soma-core 2.0.1 → 2.1.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 (161) hide show
  1. package/README.md +2 -2
  2. package/bin/eject.cjs +5 -5
  3. package/bin/soma-runtime.cjs +5 -123
  4. package/bin/soma.cjs +2 -2
  5. package/bin/soma.ts +8 -20
  6. package/core/build/compiler/page-declaration-compiler.ts +5 -6
  7. package/core/build/lsp/soma-declaration.cjs +0 -6
  8. package/core/client/container/SomaContainerAdapter.ts +1 -1
  9. package/core/client/data/region-scope-views.ts +1 -1
  10. package/core/client/engine/event-engine.ts +1 -6
  11. package/core/client/engine/soma-bootstrap.ts +5 -13
  12. package/core/client/host-bridge/soma-bootstrap-from-app.ts +2 -2
  13. package/core/client/infra/i18n/II18n.ts +5 -6
  14. package/core/client/infra/i18n/locale-catalog.ts +8 -5
  15. package/core/client/infra/identity/identity-port.ts +1 -1
  16. package/core/client/keyboard/index.ts +0 -1
  17. package/core/client/keyboard/wiring.ts +0 -3
  18. package/core/client/parser/ui-config-parser.ts +6 -9
  19. package/core/client/registry/declaration-renderer.ts +1 -1
  20. package/core/client/runtime/SomaRuntimeServices.ts +1 -1
  21. package/core/inspect/check-runtime.ts +2 -3
  22. package/core/server/host/content-security-policy.ts +2 -11
  23. package/core/server/host/host-assembly-entry.ts +10 -2
  24. package/core/server/host/host-assembly.ts +28 -10
  25. package/core/server/host/host-caller.ts +52 -0
  26. package/core/server/host/host-response-headers.ts +49 -0
  27. package/core/server/host/locale-yaml.ts +7 -5
  28. package/core/server/host/published-page-assets.ts +1 -1
  29. package/core/server/host/resolve-host-request-hook.ts +2 -11
  30. package/core/server/host/resolve-host-tree-context.ts +7 -41
  31. package/core/server/host/server-page-assets.ts +0 -22
  32. package/core/server/host/source-packages.cjs +3 -4
  33. package/core/server/host/virtual-pages.ts +12 -70
  34. package/core/server/index.ts +1 -3
  35. package/core/server/node.ts +0 -1
  36. package/core/server/page-assets.ts +2 -20
  37. package/core/server/page-declaration.ts +1 -1
  38. package/core/server/registry/api-registry-store.ts +5 -25
  39. package/core/server/registry/asset-store.ts +5 -23
  40. package/core/server/registry/page-registry-repository.ts +9 -13
  41. package/core/server/registry/page-registry-store.ts +44 -82
  42. package/core/server/registry/publish-asset-pin.ts +3 -4
  43. package/core/server/registry/registry-subjects.ts +6 -6
  44. package/core/server/registry/rollback-plan.ts +5 -8
  45. package/core/server/registry/source/version-store.ts +8 -30
  46. package/core/server/registry/standard-product.ts +1 -1
  47. package/core/server/runtime-space/bindings.ts +1 -4
  48. package/core/server/runtime-space/gc.ts +2 -3
  49. package/core/server/runtime-space/inject.ts +4 -5
  50. package/core/server/runtime-space/resolve.ts +13 -27
  51. package/core/server/runtime-space/root.cjs +9 -100
  52. package/core/server/runtime-space/root.ts +3 -23
  53. package/core/server/runtime-space/types.ts +0 -11
  54. package/core/shared/artifact-compatibility.ts +6 -16
  55. package/core/shared/component-tree-artifact.ts +4 -8
  56. package/core/shared/core-diagnostic-codes.ts +1 -3
  57. package/core/shared/pipeline-error-codes-view.ts +1 -2
  58. package/core/shared/published-page-route.ts +1 -6
  59. package/core/shared/registry-generated/diagnostic-registry-index.ts +0 -2
  60. package/core/shared/registry-generated/diagnostic-registry.ts +0 -14
  61. package/core/shared/source-file-suffix.ts +8 -0
  62. package/core/shared/types/component-tree-artifact.types.ts +2 -15
  63. package/core/shared/types/host-assembly.types.ts +31 -2
  64. package/core/shared/types/locale.types.ts +3 -3
  65. package/core/shared/types/region-scope.types.ts +1 -1
  66. package/core/shared/types/ui-config.types.ts +2 -7
  67. package/core/shared/types/write.types.ts +1 -1
  68. package/dist/browser/soma-runtime.js +20 -36
  69. package/dist/cli/soma.js +8 -21
  70. package/dist/core/index.cjs +20 -38
  71. package/dist/lsp/component-tree.cjs +7 -14
  72. package/dist/types/client/container/SomaContainerAdapter.d.ts +1 -1
  73. package/dist/types/client/engine/event-engine.d.ts +0 -2
  74. package/dist/types/client/engine/soma-bootstrap.d.ts +2 -3
  75. package/dist/types/client/host-bridge/soma-bootstrap-from-app.d.ts +2 -2
  76. package/dist/types/client/infra/i18n/II18n.d.ts +5 -6
  77. package/dist/types/client/infra/i18n/locale-catalog.d.ts +3 -3
  78. package/dist/types/client/infra/identity/identity-port.d.ts +1 -1
  79. package/dist/types/client/keyboard/index.d.ts +1 -1
  80. package/dist/types/client/keyboard/wiring.d.ts +0 -2
  81. package/dist/types/client/registry/declaration-renderer.d.ts +1 -1
  82. package/dist/types/client/runtime/SomaRuntimeServices.d.ts +1 -1
  83. package/dist/types/server/host/content-security-policy.d.ts +0 -5
  84. package/dist/types/server/host/host-assembly-entry.d.ts +5 -2
  85. package/dist/types/server/host/host-assembly.d.ts +9 -4
  86. package/dist/types/server/host/host-caller.d.ts +10 -0
  87. package/dist/types/server/host/host-response-headers.d.ts +16 -0
  88. package/dist/types/server/host/published-page-assets.d.ts +1 -1
  89. package/dist/types/server/host/resolve-host-request-hook.d.ts +0 -4
  90. package/dist/types/server/host/resolve-host-tree-context.d.ts +1 -1
  91. package/dist/types/server/host/server-page-assets.d.ts +0 -2
  92. package/dist/types/server/host/virtual-pages.d.ts +4 -14
  93. package/dist/types/server/index.d.ts +1 -2
  94. package/dist/types/server/node.d.ts +1 -1
  95. package/dist/types/server/page-assets.d.ts +1 -4
  96. package/dist/types/server/page-declaration.d.ts +1 -1
  97. package/dist/types/server/registry/api-registry-store.d.ts +1 -6
  98. package/dist/types/server/registry/asset-store.d.ts +2 -11
  99. package/dist/types/server/registry/page-registry-repository.d.ts +4 -4
  100. package/dist/types/server/registry/page-registry-store.d.ts +22 -30
  101. package/dist/types/server/registry/registry-subjects.d.ts +2 -2
  102. package/dist/types/server/registry/rollback-plan.d.ts +0 -3
  103. package/dist/types/server/registry/source/version-store.d.ts +1 -9
  104. package/dist/types/server/registry/standard-product.d.ts +1 -1
  105. package/dist/types/server/runtime-space/resolve.d.ts +0 -3
  106. package/dist/types/server/runtime-space/root.d.cts +6 -29
  107. package/dist/types/server/runtime-space/root.d.ts +2 -7
  108. package/dist/types/server/runtime-space/types.d.ts +0 -9
  109. package/dist/types/shared/artifact-compatibility.d.ts +1 -3
  110. package/dist/types/shared/core-diagnostic-codes.d.ts +1 -1
  111. package/dist/types/shared/published-page-route.d.ts +1 -3
  112. package/dist/types/shared/registry-generated/diagnostic-registry.d.ts +0 -12
  113. package/dist/types/shared/types/component-tree-artifact.types.d.ts +2 -15
  114. package/dist/types/shared/types/host-assembly.types.d.ts +27 -1
  115. package/dist/types/shared/types/locale.types.d.ts +1 -1
  116. package/dist/types/shared/types/region-scope.types.d.ts +1 -1
  117. package/dist/types/shared/types/ui-config.types.d.ts +2 -7
  118. package/dist/types/shared/types/write.types.d.ts +1 -1
  119. package/global.d.ts +0 -9
  120. package/host-next/app/SomaPageClient.tsx +359 -0
  121. package/host-next/app/[...path]/page.tsx +22 -0
  122. package/host-next/app/api/[...path]/route.ts +98 -0
  123. package/host-next/app/api/soma-registry/[...path]/route.ts +79 -0
  124. package/host-next/app/components/SomaHostPage.tsx +128 -0
  125. package/host-next/app/components/SomaHydrationShell.tsx +20 -0
  126. package/host-next/app/components/SomaPageClientBoundary.tsx +13 -0
  127. package/host-next/app/components/SomaPageForbidden.tsx +19 -0
  128. package/host-next/app/favicon.ico/route.ts +13 -0
  129. package/host-next/app/globals.css +177 -0
  130. package/host-next/app/layout.tsx +27 -0
  131. package/host-next/app/page-access.ts +47 -0
  132. package/host-next/app/page.tsx +9 -0
  133. package/host-next/app/router-bridge.ts +42 -0
  134. package/host-next/app/soma/[...path]/route.ts +9 -0
  135. package/host-next/app/soma/_shared/host-prepare.ts +33 -0
  136. package/host-next/app/soma/_shared/page-http.ts +86 -0
  137. package/host-next/app/soma/manifest/route.ts +98 -0
  138. package/host-next/app/soma/page/route.ts +36 -0
  139. package/host-next/app/soma/route.ts +9 -0
  140. package/host-next/app/soma-runtime/[...file]/route.ts +21 -0
  141. package/host-next/app/soma-runtime/_shared/static-file.ts +89 -0
  142. package/host-next/bin/host-next.cjs +59 -0
  143. package/host-next/instrumentation.ts +13 -0
  144. package/host-next/next-env.d.ts +7 -0
  145. package/host-next/next.config.js +382 -0
  146. package/host-next/proxy.ts +43 -0
  147. package/host-next/src/shell-routes.cjs +51 -0
  148. package/host-next/src/workspace.ts +543 -0
  149. package/package.json +29 -4
  150. package/tsconfig.json +2 -1
  151. package/core/server/host/page-response-mode.cjs +0 -96
  152. package/core/server/host/page-response-request.ts +0 -33
  153. package/core/server/host/request-origin.ts +0 -18
  154. package/core/server/host/soma-request-hook-host.stub.ts +0 -4
  155. package/core/server/runtime-space/migrate-sources.ts +0 -124
  156. package/core/shared/source-compat.ts +0 -9
  157. package/dist/types/server/host/page-response-request.d.ts +0 -8
  158. package/dist/types/server/host/request-origin.d.ts +0 -1
  159. package/dist/types/server/host/soma-request-hook-host.stub.d.ts +0 -2
  160. package/dist/types/server/runtime-space/migrate-sources.d.ts +0 -19
  161. /package/dist/types/shared/{source-compat.d.ts → source-file-suffix.d.ts} +0 -0
