@angular-devkit/build-angular 12.1.0-next.3 → 12.1.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 (95) hide show
  1. package/package.json +40 -39
  2. package/src/app-shell/index.js +28 -8
  3. package/src/babel/plugins/adjust-static-class-members.d.ts +25 -0
  4. package/src/babel/plugins/adjust-static-class-members.js +251 -0
  5. package/src/babel/plugins/adjust-typescript-enums.d.ts +21 -0
  6. package/src/babel/plugins/adjust-typescript-enums.js +123 -0
  7. package/src/babel/plugins/elide-angular-metadata.d.ts +21 -0
  8. package/src/babel/plugins/elide-angular-metadata.js +68 -0
  9. package/src/babel/plugins/pure-toplevel-functions.d.ts +14 -0
  10. package/src/babel/plugins/pure-toplevel-functions.js +86 -0
  11. package/src/babel/presets/application.d.ts +1 -0
  12. package/src/babel/presets/application.js +23 -3
  13. package/src/babel/webpack-loader.js +39 -1
  14. package/src/browser/index.d.ts +1 -4
  15. package/src/browser/index.js +26 -36
  16. package/src/browser/schema.d.ts +1 -1
  17. package/src/browser/schema.json +1 -1
  18. package/src/dev-server/index.d.ts +1 -1
  19. package/src/dev-server/index.js +68 -47
  20. package/src/dev-server/tests/execute-fetch.js +4 -1
  21. package/src/extract-i18n/empty-loader.d.ts +8 -0
  22. package/src/extract-i18n/empty-loader.js +13 -0
  23. package/src/extract-i18n/index.d.ts +1 -1
  24. package/src/extract-i18n/index.js +46 -18
  25. package/src/extract-i18n/ivy-extract-loader.js +20 -1
  26. package/src/karma/find-tests.js +20 -1
  27. package/src/karma/index.js +21 -1
  28. package/src/karma/schema.d.ts +1 -1
  29. package/src/karma/schema.json +1 -1
  30. package/src/karma/tests/setup.d.ts +18 -0
  31. package/src/karma/tests/setup.js +29 -0
  32. package/src/ng-packagr/index.js +21 -2
  33. package/src/protractor/index.js +21 -2
  34. package/src/sass/sass-service.d.ts +0 -3
  35. package/src/sass/sass-service.js +8 -9
  36. package/src/sass/worker.js +4 -2
  37. package/src/server/index.d.ts +1 -1
  38. package/src/server/index.js +20 -1
  39. package/src/server/schema.d.ts +1 -1
  40. package/src/server/schema.json +1 -1
  41. package/src/tslint/index.js +22 -3
  42. package/src/typings.d.ts +6 -0
  43. package/src/utils/action-cache.js +21 -2
  44. package/src/utils/action-executor.js +21 -2
  45. package/src/utils/build-browser-features.js +25 -3
  46. package/src/utils/cache-path.js +5 -2
  47. package/src/utils/check-port.js +20 -1
  48. package/src/utils/color.js +20 -1
  49. package/src/utils/copy-assets.js +26 -4
  50. package/src/utils/copy-file.js +20 -1
  51. package/src/utils/delete-output-dir.js +2 -2
  52. package/src/utils/environment-options.d.ts +1 -0
  53. package/src/utils/environment-options.js +26 -2
  54. package/src/utils/find-up.js +20 -1
  55. package/src/utils/i18n-inlining.js +21 -2
  56. package/src/utils/i18n-options.js +23 -5
  57. package/src/utils/index-file/html-rewriting-stream.js +20 -1
  58. package/src/utils/index-file/index-html-generator.js +20 -1
  59. package/src/utils/index-file/inline-critical-css.js +20 -1
  60. package/src/utils/index-file/inline-fonts.js +27 -5
  61. package/src/utils/is-directory.js +20 -1
  62. package/src/utils/load-translations.js +26 -7
  63. package/src/utils/process-bundle.js +34 -12
  64. package/src/utils/read-tsconfig.js +20 -1
  65. package/src/utils/service-worker.js +21 -2
  66. package/src/utils/spinner.d.ts +2 -0
  67. package/src/utils/spinner.js +18 -2
  68. package/src/utils/webpack-browser-config.js +21 -2
  69. package/src/webpack/configs/analytics.d.ts +11 -0
  70. package/src/webpack/configs/analytics.js +29 -0
  71. package/src/webpack/configs/common.js +96 -45
  72. package/src/webpack/configs/dev-server.js +20 -1
  73. package/src/webpack/configs/index.d.ts +1 -0
  74. package/src/webpack/configs/index.js +1 -0
  75. package/src/webpack/configs/server.js +8 -0
  76. package/src/webpack/configs/stats.d.ts +6 -14
  77. package/src/webpack/configs/stats.js +5 -8
  78. package/src/webpack/configs/styles.js +28 -2
  79. package/src/webpack/configs/test.js +32 -3
  80. package/src/webpack/configs/typescript.d.ts +2 -9
  81. package/src/webpack/configs/typescript.js +16 -14
  82. package/src/webpack/plugins/any-component-style-budget-checker.js +20 -1
  83. package/src/webpack/plugins/builder-watch-plugin.d.ts +0 -2
  84. package/src/webpack/plugins/builder-watch-plugin.js +2 -7
  85. package/src/webpack/plugins/index.js +4 -1
  86. package/src/webpack/plugins/karma/karma-context.html +1 -1
  87. package/src/webpack/plugins/karma/karma-debug.html +1 -1
  88. package/src/webpack/plugins/karma/karma.js +27 -5
  89. package/src/webpack/plugins/postcss-cli-resources.js +21 -2
  90. package/src/webpack/plugins/scripts-webpack-plugin.js +20 -1
  91. package/src/webpack/utils/async-chunks.js +9 -5
  92. package/src/webpack/utils/helpers.js +20 -1
  93. package/src/webpack/utils/stats.d.ts +2 -3
  94. package/src/webpack/utils/stats.js +50 -15
  95. package/src/extract-i18n/empty-export-default.js +0 -1
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ export default function (): string;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ function default_1() {
11
+ return `export default '';`;
12
+ }
13
+ exports.default = default_1;
@@ -8,7 +8,7 @@
8
8
  import { BuilderContext } from '@angular-devkit/architect';
