@antelopejs/dms-frontend 0.9.2 → 0.10.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 +18 -24
- package/dist/commands/build-action.js +3 -2
- package/dist/commands/dev-action.js +2 -1
- package/dist/commands/prepare-action.js +1 -1
- package/dist/commands/start-action.js +3 -24
- package/dist/commands/workspace-task.js +2 -1
- package/dist/config.js +3 -0
- package/dist/derived-outputs.js +3 -3
- package/dist/discovery.js +17 -6
- package/dist/entry-weight.js +15 -0
- package/dist/fs-sync.js +7 -4
- package/dist/index.js +2 -1
- package/dist/internal/built-workspace.d.ts +4 -0
- package/dist/internal/built-workspace.js +43 -0
- package/dist/internal/ensure.d.ts +1 -0
- package/dist/internal/ensure.js +8 -0
- package/dist/internal/locale-catalogs.d.ts +8 -3
- package/dist/internal/locale-catalogs.js +16 -6
- package/dist/internal/manifest-decoder.d.ts +7 -0
- package/dist/internal/manifest-decoder.js +81 -0
- package/dist/internal/own-release.d.ts +5 -0
- package/dist/internal/own-release.js +20 -0
- package/dist/internal/plain-object.d.ts +1 -0
- package/dist/internal/plain-object.js +6 -0
- package/dist/internal/text-list.d.ts +1 -0
- package/dist/internal/text-list.js +10 -0
- package/dist/internal/vite-manifest.d.ts +6 -0
- package/dist/internal/vite-manifest.js +24 -0
- package/dist/layer-watch.js +25 -24
- package/dist/layers.d.ts +1 -1
- package/dist/layers.js +3 -1
- package/dist/locale-files.d.ts +2 -1
- package/dist/locale-files.js +4 -0
- package/dist/manifest.d.ts +1 -1
- package/dist/manifest.js +44 -31
- package/dist/materialize.js +6 -2
- package/dist/module-set.js +2 -1
- package/dist/node-options.d.ts +1 -0
- package/dist/node-options.js +8 -0
- package/dist/output.d.ts +15 -9
- package/dist/output.js +30 -18
- package/dist/private-values.d.ts +1 -1
- package/dist/private-values.js +5 -3
- package/dist/project-modules.js +13 -8
- package/dist/renderer-range.js +5 -3
- package/dist/server-process.js +1 -1
- package/dist/verify-source-build.js +10 -2
- package/dist/verify-source-client-bundle.d.ts +1 -0
- package/dist/verify-source-client-bundle.js +30 -0
- package/dist/verify-source-runner.js +44 -60
- package/dist/verify-source-sources.js +49 -11
- package/dist/workspace-setup.js +1 -1
- package/package.json +6 -4
- package/skills/dms-frontend/SKILL.md +1 -1
- package/templates/vue/app-runtime.ts +90 -16
- package/templates/vue/client-server-guard.mjs +16 -0
- package/templates/vue/compress-assets.mjs +9 -1
- package/templates/vue/entry-weight.mjs +22 -0
- package/templates/vue/frontend-module.ts +1 -0
- package/templates/vue/frontend-runtime/module-registration.ts +2 -2
- package/templates/vue/frontend-runtime/state.ts +2 -2
- package/templates/vue/frontend-runtime/types.ts +8 -2
- package/templates/vue/globals.d.ts +5 -0
- package/templates/vue/head-order.mjs +7 -0
- package/templates/vue/icon-bundle.ts +31 -0
- package/templates/vue/icon-scan.mjs +4 -0
- package/templates/vue/message-subset.ts +65 -0
- package/templates/vue/network-error.ts +4 -0
- package/templates/vue/server/auth/backend.mjs +41 -4
- package/templates/vue/server/auth/client-ip.mjs +52 -4
- package/templates/vue/server/auth/establish-endpoints.mjs +10 -6
- package/templates/vue/server/auth/session.mjs +81 -2
- package/templates/vue/server/auth-hooks.mjs +15 -5
- package/templates/vue/server/backend-proxies.mjs +65 -9
- package/templates/vue/server/backend-request.mjs +61 -0
- package/templates/vue/server/backend-response.mjs +23 -6
- package/templates/vue/server/built-files.mjs +7 -0
- package/templates/vue/server/cli-report.mjs +53 -11
- package/templates/vue/server/client-manifest.mjs +23 -1
- package/templates/vue/server/content.mjs +18 -1
- package/templates/vue/server/dev-private-files.mjs +17 -1
- package/templates/vue/server/dev-styles.mjs +38 -0
- package/templates/vue/server/email.mjs +9 -3
- package/templates/vue/server/favicon.mjs +3 -0
- package/templates/vue/server/generated-files.mjs +211 -0
- package/templates/vue/server/homepage.mjs +21 -9
- package/templates/vue/server/html-tag.mjs +4 -0
- package/templates/vue/server/icons.mjs +80 -7
- package/templates/vue/server/in-place-render.mjs +35 -0
- package/templates/vue/server/inertia.mjs +61 -2
- package/templates/vue/server/module-event.mjs +98 -17
- package/templates/vue/server/module-route-types.mjs +78 -0
- package/templates/vue/server/module-routes.mjs +138 -31
- package/templates/vue/server/module-server.mjs +98 -27
- package/templates/vue/server/module-testing.mjs +14 -5
- package/templates/vue/server/page-props.mjs +92 -2
- package/templates/vue/server/page-redirects.mjs +37 -0
- package/templates/vue/server/path-patterns.mjs +13 -1
- package/templates/vue/server/proxy-compression.mjs +22 -0
- package/templates/vue/server/proxy-headers.mjs +11 -1
- package/templates/vue/server/proxy-redirects.mjs +20 -5
- package/templates/vue/server/proxy-request.mjs +57 -0
- package/templates/vue/server/proxy-transfers.mjs +33 -5
- package/templates/vue/server/public-endpoints.mjs +138 -23
- package/templates/vue/server/public-options.mjs +20 -6
- package/templates/vue/server/request-failure.mjs +23 -0
- package/templates/vue/server/request-routing.mjs +26 -9
- package/templates/vue/server/request-target.mjs +9 -3
- package/templates/vue/server/route-rules.mjs +39 -15
- package/templates/vue/server/ssr-module.mjs +32 -0
- package/templates/vue/server/static-files.mjs +24 -1
- package/templates/vue/server/type-guards.mjs +71 -0
- package/templates/vue/server/vite-errors.mjs +32 -5
- package/templates/vue/server/web-body.mjs +3 -0
- package/templates/vue/server-module.ts +10 -1
- package/templates/vue/server.mjs +132 -148
- package/templates/vue/sfc-global-types.mjs +112 -13
- package/templates/vue/ssr-renderer.ts +12 -3
- package/templates/vue/ui-inertia-page.mjs +16 -1
- package/templates/vue/ui-kbd.mjs +2 -1
- package/templates/vue/ui-lazy-icons.mjs +44 -0
- package/templates/vue/ui-request-state.mjs +2 -1
- package/templates/vue/vite.config.ts +2 -0
|
@@ -7,7 +7,6 @@ import { createSSRApp, h, readonly } from "vue";
|
|
|
7
7
|
import { appConfigs } from "./app-configs.generated";
|
|
8
8
|
import {
|
|
9
9
|
DMS_PAYLOAD_ID,
|
|
10
|
-
type DmsServerFetch,
|
|
11
10
|
SSR_ASYNC_COMPONENTS_ID,
|
|
12
11
|
configureDmsApp,
|
|
13
12
|
resolveDmsInertiaPage,
|
|
@@ -19,6 +18,7 @@ import {
|
|
|
19
18
|
type DmsInertiaPage,
|
|
20
19
|
type DmsPageProps,
|
|
21
20
|
type DmsPayload,
|
|
21
|
+
type DmsServerFetch,
|
|
22
22
|
createDmsFrontendRuntime,
|
|
23
23
|
hasDmsPage,
|
|
24
24
|
pageErrorData,
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
trackDmsServerScopes,
|
|
31
31
|
withPublicOptions,
|
|
32
32
|
} from "./frontend-module";
|
|
33
|
+
import { type DmsMessageSubset, SSR_MESSAGES_ID } from "./message-subset";
|
|
33
34
|
import { parsePublicOptions } from "./public-options";
|
|
34
35
|
import { frontendModules } from "./frontend-modules.generated";
|
|
35
36
|
import {
|
|
@@ -129,6 +130,12 @@ function asyncComponentsScript(names: Set<string>): string {
|
|
|
129
130
|
return `<script id="${SSR_ASYNC_COMPONENTS_ID}" type="application/json">${value}</script>`;
|
|
130
131
|
}
|
|
131
132
|
|
|
133
|
+
function messagesScript(subset: DmsMessageSubset | undefined): string {
|
|
134
|
+
if (!subset) return "";
|
|
135
|
+
const value = JSON.stringify(subset).replaceAll("<", "\\u003c");
|
|
136
|
+
return `<script id="${SSR_MESSAGES_ID}" type="application/json">${value}</script>`;
|
|
137
|
+
}
|
|
138
|
+
|
|
132
139
|
function iconsScript(names: Set<string>): string {
|
|
133
140
|
const value = JSON.stringify(serializeDmsIcons(names)).replaceAll(
|
|
134
141
|
"<",
|
|
@@ -159,7 +166,7 @@ export async function renderDmsPage(
|
|
|
159
166
|
requestCookies?: string,
|
|
160
167
|
): Promise<DmsSsrResult> {
|
|
161
168
|
const runtime = createDmsFrontendRuntime(
|
|
162
|
-
serverFetch
|
|
169
|
+
serverFetch,
|
|
163
170
|
{},
|
|
164
171
|
true,
|
|
165
172
|
requestCookies,
|
|
@@ -195,6 +202,7 @@ async function renderDmsPageWithRuntime(
|
|
|
195
202
|
let iconSymbols = new Map<string, string>();
|
|
196
203
|
let payload: DmsPayload = { data: {}, errors: {}, state: {} };
|
|
197
204
|
let catalogLocale: (() => string | undefined) | undefined;
|
|
205
|
+
let messageSubset: (() => DmsMessageSubset | undefined) | undefined;
|
|
198
206
|
const inertiaResult = await createInertiaApp({
|
|
199
207
|
page,
|
|
200
208
|
// Read as the HTML is complete: data a run settles afterwards was never
|
|
@@ -221,6 +229,7 @@ async function renderDmsPageWithRuntime(
|
|
|
221
229
|
serverFetch,
|
|
222
230
|
});
|
|
223
231
|
catalogLocale = configured.catalogLocale;
|
|
232
|
+
messageSubset = configured.messageSubset;
|
|
224
233
|
return app;
|
|
225
234
|
},
|
|
226
235
|
});
|
|
@@ -255,7 +264,7 @@ async function renderDmsPageWithRuntime(
|
|
|
255
264
|
const renderedHead = await renderSSRHead(head);
|
|
256
265
|
return {
|
|
257
266
|
error: page.props.error,
|
|
258
|
-
body: `${inertiaResult.body}${dmsIconSprite(iconSymbols)}${payloadScript(payload)}${asyncComponentsScript(asyncComponents)}${iconsScript(icons)}`,
|
|
267
|
+
body: `${inertiaResult.body}${dmsIconSprite(iconSymbols)}${payloadScript(payload)}${asyncComponentsScript(asyncComponents)}${iconsScript(icons)}${messagesScript(messageSubset?.())}`,
|
|
259
268
|
head: {
|
|
260
269
|
bodyAttrs: renderedHead.bodyAttrs,
|
|
261
270
|
headTags: `${inertiaResult.head.join("")}${renderedHead.headTags}`,
|
|
@@ -6,6 +6,20 @@ const DMS_PAGE_IMPORT =
|
|
|
6
6
|
const ANY_INERTIA_PAGE_IMPORT =
|
|
7
7
|
/import\s*\{[^}]*\busePage\b[^}]*\}\s*from\s*["']@inertiajs\/vue3["']|import\s*\*\s*as\s+\w+\s+from\s*["']@inertiajs\/vue3["']/;
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* A Vite plugin that rewrites the source of Nuxt UI files.
|
|
11
|
+
*
|
|
12
|
+
* @typedef {{
|
|
13
|
+
* name: string,
|
|
14
|
+
* enforce: "pre",
|
|
15
|
+
* transform: (
|
|
16
|
+
* this: import("vite").Rollup.TransformPluginContext,
|
|
17
|
+
* code: string,
|
|
18
|
+
* id: string,
|
|
19
|
+
* ) => { code: string, map: null } | null,
|
|
20
|
+
* }} NuxtUiRewrite
|
|
21
|
+
*/
|
|
22
|
+
|
|
9
23
|
/**
|
|
10
24
|
* The rewrite, as a Vite plugin.
|
|
11
25
|
*
|
|
@@ -16,7 +30,8 @@ const ANY_INERTIA_PAGE_IMPORT =
|
|
|
16
30
|
* a form this rewrite does not know, rather than letting the leak come back
|
|
17
31
|
* unnoticed with a Nuxt UI release.
|
|
18
32
|
*
|
|
19
|
-
* @param
|
|
33
|
+
* @param {(id: string) => boolean} isNuxtUiFile whether a module is Nuxt UI's
|
|
34
|
+
* @returns {NuxtUiRewrite}
|
|
20
35
|
*/
|
|
21
36
|
export function uiInertiaPage(isNuxtUiFile) {
|
|
22
37
|
return {
|
package/templates/vue/ui-kbd.mjs
CHANGED
|
@@ -21,7 +21,8 @@ const ROUTED_EXPORT =
|
|
|
21
21
|
* changes the form rewritten here, rather than letting the mismatch come back
|
|
22
22
|
* unnoticed.
|
|
23
23
|
*
|
|
24
|
-
* @param
|
|
24
|
+
* @param {(id: string) => boolean} isNuxtUiFile whether a module is Nuxt UI's
|
|
25
|
+
* @returns {import("./ui-inertia-page.mjs").NuxtUiRewrite}
|
|
25
26
|
*/
|
|
26
27
|
export function uiKbd(isNuxtUiFile) {
|
|
27
28
|
return {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} IconsPluginContext
|
|
3
|
+
* @property {{ config: { consumer: string } }} environment
|
|
4
|
+
* @property {(message: string) => never} error
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Nuxt UI's plugin that installs the client icon bundle. */
|
|
8
|
+
const ICONS_PLUGIN = /\/@nuxt\/ui\/dist\/runtime\/vue\/plugins\/icons\.js$/;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The client build of Nuxt UI's icons plugin, as a Vite plugin.
|
|
12
|
+
*
|
|
13
|
+
* The plugin imports the bundle of every icon the sources name, which put it
|
|
14
|
+
* in the entry of every page, the sign-in page's included, for icons it draws
|
|
15
|
+
* from the server render's own copy. The client gets an empty plugin, and
|
|
16
|
+
* `loadIconBundle` (`icon-bundle.ts`) loads the bundle when the page needs it. The server render keeps the plugin as it is. The
|
|
17
|
+
* build fails if Nuxt UI changes the form rewritten here, rather than
|
|
18
|
+
* letting the bundle return to the entry unnoticed.
|
|
19
|
+
*
|
|
20
|
+
* @param {(id: string) => boolean} isNuxtUiFile whether a module is Nuxt UI's
|
|
21
|
+
* @returns {{ name: string, enforce: "pre", transform: (this: IconsPluginContext, code: string, id: string) => { code: string, map: null } | null }}
|
|
22
|
+
*/
|
|
23
|
+
export function uiLazyIcons(isNuxtUiFile) {
|
|
24
|
+
return {
|
|
25
|
+
name: "dms-ui-lazy-icons",
|
|
26
|
+
enforce: "pre",
|
|
27
|
+
transform(code, id) {
|
|
28
|
+
const path = id.replaceAll("\\", "/").split("?")[0];
|
|
29
|
+
if (
|
|
30
|
+
this.environment.config.consumer !== "client" ||
|
|
31
|
+
!isNuxtUiFile(id) ||
|
|
32
|
+
!ICONS_PLUGIN.test(path)
|
|
33
|
+
)
|
|
34
|
+
return null;
|
|
35
|
+
if (!code.includes("virtual:nuxt-ui-icons"))
|
|
36
|
+
this.error(
|
|
37
|
+
`${id} no longer installs the client icon bundle the way the DMS ` +
|
|
38
|
+
"defers it: the bundle would return to the entry. Update " +
|
|
39
|
+
"ui-lazy-icons.mjs for this Nuxt UI release.",
|
|
40
|
+
);
|
|
41
|
+
return { code: "export default { install() {} };", map: null };
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -21,7 +21,8 @@ const APPLICATION_STATE =
|
|
|
21
21
|
* UI file defines `useState`, rather than letting the leak come back unnoticed
|
|
22
22
|
* with a Nuxt UI release.
|
|
23
23
|
*
|
|
24
|
-
* @param
|
|
24
|
+
* @param {(id: string) => boolean} isNuxtUiFile whether a module is Nuxt UI's
|
|
25
|
+
* @returns {import("./ui-inertia-page.mjs").NuxtUiRewrite}
|
|
25
26
|
*/
|
|
26
27
|
export function uiRequestState(isNuxtUiFile) {
|
|
27
28
|
return {
|
|
@@ -14,6 +14,7 @@ import { recordEntryWeight } from "./entry-weight.mjs";
|
|
|
14
14
|
import { rejectServerSourcesInClient } from "./client-server-guard.mjs";
|
|
15
15
|
import { uiInertiaPage } from "./ui-inertia-page.mjs";
|
|
16
16
|
import { uiKbd } from "./ui-kbd.mjs";
|
|
17
|
+
import { uiLazyIcons } from "./ui-lazy-icons.mjs";
|
|
17
18
|
import { uiRequestState } from "./ui-request-state.mjs";
|
|
18
19
|
import { autoImportDirectories, vitePlugins } from "./frontend-build-loader.ts";
|
|
19
20
|
import { frontendBuilds } from "./frontend-builds.generated.ts";
|
|
@@ -184,6 +185,7 @@ export default defineConfig({
|
|
|
184
185
|
},
|
|
185
186
|
},
|
|
186
187
|
uiKbd(isNuxtUiFile),
|
|
188
|
+
uiLazyIcons(isNuxtUiFile),
|
|
187
189
|
uiInertiaPage(isNuxtUiFile),
|
|
188
190
|
uiRequestState(isNuxtUiFile),
|
|
189
191
|
vue({ script: { globalTypeFiles: [sfcGlobalTypesFile] } }),
|