@earendil-works/chord 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +79 -14
- package/dist/cell.d.ts +7 -7
- package/dist/cell.d.ts.map +1 -1
- package/dist/cell.js.map +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/contract.d.ts +51 -52
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +19 -24
- package/dist/contract.js.map +1 -1
- package/dist/delta/apply-immutable-trusted.js +3 -4
- package/dist/delta/apply-immutable-trusted.js.map +1 -1
- package/dist/delta/diff.d.ts.map +1 -1
- package/dist/delta/diff.js +5 -3
- package/dist/delta/diff.js.map +1 -1
- package/dist/delta/index.d.ts +9 -1
- package/dist/delta/index.d.ts.map +1 -1
- package/dist/delta/index.js +15 -11
- package/dist/delta/index.js.map +1 -1
- package/dist/delta/pending.d.ts +36 -0
- package/dist/delta/pending.d.ts.map +1 -0
- package/dist/delta/pending.js +143 -0
- package/dist/delta/pending.js.map +1 -0
- package/dist/delta/tracker.d.ts +12 -0
- package/dist/delta/tracker.d.ts.map +1 -1
- package/dist/delta/tracker.js +109 -39
- package/dist/delta/tracker.js.map +1 -1
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +9 -7
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/next/contracts/accepts.d.ts +81 -0
- package/dist/next/contracts/accepts.d.ts.map +1 -0
- package/dist/next/contracts/accepts.js +123 -0
- package/dist/next/contracts/accepts.js.map +1 -0
- package/dist/next/contracts/contract.d.ts +121 -0
- package/dist/next/contracts/contract.d.ts.map +1 -0
- package/dist/next/contracts/contract.js +50 -0
- package/dist/next/contracts/contract.js.map +1 -0
- package/dist/next/contracts/declare.d.ts +107 -0
- package/dist/next/contracts/declare.d.ts.map +1 -0
- package/dist/next/contracts/declare.js +136 -0
- package/dist/next/contracts/declare.js.map +1 -0
- package/dist/next/contracts/evolve.d.ts +92 -0
- package/dist/next/contracts/evolve.d.ts.map +1 -0
- package/dist/next/contracts/evolve.js +179 -0
- package/dist/next/contracts/evolve.js.map +1 -0
- package/dist/next/contracts/fingerprint.d.ts +16 -0
- package/dist/next/contracts/fingerprint.d.ts.map +1 -0
- package/dist/next/contracts/fingerprint.js +50 -0
- package/dist/next/contracts/fingerprint.js.map +1 -0
- package/dist/next/contracts/history.d.ts +71 -0
- package/dist/next/contracts/history.d.ts.map +1 -0
- package/dist/next/contracts/history.js +3 -0
- package/dist/next/contracts/history.js.map +1 -0
- package/dist/next/contracts/host-kind.d.ts +40 -0
- package/dist/next/contracts/host-kind.d.ts.map +1 -0
- package/dist/next/contracts/host-kind.js +37 -0
- package/dist/next/contracts/host-kind.js.map +1 -0
- package/dist/next/contracts/index.d.ts +7 -0
- package/dist/next/contracts/index.d.ts.map +1 -0
- package/dist/next/contracts/index.js +6 -0
- package/dist/next/contracts/index.js.map +1 -0
- package/dist/next/contracts/internal.d.ts +10 -0
- package/dist/next/contracts/internal.d.ts.map +1 -0
- package/dist/next/contracts/internal.js +9 -0
- package/dist/next/contracts/internal.js.map +1 -0
- package/dist/next/contracts/names.d.ts +3 -0
- package/dist/next/contracts/names.d.ts.map +1 -0
- package/dist/next/contracts/names.js +13 -0
- package/dist/next/contracts/names.js.map +1 -0
- package/dist/next/contracts/params.d.ts +28 -0
- package/dist/next/contracts/params.d.ts.map +1 -0
- package/dist/next/contracts/params.js +50 -0
- package/dist/next/contracts/params.js.map +1 -0
- package/dist/next/contracts/schema.d.ts +102 -0
- package/dist/next/contracts/schema.d.ts.map +1 -0
- package/dist/next/contracts/schema.js +103 -0
- package/dist/next/contracts/schema.js.map +1 -0
- package/dist/next/contracts/snapshot.d.ts +16 -0
- package/dist/next/contracts/snapshot.d.ts.map +1 -0
- package/dist/next/contracts/snapshot.js +167 -0
- package/dist/next/contracts/snapshot.js.map +1 -0
- package/dist/next/data/args.d.ts +50 -0
- package/dist/next/data/args.d.ts.map +1 -0
- package/dist/next/data/args.js +83 -0
- package/dist/next/data/args.js.map +1 -0
- package/dist/next/data/errors.d.ts +73 -0
- package/dist/next/data/errors.d.ts.map +1 -0
- package/dist/next/data/errors.js +107 -0
- package/dist/next/data/errors.js.map +1 -0
- package/dist/next/data/failure.d.ts +26 -0
- package/dist/next/data/failure.d.ts.map +1 -0
- package/dist/next/data/failure.js +72 -0
- package/dist/next/data/failure.js.map +1 -0
- package/dist/next/data/index.d.ts +4 -0
- package/dist/next/data/index.d.ts.map +1 -0
- package/dist/next/data/index.js +4 -0
- package/dist/next/data/index.js.map +1 -0
- package/dist/next/data/internal.d.ts +7 -0
- package/dist/next/data/internal.d.ts.map +1 -0
- package/dist/next/data/internal.js +8 -0
- package/dist/next/data/internal.js.map +1 -0
- package/dist/next/data/params.d.ts +20 -0
- package/dist/next/data/params.d.ts.map +1 -0
- package/dist/next/data/params.js +31 -0
- package/dist/next/data/params.js.map +1 -0
- package/dist/next/data/principal.d.ts +17 -0
- package/dist/next/data/principal.d.ts.map +1 -0
- package/dist/next/data/principal.js +41 -0
- package/dist/next/data/principal.js.map +1 -0
- package/dist/next/data/validator.d.ts +12 -0
- package/dist/next/data/validator.d.ts.map +1 -0
- package/dist/next/data/validator.js +34 -0
- package/dist/next/data/validator.js.map +1 -0
- package/dist/next/documents/address-source.d.ts +20 -0
- package/dist/next/documents/address-source.d.ts.map +1 -0
- package/dist/next/documents/address-source.js +44 -0
- package/dist/next/documents/address-source.js.map +1 -0
- package/dist/next/documents/definition.d.ts +84 -0
- package/dist/next/documents/definition.d.ts.map +1 -0
- package/dist/next/documents/definition.js +73 -0
- package/dist/next/documents/definition.js.map +1 -0
- package/dist/next/documents/documents.d.ts +106 -0
- package/dist/next/documents/documents.d.ts.map +1 -0
- package/dist/next/documents/documents.js +224 -0
- package/dist/next/documents/documents.js.map +1 -0
- package/dist/next/documents/fence.d.ts +9 -0
- package/dist/next/documents/fence.d.ts.map +1 -0
- package/dist/next/documents/fence.js +15 -0
- package/dist/next/documents/fence.js.map +1 -0
- package/dist/next/documents/handles.d.ts +76 -0
- package/dist/next/documents/handles.d.ts.map +1 -0
- package/dist/next/documents/handles.js +66 -0
- package/dist/next/documents/handles.js.map +1 -0
- package/dist/next/documents/index.d.ts +4 -0
- package/dist/next/documents/index.d.ts.map +1 -0
- package/dist/next/documents/index.js +3 -0
- package/dist/next/documents/index.js.map +1 -0
- package/dist/next/documents/internal.d.ts +9 -0
- package/dist/next/documents/internal.d.ts.map +1 -0
- package/dist/next/documents/internal.js +9 -0
- package/dist/next/documents/internal.js.map +1 -0
- package/dist/next/documents/keyed-slot.d.ts +103 -0
- package/dist/next/documents/keyed-slot.d.ts.map +1 -0
- package/dist/next/documents/keyed-slot.js +395 -0
- package/dist/next/documents/keyed-slot.js.map +1 -0
- package/dist/next/documents/line.d.ts +7 -0
- package/dist/next/documents/line.d.ts.map +1 -0
- package/dist/next/documents/line.js +14 -0
- package/dist/next/documents/line.js.map +1 -0
- package/dist/next/documents/persistence.d.ts +104 -0
- package/dist/next/documents/persistence.d.ts.map +1 -0
- package/dist/next/documents/persistence.js +128 -0
- package/dist/next/documents/persistence.js.map +1 -0
- package/dist/next/documents/residency.d.ts +31 -0
- package/dist/next/documents/residency.d.ts.map +1 -0
- package/dist/next/documents/residency.js +93 -0
- package/dist/next/documents/residency.js.map +1 -0
- package/dist/next/documents/slot.d.ts +109 -0
- package/dist/next/documents/slot.d.ts.map +1 -0
- package/dist/next/documents/slot.js +181 -0
- package/dist/next/documents/slot.js.map +1 -0
- package/dist/next/documents/transaction.d.ts +133 -0
- package/dist/next/documents/transaction.d.ts.map +1 -0
- package/dist/next/documents/transaction.js +409 -0
- package/dist/next/documents/transaction.js.map +1 -0
- package/dist/next/host/activity.d.ts +31 -0
- package/dist/next/host/activity.d.ts.map +1 -0
- package/dist/next/host/activity.js +40 -0
- package/dist/next/host/activity.js.map +1 -0
- package/dist/next/host/adapted.d.ts +49 -0
- package/dist/next/host/adapted.d.ts.map +1 -0
- package/dist/next/host/adapted.js +214 -0
- package/dist/next/host/adapted.js.map +1 -0
- package/dist/next/host/attempt.d.ts +278 -0
- package/dist/next/host/attempt.d.ts.map +1 -0
- package/dist/next/host/attempt.js +1072 -0
- package/dist/next/host/attempt.js.map +1 -0
- package/dist/next/host/backoff.d.ts +29 -0
- package/dist/next/host/backoff.d.ts.map +1 -0
- package/dist/next/host/backoff.js +69 -0
- package/dist/next/host/backoff.js.map +1 -0
- package/dist/next/host/ctx.d.ts +47 -0
- package/dist/next/host/ctx.d.ts.map +1 -0
- package/dist/next/host/ctx.js +108 -0
- package/dist/next/host/ctx.js.map +1 -0
- package/dist/next/host/deadline.d.ts +12 -0
- package/dist/next/host/deadline.d.ts.map +1 -0
- package/dist/next/host/deadline.js +40 -0
- package/dist/next/host/deadline.js.map +1 -0
- package/dist/next/host/dependencies.d.ts +65 -0
- package/dist/next/host/dependencies.d.ts.map +1 -0
- package/dist/next/host/dependencies.js +115 -0
- package/dist/next/host/dependencies.js.map +1 -0
- package/dist/next/host/destination.d.ts +48 -0
- package/dist/next/host/destination.d.ts.map +1 -0
- package/dist/next/host/destination.js +101 -0
- package/dist/next/host/destination.js.map +1 -0
- package/dist/next/host/facet.d.ts +79 -0
- package/dist/next/host/facet.d.ts.map +1 -0
- package/dist/next/host/facet.js +55 -0
- package/dist/next/host/facet.js.map +1 -0
- package/dist/next/host/follow.d.ts +52 -0
- package/dist/next/host/follow.d.ts.map +1 -0
- package/dist/next/host/follow.js +207 -0
- package/dist/next/host/follow.js.map +1 -0
- package/dist/next/host/host.d.ts +495 -0
- package/dist/next/host/host.d.ts.map +1 -0
- package/dist/next/host/host.js +1075 -0
- package/dist/next/host/host.js.map +1 -0
- package/dist/next/host/index.d.ts +17 -0
- package/dist/next/host/index.d.ts.map +1 -0
- package/dist/next/host/index.js +6 -0
- package/dist/next/host/index.js.map +1 -0
- package/dist/next/host/internal.d.ts +10 -0
- package/dist/next/host/internal.d.ts.map +1 -0
- package/dist/next/host/internal.js +8 -0
- package/dist/next/host/internal.js.map +1 -0
- package/dist/next/host/members.d.ts +50 -0
- package/dist/next/host/members.d.ts.map +1 -0
- package/dist/next/host/members.js +107 -0
- package/dist/next/host/members.js.map +1 -0
- package/dist/next/host/native.d.ts +55 -0
- package/dist/next/host/native.d.ts.map +1 -0
- package/dist/next/host/native.js +92 -0
- package/dist/next/host/native.js.map +1 -0
- package/dist/next/host/object.d.ts +290 -0
- package/dist/next/host/object.d.ts.map +1 -0
- package/dist/next/host/object.js +1127 -0
- package/dist/next/host/object.js.map +1 -0
- package/dist/next/host/parked.d.ts +23 -0
- package/dist/next/host/parked.d.ts.map +1 -0
- package/dist/next/host/parked.js +79 -0
- package/dist/next/host/parked.js.map +1 -0
- package/dist/next/host/presence.d.ts +34 -0
- package/dist/next/host/presence.d.ts.map +1 -0
- package/dist/next/host/presence.js +117 -0
- package/dist/next/host/presence.js.map +1 -0
- package/dist/next/host/ref-state.d.ts +53 -0
- package/dist/next/host/ref-state.d.ts.map +1 -0
- package/dist/next/host/ref-state.js +83 -0
- package/dist/next/host/ref-state.js.map +1 -0
- package/dist/next/host/reference-keys.d.ts +36 -0
- package/dist/next/host/reference-keys.d.ts.map +1 -0
- package/dist/next/host/reference-keys.js +168 -0
- package/dist/next/host/reference-keys.js.map +1 -0
- package/dist/next/host/reference-source.d.ts +65 -0
- package/dist/next/host/reference-source.d.ts.map +1 -0
- package/dist/next/host/reference-source.js +285 -0
- package/dist/next/host/reference-source.js.map +1 -0
- package/dist/next/host/reference.d.ts +308 -0
- package/dist/next/host/reference.d.ts.map +1 -0
- package/dist/next/host/reference.js +775 -0
- package/dist/next/host/reference.js.map +1 -0
- package/dist/next/host/retry-on.d.ts +28 -0
- package/dist/next/host/retry-on.d.ts.map +1 -0
- package/dist/next/host/retry-on.js +52 -0
- package/dist/next/host/retry-on.js.map +1 -0
- package/dist/next/host/revocation.d.ts +16 -0
- package/dist/next/host/revocation.d.ts.map +1 -0
- package/dist/next/host/revocation.js +27 -0
- package/dist/next/host/revocation.js.map +1 -0
- package/dist/next/host/root.d.ts +27 -0
- package/dist/next/host/root.d.ts.map +1 -0
- package/dist/next/host/root.js +68 -0
- package/dist/next/host/root.js.map +1 -0
- package/dist/next/host/route.d.ts +64 -0
- package/dist/next/host/route.d.ts.map +1 -0
- package/dist/next/host/route.js +190 -0
- package/dist/next/host/route.js.map +1 -0
- package/dist/next/host/routines.d.ts +76 -0
- package/dist/next/host/routines.d.ts.map +1 -0
- package/dist/next/host/routines.js +350 -0
- package/dist/next/host/routines.js.map +1 -0
- package/dist/next/host/sleep.d.ts +9 -0
- package/dist/next/host/sleep.d.ts.map +1 -0
- package/dist/next/host/sleep.js +40 -0
- package/dist/next/host/sleep.js.map +1 -0
- package/dist/next/host/staging.d.ts +94 -0
- package/dist/next/host/staging.d.ts.map +1 -0
- package/dist/next/host/staging.js +302 -0
- package/dist/next/host/staging.js.map +1 -0
- package/dist/next/host/unbound.d.ts +30 -0
- package/dist/next/host/unbound.d.ts.map +1 -0
- package/dist/next/host/unbound.js +67 -0
- package/dist/next/host/unbound.js.map +1 -0
- package/dist/next/host/uuid.d.ts +3 -0
- package/dist/next/host/uuid.d.ts.map +1 -0
- package/dist/next/host/uuid.js +38 -0
- package/dist/next/host/uuid.js.map +1 -0
- package/dist/next/index.d.ts +28 -0
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +18 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/jobs/definition.d.ts +96 -0
- package/dist/next/jobs/definition.d.ts.map +1 -0
- package/dist/next/jobs/definition.js +83 -0
- package/dist/next/jobs/definition.js.map +1 -0
- package/dist/next/jobs/index.d.ts +5 -0
- package/dist/next/jobs/index.d.ts.map +1 -0
- package/dist/next/jobs/index.js +3 -0
- package/dist/next/jobs/index.js.map +1 -0
- package/dist/next/jobs/internal.d.ts +3 -0
- package/dist/next/jobs/internal.d.ts.map +1 -0
- package/dist/next/jobs/internal.js +4 -0
- package/dist/next/jobs/internal.js.map +1 -0
- package/dist/next/jobs/job.d.ts +152 -0
- package/dist/next/jobs/job.d.ts.map +1 -0
- package/dist/next/jobs/job.js +320 -0
- package/dist/next/jobs/job.js.map +1 -0
- package/dist/next/jobs/persisted.d.ts +38 -0
- package/dist/next/jobs/persisted.d.ts.map +1 -0
- package/dist/next/jobs/persisted.js +95 -0
- package/dist/next/jobs/persisted.js.map +1 -0
- package/dist/next/jobs/records.d.ts +231 -0
- package/dist/next/jobs/records.d.ts.map +1 -0
- package/dist/next/jobs/records.js +869 -0
- package/dist/next/jobs/records.js.map +1 -0
- package/dist/next/jobs/run-states.d.ts +69 -0
- package/dist/next/jobs/run-states.d.ts.map +1 -0
- package/dist/next/jobs/run-states.js +228 -0
- package/dist/next/jobs/run-states.js.map +1 -0
- package/dist/next/jobs/run.d.ts +113 -0
- package/dist/next/jobs/run.d.ts.map +1 -0
- package/dist/next/jobs/run.js +200 -0
- package/dist/next/jobs/run.js.map +1 -0
- package/dist/next/jobs/running.d.ts +44 -0
- package/dist/next/jobs/running.d.ts.map +1 -0
- package/dist/next/jobs/running.js +117 -0
- package/dist/next/jobs/running.js.map +1 -0
- package/dist/next/jobs/stored.d.ts +63 -0
- package/dist/next/jobs/stored.d.ts.map +1 -0
- package/dist/next/jobs/stored.js +55 -0
- package/dist/next/jobs/stored.js.map +1 -0
- package/dist/next/link/binary.d.ts +4 -0
- package/dist/next/link/binary.d.ts.map +1 -0
- package/dist/next/link/binary.js +534 -0
- package/dist/next/link/binary.js.map +1 -0
- package/dist/next/link/channel.d.ts +63 -0
- package/dist/next/link/channel.d.ts.map +1 -0
- package/dist/next/link/channel.js +202 -0
- package/dist/next/link/channel.js.map +1 -0
- package/dist/next/link/errors.d.ts +7 -0
- package/dist/next/link/errors.d.ts.map +1 -0
- package/dist/next/link/errors.js +21 -0
- package/dist/next/link/errors.js.map +1 -0
- package/dist/next/link/index.d.ts +8 -0
- package/dist/next/link/index.d.ts.map +1 -0
- package/dist/next/link/index.js +8 -0
- package/dist/next/link/index.js.map +1 -0
- package/dist/next/link/internal.d.ts +9 -0
- package/dist/next/link/internal.d.ts.map +1 -0
- package/dist/next/link/internal.js +10 -0
- package/dist/next/link/internal.js.map +1 -0
- package/dist/next/link/ipc.d.ts +22 -0
- package/dist/next/link/ipc.d.ts.map +1 -0
- package/dist/next/link/ipc.js +64 -0
- package/dist/next/link/ipc.js.map +1 -0
- package/dist/next/link/link.d.ts +34 -0
- package/dist/next/link/link.d.ts.map +1 -0
- package/dist/next/link/link.js +87 -0
- package/dist/next/link/link.js.map +1 -0
- package/dist/next/link/message.d.ts +249 -0
- package/dist/next/link/message.d.ts.map +1 -0
- package/dist/next/link/message.js +123 -0
- package/dist/next/link/message.js.map +1 -0
- package/dist/next/link/part.d.ts +80 -0
- package/dist/next/link/part.d.ts.map +1 -0
- package/dist/next/link/part.js +164 -0
- package/dist/next/link/part.js.map +1 -0
- package/dist/next/link/text.d.ts +6 -0
- package/dist/next/link/text.d.ts.map +1 -0
- package/dist/next/link/text.js +335 -0
- package/dist/next/link/text.js.map +1 -0
- package/dist/next/link/values.d.ts +40 -0
- package/dist/next/link/values.d.ts.map +1 -0
- package/dist/next/link/values.js +117 -0
- package/dist/next/link/values.js.map +1 -0
- package/dist/next/link/websocket.d.ts +26 -0
- package/dist/next/link/websocket.d.ts.map +1 -0
- package/dist/next/link/websocket.js +91 -0
- package/dist/next/link/websocket.js.map +1 -0
- package/dist/next/registries/contribution.d.ts +50 -0
- package/dist/next/registries/contribution.d.ts.map +1 -0
- package/dist/next/registries/contribution.js +129 -0
- package/dist/next/registries/contribution.js.map +1 -0
- package/dist/next/registries/entries.d.ts +18 -0
- package/dist/next/registries/entries.d.ts.map +1 -0
- package/dist/next/registries/entries.js +42 -0
- package/dist/next/registries/entries.js.map +1 -0
- package/dist/next/registries/index.d.ts +3 -0
- package/dist/next/registries/index.d.ts.map +1 -0
- package/dist/next/registries/index.js +5 -0
- package/dist/next/registries/index.js.map +1 -0
- package/dist/next/registries/internal.d.ts +4 -0
- package/dist/next/registries/internal.d.ts.map +1 -0
- package/dist/next/registries/internal.js +5 -0
- package/dist/next/registries/internal.js.map +1 -0
- package/dist/next/registries/record.d.ts +94 -0
- package/dist/next/registries/record.d.ts.map +1 -0
- package/dist/next/registries/record.js +253 -0
- package/dist/next/registries/record.js.map +1 -0
- package/dist/next/registries/registry.d.ts +74 -0
- package/dist/next/registries/registry.d.ts.map +1 -0
- package/dist/next/registries/registry.js +14 -0
- package/dist/next/registries/registry.js.map +1 -0
- package/dist/next/registries/value.d.ts +48 -0
- package/dist/next/registries/value.d.ts.map +1 -0
- package/dist/next/registries/value.js +199 -0
- package/dist/next/registries/value.js.map +1 -0
- package/dist/next/remote/calls.d.ts +25 -0
- package/dist/next/remote/calls.d.ts.map +1 -0
- package/dist/next/remote/calls.js +62 -0
- package/dist/next/remote/calls.js.map +1 -0
- package/dist/next/remote/consumer.d.ts +42 -0
- package/dist/next/remote/consumer.d.ts.map +1 -0
- package/dist/next/remote/consumer.js +343 -0
- package/dist/next/remote/consumer.js.map +1 -0
- package/dist/next/remote/hold.d.ts +130 -0
- package/dist/next/remote/hold.d.ts.map +1 -0
- package/dist/next/remote/hold.js +537 -0
- package/dist/next/remote/hold.js.map +1 -0
- package/dist/next/remote/host-link.d.ts +77 -0
- package/dist/next/remote/host-link.d.ts.map +1 -0
- package/dist/next/remote/host-link.js +182 -0
- package/dist/next/remote/host-link.js.map +1 -0
- package/dist/next/remote/internal.d.ts +6 -0
- package/dist/next/remote/internal.d.ts.map +1 -0
- package/dist/next/remote/internal.js +6 -0
- package/dist/next/remote/internal.js.map +1 -0
- package/dist/next/remote/path.d.ts +46 -0
- package/dist/next/remote/path.d.ts.map +1 -0
- package/dist/next/remote/path.js +73 -0
- package/dist/next/remote/path.js.map +1 -0
- package/dist/next/remote/provider.d.ts +76 -0
- package/dist/next/remote/provider.d.ts.map +1 -0
- package/dist/next/remote/provider.js +506 -0
- package/dist/next/remote/provider.js.map +1 -0
- package/dist/next/remote/relay.d.ts +58 -0
- package/dist/next/remote/relay.d.ts.map +1 -0
- package/dist/next/remote/relay.js +117 -0
- package/dist/next/remote/relay.js.map +1 -0
- package/dist/next/remote/remote-object.d.ts +133 -0
- package/dist/next/remote/remote-object.d.ts.map +1 -0
- package/dist/next/remote/remote-object.js +411 -0
- package/dist/next/remote/remote-object.js.map +1 -0
- package/dist/next/remote/replica.d.ts +59 -0
- package/dist/next/remote/replica.d.ts.map +1 -0
- package/dist/next/remote/replica.js +125 -0
- package/dist/next/remote/replica.js.map +1 -0
- package/dist/next/state/batch.d.ts +64 -0
- package/dist/next/state/batch.d.ts.map +1 -0
- package/dist/next/state/batch.js +163 -0
- package/dist/next/state/batch.js.map +1 -0
- package/dist/next/state/derive.d.ts +52 -0
- package/dist/next/state/derive.d.ts.map +1 -0
- package/dist/next/state/derive.js +182 -0
- package/dist/next/state/derive.js.map +1 -0
- package/dist/next/state/index.d.ts +6 -0
- package/dist/next/state/index.d.ts.map +1 -0
- package/dist/next/state/index.js +4 -0
- package/dist/next/state/index.js.map +1 -0
- package/dist/next/state/internal.d.ts +6 -0
- package/dist/next/state/internal.d.ts.map +1 -0
- package/dist/next/state/internal.js +8 -0
- package/dist/next/state/internal.js.map +1 -0
- package/dist/next/state/native-source.d.ts +106 -0
- package/dist/next/state/native-source.d.ts.map +1 -0
- package/dist/next/state/native-source.js +240 -0
- package/dist/next/state/native-source.js.map +1 -0
- package/dist/next/state/watchable.d.ts +114 -0
- package/dist/next/state/watchable.d.ts.map +1 -0
- package/dist/next/state/watchable.js +156 -0
- package/dist/next/state/watchable.js.map +1 -0
- package/dist/next/state/writable.d.ts +32 -0
- package/dist/next/state/writable.d.ts.map +1 -0
- package/dist/next/state/writable.js +49 -0
- package/dist/next/state/writable.js.map +1 -0
- package/dist/next/store/adapter.d.ts +67 -0
- package/dist/next/store/adapter.d.ts.map +1 -0
- package/dist/next/store/adapter.js +118 -0
- package/dist/next/store/adapter.js.map +1 -0
- package/dist/next/store/allocator.d.ts +17 -0
- package/dist/next/store/allocator.d.ts.map +1 -0
- package/dist/next/store/allocator.js +30 -0
- package/dist/next/store/allocator.js.map +1 -0
- package/dist/next/store/applier.d.ts +8 -0
- package/dist/next/store/applier.d.ts.map +1 -0
- package/dist/next/store/applier.js +375 -0
- package/dist/next/store/applier.js.map +1 -0
- package/dist/next/store/apply-batch.d.ts +12 -0
- package/dist/next/store/apply-batch.d.ts.map +1 -0
- package/dist/next/store/apply-batch.js +83 -0
- package/dist/next/store/apply-batch.js.map +1 -0
- package/dist/next/store/archive.d.ts +32 -0
- package/dist/next/store/archive.d.ts.map +1 -0
- package/dist/next/store/archive.js +129 -0
- package/dist/next/store/archive.js.map +1 -0
- package/dist/next/store/backend.d.ts +10 -0
- package/dist/next/store/backend.d.ts.map +1 -0
- package/dist/next/store/backend.js +15 -0
- package/dist/next/store/backend.js.map +1 -0
- package/dist/next/store/catalog.d.ts +24 -0
- package/dist/next/store/catalog.d.ts.map +1 -0
- package/dist/next/store/catalog.js +17 -0
- package/dist/next/store/catalog.js.map +1 -0
- package/dist/next/store/claims.d.ts +23 -0
- package/dist/next/store/claims.d.ts.map +1 -0
- package/dist/next/store/claims.js +65 -0
- package/dist/next/store/claims.js.map +1 -0
- package/dist/next/store/columns.d.ts +77 -0
- package/dist/next/store/columns.d.ts.map +1 -0
- package/dist/next/store/columns.js +77 -0
- package/dist/next/store/columns.js.map +1 -0
- package/dist/next/store/engine.d.ts +176 -0
- package/dist/next/store/engine.d.ts.map +1 -0
- package/dist/next/store/engine.js +283 -0
- package/dist/next/store/engine.js.map +1 -0
- package/dist/next/store/evaluate.d.ts +17 -0
- package/dist/next/store/evaluate.d.ts.map +1 -0
- package/dist/next/store/evaluate.js +128 -0
- package/dist/next/store/evaluate.js.map +1 -0
- package/dist/next/store/export.d.ts +17 -0
- package/dist/next/store/export.d.ts.map +1 -0
- package/dist/next/store/export.js +200 -0
- package/dist/next/store/export.js.map +1 -0
- package/dist/next/store/expression.d.ts +150 -0
- package/dist/next/store/expression.d.ts.map +1 -0
- package/dist/next/store/expression.js +268 -0
- package/dist/next/store/expression.js.map +1 -0
- package/dist/next/store/import.d.ts +10 -0
- package/dist/next/store/import.d.ts.map +1 -0
- package/dist/next/store/import.js +276 -0
- package/dist/next/store/import.js.map +1 -0
- package/dist/next/store/index.d.ts +16 -0
- package/dist/next/store/index.d.ts.map +1 -0
- package/dist/next/store/index.js +13 -0
- package/dist/next/store/index.js.map +1 -0
- package/dist/next/store/json-column.d.ts +33 -0
- package/dist/next/store/json-column.d.ts.map +1 -0
- package/dist/next/store/json-column.js +61 -0
- package/dist/next/store/json-column.js.map +1 -0
- package/dist/next/store/jsonl.d.ts +9 -0
- package/dist/next/store/jsonl.d.ts.map +1 -0
- package/dist/next/store/jsonl.js +61 -0
- package/dist/next/store/jsonl.js.map +1 -0
- package/dist/next/store/outbox.d.ts +26 -0
- package/dist/next/store/outbox.d.ts.map +1 -0
- package/dist/next/store/outbox.js +80 -0
- package/dist/next/store/outbox.js.map +1 -0
- package/dist/next/store/query.d.ts +39 -0
- package/dist/next/store/query.d.ts.map +1 -0
- package/dist/next/store/query.js +97 -0
- package/dist/next/store/query.js.map +1 -0
- package/dist/next/store/refusal.d.ts +15 -0
- package/dist/next/store/refusal.d.ts.map +1 -0
- package/dist/next/store/refusal.js +36 -0
- package/dist/next/store/refusal.js.map +1 -0
- package/dist/next/store/rows.d.ts +80 -0
- package/dist/next/store/rows.d.ts.map +1 -0
- package/dist/next/store/rows.js +183 -0
- package/dist/next/store/rows.js.map +1 -0
- package/dist/next/store/schema.d.ts +25 -0
- package/dist/next/store/schema.d.ts.map +1 -0
- package/dist/next/store/schema.js +115 -0
- package/dist/next/store/schema.js.map +1 -0
- package/dist/next/store/sql.d.ts +73 -0
- package/dist/next/store/sql.d.ts.map +1 -0
- package/dist/next/store/sql.js +234 -0
- package/dist/next/store/sql.js.map +1 -0
- package/dist/next/store/step.d.ts +48 -0
- package/dist/next/store/step.d.ts.map +1 -0
- package/dist/next/store/step.js +50 -0
- package/dist/next/store/step.js.map +1 -0
- package/dist/next/store/store.d.ts +161 -0
- package/dist/next/store/store.d.ts.map +1 -0
- package/dist/next/store/store.js +627 -0
- package/dist/next/store/store.js.map +1 -0
- package/dist/next/store/table-changes.d.ts +29 -0
- package/dist/next/store/table-changes.d.ts.map +1 -0
- package/dist/next/store/table-changes.js +102 -0
- package/dist/next/store/table-changes.js.map +1 -0
- package/dist/next/store/table-evolve.d.ts +74 -0
- package/dist/next/store/table-evolve.d.ts.map +1 -0
- package/dist/next/store/table-evolve.js +201 -0
- package/dist/next/store/table-evolve.js.map +1 -0
- package/dist/next/store/table-handle.d.ts +67 -0
- package/dist/next/store/table-handle.d.ts.map +1 -0
- package/dist/next/store/table-handle.js +101 -0
- package/dist/next/store/table-handle.js.map +1 -0
- package/dist/next/store/table-history.d.ts +75 -0
- package/dist/next/store/table-history.d.ts.map +1 -0
- package/dist/next/store/table-history.js +42 -0
- package/dist/next/store/table-history.js.map +1 -0
- package/dist/next/store/table-migration.d.ts +16 -0
- package/dist/next/store/table-migration.d.ts.map +1 -0
- package/dist/next/store/table-migration.js +202 -0
- package/dist/next/store/table-migration.js.map +1 -0
- package/dist/next/store/table-writes.d.ts +125 -0
- package/dist/next/store/table-writes.d.ts.map +1 -0
- package/dist/next/store/table-writes.js +165 -0
- package/dist/next/store/table-writes.js.map +1 -0
- package/dist/next/store/table.d.ts +80 -0
- package/dist/next/store/table.d.ts.map +1 -0
- package/dist/next/store/table.js +103 -0
- package/dist/next/store/table.js.map +1 -0
- package/dist/next/store/text.d.ts +14 -0
- package/dist/next/store/text.d.ts.map +1 -0
- package/dist/next/store/text.js +51 -0
- package/dist/next/store/text.js.map +1 -0
- package/dist/next/store/writes.d.ts +5 -0
- package/dist/next/store/writes.d.ts.map +1 -0
- package/dist/next/store/writes.js +4 -0
- package/dist/next/store/writes.js.map +1 -0
- package/dist/next-node/compression.d.ts +7 -0
- package/dist/next-node/compression.d.ts.map +1 -0
- package/dist/next-node/compression.js +24 -0
- package/dist/next-node/compression.js.map +1 -0
- package/dist/next-node/http/admission.d.ts +63 -0
- package/dist/next-node/http/admission.d.ts.map +1 -0
- package/dist/next-node/http/admission.js +134 -0
- package/dist/next-node/http/admission.js.map +1 -0
- package/dist/next-node/http/authenticate.d.ts +21 -0
- package/dist/next-node/http/authenticate.d.ts.map +1 -0
- package/dist/next-node/http/authenticate.js +34 -0
- package/dist/next-node/http/authenticate.js.map +1 -0
- package/dist/next-node/http/cookies.d.ts +24 -0
- package/dist/next-node/http/cookies.d.ts.map +1 -0
- package/dist/next-node/http/cookies.js +62 -0
- package/dist/next-node/http/cookies.js.map +1 -0
- package/dist/next-node/http/file.d.ts +23 -0
- package/dist/next-node/http/file.d.ts.map +1 -0
- package/dist/next-node/http/file.js +94 -0
- package/dist/next-node/http/file.js.map +1 -0
- package/dist/next-node/http/headers.d.ts +37 -0
- package/dist/next-node/http/headers.d.ts.map +1 -0
- package/dist/next-node/http/headers.js +129 -0
- package/dist/next-node/http/headers.js.map +1 -0
- package/dist/next-node/http/http.d.ts +100 -0
- package/dist/next-node/http/http.d.ts.map +1 -0
- package/dist/next-node/http/http.js +462 -0
- package/dist/next-node/http/http.js.map +1 -0
- package/dist/next-node/http/incoming.d.ts +19 -0
- package/dist/next-node/http/incoming.d.ts.map +1 -0
- package/dist/next-node/http/incoming.js +31 -0
- package/dist/next-node/http/incoming.js.map +1 -0
- package/dist/next-node/http/index.d.ts +11 -0
- package/dist/next-node/http/index.d.ts.map +1 -0
- package/dist/next-node/http/index.js +12 -0
- package/dist/next-node/http/index.js.map +1 -0
- package/dist/next-node/http/node.d.ts +78 -0
- package/dist/next-node/http/node.d.ts.map +1 -0
- package/dist/next-node/http/node.js +291 -0
- package/dist/next-node/http/node.js.map +1 -0
- package/dist/next-node/http/request.d.ts +54 -0
- package/dist/next-node/http/request.d.ts.map +1 -0
- package/dist/next-node/http/request.js +116 -0
- package/dist/next-node/http/request.js.map +1 -0
- package/dist/next-node/http/response.d.ts +63 -0
- package/dist/next-node/http/response.d.ts.map +1 -0
- package/dist/next-node/http/response.js +202 -0
- package/dist/next-node/http/response.js.map +1 -0
- package/dist/next-node/http/router.d.ts +114 -0
- package/dist/next-node/http/router.d.ts.map +1 -0
- package/dist/next-node/http/router.js +261 -0
- package/dist/next-node/http/router.js.map +1 -0
- package/dist/next-node/http/upgrades.d.ts +58 -0
- package/dist/next-node/http/upgrades.d.ts.map +1 -0
- package/dist/next-node/http/upgrades.js +184 -0
- package/dist/next-node/http/upgrades.js.map +1 -0
- package/dist/next-node/plugins/build.d.ts +57 -0
- package/dist/next-node/plugins/build.d.ts.map +1 -0
- package/dist/next-node/plugins/build.js +334 -0
- package/dist/next-node/plugins/build.js.map +1 -0
- package/dist/next-node/plugins/discover.d.ts +36 -0
- package/dist/next-node/plugins/discover.d.ts.map +1 -0
- package/dist/next-node/plugins/discover.js +91 -0
- package/dist/next-node/plugins/discover.js.map +1 -0
- package/dist/next-node/plugins/evaluate.d.ts +33 -0
- package/dist/next-node/plugins/evaluate.d.ts.map +1 -0
- package/dist/next-node/plugins/evaluate.js +98 -0
- package/dist/next-node/plugins/evaluate.js.map +1 -0
- package/dist/next-node/plugins/index.d.ts +9 -0
- package/dist/next-node/plugins/index.d.ts.map +1 -0
- package/dist/next-node/plugins/index.js +11 -0
- package/dist/next-node/plugins/index.js.map +1 -0
- package/dist/next-node/plugins/install.d.ts +13 -0
- package/dist/next-node/plugins/install.d.ts.map +1 -0
- package/dist/next-node/plugins/install.js +37 -0
- package/dist/next-node/plugins/install.js.map +1 -0
- package/dist/next-node/plugins/plugins.d.ts +135 -0
- package/dist/next-node/plugins/plugins.d.ts.map +1 -0
- package/dist/next-node/plugins/plugins.js +206 -0
- package/dist/next-node/plugins/plugins.js.map +1 -0
- package/dist/next-node/plugins/runtime.d.ts +41 -0
- package/dist/next-node/plugins/runtime.d.ts.map +1 -0
- package/dist/next-node/plugins/runtime.js +136 -0
- package/dist/next-node/plugins/runtime.js.map +1 -0
- package/dist/next-node/plugins/stack.d.ts +16 -0
- package/dist/next-node/plugins/stack.d.ts.map +1 -0
- package/dist/next-node/plugins/stack.js +61 -0
- package/dist/next-node/plugins/stack.js.map +1 -0
- package/dist/next-node/plugins/watcher.d.ts +58 -0
- package/dist/next-node/plugins/watcher.d.ts.map +1 -0
- package/dist/next-node/plugins/watcher.js +281 -0
- package/dist/next-node/plugins/watcher.js.map +1 -0
- package/dist/next-node/workers/control.d.ts +83 -0
- package/dist/next-node/workers/control.d.ts.map +1 -0
- package/dist/next-node/workers/control.js +77 -0
- package/dist/next-node/workers/control.js.map +1 -0
- package/dist/next-node/workers/index.d.ts +5 -0
- package/dist/next-node/workers/index.d.ts.map +1 -0
- package/dist/next-node/workers/index.js +7 -0
- package/dist/next-node/workers/index.js.map +1 -0
- package/dist/next-node/workers/lock.d.ts +21 -0
- package/dist/next-node/workers/lock.d.ts.map +1 -0
- package/dist/next-node/workers/lock.js +137 -0
- package/dist/next-node/workers/lock.js.map +1 -0
- package/dist/next-node/workers/main.d.ts +46 -0
- package/dist/next-node/workers/main.d.ts.map +1 -0
- package/dist/next-node/workers/main.js +230 -0
- package/dist/next-node/workers/main.js.map +1 -0
- package/dist/next-node/workers/process.d.ts +42 -0
- package/dist/next-node/workers/process.d.ts.map +1 -0
- package/dist/next-node/workers/process.js +125 -0
- package/dist/next-node/workers/process.js.map +1 -0
- package/dist/next-node/workers/workers.d.ts +80 -0
- package/dist/next-node/workers/workers.d.ts.map +1 -0
- package/dist/next-node/workers/workers.js +572 -0
- package/dist/next-node/workers/workers.js.map +1 -0
- package/dist/object.d.ts +4 -4
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +3 -4
- package/dist/object.js.map +1 -1
- package/dist/output.d.ts +1 -1
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +4 -2
- package/dist/output.js.map +1 -1
- package/dist/remote.d.ts.map +1 -1
- package/dist/remote.js +2 -2
- package/dist/remote.js.map +1 -1
- package/dist/schema.d.ts +8 -4
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +180 -5
- package/dist/schema.js.map +1 -1
- package/dist/sqlite/cloudflare.d.ts +2 -0
- package/dist/sqlite/cloudflare.d.ts.map +1 -1
- package/dist/sqlite/cloudflare.js +10 -0
- package/dist/sqlite/cloudflare.js.map +1 -1
- package/dist/sqlite/database.d.ts +5 -2
- package/dist/sqlite/database.d.ts.map +1 -1
- package/dist/sqlite/database.js.map +1 -1
- package/dist/sqlite/node.d.ts +4 -1
- package/dist/sqlite/node.d.ts.map +1 -1
- package/dist/sqlite/node.js +22 -5
- package/dist/sqlite/node.js.map +1 -1
- package/dist/watch.d.ts +194 -0
- package/dist/watch.d.ts.map +1 -0
- package/dist/watch.js +383 -0
- package/dist/watch.js.map +1 -0
- package/dist/wire.d.ts +174 -193
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +81 -80
- package/dist/wire.js.map +1 -1
- package/docs/guide.md +15 -15
- package/docs/next/benchmarks.md +959 -0
- package/docs/next/decisions.md +2957 -0
- package/docs/next/dependencies/book.md +1671 -0
- package/docs/next/dependencies/index.html +2641 -0
- package/docs/next/dependencies/model.md +330 -0
- package/docs/next/design.md +2554 -0
- package/docs/next/durable-observers/book.md +432 -0
- package/docs/next/durable-observers/index.html +517 -0
- package/docs/next/flow-control/book.md +333 -0
- package/docs/next/flow-control/fold/index.html +265 -0
- package/docs/next/flow-control/index.html +548 -0
- package/docs/next/flow-control/window/index.html +228 -0
- package/docs/next/guide-plugins-hosts/book.md +607 -0
- package/docs/next/guide-plugins-hosts/index.html +652 -0
- package/docs/next/http-workers/book.md +378 -0
- package/docs/next/http-workers/index.html +515 -0
- package/docs/next/layer-1.md +311 -0
- package/docs/next/layer-2.md +216 -0
- package/docs/next/plugin-model/book.md +186 -0
- package/docs/next/plugin-model/index.html +310 -0
- package/docs/next/plugin-primer/book.md +273 -0
- package/docs/next/plugin-primer/index.html +430 -0
- package/docs/next/slice-1.md +236 -0
- package/docs/next/slice-10.md +285 -0
- package/docs/next/slice-11.md +93 -0
- package/docs/next/slice-2.md +174 -0
- package/docs/next/slice-3a.md +296 -0
- package/docs/next/slice-3b.md +197 -0
- package/docs/next/slice-4.md +146 -0
- package/docs/next/slice-4a.md +418 -0
- package/docs/next/slice-4b.md +208 -0
- package/docs/next/slice-5.md +281 -0
- package/docs/next/slice-6a.md +676 -0
- package/docs/next/slice-6b.md +332 -0
- package/docs/next/slice-7a.md +130 -0
- package/docs/next/slice-7b/book.md +608 -0
- package/docs/next/slice-7b/index.html +842 -0
- package/docs/next/slice-7b.md +255 -0
- package/docs/next/slice-7c.md +165 -0
- package/docs/next/slice-8.md +194 -0
- package/docs/next/slices.md +230 -0
- package/docs/next/store/book.md +665 -0
- package/docs/next/store/index.html +861 -0
- package/docs/next/store/walkthrough.md +193 -0
- package/docs/spec.md +9 -9
- package/docs/tutorial.md +26 -25
- package/package.json +22 -6
- package/src/delta/README.md +69 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../src/next-node/plugins/plugins.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,qHAAqH;AACrH,yHAAyH;AACzH,yHAAyH;AACzH,6FAA6F;AAK7F,OAAO,EAAE,KAAK,EAAmB,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAmB,UAAU,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAkB,eAAe,EAAe,MAAM,eAAe,CAAC;AAE7E,OAAO,EAAuB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAyC,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAwC,aAAa,EAAE,MAAM,cAAc,CAAC;AA+GnF,kHAAkH;AAClH,MA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AO;QAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnD,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;QAAE,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS;YAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpH,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAClC,+FAA+F;QAC/F,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YACxE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAC/E,CAAC;IACF,CAAC;AACF,CAAC;AAED,6DAA6D;AAC7D,SAAS,OAAO,CAAC,KAAY,EAAE,KAAwB;IACtD,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;AAC9F,CAAC","sourcesContent":["// The plugins component (slice 7c §4, §5; decision \"Slice 7c's points\"; slice 10 D11, D12): discovery, builds and the\n// watcher, and per kind the complete current set of scripts (built on first use, updated by every rollout that ships\n// the kind), which its plugin runtime loads and reloads hosts with: unchanged plugins as the same facet objects, removed\n// ones left out, a failed build or evaluation keeping the plugin's loaded facet. `rollout` runs the app's steps in order\n// (one result per host) and clears the marks of plugins applied on every host of every step.\n\nimport type { Context } from \"../../context/index.ts\";\nimport type { Principal } from \"../../next/data/index.ts\";\nimport type { Host, LoadReport, PluginFacet, ReloadReport } from \"../../next/host/index.ts\";\nimport { Batch, type BatchError } from \"../../next/state/internal.ts\";\nimport type { Watchable } from \"../../watch.ts\";\nimport { type BuiltFacet, buildFacet } from \"./build.ts\";\nimport { type Discovery, discoverPlugins, type Plugin } from \"./discover.ts\";\nimport type { HostPackages } from \"./evaluate.ts\";\nimport { type InstallOptions, installDependencies } from \"./install.ts\";\nimport { createPluginRuntime, type PluginRuntime, type PluginScript } from \"./runtime.ts\";\nimport { type MarkSnapshot, type PluginsState, PluginWatcher } from \"./watcher.ts\";\n\n/** What `createPlugins` takes. */\nexport type PluginsOptions = {\n\t/** The directories plugins are listed in, in order: the first root's plugin wins a duplicate name. */\n\treadonly roots: readonly string[];\n\t/**\n\t * The app's facet kinds (one file per kind in a plugin), each with where its builds run and the host packages they\n\t * keep external: `{ server: { platform: \"node\", hostPackages: [\"@earendil-works/chord/next\", \"@app/core\"] }, … }`.\n\t */\n\treadonly kinds: Readonly<Record<string, KindDefinition>>;\n\t/** The app's base code: a change sets `base` (the app restarts its hosts; Chord restarts nothing). */\n\treadonly base?: readonly string[];\n\t/** Where the app serves browser builds' assets: the URL prefix their imports evaluate to. */\n\treadonly publicPath?: string;\n\t/** How `installDependencies` runs npm. */\n\treadonly install?: InstallOptions;\n\t/** The watcher cannot watch (reported once), and the marks' watch listeners that threw. */\n\treadonly onError: (error: PluginsError) => void;\n};\n\n/** One facet kind: Node or browser builds, and the host packages (by specifier) its builds keep external. */\nexport type KindDefinition = { readonly platform: \"node\" | \"browser\"; readonly hostPackages: readonly string[] };\n\n/** What the component reports. */\nexport type PluginsError = BatchError | { readonly kind: \"watch_failed\"; readonly error: unknown };\n\n/**\n * A build of some plugins, plain data (a clone of it reloads the same): every facet of each, the plugins as its\n * discovery saw them by name (what a reload evaluates with), and the plugins no longer discovered.\n */\nexport type Built = {\n\treadonly facets: readonly BuiltFacet[];\n\treadonly plugins: Readonly<Record<string, Plugin>>;\n\treadonly removed: readonly string[];\n};\n\n/**\n * What a rollout step did on one of its hosts (`host` named by the step): its reload's report; `stopped` when the host\n * stopped cleanly during the step (it gets the current set at its next start); `error` when it crashed or its reload\n * failed (every plugin of the step's kinds in the build counts as failed there).\n */\nexport type RolloutHost =\n\t| { readonly host: string; readonly report: ReloadReport }\n\t| { readonly host: string; readonly stopped: true }\n\t| { readonly host: string; readonly error: unknown };\n\n/** What a rollout step does: reloads its hosts with the facets of its kinds, one result per host (D12). */\nexport type RolloutStep = {\n\treadonly name: string;\n\treadonly kinds: readonly string[];\n\treload(built: Built, context: Context): Promise<{ readonly hosts: readonly RolloutHost[] }>;\n};\n\n/** What a rollout did: each step's hosts in order, and the step it stopped at (rejected), if it stopped. */\nexport type RolloutResult = {\n\treadonly steps: readonly { readonly name: string; readonly hosts: readonly RolloutHost[] }[];\n\treadonly stopped: { readonly step: string; readonly error: unknown } | undefined;\n};\n\n/** The plugins component. */\nexport interface Plugins {\n\t/** The marks: `{ dirty, install, set, base }`, a JSON watchable. */\n\treadonly state: Watchable<PluginsState>;\n\t/** The plugins of the last discovery. */\n\treadonly discovery: Discovery;\n\t/**\n\t * Builds every facet of `names` (and of plugins discovered since the last build; discovery runs again first when\n\t * the plugin set changed): plain data. It changes no current set: a rollout ships it.\n\t */\n\tbuild(names: readonly string[], context: Context): Promise<Built>;\n\t/**\n\t * The complete current set of `kind`: every discovered plugin's facet of it (built on first use), as the last\n\t * rollout or reload shipping `kind` left it; what a worker starts with.\n\t */\n\tscripts(kind: string, context: Context): Promise<readonly PluginScript[]>;\n\t/**\n\t * `kind`'s current set now, synchronously (`undefined` before its first use): a rollout step reads it as the rollout\n\t * applied its build, before another rollout can change it.\n\t */\n\tcurrent(kind: string): readonly PluginScript[] | undefined;\n\t/**\n\t * Loads `host` with `kind`'s current set, evaluated with `modules` (the host packages, this process's instances, by\n\t * specifier; kept for the host's reloads), and `core` (the app's own facets): a plugin whose build or evaluation\n\t * fails is left out and reported with the host's report.\n\t */\n\tload<P extends Principal>(\n\t\thost: Host<P>,\n\t\toptions: { readonly kind: string; readonly core: readonly PluginFacet<P>[]; readonly modules: HostPackages },\n\t\tcontext: Context,\n\t): Promise<LoadReport>;\n\t/**\n\t * Applies `built` to the current set of `host`'s kind (loaded by `load`) and reloads `host` with that complete set,\n\t * after its earlier reloads (`PluginRuntime.reload`). The host's report.\n\t */\n\treload<P extends Principal>(host: Host<P>, built: Built, context: Context): Promise<ReloadReport>;\n\t/** An in-process rollout step named `name`: `reload(host, built)`, one host named `name`. */\n\tstep<P extends Principal>(name: string, host: Host<P>): RolloutStep;\n\t/**\n\t * Runs `steps` in order with `built`, applying it to the current set of each step's kinds right before that step,\n\t * and stops at one that rejects; failed plugins and hosts do not stop it. Clears the dirty marks of the built\n\t * plugins applied on every host of every step (not failed on any, every built kind of theirs shipped by a step)\n\t * that did not change since the build.\n\t */\n\trollout(steps: readonly RolloutStep[], built: Built, context: Context): Promise<RolloutResult>;\n\t/** Installs plugin `name`'s dependencies (`installDependencies`): its install mark clears, and it is dirty. */\n\tinstallDependencies(name: string, context: Context): Promise<void>;\n\t/** Stops the watcher. */\n\tclose(): void;\n}\n\n/** Creates the plugins component (and its plugin runtime) and starts the watcher. Discovery runs at first use. */\nexport function createPlugins(options: PluginsOptions, _context: Context): Plugins {\n\treturn new PluginsComponent(options);\n}\n\nclass PluginsComponent implements Plugins {\n\treadonly #options: PluginsOptions;\n\treadonly #watcher: PluginWatcher;\n\treadonly #runtime: PluginRuntime;\n\t#discovery: Discovery = { plugins: [], problems: [] };\n\t#discovered = false;\n\t/** The latest build of every (plugin, kind) built so far, by `plugin\\u0000kind`. */\n\treadonly #built = new Map<string, BuiltFacet>();\n\t/** The current set of each kind used so far, by plugin name. */\n\treadonly #current = new Map<string, Map<string, PluginScript>>();\n\t/** The kind each loaded host was loaded with, held as long as the host is. */\n\treadonly #kinds = new WeakMap<object, string>();\n\t/** The marks each build started from, held as long as its result is (a rollout given a copy clears none). */\n\treadonly #snapshots = new WeakMap<Built, MarkSnapshot>();\n\n\tconstructor(options: PluginsOptions) {\n\t\tthis.#options = options;\n\t\tthis.#runtime = createPluginRuntime();\n\t\tconst batch = new Batch((error) => options.onError(error), undefined);\n\t\tthis.#watcher = new PluginWatcher(\n\t\t\t{\n\t\t\t\troots: options.roots,\n\t\t\t\tbase: options.base ?? [],\n\t\t\t\tkinds: Object.keys(options.kinds),\n\t\t\t\tfailed: (error) => options.onError({ kind: \"watch_failed\", error }),\n\t\t\t},\n\t\t\tbatch,\n\t\t);\n\t}\n\n\tget state(): Watchable<PluginsState> {\n\t\t// Its value is a `PluginsState`.\n\t\treturn this.#watcher as unknown as Watchable<PluginsState>;\n\t}\n\n\tget discovery(): Discovery {\n\t\treturn this.#discovery;\n\t}\n\n\tasync build(names: readonly string[], context: Context): Promise<Built> {\n\t\tconst before = new Set(this.#discovery.plugins.map(({ name }) => name));\n\t\tif (!this.#discovered || this.#watcher.needsDiscovery) await this.#discover(context);\n\t\tconst now = this.#discovery.plugins;\n\t\tconst removed = [...before].filter((name) => !now.some((plugin) => plugin.name === name));\n\t\tconst wanted = now.filter(({ name }) => names.includes(name) || !before.has(name));\n\t\tconst snapshot = this.#watcher.snapshot([...wanted.map(({ name }) => name), ...removed]);\n\t\tconst facets = await Promise.all(\n\t\t\twanted.flatMap((plugin) => Object.keys(plugin.facets).map((kind) => this.#buildOne(plugin, kind, context))),\n\t\t);\n\t\tconst plugins = Object.fromEntries(wanted.map((plugin) => [plugin.name, plugin]));\n\t\tconst built: Built = { facets, plugins, removed };\n\t\tthis.#snapshots.set(built, snapshot);\n\t\treturn built;\n\t}\n\n\tasync scripts(kind: string, context: Context): Promise<readonly PluginScript[]> {\n\t\treturn [...(await this.#set(kind, context)).values()];\n\t}\n\n\tcurrent(kind: string): readonly PluginScript[] | undefined {\n\t\tconst set = this.#current.get(kind);\n\t\treturn set === undefined ? undefined : [...set.values()];\n\t}\n\n\tasync load<P extends Principal>(\n\t\thost: Host<P>,\n\t\toptions: { readonly kind: string; readonly core: readonly PluginFacet<P>[]; readonly modules: HostPackages },\n\t\tcontext: Context,\n\t): Promise<LoadReport> {\n\t\tconst { kind, core, modules } = options;\n\t\tconst scripts = await this.scripts(kind, context);\n\t\tthis.#kinds.set(host, kind);\n\t\treturn this.#runtime.load(host, { kind, core, scripts, modules }, context);\n\t}\n\n\tasync reload<P extends Principal>(host: Host<P>, built: Built, context: Context): Promise<ReloadReport> {\n\t\tconst kind = this.#kinds.get(host);\n\t\tif (kind === undefined) throw new Error(\"plugins.reload: the host was not loaded by this component\");\n\t\tconst set = await this.#set(kind, context);\n\t\t// Applied and read in one step: two reloads started together each pass the set their own build made.\n\t\tship(set, kind, built);\n\t\treturn this.#runtime.reload(host, [...set.values()], context);\n\t}\n\n\tstep<P extends Principal>(name: string, host: Host<P>): RolloutStep {\n\t\tconst kind = this.#kinds.get(host);\n\t\tif (kind === undefined) throw new Error(\"plugins.step: the host was not loaded by this component\");\n\t\treturn {\n\t\t\tname,\n\t\t\tkinds: [kind],\n\t\t\treload: async (built, context) => ({\n\t\t\t\thosts: [{ host: name, report: await this.reload(host, built, context) }],\n\t\t\t}),\n\t\t};\n\t}\n\n\tasync rollout(steps: readonly RolloutStep[], built: Built, context: Context): Promise<RolloutResult> {\n\t\tconst done: { readonly name: string; readonly hosts: readonly RolloutHost[] }[] = [];\n\t\tconst failed = new Set<string>();\n\t\tconst shipped = new Set<string>();\n\t\tfor (const step of steps) {\n\t\t\tlet hosts: readonly RolloutHost[];\n\t\t\ttry {\n\t\t\t\tfor (const kind of step.kinds) ship(await this.#set(kind, context), kind, built);\n\t\t\t\thosts = (await step.reload(built, context)).hosts;\n\t\t\t} catch (error) {\n\t\t\t\treturn { steps: done, stopped: { step: step.name, error } };\n\t\t\t}\n\t\t\tfor (const kind of step.kinds) shipped.add(kind);\n\t\t\tfor (const entry of hosts) {\n\t\t\t\tif (\"report\" in entry) for (const { plugin } of entry.report.failed) failed.add(plugin);\n\t\t\t\telse if (\"error\" in entry) for (const plugin of builtOf(built, step.kinds)) failed.add(plugin);\n\t\t\t}\n\t\t\tdone.push({ name: step.name, hosts });\n\t\t}\n\t\t// A plugin with a built kind no step shipped is not applied everywhere it runs: it stays dirty.\n\t\tfor (const { plugin, facet } of built.facets) if (!shipped.has(facet)) failed.add(plugin);\n\t\tconst snapshot = this.#snapshots.get(built);\n\t\tif (snapshot !== undefined) {\n\t\t\tthis.#watcher.applied(\n\t\t\t\t[...snapshot.plugins.keys()].filter((name) => !failed.has(name)),\n\t\t\t\tsnapshot,\n\t\t\t);\n\t\t}\n\t\treturn { steps: done, stopped: undefined };\n\t}\n\n\tasync installDependencies(name: string, context: Context): Promise<void> {\n\t\tif (!this.#discovered) await this.#discover(context);\n\t\tconst plugin = this.#discovery.plugins.find((each) => each.name === name);\n\t\tif (plugin === undefined) throw new Error(`plugins.installDependencies: no plugin \"${name}\"`);\n\t\tawait installDependencies(plugin, context, this.#options.install);\n\t\tthis.#watcher.installed(name);\n\t}\n\n\tclose(): void {\n\t\tthis.#watcher.close();\n\t}\n\n\t/** Discovers the plugins again; the changes of the plugin set and of `package.json`s seen until now clear. */\n\tasync #discover(context: Context): Promise<void> {\n\t\tconst seen = this.#watcher.discoverySnapshot();\n\t\tthis.#discovery = await discoverPlugins(\n\t\t\tthis.#options.roots,\n\t\t\t{ kinds: Object.keys(this.#options.kinds) },\n\t\t\tcontext,\n\t\t);\n\t\tthis.#discovered = true;\n\t\tthis.#watcher.know(this.#discovery, seen);\n\t}\n\n\t/** `kind`'s current set, made at its first use from every discovered plugin's facet of it (built if needed). */\n\tasync #set(kind: string, context: Context): Promise<Map<string, PluginScript>> {\n\t\tlet set = this.#current.get(kind);\n\t\tif (set !== undefined) return set;\n\t\tif (!this.#discovered) await this.#discover(context);\n\t\tconst plugins = this.#discovery.plugins.filter((plugin) => plugin.facets[kind] !== undefined);\n\t\tconst scripts = await Promise.all(\n\t\t\tplugins.map(async (plugin): Promise<PluginScript> => {\n\t\t\t\tconst built =\n\t\t\t\t\tthis.#built.get(`${plugin.name}\\u0000${kind}`) ?? (await this.#buildOne(plugin, kind, context));\n\t\t\t\treturn { plugin, built };\n\t\t\t}),\n\t\t);\n\t\t// Built concurrently: a set made meanwhile (by a concurrent first use) wins.\n\t\tset = this.#current.get(kind) ?? new Map(scripts.map((script) => [script.plugin.name, script]));\n\t\tthis.#current.set(kind, set);\n\t\treturn set;\n\t}\n\n\t/** Builds `plugin`'s facet of `kind` and keeps it as the latest; the watcher learns what it read. */\n\tasync #buildOne(plugin: Plugin, kind: string, context: Context): Promise<BuiltFacet> {\n\t\tconst { kinds, publicPath } = this.#options;\n\t\t// Discovery finds facet files of the app's kinds only.\n\t\tconst { platform, hostPackages } = kinds[kind]!;\n\t\tconst options = {\n\t\t\thostPackages,\n\t\t\tplatform,\n\t\t\tplugins: this.#discovery.plugins,\n\t\t\t...(publicPath === undefined ? {} : { publicPath }),\n\t\t} as const;\n\t\tconst built = await buildFacet(plugin, kind, options, context);\n\t\tthis.#built.set(`${plugin.name}\\u0000${kind}`, built);\n\t\tthis.#watcher.used([built]);\n\t\treturn built;\n\t}\n}\n\n/**\n * Applies `built` to `set`, `kind`'s current set: its removed plugins and those rebuilt without a facet of `kind` leave\n * it, its facets of `kind` replace theirs.\n */\nfunction ship(set: Map<string, PluginScript>, kind: string, built: Built): void {\n\tfor (const name of built.removed) set.delete(name);\n\tfor (const [name, plugin] of Object.entries(built.plugins)) if (plugin.facets[kind] === undefined) set.delete(name);\n\tfor (const facet of built.facets) {\n\t\t// Own properties only: a plugin may be named like one of `Object.prototype`'s (`constructor`).\n\t\tif (facet.facet === kind && Object.hasOwn(built.plugins, facet.plugin)) {\n\t\t\tset.set(facet.plugin, { plugin: built.plugins[facet.plugin]!, built: facet });\n\t\t}\n\t}\n}\n\n/** The plugins of `built` with a facet of one of `kinds`. */\nfunction builtOf(built: Built, kinds: readonly string[]): string[] {\n\treturn built.facets.filter(({ facet }) => kinds.includes(facet)).map(({ plugin }) => plugin);\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Context } from "../../context/index.ts";
|
|
2
|
+
import { type Principal } from "../../next/data/index.ts";
|
|
3
|
+
import type { Host, LoadReport, PluginFacet, ReloadReport } from "../../next/host/index.ts";
|
|
4
|
+
import type { BuiltFacet } from "./build.ts";
|
|
5
|
+
import type { Plugin } from "./discover.ts";
|
|
6
|
+
import { type HostPackages } from "./evaluate.ts";
|
|
7
|
+
/** One plugin's facet of a kind as shipped to a host (plain data): its build and its plugin record. */
|
|
8
|
+
export type PluginScript = {
|
|
9
|
+
readonly plugin: Plugin;
|
|
10
|
+
readonly built: BuiltFacet;
|
|
11
|
+
};
|
|
12
|
+
/** What `PluginRuntime.load` takes besides the host. */
|
|
13
|
+
export type RuntimeLoad<P extends Principal> = {
|
|
14
|
+
readonly kind: string;
|
|
15
|
+
readonly core: readonly PluginFacet<P>[];
|
|
16
|
+
readonly scripts: readonly PluginScript[];
|
|
17
|
+
readonly modules: HostPackages;
|
|
18
|
+
};
|
|
19
|
+
/** The plugin runtime: loads and reloads hosts with complete sets of shipped scripts. */
|
|
20
|
+
export interface PluginRuntime {
|
|
21
|
+
/**
|
|
22
|
+
* Evaluates `scripts` (the complete set of `kind`) with `modules` (the host packages their `require` answers: this
|
|
23
|
+
* process's instances, kept for the host's reloads) and loads them on `host` with `core` (the app's own facets): a
|
|
24
|
+
* plugin whose build or evaluation failed is left out and reported with the host's report.
|
|
25
|
+
*/
|
|
26
|
+
load<P extends Principal>(host: Host<P>, options: RuntimeLoad<P>, context: Context): Promise<LoadReport>;
|
|
27
|
+
/**
|
|
28
|
+
* Reloads `host` (loaded by `load`) with `scripts`, the complete set now, after its earlier reloads: its core facets
|
|
29
|
+
* and unchanged plugins (the same digest) as the same objects, new scripts evaluated, a plugin whose build or
|
|
30
|
+
* evaluation failed passed as its loaded facet (an added one left out; both given to the host's closure rule),
|
|
31
|
+
* loaded plugins not in `scripts` left out. What the host committed is the loaded set, also when the reload rejects
|
|
32
|
+
* `aborted` after its commit.
|
|
33
|
+
*/
|
|
34
|
+
reload<P extends Principal>(host: Host<P>, scripts: readonly PluginScript[], context: Context): Promise<ReloadReport>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Creates a plugin runtime: turns V8's compilation cache off (once per process: each distinct evaluated script would
|
|
38
|
+
* stay cached).
|
|
39
|
+
*/
|
|
40
|
+
export declare function createPluginRuntime(): PluginRuntime;
|
|
41
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/next-node/plugins/runtime.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAGX,IAAI,EACJ,UAAU,EACV,WAAW,EAEX,YAAY,EACZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAEjE,uGAAuG;AACvG,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAAC;AAEnF,wDAAwD;AACxD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,SAAS,IAAI;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;CAC/B,CAAC;AAEF,yFAAyF;AACzF,MAAM,WAAW,aAAa;IAC7B;;;;OAIG;IACH,IAAI,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACzG;;;;;;OAMG;IACH,MAAM,CAAC,CAAC,SAAS,SAAS,EACzB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EACb,OAAO,EAAE,SAAS,YAAY,EAAE,EAChC,OAAO,EAAE,OAAO,GACd,OAAO,CAAC,YAAY,CAAC,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAMnD"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// The plugin runtime (slice 10 §3, D11): loading and reloading hosts with shipped scripts, without building (no
|
|
2
|
+
// esbuild, no watcher), so a worker evaluates what the server built. Per host it keeps the facet loaded for every plugin
|
|
3
|
+
// and passes the host its complete set at each reload: unchanged plugins (the same digest) as the same facet objects,
|
|
4
|
+
// removed ones (loaded, not shipped) left out; a plugin whose build or evaluation failed keeps its loaded facet (left
|
|
5
|
+
// out at startup) and is reported with the host's report. The plugins component (`createPlugins`) uses one.
|
|
6
|
+
import { setFlagsFromString } from "node:v8";
|
|
7
|
+
import { isChordError } from "../../next/data/index.js";
|
|
8
|
+
import { evaluateFacet } from "./evaluate.js";
|
|
9
|
+
/**
|
|
10
|
+
* Creates a plugin runtime: turns V8's compilation cache off (once per process: each distinct evaluated script would
|
|
11
|
+
* stay cached).
|
|
12
|
+
*/
|
|
13
|
+
export function createPluginRuntime() {
|
|
14
|
+
if (!cacheOff) {
|
|
15
|
+
setFlagsFromString("--no-compilation-cache");
|
|
16
|
+
cacheOff = true;
|
|
17
|
+
}
|
|
18
|
+
return new Runtime();
|
|
19
|
+
}
|
|
20
|
+
/** Whether this process turned V8's compilation cache off already. */
|
|
21
|
+
let cacheOff = false;
|
|
22
|
+
class Runtime {
|
|
23
|
+
/** Each loaded host's plugins, held as long as the host is. */
|
|
24
|
+
#hosts = new WeakMap();
|
|
25
|
+
async load(host, options, context) {
|
|
26
|
+
const { modules } = options;
|
|
27
|
+
const prepared = options.scripts.map(({ plugin, built }) => [plugin.name, prepare(plugin, built, modules)]);
|
|
28
|
+
const failed = [];
|
|
29
|
+
const facets = [...options.core];
|
|
30
|
+
for (const [plugin, each] of prepared) {
|
|
31
|
+
if (each.kind === "failed")
|
|
32
|
+
failed.push({ plugin, error: each.error });
|
|
33
|
+
// Evaluated for this host's principal type: the facets are the app's (`Facet<P>` is invariant in `P`).
|
|
34
|
+
else
|
|
35
|
+
facets.push({ name: plugin, facet: each.facet });
|
|
36
|
+
}
|
|
37
|
+
const report = await host.load(facets, context);
|
|
38
|
+
const left = new Set(report.failed.map(({ plugin }) => plugin));
|
|
39
|
+
const loaded = new Map();
|
|
40
|
+
for (const [plugin, each] of prepared) {
|
|
41
|
+
if (each.kind === "facet" && !left.has(plugin))
|
|
42
|
+
loaded.set(plugin, each);
|
|
43
|
+
}
|
|
44
|
+
// The host's own facets, for its later reloads.
|
|
45
|
+
const core = options.core;
|
|
46
|
+
this.#hosts.set(host, { core, modules, loaded, reloading: Promise.resolve() });
|
|
47
|
+
return { failed: [...failed, ...report.failed] };
|
|
48
|
+
}
|
|
49
|
+
reload(host, scripts, context) {
|
|
50
|
+
const state = this.#hosts.get(host);
|
|
51
|
+
if (state === undefined)
|
|
52
|
+
throw new Error("plugins.reload: the host was not loaded by this runtime");
|
|
53
|
+
// One after another per host: a reload computing its set from a loaded map an earlier one is about to change
|
|
54
|
+
// would pass that plugin's old facet and roll it back.
|
|
55
|
+
const reload = state.reloading.then(() => this.#reload(host, state, scripts, context));
|
|
56
|
+
// The tail settles to nothing: a report kept as its value would keep a rejected facet's closure (its error).
|
|
57
|
+
state.reloading = reload.then(() => { }, () => { });
|
|
58
|
+
return reload;
|
|
59
|
+
}
|
|
60
|
+
/** One reload of `host` with the complete set `scripts`. */
|
|
61
|
+
async #reload(host, state, scripts, context) {
|
|
62
|
+
const failed = [];
|
|
63
|
+
const next = new Map();
|
|
64
|
+
for (const { plugin, built } of scripts) {
|
|
65
|
+
const { name } = plugin;
|
|
66
|
+
const loaded = state.loaded.get(name);
|
|
67
|
+
if (built.kind === "script" && built.digest === loaded?.digest) {
|
|
68
|
+
next.set(name, loaded);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const prepared = prepare(plugin, built, state.modules);
|
|
72
|
+
if (prepared.kind === "facet") {
|
|
73
|
+
next.set(name, prepared);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
failed.push({ plugin: name, error: prepared.error });
|
|
77
|
+
if (loaded !== undefined)
|
|
78
|
+
next.set(name, loaded);
|
|
79
|
+
}
|
|
80
|
+
const facets = [...state.core, ...[...next].map(([name, { facet }]) => ({ name, facet }))];
|
|
81
|
+
// The host takes facets of its own principal type: the runtime loaded them for it. The plugins whose build or
|
|
82
|
+
// evaluation failed are the host's to report, and its closure rule's to consider.
|
|
83
|
+
let report;
|
|
84
|
+
try {
|
|
85
|
+
report = await host.reload(facets, context, { failed });
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
// Aborted after its commit: the commit stands, and is what the host runs now.
|
|
89
|
+
const committed = committedOf(error);
|
|
90
|
+
if (committed !== undefined)
|
|
91
|
+
adopt(state, next, committed.failed);
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
adopt(state, next, report.failed.map(({ plugin }) => plugin));
|
|
95
|
+
return report;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/** `built` evaluated for `plugin` with `modules`, or why not: its build failed, or its evaluation threw. */
|
|
99
|
+
function prepare(plugin, built, modules) {
|
|
100
|
+
if (built.kind === "failed") {
|
|
101
|
+
const message = `plugin "${plugin.name}": its ${built.facet} facet failed to build:\n${built.errors.join("\n")}`;
|
|
102
|
+
return { kind: "failed", error: new Error(message) };
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
const facet = evaluateFacet(built, { hostPackages: modules, plugin });
|
|
106
|
+
return { kind: "facet", facet, digest: built.digest };
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
return { kind: "failed", error };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Adopts as `state`'s loaded facets the set `next` a reload committed: a plugin the host kept old (`failed`) stays loaded
|
|
114
|
+
* as it was, an added one it left out is not loaded.
|
|
115
|
+
*/
|
|
116
|
+
function adopt(state, next, failed) {
|
|
117
|
+
for (const plugin of failed) {
|
|
118
|
+
const loaded = state.loaded.get(plugin);
|
|
119
|
+
if (loaded === undefined)
|
|
120
|
+
next.delete(plugin);
|
|
121
|
+
else
|
|
122
|
+
next.set(plugin, loaded);
|
|
123
|
+
}
|
|
124
|
+
state.loaded.clear();
|
|
125
|
+
for (const [name, each] of next)
|
|
126
|
+
state.loaded.set(name, each);
|
|
127
|
+
}
|
|
128
|
+
/** What the commit of a reload that rejected applied: an `aborted` error after its commit says (`details.committed`). */
|
|
129
|
+
function committedOf(error) {
|
|
130
|
+
if (!isChordError(error, "aborted"))
|
|
131
|
+
return undefined;
|
|
132
|
+
const details = error.details;
|
|
133
|
+
// The kernel's own error: its `committed` is a `CommittedReload`.
|
|
134
|
+
return typeof details === "object" && details !== null ? details.committed : undefined;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/next-node/plugins/runtime.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,yHAAyH;AACzH,sHAAsH;AACtH,sHAAsH;AACtH,4GAA4G;AAE5G,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,OA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AY,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACtE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;IACvD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAClC,CAAC;AACF,CAAC;AAED;;;GAGG;AACH,SAAS,KAAK,CAAC,KAAkB,EAAE,IAA8B,EAAE,MAAyB;IAC3F,KAAK,MAAM,MAAM,IAAI,MAAM,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,MAAM,KAAK,SAAS;YAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;;YACzC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACrB,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI;QAAE,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC/D,CAAC;AAED,yHAAyH;AACzH,SAAS,WAAW,CAAC,KAAc;IAClC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC;QAAE,OAAO,SAAS,CAAC;IACtD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAsE,CAAC;IAC7F,kEAAkE;IAClE,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AACxF,CAAC","sourcesContent":["// The plugin runtime (slice 10 §3, D11): loading and reloading hosts with shipped scripts, without building (no\n// esbuild, no watcher), so a worker evaluates what the server built. Per host it keeps the facet loaded for every plugin\n// and passes the host its complete set at each reload: unchanged plugins (the same digest) as the same facet objects,\n// removed ones (loaded, not shipped) left out; a plugin whose build or evaluation failed keeps its loaded facet (left\n// out at startup) and is reported with the host's report. The plugins component (`createPlugins`) uses one.\n\nimport { setFlagsFromString } from \"node:v8\";\nimport type { Context } from \"../../context/index.ts\";\nimport { isChordError, type Principal } from \"../../next/data/index.ts\";\nimport type {\n\tCommittedReload,\n\tFacet,\n\tHost,\n\tLoadReport,\n\tPluginFacet,\n\tPluginFailure,\n\tReloadReport,\n} from \"../../next/host/index.ts\";\nimport type { BuiltFacet } from \"./build.ts\";\nimport type { Plugin } from \"./discover.ts\";\nimport { evaluateFacet, type HostPackages } from \"./evaluate.ts\";\n\n/** One plugin's facet of a kind as shipped to a host (plain data): its build and its plugin record. */\nexport type PluginScript = { readonly plugin: Plugin; readonly built: BuiltFacet };\n\n/** What `PluginRuntime.load` takes besides the host. */\nexport type RuntimeLoad<P extends Principal> = {\n\treadonly kind: string;\n\treadonly core: readonly PluginFacet<P>[];\n\treadonly scripts: readonly PluginScript[];\n\treadonly modules: HostPackages;\n};\n\n/** The plugin runtime: loads and reloads hosts with complete sets of shipped scripts. */\nexport interface PluginRuntime {\n\t/**\n\t * Evaluates `scripts` (the complete set of `kind`) with `modules` (the host packages their `require` answers: this\n\t * process's instances, kept for the host's reloads) and loads them on `host` with `core` (the app's own facets): a\n\t * plugin whose build or evaluation failed is left out and reported with the host's report.\n\t */\n\tload<P extends Principal>(host: Host<P>, options: RuntimeLoad<P>, context: Context): Promise<LoadReport>;\n\t/**\n\t * Reloads `host` (loaded by `load`) with `scripts`, the complete set now, after its earlier reloads: its core facets\n\t * and unchanged plugins (the same digest) as the same objects, new scripts evaluated, a plugin whose build or\n\t * evaluation failed passed as its loaded facet (an added one left out; both given to the host's closure rule),\n\t * loaded plugins not in `scripts` left out. What the host committed is the loaded set, also when the reload rejects\n\t * `aborted` after its commit.\n\t */\n\treload<P extends Principal>(\n\t\thost: Host<P>,\n\t\tscripts: readonly PluginScript[],\n\t\tcontext: Context,\n\t): Promise<ReloadReport>;\n}\n\n/**\n * Creates a plugin runtime: turns V8's compilation cache off (once per process: each distinct evaluated script would\n * stay cached).\n */\nexport function createPluginRuntime(): PluginRuntime {\n\tif (!cacheOff) {\n\t\tsetFlagsFromString(\"--no-compilation-cache\");\n\t\tcacheOff = true;\n\t}\n\treturn new Runtime();\n}\n\n/** Whether this process turned V8's compilation cache off already. */\nlet cacheOff = false;\n\n/** A plugin's facet as a host loaded it, with its script's digest. */\ntype LoadedFacet = { readonly facet: Facet<Principal>; readonly digest: string };\n\n/**\n * A host's plugins as the runtime loaded them: its core facets, its modules, each plugin's loaded facet, and its\n * reloads, one after another (each computes its complete set once the previous one adopted its result).\n */\ntype HostPlugins = {\n\treadonly core: readonly PluginFacet<Principal>[];\n\treadonly modules: HostPackages;\n\treadonly loaded: Map<string, LoadedFacet>;\n\treloading: Promise<void>;\n};\n\n/** A plugin's facet passed to a host, or why it was not: a build or evaluation failure. */\ntype Prepared =\n\t| { readonly kind: \"facet\"; readonly facet: Facet<Principal>; readonly digest: string }\n\t| { readonly kind: \"failed\"; readonly error: unknown };\n\nclass Runtime implements PluginRuntime {\n\t/** Each loaded host's plugins, held as long as the host is. */\n\treadonly #hosts = new WeakMap<object, HostPlugins>();\n\n\tasync load<P extends Principal>(host: Host<P>, options: RuntimeLoad<P>, context: Context): Promise<LoadReport> {\n\t\tconst { modules } = options;\n\t\tconst prepared = options.scripts.map(\n\t\t\t({ plugin, built }) => [plugin.name, prepare(plugin, built, modules)] as const,\n\t\t);\n\t\tconst failed: PluginFailure[] = [];\n\t\tconst facets: PluginFacet<P>[] = [...options.core];\n\t\tfor (const [plugin, each] of prepared) {\n\t\t\tif (each.kind === \"failed\") failed.push({ plugin, error: each.error });\n\t\t\t// Evaluated for this host's principal type: the facets are the app's (`Facet<P>` is invariant in `P`).\n\t\t\telse facets.push({ name: plugin, facet: each.facet as unknown as Facet<P> });\n\t\t}\n\t\tconst report = await host.load(facets, context);\n\t\tconst left = new Set(report.failed.map(({ plugin }) => plugin));\n\t\tconst loaded = new Map<string, LoadedFacet>();\n\t\tfor (const [plugin, each] of prepared) {\n\t\t\tif (each.kind === \"facet\" && !left.has(plugin)) loaded.set(plugin, each);\n\t\t}\n\t\t// The host's own facets, for its later reloads.\n\t\tconst core = options.core as unknown as readonly PluginFacet<Principal>[];\n\t\tthis.#hosts.set(host, { core, modules, loaded, reloading: Promise.resolve() });\n\t\treturn { failed: [...failed, ...report.failed] };\n\t}\n\n\treload<P extends Principal>(\n\t\thost: Host<P>,\n\t\tscripts: readonly PluginScript[],\n\t\tcontext: Context,\n\t): Promise<ReloadReport> {\n\t\tconst state = this.#hosts.get(host);\n\t\tif (state === undefined) throw new Error(\"plugins.reload: the host was not loaded by this runtime\");\n\t\t// One after another per host: a reload computing its set from a loaded map an earlier one is about to change\n\t\t// would pass that plugin's old facet and roll it back.\n\t\tconst reload = state.reloading.then(() => this.#reload(host, state, scripts, context));\n\t\t// The tail settles to nothing: a report kept as its value would keep a rejected facet's closure (its error).\n\t\tstate.reloading = reload.then(\n\t\t\t() => {},\n\t\t\t() => {},\n\t\t);\n\t\treturn reload;\n\t}\n\n\t/** One reload of `host` with the complete set `scripts`. */\n\tasync #reload<P extends Principal>(\n\t\thost: Host<P>,\n\t\tstate: HostPlugins,\n\t\tscripts: readonly PluginScript[],\n\t\tcontext: Context,\n\t): Promise<ReloadReport> {\n\t\tconst failed: PluginFailure[] = [];\n\t\tconst next = new Map<string, LoadedFacet>();\n\t\tfor (const { plugin, built } of scripts) {\n\t\t\tconst { name } = plugin;\n\t\t\tconst loaded = state.loaded.get(name);\n\t\t\tif (built.kind === \"script\" && built.digest === loaded?.digest) {\n\t\t\t\tnext.set(name, loaded);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst prepared = prepare(plugin, built, state.modules);\n\t\t\tif (prepared.kind === \"facet\") {\n\t\t\t\tnext.set(name, prepared);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfailed.push({ plugin: name, error: prepared.error });\n\t\t\tif (loaded !== undefined) next.set(name, loaded);\n\t\t}\n\t\tconst facets = [...state.core, ...[...next].map(([name, { facet }]) => ({ name, facet }))];\n\t\t// The host takes facets of its own principal type: the runtime loaded them for it. The plugins whose build or\n\t\t// evaluation failed are the host's to report, and its closure rule's to consider.\n\t\tlet report: ReloadReport;\n\t\ttry {\n\t\t\treport = await host.reload(facets as unknown as readonly PluginFacet<P>[], context, { failed });\n\t\t} catch (error) {\n\t\t\t// Aborted after its commit: the commit stands, and is what the host runs now.\n\t\t\tconst committed = committedOf(error);\n\t\t\tif (committed !== undefined) adopt(state, next, committed.failed);\n\t\t\tthrow error;\n\t\t}\n\t\tadopt(\n\t\t\tstate,\n\t\t\tnext,\n\t\t\treport.failed.map(({ plugin }) => plugin),\n\t\t);\n\t\treturn report;\n\t}\n}\n\n/** `built` evaluated for `plugin` with `modules`, or why not: its build failed, or its evaluation threw. */\nfunction prepare(plugin: Plugin, built: BuiltFacet, modules: HostPackages): Prepared {\n\tif (built.kind === \"failed\") {\n\t\tconst message = `plugin \"${plugin.name}\": its ${built.facet} facet failed to build:\\n${built.errors.join(\"\\n\")}`;\n\t\treturn { kind: \"failed\", error: new Error(message) };\n\t}\n\ttry {\n\t\tconst facet = evaluateFacet(built, { hostPackages: modules, plugin });\n\t\treturn { kind: \"facet\", facet, digest: built.digest };\n\t} catch (error) {\n\t\treturn { kind: \"failed\", error };\n\t}\n}\n\n/**\n * Adopts as `state`'s loaded facets the set `next` a reload committed: a plugin the host kept old (`failed`) stays loaded\n * as it was, an added one it left out is not loaded.\n */\nfunction adopt(state: HostPlugins, next: Map<string, LoadedFacet>, failed: readonly string[]): void {\n\tfor (const plugin of failed) {\n\t\tconst loaded = state.loaded.get(plugin);\n\t\tif (loaded === undefined) next.delete(plugin);\n\t\telse next.set(plugin, loaded);\n\t}\n\tstate.loaded.clear();\n\tfor (const [name, each] of next) state.loaded.set(name, each);\n}\n\n/** What the commit of a reload that rejected applied: an `aborted` error after its commit says (`details.committed`). */\nfunction committedOf(error: unknown): CommittedReload | undefined {\n\tif (!isChordError(error, \"aborted\")) return undefined;\n\tconst details = error.details as { readonly committed?: CommittedReload } | null | undefined;\n\t// The kernel's own error: its `committed` is a `CommittedReload`.\n\treturn typeof details === \"object\" && details !== null ? details.committed : undefined;\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SourceMap } from "node:module";
|
|
2
|
+
/**
|
|
3
|
+
* Registers the script `source` evaluated under `filename` for plugin directory `dir` while `owner` (its facet, or the
|
|
4
|
+
* error its evaluation threw) lives: its inline source map, whose sources are relative to the plugin's directory. Two
|
|
5
|
+
* evaluations of one script (two hosts) share the entry.
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerScript(filename: string, source: string, dir: string, owner: object): void;
|
|
8
|
+
/** The inline source map esbuild appended to a built script, if it has one. */
|
|
9
|
+
export declare function inlineSourceMap(source: string): SourceMap | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* `error`'s stack with every position in a registered plugin script mapped through its source map to the plugin's file
|
|
12
|
+
* and line (`notes/worker.ts:12:3`: the plugin's directory name and the file's path inside it); other lines as they
|
|
13
|
+
* are. A value that is no error with a stack gives its string.
|
|
14
|
+
*/
|
|
15
|
+
export declare function mapStack(error: unknown): string;
|
|
16
|
+
//# sourceMappingURL=stack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../src/next-node/plugins/stack.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAexC;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAUjG;AAED,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAGrE;AAKD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAU/C"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Stack traces of plugin scripts (slice 7c §3, decision Q1 (b)): `vm.Script` maps no positions through a source map, so
|
|
2
|
+
// every evaluated script registers its map under its filename while something of its evaluation lives (its facet, or
|
|
3
|
+
// the error it threw while evaluated), and `mapStack` rewrites an error's stack through them, for the app's reporters.
|
|
4
|
+
// Nothing global: no `Error.prepareStackTrace`, no process-wide source-map switch. The registry is a module-level `Map`
|
|
5
|
+
// keyed by filename, not a `WeakMap` keyed by an owner: `mapStack` starts from a stack's text, which names only the
|
|
6
|
+
// filename. Its entries go with the last evaluation of their script (a `FinalizationRegistry` counts them down).
|
|
7
|
+
import { SourceMap } from "node:module";
|
|
8
|
+
import { basename, join } from "node:path";
|
|
9
|
+
/** The evaluated scripts by filename, while an evaluation of each lives. */
|
|
10
|
+
const scripts = new Map();
|
|
11
|
+
/** Counts down an evaluation that was collected; its script's entry goes with the last one. */
|
|
12
|
+
const collected = new FinalizationRegistry((filename) => {
|
|
13
|
+
const script = scripts.get(filename);
|
|
14
|
+
if (script !== undefined && --script.live === 0)
|
|
15
|
+
scripts.delete(filename);
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Registers the script `source` evaluated under `filename` for plugin directory `dir` while `owner` (its facet, or the
|
|
19
|
+
* error its evaluation threw) lives: its inline source map, whose sources are relative to the plugin's directory. Two
|
|
20
|
+
* evaluations of one script (two hosts) share the entry.
|
|
21
|
+
*/
|
|
22
|
+
export function registerScript(filename, source, dir, owner) {
|
|
23
|
+
let script = scripts.get(filename);
|
|
24
|
+
if (script === undefined) {
|
|
25
|
+
const map = inlineSourceMap(source);
|
|
26
|
+
if (map === undefined)
|
|
27
|
+
return;
|
|
28
|
+
script = { map, dir, live: 0 };
|
|
29
|
+
scripts.set(filename, script);
|
|
30
|
+
}
|
|
31
|
+
script.live++;
|
|
32
|
+
collected.register(owner, filename);
|
|
33
|
+
}
|
|
34
|
+
/** The inline source map esbuild appended to a built script, if it has one. */
|
|
35
|
+
export function inlineSourceMap(source) {
|
|
36
|
+
const inline = SOURCE_MAP.exec(source);
|
|
37
|
+
return inline === null ? undefined : new SourceMap(JSON.parse(Buffer.from(inline[1], "base64").toString("utf8")));
|
|
38
|
+
}
|
|
39
|
+
/** The inline source map esbuild appends to a script. */
|
|
40
|
+
const SOURCE_MAP = /\/\/# sourceMappingURL=data:application\/json;base64,([A-Za-z0-9+/=]+)\s*$/;
|
|
41
|
+
/**
|
|
42
|
+
* `error`'s stack with every position in a registered plugin script mapped through its source map to the plugin's file
|
|
43
|
+
* and line (`notes/worker.ts:12:3`: the plugin's directory name and the file's path inside it); other lines as they
|
|
44
|
+
* are. A value that is no error with a stack gives its string.
|
|
45
|
+
*/
|
|
46
|
+
export function mapStack(error) {
|
|
47
|
+
const stack = error instanceof Error ? error.stack : undefined;
|
|
48
|
+
if (stack === undefined)
|
|
49
|
+
return String(error);
|
|
50
|
+
return stack.replace(POSITION, (whole, filename, line, column) => {
|
|
51
|
+
const script = scripts.get(filename);
|
|
52
|
+
const entry = script?.map.findEntry(Number(line) - 1, Number(column) - 1);
|
|
53
|
+
if (script === undefined || entry === undefined || !("originalSource" in entry))
|
|
54
|
+
return whole;
|
|
55
|
+
const file = join(basename(script.dir), entry.originalSource).split("\\").join("/");
|
|
56
|
+
return `${file}:${entry.originalLine + 1}:${entry.originalColumn + 1}`;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/** A position in a stack line: `filename:line:column`, the filename being anything up to it (spaces included). */
|
|
60
|
+
const POSITION = /([^\s()]+):(\d+):(\d+)/g;
|
|
61
|
+
//# sourceMappingURL=stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../src/next-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AC,YAAY,GAAG,CAAC,IAAI,KAAK,CAAC,cAAc,GAAG,CAAC,EAAE,CAAC;IACxE,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,kHAAkH;AAClH,MAAM,QAAQ,GAAG,yBAAyB,CAAC","sourcesContent":["// Stack traces of plugin scripts (slice 7c §3, decision Q1 (b)): `vm.Script` maps no positions through a source map, so\n// every evaluated script registers its map under its filename while something of its evaluation lives (its facet, or\n// the error it threw while evaluated), and `mapStack` rewrites an error's stack through them, for the app's reporters.\n// Nothing global: no `Error.prepareStackTrace`, no process-wide source-map switch. The registry is a module-level `Map`\n// keyed by filename, not a `WeakMap` keyed by an owner: `mapStack` starts from a stack's text, which names only the\n// filename. Its entries go with the last evaluation of their script (a `FinalizationRegistry` counts them down).\n\nimport { SourceMap } from \"node:module\";\nimport { basename, join } from \"node:path\";\n\n/** A registered script: how its positions map, its plugin's directory, and how many of its evaluations live. */\ntype Registered = { readonly map: SourceMap; readonly dir: string; live: number };\n\n/** The evaluated scripts by filename, while an evaluation of each lives. */\nconst scripts = new Map<string, Registered>();\n\n/** Counts down an evaluation that was collected; its script's entry goes with the last one. */\nconst collected = new FinalizationRegistry<string>((filename) => {\n\tconst script = scripts.get(filename);\n\tif (script !== undefined && --script.live === 0) scripts.delete(filename);\n});\n\n/**\n * Registers the script `source` evaluated under `filename` for plugin directory `dir` while `owner` (its facet, or the\n * error its evaluation threw) lives: its inline source map, whose sources are relative to the plugin's directory. Two\n * evaluations of one script (two hosts) share the entry.\n */\nexport function registerScript(filename: string, source: string, dir: string, owner: object): void {\n\tlet script = scripts.get(filename);\n\tif (script === undefined) {\n\t\tconst map = inlineSourceMap(source);\n\t\tif (map === undefined) return;\n\t\tscript = { map, dir, live: 0 };\n\t\tscripts.set(filename, script);\n\t}\n\tscript.live++;\n\tcollected.register(owner, filename);\n}\n\n/** The inline source map esbuild appended to a built script, if it has one. */\nexport function inlineSourceMap(source: string): SourceMap | undefined {\n\tconst inline = SOURCE_MAP.exec(source);\n\treturn inline === null ? undefined : new SourceMap(JSON.parse(Buffer.from(inline[1]!, \"base64\").toString(\"utf8\")));\n}\n\n/** The inline source map esbuild appends to a script. */\nconst SOURCE_MAP = /\\/\\/# sourceMappingURL=data:application\\/json;base64,([A-Za-z0-9+/=]+)\\s*$/;\n\n/**\n * `error`'s stack with every position in a registered plugin script mapped through its source map to the plugin's file\n * and line (`notes/worker.ts:12:3`: the plugin's directory name and the file's path inside it); other lines as they\n * are. A value that is no error with a stack gives its string.\n */\nexport function mapStack(error: unknown): string {\n\tconst stack = error instanceof Error ? error.stack : undefined;\n\tif (stack === undefined) return String(error);\n\treturn stack.replace(POSITION, (whole, filename: string, line: string, column: string) => {\n\t\tconst script = scripts.get(filename);\n\t\tconst entry = script?.map.findEntry(Number(line) - 1, Number(column) - 1);\n\t\tif (script === undefined || entry === undefined || !(\"originalSource\" in entry)) return whole;\n\t\tconst file = join(basename(script.dir), entry.originalSource).split(\"\\\\\").join(\"/\");\n\t\treturn `${file}:${entry.originalLine + 1}:${entry.originalColumn + 1}`;\n\t});\n}\n\n/** A position in a stack line: `filename:line:column`, the filename being anything up to it (spaces included). */\nconst POSITION = /([^\\s()]+):(\\d+):(\\d+)/g;\n"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type Context } from "../../context/index.ts";
|
|
2
|
+
import type { JsonValue } from "../../json.ts";
|
|
3
|
+
import { type Batch, Source } from "../../next/state/internal.ts";
|
|
4
|
+
import { type BuiltFacet } from "./build.ts";
|
|
5
|
+
import { type Discovery } from "./discover.ts";
|
|
6
|
+
/** The marks: plugins to rebuild, plugins to install, whether to discover again, whether base code changed. */
|
|
7
|
+
export type PluginsState = {
|
|
8
|
+
readonly dirty: readonly string[];
|
|
9
|
+
readonly install: readonly string[];
|
|
10
|
+
readonly set: boolean;
|
|
11
|
+
readonly base: boolean;
|
|
12
|
+
};
|
|
13
|
+
/** The generation of each dirty plugin's latest change when a build started: what its rollout may clear. */
|
|
14
|
+
export type MarkSnapshot = {
|
|
15
|
+
readonly plugins: ReadonlyMap<string, number>;
|
|
16
|
+
};
|
|
17
|
+
/** The generations of the latest change of the plugin set and of a `package.json` when a discovery started. */
|
|
18
|
+
export type DiscoverySnapshot = {
|
|
19
|
+
readonly set: number;
|
|
20
|
+
readonly manifest: number;
|
|
21
|
+
};
|
|
22
|
+
/** What the watcher watches and how it reports: the roots, the base code, the facet kinds, a failure to watch. */
|
|
23
|
+
export type WatcherOptions = {
|
|
24
|
+
readonly roots: readonly string[];
|
|
25
|
+
readonly base: readonly string[];
|
|
26
|
+
readonly kinds: readonly string[];
|
|
27
|
+
/** The watcher cannot watch (the system's limit): reported once, after which the app builds on demand. */
|
|
28
|
+
readonly failed: (error: unknown) => void;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The watcher and the marks (`state`), a JSON watchable published at most once per microtask turn with changes. It
|
|
32
|
+
* marks for the plugins of the last discovery (`know`) and the files their last builds read (`used`).
|
|
33
|
+
*/
|
|
34
|
+
export declare class PluginWatcher extends Source {
|
|
35
|
+
#private;
|
|
36
|
+
constructor(options: WatcherOptions, batch: Batch);
|
|
37
|
+
get value(): JsonValue;
|
|
38
|
+
deliver(context: Context): void;
|
|
39
|
+
/** Whether the next build discovers again: the plugin set or a plugin's `package.json` changed. */
|
|
40
|
+
get needsDiscovery(): boolean;
|
|
41
|
+
/** What a discovery that starts now has seen. */
|
|
42
|
+
discoverySnapshot(): DiscoverySnapshot;
|
|
43
|
+
/** The plugins discovery found: marks are for them (a removed one's install clears); the changes it had seen clear. */
|
|
44
|
+
know(discovery: Discovery, seen: DiscoverySnapshot): void;
|
|
45
|
+
/** What `built` facets read: a later change of one of these files dirties their plugins. */
|
|
46
|
+
used(built: readonly BuiltFacet[]): void;
|
|
47
|
+
/** The marks a build of `names` starts from: each one's latest change. */
|
|
48
|
+
snapshot(names: Iterable<string>): MarkSnapshot;
|
|
49
|
+
/** `names` were applied everywhere: their marks clear unless a change came after `snapshot`. */
|
|
50
|
+
applied(names: Iterable<string>, snapshot: MarkSnapshot): void;
|
|
51
|
+
/** Plugin `name`'s dependencies were installed: its install mark clears and it is dirty (its packages changed). */
|
|
52
|
+
installed(name: string): void;
|
|
53
|
+
/** Marks what a change of the file or directory at `path` (absolute) asks for. */
|
|
54
|
+
mark(path: string): void;
|
|
55
|
+
/** Stops watching. */
|
|
56
|
+
close(): void;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=watcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watcher.d.ts","sourceRoot":"","sources":["../../../src/next-node/plugins/watcher.ts"],"names":[],"mappings":"AAUA,OAAO,EAAsB,KAAK,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,KAAK,UAAU,EAAU,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,eAAe,CAAC;AAEjE,+GAA+G;AAC/G,MAAM,MAAM,YAAY,GAAG;IAC1B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,4GAA4G;AAC5G,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC;AAE7E,+GAA+G;AAC/G,MAAM,MAAM,iBAAiB,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CA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