9
9
  import { BuildResult } from '@angular-devkit/build-webpack';
10
10
  import { JsonObject } from '@angular-devkit/core';
11
- import * as webpack from 'webpack';
11
+ import webpack from 'webpack';
12
12
  import { ExecutionTransformer } from '../transforms';
13
13
  import { Schema } from './schema';
14
14
  export declare type ExtractI18nBuilderOptions = Schema & JsonObject;
@@ -6,13 +6,35 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ var __importDefault = (this && this.__importDefault) || function (mod) {
29
+ return (mod && mod.__esModule) ? mod : { "default": mod };
30
+ };
9
31
  Object.defineProperty(exports, "__esModule", { value: true });
10
32
  exports.execute = void 0;
11
33
  const architect_1 = require("@angular-devkit/architect");
12
34
  const build_webpack_1 = require("@angular-devkit/build-webpack");
13
- const fs = require("fs");
14
- const path = require("path");
15
- const webpack = require("webpack");
35
+ const fs = __importStar(require("fs"));
36
+ const path = __importStar(require("path"));
37
+ const webpack_1 = __importDefault(require("webpack"));
16
38
  const schema_1 = require("../browser/schema");
17
39
  const i18n_options_1 = require("../utils/i18n-options");
18
40
  const version_1 = require("../utils/version");
