soma-core 1.3.3 → 1.3.5
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/README.md +7 -6
- package/app/SomaPageClient.tsx +2 -72
- package/app/soma/page/route.ts +17 -2
- package/bin/soma-lsp.cjs +1 -4
- package/core/build/compiler/full-manifest-builder.ts +17 -26
- package/core/build/compiler/html-include-expander.ts +56 -0
- package/core/build/compiler/page-assets.ts +26 -0
- package/core/build/compiler/page-declaration-compiler.ts +85 -0
- package/core/build/compiler/rollup-plugin-soma.ts +4 -19
- package/core/build/compiler/route-builder.ts +0 -2
- package/core/build/compiler/rspack-plugin-soma.js +1 -10
- package/core/build/compiler/soma-manifest-webpack-plugin.js +54 -13
- package/core/build/compiler/soma-precompile.js +74 -0
- package/core/build/compiler/soma-precompile.ts +13 -0
- package/core/build/compiler/soma-rspack-yaml-loader.js +5 -11
- package/core/build/compiler/soma-webpack-loader.js +6 -21
- package/core/build/compiler/vite-plugin-soma.ts +9 -31
- package/core/build/component/pack-from-dir.ts +58 -0
- package/core/build/component/package-loader.ts +158 -12
- package/core/build/eject/plan-eject.ts +15 -21
- package/core/build/lsp/cross-file-diagnostics.cjs +82 -113
- package/core/build/lsp/extra-completion.cjs +14 -8
- package/core/build/lsp/lsp-navigation.cjs +50 -43
- package/core/build/lsp/soma-declaration.cjs +85 -0
- package/core/build/lsp/ui-yaml-completion.cjs +98 -104
- package/core/build/v2/block-compile.ts +200 -0
- package/core/build/v2/block-loader.ts +33 -0
- package/core/build/v2/html-index.ts +120 -0
- package/core/build/v2/migrate-v1.ts +370 -0
- package/core/build/v2/soma-file-loader.ts +216 -0
- package/core/client/component/ai-catalog.ts +15 -0
- package/core/client/component/component-pack.ts +205 -31
- package/core/client/component/contract-compat.ts +132 -0
- package/core/client/component/example-v2.ts +132 -0
- package/core/client/engine/dom-renderer.ts +14 -8
- package/core/client/engine/reactive-proxy.ts +8 -7
- package/core/client/engine/soma-bootstrap.ts +23 -5
- package/core/client/parser/v2/namespace.ts +182 -0
- package/core/client/parser/v2/page-parser.ts +359 -0
- package/core/client/parser/v2/use-parser.ts +412 -0
- package/core/client/parser/value-lang.ts +340 -0
- package/core/client/pipes/pipe-registry.ts +1 -1
- package/core/client/registry/declaration-renderer.ts +17 -15
- package/core/client/registry/page-lifecycle.ts +1 -1
- package/core/client/security/attribute-presence.ts +16 -1
- package/core/client/theme/harmony.ts +307 -0
- package/core/client/theme/scene-tokens.ts +134 -0
- package/core/client/theme/theme-axes.ts +228 -0
- package/core/client/theme/theme-engine.ts +333 -73
- package/core/client/theme/tone-solver.ts +118 -0
- package/core/index.ts +74 -2
- package/core/server/host/published-page-assets.ts +35 -0
- package/core/server/host/server-page-assets.ts +33 -16
- package/core/server/host/soma-page-compile.ts +33 -0
- package/core/server/index.ts +15 -0
- package/core/server/registry/declaration-precompiler.ts +24 -54
- package/core/server/registry/page-registry-store.ts +39 -10
- package/core/server/registry/services/pages/Get.ts +19 -9
- package/core/server/registry/validation/compile-gate.ts +14 -31
- package/core/server/registry/validation/cross-check.ts +7 -17
- package/core/server/registry/validation/declaration-safety-scan.ts +2 -2
- package/core/shared/types/component-contract.types.ts +10 -0
- package/dist/core/index.cjs +2144 -155
- package/dist/types/build/compiler/full-manifest-builder.d.ts +4 -4
- package/dist/types/build/compiler/html-include-expander.d.ts +19 -0
- package/dist/types/build/compiler/page-assets.d.ts +3 -0
- package/dist/types/build/compiler/page-declaration-compiler.d.ts +33 -0
- package/dist/types/build/compiler/rollup-plugin-soma.d.ts +0 -3
- package/dist/types/build/compiler/route-builder.d.ts +0 -1
- package/dist/types/build/compiler/soma-precompile.d.ts +8 -0
- package/dist/types/build/compiler/vite-plugin-soma.d.ts +2 -10
- package/dist/types/build/component/pack-from-dir.d.ts +17 -0
- package/dist/types/build/component/package-loader.d.ts +33 -2
- package/dist/types/build/v2/block-compile.d.ts +28 -0
- package/dist/types/build/v2/block-loader.d.ts +9 -0
- package/dist/types/build/v2/html-index.d.ts +37 -0
- package/dist/types/build/v2/migrate-v1.d.ts +32 -0
- package/dist/types/build/v2/soma-file-loader.d.ts +45 -0
- package/dist/types/client/component/component-pack.d.ts +23 -3
- package/dist/types/client/component/contract-compat.d.ts +16 -0
- package/dist/types/client/component/example-v2.d.ts +9 -0
- package/dist/types/client/engine/dom-renderer.d.ts +2 -0
- package/dist/types/client/engine/soma-bootstrap.d.ts +3 -1
- package/dist/types/client/parser/v2/namespace.d.ts +52 -0
- package/dist/types/client/parser/v2/page-parser.d.ts +21 -0
- package/dist/types/client/parser/v2/use-parser.d.ts +72 -0
- package/dist/types/client/parser/value-lang.d.ts +63 -0
- package/dist/types/client/registry/declaration-renderer.d.ts +1 -2
- package/dist/types/client/theme/harmony.d.ts +77 -0
- package/dist/types/client/theme/scene-tokens.d.ts +25 -0
- package/dist/types/client/theme/theme-axes.d.ts +81 -0
- package/dist/types/client/theme/theme-engine.d.ts +29 -1
- package/dist/types/client/theme/tone-solver.d.ts +47 -0
- package/dist/types/index.d.ts +13 -2
- package/dist/types/server/host/published-page-assets.d.ts +19 -0
- package/dist/types/server/host/server-page-assets.d.ts +1 -4
- package/dist/types/server/host/soma-page-compile.d.ts +7 -0
- package/dist/types/server/index.d.ts +3 -1
- package/dist/types/server/registry/declaration-precompiler.d.ts +3 -3
- package/dist/types/server/registry/page-registry-store.d.ts +5 -5
- package/dist/types/server/registry/validation/compile-gate.d.ts +2 -0
- package/dist/types/server/registry/validation/cross-check.d.ts +4 -4
- package/dist/types/shared/types/component-contract.types.d.ts +10 -0
- package/editor/vscode/package.json +1 -24
- package/global.d.ts +1 -11
- package/next.config.js +32 -50
- package/package.json +3 -2
- package/tailwind.config.ts +0 -1
- package/tsconfig.json +20 -7
- package/core/build/lsp/event-yaml-completion.cjs +0 -106
- package/core/client/host-bridge/empty-host/data/README.md +0 -17
- package/editor/vscode/syntaxes/soma-event-yaml.tmLanguage.json +0 -30
package/next.config.js
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const { SomaManifestWebpackPlugin } = require('./core/build/compiler/soma-manifest-webpack-plugin');
|
|
5
|
-
const {
|
|
6
|
-
resolveHostConfigRoot,
|
|
7
|
-
resolveHostAppConfigPath,
|
|
8
|
-
} = require('./core/server/host/host-config-paths.cjs');
|
|
9
5
|
const {
|
|
10
6
|
readSomaPageResponseMode,
|
|
11
7
|
} = require('./core/server/host/page-response-mode.cjs');
|
|
@@ -68,47 +64,39 @@ function readHostSourceRoot() {
|
|
|
68
64
|
}
|
|
69
65
|
|
|
70
66
|
const hostSourceRoot = readHostSourceRoot();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
function runtimeWatchIgnoreDirectories(env = process.env) {
|
|
68
|
+
const directories = [
|
|
69
|
+
path.join(hostDir, 'runtime'),
|
|
70
|
+
path.join(hostDir, 'data', 'soma-runtime'),
|
|
71
|
+
path.join(hostDir, '.soma', 'next', 'runtime'),
|
|
72
|
+
env.SOMA_AI_METRICS_DIR,
|
|
73
|
+
env.SOMA_AI_FAILURE_DIR,
|
|
74
|
+
env.SOMA_PAGE_REGISTRY_DIR,
|
|
75
|
+
].filter((value) => typeof value === 'string' && value.trim() !== '');
|
|
76
|
+
return [...new Set(directories.map((directory) => path.resolve(directory).replaceAll(path.sep, '/')))];
|
|
79
77
|
}
|
|
80
78
|
|
|
81
|
-
function
|
|
82
|
-
|
|
83
|
-
if (fs.existsSync(hostFile)) {
|
|
84
|
-
return hostFile;
|
|
85
|
-
}
|
|
86
|
-
return path.resolve(__dirname, fallbackPath);
|
|
79
|
+
function escapeRegExp(value) {
|
|
80
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
87
81
|
}
|
|
88
82
|
|
|
89
|
-
function
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
function mergeWatchIgnored(existingIgnored) {
|
|
84
|
+
const directories = runtimeWatchIgnoreDirectories();
|
|
85
|
+
const patterns = directories.map((directory) => `${directory}/**`);
|
|
86
|
+
if (existingIgnored === undefined) return patterns;
|
|
87
|
+
if (existingIgnored instanceof RegExp) {
|
|
88
|
+
const runtimeSource = directories
|
|
89
|
+
.map((directory) => `${escapeRegExp(directory)}(?:[\\\\/]|$)`)
|
|
90
|
+
.join('|');
|
|
91
|
+
return new RegExp(`(?:${existingIgnored.source})|(?:${runtimeSource})`, existingIgnored.flags);
|
|
93
92
|
}
|
|
94
|
-
return
|
|
93
|
+
return [...(Array.isArray(existingIgnored) ? existingIgnored : [existingIgnored]), ...patterns];
|
|
95
94
|
}
|
|
96
95
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
* 但 SomaPageClient 对四件套 + data 是一次性并发 import,webpack 要为
|
|
102
|
-
* `@soma-host/data/${base}_data.yaml` 建 context——目录不存在时它不会安静跳过,
|
|
103
|
-
* 而是每次页面加载都报 `Module not found: Can't resolve '@soma-host/data'`。
|
|
104
|
-
* 运行时有 `.catch(() => null)` 兜底所以页面照常渲染,于是这条错误既不影响功能、
|
|
105
|
-
* 又永远刷在控制台上,把真正该看见的错误淹掉。
|
|
106
|
-
* 空目录让 context 成立且为空,import 走 catch 返回 null,与"宿主没有数据层"语义一致。
|
|
107
|
-
*/
|
|
108
|
-
function resolveOptionalHostSourceDir(relativePath, fallbackPath) {
|
|
109
|
-
const hostDirCandidate = path.resolve(hostSourceRoot, relativePath);
|
|
110
|
-
if (fs.existsSync(hostDirCandidate)) {
|
|
111
|
-
return hostDirCandidate;
|
|
96
|
+
function resolveOptionalHostSourceFile(relativePath, fallbackPath) {
|
|
97
|
+
const hostFile = path.resolve(hostSourceRoot, relativePath);
|
|
98
|
+
if (fs.existsSync(hostFile)) {
|
|
99
|
+
return hostFile;
|
|
112
100
|
}
|
|
113
101
|
return path.resolve(__dirname, fallbackPath);
|
|
114
102
|
}
|
|
@@ -230,6 +218,12 @@ const nextConfig = {
|
|
|
230
218
|
if (webpackCacheMode === 'memory' && dev) {
|
|
231
219
|
config.cache = { type: 'memory' };
|
|
232
220
|
}
|
|
221
|
+
if (dev) {
|
|
222
|
+
config.watchOptions = {
|
|
223
|
+
...config.watchOptions,
|
|
224
|
+
ignored: mergeWatchIgnored(config.watchOptions?.ignored),
|
|
225
|
+
};
|
|
226
|
+
}
|
|
233
227
|
config.resolve.alias['@'] = __dirname;
|
|
234
228
|
config.resolve.alias['soma-core$'] = path.resolve(__dirname, 'core/index.ts');
|
|
235
229
|
// Webpack 不会对指向源码 `.ts` 的 package-export 子路径稳定做条件解析;
|
|
@@ -266,18 +260,6 @@ const nextConfig = {
|
|
|
266
260
|
'bootstrap/soma-domain-loaders.ts',
|
|
267
261
|
'core/client/host-bridge/soma-domain-loaders.stub.ts',
|
|
268
262
|
);
|
|
269
|
-
config.resolve.alias['@soma-host/config/locale.yaml'] = resolveOptionalHostConfigFile(
|
|
270
|
-
'locale.yaml',
|
|
271
|
-
'core/server/host/locale.stub.ts',
|
|
272
|
-
);
|
|
273
|
-
config.resolve.alias['@soma-host/config/app.config.yaml'] = resolveHostAppConfigAlias(
|
|
274
|
-
'core/server/host/app-config.stub.ts',
|
|
275
|
-
);
|
|
276
|
-
// 必须排在 '@soma-host' 之前:数据对象层可选,宿主没有 data/ 时落到空目录
|
|
277
|
-
config.resolve.alias['@soma-host/data'] = resolveOptionalHostSourceDir(
|
|
278
|
-
'data',
|
|
279
|
-
'core/client/host-bridge/empty-host/data',
|
|
280
|
-
);
|
|
281
263
|
config.resolve.alias['@soma-host'] = hostSourceRoot;
|
|
282
264
|
|
|
283
265
|
config.plugins.push(new SomaManifestWebpackPlugin({ hostDir }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soma-core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "SOMA — Semantic Oriented Modular Architecture. A declarative frontend framework runtime built on Next.js 16 App Router.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"soma",
|
|
@@ -133,7 +133,8 @@
|
|
|
133
133
|
"verify:client-dep-graph": "node scripts/verify-client-dep-graph.mjs",
|
|
134
134
|
"test:watch": "vitest",
|
|
135
135
|
"typecheck": "tsc --noEmit",
|
|
136
|
-
"verify:precompile": "node scripts/verify-precompile-fresh.mjs"
|
|
136
|
+
"verify:precompile": "node scripts/verify-precompile-fresh.mjs",
|
|
137
|
+
"theme:snapshot": "tsx scripts/build-theme-snapshot.mjs"
|
|
137
138
|
},
|
|
138
139
|
"dependencies": {
|
|
139
140
|
"ajv": "8.20.0",
|
package/tailwind.config.ts
CHANGED
|
@@ -28,7 +28,6 @@ function loadHostPreset(): Config | null {
|
|
|
28
28
|
const hostPreset = loadHostPreset();
|
|
29
29
|
const sourceContent = getSomaAssetSources(hostDir).flatMap((source) => [
|
|
30
30
|
path.join(source.assetRoot, 'html/**/*.html'),
|
|
31
|
-
path.join(source.assetRoot, 'ui/**/*_style.yaml'),
|
|
32
31
|
path.join(source.assetRoot, 'styles/**/*.css'),
|
|
33
32
|
]);
|
|
34
33
|
|
package/tsconfig.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ES2017",
|
|
4
|
-
"lib": [
|
|
4
|
+
"lib": [
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.iterable",
|
|
7
|
+
"esnext"
|
|
8
|
+
],
|
|
5
9
|
"allowJs": true,
|
|
6
10
|
"skipLibCheck": true,
|
|
7
11
|
"strict": true,
|
|
@@ -11,16 +15,22 @@
|
|
|
11
15
|
"moduleResolution": "bundler",
|
|
12
16
|
"resolveJsonModule": true,
|
|
13
17
|
"isolatedModules": true,
|
|
14
|
-
"jsx": "
|
|
18
|
+
"jsx": "react-jsx",
|
|
15
19
|
"incremental": true,
|
|
16
20
|
"experimentalDecorators": true,
|
|
17
21
|
"emitDecoratorMetadata": true,
|
|
18
22
|
"plugins": [
|
|
19
|
-
{
|
|
23
|
+
{
|
|
24
|
+
"name": "next"
|
|
25
|
+
}
|
|
20
26
|
],
|
|
21
27
|
"paths": {
|
|
22
|
-
"@core/*": [
|
|
23
|
-
|
|
28
|
+
"@core/*": [
|
|
29
|
+
"./core/*"
|
|
30
|
+
],
|
|
31
|
+
"@/*": [
|
|
32
|
+
"./*"
|
|
33
|
+
]
|
|
24
34
|
},
|
|
25
35
|
"baseUrl": "."
|
|
26
36
|
},
|
|
@@ -29,7 +39,10 @@
|
|
|
29
39
|
"global.d.ts",
|
|
30
40
|
"**/*.ts",
|
|
31
41
|
"**/*.tsx",
|
|
32
|
-
".next/types/**/*.ts"
|
|
42
|
+
".next/types/**/*.ts",
|
|
43
|
+
".next/dev/types/**/*.ts"
|
|
33
44
|
],
|
|
34
|
-
"exclude": [
|
|
45
|
+
"exclude": [
|
|
46
|
+
"node_modules"
|
|
47
|
+
]
|
|
35
48
|
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* _event.yaml 智能补全:锚点事件、事件类型、domain 方法
|
|
3
|
-
*/
|
|
4
|
-
const fs = require('node:fs');
|
|
5
|
-
const path = require('node:path');
|
|
6
|
-
|
|
7
|
-
const EVENT_TYPES = ['UI_REFRESH', 'NAV_ACTION', 'NAV_STATIC', 'UI_INTERACT', 'CONFIRM'];
|
|
8
|
-
const TRIGGERS = ['click', 'input', 'change', 'keydown.enter', 'submit'];
|
|
9
|
-
|
|
10
|
-
function extractSomaIdsFromHtml(html) {
|
|
11
|
-
const ids = new Set();
|
|
12
|
-
for (const m of html.matchAll(/data-soma-id=["']([^"']+)["']/g)) {
|
|
13
|
-
ids.add(m[1]);
|
|
14
|
-
}
|
|
15
|
-
return [...ids].sort();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function scanDomainMethods(hostDir, pageBase) {
|
|
19
|
-
const methods = [];
|
|
20
|
-
const classPath = path.join(hostDir, 'domain', 'ui', `${pageBase}Class.ts`);
|
|
21
|
-
if (!fs.existsSync(classPath)) return methods;
|
|
22
|
-
const src = fs.readFileSync(classPath, 'utf8');
|
|
23
|
-
for (const m of src.matchAll(/^\s+async\s+(\w+)\s*\(/gm)) methods.push(m[1]);
|
|
24
|
-
for (const m of src.matchAll(/^\s+(\w+)\s*\([^)]*\)\s*[:{]/gm)) {
|
|
25
|
-
if (!['constructor', 'onMount', 'onUnmount'].includes(m[1])) methods.push(m[1]);
|
|
26
|
-
}
|
|
27
|
-
return [...new Set(methods)].sort();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function pageBaseFromUri(uri, hostDir) {
|
|
31
|
-
if (!uri) return null;
|
|
32
|
-
const filePath = decodeURIComponent(uri.replace(/^file:\/\//, ''));
|
|
33
|
-
if (hostDir) {
|
|
34
|
-
const hostRoot = path.resolve(hostDir);
|
|
35
|
-
const resolved = path.resolve(filePath);
|
|
36
|
-
if (resolved.startsWith(hostRoot)) {
|
|
37
|
-
const rel = path.relative(hostRoot, resolved);
|
|
38
|
-
const mm = rel.match(/^event[/\\](.+)_event\.yaml$/);
|
|
39
|
-
if (mm) return mm[1].replace(/\\/g, '/');
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const name = path.basename(filePath);
|
|
43
|
-
const m = name.match(/^(.+)_event\.yaml$/);
|
|
44
|
-
return m ? m[1] : null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function linePrefix(text, position) {
|
|
48
|
-
const lines = text.split('\n');
|
|
49
|
-
return (lines[position.line] ?? '').slice(0, position.character);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function completionItem(label, detail, kind = 10) {
|
|
53
|
-
return { label, kind, detail, insertText: label };
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function getEventYamlCompletions(hostDir, uri, text, position) {
|
|
57
|
-
const pageBase = pageBaseFromUri(uri, hostDir);
|
|
58
|
-
if (!pageBase) return [];
|
|
59
|
-
|
|
60
|
-
const prefix = linePrefix(text, position);
|
|
61
|
-
const trimmed = prefix.trim();
|
|
62
|
-
const items = [];
|
|
63
|
-
|
|
64
|
-
const htmlPath = path.join(hostDir, 'html', `${pageBase}.html`);
|
|
65
|
-
const somaIds = fs.existsSync(htmlPath) ? extractSomaIdsFromHtml(fs.readFileSync(htmlPath, 'utf8')) : [];
|
|
66
|
-
const methods = scanDomainMethods(hostDir, pageBase);
|
|
67
|
-
|
|
68
|
-
const anchorPartial = trimmed.match(/^([\w@]+)?$/);
|
|
69
|
-
if (anchorPartial && !trimmed.includes(':') && !trimmed.includes('|')) {
|
|
70
|
-
for (const id of somaIds) {
|
|
71
|
-
for (const trig of TRIGGERS) {
|
|
72
|
-
const label = `${id}.${trig}`;
|
|
73
|
-
if (!trimmed || label.startsWith(trimmed)) {
|
|
74
|
-
items.push(completionItem(`${label}: `, '事件锚点', 5));
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return items;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const afterColon = prefix.match(/:\s*(\w*)$/);
|
|
82
|
-
if (afterColon) {
|
|
83
|
-
const partial = afterColon[1] ?? '';
|
|
84
|
-
for (const t of EVENT_TYPES) {
|
|
85
|
-
if (!partial || t.startsWith(partial)) {
|
|
86
|
-
items.push(completionItem(`${t} | `, '事件类型', 14));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return items;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const afterPipe = prefix.match(/\|\s*(page\.)?(\w*)$/);
|
|
93
|
-
if (afterPipe) {
|
|
94
|
-
const partial = afterPipe[2] ?? '';
|
|
95
|
-
for (const m of methods) {
|
|
96
|
-
if (!partial || m.startsWith(partial)) {
|
|
97
|
-
items.push(completionItem(`page.${m}`, 'domain 方法', 2));
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return items;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return items;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
module.exports = { getEventYamlCompletions, EVENT_TYPES, TRIGGERS };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# 空数据目录(框架内置回退)
|
|
2
|
-
|
|
3
|
-
宿主没有 `data/` 目录时,`@soma-host/data` 别名指向这里。
|
|
4
|
-
|
|
5
|
-
数据对象层(`*_data.yaml`)是可选能力。`SomaPageClient` 把四件套与 data 一次性并发
|
|
6
|
-
`import()`,webpack 需要为 `@soma-host/data/${base}_data.yaml` 建立 context;目录不存在
|
|
7
|
-
时它不会安静跳过,而是每次页面加载都报 `Module not found: Can't resolve '@soma-host/data'`。
|
|
8
|
-
运行时有 `.catch(() => null)` 兜底,页面照常渲染——于是这条错误既不影响功能,又永远刷在
|
|
9
|
-
控制台里,把真正该看见的错误淹掉。
|
|
10
|
-
|
|
11
|
-
这个目录让 context 成立且为空:`import()` 找不到具体文件 → 走 catch → `dataConfig` 为
|
|
12
|
-
`undefined`,与"该宿主没有数据对象层"的语义一致。
|
|
13
|
-
|
|
14
|
-
目录名必须是 `data`:`SomaPageClient` 的 `webpackInclude` 正则是 `/\/data\/.*_data\.yaml$/`,
|
|
15
|
-
匹配的是解析后的完整路径。
|
|
16
|
-
|
|
17
|
-
本文件仅用于让 git 跟踪该目录(`.md` 不匹配上述正则,不会被打进 context)。
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "SOMA Event YAML",
|
|
3
|
-
"scopeName": "source.soma-event-yaml",
|
|
4
|
-
"patterns": [
|
|
5
|
-
{ "include": "#comments" },
|
|
6
|
-
{ "include": "#event-line" }
|
|
7
|
-
],
|
|
8
|
-
"repository": {
|
|
9
|
-
"comments": {
|
|
10
|
-
"match": "^\\s*#.*$",
|
|
11
|
-
"name": "comment.line.number-sign.soma-event"
|
|
12
|
-
},
|
|
13
|
-
"event-line": {
|
|
14
|
-
"match": "^\\s*([\\w@.-]+)\\.([\\w.]+)\\s*:\\s*(UI_REFRESH|NAV_ACTION|NAV_STATIC|UI_INTERACT|CONFIRM)\\s*\\|\\s*(.+?)\\s*$",
|
|
15
|
-
"captures": {
|
|
16
|
-
"1": { "name": "entity.name.tag.soma-anchor" },
|
|
17
|
-
"2": { "name": "support.type.soma-trigger" },
|
|
18
|
-
"3": { "name": "keyword.control.soma-event-type" },
|
|
19
|
-
"4": { "name": "entity.name.function.soma-handler" }
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"fallback-anchor": {
|
|
23
|
-
"match": "^\\s*([\\w@.-]+)\\.([\\w.]+)\\s*:",
|
|
24
|
-
"captures": {
|
|
25
|
-
"1": { "name": "entity.name.tag.soma-anchor" },
|
|
26
|
-
"2": { "name": "support.type.soma-trigger" }
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|