@mouryaamit/nx-polystack 0.0.0-stage → 1.0.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 +77 -2
- package/USER-MANUAL.md +1968 -0
- package/dist/bin/cli.d.ts +1 -0
- package/dist/bin/cli.js +92 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/executors.json +32 -0
- package/dist/generators.json +47 -0
- package/dist/migrations.json +87 -0
- package/dist/runtime/env-secret.cjs +736 -0
- package/dist/src/cli/args.d.ts +18 -0
- package/dist/src/cli/args.js +67 -0
- package/dist/src/cli/args.js.map +1 -0
- package/dist/src/cli/commands/app.d.ts +3 -0
- package/dist/src/cli/commands/app.js +108 -0
- package/dist/src/cli/commands/app.js.map +1 -0
- package/dist/src/cli/commands/build.d.ts +8 -0
- package/dist/src/cli/commands/build.js +132 -0
- package/dist/src/cli/commands/build.js.map +1 -0
- package/dist/src/cli/commands/csp.d.ts +19 -0
- package/dist/src/cli/commands/csp.js +238 -0
- package/dist/src/cli/commands/csp.js.map +1 -0
- package/dist/src/cli/commands/encryption.d.ts +4 -0
- package/dist/src/cli/commands/encryption.js +261 -0
- package/dist/src/cli/commands/encryption.js.map +1 -0
- package/dist/src/cli/commands/env.d.ts +2 -0
- package/dist/src/cli/commands/env.js +74 -0
- package/dist/src/cli/commands/env.js.map +1 -0
- package/dist/src/cli/commands/hardening.d.ts +2 -0
- package/dist/src/cli/commands/hardening.js +176 -0
- package/dist/src/cli/commands/hardening.js.map +1 -0
- package/dist/src/cli/commands/index.d.ts +3 -0
- package/dist/src/cli/commands/index.js +45 -0
- package/dist/src/cli/commands/index.js.map +1 -0
- package/dist/src/cli/commands/infra.d.ts +25 -0
- package/dist/src/cli/commands/infra.js +85 -0
- package/dist/src/cli/commands/infra.js.map +1 -0
- package/dist/src/cli/commands/internal-migrate.d.ts +3 -0
- package/dist/src/cli/commands/internal-migrate.js +65 -0
- package/dist/src/cli/commands/internal-migrate.js.map +1 -0
- package/dist/src/cli/commands/lib.d.ts +2 -0
- package/dist/src/cli/commands/lib.js +70 -0
- package/dist/src/cli/commands/lib.js.map +1 -0
- package/dist/src/cli/commands/llm.d.ts +2 -0
- package/dist/src/cli/commands/llm.js +46 -0
- package/dist/src/cli/commands/llm.js.map +1 -0
- package/dist/src/cli/commands/migrate.d.ts +2 -0
- package/dist/src/cli/commands/migrate.js +230 -0
- package/dist/src/cli/commands/migrate.js.map +1 -0
- package/dist/src/cli/commands/new.d.ts +6 -0
- package/dist/src/cli/commands/new.js +97 -0
- package/dist/src/cli/commands/new.js.map +1 -0
- package/dist/src/cli/commands/preset.d.ts +2 -0
- package/dist/src/cli/commands/preset.js +47 -0
- package/dist/src/cli/commands/preset.js.map +1 -0
- package/dist/src/cli/commands/release.d.ts +3 -0
- package/dist/src/cli/commands/release.js +83 -0
- package/dist/src/cli/commands/release.js.map +1 -0
- package/dist/src/cli/commands/shared.d.ts +3 -0
- package/dist/src/cli/commands/shared.js +55 -0
- package/dist/src/cli/commands/shared.js.map +1 -0
- package/dist/src/cli/commands/update.d.ts +11 -0
- package/dist/src/cli/commands/update.js +120 -0
- package/dist/src/cli/commands/update.js.map +1 -0
- package/dist/src/cli/context.d.ts +18 -0
- package/dist/src/cli/context.js +66 -0
- package/dist/src/cli/context.js.map +1 -0
- package/dist/src/cli/exec.d.ts +9 -0
- package/dist/src/cli/exec.js +34 -0
- package/dist/src/cli/exec.js.map +1 -0
- package/dist/src/cli/help.d.ts +1 -0
- package/dist/src/cli/help.js +291 -0
- package/dist/src/cli/help.js.map +1 -0
- package/dist/src/cli/install-source.d.ts +16 -0
- package/dist/src/cli/install-source.js +49 -0
- package/dist/src/cli/install-source.js.map +1 -0
- package/dist/src/cli/launcher.d.ts +32 -0
- package/dist/src/cli/launcher.js +168 -0
- package/dist/src/cli/launcher.js.map +1 -0
- package/dist/src/cli/migrations.d.ts +25 -0
- package/dist/src/cli/migrations.js +35 -0
- package/dist/src/cli/migrations.js.map +1 -0
- package/dist/src/cli/run-tree.d.ts +9 -0
- package/dist/src/cli/run-tree.js +32 -0
- package/dist/src/cli/run-tree.js.map +1 -0
- package/dist/src/cli/types.d.ts +18 -0
- package/dist/src/cli/types.js +12 -0
- package/dist/src/cli/types.js.map +1 -0
- package/dist/src/cli/update-plan.d.ts +15 -0
- package/dist/src/cli/update-plan.js +40 -0
- package/dist/src/cli/update-plan.js.map +1 -0
- package/dist/src/cli/versions.d.ts +26 -0
- package/dist/src/cli/versions.js +83 -0
- package/dist/src/cli/versions.js.map +1 -0
- package/dist/src/executors/build/executor.d.ts +19 -0
- package/dist/src/executors/build/executor.js +251 -0
- package/dist/src/executors/build/executor.js.map +1 -0
- package/dist/src/executors/build/schema.d.ts +42 -0
- package/dist/src/executors/build/schema.json +104 -0
- package/dist/src/executors/capacitor/executor.d.ts +8 -0
- package/dist/src/executors/capacitor/executor.js +45 -0
- package/dist/src/executors/capacitor/executor.js.map +1 -0
- package/dist/src/executors/capacitor/schema.d.ts +10 -0
- package/dist/src/executors/capacitor/schema.json +24 -0
- package/dist/src/executors/clean/executor.d.ts +19 -0
- package/dist/src/executors/clean/executor.js +134 -0
- package/dist/src/executors/clean/executor.js.map +1 -0
- package/dist/src/executors/clean/schema.d.ts +6 -0
- package/dist/src/executors/clean/schema.json +21 -0
- package/dist/src/executors/flutter-build/executor.d.ts +8 -0
- package/dist/src/executors/flutter-build/executor.js +70 -0
- package/dist/src/executors/flutter-build/executor.js.map +1 -0
- package/dist/src/executors/flutter-build/schema.d.ts +10 -0
- package/dist/src/executors/flutter-build/schema.json +44 -0
- package/dist/src/executors/flutter-export/executor.d.ts +8 -0
- package/dist/src/executors/flutter-export/executor.js +36 -0
- package/dist/src/executors/flutter-export/executor.js.map +1 -0
- package/dist/src/executors/flutter-export/schema.d.ts +6 -0
- package/dist/src/executors/flutter-export/schema.json +28 -0
- package/dist/src/generators/app/files/angular/.eslintrc.json__template__ +28 -0
- package/dist/src/generators/app/files/angular/csp-allowlist.json__template__ +1 -0
- package/dist/src/generators/app/files/angular/server/README.md__template__ +31 -0
- package/dist/src/generators/app/files/angular/src/app/app-routing.module.ts__template__ +10 -0
- package/dist/src/generators/app/files/angular/src/app/app.component.html__template__ +4 -0
- package/dist/src/generators/app/files/angular/src/app/app.component.scss__template__ +1 -0
- package/dist/src/generators/app/files/angular/src/app/app.component.ts__template__ +9 -0
- package/dist/src/generators/app/files/angular/src/app/app.module.ts__template__ +13 -0
- package/dist/src/generators/app/files/angular/src/index.html__template__ +12 -0
- package/dist/src/generators/app/files/angular/src/main.ts__template__ +16 -0
- package/dist/src/generators/app/files/angular/src/styles.scss__template__ +1 -0
- package/dist/src/generators/app/files/angular/tsconfig.app.json__template__ +10 -0
- package/dist/src/generators/app/files/angular/tsconfig.json__template__ +25 -0
- package/dist/src/generators/app/files/angular/tsconfig.spec.json__template__ +8 -0
- package/dist/src/generators/app/files/flutter/.gitignore__template__ +10 -0
- package/dist/src/generators/app/files/flutter/analysis_options.yaml__template__ +8 -0
- package/dist/src/generators/app/files/flutter/lib/main.dart__template__ +23 -0
- package/dist/src/generators/app/files/flutter/pubspec.yaml__template__ +26 -0
- package/dist/src/generators/app/files/flutter/server/nginx.conf__template__ +35 -0
- package/dist/src/generators/app/files/ionic/.gitignore__template__ +7 -0
- package/dist/src/generators/app/files/ionic/capacitor.config.ts__template__ +19 -0
- package/dist/src/generators/app/files/ionic/package.json__template__ +14 -0
- package/dist/src/generators/app/files/ionic/src/app/app.component.html__template__ +3 -0
- package/dist/src/generators/app/files/ionic/src/app/app.component.scss__template__ +0 -0
- package/dist/src/generators/app/files/ionic/src/app/app.module.ts__template__ +16 -0
- package/dist/src/generators/app/files/ionic/src/index.html__template__ +17 -0
- package/dist/src/generators/app/files/ionic/src/styles.scss__template__ +12 -0
- package/dist/src/generators/app/generator.d.ts +15 -0
- package/dist/src/generators/app/generator.js +363 -0
- package/dist/src/generators/app/generator.js.map +1 -0
- package/dist/src/generators/app/schema.d.ts +19 -0
- package/dist/src/generators/app/schema.json +77 -0
- package/dist/src/generators/env/generator.d.ts +3 -0
- package/dist/src/generators/env/generator.js +454 -0
- package/dist/src/generators/env/generator.js.map +1 -0
- package/dist/src/generators/env/schema.d.ts +18 -0
- package/dist/src/generators/env/schema.json +47 -0
- package/dist/src/generators/infra/files/ci/commitlint/commitlint.config.js__template__ +6 -0
- package/dist/src/generators/infra/files/ci/common/tools/config/allowed-cycles.json__template__ +1 -0
- package/dist/src/generators/infra/files/ci/common/tools/scripts/check-cycles.js__template__ +201 -0
- package/dist/src/generators/infra/files/ci/github-actions/.github/workflows/ci.yml__template__ +68 -0
- package/dist/src/generators/infra/files/ci/github-actions/.github/workflows/pr-title.yml__template__ +36 -0
- package/dist/src/generators/infra/files/ci/jenkins/Jenkinsfile__template__ +45 -0
- package/dist/src/generators/infra/files/docs/.github/ISSUE_TEMPLATE/bug.yml__template__ +39 -0
- package/dist/src/generators/infra/files/docs/.github/ISSUE_TEMPLATE/config.yml__template__ +1 -0
- package/dist/src/generators/infra/files/docs/.github/ISSUE_TEMPLATE/feature.yml__template__ +23 -0
- package/dist/src/generators/infra/files/docs/.github/PULL_REQUEST_TEMPLATE.md__template__ +23 -0
- package/dist/src/generators/infra/files/docs/CODE_OF_CONDUCT.md__template__ +18 -0
- package/dist/src/generators/infra/files/docs/CONTRIBUTING.md__template__ +61 -0
- package/dist/src/generators/infra/files/docs/SECURITY.md__template__ +25 -0
- package/dist/src/generators/infra/files/quality/.husky/pre-push__template__ +2 -0
- package/dist/src/generators/infra/files/quality/.secretlintignore__template__ +7 -0
- package/dist/src/generators/infra/files/quality/.secretlintrc.json__template__ +7 -0
- package/dist/src/generators/infra/files/quality/knip.json__template__ +9 -0
- package/dist/src/generators/infra/files/upgrades/.github/workflows/dependency-upgrade.yml__template__ +80 -0
- package/dist/src/generators/infra/generator.d.ts +60 -0
- package/dist/src/generators/infra/generator.js +356 -0
- package/dist/src/generators/infra/generator.js.map +1 -0
- package/dist/src/generators/infra/options.d.ts +28 -0
- package/dist/src/generators/infra/options.js +80 -0
- package/dist/src/generators/infra/options.js.map +1 -0
- package/dist/src/generators/infra/schema.d.ts +19 -0
- package/dist/src/generators/infra/schema.json +59 -0
- package/dist/src/generators/lib/angular-lib.d.ts +27 -0
- package/dist/src/generators/lib/angular-lib.js +85 -0
- package/dist/src/generators/lib/angular-lib.js.map +1 -0
- package/dist/src/generators/lib/files/angular/component/src/index.ts__template__ +2 -0
- package/dist/src/generators/lib/files/angular/component/src/lib/__fileName__/__fileName__.component.html__template__ +1 -0
- package/dist/src/generators/lib/files/angular/component/src/lib/__fileName__/__fileName__.component.scss__template__ +3 -0
- package/dist/src/generators/lib/files/angular/component/src/lib/__fileName__/__fileName__.component.ts__template__ +9 -0
- package/dist/src/generators/lib/files/angular/component/src/lib/__fileName__.module.ts__template__ +11 -0
- package/dist/src/generators/lib/files/angular/config/.eslintrc.json__template__ +32 -0
- package/dist/src/generators/lib/files/angular/config/tsconfig.json__template__ +22 -0
- package/dist/src/generators/lib/files/angular/config/tsconfig.lib.json__template__ +12 -0
- package/dist/src/generators/lib/files/assets/README.md__template__ +13 -0
- package/dist/src/generators/lib/files/design-tokens/README.md__template__ +90 -0
- package/dist/src/generators/lib/files/design-tokens/generated/dart/pubspec.yaml__template__ +11 -0
- package/dist/src/generators/lib/files/design-tokens/src/index.ts__template__ +1 -0
- package/dist/src/generators/lib/files/design-tokens/style-dictionary.config.js__template__ +41 -0
- package/dist/src/generators/lib/files/flutter/.gitignore__template__ +7 -0
- package/dist/src/generators/lib/files/flutter/analysis_options.yaml__template__ +6 -0
- package/dist/src/generators/lib/files/flutter/lib/__snakeName__.dart__template__ +1 -0
- package/dist/src/generators/lib/files/flutter/lib/src/__snakeName__.dart__template__ +6 -0
- package/dist/src/generators/lib/files/flutter/pubspec.yaml__template__ +18 -0
- package/dist/src/generators/lib/files/flutter/test/__snakeName___test.dart__template__ +8 -0
- package/dist/src/generators/lib/files/ionic/src/index.ts__template__ +2 -0
- package/dist/src/generators/lib/files/ionic/src/lib/__fileName__/__fileName__.page.html__template__ +9 -0
- package/dist/src/generators/lib/files/ionic/src/lib/__fileName__/__fileName__.page.scss__template__ +3 -0
- package/dist/src/generators/lib/files/ionic/src/lib/__fileName__/__fileName__.page.ts__template__ +9 -0
- package/dist/src/generators/lib/files/ionic/src/lib/__fileName__.module.ts__template__ +12 -0
- package/dist/src/generators/lib/files/pii/README.md__template__ +35 -0
- package/dist/src/generators/lib/files/pii/src/index.ts__template__ +5 -0
- package/dist/src/generators/lib/files/pii/src/lib/pii-mask.directive.ts__template__ +30 -0
- package/dist/src/generators/lib/files/pii/src/lib/pii-mask.module.ts__template__ +17 -0
- package/dist/src/generators/lib/files/pii/src/lib/pii-mask.options.ts__template__ +6 -0
- package/dist/src/generators/lib/files/pii/src/lib/pii-mask.pipe.ts__template__ +14 -0
- package/dist/src/generators/lib/files/pii/src/lib/pii-mask.ts__template__ +117 -0
- package/dist/src/generators/lib/files/session/README.md__template__ +39 -0
- package/dist/src/generators/lib/files/session/src/index.ts__template__ +5 -0
- package/dist/src/generators/lib/files/session/src/lib/session-clock.ts__template__ +113 -0
- package/dist/src/generators/lib/files/session/src/lib/session-timeout.config.ts__template__ +8 -0
- package/dist/src/generators/lib/files/session/src/lib/session-timeout.module.ts__template__ +23 -0
- package/dist/src/generators/lib/files/session/src/lib/session-timeout.service.ts__template__ +289 -0
- package/dist/src/generators/lib/files/session/src/lib/session-warning/session-warning.component.html__template__ +21 -0
- package/dist/src/generators/lib/files/session/src/lib/session-warning/session-warning.component.scss__template__ +40 -0
- package/dist/src/generators/lib/files/session/src/lib/session-warning/session-warning.component.ts__template__ +105 -0
- package/dist/src/generators/lib/files/state/ngrx/README.md__template__ +33 -0
- package/dist/src/generators/lib/files/state/ngrx/src/index.ts__template__ +6 -0
- package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__-state.module.ts__template__ +18 -0
- package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__.actions.ts__template__ +12 -0
- package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__.effects.ts__template__ +26 -0
- package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__.models.ts__template__ +4 -0
- package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__.reducer.ts__template__ +33 -0
- package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__.selectors.ts__template__ +14 -0
- package/dist/src/generators/lib/files/state/simple-service/README.md__template__ +20 -0
- package/dist/src/generators/lib/files/state/simple-service/src/index.ts__template__ +2 -0
- package/dist/src/generators/lib/files/state/simple-service/src/lib/__fileName__.store.ts__template__ +58 -0
- package/dist/src/generators/lib/files/state/simple-service/src/lib/store.ts__template__ +34 -0
- package/dist/src/generators/lib/files/styles/README.md__template__ +39 -0
- package/dist/src/generators/lib/files/styles/src/_index.scss__template__ +3 -0
- package/dist/src/generators/lib/files/styles/src/mixins/_index.scss__template__ +13 -0
- package/dist/src/generators/lib/files/styles/src/themes/_index.scss__template__ +20 -0
- package/dist/src/generators/lib/files/styles/src/tokens/_index.scss__template__ +27 -0
- package/dist/src/generators/lib/files/ts/config/.eslintrc.json__template__ +10 -0
- package/dist/src/generators/lib/files/ts/config/tsconfig.json__template__ +14 -0
- package/dist/src/generators/lib/files/ts/config/tsconfig.lib.json__template__ +10 -0
- package/dist/src/generators/lib/files/ts/sample/src/index.ts__template__ +1 -0
- package/dist/src/generators/lib/files/ts/sample/src/lib/__fileName__.ts__template__ +4 -0
- package/dist/src/generators/lib/generator.d.ts +3 -0
- package/dist/src/generators/lib/generator.js +53 -0
- package/dist/src/generators/lib/generator.js.map +1 -0
- package/dist/src/generators/lib/lib-utils.d.ts +72 -0
- package/dist/src/generators/lib/lib-utils.js +170 -0
- package/dist/src/generators/lib/lib-utils.js.map +1 -0
- package/dist/src/generators/lib/schema.d.ts +31 -0
- package/dist/src/generators/lib/schema.json +63 -0
- package/dist/src/generators/lib/style-dictionary.d.ts +36 -0
- package/dist/src/generators/lib/style-dictionary.js +183 -0
- package/dist/src/generators/lib/style-dictionary.js.map +1 -0
- package/dist/src/generators/lib/types/angular.d.ts +2 -0
- package/dist/src/generators/lib/types/angular.js +20 -0
- package/dist/src/generators/lib/types/angular.js.map +1 -0
- package/dist/src/generators/lib/types/assets.d.ts +2 -0
- package/dist/src/generators/lib/types/assets.js +20 -0
- package/dist/src/generators/lib/types/assets.js.map +1 -0
- package/dist/src/generators/lib/types/design-tokens.d.ts +10 -0
- package/dist/src/generators/lib/types/design-tokens.js +78 -0
- package/dist/src/generators/lib/types/design-tokens.js.map +1 -0
- package/dist/src/generators/lib/types/flutter.d.ts +2 -0
- package/dist/src/generators/lib/types/flutter.js +28 -0
- package/dist/src/generators/lib/types/flutter.js.map +1 -0
- package/dist/src/generators/lib/types/index.d.ts +8 -0
- package/dist/src/generators/lib/types/index.js +31 -0
- package/dist/src/generators/lib/types/index.js.map +1 -0
- package/dist/src/generators/lib/types/ionic.d.ts +4 -0
- package/dist/src/generators/lib/types/ionic.js +35 -0
- package/dist/src/generators/lib/types/ionic.js.map +1 -0
- package/dist/src/generators/lib/types/pii.d.ts +3 -0
- package/dist/src/generators/lib/types/pii.js +19 -0
- package/dist/src/generators/lib/types/pii.js.map +1 -0
- package/dist/src/generators/lib/types/session.d.ts +3 -0
- package/dist/src/generators/lib/types/session.js +21 -0
- package/dist/src/generators/lib/types/session.js.map +1 -0
- package/dist/src/generators/lib/types/state.d.ts +5 -0
- package/dist/src/generators/lib/types/state.js +48 -0
- package/dist/src/generators/lib/types/state.js.map +1 -0
- package/dist/src/generators/lib/types/styles.d.ts +2 -0
- package/dist/src/generators/lib/types/styles.js +19 -0
- package/dist/src/generators/lib/types/styles.js.map +1 -0
- package/dist/src/generators/lib/types/ts.d.ts +5 -0
- package/dist/src/generators/lib/types/ts.js +30 -0
- package/dist/src/generators/lib/types/ts.js.map +1 -0
- package/dist/src/generators/llm/generator.d.ts +8 -0
- package/dist/src/generators/llm/generator.js +13 -0
- package/dist/src/generators/llm/generator.js.map +1 -0
- package/dist/src/generators/llm/schema.d.ts +4 -0
- package/dist/src/generators/llm/schema.json +16 -0
- package/dist/src/generators/migrate/adapters/angular-cli.d.ts +82 -0
- package/dist/src/generators/migrate/adapters/angular-cli.js +439 -0
- package/dist/src/generators/migrate/adapters/angular-cli.js.map +1 -0
- package/dist/src/generators/migrate/adapters/angular-workspace.d.ts +28 -0
- package/dist/src/generators/migrate/adapters/angular-workspace.js +397 -0
- package/dist/src/generators/migrate/adapters/angular-workspace.js.map +1 -0
- package/dist/src/generators/migrate/adapters/external.d.ts +23 -0
- package/dist/src/generators/migrate/adapters/external.js +230 -0
- package/dist/src/generators/migrate/adapters/external.js.map +1 -0
- package/dist/src/generators/migrate/adapters/flutter.d.ts +26 -0
- package/dist/src/generators/migrate/adapters/flutter.js +176 -0
- package/dist/src/generators/migrate/adapters/flutter.js.map +1 -0
- package/dist/src/generators/migrate/adapters/index.d.ts +34 -0
- package/dist/src/generators/migrate/adapters/index.js +136 -0
- package/dist/src/generators/migrate/adapters/index.js.map +1 -0
- package/dist/src/generators/migrate/adapters/ionic.d.ts +17 -0
- package/dist/src/generators/migrate/adapters/ionic.js +137 -0
- package/dist/src/generators/migrate/adapters/ionic.js.map +1 -0
- package/dist/src/generators/migrate/adapters/npm-workspaces.d.ts +23 -0
- package/dist/src/generators/migrate/adapters/npm-workspaces.js +734 -0
- package/dist/src/generators/migrate/adapters/npm-workspaces.js.map +1 -0
- package/dist/src/generators/migrate/adapters/nx-workspace.d.ts +47 -0
- package/dist/src/generators/migrate/adapters/nx-workspace.js +1037 -0
- package/dist/src/generators/migrate/adapters/nx-workspace.js.map +1 -0
- package/dist/src/generators/migrate/adapters/scaffold.d.ts +2 -0
- package/dist/src/generators/migrate/adapters/scaffold.js +200 -0
- package/dist/src/generators/migrate/adapters/scaffold.js.map +1 -0
- package/dist/src/generators/migrate/adapters/types.d.ts +184 -0
- package/dist/src/generators/migrate/adapters/types.js +63 -0
- package/dist/src/generators/migrate/adapters/types.js.map +1 -0
- package/dist/src/generators/migrate/angular-code-scan.d.ts +6 -0
- package/dist/src/generators/migrate/angular-code-scan.js +150 -0
- package/dist/src/generators/migrate/angular-code-scan.js.map +1 -0
- package/dist/src/generators/migrate/angular-config-files.d.ts +49 -0
- package/dist/src/generators/migrate/angular-config-files.js +158 -0
- package/dist/src/generators/migrate/angular-config-files.js.map +1 -0
- package/dist/src/generators/migrate/angular-project-json.d.ts +73 -0
- package/dist/src/generators/migrate/angular-project-json.js +352 -0
- package/dist/src/generators/migrate/angular-project-json.js.map +1 -0
- package/dist/src/generators/migrate/angular-workspace/aliases.d.ts +30 -0
- package/dist/src/generators/migrate/angular-workspace/aliases.js +73 -0
- package/dist/src/generators/migrate/angular-workspace/aliases.js.map +1 -0
- package/dist/src/generators/migrate/angular-workspace/eslint.d.ts +8 -0
- package/dist/src/generators/migrate/angular-workspace/eslint.js +38 -0
- package/dist/src/generators/migrate/angular-workspace/eslint.js.map +1 -0
- package/dist/src/generators/migrate/angular-workspace/ng-package.d.ts +4 -0
- package/dist/src/generators/migrate/angular-workspace/ng-package.js +16 -0
- package/dist/src/generators/migrate/angular-workspace/ng-package.js.map +1 -0
- package/dist/src/generators/migrate/angular-workspace/source.d.ts +15 -0
- package/dist/src/generators/migrate/angular-workspace/source.js +108 -0
- package/dist/src/generators/migrate/angular-workspace/source.js.map +1 -0
- package/dist/src/generators/migrate/angular17.d.ts +45 -0
- package/dist/src/generators/migrate/angular17.js +495 -0
- package/dist/src/generators/migrate/angular17.js.map +1 -0
- package/dist/src/generators/migrate/batch.d.ts +29 -0
- package/dist/src/generators/migrate/batch.js +211 -0
- package/dist/src/generators/migrate/batch.js.map +1 -0
- package/dist/src/generators/migrate/copy.d.ts +60 -0
- package/dist/src/generators/migrate/copy.js +224 -0
- package/dist/src/generators/migrate/copy.js.map +1 -0
- package/dist/src/generators/migrate/dependencies.d.ts +38 -0
- package/dist/src/generators/migrate/dependencies.js +196 -0
- package/dist/src/generators/migrate/dependencies.js.map +1 -0
- package/dist/src/generators/migrate/generator.d.ts +9 -0
- package/dist/src/generators/migrate/generator.js +347 -0
- package/dist/src/generators/migrate/generator.js.map +1 -0
- package/dist/src/generators/migrate/imports/rewrite.d.ts +46 -0
- package/dist/src/generators/migrate/imports/rewrite.js +382 -0
- package/dist/src/generators/migrate/imports/rewrite.js.map +1 -0
- package/dist/src/generators/migrate/ionic/capacitor-config.d.ts +24 -0
- package/dist/src/generators/migrate/ionic/capacitor-config.js +113 -0
- package/dist/src/generators/migrate/ionic/capacitor-config.js.map +1 -0
- package/dist/src/generators/migrate/ionic/packages.d.ts +34 -0
- package/dist/src/generators/migrate/ionic/packages.js +92 -0
- package/dist/src/generators/migrate/ionic/packages.js.map +1 -0
- package/dist/src/generators/migrate/ionic/shape.d.ts +32 -0
- package/dist/src/generators/migrate/ionic/shape.js +221 -0
- package/dist/src/generators/migrate/ionic/shape.js.map +1 -0
- package/dist/src/generators/migrate/ionic/skip.d.ts +3 -0
- package/dist/src/generators/migrate/ionic/skip.js +25 -0
- package/dist/src/generators/migrate/ionic/skip.js.map +1 -0
- package/dist/src/generators/migrate/names.d.ts +3 -0
- package/dist/src/generators/migrate/names.js +21 -0
- package/dist/src/generators/migrate/names.js.map +1 -0
- package/dist/src/generators/migrate/npm-deps.d.ts +28 -0
- package/dist/src/generators/migrate/npm-deps.js +63 -0
- package/dist/src/generators/migrate/npm-deps.js.map +1 -0
- package/dist/src/generators/migrate/npm-workspaces/pnpm-yaml.d.ts +10 -0
- package/dist/src/generators/migrate/npm-workspaces/pnpm-yaml.js +246 -0
- package/dist/src/generators/migrate/npm-workspaces/pnpm-yaml.js.map +1 -0
- package/dist/src/generators/migrate/npm-workspaces/source.d.ts +46 -0
- package/dist/src/generators/migrate/npm-workspaces/source.js +253 -0
- package/dist/src/generators/migrate/npm-workspaces/source.js.map +1 -0
- package/dist/src/generators/migrate/nx/build-scripts.d.ts +22 -0
- package/dist/src/generators/migrate/nx/build-scripts.js +147 -0
- package/dist/src/generators/migrate/nx/build-scripts.js.map +1 -0
- package/dist/src/generators/migrate/nx/detect.d.ts +3 -0
- package/dist/src/generators/migrate/nx/detect.js +43 -0
- package/dist/src/generators/migrate/nx/detect.js.map +1 -0
- package/dist/src/generators/migrate/nx/env-encryption.d.ts +35 -0
- package/dist/src/generators/migrate/nx/env-encryption.js +423 -0
- package/dist/src/generators/migrate/nx/env-encryption.js.map +1 -0
- package/dist/src/generators/migrate/nx/rewrite.d.ts +27 -0
- package/dist/src/generators/migrate/nx/rewrite.js +223 -0
- package/dist/src/generators/migrate/nx/rewrite.js.map +1 -0
- package/dist/src/generators/migrate/nx/selection.d.ts +25 -0
- package/dist/src/generators/migrate/nx/selection.js +173 -0
- package/dist/src/generators/migrate/nx/selection.js.map +1 -0
- package/dist/src/generators/migrate/nx/shared-folders.d.ts +58 -0
- package/dist/src/generators/migrate/nx/shared-folders.js +239 -0
- package/dist/src/generators/migrate/nx/shared-folders.js.map +1 -0
- package/dist/src/generators/migrate/nx/workspace-source.d.ts +58 -0
- package/dist/src/generators/migrate/nx/workspace-source.js +275 -0
- package/dist/src/generators/migrate/nx/workspace-source.js.map +1 -0
- package/dist/src/generators/migrate/pnpm.d.ts +42 -0
- package/dist/src/generators/migrate/pnpm.js +132 -0
- package/dist/src/generators/migrate/pnpm.js.map +1 -0
- package/dist/src/generators/migrate/report.d.ts +21 -0
- package/dist/src/generators/migrate/report.js +243 -0
- package/dist/src/generators/migrate/report.js.map +1 -0
- package/dist/src/generators/migrate/rollback/manifest.d.ts +84 -0
- package/dist/src/generators/migrate/rollback/manifest.js +162 -0
- package/dist/src/generators/migrate/rollback/manifest.js.map +1 -0
- package/dist/src/generators/migrate/rollback/recording-tree.d.ts +19 -0
- package/dist/src/generators/migrate/rollback/recording-tree.js +87 -0
- package/dist/src/generators/migrate/rollback/recording-tree.js.map +1 -0
- package/dist/src/generators/migrate/rollback/rollback.d.ts +29 -0
- package/dist/src/generators/migrate/rollback/rollback.js +271 -0
- package/dist/src/generators/migrate/rollback/rollback.js.map +1 -0
- package/dist/src/generators/migrate/schema.d.ts +41 -0
- package/dist/src/generators/migrate/schema.json +85 -0
- package/dist/src/generators/migrate/source.d.ts +26 -0
- package/dist/src/generators/migrate/source.js +70 -0
- package/dist/src/generators/migrate/source.js.map +1 -0
- package/dist/src/generators/preset/files/root/.editorconfig__template__ +15 -0
- package/dist/src/generators/preset/files/root/.eslintignore__template__ +2 -0
- package/dist/src/generators/preset/files/root/.eslintrc.json__template__ +38 -0
- package/dist/src/generators/preset/files/root/.gitattributes__template__ +12 -0
- package/dist/src/generators/preset/files/root/.gitignore__template__ +9 -0
- package/dist/src/generators/preset/files/root/.husky/commit-msg__template__ +1 -0
- package/dist/src/generators/preset/files/root/.husky/pre-commit__template__ +1 -0
- package/dist/src/generators/preset/files/root/.npmrc__template__ +4 -0
- package/dist/src/generators/preset/files/root/.nvmrc__template__ +1 -0
- package/dist/src/generators/preset/files/root/.prettierignore__template__ +6 -0
- package/dist/src/generators/preset/files/root/.prettierrc__template__ +7 -0
- package/dist/src/generators/preset/files/root/commitlint.config.js__template__ +6 -0
- package/dist/src/generators/preset/files/root/nx.json__template__ +30 -0
- package/dist/src/generators/preset/files/root/package.json__template__ +34 -0
- package/dist/src/generators/preset/files/root/tools/config/sri-cdn-allowlist.json__template__ +1 -0
- package/dist/src/generators/preset/files/root/tsconfig.base.json__template__ +18 -0
- package/dist/src/generators/preset/generator.d.ts +11 -0
- package/dist/src/generators/preset/generator.js +91 -0
- package/dist/src/generators/preset/generator.js.map +1 -0
- package/dist/src/generators/preset/schema.d.ts +20 -0
- package/dist/src/generators/preset/schema.json +86 -0
- package/dist/src/generators/shared-libs/generator.d.ts +4 -0
- package/dist/src/generators/shared-libs/generator.js +60 -0
- package/dist/src/generators/shared-libs/generator.js.map +1 -0
- package/dist/src/generators/shared-libs/schema.d.ts +6 -0
- package/dist/src/generators/shared-libs/schema.json +21 -0
- package/dist/src/index.d.ts +16 -0
- package/dist/src/index.js +20 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/csp/allowlist.d.ts +64 -0
- package/dist/src/lib/csp/allowlist.js +126 -0
- package/dist/src/lib/csp/allowlist.js.map +1 -0
- package/dist/src/lib/csp/import.d.ts +52 -0
- package/dist/src/lib/csp/import.js +291 -0
- package/dist/src/lib/csp/import.js.map +1 -0
- package/dist/src/lib/csp/render.d.ts +19 -0
- package/dist/src/lib/csp/render.js +116 -0
- package/dist/src/lib/csp/render.js.map +1 -0
- package/dist/src/lib/env/derive.d.ts +38 -0
- package/dist/src/lib/env/derive.js +115 -0
- package/dist/src/lib/env/derive.js.map +1 -0
- package/dist/src/lib/env-encryption/backup.d.ts +40 -0
- package/dist/src/lib/env-encryption/backup.js +234 -0
- package/dist/src/lib/env-encryption/backup.js.map +1 -0
- package/dist/src/lib/env-encryption/config.d.ts +50 -0
- package/dist/src/lib/env-encryption/config.js +173 -0
- package/dist/src/lib/env-encryption/config.js.map +1 -0
- package/dist/src/lib/env-encryption/domains.d.ts +9 -0
- package/dist/src/lib/env-encryption/domains.js +52 -0
- package/dist/src/lib/env-encryption/domains.js.map +1 -0
- package/dist/src/lib/env-encryption/encrypt.d.ts +48 -0
- package/dist/src/lib/env-encryption/encrypt.js +407 -0
- package/dist/src/lib/env-encryption/encrypt.js.map +1 -0
- package/dist/src/lib/env-encryption/env-file.d.ts +72 -0
- package/dist/src/lib/env-encryption/env-file.js +395 -0
- package/dist/src/lib/env-encryption/env-file.js.map +1 -0
- package/dist/src/lib/env-encryption/gcm.d.ts +51 -0
- package/dist/src/lib/env-encryption/gcm.js +76 -0
- package/dist/src/lib/env-encryption/gcm.js.map +1 -0
- package/dist/src/lib/env-encryption/key-material.d.ts +53 -0
- package/dist/src/lib/env-encryption/key-material.js +148 -0
- package/dist/src/lib/env-encryption/key-material.js.map +1 -0
- package/dist/src/lib/env-encryption/placeholders.d.ts +15 -0
- package/dist/src/lib/env-encryption/placeholders.js +93 -0
- package/dist/src/lib/env-encryption/placeholders.js.map +1 -0
- package/dist/src/lib/env-encryption/prepare.d.ts +43 -0
- package/dist/src/lib/env-encryption/prepare.js +245 -0
- package/dist/src/lib/env-encryption/prepare.js.map +1 -0
- package/dist/src/lib/env-encryption/sensitive.d.ts +2 -0
- package/dist/src/lib/env-encryption/sensitive.js +180 -0
- package/dist/src/lib/env-encryption/sensitive.js.map +1 -0
- package/dist/src/lib/env-encryption/stamp.d.ts +2 -0
- package/dist/src/lib/env-encryption/stamp.js +52 -0
- package/dist/src/lib/env-encryption/stamp.js.map +1 -0
- package/dist/src/lib/env-encryption/switch-gcm.d.ts +43 -0
- package/dist/src/lib/env-encryption/switch-gcm.js +371 -0
- package/dist/src/lib/env-encryption/switch-gcm.js.map +1 -0
- package/dist/src/lib/env-encryption/workspace.d.ts +10 -0
- package/dist/src/lib/env-encryption/workspace.js +48 -0
- package/dist/src/lib/env-encryption/workspace.js.map +1 -0
- package/dist/src/lib/hardening/files.d.ts +17 -0
- package/dist/src/lib/hardening/files.js +43 -0
- package/dist/src/lib/hardening/files.js.map +1 -0
- package/dist/src/lib/hardening/integrity.d.ts +24 -0
- package/dist/src/lib/hardening/integrity.js +112 -0
- package/dist/src/lib/hardening/integrity.js.map +1 -0
- package/dist/src/lib/hardening/leak-check.d.ts +15 -0
- package/dist/src/lib/hardening/leak-check.js +100 -0
- package/dist/src/lib/hardening/leak-check.js.map +1 -0
- package/dist/src/lib/hardening/ngsw.d.ts +7 -0
- package/dist/src/lib/hardening/ngsw.js +55 -0
- package/dist/src/lib/hardening/ngsw.js.map +1 -0
- package/dist/src/lib/hardening/obfuscate.d.ts +36 -0
- package/dist/src/lib/hardening/obfuscate.js +153 -0
- package/dist/src/lib/hardening/obfuscate.js.map +1 -0
- package/dist/src/lib/hardening/options.d.ts +36 -0
- package/dist/src/lib/hardening/options.js +143 -0
- package/dist/src/lib/hardening/options.js.map +1 -0
- package/dist/src/lib/hardening/source-maps.d.ts +7 -0
- package/dist/src/lib/hardening/source-maps.js +37 -0
- package/dist/src/lib/hardening/source-maps.js.map +1 -0
- package/dist/src/lib/hardening/strip.d.ts +55 -0
- package/dist/src/lib/hardening/strip.js +178 -0
- package/dist/src/lib/hardening/strip.js.map +1 -0
- package/dist/src/lib/helpers/encrypt-env.d.ts +13 -0
- package/dist/src/lib/helpers/encrypt-env.js +33 -0
- package/dist/src/lib/helpers/encrypt-env.js.map +1 -0
- package/dist/src/lib/helpers/inject-meta.d.ts +14 -0
- package/dist/src/lib/helpers/inject-meta.js +49 -0
- package/dist/src/lib/helpers/inject-meta.js.map +1 -0
- package/dist/src/lib/helpers/inject-nonce.d.ts +7 -0
- package/dist/src/lib/helpers/inject-nonce.js +59 -0
- package/dist/src/lib/helpers/inject-nonce.js.map +1 -0
- package/dist/src/lib/helpers/inject-sri.d.ts +11 -0
- package/dist/src/lib/helpers/inject-sri.js +92 -0
- package/dist/src/lib/helpers/inject-sri.js.map +1 -0
- package/dist/src/lib/helpers/strip-exif.d.ts +9 -0
- package/dist/src/lib/helpers/strip-exif.js +52 -0
- package/dist/src/lib/helpers/strip-exif.js.map +1 -0
- package/dist/src/lib/release/plan.d.ts +45 -0
- package/dist/src/lib/release/plan.js +76 -0
- package/dist/src/lib/release/plan.js.map +1 -0
- package/dist/src/lib/release/run.d.ts +46 -0
- package/dist/src/lib/release/run.js +160 -0
- package/dist/src/lib/release/run.js.map +1 -0
- package/dist/src/lib/utils/angular-deps.d.ts +22 -0
- package/dist/src/lib/utils/angular-deps.js +108 -0
- package/dist/src/lib/utils/angular-deps.js.map +1 -0
- package/dist/src/lib/utils/angular-project.d.ts +52 -0
- package/dist/src/lib/utils/angular-project.js +168 -0
- package/dist/src/lib/utils/angular-project.js.map +1 -0
- package/dist/src/lib/utils/app-dir.d.ts +17 -0
- package/dist/src/lib/utils/app-dir.js +52 -0
- package/dist/src/lib/utils/app-dir.js.map +1 -0
- package/dist/src/lib/utils/base-href.d.ts +26 -0
- package/dist/src/lib/utils/base-href.js +60 -0
- package/dist/src/lib/utils/base-href.js.map +1 -0
- package/dist/src/lib/utils/ci-resolve.d.ts +10 -0
- package/dist/src/lib/utils/ci-resolve.js +50 -0
- package/dist/src/lib/utils/ci-resolve.js.map +1 -0
- package/dist/src/lib/utils/csp-nonce.d.ts +34 -0
- package/dist/src/lib/utils/csp-nonce.js +142 -0
- package/dist/src/lib/utils/csp-nonce.js.map +1 -0
- package/dist/src/lib/utils/dependencies.d.ts +25 -0
- package/dist/src/lib/utils/dependencies.js +71 -0
- package/dist/src/lib/utils/dependencies.js.map +1 -0
- package/dist/src/lib/utils/devkit-deps.d.ts +19 -0
- package/dist/src/lib/utils/devkit-deps.js +34 -0
- package/dist/src/lib/utils/devkit-deps.js.map +1 -0
- package/dist/src/lib/utils/env-files.d.ts +18 -0
- package/dist/src/lib/utils/env-files.js +41 -0
- package/dist/src/lib/utils/env-files.js.map +1 -0
- package/dist/src/lib/utils/filesystem.d.ts +7 -0
- package/dist/src/lib/utils/filesystem.js +20 -0
- package/dist/src/lib/utils/filesystem.js.map +1 -0
- package/dist/src/lib/utils/flutter-web.d.ts +7 -0
- package/dist/src/lib/utils/flutter-web.js +56 -0
- package/dist/src/lib/utils/flutter-web.js.map +1 -0
- package/dist/src/lib/utils/knip.d.ts +16 -0
- package/dist/src/lib/utils/knip.js +71 -0
- package/dist/src/lib/utils/knip.js.map +1 -0
- package/dist/src/lib/utils/lint-staged.d.ts +5 -0
- package/dist/src/lib/utils/lint-staged.js +34 -0
- package/dist/src/lib/utils/lint-staged.js.map +1 -0
- package/dist/src/lib/utils/llm-block.d.ts +88 -0
- package/dist/src/lib/utils/llm-block.js +457 -0
- package/dist/src/lib/utils/llm-block.js.map +1 -0
- package/dist/src/lib/utils/node-engine.d.ts +9 -0
- package/dist/src/lib/utils/node-engine.js +63 -0
- package/dist/src/lib/utils/node-engine.js.map +1 -0
- package/dist/src/lib/utils/npm-scripts.d.ts +7 -0
- package/dist/src/lib/utils/npm-scripts.js +28 -0
- package/dist/src/lib/utils/npm-scripts.js.map +1 -0
- package/dist/src/lib/utils/nx-targets.d.ts +3 -0
- package/dist/src/lib/utils/nx-targets.js +25 -0
- package/dist/src/lib/utils/nx-targets.js.map +1 -0
- package/dist/src/lib/utils/project-json-files.d.ts +23 -0
- package/dist/src/lib/utils/project-json-files.js +73 -0
- package/dist/src/lib/utils/project-json-files.js.map +1 -0
- package/dist/src/lib/utils/quality.d.ts +71 -0
- package/dist/src/lib/utils/quality.js +295 -0
- package/dist/src/lib/utils/quality.js.map +1 -0
- package/dist/src/lib/utils/serve-port.d.ts +28 -0
- package/dist/src/lib/utils/serve-port.js +73 -0
- package/dist/src/lib/utils/serve-port.js.map +1 -0
- package/dist/src/lib/utils/shared-libs.d.ts +37 -0
- package/dist/src/lib/utils/shared-libs.js +152 -0
- package/dist/src/lib/utils/shared-libs.js.map +1 -0
- package/dist/src/lib/utils/ts-paths.d.ts +3 -0
- package/dist/src/lib/utils/ts-paths.js +31 -0
- package/dist/src/lib/utils/ts-paths.js.map +1 -0
- package/dist/src/lib/utils/workspace.d.ts +3 -0
- package/dist/src/lib/utils/workspace.js +15 -0
- package/dist/src/lib/utils/workspace.js.map +1 -0
- package/dist/src/migrate-sdk.d.ts +31 -0
- package/dist/src/migrate-sdk.js +35 -0
- package/dist/src/migrate-sdk.js.map +1 -0
- package/dist/src/migrations/add-csp-nonce-import/add-csp-nonce-import.d.ts +2 -0
- package/dist/src/migrations/add-csp-nonce-import/add-csp-nonce-import.js +40 -0
- package/dist/src/migrations/add-csp-nonce-import/add-csp-nonce-import.js.map +1 -0
- package/dist/src/migrations/add-executor-peers/add-executor-peers.d.ts +6 -0
- package/dist/src/migrations/add-executor-peers/add-executor-peers.js +21 -0
- package/dist/src/migrations/add-executor-peers/add-executor-peers.js.map +1 -0
- package/dist/src/migrations/add-lib-build-dependencies/add-lib-build-dependencies.d.ts +7 -0
- package/dist/src/migrations/add-lib-build-dependencies/add-lib-build-dependencies.js +47 -0
- package/dist/src/migrations/add-lib-build-dependencies/add-lib-build-dependencies.js.map +1 -0
- package/dist/src/migrations/add-lint-dependencies/add-lint-dependencies.d.ts +6 -0
- package/dist/src/migrations/add-lint-dependencies/add-lint-dependencies.js +27 -0
- package/dist/src/migrations/add-lint-dependencies/add-lint-dependencies.js.map +1 -0
- package/dist/src/migrations/add-lint-staged-config/add-lint-staged-config.d.ts +7 -0
- package/dist/src/migrations/add-lint-staged-config/add-lint-staged-config.js +22 -0
- package/dist/src/migrations/add-lint-staged-config/add-lint-staged-config.js.map +1 -0
- package/dist/src/migrations/angular-release-target/angular-release-target.d.ts +3 -0
- package/dist/src/migrations/angular-release-target/angular-release-target.js +80 -0
- package/dist/src/migrations/angular-release-target/angular-release-target.js.map +1 -0
- package/dist/src/migrations/app-clean-and-port/app-clean-and-port.d.ts +7 -0
- package/dist/src/migrations/app-clean-and-port/app-clean-and-port.js +89 -0
- package/dist/src/migrations/app-clean-and-port/app-clean-and-port.js.map +1 -0
- package/dist/src/migrations/env-encryption-config/env-encryption-config.d.ts +7 -0
- package/dist/src/migrations/env-encryption-config/env-encryption-config.js +42 -0
- package/dist/src/migrations/env-encryption-config/env-encryption-config.js.map +1 -0
- package/dist/src/migrations/env-encryption-key-sources/env-encryption-key-sources.d.ts +3 -0
- package/dist/src/migrations/env-encryption-key-sources/env-encryption-key-sources.js +15 -0
- package/dist/src/migrations/env-encryption-key-sources/env-encryption-key-sources.js.map +1 -0
- package/dist/src/migrations/fix-lint-script/fix-lint-script.d.ts +7 -0
- package/dist/src/migrations/fix-lint-script/fix-lint-script.js +27 -0
- package/dist/src/migrations/fix-lint-script/fix-lint-script.js.map +1 -0
- package/dist/src/migrations/flutter-web-platform/flutter-web-platform.d.ts +8 -0
- package/dist/src/migrations/flutter-web-platform/flutter-web-platform.js +35 -0
- package/dist/src/migrations/flutter-web-platform/flutter-web-platform.js.map +1 -0
- package/dist/src/migrations/plugin-repo-dev/plugin-repo-dev.d.ts +9 -0
- package/dist/src/migrations/plugin-repo-dev/plugin-repo-dev.js +42 -0
- package/dist/src/migrations/plugin-repo-dev/plugin-repo-dev.js.map +1 -0
- package/dist/src/migrations/prepush-audit-warn-only/prepush-audit-warn-only.d.ts +8 -0
- package/dist/src/migrations/prepush-audit-warn-only/prepush-audit-warn-only.js +30 -0
- package/dist/src/migrations/prepush-audit-warn-only/prepush-audit-warn-only.js.map +1 -0
- package/dist/src/migrations/quality-checks/quality-checks.d.ts +7 -0
- package/dist/src/migrations/quality-checks/quality-checks.js +46 -0
- package/dist/src/migrations/quality-checks/quality-checks.js.map +1 -0
- package/dist/src/migrations/release-hardening/release-hardening.d.ts +8 -0
- package/dist/src/migrations/release-hardening/release-hardening.js +98 -0
- package/dist/src/migrations/release-hardening/release-hardening.js.map +1 -0
- package/dist/src/migrations/sharp-security-update/sharp-security-update.d.ts +10 -0
- package/dist/src/migrations/sharp-security-update/sharp-security-update.js +40 -0
- package/dist/src/migrations/sharp-security-update/sharp-security-update.js.map +1 -0
- package/migrate/package.json +5 -0
- package/package.json +120 -4
- package/runtime/csp-nonce.js +109 -0
- package/runtime/env-secret.d.ts +63 -0
- package/runtime/env-secret.mjs +698 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readBuildScripts = exports.baseHrefsInScript = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
7
|
+
const angular_project_json_1 = require("../angular-project-json");
|
|
8
|
+
const ENV_NAME = {
|
|
9
|
+
development: 'dev',
|
|
10
|
+
production: 'prod',
|
|
11
|
+
};
|
|
12
|
+
const releaseName = (env) => ENV_NAME[env] ?? (0, angular_project_json_1.releaseConfigName)(env);
|
|
13
|
+
const flag = (cmd, names) => {
|
|
14
|
+
for (const n of names) {
|
|
15
|
+
const m = new RegExp(`(?:^|\\s)--?${n}(?:=|\\s+)(['"]?)([^\\s'"]+)\\1`).exec(cmd);
|
|
16
|
+
if (m)
|
|
17
|
+
return m[2];
|
|
18
|
+
}
|
|
19
|
+
return undefined;
|
|
20
|
+
};
|
|
21
|
+
const escape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
22
|
+
/** The `{ … }` text starting at `open` (balanced braces, quotes skipped). */
|
|
23
|
+
function objectAt(text, open) {
|
|
24
|
+
let depth = 0;
|
|
25
|
+
let quote;
|
|
26
|
+
for (let i = open; i < text.length; i++) {
|
|
27
|
+
const c = text[i];
|
|
28
|
+
if (quote) {
|
|
29
|
+
if (c === '\\')
|
|
30
|
+
i++;
|
|
31
|
+
else if (c === quote)
|
|
32
|
+
quote = undefined;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (c === "'" || c === '"' || c === '`')
|
|
36
|
+
quote = c;
|
|
37
|
+
else if (c === '{')
|
|
38
|
+
depth++;
|
|
39
|
+
else if (c === '}' && --depth === 0)
|
|
40
|
+
return text.slice(open, i + 1);
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
/** `project: '/x/'` or `project: { uat: '/x/', … }` at the top level of a map's text. */
|
|
45
|
+
function hrefsInMap(map, project) {
|
|
46
|
+
const key = `(?:^|[\\s,{])(['"]?)${escape(project)}\\1\\s*:\\s*`;
|
|
47
|
+
const str = new RegExp(`${key}(['"\`])(\\/[^'"\`]*)\\2`, 'm').exec(map);
|
|
48
|
+
if (str)
|
|
49
|
+
return { '*': str[3] };
|
|
50
|
+
const obj = new RegExp(`${key}\\{([^{}]*)\\}`, 'm').exec(map);
|
|
51
|
+
if (!obj)
|
|
52
|
+
return undefined;
|
|
53
|
+
const out = {};
|
|
54
|
+
for (const m of obj[2].matchAll(/(['"]?)(\w+)\1\s*:\s*(['"`])(\/[^'"`]*)\3/g)) {
|
|
55
|
+
out[releaseName(m[2])] = m[4];
|
|
56
|
+
}
|
|
57
|
+
return Object.keys(out).length > 0 ? out : undefined;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Base hrefs for `project` in a script's text, read only from maps whose name says base href
|
|
61
|
+
* (`const BASE_HREF = { project: '/x/' }`, `baseHrefs: { project: { uat: '/x/' } }`). Values must
|
|
62
|
+
* start with "/". Undefined when there is none, or when two maps disagree.
|
|
63
|
+
*/
|
|
64
|
+
function baseHrefsInScript(text, project) {
|
|
65
|
+
const found = [];
|
|
66
|
+
for (const m of text.matchAll(/[\w$]*base[_-]?hrefs?[\w$]*['"]?\s*[:=]\s*\{/gi)) {
|
|
67
|
+
const map = objectAt(text, (m.index ?? 0) + m[0].length - 1);
|
|
68
|
+
const hrefs = map ? hrefsInMap(map, project) : undefined;
|
|
69
|
+
if (hrefs)
|
|
70
|
+
found.push(hrefs);
|
|
71
|
+
}
|
|
72
|
+
if (found.length === 0)
|
|
73
|
+
return undefined;
|
|
74
|
+
const first = JSON.stringify(found[0]);
|
|
75
|
+
return found.every((f) => JSON.stringify(f) === first) ? found[0] : undefined;
|
|
76
|
+
}
|
|
77
|
+
exports.baseHrefsInScript = baseHrefsInScript;
|
|
78
|
+
function readBuildScripts(sourceDir, scripts, projects) {
|
|
79
|
+
const info = {
|
|
80
|
+
baseHrefs: new Map(),
|
|
81
|
+
customBuilds: {},
|
|
82
|
+
customScripts: [],
|
|
83
|
+
unread: [],
|
|
84
|
+
};
|
|
85
|
+
const names = new Set(projects);
|
|
86
|
+
const texts = new Map();
|
|
87
|
+
const read = (rel) => {
|
|
88
|
+
if (!texts.has(rel)) {
|
|
89
|
+
try {
|
|
90
|
+
texts.set(rel, fs.readFileSync(path.join(sourceDir, ...rel.split('/')), 'utf8'));
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
texts.set(rel, undefined);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return texts.get(rel);
|
|
97
|
+
};
|
|
98
|
+
const set = (project, env, href) => {
|
|
99
|
+
const hrefs = info.baseHrefs.get(project) ?? {};
|
|
100
|
+
hrefs[env] = href;
|
|
101
|
+
info.baseHrefs.set(project, hrefs);
|
|
102
|
+
};
|
|
103
|
+
const customProjects = new Map();
|
|
104
|
+
for (const [name, cmd] of Object.entries(scripts ?? {})) {
|
|
105
|
+
if (typeof cmd !== 'string')
|
|
106
|
+
continue;
|
|
107
|
+
// nx build <p> / nx run <p>:build[:<c>] / ng build <p>, with --configuration and --base-href.
|
|
108
|
+
const direct = /\b(?:nx|ng)\s+(?:build\s+([\w.-]+)|run\s+([\w.-]+):build(?::([\w-]+))?)/.exec(cmd);
|
|
109
|
+
if (direct) {
|
|
110
|
+
const project = direct[1] ?? direct[2];
|
|
111
|
+
const href = flag(cmd, ['base-href', 'baseHref']);
|
|
112
|
+
const config = direct[3] ?? flag(cmd, ['configuration', 'c']);
|
|
113
|
+
if (names.has(project) && href)
|
|
114
|
+
set(project, config ? releaseName(config) : '*', href);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const node = /\bnode\s+(['"]?)([^\s'"]+\.(?:c|m)?js)\1/.exec(cmd);
|
|
118
|
+
if (!node || !/build/i.test(`${name} ${node[2]}`))
|
|
119
|
+
continue;
|
|
120
|
+
const script = path.posix.normalize(node[2].replace(/^\.\//, ''));
|
|
121
|
+
const project = flag(cmd, ['project', 'app']);
|
|
122
|
+
if (!project || (!names.has(project) && project !== 'all'))
|
|
123
|
+
continue;
|
|
124
|
+
info.customBuilds[name] = cmd;
|
|
125
|
+
if (!info.customScripts.includes(script))
|
|
126
|
+
info.customScripts.push(script);
|
|
127
|
+
const env = flag(cmd, ['env', 'configuration', 'c']);
|
|
128
|
+
const targets = project === 'all' ? [...names] : [project];
|
|
129
|
+
for (const p of targets) {
|
|
130
|
+
customProjects.set(p, script);
|
|
131
|
+
const hrefs = read(script) !== undefined ? baseHrefsInScript(read(script), p) : undefined;
|
|
132
|
+
if (!hrefs)
|
|
133
|
+
continue;
|
|
134
|
+
for (const [e, href] of Object.entries(hrefs)) {
|
|
135
|
+
if (e === '*' && env)
|
|
136
|
+
set(p, releaseName(env), href);
|
|
137
|
+
else
|
|
138
|
+
set(p, e, href);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
info.customScripts.sort();
|
|
143
|
+
info.unread = [...customProjects.keys()].filter((p) => !info.baseHrefs.has(p)).sort();
|
|
144
|
+
return info;
|
|
145
|
+
}
|
|
146
|
+
exports.readBuildScripts = readBuildScripts;
|
|
147
|
+
//# sourceMappingURL=build-scripts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-scripts.js","sourceRoot":"","sources":["../../../../../src/generators/migrate/nx/build-scripts.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,mDAA6B;AAE7B,kEAA4D;AAmB5D,MAAM,QAAQ,GAA2B;IACvC,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,MAAM;CACnB,CAAC;AACF,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAA,wCAAiB,EAAC,GAAG,CAAC,CAAC;AAE7E,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,KAAe,EAAsB,EAAE;IAChE,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE;QACrB,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,eAAe,CAAC,iCAAiC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClF,IAAI,CAAC;YAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;KACpB;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAEvE,6EAA6E;AAC7E,SAAS,QAAQ,CAAC,IAAY,EAAE,IAAY;IAC1C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAyB,CAAC;IA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AAlED,4CAkEC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.detectNxWorkspace = exports.SUPPORTED_NX_MAJORS = void 0;
|
|
4
|
+
const dependencies_1 = require("../../../lib/utils/dependencies");
|
|
5
|
+
const source_1 = require("../source");
|
|
6
|
+
const workspace_source_1 = require("./workspace-source");
|
|
7
|
+
exports.SUPPORTED_NX_MAJORS = [15, 16, 17];
|
|
8
|
+
function detectNxWorkspace(sourceDir) {
|
|
9
|
+
if (!(0, source_1.sourceExists)(sourceDir, 'nx.json'))
|
|
10
|
+
return { confidence: 0, reasons: ['no nx.json'] };
|
|
11
|
+
const version = (0, workspace_source_1.sourceNxVersion)(sourceDir);
|
|
12
|
+
const major = version ? (0, dependencies_1.majorOf)(version) : undefined;
|
|
13
|
+
const reasons = [`nx.json, Nx ${version ?? '(version not found in package.json)'}`];
|
|
14
|
+
let confidence = 0.95;
|
|
15
|
+
if (major === undefined || !exports.SUPPORTED_NX_MAJORS.includes(major)) {
|
|
16
|
+
confidence = 0.5;
|
|
17
|
+
reasons.push(`Nx ${major ?? '?'} is outside the supported 15–17`);
|
|
18
|
+
}
|
|
19
|
+
let projects;
|
|
20
|
+
try {
|
|
21
|
+
projects = (0, workspace_source_1.discoverProjects)(sourceDir);
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
25
|
+
return { confidence: 0.3, reasons: [...reasons, message.replace(/^migrate: /, '')] };
|
|
26
|
+
}
|
|
27
|
+
const counts = new Map();
|
|
28
|
+
for (const p of projects)
|
|
29
|
+
counts.set(p.kind, (counts.get(p.kind) ?? 0) + 1);
|
|
30
|
+
reasons.push(projects.length === 0
|
|
31
|
+
? 'no projects found'
|
|
32
|
+
: `projects: ${[...counts]
|
|
33
|
+
.sort(([a], [b]) => (a < b ? -1 : 1))
|
|
34
|
+
.map(([kind, n]) => `${n} ${kind}`)
|
|
35
|
+
.join(', ')}`);
|
|
36
|
+
if (!projects.some((p) => (0, workspace_source_1.isSupportedKind)(p.kind))) {
|
|
37
|
+
confidence = Math.min(confidence, 0.3);
|
|
38
|
+
reasons.push('no project nx-polystack can migrate yet');
|
|
39
|
+
}
|
|
40
|
+
return { confidence, reasons };
|
|
41
|
+
}
|
|
42
|
+
exports.detectNxWorkspace = detectNxWorkspace;
|
|
43
|
+
//# sourceMappingURL=detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.js","sourceRoot":"","sources":["../../../../../src/generators/migrate/nx/detect.ts"],"names":[],"mappings":";;;AAAA,kEAA0D;AAE1D,sCAAyC;AAEzC,yDAK4B;AAEf,QAAA,mBAAmB,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAEhD,SAAgB,iBAAiB,CAAC,SAAiB;IACjD,IAAI,CAAC,IAAA,qBAAY,EAAC,SAAS,EAAE,SAAS,CAAC;QAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC;IAC3F,MAAM,OAAO,GAAG,IAAA,kCAAe,EAAC,SAAS,CAAC,CAAC;IAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,IAAA,sBAAO,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACrD,MAAM,OAAO,GAAG,CAAC,eAAe,OAAO,IAAI,qCAAqC,EAAE,CAAC,CAAC;IACpF,IAAI,UAAU,GAAG,IAAI,CAAC;IACtB,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,2BAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAC/D,UAAU,GAAG,GAAG,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,GAAG,iCAAiC,CAAC,CAAC;KACnE;IACD,IAAI,QAAyB,CAAC;IAC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,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QACvC,OAAO,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;KACzD;IACD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AACjC,CAAC;AAhCD,8CAgCC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
export declare const RUNTIME_MODULE = "@mouryaamit/nx-polystack/runtime/env-secret";
|
|
3
|
+
/**
|
|
4
|
+
* The string items of `NAME = [ … ]` in a script (the declaration outside comments and strings).
|
|
5
|
+
* Undefined when it is missing or an item is anything but one plain quoted string.
|
|
6
|
+
*/
|
|
7
|
+
export declare function stringArrayConst(text: string, name: string): string[] | undefined;
|
|
8
|
+
export interface SourceEnvEncryption {
|
|
9
|
+
script: string;
|
|
10
|
+
publicKeys: string[];
|
|
11
|
+
profileFiles: string[];
|
|
12
|
+
timeField?: string;
|
|
13
|
+
branchField?: string;
|
|
14
|
+
/** Set by applySourceEnvEncryption when the workspace settings were changed to match. */
|
|
15
|
+
applied?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** The source's own env encryption, when it has the known shape. */
|
|
18
|
+
export declare function detectSourceEnvEncryption(sourceDir: string): SourceEnvEncryption | {
|
|
19
|
+
unreadable: string;
|
|
20
|
+
} | undefined;
|
|
21
|
+
/** C2: settings that make the release build encrypt like the source's script. */
|
|
22
|
+
export declare function applySourceEnvEncryption(tree: Tree, sourceDir: string, notes: string[], copiedRoots?: string[]): SourceEnvEncryption | undefined;
|
|
23
|
+
/** Names a module exports (declarations and `export { … }` lists); `default` for a default export. */
|
|
24
|
+
export declare function exportedNames(text: string): string[];
|
|
25
|
+
/**
|
|
26
|
+
* Whether an env-secret.ts has the known shape: CryptoJS with the ENC() marker, exports
|
|
27
|
+
* envSecret and decryptEnvironment, exports nothing the wrapper would not keep, and imports
|
|
28
|
+
* `environment` from a relative path.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isKnownEnvSecret(text: string): {
|
|
31
|
+
envImport: string;
|
|
32
|
+
} | undefined;
|
|
33
|
+
export declare function envSecretWrapper(file: string, envImport: string): string;
|
|
34
|
+
/** C1: known-shape env-secret.ts files under `roots` become wrappers of the runtime module. */
|
|
35
|
+
export declare function swapEnvSecretModules(tree: Tree, roots: string[], notes: string[], sourceDir?: string): void;
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.swapEnvSecretModules = exports.envSecretWrapper = exports.isKnownEnvSecret = exports.exportedNames = exports.applySourceEnvEncryption = exports.detectSourceEnvEncryption = exports.stringArrayConst = exports.RUNTIME_MODULE = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
7
|
+
const config_1 = require("../../../lib/env-encryption/config");
|
|
8
|
+
const env_file_1 = require("../../../lib/env-encryption/env-file");
|
|
9
|
+
const workspace_1 = require("../../../lib/env-encryption/workspace");
|
|
10
|
+
const angular_project_1 = require("../../../lib/utils/angular-project");
|
|
11
|
+
/**
|
|
12
|
+
* Sources that encrypt env files with their own script (deny by default, `ENC(...)` values,
|
|
13
|
+
* `PUBLIC_ENV_KEYS`, sensitive fields of `app.profile.ts`) and decrypt them with their own
|
|
14
|
+
* `env-secret.ts`: the workspace's env encryption settings are set to produce the same output, and
|
|
15
|
+
* a known-shape `env-secret.ts` becomes a wrapper of the library runtime module.
|
|
16
|
+
*/
|
|
17
|
+
const code = (s) => `\`${s}\``;
|
|
18
|
+
exports.RUNTIME_MODULE = '@mouryaamit/nx-polystack/runtime/env-secret';
|
|
19
|
+
function readSource(sourceDir, rel) {
|
|
20
|
+
try {
|
|
21
|
+
return fs.readFileSync(path.join(sourceDir, ...rel.split('/')), 'utf8');
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Source files under `dir` (relative, POSIX) matching `test`, a few levels deep. */
|
|
28
|
+
function findSourceFiles(sourceDir, dir, test, depth = 3) {
|
|
29
|
+
const out = [];
|
|
30
|
+
const walk = (rel, d) => {
|
|
31
|
+
let entries;
|
|
32
|
+
try {
|
|
33
|
+
entries = fs.readdirSync(path.join(sourceDir, ...rel.split('/')), { withFileTypes: true });
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
for (const e of entries) {
|
|
39
|
+
const child = rel ? `${rel}/${e.name}` : e.name;
|
|
40
|
+
if (e.isDirectory() && d > 0 && e.name !== 'node_modules' && !e.name.startsWith('.')) {
|
|
41
|
+
walk(child, d - 1);
|
|
42
|
+
}
|
|
43
|
+
else if (e.isFile() && test.test(e.name))
|
|
44
|
+
out.push(child);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
walk(dir, depth);
|
|
48
|
+
return out.sort();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The string items of `NAME = [ … ]` in a script (the declaration outside comments and strings).
|
|
52
|
+
* Undefined when it is missing or an item is anything but one plain quoted string.
|
|
53
|
+
*/
|
|
54
|
+
function stringArrayConst(text, name) {
|
|
55
|
+
const re = new RegExp(`\\b${name}\\s*=\\s*\\[`, 'g');
|
|
56
|
+
let m;
|
|
57
|
+
while ((m = re.exec(text))) {
|
|
58
|
+
if (!(0, env_file_1.isCodeAt)(text, m.index))
|
|
59
|
+
continue;
|
|
60
|
+
const open = m.index + m[0].length - 1;
|
|
61
|
+
const close = (0, env_file_1.closingBracket)(text, open);
|
|
62
|
+
if (close < 0)
|
|
63
|
+
return undefined;
|
|
64
|
+
const body = (0, env_file_1.stripComments)(text.slice(open + 1, close));
|
|
65
|
+
const items = [];
|
|
66
|
+
for (const raw of splitTopLevel(body)) {
|
|
67
|
+
const item = raw.trim();
|
|
68
|
+
if (item === '')
|
|
69
|
+
continue;
|
|
70
|
+
const strs = (0, env_file_1.quotedStrings)(item);
|
|
71
|
+
if (strs.length !== 1 || strs[0].start !== 0 || strs[0].end !== item.length)
|
|
72
|
+
return undefined;
|
|
73
|
+
items.push((0, env_file_1.unescapeString)(strs[0].content));
|
|
74
|
+
}
|
|
75
|
+
return items;
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
exports.stringArrayConst = stringArrayConst;
|
|
80
|
+
/** Splits list text at top-level commas (strings kept intact). */
|
|
81
|
+
function splitTopLevel(body) {
|
|
82
|
+
const parts = [];
|
|
83
|
+
let last = 0;
|
|
84
|
+
let depth = 0;
|
|
85
|
+
const strings = (0, env_file_1.quotedStrings)(body);
|
|
86
|
+
let si = 0;
|
|
87
|
+
for (let i = 0; i < body.length; i++) {
|
|
88
|
+
while (si < strings.length && strings[si].end <= i)
|
|
89
|
+
si++;
|
|
90
|
+
if (si < strings.length && strings[si].start <= i && i < strings[si].end) {
|
|
91
|
+
i = strings[si].end - 1;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const c = body[i];
|
|
95
|
+
if (c === '[' || c === '{' || c === '(')
|
|
96
|
+
depth++;
|
|
97
|
+
else if (c === ']' || c === '}' || c === ')')
|
|
98
|
+
depth--;
|
|
99
|
+
else if (c === ',' && depth === 0) {
|
|
100
|
+
parts.push(body.slice(last, i));
|
|
101
|
+
last = i + 1;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
parts.push(body.slice(last));
|
|
105
|
+
return parts;
|
|
106
|
+
}
|
|
107
|
+
/** The source's own env encryption, when it has the known shape. */
|
|
108
|
+
function detectSourceEnvEncryption(sourceDir) {
|
|
109
|
+
let unreadable;
|
|
110
|
+
const scripts = findSourceFiles(sourceDir, 'tools', /^encrypt-env\.(c?js|ts)$/);
|
|
111
|
+
for (const script of scripts) {
|
|
112
|
+
const text = readSource(sourceDir, script) ?? '';
|
|
113
|
+
if (!text.includes('ENC('))
|
|
114
|
+
continue;
|
|
115
|
+
const publicKeys = stringArrayConst(text, 'PUBLIC_ENV_KEYS');
|
|
116
|
+
if (!publicKeys) {
|
|
117
|
+
unreadable = script;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const envFiles = findSourceFiles(sourceDir, 'environments', /^environment.*\.ts$/, 2);
|
|
121
|
+
// Profiles next to the env files (environments/<app>/app.profile.ts) only.
|
|
122
|
+
const profiles = findSourceFiles(sourceDir, 'environments', /^app\.profile\.ts$/, 2).filter((f) => /^environments\/[^/]+\/app\.profile\.ts$/.test(f));
|
|
123
|
+
const declared = new Set();
|
|
124
|
+
for (const f of envFiles) {
|
|
125
|
+
for (const field of (0, env_file_1.environmentFields)(readSource(sourceDir, f) ?? ''))
|
|
126
|
+
declared.add(field.key);
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
script,
|
|
130
|
+
publicKeys,
|
|
131
|
+
profileFiles: profiles.length > 0 ? ['app.profile.ts'] : [],
|
|
132
|
+
timeField: declared.has('timeStamp') ? 'timeStamp' : undefined,
|
|
133
|
+
branchField: declared.has('branchName')
|
|
134
|
+
? 'branchName'
|
|
135
|
+
: declared.has('branch')
|
|
136
|
+
? 'branch'
|
|
137
|
+
: undefined,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
return unreadable ? { unreadable } : undefined;
|
|
141
|
+
}
|
|
142
|
+
exports.detectSourceEnvEncryption = detectSourceEnvEncryption;
|
|
143
|
+
/** True when the workspace block is absent or still the untouched default of the preset/migration. */
|
|
144
|
+
function isDefaultBlock(raw) {
|
|
145
|
+
if (raw === undefined)
|
|
146
|
+
return true;
|
|
147
|
+
let cfg;
|
|
148
|
+
try {
|
|
149
|
+
cfg = (0, config_1.normalizeEnvEncryption)(raw);
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
const stampDefault = cfg.stamp === undefined || JSON.stringify(cfg.stamp) === JSON.stringify(config_1.DEFAULT_STAMP);
|
|
155
|
+
return (cfg.mode === 'listed' &&
|
|
156
|
+
Object.values(cfg.keys).every((k) => k.length === 0) &&
|
|
157
|
+
JSON.stringify(cfg.publicKeys) === JSON.stringify(config_1.DEFAULT_PUBLIC_KEYS) &&
|
|
158
|
+
cfg.profileFiles.length === 0 &&
|
|
159
|
+
cfg.cipher === 'cryptojs' &&
|
|
160
|
+
JSON.stringify(cfg.keySources) === JSON.stringify(['commit']) &&
|
|
161
|
+
cfg.metaName === 'x-build' &&
|
|
162
|
+
stampDefault);
|
|
163
|
+
}
|
|
164
|
+
/** Projects (outside `copiedRoots`) that build through the polystack release executor. */
|
|
165
|
+
function otherReleaseProjects(tree, copiedRoots) {
|
|
166
|
+
const out = [];
|
|
167
|
+
const visit = (dir, depth) => {
|
|
168
|
+
for (const child of tree.children(dir)) {
|
|
169
|
+
const p = dir ? `${dir}/${child}` : child;
|
|
170
|
+
if (child === 'project.json' && tree.isFile(p)) {
|
|
171
|
+
const root = dir;
|
|
172
|
+
if (copiedRoots.some((r) => root === r || root.startsWith(`${r}/`)))
|
|
173
|
+
continue;
|
|
174
|
+
try {
|
|
175
|
+
const pj = JSON.parse(tree.read(p, 'utf8') ?? '{}');
|
|
176
|
+
const targets = Object.values(pj.targets ?? {});
|
|
177
|
+
if (targets.some((t) => t.executor === angular_project_1.POLYSTACK_BUILD_EXECUTOR))
|
|
178
|
+
out.push(pj.name ?? root);
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
// Unreadable project.json: not ours to judge.
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
else if (depth > 0 &&
|
|
185
|
+
!tree.isFile(p) &&
|
|
186
|
+
!['node_modules', 'dist', 'tmp', 'coverage', 'out-tsc'].includes(child) &&
|
|
187
|
+
!child.startsWith('.')) {
|
|
188
|
+
visit(p, depth - 1);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
visit('', 6);
|
|
193
|
+
return out.sort();
|
|
194
|
+
}
|
|
195
|
+
/** C2: settings that make the release build encrypt like the source's script. */
|
|
196
|
+
function applySourceEnvEncryption(tree, sourceDir, notes, copiedRoots = []) {
|
|
197
|
+
const detected = detectSourceEnvEncryption(sourceDir);
|
|
198
|
+
if (detected && 'unreadable' in detected) {
|
|
199
|
+
notes.push(`Env encryption: the source encrypts its env files with ${code(detected.unreadable)}, but its ` +
|
|
200
|
+
'public keys list could not be read (it is not a plain list of strings); set the release ' +
|
|
201
|
+
"build's settings by hand with `pstack encryption`.");
|
|
202
|
+
return undefined;
|
|
203
|
+
}
|
|
204
|
+
const found = detected;
|
|
205
|
+
if (!found || !tree.exists('nx.json'))
|
|
206
|
+
return found;
|
|
207
|
+
const raw = (0, workspace_1.readEnvEncryptionBlock)(tree);
|
|
208
|
+
const settings = [
|
|
209
|
+
'mode `all`',
|
|
210
|
+
'format `enc`',
|
|
211
|
+
`publicKeys ${found.publicKeys.map(code).join(', ')}`,
|
|
212
|
+
found.profileFiles.length > 0 ? `profileFiles ${code('app.profile.ts')}` : '',
|
|
213
|
+
found.timeField || found.branchField
|
|
214
|
+
? `stamp fields ${[found.timeField, found.branchField]
|
|
215
|
+
.filter(Boolean)
|
|
216
|
+
.map((f) => code(f))
|
|
217
|
+
.join(' / ')}`
|
|
218
|
+
: '',
|
|
219
|
+
].filter(Boolean);
|
|
220
|
+
const others = otherReleaseProjects(tree, copiedRoots);
|
|
221
|
+
if (others.length > 0) {
|
|
222
|
+
notes.push(`Env encryption: the source encrypts its env files with ${code(found.script)} (${settings.join(', ')}). The workspace's settings apply to every app, and ${others
|
|
223
|
+
.map(code)
|
|
224
|
+
.join(', ')} already ` +
|
|
225
|
+
'build with them, so they were kept: the imported apps are encrypted as the workspace ' +
|
|
226
|
+
'says until you change it with `pstack encryption`.');
|
|
227
|
+
return found;
|
|
228
|
+
}
|
|
229
|
+
if (!isDefaultBlock(raw)) {
|
|
230
|
+
notes.push(`Env encryption: the source encrypts its env files with ${code(found.script)} (${settings.join(', ')}); the workspace already has its own ${code('pstack.envEncryption')} settings, so they ` + 'were kept. Compare them with `pstack encryption`.');
|
|
231
|
+
return found;
|
|
232
|
+
}
|
|
233
|
+
const base = (0, config_1.normalizeEnvEncryption)(raw);
|
|
234
|
+
(0, workspace_1.writeEnvEncryptionBlock)(tree, {
|
|
235
|
+
...base,
|
|
236
|
+
mode: 'all',
|
|
237
|
+
format: 'enc',
|
|
238
|
+
publicKeys: found.publicKeys,
|
|
239
|
+
profileFiles: found.profileFiles,
|
|
240
|
+
stamp: found.timeField || found.branchField
|
|
241
|
+
? {
|
|
242
|
+
...config_1.DEFAULT_STAMP,
|
|
243
|
+
...(base.stamp ?? {}),
|
|
244
|
+
timeField: found.timeField ?? config_1.DEFAULT_STAMP.timeField,
|
|
245
|
+
branchField: found.branchField ?? config_1.DEFAULT_STAMP.branchField,
|
|
246
|
+
}
|
|
247
|
+
: base.stamp,
|
|
248
|
+
});
|
|
249
|
+
notes.push(`Env encryption: the source encrypts its env files with ${code(found.script)}; ` +
|
|
250
|
+
`${code('nx.json')} ${code('pstack.envEncryption')} now does the same in release builds ` +
|
|
251
|
+
`(${settings.join(', ')}). Set the build stamp time zone and format with ` +
|
|
252
|
+
'`pstack encryption --timezone=… --stamp-format=…` if the source used others.');
|
|
253
|
+
return { ...found, applied: true };
|
|
254
|
+
}
|
|
255
|
+
exports.applySourceEnvEncryption = applySourceEnvEncryption;
|
|
256
|
+
const WRAPPER_EXPORTS = new Set([
|
|
257
|
+
'envSecret',
|
|
258
|
+
'decryptEnvValue',
|
|
259
|
+
'getBuildMeta',
|
|
260
|
+
'decryptEnvironment',
|
|
261
|
+
'EncryptedEnvKey',
|
|
262
|
+
]);
|
|
263
|
+
/** Names a module exports (declarations and `export { … }` lists); `default` for a default export. */
|
|
264
|
+
function exportedNames(text) {
|
|
265
|
+
const code = (0, env_file_1.stripComments)(text);
|
|
266
|
+
const names = new Set();
|
|
267
|
+
for (const m of code.matchAll(/\bexport\s+(?:declare\s+)?(?:async\s+)?(?:function\*?|const|let|var|class|type|interface|enum|abstract\s+class)\s+([A-Za-z_$][\w$]*)/g)) {
|
|
268
|
+
names.add(m[1]);
|
|
269
|
+
}
|
|
270
|
+
for (const m of code.matchAll(/\bexport\s+(?:type\s+)?\{([^}]*)\}/g)) {
|
|
271
|
+
for (const part of m[1].split(',')) {
|
|
272
|
+
const name = part
|
|
273
|
+
.trim()
|
|
274
|
+
.split(/\s+as\s+/)
|
|
275
|
+
.pop()
|
|
276
|
+
?.trim();
|
|
277
|
+
if (name)
|
|
278
|
+
names.add(name);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (/\bexport\s+default\b/.test(code) || /\bexport\s*\*/.test(code))
|
|
282
|
+
names.add('default');
|
|
283
|
+
// Destructured exports (export const { a, b } = x) are not listed: an unknown shape.
|
|
284
|
+
if (/\bexport\s+(?:const|let|var)\s*[{[]/.test(code))
|
|
285
|
+
names.add('(destructured)');
|
|
286
|
+
return [...names];
|
|
287
|
+
}
|
|
288
|
+
exports.exportedNames = exportedNames;
|
|
289
|
+
/**
|
|
290
|
+
* Whether an env-secret.ts has the known shape: CryptoJS with the ENC() marker, exports
|
|
291
|
+
* envSecret and decryptEnvironment, exports nothing the wrapper would not keep, and imports
|
|
292
|
+
* `environment` from a relative path.
|
|
293
|
+
*/
|
|
294
|
+
function isKnownEnvSecret(text) {
|
|
295
|
+
const names = exportedNames(text);
|
|
296
|
+
if (!names.includes('envSecret') || !names.includes('decryptEnvironment'))
|
|
297
|
+
return undefined;
|
|
298
|
+
if (names.some((n) => !WRAPPER_EXPORTS.has(n)))
|
|
299
|
+
return undefined;
|
|
300
|
+
// A narrower key type (e.g. keyof typeof environment) would be widened by the wrapper.
|
|
301
|
+
const keyType = /\btype\s+EncryptedEnvKey\s*=\s*([^;\n]+)/.exec((0, env_file_1.stripComments)(text));
|
|
302
|
+
if (keyType && keyType[1].trim() !== 'string')
|
|
303
|
+
return undefined;
|
|
304
|
+
if (!/crypto-js/.test(text) || !text.includes('ENC('))
|
|
305
|
+
return undefined;
|
|
306
|
+
const m = /import\s*\{\s*environment\s*\}\s*from\s*(['"])(\.[^'"]+)\1/.exec(text);
|
|
307
|
+
return m ? { envImport: m[2] } : undefined;
|
|
308
|
+
}
|
|
309
|
+
exports.isKnownEnvSecret = isKnownEnvSecret;
|
|
310
|
+
function envSecretWrapper(file, envImport) {
|
|
311
|
+
return `// ${file}
|
|
312
|
+
// Env secrets through the nx-polystack runtime module (rewritten by pstack migrate). The release
|
|
313
|
+
// build encrypts env values (nx.json pstack.envEncryption) and the runtime decrypts ENC(...)
|
|
314
|
+
// values with the build commit from <meta name="x-build">, as the original module did. With
|
|
315
|
+
// cipher aes-gcm, main.ts awaits envReady and decryptEnvironmentAsync decrypts other objects.
|
|
316
|
+
import {
|
|
317
|
+
decryptEnvValue as runtimeDecryptEnvValue,
|
|
318
|
+
decryptTree,
|
|
319
|
+
decryptTreeAsync,
|
|
320
|
+
envReady,
|
|
321
|
+
envReadySync,
|
|
322
|
+
envSecret as runtimeEnvSecret,
|
|
323
|
+
getBuildMeta as runtimeGetBuildMeta,
|
|
324
|
+
type BuildMeta,
|
|
325
|
+
} from '${exports.RUNTIME_MODULE}';
|
|
326
|
+
|
|
327
|
+
import { environment } from '${envImport}';
|
|
328
|
+
|
|
329
|
+
/** Any environment field can be encrypted at build, so this is any key of the env object. */
|
|
330
|
+
export type EncryptedEnvKey = string;
|
|
331
|
+
|
|
332
|
+
let ready = false;
|
|
333
|
+
function ensureReady(): void {
|
|
334
|
+
if (!ready) {
|
|
335
|
+
envReadySync(environment);
|
|
336
|
+
ready = true;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** Build metadata from <meta name="x-build">, or null (dev server / tests). */
|
|
341
|
+
export function getBuildMeta(): BuildMeta | null {
|
|
342
|
+
return runtimeGetBuildMeta();
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/** Decrypts one build-encrypted value; returns it unchanged if it is not ciphertext. */
|
|
346
|
+
export function decryptEnvValue(value: string, commit?: string | null): string {
|
|
347
|
+
return runtimeDecryptEnvValue(value, commit);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/** Plaintext value of an environment field ('' when the env file does not define it). */
|
|
351
|
+
export function envSecret(key: EncryptedEnvKey): string {
|
|
352
|
+
ensureReady();
|
|
353
|
+
return runtimeEnvSecret(key);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/** Decrypts every ENC(...) value of the environment in place; returns the dotted paths decrypted. */
|
|
357
|
+
export function decryptEnvironment(
|
|
358
|
+
env: Record<string, unknown> = environment as Record<string, unknown>,
|
|
359
|
+
): string[] {
|
|
360
|
+
if (env !== (environment as unknown)) return decryptTree(env);
|
|
361
|
+
ready = true;
|
|
362
|
+
return envReadySync(environment, { inPlace: true });
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Decrypts every encrypted value in place (aes-gcm ENC2 too) with the key registered by envReady:
|
|
367
|
+
* the environment without an argument, else that object; returns the dotted paths decrypted.
|
|
368
|
+
*/
|
|
369
|
+
export function decryptEnvironmentAsync(obj?: object): Promise<string[]> {
|
|
370
|
+
return obj ? decryptTreeAsync(obj) : envReady(environment, { inPlace: true });
|
|
371
|
+
}
|
|
372
|
+
`;
|
|
373
|
+
}
|
|
374
|
+
exports.envSecretWrapper = envSecretWrapper;
|
|
375
|
+
/** C1: known-shape env-secret.ts files under `roots` become wrappers of the runtime module. */
|
|
376
|
+
function swapEnvSecretModules(tree, roots, notes, sourceDir) {
|
|
377
|
+
const swapped = [];
|
|
378
|
+
const kept = [];
|
|
379
|
+
const visit = (dir, depth) => {
|
|
380
|
+
if (!tree.exists(dir) || tree.isFile(dir))
|
|
381
|
+
return;
|
|
382
|
+
for (const child of tree.children(dir)) {
|
|
383
|
+
const p = `${dir}/${child}`;
|
|
384
|
+
if (tree.isFile(p)) {
|
|
385
|
+
if (child !== 'env-secret.ts')
|
|
386
|
+
continue;
|
|
387
|
+
const text = tree.read(p, 'utf8') ?? '';
|
|
388
|
+
if (text.includes(exports.RUNTIME_MODULE))
|
|
389
|
+
continue;
|
|
390
|
+
// Only files this import copied (a workspace file kept in a shared folder is left alone).
|
|
391
|
+
if (sourceDir !== undefined && readSource(sourceDir, p) !== text)
|
|
392
|
+
continue;
|
|
393
|
+
const shape = isKnownEnvSecret(text);
|
|
394
|
+
if (shape) {
|
|
395
|
+
tree.write(p, envSecretWrapper(p, shape.envImport));
|
|
396
|
+
swapped.push(p);
|
|
397
|
+
}
|
|
398
|
+
else if (/crypto-js|ENC\(/.test(text)) {
|
|
399
|
+
kept.push(p);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
else if (depth > 0 && child !== 'node_modules' && !child.startsWith('.')) {
|
|
403
|
+
visit(p, depth - 1);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
for (const root of [...new Set(roots)].sort())
|
|
408
|
+
visit(root, 6);
|
|
409
|
+
if (swapped.length > 0) {
|
|
410
|
+
notes.push(`Env secrets: ${swapped.map(code).join(', ')} now wrap ${code(exports.RUNTIME_MODULE)} ` +
|
|
411
|
+
'(same exports: envSecret, decryptEnvValue, getBuildMeta, decryptEnvironment, plus ' +
|
|
412
|
+
'decryptEnvironmentAsync for cipher aes-gcm); modules ' +
|
|
413
|
+
'that import them, such as env-init.ts, are unchanged. envSecret() caches each value ' +
|
|
414
|
+
'after its first read; code that changes `environment` at runtime and reads it again ' +
|
|
415
|
+
'through envSecret() sees the first value.');
|
|
416
|
+
}
|
|
417
|
+
if (kept.length > 0) {
|
|
418
|
+
notes.push(`Env secrets: ${kept.map(code).join(', ')} decrypt env values their own way and were kept; ` +
|
|
419
|
+
`check them against ${code(exports.RUNTIME_MODULE)} and the release build's settings.`);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
exports.swapEnvSecretModules = swapEnvSecretModules;
|
|
423
|
+
//# sourceMappingURL=env-encryption.js.map
|