@angular-devkit/build-angular 0.1101.0-next.2 → 0.1101.0

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 (42) hide show
  1. package/package.json +28 -28
  2. package/src/babel/babel-loader.d.ts +24 -0
  3. package/src/babel/presets/application.d.ts +2 -1
  4. package/src/babel/presets/application.js +30 -0
  5. package/src/babel/webpack-loader.d.ts +2 -0
  6. package/src/babel/webpack-loader.js +114 -0
  7. package/src/browser/index.js +3 -4
  8. package/src/browser/schema.d.ts +9 -6
  9. package/src/browser/schema.json +4 -4
  10. package/src/browser/tests/setup.d.ts +18 -0
  11. package/src/browser/tests/setup.js +20 -0
  12. package/src/dev-server/schema.d.ts +9 -8
  13. package/src/dev-server/schema.json +4 -4
  14. package/src/extract-i18n/index.js +24 -1
  15. package/src/extract-i18n/schema.d.ts +2 -0
  16. package/src/extract-i18n/schema.js +2 -0
  17. package/src/extract-i18n/schema.json +6 -2
  18. package/src/karma/schema.d.ts +4 -2
  19. package/src/karma/schema.json +1 -1
  20. package/src/server/index.js +1 -1
  21. package/src/server/schema.d.ts +6 -4
  22. package/src/server/schema.json +2 -2
  23. package/src/testing/builder-harness.d.ts +50 -0
  24. package/src/testing/builder-harness.js +307 -0
  25. package/src/testing/file-watching.d.ts +19 -0
  26. package/src/testing/file-watching.js +34 -0
  27. package/src/testing/index.d.ts +9 -0
  28. package/src/testing/index.js +5 -0
  29. package/src/testing/jasmine-helpers.d.ts +26 -0
  30. package/src/testing/jasmine-helpers.js +86 -0
  31. package/src/utils/build-options.d.ts +2 -2
  32. package/src/utils/load-translations.js +3 -0
  33. package/src/utils/webpack-browser-config.js +12 -2
  34. package/src/webpack/configs/browser.js +1 -1
  35. package/src/webpack/configs/common.js +14 -30
  36. package/src/webpack/configs/styles.js +3 -0
  37. package/src/webpack/es5-polyfills.js +7 -0
  38. package/src/webpack/plugins/builder-watch-plugin.d.ts +51 -0
  39. package/src/webpack/plugins/builder-watch-plugin.js +103 -0
  40. package/src/webpack/plugins/hmr/hmr-accept.js +4 -0
  41. package/src/webpack/plugins/karma.d.ts +0 -7
  42. package/src/webpack/plugins/karma.js +14 -23
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "0.1101.0-next.2",
3
+ "version": "0.1101.0",
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.2",
11
- "@angular-devkit/build-optimizer": "0.1101.0-next.2",
12
- "@angular-devkit/build-webpack": "0.1101.0-next.2",
13
- "@angular-devkit/core": "11.1.0-next.2",
14
- "@babel/core": "7.12.9",
15
- "@babel/generator": "7.12.5",
16
- "@babel/plugin-transform-runtime": "7.12.1",
17
- "@babel/preset-env": "7.12.7",
10
+ "@angular-devkit/architect": "0.1101.0",
11
+ "@angular-devkit/build-optimizer": "0.1101.0",
12
+ "@angular-devkit/build-webpack": "0.1101.0",
13
+ "@angular-devkit/core": "11.1.0",
14
+ "@babel/core": "7.12.10",
15
+ "@babel/generator": "7.12.11",
16
+ "@babel/plugin-transform-runtime": "7.12.10",
17
+ "@babel/preset-env": "7.12.11",
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.2",
21
+ "@ngtools/webpack": "11.1.0",
22
22
  "ansi-colors": "4.1.1",
23
- "autoprefixer": "10.0.4",
23
+ "autoprefixer": "10.2.1",
24
24
  "babel-loader": "8.2.2",
25
25
  "browserslist": "^4.9.1",
26
26
  "cacache": "15.0.5",
27
27
  "caniuse-lite": "^1.0.30001032",
28
28
  "circular-dependency-plugin": "5.2.2",
29
29
  "copy-webpack-plugin": "6.3.2",
30
- "core-js": "3.8.1",
30
+ "core-js": "3.8.2",
31
31
  "critters": "0.0.6",
32
32
  "css-loader": "5.0.1",
33
33
  "cssnano": "4.1.10",
@@ -37,43 +37,43 @@
37
37
  "inquirer": "7.3.3",
38
38
  "jest-worker": "26.6.2",
39
39
  "karma-source-map-support": "1.4.0",