@@ -42,28 +64,28 @@ function getI18nOutfile(format) {
42
64
  async function getSerializer(format, sourceLocale, basePath, useLegacyIds, diagnostics) {
43
65
  switch (format) {
44
66
  case schema_2.Format.Xmb:
45
- const { XmbTranslationSerializer } = await Promise.resolve().then(() => require('@angular/localize/src/tools/src/extract/translation_files/xmb_translation_serializer'));
67
+ const { XmbTranslationSerializer } = await Promise.resolve().then(() => __importStar(require('@angular/localize/src/tools/src/extract/translation_files/xmb_translation_serializer')));
46
68
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
69
  return new XmbTranslationSerializer(basePath, useLegacyIds);
48
70
  case schema_2.Format.Xlf:
49
71
  case schema_2.Format.Xlif:
50
72
  case schema_2.Format.Xliff:
51
- const { Xliff1TranslationSerializer } = await Promise.resolve().then(() => require('@angular/localize/src/tools/src/extract/translation_files/xliff1_translation_serializer'));
73
+ const { Xliff1TranslationSerializer } = await Promise.resolve().then(() => __importStar(require('@angular/localize/src/tools/src/extract/translation_files/xliff1_translation_serializer')));
52
74
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
75
  return new Xliff1TranslationSerializer(sourceLocale, basePath, useLegacyIds, {});
54
76
  case schema_2.Format.Xlf2:
55
77
  case schema_2.Format.Xliff2:
56
- const { Xliff2TranslationSerializer } = await Promise.resolve().then(() => require('@angular/localize/src/tools/src/extract/translation_files/xliff2_translation_serializer'));
78
+ const { Xliff2TranslationSerializer } = await Promise.resolve().then(() => __importStar(require('@angular/localize/src/tools/src/extract/translation_files/xliff2_translation_serializer')));
57
79
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
80
  return new Xliff2TranslationSerializer(sourceLocale, basePath, useLegacyIds, {});
59
81
  case schema_2.Format.Json:
60
- const { SimpleJsonTranslationSerializer } = await Promise.resolve().then(() => require('@angular/localize/src/tools/src/extract/translation_files/json_translation_serializer'));
82
+ const { SimpleJsonTranslationSerializer } = await Promise.resolve().then(() => __importStar(require('@angular/localize/src/tools/src/extract/translation_files/json_translation_serializer')));
61
83
  return new SimpleJsonTranslationSerializer(sourceLocale);
62
84
  case schema_2.Format.LegacyMigrate:
63
- const { LegacyMessageIdMigrationSerializer } = await Promise.resolve().then(() => require('@angular/localize/src/tools/src/extract/translation_files/legacy_message_id_migration_serializer'));
85
+ const { LegacyMessageIdMigrationSerializer } = await Promise.resolve().then(() => __importStar(require('@angular/localize/src/tools/src/extract/translation_files/legacy_message_id_migration_serializer')));
64
86
  return new LegacyMessageIdMigrationSerializer(diagnostics);
65
87
  case schema_2.Format.Arb:
66
- const { ArbTranslationSerializer } = await Promise.resolve().then(() => require('@angular/localize/src/tools/src/extract/translation_files/arb_translation_serializer'));
88
+ const { ArbTranslationSerializer } = await Promise.resolve().then(() => __importStar(require('@angular/localize/src/tools/src/extract/translation_files/arb_translation_serializer')));
67
89
  const fileSystem = {
68
90
  relative(from, to) {
69
91
  return path.relative(from, to);
@@ -118,7 +140,7 @@ async function execute(options, context, transforms) {
118
140
  const i18n = i18n_options_1.createI18nOptions(metadata);
119
141
  let useLegacyIds = true;
120
142
  const ivyMessages = [];
121
- const { config, projectRoot } = await webpack_browser_config_1.generateBrowserWebpackConfigFromContext({
143
+ const builderOptions = {
122
144
  ...browserOptions,
123
145
  optimization: false,
124
146
  sourceMap: {
@@ -138,7 +160,8 @@ async function execute(options, context, transforms) {
138
160
  subresourceIntegrity: false,
139
161
  outputHashing: schema_1.OutputHashing.None,
140
162
  namedChunks: true,
141
- }, context, (wco) => {
163
+ };
164
+ const { config, projectRoot } = await webpack_browser_config_1.generateBrowserWebpackConfigFromContext(builderOptions, context, (wco) => {
142
165
  var _a;
143
166
  if (wco.tsConfig.options.enableIvy === false) {
144
167
  context.logger.warn('Ivy extraction enabled but application is not Ivy enabled. Extraction may fail.');
@@ -167,11 +190,16 @@ async function execute(options, context, transforms) {
167
190
  ],
168
191
  },
169
192
  });
170
- // Replace all stylesheets with an empty default export
193
+ // Replace all stylesheets with empty content
171
194
  partials.push({
172
- plugins: [
173
- new webpack.NormalModuleReplacementPlugin(/\.(css|scss|sass|styl|less)$/, path.join(__dirname, 'empty-export-default.js')),
174
- ],
195
+ module: {
196
+ rules: [
197
+ {
198
+ test: /\.(css|scss|sass|styl|less)$/,
199
+ loader: require.resolve('./empty-loader'),
200
+ },
201
+ ],
202
+ },
175
203
  });
176
204
  return partials;
177
205
  });
@@ -186,8 +214,8 @@ async function execute(options, context, transforms) {
186
214
  };
187
215
  }
188
216
  const webpackResult = await build_webpack_1.runWebpack((await ((_a = transforms === null || transforms === void 0 ? void 0 : transforms.webpackConfiguration) === null || _a === void 0 ? void 0 : _a.call(transforms, config))) || config, context, {
189
- logging: stats_1.createWebpackLoggingCallback(false, context.logger),
190
- webpackFactory: webpack,
217
+ logging: stats_1.createWebpackLoggingCallback(builderOptions, context.logger),
218
+ webpackFactory: webpack_1.default,
191
219
  }).toPromise();
192
220
  // Set the outputPath to the extraction output location for downstream consumers
193
221
  webpackResult.outputPath = outFile;
@@ -196,7 +224,7 @@ async function execute(options, context, transforms) {
196
224
  return webpackResult;
197
225
  }
198
226
  const basePath = config.context || projectRoot;
199
- const { checkDuplicateMessages } = await Promise.resolve().then(() => require('@angular/localize/src/tools/src/extract/duplicates'));
227
+ const { checkDuplicateMessages } = await Promise.resolve().then(() => __importStar(require('@angular/localize/src/tools/src/extract/duplicates')));
200
228
  // The filesystem is used to create a relative path for each file
201
229
  // from the basePath. This relative path is then used in the error message.
202
230
  const checkFileSystem = {
@@ -6,10 +6,29 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
9
28
  Object.defineProperty(exports, "__esModule", { value: true });
10
29
  const extraction_1 = require("@angular/localize/src/tools/src/extract/extraction");
11
30
  const loader_utils_1 = require("loader-utils");
12
- const nodePath = require("path");
31
+ const nodePath = __importStar(require("path"));
13
32
  function localizeExtractLoader(content,
14
33
  // Source map types are broken in the webpack type definitions
15
34
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -6,10 +6,29 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
9
28
  Object.defineProperty(exports, "__esModule", { value: true });
10
29
  exports.findTests = void 0;
11
30
  const fs_1 = require("fs");
12
- const glob = require("glob");
31
+ const glob = __importStar(require("glob"));
13
32
  const path_1 = require("path");
14
33
  const is_directory_1 = require("../utils/is-directory");
15
34
  // go through all patterns and find unique list of files
@@ -6,6 +6,25 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
9
28
  Object.defineProperty(exports, "__esModule", { value: true });
10
29
  exports.execute = void 0;
11
30
  const architect_1 = require("@angular-devkit/architect");
@@ -40,6 +59,7 @@ async function initialize(options, context, webpackConfigurationTransformer) {
40
59
  // https://github.com/webpack/webpack-dev-middleware/blob/698c9ae5e9bb9a013985add6189ff21c1a1ec185/src/index.js#L65
41
60
  // https://github.com/webpack/webpack/blob/cde1b73e12eb8a77eb9ba42e7920c9ec5d29c2c9/lib/Compiler.js#L379-L388
42
61
  watch: true,
62
+ extractCss: true,
43
63
  }, context, (wco) => [
44
64
  configs_1.getCommonConfig(wco),
45
65
  configs_1.getStylesConfig(wco),
@@ -47,7 +67,7 @@ async function initialize(options, context, webpackConfigurationTransformer) {
47
67
  configs_1.getTestConfig(wco),
48
68
  configs_1.getWorkerConfig(wco),
49
69
  ]);
50
- const karma = await Promise.resolve().then(() => require('karma'));
70
+ const karma = await Promise.resolve().then(() => __importStar(require('karma')));
51
71
  return [
52
72
  karma,
53
73
  webpackConfigurationTransformer ? await webpackConfigurationTransformer(config) : config,
@@ -167,7 +167,7 @@ export interface SourceMapClass {
167
167
  */
168
168
  export interface StylePreprocessorOptions {
169
169
  /**
170
- * Paths to include. Paths will be resolved to project root.
170
+ * Paths to include. Paths will be resolved to workspace root.
171
171
  */
172
172
  includePaths?: string[];
173
173
  }
@@ -55,7 +55,7 @@
55
55
  "type": "object",
56
56
  "properties": {
57
57
  "includePaths": {
58
- "description": "Paths to include. Paths will be resolved to project root.",
58
+ "description": "Paths to include. Paths will be resolved to workspace root.",
59
59
  "type": "array",
60
60
  "items": {
61
61
  "type": "string"
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { Schema } from '../schema';
9
+ export { describeBuilder } from '../../testing';
10
+ export declare const KARMA_BUILDER_INFO: Readonly<{
11
+ name: string;
12
+ schemaPath: string;
13
+ }>;
14
+ /**
15
+ * Contains all required karma builder fields.
16
+ * Also disables progress reporting to minimize logging output.
17
+ */
18
+ export declare const BASE_OPTIONS: Readonly<Schema>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.io/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.BASE_OPTIONS = exports.KARMA_BUILDER_INFO = exports.describeBuilder = void 0;
11
+ var testing_1 = require("../../testing");
12
+ Object.defineProperty(exports, "describeBuilder", { enumerable: true, get: function () { return testing_1.describeBuilder; } });
13
+ exports.KARMA_BUILDER_INFO = Object.freeze({
14
+ name: '@angular-devkit/build-angular:karma',
15
+ schemaPath: __dirname + '/../schema.json',
16
+ });
17
+ /**
18
+ * Contains all required karma builder fields.
19
+ * Also disables progress reporting to minimize logging output.
20
+ */
21
+ exports.BASE_OPTIONS = Object.freeze({
22
+ main: 'src/test.ts',
23
+ polyfills: 'src/polyfills.ts',
24
+ tsConfig: 'src/tsconfig.spec.json',
25
+ karmaConfig: 'karma.conf.js',
26
+ browsers: 'ChromeHeadlessCI',
27
+ progress: false,
28
+ watch: false,
29
+ });
@@ -6,6 +6,25 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
9
28
  Object.defineProperty(exports, "__esModule", { value: true });
10
29
  exports.execute = void 0;
11
30
  const architect_1 = require("@angular-devkit/architect");
@@ -13,7 +32,7 @@ const path_1 = require("path");
13
32
  const rxjs_1 = require("rxjs");
14
33
  const operators_1 = require("rxjs/operators");
15
34
  async function initialize(options, root) {
16
- const packager = (await Promise.resolve().then(() => require('ng-packagr'))).ngPackagr();
35
+ const packager = (await Promise.resolve().then(() => __importStar(require('ng-packagr')))).ngPackagr();
17
36
  packager.forProject(path_1.resolve(root, options.project));
18
37
  if (options.tsConfig) {
19
38
  packager.withTsConfig(path_1.resolve(root, options.tsConfig));
@@ -24,7 +43,7 @@ async function initialize(options, root) {
24
43
  * @experimental Direct usage of this function is considered experimental.
25
44
  */
26
45
  function execute(options, context) {
27
- return rxjs_1.from(initialize(options, context.workspaceRoot)).pipe(operators_1.switchMap((packager) => (options.watch ? packager.watch() : packager.build())), operators_1.mapTo({ success: true }));
46
+ return rxjs_1.from(initialize(options, context.workspaceRoot)).pipe(operators_1.switchMap((packager) => (options.watch ? packager.watch() : packager.build())), operators_1.mapTo({ success: true }), operators_1.catchError((err) => rxjs_1.of({ success: false, error: err.message })));
28
47
  }
29
48
  exports.execute = execute;
30
49
  exports.default = architect_1.createBuilder(execute);
@@ -6,12 +6,31 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
9
28
  Object.defineProperty(exports, "__esModule", { value: true });
10
29
  exports.execute = void 0;
11
30
  const architect_1 = require("@angular-devkit/architect");
12
31
  const core_1 = require("@angular-devkit/core");
13
32
  const path_1 = require("path");
14
- const url = require("url");
33
+ const url = __importStar(require("url"));
15
34
  const utils_1 = require("../utils");
16
35
  function runProtractor(root, options) {
17
36
  const additionalProtractorConfig = {
@@ -50,7 +69,7 @@ async function updateWebdriver() {
50
69
  Update webdriver-manager manually and run 'ng e2e --no-webdriver-update' instead.
51
70
  `);
52
71
  }
53
- const webdriverUpdate = await Promise.resolve().then(() => require(path));
72
+ const webdriverUpdate = await Promise.resolve().then(() => __importStar(require(path)));
54
73
  // const webdriverUpdate = await import(path) as typeof import ('webdriver-manager/built/lib/cmds/update');
55
74
  // run `webdriver-manager update --standalone false --gecko false --quiet`
56
75
  // if you change this, update the command comment in prev line
@@ -41,9 +41,6 @@ export declare class SassWorkerImplementation {
41
41
  /**
42
42
  * Shutdown the Sass render worker.
43
43
  * Executing this method will stop any pending render requests.
44
- *
45
- * The worker is unreferenced upon creation and will not block application exit. This method
46
- * is only needed if early cleanup is needed.
47
44
  */
48
45
  close(): void;
49
46
  private createWorker;
@@ -87,13 +87,13 @@ class SassWorkerImplementation {
87
87
  /**
88
88
  * Shutdown the Sass render worker.
89
89
  * Executing this method will stop any pending render requests.
90
- *
91
- * The worker is unreferenced upon creation and will not block application exit. This method
92
- * is only needed if early cleanup is needed.
93
90
  */
94
91
  close() {
95
92
  for (const worker of this.workers) {
96
- void worker.terminate();
93
+ try {
94
+ void worker.terminate();
95
+ }
96
+ catch { }
97
97
  }
98
98
  this.requests.clear();
99
99
  }
@@ -134,7 +134,7 @@ class SassWorkerImplementation {
134
134
  request.callback(response.error);
135
135
  }
136
136
  });
137
- mainImporterPort.on('message', ({ id, url, prev }) => {
137
+ mainImporterPort.on('message', ({ id, url, prev, fromImport, }) => {
138
138
  const request = this.requests.get(id);
139
139
  if (!(request === null || request === void 0 ? void 0 : request.importers)) {
140
140
  mainImporterPort.postMessage(null);
@@ -142,7 +142,7 @@ class SassWorkerImplementation {
142
142
  Atomics.notify(importerSignal, 0);
143
143
  return;
144
144
  }
145
- this.processImporters(request.importers, url, prev)
145
+ this.processImporters(request.importers, url, prev, fromImport)
146
146
  .then((result) => {
147
147
  mainImporterPort.postMessage(result);
148
148
  })
@@ -154,16 +154,15 @@ class SassWorkerImplementation {
154
154
  Atomics.notify(importerSignal, 0);
155
155
  });
156
156
  });
157
- worker.unref();
158
157
  mainImporterPort.unref();
159
158
  return worker;
160
159
  }
161
- async processImporters(importers, url, prev) {
160
+ async processImporters(importers, url, prev, fromImport) {
162
161
  let result = null;
163
162
  for (const importer of importers) {
164
163
  result = await new Promise((resolve) => {
165
164
  // Importers can be both sync and async
166
- const innerResult = importer(url, prev, resolve);
165
+ const innerResult = importer.call({ fromImport }, url, prev, resolve);
167
166
  if (innerResult !== undefined) {
168
167
  resolve(innerResult);
169
168
  }
@@ -29,10 +29,12 @@ worker_threads_1.parentPort.on('message', (message) => {
29
29
  // This process must be synchronous from the perspective of dart-sass. The `Atomics`
30
30
  // functions combined with the shared memory `importSignal` and the Node.js
31
31
  // `receiveMessageOnPort` function are used to ensure synchronous behavior.
32
- options.importer = (url, prev) => {
32
+ options.importer = function (url, prev) {
33
33
  var _a;
34
34
  Atomics.store(importerSignal, 0, 0);
35
- workerImporterPort.postMessage({ id, url, prev });
35
+ // `this.fromImport` was added in dart-sass in 1.33.0, `@types/sass` doesn't include it yet.
36
+ const { fromImport } = this;
37
+ workerImporterPort.postMessage({ id, url, prev, fromImport });
36
38
  Atomics.wait(importerSignal, 0, 0);
37
39
  return (_a = worker_threads_1.receiveMessageOnPort(workerImporterPort)) === null || _a === void 0 ? void 0 : _a.message;
38
40
  };
@@ -8,7 +8,7 @@
8
8
  import { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
9
9
  import { json } from '@angular-devkit/core';
10
10
  import { Observable } from 'rxjs';
11
- import * as webpack from 'webpack';
11
+ import webpack from 'webpack';
12
12
  import { ExecutionTransformer } from '../transforms';
13
13
  import { Schema as ServerBuilderOptions } from './schema';
14
14
  /**
@@ -6,12 +6,31 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
9
28
  Object.defineProperty(exports, "__esModule", { value: true });
10
29
  exports.execute = void 0;
11
30
  const architect_1 = require("@angular-devkit/architect");
12
31
  const build_webpack_1 = require("@angular-devkit/build-webpack");
13
32
  const core_1 = require("@angular-devkit/core");
14
- const path = require("path");
33
+ const path = __importStar(require("path"));
15
34
  const rxjs_1 = require("rxjs");
16
35
  const operators_1 = require("rxjs/operators");
17
36
  const typescript_1 = require("typescript");
@@ -198,7 +198,7 @@ export interface SourceMapClass {
198
198
  */
199
199
  export interface StylePreprocessorOptions {
200
200
  /**
201
- * Paths to include. Paths will be resolved to project root.
201
+ * Paths to include. Paths will be resolved to workspace root.
202
202
  */
203
203
  includePaths?: string[];
204
204
  }
@@ -24,7 +24,7 @@
24
24
  "type": "object",
25
25
  "properties": {
26
26
  "includePaths": {
27
- "description": "Paths to include. Paths will be resolved to project root.",
27
+ "description": "Paths to include. Paths will be resolved to workspace root.",
28
28
  "type": "array",
29
29
  "items": {
30
30
  "type": "string"
@@ -6,12 +6,31 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
9
28
  Object.defineProperty(exports, "__esModule", { value: true });
10
29
  const architect_1 = require("@angular-devkit/architect");
11
30
  const fs_1 = require("fs");
12
- const glob = require("glob");
31
+ const glob = __importStar(require("glob"));
13
32
  const minimatch_1 = require("minimatch");
14
- const path = require("path");
33
+ const path = __importStar(require("path"));
15
34
  const strip_bom_1 = require("../utils/strip-bom");
16
35
  async function _run(options, context) {
17
36
  context.logger.warn(`TSLint's support is discontinued and we're deprecating its support in Angular CLI.\n` +
@@ -30,7 +49,7 @@ async function _run(options, context) {
30
49
  }
31
50
  let tslint;
32
51
  try {
33
- tslint = await Promise.resolve().then(() => require('tslint'));
52
+ tslint = await Promise.resolve().then(() => __importStar(require('tslint')));
34
53
  }
35
54
  catch {
36
55
  throw new Error('Unable to find TSLint. Ensure TSLint is installed.');
package/src/typings.d.ts CHANGED
@@ -9,3 +9,9 @@
9
9
  declare module '@discoveryjs/json-ext' {
10
10
  export function stringifyStream(value: unknown): import('stream').Readable;
11
11
  }
12
+
13
+ declare module '@babel/helper-annotate-as-pure' {
14
+ export default function annotateAsPure(
15
+ pathOrNode: import('@babel/types').Node | { node: import('@babel/types').Node },
16
+ ): void;
17
+ }