@homepages/concrete 5.0.0 → 6.0.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.
Files changed (269) hide show
  1. package/CHANGELOG.md +336 -0
  2. package/README.md +28 -17
  3. package/codemods/fill-is-a-source.mjs +533 -0
  4. package/codemods/manifest.json +12 -0
  5. package/codemods/reads-replace-reconcile.mjs +285 -0
  6. package/dist/artifact/playground/client/assets/{index-D1fwOGVK.js → index-u3T7DiSN.js} +96 -96
  7. package/dist/artifact/playground/client/index.html +1 -1
  8. package/dist/artifact/playground/host.mjs +23 -23
  9. package/dist/base.css +3 -8
  10. package/dist/browser/site-config.js +1 -16
  11. package/dist/browser/submit-lead.js +0 -31
  12. package/dist/cli/build/artifact.js +16 -23
  13. package/dist/cli/build/captures.js +0 -6
  14. package/dist/cli/build/esbuild.js +0 -17
  15. package/dist/cli/build/fixtures.js +15 -30
  16. package/dist/cli/build/icons.js +0 -3
  17. package/dist/cli/build/index.js +1 -1
  18. package/dist/cli/build/playground.js +4 -8
  19. package/dist/cli/build/sections.js +9 -30
  20. package/dist/cli/build/source.js +52 -27
  21. package/dist/cli/build/static.js +4 -25
  22. package/dist/cli/capture/bundle.js +0 -9
  23. package/dist/cli/capture/capture-browser.js +0 -14
  24. package/dist/cli/capture/capture.js +1 -8
  25. package/dist/cli/check/analyze.js +2 -5
  26. package/dist/cli/check/index.js +1 -1
  27. package/dist/cli/check/line-endings.js +52 -0
  28. package/dist/cli/check/load-workspace.js +3 -8
  29. package/dist/cli/check/portable-names.js +48 -0
  30. package/dist/cli/check/render/class-conflicts.js +0 -5
  31. package/dist/cli/check/render/html.js +0 -1
  32. package/dist/cli/check/render/invariants.js +0 -5
  33. package/dist/cli/check/render/island-frames.js +0 -25
  34. package/dist/cli/check/render/marker-coverage.js +0 -20
  35. package/dist/cli/check/render/nav.js +0 -33
  36. package/dist/cli/check/report.js +0 -3
  37. package/dist/cli/check/stages/bundles.js +1 -9
  38. package/dist/cli/check/stages/composition.js +3 -2
  39. package/dist/cli/check/stages/dependencies.js +7 -38
  40. package/dist/cli/check/stages/fixtures.js +3 -31
  41. package/dist/cli/check/stages/lint.js +2 -2
  42. package/dist/cli/check/stages/logic.js +3 -34
  43. package/dist/cli/check/stages/relations.js +46 -0
  44. package/dist/cli/check/stages/render.js +0 -1
  45. package/dist/cli/check/stages/sections.js +3 -3
  46. package/dist/cli/check/stages/stylesheet.js +1 -1
  47. package/dist/cli/check/stages/typecheck.js +5 -11
  48. package/dist/cli/check/stages/workspace.js +36 -14
  49. package/dist/cli/commands.js +9 -56
  50. package/dist/cli/currency/cache.js +4 -17
  51. package/dist/cli/currency/decide.js +0 -14
  52. package/dist/cli/currency/opt-out.js +0 -7
  53. package/dist/cli/currency/preamble.js +3 -24
  54. package/dist/cli/currency/prompt.js +0 -1
  55. package/dist/cli/currency/refresh.js +5 -12
  56. package/dist/cli/currency/resolve-latest.js +3 -64
  57. package/dist/cli/currency/version-order.js +0 -12
  58. package/dist/cli/dev/crop.js +0 -2
  59. package/dist/cli/dev/http.js +0 -13
  60. package/dist/cli/dev/index.js +3 -4
  61. package/dist/cli/dev/islands.js +25 -70
  62. package/dist/cli/dev/listen.js +26 -0
  63. package/dist/cli/dev/load-template.js +0 -1
  64. package/dist/cli/dev/request-error.js +0 -4
  65. package/dist/cli/dev/server.js +46 -52
  66. package/dist/cli/dev/tsconfig-paths.js +0 -13
  67. package/dist/cli/dev/vite.js +9 -38
  68. package/dist/cli/dev/workspace-reader.js +4 -34
  69. package/dist/cli/media/cache.js +4 -51
  70. package/dist/cli/media/derive.js +2 -94
  71. package/dist/cli/media/deriver-plugin.js +0 -2
  72. package/dist/cli/media/frame-rung-floor.js +0 -6
  73. package/dist/cli/property/index.js +0 -4
  74. package/dist/cli/property/library.js +6 -24
  75. package/dist/cli/publish/client.js +0 -1
  76. package/dist/cli/publish/freshness.js +0 -2
  77. package/dist/cli/publish/git.js +2 -8
  78. package/dist/cli/publish/index.js +8 -15
  79. package/dist/cli/publish/pack.js +5 -6
  80. package/dist/cli/publish/report.js +0 -6
  81. package/dist/cli/publish/target.js +16 -13
  82. package/dist/cli/publish/wire.js +0 -6
  83. package/dist/cli/tar.js +2 -9
  84. package/dist/cli/upgrade/codemod.js +0 -8
  85. package/dist/cli/upgrade/index.js +0 -24
  86. package/dist/cli/upgrade/manifest.js +0 -12
  87. package/dist/cli/upgrade/plan.js +0 -17
  88. package/dist/cli/upgrade/stage.js +12 -15
  89. package/dist/cli/version.js +0 -8
  90. package/dist/cli/workspace.js +2 -34
  91. package/dist/cli.js +4 -21
  92. package/dist/css/compile.js +25 -28
  93. package/dist/css/graph.js +3 -10
  94. package/dist/css/inline.js +3 -13
  95. package/dist/css/rules.js +6 -43
  96. package/dist/design-system/format-variants.js +0 -22
  97. package/dist/eslint/authoring.js +0 -2
  98. package/dist/eslint/correctness.js +0 -7
  99. package/dist/eslint/rules/editor-reason.js +0 -11
  100. package/dist/eslint/rules/island-ids.js +0 -1
  101. package/dist/eslint/rules/jsx-visitor.js +0 -13
  102. package/dist/eslint/rules/no-editor-globals.js +0 -2
  103. package/dist/eslint/rules/no-raw-values.js +0 -1
  104. package/dist/fixtures/brand.js +0 -1
  105. package/dist/fixtures/bundle-rule.js +4 -9
  106. package/dist/fixtures/canonical.d.ts +20 -0
  107. package/dist/fixtures/image-dimensions.js +0 -1
  108. package/dist/fixtures/load.js +8 -17
  109. package/dist/fixtures/media-plugin.js +4 -31
  110. package/dist/fixtures/media.js +0 -21
  111. package/dist/fixtures/package-stylesheets.js +0 -6
  112. package/dist/fixtures/property.js +16 -15
  113. package/dist/fixtures/resolve.js +102 -29
  114. package/dist/fixtures/rows.js +12 -11
  115. package/dist/fixtures/synthesize-empties.js +0 -4
  116. package/dist/fixtures.d.ts +19 -4
  117. package/dist/fixtures.js +0 -18
  118. package/dist/index.d.ts +8 -9
  119. package/dist/index.js +2 -11
  120. package/dist/islands/client-module.js +0 -11
  121. package/dist/islands/marker.js +0 -33
  122. package/dist/node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/browser.js +0 -20
  123. package/dist/packages/external/concrete/package.js +1 -1
  124. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +21 -35
  125. package/dist/packages/internal/fill-bake/dist/compute-reads.js +4 -0
  126. package/dist/packages/internal/fill-bake/dist/derive-source.js +40 -0
  127. package/dist/packages/internal/fill-bake/dist/display.js +0 -1
  128. package/dist/packages/internal/fill-bake/dist/index.js +4 -4
  129. package/dist/packages/internal/fill-vocabulary/dist/origination.js +106 -0
  130. package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -49
  131. package/dist/packages/internal/format-geometry/dist/capture.js +10 -240
  132. package/dist/packages/internal/format-geometry/dist/geometry.js +0 -6
  133. package/dist/packages/internal/image-ladder/dist/crop.js +0 -12
  134. package/dist/packages/internal/image-ladder/dist/policy.js +0 -14
  135. package/dist/packages/internal/island-runtime/dist/capture-holds.js +0 -13
  136. package/dist/packages/internal/island-runtime/dist/contract.js +0 -34
  137. package/dist/packages/internal/island-runtime/dist/editor-instance-context.js +0 -1
  138. package/dist/packages/internal/island-runtime/dist/index.js +0 -34
  139. package/dist/packages/internal/island-runtime/dist/island-id-context.js +0 -1
  140. package/dist/packages/internal/island-runtime/dist/use-capture-ready.js +0 -15
  141. package/dist/packages/internal/island-runtime/dist/use-editor.js +0 -10
  142. package/dist/packages/internal/island-runtime/dist/use-island-id.js +0 -32
  143. package/dist/packages/internal/property-facts/dist/derive-facts-view.js +2 -17
  144. package/dist/packages/internal/property-facts/dist/index.js +1 -1
  145. package/dist/packages/internal/property-facts/dist/{property-facts-CSdkSuD7.js → property-facts-5pxZnlkh.js} +13 -2
  146. package/dist/packages/internal/section-contracts/dist/cap-contract.js +1 -18
  147. package/dist/packages/internal/section-contracts/dist/catalog.js +16 -8
  148. package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +12 -16
  149. package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +5 -11
  150. package/dist/packages/internal/section-contracts/dist/display-contract.js +2 -0
  151. package/dist/packages/internal/section-contracts/dist/display-evidence-contract.js +2 -8
  152. package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +13 -0
  153. package/dist/packages/internal/section-contracts/dist/index.js +2 -1
  154. package/dist/packages/internal/section-contracts/dist/interpolation-contract.js +16 -42
  155. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +24 -43
  156. package/dist/packages/internal/section-contracts/dist/name-title-contract.js +11 -18
  157. package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +10 -12
  158. package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +3 -13
  159. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +6 -18
  160. package/dist/packages/internal/section-contracts/dist/runners.js +21 -13
  161. package/dist/packages/internal/section-contracts/dist/source-contract.js +13 -2
  162. package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +31 -0
  163. package/dist/packages/internal/source-resolution/dist/index.js +1 -9
  164. package/dist/packages/internal/template-artifact/dist/hash.js +0 -8
  165. package/dist/packages/internal/template-artifact/dist/index.js +1 -1
  166. package/dist/packages/internal/template-artifact/dist/layout.js +0 -39
  167. package/dist/packages/internal/template-artifact/dist/manifest.js +1 -9
  168. package/dist/packages/internal/template-artifact/dist/sha256.js +0 -1
  169. package/dist/packages/internal/template-artifact/dist/verify.js +2 -4
  170. package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -16
  171. package/dist/packages/internal/template-contracts/dist/content-categories.js +0 -4
  172. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +16 -10
  173. package/dist/packages/internal/template-contracts/dist/facts-view.js +15 -28
  174. package/dist/packages/internal/template-contracts/dist/layout.js +0 -7
  175. package/dist/packages/internal/template-contracts/dist/markers.js +0 -29
  176. package/dist/packages/internal/template-contracts/dist/select-key.js +0 -6
  177. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +56 -34
  178. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +22 -389
  179. package/dist/platform/file-url.js +8 -0
  180. package/dist/platform/fs.js +73 -0
  181. package/dist/platform/names.js +63 -0
  182. package/dist/platform/order.js +7 -0
  183. package/dist/platform/paths.js +62 -0
  184. package/dist/platform/process.js +97 -0
  185. package/dist/playground/host/page-state.js +0 -2
  186. package/dist/playground/host/paths.js +0 -1
  187. package/dist/playground/layout.js +0 -7
  188. package/dist/playground/wire.js +0 -8
  189. package/dist/primitives/FrameShell.js +0 -18
  190. package/dist/primitives/Image.d.ts +5 -1
  191. package/dist/primitives/Image.js +2 -68
  192. package/dist/primitives/Section.js +0 -13
  193. package/dist/primitives/Tour.js +0 -26
  194. package/dist/primitives/Video.js +0 -32
  195. package/dist/primitives/embed-playback.js +0 -1
  196. package/dist/primitives/marker-attrs.js +0 -17
  197. package/dist/primitives/picture-sources.js +6 -1
  198. package/dist/primitives/probe-context.js +0 -7
  199. package/dist/primitives/slot-bindings.js +0 -46
  200. package/dist/primitives/slot-document.js +0 -11
  201. package/dist/primitives/slot-group.js +0 -9
  202. package/dist/primitives/slot-media.js +0 -27
  203. package/dist/primitives/slot-scalar.js +0 -4
  204. package/dist/primitives/slot.js +0 -6
  205. package/dist/rules/registry.js +42 -24
  206. package/dist/schema/compute.d.ts +46 -8
  207. package/dist/schema/compute.js +21 -15
  208. package/dist/schema/define-schema.d.ts +1 -1
  209. package/dist/schema/define-schema.js +37 -17
  210. package/dist/schema/extract-fill-spec.js +93 -180
  211. package/dist/schema/extract-used-facts.js +16 -158
  212. package/dist/schema/fact.d.ts +25 -12
  213. package/dist/schema/fact.js +7 -11
  214. package/dist/schema/fill-builders.d.ts +91 -366
  215. package/dist/schema/fill-builders.js +21 -259
  216. package/dist/schema/fill-declaration.d.ts +7 -69
  217. package/dist/schema/fill-declaration.js +5 -34
  218. package/dist/schema/fill-spec.js +59 -148
  219. package/dist/schema/format-presets.js +0 -12
  220. package/dist/schema/format.js +0 -7
  221. package/dist/schema/layout.js +0 -10
  222. package/dist/schema/manifest.js +0 -39
  223. package/dist/schema/property-facts.d.ts +20 -0
  224. package/dist/schema/section-nav.js +0 -15
  225. package/dist/schema/section-schema.d.ts +0 -1
  226. package/dist/schema/section-schema.js +4 -20
  227. package/dist/schema/slot-builders.d.ts +128 -117
  228. package/dist/schema/slot-builders.js +18 -201
  229. package/dist/schema/slot-ref.d.ts +63 -0
  230. package/dist/schema/slot-ref.js +33 -0
  231. package/dist/schema/slot-types.d.ts +3 -2
  232. package/dist/schema/slot-types.js +11 -20
  233. package/dist/section/declare.d.ts +14 -10
  234. package/dist/section/declare.js +13 -2
  235. package/dist/section/discovery.js +6 -21
  236. package/dist/section/groups.js +0 -6
  237. package/dist/section/materialize.js +0 -5
  238. package/dist/section/placements.js +0 -4
  239. package/dist/section/section.d.ts +8 -5
  240. package/dist/section/section.js +7 -29
  241. package/dist/styles.css +5 -0
  242. package/dist/template/define-template.d.ts +0 -4
  243. package/dist/template/define-template.js +1 -15
  244. package/dist/template/logic-build.js +8 -35
  245. package/dist/template/logic-shim.d.ts +4 -5
  246. package/dist/template/logic-shim.js +2 -6
  247. package/dist/template/logic-transform.js +0 -6
  248. package/dist/template/materialize.js +52 -43
  249. package/dist/template/mirror-types.js +43 -0
  250. package/dist/template/running-copy.js +5 -20
  251. package/dist/template/section-reads.js +83 -0
  252. package/guide/reference/cli/INDEX.md +12 -6
  253. package/guide/reference/cli/build.md +1 -1
  254. package/guide/reference/cli/check.md +1 -1
  255. package/guide/reference/cli/dev.md +3 -3
  256. package/guide/reference/cli/property-add.md +1 -1
  257. package/guide/reference/cli/property-list.md +1 -1
  258. package/guide/reference/cli/publish.md +4 -2
  259. package/guide/reference/cli/upgrade.md +1 -1
  260. package/guide/reference/rules/INDEX.md +26 -13
  261. package/package.json +4 -2
  262. package/dist/packages/internal/fact-interpolation/dist/index.js +0 -22
  263. package/dist/packages/internal/fill-bake/dist/reconcile-cross-section.js +0 -170
  264. package/dist/packages/internal/fill-vocabulary/dist/facts.d.ts +0 -32
  265. package/dist/packages/internal/fill-vocabulary/dist/facts.js +0 -131
  266. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +0 -11
  267. package/dist/schema/fill-spec.d.ts +0 -18
  268. package/dist/template/reconcile.d.ts +0 -67
  269. package/dist/template/reconcile.js +0 -25
