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

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 (57) hide show
  1. package/package.json +16 -15
  2. package/src/builders/app-shell/index.js +16 -8
  3. package/src/builders/browser/schema.d.ts +6 -2
  4. package/src/builders/browser/schema.json +16 -2
  5. package/src/builders/browser-esbuild/compiler-plugin.d.ts +9 -2
  6. package/src/builders/browser-esbuild/compiler-plugin.js +114 -90
  7. package/src/builders/browser-esbuild/esbuild.d.ts +4 -3
  8. package/src/builders/browser-esbuild/esbuild.js +12 -6
  9. package/src/builders/browser-esbuild/experimental-warnings.js +0 -3
  10. package/src/builders/browser-esbuild/index.d.ts +3 -3
  11. package/src/builders/browser-esbuild/index.js +143 -86
  12. package/src/builders/browser-esbuild/options.d.ts +26 -4
  13. package/src/builders/browser-esbuild/options.js +62 -6
  14. package/src/builders/browser-esbuild/schema.d.ts +6 -2
  15. package/src/builders/browser-esbuild/schema.json +16 -2
  16. package/src/builders/browser-esbuild/watcher.d.ts +23 -0
  17. package/src/builders/browser-esbuild/watcher.js +93 -0
  18. package/src/builders/karma/find-tests-plugin.d.ts +19 -0
  19. package/src/builders/karma/{find-tests.js → find-tests-plugin.js} +49 -5
  20. package/src/builders/karma/index.d.ts +1 -1
  21. package/src/builders/karma/index.js +86 -43
  22. package/src/builders/karma/schema.d.ts +8 -4
  23. package/src/builders/karma/schema.json +18 -3
  24. package/src/builders/server/schema.d.ts +0 -5
  25. package/src/builders/server/schema.json +0 -5
  26. package/src/sass/sass-service-legacy.d.ts +51 -0
  27. package/src/sass/sass-service-legacy.js +175 -0
  28. package/src/sass/sass-service.d.ts +6 -9
  29. package/src/sass/sass-service.js +69 -52
  30. package/src/{builders/karma/find-tests.d.ts → sass/worker-legacy.d.ts} +1 -1
  31. package/src/sass/worker-legacy.js +44 -0
  32. package/src/sass/worker.js +64 -14
  33. package/src/utils/build-options.d.ts +1 -2
  34. package/src/utils/environment-options.d.ts +1 -0
  35. package/src/utils/environment-options.js +11 -1
  36. package/src/utils/normalize-builder-schema.d.ts +1 -0
  37. package/src/utils/normalize-builder-schema.js +3 -2
  38. package/src/utils/normalize-polyfills.d.ts +8 -0
  39. package/src/utils/normalize-polyfills.js +24 -0
  40. package/src/utils/process-bundle.js +1 -1
  41. package/src/utils/service-worker.d.ts +3 -0
  42. package/src/utils/service-worker.js +29 -2
  43. package/src/utils/webpack-diagnostics.d.ts +1 -1
  44. package/src/utils/webpack-diagnostics.js +2 -3
  45. package/src/webpack/configs/common.js +29 -14
  46. package/src/webpack/configs/styles.d.ts +1 -7
  47. package/src/webpack/configs/styles.js +102 -106
  48. package/src/webpack/plugins/javascript-optimizer-plugin.js +2 -2
  49. package/src/webpack/plugins/karma/karma.js +4 -5
  50. package/src/webpack/plugins/scripts-webpack-plugin.js +24 -5
  51. package/src/webpack/plugins/styles-webpack-plugin.d.ts +19 -0
  52. package/src/webpack/plugins/styles-webpack-plugin.js +71 -0
  53. package/src/webpack/plugins/transfer-size-plugin.js +2 -1
  54. package/src/webpack/utils/helpers.d.ts +5 -2
  55. package/src/webpack/utils/helpers.js +24 -33
  56. package/src/webpack/plugins/single-test-transform.d.ts +0 -27
  57. package/src/webpack/plugins/single-test-transform.js +0 -44