40
- "less": "3.12.2",
41
- "less-loader": "7.1.0",
42
- "license-webpack-plugin": "2.3.1",
40
+ "less": "4.1.0",
41
+ "less-loader": "7.2.1",
42
+ "license-webpack-plugin": "2.3.11",
43
43
  "loader-utils": "2.0.0",
44
- "mini-css-extract-plugin": "1.3.1",
44
+ "mini-css-extract-plugin": "1.3.3",
45
45
  "minimatch": "3.0.4",
46
- "open": "7.3.0",
47
- "ora": "5.1.0",
46
+ "open": "7.3.1",
47
+ "ora": "5.2.0",
48
48
  "parse5-html-rewriting-stream": "6.0.1",
49
49
  "pnp-webpack-plugin": "1.6.4",
50
- "postcss": "8.1.10",
51
- "postcss-import": "13.0.0",
50
+ "postcss": "8.2.4",
51
+ "postcss-import": "14.0.0",
52
52
  "postcss-loader": "4.1.0",
53
53
  "raw-loader": "4.0.2",
54
54
  "regenerator-runtime": "0.13.7",
55
55
  "resolve-url-loader": "3.1.2",
56
56
  "rimraf": "3.0.2",
57
- "rollup": "2.34.0",
57
+ "rollup": "2.36.1",
58
58
  "rxjs": "6.6.3",
59
- "sass": "1.29.0",
60
- "sass-loader": "10.1.0",
61
- "semver": "7.3.2",
59
+ "sass": "1.32.4",
60
+ "sass-loader": "10.1.1",
61
+ "semver": "7.3.4",
62
62
  "source-map": "0.7.3",
63
- "source-map-loader": "1.1.2",
63
+ "source-map-loader": "1.1.3",
64
64
  "source-map-support": "0.5.19",
65
65
  "speed-measure-webpack-plugin": "1.3.3",
66
66
  "style-loader": "2.0.0",
67
67
  "stylus": "0.54.8",
68
- "stylus-loader": "4.3.1",
68
+ "stylus-loader": "4.3.2",
69
69
  "terser": "5.5.1",
70
70
  "terser-webpack-plugin": "4.2.3",
71
71
  "text-table": "0.2.0",
72
72
  "tree-kill": "1.2.2",
73
73
  "webpack": "4.44.2",
74
74
  "webpack-dev-middleware": "3.7.2",
75
- "webpack-dev-server": "3.11.0",
76
- "webpack-merge": "5.4.0",
75
+ "webpack-dev-server": "3.11.1",
76
+ "webpack-merge": "5.7.3",
77
77
  "webpack-sources": "2.2.0",
78
78
  "webpack-subresource-integrity": "1.5.2",
79
79
  "worker-plugin": "5.0.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
  /**
@@ -115,7 +115,7 @@ export interface Schema {
115
115
  * Enables optimization of the build output. Including minification of scripts and styles,
116
116
  * tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For
117
117
  * more information, see
118
- * https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.
118
+ * https://angular.io/guide/workspace-config#optimization-configuration.
119
119
  */
120
120
  optimization?: OptimizationUnion;
121
121
  /**
@@ -162,7 +162,8 @@ export interface Schema {
162
162
  */
163
163
  showCircularDependencies?: boolean;
164
164
  /**
165
- * Output source maps.
165
+ * Output source maps for scripts and styles. For more information, see
166
+ * https://angular.io/guide/workspace-config#source-map-configuration.
166
167
  */
167
168
  sourceMap?: SourceMapUnion;
168
169
  /**
@@ -187,7 +188,8 @@ export interface Schema {
187
188
  */
188
189
  tsConfig: string;
189
190
  /**
190
- * 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.
191
193
  */
192
194
  vendorChunk?: boolean;
193
195
  /**
@@ -322,7 +324,7 @@ export declare type Localize = string[] | boolean;
322
324
  * Enables optimization of the build output. Including minification of scripts and styles,
323
325
  * tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For
324
326
  * more information, see
325
- * https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.
327
+ * https://angular.io/guide/workspace-config#optimization-configuration.
326
328
  */
327
329
  export declare type OptimizationUnion = boolean | OptimizationClass;