@@ -1,22 +1,21 @@
1
+ import { onShutdown } from "../../platform/process.js";
1
2
  import { findCommand, flagDefault, parseSpec, stringFlag } from "../commands.js";
3
+ import { findWorkspaceRoot } from "../workspace.js";
2
4
  import { TEMPLATE_FILE } from "./workspace-reader.js";
3
5
  import { startDevServer } from "./server.js";
4
- import { findWorkspaceRoot } from "../workspace.js";
5
6
  import { existsSync } from "node:fs";
6
7
  import { join } from "node:path";
7
8
  import { parseArgs } from "node:util";
8
9
 
9
10
  //#region src/cli/dev/index.ts
10
11
  const DEFAULT_PORT = Number(flagDefault(findCommand("dev"), "port"));
11
- /** The port a `--port` value names: a positive integer, else the default. */
12
12
  function parsePort(raw) {
13
13
  if (raw === null) return DEFAULT_PORT;
14
14
  const port = Number(raw);
15
15
  return Number.isInteger(port) && port > 0 ? port : DEFAULT_PORT;
16
16
  }
17
17
  const processSignals = () => new Promise((resolveStop) => {
18
- process.once("SIGINT", () => resolveStop());
19
- process.once("SIGTERM", () => resolveStop());
18
+ onShutdown(resolveStop);
20
19
  });
