@nx/webpack 16.8.0-beta.3 → 16.8.0-beta.5

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.
@@ -1,38 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.webpackInitSchematic = exports.webpackInitGenerator = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
7
6
  const versions_1 = require("../../utils/versions");
8
- function webpackInitGenerator(tree, schema) {
9
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
- const tasks = [];
11
- const devDependencies = {
12
- '@nx/webpack': versions_1.nxVersion,
13
- };
14
- if (schema.compiler === 'swc') {
15
- devDependencies['swc-loader'] = versions_1.swcLoaderVersion;
16
- const addSwcTask = (0, add_swc_dependencies_1.addSwcDependencies)(tree);
17
- tasks.push(addSwcTask);
18
- }
19
- if (schema.compiler === 'tsc') {
20
- devDependencies['tslib'] = versions_1.tsLibVersion;
21
- }
22
- if (schema.uiFramework === 'react') {
23
- devDependencies['@pmmmwh/react-refresh-webpack-plugin'] =
24
- versions_1.reactRefreshWebpackPluginVersion;
25
- devDependencies['@svgr/webpack'] = versions_1.svgrWebpackVersion;
26
- devDependencies['react-refresh'] = versions_1.reactRefreshVersion;
27
- devDependencies['url-loader'] = versions_1.urlLoaderVersion;
28
- }
29
- if (!schema.skipFormat) {
30
- yield (0, devkit_1.formatFiles)(tree);
31
- }
32
- const baseInstalTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies);
33
- tasks.push(baseInstalTask);
34
- return (0, devkit_1.runTasksInSerial)(...tasks);
35
- });
7
+ async function webpackInitGenerator(tree, schema) {
8
+ const tasks = [];
9
+ const devDependencies = {
10
+ '@nx/webpack': versions_1.nxVersion,
11
+ };
12
+ if (schema.compiler === 'swc') {
13
+ devDependencies['swc-loader'] = versions_1.swcLoaderVersion;
14
+ const addSwcTask = (0, add_swc_dependencies_1.addSwcDependencies)(tree);
15
+ tasks.push(addSwcTask);
16
+ }
17
+ if (schema.compiler === 'tsc') {
18
+ devDependencies['tslib'] = versions_1.tsLibVersion;
19
+ }
20
+ if (schema.uiFramework === 'react') {
21
+ devDependencies['@pmmmwh/react-refresh-webpack-plugin'] =
22
+ versions_1.reactRefreshWebpackPluginVersion;
23
+ devDependencies['@svgr/webpack'] = versions_1.svgrWebpackVersion;
24
+ devDependencies['react-refresh'] = versions_1.reactRefreshVersion;
25
+ devDependencies['url-loader'] = versions_1.urlLoaderVersion;
26
+ }
27
+ if (!schema.skipFormat) {
28
+ await (0, devkit_1.formatFiles)(tree);
29
+ }
30
+ const baseInstalTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies);
31
+ tasks.push(baseInstalTask);
32
+ return (0, devkit_1.runTasksInSerial)(...tasks);
36
33
  }
37
34
  exports.webpackInitGenerator = webpackInitGenerator;
38
35
  exports.default = webpackInitGenerator;
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  const add_babel_inputs_1 = require("@nx/js/src/utils/add-babel-inputs");
6
- function default_1(tree) {
7
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
- (0, add_babel_inputs_1.addBabelInputs)(tree);
9
- yield (0, devkit_1.formatFiles)(tree);
10
- });
5
+ async function default_1(tree) {
6
+ (0, add_babel_inputs_1.addBabelInputs)(tree);
7
+ await (0, devkit_1.formatFiles)(tree);
11
8
  }
12
9
  exports.default = default_1;
