@nx/angular 16.8.0-beta.3 → 16.8.0-beta.5

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 (220) hide show
  1. package/mf/mf.js +31 -36
  2. package/migrations.json +9 -0
  3. package/package.json +11 -11
  4. package/plugins/component-testing.js +82 -44
  5. package/src/builders/module-federation-dev-server/module-federation-dev-server.impl.js +4 -6
  6. package/src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl.js +4 -6
  7. package/src/builders/utilities/buildable-libs.js +1 -2
  8. package/src/builders/utilities/module-federation.js +2 -3
  9. package/src/builders/utilities/webpack.js +16 -21
  10. package/src/builders/webpack-browser/webpack-browser.impl.js +13 -13
  11. package/src/builders/webpack-dev-server/lib/normalize-options.js +8 -1
  12. package/src/builders/webpack-dev-server/webpack-dev-server.impl.js +24 -18
  13. package/src/builders/webpack-server/webpack-server.impl.js +5 -7
  14. package/src/executors/browser-esbuild/browser-esbuild.impl.js +19 -23
  15. package/src/executors/browser-esbuild/lib/buildable-libs.js +1 -2
  16. package/src/executors/delegate-build/delegate-build.impl.js +9 -12
  17. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +4 -7
  18. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.transform.js +4 -5
  19. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-package.transform.js +158 -156
  20. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/options.di.js +6 -3
  21. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.js +118 -118
  22. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/styles/stylesheet-processor.js +96 -103
  23. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ts/cache-compiler-host.js +20 -12
  24. package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.js +18 -21
  25. package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +6 -9
  26. package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.js +6 -3
  27. package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +122 -122
  28. package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +96 -103
  29. package/src/executors/package/ng-packagr-adjustments/ts/cache-compiler-host.js +21 -13
  30. package/src/executors/package/ng-packagr-adjustments/utils/ng-compiler-cli.js +5 -8
  31. package/src/executors/package/package.impl.js +33 -38
  32. package/src/executors/utilities/angular-version-utils.js +1 -1
  33. package/src/executors/utilities/tailwindcss.js +2 -2
  34. package/src/executors/utilities/typescript.js +23 -28
  35. package/src/generators/add-linting/add-linting.js +76 -69
  36. package/src/generators/add-linting/lib/add-angular-eslint-dependencies.js +2 -0
  37. package/src/generators/add-linting/lib/create-eslint-configuration.js +12 -4
  38. package/src/generators/application/application.js +56 -55
  39. package/src/generators/application/lib/add-e2e.js +36 -40
  40. package/src/generators/application/lib/add-linting.js +12 -15
  41. package/src/generators/application/lib/add-proxy-config.js +4 -1
  42. package/src/generators/application/lib/add-unit-test-runner.js +15 -18
  43. package/src/generators/application/lib/create-files.js +44 -47
  44. package/src/generators/application/lib/enable-strict-type-checking.js +2 -2
  45. package/src/generators/application/lib/normalize-options.js +37 -25
  46. package/src/generators/application/lib/set-app-strict-default.js +1 -2
  47. package/src/generators/application/lib/update-editor-tsconfig.js +1 -2
  48. package/src/generators/component/component.js +40 -43
  49. package/src/generators/component/lib/normalize-options.js +15 -5
  50. package/src/generators/component-cypress-spec/component-cypress-spec.js +25 -28
  51. package/src/generators/component-story/component-story.js +19 -22
  52. package/src/generators/convert-to-with-mf/convert-to-with-mf.js +19 -22
  53. package/src/generators/convert-to-with-mf/lib/get-webpack-config-path.js +3 -4
  54. package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js +103 -106
  55. package/src/generators/cypress-component-configuration/cypress-component-configuration.js +59 -62
  56. package/src/generators/directive/directive.js +21 -24
  57. package/src/generators/directive/lib/normalize-options.js +11 -5
  58. package/src/generators/host/files/src/main.server.ts__tmpl__ +1 -1
  59. package/src/generators/host/host.js +77 -67
  60. package/src/generators/host/lib/add-ssr.js +32 -33
  61. package/src/generators/init/init.js +101 -92
  62. package/src/generators/library/lib/add-standalone-component.js +18 -13
  63. package/src/generators/library/lib/enable-strict-type-checking.js +17 -5
  64. package/src/generators/library/lib/normalize-options.js +68 -53
  65. package/src/generators/library/library.js +89 -92
  66. package/src/generators/library-secondary-entry-point/lib/add-files.js +5 -1
  67. package/src/generators/library-secondary-entry-point/lib/normalize-options.js +6 -3
  68. package/src/generators/library-secondary-entry-point/lib/update-linting-file-patterns.js +1 -2
  69. package/src/generators/library-secondary-entry-point/library-secondary-entry-point.js +6 -9
  70. package/src/generators/move/lib/normalize-schema.js +5 -1
  71. package/src/generators/move/lib/update-module-name.js +1 -1
  72. package/src/generators/move/lib/update-ng-package.js +1 -2
  73. package/src/generators/move/lib/update-secondary-entry-points.js +1 -2
  74. package/src/generators/move/move.js +9 -12
  75. package/src/generators/ng-add/migrate-from-angular-cli.js +54 -53
  76. package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +4 -3
  77. package/src/generators/ng-add/migrators/builders/angular-devkit-ng-packagr.migrator.js +11 -12
  78. package/src/generators/ng-add/migrators/builders/angular-eslint-lint.migrator.js +39 -42
  79. package/src/generators/ng-add/migrators/builders/builder.migrator.js +1 -2
  80. package/src/generators/ng-add/migrators/migrator.js +7 -11
  81. package/src/generators/ng-add/migrators/projects/app.migrator.js +39 -43
  82. package/src/generators/ng-add/migrators/projects/e2e.migrator.js +115 -91
  83. package/src/generators/ng-add/migrators/projects/lib.migrator.js +23 -31
  84. package/src/generators/ng-add/migrators/projects/project.migrator.js +10 -14
  85. package/src/generators/ng-add/ng-add.js +5 -8
  86. package/src/generators/ng-add/utilities/dependencies.js +2 -3
  87. package/src/generators/ng-add/utilities/format-files-task.js +1 -1
  88. package/src/generators/ng-add/utilities/projects.js +1 -1
  89. package/src/generators/ng-add/utilities/workspace.js +25 -36
  90. package/src/generators/ngrx/lib/add-imports-to-module.js +1 -2
  91. package/src/generators/ngrx/lib/add-ngrx-to-package-json.js +1 -3
  92. package/src/generators/ngrx/lib/generate-files.js +11 -2
  93. package/src/generators/ngrx/lib/normalize-options.js +9 -4
  94. package/src/generators/ngrx/lib/validate-options.js +3 -3
  95. package/src/generators/ngrx/ngrx.js +18 -21
  96. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.actions.ts__tmpl__ +1 -1
  97. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.effects.spec.ts__tmpl__ +2 -2
  98. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.effects.ts__tmpl__ +2 -2
  99. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.facade.spec.ts__tmpl__ +6 -6
  100. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.facade.ts__tmpl__ +3 -3
  101. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.reducer.spec.ts__tmpl__ +3 -3
  102. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.reducer.ts__tmpl__ +2 -2
  103. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.selectors.spec.ts__tmpl__ +3 -3
  104. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.selectors.ts__tmpl__ +1 -1
  105. package/src/generators/ngrx-feature-store/files/no-inject/__directory__/__fileName__.effects.ts__tmpl__ +2 -2
  106. package/src/generators/ngrx-feature-store/files/no-inject/__directory__/__fileName__.facade.ts__tmpl__ +3 -3
  107. package/src/generators/ngrx-feature-store/lib/add-exports-barrel.js +4 -1
  108. package/src/generators/ngrx-feature-store/lib/add-imports.js +1 -1
  109. package/src/generators/ngrx-feature-store/lib/add-ngrx-to-package-json.js +1 -3
  110. package/src/generators/ngrx-feature-store/lib/generate-files.js +20 -4
  111. package/src/generators/ngrx-feature-store/lib/normalize-options.d.ts +1 -0
  112. package/src/generators/ngrx-feature-store/lib/normalize-options.js +22 -3
  113. package/src/generators/ngrx-feature-store/lib/validate-options.js +2 -2
  114. package/src/generators/ngrx-feature-store/ngrx-feature-store.js +18 -21
  115. package/src/generators/ngrx-root-store/lib/add-ngrx-to-package-json.js +8 -6
  116. package/src/generators/ngrx-root-store/lib/normalize-options.js +8 -4
  117. package/src/generators/ngrx-root-store/lib/validate-options.js +2 -2
  118. package/src/generators/ngrx-root-store/ngrx-root-store.js +27 -30
  119. package/src/generators/pipe/lib/normalize-options.js +9 -3
  120. package/src/generators/pipe/pipe.js +21 -24
  121. package/src/generators/remote/files/base/src/main.server.ts__tmpl__ +2 -2
  122. package/src/generators/remote/lib/add-ssr.js +46 -43
  123. package/src/generators/remote/lib/find-next-available-port.js +1 -2
  124. package/src/generators/remote/remote.js +52 -49
  125. package/src/generators/scam/lib/convert-component-to-scam.js +1 -2
  126. package/src/generators/scam/lib/normalize-options.js +11 -4
  127. package/src/generators/scam/scam.js +15 -12
  128. package/src/generators/scam-directive/lib/normalize-options.js +12 -4
  129. package/src/generators/scam-directive/scam-directive.js +13 -10
  130. package/src/generators/scam-pipe/lib/normalize-options.js +12 -4
  131. package/src/generators/scam-pipe/scam-pipe.js +13 -10
  132. package/src/generators/scam-to-standalone/scam-to-standalone.js +23 -26
  133. package/src/generators/setup-mf/lib/add-cypress-workaround.js +1 -1
  134. package/src/generators/setup-mf/lib/add-remote-to-host.js +4 -1
  135. package/src/generators/setup-mf/lib/change-build-target.js +10 -4
  136. package/src/generators/setup-mf/lib/generate-config.js +1 -1
  137. package/src/generators/setup-mf/lib/get-remotes-with-ports.js +1 -2
  138. package/src/generators/setup-mf/lib/normalize-options.js +5 -2
  139. package/src/generators/setup-mf/lib/set-tsconfig-target.js +7 -1
  140. package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +1 -2
  141. package/src/generators/setup-mf/lib/setup-serve-target.js +10 -3
  142. package/src/generators/setup-mf/setup-mf.js +32 -35
  143. package/src/generators/setup-ssr/lib/generate-files.js +8 -5
  144. package/src/generators/setup-ssr/lib/normalize-options.js +9 -10
  145. package/src/generators/setup-ssr/lib/update-project-config.js +21 -17
  146. package/src/generators/setup-ssr/setup-ssr.js +26 -27
  147. package/src/generators/setup-tailwind/lib/add-tailwind-config-path-to-project.js +6 -4
  148. package/src/generators/setup-tailwind/lib/detect-tailwind-installed-version.js +1 -2
  149. package/src/generators/setup-tailwind/lib/normalize-options.js +4 -1
  150. package/src/generators/setup-tailwind/lib/update-application-styles.js +5 -6
  151. package/src/generators/setup-tailwind/setup-tailwind.js +20 -23
  152. package/src/generators/stories/lib/get-e2e-project.js +1 -1
  153. package/src/generators/stories/stories.js +43 -50
  154. package/src/generators/storybook-configuration/lib/assert-compatible-storybook-version.js +1 -1
  155. package/src/generators/storybook-configuration/lib/generate-stories.js +10 -13
  156. package/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +12 -15
  157. package/src/generators/storybook-configuration/storybook-configuration.js +20 -16
  158. package/src/generators/utils/create-ts-config.js +1 -1
  159. package/src/generators/utils/entry-point.js +1 -2
  160. package/src/generators/utils/export-scam.js +1 -1
  161. package/src/generators/utils/insert-ngmodule-import.js +1 -1
  162. package/src/generators/utils/path.js +3 -3
  163. package/src/generators/utils/project.js +2 -3
  164. package/src/generators/utils/selector.js +1 -1
  165. package/src/generators/utils/storybook-ast/component-info.js +1 -2
  166. package/src/generators/utils/storybook-ast/entry-point.js +1 -2
  167. package/src/generators/utils/storybook-ast/module-info.js +1 -2
  168. package/src/generators/utils/storybook-ast/tree-utilities.js +1 -1
  169. package/src/generators/utils/testing.js +141 -138
  170. package/src/generators/utils/validations.js +1 -1
  171. package/src/generators/utils/version-utils.js +5 -7
  172. package/src/generators/web-worker/lib/normalize-options.js +6 -3
  173. package/src/generators/web-worker/web-worker.js +25 -28
  174. package/src/migrations/update-14-2-0/remove-show-circular-dependencies-option.js +10 -13
  175. package/src/migrations/update-14-2-0/update-angular-cli.js +14 -18
  176. package/src/migrations/update-14-2-0/update-libraries-secondary-entrypoints.js +22 -26
  177. package/src/migrations/update-14-2-0/update-ngcc-target.js +10 -14
  178. package/src/migrations/update-14-2-0/update-router-initial-navigation.js +31 -39
  179. package/src/migrations/update-14-2-0/update-tsconfig-target.js +48 -56
  180. package/src/migrations/update-14-5-0/migrate-mfe-to-mf.js +14 -17
  181. package/src/migrations/update-14-5-2/update-angular-cli.js +14 -18
  182. package/src/migrations/update-14-6-0/update-angular-cli.js +14 -18
  183. package/src/migrations/update-15-0-0/add-karma-inputs.js +27 -32
  184. package/src/migrations/update-15-0-0/switch-to-jasmine-marbles.js +62 -68
  185. package/src/migrations/update-15-2-0/remove-browserlist-config.js +34 -37
  186. package/src/migrations/update-15-2-0/remove-platform-server-exports.js +49 -52
  187. package/src/migrations/update-15-2-0/update-angular-cli.js +14 -18
  188. package/src/migrations/update-15-2-0/update-karma-main-file.js +11 -12
  189. package/src/migrations/update-15-2-0/update-typescript-target.js +40 -39
  190. package/src/migrations/update-15-2-0/update-workspace-config.js +16 -19
  191. package/src/migrations/update-15-5-0/update-angular-cli.js +14 -18
  192. package/src/migrations/update-15-7-0/install-required-packages.js +26 -28
  193. package/src/migrations/update-15-8-0/update-angular-cli.js +14 -18
  194. package/src/migrations/update-15-9-0/update-file-server-executor.js +31 -35
  195. package/src/migrations/update-15-9-0/update-testing-tsconfig.js +17 -22
  196. package/src/migrations/update-16-0-0/remove-karma-defaults.js +15 -18
  197. package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.js +22 -25
  198. package/src/migrations/update-16-0-0/remove-protractor-defaults.js +15 -18
  199. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +3 -6
  200. package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.js +38 -42
  201. package/src/migrations/update-16-1-0/remove-ngcc-invocation.js +15 -19
  202. package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +49 -52
  203. package/src/migrations/update-16-1-0/update-angular-cli.js +14 -18
  204. package/src/migrations/update-16-1-0/update-server-executor-config.js +13 -16
  205. package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +25 -29
  206. package/src/migrations/update-16-4-0/rename-angular-eslint-accesibility-rules.js +13 -16
  207. package/src/migrations/update-16-4-0/update-angular-cli.js +14 -18
  208. package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.js +19 -24
  209. package/src/migrations/update-16-7-0/update-angular-cli.js +14 -18
  210. package/src/migrations/utils/projects.js +9 -15
  211. package/src/utils/backward-compatible-versions.js +2 -0
  212. package/src/utils/get-mf-projects.js +1 -2
  213. package/src/utils/mf/utils.js +43 -44
  214. package/src/utils/mf/with-module-federation-ssr.js +39 -24
  215. package/src/utils/mf/with-module-federation.js +40 -21
  216. package/src/utils/nx-devkit/ast-utils.js +2 -3
  217. package/src/utils/nx-devkit/testing.js +9 -9
  218. package/src/utils/version-utils.js +2 -4
  219. package/src/utils/versions.d.ts +1 -0
  220. package/src/utils/versions.js +2 -1