@@ -0,0 +1,93 @@
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.createWatcher = exports.ChangedFiles = void 0;
11
+ const chokidar_1 = require("chokidar");
12
+ class ChangedFiles {
13
+ constructor() {
14
+ this.added = new Set();
15
+ this.modified = new Set();
16
+ this.removed = new Set();
17
+ }
18
+ toDebugString() {
19
+ const content = {
20
+ added: Array.from(this.added),
21
+ modified: Array.from(this.modified),
22
+ removed: Array.from(this.removed),
23
+ };
24
+ return JSON.stringify(content, null, 2);
25
+ }
26
+ }
27
+ exports.ChangedFiles = ChangedFiles;
28
+ function createWatcher(options) {
29
+ const watcher = new chokidar_1.FSWatcher({
30
+ ...options,
31
+ disableGlobbing: true,
32
+ ignoreInitial: true,
33
+ });
34
+ const nextQueue = [];
35
+ let currentChanges;
36
+ watcher.on('all', (event, path) => {
37
+ switch (event) {
38
+ case 'add':
39
+ currentChanges !== null && currentChanges !== void 0 ? currentChanges : (currentChanges = new ChangedFiles());
40
+ currentChanges.added.add(path);
41
+ break;
42
+ case 'change':
43
+ currentChanges !== null && currentChanges !== void 0 ? currentChanges : (currentChanges = new ChangedFiles());
44
+ currentChanges.modified.add(path);
45
+ break;
46
+ case 'unlink':
47
+ currentChanges !== null && currentChanges !== void 0 ? currentChanges : (currentChanges = new ChangedFiles());
48
+ currentChanges.removed.add(path);
49
+ break;
50
+ default:
51
+ return;
52
+ }
53
+ const next = nextQueue.shift();
54
+ if (next) {
55
+ const value = currentChanges;
56
+ currentChanges = undefined;
57
+ next(value);
58
+ }
59
+ });
60
+ return {
61
+ [Symbol.asyncIterator]() {
62
+ return this;
63
+ },
64
+ async next() {
65
+ if (currentChanges && nextQueue.length === 0) {
66
+ const result = { value: currentChanges };
67
+ currentChanges = undefined;
68
+ return result;
69
+ }
70
+ return new Promise((resolve) => {
71
+ nextQueue.push((value) => resolve(value ? { value } : { done: true, value }));
72
+ });
73
+ },
74
+ add(paths) {
75
+ watcher.add(paths);
76
+ },
77
+ remove(paths) {
78
+ watcher.unwatch(paths);
79
+ },
80
+ async close() {
81
+ try {
82
+ await watcher.close();
83
+ }
84
+ finally {
85
+ let next;
86
+ while ((next = nextQueue.shift()) !== undefined) {
87
+ next();
88
+ }
89
+ }
90
+ },
91
+ };
92
+ }
93
+ exports.createWatcher = createWatcher;
@@ -0,0 +1,19 @@
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 type { Compiler } from 'webpack';
9
+ export interface FindTestsPluginOptions {
10
+ include?: string[];
11
+ workspaceRoot: string;
12
+ projectSourceRoot: string;
13
+ }
14
+ export declare class FindTestsPlugin {
15
+ private options;
16
+ private compilation;
17
+ constructor(options: FindTestsPluginOptions);
18
+ apply(compiler: Compiler): void;
19
+ }
@@ -29,13 +29,54 @@ var __importStar = (this && this.__importStar) || function (mod) {
29
29
  __setModuleDefault(result, mod);
30
30
  return result;
31
31
  };
32
+ var __importDefault = (this && this.__importDefault) || function (mod) {
33
+ return (mod && mod.__esModule) ? mod : { "default": mod };
34
+ };
32
35
  Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.findTests = void 0;
36
+ exports.FindTestsPlugin = void 0;
37
+ const assert_1 = __importDefault(require("assert"));
34
38
  const fs_1 = require("fs");
35
39
  const glob_1 = __importStar(require("glob"));
36
40
  const path_1 = require("path");
37
41
  const util_1 = require("util");
42
+ const webpack_diagnostics_1 = require("../../utils/webpack-diagnostics");
38
43
  const globPromise = (0, util_1.promisify)(glob_1.default);
