@tinkered/core 0.30.0 → 0.30.1
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/package.json
CHANGED
package/skills/core/SKILL.md
CHANGED
|
@@ -14,7 +14,7 @@ metadata:
|
|
|
14
14
|
task skill to load next.
|
|
15
15
|
type: core
|
|
16
16
|
library: '@tinkered/core'
|
|
17
|
-
library_version: '0.30.
|
|
17
|
+
library_version: '0.30.1'
|
|
18
18
|
sources:
|
|
19
19
|
- 'lagz0ne/tinkered:packages/core/src/main.ts'
|
|
20
20
|
- 'lagz0ne/tinkered:docs/best-practices.md'
|
|
@@ -34,7 +34,7 @@ the task crosses two of them.
|
|
|
34
34
|
[operation](./operation/SKILL.md)
|
|
35
35
|
- State, keyed members, where a write lands:
|
|
36
36
|
[data](./data/SKILL.md)
|
|
37
|
-
- A feature's
|
|
37
|
+
- A feature's capsule, config, install:
|
|
38
38
|
[capsule](./capsule/SKILL.md)
|
|
39
39
|
- A call or a live read between server and page:
|
|
40
40
|
[rpc](./rpc/SKILL.md)
|
|
@@ -78,8 +78,9 @@ id, fix the code, and run the check again.
|
|
|
78
78
|
- `tinker/config`: config goes in the capsule
|
|
79
79
|
call. Check: `MissingConfig` at start.
|
|
80
80
|
Skill: capsule.
|
|
81
|
-
- `tinker/
|
|
82
|
-
|
|
81
|
+
- `tinker/barrel`: a file exports only what it
|
|
82
|
+
declares. Check: `tinker check`. Skill:
|
|
83
|
+
capsule.
|
|
83
84
|
- `tinker/cell-write`: an exported cell is read
|
|
84
85
|
only. Check: lint and `InvalidDependency`.
|
|
85
86
|
Skill: data.
|
|
@@ -5,7 +5,7 @@ description: >
|
|
|
5
5
|
give it settings, install it in a cmd, or
|
|
6
6
|
import it from other code. Also when start
|
|
7
7
|
fails with MissingConfig, or a check prints
|
|
8
|
-
tinker/seam, tinker/config or tinker/
|
|
8
|
+
tinker/seam, tinker/config or tinker/barrel.
|
|
9
9
|
metadata:
|
|
10
10
|
purpose: >
|
|
11
11
|
How to write a capsule, fill its config in
|
|
@@ -13,7 +13,7 @@ metadata:
|
|
|
13
13
|
binding only.
|
|
14
14
|
type: sub-skill
|
|
15
15
|
library: '@tinkered/core'
|
|
16
|
-
library_version: '0.30.
|
|
16
|
+
library_version: '0.30.1'
|
|
17
17
|
requires:
|
|
18
18
|
- core
|
|
19
19
|
sources:
|
|
@@ -23,9 +23,8 @@ sources:
|
|
|
23
23
|
|
|
24
24
|
# Capsule
|
|
25
25
|
|
|
26
|
-
A capsule
|
|
27
|
-
|
|
28
|
-
installs it with values.
|
|
26
|
+
A capsule holds a feature's config, its exports
|
|
27
|
+
and its hooks. A cmd installs it with values.
|
|
29
28
|
|
|
30
29
|
## Setup
|
|
31
30
|
|
|
@@ -107,19 +106,6 @@ export default defineMain(async ({ env, signal }) => {
|
|
|
107
106
|
function builds it.
|
|
108
107
|
- A feature never reads `process.env`.
|
|
109
108
|
|
|
110
|
-
### One folder, one door
|
|
111
|
-
|
|
112
|
-
```text
|
|
113
|
-
src/sea/
|
|
114
|
-
index.ts the capsule
|
|
115
|
-
index.server.ts the server's door
|
|
116
|
-
contract.ts rpc and remote data
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Other features import `@/sea` only. They reach a
|
|
120
|
-
unit as `sea.press`, never by a path into the
|
|
121
|
-
folder.
|
|
122
|
-
|
|
123
109
|
## Common mistakes
|
|
124
110
|
|
|
125
111
|
### HIGH: root tags fill a capsule key [tinker/config]
|
|
@@ -152,17 +138,27 @@ const press = operation({
|
|
|
152
138
|
Right: declare a `config` key, and let the cmd
|
|
153
139
|
pass the value.
|
|
154
140
|
|
|
155
|
-
### HIGH:
|
|
141
|
+
### HIGH: a barrel [tinker/barrel]
|
|
142
|
+
|
|
143
|
+
A barrel passes on what other files export. Its
|
|
144
|
+
importer cannot see which files it reaches. One
|
|
145
|
+
of them can be a `.server.` file, and then the
|
|
146
|
+
page build takes server code.
|
|
156
147
|
|
|
157
148
|
Wrong:
|
|
158
149
|
|
|
159
150
|
```ts no-check
|
|
160
|
-
|
|
151
|
+
export * from "./todo-list";
|
|
152
|
+
export type { Todo } from "./todo.schema";
|
|
161
153
|
```
|
|
162
154
|
|
|
163
|
-
Right:
|
|
164
|
-
|
|
165
|
-
`
|
|
155
|
+
Right: delete the re-export. Import the name from
|
|
156
|
+
the file that declares it, as
|
|
157
|
+
`import { TodoList } from "@/todo/todo-list";`.
|
|
158
|
+
A file exports only what it declares.
|
|
159
|
+
|
|
160
|
+
Check: `tinker check` prints each re-export and
|
|
161
|
+
its line.
|
|
166
162
|
|
|
167
163
|
### MEDIUM: a function that makes units
|
|
168
164
|
|
|
@@ -175,6 +171,5 @@ config.
|
|
|
175
171
|
## Completion
|
|
176
172
|
|
|
177
173
|
- The app starts: no `MissingConfig`.
|
|
178
|
-
- `
|
|
179
|
-
`no-restricted-imports`.
|
|
174
|
+
- `tinker check` prints no `tinker/barrel`.
|
|
180
175
|
- `grep -rn "process.env" src` prints no line.
|
package/skills/core/rpc/SKILL.md
CHANGED