@akanjs/devkit 3.0.0-alpha.31 → 3.0.0-alpha.32
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.
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
engine biome(1.0)
|
|
2
2
|
language js(typescript, jsx)
|
|
3
3
|
|
|
4
|
+
// `Util` and `Zone` are always client components, so a *prop* typed as a `cnst` model is a hydrated
|
|
5
|
+
// class instance the server has to hand across the boundary — the methods are stripped on the way and
|
|
6
|
+
// what arrives is a plain object wearing the model's type.
|
|
7
|
+
//
|
|
8
|
+
// Only prop positions are reported: the component's `*Props` interface / type alias, or the inline
|
|
9
|
+
// object type on its parameter. A `cnst` type anywhere else in the file never crosses the boundary and
|
|
10
|
+
// stays legal — a local annotation, a callback parameter the framework already types with the model
|
|
11
|
+
// (`renderItem`, `renderList`), a module-scope helper, a non-`Props` local shape, and the props of a
|
|
12
|
+
// component nested inside another one. A function-typed prop is client-internal too: a closure cannot
|
|
13
|
+
// cross the RSC boundary at all, so whoever passes it already holds the value it takes.
|
|
4
14
|
TsReferenceType() as $ref where {
|
|
5
15
|
$ref <: r"cnst\.[A-Za-z_$][A-Za-z0-9_$]*",
|
|
6
16
|
not $ref <: within TsIndexedAccessType() as $indexed where {
|
|
@@ -9,8 +19,34 @@ TsReferenceType() as $ref where {
|
|
|
9
19
|
not $ref <: within TsReferenceType() as $wrapper where {
|
|
10
20
|
$wrapper <: r"(?:Client|Server)(?:Init|View|Edit)<[\s\S]*"
|
|
11
21
|
},
|
|
22
|
+
not $ref <: within TsFunctionType(),
|
|
23
|
+
or {
|
|
24
|
+
$ref <: within TsInterfaceDeclaration() as $propsInterface where {
|
|
25
|
+
$propsInterface <: r"interface\s+[A-Za-z0-9_$]*Props[\s\S]*"
|
|
26
|
+
},
|
|
27
|
+
$ref <: within TsTypeAliasDeclaration() as $propsAlias where {
|
|
28
|
+
$propsAlias <: r"type\s+[A-Za-z0-9_$]*Props[\s\S]*"
|
|
29
|
+
},
|
|
30
|
+
and {
|
|
31
|
+
$ref <: within JsFormalParameter(),
|
|
32
|
+
// A parameter is a sibling of the body, so this only drops the ones belonging to a function
|
|
33
|
+
// declared *inside* a component — a nested component or a local callback.
|
|
34
|
+
not $ref <: within JsFunctionBody(),
|
|
35
|
+
// Same for a callback handed straight to a call, which an expression-bodied component leaves
|
|
36
|
+
// outside every function body: `rows.map((row: cnst.LightTicket) => …)`.
|
|
37
|
+
not $ref <: within JsCallArguments(),
|
|
38
|
+
or {
|
|
39
|
+
$ref <: within JsVariableDeclarator() as $component where {
|
|
40
|
+
$component <: r"[A-Z][A-Za-z0-9_$]*[\s\S]*"
|
|
41
|
+
},
|
|
42
|
+
$ref <: within JsFunctionDeclaration() as $componentFn where {
|
|
43
|
+
$componentFn <: r"(?:async\s+)?function\s+[A-Z][A-Za-z0-9_$]*[\s\S]*"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
12
48
|
register_diagnostic(
|
|
13
49
|
span = $ref,
|
|
14
|
-
message = "Util and Zone are client components, so a cnst model type
|
|
50
|
+
message = "Util and Zone are client components, so a cnst model type on a prop is a class instance crossing the server boundary. Take an id instead (bannerId: string), or hand server data across as ClientInit / ClientView. An enum union such as cnst.AdminRole['value'] is allowed, and so is a cnst type that stays inside the file — a local annotation or a callback parameter."
|
|
15
51
|
)
|
|
16
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/devkit",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.32",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@langchain/openai": "^1.4.6",
|
|
46
46
|
"@tailwindcss/node": "^4.3.0",
|
|
47
47
|
"@trapezedev/project": "^7.1.4",
|
|
48
|
-
"akanjs": "3.0.0-alpha.
|
|
48
|
+
"akanjs": "3.0.0-alpha.32",
|
|
49
49
|
"chalk": "^5.6.2",
|
|
50
50
|
"commander": "^14.0.3",
|
|
51
51
|
"dayjs": "^1.11.20",
|