@angular-devkit/build-angular 15.0.0-next.1 → 15.0.0-next.2

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 (49) hide show
  1. package/package.json +13 -15
  2. package/src/babel/presets/application.d.ts +1 -2
  3. package/src/babel/presets/application.js +1 -4
  4. package/src/babel/webpack-loader.js +8 -22
  5. package/src/builders/browser/index.d.ts +1 -1
  6. package/src/builders/browser/index.js +4 -16
  7. package/src/builders/browser/schema.json +2 -2
  8. package/src/builders/browser-esbuild/compiler-plugin.d.ts +1 -0
  9. package/src/builders/browser-esbuild/compiler-plugin.js +20 -17
  10. package/src/builders/browser-esbuild/experimental-warnings.js +0 -1
  11. package/src/builders/browser-esbuild/index.js +18 -5
  12. package/src/builders/browser-esbuild/schema.d.ts +2 -4
  13. package/src/builders/browser-esbuild/schema.json +13 -32
  14. package/src/builders/browser-esbuild/stylesheets.d.ts +1 -0
  15. package/src/builders/browser-esbuild/stylesheets.js +1 -0
  16. package/src/builders/extract-i18n/index.js +1 -1
  17. package/src/builders/karma/schema.json +2 -2
  18. package/src/builders/server/index.d.ts +1 -1
  19. package/src/builders/server/index.js +42 -10
  20. package/src/builders/server/platform-server-exports-loader.d.ts +13 -0
  21. package/src/builders/server/platform-server-exports-loader.js +24 -0
  22. package/src/utils/build-options.d.ts +1 -2
  23. package/src/utils/esbuild-targets.d.ts +12 -0
  24. package/src/utils/esbuild-targets.js +39 -0
  25. package/src/utils/i18n-inlining.d.ts +1 -1
  26. package/src/utils/i18n-inlining.js +3 -4
  27. package/src/utils/normalize-builder-schema.d.ts +2 -2
  28. package/src/utils/normalize-builder-schema.js +2 -2
  29. package/src/utils/process-bundle.d.ts +0 -1
  30. package/src/utils/process-bundle.js +29 -57
  31. package/src/utils/supported-browsers.d.ts +2 -1
  32. package/src/utils/supported-browsers.js +18 -2
  33. package/src/utils/webpack-browser-config.d.ts +0 -2
  34. package/src/utils/webpack-browser-config.js +2 -8
  35. package/src/webpack/configs/common.js +10 -12
  36. package/src/webpack/configs/dev-server.js +1 -1
  37. package/src/webpack/configs/styles.js +0 -20
  38. package/src/webpack/plugins/any-component-style-budget-checker.js +1 -1
  39. package/src/webpack/plugins/css-optimizer-plugin.d.ts +0 -1
  40. package/src/webpack/plugins/css-optimizer-plugin.js +3 -26
  41. package/src/webpack/plugins/hmr/hmr-loader.d.ts +1 -1
  42. package/src/webpack/plugins/hmr/hmr-loader.js +2 -5
  43. package/src/webpack/plugins/javascript-optimizer-plugin.d.ts +4 -6
  44. package/src/webpack/plugins/javascript-optimizer-plugin.js +5 -14
  45. package/src/webpack/plugins/javascript-optimizer-worker.d.ts +3 -2
  46. package/src/webpack/plugins/javascript-optimizer-worker.js +21 -46
  47. package/src/webpack/plugins/typescript.js +14 -25
  48. package/src/webpack/utils/helpers.d.ts +0 -2
  49. package/src/webpack/utils/helpers.js +1 -17