21
20
  function createDevRunner(deps) {
22
21
  return async (argv, io) => {
@@ -1,9 +1,10 @@
1
1
  import { CAPTURE_ISLANDS_READY_GLOBAL } from "../../packages/internal/format-geometry/dist/capture.js";
2
2
  import "../../packages/internal/format-geometry/dist/index.js";
3
3
  import { hasClientDirective } from "../../islands/client-module.js";
4
- import { readFileSync, readdirSync } from "node:fs";
5
- import { basename, dirname, extname, join, relative, sep } from "node:path";
6
- import { fileURLToPath } from "node:url";
4
+ import { isWorkspaceFile, packageFile, toPosix } from "../../platform/paths.js";
5
+ import { listDirSync } from "../../platform/fs.js";
6
+ import { readFileSync } from "node:fs";
7
+ import nodePath, { dirname, extname, join, relative } from "node:path";
7
8
  import { mkdir, readFile, writeFile } from "node:fs/promises";
8
9
  import { createHash } from "node:crypto";
9
10
 
@@ -14,12 +15,7 @@ const SKIPPED_DIRS = /* @__PURE__ */ new Set([
14
15
  "dist",
15
16
  ".concrete"
16
17
  ]);
17
- /** Forward slashes: Vite module ids use them on every platform, `node:path` does not. */
18
- function toPosixPath(path) {
19
- return sep === "\\" ? path.replaceAll("\\", "/") : path;
20
- }
21
18
  const SERVER_FRAME = /^[ \t]*export[ \t]+const[ \t]+serverFrame[ \t]*(?::[^=]*)?=[ \t]*(.*)$/m;
22
- /** Whether a client module declares the literal `serverFrame = false`: no server-rendered first frame. */
23
19
  function declaresNoServerFrame(text) {
24
20
  const declaration = SERVER_FRAME.exec(text);
25
21
  if (!declaration) return false;
@@ -30,29 +26,29 @@ function declaresNoServerFrame(text) {
30
26
  if (rest !== "" && !/^(?:satisfies|as)\b/.test(rest)) return false;
31
27
  return literal[1] === "false";
32
28
  }
33
- /**
34
- * The island key of a module: its workspace path without the extension, split at the
35
- * last segment — `sections/hero/Counter.tsx` → `sections/hero:Counter`.
36
- */
37
- function islandKeyFor(root, file) {
38
- const rel = toPosixPath(relative(root, file));
39
- const dir = dirname(rel);
40
- const stem = basename(rel, extname(rel));
41
- return `${dir === "." ? "" : dir}:${stem}`;
29
+ function islandKeyFor(root, file, paths = nodePath) {
30
+ const rel = toPosix(paths.relative(root, file), paths);
31
+ const slash = rel.lastIndexOf("/");
32
+ const name = rel.slice(slash + 1);
33
+ const dot = name.lastIndexOf(".");
34
+ return `${rel.slice(0, Math.max(slash, 0))}:${dot > 0 ? name.slice(0, dot) : name}`;
35
+ }
36
+ function workspaceComponentFile(root, id, paths = nodePath) {
37
+ const file = id.split("?")[0] ?? id;
38
+ return COMPONENT_EXTS.has(paths.extname(file)) && isWorkspaceFile(root, file, paths) ? file : null;
42
39
  }
43
- /** Every island module in the workspace, sorted: a `.tsx`/`.jsx` file whose prologue says `"use client"`. */
44
40
  function findWorkspaceIslands(root) {
45
41
  const out = [];
46
42
  const walk = (dir, depth) => {
47
43
  let entries;
48
44
  try {
49
- entries = readdirSync(dir, { withFileTypes: true });
45
+ entries = listDirSync(dir);
50
46
  } catch {
51
47
  return;
52
48
  }
53
- for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
49
+ for (const entry of entries) {
54
50
  if (entry.name.startsWith(".")) continue;
55
- const path = join(dir, entry.name);
51
+ const path = entry.path;
56
52
  if (entry.isDirectory()) {
57
53
  if (SKIPPED_DIRS.has(entry.name) || depth === 0 && entry.name === "fixtures") continue;
58
54
  walk(path, depth + 1);
@@ -70,10 +66,9 @@ function findWorkspaceIslands(root) {
70
66
  walk(root, 0);
71
67
  return out;
72
68
  }
73
- /** island key → the root-relative URL Vite serves the module at. */
74
69
  function islandMapOf(root, files) {
75
70
  const map = {};
76
- for (const file of files) map[islandKeyFor(root, file)] = `/${toPosixPath(relative(root, file))}`;
71
+ for (const file of files) map[islandKeyFor(root, file)] = `/${toPosix(relative(root, file))}`;
77
72
  return map;
78
73
  }
79
74
  function markerModule(islandKey, markerSpecifier, children) {
@@ -91,38 +86,21 @@ export default function __trIslandWrapper(__trProps) {
91
86
  `;
92
87
  }
93
88
  const DEFAULT_EXPORT = /export\s+default\s+/;
94
- /**
95
- * A client module rewritten so its default export renders through the island marker. The
96
- * original is rebound to `__trIslandReal` and re-exported under that name: a top-level
97
- * marker must hydrate the RAW component (the marker's children are its own output),
98
- * while a nested usage must render the wrapper so its marker is emitted, and one shared
99
- * Vite module graph serves both. `null` for a non-client module or one with no default.
100
- */
101
89
  function wrapClientModule(code, islandKey, markerSpecifier) {
102
90
  if (!hasClientDirective(code) || !DEFAULT_EXPORT.test(code)) return null;
103
91
  return code.replace(DEFAULT_EXPORT, "const __trIslandReal = ") + markerModule(islandKey, markerSpecifier, "\n __trCreateElement(__trIslandReal, __trProps),") + "export { __trIslandReal };\n";
104
92
  }
105
- /** The marker-only module the SERVER graph gets for an island declaring `serverFrame = false`. */
106
93
  function stubClientModule(code, islandKey, markerSpecifier) {
107
94
  if (!hasClientDirective(code) || !DEFAULT_EXPORT.test(code) || !declaresNoServerFrame(code)) return null;
108
95
  return markerModule(islandKey, markerSpecifier, "");
109
96
  }
110
- /**
111
- * The Vite transform that makes an island of every workspace client module, in both
112
- * graphs. The browser graph needs the wrap too: a NESTED island is marked in the server
113
- * HTML, so its parent's client render must emit that marker, or React discards the
114
- * parent's server tree. The server graph alone stubs an island with no server frame.
115
- *
116
- * It must run before the React plugin, which consumes the directive otherwise.
117
- */
118
97
  function islandTransformPlugin(options) {
119
- const inside = options.root.endsWith(sep) ? options.root : options.root + sep;
120
98
  return {
121
99
  name: "concrete-dev:islands",
122
100
  enforce: "pre",
123
101
  transform(code, id, transformOptions) {
124
- const file = id.split("?")[0] ?? id;
125
- if (!COMPONENT_EXTS.has(extname(file)) || !file.startsWith(inside) || file.includes(`${sep}node_modules${sep}`)) return null;
102
+ const file = workspaceComponentFile(options.root, id);
103
+ if (file === null) return null;
126
104
  const key = islandKeyFor(options.root, file);
127
105
  if (transformOptions?.ssr === true) {
128
106
  const stub = stubClientModule(code, key, options.markerSpecifier);
@@ -139,18 +117,12 @@ function islandTransformPlugin(options) {
139
117
  }
140
118
  };
141
119
  }
142
- /**
143
- * The same transform for the server graph `concrete dev` renders from, which esbuild
144
- * bundles (./load-template.ts): a workspace client module is stubbed when it declares no
145
- * server frame and wrapped otherwise, exactly as the browser graph's Vite plugin does.
146
- */
147
120
  function islandEsbuildPlugin(options) {
148
- const inside = options.root.endsWith(sep) ? options.root : options.root + sep;
149
121
  return {
150
122
  name: "concrete-dev:islands",
151
123
  setup(build) {
152
124
  build.onLoad({ filter: /\.[jt]sx$/ }, async (args) => {
153
- if (!args.path.startsWith(inside) || args.path.includes(`${sep}node_modules${sep}`)) return void 0;
125
+ if (workspaceComponentFile(options.root, args.path) === null) return void 0;
154
126
  const code = await readFile(args.path, "utf8");
155
127
  const key = islandKeyFor(options.root, args.path);
156
128
  const contents = stubClientModule(code, key, options.markerSpecifier) ?? wrapClientModule(code, key, options.markerSpecifier);
@@ -164,21 +136,15 @@ function islandEsbuildPlugin(options) {
164
136
  }
165
137
  };
166
138
  }
167
- /**
168
- * The island runtime module the host scripts import, by absolute path: the built entry
169
- * beside this module in dist, or the source module when running from source.
170
- */
171
139
  function islandRuntimeFile() {
172
- const here = fileURLToPath(import.meta.url);
173
- return extname(here) === ".ts" ? join(dirname(here), "island-runtime.ts") : join(dirname(here), "..", "..", "playground-island-runtime.js");
140
+ return packageFile("cli/dev/island-runtime.ts", "playground-island-runtime.js");
174
141
  }
175
- /** The `/@fs/` URL Vite serves an absolute file at. */
176
142
  function fsUrl(file) {
177
- return `/@fs/${toPosixPath(file).replace(/^\/+/, "")}`;
143
+ return `/@fs/${toPosix(file).replace(/^\/+/, "")}`;
178
144
  }
179
145
  function importers(root, files) {
180
146
  return `const modules = {\n${files.map((file) => {
181
- const url = `/${toPosixPath(relative(root, file))}`;
147
+ const url = `/${toPosix(relative(root, file))}`;
182
148
  return ` ${JSON.stringify(url)}: () => import(${JSON.stringify(url)}),`;
183
149
  }).join("\n")}\n};`;
184
150
  }
@@ -227,12 +193,6 @@ window.${CAPTURE_ISLANDS_READY_GLOBAL} = ready;
227
193
  ready.catch(() => {});
228
194
  `;
229
195
  }
230
- /**
231
- * The canvas island host, over whatever reaches the island modules: `concrete dev`'s Vite
232
- * importers, or a published build's hashed bundles (`bundledCanvasHostSource`). One body,
233
- * so the gate, the shields and the commit signal a hosted canvas runs are the ones a
234
- * developer saw in `dev`.
235
- */
236
196
  function canvasHostCore(runtimeSpecifier, modules) {
237
197
  return `${modules.head}
238
198
  import { hydrateIslands, unmountIslands } from ${JSON.stringify(runtimeSpecifier)};
@@ -365,11 +325,6 @@ function importIsland(key) {
365
325
  label: "concrete dev"
366
326
  });
367
327
  }
368
- /**
369
- * Write both host scripts under the workspace's `.concrete/dev/` and return the URLs Vite
370
- * serves them at. Each URL carries a hash of its contents, so a changed island set is a
371
- * new module to Vite rather than a cached one.
372
- */
373
328
  async function writeIslandHostScripts(root, files) {
374
329
  const dir = join(root, ".concrete", "dev");
375
330
  await mkdir(dir, { recursive: true });
@@ -387,4 +342,4 @@ async function writeIslandHostScripts(root, files) {
387
342
  }
388
343
 
389
344
  //#endregion
390
- export { declaresNoServerFrame, findWorkspaceIslands, fsUrl, hasClientDirective, islandEsbuildPlugin, islandKeyFor, islandMapOf, islandRuntimeFile, islandTransformPlugin, stubClientModule, toPosixPath, wrapClientModule, writeIslandHostScripts };
345
+ export { declaresNoServerFrame, findWorkspaceIslands, fsUrl, hasClientDirective, islandEsbuildPlugin, islandKeyFor, islandMapOf, islandRuntimeFile, islandTransformPlugin, stubClientModule, workspaceComponentFile, wrapClientModule, writeIslandHostScripts };
@@ -0,0 +1,26 @@
1
+ //#region src/cli/dev/listen.ts
2
+ const HMR_PORT_OFFSET = 100;
3
+ const MAX_PORT = 65535;
4
+ const MAX_DEV_PORT = MAX_PORT - 100;
5
+ function hmrPortFor(port) {
6
+ if (port > 65435) throw new Error(`port ${String(port)} leaves no room for the editor's module-reload socket at port + ${String(100)} — pick one no higher than ${String(MAX_DEV_PORT)} with --port <n>`);
7
+ return port + 100;
8
+ }
9
+ function listenRefusal(err, what) {
10
+ if (err.code === "EADDRINUSE") return /* @__PURE__ */ new Error(`${what} is already in use — pick another with --port <n>`);
11
+ if (err.code === "EACCES") return /* @__PURE__ */ new Error(`${what} is reserved or not permitted on this machine — pick another with --port <n>`);
12
+ return err;
13
+ }
14
+ function listenOn(server, port, what) {
15
+ return new Promise((resolveListen, reject) => {
16
+ const refuse = (err) => reject(listenRefusal(err, what));
17
+ server.once("error", refuse);
18
+ server.listen(port, () => {
19
+ server.off("error", refuse);
20
+ resolveListen();
21
+ });
22
+ });
23
+ }
24
+
25
+ //#endregion
26
+ export { MAX_DEV_PORT, hmrPortFor, listenOn, listenRefusal };
@@ -7,7 +7,6 @@ import { build } from "esbuild";
7
7
 
8
8
  //#region src/cli/dev/load-template.ts
9
9
  let serial = 0;
10
- /** Bundle `<root>/template.ts` into the workspace's `.concrete/` cache and import the output. */
11
10
  async function loadTemplateModule(options) {
12
11
  const { root } = options;
13
12
  const media = createFixtureMediaPlugin(root);
@@ -1,8 +1,4 @@
1
1
  //#region src/cli/dev/request-error.ts
2
- /**
3
- * Answer a rejected request handler. Safe to call at any point in a response's
4
- * life: it never writes headers twice, and it never throws.
5
- */
6
2
  function respondToHandlerError(err, req, res, fixStacktrace) {
7
3
  const error = err instanceof Error ? err : new Error(String(err));
8
4
  fixStacktrace?.(error);
@@ -1,5 +1,6 @@
1
+ import { RUNNING_FROM_SOURCE, isInsideRoot, packageFile, packageRoot, toPosix } from "../../platform/paths.js";
1
2
  import { ASSET_PUBLIC_PATH } from "../../css/inline.js";
2
- import { findWorkspaceIslands, islandMapOf, writeIslandHostScripts } from "./islands.js";
3
+ import { findWorkspaceIslands, fsUrl, islandMapOf, writeIslandHostScripts } from "./islands.js";
3
4
  import { FIXTURE_MEDIA_PATH } from "../../fixtures/media-plugin.js";
4
5
  import { HMR_EVENTS, ROUTES } from "../../playground/wire.js";
5
6
  import { STYLESHEET_PATHS } from "../../playground/host/paths.js";
@@ -10,46 +11,28 @@ import { croppedMediaUrl, cutRegion } from "./crop.js";
10
11
  import { createHmrBus } from "./hmr.js";
11
12
  import { RequestError, contentTypeFor, readBody, sendBytes, sendFile, sendHtml, sendText } from "./http.js";
12
13
  import { respondToHandlerError } from "./request-error.js";
14
+ import { hmrPortFor, listenOn } from "./listen.js";
13
15
  import { createDevVite, settleBrowserDependencies } from "./vite.js";
14
16
  import { DevWorkspace } from "./workspace-reader.js";
15
17
  import { existsSync, statSync } from "node:fs";
16
- import { dirname, extname, join, relative, resolve, sep } from "node:path";
17
- import { fileURLToPath, pathToFileURL } from "node:url";
18
+ import { extname, join, relative, resolve } from "node:path";
19
+ import { pathToFileURL } from "node:url";
18
20
  import { readFile } from "node:fs/promises";
19
21
  import { createServer } from "node:http";
20
22
 
21
23
  //#region src/cli/dev/server.ts
22
- /** The host module bounds a render request at the same size. */
23
24
  const MAX_BODY_BYTES = 1024 * 1024;
24
- /** How many cut crops the server keeps in memory: a session draws a handful, and a re-render asks for the same ones again. */
25
25
  const MAX_CACHED_CROPS = 64;
26
- /** The canvas kernel rewrites a stylesheet asset's `/section-assets/` URL to this mount under the frame's base. */
27
26
  const CANVAS_SECTION_ASSET_PATH = "/runtime/section-asset";
28
- /** The package root: the nearest ancestor of this module with a package.json. */
29
- function findPackageRoot(fromFile) {
30
- let dir = dirname(fromFile);
31
- for (;;) {
32
- if (existsSync(join(dir, "package.json"))) return dir;
33
- const parent = dirname(dir);
34
- if (parent === dir) throw new Error("concrete dev: could not locate the package root");
35
- dir = parent;
36
- }
37
- }
38
- const THIS_FILE = fileURLToPath(import.meta.url);
39
- /** Running from source (a test, a checkout) rather than the built package. */
40
- const FROM_SOURCE = extname(THIS_FILE) === ".ts";
41
- /** The client shell with the base stamped: every route the client builds resolves against it. */
42
27
  function stampBase(html, base) {
43
28
  const tag = `<base href="${base}">`;
44
29
  return /<head[^>]*>/i.test(html) ? html.replace(/<head[^>]*>/i, (head) => `${head}\n ${tag}`) : `${tag}${html}`;
45
30
  }
46
- /** The canvas routes the client's shell answers: the base itself and `fixtures/<fixture>/canvas[/<canvas-id>]`. */
47
31
  function isCanvasPath(path) {
48
32
  if (path === "/") return true;
49
33
  const [head, fixture, view, ...rest] = path.split("/").filter(Boolean);
50
34
  return head === "fixtures" && fixture !== void 0 && view === "canvas" && rest.length <= 1;
51
35
  }
52
- /** The host module an artifact carries, as the package built it. */
53
36
  async function loadHostModule(packageRoot) {
54
37
  const file = playgroundHostFile(packageRoot);
55
38
  if (!existsSync(file)) throw new Error(`the playground host module is not built (${file}) — run the package's build.`);
@@ -59,23 +42,36 @@ async function loadHostModule(packageRoot) {
59
42
  }
60
43
  async function startDevServer(options) {
61
44
  const { root, port, log } = options;
62
- const packageRoot = findPackageRoot(THIS_FILE);
63
- const clientDir = playgroundClientOutDir(packageRoot);
45
+ const hmrPort = hmrPortFor(port);
46
+ const packageRoot$1 = packageRoot();
47
+ const clientDir = playgroundClientOutDir(packageRoot$1);
64
48
  if (!existsSync(join(clientDir, "index.html"))) log.write(`concrete dev: the playground client is not built (${clientDir}) — run the package's build.\n`);
65
- const createHost = await loadHostModule(packageRoot);
66
- const sourceMarker = join(packageRoot, "src", "islands", "marker.tsx");
67
- const browserMarker = FROM_SOURCE ? `/@fs/${sourceMarker.replace(/^\/+/, "")}` : "@homepages/concrete";
68
- const serverMarker = FROM_SOURCE ? sourceMarker : "@homepages/concrete";
69
- const islandEntries = findWorkspaceIslands(root).map((file) => relative(root, file));
49
+ const createHost = await loadHostModule(packageRoot$1);
50
+ const sourceMarker = join(packageRoot$1, "src", "islands", "marker.tsx");
51
+ const browserMarker = RUNNING_FROM_SOURCE ? fsUrl(sourceMarker) : "@homepages/concrete";
52
+ const serverMarker = RUNNING_FROM_SOURCE ? sourceMarker : "@homepages/concrete";
53
+ const islandEntries = findWorkspaceIslands(root).map((file) => toPosix(relative(root, file)));
70
54
  const browserAssets = /* @__PURE__ */ new Map();
71
- const vite = await createDevVite({
72
- root,
73
- packageRoot,
74
- markerSpecifier: browserMarker,
75
- hmrPort: port + 100,
76
- islandEntries,
77
- assets: browserAssets
55
+ const hmrServer = createServer((_req, res) => {
56
+ res.writeHead(426).end("Upgrade Required");
78
57
  });
58
+ await listenOn(hmrServer, hmrPort, `port ${String(hmrPort)} (the editor's module-reload socket, --port + ${String(100)})`);
59
+ const closeHmrServer = () => new Promise((done) => hmrServer.close(() => done()));
60
+ let vite;
61
+ try {
62
+ vite = await createDevVite({
63
+ root,
64
+ packageRoot: packageRoot$1,
65
+ markerSpecifier: browserMarker,
66
+ hmrServer,
67
+ hmrPort,
68
+ islandEntries,
69
+ assets: browserAssets
70
+ });
71
+ } catch (err) {
72
+ await closeHmrServer();
73
+ throw err;
74
+ }
79
75
  let islands = {
80
76
  map: {},
81
77
  canvasHost: null,
@@ -102,7 +98,7 @@ async function startDevServer(options) {
102
98
  await refreshIslands();
103
99
  const capturer = options.capturer ?? createCapturer({
104
100
  root,
105
- packageRoot
101
+ packageRoot: packageRoot$1
106
102
  });
107
103
  const origin = `http://localhost:${port}/`;
108
104
  let browserGraphSettled = null;
@@ -137,16 +133,16 @@ async function startDevServer(options) {
137
133
  host,
138
134
  hmr,
139
135
  clientDir,
140
- baseCss: join(packageRoot, FROM_SOURCE ? join("src", "css", "base.css") : join("dist", "base.css")),
136
+ baseCss: packageFile("css/base.css", "base.css"),
141
137
  log,
142
138
  browserAssets,
143
139
  crops: /* @__PURE__ */ new Map()
144
140
  };
145
- const fixturesDir = join(root, "fixtures") + sep;
141
+ const fixturesDir = join(root, "fixtures");
146
142
  const onChange = (path) => {
147
143
  vite.moduleGraph.invalidateAll();
148
144
  browserGraphSettled = null;
149
- if (path.startsWith(fixturesDir)) {
145
+ if (isInsideRoot(fixturesDir, path)) {
150
146
  workspace.invalidateFixtures();
151
147
  hmr.broadcast(HMR_EVENTS.fixtures);
152
148
  return;
@@ -174,14 +170,13 @@ async function startDevServer(options) {
174
170
  respondToHandlerError(err, req, res, (error) => vite.ssrFixStacktrace(error));
175
171
  });
176
172
  });
177
- await new Promise((resolveListen, reject) => {
178
- server.once("error", (err) => {
179
- vite.close().finally(() => {
180
- reject(err.code === "EADDRINUSE" ? /* @__PURE__ */ new Error(`port ${String(port)} is already in use — pick another with --port <n>`) : err);
181
- });
182
- });
183
- server.listen(port, resolveListen);
184
- });
173
+ try {
174
+ await listenOn(server, port, `port ${String(port)}`);
175
+ } catch (err) {
176
+ await vite.close();
177
+ await closeHmrServer();
178
+ throw err;
179
+ }
185
180
  return {
186
181
  url: origin,
187
182
  port,
@@ -191,10 +186,10 @@ async function startDevServer(options) {
191
186
  await new Promise((done) => server.close(() => done()));
192
187
  await capturer.close();
193
188
  await vite.close();
189
+ await closeHmrServer();
194
190
  }
195
191
  };
196
192
  }
197
- /** A Node request as the fetch-style request the host module takes. Only a request with a method that carries one reads its body. */
198
193
  async function toFetchRequest(req, url) {
199
194
  const method = req.method ?? "GET";
200
195
  const headers = new Headers();
@@ -237,10 +232,9 @@ async function sendClientShell(ctx, res) {
237
232
  }
238
233
  sendHtml(res, stampBase(html, "/"));
239
234
  }
240
- /** A file the client build emitted, by its path under the base. `false` when there is none. */
241
235
  async function sendClientAsset(ctx, path, res) {
242
236
  const file = resolve(ctx.clientDir, `.${decodeURIComponent(path)}`);
243
- if (!file.startsWith(ctx.clientDir + sep)) return false;
237
+ if (!isInsideRoot(ctx.clientDir, file)) return false;
244
238
  try {
245
239
  if (!statSync(file).isFile()) return false;
246
240
  } catch {
@@ -312,4 +306,4 @@ async function sendFixtureMedia(ctx, req, url, res) {
312
306
  }
313
307
 
314
308
  //#endregion
315
- export { findPackageRoot, isCanvasPath, stampBase, startDevServer };
309
+ export { isCanvasPath, stampBase, startDevServer };
@@ -22,7 +22,6 @@ function toPattern(key, targets, baseUrl) {
22
22
  targets: targets.map((target) => isAbsolute(target) ? target : join(baseUrl, target))
23
23
  };
24
24
  }
25
- /** The wildcard capture for a match, `""` for an exact match, or `undefined` when `specifier` doesn't match. */
26
25
  function matchPattern(pattern, specifier) {
27
26
  if (!pattern.hasWildcard) return specifier === pattern.prefix ? "" : void 0;
28
27
  if (!specifier.startsWith(pattern.prefix) || !specifier.endsWith(pattern.suffix)) return void 0;
@@ -35,7 +34,6 @@ function isFile(path) {
35
34
  return false;
36
35
  }
37
36
  }
38
- /** `candidate` resolved as tsc would: itself, itself with an extension, or a directory index. */
39
37
  function resolveCandidate(candidate) {
40
38
  for (const ext of RESOLVE_EXTENSIONS) if (isFile(candidate + ext)) return candidate + ext;
41
39
  for (const ext of RESOLVE_EXTENSIONS.slice(1)) {
@@ -43,12 +41,6 @@ function resolveCandidate(candidate) {
43
41
  if (isFile(indexFile)) return indexFile;
44
42
  }
45
43
  }
46
- /**
47
- * The resolver for `root`'s tsconfig `paths`, or `null` when the workspace declares none
48
- * or its tsconfig cannot be read. Synchronous, and handed the compiler rather than
49
- * importing it, so the lint preset's rules (which cannot await) resolve an import exactly
50
- * as `dev` does. Relative, absolute and unmapped specifiers resolve to `undefined`.
51
- */
52
44
  function createPathsResolver(ts, root) {
53
45
  try {
54
46
  const configFile = ts.readConfigFile(join(root, "tsconfig.json"), (file) => ts.sys.readFile(file));
@@ -73,11 +65,6 @@ function createPathsResolver(ts, root) {
73
65
  return null;
74
66
  }
75
67
  }
76
- /**
77
- * A Vite `resolveId` plugin from `root`'s tsconfig `paths`, or `null` when the workspace
78
- * declares none or its tsconfig cannot be read — `check` owns reporting a broken tsconfig,
79
- * so `dev` degrades rather than refusing to start over it.
80
- */
81
68
  async function createTsconfigPathsPlugin(root) {
82
69
  const ts = (await import("typescript")).default;
83
70
  const resolvePath = createPathsResolver(ts, root);
@@ -1,17 +1,14 @@
1
1
  import { createTsconfigPathsPlugin } from "./tsconfig-paths.js";
2
- import { islandTransformPlugin, toPosixPath } from "./islands.js";
2
+ import { isInsideRoot, toPosix } from "../../platform/paths.js";
3
+ import { islandTransformPlugin } from "./islands.js";
3
4
  import { imageDimensions } from "../../fixtures/image-dimensions.js";
4
5
  import { MEDIA_EXTENSIONS, fixtureMediaModule } from "../../fixtures/media-plugin.js";
5
- import { extname, isAbsolute, relative } from "node:path";
6
+ import { extname } from "node:path";
6
7
  import { readFile } from "node:fs/promises";
7
8
  import react from "@vitejs/plugin-react";
8
9
  import { createServer } from "vite";
9
10
 
10
11
  //#region src/cli/dev/vite.ts
11
- function isInside(dir, file) {
12
- const rel = relative(dir, file);
13
- return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
14
- }
15
12
  const RASTER_EXTENSIONS = /* @__PURE__ */ new Set([
16
13
  ".png",
17
14
  ".jpg",
@@ -19,24 +16,6 @@ const RASTER_EXTENSIONS = /* @__PURE__ */ new Set([
19
16
  ".webp",
20
17
  ".avif"
21
18
  ]);
22
- /**
23
- * Every asset import in the BROWSER graph, resolved exactly as the server graph resolves
24
- * it (../../fixtures/media-plugin.ts): a raster yields the `AuthorImage` object the
25
- * authoring contract promises, everything else its served `/fixture-media/` URL string.
26
- *
27
- * Left to itself Vite answers differently on both counts — it inlines a file under
28
- * `assetsInlineLimit` as a `data:` URI and names the rest by their workspace path — and an
29
- * island is in BOTH graphs, so a divergence is an attribute mismatch React reports on the
30
- * island's own element at hydration. `build` has no such split (both its graphs are
31
- * esbuild's), so this is the dev server's alone to close.
32
- *
33
- * What it mints is recorded in `assets`, which the server's `/fixture-media/` route reads
34
- * alongside the server graph's index: an island declaring `serverFrame = false` is stubbed
35
- * out of that graph, so its assets are minted only here.
36
- *
37
- * A query suffix (`?url`, `?raw`) is the author asking Vite for a form of their own on
38
- * purpose, and is left to Vite.
39
- */
40
19
  function fixtureMediaVitePlugin(root, assets) {
41
20
  return {
42
21
  name: "concrete-dev:fixture-media",
@@ -44,7 +23,7 @@ function fixtureMediaVitePlugin(root, assets) {
44
23
  async load(id) {
45
24
  if (id.includes("?")) return null;
46
25
  const ext = extname(id).toLowerCase();
47
- if (!isInside(root, id)) return rasterFromPackage(id, ext);
26
+ if (!isInsideRoot(root, id)) return rasterFromPackage(id, ext);
48
27
  if (!MEDIA_EXTENSIONS.has(ext)) return null;
49
28
  const { asset, value } = fixtureMediaModule(id, await readFile(id));
50
29
  assets.set(asset.url, asset);
@@ -58,7 +37,7 @@ async function rasterFromPackage(id, ext) {
58
37
  width: 0,
59
38
  height: 0
60
39
  };
61
- const url = `/@fs/${toPosixPath(id).replace(/^\/+/, "")}`;
40
+ const url = `/@fs/${toPosix(id).replace(/^\/+/, "")}`;
62
41
  return `export default ${JSON.stringify({
63
42
  url,
64
43
  responsive: null,
@@ -87,7 +66,10 @@ async function createDevVite(options) {
87
66
  middlewareMode: true,
88
67
  fs: { allow: [root, packageRoot] },
89
68
  watch: { ignored: ["**/.concrete/**", "**/node_modules/**"] },
90
- hmr: { port: options.hmrPort }
69
+ hmr: {
70
+ server: options.hmrServer,
71
+ port: options.hmrPort
72
+ }
91
73
  },
92
74
  resolve: { dedupe: ["react", "react-dom"] },
93
75
  optimizeDeps: {
@@ -100,17 +82,6 @@ async function createDevVite(options) {
100
82
  }
101
83
  });
102
84
  }
103
- /**
104
- * Resolves once the browser graph reachable from `entryUrls` has been transformed and the
105
- * dependency optimizer has committed every package that graph imports. Never rejects: a
106
- * module that fails to transform is left for the page to report.
107
- *
108
- * A capture awaits this before Chromium opens a page. A package import Vite first meets
109
- * mid-page — one the dependency scan missed, or one added after the cache under
110
- * `node_modules/.vite` was written — re-optimizes, and when that moves an optimized file
111
- * Vite FULL-RELOADS every open page, destroying the one a capture is settling. Met here,
112
- * with no page open, the reload lands on nobody.
113
- */
114
85
  async function settleBrowserDependencies(vite, entryUrls) {
115
86
  const client = vite.environments.client;
116
87
  const optimizer = client.depsOptimizer;