@dooc-dev/dooc 0.0.7 → 0.0.8

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 (302) hide show
  1. package/dist/client.global.js +1 -0
  2. package/dist/code-worker.global.js +11 -11
  3. package/dist/code.global.js +75 -75
  4. package/dist/edit.global.js +234 -231
  5. package/dist/{compiler → engine/compiler}/bundle-urls.js +1 -4
  6. package/dist/{compiler → engine/compiler}/check-prose.d.ts +1 -1
  7. package/dist/{compiler → engine/compiler}/check-prose.js +1 -1
  8. package/dist/{compiler → engine/compiler}/check.js +15 -27
  9. package/dist/{compiler → engine/compiler}/code-blocks.js +3 -1
  10. package/dist/{compiler → engine/compiler}/code-languages.js +1 -2
  11. package/dist/{compiler → engine/compiler}/compile.d.ts +5 -4
  12. package/dist/{compiler → engine/compiler}/compile.js +91 -32
  13. package/dist/{compiler → engine/compiler}/config.js +1 -3
  14. package/dist/{compiler → engine/compiler}/dialect.d.ts +1 -3
  15. package/dist/{compiler → engine/compiler}/dialect.js +8 -52
  16. package/dist/{compiler → engine/compiler}/dxf.js +1 -1
  17. package/dist/{compiler → engine/compiler}/export.js +15 -8
  18. package/dist/{compiler → engine/compiler}/figures.js +26 -22
  19. package/dist/{compiler → engine/compiler}/file-cache.d.ts +1 -2
  20. package/dist/{compiler → engine/compiler}/file-cache.js +8 -15
  21. package/dist/{compiler → engine/compiler}/files.js +49 -38
  22. package/dist/{compiler → engine/compiler}/fonts.js +1 -3
  23. package/dist/{compiler → engine/compiler}/from-mdast.js +1 -1
  24. package/dist/engine/compiler/host.d.ts +10 -0
  25. package/dist/engine/compiler/host.js +16 -0
  26. package/dist/{compiler → engine/compiler}/icons.d.ts +3 -0
  27. package/dist/{compiler → engine/compiler}/icons.js +28 -10
  28. package/dist/{compiler → engine/compiler}/ignored-files.d.ts +2 -0
  29. package/dist/{compiler → engine/compiler}/ignored-files.js +12 -3
  30. package/dist/{compiler → engine/compiler}/locales.js +2 -8
  31. package/dist/{compiler → engine/compiler}/manifest.d.ts +3 -2
  32. package/dist/engine/compiler/manifest.js +46 -0
  33. package/dist/{compiler → engine/compiler}/ops.d.ts +4 -1
  34. package/dist/{compiler → engine/compiler}/ops.js +36 -21
  35. package/dist/engine/compiler/schema-file-references.d.ts +2 -0
  36. package/dist/engine/compiler/schema-file-references.js +82 -0
  37. package/dist/engine/compiler/serialize.d.ts +2 -0
  38. package/dist/engine/compiler/serialize.js +5 -0
  39. package/dist/{compiler → engine/compiler}/subformat-schema.js +1 -3
  40. package/dist/{compiler → engine/compiler}/subformats.d.ts +10 -0
  41. package/dist/{compiler → engine/compiler}/subformats.js +122 -18
  42. package/dist/{compiler → engine/compiler}/textfile-remote.js +1 -2
  43. package/dist/{compiler → engine/compiler}/textfile.js +4 -6
  44. package/dist/{compiler → engine/compiler}/theme-variants.js +1 -1
  45. package/dist/{compiler → engine/compiler}/zip.js +1 -1
  46. package/dist/{core → engine/core}/blocks.d.ts +6 -4
  47. package/dist/{core → engine/core}/content-metadata.d.ts +6 -1
  48. package/dist/{core → engine/core}/content-metadata.js +84 -18
  49. package/dist/{core → engine/core}/content-types.d.ts +4 -2
  50. package/dist/{core → engine/core}/html.d.ts +7 -0
  51. package/dist/{core → engine/core}/html.js +44 -3
  52. package/dist/{core → engine/core}/icons.d.ts +3 -0
  53. package/dist/engine/core/icons.js +20 -0
  54. package/dist/{core → engine/core}/routing.d.ts +2 -0
  55. package/dist/{core → engine/core}/routing.js +9 -0
  56. package/dist/{core → engine/core}/schema-refs.d.ts +1 -1
  57. package/dist/{core → engine/core}/schema-refs.js +3 -1
  58. package/dist/engine/core/subformat-references.d.ts +5 -0
  59. package/dist/engine/core/subformat-references.js +33 -0
  60. package/dist/{core → engine/core}/subformats.d.ts +7 -0
  61. package/dist/{core → engine/core}/subformats.js +5 -1
  62. package/dist/{core → engine/core}/taxonomy.d.ts +2 -3
  63. package/dist/{core → engine/core}/taxonomy.js +1 -5
  64. package/dist/flow.global.js +306 -306
  65. package/dist/frontend/application-request.d.ts +14 -0
  66. package/dist/frontend/application-request.js +36 -0
  67. package/dist/frontend/document-application.d.ts +200 -0
  68. package/dist/{viewer/serve.js → frontend/document-application.js} +1611 -1670
  69. package/dist/frontend/figure-preview.d.ts +4 -0
  70. package/dist/{viewer → frontend}/figure-preview.js +4 -4
  71. package/dist/{viewer → frontend}/file-references.d.ts +1 -1
  72. package/dist/{viewer → frontend}/file-references.js +3 -3
  73. package/dist/{viewer → frontend}/font-picker.d.ts +1 -1
  74. package/dist/{viewer → frontend}/font-settings.d.ts +1 -1
  75. package/dist/{viewer → frontend}/language-picker.js +112 -18
  76. package/dist/{viewer → frontend}/locales/eng.json +16 -2
  77. package/dist/{viewer → frontend}/locales/jpn.json +16 -2
  78. package/dist/{viewer → frontend}/locales/zho.json +16 -2
  79. package/dist/{viewer → frontend}/nav-focus.js +2 -0
  80. package/dist/{viewer → frontend}/plugin-blocks.js +2 -2
  81. package/dist/{viewer → frontend}/resize.js +14 -2
  82. package/dist/frontend/resource-download.d.ts +2 -0
  83. package/dist/frontend/resource-download.js +43 -0
  84. package/dist/{viewer → frontend}/resource-library.d.ts +9 -2
  85. package/dist/{viewer → frontend}/resource-library.js +133 -37
  86. package/dist/{core → frontend}/schema-graph-flow.d.ts +1 -1
  87. package/dist/{core → frontend}/schema-graph-flow.js +1 -1
  88. package/dist/{viewer → frontend}/search.d.ts +2 -2
  89. package/dist/{viewer → frontend}/search.js +26 -8
  90. package/dist/graph/schema-graph-global.js +17 -17
  91. package/dist/install.sh +68 -0
  92. package/dist/plugins.global.js +62 -62
  93. package/dist/{viewer → server}/assets.d.ts +2 -0
  94. package/dist/server/assets.js +7 -0
  95. package/dist/{viewer → server}/build-plugins.js +4 -4
  96. package/dist/{viewer → server}/build.d.ts +2 -1
  97. package/dist/{viewer → server}/build.js +31 -15
  98. package/dist/{cli.js → server/cli.js} +199 -66
  99. package/dist/server/editor-tools.d.ts +1 -0
  100. package/dist/server/editor-tools.js +1 -0
  101. package/dist/{viewer → server}/extension-pack.js +2 -2
  102. package/dist/{viewer → server}/extensions.d.ts +1 -1
  103. package/dist/{viewer → server}/extensions.js +3 -3
  104. package/dist/server/git-diff.d.ts +10 -0
  105. package/dist/{viewer → server}/git-diff.js +45 -10
  106. package/dist/server/git-origin.d.ts +4 -0
  107. package/dist/server/git-origin.js +103 -0
  108. package/dist/server/git.d.ts +9 -0
  109. package/dist/{viewer → server}/git.js +50 -6
  110. package/dist/server/history.d.ts +14 -0
  111. package/dist/server/history.js +205 -0
  112. package/dist/{viewer → server}/hmr.d.ts +0 -22
  113. package/dist/server/hmr.js +168 -0
  114. package/dist/server/index.d.ts +17 -0
  115. package/dist/{index.js → server/index.js} +16 -16
  116. package/dist/{viewer → server}/ja-lint.d.ts +1 -1
  117. package/dist/{viewer → server}/languages.d.ts +1 -1
  118. package/dist/{viewer → server}/languages.js +3 -3
  119. package/dist/{mcp.d.ts → server/mcp.d.ts} +2 -2
  120. package/dist/{mcp.js → server/mcp.js} +60 -21
  121. package/dist/{viewer → server}/plugin-config.d.ts +2 -2
  122. package/dist/{viewer → server}/plugin-config.js +2 -2
  123. package/dist/{plugins → server/plugins}/local-storage.d.ts +1 -1
  124. package/dist/{plugins → server/plugins}/local-storage.js +1 -1
  125. package/dist/{plugins → server/plugins}/runtime.d.ts +4 -4
  126. package/dist/{plugins → server/plugins}/runtime.js +4 -4
  127. package/dist/{viewer → server}/plugins.d.ts +3 -3
  128. package/dist/{viewer → server}/plugins.js +14 -13
  129. package/dist/server/resource-library.d.ts +1 -0
  130. package/dist/server/resource-library.js +1 -0
  131. package/dist/server/self.d.ts +5 -0
  132. package/dist/server/self.js +98 -0
  133. package/dist/server/serve.d.ts +61 -0
  134. package/dist/server/serve.js +503 -0
  135. package/dist/server/static-client.d.ts +4 -0
  136. package/dist/server/static-client.js +117 -0
  137. package/dist/server/workspace-server.d.ts +16 -0
  138. package/dist/server/workspace-server.js +266 -0
  139. package/dist/{viewer → server}/workspace.d.ts +6 -1
  140. package/dist/{viewer → server}/workspace.js +46 -0
  141. package/dist/subformats.global.js +92 -6
  142. package/dist/ui.global.js +85 -72
  143. package/dist/workspace/client.d.ts +13 -0
  144. package/dist/workspace/client.js +114 -0
  145. package/dist/{viewer → workspace}/code-file.d.ts +1 -1
  146. package/dist/{viewer → workspace}/code-file.js +7 -7
  147. package/dist/workspace/connection.d.ts +27 -0
  148. package/dist/workspace/connection.js +38 -0
  149. package/dist/{viewer → workspace}/editor-tools.d.ts +7 -1
  150. package/dist/{viewer → workspace}/editor-tools.js +12 -9
  151. package/dist/{viewer → workspace}/git-types.d.ts +7 -0
  152. package/dist/workspace/github.d.ts +4 -0
  153. package/dist/workspace/github.js +99 -0
  154. package/dist/workspace/history.d.ts +46 -0
  155. package/dist/workspace/history.js +86 -0
  156. package/dist/workspace/protocol.d.ts +38 -0
  157. package/dist/workspace/protocol.js +20 -0
  158. package/dist/workspace/resource-download.d.ts +1 -0
  159. package/dist/workspace/resource-download.js +8 -0
  160. package/dist/workspace/server.d.ts +9 -0
  161. package/dist/workspace/server.js +48 -0
  162. package/dist/{viewer → workspace}/site-icon.js +9 -10
  163. package/dist/{viewer → workspace}/site-title.js +6 -7
  164. package/dist/{viewer → workspace}/textfile.d.ts +1 -1
  165. package/dist/{viewer → workspace}/textfile.js +5 -5
  166. package/dist/workspace-worker.global.js +2859 -0
  167. package/package.json +34 -20
  168. package/dist/compiler/manifest.js +0 -37
  169. package/dist/compiler/serialize.d.ts +0 -3
  170. package/dist/compiler/serialize.js +0 -16
  171. package/dist/core/icons.js +0 -5
  172. package/dist/index.d.ts +0 -17
  173. package/dist/viewer/assets.js +0 -3
  174. package/dist/viewer/figure-preview.d.ts +0 -4
  175. package/dist/viewer/git-diff.d.ts +0 -6
  176. package/dist/viewer/git.d.ts +0 -5
  177. package/dist/viewer/hmr.js +0 -341
  178. package/dist/viewer/serve.d.ts +0 -216
  179. /package/dist/{compiler → engine/compiler}/asset-references.d.ts +0 -0
  180. /package/dist/{compiler → engine/compiler}/asset-references.js +0 -0
  181. /package/dist/{compiler → engine/compiler}/bundle-urls.d.ts +0 -0
  182. /package/dist/{compiler → engine/compiler}/check-types.d.ts +0 -0
  183. /package/dist/{compiler → engine/compiler}/check-types.js +0 -0
  184. /package/dist/{compiler → engine/compiler}/check.d.ts +0 -0
  185. /package/dist/{compiler → engine/compiler}/code-blocks.d.ts +0 -0
  186. /package/dist/{compiler → engine/compiler}/code-languages.d.ts +0 -0
  187. /package/dist/{compiler → engine/compiler}/config.d.ts +0 -0
  188. /package/dist/{compiler → engine/compiler}/drawio.d.ts +0 -0
  189. /package/dist/{compiler → engine/compiler}/drawio.js +0 -0
  190. /package/dist/{compiler → engine/compiler}/dxf.d.ts +0 -0
  191. /package/dist/{compiler → engine/compiler}/export.d.ts +0 -0
  192. /package/dist/{compiler → engine/compiler}/figures.d.ts +0 -0
  193. /package/dist/{compiler → engine/compiler}/files.d.ts +0 -0
  194. /package/dist/{compiler → engine/compiler}/fonts.d.ts +0 -0
  195. /package/dist/{compiler → engine/compiler}/format.d.ts +0 -0
  196. /package/dist/{compiler → engine/compiler}/format.js +0 -0
  197. /package/dist/{compiler → engine/compiler}/from-mdast.d.ts +0 -0
  198. /package/dist/{compiler → engine/compiler}/language-codes.d.ts +0 -0
  199. /package/dist/{compiler → engine/compiler}/language-codes.js +0 -0
  200. /package/dist/{compiler → engine/compiler}/locales.d.ts +0 -0
  201. /package/dist/{compiler → engine/compiler}/public-file.d.ts +0 -0
  202. /package/dist/{compiler → engine/compiler}/public-file.js +0 -0
  203. /package/dist/{compiler → engine/compiler}/subformat-schema.d.ts +0 -0
  204. /package/dist/{compiler → engine/compiler}/terms.d.ts +0 -0
  205. /package/dist/{compiler → engine/compiler}/terms.js +0 -0
  206. /package/dist/{compiler → engine/compiler}/textfile-remote.d.ts +0 -0
  207. /package/dist/{compiler → engine/compiler}/textfile.d.ts +0 -0
  208. /package/dist/{compiler → engine/compiler}/theme-variants.d.ts +0 -0
  209. /package/dist/{compiler → engine/compiler}/zip.d.ts +0 -0
  210. /package/dist/{core → engine/core}/blocks.js +0 -0
  211. /package/dist/{core → engine/core}/code-file.d.ts +0 -0
  212. /package/dist/{core → engine/core}/code-file.js +0 -0
  213. /package/dist/{core → engine/core}/code-grammars.d.ts +0 -0
  214. /package/dist/{core → engine/core}/code-grammars.js +0 -0
  215. /package/dist/{core → engine/core}/content-types.js +0 -0
  216. /package/dist/{core → engine/core}/escape-html.d.ts +0 -0
  217. /package/dist/{core → engine/core}/escape-html.js +0 -0
  218. /package/dist/{core → engine/core}/extension-package.d.ts +0 -0
  219. /package/dist/{core → engine/core}/extension-package.js +0 -0
  220. /package/dist/{core → engine/core}/figure-frame.d.ts +0 -0
  221. /package/dist/{core → engine/core}/figure-frame.js +0 -0
  222. /package/dist/{core → engine/core}/file-embed.d.ts +0 -0
  223. /package/dist/{core → engine/core}/file-embed.js +0 -0
  224. /package/dist/{core → engine/core}/files.d.ts +0 -0
  225. /package/dist/{core → engine/core}/files.js +0 -0
  226. /package/dist/{core → engine/core}/graph-common.d.ts +0 -0
  227. /package/dist/{core → engine/core}/graph-common.js +0 -0
  228. /package/dist/{core → engine/core}/graph.d.ts +0 -0
  229. /package/dist/{core → engine/core}/graph.js +0 -0
  230. /package/dist/{core → engine/core}/inline.d.ts +0 -0
  231. /package/dist/{core → engine/core}/inline.js +0 -0
  232. /package/dist/{core → engine/core}/json-tools.d.ts +0 -0
  233. /package/dist/{core → engine/core}/json-tools.js +0 -0
  234. /package/dist/{core → engine/core}/language.d.ts +0 -0
  235. /package/dist/{core → engine/core}/language.js +0 -0
  236. /package/dist/{core → engine/core}/languages/ja.d.ts +0 -0
  237. /package/dist/{core → engine/core}/languages/ja.js +0 -0
  238. /package/dist/{core → engine/core}/markdown.d.ts +0 -0
  239. /package/dist/{core → engine/core}/markdown.js +0 -0
  240. /package/dist/{core → engine/core}/previewers.d.ts +0 -0
  241. /package/dist/{core → engine/core}/previewers.js +0 -0
  242. /package/dist/{core → engine/core}/schema-comments.d.ts +0 -0
  243. /package/dist/{core → engine/core}/schema-comments.js +0 -0
  244. /package/dist/{core → engine/core}/schema-fields.d.ts +0 -0
  245. /package/dist/{core → engine/core}/schema-fields.js +0 -0
  246. /package/dist/{core → engine/core}/schema-graph.d.ts +0 -0
  247. /package/dist/{core → engine/core}/schema-graph.js +0 -0
  248. /package/dist/{core → engine/core}/subformat-record.d.ts +0 -0
  249. /package/dist/{core → engine/core}/subformat-record.js +0 -0
  250. /package/dist/{core → engine/core}/term-reference.d.ts +0 -0
  251. /package/dist/{core → engine/core}/term-reference.js +0 -0
  252. /package/dist/{core → engine/core}/textfile.d.ts +0 -0
  253. /package/dist/{core → engine/core}/textfile.js +0 -0
  254. /package/dist/{core → engine/core}/theme-variants.d.ts +0 -0
  255. /package/dist/{core → engine/core}/theme-variants.js +0 -0
  256. /package/dist/{core → engine/core}/workspace.d.ts +0 -0
  257. /package/dist/{core → engine/core}/workspace.js +0 -0
  258. /package/dist/{viewer → frontend}/bundle-network.d.ts +0 -0
  259. /package/dist/{viewer → frontend}/bundle-network.js +0 -0
  260. /package/dist/{core → frontend}/flow-base-css.generated.d.ts +0 -0
  261. /package/dist/{core → frontend}/flow-base-css.generated.js +0 -0
  262. /package/dist/{core → frontend}/flow-css.d.ts +0 -0
  263. /package/dist/{core → frontend}/flow-css.js +0 -0
  264. /package/dist/{viewer → frontend}/font-picker.js +0 -0
  265. /package/dist/{viewer → frontend}/font-settings.js +0 -0
  266. /package/dist/{viewer → frontend}/i18n.d.ts +0 -0
  267. /package/dist/{viewer → frontend}/i18n.js +0 -0
  268. /package/dist/{viewer → frontend}/language-picker.d.ts +0 -0
  269. /package/dist/{viewer → frontend}/lazy-preview.d.ts +0 -0
  270. /package/dist/{viewer → frontend}/lazy-preview.js +0 -0
  271. /package/dist/{viewer → frontend}/nav-focus.d.ts +0 -0
  272. /package/dist/{viewer → frontend}/nav-update.d.ts +0 -0
  273. /package/dist/{viewer → frontend}/nav-update.js +0 -0
  274. /package/dist/{viewer → frontend}/plugin-blocks.d.ts +0 -0
  275. /package/dist/{viewer → frontend}/plugin-style.d.ts +0 -0
  276. /package/dist/{viewer → frontend}/plugin-style.js +0 -0
  277. /package/dist/{viewer → frontend}/plugin-view.d.ts +0 -0
  278. /package/dist/{viewer → frontend}/plugin-view.js +0 -0
  279. /package/dist/{viewer → frontend}/resize.d.ts +0 -0
  280. /package/dist/{core → frontend}/schema-graph-mount.d.ts +0 -0
  281. /package/dist/{core → frontend}/schema-graph-mount.js +0 -0
  282. /package/dist/{core → frontend}/table-ui.d.ts +0 -0
  283. /package/dist/{core → frontend}/table-ui.js +0 -0
  284. /package/dist/{core → frontend}/terms-ui.d.ts +0 -0
  285. /package/dist/{core → frontend}/terms-ui.js +0 -0
  286. /package/dist/{viewer → frontend}/theme-picker.d.ts +0 -0
  287. /package/dist/{viewer → frontend}/theme-picker.js +0 -0
  288. /package/dist/{core → frontend}/toc-ui.d.ts +0 -0
  289. /package/dist/{core → frontend}/toc-ui.js +0 -0
  290. /package/dist/{core → frontend}/video-ui.d.ts +0 -0
  291. /package/dist/{core → frontend}/video-ui.js +0 -0
  292. /package/dist/{viewer → server}/build-plugins.d.ts +0 -0
  293. /package/dist/{cli.d.ts → server/cli.d.ts} +0 -0
  294. /package/dist/{viewer → server}/extension-pack.d.ts +0 -0
  295. /package/dist/{viewer → server}/fonts/LICENSE.txt +0 -0
  296. /package/dist/{viewer → server}/fonts/udev-gothic-regular.woff2 +0 -0
  297. /package/dist/{viewer → server}/fonts.d.ts +0 -0
  298. /package/dist/{viewer → server}/fonts.js +0 -0
  299. /package/dist/{viewer → server}/ja-lint.js +0 -0
  300. /package/dist/{viewer → workspace}/git-types.js +0 -0
  301. /package/dist/{viewer → workspace}/site-icon.d.ts +0 -0
  302. /package/dist/{viewer → workspace}/site-title.d.ts +0 -0