@@ -1,24 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
- function default_1(tree) {
6
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
7
- const projects = (0, devkit_1.getProjects)(tree);
8
- projects.forEach((p) => {
9
- let shouldUpdate = false;
10
- Object.entries(p.targets).forEach(([name, config]) => {
11
- var _a, _b, _c, _d, _e, _f;
12
- if (((_b = (_a = p.targets) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.executor) === '@nrwl/webpack:webpack' &&
13
- ((_d = (_c = p.targets) === null || _c === void 0 ? void 0 : _c[name]) === null || _d === void 0 ? void 0 : _d.options.es2015Polyfills)) {
14
- (_f = (_e = p.targets) === null || _e === void 0 ? void 0 : _e[name]) === null || _f === void 0 ? true : delete _f.options.es2015Polyfills;
15
- shouldUpdate = true;
16
- }
17
- });
18
- if (shouldUpdate) {
19
- (0, devkit_1.updateProjectConfiguration)(tree, p.name, p);
4
+ async function default_1(tree) {
5
+ const projects = (0, devkit_1.getProjects)(tree);
6
+ projects.forEach((p) => {
7
+ let shouldUpdate = false;
8
+ Object.entries(p.targets).forEach(([name, config]) => {
9
+ if (p.targets?.[name]?.executor === '@nrwl/webpack:webpack' &&
10
+ p.targets?.[name]?.options.es2015Polyfills) {
11
+ delete p.targets?.[name]?.options.es2015Polyfills;
12
+ shouldUpdate = true;
20
13
  }
21
14
  });
15
+ if (shouldUpdate) {
16
+ (0, devkit_1.updateProjectConfiguration)(tree, p.name, p);
17
+ }
22
18
  });
23
19
  }
24
20
  exports.default = default_1;
@@ -1,49 +1,46 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
6
5
  const path_1 = require("path");
7
- function default_1(tree) {
8
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
- // Since projects can have multiple configurations, we need to know if the default options
10
- // need to be migrated or not. If so then the subsequent configurations with `webpackConfig` also need to be.
11
- const defaultOptionsUpdated = new Set();
12
- (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/webpack:webpack', (options, projectName, targetName, configurationName) => {
13
- var _a;
14
- const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
15
- const defaultOptions = projectConfiguration.targets[targetName].options;
16
- const defaultWasUpdated = defaultOptionsUpdated.has(projectName);
17
- // If default was not updated (for different configurations), we don't do anything
18
- // If isolatedConfig is set, we don't need to do anything
19
- // If project is React, we don't need to do anything
20
- if (!defaultWasUpdated &&
21
- ((defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.isolatedConfig) ||
22
- ((_a = defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.main) === null || _a === void 0 ? void 0 : _a.match(/main\.(t|j)sx$/)) ||
23
- (defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.webpackConfig) === '@nrwl/react/plugins/webpack')) {
24
- return;
6
+ async function default_1(tree) {
7
+ // Since projects can have multiple configurations, we need to know if the default options
8
+ // need to be migrated or not. If so then the subsequent configurations with `webpackConfig` also need to be.
9
+ const defaultOptionsUpdated = new Set();
10
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/webpack:webpack', (options, projectName, targetName, configurationName) => {
11
+ const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
12
+ const defaultOptions = projectConfiguration.targets[targetName].options;
13
+ const defaultWasUpdated = defaultOptionsUpdated.has(projectName);
14
+ // If default was not updated (for different configurations), we don't do anything
15
+ // If isolatedConfig is set, we don't need to do anything
16
+ // If project is React, we don't need to do anything
17
+ if (!defaultWasUpdated &&
18
+ (defaultOptions?.isolatedConfig ||
19
+ defaultOptions?.main?.match(/main\.(t|j)sx$/) ||
20
+ defaultOptions?.webpackConfig === '@nrwl/react/plugins/webpack')) {
21
+ return;
22
+ }
23
+ defaultOptionsUpdated.add(projectName);
24
+ // If this is not the base options (e.g. for development, production, or something custom),
25
+ // then skip it unless it specifically configures a webpackConfig file
26
+ if (configurationName && !options?.webpackConfig) {
27
+ return;
28
+ }
29
+ // If webpackConfig is set, update it with the new options
30
+ // If webpackConfig is not set, we need to create a new
31
+ // webpack.config.js file and set the path to it in the
32
+ // executor options
33
+ if (options?.webpackConfig) {
34
+ let oldName = options.webpackConfig;
35
+ if (options.webpackConfig.endsWith('.js')) {
36
+ oldName = options.webpackConfig.replace('.js', '.old.js');
25
37
  }
26
- defaultOptionsUpdated.add(projectName);
27
- // If this is not the base options (e.g. for development, production, or something custom),
28
- // then skip it unless it specifically configures a webpackConfig file
29
- if (configurationName && !(options === null || options === void 0 ? void 0 : options.webpackConfig)) {
30
- return;
38
+ if (options.webpackConfig.endsWith('.ts')) {
39
+ oldName = options.webpackConfig.replace('.ts', '.old.ts');
31
40
  }
32
- // If webpackConfig is set, update it with the new options
33
- // If webpackConfig is not set, we need to create a new
34
- // webpack.config.js file and set the path to it in the
35
- // executor options
36
- if (options === null || options === void 0 ? void 0 : options.webpackConfig) {
37
- let oldName = options.webpackConfig;
38
- if (options.webpackConfig.endsWith('.js')) {
39
- oldName = options.webpackConfig.replace('.js', '.old.js');
40
- }
41
- if (options.webpackConfig.endsWith('.ts')) {
42
- oldName = options.webpackConfig.replace('.ts', '.old.ts');
43
- }
44
- renameFile(tree, options.webpackConfig, oldName);
45
- const justTheFileName = (0, path_1.basename)(oldName);
46
- tree.write(options.webpackConfig, `
41
+ renameFile(tree, options.webpackConfig, oldName);
42
+ const justTheFileName = (0, path_1.basename)(oldName);
43
+ tree.write(options.webpackConfig, `
47
44
  const { composePlugins, withNx } = require('@nrwl/webpack');
48
45
 
49
46
  // Nx plugins for webpack.
@@ -51,30 +48,30 @@ function default_1(tree) {
51
48
  // Note: This was added by an Nx migration.
52
49
  // You should consider inlining the logic into this file.
53
50
  // For more information on webpack config and Nx see:
54
- // https://nx.dev/packages/webpack/documents/webpack-config-setup
51
+ // https://nx.dev/recipes/webpack/webpack-config-setup
55
52
  return require('./${justTheFileName}')(config, context);
56
53
  });
57
54
  `);
58
- options.isolatedConfig = true;
59
- projectConfiguration.targets[targetName][configurationName !== null && configurationName !== void 0 ? configurationName : 'options'] = options;
60
- (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
61
- devkit_1.logger.info(`
55
+ options.isolatedConfig = true;
56
+ projectConfiguration.targets[targetName][configurationName ?? 'options'] = options;
57
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
58
+ devkit_1.logger.info(`
62
59
  ${options.webpackConfig} has been renamed to ${oldName} and a new ${options.webpackConfig}
63
60
  has been created for your project ${projectName}.
64
61
  You should consider inlining the logic from ${oldName} into ${options.webpackConfig}.
65
62
  You can read our guide on how to do this here:
66
63
 
67
- https://nx.dev/packages/webpack/documents/webpack-config-setup
64
+ https://nx.dev/recipes/webpack/webpack-config-setup
68
65
  `);
66
+ }
67
+ else {
68
+ const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
69
+ if (!options) {
70
+ options = {};
69
71
  }
70
- else {
71
- const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
72
- if (!options) {
73
- options = {};
74
- }
75
- options.webpackConfig = `${projectConfiguration.root}/webpack.config.js`;
76
- options.isolatedConfig = true;
77
- tree.write(options.webpackConfig, `
72
+ options.webpackConfig = `${projectConfiguration.root}/webpack.config.js`;
73
+ options.isolatedConfig = true;
74
+ tree.write(options.webpackConfig, `
78
75
  const { composePlugins, withNx } = require('@nrwl/webpack');
79
76
 
80
77
  // Nx plugins for webpack.
@@ -82,16 +79,15 @@ function default_1(tree) {
82
79
  // Update the webpack config as needed here.
83
80
  // e.g. config.plugins.push(new MyPlugin())
84
81
  // For more information on webpack config and Nx see:
85
- // https://nx.dev/packages/webpack/documents/webpack-config-setup
82
+ // https://nx.dev/recipes/webpack/webpack-config-setup
86
83
  return config;
87
84
  });
88
85
  `);
89
- projectConfiguration.targets[targetName].options = options;
90
- (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
91
- }
92
- });
93
- yield (0, devkit_1.formatFiles)(tree);
86
+ projectConfiguration.targets[targetName].options = options;
87
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
88
+ }
94
89
  });
90
+ await (0, devkit_1.formatFiles)(tree);
95
91
  }
96
92
  exports.default = default_1;
97
93
  function renameFile(tree, from, to) {
@@ -1,20 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
6
- function default_1(tree) {
7
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
- (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/webpack:webpack', (options, projectName, targetName, _configurationName) => {
9
- if (options.babelUpwardRootMode !== undefined) {
10
- return;
11
- }
12
- const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
13
- projectConfiguration.targets[targetName].options.babelUpwardRootMode =
14
- true;
15
- (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
16
- });
17
- yield (0, devkit_1.formatFiles)(tree);
5
+ async function default_1(tree) {
6
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/webpack:webpack', (options, projectName, targetName, _configurationName) => {
7
+ if (options.babelUpwardRootMode !== undefined) {
8
+ return;
9
+ }
10
+ const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
11
+ projectConfiguration.targets[targetName].options.babelUpwardRootMode =
12
+ true;
13
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
18
14
  });
15
+ await (0, devkit_1.formatFiles)(tree);
19
16
  }
20
17
  exports.default = default_1;
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
6
- function replacePackage(tree) {
7
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
- yield (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/webpack', '@nx/webpack');
9
- yield (0, devkit_1.formatFiles)(tree);
10
- });
5
+ async function replacePackage(tree) {
6
+ await (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/webpack', '@nx/webpack');
7
+ await (0, devkit_1.formatFiles)(tree);
11
8
  }
12
9
  exports.default = replacePackage;
@@ -18,7 +18,6 @@ class GeneratePackageJsonPlugin {
18
18
  name: pluginName,
19
19
  stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
20
20
  }, () => {
21
- var _a;
22
21
  const helperDependencies = (0, js_2.getHelperDependenciesFromProjectGraph)(this.context.root, this.context.projectName, this.projectGraph);
23
22
  const importHelpers = !!(0, js_2.readTsConfig)(this.options.tsConfig).options
24
23
  .importHelpers;
@@ -37,9 +36,10 @@ class GeneratePackageJsonPlugin {
37
36
  isProduction: true,
38
37
  helperDependencies: helperDependencies.map((dep) => dep.target),
39
38
  });
40
- packageJson.main = (_a = packageJson.main) !== null && _a !== void 0 ? _a : this.options.outputFileName;
39
+ packageJson.main = packageJson.main ?? this.options.outputFileName;
41
40
  compilation.emitAsset('package.json', new webpack_1.sources.RawSource((0, devkit_1.serializeJson)(packageJson)));
42
- compilation.emitAsset((0, js_2.getLockFileName)(), new webpack_1.sources.RawSource((0, js_1.createLockFile)(packageJson)));
41
+ const packageManager = (0, devkit_1.detectPackageManager)(this.context.root);
42
+ compilation.emitAsset((0, js_2.getLockFileName)(packageManager), new webpack_1.sources.RawSource((0, js_1.createLockFile)(packageJson, this.projectGraph, packageManager)));
43
43
  });
44
44
  });
45
45
  }
@@ -2,8 +2,10 @@ import type { Compiler } from 'webpack';
2
2
  export declare class WebpackNxBuildCoordinationPlugin {
3
3
  private readonly buildCmd;
4
4
  private currentlyRunning;
5
+ private buildCmdProcess;
5
6
  constructor(buildCmd: string, skipInitialBuild?: boolean);
6
7
  apply(compiler: Compiler): void;
7
- startWatchingBuildableLibs(): void;
8
+ startWatchingBuildableLibs(): Promise<void>;
8
9
  buildChangedProjects(): Promise<void>;
10
+ private createFileWatcher;
9
11
  }
@@ -1,50 +1,81 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WebpackNxBuildCoordinationPlugin = void 0;
4
- const tslib_1 = require("tslib");
5
- const chokidar_1 = require("chokidar");
6
4
  const child_process_1 = require("child_process");
7
- const devkit_1 = require("@nx/devkit");
8
- const devkit_2 = require("@nx/devkit");
9
- const ignore_1 = require("ignore");
10
- const fs_1 = require("fs");
5
+ const client_1 = require("nx/src/daemon/client/client");
6
+ const watch_1 = require("nx/src/command-line/watch");
7
+ const output_1 = require("nx/src/utils/output");
11
8
  class WebpackNxBuildCoordinationPlugin {
12
9
  constructor(buildCmd, skipInitialBuild) {
13
10
  this.buildCmd = buildCmd;
14
11
  this.currentlyRunning = 'none';
12
+ this.buildCmdProcess = null;
15
13
  if (!skipInitialBuild) {
16
14
  this.buildChangedProjects();
17
15
  }
18
16
  this.startWatchingBuildableLibs();
19
17
  }
20
18
  apply(compiler) {
21
- compiler.hooks.beforeCompile.tapPromise('IncrementalDevServerPlugin', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
19
+ compiler.hooks.beforeCompile.tapPromise('IncrementalDevServerPlugin', async () => {
22
20
  while (this.currentlyRunning === 'nx-build') {
23
- yield sleep(50);
21
+ await sleep(50);
24
22
  }
25
23
  this.currentlyRunning = 'webpack-build';
26
- }));
27
- compiler.hooks.done.tapPromise('IncrementalDevServerPlugin', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
24
+ });
25
+ compiler.hooks.done.tapPromise('IncrementalDevServerPlugin', async () => {
28
26
  this.currentlyRunning = 'none';
29
- }));
27
+ });
30
28
  }
31
- startWatchingBuildableLibs() {
32
- createFileWatcher(process.cwd(), () => {
33
- this.buildChangedProjects();
29
+ async startWatchingBuildableLibs() {
30
+ const unregisterFileWatcher = await this.createFileWatcher();
31
+ process.on('exit', () => {
32
+ unregisterFileWatcher();
34
33
  });
35
34
  }
36
- buildChangedProjects() {
37
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
- while (this.currentlyRunning === 'webpack-build') {
39
- yield sleep(50);
35
+ async buildChangedProjects() {
36
+ while (this.currentlyRunning === 'webpack-build') {
37
+ await sleep(50);
38
+ }
39
+ this.currentlyRunning = 'nx-build';
40
+ try {
41
+ return await new Promise((res) => {
42
+ this.buildCmdProcess = (0, child_process_1.exec)(this.buildCmd);
43
+ this.buildCmdProcess.stdout.pipe(process.stdout);
44
+ this.buildCmdProcess.stderr.pipe(process.stderr);
45
+ this.buildCmdProcess.on('exit', () => {
46
+ res();
47
+ });
48
+ this.buildCmdProcess.on('error', () => {
49
+ res();
50
+ });
51
+ });
52
+ }
53
+ finally {
54
+ this.currentlyRunning = 'none';
55
+ this.buildCmdProcess = null;
56
+ }
57
+ }
58
+ createFileWatcher() {
59
+ const runner = new watch_1.BatchFunctionRunner(() => this.buildChangedProjects());
60
+ return client_1.daemonClient.registerFileWatcher({
61
+ watchProjects: 'all',
62
+ }, (err, { changedProjects, changedFiles }) => {
63
+ if (err === 'closed') {
64
+ output_1.output.error({
65
+ title: 'Watch connection closed',
66
+ bodyLines: [
67
+ 'The daemon has closed the connection to this watch process.',
68
+ 'Please restart your watch command.',
69
+ ],
70
+ });
71
+ process.exit(1);
40
72
  }
41
- this.currentlyRunning = 'nx-build';
42
- try {
43
- (0, child_process_1.execSync)(this.buildCmd, { stdio: [0, 1, 2] });
44
- // eslint-disable-next-line no-empty
73
+ if (this.buildCmdProcess) {
74
+ this.buildCmdProcess.kill(2);
75
+ this.buildCmdProcess = null;
45
76
  }
46
- catch (e) { }
47
- this.currentlyRunning = 'none';
77
+ // Queue a build
78
+ runner.enqueue(changedProjects, changedFiles);
48
79
  });
49
80
  }
50
81
  }
@@ -52,32 +83,3 @@ exports.WebpackNxBuildCoordinationPlugin = WebpackNxBuildCoordinationPlugin;
52
83
  function sleep(time) {
53
84
  return new Promise((resolve) => setTimeout(resolve, time));
54
85
  }
55
- function getIgnoredGlobs(root) {
56
- const ig = (0, ignore_1.default)();
57
- try {
58
- ig.add((0, fs_1.readFileSync)(`${root}/.gitignore`, 'utf-8'));
59
- }
60
- catch (_a) { }
61
- try {
62
- ig.add((0, fs_1.readFileSync)(`${root}/.nxignore`, 'utf-8'));
63
- }
64
- catch (_b) { }
65
- return ig;
66
- }
67
- function createFileWatcher(root, changeHandler) {
68
- const ignoredGlobs = getIgnoredGlobs(root);
69
- const layout = (0, devkit_1.workspaceLayout)();
70
- const watcher = (0, chokidar_1.watch)([
71
- (0, devkit_2.joinPathFragments)(layout.appsDir, '**'),
72
- (0, devkit_2.joinPathFragments)(layout.libsDir, '**'),
73
- ], {
74
- cwd: root,
75
- ignoreInitial: true,
76
- });
77
- watcher.on('all', (_event, path) => {
78
- if (ignoredGlobs.ignores(path))
79
- return;
80
- changeHandler();
81
- });
82
- return { close: () => watcher.close() };
83
- }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.composePluginsSync = exports.composePlugins = exports.getBaseWebpackPartial = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const with_nx_1 = require("./with-nx");
6
5
  const with_web_1 = require("./with-web");
7
6
  /** @deprecated use withNx and withWeb plugins directly */
@@ -12,14 +11,12 @@ function getBaseWebpackPartial(options, context) {
12
11
  }
13
12
  exports.getBaseWebpackPartial = getBaseWebpackPartial;
14
13
  function composePlugins(...plugins) {
15
- return function combined(config, ctx) {
16
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
17
- for (const plugin of plugins) {
18
- const fn = yield plugin;
19
- config = yield fn(config, ctx);
20
- }
21
- return config;
22
- });
14
+ return async function combined(config, ctx) {
15
+ for (const plugin of plugins) {
16
+ const fn = await plugin;
17
+ config = await fn(config, ctx);
18
+ }
19
+ return config;
23
20
  };
24
21
  }
25
22
  exports.composePlugins = composePlugins;
@@ -5,7 +5,6 @@ const CopyWebpackPlugin = require("copy-webpack-plugin");
5
5
  function createCopyPlugin(assets) {
6
6
  return new CopyWebpackPlugin({
7
7
  patterns: assets.map((asset) => {
8
- var _a;
9
8
  return {
10
9
  context: asset.input,
11
10
  // Now we remove starting slash to make Webpack place it from the output root.
@@ -16,7 +15,7 @@ function createCopyPlugin(assets) {
16
15
  '.gitkeep',
17
16
  '**/.DS_Store',
18
17
  '**/Thumbs.db',
19
- ...((_a = asset.ignore) !== null && _a !== void 0 ? _a : []),
18
+ ...(asset.ignore ?? []),
20
19
  ],
21
20
  dot: true,
22
21
  },
@@ -1,18 +1,6 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
1
  module.exports = require('babel-loader').custom(() => {
13
2
  return {
14
- customOptions(_a) {
15
- var { isTest, isModern, emitDecoratorMetadata } = _a, loader = __rest(_a, ["isTest", "isModern", "emitDecoratorMetadata"]);
3
+ customOptions({ isTest, isModern, emitDecoratorMetadata, ...loader }) {
16
4
  return {
17
5
  custom: { isTest, isModern, emitDecoratorMetadata },
18
6
  loader,
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeExtraEntryPoints = void 0;
4
- const tslib_1 = require("tslib");
5
4
  function normalizeExtraEntryPoints(extraEntryPoints, defaultBundleName) {
6
5
  return extraEntryPoints.map((entry) => {
7
6
  let normalizedEntry;
@@ -13,7 +12,7 @@ function normalizeExtraEntryPoints(extraEntryPoints, defaultBundleName) {
13
12
  };
14
13
  }
15
14
  else {
16
- const { inject = true } = entry, newEntry = tslib_1.__rest(entry, ["inject"]);
15
+ const { inject = true, ...newEntry } = entry;
17
16
  let bundleName;
18
17
  if (entry.bundleName) {
19
18
  bundleName = entry.bundleName;
@@ -21,7 +20,7 @@ function normalizeExtraEntryPoints(extraEntryPoints, defaultBundleName) {
21
20
  else {
22
21
  bundleName = defaultBundleName;
23
22
  }
24
- normalizedEntry = Object.assign(Object.assign({}, newEntry), { bundleName });
23
+ normalizedEntry = { ...newEntry, bundleName };
25
24
  }
26
25
  return normalizedEntry;
27
26
  });