@angular-devkit/build-angular 13.0.0-rc.0 → 13.0.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.
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "13.0.0-rc.0",
3
+ "version": "13.0.0",
4
4
  "description": "Angular Webpack Build Facade",
5
5
  "main": "src/index.js",
6
6
  "typings": "src/index.d.ts",
7
7
  "builders": "builders.json",
8
8
  "dependencies": {
9
9
  "@ampproject/remapping": "1.0.1",
10
- "@angular-devkit/architect": "0.1300.0-rc.0",
11
- "@angular-devkit/build-webpack": "0.1300.0-rc.0",
12
- "@angular-devkit/core": "13.0.0-rc.0",
10
+ "@angular-devkit/architect": "0.1300.0",
11
+ "@angular-devkit/build-webpack": "0.1300.0",
12
+ "@angular-devkit/core": "13.0.0",
13
13
  "@babel/core": "7.15.8",
14
14
  "@babel/generator": "7.15.8",
15
15
  "@babel/helper-annotate-as-pure": "7.15.4",
@@ -20,42 +20,42 @@
20
20
  "@babel/runtime": "7.15.4",
21
21
  "@babel/template": "7.15.4",
22
22
  "@discoveryjs/json-ext": "0.5.5",
23
- "@jsdevtools/coverage-istanbul-loader": "3.0.5",
24
- "@ngtools/webpack": "13.0.0-rc.0",
23
+ "@ngtools/webpack": "13.0.0",
25
24
  "ansi-colors": "4.1.1",
26
- "babel-loader": "8.2.2",
25
+ "babel-loader": "8.2.3",
26
+ "babel-plugin-istanbul": "6.1.1",
27
27
  "browserslist": "^4.9.1",
28
28
  "cacache": "15.3.0",
29
29
  "caniuse-lite": "^1.0.30001032",
30
30
  "circular-dependency-plugin": "5.2.2",
31
31
  "copy-webpack-plugin": "9.0.1",
32
- "core-js": "3.18.3",
33
- "critters": "0.0.10",
34
- "css-loader": "6.4.0",
35
- "esbuild-wasm": "0.13.5",
32
+ "core-js": "3.19.0",
33
+ "critters": "0.0.14",
34
+ "css-loader": "6.5.0",
35
+ "esbuild-wasm": "0.13.12",
36
36
  "glob": "7.2.0",
37
37
  "https-proxy-agent": "5.0.0",
38
38
  "inquirer": "8.2.0",
39
39
  "karma-source-map-support": "1.4.0",
40
40
  "less": "4.1.2",
41
- "less-loader": "10.1.0",
41
+ "less-loader": "10.2.0",
42
42
  "license-webpack-plugin": "3.0.0",
43
- "loader-utils": "2.0.0",
44
- "mini-css-extract-plugin": "2.4.2",
43
+ "loader-utils": "3.0.0",
44
+ "mini-css-extract-plugin": "2.4.3",
45
45
  "minimatch": "3.0.4",
46
- "open": "8.3.0",
46
+ "open": "8.4.0",
47
47
  "ora": "5.4.1",
48
48
  "parse5-html-rewriting-stream": "6.0.1",
49
49
  "piscina": "3.1.0",
50
- "postcss": "8.3.9",
50
+ "postcss": "8.3.11",
51
51
  "postcss-import": "14.0.2",
52
- "postcss-loader": "6.1.1",
52
+ "postcss-loader": "6.2.0",
53
53
  "postcss-preset-env": "6.7.0",
54
54
  "regenerator-runtime": "0.13.9",
55
55
  "resolve-url-loader": "4.0.0",
56
56
  "rxjs": "6.6.7",
57
- "sass": "1.42.1",
58
- "sass-loader": "12.2.0",
57
+ "sass": "1.43.4",
58
+ "sass-loader": "12.3.0",
59
59
  "semver": "7.3.5",
60
60
  "source-map-loader": "3.0.0",
61
61
  "source-map-support": "0.5.20",
@@ -65,14 +65,14 @@
65
65
  "text-table": "0.2.0",
66
66
  "tree-kill": "1.2.2",
67
67
  "tslib": "2.3.1",
68
- "webpack": "5.58.1",
68
+ "webpack": "5.60.0",
69
69
  "webpack-dev-middleware": "5.2.1",
70
- "webpack-dev-server": "4.3.1",
70
+ "webpack-dev-server": "4.4.0",
71
71
  "webpack-merge": "5.8.0",
72
72
  "webpack-subresource-integrity": "5.0.0"
73
73
  },
