@angular/cli 22.2.1 → 22.3.0-next.0
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/bin/ng.js +7 -10
- package/bin/version.js +98 -0
- package/index.d.ts +19 -0
- package/lib/chunk-5AASRQKS.js +85 -0
- package/lib/chunk-A2VIYA2E.js +165 -0
- package/lib/chunk-CAZUOCTC.js +225 -0
- package/lib/chunk-DHWVZMLH.js +206 -0
- package/lib/chunk-FZ5GFCWU.js +483 -0
- package/lib/chunk-G7TRU43D.js +42 -0
- package/lib/chunk-GHUUJYOY.js +40 -0
- package/lib/chunk-JBLF2TH3.js +267 -0
- package/lib/chunk-Q67GOPL7.js +380 -0
- package/lib/chunk-SN4KY4Z3.js +24 -0
- package/lib/chunk-XFL2J3CJ.js +24 -0
- package/lib/chunk-XG3HVNIL.js +59 -0
- package/lib/chunk-YM7ILCS5.js +2573 -0
- package/lib/cli/index.js +353 -105
- package/lib/cli-4CMZ6KMR.js +48 -0
- package/lib/cli-4Q7DGTBA.js +33 -0
- package/lib/cli-6AHY7ADW.js +96 -0
- package/lib/cli-A5UAJDO6.js +135 -0
- package/lib/cli-ACLGUIBI.js +2531 -0
- package/lib/cli-BQRFWIMG.js +35 -0
- package/lib/cli-CWICUPZW.js +42 -0
- package/lib/cli-DWQUM3M2.js +29 -0
- package/lib/cli-L4TM4JH3.js +88 -0
- package/lib/cli-LYBZEMDR.js +96 -0
- package/lib/cli-PDCEX7HQ.js +605 -0
- package/lib/cli-PJVTDBQM.js +51 -0
- package/lib/cli-PRIRL3WP.js +185 -0
- package/lib/cli-PU5VH7JB.js +189 -0
- package/lib/cli-QUH44NUB.js +68 -0
- package/lib/cli-VVITNTBC.js +50 -0
- package/lib/cli-XM4L4PP4.js +1651 -0
- package/lib/cli-Y2ECUR33.js +33 -0
- package/lib/cli-YDSMJOSO.js +182 -0
- package/lib/color-SJPGXZVA.js +8 -0
- package/lib/config/schema.json +204 -0
- package/lib/config-QXK7SSVG.js +22 -0
- package/lib/init.js +91 -180
- package/package.json +20 -15
- package/lib/cli/index.d.ts +0 -11
- package/lib/cli/index.js.map +0 -1
- package/lib/config/workspace-schema.d.ts +0 -1025
- package/lib/config/workspace-schema.js +0 -131
- package/lib/config/workspace-schema.js.map +0 -1
- package/lib/init.d.ts +0 -8
- package/lib/init.js.map +0 -1
- package/src/analytics/analytics-collector.d.ts +0 -35
- package/src/analytics/analytics-collector.js +0 -195
- package/src/analytics/analytics-collector.js.map +0 -1
- package/src/analytics/analytics-parameters.d.ts +0 -101
- package/src/analytics/analytics-parameters.js +0 -107
- package/src/analytics/analytics-parameters.js.map +0 -1
- package/src/analytics/analytics.d.ts +0 -27
- package/src/analytics/analytics.js +0 -183
- package/src/analytics/analytics.js.map +0 -1
- package/src/command-builder/architect-base-command-module.d.ts +0 -30
- package/src/command-builder/architect-base-command-module.js +0 -244
- package/src/command-builder/architect-base-command-module.js.map +0 -1
- package/src/command-builder/architect-command-module.d.ts +0 -28
- package/src/command-builder/architect-command-module.js +0 -218
- package/src/command-builder/architect-command-module.js.map +0 -1
- package/src/command-builder/command-module.d.ts +0 -73
- package/src/command-builder/command-module.js +0 -260
- package/src/command-builder/command-module.js.map +0 -1
- package/src/command-builder/command-runner.d.ts +0 -9
- package/src/command-builder/command-runner.js +0 -202
- package/src/command-builder/command-runner.js.map +0 -1
- package/src/command-builder/definitions.d.ts +0 -41
- package/src/command-builder/definitions.js +0 -20
- package/src/command-builder/definitions.js.map +0 -1
- package/src/command-builder/schematics-command-module.d.ts +0 -41
- package/src/command-builder/schematics-command-module.js +0 -408
- package/src/command-builder/schematics-command-module.js.map +0 -1
- package/src/command-builder/utilities/command.d.ts +0 -13
- package/src/command-builder/utilities/command.js +0 -39
- package/src/command-builder/utilities/command.js.map +0 -1
- package/src/command-builder/utilities/json-help.d.ts +0 -37
- package/src/command-builder/utilities/json-help.js +0 -92
- package/src/command-builder/utilities/json-help.js.map +0 -1
- package/src/command-builder/utilities/json-schema.d.ts +0 -64
- package/src/command-builder/utilities/json-schema.js +0 -349
- package/src/command-builder/utilities/json-schema.js.map +0 -1
- package/src/command-builder/utilities/normalize-options-middleware.d.ts +0 -18
- package/src/command-builder/utilities/normalize-options-middleware.js +0 -37
- package/src/command-builder/utilities/normalize-options-middleware.js.map +0 -1
- package/src/command-builder/utilities/schematic-engine-host.d.ts +0 -15
- package/src/command-builder/utilities/schematic-engine-host.js +0 -179
- package/src/command-builder/utilities/schematic-engine-host.js.map +0 -1
- package/src/command-builder/utilities/schematic-workflow.d.ts +0 -14
- package/src/command-builder/utilities/schematic-workflow.js +0 -70
- package/src/command-builder/utilities/schematic-workflow.js.map +0 -1
- package/src/commands/add/cli.d.ts +0 -41
- package/src/commands/add/cli.js +0 -705
- package/src/commands/add/cli.js.map +0 -1
- package/src/commands/add/long-description.md +0 -7
- package/src/commands/analytics/cli.d.ts +0 -16
- package/src/commands/analytics/cli.js +0 -34
- package/src/commands/analytics/cli.js.map +0 -1
- package/src/commands/analytics/info/cli.d.ts +0 -16
- package/src/commands/analytics/info/cli.js +0 -25
- package/src/commands/analytics/info/cli.js.map +0 -1
- package/src/commands/analytics/long-description.md +0 -20
- package/src/commands/analytics/settings/cli.d.ts +0 -35
- package/src/commands/analytics/settings/cli.js +0 -54
- package/src/commands/analytics/settings/cli.js.map +0 -1
- package/src/commands/build/cli.d.ts +0 -16
- package/src/commands/build/cli.js +0 -21
- package/src/commands/build/cli.js.map +0 -1
- package/src/commands/build/long-description.md +0 -18
- package/src/commands/cache/clean/cli.d.ts +0 -17
- package/src/commands/cache/clean/cli.js +0 -32
- package/src/commands/cache/clean/cli.js.map +0 -1
- package/src/commands/cache/cli.d.ts +0 -17
- package/src/commands/cache/cli.js +0 -36
- package/src/commands/cache/cli.js.map +0 -1
- package/src/commands/cache/info/cli.d.ts +0 -20
- package/src/commands/cache/info/cli.js +0 -139
- package/src/commands/cache/info/cli.js.map +0 -1
- package/src/commands/cache/long-description.md +0 -53
- package/src/commands/cache/settings/cli.d.ts +0 -27
- package/src/commands/cache/settings/cli.js +0 -41
- package/src/commands/cache/settings/cli.js.map +0 -1
- package/src/commands/cache/utilities.d.ts +0 -11
- package/src/commands/cache/utilities.js +0 -90
- package/src/commands/cache/utilities.js.map +0 -1
- package/src/commands/command-config.d.ts +0 -17
- package/src/commands/command-config.js +0 -116
- package/src/commands/command-config.js.map +0 -1
- package/src/commands/completion/cli.d.ts +0 -16
- package/src/commands/completion/cli.js +0 -61
- package/src/commands/completion/cli.js.map +0 -1
- package/src/commands/completion/long-description.md +0 -67
- package/src/commands/config/cli.d.ts +0 -24
- package/src/commands/config/cli.js +0 -150
- package/src/commands/config/cli.js.map +0 -1
- package/src/commands/config/long-description.md +0 -13
- package/src/commands/deploy/cli.d.ts +0 -17
- package/src/commands/deploy/cli.js +0 -38
- package/src/commands/deploy/cli.js.map +0 -1
- package/src/commands/deploy/long-description.md +0 -22
- package/src/commands/e2e/cli.d.ts +0 -18
- package/src/commands/e2e/cli.js +0 -42
- package/src/commands/e2e/cli.js.map +0 -1
- package/src/commands/extract-i18n/cli.d.ts +0 -17
- package/src/commands/extract-i18n/cli.js +0 -48
- package/src/commands/extract-i18n/cli.js.map +0 -1
- package/src/commands/generate/cli.d.ts +0 -47
- package/src/commands/generate/cli.js +0 -189
- package/src/commands/generate/cli.js.map +0 -1
- package/src/commands/lint/cli.d.ts +0 -17
- package/src/commands/lint/cli.js +0 -25
- package/src/commands/lint/cli.js.map +0 -1
- package/src/commands/lint/long-description.md +0 -20
- package/src/commands/make-this-awesome/cli.d.ts +0 -17
- package/src/commands/make-this-awesome/cli.js +0 -36
- package/src/commands/make-this-awesome/cli.js.map +0 -1
- package/src/commands/mcp/cli.d.ts +0 -21
- package/src/commands/mcp/cli.js +0 -74
- package/src/commands/mcp/cli.js.map +0 -1
- package/src/commands/mcp/constants.d.ts +0 -10
- package/src/commands/mcp/constants.js +0 -16
- package/src/commands/mcp/constants.js.map +0 -1
- package/src/commands/mcp/devserver.d.ts +0 -85
- package/src/commands/mcp/devserver.js +0 -109
- package/src/commands/mcp/devserver.js.map +0 -1
- package/src/commands/mcp/host.d.ts +0 -103
- package/src/commands/mcp/host.js +0 -270
- package/src/commands/mcp/host.js.map +0 -1
- package/src/commands/mcp/mcp-server.d.ts +0 -38
- package/src/commands/mcp/mcp-server.js +0 -176
- package/src/commands/mcp/mcp-server.js.map +0 -1
- package/src/commands/mcp/resources/ai-tutor.md +0 -822
- package/src/commands/mcp/resources/best-practices.md +0 -59
- package/src/commands/mcp/resources/instructions.d.ts +0 -9
- package/src/commands/mcp/resources/instructions.js +0 -26
- package/src/commands/mcp/resources/instructions.js.map +0 -1
- package/src/commands/mcp/shared-options.d.ts +0 -12
- package/src/commands/mcp/shared-options.js +0 -22
- package/src/commands/mcp/shared-options.js.map +0 -1
- package/src/commands/mcp/tools/ai-tutor.d.ts +0 -12
- package/src/commands/mcp/tools/ai-tutor.js +0 -59
- package/src/commands/mcp/tools/ai-tutor.js.map +0 -1
- package/src/commands/mcp/tools/best-practices.d.ts +0 -13
- package/src/commands/mcp/tools/best-practices.js +0 -196
- package/src/commands/mcp/tools/best-practices.js.map +0 -1
- package/src/commands/mcp/tools/devserver/devserver-start.d.ts +0 -32
- package/src/commands/mcp/tools/devserver/devserver-start.js +0 -110
- package/src/commands/mcp/tools/devserver/devserver-start.js.map +0 -1
- package/src/commands/mcp/tools/devserver/devserver-stop.d.ts +0 -31
- package/src/commands/mcp/tools/devserver/devserver-stop.js +0 -69
- package/src/commands/mcp/tools/devserver/devserver-stop.js.map +0 -1
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.d.ts +0 -41
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js +0 -105
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js.map +0 -1
- package/src/commands/mcp/tools/doc-search.d.ts +0 -21
- package/src/commands/mcp/tools/doc-search.js +0 -307
- package/src/commands/mcp/tools/doc-search.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.d.ts +0 -17
- package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.js +0 -62
- package/src/commands/mcp/tools/onpush-zoneless-migration/analyze-for-unsupported-zone-uses.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.d.ts +0 -12
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js +0 -70
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.d.ts +0 -12
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js +0 -60
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.d.ts +0 -15
- package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js +0 -238
- package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.d.ts +0 -9
- package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.js +0 -14
- package/src/commands/mcp/tools/onpush-zoneless-migration/send-debug-message.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.d.ts +0 -36
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js +0 -135
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/types.d.ts +0 -13
- package/src/commands/mcp/tools/onpush-zoneless-migration/types.js +0 -10
- package/src/commands/mcp/tools/onpush-zoneless-migration/types.js.map +0 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.d.ts +0 -16
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js +0 -215
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js.map +0 -1
- package/src/commands/mcp/tools/projects.d.ts +0 -48
- package/src/commands/mcp/tools/projects.js +0 -541
- package/src/commands/mcp/tools/projects.js.map +0 -1
- package/src/commands/mcp/tools/run-target/build-target-strategy.d.ts +0 -14
- package/src/commands/mcp/tools/run-target/build-target-strategy.js +0 -53
- package/src/commands/mcp/tools/run-target/build-target-strategy.js.map +0 -1
- package/src/commands/mcp/tools/run-target/generic-target-strategy.d.ts +0 -14
- package/src/commands/mcp/tools/run-target/generic-target-strategy.js +0 -63
- package/src/commands/mcp/tools/run-target/generic-target-strategy.js.map +0 -1
- package/src/commands/mcp/tools/run-target/options-serializer.d.ts +0 -13
- package/src/commands/mcp/tools/run-target/options-serializer.js +0 -41
- package/src/commands/mcp/tools/run-target/options-serializer.js.map +0 -1
- package/src/commands/mcp/tools/run-target/run-target.d.ts +0 -34
- package/src/commands/mcp/tools/run-target/run-target.js +0 -69
- package/src/commands/mcp/tools/run-target/run-target.js.map +0 -1
- package/src/commands/mcp/tools/run-target/strategy.d.ts +0 -15
- package/src/commands/mcp/tools/run-target/strategy.js +0 -10
- package/src/commands/mcp/tools/run-target/strategy.js.map +0 -1
- package/src/commands/mcp/tools/run-target/types.d.ts +0 -39
- package/src/commands/mcp/tools/run-target/types.js +0 -41
- package/src/commands/mcp/tools/run-target/types.js.map +0 -1
- package/src/commands/mcp/tools/run-target/unit-test-strategy.d.ts +0 -14
- package/src/commands/mcp/tools/run-target/unit-test-strategy.js +0 -56
- package/src/commands/mcp/tools/run-target/unit-test-strategy.js.map +0 -1
- package/src/commands/mcp/tools/tool-registry.d.ts +0 -40
- package/src/commands/mcp/tools/tool-registry.js +0 -40
- package/src/commands/mcp/tools/tool-registry.js.map +0 -1
- package/src/commands/mcp/utils.d.ts +0 -25
- package/src/commands/mcp/utils.js +0 -44
- package/src/commands/mcp/utils.js.map +0 -1
- package/src/commands/mcp/workspace-utils.d.ts +0 -55
- package/src/commands/mcp/workspace-utils.js +0 -181
- package/src/commands/mcp/workspace-utils.js.map +0 -1
- package/src/commands/new/cli.d.ts +0 -27
- package/src/commands/new/cli.js +0 -76
- package/src/commands/new/cli.js.map +0 -1
- package/src/commands/new/long-description.md +0 -15
- package/src/commands/run/cli.d.ts +0 -25
- package/src/commands/run/cli.js +0 -89
- package/src/commands/run/cli.js.map +0 -1
- package/src/commands/run/long-description.md +0 -10
- package/src/commands/serve/cli.d.ts +0 -16
- package/src/commands/serve/cli.js +0 -20
- package/src/commands/serve/cli.js.map +0 -1
- package/src/commands/test/cli.d.ts +0 -16
- package/src/commands/test/cli.js +0 -21
- package/src/commands/test/cli.js.map +0 -1
- package/src/commands/test/long-description.md +0 -2
- package/src/commands/update/cli.d.ts +0 -50
- package/src/commands/update/cli.js +0 -586
- package/src/commands/update/cli.js.map +0 -1
- package/src/commands/update/long-description.md +0 -22
- package/src/commands/update/update-resolver.d.ts +0 -75
- package/src/commands/update/update-resolver.js +0 -918
- package/src/commands/update/update-resolver.js.map +0 -1
- package/src/commands/update/utilities/cli-version.d.ts +0 -48
- package/src/commands/update/utilities/cli-version.js +0 -196
- package/src/commands/update/utilities/cli-version.js.map +0 -1
- package/src/commands/update/utilities/constants.d.ts +0 -12
- package/src/commands/update/utilities/constants.js +0 -16
- package/src/commands/update/utilities/constants.js.map +0 -1
- package/src/commands/update/utilities/git.d.ts +0 -36
- package/src/commands/update/utilities/git.js +0 -148
- package/src/commands/update/utilities/git.js.map +0 -1
- package/src/commands/update/utilities/migration.d.ts +0 -32
- package/src/commands/update/utilities/migration.js +0 -271
- package/src/commands/update/utilities/migration.js.map +0 -1
- package/src/commands/version/cli.d.ts +0 -36
- package/src/commands/version/cli.js +0 -117
- package/src/commands/version/cli.js.map +0 -1
- package/src/commands/version/version-info.d.ts +0 -46
- package/src/commands/version/version-info.js +0 -101
- package/src/commands/version/version-info.js.map +0 -1
- package/src/package-managers/discovery.d.ts +0 -23
- package/src/package-managers/discovery.js +0 -104
- package/src/package-managers/discovery.js.map +0 -1
- package/src/package-managers/error.d.ts +0 -43
- package/src/package-managers/error.js +0 -41
- package/src/package-managers/error.js.map +0 -1
- package/src/package-managers/factory.d.ts +0 -30
- package/src/package-managers/factory.js +0 -137
- package/src/package-managers/factory.js.map +0 -1
- package/src/package-managers/host.d.ts +0 -86
- package/src/package-managers/host.js +0 -91
- package/src/package-managers/host.js.map +0 -1
- package/src/package-managers/index.d.ts +0 -13
- package/src/package-managers/index.js +0 -17
- package/src/package-managers/index.js.map +0 -1
- package/src/package-managers/logger.d.ts +0 -27
- package/src/package-managers/logger.js +0 -10
- package/src/package-managers/logger.js.map +0 -1
- package/src/package-managers/package-manager-descriptor.d.ts +0 -269
- package/src/package-managers/package-manager-descriptor.js +0 -210
- package/src/package-managers/package-manager-descriptor.js.map +0 -1
- package/src/package-managers/package-manager.d.ts +0 -200
- package/src/package-managers/package-manager.js +0 -720
- package/src/package-managers/package-manager.js.map +0 -1
- package/src/package-managers/package-metadata.d.ts +0 -91
- package/src/package-managers/package-metadata.js +0 -10
- package/src/package-managers/package-metadata.js.map +0 -1
- package/src/package-managers/package-tree.d.ts +0 -23
- package/src/package-managers/package-tree.js +0 -10
- package/src/package-managers/package-tree.js.map +0 -1
- package/src/package-managers/parsers.d.ts +0 -167
- package/src/package-managers/parsers.js +0 -674
- package/src/package-managers/parsers.js.map +0 -1
- package/src/utilities/color.d.ts +0 -23
- package/src/utilities/color.js +0 -41
- package/src/utilities/color.js.map +0 -1
- package/src/utilities/completion.d.ts +0 -30
- package/src/utilities/completion.js +0 -270
- package/src/utilities/completion.js.map +0 -1
- package/src/utilities/config.d.ts +0 -38
- package/src/utilities/config.js +0 -368
- package/src/utilities/config.js.map +0 -1
- package/src/utilities/environment-options.d.ts +0 -25
- package/src/utilities/environment-options.js +0 -60
- package/src/utilities/environment-options.js.map +0 -1
- package/src/utilities/eol.d.ts +0 -20
- package/src/utilities/eol.js +0 -35
- package/src/utilities/eol.js.map +0 -1
- package/src/utilities/error.d.ts +0 -18
- package/src/utilities/error.js +0 -41
- package/src/utilities/error.js.map +0 -1
- package/src/utilities/find-up.d.ts +0 -21
- package/src/utilities/find-up.js +0 -67
- package/src/utilities/find-up.js.map +0 -1
- package/src/utilities/json-file.d.ts +0 -24
- package/src/utilities/json-file.js +0 -179
- package/src/utilities/json-file.js.map +0 -1
- package/src/utilities/log-file.d.ts +0 -13
- package/src/utilities/log-file.js +0 -28
- package/src/utilities/log-file.js.map +0 -1
- package/src/utilities/memoize.d.ts +0 -15
- package/src/utilities/memoize.js +0 -64
- package/src/utilities/memoize.js.map +0 -1
- package/src/utilities/node-version.d.ts +0 -21
- package/src/utilities/node-version.js +0 -65
- package/src/utilities/node-version.js.map +0 -1
- package/src/utilities/prettier.d.ts +0 -19
- package/src/utilities/prettier.js +0 -105
- package/src/utilities/prettier.js.map +0 -1
- package/src/utilities/project.d.ts +0 -8
- package/src/utilities/project.js +0 -81
- package/src/utilities/project.js.map +0 -1
- package/src/utilities/prompt.d.ts +0 -17
- package/src/utilities/prompt.js +0 -90
- package/src/utilities/prompt.js.map +0 -1
- package/src/utilities/tty.d.ts +0 -16
- package/src/utilities/tty.js +0 -23
- package/src/utilities/tty.js.map +0 -1
- package/src/utilities/version.d.ts +0 -16
- package/src/utilities/version.js +0 -26
- package/src/utilities/version.js.map +0 -1
package/src/utilities/find-up.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
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 = parent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IAAI,UAAU,GAAG,IAAA,mBAAO,EAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,IAAI,EAAE,CAAC;QACZ,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;YAC7B,MAAM,CAAC,GAAG,IAAA,gBAAI,EAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YACjC,IAAI,IAAA,oBAAU,EAAC,CAAC,CAAC,EAAE,CAAC;gBAClB,OAAO,CAAC,CAAC;YACX,CAAC;QACH,CAAC;QAED,MAAM,SAAS,GAAG,IAAA,mBAAO,EAAC,UAAU,CAAC,CAAC;QACtC,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;YAC7B,MAAM;QACR,CAAC;QAED,UAAU,GAAG,SAAS,CAAC;IACzB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
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;
|
|
@@ -1,179 +0,0 @@
|
|
|
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
|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,CAAC,CAAC;YAChC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;CACF;AAxJD,4BAwJC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAAsB,IAAY;IAChE,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,MAAM,OAAO,GAAG,IAAA,oBAAK,EAAC,IAAA,sBAAY,EAAC,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAM,CAAC;IAC9F,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;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"}
|
|
@@ -1,13 +0,0 @@
|
|
|
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;
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,15 +0,0 @@
|
|
|
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;
|
package/src/utilities/memoize.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,IAAU;QACxC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC7B,MAAM,IAAI,KAAK,CACb,YAAY,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,wBAAwB,CAC/E,CAAC;YACJ,CAAC;QACH,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACnB,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAW,CAAC;QAClC,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAEvB,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAED,mDAAmD;AACnD,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,CACL,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;QAC7C,OAAO,KAAK,KAAK,UAAU;QAC3B,OAAO,KAAK,KAAK,QAAQ,CAC1B,CAAC;AACJ,CAAC;AAED,0DAA0D;AAC1D,SAAS,kBAAkB,CAAC,KAAc;IACxC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,2CAA2C;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,YAAmC,CAAC;IACxC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,kCAAkC;QAClC,YAAY,GAAG,KAAK,CAAC;IACvB,CAAC;SAAM,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,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"}
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
* The supported Node.js versions.
|
|
10
|
-
*/
|
|
11
|
-
export declare const supportedNodeVersions: string[];
|
|
12
|
-
/**
|
|
13
|
-
* Checks if the current Node.js version is supported.
|
|
14
|
-
* @returns `true` if the current Node.js version is supported, `false` otherwise.
|
|
15
|
-
*/
|
|
16
|
-
export declare function isNodeVersionSupported(): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Checks if the current Node.js version is the minimum supported version.
|
|
19
|
-
* @returns `true` if the current Node.js version is the minimum supported version, `false` otherwise.
|
|
20
|
-
*/
|
|
21
|
-
export declare function isNodeVersionMinSupported(): boolean;
|
|
@@ -1,65 +0,0 @@
|
|
|
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.supportedNodeVersions = void 0;
|
|
11
|
-
exports.isNodeVersionSupported = isNodeVersionSupported;
|
|
12
|
-
exports.isNodeVersionMinSupported = isNodeVersionMinSupported;
|
|
13
|
-
/**
|
|
14
|
-
* @fileoverview This file contains the supported Node.js version for the Angular CLI.
|
|
15
|
-
* @important This file must not import any other modules.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* The supported Node.js version for the Angular CLI.
|
|
19
|
-
*/
|
|
20
|
-
const SUPPORTED_NODE_VERSIONS = '^22.22.3 || ^24.15.0 || >=26.0.0';
|
|
21
|
-
/**
|
|
22
|
-
* The supported Node.js versions.
|
|
23
|
-
*/
|
|
24
|
-
exports.supportedNodeVersions = SUPPORTED_NODE_VERSIONS.replace(/[\^~<>=]/g, '')
|
|
25
|
-
.split('||')
|
|
26
|
-
.map((v) => v.trim());
|
|
27
|
-
/**
|
|
28
|
-
* Checks if the current Node.js version is supported.
|
|
29
|
-
* @returns `true` if the current Node.js version is supported, `false` otherwise.
|
|
30
|
-
*/
|
|
31
|
-
function isNodeVersionSupported() {
|
|
32
|
-
if (SUPPORTED_NODE_VERSIONS.charAt(0) === '0') {
|
|
33
|
-
// Unlike `pkg_npm`, `ts_library` which is used to run unit tests does not support substitutions.
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
const [processMajor, processMinor, processPatch] = process.versions.node
|
|
37
|
-
.split('.', 3)
|
|
38
|
-
.map((part) => Number(part));
|
|
39
|
-
for (const version of exports.supportedNodeVersions) {
|
|
40
|
-
const [major, minor, patch] = version.split('.', 3).map((part) => Number(part));
|
|
41
|
-
if ((major === processMajor && processMinor === minor && processPatch >= patch) ||
|
|
42
|
-
(major === processMajor && processMinor > minor)) {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Checks if the current Node.js version is the minimum supported version.
|
|
50
|
-
* @returns `true` if the current Node.js version is the minimum supported version, `false` otherwise.
|
|
51
|
-
*/
|
|
52
|
-
function isNodeVersionMinSupported() {
|
|
53
|
-
if (SUPPORTED_NODE_VERSIONS.charAt(0) === '0') {
|
|
54
|
-
// Unlike `pkg_npm`, `ts_library` which is used to run unit tests does not support substitutions.
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
const [processMajor, processMinor, processPatch] = process.versions.node
|
|
58
|
-
.split('.', 3)
|
|
59
|
-
.map((part) => Number(part));
|
|
60
|
-
const [major, minor, patch] = exports.supportedNodeVersions[0].split('.', 3).map((part) => Number(part));
|
|
61
|
-
return (processMajor > major ||
|
|
62
|
-
(processMajor === major && processMinor > minor) ||
|
|
63
|
-
(processMajor === major && processMinor === minor && processPatch >= patch));
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=node-version.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node-version.js","sourceRoot":"","sources":["node-version.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAwBH,wDAqBC;AAMD,8DAgBC;AAjED;;;GAGG;AAEH;;GAEG;AAEH,MAAM,uBAAuB,GAAG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CAAC;IAED,MAAM,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI;SACrE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;SACb,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/B,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,6BAAqB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAEjG,OAAO,CACL,YAAY,GAAG,KAAK;QACpB,CAAC,YAAY,KAAK,KAAK,IAAI,YAAY,GAAG,KAAK,CAAC;QAChD,CAAC,YAAY,KAAK,KAAK,IAAI,YAAY,KAAK,KAAK,IAAI,YAAY,IAAI,KAAK,CAAC,CAC5E,CAAC;AACJ,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
* Groups files into batches whose combined argument length (including `baseLength`
|
|
10
|
-
* for the fixed leading arguments) stays under `maxLength`. A file longer on its own
|
|
11
|
-
* than the budget still gets its own batch, so files are never dropped.
|
|
12
|
-
*/
|
|
13
|
-
export declare function batchFilesByArgumentLength(files: Iterable<string>, baseLength: number, maxLength: number): string[][];
|
|
14
|
-
/**
|
|
15
|
-
* Formats files using Prettier.
|
|
16
|
-
* @param cwd The current working directory.
|
|
17
|
-
* @param files The files to format.
|
|
18
|
-
*/
|
|
19
|
-
export declare function formatFiles(cwd: string, files: Set<string>): Promise<void>;
|
|
@@ -1,105 +0,0 @@
|
|
|
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.batchFilesByArgumentLength = batchFilesByArgumentLength;
|
|
11
|
-
exports.formatFiles = formatFiles;
|
|
12
|
-
const node_child_process_1 = require("node:child_process");
|
|
13
|
-
const promises_1 = require("node:fs/promises");
|
|
14
|
-
const node_module_1 = require("node:module");
|
|
15
|
-
const node_path_1 = require("node:path");
|
|
16
|
-
const node_util_1 = require("node:util");
|
|
17
|
-
const execFileAsync = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
18
|
-
let prettierCliPath;
|
|
19
|
-
/**
|
|
20
|
-
* Conservative upper bound for the length of a single spawned command line.
|
|
21
|
-
* Windows caps `CreateProcess` command lines at 32,767 characters; POSIX `ARG_MAX`
|
|
22
|
-
* is larger. Staying below this budget avoids `E2BIG`/`ENAMETOOLONG` when a large
|
|
23
|
-
* migration changes thousands of files.
|
|
24
|
-
*/
|
|
25
|
-
const MAX_COMMAND_LINE_LENGTH = 32_000;
|
|
26
|
-
/**
|
|
27
|
-
* Groups files into batches whose combined argument length (including `baseLength`
|
|
28
|
-
* for the fixed leading arguments) stays under `maxLength`. A file longer on its own
|
|
29
|
-
* than the budget still gets its own batch, so files are never dropped.
|
|
30
|
-
*/
|
|
31
|
-
function batchFilesByArgumentLength(files, baseLength, maxLength) {
|
|
32
|
-
const batches = [];
|
|
33
|
-
let batch = [];
|
|
34
|
-
let length = baseLength;
|
|
35
|
-
for (const file of files) {
|
|
36
|
-
// Account for the separator between arguments, plus the surrounding quotes the OS
|
|
37
|
-
// adds to paths containing spaces when they are spawned.
|
|
38
|
-
const fileLength = file.length + (file.includes(' ') ? 3 : 1);
|
|
39
|
-
if (batch.length > 0 && length + fileLength > maxLength) {
|
|
40
|
-
batches.push(batch);
|
|
41
|
-
batch = [];
|
|
42
|
-
length = baseLength;
|
|
43
|
-
}
|
|
44
|
-
batch.push(file);
|
|
45
|
-
length += fileLength;
|
|
46
|
-
}
|
|
47
|
-
if (batch.length > 0) {
|
|
48
|
-
batches.push(batch);
|
|
49
|
-
}
|
|
50
|
-
return batches;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Formats files using Prettier.
|
|
54
|
-
* @param cwd The current working directory.
|
|
55
|
-
* @param files The files to format.
|
|
56
|
-
*/
|
|
57
|
-
async function formatFiles(cwd, files) {
|
|
58
|
-
if (!files.size) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (prettierCliPath === undefined) {
|
|
62
|
-
try {
|
|
63
|
-
const prettierPath = (0, node_module_1.createRequire)(cwd + '/').resolve('prettier/package.json');
|
|
64
|
-
const prettierPackageJson = JSON.parse(await (0, promises_1.readFile)(prettierPath, 'utf-8'));
|
|
65
|
-
prettierCliPath = (0, node_path_1.join)((0, node_path_1.dirname)(prettierPath), prettierPackageJson.bin);
|
|
66
|
-
}
|
|
67
|
-
catch {
|
|
68
|
-
// Prettier is not installed.
|
|
69
|
-
prettierCliPath = null;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (!prettierCliPath) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
const baseArgs = [
|
|
76
|
-
prettierCliPath,
|
|
77
|
-
'--write',
|
|
78
|
-
'--no-error-on-unmatched-pattern',
|
|
79
|
-
'--ignore-unknown',
|
|
80
|
-
];
|
|
81
|
-
// `process.execPath` is spawned as the first argument and also counts toward the
|
|
82
|
-
// command-line limit; it and `prettierCliPath` are absolute paths that may contain
|
|
83
|
-
// spaces and therefore be quoted.
|
|
84
|
-
const baseLength = [process.execPath, ...baseArgs].reduce((total, arg) => total + arg.length + (arg.includes(' ') ? 3 : 1), 0);
|
|
85
|
-
// Spawn Prettier once per batch so repositories with many changed files do not
|
|
86
|
-
// overflow the OS command-line length limit. A failure in one batch (e.g. a file
|
|
87
|
-
// Prettier cannot parse) must not stop the remaining batches, matching the previous
|
|
88
|
-
// single-invocation behavior, so errors are collected and reported together.
|
|
89
|
-
const errors = [];
|
|
90
|
-
for (const batch of batchFilesByArgumentLength(files, baseLength, MAX_COMMAND_LINE_LENGTH)) {
|
|
91
|
-
try {
|
|
92
|
-
await execFileAsync(process.execPath, [...baseArgs, ...batch], {
|
|
93
|
-
cwd,
|
|
94
|
-
shell: false,
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
errors.push(error instanceof Error ? error.message : String(error));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (errors.length > 0) {
|
|
102
|
-
throw new Error(errors.join('\n'));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=prettier.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prettier.js","sourceRoot":"","sources":["prettier.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAwBH,gEA6BC;AAOD,kCAuDC;AAjHD,2DAA8C;AAC9C,+CAA4C;AAC5C,6CAA4C;AAC5C,yCAA0C;AAC1C,yCAAsC;AAEtC,MAAM,aAAa,GAAG,IAAA,qBAAS,EAAC,6BAAQ,CAAC,CAAC;AAC1C,IAAI,eAA0C,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAEvC;;;;GAIG;AACH,SAAgB,0BAA0B,CACxC,KAAuB,EACvB,UAAkB,EAClB,SAAiB;IAEjB,MAAM,OAAO,GAAe,EAAE,CAAC;IAC/B,IAAI,KAAK,GAAa,EAAE,CAAC;IACzB,IAAI,MAAM,GAAG,UAAU,CAAC;IAExB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,k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
|
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
|
-
export declare function findWorkspaceFile(currentDirectory?: string): string | null;
|