@angular-devkit/build-angular 18.0.0-next.2 → 18.0.0-next.4

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 (249) hide show
  1. package/builders.json +1 -5
  2. package/package.json +21 -20
  3. package/src/builders/app-shell/index.js +3 -5
  4. package/src/builders/browser/index.d.ts +1 -1
  5. package/src/builders/browser/index.js +9 -13
  6. package/src/builders/browser-esbuild/index.d.ts +2 -2
  7. package/src/builders/browser-esbuild/index.js +6 -9
  8. package/src/builders/dev-server/builder.d.ts +2 -2
  9. package/src/builders/dev-server/builder.js +11 -6
  10. package/src/builders/dev-server/index.d.ts +1 -1
  11. package/src/builders/dev-server/webpack-server.d.ts +1 -1
  12. package/src/builders/dev-server/webpack-server.js +5 -6
  13. package/src/builders/extract-i18n/application-extraction.js +2 -2
  14. package/src/builders/extract-i18n/builder.js +3 -4
  15. package/src/builders/extract-i18n/options.d.ts +1 -1
  16. package/src/builders/extract-i18n/options.js +2 -2
  17. package/src/builders/jest/index.js +2 -2
  18. package/src/builders/karma/index.js +3 -4
  19. package/src/builders/ng-packagr/index.js +8 -7
  20. package/src/builders/ng-packagr/schema.d.ts +4 -0
  21. package/src/builders/ng-packagr/schema.json +4 -0
  22. package/src/builders/prerender/index.js +2 -2
  23. package/src/builders/prerender/render-worker.js +1 -1
  24. package/src/builders/server/index.js +3 -4
  25. package/src/builders/server/platform-server-exports-loader.js +2 -1
  26. package/src/builders/ssr-dev-server/index.js +34 -34
  27. package/src/builders/web-test-runner/index.js +2 -2
  28. package/src/index.d.ts +1 -1
  29. package/src/index.js +2 -2
  30. package/src/tools/babel/presets/application.js +1 -1
  31. package/src/tools/webpack/configs/styles.js +2 -2
  32. package/src/tools/webpack/plugins/any-component-style-budget-checker.d.ts +2 -2
  33. package/src/tools/webpack/plugins/any-component-style-budget-checker.js +14 -17
  34. package/src/tools/webpack/plugins/css-optimizer-plugin.js +2 -2
  35. package/src/tools/webpack/plugins/index-html-webpack-plugin.d.ts +1 -1
  36. package/src/tools/webpack/plugins/index-html-webpack-plugin.js +3 -3
  37. package/src/tools/webpack/plugins/javascript-optimizer-plugin.js +2 -2
  38. package/src/tools/webpack/plugins/service-worker-plugin.js +2 -2
  39. package/src/tools/webpack/utils/stats.d.ts +1 -14
  40. package/src/tools/webpack/utils/stats.js +3 -207
  41. package/src/utils/action-executor.d.ts +1 -1
  42. package/src/utils/i18n-inlining.d.ts +1 -1
  43. package/src/utils/i18n-webpack.d.ts +16 -0
  44. package/src/utils/i18n-webpack.js +107 -0
  45. package/src/utils/index.d.ts +1 -2
  46. package/src/utils/index.js +4 -2
  47. package/src/utils/normalize-builder-schema.js +2 -2
  48. package/src/utils/normalize-cache.js +1 -1
  49. package/src/utils/normalize-optimization.d.ts +1 -1
  50. package/src/utils/normalize-optimization.js +0 -2
  51. package/src/utils/output-paths.d.ts +1 -1
  52. package/src/utils/webpack-browser-config.d.ts +1 -1
  53. package/src/utils/webpack-browser-config.js +2 -2
  54. package/src/builders/application/build-action.d.ts +0 -33
  55. package/src/builders/application/build-action.js +0 -183
  56. package/src/builders/application/execute-build.d.ts +0 -11
  57. package/src/builders/application/execute-build.js +0 -127
  58. package/src/builders/application/execute-post-bundle.d.ts +0 -25
  59. package/src/builders/application/execute-post-bundle.js +0 -96
  60. package/src/builders/application/i18n.d.ts +0 -29
  61. package/src/builders/application/i18n.js +0 -128
  62. package/src/builders/application/index.d.ts +0 -57
  63. package/src/builders/application/index.js +0 -121
  64. package/src/builders/application/options.d.ts +0 -149
  65. package/src/builders/application/options.js +0 -352
  66. package/src/builders/application/schema.d.ts +0 -512
  67. package/src/builders/application/schema.js +0 -58
  68. package/src/builders/application/schema.json +0 -635
  69. package/src/builders/application/setup-bundling.d.ts +0 -19
  70. package/src/builders/application/setup-bundling.js +0 -71
  71. package/src/builders/dev-server/vite-server.d.ts +0 -30
  72. package/src/builders/dev-server/vite-server.js +0 -502
  73. package/src/tools/babel/plugins/adjust-static-class-members.d.ts +0 -27
  74. package/src/tools/babel/plugins/adjust-static-class-members.js +0 -351
  75. package/src/tools/babel/plugins/adjust-typescript-enums.d.ts +0 -23
  76. package/src/tools/babel/plugins/adjust-typescript-enums.js +0 -113
  77. package/src/tools/babel/plugins/elide-angular-metadata.d.ts +0 -23
  78. package/src/tools/babel/plugins/elide-angular-metadata.js +0 -110
  79. package/src/tools/babel/plugins/index.d.ts +0 -11
  80. package/src/tools/babel/plugins/index.js +0 -21
  81. package/src/tools/babel/plugins/pure-toplevel-functions.d.ts +0 -16
  82. package/src/tools/babel/plugins/pure-toplevel-functions.js +0 -90
  83. package/src/tools/esbuild/angular/angular-host.d.ts +0 -26
  84. package/src/tools/esbuild/angular/angular-host.js +0 -72
  85. package/src/tools/esbuild/angular/compilation/angular-compilation.d.ts +0 -42
  86. package/src/tools/esbuild/angular/compilation/angular-compilation.js +0 -94
  87. package/src/tools/esbuild/angular/compilation/aot-compilation.d.ts +0 -21
  88. package/src/tools/esbuild/angular/compilation/aot-compilation.js +0 -228
  89. package/src/tools/esbuild/angular/compilation/factory.d.ts +0 -16
  90. package/src/tools/esbuild/angular/compilation/factory.js +0 -56
  91. package/src/tools/esbuild/angular/compilation/index.d.ts +0 -10
  92. package/src/tools/esbuild/angular/compilation/index.js +0 -17
  93. package/src/tools/esbuild/angular/compilation/jit-compilation.d.ts +0 -21
  94. package/src/tools/esbuild/angular/compilation/jit-compilation.js +0 -106
  95. package/src/tools/esbuild/angular/compilation/noop-compilation.d.ts +0 -20
  96. package/src/tools/esbuild/angular/compilation/noop-compilation.js +0 -26
  97. package/src/tools/esbuild/angular/compilation/parallel-compilation.d.ts +0 -42
  98. package/src/tools/esbuild/angular/compilation/parallel-compilation.js +0 -123
  99. package/src/tools/esbuild/angular/compilation/parallel-worker.d.ts +0 -33
  100. package/src/tools/esbuild/angular/compilation/parallel-worker.js +0 -90
  101. package/src/tools/esbuild/angular/compilation-state.d.ts +0 -15
  102. package/src/tools/esbuild/angular/compilation-state.js +0 -44
  103. package/src/tools/esbuild/angular/compiler-plugin.d.ts +0 -27
  104. package/src/tools/esbuild/angular/compiler-plugin.js +0 -433
  105. package/src/tools/esbuild/angular/component-stylesheets.d.ts +0 -44
  106. package/src/tools/esbuild/angular/component-stylesheets.js +0 -150
  107. package/src/tools/esbuild/angular/diagnostics.d.ts +0 -15
  108. package/src/tools/esbuild/angular/diagnostics.js +0 -69
  109. package/src/tools/esbuild/angular/file-reference-tracker.d.ts +0 -17
  110. package/src/tools/esbuild/angular/file-reference-tracker.js +0 -57
  111. package/src/tools/esbuild/angular/jit-plugin-callbacks.d.ts +0 -23
  112. package/src/tools/esbuild/angular/jit-plugin-callbacks.js +0 -117
  113. package/src/tools/esbuild/angular/jit-resource-transformer.d.ts +0 -17
  114. package/src/tools/esbuild/angular/jit-resource-transformer.js +0 -186
  115. package/src/tools/esbuild/angular/source-file-cache.d.ts +0 -18
  116. package/src/tools/esbuild/angular/source-file-cache.js +0 -65
  117. package/src/tools/esbuild/angular/uri.d.ts +0 -54
  118. package/src/tools/esbuild/angular/uri.js +0 -74
  119. package/src/tools/esbuild/angular/web-worker-transformer.d.ts +0 -17
  120. package/src/tools/esbuild/angular/web-worker-transformer.js +0 -94
  121. package/src/tools/esbuild/application-code-bundle.d.ts +0 -20
  122. package/src/tools/esbuild/application-code-bundle.js +0 -368
  123. package/src/tools/esbuild/budget-stats.d.ts +0 -19
  124. package/src/tools/esbuild/budget-stats.js +0 -59
  125. package/src/tools/esbuild/bundler-context.d.ts +0 -75
  126. package/src/tools/esbuild/bundler-context.js +0 -366
  127. package/src/tools/esbuild/bundler-execution-result.d.ts +0 -71
  128. package/src/tools/esbuild/bundler-execution-result.js +0 -131
  129. package/src/tools/esbuild/cache.d.ts +0 -88
  130. package/src/tools/esbuild/cache.js +0 -92
  131. package/src/tools/esbuild/commonjs-checker.d.ts +0 -28
  132. package/src/tools/esbuild/commonjs-checker.js +0 -151
  133. package/src/tools/esbuild/compiler-plugin-options.d.ts +0 -16
  134. package/src/tools/esbuild/compiler-plugin-options.js +0 -49
  135. package/src/tools/esbuild/external-packages-plugin.d.ts +0 -18
  136. package/src/tools/esbuild/external-packages-plugin.js +0 -70
  137. package/src/tools/esbuild/global-scripts.d.ts +0 -16
  138. package/src/tools/esbuild/global-scripts.js +0 -142
  139. package/src/tools/esbuild/global-styles.d.ts +0 -10
  140. package/src/tools/esbuild/global-styles.js +0 -74
  141. package/src/tools/esbuild/i18n-inliner-worker.d.ts +0 -42
  142. package/src/tools/esbuild/i18n-inliner-worker.js +0 -136
  143. package/src/tools/esbuild/i18n-inliner.d.ts +0 -44
  144. package/src/tools/esbuild/i18n-inliner.js +0 -150
  145. package/src/tools/esbuild/i18n-locale-plugin.d.ts +0 -22
  146. package/src/tools/esbuild/i18n-locale-plugin.js +0 -120
  147. package/src/tools/esbuild/index-html-generator.d.ts +0 -15
  148. package/src/tools/esbuild/index-html-generator.js +0 -129
  149. package/src/tools/esbuild/javascript-transformer-worker.d.ts +0 -19
  150. package/src/tools/esbuild/javascript-transformer-worker.js +0 -154
  151. package/src/tools/esbuild/javascript-transformer.d.ts +0 -54
  152. package/src/tools/esbuild/javascript-transformer.js +0 -143
  153. package/src/tools/esbuild/license-extractor.d.ts +0 -25
  154. package/src/tools/esbuild/license-extractor.js +0 -158
  155. package/src/tools/esbuild/load-result-cache.d.ts +0 -21
  156. package/src/tools/esbuild/load-result-cache.js +0 -75
  157. package/src/tools/esbuild/profiling.d.ts +0 -11
  158. package/src/tools/esbuild/profiling.js +0 -78
  159. package/src/tools/esbuild/rxjs-esm-resolution-plugin.d.ts +0 -18
  160. package/src/tools/esbuild/rxjs-esm-resolution-plugin.js +0 -44
  161. package/src/tools/esbuild/sourcemap-ignorelist-plugin.d.ts +0 -17
  162. package/src/tools/esbuild/sourcemap-ignorelist-plugin.js +0 -73
  163. package/src/tools/esbuild/stylesheets/bundle-options.d.ts +0 -35
  164. package/src/tools/esbuild/stylesheets/bundle-options.js +0 -64
  165. package/src/tools/esbuild/stylesheets/css-inline-fonts-plugin.d.ts +0 -25
  166. package/src/tools/esbuild/stylesheets/css-inline-fonts-plugin.js +0 -57
  167. package/src/tools/esbuild/stylesheets/css-language.d.ts +0 -9
  168. package/src/tools/esbuild/stylesheets/css-language.js +0 -15
  169. package/src/tools/esbuild/stylesheets/css-resource-plugin.d.ts +0 -18
  170. package/src/tools/esbuild/stylesheets/css-resource-plugin.js +0 -107
  171. package/src/tools/esbuild/stylesheets/less-language.d.ts +0 -9
  172. package/src/tools/esbuild/stylesheets/less-language.js +0 -155
  173. package/src/tools/esbuild/stylesheets/sass-language.d.ts +0 -10
  174. package/src/tools/esbuild/stylesheets/sass-language.js +0 -185
  175. package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.d.ts +0 -58
  176. package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.js +0 -282
  177. package/src/tools/esbuild/utils.d.ts +0 -41
  178. package/src/tools/esbuild/utils.js +0 -378
  179. package/src/tools/esbuild/virtual-module-plugin.d.ts +0 -33
  180. package/src/tools/esbuild/virtual-module-plugin.js +0 -43
  181. package/src/tools/esbuild/watcher.d.ts +0 -25
  182. package/src/tools/esbuild/watcher.js +0 -118
  183. package/src/tools/sass/lexer.d.ts +0 -18
  184. package/src/tools/sass/lexer.js +0 -161
  185. package/src/tools/sass/rebasing-importer.d.ts +0 -101
  186. package/src/tools/sass/rebasing-importer.js +0 -337
  187. package/src/tools/sass/sass-service.d.ts +0 -49
  188. package/src/tools/sass/sass-service.js +0 -213
  189. package/src/tools/sass/worker.d.ts +0 -8
  190. package/src/tools/sass/worker.js +0 -164
  191. package/src/tools/vite/angular-memory-plugin.d.ts +0 -24
  192. package/src/tools/vite/angular-memory-plugin.js +0 -268
  193. package/src/tools/vite/i18n-locale-plugin.d.ts +0 -18
  194. package/src/tools/vite/i18n-locale-plugin.js +0 -55
  195. package/src/typings.d.ts +0 -21
  196. package/src/utils/bundle-calculator.d.ts +0 -44
  197. package/src/utils/bundle-calculator.js +0 -302
  198. package/src/utils/check-port.d.ts +0 -8
  199. package/src/utils/check-port.js +0 -58
  200. package/src/utils/delete-output-dir.d.ts +0 -11
  201. package/src/utils/delete-output-dir.js +0 -46
  202. package/src/utils/i18n-options.d.ts +0 -40
  203. package/src/utils/i18n-options.js +0 -254
  204. package/src/utils/index-file/augment-index-html.d.ts +0 -40
  205. package/src/utils/index-file/augment-index-html.js +0 -238
  206. package/src/utils/index-file/html-rewriting-stream.d.ts +0 -11
  207. package/src/utils/index-file/html-rewriting-stream.js +0 -28
  208. package/src/utils/index-file/index-html-generator.d.ts +0 -47
  209. package/src/utils/index-file/index-html-generator.js +0 -119
  210. package/src/utils/index-file/inline-critical-css.d.ts +0 -24
  211. package/src/utils/index-file/inline-critical-css.js +0 -179
  212. package/src/utils/index-file/inline-fonts.d.ts +0 -23
  213. package/src/utils/index-file/inline-fonts.js +0 -267
  214. package/src/utils/index-file/style-nonce.d.ts +0 -12
  215. package/src/utils/index-file/style-nonce.js +0 -53
  216. package/src/utils/load-proxy-config.d.ts +0 -8
  217. package/src/utils/load-proxy-config.js +0 -192
  218. package/src/utils/load-translations.d.ts +0 -16
  219. package/src/utils/load-translations.js +0 -84
  220. package/src/utils/postcss-configuration.d.ts +0 -17
  221. package/src/utils/postcss-configuration.js +0 -86
  222. package/src/utils/purge-cache.d.ts +0 -10
  223. package/src/utils/purge-cache.js +0 -40
  224. package/src/utils/routes-extractor/extractor.d.ts +0 -15
  225. package/src/utils/routes-extractor/extractor.js +0 -97
  226. package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.d.ts +0 -18
  227. package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.js +0 -129
  228. package/src/utils/server-rendering/esm-in-memory-loader/register-hooks.d.ts +0 -8
  229. package/src/utils/server-rendering/esm-in-memory-loader/register-hooks.js +0 -13
  230. package/src/utils/server-rendering/fetch-patch.d.ts +0 -8
  231. package/src/utils/server-rendering/fetch-patch.js +0 -66
  232. package/src/utils/server-rendering/load-esm-from-memory.d.ts +0 -10
  233. package/src/utils/server-rendering/load-esm-from-memory.js +0 -26
  234. package/src/utils/server-rendering/main-bundle-exports.d.ts +0 -27
  235. package/src/utils/server-rendering/main-bundle-exports.js +0 -9
  236. package/src/utils/server-rendering/prerender.d.ts +0 -23
  237. package/src/utils/server-rendering/prerender.js +0 -192
  238. package/src/utils/server-rendering/render-page.d.ts +0 -26
  239. package/src/utils/server-rendering/render-page.js +0 -110
  240. package/src/utils/server-rendering/render-worker.d.ts +0 -22
  241. package/src/utils/server-rendering/render-worker.js +0 -30
  242. package/src/utils/server-rendering/routes-extractor-worker.d.ts +0 -21
  243. package/src/utils/server-rendering/routes-extractor-worker.js +0 -53
  244. package/src/utils/service-worker.d.ts +0 -25
  245. package/src/utils/service-worker.js +0 -211
  246. package/src/utils/supported-browsers.d.ts +0 -10
  247. package/src/utils/supported-browsers.js +0 -42
  248. package/src/utils/version.d.ts +0 -8
  249. package/src/utils/version.js +0 -59
