@firsthandjs/core 0.9.0 → 0.10.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.
- package/dist/core.d.ts +30 -3
- package/dist/core.d.ts.map +1 -1
- package/dist/index.dev.js +4 -0
- package/package.json +1 -1
package/dist/core.d.ts
CHANGED
|
@@ -3,9 +3,36 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These three live in one module because they are one algorithm: an effect run
|
|
5
5
|
* needs to reset its owner scope, and owner disposal needs to unlink graph
|
|
6
|
-
* edges.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* edges. The public API is layered on top in `signal.ts`, `computed.ts`,
|
|
7
|
+
* `effect.ts`, `lifecycle.ts` and `context.ts`.
|
|
8
|
+
*
|
|
9
|
+
* ## Why this is one module
|
|
10
|
+
*
|
|
11
|
+
* It is 561 statements against a 300-statement limit
|
|
12
|
+
* (docs/architecture/code-rules.md §1), and it is the only file in the
|
|
13
|
+
* repository that does not meet it. That is a decision rather than an
|
|
14
|
+
* oversight, and this is the evidence for it.
|
|
15
|
+
*
|
|
16
|
+
* Four of the sections below write the same three module variables:
|
|
17
|
+
*
|
|
18
|
+
* | Variable | Written by |
|
|
19
|
+
* | --------------- | --------------------------------------------------- |
|
|
20
|
+
* | `activeSub` | `evaluate`, `runEffect`, `untrack` |
|
|
21
|
+
* | `currentOwner` | `evaluate`, `runEffect`, `setOwner`, `deferOwner` |
|
|
22
|
+
* | `deferred` | the same four |
|
|
23
|
+
*
|
|
24
|
+
* A module cannot assign a binding it imported, so splitting those sections
|
|
25
|
+
* apart means one of two things: a shared state object, which puts a property
|
|
26
|
+
* load in front of every `activeSub` read — including the one in `Cell.value`,
|
|
27
|
+
* the hottest read in the framework — or setter functions, which put a call
|
|
28
|
+
* there instead. Both are changes to exactly what `npm run bench:ic` exists to
|
|
29
|
+
* watch, and CONTRIBUTING §2 does not accept "probably fine" for that.
|
|
30
|
+
*
|
|
31
|
+
* So the limit stands and this file is the documented exception, not a
|
|
32
|
+
* precedent: it has one reason to change, which is the reactive algorithm. If
|
|
33
|
+
* somebody wants the split, the way to get it is a branch that does it, a
|
|
34
|
+
* before-and-after from `bench`, `bench:micro` and `bench:ic`, and a number
|
|
35
|
+
* showing the reads stayed monomorphic.
|
|
9
36
|
*
|
|
10
37
|
* Model (ADR-0001): a write pushes *invalidation* through the subscriber graph
|
|
11
38
|
* and queues effects; values are pulled lazily on read. Nothing recomputes
|
package/dist/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAiBH;oCACoC;AACpC,qBAAa,IAAI;IACP,GAAG,EAAE,IAAI,CAAC;IACV,GAAG,EAAE,IAAI,CAAC;IACV,OAAO,EAAE,IAAI,GAAG,SAAS,CAAC;IAC1B,OAAO,EAAE,IAAI,GAAG,SAAS,CAAC;IAC1B,OAAO,EAAE,IAAI,GAAG,SAAS,CAAC;IAC1B,OAAO,EAAE,IAAI,GAAG,SAAS,CAAC;gBAOhC,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,IAAI,EACT,OAAO,EAAE,IAAI,GAAG,SAAS,EACzB,OAAO,EAAE,IAAI,GAAG,SAAS,EACzB,OAAO,EAAE,IAAI,GAAG,SAAS;CAS5B;AAOD;;;GAGG;AACH,qBAAa,IAAI;IACP,KAAK,EAAE,MAAM,CAAC;IACtB,oDAAoD;IAC5C,CAAC,EAAE,OAAO,CAAC;IACnB,8DAA8D;IACtD,EAAE,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,O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EAAE,CAAC,EAAE,OAAO,KAAK,OAAO,CAQrC;AAMD,wBAAgB,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CASvC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAO5C;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAQzC"}
|
package/dist/index.dev.js
CHANGED
|
@@ -90,6 +90,10 @@ function devRunning(effect2) {
|
|
|
90
90
|
|
|
91
91
|
// packages/core/src/core.ts
|
|
92
92
|
var Link = class {
|
|
93
|
+
// One allocation per dependency edge (ADR-0002). An options object would be
|
|
94
|
+
// a second one, on the path that exists to allocate nothing in the common
|
|
95
|
+
// case — see docs/architecture/code-rules.md §5.
|
|
96
|
+
// eslint-disable-next-line max-params -- measured hot path; see above
|
|
93
97
|
constructor(dep, sub, prevDep, nextDep, prevSub) {
|
|
94
98
|
this.dep = dep;
|
|
95
99
|
this.sub = sub;
|