@@ -1,11 +1,38 @@
1
1
  import { execFileSync } from "node:child_process";
2
2
  import { isDeepStrictEqual } from "node:util";
3
- import { parseDoc } from "../compiler/dialect.js";
4
- import { parseManifestText } from "../compiler/manifest.js";
5
- import { textfilePath } from "../compiler/textfile.js";
6
- import { MANIFEST_FILE } from "../core/content-metadata.js";
3
+ import { parseDoc } from "../engine/compiler/dialect.js";
4
+ import { manifestFile, parseManifestText } from "../engine/compiler/manifest.js";
5
+ import { textfilePath } from "../engine/compiler/textfile.js";
7
6
  import { parseGitChanges } from "./git.js";
8
- export const gitFileChanges = (root) => {
7
+ import { gitSignature } from "./workspace.js";
8
+ // Git answers are reused until the metadata they were read from changes (see gitSignature).
9
+ const memo = new Map();
10
+ const remember = (scope, signature, key, read) => {
11
+ if (signature === undefined)
12
+ return read();
13
+ let entry = memo.get(scope);
14
+ // Base texts of visited files accumulate under one HEAD; start over past a generous bound.
15
+ if (entry?.signature !== signature || entry.values.size > 500) {
16
+ entry = { signature, values: new Map() };
17
+ memo.set(scope, entry);
18
+ }
19
+ if (entry.values.has(key))
20
+ return entry.values.get(key);
21
+ const value = read();
22
+ // Failures (null) stay uncached so a transient Git error does not stick.
23
+ if (value !== null)
24
+ entry.values.set(key, value);
25
+ return value;
26
+ };
27
+ /**
28
+ * `revision` identifies the working tree contents (filesSnapshot); with it the status is reused
29
+ * until the files, the index or HEAD change.
30
+ */
31
+ export const gitFileChanges = (root, revision) => {
32
+ const signature = revision === undefined ? undefined : gitSignature(root, true);
33
+ return remember(`status|${root}`, signature === undefined ? undefined : `${signature}|${revision}`, "", () => readGitFileChanges(root));
34
+ };
35
+ const readGitFileChanges = (root) => {
9
36
  const changes = new Map();
10
37
  const git = (...args) => execFileSync("git", ["--no-optional-locks", "-C", root, ...args], {
11
38
  encoding: "utf8",
@@ -29,6 +56,15 @@ export const gitFileChanges = (root) => {
29
56
  };
30
57
  /** Compare against HEAD so saving or staging does not clear the editor's changes. */
31
58
  export const gitBaseText = (root, file) => {
59
+ try {
60
+ textfilePath(root, file);
61
+ }
62
+ catch {
63
+ return null;
64
+ }
65
+ return remember(`head|${root}`, gitSignature(root), file, () => readGitBaseText(root, file));
66
+ };
67
+ const readGitBaseText = (root, file) => {
32
68
  const git = (...args) => execFileSync("git", ["-C", root, ...args], {
33
69
  encoding: "utf8",
34
70
  stdio: ["ignore", "pipe", "ignore"],
@@ -36,7 +72,6 @@ export const gitBaseText = (root, file) => {
36
72
  maxBuffer: 5_000_000,
37
73
  });
38
74
  try {
39
- textfilePath(root, file);
40
75
  let head;
41
76
  try {
42
77
  head = git("rev-parse", "--verify", "--quiet", "HEAD").trim();
@@ -57,10 +92,10 @@ export const gitBaseBody = (root, file) => {
57
92
  const raw = gitBaseText(root, file);
58
93
  return raw === null ? null : parseDoc(raw).body;
59
94
  };
60
- export const setSubformatChanges = (root, collections) => {
61
- const changes = gitFileChanges(root);
62
- const raw = gitBaseText(root, MANIFEST_FILE);
63
- const base = raw === null ? undefined : parseManifestText(raw);
95
+ export const setSubformatChanges = (root, collections, revision) => {
96
+ const changes = gitFileChanges(root, revision);
97
+ const raw = gitBaseText(root, manifestFile(root));
98
+ const base = raw === null ? undefined : parseManifestText(raw, manifestFile(root));
64
99
  for (const collection of collections) {
65
100
  const previous = base?.subformats?.find((item) => item.ext === collection.ext);
66
101
  collection.baseLayouts =
@@ -0,0 +1,4 @@
1
+ import type { GitOrigin } from "../workspace/git-types.js";
2
+ type Git = (root: string, args: string[], input?: string) => Promise<string>;
3
+ export declare const nativeGitOrigin: (root: string, git: Git) => Promise<GitOrigin | undefined>;
4
+ export {};
@@ -0,0 +1,103 @@
1
+ import { execFile } from "node:child_process";
2
+ import { createGithubOrigin, githubRepository } from "../workspace/github.js";
3
+ export const nativeGitOrigin = async (root, git) => {
4
+ const remote = await git(root, ["remote", "get-url", "origin"]).then((value) => value.trim(), () => "");
5
+ if (!remote)
6
+ return undefined;
7
+ const validate = async () => {
8
+ const current = (await git(root, ["remote", "get-url", "origin"])).trim();
9
+ const pushes = (await git(root, ["remote", "get-url", "--push", "--all", "origin"]))
10
+ .trim()
11
+ .split("\n");
12
+ if (current !== remote || pushes.length !== 1 || pushes[0] !== remote)
13
+ throw new Error("Origin must have one matching fetch and push URL. Reload after changing it.");
14
+ };
15
+ const sync = async (action, context) => {
16
+ await validate();
17
+ if (action === "fetch") {
18
+ await git(root, ["fetch", "origin"]);
19
+ return;
20
+ }
21
+ if (!context.branch || !/^[a-f\d]{40,64}$/i.test(context.head))
22
+ throw new Error("A committed branch is required");
23
+ await git(root, ["check-ref-format", `refs/heads/${context.branch}`]);
24
+ if ((await git(root, ["rev-parse", "HEAD"])).trim() !== context.head ||
25
+ (await git(root, ["symbolic-ref", "--short", "HEAD"])).trim() !== context.branch)
26
+ throw new Error("Branch changed. Reload before continuing.");
27
+ if (action === "push")
28
+ await git(root, [
29
+ "-c",
30
+ "push.followTags=false",
31
+ "-c",
32
+ "remote.origin.mirror=false",
33
+ "push",
34
+ "--no-force",
35
+ "--no-follow-tags",
36
+ "origin",
37
+ `${context.head}:refs/heads/${context.branch}`,
38
+ ]);
39
+ else {
40
+ if ((await git(root, ["status", "--porcelain"])).trim())
41
+ throw new Error("Commit changes before pulling");
42
+ await git(root, ["fetch", "origin", `refs/heads/${context.branch}`]);
43
+ await git(root, ["-c", "merge.autostash=false", "merge", "--ff-only", "FETCH_HEAD"]);
44
+ }
45
+ };
46
+ const repository = githubRepository(remote);
47
+ if (!repository)
48
+ return {
49
+ name: "Git remote",
50
+ capabilities: ["fetch", "pull", "push"],
51
+ read: async () => ({
52
+ url: /^https?:\/\//.test(remote) ? remote : "",
53
+ defaultBranch: "",
54
+ pullRequests: [],
55
+ }),
56
+ execute: async (context, input) => {
57
+ if (input.action !== "fetch" && input.action !== "pull" && input.action !== "push")
58
+ throw new Error("Pull requests require a GitHub origin or an origin plugin");
59
+ await sync(input.action, context);
60
+ },
61
+ };
62
+ return createGithubOrigin(repository, async (path, method = "GET", body) => {
63
+ await validate();
64
+ return new Promise((resolve, reject) => {
65
+ const env = {
66
+ ...process.env,
67
+ GH_PROMPT_DISABLED: "1",
68
+ GH_PAGER: "cat",
69
+ };
70
+ delete env.GH_REPO;
71
+ const child = execFile("gh", [
72
+ "api",
73
+ "--hostname",
74
+ "github.com",
75
+ path,
76
+ "--method",
77
+ method,
78
+ ...(body === undefined ? [] : ["--input", "-"]),
79
+ ], {
80
+ cwd: root,
81
+ env,
82
+ encoding: "utf8",
83
+ timeout: 30_000,
84
+ maxBuffer: 8 * 1024 * 1024,
85
+ }, (error, stdout, stderr) => {
86
+ if (error)
87
+ reject(new Error(error.code === "ENOENT"
88
+ ? "Install GitHub CLI and run gh auth login to manage pull requests."
89
+ : stderr.trim().slice(0, 2000) || "GitHub request failed"));
90
+ else {
91
+ try {
92
+ resolve(JSON.parse(stdout));
93
+ }
94
+ catch {
95
+ reject(new Error("Invalid GitHub response"));
96
+ }
97
+ }
98
+ });
99
+ child.stdin?.on("error", () => { });
100
+ child.stdin?.end(body === undefined ? "" : JSON.stringify(body));
101
+ });
102
+ }, sync);
103
+ };
@@ -0,0 +1,9 @@
1
+ import type { GitChange, GitOrigin } from "../workspace/git-types.js";
2
+ export declare const git: (root: string, args: string[], input?: string) => Promise<string>;
3
+ export declare const parseGitChanges: (status: string) => GitChange[];
4
+ export declare const gitWorktrees: (root: string) => Promise<Map<string, string>>;
5
+ export declare const gitManifestPath: (root: string, repository: string) => string;
6
+ export declare const hasGitManifest: (root: string, manifest: string, ref?: string) => Promise<boolean>;
7
+ export declare const validateGitOrigin: (value: unknown) => GitOrigin;
8
+ /** Serialize UI operations; Git's own locks still arbitrate with other Git clients. */
9
+ export declare const createGitHandler: (documentRoot: string, getOrigin: () => GitOrigin | undefined) => (input: Record<string, unknown> | undefined) => Promise<unknown>;
@@ -1,8 +1,11 @@
1
1
  import { execFile } from "node:child_process";
2
2
  import { createHash } from "node:crypto";
3
- import { lstat, readFile, readlink } from "node:fs/promises";
4
- import { basename, join } from "node:path";
5
- const git = (root, args, input = "") => new Promise((resolve, reject) => {
3
+ import { lstat, readFile, readlink, stat } from "node:fs/promises";
4
+ import { basename, join, relative } from "node:path";
5
+ import { manifestFile } from "../engine/compiler/manifest.js";
6
+ import { nativeGitOrigin } from "./git-origin.js";
7
+ import { readWorkspaceSource } from "./workspace.js";
8
+ export const git = (root, args, input = "") => new Promise((resolve, reject) => {
6
9
  const child = execFile("git",
7
10
  // Stash uses pathspec magic internally when cleaning its saved untracked files.
8
11
  [
@@ -41,6 +44,21 @@ export const parseGitChanges = (status) => {
41
44
  }
42
45
  return changes;
43
46
  };
47
+ export const gitWorktrees = async (root) => {
48
+ const worktrees = new Map();
49
+ for (const record of (await git(root, ["worktree", "list", "--porcelain", "-z"])).split("\0\0")) {
50
+ const fields = record.split("\0");
51
+ const branch = fields.find((field) => field.startsWith("branch refs/heads/"));
52
+ const path = fields.find((field) => field.startsWith("worktree "));
53
+ if (branch && path)
54
+ worktrees.set(branch.slice("branch refs/heads/".length), path.slice("worktree ".length));
55
+ }
56
+ return worktrees;
57
+ };
58
+ export const gitManifestPath = (root, repository) => relative(repository, join(root, manifestFile(root))).replaceAll("\\", "/");
59
+ export const hasGitManifest = (root, manifest, ref) => ref === undefined
60
+ ? stat(join(root, manifest)).then((value) => value.isFile(), () => false)
61
+ : git(root, ["cat-file", "-t", `${ref}:${manifest}`]).then((value) => value.trim() === "blob", () => false);
44
62
  const text = (value, limit, empty = false) => {
45
63
  if (typeof value !== "string" ||
46
64
  value.length > limit ||
@@ -123,7 +141,12 @@ export const createGitHandler = (documentRoot, getOrigin) => {
123
141
  return {
124
142
  context: { root, branch, head },
125
143
  state: {
126
- repo: basename(root),
144
+ repo: (() => {
145
+ const source = readWorkspaceSource(root);
146
+ return source.protocol === "git"
147
+ ? (source.repo ?? basename(root))
148
+ : basename(root);
149
+ })(),
127
150
  branch,
128
151
  head,
129
152
  version: hash.digest("hex"),
@@ -151,8 +174,22 @@ export const createGitHandler = (documentRoot, getOrigin) => {
151
174
  busy = true;
152
175
  try {
153
176
  const { state, context } = await snapshot();
154
- const origin = getOrigin();
177
+ const configuredOrigin = getOrigin();
178
+ const origin = configuredOrigin ?? (await nativeGitOrigin(context.root, git));
155
179
  if (input.action === "read" || input.action === "branches") {
180
+ if (input.action === "branches") {
181
+ const manifest = gitManifestPath(documentRoot, context.root);
182
+ const worktrees = await gitWorktrees(context.root);
183
+ const available = await Promise.all(state.branches.map((branch) => {
184
+ const path = worktrees.get(branch);
185
+ return hasGitManifest(path ?? context.root, manifest, path ? undefined : `refs/heads/${branch}`);
186
+ }));
187
+ state.branchWorkspaces = {
188
+ manifest,
189
+ unavailable: state.branches.filter((_, index) => !available[index]),
190
+ canCreate: await hasGitManifest(context.root, manifest, "HEAD"),
191
+ };
192
+ }
156
193
  if (origin && input.action === "read") {
157
194
  try {
158
195
  state.origin = {
@@ -162,6 +199,13 @@ export const createGitHandler = (documentRoot, getOrigin) => {
162
199
  };
163
200
  }
164
201
  catch (error) {
202
+ state.origin = {
203
+ name: origin.name,
204
+ capabilities: origin.capabilities,
205
+ url: "",
206
+ defaultBranch: "",
207
+ pullRequests: [],
208
+ };
165
209
  state.originError =
166
210
  error instanceof Error ? error.message : "Origin unavailable";
167
211
  }
@@ -324,7 +368,7 @@ export const createGitHandler = (documentRoot, getOrigin) => {
324
368
  }
325
369
  else
326
370
  throw new Error("Invalid Git action");
327
- if (getOrigin() !== origin)
371
+ if (getOrigin() !== configuredOrigin)
328
372
  throw new Error("Origin changed. Reload before continuing.");
329
373
  await origin.execute(context, request);
330
374
  }
@@ -0,0 +1,14 @@
1
+ import type { History } from "../workspace/history.js";
2
+ /**
3
+ * A snapshot is a commit of everything under the workspace folder. With `branch`, snapshots are
4
+ * only taken on that branch (a shared workspace records straight onto its main line).
5
+ */
6
+ export declare const gitHistory: (root: string, branch?: string) => History;
7
+ /**
8
+ * A snapshot is a copy of every managed file under `.dooc/snapshots/<id>/files`.
9
+ * shortcut: full copy per snapshot, switch to content-addressed blobs when large media makes
10
+ * the folder grow too fast.
11
+ */
12
+ export declare const folderHistory: (root: string) => History;
13
+ /** Chosen per request, so `git init` in a running workspace switches the driver. */
14
+ export declare const workspaceHistory: (root: string, branch?: string) => History;
@@ -0,0 +1,205 @@
1
+ // Node history drivers: Git commits in a Git workspace, folder copies ("single storage") elsewhere.
2
+ import { randomBytes } from "node:crypto";
3
+ import { cpSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, rmdirSync, rmSync, writeFileSync, } from "node:fs";
4
+ import { dirname, join, relative } from "node:path";
5
+ import { projectFiles } from "../engine/compiler/files.js";
6
+ import { translationFiles } from "../engine/compiler/locales.js";
7
+ import { manifestFile } from "../engine/compiler/manifest.js";
8
+ import { textfilePath } from "../engine/compiler/textfile.js";
9
+ import { git } from "./git.js";
10
+ import { readWorkspaceSource } from "./workspace.js";
11
+ const LOG_FORMAT = "--format=%H%x00%aI%x00%an%x00%s%x00%(trailers:key=Co-authored-by,valueonly,separator=%x1f)%x1e";
12
+ const parseLog = (log) => log
13
+ .split("\x1e")
14
+ .map((record) => record.trim().split("\0"))
15
+ .filter((fields) => fields.length === 5)
16
+ .map(([id = "", time = "", author = "", message = "", trailers = ""]) => {
17
+ // A trailer value is "Name <email>"; history shows names only.
18
+ const coAuthors = trailers
19
+ .split("\x1f")
20
+ .map((value) => value.replace(/<[^>]*>\s*$/, "").trim())
21
+ .filter(Boolean);
22
+ return { id, time, author, message, ...(coAuthors.length ? { coAuthors } : {}) };
23
+ });
24
+ const signature = ({ name, email = "" }) => `${name} <${email}>`;
25
+ /**
26
+ * A snapshot is a commit of everything under the workspace folder. With `branch`, snapshots are
27
+ * only taken on that branch (a shared workspace records straight onto its main line).
28
+ */
29
+ export const gitHistory = (root, branch) => {
30
+ const changed = async () => (await git(root, ["status", "--porcelain", "--", "."])) !== "";
31
+ const assertBranch = async () => {
32
+ const current = (await git(root, ["symbolic-ref", "--quiet", "--short", "HEAD"]).catch(() => "")).trim();
33
+ if (branch !== undefined && current !== branch)
34
+ throw new Error(`Snapshots are recorded on ${branch}, but the workspace is on ${current || "a detached commit"}`);
35
+ };
36
+ const commit = async (message, by = {}) => {
37
+ await assertBranch();
38
+ const trailers = (by.coAuthors ?? []).map((p) => `Co-authored-by: ${signature(p)}`);
39
+ await git(root, [
40
+ "commit",
41
+ "--file=-",
42
+ ...(by.author ? [`--author=${signature(by.author)}`] : []),
43
+ "--",
44
+ ".",
45
+ ], trailers.length ? `${message}\n\n${trailers.join("\n")}\n` : message);
46
+ const [snapshot] = parseLog(await git(root, ["log", "-1", LOG_FORMAT]));
47
+ if (!snapshot)
48
+ throw new Error("Snapshot was not recorded");
49
+ return snapshot;
50
+ };
51
+ return {
52
+ list: async () =>
53
+ // An empty repository has no HEAD to list.
54
+ parseLog(await git(root, ["log", "-n", "200", LOG_FORMAT, "--", "."]).catch(() => "")),
55
+ async snapshot(message, by) {
56
+ await assertBranch();
57
+ await git(root, ["add", "--all", "--", "."]);
58
+ if (!(await changed()))
59
+ throw new Error("Nothing has changed since the last snapshot");
60
+ return commit(message, by);
61
+ },
62
+ async restore(id) {
63
+ if (!/^[0-9a-f]{40}([0-9a-f]{24})?$/.test(id))
64
+ throw new Error("Unknown snapshot");
65
+ await git(root, ["cat-file", "-e", `${id}^{commit}`]);
66
+ if (await changed())
67
+ throw new Error("Snapshot the current changes before restoring");
68
+ await assertBranch();
69
+ // Files added after the snapshot are tracked, so restoring removes them as well.
70
+ await git(root, ["restore", `--source=${id}`, "--staged", "--worktree", "--", "."]);
71
+ if (await changed())
72
+ await commit(`Restore snapshot ${id.slice(0, 7)}`);
73
+ },
74
+ };
75
+ };
76
+ const SNAPSHOTS = ".dooc/snapshots";
77
+ /**
78
+ * A snapshot is a copy of every managed file under `.dooc/snapshots/<id>/files`.
79
+ * shortcut: full copy per snapshot, switch to content-addressed blobs when large media makes
80
+ * the folder grow too fast.
81
+ */
82
+ export const folderHistory = (root) => {
83
+ const managed = () => [
84
+ ...new Set([
85
+ manifestFile(root),
86
+ ...projectFiles(root).map((file) => file.path),
87
+ ...translationFiles(root),
88
+ ]),
89
+ ];
90
+ const read = (id) => {
91
+ try {
92
+ const { time, message, author, coAuthors } = JSON.parse(readFileSync(join(root, SNAPSHOTS, id, "snapshot.json"), "utf8"));
93
+ return typeof time === "string" && typeof message === "string"
94
+ ? {
95
+ id,
96
+ time,
97
+ message,
98
+ ...(typeof author === "string" ? { author } : {}),
99
+ ...(Array.isArray(coAuthors) && coAuthors.length
100
+ ? { coAuthors: coAuthors.map(String) }
101
+ : {}),
102
+ }
103
+ : undefined;
104
+ }
105
+ catch {
106
+ // A half-written or foreign folder is not a snapshot.
107
+ return undefined;
108
+ }
109
+ };
110
+ const list = () => existsSync(join(root, SNAPSHOTS))
111
+ ? readdirSync(join(root, SNAPSHOTS))
112
+ .sort()
113
+ .reverse()
114
+ .flatMap((id) => read(id) ?? [])
115
+ : [];
116
+ const snapshot = (message, by = {}) => {
117
+ const time = new Date().toISOString();
118
+ // Sorts by time; the suffix separates snapshots taken within one millisecond.
119
+ const id = `${time.replace(/[-:.]/g, "")}-${randomBytes(3).toString("hex")}`;
120
+ const directory = join(root, SNAPSHOTS, id);
121
+ for (const file of managed()) {
122
+ const source = textfilePath(root, file);
123
+ if (!existsSync(source))
124
+ continue;
125
+ mkdirSync(dirname(join(directory, "files", file)), { recursive: true });
126
+ cpSync(source, join(directory, "files", file));
127
+ }
128
+ mkdirSync(directory, { recursive: true });
129
+ // Written last: a snapshot without it is ignored, so an interrupted copy never lists.
130
+ const author = by.author?.name;
131
+ writeFileSync(join(directory, "snapshot.json"), JSON.stringify({ time, message, author, coAuthors: by.coAuthors?.map((p) => p.name) }));
132
+ return { id, time, message, ...(author ? { author } : {}) };
133
+ };
134
+ const prepareRestore = (files) => {
135
+ const current = new Set(managed());
136
+ const kept = new Set(readdirSync(files, { recursive: true, withFileTypes: true })
137
+ .filter((entry) => entry.isFile())
138
+ .map((entry) => relative(files, join(entry.parentPath, entry.name)).replaceAll("\\", "/")));
139
+ const directories = new Set();
140
+ for (const file of kept) {
141
+ const parts = file.split("/");
142
+ for (let i = 1; i <= parts.length; i++) {
143
+ const path = parts.slice(0, i).join("/");
144
+ const entry = lstatSync(join(root, path), { throwIfNoEntry: false });
145
+ if (!entry)
146
+ break;
147
+ if (!entry.isDirectory()) {
148
+ if (!entry.isFile() || !current.has(path))
149
+ throw new Error(`Restore would overwrite an unmanaged file: ${path}`);
150
+ break;
151
+ }
152
+ if (i !== parts.length)
153
+ continue;
154
+ directories.add(path);
155
+ for (const child of readdirSync(join(root, path), {
156
+ recursive: true,
157
+ withFileTypes: true,
158
+ })) {
159
+ const name = relative(root, join(child.parentPath, child.name)).replaceAll("\\", "/");
160
+ if (child.isDirectory())
161
+ directories.add(name);
162
+ else if (!child.isFile() || !current.has(name))
163
+ throw new Error(`Restore would overwrite an unmanaged file: ${name}`);
164
+ }
165
+ }
166
+ }
167
+ return () => {
168
+ for (const file of current)
169
+ if (!kept.has(file))
170
+ rmSync(textfilePath(root, file), { force: true });
171
+ for (const directory of [...directories].sort((a, b) => b.length - a.length))
172
+ rmdirSync(join(root, directory));
173
+ for (const file of kept) {
174
+ const target = textfilePath(root, file);
175
+ mkdirSync(dirname(target), { recursive: true });
176
+ cpSync(join(files, file), target);
177
+ }
178
+ };
179
+ };
180
+ return {
181
+ list: async () => list(),
182
+ snapshot: async (message, by) => snapshot(message, by),
183
+ async restore(id) {
184
+ if (!/^[\w-]+$/.test(id) || !read(id))
185
+ throw new Error("Unknown snapshot");
186
+ const restore = prepareRestore(join(root, SNAPSHOTS, id, "files"));
187
+ // There is no working-tree check here, so the current state is kept as a snapshot.
188
+ const backup = snapshot(`Before restoring ${id}`);
189
+ try {
190
+ restore();
191
+ }
192
+ catch (error) {
193
+ try {
194
+ prepareRestore(join(root, SNAPSHOTS, backup.id, "files"))();
195
+ }
196
+ catch (rollback) {
197
+ throw new AggregateError([error, rollback], `Restore failed; recover the saved files from ${SNAPSHOTS}/${backup.id}`);
198
+ }
199
+ throw error;
200
+ }
201
+ },
202
+ };
203
+ };
204
+ /** Chosen per request, so `git init` in a running workspace switches the driver. */
205
+ export const workspaceHistory = (root, branch) => readWorkspaceSource(root).protocol === "git" ? gitHistory(root, branch) : folderHistory(root);
@@ -1,7 +1,3 @@
1
- import type { ServerResponse } from "node:http";
2
- import type { ServeMode } from "./serve.js";
3
- /** SSE endpoint. SoT for the server route and the client script's connection target. */
4
- export declare const HMR_PATH = "/api/hmr";
5
1
  /** Kind of change — content = main data, client = edit's client bundle (needs a reload). */
6
2
  export type HmrKind = "content" | "client";
7
3
  /**
@@ -9,8 +5,6 @@ export type HmrKind = "content" | "client";
9
5
  * (dist output, temp files etc.).
10
6
  */
11
7
  export declare const classifyChange: (rel: string) => HmrKind | undefined;
12
- /** One SSE frame (in the format the client's EventSource reads). */
13
- export declare const sseFrame: (event: string, data: unknown) => string;
14
8
  /**
15
9
  * Notification hooks the client script puts on `window.__docsHmr` (contract with edit-client.ts).
16
10
  * setDirty = shares the unsaved state,
@@ -22,12 +16,6 @@ export interface HmrBridge {
22
16
  onContent?: (files: string[]) => void;
23
17
  updatePreview?: (target: HTMLElement, source: HTMLElement) => void;
24
18
  }
25
- export interface HmrHub {
26
- /** GET /api/hmr — holds the connection and keeps pushing broadcasts to it. */
27
- handle: (res: ServerResponse) => void;
28
- broadcast: (kind: HmrKind, files: string[]) => void;
29
- }
30
- export declare const createHmrHub: (bootId: string) => HmrHub;
31
19
  /**
32
20
  * Folders to watch. The docs-side ones are relative to docsRoot, src to pkgRoot (only files that
33
21
  * classifyChange marks "client" count).
@@ -41,13 +29,3 @@ export declare const watchProject: (docsRoot: string, pkgRoot: string, onChange:
41
29
  close: () => void;
42
30
  watchTextfiles: (files: Iterable<string>) => void;
43
31
  };
44
- /**
45
- * Client script injected into page(). How changes are applied depends on mode:
46
- * preview = swap the main <main> + nav (keeping scroll / sidebar state).
47
- * edit = delegate content changes to `window.__docsHmr.onContent` (registered by
48
- * edit-client.ts) without reloading (pages without it, e.g. the new page, reload).
49
- * Changes to the client bundle (`src/viewer/edit-client.ts` / `src/core/*.tsx`) and
50
- * a bootId difference in `hello` (= the server itself restarted) reload. While there
51
- * are unsaved (dirty) changes, the reload is downgraded to a badge and waits.
52
- */
53
- export declare const hmrClientScript: (mode: ServeMode) => string;