@nx/webpack 16.0.0-beta.1

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 (143) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +22 -0
  3. package/README.md +63 -0
  4. package/executors.json +36 -0
  5. package/generators.json +33 -0
  6. package/index.d.ts +12 -0
  7. package/index.js +14 -0
  8. package/index.js.map +1 -0
  9. package/migrations.json +35 -0
  10. package/package.json +79 -0
  11. package/src/executors/dev-server/compat.d.ts +2 -0
  12. package/src/executors/dev-server/compat.js +6 -0
  13. package/src/executors/dev-server/compat.js.map +1 -0
  14. package/src/executors/dev-server/dev-server.impl.d.ts +7 -0
  15. package/src/executors/dev-server/dev-server.impl.js +69 -0
  16. package/src/executors/dev-server/dev-server.impl.js.map +1 -0
  17. package/src/executors/dev-server/lib/get-dev-server-config.d.ts +5 -0
  18. package/src/executors/dev-server/lib/get-dev-server-config.js +89 -0
  19. package/src/executors/dev-server/lib/get-dev-server-config.js.map +1 -0
  20. package/src/executors/dev-server/lib/serve-path.d.ts +3 -0
  21. package/src/executors/dev-server/lib/serve-path.js +46 -0
  22. package/src/executors/dev-server/lib/serve-path.js.map +1 -0
  23. package/src/executors/dev-server/schema.d.ts +17 -0
  24. package/src/executors/dev-server/schema.json +76 -0
  25. package/src/executors/ssr-dev-server/compat.d.ts +2 -0
  26. package/src/executors/ssr-dev-server/compat.js +6 -0
  27. package/src/executors/ssr-dev-server/compat.js.map +1 -0
  28. package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.d.ts +1 -0
  29. package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.js +40 -0
  30. package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.js.map +1 -0
  31. package/src/executors/ssr-dev-server/schema.d.ts +11 -0
  32. package/src/executors/ssr-dev-server/schema.json +37 -0
  33. package/src/executors/ssr-dev-server/ssr-dev-server.impl.d.ts +8 -0
  34. package/src/executors/ssr-dev-server/ssr-dev-server.impl.js +59 -0
  35. package/src/executors/ssr-dev-server/ssr-dev-server.impl.js.map +1 -0
  36. package/src/executors/webpack/compat.d.ts +2 -0
  37. package/src/executors/webpack/compat.js +6 -0
  38. package/src/executors/webpack/compat.js.map +1 -0
  39. package/src/executors/webpack/lib/get-webpack-config.d.ts +5 -0
  40. package/src/executors/webpack/lib/get-webpack-config.js +17 -0
  41. package/src/executors/webpack/lib/get-webpack-config.js.map +1 -0
  42. package/src/executors/webpack/lib/normalize-options.d.ts +4 -0
  43. package/src/executors/webpack/lib/normalize-options.js +71 -0
  44. package/src/executors/webpack/lib/normalize-options.js.map +1 -0
  45. package/src/executors/webpack/lib/run-webpack.d.ts +3 -0
  46. package/src/executors/webpack/lib/run-webpack.js +38 -0
  47. package/src/executors/webpack/lib/run-webpack.js.map +1 -0
  48. package/src/executors/webpack/schema.d.ts +105 -0
  49. package/src/executors/webpack/schema.json +414 -0
  50. package/src/executors/webpack/webpack.impl.d.ts +14 -0
  51. package/src/executors/webpack/webpack.impl.js +107 -0
  52. package/src/executors/webpack/webpack.impl.js.map +1 -0
  53. package/src/generators/init/init.d.ts +5 -0
  54. package/src/generators/init/init.js +41 -0
  55. package/src/generators/init/init.js.map +1 -0
  56. package/src/generators/init/schema.d.ts +5 -0
  57. package/src/generators/init/schema.json +28 -0
  58. package/src/generators/webpack-project/schema.d.ts +13 -0
  59. package/src/generators/webpack-project/schema.json +77 -0
  60. package/src/generators/webpack-project/webpack-project.d.ts +5 -0
  61. package/src/generators/webpack-project/webpack-project.js +111 -0
  62. package/src/generators/webpack-project/webpack-project.js.map +1 -0
  63. package/src/migrations/update-15-0-0/add-babel-inputs.d.ts +2 -0
  64. package/src/migrations/update-15-0-0/add-babel-inputs.js +13 -0
  65. package/src/migrations/update-15-0-0/add-babel-inputs.js.map +1 -0
  66. package/src/migrations/update-15-4-5/remove-es2015-polyfills-option.d.ts +2 -0
  67. package/src/migrations/update-15-4-5/remove-es2015-polyfills-option.js +25 -0
  68. package/src/migrations/update-15-4-5/remove-es2015-polyfills-option.js.map +1 -0
  69. package/src/migrations/update-15-6-3/webpack-config-setup.d.ts +2 -0
  70. package/src/migrations/update-15-6-3/webpack-config-setup.js +105 -0
  71. package/src/migrations/update-15-6-3/webpack-config-setup.js.map +1 -0
  72. package/src/migrations/update-15-7-2/add-babelUpwardRootMode-flag.d.ts +2 -0
  73. package/src/migrations/update-15-7-2/add-babelUpwardRootMode-flag.js +21 -0
  74. package/src/migrations/update-15-7-2/add-babelUpwardRootMode-flag.js.map +1 -0
  75. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  76. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
  77. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
  78. package/src/plugins/generate-package-json-plugin.d.ts +12 -0
  79. package/src/plugins/generate-package-json-plugin.js +49 -0
  80. package/src/plugins/generate-package-json-plugin.js.map +1 -0
  81. package/src/plugins/stats-json-plugin.d.ts +4 -0
  82. package/src/plugins/stats-json-plugin.js +14 -0
  83. package/src/plugins/stats-json-plugin.js.map +1 -0
  84. package/src/plugins/webpack-nx-build-coordination-plugin.d.ts +9 -0
  85. package/src/plugins/webpack-nx-build-coordination-plugin.js +84 -0
  86. package/src/plugins/webpack-nx-build-coordination-plugin.js.map +1 -0
  87. package/src/plugins/write-index-html-plugin.d.ts +22 -0
  88. package/src/plugins/write-index-html-plugin.js +251 -0
  89. package/src/plugins/write-index-html-plugin.js.map +1 -0
  90. package/src/utils/config.d.ts +17 -0
  91. package/src/utils/config.js +35 -0
  92. package/src/utils/config.js.map +1 -0
  93. package/src/utils/create-copy-plugin.d.ts +3 -0
  94. package/src/utils/create-copy-plugin.js +28 -0
  95. package/src/utils/create-copy-plugin.js.map +1 -0
  96. package/src/utils/fs.d.ts +6 -0
  97. package/src/utils/fs.js +59 -0
  98. package/src/utils/fs.js.map +1 -0
  99. package/src/utils/get-client-environment.d.ts +5 -0
  100. package/src/utils/get-client-environment.js +30 -0
  101. package/src/utils/get-client-environment.js.map +1 -0
  102. package/src/utils/get-css-module-local-ident.d.ts +1 -0
  103. package/src/utils/get-css-module-local-ident.js +19 -0
  104. package/src/utils/get-css-module-local-ident.js.map +1 -0
  105. package/src/utils/hash-format.d.ts +7 -0
  106. package/src/utils/hash-format.js +24 -0
  107. package/src/utils/hash-format.js.map +1 -0
  108. package/src/utils/models.d.ts +23 -0
  109. package/src/utils/models.js +3 -0
  110. package/src/utils/models.js.map +1 -0
  111. package/src/utils/run-webpack.d.ts +5 -0
  112. package/src/utils/run-webpack.js +30 -0
  113. package/src/utils/run-webpack.js.map +1 -0
  114. package/src/utils/versions.d.ts +8 -0
  115. package/src/utils/versions.js +13 -0
  116. package/src/utils/versions.js.map +1 -0
  117. package/src/utils/web-babel-loader.d.ts +0 -0
  118. package/src/utils/web-babel-loader.js +29 -0
  119. package/src/utils/web-babel-loader.js.map +1 -0
  120. package/src/utils/webpack/custom-webpack.d.ts +3 -0
  121. package/src/utils/webpack/custom-webpack.js +42 -0
  122. package/src/utils/webpack/custom-webpack.js.map +1 -0
  123. package/src/utils/webpack/interpolate-env-variables-to-index.d.ts +1 -0
  124. package/src/utils/webpack/interpolate-env-variables-to-index.js +31 -0
  125. package/src/utils/webpack/interpolate-env-variables-to-index.js.map +1 -0
  126. package/src/utils/webpack/normalize-entry.d.ts +2 -0
  127. package/src/utils/webpack/normalize-entry.js +30 -0
  128. package/src/utils/webpack/normalize-entry.js.map +1 -0
  129. package/src/utils/webpack/package-chunk-sort.d.ts +5 -0
  130. package/src/utils/webpack/package-chunk-sort.js +30 -0
  131. package/src/utils/webpack/package-chunk-sort.js.map +1 -0
  132. package/src/utils/webpack/plugins/postcss-cli-resources.d.ts +13 -0
  133. package/src/utils/webpack/plugins/postcss-cli-resources.js +170 -0
  134. package/src/utils/webpack/plugins/postcss-cli-resources.js.map +1 -0
  135. package/src/utils/webpack/plugins/scripts-webpack-plugin.d.ts +17 -0
  136. package/src/utils/webpack/plugins/scripts-webpack-plugin.js +121 -0
  137. package/src/utils/webpack/plugins/scripts-webpack-plugin.js.map +1 -0
  138. package/src/utils/with-nx.d.ts +61 -0
  139. package/src/utils/with-nx.js +285 -0
  140. package/src/utils/with-nx.js.map +1 -0
  141. package/src/utils/with-web.d.ts +21 -0
  142. package/src/utils/with-web.js +468 -0
  143. package/src/utils/with-web.js.map +1 -0
