remult 3.3.6 → 3.3.7
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/esm/server/get-remult-admin-html.js +3 -139
- package/esm/server/remult-admin-html.js +13 -0
- package/esm/server/remult-admin.js +0 -13
- package/esm/server/remult-api-server.js +5 -1
- package/package.json +1 -1
- package/server/get-remult-admin-html.js +1 -1
- package/server/remult-admin-html.d.ts +2 -0
- package/server/remult-admin-html.js +14 -0
- package/server/remult-admin.d.ts +0 -1
- package/server/remult-admin.js +0 -12
- package/server/remult-api-server.js +21 -14
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getHtml } from './get-remult-admin-html.js';
|
|
2
|
+
export default function remultAdminHtml(options) {
|
|
3
|
+
const { head, rootPath, requireAuthToken, disableLiveQuery } = options;
|
|
4
|
+
return getHtml()
|
|
5
|
+
.replace('<!--PLACE_HERE_HEAD-->', head)
|
|
6
|
+
.replace('<!--PLACE_HERE_BODY-->', `<script>
|
|
7
|
+
window.optionsFromServer = ${JSON.stringify({
|
|
8
|
+
rootPath,
|
|
9
|
+
requireAuthToken,
|
|
10
|
+
disableLiveQuery,
|
|
11
|
+
})}
|
|
12
|
+
</script>`);
|
|
13
|
+
}
|
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
import { getRelationFieldInfo, } from '../src/remult3/relationInfoMember.js';
|
|
2
2
|
import { Filter } from '../src/filter/filter-interfaces.js';
|
|
3
|
-
import { getHtml } from './get-remult-admin-html.js';
|
|
4
3
|
import { getValueList } from '../src/remult3/RepositoryImplementation.js';
|
|
5
4
|
import { InputTypes } from '../inputTypes.js';
|
|
6
|
-
export default function remultAdminHtml(options) {
|
|
7
|
-
const { head, rootPath, requireAuthToken, disableLiveQuery } = options;
|
|
8
|
-
return getHtml()
|
|
9
|
-
.replace('<!--PLACE_HERE_HEAD-->', head)
|
|
10
|
-
.replace('<!--PLACE_HERE_BODY-->', `<script>
|
|
11
|
-
window.optionsFromServer = ${JSON.stringify({
|
|
12
|
-
rootPath,
|
|
13
|
-
requireAuthToken,
|
|
14
|
-
disableLiveQuery,
|
|
15
|
-
})}
|
|
16
|
-
</script>`);
|
|
17
|
-
}
|
|
18
5
|
export function buildEntityInfo(options) {
|
|
19
6
|
const entities = [];
|
|
20
7
|
for (const metadata of options.entities.map((e) => options.remult.repo(e).metadata)) {
|
|
@@ -11,7 +11,7 @@ import { getEntityKey } from '../src/remult3/getEntityRef.js';
|
|
|
11
11
|
import { Action, classBackendMethodsArray } from '../src/server-action.js';
|
|
12
12
|
import { serverActionField } from '../src/server-action-info.js';
|
|
13
13
|
import { remultStatic } from '../src/remult-static.js';
|
|
14
|
-
import
|
|
14
|
+
import { buildEntityInfo } from './remult-admin.js';
|
|
15
15
|
import { isOfType } from '../src/isOfType.js';
|
|
16
16
|
import { initDataProviderOrJson } from './initDataProviderOrJson.js';
|
|
17
17
|
import { modulesFlatAndOrdered } from './module.js';
|
|
@@ -246,6 +246,10 @@ export class RemultServerImplementation {
|
|
|
246
246
|
disableLiveQuery =
|
|
247
247
|
this.options.admin.disableLiveQuery ?? disableLiveQuery;
|
|
248
248
|
}
|
|
249
|
+
// Lazy-load the ~1.4MB admin HTML module only when the admin
|
|
250
|
+
// page is actually requested, so it is never pulled into the
|
|
251
|
+
// bundle of apps that don't serve the admin UI.
|
|
252
|
+
const { default: remultAdminHtml } = await import('./remult-admin-html.js');
|
|
249
253
|
origResponse.send(remultAdminHtml({
|
|
250
254
|
rootPath: this.options.rootPath ?? '/api',
|
|
251
255
|
head,
|