@rushstack/heft-webpack4-plugin 0.5.16 → 0.6.0-dev.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.
package/README.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # @rushstack/heft-webpack4-plugin
2
2
 
3
- This is a Heft plugin for using Webpack 4 during the "bundle" stage.
3
+ This is a Heft plugin for using Webpack 4.
4
4
 
5
5
  ## Links
6
6
 
7
7
  - [CHANGELOG.md](
8
8
  https://github.com/microsoft/rushstack/blob/main/heft-plugins/heft-webpack4-plugin/CHANGELOG.md) - Find
9
9
  out what's new in the latest version
10
+ - [@rushstack/heft](https://www.npmjs.com/package/@rushstack/heft) - Heft is a config-driven toolchain that invokes popular tools such as TypeScript, ESLint, Jest, Webpack, and API Extractor.
10
11
 
11
12
  Heft is part of the [Rush Stack](https://rushstack.io/) family of projects.
@@ -1,49 +1,100 @@
1
+ import type { AsyncParallelHook } from 'tapable';
2
+ import type { AsyncSeriesBailHook } from 'tapable';
3
+ import type { AsyncSeriesHook } from 'tapable';
1
4
  import type { Configuration } from 'webpack-dev-server';
2
- import type { IBuildStageProperties } from '@rushstack/heft';
3
- import type { IBundleSubstageProperties } from '@rushstack/heft';
4
- import type { IHeftPlugin } from '@rushstack/heft';
5
- import type * as webpack from 'webpack';
5
+ import type { HeftConfiguration } from '@rushstack/heft';
6
+ import type { IHeftTaskSession } from '@rushstack/heft';
7
+ import type * as TWebpack from 'webpack';
6
8
 
7
9
  /**
8
10
  * @public
9
11
  */
10
- declare const _default: IHeftPlugin<void>;
11
- export default _default;
12
+ export declare type IWebpackConfiguration = IWebpackConfigurationWithDevServer | IWebpackConfigurationWithDevServer[];
12
13
 
13
14
  /**
15
+ * The environment passed into the Webpack configuration function. Loosely based
16
+ * on the default Webpack environment options, specified here:
17
+ * https://webpack.js.org/api/cli/#environment-options
18
+ *
14
19
  * @public
15
20
  */
16
- export declare interface IWebpackBuildStageProperties extends IBuildStageProperties {
17
- webpackStats?: webpack.Stats | webpack.compilation.MultiStats;
21
+ export declare interface IWebpackConfigurationFnEnvironment {
22
+ /**
23
+ * Whether or not the run is in production mode. Synonym of
24
+ * IWebpackConfigurationFnEnvironment.production.
25
+ */
26
+ prod: boolean;
27
+ /**
28
+ * Whether or not the run is in production mode. Synonym of
29
+ * IWebpackConfigurationFnEnvironment.prod.
30
+ */
31
+ production: boolean;
32
+ /**
33
+ * The task session provided to the plugin.
34
+ */
35
+ taskSession: IHeftTaskSession;
36
+ /**
37
+ * The Heft configuration provided to the plugin.
38
+ */
39
+ heftConfiguration: HeftConfiguration;
40
+ /**
41
+ * The resolved Webpack package.
42
+ */
43
+ webpack: typeof TWebpack;
44
+ }
45
+
46
+ /**
47
+ * @public
48
+ */
49
+ export declare interface IWebpackConfigurationWithDevServer extends TWebpack.Configuration {
50
+ devServer?: Configuration;
18
51
  }
19
52
 
20
53
  /**
21
54
  * @public
22
55
  */
23
- export declare interface IWebpackBundleSubstageProperties extends IBundleSubstageProperties {
56
+ export declare interface IWebpackPluginAccessor {
24
57
  /**
25
- * The configuration used by the Webpack plugin. This must be populated
26
- * for Webpack to run. If webpackConfigFilePath is specified,
27
- * this will be populated automatically with the exports of the
28
- * config file referenced in that property.
29
- *
30
- * @remarks
31
- * Tapable event handlers can return `null` instead of `undefined` to suppress
32
- * other handlers from creating a configuration object.
58
+ * Hooks that are called at various points in the Webpack plugin lifecycle.
33
59
  */
34
- webpackConfiguration?: webpack.Configuration | webpack.Configuration[] | null;
60
+ hooks: IWebpackPluginAccessorHooks;
35
61
  }
36
62
 
37
63
  /**
38
64
  * @public
39
65
  */
40
- export declare type IWebpackConfiguration = IWebpackConfigurationWithDevServer | IWebpackConfigurationWithDevServer[] | undefined;
66
+ export declare interface IWebpackPluginAccessorHooks {
67
+ /**
68
+ * A hook that allows for loading custom configurations used by the Webpack
69
+ * plugin. If a webpack configuration is provided, this will be populated automatically
70
+ * with the exports of the config file. If a webpack configuration is not provided,
71
+ * one will be loaded by the Webpack plugin.
72
+ *
73
+ * @remarks
74
+ * Tapable event handlers can return `false` instead of `undefined` to suppress
75
+ * other handlers from creating a configuration object, and prevent webpack from running.
76
+ */
77
+ readonly onLoadConfiguration: AsyncSeriesBailHook<never, never, never, IWebpackConfiguration | false>;
78
+ /**
79
+ * A hook that allows for modification of the loaded configuration used by the Webpack
80
+ * plugin. If no configuration was loaded, this hook will not be called.
81
+ */
82
+ readonly onConfigure: AsyncSeriesHook<IWebpackConfiguration, never, never>;
83
+ /**
84
+ * A hook that provides the finalized configuration that will be used by Webpack.
85
+ * If no configuration was loaded, this hook will not be called.
86
+ */
87
+ readonly onAfterConfigure: AsyncParallelHook<IWebpackConfiguration, never, never>;
88
+ /**
89
+ * A hook that provides the stats output from Webpack. If no configuration is loaded,
90
+ * this hook will not be called.
91
+ */
92
+ readonly onEmitStats: AsyncParallelHook<TWebpack.Stats | TWebpack.compilation.MultiStats, never, never>;
93
+ }
41
94
 
42
95
  /**
43
96
  * @public
44
97
  */
45
- export declare interface IWebpackConfigurationWithDevServer extends webpack.Configuration {
46
- devServer?: Configuration;
47
- }
98
+ export declare const PluginName: 'Webpack4Plugin';
48
99
 
49
100
  export { }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/heft/heft-plugin.schema.json",
3
+
4
+ "taskPlugins": [
5
+ {
6
+ "pluginName": "Webpack4Plugin",
7
+ "entryPoint": "./lib/Webpack4Plugin",
8
+ "optionsSchema": "./lib/schemas/heft-webpack4-plugin.schema.json",
9
+
10
+ "parameterScope": "webpack4",
11
+ "parameters": [
12
+ {
13
+ "longName": "--serve",
14
+ "parameterKind": "flag",
15
+ "description": "Start a local web server for testing purposes using webpack-dev-server. This parameter is only available when running in watch mode."
16
+ }
17
+ ]
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,32 @@
1
+ import type { HeftConfiguration, IHeftTaskSession, IHeftTaskPlugin } from '@rushstack/heft';
2
+ import type { IWebpackPluginAccessor } from './shared';
3
+ export interface IWebpackPluginOptions {
4
+ devConfigurationPath: string | undefined;
5
+ configurationPath: string | undefined;
6
+ }
7
+ /**
8
+ * @public
9
+ */
10
+ export declare const PLUGIN_NAME: 'Webpack4Plugin';
11
+ /**
12
+ * @internal
13
+ */
14
+ export default class Webpack4Plugin implements IHeftTaskPlugin<IWebpackPluginOptions> {
15
+ private _serve;
16
+ private _webpack;
17
+ private _webpackCompiler;
18
+ private _webpackConfiguration;
19
+ private _webpackWatchers;
20
+ private _webpackCompilationDonePromise;
21
+ private _webpackCompilationDonePromiseResolveFn;
22
+ readonly accessor: IWebpackPluginAccessor;
23
+ apply(taskSession: IHeftTaskSession, heftConfiguration: HeftConfiguration, options: IWebpackPluginOptions): void;
24
+ private _getWebpackConfigurationAsync;
25
+ private _loadWebpackAsync;
26
+ private _getWebpackCompilerAsync;
27
+ private _runWebpackAsync;
28
+ private _runWebpackWatchAsync;
29
+ private _validateEnvironmentVariable;
30
+ private _emitErrors;
31
+ }
32
+ //# sourceMappingURL=Webpack4Plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Webpack4Plugin.d.ts","sourceRoot":"","sources":["../src/Webpack4Plugin.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAEhB,eAAe,EAIhB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAGV,sBAAsB,EACvB,MAAM,UAAU,CAAC;AA8BlB,MAAM,WAAW,qBAAqB;IACpC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,gBAAmC,CAAC;AAQ9D;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,YAAW,eAAe,CAAC,qBAAqB,CAAC;IACnF,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,gBAAgB,CAAuD;IAC/E,OAAO,CAAC,qBAAqB,CAA2E;IACxG,OAAO,CAAC,gBAAgB,CAAiC;IACzD,OAAO,CAAC,8BAA8B,CAA4B;IAClE,OAAO,CAAC,uCAAuC,CAA2B;IAE1E,SAAgB,QAAQ,EAAE,sBAAsB,CAO9C;IAEK,KAAK,CACV,WAAW,EAAE,gBAAgB,EAC7B,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,EAAE,qBAAqB,GAC7B,IAAI;YA4CO,6BAA6B;YAoD7B,iBAAiB;YAQjB,wBAAwB;YAgBxB,gBAAgB;YA6ChB,qBAAqB;IA6KnC,OAAO,CAAC,4BAA4B;IAYpC,OAAO,CAAC,WAAW;CAapB"}
@@ -0,0 +1,329 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || function (mod) {
21
+ if (mod && mod.__esModule) return mod;
22
+ var result = {};
23
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
+ __setModuleDefault(result, mod);
25
+ return result;
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.PLUGIN_NAME = void 0;
29
+ const tapable_1 = require("tapable");
30
+ const debug_certificate_manager_1 = require("@rushstack/debug-certificate-manager");
31
+ const node_core_library_1 = require("@rushstack/node-core-library");
32
+ const WebpackConfigurationLoader_1 = require("./WebpackConfigurationLoader");
33
+ /**
34
+ * @public
35
+ */
36
+ exports.PLUGIN_NAME = 'Webpack4Plugin';
37
+ const SERVE_PARAMETER_LONG_NAME = '--serve';
38
+ const WEBPACK_PACKAGE_NAME = 'webpack';
39
+ const WEBPACK_DEV_SERVER_PACKAGE_NAME = 'webpack-dev-server';
40
+ const WEBPACK_DEV_SERVER_ENV_VAR_NAME = 'WEBPACK_DEV_SERVER';
41
+ const WEBPACK_DEV_MIDDLEWARE_PACKAGE_NAME = 'webpack-dev-middleware';
42
+ const UNINITIALIZED = 'UNINITIALIZED';
43
+ /**
44
+ * @internal
45
+ */
46
+ class Webpack4Plugin {
47
+ constructor() {
48
+ this._serve = false;
49
+ this._webpackConfiguration = UNINITIALIZED;
50
+ this.accessor = {
51
+ hooks: {
52
+ onLoadConfiguration: new tapable_1.AsyncSeriesBailHook(),
53
+ onConfigure: new tapable_1.AsyncSeriesHook(['webpackConfiguration']),
54
+ onAfterConfigure: new tapable_1.AsyncParallelHook(['webpackConfiguration']),
55
+ onEmitStats: new tapable_1.AsyncParallelHook(['webpackStats'])
56
+ }
57
+ };
58
+ }
59
+ apply(taskSession, heftConfiguration, options) {
60
+ this._serve = taskSession.parameters.getFlagParameter(SERVE_PARAMETER_LONG_NAME).value;
61
+ if (!taskSession.parameters.watch && this._serve) {
62
+ throw new Error(`The ${JSON.stringify(SERVE_PARAMETER_LONG_NAME)} parameter is only available when running in watch mode.`);
63
+ }
64
+ taskSession.hooks.clean.tapPromise(exports.PLUGIN_NAME, async (cleanOptions) => {
65
+ var _a;
66
+ // Obtain the finalized webpack configuration
67
+ const webpackConfiguration = await this._getWebpackConfigurationAsync(taskSession, heftConfiguration, options);
68
+ if (webpackConfiguration) {
69
+ const webpackConfigurationArray = Array.isArray(webpackConfiguration)
70
+ ? webpackConfiguration
71
+ : [webpackConfiguration];
72
+ // Add each output path to the clean list
73
+ // NOTE: Webpack plugins that write assets to paths that start with '../' or outside of the
74
+ // `output.path` will need to be manually added to the phase-level cleanup list in heft.json.
75
+ for (const config of webpackConfigurationArray) {
76
+ if ((_a = config.output) === null || _a === void 0 ? void 0 : _a.path) {
77
+ cleanOptions.addDeleteOperations({ sourcePath: config.output.path });
78
+ }
79
+ }
80
+ }
81
+ });
82
+ taskSession.hooks.run.tapPromise(exports.PLUGIN_NAME, async (runOptions) => {
83
+ await this._runWebpackAsync(taskSession, heftConfiguration, options);
84
+ });
85
+ taskSession.hooks.runIncremental.tapPromise(exports.PLUGIN_NAME, async (runOptions) => {
86
+ await this._runWebpackWatchAsync(taskSession, heftConfiguration, options);
87
+ });
88
+ }
89
+ async _getWebpackConfigurationAsync(taskSession, heftConfiguration, options) {
90
+ if (this._webpackConfiguration === UNINITIALIZED) {
91
+ // Obtain the webpack configuration by calling into the hook. If undefined
92
+ // is returned, load the default Webpack configuration.
93
+ taskSession.logger.terminal.writeVerboseLine('Attempting to load Webpack configuration via external plugins');
94
+ let webpackConfiguration = await this.accessor.hooks.onLoadConfiguration.promise();
95
+ if (webpackConfiguration === undefined) {
96
+ taskSession.logger.terminal.writeVerboseLine('Attempt to load the default Webpack configuration');
97
+ const configurationLoader = new WebpackConfigurationLoader_1.WebpackConfigurationLoader(taskSession.logger, taskSession.parameters.production, taskSession.parameters.watch && this._serve);
98
+ webpackConfiguration = await configurationLoader.tryLoadWebpackConfigurationAsync(Object.assign(Object.assign({}, options), { taskSession,
99
+ heftConfiguration, loadWebpackAsyncFn: this._loadWebpackAsync.bind(this) }));
100
+ }
101
+ if (webpackConfiguration === false) {
102
+ taskSession.logger.terminal.writeLine('Webpack disabled by external plugin');
103
+ this._webpackConfiguration = undefined;
104
+ }
105
+ else if (webpackConfiguration === undefined ||
106
+ (Array.isArray(webpackConfiguration) && webpackConfiguration.length === 0)) {
107
+ taskSession.logger.terminal.writeLine('No Webpack configuration found');
108
+ this._webpackConfiguration = undefined;
109
+ }
110
+ else {
111
+ if (this.accessor.hooks.onConfigure.isUsed()) {
112
+ // Allow for plugins to customise the configuration
113
+ await this.accessor.hooks.onConfigure.promise(webpackConfiguration);
114
+ }
115
+ if (this.accessor.hooks.onAfterConfigure.isUsed()) {
116
+ // Provide the finalized configuration
117
+ await this.accessor.hooks.onAfterConfigure.promise(webpackConfiguration);
118
+ }
119
+ this._webpackConfiguration = webpackConfiguration;
120
+ }
121
+ }
122
+ return this._webpackConfiguration;
123
+ }
124
+ async _loadWebpackAsync() {
125
+ if (!this._webpack) {
126
+ // Allow this to fail if webpack is not installed
127
+ this._webpack = await Promise.resolve().then(() => __importStar(require(WEBPACK_PACKAGE_NAME)));
128
+ }
129
+ return this._webpack;
130
+ }
131
+ async _getWebpackCompilerAsync(taskSession, webpackConfiguration) {
132
+ if (!this._webpackCompiler) {
133
+ const webpack = await this._loadWebpackAsync();
134
+ taskSession.logger.terminal.writeLine(`Using Webpack version ${webpack.version}`);
135
+ this._webpackCompiler = Array.isArray(webpackConfiguration)
136
+ ? webpack.default(webpackConfiguration) /* (webpack.Compilation[]) => MultiCompiler */
137
+ : webpack.default(webpackConfiguration); /* (webpack.Compilation) => Compiler */
138
+ }
139
+ return this._webpackCompiler;
140
+ }
141
+ async _runWebpackAsync(taskSession, heftConfiguration, options) {
142
+ this._validateEnvironmentVariable(taskSession);
143
+ if (taskSession.parameters.watch || this._serve) {
144
+ // Should never happen, but just in case
145
+ throw new node_core_library_1.InternalError('Cannot run Webpack in compilation mode when watch mode is enabled');
146
+ }
147
+ // Load the config and compiler, and return if there is no config found
148
+ const webpackConfiguration = await this._getWebpackConfigurationAsync(taskSession, heftConfiguration, options);
149
+ if (!webpackConfiguration) {
150
+ return;
151
+ }
152
+ const compiler = await this._getWebpackCompilerAsync(taskSession, webpackConfiguration);
153
+ taskSession.logger.terminal.writeLine('Running Webpack compilation');
154
+ // Run the webpack compiler
155
+ let stats;
156
+ try {
157
+ stats = await node_core_library_1.LegacyAdapters.convertCallbackToPromise(compiler.run.bind(compiler));
158
+ }
159
+ catch (e) {
160
+ taskSession.logger.emitError(e);
161
+ }
162
+ // Emit the errors from the stats object, if present
163
+ if (stats) {
164
+ this._emitErrors(taskSession.logger, stats);
165
+ if (this.accessor.hooks.onEmitStats.isUsed()) {
166
+ await this.accessor.hooks.onEmitStats.promise(stats);
167
+ }
168
+ }
169
+ }
170
+ async _runWebpackWatchAsync(taskSession, heftConfiguration, options) {
171
+ var _a;
172
+ // Save a handle to the original promise, since the this-scoped promise will be replaced whenever
173
+ // the compilation completes.
174
+ let webpackCompilationDonePromise = this._webpackCompilationDonePromise;
175
+ if (!this._webpackWatchers) {
176
+ this._validateEnvironmentVariable(taskSession);
177
+ if (!taskSession.parameters.watch) {
178
+ // Should never happen, but just in case
179
+ throw new node_core_library_1.InternalError('Cannot run Webpack in watch mode when compilation mode is enabled');
180
+ }
181
+ // Load the config and compiler, and return if there is no config found
182
+ const webpackConfiguration = await this._getWebpackConfigurationAsync(taskSession, heftConfiguration, options);
183
+ if (!webpackConfiguration) {
184
+ return;
185
+ }
186
+ // Get the compiler which will be used for both serve and watch mode
187
+ const compiler = await this._getWebpackCompilerAsync(taskSession, webpackConfiguration);
188
+ // Set up the hook to detect when the watcher completes the watcher compilation. We will also log out
189
+ // errors from the compilation if present from the output stats object.
190
+ this._webpackCompilationDonePromise = new Promise((resolve) => {
191
+ this._webpackCompilationDonePromiseResolveFn = resolve;
192
+ });
193
+ webpackCompilationDonePromise = this._webpackCompilationDonePromise;
194
+ compiler.hooks.done.tap(exports.PLUGIN_NAME, (stats) => {
195
+ this._webpackCompilationDonePromiseResolveFn();
196
+ this._webpackCompilationDonePromise = new Promise((resolve) => {
197
+ this._webpackCompilationDonePromiseResolveFn = resolve;
198
+ });
199
+ if (stats) {
200
+ this._emitErrors(taskSession.logger, stats);
201
+ }
202
+ });
203
+ // TWebpack.Compiler and TWebpack.MultiCompiler in Webpack 4 do not allow you to access the running
204
+ // watcher, so we need to patch the method to set the watcher on the parent object.
205
+ const originalWatch = compiler.watch.bind(compiler);
206
+ compiler.watch = (watchOptions, handler) => {
207
+ const watcher = originalWatch(watchOptions, handler);
208
+ compiler.watching = watcher;
209
+ return watcher;
210
+ };
211
+ // Determine how we will run the compiler. When serving, we will run the compiler
212
+ // via the webpack-dev-server. Otherwise, we will run the compiler directly.
213
+ if (this._serve) {
214
+ const defaultDevServerOptions = {
215
+ host: 'localhost',
216
+ devMiddleware: {
217
+ publicPath: '/',
218
+ stats: {
219
+ cached: false,
220
+ cachedAssets: false,
221
+ colors: heftConfiguration.terminalProvider.supportsColor
222
+ }
223
+ },
224
+ client: {
225
+ logging: 'info'
226
+ },
227
+ port: 8080,
228
+ onListening: (server) => {
229
+ var _a;
230
+ const addressInfo = (_a = server.server) === null || _a === void 0 ? void 0 : _a.address();
231
+ if (addressInfo) {
232
+ const address = typeof addressInfo === 'string' ? addressInfo : `${addressInfo.address}:${addressInfo.port}`;
233
+ taskSession.logger.terminal.writeLine(`Started Webpack Dev Server at https://${address}`);
234
+ }
235
+ }
236
+ };
237
+ // Obtain the devServerOptions from the webpack configuration, and combine with the default options
238
+ let devServerOptions;
239
+ if (Array.isArray(webpackConfiguration)) {
240
+ const filteredDevServerOptions = webpackConfiguration
241
+ .map((configuration) => configuration.devServer)
242
+ .filter((devServer) => !!devServer);
243
+ if (filteredDevServerOptions.length > 1) {
244
+ taskSession.logger.emitWarning(new Error(`Detected multiple webpack devServer configurations, using the first one.`));
245
+ }
246
+ devServerOptions = Object.assign(Object.assign({}, defaultDevServerOptions), filteredDevServerOptions[0]);
247
+ }
248
+ else {
249
+ devServerOptions = Object.assign(Object.assign({}, defaultDevServerOptions), webpackConfiguration.devServer);
250
+ }
251
+ // Add the certificate and key to the devServerOptions if these fields don't already have values
252
+ if (!devServerOptions.server) {
253
+ const certificateManager = new debug_certificate_manager_1.CertificateManager();
254
+ const certificate = await certificateManager.ensureCertificateAsync(true, taskSession.logger.terminal);
255
+ devServerOptions = Object.assign(Object.assign({}, devServerOptions), { server: {
256
+ type: 'https',
257
+ options: {
258
+ key: certificate.pemKey,
259
+ cert: certificate.pemCertificate
260
+ }
261
+ } });
262
+ }
263
+ // Since the webpack-dev-server does not return infrastructure errors via a callback like
264
+ // compiler.watch(...), we will need to intercept them and log them ourselves.
265
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
266
+ compiler.hooks.infrastructureLog.tap(exports.PLUGIN_NAME, (name, type, args) => {
267
+ if (name === WEBPACK_DEV_MIDDLEWARE_PACKAGE_NAME && type === 'error') {
268
+ const error = args[0];
269
+ if (error) {
270
+ taskSession.logger.emitError(error);
271
+ }
272
+ }
273
+ return true;
274
+ });
275
+ // The webpack-dev-server package has a design flaw, where merely loading its package will set the
276
+ // WEBPACK_DEV_SERVER environment variable -- even if no APIs are accessed. This environment variable
277
+ // causes incorrect behavior if Heft is not running in serve mode. Thus, we need to be careful to call
278
+ // require() only if Heft is in serve mode.
279
+ taskSession.logger.terminal.writeLine('Starting webpack-dev-server');
280
+ const WebpackDevServer = (await Promise.resolve().then(() => __importStar(require(WEBPACK_DEV_SERVER_PACKAGE_NAME))))
281
+ .default;
282
+ const webpackDevServer = new WebpackDevServer(devServerOptions, compiler);
283
+ await webpackDevServer.start();
284
+ }
285
+ else {
286
+ // Create the watcher. Compilation will start immediately after invoking watch().
287
+ taskSession.logger.terminal.writeLine('Starting Webpack watcher');
288
+ compiler.watch({}, (error) => {
289
+ if (error) {
290
+ taskSession.logger.emitError(error);
291
+ }
292
+ });
293
+ }
294
+ // Store the watchers to be used for suspend/resume
295
+ this._webpackWatchers = ((_a = compiler.compilers) !== null && _a !== void 0 ? _a : [compiler]).map((compiler) => compiler.watching);
296
+ }
297
+ // Resume the compilation, wait for the compilation to complete, then suspend the watchers until the
298
+ // next iteration. Even if there are no changes, the promise should resolve since resuming from a
299
+ // suspended state invalidates the state of the watcher.
300
+ taskSession.logger.terminal.writeLine('Running incremental Webpack compilation');
301
+ for (const watcher of this._webpackWatchers) {
302
+ watcher.resume();
303
+ }
304
+ await webpackCompilationDonePromise;
305
+ for (const watcher of this._webpackWatchers) {
306
+ watcher.suspend();
307
+ }
308
+ }
309
+ _validateEnvironmentVariable(taskSession) {
310
+ if (!this._serve && process.env[WEBPACK_DEV_SERVER_ENV_VAR_NAME]) {
311
+ taskSession.logger.emitWarning(new Error(`The "${WEBPACK_DEV_SERVER_ENV_VAR_NAME}" environment variable is set, ` +
312
+ 'which will cause problems when webpack is not running in serve mode. ' +
313
+ `(Did a dependency inadvertently load the "${WEBPACK_DEV_SERVER_PACKAGE_NAME}" package?)`));
314
+ }
315
+ }
316
+ _emitErrors(logger, stats) {
317
+ if (stats.hasErrors() || stats.hasWarnings()) {
318
+ const serializedStats = stats.toJson('errors-warnings');
319
+ for (const warning of serializedStats.warnings) {
320
+ logger.emitWarning(warning instanceof Error ? warning : new Error(warning));
321
+ }
322
+ for (const error of serializedStats.errors) {
323
+ logger.emitError(error instanceof Error ? error : new Error(error));
324
+ }
325
+ }
326
+ }
327
+ }
328
+ exports.default = Webpack4Plugin;
329
+ //# sourceMappingURL=Webpack4Plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Webpack4Plugin.js","sourceRoot":"","sources":["../src/Webpack4Plugin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAK3D,qCAAqG;AACrG,oFAA6F;AAC7F,oEAA6E;AAgB7E,6EAA0E;AAkC1E;;GAEG;AACU,QAAA,WAAW,GAAqB,gBAAgB,CAAC;AAC9D,MAAM,yBAAyB,GAAc,SAAS,CAAC;AACvD,MAAM,oBAAoB,GAAc,SAAS,CAAC;AAClD,MAAM,+BAA+B,GAAyB,oBAAoB,CAAC;AACnF,MAAM,+BAA+B,GAAyB,oBAAoB,CAAC;AACnF,MAAM,mCAAmC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AC,MAAM,CAAC,iBAAiB,CAAC,CAAC;YAErF,KAAK,MAAM,OAAO,IAAI,eAAe,CAAC,QAA8B,EAAE;gBACpE,MAAM,CAAC,WAAW,CAAC,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;aAC7E;YAED,KAAK,MAAM,KAAK,IAAI,eAAe,CAAC,MAA4B,EAAE;gBAChE,MAAM,CAAC,SAAS,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;aACrE;SACF;IACH,CAAC;CACF;AAjYD,iCAiYC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { AddressInfo } from 'net';\nimport type * as TWebpack from 'webpack';\nimport type TWebpackDevServer from 'webpack-dev-server';\nimport { AsyncParallelHook, AsyncSeriesBailHook, AsyncSeriesHook, type SyncBailHook } from 'tapable';\nimport { CertificateManager, type ICertificate } from '@rushstack/debug-certificate-manager';\nimport { InternalError, LegacyAdapters } from '@rushstack/node-core-library';\nimport type {\n HeftConfiguration,\n IHeftTaskSession,\n IHeftTaskCleanHookOptions,\n IHeftTaskPlugin,\n IHeftTaskRunHookOptions,\n IScopedLogger,\n IHeftTaskRunIncrementalHookOptions\n} from '@rushstack/heft';\n\nimport type {\n IWebpackConfiguration,\n IWebpackConfigurationWithDevServer,\n IWebpackPluginAccessor\n} from './shared';\nimport { WebpackConfigurationLoader } from './WebpackConfigurationLoader';\n\ntype ExtendedWatching = TWebpack.Watching & {\n resume: () => void;\n suspend: () => void;\n};\n\ntype ExtendedMultiWatching = TWebpack.MultiWatching & {\n resume: () => void;\n suspend: () => void;\n};\n\ntype ExtendedCompiler = TWebpack.Compiler & {\n hooks: TWebpack.Compiler['hooks'] & {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n infrastructureLog: SyncBailHook<string, string, any[]>;\n };\n watching: ExtendedWatching;\n};\n\ntype ExtendedMultiCompiler = TWebpack.MultiCompiler & {\n compilers: ExtendedCompiler[];\n hooks: TWebpack.MultiCompiler['hooks'] & {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n infrastructureLog: SyncBailHook<string, string, any[]>;\n };\n watching: ExtendedMultiWatching;\n};\n\nexport interface IWebpackPluginOptions {\n devConfigurationPath: string | undefined;\n configurationPath: string | undefined;\n}\n\n/**\n * @public\n */\nexport const PLUGIN_NAME: 'Webpack4Plugin' = 'Webpack4Plugin';\nconst SERVE_PARAMETER_LONG_NAME: '--serve' = '--serve';\nconst WEBPACK_PACKAGE_NAME: 'webpack' = 'webpack';\nconst WEBPACK_DEV_SERVER_PACKAGE_NAME: 'webpack-dev-server' = 'webpack-dev-server';\nconst WEBPACK_DEV_SERVER_ENV_VAR_NAME: 'WEBPACK_DEV_SERVER' = 'WEBPACK_DEV_SERVER';\nconst WEBPACK_DEV_MIDDLEWARE_PACKAGE_NAME: 'webpack-dev-middleware' = 'webpack-dev-middleware';\nconst UNINITIALIZED: 'UNINITIALIZED' = 'UNINITIALIZED';\n\n/**\n * @internal\n */\nexport default class Webpack4Plugin implements IHeftTaskPlugin<IWebpackPluginOptions> {\n private _serve: boolean = false;\n private _webpack: typeof TWebpack | undefined;\n private _webpackCompiler: ExtendedCompiler | ExtendedMultiCompiler | undefined;\n private _webpackConfiguration: IWebpackConfiguration | undefined | typeof UNINITIALIZED = UNINITIALIZED;\n private _webpackWatchers: ExtendedWatching[] | undefined;\n private _webpackCompilationDonePromise: Promise<void> | undefined;\n private _webpackCompilationDonePromiseResolveFn: (() => void) | undefined;\n\n public readonly accessor: IWebpackPluginAccessor = {\n hooks: {\n onLoadConfiguration: new AsyncSeriesBailHook(),\n onConfigure: new AsyncSeriesHook(['webpackConfiguration']),\n onAfterConfigure: new AsyncParallelHook(['webpackConfiguration']),\n onEmitStats: new AsyncParallelHook(['webpackStats'])\n }\n };\n\n public apply(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration,\n options: IWebpackPluginOptions\n ): void {\n this._serve = taskSession.parameters.getFlagParameter(SERVE_PARAMETER_LONG_NAME).value;\n if (!taskSession.parameters.watch && this._serve) {\n throw new Error(\n `The ${JSON.stringify(\n SERVE_PARAMETER_LONG_NAME\n )} parameter is only available when running in watch mode.`\n );\n }\n\n taskSession.hooks.clean.tapPromise(PLUGIN_NAME, async (cleanOptions: IHeftTaskCleanHookOptions) => {\n // Obtain the finalized webpack configuration\n const webpackConfiguration: IWebpackConfiguration | undefined =\n await this._getWebpackConfigurationAsync(taskSession, heftConfiguration, options);\n if (webpackConfiguration) {\n const webpackConfigurationArray: IWebpackConfigurationWithDevServer[] = Array.isArray(\n webpackConfiguration\n )\n ? webpackConfiguration\n : [webpackConfiguration];\n\n // Add each output path to the clean list\n // NOTE: Webpack plugins that write assets to paths that start with '../' or outside of the\n // `output.path` will need to be manually added to the phase-level cleanup list in heft.json.\n for (const config of webpackConfigurationArray) {\n if (config.output?.path) {\n cleanOptions.addDeleteOperations({ sourcePath: config.output.path });\n }\n }\n }\n });\n\n taskSession.hooks.run.tapPromise(PLUGIN_NAME, async (runOptions: IHeftTaskRunHookOptions) => {\n await this._runWebpackAsync(taskSession, heftConfiguration, options);\n });\n\n taskSession.hooks.runIncremental.tapPromise(\n PLUGIN_NAME,\n async (runOptions: IHeftTaskRunIncrementalHookOptions) => {\n await this._runWebpackWatchAsync(taskSession, heftConfiguration, options);\n }\n );\n }\n\n private async _getWebpackConfigurationAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration,\n options: IWebpackPluginOptions\n ): Promise<IWebpackConfiguration | undefined> {\n if (this._webpackConfiguration === UNINITIALIZED) {\n // Obtain the webpack configuration by calling into the hook. If undefined\n // is returned, load the default Webpack configuration.\n taskSession.logger.terminal.writeVerboseLine(\n 'Attempting to load Webpack configuration via external plugins'\n );\n let webpackConfiguration: IWebpackConfiguration | false | undefined =\n await this.accessor.hooks.onLoadConfiguration.promise();\n if (webpackConfiguration === undefined) {\n taskSession.logger.terminal.writeVerboseLine('Attempt to load the default Webpack configuration');\n const configurationLoader: WebpackConfigurationLoader = new WebpackConfigurationLoader(\n taskSession.logger,\n taskSession.parameters.production,\n taskSession.parameters.watch && this._serve\n );\n webpackConfiguration = await configurationLoader.tryLoadWebpackConfigurationAsync({\n ...options,\n taskSession,\n heftConfiguration,\n loadWebpackAsyncFn: this._loadWebpackAsync.bind(this)\n });\n }\n\n if (webpackConfiguration === false) {\n taskSession.logger.terminal.writeLine('Webpack disabled by external plugin');\n this._webpackConfiguration = undefined;\n } else if (\n webpackConfiguration === undefined ||\n (Array.isArray(webpackConfiguration) && webpackConfiguration.length === 0)\n ) {\n taskSession.logger.terminal.writeLine('No Webpack configuration found');\n this._webpackConfiguration = undefined;\n } else {\n if (this.accessor.hooks.onConfigure.isUsed()) {\n // Allow for plugins to customise the configuration\n await this.accessor.hooks.onConfigure.promise(webpackConfiguration);\n }\n if (this.accessor.hooks.onAfterConfigure.isUsed()) {\n // Provide the finalized configuration\n await this.accessor.hooks.onAfterConfigure.promise(webpackConfiguration);\n }\n this._webpackConfiguration = webpackConfiguration;\n }\n }\n return this._webpackConfiguration;\n }\n\n private async _loadWebpackAsync(): Promise<typeof TWebpack> {\n if (!this._webpack) {\n // Allow this to fail if webpack is not installed\n this._webpack = await import(WEBPACK_PACKAGE_NAME);\n }\n return this._webpack!;\n }\n\n private async _getWebpackCompilerAsync(\n taskSession: IHeftTaskSession,\n webpackConfiguration: IWebpackConfiguration\n ): Promise<ExtendedCompiler | ExtendedMultiCompiler> {\n if (!this._webpackCompiler) {\n const webpack: typeof TWebpack = await this._loadWebpackAsync();\n taskSession.logger.terminal.writeLine(`Using Webpack version ${webpack.version}`);\n this._webpackCompiler = Array.isArray(webpackConfiguration)\n ? (webpack.default(\n webpackConfiguration\n ) as ExtendedMultiCompiler) /* (webpack.Compilation[]) => MultiCompiler */\n : (webpack.default(webpackConfiguration) as ExtendedCompiler); /* (webpack.Compilation) => Compiler */\n }\n return this._webpackCompiler;\n }\n\n private async _runWebpackAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration,\n options: IWebpackPluginOptions\n ): Promise<void> {\n this._validateEnvironmentVariable(taskSession);\n if (taskSession.parameters.watch || this._serve) {\n // Should never happen, but just in case\n throw new InternalError('Cannot run Webpack in compilation mode when watch mode is enabled');\n }\n\n // Load the config and compiler, and return if there is no config found\n const webpackConfiguration: IWebpackConfiguration | undefined = await this._getWebpackConfigurationAsync(\n taskSession,\n heftConfiguration,\n options\n );\n if (!webpackConfiguration) {\n return;\n }\n const compiler: ExtendedCompiler | ExtendedMultiCompiler = await this._getWebpackCompilerAsync(\n taskSession,\n webpackConfiguration\n );\n taskSession.logger.terminal.writeLine('Running Webpack compilation');\n\n // Run the webpack compiler\n let stats: TWebpack.Stats | TWebpack.MultiStats | undefined;\n try {\n stats = await LegacyAdapters.convertCallbackToPromise(\n (compiler as TWebpack.Compiler).run.bind(compiler)\n );\n } catch (e) {\n taskSession.logger.emitError(e as Error);\n }\n\n // Emit the errors from the stats object, if present\n if (stats) {\n this._emitErrors(taskSession.logger, stats);\n if (this.accessor.hooks.onEmitStats.isUsed()) {\n await this.accessor.hooks.onEmitStats.promise(stats);\n }\n }\n }\n\n private async _runWebpackWatchAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration,\n options: IWebpackPluginOptions\n ): Promise<void> {\n // Save a handle to the original promise, since the this-scoped promise will be replaced whenever\n // the compilation completes.\n let webpackCompilationDonePromise: Promise<void> | undefined = this._webpackCompilationDonePromise;\n\n if (!this._webpackWatchers) {\n this._validateEnvironmentVariable(taskSession);\n if (!taskSession.parameters.watch) {\n // Should never happen, but just in case\n throw new InternalError('Cannot run Webpack in watch mode when compilation mode is enabled');\n }\n\n // Load the config and compiler, and return if there is no config found\n const webpackConfiguration: IWebpackConfiguration | undefined =\n await this._getWebpackConfigurationAsync(taskSession, heftConfiguration, options);\n if (!webpackConfiguration) {\n return;\n }\n\n // Get the compiler which will be used for both serve and watch mode\n const compiler: ExtendedCompiler | ExtendedMultiCompiler = await this._getWebpackCompilerAsync(\n taskSession,\n webpackConfiguration\n );\n\n // Set up the hook to detect when the watcher completes the watcher compilation. We will also log out\n // errors from the compilation if present from the output stats object.\n this._webpackCompilationDonePromise = new Promise((resolve: () => void) => {\n this._webpackCompilationDonePromiseResolveFn = resolve;\n });\n webpackCompilationDonePromise = this._webpackCompilationDonePromise;\n compiler.hooks.done.tap(PLUGIN_NAME, (stats?: TWebpack.Stats | TWebpack.MultiStats) => {\n this._webpackCompilationDonePromiseResolveFn!();\n this._webpackCompilationDonePromise = new Promise((resolve: () => void) => {\n this._webpackCompilationDonePromiseResolveFn = resolve;\n });\n if (stats) {\n this._emitErrors(taskSession.logger, stats);\n }\n });\n\n // TWebpack.Compiler and TWebpack.MultiCompiler in Webpack 4 do not allow you to access the running\n // watcher, so we need to patch the method to set the watcher on the parent object.\n const originalWatch: TWebpack.Compiler['watch'] | TWebpack.MultiCompiler['watch'] =\n compiler.watch.bind(compiler);\n compiler.watch = (\n watchOptions: TWebpack.ICompiler.WatchOptions,\n handler: TWebpack.ICompiler.Handler & TWebpack.ICompiler.MultiHandler\n ) => {\n const watcher: ExtendedWatching | ExtendedMultiWatching = originalWatch(watchOptions, handler) as\n | ExtendedWatching\n | ExtendedMultiWatching;\n compiler.watching = watcher;\n return watcher;\n };\n\n // Determine how we will run the compiler. When serving, we will run the compiler\n // via the webpack-dev-server. Otherwise, we will run the compiler directly.\n if (this._serve) {\n const defaultDevServerOptions: TWebpackDevServer.Configuration = {\n host: 'localhost',\n devMiddleware: {\n publicPath: '/',\n stats: {\n cached: false,\n cachedAssets: false,\n colors: heftConfiguration.terminalProvider.supportsColor\n }\n },\n client: {\n logging: 'info'\n },\n port: 8080,\n onListening: (server: TWebpackDevServer) => {\n const addressInfo: AddressInfo | string | undefined = server.server?.address() as AddressInfo;\n if (addressInfo) {\n const address: string =\n typeof addressInfo === 'string' ? addressInfo : `${addressInfo.address}:${addressInfo.port}`;\n taskSession.logger.terminal.writeLine(`Started Webpack Dev Server at https://${address}`);\n }\n }\n };\n\n // Obtain the devServerOptions from the webpack configuration, and combine with the default options\n let devServerOptions: TWebpackDevServer.Configuration;\n if (Array.isArray(webpackConfiguration)) {\n const filteredDevServerOptions: TWebpackDevServer.Configuration[] = webpackConfiguration\n .map((configuration) => configuration.devServer)\n .filter((devServer): devServer is TWebpackDevServer.Configuration => !!devServer);\n if (filteredDevServerOptions.length > 1) {\n taskSession.logger.emitWarning(\n new Error(`Detected multiple webpack devServer configurations, using the first one.`)\n );\n }\n devServerOptions = { ...defaultDevServerOptions, ...filteredDevServerOptions[0] };\n } else {\n devServerOptions = { ...defaultDevServerOptions, ...webpackConfiguration.devServer };\n }\n\n // Add the certificate and key to the devServerOptions if these fields don't already have values\n if (!devServerOptions.server) {\n const certificateManager: CertificateManager = new CertificateManager();\n const certificate: ICertificate = await certificateManager.ensureCertificateAsync(\n true,\n taskSession.logger.terminal\n );\n devServerOptions = {\n ...devServerOptions,\n server: {\n type: 'https',\n options: {\n key: certificate.pemKey,\n cert: certificate.pemCertificate\n }\n }\n };\n }\n\n // Since the webpack-dev-server does not return infrastructure errors via a callback like\n // compiler.watch(...), we will need to intercept them and log them ourselves.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n compiler.hooks.infrastructureLog.tap(PLUGIN_NAME, (name: string, type: string, args: any[]) => {\n if (name === WEBPACK_DEV_MIDDLEWARE_PACKAGE_NAME && type === 'error') {\n const error: Error | undefined = args[0];\n if (error) {\n taskSession.logger.emitError(error);\n }\n }\n return true;\n });\n\n // The webpack-dev-server package has a design flaw, where merely loading its package will set the\n // WEBPACK_DEV_SERVER environment variable -- even if no APIs are accessed. This environment variable\n // causes incorrect behavior if Heft is not running in serve mode. Thus, we need to be careful to call\n // require() only if Heft is in serve mode.\n taskSession.logger.terminal.writeLine('Starting webpack-dev-server');\n const WebpackDevServer: typeof TWebpackDevServer = (await import(WEBPACK_DEV_SERVER_PACKAGE_NAME))\n .default;\n const webpackDevServer: TWebpackDevServer = new WebpackDevServer(devServerOptions, compiler);\n await webpackDevServer.start();\n } else {\n // Create the watcher. Compilation will start immediately after invoking watch().\n taskSession.logger.terminal.writeLine('Starting Webpack watcher');\n compiler.watch({}, (error?: Error | null) => {\n if (error) {\n taskSession.logger.emitError(error);\n }\n });\n }\n\n // Store the watchers to be used for suspend/resume\n this._webpackWatchers = (\n (compiler as ExtendedMultiCompiler).compilers ?? [compiler as ExtendedCompiler]\n ).map((compiler: ExtendedCompiler) => compiler.watching);\n }\n\n // Resume the compilation, wait for the compilation to complete, then suspend the watchers until the\n // next iteration. Even if there are no changes, the promise should resolve since resuming from a\n // suspended state invalidates the state of the watcher.\n taskSession.logger.terminal.writeLine('Running incremental Webpack compilation');\n for (const watcher of this._webpackWatchers) {\n watcher.resume();\n }\n await webpackCompilationDonePromise;\n for (const watcher of this._webpackWatchers) {\n watcher.suspend();\n }\n }\n\n private _validateEnvironmentVariable(taskSession: IHeftTaskSession): void {\n if (!this._serve && process.env[WEBPACK_DEV_SERVER_ENV_VAR_NAME]) {\n taskSession.logger.emitWarning(\n new Error(\n `The \"${WEBPACK_DEV_SERVER_ENV_VAR_NAME}\" environment variable is set, ` +\n 'which will cause problems when webpack is not running in serve mode. ' +\n `(Did a dependency inadvertently load the \"${WEBPACK_DEV_SERVER_PACKAGE_NAME}\" package?)`\n )\n );\n }\n }\n\n private _emitErrors(logger: IScopedLogger, stats: TWebpack.Stats | TWebpack.compilation.MultiStats): void {\n if (stats.hasErrors() || stats.hasWarnings()) {\n const serializedStats: TWebpack.Stats.ToJsonOutput = stats.toJson('errors-warnings');\n\n for (const warning of serializedStats.warnings as (string | Error)[]) {\n logger.emitWarning(warning instanceof Error ? warning : new Error(warning));\n }\n\n for (const error of serializedStats.errors as (string | Error)[]) {\n logger.emitError(error instanceof Error ? error : new Error(error));\n }\n }\n }\n}\n"]}
@@ -1,7 +1,19 @@
1
- import type { IBuildStageProperties, ScopedLogger } from '@rushstack/heft';
2
- import { IWebpackConfiguration } from './shared';
1
+ import type * as TWebpack from 'webpack';
2
+ import type { IScopedLogger, IHeftTaskSession, HeftConfiguration } from '@rushstack/heft';
3
+ import type { IWebpackPluginOptions } from './Webpack4Plugin';
4
+ import type { IWebpackConfiguration } from './shared';
5
+ interface ILoadWebpackConfigurationOptions extends IWebpackPluginOptions {
6
+ taskSession: IHeftTaskSession;
7
+ heftConfiguration: HeftConfiguration;
8
+ loadWebpackAsyncFn: () => Promise<typeof TWebpack>;
9
+ }
3
10
  export declare class WebpackConfigurationLoader {
4
- static tryLoadWebpackConfigAsync(logger: ScopedLogger, buildFolder: string, buildProperties: IBuildStageProperties): Promise<IWebpackConfiguration | undefined>;
5
- private static _tryLoadWebpackConfiguration;
11
+ private readonly _logger;
12
+ private readonly _production;
13
+ private readonly _serveMode;
14
+ constructor(logger: IScopedLogger, production: boolean, serveMode: boolean);
15
+ tryLoadWebpackConfigurationAsync(options: ILoadWebpackConfigurationOptions): Promise<IWebpackConfiguration | undefined>;
16
+ private _tryLoadWebpackConfigurationInnerAsync;
6
17
  }
18
+ export {};
7
19
  //# sourceMappingURL=WebpackConfigurationLoader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebpackConfigurationLoader.d.ts","sourceRoot":"","sources":["../src/WebpackConfigurationLoader.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAqBjD,qBAAa,0BAA0B;WACjB,yBAAyB,CAC3C,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,qBAAqB,GACrC,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IA4C7C,OAAO,CAAC,MAAM,CAAC,4BAA4B;CAe5C"}
1
+ {"version":3,"file":"WebpackConfigurationLoader.d.ts","sourceRoot":"","sources":["../src/WebpackConfigurationLoader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,QAAQ,MAAM,SAAS,CAAC;AAEzC,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAsC,MAAM,UAAU,CAAC;AAW1F,UAAU,gCAAiC,SAAQ,qBAAqB;IACtE,WAAW,EAAE,gBAAgB,CAAC;IAC9B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,kBAAkB,EAAE,MAAM,OAAO,CAAC,OAAO,QAAQ,CAAC,CAAC;CACpD;AAKD,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAU;IACtC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAU;gBAElB,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO;IAMpE,gCAAgC,CAC3C,OAAO,EAAE,gCAAgC,GACxC,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;YAwD/B,sCAAsC;CAmBrD"}