@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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { writeIfChanged } from "../content";
|
|
3
|
-
import { consoleReporter, type Reporter } from "../log";
|
|
4
|
-
import { CliError, type DecoPaths, decoPaths, findDecoRoot } from "../root";
|
|
5
|
-
import { generateSchema, type SchemaResult } from "./generate";
|
|
2
|
+
import { writeIfChanged } from "../content.ts";
|
|
3
|
+
import { consoleReporter, type Reporter } from "../log.ts";
|
|
4
|
+
import { CliError, type DecoPaths, decoPaths, findDecoRoot } from "../root.ts";
|
|
5
|
+
import { generateSchema, type SchemaResult } from "./generate.ts";
|
|
6
6
|
|
|
7
7
|
export interface SchemaOptions {
|
|
8
8
|
root?: string;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
import fs from "node:fs";
|
|
25
25
|
import path from "node:path";
|
|
26
|
-
import type { TsSymbol as MorphSymbol, TsType as Type } from "./tsProgram";
|
|
26
|
+
import type { TsSymbol as MorphSymbol, TsType as Type } from "./tsProgram.ts";
|
|
27
27
|
|
|
28
28
|
export const RESOLVABLE_KEY = "Resolvable";
|
|
29
29
|
export const SECTION_REF_KEY = "__SECTION_REF__";
|
|
@@ -662,9 +662,14 @@ export function typeToJsonSchema(
|
|
|
662
662
|
* A machine-independent id for a source file: relative to the app root, or
|
|
663
663
|
* `<package name>/<path in package>` for a file in a dependency (including a
|
|
664
664
|
* workspace package the checker reached through a symlink).
|
|
665
|
+
*
|
|
666
|
+
* A declaration file with a declaration map (`x.d.ts` + `x.d.ts.map`, as
|
|
667
|
+
* `tsc` emits into a package's dist/) is named after the source it was
|
|
668
|
+
* compiled from, so a type keeps one id whether the checker read the
|
|
669
|
+
* package's compiled `.d.ts` or its `.ts` source (the "source" condition).
|
|
665
670
|
*/
|
|
666
671
|
export function stableFileId(filePath: string, root: string): string {
|
|
667
|
-
const file = filePath.replace(/^file:\/+/, "/");
|
|
672
|
+
const file = sourceOfDeclaration(filePath.replace(/^file:\/+/, "/"));
|
|
668
673
|
const nm = file.lastIndexOf("/node_modules/");
|
|
669
674
|
if (nm >= 0) return file.slice(nm + "/node_modules/".length);
|
|
670
675
|
const rel = path.relative(root, file).split(path.sep).join("/");
|
|
@@ -687,3 +692,20 @@ export function stableFileId(filePath: string, root: string): string {
|
|
|
687
692
|
dir = parent;
|
|
688
693
|
}
|
|
689
694
|
}
|
|
695
|
+
|
|
696
|
+
/** The `.ts` file a `.d.ts` was emitted from, per its declaration map; else the file itself. */
|
|
697
|
+
function sourceOfDeclaration(file: string): string {
|
|
698
|
+
if (!/\.d\.[cm]?ts$/.test(file)) return file;
|
|
699
|
+
try {
|
|
700
|
+
const map = JSON.parse(fs.readFileSync(`${file}.map`, "utf8")) as {
|
|
701
|
+
sources?: unknown;
|
|
702
|
+
sourceRoot?: unknown;
|
|
703
|
+
};
|
|
704
|
+
const source = Array.isArray(map.sources) ? map.sources[0] : undefined;
|
|
705
|
+
if (typeof source !== "string") return file;
|
|
706
|
+
const sourceRoot = typeof map.sourceRoot === "string" ? map.sourceRoot : "";
|
|
707
|
+
return path.resolve(path.dirname(file), sourceRoot, source);
|
|
708
|
+
} catch {
|
|
709
|
+
return file;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
@@ -20,15 +20,15 @@ import http from "node:http";
|
|
|
20
20
|
import type { AddressInfo } from "node:net";
|
|
21
21
|
import path from "node:path";
|
|
22
22
|
import { Readable } from "node:stream";
|
|
23
|
-
import { ErrorCode } from "../../../protocol/errors";
|
|
24
|
-
import { blockNameFromFile } from "../../../protocol/keys";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import
|
|
28
|
-
import {
|
|
29
|
-
import { readSavedBlocks, writeContent } from "../content";
|
|
30
|
-
import { consoleReporter, type Reporter } from "../log";
|
|
31
|
-
import { CliError, decoPaths, findDecoRoot, packageVersion } from "../root";
|
|
23
|
+
import { ErrorCode } from "../../../protocol/errors.ts";
|
|
24
|
+
import { blockNameFromFile } from "../../../protocol/keys.ts";
|
|
25
|
+
import { createAssetHandler } from "../../../protocol/server/assets.ts";
|
|
26
|
+
import { createContentHandler } from "../../../protocol/server/index.ts";
|
|
27
|
+
import { createFsStorage } from "../../../protocol/storage/fs/index.ts";
|
|
28
|
+
import type { ContentStorage } from "../../../protocol/storage.ts";
|
|
29
|
+
import { readSavedBlocks, writeContent } from "../content.ts";
|
|
30
|
+
import { consoleReporter, type Reporter } from "../log.ts";
|
|
31
|
+
import { CliError, decoPaths, findDecoRoot, packageVersion } from "../root.ts";
|
|
32
32
|
|
|
33
33
|
/** The site editor's origins: the browser origins allowed by default. */
|
|
34
34
|
const STUDIO_ORIGINS = [
|
package/src/v8/client.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* A client: one revision, loaded on first use and read for the rest of its
|
|
3
3
|
* life, plus a memo of block results. Create one per request.
|
|
4
4
|
*/
|
|
5
|
-
import { errors, isResolutionError, ResolutionError } from "./errors";
|
|
6
|
-
import { isBlock } from "./json";
|
|
7
|
-
import { Resolver } from "./resolver";
|
|
8
|
-
import type { ClientTelemetry } from "./telemetry";
|
|
5
|
+
import { errors, isResolutionError, ResolutionError } from "./errors.ts";
|
|
6
|
+
import { isBlock } from "./json.ts";
|
|
7
|
+
import { Resolver } from "./resolver.ts";
|
|
8
|
+
import type { ClientTelemetry } from "./telemetry.ts";
|
|
9
9
|
import type {
|
|
10
10
|
Block,
|
|
11
11
|
Blocks,
|
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
ResolveOptions,
|
|
16
16
|
Result,
|
|
17
17
|
Snapshot,
|
|
18
|
-
} from "./types";
|
|
18
|
+
} from "./types.ts";
|
|
19
19
|
|
|
20
20
|
interface ClientOptions {
|
|
21
21
|
/** Loads this client's snapshot; called at most once. */
|
package/src/v8/cms.ts
CHANGED
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
* a package loaded twice (two bundles, a dev reload) still shares one content
|
|
7
7
|
* cache. See /next/api-reference#one-instance-per-process.
|
|
8
8
|
*/
|
|
9
|
-
import { runInBackground } from "./background";
|
|
10
|
-
import { builtIns } from "./builtins/index";
|
|
11
|
-
import { secretBlock } from "./builtins/secret";
|
|
12
|
-
import { CMSClient } from "./client";
|
|
13
|
-
import { ContentStore, isLoader, isSnapshot } from "./content";
|
|
14
|
-
import { clearGlobals, contentIdentity, fnv1a, readEnv } from "./identity";
|
|
15
|
-
import { remoteLoader, resetRemoteLoaders } from "./remoteLoader";
|
|
16
|
-
import { resolveDestination, setCurrentTelemetry, TelemetryPipeline } from "./telemetry";
|
|
17
|
-
import type { Blocks, Client, CMS, CMSConfig, Loader, Snapshot } from "./types";
|
|
9
|
+
import { runInBackground } from "./background.ts";
|
|
10
|
+
import { builtIns } from "./builtins/index.ts";
|
|
11
|
+
import { secretBlock } from "./builtins/secret.ts";
|
|
12
|
+
import { CMSClient } from "./client.ts";
|
|
13
|
+
import { ContentStore, isLoader, isSnapshot } from "./content.ts";
|
|
14
|
+
import { clearGlobals, contentIdentity, fnv1a, readEnv } from "./identity.ts";
|
|
15
|
+
import { remoteLoader, resetRemoteLoaders } from "./remoteLoader.ts";
|
|
16
|
+
import { resolveDestination, setCurrentTelemetry, TelemetryPipeline } from "./telemetry.ts";
|
|
17
|
+
import type { Blocks, Client, CMS, CMSConfig, Loader, Snapshot } from "./types.ts";
|
|
18
18
|
|
|
19
19
|
const INSTANCE_PREFIX = "decocms.blocks.cms:";
|
|
20
20
|
const MIN_INTERVAL = 60_000;
|
package/src/v8/content.ts
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
* revision string a client may hand back, so it must only ever reach published
|
|
8
8
|
* content, never a draft someone loaded with a pointer.
|
|
9
9
|
*/
|
|
10
|
-
import { formatDraftPointer, parseDraftPointer } from "./draft";
|
|
11
|
-
import { errors, isResolutionError } from "./errors";
|
|
12
|
-
import { isPlainObject } from "./json";
|
|
13
|
-
import type { Loader, Snapshot } from "./types";
|
|
10
|
+
import { formatDraftPointer, parseDraftPointer } from "./draft.ts";
|
|
11
|
+
import { errors, isResolutionError } from "./errors.ts";
|
|
12
|
+
import { isPlainObject } from "./json.ts";
|
|
13
|
+
import type { Loader, Snapshot } from "./types.ts";
|
|
14
14
|
|
|
15
15
|
const SERVED_REVISIONS = 16;
|
|
16
16
|
const CACHED_DRAFTS = 32;
|
package/src/v8/draft.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* `<host[:port]><path[?query]>@<version>` that names a draft, and the two
|
|
4
4
|
* helpers that carry one from a `?__draft=` link into a cookie.
|
|
5
5
|
*/
|
|
6
|
-
import type { DraftPointer } from "./types";
|
|
6
|
+
import type { DraftPointer } from "./types.ts";
|
|
7
7
|
|
|
8
8
|
/** The draft cookie's name, for frameworks whose cookie API has no Request (Next.js `cookies()`). */
|
|
9
9
|
export const DRAFT_COOKIE = "deco-draft";
|
package/src/v8/errors.ts
CHANGED
package/src/v8/fetch.ts
CHANGED
|
@@ -9,12 +9,16 @@
|
|
|
9
9
|
* has no telemetry destination. Nothing about a request's body, headers or
|
|
10
10
|
* query string is recorded.
|
|
11
11
|
*/
|
|
12
|
-
import { currentTelemetry, describe, newTraceId } from "./telemetry";
|
|
12
|
+
import { currentTelemetry, describe, newTraceId } from "./telemetry.ts";
|
|
13
13
|
|
|
14
14
|
interface InstrumentedFetchOptions {
|
|
15
15
|
/** The provider label, e.g. "vtex", "acme-search". */
|
|
16
16
|
provider: string;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* The fetch underneath; defaults to `globalThis.fetch`. An upstream cache
|
|
19
|
+
* goes here (see /next/caching#upstream-data); a response it serves from
|
|
20
|
+
* the cache carries `x-cache: HIT` and is measured with `cached=true`.
|
|
21
|
+
*/
|
|
18
22
|
fetch?: typeof fetch;
|
|
19
23
|
/** Off unless set. `attempts` is how many times a failed request is retried; a retried request is measured once. */
|
|
20
24
|
retry?: { attempts: number; backoffMs?: number };
|
|
@@ -27,19 +31,6 @@ type InstrumentedFetch = (
|
|
|
27
31
|
init?: RequestInit & { operation?: string },
|
|
28
32
|
) => Promise<Response>;
|
|
29
33
|
|
|
30
|
-
/**
|
|
31
|
-
* Where a framework binding installs its upstream cache (on Workers,
|
|
32
|
-
* `@decocms/tanstack` installs one over the Cache API). GETs go through it,
|
|
33
|
-
* and it reports whether the response came from the cache.
|
|
34
|
-
*/
|
|
35
|
-
const UPSTREAM_CACHE = Symbol.for("decocms.blocks.upstreamCache");
|
|
36
|
-
|
|
37
|
-
type UpstreamCache = (
|
|
38
|
-
input: string | URL | Request,
|
|
39
|
-
init: RequestInit,
|
|
40
|
-
fetch: typeof globalThis.fetch,
|
|
41
|
-
) => Promise<{ response: Response; cached: boolean }>;
|
|
42
|
-
|
|
43
34
|
/** Statuses worth retrying: rate limits and gateway errors. */
|
|
44
35
|
const RETRY_STATUSES = new Set([429, 502, 503, 504]);
|
|
45
36
|
/** Only requests that are safe to repeat are retried. */
|
|
@@ -55,17 +46,7 @@ export function createInstrumentedFetch(options: InstrumentedFetchOptions): Inst
|
|
|
55
46
|
const method = (
|
|
56
47
|
requestInit.method ?? (input instanceof Request ? input.method : "GET")
|
|
57
48
|
).toUpperCase();
|
|
58
|
-
const
|
|
59
|
-
const cache = (globalThis as Record<symbol, UpstreamCache | undefined>)[UPSTREAM_CACHE];
|
|
60
|
-
let cached = false;
|
|
61
|
-
const doFetch: typeof globalThis.fetch =
|
|
62
|
-
typeof cache === "function" && method === "GET"
|
|
63
|
-
? async (request, requestInit = {}) => {
|
|
64
|
-
const hit = await cache(request as string | URL | Request, requestInit, origin);
|
|
65
|
-
cached = hit.cached;
|
|
66
|
-
return hit.response;
|
|
67
|
-
}
|
|
68
|
-
: origin;
|
|
49
|
+
const doFetch = options.fetch ?? globalThis.fetch;
|
|
69
50
|
const maxRetries =
|
|
70
51
|
retry && IDEMPOTENT.has(method) ? Math.max(0, Math.floor(retry.attempts)) : 0;
|
|
71
52
|
const startedAt = Date.now();
|
|
@@ -112,8 +93,8 @@ export function createInstrumentedFetch(options: InstrumentedFetchOptions): Inst
|
|
|
112
93
|
provider,
|
|
113
94
|
operation,
|
|
114
95
|
status_class: response ? `${Math.floor(response.status / 100)}xx` : "error",
|
|
115
|
-
//
|
|
116
|
-
cached,
|
|
96
|
+
// An upstream cache is the site's own `fetch` option; it marks a hit `x-cache: HIT`.
|
|
97
|
+
cached: response?.headers.get("x-cache") === "HIT",
|
|
117
98
|
retries,
|
|
118
99
|
};
|
|
119
100
|
telemetry.histogram(
|
package/src/v8/identity.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* keys go into the global symbol registry, so they're derived from the
|
|
4
4
|
* configuration and never carry a secret.
|
|
5
5
|
*/
|
|
6
|
-
import type { Loader, Snapshot } from "./types";
|
|
6
|
+
import type { Loader, Snapshot } from "./types.ts";
|
|
7
7
|
|
|
8
8
|
const OBJECT_IDS = Symbol.for("decocms.blocks.cms-loader-ids");
|
|
9
9
|
|
package/src/v8/index.ts
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
* `matchRoute` and the draft helpers. Re-exported from the package root, where
|
|
4
4
|
* these names are the documented ones; see /next/api-reference.
|
|
5
5
|
*/
|
|
6
|
-
export { createCMS, resetForTests } from "./cms";
|
|
6
|
+
export { createCMS, resetForTests } from "./cms.ts";
|
|
7
7
|
export {
|
|
8
8
|
DRAFT_COOKIE,
|
|
9
9
|
draftCookie,
|
|
10
10
|
draftPointer,
|
|
11
11
|
formatDraftPointer,
|
|
12
12
|
parseDraftPointer,
|
|
13
|
-
} from "./draft";
|
|
14
|
-
export { matchRoute } from "./matchRoute";
|
|
15
|
-
export { remoteLoader } from "./remoteLoader";
|
|
13
|
+
} from "./draft.ts";
|
|
14
|
+
export { matchRoute } from "./matchRoute.ts";
|
|
15
|
+
export { remoteLoader } from "./remoteLoader.ts";
|
|
16
16
|
export type {
|
|
17
17
|
Analytics,
|
|
18
18
|
Block,
|
|
@@ -36,4 +36,4 @@ export type {
|
|
|
36
36
|
Telemetry,
|
|
37
37
|
TelemetryConfig,
|
|
38
38
|
Variant,
|
|
39
|
-
} from "./types";
|
|
39
|
+
} from "./types.ts";
|
package/src/v8/matchRoute.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* reach the same leaf are a conflict `deco check` reports; here the earlier
|
|
12
12
|
* one keeps it, so a lookup never throws. No regex, no sorting.
|
|
13
13
|
*/
|
|
14
|
-
import type { LegacyRedirect, Match, Redirect, RedirectStatus, Route } from "./types";
|
|
14
|
+
import type { LegacyRedirect, Match, Redirect, RedirectStatus, Route } from "./types.ts";
|
|
15
15
|
|
|
16
16
|
/** A leaf holds the entry and its parameter names, in path order; `splat` is a trailing `*`'s leaf. */
|
|
17
17
|
type Leaf<T> = { value: T; names: string[] };
|
package/src/v8/remoteLoader.ts
CHANGED
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
*
|
|
23
23
|
* Instances are process-wide singletons, like `createCMS`'s.
|
|
24
24
|
*/
|
|
25
|
-
import { computeContentRevision } from "./canonical";
|
|
26
|
-
import { isSnapshot } from "./content";
|
|
27
|
-
import { parseDraftPointer } from "./draft";
|
|
28
|
-
import { clearGlobals, contentIdentity, fnv1a } from "./identity";
|
|
29
|
-
import { isPlainObject } from "./json";
|
|
30
|
-
import type { Loader, Snapshot } from "./types";
|
|
25
|
+
import { computeContentRevision } from "./canonical.ts";
|
|
26
|
+
import { isSnapshot } from "./content.ts";
|
|
27
|
+
import { parseDraftPointer } from "./draft.ts";
|
|
28
|
+
import { clearGlobals, contentIdentity, fnv1a } from "./identity.ts";
|
|
29
|
+
import { isPlainObject } from "./json.ts";
|
|
30
|
+
import type { Loader, Snapshot } from "./types.ts";
|
|
31
31
|
|
|
32
32
|
/** The hosted delivery origin: channel manifests, release assets and drafts. */
|
|
33
33
|
const HOSTED_DELIVERY_ORIGIN = "https://delivery.decocms.com";
|
|
@@ -89,7 +89,7 @@ class RemoteLoader implements Loader {
|
|
|
89
89
|
const manifest = await this.#manifest();
|
|
90
90
|
if (manifest.generation < this.#generation) return { updated: false };
|
|
91
91
|
|
|
92
|
-
// Best effort: a fallback that can't load (a
|
|
92
|
+
// Best effort: a fallback that can't load (a KV key the deploy never wrote) is
|
|
93
93
|
// fixed by downloading the release, not by failing the check.
|
|
94
94
|
const fallbackRevision = await this.#fallbackRevisionNow().catch(() => undefined);
|
|
95
95
|
const served = this.#current !== undefined ? this.#current.revision : fallbackRevision;
|
package/src/v8/resolver.ts
CHANGED
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
* are read-only (see `Client` in ./types): mutating one in place would change
|
|
17
17
|
* the others, the class of bug behind the v7 layout-cache race.
|
|
18
18
|
*/
|
|
19
|
-
import { RESERVED_NAMES } from "./builtins/index";
|
|
20
|
-
import { isLazyBuiltin } from "./builtins/lazy";
|
|
21
|
-
import { LEGACY_ALIASES, wrapLegacyVariants } from "./builtins/legacy";
|
|
22
|
-
import { errors, isResolutionError } from "./errors";
|
|
23
|
-
import { canonicalKey, isPlainObject, type JsonObject, own } from "./json";
|
|
24
|
-
import type { BlockFunction, Blocks, Lazy, Snapshot } from "./types";
|
|
19
|
+
import { RESERVED_NAMES } from "./builtins/index.ts";
|
|
20
|
+
import { isLazyBuiltin } from "./builtins/lazy.ts";
|
|
21
|
+
import { LEGACY_ALIASES, wrapLegacyVariants } from "./builtins/legacy.ts";
|
|
22
|
+
import { errors, isResolutionError } from "./errors.ts";
|
|
23
|
+
import { canonicalKey, isPlainObject, type JsonObject, own } from "./json.ts";
|
|
24
|
+
import type { BlockFunction, Blocks, Lazy, Snapshot } from "./types.ts";
|
|
25
25
|
|
|
26
26
|
type Path = (string | number)[];
|
|
27
27
|
|
package/src/v8/secrets.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* script or an AI agent that writes content (see /next/api-reference#secrets).
|
|
4
4
|
* Web Crypto only, so it runs in browsers, on Workers and on Node.
|
|
5
5
|
*/
|
|
6
|
-
import { encryptToCiphertext } from "./ciphertext";
|
|
6
|
+
import { encryptToCiphertext } from "./ciphertext.ts";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Encrypts `value` with your public key (the contents of `.deco/secrets.pub`)
|
package/src/v8/telemetry.ts
CHANGED
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
* - Everything is scrubbed before encoding: no query strings, tokens,
|
|
15
15
|
* cookies or authorization values, and no value a secret block decrypted.
|
|
16
16
|
*/
|
|
17
|
-
import { hasBackgroundHook, later, runInBackground } from "./background";
|
|
18
|
-
import { isResolutionError } from "./errors";
|
|
19
|
-
import { readEnv } from "./identity";
|
|
20
|
-
import { isPlainObject } from "./json";
|
|
21
|
-
import type { CMSError, Snapshot, TelemetryConfig } from "./types";
|
|
17
|
+
import { hasBackgroundHook, later, runInBackground } from "./background.ts";
|
|
18
|
+
import { isResolutionError } from "./errors.ts";
|
|
19
|
+
import { readEnv } from "./identity.ts";
|
|
20
|
+
import { isPlainObject } from "./json.ts";
|
|
21
|
+
import type { CMSError, Snapshot, TelemetryConfig } from "./types.ts";
|
|
22
22
|
|
|
23
23
|
/** The hosted Deco CMS collector, for `telemetry: { site, token }`. */
|
|
24
24
|
const HOSTED_TELEMETRY_ENDPOINT = "https://otel.decocms.com";
|
|
@@ -366,7 +366,7 @@ export class TelemetryPipeline {
|
|
|
366
366
|
});
|
|
367
367
|
return;
|
|
368
368
|
}
|
|
369
|
-
// With a
|
|
369
|
+
// With a host hook (Workers: after the response, in ctx.waitUntil),
|
|
370
370
|
// a batch goes out once it's FLUSH_MS old; a younger one stays pending
|
|
371
371
|
// and a later request's measurement schedules it again.
|
|
372
372
|
runInBackground(() => {
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Applies convention-based section metadata generated by generate-sections.ts.
|
|
3
|
-
*
|
|
4
|
-
* Reads the generated sectionMeta/syncComponents/loadingFallbacks and calls
|
|
5
|
-
* the appropriate registration functions — replacing manual calls to
|
|
6
|
-
* registerSectionsSync, setAsyncRenderingConfig, registerCacheableSections,
|
|
7
|
-
* registerLayoutSections, registerSeoSections, and registerSection.
|
|
8
|
-
*/
|
|
9
|
-
import { registerSection, registerSectionsSync, setSectionRenderJson } from "./registry";
|
|
10
|
-
import type { RenderJson } from "./renderJson";
|
|
11
|
-
import {
|
|
12
|
-
type AsyncRenderingConfig,
|
|
13
|
-
getAsyncRenderingConfig,
|
|
14
|
-
registerAlwaysDeferSections,
|
|
15
|
-
registerEagerSections,
|
|
16
|
-
registerNeverDeferSections,
|
|
17
|
-
registerSeoSections,
|
|
18
|
-
setAsyncRenderingConfig,
|
|
19
|
-
} from "./resolve";
|
|
20
|
-
import {
|
|
21
|
-
type CacheableSectionInput,
|
|
22
|
-
registerCacheableSections,
|
|
23
|
-
registerLayoutSections,
|
|
24
|
-
} from "./sectionLoaders";
|
|
25
|
-
|
|
26
|
-
export interface SectionMetaEntry {
|
|
27
|
-
eager?: boolean;
|
|
28
|
-
neverDefer?: boolean;
|
|
29
|
-
deferred?: boolean;
|
|
30
|
-
cache?: string;
|
|
31
|
-
layout?: boolean;
|
|
32
|
-
sync?: boolean;
|
|
33
|
-
clientOnly?: boolean;
|
|
34
|
-
seo?: boolean;
|
|
35
|
-
hasLoadingFallback?: boolean;
|
|
36
|
-
/** `export const renderJson = false` — drop the section from ?renderJson. */
|
|
37
|
-
renderJson?: false;
|
|
38
|
-
/** `export const renderJson = (props) => ...` — a projection fn (in `renderJsons`). */
|
|
39
|
-
hasRenderJson?: boolean;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface ApplySectionConventionsInput {
|
|
43
|
-
/** Section metadata map from sections.gen.ts */
|
|
44
|
-
meta: Record<string, SectionMetaEntry>;
|
|
45
|
-
/** Sync-imported section modules from sections.gen.ts */
|
|
46
|
-
syncComponents?: Record<string, any>;
|
|
47
|
-
/** LoadingFallback components from sections.gen.ts */
|
|
48
|
-
loadingFallbacks?: Record<string, React.ComponentType<any>>;
|
|
49
|
-
/** renderJson projection functions from sections.gen.ts (?renderJson mobile path) */
|
|
50
|
-
renderJsons?: Record<string, RenderJson>;
|
|
51
|
-
/** Lazy section loaders from import.meta.glob (used for clientOnly/loadingFallback registration) */
|
|
52
|
-
sectionGlob?: Record<string, () => Promise<any>>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function applySectionConventions(input: ApplySectionConventionsInput): void {
|
|
56
|
-
const { meta, syncComponents, loadingFallbacks, renderJsons, sectionGlob } = input;
|
|
57
|
-
|
|
58
|
-
const eagerSections: string[] = [];
|
|
59
|
-
const neverDeferSections: string[] = [];
|
|
60
|
-
const alwaysDeferSections: string[] = [];
|
|
61
|
-
const layoutSections: string[] = [];
|
|
62
|
-
const seoSections: string[] = [];
|
|
63
|
-
const cacheableSections: Record<string, CacheableSectionInput> = {};
|
|
64
|
-
|
|
65
|
-
for (const [key, entry] of Object.entries(meta)) {
|
|
66
|
-
if (entry.eager) eagerSections.push(key);
|
|
67
|
-
if (entry.neverDefer) neverDeferSections.push(key);
|
|
68
|
-
if (entry.deferred) alwaysDeferSections.push(key);
|
|
69
|
-
if (entry.layout) layoutSections.push(key);
|
|
70
|
-
if (entry.seo) seoSections.push(key);
|
|
71
|
-
if (entry.cache) cacheableSections[key] = entry.cache as CacheableSectionInput;
|
|
72
|
-
|
|
73
|
-
if (entry.clientOnly && sectionGlob) {
|
|
74
|
-
const globKey = sectionGlobKey(key, sectionGlob);
|
|
75
|
-
if (globKey) {
|
|
76
|
-
registerSection(key, sectionGlob[globKey] as any, { clientOnly: true });
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (entry.hasLoadingFallback && loadingFallbacks?.[key] && sectionGlob) {
|
|
81
|
-
const globKey = sectionGlobKey(key, sectionGlob);
|
|
82
|
-
if (globKey) {
|
|
83
|
-
registerSection(key, sectionGlob[globKey] as any, {
|
|
84
|
-
loadingFallback: loadingFallbacks[key],
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// renderJson (?renderJson mobile path): a `= false` opt-out drops the
|
|
90
|
-
// section; a projection function trims its props. Set as a section option so
|
|
91
|
-
// the serializer reads it via getSectionOptions without loading the module.
|
|
92
|
-
if (entry.renderJson === false) {
|
|
93
|
-
setSectionRenderJson(key, false);
|
|
94
|
-
} else if (entry.hasRenderJson && renderJsons?.[key]) {
|
|
95
|
-
setSectionRenderJson(key, renderJsons[key]);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (syncComponents && Object.keys(syncComponents).length > 0) {
|
|
100
|
-
registerSectionsSync(syncComponents);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (eagerSections.length > 0) {
|
|
104
|
-
registerEagerSections(eagerSections);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (neverDeferSections.length > 0) {
|
|
108
|
-
registerNeverDeferSections(neverDeferSections);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (alwaysDeferSections.length > 0) {
|
|
112
|
-
registerAlwaysDeferSections(alwaysDeferSections);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Always initialize asyncConfig so CMS Lazy deferral (`respectCmsLazy`) is
|
|
116
|
-
// active — this is what makes the admin ⚡ toggle the source of truth. Without
|
|
117
|
-
// it, asyncConfig stays null, `useAsync` is false in resolveDecoPage, and
|
|
118
|
-
// even editor-marked ⚡ sections render eagerly. (The default foldThreshold is
|
|
119
|
-
// Infinity, so position-based deferral stays off unless a site opts in.)
|
|
120
|
-
const existing: Partial<AsyncRenderingConfig> = getAsyncRenderingConfig() ?? {};
|
|
121
|
-
setAsyncRenderingConfig({
|
|
122
|
-
...existing,
|
|
123
|
-
alwaysEager: [...(existing.alwaysEager ?? []), ...eagerSections],
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
if (layoutSections.length > 0) {
|
|
127
|
-
registerLayoutSections(layoutSections);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (seoSections.length > 0) {
|
|
131
|
-
registerSeoSections(seoSections);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (Object.keys(cacheableSections).length > 0) {
|
|
135
|
-
registerCacheableSections(cacheableSections);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function sectionGlobKey(
|
|
140
|
-
sectionKey: string,
|
|
141
|
-
glob: Record<string, () => Promise<any>>,
|
|
142
|
-
): string | null {
|
|
143
|
-
const relative = sectionKey.replace("site/sections/", "./sections/");
|
|
144
|
-
if (glob[relative]) return relative;
|
|
145
|
-
const withDot = sectionKey.replace("site/", "./");
|
|
146
|
-
if (glob[withDot]) return withDot;
|
|
147
|
-
return null;
|
|
148
|
-
}
|