@angular-devkit/build-angular 0.1101.0-next.4 → 0.1101.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.
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "0.1101.0-next.4",
3
+ "version": "0.1101.2",
4
4
  "description": "Angular Webpack Build Facade",
5
5
  "experimental": true,
6
6
  "main": "src/index.js",
7
7
  "typings": "src/index.d.ts",
8
8
  "builders": "builders.json",
9
9
  "dependencies": {
10
- "@angular-devkit/architect": "0.1101.0-next.4",
11
- "@angular-devkit/build-optimizer": "0.1101.0-next.4",
12
- "@angular-devkit/build-webpack": "0.1101.0-next.4",
13
- "@angular-devkit/core": "11.1.0-next.4",
10
+ "@angular-devkit/architect": "0.1101.2",
11
+ "@angular-devkit/build-optimizer": "0.1101.2",
12
+ "@angular-devkit/build-webpack": "0.1101.2",
13
+ "@angular-devkit/core": "11.1.2",
14
14
  "@babel/core": "7.12.10",
15
15
  "@babel/generator": "7.12.11",
16
16
  "@babel/plugin-transform-runtime": "7.12.10",
@@ -18,9 +18,9 @@
18
18
  "@babel/runtime": "7.12.5",
19
19
  "@babel/template": "7.12.7",
20
20
  "@jsdevtools/coverage-istanbul-loader": "3.0.5",
21
- "@ngtools/webpack": "11.1.0-next.4",
21
+ "@ngtools/webpack": "11.1.2",
22
22
  "ansi-colors": "4.1.1",
23
- "autoprefixer": "10.2.0",
23
+ "autoprefixer": "10.2.1",
24
24
  "babel-loader": "8.2.2",
25
25
  "browserslist": "^4.9.1",
26
26
  "cacache": "15.0.5",
@@ -34,30 +34,31 @@
34
34
  "file-loader": "6.2.0",
35
35
  "find-cache-dir": "3.3.1",
36
36
  "glob": "7.1.6",
37
+ "https-proxy-agent": "5.0.0",
37
38
  "inquirer": "7.3.3",
38
39
  "jest-worker": "26.6.2",
39
40
  "karma-source-map-support": "1.4.0",
40
- "less": "4.0.0",
41
- "less-loader": "7.2.1",
42
- "license-webpack-plugin": "2.3.9",
41
+ "less": "4.1.0",
42
+ "less-loader": "7.3.0",
43
+ "license-webpack-plugin": "2.3.11",
43
44
  "loader-utils": "2.0.0",
44
45
  "mini-css-extract-plugin": "1.3.3",
45
46
  "minimatch": "3.0.4",
46
- "open": "7.3.0",
47
+ "open": "7.3.1",
47
48
  "ora": "5.2.0",
48
49
  "parse5-html-rewriting-stream": "6.0.1",
49
50
  "pnp-webpack-plugin": "1.6.4",
50
- "postcss": "8.2.2",
51
+ "postcss": "8.2.4",
51
52
  "postcss-import": "14.0.0",
52
- "postcss-loader": "4.1.0",
53
+ "postcss-loader": "4.2.0",
53
54
  "raw-loader": "4.0.2",
54
55
  "regenerator-runtime": "0.13.7",
55
56
  "resolve-url-loader": "3.1.2",
56
57
  "rimraf": "3.0.2",
57
- "rollup": "2.36.0",
58
+ "rollup": "2.36.1",
58
59
  "rxjs": "6.6.3",
59
- "sass": "1.32.0",
60
- "sass-loader": "10.1.0",
60
+ "sass": "1.32.4",
61
+ "sass-loader": "10.1.1",
61
62
  "semver": "7.3.4",
62
63
  "source-map": "0.7.3",
63
64
  "source-map-loader": "1.1.3",
@@ -65,7 +66,7 @@
65
66
  "speed-measure-webpack-plugin": "1.3.3",
66
67
  "style-loader": "2.0.0",
67
68
  "stylus": "0.54.8",
68
- "stylus-loader": "4.3.1",
69
+ "stylus-loader": "4.3.2",
69
70
  "terser": "5.5.1",
70
71
  "terser-webpack-plugin": "4.2.3",
71
72
  "text-table": "0.2.0",
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google Inc. 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
+ declare module 'babel-loader' {
9
+ type BabelLoaderCustomizer<T> = (
10
+ babel: typeof import('@babel/core'),
11
+ ) => {
12
+ customOptions?(
13
+ this: import('webpack').loader.LoaderContext,
14
+ loaderOptions: Record<string, unknown>,
15
+ loaderArguments: { source: string; map?: unknown },
16
+ ): Promise<{ custom?: T; loader: Record<string, unknown> }>;
17
+ config?(
18
+ this: import('webpack').loader.LoaderContext,
19
+ configuration: import('@babel/core').PartialConfig,
20
+ loaderArguments: { source: string; map?: unknown; customOptions: T },
21
+ ): import('@babel/core').TransformOptions;
22
+ };
23
+ function custom<T>(customizer: BabelLoaderCustomizer<T>): import('webpack').loader.Loader;
24
+ }
@@ -1,10 +1,11 @@
1
- export declare type DiagnosticReporter = (type: 'error' | 'warning', message: string) => void;
1
+ export declare type DiagnosticReporter = (type: 'error' | 'warning' | 'info', message: string) => void;
2
2
  export interface ApplicationPresetOptions {
3
3
  i18n?: {
4
4
  locale: string;
5
5
  missingTranslationBehavior?: 'error' | 'warning' | 'ignore';
6
6
  translation?: unknown;
7
7
  };
8
+ angularLinker?: boolean;
8
9
  forceES5?: boolean;
9
10
  forceAsyncTransformation?: boolean;
10
11
  diagnosticReporter?: DiagnosticReporter;
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  * Use of this source code is governed by an MIT-style license that can be
8
8
  * found in the LICENSE file at https://angular.io/license
9
9
  */
10
+ const fs = require("fs");
10
11
  const path = require("path");
11
12
  function createI18nDiagnostics(reporter) {
12
13
  // Babel currently is synchronous so import cannot be used
@@ -57,10 +58,39 @@ function createI18nPlugins(locale, translation, missingTranslationBehavior, diag
57
58
  plugins.push(makeLocalePlugin(locale));
58
59
  return plugins;
59
60
  }
61
+ function createNgtscLogger(reporter) {
62
+ return {
63
+ level: 1,
64
+ debug(...args) { },
65
+ info(...args) {
66
+ reporter === null || reporter === void 0 ? void 0 : reporter('info', args.join());
67
+ },
68
+ warn(...args) {
69
+ reporter === null || reporter === void 0 ? void 0 : reporter('warning', args.join());
70
+ },
71
+ error(...args) {
72
+ reporter === null || reporter === void 0 ? void 0 : reporter('error', args.join());
73
+ },
74
+ };
75
+ }
60
76
  function default_1(api, options) {
61
77
  const presets = [];
62
78
  const plugins = [];
63
79
  let needRuntimeTransform = false;
80
+ if (options.angularLinker) {
81
+ // Babel currently is synchronous so import cannot be used
82
+ const { createEs2015LinkerPlugin, } = require('@angular/compiler-cli/linker/babel');
83
+ plugins.push(createEs2015LinkerPlugin({
84
+ logger: createNgtscLogger(options.diagnosticReporter),
85
+ fileSystem: {
86
+ resolve: path.resolve,
87
+ exists: fs.existsSync,
88
+ dirname: path.dirname,
89
+ relative: path.relative,
90
+ readFile: fs.readFileSync,
91
+ },
92
+ }));
93
+ }
64
94
  if (options.forceES5) {
65
95
  presets.push([
66
96
  require('@babel/preset-env').default,
@@ -0,0 +1,2 @@
1
+ declare const _default: import("webpack").loader.Loader;
2
+ export default _default;
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * @license
5
+ * Copyright Google Inc. All Rights Reserved.
6
+ *
7
+ * Use of this source code is governed by an MIT-style license that can be
8
+ * found in the LICENSE file at https://angular.io/license
9
+ */
10
+ const babel_loader_1 = require("babel-loader");
11
+ const typescript_1 = require("typescript");
12
+ /**
13
+ * Cached linker check utility function
14
+ *
15
+ * If undefined, not yet been imported
16
+ * If null, attempted import failed and no linker support
17
+ * If function, import succeeded and linker supported
18
+ */
19
+ let needsLinking;
20
+ async function checkLinking(path, source) {
21
+ // @angular/core and @angular/compiler will cause false positives
22
+ if (/[\\\/]@angular[\\\/](?:compiler|core)/.test(path)) {
23
+ return { requiresLinking: false };
24
+ }
25
+ if (needsLinking !== null) {
26
+ try {
27
+ if (needsLinking === undefined) {
28
+ needsLinking = (await Promise.resolve().then(() => require('@angular/compiler-cli/linker'))).needsLinking;
29
+ }
30
+ // If the linker entry point is present then there is linker support
31
+ return { hasLinkerSupport: true, requiresLinking: needsLinking(path, source) };
32
+ }
33
+ catch (_a) {
34
+ needsLinking = null;
35
+ }
36
+ }
37
+ // Fallback for Angular versions less than 11.1.0 with no linker support.
38
+ // This information is used to issue errors if a partially compiled library is used when unsupported.
39
+ return {
40
+ hasLinkerSupport: false,
41
+ requiresLinking: source.includes('ɵɵngDeclareDirective') || source.includes('ɵɵngDeclareComponent'),
42
+ };
43
+ }
44
+ exports.default = babel_loader_1.custom(() => {
45
+ const baseOptions = Object.freeze({
46
+ babelrc: false,
47
+ configFile: false,
48
+ compact: false,
49
+ cacheCompression: false,
50
+ sourceType: 'unambiguous',
51
+ });
52
+ return {
53
+ async customOptions({ scriptTarget, ...loaderOptions }, { source }) {
54
+ // Must process file if plugins are added
55
+ let shouldProcess = Array.isArray(loaderOptions.plugins) && loaderOptions.plugins.length > 0;
56
+ // Analyze file for linking
57
+ let shouldLink = false;
58
+ const { hasLinkerSupport, requiresLinking } = await checkLinking(this.resourcePath, source);
59
+ if (requiresLinking && !hasLinkerSupport) {
60
+ // Cannot link if there is no linker support
61
+ this.emitError('File requires the Angular linker. "@angular/compiler-cli" version 11.1.0 or greater is needed.');
62
+ }
63
+ else {
64
+ shouldLink = requiresLinking;
65
+ }
66
+ shouldProcess || (shouldProcess = shouldLink);
67
+ // Analyze for ES target processing
68
+ let forceES5 = false;
69
+ const esTarget = scriptTarget;
70
+ if (esTarget < typescript_1.ScriptTarget.ES2015) {
71
+ forceES5 = true;
72
+ }
73
+ shouldProcess || (shouldProcess = forceES5);
74
+ // Add provided loader options to default base options
75
+ const options = {
76
+ ...baseOptions,
77
+ ...loaderOptions,
78
+ };
79
+ // Skip babel processing if no actions are needed
80
+ if (!shouldProcess) {
81
+ // Force the current file to be ignored
82
+ options.ignore = [() => true];
83
+ }
84
+ return { custom: { forceES5, shouldLink }, loader: options };
85
+ },
86
+ config(configuration, { customOptions }) {
87
+ return {
88
+ ...configuration.options,
89
+ presets: [
90
+ ...(configuration.options.presets || []),
91
+ [
92
+ require('./presets/application').default,
93
+ {
94
+ angularLinker: customOptions.shouldLink,
95
+ forceES5: customOptions.forceES5,
96
+ diagnosticReporter: (type, message) => {
97
+ switch (type) {
98
+ case 'error':
99
+ this.emitError(message);
100
+ break;
101
+ case 'info':
102
+ // Webpack does not currently have an informational diagnostic
103
+ case 'warning':
104
+ this.emitWarning(message);
105
+ break;
106
+ }
107
+ },
108
+ },
109
+ ],
110
+ ],
111
+ };
112
+ },
113
+ };
114
+ });
@@ -63,7 +63,7 @@ function getCompilerConfig(wco) {
63
63
  return {};
64
64
  }
65
65
  exports.getCompilerConfig = getCompilerConfig;
66
- async function initialize(options, context, host, differentialLoadingMode, webpackConfigurationTransform) {
66
+ async function initialize(options, context, host, differentialLoadingNeeded, webpackConfigurationTransform) {
67
67
  var _a, _b;
68
68
  const originalOutputPath = options.outputPath;
69
69
  // Assets are processed directly by the builder except when watching
@@ -76,7 +76,7 @@ async function initialize(options, context, host, differentialLoadingMode, webpa
76
76
  getAnalyticsConfig(wco, context),
77
77
  getCompilerConfig(wco),
78
78
  wco.buildOptions.webWorkerTsConfig ? configs_1.getWorkerConfig(wco) : {},
79
- ], host, { differentialLoadingMode });
79
+ ], host, { differentialLoadingNeeded });
80
80
  // Validate asset option values if processed directly
81
81
  if (((_a = options.assets) === null || _a === void 0 ? void 0 : _a.length) && !((_b = adjustedOptions.assets) === null || _b === void 0 ? void 0 : _b.length)) {
82
82
  utils_1.normalizeAssetPatterns(options.assets, new core_1.virtualFs.SyncDelegateHost(host), core_1.normalize(context.workspaceRoot), core_1.normalize(projectRoot), projectSourceRoot === undefined ? undefined : core_1.normalize(projectSourceRoot)).forEach(({ output }) => {
@@ -115,7 +115,6 @@ function buildWebpackBrowser(options, context, transforms = {}) {
115
115
  const target = compilerOptions.target || typescript_1.ScriptTarget.ES5;
116
116
  const buildBrowserFeatures = new utils_1.BuildBrowserFeatures(sysProjectRoot);
117
117
  const isDifferentialLoadingNeeded = buildBrowserFeatures.isDifferentialLoadingNeeded(target);
118
- const differentialLoadingMode = !options.watch && isDifferentialLoadingNeeded;
119
118
  if (target > typescript_1.ScriptTarget.ES2015 && isDifferentialLoadingNeeded) {
120
119
  context.logger.warn(core_1.tags.stripIndent `
121
120
  Warning: Using differential loading with targets ES5 and ES2016 or higher may
@@ -133,7 +132,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
133
132
  '\nFor additional information: https://v10.angular.io/guide/deprecations#ie-9-10-and-mobile');
134
133
  }
135
134
  return {
136
- ...(await initialize(options, context, host, differentialLoadingMode, transforms.webpackConfiguration)),
135
+ ...(await initialize(options, context, host, isDifferentialLoadingNeeded, transforms.webpackConfiguration)),
137
136
  buildBrowserFeatures,
138
137
  isDifferentialLoadingNeeded,
139
138
  target,
@@ -28,7 +28,7 @@ export interface Schema {
28
28
  */
29
29
  buildOptimizer?: boolean;
30
30
  /**
31
- * Use a separate bundle containing code used across multiple bundles.
31
+ * Generate a seperate bundle containing code used across multiple bundles.
32
32
  */
33
33
  commonChunk?: boolean;
34
34
  /**
@@ -188,7 +188,8 @@ export interface Schema {
188
188
  */
189
189
  tsConfig: string;
190
190
  /**
191
- * Use a separate bundle containing only vendor libraries.
191
+ * Generate a seperate bundle containing only vendor libraries. This option should only used
192
+ * for development.
192
193
  */
193
194
  vendorChunk?: boolean;
194
195
  /**
@@ -328,7 +329,8 @@ export declare type Localize = string[] | boolean;
328
329
  export declare type OptimizationUnion = boolean | OptimizationClass;
329
330
  export interface OptimizationClass {
330
331
  /**
331
- * Enables optimization for fonts. This requires internet access.
332
+ * Enables optimization for fonts. This option requires internet access. `HTTPS_PROXY`
333
+ * environment variable can be used to specify a proxy server.
332
334
  */
333
335
  fonts?: FontsUnion;
334
336
  /**
@@ -341,13 +343,15 @@ export interface OptimizationClass {
341
343
  styles?: StylesUnion;
342
344
  }
343
345
  /**
344
- * Enables optimization for fonts. This requires internet access.
346
+ * Enables optimization for fonts. This option requires internet access. `HTTPS_PROXY`
347
+ * environment variable can be used to specify a proxy server.
345
348
  */
346
349
  export declare type FontsUnion = boolean | FontsClass;
347
350
  export interface FontsClass {
348
351
  /**
349
352
  * Reduce render blocking requests by inlining external Google fonts and icons CSS
350
- * definitions in the application's HTML index file. This requires internet access.
353
+ * definitions in the application's HTML index file. This option requires internet access.
354
+ * `HTTPS_PROXY` environment variable can be used to specify a proxy server.
351
355
  */
352
356
  inline?: boolean;
353
357
  }
@@ -95,7 +95,7 @@
95
95
  ]
96
96
  },
97
97
  "fonts": {
98
- "description": "Enables optimization for fonts. This requires internet access.",
98
+ "description": "Enables optimization for fonts. This option requires internet access. `HTTPS_PROXY` environment variable can be used to specify a proxy server.",
99
99
  "default": true,
100
100
  "oneOf": [
101
101
  {
@@ -103,7 +103,7 @@
103
103
  "properties": {
104
104
  "inline": {
105
105
  "type": "boolean",
106
- "description": "Reduce render blocking requests by inlining external Google fonts and icons CSS definitions in the application's HTML index file. This requires internet access.",
106
+ "description": "Reduce render blocking requests by inlining external Google fonts and icons CSS definitions in the application's HTML index file. This option requires internet access. `HTTPS_PROXY` environment variable can be used to specify a proxy server.",
107
107
  "default": true
108
108
  }
109
109
  },
@@ -182,12 +182,12 @@
182
182
  },
183
183
  "vendorChunk": {
184
184
  "type": "boolean",
185
- "description": "Use a separate bundle containing only vendor libraries.",
185
+ "description": "Generate a seperate bundle containing only vendor libraries. This option should only used for development.",
186
186
  "default": true
187
187
  },
188
188
  "commonChunk": {
189
189
  "type": "boolean",
190
- "description": "Use a separate bundle containing code used across multiple bundles.",
190
+ "description": "Generate a seperate bundle containing code used across multiple bundles.",
191
191
  "default": true
192
192
  },
193
193
  "baseHref": {
@@ -23,7 +23,7 @@ export interface Schema {
23
23
  */
24
24
  browserTarget: string;
25
25
  /**
26
- * Use a separate bundle containing code used across multiple bundles.
26
+ * Generate a seperate bundle containing code used across multiple bundles.
27
27
  * @deprecated Use the "commonChunk" option in the browser builder instead.
28
28
  */
29
29
  commonChunk?: boolean;
@@ -121,7 +121,8 @@ export interface Schema {
121
121
  */
122
122
  sslKey?: string;
123
123
  /**
124
- * Use a separate bundle containing only vendor libraries.
124
+ * Generate a seperate bundle containing only vendor libraries. This option should only used
125
+ * for development.
125
126
  * @deprecated Use the "vendorChunk" option in the browser builder instead.
126
127
  */
127
128
  vendorChunk?: boolean;
@@ -173,12 +173,12 @@
173
173
  },
174
174
  "vendorChunk": {
175
175
  "type": "boolean",
176
- "description": "Use a separate bundle containing only vendor libraries.",
176
+ "description": "Generate a seperate bundle containing only vendor libraries. This option should only used for development.",
177
177
  "x-deprecated": "Use the \"vendorChunk\" option in the browser builder instead."
178
178
  },
179
179
  "commonChunk": {
180
180
  "type": "boolean",
181
- "description": "Use a separate bundle containing code used across multiple bundles.",
181
+ "description": "Generate a seperate bundle containing code used across multiple bundles.",
182
182
  "x-deprecated": "Use the \"commonChunk\" option in the browser builder instead."
183
183
  },
184
184
  "baseHref": {
@@ -29,6 +29,10 @@ function getI18nOutfile(format) {
29
29
  case 'xlf2':
30
30
  case 'xliff2':
31
31
  return 'messages.xlf';
32
+ case 'json':
33
+ return 'messages.json';
34
+ case 'arb':
35
+ return 'messages.arb';
32
36
  default:
33
37
  throw new Error(`Unsupported format "${format}"`);
34
38
  }
@@ -50,6 +54,19 @@ async function getSerializer(format, sourceLocale, basePath, useLegacyIds) {
50
54
  const { Xliff2TranslationSerializer } = await Promise.resolve().then(() => require('@angular/localize/src/tools/src/extract/translation_files/xliff2_translation_serializer'));
51
55
  // tslint:disable-next-line: no-any
52
56
  return new Xliff2TranslationSerializer(sourceLocale, basePath, useLegacyIds, {});
57
+ case schema_1.Format.Json:
58
+ const { SimpleJsonTranslationSerializer } = await Promise.resolve().then(() => require('@angular/localize/src/tools/src/extract/translation_files/json_translation_serializer'));
59
+ // tslint:disable-next-line: no-any
60
+ return new SimpleJsonTranslationSerializer(sourceLocale);
61
+ case schema_1.Format.Arb:
62
+ const { ArbTranslationSerializer } = await Promise.resolve().then(() => require('@angular/localize/src/tools/src/extract/translation_files/arb_translation_serializer'));
63
+ const fileSystem = {
64
+ relative(from, to) {
65
+ return path.relative(from, to);
66
+ },
67
+ };
68
+ // tslint:disable-next-line: no-any
69
+ return new ArbTranslationSerializer(sourceLocale, basePath, fileSystem);
53
70
  }
54
71
  }
55
72
  function normalizeFormatOption(options) {
@@ -70,6 +87,12 @@ function normalizeFormatOption(options) {
70
87
  case schema_1.Format.Xliff2:
71
88
  format = schema_1.Format.Xlf2;
72
89
  break;
90
+ case schema_1.Format.Json:
91
+ format = schema_1.Format.Json;
92
+ break;
93
+ case schema_1.Format.Arb:
94
+ format = schema_1.Format.Arb;
95
+ break;
73
96
  case undefined:
74
97
  format = schema_1.Format.Xlf;
75
98
  break;
@@ -89,7 +112,7 @@ async function execute(options, context, transforms) {
89
112
  const browserOptions = await context.validateOptions(await context.getTargetOptions(browserTarget), await context.getBuilderNameForTarget(browserTarget));
90
113
  const format = normalizeFormatOption(options);
91
114
  // We need to determine the outFile name so that AngularCompiler can retrieve it.
92
- let outFile = options.outFile || getI18nOutfile(options.format);
115
+ let outFile = options.outFile || getI18nOutfile(format);
93
116
  if (options.outputPath) {
94
117
  // AngularCompilerPlugin doesn't support genDir so we have to adjust outFile instead.
95
118
  outFile = path.join(options.outputPath, outFile);
@@ -46,6 +46,8 @@ export interface Schema {
46
46
  * @deprecated Use 'format' option instead.
47
47
  */
48
48
  export declare enum Format {
49
+ Arb = "arb",
50
+ Json = "json",
49
51
  Xlf = "xlf",
50
52
  Xlf2 = "xlf2",
51
53
  Xlif = "xlif",
@@ -11,6 +11,8 @@ exports.Format = void 0;
11
11
  */
12
12
  var Format;
13
13
  (function (Format) {
14
+ Format["Arb"] = "arb";
15
+ Format["Json"] = "json";
14
16
  Format["Xlf"] = "xlf";
15
17
  Format["Xlf2"] = "xlf2";
16
18
  Format["Xlif"] = "xlif";
@@ -19,7 +19,9 @@
19
19
  "xlif",
20
20
  "xliff",
21
21
  "xlf2",
22
- "xliff2"
22
+ "xliff2",
23
+ "json",
24
+ "arb"
23
25
  ]
24
26
  },
25
27
  "i18nFormat": {
@@ -33,7 +35,9 @@
33
35
  "xlif",
34
36
  "xliff",
35
37
  "xlf2",
36
- "xliff2"
38
+ "xliff2",
39
+ "json",
40
+ "arb"
37
41
  ]
38
42
  },
39
43
  "i18nLocale": {
@@ -103,8 +103,7 @@
103
103
  },
104
104
  "watch": {
105
105
  "type": "boolean",
106
- "description": "Run build when files change.",
107
- "default": true
106
+ "description": "Run build when files change."
108
107
  },
109
108
  "poll": {
110
109
  "type": "number",
@@ -44,7 +44,7 @@ function execute(options, context, transforms = {}) {
44
44
  context.logger.warn(core_1.tags.stripIndent `
45
45
  Warning: Turning off 'bundleDependencies' with Ivy may result in undefined behaviour
46
46
  unless 'node_modules' are transformed using the standalone Angular compatibility compiler (NGCC).
47
- See: http://v9.angular.io/guide/ivy#ivy-and-universal-app-shell
47
+ See: https://angular.io/guide/ivy#ivy-and-universal-app-shell
48
48
  `);
49
49
  }
50
50
  }
@@ -39,6 +39,7 @@ export declare class BuilderHarness<T> {
39
39
  withBuilderTarget<O>(target: string, handler: BuilderHandlerFn<O & json.JsonObject>, options?: O, info?: Partial<BuilderInfo>): this;
40
40
  execute(options?: Partial<BuilderHarnessExecutionOptions>): Observable<BuilderHarnessExecutionResult>;
41
41
  executeOnce(options?: Partial<BuilderHarnessExecutionOptions>): Promise<BuilderHarnessExecutionResult>;
42
+ appendToFile(path: string, content: string): Promise<void>;
42
43
  writeFile(path: string, content: string | Buffer): Promise<void>;
43
44
  writeFiles(files: Record<string, string | Buffer>): Promise<void>;
44
45
  removeFile(path: string): Promise<void>;
@@ -168,6 +168,9 @@ class BuilderHarness {
168
168
  // Return the first result
169
169
  return this.execute(options).pipe(operators_1.first()).toPromise();
170
170
  }
171
+ async appendToFile(path, content) {
172
+ await this.writeFile(path, this.readFile(path).concat(content));
173
+ }
171
174
  async writeFile(path, content) {
172
175
  var _a;
173
176
  this.host
@@ -68,7 +68,7 @@ export interface BuildOptions {
68
68
  fileReplacements: NormalizedFileReplacement[];
69
69
  experimentalRollupPass?: boolean;
70
70
  allowedCommonJsDependencies?: string[];
71
- differentialLoadingMode?: boolean;
71
+ differentialLoadingNeeded?: boolean;
72
72
  }
73
73
  export interface WebpackTestOptions extends BuildOptions {
74
74
  codeCoverage?: boolean;
@@ -84,5 +84,5 @@ export interface WebpackConfigOptions<T = BuildOptions> {
84
84
  buildOptions: T;
85
85
  tsConfig: ParsedConfiguration;
86
86
  tsConfigPath: string;
87
- supportES2015: boolean;
87
+ scriptTarget: import('typescript').ScriptTarget;
88
88
  }
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.InlineFontsProcessor = void 0;
11
11
  const cacache = require("cacache");
12
12
  const https = require("https");
13
+ const proxyAgent = require("https-proxy-agent");
13
14
  const url_1 = require("url");
14
15
  const cache_path_1 = require("../cache-path");
15
16
  const environment_options_1 = require("../environment-options");
@@ -69,6 +70,7 @@ class InlineFontsProcessor {
69
70
  return transformedContent;
70
71
  }
71
72
  async getResponse(url, userAgent) {
73
+ var _a;
72
74
  const key = `${packageVersion}|${url}|${userAgent}`;
73
75
  if (cacheFontsPath) {
74
76
  const entry = await cacache.get.info(cacheFontsPath, key);
@@ -76,9 +78,16 @@ class InlineFontsProcessor {
76
78
  return fs_1.readFile(entry.path, 'utf8');
77
79
  }
78
80
  }
81
+ let agent;
82
+ const httpsProxy = (_a = process.env.HTTPS_PROXY) !== null && _a !== void 0 ? _a : process.env.https_proxy;
83
+ if (httpsProxy) {
84
+ agent = proxyAgent(httpsProxy);
85
+ }
79
86
  const data = await new Promise((resolve, reject) => {
80
87
  let rawResponse = '';
81
88
  https.get(url, {
89
+ agent,
90
+ rejectUnauthorized: false,
82
91
  headers: {
83
92
  'user-agent': userAgent,
84
93
  },
@@ -51,6 +51,9 @@ async function importParsers() {
51
51
  const localizeDiag = await Promise.resolve().then(() => require('@angular/localize/src/tools/src/diagnostics'));
52
52
  const diagnostics = new localizeDiag.Diagnostics();
53
53
  const parsers = {
54
+ arb: new (await Promise.resolve().then(() => require(
55
+ // tslint:disable-next-line:trailing-comma
56
+ '@angular/localize/src/tools/src/translate/translation_files/translation_parsers/arb_translation_parser'))).ArbTranslationParser(),
54
57
  json: new (await Promise.resolve().then(() => require(
55
58
  // tslint:disable-next-line:trailing-comma
56
59
  '@angular/localize/src/tools/src/translate/translation_files/translation_parsers/simple_json_translation_parser'))).SimpleJsonTranslationParser(),
@@ -41,7 +41,7 @@ async function generateWebpackConfig(workspaceRoot, projectRoot, sourceRoot, opt
41
41
  buildOptions,
42
42
  tsConfig,
43
43
  tsConfigPath,
44
- supportES2015,
44
+ scriptTarget,
45
45
  };
46
46
  wco.buildOptions.progress = utils_1.defaultProgress(wco.buildOptions.progress);
47
47
  const webpackConfig = webpack_merge_1.merge(webpackPartialGenerator(wco));
@@ -63,7 +63,7 @@ async function generateWebpackConfig(workspaceRoot, projectRoot, sourceRoot, opt
63
63
  }
64
64
  }
65
65
  if (environment_options_1.profilingEnabled) {
66
- const esVersionInFileName = helpers_1.getEsVersionForFileName(tsConfig.options.target, buildOptions.differentialLoadingMode);
66
+ const esVersionInFileName = helpers_1.getEsVersionForFileName(tsConfig.options.target, buildOptions.differentialLoadingNeeded);
67
67
  const SpeedMeasurePlugin = await Promise.resolve().then(() => require('speed-measure-webpack-plugin'));
68
68
  const smp = new SpeedMeasurePlugin({
69
69
  outputFormat: 'json',
@@ -28,7 +28,7 @@ function getBrowserConfig(wco) {
28
28
  }));
29
29
  }
30
30
  if (scriptsSourceMap || stylesSourceMap) {
31
- extraPlugins.push(helpers_1.getSourceMapDevTool(scriptsSourceMap, stylesSourceMap, buildOptions.differentialLoadingMode ? true : hiddenSourceMap, false));
31
+ extraPlugins.push(helpers_1.getSourceMapDevTool(scriptsSourceMap, stylesSourceMap, buildOptions.differentialLoadingNeeded && !buildOptions.watch ? true : hiddenSourceMap, false));
32
32
  }
33
33
  let crossOriginLoading = false;
34
34
  if (subresourceIntegrity && crossOrigin === 'none') {
@@ -35,7 +35,7 @@ function getCommonConfig(wco) {
35
35
  const entryPoints = {};
36
36
  // determine hashing format
37
37
  const hashFormat = helpers_1.getOutputHashFormat(buildOptions.outputHashing || 'none');
38
- const targetInFileName = helpers_1.getEsVersionForFileName(tsConfig.options.target, buildOptions.differentialLoadingMode);
38
+ const targetInFileName = helpers_1.getEsVersionForFileName(tsConfig.options.target, buildOptions.differentialLoadingNeeded);
39
39
  if (buildOptions.main) {
40
40
  const mainPath = path.resolve(root, buildOptions.main);
41
41
  entryPoints['main'] = [mainPath];
@@ -78,7 +78,7 @@ function getCommonConfig(wco) {
78
78
  });
79
79
  }
80
80
  }
81
- const differentialLoadingMode = buildOptions.differentialLoadingMode;
81
+ const differentialLoadingMode = buildOptions.differentialLoadingNeeded && !buildOptions.watch;
82
82
  if (platform !== 'server') {
83
83
  if (differentialLoadingMode || tsConfig.options.target === typescript_1.ScriptTarget.ES5) {
84
84
  const buildBrowserFeatures = new utils_1.BuildBrowserFeatures(projectRoot);
@@ -439,35 +439,19 @@ function getCommonConfig(wco) {
439
439
  sideEffects: true,
440
440
  },
441
441
  {
442
- test: /\.m?js$/,
442
+ test: /\.[cm]?js$/,
443
443
  exclude: [/[\/\\](?:core-js|\@babel|tslib|web-animations-js)[\/\\]/, /(ngfactory|ngstyle)\.js$/],
444
444
  use: [
445
- ...(wco.supportES2015
446
- ? []
447
- : [
448
- {
449
- loader: require.resolve('babel-loader'),
450
- options: {
451
- babelrc: false,
452
- configFile: false,
453
- compact: false,
454
- cacheCompression: false,
455
- cacheDirectory: cache_path_1.findCachePath('babel-webpack'),
456
- cacheIdentifier: JSON.stringify({
457
- buildAngular: require('../../../package.json').version,
458
- }),
459
- sourceType: 'unambiguous',
460
- presets: [
461
- [
462
- require.resolve('../../babel/presets/application'),
463
- {
464
- forceES5: true,
465
- },
466
- ],
467
- ],
468
- },
469
- },
470
- ]),
445
+ {
446
+ loader: require.resolve('../../babel/webpack-loader'),
447
+ options: {
448
+ cacheDirectory: cache_path_1.findCachePath('babel-webpack'),
449
+ cacheIdentifier: JSON.stringify({
450
+ buildAngular: require('../../../package.json').version,
451
+ }),
452
+ scriptTarget: wco.scriptTarget,
453
+ },
454
+ },
471
455
  ...buildOptimizerUseRule,
472
456
  ],
473
457
  },
@@ -109,6 +109,7 @@ function getStylesConfig(wco) {
109
109
  {
110
110
  loader: require.resolve('less-loader'),
111
111
  options: {
112
+ implementation: require('less'),
112
113
  sourceMap: cssSourceMap,
113
114
  lessOptions: {
114
115
  javascriptEnabled: true,
@@ -186,6 +187,7 @@ function getStylesConfig(wco) {
186
187
  {
187
188
  loader: require.resolve('postcss-loader'),
188
189
  options: {
190
+ implementation: require('postcss'),
189
191
  postcssOptions: postcssOptionsCreator(componentsSourceMap, false),
190
192
  },
191
193
  },
@@ -215,6 +217,7 @@ function getStylesConfig(wco) {
215
217
  {
216
218
  loader: require.resolve('postcss-loader'),
217
219
  options: {
220
+ implementation: require('postcss'),
218
221
  postcssOptions: postcssOptionsCreator(globalSourceMap, buildOptions.extractCss),
219
222
  },
220
223
  },
@@ -32,6 +32,10 @@ import 'core-js/modules/es.object.assign';
32
32
  import 'core-js/modules/es.object.is';
33
33
  import 'core-js/modules/es.object.set-prototype-of';
34
34
  import 'core-js/modules/es.object.to-string';
35
+ import 'core-js/modules/es.object.entries';
36
+ import 'core-js/modules/es.object.values';
37
+ import 'core-js/modules/es.object.get-own-property-descriptors';
38
+ import 'core-js/modules/es.object.from-entries';
35
39
 
36
40
  // ES2015 array capabilities
37
41
  import 'core-js/modules/es.array.concat';
@@ -56,6 +60,9 @@ import 'core-js/modules/es.array.fill';
56
60
  import 'core-js/modules/es.array.find';
57
61
  import 'core-js/modules/es.array.find-index';
58
62
  import 'core-js/modules/es.array.iterator';
63
+ import 'core-js/modules/es.array.includes';
64
+ import 'core-js/modules/es.array.flat';
65
+ import 'core-js/modules/es.array.flat-map';
59
66
 
60
67
  // ES2015 string capabilities
61
68
  import 'core-js/modules/es.string.from-code-point';
@@ -71,6 +71,7 @@ class ScriptsWebpackPlugin {
71
71
  compilation.chunks.push(chunk);
72
72
  }
73
73
  compilation.assets[filename] = source;
74
+ compilation.hooks.chunkAsset.call(chunk, filename);
74
75
  }
75
76
  apply(compiler) {
76
77
  if (!this.options.scripts || this.options.scripts.length === 0) {