44
+ /**
45
+ * The name of the plugin provided to Webpack when tapping Webpack compiler hooks.
46
+ */
47
+ const PLUGIN_NAME = 'angular-find-tests-plugin';
48
+ class FindTestsPlugin {
49
+ constructor(options) {
50
+ this.options = options;
51
+ }
52
+ apply(compiler) {
53
+ const { include = ['**/*.spec.ts'], projectSourceRoot, workspaceRoot } = this.options;
54
+ const webpackOptions = compiler.options;
55
+ const entry = typeof webpackOptions.entry === 'function' ? webpackOptions.entry() : webpackOptions.entry;
56
+ let originalImport;
57
+ // Add tests files are part of the entry-point.
58
+ webpackOptions.entry = async () => {
59
+ const specFiles = await findTests(include, workspaceRoot, projectSourceRoot);
60
+ if (!specFiles.length) {
61
+ (0, assert_1.default)(this.compilation, 'Compilation cannot be undefined.');
62
+ (0, webpack_diagnostics_1.addError)(this.compilation, `Specified patterns: "${include.join(', ')}" did not match any spec files.`);
63
+ }
64
+ const entrypoints = await entry;
65
+ const entrypoint = entrypoints['main'];
66
+ if (!entrypoint.import) {
67
+ throw new Error(`Cannot find 'main' entrypoint.`);
68
+ }
69
+ originalImport !== null && originalImport !== void 0 ? originalImport : (originalImport = entrypoint.import);
70
+ entrypoint.import = [...originalImport, ...specFiles];
71
+ return entrypoints;
72
+ };
73
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
74
+ this.compilation = compilation;
75
+ compilation.contextDependencies.add(projectSourceRoot);
76
+ });
77
+ }
78
+ }
79
+ exports.FindTestsPlugin = FindTestsPlugin;
39
80
  // go through all patterns and find unique list of files
40
81
  async function findTests(patterns, workspaceRoot, projectSourceRoot) {
41
82
  const matchingTestsPromises = patterns.map((pattern) => findMatchingTests(pattern, workspaceRoot, projectSourceRoot));
@@ -43,11 +84,13 @@ async function findTests(patterns, workspaceRoot, projectSourceRoot) {
43
84
  // Unique file names
44
85
  return [...new Set(files.flat())];
45
86
  }
46
- exports.findTests = findTests;
47
87
  const normalizePath = (path) => path.replace(/\\/g, '/');
48
88
  async function findMatchingTests(pattern, workspaceRoot, projectSourceRoot) {
49
89
  // normalize pattern, glob lib only accepts forward slashes
50
90
  let normalizedPattern = normalizePath(pattern);
91
+ if (normalizedPattern.charAt(0) === '/') {
92
+ normalizedPattern = normalizedPattern.substring(1);
93
+ }
51
94
  const relativeProjectRoot = normalizePath((0, path_1.relative)(workspaceRoot, projectSourceRoot) + '/');
52
95
  // remove relativeProjectRoot to support relative paths from root
53
96
  // such paths are easy to get when running scripts via IDEs
@@ -63,9 +106,9 @@ async function findMatchingTests(pattern, workspaceRoot, projectSourceRoot) {
63
106
  // see if matching spec file exists
64
107
  const fileExt = (0, path_1.extname)(normalizedPattern);
65
108
  // Replace extension to `.spec.ext`. Example: `src/app/app.component.ts`-> `src/app/app.component.spec.ts`
66
- const potentialSpec = (0, path_1.join)((0, path_1.dirname)(normalizedPattern), `${(0, path_1.basename)(normalizedPattern, fileExt)}.spec${fileExt}`);
67
- if (await exists((0, path_1.join)(projectSourceRoot, potentialSpec))) {
68
- return [normalizePath(potentialSpec)];
109
+ const potentialSpec = (0, path_1.join)(projectSourceRoot, (0, path_1.dirname)(normalizedPattern), `${(0, path_1.basename)(normalizedPattern, fileExt)}.spec${fileExt}`);
110
+ if (await exists(potentialSpec)) {
111
+ return [potentialSpec];
69
112
  }
70
113
  }
71
114
  }
@@ -73,6 +116,7 @@ async function findMatchingTests(pattern, workspaceRoot, projectSourceRoot) {
73
116
  cwd: projectSourceRoot,
74
117
  root: projectSourceRoot,
75
118
  nomount: true,
119
+ absolute: true,
76
120
  });
77
121
  }
