@openmrs/webpack-config 11.0.1-pre.5904 → 11.0.1-pre.5908
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 -3
- package/package.json +2 -2
- package/src/index.ts +19 -1
- package/tsconfig.json +1 -1
package/dist/index.js
CHANGED
|
@@ -115,6 +115,14 @@ function buildFederationRuntimeGuard(appName, expectedMinor) {
|
|
|
115
115
|
: '';
|
|
116
116
|
return missingRuntime + skew + '})();';
|
|
117
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Entry points of a shared dependency that frontend modules import by name, and so share alongside
|
|
120
|
+
* it under its peer range. Compiled JSX imports `react/jsx-runtime`.
|
|
121
|
+
*/
|
|
122
|
+
const sharedSubpaths = {
|
|
123
|
+
react: ['react/jsx-runtime'],
|
|
124
|
+
'react-dom': ['react-dom/client'],
|
|
125
|
+
};
|
|
118
126
|
function getFrameworkVersion() {
|
|
119
127
|
try {
|
|
120
128
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
@@ -346,6 +354,15 @@ exports.default = (env, argv = {}) => {
|
|
|
346
354
|
},
|
|
347
355
|
// ignore a project .swcrc to match rspack behavior
|
|
348
356
|
swcrc: false,
|
|
357
|
+
jsc: {
|
|
358
|
+
transform: {
|
|
359
|
+
// `openmrs develop` serves a production app shell so we must ensure we match that
|
|
360
|
+
react: {
|
|
361
|
+
runtime: 'automatic',
|
|
362
|
+
development: false,
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
},
|
|
349
366
|
},
|
|
350
367
|
},
|
|
351
368
|
}, exports.scriptRuleConfig),
|
|
@@ -450,15 +467,15 @@ exports.default = (env, argv = {}) => {
|
|
|
450
467
|
'./start': srcFile,
|
|
451
468
|
},
|
|
452
469
|
shared: [...Object.keys(peerDependencies), '@openmrs/esm-framework/src/internal'].reduce((obj, depName) => {
|
|
453
|
-
var _a;
|
|
454
|
-
const shareNames = [depName];
|
|
470
|
+
var _a, _b;
|
|
471
|
+
const shareNames = [depName, ...((_a = sharedSubpaths[depName]) !== null && _a !== void 0 ? _a : [])];
|
|
455
472
|
// Also handle swr/immutable, etc.
|
|
456
473
|
if (depName === 'swr') {
|
|
457
474
|
shareNames.push('swr/');
|
|
458
475
|
}
|
|
459
476
|
for (const shareName of shareNames) {
|
|
460
477
|
obj[shareName] = {
|
|
461
|
-
requiredVersion: (
|
|
478
|
+
requiredVersion: (_b = peerDependencies[depName]) !== null && _b !== void 0 ? _b : false,
|
|
462
479
|
strictVersion: false,
|
|
463
480
|
singleton: true,
|
|
464
481
|
import: shareName,
|
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.5908",
|
|
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.5908",
|
|
36
36
|
"@swc/core": "1.15.21",
|
|
37
37
|
"browserslist": "4.28.9",
|
|
38
38
|
"browserslist-config-openmrs": "^1.0.1",
|
package/src/index.ts
CHANGED
|
@@ -131,6 +131,15 @@ function buildFederationRuntimeGuard(appName: string, expectedMinor: string | un
|
|
|
131
131
|
return missingRuntime + skew + '})();';
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Entry points of a shared dependency that frontend modules import by name, and so share alongside
|
|
136
|
+
* it under its peer range. Compiled JSX imports `react/jsx-runtime`.
|
|
137
|
+
*/
|
|
138
|
+
const sharedSubpaths: Record<string, Array<string>> = {
|
|
139
|
+
react: ['react/jsx-runtime'],
|
|
140
|
+
'react-dom': ['react-dom/client'],
|
|
141
|
+
};
|
|
142
|
+
|
|
134
143
|
function getFrameworkVersion() {
|
|
135
144
|
try {
|
|
136
145
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
@@ -420,6 +429,15 @@ export default (env: Record<string, string>, argv: Record<string, string> = {})
|
|
|
420
429
|
},
|
|
421
430
|
// ignore a project .swcrc to match rspack behavior
|
|
422
431
|
swcrc: false,
|
|
432
|
+
jsc: {
|
|
433
|
+
transform: {
|
|
434
|
+
// `openmrs develop` serves a production app shell so we must ensure we match that
|
|
435
|
+
react: {
|
|
436
|
+
runtime: 'automatic',
|
|
437
|
+
development: false,
|
|
438
|
+
},
|
|
439
|
+
},
|
|
440
|
+
},
|
|
423
441
|
},
|
|
424
442
|
},
|
|
425
443
|
},
|
|
@@ -549,7 +567,7 @@ export default (env: Record<string, string>, argv: Record<string, string> = {})
|
|
|
549
567
|
'./start': srcFile,
|
|
550
568
|
},
|
|
551
569
|
shared: [...Object.keys(peerDependencies), '@openmrs/esm-framework/src/internal'].reduce((obj, depName) => {
|
|
552
|
-
const shareNames = [depName];
|
|
570
|
+
const shareNames = [depName, ...(sharedSubpaths[depName] ?? [])];
|
|
553
571
|
|
|
554
572
|
// Also handle swr/immutable, etc.
|
|
555
573
|
if (depName === 'swr') {
|