@@ -46,7 +46,7 @@ async function getDevServerConfig(wco) {
46
46
  if (hmr) {
47
47
  extraRules.push({
48
48
  loader: hmr_loader_1.HmrLoader,
49
- include: [main].map((p) => (0, path_1.resolve)(wco.root, p)),
49
+ include: [(0, path_1.resolve)(wco.root, main)],
50
50
  });
51
51
  }
52
52
  const extraPlugins = [];
@@ -97,10 +97,6 @@ function getStylesConfig(wco) {
97
97
  // Add plugin to remove hashes from lazy styles.
98
98
  extraPlugins.push(new plugins_1.RemoveHashPlugin({ chunkNames: noInjectNames, hashFormat }));
99
99
  }
100
- if (globalStylePaths.some((p) => p.endsWith('.styl'))) {
101
- wco.logger.warn('Stylus usage is deprecated and will be removed in a future major version. ' +
102
- 'To opt-out of the deprecated behaviour, please migrate to another stylesheet language.');
103
- }
104
100
  const sassImplementation = new sass_service_1.SassWorkerImplementation();
105
101
  const sassTildeUsageMessage = new Set();
106
102
  extraPlugins.push({
@@ -329,22 +325,6 @@ function getStylesConfig(wco) {
329
325
  },
330
326
  ],
331
327
  },
332
- {
333
- extensions: ['styl'],
334
- use: [
335
- {
336
- loader: require.resolve('stylus-loader'),
337
- options: {
338
- sourceMap: cssSourceMap,
339
- stylusOptions: {
340
- compress: false,
341
- sourceMap: { comment: false },
342
- paths: includePaths,
343
- },
344
- },
345
- },
346
- ],
347
- },
348
328
  ];