78
122
  async function isDirectory(path) {
@@ -23,5 +23,5 @@ export declare function execute(options: KarmaBuilderOptions, context: BuilderCo
23
23
  karmaOptions?: (options: KarmaConfigOptions) => KarmaConfigOptions;
24
24
  }): Observable<BuilderOutput>;
25
25
  export { KarmaBuilderOptions };
26
- declare const _default: import("@angular-devkit/architect/src/internal").Builder<Record<string, string> & KarmaBuilderOptions & import("../../../../core/src").JsonObject>;
26
+ declare const _default: import("@angular-devkit/architect/src/internal").Builder<Record<string, string> & KarmaBuilderOptions & import("@angular-devkit/core").JsonObject>;
27
27
  export default _default;
@@ -32,6 +32,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.execute = void 0;
34
34
  const architect_1 = require("@angular-devkit/architect");
35
+ const core_1 = require("@angular-devkit/core");
36
+ const karma_1 = require("karma");
37
+ const module_1 = require("module");
35
38
  const path = __importStar(require("path"));
36
39
  const rxjs_1 = require("rxjs");
37
40
  const operators_1 = require("rxjs/operators");
@@ -39,10 +42,10 @@ const purge_cache_1 = require("../../utils/purge-cache");
39
42
  const version_1 = require("../../utils/version");
40
43
  const webpack_browser_config_1 = require("../../utils/webpack-browser-config");
41
44
  const configs_1 = require("../../webpack/configs");
42
- const single_test_transform_1 = require("../../webpack/plugins/single-test-transform");
43
45
  const schema_1 = require("../browser/schema");
44
- const find_tests_1 = require("./find-tests");
46
+ const find_tests_plugin_1 = require("./find-tests-plugin");
45
47
  async function initialize(options, context, webpackConfigurationTransformer) {
48
+ var _a;
46
49
  // Purge old build disk cache.
47
50
  await (0, purge_cache_1.purgeStaleBuildCache)(context);
48
51
  const { config } = await (0, webpack_browser_config_1.generateBrowserWebpackConfigFromContext)(
@@ -67,10 +70,7 @@ async function initialize(options, context, webpackConfigurationTransformer) {
67
70
  watch: true,
68
71
  }, context, (wco) => [(0, configs_1.getCommonConfig)(wco), (0, configs_1.getStylesConfig)(wco)]);
69
72
  const karma = await Promise.resolve().then(() => __importStar(require('karma')));
70
- return [
71
- karma,
72
- webpackConfigurationTransformer ? await webpackConfigurationTransformer(config) : config,
73
- ];
73
+ return [karma, (_a = (await (webpackConfigurationTransformer === null || webpackConfigurationTransformer === void 0 ? void 0 : webpackConfigurationTransformer(config)))) !== null && _a !== void 0 ? _a : config];
74
74
  }
