@starbeam/shared
Advanced tools
Comparing version 1.3.8-unstable.84e5619 to 1.3.8-unstable.9b5a07d
124
CHANGELOG.md
@@ -1,124 +0,2 @@ | ||
# @starbeam/shared | ||
# Changelog | ||
## 1.3.7 | ||
### Patch Changes | ||
- e459bf2: Fix CJS builds | ||
## 1.3.6 | ||
### Patch Changes | ||
- 2a1f728: Improve @starbeam/react | ||
## 1.3.5 | ||
### Patch Changes | ||
- 14f961b: Fixes #75 | ||
## 1.3.4 | ||
### Patch Changes | ||
- ded6421: Add /setup to preact | ||
## 1.3.3 | ||
### Patch Changes | ||
- 6502cc7: Remove errant import | ||
## 1.3.2 | ||
### Patch Changes | ||
- de755c6: Improve type inference | ||
## 1.3.1 | ||
### Patch Changes | ||
- 3bf1221: Prepare for Starbeam 0.8.4 | ||
## 1.3.0 | ||
### Minor Changes | ||
- 1a553c5: Prepare for 0.8 | ||
## 1.2.2 | ||
### Patch Changes | ||
- 40844fd: Try to fix the build | ||
## 1.2.1 | ||
### Patch Changes | ||
- 50f7a8f: Publish @domtree | ||
## 1.2.0 | ||
### Minor Changes | ||
- 58f7974: Starbeam 0.7.0 | ||
- Significant improvements to debugging infrastructure | ||
## 1.1.0 | ||
### Minor Changes | ||
- Prepare 0.6.0 | ||
## 1.0.8 | ||
### Patch Changes | ||
- Prepare 0.5.8 | ||
## 1.0.7 | ||
### Patch Changes | ||
- Fix a bug in the transition from uninitialized to initialized reactive Map | ||
## 1.0.6 | ||
### Patch Changes | ||
- Fix ESM package mistakes | ||
## 1.0.5 | ||
### Patch Changes | ||
- Another attempt to get the build right | ||
## 1.0.4 | ||
### Patch Changes | ||
- The 0.5.3 release was missing dists | ||
## 1.0.3 | ||
### Patch Changes | ||
- d21391d: Update resources to support React's three-phase lifecycle | ||
## 1.0.2 | ||
### Patch Changes | ||
- 719a6fe: Updated package export maps | ||
## 1.0.1 | ||
### Patch Changes | ||
- 2a957e5: Try to fix types | ||
- e03c2a0: Initial publish |
@@ -1,2 +0,2 @@ | ||
export { COORDINATION, TAG, UNINITIALIZED } from "./src/constants.js"; | ||
export { TAG, UNINITIALIZED } from "./src/constants.js"; | ||
export { getID } from "./src/id.js"; | ||
@@ -3,0 +3,0 @@ export { |
{ | ||
"name": "@starbeam/shared", | ||
"version": "1.3.8-unstable.84e5619", | ||
"type": "module", | ||
"version": "1.3.8-unstable.9b5a07d", | ||
"description": "A package that facilitates having multiple copies of Starbeam in a single process that interoperate with each other", | ||
"type": "module", | ||
"main": "index.ts", | ||
"types": "index.ts", | ||
"main": "dist/index.cjs", | ||
"types": "dist/index.d.ts", | ||
"exports": { | ||
"default": "./index.ts" | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js", | ||
"default": "./dist/index.cjs" | ||
}, | ||
"publishConfig": { | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js", | ||
"default": "./dist/index.cjs" | ||
} | ||
}, | ||
"main": "dist/index.cjs", | ||
"types": "dist/index.d.ts" | ||
}, | ||
"starbeam": { | ||
"type": "library:public" | ||
}, | ||
"devDependencies": { | ||
"@starbeam-dev/compile": "^1.1.0", | ||
"@starbeam-dev/eslint-plugin": "^1.0.4", | ||
"rollup": "^4.0.2" | ||
}, | ||
"files": [ | ||
"dist", | ||
"README.md", | ||
"CHANGELOG.md", | ||
"LICENSE.md" | ||
], | ||
"scripts": { | ||
"build": "rollup -c", | ||
"test:lint": "eslint . --max-warnings 0", | ||
"test:specs": "vitest --run", | ||
"test:specs": "vitest --run --pool forks", | ||
"test:types": "tsc -b" | ||
}, | ||
"devDependencies": { | ||
"@starbeam/eslint-plugin": "workspace:^", | ||
"@starbeam-dev/build-support": "workspace:^", | ||
"rollup": "^3.29.2" | ||
} | ||
} | ||
} |
@@ -1,15 +0,90 @@ | ||
This package provides an extremely stable API for getting: | ||
# `@starbeam/shared` | ||
- The current timestamp as a number | ||
- The value of the `UNINITIALIZED` symbol | ||
**Unless you are very interested in the stability strategy of Starbeam, you don't | ||
need to understand how this package works.** | ||
Apps shouldn't use the exports of this dependency directly. Instead, separating the most fundamental | ||
parts of Starbeam's composition into a separate package allows two versions of Starbeam to coexist | ||
in the same process and **to share reactivity between them**. | ||
--- | ||
In other words, if you access a Cell from version 1 of Starbeam in the context of a formula | ||
created in version 2 of Starbeam, updating the cell will invalidate the formula. | ||
This package is designed to make it possible for multiple copies of Starbeam to | ||
interact with each other in a single process. | ||
This package uses `Symbol.for` to ensure that only a single copy of the fundamental symbols and | ||
constants exists in a single process. As a result, it is not necessary to install this package as a | ||
peer dependency. | ||
> For example, this means that: | ||
> | ||
> - if one copy of Starbeam creates a formula | ||
> - and the formula read the value of a cell from another copy of Starbeam | ||
> - then updating the cell will invalidate the formula | ||
## How it Works | ||
It accomplishes this by storing a handful of very stable Starbeam fundamentals | ||
in a single global symbol (`Symbol.for("starbeam.COORDINATION")`). | ||
The first access to any of `@starbeam/shared`'s exports (from any copy of | ||
Starbeam) instantiates the values in that symbol. Future accesses of the exports | ||
use that already instantiated value. | ||
> This package uses `Symbol.for` to ensure that only a single copy of the | ||
> fundamental symbols and constants exists in a single process. As a result, **it | ||
> is not necessary to install this package as a peer dependency**. | ||
## Starbeam Fundamentals | ||
<dl> | ||
<dt><code>now()</code></dt> | ||
<dd>Returns the current timestamp as a number.</dd> | ||
<dt><code>bump()</code></dt> | ||
<dd>Increment the current timestamp and return the new one.</dd> | ||
<dt><code>start()</code></dt> | ||
<dd>Start a new tracking frame. This function returns a function that, when called, finalizes the tracking frame. The finalization function returns a list of the cell tags that were consumed during the duration of the tracking frame.</dd> | ||
<dt><code>consume(tag)</code></dt> | ||
<dd>Consume a tag.</dd> | ||
<dt><code>getId()</code></dt> | ||
<dd>Returns a unique, deterministic identifier as a string or number. This is useful to create primitive identifiers that are guaranteed to be unique even if multiple copies of Starbeam exist in a single process.</dd> | ||
<dt><code>TAG</code></dt> | ||
<dd>The value of the `TAG` symbol. A reactive value's tag is stored in this property.</dd> | ||
<dt><code>UNINITIALIZED</code></dt> | ||
<dd>A special value representing an uninitialized value. This is sometimes necessary to differentiate between <code>undefined</code> as an actual user value and an internal uninitialized state.</dd> | ||
</dl> | ||
## Stability | ||
The goal of this package is to provide a place for the most primitive | ||
representation of Starbeam fundamentals. It is designed to be as stable as | ||
possible, so that the implementations of tags and reactive values from multiple | ||
different major versions of Starbeam can interoperate. | ||
We expect this package to remain at `1.x` for the foreseeable future. | ||
If we need to make breaking changes to this package, that will also make | ||
versions of Starbeam that depend on `1.x` incompatible with versions of Starbeam | ||
that depend on `2.x`. As a result, we intend to try as hard as possible to avoid | ||
strictly breaking changes. | ||
One consequence of this design goal is that the functions in this package take | ||
and return simple TypeScript types. For example, timestamps are represented as | ||
numbers and cell tags are just `unknown`. | ||
In practice, interoperability between Starbeam versions will also require | ||
stability in the fundamental protocol of cell tags. This basically means that | ||
the fundamental interface for tags is: | ||
```ts | ||
interface CellTag { | ||
readonly lastUpdated: number; | ||
readonly dependencies: () => CellTag[]; | ||
} | ||
interface FormulaTag { | ||
readonly dependencies: undefined | (() => CellTag[]); | ||
} | ||
type Tag = CellTag | FormulaTag; | ||
``` | ||
Because TypeScript frequently makes breaking changes, adding these fundamental | ||
types to this package as part of its API is still a work in progress. | ||
However, the description of the fundamental tag types is intended to document | ||
the intended stability of the `Tag` types in Starbeam, which means that the | ||
implementation of tags in other parts of Starbeam will only change if | ||
`@starbeam/shared` has a major version bump. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
85528
0
91
11
517
1