@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.
Files changed (680) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +77 -2
  3. package/USER-MANUAL.md +1968 -0
  4. package/dist/bin/cli.d.ts +1 -0
  5. package/dist/bin/cli.js +92 -0
  6. package/dist/bin/cli.js.map +1 -0
  7. package/dist/executors.json +32 -0
  8. package/dist/generators.json +47 -0
  9. package/dist/migrations.json +87 -0
  10. package/dist/runtime/env-secret.cjs +736 -0
  11. package/dist/src/cli/args.d.ts +18 -0
  12. package/dist/src/cli/args.js +67 -0
  13. package/dist/src/cli/args.js.map +1 -0
  14. package/dist/src/cli/commands/app.d.ts +3 -0
  15. package/dist/src/cli/commands/app.js +108 -0
  16. package/dist/src/cli/commands/app.js.map +1 -0
  17. package/dist/src/cli/commands/build.d.ts +8 -0
  18. package/dist/src/cli/commands/build.js +132 -0
  19. package/dist/src/cli/commands/build.js.map +1 -0
  20. package/dist/src/cli/commands/csp.d.ts +19 -0
  21. package/dist/src/cli/commands/csp.js +238 -0
  22. package/dist/src/cli/commands/csp.js.map +1 -0
  23. package/dist/src/cli/commands/encryption.d.ts +4 -0
  24. package/dist/src/cli/commands/encryption.js +261 -0
  25. package/dist/src/cli/commands/encryption.js.map +1 -0
  26. package/dist/src/cli/commands/env.d.ts +2 -0
  27. package/dist/src/cli/commands/env.js +74 -0
  28. package/dist/src/cli/commands/env.js.map +1 -0
  29. package/dist/src/cli/commands/hardening.d.ts +2 -0
  30. package/dist/src/cli/commands/hardening.js +176 -0
  31. package/dist/src/cli/commands/hardening.js.map +1 -0
  32. package/dist/src/cli/commands/index.d.ts +3 -0
  33. package/dist/src/cli/commands/index.js +45 -0
  34. package/dist/src/cli/commands/index.js.map +1 -0
  35. package/dist/src/cli/commands/infra.d.ts +25 -0
  36. package/dist/src/cli/commands/infra.js +85 -0
  37. package/dist/src/cli/commands/infra.js.map +1 -0
  38. package/dist/src/cli/commands/internal-migrate.d.ts +3 -0
  39. package/dist/src/cli/commands/internal-migrate.js +65 -0
  40. package/dist/src/cli/commands/internal-migrate.js.map +1 -0
  41. package/dist/src/cli/commands/lib.d.ts +2 -0
  42. package/dist/src/cli/commands/lib.js +70 -0
  43. package/dist/src/cli/commands/lib.js.map +1 -0
  44. package/dist/src/cli/commands/llm.d.ts +2 -0
  45. package/dist/src/cli/commands/llm.js +46 -0
  46. package/dist/src/cli/commands/llm.js.map +1 -0
  47. package/dist/src/cli/commands/migrate.d.ts +2 -0
  48. package/dist/src/cli/commands/migrate.js +230 -0
  49. package/dist/src/cli/commands/migrate.js.map +1 -0
  50. package/dist/src/cli/commands/new.d.ts +6 -0
  51. package/dist/src/cli/commands/new.js +97 -0
  52. package/dist/src/cli/commands/new.js.map +1 -0
  53. package/dist/src/cli/commands/preset.d.ts +2 -0
  54. package/dist/src/cli/commands/preset.js +47 -0
  55. package/dist/src/cli/commands/preset.js.map +1 -0
  56. package/dist/src/cli/commands/release.d.ts +3 -0
  57. package/dist/src/cli/commands/release.js +83 -0
  58. package/dist/src/cli/commands/release.js.map +1 -0
  59. package/dist/src/cli/commands/shared.d.ts +3 -0
  60. package/dist/src/cli/commands/shared.js +55 -0
  61. package/dist/src/cli/commands/shared.js.map +1 -0
  62. package/dist/src/cli/commands/update.d.ts +11 -0
  63. package/dist/src/cli/commands/update.js +120 -0
  64. package/dist/src/cli/commands/update.js.map +1 -0
  65. package/dist/src/cli/context.d.ts +18 -0
  66. package/dist/src/cli/context.js +66 -0
  67. package/dist/src/cli/context.js.map +1 -0
  68. package/dist/src/cli/exec.d.ts +9 -0
  69. package/dist/src/cli/exec.js +34 -0
  70. package/dist/src/cli/exec.js.map +1 -0
  71. package/dist/src/cli/help.d.ts +1 -0
  72. package/dist/src/cli/help.js +291 -0
  73. package/dist/src/cli/help.js.map +1 -0
  74. package/dist/src/cli/install-source.d.ts +16 -0
  75. package/dist/src/cli/install-source.js +49 -0
  76. package/dist/src/cli/install-source.js.map +1 -0
  77. package/dist/src/cli/launcher.d.ts +32 -0
  78. package/dist/src/cli/launcher.js +168 -0
  79. package/dist/src/cli/launcher.js.map +1 -0
  80. package/dist/src/cli/migrations.d.ts +25 -0
  81. package/dist/src/cli/migrations.js +35 -0
  82. package/dist/src/cli/migrations.js.map +1 -0
  83. package/dist/src/cli/run-tree.d.ts +9 -0
  84. package/dist/src/cli/run-tree.js +32 -0
  85. package/dist/src/cli/run-tree.js.map +1 -0
  86. package/dist/src/cli/types.d.ts +18 -0
  87. package/dist/src/cli/types.js +12 -0
  88. package/dist/src/cli/types.js.map +1 -0
  89. package/dist/src/cli/update-plan.d.ts +15 -0
  90. package/dist/src/cli/update-plan.js +40 -0
  91. package/dist/src/cli/update-plan.js.map +1 -0
  92. package/dist/src/cli/versions.d.ts +26 -0
  93. package/dist/src/cli/versions.js +83 -0
  94. package/dist/src/cli/versions.js.map +1 -0
  95. package/dist/src/executors/build/executor.d.ts +19 -0
  96. package/dist/src/executors/build/executor.js +251 -0
  97. package/dist/src/executors/build/executor.js.map +1 -0
  98. package/dist/src/executors/build/schema.d.ts +42 -0
  99. package/dist/src/executors/build/schema.json +104 -0
  100. package/dist/src/executors/capacitor/executor.d.ts +8 -0
  101. package/dist/src/executors/capacitor/executor.js +45 -0
  102. package/dist/src/executors/capacitor/executor.js.map +1 -0
  103. package/dist/src/executors/capacitor/schema.d.ts +10 -0
  104. package/dist/src/executors/capacitor/schema.json +24 -0
  105. package/dist/src/executors/clean/executor.d.ts +19 -0
  106. package/dist/src/executors/clean/executor.js +134 -0
  107. package/dist/src/executors/clean/executor.js.map +1 -0
  108. package/dist/src/executors/clean/schema.d.ts +6 -0
  109. package/dist/src/executors/clean/schema.json +21 -0
  110. package/dist/src/executors/flutter-build/executor.d.ts +8 -0
  111. package/dist/src/executors/flutter-build/executor.js +70 -0
  112. package/dist/src/executors/flutter-build/executor.js.map +1 -0
  113. package/dist/src/executors/flutter-build/schema.d.ts +10 -0
  114. package/dist/src/executors/flutter-build/schema.json +44 -0
  115. package/dist/src/executors/flutter-export/executor.d.ts +8 -0
  116. package/dist/src/executors/flutter-export/executor.js +36 -0
  117. package/dist/src/executors/flutter-export/executor.js.map +1 -0
  118. package/dist/src/executors/flutter-export/schema.d.ts +6 -0
  119. package/dist/src/executors/flutter-export/schema.json +28 -0
  120. package/dist/src/generators/app/files/angular/.eslintrc.json__template__ +28 -0
  121. package/dist/src/generators/app/files/angular/csp-allowlist.json__template__ +1 -0
  122. package/dist/src/generators/app/files/angular/server/README.md__template__ +31 -0
  123. package/dist/src/generators/app/files/angular/src/app/app-routing.module.ts__template__ +10 -0
  124. package/dist/src/generators/app/files/angular/src/app/app.component.html__template__ +4 -0
  125. package/dist/src/generators/app/files/angular/src/app/app.component.scss__template__ +1 -0
  126. package/dist/src/generators/app/files/angular/src/app/app.component.ts__template__ +9 -0
  127. package/dist/src/generators/app/files/angular/src/app/app.module.ts__template__ +13 -0
  128. package/dist/src/generators/app/files/angular/src/index.html__template__ +12 -0
  129. package/dist/src/generators/app/files/angular/src/main.ts__template__ +16 -0
  130. package/dist/src/generators/app/files/angular/src/styles.scss__template__ +1 -0
  131. package/dist/src/generators/app/files/angular/tsconfig.app.json__template__ +10 -0
  132. package/dist/src/generators/app/files/angular/tsconfig.json__template__ +25 -0
  133. package/dist/src/generators/app/files/angular/tsconfig.spec.json__template__ +8 -0
  134. package/dist/src/generators/app/files/flutter/.gitignore__template__ +10 -0
  135. package/dist/src/generators/app/files/flutter/analysis_options.yaml__template__ +8 -0
  136. package/dist/src/generators/app/files/flutter/lib/main.dart__template__ +23 -0
  137. package/dist/src/generators/app/files/flutter/pubspec.yaml__template__ +26 -0
  138. package/dist/src/generators/app/files/flutter/server/nginx.conf__template__ +35 -0
  139. package/dist/src/generators/app/files/ionic/.gitignore__template__ +7 -0
  140. package/dist/src/generators/app/files/ionic/capacitor.config.ts__template__ +19 -0
  141. package/dist/src/generators/app/files/ionic/package.json__template__ +14 -0
  142. package/dist/src/generators/app/files/ionic/src/app/app.component.html__template__ +3 -0
  143. package/dist/src/generators/app/files/ionic/src/app/app.component.scss__template__ +0 -0
  144. package/dist/src/generators/app/files/ionic/src/app/app.module.ts__template__ +16 -0
  145. package/dist/src/generators/app/files/ionic/src/index.html__template__ +17 -0
  146. package/dist/src/generators/app/files/ionic/src/styles.scss__template__ +12 -0
  147. package/dist/src/generators/app/generator.d.ts +15 -0
  148. package/dist/src/generators/app/generator.js +363 -0
  149. package/dist/src/generators/app/generator.js.map +1 -0
  150. package/dist/src/generators/app/schema.d.ts +19 -0
  151. package/dist/src/generators/app/schema.json +77 -0
  152. package/dist/src/generators/env/generator.d.ts +3 -0
  153. package/dist/src/generators/env/generator.js +454 -0
  154. package/dist/src/generators/env/generator.js.map +1 -0
  155. package/dist/src/generators/env/schema.d.ts +18 -0
  156. package/dist/src/generators/env/schema.json +47 -0
  157. package/dist/src/generators/infra/files/ci/commitlint/commitlint.config.js__template__ +6 -0
  158. package/dist/src/generators/infra/files/ci/common/tools/config/allowed-cycles.json__template__ +1 -0
  159. package/dist/src/generators/infra/files/ci/common/tools/scripts/check-cycles.js__template__ +201 -0
  160. package/dist/src/generators/infra/files/ci/github-actions/.github/workflows/ci.yml__template__ +68 -0
  161. package/dist/src/generators/infra/files/ci/github-actions/.github/workflows/pr-title.yml__template__ +36 -0
  162. package/dist/src/generators/infra/files/ci/jenkins/Jenkinsfile__template__ +45 -0
  163. package/dist/src/generators/infra/files/docs/.github/ISSUE_TEMPLATE/bug.yml__template__ +39 -0
  164. package/dist/src/generators/infra/files/docs/.github/ISSUE_TEMPLATE/config.yml__template__ +1 -0
  165. package/dist/src/generators/infra/files/docs/.github/ISSUE_TEMPLATE/feature.yml__template__ +23 -0
  166. package/dist/src/generators/infra/files/docs/.github/PULL_REQUEST_TEMPLATE.md__template__ +23 -0
  167. package/dist/src/generators/infra/files/docs/CODE_OF_CONDUCT.md__template__ +18 -0
  168. package/dist/src/generators/infra/files/docs/CONTRIBUTING.md__template__ +61 -0
  169. package/dist/src/generators/infra/files/docs/SECURITY.md__template__ +25 -0
  170. package/dist/src/generators/infra/files/quality/.husky/pre-push__template__ +2 -0
  171. package/dist/src/generators/infra/files/quality/.secretlintignore__template__ +7 -0
  172. package/dist/src/generators/infra/files/quality/.secretlintrc.json__template__ +7 -0
  173. package/dist/src/generators/infra/files/quality/knip.json__template__ +9 -0
  174. package/dist/src/generators/infra/files/upgrades/.github/workflows/dependency-upgrade.yml__template__ +80 -0
  175. package/dist/src/generators/infra/generator.d.ts +60 -0
  176. package/dist/src/generators/infra/generator.js +356 -0
  177. package/dist/src/generators/infra/generator.js.map +1 -0
  178. package/dist/src/generators/infra/options.d.ts +28 -0
  179. package/dist/src/generators/infra/options.js +80 -0
  180. package/dist/src/generators/infra/options.js.map +1 -0
  181. package/dist/src/generators/infra/schema.d.ts +19 -0
  182. package/dist/src/generators/infra/schema.json +59 -0
  183. package/dist/src/generators/lib/angular-lib.d.ts +27 -0
  184. package/dist/src/generators/lib/angular-lib.js +85 -0
  185. package/dist/src/generators/lib/angular-lib.js.map +1 -0
  186. package/dist/src/generators/lib/files/angular/component/src/index.ts__template__ +2 -0
  187. package/dist/src/generators/lib/files/angular/component/src/lib/__fileName__/__fileName__.component.html__template__ +1 -0
  188. package/dist/src/generators/lib/files/angular/component/src/lib/__fileName__/__fileName__.component.scss__template__ +3 -0
  189. package/dist/src/generators/lib/files/angular/component/src/lib/__fileName__/__fileName__.component.ts__template__ +9 -0
  190. package/dist/src/generators/lib/files/angular/component/src/lib/__fileName__.module.ts__template__ +11 -0
  191. package/dist/src/generators/lib/files/angular/config/.eslintrc.json__template__ +32 -0
  192. package/dist/src/generators/lib/files/angular/config/tsconfig.json__template__ +22 -0
  193. package/dist/src/generators/lib/files/angular/config/tsconfig.lib.json__template__ +12 -0
  194. package/dist/src/generators/lib/files/assets/README.md__template__ +13 -0
  195. package/dist/src/generators/lib/files/design-tokens/README.md__template__ +90 -0
  196. package/dist/src/generators/lib/files/design-tokens/generated/dart/pubspec.yaml__template__ +11 -0
  197. package/dist/src/generators/lib/files/design-tokens/src/index.ts__template__ +1 -0
  198. package/dist/src/generators/lib/files/design-tokens/style-dictionary.config.js__template__ +41 -0
  199. package/dist/src/generators/lib/files/flutter/.gitignore__template__ +7 -0
  200. package/dist/src/generators/lib/files/flutter/analysis_options.yaml__template__ +6 -0
  201. package/dist/src/generators/lib/files/flutter/lib/__snakeName__.dart__template__ +1 -0
  202. package/dist/src/generators/lib/files/flutter/lib/src/__snakeName__.dart__template__ +6 -0
  203. package/dist/src/generators/lib/files/flutter/pubspec.yaml__template__ +18 -0
  204. package/dist/src/generators/lib/files/flutter/test/__snakeName___test.dart__template__ +8 -0
  205. package/dist/src/generators/lib/files/ionic/src/index.ts__template__ +2 -0
  206. package/dist/src/generators/lib/files/ionic/src/lib/__fileName__/__fileName__.page.html__template__ +9 -0
  207. package/dist/src/generators/lib/files/ionic/src/lib/__fileName__/__fileName__.page.scss__template__ +3 -0
  208. package/dist/src/generators/lib/files/ionic/src/lib/__fileName__/__fileName__.page.ts__template__ +9 -0
  209. package/dist/src/generators/lib/files/ionic/src/lib/__fileName__.module.ts__template__ +12 -0
  210. package/dist/src/generators/lib/files/pii/README.md__template__ +35 -0
  211. package/dist/src/generators/lib/files/pii/src/index.ts__template__ +5 -0
  212. package/dist/src/generators/lib/files/pii/src/lib/pii-mask.directive.ts__template__ +30 -0
  213. package/dist/src/generators/lib/files/pii/src/lib/pii-mask.module.ts__template__ +17 -0
  214. package/dist/src/generators/lib/files/pii/src/lib/pii-mask.options.ts__template__ +6 -0
  215. package/dist/src/generators/lib/files/pii/src/lib/pii-mask.pipe.ts__template__ +14 -0
  216. package/dist/src/generators/lib/files/pii/src/lib/pii-mask.ts__template__ +117 -0
  217. package/dist/src/generators/lib/files/session/README.md__template__ +39 -0
  218. package/dist/src/generators/lib/files/session/src/index.ts__template__ +5 -0
  219. package/dist/src/generators/lib/files/session/src/lib/session-clock.ts__template__ +113 -0
  220. package/dist/src/generators/lib/files/session/src/lib/session-timeout.config.ts__template__ +8 -0
  221. package/dist/src/generators/lib/files/session/src/lib/session-timeout.module.ts__template__ +23 -0
  222. package/dist/src/generators/lib/files/session/src/lib/session-timeout.service.ts__template__ +289 -0
  223. package/dist/src/generators/lib/files/session/src/lib/session-warning/session-warning.component.html__template__ +21 -0
  224. package/dist/src/generators/lib/files/session/src/lib/session-warning/session-warning.component.scss__template__ +40 -0
  225. package/dist/src/generators/lib/files/session/src/lib/session-warning/session-warning.component.ts__template__ +105 -0
  226. package/dist/src/generators/lib/files/state/ngrx/README.md__template__ +33 -0
  227. package/dist/src/generators/lib/files/state/ngrx/src/index.ts__template__ +6 -0
  228. package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__-state.module.ts__template__ +18 -0
  229. package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__.actions.ts__template__ +12 -0
  230. package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__.effects.ts__template__ +26 -0
  231. package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__.models.ts__template__ +4 -0
  232. package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__.reducer.ts__template__ +33 -0
  233. package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__.selectors.ts__template__ +14 -0
  234. package/dist/src/generators/lib/files/state/simple-service/README.md__template__ +20 -0
  235. package/dist/src/generators/lib/files/state/simple-service/src/index.ts__template__ +2 -0
  236. package/dist/src/generators/lib/files/state/simple-service/src/lib/__fileName__.store.ts__template__ +58 -0
  237. package/dist/src/generators/lib/files/state/simple-service/src/lib/store.ts__template__ +34 -0
  238. package/dist/src/generators/lib/files/styles/README.md__template__ +39 -0
  239. package/dist/src/generators/lib/files/styles/src/_index.scss__template__ +3 -0
  240. package/dist/src/generators/lib/files/styles/src/mixins/_index.scss__template__ +13 -0
  241. package/dist/src/generators/lib/files/styles/src/themes/_index.scss__template__ +20 -0
  242. package/dist/src/generators/lib/files/styles/src/tokens/_index.scss__template__ +27 -0
  243. package/dist/src/generators/lib/files/ts/config/.eslintrc.json__template__ +10 -0
  244. package/dist/src/generators/lib/files/ts/config/tsconfig.json__template__ +14 -0
  245. package/dist/src/generators/lib/files/ts/config/tsconfig.lib.json__template__ +10 -0
  246. package/dist/src/generators/lib/files/ts/sample/src/index.ts__template__ +1 -0
  247. package/dist/src/generators/lib/files/ts/sample/src/lib/__fileName__.ts__template__ +4 -0
  248. package/dist/src/generators/lib/generator.d.ts +3 -0
  249. package/dist/src/generators/lib/generator.js +53 -0
  250. package/dist/src/generators/lib/generator.js.map +1 -0
  251. package/dist/src/generators/lib/lib-utils.d.ts +72 -0
  252. package/dist/src/generators/lib/lib-utils.js +170 -0
  253. package/dist/src/generators/lib/lib-utils.js.map +1 -0
  254. package/dist/src/generators/lib/schema.d.ts +31 -0
  255. package/dist/src/generators/lib/schema.json +63 -0
  256. package/dist/src/generators/lib/style-dictionary.d.ts +36 -0
  257. package/dist/src/generators/lib/style-dictionary.js +183 -0
  258. package/dist/src/generators/lib/style-dictionary.js.map +1 -0
  259. package/dist/src/generators/lib/types/angular.d.ts +2 -0
  260. package/dist/src/generators/lib/types/angular.js +20 -0
  261. package/dist/src/generators/lib/types/angular.js.map +1 -0
  262. package/dist/src/generators/lib/types/assets.d.ts +2 -0
  263. package/dist/src/generators/lib/types/assets.js +20 -0
  264. package/dist/src/generators/lib/types/assets.js.map +1 -0
  265. package/dist/src/generators/lib/types/design-tokens.d.ts +10 -0
  266. package/dist/src/generators/lib/types/design-tokens.js +78 -0
  267. package/dist/src/generators/lib/types/design-tokens.js.map +1 -0
  268. package/dist/src/generators/lib/types/flutter.d.ts +2 -0
  269. package/dist/src/generators/lib/types/flutter.js +28 -0
  270. package/dist/src/generators/lib/types/flutter.js.map +1 -0
  271. package/dist/src/generators/lib/types/index.d.ts +8 -0
  272. package/dist/src/generators/lib/types/index.js +31 -0
  273. package/dist/src/generators/lib/types/index.js.map +1 -0
  274. package/dist/src/generators/lib/types/ionic.d.ts +4 -0
  275. package/dist/src/generators/lib/types/ionic.js +35 -0
  276. package/dist/src/generators/lib/types/ionic.js.map +1 -0
  277. package/dist/src/generators/lib/types/pii.d.ts +3 -0
  278. package/dist/src/generators/lib/types/pii.js +19 -0
  279. package/dist/src/generators/lib/types/pii.js.map +1 -0
  280. package/dist/src/generators/lib/types/session.d.ts +3 -0
  281. package/dist/src/generators/lib/types/session.js +21 -0
  282. package/dist/src/generators/lib/types/session.js.map +1 -0
  283. package/dist/src/generators/lib/types/state.d.ts +5 -0
  284. package/dist/src/generators/lib/types/state.js +48 -0
  285. package/dist/src/generators/lib/types/state.js.map +1 -0
  286. package/dist/src/generators/lib/types/styles.d.ts +2 -0
  287. package/dist/src/generators/lib/types/styles.js +19 -0
  288. package/dist/src/generators/lib/types/styles.js.map +1 -0
  289. package/dist/src/generators/lib/types/ts.d.ts +5 -0
  290. package/dist/src/generators/lib/types/ts.js +30 -0
  291. package/dist/src/generators/lib/types/ts.js.map +1 -0
  292. package/dist/src/generators/llm/generator.d.ts +8 -0
  293. package/dist/src/generators/llm/generator.js +13 -0
  294. package/dist/src/generators/llm/generator.js.map +1 -0
  295. package/dist/src/generators/llm/schema.d.ts +4 -0
  296. package/dist/src/generators/llm/schema.json +16 -0
  297. package/dist/src/generators/migrate/adapters/angular-cli.d.ts +82 -0
  298. package/dist/src/generators/migrate/adapters/angular-cli.js +439 -0
  299. package/dist/src/generators/migrate/adapters/angular-cli.js.map +1 -0
  300. package/dist/src/generators/migrate/adapters/angular-workspace.d.ts +28 -0
  301. package/dist/src/generators/migrate/adapters/angular-workspace.js +397 -0
  302. package/dist/src/generators/migrate/adapters/angular-workspace.js.map +1 -0
  303. package/dist/src/generators/migrate/adapters/external.d.ts +23 -0
  304. package/dist/src/generators/migrate/adapters/external.js +230 -0
  305. package/dist/src/generators/migrate/adapters/external.js.map +1 -0
  306. package/dist/src/generators/migrate/adapters/flutter.d.ts +26 -0
  307. package/dist/src/generators/migrate/adapters/flutter.js +176 -0
  308. package/dist/src/generators/migrate/adapters/flutter.js.map +1 -0
  309. package/dist/src/generators/migrate/adapters/index.d.ts +34 -0
  310. package/dist/src/generators/migrate/adapters/index.js +136 -0
  311. package/dist/src/generators/migrate/adapters/index.js.map +1 -0
  312. package/dist/src/generators/migrate/adapters/ionic.d.ts +17 -0
  313. package/dist/src/generators/migrate/adapters/ionic.js +137 -0
  314. package/dist/src/generators/migrate/adapters/ionic.js.map +1 -0
  315. package/dist/src/generators/migrate/adapters/npm-workspaces.d.ts +23 -0
  316. package/dist/src/generators/migrate/adapters/npm-workspaces.js +734 -0
  317. package/dist/src/generators/migrate/adapters/npm-workspaces.js.map +1 -0
  318. package/dist/src/generators/migrate/adapters/nx-workspace.d.ts +47 -0
  319. package/dist/src/generators/migrate/adapters/nx-workspace.js +1037 -0
  320. package/dist/src/generators/migrate/adapters/nx-workspace.js.map +1 -0
  321. package/dist/src/generators/migrate/adapters/scaffold.d.ts +2 -0
  322. package/dist/src/generators/migrate/adapters/scaffold.js +200 -0
  323. package/dist/src/generators/migrate/adapters/scaffold.js.map +1 -0
  324. package/dist/src/generators/migrate/adapters/types.d.ts +184 -0
  325. package/dist/src/generators/migrate/adapters/types.js +63 -0
  326. package/dist/src/generators/migrate/adapters/types.js.map +1 -0
  327. package/dist/src/generators/migrate/angular-code-scan.d.ts +6 -0
  328. package/dist/src/generators/migrate/angular-code-scan.js +150 -0
  329. package/dist/src/generators/migrate/angular-code-scan.js.map +1 -0
  330. package/dist/src/generators/migrate/angular-config-files.d.ts +49 -0
  331. package/dist/src/generators/migrate/angular-config-files.js +158 -0
  332. package/dist/src/generators/migrate/angular-config-files.js.map +1 -0
  333. package/dist/src/generators/migrate/angular-project-json.d.ts +73 -0
  334. package/dist/src/generators/migrate/angular-project-json.js +352 -0
  335. package/dist/src/generators/migrate/angular-project-json.js.map +1 -0
  336. package/dist/src/generators/migrate/angular-workspace/aliases.d.ts +30 -0
  337. package/dist/src/generators/migrate/angular-workspace/aliases.js +73 -0
  338. package/dist/src/generators/migrate/angular-workspace/aliases.js.map +1 -0
  339. package/dist/src/generators/migrate/angular-workspace/eslint.d.ts +8 -0
  340. package/dist/src/generators/migrate/angular-workspace/eslint.js +38 -0
  341. package/dist/src/generators/migrate/angular-workspace/eslint.js.map +1 -0
  342. package/dist/src/generators/migrate/angular-workspace/ng-package.d.ts +4 -0
  343. package/dist/src/generators/migrate/angular-workspace/ng-package.js +16 -0
  344. package/dist/src/generators/migrate/angular-workspace/ng-package.js.map +1 -0
  345. package/dist/src/generators/migrate/angular-workspace/source.d.ts +15 -0
  346. package/dist/src/generators/migrate/angular-workspace/source.js +108 -0
  347. package/dist/src/generators/migrate/angular-workspace/source.js.map +1 -0
  348. package/dist/src/generators/migrate/angular17.d.ts +45 -0
  349. package/dist/src/generators/migrate/angular17.js +495 -0
  350. package/dist/src/generators/migrate/angular17.js.map +1 -0
  351. package/dist/src/generators/migrate/batch.d.ts +29 -0
  352. package/dist/src/generators/migrate/batch.js +211 -0
  353. package/dist/src/generators/migrate/batch.js.map +1 -0
  354. package/dist/src/generators/migrate/copy.d.ts +60 -0
  355. package/dist/src/generators/migrate/copy.js +224 -0
  356. package/dist/src/generators/migrate/copy.js.map +1 -0
  357. package/dist/src/generators/migrate/dependencies.d.ts +38 -0
  358. package/dist/src/generators/migrate/dependencies.js +196 -0
  359. package/dist/src/generators/migrate/dependencies.js.map +1 -0
  360. package/dist/src/generators/migrate/generator.d.ts +9 -0
  361. package/dist/src/generators/migrate/generator.js +347 -0
  362. package/dist/src/generators/migrate/generator.js.map +1 -0
  363. package/dist/src/generators/migrate/imports/rewrite.d.ts +46 -0
  364. package/dist/src/generators/migrate/imports/rewrite.js +382 -0
  365. package/dist/src/generators/migrate/imports/rewrite.js.map +1 -0
  366. package/dist/src/generators/migrate/ionic/capacitor-config.d.ts +24 -0
  367. package/dist/src/generators/migrate/ionic/capacitor-config.js +113 -0
  368. package/dist/src/generators/migrate/ionic/capacitor-config.js.map +1 -0
  369. package/dist/src/generators/migrate/ionic/packages.d.ts +34 -0
  370. package/dist/src/generators/migrate/ionic/packages.js +92 -0
  371. package/dist/src/generators/migrate/ionic/packages.js.map +1 -0
  372. package/dist/src/generators/migrate/ionic/shape.d.ts +32 -0
  373. package/dist/src/generators/migrate/ionic/shape.js +221 -0
  374. package/dist/src/generators/migrate/ionic/shape.js.map +1 -0
  375. package/dist/src/generators/migrate/ionic/skip.d.ts +3 -0
  376. package/dist/src/generators/migrate/ionic/skip.js +25 -0
  377. package/dist/src/generators/migrate/ionic/skip.js.map +1 -0
  378. package/dist/src/generators/migrate/names.d.ts +3 -0
  379. package/dist/src/generators/migrate/names.js +21 -0
  380. package/dist/src/generators/migrate/names.js.map +1 -0
  381. package/dist/src/generators/migrate/npm-deps.d.ts +28 -0
  382. package/dist/src/generators/migrate/npm-deps.js +63 -0
  383. package/dist/src/generators/migrate/npm-deps.js.map +1 -0
  384. package/dist/src/generators/migrate/npm-workspaces/pnpm-yaml.d.ts +10 -0
  385. package/dist/src/generators/migrate/npm-workspaces/pnpm-yaml.js +246 -0
  386. package/dist/src/generators/migrate/npm-workspaces/pnpm-yaml.js.map +1 -0
  387. package/dist/src/generators/migrate/npm-workspaces/source.d.ts +46 -0
  388. package/dist/src/generators/migrate/npm-workspaces/source.js +253 -0
  389. package/dist/src/generators/migrate/npm-workspaces/source.js.map +1 -0
  390. package/dist/src/generators/migrate/nx/build-scripts.d.ts +22 -0
  391. package/dist/src/generators/migrate/nx/build-scripts.js +147 -0
  392. package/dist/src/generators/migrate/nx/build-scripts.js.map +1 -0
  393. package/dist/src/generators/migrate/nx/detect.d.ts +3 -0
  394. package/dist/src/generators/migrate/nx/detect.js +43 -0
  395. package/dist/src/generators/migrate/nx/detect.js.map +1 -0
  396. package/dist/src/generators/migrate/nx/env-encryption.d.ts +35 -0
  397. package/dist/src/generators/migrate/nx/env-encryption.js +423 -0
  398. package/dist/src/generators/migrate/nx/env-encryption.js.map +1 -0
  399. package/dist/src/generators/migrate/nx/rewrite.d.ts +27 -0
  400. package/dist/src/generators/migrate/nx/rewrite.js +223 -0
  401. package/dist/src/generators/migrate/nx/rewrite.js.map +1 -0
  402. package/dist/src/generators/migrate/nx/selection.d.ts +25 -0
  403. package/dist/src/generators/migrate/nx/selection.js +173 -0
  404. package/dist/src/generators/migrate/nx/selection.js.map +1 -0
  405. package/dist/src/generators/migrate/nx/shared-folders.d.ts +58 -0
  406. package/dist/src/generators/migrate/nx/shared-folders.js +239 -0
  407. package/dist/src/generators/migrate/nx/shared-folders.js.map +1 -0
  408. package/dist/src/generators/migrate/nx/workspace-source.d.ts +58 -0
  409. package/dist/src/generators/migrate/nx/workspace-source.js +275 -0
  410. package/dist/src/generators/migrate/nx/workspace-source.js.map +1 -0
  411. package/dist/src/generators/migrate/pnpm.d.ts +42 -0
  412. package/dist/src/generators/migrate/pnpm.js +132 -0
  413. package/dist/src/generators/migrate/pnpm.js.map +1 -0
  414. package/dist/src/generators/migrate/report.d.ts +21 -0
  415. package/dist/src/generators/migrate/report.js +243 -0
  416. package/dist/src/generators/migrate/report.js.map +1 -0
  417. package/dist/src/generators/migrate/rollback/manifest.d.ts +84 -0
  418. package/dist/src/generators/migrate/rollback/manifest.js +162 -0
  419. package/dist/src/generators/migrate/rollback/manifest.js.map +1 -0
  420. package/dist/src/generators/migrate/rollback/recording-tree.d.ts +19 -0
  421. package/dist/src/generators/migrate/rollback/recording-tree.js +87 -0
  422. package/dist/src/generators/migrate/rollback/recording-tree.js.map +1 -0
  423. package/dist/src/generators/migrate/rollback/rollback.d.ts +29 -0
  424. package/dist/src/generators/migrate/rollback/rollback.js +271 -0
  425. package/dist/src/generators/migrate/rollback/rollback.js.map +1 -0
  426. package/dist/src/generators/migrate/schema.d.ts +41 -0
  427. package/dist/src/generators/migrate/schema.json +85 -0
  428. package/dist/src/generators/migrate/source.d.ts +26 -0
  429. package/dist/src/generators/migrate/source.js +70 -0
  430. package/dist/src/generators/migrate/source.js.map +1 -0
  431. package/dist/src/generators/preset/files/root/.editorconfig__template__ +15 -0
  432. package/dist/src/generators/preset/files/root/.eslintignore__template__ +2 -0
  433. package/dist/src/generators/preset/files/root/.eslintrc.json__template__ +38 -0
  434. package/dist/src/generators/preset/files/root/.gitattributes__template__ +12 -0
  435. package/dist/src/generators/preset/files/root/.gitignore__template__ +9 -0
  436. package/dist/src/generators/preset/files/root/.husky/commit-msg__template__ +1 -0
  437. package/dist/src/generators/preset/files/root/.husky/pre-commit__template__ +1 -0
  438. package/dist/src/generators/preset/files/root/.npmrc__template__ +4 -0
  439. package/dist/src/generators/preset/files/root/.nvmrc__template__ +1 -0
  440. package/dist/src/generators/preset/files/root/.prettierignore__template__ +6 -0
  441. package/dist/src/generators/preset/files/root/.prettierrc__template__ +7 -0
  442. package/dist/src/generators/preset/files/root/commitlint.config.js__template__ +6 -0
  443. package/dist/src/generators/preset/files/root/nx.json__template__ +30 -0
  444. package/dist/src/generators/preset/files/root/package.json__template__ +34 -0
  445. package/dist/src/generators/preset/files/root/tools/config/sri-cdn-allowlist.json__template__ +1 -0
  446. package/dist/src/generators/preset/files/root/tsconfig.base.json__template__ +18 -0
  447. package/dist/src/generators/preset/generator.d.ts +11 -0
  448. package/dist/src/generators/preset/generator.js +91 -0
  449. package/dist/src/generators/preset/generator.js.map +1 -0
  450. package/dist/src/generators/preset/schema.d.ts +20 -0
  451. package/dist/src/generators/preset/schema.json +86 -0
  452. package/dist/src/generators/shared-libs/generator.d.ts +4 -0
  453. package/dist/src/generators/shared-libs/generator.js +60 -0
  454. package/dist/src/generators/shared-libs/generator.js.map +1 -0
  455. package/dist/src/generators/shared-libs/schema.d.ts +6 -0
  456. package/dist/src/generators/shared-libs/schema.json +21 -0
  457. package/dist/src/index.d.ts +16 -0
  458. package/dist/src/index.js +20 -0
  459. package/dist/src/index.js.map +1 -0
  460. package/dist/src/lib/csp/allowlist.d.ts +64 -0
  461. package/dist/src/lib/csp/allowlist.js +126 -0
  462. package/dist/src/lib/csp/allowlist.js.map +1 -0
  463. package/dist/src/lib/csp/import.d.ts +52 -0
  464. package/dist/src/lib/csp/import.js +291 -0
  465. package/dist/src/lib/csp/import.js.map +1 -0
  466. package/dist/src/lib/csp/render.d.ts +19 -0
  467. package/dist/src/lib/csp/render.js +116 -0
  468. package/dist/src/lib/csp/render.js.map +1 -0
  469. package/dist/src/lib/env/derive.d.ts +38 -0
  470. package/dist/src/lib/env/derive.js +115 -0
  471. package/dist/src/lib/env/derive.js.map +1 -0
  472. package/dist/src/lib/env-encryption/backup.d.ts +40 -0
  473. package/dist/src/lib/env-encryption/backup.js +234 -0
  474. package/dist/src/lib/env-encryption/backup.js.map +1 -0
  475. package/dist/src/lib/env-encryption/config.d.ts +50 -0
  476. package/dist/src/lib/env-encryption/config.js +173 -0
  477. package/dist/src/lib/env-encryption/config.js.map +1 -0
  478. package/dist/src/lib/env-encryption/domains.d.ts +9 -0
  479. package/dist/src/lib/env-encryption/domains.js +52 -0
  480. package/dist/src/lib/env-encryption/domains.js.map +1 -0
  481. package/dist/src/lib/env-encryption/encrypt.d.ts +48 -0
  482. package/dist/src/lib/env-encryption/encrypt.js +407 -0
  483. package/dist/src/lib/env-encryption/encrypt.js.map +1 -0
  484. package/dist/src/lib/env-encryption/env-file.d.ts +72 -0
  485. package/dist/src/lib/env-encryption/env-file.js +395 -0
  486. package/dist/src/lib/env-encryption/env-file.js.map +1 -0
  487. package/dist/src/lib/env-encryption/gcm.d.ts +51 -0
  488. package/dist/src/lib/env-encryption/gcm.js +76 -0
  489. package/dist/src/lib/env-encryption/gcm.js.map +1 -0
  490. package/dist/src/lib/env-encryption/key-material.d.ts +53 -0
  491. package/dist/src/lib/env-encryption/key-material.js +148 -0
  492. package/dist/src/lib/env-encryption/key-material.js.map +1 -0
  493. package/dist/src/lib/env-encryption/placeholders.d.ts +15 -0
  494. package/dist/src/lib/env-encryption/placeholders.js +93 -0
  495. package/dist/src/lib/env-encryption/placeholders.js.map +1 -0
  496. package/dist/src/lib/env-encryption/prepare.d.ts +43 -0
  497. package/dist/src/lib/env-encryption/prepare.js +245 -0
  498. package/dist/src/lib/env-encryption/prepare.js.map +1 -0
  499. package/dist/src/lib/env-encryption/sensitive.d.ts +2 -0
  500. package/dist/src/lib/env-encryption/sensitive.js +180 -0
  501. package/dist/src/lib/env-encryption/sensitive.js.map +1 -0
  502. package/dist/src/lib/env-encryption/stamp.d.ts +2 -0
  503. package/dist/src/lib/env-encryption/stamp.js +52 -0
  504. package/dist/src/lib/env-encryption/stamp.js.map +1 -0
  505. package/dist/src/lib/env-encryption/switch-gcm.d.ts +43 -0
  506. package/dist/src/lib/env-encryption/switch-gcm.js +371 -0
  507. package/dist/src/lib/env-encryption/switch-gcm.js.map +1 -0
  508. package/dist/src/lib/env-encryption/workspace.d.ts +10 -0
  509. package/dist/src/lib/env-encryption/workspace.js +48 -0
  510. package/dist/src/lib/env-encryption/workspace.js.map +1 -0
  511. package/dist/src/lib/hardening/files.d.ts +17 -0
  512. package/dist/src/lib/hardening/files.js +43 -0
  513. package/dist/src/lib/hardening/files.js.map +1 -0
  514. package/dist/src/lib/hardening/integrity.d.ts +24 -0
  515. package/dist/src/lib/hardening/integrity.js +112 -0
  516. package/dist/src/lib/hardening/integrity.js.map +1 -0
  517. package/dist/src/lib/hardening/leak-check.d.ts +15 -0
  518. package/dist/src/lib/hardening/leak-check.js +100 -0
  519. package/dist/src/lib/hardening/leak-check.js.map +1 -0
  520. package/dist/src/lib/hardening/ngsw.d.ts +7 -0
  521. package/dist/src/lib/hardening/ngsw.js +55 -0
  522. package/dist/src/lib/hardening/ngsw.js.map +1 -0
  523. package/dist/src/lib/hardening/obfuscate.d.ts +36 -0
  524. package/dist/src/lib/hardening/obfuscate.js +153 -0
  525. package/dist/src/lib/hardening/obfuscate.js.map +1 -0
  526. package/dist/src/lib/hardening/options.d.ts +36 -0
  527. package/dist/src/lib/hardening/options.js +143 -0
  528. package/dist/src/lib/hardening/options.js.map +1 -0
  529. package/dist/src/lib/hardening/source-maps.d.ts +7 -0
  530. package/dist/src/lib/hardening/source-maps.js +37 -0
  531. package/dist/src/lib/hardening/source-maps.js.map +1 -0
  532. package/dist/src/lib/hardening/strip.d.ts +55 -0
  533. package/dist/src/lib/hardening/strip.js +178 -0
  534. package/dist/src/lib/hardening/strip.js.map +1 -0
  535. package/dist/src/lib/helpers/encrypt-env.d.ts +13 -0
  536. package/dist/src/lib/helpers/encrypt-env.js +33 -0
  537. package/dist/src/lib/helpers/encrypt-env.js.map +1 -0
  538. package/dist/src/lib/helpers/inject-meta.d.ts +14 -0
  539. package/dist/src/lib/helpers/inject-meta.js +49 -0
  540. package/dist/src/lib/helpers/inject-meta.js.map +1 -0
  541. package/dist/src/lib/helpers/inject-nonce.d.ts +7 -0
  542. package/dist/src/lib/helpers/inject-nonce.js +59 -0
  543. package/dist/src/lib/helpers/inject-nonce.js.map +1 -0
  544. package/dist/src/lib/helpers/inject-sri.d.ts +11 -0
  545. package/dist/src/lib/helpers/inject-sri.js +92 -0
  546. package/dist/src/lib/helpers/inject-sri.js.map +1 -0
  547. package/dist/src/lib/helpers/strip-exif.d.ts +9 -0
  548. package/dist/src/lib/helpers/strip-exif.js +52 -0
  549. package/dist/src/lib/helpers/strip-exif.js.map +1 -0
  550. package/dist/src/lib/release/plan.d.ts +45 -0
  551. package/dist/src/lib/release/plan.js +76 -0
  552. package/dist/src/lib/release/plan.js.map +1 -0
  553. package/dist/src/lib/release/run.d.ts +46 -0
  554. package/dist/src/lib/release/run.js +160 -0
  555. package/dist/src/lib/release/run.js.map +1 -0
  556. package/dist/src/lib/utils/angular-deps.d.ts +22 -0
  557. package/dist/src/lib/utils/angular-deps.js +108 -0
  558. package/dist/src/lib/utils/angular-deps.js.map +1 -0
  559. package/dist/src/lib/utils/angular-project.d.ts +52 -0
  560. package/dist/src/lib/utils/angular-project.js +168 -0
  561. package/dist/src/lib/utils/angular-project.js.map +1 -0
  562. package/dist/src/lib/utils/app-dir.d.ts +17 -0
  563. package/dist/src/lib/utils/app-dir.js +52 -0
  564. package/dist/src/lib/utils/app-dir.js.map +1 -0
  565. package/dist/src/lib/utils/base-href.d.ts +26 -0
  566. package/dist/src/lib/utils/base-href.js +60 -0
  567. package/dist/src/lib/utils/base-href.js.map +1 -0
  568. package/dist/src/lib/utils/ci-resolve.d.ts +10 -0
  569. package/dist/src/lib/utils/ci-resolve.js +50 -0
  570. package/dist/src/lib/utils/ci-resolve.js.map +1 -0
  571. package/dist/src/lib/utils/csp-nonce.d.ts +34 -0
  572. package/dist/src/lib/utils/csp-nonce.js +142 -0
  573. package/dist/src/lib/utils/csp-nonce.js.map +1 -0
  574. package/dist/src/lib/utils/dependencies.d.ts +25 -0
  575. package/dist/src/lib/utils/dependencies.js +71 -0
  576. package/dist/src/lib/utils/dependencies.js.map +1 -0
  577. package/dist/src/lib/utils/devkit-deps.d.ts +19 -0
  578. package/dist/src/lib/utils/devkit-deps.js +34 -0
  579. package/dist/src/lib/utils/devkit-deps.js.map +1 -0
  580. package/dist/src/lib/utils/env-files.d.ts +18 -0
  581. package/dist/src/lib/utils/env-files.js +41 -0
  582. package/dist/src/lib/utils/env-files.js.map +1 -0
  583. package/dist/src/lib/utils/filesystem.d.ts +7 -0
  584. package/dist/src/lib/utils/filesystem.js +20 -0
  585. package/dist/src/lib/utils/filesystem.js.map +1 -0
  586. package/dist/src/lib/utils/flutter-web.d.ts +7 -0
  587. package/dist/src/lib/utils/flutter-web.js +56 -0
  588. package/dist/src/lib/utils/flutter-web.js.map +1 -0
  589. package/dist/src/lib/utils/knip.d.ts +16 -0
  590. package/dist/src/lib/utils/knip.js +71 -0
  591. package/dist/src/lib/utils/knip.js.map +1 -0
  592. package/dist/src/lib/utils/lint-staged.d.ts +5 -0
  593. package/dist/src/lib/utils/lint-staged.js +34 -0
  594. package/dist/src/lib/utils/lint-staged.js.map +1 -0
  595. package/dist/src/lib/utils/llm-block.d.ts +88 -0
  596. package/dist/src/lib/utils/llm-block.js +457 -0
  597. package/dist/src/lib/utils/llm-block.js.map +1 -0
  598. package/dist/src/lib/utils/node-engine.d.ts +9 -0
  599. package/dist/src/lib/utils/node-engine.js +63 -0
  600. package/dist/src/lib/utils/node-engine.js.map +1 -0
  601. package/dist/src/lib/utils/npm-scripts.d.ts +7 -0
  602. package/dist/src/lib/utils/npm-scripts.js +28 -0
  603. package/dist/src/lib/utils/npm-scripts.js.map +1 -0
  604. package/dist/src/lib/utils/nx-targets.d.ts +3 -0
  605. package/dist/src/lib/utils/nx-targets.js +25 -0
  606. package/dist/src/lib/utils/nx-targets.js.map +1 -0
  607. package/dist/src/lib/utils/project-json-files.d.ts +23 -0
  608. package/dist/src/lib/utils/project-json-files.js +73 -0
  609. package/dist/src/lib/utils/project-json-files.js.map +1 -0
  610. package/dist/src/lib/utils/quality.d.ts +71 -0
  611. package/dist/src/lib/utils/quality.js +295 -0
  612. package/dist/src/lib/utils/quality.js.map +1 -0
  613. package/dist/src/lib/utils/serve-port.d.ts +28 -0
  614. package/dist/src/lib/utils/serve-port.js +73 -0
  615. package/dist/src/lib/utils/serve-port.js.map +1 -0
  616. package/dist/src/lib/utils/shared-libs.d.ts +37 -0
  617. package/dist/src/lib/utils/shared-libs.js +152 -0
  618. package/dist/src/lib/utils/shared-libs.js.map +1 -0
  619. package/dist/src/lib/utils/ts-paths.d.ts +3 -0
  620. package/dist/src/lib/utils/ts-paths.js +31 -0
  621. package/dist/src/lib/utils/ts-paths.js.map +1 -0
  622. package/dist/src/lib/utils/workspace.d.ts +3 -0
  623. package/dist/src/lib/utils/workspace.js +15 -0
  624. package/dist/src/lib/utils/workspace.js.map +1 -0
  625. package/dist/src/migrate-sdk.d.ts +31 -0
  626. package/dist/src/migrate-sdk.js +35 -0
  627. package/dist/src/migrate-sdk.js.map +1 -0
  628. package/dist/src/migrations/add-csp-nonce-import/add-csp-nonce-import.d.ts +2 -0
  629. package/dist/src/migrations/add-csp-nonce-import/add-csp-nonce-import.js +40 -0
  630. package/dist/src/migrations/add-csp-nonce-import/add-csp-nonce-import.js.map +1 -0
  631. package/dist/src/migrations/add-executor-peers/add-executor-peers.d.ts +6 -0
  632. package/dist/src/migrations/add-executor-peers/add-executor-peers.js +21 -0
  633. package/dist/src/migrations/add-executor-peers/add-executor-peers.js.map +1 -0
  634. package/dist/src/migrations/add-lib-build-dependencies/add-lib-build-dependencies.d.ts +7 -0
  635. package/dist/src/migrations/add-lib-build-dependencies/add-lib-build-dependencies.js +47 -0
  636. package/dist/src/migrations/add-lib-build-dependencies/add-lib-build-dependencies.js.map +1 -0
  637. package/dist/src/migrations/add-lint-dependencies/add-lint-dependencies.d.ts +6 -0
  638. package/dist/src/migrations/add-lint-dependencies/add-lint-dependencies.js +27 -0
  639. package/dist/src/migrations/add-lint-dependencies/add-lint-dependencies.js.map +1 -0
  640. package/dist/src/migrations/add-lint-staged-config/add-lint-staged-config.d.ts +7 -0
  641. package/dist/src/migrations/add-lint-staged-config/add-lint-staged-config.js +22 -0
  642. package/dist/src/migrations/add-lint-staged-config/add-lint-staged-config.js.map +1 -0
  643. package/dist/src/migrations/angular-release-target/angular-release-target.d.ts +3 -0
  644. package/dist/src/migrations/angular-release-target/angular-release-target.js +80 -0
  645. package/dist/src/migrations/angular-release-target/angular-release-target.js.map +1 -0
  646. package/dist/src/migrations/app-clean-and-port/app-clean-and-port.d.ts +7 -0
  647. package/dist/src/migrations/app-clean-and-port/app-clean-and-port.js +89 -0
  648. package/dist/src/migrations/app-clean-and-port/app-clean-and-port.js.map +1 -0
  649. package/dist/src/migrations/env-encryption-config/env-encryption-config.d.ts +7 -0
  650. package/dist/src/migrations/env-encryption-config/env-encryption-config.js +42 -0
  651. package/dist/src/migrations/env-encryption-config/env-encryption-config.js.map +1 -0
  652. package/dist/src/migrations/env-encryption-key-sources/env-encryption-key-sources.d.ts +3 -0
  653. package/dist/src/migrations/env-encryption-key-sources/env-encryption-key-sources.js +15 -0
  654. package/dist/src/migrations/env-encryption-key-sources/env-encryption-key-sources.js.map +1 -0
  655. package/dist/src/migrations/fix-lint-script/fix-lint-script.d.ts +7 -0
  656. package/dist/src/migrations/fix-lint-script/fix-lint-script.js +27 -0
  657. package/dist/src/migrations/fix-lint-script/fix-lint-script.js.map +1 -0
  658. package/dist/src/migrations/flutter-web-platform/flutter-web-platform.d.ts +8 -0
  659. package/dist/src/migrations/flutter-web-platform/flutter-web-platform.js +35 -0
  660. package/dist/src/migrations/flutter-web-platform/flutter-web-platform.js.map +1 -0
  661. package/dist/src/migrations/plugin-repo-dev/plugin-repo-dev.d.ts +9 -0
  662. package/dist/src/migrations/plugin-repo-dev/plugin-repo-dev.js +42 -0
  663. package/dist/src/migrations/plugin-repo-dev/plugin-repo-dev.js.map +1 -0
  664. package/dist/src/migrations/prepush-audit-warn-only/prepush-audit-warn-only.d.ts +8 -0
  665. package/dist/src/migrations/prepush-audit-warn-only/prepush-audit-warn-only.js +30 -0
  666. package/dist/src/migrations/prepush-audit-warn-only/prepush-audit-warn-only.js.map +1 -0
  667. package/dist/src/migrations/quality-checks/quality-checks.d.ts +7 -0
  668. package/dist/src/migrations/quality-checks/quality-checks.js +46 -0
  669. package/dist/src/migrations/quality-checks/quality-checks.js.map +1 -0
  670. package/dist/src/migrations/release-hardening/release-hardening.d.ts +8 -0
  671. package/dist/src/migrations/release-hardening/release-hardening.js +98 -0
  672. package/dist/src/migrations/release-hardening/release-hardening.js.map +1 -0
  673. package/dist/src/migrations/sharp-security-update/sharp-security-update.d.ts +10 -0
  674. package/dist/src/migrations/sharp-security-update/sharp-security-update.js +40 -0
  675. package/dist/src/migrations/sharp-security-update/sharp-security-update.js.map +1 -0
  676. package/migrate/package.json +5 -0
  677. package/package.json +120 -4
  678. package/runtime/csp-nonce.js +109 -0
  679. package/runtime/env-secret.d.ts +63 -0
  680. 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,G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CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBAC7C,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG;oBAAE,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;;oBAChD,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;aACtB;SACF;KACF;IACD,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;IAC1B,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACtF,OAAO,IAAI,CAAC;AACd,CAAC;AAlED,4CAkEC"}
@@ -0,0 +1,3 @@
1
+ import type { Detection } from '../adapters/types';
2
+ export declare const SUPPORTED_NX_MAJORS: number[];
3
+ export declare function detectNxWorkspace(sourceDir: string): Detection;
@@ -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,CA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AAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aACpC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;aAClC,IAAI,CAAC,IAAI,CAAC,EAAE,CACpB,CAAC;IACF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,kCAAe,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;QAClD,UAAU,GAAG,IAAI,CAAC,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