@antelopejs/dms-frontend 0.9.1 → 0.9.3

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.
Files changed (103) hide show
  1. package/README.md +9 -1
  2. package/dist/cancellation.js +2 -1
  3. package/dist/config.js +11 -7
  4. package/dist/derived-outputs.js +6 -113
  5. package/dist/dev-modules.js +3 -2
  6. package/dist/discovery.js +19 -12
  7. package/dist/fs-sync.js +1 -2
  8. package/dist/internal/guards.d.ts +5 -0
  9. package/dist/internal/guards.js +22 -0
  10. package/dist/internal/locale-catalogs.d.ts +6 -0
  11. package/dist/internal/locale-catalogs.js +115 -0
  12. package/dist/layer-aliases.js +2 -1
  13. package/dist/layers.js +2 -1
  14. package/dist/locale-files.js +9 -4
  15. package/dist/manifest-secrets.js +11 -4
  16. package/dist/manifest.js +11 -5
  17. package/dist/materialize.js +6 -5
  18. package/dist/module-set.js +2 -4
  19. package/dist/ports.js +8 -1
  20. package/dist/private-values.js +26 -17
  21. package/dist/project-modules.js +17 -11
  22. package/dist/renderer-range.js +2 -1
  23. package/dist/server-process.js +17 -16
  24. package/dist/update-check.js +23 -16
  25. package/dist/verify-source-runner.js +2 -2
  26. package/dist/workspace-setup.js +1 -2
  27. package/dist/workspace.js +11 -10
  28. package/package.json +7 -4
  29. package/skills/dms-frontend/SKILL.md +1 -1
  30. package/skills/dms-frontend/cases.json +77 -0
  31. package/templates/vue/app-runtime.ts +88 -7
  32. package/templates/vue/client-chunking.mjs +0 -5
  33. package/templates/vue/client-server-guard.mjs +10 -13
  34. package/templates/vue/entry-weight.mjs +12 -14
  35. package/templates/vue/frontend-module.ts +159 -3563
  36. package/templates/vue/frontend-runtime/async-data-entry.ts +320 -0
  37. package/templates/vue/frontend-runtime/async-data.ts +404 -0
  38. package/templates/vue/frontend-runtime/components.ts +386 -0
  39. package/templates/vue/frontend-runtime/cookies.ts +125 -0
  40. package/templates/vue/frontend-runtime/data-access.ts +132 -0
  41. package/templates/vue/frontend-runtime/dms-error.ts +11 -0
  42. package/templates/vue/frontend-runtime/errors.ts +145 -0
  43. package/templates/vue/frontend-runtime/fetch.ts +306 -0
  44. package/templates/vue/frontend-runtime/module-registration.ts +247 -0
  45. package/templates/vue/frontend-runtime/paged-data.ts +191 -0
  46. package/templates/vue/frontend-runtime/payload.ts +172 -0
  47. package/templates/vue/frontend-runtime/route.ts +328 -0
  48. package/templates/vue/frontend-runtime/sdk.ts +300 -0
  49. package/templates/vue/frontend-runtime/state.ts +167 -0
  50. package/templates/vue/frontend-runtime/types.ts +361 -0
  51. package/templates/vue/frontend-runtime/ui.ts +247 -0
  52. package/templates/vue/globals.d.ts +5 -0
  53. package/templates/vue/head-order.mjs +11 -13
  54. package/templates/vue/icon-bundle.ts +31 -0
  55. package/templates/vue/message-subset.ts +65 -0
  56. package/templates/vue/network-error.ts +4 -0
  57. package/templates/vue/prepare-types.mjs +0 -8
  58. package/templates/vue/server/auth/backend.mjs +4 -2
  59. package/templates/vue/server/auth/establish-endpoints.mjs +14 -9
  60. package/templates/vue/server/auth/session.mjs +4 -3
  61. package/templates/vue/server/auth-hooks.mjs +6 -6
  62. package/templates/vue/server/backend-proxies.mjs +6 -6
  63. package/templates/vue/server/backend-response.mjs +15 -14
  64. package/templates/vue/server/built-files.mjs +10 -8
  65. package/templates/vue/server/cli-report.mjs +7 -5
  66. package/templates/vue/server/client-error.mjs +11 -8
  67. package/templates/vue/server/client-manifest.mjs +9 -8
  68. package/templates/vue/server/content.mjs +2 -1
  69. package/templates/vue/server/dev-private-files.mjs +20 -15
  70. package/templates/vue/server/dev-styles.mjs +22 -25
  71. package/templates/vue/server/email-bundle-watch.mjs +0 -12
  72. package/templates/vue/server/email.mjs +20 -15
  73. package/templates/vue/server/favicon.mjs +12 -11
  74. package/templates/vue/server/homepage.mjs +8 -10
  75. package/templates/vue/server/icons.mjs +18 -9
  76. package/templates/vue/server/in-place-render.mjs +6 -8
  77. package/templates/vue/server/listen-host.mjs +2 -2
  78. package/templates/vue/server/module-event.mjs +5 -5
  79. package/templates/vue/server/module-routes.mjs +11 -7
  80. package/templates/vue/server/module-server.mjs +8 -7
  81. package/templates/vue/server/module-testing.mjs +7 -7
  82. package/templates/vue/server/page-props.mjs +14 -14
  83. package/templates/vue/server/path-patterns.mjs +4 -4
  84. package/templates/vue/server/proxy-compression.mjs +21 -13
  85. package/templates/vue/server/proxy-headers.mjs +5 -3
  86. package/templates/vue/server/proxy-redirects.mjs +7 -6
  87. package/templates/vue/server/proxy-transfers.mjs +15 -11
  88. package/templates/vue/server/public-endpoints.mjs +27 -19
  89. package/templates/vue/server/public-options.mjs +9 -7
  90. package/templates/vue/server/request-failure.mjs +4 -6
  91. package/templates/vue/server/request-routing.mjs +8 -11
  92. package/templates/vue/server/request-target.mjs +6 -6
  93. package/templates/vue/server/route-rules.mjs +7 -5
  94. package/templates/vue/server/static-files.mjs +19 -10
  95. package/templates/vue/server/web-body.mjs +3 -4
  96. package/templates/vue/server.mjs +32 -19
  97. package/templates/vue/sfc-global-types.mjs +27 -24
  98. package/templates/vue/ssr-renderer.ts +10 -1
  99. package/templates/vue/ui-inertia-page.mjs +7 -7
  100. package/templates/vue/ui-kbd.mjs +10 -10
  101. package/templates/vue/ui-lazy-icons.mjs +44 -0
  102. package/templates/vue/ui-request-state.mjs +9 -9
  103. package/templates/vue/vite.config.ts +2 -0
