@rushstack/heft-webpack4-plugin 0.6.0-rc.4 → 0.6.0-rc.6

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.
@@ -131,7 +131,7 @@ class Webpack4Plugin {
131
131
  async _loadWebpackAsync() {
132
132
  if (!this._webpack) {
133
133
  // Allow this to fail if webpack is not installed
134
- this._webpack = await Promise.resolve().then(() => __importStar(require(WEBPACK_PACKAGE_NAME)));
134
+ this._webpack = await Promise.resolve(`${WEBPACK_PACKAGE_NAME}`).then(s => __importStar(require(s)));
135
135
  }
136
136
  return this._webpack;
137
137
  }
@@ -293,7 +293,7 @@ class Webpack4Plugin {
293
293
  // causes incorrect behavior if Heft is not running in serve mode. Thus, we need to be careful to call
294
294
  // require() only if Heft is in serve mode.
295
295
  taskSession.logger.terminal.writeLine('Starting webpack-dev-server');
296
- const WebpackDevServer = (await Promise.resolve().then(() => __importStar(require(WEBPACK_DEV_SERVER_PACKAGE_NAME))))
296
+ const WebpackDevServer = (await Promise.resolve(`${WEBPACK_DEV_SERVER_PACKAGE_NAME}`).then(s => __importStar(require(s))))
297
297
  .default;
298
298
  const webpackDevServer = new WebpackDevServer(devServerOptions, compiler);
299
299
  await webpackDevServer.start();
@@ -1 +1 @@
1
- {"version":3,"file":"Webpack4Plugin.js","sourceRoot":"","sources":["../src/Webpack4Plugin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAK3D,qCAAqG;AACrG,oFAA6F;AAC7F,oEAA6E;AAW7E,6EAA0E;AAC1E,uEAImC;AAmCnC;;GAEG;AACU,QAAA,WAAW,GAAsB,iBAAiB,CAAC;AAChE,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,M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,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;iBACtE;gBAED,IAAI,gBAAgB,CAAC,QAAQ,EAAE;oBAC7B,KAAK,MAAM,KAAK,IAAI,gBAAgB,CAAC,QAAQ,EAAE;wBAC7C,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;qBAC7B;iBACF;aACF;SACF;IACH,CAAC;CACF;AAxaD,iCAwaC","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 IHeftTaskPlugin,\n IHeftTaskRunHookOptions,\n IScopedLogger,\n IHeftTaskRunIncrementalHookOptions\n} from '@rushstack/heft';\n\nimport type { IWebpackConfiguration, IWebpackPluginAccessor } from './shared';\nimport { WebpackConfigurationLoader } from './WebpackConfigurationLoader';\nimport {\n DeferredWatchFileSystem,\n type IWatchFileSystem,\n OverrideNodeWatchFSPlugin\n} from './DeferredWatchFileSystem';\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 watchFileSystem: IWatchFileSystem;\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: 'webpack4-plugin' = 'webpack4-plugin';\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 _accessor: IWebpackPluginAccessor | undefined;\n private _isServeMode: boolean = false;\n private _webpack: typeof TWebpack | undefined;\n private _webpackCompiler: ExtendedCompiler | ExtendedMultiCompiler | undefined;\n private _webpackConfiguration: IWebpackConfiguration | undefined | typeof UNINITIALIZED = UNINITIALIZED;\n private _webpackCompilationDonePromise: Promise<void> | undefined;\n private _webpackCompilationDonePromiseResolveFn: (() => void) | undefined;\n private _watchFileSystems: Set<DeferredWatchFileSystem> | undefined;\n\n private _warnings: Error[] = [];\n private _errors: Error[] = [];\n\n public get accessor(): IWebpackPluginAccessor {\n if (!this._accessor) {\n this._accessor = {\n hooks: {\n onLoadConfiguration: new AsyncSeriesBailHook(),\n onConfigure: new AsyncSeriesHook(['webpackConfiguration']),\n onAfterConfigure: new AsyncParallelHook(['webpackConfiguration']),\n onEmitStats: new AsyncParallelHook(['webpackStats'])\n },\n parameters: {\n isServeMode: this._isServeMode\n }\n };\n }\n return this._accessor;\n }\n\n public apply(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration,\n options: IWebpackPluginOptions\n ): void {\n this._isServeMode = taskSession.parameters.getFlagParameter(SERVE_PARAMETER_LONG_NAME).value;\n if (!taskSession.parameters.watch && this._isServeMode) {\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.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, runOptions.requestRun);\n }\n );\n }\n\n private async _getWebpackConfigurationAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration,\n options: IWebpackPluginOptions,\n requestRun?: () => void\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._isServeMode\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 if (requestRun) {\n const overrideWatchFSPlugin: OverrideNodeWatchFSPlugin = new OverrideNodeWatchFSPlugin(requestRun);\n this._watchFileSystems = overrideWatchFSPlugin.fileSystems;\n for (const config of Array.isArray(webpackConfiguration)\n ? webpackConfiguration\n : [webpackConfiguration]) {\n if (!config.plugins) {\n config.plugins = [overrideWatchFSPlugin];\n } else {\n config.plugins.unshift(overrideWatchFSPlugin);\n }\n }\n }\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._isServeMode) {\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._recordErrors(stats);\n if (this.accessor.hooks.onEmitStats.isUsed()) {\n await this.accessor.hooks.onEmitStats.promise(stats);\n }\n this._emitErrors(taskSession.logger);\n }\n }\n\n private async _runWebpackWatchAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration,\n options: IWebpackPluginOptions,\n requestRun: () => void\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 let isInitial: boolean = false;\n\n if (!this._webpackCompiler) {\n isInitial = true;\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, requestRun);\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._recordErrors(stats);\n }\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._isServeMode) {\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 webSocketURL: {\n port: 8080\n }\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\n // Update the web socket URL to use the hostname provided by the certificate\n const clientConfiguration: TWebpackDevServer.Configuration['client'] = devServerOptions.client;\n const hostname: string | undefined = certificate.subjectAltNames?.[0];\n if (hostname && typeof clientConfiguration === 'object') {\n const { webSocketURL } = clientConfiguration;\n if (typeof webSocketURL === 'object') {\n clientConfiguration.webSocketURL = {\n ...webSocketURL,\n hostname\n };\n }\n }\n\n devServerOptions = {\n ...devServerOptions,\n server: {\n type: 'https',\n options: {\n minVersion: 'TLSv1.3',\n key: certificate.pemKey,\n cert: certificate.pemCertificate,\n ca: certificate.pemCaCertificate\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\n let hasChanges: boolean = true;\n if (!isInitial && this._watchFileSystems) {\n hasChanges = false;\n for (const watchFileSystem of this._watchFileSystems) {\n hasChanges = watchFileSystem.flush() || hasChanges;\n }\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 if (hasChanges) {\n taskSession.logger.terminal.writeLine('Running incremental Webpack compilation');\n await webpackCompilationDonePromise;\n } else {\n taskSession.logger.terminal.writeLine(\n 'Webpack has not detected changes. Listing previous diagnostics.'\n );\n }\n\n this._emitErrors(taskSession.logger);\n }\n\n private _validateEnvironmentVariable(taskSession: IHeftTaskSession): void {\n if (!this._isServeMode && 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): void {\n for (const warning of this._warnings) {\n logger.emitWarning(warning);\n }\n for (const error of this._errors) {\n logger.emitError(error);\n }\n }\n\n private _recordErrors(stats: TWebpack.Stats | TWebpack.compilation.MultiStats): void {\n this._errors.length = 0;\n this._warnings.length = 0;\n\n if (stats.hasErrors() || stats.hasWarnings()) {\n const serializedStats: TWebpack.Stats.ToJsonOutput[] = [stats.toJson('errors-warnings')];\n\n for (const compilationStats of serializedStats) {\n for (const warning of compilationStats.warnings as (string | Error)[]) {\n this._warnings.push(warning instanceof Error ? warning : new Error(warning));\n }\n\n for (const error of compilationStats.errors as (string | Error)[]) {\n this._errors.push(error instanceof Error ? error : new Error(error));\n }\n\n if (compilationStats.children) {\n for (const child of compilationStats.children) {\n serializedStats.push(child);\n }\n }\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"Webpack4Plugin.js","sourceRoot":"","sources":["../src/Webpack4Plugin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAK3D,qCAAqG;AACrG,oFAA6F;AAC7F,oEAA6E;AAW7E,6EAA0E;AAC1E,uEAImC;AAmCnC;;GAEG;AACU,QAAA,WAAW,GAAsB,iBAAiB,CAAC;AAChE,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,GAA6B,wBAAwB,CAAC;AAC/F,MAAM,aAAa,GAAoB,eAAe,CAAC;AAEvD;;GAEG;AACH,MAAqB,cAAc;IAAnC;QAEU,iBAAY,GAAY,KAAK,CAAC;QAG9B,0BAAqB,GAA6D,aAAa,CAAC;QAKhG,cAAS,GAAY,EAAE,CAAC;QACxB,YAAO,GAAY,EAAE,CAAC;IA6ZhC,CAAC;IA3ZC,IAAW,QAAQ;QACjB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG;gBACf,KAAK,EAAE;oBACL,mBAAmB,EAAE,IAAI,6BAAmB,EAAE;oBAC9C,WAAW,EAAE,IAAI,yBAAe,CAAC,CAAC,sBAAsB,CAAC,CAAC;oBAC1D,gBAAgB,EAAE,IAAI,2BAAiB,CAAC,CAAC,sBAAsB,CAAC,CAAC;oBACjE,WAAW,EAAE,IAAI,2BAAiB,CAAC,CAAC,cAAc,CAAC,CAAC;iBACrD;gBACD,UAAU,EAAE;oBACV,WAAW,EAAE,IAAI,CAAC,Y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IAAI,KAAK,CAAC,SAAS,EAAE,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE;YAC5C,MAAM,eAAe,GAAkC,CAAC,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC;YAEzF,KAAK,MAAM,gBAAgB,IAAI,eAAe,EAAE;gBAC9C,KAAK,MAAM,OAAO,IAAI,gBAAgB,CAAC,QAA8B,EAAE;oBACrE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;iBAC9E;gBAED,KAAK,MAAM,KAAK,IAAI,gBAAgB,CAAC,MAA4B,EAAE;oBACjE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;iBACtE;gBAED,IAAI,gBAAgB,CAAC,QAAQ,EAAE;oBAC7B,KAAK,MAAM,KAAK,IAAI,gBAAgB,CAAC,QAAQ,EAAE;wBAC7C,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;qBAC7B;iBACF;aACF;SACF;IACH,CAAC;CACF;AAxaD,iCAwaC","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 IHeftTaskPlugin,\n IHeftTaskRunHookOptions,\n IScopedLogger,\n IHeftTaskRunIncrementalHookOptions\n} from '@rushstack/heft';\n\nimport type { IWebpackConfiguration, IWebpackPluginAccessor } from './shared';\nimport { WebpackConfigurationLoader } from './WebpackConfigurationLoader';\nimport {\n DeferredWatchFileSystem,\n type IWatchFileSystem,\n OverrideNodeWatchFSPlugin\n} from './DeferredWatchFileSystem';\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 watchFileSystem: IWatchFileSystem;\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: 'webpack4-plugin' = 'webpack4-plugin';\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 _accessor: IWebpackPluginAccessor | undefined;\n private _isServeMode: boolean = false;\n private _webpack: typeof TWebpack | undefined;\n private _webpackCompiler: ExtendedCompiler | ExtendedMultiCompiler | undefined;\n private _webpackConfiguration: IWebpackConfiguration | undefined | typeof UNINITIALIZED = UNINITIALIZED;\n private _webpackCompilationDonePromise: Promise<void> | undefined;\n private _webpackCompilationDonePromiseResolveFn: (() => void) | undefined;\n private _watchFileSystems: Set<DeferredWatchFileSystem> | undefined;\n\n private _warnings: Error[] = [];\n private _errors: Error[] = [];\n\n public get accessor(): IWebpackPluginAccessor {\n if (!this._accessor) {\n this._accessor = {\n hooks: {\n onLoadConfiguration: new AsyncSeriesBailHook(),\n onConfigure: new AsyncSeriesHook(['webpackConfiguration']),\n onAfterConfigure: new AsyncParallelHook(['webpackConfiguration']),\n onEmitStats: new AsyncParallelHook(['webpackStats'])\n },\n parameters: {\n isServeMode: this._isServeMode\n }\n };\n }\n return this._accessor;\n }\n\n public apply(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration,\n options: IWebpackPluginOptions\n ): void {\n this._isServeMode = taskSession.parameters.getFlagParameter(SERVE_PARAMETER_LONG_NAME).value;\n if (!taskSession.parameters.watch && this._isServeMode) {\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.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, runOptions.requestRun);\n }\n );\n }\n\n private async _getWebpackConfigurationAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration,\n options: IWebpackPluginOptions,\n requestRun?: () => void\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._isServeMode\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 if (requestRun) {\n const overrideWatchFSPlugin: OverrideNodeWatchFSPlugin = new OverrideNodeWatchFSPlugin(requestRun);\n this._watchFileSystems = overrideWatchFSPlugin.fileSystems;\n for (const config of Array.isArray(webpackConfiguration)\n ? webpackConfiguration\n : [webpackConfiguration]) {\n if (!config.plugins) {\n config.plugins = [overrideWatchFSPlugin];\n } else {\n config.plugins.unshift(overrideWatchFSPlugin);\n }\n }\n }\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._isServeMode) {\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._recordErrors(stats);\n if (this.accessor.hooks.onEmitStats.isUsed()) {\n await this.accessor.hooks.onEmitStats.promise(stats);\n }\n this._emitErrors(taskSession.logger);\n }\n }\n\n private async _runWebpackWatchAsync(\n taskSession: IHeftTaskSession,\n heftConfiguration: HeftConfiguration,\n options: IWebpackPluginOptions,\n requestRun: () => void\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 let isInitial: boolean = false;\n\n if (!this._webpackCompiler) {\n isInitial = true;\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, requestRun);\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._recordErrors(stats);\n }\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._isServeMode) {\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 webSocketURL: {\n port: 8080\n }\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\n // Update the web socket URL to use the hostname provided by the certificate\n const clientConfiguration: TWebpackDevServer.Configuration['client'] = devServerOptions.client;\n const hostname: string | undefined = certificate.subjectAltNames?.[0];\n if (hostname && typeof clientConfiguration === 'object') {\n const { webSocketURL } = clientConfiguration;\n if (typeof webSocketURL === 'object') {\n clientConfiguration.webSocketURL = {\n ...webSocketURL,\n hostname\n };\n }\n }\n\n devServerOptions = {\n ...devServerOptions,\n server: {\n type: 'https',\n options: {\n minVersion: 'TLSv1.3',\n key: certificate.pemKey,\n cert: certificate.pemCertificate,\n ca: certificate.pemCaCertificate\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\n let hasChanges: boolean = true;\n if (!isInitial && this._watchFileSystems) {\n hasChanges = false;\n for (const watchFileSystem of this._watchFileSystems) {\n hasChanges = watchFileSystem.flush() || hasChanges;\n }\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 if (hasChanges) {\n taskSession.logger.terminal.writeLine('Running incremental Webpack compilation');\n await webpackCompilationDonePromise;\n } else {\n taskSession.logger.terminal.writeLine(\n 'Webpack has not detected changes. Listing previous diagnostics.'\n );\n }\n\n this._emitErrors(taskSession.logger);\n }\n\n private _validateEnvironmentVariable(taskSession: IHeftTaskSession): void {\n if (!this._isServeMode && 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): void {\n for (const warning of this._warnings) {\n logger.emitWarning(warning);\n }\n for (const error of this._errors) {\n logger.emitError(error);\n }\n }\n\n private _recordErrors(stats: TWebpack.Stats | TWebpack.compilation.MultiStats): void {\n this._errors.length = 0;\n this._warnings.length = 0;\n\n if (stats.hasErrors() || stats.hasWarnings()) {\n const serializedStats: TWebpack.Stats.ToJsonOutput[] = [stats.toJson('errors-warnings')];\n\n for (const compilationStats of serializedStats) {\n for (const warning of compilationStats.warnings as (string | Error)[]) {\n this._warnings.push(warning instanceof Error ? warning : new Error(warning));\n }\n\n for (const error of compilationStats.errors as (string | Error)[]) {\n this._errors.push(error instanceof Error ? error : new Error(error));\n }\n\n if (compilationStats.children) {\n for (const child of compilationStats.children) {\n serializedStats.push(child);\n }\n }\n }\n }\n }\n}\n"]}
@@ -81,7 +81,7 @@ class WebpackConfigurationLoader {
81
81
  const configExists = await node_core_library_1.FileSystem.existsAsync(configurationPath);
82
82
  if (configExists) {
83
83
  try {
84
- return await Promise.resolve().then(() => __importStar(require(configurationPath)));
84
+ return await Promise.resolve(`${configurationPath}`).then(s => __importStar(require(s)));
85
85
  }
86
86
  catch (e) {
87
87
  const error = e;
@@ -1 +1 @@
1
- {"version":3,"file":"WebpackConfigurationLoader.js","sourceRoot":"","sources":["../src/WebpackConfigurationLoader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAE7B,oEAA0D;AAqB1D,MAAM,2BAA2B,GAA0B,qBAAqB,CAAC;AACjF,MAAM,+BAA+B,GAA8B,yBAAyB,CAAC;AAE7F,MAAa,0BAA0B;IAKr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AAa,KAAK,UAAU,EAAE;gBACvC,uEAAuE;gBACvE,OAAO,aAAa,CAAC;oBACnB,IAAI,EAAE,IAAI,CAAC,WAAW;oBACtB,UAAU,EAAE,IAAI,CAAC,WAAW;oBAC5B,WAAW;oBACX,iBAAiB;oBACjB,OAAO,EAAE,MAAM,kBAAkB,EAAE;iBACpC,CAAC,CAAC;aACJ;iBAAM;gBACL,OAAO,aAAa,CAAC;aACtB;SACF;aAAM;YACL,OAAO,SAAS,CAAC;SAClB;IACH,CAAC;IAEO,KAAK,CAAC,sCAAsC,CAClD,iBAAyB;QAEzB,MAAM,YAAY,GAAY,MAAM,8BAAU,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;QAC9E,IAAI,YAAY,EAAE;YAChB,IAAI;gBACF,OAAO,wDAAa,iBAAiB,GAAC,CAAC;aACxC;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,KAAK,GAA0B,CAA0B,CAAC;gBAChE,IAAI,KAAK,CAAC,IAAI,KAAK,sBAAsB,EAAE;oBACzC,4CAA4C;oBAC5C,OAAO,SAAS,CAAC;iBAClB;gBACD,MAAM,IAAI,KAAK,CAAC,2CAA2C,iBAAiB,MAAM,CAAC,EAAE,CAAC,CAAC;aACxF;SACF;aAAM;YACL,OAAO,SAAS,CAAC;SAClB;IACH,CAAC;CACF;AAxFD,gEAwFC","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 * as path from 'path';\nimport type * as TWebpack from 'webpack';\nimport { FileSystem } from '@rushstack/node-core-library';\nimport type { IScopedLogger, IHeftTaskSession, HeftConfiguration } from '@rushstack/heft';\n\nimport type { IWebpackPluginOptions } from './Webpack4Plugin';\nimport type { IWebpackConfiguration, IWebpackConfigurationFnEnvironment } from './shared';\n\ntype IWebpackConfigJsExport =\n | TWebpack.Configuration\n | TWebpack.Configuration[]\n | Promise<TWebpack.Configuration>\n | Promise<TWebpack.Configuration[]>\n | ((env: IWebpackConfigurationFnEnvironment) => TWebpack.Configuration | TWebpack.Configuration[])\n | ((env: IWebpackConfigurationFnEnvironment) => Promise<TWebpack.Configuration | TWebpack.Configuration[]>);\ntype IWebpackConfigJs = IWebpackConfigJsExport | { default: IWebpackConfigJsExport };\n\ninterface ILoadWebpackConfigurationOptions extends IWebpackPluginOptions {\n taskSession: IHeftTaskSession;\n heftConfiguration: HeftConfiguration;\n loadWebpackAsyncFn: () => Promise<typeof TWebpack>;\n}\n\nconst DEFAULT_WEBPACK_CONFIG_PATH: './webpack.config.js' = './webpack.config.js';\nconst DEFAULT_WEBPACK_DEV_CONFIG_PATH: './webpack.dev.config.js' = './webpack.dev.config.js';\n\nexport class WebpackConfigurationLoader {\n private readonly _logger: IScopedLogger;\n private readonly _production: boolean;\n private readonly _serveMode: boolean;\n\n public constructor(logger: IScopedLogger, production: boolean, serveMode: boolean) {\n this._logger = logger;\n this._production = production;\n this._serveMode = serveMode;\n }\n\n public async tryLoadWebpackConfigurationAsync(\n options: ILoadWebpackConfigurationOptions\n ): Promise<IWebpackConfiguration | undefined> {\n // TODO: Eventually replace this custom logic with a call to this utility in in webpack-cli:\n // https://github.com/webpack/webpack-cli/blob/next/packages/webpack-cli/lib/groups/ConfigGroup.js\n\n const { taskSession, heftConfiguration, configurationPath, devConfigurationPath, loadWebpackAsyncFn } =\n options;\n let webpackConfigJs: IWebpackConfigJs | undefined;\n\n try {\n const buildFolderPath: string = heftConfiguration.buildFolderPath;\n if (this._serveMode) {\n const devConfigPath: string = path.resolve(\n buildFolderPath,\n devConfigurationPath || DEFAULT_WEBPACK_DEV_CONFIG_PATH\n );\n this._logger.terminal.writeVerboseLine(\n `Attempting to load webpack configuration from \"${devConfigPath}\".`\n );\n webpackConfigJs = await this._tryLoadWebpackConfigurationInnerAsync(devConfigPath);\n }\n\n if (!webpackConfigJs) {\n const configPath: string = path.resolve(\n buildFolderPath,\n configurationPath || DEFAULT_WEBPACK_CONFIG_PATH\n );\n this._logger.terminal.writeVerboseLine(\n `Attempting to load webpack configuration from \"${configPath}\".`\n );\n webpackConfigJs = await this._tryLoadWebpackConfigurationInnerAsync(configPath);\n }\n } catch (error) {\n this._logger.emitError(error as Error);\n }\n\n if (webpackConfigJs) {\n const webpackConfig: IWebpackConfigJsExport =\n (webpackConfigJs as { default: IWebpackConfigJsExport }).default || webpackConfigJs;\n\n if (typeof webpackConfig === 'function') {\n // Defer loading of webpack until we know for sure that we will need it\n return webpackConfig({\n prod: this._production,\n production: this._production,\n taskSession,\n heftConfiguration,\n webpack: await loadWebpackAsyncFn()\n });\n } else {\n return webpackConfig;\n }\n } else {\n return undefined;\n }\n }\n\n private async _tryLoadWebpackConfigurationInnerAsync(\n configurationPath: string\n ): Promise<IWebpackConfigJs | undefined> {\n const configExists: boolean = await FileSystem.existsAsync(configurationPath);\n if (configExists) {\n try {\n return await import(configurationPath);\n } catch (e) {\n const error: NodeJS.ErrnoException = e as NodeJS.ErrnoException;\n if (error.code === 'ERR_MODULE_NOT_FOUND') {\n // No configuration found, return undefined.\n return undefined;\n }\n throw new Error(`Error loading webpack configuration at \"${configurationPath}\": ${e}`);\n }\n } else {\n return undefined;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"WebpackConfigurationLoader.js","sourceRoot":"","sources":["../src/WebpackConfigurationLoader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAE7B,oEAA0D;AAqB1D,MAAM,2BAA2B,GAA0B,qBAAqB,CAAC;AACjF,MAAM,+BAA+B,GAA8B,yBAAyB,CAAC;AAE7F,MAAa,0BAA0B;IAKrC,YAAmB,MAAqB,EAAE,UAAmB,EAAE,SAAkB;QAC/E,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAEM,KAAK,CAAC,g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E;iBACpC,CAAC,CAAC;aACJ;iBAAM;gBACL,OAAO,aAAa,CAAC;aACtB;SACF;aAAM;YACL,OAAO,SAAS,CAAC;SAClB;IACH,CAAC;IAEO,KAAK,CAAC,sCAAsC,CAClD,iBAAyB;QAEzB,MAAM,YAAY,GAAY,MAAM,8BAAU,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;QAC9E,IAAI,YAAY,EAAE;YAChB,IAAI;gBACF,OAAO,yBAAa,iBAAiB,uCAAC,CAAC;aACxC;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,KAAK,GAA0B,CAA0B,CAAC;gBAChE,IAAI,KAAK,CAAC,IAAI,KAAK,sBAAsB,EAAE;oBACzC,4CAA4C;oBAC5C,OAAO,SAAS,CAAC;iBAClB;gBACD,MAAM,IAAI,KAAK,CAAC,2CAA2C,iBAAiB,MAAM,CAAC,EAAE,CAAC,CAAC;aACxF;SACF;aAAM;YACL,OAAO,SAAS,CAAC;SAClB;IACH,CAAC;CACF;AAxFD,gEAwFC","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 * as path from 'path';\nimport type * as TWebpack from 'webpack';\nimport { FileSystem } from '@rushstack/node-core-library';\nimport type { IScopedLogger, IHeftTaskSession, HeftConfiguration } from '@rushstack/heft';\n\nimport type { IWebpackPluginOptions } from './Webpack4Plugin';\nimport type { IWebpackConfiguration, IWebpackConfigurationFnEnvironment } from './shared';\n\ntype IWebpackConfigJsExport =\n | TWebpack.Configuration\n | TWebpack.Configuration[]\n | Promise<TWebpack.Configuration>\n | Promise<TWebpack.Configuration[]>\n | ((env: IWebpackConfigurationFnEnvironment) => TWebpack.Configuration | TWebpack.Configuration[])\n | ((env: IWebpackConfigurationFnEnvironment) => Promise<TWebpack.Configuration | TWebpack.Configuration[]>);\ntype IWebpackConfigJs = IWebpackConfigJsExport | { default: IWebpackConfigJsExport };\n\ninterface ILoadWebpackConfigurationOptions extends IWebpackPluginOptions {\n taskSession: IHeftTaskSession;\n heftConfiguration: HeftConfiguration;\n loadWebpackAsyncFn: () => Promise<typeof TWebpack>;\n}\n\nconst DEFAULT_WEBPACK_CONFIG_PATH: './webpack.config.js' = './webpack.config.js';\nconst DEFAULT_WEBPACK_DEV_CONFIG_PATH: './webpack.dev.config.js' = './webpack.dev.config.js';\n\nexport class WebpackConfigurationLoader {\n private readonly _logger: IScopedLogger;\n private readonly _production: boolean;\n private readonly _serveMode: boolean;\n\n public constructor(logger: IScopedLogger, production: boolean, serveMode: boolean) {\n this._logger = logger;\n this._production = production;\n this._serveMode = serveMode;\n }\n\n public async tryLoadWebpackConfigurationAsync(\n options: ILoadWebpackConfigurationOptions\n ): Promise<IWebpackConfiguration | undefined> {\n // TODO: Eventually replace this custom logic with a call to this utility in in webpack-cli:\n // https://github.com/webpack/webpack-cli/blob/next/packages/webpack-cli/lib/groups/ConfigGroup.js\n\n const { taskSession, heftConfiguration, configurationPath, devConfigurationPath, loadWebpackAsyncFn } =\n options;\n let webpackConfigJs: IWebpackConfigJs | undefined;\n\n try {\n const buildFolderPath: string = heftConfiguration.buildFolderPath;\n if (this._serveMode) {\n const devConfigPath: string = path.resolve(\n buildFolderPath,\n devConfigurationPath || DEFAULT_WEBPACK_DEV_CONFIG_PATH\n );\n this._logger.terminal.writeVerboseLine(\n `Attempting to load webpack configuration from \"${devConfigPath}\".`\n );\n webpackConfigJs = await this._tryLoadWebpackConfigurationInnerAsync(devConfigPath);\n }\n\n if (!webpackConfigJs) {\n const configPath: string = path.resolve(\n buildFolderPath,\n configurationPath || DEFAULT_WEBPACK_CONFIG_PATH\n );\n this._logger.terminal.writeVerboseLine(\n `Attempting to load webpack configuration from \"${configPath}\".`\n );\n webpackConfigJs = await this._tryLoadWebpackConfigurationInnerAsync(configPath);\n }\n } catch (error) {\n this._logger.emitError(error as Error);\n }\n\n if (webpackConfigJs) {\n const webpackConfig: IWebpackConfigJsExport =\n (webpackConfigJs as { default: IWebpackConfigJsExport }).default || webpackConfigJs;\n\n if (typeof webpackConfig === 'function') {\n // Defer loading of webpack until we know for sure that we will need it\n return webpackConfig({\n prod: this._production,\n production: this._production,\n taskSession,\n heftConfiguration,\n webpack: await loadWebpackAsyncFn()\n });\n } else {\n return webpackConfig;\n }\n } else {\n return undefined;\n }\n }\n\n private async _tryLoadWebpackConfigurationInnerAsync(\n configurationPath: string\n ): Promise<IWebpackConfigJs | undefined> {\n const configExists: boolean = await FileSystem.existsAsync(configurationPath);\n if (configExists) {\n try {\n return await import(configurationPath);\n } catch (e) {\n const error: NodeJS.ErrnoException = e as NodeJS.ErrnoException;\n if (error.code === 'ERR_MODULE_NOT_FOUND') {\n // No configuration found, return undefined.\n return undefined;\n }\n throw new Error(`Error loading webpack configuration at \"${configurationPath}\": ${e}`);\n }\n } else {\n return undefined;\n }\n }\n}\n"]}
package/lib/shared.d.ts CHANGED
@@ -50,7 +50,7 @@ export interface IWebpackConfigurationWithDevServer extends TWebpack.Configurati
50
50
  /**
51
51
  * @public
52
52
  */
53
- export declare type IWebpackConfiguration = IWebpackConfigurationWithDevServer | IWebpackConfigurationWithDevServer[];
53
+ export type IWebpackConfiguration = IWebpackConfigurationWithDevServer | IWebpackConfigurationWithDevServer[];
54
54
  /**
55
55
  * @public
56
56
  */
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,QAAQ,MAAM,SAAS,CAAC;AAEzC,OAAO,QAAQ,SAAS,CAAC;IACvB,KAAY,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC;IACzD,KAAY,YAAY,GAAG,OAAO,CAAC;IACnC,KAAY,gBAAgB,GAAG,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC;IAGhE,UAAiB,QAAQ;QACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB;CACF;AACD,OAAO,KAAK,EAAE,aAAa,IAAI,6BAA6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ACH,MAAM,MAAM,qBAAqB,GAAG,kCAAkC,GAAG,kCAAkC,EAAE,CAAC;AAE9G;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;;;;;OASG;IACH,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,qBAAqB,GAAG,KAAK,CAAC,CAAC;IACtG;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC,qBAAqB,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC3E;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,qBAAqB,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAClF;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAC,QAAQ,CAAC,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;CACzG;AAED;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,2BAA2B,CAAC;IAC5C;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,gCAAgC,CAAC;CACvD"}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.33.7"
8
+ "packageVersion": "7.35.0"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/heft-webpack4-plugin",
3
- "version": "0.6.0-rc.4",
3
+ "version": "0.6.0-rc.6",
4
4
  "description": "Heft plugin for Webpack 4",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,26 +17,26 @@
17
17
  }
18
18
  },
19
19
  "peerDependencies": {
20
- "@rushstack/heft": "0.50.0-rc.4",
20
+ "@rushstack/heft": "^0.50.6",
21
21
  "@types/webpack": "^4",
22
22
  "webpack": "~4.44.2"
23
23
  },
24
24
  "dependencies": {
25
- "@rushstack/debug-certificate-manager": "1.2.8",
26
- "@rushstack/node-core-library": "3.53.3",
27
25
  "@types/tapable": "1.0.6",
28
26
  "tapable": "1.1.3",
29
27
  "watchpack": "2.4.0",
30
- "webpack-dev-server": "~4.9.3"
28
+ "webpack-dev-server": "~4.9.3",
29
+ "@rushstack/debug-certificate-manager": "1.2.27",
30
+ "@rushstack/node-core-library": "3.59.1"
31
31
  },
32
32
  "devDependencies": {
33
- "@rushstack/eslint-config": "3.1.1",
34
- "@rushstack/heft-node-rig": "1.12.0-rc.4",
35
- "@rushstack/heft": "0.50.0-rc.4",
36
- "@types/node": "12.20.24",
33
+ "@types/node": "14.18.36",
37
34
  "@types/watchpack": "2.4.0",
38
35
  "@types/webpack": "4.41.32",
39
- "webpack": "~4.44.2"
36
+ "webpack": "~4.44.2",
37
+ "@rushstack/eslint-config": "3.3.0",
38
+ "@rushstack/heft-node-rig": "1.14.0-rc.6",
39
+ "@rushstack/heft": "0.51.0-rc.6"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "heft build --clean",