@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,736 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.envSecretAsync = exports.envSecret = exports.decryptTreeAsync = exports.envReady = exports.isHostAllowed = exports.envReadySync = exports.decryptTree = exports.decryptEnvValue = exports.isEncryptedValue = exports.getBuildMeta = void 0;
|
|
7
|
+
/* eslint-env browser */
|
|
8
|
+
/**
|
|
9
|
+
* @mouryaamit/nx-polystack/runtime/env-secret
|
|
10
|
+
*
|
|
11
|
+
* Browser side of the release build's env encryption (nx.json pstack.envEncryption). The build
|
|
12
|
+
* encrypts env values with CryptoJS AES, the passphrase being the build's commit, which the build
|
|
13
|
+
* also writes into <meta name="x-build"> (base64 JSON). Values are `ENC(<ciphertext>)` (format
|
|
14
|
+
* enc) or the bare ciphertext (format raw).
|
|
15
|
+
*
|
|
16
|
+
* Once, at startup (main.ts, before AppModule is imported or bootstrapped):
|
|
17
|
+
* import { environment } from '../../../environments/web/environment';
|
|
18
|
+
* import { envReadySync } from '@mouryaamit/nx-polystack/runtime/env-secret';
|
|
19
|
+
* (ES module; a CommonJS copy is served to require() users such as Jest.)
|
|
20
|
+
* envReadySync(environment, { sync: ['uname'] }); // or { inPlace: true }
|
|
21
|
+
* Then:
|
|
22
|
+
* envSecret('uname') // sync: decrypted at startup (sync) or on first call, cached
|
|
23
|
+
* await envSecretAsync('password') // decrypted on every call, nothing kept
|
|
24
|
+
*
|
|
25
|
+
* Cipher aes-gcm (pstack.envEncryption.cipher): values are `ENC2(<iv>.<ciphertext>)`, decrypted
|
|
26
|
+
* with Web Crypto under a per-build key split across the meta tag, the bundle (the hidden
|
|
27
|
+
* `__pstack` env field) and optionally an asset. Web Crypto is async, so main.ts must
|
|
28
|
+
* await envReady(environment, { inPlace: true }); // + getKey for key source custom
|
|
29
|
+
* before bootstrap; envReadySync leaves ENC2 values alone and envSecret throws on one. A domain
|
|
30
|
+
* lock in __pstack can refuse (or warn) on hosts the build was not made for.
|
|
31
|
+
*
|
|
32
|
+
* Values that are not encrypted (nx serve, a plain build) are returned as they are. This keeps
|
|
33
|
+
* values out of plain sight in the bundle; the key ships with the page, so it is not a
|
|
34
|
+
* confidentiality guarantee: real secrets belong on a server.
|
|
35
|
+
*/
|
|
36
|
+
const aes_js_1 = __importDefault(require("crypto-js/aes.js"));
|
|
37
|
+
const enc_utf8_js_1 = __importDefault(require("crypto-js/enc-utf8.js"));
|
|
38
|
+
const ENC_OPEN = 'ENC(';
|
|
39
|
+
const ENC_CLOSE = ')';
|
|
40
|
+
/** Base64 of "Salted__": the OpenSSL header CryptoJS writes for passphrase encryption. */
|
|
41
|
+
const RAW_PREFIX = 'U2FsdGVkX1';
|
|
42
|
+
const ENC2_OPEN = 'ENC2(';
|
|
43
|
+
/** Hidden env field written by aes-gcm builds (see src/lib/env-encryption/gcm.ts). */
|
|
44
|
+
const PSTACK_FIELD = '__pstack';
|
|
45
|
+
/** Order of the key factors in the HKDF input; same as KEY_SOURCES on the build side. */
|
|
46
|
+
const SOURCE_ORDER = ['commit', 'salt', 'env', 'custom'];
|
|
47
|
+
const SHARE_BYTES = 32;
|
|
48
|
+
const state = {
|
|
49
|
+
env: undefined,
|
|
50
|
+
metaName: 'x-build',
|
|
51
|
+
cache: new Map(),
|
|
52
|
+
warned: false,
|
|
53
|
+
/** aes-gcm key of the registered environment (CryptoKey), set by envReady. */
|
|
54
|
+
gcmKey: undefined,
|
|
55
|
+
/** The domain lock refused this host. */
|
|
56
|
+
blocked: false,
|
|
57
|
+
/** __pstack and getKey of an envReady that had no ENC2 value: decryptTreeAsync derives later. */
|
|
58
|
+
deferred: undefined,
|
|
59
|
+
/** Top-level fields whose ENC2 value could not be decrypted (envSecret names them). */
|
|
60
|
+
failed: new Set(),
|
|
61
|
+
/** Parsed __pstack per environment object: envReady removes the field, a second call reuses it. */
|
|
62
|
+
pstacks: new WeakMap(),
|
|
63
|
+
};
|
|
64
|
+
function warnOnce(message) {
|
|
65
|
+
if (state.warned || typeof console === 'undefined')
|
|
66
|
+
return;
|
|
67
|
+
state.warned = true;
|
|
68
|
+
console.warn(`[env-secret] ${message}`);
|
|
69
|
+
}
|
|
70
|
+
const isEnc2 = (v) => typeof v === 'string' && v.startsWith(ENC2_OPEN) && v.endsWith(ENC_CLOSE);
|
|
71
|
+
const utf8 = (s) => new TextEncoder().encode(s);
|
|
72
|
+
/** Bytes of base64url text, padded or not (Node writes it unpadded); throws when malformed. */
|
|
73
|
+
function fromB64u(s) {
|
|
74
|
+
if (typeof s !== 'string' || s.length % 4 === 1 || !/^[A-Za-z0-9_-]*={0,2}$/.test(s)) {
|
|
75
|
+
throw new Error('[env-secret] malformed base64url');
|
|
76
|
+
}
|
|
77
|
+
const bare = s.replace(/=+$/, '');
|
|
78
|
+
const bin = atob(bare.replace(/-/g, '+').replace(/_/g, '/') + '==='.slice((bare.length + 3) % 4));
|
|
79
|
+
const out = new Uint8Array(bin.length);
|
|
80
|
+
for (let i = 0; i < bin.length; i++)
|
|
81
|
+
out[i] = bin.charCodeAt(i);
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
/** The whole meta payload (with the aes-gcm key share), or null. */
|
|
85
|
+
function readMeta(metaName) {
|
|
86
|
+
try {
|
|
87
|
+
if (typeof document === 'undefined')
|
|
88
|
+
return null;
|
|
89
|
+
const meta = document.querySelector(`meta[name="${metaName || state.metaName}"]`);
|
|
90
|
+
const content = meta && meta.getAttribute('content');
|
|
91
|
+
const parsed = content ? JSON.parse(atob(content)) : null;
|
|
92
|
+
return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : null;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/** The build info written into <meta name="x-build"> by the release build, or null. */
|
|
99
|
+
function getBuildMeta(metaName) {
|
|
100
|
+
const m = readMeta(metaName);
|
|
101
|
+
if (!m)
|
|
102
|
+
return null;
|
|
103
|
+
// The aes-gcm key share is not build info.
|
|
104
|
+
const rest = { ...m };
|
|
105
|
+
delete rest.k;
|
|
106
|
+
return rest;
|
|
107
|
+
}
|
|
108
|
+
exports.getBuildMeta = getBuildMeta;
|
|
109
|
+
/** True for `ENC(...)` and `ENC2(...)` values and bare CryptoJS passphrase ciphertext. */
|
|
110
|
+
function isEncryptedValue(value) {
|
|
111
|
+
if (typeof value !== 'string')
|
|
112
|
+
return false;
|
|
113
|
+
if (isEnc2(value))
|
|
114
|
+
return true;
|
|
115
|
+
if (value.startsWith(ENC_OPEN) && value.endsWith(ENC_CLOSE))
|
|
116
|
+
return true;
|
|
117
|
+
return value.startsWith(RAW_PREFIX) && /^[A-Za-z0-9+/]+=*$/.test(value) && value.length >= 44;
|
|
118
|
+
}
|
|
119
|
+
exports.isEncryptedValue = isEncryptedValue;
|
|
120
|
+
/**
|
|
121
|
+
* Plaintext of an encrypted value; the value unchanged when it is not encrypted, when no commit
|
|
122
|
+
* is available, or when it cannot be decrypted (one console warning, never the value).
|
|
123
|
+
*/
|
|
124
|
+
function decryptEnvValue(value, commit) {
|
|
125
|
+
var _a;
|
|
126
|
+
if (!isEncryptedValue(value))
|
|
127
|
+
return value;
|
|
128
|
+
// aes-gcm values need the async path (envReady); the sync path leaves them alone.
|
|
129
|
+
if (isEnc2(value))
|
|
130
|
+
return value;
|
|
131
|
+
const key = commit !== undefined ? commit : (_a = readMeta()) === null || _a === void 0 ? void 0 : _a.commit;
|
|
132
|
+
if (!key) {
|
|
133
|
+
warnOnce(`encrypted env value but no <meta name="${state.metaName}"> commit found`);
|
|
134
|
+
return value;
|
|
135
|
+
}
|
|
136
|
+
const cipher = value.startsWith(ENC_OPEN) && value.endsWith(ENC_CLOSE)
|
|
137
|
+
? value.slice(ENC_OPEN.length, -ENC_CLOSE.length)
|
|
138
|
+
: value;
|
|
139
|
+
try {
|
|
140
|
+
const plain = aes_js_1.default.decrypt(cipher, String(key)).toString(enc_utf8_js_1.default);
|
|
141
|
+
if (plain)
|
|
142
|
+
return plain;
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
// Falls through to the warning.
|
|
146
|
+
}
|
|
147
|
+
warnOnce('could not decrypt an env value (commit mismatch?)');
|
|
148
|
+
return value;
|
|
149
|
+
}
|
|
150
|
+
exports.decryptEnvValue = decryptEnvValue;
|
|
151
|
+
const isPlainContainer = (v) => {
|
|
152
|
+
if (v === null || typeof v !== 'object')
|
|
153
|
+
return false;
|
|
154
|
+
if (Array.isArray(v))
|
|
155
|
+
return true;
|
|
156
|
+
const proto = Object.getPrototypeOf(v);
|
|
157
|
+
return proto === Object.prototype || proto === null;
|
|
158
|
+
};
|
|
159
|
+
function decryptInPlace(env, commit, cacheTopLevel) {
|
|
160
|
+
const done = [];
|
|
161
|
+
const readOnly = [];
|
|
162
|
+
const seen = new WeakSet();
|
|
163
|
+
const walk = (node, prefix) => {
|
|
164
|
+
if (seen.has(node))
|
|
165
|
+
return;
|
|
166
|
+
seen.add(node);
|
|
167
|
+
for (const key of Object.keys(node)) {
|
|
168
|
+
if (!prefix && key === PSTACK_FIELD)
|
|
169
|
+
continue;
|
|
170
|
+
const raw = node[key];
|
|
171
|
+
const at = prefix ? `${prefix}.${key}` : key;
|
|
172
|
+
if (isEncryptedValue(raw)) {
|
|
173
|
+
const plain = decryptEnvValue(raw, commit);
|
|
174
|
+
if (plain !== raw) {
|
|
175
|
+
if (cacheTopLevel && !prefix)
|
|
176
|
+
state.cache.set(key, { raw, plain });
|
|
177
|
+
try {
|
|
178
|
+
node[key] = plain;
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
// ES modules run in strict mode: a frozen or read-only object throws here.
|
|
182
|
+
}
|
|
183
|
+
if (node[key] === plain)
|
|
184
|
+
done.push(at);
|
|
185
|
+
else
|
|
186
|
+
readOnly.push(at);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
else if (isPlainContainer(raw)) {
|
|
190
|
+
walk(raw, at);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
walk(env, '');
|
|
195
|
+
if (readOnly.length > 0 && typeof console !== 'undefined') {
|
|
196
|
+
console.warn(`[env-secret] read-only fields left encrypted in place: ${readOnly.join(', ')}` +
|
|
197
|
+
(cacheTopLevel ? ' (envSecret() still returns top-level ones)' : ''));
|
|
198
|
+
}
|
|
199
|
+
return done;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Decrypts every encrypted value of an object tree in place (any object, not registered with
|
|
203
|
+
* envReady); returns the dotted paths decrypted.
|
|
204
|
+
*/
|
|
205
|
+
function decryptTree(obj, commit) {
|
|
206
|
+
var _a;
|
|
207
|
+
if (!obj || typeof obj !== 'object')
|
|
208
|
+
return [];
|
|
209
|
+
return decryptInPlace(obj, commit !== undefined ? commit : (_a = readMeta()) === null || _a === void 0 ? void 0 : _a.commit, false);
|
|
210
|
+
}
|
|
211
|
+
exports.decryptTree = decryptTree;
|
|
212
|
+
/**
|
|
213
|
+
* Validates and registers the environment. Another object starts over (cache, aes-gcm key,
|
|
214
|
+
* blocked state, meta name unless given); the same object keeps them, so a later envReadySync
|
|
215
|
+
* does not drop the key or the meta name.
|
|
216
|
+
*/
|
|
217
|
+
function register(environment, opts, name) {
|
|
218
|
+
if (!environment || typeof environment !== 'object') {
|
|
219
|
+
throw new Error(`[env-secret] ${name}(environment): pass the app environment object`);
|
|
220
|
+
}
|
|
221
|
+
if (state.env !== environment) {
|
|
222
|
+
state.cache = new Map();
|
|
223
|
+
state.gcmKey = undefined;
|
|
224
|
+
state.blocked = false;
|
|
225
|
+
state.failed = new Set();
|
|
226
|
+
state.deferred = undefined;
|
|
227
|
+
}
|
|
228
|
+
// The same object registered again without metaName (e.g. a wrapper's envReadySync after
|
|
229
|
+
// main.ts awaited envReady with a custom name) keeps the current meta name.
|
|
230
|
+
if (opts.metaName)
|
|
231
|
+
state.metaName = opts.metaName;
|
|
232
|
+
else if (state.env !== environment)
|
|
233
|
+
state.metaName = 'x-build';
|
|
234
|
+
state.env = environment;
|
|
235
|
+
state.warned = false;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Registers the app's environment object and prepares it. Options:
|
|
239
|
+
* - inPlace: decrypt every encrypted value of the environment (nested objects and arrays too)
|
|
240
|
+
* in place, so code reading environment.x gets plaintext;
|
|
241
|
+
* - sync: top-level fields (or 'all') decrypted now into a private cache for envSecret();
|
|
242
|
+
* - metaName: the meta tag with the build info (default x-build).
|
|
243
|
+
* Returns the dotted paths decrypted. aes-gcm values (`ENC2(...)`) are left alone: use envReady.
|
|
244
|
+
*/
|
|
245
|
+
function envReadySync(environment, options) {
|
|
246
|
+
const opts = options || {};
|
|
247
|
+
register(environment, opts, 'envReadySync');
|
|
248
|
+
return readySync(environment, opts);
|
|
249
|
+
}
|
|
250
|
+
exports.envReadySync = envReadySync;
|
|
251
|
+
function readySync(environment, opts) {
|
|
252
|
+
var _a;
|
|
253
|
+
const commit = (_a = readMeta()) === null || _a === void 0 ? void 0 : _a.commit;
|
|
254
|
+
if (opts.inPlace)
|
|
255
|
+
return decryptInPlace(environment, commit, true);
|
|
256
|
+
const keys = opts.sync === 'all' ? Object.keys(environment) : Array.isArray(opts.sync) ? opts.sync : [];
|
|
257
|
+
const done = [];
|
|
258
|
+
for (const key of keys) {
|
|
259
|
+
const raw = environment[key];
|
|
260
|
+
if (typeof raw !== 'string')
|
|
261
|
+
continue;
|
|
262
|
+
const plain = decryptEnvValue(raw, commit);
|
|
263
|
+
state.cache.set(key, { raw, plain });
|
|
264
|
+
if (plain !== raw)
|
|
265
|
+
done.push(key);
|
|
266
|
+
}
|
|
267
|
+
return done;
|
|
268
|
+
}
|
|
269
|
+
/** True when `host` is listed (`*.x` = any subdomain of x; `x` also allows www.x when www). */
|
|
270
|
+
function isHostAllowed(host, hosts, www) {
|
|
271
|
+
const norm = (v) => String(v || '')
|
|
272
|
+
.trim()
|
|
273
|
+
.toLowerCase()
|
|
274
|
+
.replace(/\.$/, '');
|
|
275
|
+
const h = norm(host);
|
|
276
|
+
if (!h)
|
|
277
|
+
return false;
|
|
278
|
+
return (hosts || []).some((listed) => {
|
|
279
|
+
const entry = norm(listed);
|
|
280
|
+
if (!entry)
|
|
281
|
+
return false;
|
|
282
|
+
if (entry.startsWith('*.')) {
|
|
283
|
+
const suffix = entry.slice(1);
|
|
284
|
+
return h.endsWith(suffix) && h.length > suffix.length;
|
|
285
|
+
}
|
|
286
|
+
return h === entry || (!!www && h === `www.${entry}`);
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
exports.isHostAllowed = isHostAllowed;
|
|
290
|
+
/** Whether this page may decrypt; never names the allowed hosts. */
|
|
291
|
+
function domainAllowed(lock) {
|
|
292
|
+
if (!lock || typeof location === 'undefined')
|
|
293
|
+
return true;
|
|
294
|
+
const proto = String(location.protocol || '').toLowerCase();
|
|
295
|
+
const host = String(location.hostname || '')
|
|
296
|
+
.toLowerCase()
|
|
297
|
+
.replace(/\.$/, '');
|
|
298
|
+
if (['capacitor:', 'ionic:'].includes(proto))
|
|
299
|
+
return true;
|
|
300
|
+
if (['localhost', '127.0.0.1', '[::1]', '::1'].includes(host))
|
|
301
|
+
return true;
|
|
302
|
+
if (isHostAllowed(host, lock.h, lock.w))
|
|
303
|
+
return true;
|
|
304
|
+
if (lock.m === 'warn') {
|
|
305
|
+
if (typeof console !== 'undefined') {
|
|
306
|
+
console.warn('[env-secret] this build is not meant for this host');
|
|
307
|
+
}
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
if (typeof console !== 'undefined') {
|
|
311
|
+
console.error('[env-secret] this build is not allowed on this host; env values were not decrypted');
|
|
312
|
+
}
|
|
313
|
+
return false;
|
|
314
|
+
}
|
|
315
|
+
const isStr = (v) => typeof v === 'string';
|
|
316
|
+
const isObj = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
317
|
+
/** Parses and checks a __pstack value; the error never quotes it. */
|
|
318
|
+
function parsePstack(raw) {
|
|
319
|
+
const invalid = (why) => new Error(`[env-secret] invalid ${PSTACK_FIELD} field (${why})`);
|
|
320
|
+
let p;
|
|
321
|
+
try {
|
|
322
|
+
p = JSON.parse(new TextDecoder().decode(fromB64u(raw)));
|
|
323
|
+
}
|
|
324
|
+
catch {
|
|
325
|
+
throw invalid('not base64url JSON');
|
|
326
|
+
}
|
|
327
|
+
if (!isObj(p))
|
|
328
|
+
throw invalid('not an object');
|
|
329
|
+
if (p.v !== 2)
|
|
330
|
+
throw invalid('unknown version');
|
|
331
|
+
if (!isStr(p.p) || !isStr(p.e) || p.p.includes('|') || p.e.includes('|')) {
|
|
332
|
+
throw invalid('env project or env');
|
|
333
|
+
}
|
|
334
|
+
if (!isStr(p.b))
|
|
335
|
+
throw invalid('bundle share');
|
|
336
|
+
if (!Array.isArray(p.s) || p.s.length === 0 || !p.s.every((s) => SOURCE_ORDER.includes(s))) {
|
|
337
|
+
throw invalid('key sources');
|
|
338
|
+
}
|
|
339
|
+
if (p.f !== undefined && (!isObj(p.f) || !Object.values(p.f).every(isStr))) {
|
|
340
|
+
throw invalid('key factors');
|
|
341
|
+
}
|
|
342
|
+
if (p.a !== undefined && (!isStr(p.a) || !/^[A-Za-z0-9._-]+$/.test(p.a))) {
|
|
343
|
+
throw invalid('key asset');
|
|
344
|
+
}
|
|
345
|
+
if (p.d !== undefined &&
|
|
346
|
+
(!isObj(p.d) ||
|
|
347
|
+
!Array.isArray(p.d.h) ||
|
|
348
|
+
!p.d.h.every(isStr) ||
|
|
349
|
+
!['block', 'warn'].includes(p.d.m))) {
|
|
350
|
+
throw invalid('domain lock');
|
|
351
|
+
}
|
|
352
|
+
if (p.ri !== undefined && p.ri !== 1)
|
|
353
|
+
throw invalid('integrity flag');
|
|
354
|
+
return p;
|
|
355
|
+
}
|
|
356
|
+
/** The parsed __pstack of the environment, removed from it (it is reused on a second call). */
|
|
357
|
+
function takePstack(environment) {
|
|
358
|
+
const raw = environment[PSTACK_FIELD];
|
|
359
|
+
if (typeof raw !== 'string')
|
|
360
|
+
return state.pstacks.get(environment);
|
|
361
|
+
const p = parsePstack(raw);
|
|
362
|
+
state.pstacks.set(environment, p);
|
|
363
|
+
try {
|
|
364
|
+
delete environment[PSTACK_FIELD];
|
|
365
|
+
}
|
|
366
|
+
catch {
|
|
367
|
+
// Read-only object: the field stays; it holds no plaintext.
|
|
368
|
+
}
|
|
369
|
+
return p;
|
|
370
|
+
}
|
|
371
|
+
const keyError = (why) => new Error(`[env-secret] aes-gcm key: ${why}`);
|
|
372
|
+
/** One key share; every share is SHARE_BYTES long. */
|
|
373
|
+
function share(bytes, where) {
|
|
374
|
+
if (bytes.length !== SHARE_BYTES)
|
|
375
|
+
throw keyError(`the ${where} share has the wrong length`);
|
|
376
|
+
return bytes;
|
|
377
|
+
}
|
|
378
|
+
/** The page's origin (location, else the document base URL); '' when neither is known. */
|
|
379
|
+
function pageOrigin() {
|
|
380
|
+
try {
|
|
381
|
+
if (typeof location !== 'undefined' && location && isStr(location.origin)) {
|
|
382
|
+
return location.origin;
|
|
383
|
+
}
|
|
384
|
+
return new URL(document.baseURI).origin;
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
return '';
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* SRI builds: every same-origin <script src> on the page (the files this build served) must carry
|
|
392
|
+
* an integrity attribute, else a script was injected or its hash removed. Scripts from other
|
|
393
|
+
* http(s) origins (tag managers, chat widgets) are left to the CSP allowlist; anything else
|
|
394
|
+
* (blob:, data:, an unreadable src) is checked. A presence check (the browser verifies the
|
|
395
|
+
* values); inline scripts are not covered. No document (SSR, worker): passes; a document that
|
|
396
|
+
* cannot be queried fails.
|
|
397
|
+
*/
|
|
398
|
+
function scriptsHaveIntegrity() {
|
|
399
|
+
if (typeof document === 'undefined' || !document)
|
|
400
|
+
return true;
|
|
401
|
+
if (typeof document.querySelectorAll !== 'function')
|
|
402
|
+
return false;
|
|
403
|
+
const origin = pageOrigin();
|
|
404
|
+
for (const s of document.querySelectorAll('script[src]')) {
|
|
405
|
+
let url;
|
|
406
|
+
try {
|
|
407
|
+
url = new URL(s.getAttribute('src') || '', document.baseURI);
|
|
408
|
+
}
|
|
409
|
+
catch {
|
|
410
|
+
url = undefined;
|
|
411
|
+
}
|
|
412
|
+
const external = url && (url.protocol === 'https:' || url.protocol === 'http:') && url.origin !== origin;
|
|
413
|
+
if (external)
|
|
414
|
+
continue;
|
|
415
|
+
const value = s.getAttribute('integrity');
|
|
416
|
+
if (!value || !value.trim())
|
|
417
|
+
return false;
|
|
418
|
+
}
|
|
419
|
+
return true;
|
|
420
|
+
}
|
|
421
|
+
async function deriveGcmKey(p, getKey) {
|
|
422
|
+
// Checked before any key material is touched: no key, nothing decrypted.
|
|
423
|
+
if (p.ri === 1 && !scriptsHaveIntegrity()) {
|
|
424
|
+
throw new Error('[env-secret] integrity required: a script has no integrity attribute');
|
|
425
|
+
}
|
|
426
|
+
if (typeof crypto === 'undefined' || !crypto || !crypto.subtle) {
|
|
427
|
+
throw new Error('[env-secret] aes-gcm needs Web Crypto (https or localhost)');
|
|
428
|
+
}
|
|
429
|
+
const meta = readMeta();
|
|
430
|
+
if (!meta || !isStr(meta.k) || !isStr(meta.timestamp_utc)) {
|
|
431
|
+
throw keyError(`no key share in <meta name="${state.metaName}">`);
|
|
432
|
+
}
|
|
433
|
+
const decode = (s, where) => {
|
|
434
|
+
try {
|
|
435
|
+
return share(fromB64u(s), where);
|
|
436
|
+
}
|
|
437
|
+
catch {
|
|
438
|
+
throw keyError(`the ${where} share is malformed`);
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
const shares = [decode(meta.k, 'meta'), decode(p.b, 'bundle')];
|
|
442
|
+
if (p.a) {
|
|
443
|
+
let bytes;
|
|
444
|
+
try {
|
|
445
|
+
const res = await fetch(new URL(`assets/${p.a}`, document.baseURI).toString(), {
|
|
446
|
+
cache: 'no-store',
|
|
447
|
+
});
|
|
448
|
+
if (!res.ok)
|
|
449
|
+
throw new Error('status');
|
|
450
|
+
bytes = new Uint8Array(await res.arrayBuffer());
|
|
451
|
+
}
|
|
452
|
+
catch {
|
|
453
|
+
throw keyError('the key asset could not be loaded');
|
|
454
|
+
}
|
|
455
|
+
if (bytes.length !== SHARE_BYTES) {
|
|
456
|
+
// Usually index.html served for a missing file by a single-page-app fallback.
|
|
457
|
+
throw keyError('the key asset could not be loaded (got a different file — check the server serves ' +
|
|
458
|
+
'assets/ before any SPA fallback)');
|
|
459
|
+
}
|
|
460
|
+
shares.push(bytes);
|
|
461
|
+
}
|
|
462
|
+
const r = new Uint8Array(SHARE_BYTES);
|
|
463
|
+
for (const s of shares)
|
|
464
|
+
for (let i = 0; i < r.length; i++)
|
|
465
|
+
r[i] ^= s[i];
|
|
466
|
+
const values = { ...(p.f || {}) };
|
|
467
|
+
delete values.custom;
|
|
468
|
+
if (p.s.includes('custom')) {
|
|
469
|
+
if (typeof getKey !== 'function') {
|
|
470
|
+
throw new Error('[env-secret] key source custom: pass envReady(environment, { getKey })');
|
|
471
|
+
}
|
|
472
|
+
values.custom = String(await getKey());
|
|
473
|
+
}
|
|
474
|
+
const t = utf8(SOURCE_ORDER.filter((s) => p.s.includes(s))
|
|
475
|
+
.map((s) => { var _a; return `${s}=${(_a = values[s]) !== null && _a !== void 0 ? _a : ''}`; })
|
|
476
|
+
.join('\n'));
|
|
477
|
+
const ikm = new Uint8Array(r.length + t.length);
|
|
478
|
+
ikm.set(r);
|
|
479
|
+
ikm.set(t, r.length);
|
|
480
|
+
const base = await crypto.subtle.importKey('raw', ikm, 'HKDF', false, ['deriveKey']);
|
|
481
|
+
return crypto.subtle.deriveKey({
|
|
482
|
+
name: 'HKDF',
|
|
483
|
+
hash: 'SHA-256',
|
|
484
|
+
salt: utf8(meta.timestamp_utc),
|
|
485
|
+
info: utf8(`pstack-env-v2|${p.p}|${p.e}`),
|
|
486
|
+
}, base, { name: 'AES-GCM', length: 256 }, false, ['decrypt']);
|
|
487
|
+
}
|
|
488
|
+
/** Plaintext of an ENC2 value; throws (without the value) when malformed or not authentic. */
|
|
489
|
+
async function gcmDecrypt(key, value, holder) {
|
|
490
|
+
const parts = value.slice(ENC2_OPEN.length, -ENC_CLOSE.length).split('.');
|
|
491
|
+
if (parts.length !== 2)
|
|
492
|
+
throw new Error('malformed');
|
|
493
|
+
const iv = fromB64u(parts[0]);
|
|
494
|
+
const data = fromB64u(parts[1]);
|
|
495
|
+
if (iv.length !== 12 || data.length < 16)
|
|
496
|
+
throw new Error('malformed');
|
|
497
|
+
const plain = await crypto.subtle.decrypt({ name: 'AES-GCM', iv, additionalData: utf8(holder) }, key, data);
|
|
498
|
+
return new TextDecoder().decode(plain);
|
|
499
|
+
}
|
|
500
|
+
/** Whether a tree holds an ENC2 value (the environment's own __pstack field skipped). */
|
|
501
|
+
function hasEnc2(root) {
|
|
502
|
+
const seen = new WeakSet();
|
|
503
|
+
const scan = (node, top) => {
|
|
504
|
+
if (seen.has(node))
|
|
505
|
+
return false;
|
|
506
|
+
seen.add(node);
|
|
507
|
+
return Object.keys(node).some((k) => {
|
|
508
|
+
if (top && k === PSTACK_FIELD)
|
|
509
|
+
return false;
|
|
510
|
+
const v = node[k];
|
|
511
|
+
return isEnc2(v) || (isPlainContainer(v) && scan(v, false));
|
|
512
|
+
});
|
|
513
|
+
};
|
|
514
|
+
return scan(root, true);
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Decrypts the encrypted values of a tree in place (ENC2 with `key`, cryptojs with `commit`).
|
|
518
|
+
* AAD: the name of the property holding the value (for array items, the array's). `onTop` is
|
|
519
|
+
* called for each top-level field of the registered environment (null for other trees).
|
|
520
|
+
*/
|
|
521
|
+
async function gcmWalk(root, key, commit, onTop) {
|
|
522
|
+
const out = { done: [], readOnly: [], failed: [] };
|
|
523
|
+
const seen = new WeakSet();
|
|
524
|
+
const walk = async (node, prefix, holder) => {
|
|
525
|
+
if (seen.has(node))
|
|
526
|
+
return;
|
|
527
|
+
seen.add(node);
|
|
528
|
+
const isArr = Array.isArray(node);
|
|
529
|
+
for (const k of Object.keys(node)) {
|
|
530
|
+
if (!prefix && onTop && k === PSTACK_FIELD)
|
|
531
|
+
continue;
|
|
532
|
+
const raw = node[k];
|
|
533
|
+
const at = prefix ? `${prefix}.${k}` : k;
|
|
534
|
+
const name = isArr ? holder : k;
|
|
535
|
+
if (isEncryptedValue(raw)) {
|
|
536
|
+
let plain = raw;
|
|
537
|
+
if (!isEnc2(raw))
|
|
538
|
+
plain = decryptEnvValue(raw, commit);
|
|
539
|
+
else {
|
|
540
|
+
try {
|
|
541
|
+
plain = await gcmDecrypt(key, raw, name);
|
|
542
|
+
}
|
|
543
|
+
catch {
|
|
544
|
+
out.failed.push(at);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
if (!prefix && onTop)
|
|
548
|
+
onTop(k, raw, plain);
|
|
549
|
+
if (plain === raw)
|
|
550
|
+
continue;
|
|
551
|
+
try {
|
|
552
|
+
node[k] = plain;
|
|
553
|
+
}
|
|
554
|
+
catch {
|
|
555
|
+
// ES modules run in strict mode: a frozen or read-only object throws here.
|
|
556
|
+
}
|
|
557
|
+
if (node[k] === plain)
|
|
558
|
+
out.done.push(at);
|
|
559
|
+
else
|
|
560
|
+
out.readOnly.push(at);
|
|
561
|
+
}
|
|
562
|
+
else if (isPlainContainer(raw)) {
|
|
563
|
+
await walk(raw, at, name);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
await walk(root, '', '');
|
|
568
|
+
return out;
|
|
569
|
+
}
|
|
570
|
+
/** Console report of a walk: paths only, never values. */
|
|
571
|
+
function report(readOnly, failed, topLevelNote) {
|
|
572
|
+
if (typeof console === 'undefined')
|
|
573
|
+
return;
|
|
574
|
+
if (readOnly.length > 0) {
|
|
575
|
+
console.warn(`[env-secret] read-only fields left encrypted in place: ${readOnly.join(', ')}` +
|
|
576
|
+
(topLevelNote ? ' (envSecret() still returns top-level ones)' : ''));
|
|
577
|
+
}
|
|
578
|
+
if (failed.length > 0) {
|
|
579
|
+
console.error(`[env-secret] could not decrypt (aes-gcm: malformed or not authentic): ${failed.join(', ')}`);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
const notAllowed = () => new Error('[env-secret] this build is not allowed on this host');
|
|
583
|
+
const noKey = () => new Error('[env-secret] await envReady(environment) first');
|
|
584
|
+
/**
|
|
585
|
+
* Registers the environment and decrypts it like envReadySync; aes-gcm builds (ENC2 values) need
|
|
586
|
+
* this async call (Web Crypto) before bootstrap. Options as envReadySync, plus getKey (key
|
|
587
|
+
* source custom). Values that fail authentication stay encrypted and are reported by path.
|
|
588
|
+
*/
|
|
589
|
+
async function envReady(environment, options) {
|
|
590
|
+
var _a;
|
|
591
|
+
const opts = options || {};
|
|
592
|
+
register(environment, opts, 'envReady');
|
|
593
|
+
const p = takePstack(environment);
|
|
594
|
+
if (!p) {
|
|
595
|
+
if (hasEnc2(environment) && typeof console !== 'undefined') {
|
|
596
|
+
console.error(`[env-secret] aes-gcm values but no ${PSTACK_FIELD} field (was the env file built by ` +
|
|
597
|
+
'the release target?)');
|
|
598
|
+
}
|
|
599
|
+
return readySync(environment, opts);
|
|
600
|
+
}
|
|
601
|
+
state.blocked = !domainAllowed(p.d);
|
|
602
|
+
if (state.blocked)
|
|
603
|
+
return [];
|
|
604
|
+
if (!hasEnc2(environment)) {
|
|
605
|
+
// No ENC2 value here: decryptTreeAsync derives the key if another tree needs it.
|
|
606
|
+
if (!state.gcmKey)
|
|
607
|
+
state.deferred = { env: environment, p, getKey: opts.getKey };
|
|
608
|
+
return readySync(environment, opts);
|
|
609
|
+
}
|
|
610
|
+
state.deferred = undefined;
|
|
611
|
+
const key = await deriveGcmKey(p, opts.getKey);
|
|
612
|
+
// A concurrent call may have registered another object meanwhile: it keeps its own state.
|
|
613
|
+
const owns = state.env === environment;
|
|
614
|
+
if (owns) {
|
|
615
|
+
state.gcmKey = key;
|
|
616
|
+
state.failed = new Set();
|
|
617
|
+
}
|
|
618
|
+
const commit = (_a = readMeta()) === null || _a === void 0 ? void 0 : _a.commit;
|
|
619
|
+
const remember = (k, raw, plain) => {
|
|
620
|
+
if (!owns)
|
|
621
|
+
return;
|
|
622
|
+
if (isEnc2(raw) && plain === raw) {
|
|
623
|
+
state.failed.add(k);
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
state.failed.delete(k);
|
|
627
|
+
state.cache.set(k, { raw, plain });
|
|
628
|
+
};
|
|
629
|
+
if (opts.inPlace) {
|
|
630
|
+
const r = await gcmWalk(environment, key, commit, remember);
|
|
631
|
+
report(r.readOnly, r.failed, true);
|
|
632
|
+
return r.done;
|
|
633
|
+
}
|
|
634
|
+
const keys = opts.sync === 'all'
|
|
635
|
+
? Object.keys(environment).filter((k) => k !== PSTACK_FIELD)
|
|
636
|
+
: Array.isArray(opts.sync)
|
|
637
|
+
? opts.sync
|
|
638
|
+
: [];
|
|
639
|
+
const done = [];
|
|
640
|
+
const failed = [];
|
|
641
|
+
for (const k of keys) {
|
|
642
|
+
const raw = environment[k];
|
|
643
|
+
if (typeof raw !== 'string')
|
|
644
|
+
continue;
|
|
645
|
+
let plain = raw;
|
|
646
|
+
if (!isEnc2(raw))
|
|
647
|
+
plain = decryptEnvValue(raw, commit);
|
|
648
|
+
else {
|
|
649
|
+
try {
|
|
650
|
+
plain = await gcmDecrypt(key, raw, k);
|
|
651
|
+
}
|
|
652
|
+
catch {
|
|
653
|
+
failed.push(k);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
remember(k, raw, plain);
|
|
657
|
+
if (plain !== raw)
|
|
658
|
+
done.push(k);
|
|
659
|
+
}
|
|
660
|
+
report([], failed, false);
|
|
661
|
+
return done;
|
|
662
|
+
}
|
|
663
|
+
exports.envReady = envReady;
|
|
664
|
+
/**
|
|
665
|
+
* Decrypts every encrypted value (ENC2 and cryptojs) of any object tree in place with the key
|
|
666
|
+
* registered by envReady; returns the dotted paths decrypted. Failures are reported by path.
|
|
667
|
+
*/
|
|
668
|
+
async function decryptTreeAsync(obj) {
|
|
669
|
+
var _a;
|
|
670
|
+
if (state.blocked)
|
|
671
|
+
throw notAllowed();
|
|
672
|
+
let key = state.gcmKey;
|
|
673
|
+
if (!key) {
|
|
674
|
+
const d = state.deferred;
|
|
675
|
+
if (!d || d.env !== state.env)
|
|
676
|
+
throw noKey();
|
|
677
|
+
key = await deriveGcmKey(d.p, d.getKey);
|
|
678
|
+
// Same guard as envReady: keep the key only while that environment is still registered.
|
|
679
|
+
if (state.env === d.env && state.deferred === d) {
|
|
680
|
+
state.gcmKey = key;
|
|
681
|
+
state.deferred = undefined;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
if (!obj || typeof obj !== 'object')
|
|
685
|
+
return [];
|
|
686
|
+
const r = await gcmWalk(obj, key, (_a = readMeta()) === null || _a === void 0 ? void 0 : _a.commit, null);
|
|
687
|
+
report(r.readOnly, r.failed, false);
|
|
688
|
+
return r.done;
|
|
689
|
+
}
|
|
690
|
+
exports.decryptTreeAsync = decryptTreeAsync;
|
|
691
|
+
function rawValue(key) {
|
|
692
|
+
if (!state.env) {
|
|
693
|
+
throw new Error('[env-secret] call envReady(environment) or envReadySync(environment) first');
|
|
694
|
+
}
|
|
695
|
+
const raw = state.env[key];
|
|
696
|
+
return typeof raw === 'string' ? raw : undefined;
|
|
697
|
+
}
|
|
698
|
+
/** Plaintext of a top-level env field ('' when it is not a string); cached after the first call. */
|
|
699
|
+
function envSecret(key) {
|
|
700
|
+
const raw = rawValue(key);
|
|
701
|
+
const hit = state.cache.get(key);
|
|
702
|
+
// A cached value stays valid while the field holds the value it was read from (or its
|
|
703
|
+
// plaintext, after an in-place decrypt).
|
|
704
|
+
if (hit && (hit.raw === raw || hit.plain === raw))
|
|
705
|
+
return hit.plain;
|
|
706
|
+
if (isEnc2(raw)) {
|
|
707
|
+
if (state.blocked)
|
|
708
|
+
throw notAllowed();
|
|
709
|
+
if (state.failed.has(key))
|
|
710
|
+
throw new Error(`[env-secret] could not decrypt ${key}`);
|
|
711
|
+
throw new Error(`[env-secret] ${key} uses aes-gcm; await envReady(environment) before bootstrap`);
|
|
712
|
+
}
|
|
713
|
+
const plain = raw === undefined ? '' : decryptEnvValue(raw);
|
|
714
|
+
state.cache.set(key, { raw, plain });
|
|
715
|
+
return plain;
|
|
716
|
+
}
|
|
717
|
+
exports.envSecret = envSecret;
|
|
718
|
+
/** Plaintext of a top-level env field, decrypted on every call; nothing is kept. */
|
|
719
|
+
async function envSecretAsync(key) {
|
|
720
|
+
const raw = rawValue(key);
|
|
721
|
+
if (raw === undefined)
|
|
722
|
+
return '';
|
|
723
|
+
if (!isEnc2(raw))
|
|
724
|
+
return decryptEnvValue(raw);
|
|
725
|
+
if (state.blocked)
|
|
726
|
+
throw notAllowed();
|
|
727
|
+
if (!state.gcmKey)
|
|
728
|
+
throw noKey();
|
|
729
|
+
try {
|
|
730
|
+
return await gcmDecrypt(state.gcmKey, raw, key);
|
|
731
|
+
}
|
|
732
|
+
catch {
|
|
733
|
+
throw new Error(`[env-secret] could not decrypt ${key} (aes-gcm: malformed or not authentic)`);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
exports.envSecretAsync = envSecretAsync;
|