@@ -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
+ }
@@ -1,12 +1,3 @@
1
- // Nuxt UI's `useState` outside Nuxt keeps its state in one object for the
2
- // whole module: on a server, for the whole process. A toast one render adds
3
- // (`useToast()` keeps its list there) would then show in every later render,
4
- // whoever asks for the page, until the server restarts. Nuxt UI's stub keeps
5
- // its state in the DMS's per-application state instead, as Nuxt's own
6
- // `useState` does, and the build fails if the stub changes form or another
7
- // Nuxt UI file defines `useState`, rather than letting the leak come back
8
- // unnoticed with a Nuxt UI release.
9
-
10
1
  /** Nuxt UI's stub of Nuxt's composables, which defines `useState`. */
11
2
  const STUB = /\/@nuxt\/ui\/dist\/runtime\/vue\/stubs\/base\.js$/;
12
3
  /** `useState` as Nuxt UI 4 defines it: a module-wide record of refs. */
@@ -21,6 +12,15 @@ const APPLICATION_STATE =
21
12
  /**
22
13
  * The rewrite, as a Vite plugin.
23
14
  *
15
+ * Nuxt UI's `useState` outside Nuxt keeps its state in one object for the whole
16
+ * module: on a server, for the whole process. A toast one render adds
17
+ * (`useToast()` keeps its list there) would then show in every later render,
18
+ * whoever asks for the page, until the server restarts. Nuxt UI's stub keeps
19
+ * its state in the DMS's per-application state instead, as Nuxt's own
20
+ * `useState` does, and the build fails if the stub changes form or another Nuxt
21
+ * UI file defines `useState`, rather than letting the leak come back unnoticed
22
+ * with a Nuxt UI release.
23
+ *
24
24
  * @param isNuxtUiFile `(id) => boolean`, whether a module is Nuxt UI's
25
25
  */
26
26
  export function uiRequestState(isNuxtUiFile) {
@@ -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] } }),