@@ -1,96 +0,0 @@
1
- const fs = require('node:fs');
2
- const yaml = require('js-yaml');
3
- const {
4
- readSomaEnv,
5
- resolveHostAppConfigPath,
6
- } = require('./host-config-paths.cjs');
7
-
8
- const PAGE_RESPONSE_MODES = new Set(['html', 'json']);
9
-
10
- class SomaPageResponseModeConfigError extends Error {
11
- constructor(code, message, configPath) {
12
- super(message);
13
- this.name = 'SomaPageResponseModeConfigError';
14
- this.code = code;
15
- this.configPath = configPath;
16
- }
17
- }
18
-
19
- function isRecord(value) {
20
- return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
21
- }
22
-
23
- function readSomaPageResponseMode(hostDir, env = process.env) {
24
- const environment = readSomaEnv(env);
25
- const configPath = resolveHostAppConfigPath(hostDir, environment);
26
- if (!configPath) {
27
- return { mode: 'html', environment, configPath: null };
28
- }
29
-
30
- let document;
31
- try {
32
- document = yaml.load(fs.readFileSync(configPath, 'utf8')) ?? {};
33
- } catch (error) {
34
- const detail = error instanceof Error ? error.message : String(error);
35
- throw new SomaPageResponseModeConfigError(
36
- 'SOMA_PAGE_RESPONSE_CONFIG_INVALID',
37
- 'Cannot read App config for page response mode: ' + detail,
38
- configPath,
39
- );
40
- }
41
-
42
- if (!isRecord(document)) {
43
- throw new SomaPageResponseModeConfigError(
44
- 'SOMA_PAGE_RESPONSE_CONFIG_INVALID',
45
- 'App config must be a YAML object: ' + configPath,
46
- configPath,
47
- );
48
- }
49
-
50
- const somaConfig = document.soma;
51
- if (somaConfig === undefined || somaConfig === null) {
52
- return { mode: 'html', environment, configPath };
53
- }
54
- if (!isRecord(somaConfig)) {
55
- throw new SomaPageResponseModeConfigError(
56
- 'SOMA_PAGE_RESPONSE_CONFIG_INVALID',
57
- 'App config field "soma" must be an object: ' + configPath,
58
- configPath,
59
- );
60
- }
61
-
62
- const rawMode = somaConfig.pageResponseMode;
63
- if (rawMode === undefined || rawMode === null || rawMode === '') {
64
- return { mode: 'html', environment, configPath };
65
- }
66
- if (typeof rawMode !== 'string') {
67
- throw new SomaPageResponseModeConfigError(
68
- 'SOMA_PAGE_RESPONSE_MODE_INVALID',
69
- 'App config field "soma.pageResponseMode" must be "html" or "json": ' + configPath,
70
- configPath,
71
- );
72
- }
73
-
74
- const mode = rawMode.trim().toLowerCase();
75
- if (!PAGE_RESPONSE_MODES.has(mode)) {
76
- throw new SomaPageResponseModeConfigError(
77
- 'SOMA_PAGE_RESPONSE_MODE_INVALID',
78
- 'Unsupported soma.pageResponseMode "' + rawMode + '"; expected "html" or "json": ' + configPath,
79
- configPath,
80
- );
81
- }
82
- if (mode === 'json' && environment !== 'test') {
83
- throw new SomaPageResponseModeConfigError(
84
- 'SOMA_PAGE_RESPONSE_MODE_PRODUCTION_FORBIDDEN',
85
- 'soma.pageResponseMode=json is test-only and cannot run in production: ' + configPath,
86
- configPath,
87
- );
88
- }
89
-
90
- return { mode, environment, configPath };
91
- }
92
-
93
- module.exports = {
94
- SomaPageResponseModeConfigError,
95
- readSomaPageResponseMode,
96
- };
@@ -1,33 +0,0 @@
1
- export const SOMA_PAGE_REQUEST_URL_HEADER = 'x-soma-page-request-url';
2
-
3
- export function isJsonPageResponseMode(mode: string | undefined): boolean {
4
- return mode?.trim().toLowerCase() === 'json';
5
- }
6
-
7
- export function isSomaPageRequestPath(pathname: string): boolean {
8
- const normalized = pathname.startsWith('/') ? pathname : '/' + pathname;
9
- const firstSegment = normalized.split('/').filter(Boolean)[0] ?? '';
10
- if (firstSegment === 'api' || firstSegment === 'soma' || firstSegment === '_next') {
11
- return false;
12
- }
13
-
14
- const lastSegment = normalized.split('/').filter(Boolean).at(-1) ?? '';
15
- if (lastSegment === 'favicon.ico') {
16
- return false;
17
- }
18
- const extension = lastSegment.match(/\.([^./]+)$/)?.[1]?.toLowerCase();
19
- return !extension || extension === 'html';
20
- }
21
-
22
- export function shouldUseJsonPageResponse(options: {
23
- mode: string | undefined;
24
- method: string;
25
- pathname: string;
26
- }): boolean {
27
- const method = options.method.toUpperCase();
28
- return (
29
- isJsonPageResponseMode(options.mode)
30
- && (method === 'GET' || method === 'HEAD')
31
- && isSomaPageRequestPath(options.pathname)
32
- );
33
- }
@@ -1,18 +0,0 @@
1
- function firstForwardedValue(value: string | null): string {
2
- return value?.split(',')[0]?.trim() ?? '';
3
- }
4
-
5
- export function resolveSomaRequestOrigin(requestHeaders: Headers): string {
6
- const host = firstForwardedValue(requestHeaders.get('x-forwarded-host'))
7
- || firstForwardedValue(requestHeaders.get('host'))
8
- || 'localhost';
9
- const closingBracket = host.indexOf(']');
10
- const hostname = (host.startsWith('[') && closingBracket > 0
11
- ? host.slice(1, closingBracket)
12
- : host.split(':')[0]).toLowerCase();
13
- const forwardedProtocol = firstForwardedValue(requestHeaders.get('x-forwarded-proto'));
14
- const protocol = forwardedProtocol === 'http' || forwardedProtocol === 'https'
15
- ? forwardedProtocol
16
- : (hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '::1' ? 'http' : 'https');
17
- return protocol + '://' + host;
18
- }
@@ -1,4 +0,0 @@
1
- import type { SomaRequestHook } from './resolve-host-request-hook';
2
-
3
- export const somaRequestHook: SomaRequestHook | undefined = undefined;
4
-
@@ -1,124 +0,0 @@
1
- // `soma runtime migrate` 的源附件步骤(AD-46 ①,C6-e):把旧后缀 `.biz.json` 与旧目录键 `biz` 搬到新名。
2
- //
3
- // · 旧后缀:`dirs.sources` 里的 `<键>.biz.json` 改名为 `<键>.source.json`;
4
- // · 旧目录:`layout.legacy.sources`(盘上 `registry/biz`、旧位置 `data/soma-runtime/biz`、页面别名同级的 `../biz`)里的文件
5
- // 搬进 `dirs.sources`,搬的同时按新后缀命名。
6
- //
7
- // 纪律(幂等、中途失败不丢数据):
8
- // · 单文件用 rename(同目录同卷原子),跨卷先拷贝到目标目录里的 `.tmp` 再 rename、最后才删源——任何一步失败,源文件都还在;
9
- // · 目标已存在且字节相同 -> 视为已迁移,删旧副本;目标已存在且内容不同 -> 不覆盖、旧文件保留、记冲突(调用方退出码 1);
10
- // · 只处理 `.biz.json`(以及旧目录里的其它文件原名搬运),不碰 `.lock` / `.tmp`;
11
- // · 重复执行:第二次没有旧后缀文件、旧目录已空,什么都不做。
12
- //
13
- // 纯 fs 实现,无 core 其他依赖(bin/soma-runtime.cjs 经 jiti 载入)。
14
-
15
- import fs from 'node:fs';
16
- import path from 'node:path';
17
- import { SOMA_SOURCE_FILE_SUFFIX } from '../../shared/source-compat';
18
-
19
- /** 盘上旧后缀:只在本迁移工具里读取并改名,运行时存储不识别 */
20
- const SOMA_OLD_SOURCE_FILE_SUFFIX = '.biz.json';
21
-
22
- export interface SomaSourceMigrateItem {
23
- readonly from: string;
24
- readonly to: string;
25
- }
26
-
27
- export interface SomaSourceMigrateReport {
28
- /** 已搬(dry-run 时为将搬) */
29
- readonly moved: readonly SomaSourceMigrateItem[];
30
- /** 目标已存在且字节相同:旧副本已删(dry-run 时为将删)的文件数 */
31
- readonly identical: number;
32
- /** 目标已存在且内容不同:未覆盖,旧文件保留 */
33
- readonly conflicts: readonly SomaSourceMigrateItem[];
34
- }
35
-
36
- function walk(dir: string, base: string = dir): string[] {
37
- let entries: fs.Dirent[];
38
- try {
39
- entries = fs.readdirSync(dir, { withFileTypes: true });
40
- } catch {
41
- return [];
42
- }
43
- const out: string[] = [];
44
- for (const entry of entries) {
45
- const full = path.join(dir, entry.name);
46
- if (entry.isDirectory()) out.push(...walk(full, base));
47
- else if (entry.isFile() && !entry.name.endsWith('.lock') && !entry.name.endsWith('.tmp')) out.push(path.relative(base, full));
48
- }
49
- return out;
50
- }
51
-
52
- /** 新后缀名:`x.biz.json` -> `x.source.json`;其它文件名原样 */
53
- export function sourceFileNameOf(relative: string): string {
54
- return relative.endsWith(SOMA_OLD_SOURCE_FILE_SUFFIX)
55
- ? `${relative.slice(0, -SOMA_OLD_SOURCE_FILE_SUFFIX.length)}${SOMA_SOURCE_FILE_SUFFIX}`
56
- : relative;
57
- }
58
-
59
- /** 搬一个文件:同卷 rename;跨卷 拷贝到 `.tmp` -> rename -> 删源。任何一步抛错,源文件都还在 */
60
- function moveFileSafely(from: string, to: string): void {
61
- fs.mkdirSync(path.dirname(to), { recursive: true });
62
- try {
63
- fs.renameSync(from, to);
64
- return;
65
- } catch (error) {
66
- if ((error as NodeJS.ErrnoException).code !== 'EXDEV') throw error;
67
- }
68
- const temp = `${to}.${process.pid}.tmp`;
69
- fs.copyFileSync(from, temp);
70
- fs.renameSync(temp, to);
71
- fs.unlinkSync(from);
72
- }
73
-
74
- function removeEmptyDirs(dir: string): void {
75
- let entries: fs.Dirent[];
76
- try {
77
- entries = fs.readdirSync(dir, { withFileTypes: true });
78
- } catch {
79
- return;
80
- }
81
- for (const entry of entries) if (entry.isDirectory()) removeEmptyDirs(path.join(dir, entry.name));
82
- try {
83
- if (fs.readdirSync(dir).length === 0) fs.rmdirSync(dir);
84
- } catch {
85
- /* 非空或并发:保留 */
86
- }
87
- }
88
-
89
- /**
90
- * @param targetDir 新目录(`layout.dirs.sources`)
91
- * @param legacyDirs 旧目录候选(`layout.legacy.sources`)
92
- */
93
- export function migrateSourceFiles(targetDir: string, legacyDirs: readonly string[], dryRun: boolean): SomaSourceMigrateReport {
94
- const moved: SomaSourceMigrateItem[] = [];
95
- const conflicts: SomaSourceMigrateItem[] = [];
96
- let identical = 0;
97
-
98
- const relocate = (from: string, to: string): void => {
99
- if (fs.existsSync(to)) {
100
- if (fs.readFileSync(from).equals(fs.readFileSync(to))) {
101
- identical += 1;
102
- if (!dryRun) fs.unlinkSync(from);
103
- } else {
104
- conflicts.push({ from, to });
105
- }
106
- return;
107
- }
108
- moved.push({ from, to });
109
- if (!dryRun) moveFileSafely(from, to);
110
- };
111
-
112
- // 1) 旧目录 -> 新目录(顺带改后缀)
113
- for (const legacy of legacyDirs) {
114
- if (path.resolve(legacy) === path.resolve(targetDir)) continue;
115
- for (const relative of walk(legacy)) relocate(path.join(legacy, relative), path.join(targetDir, sourceFileNameOf(relative)));
116
- if (!dryRun) removeEmptyDirs(legacy);
117
- }
118
- // 2) 新目录里残留的旧后缀(含第 1 步搬来的、以及早先版本在新目录里写下的)就地改名
119
- for (const relative of walk(targetDir)) {
120
- if (!relative.endsWith(SOMA_OLD_SOURCE_FILE_SUFFIX)) continue;
121
- relocate(path.join(targetDir, relative), path.join(targetDir, sourceFileNameOf(relative)));
122
- }
123
- return { moved, identical, conflicts };
124
- }
@@ -1,9 +0,0 @@
1
- // 源附件落盘后缀的中性名(AD-46 ①,看板 C6-e)。
2
- //
3
- // 现名:落盘后缀 `.source.json`、runtime 目录键 `sources`、限值 `cache.sourceAssetCapacity`、码表族 `sourceRegistry` / 码前缀 `SOURCE_*`。
4
- // 旧名运行时一律不再识别,按「不存在 / 未知键」处理;盘上旧文件改名只由迁移工具(`runtime-space/migrate-sources.ts`)自带的常量处理。
5
- //
6
- // 本文件无 DOM、无 node 依赖。
7
-
8
- /** 落盘 / 对象键后缀 */
9
- export const SOMA_SOURCE_FILE_SUFFIX = '.source.json';
@@ -1,8 +0,0 @@
1
- export declare const SOMA_PAGE_REQUEST_URL_HEADER = "x-soma-page-request-url";
2
- export declare function isJsonPageResponseMode(mode: string | undefined): boolean;
3
- export declare function isSomaPageRequestPath(pathname: string): boolean;
4
- export declare function shouldUseJsonPageResponse(options: {
5
- mode: string | undefined;
6
- method: string;
7
- pathname: string;
8
- }): boolean;
@@ -1 +0,0 @@
1
- export declare function resolveSomaRequestOrigin(requestHeaders: Headers): string;
@@ -1,2 +0,0 @@
1
- import type { SomaRequestHook } from './resolve-host-request-hook';
2
- export declare const somaRequestHook: SomaRequestHook | undefined;
@@ -1,19 +0,0 @@
1
- export interface SomaSourceMigrateItem {
2
- readonly from: string;
3
- readonly to: string;
4
- }
5
- export interface SomaSourceMigrateReport {
6
- /** 已搬(dry-run 时为将搬) */
7
- readonly moved: readonly SomaSourceMigrateItem[];
8
- /** 目标已存在且字节相同:旧副本已删(dry-run 时为将删)的文件数 */
9
- readonly identical: number;
10
- /** 目标已存在且内容不同:未覆盖,旧文件保留 */
11
- readonly conflicts: readonly SomaSourceMigrateItem[];
12
- }
13
- /** 新后缀名:`x.biz.json` -> `x.source.json`;其它文件名原样 */
14
- export declare function sourceFileNameOf(relative: string): string;
15
- /**
16
- * @param targetDir 新目录(`layout.dirs.sources`)
17
- * @param legacyDirs 旧目录候选(`layout.legacy.sources`)
18
- */
19
- export declare function migrateSourceFiles(targetDir: string, legacyDirs: readonly string[], dryRun: boolean): SomaSourceMigrateReport;