@exactjs/core 0.6.0 → 0.6.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/dist/client/component/resumption.js +3 -1
- package/dist/client/component/resumption.js.map +1 -1
- package/dist/client/framework/server-task-helpers.d.ts +1 -1
- package/dist/client/framework/server-task-helpers.d.ts.map +1 -1
- package/dist/client/framework/server-task-helpers.js +1 -1
- package/dist/client/framework/server-task-helpers.js.map +1 -1
- package/dist/client/tasks/frame-continuation.d.ts +1 -1
- package/dist/client/tasks/frame-continuation.d.ts.map +1 -1
- package/dist/client/tasks/frame-continuation.js +21 -10
- package/dist/client/tasks/frame-continuation.js.map +1 -1
- package/dist/client/tasks/frame-runtime.d.ts +2 -2
- package/dist/client/tasks/frame-runtime.d.ts.map +1 -1
- package/dist/client/tasks/frame-runtime.js +14 -6
- package/dist/client/tasks/frame-runtime.js.map +1 -1
- package/dist/client/tasks/resources.d.ts.map +1 -1
- package/dist/client/tasks/resources.js +6 -3
- package/dist/client/tasks/resources.js.map +1 -1
- package/dist/client/tasks/scheduled-reactions.d.ts.map +1 -1
- package/dist/client/tasks/scheduled-reactions.js +9 -2
- package/dist/client/tasks/scheduled-reactions.js.map +1 -1
- package/dist/component/resumption.js +3 -1
- package/dist/component/resumption.js.map +1 -1
- package/dist/framework/server-task-helpers.d.ts +1 -1
- package/dist/framework/server-task-helpers.d.ts.map +1 -1
- package/dist/framework/server-task-helpers.js +1 -1
- package/dist/framework/server-task-helpers.js.map +1 -1
- package/dist/server/component/resumption.js +3 -1
- package/dist/server/component/resumption.js.map +1 -1
- package/dist/server/framework/server-task-helpers.d.ts +1 -1
- package/dist/server/framework/server-task-helpers.d.ts.map +1 -1
- package/dist/server/framework/server-task-helpers.js +1 -1
- package/dist/server/framework/server-task-helpers.js.map +1 -1
- package/dist/server/tasks/frame-continuation.d.ts +1 -1
- package/dist/server/tasks/frame-continuation.d.ts.map +1 -1
- package/dist/server/tasks/frame-continuation.js +21 -10
- package/dist/server/tasks/frame-continuation.js.map +1 -1
- package/dist/server/tasks/frame-runtime.d.ts +2 -2
- package/dist/server/tasks/frame-runtime.d.ts.map +1 -1
- package/dist/server/tasks/frame-runtime.js +14 -6
- package/dist/server/tasks/frame-runtime.js.map +1 -1
- package/dist/server/tasks/resources.d.ts.map +1 -1
- package/dist/server/tasks/resources.js +6 -3
- package/dist/server/tasks/resources.js.map +1 -1
- package/dist/server/tasks/scheduled-reactions.d.ts.map +1 -1
- package/dist/server/tasks/scheduled-reactions.js +9 -2
- package/dist/server/tasks/scheduled-reactions.js.map +1 -1
- package/dist/tasks/frame-continuation.d.ts +1 -1
- package/dist/tasks/frame-continuation.d.ts.map +1 -1
- package/dist/tasks/frame-continuation.js +21 -10
- package/dist/tasks/frame-continuation.js.map +1 -1
- package/dist/tasks/frame-runtime.d.ts +2 -2
- package/dist/tasks/frame-runtime.d.ts.map +1 -1
- package/dist/tasks/frame-runtime.js +14 -6
- package/dist/tasks/frame-runtime.js.map +1 -1
- package/dist/tasks/resources.d.ts.map +1 -1
- package/dist/tasks/resources.js +6 -3
- package/dist/tasks/resources.js.map +1 -1
- package/dist/tasks/scheduled-reactions.d.ts.map +1 -1
- package/dist/tasks/scheduled-reactions.js +9 -2
- package/dist/tasks/scheduled-reactions.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-reactions.js","sourceRoot":"","sources":["../../../src/tasks/scheduled-reactions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAwB,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EACN,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,uB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CAAC;AAED,SAAS,kBAAkB;IAC1B,OAAO,UAAU,CAAC,WAAW,EAAE,GAAG,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;AACpD,CAAC","sourcesContent":["import type { ScheduledWorkContext } from '@exactjs/reactive/framework/runtime';\nimport { TaskCancellation } from './cancellation.js';\nimport { taskFrameTokenBrand, type TaskFrameRecord } from './frame-contracts.js';\nimport { taskFrameInspectionAttached } from './frame-inspection-capability.js';\nimport {\n\tallocateTaskFrameId,\n\tattachTaskFrameSettlement,\n\tcurrentTaskFrameRecord,\n\texecuteTaskFrame,\n\twithTaskFrameRecord\n} from './frame-runtime.js';\nimport { settleTaskFrameChildren } from './frame-settlement.js';\n\ntype ScheduledReactionBatch = {\n\treadonly frame: TaskFrameRecord;\n\treadonly signal: AbortSignal;\n\treadonly resolve: () => void;\n\treadonly reject: (error: unknown) => void;\n\tpending: number;\n\tfailed: boolean;\n\tfailure?: unknown;\n\tclosed: boolean;\n};\n\nconst scheduledReactionBatches = new WeakMap<TaskFrameRecord, ScheduledReactionBatch>();\n\n/** Acquires one lease on the consequence frame shared by a task invalidation wave. */\nexport function acquireScheduledReactionBatch(parent: TaskFrameRecord): ScheduledWorkContext {\n\tlet batch = scheduledReactionBatches.get(parent);\n\tif (!batch || batch.closed) {\n\t\tbatch = createScheduledReactionBatch(parent);\n\t\tscheduledReactionBatches.set(parent, batch);\n\t}\n\tbatch.pending++;\n\tlet released = false;\n\tconst release = (error?: unknown, failed = false) => {\n\t\tif (released) return;\n\t\treleased = true;\n\t\tif (failed && !batch!.failed) {\n\t\t\tbatch!.failed = true;\n\t\t\tbatch!.failure = error;\n\t\t}\n\t\tif (--batch!.pending !== 0) return;\n\t\tbatch!.closed = true;\n\t\tif (scheduledReactionBatches.get(parent) === batch) scheduledReactionBatches.delete(parent);\n\t\tif (batch!.failed) batch!.reject(batch!.failure);\n\t\telse batch!.resolve();\n\t};\n\treturn {\n\t\trun(work) {\n\t\t\tif (released) return;\n\t\t\ttry {\n\t\t\t\tif (batch!.signal.aborted) throw new TaskCancellation(batch!.signal.reason);\n\t\t\t\twithTaskFrameRecord(batch!.frame, work);\n\t\t\t} catch (error) {\n\t\t\t\trelease(error, true);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\trelease();\n\t\t},\n\t\tcancel: release\n\t};\n}\n\nfunction createScheduledReactionBatch(parent: TaskFrameRecord): ScheduledReactionBatch {\n\treturn taskFrameInspectionAttached(parent)\n\t\t? createInspectedScheduledReactionBatch(parent)\n\t\t: createInlineScheduledReactionBatch(parent);\n}\n\n/** Attaches one completion lease without a complete public task frame. */\nfunction createInlineScheduledReactionBatch(parent: TaskFrameRecord): ScheduledReactionBatch {\n\tlet controller: AbortController | undefined;\n\tlet acceptCompletion!: () => void;\n\tlet rejectCompletion!: (error: unknown) => void;\n\tconst completion = new Promise<void>((accept, fail) => {\n\t\tacceptCompletion = accept;\n\t\trejectCompletion = fail;\n\t});\n\tconst frame: TaskFrameRecord = {\n\t\t[taskFrameTokenBrand]: true,\n\t\tid: allocateTaskFrameId(),\n\t\towner: parent.owner,\n\t\tparent,\n\t\tget controller() {\n\t\t\tif (!controller) {\n\t\t\t\tcontroller = new AbortController();\n\t\t\t\tlinkAbort(parent.controller.signal, controller);\n\t\t\t}\n\t\t\treturn controller;\n\t\t},\n\t\tkind: 'reactive',\n\t\tlabel: 'reactive consequences',\n\t\tactivation: parent.activation,\n\t\tgeneration: parent.generation,\n\t\tplacement: parent.placement,\n\t\tconcurrency: parent.concurrency,\n\t\tpriority: parent.priority,\n\t\treadiness: parent.readiness,\n\t\tstartedAt: monotonicTimestamp(),\n\t\tproducerOpen: true,\n\t\tsettled: false\n\t};\n\tattachTaskFrameSettlement(parent, completion);\n\treturn {\n\t\tframe,\n\t\tsignal: parent.controller.signal,\n\t\tresolve() {\n\t\t\tframe.producerOpen = false;\n\t\t\tvoid settleTaskFrameChildren(frame).then(\n\t\t\t\t() => finishInlineFrame(frame, acceptCompletion),\n\t\t\t\t(error) => finishInlineFrame(frame, () => rejectCompletion(error))\n\t\t\t);\n\t\t},\n\t\treject(error) {\n\t\t\tframe.producerOpen = false;\n\t\t\tcontroller?.abort(error);\n\t\t\tconst finish = () => finishInlineFrame(frame, () => rejectCompletion(error));\n\t\t\tvoid settleTaskFrameChildren(frame).then(finish, finish);\n\t\t},\n\t\tpending: 0,\n\t\tfailed: false,\n\t\tclosed: false\n\t};\n}\n\nfunction finishInlineFrame(frame: TaskFrameRecord, settle: () => void): void {\n\tframe.settled = true;\n\tsettle();\n}\n\n/** Retains the complete consequence projection while DevTools inspection is attached. */\nfunction createInspectedScheduledReactionBatch(parent: TaskFrameRecord): ScheduledReactionBatch {\n\tlet resolve!: () => void;\n\tlet reject!: (error: unknown) => void;\n\tconst completion = new Promise<void>((accept, fail) => {\n\t\tresolve = accept;\n\t\treject = fail;\n\t});\n\tlet frame!: TaskFrameRecord;\n\tconst execution = executeTaskFrame(\n\t\t{\n\t\t\tparent,\n\t\t\towner: parent.owner,\n\t\t\tactivation: parent.activation,\n\t\t\tkind: 'reactive',\n\t\t\tlabel: 'reactive consequences',\n\t\t\tpublicContext: false\n\t\t},\n\t\t() => {\n\t\t\tframe = currentTaskFrameRecord()!;\n\t\t\treturn completion;\n\t\t}\n\t);\n\tvoid execution.catch(() => undefined);\n\treturn {\n\t\tframe,\n\t\tsignal: frame.controller.signal,\n\t\tresolve,\n\t\treject,\n\t\tpending: 0,\n\t\tfailed: false,\n\t\tclosed: false\n\t};\n}\n\nfunction linkAbort(signal: AbortSignal, target: AbortController): void {\n\tif (signal.aborted) target.abort(signal.reason);\n\telse signal.addEventListener('abort', () => target.abort(signal.reason), { once: true });\n}\n\nfunction monotonicTimestamp(): number {\n\treturn globalThis.performance?.now() ?? Date.now();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"scheduled-reactions.js","sourceRoot":"","sources":["../../../src/tasks/scheduled-reactions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBA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,MAAM;QAC/B,OAAO;QACP,MAAM;QACN,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,KAAK;KACb,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,MAAmB,EAAE,MAAuB;IAC9D,IAAI,MAAM,CAAC,OAAO;QAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;;QAC3C,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1F,CAAC;AAED,SAAS,kBAAkB;IAC1B,OAAO,UAAU,CAAC,WAAW,EAAE,GAAG,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;AACpD,CAAC","sourcesContent":["import type { ScheduledWorkContext } from '@exactjs/reactive/framework/runtime';\nimport { TaskCancellation } from './cancellation.js';\nimport { taskFrameTokenBrand, type TaskFrameRecord } from './frame-contracts.js';\nimport { taskFrameInspectionAttached } from './frame-inspection-capability.js';\nimport {\n\tallocateTaskFrameId,\n\tattachTaskFrameSettlement,\n\tcurrentTaskFrameRecord,\n\texecuteTaskFrame,\n\twithTaskFrameRecord\n} from './frame-runtime.js';\nimport { settleTaskFrameChildren } from './frame-settlement.js';\n\ntype ScheduledReactionBatch = {\n\treadonly frame: TaskFrameRecord;\n\treadonly signal: AbortSignal;\n\treadonly resolve: () => void;\n\treadonly reject: (error: unknown) => void;\n\tpending: number;\n\tfailed: boolean;\n\tfailure?: unknown;\n\tclosed: boolean;\n};\n\nconst scheduledReactionBatches = new WeakMap<TaskFrameRecord, ScheduledReactionBatch>();\n\n/** Acquires one lease on the consequence frame shared by a task invalidation wave. */\nexport function acquireScheduledReactionBatch(parent: TaskFrameRecord): ScheduledWorkContext {\n\tlet batch = scheduledReactionBatches.get(parent);\n\tif (!batch || batch.closed) {\n\t\tbatch = createScheduledReactionBatch(parent);\n\t\tscheduledReactionBatches.set(parent, batch);\n\t}\n\tbatch.pending++;\n\tlet released = false;\n\tconst release = (error?: unknown, failed = false) => {\n\t\tif (released) return;\n\t\treleased = true;\n\t\tif (failed && !batch!.failed) {\n\t\t\tbatch!.failed = true;\n\t\t\tbatch!.failure = error;\n\t\t}\n\t\tif (--batch!.pending !== 0) return;\n\t\tbatch!.closed = true;\n\t\tif (scheduledReactionBatches.get(parent) === batch) scheduledReactionBatches.delete(parent);\n\t\tif (batch!.failed) batch!.reject(batch!.failure);\n\t\telse batch!.resolve();\n\t};\n\treturn {\n\t\trun(work) {\n\t\t\tif (released) return;\n\t\t\tif (batch!.signal.aborted) {\n\t\t\t\t// Invalidation observes already committed state, and the live observer may have\n\t\t\t\t// coalesced newer writes. Retire its cancelled task lease without discarding the\n\t\t\t\t// observation or resuming the stale producer. Reaction scope disposal is owned\n\t\t\t\t// by the scheduler; genuine observer failures still propagate normally.\n\t\t\t\trelease(new TaskCancellation(batch!.signal.reason), true);\n\t\t\t\twithTaskFrameRecord(undefined, work);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\twithTaskFrameRecord(batch!.frame, work);\n\t\t\t} catch (error) {\n\t\t\t\trelease(error, true);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\trelease();\n\t\t},\n\t\tcancel: release\n\t};\n}\n\nfunction createScheduledReactionBatch(parent: TaskFrameRecord): ScheduledReactionBatch {\n\treturn taskFrameInspectionAttached(parent)\n\t\t? createInspectedScheduledReactionBatch(parent)\n\t\t: createInlineScheduledReactionBatch(parent);\n}\n\n/** Attaches one completion lease without a complete public task frame. */\nfunction createInlineScheduledReactionBatch(parent: TaskFrameRecord): ScheduledReactionBatch {\n\tlet controller: AbortController | undefined;\n\tlet acceptCompletion!: () => void;\n\tlet rejectCompletion!: (error: unknown) => void;\n\tconst completion = new Promise<void>((accept, fail) => {\n\t\tacceptCompletion = accept;\n\t\trejectCompletion = fail;\n\t});\n\tconst frame: TaskFrameRecord = {\n\t\t[taskFrameTokenBrand]: true,\n\t\tid: allocateTaskFrameId(),\n\t\towner: parent.owner,\n\t\tparent,\n\t\tget controller() {\n\t\t\tif (!controller) {\n\t\t\t\tcontroller = new AbortController();\n\t\t\t\tlinkAbort(parent.controller.signal, controller);\n\t\t\t}\n\t\t\treturn controller;\n\t\t},\n\t\tkind: 'reactive',\n\t\tlabel: 'reactive consequences',\n\t\tactivation: parent.activation,\n\t\tgeneration: parent.generation,\n\t\tplacement: parent.placement,\n\t\tconcurrency: parent.concurrency,\n\t\tpriority: parent.priority,\n\t\treadiness: parent.readiness,\n\t\tstartedAt: monotonicTimestamp(),\n\t\tproducerOpen: true,\n\t\tsettled: false\n\t};\n\tattachTaskFrameSettlement(parent, completion);\n\treturn {\n\t\tframe,\n\t\tsignal: parent.controller.signal,\n\t\tresolve() {\n\t\t\tframe.producerOpen = false;\n\t\t\tvoid settleTaskFrameChildren(frame).then(\n\t\t\t\t() => finishInlineFrame(frame, acceptCompletion),\n\t\t\t\t(error) => finishInlineFrame(frame, () => rejectCompletion(error))\n\t\t\t);\n\t\t},\n\t\treject(error) {\n\t\t\tframe.producerOpen = false;\n\t\t\tcontroller?.abort(error);\n\t\t\tconst finish = () => finishInlineFrame(frame, () => rejectCompletion(error));\n\t\t\tvoid settleTaskFrameChildren(frame).then(finish, finish);\n\t\t},\n\t\tpending: 0,\n\t\tfailed: false,\n\t\tclosed: false\n\t};\n}\n\nfunction finishInlineFrame(frame: TaskFrameRecord, settle: () => void): void {\n\tframe.settled = true;\n\tsettle();\n}\n\n/** Retains the complete consequence projection while DevTools inspection is attached. */\nfunction createInspectedScheduledReactionBatch(parent: TaskFrameRecord): ScheduledReactionBatch {\n\tlet resolve!: () => void;\n\tlet reject!: (error: unknown) => void;\n\tconst completion = new Promise<void>((accept, fail) => {\n\t\tresolve = accept;\n\t\treject = fail;\n\t});\n\tlet frame!: TaskFrameRecord;\n\tconst execution = executeTaskFrame(\n\t\t{\n\t\t\tparent,\n\t\t\towner: parent.owner,\n\t\t\tactivation: parent.activation,\n\t\t\tkind: 'reactive',\n\t\t\tlabel: 'reactive consequences',\n\t\t\tpublicContext: false\n\t\t},\n\t\t() => {\n\t\t\tframe = currentTaskFrameRecord()!;\n\t\t\treturn completion;\n\t\t}\n\t);\n\tvoid execution.catch(() => undefined);\n\treturn {\n\t\tframe,\n\t\tsignal: frame.controller.signal,\n\t\tresolve,\n\t\treject,\n\t\tpending: 0,\n\t\tfailed: false,\n\t\tclosed: false\n\t};\n}\n\nfunction linkAbort(signal: AbortSignal, target: AbortController): void {\n\tif (signal.aborted) target.abort(signal.reason);\n\telse signal.addEventListener('abort', () => target.abort(signal.reason), { once: true });\n}\n\nfunction monotonicTimestamp(): number {\n\treturn globalThis.performance?.now() ?? Date.now();\n}\n"]}
|
|
@@ -21,7 +21,9 @@ function writePath(target, path, value) {
|
|
|
21
21
|
let cursor = target;
|
|
22
22
|
for (const segment of segments.slice(0, -1)) {
|
|
23
23
|
const current = cursor[segment];
|
|
24
|
-
|
|
24
|
+
// A child path can accompany its captured parent or a setup-owned array.
|
|
25
|
+
// Traversing `.length` or an indexed item must preserve that array's identity.
|
|
26
|
+
if (current && typeof current === 'object') {
|
|
25
27
|
cursor = current;
|
|
26
28
|
}
|
|
27
29
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resumption.js","sourceRoot":"","sources":["../../src/component/resumption.ts"],"names":[],"mappings":"AAKA,4FAA4F;AAC5F,MAAM,UAAU,wBAAwB,CACvC,KAAwC,EACxC,UAAqC;IAErC,MAAM,MAAM,GAAG,aAAa,IAAI,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACvF,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,KAAK,MAAM,CAAC,KAA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IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC5C,MAAM,GAAG,OAAkC,CAAC;QAC7C,CAAC;aAAM,CAAC;YACP,MAAM,OAAO,GAA4B,EAAE,CAAC;YAC5C,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;YAC1B,MAAM,GAAG,OAAO,CAAC;QAClB,CAAC;IACF,CAAC;IACD,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,GAAG,KAAK,CAAC;AAClC,CAAC;AAED,8EAA8E;AAC9E,SAAS,WAAW,CAAC,OAAe;IACnC,OAAO,CACN,OAAO,CAAC,MAAM,GAAG,CAAC;QAClB,OAAO,KAAK,WAAW;QACvB,OAAO,KAAK,WAAW;QACvB,OAAO,KAAK,aAAa,CACzB,CAAC;AACH,CAAC","sourcesContent":["import type { Reactive } from '@exactjs/reactive/framework/runtime';\nimport type { ComponentResumptionSource } from './contracts.js';\n\ntype IndexedResumptionField = readonly [field: number | string, value: unknown];\n\n/** Applies compiler-selected SSR state paths without replacing client-local setup state. */\nexport function applyComponentResumption(\n\tstate: Reactive<Record<string, unknown>>,\n\tresumption: ComponentResumptionSource\n): void {\n\tconst values = 'componentId' in resumption ? resumption.values : (resumption[1] ?? []);\n\tif (Array.isArray(values)) {\n\t\tfor (const [field, value] of values as unknown as readonly IndexedResumptionField[]) {\n\t\t\tif (typeof field !== 'string')\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`eXact indexed resumption was not prepared for ${'componentId' in resumption ? resumption.componentId : resumption[0]}`\n\t\t\t\t);\n\t\t\twritePath(state, field, value);\n\t\t}\n\t\treturn;\n\t}\n\tfor (const [path, value] of Object.entries(values)) writePath(state, path, value);\n}\n\n/** Materializes one validated dotted state path into the live reactive state object. */\nfunction writePath(target: Record<string, unknown>, path: string, value: unknown): void {\n\tconst segments = path.split('.');\n\tif (!segments.length || !segments.every(safeSegment)) {\n\t\tthrow new Error(`Malformed eXact component resumption state path ${path}`);\n\t}\n\tlet cursor = target;\n\tfor (const segment of segments.slice(0, -1)) {\n\t\tconst current = cursor[segment];\n\t\t// A child path can accompany its captured parent or a setup-owned array.\n\t\t// Traversing `.length` or an indexed item must preserve that array's identity.\n\t\tif (current && typeof current === 'object') {\n\t\t\tcursor = current as Record<string, unknown>;\n\t\t} else {\n\t\t\tconst created: Record<string, unknown> = {};\n\t\t\tcursor[segment] = created;\n\t\t\tcursor = created;\n\t\t}\n\t}\n\tcursor[segments.at(-1)!] = value;\n}\n\n/** Rejects prototype-bearing path segments before touching reactive state. */\nfunction safeSegment(segment: string): boolean {\n\treturn (\n\t\tsegment.length > 0 &&\n\t\tsegment !== '__proto__' &&\n\t\tsegment !== 'prototype' &&\n\t\tsegment !== 'constructor'\n\t);\n}\n"]}
|
|
@@ -2,7 +2,7 @@ export { registerComponentContinuationContexts } from '../component/context-resu
|
|
|
2
2
|
export { dispatchComponentContinuation } from '../component/domain.js';
|
|
3
3
|
export { activateTaskForHost } from '../tasks/activation.js';
|
|
4
4
|
export { activateComputationForHost } from '../tasks/computation-activation.js';
|
|
5
|
-
export { createTrackedContinuationDependency } from '../tasks/dependency-source.js';
|
|
5
|
+
export { createIndexedContinuationDependency, createTrackedContinuationDependency } from '../tasks/dependency-source.js';
|
|
6
6
|
export { activateCompiledClientLatestTaskForHost, bindCompiledClientLatestTaskForHost } from '../tasks/compiled-latest.js';
|
|
7
7
|
export { markComponentContinuationTask } from '../tasks/component-continuation.js';
|
|
8
8
|
export { taskMutation } from '../tasks/frame-runtime.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-task-helpers.d.ts","sourceRoot":"","sources":["../../src/framework/server-task-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,
|
|
1
|
+
{"version":3,"file":"server-task-helpers.d.ts","sourceRoot":"","sources":["../../src/framework/server-task-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EACN,mCAAmC,EACnC,mCAAmC,EACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,uCAAuC,EACvC,mCAAmC,EACnC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,sCAAsC,EAAE,MAAM,wCAAwC,CAAC;AAChG,OAAO,EACN,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -2,7 +2,7 @@ export { registerComponentContinuationContexts } from '../component/context-resu
|
|
|
2
2
|
export { dispatchComponentContinuation } from '../component/domain.js';
|
|
3
3
|
export { activateTaskForHost } from '../tasks/activation.js';
|
|
4
4
|
export { activateComputationForHost } from '../tasks/computation-activation.js';
|
|
5
|
-
export { createTrackedContinuationDependency } from '../tasks/dependency-source.js';
|
|
5
|
+
export { createIndexedContinuationDependency, createTrackedContinuationDependency } from '../tasks/dependency-source.js';
|
|
6
6
|
export { activateCompiledClientLatestTaskForHost, bindCompiledClientLatestTaskForHost } from '../tasks/compiled-latest.js';
|
|
7
7
|
export { markComponentContinuationTask } from '../tasks/component-continuation.js';
|
|
8
8
|
export { taskMutation } from '../tasks/frame-runtime.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-task-helpers.js","sourceRoot":"","sources":["../../src/framework/server-task-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,
|
|
1
|
+
{"version":3,"file":"server-task-helpers.js","sourceRoot":"","sources":["../../src/framework/server-task-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EACN,mCAAmC,EACnC,mCAAmC,EACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,uCAAuC,EACvC,mCAAmC,EACnC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,sCAAsC,EAAE,MAAM,wCAAwC,CAAC;AAChG,OAAO,EACN,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["export { registerComponentContinuationContexts } from '../component/context-resumption.js';\nexport { dispatchComponentContinuation } from '../component/domain.js';\nexport { activateTaskForHost } from '../tasks/activation.js';\nexport { activateComputationForHost } from '../tasks/computation-activation.js';\nexport {\n\tcreateIndexedContinuationDependency,\n\tcreateTrackedContinuationDependency\n} from '../tasks/dependency-source.js';\nexport {\n\tactivateCompiledClientLatestTaskForHost,\n\tbindCompiledClientLatestTaskForHost\n} from '../tasks/compiled-latest.js';\nexport { markComponentContinuationTask } from '../tasks/component-continuation.js';\nexport { taskMutation } from '../tasks/frame-runtime.js';\nexport { bindTaskForHost, defineTask, invokeTask } from '../tasks/runtime.js';\nexport { activateServerComponentTaskTreeForHost } from '../tasks/server-component-task-tree.js';\nexport {\n\tmutateTaskCollection,\n\townTaskResource,\n\tstageTaskMutation,\n\ttaskAnimationFrame,\n\ttaskAwait,\n\ttaskFetch,\n\ttaskIdleCallback,\n\ttaskInterval,\n\ttaskObserver,\n\ttaskTimeout\n} from '../tasks/resources.js';\nexport { combineTaskSignal, withAbortSignal, withTaskSignal } from '../tasks/signals.js';\n"]}
|
|
@@ -21,7 +21,9 @@ function writePath(target, path, value) {
|
|
|
21
21
|
let cursor = target;
|
|
22
22
|
for (const segment of segments.slice(0, -1)) {
|
|
23
23
|
const current = cursor[segment];
|
|
24
|
-
|
|
24
|
+
// A child path can accompany its captured parent or a setup-owned array.
|
|
25
|
+
// Traversing `.length` or an indexed item must preserve that array's identity.
|
|
26
|
+
if (current && typeof current === 'object') {
|
|
25
27
|
cursor = current;
|
|
26
28
|
}
|
|
27
29
|
else {
|
|
@@ -1 +1 @@
|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Q,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,KAAK,CAAC,mDAAmD,IAAI,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,IAAI,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;QAChC,yEAAyE;QACzE,+EAA+E;QAC/E,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC5C,MAAM,GAAG,OAAkC,CAAC;QAC7C,CAAC;aAAM,CAAC;YACP,MAAM,OAAO,GAA4B,EAAE,CAAC;YAC5C,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;YAC1B,MAAM,GAAG,OAAO,CAAC;QAClB,CAAC;IACF,CAAC;IACD,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,GAAG,KAAK,CAAC;AAClC,CAAC;AAED,8EAA8E;AAC9E,SAAS,WAAW,CAAC,OAAe;IACnC,OAAO,CACN,OAAO,CAAC,MAAM,GAAG,CAAC;QAClB,OAAO,KAAK,WAAW;QACvB,OAAO,KAAK,WAAW;QACvB,OAAO,KAAK,aAAa,CACzB,CAAC;AACH,CAAC","sourcesContent":["import type { Reactive } from '@exactjs/reactive/framework/runtime';\nimport type { ComponentResumptionSource } from './contracts.js';\n\ntype IndexedResumptionField = readonly [field: number | string, value: unknown];\n\n/** Applies compiler-selected SSR state paths without replacing client-local setup state. */\nexport function applyComponentResumption(\n\tstate: Reactive<Record<string, unknown>>,\n\tresumption: ComponentResumptionSource\n): void {\n\tconst values = 'componentId' in resumption ? resumption.values : (resumption[1] ?? []);\n\tif (Array.isArray(values)) {\n\t\tfor (const [field, value] of values as unknown as readonly IndexedResumptionField[]) {\n\t\t\tif (typeof field !== 'string')\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`eXact indexed resumption was not prepared for ${'componentId' in resumption ? resumption.componentId : resumption[0]}`\n\t\t\t\t);\n\t\t\twritePath(state, field, value);\n\t\t}\n\t\treturn;\n\t}\n\tfor (const [path, value] of Object.entries(values)) writePath(state, path, value);\n}\n\n/** Materializes one validated dotted state path into the live reactive state object. */\nfunction writePath(target: Record<string, unknown>, path: string, value: unknown): void {\n\tconst segments = path.split('.');\n\tif (!segments.length || !segments.every(safeSegment)) {\n\t\tthrow new Error(`Malformed eXact component resumption state path ${path}`);\n\t}\n\tlet cursor = target;\n\tfor (const segment of segments.slice(0, -1)) {\n\t\tconst current = cursor[segment];\n\t\t// A child path can accompany its captured parent or a setup-owned array.\n\t\t// Traversing `.length` or an indexed item must preserve that array's identity.\n\t\tif (current && typeof current === 'object') {\n\t\t\tcursor = current as Record<string, unknown>;\n\t\t} else {\n\t\t\tconst created: Record<string, unknown> = {};\n\t\t\tcursor[segment] = created;\n\t\t\tcursor = created;\n\t\t}\n\t}\n\tcursor[segments.at(-1)!] = value;\n}\n\n/** Rejects prototype-bearing path segments before touching reactive state. */\nfunction safeSegment(segment: string): boolean {\n\treturn (\n\t\tsegment.length > 0 &&\n\t\tsegment !== '__proto__' &&\n\t\tsegment !== 'prototype' &&\n\t\tsegment !== 'constructor'\n\t);\n}\n"]}
|
|
@@ -2,7 +2,7 @@ export { registerComponentContinuationContexts } from '../component/context-resu
|
|
|
2
2
|
export { dispatchComponentContinuation } from '../component/domain.js';
|
|
3
3
|
export { activateTaskForHost } from '../tasks/activation.js';
|
|
4
4
|
export { activateComputationForHost } from '../tasks/computation-activation.js';
|
|
5
|
-
export { createTrackedContinuationDependency } from '../tasks/dependency-source.js';
|
|
5
|
+
export { createIndexedContinuationDependency, createTrackedContinuationDependency } from '../tasks/dependency-source.js';
|
|
6
6
|
export { activateCompiledClientLatestTaskForHost, bindCompiledClientLatestTaskForHost } from '../tasks/compiled-latest.js';
|
|
7
7
|
export { markComponentContinuationTask } from '../tasks/component-continuation.js';
|
|
8
8
|
export { taskMutation } from '../tasks/frame-runtime.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-task-helpers.d.ts","sourceRoot":"","sources":["../../../src/framework/server-task-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,
|
|
1
|
+
{"version":3,"file":"server-task-helpers.d.ts","sourceRoot":"","sources":["../../../src/framework/server-task-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EACN,mCAAmC,EACnC,mCAAmC,EACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,uCAAuC,EACvC,mCAAmC,EACnC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,sCAAsC,EAAE,MAAM,wCAAwC,CAAC;AAChG,OAAO,EACN,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -2,7 +2,7 @@ export { registerComponentContinuationContexts } from '../component/context-resu
|
|
|
2
2
|
export { dispatchComponentContinuation } from '../component/domain.js';
|
|
3
3
|
export { activateTaskForHost } from '../tasks/activation.js';
|
|
4
4
|
export { activateComputationForHost } from '../tasks/computation-activation.js';
|
|
5
|
-
export { createTrackedContinuationDependency } from '../tasks/dependency-source.js';
|
|
5
|
+
export { createIndexedContinuationDependency, createTrackedContinuationDependency } from '../tasks/dependency-source.js';
|
|
6
6
|
export { activateCompiledClientLatestTaskForHost, bindCompiledClientLatestTaskForHost } from '../tasks/compiled-latest.js';
|
|
7
7
|
export { markComponentContinuationTask } from '../tasks/component-continuation.js';
|
|
8
8
|
export { taskMutation } from '../tasks/frame-runtime.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-task-helpers.js","sourceRoot":"","sources":["../../../src/framework/server-task-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,
|
|
1
|
+
{"version":3,"file":"server-task-helpers.js","sourceRoot":"","sources":["../../../src/framework/server-task-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EACN,mCAAmC,EACnC,mCAAmC,EACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,uCAAuC,EACvC,mCAAmC,EACnC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,sCAAsC,EAAE,MAAM,wCAAwC,CAAC;AAChG,OAAO,EACN,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["export { registerComponentContinuationContexts } from '../component/context-resumption.js';\nexport { dispatchComponentContinuation } from '../component/domain.js';\nexport { activateTaskForHost } from '../tasks/activation.js';\nexport { activateComputationForHost } from '../tasks/computation-activation.js';\nexport {\n\tcreateIndexedContinuationDependency,\n\tcreateTrackedContinuationDependency\n} from '../tasks/dependency-source.js';\nexport {\n\tactivateCompiledClientLatestTaskForHost,\n\tbindCompiledClientLatestTaskForHost\n} from '../tasks/compiled-latest.js';\nexport { markComponentContinuationTask } from '../tasks/component-continuation.js';\nexport { taskMutation } from '../tasks/frame-runtime.js';\nexport { bindTaskForHost, defineTask, invokeTask } from '../tasks/runtime.js';\nexport { activateServerComponentTaskTreeForHost } from '../tasks/server-component-task-tree.js';\nexport {\n\tmutateTaskCollection,\n\townTaskResource,\n\tstageTaskMutation,\n\ttaskAnimationFrame,\n\ttaskAwait,\n\ttaskFetch,\n\ttaskIdleCallback,\n\ttaskInterval,\n\ttaskObserver,\n\ttaskTimeout\n} from '../tasks/resources.js';\nexport { combineTaskSignal, withAbortSignal, withTaskSignal } from '../tasks/signals.js';\n"]}
|
|
@@ -4,5 +4,5 @@ export declare function registerTaskFrameSignal(signal: AbortSignal, frame: Task
|
|
|
4
4
|
/** Releases continuation restoration state when its frame settles. */
|
|
5
5
|
export declare function releaseTaskFrameSignal(signal: AbortSignal): void;
|
|
6
6
|
/** Queues one serialized continuation resumption for the frame owning a task signal. */
|
|
7
|
-
export declare function resumeTaskFrameContinuation(signal: AbortSignal, resume: () => void, enter: (frame: TaskFrameRecord) => () => void): void;
|
|
7
|
+
export declare function resumeTaskFrameContinuation(signal: AbortSignal, resume: () => void, enter: (frame: TaskFrameRecord | undefined) => () => void): void;
|
|
8
8
|
//# sourceMappingURL=frame-continuation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-continuation.d.ts","sourceRoot":"","sources":["../../../src/tasks/frame-continuation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAU5D,uFAAuF;AACvF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CAEzF;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAEhE;AAED,wFAAwF;AACxF,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,MAAM,IAAI,EAClB,KAAK,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"frame-continuation.d.ts","sourceRoot":"","sources":["../../../src/tasks/frame-continuation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAU5D,uFAAuF;AACvF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CAEzF;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAEhE;AAED,wFAAwF;AACxF,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,MAAM,IAAI,EAClB,KAAK,EAAE,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,KAAK,MAAM,IAAI,GACvD,IAAI,CAYN"}
|
|
@@ -31,15 +31,26 @@ function runNextTaskResumption() {
|
|
|
31
31
|
resumptionScheduled = false;
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
leave();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
let leave;
|
|
35
|
+
try {
|
|
36
|
+
// Cancellation may settle a frame while an earlier resumption owns the queue.
|
|
37
|
+
// Deliver the pending promise settlement without reviving that frame.
|
|
38
|
+
leave = next.enter(next.frame.settled ? undefined : next.frame);
|
|
39
|
+
next.resume();
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
// Promise resolution queues the authored continuation before the restoration job.
|
|
43
|
+
queueMicrotask(() => {
|
|
44
|
+
try {
|
|
45
|
+
leave?.();
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
if (pendingResumptions.length)
|
|
49
|
+
queueMicrotask(runNextTaskResumption);
|
|
50
|
+
else
|
|
51
|
+
resumptionScheduled = false;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
44
55
|
}
|
|
45
56
|
//# sourceMappingURL=frame-continuation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-continuation.js","sourceRoot":"","sources":["../../../src/tasks/frame-continuation.ts"],"names":[],"mappings":"AAEA,MAAM,cAAc,GAAG,IAAI,OAAO,EAAgC,CAAC;AACnE,MAAM,kBAAkB,GAInB,EAAE,CAAC;AACR,IAAI,mBAAmB,GAAG,KAAK,CAAC;AAEhC,uFAAuF;AACvF,MAAM,UAAU,uBAAuB,CAAC,MAAmB,EAAE,KAAsB;IAClF,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,sBAAsB,CAAC,MAAmB;IACzD,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,2BAA2B,CAC1C,MAAmB,EACnB,MAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"frame-continuation.js","sourceRoot":"","sources":["../../../src/tasks/frame-continuation.ts"],"names":[],"mappings":"AAEA,MAAM,cAAc,GAAG,IAAI,OAAO,EAAgC,CAAC;AACnE,MAAM,kBAAkB,GAInB,EAAE,CAAC;AACR,IAAI,mBAAmB,GAAG,KAAK,CAAC;AAEhC,uFAAuF;AACvF,MAAM,UAAU,uBAAuB,CAAC,MAAmB,EAAE,KAAsB;IAClF,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,sBAAsB,CAAC,MAAmB;IACzD,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,2BAA2B,CAC1C,MAAmB,EACnB,MAAkB,EAClB,KAAyD;IAEzD,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACzC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QAC7B,MAAM,EAAE,CAAC;QACT,OAAO;IACR,CAAC;IACD,kBAAkB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAClD,IAAI,mBAAmB;QAAE,OAAO;IAChC,mBAAmB,GAAG,IAAI,CAAC;IAC3B,8FAA8F;IAC9F,8FAA8F;IAC9F,qBAAqB,EAAE,CAAC;AACzB,CAAC;AAED,+FAA+F;AAC/F,SAAS,qBAAqB;IAC7B,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,EAAE,CAAC;IACxC,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,mBAAmB,GAAG,KAAK,CAAC;QAC5B,OAAO;IACR,CAAC;IACD,IAAI,KAA+B,CAAC;IACpC,IAAI,CAAC;QACJ,8EAA8E;QAC9E,sEAAsE;QACtE,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChE,IAAI,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;YAAS,CAAC;QACV,kFAAkF;QAClF,cAAc,CAAC,GAAG,EAAE;YACnB,IAAI,CAAC;gBACJ,KAAK,EAAE,EAAE,CAAC;YACX,CAAC;oBAAS,CAAC;gBACV,IAAI,kBAAkB,CAAC,MAAM;oBAAE,cAAc,CAAC,qBAAqB,CAAC,CAAC;;oBAChE,mBAAmB,GAAG,KAAK,CAAC;YAClC,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC","sourcesContent":["import type { TaskFrameRecord } from './frame-contracts.js';\n\nconst framesBySignal = new WeakMap<AbortSignal, TaskFrameRecord>();\nconst pendingResumptions: Array<{\n\treadonly frame: TaskFrameRecord;\n\treadonly resume: () => void;\n\treadonly enter: (frame: TaskFrameRecord | undefined) => () => void;\n}> = [];\nlet resumptionScheduled = false;\n\n/** Associates a frame signal with the frame restored after compiler-lowered awaits. */\nexport function registerTaskFrameSignal(signal: AbortSignal, frame: TaskFrameRecord): void {\n\tframesBySignal.set(signal, frame);\n}\n\n/** Releases continuation restoration state when its frame settles. */\nexport function releaseTaskFrameSignal(signal: AbortSignal): void {\n\tframesBySignal.delete(signal);\n}\n\n/** Queues one serialized continuation resumption for the frame owning a task signal. */\nexport function resumeTaskFrameContinuation(\n\tsignal: AbortSignal,\n\tresume: () => void,\n\tenter: (frame: TaskFrameRecord | undefined) => () => void\n): void {\n\tconst frame = framesBySignal.get(signal);\n\tif (!frame || frame.settled) {\n\t\tresume();\n\t\treturn;\n\t}\n\tpendingResumptions.push({ frame, resume, enter });\n\tif (resumptionScheduled) return;\n\tresumptionScheduled = true;\n\t// The promise-resolution job is already an asynchronous boundary. Enter the uncontended first\n\t// continuation there and retain the queue only for resolutions that overlap its authored job.\n\trunNextTaskResumption();\n}\n\n/** Serializes restoration so concurrent promise resolutions cannot exchange task ownership. */\nfunction runNextTaskResumption(): void {\n\tconst next = pendingResumptions.shift();\n\tif (!next) {\n\t\tresumptionScheduled = false;\n\t\treturn;\n\t}\n\tlet leave: (() => void) | undefined;\n\ttry {\n\t\t// Cancellation may settle a frame while an earlier resumption owns the queue.\n\t\t// Deliver the pending promise settlement without reviving that frame.\n\t\tleave = next.enter(next.frame.settled ? undefined : next.frame);\n\t\tnext.resume();\n\t} finally {\n\t\t// Promise resolution queues the authored continuation before the restoration job.\n\t\tqueueMicrotask(() => {\n\t\t\ttry {\n\t\t\t\tleave?.();\n\t\t\t} finally {\n\t\t\t\tif (pendingResumptions.length) queueMicrotask(runNextTaskResumption);\n\t\t\t\telse resumptionScheduled = false;\n\t\t\t}\n\t\t});\n\t}\n}\n"]}
|
|
@@ -18,8 +18,8 @@ export declare function withDeferredTaskFrame<T>(materialize: () => TaskFrameRec
|
|
|
18
18
|
export declare function currentTaskOwnerRecord(): TaskOwnerRecord | undefined;
|
|
19
19
|
/** Establishes a durable host owner during component state-machine construction or adapter setup. */
|
|
20
20
|
export declare function withTaskOwnerRecord<T>(owner: TaskOwnerRecord, work: () => T): T;
|
|
21
|
-
/** Runs a synchronous segment with
|
|
22
|
-
export declare function withTaskFrameRecord<T>(frame: TaskFrameRecord, work: () => T): T;
|
|
21
|
+
/** Runs a synchronous segment with the supplied frame, or clears ambient frame ownership. */
|
|
22
|
+
export declare function withTaskFrameRecord<T>(frame: TaskFrameRecord | undefined, work: () => T): T;
|
|
23
23
|
/**
|
|
24
24
|
* Runs work in a frame, then waits for dynamically attached descendants and
|
|
25
25
|
* executes cleanup in last-in-first-out order.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-runtime.d.ts","sourceRoot":"","sources":["../../../src/tasks/frame-runtime.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAO7D,OAAO,EAA0B,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAajF,OAAO,EAGN,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACX,wBAAwB,EACxB,0BAA0B,EAC1B,eAAe,EACf,eAAe,EACf,MAAM,sBAAsB,CAAC;AAQ9B,kEAAkE;AAClE,wBAAgB,qBAAqB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,eAAe,CAErE;AAED,4EAA4E;AAC5E,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAGhG;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,eAAe,CAGjE;AAED,8EAA8E;AAC9E,wBAAgB,sBAAsB,IAAI,eAAe,GAAG,SAAS,CAEpE;AAED,kGAAkG;AAClG,wBAAgB,4BAA4B,IAAI,eAAe,GAAG,SAAS,CAE1E;AAED,mGAAmG;AACnG,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,eAAe,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAQ7F;AAED,wEAAwE;AACxE,wBAAgB,sBAAsB,IAAI,eAAe,GAAG,S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
+
/** Runs a synchronous segment with the supplied frame, or clears ambient frame ownership. */
|
|
67
67
|
export function withTaskFrameRecord(frame, work) {
|
|
68
|
-
if (frame
|
|
68
|
+
if (frame?.settled)
|
|
69
69
|
throw new Error('Cannot resume a settled task frame');
|
|
70
70
|
ensureScheduledWorkContextCapture();
|
|
71
71
|
const previous = currentFrame;
|
|
72
|
+
const previousMaterializer = deferredFrameMaterializer;
|
|
72
73
|
currentFrame = frame;
|
|
74
|
+
if (!frame)
|
|
75
|
+
deferredFrameMaterializer = undefined;
|
|
73
76
|
try {
|
|
74
77
|
return work();
|
|
75
78
|
}
|
|
76
79
|
finally {
|
|
77
80
|
currentFrame = previous;
|
|
81
|
+
deferredFrameMaterializer = previousMaterializer;
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
/**
|
|
@@ -88,8 +92,10 @@ export function executeTaskFrame(options, work) {
|
|
|
88
92
|
(!structuralParent.producerOpen || structuralParent.settled))
|
|
89
93
|
return Promise.reject(new Error('Cannot attach work after the parent task producer has closed'));
|
|
90
94
|
const owner = options.owner ?? structuralParent?.owner ?? createTaskOwnerRecord('implicit task invocation');
|
|
91
|
-
if (owner.disposed)
|
|
92
|
-
|
|
95
|
+
if (owner.disposed) {
|
|
96
|
+
options.controller?.abort('task-owner-disposed');
|
|
97
|
+
return Promise.reject(new TaskCancellation(options.controller?.signal.reason ?? 'task-owner-disposed'));
|
|
98
|
+
}
|
|
93
99
|
const controller = options.controller ?? new AbortController();
|
|
94
100
|
// The owner cancels its active frame controllers directly during disposal. Subscribing every
|
|
95
101
|
// frame to its durable signal would retain settled controllers until the owner itself is released.
|
|
@@ -288,12 +294,14 @@ export function taskMutation(signal, mutation) {
|
|
|
288
294
|
/** Restores the owning task frame around one compiler-lowered async continuation. */
|
|
289
295
|
export function resumeTaskFrame(signal, resume) {
|
|
290
296
|
resumeTaskFrameContinuation(signal, resume, (frame) => {
|
|
291
|
-
if (frame.settled)
|
|
292
|
-
throw new Error('Cannot resume a settled task frame');
|
|
293
297
|
const previous = currentFrame;
|
|
298
|
+
const previousMaterializer = deferredFrameMaterializer;
|
|
294
299
|
currentFrame = frame;
|
|
300
|
+
if (!frame)
|
|
301
|
+
deferredFrameMaterializer = undefined;
|
|
295
302
|
return () => {
|
|
296
303
|
currentFrame = previous;
|
|
304
|
+
deferredFrameMaterializer = previousMaterializer;
|
|
297
305
|
};
|
|
298
306
|
});
|
|
299
307
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-runtime.js","sourceRoot":"","sources":["../../../src/tasks/frame-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,8BAA8B,EAE9B,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EACN,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EACN,qBAAqB,EACrB,2BAA2B,EAC3B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EACN,mBAAmB,EACnB,cAAc,EAKd,MAAM,sBAAsB,CAAC;AAO9B,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,IAAI,YAAyC,CAAC;AAC9C,IAAI,YAAyC,CAAC;AAC9C,IAAI,yBAA8D,CAAC;AACnE,IAAI,6BAA6B,GAAG,KAAK,CAAC;AAC1C,MAAM,sBAAsB,GAAG,IAAI,OAAO,EAAiD,CAAC;AAE5F,kEAAkE;AAClE,MAAM,UAAU,qBAAqB,CAAC,KAA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;AAED,SAAS,iCAAiC;IACzC,IAAI,6BAA6B;QAAE,OAAO;IAC1C,6BAA6B,GAAG,IAAI,CAAC;IACrC,8BAA8B,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC3C,MAAM,MAAM,GAAG,sBAAsB,EAAE,CAAC;QACxC,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QACxE,IAAI,QAAQ,KAAK,aAAa,IAAI,4BAA4B,CAAC,GAAG,CAAC,MAAM,CAAC;YACzE,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC;QAC3C,OAAO,6BAA6B,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,iGAAiG;AACjG,SAAS,0BAA0B,CAAC,MAAuB;IAC1D,IAAI,OAAO,GAAG,2BAA2B,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtD,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAC5B,OAAO,GAAG;QACT,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC;QAChD,MAAM,KAAI,CAAC;KACX,CAAC;IACF,2BAA2B,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjD,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["import {\n\tsetScheduledWorkContextCapture,\n\ttype ScheduledWorkContext\n} from '@exactjs/reactive/framework/runtime';\nimport type { TaskContext, TaskOwner } from './contracts.js';\nimport { raceTaskCancellation, TaskCancellation } from './cancellation.js';\nimport {\n\tregisterTaskFrameSignal,\n\treleaseTaskFrameSignal,\n\tresumeTaskFrameContinuation\n} from './frame-continuation.js';\nimport { createTaskFrameContext, frameForTaskContext } from './frame-context.js';\nimport {\n\tpublishTaskFrameEvent,\n\ttaskFrameInspectionAttached\n} from './frame-inspection-capability.js';\nimport {\n\tregisterTaskFrameSettlement,\n\trunTaskFrameCleanups,\n\tsettleTaskFrameChildren\n} from './frame-settlement.js';\nimport { createLazyTaskOwnerRecord } from './owner-record.js';\nimport { acquireScheduledReactionBatch } from './scheduled-reactions.js';\n\nimport {\n\ttaskFrameTokenBrand,\n\ttaskOwnerBrand,\n\ttype InternalTaskFrameOptions,\n\ttype TaskFrameCleanup,\n\ttype TaskFrameRecord,\n\ttype TaskOwnerRecord\n} from './frame-contracts.js';\nexport type {\n\tInternalTaskFrameOptions,\n\tTaskActivationRegistration,\n\tTaskFrameRecord,\n\tTaskOwnerRecord\n} from './frame-contracts.js';\nlet nextFrameId = 1;\nlet currentFrame: TaskFrameRecord | undefined;\nlet currentOwner: TaskOwnerRecord | undefined;\nlet deferredFrameMaterializer: (() => TaskFrameRecord) | undefined;\nlet scheduledWorkCaptureInstalled = false;\nconst synchronousFrameErrors = new WeakMap<Promise<unknown>, { readonly error: unknown }>();\n\n/** Creates a durable task owner and its cancellation lifetime. */\nexport function createTaskOwnerRecord(label?: string): TaskOwnerRecord {\n\treturn createLazyTaskOwnerRecord(label);\n}\n\n/** Retains setup-owned cleanup until its durable task owner is disposed. */\nexport function registerTaskOwnerCleanup(owner: TaskOwnerRecord, cleanup: TaskFrameCleanup): void {\n\tif (owner.disposed) throw new Error('Task owner has been disposed');\n\towner.ownerCleanups.add(cleanup);\n}\n\n/** Validates and returns the internal representation of a public owner. */\nexport function taskOwnerRecord(owner: TaskOwner): TaskOwnerRecord {\n\tif (!(taskOwnerBrand in owner)) throw new TypeError('Task owner was not created by eXact');\n\treturn owner as TaskOwnerRecord;\n}\n\n/** Returns the frame active for the current synchronous execution segment. */\nexport function currentTaskFrameRecord(): TaskFrameRecord | undefined {\n\treturn currentFrame;\n}\n\n/** Materializes an interaction frame only when synchronous work requests structural ownership. */\nexport function materializeDeferredTaskFrame(): TaskFrameRecord | undefined {\n\treturn deferredFrameMaterializer?.();\n}\n\n/** Installs the lazy structural parent available to task and navigation operations during work. */\nexport function withDeferredTaskFrame<T>(materialize: () => TaskFrameRecord, work: () => T): T {\n\tconst previous = deferredFrameMaterializer;\n\tdeferredFrameMaterializer = materialize;\n\ttry {\n\t\treturn work();\n\t} finally {\n\t\tdeferredFrameMaterializer = previous;\n\t}\n}\n\n/** Returns the durable owner supplied by the current framework host. */\nexport function currentTaskOwnerRecord(): TaskOwnerRecord | undefined {\n\treturn currentFrame?.owner ?? currentOwner;\n}\n\n/** Establishes a durable host owner during component state-machine construction or adapter setup. */\nexport function withTaskOwnerRecord<T>(owner: TaskOwnerRecord, work: () => T): T {\n\tconst previous = currentOwner;\n\tcurrentOwner = owner;\n\ttry {\n\t\treturn work();\n\t} finally {\n\t\tcurrentOwner = previous;\n\t}\n}\n\n/** Runs a synchronous segment with one frame as ambient context. */\nexport function withTaskFrameRecord<T>(frame: TaskFrameRecord, work: () => T): T {\n\tif (frame.settled) throw new Error('Cannot resume a settled task frame');\n\tensureScheduledWorkContextCapture();\n\tconst previous = currentFrame;\n\tcurrentFrame = frame;\n\ttry {\n\t\treturn work();\n\t} finally {\n\t\tcurrentFrame = previous;\n\t}\n}\n\n/**\n * Runs work in a frame, then waits for dynamically attached descendants and\n * executes cleanup in last-in-first-out order.\n */\nexport function executeTaskFrame<T>(\n\toptions: InternalTaskFrameOptions,\n\twork: (context: TaskContext) => T | PromiseLike<T>\n): Promise<T> {\n\tconst structuralParent = options.detached ? undefined : (options.parent ?? currentFrame);\n\tif (\n\t\tstructuralParent &&\n\t\t!options.parentReserved &&\n\t\t(!structuralParent.producerOpen || structuralParent.settled)\n\t)\n\t\treturn Promise.reject(\n\t\t\tnew Error('Cannot attach work after the parent task producer has closed')\n\t\t);\n\tconst owner =\n\t\toptions.owner ?? structuralParent?.owner ?? createTaskOwnerRecord('implicit task invocation');\n\tif (owner.disposed) return Promise.reject(new Error('Task owner has been disposed'));\n\tconst controller = options.controller ?? new AbortController();\n\t// The owner cancels its active frame controllers directly during disposal. Subscribing every\n\t// frame to its durable signal would retain settled controllers until the owner itself is released.\n\tif (structuralParent) linkAbort(structuralParent.controller.signal, controller);\n\n\tlet resolveSettlement!: () => void;\n\tlet rejectSettlement!: (error: unknown) => void;\n\tconst settlement = new Promise<void>((resolve, reject) => {\n\t\tresolveSettlement = resolve;\n\t\trejectSettlement = reject;\n\t});\n\tconst frame: TaskFrameRecord = {\n\t\t[taskFrameTokenBrand]: true as const,\n\t\tid: nextFrameId++,\n\t\towner,\n\t\tparent: structuralParent,\n\t\tcontroller,\n\t\t...(options.label === undefined ? {} : { label: options.label }),\n\t\t...(options.sourceEntityId === undefined ? {} : { sourceEntityId: options.sourceEntityId }),\n\t\tactivation: options.activation ?? 'invoked',\n\t\tgeneration: options.generation ?? 1,\n\t\tplacement: options.placement ?? 'current',\n\t\tconcurrency: options.concurrency ?? 'parallel',\n\t\tpriority: options.priority ?? structuralParent?.priority ?? 'normal',\n\t\treadiness:\n\t\t\toptions.readiness ??\n\t\t\t(options.priority === 'deferred'\n\t\t\t\t? 'nonblocking'\n\t\t\t\t: (structuralParent?.readiness ?? 'blocking')),\n\t\tkind: options.kind ?? 'task',\n\t\tproducerOpen: true,\n\t\tsettled: false,\n\t\tstartedAt: monotonicTimestamp()\n\t};\n\tif (options.publicContext !== false)\n\t\t(frame as { context: TaskContext }).context = createTaskFrameContext(frame, options);\n\tregisterTaskFrameSignal(controller.signal, frame);\n\tregisterTaskFrameSettlement(frame, settlement);\n\towner.frames.add(frame);\n\tconst inspectedAtStart = taskFrameInspectionAttached(frame);\n\tif (inspectedAtStart) {\n\t\tpublishTaskFrameEvent(frame, 'task.frame.enter');\n\t\tpublishTaskFrameEvent(frame, 'task.start', undefined, {\n\t\t\tkind: 'start',\n\t\t\targuments: options.inspectionArguments\n\t\t});\n\t} else uninspectedSynchronousFrames.add(frame);\n\tif (structuralParent) {\n\t\t(structuralParent.children ??= new Set()).add(settlement);\n\t\tvoid settlement\n\t\t\t.finally(() => structuralParent.children?.delete(settlement))\n\t\t\t.catch(() => undefined);\n\t} else {\n\t\t// Root settlement is observed through executeTaskFrame's returned\n\t\t// promise; the internal structural signal has no parent consumer.\n\t\tvoid settlement.catch(() => undefined);\n\t}\n\n\tlet directResult: T | PromiseLike<T>;\n\tlet synchronousError: unknown;\n\ttry {\n\t\tif (controller.signal.aborted) throw new TaskCancellation(controller.signal.reason);\n\t\tdirectResult = withTaskFrameRecord(frame, () => work(frame.context!));\n\t} catch (error) {\n\t\tsynchronousError = error;\n\t\tdirectResult = Promise.reject(error);\n\t} finally {\n\t\tuninspectedSynchronousFrames.delete(frame);\n\t}\n\tconst execution = raceTaskCancellation(controller.signal, directResult);\n\n\tconst result = execution.then(\n\t\tasync (value) => {\n\t\t\tframe.producerOpen = false;\n\t\t\tpublishTaskFrameEvent(frame, 'task.foreground-settle');\n\t\t\tlet structuralError: unknown;\n\t\t\tlet structuralFailed = false;\n\t\t\ttry {\n\t\t\t\tawait settleTaskFrameChildren(frame);\n\t\t\t} catch (error) {\n\t\t\t\tstructuralError = error;\n\t\t\t\tstructuralFailed = true;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait runTaskFrameCleanups(frame);\n\t\t\t} catch (cleanupError) {\n\t\t\t\tif (!structuralFailed) throw cleanupError;\n\t\t\t\tif (structuralError && typeof structuralError === 'object')\n\t\t\t\t\tObject.defineProperty(structuralError, 'suppressed', {\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tvalue: [cleanupError]\n\t\t\t\t\t});\n\t\t\t}\n\t\t\tif (controller.signal.aborted) throw new TaskCancellation(controller.signal.reason);\n\t\t\tif (structuralFailed) throw structuralError;\n\t\t\treturn value;\n\t\t},\n\t\tasync (error) => {\n\t\t\tconst outcomeError =\n\t\t\t\tcontroller.signal.aborted && !(error instanceof TaskCancellation)\n\t\t\t\t\t? new TaskCancellation(controller.signal.reason)\n\t\t\t\t\t: error;\n\t\t\tframe.producerOpen = false;\n\t\t\tpublishTaskFrameEvent(frame, 'task.foreground-settle');\n\t\t\tcontroller.abort(error);\n\t\t\tlet childError: unknown;\n\t\t\tlet childFailed = false;\n\t\t\ttry {\n\t\t\t\tawait settleTaskFrameChildren(frame);\n\t\t\t} catch (error) {\n\t\t\t\tchildError = error;\n\t\t\t\tchildFailed = true;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait runTaskFrameCleanups(frame);\n\t\t\t} catch (cleanupError) {\n\t\t\t\tif (outcomeError && typeof outcomeError === 'object')\n\t\t\t\t\tObject.defineProperty(outcomeError, 'suppressed', {\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tvalue: [cleanupError]\n\t\t\t\t\t});\n\t\t\t}\n\t\t\tif (outcomeError === undefined && childFailed) throw childError;\n\t\t\tthrow outcomeError;\n\t\t}\n\t);\n\tconst output = result.then(\n\t\t(value) => {\n\t\t\tframe.settled = true;\n\t\t\treleaseTaskFrameSignal(controller.signal);\n\t\t\towner.frames.delete(frame);\n\t\t\tresolveSettlement();\n\t\t\tpublishTaskFrameEvent(frame, 'task.frame.exit');\n\t\t\tpublishTaskFrameEvent(frame, 'task.structural-settle');\n\t\t\tpublishTaskFrameEvent(frame, 'task.settle', undefined, {\n\t\t\t\tkind: 'outcome',\n\t\t\t\tstatus: 'settled',\n\t\t\t\tvalue\n\t\t\t});\n\t\t\treturn value;\n\t\t},\n\t\t(error) => {\n\t\t\tframe.settled = true;\n\t\t\treleaseTaskFrameSignal(controller.signal);\n\t\t\towner.frames.delete(frame);\n\t\t\tif (options.propagateFailure?.() === false) resolveSettlement();\n\t\t\telse rejectSettlement(error);\n\t\t\tpublishTaskFrameEvent(frame, 'task.frame.exit');\n\t\t\tconst cancelled = error instanceof TaskCancellation;\n\t\t\tpublishTaskFrameEvent(frame, cancelled ? 'task.cancel' : 'task.fail', error, {\n\t\t\t\tkind: 'outcome',\n\t\t\t\tstatus: cancelled ? 'cancelled' : 'failed',\n\t\t\t\tvalue: error\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t);\n\tif (synchronousError !== undefined) {\n\t\tsynchronousFrameErrors.set(output, { error: synchronousError });\n\t\t// Callers that preserve a synchronous host contract rethrow this error\n\t\t// immediately. The frame still settles asynchronously to release ownership.\n\t\tvoid output.catch(() => undefined);\n\t}\n\treturn output;\n}\n\n/** Returns an error thrown before a task frame's producer yielded to asynchronous work. */\nexport function taskFrameSynchronousError(\n\texecution: PromiseLike<unknown>\n): { readonly error: unknown } | undefined {\n\treturn execution instanceof Promise ? synchronousFrameErrors.get(execution) : undefined;\n}\n\n/** Adds a structural contribution to a frame before its producer closes. */\nexport function attachTaskFrameSettlement(\n\tframe: TaskFrameRecord,\n\tsettlement: PromiseLike<unknown>\n): void {\n\tif (frame.settled || !frame.producerOpen)\n\t\tthrow new Error('Cannot attach work after the task frame producer has closed');\n\tconst normalized = Promise.resolve(settlement).then(() => undefined);\n\t(frame.children ??= new Set()).add(normalized);\n\tvoid normalized.finally(() => frame.children?.delete(normalized)).catch(() => undefined);\n}\n\n/** Adds structural work to the synchronously active task frame, when present. */\nexport function joinTask(settlement: PromiseLike<unknown>): void {\n\tconst frame = currentTaskFrameRecord() ?? materializeDeferredTaskFrame();\n\tif (frame) attachTaskFrameSettlement(frame, settlement);\n}\n\n/** Publishes a task-owned mutation only while its generation remains current. */\nexport function taskMutation<Result>(signal: AbortSignal, mutation: () => Result): Result {\n\tif (signal.aborted) throw new TaskCancellation(signal.reason);\n\treturn mutation();\n}\n\n/** Restores the owning task frame around one compiler-lowered async continuation. */\nexport function resumeTaskFrame(signal: AbortSignal, resume: () => void): void {\n\tresumeTaskFrameContinuation(signal, resume, (frame) => {\n\t\tif (frame.settled) throw new Error('Cannot resume a settled task frame');\n\t\tconst previous = currentFrame;\n\t\tcurrentFrame = frame;\n\t\treturn () => {\n\t\t\tcurrentFrame = previous;\n\t\t};\n\t});\n}\n\nexport { frameForTaskContext };\nconst interactiveReactionContexts = new WeakMap<TaskFrameRecord, ScheduledWorkContext>();\nconst uninspectedSynchronousFrames = new WeakSet<TaskFrameRecord>();\n\nfunction linkAbort(signal: AbortSignal, target: AbortController): void {\n\tif (signal.aborted) {\n\t\ttarget.abort(signal.reason);\n\t\treturn;\n\t}\n\tsignal.addEventListener('abort', () => target.abort(signal.reason), { once: true });\n}\n\nfunction monotonicTimestamp(): number {\n\treturn globalThis.performance?.now() ?? Date.now();\n}\n\n/** Allocates one process-local frame identity for internal consequence frames. */\nexport function allocateTaskFrameId(): number {\n\treturn nextFrameId++;\n}\n\nfunction ensureScheduledWorkContextCapture(): void {\n\tif (scheduledWorkCaptureInstalled) return;\n\tscheduledWorkCaptureInstalled = true;\n\tsetScheduledWorkContextCapture((priority) => {\n\t\tconst parent = currentTaskFrameRecord();\n\t\tif (!parent || !parent.producerOpen || parent.settled) return undefined;\n\t\tif (priority === 'interactive' && uninspectedSynchronousFrames.has(parent))\n\t\t\treturn interactiveReactionContext(parent);\n\t\treturn acquireScheduledReactionBatch(parent);\n\t});\n}\n\n/** Reuses an open interaction producer for consequences drained inside the same DOM callback. */\nfunction interactiveReactionContext(parent: TaskFrameRecord): ScheduledWorkContext {\n\tlet context = interactiveReactionContexts.get(parent);\n\tif (context) return context;\n\tcontext = {\n\t\trun: (work) => withTaskFrameRecord(parent, work),\n\t\tcancel() {}\n\t};\n\tinteractiveReactionContexts.set(parent, context);\n\treturn context;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"frame-runtime.js","sourceRoot":"","sources":["../../../src/tasks/frame-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,8BAA8B,EAE9B,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EACN,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EACN,qBAAqB,EACrB,2BAA2B,EAC3B,MAAM,kCAAkC,CAAC;A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AC;QAC3C,OAAO,6BAA6B,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,iGAAiG;AACjG,SAAS,0BAA0B,CAAC,MAAuB;IAC1D,IAAI,OAAO,GAAG,2BAA2B,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtD,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAC5B,OAAO,GAAG;QACT,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC;QAChD,MAAM,KAAI,CAAC;KACX,CAAC;IACF,2BAA2B,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjD,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["import {\n\tsetScheduledWorkContextCapture,\n\ttype ScheduledWorkContext\n} from '@exactjs/reactive/framework/runtime';\nimport type { TaskContext, TaskOwner } from './contracts.js';\nimport { raceTaskCancellation, TaskCancellation } from './cancellation.js';\nimport {\n\tregisterTaskFrameSignal,\n\treleaseTaskFrameSignal,\n\tresumeTaskFrameContinuation\n} from './frame-continuation.js';\nimport { createTaskFrameContext, frameForTaskContext } from './frame-context.js';\nimport {\n\tpublishTaskFrameEvent,\n\ttaskFrameInspectionAttached\n} from './frame-inspection-capability.js';\nimport {\n\tregisterTaskFrameSettlement,\n\trunTaskFrameCleanups,\n\tsettleTaskFrameChildren\n} from './frame-settlement.js';\nimport { createLazyTaskOwnerRecord } from './owner-record.js';\nimport { acquireScheduledReactionBatch } from './scheduled-reactions.js';\n\nimport {\n\ttaskFrameTokenBrand,\n\ttaskOwnerBrand,\n\ttype InternalTaskFrameOptions,\n\ttype TaskFrameCleanup,\n\ttype TaskFrameRecord,\n\ttype TaskOwnerRecord\n} from './frame-contracts.js';\nexport type {\n\tInternalTaskFrameOptions,\n\tTaskActivationRegistration,\n\tTaskFrameRecord,\n\tTaskOwnerRecord\n} from './frame-contracts.js';\nlet nextFrameId = 1;\nlet currentFrame: TaskFrameRecord | undefined;\nlet currentOwner: TaskOwnerRecord | undefined;\nlet deferredFrameMaterializer: (() => TaskFrameRecord) | undefined;\nlet scheduledWorkCaptureInstalled = false;\nconst synchronousFrameErrors = new WeakMap<Promise<unknown>, { readonly error: unknown }>();\n\n/** Creates a durable task owner and its cancellation lifetime. */\nexport function createTaskOwnerRecord(label?: string): TaskOwnerRecord {\n\treturn createLazyTaskOwnerRecord(label);\n}\n\n/** Retains setup-owned cleanup until its durable task owner is disposed. */\nexport function registerTaskOwnerCleanup(owner: TaskOwnerRecord, cleanup: TaskFrameCleanup): void {\n\tif (owner.disposed) throw new Error('Task owner has been disposed');\n\towner.ownerCleanups.add(cleanup);\n}\n\n/** Validates and returns the internal representation of a public owner. */\nexport function taskOwnerRecord(owner: TaskOwner): TaskOwnerRecord {\n\tif (!(taskOwnerBrand in owner)) throw new TypeError('Task owner was not created by eXact');\n\treturn owner as TaskOwnerRecord;\n}\n\n/** Returns the frame active for the current synchronous execution segment. */\nexport function currentTaskFrameRecord(): TaskFrameRecord | undefined {\n\treturn currentFrame;\n}\n\n/** Materializes an interaction frame only when synchronous work requests structural ownership. */\nexport function materializeDeferredTaskFrame(): TaskFrameRecord | undefined {\n\treturn deferredFrameMaterializer?.();\n}\n\n/** Installs the lazy structural parent available to task and navigation operations during work. */\nexport function withDeferredTaskFrame<T>(materialize: () => TaskFrameRecord, work: () => T): T {\n\tconst previous = deferredFrameMaterializer;\n\tdeferredFrameMaterializer = materialize;\n\ttry {\n\t\treturn work();\n\t} finally {\n\t\tdeferredFrameMaterializer = previous;\n\t}\n}\n\n/** Returns the durable owner supplied by the current framework host. */\nexport function currentTaskOwnerRecord(): TaskOwnerRecord | undefined {\n\treturn currentFrame?.owner ?? currentOwner;\n}\n\n/** Establishes a durable host owner during component state-machine construction or adapter setup. */\nexport function withTaskOwnerRecord<T>(owner: TaskOwnerRecord, work: () => T): T {\n\tconst previous = currentOwner;\n\tcurrentOwner = owner;\n\ttry {\n\t\treturn work();\n\t} finally {\n\t\tcurrentOwner = previous;\n\t}\n}\n\n/** Runs a synchronous segment with the supplied frame, or clears ambient frame ownership. */\nexport function withTaskFrameRecord<T>(frame: TaskFrameRecord | undefined, work: () => T): T {\n\tif (frame?.settled) throw new Error('Cannot resume a settled task frame');\n\tensureScheduledWorkContextCapture();\n\tconst previous = currentFrame;\n\tconst previousMaterializer = deferredFrameMaterializer;\n\tcurrentFrame = frame;\n\tif (!frame) deferredFrameMaterializer = undefined;\n\ttry {\n\t\treturn work();\n\t} finally {\n\t\tcurrentFrame = previous;\n\t\tdeferredFrameMaterializer = previousMaterializer;\n\t}\n}\n\n/**\n * Runs work in a frame, then waits for dynamically attached descendants and\n * executes cleanup in last-in-first-out order.\n */\nexport function executeTaskFrame<T>(\n\toptions: InternalTaskFrameOptions,\n\twork: (context: TaskContext) => T | PromiseLike<T>\n): Promise<T> {\n\tconst structuralParent = options.detached ? undefined : (options.parent ?? currentFrame);\n\tif (\n\t\tstructuralParent &&\n\t\t!options.parentReserved &&\n\t\t(!structuralParent.producerOpen || structuralParent.settled)\n\t)\n\t\treturn Promise.reject(\n\t\t\tnew Error('Cannot attach work after the parent task producer has closed')\n\t\t);\n\tconst owner =\n\t\toptions.owner ?? structuralParent?.owner ?? createTaskOwnerRecord('implicit task invocation');\n\tif (owner.disposed) {\n\t\toptions.controller?.abort('task-owner-disposed');\n\t\treturn Promise.reject(\n\t\t\tnew TaskCancellation(options.controller?.signal.reason ?? 'task-owner-disposed')\n\t\t);\n\t}\n\tconst controller = options.controller ?? new AbortController();\n\t// The owner cancels its active frame controllers directly during disposal. Subscribing every\n\t// frame to its durable signal would retain settled controllers until the owner itself is released.\n\tif (structuralParent) linkAbort(structuralParent.controller.signal, controller);\n\n\tlet resolveSettlement!: () => void;\n\tlet rejectSettlement!: (error: unknown) => void;\n\tconst settlement = new Promise<void>((resolve, reject) => {\n\t\tresolveSettlement = resolve;\n\t\trejectSettlement = reject;\n\t});\n\tconst frame: TaskFrameRecord = {\n\t\t[taskFrameTokenBrand]: true as const,\n\t\tid: nextFrameId++,\n\t\towner,\n\t\tparent: structuralParent,\n\t\tcontroller,\n\t\t...(options.label === undefined ? {} : { label: options.label }),\n\t\t...(options.sourceEntityId === undefined ? {} : { sourceEntityId: options.sourceEntityId }),\n\t\tactivation: options.activation ?? 'invoked',\n\t\tgeneration: options.generation ?? 1,\n\t\tplacement: options.placement ?? 'current',\n\t\tconcurrency: options.concurrency ?? 'parallel',\n\t\tpriority: options.priority ?? structuralParent?.priority ?? 'normal',\n\t\treadiness:\n\t\t\toptions.readiness ??\n\t\t\t(options.priority === 'deferred'\n\t\t\t\t? 'nonblocking'\n\t\t\t\t: (structuralParent?.readiness ?? 'blocking')),\n\t\tkind: options.kind ?? 'task',\n\t\tproducerOpen: true,\n\t\tsettled: false,\n\t\tstartedAt: monotonicTimestamp()\n\t};\n\tif (options.publicContext !== false)\n\t\t(frame as { context: TaskContext }).context = createTaskFrameContext(frame, options);\n\tregisterTaskFrameSignal(controller.signal, frame);\n\tregisterTaskFrameSettlement(frame, settlement);\n\towner.frames.add(frame);\n\tconst inspectedAtStart = taskFrameInspectionAttached(frame);\n\tif (inspectedAtStart) {\n\t\tpublishTaskFrameEvent(frame, 'task.frame.enter');\n\t\tpublishTaskFrameEvent(frame, 'task.start', undefined, {\n\t\t\tkind: 'start',\n\t\t\targuments: options.inspectionArguments\n\t\t});\n\t} else uninspectedSynchronousFrames.add(frame);\n\tif (structuralParent) {\n\t\t(structuralParent.children ??= new Set()).add(settlement);\n\t\tvoid settlement\n\t\t\t.finally(() => structuralParent.children?.delete(settlement))\n\t\t\t.catch(() => undefined);\n\t} else {\n\t\t// Root settlement is observed through executeTaskFrame's returned\n\t\t// promise; the internal structural signal has no parent consumer.\n\t\tvoid settlement.catch(() => undefined);\n\t}\n\n\tlet directResult: T | PromiseLike<T>;\n\tlet synchronousError: unknown;\n\ttry {\n\t\tif (controller.signal.aborted) throw new TaskCancellation(controller.signal.reason);\n\t\tdirectResult = withTaskFrameRecord(frame, () => work(frame.context!));\n\t} catch (error) {\n\t\tsynchronousError = error;\n\t\tdirectResult = Promise.reject(error);\n\t} finally {\n\t\tuninspectedSynchronousFrames.delete(frame);\n\t}\n\tconst execution = raceTaskCancellation(controller.signal, directResult);\n\n\tconst result = execution.then(\n\t\tasync (value) => {\n\t\t\tframe.producerOpen = false;\n\t\t\tpublishTaskFrameEvent(frame, 'task.foreground-settle');\n\t\t\tlet structuralError: unknown;\n\t\t\tlet structuralFailed = false;\n\t\t\ttry {\n\t\t\t\tawait settleTaskFrameChildren(frame);\n\t\t\t} catch (error) {\n\t\t\t\tstructuralError = error;\n\t\t\t\tstructuralFailed = true;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait runTaskFrameCleanups(frame);\n\t\t\t} catch (cleanupError) {\n\t\t\t\tif (!structuralFailed) throw cleanupError;\n\t\t\t\tif (structuralError && typeof structuralError === 'object')\n\t\t\t\t\tObject.defineProperty(structuralError, 'suppressed', {\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tvalue: [cleanupError]\n\t\t\t\t\t});\n\t\t\t}\n\t\t\tif (controller.signal.aborted) throw new TaskCancellation(controller.signal.reason);\n\t\t\tif (structuralFailed) throw structuralError;\n\t\t\treturn value;\n\t\t},\n\t\tasync (error) => {\n\t\t\tconst outcomeError =\n\t\t\t\tcontroller.signal.aborted && !(error instanceof TaskCancellation)\n\t\t\t\t\t? new TaskCancellation(controller.signal.reason)\n\t\t\t\t\t: error;\n\t\t\tframe.producerOpen = false;\n\t\t\tpublishTaskFrameEvent(frame, 'task.foreground-settle');\n\t\t\tcontroller.abort(error);\n\t\t\tlet childError: unknown;\n\t\t\tlet childFailed = false;\n\t\t\ttry {\n\t\t\t\tawait settleTaskFrameChildren(frame);\n\t\t\t} catch (error) {\n\t\t\t\tchildError = error;\n\t\t\t\tchildFailed = true;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait runTaskFrameCleanups(frame);\n\t\t\t} catch (cleanupError) {\n\t\t\t\tif (outcomeError && typeof outcomeError === 'object')\n\t\t\t\t\tObject.defineProperty(outcomeError, 'suppressed', {\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tvalue: [cleanupError]\n\t\t\t\t\t});\n\t\t\t}\n\t\t\tif (outcomeError === undefined && childFailed) throw childError;\n\t\t\tthrow outcomeError;\n\t\t}\n\t);\n\tconst output = result.then(\n\t\t(value) => {\n\t\t\tframe.settled = true;\n\t\t\treleaseTaskFrameSignal(controller.signal);\n\t\t\towner.frames.delete(frame);\n\t\t\tresolveSettlement();\n\t\t\tpublishTaskFrameEvent(frame, 'task.frame.exit');\n\t\t\tpublishTaskFrameEvent(frame, 'task.structural-settle');\n\t\t\tpublishTaskFrameEvent(frame, 'task.settle', undefined, {\n\t\t\t\tkind: 'outcome',\n\t\t\t\tstatus: 'settled',\n\t\t\t\tvalue\n\t\t\t});\n\t\t\treturn value;\n\t\t},\n\t\t(error) => {\n\t\t\tframe.settled = true;\n\t\t\treleaseTaskFrameSignal(controller.signal);\n\t\t\towner.frames.delete(frame);\n\t\t\tif (options.propagateFailure?.() === false) resolveSettlement();\n\t\t\telse rejectSettlement(error);\n\t\t\tpublishTaskFrameEvent(frame, 'task.frame.exit');\n\t\t\tconst cancelled = error instanceof TaskCancellation;\n\t\t\tpublishTaskFrameEvent(frame, cancelled ? 'task.cancel' : 'task.fail', error, {\n\t\t\t\tkind: 'outcome',\n\t\t\t\tstatus: cancelled ? 'cancelled' : 'failed',\n\t\t\t\tvalue: error\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t);\n\tif (synchronousError !== undefined) {\n\t\tsynchronousFrameErrors.set(output, { error: synchronousError });\n\t\t// Callers that preserve a synchronous host contract rethrow this error\n\t\t// immediately. The frame still settles asynchronously to release ownership.\n\t\tvoid output.catch(() => undefined);\n\t}\n\treturn output;\n}\n\n/** Returns an error thrown before a task frame's producer yielded to asynchronous work. */\nexport function taskFrameSynchronousError(\n\texecution: PromiseLike<unknown>\n): { readonly error: unknown } | undefined {\n\treturn execution instanceof Promise ? synchronousFrameErrors.get(execution) : undefined;\n}\n\n/** Adds a structural contribution to a frame before its producer closes. */\nexport function attachTaskFrameSettlement(\n\tframe: TaskFrameRecord,\n\tsettlement: PromiseLike<unknown>\n): void {\n\tif (frame.settled || !frame.producerOpen)\n\t\tthrow new Error('Cannot attach work after the task frame producer has closed');\n\tconst normalized = Promise.resolve(settlement).then(() => undefined);\n\t(frame.children ??= new Set()).add(normalized);\n\tvoid normalized.finally(() => frame.children?.delete(normalized)).catch(() => undefined);\n}\n\n/** Adds structural work to the synchronously active task frame, when present. */\nexport function joinTask(settlement: PromiseLike<unknown>): void {\n\tconst frame = currentTaskFrameRecord() ?? materializeDeferredTaskFrame();\n\tif (frame) attachTaskFrameSettlement(frame, settlement);\n}\n\n/** Publishes a task-owned mutation only while its generation remains current. */\nexport function taskMutation<Result>(signal: AbortSignal, mutation: () => Result): Result {\n\tif (signal.aborted) throw new TaskCancellation(signal.reason);\n\treturn mutation();\n}\n\n/** Restores the owning task frame around one compiler-lowered async continuation. */\nexport function resumeTaskFrame(signal: AbortSignal, resume: () => void): void {\n\tresumeTaskFrameContinuation(signal, resume, (frame) => {\n\t\tconst previous = currentFrame;\n\t\tconst previousMaterializer = deferredFrameMaterializer;\n\t\tcurrentFrame = frame;\n\t\tif (!frame) deferredFrameMaterializer = undefined;\n\t\treturn () => {\n\t\t\tcurrentFrame = previous;\n\t\t\tdeferredFrameMaterializer = previousMaterializer;\n\t\t};\n\t});\n}\n\nexport { frameForTaskContext };\nconst interactiveReactionContexts = new WeakMap<TaskFrameRecord, ScheduledWorkContext>();\nconst uninspectedSynchronousFrames = new WeakSet<TaskFrameRecord>();\n\nfunction linkAbort(signal: AbortSignal, target: AbortController): void {\n\tif (signal.aborted) {\n\t\ttarget.abort(signal.reason);\n\t\treturn;\n\t}\n\tsignal.addEventListener('abort', () => target.abort(signal.reason), { once: true });\n}\n\nfunction monotonicTimestamp(): number {\n\treturn globalThis.performance?.now() ?? Date.now();\n}\n\n/** Allocates one process-local frame identity for internal consequence frames. */\nexport function allocateTaskFrameId(): number {\n\treturn nextFrameId++;\n}\n\nfunction ensureScheduledWorkContextCapture(): void {\n\tif (scheduledWorkCaptureInstalled) return;\n\tscheduledWorkCaptureInstalled = true;\n\tsetScheduledWorkContextCapture((priority) => {\n\t\tconst parent = currentTaskFrameRecord();\n\t\tif (!parent || !parent.producerOpen || parent.settled) return undefined;\n\t\tif (priority === 'interactive' && uninspectedSynchronousFrames.has(parent))\n\t\t\treturn interactiveReactionContext(parent);\n\t\treturn acquireScheduledReactionBatch(parent);\n\t});\n}\n\n/** Reuses an open interaction producer for consequences drained inside the same DOM callback. */\nfunction interactiveReactionContext(parent: TaskFrameRecord): ScheduledWorkContext {\n\tlet context = interactiveReactionContexts.get(parent);\n\tif (context) return context;\n\tcontext = {\n\t\trun: (work) => withTaskFrameRecord(parent, work),\n\t\tcancel() {}\n\t};\n\tinteractiveReactionContexts.set(parent, context);\n\treturn context;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/tasks/resources.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACX,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAUzE,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAErF;AAKD,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CASjF;AAED,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAO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AAC,EAC1B,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,EAC9D,KAAK,EAAE,OAAO,EACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,CAAC,CAiBH;AAID;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CA4CvF"}
|
|
@@ -302,8 +302,11 @@ function ignoreSettlement() { }
|
|
|
302
302
|
* remains parked until the scope resumes, and cancellation can still reject during that wait.
|
|
303
303
|
*/
|
|
304
304
|
export function taskAwait(signal, value) {
|
|
305
|
-
if (signal.aborted)
|
|
305
|
+
if (signal.aborted) {
|
|
306
|
+
// The source expression has already executed and still owns a possible rejection.
|
|
307
|
+
void Promise.resolve(value).catch(ignoreSettlement);
|
|
306
308
|
return Promise.reject(new TaskCancellation(signal.reason));
|
|
309
|
+
}
|
|
307
310
|
return new Promise((resolve, reject) => {
|
|
308
311
|
let settled = false;
|
|
309
312
|
let releaseWaiter;
|
|
@@ -334,10 +337,10 @@ export function taskAwait(signal, value) {
|
|
|
334
337
|
if (settled)
|
|
335
338
|
return;
|
|
336
339
|
const owner = taskOwners.get(signal);
|
|
337
|
-
if (owner?.scope.paused) {
|
|
340
|
+
if (owner?.scope.active && owner.scope.paused) {
|
|
338
341
|
releaseWaiter = scheduleEffectScopeResume(owner.scope, () => {
|
|
339
342
|
releaseWaiter = undefined;
|
|
340
|
-
|
|
343
|
+
continueTask(result, failed);
|
|
341
344
|
});
|
|
342
345
|
return;
|
|
343
346
|
}
|