openmrs 6.3.1-pre.3207 → 6.3.1-pre.3211
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/commands/develop.js +12 -13
- package/package.json +4 -4
- package/src/commands/develop.ts +14 -15
package/dist/commands/develop.js
CHANGED
|
@@ -53,15 +53,14 @@ async function runDevelop(args) {
|
|
|
53
53
|
const source = (0, node_path_1.resolve)(require.resolve('@openmrs/esm-app-shell/package.json'), '..', 'dist');
|
|
54
54
|
const index = (0, node_path_1.resolve)(source, 'index.html');
|
|
55
55
|
const indexContent = (0, node_fs_1.readFileSync)(index, 'utf8')
|
|
56
|
-
.replace(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
56
|
+
.replace(/<script>initializeSpa\([\s\S\n]*<\/script>/m, `<script>
|
|
57
|
+
initializeSpa({
|
|
58
|
+
apiUrl: ${JSON.stringify(apiUrl)},
|
|
59
|
+
spaPath: ${JSON.stringify(spaPath)},
|
|
60
|
+
env: "development",
|
|
61
|
+
offline: ${supportOffline},
|
|
62
|
+
configUrls: ${JSON.stringify([...configUrls, ...localConfigUrls])},
|
|
63
|
+
});
|
|
65
64
|
</script>
|
|
66
65
|
`)
|
|
67
66
|
.replace(/href="\/openmrs\/spa/g, `href="${spaPath}`)
|
|
@@ -78,10 +77,6 @@ async function runDevelop(args) {
|
|
|
78
77
|
// explicitly exclude routes that we want to use other handlers for.
|
|
79
78
|
//
|
|
80
79
|
// express.static respects normal route declaration order.
|
|
81
|
-
// Return our custom `index.html` for all requests beginning with spaPath
|
|
82
|
-
// and not ending in `.js`, `.woff`, `.woff2`, `.json`, or any three-character
|
|
83
|
-
// extension.
|
|
84
|
-
const indexHtmlPathMatcher = new RegExp(`^${spaPath}/(?!.*\\.js$)(?!.*\\.woff2?$)(?!.*\\.json$)(?!.*\\....$).*$`);
|
|
85
80
|
// Route for custom `importmap.json` goes above static assets
|
|
86
81
|
if (importmap.type === 'inline') {
|
|
87
82
|
app.get(`${spaPath}/importmap.json`, (_, res) => {
|
|
@@ -128,6 +123,10 @@ async function runDevelop(args) {
|
|
|
128
123
|
res.contentType('application/json').send((0, node_fs_1.readFileSync)((0, node_path_1.resolve)(process.cwd(), file)));
|
|
129
124
|
});
|
|
130
125
|
});
|
|
126
|
+
// Return our custom `index.html` for all requests beginning with spaPath
|
|
127
|
+
// and not ending in `.js`, `.woff`, `.woff2`, `.json`, or any two- or three-character
|
|
128
|
+
// extension.
|
|
129
|
+
const indexHtmlPathMatcher = /\/openmrs\/spa\/(?!.*\.(js|woff2?|json|.{2,3}$)).*$/;
|
|
131
130
|
// Route for custom `index.html` goes above static assets
|
|
132
131
|
app.get(indexHtmlPathMatcher, (_, res) => res.contentType('text/html').send(indexContent));
|
|
133
132
|
// Return static assets for any request for which we have one, except importmap.json and index.html
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openmrs",
|
|
3
|
-
"version": "6.3.1-pre.
|
|
3
|
+
"version": "6.3.1-pre.3211",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": "./dist/cli.js",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
],
|
|
30
30
|
"homepage": "https://github.com/openmrs/openmrs-esm-core#readme",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@openmrs/esm-app-shell": "6.3.1-pre.
|
|
33
|
-
"@openmrs/rspack-config": "6.3.1-pre.
|
|
34
|
-
"@openmrs/webpack-config": "6.3.1-pre.
|
|
32
|
+
"@openmrs/esm-app-shell": "6.3.1-pre.3211",
|
|
33
|
+
"@openmrs/rspack-config": "6.3.1-pre.3211",
|
|
34
|
+
"@openmrs/webpack-config": "6.3.1-pre.3211",
|
|
35
35
|
"@pnpm/npm-conf": "^2.1.0",
|
|
36
36
|
"@rspack/cli": "^1.3.11",
|
|
37
37
|
"@rspack/core": "^1.3.11",
|
package/src/commands/develop.ts
CHANGED
|
@@ -48,16 +48,15 @@ export async function runDevelop(args: DevelopArgs) {
|
|
|
48
48
|
const index = resolve(source, 'index.html');
|
|
49
49
|
const indexContent = readFileSync(index, 'utf8')
|
|
50
50
|
.replace(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
51
|
+
/<script>initializeSpa\([\s\S\n]*<\/script>/m,
|
|
52
|
+
`<script>
|
|
53
|
+
initializeSpa({
|
|
54
|
+
apiUrl: ${JSON.stringify(apiUrl)},
|
|
55
|
+
spaPath: ${JSON.stringify(spaPath)},
|
|
56
|
+
env: "development",
|
|
57
|
+
offline: ${supportOffline},
|
|
58
|
+
configUrls: ${JSON.stringify([...configUrls, ...localConfigUrls])},
|
|
59
|
+
});
|
|
61
60
|
</script>
|
|
62
61
|
`,
|
|
63
62
|
)
|
|
@@ -79,11 +78,6 @@ export async function runDevelop(args: DevelopArgs) {
|
|
|
79
78
|
//
|
|
80
79
|
// express.static respects normal route declaration order.
|
|
81
80
|
|
|
82
|
-
// Return our custom `index.html` for all requests beginning with spaPath
|
|
83
|
-
// and not ending in `.js`, `.woff`, `.woff2`, `.json`, or any three-character
|
|
84
|
-
// extension.
|
|
85
|
-
const indexHtmlPathMatcher = new RegExp(`^${spaPath}/(?!.*\\.js$)(?!.*\\.woff2?$)(?!.*\\.json$)(?!.*\\....$).*$`);
|
|
86
|
-
|
|
87
81
|
// Route for custom `importmap.json` goes above static assets
|
|
88
82
|
if (importmap.type === 'inline') {
|
|
89
83
|
app.get(`${spaPath}/importmap.json`, (_, res) => {
|
|
@@ -136,6 +130,11 @@ export async function runDevelop(args: DevelopArgs) {
|
|
|
136
130
|
});
|
|
137
131
|
});
|
|
138
132
|
|
|
133
|
+
// Return our custom `index.html` for all requests beginning with spaPath
|
|
134
|
+
// and not ending in `.js`, `.woff`, `.woff2`, `.json`, or any two- or three-character
|
|
135
|
+
// extension.
|
|
136
|
+
const indexHtmlPathMatcher = /\/openmrs\/spa\/(?!.*\.(js|woff2?|json|.{2,3}$)).*$/;
|
|
137
|
+
|
|
139
138
|
// Route for custom `index.html` goes above static assets
|
|
140
139
|
app.get(indexHtmlPathMatcher, (_, res) => res.contentType('text/html').send(indexContent));
|
|
141
140
|
|