75
75
  /**
76
76
  * @experimental Direct usage of this function is considered experimental.
@@ -84,9 +84,15 @@ function execute(options, context, transforms = {}) {
84
84
  }
85
85
  return (0, rxjs_1.from)(initialize(options, context, transforms.webpackConfiguration)).pipe((0, operators_1.switchMap)(async ([karma, webpackConfig]) => {
86
86
  var _a, _b, _c, _d, _e;
87
- const karmaOptions = {
88
- singleRun,
89
- };
87
+ // Determine project name from builder context target
88
+ const projectName = (_a = context.target) === null || _a === void 0 ? void 0 : _a.project;
89
+ if (!projectName) {
90
+ throw new Error(`The 'karma' builder requires a target to be specified.`);
91
+ }
92
+ const karmaOptions = options.karmaConfig
93
+ ? {}
94
+ : getBuiltInKarmaConfig(context.workspaceRoot, projectName);
95
+ karmaOptions.singleRun = singleRun;
90
96
  // Convert browsers from a string to an array
91
97
  if (options.browsers) {
92
98
  karmaOptions.browsers = options.browsers.split(',');
@@ -100,47 +106,32 @@ function execute(options, context, transforms = {}) {
100
106
  karmaOptions.reporters = reporters;
101
107
  }
102
108
  }
103
- // prepend special webpack loader that will transform test.ts
104
- if ((_a = options.include) === null || _a === void 0 ? void 0 : _a.length) {
105
- const projectName = (_b = context.target) === null || _b === void 0 ? void 0 : _b.project;
106
- if (!projectName) {
107
- throw new Error('The builder requires a target.');
108
- }
109
- const projectMetadata = await context.getProjectMetadata(projectName);
110
- const sourceRoot = ((_d = (_c = projectMetadata.sourceRoot) !== null && _c !== void 0 ? _c : projectMetadata.root) !== null && _d !== void 0 ? _d : '');
111
- const projectSourceRoot = path.join(context.workspaceRoot, sourceRoot);
112
- const files = await (0, find_tests_1.findTests)(options.include, context.workspaceRoot, projectSourceRoot);
113
- // early exit, no reason to start karma
114
- if (!files.length) {
115
- throw new Error(`Specified patterns: "${options.include.join(', ')}" did not match any spec files.`);
116
- }
117
- // Get the rules and ensure the Webpack configuration is setup properly
118
- const rules = ((_e = webpackConfig.module) === null || _e === void 0 ? void 0 : _e.rules) || [];
119
- if (!webpackConfig.module) {
120
- webpackConfig.module = { rules };
109
+ if (!options.main) {
110
+ (_b = webpackConfig.entry) !== null && _b !== void 0 ? _b : (webpackConfig.entry = {});
111
+ if (typeof webpackConfig.entry === 'object' && !Array.isArray(webpackConfig.entry)) {
112
+ if (Array.isArray(webpackConfig.entry['main'])) {
113
+ webpackConfig.entry['main'].push(getBuiltInMainFile());
114
+ }
115
+ else {
116
+ webpackConfig.entry['main'] = [getBuiltInMainFile()];
117
+ }
121
118
  }
122
- else if (!webpackConfig.module.rules) {
123
- webpackConfig.module.rules = rules;
124
- }
125
- rules.unshift({
126
- test: path.resolve(context.workspaceRoot, options.main),
127
- use: {
128
- // cannot be a simple path as it differs between environments
129
- loader: single_test_transform_1.SingleTestTransformLoader,
130
- options: {
131
- files,
132
- logger: context.logger,
133
- },
134
- },
135
- });
136
119
  }
120
+ const projectMetadata = await context.getProjectMetadata(projectName);
121
+ const sourceRoot = ((_d = (_c = projectMetadata.sourceRoot) !== null && _c !== void 0 ? _c : projectMetadata.root) !== null && _d !== void 0 ? _d : '');
122
+ (_e = webpackConfig.plugins) !== null && _e !== void 0 ? _e : (webpackConfig.plugins = []);
123
+ webpackConfig.plugins.push(new find_tests_plugin_1.FindTestsPlugin({
124
+ include: options.include,
125
+ workspaceRoot: context.workspaceRoot,
126
+ projectSourceRoot: path.join(context.workspaceRoot, sourceRoot),
127
+ }));
137
128
  karmaOptions.buildWebpack = {
138
129
  options,
139
130
  webpackConfig,
140
131
  logger: context.logger,
141
132
  };
142
- const config = await karma.config.parseConfig(path.resolve(context.workspaceRoot, options.karmaConfig), transforms.karmaOptions ? transforms.karmaOptions(karmaOptions) : karmaOptions, { promiseConfig: true, throwErrors: true });
143
- return [karma, config];
133
+ const parsedKarmaConfig = await karma_1.config.parseConfig(options.karmaConfig && path.resolve(context.workspaceRoot, options.karmaConfig), transforms.karmaOptions ? transforms.karmaOptions(karmaOptions) : karmaOptions, { promiseConfig: true, throwErrors: true });
134
+ return [karma, parsedKarmaConfig];
144
135
  }), (0, operators_1.switchMap)(([karma, karmaConfig]) => new rxjs_1.Observable((subscriber) => {
145
136
  var _a, _b, _c;
146
137
  var _d, _e;
@@ -163,4 +154,56 @@ function execute(options, context, transforms = {}) {
163
154
  })), (0, operators_1.defaultIfEmpty)({ success: false }));
164
155
  }
165
156
  exports.execute = execute;
157
+ function getBuiltInKarmaConfig(workspaceRoot, projectName) {
158
+ let coverageFolderName = projectName.charAt(0) === '@' ? projectName.slice(1) : projectName;
159
+ if (/[A-Z]/.test(coverageFolderName)) {
160
+ coverageFolderName = core_1.strings.dasherize(coverageFolderName);
161
+ }
162
+ const workspaceRootRequire = (0, module_1.createRequire)(workspaceRoot + '/');
163
+ return {
164
+ basePath: '',
165
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
166
+ plugins: [
167
+ 'karma-jasmine',
168
+ 'karma-chrome-launcher',
169
+ 'karma-jasmine-html-reporter',
170
+ 'karma-coverage',
171
+ '@angular-devkit/build-angular/plugins/karma',
172
+ ].map((p) => workspaceRootRequire(p)),
173
+ client: {
174
+ clearContext: false, // leave Jasmine Spec Runner output visible in browser
175
+ },
176
+ jasmineHtmlReporter: {
177
+ suppressAll: true, // removes the duplicated traces
178
+ },
179
+ coverageReporter: {
180
+ dir: path.join(workspaceRoot, 'coverage', coverageFolderName),
181
+ subdir: '.',
182
+ reporters: [{ type: 'html' }, { type: 'text-summary' }],
183
+ },
184
+ reporters: ['progress', 'kjhtml'],
185
+ port: 9876,
186
+ colors: true,
187
+ logLevel: karma_1.constants.LOG_INFO,
188
+ autoWatch: true,
189
+ browsers: ['Chrome'],
190
+ restartOnFileChange: true,
191
+ };
192
+ }
166
193
  exports.default = (0, architect_1.createBuilder)(execute);
194
+ function getBuiltInMainFile() {
195
+ const content = Buffer.from(`
196
+ import { getTestBed } from '@angular/core/testing';
197
+ import {
198
+ BrowserDynamicTestingModule,
199
+ platformBrowserDynamicTesting,
200
+ } from '@angular/platform-browser-dynamic/testing';
201
+
202
+ // Initialize the Angular testing environment.
203
+ getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
204
+ errorOnUnknownElements: true,
205
+ errorOnUnknownProperties: true
206
+ });
207
+ `).toString('base64');
208
+ return `ng-virtual-main.js!=!data:text/javascript;base64,${content}`;
209
+ }
@@ -38,19 +38,19 @@ export interface Schema {
38
38
  /**
39
39
  * The name of the Karma configuration file.
40
40
  */
