dsh-ptc-plus 0.4.1 → 0.4.2
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/README.en.md +6 -10
- package/README.md +6 -10
- package/client.js +262 -31
- package/compiler-core.cjs +132 -130
- package/compiler-core.cjs.map +3 -3
- package/docs/README.md +1 -0
- package/docs/adr/0023-global-user-bindings.md +6 -6
- package/docs/adr/0025-use-versioned-logical-binding-identities.md +3 -3
- package/docs/adr/0027-run-the-session-kernel-in-a-killable-helper-process.md +5 -5
- package/docs/architecture.md +9 -5
- package/docs/client-ui.md +1 -1
- package/docs/durability-design.md +6 -3
- package/docs/installation.md +4 -4
- package/docs/runtime-reference.md +5 -1
- package/docs/stateful-binding-updates-proposal.md +8 -4
- package/docs/user-bindings.en.md +5 -3
- package/docs/user-bindings.md +4 -2
- package/docs/verification-optimization-work.md +41 -0
- package/docs/verification.md +15 -1
- package/internal/async-local-storage-intrinsics.js +38 -0
- package/internal/binding-declaration-contract.js +8 -0
- package/internal/binding-source-analysis.js +381 -64
- package/internal/binding-update-policy.js +7 -1
- package/internal/cell-analysis.js +21 -8
- package/internal/compiler-intrinsics.js +9 -43
- package/internal/compiler-module-links.js +7 -4
- package/internal/dynamic-environment-integration.js +8 -4
- package/internal/dynamic-environment-runtime.js +24 -3
- package/internal/dynamic-native-calls.js +4 -1
- package/internal/dynamic-native-runtime.js +15 -1
- package/internal/failure-reporting.js +38 -30
- package/internal/isolated-worker.js +17 -10
- package/internal/kernel-worker.js +493 -331
- package/internal/module-compilation.js +5 -4
- package/internal/module-transform-contract.js +32 -2
- package/internal/record-utils.js +24 -15
- package/internal/repl-value-observer.js +6 -3
- package/internal/runtime-intrinsics.js +101 -0
- package/internal/session-cell-executor.js +2 -1
- package/internal/session-journal-schema.js +30 -13
- package/internal/session-journal.js +19 -4
- package/internal/session-runtime.js +1 -0
- package/internal/source-position-map.js +19 -0
- package/internal/stateful-root-compiler.js +3 -1
- package/internal/typescript-transform.js +4 -2
- package/internal/user-binding-console-worker.js +101 -41
- package/internal/user-bindings.js +10 -2
- package/internal/value-wire.js +101 -71
- package/internal/worker-cwd-virtualization.js +80 -53
- package/internal/worker-environment.js +20 -0
- package/internal/worker-repl-realm.js +134 -0
- package/package.json +2 -1
- package/src/client-activity.js +8 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks'
|
|
2
|
+
|
|
3
|
+
const bind = Function.prototype.call.bind(Function.prototype.bind)
|
|
4
|
+
const defineProperty = Object.defineProperty
|
|
5
|
+
const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor
|
|
6
|
+
const apply = Reflect.apply
|
|
7
|
+
const nativeGetStore = AsyncLocalStorage.prototype.getStore
|
|
8
|
+
const nativeEnterWith = AsyncLocalStorage.prototype.enterWith
|
|
9
|
+
const nativeRun = AsyncLocalStorage.prototype.run
|
|
10
|
+
const nativeRunDescriptor = getOwnPropertyDescriptor(AsyncLocalStorage.prototype, 'run')
|
|
11
|
+
|
|
12
|
+
function protect(scope) {
|
|
13
|
+
defineProperty(scope, 'getStore', { value: bind(nativeGetStore, scope) })
|
|
14
|
+
defineProperty(scope, 'enterWith', { value: bind(nativeEnterWith, scope) })
|
|
15
|
+
defineProperty(scope, 'run', { value: bind(nativeRun, scope) })
|
|
16
|
+
return scope
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function createPrivateAsyncLocalStorage() {
|
|
20
|
+
return protect(new AsyncLocalStorage())
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function protectNextAsyncLocalStorageRun(invoke) {
|
|
24
|
+
let scope
|
|
25
|
+
defineProperty(AsyncLocalStorage.prototype, 'run', {
|
|
26
|
+
...nativeRunDescriptor,
|
|
27
|
+
value: function (...args) {
|
|
28
|
+
scope ??= protect(this)
|
|
29
|
+
return apply(nativeRun, this, args)
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
try {
|
|
33
|
+
invoke()
|
|
34
|
+
} finally {
|
|
35
|
+
defineProperty(AsyncLocalStorage.prototype, 'run', nativeRunDescriptor)
|
|
36
|
+
}
|
|
37
|
+
return scope
|
|
38
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const BINDING_TYPE_NAMESPACE_TOKEN = '__ptcBindingTypes'
|
|
2
|
+
|
|
3
|
+
export function bindingTypeNamespaceToken(source) {
|
|
4
|
+
let token = BINDING_TYPE_NAMESPACE_TOKEN
|
|
5
|
+
let suffix = 0
|
|
6
|
+
while (source.includes(token)) token = `${BINDING_TYPE_NAMESPACE_TOKEN}_${++suffix}`
|
|
7
|
+
return token
|
|
8
|
+
}
|