@openmrs/rspack-config 11.0.1-pre.5837 → 11.0.1-pre.5906
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 +18 -3
- package/package.json +2 -2
- package/src/index.ts +17 -1
- package/tsconfig.json +1 -1
package/dist/index.js
CHANGED
|
@@ -123,6 +123,14 @@ function buildFederationRuntimeGuard(appName, expectedMinor) {
|
|
|
123
123
|
: '';
|
|
124
124
|
return missingRuntime + skew + '})();';
|
|
125
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Entry points of a shared dependency that frontend modules import by name, and so share alongside
|
|
128
|
+
* it under its peer range. Compiled JSX imports `react/jsx-runtime`.
|
|
129
|
+
*/
|
|
130
|
+
const sharedSubpaths = {
|
|
131
|
+
react: ['react/jsx-runtime'],
|
|
132
|
+
'react-dom': ['react-dom/client'],
|
|
133
|
+
};
|
|
126
134
|
function getFrameworkVersion() {
|
|
127
135
|
try {
|
|
128
136
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
@@ -341,6 +349,13 @@ exports.default = (env, argv = {}) => {
|
|
|
341
349
|
syntax: 'typescript',
|
|
342
350
|
tsx: true,
|
|
343
351
|
},
|
|
352
|
+
transform: {
|
|
353
|
+
// `openmrs develop` serves a production app shell so we must ensure we match that
|
|
354
|
+
react: {
|
|
355
|
+
runtime: 'automatic',
|
|
356
|
+
development: false,
|
|
357
|
+
},
|
|
358
|
+
},
|
|
344
359
|
},
|
|
345
360
|
},
|
|
346
361
|
}, exports.scriptRuleConfig),
|
|
@@ -432,15 +447,15 @@ exports.default = (env, argv = {}) => {
|
|
|
432
447
|
'./start': srcFile,
|
|
433
448
|
},
|
|
434
449
|
shared: [...Object.keys(peerDependencies), '@openmrs/esm-framework/src/internal'].reduce((obj, depName) => {
|
|
435
|
-
var _a;
|
|
436
|
-
const shareNames = [depName];
|
|
450
|
+
var _a, _b;
|
|
451
|
+
const shareNames = [depName, ...((_a = sharedSubpaths[depName]) !== null && _a !== void 0 ? _a : [])];
|
|
437
452
|
// Also handle swr/immutable, etc.
|
|
438
453
|
if (depName === 'swr') {
|
|
439
454
|
shareNames.push('swr/');
|
|
440
455
|
}
|
|
441
456
|
for (const shareName of shareNames) {
|
|
442
457
|
obj[shareName] = {
|
|
443
|
-
requiredVersion: (
|
|
458
|
+
requiredVersion: (_b = peerDependencies[depName]) !== null && _b !== void 0 ? _b : false,
|
|
444
459
|
strictVersion: false,
|
|
445
460
|
singleton: true,
|
|
446
461
|
import: shareName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/rspack-config",
|
|
3
|
-
"version": "11.0.1-pre.
|
|
3
|
+
"version": "11.0.1-pre.5906",
|
|
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.5906",
|
|
36
36
|
"@rspack/cli": "1.7.9",
|
|
37
37
|
"@rspack/core": "1.7.9",
|
|
38
38
|
"@swc/core": "1.15.21",
|
package/src/index.ts
CHANGED
|
@@ -103,6 +103,15 @@ function buildFederationRuntimeGuard(appName: string, expectedMinor: string | un
|
|
|
103
103
|
return missingRuntime + skew + '})();';
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Entry points of a shared dependency that frontend modules import by name, and so share alongside
|
|
108
|
+
* it under its peer range. Compiled JSX imports `react/jsx-runtime`.
|
|
109
|
+
*/
|
|
110
|
+
const sharedSubpaths: Record<string, Array<string>> = {
|
|
111
|
+
react: ['react/jsx-runtime'],
|
|
112
|
+
'react-dom': ['react-dom/client'],
|
|
113
|
+
};
|
|
114
|
+
|
|
106
115
|
function getFrameworkVersion() {
|
|
107
116
|
try {
|
|
108
117
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
@@ -372,6 +381,13 @@ export default (env: Record<string, string>, argv: Record<string, string> = {})
|
|
|
372
381
|
syntax: 'typescript',
|
|
373
382
|
tsx: true,
|
|
374
383
|
},
|
|
384
|
+
transform: {
|
|
385
|
+
// `openmrs develop` serves a production app shell so we must ensure we match that
|
|
386
|
+
react: {
|
|
387
|
+
runtime: 'automatic',
|
|
388
|
+
development: false,
|
|
389
|
+
},
|
|
390
|
+
},
|
|
375
391
|
},
|
|
376
392
|
},
|
|
377
393
|
},
|
|
@@ -487,7 +503,7 @@ export default (env: Record<string, string>, argv: Record<string, string> = {})
|
|
|
487
503
|
'./start': srcFile,
|
|
488
504
|
},
|
|
489
505
|
shared: [...Object.keys(peerDependencies), '@openmrs/esm-framework/src/internal'].reduce((obj, depName) => {
|
|
490
|
-
const shareNames = [depName];
|
|
506
|
+
const shareNames = [depName, ...(sharedSubpaths[depName] ?? [])];
|
|
491
507
|
|
|
492
508
|
// Also handle swr/immutable, etc.
|
|
493
509
|
if (depName === 'swr') {
|