41
- karmaConfig: string;
41
+ karmaConfig?: string;
42
42
  /**
43
43
  * The name of the main entry-point file.
44
44
  */
45
- main: string;
45
+ main?: string;
46
46
  /**
47
47
  * Enable and define the file watching poll time period in milliseconds.
48
48
  */
49
49
  poll?: number;
50
50
  /**
51
- * The name of the polyfills file.
51
+ * Polyfills to be included in the build.
52
52
  */
53
- polyfills?: string;
53
+ polyfills?: Polyfills;
54
54
  /**
55
55
  * Do not use the real path when resolving modules. If unset then will default to `true` if
56
56
  * NodeJS option --preserve-symlinks is set.
@@ -128,6 +128,10 @@ export declare enum InlineStyleLanguage {
128
128
  Sass = "sass",
129
129
  Scss = "scss"
130
130
  }
131
+ /**
132
+ * Polyfills to be included in the build.
133
+ */
134
+ export declare type Polyfills = string[] | string;
131
135
  export declare type ScriptElement = ScriptClass | string;
132
136
  export interface ScriptClass {
133
137
  /**
@@ -17,8 +17,22 @@
17
17
  "description": "The name of the Karma configuration file."
18
18
  },
19
19
  "polyfills": {
20
- "type": "string",
21
- "description": "The name of the polyfills file."
20
+ "description": "Polyfills to be included in the build.",
21
+ "oneOf": [
22
+ {
23
+ "type": "array",
24
+ "description": "A list of polyfills to include in the build. Can be a full path for a file, relative to the current workspace or module specifier. Example: 'zone.js'.",
25
+ "items": {
26
+ "type": "string",
27
+ "uniqueItems": true
28
+ },
29
+ "default": []
30
+ },
31
+ {
32
+ "type": "string",
33
+ "description": "The full path for the polyfills file, relative to the current workspace or a module specifier. Example: 'zone.js'."
34
+ }
35
+ ]
22
36
  },
23
37
  "assets": {
24
38
  "type": "array",
@@ -126,6 +140,7 @@
126
140
  "items": {
127
141
  "type": "string"
128
142
  },
143
+ "default": ["**/*.spec.ts"],
129
144
  "description": "Globs of files to include, relative to workspace or project root. \nThere are 2 special cases:\n - when a path to directory is provided, all spec files ending \".spec.@(ts|tsx)\" will be included\n - when a path to a file is provided, and a matching spec file exists it will be included instead."
130
145
  },
