@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,22 @@
1
+ import { Compiler } from 'webpack';
2
+ import { ExtraEntryPoint } from '../utils/models';
3
+ export interface WriteIndexHtmlOptions {
4
+ indexPath: string;
5
+ outputPath: string;
6
+ baseHref?: string;
7
+ deployUrl?: string;
8
+ sri?: boolean;
9
+ scripts?: ExtraEntryPoint[];
10
+ styles?: ExtraEntryPoint[];
11
+ crossOrigin?: 'none' | 'anonymous' | 'use-credentials';
12
+ }
13
+ export declare class WriteIndexHtmlPlugin {
14
+ private readonly options;
15
+ constructor(options: WriteIndexHtmlOptions);
16
+ apply(compiler: Compiler): void;
17
+ private getEmittedFiles;
18
+ private stripBom;
19
+ private augmentIndexHtml;
20
+ private generateSriAttributes;
21
+ private filterAndMapBuildFiles;
22
+ }
@@ -0,0 +1,251 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WriteIndexHtmlPlugin = void 0;
4
+ const webpack = require("webpack");
5
+ const crypto_1 = require("crypto");
6
+ const fs_1 = require("fs");
7
+ const interpolate_env_variables_to_index_1 = require("../utils/webpack/interpolate-env-variables-to-index");
8
+ const package_chunk_sort_1 = require("../utils/webpack/package-chunk-sort");
9
+ const path_1 = require("path");
10
+ const parse5 = require('parse5');
11
+ class WriteIndexHtmlPlugin {
12
+ constructor(options) {
13
+ this.options = options;
14
+ }
15
+ apply(compiler) {
16
+ const { outputPath, indexPath, baseHref, deployUrl, sri = false, scripts = [], styles = [], crossOrigin, } = this.options;
17
+ compiler.hooks.thisCompilation.tap('WriteIndexHtmlPlugin', (compilation) => {
18
+ compilation.hooks.processAssets.tap({
19
+ name: 'WriteIndexHtmlPlugin',
20
+ // After minification and sourcemaps are done
21
+ stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE,
22
+ }, () => {
23
+ const moduleFiles = this.getEmittedFiles(compilation);
24
+ const files = moduleFiles.filter((x) => x.extension === '.css');
25
+ let content = (0, fs_1.readFileSync)(indexPath).toString();
26
+ content = this.stripBom(content);
27
+ compilation.assets[outputPath] = this.augmentIndexHtml({
28
+ input: outputPath,
29
+ inputContent: (0, interpolate_env_variables_to_index_1.interpolateEnvironmentVariablesToIndex)(content, deployUrl),
30
+ baseHref,
31
+ deployUrl,
32
+ crossOrigin,
33
+ sri,
34
+ entrypoints: (0, package_chunk_sort_1.generateEntryPoints)({ scripts, styles }),
35
+ files: this.filterAndMapBuildFiles(files, ['.js', '.css']),
36
+ moduleFiles: this.filterAndMapBuildFiles(moduleFiles, ['.js']),
37
+ loadOutputFile: (filePath) => compilation.assets[filePath].source().toString(),
38
+ });
39
+ });
40
+ });
41
+ }
42
+ getEmittedFiles(compilation) {
43
+ const files = [];
44
+ // adds all chunks to the list of emitted files such as lazy loaded modules
45
+ for (const chunk of compilation.chunks) {
46
+ for (const file of chunk.files) {
47
+ files.push({
48
+ // The id is guaranteed to exist at this point in the compilation process
49
+ // tslint:disable-next-line: no-non-null-assertion
50
+ id: chunk.id.toString(),
51
+ name: chunk.name,
52
+ file,
53
+ extension: (0, path_1.extname)(file),
54
+ initial: chunk.isOnlyInitial(),
55
+ });
56
+ }
57
+ }
58
+ // other all files
59
+ for (const file of Object.keys(compilation.assets)) {
60
+ files.push({
61
+ file,
62
+ extension: (0, path_1.extname)(file),
63
+ initial: false,
64
+ asset: true,
65
+ });
66
+ }
67
+ // dedupe
68
+ return files.filter(({ file, name }, index) => files.findIndex((f) => f.file === file && (!name || name === f.name)) === index);
69
+ }
70
+ stripBom(data) {
71
+ return data.replace(/^\uFEFF/, '');
72
+ }
73
+ augmentIndexHtml(params) {
74
+ const { loadOutputFile, files, moduleFiles = [], entrypoints } = params;
75
+ let { crossOrigin = 'none' } = params;
76
+ if (params.sri && crossOrigin === 'none') {
77
+ crossOrigin = 'anonymous';
78
+ }
79
+ const stylesheets = new Set();
80
+ const scripts = new Set();
81
+ // Sort files in the order we want to insert them by entrypoint and dedupes duplicates
82
+ const mergedFiles = [...moduleFiles, ...files];
83
+ for (const entrypoint of entrypoints) {
84
+ for (const { extension, file, name } of mergedFiles) {
85
+ if (name !== entrypoint) {
86
+ continue;
87
+ }
88
+ switch (extension) {
89
+ case '.js':
90
+ scripts.add(file);
91
+ break;
92
+ case '.css':
93
+ stylesheets.add(file);
94
+ break;
95
+ }
96
+ }
97
+ }
98
+ // Find the head and body elements
99
+ const treeAdapter = parse5.treeAdapters.default;
100
+ const document = parse5.parse(params.inputContent, {
101
+ treeAdapter,
102
+ locationInfo: true,
103
+ });
104
+ let headElement;
105
+ let bodyElement;
106
+ for (const docChild of document.childNodes) {
107
+ if (docChild.tagName === 'html') {
108
+ for (const htmlChild of docChild.childNodes) {
109
+ if (htmlChild.tagName === 'head') {
110
+ headElement = htmlChild;
111
+ }
112
+ else if (htmlChild.tagName === 'body') {
113
+ bodyElement = htmlChild;
114
+ }
115
+ }
116
+ }
117
+ }
118
+ if (!headElement || !bodyElement) {
119
+ throw new Error('Missing head and/or body elements');
120
+ }
121
+ // Determine script insertion point
122
+ let scriptInsertionPoint;
123
+ if (bodyElement.__location && bodyElement.__location.endTag) {
124
+ scriptInsertionPoint = bodyElement.__location.endTag.startOffset;
125
+ }
126
+ else {
127
+ // Less accurate fallback
128
+ // parse5 4.x does not provide locations if malformed html is present
129
+ scriptInsertionPoint = params.inputContent.indexOf('</body>');
130
+ }
131
+ let styleInsertionPoint;
132
+ if (headElement.__location && headElement.__location.endTag) {
133
+ styleInsertionPoint = headElement.__location.endTag.startOffset;
134
+ }
135
+ else {
136
+ // Less accurate fallback
137
+ // parse5 4.x does not provide locations if malformed html is present
138
+ styleInsertionPoint = params.inputContent.indexOf('</head>');
139
+ }
140
+ // Inject into the html
141
+ const indexSource = new webpack.sources.ReplaceSource(new webpack.sources.RawSource(params.inputContent, false), params.input);
142
+ let scriptElements = '';
143
+ for (const script of scripts) {
144
+ const attrs = [
145
+ { name: 'src', value: (params.deployUrl || '') + script },
146
+ ];
147
+ if (crossOrigin !== 'none') {
148
+ attrs.push({ name: 'crossorigin', value: crossOrigin });
149
+ }
150
+ // We want to include nomodule or module when a file is not common amongs all
151
+ // such as runtime.js
152
+ const scriptPredictor = ({ file, }) => file === script;
153
+ if (!files.some(scriptPredictor)) {
154
+ // in some cases for differential loading file with the same name is avialable in both
155
+ // nomodule and module such as scripts.js
156
+ // we shall not add these attributes if that's the case
157
+ const isModuleType = moduleFiles.some(scriptPredictor);
158
+ if (isModuleType) {
159
+ attrs.push({ name: 'type', value: 'module' });
160
+ }
161
+ else {
162
+ attrs.push({ name: 'defer', value: null });
163
+ }
164
+ }
165
+ else {
166
+ attrs.push({ name: 'type', value: 'module' });
167
+ }
168
+ if (params.sri) {
169
+ const content = loadOutputFile(script);
170
+ attrs.push(...this.generateSriAttributes(content));
171
+ }
172
+ const attributes = attrs
173
+ .map((attr) => attr.value === null ? attr.name : `${attr.name}="${attr.value}"`)
174
+ .join(' ');
175
+ scriptElements += `<script ${attributes}></script>`;
176
+ }
177
+ indexSource.insert(scriptInsertionPoint, scriptElements);
178
+ // Adjust base href if specified
179
+ if (typeof params.baseHref == 'string') {
180
+ let baseElement;
181
+ for (const headChild of headElement.childNodes) {
182
+ if (headChild.tagName === 'base') {
183
+ baseElement = headChild;
184
+ }
185
+ }
186
+ const baseFragment = treeAdapter.createDocumentFragment();
187
+ if (!baseElement) {
188
+ baseElement = treeAdapter.createElement('base', undefined, [
189
+ { name: 'href', value: params.baseHref },
190
+ ]);
191
+ treeAdapter.appendChild(baseFragment, baseElement);
192
+ indexSource.insert(headElement.__location.startTag.endOffset, parse5.serialize(baseFragment, { treeAdapter }));
193
+ }
194
+ else {
195
+ let hrefAttribute;
196
+ for (const attribute of baseElement.attrs) {
197
+ if (attribute.name === 'href') {
198
+ hrefAttribute = attribute;
199
+ }
200
+ }
201
+ if (hrefAttribute) {
202
+ hrefAttribute.value = params.baseHref;
203
+ }
204
+ else {
205
+ baseElement.attrs.push({ name: 'href', value: params.baseHref });
206
+ }
207
+ treeAdapter.appendChild(baseFragment, baseElement);
208
+ indexSource.replace(baseElement.__location.startOffset, baseElement.__location.endOffset, parse5.serialize(baseFragment, { treeAdapter }));
209
+ }
210
+ }
211
+ const styleElements = treeAdapter.createDocumentFragment();
212
+ for (const stylesheet of stylesheets) {
213
+ const attrs = [
214
+ { name: 'rel', value: 'stylesheet' },
215
+ { name: 'href', value: (params.deployUrl || '') + stylesheet },
216
+ ];
217
+ if (crossOrigin !== 'none') {
218
+ attrs.push({ name: 'crossorigin', value: crossOrigin });
219
+ }
220
+ if (params.sri) {
221
+ const content = loadOutputFile(stylesheet);
222
+ attrs.push(...this.generateSriAttributes(content));
223
+ }
224
+ const element = treeAdapter.createElement('link', undefined, attrs);
225
+ treeAdapter.appendChild(styleElements, element);
226
+ }
227
+ indexSource.insert(styleInsertionPoint, parse5.serialize(styleElements, { treeAdapter }));
228
+ return indexSource;
229
+ }
230
+ generateSriAttributes(content) {
231
+ const algo = 'sha384';
232
+ const hash = (0, crypto_1.createHash)(algo).update(content, 'utf8').digest('base64');
233
+ return [{ name: 'integrity', value: `${algo}-${hash}` }];
234
+ }
235
+ filterAndMapBuildFiles(files, extensionFilter) {
236
+ const filteredFiles = [];
237
+ // This test excludes files generated by HMR (e.g. main.hot-update.js).
238
+ const hotUpdateAsset = /hot-update\.[cm]?js$/;
239
+ for (const { file, name, extension, initial } of files) {
240
+ if (name &&
241
+ initial &&
242
+ extensionFilter.includes(extension) &&
243
+ !hotUpdateAsset.test(file)) {
244
+ filteredFiles.push({ file, extension, name });
245
+ }
246
+ }
247
+ return filteredFiles;
248
+ }
249
+ }
250
+ exports.WriteIndexHtmlPlugin = WriteIndexHtmlPlugin;
251
+ //# sourceMappingURL=write-index-html-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write-index-html-plugin.js","sourceRoot":"","sources":["../../../../../packages/webpack/src/plugins/write-index-html-plugin.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAEnC,mCAAoC;AACpC,2BAAkC;AAGlC,4GAA6G;AAC7G,4EAA0E;AAC1E,+BAA+B;AAE/B,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAajC,MAAa,oBAAoB;IAC/B,YAA6B,OAA8B;QAA9B,YAAO,GAAP,OAAO,CAAuB;IAAG,CAAC;IAE/D,KAAK,CAAC,QAAkB;QACtB,MAAM,EACJ,UAAU,EACV,SAAS,EACT,QAAQ,EACR,SAAS,EACT,GAAG,GAAG,KAAK,EACX,OAAO,GAAG,EAAE,EACZ,MAAM,GAAG,EAAE,EACX,WAAW,GACZ,GAAG,IAAI,CAAC,OAAO,CAAC;QACjB,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAChC,sBAAsB,EACtB,CAAC,WAAW,EAAE,EAAE;YACd,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CACjC;gBACE,IAAI,EAAE,sBAAsB;gBAC5B,6CAA6C;gBAC7C,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,oCAAoC;aAChE,EACD,GAAG,EAAE;gBACH,MAAM,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;gBACtD,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC;gBAChE,IAAI,OAAO,GAAG,IAAA,iBAAY,EAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC;gBACjD,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,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,CAAC,QAAQ,CAAC,SAAS,CAAC;gBACnC,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAC1B;gBACA,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;aAC/C;SACF;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AAnWD,oDAmWC"}
@@ -0,0 +1,17 @@
1
+ import { ExecutorContext } from '@nx/devkit';
2
+ import { Configuration } from 'webpack';
3
+ import { NormalizedWebpackExecutorOptions } from '../executors/webpack/schema';
4
+ /** @deprecated use withNx and withWeb plugins directly */
5
+ export declare function getBaseWebpackPartial(options: NormalizedWebpackExecutorOptions, context?: ExecutorContext): Configuration;
6
+ export interface NxWebpackExecutionContext {
7
+ options: NormalizedWebpackExecutorOptions;
8
+ context: ExecutorContext;
9
+ }
10
+ export interface NxWebpackPlugin {
11
+ (config: Configuration, ctx: NxWebpackExecutionContext): Configuration;
12
+ }
13
+ export interface AsyncNxWebpackPlugin {
14
+ (config: Configuration, ctx: NxWebpackExecutionContext): Configuration | Promise<Configuration>;
15
+ }
16
+ export declare function composePlugins(...plugins: (NxWebpackPlugin | AsyncNxWebpackPlugin | Promise<NxWebpackPlugin | AsyncNxWebpackPlugin>)[]): (config: Configuration, ctx: NxWebpackExecutionContext) => Promise<Configuration>;
17
+ export declare function composePluginsSync(...plugins: NxWebpackPlugin[]): (config: Configuration, ctx: NxWebpackExecutionContext) => Configuration;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.composePluginsSync = exports.composePlugins = exports.getBaseWebpackPartial = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const with_nx_1 = require("./with-nx");
6
+ const with_web_1 = require("./with-web");
7
+ /** @deprecated use withNx and withWeb plugins directly */
8
+ function getBaseWebpackPartial(options, context) {
9
+ const config = {};
10
+ const configure = composePluginsSync((0, with_nx_1.withNx)(), (0, with_web_1.withWeb)());
11
+ return configure(config, { options, context });
12
+ }
13
+ exports.getBaseWebpackPartial = getBaseWebpackPartial;
14
+ 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
+ });
23
+ };
24
+ }
25
+ exports.composePlugins = composePlugins;
26
+ function composePluginsSync(...plugins) {
27
+ return function combined(config, ctx) {
28
+ for (const plugin of plugins) {
29
+ config = plugin(config, ctx);
30
+ }
31
+ return config;
32
+ };
33
+ }
34
+ exports.composePluginsSync = composePluginsSync;
35
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../packages/webpack/src/utils/config.ts"],"names":[],"mappings":";;;;AAIA,uCAAmC;AACnC,yCAAqC;AAErC,0DAA0D;AAC1D,SAAgB,qBAAqB,CACnC,OAAyC,EACzC,OAAyB;IAEzB,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,MAAM,SAAS,GAAG,kBAAkB,CAAC,IAAA,gBAAM,GAAE,EAAE,IAAA,kBAAO,GAAE,CAAC,CAAC;IAC1D,OAAO,SAAS,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AACjD,CAAC;AAPD,sDAOC;AAgBD,SAAgB,cAAc,CAC5B,GAAG,OAIA;IAEH,OAAO,SAAe,QAAQ,CAC5B,MAAqB,EACrB,GAA8B;;YAE9B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;gBAC5B,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC;gBACxB,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;aAChC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA,CAAC;AACJ,CAAC;AAjBD,wCAiBC;AAED,SAAgB,kBAAkB,CAAC,GAAG,OAA0B;IAC9D,OAAO,SAAS,QAAQ,CACtB,MAAqB,EACrB,GAA8B;QAE9B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC5B,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;SAC9B;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAVD,gDAUC"}
@@ -0,0 +1,3 @@
1
+ import * as CopyWebpackPlugin from 'copy-webpack-plugin';
2
+ import { AssetGlobPattern } from '../executors/webpack/schema';
3
+ export declare function createCopyPlugin(assets: AssetGlobPattern[]): CopyWebpackPlugin;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCopyPlugin = void 0;
4
+ const CopyWebpackPlugin = require("copy-webpack-plugin");
5
+ function createCopyPlugin(assets) {
6
+ return new CopyWebpackPlugin({
7
+ patterns: assets.map((asset) => {
8
+ var _a;
9
+ return {
10
+ context: asset.input,
11
+ // Now we remove starting slash to make Webpack place it from the output root.
12
+ to: asset.output,
13
+ from: asset.glob,
14
+ globOptions: {
15
+ ignore: [
16
+ '.gitkeep',
17
+ '**/.DS_Store',
18
+ '**/Thumbs.db',
19
+ ...((_a = asset.ignore) !== null && _a !== void 0 ? _a : []),
20
+ ],
21
+ dot: true,
22
+ },
23
+ };
24
+ }),
25
+ });
26
+ }
27
+ exports.createCopyPlugin = createCopyPlugin;
28
+ //# sourceMappingURL=create-copy-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-copy-plugin.js","sourceRoot":"","sources":["../../../../../packages/webpack/src/utils/create-copy-plugin.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AAGzD,SAAgB,gBAAgB,CAAC,MAA0B;IACzD,OAAO,IAAI,iBAAiB,CAAC;QAC3B,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;;YAC7B,OAAO;gBACL,OAAO,EAAE,KAAK,CAAC,KAAK;gBACpB,8EAA8E;gBAC9E,EAAE,EAAE,KAAK,CAAC,MAAM;gBAChB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,WAAW,EAAE;oBACX,MAAM,EAAE;wBACN,UAAU;wBACV,cAAc;wBACd,cAAc;wBACd,GAAG,CAAC,MAAA,KAAK,CAAC,MAAM,mCAAI,EAAE,CAAC;qBACxB;oBACD,GAAG,EAAE,IAAI;iBACV;aACF,CAAC;QACJ,CAAC,CAAC;KACH,CAAC,CAAC;AACL,CAAC;AApBD,4CAoBC"}
@@ -0,0 +1,6 @@
1
+ export declare function findUp(names: string | string[], from: string, stopOnNodeModules?: boolean): string;
2
+ export declare function findAllNodeModules(from: string, root?: string): string[];
3
+ /**
4
+ * Delete an output directory, but error out if it's the root of the project.
5
+ */
6
+ export declare function deleteOutputDir(root: string, outputPath: string): void;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteOutputDir = exports.findAllNodeModules = exports.findUp = void 0;
4
+ const path = require("path");
5
+ const fs_1 = require("fs");
6
+ const fileutils_1 = require("nx/src/utils/fileutils");
7
+ function findUp(names, from, stopOnNodeModules = false) {
8
+ if (!Array.isArray(names)) {
9
+ names = [names];
10
+ }
11
+ const root = path.parse(from).root;
12
+ let currentDir = from;
13
+ while (currentDir && currentDir !== root) {
14
+ for (const name of names) {
15
+ const p = path.join(currentDir, name);
16
+ if ((0, fs_1.existsSync)(p)) {
17
+ return p;
18
+ }
19
+ }
20
+ if (stopOnNodeModules) {
21
+ const nodeModuleP = path.join(currentDir, 'node_modules');
22
+ if ((0, fs_1.existsSync)(nodeModuleP)) {
23
+ return null;
24
+ }
25
+ }
26
+ currentDir = path.dirname(currentDir);
27
+ }
28
+ return null;
29
+ }
30
+ exports.findUp = findUp;
31
+ function findAllNodeModules(from, root) {
32
+ const nodeModules = [];
33
+ let current = from;
34
+ while (current && current !== root) {
35
+ const potential = path.join(current, 'node_modules');
36
+ if ((0, fileutils_1.directoryExists)(potential)) {
37
+ nodeModules.push(potential);
38
+ }
39
+ const next = path.dirname(current);
40
+ if (next === current) {
41
+ break;
42
+ }
43
+ current = next;
44
+ }
45
+ return nodeModules;
46
+ }
47
+ exports.findAllNodeModules = findAllNodeModules;
48
+ /**
49
+ * Delete an output directory, but error out if it's the root of the project.
50
+ */
51
+ function deleteOutputDir(root, outputPath) {
52
+ const resolvedOutputPath = path.resolve(root, outputPath);
53
+ if (resolvedOutputPath === root) {
54
+ throw new Error('Output path MUST not be project root directory!');
55
+ }
56
+ (0, fs_1.rmSync)(resolvedOutputPath, { recursive: true, force: true });
57
+ }
58
+ exports.deleteOutputDir = deleteOutputDir;
59
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../../../packages/webpack/src/utils/fs.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,2BAAwC;AACxC,sDAAyD;AAEzD,SAAgB,MAAM,CACpB,KAAwB,EACxB,IAAY,EACZ,iBAAiB,GAAG,KAAK;IAEzB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACzB,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;KACjB;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;IAEnC,IAAI,UAAU,GAAG,IAAI,CAAC;IACtB,OAAO,UAAU,IAAI,UAAU,KAAK,IAAI,EAAE;QACxC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YACtC,IAAI,IAAA,eAAU,EAAC,CAAC,CAAC,EAAE;gBACjB,OAAO,CAAC,CAAC;aACV;SACF;QAED,IAAI,iBAAiB,EAAE;YACrB,MAAM,WAAW,GAAG,IAAI,CAAC,IA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env': {};
4
+ };
5
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getClientEnvironment = void 0;
4
+ function getClientEnvironment(mode) {
5
+ // Grab NODE_ENV and NX_* environment variables and prepare them to be
6
+ // injected into the application via DefinePlugin in webpack configuration.
7
+ const NX_APP = /^NX_/i;
8
+ const raw = Object.keys(process.env)
9
+ .filter((key) => NX_APP.test(key))
10
+ .reduce((env, key) => {
11
+ env[key] = process.env[key];
12
+ return env;
13
+ },
14
+ // If mode is undefined or is dev or prod then webpack already defines this variable for us.
15
+ !mode || mode === 'development' || mode === 'production'
16
+ ? {}
17
+ : {
18
+ NODE_ENV: process.env.NODE_ENV,
19
+ });
20
+ // Stringify all values so we can feed into webpack DefinePlugin
21
+ const stringified = {
22
+ 'process.env': Object.keys(raw).reduce((env, key) => {
23
+ env[key] = JSON.stringify(raw[key]);
24
+ return env;
25
+ }, {}),
26
+ };
27
+ return { stringified };
28
+ }
29
+ exports.getClientEnvironment = getClientEnvironment;
30
+ //# sourceMappingURL=get-client-environment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-client-environment.js","sourceRoot":"","sources":["../../../../../packages/webpack/src/utils/get-client-environment.ts"],"names":[],"mappings":";;;AAAA,SAAgB,oBAAoB,CAAC,IAAa;IAChD,sEAAsE;IACtE,2EAA2E;IAC3E,MAAM,MAAM,GAAG,OAAO,CAAC;IAEvB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;SACjC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACjC,MAAM,CACL,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACX,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,GAAG,CAAC;IACb,CAAC;IACD,4FAA4F;IAC5F,CAAC,IAAI,IAAI,IAAI,KAAK,aAAa,IAAI,IAAI,KAAK,YAAY;QACtD,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC;YACE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ;SAC/B,CACN,CAAC;IAEJ,gEAAgE;IAChE,MAAM,WAAW,GAAG;QAClB,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAClD,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACpC,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC;KACP,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,CAAC;AACzB,CAAC;AA7BD,oDA6BC"}
@@ -0,0 +1 @@
1
+ export declare function getCSSModuleLocalIdent(ctx: any, localIdentName: any, localName: any, options: any): any;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCSSModuleLocalIdent = void 0;
4
+ const path_1 = require("path");
5
+ const loader_utils_1 = require("loader-utils");
6
+ function getCSSModuleLocalIdent(ctx, localIdentName, localName, options) {
7
+ // Use the filename or folder name, based on some uses the index.js / index.module.(css|scss|sass) project style
8
+ const fileNameOrFolder = ctx.resourcePath.match(/index\.module\.(css|scss|sass|styl)$/)
9
+ ? '[folder]'
10
+ : '[name]';
11
+ // Create a hash based on a the file location and class name. Will be unique across a project, and close to globally unique.
12
+ const hash = (0, loader_utils_1.getHashDigest)(path_1.posix.relative(ctx.rootContext, ctx.resourcePath) + localName, 'md5', 'base64', 5);
13
+ // Use loaderUtils to find the file or folder name
14
+ const className = (0, loader_utils_1.interpolateName)(ctx, `${fileNameOrFolder}_${localName}__${hash}`, options);
15
+ // Remove the .module that appears in every classname when based on the file and replace all "." with "_".
16
+ return className.replace('.module_', '_').replace(/\./g, '_');
17
+ }
18
+ exports.getCSSModuleLocalIdent = getCSSModuleLocalIdent;
19
+ //# sourceMappingURL=get-css-module-local-ident.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-css-module-local-ident.js","sourceRoot":"","sources":["../../../../../packages/webpack/src/utils/get-css-module-local-ident.ts"],"names":[],"mappings":";;;AAAA,+BAA6B;AAC7B,+CAA8D;AAE9D,SAAgB,sBAAsB,CACpC,GAAG,EACH,cAAc,EACd,SAAS,EACT,OAAO;IAEP,gHAAgH;IAChH,MAAM,gBAAgB,GAAG,GAAG,CAAC,YAAY,CAAC,KAAK,CAC7C,sCAAsC,CACvC;QACC,CAAC,CAAC,UAAU;QACZ,CAAC,CAAC,QAAQ,CAAC;IACb,4HAA4H;IAC5H,MAAM,IAAI,GAAG,IAAA,4BAAa,EACxB,YAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,SAAS,EAC7D,KAAK,EACL,QAAQ,EACR,CAAC,CACF,CAAC;IACF,kDAAkD;IAClD,MAAM,SAAS,GAAG,IAAA,8BAAe,EAC/B,GAAG,EACH,GAAG,gBAAgB,IAAI,SAAS,KAAK,IAAI,EAAE,EAC3C,OAAO,CACR,CAAC;IACF,0GAA0G;IAC1G,OAAO,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAChE,CAAC;AA3BD,wDA2BC"}
@@ -0,0 +1,7 @@
1
+ export interface HashFormat {
2
+ chunk: string;
3
+ extract: string;
4
+ file: string;
5
+ script: string;
6
+ }
7
+ export declare function getOutputHashFormat(option: string, length?: number): HashFormat;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOutputHashFormat = void 0;
4
+ function getOutputHashFormat(option, length = 20) {
5
+ const hashFormats = {
6
+ none: { chunk: '', extract: '', file: '', script: '' },
7
+ media: { chunk: '', extract: '', file: `.[hash:${length}]`, script: '' },
8
+ bundles: {
9
+ chunk: `.[chunkhash:${length}]`,
10
+ extract: `.[contenthash:${length}]`,
11
+ file: '',
12
+ script: `.[contenthash:${length}]`,
13
+ },
14
+ all: {
15
+ chunk: `.[chunkhash:${length}]`,
16
+ extract: `.[contenthash:${length}]`,
17
+ file: `.[contenthash:${length}]`,
18
+ script: `.[contenthash:${length}]`,
19
+ },
20
+ };
21
+ return hashFormats[option] || hashFormats['none'];
22
+ }
23
+ exports.getOutputHashFormat = getOutputHashFormat;
24
+ //# sourceMappingURL=hash-format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash-format.js","sourceRoot":"","sources":["../../../../../packages/webpack/src/utils/hash-format.ts"],"names":[],"mappings":";;;AAOA,SAAgB,mBAAmB,CAAC,MAAc,EAAE,MAAM,GAAG,EAAE;IAC7D,MAAM,WAAW,GAAqC;QACpD,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QACtD,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,MAAM,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;QACxE,OAAO,EAAE;YACP,KAAK,EAAE,eAAe,MAAM,GAAG;YAC/B,OAAO,EAAE,iBAAiB,MAAM,GAAG;YACnC,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,iBAAiB,MAAM,GAAG;SACnC;QACD,GAAG,EAAE;YACH,KAAK,EAAE,eAAe,MAAM,GAAG;YAC/B,OAAO,EAAE,iBAAiB,MAAM,GAAG;YACnC,IAAI,EAAE,iBAAiB,MAAM,GAAG;YAChC,MAAM,EAAE,iBAAiB,MAAM,GAAG;SACnC;KACF,CAAC;IACF,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AACpD,CAAC;AAlBD,kDAkBC"}
@@ -0,0 +1,23 @@
1
+ export type ExtraEntryPoint = ExtraEntryPointClass | string;
2
+ export interface ExtraEntryPointClass {
3
+ bundleName?: string;
4
+ inject?: boolean;
5
+ input: string;
6
+ }
7
+ export type NormalizedEntryPoint = Required<ExtraEntryPointClass>;
8
+ export interface EmittedFile {
9
+ id?: string;
10
+ name?: string;
11
+ file: string;
12
+ extension: string;
13
+ initial: boolean;
14
+ asset?: boolean;
15
+ }
16
+ export interface CreateWebpackConfigOptions<T = any> {
17
+ root: string;
18
+ projectRoot: string;
19
+ sourceRoot?: string;
20
+ buildOptions: T;
21
+ tsConfig: any;
22
+ tsConfigPath: string;
23
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../../packages/webpack/src/utils/models.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { Observable } from 'rxjs';
2
+ export declare function runWebpackDevServer(config: any, webpack: typeof import('webpack'), WebpackDevServer: typeof import('webpack-dev-server')): Observable<{
3
+ stats: any;
4
+ baseUrl: string;
5
+ }>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runWebpackDevServer = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ function runWebpackDevServer(config, webpack, WebpackDevServer) {
6
+ return new rxjs_1.Observable((subscriber) => {
7
+ const webpackCompiler = webpack(config);
8
+ let baseUrl;
9
+ webpackCompiler.hooks.done.tap('build-webpack', (stats) => {
10
+ subscriber.next({ stats, baseUrl });
11
+ });
12
+ const devServerConfig = config.devServer || {};
13
+ const originalOnListen = devServerConfig.onListening;
14
+ devServerConfig.onListening = function (server) {
15
+ originalOnListen(server);
16
+ const devServerOptions = server.options;
17
+ baseUrl = `${server.options.https ? 'https' : 'http'}://${server.options.host}:${server.options.port}${devServerOptions.devMiddleware.publicPath}`;
18
+ };
19
+ const webpackServer = new WebpackDevServer(devServerConfig, webpackCompiler);
20
+ try {
21
+ webpackServer.start().catch((err) => subscriber.error(err));
22
+ return () => webpackServer.stop();
23
+ }
24
+ catch (e) {
25
+ throw new Error('Could not start start dev server');
26
+ }
27
+ });
28
+ }
29
+ exports.runWebpackDevServer = runWebpackDevServer;
30
+ //# sourceMappingURL=run-webpack.js.map