@antelopejs/dms-frontend 0.3.11 → 0.4.0
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/README.md +85 -5
- package/dist/commands/verify-source-action.js +2 -10
- package/dist/commands/verify-source.js +11 -7
- package/dist/config.d.ts +1 -0
- package/dist/config.js +5 -1
- package/dist/derived-outputs.d.ts +2 -0
- package/dist/derived-outputs.js +22 -3
- package/dist/help.js +4 -0
- package/dist/layers.js +1 -0
- package/dist/verify-source-runner.js +6 -42
- package/dist/verify-source-sources.d.ts +13 -0
- package/dist/verify-source-sources.js +189 -0
- package/dist/workspace.d.ts +1 -0
- package/package.json +1 -1
- package/templates/vue/DmsDynamicPage.vue +3 -1
- package/templates/vue/app-runtime.ts +42 -26
- package/templates/vue/frontend-build-loader.ts +78 -0
- package/templates/vue/frontend-build.ts +41 -0
- package/templates/vue/frontend-module.ts +166 -22
- package/templates/vue/icon-hydration.ts +78 -0
- package/templates/vue/server/auth/backend.mjs +20 -6
- package/templates/vue/server/auth/client-ip.mjs +28 -0
- package/templates/vue/server/auth/routes.mjs +1 -0
- package/templates/vue/server/auth/session.mjs +6 -0
- package/templates/vue/server/icons.mjs +43 -1
- package/templates/vue/server.mjs +14 -13
- package/templates/vue/ssr-renderer.ts +18 -1
- package/templates/vue/vite.config.ts +25 -23
|
@@ -24,6 +24,13 @@ import {
|
|
|
24
24
|
trackDmsServerScopes,
|
|
25
25
|
} from "./frontend-module";
|
|
26
26
|
import { frontendModules } from "./frontend-modules.generated";
|
|
27
|
+
import {
|
|
28
|
+
SSR_ICONS_ID,
|
|
29
|
+
serializeDmsIcons,
|
|
30
|
+
trackDmsIcons,
|
|
31
|
+
} from "./icon-hydration";
|
|
32
|
+
|
|
33
|
+
export { registerDmsIconCollections } from "./icon-hydration";
|
|
27
34
|
|
|
28
35
|
export interface DmsSsrPage {
|
|
29
36
|
component: string;
|
|
@@ -75,6 +82,14 @@ function asyncComponentsScript(names: Set<string>): string {
|
|
|
75
82
|
return `<script id="${SSR_ASYNC_COMPONENTS_ID}" type="application/json">${value}</script>`;
|
|
76
83
|
}
|
|
77
84
|
|
|
85
|
+
function iconsScript(names: Set<string>): string {
|
|
86
|
+
const value = JSON.stringify(serializeDmsIcons(names)).replaceAll(
|
|
87
|
+
"<",
|
|
88
|
+
"\\u003c",
|
|
89
|
+
);
|
|
90
|
+
return `<script id="${SSR_ICONS_ID}" type="application/json">${value}</script>`;
|
|
91
|
+
}
|
|
92
|
+
|
|
78
93
|
await setupFrontendModules(frontendModules);
|
|
79
94
|
|
|
80
95
|
export function isDmsFrontendPage(path: string): boolean {
|
|
@@ -117,6 +132,7 @@ async function renderDmsPageWithRuntime(
|
|
|
117
132
|
const head = createHead();
|
|
118
133
|
const ssrContext: DmsSsrContext = {};
|
|
119
134
|
let asyncComponents = new Set<string>();
|
|
135
|
+
let icons = new Set<string>();
|
|
120
136
|
const inertiaResult = await createInertiaApp({
|
|
121
137
|
page,
|
|
122
138
|
render: (app) => renderToString(app, ssrContext),
|
|
@@ -124,6 +140,7 @@ async function renderDmsPageWithRuntime(
|
|
|
124
140
|
async setup({ App, props, plugin }) {
|
|
125
141
|
const app = createSSRApp({ render: () => h(App, props) });
|
|
126
142
|
asyncComponents = trackDmsAsyncComponents(app);
|
|
143
|
+
icons = trackDmsIcons(app);
|
|
127
144
|
stopScopes = trackDmsServerScopes(app);
|
|
128
145
|
const configured = await configureDmsApp({
|
|
129
146
|
app,
|
|
@@ -173,7 +190,7 @@ async function renderDmsPageWithRuntime(
|
|
|
173
190
|
const renderedHead = await renderSSRHead(head);
|
|
174
191
|
return {
|
|
175
192
|
error: page.props.error,
|
|
176
|
-
body: `${inertiaResult.body}${asyncDataScript(runtime)}${asyncComponentsScript(asyncComponents)}`,
|
|
193
|
+
body: `${inertiaResult.body}${asyncDataScript(runtime)}${asyncComponentsScript(asyncComponents)}${iconsScript(icons)}`,
|
|
177
194
|
head: {
|
|
178
195
|
bodyAttrs: renderedHead.bodyAttrs,
|
|
179
196
|
headTags: `${inertiaResult.head.join("")}${renderedHead.headTags}`,
|
|
@@ -2,7 +2,15 @@ import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
|
2
2
|
import { basename, resolve } from "node:path";
|
|
3
3
|
import ui from "@nuxt/ui/vite";
|
|
4
4
|
import vue from "@vitejs/plugin-vue";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
createLogger,
|
|
7
|
+
defineConfig,
|
|
8
|
+
type LogLevel,
|
|
9
|
+
normalizePath,
|
|
10
|
+
type Plugin,
|
|
11
|
+
} from "vite";
|
|
12
|
+
import { autoImportDirectories } from "./frontend-build-loader";
|
|
13
|
+
import { frontendBuilds } from "./frontend-builds.generated";
|
|
6
14
|
import { orderHeadForFirstPaint } from "./head-order.mjs";
|
|
7
15
|
import { iconScanGlobs } from "./icon-scan.mjs";
|
|
8
16
|
|
|
@@ -40,21 +48,19 @@ const stableModuleAliases = Object.fromEntries(
|
|
|
40
48
|
}),
|
|
41
49
|
);
|
|
42
50
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
* `ajs dms build` runs Vite at "warn" and reports the steps itself; a verbose
|
|
52
|
+
* run, `dev` and a hand-run build keep Vite's own output.
|
|
53
|
+
*/
|
|
54
|
+
const logLevel = (process.env.DMS_VITE_LOG_LEVEL ?? "info") as LogLevel;
|
|
55
|
+
const logger = createLogger(logLevel);
|
|
56
|
+
/**
|
|
57
|
+
* Only what each module declares in its `dms.frontend.build.ts`: a module
|
|
58
|
+
* without one has nothing auto-imported.
|
|
49
59
|
*/
|
|
50
|
-
const importDirectories =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"app/utils/**/*",
|
|
55
|
-
"app/build/composables/**/*",
|
|
56
|
-
"app/build/types/**/*",
|
|
57
|
-
].map((glob) => ({ glob: normalizePath(resolve(root, glob)), types: true })),
|
|
60
|
+
const importDirectories = autoImportDirectories(
|
|
61
|
+
registry.modules,
|
|
62
|
+
frontendBuilds,
|
|
63
|
+
(message) => logger.warn(message),
|
|
58
64
|
);
|
|
59
65
|
const optimizedDependencies = [
|
|
60
66
|
"vue",
|
|
@@ -90,8 +96,9 @@ const optimizedDependencies = [
|
|
|
90
96
|
* startup, pays that cost a single time and in a place where it reads as
|
|
91
97
|
* startup rather than as a crash.
|
|
92
98
|
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
99
|
+
* Globs are POSIX, always: `resolve` returns a native path, whose Windows
|
|
100
|
+
* backslashes a glob matcher reads as escape characters, not as separators.
|
|
101
|
+
* `normalizePath` is Vite's own answer to this, the identity on POSIX.
|
|
95
102
|
*/
|
|
96
103
|
const optimizerEntries = [
|
|
97
104
|
resolve(__dirname, "main.ts"),
|
|
@@ -117,12 +124,6 @@ const uiInertiaLinkImport = resolve(
|
|
|
117
124
|
"node_modules/@nuxt/ui/dist/runtime/vue/overrides/inertia/Link.vue",
|
|
118
125
|
);
|
|
119
126
|
|
|
120
|
-
/**
|
|
121
|
-
* `ajs dms build` runs Vite at "warn" and reports the steps itself; a verbose
|
|
122
|
-
* run, `dev` and a hand-run build keep Vite's own output.
|
|
123
|
-
*/
|
|
124
|
-
const logLevel = (process.env.DMS_VITE_LOG_LEVEL ?? "info") as LogLevel;
|
|
125
|
-
|
|
126
127
|
export default defineConfig({
|
|
127
128
|
logLevel,
|
|
128
129
|
plugins: [
|
|
@@ -175,6 +176,7 @@ export default defineConfig({
|
|
|
175
176
|
"useI18n",
|
|
176
177
|
"useError",
|
|
177
178
|
"useDmsLazyAsyncData",
|
|
179
|
+
"useDmsPageLoading",
|
|
178
180
|
"useDmsApp",
|
|
179
181
|
"useDmsRoute",
|
|
180
182
|
"useDmsRouter",
|