@nx/angular-rspack 0.0.0-pr-32422-a3285be

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 (193) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +98 -0
  3. package/README.md__tpl__ +48 -0
  4. package/dist/lib/config/config-utils/browser-config.d.ts +4 -0
  5. package/dist/lib/config/config-utils/browser-config.d.ts.map +1 -0
  6. package/dist/lib/config/config-utils/browser-config.js +83 -0
  7. package/dist/lib/config/config-utils/common-config.d.ts +3 -0
  8. package/dist/lib/config/config-utils/common-config.d.ts.map +1 -0
  9. package/dist/lib/config/config-utils/common-config.js +144 -0
  10. package/dist/lib/config/config-utils/dev-server-config-utils.d.ts +4 -0
  11. package/dist/lib/config/config-utils/dev-server-config-utils.d.ts.map +1 -0
  12. package/dist/lib/config/config-utils/dev-server-config-utils.js +258 -0
  13. package/dist/lib/config/config-utils/entry-points.d.ts +9 -0
  14. package/dist/lib/config/config-utils/entry-points.d.ts.map +1 -0
  15. package/dist/lib/config/config-utils/entry-points.js +36 -0
  16. package/dist/lib/config/config-utils/get-stats-options.d.ts +3 -0
  17. package/dist/lib/config/config-utils/get-stats-options.d.ts.map +1 -0
  18. package/dist/lib/config/config-utils/get-stats-options.js +39 -0
  19. package/dist/lib/config/config-utils/helpers.d.ts +13 -0
  20. package/dist/lib/config/config-utils/helpers.d.ts.map +1 -0
  21. package/dist/lib/config/config-utils/helpers.js +106 -0
  22. package/dist/lib/config/config-utils/optimization-config.d.ts +5 -0
  23. package/dist/lib/config/config-utils/optimization-config.d.ts.map +1 -0
  24. package/dist/lib/config/config-utils/optimization-config.js +69 -0
  25. package/dist/lib/config/config-utils/server-config.d.ts +4 -0
  26. package/dist/lib/config/config-utils/server-config.d.ts.map +1 -0
  27. package/dist/lib/config/config-utils/server-config.js +92 -0
  28. package/dist/lib/config/config-utils/sourcemap-utils.d.ts +7 -0
  29. package/dist/lib/config/config-utils/sourcemap-utils.d.ts.map +1 -0
  30. package/dist/lib/config/config-utils/sourcemap-utils.js +48 -0
  31. package/dist/lib/config/config-utils/style-config-utils.d.ts +7 -0
  32. package/dist/lib/config/config-utils/style-config-utils.d.ts.map +1 -0
  33. package/dist/lib/config/config-utils/style-config-utils.js +353 -0
  34. package/dist/lib/config/config-utils/user-defined-config-helpers.d.ts +73 -0
  35. package/dist/lib/config/config-utils/user-defined-config-helpers.d.ts.map +1 -0
  36. package/dist/lib/config/config-utils/user-defined-config-helpers.js +23 -0
  37. package/dist/lib/config/create-config.d.ts +11 -0
  38. package/dist/lib/config/create-config.d.ts.map +1 -0
  39. package/dist/lib/config/create-config.js +35 -0
  40. package/dist/lib/config/i18n/create-i18n-options.d.ts +6 -0
  41. package/dist/lib/config/i18n/create-i18n-options.d.ts.map +1 -0
  42. package/dist/lib/config/i18n/create-i18n-options.js +124 -0
  43. package/dist/lib/index.d.ts +7 -0
  44. package/dist/lib/index.d.ts.map +1 -0
  45. package/dist/lib/index.js +14 -0
  46. package/dist/lib/models/angular-rspack-plugin-options.d.ts +344 -0
  47. package/dist/lib/models/angular-rspack-plugin-options.d.ts.map +1 -0
  48. package/dist/lib/models/angular-rspack-plugin-options.js +2 -0
  49. package/dist/lib/models/augmented-compilation.d.ts +13 -0
  50. package/dist/lib/models/augmented-compilation.d.ts.map +1 -0
  51. package/dist/lib/models/augmented-compilation.js +4 -0
  52. package/dist/lib/models/i18n.d.ts +33 -0
  53. package/dist/lib/models/i18n.d.ts.map +1 -0
  54. package/dist/lib/models/i18n.js +41 -0
  55. package/dist/lib/models/index.d.ts +5 -0
  56. package/dist/lib/models/index.d.ts.map +1 -0
  57. package/dist/lib/models/index.js +7 -0
  58. package/dist/lib/models/normalize-options.d.ts +16 -0
  59. package/dist/lib/models/normalize-options.d.ts.map +1 -0
  60. package/dist/lib/models/normalize-options.js +424 -0
  61. package/dist/lib/plugins/angular-rspack-plugin.d.ts +9 -0
  62. package/dist/lib/plugins/angular-rspack-plugin.d.ts.map +1 -0
  63. package/dist/lib/plugins/angular-rspack-plugin.js +234 -0
  64. package/dist/lib/plugins/angular-ssr-dev-server.d.ts +8 -0
  65. package/dist/lib/plugins/angular-ssr-dev-server.d.ts.map +1 -0
  66. package/dist/lib/plugins/angular-ssr-dev-server.js +62 -0
  67. package/dist/lib/plugins/any-component-style-budget-checker-plugin.d.ts +19 -0
  68. package/dist/lib/plugins/any-component-style-budget-checker-plugin.d.ts.map +1 -0
  69. package/dist/lib/plugins/any-component-style-budget-checker-plugin.js +64 -0
  70. package/dist/lib/plugins/client/ssr-reload-client.d.ts +2 -0
  71. package/dist/lib/plugins/client/ssr-reload-client.d.ts.map +1 -0
  72. package/dist/lib/plugins/client/ssr-reload-client.js +15 -0
  73. package/dist/lib/plugins/i18n-inline-plugin.d.ts +8 -0
  74. package/dist/lib/plugins/i18n-inline-plugin.d.ts.map +1 -0
  75. package/dist/lib/plugins/i18n-inline-plugin.js +201 -0
  76. package/dist/lib/plugins/index-html-plugin.d.ts +21 -0
  77. package/dist/lib/plugins/index-html-plugin.d.ts.map +1 -0
  78. package/dist/lib/plugins/index-html-plugin.js +107 -0
  79. package/dist/lib/plugins/loaders/angular-partial-transform.loader.d.ts +3 -0
  80. package/dist/lib/plugins/loaders/angular-partial-transform.loader.d.ts.map +1 -0
  81. package/dist/lib/plugins/loaders/angular-partial-transform.loader.js +39 -0
  82. package/dist/lib/plugins/loaders/angular-transform.loader.d.ts +7 -0
  83. package/dist/lib/plugins/loaders/angular-transform.loader.d.ts.map +1 -0
  84. package/dist/lib/plugins/loaders/angular-transform.loader.js +40 -0
  85. package/dist/lib/plugins/loaders/hmr-accept-loader.d.ts +11 -0
  86. package/dist/lib/plugins/loaders/hmr-accept-loader.d.ts.map +1 -0
  87. package/dist/lib/plugins/loaders/hmr-accept-loader.js +24 -0
  88. package/dist/lib/plugins/loaders/hmr-accept.d.ts +9 -0
  89. package/dist/lib/plugins/loaders/hmr-accept.d.ts.map +1 -0
  90. package/dist/lib/plugins/loaders/hmr-accept.js +183 -0
  91. package/dist/lib/plugins/loaders/platform-server-exports.loader.d.ts +5 -0
  92. package/dist/lib/plugins/loaders/platform-server-exports.loader.d.ts.map +1 -0
  93. package/dist/lib/plugins/loaders/platform-server-exports.loader.js +18 -0
  94. package/dist/lib/plugins/ng-rspack.d.ts +13 -0
  95. package/dist/lib/plugins/ng-rspack.d.ts.map +1 -0
  96. package/dist/lib/plugins/ng-rspack.js +134 -0
  97. package/dist/lib/plugins/prerender-plugin.d.ts +8 -0
  98. package/dist/lib/plugins/prerender-plugin.d.ts.map +1 -0
  99. package/dist/lib/plugins/prerender-plugin.js +216 -0
  100. package/dist/lib/plugins/progress-plugin.d.ts +12 -0
  101. package/dist/lib/plugins/progress-plugin.d.ts.map +1 -0
  102. package/dist/lib/plugins/progress-plugin.js +36 -0
  103. package/dist/lib/plugins/rxjs-esm-resolution.d.ts +5 -0
  104. package/dist/lib/plugins/rxjs-esm-resolution.d.ts.map +1 -0
  105. package/dist/lib/plugins/rxjs-esm-resolution.js +15 -0
  106. package/dist/lib/plugins/server/ssr-reload-server.d.ts +6 -0
  107. package/dist/lib/plugins/server/ssr-reload-server.d.ts.map +1 -0
  108. package/dist/lib/plugins/server/ssr-reload-server.js +21 -0
  109. package/dist/lib/plugins/stats-json-plugin.d.ts +14 -0
  110. package/dist/lib/plugins/stats-json-plugin.d.ts.map +1 -0
  111. package/dist/lib/plugins/stats-json-plugin.js +69 -0
  112. package/dist/lib/plugins/suppress-js-for-css-chunks-plugin.d.ts +5 -0
  113. package/dist/lib/plugins/suppress-js-for-css-chunks-plugin.d.ts.map +1 -0
  114. package/dist/lib/plugins/suppress-js-for-css-chunks-plugin.js +34 -0
  115. package/dist/lib/plugins/tools/dev-tools-ignore-plugin.d.ts +17 -0
  116. package/dist/lib/plugins/tools/dev-tools-ignore-plugin.d.ts.map +1 -0
  117. package/dist/lib/plugins/tools/dev-tools-ignore-plugin.js +57 -0
  118. package/dist/lib/plugins/tools/render-worker.d.ts +31 -0
  119. package/dist/lib/plugins/tools/render-worker.d.ts.map +1 -0
  120. package/dist/lib/plugins/tools/render-worker.js +105 -0
  121. package/dist/lib/plugins/tools/routes-extractor-worker.d.ts +21 -0
  122. package/dist/lib/plugins/tools/routes-extractor-worker.d.ts.map +1 -0
  123. package/dist/lib/plugins/tools/routes-extractor-worker.js +48 -0
  124. package/dist/lib/plugins/tools/worker-pool.d.ts +13 -0
  125. package/dist/lib/plugins/tools/worker-pool.d.ts.map +1 -0
  126. package/dist/lib/plugins/tools/worker-pool.js +23 -0
  127. package/dist/lib/plugins/transfer-size-plugin.d.ts +12 -0
  128. package/dist/lib/plugins/transfer-size-plugin.d.ts.map +1 -0
  129. package/dist/lib/plugins/transfer-size-plugin.js +49 -0
  130. package/dist/lib/plugins/watch-file-logs-plugin.d.ts +12 -0
  131. package/dist/lib/plugins/watch-file-logs-plugin.d.ts.map +1 -0
  132. package/dist/lib/plugins/watch-file-logs-plugin.js +27 -0
  133. package/dist/lib/utils/async-chunks.d.ts +17 -0
  134. package/dist/lib/utils/async-chunks.d.ts.map +1 -0
  135. package/dist/lib/utils/async-chunks.js +44 -0
  136. package/dist/lib/utils/color.d.ts +11 -0
  137. package/dist/lib/utils/color.d.ts.map +1 -0
  138. package/dist/lib/utils/color.js +41 -0
  139. package/dist/lib/utils/find-project-for-path.d.ts +16 -0
  140. package/dist/lib/utils/find-project-for-path.d.ts.map +1 -0
  141. package/dist/lib/utils/find-project-for-path.js +42 -0
  142. package/dist/lib/utils/get-locale-base-href.d.ts +3 -0
  143. package/dist/lib/utils/get-locale-base-href.d.ts.map +1 -0
  144. package/dist/lib/utils/get-locale-base-href.js +17 -0
  145. package/dist/lib/utils/graph.d.ts +3 -0
  146. package/dist/lib/utils/graph.d.ts.map +1 -0
  147. package/dist/lib/utils/graph.js +25 -0
  148. package/dist/lib/utils/i18n.d.ts +4 -0
  149. package/dist/lib/utils/i18n.d.ts.map +1 -0
  150. package/dist/lib/utils/i18n.js +25 -0
  151. package/dist/lib/utils/index-file/add-body-script.d.ts +2 -0
  152. package/dist/lib/utils/index-file/add-body-script.d.ts.map +1 -0
  153. package/dist/lib/utils/index-file/add-body-script.js +15 -0
  154. package/dist/lib/utils/index-file/add-event-dispatch-contract.d.ts +9 -0
  155. package/dist/lib/utils/index-file/add-event-dispatch-contract.d.ts.map +1 -0
  156. package/dist/lib/utils/index-file/add-event-dispatch-contract.js +27 -0
  157. package/dist/lib/utils/index-file/get-index-input-file.d.ts +3 -0
  158. package/dist/lib/utils/index-file/get-index-input-file.d.ts.map +1 -0
  159. package/dist/lib/utils/index-file/get-index-input-file.js +9 -0
  160. package/dist/lib/utils/index-file/get-index-output-file.d.ts +3 -0
  161. package/dist/lib/utils/index-file/get-index-output-file.d.ts.map +1 -0
  162. package/dist/lib/utils/index-file/get-index-output-file.js +10 -0
  163. package/dist/lib/utils/index-file/html-rewriting-stream.d.ts +16 -0
  164. package/dist/lib/utils/index-file/html-rewriting-stream.d.ts.map +1 -0
  165. package/dist/lib/utils/index-file/html-rewriting-stream.js +27 -0
  166. package/dist/lib/utils/max-workers.d.ts +2 -0
  167. package/dist/lib/utils/max-workers.d.ts.map +1 -0
  168. package/dist/lib/utils/max-workers.js +21 -0
  169. package/dist/lib/utils/misc-helpers.d.ts +7 -0
  170. package/dist/lib/utils/misc-helpers.d.ts.map +1 -0
  171. package/dist/lib/utils/misc-helpers.js +34 -0
  172. package/dist/lib/utils/postcss-cli-resources.d.ts +22 -0
  173. package/dist/lib/utils/postcss-cli-resources.d.ts.map +1 -0
  174. package/dist/lib/utils/postcss-cli-resources.js +159 -0
  175. package/dist/lib/utils/postcss-configuration.d.ts +18 -0
  176. package/dist/lib/utils/postcss-configuration.d.ts.map +1 -0
  177. package/dist/lib/utils/postcss-configuration.js +92 -0
  178. package/dist/lib/utils/rspack-diagnostics.d.ts +4 -0
  179. package/dist/lib/utils/rspack-diagnostics.d.ts.map +1 -0
  180. package/dist/lib/utils/rspack-diagnostics.js +22 -0
  181. package/dist/lib/utils/spinner.d.ts +21 -0
  182. package/dist/lib/utils/spinner.d.ts.map +1 -0
  183. package/dist/lib/utils/spinner.js +54 -0
  184. package/dist/lib/utils/stats.d.ts +35 -0
  185. package/dist/lib/utils/stats.d.ts.map +1 -0
  186. package/dist/lib/utils/stats.js +313 -0
  187. package/dist/lib/utils/tty.d.ts +9 -0
  188. package/dist/lib/utils/tty.d.ts.map +1 -0
  189. package/dist/lib/utils/tty.js +22 -0
  190. package/dist/lib/utils/url-join.d.ts +9 -0
  191. package/dist/lib/utils/url-join.d.ts.map +1 -0
  192. package/dist/lib/utils/url-join.js +17 -0
  193. package/package.json +150 -0