@@ -9,7 +9,6 @@
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.compileSourceFiles = void 0;
12
- const tslib_1 = require("tslib");
13
12
  const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
14
13
  const cache_compiler_host_1 = require("ng-packagr/lib/ts/cache-compiler-host");
15
14
  const log = require("ng-packagr/lib/utils/log");
@@ -17,134 +16,135 @@ const ng_compiler_cli_1 = require("ng-packagr/lib/utils/ng-compiler-cli");
17
16
  const ts = require("typescript");
18
17
  const angular_version_utils_1 = require("../../../utilities/angular-version-utils");
19
18
  const cache_compiler_host_2 = require("../ts/cache-compiler-host");
20
- function compileSourceFiles(graph, tsConfig, moduleResolutionCache, extraOptions, stylesheetProcessor, watch) {
21
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
- const { NgtscProgram, formatDiagnostics } = yield (0, ng_compiler_cli_1.ngCompilerCli)();
23
- const tsConfigOptions = Object.assign(Object.assign({}, tsConfig.options), extraOptions);
24
- const entryPoint = graph.find((0, nodes_1.isEntryPointInProgress)());
25
- const ngPackageNode = graph.find(nodes_1.isPackage);
26
- const inlineStyleLanguage = ngPackageNode.data.inlineStyleLanguage;
27
- const tsCompilerHost = (0, cache_compiler_host_2.cacheCompilerHost)(graph, entryPoint, tsConfigOptions, moduleResolutionCache, stylesheetProcessor, inlineStyleLanguage);
28
- const cache = entryPoint.cache;
29
- const sourceFileCache = cache.sourcesFileCache;
30
- // Create the Angular specific program that contains the Angular compiler
31
- const angularProgram = new NgtscProgram(tsConfig.rootNames, tsConfigOptions, tsCompilerHost, cache.oldNgtscProgram);
32
- const angularCompiler = angularProgram.compiler;
33
- const { ignoreForDiagnostics, ignoreForEmit } = angularCompiler;
34
- // SourceFile versions are required for builder programs.
35
- // The wrapped host inside NgtscProgram adds additional files that will not have versions.
36
- const typeScriptProgram = angularProgram.getTsProgram();
37
- (0, cache_compiler_host_1.augmentProgramWithVersioning)(typeScriptProgram);
38
- let builder;
39
- if (watch) {
40
- builder = cache.oldBuilder =
41
- ts.createEmitAndSemanticDiagnosticsBuilderProgram(typeScriptProgram, tsCompilerHost, cache.oldBuilder);
42
- cache.oldNgtscProgram = angularProgram;
43
- }
44
- else {
45
- // When not in watch mode, the startup cost of the incremental analysis can be avoided by
46
- // using an abstract builder that only wraps a TypeScript program.
47
- builder = ts.createAbstractBuilder(typeScriptProgram, tsCompilerHost);
48
- }
49
- // Update semantic diagnostics cache
50
- const affectedFiles = new Set();
51
- // Analyze affected files when in watch mode for incremental type checking
52
- if ('getSemanticDiagnosticsOfNextAffectedFile' in builder) {
53
- // eslint-disable-next-line no-constant-condition
54
- while (true) {
55
- const result = builder.getSemanticDiagnosticsOfNextAffectedFile(undefined, (sourceFile) => {
56
- // If the affected file is a TTC shim, add the shim's original source file.
57
- // This ensures that changes that affect TTC are typechecked even when the changes
58
- // are otherwise unrelated from a TS perspective and do not result in Ivy codegen changes.
59
- // For example, changing @Input property types of a directive used in another component's
60
- // template.
61
- if (ignoreForDiagnostics.has(sourceFile) &&
62
- sourceFile.fileName.endsWith('.ngtypecheck.ts')) {
63
- // This file name conversion relies on internal compiler logic and should be converted
64
- // to an official method when available. 15 is length of `.ngtypecheck.ts`
65
- const originalFilename = sourceFile.fileName.slice(0, -15) + '.ts';
66
- const originalSourceFile = builder.getSourceFile(originalFilename);
67
- if (originalSourceFile) {
68
- affectedFiles.add(originalSourceFile);
69
- }
70
- return true;
19
+ async function compileSourceFiles(graph, tsConfig, moduleResolutionCache, extraOptions, stylesheetProcessor, watch) {
20
+ const { NgtscProgram, formatDiagnostics } = await (0, ng_compiler_cli_1.ngCompilerCli)();
21
+ const tsConfigOptions = {
22
+ ...tsConfig.options,
23
+ ...extraOptions,
24
+ };
25
+ const entryPoint = graph.find((0, nodes_1.isEntryPointInProgress)());
26
+ const ngPackageNode = graph.find(nodes_1.isPackage);
27
+ const inlineStyleLanguage = ngPackageNode.data.inlineStyleLanguage;
28
+ const tsCompilerHost = (0, cache_compiler_host_2.cacheCompilerHost)(graph, entryPoint, tsConfigOptions, moduleResolutionCache, stylesheetProcessor, inlineStyleLanguage);
29
+ const cache = entryPoint.cache;
30
+ const sourceFileCache = cache.sourcesFileCache;
31
+ // Create the Angular specific program that contains the Angular compiler
32
+ const angularProgram = new NgtscProgram(tsConfig.rootNames, tsConfigOptions, tsCompilerHost, cache.oldNgtscProgram);
33
+ const angularCompiler = angularProgram.compiler;
34
+ const { ignoreForDiagnostics, ignoreForEmit } = angularCompiler;
35
+ // SourceFile versions are required for builder programs.
36
+ // The wrapped host inside NgtscProgram adds additional files that will not have versions.
37
+ const typeScriptProgram = angularProgram.getTsProgram();
38
+ (0, cache_compiler_host_1.augmentProgramWithVersioning)(typeScriptProgram);
39
+ let builder;
40
+ if (watch) {
41
+ builder = cache.oldBuilder =
42
+ ts.createEmitAndSemanticDiagnosticsBuilderProgram(typeScriptProgram, tsCompilerHost, cache.oldBuilder);
43
+ cache.oldNgtscProgram = angularProgram;
44
+ }
45
+ else {
46
+ // When not in watch mode, the startup cost of the incremental analysis can be avoided by
47
+ // using an abstract builder that only wraps a TypeScript program.
48
+ builder = ts.createAbstractBuilder(typeScriptProgram, tsCompilerHost);
49
+ }
50
+ // Update semantic diagnostics cache
51
+ const affectedFiles = new Set();
52
+ // Analyze affected files when in watch mode for incremental type checking
53
+ if ('getSemanticDiagnosticsOfNextAffectedFile' in builder) {
54
+ // eslint-disable-next-line no-constant-condition
55
+ while (true) {
56
+ const result = builder.getSemanticDiagnosticsOfNextAffectedFile(undefined, (sourceFile) => {
57
+ // If the affected file is a TTC shim, add the shim's original source file.
58
+ // This ensures that changes that affect TTC are typechecked even when the changes
59
+ // are otherwise unrelated from a TS perspective and do not result in Ivy codegen changes.
60
+ // For example, changing @Input property types of a directive used in another component's
61
+ // template.
62
+ if (ignoreForDiagnostics.has(sourceFile) &&
63
+ sourceFile.fileName.endsWith('.ngtypecheck.ts')) {
64
+ // This file name conversion relies on internal compiler logic and should be converted
65
+ // to an official method when available. 15 is length of `.ngtypecheck.ts`
66
+ const originalFilename = sourceFile.fileName.slice(0, -15) + '.ts';
67
+ const originalSourceFile = builder.getSourceFile(originalFilename);
68
+ if (originalSourceFile) {
69
+ affectedFiles.add(originalSourceFile);
71
70
  }
72
- return false;
73
- });
74
- if (!result) {
75
- break;
71
+ return true;
76
72
  }
77
- affectedFiles.add(result.affected);
73
+ return false;
74
+ });
75
+ if (!result) {
76
+ break;
78
77
  }
78
+ affectedFiles.add(result.affected);
79
79
  }
80
- // Collect program level diagnostics
81
- const allDiagnostics = [
82
- ...angularCompiler.getOptionDiagnostics(),
83
- ...builder.getOptionsDiagnostics(),
84
- ...builder.getGlobalDiagnostics(),
85
- ];
86
- // Required to support asynchronous resource loading
87
- // Must be done before creating transformers or getting template diagnostics
88
- yield angularCompiler.analyzeAsync();
89
- // Collect source file specific diagnostics
90
- for (const sourceFile of builder.getSourceFiles()) {
91
- if (!ignoreForDiagnostics.has(sourceFile)) {
92
- allDiagnostics.push(...builder.getDeclarationDiagnostics(sourceFile), ...builder.getSyntacticDiagnostics(sourceFile), ...builder.getSemanticDiagnostics(sourceFile));
93
- }
94
- if (sourceFile.isDeclarationFile) {
95
- continue;
96
- }
97
- // Collect sources that are required to be emitted
98
- const angularVersion = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
99
- const incrementalCompilation = angularVersion.major < 16
100
- ? angularCompiler.incrementalDriver
101
- : angularCompiler.incrementalCompilation;
102
- if (!ignoreForEmit.has(sourceFile) &&
103
- !incrementalCompilation.safeToSkipEmit(sourceFile)) {
104
- // If required to emit, diagnostics may have also changed
105
- if (!ignoreForDiagnostics.has(sourceFile)) {
106
- affectedFiles.add(sourceFile);
107
- }
108
- }
109
- else if (sourceFileCache &&
110
- !affectedFiles.has(sourceFile) &&
111
- !ignoreForDiagnostics.has(sourceFile)) {
112
- // Use cached Angular diagnostics for unchanged and unaffected files
113
- const angularDiagnostics = sourceFileCache.getAngularDiagnostics(sourceFile);
114
- if (angularDiagnostics === null || angularDiagnostics === void 0 ? void 0 : angularDiagnostics.length) {
115
- allDiagnostics.push(...angularDiagnostics);
116
- }
117
- }
80
+ }
81
+ // Collect program level diagnostics
82
+ const allDiagnostics = [
83
+ ...angularCompiler.getOptionDiagnostics(),
84
+ ...builder.getOptionsDiagnostics(),
85
+ ...builder.getGlobalDiagnostics(),
86
+ ];
87
+ // Required to support asynchronous resource loading
88
+ // Must be done before creating transformers or getting template diagnostics
89
+ await angularCompiler.analyzeAsync();
90
+ // Collect source file specific diagnostics
91
+ for (const sourceFile of builder.getSourceFiles()) {
92
+ if (!ignoreForDiagnostics.has(sourceFile)) {
93
+ allDiagnostics.push(...builder.getDeclarationDiagnostics(sourceFile), ...builder.getSyntacticDiagnostics(sourceFile), ...builder.getSemanticDiagnostics(sourceFile));
118
94
  }
119
- // Collect new Angular diagnostics for files affected by changes
120
- for (const affectedFile of affectedFiles) {
121
- const angularDiagnostics = angularCompiler.getDiagnosticsForFile(affectedFile,
122
- /** OptimizeFor.WholeProgram */ 1);
123
- allDiagnostics.push(...angularDiagnostics);
124
- sourceFileCache.updateAngularDiagnostics(affectedFile, angularDiagnostics);
95
+ if (sourceFile.isDeclarationFile) {
96
+ continue;
125
97
  }
126
- const otherDiagnostics = [];
127
- const errorDiagnostics = [];
128
- for (const diagnostic of allDiagnostics) {
129
- if (diagnostic.category === ts.DiagnosticCategory.Error) {
130
- errorDiagnostics.push(diagnostic);
98
+ // Collect sources that are required to be emitted
99
+ const angularVersion = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
100
+ const incrementalCompilation = angularVersion.major < 16
101
+ ? angularCompiler.incrementalDriver
102
+ : angularCompiler.incrementalCompilation;
103
+ if (!ignoreForEmit.has(sourceFile) &&
104
+ !incrementalCompilation.safeToSkipEmit(sourceFile)) {
105
+ // If required to emit, diagnostics may have also changed
106
+ if (!ignoreForDiagnostics.has(sourceFile)) {
107
+ affectedFiles.add(sourceFile);
131
108
  }
132
- else {
133
- otherDiagnostics.push(diagnostic);
109
+ }
110
+ else if (sourceFileCache &&
111
+ !affectedFiles.has(sourceFile) &&
112
+ !ignoreForDiagnostics.has(sourceFile)) {
113
+ // Use cached Angular diagnostics for unchanged and unaffected files
114
+ const angularDiagnostics = sourceFileCache.getAngularDiagnostics(sourceFile);
115
+ if (angularDiagnostics?.length) {
116
+ allDiagnostics.push(...angularDiagnostics);
134
117
  }
135
118
  }
136
- if (otherDiagnostics.length) {
137
- log.msg(formatDiagnostics(errorDiagnostics));
119
+ }
120
+ // Collect new Angular diagnostics for files affected by changes
121
+ for (const affectedFile of affectedFiles) {
122
+ const angularDiagnostics = angularCompiler.getDiagnosticsForFile(affectedFile,
123
+ /** OptimizeFor.WholeProgram */ 1);
124
+ allDiagnostics.push(...angularDiagnostics);
125
+ sourceFileCache.updateAngularDiagnostics(affectedFile, angularDiagnostics);
126
+ }
127
+ const otherDiagnostics = [];
128
+ const errorDiagnostics = [];
129
+ for (const diagnostic of allDiagnostics) {
130
+ if (diagnostic.category === ts.DiagnosticCategory.Error) {
131
+ errorDiagnostics.push(diagnostic);
138
132
  }
139
- if (errorDiagnostics.length) {
140
- throw new Error(formatDiagnostics(errorDiagnostics));
133
+ else {
134
+ otherDiagnostics.push(diagnostic);
141
135
  }
142
- const transformers = angularCompiler.prepareEmit().transformers;
143
- for (const sourceFile of builder.getSourceFiles()) {
144
- if (!ignoreForEmit.has(sourceFile)) {
145
- builder.emit(sourceFile, undefined, undefined, undefined, transformers);
146
- }
136
+ }
137
+ if (otherDiagnostics.length) {
138
+ log.msg(formatDiagnostics(errorDiagnostics));
139
+ }
140
+ if (errorDiagnostics.length) {
141
+ throw new Error(formatDiagnostics(errorDiagnostics));
142
+ }
143
+ const transformers = angularCompiler.prepareEmit().transformers;
144
+ for (const sourceFile of builder.getSourceFiles()) {
145
+ if (!ignoreForEmit.has(sourceFile)) {
146
+ builder.emit(sourceFile, undefined, undefined, undefined, transformers);
147
147
  }
148
- });
148
+ }
149
149
  }
150
150
  exports.compileSourceFiles = compileSourceFiles;
@@ -10,7 +10,6 @@
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.StylesheetProcessor = exports.InlineStyleLanguage = exports.CssUrl = void 0;
13
- const tslib_1 = require("tslib");
14
13
  const browserslist = require("browserslist");
15
14
  const fs_1 = require("fs");
16
15
  const esbuild_executor_1 = require("ng-packagr/lib/esbuild/esbuild-executor");
@@ -72,82 +71,78 @@ class StylesheetProcessor {
72
71
  this.tailwindSetup = (0, tailwindcss_1.getTailwindSetup)(this.basePath, this.tailwindConfig);
73
72
  this.postCssProcessor = this.createPostCssPlugins();
74
73
  }
75
- process({ filePath, content, }) {
76
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
77
- let key;
78
- if (this.cacheDirectory &&
79
- !content.includes('@import') &&
80
- !content.includes('@use') &&
81
- !this.containsTailwindDirectives(content)) {
82
- // No transitive deps and no Tailwind directives, we can cache more aggressively.
83
- key = yield (0, cache_1.generateKey)(content, ...this.browserslistData, filePath);
84
- const result = yield (0, cache_1.readCacheEntry)(this.cacheDirectory, key);
85
- if (result) {
86
- result.warnings.forEach((msg) => log.warn(msg));
87
- return result.css;
88
- }
74
+ async process({ filePath, content, }) {
75
+ let key;
76
+ if (this.cacheDirectory &&
77
+ !content.includes('@import') &&
78
+ !content.includes('@use') &&
79
+ !this.containsTailwindDirectives(content)) {
80
+ // No transitive deps and no Tailwind directives, we can cache more aggressively.
81
+ key = await (0, cache_1.generateKey)(content, ...this.browserslistData, filePath);
82
+ const result = await (0, cache_1.readCacheEntry)(this.cacheDirectory, key);
83
+ if (result) {
84
+ result.warnings.forEach((msg) => log.warn(msg));
85
+ return result.css;
89
86
  }
90
- // Render pre-processor language (sass, styl, less)
91
- const renderedCss = yield this.renderCss(filePath, content);
92
- let containsTailwindDirectives = false;
93
- if (this.cacheDirectory) {
94
- containsTailwindDirectives = this.containsTailwindDirectives(renderedCss);
95
- if (!containsTailwindDirectives) {
96
- // No Tailwind directives to process by PostCSS, we can return cached results
97
- if (!key) {
98
- key = yield (0, cache_1.generateKey)(renderedCss, ...this.browserslistData, filePath);
99
- }
100
- const cachedResult = yield this.getCachedResult(key);
101
- if (cachedResult) {
102
- return cachedResult;
103
- }
87
+ }
88
+ // Render pre-processor language (sass, styl, less)
89
+ const renderedCss = await this.renderCss(filePath, content);
90
+ let containsTailwindDirectives = false;
91
+ if (this.cacheDirectory) {
92
+ containsTailwindDirectives = this.containsTailwindDirectives(renderedCss);
93
+ if (!containsTailwindDirectives) {
94
+ // No Tailwind directives to process by PostCSS, we can return cached results
95
+ if (!key) {
96
+ key = await (0, cache_1.generateKey)(renderedCss, ...this.browserslistData, filePath);
104
97
  }
105
- }
106
- // Render postcss (autoprefixing and friends)
107
- const result = yield this.postCssProcessor.process(renderedCss, {
108
- from: filePath,
109
- to: filePath.replace((0, path_1.extname)(filePath), '.css'),
110
- });
111
- if (this.cacheDirectory && containsTailwindDirectives) {
112
- // We had Tailwind directives to process by PostCSS, only now
113
- // is safe to return cached results
114
- key = yield (0, cache_1.generateKey)(result.css, ...this.browserslistData, filePath);
115
- const cachedResult = yield this.getCachedResult(key);
98
+ const cachedResult = await this.getCachedResult(key);
116
99
  if (cachedResult) {
117
100
  return cachedResult;
118
101
  }
119
102
  }
120
- const warnings = result.warnings().map((w) => w.toString());
121
- const { code, warnings: esBuildWarnings } = yield this.esbuild.transform(result.css, {
122
- loader: 'css',
123
- minify: true,
124
- target: this.targets,
125
- sourcefile: filePath,
126
- });
127
- if (esBuildWarnings.length > 0) {
128
- warnings.push(...(yield this.esbuild.formatMessages(esBuildWarnings, {
129
- kind: 'warning',
130
- })));
131
- }
132
- if (this.cacheDirectory) {
133
- yield (0, cache_1.saveCacheEntry)(this.cacheDirectory, key, JSON.stringify({
134
- css: code,
135
- warnings,
136
- }));
137
- }
138
- warnings.forEach((msg) => log.warn(msg));
139
- return code;
103
+ }
104
+ // Render postcss (autoprefixing and friends)
105
+ const result = await this.postCssProcessor.process(renderedCss, {
106
+ from: filePath,
107
+ to: filePath.replace((0, path_1.extname)(filePath), '.css'),
140
108
  });
141
- }
142
- getCachedResult(key) {
143
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
144
- const cachedResult = yield (0, cache_1.readCacheEntry)(this.cacheDirectory, key);
109
+ if (this.cacheDirectory && containsTailwindDirectives) {
110
+ // We had Tailwind directives to process by PostCSS, only now
111
+ // is safe to return cached results
112
+ key = await (0, cache_1.generateKey)(result.css, ...this.browserslistData, filePath);
113
+ const cachedResult = await this.getCachedResult(key);
145
114
  if (cachedResult) {
146
- cachedResult.warnings.forEach((msg) => log.warn(msg));
147
- return cachedResult.css;
115
+ return cachedResult;
148
116
  }
149
- return undefined;
117
+ }
118
+ const warnings = result.warnings().map((w) => w.toString());
119
+ const { code, warnings: esBuildWarnings } = await this.esbuild.transform(result.css, {
120
+ loader: 'css',
121
+ minify: true,
122
+ target: this.targets,
123
+ sourcefile: filePath,
150
124
  });
125
+ if (esBuildWarnings.length > 0) {
126
+ warnings.push(...(await this.esbuild.formatMessages(esBuildWarnings, {
127
+ kind: 'warning',
128
+ })));
129
+ }
130
+ if (this.cacheDirectory) {
131
+ await (0, cache_1.saveCacheEntry)(this.cacheDirectory, key, JSON.stringify({
132
+ css: code,
133
+ warnings,
134
+ }));
135
+ }
136
+ warnings.forEach((msg) => log.warn(msg));
137
+ return code;
138
+ }
139
+ async getCachedResult(key) {
140
+ const cachedResult = await (0, cache_1.readCacheEntry)(this.cacheDirectory, key);
141
+ if (cachedResult) {
142
+ cachedResult.warnings.forEach((msg) => log.warn(msg));
143
+ return cachedResult.css;
144
+ }
145
+ return undefined;
151
146
  }
152
147
  containsTailwindDirectives(content) {
153
148
  return (this.tailwindSetup && tailwindcss_1.tailwindDirectives.some((d) => content.includes(d)));
@@ -167,46 +162,44 @@ class StylesheetProcessor {
167
162
  }));
168
163
  return postcss(postCssPlugins);
169
164
  }
170
- renderCss(filePath, css) {
171
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
172
- const ext = (0, path_1.extname)(filePath);
173
- switch (ext) {
174
- case '.sass':
175
- case '.scss': {
176
- const angularVersion = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
177
- if (angularVersion && angularVersion.major < 15) {
178
- return (yield Promise.resolve().then(() => require('sass')))
179
- .renderSync({
180
- file: filePath,
181
- data: css,
182
- indentedSyntax: '.sass' === ext,
183
- importer: customSassImporter,
184
- includePaths: this.styleIncludePaths,
185
- })
186
- .css.toString();
187
- }
188
- return (yield Promise.resolve().then(() => require('sass')))
189
- .compileString(css, {
190
- url: (0, node_url_1.pathToFileURL)(filePath),
191
- syntax: '.sass' === ext ? 'indented' : 'scss',
192
- loadPaths: this.styleIncludePaths,
165
+ async renderCss(filePath, css) {
166
+ const ext = (0, path_1.extname)(filePath);
167
+ switch (ext) {
168
+ case '.sass':
169
+ case '.scss': {
170
+ const angularVersion = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
171
+ if (angularVersion && angularVersion.major < 15) {
172
+ return (await Promise.resolve().then(() => require('sass')))
173
+ .renderSync({
174
+ file: filePath,
175
+ data: css,
176
+ indentedSyntax: '.sass' === ext,
177
+ importer: customSassImporter,
178
+ includePaths: this.styleIncludePaths,
193
179
  })
194
180
  .css.toString();
195
181
  }
196
- case '.less': {
197
- const { css: content } = yield (yield Promise.resolve().then(() => require('less'))).render(css, {
198
- filename: filePath,
199
- math: 'always',
200
- javascriptEnabled: true,
201
- paths: this.styleIncludePaths,
202
- });
203
- return content;
204
- }
205
- case '.css':
206
- default:
207
- return css;
182
+ return (await Promise.resolve().then(() => require('sass')))
183
+ .compileString(css, {
184
+ url: (0, node_url_1.pathToFileURL)(filePath),
185
+ syntax: '.sass' === ext ? 'indented' : 'scss',
186
+ loadPaths: this.styleIncludePaths,
187
+ })
188
+ .css.toString();
208
189
  }
209
- });
190
+ case '.less': {
191
+ const { css: content } = await (await Promise.resolve().then(() => require('less'))).render(css, {
192
+ filename: filePath,
193
+ math: 'always',
194
+ javascriptEnabled: true,
195
+ paths: this.styleIncludePaths,
196
+ });
197
+ return content;
198
+ }
199
+ case '.css':
200
+ default:
201
+ return css;
202
+ }
210
203
  }
211
204
  }
212
205
  exports.StylesheetProcessor = StylesheetProcessor;
@@ -7,7 +7,6 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.augmentProgramWithVersioning = exports.cacheCompilerHost = void 0;
10
- const tslib_1 = require("tslib");
11
10
  const crypto_1 = require("crypto");
12
11
  const node_1 = require("ng-packagr/lib/graph/node");
13
12
  const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
@@ -33,7 +32,8 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
33
32
  const flatModuleFileDtsFilename = `${flatModuleFile}.d.ts`;
34
33
  const flatModuleFileDtsPath = (0, path_1.ensureUnixPath)(path.join(destinationPath, flatModuleFileDtsFilename));
35
34
  const hasIndexEntryFile = path.basename(entryFile.toLowerCase()) === 'index.ts';
36
- return Object.assign(Object.assign({}, compilerHost), {
35
+ return {
36
+ ...compilerHost,
37
37
  // ts specific
38
38
  fileExists: (fileName) => {
39
39
  const cache = sourcesFileCache.getOrCreate(fileName);
@@ -41,14 +41,16 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
41
41
  cache.exists = compilerHost.fileExists.call(this, fileName);
42
42
  }
43
43
  return cache.exists;
44
- }, getSourceFile: (fileName, languageVersion) => {
44
+ },
45
+ getSourceFile: (fileName, languageVersion) => {
45
46
  addDependee(fileName);
46
47
  const cache = sourcesFileCache.getOrCreate(fileName);
47
48
  if (!cache.sourceFile) {
48
49
  cache.sourceFile = compilerHost.getSourceFile.call(this, fileName, languageVersion);
49
50
  }
50
51
  return cache.sourceFile;
51
- }, writeFile: (fileName, data, writeByteOrderMark, onError, sourceFiles) => {
52
+ },
53
+ writeFile: (fileName, data, writeByteOrderMark, onError, sourceFiles) => {
52
54
  if (fileName.endsWith('.d.ts')) {
53
55
  if (fileName === flatModuleFileDtsPath) {
54
56
  if (hasIndexEntryFile) {
@@ -78,25 +80,29 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
78
80
  });
79
81
  }
80
82
  compilerHost.writeFile.call(this, fileName, data, writeByteOrderMark, onError, sourceFiles);
81
- }, readFile: (fileName) => {
83
+ },
84
+ readFile: (fileName) => {
82
85
  addDependee(fileName);
83
86
  const cache = sourcesFileCache.getOrCreate(fileName);
84
87
  if (cache.content === undefined) {
85
88
  cache.content = compilerHost.readFile.call(this, fileName);
86
89
  }
87
90
  return cache.content;
88
- }, resolveModuleNames: (moduleNames, containingFile) => {
91
+ },
92
+ resolveModuleNames: (moduleNames, containingFile) => {
89
93
  return moduleNames.map((moduleName) => {
90
94
  const { resolvedModule } = ts.resolveModuleName(moduleName, (0, path_1.ensureUnixPath)(containingFile), compilerOptions, compilerHost, moduleResolutionCache);
91
95
  return resolvedModule;
92
96
  });
93
- }, resourceNameToFileName: (resourceName, containingFilePath) => {
97
+ },
98
+ resourceNameToFileName: (resourceName, containingFilePath) => {
94
99
  const resourcePath = path.resolve(path.dirname(containingFilePath), resourceName);
95
100
  const containingNode = getNode(containingFilePath);
96
101
  const resourceNode = getNode(resourcePath);
97
102
  containingNode.dependsOn(resourceNode);
98
103
  return resourcePath;
99
- }, readResource: (fileName) => tslib_1.__awaiter(this, void 0, void 0, function* () {
104
+ },
105
+ readResource: async (fileName) => {
100
106
  addDependee(fileName);
101
107
  const cache = sourcesFileCache.getOrCreate(fileName);
102
108
  if (cache.content === undefined) {
@@ -109,7 +115,7 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
109
115
  }
110
116
  else {
111
117
  // stylesheet
112
- cache.content = yield stylesheetProcessor.process({
118
+ cache.content = await stylesheetProcessor.process({
113
119
  filePath: fileName,
114
120
  content: compilerHost.readFile.call(this, fileName),
115
121
  });
@@ -117,7 +123,8 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
117
123
  cache.exists = true;
118
124
  }
119
125
  return cache.content;
120
- }), transformResource: (data, context) => tslib_1.__awaiter(this, void 0, void 0, function* () {
126
+ },
127
+ transformResource: async (data, context) => {
121
128
  if (context.resourceFile || context.type !== 'style') {
122
129
  return null;
123
130
  }
@@ -126,7 +133,7 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
126
133
  const fileName = `${context.containingFile}-${key}.${inlineStyleLanguage}`;
127
134
  const cache = sourcesFileCache.getOrCreate(fileName);
128
135
  if (cache.content === undefined) {
129
- cache.content = yield stylesheetProcessor.process({
136
+ cache.content = await stylesheetProcessor.process({
130
137
  filePath: context.containingFile,
131
138
  content: data,
132
139
  });
@@ -138,7 +145,8 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
138
145
  return { content: cache.content };
139
146
  }
140
147
  return null;
141
- }) });
148
+ },
149
+ };
142
150
  }
143
151
  exports.cacheCompilerHost = cacheCompilerHost;
144
152
  function augmentProgramWithVersioning(program) {