soma-core 2.2.7 → 2.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/build/compiler/full-manifest-builder.ts +1 -1
- package/core/build/compiler/host-config-sync.cjs +1 -1
- package/core/build/compiler/soma-manifest-webpack-plugin.js +2 -6
- package/core/build/compiler/soma-precompile.js +80 -4
- package/core/client/a11y/announcer.ts +2 -16
- package/core/client/base/SomaPageRootBase.ts +2 -2
- package/core/client/base/defineSomaView.ts +11 -2
- package/core/client/base/runtime-services.types.ts +57 -0
- package/core/client/data/data-object-resolver.ts +36 -5
- package/core/client/data/role-gate.ts +2 -8
- package/core/client/engine/event-engine.ts +1 -0
- package/core/client/engines/chart/adapter-echarts.ts +75 -2
- package/core/client/engines/chart/index.ts +18 -0
- package/core/client/engines/chart/port.ts +13 -0
- package/core/client/engines/diff/adapter-jsdiff.ts +27 -8
- package/core/client/engines/diff/index.ts +81 -6
- package/core/client/engines/diff/items.ts +212 -0
- package/core/client/engines/diff/port.ts +140 -3
- package/core/client/engines/diff/prose.ts +443 -0
- package/core/client/engines/engine-adapters.ts +6 -0
- package/core/client/engines/highlight/adapter-lezer.ts +109 -0
- package/core/client/engines/highlight/index.ts +135 -0
- package/core/client/engines/highlight/port.ts +92 -0
- package/core/client/engines/markdown/adapter-markdown-it.ts +65 -0
- package/core/client/engines/markdown/blocks.ts +335 -0
- package/core/client/engines/markdown/index.ts +51 -0
- package/core/client/engines/markdown/port.ts +94 -0
- package/core/client/engines/markdown/vendor-modules.d.ts +6 -0
- package/core/client/engines/structured/adapter-js-yaml.ts +33 -0
- package/core/client/engines/structured/index.ts +139 -0
- package/core/client/engines/structured/port.ts +59 -0
- package/core/client/infra/http/SomaHttpService.ts +2 -4
- package/core/client/infra/notify/DefaultNotifyService.ts +2 -3
- package/core/client/infra/permission/SomaPermission.ts +1 -1
- package/core/client/render-ports/notify-renderer.ts +2 -46
- package/core/client/runtime/SomaRuntimeServices.ts +16 -45
- package/core/server/host/app-config-composer.ts +6 -52
- package/core/server/host/host-config-paths.cjs +2 -100
- package/core/server/host/precompiled-manifest.ts +69 -0
- package/core/server/infra/host-config-paths.cjs +100 -0
- package/core/server/page-assets.ts +2 -70
- package/core/server/runtime-space/bindings.ts +76 -1
- package/core/server/runtime-space/digest.ts +6 -0
- package/core/server/runtime-space/index.ts +1 -1
- package/core/server/runtime-space/prewarm.ts +8 -8
- package/core/server/runtime-space/store.ts +23 -7
- package/core/server/runtime-space/types.ts +3 -2
- package/core/shared/app-config-merge.ts +59 -0
- package/core/shared/registry-generated/limits.ts +80 -4
- package/core/shared/types/announcer.types.ts +18 -0
- package/core/shared/types/notify.types.ts +26 -0
- package/core/shared/types/role-gate.types.ts +11 -0
- package/dist/browser/runtime-bundle.manifest.json +50 -7
- package/dist/browser/soma-runtime.js +120022 -103991
- package/dist/core/index.cjs +113888 -97846
- package/dist/host-native/aot-builder.cjs +277 -189
- package/dist/host-native/native-server.cjs +245 -84
- package/dist/lsp/component-tree.cjs +80 -4
- package/dist/types/build/compiler/full-manifest-builder.d.ts +1 -1
- package/dist/types/client/a11y/announcer.d.ts +2 -14
- package/dist/types/client/base/SomaPageRootBase.d.ts +2 -2
- package/dist/types/client/base/runtime-services.types.d.ts +50 -0
- package/dist/types/client/data/role-gate.d.ts +2 -8
- package/dist/types/client/engines/chart/index.d.ts +1 -1
- package/dist/types/client/engines/chart/port.d.ts +15 -0
- package/dist/types/client/engines/diff/index.d.ts +1 -1
- package/dist/types/client/engines/diff/items.d.ts +24 -0
- package/dist/types/client/engines/diff/port.d.ts +124 -2
- package/dist/types/client/engines/diff/prose.d.ts +80 -0
- package/dist/types/client/engines/engine-adapters.d.ts +6 -0
- package/dist/types/client/engines/highlight/adapter-lezer.d.ts +6 -0
- package/dist/types/client/engines/highlight/index.d.ts +15 -0
- package/dist/types/client/engines/highlight/port.d.ts +64 -0
- package/dist/types/client/engines/markdown/adapter-markdown-it.d.ts +6 -0
- package/dist/types/client/engines/markdown/blocks.d.ts +29 -0
- package/dist/types/client/engines/markdown/index.d.ts +9 -0
- package/dist/types/client/engines/markdown/port.d.ts +166 -0
- package/dist/types/client/engines/structured/adapter-js-yaml.d.ts +6 -0
- package/dist/types/client/engines/structured/index.d.ts +29 -0
- package/dist/types/client/engines/structured/port.d.ts +45 -0
- package/dist/types/client/infra/http/SomaHttpService.d.ts +1 -1
- package/dist/types/client/infra/notify/DefaultNotifyService.d.ts +2 -3
- package/dist/types/client/infra/permission/SomaPermission.d.ts +1 -1
- package/dist/types/client/render-ports/notify-renderer.d.ts +1 -56
- package/dist/types/client/runtime/SomaRuntimeServices.d.ts +9 -44
- package/dist/types/server/host/app-config-composer.d.ts +2 -3
- package/dist/types/server/host/host-config-paths.d.cts +2 -7
- package/dist/types/server/host/precompiled-manifest.d.ts +5 -0
- package/dist/types/server/infra/host-config-paths.d.cts +7 -0
- package/dist/types/server/page-assets.d.ts +2 -5
- package/dist/types/server/runtime-space/bindings.d.ts +9 -0
- package/dist/types/server/runtime-space/digest.d.ts +5 -0
- package/dist/types/server/runtime-space/index.d.ts +1 -1
- package/dist/types/server/runtime-space/prewarm.d.ts +2 -2
- package/dist/types/server/runtime-space/store.d.ts +4 -0
- package/dist/types/server/runtime-space/types.d.ts +3 -2
- package/dist/types/shared/app-config-merge.d.ts +3 -0
- package/dist/types/shared/registry-generated/limits.d.ts +78 -4
- package/dist/types/shared/types/announcer.types.d.ts +14 -0
- package/dist/types/shared/types/notify.types.d.ts +36 -0
- package/dist/types/shared/types/role-gate.types.d.ts +8 -0
- package/host-native/src/aot-builder.ts +12 -5
- package/host-native/src/dev-chunk-gc.ts +104 -0
- package/host-native/src/host-prepare.ts +19 -2
- package/host-native/src/manifest-http.ts +1 -1
- package/host-native/src/native-server.ts +16 -0
- package/host-native/src/page-http.ts +2 -67
- package/host-native/src/page-payload-cache.ts +68 -0
- package/package.json +16 -2
|
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// core/server/
|
|
33
|
+
// core/server/infra/host-config-paths.cjs
|
|
34
34
|
var require_host_config_paths = __commonJS({
|
|
35
|
-
"core/server/
|
|
35
|
+
"core/server/infra/host-config-paths.cjs"(exports2, module2) {
|
|
36
36
|
"use strict";
|
|
37
37
|
var fs16 = require("node:fs");
|
|
38
38
|
var path18 = require("node:path");
|
|
@@ -121,13 +121,21 @@ var require_host_config_paths = __commonJS({
|
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
|
|
124
|
+
// core/server/host/host-config-paths.cjs
|
|
125
|
+
var require_host_config_paths2 = __commonJS({
|
|
126
|
+
"core/server/host/host-config-paths.cjs"(exports2, module2) {
|
|
127
|
+
"use strict";
|
|
128
|
+
module2.exports = require_host_config_paths();
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
124
132
|
// core/server/host/source-packages.cjs
|
|
125
133
|
var require_source_packages = __commonJS({
|
|
126
134
|
"core/server/host/source-packages.cjs"(exports2, module2) {
|
|
127
135
|
"use strict";
|
|
128
136
|
var fs16 = require("node:fs");
|
|
129
137
|
var path18 = require("node:path");
|
|
130
|
-
var { getSomaHostConfigRoot: getSomaHostConfigRoot2 } =
|
|
138
|
+
var { getSomaHostConfigRoot: getSomaHostConfigRoot2 } = require_host_config_paths2();
|
|
131
139
|
var SOMA_SOURCE_PACKAGES_ENV = "SOMA_SOURCE_PACKAGES";
|
|
132
140
|
var MAX_ASSET_SOURCE_CACHE = 64;
|
|
133
141
|
var assetSourcesCache = /* @__PURE__ */ new Map();
|
|
@@ -2468,6 +2476,16 @@ var SOMA_PIPELINE_LIMITS = {
|
|
|
2468
2476
|
"file": "core/server/registry/api-registry-store.ts",
|
|
2469
2477
|
"symbol": "SOMA_PIPELINE_LIMITS"
|
|
2470
2478
|
},
|
|
2479
|
+
{
|
|
2480
|
+
"module": "soma-core",
|
|
2481
|
+
"file": "core/client/engines/diff/index.ts",
|
|
2482
|
+
"symbol": "SOMA_PIPELINE_LIMITS"
|
|
2483
|
+
},
|
|
2484
|
+
{
|
|
2485
|
+
"module": "soma-core",
|
|
2486
|
+
"file": "core/client/engines/highlight/index.ts",
|
|
2487
|
+
"symbol": "SOMA_PIPELINE_LIMITS"
|
|
2488
|
+
},
|
|
2471
2489
|
{
|
|
2472
2490
|
"module": "soma-core",
|
|
2473
2491
|
"file": "core/server/registry/page-registry-store.ts",
|
|
@@ -2770,17 +2788,17 @@ var SOMA_PIPELINE_LIMITS = {
|
|
|
2770
2788
|
},
|
|
2771
2789
|
{
|
|
2772
2790
|
"module": "soma-ai",
|
|
2773
|
-
"file": "src/
|
|
2791
|
+
"file": "src/server/common/RateLimitBackend.ts",
|
|
2774
2792
|
"symbol": "SOMA_PIPELINE_LIMITS_AI"
|
|
2775
2793
|
},
|
|
2776
2794
|
{
|
|
2777
2795
|
"module": "soma-ai",
|
|
2778
|
-
"file": "src/
|
|
2796
|
+
"file": "src/server/common/RequestBodyLimit.ts",
|
|
2779
2797
|
"symbol": "SOMA_PIPELINE_LIMITS_AI"
|
|
2780
2798
|
},
|
|
2781
2799
|
{
|
|
2782
2800
|
"module": "soma-ai",
|
|
2783
|
-
"file": "src/
|
|
2801
|
+
"file": "src/server/services/ai-assistant/Chat.ts",
|
|
2784
2802
|
"symbol": "SOMA_PIPELINE_LIMITS_AI"
|
|
2785
2803
|
},
|
|
2786
2804
|
{
|
|
@@ -2795,7 +2813,7 @@ var SOMA_PIPELINE_LIMITS = {
|
|
|
2795
2813
|
},
|
|
2796
2814
|
{
|
|
2797
2815
|
"module": "soma-ai",
|
|
2798
|
-
"file": "src/
|
|
2816
|
+
"file": "src/domain/ai-shared/TrustedRequestContext.ts",
|
|
2799
2817
|
"symbol": "SOMA_PIPELINE_LIMITS_AI_RUNTIME"
|
|
2800
2818
|
},
|
|
2801
2819
|
{
|
|
@@ -2968,6 +2986,72 @@ var SOMA_PIPELINE_LIMITS = {
|
|
|
2968
2986
|
"tokensBytes": 40960,
|
|
2969
2987
|
"componentBytesPerPage": 163840,
|
|
2970
2988
|
"overrideBlockBytes": 8192
|
|
2989
|
+
},
|
|
2990
|
+
"contentEngines": {
|
|
2991
|
+
"diff": {
|
|
2992
|
+
"basis": {
|
|
2993
|
+
"maxChars": "\u5355\u4E2A\u5DEE\u5F02\u8BA1\u7B97\u4E24\u4FA7\u5408\u8BA1\u5B57\u6570\u4E0A\u9650\uFF1B\u8D85\u9650\u4E0D\u8BA1\u7B97\u3001\u6574\u6BB5\u66FF\u6362\uFF08\u53C2\u8003\u6587\u672C\u5DEE\u5F02\u7EC4\u4EF6\u7B14\u8BB0 C.5\u300C\u5355\u4E2A\u5DEE\u5F02\u7EC4\u4EF6\u603B\u91CF 200 000 \u5B57\u300D\uFF0C\u5B9E\u6D4B 4\uFF1A\u4E07\u5B57\u7EA7\u9010\u5B57\u6BD4\u8F83\u9700\u8D85\u65F6\u4E0E\u9000\u5316\uFF09",
|
|
2994
|
+
"maxCharsPerCompare": "\u5355\u6B21\u8BCD\u7EA7\u6BD4\u8F83\uFF08\u4E00\u5BF9\u53E5\u5B50 / \u4E00\u6B21 diff \u8C03\u7528\uFF09\u4E24\u4FA7\u5408\u8BA1\u5B57\u6570\u4E0A\u9650\uFF08\u7B14\u8BB0 C.2 BaseOpts maxChars 20 000\uFF09",
|
|
2995
|
+
"timeoutMs": "\u4E00\u6B21 diffProse / diffItems \u7684\u603B\u65F6\u9650\uFF08\u6BEB\u79D2\uFF09\uFF0C\u540C VisualEditor timeout 1000\uFF08\u7B14\u8BB0 C.2\uFF09",
|
|
2996
|
+
"maxItems": "\u6761\u76EE\u5217\u8868\u5355\u4FA7\u6761\u76EE\u6570\u4E0A\u9650\uFF1B\u8D85\u9650\u4E0D\u9010\u6761\u6BD4\u8F83\uFF08\u7B14\u8BB0 C.5\u300C\u6761\u76EE 2 000 \u4E2A\u300D\uFF09",
|
|
2997
|
+
"moveDetectMaxChanged": "\u53D8\u5316\u6761\u76EE\uFF08\u589E + \u5220\uFF09\u8D85\u8FC7\u6B64\u6570\u4E0D\u505A\u79FB\u52A8\u68C0\u6D4B\uFF08\u7B14\u8BB0 C.2\uFF0Cwikidiff2 \u589E\u5220\u5408\u8BA1 > 100 \u4E0D\u68C0\u6D4B\u7684\u653E\u5BBD\u7248\uFF0C\u7ECF\u9A8C\u503C\uFF09",
|
|
2998
|
+
"pairAt": "\u53E5 / \u6BB5\u914D\u5BF9\u9608\u503C\uFF1A\u5B57\u7B26\u591A\u91CD\u96C6 Dice \u2265 \u6B64\u503C\u89C6\u4E3A\u6539\u5199\uFF08VisualEditor diffThreshold 0.5\uFF1B\u5B9E\u6D4B 3 \u7684\u6539\u5199\u53E5\u4E3A 0.84\u20130.89\uFF09",
|
|
2999
|
+
"rewriteBelow": "\u6574\u4F53\u76F8\u4F3C\u5EA6\u4F4E\u4E8E\u6B64\u503C\u6574\u6BB5\u66FF\u6362\uFF08\u7B49\u6548 VE keep < 0.5 \xD7 diff\uFF1B\u5B9E\u6D4B 2 \u7684 C3 \u6574\u53E5\u91CD\u5199\u7EA6 0.16\uFF09",
|
|
3000
|
+
"absorbOrphan": "\u5B64\u5B57\u5438\u6536\uFF1A\u5939\u5728\u4E24\u5904\u6539\u52A8\u95F4\u3001\u957F\u5EA6 \u2264 \u6B64\u503C\uFF08\u5B57\uFF09\u7684\u975E\u6807\u70B9\u76F8\u540C\u7247\u6BB5\u5E76\u5165\u6539\u52A8\uFF08\u5B9E\u6D4B 2 \u7684 C5\u300C\u671F\u300D\uFF09",
|
|
3001
|
+
"absorbOrphanMax": "\u8C03\u7528\u65B9\u53EF\u8C03\u7684\u5B64\u5B57\u5438\u6536\u4E0A\u9650\uFF08\u5B57\uFF09\uFF0C\u9632\u6B62\u628A\u6574\u53E5\u5438\u6210\u6539\u52A8",
|
|
3002
|
+
"titleAt": "\u65E0 key \u6761\u76EE\u6309\u6807\u9898\u914D\u5BF9\u7684\u76F8\u4F3C\u5EA6\u9608\u503C\uFF08\u7B14\u8BB0 C.2 ItemOpts.match.titleAt 0.6\uFF09",
|
|
3003
|
+
"bodyAt": "\u65E0 key \u6761\u76EE\u6309\u6B63\u6587\u914D\u5BF9\u7684\u76F8\u4F3C\u5EA6\u9608\u503C\uFF08\u7B14\u8BB0 C.2 ItemOpts.match.bodyAt 0.5\uFF09",
|
|
3004
|
+
"maxAlignTokens": "\u5E8F\u5217\u5BF9\u9F50\u7684\u4E0D\u540C\u952E\u6570\u4E0A\u9650\uFF08\u6BCF\u4E2A\u952E\u6620\u5C04\u4E3A\u4E00\u4E2A BMP \u79C1\u7528\u533A\u5B57\u7B26\uFF0CU+E000\u2013U+F8FF \u5171 6400 \u4E2A\uFF09",
|
|
3005
|
+
"maxPairMatrix": "\u4E00\u6BB5\u5220\u589E\u533A\u95F4\u5185\u53E5 / \u6BB5\u914D\u5BF9\u7684\u5019\u9009\u77E9\u9635\u4E0A\u9650\uFF08\u5220\u6570 \xD7 \u589E\u6570\uFF09\uFF0C\u8D85\u51FA\u4E0D\u914D\u5BF9\u3001\u6309\u5220 + \u589E\u5448\u73B0\uFF1B\u7ECF\u9A8C\u503C\uFF0C\u8BC1\u636E\u5F31",
|
|
3006
|
+
"maxPairCandidates": "\u65E0 key \u6761\u76EE\u6309\u76F8\u4F3C\u5EA6\u914D\u5BF9\u7684\u5019\u9009\u77E9\u9635\u4E0A\u9650\uFF08\u5269\u4F59\u65E7\u6761\u76EE \xD7 \u5269\u4F59\u65B0\u6761\u76EE\uFF09\uFF1B\u7ECF\u9A8C\u503C\uFF0C\u8BC1\u636E\u5F31"
|
|
3007
|
+
},
|
|
3008
|
+
"maxChars": 2e5,
|
|
3009
|
+
"maxCharsPerCompare": 2e4,
|
|
3010
|
+
"timeoutMs": 1e3,
|
|
3011
|
+
"maxItems": 2e3,
|
|
3012
|
+
"moveDetectMaxChanged": 500,
|
|
3013
|
+
"pairAt": 0.5,
|
|
3014
|
+
"rewriteBelow": 0.4,
|
|
3015
|
+
"absorbOrphan": 1,
|
|
3016
|
+
"absorbOrphanMax": 4,
|
|
3017
|
+
"titleAt": 0.6,
|
|
3018
|
+
"bodyAt": 0.5,
|
|
3019
|
+
"maxAlignTokens": 6400,
|
|
3020
|
+
"maxPairMatrix": 2500,
|
|
3021
|
+
"maxPairCandidates": 25e4
|
|
3022
|
+
},
|
|
3023
|
+
"highlight": {
|
|
3024
|
+
"basis": {
|
|
3025
|
+
"maxLines": "\u9AD8\u4EAE\u7684\u6700\u591A\u884C\u6570\uFF1B\u8D85\u51FA\u90E8\u5206\u6309\u7EAF\u6587\u672C\uFF08\u53C2\u8003\u6587\u672C\u5DEE\u5F02\u7EC4\u4EF6\u7B14\u8BB0 C.2 \u7AEF\u53E3 2 maxLines 5 000\uFF09",
|
|
3026
|
+
"maxLineLength": "\u5355\u884C\u8D85\u8FC7\u6B64\u5B57\u7B26\u6570\u6574\u884C\u6309\u7EAF\u6587\u672C\uFF08\u7B14\u8BB0 C.2 maxLineLength 2 000\uFF0C\u538B\u7F29\u540E\u7684\u5355\u884C JS / JSON \u5E38\u89C1\uFF09",
|
|
3027
|
+
"timeoutMs": "\u4E00\u6B21\u89E3\u6790\u7684\u65F6\u9650\uFF08\u6BEB\u79D2\uFF09\uFF1BLezer \u6309 advance() \u5206\u6B65\u89E3\u6790\uFF0C\u8D85\u65F6\u6574\u6BB5\u6309\u7EAF\u6587\u672C\uFF08\u7ECF\u9A8C\u503C\uFF0C\u4E0E\u5DEE\u5F02\u7AEF\u53E3\u540C\u53D6 1 000\uFF09",
|
|
3028
|
+
"maxChars": "\u6574\u6BB5\u8D85\u8FC7\u6B64\u5B57\u7B26\u6570\u4E0D\u89E3\u6790\u3001\u6309\u7EAF\u6587\u672C\uFF08\u7ECF\u9A8C\u503C\uFF0C\u8BC1\u636E\u5F31\uFF1A\u7EA6 1 MB \u6587\u672C\uFF09",
|
|
3029
|
+
"jsonSniffMaxChars": "\u8BED\u8A00\u63A8\u65AD\u300C\u6574\u4F53\u80FD JSON.parse\u300D\u53EA\u5BF9\u4E0D\u8D85\u8FC7\u6B64\u5B57\u7B26\u6570\u7684\u6837\u672C\u505A\uFF08\u907F\u514D\u5BF9\u5927\u6587\u672C\u53CD\u590D\u89E3\u6790\uFF1B\u7ECF\u9A8C\u503C\uFF09"
|
|
3030
|
+
},
|
|
3031
|
+
"maxLines": 5e3,
|
|
3032
|
+
"maxLineLength": 2e3,
|
|
3033
|
+
"timeoutMs": 1e3,
|
|
3034
|
+
"maxChars": 1e6,
|
|
3035
|
+
"jsonSniffMaxChars": 2e5
|
|
3036
|
+
},
|
|
3037
|
+
"structured": {
|
|
3038
|
+
"basis": {
|
|
3039
|
+
"maxChars": "JSON / YAML \u539F\u6587\u8D85\u8FC7\u6B64\u5B57\u7B26\u6570\u4E0D\u89E3\u6790\u3001\u6309\u539F\u6587\u663E\u793A\uFF08\u4E0E\u4EE3\u7801\u9AD8\u4EAE\u7AEF\u53E3 maxChars \u540C\u53D6\u7EA6 1 MB\uFF1B\u7ECF\u9A8C\u503C\uFF0C\u8BC1\u636E\u5F31\uFF09",
|
|
3040
|
+
"maxNodes": "\u89E3\u6790\u540E\u503C\u7684\u8282\u70B9\u603B\u6570\u4E0A\u9650\uFF08\u5BF9\u8C61 / \u6570\u7EC4 / \u53F6\u5B50\u5404\u8BA1 1\uFF09\uFF1BYAML \u522B\u540D\u5C55\u5F00\u8D85\u9650\u5373\u6309 too-many-nodes \u964D\u7EA7\uFF0C\u9632\u300C\u5341\u4EBF\u7B11\u58F0\u300D\u5F0F\u522B\u540D\u70B8\u5F39\uFF08\u7ECF\u9A8C\u503C\uFF1A20 \u4E07\u8282\u70B9\u7EA6\u4E3A 1 MB \u7D27\u51D1 JSON \u7684\u91CF\u7EA7\uFF09"
|
|
3041
|
+
},
|
|
3042
|
+
"maxChars": 1e6,
|
|
3043
|
+
"maxNodes": 2e5
|
|
3044
|
+
},
|
|
3045
|
+
"markdown": {
|
|
3046
|
+
"basis": {
|
|
3047
|
+
"maxChars": "Markdown \u539F\u6587\u8D85\u8FC7\u6B64\u5B57\u7B26\u6570\u4E0D\u89E3\u6790\u3001\u6309\u7EAF\u6587\u672C\u663E\u793A\uFF08\u53C2\u8003\u6587\u672C\u5DEE\u5F02\u7EC4\u4EF6\u7B14\u8BB0 C.2 \u7AEF\u53E3 1 limits.maxChars 200 000\uFF09",
|
|
3048
|
+
"maxBlocks": "\u5757\u6570\u4E0A\u9650\uFF0C\u8D85\u51FA\u622A\u65AD\u5E76\u6807 truncated\uFF08\u7B14\u8BB0 C.2 maxBlocks 5 000\uFF09",
|
|
3049
|
+
"summaryChars": "meta.summary \u53D6\u53BB\u6807\u8BB0\u5168\u6587\u7684\u524D N \u5B57\uFF08\u7B14\u8BB0 C.2\u300C\u524D 80 \u5B57\u300D\uFF09"
|
|
3050
|
+
},
|
|
3051
|
+
"maxChars": 2e5,
|
|
3052
|
+
"maxBlocks": 5e3,
|
|
3053
|
+
"summaryChars": 80
|
|
3054
|
+
}
|
|
2971
3055
|
}
|
|
2972
3056
|
};
|
|
2973
3057
|
|
|
@@ -5935,6 +6019,7 @@ function compileFlatPage(input) {
|
|
|
5935
6019
|
|
|
5936
6020
|
// core/server/runtime-space/digest.ts
|
|
5937
6021
|
var import_node_crypto = require("node:crypto");
|
|
6022
|
+
var SOMA_RUNTIME_STORE_FORMAT = 2;
|
|
5938
6023
|
var SOMA_RUNTIME_DIGEST_PATTERN = /^[0-9a-f]{64}$/;
|
|
5939
6024
|
function isRuntimeDigest(value2) {
|
|
5940
6025
|
return typeof value2 === "string" && SOMA_RUNTIME_DIGEST_PATTERN.test(value2);
|
|
@@ -6702,16 +6787,10 @@ var ServerFileCache = class _ServerFileCache {
|
|
|
6702
6787
|
|
|
6703
6788
|
// core/server/host/app-config-composer.ts
|
|
6704
6789
|
var import_node_fs3 = __toESM(require("node:fs"));
|
|
6705
|
-
var
|
|
6706
|
-
|
|
6707
|
-
// core/server/host/host-dir.ts
|
|
6708
|
-
var import_node_path3 = __toESM(require("node:path"));
|
|
6709
|
-
function currentHostDir() {
|
|
6710
|
-
const configured = process.env.SOMA_HOST_DIR;
|
|
6711
|
-
return configured !== void 0 && configured.trim() !== "" ? import_node_path3.default.resolve(configured) : void 0;
|
|
6712
|
-
}
|
|
6790
|
+
var import_js_yaml4 = __toESM(require("js-yaml"));
|
|
6713
6791
|
|
|
6714
|
-
// core/
|
|
6792
|
+
// core/shared/app-config-merge.ts
|
|
6793
|
+
var import_js_yaml3 = __toESM(require("js-yaml"));
|
|
6715
6794
|
var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
6716
6795
|
function isRecord5(value2) {
|
|
6717
6796
|
return Boolean(value2) && typeof value2 === "object" && !Array.isArray(value2);
|
|
@@ -6754,12 +6833,24 @@ function mergeSourcePackageAppConfig(sourcePackageConfig, hostConfig) {
|
|
|
6754
6833
|
}
|
|
6755
6834
|
return cloneValue(sourcePackageConfig ?? {});
|
|
6756
6835
|
}
|
|
6836
|
+
|
|
6837
|
+
// core/server/host/host-dir.ts
|
|
6838
|
+
var import_node_path3 = __toESM(require("node:path"));
|
|
6839
|
+
function currentHostDir() {
|
|
6840
|
+
const configured = process.env.SOMA_HOST_DIR;
|
|
6841
|
+
return configured !== void 0 && configured.trim() !== "" ? import_node_path3.default.resolve(configured) : void 0;
|
|
6842
|
+
}
|
|
6843
|
+
|
|
6844
|
+
// core/server/host/app-config-composer.ts
|
|
6845
|
+
function isRecord6(value2) {
|
|
6846
|
+
return Boolean(value2) && typeof value2 === "object" && !Array.isArray(value2);
|
|
6847
|
+
}
|
|
6757
6848
|
function composeAppConfigYaml(sourcePackageConfigYaml, hostConfigYaml) {
|
|
6758
6849
|
const merged = mergeSourcePackageAppConfig(
|
|
6759
6850
|
parseAppConfigYaml(sourcePackageConfigYaml),
|
|
6760
6851
|
parseAppConfigYaml(hostConfigYaml)
|
|
6761
6852
|
);
|
|
6762
|
-
return
|
|
6853
|
+
return import_js_yaml4.default.dump(merged, { noRefs: true, lineWidth: -1 });
|
|
6763
6854
|
}
|
|
6764
6855
|
function readHostAppDisplayName(hostDir = currentHostDir()) {
|
|
6765
6856
|
if (!hostDir) {
|
|
@@ -6771,7 +6862,7 @@ function readHostAppDisplayName(hostDir = currentHostDir()) {
|
|
|
6771
6862
|
}
|
|
6772
6863
|
try {
|
|
6773
6864
|
const config = parseAppConfigYaml(import_node_fs3.default.readFileSync(configPath, "utf8"));
|
|
6774
|
-
if (!
|
|
6865
|
+
if (!isRecord6(config) || typeof config.displayName !== "string") {
|
|
6775
6866
|
return "";
|
|
6776
6867
|
}
|
|
6777
6868
|
return config.displayName.trim();
|
|
@@ -6781,7 +6872,7 @@ function readHostAppDisplayName(hostDir = currentHostDir()) {
|
|
|
6781
6872
|
}
|
|
6782
6873
|
|
|
6783
6874
|
// core/build/compiler/page-declaration-compiler.ts
|
|
6784
|
-
var
|
|
6875
|
+
var import_js_yaml6 = __toESM(require("js-yaml"));
|
|
6785
6876
|
|
|
6786
6877
|
// core/build/compiler/html-include-expander.ts
|
|
6787
6878
|
var SomaHtmlIncludeError = class extends Error {
|
|
@@ -6871,12 +6962,12 @@ var SomaGenerationAggregateError = class extends SomaGenerationError {
|
|
|
6871
6962
|
};
|
|
6872
6963
|
|
|
6873
6964
|
// core/build/compiler/soma-precompile.ts
|
|
6874
|
-
var
|
|
6965
|
+
var import_js_yaml5 = __toESM(require("js-yaml"));
|
|
6875
6966
|
function compileEventConfig(yamlStr) {
|
|
6876
6967
|
if (!yamlStr.trim()) {
|
|
6877
6968
|
return { events: [], timers: [] };
|
|
6878
6969
|
}
|
|
6879
|
-
return compileEventConfigFromRaw(
|
|
6970
|
+
return compileEventConfigFromRaw(import_js_yaml5.default.load(yamlStr));
|
|
6880
6971
|
}
|
|
6881
6972
|
function compileEventConfigFromRaw(raw) {
|
|
6882
6973
|
const { eventsRaw, timers } = splitEventConfigRaw(raw);
|
|
@@ -6889,7 +6980,7 @@ function compileDataConfig(yamlStr) {
|
|
|
6889
6980
|
if (!yamlStr.trim()) {
|
|
6890
6981
|
return { objects: {} };
|
|
6891
6982
|
}
|
|
6892
|
-
return parseDataConfig(
|
|
6983
|
+
return parseDataConfig(import_js_yaml5.default.load(yamlStr));
|
|
6893
6984
|
}
|
|
6894
6985
|
|
|
6895
6986
|
// core/build/component-tree/source-preflight.ts
|
|
@@ -6958,7 +7049,7 @@ function assertNoComponentTreeSyntax(html) {
|
|
|
6958
7049
|
|
|
6959
7050
|
// core/build/compiler/page-declaration-compiler.ts
|
|
6960
7051
|
var SOMA_UNKNOWN_COMPILE_IDENTITY = "";
|
|
6961
|
-
var dump = (value2) =>
|
|
7052
|
+
var dump = (value2) => import_js_yaml6.default.dump(value2, { lineWidth: 120, noRefs: true, quotingType: '"' });
|
|
6962
7053
|
var DEFAULT_OPTIONS = { purpose: "static" };
|
|
6963
7054
|
function compilePageDeclaration(source2, options = DEFAULT_OPTIONS) {
|
|
6964
7055
|
try {
|
|
@@ -7145,7 +7236,7 @@ function compileSomaPageAssets(quartet, base, includes, options = {}) {
|
|
|
7145
7236
|
}
|
|
7146
7237
|
|
|
7147
7238
|
// core/server/host/locale-yaml.ts
|
|
7148
|
-
var
|
|
7239
|
+
var import_js_yaml7 = __toESM(require("js-yaml"));
|
|
7149
7240
|
|
|
7150
7241
|
// core/shared/types/locale.types.ts
|
|
7151
7242
|
var SOMA_LOCALE_BUNDLE_FORMAT = "soma.locale-bundle";
|
|
@@ -7175,7 +7266,7 @@ function stringEntries(value2) {
|
|
|
7175
7266
|
}
|
|
7176
7267
|
function mergeLocaleYaml(hostYaml, compiled) {
|
|
7177
7268
|
if (compiled === void 0) return hostYaml;
|
|
7178
|
-
const hostRaw = hostYaml.trim() === "" ? void 0 :
|
|
7269
|
+
const hostRaw = hostYaml.trim() === "" ? void 0 : import_js_yaml7.default.load(hostYaml);
|
|
7179
7270
|
const hostEmpty = hostRaw === void 0 || hostRaw === null || typeof hostRaw === "object" && !Array.isArray(hostRaw) && Object.keys(hostRaw).length === 0;
|
|
7180
7271
|
if (!hostEmpty && !isLocaleBundle(hostRaw)) {
|
|
7181
7272
|
throw new Error("[soma-core][\u8BCD\u8868] Host \u7684 locale.yaml \u5FC5\u987B\u662F { format: soma.locale-bundle, defaultLocale, <\u8BED\u8A00>: { \u952E: \u6587\u6848 } } \u4FE1\u5C01\uFF1B\u4E0D\u63A5\u53D7\u6241\u5E73\u5355\u5B57\u5178");
|
|
@@ -7195,17 +7286,17 @@ function mergeLocaleYaml(hostYaml, compiled) {
|
|
|
7195
7286
|
...defaultLocale !== void 0 ? { defaultLocale } : {},
|
|
7196
7287
|
...merged
|
|
7197
7288
|
};
|
|
7198
|
-
return
|
|
7289
|
+
return import_js_yaml7.default.dump(result, { lineWidth: -1, noRefs: true });
|
|
7199
7290
|
}
|
|
7200
7291
|
|
|
7201
7292
|
// core/server/host/page-markup-config.ts
|
|
7202
7293
|
var import_node_fs4 = require("node:fs");
|
|
7203
7294
|
var import_node_path4 = require("node:path");
|
|
7204
|
-
var
|
|
7295
|
+
var import_js_yaml8 = __toESM(require("js-yaml"));
|
|
7205
7296
|
function loadPageMarkupConfig(configRoot, base) {
|
|
7206
7297
|
const file = (0, import_node_path4.join)(configRoot, "page-markup.config.yaml");
|
|
7207
7298
|
if (!(0, import_node_fs4.existsSync)(file)) return {};
|
|
7208
|
-
const raw =
|
|
7299
|
+
const raw = import_js_yaml8.default.load((0, import_node_fs4.readFileSync)(file, "utf8"));
|
|
7209
7300
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
7210
7301
|
throw new Error("[soma-core][\u9875\u9762\u683C\u5F0F] page-markup.config.yaml \u5FC5\u987B\u5305\u542B pages \u5BF9\u8C61");
|
|
7211
7302
|
}
|
|
@@ -7533,12 +7624,12 @@ function isStatusError(error) {
|
|
|
7533
7624
|
// core/server/runtime-space/access-gate.ts
|
|
7534
7625
|
var SOMA_ANONYMOUS_ACCESS_IDENTITY = Object.freeze({ signedIn: false, roles: /* @__PURE__ */ new Set() });
|
|
7535
7626
|
var SOMA_FORBIDDEN_TEXT_KEY = SOMA_PAGE_FORBIDDEN_I18N_KEY;
|
|
7536
|
-
function
|
|
7627
|
+
function isRecord7(value2) {
|
|
7537
7628
|
return value2 !== null && typeof value2 === "object" && !Array.isArray(value2);
|
|
7538
7629
|
}
|
|
7539
7630
|
function readAccessIdentity(raw) {
|
|
7540
7631
|
if (raw === null || raw === void 0 || raw === false) return SOMA_ANONYMOUS_ACCESS_IDENTITY;
|
|
7541
|
-
if (!
|
|
7632
|
+
if (!isRecord7(raw)) return { signedIn: true, roles: /* @__PURE__ */ new Set() };
|
|
7542
7633
|
if (raw.signedIn === false) return SOMA_ANONYMOUS_ACCESS_IDENTITY;
|
|
7543
7634
|
const roles = /* @__PURE__ */ new Set();
|
|
7544
7635
|
if (Array.isArray(raw.roles)) {
|
|
@@ -7551,14 +7642,14 @@ function rolesScopeOf(rule) {
|
|
|
7551
7642
|
return resolveScope({ scope: rule.roles_scope, items: Array.isArray(rule.roles) ? rule.roles : void 0 });
|
|
7552
7643
|
}
|
|
7553
7644
|
function isOpenAccessRule(rule) {
|
|
7554
|
-
if (rule === void 0 || rule === null || !
|
|
7645
|
+
if (rule === void 0 || rule === null || !isRecord7(rule)) return true;
|
|
7555
7646
|
const roles = rolesScopeOf(rule);
|
|
7556
7647
|
return roles.problem === null && roles.scope === "all" && rule.signed_in !== true;
|
|
7557
7648
|
}
|
|
7558
7649
|
function evaluateAccessRule(rule, identity) {
|
|
7559
7650
|
if (isOpenAccessRule(rule)) return "allow";
|
|
7560
7651
|
if (!identity.signedIn) return "unauthenticated";
|
|
7561
|
-
const roles =
|
|
7652
|
+
const roles = isRecord7(rule) ? rolesScopeOf(rule) : null;
|
|
7562
7653
|
if (roles !== null && roles.problem !== null) return "forbidden";
|
|
7563
7654
|
if (roles !== null && roles.scope === "specific" && !roles.items.some((role) => identity.roles.has(role))) return "forbidden";
|
|
7564
7655
|
return "allow";
|
|
@@ -7612,7 +7703,7 @@ function readAccessPolicy(hostDir) {
|
|
|
7612
7703
|
}
|
|
7613
7704
|
}
|
|
7614
7705
|
function accessRulesOf(binding, envelope, policy) {
|
|
7615
|
-
const own =
|
|
7706
|
+
const own = isRecord7(envelope?.access) ? envelope?.access : void 0;
|
|
7616
7707
|
const floor = grantFor(policy.grants, binding.caller, binding.address)?.access;
|
|
7617
7708
|
return [policy.defaultAccess, floor, own].filter((rule) => !isOpenAccessRule(rule));
|
|
7618
7709
|
}
|
|
@@ -7649,21 +7740,21 @@ async function gateAccess(binding, envelope, policy, resolveIdentity, requestedP
|
|
|
7649
7740
|
|
|
7650
7741
|
// core/server/runtime-space/nav-catalog.ts
|
|
7651
7742
|
var LIMITS = SOMA_PIPELINE_LIMITS2.envelope;
|
|
7652
|
-
function
|
|
7743
|
+
function isRecord8(value2) {
|
|
7653
7744
|
return value2 !== null && typeof value2 === "object" && !Array.isArray(value2);
|
|
7654
7745
|
}
|
|
7655
7746
|
function navSlotOf(source2) {
|
|
7656
7747
|
const { binding, envelope } = source2;
|
|
7657
7748
|
if (binding.origin === "static" || binding.kind !== "exact" || binding.purpose === "preview") return null;
|
|
7658
7749
|
const nav = envelope?.nav;
|
|
7659
|
-
if (!
|
|
7750
|
+
if (!isRecord8(nav)) return null;
|
|
7660
7751
|
const typed = nav;
|
|
7661
7752
|
return { group: typed.group ?? LIMITS.navDefaultGroup, nav: typed };
|
|
7662
7753
|
}
|
|
7663
7754
|
function titleOf(source2) {
|
|
7664
7755
|
const raw = source2.envelope?.title;
|
|
7665
7756
|
if (typeof raw === "string" && raw !== "") return raw;
|
|
7666
|
-
if (
|
|
7757
|
+
if (isRecord8(raw) && typeof raw.t === "string") return { t: raw.t };
|
|
7667
7758
|
return source2.binding.title ?? source2.binding.address;
|
|
7668
7759
|
}
|
|
7669
7760
|
var reportedParents = /* @__PURE__ */ new Set();
|
|
@@ -7868,7 +7959,7 @@ var SOMA_DEFAULT_PAGE_GRANTS = Object.freeze([
|
|
|
7868
7959
|
var PERSIST_RANK = Object.freeze(
|
|
7869
7960
|
Object.fromEntries(SOMA_ENVELOPE_PERSIST_LEVELS.map((level, index) => [level, index]))
|
|
7870
7961
|
);
|
|
7871
|
-
function
|
|
7962
|
+
function isRecord9(value2) {
|
|
7872
7963
|
return value2 !== null && typeof value2 === "object" && !Array.isArray(value2);
|
|
7873
7964
|
}
|
|
7874
7965
|
function invalidGrant(index, problem, remedy = "\u6309\u300A\u9875\u9762\u7EA7\u63CF\u8FF0\u4E0E\u6309 URL \u6CE8\u518C\u300B\xA74.6 \u4FEE\u6B63 pageGrants") {
|
|
@@ -7886,7 +7977,7 @@ function validatePageGrants(grants, context = { staticAddresses: [], fixedAddres
|
|
|
7886
7977
|
const seen = /* @__PURE__ */ new Map();
|
|
7887
7978
|
const out = [];
|
|
7888
7979
|
grants.forEach((raw, index) => {
|
|
7889
|
-
if (!
|
|
7980
|
+
if (!isRecord9(raw)) invalidGrant(index, "\u6761\u76EE\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
7890
7981
|
for (const key2 of Object.keys(raw)) {
|
|
7891
7982
|
if (!GRANT_KEYS.has(key2)) invalidGrant(index, `\u672A\u77E5\u952E ${JSON.stringify(key2)}`, `\u53EA\u8BA4 ${[...GRANT_KEYS].join(" / ")}`);
|
|
7892
7983
|
}
|
|
@@ -7907,7 +7998,7 @@ function validatePageGrants(grants, context = { staticAddresses: [], fixedAddres
|
|
|
7907
7998
|
}
|
|
7908
7999
|
if (raw.max !== void 0 && (!Number.isInteger(raw.max) || raw.max < 1)) invalidGrant(index, "max \u5FC5\u987B\u662F\u6B63\u6574\u6570");
|
|
7909
8000
|
if (raw.access !== void 0) {
|
|
7910
|
-
if (!
|
|
8001
|
+
if (!isRecord9(raw.access)) invalidGrant(index, "access \u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
7911
8002
|
for (const key2 of Object.keys(raw.access)) if (!ACCESS_KEYS.has(key2)) invalidGrant(index, `access \u542B\u672A\u77E5\u952E ${JSON.stringify(key2)}`);
|
|
7912
8003
|
const { roles, signed_in: signedIn } = raw.access;
|
|
7913
8004
|
if (roles !== void 0 && (!Array.isArray(roles) || roles.length === 0 || roles.some((role) => typeof role !== "string" || role === ""))) {
|
|
@@ -7916,7 +8007,7 @@ function validatePageGrants(grants, context = { staticAddresses: [], fixedAddres
|
|
|
7916
8007
|
if (signedIn !== void 0 && typeof signedIn !== "boolean") invalidGrant(index, "access.signed_in \u5FC5\u987B\u662F\u5E03\u5C14\u503C");
|
|
7917
8008
|
}
|
|
7918
8009
|
if (raw.nav !== void 0) {
|
|
7919
|
-
if (!
|
|
8010
|
+
if (!isRecord9(raw.nav)) invalidGrant(index, "nav \u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
7920
8011
|
for (const key2 of Object.keys(raw.nav)) if (!NAV_KEYS.has(key2)) invalidGrant(index, `nav \u542B\u672A\u77E5\u952E ${JSON.stringify(key2)}`, "\u6388\u6743\u53EA\u76D6 group / order / icon");
|
|
7921
8012
|
if (raw.nav.order !== void 0 && !Number.isFinite(raw.nav.order)) invalidGrant(index, "nav.order \u5FC5\u987B\u662F\u6570\u5B57");
|
|
7922
8013
|
if (shape.kind !== "exact" && shape.kind !== "all" && Object.keys(raw.nav).length > 0) {
|
|
@@ -8468,6 +8559,17 @@ var SomaRuntimeStore = class {
|
|
|
8468
8559
|
this.pages.set(digest, page);
|
|
8469
8560
|
return page;
|
|
8470
8561
|
}
|
|
8562
|
+
/** 删除产物文件(升级丢弃旧产物后清理用;调用方保证没有别的绑定引用它);返回是否真删了文件 */
|
|
8563
|
+
removeArtifact(digest) {
|
|
8564
|
+
if (!isRuntimeDigest(digest)) return false;
|
|
8565
|
+
this.pages.delete(digest);
|
|
8566
|
+
try {
|
|
8567
|
+
import_node_fs8.default.unlinkSync(artifactFilePath(this.dirs.artifacts, digest));
|
|
8568
|
+
return true;
|
|
8569
|
+
} catch {
|
|
8570
|
+
return false;
|
|
8571
|
+
}
|
|
8572
|
+
}
|
|
8471
8573
|
hasArtifact(digest) {
|
|
8472
8574
|
return isRuntimeDigest(digest) && import_node_fs8.default.existsSync(artifactFilePath(this.dirs.artifacts, digest));
|
|
8473
8575
|
}
|
|
@@ -8512,7 +8614,7 @@ var SomaRuntimeStore = class {
|
|
|
8512
8614
|
}
|
|
8513
8615
|
writeBinding(binding) {
|
|
8514
8616
|
import_node_fs8.default.mkdirSync(this.dirs.bindings, { recursive: true });
|
|
8515
|
-
const record3 = { schemaVersion:
|
|
8617
|
+
const record3 = { schemaVersion: SOMA_RUNTIME_STORE_FORMAT, binding };
|
|
8516
8618
|
writeFileAtomic(this.bindingFile(binding.address), `${JSON.stringify(record3, null, 2)}
|
|
8517
8619
|
`);
|
|
8518
8620
|
}
|
|
@@ -8521,7 +8623,7 @@ var SomaRuntimeStore = class {
|
|
|
8521
8623
|
try {
|
|
8522
8624
|
const stat = import_node_fs8.default.statSync(file);
|
|
8523
8625
|
const record3 = JSON.parse(import_node_fs8.default.readFileSync(file, "utf8"));
|
|
8524
|
-
if (record3.schemaVersion !==
|
|
8626
|
+
if (record3.schemaVersion !== SOMA_RUNTIME_STORE_FORMAT || !record3.binding) return null;
|
|
8525
8627
|
return { binding: record3.binding, mtimeMs: stat.mtimeMs };
|
|
8526
8628
|
} catch {
|
|
8527
8629
|
return null;
|
|
@@ -8543,6 +8645,8 @@ var SomaRuntimeStore = class {
|
|
|
8543
8645
|
return false;
|
|
8544
8646
|
}
|
|
8545
8647
|
}
|
|
8648
|
+
/** 本进程读绑定时因落盘格式版本不符而丢弃的旧绑定个数(启动汇总日志用) */
|
|
8649
|
+
legacyDiscarded = 0;
|
|
8546
8650
|
/** 严格删除:文件本来就不在返回 false(视为成功);其他失败(权限 / IO)原样抛出,不吞 */
|
|
8547
8651
|
removeBindingStrict(address) {
|
|
8548
8652
|
try {
|
|
@@ -8568,7 +8672,11 @@ var SomaRuntimeStore = class {
|
|
|
8568
8672
|
const file = import_node_path8.default.join(this.dirs.bindings, name);
|
|
8569
8673
|
const stat = import_node_fs8.default.statSync(file);
|
|
8570
8674
|
const record3 = JSON.parse(import_node_fs8.default.readFileSync(file, "utf8"));
|
|
8571
|
-
if (record3.schemaVersion ===
|
|
8675
|
+
if (record3.schemaVersion === SOMA_RUNTIME_STORE_FORMAT && record3.binding) out.push({ binding: record3.binding, mtimeMs: stat.mtimeMs });
|
|
8676
|
+
else {
|
|
8677
|
+
import_node_fs8.default.unlinkSync(file);
|
|
8678
|
+
this.legacyDiscarded += 1;
|
|
8679
|
+
}
|
|
8572
8680
|
} catch {
|
|
8573
8681
|
}
|
|
8574
8682
|
}
|
|
@@ -8578,14 +8686,14 @@ var SomaRuntimeStore = class {
|
|
|
8578
8686
|
readPrewarmIndex() {
|
|
8579
8687
|
try {
|
|
8580
8688
|
const parsed = JSON.parse(import_node_fs8.default.readFileSync(import_node_path8.default.join(this.dirs.prewarm, "index.json"), "utf8"));
|
|
8581
|
-
if (parsed.schemaVersion ===
|
|
8689
|
+
if (parsed.schemaVersion === SOMA_RUNTIME_STORE_FORMAT && parsed.entries && typeof parsed.entries === "object") return parsed;
|
|
8582
8690
|
} catch {
|
|
8583
8691
|
}
|
|
8584
|
-
return { schemaVersion:
|
|
8692
|
+
return { schemaVersion: SOMA_RUNTIME_STORE_FORMAT, entries: {} };
|
|
8585
8693
|
}
|
|
8586
8694
|
writePrewarmIndex(entries) {
|
|
8587
8695
|
import_node_fs8.default.mkdirSync(this.dirs.prewarm, { recursive: true });
|
|
8588
|
-
const index = { schemaVersion:
|
|
8696
|
+
const index = { schemaVersion: SOMA_RUNTIME_STORE_FORMAT, entries };
|
|
8589
8697
|
writeFileAtomic(import_node_path8.default.join(this.dirs.prewarm, "index.json"), `${JSON.stringify(index, null, 2)}
|
|
8590
8698
|
`);
|
|
8591
8699
|
}
|
|
@@ -8605,7 +8713,8 @@ function space() {
|
|
|
8605
8713
|
loadedRoots: /* @__PURE__ */ new Set(),
|
|
8606
8714
|
stores: /* @__PURE__ */ new Map(),
|
|
8607
8715
|
layoutMemo: null,
|
|
8608
|
-
rootErrorReported: false
|
|
8716
|
+
rootErrorReported: false,
|
|
8717
|
+
ownerGuards: /* @__PURE__ */ new Map()
|
|
8609
8718
|
};
|
|
8610
8719
|
}
|
|
8611
8720
|
var LAYOUT_ENV_KEYS = ["SOMA_HOST_DIR", "SOMA_RUNTIME_DIR"];
|
|
@@ -8654,6 +8763,9 @@ function ensureLoaded() {
|
|
|
8654
8763
|
state2.loadedRoots.add(layout.root);
|
|
8655
8764
|
const store = runtimeStore(layout);
|
|
8656
8765
|
const now = Date.now();
|
|
8766
|
+
const dropped = { format: 0, owner: 0 };
|
|
8767
|
+
const droppedDigests = /* @__PURE__ */ new Set();
|
|
8768
|
+
const legacyBefore = store.legacyDiscarded;
|
|
8657
8769
|
for (const read of store.listBindings()) {
|
|
8658
8770
|
const binding = read.binding;
|
|
8659
8771
|
if (binding.origin !== "inject" || binding.digest === null || binding.kind === "prefix") continue;
|
|
@@ -8668,16 +8780,38 @@ function ensureLoaded() {
|
|
|
8668
8780
|
console.warn(`[soma-core][\u5F15\u64CE] \u6301\u4E45\u7ED1\u5B9A ${binding.address} \u7684\u4EA7\u7269\u7F3A\u5931\u6216\u635F\u574F\uFF08${binding.digest.slice(0, 12)}\u2026\uFF09\uFF0C\u5DF2\u8DF3\u8FC7\uFF1B\u91CD\u65B0 inject \u5373\u53EF\u6062\u590D\u3002`);
|
|
8669
8781
|
continue;
|
|
8670
8782
|
}
|
|
8783
|
+
const envelope = page.envelope ?? readFlatEnvelope(page.uiYaml);
|
|
8784
|
+
if (page.format !== SOMA_PAGE_FORMAT_VERSION) {
|
|
8785
|
+
store.removeBinding(binding.address);
|
|
8786
|
+
dropped.format += 1;
|
|
8787
|
+
droppedDigests.add(binding.digest);
|
|
8788
|
+
continue;
|
|
8789
|
+
}
|
|
8790
|
+
const guard = binding.owner === void 0 ? void 0 : state2.ownerGuards.get(binding.owner);
|
|
8791
|
+
if (guard !== void 0 && !guard(binding.version)) {
|
|
8792
|
+
store.removeBinding(binding.address);
|
|
8793
|
+
dropped.owner += 1;
|
|
8794
|
+
droppedDigests.add(binding.digest);
|
|
8795
|
+
continue;
|
|
8796
|
+
}
|
|
8671
8797
|
state2.generations.set(key, Math.max(state2.generations.get(key) ?? 0, binding.generation));
|
|
8672
8798
|
state2.entries.set(key, {
|
|
8673
8799
|
binding: { ...binding, persisted: true },
|
|
8674
8800
|
page,
|
|
8675
|
-
envelope
|
|
8801
|
+
envelope,
|
|
8676
8802
|
prefix: null,
|
|
8677
8803
|
registryName: null,
|
|
8678
8804
|
mtimeMs: read.mtimeMs
|
|
8679
8805
|
});
|
|
8680
8806
|
}
|
|
8807
|
+
const legacy = store.legacyDiscarded - legacyBefore;
|
|
8808
|
+
dropped.format += legacy;
|
|
8809
|
+
if (dropped.format + dropped.owner > 0) {
|
|
8810
|
+
const live = new Set([...state2.entries.values()].flatMap((entry) => entry.binding.digest !== null ? [entry.binding.digest] : []));
|
|
8811
|
+
let cleaned = 0;
|
|
8812
|
+
for (const digest of droppedDigests) if (!live.has(digest) && store.removeArtifact(digest)) cleaned += 1;
|
|
8813
|
+
console.warn(`[soma-core][\u5F15\u64CE] \u5347\u7EA7\u540E\u4E22\u5F03\u65E7\u9875\u9762\u4EA7\u7269 ${dropped.format + dropped.owner} \u4E2A\uFF08\u683C\u5F0F\u7248\u672C\u4E0D\u7B26 ${dropped.format}\uFF0C\u4EA7\u51FA\u65B9\u7248\u672C\u4E0D\u7B26 ${dropped.owner}\uFF09\uFF0C\u5DF2\u6E05\u7406\u4EA7\u7269\u6587\u4EF6 ${cleaned} \u4E2A\uFF1B\u7531\u4EA7\u51FA\u65B9\u91CD\u65B0\u7F16\u8BD1\u6CE8\u5165\u3002`);
|
|
8814
|
+
}
|
|
8681
8815
|
if (process.env.SOMA_RUNTIME_GC !== "off") {
|
|
8682
8816
|
try {
|
|
8683
8817
|
const referenced = [...state2.entries.values()].flatMap((entry) => entry.binding.digest !== null ? [entry.binding.digest] : []);
|
|
@@ -8920,14 +9054,14 @@ function assertAddress(address, kinds) {
|
|
|
8920
9054
|
}
|
|
8921
9055
|
return { normalized: check.normalized, kind: check.kind };
|
|
8922
9056
|
}
|
|
8923
|
-
function
|
|
9057
|
+
function isRecord10(value2) {
|
|
8924
9058
|
return value2 !== null && typeof value2 === "object" && !Array.isArray(value2);
|
|
8925
9059
|
}
|
|
8926
9060
|
function invalid(situation, problem, remedy) {
|
|
8927
9061
|
return runtimeError("CORE-RUNTIME-ADDRESS-INVALID", situation, problem, remedy);
|
|
8928
9062
|
}
|
|
8929
9063
|
function assertStandardPageShape(page, address) {
|
|
8930
|
-
if (!
|
|
9064
|
+
if (!isRecord10(page)) throw invalid(`\u6CE8\u5165 ${address}`, "\u8F7D\u8377\u4E0D\u662F\u5BF9\u8C61", "\u4F20 { format: 1, html, uiYaml, eventYaml?, styleYaml?, \u2026 }");
|
|
8931
9065
|
if (page.format !== SOMA_PAGE_FORMAT_VERSION) {
|
|
8932
9066
|
throw runtimeError(
|
|
8933
9067
|
"CORE-FORMAT-VERSION-UNSUPPORTED",
|
|
@@ -8936,12 +9070,12 @@ function assertStandardPageShape(page, address) {
|
|
|
8936
9070
|
"\u6309\u5F53\u524D\u4E3B\u7248\u672C\u4EA7\u51FA\u6807\u51C6\u683C\u5F0F"
|
|
8937
9071
|
);
|
|
8938
9072
|
}
|
|
8939
|
-
if (typeof page.html !== "string" || !(typeof page.uiYaml === "string" ||
|
|
9073
|
+
if (typeof page.html !== "string" || !(typeof page.uiYaml === "string" || isRecord10(page.uiYaml))) {
|
|
8940
9074
|
throw invalid(`\u6CE8\u5165 ${address}`, "\u8F7D\u8377\u7F3A html \u6216 uiYaml\uFF08html \u5FC5\u987B\u662F\u5B57\u7B26\u4E32\uFF0CuiYaml \u662F\u5E73\u94FA\u6587\u672C\u6216\u5BF9\u8C61\uFF09", "\u6807\u51C6\u683C\u5F0F\u8F7D\u8377\u662F\u56DB\u4EF6\u5957\uFF1Ahtml + uiYaml\uFF08\u5FC5\u9700\uFF09+ eventYaml / styleYaml\uFF08\u53EF\u9009\uFF09");
|
|
8941
9075
|
}
|
|
8942
9076
|
for (const key of ["eventYaml", "styleYaml"]) {
|
|
8943
9077
|
const value2 = page[key];
|
|
8944
|
-
if (value2 !== void 0 && !(typeof value2 === "string" ||
|
|
9078
|
+
if (value2 !== void 0 && !(typeof value2 === "string" || isRecord10(value2))) {
|
|
8945
9079
|
throw invalid(`\u6CE8\u5165 ${address}`, `\u8F7D\u8377\u7684 ${key} \u5F62\u72B6\u4E0D\u5408\u6CD5\uFF08\u5FC5\u987B\u662F\u5E73\u94FA\u6587\u672C\u6216\u5BF9\u8C61\uFF09`, `${key} \u7F3A\u7701\u8868\u793A\u6CA1\u6709\u8BE5\u4EF6\uFF1B\u7ED9\u4E86\u5C31\u5FC5\u987B\u662F\u5E73\u94FA YAML \u6587\u672C\u6216\u5DF2\u89E3\u6790\u5BF9\u8C61`);
|
|
8946
9080
|
}
|
|
8947
9081
|
}
|
|
@@ -8969,7 +9103,7 @@ function checkOptions(address, options, now) {
|
|
|
8969
9103
|
throw invalid(`\u6CE8\u5165 ${address}`, `owner ${JSON.stringify(options.owner)} \u4E0D\u5408\uFF08\u6765\u6E90\u7C7B\u578B\uFF0C\u5F62\u5982 soma-ui / soma-kit / native\uFF09`, "owner \u662F\u6765\u6E90\u7C7B\u578B\uFF1A\u539F\u751F\u9875 native\uFF0C\u65B9\u8A00\u5199\u65B9\u8A00\u540D");
|
|
8970
9104
|
}
|
|
8971
9105
|
const source2 = options.source;
|
|
8972
|
-
if (source2 !== void 0 && (!
|
|
9106
|
+
if (source2 !== void 0 && (!isRecord10(source2) || typeof source2.format !== "string" || !LABEL3.test(source2.format) || typeof source2.digest !== "string" || source2.digest === "" || source2.digest.length > 128)) {
|
|
8973
9107
|
throw invalid(`\u6CE8\u5165 ${address}`, "source \u5FC5\u987B\u662F { format: \u5C0F\u5199\u6807\u7B7E, digest: \u975E\u7A7A\u4E32 }", "format \u662F\u4E0D\u900F\u660E\u6765\u6E90\u6807\u7B7E\uFF0Cdigest \u662F\u6765\u6E90\u6E90\u7801\u6458\u8981");
|
|
8974
9108
|
}
|
|
8975
9109
|
}
|
|
@@ -9040,10 +9174,10 @@ function unbindRegistryPage(address) {
|
|
|
9040
9174
|
}
|
|
9041
9175
|
|
|
9042
9176
|
// core/server/runtime-space/dynamic-pages.ts
|
|
9043
|
-
var
|
|
9177
|
+
var import_js_yaml10 = __toESM(require("js-yaml"));
|
|
9044
9178
|
|
|
9045
9179
|
// core/server/registry/validation/declaration-safety-scan.ts
|
|
9046
|
-
var
|
|
9180
|
+
var import_js_yaml9 = __toESM(require("js-yaml"));
|
|
9047
9181
|
|
|
9048
9182
|
// core/shared/inert-data-element.ts
|
|
9049
9183
|
var ALLOWED_ATTRS = /* @__PURE__ */ new Set(["type", "id"]);
|
|
@@ -9165,7 +9299,7 @@ function hasDangerousSchemeInRawText(source2) {
|
|
|
9165
9299
|
function hasDangerousSchemeInYaml(source2) {
|
|
9166
9300
|
let document;
|
|
9167
9301
|
try {
|
|
9168
|
-
document =
|
|
9302
|
+
document = import_js_yaml9.default.load(source2);
|
|
9169
9303
|
} catch {
|
|
9170
9304
|
return hasDangerousSchemeInRawText(source2);
|
|
9171
9305
|
}
|
|
@@ -9346,7 +9480,7 @@ function isStandardDeclaration(declaration) {
|
|
|
9346
9480
|
|
|
9347
9481
|
// core/server/runtime-space/resolve.ts
|
|
9348
9482
|
var import_node_path13 = __toESM(require("node:path"));
|
|
9349
|
-
var
|
|
9483
|
+
var import_js_yaml12 = __toESM(require("js-yaml"));
|
|
9350
9484
|
var import_node_crypto7 = require("node:crypto");
|
|
9351
9485
|
|
|
9352
9486
|
// core/shared/published-page-route.ts
|
|
@@ -10337,7 +10471,7 @@ function digestTreeData(value2) {
|
|
|
10337
10471
|
}
|
|
10338
10472
|
|
|
10339
10473
|
// core/build/component-tree/artifact-codec.ts
|
|
10340
|
-
var
|
|
10474
|
+
var import_js_yaml11 = __toESM(require("js-yaml"));
|
|
10341
10475
|
var TREE_COMPILER_VERSION = "component-tree:1.0.0";
|
|
10342
10476
|
function fail2(path18) {
|
|
10343
10477
|
throw new SomaComponentTreeError({
|
|
@@ -10370,7 +10504,7 @@ function normalizeRuntimeConfig(input) {
|
|
|
10370
10504
|
const safe = record2(canonicalTreeData(input));
|
|
10371
10505
|
if (safe.styleYaml?.trim() || safe.styleConfig !== void 0 && safe.styleConfig !== null && Object.keys(record2(safe.styleConfig)).length > 0) fail2("style");
|
|
10372
10506
|
const objectUi = safe.uiConfig === void 0 ? void 0 : normalizeUi(safe.uiConfig, safe);
|
|
10373
|
-
const yamlUi = safe.uiYaml === void 0 ? void 0 : normalizeUi(
|
|
10507
|
+
const yamlUi = safe.uiYaml === void 0 ? void 0 : normalizeUi(import_js_yaml11.default.load(safe.uiYaml), safe);
|
|
10374
10508
|
const ui = same(objectUi, yamlUi, "ui");
|
|
10375
10509
|
if (ui === void 0) fail2("ui");
|
|
10376
10510
|
const timers = same(safe.timers, safe.timerConfig, "event.timers");
|
|
@@ -10534,7 +10668,7 @@ function message2(error) {
|
|
|
10534
10668
|
var import_node_path11 = __toESM(require("node:path"));
|
|
10535
10669
|
|
|
10536
10670
|
// core/shared/std-auth-scan.ts
|
|
10537
|
-
function
|
|
10671
|
+
function isRecord11(value2) {
|
|
10538
10672
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
10539
10673
|
}
|
|
10540
10674
|
function apiText(value2) {
|
|
@@ -10545,7 +10679,7 @@ function nameOf(entry, names) {
|
|
|
10545
10679
|
}
|
|
10546
10680
|
function scanApiRefsAt(context, node, names) {
|
|
10547
10681
|
const refs = [];
|
|
10548
|
-
if (!
|
|
10682
|
+
if (!isRecord11(node)) return refs;
|
|
10549
10683
|
for (const point of SOMA_STD_AUTH_SCAN.points) {
|
|
10550
10684
|
if (point.context !== context) continue;
|
|
10551
10685
|
const value2 = node[nameOf(point, names)];
|
|
@@ -10576,7 +10710,7 @@ function scanApiRefsAt(context, node, names) {
|
|
|
10576
10710
|
function readPath(value2, path18) {
|
|
10577
10711
|
let node = value2;
|
|
10578
10712
|
for (const segment of path18) {
|
|
10579
|
-
if (!
|
|
10713
|
+
if (!isRecord11(node)) return void 0;
|
|
10580
10714
|
node = node[segment];
|
|
10581
10715
|
}
|
|
10582
10716
|
return node;
|
|
@@ -10594,7 +10728,7 @@ function collectGrammarApiRefs(object, options) {
|
|
|
10594
10728
|
for (const ref of scanApiRefsAt(context, node, options.names)) {
|
|
10595
10729
|
out.push({ path: apiRefPath(base, ref, options), api: ref.api, ...ref.bare ? { bare: true } : {} });
|
|
10596
10730
|
}
|
|
10597
|
-
if (!
|
|
10731
|
+
if (!isRecord11(node)) return;
|
|
10598
10732
|
for (const container of SOMA_STD_AUTH_SCAN.containers) {
|
|
10599
10733
|
if (container.context !== context) continue;
|
|
10600
10734
|
const child = node[nameOf(container, options.names)];
|
|
@@ -10602,7 +10736,7 @@ function collectGrammarApiRefs(object, options) {
|
|
|
10602
10736
|
const target = container.contains;
|
|
10603
10737
|
const run = () => {
|
|
10604
10738
|
if (container.shape === "map") {
|
|
10605
|
-
if (!
|
|
10739
|
+
if (!isRecord11(child)) return;
|
|
10606
10740
|
const keys = options.sortFields === true ? Object.keys(child).sort() : Object.keys(child);
|
|
10607
10741
|
for (const name of keys) visit(target, child[name], options.keyPath(childBase, name), false);
|
|
10608
10742
|
} else if (Array.isArray(child)) {
|
|
@@ -12535,13 +12669,13 @@ var SOMA_GENERATION_ERROR_CODES = [
|
|
|
12535
12669
|
];
|
|
12536
12670
|
|
|
12537
12671
|
// core/shared/generation-diagnostics.ts
|
|
12538
|
-
function
|
|
12672
|
+
function isRecord12(value2) {
|
|
12539
12673
|
return typeof value2 === "object" && value2 !== null;
|
|
12540
12674
|
}
|
|
12541
12675
|
function isGenerationErrorShape(value2) {
|
|
12542
|
-
if (!
|
|
12676
|
+
if (!isRecord12(value2)) return false;
|
|
12543
12677
|
const src = value2.src;
|
|
12544
|
-
return typeof value2.code === "string" && SOMA_GENERATION_ERROR_CODES.includes(value2.code) && typeof value2.layer === "string" && typeof value2.situation === "string" && typeof value2.problem === "string" && typeof value2.remedy === "string" &&
|
|
12678
|
+
return typeof value2.code === "string" && SOMA_GENERATION_ERROR_CODES.includes(value2.code) && typeof value2.layer === "string" && typeof value2.situation === "string" && typeof value2.problem === "string" && typeof value2.remedy === "string" && isRecord12(src) && typeof src.file === "string" && typeof src.path === "string";
|
|
12545
12679
|
}
|
|
12546
12680
|
function toPlainErrorShape(shape) {
|
|
12547
12681
|
return {
|
|
@@ -12555,7 +12689,7 @@ function toPlainErrorShape(shape) {
|
|
|
12555
12689
|
};
|
|
12556
12690
|
}
|
|
12557
12691
|
function readGenerationDiagnostics(error) {
|
|
12558
|
-
if (!
|
|
12692
|
+
if (!isRecord12(error)) return null;
|
|
12559
12693
|
const list2 = error.diagnostics;
|
|
12560
12694
|
if (Array.isArray(list2) && list2.length > 0 && list2.every(isGenerationErrorShape)) {
|
|
12561
12695
|
return list2.map(toPlainErrorShape);
|
|
@@ -13171,7 +13305,7 @@ function readHostFiles(hostDir) {
|
|
|
13171
13305
|
function pageLocaleBundle(page) {
|
|
13172
13306
|
if (page.locale === void 0 || page.locale.trim() === "") return void 0;
|
|
13173
13307
|
try {
|
|
13174
|
-
const parsed =
|
|
13308
|
+
const parsed = import_js_yaml12.default.load(page.locale);
|
|
13175
13309
|
return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : void 0;
|
|
13176
13310
|
} catch {
|
|
13177
13311
|
return void 0;
|
|
@@ -13960,11 +14094,8 @@ function clearTailwindCompilerCache() {
|
|
|
13960
14094
|
// host-native/src/page-http.ts
|
|
13961
14095
|
var import_node_crypto9 = require("node:crypto");
|
|
13962
14096
|
var import_node_zlib = __toESM(require("node:zlib"));
|
|
13963
|
-
|
|
13964
|
-
|
|
13965
|
-
}
|
|
13966
|
-
var VARY_DEFAULT = "Cookie, Authorization";
|
|
13967
|
-
var VARY_ENCODING = "Cookie, Authorization, Accept-Encoding";
|
|
14097
|
+
|
|
14098
|
+
// host-native/src/page-payload-cache.ts
|
|
13968
14099
|
var MAX_CACHE_ENTRIES = 256;
|
|
13969
14100
|
var MAX_CACHE_BYTES = 64 * 1024 * 1024;
|
|
13970
14101
|
var PagePayloadBufferLRU = class {
|
|
@@ -14011,6 +14142,13 @@ var PagePayloadBufferCache = new PagePayloadBufferLRU();
|
|
|
14011
14142
|
function clearPagePayloadBufferCache() {
|
|
14012
14143
|
PagePayloadBufferCache.clear();
|
|
14013
14144
|
}
|
|
14145
|
+
|
|
14146
|
+
// host-native/src/page-http.ts
|
|
14147
|
+
function resolveLoginPath(assembly) {
|
|
14148
|
+
return resolveHostLoginPath(assembly);
|
|
14149
|
+
}
|
|
14150
|
+
var VARY_DEFAULT = "Cookie, Authorization";
|
|
14151
|
+
var VARY_ENCODING = "Cookie, Authorization, Accept-Encoding";
|
|
14014
14152
|
function weakEtag(body) {
|
|
14015
14153
|
return `W/"${(0, import_node_crypto9.createHash)("sha1").update(body).digest("hex").slice(0, 20)}"`;
|
|
14016
14154
|
}
|
|
@@ -14148,7 +14286,7 @@ function writeIfChanged(file, content) {
|
|
|
14148
14286
|
function readCompiledRecord(file) {
|
|
14149
14287
|
try {
|
|
14150
14288
|
const record3 = JSON.parse(import_node_fs14.default.readFileSync(file, "utf8"));
|
|
14151
|
-
return record3.schemaVersion ===
|
|
14289
|
+
return record3.schemaVersion === SOMA_RUNTIME_STORE_FORMAT && typeof record3.digest === "string" ? record3 : null;
|
|
14152
14290
|
} catch {
|
|
14153
14291
|
return null;
|
|
14154
14292
|
}
|
|
@@ -14181,7 +14319,7 @@ async function runPrewarm(options) {
|
|
|
14181
14319
|
continue;
|
|
14182
14320
|
}
|
|
14183
14321
|
const record3 = {
|
|
14184
|
-
schemaVersion:
|
|
14322
|
+
schemaVersion: SOMA_RUNTIME_STORE_FORMAT,
|
|
14185
14323
|
address: item.address,
|
|
14186
14324
|
digest,
|
|
14187
14325
|
inputsDigest: item.inputsDigest,
|
|
@@ -14202,7 +14340,7 @@ async function runPrewarm(options) {
|
|
|
14202
14340
|
} catch {
|
|
14203
14341
|
}
|
|
14204
14342
|
if (options.meta !== void 0) {
|
|
14205
|
-
const record3 = { schemaVersion:
|
|
14343
|
+
const record3 = { schemaVersion: SOMA_RUNTIME_STORE_FORMAT, meta: options.meta };
|
|
14206
14344
|
writeIfChanged(import_node_path16.default.join(layout.dirs.prewarm, SOMA_PREWARM_META_FILE), `${JSON.stringify(record3)}
|
|
14207
14345
|
`);
|
|
14208
14346
|
}
|
|
@@ -14219,7 +14357,7 @@ async function runPrewarm(options) {
|
|
|
14219
14357
|
persistedBindings += 1;
|
|
14220
14358
|
}
|
|
14221
14359
|
const sorted = Object.fromEntries(Object.entries(entries).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
|
|
14222
|
-
const indexText = `${JSON.stringify({ schemaVersion:
|
|
14360
|
+
const indexText = `${JSON.stringify({ schemaVersion: SOMA_RUNTIME_STORE_FORMAT, entries: sorted }, null, 2)}
|
|
14223
14361
|
`;
|
|
14224
14362
|
writeIfChanged(import_node_path16.default.join(layout.dirs.prewarm, "index.json"), indexText);
|
|
14225
14363
|
return {
|
|
@@ -14247,13 +14385,13 @@ function readPrewarmCompiled(layout) {
|
|
|
14247
14385
|
let meta = null;
|
|
14248
14386
|
try {
|
|
14249
14387
|
const parsed = JSON.parse(import_node_fs14.default.readFileSync(import_node_path16.default.join(layout.dirs.prewarm, SOMA_PREWARM_META_FILE), "utf8"));
|
|
14250
|
-
if (parsed.schemaVersion ===
|
|
14388
|
+
if (parsed.schemaVersion === SOMA_RUNTIME_STORE_FORMAT) meta = parsed.meta;
|
|
14251
14389
|
} catch {
|
|
14252
14390
|
}
|
|
14253
14391
|
return { pages, meta };
|
|
14254
14392
|
}
|
|
14255
14393
|
|
|
14256
|
-
// core/server/
|
|
14394
|
+
// core/server/host/precompiled-manifest.ts
|
|
14257
14395
|
function validatePages(raw) {
|
|
14258
14396
|
if (!raw?.pages || !Array.isArray(raw.pages)) return null;
|
|
14259
14397
|
for (const page of raw.pages) {
|
|
@@ -14387,12 +14525,12 @@ function buildRouteTable(htmlFiles) {
|
|
|
14387
14525
|
}
|
|
14388
14526
|
|
|
14389
14527
|
// core/build/compiler/full-manifest-builder.ts
|
|
14390
|
-
var
|
|
14528
|
+
var import_js_yaml13 = __toESM(require("js-yaml"));
|
|
14391
14529
|
function precompileAll(inputs) {
|
|
14392
14530
|
const hostAppConfig = parseAppConfigYaml(inputs.appConfigYaml);
|
|
14393
14531
|
return {
|
|
14394
14532
|
routes: buildRouteTable(inputs.htmlFiles),
|
|
14395
|
-
locale:
|
|
14533
|
+
locale: import_js_yaml13.default.load(inputs.localeYaml) || {},
|
|
14396
14534
|
appConfig: hostAppConfig,
|
|
14397
14535
|
pages: inputs.pages.map((p) => precompilePage(p, {
|
|
14398
14536
|
hostAppConfig,
|
|
@@ -14434,8 +14572,20 @@ function precompilePage(p, context) {
|
|
|
14434
14572
|
}
|
|
14435
14573
|
|
|
14436
14574
|
// host-native/src/host-prepare.ts
|
|
14437
|
-
var import_host_config_paths5 = __toESM(
|
|
14575
|
+
var import_host_config_paths5 = __toESM(require_host_config_paths2());
|
|
14438
14576
|
var SOMA_SHELL_ROUTES_ENV = "SOMA_SHELL_ROUTES";
|
|
14577
|
+
var coreIdentityMemo = null;
|
|
14578
|
+
function coreCompilerIdentity() {
|
|
14579
|
+
if (coreIdentityMemo !== null) return coreIdentityMemo;
|
|
14580
|
+
let version = "unknown";
|
|
14581
|
+
try {
|
|
14582
|
+
const raw = JSON.parse(import_node_fs15.default.readFileSync(import_node_path17.default.join(__dirname, "..", "..", "package.json"), "utf8"));
|
|
14583
|
+
if (typeof raw.version === "string") version = raw.version;
|
|
14584
|
+
} catch {
|
|
14585
|
+
}
|
|
14586
|
+
coreIdentityMemo = `soma-core@${version}/store-format-${SOMA_RUNTIME_STORE_FORMAT}`;
|
|
14587
|
+
return coreIdentityMemo;
|
|
14588
|
+
}
|
|
14439
14589
|
var lastRaw;
|
|
14440
14590
|
var lastParsed = [];
|
|
14441
14591
|
function readShellRoutesFromEnv(env = process.env) {
|
|
@@ -14540,7 +14690,8 @@ async function prewarmHostPages(hostDir, env = process.env) {
|
|
|
14540
14690
|
appConfigYaml: compileInput.appConfigYaml,
|
|
14541
14691
|
hostAppConfigYaml: appConfigYaml,
|
|
14542
14692
|
treeContext: compileInput.treeContext ?? null,
|
|
14543
|
-
|
|
14693
|
+
// 预编译旁档只在「同一份 core 编的」时复用:core 升级后整批旁档自动失效,不需要手工清 .soma/runtime
|
|
14694
|
+
compilerIdentity: coreCompilerIdentity()
|
|
14544
14695
|
}),
|
|
14545
14696
|
compile: () => precompilePage(compileInput, { hostAppConfig: shell.appConfig })
|
|
14546
14697
|
};
|
|
@@ -15488,6 +15639,13 @@ data: ${data || ""}
|
|
|
15488
15639
|
});
|
|
15489
15640
|
return refreshTask;
|
|
15490
15641
|
};
|
|
15642
|
+
const waitForDevRefreshIdle = async () => {
|
|
15643
|
+
const deadline = Date.now() + 3e4;
|
|
15644
|
+
while (!watcherClosed && (refreshTask !== null || refreshPending || debounceTimer !== null) && Date.now() < deadline) {
|
|
15645
|
+
if (refreshTask !== null) await refreshTask.catch(() => void 0);
|
|
15646
|
+
else await new Promise((resolve4) => setTimeout(resolve4, 50));
|
|
15647
|
+
}
|
|
15648
|
+
};
|
|
15491
15649
|
if (dev) {
|
|
15492
15650
|
try {
|
|
15493
15651
|
fsWatcher = import_node_fs17.default.watch(webRoot, { recursive: true }, (_event, filename) => {
|
|
@@ -15585,8 +15743,10 @@ data: ${data || ""}
|
|
|
15585
15743
|
const subSegments = pathname.slice("/_soma/client/".length).split("/").filter(Boolean);
|
|
15586
15744
|
const staticReq = createStaticLookupRequest(req, method);
|
|
15587
15745
|
const clientStaticDir = import_node_path19.default.resolve(runtimeLayout2.dirs.static, "client");
|
|
15746
|
+
if (dev) await waitForDevRefreshIdle();
|
|
15588
15747
|
const clientRes = serveStaticFromRoot(clientStaticDir, subSegments, staticReq, true);
|
|
15589
15748
|
if (clientRes) {
|
|
15749
|
+
if (dev && !/immutable/.test(clientRes.headers.get("cache-control") ?? "")) clientRes.headers.set("cache-control", "no-cache");
|
|
15590
15750
|
await sendWebResponse(clientRes, res, method);
|
|
15591
15751
|
return;
|
|
15592
15752
|
}
|
|
@@ -15650,6 +15810,7 @@ data: ${data || ""}
|
|
|
15650
15810
|
await sendWebResponse(response, res, method);
|
|
15651
15811
|
return;
|
|
15652
15812
|
} catch (error) {
|
|
15813
|
+
if (!isStatusError(error)) console.error(`[soma-native] \u9875\u9762\u8F7D\u5165\u5931\u8D25 path=${pagePath}`, error);
|
|
15653
15814
|
let response = pageErrorResponse(error, assembly);
|
|
15654
15815
|
response = await applyHostAndCspHeaders(response, { method: "GET", pathname }, env);
|
|
15655
15816
|
await sendWebResponse(response, res, method);
|