349
329
  return {
350
330
  entry: entryPoints,
@@ -59,7 +59,7 @@ class AnyComponentStyleBudgetChecker {
59
59
  if (!compilation.compiler.parentCompilation) {
60
60
  return;
61
61
  }
62
- const cssExtensions = ['.css', '.scss', '.less', '.styl', '.sass'];
62
+ const cssExtensions = ['.css', '.scss', '.less', '.sass'];
63
63
  const componentStyles = Object.keys(compilation.assets)
64
64
  .filter((name) => cssExtensions.includes(path.extname(name)))
65
65
  .map((name) => ({
@@ -32,5 +32,4 @@ export declare class CssOptimizerPlugin {
32
32
  */
33
33
  private optimize;
34
34
  private addWarnings;
35
- private transformSupportedBrowsersToTargets;
36
35
  }
@@ -8,6 +8,7 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.CssOptimizerPlugin = void 0;
11
+ const esbuild_targets_1 = require("../../utils/esbuild-targets");
11
12
  const webpack_diagnostics_1 = require("../../utils/webpack-diagnostics");
12
13
  const esbuild_executor_1 = require("./esbuild-executor");
13
14
  /**
@@ -24,7 +25,7 @@ class CssOptimizerPlugin {
24
25
  constructor(options) {
25
26
  this.esbuild = new esbuild_executor_1.EsbuildExecutor();
26
27
  if (options === null || options === void 0 ? void 0 : options.supportedBrowsers) {
27
- this.targets = this.transformSupportedBrowsersToTargets(options.supportedBrowsers);
28
+ this.targets = (0, esbuild_targets_1.transformSupportedBrowsersToTargets)(options.supportedBrowsers);
28
29
  }
29
30
  }
30
31
  apply(compiler) {
@@ -38,7 +39,7 @@ class CssOptimizerPlugin {
38
39
  const cache = compilation.options.cache && compilation.getCache(PLUGIN_NAME);
39
40
  logger.time('optimize css assets');
40
41
  for (const assetName of Object.keys(compilationAssets)) {
41
- if (!/\.(?:css|scss|sass|less|styl)$/.test(assetName)) {
42
+ if (!/\.(?:css|scss|sass|less)$/.test(assetName)) {
42
43
  continue;
43
44
  }
44
45
  const asset = compilation.getAsset(assetName);
@@ -117,29 +118,5 @@ class CssOptimizerPlugin {
117
118
  }
118
119
  }
119
120
  }
120
- transformSupportedBrowsersToTargets(supportedBrowsers) {
121
- const transformed = [];
122
- // https://esbuild.github.io/api/#target
123
- const esBuildSupportedBrowsers = new Set(['safari', 'firefox', 'edge', 'chrome', 'ios']);
124
- for (const browser of supportedBrowsers) {
125
- let [browserName, version] = browser.split(' ');
126
- // browserslist uses the name `ios_saf` for iOS Safari whereas esbuild uses `ios`
127
- if (browserName === 'ios_saf') {
128
- browserName = 'ios';
129
- }
130
- // browserslist uses ranges `15.2-15.3` versions but only the lowest is required
131
- // to perform minimum supported feature checks. esbuild also expects a single version.
132
- [version] = version.split('-');
133
- if (esBuildSupportedBrowsers.has(browserName)) {
134
- if (browserName === 'safari' && version === 'TP') {
135
- // esbuild only supports numeric versions so `TP` is converted to a high number (999) since
136
- // a Technology Preview (TP) of Safari is assumed to support all currently known features.
137
- version = '999';
138
- }
139
- transformed.push(browserName + version);
140
- }
141
- }
142
- return transformed.length ? transformed : undefined;
143
- }
144
121
  }
145
122
  exports.CssOptimizerPlugin = CssOptimizerPlugin;
@@ -6,4 +6,4 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  export declare const HmrLoader: string;
9
- export default function (this: any, content: string, map: any): void;
9
+ export default function localizeExtractLoader(this: import('webpack').LoaderContext<{}>, content: string, map: Parameters<import('webpack').LoaderDefinitionFunction>[1]): void;
@@ -11,10 +11,7 @@ exports.HmrLoader = void 0;
11
11
  const path_1 = require("path");
12
12
  exports.HmrLoader = __filename;
13
13
  const hmrAcceptPath = (0, path_1.join)(__dirname, './hmr-accept.js').replace(/\\/g, '/');
14
- function default_1(content,
15
- // Source map types are broken in the webpack type definitions
16
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
- map) {
14
+ function localizeExtractLoader(content, map) {
18
15
  const source = `${content}
19
16
 
20
17
  // HMR Accept Code
@@ -24,4 +21,4 @@ map) {
24
21
  this.callback(null, source, map);
25
22
  return;
26
23
  }
27
- exports.default = default_1;
24
+ exports.default = localizeExtractLoader;
@@ -5,7 +5,6 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- import { ScriptTarget } from 'typescript';
9
8
  import type { Compiler } from 'webpack';
10
9
  /**
11
10
  * The options used to configure the {@link JavaScriptOptimizerPlugin}.
@@ -29,11 +28,9 @@ export interface JavaScriptOptimizerOptions {
29
28
  */
30
29
  sourcemap?: boolean;
31
30
  /**
32
- * The ECMAScript version that should be used when generating output code.
33
- * The optimizer will not adjust the output code with features present in newer
34
- * ECMAScript versions.
31
+ * A list of supported browsers that is used for output code.
35
32
  */
36
- target: ScriptTarget;
33
+ supportedBrowsers?: string[];
37
34
  /**
38
35
  * Enables the retention of identifier names and ensures that function and class names are
39
36
  * present in the output code.
@@ -61,7 +58,8 @@ export interface JavaScriptOptimizerOptions {
61
58
  * optimizations not yet implemented by `esbuild`.
62
59
  */
63
60
  export declare class JavaScriptOptimizerPlugin {
64
- options: JavaScriptOptimizerOptions;
61
+ private options;
62
+ private targets;
65
63
  constructor(options: JavaScriptOptimizerOptions);
66
64
  apply(compiler: Compiler): void;
67
65
  }
@@ -12,8 +12,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.JavaScriptOptimizerPlugin = void 0;
14
14
  const piscina_1 = __importDefault(require("piscina"));
15
- const typescript_1 = require("typescript");
16
15
  const environment_options_1 = require("../../utils/environment-options");
16
+ const esbuild_targets_1 = require("../../utils/esbuild-targets");
17
17
  const esbuild_executor_1 = require("./esbuild-executor");
18
18
  /**
19
19
  * The maximum number of Workers that will be created to execute optimize tasks.
@@ -34,6 +34,9 @@ const PLUGIN_NAME = 'angular-javascript-optimizer';
34
34
  class JavaScriptOptimizerPlugin {
35
35
  constructor(options) {
36
36
  this.options = options;
37
+ if (options.supportedBrowsers) {
38
+ this.targets = (0, esbuild_targets_1.transformSupportedBrowsersToTargets)(options.supportedBrowsers);
39
+ }
37
40
  }
38
41
  apply(compiler) {
39
42
  const { OriginalSource, SourceMapSource } = compiler.webpack.sources;
@@ -90,25 +93,13 @@ class JavaScriptOptimizerPlugin {
90
93
  define[key] = String(value);
91
94
  }
92
95
  }
93
- let target = 2017;
94
- if (this.options.target) {
95
- if (this.options.target <= typescript_1.ScriptTarget.ES5) {
96
- target = 5;
97
- }
98
- else if (this.options.target === typescript_1.ScriptTarget.ESNext) {
99
- target = 'next';
100
- }
101
- else {
102
- target = Number(typescript_1.ScriptTarget[this.options.target].slice(2));
103
- }
104
- }
105
96
  // Setup the options used by all worker tasks
106
97
  const optimizeOptions = {
107
98
  sourcemap: this.options.sourcemap,
108
99
  define,
109
100
  keepNames: this.options.keepNames,
110
101
  keepIdentifierNames: this.options.keepIdentifierNames,
111
- target,
102
+ target: this.targets,
112
103
  removeLicenses: this.options.removeLicenses,
113
104
  advanced: this.options.advanced,
114
105
  // Perform a single native esbuild support check.
@@ -39,9 +39,10 @@ export interface OptimizeRequestOptions {
39
39
  */
40
40
  sourcemap?: boolean;
41
41
  /**
42
- * Specifies the target ECMAScript version for the output code.
42
+ * Specifies the list of supported esbuild targets.
43
+ * @see: https://esbuild.github.io/api/#target
43
44
  */
44
- target: 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 'next';
45
+ target?: string[];
45
46
  /**
46
47
  * Controls whether esbuild should only use the WASM-variant instead of trying to
47
48
  * use the native variant. Some platforms may not support the native-variant and
@@ -26,9 +26,7 @@ async function default_1({ asset, options }) {
26
26
  // esbuild is used as a first pass
27
27
  const esbuildResult = await optimizeWithEsbuild(asset.code, asset.name, options);
28
28
  // terser is used as a second pass
29
- const terserResult = await optimizeWithTerser(asset.name, esbuildResult.code, options.sourcemap,
30
- // Terser only supports up to ES2020.
31
- options.target === 'next' ? 2020 : options.target, options.advanced);
29
+ const terserResult = await optimizeWithTerser(asset.name, esbuildResult.code, options.sourcemap, options.advanced);
32
30
  // Merge intermediate sourcemaps with input sourcemap if enabled
33
31
  let fullSourcemap;
34
32
  if (options.sourcemap) {
@@ -56,49 +54,26 @@ exports.default = default_1;
56
54
  * @returns A promise that resolves with the optimized code, source map, and any warnings.
57
55
  */
58
56
  async function optimizeWithEsbuild(content, name, options) {
59
- var _a;
60
57
  if (!esbuild) {
61
58
  esbuild = new esbuild_executor_1.EsbuildExecutor(options.alwaysUseWasm);
62
59
  }
63
- let result;
64
- try {
65
- result = await esbuild.transform(content, {
66
- minifyIdentifiers: !options.keepIdentifierNames,
67
- minifySyntax: true,
68
- // NOTE: Disabling whitespace ensures unused pure annotations are kept
69
- minifyWhitespace: false,
70
- pure: ['forwardRef'],
71
- legalComments: options.removeLicenses ? 'none' : 'inline',
72
- sourcefile: name,
73
- sourcemap: options.sourcemap && 'external',
74
- define: options.define,
75
- // This option should always be disabled for browser builds as we don't rely on `.name`
76
- // and causes deadcode to be retained which makes `NG_BUILD_MANGLE` unusable to investigate tree-shaking issues.
77
- // We enable `keepNames` only for server builds as Domino relies on `.name`.
78
- // Once we no longer rely on Domino for SSR we should be able to remove this.
79
- keepNames: options.keepNames,
80
- target: `es${options.target}`,
81
- });
82
- }
83
- catch (error) {
84
- const failure = error;
85
- // If esbuild fails with only ES5 support errors, fallback to just terser.
86
- // This will only happen if ES5 is the output target and a global script contains ES2015+ syntax.
87
- // In that case, the global script is technically already invalid for the target environment but
88
- // this is and has been considered a configuration issue. Global scripts must be compatible with
89
- // the target environment.
90
- if ((_a = failure.errors) === null || _a === void 0 ? void 0 : _a.every((error) => error.text.includes('to the configured target environment ("es5") is not supported yet'))) {
91
- result = {
92
- code: content,
93
- map: '',
94
- warnings: [],
95
- };
96
- }
97
- else {
98
- throw error;
99
- }
100
- }
101
- return result;
60
+ return esbuild.transform(content, {
61
+ minifyIdentifiers: !options.keepIdentifierNames,
62
+ minifySyntax: true,
63
+ // NOTE: Disabling whitespace ensures unused pure annotations are kept
64
+ minifyWhitespace: false,
65
+ pure: ['forwardRef'],
66
+ legalComments: options.removeLicenses ? 'none' : 'inline',
67
+ sourcefile: name,
68
+ sourcemap: options.sourcemap && 'external',
69
+ define: options.define,
70
+ // This option should always be disabled for browser builds as we don't rely on `.name`
71
+ // and causes deadcode to be retained which makes `NG_BUILD_MANGLE` unusable to investigate tree-shaking issues.
72
+ // We enable `keepNames` only for server builds as Domino relies on `.name`.
73
+ // Once we no longer rely on Domino for SSR we should be able to remove this.
74
+ keepNames: options.keepNames,
75
+ target: options.target,
76
+ });
102
77
  }
103
78
  /**
104
79
  * Optimizes a JavaScript asset using terser.
@@ -106,17 +81,17 @@ async function optimizeWithEsbuild(content, name, options) {
106
81
  * @param name The name of the JavaScript asset. Used to generate source maps.
107
82
  * @param code The JavaScript asset source content to optimize.
108
83
  * @param sourcemaps If true, generate an output source map for the optimized code.
109
- * @param target Specifies the target ECMAScript version for the output code.
110
84
  * @param advanced Controls advanced optimizations.
111
85
  * @returns A promise that resolves with the optimized code and source map.
112
86
  */
113
- async function optimizeWithTerser(name, code, sourcemaps, target, advanced) {
87
+ async function optimizeWithTerser(name, code, sourcemaps, advanced) {
114
88
  const result = await (0, terser_1.minify)({ [name]: code }, {
115
89
  compress: {
116
90
  passes: advanced ? 2 : 1,
117
91
  pure_getters: advanced,
118
92
  },
119
- ecma: target,
93
+ // terser only supports up to ES2020
94
+ ecma: 2020,
120
95
  // esbuild in the first pass is used to minify identifiers instead of mangle here
121
96
  mangle: false,
122
97
  // esbuild in the first pass is used to minify function names
@@ -11,52 +11,41 @@ exports.createIvyPlugin = void 0;
11
11
  const webpack_1 = require("@ngtools/webpack");
12
12
  const typescript_1 = require("typescript");
13
13
  function createIvyPlugin(wco, aot, tsconfig) {
14
- const { buildOptions } = wco;
14
+ var _a, _b;
15
+ var _c;
16
+ const { buildOptions, tsConfig } = wco;
15
17
  const optimize = buildOptions.optimization.scripts;
16
18
  const compilerOptions = {
17
19
  sourceMap: buildOptions.sourceMap.scripts,
18
20
  declaration: false,
19
21
  declarationMap: false,
20
22
  };
23
+ if (tsConfig.options.target === undefined || tsConfig.options.target < typescript_1.ScriptTarget.ES2022) {
24
+ tsConfig.options.target = typescript_1.ScriptTarget.ES2022;
25
+ // If 'useDefineForClassFields' is already defined in the users project leave the value as is.
26
+ // Otherwise fallback to false due to https://github.com/microsoft/TypeScript/issues/45995
27
+ // which breaks the deprecated `@Effects` NGRX decorator and potentially other existing code as well.
28
+ (_a = (_c = tsConfig.options).useDefineForClassFields) !== null && _a !== void 0 ? _a : (_c.useDefineForClassFields = false);
29
+ wco.logger.warn('TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and ' +
30
+ '"false" respectively by the Angular CLI. To control ECMA version and features use the Browerslist configuration. ' +
31
+ 'For more information, see https://github.com/browserslist/browserslist');
32
+ }
21
33
  if (buildOptions.preserveSymlinks !== undefined) {
22
34
  compilerOptions.preserveSymlinks = buildOptions.preserveSymlinks;
23
35
  }
24
- // Outputting ES2015 from TypeScript is the required minimum for the build optimizer passes.
25
- // Downleveling to ES5 will occur after the build optimizer passes via babel which is the same
26
- // as for third-party libraries. This greatly reduces the complexity of static analysis.
27
- if (wco.scriptTarget < typescript_1.ScriptTarget.ES2015) {
28
- compilerOptions.target = typescript_1.ScriptTarget.ES2015;
29
- wco.logger.warn('DEPRECATED: ES5 output is deprecated. Please update TypeScript `target` compiler option to ES2015 or later.');
30
- }
31
36
  const fileReplacements = {};
32
37
  if (buildOptions.fileReplacements) {
33
38
  for (const replacement of buildOptions.fileReplacements) {
34
39
  fileReplacements[replacement.replace] = replacement.with;
35
40
  }
36
41
  }
37
- let inlineStyleFileExtension;
38
- switch (buildOptions.inlineStyleLanguage) {
39
- case 'less':
40
- inlineStyleFileExtension = 'less';
41
- break;
42
- case 'sass':
43
- inlineStyleFileExtension = 'sass';
44
- break;
45
- case 'scss':
46
- inlineStyleFileExtension = 'scss';
47
- break;
48
- case 'css':
49
- default:
50
- inlineStyleFileExtension = 'css';
51
- break;
52
- }
53
42
  return new webpack_1.AngularWebpackPlugin({
54
43
  tsconfig,
55
44
  compilerOptions,
56
45
  fileReplacements,
57
46
  jitMode: !aot,
58
47
  emitNgModuleScope: !optimize,
59
- inlineStyleFileExtension,
48
+ inlineStyleFileExtension: (_b = buildOptions.inlineStyleLanguage) !== null && _b !== void 0 ? _b : 'css',
60
49
  });
61
50
  }
62
51
  exports.createIvyPlugin = createIvyPlugin;
@@ -6,7 +6,6 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import type { ObjectPattern } from 'copy-webpack-plugin';
9
- import { ScriptTarget } from 'typescript';
10
9
  import type { Configuration, WebpackOptionsNormalized } from 'webpack';
11
10
  import { AssetPatternClass, OutputHashing, ScriptElement, StyleElement } from '../../builders/browser/schema';
12
11
  import { WebpackConfigOptions } from '../../utils/build-options';
@@ -31,4 +30,3 @@ export declare function globalScriptsByBundleName(root: string, scripts: ScriptE
31
30
  export declare function assetPatterns(root: string, assets: AssetPatternClass[]): ObjectPattern[];
32
31
  export declare function externalizePackages(context: string, request: string | undefined, callback: (error?: Error, result?: string) => void): void;
33
32
  export declare function getStatsOptions(verbose?: boolean): WebpackStatsOptions;
34
- export declare function getMainFieldsAndConditionNames(target: ScriptTarget, platformServer: boolean): Pick<WebpackOptionsNormalized['resolve'], 'mainFields' | 'conditionNames'>;
@@ -33,12 +33,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
33
33
  return (mod && mod.__esModule) ? mod : { "default": mod };
34
34
  };
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.getMainFieldsAndConditionNames = exports.getStatsOptions = exports.externalizePackages = exports.assetPatterns = exports.globalScriptsByBundleName = exports.getCacheSettings = exports.getInstrumentationExcludedPaths = exports.assetNameTemplateFactory = exports.normalizeExtraEntryPoints = exports.getOutputHashFormat = void 0;
36
+ exports.getStatsOptions = exports.externalizePackages = exports.assetPatterns = exports.globalScriptsByBundleName = exports.getCacheSettings = exports.getInstrumentationExcludedPaths = exports.assetNameTemplateFactory = exports.normalizeExtraEntryPoints = exports.getOutputHashFormat = void 0;
37
37
  const crypto_1 = require("crypto");
38
38
  const fs_1 = require("fs");
39
39
  const glob_1 = __importDefault(require("glob"));
40
40
  const path = __importStar(require("path"));
41
- const typescript_1 = require("typescript");
42
41
  const schema_1 = require("../../builders/browser/schema");
43
42
  const package_version_1 = require("../../utils/package-version");
44
43
  function getOutputHashFormat(outputHashing = schema_1.OutputHashing.None, length = 20) {
@@ -288,18 +287,3 @@ function getStatsOptions(verbose = false) {
288
287
  : webpackOutputOptions;
289
288
  }
290
289
  exports.getStatsOptions = getStatsOptions;
291
- function getMainFieldsAndConditionNames(target, platformServer) {
292
- const mainFields = platformServer
293
- ? ['es2015', 'module', 'main']
294
- : ['es2015', 'browser', 'module', 'main'];
295
- const conditionNames = ['es2015', '...'];
296
- if (target >= typescript_1.ScriptTarget.ES2020) {
297
- mainFields.unshift('es2020');
298
- conditionNames.unshift('es2020');
299
- }
300
- return {
301
- mainFields,
302
- conditionNames,
303
- };
304
- }
305
- exports.getMainFieldsAndConditionNames = getMainFieldsAndConditionNames;