131
146
  "sourceMap": {
@@ -240,7 +255,7 @@
240
255
  }
241
256
  },
242
257
  "additionalProperties": false,
243
- "required": ["main", "tsConfig", "karmaConfig"],
258
+ "required": ["tsConfig"],
244
259
  "definitions": {
245
260
  "assetPattern": {
246
261
  "oneOf": [
@@ -1,9 +1,4 @@
1
1
  export interface Schema {
2
- /**
3
- * Which external dependencies to bundle into the bundle. By default, all of node_modules
4
- * will be bundled.
5
- */
6
- bundleDependencies?: boolean;
7
2
  /**
8
3
  * Delete the output path before building.
9
4
  */
@@ -181,11 +181,6 @@
181
181
  "description": "Use file name for lazy loaded chunks.",
182
182
  "default": false
183
183
  },
184
- "bundleDependencies": {
185
- "description": "Which external dependencies to bundle into the bundle. By default, all of node_modules will be bundled.",
186
- "default": true,
187
- "type": "boolean"
188
- },
189
184
  "externalDependencies": {
190
185
  "description": "Exclude the listed external dependencies from being bundled into the bundle. Instead, the created bundle relies on these dependencies to be available during runtime.",
191
186
  "type": "array",
@@ -0,0 +1,51 @@
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 { LegacyResult as CompileResult, LegacyException as Exception, LegacyOptions as Options } from 'sass';
9
+ /**
10
+ * The callback type for the `dart-sass` asynchronous render function.
11
+ */
12
+ declare type RenderCallback = (error?: Exception, result?: CompileResult) => void;
13
+ /**
14
+ * A Sass renderer implementation that provides an interface that can be used by Webpack's
15
+ * `sass-loader`. The implementation uses a Worker thread to perform the Sass rendering
16
+ * with the `dart-sass` package. The `dart-sass` synchronous render function is used within
17
+ * the worker which can be up to two times faster than the asynchronous variant.
18
+ */
19
+ export declare class SassLegacyWorkerImplementation {
20
+ private readonly workers;
21
+ private readonly availableWorkers;
22
+ private readonly requests;
23
+ private readonly workerPath;
24
+ private idCounter;
25
+ private nextWorkerIndex;
26
+ /**
27
+ * Provides information about the Sass implementation.
28
+ * This mimics enough of the `dart-sass` value to be used with the `sass-loader`.
29
+ */
30
+ get info(): string;
31
+ /**
32
+ * The synchronous render function is not used by the `sass-loader`.
33
+ */
34
+ renderSync(): never;
35
+ /**
36
+ * Asynchronously request a Sass stylesheet to be renderered.
37
+ *
38
+ * @param options The `dart-sass` options to use when rendering the stylesheet.
39
+ * @param callback The function to execute when the rendering is complete.
40
+ */
41
+ render(options: Options<'async'>, callback: RenderCallback): void;
42
+ /**
43
+ * Shutdown the Sass render worker.
44
+ * Executing this method will stop any pending render requests.
45
+ */
46
+ close(): void;
47
+ private createWorker;
48
+ private processImporters;
49
+ private createRequest;
50
+ }
51
+ export {};