@rushstack/heft-webpack4-plugin 1.1.14 → 1.2.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/CHANGELOG.json +58 -0
- package/CHANGELOG.md +15 -1
- package/heft-plugin.json +2 -2
- package/{lib → lib-dts}/tsdoc-metadata.json +1 -1
- package/lib-esm/DeferredWatchFileSystem.js +120 -0
- package/lib-esm/DeferredWatchFileSystem.js.map +1 -0
- package/lib-esm/Webpack4Plugin.js +326 -0
- package/lib-esm/Webpack4Plugin.js.map +1 -0
- package/lib-esm/WebpackConfigurationLoader.js +122 -0
- package/lib-esm/WebpackConfigurationLoader.js.map +1 -0
- package/lib-esm/WebpackConfigurationLoader.test.js.map +1 -0
- package/lib-esm/index.js +4 -0
- package/lib-esm/index.js.map +1 -0
- package/lib-esm/schemas/heft-webpack4-plugin.schema.json +25 -0
- package/lib-esm/shared.js +13 -0
- package/lib-esm/shared.js.map +1 -0
- package/package.json +35 -9
- /package/{lib → lib-commonjs}/DeferredWatchFileSystem.js +0 -0
- /package/{lib → lib-commonjs}/DeferredWatchFileSystem.js.map +0 -0
- /package/{lib → lib-commonjs}/Webpack4Plugin.js +0 -0
- /package/{lib → lib-commonjs}/Webpack4Plugin.js.map +0 -0
- /package/{lib → lib-commonjs}/WebpackConfigurationLoader.js +0 -0
- /package/{lib → lib-commonjs}/WebpackConfigurationLoader.js.map +0 -0
- /package/{lib → lib-commonjs}/WebpackConfigurationLoader.test.js.map +0 -0
- /package/{lib → lib-commonjs}/index.js +0 -0
- /package/{lib → lib-commonjs}/index.js.map +0 -0
- /package/{lib → lib-commonjs}/schemas/heft-webpack4-plugin.schema.json +0 -0
- /package/{lib → lib-commonjs}/shared.js +0 -0
- /package/{lib → lib-commonjs}/shared.js.map +0 -0
- /package/{lib → lib-dts}/DeferredWatchFileSystem.d.ts +0 -0
- /package/{lib → lib-dts}/DeferredWatchFileSystem.d.ts.map +0 -0
- /package/{lib → lib-dts}/Webpack4Plugin.d.ts +0 -0
- /package/{lib → lib-dts}/Webpack4Plugin.d.ts.map +0 -0
- /package/{lib → lib-dts}/WebpackConfigurationLoader.d.ts +0 -0
- /package/{lib → lib-dts}/WebpackConfigurationLoader.d.ts.map +0 -0
- /package/{lib → lib-dts}/WebpackConfigurationLoader.test.d.ts +0 -0
- /package/{lib → lib-dts}/WebpackConfigurationLoader.test.d.ts.map +0 -0
- /package/{lib → lib-dts}/index.d.ts +0 -0
- /package/{lib → lib-dts}/index.d.ts.map +0 -0
- /package/{lib → lib-dts}/shared.d.ts +0 -0
- /package/{lib → lib-dts}/shared.d.ts.map +0 -0
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,64 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/heft-webpack4-plugin",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "1.2.1",
|
|
6
|
+
"tag": "@rushstack/heft-webpack4-plugin_v1.2.1",
|
|
7
|
+
"date": "Fri, 20 Feb 2026 00:15:04 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644."
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"dependency": [
|
|
15
|
+
{
|
|
16
|
+
"comment": "Updating dependency \"@rushstack/debug-certificate-manager\" to `1.7.1`"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"comment": "Updating dependency \"@rushstack/node-core-library\" to `5.20.1`"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"comment": "Updating dependency \"@rushstack/heft\" to `1.2.1`"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"comment": "Updating dependency \"@rushstack/terminal\" to `0.22.1`"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"comment": "Updating dependency \"@rushstack/heft\" from `^1.2.0` to `1.2.1`"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"version": "1.2.0",
|
|
35
|
+
"tag": "@rushstack/heft-webpack4-plugin_v1.2.0",
|
|
36
|
+
"date": "Thu, 19 Feb 2026 00:04:53 GMT",
|
|
37
|
+
"comments": {
|
|
38
|
+
"minor": [
|
|
39
|
+
{
|
|
40
|
+
"comment": "Normalize package layout. CommonJS is now under `lib-commonjs`, DTS is now under `lib-dts`, and ESM is now under `lib-esm`. Imports to `lib` still work as before, handled by the `\"exports\"` field in `package.json`."
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"dependency": [
|
|
44
|
+
{
|
|
45
|
+
"comment": "Updating dependency \"@rushstack/debug-certificate-manager\" to `1.7.0`"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"comment": "Updating dependency \"@rushstack/node-core-library\" to `5.20.0`"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"comment": "Updating dependency \"@rushstack/heft\" to `1.2.0`"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"comment": "Updating dependency \"@rushstack/terminal\" to `0.22.0`"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"comment": "Updating dependency \"@rushstack/heft\" from `^1.1.14` to `1.2.0`"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
4
62
|
{
|
|
5
63
|
"version": "1.1.14",
|
|
6
64
|
"tag": "@rushstack/heft-webpack4-plugin_v1.1.14",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Change Log - @rushstack/heft-webpack4-plugin
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 20 Feb 2026 00:15:04 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 1.2.1
|
|
6
|
+
Fri, 20 Feb 2026 00:15:04 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- Add `"node"` condition before `"import"` in the `"exports"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `"import"`. Fixes https://github.com/microsoft/rushstack/issues/5644.
|
|
11
|
+
|
|
12
|
+
## 1.2.0
|
|
13
|
+
Thu, 19 Feb 2026 00:04:53 GMT
|
|
14
|
+
|
|
15
|
+
### Minor changes
|
|
16
|
+
|
|
17
|
+
- Normalize package layout. CommonJS is now under `lib-commonjs`, DTS is now under `lib-dts`, and ESM is now under `lib-esm`. Imports to `lib` still work as before, handled by the `"exports"` field in `package.json`.
|
|
4
18
|
|
|
5
19
|
## 1.1.14
|
|
6
20
|
Sat, 07 Feb 2026 01:13:26 GMT
|
package/heft-plugin.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"taskPlugins": [
|
|
5
5
|
{
|
|
6
6
|
"pluginName": "webpack4-plugin",
|
|
7
|
-
"entryPoint": "./lib/Webpack4Plugin",
|
|
8
|
-
"optionsSchema": "./lib/schemas/heft-webpack4-plugin.schema.json",
|
|
7
|
+
"entryPoint": "./lib-commonjs/Webpack4Plugin",
|
|
8
|
+
"optionsSchema": "./lib-commonjs/schemas/heft-webpack4-plugin.schema.json",
|
|
9
9
|
|
|
10
10
|
"parameterScope": "webpack4",
|
|
11
11
|
"parameters": [
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import Watchpack from 'watchpack';
|
|
4
|
+
function* contains(source, collection) {
|
|
5
|
+
for (const item of source) {
|
|
6
|
+
if (collection.has(item)) {
|
|
7
|
+
yield item;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export class DeferredWatchFileSystem {
|
|
12
|
+
constructor(inputFileSystem, onChange) {
|
|
13
|
+
this.inputFileSystem = inputFileSystem;
|
|
14
|
+
this.watcherOptions = {
|
|
15
|
+
aggregateTimeout: 0
|
|
16
|
+
};
|
|
17
|
+
this.watcher = new Watchpack(this.watcherOptions);
|
|
18
|
+
this._onChange = onChange;
|
|
19
|
+
}
|
|
20
|
+
flush() {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
const state = this._state;
|
|
23
|
+
if (!state) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
const { files, dirs, missing, changes, removals, callback } = state;
|
|
27
|
+
const { changes: aggregatedChanges, removals: aggregatedRemovals } = this.watcher.getAggregated();
|
|
28
|
+
// Webpack 4 treats changes as a superset of removals
|
|
29
|
+
for (const removal of aggregatedRemovals) {
|
|
30
|
+
changes.add(removal);
|
|
31
|
+
removals.add(removal);
|
|
32
|
+
}
|
|
33
|
+
for (const change of aggregatedChanges) {
|
|
34
|
+
removals.delete(change);
|
|
35
|
+
changes.add(change);
|
|
36
|
+
}
|
|
37
|
+
if (changes.size > 0) {
|
|
38
|
+
(_b = (_a = this.inputFileSystem).purge) === null || _b === void 0 ? void 0 : _b.call(_a, Array.from(changes));
|
|
39
|
+
const filteredRemovals = new Set(contains(removals, files));
|
|
40
|
+
const changedFiles = Array.from(contains(changes, files)).sort();
|
|
41
|
+
const changedDirs = Array.from(contains(changes, dirs)).sort();
|
|
42
|
+
const changedMissing = Array.from(contains(changes, missing)).sort();
|
|
43
|
+
const times = new Map(Object.entries(this.watcher.getTimes()));
|
|
44
|
+
callback(undefined, changedFiles, changedDirs, changedMissing, times, times, filteredRemovals);
|
|
45
|
+
changes.clear();
|
|
46
|
+
removals.clear();
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
watch(files, directories, missing, startTime, options, callback, callbackUndelayed) {
|
|
52
|
+
const oldWatcher = this.watcher;
|
|
53
|
+
const watcher = (this.watcher = new Watchpack(options));
|
|
54
|
+
const changes = new Set();
|
|
55
|
+
const removals = new Set();
|
|
56
|
+
this._state = {
|
|
57
|
+
files: new Set(files),
|
|
58
|
+
dirs: new Set(directories),
|
|
59
|
+
missing: new Set(missing),
|
|
60
|
+
changes,
|
|
61
|
+
removals,
|
|
62
|
+
callback
|
|
63
|
+
};
|
|
64
|
+
watcher.once('aggregated', (newChanges, newRemovals) => {
|
|
65
|
+
watcher.pause();
|
|
66
|
+
for (const change of newChanges) {
|
|
67
|
+
changes.add(change);
|
|
68
|
+
}
|
|
69
|
+
for (const removal of newRemovals) {
|
|
70
|
+
changes.add(removal);
|
|
71
|
+
removals.add(removal);
|
|
72
|
+
}
|
|
73
|
+
this._onChange();
|
|
74
|
+
});
|
|
75
|
+
watcher.watch({
|
|
76
|
+
files,
|
|
77
|
+
directories,
|
|
78
|
+
missing,
|
|
79
|
+
startTime
|
|
80
|
+
});
|
|
81
|
+
if (oldWatcher) {
|
|
82
|
+
oldWatcher.close();
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
close: () => {
|
|
86
|
+
if (this.watcher) {
|
|
87
|
+
this.watcher.close();
|
|
88
|
+
this.watcher = undefined;
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
pause: () => {
|
|
92
|
+
if (this.watcher) {
|
|
93
|
+
this.watcher.pause();
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
getFileTimestamps: () => {
|
|
97
|
+
var _a;
|
|
98
|
+
const timestamps = (_a = this.watcher) === null || _a === void 0 ? void 0 : _a.getTimes();
|
|
99
|
+
return timestamps ? new Map(Object.entries(timestamps)) : new Map();
|
|
100
|
+
},
|
|
101
|
+
getContextTimestamps: () => {
|
|
102
|
+
var _a;
|
|
103
|
+
const timestamps = (_a = this.watcher) === null || _a === void 0 ? void 0 : _a.getTimes();
|
|
104
|
+
return timestamps ? new Map(Object.entries(timestamps)) : new Map();
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
export class OverrideNodeWatchFSPlugin {
|
|
110
|
+
constructor(onChange) {
|
|
111
|
+
this.fileSystems = new Set();
|
|
112
|
+
this._onChange = onChange;
|
|
113
|
+
}
|
|
114
|
+
apply(compiler) {
|
|
115
|
+
const watchFileSystem = new DeferredWatchFileSystem(compiler.inputFileSystem, this._onChange);
|
|
116
|
+
this.fileSystems.add(watchFileSystem);
|
|
117
|
+
compiler.watchFileSystem = watchFileSystem;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=DeferredWatchFileSystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeferredWatchFileSystem.js","sourceRoot":"","sources":["../src/DeferredWatchFileSystem.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,SAAgC,MAAM,WAAW,CAAC;AA8BzD,QAAQ,CAAC,CAAC,QAAQ,CAAI,MAAmB,EAAE,UAA0B;IACnE,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QAC1B,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,CAAC;QACb,CAAC;IACH,CAAC;AACH,CAAC;AAyBD,MAAM,OAAO,uBAAuB;IAQlC,YAAmB,eAA2B,EAAE,QAAoB;QAClE,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,cAAc,GAAG;YACpB,gBAAgB,EAAE,CAAC;SACpB,CAAC;QACF,IAAI,CAAC,OAAO,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAClD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAEM,KAAK;;QACV,MAAM,KAAK,GAA4B,IAAI,CAAC,MAAM,CAAC;QAEnD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,KA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B;QAHvB,gBAAW,GAAiC,IAAI,GAAG,EAAE,CAAC;QAIpE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAEM,KAAK,CAAC,QAAkB;QAC7B,MAAM,eAAe,GAA4B,IAAI,uBAAuB,CAC1E,QAAQ,CAAC,eAAe,EACxB,IAAI,CAAC,SAAS,CACf,CAAC;QACF,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QACrC,QAAmD,CAAC,eAAe,GAAG,eAAe,CAAC;IACzF,CAAC;CACF","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 Watchpack, { type WatchOptions } from 'watchpack';\nimport type { Compiler, Plugin } from 'webpack';\n\nexport interface IPurgeable {\n purge?: (changes: string[]) => void;\n}\n\nexport interface IWatchCallback {\n (\n err: Error | undefined,\n files: string[],\n dirs: string[],\n missing: string[],\n fileTimes: Map<string, number>,\n dirTimes: Map<string, number>,\n removals: Set<string>\n ): void;\n}\n\nexport interface IWatchUndelayedCallback {\n (path: string, mtime: number): void;\n}\n\nexport interface IWatch {\n close(): void;\n pause(): void;\n getFileTimestamps(): Map<string, number>;\n getContextTimestamps(): Map<string, number>;\n}\n\nfunction* contains<T>(source: Iterable<T>, collection: ReadonlySet<T>): IterableIterator<T> {\n for (const item of source) {\n if (collection.has(item)) {\n yield item;\n }\n }\n}\n\ninterface IWatchState {\n files: Set<string>;\n dirs: Set<string>;\n missing: Set<string>;\n\n changes: Set<string>;\n removals: Set<string>;\n\n callback: IWatchCallback;\n}\n\nexport interface IWatchFileSystem {\n watch(\n files: string[],\n directories: string[],\n missing: string[],\n startTime: number,\n options: WatchOptions,\n callback: IWatchCallback,\n callbackUndelayed: IWatchUndelayedCallback\n ): IWatch;\n}\n\nexport class DeferredWatchFileSystem implements IWatchFileSystem {\n public readonly inputFileSystem: IPurgeable;\n public readonly watcherOptions: WatchOptions;\n public watcher: Watchpack | undefined;\n\n private readonly _onChange: () => void;\n private _state: IWatchState | undefined;\n\n public constructor(inputFileSystem: IPurgeable, onChange: () => void) {\n this.inputFileSystem = inputFileSystem;\n this.watcherOptions = {\n aggregateTimeout: 0\n };\n this.watcher = new Watchpack(this.watcherOptions);\n this._onChange = onChange;\n }\n\n public flush(): boolean {\n const state: IWatchState | undefined = this._state;\n\n if (!state) {\n return false;\n }\n\n const { files, dirs, missing, changes, removals, callback } = state;\n\n const { changes: aggregatedChanges, removals: aggregatedRemovals } = this.watcher!.getAggregated();\n\n // Webpack 4 treats changes as a superset of removals\n for (const removal of aggregatedRemovals) {\n changes.add(removal);\n removals.add(removal);\n }\n for (const change of aggregatedChanges) {\n removals.delete(change);\n changes.add(change);\n }\n\n if (changes.size > 0) {\n this.inputFileSystem.purge?.(Array.from(changes));\n\n const filteredRemovals: Set<string> = new Set(contains(removals, files));\n const changedFiles: string[] = Array.from(contains(changes, files)).sort();\n const changedDirs: string[] = Array.from(contains(changes, dirs)).sort();\n const changedMissing: string[] = Array.from(contains(changes, missing)).sort();\n\n const times: Map<string, number> = new Map(Object.entries(this.watcher!.getTimes()));\n\n callback(undefined, changedFiles, changedDirs, changedMissing, times, times, filteredRemovals);\n\n changes.clear();\n removals.clear();\n\n return true;\n }\n\n return false;\n }\n\n public watch(\n files: string[],\n directories: string[],\n missing: string[],\n startTime: number,\n options: WatchOptions,\n callback: IWatchCallback,\n callbackUndelayed: IWatchUndelayedCallback\n ): IWatch {\n const oldWatcher: Watchpack | undefined = this.watcher;\n const watcher: Watchpack = (this.watcher = new Watchpack(options));\n\n const changes: Set<string> = new Set();\n const removals: Set<string> = new Set();\n\n this._state = {\n files: new Set(files),\n dirs: new Set(directories),\n missing: new Set(missing),\n\n changes,\n removals,\n\n callback\n };\n\n watcher.once('aggregated', (newChanges: Set<string>, newRemovals: Set<string>) => {\n watcher.pause();\n\n for (const change of newChanges) {\n changes.add(change);\n }\n for (const removal of newRemovals) {\n changes.add(removal);\n removals.add(removal);\n }\n\n this._onChange();\n });\n\n watcher.watch({\n files,\n directories,\n missing,\n startTime\n });\n\n if (oldWatcher) {\n oldWatcher.close();\n }\n\n return {\n close: () => {\n if (this.watcher) {\n this.watcher.close();\n this.watcher = undefined;\n }\n },\n pause: () => {\n if (this.watcher) {\n this.watcher.pause();\n }\n },\n getFileTimestamps: () => {\n const timestamps: Record<string, number> | undefined = this.watcher?.getTimes();\n return timestamps ? new Map(Object.entries(timestamps)) : new Map();\n },\n getContextTimestamps: () => {\n const timestamps: Record<string, number> | undefined = this.watcher?.getTimes();\n return timestamps ? new Map(Object.entries(timestamps)) : new Map();\n }\n };\n }\n}\n\nexport class OverrideNodeWatchFSPlugin implements Plugin {\n public readonly fileSystems: Set<DeferredWatchFileSystem> = new Set();\n private readonly _onChange: () => void;\n\n public constructor(onChange: () => void) {\n this._onChange = onChange;\n }\n\n public apply(compiler: Compiler): void {\n const watchFileSystem: DeferredWatchFileSystem = new DeferredWatchFileSystem(\n compiler.inputFileSystem,\n this._onChange\n );\n this.fileSystems.add(watchFileSystem);\n (compiler as { watchFileSystem?: IWatchFileSystem }).watchFileSystem = watchFileSystem;\n }\n}\n"]}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import { AsyncParallelHook, AsyncSeriesBailHook, AsyncSeriesHook } from 'tapable';
|
|
4
|
+
import { CertificateManager } from '@rushstack/debug-certificate-manager';
|
|
5
|
+
import { InternalError, LegacyAdapters } from '@rushstack/node-core-library';
|
|
6
|
+
import { PLUGIN_NAME } from './shared';
|
|
7
|
+
import { tryLoadWebpackConfigurationAsync } from './WebpackConfigurationLoader';
|
|
8
|
+
import { OverrideNodeWatchFSPlugin } from './DeferredWatchFileSystem';
|
|
9
|
+
const SERVE_PARAMETER_LONG_NAME = '--serve';
|
|
10
|
+
const WEBPACK_PACKAGE_NAME = 'webpack';
|
|
11
|
+
const WEBPACK_DEV_SERVER_PACKAGE_NAME = 'webpack-dev-server';
|
|
12
|
+
const WEBPACK_DEV_SERVER_ENV_VAR_NAME = 'WEBPACK_DEV_SERVER';
|
|
13
|
+
const WEBPACK_DEV_MIDDLEWARE_PACKAGE_NAME = 'webpack-dev-middleware';
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export default class Webpack4Plugin {
|
|
18
|
+
constructor() {
|
|
19
|
+
this._isServeMode = false;
|
|
20
|
+
this._webpackConfiguration = false;
|
|
21
|
+
this._warnings = [];
|
|
22
|
+
this._errors = [];
|
|
23
|
+
}
|
|
24
|
+
get accessor() {
|
|
25
|
+
if (!this._accessor) {
|
|
26
|
+
this._accessor = {
|
|
27
|
+
hooks: _createAccessorHooks(),
|
|
28
|
+
parameters: {
|
|
29
|
+
isServeMode: this._isServeMode
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return this._accessor;
|
|
34
|
+
}
|
|
35
|
+
apply(taskSession, heftConfiguration, options = {}) {
|
|
36
|
+
this._isServeMode = taskSession.parameters.getFlagParameter(SERVE_PARAMETER_LONG_NAME).value;
|
|
37
|
+
if (!taskSession.parameters.watch && this._isServeMode) {
|
|
38
|
+
throw new Error(`The ${JSON.stringify(SERVE_PARAMETER_LONG_NAME)} parameter is only available when running in watch mode.`);
|
|
39
|
+
}
|
|
40
|
+
taskSession.hooks.run.tapPromise(PLUGIN_NAME, async (runOptions) => {
|
|
41
|
+
await this._runWebpackAsync(taskSession, heftConfiguration, options);
|
|
42
|
+
});
|
|
43
|
+
taskSession.hooks.runIncremental.tapPromise(PLUGIN_NAME, async (runOptions) => {
|
|
44
|
+
await this._runWebpackWatchAsync(taskSession, heftConfiguration, options, runOptions.requestRun);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
async _getWebpackConfigurationAsync(taskSession, heftConfiguration, options, requestRun) {
|
|
48
|
+
if (this._webpackConfiguration === false) {
|
|
49
|
+
const webpackConfiguration = await tryLoadWebpackConfigurationAsync({
|
|
50
|
+
taskSession,
|
|
51
|
+
heftConfiguration,
|
|
52
|
+
hooks: this.accessor.hooks,
|
|
53
|
+
serveMode: this._isServeMode,
|
|
54
|
+
loadWebpackAsyncFn: this._loadWebpackAsync.bind(this)
|
|
55
|
+
}, options);
|
|
56
|
+
if (webpackConfiguration && requestRun) {
|
|
57
|
+
const overrideWatchFSPlugin = new OverrideNodeWatchFSPlugin(requestRun);
|
|
58
|
+
this._watchFileSystems = overrideWatchFSPlugin.fileSystems;
|
|
59
|
+
for (const config of Array.isArray(webpackConfiguration)
|
|
60
|
+
? webpackConfiguration
|
|
61
|
+
: [webpackConfiguration]) {
|
|
62
|
+
if (!config.plugins) {
|
|
63
|
+
config.plugins = [overrideWatchFSPlugin];
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
config.plugins.unshift(overrideWatchFSPlugin);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
this._webpackConfiguration = webpackConfiguration;
|
|
71
|
+
}
|
|
72
|
+
return this._webpackConfiguration;
|
|
73
|
+
}
|
|
74
|
+
async _loadWebpackAsync() {
|
|
75
|
+
if (!this._webpack) {
|
|
76
|
+
// Allow this to fail if webpack is not installed
|
|
77
|
+
this._webpack = await import(WEBPACK_PACKAGE_NAME);
|
|
78
|
+
}
|
|
79
|
+
return this._webpack;
|
|
80
|
+
}
|
|
81
|
+
async _getWebpackCompilerAsync(taskSession, webpackConfiguration) {
|
|
82
|
+
if (!this._webpackCompiler) {
|
|
83
|
+
const webpack = await this._loadWebpackAsync();
|
|
84
|
+
taskSession.logger.terminal.writeLine(`Using Webpack version ${webpack.version}`);
|
|
85
|
+
this._webpackCompiler = Array.isArray(webpackConfiguration)
|
|
86
|
+
? webpack.default(webpackConfiguration) /* (webpack.Compilation[]) => MultiCompiler */
|
|
87
|
+
: webpack.default(webpackConfiguration); /* (webpack.Compilation) => Compiler */
|
|
88
|
+
}
|
|
89
|
+
return this._webpackCompiler;
|
|
90
|
+
}
|
|
91
|
+
async _runWebpackAsync(taskSession, heftConfiguration, options) {
|
|
92
|
+
this._validateEnvironmentVariable(taskSession);
|
|
93
|
+
if (taskSession.parameters.watch || this._isServeMode) {
|
|
94
|
+
// Should never happen, but just in case
|
|
95
|
+
throw new InternalError('Cannot run Webpack in compilation mode when watch mode is enabled');
|
|
96
|
+
}
|
|
97
|
+
// Load the config and compiler, and return if there is no config found
|
|
98
|
+
const webpackConfiguration = await this._getWebpackConfigurationAsync(taskSession, heftConfiguration, options);
|
|
99
|
+
if (!webpackConfiguration) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const compiler = await this._getWebpackCompilerAsync(taskSession, webpackConfiguration);
|
|
103
|
+
taskSession.logger.terminal.writeLine('Running Webpack compilation');
|
|
104
|
+
// Run the webpack compiler
|
|
105
|
+
let stats;
|
|
106
|
+
try {
|
|
107
|
+
stats = await LegacyAdapters.convertCallbackToPromise(compiler.run.bind(compiler));
|
|
108
|
+
}
|
|
109
|
+
catch (e) {
|
|
110
|
+
taskSession.logger.emitError(e);
|
|
111
|
+
}
|
|
112
|
+
// Emit the errors from the stats object, if present
|
|
113
|
+
if (stats) {
|
|
114
|
+
this._recordErrors(stats);
|
|
115
|
+
if (this.accessor.hooks.onEmitStats.isUsed()) {
|
|
116
|
+
await this.accessor.hooks.onEmitStats.promise(stats);
|
|
117
|
+
}
|
|
118
|
+
this._emitErrors(taskSession.logger);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async _runWebpackWatchAsync(taskSession, heftConfiguration, options, requestRun) {
|
|
122
|
+
var _a;
|
|
123
|
+
// Save a handle to the original promise, since the this-scoped promise will be replaced whenever
|
|
124
|
+
// the compilation completes.
|
|
125
|
+
let webpackCompilationDonePromise = this._webpackCompilationDonePromise;
|
|
126
|
+
let isInitial = false;
|
|
127
|
+
if (!this._webpackCompiler) {
|
|
128
|
+
isInitial = true;
|
|
129
|
+
this._validateEnvironmentVariable(taskSession);
|
|
130
|
+
if (!taskSession.parameters.watch) {
|
|
131
|
+
// Should never happen, but just in case
|
|
132
|
+
throw new InternalError('Cannot run Webpack in watch mode when compilation mode is enabled');
|
|
133
|
+
}
|
|
134
|
+
// Load the config and compiler, and return if there is no config found
|
|
135
|
+
const webpackConfiguration = await this._getWebpackConfigurationAsync(taskSession, heftConfiguration, options, requestRun);
|
|
136
|
+
if (!webpackConfiguration) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
// Get the compiler which will be used for both serve and watch mode
|
|
140
|
+
const compiler = await this._getWebpackCompilerAsync(taskSession, webpackConfiguration);
|
|
141
|
+
// Set up the hook to detect when the watcher completes the watcher compilation. We will also log out
|
|
142
|
+
// errors from the compilation if present from the output stats object.
|
|
143
|
+
this._webpackCompilationDonePromise = new Promise((resolve) => {
|
|
144
|
+
this._webpackCompilationDonePromiseResolveFn = resolve;
|
|
145
|
+
});
|
|
146
|
+
webpackCompilationDonePromise = this._webpackCompilationDonePromise;
|
|
147
|
+
compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {
|
|
148
|
+
this._webpackCompilationDonePromiseResolveFn();
|
|
149
|
+
this._webpackCompilationDonePromise = new Promise((resolve) => {
|
|
150
|
+
this._webpackCompilationDonePromiseResolveFn = resolve;
|
|
151
|
+
});
|
|
152
|
+
if (stats) {
|
|
153
|
+
this._recordErrors(stats);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
// Determine how we will run the compiler. When serving, we will run the compiler
|
|
157
|
+
// via the webpack-dev-server. Otherwise, we will run the compiler directly.
|
|
158
|
+
if (this._isServeMode) {
|
|
159
|
+
const defaultDevServerOptions = {
|
|
160
|
+
host: 'localhost',
|
|
161
|
+
devMiddleware: {
|
|
162
|
+
publicPath: '/',
|
|
163
|
+
stats: {
|
|
164
|
+
cached: false,
|
|
165
|
+
cachedAssets: false,
|
|
166
|
+
colors: heftConfiguration.terminalProvider.supportsColor
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
client: {
|
|
170
|
+
logging: 'info',
|
|
171
|
+
webSocketURL: {
|
|
172
|
+
port: 8080
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
port: 8080,
|
|
176
|
+
onListening: (server) => {
|
|
177
|
+
var _a;
|
|
178
|
+
const addressInfo = (_a = server.server) === null || _a === void 0 ? void 0 : _a.address();
|
|
179
|
+
if (addressInfo) {
|
|
180
|
+
const address = typeof addressInfo === 'string' ? addressInfo : `${addressInfo.address}:${addressInfo.port}`;
|
|
181
|
+
taskSession.logger.terminal.writeLine(`Started Webpack Dev Server at https://${address}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
// Obtain the devServerOptions from the webpack configuration, and combine with the default options
|
|
186
|
+
let devServerOptions;
|
|
187
|
+
if (Array.isArray(webpackConfiguration)) {
|
|
188
|
+
const filteredDevServerOptions = webpackConfiguration
|
|
189
|
+
.map((configuration) => configuration.devServer)
|
|
190
|
+
.filter((devServer) => !!devServer);
|
|
191
|
+
if (filteredDevServerOptions.length > 1) {
|
|
192
|
+
taskSession.logger.emitWarning(new Error(`Detected multiple webpack devServer configurations, using the first one.`));
|
|
193
|
+
}
|
|
194
|
+
devServerOptions = { ...defaultDevServerOptions, ...filteredDevServerOptions[0] };
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
devServerOptions = { ...defaultDevServerOptions, ...webpackConfiguration.devServer };
|
|
198
|
+
}
|
|
199
|
+
// Add the certificate and key to the devServerOptions if these fields don't already have values
|
|
200
|
+
if (!devServerOptions.server) {
|
|
201
|
+
const certificateManager = new CertificateManager();
|
|
202
|
+
const certificate = await certificateManager.ensureCertificateAsync(true, taskSession.logger.terminal);
|
|
203
|
+
// Update the web socket URL to use the hostname provided by the certificate
|
|
204
|
+
const clientConfiguration = devServerOptions.client;
|
|
205
|
+
const hostname = (_a = certificate.subjectAltNames) === null || _a === void 0 ? void 0 : _a[0];
|
|
206
|
+
if (hostname && typeof clientConfiguration === 'object') {
|
|
207
|
+
const { webSocketURL } = clientConfiguration;
|
|
208
|
+
if (typeof webSocketURL === 'object') {
|
|
209
|
+
clientConfiguration.webSocketURL = {
|
|
210
|
+
...webSocketURL,
|
|
211
|
+
hostname
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
devServerOptions = {
|
|
216
|
+
...devServerOptions,
|
|
217
|
+
server: {
|
|
218
|
+
type: 'https',
|
|
219
|
+
options: {
|
|
220
|
+
minVersion: 'TLSv1.3',
|
|
221
|
+
key: certificate.pemKey,
|
|
222
|
+
cert: certificate.pemCertificate,
|
|
223
|
+
ca: certificate.pemCaCertificate
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
// Since the webpack-dev-server does not return infrastructure errors via a callback like
|
|
229
|
+
// compiler.watch(...), we will need to intercept them and log them ourselves.
|
|
230
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
231
|
+
compiler.hooks.infrastructureLog.tap(PLUGIN_NAME, (name, type, args) => {
|
|
232
|
+
if (name === WEBPACK_DEV_MIDDLEWARE_PACKAGE_NAME && type === 'error') {
|
|
233
|
+
const error = args[0];
|
|
234
|
+
if (error) {
|
|
235
|
+
taskSession.logger.emitError(error);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return true;
|
|
239
|
+
});
|
|
240
|
+
// The webpack-dev-server package has a design flaw, where merely loading its package will set the
|
|
241
|
+
// WEBPACK_DEV_SERVER environment variable -- even if no APIs are accessed. This environment variable
|
|
242
|
+
// causes incorrect behavior if Heft is not running in serve mode. Thus, we need to be careful to call
|
|
243
|
+
// require() only if Heft is in serve mode.
|
|
244
|
+
taskSession.logger.terminal.writeLine('Starting webpack-dev-server');
|
|
245
|
+
const WebpackDevServer = (await import(WEBPACK_DEV_SERVER_PACKAGE_NAME))
|
|
246
|
+
.default;
|
|
247
|
+
const webpackDevServer = new WebpackDevServer(devServerOptions, compiler);
|
|
248
|
+
await webpackDevServer.start();
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
// Create the watcher. Compilation will start immediately after invoking watch().
|
|
252
|
+
taskSession.logger.terminal.writeLine('Starting Webpack watcher');
|
|
253
|
+
compiler.watch({}, (error) => {
|
|
254
|
+
if (error) {
|
|
255
|
+
taskSession.logger.emitError(error);
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
let hasChanges = true;
|
|
261
|
+
if (!isInitial && this._watchFileSystems) {
|
|
262
|
+
hasChanges = false;
|
|
263
|
+
for (const watchFileSystem of this._watchFileSystems) {
|
|
264
|
+
hasChanges = watchFileSystem.flush() || hasChanges;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
// Resume the compilation, wait for the compilation to complete, then suspend the watchers until the
|
|
268
|
+
// next iteration. Even if there are no changes, the promise should resolve since resuming from a
|
|
269
|
+
// suspended state invalidates the state of the watcher.
|
|
270
|
+
if (hasChanges) {
|
|
271
|
+
taskSession.logger.terminal.writeLine('Running incremental Webpack compilation');
|
|
272
|
+
await webpackCompilationDonePromise;
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
taskSession.logger.terminal.writeLine('Webpack has not detected changes. Listing previous diagnostics.');
|
|
276
|
+
}
|
|
277
|
+
this._emitErrors(taskSession.logger);
|
|
278
|
+
}
|
|
279
|
+
_validateEnvironmentVariable(taskSession) {
|
|
280
|
+
if (!this._isServeMode && process.env[WEBPACK_DEV_SERVER_ENV_VAR_NAME]) {
|
|
281
|
+
taskSession.logger.emitWarning(new Error(`The "${WEBPACK_DEV_SERVER_ENV_VAR_NAME}" environment variable is set, ` +
|
|
282
|
+
'which will cause problems when webpack is not running in serve mode. ' +
|
|
283
|
+
`(Did a dependency inadvertently load the "${WEBPACK_DEV_SERVER_PACKAGE_NAME}" package?)`));
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
_emitErrors(logger) {
|
|
287
|
+
for (const warning of this._warnings) {
|
|
288
|
+
logger.emitWarning(warning);
|
|
289
|
+
}
|
|
290
|
+
for (const error of this._errors) {
|
|
291
|
+
logger.emitError(error);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
_recordErrors(stats) {
|
|
295
|
+
this._errors.length = 0;
|
|
296
|
+
this._warnings.length = 0;
|
|
297
|
+
if (stats.hasErrors() || stats.hasWarnings()) {
|
|
298
|
+
const serializedStats = [stats.toJson('errors-warnings')];
|
|
299
|
+
for (const compilationStats of serializedStats) {
|
|
300
|
+
for (const warning of compilationStats.warnings) {
|
|
301
|
+
this._warnings.push(warning instanceof Error ? warning : new Error(warning));
|
|
302
|
+
}
|
|
303
|
+
for (const error of compilationStats.errors) {
|
|
304
|
+
this._errors.push(error instanceof Error ? error : new Error(error));
|
|
305
|
+
}
|
|
306
|
+
if (compilationStats.children) {
|
|
307
|
+
for (const child of compilationStats.children) {
|
|
308
|
+
serializedStats.push(child);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* @internal
|
|
317
|
+
*/
|
|
318
|
+
export function _createAccessorHooks() {
|
|
319
|
+
return {
|
|
320
|
+
onLoadConfiguration: new AsyncSeriesBailHook(),
|
|
321
|
+
onConfigure: new AsyncSeriesHook(['webpackConfiguration']),
|
|
322
|
+
onAfterConfigure: new AsyncParallelHook(['webpackConfiguration']),
|
|
323
|
+
onEmitStats: new AsyncParallelHook(['webpackStats'])
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
//# sourceMappingURL=Webpack4Plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Webpack4Plugin.js","sourceRoot":"","sources":["../src/Webpack4Plugin.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAM3D,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,CAAC,sBAAsB,CAAC,CAAC;QAC1D,gBAAgB,EAAE,IAAI,iBAAiB,CAAC,CAAC,sBAAsB,CAAC,CAAC;QACjE,WAAW,EAAE,IAAI,iBAAiB,CAAC,CAAC,cAAc,CAAC,CAAC;KACrD,CAAC;AACJ,CAAC","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 'node:net';\n\nimport type * as TWebpack from 'webpack';\nimport type TWebpackDevServer from 'webpack-dev-server';\nimport { AsyncParallelHook, AsyncSeriesBailHook, AsyncSeriesHook, type SyncBailHook } from 'tapable';\n\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 {\n PLUGIN_NAME,\n type IWebpackConfiguration,\n type IWebpackPluginAccessor,\n type IWebpackPluginAccessorHooks\n} from './shared';\nimport { tryLoadWebpackConfigurationAsync } from './WebpackConfigurationLoader';\nimport {\n type 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\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';\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 | false = false;\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: _createAccessorHooks(),\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 === false) {\n const webpackConfiguration: IWebpackConfiguration | undefined = await tryLoadWebpackConfigurationAsync(\n {\n taskSession,\n heftConfiguration,\n hooks: this.accessor.hooks,\n serveMode: this._isServeMode,\n loadWebpackAsyncFn: this._loadWebpackAsync.bind(this)\n },\n options\n );\n\n if (webpackConfiguration && 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 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._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\n/**\n * @internal\n */\nexport function _createAccessorHooks(): IWebpackPluginAccessorHooks {\n return {\n onLoadConfiguration: new AsyncSeriesBailHook(),\n onConfigure: new AsyncSeriesHook(['webpackConfiguration']),\n onAfterConfigure: new AsyncParallelHook(['webpackConfiguration']),\n onEmitStats: new AsyncParallelHook(['webpackStats'])\n };\n}\n"]}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { FileSystem } from '@rushstack/node-core-library';
|
|
5
|
+
import { PLUGIN_NAME, STAGE_LOAD_LOCAL_CONFIG } from './shared';
|
|
6
|
+
const DEFAULT_WEBPACK_CONFIG_PATH = './webpack.config.js';
|
|
7
|
+
const DEFAULT_WEBPACK_DEV_CONFIG_PATH = './webpack.dev.config.js';
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export async function tryLoadWebpackConfigurationAsync(options, pluginOptions) {
|
|
12
|
+
const { taskSession, hooks, _tryLoadConfigFileAsync = tryLoadWebpackConfigurationFileAsync } = options;
|
|
13
|
+
const { logger } = taskSession;
|
|
14
|
+
const { terminal } = logger;
|
|
15
|
+
// Apply default behavior. Due to the state of `this._webpackConfiguration`, this code
|
|
16
|
+
// will execute exactly once.
|
|
17
|
+
hooks.onLoadConfiguration.tapPromise({
|
|
18
|
+
name: PLUGIN_NAME,
|
|
19
|
+
stage: STAGE_LOAD_LOCAL_CONFIG
|
|
20
|
+
}, async () => {
|
|
21
|
+
terminal.writeVerboseLine(`Attempting to load Webpack configuration from local file`);
|
|
22
|
+
const webpackConfiguration = await _tryLoadConfigFileAsync(options, pluginOptions);
|
|
23
|
+
if (webpackConfiguration) {
|
|
24
|
+
terminal.writeVerboseLine(`Loaded Webpack configuration from local file.`);
|
|
25
|
+
}
|
|
26
|
+
return webpackConfiguration;
|
|
27
|
+
});
|
|
28
|
+
// Obtain the webpack configuration by calling into the hook.
|
|
29
|
+
// The local configuration is loaded at STAGE_LOAD_LOCAL_CONFIG
|
|
30
|
+
terminal.writeVerboseLine('Attempting to load Webpack configuration');
|
|
31
|
+
let webpackConfiguration = await hooks.onLoadConfiguration.promise();
|
|
32
|
+
if (webpackConfiguration === false) {
|
|
33
|
+
terminal.writeLine('Webpack disabled by external plugin');
|
|
34
|
+
webpackConfiguration = undefined;
|
|
35
|
+
}
|
|
36
|
+
else if (webpackConfiguration === undefined ||
|
|
37
|
+
(Array.isArray(webpackConfiguration) && webpackConfiguration.length === 0)) {
|
|
38
|
+
terminal.writeLine('No Webpack configuration found');
|
|
39
|
+
webpackConfiguration = undefined;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
if (hooks.onConfigure.isUsed()) {
|
|
43
|
+
// Allow for plugins to customise the configuration
|
|
44
|
+
await hooks.onConfigure.promise(webpackConfiguration);
|
|
45
|
+
}
|
|
46
|
+
if (hooks.onAfterConfigure.isUsed()) {
|
|
47
|
+
// Provide the finalized configuration
|
|
48
|
+
await hooks.onAfterConfigure.promise(webpackConfiguration);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return webpackConfiguration;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export async function tryLoadWebpackConfigurationFileAsync(options, pluginOptions) {
|
|
57
|
+
// TODO: Eventually replace this custom logic with a call to this utility in in webpack-cli:
|
|
58
|
+
// https://github.com/webpack/webpack-cli/blob/next/packages/webpack-cli/lib/groups/ConfigGroup.js
|
|
59
|
+
const { taskSession, heftConfiguration, loadWebpackAsyncFn, serveMode } = options;
|
|
60
|
+
const { logger, parameters: { production } } = taskSession;
|
|
61
|
+
const { terminal } = logger;
|
|
62
|
+
const { configurationPath, devConfigurationPath } = pluginOptions;
|
|
63
|
+
let webpackConfigJs;
|
|
64
|
+
try {
|
|
65
|
+
const buildFolderPath = heftConfiguration.buildFolderPath;
|
|
66
|
+
if (serveMode) {
|
|
67
|
+
const devConfigPath = path.resolve(buildFolderPath, devConfigurationPath || DEFAULT_WEBPACK_DEV_CONFIG_PATH);
|
|
68
|
+
terminal.writeVerboseLine(`Attempting to load webpack configuration from "${devConfigPath}".`);
|
|
69
|
+
webpackConfigJs = await _tryLoadWebpackConfigurationFileInnerAsync(devConfigPath);
|
|
70
|
+
}
|
|
71
|
+
if (!webpackConfigJs) {
|
|
72
|
+
const configPath = path.resolve(buildFolderPath, configurationPath || DEFAULT_WEBPACK_CONFIG_PATH);
|
|
73
|
+
terminal.writeVerboseLine(`Attempting to load webpack configuration from "${configPath}".`);
|
|
74
|
+
webpackConfigJs = await _tryLoadWebpackConfigurationFileInnerAsync(configPath);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
logger.emitError(error);
|
|
79
|
+
}
|
|
80
|
+
if (webpackConfigJs) {
|
|
81
|
+
const webpackConfig = webpackConfigJs.default || webpackConfigJs;
|
|
82
|
+
if (typeof webpackConfig === 'function') {
|
|
83
|
+
// Defer loading of webpack until we know for sure that we will need it
|
|
84
|
+
return webpackConfig({
|
|
85
|
+
prod: production,
|
|
86
|
+
production,
|
|
87
|
+
taskSession,
|
|
88
|
+
heftConfiguration,
|
|
89
|
+
webpack: await loadWebpackAsyncFn()
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
return webpackConfig;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
export async function _tryLoadWebpackConfigurationFileInnerAsync(configurationPath) {
|
|
104
|
+
const configExists = await FileSystem.existsAsync(configurationPath);
|
|
105
|
+
if (configExists) {
|
|
106
|
+
try {
|
|
107
|
+
return await import(configurationPath);
|
|
108
|
+
}
|
|
109
|
+
catch (e) {
|
|
110
|
+
const error = e;
|
|
111
|
+
if (error.code === 'ERR_MODULE_NOT_FOUND') {
|
|
112
|
+
// No configuration found, return undefined.
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
throw new Error(`Error loading webpack configuration at "${configurationPath}": ${e}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=WebpackConfigurationLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebpackConfigurationLoader.js","sourceRoot":"","sources":["../src/WebpackConfigurationLoader.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI1D,OAAO,EACL,WAAW,EACX,uBAAuB,EAIxB,MAAM,UAAU,CAAC;AAwBlB,MAAM,2BAA2B,GAA0B,qBAAqB,CAAC;AACjF,MAAM,+BAA+B,GAA8B,yBAAyB,CAAC;AAE7F;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,OAAyC,EACzC,aAAoC;IAEpC,MAAM,EAAE,WAAW,EAAE,KAA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MAAM,0CAA0C,CAAC,UAAU,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,SAAS,CAAC,KAAc,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,eAAe,EAAE,CAAC;QACpB,MAAM,aAAa,GAChB,eAAuD,CAAC,OAAO,IAAI,eAAe,CAAC;QAEtF,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE,CAAC;YACxC,uEAAuE;YACvE,OAAO,aAAa,CAAC;gBACnB,IAAI,EAAE,UAAU;gBAChB,UAAU;gBACV,WAAW;gBACX,iBAAiB;gBACjB,OAAO,EAAE,MAAM,kBAAkB,EAAE;aACpC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,aAAa,CAAC;QACvB,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,0CAA0C,CAC9D,iBAAyB;IAEzB,MAAM,YAAY,GAAY,MAAM,UAAU,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAC9E,IAAI,YAAY,EAAE,CAAC;QACjB,IAAI,CAAC;YACH,OAAO,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,KAAK,GAA0B,CAA0B,CAAC;YAChE,IAAI,KAAK,CAAC,IAAI,KAAK,sBAAsB,EAAE,CAAC;gBAC1C,4CAA4C;gBAC5C,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,2CAA2C,iBAAiB,MAAM,CAAC,EAAE,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC","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 'node:path';\n\nimport type * as TWebpack from 'webpack';\n\nimport { FileSystem } from '@rushstack/node-core-library';\nimport type { IHeftTaskSession, HeftConfiguration } from '@rushstack/heft';\n\nimport type { IWebpackPluginOptions } from './Webpack4Plugin';\nimport {\n PLUGIN_NAME,\n STAGE_LOAD_LOCAL_CONFIG,\n type IWebpackConfiguration,\n type IWebpackConfigurationFnEnvironment,\n type IWebpackPluginAccessorHooks\n} 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\n/**\n * @internal\n */\nexport interface ILoadWebpackConfigurationOptions {\n taskSession: IHeftTaskSession;\n heftConfiguration: HeftConfiguration;\n serveMode: boolean;\n loadWebpackAsyncFn: () => Promise<typeof TWebpack>;\n hooks: Pick<IWebpackPluginAccessorHooks, 'onLoadConfiguration' | 'onConfigure' | 'onAfterConfigure'>;\n\n _tryLoadConfigFileAsync?: typeof tryLoadWebpackConfigurationFileAsync;\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\n/**\n * @internal\n */\nexport async function tryLoadWebpackConfigurationAsync(\n options: ILoadWebpackConfigurationOptions,\n pluginOptions: IWebpackPluginOptions\n): Promise<IWebpackConfiguration | undefined> {\n const { taskSession, hooks, _tryLoadConfigFileAsync = tryLoadWebpackConfigurationFileAsync } = options;\n const { logger } = taskSession;\n const { terminal } = logger;\n\n // Apply default behavior. Due to the state of `this._webpackConfiguration`, this code\n // will execute exactly once.\n hooks.onLoadConfiguration.tapPromise(\n {\n name: PLUGIN_NAME,\n stage: STAGE_LOAD_LOCAL_CONFIG\n },\n async () => {\n terminal.writeVerboseLine(`Attempting to load Webpack configuration from local file`);\n const webpackConfiguration: IWebpackConfiguration | undefined = await _tryLoadConfigFileAsync(\n options,\n pluginOptions\n );\n\n if (webpackConfiguration) {\n terminal.writeVerboseLine(`Loaded Webpack configuration from local file.`);\n }\n\n return webpackConfiguration;\n }\n );\n\n // Obtain the webpack configuration by calling into the hook.\n // The local configuration is loaded at STAGE_LOAD_LOCAL_CONFIG\n terminal.writeVerboseLine('Attempting to load Webpack configuration');\n let webpackConfiguration: IWebpackConfiguration | false | undefined =\n await hooks.onLoadConfiguration.promise();\n\n if (webpackConfiguration === false) {\n terminal.writeLine('Webpack disabled by external plugin');\n webpackConfiguration = undefined;\n } else if (\n webpackConfiguration === undefined ||\n (Array.isArray(webpackConfiguration) && webpackConfiguration.length === 0)\n ) {\n terminal.writeLine('No Webpack configuration found');\n webpackConfiguration = undefined;\n } else {\n if (hooks.onConfigure.isUsed()) {\n // Allow for plugins to customise the configuration\n await hooks.onConfigure.promise(webpackConfiguration);\n }\n if (hooks.onAfterConfigure.isUsed()) {\n // Provide the finalized configuration\n await hooks.onAfterConfigure.promise(webpackConfiguration);\n }\n }\n return webpackConfiguration;\n}\n\n/**\n * @internal\n */\nexport async function tryLoadWebpackConfigurationFileAsync(\n options: ILoadWebpackConfigurationOptions,\n pluginOptions: IWebpackPluginOptions\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, loadWebpackAsyncFn, serveMode } = options;\n const {\n logger,\n parameters: { production }\n } = taskSession;\n const { terminal } = logger;\n const { configurationPath, devConfigurationPath } = pluginOptions;\n let webpackConfigJs: IWebpackConfigJs | undefined;\n\n try {\n const buildFolderPath: string = heftConfiguration.buildFolderPath;\n if (serveMode) {\n const devConfigPath: string = path.resolve(\n buildFolderPath,\n devConfigurationPath || DEFAULT_WEBPACK_DEV_CONFIG_PATH\n );\n terminal.writeVerboseLine(`Attempting to load webpack configuration from \"${devConfigPath}\".`);\n webpackConfigJs = await _tryLoadWebpackConfigurationFileInnerAsync(devConfigPath);\n }\n\n if (!webpackConfigJs) {\n const configPath: string = path.resolve(\n buildFolderPath,\n configurationPath || DEFAULT_WEBPACK_CONFIG_PATH\n );\n terminal.writeVerboseLine(`Attempting to load webpack configuration from \"${configPath}\".`);\n webpackConfigJs = await _tryLoadWebpackConfigurationFileInnerAsync(configPath);\n }\n } catch (error) {\n 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: production,\n 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/**\n * @internal\n */\nexport async function _tryLoadWebpackConfigurationFileInnerAsync(\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebpackConfigurationLoader.test.js","sourceRoot":"","sources":["../src/WebpackConfigurationLoader.test.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAG3D,OAAO,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E,gBAAgB,CAAC,CAAC;QAE7D,MAAM,UAAU,GAA0B,EAAE,CAAC;QAE7C,OAAO,CAAC,uBAAuB,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QAE7E,MAAM,MAAM,GACV,MAAM,0BAA0B,CAAC,gCAAgC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACjF,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChC,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QACjE,MAAM,CAAC,WAAW,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC7C,MAAM,CAAC,WAAW,CAAC,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;QACrD,MAAM,CAAC,gBAAgB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAClD,MAAM,CAAC,gBAAgB,CAAC,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","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 { HeftConfiguration, IHeftParameters, IHeftTaskSession, IScopedLogger } from '@rushstack/heft';\nimport { MockScopedLogger } from '@rushstack/heft/lib/pluginFramework/logging/MockScopedLogger';\nimport { type ITerminal, StringBufferTerminalProvider, Terminal } from '@rushstack/terminal';\n\nimport * as WebpackConfigurationLoader from './WebpackConfigurationLoader';\nimport { _createAccessorHooks } from './Webpack4Plugin';\nimport { type IWebpackConfiguration, STAGE_LOAD_LOCAL_CONFIG } from './shared';\n\ninterface IMockLoadWebpackConfigurationOptions\n extends WebpackConfigurationLoader.ILoadWebpackConfigurationOptions {\n loadWebpackAsyncFn: jest.Mock;\n _terminalProvider: StringBufferTerminalProvider;\n _tryLoadConfigFileAsync: jest.Mock;\n}\n\ndescribe(WebpackConfigurationLoader.tryLoadWebpackConfigurationAsync.name, () => {\n function createOptions(production: boolean, serveMode: boolean): IMockLoadWebpackConfigurationOptions {\n const terminalProvider: StringBufferTerminalProvider = new StringBufferTerminalProvider(false);\n const terminal: ITerminal = new Terminal(terminalProvider);\n const logger: IScopedLogger = new MockScopedLogger(terminal);\n const buildFolderPath: string = __dirname;\n\n const parameters: Partial<IHeftParameters> = {\n production\n };\n\n const taskSession: IHeftTaskSession = {\n logger,\n parameters: parameters as unknown as IHeftParameters,\n // Other values unused during these tests\n hooks: undefined!,\n parsedCommandLine: undefined!,\n requestAccessToPluginByName: undefined!,\n taskName: 'webpack',\n tempFolderPath: `${__dirname}/temp`\n };\n\n const heftConfiguration: Partial<HeftConfiguration> = {\n buildFolderPath\n };\n\n return {\n taskSession,\n heftConfiguration: heftConfiguration as unknown as HeftConfiguration,\n hooks: _createAccessorHooks(),\n loadWebpackAsyncFn: jest.fn(),\n serveMode,\n\n _terminalProvider: terminalProvider,\n _tryLoadConfigFileAsync: jest.fn()\n };\n }\n\n it(`onLoadConfiguration can return false`, async () => {\n const options: IMockLoadWebpackConfigurationOptions = createOptions(false, false);\n\n const onLoadConfiguration: jest.Mock = jest.fn();\n const onConfigure: jest.Mock = jest.fn();\n const onAfterConfigure: jest.Mock = jest.fn();\n\n options.hooks.onLoadConfiguration.tap('test', onLoadConfiguration);\n options.hooks.onConfigure.tap('test', onConfigure);\n options.hooks.onAfterConfigure.tap('test', onAfterConfigure);\n\n onLoadConfiguration.mockReturnValue(false);\n\n const config: IWebpackConfiguration | undefined =\n await WebpackConfigurationLoader.tryLoadWebpackConfigurationAsync(options, {});\n expect(config).toBeUndefined();\n expect(onLoadConfiguration).toHaveBeenCalledTimes(1);\n expect(options._tryLoadConfigFileAsync).toHaveBeenCalledTimes(0);\n expect(onConfigure).toHaveBeenCalledTimes(0);\n expect(onAfterConfigure).toHaveBeenCalledTimes(0);\n });\n\n it(`calls tryLoadWebpackConfigurationFileAsync`, async () => {\n const options: IMockLoadWebpackConfigurationOptions = createOptions(false, false);\n\n const onConfigure: jest.Mock = jest.fn();\n const onAfterConfigure: jest.Mock = jest.fn();\n\n options.hooks.onConfigure.tap('test', onConfigure);\n options.hooks.onAfterConfigure.tap('test', onAfterConfigure);\n\n options._tryLoadConfigFileAsync.mockReturnValue(Promise.resolve(undefined));\n\n const config: IWebpackConfiguration | undefined =\n await WebpackConfigurationLoader.tryLoadWebpackConfigurationAsync(options, {});\n expect(config).toBeUndefined();\n expect(options._tryLoadConfigFileAsync).toHaveBeenCalledTimes(1);\n expect(onConfigure).toHaveBeenCalledTimes(0);\n expect(onAfterConfigure).toHaveBeenCalledTimes(0);\n });\n\n it(`can fall back`, async () => {\n const options: IMockLoadWebpackConfigurationOptions = createOptions(false, false);\n\n const onLoadConfiguration: jest.Mock = jest.fn();\n const onConfigure: jest.Mock = jest.fn();\n const onAfterConfigure: jest.Mock = jest.fn();\n\n options.hooks.onLoadConfiguration.tap(\n { name: 'test', stage: STAGE_LOAD_LOCAL_CONFIG + 1 },\n onLoadConfiguration\n );\n options.hooks.onConfigure.tap('test', onConfigure);\n options.hooks.onAfterConfigure.tap('test', onAfterConfigure);\n\n options._tryLoadConfigFileAsync.mockReturnValue(Promise.resolve(undefined));\n\n const mockConfig: IWebpackConfiguration = {};\n onLoadConfiguration.mockReturnValue(mockConfig);\n\n const config: IWebpackConfiguration | undefined =\n await WebpackConfigurationLoader.tryLoadWebpackConfigurationAsync(options, {});\n expect(config).toBe(mockConfig);\n\n expect(options._tryLoadConfigFileAsync).toHaveBeenCalledTimes(1);\n expect(onLoadConfiguration).toHaveBeenCalledTimes(1);\n expect(onConfigure).toHaveBeenCalledTimes(1);\n expect(onAfterConfigure).toHaveBeenCalledTimes(1);\n\n expect(onConfigure).toHaveBeenCalledWith(mockConfig);\n expect(onAfterConfigure).toHaveBeenCalledWith(mockConfig);\n });\n\n it(`respects hook order`, async () => {\n const options: IMockLoadWebpackConfigurationOptions = createOptions(false, false);\n\n const onConfigure: jest.Mock = jest.fn();\n const onAfterConfigure: jest.Mock = jest.fn();\n\n options.hooks.onConfigure.tap('test', onConfigure);\n options.hooks.onAfterConfigure.tap('test', onAfterConfigure);\n\n const mockConfig: IWebpackConfiguration = {};\n\n options._tryLoadConfigFileAsync.mockReturnValue(Promise.resolve(mockConfig));\n\n const config: IWebpackConfiguration | undefined =\n await WebpackConfigurationLoader.tryLoadWebpackConfigurationAsync(options, {});\n expect(config).toBe(mockConfig);\n expect(options._tryLoadConfigFileAsync).toHaveBeenCalledTimes(1);\n expect(onConfigure).toHaveBeenCalledTimes(1);\n expect(onConfigure).toHaveBeenCalledWith(mockConfig);\n expect(onAfterConfigure).toHaveBeenCalledTimes(1);\n expect(onAfterConfigure).toHaveBeenCalledWith(mockConfig);\n });\n});\n"]}
|
package/lib-esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,OAAO,EAAE,WAAW,IAAI,UAAU,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport { PLUGIN_NAME as PluginName, STAGE_LOAD_LOCAL_CONFIG } from './shared';\n\nexport type {\n IWebpackConfigurationWithDevServer,\n IWebpackConfiguration,\n IWebpackConfigurationFnEnvironment,\n IWebpackPluginAccessor,\n IWebpackPluginAccessorHooks,\n IWebpackPluginAccessorParameters\n} from './shared';\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
3
|
+
"title": "Webpack 4 Plugin Configuration",
|
|
4
|
+
"description": "Defines options for Webpack 4 plugin execution.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
|
|
9
|
+
"properties": {
|
|
10
|
+
"$schema": {
|
|
11
|
+
"description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.",
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
"devConfigurationPath": {
|
|
16
|
+
"description": "Specifies a relative path to the Webpack dev configuration, which is used in \"serve\" mode. The default value is \"./webpack.dev.config.js\".",
|
|
17
|
+
"type": "string"
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
"configurationPath": {
|
|
21
|
+
"description": "Specifies a relative path to the Webpack configuration. The default value is \"./webpack.config.js\".",
|
|
22
|
+
"type": "string"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
/**
|
|
4
|
+
* The stage in the `onLoadConfiguration` hook at which the config will be loaded from the local
|
|
5
|
+
* webpack config file.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export const STAGE_LOAD_LOCAL_CONFIG = 1000;
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export const PLUGIN_NAME = 'webpack4-plugin';
|
|
13
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;AA0H3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAS,IAAI,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAsB,iBAAiB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n// eslint-disable-next-line import/order\nimport type * as TWebpack from 'webpack';\n// Compensate for webpack-dev-server referencing constructs from webpack 5\ndeclare module 'webpack' {\n export type MultiStats = TWebpack.compilation.MultiStats;\n export type StatsOptions = unknown;\n export type StatsCompilation = TWebpack.compilation.Compilation;\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n export interface Compiler {\n watching?: unknown;\n }\n}\nimport type { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';\nimport type { AsyncParallelHook, AsyncSeriesBailHook, AsyncSeriesHook } from 'tapable';\n\nimport type { IHeftTaskSession, HeftConfiguration } from '@rushstack/heft';\n\n/**\n * The environment passed into the Webpack configuration function. Loosely based\n * on the default Webpack environment options, specified here:\n * https://webpack.js.org/api/cli/#environment-options\n *\n * @public\n */\nexport interface IWebpackConfigurationFnEnvironment {\n /**\n * Whether or not the run is in production mode. Synonym of\n * IWebpackConfigurationFnEnvironment.production.\n */\n prod: boolean;\n /**\n * Whether or not the run is in production mode. Synonym of\n * IWebpackConfigurationFnEnvironment.prod.\n */\n production: boolean;\n\n // Non-standard environment options\n /**\n * The task session provided to the plugin.\n */\n taskSession: IHeftTaskSession;\n /**\n * The Heft configuration provided to the plugin.\n */\n heftConfiguration: HeftConfiguration;\n /**\n * The resolved Webpack package.\n */\n webpack: typeof TWebpack;\n}\n\n/**\n * @public\n */\nexport interface IWebpackConfigurationWithDevServer extends TWebpack.Configuration {\n devServer?: WebpackDevServerConfiguration;\n}\n\n/**\n * @public\n */\nexport type IWebpackConfiguration = IWebpackConfigurationWithDevServer | IWebpackConfigurationWithDevServer[];\n\n/**\n * @public\n */\nexport interface IWebpackPluginAccessorHooks {\n /**\n * A hook that allows for loading custom configurations used by the Webpack\n * plugin. If a tap returns a value other than `undefined` before stage {@link STAGE_LOAD_LOCAL_CONFIG},\n * it will suppress loading from the webpack config file. To provide a fallback behavior in the\n * absence of a local config file, tap this hook with a `stage` value greater than {@link STAGE_LOAD_LOCAL_CONFIG}.\n *\n * @remarks\n * Tapable event handlers can return `false` instead of `undefined` to suppress\n * other handlers from creating a configuration object, and prevent webpack from running.\n */\n readonly onLoadConfiguration: AsyncSeriesBailHook<never, never, never, IWebpackConfiguration | false>;\n /**\n * A hook that allows for modification of the loaded configuration used by the Webpack\n * plugin. If no configuration was loaded, this hook will not be called.\n */\n readonly onConfigure: AsyncSeriesHook<IWebpackConfiguration, never, never>;\n /**\n * A hook that provides the finalized configuration that will be used by Webpack.\n * If no configuration was loaded, this hook will not be called.\n */\n readonly onAfterConfigure: AsyncParallelHook<IWebpackConfiguration, never, never>;\n /**\n * A hook that provides the stats output from Webpack. If no configuration is loaded,\n * this hook will not be called.\n */\n readonly onEmitStats: AsyncParallelHook<TWebpack.Stats | TWebpack.compilation.MultiStats, never, never>;\n}\n\n/**\n * @public\n */\nexport interface IWebpackPluginAccessorParameters {\n /**\n * Whether or not serve mode was enabled by passing the `--serve` flag.\n */\n readonly isServeMode: boolean;\n}\n\n/**\n * @public\n */\nexport interface IWebpackPluginAccessor {\n /**\n * Hooks that are called at various points in the Webpack plugin lifecycle.\n */\n readonly hooks: IWebpackPluginAccessorHooks;\n /**\n * Parameters that are provided by the Webpack plugin.\n */\n readonly parameters: IWebpackPluginAccessorParameters;\n}\n\n/**\n * The stage in the `onLoadConfiguration` hook at which the config will be loaded from the local\n * webpack config file.\n * @public\n */\nexport const STAGE_LOAD_LOCAL_CONFIG: 1000 = 1000;\n\n/**\n * @public\n */\nexport const PLUGIN_NAME: 'webpack4-plugin' = 'webpack4-plugin';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/heft-webpack4-plugin",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Heft plugin for Webpack 4",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,8 +8,33 @@
|
|
|
8
8
|
"directory": "heft-plugins/heft-webpack4-plugin"
|
|
9
9
|
},
|
|
10
10
|
"homepage": "https://rushstack.io/pages/heft/overview/",
|
|
11
|
-
"main": "lib/index.js",
|
|
12
|
-
"
|
|
11
|
+
"main": "./lib-commonjs/index.js",
|
|
12
|
+
"module": "./lib-esm/index.js",
|
|
13
|
+
"types": "./lib-dts/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./lib-dts/index.d.ts",
|
|
17
|
+
"node": "./lib-commonjs/index.js",
|
|
18
|
+
"import": "./lib-esm/index.js",
|
|
19
|
+
"require": "./lib-commonjs/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./lib/*.schema.json": "./lib-commonjs/*.schema.json",
|
|
22
|
+
"./lib/*": {
|
|
23
|
+
"types": "./lib-dts/*.d.ts",
|
|
24
|
+
"node": "./lib-commonjs/*.js",
|
|
25
|
+
"import": "./lib-esm/*.js",
|
|
26
|
+
"require": "./lib-commonjs/*.js"
|
|
27
|
+
},
|
|
28
|
+
"./heft-plugin.json": "./heft-plugin.json",
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"typesVersions": {
|
|
32
|
+
"*": {
|
|
33
|
+
"lib/*": [
|
|
34
|
+
"lib-dts/*"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
13
38
|
"license": "MIT",
|
|
14
39
|
"peerDependenciesMeta": {
|
|
15
40
|
"@types/webpack": {
|
|
@@ -17,7 +42,7 @@
|
|
|
17
42
|
}
|
|
18
43
|
},
|
|
19
44
|
"peerDependencies": {
|
|
20
|
-
"@rushstack/heft": "^1.1
|
|
45
|
+
"@rushstack/heft": "^1.2.1",
|
|
21
46
|
"@types/webpack": "^4",
|
|
22
47
|
"webpack": "~4.47.0"
|
|
23
48
|
},
|
|
@@ -26,18 +51,19 @@
|
|
|
26
51
|
"tapable": "1.1.3",
|
|
27
52
|
"watchpack": "2.4.0",
|
|
28
53
|
"webpack-dev-server": "~4.9.3",
|
|
29
|
-
"@rushstack/
|
|
30
|
-
"@rushstack/
|
|
54
|
+
"@rushstack/debug-certificate-manager": "1.7.1",
|
|
55
|
+
"@rushstack/node-core-library": "5.20.1"
|
|
31
56
|
},
|
|
32
57
|
"devDependencies": {
|
|
33
58
|
"@types/watchpack": "2.4.0",
|
|
34
59
|
"@types/webpack": "4.41.32",
|
|
35
60
|
"eslint": "~9.37.0",
|
|
36
61
|
"webpack": "~4.47.0",
|
|
37
|
-
"
|
|
38
|
-
"@rushstack/terminal": "0.
|
|
39
|
-
"
|
|
62
|
+
"@rushstack/heft": "1.2.1",
|
|
63
|
+
"@rushstack/terminal": "0.22.1",
|
|
64
|
+
"local-node-rig": "1.0.0"
|
|
40
65
|
},
|
|
66
|
+
"sideEffects": false,
|
|
41
67
|
"scripts": {
|
|
42
68
|
"build": "heft build --clean",
|
|
43
69
|
"start": "heft test --clean --watch",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|