@uniweb/build 1.10.10 → 1.10.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/build",
3
- "version": "1.10.10",
3
+ "version": "1.10.11",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -57,14 +57,14 @@
57
57
  "sharp": "^0.35.5",
58
58
  "yaml": "^2.5.0",
59
59
  "@uniweb/content-reader": "~1.5.7",
60
- "@uniweb/projections": "~1.2.5",
61
- "@uniweb/content-writer": "~1.3.1",
62
60
  "@uniweb/schemas": "~1.6.5",
61
+ "@uniweb/theming": "~1.2.1",
63
62
  "@uniweb/semantic-parser": "~1.13.0",
64
- "@uniweb/theming": "~1.2.1"
63
+ "@uniweb/content-writer": "~1.3.1",
64
+ "@uniweb/projections": "~1.2.6"
65
65
  },
66
66
  "optionalDependencies": {
67
- "@uniweb/runtime": "~1.2.8"
67
+ "@uniweb/runtime": "~1.2.11"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
@@ -73,8 +73,8 @@
73
73
  "@tailwindcss/vite": "^4.0.0",
74
74
  "@vitejs/plugin-react": "^4.0.0 || ^5.0.0",
75
75
  "vite-plugin-svgr": "^4.0.0",
76
- "@uniweb/core": "~1.4.10",
77
- "@uniweb/runtime": "~1.2.8"
76
+ "@uniweb/runtime": "~1.2.11",
77
+ "@uniweb/core": "~1.4.11"
78
78
  },
79
79
  "peerDependenciesMeta": {
80
80
  "vite": {
@@ -0,0 +1,37 @@
1
+ /**
2
+ * A package a foundation imports DYNAMICALLY stays a dynamic import in `dist/entry-ssr.js`.
3
+ *
4
+ * The SSR twin is one file (`inlineDynamicImports`), so every dynamic import is folded into it,
5
+ * and a module folded in runs when the file loads: the browser bundle's laziness is gone. For a
6
+ * client-only library imported where it is used — a map inside an effect, a highlighter on demand
7
+ * — its code then runs in the host's isolate at load, and one that touches `window` there stops
8
+ * the foundation loading at all. Leaflet does (`window.requestAnimationFrame`, `window.L`), and
9
+ * every page of a site using it was served as the bare shell, with no prerendered body or head.
10
+ *
11
+ * Kept as the import it is, such a package stays dormant, as kit's Shiki always has
12
+ * (`isSSRExternal`): server rendering never awaits it, and a host has nothing to supply for it.
13
+ *
14
+ * Only a package. The foundation's own modules (`./chart.js`, `#components/x`) are folded in as
15
+ * before, since a host that loads one file could not reach them otherwise.
16
+ */
17
+ export function ssrDormantDynamicImports() {
18
+ return {
19
+ name: 'uniweb:ssr-dormant-dynamic-imports',
20
+ resolveDynamicImport(specifier) {
21
+ return typeof specifier === 'string' && isPackageSpecifier(specifier) ? { id: specifier, external: true } : null
22
+ },
23
+ }
24
+ }
25
+
26
+ /**
27
+ * A bare package specifier — `leaflet`, `@scope/pkg/sub` — rather than a relative or absolute
28
+ * path, a package-internal `#` import, a virtual module, or anything with a scheme.
29
+ *
30
+ * @param {string} specifier
31
+ * @returns {boolean}
32
+ */
33
+ export function isPackageSpecifier(specifier) {
34
+ if (!specifier || /^[.#/\\\0]/.test(specifier)) return false
35
+ if (/^[a-z][a-z0-9+.-]*:/i.test(specifier)) return false
36
+ return true
37
+ }
@@ -19,6 +19,7 @@ import { deriveSupports } from './foundation/derive-supports.js'
19
19
  import { proseWithoutStyles, PROSE_WITHOUT_STYLES_WARNING } from './foundation/prose-styles.js'
20
20
  import { nodeEnvDefine } from './foundation/node-env.js'
21
21
  import { foundationScopeDefine } from './foundation/scope-define.js'
22
+ import { ssrDormantDynamicImports } from './foundation/ssr-dormant-imports.js'
22
23
  import { DEV_REBUILD_MARKER, hasDevRebuildMarker } from './foundation/dev-rebuild.js'
23
24
 
24
25
  // Foundations already told that their prose has no stylesheet — once per process, so a dev
@@ -282,7 +283,10 @@ async function emitFoundationVarsCss(outDir, schema) {
282
283
  * It hydrates in the browser and never runs during renderToString. Keeping it
283
284
  * external drops the ~10 MB Shiki language graph from the SSR bundle and leaves
284
285
  * it a DORMANT dynamic import that server rendering never awaits — so a host
285
- * has nothing to supply for it.
286
+ * has nothing to supply for it. Every other package a foundation imports
287
+ * dynamically gets the same treatment from `ssrDormantDynamicImports`
288
+ * (`foundation/ssr-dormant-imports.js`); Shiki keeps its own entry here, which
289
+ * also keeps a static import of it out.
286
290
  *
287
291
  * ⛔ `fuse.js` was listed here too, until the local search ranker became
288
292
  * `@uniweb/projections/search` (2026-09-06). Nothing imports fuse now, so the
@@ -350,7 +354,9 @@ async function buildEntrySSR(foundationRoot, entrySourcePath, outDir) {
350
354
  }
351
355
  const react = (await import('@vitejs/plugin-react')).default
352
356
  const svgr = (await import('vite-plugin-svgr')).default
353
- plugins.push(react(), svgr(), nodeEnvDefine(), foundationScopeDefine({ foundationDir: foundationRoot }))
357
+ // ssrDormantDynamicImports: a package imported dynamically stays `import('pkg')`, dormant,
358
+ // rather than folded in to run at load (see its module).
359
+ plugins.push(react(), svgr(), nodeEnvDefine(), foundationScopeDefine({ foundationDir: foundationRoot }), ssrDormantDynamicImports())
354
360
 
355
361
  await viteBuild({
356
362
  root: foundationRoot,