@depup/angular__cli 21.2.1-depup.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +36 -0
- package/bin/bootstrap.js +33 -0
- package/bin/ng.js +71 -0
- package/bin/package.json +3 -0
- package/changes.json +30 -0
- package/lib/cli/index.d.ts +11 -0
- package/lib/cli/index.js +109 -0
- package/lib/cli/index.js.map +1 -0
- package/lib/code-examples.db +0 -0
- package/lib/config/schema.json +6150 -0
- package/lib/config/workspace-schema.d.ts +1025 -0
- package/lib/config/workspace-schema.js +133 -0
- package/lib/config/workspace-schema.js.map +1 -0
- package/lib/init.d.ts +8 -0
- package/lib/init.js +162 -0
- package/lib/init.js.map +1 -0
- package/package.json +103 -0
- package/src/analytics/analytics-collector.d.ts +35 -0
- package/src/analytics/analytics-collector.js +195 -0
- package/src/analytics/analytics-collector.js.map +1 -0
- package/src/analytics/analytics-parameters.d.ts +101 -0
- package/src/analytics/analytics-parameters.js +107 -0
- package/src/analytics/analytics-parameters.js.map +1 -0
- package/src/analytics/analytics.d.ts +27 -0
- package/src/analytics/analytics.js +183 -0
- package/src/analytics/analytics.js.map +1 -0
- package/src/command-builder/architect-base-command-module.d.ts +30 -0
- package/src/command-builder/architect-base-command-module.js +244 -0
- package/src/command-builder/architect-base-command-module.js.map +1 -0
- package/src/command-builder/architect-command-module.d.ts +28 -0
- package/src/command-builder/architect-command-module.js +218 -0
- package/src/command-builder/architect-command-module.js.map +1 -0
- package/src/command-builder/command-module.d.ts +73 -0
- package/src/command-builder/command-module.js +245 -0
- package/src/command-builder/command-module.js.map +1 -0
- package/src/command-builder/command-runner.d.ts +9 -0
- package/src/command-builder/command-runner.js +195 -0
- package/src/command-builder/command-runner.js.map +1 -0
- package/src/command-builder/definitions.d.ts +41 -0
- package/src/command-builder/definitions.js +20 -0
- package/src/command-builder/definitions.js.map +1 -0
- package/src/command-builder/schematics-command-module.d.ts +41 -0
- package/src/command-builder/schematics-command-module.js +408 -0
- package/src/command-builder/schematics-command-module.js.map +1 -0
- package/src/command-builder/utilities/command.d.ts +13 -0
- package/src/command-builder/utilities/command.js +39 -0
- package/src/command-builder/utilities/command.js.map +1 -0
- package/src/command-builder/utilities/json-help.d.ts +37 -0
- package/src/command-builder/utilities/json-help.js +92 -0
- package/src/command-builder/utilities/json-help.js.map +1 -0
- package/src/command-builder/utilities/json-schema.d.ts +64 -0
- package/src/command-builder/utilities/json-schema.js +349 -0
- package/src/command-builder/utilities/json-schema.js.map +1 -0
- package/src/command-builder/utilities/normalize-options-middleware.d.ts +18 -0
- package/src/command-builder/utilities/normalize-options-middleware.js +37 -0
- package/src/command-builder/utilities/normalize-options-middleware.js.map +1 -0
- package/src/command-builder/utilities/schematic-engine-host.d.ts +15 -0
- package/src/command-builder/utilities/schematic-engine-host.js +179 -0
- package/src/command-builder/utilities/schematic-engine-host.js.map +1 -0
- package/src/command-builder/utilities/schematic-workflow.d.ts +14 -0
- package/src/command-builder/utilities/schematic-workflow.js +70 -0
- package/src/command-builder/utilities/schematic-workflow.js.map +1 -0
- package/src/commands/add/cli.d.ts +38 -0
- package/src/commands/add/cli.js +623 -0
- package/src/commands/add/cli.js.map +1 -0
- package/src/commands/add/long-description.md +7 -0
- package/src/commands/analytics/cli.d.ts +16 -0
- package/src/commands/analytics/cli.js +34 -0
- package/src/commands/analytics/cli.js.map +1 -0
- package/src/commands/analytics/info/cli.d.ts +16 -0
- package/src/commands/analytics/info/cli.js +25 -0
- package/src/commands/analytics/info/cli.js.map +1 -0
- package/src/commands/analytics/long-description.md +20 -0
- package/src/commands/analytics/settings/cli.d.ts +35 -0
- package/src/commands/analytics/settings/cli.js +54 -0
- package/src/commands/analytics/settings/cli.js.map +1 -0
- package/src/commands/build/cli.d.ts +16 -0
- package/src/commands/build/cli.js +21 -0
- package/src/commands/build/cli.js.map +1 -0
- package/src/commands/build/long-description.md +18 -0
- package/src/commands/cache/clean/cli.d.ts +17 -0
- package/src/commands/cache/clean/cli.js +32 -0
- package/src/commands/cache/clean/cli.js.map +1 -0
- package/src/commands/cache/cli.d.ts +17 -0
- package/src/commands/cache/cli.js +36 -0
- package/src/commands/cache/cli.js.map +1 -0
- package/src/commands/cache/info/cli.d.ts +20 -0
- package/src/commands/cache/info/cli.js +139 -0
- package/src/commands/cache/info/cli.js.map +1 -0
- package/src/commands/cache/long-description.md +53 -0
- package/src/commands/cache/settings/cli.d.ts +27 -0
- package/src/commands/cache/settings/cli.js +41 -0
- package/src/commands/cache/settings/cli.js.map +1 -0
- package/src/commands/cache/utilities.d.ts +11 -0
- package/src/commands/cache/utilities.js +47 -0
- package/src/commands/cache/utilities.js.map +1 -0
- package/src/commands/command-config.d.ts +17 -0
- package/src/commands/command-config.js +116 -0
- package/src/commands/command-config.js.map +1 -0
- package/src/commands/completion/cli.d.ts +16 -0
- package/src/commands/completion/cli.js +61 -0
- package/src/commands/completion/cli.js.map +1 -0
- package/src/commands/completion/long-description.md +67 -0
- package/src/commands/config/cli.d.ts +24 -0
- package/src/commands/config/cli.js +150 -0
- package/src/commands/config/cli.js.map +1 -0
- package/src/commands/config/long-description.md +13 -0
- package/src/commands/deploy/cli.d.ts +17 -0
- package/src/commands/deploy/cli.js +38 -0
- package/src/commands/deploy/cli.js.map +1 -0
- package/src/commands/deploy/long-description.md +22 -0
- package/src/commands/e2e/cli.d.ts +18 -0
- package/src/commands/e2e/cli.js +42 -0
- package/src/commands/e2e/cli.js.map +1 -0
- package/src/commands/extract-i18n/cli.d.ts +17 -0
- package/src/commands/extract-i18n/cli.js +48 -0
- package/src/commands/extract-i18n/cli.js.map +1 -0
- package/src/commands/generate/cli.d.ts +47 -0
- package/src/commands/generate/cli.js +189 -0
- package/src/commands/generate/cli.js.map +1 -0
- package/src/commands/lint/cli.d.ts +17 -0
- package/src/commands/lint/cli.js +25 -0
- package/src/commands/lint/cli.js.map +1 -0
- package/src/commands/lint/long-description.md +20 -0
- package/src/commands/make-this-awesome/cli.d.ts +17 -0
- package/src/commands/make-this-awesome/cli.js +36 -0
- package/src/commands/make-this-awesome/cli.js.map +1 -0
- package/src/commands/mcp/cli.d.ts +20 -0
- package/src/commands/mcp/cli.js +74 -0
- package/src/commands/mcp/cli.js.map +1 -0
- package/src/commands/mcp/constants.d.ts +10 -0
- package/src/commands/mcp/constants.js +16 -0
- package/src/commands/mcp/constants.js.map +1 -0
- package/src/commands/mcp/devserver.d.ts +85 -0
- package/src/commands/mcp/devserver.js +112 -0
- package/src/commands/mcp/devserver.js.map +1 -0
- package/src/commands/mcp/host.d.ts +97 -0
- package/src/commands/mcp/host.js +118 -0
- package/src/commands/mcp/host.js.map +1 -0
- package/src/commands/mcp/mcp-server.d.ts +192 -0
- package/src/commands/mcp/mcp-server.js +155 -0
- package/src/commands/mcp/mcp-server.js.map +1 -0
- package/src/commands/mcp/resources/ai-tutor.md +824 -0
- package/src/commands/mcp/resources/best-practices.md +54 -0
- package/src/commands/mcp/resources/instructions.d.ts +9 -0
- package/src/commands/mcp/resources/instructions.js +26 -0
- package/src/commands/mcp/resources/instructions.js.map +1 -0
- package/src/commands/mcp/shared-options.d.ts +12 -0
- package/src/commands/mcp/shared-options.js +22 -0
- package/src/commands/mcp/shared-options.js.map +1 -0
- package/src/commands/mcp/tools/ai-tutor.d.ts +12 -0
- package/src/commands/mcp/tools/ai-tutor.js +59 -0
- package/src/commands/mcp/tools/ai-tutor.js.map +1 -0
- package/src/commands/mcp/tools/best-practices.d.ts +13 -0
- package/src/commands/mcp/tools/best-practices.js +187 -0
- package/src/commands/mcp/tools/best-practices.js.map +1 -0
- package/src/commands/mcp/tools/build.d.ts +37 -0
- package/src/commands/mcp/tools/build.js +89 -0
- package/src/commands/mcp/tools/build.js.map +1 -0
- package/src/commands/mcp/tools/devserver/devserver-start.d.ts +31 -0
- package/src/commands/mcp/tools/devserver/devserver-start.js +91 -0
- package/src/commands/mcp/tools/devserver/devserver-start.js.map +1 -0
- package/src/commands/mcp/tools/devserver/devserver-stop.d.ts +31 -0
- package/src/commands/mcp/tools/devserver/devserver-stop.js +68 -0
- package/src/commands/mcp/tools/devserver/devserver-stop.js.map +1 -0
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.d.ts +41 -0
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js +104 -0
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js.map +1 -0
- package/src/commands/mcp/tools/doc-search.d.ts +21 -0
- package/src/commands/mcp/tools/doc-search.js +324 -0
- package/src/commands/mcp/tools/doc-search.js.map +1 -0
- package/src/commands/mcp/tools/e2e.d.ts +44 -0
- package/src/commands/mcp/tools/e2e.js +87 -0
- package/src/commands/mcp/tools/e2e.js.map +1 -0
- package/src/commands/mcp/tools/examples/database-discovery.d.ts +34 -0
- package/src/commands/mcp/tools/examples/database-discovery.js +87 -0
- package/src/commands/mcp/tools/examples/database-discovery.js.map +1 -0
- package/src/commands/mcp/tools/examples/database.d.ts +35 -0
- package/src/commands/mcp/tools/examples/database.js +125 -0
- package/src/commands/mcp/tools/examples/database.js.map +1 -0
- package/src/commands/mcp/tools/examples/index.d.ts +26 -0
- package/src/commands/mcp/tools/examples/index.js +149 -0
- package/src/commands/mcp/tools/examples/index.js.map +1 -0
- package/src/commands/mcp/tools/examples/query-escaper.d.ts +20 -0
- package/src/commands/mcp/tools/examples/query-escaper.js +68 -0
- package/src/commands/mcp/tools/examples/query-escaper.js.map +1 -0
- package/src/commands/mcp/tools/examples/runtime-database.d.ts +10 -0
- package/src/commands/mcp/tools/examples/runtime-database.js +192 -0
- package/src/commands/mcp/tools/examples/runtime-database.js.map +1 -0
- package/src/commands/mcp/tools/examples/schemas.d.ts +29 -0
- package/src/commands/mcp/tools/examples/schemas.js +101 -0
- package/src/commands/mcp/tools/examples/schemas.js.map +1 -0
- package/src/commands/mcp/tools/examples/utils.d.ts +14 -0
- package/src/commands/mcp/tools/examples/utils.js +31 -0
- package/src/commands/mcp/tools/examples/utils.js.map +1 -0
- package/src/commands/mcp/tools/modernize.d.ts +43 -0
- package/src/commands/mcp/tools/modernize.js +165 -0
- package/src/commands/mcp/tools/modernize.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.d.ts +17 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.js +62 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.d.ts +12 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js +73 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.d.ts +11 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js +60 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.d.ts +15 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js +238 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.d.ts +10 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.js +20 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.d.ts +35 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js +136 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/types.d.ts +13 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/types.js +10 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/types.js.map +1 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.d.ts +16 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js +224 -0
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js.map +1 -0
- package/src/commands/mcp/tools/projects.d.ts +47 -0
- package/src/commands/mcp/tools/projects.js +523 -0
- package/src/commands/mcp/tools/projects.js.map +1 -0
- package/src/commands/mcp/tools/test.d.ts +35 -0
- package/src/commands/mcp/tools/test.js +79 -0
- package/src/commands/mcp/tools/test.js.map +1 -0
- package/src/commands/mcp/tools/tool-registry.d.ts +39 -0
- package/src/commands/mcp/tools/tool-registry.js +35 -0
- package/src/commands/mcp/tools/tool-registry.js.map +1 -0
- package/src/commands/mcp/utils.d.ts +25 -0
- package/src/commands/mcp/utils.js +44 -0
- package/src/commands/mcp/utils.js.map +1 -0
- package/src/commands/mcp/workspace-utils.d.ts +53 -0
- package/src/commands/mcp/workspace-utils.js +138 -0
- package/src/commands/mcp/workspace-utils.js.map +1 -0
- package/src/commands/new/cli.d.ts +27 -0
- package/src/commands/new/cli.js +76 -0
- package/src/commands/new/cli.js.map +1 -0
- package/src/commands/new/long-description.md +15 -0
- package/src/commands/run/cli.d.ts +25 -0
- package/src/commands/run/cli.js +89 -0
- package/src/commands/run/cli.js.map +1 -0
- package/src/commands/run/long-description.md +10 -0
- package/src/commands/serve/cli.d.ts +16 -0
- package/src/commands/serve/cli.js +20 -0
- package/src/commands/serve/cli.js.map +1 -0
- package/src/commands/test/cli.d.ts +16 -0
- package/src/commands/test/cli.js +21 -0
- package/src/commands/test/cli.js.map +1 -0
- package/src/commands/test/long-description.md +2 -0
- package/src/commands/update/cli.d.ts +34 -0
- package/src/commands/update/cli.js +531 -0
- package/src/commands/update/cli.js.map +1 -0
- package/src/commands/update/long-description.md +22 -0
- package/src/commands/update/schematic/collection.json +9 -0
- package/src/commands/update/schematic/index.d.ts +11 -0
- package/src/commands/update/schematic/index.js +715 -0
- package/src/commands/update/schematic/index.js.map +1 -0
- package/src/commands/update/schematic/schema.d.ts +51 -0
- package/src/commands/update/schematic/schema.js +16 -0
- package/src/commands/update/schematic/schema.js.map +1 -0
- package/src/commands/update/schematic/schema.json +64 -0
- package/src/commands/update/utilities/cli-version.d.ts +48 -0
- package/src/commands/update/utilities/cli-version.js +196 -0
- package/src/commands/update/utilities/cli-version.js.map +1 -0
- package/src/commands/update/utilities/constants.d.ts +12 -0
- package/src/commands/update/utilities/constants.js +16 -0
- package/src/commands/update/utilities/constants.js.map +1 -0
- package/src/commands/update/utilities/git.d.ts +36 -0
- package/src/commands/update/utilities/git.js +148 -0
- package/src/commands/update/utilities/git.js.map +1 -0
- package/src/commands/update/utilities/migration.d.ts +32 -0
- package/src/commands/update/utilities/migration.js +267 -0
- package/src/commands/update/utilities/migration.js.map +1 -0
- package/src/commands/version/cli.d.ts +36 -0
- package/src/commands/version/cli.js +117 -0
- package/src/commands/version/cli.js.map +1 -0
- package/src/commands/version/version-info.d.ts +46 -0
- package/src/commands/version/version-info.js +107 -0
- package/src/commands/version/version-info.js.map +1 -0
- package/src/package-managers/discovery.d.ts +23 -0
- package/src/package-managers/discovery.js +104 -0
- package/src/package-managers/discovery.js.map +1 -0
- package/src/package-managers/error.d.ts +43 -0
- package/src/package-managers/error.js +41 -0
- package/src/package-managers/error.js.map +1 -0
- package/src/package-managers/factory.d.ts +30 -0
- package/src/package-managers/factory.js +137 -0
- package/src/package-managers/factory.js.map +1 -0
- package/src/package-managers/host.d.ts +86 -0
- package/src/package-managers/host.js +80 -0
- package/src/package-managers/host.js.map +1 -0
- package/src/package-managers/index.d.ts +13 -0
- package/src/package-managers/index.js +17 -0
- package/src/package-managers/index.js.map +1 -0
- package/src/package-managers/logger.d.ts +27 -0
- package/src/package-managers/logger.js +10 -0
- package/src/package-managers/logger.js.map +1 -0
- package/src/package-managers/package-manager-descriptor.d.ts +245 -0
- package/src/package-managers/package-manager-descriptor.js +175 -0
- package/src/package-managers/package-manager-descriptor.js.map +1 -0
- package/src/package-managers/package-manager.d.ts +191 -0
- package/src/package-managers/package-manager.js +496 -0
- package/src/package-managers/package-manager.js.map +1 -0
- package/src/package-managers/package-metadata.d.ts +91 -0
- package/src/package-managers/package-metadata.js +10 -0
- package/src/package-managers/package-metadata.js.map +1 -0
- package/src/package-managers/package-tree.d.ts +23 -0
- package/src/package-managers/package-tree.js +10 -0
- package/src/package-managers/package-tree.js.map +1 -0
- package/src/package-managers/parsers.d.ts +170 -0
- package/src/package-managers/parsers.js +467 -0
- package/src/package-managers/parsers.js.map +1 -0
- package/src/utilities/color.d.ts +9 -0
- package/src/utilities/color.js +28 -0
- package/src/utilities/color.js.map +1 -0
- package/src/utilities/completion.d.ts +30 -0
- package/src/utilities/completion.js +270 -0
- package/src/utilities/completion.js.map +1 -0
- package/src/utilities/config.d.ts +38 -0
- package/src/utilities/config.js +369 -0
- package/src/utilities/config.js.map +1 -0
- package/src/utilities/environment-options.d.ts +25 -0
- package/src/utilities/environment-options.js +60 -0
- package/src/utilities/environment-options.js.map +1 -0
- package/src/utilities/eol.d.ts +20 -0
- package/src/utilities/eol.js +35 -0
- package/src/utilities/eol.js.map +1 -0
- package/src/utilities/error.d.ts +18 -0
- package/src/utilities/error.js +41 -0
- package/src/utilities/error.js.map +1 -0
- package/src/utilities/find-up.d.ts +21 -0
- package/src/utilities/find-up.js +67 -0
- package/src/utilities/find-up.js.map +1 -0
- package/src/utilities/json-file.d.ts +24 -0
- package/src/utilities/json-file.js +179 -0
- package/src/utilities/json-file.js.map +1 -0
- package/src/utilities/log-file.d.ts +13 -0
- package/src/utilities/log-file.js +28 -0
- package/src/utilities/log-file.js.map +1 -0
- package/src/utilities/memoize.d.ts +15 -0
- package/src/utilities/memoize.js +64 -0
- package/src/utilities/memoize.js.map +1 -0
- package/src/utilities/package-metadata.d.ts +58 -0
- package/src/utilities/package-metadata.js +265 -0
- package/src/utilities/package-metadata.js.map +1 -0
- package/src/utilities/prettier.d.ts +13 -0
- package/src/utilities/prettier.js +46 -0
- package/src/utilities/prettier.js.map +1 -0
- package/src/utilities/project.d.ts +8 -0
- package/src/utilities/project.js +81 -0
- package/src/utilities/project.js.map +1 -0
- package/src/utilities/prompt.d.ts +17 -0
- package/src/utilities/prompt.js +90 -0
- package/src/utilities/prompt.js.map +1 -0
- package/src/utilities/tty.d.ts +16 -0
- package/src/utilities/tty.js +23 -0
- package/src/utilities/tty.js.map +1 -0
- package/src/utilities/version.d.ts +16 -0
- package/src/utilities/version.js +26 -0
- package/src/utilities/version.js.map +1 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.findUp = findUp;
|
|
11
|
+
exports.findUpSync = findUpSync;
|
|
12
|
+
const node_fs_1 = require("node:fs");
|
|
13
|
+
const promises_1 = require("node:fs/promises");
|
|
14
|
+
const node_path_1 = require("node:path");
|
|
15
|
+
/**
|
|
16
|
+
* Find a file or directory by walking up the directory tree.
|
|
17
|
+
* @param names The name or names of the files or directories to find.
|
|
18
|
+
* @param from The directory to start the search from.
|
|
19
|
+
* @returns The path to the first match found, or `null` if no match was found.
|
|
20
|
+
*/
|
|
21
|
+
async function findUp(names, from) {
|
|
22
|
+
const filenames = Array.isArray(names) ? names : [names];
|
|
23
|
+
let currentDir = (0, node_path_1.resolve)(from);
|
|
24
|
+
while (true) {
|
|
25
|
+
for (const name of filenames) {
|
|
26
|
+
const p = (0, node_path_1.join)(currentDir, name);
|
|
27
|
+
try {
|
|
28
|
+
await (0, promises_1.stat)(p);
|
|
29
|
+
return p;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Ignore errors (e.g. file not found).
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const parentDir = (0, node_path_1.dirname)(currentDir);
|
|
36
|
+
if (parentDir === currentDir) {
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
currentDir = parentDir;
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Synchronously find a file or directory by walking up the directory tree.
|
|
45
|
+
* @param names The name or names of the files or directories to find.
|
|
46
|
+
* @param from The directory to start the search from.
|
|
47
|
+
* @returns The path to the first match found, or `null` if no match was found.
|
|
48
|
+
*/
|
|
49
|
+
function findUpSync(names, from) {
|
|
50
|
+
const filenames = Array.isArray(names) ? names : [names];
|
|
51
|
+
let currentDir = (0, node_path_1.resolve)(from);
|
|
52
|
+
while (true) {
|
|
53
|
+
for (const name of filenames) {
|
|
54
|
+
const p = (0, node_path_1.join)(currentDir, name);
|
|
55
|
+
if ((0, node_fs_1.existsSync)(p)) {
|
|
56
|
+
return p;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const parentDir = (0, node_path_1.dirname)(currentDir);
|
|
60
|
+
if (parentDir === currentDir) {
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
currentDir = parentDir;
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=find-up.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-up.js","sourceRoot":"","sources":["find-up.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAYH,wBAyBC;AAQD,gCAqBC;AAhED,qCAAqC;AACrC,+CAAwC;AACxC,yCAAmD;AAEnD;;;;;GAKG;AACI,KAAK,UAAU,MAAM,CAAC,KAAwB,EAAE,IAAY;IACjE,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAEzD,IAAI,UAAU,GAAG,IAAA,mBAAO,EAAC,IAAI,CAAC,CAA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-0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { JsonValue } from '@angular-devkit/core';
|
|
9
|
+
/** A function that returns an index to insert a new property in a JSON object. */
|
|
10
|
+
export type InsertionIndex = (properties: string[]) => number;
|
|
11
|
+
/** A JSON path. */
|
|
12
|
+
export type JSONPath = (string | number)[];
|
|
13
|
+
/**
|
|
14
|
+
* Reads and parses a JSON file, supporting comments and trailing commas.
|
|
15
|
+
* @param path The path to the JSON file.
|
|
16
|
+
* @returns The parsed JSON object.
|
|
17
|
+
*/
|
|
18
|
+
export declare function readAndParseJson<T extends JsonValue>(path: string): T;
|
|
19
|
+
/**
|
|
20
|
+
* Parses a JSON string, supporting comments and trailing commas.
|
|
21
|
+
* @param content The JSON string to parse.
|
|
22
|
+
* @returns The parsed JSON object.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseJson<T extends JsonValue>(content: string): T;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.JSONFile = void 0;
|
|
11
|
+
exports.readAndParseJson = readAndParseJson;
|
|
12
|
+
exports.parseJson = parseJson;
|
|
13
|
+
const jsonc_parser_1 = require("jsonc-parser");
|
|
14
|
+
const node_fs_1 = require("node:fs");
|
|
15
|
+
const eol_1 = require("./eol");
|
|
16
|
+
const error_1 = require("./error");
|
|
17
|
+
/**
|
|
18
|
+
* Represents a JSON file, allowing for reading, modifying, and saving.
|
|
19
|
+
* This class uses `jsonc-parser` to preserve comments and formatting, including
|
|
20
|
+
* indentation and end-of-line sequences.
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
class JSONFile {
|
|
24
|
+
/** The raw content of the JSON file. */
|
|
25
|
+
#content;
|
|
26
|
+
/** The end-of-line sequence used in the file. */
|
|
27
|
+
#eol;
|
|
28
|
+
/** Whether the file uses spaces for indentation. */
|
|
29
|
+
#insertSpaces = true;
|
|
30
|
+
/** The number of spaces or tabs used for indentation. */
|
|
31
|
+
#tabSize = 2;
|
|
32
|
+
/** The path to the JSON file. */
|
|
33
|
+
#path;
|
|
34
|
+
/** The parsed JSON abstract syntax tree. */
|
|
35
|
+
#jsonAst;
|
|
36
|
+
/** The raw content of the JSON file. */
|
|
37
|
+
get content() {
|
|
38
|
+
return this.#content;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates an instance of JSONFile.
|
|
42
|
+
* @param path The path to the JSON file.
|
|
43
|
+
*/
|
|
44
|
+
constructor(path) {
|
|
45
|
+
this.#path = path;
|
|
46
|
+
try {
|
|
47
|
+
this.#content = (0, node_fs_1.readFileSync)(this.#path, 'utf-8');
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
(0, error_1.assertIsError)(e);
|
|
51
|
+
// We don't have to worry about ENOENT, since we'll be creating the file.
|
|
52
|
+
if (e.code !== 'ENOENT') {
|
|
53
|
+
throw e;
|
|
54
|
+
}
|
|
55
|
+
this.#content = '';
|
|
56
|
+
}
|
|
57
|
+
this.#eol = (0, eol_1.getEOL)(this.#content);
|
|
58
|
+
this.#detectIndentation();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Gets the parsed JSON abstract syntax tree.
|
|
62
|
+
* The AST is lazily parsed and cached.
|
|
63
|
+
*/
|
|
64
|
+
get JsonAst() {
|
|
65
|
+
if (this.#jsonAst) {
|
|
66
|
+
return this.#jsonAst;
|
|
67
|
+
}
|
|
68
|
+
const errors = [];
|
|
69
|
+
this.#jsonAst = (0, jsonc_parser_1.parseTree)(this.#content, errors, { allowTrailingComma: true });
|
|
70
|
+
if (errors.length) {
|
|
71
|
+
formatError(this.#path, errors);
|
|
72
|
+
}
|
|
73
|
+
return this.#jsonAst;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Gets a value from the JSON file at a specific path.
|
|
77
|
+
* @param jsonPath The path to the value.
|
|
78
|
+
* @returns The value at the given path, or `undefined` if not found.
|
|
79
|
+
*/
|
|
80
|
+
get(jsonPath) {
|
|
81
|
+
const jsonAstNode = this.JsonAst;
|
|
82
|
+
if (!jsonAstNode) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
if (jsonPath.length === 0) {
|
|
86
|
+
return (0, jsonc_parser_1.getNodeValue)(jsonAstNode);
|
|
87
|
+
}
|
|
88
|
+
const node = (0, jsonc_parser_1.findNodeAtLocation)(jsonAstNode, jsonPath);
|
|
89
|
+
return node === undefined ? undefined : (0, jsonc_parser_1.getNodeValue)(node);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Modifies a value in the JSON file.
|
|
93
|
+
* @param jsonPath The path to the value to modify.
|
|
94
|
+
* @param value The new value to insert.
|
|
95
|
+
* @param insertInOrder A function to determine the insertion index, or `false` to insert at the end.
|
|
96
|
+
* @returns `true` if the modification was successful, `false` otherwise.
|
|
97
|
+
*/
|
|
98
|
+
modify(jsonPath, value, insertInOrder) {
|
|
99
|
+
if (value === undefined && this.get(jsonPath) === undefined) {
|
|
100
|
+
// Cannot remove a value which doesn't exist.
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
let getInsertionIndex;
|
|
104
|
+
if (insertInOrder === undefined) {
|
|
105
|
+
const property = jsonPath.slice(-1)[0];
|
|
106
|
+
getInsertionIndex = (properties) => [...properties, property].sort().findIndex((p) => p === property);
|
|
107
|
+
}
|
|
108
|
+
else if (insertInOrder !== false) {
|
|
109
|
+
getInsertionIndex = insertInOrder;
|
|
110
|
+
}
|
|
111
|
+
const edits = (0, jsonc_parser_1.modify)(this.#content, jsonPath, value, {
|
|
112
|
+
getInsertionIndex,
|
|
113
|
+
formattingOptions: {
|
|
114
|
+
insertSpaces: this.#insertSpaces,
|
|
115
|
+
tabSize: this.#tabSize,
|
|
116
|
+
eol: this.#eol,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
if (edits.length === 0) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
this.#content = (0, jsonc_parser_1.applyEdits)(this.#content, edits);
|
|
123
|
+
this.#jsonAst = undefined;
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Deletes a value from the JSON file at a specific path.
|
|
128
|
+
* @param jsonPath The path to the value to delete.
|
|
129
|
+
* @returns `true` if the deletion was successful, `false` otherwise.
|
|
130
|
+
*/
|
|
131
|
+
delete(jsonPath) {
|
|
132
|
+
return this.modify(jsonPath, undefined);
|
|
133
|
+
}
|
|
134
|
+
/** Saves the modified content back to the file. */
|
|
135
|
+
save() {
|
|
136
|
+
(0, node_fs_1.writeFileSync)(this.#path, this.#content);
|
|
137
|
+
}
|
|
138
|
+
/** Detects the indentation of the file. */
|
|
139
|
+
#detectIndentation() {
|
|
140
|
+
// Find the first line that has indentation.
|
|
141
|
+
const match = this.#content.match(/^(?:( )+|\t+)\S/m);
|
|
142
|
+
if (match) {
|
|
143
|
+
this.#insertSpaces = !!match[1];
|
|
144
|
+
this.#tabSize = match[0].length - 1;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.JSONFile = JSONFile;
|
|
149
|
+
/**
|
|
150
|
+
* Reads and parses a JSON file, supporting comments and trailing commas.
|
|
151
|
+
* @param path The path to the JSON file.
|
|
152
|
+
* @returns The parsed JSON object.
|
|
153
|
+
*/
|
|
154
|
+
function readAndParseJson(path) {
|
|
155
|
+
const errors = [];
|
|
156
|
+
const content = (0, jsonc_parser_1.parse)((0, node_fs_1.readFileSync)(path, 'utf-8'), errors, { allowTrailingComma: true });
|
|
157
|
+
if (errors.length) {
|
|
158
|
+
formatError(path, errors);
|
|
159
|
+
}
|
|
160
|
+
return content;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Formats a JSON parsing error and throws an exception.
|
|
164
|
+
* @param path The path to the file that failed to parse.
|
|
165
|
+
* @param errors The list of parsing errors.
|
|
166
|
+
*/
|
|
167
|
+
function formatError(path, errors) {
|
|
168
|
+
const { error, offset } = errors[0];
|
|
169
|
+
throw new Error(`Failed to parse "${path}" as JSON AST Object. ${(0, jsonc_parser_1.printParseErrorCode)(error)} at location: ${offset}.`);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Parses a JSON string, supporting comments and trailing commas.
|
|
173
|
+
* @param content The JSON string to parse.
|
|
174
|
+
* @returns The parsed JSON object.
|
|
175
|
+
*/
|
|
176
|
+
function parseJson(content) {
|
|
177
|
+
return (0, jsonc_parser_1.parse)(content, undefined, { allowTrailingComma: true });
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=json-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-file.js","sourceRoot":"","sources":["json-file.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA6LH,4CAQC;AAqBD,8BAEC;AAzND,+CAUsB;AACtB,qCAAsD;AACtD,+BAA+B;AAC/B,mCAAwC;AAQxC;;;;;GAKG;AACH,MAAa,QAAQ;IACnB,wCAAwC;IACxC,QAAQ,CAAS;IAEjB,iDAAiD;IACjD,IAAI,CAAS;IAEb,oDAAoD;IACpD,aAAa,GAAG,IAAI,CAAC;IAErB,yDAAyD;IACzD,QAAQ,GAAG,CAAC,CAAC;IAEb,iCAAiC;IACjC,KAAK,CAAS;IAEd,4CAA4C;IAC5C,QAAQ,CAAmB;IAE3B,wCAAwC;IACxC,IAAW,OAAO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;GAIG;AACH,SAAS,WAAW,CAAC,IAAY,EAAE,MAAoB;IACrD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,IAAI,KAAK,CACb,oBAAoB,IAAI,yBAAyB,IAAA,kCAAmB,EAClE,KAAK,CACN,iBAAiB,MAAM,GAAG,CAC5B,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,SAAS,CAAsB,OAAe;IAC5D,OAAO,IAAA,oBAAK,EAAC,OAAO,EAAE,SAAS,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAM,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Writes an Error to a temporary log file.
|
|
10
|
+
* If this method is called multiple times from the same process the same log file will be used.
|
|
11
|
+
* @returns The path of the generated log file.
|
|
12
|
+
*/
|
|
13
|
+
export declare function writeErrorToLogFile(error: Error): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.writeErrorToLogFile = writeErrorToLogFile;
|
|
11
|
+
const node_fs_1 = require("node:fs");
|
|
12
|
+
const node_os_1 = require("node:os");
|
|
13
|
+
const node_path_1 = require("node:path");
|
|
14
|
+
let logPath;
|
|
15
|
+
/**
|
|
16
|
+
* Writes an Error to a temporary log file.
|
|
17
|
+
* If this method is called multiple times from the same process the same log file will be used.
|
|
18
|
+
* @returns The path of the generated log file.
|
|
19
|
+
*/
|
|
20
|
+
function writeErrorToLogFile(error) {
|
|
21
|
+
if (!logPath) {
|
|
22
|
+
const tempDirectory = (0, node_fs_1.mkdtempSync)((0, node_fs_1.realpathSync)((0, node_os_1.tmpdir)()) + '/ng-');
|
|
23
|
+
logPath = (0, node_path_1.normalize)(tempDirectory + '/angular-errors.log');
|
|
24
|
+
}
|
|
25
|
+
(0, node_fs_1.appendFileSync)(logPath, '[error] ' + (error.stack || error) + '\n\n');
|
|
26
|
+
return logPath;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=log-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-file.js","sourceRoot":"","sources":["log-file.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAaH,kDASC;AApBD,qCAAoE;AACpE,qCAAiC;AACjC,yCAAsC;AAEtC,IAAI,OAA2B,CAAC;AAEhC;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,KAAY;IAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,aAAa,GAAG,IAAA,qBAAW,EAAC,IAAA,sBAAY,EAAC,IAAA,gBAAM,GAAE,CAAC,GAAG,MAAM,CAAC,CAAC;QACnE,OAAO,GAAG,IAAA,qBAAS,EAAC,aAAa,GAAG,qBAAqB,CAAC,CAAC;IAC7D,CAAC;IAED,IAAA,wBAAc,EAAC,OAAO,EAAE,UAAU,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC;IAEtE,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* A decorator that memoizes methods and getters.
|
|
10
|
+
*
|
|
11
|
+
* **Note**: Be cautious where and how to use this decorator as the size of the cache will grow unbounded.
|
|
12
|
+
*
|
|
13
|
+
* @see https://en.wikipedia.org/wiki/Memoization
|
|
14
|
+
*/
|
|
15
|
+
export declare function memoize<This, Args extends unknown[], Return>(target: (this: This, ...args: Args) => Return, context: ClassMemberDecoratorContext): (this: This, ...args: Args) => Return;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.memoize = memoize;
|
|
11
|
+
/**
|
|
12
|
+
* A decorator that memoizes methods and getters.
|
|
13
|
+
*
|
|
14
|
+
* **Note**: Be cautious where and how to use this decorator as the size of the cache will grow unbounded.
|
|
15
|
+
*
|
|
16
|
+
* @see https://en.wikipedia.org/wiki/Memoization
|
|
17
|
+
*/
|
|
18
|
+
function memoize(target, context) {
|
|
19
|
+
if (context.kind !== 'method' && context.kind !== 'getter') {
|
|
20
|
+
throw new Error('Memoize decorator can only be used on methods or get accessors.');
|
|
21
|
+
}
|
|
22
|
+
const cache = new Map();
|
|
23
|
+
return function (...args) {
|
|
24
|
+
for (const arg of args) {
|
|
25
|
+
if (!isJSONSerializable(arg)) {
|
|
26
|
+
throw new Error(`Argument ${isNonPrimitive(arg) ? arg.toString() : arg} is JSON serializable.`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const key = JSON.stringify(args);
|
|
30
|
+
if (cache.has(key)) {
|
|
31
|
+
return cache.get(key);
|
|
32
|
+
}
|
|
33
|
+
const result = target.apply(this, args);
|
|
34
|
+
cache.set(key, result);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Method to check if value is a non primitive. */
|
|
39
|
+
function isNonPrimitive(value) {
|
|
40
|
+
return ((value !== null && typeof value === 'object') ||
|
|
41
|
+
typeof value === 'function' ||
|
|
42
|
+
typeof value === 'symbol');
|
|
43
|
+
}
|
|
44
|
+
/** Method to check if the values are JSON serializable */
|
|
45
|
+
function isJSONSerializable(value) {
|
|
46
|
+
if (!isNonPrimitive(value)) {
|
|
47
|
+
// Can be seralized since it's a primitive.
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
let nestedValues;
|
|
51
|
+
if (Array.isArray(value)) {
|
|
52
|
+
// It's an array, check each item.
|
|
53
|
+
nestedValues = value;
|
|
54
|
+
}
|
|
55
|
+
else if (Object.prototype.toString.call(value) === '[object Object]') {
|
|
56
|
+
// It's a plain object, check each value.
|
|
57
|
+
nestedValues = Object.values(value);
|
|
58
|
+
}
|
|
59
|
+
if (!nestedValues || nestedValues.some((v) => !isJSONSerializable(v))) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=memoize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoize.js","sourceRoot":"","sources":["memoize.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AASH,0BA6BC;AApCD;;;;;;GAMG;AACH,SAAgB,OAAO,CACrB,MAA6C,EAC7C,OAAoC;IAEpC,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;IACrF,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IAExC,OAAO,UAAsB,GAAG,I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KAAK,CAAC,KAAK,iBAAiB,EAAE,CAAC;QACvE,yCAAyC;QACzC,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { logging } from '@angular-devkit/core';
|
|
9
|
+
import type { Manifest, Packument } from 'pacote';
|
|
10
|
+
export interface PackageMetadata extends Packument, NgPackageManifestProperties {
|
|
11
|
+
tags: Record<string, PackageManifest>;
|
|
12
|
+
versions: Record<string, PackageManifest>;
|
|
13
|
+
}
|
|
14
|
+
export interface NpmRepositoryPackageJson extends PackageMetadata {
|
|
15
|
+
requestedName?: string;
|
|
16
|
+
}
|
|
17
|
+
export type NgAddSaveDependency = 'dependencies' | 'devDependencies' | boolean;
|
|
18
|
+
export interface PackageIdentifier {
|
|
19
|
+
type: 'git' | 'tag' | 'version' | 'range' | 'file' | 'directory' | 'remote';
|
|
20
|
+
name: string;
|
|
21
|
+
scope: string | null;
|
|
22
|
+
registry: boolean;
|
|
23
|
+
raw: string;
|
|
24
|
+
fetchSpec: string;
|
|
25
|
+
rawSpec: string;
|
|
26
|
+
}
|
|
27
|
+
export interface NgPackageManifestProperties {
|
|
28
|
+
'ng-add'?: {
|
|
29
|
+
save?: NgAddSaveDependency;
|
|
30
|
+
};
|
|
31
|
+
'ng-update'?: {
|
|
32
|
+
migrations?: string;
|
|
33
|
+
packageGroup?: string[] | Record<string, string>;
|
|
34
|
+
packageGroupName?: string;
|
|
35
|
+
requirements?: string[] | Record<string, string>;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export interface PackageManifest extends Manifest, NgPackageManifestProperties {
|
|
39
|
+
deprecated?: boolean;
|
|
40
|
+
peerDependenciesMeta?: Record<string, {
|
|
41
|
+
optional?: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
44
|
+
export declare function fetchPackageMetadata(name: string, logger: logging.LoggerApi, options?: {
|
|
45
|
+
registry?: string;
|
|
46
|
+
usingYarn?: boolean;
|
|
47
|
+
verbose?: boolean;
|
|
48
|
+
}): Promise<PackageMetadata>;
|
|
49
|
+
export declare function fetchPackageManifest(name: string, logger: logging.LoggerApi, options?: {
|
|
50
|
+
registry?: string;
|
|
51
|
+
usingYarn?: boolean;
|
|
52
|
+
verbose?: boolean;
|
|
53
|
+
}): Promise<PackageManifest>;
|
|
54
|
+
export declare function getNpmPackageJson(packageName: string, logger: logging.LoggerApi, options?: {
|
|
55
|
+
registry?: string;
|
|
56
|
+
usingYarn?: boolean;
|
|
57
|
+
verbose?: boolean;
|
|
58
|
+
}): Promise<Partial<NpmRepositoryPackageJson>>;
|