@decocms/blocks 8.1.0-next.0 → 8.1.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/deco.js +5 -12
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol/assets.d.ts +46 -0
- package/dist/protocol/assets.d.ts.map +1 -0
- package/dist/protocol/assets.js +105 -0
- package/dist/protocol/assets.js.map +1 -0
- package/dist/protocol/canonical.d.ts +8 -0
- package/dist/protocol/canonical.d.ts.map +1 -0
- package/dist/protocol/canonical.js +8 -0
- package/dist/protocol/canonical.js.map +1 -0
- package/dist/protocol/ciphertext.d.ts +7 -0
- package/dist/protocol/ciphertext.d.ts.map +1 -0
- package/dist/protocol/ciphertext.js +7 -0
- package/dist/protocol/ciphertext.js.map +1 -0
- package/dist/protocol/client.d.ts +54 -0
- package/dist/protocol/client.d.ts.map +1 -0
- package/dist/protocol/client.js +104 -0
- package/dist/protocol/client.js.map +1 -0
- package/dist/protocol/conformance/cases/assets.d.ts +3 -0
- package/dist/protocol/conformance/cases/assets.d.ts.map +1 -0
- package/dist/protocol/conformance/cases/assets.js +71 -0
- package/dist/protocol/conformance/cases/assets.js.map +1 -0
- package/dist/protocol/conformance/cases/guards.d.ts +3 -0
- package/dist/protocol/conformance/cases/guards.d.ts.map +1 -0
- package/dist/protocol/conformance/cases/guards.js +265 -0
- package/dist/protocol/conformance/cases/guards.js.map +1 -0
- package/dist/protocol/conformance/cases/reads.d.ts +3 -0
- package/dist/protocol/conformance/cases/reads.d.ts.map +1 -0
- package/dist/protocol/conformance/cases/reads.js +140 -0
- package/dist/protocol/conformance/cases/reads.js.map +1 -0
- package/dist/protocol/conformance/cases/types.d.ts +9 -0
- package/dist/protocol/conformance/cases/types.d.ts.map +1 -0
- package/dist/protocol/conformance/cases/types.js +2 -0
- package/dist/protocol/conformance/cases/types.js.map +1 -0
- package/dist/protocol/conformance/cases/wire.d.ts +3 -0
- package/dist/protocol/conformance/cases/wire.d.ts.map +1 -0
- package/dist/protocol/conformance/cases/wire.js +130 -0
- package/dist/protocol/conformance/cases/wire.js.map +1 -0
- package/dist/protocol/conformance/cases/writes.d.ts +3 -0
- package/dist/protocol/conformance/cases/writes.d.ts.map +1 -0
- package/dist/protocol/conformance/cases/writes.js +278 -0
- package/dist/protocol/conformance/cases/writes.js.map +1 -0
- package/dist/protocol/conformance/contentHashFixtures.d.ts +22 -0
- package/dist/protocol/conformance/contentHashFixtures.d.ts.map +1 -0
- package/dist/protocol/conformance/contentHashFixtures.js +64 -0
- package/dist/protocol/conformance/contentHashFixtures.js.map +1 -0
- package/dist/protocol/conformance/context.d.ts +100 -0
- package/dist/protocol/conformance/context.d.ts.map +1 -0
- package/dist/protocol/conformance/context.js +155 -0
- package/dist/protocol/conformance/context.js.map +1 -0
- package/dist/protocol/conformance/index.d.ts +32 -0
- package/dist/protocol/conformance/index.d.ts.map +1 -0
- package/dist/protocol/conformance/index.js +90 -0
- package/dist/protocol/conformance/index.js.map +1 -0
- package/dist/protocol/errors.d.ts +85 -0
- package/dist/protocol/errors.d.ts.map +1 -0
- package/dist/protocol/errors.js +62 -0
- package/dist/protocol/errors.js.map +1 -0
- package/dist/protocol/index.d.ts +25 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +25 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/protocol/keys.d.ts +101 -0
- package/dist/protocol/keys.d.ts.map +1 -0
- package/dist/protocol/keys.js +223 -0
- package/dist/protocol/keys.js.map +1 -0
- package/dist/protocol/params.d.ts +10 -0
- package/dist/protocol/params.d.ts.map +1 -0
- package/dist/protocol/params.js +54 -0
- package/dist/protocol/params.js.map +1 -0
- package/dist/protocol/secrets.d.ts +22 -0
- package/dist/protocol/secrets.d.ts.map +1 -0
- package/dist/protocol/secrets.js +200 -0
- package/dist/protocol/secrets.js.map +1 -0
- package/dist/protocol/server/assets.d.ts +20 -0
- package/dist/protocol/server/assets.d.ts.map +1 -0
- package/dist/protocol/server/assets.js +77 -0
- package/dist/protocol/server/assets.js.map +1 -0
- package/dist/protocol/server/auth.d.ts +31 -0
- package/dist/protocol/server/auth.d.ts.map +1 -0
- package/dist/protocol/server/auth.js +32 -0
- package/dist/protocol/server/auth.js.map +1 -0
- package/dist/protocol/server/bodyCache.d.ts +28 -0
- package/dist/protocol/server/bodyCache.d.ts.map +1 -0
- package/dist/protocol/server/bodyCache.js +75 -0
- package/dist/protocol/server/bodyCache.js.map +1 -0
- package/dist/protocol/server/content.d.ts +44 -0
- package/dist/protocol/server/content.d.ts.map +1 -0
- package/dist/protocol/server/content.js +132 -0
- package/dist/protocol/server/content.js.map +1 -0
- package/dist/protocol/server/core.d.ts +63 -0
- package/dist/protocol/server/core.d.ts.map +1 -0
- package/dist/protocol/server/core.js +77 -0
- package/dist/protocol/server/core.js.map +1 -0
- package/dist/protocol/server/handler.d.ts +5 -0
- package/dist/protocol/server/handler.d.ts.map +1 -0
- package/dist/protocol/server/handler.js +70 -0
- package/dist/protocol/server/handler.js.map +1 -0
- package/dist/protocol/server/http.d.ts +24 -0
- package/dist/protocol/server/http.d.ts.map +1 -0
- package/dist/protocol/server/http.js +133 -0
- package/dist/protocol/server/http.js.map +1 -0
- package/dist/protocol/server/index.d.ts +11 -0
- package/dist/protocol/server/index.d.ts.map +1 -0
- package/dist/protocol/server/index.js +9 -0
- package/dist/protocol/server/index.js.map +1 -0
- package/dist/protocol/server/methods/apply.d.ts +4 -0
- package/dist/protocol/server/methods/apply.d.ts.map +1 -0
- package/dist/protocol/server/methods/apply.js +275 -0
- package/dist/protocol/server/methods/apply.js.map +1 -0
- package/dist/protocol/server/methods/read.d.ts +14 -0
- package/dist/protocol/server/methods/read.d.ts.map +1 -0
- package/dist/protocol/server/methods/read.js +132 -0
- package/dist/protocol/server/methods/read.js.map +1 -0
- package/dist/protocol/server/rpc.d.ts +7 -0
- package/dist/protocol/server/rpc.d.ts.map +1 -0
- package/dist/protocol/server/rpc.js +115 -0
- package/dist/protocol/server/rpc.js.map +1 -0
- package/dist/protocol/storage/fs/hash.d.ts +8 -0
- package/dist/protocol/storage/fs/hash.d.ts.map +1 -0
- package/dist/protocol/storage/fs/hash.js +20 -0
- package/dist/protocol/storage/fs/hash.js.map +1 -0
- package/dist/protocol/storage/fs/index.d.ts +30 -0
- package/dist/protocol/storage/fs/index.d.ts.map +1 -0
- package/dist/protocol/storage/fs/index.js +301 -0
- package/dist/protocol/storage/fs/index.js.map +1 -0
- package/dist/protocol/storage/fs/lock.d.ts +8 -0
- package/dist/protocol/storage/fs/lock.d.ts.map +1 -0
- package/dist/protocol/storage/fs/lock.js +61 -0
- package/dist/protocol/storage/fs/lock.js.map +1 -0
- package/dist/protocol/storage/fs/transaction.d.ts +19 -0
- package/dist/protocol/storage/fs/transaction.d.ts.map +1 -0
- package/dist/protocol/storage/fs/transaction.js +174 -0
- package/dist/protocol/storage/fs/transaction.js.map +1 -0
- package/dist/protocol/storage/fs/unsupported.d.ts +10 -0
- package/dist/protocol/storage/fs/unsupported.d.ts.map +1 -0
- package/dist/protocol/storage/fs/unsupported.js +4 -0
- package/dist/protocol/storage/fs/unsupported.js.map +1 -0
- package/dist/protocol/storage/memory.d.ts +40 -0
- package/dist/protocol/storage/memory.d.ts.map +1 -0
- package/dist/protocol/storage/memory.js +179 -0
- package/dist/protocol/storage/memory.js.map +1 -0
- package/dist/protocol/storage.d.ts +178 -0
- package/dist/protocol/storage.d.ts.map +1 -0
- package/dist/protocol/storage.js +29 -0
- package/dist/protocol/storage.js.map +1 -0
- package/dist/protocol/types.d.ts +194 -0
- package/dist/protocol/types.d.ts.map +1 -0
- package/dist/protocol/types.js +31 -0
- package/dist/protocol/types.js.map +1 -0
- package/dist/v8/analytics.d.ts +31 -0
- package/dist/v8/analytics.d.ts.map +1 -0
- package/dist/v8/analytics.js +46 -0
- package/dist/v8/analytics.js.map +1 -0
- package/dist/v8/background.d.ts +26 -0
- package/dist/v8/background.d.ts.map +1 -0
- package/dist/v8/background.js +95 -0
- package/dist/v8/background.js.map +1 -0
- package/dist/v8/builtins/data.d.ts +15 -0
- package/dist/v8/builtins/data.d.ts.map +1 -0
- package/dist/v8/builtins/data.js +18 -0
- package/dist/v8/builtins/data.js.map +1 -0
- package/dist/v8/builtins/index.d.ts +9 -0
- package/dist/v8/builtins/index.d.ts.map +1 -0
- package/dist/v8/builtins/index.js +24 -0
- package/dist/v8/builtins/index.js.map +1 -0
- package/dist/v8/builtins/lazy.d.ts +17 -0
- package/dist/v8/builtins/lazy.d.ts.map +1 -0
- package/dist/v8/builtins/lazy.js +13 -0
- package/dist/v8/builtins/lazy.js.map +1 -0
- package/dist/v8/builtins/legacy.d.ts +41 -0
- package/dist/v8/builtins/legacy.d.ts.map +1 -0
- package/dist/v8/builtins/legacy.js +62 -0
- package/dist/v8/builtins/legacy.js.map +1 -0
- package/dist/v8/builtins/matchers.d.ts +19 -0
- package/dist/v8/builtins/matchers.d.ts.map +1 -0
- package/dist/v8/builtins/matchers.js +24 -0
- package/dist/v8/builtins/matchers.js.map +1 -0
- package/dist/v8/builtins/multivariate.d.ts +15 -0
- package/dist/v8/builtins/multivariate.d.ts.map +1 -0
- package/dist/v8/builtins/multivariate.js +18 -0
- package/dist/v8/builtins/multivariate.js.map +1 -0
- package/dist/v8/builtins/secret.d.ts +7 -0
- package/dist/v8/builtins/secret.d.ts.map +1 -0
- package/dist/v8/builtins/secret.js +68 -0
- package/dist/v8/builtins/secret.js.map +1 -0
- package/dist/v8/canonical.d.ts +42 -0
- package/dist/v8/canonical.d.ts.map +1 -0
- package/dist/v8/canonical.js +111 -0
- package/dist/v8/canonical.js.map +1 -0
- package/dist/v8/ciphertext.d.ts +58 -0
- package/dist/v8/ciphertext.d.ts.map +1 -0
- package/dist/v8/ciphertext.js +134 -0
- package/dist/v8/ciphertext.js.map +1 -0
- package/dist/v8/cli/builtins.d.ts +11 -0
- package/dist/v8/cli/builtins.d.ts.map +1 -0
- package/dist/v8/cli/builtins.js +18 -0
- package/dist/v8/cli/builtins.js.map +1 -0
- package/dist/v8/cli/check/index.d.ts +41 -0
- package/dist/v8/cli/check/index.d.ts.map +1 -0
- package/dist/v8/cli/check/index.js +713 -0
- package/dist/v8/cli/check/index.js.map +1 -0
- package/dist/v8/cli/check/messages.d.ts +24 -0
- package/dist/v8/cli/check/messages.d.ts.map +1 -0
- package/dist/v8/cli/check/messages.js +150 -0
- package/dist/v8/cli/check/messages.js.map +1 -0
- package/dist/v8/cli/content.d.ts +60 -0
- package/dist/v8/cli/content.d.ts.map +1 -0
- package/dist/v8/cli/content.js +231 -0
- package/dist/v8/cli/content.js.map +1 -0
- package/dist/v8/cli/index.d.ts +18 -0
- package/dist/v8/cli/index.d.ts.map +1 -0
- package/dist/v8/cli/index.js +18 -0
- package/dist/v8/cli/index.js.map +1 -0
- package/dist/v8/cli/log.d.ts +9 -0
- package/dist/v8/cli/log.d.ts.map +1 -0
- package/dist/v8/cli/log.js +11 -0
- package/dist/v8/cli/log.js.map +1 -0
- package/dist/v8/cli/main.d.ts +2 -0
- package/dist/v8/cli/main.d.ts.map +1 -0
- package/dist/v8/cli/main.js +9 -0
- package/dist/v8/cli/main.js.map +1 -0
- package/dist/v8/cli/root.d.ts +28 -0
- package/dist/v8/cli/root.d.ts.map +1 -0
- package/dist/v8/cli/root.js +64 -0
- package/dist/v8/cli/root.js.map +1 -0
- package/dist/v8/cli/run.d.ts +13 -0
- package/dist/v8/cli/run.d.ts.map +1 -0
- package/dist/v8/cli/run.js +210 -0
- package/dist/v8/cli/run.js.map +1 -0
- package/dist/v8/cli/schema/builtinSchemas.d.ts +22 -0
- package/dist/v8/cli/schema/builtinSchemas.d.ts.map +1 -0
- package/dist/v8/cli/schema/builtinSchemas.js +213 -0
- package/dist/v8/cli/schema/builtinSchemas.js.map +1 -0
- package/dist/v8/cli/schema/generate.d.ts +50 -0
- package/dist/v8/cli/schema/generate.d.ts.map +1 -0
- package/dist/v8/cli/schema/generate.js +415 -0
- package/dist/v8/cli/schema/generate.js.map +1 -0
- package/dist/v8/cli/schema/index.d.ts +21 -0
- package/dist/v8/cli/schema/index.d.ts.map +1 -0
- package/dist/v8/cli/schema/index.js +51 -0
- package/dist/v8/cli/schema/index.js.map +1 -0
- package/dist/v8/cli/schema/tsProgram.d.ts +120 -0
- package/dist/v8/cli/schema/tsProgram.d.ts.map +1 -0
- package/dist/v8/cli/schema/tsProgram.js +418 -0
- package/dist/v8/cli/schema/tsProgram.js.map +1 -0
- package/dist/v8/cli/schema/typeToSchema.d.ts +81 -0
- package/dist/v8/cli/schema/typeToSchema.d.ts.map +1 -0
- package/dist/v8/cli/schema/typeToSchema.js +683 -0
- package/dist/v8/cli/schema/typeToSchema.js.map +1 -0
- package/dist/v8/cli/serve/server.d.ts +31 -0
- package/dist/v8/cli/serve/server.d.ts.map +1 -0
- package/dist/v8/cli/serve/server.js +247 -0
- package/dist/v8/cli/serve/server.js.map +1 -0
- package/dist/v8/cli/watch.d.ts +20 -0
- package/dist/v8/cli/watch.d.ts.map +1 -0
- package/dist/v8/cli/watch.js +79 -0
- package/dist/v8/cli/watch.js.map +1 -0
- package/dist/v8/client.d.ts +20 -0
- package/dist/v8/client.d.ts.map +1 -0
- package/dist/v8/client.js +115 -0
- package/dist/v8/client.js.map +1 -0
- package/dist/v8/cms.d.ts +9 -0
- package/dist/v8/cms.d.ts.map +1 -0
- package/dist/v8/cms.js +206 -0
- package/dist/v8/cms.js.map +1 -0
- package/dist/v8/content.d.ts +35 -0
- package/dist/v8/content.d.ts.map +1 -0
- package/dist/v8/content.js +183 -0
- package/dist/v8/content.js.map +1 -0
- package/dist/v8/draft.d.ts +44 -0
- package/dist/v8/draft.d.ts.map +1 -0
- package/dist/v8/draft.js +133 -0
- package/dist/v8/draft.js.map +1 -0
- package/dist/v8/errors.d.ts +21 -0
- package/dist/v8/errors.d.ts.map +1 -0
- package/dist/v8/errors.js +39 -0
- package/dist/v8/errors.js.map +1 -0
- package/dist/v8/fetch.d.ts +26 -0
- package/dist/v8/fetch.d.ts.map +1 -0
- package/dist/v8/fetch.js +98 -0
- package/dist/v8/fetch.js.map +1 -0
- package/dist/v8/identity.d.ts +19 -0
- package/dist/v8/identity.d.ts.map +1 -0
- package/dist/v8/identity.js +54 -0
- package/dist/v8/identity.js.map +1 -0
- package/dist/v8/index.d.ts +11 -0
- package/dist/v8/index.d.ts.map +1 -0
- package/dist/v8/index.js +10 -0
- package/dist/v8/index.js.map +1 -0
- package/dist/v8/json.d.ts +19 -0
- package/dist/v8/json.d.ts.map +1 -0
- package/dist/v8/json.js +65 -0
- package/dist/v8/json.js.map +1 -0
- package/dist/v8/matchRoute.d.ts +30 -0
- package/dist/v8/matchRoute.d.ts.map +1 -0
- package/dist/v8/matchRoute.js +175 -0
- package/dist/v8/matchRoute.js.map +1 -0
- package/dist/v8/remoteLoader.d.ts +16 -0
- package/dist/v8/remoteLoader.d.ts.map +1 -0
- package/dist/v8/remoteLoader.js +243 -0
- package/dist/v8/remoteLoader.js.map +1 -0
- package/dist/v8/resolver.d.ts +34 -0
- package/dist/v8/resolver.d.ts.map +1 -0
- package/dist/v8/resolver.js +219 -0
- package/dist/v8/resolver.js.map +1 -0
- package/dist/v8/secrets.d.ts +9 -0
- package/dist/v8/secrets.d.ts.map +1 -0
- package/dist/v8/secrets.js +14 -0
- package/dist/v8/secrets.js.map +1 -0
- package/dist/v8/telemetry.d.ts +61 -0
- package/dist/v8/telemetry.d.ts.map +1 -0
- package/dist/v8/telemetry.js +460 -0
- package/dist/v8/telemetry.js.map +1 -0
- package/dist/v8/types.d.ts +214 -0
- package/dist/v8/types.d.ts.map +1 -0
- package/dist/v8/types.js +2 -0
- package/dist/v8/types.js.map +1 -0
- package/package.json +65 -105
- package/src/index.ts +3 -13
- package/src/protocol/canonical.ts +1 -1
- package/src/protocol/ciphertext.ts +1 -1
- package/src/protocol/client.ts +2 -2
- package/src/protocol/conformance/cases/assets.ts +3 -3
- package/src/protocol/conformance/cases/guards.ts +4 -4
- package/src/protocol/conformance/cases/reads.ts +4 -4
- package/src/protocol/conformance/cases/types.ts +1 -1
- package/src/protocol/conformance/cases/wire.ts +4 -4
- package/src/protocol/conformance/cases/writes.ts +4 -4
- package/src/protocol/conformance/context.ts +4 -4
- package/src/protocol/conformance/index.ts +10 -10
- package/src/protocol/index.ts +6 -6
- package/src/protocol/params.ts +2 -2
- package/src/protocol/secrets.ts +3 -3
- package/src/protocol/server/assets.ts +6 -6
- package/src/protocol/server/auth.ts +1 -1
- package/src/protocol/server/content.ts +5 -5
- package/src/protocol/server/core.ts +12 -6
- package/src/protocol/server/handler.ts +6 -6
- package/src/protocol/server/http.ts +1 -1
- package/src/protocol/server/index.ts +3 -3
- package/src/protocol/server/methods/apply.ts +9 -9
- package/src/protocol/server/methods/read.ts +5 -5
- package/src/protocol/server/rpc.ts +6 -6
- package/src/protocol/storage/fs/index.ts +7 -7
- package/src/protocol/storage/fs/lock.ts +1 -1
- package/src/protocol/storage/fs/unsupported.ts +2 -2
- package/src/protocol/storage/memory.ts +5 -5
- package/src/protocol/storage.ts +1 -1
- package/src/v8/analytics.ts +2 -2
- package/src/v8/background.ts +3 -3
- package/src/v8/builtins/data.ts +1 -1
- package/src/v8/builtins/index.ts +6 -6
- package/src/v8/builtins/lazy.ts +1 -1
- package/src/v8/builtins/legacy.ts +2 -2
- package/src/v8/builtins/multivariate.ts +1 -1
- package/src/v8/builtins/secret.ts +2 -2
- package/src/v8/cli/builtins.ts +2 -2
- package/src/v8/cli/check/index.ts +11 -11
- package/src/v8/cli/content.ts +6 -6
- package/src/v8/cli/index.ts +8 -8
- package/src/v8/cli/main.ts +1 -1
- package/src/v8/cli/run.ts +7 -7
- package/src/v8/cli/schema/builtinSchemas.ts +1 -1
- package/src/v8/cli/schema/generate.ts +6 -6
- package/src/v8/cli/schema/index.ts +4 -4
- package/src/v8/cli/schema/tsProgram.ts +1 -1
- package/src/v8/cli/schema/typeToSchema.ts +24 -2
- package/src/v8/cli/serve/server.ts +9 -9
- package/src/v8/client.ts +5 -5
- package/src/v8/cms.ts +9 -9
- package/src/v8/content.ts +4 -4
- package/src/v8/draft.ts +1 -1
- package/src/v8/errors.ts +1 -1
- package/src/v8/fetch.ts +9 -28
- package/src/v8/identity.ts +1 -1
- package/src/v8/index.ts +5 -5
- package/src/v8/matchRoute.ts +1 -1
- package/src/v8/remoteLoader.ts +7 -7
- package/src/v8/resolver.ts +6 -6
- package/src/v8/secrets.ts +1 -1
- package/src/v8/telemetry.ts +6 -6
- package/src/cms/applySectionConventions.ts +0 -148
- package/src/cms/blockSource.ts +0 -228
- package/src/cms/client.ts +0 -85
- package/src/cms/deferredTrigger.ts +0 -58
- package/src/cms/draftSource.ts +0 -476
- package/src/cms/index.ts +0 -180
- package/src/cms/loadDecofileDirectory.ts +0 -89
- package/src/cms/loader.ts +0 -563
- package/src/cms/registry.ts +0 -264
- package/src/cms/renderJson.ts +0 -179
- package/src/cms/resolve.ts +0 -2583
- package/src/cms/schema.ts +0 -1219
- package/src/cms/sectionLoaderContext.ts +0 -113
- package/src/cms/sectionLoaders.ts +0 -686
- package/src/cms/sectionMixins.ts +0 -153
- package/src/flags/audience.ts +0 -56
- package/src/flags/everyone.ts +0 -29
- package/src/flags/flag.ts +0 -15
- package/src/flags/multivariate/image.ts +0 -11
- package/src/flags/multivariate/message.ts +0 -11
- package/src/flags/multivariate/page.ts +0 -16
- package/src/flags/multivariate/section.ts +0 -16
- package/src/flags/multivariate.ts +0 -1
- package/src/flags/types.ts +0 -59
- package/src/flags/utils/multivariate.ts +0 -20
- package/src/hooks/Image.tsx +0 -314
- package/src/hooks/JsonLd.tsx +0 -353
- package/src/hooks/LazySection.tsx +0 -121
- package/src/hooks/LiveControls.tsx +0 -144
- package/src/hooks/Picture.tsx +0 -127
- package/src/hooks/RenderSection.tsx +0 -91
- package/src/hooks/SectionErrorFallback.tsx +0 -97
- package/src/hooks/Stats.tsx +0 -134
- package/src/hooks/index.ts +0 -35
- package/src/hooks/useLoadMore.ts +0 -100
- package/src/matchers/builtins.ts +0 -459
- package/src/matchers/countryNames.ts +0 -104
- package/src/matchers/override.ts +0 -136
- package/src/matchers/posthog.ts +0 -154
- package/src/middleware/decoState.ts +0 -55
- package/src/middleware/healthMetrics.ts +0 -133
- package/src/middleware/hydrationContext.ts +0 -79
- package/src/middleware/index.ts +0 -88
- package/src/middleware/liveness.ts +0 -21
- package/src/middleware/observability.ts +0 -800
- package/src/middleware/validateSection.ts +0 -100
- package/src/preview/DraftPreviewBadge.tsx +0 -306
- package/src/preview/decoMark.ts +0 -11
- package/src/preview/index.ts +0 -8
- package/src/sdk/abTesting.ts +0 -556
- package/src/sdk/analytics.ts +0 -147
- package/src/sdk/cacheHeaders.ts +0 -633
- package/src/sdk/cacheStorage.ts +0 -287
- package/src/sdk/cachedLoader.ts +0 -556
- package/src/sdk/clx.ts +0 -5
- package/src/sdk/cn.ts +0 -28
- package/src/sdk/composite.ts +0 -114
- package/src/sdk/cookie.ts +0 -129
- package/src/sdk/crypto.ts +0 -199
- package/src/sdk/csp.ts +0 -59
- package/src/sdk/deepOmit.ts +0 -52
- package/src/sdk/detectDevice.ts +0 -45
- package/src/sdk/djb2.ts +0 -20
- package/src/sdk/encoding.ts +0 -44
- package/src/sdk/env.ts +0 -54
- package/src/sdk/experiments.ts +0 -314
- package/src/sdk/fetchCache.ts +0 -269
- package/src/sdk/fetchTimeout.ts +0 -58
- package/src/sdk/flags.ts +0 -138
- package/src/sdk/http.ts +0 -124
- package/src/sdk/index.ts +0 -97
- package/src/sdk/inflightTimeout.ts +0 -53
- package/src/sdk/instrumentedFetch.ts +0 -362
- package/src/sdk/invoke.ts +0 -298
- package/src/sdk/logger.ts +0 -304
- package/src/sdk/mergeCacheControl.ts +0 -150
- package/src/sdk/nonce.ts +0 -46
- package/src/sdk/normalizeUrls.ts +0 -91
- package/src/sdk/observability.ts +0 -116
- package/src/sdk/otel.ts +0 -1118
- package/src/sdk/otelAdapters/clickhouseCollector.ts +0 -65
- package/src/sdk/otelAdapters.ts +0 -144
- package/src/sdk/otelHttpLog.ts +0 -419
- package/src/sdk/otelHttpMeter.ts +0 -532
- package/src/sdk/otelHttpTracer.ts +0 -543
- package/src/sdk/redirects.ts +0 -336
- package/src/sdk/requestContext.ts +0 -281
- package/src/sdk/requestContextStorage.browser.ts +0 -43
- package/src/sdk/requestContextStorage.ts +0 -35
- package/src/sdk/responseCache.ts +0 -82
- package/src/sdk/retry.ts +0 -45
- package/src/sdk/serverTimings.ts +0 -68
- package/src/sdk/signal.ts +0 -42
- package/src/sdk/sitemap.ts +0 -160
- package/src/sdk/urlRedaction.ts +0 -82
- package/src/sdk/urlUtils.ts +0 -183
- package/src/sdk/useDevice.ts +0 -89
- package/src/sdk/useDeviceContext.tsx +0 -108
- package/src/sdk/useId.ts +0 -7
- package/src/sdk/useScript.ts +0 -210
- package/src/sdk/useSuggestions.ts +0 -188
- package/src/sdk/wrapCaughtErrors.ts +0 -107
- package/src/setup.ts +0 -120
- package/src/types/index.ts +0 -53
- package/src/types/widgets.ts +0 -14
package/src/cms/blockSource.ts
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BlockSource — the runtime source of truth for the CMS decofile.
|
|
3
|
-
*
|
|
4
|
-
* A `BlockSource` asynchronously yields the *whole* decofile snapshot (the
|
|
5
|
-
* `Record<string, unknown>` blocks map) plus its revision hash. This is the
|
|
6
|
-
* "fast deploy" seam: the framework can hydrate the in-memory block map from a
|
|
7
|
-
* remote source (Cloudflare KV) on cold start and swap it on revision change,
|
|
8
|
-
* WITHOUT making the synchronous resolution hot path (`loadBlocks()` in
|
|
9
|
-
* `loader.ts`) async.
|
|
10
|
-
*
|
|
11
|
-
* Design note (whole-snapshot vs per-block): the resolver calls `loadBlocks()`
|
|
12
|
-
* synchronously in dozens of places (matchers, deferral checks, page lookup,
|
|
13
|
-
* SEO). Rather than threading `async` through all of that, a `BlockSource`
|
|
14
|
-
* loads the entire decofile once and the framework calls `setBlocks()` to swap
|
|
15
|
-
* the in-memory map. Per-request reads stay in-memory (zero added latency); KV
|
|
16
|
-
* is touched only on cold start and during the opportunistic revision poll.
|
|
17
|
-
*
|
|
18
|
-
* Mirrors the `DecofileProvider` pattern from the original deco-cx/deco Fresh
|
|
19
|
-
* runtime (`engine/decofile/provider.ts`), trimmed to what the snapshot-swap
|
|
20
|
-
* model needs.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
import { djb2Hex } from "../sdk/djb2";
|
|
24
|
-
|
|
25
|
-
/** A fully-loaded decofile snapshot: the blocks map and its revision hash. */
|
|
26
|
-
export interface BlockSnapshot {
|
|
27
|
-
/** The decofile — a flat map of block name → block JSON. */
|
|
28
|
-
blocks: Record<string, unknown>;
|
|
29
|
-
/** DJB2 hex revision computed over the blocks (see `computeRevision`). */
|
|
30
|
-
revision: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Source of the runtime decofile snapshot.
|
|
35
|
-
*
|
|
36
|
-
* Implementations:
|
|
37
|
-
* - `BundledBlockSource` — the build-time `blocks.gen` snapshot (fallback /
|
|
38
|
-
* local dev). A no-op here because `setup.ts` already loads it via
|
|
39
|
-
* `setBlocks()` at module init.
|
|
40
|
-
* - `KVBlockSource` — reads `decofile:<id>` + `index:revision:<id>` (keyed by
|
|
41
|
-
* deployment id) from a Cloudflare KV namespace.
|
|
42
|
-
*/
|
|
43
|
-
export interface BlockSource {
|
|
44
|
-
/**
|
|
45
|
-
* Load the full decofile snapshot. Returns `null` when this source has no
|
|
46
|
-
* snapshot to offer (e.g. KV key missing, or the bundled source which is
|
|
47
|
-
* already applied at startup) — the caller then keeps whatever blocks are
|
|
48
|
-
* currently in memory.
|
|
49
|
-
*/
|
|
50
|
-
loadSnapshot(): Promise<BlockSnapshot | null>;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Cheap revision probe used for change detection during polling. Returns the
|
|
54
|
-
* current revision without transferring the full snapshot, or `null` when
|
|
55
|
-
* unavailable.
|
|
56
|
-
*/
|
|
57
|
-
getRevision(): Promise<string | null>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Compute the revision hash for a blocks map.
|
|
62
|
-
*
|
|
63
|
-
* MUST match `computeRevision` in `loader.ts` (DJB2 over the JSON string) so
|
|
64
|
-
* that a snapshot written to KV and the revision stored alongside it agree
|
|
65
|
-
* with the revision an isolate computes after `setBlocks()` — otherwise the
|
|
66
|
-
* poller would see a permanent mismatch and reload on every tick.
|
|
67
|
-
*/
|
|
68
|
-
export function computeRevision(blocks: Record<string, unknown>): string {
|
|
69
|
-
return djb2Hex(JSON.stringify(blocks));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Bundled (build-time) snapshot source.
|
|
74
|
-
*
|
|
75
|
-
* Intentionally a no-op `loadSnapshot()`: the bundled `blocks.gen` is applied
|
|
76
|
-
* by `createSiteSetup()` → `setBlocks()` at module load, before any request.
|
|
77
|
-
* This exists so callers can treat "bundled" uniformly through the
|
|
78
|
-
* `BlockSource` interface and so the composition layer (KV primary + bundled
|
|
79
|
-
* fallback) has a concrete fallback object.
|
|
80
|
-
*/
|
|
81
|
-
export class BundledBlockSource implements BlockSource {
|
|
82
|
-
loadSnapshot(): Promise<BlockSnapshot | null> {
|
|
83
|
-
return Promise.resolve(null);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
getRevision(): Promise<string | null> {
|
|
87
|
-
return Promise.resolve(null);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// ---------------------------------------------------------------------------
|
|
92
|
-
// Minimal Cloudflare KV type
|
|
93
|
-
// ---------------------------------------------------------------------------
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Minimal structural type for a Cloudflare KV namespace binding.
|
|
97
|
-
*
|
|
98
|
-
* Declared locally (matching the pattern in `workerEntry.ts`, which defines
|
|
99
|
-
* its own `WorkerExecutionContext`) so `@decocms/start` does not depend on
|
|
100
|
-
* `@cloudflare/workers-types`. Only the methods the framework actually uses
|
|
101
|
-
* are modeled.
|
|
102
|
-
*/
|
|
103
|
-
export interface KVNamespace {
|
|
104
|
-
get(key: string, options?: { type?: "text" }): Promise<string | null>;
|
|
105
|
-
put(
|
|
106
|
-
key: string,
|
|
107
|
-
value: string,
|
|
108
|
-
options?: { expirationTtl?: number; metadata?: Record<string, unknown> },
|
|
109
|
-
): Promise<void>;
|
|
110
|
-
delete(key: string): Promise<void>;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// ---------------------------------------------------------------------------
|
|
114
|
-
// KV key layout — keyed by DEPLOYMENT ID so every code deployment reads its own
|
|
115
|
-
// content snapshot (deploy isolation, cheap rollback, build-time content sync).
|
|
116
|
-
//
|
|
117
|
-
// The deployment id is the git commit sha (see `getDeploymentId` below).
|
|
118
|
-
// Shared by the runtime reader (`kvBlockSource.ts`), the write-through path
|
|
119
|
-
// (`admin/decofile.ts`), and the CI sync/migrate scripts, so the contract can't
|
|
120
|
-
// drift between read and write sides.
|
|
121
|
-
//
|
|
122
|
-
// decofile:<id> full decofile JSON for deployment <id>
|
|
123
|
-
// index:revision:<id> DJB2 hex revision of that snapshot (polled)
|
|
124
|
-
// index:live pointer to the currently-live <id> (set post-deploy)
|
|
125
|
-
// index:deployments JSON [{id, ts}] (newest last) — GC bookkeeping
|
|
126
|
-
// redirect:<id>:<path> ONE key per exact redirect (see below)
|
|
127
|
-
// ---------------------------------------------------------------------------
|
|
128
|
-
|
|
129
|
-
/** KV key holding the full decofile JSON for deployment `id`. */
|
|
130
|
-
export function snapshotKey(id: string): string {
|
|
131
|
-
return `decofile:${id}`;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/** KV key holding the DJB2 hex revision of deployment `id`'s snapshot. */
|
|
135
|
-
export function revisionKey(id: string): string {
|
|
136
|
-
return `index:revision:${id}`;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/** Pointer key naming the currently-live deployment id. Written by a code
|
|
140
|
-
* deploy AFTER the new version has activated (so a rolling deploy never points
|
|
141
|
-
* live at a version that isn't serving yet). */
|
|
142
|
-
export const LIVE_KEY = "index:live";
|
|
143
|
-
|
|
144
|
-
/** Bookkeeping key: JSON array of `{ id, ts }` (newest last) tracking known
|
|
145
|
-
* deployment snapshots so the sync script can GC all but the last N. */
|
|
146
|
-
export const DEPLOYMENTS_KEY = "index:deployments";
|
|
147
|
-
|
|
148
|
-
// ---------------------------------------------------------------------------
|
|
149
|
-
// Exact redirects — one KV key each, deliberately NOT inside the decofile.
|
|
150
|
-
//
|
|
151
|
-
// A bulk-migration site can carry tens of thousands of rules. Inside the
|
|
152
|
-
// decofile they are resident in every isolate twice over: once in the parsed
|
|
153
|
-
// snapshot graph, once in the `RedirectMap` built from it — megabytes of a
|
|
154
|
-
// 128MB budget, for data that is read at most once per request and usually
|
|
155
|
-
// never. As their own keys they are looked up on demand and the list is never
|
|
156
|
-
// loaded at all.
|
|
157
|
-
//
|
|
158
|
-
// Only EXACT rules move. Glob rules (`/old/*`) cannot be addressed by key and
|
|
159
|
-
// must be scanned in order, so they stay in the decofile — there are tens of
|
|
160
|
-
// them, not thousands.
|
|
161
|
-
// ---------------------------------------------------------------------------
|
|
162
|
-
|
|
163
|
-
/** Key prefix holding deployment `id`'s exact redirects (one key per path). */
|
|
164
|
-
export function redirectPrefix(id: string): string {
|
|
165
|
-
return `redirect:${id}:`;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* KV key for one exact redirect. `path` MUST already be normalized by
|
|
170
|
-
* `normalizePath` (`@decocms/blocks/sdk/redirects`) on both sides — the writer
|
|
171
|
-
* and the request-time lookup — or a rule is written under a key nothing ever
|
|
172
|
-
* asks for.
|
|
173
|
-
*/
|
|
174
|
-
export function redirectKey(id: string, path: string): string {
|
|
175
|
-
return `${redirectPrefix(id)}${path}`;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/** Value stored at a `redirect:<id>:<path>` key. */
|
|
179
|
-
export interface StoredRedirect {
|
|
180
|
-
to: string;
|
|
181
|
-
status: 301 | 302;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// ---------------------------------------------------------------------------
|
|
185
|
-
// Deployment id resolution
|
|
186
|
-
//
|
|
187
|
-
// Which snapshot key does THIS running worker read/write? The deployment id.
|
|
188
|
-
// Kept here (framework-agnostic) alongside the key builders it feeds, so the
|
|
189
|
-
// runtime read path (`@decocms/tanstack` kvHydration) and the write-through
|
|
190
|
-
// path (`@decocms/blocks-admin` decofile) resolve it identically — no drift.
|
|
191
|
-
// ---------------------------------------------------------------------------
|
|
192
|
-
|
|
193
|
-
/** Deploy-time var naming this version's content snapshot key. Set by the
|
|
194
|
-
* deploy command (`wrangler deploy --var DECO_DEPLOYMENT_ID:<sha>`). */
|
|
195
|
-
export const DEPLOYMENT_ID_ENV = "DECO_DEPLOYMENT_ID";
|
|
196
|
-
|
|
197
|
-
/** Fallback var (cache-key version) — the same commit sha, already threaded by
|
|
198
|
-
* some sites via `--var BUILD_HASH:<sha>`. */
|
|
199
|
-
export const BUILD_HASH_ENV = "BUILD_HASH";
|
|
200
|
-
|
|
201
|
-
// Build-time constant injected by the tanstack `decoVitePlugin()` (git
|
|
202
|
-
// rev-parse / WORKERS_CI_COMMIT_SHA) as the last-resort deployment id. Declared
|
|
203
|
-
// here with a `typeof` guard so it's inert where the define isn't applied
|
|
204
|
-
// (e.g. the Next.js build, or this package's own tsc output).
|
|
205
|
-
declare const __DECO_BUILD_HASH__: string | undefined;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Resolve this worker's deployment id — the key its content is stored under
|
|
209
|
-
* (`decofile:<id>`). Priority:
|
|
210
|
-
* 1. `env.DECO_DEPLOYMENT_ID` — set by the deploy command (authoritative).
|
|
211
|
-
* 2. `env.BUILD_HASH` — the cache-key version var; the same commit sha.
|
|
212
|
-
* 3. `__DECO_BUILD_HASH__` — build-time constant (the commit the bundle, and
|
|
213
|
-
* thus the build-time content sync, was produced from).
|
|
214
|
-
* Returns `null` when none resolves — the caller then serves the bundled
|
|
215
|
-
* snapshot (never another deployment's content).
|
|
216
|
-
*/
|
|
217
|
-
export function getDeploymentId(env: Record<string, unknown>): string | null {
|
|
218
|
-
const fromDeploymentVar = env[DEPLOYMENT_ID_ENV];
|
|
219
|
-
if (typeof fromDeploymentVar === "string" && fromDeploymentVar) {
|
|
220
|
-
return fromDeploymentVar;
|
|
221
|
-
}
|
|
222
|
-
const fromBuildHash = env[BUILD_HASH_ENV];
|
|
223
|
-
if (typeof fromBuildHash === "string" && fromBuildHash) return fromBuildHash;
|
|
224
|
-
if (typeof __DECO_BUILD_HASH__ !== "undefined" && __DECO_BUILD_HASH__) {
|
|
225
|
-
return __DECO_BUILD_HASH__;
|
|
226
|
-
}
|
|
227
|
-
return null;
|
|
228
|
-
}
|
package/src/cms/client.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-safe subset of `@decocms/blocks/cms`.
|
|
3
|
-
*
|
|
4
|
-
* `@decocms/blocks/cms` (the full barrel in `./index.ts`) re-exports
|
|
5
|
-
* `loader.ts` and `resolve.ts`, which transitively import `node:async_hooks`
|
|
6
|
-
* and `node:fs/promises`. Bundling ANY export from that barrel for a browser
|
|
7
|
-
* target — even one that itself has zero Node dependencies, like
|
|
8
|
-
* `getResolvedComponent` — drags the whole module graph in, since ES module
|
|
9
|
-
* imports are evaluated at the file level, not per-export. Turbopack rejects
|
|
10
|
-
* this outright in production builds ("the chunking context does not
|
|
11
|
-
* support external modules"); webpack has historically let it through
|
|
12
|
-
* uncaught, which just defers the failure to whoever notices the bloated
|
|
13
|
-
* client bundle or a runtime error.
|
|
14
|
-
*
|
|
15
|
-
* This entry point exists so Client Components can import section-registry
|
|
16
|
-
* lookups (e.g. to resolve and render a section by name, given data already
|
|
17
|
-
* fetched server-side) without pulling in the resolver/loader machinery.
|
|
18
|
-
*
|
|
19
|
-
* Verified client-safe by import-graph inspection, transitively:
|
|
20
|
-
* - `registry.ts` imports only React types.
|
|
21
|
-
* - `sectionMixins.ts` imports `useDevice.ts`, which goes through
|
|
22
|
-
* `requestContext.ts` — that module's only `node:async_hooks` dependency
|
|
23
|
-
* (`requestContextStorage.ts`) is itself swapped for a no-op browser stub
|
|
24
|
-
* via this package's `"browser"` export condition (see
|
|
25
|
-
* `sdk/requestContextStorage.browser.ts`), so it's already safe for a
|
|
26
|
-
* browser bundle.
|
|
27
|
-
* - `schema.ts` has no imports at all.
|
|
28
|
-
* - `deferredTrigger.ts` has no imports at all — it only reads the
|
|
29
|
-
* `globalThis.__deco.asyncConfig` bag `resolve.ts` writes, which is exactly
|
|
30
|
-
* why it is a standalone module instead of living in `resolve.ts`.
|
|
31
|
-
*
|
|
32
|
-
* Deliberately NOT re-exported here: `loader.ts`, `resolve.ts`,
|
|
33
|
-
* `sectionLoaders.ts`, `loadDecofileDirectory.ts`, `blockSource.ts`, and
|
|
34
|
-
* `applySectionConventions.ts` (which itself pulls in `resolve.ts` and
|
|
35
|
-
* `sectionLoaders.ts` for section-registration setup). Those are resolver/
|
|
36
|
-
* storage concerns that only make sense server-side — import them from
|
|
37
|
-
* `@decocms/blocks/cms` instead.
|
|
38
|
-
*/
|
|
39
|
-
export type { DeferredTrigger } from "./deferredTrigger";
|
|
40
|
-
export { DEFAULT_DEFERRED_TRIGGER, getDeferredTrigger } from "./deferredTrigger";
|
|
41
|
-
export type { OnBeforeResolveProps, SectionModule, SectionOptions } from "./registry";
|
|
42
|
-
export {
|
|
43
|
-
getResolvedComponent,
|
|
44
|
-
getSection,
|
|
45
|
-
getSectionOptions,
|
|
46
|
-
getSectionRegistry,
|
|
47
|
-
getSyncComponent,
|
|
48
|
-
listRegisteredSections,
|
|
49
|
-
preloadSectionComponents,
|
|
50
|
-
preloadSectionModule,
|
|
51
|
-
registerOnBeforeResolveProps,
|
|
52
|
-
registerSection,
|
|
53
|
-
registerSections,
|
|
54
|
-
registerSectionsSync,
|
|
55
|
-
setResolvedComponent,
|
|
56
|
-
} from "./registry";
|
|
57
|
-
export type {
|
|
58
|
-
ActionConfig,
|
|
59
|
-
AppSchemas,
|
|
60
|
-
BlockPropsSchema,
|
|
61
|
-
LoaderConfig,
|
|
62
|
-
MatcherConfig,
|
|
63
|
-
MetaResponse,
|
|
64
|
-
} from "./schema";
|
|
65
|
-
export {
|
|
66
|
-
composeMeta,
|
|
67
|
-
getRegisteredLoaders,
|
|
68
|
-
getRegisteredMatchers,
|
|
69
|
-
inferLoaderTags,
|
|
70
|
-
registerActionSchema,
|
|
71
|
-
registerActionSchemas,
|
|
72
|
-
registerAppSchemas,
|
|
73
|
-
registerLoaderSchema,
|
|
74
|
-
registerLoaderSchemas,
|
|
75
|
-
registerMatcherSchema,
|
|
76
|
-
registerMatcherSchemas,
|
|
77
|
-
} from "./schema";
|
|
78
|
-
export type { SectionLoaderFn } from "./sectionLoaders";
|
|
79
|
-
export {
|
|
80
|
-
compose,
|
|
81
|
-
withDevice,
|
|
82
|
-
withMobile,
|
|
83
|
-
withSearchParam,
|
|
84
|
-
withSectionLoader,
|
|
85
|
-
} from "./sectionMixins";
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-safe reader for the deferred-section trigger mode.
|
|
3
|
-
*
|
|
4
|
-
* Lives in its own module — with zero imports — so a browser bundle can reach
|
|
5
|
-
* it without dragging in `resolve.ts` (and its `node:async_hooks` /
|
|
6
|
-
* `node:fs/promises` chain). Same reasoning as `cms/client.ts`; see the header
|
|
7
|
-
* comment there.
|
|
8
|
-
*
|
|
9
|
-
* The value itself is written by `setAsyncRenderingConfig()` in `resolve.ts`,
|
|
10
|
-
* into the same `globalThis.__deco.asyncConfig` bag the server reads.
|
|
11
|
-
*
|
|
12
|
-
* WHERE THE SETTING HAS TO RUN: this is read in the browser, so
|
|
13
|
-
* `setAsyncRenderingConfig()` only takes effect if it runs in a module the
|
|
14
|
-
* client bundle also loads — normally `setup.ts`, imported from `router.tsx`.
|
|
15
|
-
* Set it from server-only code (the worker entry, `server.ts`) and the server
|
|
16
|
-
* defers the section as expected while the client silently falls back to
|
|
17
|
-
* `"intersection"`, which looks exactly like the option being ignored.
|
|
18
|
-
*
|
|
19
|
-
* WHO READS IT: only `@decocms/tanstack` (`DeferredSectionWrapper` in
|
|
20
|
-
* `hooks/DecoPageRenderer.tsx`). It lives here because that is where
|
|
21
|
-
* `AsyncRenderingConfig` lives; in `@decocms/nextjs` it is a no-op.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* How a deferred (⚡) section decides it's time to fetch its real markup.
|
|
26
|
-
*
|
|
27
|
-
* - `"intersection"` — wait until the skeleton is within 300px of the viewport.
|
|
28
|
-
* Cheapest, and the default.
|
|
29
|
-
* - `"load"` — fetch as soon as the wrapper mounts, without waiting for scroll.
|
|
30
|
-
* This is what Deco on Fresh does through `DispatchAsyncRender`'s
|
|
31
|
-
* `partialTriggerMode: "load"`: the page ships a light skeleton HTML and then
|
|
32
|
-
* materializes every deferred section right after hydration. Sites migrating
|
|
33
|
-
* from Fresh need this to keep parity — under `"intersection"` alone, content
|
|
34
|
-
* below the fold does not exist until the user scrolls, which loses
|
|
35
|
-
* below-the-fold analytics impressions and leaves the document short.
|
|
36
|
-
*
|
|
37
|
-
* The tradeoff of `"load"` is a request burst: every deferred section fires its
|
|
38
|
-
* serverFn POST in the same commit, on first load and again on every SPA
|
|
39
|
-
* navigation. That is precisely what the rAF + observer path exists to avoid,
|
|
40
|
-
* and it is also exactly what Fresh does — so it is the right default for a
|
|
41
|
-
* migrated site and the wrong one for a page with many heavy deferred sections.
|
|
42
|
-
* The switch is site-wide; a per-section override (honouring the `loading` prop
|
|
43
|
-
* the CMS `Lazy.tsx` wrapper already carries, which the resolver currently
|
|
44
|
-
* discards) would be the finer-grained successor.
|
|
45
|
-
*/
|
|
46
|
-
export type DeferredTrigger = "intersection" | "load";
|
|
47
|
-
|
|
48
|
-
export const DEFAULT_DEFERRED_TRIGGER: DeferredTrigger = "intersection";
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Read the configured trigger. Falls back to `"intersection"` when
|
|
52
|
-
* `setAsyncRenderingConfig()` was never called or omitted the option, so
|
|
53
|
-
* existing sites are not regressed by a framework bump.
|
|
54
|
-
*/
|
|
55
|
-
export function getDeferredTrigger(): DeferredTrigger {
|
|
56
|
-
const config = (globalThis as any).__deco?.asyncConfig;
|
|
57
|
-
return config?.deferredTrigger ?? DEFAULT_DEFERRED_TRIGGER;
|
|
58
|
-
}
|