@@ -0,0 +1,77 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "NxWebpackProject",
4
+ "cli": "nx",
5
+ "title": "Add Webpack Configuration to a project",
6
+ "description": "Add Webpack Configuration to a project.",
7
+ "type": "object",
8
+ "properties": {
9
+ "project": {
10
+ "type": "string",
11
+ "description": "The name of the project.",
12
+ "$default": {
13
+ "$source": "argv",
14
+ "index": 0
15
+ },
16
+ "x-dropdown": "project",
17
+ "x-prompt": "What is the name of the project to set up a webpack for?",
18
+ "x-priority": "important"
19
+ },
20
+ "compiler": {
21
+ "type": "string",
22
+ "enum": ["babel", "swc", "tsc"],
23
+ "description": "The compiler to use to build source.",
24
+ "default": "babel"
25
+ },
26
+ "main": {
27
+ "type": "string",
28
+ "description": "Path relative to the workspace root for the main entry file. Defaults to '<projectRoot>/src/main.ts'.",
29
+ "x-priority": "important"
30
+ },
31
+ "tsConfig": {
32
+ "type": "string",
33
+ "description": "Path relative to the workspace root for the tsconfig file to build with. Defaults to '<projectRoot>/tsconfig.app.json'.",
34
+ "x-priority": "important"
35
+ },
36
+ "target": {
37
+ "type": "string",
38
+ "description": "Target platform for the build, same as the Webpack config option.",
39
+ "enum": ["node", "web"],
40
+ "default": "web"
41
+ },
42
+ "skipFormat": {
43
+ "description": "Skip formatting files.",
44
+ "type": "boolean",
45
+ "default": false,
46
+ "x-priority": "internal"
47
+ },
48
+ "skipPackageJson": {
49
+ "type": "boolean",
50
+ "default": false,
51
+ "description": "Do not add dependencies to `package.json`.",
52
+ "x-priority": "internal"
53
+ },
54
+ "skipValidation": {
55
+ "type": "boolean",
56
+ "default": false,
57
+ "description": "Do not perform any validation on existing project.",
58
+ "x-priority": "internal"
59
+ },
60
+ "devServer": {
61
+ "type": "boolean",
62
+ "description": "Add a serve target to run a local webpack dev-server",
63
+ "default": false
64
+ },
65
+ "webpackConfig": {
66
+ "type": "string",
67
+ "description": "Path relative to workspace root to a custom webpack file that takes a config object and returns an updated config.",
68
+ "x-priority": "internal"
69
+ },
70
+ "babelConfig": {
71
+ "type": "string",
72
+ "description": "Optionally specify a path relative to workspace root to the babel configuration file of your project.",
73
+ "x-completion-type": "file"
74
+ }
75
+ },
76
+ "required": []
77
+ }
@@ -0,0 +1,5 @@
1
+ import type { Tree } from '@nx/devkit';
2
+ import { WebpackProjectGeneratorSchema } from './schema';
3
+ export declare function webpackProjectGenerator(tree: Tree, options: WebpackProjectGeneratorSchema): Promise<import("@nx/devkit").GeneratorCallback>;
4
+ export default webpackProjectGenerator;
5
+ export declare const webpackProjectSchematic: (generatorOptions: WebpackProjectGeneratorSchema) => (tree: any, context: any) => Promise<any>;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webpackProjectSchematic = exports.webpackProjectGenerator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const init_1 = require("../init/init");
7
+ function webpackProjectGenerator(tree, options) {
8
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+ const task = yield (0, init_1.webpackInitGenerator)(tree, Object.assign(Object.assign({}, options), { skipFormat: true }));
10
+ checkForTargetConflicts(tree, options);
11
+ addBuildTarget(tree, options);
12
+ if (options.devServer) {
13
+ addServeTarget(tree, options);
14
+ }
15
+ if (!options.skipFormat) {
16
+ yield (0, devkit_1.formatFiles)(tree);
17
+ }
18
+ return task;
19
+ });
20
+ }
21
+ exports.webpackProjectGenerator = webpackProjectGenerator;
22
+ function checkForTargetConflicts(tree, options) {
23
+ var _a, _b;
24
+ if (options.skipValidation)
25
+ return;
26
+ const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
27
+ if ((_a = project.targets) === null || _a === void 0 ? void 0 : _a.build) {
28
+ throw new Error(`Project "${project.name}" already has a build target. Pass --skipValidation to ignore this error.`);
29
+ }
30
+ if (options.devServer && ((_b = project.targets) === null || _b === void 0 ? void 0 : _b.serve)) {
31
+ throw new Error(`Project "${project.name}" already has a serve target. Pass --skipValidation to ignore this error.`);
32
+ }
33
+ }
34
+ function addBuildTarget(tree, options) {
35
+ var _a, _b, _c;
36
+ const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
37
+ const buildOptions = {
38
+ target: options.target,
39
+ outputPath: (0, devkit_1.joinPathFragments)('dist', project.root),
40
+ compiler: (_a = options.compiler) !== null && _a !== void 0 ? _a : 'babel',
41
+ main: (_b = options.main) !== null && _b !== void 0 ? _b : (0, devkit_1.joinPathFragments)(project.root, 'src/main.ts'),
42
+ tsConfig: (_c = options.tsConfig) !== null && _c !== void 0 ? _c : (0, devkit_1.joinPathFragments)(project.root, 'tsconfig.app.json'),
43
+ webpackConfig: (0, devkit_1.joinPathFragments)(project.root, 'webpack.config.js'),
44
+ };
45
+ if (options.webpackConfig) {
46
+ buildOptions.webpackConfig = options.webpackConfig;
47
+ }
48
+ if (options.babelConfig) {
49
+ buildOptions.babelConfig = options.babelConfig;
50
+ }
51
+ else {
52
+ buildOptions.babelUpwardRootMode = true;
53
+ }
54
+ if (options.target === 'node') {
55
+ tree.write((0, devkit_1.joinPathFragments)(project.root, 'webpack.config.js'), `
56
+ const { composePlugins, withNx } = require('@nx/webpack');
57
+
58
+ // Nx plugins for webpack.
59
+ module.exports = composePlugins(withNx(), (config) => {
60
+ // Update the webpack config as needed here.
61
+ // e.g. \`config.plugins.push(new MyPlugin())\`
62
+ return config;
63
+ });
64
+ `);
65
+ }
66
+ else {
67
+ tree.write((0, devkit_1.joinPathFragments)(project.root, 'webpack.config.js'), `
68
+ const { composePlugins, withNx, withWeb } = require('@nx/webpack');
69
+
70
+ // Nx plugins for webpack.
71
+ module.exports = composePlugins(withNx(), withWeb(), (config) => {
72
+ // Update the webpack config as needed here.
73
+ // e.g. \`config.plugins.push(new MyPlugin())\`
74
+ return config;
75
+ });
76
+ `);
77
+ }
78
+ (0, devkit_1.updateProjectConfiguration)(tree, options.project, Object.assign(Object.assign({}, project), { targets: Object.assign(Object.assign({}, project.targets), { build: {
79
+ executor: '@nrwl/webpack:webpack',
80
+ outputs: ['{options.outputPath}'],
81
+ defaultConfiguration: 'production',
82
+ options: buildOptions,
83
+ configurations: {
84
+ production: {
85
+ optimization: true,
86
+ outputHashing: options.target === 'web' ? 'all' : 'none',
87
+ sourceMap: false,
88
+ namedChunks: false,
89
+ extractLicenses: true,
90
+ vendorChunk: false,
91
+ },
92
+ },
93
+ } }) }));
94
+ }
95
+ function addServeTarget(tree, options) {
96
+ const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
97
+ (0, devkit_1.updateProjectConfiguration)(tree, options.project, Object.assign(Object.assign({}, project), { targets: Object.assign(Object.assign({}, project.targets), { serve: {
98
+ executor: '@nrwl/webpack:dev-server',
99
+ options: {
100
+ buildTarget: `${options.project}:build`,
101
+ },
102
+ configurations: {
103
+ production: {
104
+ buildTarget: `${options.project}:build:production`,
105
+ },
106
+ },
107
+ } }) }));
108
+ }
109
+ exports.default = webpackProjectGenerator;
110
+ exports.webpackProjectSchematic = (0, devkit_1.convertNxGenerator)(webpackProjectGenerator);
111
+ //# sourceMappingURL=webpack-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack-project.js","sourceRoot":"","sources":["../../../../../../packages/webpack/src/generators/webpack-project/webpack-project.ts"],"names":[],"mappings":";;;;AACA,uCAMoB;AAEpB,uCAAoD;AAIpD,SAAsB,uBAAuB,CAC3C,IAAU,EACV,OAAsC;;QAEtC,MAAM,IAAI,GAAG,MAAM,IAAA,2BAAoB,EAAC,IAAI,kC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AS,EAAE,KAAK;wBAChB,WAAW,EAAE,KAAK;wBAClB,eAAe,EAAE,IAAI;wBACrB,WAAW,EAAE,KAAK;qBACnB;iBACF;aACF,OAEH,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,IAAU,EAAE,OAAsC;IACxE,MAAM,OAAO,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAChE,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,kCAC3C,OAAO,KACV,OAAO,kCACF,OAAO,CAAC,OAAO,KAClB,KAAK,EAAE;gBACL,QAAQ,EAAE,0BAA0B;gBACpC,OAAO,EAAE;oBACP,WAAW,EAAE,GAAG,OAAO,CAAC,OAAO,QAAQ;iBACxC;gBACD,cAAc,EAAE;oBACd,UAAU,EAAE;wBACV,WAAW,EAAE,GAAG,OAAO,CAAC,OAAO,mBAAmB;qBACnD;iBACF;aACF,OAEH,CAAC;AACL,CAAC;AAED,kBAAe,uBAAuB,CAAC;AAE1B,QAAA,uBAAuB,GAAG,IAAA,2BAAkB,EACvD,uBAAuB,CACxB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function (tree: Tree): Promise<void>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ 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
+ });
11
+ }
12
+ exports.default = default_1;
13
+ //# sourceMappingURL=add-babel-inputs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-babel-inputs.js","sourceRoot":"","sources":["../../../../../../packages/webpack/src/migrations/update-15-0-0/add-babel-inputs.ts"],"names":[],"mappings":";;;AAAA,uCAA+C;AAC/C,wEAAmE;AAEnE,mBAA+B,IAAU;;QACvC,IAAA,iCAAc,EAAC,IAAI,CAAC,CAAC;QACrB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAHD,4BAGC"}
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function (tree: Tree): Promise<void>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ 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);
20
+ }
21
+ });
22
+ });
23
+ }
24
+ exports.default = default_1;
25
+ //# sourceMappingURL=remove-es2015-polyfills-option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-es2015-polyfills-option.js","sourceRoot":"","sources":["../../../../../../packages/webpack/src/migrations/update-15-4-5/remove-es2015-polyfills-option.ts"],"names":[],"mappings":";;;AAAA,uCAA2E;AAE3E,mBAA+B,IAAU;;QACvC,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QACnC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACrB,IAAI,YAAY,GAAG,KAAK,CAAC;YAEzB,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE;;gBACnD,IACE,CAAA,MAAA,MAAA,CAAC,CAAC,OAAO,0CAAG,IAAI,CAAC,0CAAE,QAAQ,MAAK,uBAAuB;qBACvD,MAAA,MAAA,CAAC,CAAC,OAAO,0CAAG,IAAI,CAAC,0CAAE,OAAO,CAAC,eAAe,CAAA,EAC1C;oBACO,MAAA,MAAA,CAAC,CAAC,OAAO,0CAAG,IAAI,CAAC,+CAAE,OAAO,CAAC,eAAe,CAAC;oBAClD,YAAY,GAAG,IAAI,CAAC;iBACrB;YACH,CAAC,CAAC,CAAC;YAEH,IAAI,YAAY,EAAE;gBAChB,IAAA,mCAA0B,EAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;aAC7C;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CAAA;AAnBD,4BAmBC"}
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function (tree: Tree): Promise<void>;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
6
+ 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;
25
+ }
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;
31
+ }
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, `
47
+ const { composePlugins, withNx } = require('@nrwl/webpack');
48
+
49
+ // Nx plugins for webpack.
50
+ module.exports = composePlugins(withNx(), (config, { options, context }) => {
51
+ // Note: This was added by an Nx migration.
52
+ // You should consider inlining the logic into this file.
53
+ // For more information on webpack config and Nx see:
54
+ // https://nx.dev/packages/webpack/documents/webpack-config-setup
55
+ return require('./${justTheFileName}')(config, context);
56
+ });
57
+ `);
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(`
62
+ ${options.webpackConfig} has been renamed to ${oldName} and a new ${options.webpackConfig}
63
+ has been created for your project ${projectName}.
64
+ You should consider inlining the logic from ${oldName} into ${options.webpackConfig}.
65
+ You can read our guide on how to do this here:
66
+
67
+ https://nx.dev/packages/webpack/documents/webpack-config-setup
68
+ `);
69
+ }
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, `
78
+ const { composePlugins, withNx } = require('@nrwl/webpack');
79
+
80
+ // Nx plugins for webpack.
81
+ module.exports = composePlugins(withNx(), (config) => {
82
+ // Update the webpack config as needed here.
83
+ // e.g. config.plugins.push(new MyPlugin())
84
+ // For more information on webpack config and Nx see:
85
+ // https://nx.dev/packages/webpack/documents/webpack-config-setup
86
+ return config;
87
+ });
88
+ `);
89
+ projectConfiguration.targets[targetName].options = options;
90
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
91
+ }
92
+ });
93
+ yield (0, devkit_1.formatFiles)(tree);
94
+ });
95
+ }
96
+ exports.default = default_1;
97
+ function renameFile(tree, from, to) {
98
+ const buffer = tree.read(from);
99
+ if (!buffer) {
100
+ return;
101
+ }
102
+ tree.write(to, buffer);
103
+ tree.delete(from);
104
+ }
105
+ //# sourceMappingURL=webpack-config-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack-config-setup.js","sourceRoot":"","sources":["../../../../../../packages/webpack/src/migrations/update-15-6-3/webpack-config-setup.ts"],"names":[],"mappings":";;;AAAA,uCAMoB;AACpB,6FAA0F;AAE1F,+BAAgC;AAEhC,mBAA+B,IAAU;;QACvC,0FAA0F;QAC1F,6GAA6G;QAC7G,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAU,CAAC;QAChD,IAAA,+CAAsB,EACpB,IAAI,EACJ,uBAAuB,EACvB,CACE,OAA+B,EAC/B,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,EAAE;;YACF,MAAM,oBAAoB,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YACzE,MAAM,cAAc,GAAG,oBAAoB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;YACxE,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAEjE,kFAAkF;YAClF,yDAAyD;YACzD,oDAAoD;YACpD,IACE,CAAC,iBAAiB;gBAClB,CAAC,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,cAAc;qBAC7B,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,IAAI,0CAAE,KAAK,CAAC,gBAAgB,CAAC,CAAA;oBAC7C,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,aAAa,MAAK,6BAA6B,CAAC,EAClE;gBACA,OAAO;aACR;YACD,qBAAqB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAEvC,2FAA2F;YAC3F,sEAAsE;YACtE,IAAI,iBAAiB,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,CAAA,EAAE;gBAChD,OAAO;aACR;YAED,0DAA0D;YAC1D,uDAAuD;YACvD,uDAAuD;YACvD,mBAAmB;YAEnB,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,EAAE;gBAC1B,IAAI,OAA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zE,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;gBAE9B,IAAI,CAAC,KAAK,CACR,OAAO,CAAC,aAAa,EACrB;;;;;;;;;;;SAWD,CACA,CAAC;gBAEF,oBAAoB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC;gBAC3D,IAAA,mCAA0B,EAAC,IAAI,EAAE,WAAW,EAAE,oBAAoB,CAAC,CAAC;aACrE;QACH,CAAC,CACF,CAAC;QAEF,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AA1HD,4BA0HC;AAED,SAAS,UAAU,CAAC,IAAU,EAAE,IAAY,EAAE,EAAU;IACtD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE;QACX,OAAO;KACR;IACD,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function (tree: Tree): Promise<void>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ 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);
18
+ });
19
+ }
20
+ exports.default = default_1;
21
+ //# sourceMappingURL=add-babelUpwardRootMode-flag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-babelUpwardRootMode-flag.js","sourceRoot":"","sources":["../../../../../../packages/webpack/src/migrations/update-15-7-2/add-babelUpwardRootMode-flag.ts"],"names":[],"mappings":";;;AAAA,uCAKoB;AACpB,6FAA0F;AAG1F,mBAA+B,IAAU;;QACvC,IAAA,+CAAsB,EACpB,IAAI,EACJ,uBAAuB,EACvB,CACE,OAA+B,EAC/B,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,EAAE;YACF,IAAI,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE;gBAC7C,OAAO;aACR;YAED,MAAM,oBAAoB,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YACzE,oBAAoB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,mBAAmB;gBAClE,IAAI,CAAC;YACP,IAAA,mCAA0B,EAAC,IAAI,EAAE,WAAW,EAAE,oBAAoB,CAAC,CAAC;QACtE,CAAC,CACF,CAAC;QAEF,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAtBD,4BAsBC"}
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function replacePackage(tree: Tree): Promise<void>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ 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
+ });
11
+ }
12
+ exports.default = replacePackage;
13
+ //# sourceMappingURL=update-16-0-0-add-nx-packages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-16-0-0-add-nx-packages.js","sourceRoot":"","sources":["../../../../../../packages/webpack/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.ts"],"names":[],"mappings":";;;AAAA,uCAA+C;AAC/C,0EAAuF;AAEvF,SAA8B,cAAc,CAAC,IAAU;;QACrD,MAAM,IAAA,iDAA+B,EAAC,IAAI,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;QAE5E,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAJD,iCAIC"}
@@ -0,0 +1,12 @@
1
+ import { type Compiler, type WebpackPluginInstance } from 'webpack';
2
+ import { ExecutorContext } from '@nx/devkit';
3
+ export declare class GeneratePackageJsonPlugin implements WebpackPluginInstance {
4
+ private readonly options;
5
+ private readonly context;
6
+ private readonly projectGraph;
7
+ constructor(options: {
8
+ tsConfig: string;
9
+ outputFileName: string;
10
+ }, context: ExecutorContext);
11
+ apply(compiler: Compiler): void;
12
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GeneratePackageJsonPlugin = void 0;
4
+ const webpack_1 = require("webpack");
5
+ const js_1 = require("@nx/js");
6
+ const devkit_1 = require("@nx/devkit");
7
+ const js_2 = require("@nx/js");
8
+ const lock_file_1 = require("nx/src/plugins/js/lock-file/lock-file");
9
+ const pluginName = 'GeneratePackageJsonPlugin';
10
+ class GeneratePackageJsonPlugin {
11
+ constructor(options, context) {
12
+ this.options = options;
13
+ this.context = context;
14
+ this.projectGraph = context.projectGraph;
15
+ }
16
+ apply(compiler) {
17
+ compiler.hooks.thisCompilation.tap(pluginName, (compilation) => {
18
+ compilation.hooks.processAssets.tap({
19
+ name: pluginName,
20
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
21
+ }, () => {
22
+ var _a;
23
+ const helperDependencies = (0, js_2.getHelperDependenciesFromProjectGraph)(this.context.root, this.context.projectName, this.projectGraph);
24
+ const importHelpers = !!(0, js_2.readTsConfig)(this.options.tsConfig).options
25
+ .importHelpers;
26
+ const shouldAddHelperDependency = importHelpers &&
27
+ helperDependencies.every((dep) => dep.target !== js_2.HelperDependency.tsc);
28
+ if (shouldAddHelperDependency) {
29
+ helperDependencies.push({
30
+ type: 'static',
31
+ source: this.context.projectName,
32
+ target: js_2.HelperDependency.tsc,
33
+ });
34
+ }
35
+ const packageJson = (0, js_1.createPackageJson)(this.context.projectName, this.projectGraph, {
36
+ target: this.context.targetName,
37
+ root: this.context.root,
38
+ isProduction: true,
39
+ helperDependencies: helperDependencies.map((dep) => dep.target),
40
+ });
41
+ packageJson.main = (_a = packageJson.main) !== null && _a !== void 0 ? _a : this.options.outputFileName;
42
+ compilation.emitAsset('package.json', new webpack_1.sources.RawSource((0, devkit_1.serializeJson)(packageJson)));
43
+ compilation.emitAsset((0, lock_file_1.getLockFileName)(), new webpack_1.sources.RawSource((0, js_1.createLockFile)(packageJson)));
44
+ });
45
+ });
46
+ }
47
+ }
48
+ exports.GeneratePackageJsonPlugin = GeneratePackageJsonPlugin;
49
+ //# sourceMappingURL=generate-package-json-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-package-json-plugin.js","sourceRoot":"","sources":["../../../../../packages/webpack/src/plugins/generate-package-json-plugin.ts"],"names":[],"mappings":";;;AAAA,qCAA6E;AAC7E,+BAA2D;AAC3D,uCAA+E;AAC/E,+BAIgB;AAChB,qEAAwE;AAExE,MAAM,UAAU,GAAG,2BAA2B,CAAC;AAE/C,MAAa,yBAAyB;IAGpC,YACmB,OAAqD,EACrD,OAAwB;QADxB,YAAO,GAAP,OAAO,CAA8C;QACrD,YAAO,GAAP,OAAO,CAAiB;QAEzC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAA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AAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC;iBAChE,CACF,CAAC;gBACF,WAAW,CAAC,IAAI,GAAG,MAAA,WAAW,CAAC,IAAI,mCAAI,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;gBAEnE,WAAW,CAAC,SAAS,CACnB,cAAc,EACd,IAAI,iBAAO,CAAC,SAAS,CAAC,IAAA,sBAAa,EAAC,WAAW,CAAC,CAAC,CAClD,CAAC;gBACF,WAAW,CAAC,SAAS,CACnB,IAAA,2BAAe,GAAE,EACjB,IAAI,iBAAO,CAAC,SAAS,CAAC,IAAA,mBAAc,EAAC,WAAW,CAAC,CAAC,CACnD,CAAC;YACJ,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAhED,8DAgEC"}
@@ -0,0 +1,4 @@
1
+ import { Compiler } from 'webpack';
2
+ export declare class StatsJsonPlugin {
3
+ apply(compiler: Compiler): void;
4
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StatsJsonPlugin = void 0;
4
+ const webpack_1 = require("webpack");
5
+ class StatsJsonPlugin {
6
+ apply(compiler) {
7
+ compiler.hooks.emit.tap('StatsJsonPlugin', (compilation) => {
8
+ const data = JSON.stringify(compilation.getStats().toJson('verbose'));
9
+ compilation.assets[`stats.json`] = new webpack_1.sources.RawSource(data);
10
+ });
11
+ }
12
+ }
13
+ exports.StatsJsonPlugin = StatsJsonPlugin;
14
+ //# sourceMappingURL=stats-json-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats-json-plugin.js","sourceRoot":"","sources":["../../../../../packages/webpack/src/plugins/stats-json-plugin.ts"],"names":[],"mappings":";;;AAAA,qCAA4C;AAE5C,MAAa,eAAe;IAC1B,KAAK,CAAC,QAAkB;QACtB,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,WAAW,EAAE,EAAE;YACzD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;YACtE,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI,iBAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAPD,0CAOC"}
@@ -0,0 +1,9 @@
1
+ import type { Compiler } from 'webpack';
2
+ export declare class WebpackNxBuildCoordinationPlugin {
3
+ private readonly buildCmd;
4
+ private currentlyRunning;
5
+ constructor(buildCmd: string, skipInitialBuild?: boolean);
6
+ apply(compiler: Compiler): void;
7
+ startWatchingBuildableLibs(): void;
8
+ buildChangedProjects(): Promise<void>;
9
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WebpackNxBuildCoordinationPlugin = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const chokidar_1 = require("chokidar");
6
+ 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");
11
+ class WebpackNxBuildCoordinationPlugin {
12
+ constructor(buildCmd, skipInitialBuild) {
13
+ this.buildCmd = buildCmd;
14
+ this.currentlyRunning = 'none';
15
+ if (!skipInitialBuild) {
16
+ this.buildChangedProjects();
17
+ }
18
+ this.startWatchingBuildableLibs();
19
+ }
20
+ apply(compiler) {
21
+ compiler.hooks.beforeCompile.tapPromise('IncrementalDevServerPlugin', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+ while (this.currentlyRunning === 'nx-build') {
23
+ yield sleep(50);
24
+ }
25
+ this.currentlyRunning = 'webpack-build';
26
+ }));
27
+ compiler.hooks.done.tapPromise('IncrementalDevServerPlugin', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ this.currentlyRunning = 'none';
29
+ }));
30
+ }
31
+ startWatchingBuildableLibs() {
32
+ createFileWatcher(process.cwd(), () => {
33
+ this.buildChangedProjects();
34
+ });
35
+ }
36
+ buildChangedProjects() {
37
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
+ while (this.currentlyRunning === 'webpack-build') {
39
+ yield sleep(50);
40
+ }
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
45
+ }
46
+ catch (e) { }
47
+ this.currentlyRunning = 'none';
48
+ });
49
+ }
50
+ }
51
+ exports.WebpackNxBuildCoordinationPlugin = WebpackNxBuildCoordinationPlugin;
52
+ function sleep(time) {
53
+ return new Promise((resolve) => setTimeout(resolve, time));
54
+ }
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
+ }
84
+ //# sourceMappingURL=webpack-nx-build-coordination-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack-nx-build-coordination-plugin.js","sourceRoot":"","sources":["../../../../../pack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