@@ -1,158 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- var __importDefault = (this && this.__importDefault) || function (mod) {
10
- return (mod && mod.__esModule) ? mod : { "default": mod };
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.extractLicenses = void 0;
14
- const promises_1 = require("node:fs/promises");
15
- const node_path_1 = __importDefault(require("node:path"));
16
- /**
17
- * The path segment used to signify that a file is part of a package.
18
- */
19
- const NODE_MODULE_SEGMENT = 'node_modules';
20
- /**
21
- * String constant for the NPM recommended custom license wording.
22
- *
23
- * See: https://docs.npmjs.com/cli/v9/configuring-npm/package-json#license
24
- *
25
- * Example:
26
- * ```
27
- * {
28
- * "license" : "SEE LICENSE IN <filename>"
29
- * }
30
- * ```
31
- */
32
- const CUSTOM_LICENSE_TEXT = 'SEE LICENSE IN ';
33
- /**
34
- * A list of commonly named license files found within packages.
35
- */
36
- const LICENSE_FILES = ['LICENSE', 'LICENSE.txt', 'LICENSE.md'];
37
- /**
38
- * Header text that will be added to the top of the output license extraction file.
39
- */
40
- const EXTRACTION_FILE_HEADER = '';
41
- /**
42
- * The package entry separator to use within the output license extraction file.
43
- */
44
- const EXTRACTION_FILE_SEPARATOR = '-'.repeat(80) + '\n';
45
- /**
46
- * Extracts license information for each node module package included in the output
47
- * files of the built code. This includes JavaScript and CSS output files. The esbuild
48
- * metafile generated during the bundling steps is used as the source of information
49
- * regarding what input files where included and where they are located. A path segment
50
- * of `node_modules` is used to indicate that a file belongs to a package and its license
51
- * should be include in the output licenses file.
52
- *
53
- * The package name and license field are extracted from the `package.json` file for the
54
- * package. If a license file (e.g., `LICENSE`) is present in the root of the package, it
55
- * will also be included in the output licenses file.
56
- *
57
- * @param metafile An esbuild metafile object.
58
- * @param rootDirectory The root directory of the workspace.
59
- * @returns A string containing the content of the output licenses file.
60
- */
61
- async function extractLicenses(metafile, rootDirectory) {
62
- let extractedLicenseContent = `${EXTRACTION_FILE_HEADER}\n${EXTRACTION_FILE_SEPARATOR}`;
63
- const seenPaths = new Set();
64
- const seenPackages = new Set();
65
- for (const entry of Object.values(metafile.outputs)) {
66
- for (const [inputPath, { bytesInOutput }] of Object.entries(entry.inputs)) {
67
- // Skip if not included in output
68
- if (bytesInOutput <= 0) {
69
- continue;
70
- }
71
- // Skip already processed paths
72
- if (seenPaths.has(inputPath)) {
73
- continue;
74
- }
75
- seenPaths.add(inputPath);
76
- // Skip non-package paths
77
- if (!inputPath.includes(NODE_MODULE_SEGMENT)) {
78
- continue;
79
- }
80
- // Extract the package name from the path
81
- let baseDirectory = node_path_1.default.join(rootDirectory, inputPath);
82
- let nameOrScope, nameOrFile;
83
- let found = false;
84
- while (baseDirectory !== node_path_1.default.dirname(baseDirectory)) {
85
- const segment = node_path_1.default.basename(baseDirectory);
86
- if (segment === NODE_MODULE_SEGMENT) {
87
- found = true;
88
- break;
89
- }
90
- nameOrFile = nameOrScope;
91
- nameOrScope = segment;
92
- baseDirectory = node_path_1.default.dirname(baseDirectory);
93
- }
94
- // Skip non-package path edge cases that are not caught in the includes check above
95
- if (!found || !nameOrScope) {
96
- continue;
97
- }
98
- const packageName = nameOrScope.startsWith('@')
99
- ? `${nameOrScope}/${nameOrFile}`
100
- : nameOrScope;
101
- const packageDirectory = node_path_1.default.join(baseDirectory, packageName);
102
- // Load the package's metadata to find the package's name, version, and license type
103
- const packageJsonPath = node_path_1.default.join(packageDirectory, 'package.json');
104
- let packageJson;
105
- try {
106
- packageJson = JSON.parse(await (0, promises_1.readFile)(packageJsonPath, 'utf-8'));
107
- }
108
- catch {
109
- // Invalid package
110
- continue;
111
- }
112
- // Skip already processed packages
113
- const packageId = `${packageName}@${packageJson.version}`;
114
- if (seenPackages.has(packageId)) {
115
- continue;
116
- }
117
- seenPackages.add(packageId);
118
- // Attempt to find license text inside package
119
- let licenseText = '';
120
- if (typeof packageJson.license === 'string' &&
121
- packageJson.license.toLowerCase().startsWith(CUSTOM_LICENSE_TEXT)) {
122
- // Attempt to load the package's custom license
123
- let customLicensePath;
124
- const customLicenseFile = node_path_1.default.normalize(packageJson.license.slice(CUSTOM_LICENSE_TEXT.length + 1).trim());
125
- if (customLicenseFile.startsWith('..') || node_path_1.default.isAbsolute(customLicenseFile)) {
126
- // Path is attempting to access files outside of the package
127
- // TODO: Issue warning?
128
- }
129
- else {
130
- customLicensePath = node_path_1.default.join(packageDirectory, customLicenseFile);
131
- try {
132
- licenseText = await (0, promises_1.readFile)(customLicensePath, 'utf-8');
133
- break;
134
- }
135
- catch { }
136
- }
137
- }
138
- else {
139
- // Search for a license file within the root of the package
140
- for (const potentialLicense of LICENSE_FILES) {
141
- const packageLicensePath = node_path_1.default.join(packageDirectory, potentialLicense);
142
- try {
143
- licenseText = await (0, promises_1.readFile)(packageLicensePath, 'utf-8');
144
- break;
145
- }
146
- catch { }
147
- }
148
- }
149
- // Generate the package's license entry in the output content
150
- extractedLicenseContent += `Package: ${packageJson.name}\n`;
151
- extractedLicenseContent += `License: ${JSON.stringify(packageJson.license, null, 2)}\n`;
152
- extractedLicenseContent += `\n${licenseText}\n`;
153
- extractedLicenseContent += EXTRACTION_FILE_SEPARATOR;
154
- }
155
- }
156
- return extractedLicenseContent;
157
- }
158
- exports.extractLicenses = extractLicenses;
@@ -1,21 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import type { OnLoadResult, PluginBuild } from 'esbuild';
9
- export interface LoadResultCache {
10
- get(path: string): OnLoadResult | undefined;
11
- put(path: string, result: OnLoadResult): Promise<void>;
12
- readonly watchFiles: ReadonlyArray<string>;
13
- }
14
- export declare function createCachedLoad(cache: LoadResultCache | undefined, callback: Parameters<PluginBuild['onLoad']>[1]): Parameters<PluginBuild['onLoad']>[1];
15
- export declare class MemoryLoadResultCache implements LoadResultCache {
16
- #private;
17
- get(path: string): OnLoadResult | undefined;
18
- put(path: string, result: OnLoadResult): Promise<void>;
19
- invalidate(path: string): boolean;
20
- get watchFiles(): string[];
21
- }
@@ -1,75 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.MemoryLoadResultCache = exports.createCachedLoad = void 0;
11
- const node_path_1 = require("node:path");
12
- function createCachedLoad(cache, callback) {
13
- if (cache === undefined) {
14
- return callback;
15
- }
16
- return async (args) => {
17
- const loadCacheKey = `${args.namespace}:${args.path}`;
18
- let result = cache.get(loadCacheKey);
19
- if (result === undefined) {
20
- result = await callback(args);
21
- // Do not cache null or undefined
22
- if (result) {
23
- // Ensure requested path is included if it was a resolved file
24
- if (args.namespace === 'file') {
25
- result.watchFiles ??= [];
26
- result.watchFiles.push(args.path);
27
- }
28
- await cache.put(loadCacheKey, result);
29
- }
30
- }
31
- return result;
32
- };
33
- }
34
- exports.createCachedLoad = createCachedLoad;
35
- class MemoryLoadResultCache {
36
- #loadResults = new Map();
37
- #fileDependencies = new Map();
38
- get(path) {
39
- return this.#loadResults.get(path);
40
- }
41
- async put(path, result) {
42
- this.#loadResults.set(path, result);
43
- if (result.watchFiles) {
44
- for (const watchFile of result.watchFiles) {
45
- // Normalize the watch file path to ensure OS consistent paths
46
- const normalizedWatchFile = (0, node_path_1.normalize)(watchFile);
47
- let affected = this.#fileDependencies.get(normalizedWatchFile);
48
- if (affected === undefined) {
49
- affected = new Set();
50
- this.#fileDependencies.set(normalizedWatchFile, affected);
51
- }
52
- affected.add(path);
53
- }
54
- }
55
- }
56
- invalidate(path) {
57
- const affectedPaths = this.#fileDependencies.get(path);
58
- let found = false;
59
- if (affectedPaths) {
60
- for (const affected of affectedPaths) {
61
- if (this.#loadResults.delete(affected)) {
62
- found = true;
63
- }
64
- }
65
- this.#fileDependencies.delete(path);
66
- }
67
- return found;
68
- }
69
- get watchFiles() {
70
- // this.#loadResults.keys() is not included here because the keys
71
- // are namespaced request paths and not disk-based file paths.
72
- return [...this.#fileDependencies.keys()];
73
- }
74
- }
75
- exports.MemoryLoadResultCache = MemoryLoadResultCache;
@@ -1,11 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- export declare function resetCumulativeDurations(): void;
9
- export declare function logCumulativeDurations(): void;
10
- export declare function profileAsync<T>(name: string, action: () => Promise<T>, cumulative?: boolean): Promise<T>;
11
- export declare function profileSync<T>(name: string, action: () => T, cumulative?: boolean): T;
@@ -1,78 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.profileSync = exports.profileAsync = exports.logCumulativeDurations = exports.resetCumulativeDurations = void 0;
11
- const environment_options_1 = require("../../utils/environment-options");
12
- let cumulativeDurations;
13
- function resetCumulativeDurations() {
14
- cumulativeDurations?.clear();
15
- }
16
- exports.resetCumulativeDurations = resetCumulativeDurations;
17
- function logCumulativeDurations() {
18
- if (!environment_options_1.debugPerformance || !cumulativeDurations) {
19
- return;
20
- }
21
- for (const [name, durations] of cumulativeDurations) {
22
- let total = 0;
23
- let min;
24
- let max;
25
- for (const duration of durations) {
26
- total += duration;
27
- if (min === undefined || duration < min) {
28
- min = duration;
29
- }
30
- if (max === undefined || duration > max) {
31
- max = duration;
32
- }
33
- }
34
- const average = total / durations.length;
35
- // eslint-disable-next-line no-console
36
- console.log(`DURATION[${name}]: ${total.toFixed(9)}s [count: ${durations.length}; avg: ${average.toFixed(9)}s; min: ${min?.toFixed(9)}s; max: ${max?.toFixed(9)}s]`);
37
- }
38
- }
39
- exports.logCumulativeDurations = logCumulativeDurations;
40
- function recordDuration(name, startTime, cumulative) {
41
- const duration = Number(process.hrtime.bigint() - startTime) / 10 ** 9;
42
- if (cumulative) {
43
- cumulativeDurations ??= new Map();
44
- const durations = cumulativeDurations.get(name) ?? [];
45
- durations.push(duration);
46
- cumulativeDurations.set(name, durations);
47
- }
48
- else {
49
- // eslint-disable-next-line no-console
50
- console.log(`DURATION[${name}]: ${duration.toFixed(9)}s`);
51
- }
52
- }
53
- async function profileAsync(name, action, cumulative) {
54
- if (!environment_options_1.debugPerformance) {
55
- return action();
56
- }
57
- const startTime = process.hrtime.bigint();
58
- try {
59
- return await action();
60
- }
61
- finally {
62
- recordDuration(name, startTime, cumulative);
63
- }
64
- }
65
- exports.profileAsync = profileAsync;
66
- function profileSync(name, action, cumulative) {
67
- if (!environment_options_1.debugPerformance) {
68
- return action();
69
- }
70
- const startTime = process.hrtime.bigint();
71
- try {
72
- return action();
73
- }
74
- finally {
75
- recordDuration(name, startTime, cumulative);
76
- }
77
- }
78
- exports.profileSync = profileSync;
@@ -1,18 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import type { Plugin } from 'esbuild';
9
- /**
10
- * Creates a plugin that forces ESM resolution of rxjs.
11
- * This is needed as when targeting node, the CJS version is used to the current package conditional exports.
12
- * @see: https://github.com/ReactiveX/rxjs/blob/2947583bb33e97f3db9e6d9f6cea70c62a173060/package.json#L19.
13
- *
14
- * NOTE: This can be removed when and if rxjs adds an import condition that allows ESM usage on Node.js.
15
- *
16
- * @returns An esbuild plugin.
17
- */
18
- export declare function createRxjsEsmResolutionPlugin(): Plugin;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.createRxjsEsmResolutionPlugin = void 0;
11
- const RXJS_ESM_RESOLUTION = Symbol('RXJS_ESM_RESOLUTION');
12
- /**
13
- * Creates a plugin that forces ESM resolution of rxjs.
14
- * This is needed as when targeting node, the CJS version is used to the current package conditional exports.
15
- * @see: https://github.com/ReactiveX/rxjs/blob/2947583bb33e97f3db9e6d9f6cea70c62a173060/package.json#L19.
16
- *
17
- * NOTE: This can be removed when and if rxjs adds an import condition that allows ESM usage on Node.js.
18
- *
19
- * @returns An esbuild plugin.
20
- */
21
- function createRxjsEsmResolutionPlugin() {
22
- return {
23
- name: 'angular-rxjs-resolution',
24
- setup(build) {
25
- build.onResolve({ filter: /^rxjs/ }, async (args) => {
26
- if (args.pluginData?.[RXJS_ESM_RESOLUTION]) {
27
- return null;
28
- }
29
- const { importer, kind, resolveDir, namespace, pluginData = {} } = args;
30
- pluginData[RXJS_ESM_RESOLUTION] = true;
31
- const result = await build.resolve(args.path, {
32
- importer,
33
- kind,
34
- namespace,
35
- pluginData,
36
- resolveDir,
37
- });
38
- result.path = result.path.replace(/([\\/]dist[\\/])cjs([\\/])/, '$1esm$2');
39
- return result;
40
- });
41
- },
42
- };
43
- }
44
- exports.createRxjsEsmResolutionPlugin = createRxjsEsmResolutionPlugin;
@@ -1,17 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import type { Plugin } from 'esbuild';
9
- /**
10
- * Creates an esbuild plugin that updates generated sourcemaps to include the Chrome
11
- * DevTools ignore list extension. All source files that originate from a node modules
12
- * directory are added to the ignore list by this plugin.
13
- *
14
- * For more information, see https://developer.chrome.com/articles/x-google-ignore-list/
15
- * @returns An esbuild plugin.
16
- */
17
- export declare function createSourcemapIgnorelistPlugin(): Plugin;
@@ -1,73 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.createSourcemapIgnorelistPlugin = void 0;
11
- /**
12
- * The field identifier for the sourcemap Chrome Devtools ignore list extension.
13
- *
14
- * Following the naming conventions from https://sourcemaps.info/spec.html#h.ghqpj1ytqjbm
15
- */
16
- const IGNORE_LIST_ID = 'x_google_ignoreList';
17
- /**
18
- * The UTF-8 bytes for the node modules check text used to avoid unnecessary parsing
19
- * of a full source map if not present in the source map data.
20
- */
21
- const NODE_MODULE_BYTES = Buffer.from('node_modules/', 'utf-8');
22
- /**
23
- * Creates an esbuild plugin that updates generated sourcemaps to include the Chrome
24
- * DevTools ignore list extension. All source files that originate from a node modules
25
- * directory are added to the ignore list by this plugin.
26
- *
27
- * For more information, see https://developer.chrome.com/articles/x-google-ignore-list/
28
- * @returns An esbuild plugin.
29
- */
30
- function createSourcemapIgnorelistPlugin() {
31
- return {
32
- name: 'angular-sourcemap-ignorelist',
33
- setup(build) {
34
- if (!build.initialOptions.sourcemap) {
35
- return;
36
- }
37
- build.onEnd((result) => {
38
- if (!result.outputFiles) {
39
- return;
40
- }
41
- for (const file of result.outputFiles) {
42
- // Only process sourcemap files
43
- if (!file.path.endsWith('.map')) {
44
- continue;
45
- }
46
- // Create a Buffer object that shares the memory of the output file contents
47
- const contents = Buffer.from(file.contents.buffer, file.contents.byteOffset, file.contents.byteLength);
48
- // Avoid parsing sourcemaps that have no node modules references
49
- if (!contents.includes(NODE_MODULE_BYTES)) {
50
- continue;
51
- }
52
- const map = JSON.parse(contents.toString('utf-8'));
53
- const ignoreList = [];
54
- // Check and store the index of each source originating from a node modules directory
55
- for (let index = 0; index < map.sources.length; ++index) {
56
- const location = map.sources[index].indexOf('node_modules/');
57
- if (location === 0 || (location > 0 && map.sources[index][location - 1] === '/')) {
58
- ignoreList.push(index);
59
- }
60
- }
61
- // Avoid regenerating the source map if nothing changed
62
- if (ignoreList.length === 0) {
63
- continue;
64
- }
65
- // Update the sourcemap in the output file
66
- map[IGNORE_LIST_ID] = ignoreList;
67
- file.contents = Buffer.from(JSON.stringify(map), 'utf-8');
68
- }
69
- });
70
- },
71
- };
72
- }
73
- exports.createSourcemapIgnorelistPlugin = createSourcemapIgnorelistPlugin;
@@ -1,35 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import type { BuildOptions } from 'esbuild';
9
- import { NormalizedCachedOptions } from '../../../utils/normalize-cache';
10
- import { PostcssConfiguration } from '../../../utils/postcss-configuration';
11
- import { LoadResultCache } from '../load-result-cache';
12
- export interface BundleStylesheetOptions {
13
- workspaceRoot: string;
14
- optimization: boolean;
15
- inlineFonts: boolean;
16
- preserveSymlinks?: boolean;
17
- sourcemap: boolean | 'external' | 'inline' | 'linked';
18
- outputNames: {
19
- bundles: string;
20
- media: string;
21
- };
22
- includePaths?: string[];
23
- externalDependencies?: string[];
24
- target: string[];
25
- tailwindConfiguration?: {
26
- file: string;
27
- package: string;
28
- };
29
- postcssConfiguration?: PostcssConfiguration;
30
- publicPath?: string;
31
- cacheOptions: NormalizedCachedOptions;
32
- }
33
- export declare function createStylesheetBundleOptions(options: BundleStylesheetOptions, cache?: LoadResultCache, inlineComponentData?: Record<string, string>): BuildOptions & {
34
- plugins: NonNullable<BuildOptions['plugins']>;
35
- };
@@ -1,64 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- var __importDefault = (this && this.__importDefault) || function (mod) {
10
- return (mod && mod.__esModule) ? mod : { "default": mod };
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.createStylesheetBundleOptions = void 0;
14
- const node_path_1 = __importDefault(require("node:path"));
15
- const css_inline_fonts_plugin_1 = require("./css-inline-fonts-plugin");
16
- const css_language_1 = require("./css-language");
17
- const css_resource_plugin_1 = require("./css-resource-plugin");
18
- const less_language_1 = require("./less-language");
19
- const sass_language_1 = require("./sass-language");
20
- const stylesheet_plugin_factory_1 = require("./stylesheet-plugin-factory");
21
- function createStylesheetBundleOptions(options, cache, inlineComponentData) {
22
- // Ensure preprocessor include paths are absolute based on the workspace root
23
- const includePaths = options.includePaths?.map((includePath) => node_path_1.default.resolve(options.workspaceRoot, includePath));
24
- const pluginFactory = new stylesheet_plugin_factory_1.StylesheetPluginFactory({
25
- sourcemap: !!options.sourcemap,
26
- includePaths,
27
- inlineComponentData,
28
- tailwindConfiguration: options.tailwindConfiguration,
29
- postcssConfiguration: options.postcssConfiguration,
30
- }, cache);
31
- const plugins = [
32
- pluginFactory.create(sass_language_1.SassStylesheetLanguage),
33
- pluginFactory.create(less_language_1.LessStylesheetLanguage),
34
- pluginFactory.create(css_language_1.CssStylesheetLanguage),
35
- (0, css_resource_plugin_1.createCssResourcePlugin)(cache),
36
- ];
37
- if (options.inlineFonts) {
38
- plugins.push((0, css_inline_fonts_plugin_1.createCssInlineFontsPlugin)({ cache, cacheOptions: options.cacheOptions }));
39
- }
40
- return {
41
- absWorkingDir: options.workspaceRoot,
42
- bundle: true,
43
- entryNames: options.outputNames.bundles,
44
- assetNames: options.outputNames.media,
45
- logLevel: 'silent',
46
- minify: options.optimization,
47
- metafile: true,
48
- sourcemap: options.sourcemap,
49
- outdir: options.workspaceRoot,
50
- write: false,
51
- platform: 'browser',
52
- target: options.target,
53
- preserveSymlinks: options.preserveSymlinks,
54
- external: options.externalDependencies,
55
- publicPath: options.publicPath,
56
- conditions: ['style', 'sass', 'less'],
57
- mainFields: ['style', 'sass'],
58
- // Unlike JS, CSS does not have implicit file extensions in the general case.
59
- // Preprocessor specific behavior is handled in each stylesheet language plugin.
60
- resolveExtensions: [],
61
- plugins,
62
- };
63
- }
64
- exports.createStylesheetBundleOptions = createStylesheetBundleOptions;
@@ -1,25 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import type { Plugin } from 'esbuild';
9
- import { NormalizedCachedOptions } from '../../../utils/normalize-cache';
10
- import { LoadResultCache } from '../load-result-cache';
11
- /**
12
- * Options for the createCssInlineFontsPlugin
13
- * @see createCssInlineFontsPlugin
14
- */
15
- export interface CssInlineFontsPluginOptions {
16
- /** Disk cache normalized options */
17
- cacheOptions?: NormalizedCachedOptions;
18
- /** Load results cache. */
19
- cache?: LoadResultCache;
20
- }
21
- /**
22
- * Creates an esbuild {@link Plugin} that inlines fonts imported via import-rule.
23
- * within the build configuration.
24
- */
25
- export declare function createCssInlineFontsPlugin({ cache, cacheOptions, }: CssInlineFontsPluginOptions): Plugin;