328
330
  export interface OptimizationClass {
@@ -390,7 +392,8 @@ export interface ExtraEntryPointClass {
390
392
  input: string;
391
393
  }
392
394
  /**
393
- * Output source maps.
395
+ * Output source maps for scripts and styles. For more information, see
396
+ * https://angular.io/guide/workspace-config#source-map-configuration.
394
397
  */
395
398
  export declare type SourceMapUnion = boolean | SourceMapClass;
396
399
  export interface SourceMapClass {
@@ -57,7 +57,7 @@
57
57
  "additionalProperties": false
58
58
  },
59
59
  "optimization": {
60
- "description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.",
60
+ "description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration.",
61
61
  "x-user-analytics": 16,
62
62
  "default": false,
63
63
  "oneOf": [
@@ -146,7 +146,7 @@
146
146
  "default": false
147
147
  },
148
148
  "sourceMap": {
149
- "description": "Output source maps.",
149
+ "description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.",
150
150
  "default": true,
151
151
  "oneOf": [
152
152
  {
@@ -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": {
@@ -0,0 +1,18 @@
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
+ import { Schema } from '../schema';
9
+ export { describeBuilder } from '../../testing';
10
+ export declare const BROWSER_BUILDER_INFO: Readonly<{
11
+ name: string;
12
+ schemaPath: string;
13
+ }>;
14
+ /**
15
+ * Contains all required browser builder fields.
16
+ * Also disables progress reporting to minimize logging output.
17
+ */
18
+ export declare const BASE_OPTIONS: Readonly<Schema>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BASE_OPTIONS = exports.BROWSER_BUILDER_INFO = exports.describeBuilder = void 0;
4
+ var testing_1 = require("../../testing");
5
+ Object.defineProperty(exports, "describeBuilder", { enumerable: true, get: function () { return testing_1.describeBuilder; } });
6
+ exports.BROWSER_BUILDER_INFO = Object.freeze({
7
+ name: '@angular-devkit/build-angular:browser',
8
+ schemaPath: __dirname + '/../schema.json',
9
+ });
10
+ /**
11
+ * Contains all required browser builder fields.
12
+ * Also disables progress reporting to minimize logging output.
13
+ */
14
+ exports.BASE_OPTIONS = Object.freeze({
15
+ index: 'src/index.html',
16
+ main: 'src/main.ts',
17
+ outputPath: 'dist',
18
+ tsConfig: 'src/tsconfig.app.json',
19
+ progress: false,
20
+ });
@@ -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;
@@ -66,8 +66,7 @@ export interface Schema {
66
66
  /**
67
67
  * Enables optimization of the build output. Including minification of scripts and styles,
68
68
  * tree-shaking, dead-code elimination, tree-shaking and fonts inlining. For more
69
- * information, see
70
- * https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.
69
+ * information, see https://angular.io/guide/workspace-config#optimization-configuration.
71
70
  * @deprecated Use the "optimization" option in the browser builder instead.
72
71
  */
73
72
  optimization?: OptimizationUnion;
@@ -104,7 +103,8 @@ export interface Schema {
104
103
  */
105
104
  servePathDefaultWarning?: boolean;
106
105
  /**
107
- * Output source maps.
106
+ * Output source maps for scripts and styles. For more information, see
107
+ * https://angular.io/guide/workspace-config#source-map-configuration.
108
108
  * @deprecated Use the "sourceMap" option in the browser builder instead.
109
109
  */
110
110
  sourceMap?: SourceMapUnion;
@@ -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;
@@ -137,8 +138,7 @@ export interface Schema {
137
138
  /**
138
139
  * Enables optimization of the build output. Including minification of scripts and styles,
139
140
  * tree-shaking, dead-code elimination, tree-shaking and fonts inlining. For more
140
- * information, see
141
- * https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.
141
+ * information, see https://angular.io/guide/workspace-config#optimization-configuration.
142
142
  * @deprecated Use the "optimization" option in the browser builder instead.
143
143
  */
144
144
  export declare type OptimizationUnion = boolean | OptimizationClass;
@@ -153,7 +153,8 @@ export interface OptimizationClass {
153
153
  styles?: boolean;
154
154
  }
155
155
  /**
156
- * Output source maps.
156
+ * Output source maps for scripts and styles. For more information, see
157
+ * https://angular.io/guide/workspace-config#source-map-configuration.
157
158
  * @deprecated Use the "sourceMap" option in the browser builder instead.
158
159
  */
159
160
  export declare type SourceMapUnion = boolean | SourceMapClass;
@@ -105,7 +105,7 @@
105
105
  "x-deprecated": "No longer has an effect."
106
106
  },
107
107
  "optimization": {
108
- "description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, tree-shaking and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-and-source-map-configuration.",
108
+ "description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, tree-shaking and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration.",
109
109
  "x-user-analytics": 16,
110
110
  "oneOf": [
111
111
  {
@@ -137,7 +137,7 @@
137
137
  "x-deprecated": "Use the \"aot\" option in the browser builder instead."
138
138
  },
139
139
  "sourceMap": {
140
- "description": "Output source maps.",
140
+ "description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.",
141
141
  "oneOf": [
142
142
  {
143
143
  "type": "object",
@@ -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";