74
74
  "optionalDependencies": {
75
- "esbuild": "0.13.5"
75
+ "esbuild": "0.13.12"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "@angular/compiler-cli": "^13.0.0 || ^13.0.0-next",
@@ -32,6 +32,14 @@ export interface ApplicationPresetOptions {
32
32
  };
33
33
  forceES5?: boolean;
34
34
  forceAsyncTransformation?: boolean;
35
+ instrumentCode?: {
36
+ includedBasePath: string;
37
+ };
38
+ optimize?: {
39
+ looseEnums: boolean;
40
+ pureTopLevel: boolean;
41
+ wrapDecorators: boolean;
42
+ };
35
43
  diagnosticReporter?: DiagnosticReporter;
36
44
  }
37
45
  export default function (api: unknown, options: ApplicationPresetOptions): {
@@ -145,6 +145,24 @@ function default_1(api, options) {
145
145
  plugins.push(require('@babel/plugin-transform-async-to-generator').default, require('@babel/plugin-proposal-async-generator-functions').default);
146
146
  needRuntimeTransform = true;
147
147
  }
148
+ if (options.optimize) {
149
+ if (options.optimize.pureTopLevel) {
150
+ plugins.push(require('../plugins/pure-toplevel-functions').default);
151
+ }
152
+ plugins.push(require('../plugins/elide-angular-metadata').default, [
153
+ require('../plugins/adjust-typescript-enums').default,
154
+ { loose: options.optimize.looseEnums },
155
+ ], [
156
+ require('../plugins/adjust-static-class-members').default,
157
+ { wrapDecorators: options.optimize.wrapDecorators },
158
+ ]);
159
+ }
160
+ if (options.instrumentCode) {
161
+ plugins.push([
162
+ require('babel-plugin-istanbul').default,
163
+ { inputSourceMap: false, cwd: options.instrumentCode.includedBasePath },
164
+ ]);
165
+ }
148
166
  if (needRuntimeTransform) {
149
167
  // Babel equivalent to TypeScript's `importHelpers` option
150
168
  plugins.push([
@@ -5,5 +5,14 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
+ import { ApplicationPresetOptions } from './presets/application';
9
+ interface AngularCustomOptions extends Omit<ApplicationPresetOptions, 'instrumentCode'> {
10
+ instrumentCode?: {
11
+ /** node_modules and test files are always excluded. */
12
+ excludedPaths: Set<String>;
13
+ includedBasePath: string;
14
+ };
15
+ }
16
+ export declare type AngularBabelLoaderOptions = AngularCustomOptions & Record<string, unknown>;
8
17
  declare const _default: any;
9
18
  export default _default;
@@ -51,8 +51,9 @@ exports.default = (0, babel_loader_1.custom)(() => {
51
51
  inputSourceMap: false,
52
52
  });
53
53
  return {
54
- async customOptions({ i18n, scriptTarget, aot, optimize, ...rawOptions }, { source }) {
54
+ async customOptions(options, { source }) {
55
55
  var _a, _b;
56
+ const { i18n, scriptTarget, aot, optimize, instrumentCode, ...rawOptions } = options;
56
57
  // Must process file if plugins are added
57
58
  let shouldProcess = Array.isArray(rawOptions.plugins) && rawOptions.plugins.length > 0;
58
59
  const customOptions = {
@@ -60,6 +61,7 @@ exports.default = (0, babel_loader_1.custom)(() => {
60
61
  forceES5: false,
61
62
  angularLinker: undefined,
62
63
  i18n: undefined,
64
+ instrumentCode: undefined,
63
65
  };
64
66
  // Analyze file for linking
65
67
  if (await requiresLinking(this.resourcePath, source)) {
@@ -91,7 +93,7 @@ exports.default = (0, babel_loader_1.custom)(() => {
91
93
  customOptions.forceAsyncTransformation =
92
94
  !/[\\/][_f]?esm2015[\\/]/.test(this.resourcePath) && source.includes('async');
93
95
  }
94
- shouldProcess || (shouldProcess = customOptions.forceAsyncTransformation || customOptions.forceES5);
96
+ shouldProcess || (shouldProcess = customOptions.forceAsyncTransformation || customOptions.forceES5 || false);
95
97
  }
96
98
  // Analyze for i18n inlining
97
99
  if (i18n &&
@@ -131,6 +133,16 @@ exports.default = (0, babel_loader_1.custom)(() => {
131
133
  };
132
134
  shouldProcess = true;
133
135
  }
136
+ if (instrumentCode &&
137
+ !instrumentCode.excludedPaths.has(this.resourcePath) &&
138
+ !/\.(e2e|spec)\.tsx?$|[\\/]node_modules[\\/]/.test(this.resourcePath) &&
139
+ this.resourcePath.startsWith(instrumentCode.includedBasePath)) {
140
+ // `babel-plugin-istanbul` has it's own includes but we do the below so that we avoid running the the loader.
141
+ customOptions.instrumentCode = {
142
+ includedBasePath: instrumentCode.includedBasePath,
143
+ };
144
+ shouldProcess = true;
145
+ }
134
146
  // Add provided loader options to default base options
135
147
  const loaderOptions = {
136
148
  ...baseOptions,
@@ -150,27 +162,12 @@ exports.default = (0, babel_loader_1.custom)(() => {
150
162
  return { custom: customOptions, loader: loaderOptions };
151
163
  },
152
164
  config(configuration, { customOptions }) {
153
- var _a;
154
- const plugins = (_a = configuration.options.plugins) !== null && _a !== void 0 ? _a : [];
155
- if (customOptions.optimize) {
156
- if (customOptions.optimize.pureTopLevel) {
157
- plugins.push(require('./plugins/pure-toplevel-functions').default);
158
- }
159
- plugins.push(require('./plugins/elide-angular-metadata').default, [
160
- require('./plugins/adjust-typescript-enums').default,
161
- { loose: customOptions.optimize.looseEnums },
162
- ], [
163
- require('./plugins/adjust-static-class-members').default,
164
- { wrapDecorators: customOptions.optimize.wrapDecorators },
165
- ]);
166
- }
167
165
  return {
168
166
  ...configuration.options,
169
167
  // Using `false` disables babel from attempting to locate sourcemaps or process any inline maps.
170
168
  // The babel types do not include the false option even though it is valid
171
169
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
172
170
  inputSourceMap: false,
173
- plugins,
174
171
  presets: [
175
172
  ...(configuration.options.presets || []),
176
173
  [
@@ -89,7 +89,7 @@
89
89
  "inlineCritical": {
90
90
  "type": "boolean",
91
91
  "description": "Extract and inline critical CSS definitions to improve first paint time.",
92
- "default": false
92
+ "default": true
93
93
  }
94
94
  },
95
95
  "additionalProperties": false
@@ -216,6 +216,9 @@ function serveWebpackBrowser(options, context, transforms = {}) {
216
216
  if (buildEvent.success) {
217
217
  logger.info(`\n${color_1.colors.greenBright(color_1.colors.symbols.check)} Compiled successfully.`);
218
218
  }
219
+ else {
220
+ logger.info(`\n${color_1.colors.redBright(color_1.colors.symbols.cross)} Failed to compile.`);
221
+ }
219
222
  return { ...buildEvent, baseUrl: serverAddress };
220
223
  }));
221
224
  }));
@@ -132,6 +132,16 @@ async function execute(options, context, transforms) {
132
132
  if (!context.target || !context.target.project) {
133
133
  throw new Error('The builder requires a target.');
134
134
  }
135
+ try {
136
+ require.resolve('@angular/localize');
137
+ }
138
+ catch {
139
+ return {
140
+ success: false,
141
+ error: `i18n extraction requires the '@angular/localize' package.`,
142
+ outputPath: outFile,
143
+ };
144
+ }
135
145
  const metadata = await context.getProjectMetadata(context.target);
136
146
  const i18n = (0, i18n_options_1.createI18nOptions)(metadata);
137
147
  let useLegacyIds = true;
@@ -196,16 +206,6 @@ async function execute(options, context, transforms) {
196
206
  });
197
207
  return partials;
198
208
  });
199
- try {
200
- require.resolve('@angular/localize');
201
- }
202
- catch {
203
- return {
204
- success: false,
205
- error: `Ivy extraction requires the '@angular/localize' package.`,
206
- outputPath: outFile,
207
- };
208
- }
209
209
  // All the localize usages are setup to first try the ESM entry point then fallback to the deep imports.
210
210
  // This provides interim compatibility while the framework is transitioned to bundled ESM packages.
211
211
  const localizeToolsModule = await (0, load_esm_1.loadEsmModule)('@angular/localize/tools');
@@ -48,9 +48,9 @@ class SassWorkerImplementation {
48
48
  * @param callback The function to execute when the rendering is complete.
49
49
  */
50
50
  render(options, callback) {
51
- // The `functions` and `importer` options are JavaScript functions that cannot be transferred.
51
+ // The `functions`, `logger` and `importer` options are JavaScript functions that cannot be transferred.
52
52
  // If any additional function options are added in the future, they must be excluded as well.
53
- const { functions, importer, ...serializableOptions } = options;
53
+ const { functions, importer, logger, ...serializableOptions } = options;
54
54
  // The CLI's configuration does not use or expose the ability to defined custom Sass functions
55
55
  if (functions && Object.keys(functions).length > 0) {
56
56
  throw new Error('Sass custom functions are not supported.');
@@ -25,7 +25,6 @@ worker_threads_1.parentPort.on('message', ({ id, hasImporter, options }) => {
25
25
  options.importer = function (url, prev) {
26
26
  var _a;
27
27
  Atomics.store(importerSignal, 0, 0);
28
- // `this.fromImport` was added in dart-sass in 1.33.0, `@types/sass` doesn't include it yet.
29
28
  const { fromImport } = this;
30
29
  workerImporterPort.postMessage({ id, url, prev, fromImport });
31
30
  Atomics.wait(importerSignal, 0, 0);
@@ -40,13 +40,12 @@ class BundleActionExecutor {
40
40
  const executions = new Map();
41
41
  for (const action of actions) {
42
42
  const execution = executor(action);
43
- executions.set(execution, execution.then((result) => {
44
- executions.delete(execution);
45
- return result;
46
- }));
43
+ executions.set(execution, execution.then((result) => [execution, result]));
47
44
  }
48
45
  while (executions.size > 0) {
49
- yield Promise.race(executions.values());
46
+ const [execution, result] = await Promise.race(executions.values());
47
+ executions.delete(execution);
48
+ yield result;
50
49
  }
51
50
  }
52
51
  stop() {
@@ -75,4 +75,5 @@ export interface WebpackConfigOptions<T = BuildOptions> {
75
75
  tsConfig: ParsedConfiguration;
76
76
  tsConfigPath: string;
77
77
  scriptTarget: import('typescript').ScriptTarget;
78
+ projectName: string;
78
79
  }
@@ -16,8 +16,7 @@ function normalizeOptimization(optimization = true) {
16
16
  ? optimization.styles
17
17
  : {
18
18
  minify: !!optimization.styles,
19
- // inlineCritical is always false unless explictly set.
20
- inlineCritical: false,
19
+ inlineCritical: !!optimization.styles,
21
20
  },
22
21
  fonts: typeof optimization.fonts === 'object'
23
22
  ? optimization.fonts
@@ -30,8 +29,7 @@ function normalizeOptimization(optimization = true) {
30
29
  scripts: optimization,
31
30
  styles: {
32
31
  minify: optimization,
33
- // inlineCritical is always false unless explictly set.
34
- inlineCritical: false,
32
+ inlineCritical: optimization,
35
33
  },
36
34
  fonts: {
37
35
  inline: optimization,
@@ -15,7 +15,7 @@ import { WebpackConfigOptions } from '../utils/build-options';
15
15
  import { I18nOptions } from './i18n-options';
16
16
  export declare type BrowserWebpackConfigOptions = WebpackConfigOptions<NormalizedBrowserBuilderSchema>;
17
17
  export declare type WebpackPartialGenerator = (configurationOptions: BrowserWebpackConfigOptions) => (Promise<Configuration> | Configuration)[];
18
- export declare function generateWebpackConfig(workspaceRoot: string, projectRoot: string, sourceRoot: string | undefined, options: NormalizedBrowserBuilderSchema, webpackPartialGenerator: WebpackPartialGenerator, logger: logging.LoggerApi, extraBuildOptions: Partial<NormalizedBrowserBuilderSchema>): Promise<Configuration>;
18
+ export declare function generateWebpackConfig(workspaceRoot: string, projectRoot: string, sourceRoot: string | undefined, projectName: string, options: NormalizedBrowserBuilderSchema, webpackPartialGenerator: WebpackPartialGenerator, logger: logging.LoggerApi, extraBuildOptions: Partial<NormalizedBrowserBuilderSchema>): Promise<Configuration>;
19
19
  export declare function generateI18nBrowserWebpackConfigFromContext(options: BrowserBuilderSchema, context: BuilderContext, webpackPartialGenerator: WebpackPartialGenerator, extraBuildOptions?: Partial<NormalizedBrowserBuilderSchema>): Promise<{
20
20
  config: Configuration;
21
21
  projectRoot: string;
@@ -36,7 +36,7 @@ const utils_1 = require("../utils");
36
36
  const read_tsconfig_1 = require("../utils/read-tsconfig");
37
37
  const builder_watch_plugin_1 = require("../webpack/plugins/builder-watch-plugin");
38
38
  const i18n_options_1 = require("./i18n-options");
39
- async function generateWebpackConfig(workspaceRoot, projectRoot, sourceRoot, options, webpackPartialGenerator, logger, extraBuildOptions) {
39
+ async function generateWebpackConfig(workspaceRoot, projectRoot, sourceRoot, projectName, options, webpackPartialGenerator, logger, extraBuildOptions) {
40
40
  // Ensure Build Optimizer is only used with AOT.
41
41
  if (options.buildOptimizer && !options.aot) {
42
42
  throw new Error(`The 'buildOptimizer' option cannot be used without 'aot'.`);
@@ -54,6 +54,7 @@ async function generateWebpackConfig(workspaceRoot, projectRoot, sourceRoot, opt
54
54
  buildOptions,
55
55
  tsConfig,
56
56
  tsConfigPath,
57
+ projectName,
57
58
  scriptTarget,
58
59
  };
59
60
  wco.buildOptions.progress = (0, utils_1.defaultProgress)(wco.buildOptions.progress);
@@ -119,7 +120,7 @@ async function generateBrowserWebpackConfigFromContext(options, context, webpack
119
120
  ? (0, core_1.resolve)(workspaceRoot, (0, core_1.normalize)(projectSourceRoot))
120
121
  : undefined;
121
122
  const normalizedOptions = (0, utils_1.normalizeBrowserSchema)(workspaceRoot, projectRoot, sourceRoot, options, projectMetadata);
122
- const config = await generateWebpackConfig((0, core_1.getSystemPath)(workspaceRoot), (0, core_1.getSystemPath)(projectRoot), sourceRoot && (0, core_1.getSystemPath)(sourceRoot), normalizedOptions, webpackPartialGenerator, context.logger, extraBuildOptions);
123
+ const config = await generateWebpackConfig((0, core_1.getSystemPath)(workspaceRoot), (0, core_1.getSystemPath)(projectRoot), sourceRoot && (0, core_1.getSystemPath)(sourceRoot), projectName, normalizedOptions, webpackPartialGenerator, context.logger, extraBuildOptions);
123
124
  // If builder watch support is present in the context, add watch plugin
124
125
  // This is internal only and currently only used for testing
125
126
  const watcherFactory = context.watcherFactory;
@@ -6,5 +6,5 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import { Configuration } from 'webpack';
9
- import { WebpackConfigOptions } from '../../utils/build-options';
10
- export declare function getCommonConfig(wco: WebpackConfigOptions): Promise<Configuration>;
9
+ import { WebpackConfigOptions, WebpackTestOptions } from '../../utils/build-options';
10
+ export declare function getCommonConfig(wco: WebpackConfigOptions<WebpackTestOptions>): Promise<Configuration>;
@@ -47,8 +47,8 @@ const helpers_1 = require("../utils/helpers");
47
47
  // eslint-disable-next-line max-lines-per-function
48
48
  async function getCommonConfig(wco) {
49
49
  var _a, _b;
50
- const { root, projectRoot, buildOptions, tsConfig } = wco;
51
- const { cache, platform = 'browser', sourceMap: { styles: stylesSourceMap, scripts: scriptsSourceMap, vendor: vendorSourceMap }, optimization: { styles: stylesOptimization, scripts: scriptsOptimization }, } = buildOptions;
50
+ const { root, projectRoot, buildOptions, tsConfig, projectName, sourceRoot } = wco;
51
+ const { cache, codeCoverage, codeCoverageExclude = [], platform = 'browser', sourceMap: { styles: stylesSourceMap, scripts: scriptsSourceMap, vendor: vendorSourceMap }, optimization: { styles: stylesOptimization, scripts: scriptsOptimization }, } = buildOptions;
52
52
  const extraPlugins = [];
53
53
  const extraRules = [];
54
54
  const entryPoints = {};
@@ -282,6 +282,7 @@ async function getCommonConfig(wco) {
282
282
  context: root,
283
283
  entry: entryPoints,
284
284
  output: {
285
+ uniqueName: projectName,
285
286
  hashFunction: 'xxhash64',
286
287
  clean: (_a = buildOptions.deleteOutputPath) !== null && _a !== void 0 ? _a : true,
287
288
  path: path.resolve(root, buildOptions.outputPath),
@@ -324,6 +325,12 @@ async function getCommonConfig(wco) {
324
325
  scriptTarget: wco.scriptTarget,
325
326
  aot: buildOptions.aot,
326
327
  optimize: buildOptions.buildOptimizer,
328
+ instrumentCode: codeCoverage
329
+ ? {
330
+ includedBasePath: sourceRoot,
331
+ excludedPaths: (0, helpers_1.getInstrumentationExcludedPaths)(root, codeCoverageExclude),
332
+ }
333
+ : undefined,
327
334
  },
328
335
  },
329
336
  ],
@@ -28,7 +28,8 @@ function getServerConfig(wco) {
28
28
  }
29
29
  return {
30
30
  resolve: {
31
- mainFields: ['es2020', 'es2015', 'main', 'module'],
31
+ mainFields: ['es2015', 'main', 'module'],
32
+ conditionNames: ['es2015', '...'],
32
33
  },
33
34
  output: {
34
35
  libraryTarget: 'commonjs',
@@ -27,32 +27,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.getTestConfig = void 0;
30
- const glob = __importStar(require("glob"));
31
30
  const path = __importStar(require("path"));
32
31
  const typescript_1 = require("typescript");
33
32
  const helpers_1 = require("../utils/helpers");
34
33
  function getTestConfig(wco) {
35
- const { buildOptions: { codeCoverage, codeCoverageExclude, main, sourceMap, webWorkerTsConfig }, root, sourceRoot, } = wco;
36
- const extraRules = [];
34
+ const { buildOptions: { main, sourceMap, webWorkerTsConfig }, root, } = wco;
37
35
  const extraPlugins = [];
38
- if (codeCoverage) {
39
- const exclude = [/\.(e2e|spec)\.tsx?$/, /node_modules/];
40
- if (codeCoverageExclude) {
41
- for (const excludeGlob of codeCoverageExclude) {
42
- glob
43
- .sync(path.join(root, excludeGlob), { nodir: true })
44
- .forEach((file) => exclude.push(path.normalize(file)));
45
- }
46
- }
47
- extraRules.push({
48
- test: /\.[cm]?[tj]sx?$/,
49
- loader: require.resolve('@jsdevtools/coverage-istanbul-loader'),
50
- options: { esModules: true },
51
- enforce: 'post',
52
- exclude,
53
- include: sourceRoot,
54
- });
55
- }
56
36
  if (sourceMap.scripts || sourceMap.styles) {
57
37
  extraPlugins.push((0, helpers_1.getSourceMapDevTool)(sourceMap.scripts, sourceMap.styles, false, true));
58
38
  }
@@ -68,7 +48,6 @@ function getTestConfig(wco) {
68
48
  main: path.resolve(root, main),
69
49
  },
70
50
  module: {
71
- rules: extraRules,
72
51
  parser: webWorkerTsConfig === undefined
73
52
  ? {
74
53
  javascript: {
@@ -20,3 +20,4 @@ export declare function getSourceMapDevTool(scriptsSourceMap: boolean | undefine
20
20
  export declare function isPolyfillsEntry(name: string): boolean;
21
21
  export declare function getWatchOptions(poll: number | undefined): NonNullable<Configuration['watchOptions']>;
22
22
  export declare function assetNameTemplateFactory(hashFormat: HashFormat): (resourcePath: string) => string;
23
+ export declare function getInstrumentationExcludedPaths(sourceRoot: string, excludedPaths: string[]): Set<string>;
@@ -25,8 +25,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  __setModuleDefault(result, mod);
26
26
  return result;
27
27
  };
28
+ var __importDefault = (this && this.__importDefault) || function (mod) {
29
+ return (mod && mod.__esModule) ? mod : { "default": mod };
30
+ };
28
31
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.assetNameTemplateFactory = exports.getWatchOptions = exports.isPolyfillsEntry = exports.getSourceMapDevTool = exports.normalizeExtraEntryPoints = exports.getOutputHashFormat = void 0;
32
+ exports.getInstrumentationExcludedPaths = exports.assetNameTemplateFactory = exports.getWatchOptions = exports.isPolyfillsEntry = exports.getSourceMapDevTool = exports.normalizeExtraEntryPoints = exports.getOutputHashFormat = void 0;
33
+ const glob_1 = __importDefault(require("glob"));
30
34
  const path = __importStar(require("path"));
31
35
  const webpack_1 = require("webpack");
32
36
  function getOutputHashFormat(option, length = 20) {
@@ -126,3 +130,13 @@ function assetNameTemplateFactory(hashFormat) {
126
130
  };
127
131
  }
128
132
  exports.assetNameTemplateFactory = assetNameTemplateFactory;
133
+ function getInstrumentationExcludedPaths(sourceRoot, excludedPaths) {
134
+ const excluded = new Set();
135
+ for (const excludeGlob of excludedPaths) {
136
+ glob_1.default
137
+ .sync(path.join(sourceRoot, excludeGlob), { nodir: true })
138
+ .forEach((p) => excluded.add(path.normalize(p)));
139
+ }
140
+ return excluded;
141
+ }
142
+ exports.getInstrumentationExcludedPaths = getInstrumentationExcludedPaths;