@starbeam/shared
Advanced tools
Comparing version 1.3.8-unstable.0b31af0 to 1.3.8-unstable.229fe05
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,187 +0,196 @@ | ||
/** | ||
* The `UNINITIALIZED` symbol represents a special internal value that can be | ||
* used to differentiate between any user-supplied value and the state of being | ||
* uninitialized. | ||
* | ||
* You do not **need** to import `@starbeam/shared` to get this symbol, as it | ||
* is specified using `Symbol.for`. | ||
*/ let I = Symbol.for("starbeam.UNINITIALIZED"), N = Symbol.for("starbeam.TAG"), o = Symbol.for("starbeam.COORDINATION"); | ||
let I = Symbol.for("starbeam.UNINITIALIZED"), | ||
N = Symbol.for("starbeam.TAG"), | ||
o = Symbol.for("starbeam.COORDINATION"); | ||
function getCoordination() { | ||
let t = globalThis[o]; | ||
return t || (globalThis[o] = t = {}), t; | ||
let t = globalThis[o]; | ||
return t || (globalThis[o] = t = {}), t; | ||
} | ||
let e$3 = getCoordination(), i$1 = e$3.id; | ||
let e$3 = getCoordination(), | ||
i$1 = e$3.id; | ||
if (!i$1) { | ||
let t = 1; | ||
i$1 = e$3.id = { | ||
get: ()=>t++ | ||
}; | ||
let t = 1; | ||
i$1 = e$3.id = { get: () => t++ }; | ||
} | ||
let r$2 = i$1; | ||
/** | ||
* Get a fresh unique ID. | ||
*/ function getID() { | ||
return r$2.get(); | ||
function getID() { | ||
return r$2.get(); | ||
} | ||
let i = getCoordination(), t = i.lifetime, n$2 = 0; | ||
let i = getCoordination(), | ||
t = i.e, | ||
n$2 = 0; | ||
if (!t) { | ||
class e { | ||
#e = new Set(); | ||
children = new Set(); | ||
#i = !1; | ||
add(e) { | ||
this.#e.add(e); | ||
} | ||
delete(e) { | ||
this.#e.delete(e); | ||
} | ||
finalize() { | ||
if (this.#i) return !1; | ||
for (let e of (this.#i = !0, this.children))e.finalize(); | ||
for (let e of this.#e)e(); | ||
return this.#e.clear(), !0; | ||
} | ||
isFinalized() { | ||
return this.#i; | ||
} | ||
class e { | ||
#e = new Set(); | ||
children = new Set(); | ||
#i = !1; | ||
add(e) { | ||
this.#e.add(e); | ||
} | ||
class r { | ||
#t = new WeakMap(); | ||
#n; | ||
#r; | ||
#a; | ||
constructor(){ | ||
this.#r = ()=>{ | ||
let e = i.testing?.registry ?? FinalizationRegistry; | ||
return new e((e)=>void e.finalize()); | ||
}; | ||
delete(e) { | ||
this.#e.delete(e); | ||
} | ||
i() { | ||
if (this.#i) return !1; | ||
for (let e of ((this.#i = !0), this.children)) e.i(); | ||
for (let e of this.#e) e(); | ||
return this.#e.clear(), !0; | ||
} | ||
t() { | ||
return this.#i; | ||
} | ||
} | ||
class r { | ||
#t = new WeakMap(); | ||
#n; | ||
#r; | ||
#a; | ||
constructor() { | ||
this.#r = () => | ||
new (i.n?.r ?? FinalizationRegistry)((e) => { | ||
e.i(); | ||
}); | ||
} | ||
a = (e = { id: n$2++ }) => this.#l(e); | ||
l = (e = { id: n$2++ }) => this.#l(e, { to: "parent" }); | ||
o = (e, { parent: i } = {}) => { | ||
if (!this.#n && !i) return () => {}; | ||
let t = this.#o(e); | ||
if (i) { | ||
let e = this.#o(i); | ||
return ( | ||
e.children.add(t), | ||
() => { | ||
e.children.delete(t); | ||
} | ||
); | ||
} | ||
if (!this.#n) return () => {}; | ||
let n = this.#n; | ||
return ( | ||
n.children.add(t), | ||
() => { | ||
n.children.delete(t); | ||
} | ||
mountFinalizationScope = (e = { | ||
id: n$2++ | ||
})=>this.#l(e); | ||
pushFinalizationScope = (e = { | ||
id: n$2++ | ||
})=>this.#l(e, { | ||
to: "parent" | ||
}); | ||
linkToFinalizationScope = (e, { parent: i } = {})=>{ | ||
if (!this.#n && !i) return ()=>void 0; | ||
let t = this.#o(e); | ||
if (i) { | ||
let e = this.#o(i); | ||
return e.children.add(t), ()=>void e.children.delete(t); | ||
} | ||
if (!this.#n) return ()=>void 0; | ||
let n = this.#n; | ||
return n.children.add(t), ()=>void n.children.delete(t); | ||
}; | ||
onFinalize = (e, i)=>{ | ||
let t = i && e, n = i ?? e; | ||
if (t) { | ||
let e = this.#o(t); | ||
return e.add(n), ()=>void e.delete(n); | ||
} | ||
if (!this.#n) return ()=>void 0; | ||
let r = this.#n; | ||
return r.add(n), ()=>void r.delete(n); | ||
}; | ||
finalize = (e)=>!!e && (this.#t.get(e)?.finalize() ?? !1); | ||
isFinalized = (e)=>this.#t.get(e)?.isFinalized() ?? !1; | ||
#l = (e, i)=>{ | ||
let t = this.#n, n = this.#o(e); | ||
return this.#n = n, i?.to === "parent" && t?.children.add(n), ()=>(this.#n = t, e); | ||
}; | ||
get #s() { | ||
let e = this.#a; | ||
return e || (e = this.#r(), this.#a = e), e; | ||
); | ||
}; | ||
s = (e, i) => { | ||
let t = i && e, | ||
n = i ?? e; | ||
if (t) { | ||
let e = this.#o(t); | ||
return ( | ||
e.add(n), | ||
() => { | ||
e.delete(n); | ||
} | ||
); | ||
} | ||
if (!this.#n) return () => {}; | ||
let r = this.#n; | ||
return ( | ||
r.add(n), | ||
() => { | ||
r.delete(n); | ||
} | ||
#o(i) { | ||
let t = this.#s, n = this.#t.get(i); | ||
return n || (n = new e(), this.#t.set(i, n), t.register(i, n)), n; | ||
} | ||
); | ||
}; | ||
i = (e) => !!e && (this.#t.get(e)?.i() ?? !1); | ||
t = (e) => this.#t.get(e)?.t() ?? !1; | ||
#l = (e, i) => { | ||
let t = this.#n, | ||
n = this.#o(e); | ||
return ( | ||
(this.#n = n), | ||
"parent" === i?.to && t?.children.add(n), | ||
() => ((this.#n = t), e) | ||
); | ||
}; | ||
get #s() { | ||
let e = this.#a; | ||
return e || ((e = this.#r()), (this.#a = e)), e; | ||
} | ||
t = i.lifetime = new r(); | ||
#o(i) { | ||
let t = this.#s, | ||
n = this.#t.get(i); | ||
return n || ((n = new e()), this.#t.set(i, n), t.register(i, n)), n; | ||
} | ||
} | ||
t = i.e = new r(); | ||
} | ||
let r$1 = t; | ||
function mountFinalizationScope(e) { | ||
return r$1.mountFinalizationScope(e); | ||
return r$1.a(e); | ||
} | ||
function pushFinalizationScope(e) { | ||
return r$1.pushFinalizationScope(e); | ||
return r$1.l(e); | ||
} | ||
function linkToFinalizationScope(e, i) { | ||
return r$1.linkToFinalizationScope(e, i); | ||
return r$1.o(e, i); | ||
} | ||
/** | ||
* Attempt to finalize the given object. | ||
* | ||
* If the object is not finalizable, return false. | ||
* If the object was already finalized, return false. | ||
* Otherwise, finalize the object and return true. | ||
*/ function finalize(e) { | ||
return r$1.finalize(e); | ||
function finalize(e) { | ||
return r$1.i(e); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function onFinalize(...e) { | ||
return r$1.onFinalize(...e); | ||
return r$1.s(...e); | ||
} | ||
function isFinalized(e) { | ||
return r$1.isFinalized(e); | ||
return r$1.t(e); | ||
} | ||
/** | ||
* The `CLOCK` constant is a universal monotonically increasing clock. The | ||
* `Timestamp` class is used in `@starbeam/timeline` and `@starbeam/universal`, | ||
* but `Timestamp` defers to this constant. This means that multiple copies of | ||
* `@starbeam/timeline` will still see the same monotonically increasing clock. | ||
* | ||
* The term "timestamp" is used in this context to refer to a monotonically | ||
* increasing number, where each number represents a different moment in time. | ||
*/ let e$2 = getCoordination(), m = e$2.now; | ||
m || (m = e$2.now = { | ||
timestamp: 1 | ||
}); | ||
let e$2 = getCoordination(), | ||
m = e$2.now; | ||
m || (m = e$2.now = { timestamp: 1 }); | ||
let n$1 = m; | ||
/** | ||
* Get the current timestamp. | ||
*/ function now() { | ||
return n$1.timestamp; | ||
function now() { | ||
return n$1.timestamp; | ||
} | ||
/** | ||
* Increment the current timestamp, and return the new one. | ||
*/ function bump() { | ||
return n$1.timestamp = n$1.timestamp + 1, now(); | ||
function bump() { | ||
return (n$1.timestamp = n$1.timestamp + 1), now(); | ||
} | ||
let e$1 = getCoordination(), n = e$1.stack; | ||
let e$1 = getCoordination(), | ||
n = e$1.stack; | ||
if (!n) { | ||
let t = new Set(); | ||
n = e$1.stack = { | ||
start: ()=>{ | ||
let e = t; | ||
return t = new Set(), ()=>{ | ||
let n = t; | ||
return t = e, n; | ||
}; | ||
}, | ||
consume: (e)=>void t.add(e) | ||
}; | ||
let t = new Set(); | ||
n = e$1.stack = { | ||
start: () => { | ||
let e = t; | ||
return ( | ||
(t = new Set()), | ||
() => { | ||
let n = t; | ||
return (t = e), n; | ||
} | ||
); | ||
}, | ||
t: (e) => { | ||
t.add(e); | ||
}, | ||
}; | ||
} | ||
let r = n; | ||
function start() { | ||
return r.start(); | ||
return r.start(); | ||
} | ||
function consume(t) { | ||
r.consume(t); | ||
r.t(t); | ||
} | ||
let e = getCoordination(); | ||
function testing(t) { | ||
e.testing = e.testing ?? {}, Object.assign(e.testing, t); | ||
(e.t = e.t ?? {}), Object.assign(e.t, t); | ||
} | ||
export { N as TAG, I as UNINITIALIZED, bump, consume, finalize, getID, isFinalized, linkToFinalizationScope, mountFinalizationScope, now, onFinalize, pushFinalizationScope, start, testing }; | ||
export { | ||
N as TAG, | ||
I as UNINITIALIZED, | ||
bump, | ||
consume, | ||
finalize, | ||
getID, | ||
isFinalized, | ||
linkToFinalizationScope, | ||
mountFinalizationScope, | ||
now, | ||
onFinalize, | ||
pushFinalizationScope, | ||
start, | ||
testing, | ||
}; | ||
//# sourceMappingURL=index.production.js.map |
{ | ||
"name": "@starbeam/shared", | ||
"type": "module", | ||
"version": "1.3.8-unstable.0b31af0", | ||
"version": "1.3.8-unstable.229fe05", | ||
"description": "A package that facilitates having multiple copies of Starbeam in a single process that interoperate with each other", | ||
@@ -17,5 +17,5 @@ "main": "dist/index.cjs", | ||
"devDependencies": { | ||
"@starbeam-dev/compile": "^1.0.2", | ||
"@starbeam-dev/eslint-plugin": "^1.0.4", | ||
"rollup": "^4.0.2" | ||
"@starbeam-dev/eslint-plugin": "^1.0.6", | ||
"rollup": "^4.0.2", | ||
"@starbeam-dev/compile": "1.2.0" | ||
}, | ||
@@ -22,0 +22,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
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
96320
703