@openmrs/webpack-config 11.0.1-pre.5932 → 11.0.1-pre.5956
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/dist/index.js +20 -0
- package/package.json +3 -3
- package/src/index.ts +27 -0
package/dist/index.js
CHANGED
|
@@ -242,6 +242,26 @@ function slugify(name) {
|
|
|
242
242
|
function fileExistsSync(name) {
|
|
243
243
|
return (0, fs_1.existsSync)(name) && (0, fs_1.statSync)(name).isFile();
|
|
244
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* fork-ts-checker-webpack-plugin 9 passes Chokidar 4 `interval: undefined` and `binaryInterval: undefined`
|
|
247
|
+
* whenever webpack polls without a numeric `poll`, which is `poll: true` or `CHOKIDAR_USEPOLLING` on its own.
|
|
248
|
+
* Chokidar 4 spreads those over its defaults, so the watch process crashes with `ERR_INVALID_ARG_TYPE` as soon
|
|
249
|
+
* as polling starts. Chokidar 3 ignored undefined options; dropping them before they reach the plugin's copy of
|
|
250
|
+
* Chokidar restores that, along with Chokidar's own intervals.
|
|
251
|
+
*/
|
|
252
|
+
function keepChokidarPollingDefaults() {
|
|
253
|
+
const pluginDir = (0, path_1.dirname)(require.resolve('fork-ts-checker-webpack-plugin'));
|
|
254
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
255
|
+
const chokidarModule = require(require.resolve('chokidar', { paths: [pluginDir] }));
|
|
256
|
+
// The plugin calls `chokidar.default.watch`, through TypeScript's `__importDefault`.
|
|
257
|
+
const chokidar = chokidarModule.__esModule ? chokidarModule.default : chokidarModule;
|
|
258
|
+
const watch = chokidar === null || chokidar === void 0 ? void 0 : chokidar.watch;
|
|
259
|
+
if (typeof watch !== 'function' || watch.keepsPollingDefaults) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
chokidar.watch = Object.assign((paths, options) => watch(paths, options && Object.fromEntries(Object.entries(options).filter(([, value]) => value !== undefined))), { keepsPollingDefaults: true });
|
|
263
|
+
}
|
|
264
|
+
keepChokidarPollingDefaults();
|
|
245
265
|
/**
|
|
246
266
|
* This object will be merged into the webpack config.
|
|
247
267
|
* Array values will be concatenated with the existing array.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/webpack-config",
|
|
3
|
-
"version": "11.0.1-pre.
|
|
3
|
+
"version": "11.0.1-pre.5956",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"homepage": "https://github.com/openmrs/openmrs-esm-core#readme",
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@module-federation/enhanced": "2.8.1",
|
|
35
|
-
"@openmrs/carbon-css-guard": "11.0.1-pre.
|
|
35
|
+
"@openmrs/carbon-css-guard": "11.0.1-pre.5956",
|
|
36
36
|
"@swc/core": "1.15.21",
|
|
37
37
|
"browserslist": "4.28.9",
|
|
38
38
|
"browserslist-config-openmrs": "^1.0.1",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"copy-webpack-plugin": "11.0.0",
|
|
41
41
|
"css-loader": "5.2.7",
|
|
42
42
|
"css-minimizer-webpack-plugin": "7.0.2",
|
|
43
|
-
"fork-ts-checker-webpack-plugin": "
|
|
43
|
+
"fork-ts-checker-webpack-plugin": "9.1.0",
|
|
44
44
|
"lightningcss": "1.32.0",
|
|
45
45
|
"lodash": "4.17.21",
|
|
46
46
|
"mini-css-extract-plugin": "2.9.1",
|
package/src/index.ts
CHANGED
|
@@ -300,6 +300,33 @@ function fileExistsSync(name: string) {
|
|
|
300
300
|
return existsSync(name) && statSync(name).isFile();
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
+
/**
|
|
304
|
+
* fork-ts-checker-webpack-plugin 9 passes Chokidar 4 `interval: undefined` and `binaryInterval: undefined`
|
|
305
|
+
* whenever webpack polls without a numeric `poll`, which is `poll: true` or `CHOKIDAR_USEPOLLING` on its own.
|
|
306
|
+
* Chokidar 4 spreads those over its defaults, so the watch process crashes with `ERR_INVALID_ARG_TYPE` as soon
|
|
307
|
+
* as polling starts. Chokidar 3 ignored undefined options; dropping them before they reach the plugin's copy of
|
|
308
|
+
* Chokidar restores that, along with Chokidar's own intervals.
|
|
309
|
+
*/
|
|
310
|
+
function keepChokidarPollingDefaults() {
|
|
311
|
+
const pluginDir = dirname(require.resolve('fork-ts-checker-webpack-plugin'));
|
|
312
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
313
|
+
const chokidarModule = require(require.resolve('chokidar', { paths: [pluginDir] }));
|
|
314
|
+
// The plugin calls `chokidar.default.watch`, through TypeScript's `__importDefault`.
|
|
315
|
+
const chokidar = chokidarModule.__esModule ? chokidarModule.default : chokidarModule;
|
|
316
|
+
const watch = chokidar?.watch;
|
|
317
|
+
if (typeof watch !== 'function' || watch.keepsPollingDefaults) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
chokidar.watch = Object.assign(
|
|
322
|
+
(paths: unknown, options?: Record<string, unknown>) =>
|
|
323
|
+
watch(paths, options && Object.fromEntries(Object.entries(options).filter(([, value]) => value !== undefined))),
|
|
324
|
+
{ keepsPollingDefaults: true },
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
keepChokidarPollingDefaults();
|
|
329
|
+
|
|
303
330
|
/**
|
|
304
331
|
* This object will be merged into the webpack config.
|
|
305
332
|
* Array values will be concatenated with the existing array.
|