@uniweb/build 0.18.0 → 0.18.2

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": "0.18.0",
3
+ "version": "0.18.2",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -59,15 +59,15 @@
59
59
  "js-yaml": "^4.1.0",
60
60
  "sharp": "^0.35.3",
61
61
  "yaml": "^2.5.0",
62
- "@uniweb/schemas": "0.2.10",
63
62
  "@uniweb/theming": "0.1.15",
64
63
  "@uniweb/content-writer": "0.3.3",
64
+ "@uniweb/schemas": "0.2.10",
65
65
  "@uniweb/projections": "0.2.5"
66
66
  },
67
67
  "optionalDependencies": {
68
68
  "@uniweb/content-reader": "1.2.2",
69
69
  "@uniweb/schemas": "0.2.10",
70
- "@uniweb/runtime": "0.11.0",
70
+ "@uniweb/runtime": "0.11.2",
71
71
  "@uniweb/semantic-parser": "1.2.1"
72
72
  },
73
73
  "peerDependencies": {
@@ -26,23 +26,14 @@
26
26
  import { resolve } from 'node:path'
27
27
  import { foundationPlugin } from '../vite-foundation-plugin.js'
28
28
  import { resolveFoundationSrcDir } from '../utils/foundation-source-root.js'
29
-
30
- /**
31
- * Default externals for foundations
32
- * These are not bundled into the foundation output
33
- */
34
- /**
35
- * Default externals for foundations
36
- * These are provided by the runtime and should not be bundled
37
- */
38
- const DEFAULT_EXTERNALS = [
39
- 'react',
40
- 'react-dom',
41
- 'react-dom/server',
42
- 'react/jsx-runtime',
43
- 'react/jsx-dev-runtime',
44
- '@uniweb/core'
45
- ]
29
+ // The ONE definition. This list used to be re-typed here, and again in
30
+ // vite-foundation-plugin.js — three hand-synced copies of "what a foundation
31
+ // externalizes", with nothing binding them. The failure mode of a drift is not
32
+ // a build error: it is the same bare specifier resolving to two React
33
+ // instances at runtime, which breaks hooks with no signal at build time.
34
+ // `import-map-plugin.js` imports nothing, so this is a leaf import with no
35
+ // cycle risk.
36
+ import { DEFAULT_EXTERNALS } from '../import-map-plugin.js'
46
37
 
47
38
  /**
48
39
  * Create a complete Vite configuration for a Uniweb foundation
@@ -14,6 +14,7 @@ import { buildSchema } from './schema.js'
14
14
  import { generateEntryPoint, shouldRegenerateForFile } from './generate-entry.js'
15
15
  import { processAllPreviews } from './images.js'
16
16
  import { generateFoundationVars } from './theme/index.js'
17
+ import { DEFAULT_EXTERNALS } from './import-map-plugin.js'
17
18
 
18
19
  /**
19
20
  * Build schema.json with preview image references
@@ -358,11 +359,12 @@ async function emitFoundationVarsCss(outDir, schema) {
358
359
  /**
359
360
  * Externals for the SSR bundle (`dist/entry-ssr.js`).
360
361
  *
361
- * Same set the browser foundation build externalizes (DEFAULT_EXTERNALS in
362
- * foundation/config.jsreact/react-dom/react-dom-server/jsx-runtime/core),
363
- * which the Cloudflare edge isolate resolves to the SHARED runtime's React/core
364
- * (worker-runtime.js) via its shims so React stays deduped and runtime patches
365
- * still propagate without a foundation rebuild.
362
+ * Same set the browser foundation build externalizes, and now literally the
363
+ * same array `DEFAULT_EXTERNALS`, imported rather than re-typed. The isolate
364
+ * resolves these to the SHARED runtime's React/core (worker-runtime.js) via its
365
+ * shims, so React stays deduped and runtime patches still propagate without a
366
+ * foundation rebuild. "Same set" was a comment three copies made a promise
367
+ * rather than a fact; deriving it makes drift unrepresentable.
366
368
  *
367
369
  * PLUS the client-only libraries kit code-splits via dynamic import:
368
370
  * - shiki / shiki/bundle/full — syntax highlighting (kit Code renderer)
@@ -372,14 +374,7 @@ async function emitFoundationVarsCss(outDir, schema) {
372
374
  * the SSR bundle and leaves them as DORMANT dynamic imports the isolate never
373
375
  * awaits — so no extra modules-map entry is needed for them edge-side.
374
376
  */
375
- const SSR_DEFAULT_EXTERNALS = [
376
- 'react',
377
- 'react-dom',
378
- 'react-dom/server',
379
- 'react/jsx-runtime',
380
- 'react/jsx-dev-runtime',
381
- '@uniweb/core',
382
- ]
377
+ const SSR_DEFAULT_EXTERNALS = DEFAULT_EXTERNALS
383
378
 
384
379
  function isSSRExternal(id) {
385
380
  if (SSR_DEFAULT_EXTERNALS.includes(id)) return true