@@ -0,0 +1,49 @@
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.dev/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.TransferSizePlugin = void 0;
11
+ const node_util_1 = require("node:util");
12
+ const node_zlib_1 = require("node:zlib");
13
+ const rspack_diagnostics_1 = require("../utils/rspack-diagnostics");
14
+ const brotliCompressAsync = (0, node_util_1.promisify)(node_zlib_1.brotliCompress);
15
+ const PLUGIN_NAME = 'angular-transfer-size-estimator';
16
+ class TransferSizePlugin {
17
+ apply(compiler) {
18
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
19
+ compilation.hooks.processAssets.tapAsync({
20
+ name: PLUGIN_NAME,
21
+ stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_ANALYSE,
22
+ }, async (compilationAssets, callback) => {
23
+ const actions = [];
24
+ for (const assetName of Object.keys(compilationAssets)) {
25
+ if (!assetName.endsWith('.js') && !assetName.endsWith('.css')) {
26
+ continue;
27
+ }
28
+ const scriptAsset = compilation.getAsset(assetName);
29
+ if (!scriptAsset || scriptAsset.source.size() <= 0) {
30
+ continue;
31
+ }
32
+ actions.push(brotliCompressAsync(scriptAsset.source.source())
33
+ .then((result) => {
34
+ compilation.updateAsset(assetName, (s) => s, (assetInfo) => {
35
+ assetInfo.estimatedTransferSize = result.length;
36
+ return assetInfo;
37
+ });
38
+ })
39
+ .catch((error) => {
40
+ (0, rspack_diagnostics_1.addWarning)(compilation, `Unable to calculate estimated transfer size for '${assetName}'. Reason: ${error.message}`);
41
+ }));
42
+ }
43
+ await Promise.all(actions);
44
+ callback();
45
+ });
46
+ });
47
+ }
48
+ }
49
+ exports.TransferSizePlugin = TransferSizePlugin;
@@ -0,0 +1,12 @@
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.dev/license
7
+ */
8
+ import type { Compiler, RspackPluginInstance } from '@rspack/core';
9
+ export declare class WatchFilesLogsPlugin implements RspackPluginInstance {
10
+ apply(compiler: Compiler): void;
11
+ }
12
+ //# sourceMappingURL=watch-file-logs-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-file-logs-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/watch-file-logs-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAInE,qBAAa,oBAAqB,YAAW,oBAAoB;IAC/D,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAiBzB"}
@@ -0,0 +1,27 @@
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.dev/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.WatchFilesLogsPlugin = void 0;
11
+ const PLUGIN_NAME = 'AngularRspackWatchFilesLogsPlugin';
12
+ class WatchFilesLogsPlugin {
13
+ apply(compiler) {
14
+ compiler.hooks.watchRun.tap(PLUGIN_NAME, ({ modifiedFiles, removedFiles }) => {
15
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
16
+ const logger = compilation.getLogger(PLUGIN_NAME);
17
+ if (modifiedFiles?.size) {
18
+ logger.log(`Modified files:\n${[...modifiedFiles].join('\n')}\n`);
19
+ }
20
+ if (removedFiles?.size) {
21
+ logger.log(`Removed files:\n${[...removedFiles].join('\n')}\n`);
22
+ }
23
+ });
24
+ });
25
+ }
26
+ }
27
+ exports.WatchFilesLogsPlugin = WatchFilesLogsPlugin;
@@ -0,0 +1,17 @@
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.dev/license
7
+ */
8
+ import { StatsChunk, StatsCompilation } from '@rspack/core';
9
+ import { NormalizedEntryPoint } from '../models/angular-rspack-plugin-options';
10
+ /**
11
+ * Webpack stats may incorrectly mark extra entry points `initial` chunks, when
12
+ * they are actually loaded asynchronously and thus not in the main bundle. This
13
+ * function finds extra entry points in Webpack stats and corrects this value
14
+ * whereever necessary. Does not modify {@param webpackStats}.
15
+ */
16
+ export declare function markAsyncChunksNonInitial(webpackStats: StatsCompilation, extraEntryPoints: NormalizedEntryPoint[]): StatsChunk[];
17
+ //# sourceMappingURL=async-chunks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-chunks.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/async-chunks.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,gBAAgB,EAC9B,gBAAgB,EAAE,oBAAoB,EAAE,GACvC,UAAU,EAAE,CAqCd"}
@@ -0,0 +1,44 @@
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.dev/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.markAsyncChunksNonInitial = markAsyncChunksNonInitial;
11
+ /**
12
+ * Webpack stats may incorrectly mark extra entry points `initial` chunks, when
13
+ * they are actually loaded asynchronously and thus not in the main bundle. This
14
+ * function finds extra entry points in Webpack stats and corrects this value
15
+ * whereever necessary. Does not modify {@param webpackStats}.
16
+ */
17
+ function markAsyncChunksNonInitial(webpackStats, extraEntryPoints) {
18
+ const { chunks = [], entrypoints: entryPoints = {} } = webpackStats;
19
+ // Find all Webpack chunk IDs not injected into the main bundle. We don't have
20
+ // to worry about transitive dependencies because extra entry points cannot be
21
+ // depended upon in Webpack, thus any extra entry point with `inject: false`,
22
+ // **cannot** be loaded in main bundle.
23
+ const asyncChunkIds = extraEntryPoints
24
+ .filter((entryPoint) => !entryPoint.inject && entryPoints[entryPoint.bundleName])
25
+ .flatMap((entryPoint) => entryPoints[entryPoint.bundleName].chunks?.filter((n) => n !== 'runtime'));
26
+ // Find chunks for each ID.
27
+ const asyncChunks = asyncChunkIds.map((chunkId) => {
28
+ const chunk = chunks.find((chunk) => chunk.id === chunkId);
29
+ if (!chunk) {
30
+ throw new Error(`Failed to find chunk (${chunkId}) in set:\n${JSON.stringify(chunks)}`);
31
+ }
32
+ return chunk;
33
+ });
34
+ // A chunk is considered `initial` only if Webpack already belives it to be initial
35
+ // and the application developer did not mark it async via an extra entry point.
36
+ return chunks.map((chunk) => {
37
+ return asyncChunks.find((asyncChunk) => asyncChunk === chunk)
38
+ ? {
39
+ ...chunk,
40
+ initial: false,
41
+ }
42
+ : chunk;
43
+ });
44
+ }
@@ -0,0 +1,11 @@
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.dev/license
7
+ */
8
+ import * as ansiColors from 'ansi-colors';
9
+ declare const colors: typeof ansiColors;
10
+ export { colors };
11
+ //# sourceMappingURL=color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/color.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,aAAa,CAAC;AA+B1C,QAAA,MAAM,MAAM,mBAAsB,CAAC;AAGnC,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,41 @@
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.dev/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.colors = void 0;
11
+ const tslib_1 = require("tslib");
12
+ const ansiColors = tslib_1.__importStar(require("ansi-colors"));
13
+ const node_tty_1 = require("node:tty");
14
+ function supportColor() {
15
+ if (process.env.FORCE_COLOR !== undefined) {
16
+ // 2 colors: FORCE_COLOR = 0 (Disables colors), depth 1
17
+ // 16 colors: FORCE_COLOR = 1, depth 4
18
+ // 256 colors: FORCE_COLOR = 2, depth 8
19
+ // 16,777,216 colors: FORCE_COLOR = 3, depth 16
20
+ // See: https://nodejs.org/dist/latest-v12.x/docs/api/tty.html#tty_writestream_getcolordepth_env
21
+ // and https://github.com/nodejs/node/blob/b9f36062d7b5c5039498e98d2f2c180dca2a7065/lib/internal/tty.js#L106;
22
+ switch (process.env.FORCE_COLOR) {
23
+ case '':
24
+ case 'true':
25
+ case '1':
26
+ case '2':
27
+ case '3':
28
+ return true;
29
+ default:
30
+ return false;
31
+ }
32
+ }
33
+ if (process.stdout instanceof node_tty_1.WriteStream) {
34
+ return process.stdout.hasColors();
35
+ }
36
+ return false;
37
+ }
38
+ // Create a separate instance to prevent unintended global changes to the color configuration
39
+ const colors = ansiColors.create();
40
+ exports.colors = colors;
41
+ colors.enabled = supportColor();
@@ -0,0 +1,16 @@
1
+ import type { ProjectGraphProjectNode } from '@nx/devkit';
2
+ type ProjectRootMappings = Map<string, string>;
3
+ /**
4
+ * This creates a map of project roots to project names to easily look up the project of a file
5
+ * @param nodes This is the nodes from the project graph
6
+ */
7
+ export declare function createProjectRootMappings(nodes: Record<string, ProjectGraphProjectNode>): ProjectRootMappings;
8
+ /**
9
+ * Locates a project in projectRootMap based on a file within it
10
+ * @param filePath path that is inside of projectName. This should be relative from the workspace root
11
+ * @param projectRootMap Map<projectRoot, projectName> Use {@link createProjectRootMappings} to create this
12
+ */
13
+ export declare function findProjectForPath(filePath: string, projectRootMap: ProjectRootMappings): string | undefined;
14
+ export declare function normalizeProjectRoot(root: string): string;
15
+ export {};
16
+ //# sourceMappingURL=find-project-for-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-project-for-path.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/find-project-for-path.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAG1D,KAAK,mBAAmB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/C;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,GAC7C,mBAAmB,CAQrB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,mBAAmB,GAClC,MAAM,GAAG,SAAS,CAkBpB;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,UAGhD"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createProjectRootMappings = createProjectRootMappings;
4
+ exports.findProjectForPath = findProjectForPath;
5
+ exports.normalizeProjectRoot = normalizeProjectRoot;
6
+ const node_path_1 = require("node:path");
7
+ /**
8
+ * This creates a map of project roots to project names to easily look up the project of a file
9
+ * @param nodes This is the nodes from the project graph
10
+ */
11
+ function createProjectRootMappings(nodes) {
12
+ const projectRootMappings = new Map();
13
+ for (const projectName of Object.keys(nodes)) {
14
+ const root = nodes[projectName].data.root;
15
+ projectRootMappings.set(normalizeProjectRoot(root), projectName);
16
+ }
17
+ return projectRootMappings;
18
+ }
19
+ /**
20
+ * Locates a project in projectRootMap based on a file within it
21
+ * @param filePath path that is inside of projectName. This should be relative from the workspace root
22
+ * @param projectRootMap Map<projectRoot, projectName> Use {@link createProjectRootMappings} to create this
23
+ */
24
+ function findProjectForPath(filePath, projectRootMap) {
25
+ /**
26
+ * Project Mappings are in UNIX-style file paths
27
+ * Windows may pass Win-style file paths
28
+ * Ensure filePath is in UNIX-style
29
+ */
30
+ let currentPath = node_path_1.posix.normalize(filePath);
31
+ for (; currentPath != node_path_1.posix.dirname(currentPath); currentPath = node_path_1.posix.dirname(currentPath)) {
32
+ const p = projectRootMap.get(currentPath);
33
+ if (p) {
34
+ return p;
35
+ }
36
+ }
37
+ return projectRootMap.get(currentPath);
38
+ }
39
+ function normalizeProjectRoot(root) {
40
+ root = root === '' ? '.' : root;
41
+ return root && root.endsWith('/') ? root.substring(0, root.length - 1) : root;
42
+ }
@@ -0,0 +1,3 @@
1
+ import { I18nOptions } from '../models';
2
+ export declare function getLocaleBaseHref(i18n: I18nOptions, locale: string, baseHref?: string): string | undefined;
3
+ //# sourceMappingURL=get-locale-base-href.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-locale-base-href.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/get-locale-base-href.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAepB"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLocaleBaseHref = getLocaleBaseHref;
4
+ const url_join_1 = require("./url-join");
5
+ function getLocaleBaseHref(i18n, locale, baseHref) {
6
+ if (i18n.flatOutput) {
7
+ return undefined;
8
+ }
9
+ const localeData = i18n.locales[locale];
10
+ if (!localeData) {
11
+ return undefined;
12
+ }
13
+ const baseHrefSuffix = localeData.baseHref ?? localeData.subPath + '/';
14
+ return baseHrefSuffix !== ''
15
+ ? (0, url_join_1.urlJoin)(baseHref || '', baseHrefSuffix)
16
+ : undefined;
17
+ }
@@ -0,0 +1,3 @@
1
+ import { type ProjectGraph } from '@nx/devkit';
2
+ export declare function retrieveOrCreateProjectGraph(): Promise<ProjectGraph | null>;
3
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAEpB,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAoBjF"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.retrieveOrCreateProjectGraph = retrieveOrCreateProjectGraph;
4
+ const devkit_1 = require("@nx/devkit");
5
+ async function retrieveOrCreateProjectGraph() {
6
+ let projectGraph = null;
7
+ try {
8
+ projectGraph = (0, devkit_1.readCachedProjectGraph)();
9
+ }
10
+ catch {
11
+ // ignore
12
+ }
13
+ try {
14
+ if (!projectGraph) {
15
+ projectGraph = await (0, devkit_1.createProjectGraphAsync)({
16
+ exitOnError: false,
17
+ resetDaemonClient: true,
18
+ });
19
+ }
20
+ }
21
+ catch {
22
+ // ignore
23
+ }
24
+ return projectGraph;
25
+ }
@@ -0,0 +1,4 @@
1
+ import type { I18nOptions } from '../models';
2
+ export declare function ensureOutputPaths(baseOutputPath: string, i18n: I18nOptions): Map<string, string>;
3
+ export declare function getLocaleOutputPaths(i18n: I18nOptions): Map<string, string>;
4
+ //# sourceMappingURL=i18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/i18n.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,WAAW,GAChB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAWrB;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAS3E"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ensureOutputPaths = ensureOutputPaths;
4
+ exports.getLocaleOutputPaths = getLocaleOutputPaths;
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
+ function ensureOutputPaths(baseOutputPath, i18n) {
8
+ const outputPaths = getLocaleOutputPaths(i18n);
9
+ for (const [, outputPath] of outputPaths) {
10
+ const fullPath = (0, node_path_1.join)(baseOutputPath, outputPath);
11
+ if (!(0, node_fs_1.existsSync)(fullPath)) {
12
+ (0, node_fs_1.mkdirSync)(fullPath, { recursive: true });
13
+ }
14
+ }
15
+ return outputPaths;
16
+ }
17
+ function getLocaleOutputPaths(i18n) {
18
+ const outputPaths = i18n.shouldInline
19
+ ? [...i18n.inlineLocales].map((l) => [
20
+ l,
21
+ i18n.flatOutput ? '' : i18n.locales[l].subPath,
22
+ ])
23
+ : [['', '']];
24
+ return new Map(outputPaths);
25
+ }
@@ -0,0 +1,2 @@
1
+ export declare function addBodyScript(html: string, bodyScriptContents: string): Promise<string>;
2
+ //# sourceMappingURL=add-body-script.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-body-script.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/index-file/add-body-script.ts"],"names":[],"mappings":"AAEA,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,MAAM,CAAC,CAcjB"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addBodyScript = addBodyScript;
4
+ const html_rewriting_stream_1 = require("./html-rewriting-stream");
5
+ async function addBodyScript(html, bodyScriptContents) {
6
+ const { rewriter, transformedContent } = await (0, html_rewriting_stream_1.htmlRewritingStream)(html);
7
+ const bodyScript = `<script type="text/javascript">${bodyScriptContents}</script>`;
8
+ rewriter.on('startTag', (tag) => {
9
+ rewriter.emitStartTag(tag);
10
+ if (tag.tagName === 'body') {
11
+ rewriter.emitRaw(bodyScript);
12
+ }
13
+ });
14
+ return transformedContent();
15
+ }
@@ -0,0 +1,9 @@
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.dev/license
7
+ */
8
+ export declare function addEventDispatchContract(html: string): Promise<string>;
9
+ //# sourceMappingURL=add-event-dispatch-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-event-dispatch-contract.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/index-file/add-event-dispatch-contract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoB5E"}
@@ -0,0 +1,27 @@
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.dev/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.addEventDispatchContract = addEventDispatchContract;
11
+ const promises_1 = require("node:fs/promises");
12
+ const html_rewriting_stream_1 = require("./html-rewriting-stream");
13
+ let jsActionContractScript;
14
+ async function addEventDispatchContract(html) {
15
+ const { rewriter, transformedContent } = await (0, html_rewriting_stream_1.htmlRewritingStream)(html);
16
+ jsActionContractScript ??=
17
+ '<script type="text/javascript" id="ng-event-dispatch-contract">' +
18
+ (await (0, promises_1.readFile)(require.resolve('@angular/core/event-dispatch-contract.min.js'), 'utf-8')) +
19
+ '</script>';
20
+ rewriter.on('startTag', (tag) => {
21
+ rewriter.emitStartTag(tag);
22
+ if (tag.tagName === 'body') {
23
+ rewriter.emitRaw(jsActionContractScript);
24
+ }
25
+ });
26
+ return transformedContent();
27
+ }
@@ -0,0 +1,3 @@
1
+ import type { IndexExpandedDefinition } from '../../models';
2
+ export declare function getIndexInputFile(index: IndexExpandedDefinition): string;
3
+ //# sourceMappingURL=get-index-input-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-index-input-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/index-file/get-index-input-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE5D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,uBAAuB,GAAG,MAAM,CAMxE"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getIndexInputFile = getIndexInputFile;
4
+ function getIndexInputFile(index) {
5
+ if (typeof index === 'string') {
6
+ return index;
7
+ }
8
+ return index.input;
9
+ }
@@ -0,0 +1,3 @@
1
+ import type { IndexExpandedDefinition } from '../../models';
2
+ export declare function getIndexOutputFile(index: IndexExpandedDefinition): string;
3
+ //# sourceMappingURL=get-index-output-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-index-output-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/index-file/get-index-output-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAG5D,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,MAAM,CAMzE"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getIndexOutputFile = getIndexOutputFile;
4
+ const node_path_1 = require("node:path");
5
+ function getIndexOutputFile(index) {
6
+ if (typeof index === 'string') {
7
+ return (0, node_path_1.basename)(index);
8
+ }
9
+ return index.output || 'index.html';
10
+ }
@@ -0,0 +1,16 @@
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.dev/license
7
+ */
8
+ import type { RewritingStream } from 'parse5-html-rewriting-stream';
9
+ export type StartTag = Parameters<RewritingStream['emitStartTag']>[0];
10
+ export type EndTag = Parameters<RewritingStream['emitEndTag']>[0];
11
+ export type { RewritingStream };
12
+ export declare function htmlRewritingStream(content: string): Promise<{
13
+ rewriter: RewritingStream;
14
+ transformedContent: () => Promise<string>;
15
+ }>;
16
+ //# sourceMappingURL=html-rewriting-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-rewriting-stream.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/index-file/html-rewriting-stream.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAIpE,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtE,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClE,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAClE,QAAQ,EAAE,eAAe,CAAC;IAC1B,kBAAkB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3C,CAAC,CAkBD"}
@@ -0,0 +1,27 @@
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.dev/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.htmlRewritingStream = htmlRewritingStream;
11
+ const node_stream_1 = require("node:stream");
12
+ const promises_1 = require("node:stream/promises");
13
+ const misc_helpers_1 = require("../misc-helpers");
14
+ async function htmlRewritingStream(content) {
15
+ const { RewritingStream } = await (0, misc_helpers_1.loadEsmModule)('parse5-html-rewriting-stream');
16
+ const rewriter = new RewritingStream();
17
+ return {
18
+ rewriter,
19
+ transformedContent: () => (0, promises_1.pipeline)(node_stream_1.Readable.from(content), rewriter, async function (source) {
20
+ const chunks = [];
21
+ for await (const chunk of source) {
22
+ chunks.push(Buffer.from(chunk));
23
+ }
24
+ return Buffer.concat(chunks).toString('utf-8');
25
+ }),
26
+ };
27
+ }
@@ -0,0 +1,2 @@
1
+ export declare const maxWorkers: () => number;
2
+ //# sourceMappingURL=max-workers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"max-workers.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/max-workers.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,UAAU,cAKtB,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.maxWorkers = void 0;
4
+ const node_os_1 = require("node:os");
5
+ const ENV_NG_BUILD_MAX_WORKERS = 'NG_BUILD_MAX_WORKERS';
6
+ function isPresent(variable) {
7
+ return typeof variable === 'string' && variable.trim() !== '';
8
+ }
9
+ function parseMaxWorkers(value) {
10
+ if (!isPresent(value))
11
+ return null;
12
+ const parsed = Number(value);
13
+ return Number.isNaN(parsed) || parsed <= 0 ? null : parsed; // Ensure valid positive number
14
+ }
15
+ const maxWorkers = () => {
16
+ const parsedWorkers = parseMaxWorkers(process.env[ENV_NG_BUILD_MAX_WORKERS]);
17
+ return parsedWorkers !== null
18
+ ? parsedWorkers
19
+ : Math.min(4, Math.max((0, node_os_1.availableParallelism)() - 1, 1));
20
+ };
21
+ exports.maxWorkers = maxWorkers;
@@ -0,0 +1,7 @@
1
+ export declare function loadEsmModule<T>(modulePath: string | URL): Promise<T>;
2
+ export declare function assertIsError(value: unknown): asserts value is Error & {
3
+ code?: string;
4
+ };
5
+ export declare function isPackageInstalled(root: string, name: string): boolean;
6
+ export declare function assertNever(input: never): never;
7
+ //# sourceMappingURL=misc-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"misc-helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/misc-helpers.ts"],"names":[],"mappings":"AAIA,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAOrE;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,KAAK,IAAI,KAAK,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAS5C;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAQtE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAQ/C"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadEsmModule = loadEsmModule;
4
+ exports.assertIsError = assertIsError;
5
+ exports.isPackageInstalled = isPackageInstalled;
6
+ exports.assertNever = assertNever;
7
+ const tslib_1 = require("tslib");
8
+ const node_assert_1 = tslib_1.__importDefault(require("node:assert"));
9
+ let load;
10
+ function loadEsmModule(modulePath) {
11
+ load ??= new Function('modulePath', `return import(modulePath);`);
12
+ return load(modulePath);
13
+ }
14
+ function assertIsError(value) {
15
+ const isError = value instanceof Error ||
16
+ // The following is needed to identify errors coming from RxJs
17
+ (typeof value === 'object' &&
18
+ value &&
19
+ 'name' in value &&
20
+ 'message' in value);
21
+ (0, node_assert_1.default)(isError, 'catch clause variable is not an Error instance');
22
+ }
23
+ function isPackageInstalled(root, name) {
24
+ try {
25
+ require.resolve(name, { paths: [root] });
26
+ return true;
27
+ }
28
+ catch {
29
+ return false;
30
+ }
31
+ }
32
+ function assertNever(input) {
33
+ throw new Error(`Unexpected call to assertNever() with input: ${JSON.stringify(input, null /* replacer */, 4 /* tabSize */)}`);
34
+ }