alchemy 2.0.0-beta.62 → 2.0.0-beta.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/bin/exec.js +1959 -70
- package/bin/exec.js.map +1 -1
- package/lib/AWS/AuthProvider.js +1 -1
- package/lib/AWS/AuthProvider.js.map +1 -1
- package/lib/AWS/EC2/hosted.d.ts.map +1 -1
- package/lib/AWS/EC2/hosted.js +2 -1
- package/lib/AWS/EC2/hosted.js.map +1 -1
- package/lib/AWS/ECS/Task.d.ts.map +1 -1
- package/lib/AWS/ECS/Task.js +2 -1
- package/lib/AWS/ECS/Task.js.map +1 -1
- package/lib/AWS/Lambda/Function.d.ts.map +1 -1
- package/lib/AWS/Lambda/Function.js +13 -40
- package/lib/AWS/Lambda/Function.js.map +1 -1
- package/lib/AWS/Lambda/MicrovmRuntimeContext.d.ts.map +1 -1
- package/lib/AWS/Lambda/MicrovmRuntimeContext.js +9 -21
- package/lib/AWS/Lambda/MicrovmRuntimeContext.js.map +1 -1
- package/lib/Action.d.ts +8 -0
- package/lib/Action.d.ts.map +1 -1
- package/lib/Action.js +16 -5
- package/lib/Action.js.map +1 -1
- package/lib/ActionRuntimeContext.d.ts +14 -0
- package/lib/ActionRuntimeContext.d.ts.map +1 -0
- package/lib/ActionRuntimeContext.js +56 -0
- package/lib/ActionRuntimeContext.js.map +1 -0
- package/lib/Apply.d.ts.map +1 -1
- package/lib/Apply.js +40 -6
- package/lib/Apply.js.map +1 -1
- package/lib/Auth/AuthProvider.d.ts +3 -3
- package/lib/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Auth/AuthProvider.js +1 -1
- package/lib/Auth/AuthProvider.js.map +1 -1
- package/lib/Auth/Lock.d.ts.map +1 -1
- package/lib/Auth/Lock.js +5 -2
- package/lib/Auth/Lock.js.map +1 -1
- package/lib/Bundle/PurePlugin.d.ts.map +1 -1
- package/lib/Bundle/PurePlugin.js +26 -1
- package/lib/Bundle/PurePlugin.js.map +1 -1
- package/lib/Bundle/Vite.d.ts +2 -0
- package/lib/Bundle/Vite.d.ts.map +1 -1
- package/lib/Bundle/Vite.js +24 -1
- package/lib/Bundle/Vite.js.map +1 -1
- package/lib/Cli/LoggingCli.d.ts.map +1 -1
- package/lib/Cli/LoggingCli.js +7 -4
- package/lib/Cli/LoggingCli.js.map +1 -1
- package/lib/Cli/commands/_shared.d.ts +19 -0
- package/lib/Cli/commands/_shared.d.ts.map +1 -1
- package/lib/Cli/commands/_shared.js +22 -0
- package/lib/Cli/commands/_shared.js.map +1 -1
- package/lib/Cli/commands/login.d.ts +7 -3
- package/lib/Cli/commands/login.d.ts.map +1 -1
- package/lib/Cli/commands/login.js +70 -12
- package/lib/Cli/commands/login.js.map +1 -1
- package/lib/Cli/commands/profile.d.ts.map +1 -1
- package/lib/Cli/commands/profile.js +7 -20
- package/lib/Cli/commands/profile.js.map +1 -1
- package/lib/Cloudflare/AI/LanguageModel.js +21 -4
- package/lib/Cloudflare/AI/LanguageModel.js.map +1 -1
- package/lib/Cloudflare/AI/QuerySearchLocal.d.ts +37 -0
- package/lib/Cloudflare/AI/QuerySearchLocal.d.ts.map +1 -0
- package/lib/Cloudflare/AI/QuerySearchLocal.js +53 -0
- package/lib/Cloudflare/AI/QuerySearchLocal.js.map +1 -0
- package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.d.ts +35 -0
- package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.d.ts.map +1 -0
- package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.js +47 -0
- package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.js.map +1 -0
- package/lib/Cloudflare/AI/SearchHttpClient.d.ts +34 -0
- package/lib/Cloudflare/AI/SearchHttpClient.d.ts.map +1 -0
- package/lib/Cloudflare/AI/SearchHttpClient.js +262 -0
- package/lib/Cloudflare/AI/SearchHttpClient.js.map +1 -0
- package/lib/Cloudflare/AI/index.d.ts +2 -0
- package/lib/Cloudflare/AI/index.d.ts.map +1 -1
- package/lib/Cloudflare/AI/index.js +2 -0
- package/lib/Cloudflare/AI/index.js.map +1 -1
- package/lib/Cloudflare/Auth/AuthProvider.js +1 -1
- package/lib/Cloudflare/Auth/AuthProvider.js.map +1 -1
- package/lib/Cloudflare/Containers/ContainerBundle.d.ts.map +1 -1
- package/lib/Cloudflare/Containers/ContainerBundle.js +11 -1
- package/lib/Cloudflare/Containers/ContainerBundle.js.map +1 -1
- package/lib/Cloudflare/Containers/ContainerPlatform.d.ts.map +1 -1
- package/lib/Cloudflare/Containers/ContainerPlatform.js +12 -33
- package/lib/Cloudflare/Containers/ContainerPlatform.js.map +1 -1
- package/lib/Cloudflare/D1/QueryDatabaseHttpClient.d.ts +24 -0
- package/lib/Cloudflare/D1/QueryDatabaseHttpClient.d.ts.map +1 -0
- package/lib/Cloudflare/D1/QueryDatabaseHttpClient.js +106 -0
- package/lib/Cloudflare/D1/QueryDatabaseHttpClient.js.map +1 -0
- package/lib/Cloudflare/D1/QueryDatabaseLocal.d.ts +38 -0
- package/lib/Cloudflare/D1/QueryDatabaseLocal.d.ts.map +1 -0
- package/lib/Cloudflare/D1/QueryDatabaseLocal.js +54 -0
- package/lib/Cloudflare/D1/QueryDatabaseLocal.js.map +1 -0
- package/lib/Cloudflare/D1/index.d.ts +1 -0
- package/lib/Cloudflare/D1/index.d.ts.map +1 -1
- package/lib/Cloudflare/D1/index.js +1 -0
- package/lib/Cloudflare/D1/index.js.map +1 -1
- package/lib/Cloudflare/DNS/DnsHttp.d.ts +16 -1
- package/lib/Cloudflare/DNS/DnsHttp.d.ts.map +1 -1
- package/lib/Cloudflare/DNS/DnsHttp.js +6 -1
- package/lib/Cloudflare/DNS/DnsHttp.js.map +1 -1
- package/lib/Cloudflare/DNS/DnsLocal.d.ts +22 -0
- package/lib/Cloudflare/DNS/DnsLocal.d.ts.map +1 -0
- package/lib/Cloudflare/DNS/DnsLocal.js +31 -0
- package/lib/Cloudflare/DNS/DnsLocal.js.map +1 -0
- package/lib/Cloudflare/DNS/ReadDnsHttp.d.ts +3 -3
- package/lib/Cloudflare/DNS/ReadDnsHttp.d.ts.map +1 -1
- package/lib/Cloudflare/DNS/ReadDnsHttp.js +3 -4
- package/lib/Cloudflare/DNS/ReadDnsHttp.js.map +1 -1
- package/lib/Cloudflare/DNS/ReadDnsLocal.d.ts +32 -0
- package/lib/Cloudflare/DNS/ReadDnsLocal.d.ts.map +1 -0
- package/lib/Cloudflare/DNS/ReadDnsLocal.js +35 -0
- package/lib/Cloudflare/DNS/ReadDnsLocal.js.map +1 -0
- package/lib/Cloudflare/DNS/ReadWriteDnsHttp.d.ts +3 -3
- package/lib/Cloudflare/DNS/ReadWriteDnsHttp.d.ts.map +1 -1
- package/lib/Cloudflare/DNS/ReadWriteDnsHttp.js +4 -4
- package/lib/Cloudflare/DNS/ReadWriteDnsHttp.js.map +1 -1
- package/lib/Cloudflare/DNS/ReadWriteDnsLocal.d.ts +40 -0
- package/lib/Cloudflare/DNS/ReadWriteDnsLocal.d.ts.map +1 -0
- package/lib/Cloudflare/DNS/ReadWriteDnsLocal.js +43 -0
- package/lib/Cloudflare/DNS/ReadWriteDnsLocal.js.map +1 -0
- package/lib/Cloudflare/DNS/WriteDnsHttp.d.ts +3 -3
- package/lib/Cloudflare/DNS/WriteDnsHttp.d.ts.map +1 -1
- package/lib/Cloudflare/DNS/WriteDnsHttp.js +3 -4
- package/lib/Cloudflare/DNS/WriteDnsHttp.js.map +1 -1
- package/lib/Cloudflare/DNS/WriteDnsLocal.d.ts +38 -0
- package/lib/Cloudflare/DNS/WriteDnsLocal.d.ts.map +1 -0
- package/lib/Cloudflare/DNS/WriteDnsLocal.js +41 -0
- package/lib/Cloudflare/DNS/WriteDnsLocal.js.map +1 -0
- package/lib/Cloudflare/DNS/index.d.ts +3 -0
- package/lib/Cloudflare/DNS/index.d.ts.map +1 -1
- package/lib/Cloudflare/DNS/index.js +3 -0
- package/lib/Cloudflare/DNS/index.js.map +1 -1
- package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.d.ts +27 -0
- package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.d.ts.map +1 -0
- package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.js +86 -0
- package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.js.map +1 -0
- package/lib/Cloudflare/Flagship/ReadFlagsLocal.d.ts +41 -0
- package/lib/Cloudflare/Flagship/ReadFlagsLocal.d.ts.map +1 -0
- package/lib/Cloudflare/Flagship/ReadFlagsLocal.js +57 -0
- package/lib/Cloudflare/Flagship/ReadFlagsLocal.js.map +1 -0
- package/lib/Cloudflare/Flagship/index.d.ts +1 -0
- package/lib/Cloudflare/Flagship/index.d.ts.map +1 -1
- package/lib/Cloudflare/Flagship/index.js +1 -0
- package/lib/Cloudflare/Flagship/index.js.map +1 -1
- package/lib/Cloudflare/KV/NamespaceHttp.d.ts +16 -1
- package/lib/Cloudflare/KV/NamespaceHttp.d.ts.map +1 -1
- package/lib/Cloudflare/KV/NamespaceHttp.js +8 -2
- package/lib/Cloudflare/KV/NamespaceHttp.js.map +1 -1
- package/lib/Cloudflare/KV/NamespaceLocal.d.ts +22 -0
- package/lib/Cloudflare/KV/NamespaceLocal.d.ts.map +1 -0
- package/lib/Cloudflare/KV/NamespaceLocal.js +32 -0
- package/lib/Cloudflare/KV/NamespaceLocal.js.map +1 -0
- package/lib/Cloudflare/KV/ReadNamespaceHttp.d.ts +2 -2
- package/lib/Cloudflare/KV/ReadNamespaceHttp.d.ts.map +1 -1
- package/lib/Cloudflare/KV/ReadNamespaceHttp.js +5 -6
- package/lib/Cloudflare/KV/ReadNamespaceHttp.js.map +1 -1
- package/lib/Cloudflare/KV/ReadNamespaceLocal.d.ts +27 -0
- package/lib/Cloudflare/KV/ReadNamespaceLocal.d.ts.map +1 -0
- package/lib/Cloudflare/KV/ReadNamespaceLocal.js +30 -0
- package/lib/Cloudflare/KV/ReadNamespaceLocal.js.map +1 -0
- package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.d.ts +3 -3
- package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.d.ts.map +1 -1
- package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.js +6 -6
- package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.js.map +1 -1
- package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.d.ts +34 -0
- package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.d.ts.map +1 -0
- package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.js +37 -0
- package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.js.map +1 -0
- package/lib/Cloudflare/KV/WriteNamespaceHttp.d.ts +2 -2
- package/lib/Cloudflare/KV/WriteNamespaceHttp.d.ts.map +1 -1
- package/lib/Cloudflare/KV/WriteNamespaceHttp.js +5 -6
- package/lib/Cloudflare/KV/WriteNamespaceHttp.js.map +1 -1
- package/lib/Cloudflare/KV/WriteNamespaceLocal.d.ts +27 -0
- package/lib/Cloudflare/KV/WriteNamespaceLocal.d.ts.map +1 -0
- package/lib/Cloudflare/KV/WriteNamespaceLocal.js +30 -0
- package/lib/Cloudflare/KV/WriteNamespaceLocal.js.map +1 -0
- package/lib/Cloudflare/KV/index.d.ts +3 -0
- package/lib/Cloudflare/KV/index.d.ts.map +1 -1
- package/lib/Cloudflare/KV/index.js +3 -0
- package/lib/Cloudflare/KV/index.js.map +1 -1
- package/lib/Cloudflare/Queues/QueueHttp.d.ts +20 -1
- package/lib/Cloudflare/Queues/QueueHttp.d.ts.map +1 -1
- package/lib/Cloudflare/Queues/QueueHttp.js +2 -2
- package/lib/Cloudflare/Queues/QueueHttp.js.map +1 -1
- package/lib/Cloudflare/Queues/WriteQueueHttp.d.ts +9 -3
- package/lib/Cloudflare/Queues/WriteQueueHttp.d.ts.map +1 -1
- package/lib/Cloudflare/Queues/WriteQueueHttp.js +11 -6
- package/lib/Cloudflare/Queues/WriteQueueHttp.js.map +1 -1
- package/lib/Cloudflare/Queues/WriteQueueLocal.d.ts +36 -0
- package/lib/Cloudflare/Queues/WriteQueueLocal.d.ts.map +1 -0
- package/lib/Cloudflare/Queues/WriteQueueLocal.js +51 -0
- package/lib/Cloudflare/Queues/WriteQueueLocal.js.map +1 -0
- package/lib/Cloudflare/Queues/index.d.ts +1 -0
- package/lib/Cloudflare/Queues/index.d.ts.map +1 -1
- package/lib/Cloudflare/Queues/index.js +1 -0
- package/lib/Cloudflare/Queues/index.js.map +1 -1
- package/lib/Cloudflare/R2/BucketHttp.d.ts +15 -1
- package/lib/Cloudflare/R2/BucketHttp.d.ts.map +1 -1
- package/lib/Cloudflare/R2/BucketHttp.js +3 -3
- package/lib/Cloudflare/R2/BucketHttp.js.map +1 -1
- package/lib/Cloudflare/R2/BucketLocal.d.ts +21 -0
- package/lib/Cloudflare/R2/BucketLocal.d.ts.map +1 -0
- package/lib/Cloudflare/R2/BucketLocal.js +32 -0
- package/lib/Cloudflare/R2/BucketLocal.js.map +1 -0
- package/lib/Cloudflare/R2/ReadBucketHttp.d.ts +2 -2
- package/lib/Cloudflare/R2/ReadBucketHttp.d.ts.map +1 -1
- package/lib/Cloudflare/R2/ReadBucketHttp.js +4 -4
- package/lib/Cloudflare/R2/ReadBucketHttp.js.map +1 -1
- package/lib/Cloudflare/R2/ReadBucketLocal.d.ts +27 -0
- package/lib/Cloudflare/R2/ReadBucketLocal.d.ts.map +1 -0
- package/lib/Cloudflare/R2/ReadBucketLocal.js +30 -0
- package/lib/Cloudflare/R2/ReadBucketLocal.js.map +1 -0
- package/lib/Cloudflare/R2/ReadWriteBucketHttp.d.ts +2 -2
- package/lib/Cloudflare/R2/ReadWriteBucketHttp.d.ts.map +1 -1
- package/lib/Cloudflare/R2/ReadWriteBucketHttp.js +5 -4
- package/lib/Cloudflare/R2/ReadWriteBucketHttp.js.map +1 -1
- package/lib/Cloudflare/R2/ReadWriteBucketLocal.d.ts +30 -0
- package/lib/Cloudflare/R2/ReadWriteBucketLocal.d.ts.map +1 -0
- package/lib/Cloudflare/R2/ReadWriteBucketLocal.js +33 -0
- package/lib/Cloudflare/R2/ReadWriteBucketLocal.js.map +1 -0
- package/lib/Cloudflare/R2/WriteBucketHttp.d.ts +2 -2
- package/lib/Cloudflare/R2/WriteBucketHttp.d.ts.map +1 -1
- package/lib/Cloudflare/R2/WriteBucketHttp.js +4 -4
- package/lib/Cloudflare/R2/WriteBucketHttp.js.map +1 -1
- package/lib/Cloudflare/R2/WriteBucketLocal.d.ts +27 -0
- package/lib/Cloudflare/R2/WriteBucketLocal.d.ts.map +1 -0
- package/lib/Cloudflare/R2/WriteBucketLocal.js +30 -0
- package/lib/Cloudflare/R2/WriteBucketLocal.js.map +1 -0
- package/lib/Cloudflare/R2/index.d.ts +3 -0
- package/lib/Cloudflare/R2/index.d.ts.map +1 -1
- package/lib/Cloudflare/R2/index.js +3 -0
- package/lib/Cloudflare/R2/index.js.map +1 -1
- package/lib/Cloudflare/StateStore/Api.d.ts +2 -0
- package/lib/Cloudflare/Tunnel/ReadTunnel.d.ts +3 -3
- package/lib/Cloudflare/Tunnel/ReadTunnel.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/ReadTunnel.js +7 -8
- package/lib/Cloudflare/Tunnel/ReadTunnel.js.map +1 -1
- package/lib/Cloudflare/Tunnel/ReadTunnelLocal.d.ts +29 -0
- package/lib/Cloudflare/Tunnel/ReadTunnelLocal.d.ts.map +1 -0
- package/lib/Cloudflare/Tunnel/ReadTunnelLocal.js +30 -0
- package/lib/Cloudflare/Tunnel/ReadTunnelLocal.js.map +1 -0
- package/lib/Cloudflare/Tunnel/ReadWriteTunnel.d.ts +3 -3
- package/lib/Cloudflare/Tunnel/ReadWriteTunnel.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/ReadWriteTunnel.js +4 -4
- package/lib/Cloudflare/Tunnel/ReadWriteTunnel.js.map +1 -1
- package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.d.ts +35 -0
- package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.d.ts.map +1 -0
- package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.js +36 -0
- package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.js.map +1 -0
- package/lib/Cloudflare/Tunnel/TunnelBinding.d.ts +17 -1
- package/lib/Cloudflare/Tunnel/TunnelBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/TunnelBinding.js +7 -1
- package/lib/Cloudflare/Tunnel/TunnelBinding.js.map +1 -1
- package/lib/Cloudflare/Tunnel/TunnelLocalBinding.d.ts +19 -0
- package/lib/Cloudflare/Tunnel/TunnelLocalBinding.d.ts.map +1 -0
- package/lib/Cloudflare/Tunnel/TunnelLocalBinding.js +29 -0
- package/lib/Cloudflare/Tunnel/TunnelLocalBinding.js.map +1 -0
- package/lib/Cloudflare/Tunnel/WarpConnector.d.ts +3 -3
- package/lib/Cloudflare/Tunnel/WarpConnector.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/WarpConnector.js +7 -4
- package/lib/Cloudflare/Tunnel/WarpConnector.js.map +1 -1
- package/lib/Cloudflare/Tunnel/WriteTunnel.d.ts +3 -3
- package/lib/Cloudflare/Tunnel/WriteTunnel.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/WriteTunnel.js +7 -8
- package/lib/Cloudflare/Tunnel/WriteTunnel.js.map +1 -1
- package/lib/Cloudflare/Tunnel/WriteTunnelLocal.d.ts +29 -0
- package/lib/Cloudflare/Tunnel/WriteTunnelLocal.d.ts.map +1 -0
- package/lib/Cloudflare/Tunnel/WriteTunnelLocal.js +30 -0
- package/lib/Cloudflare/Tunnel/WriteTunnelLocal.js.map +1 -0
- package/lib/Cloudflare/Tunnel/index.d.ts +3 -0
- package/lib/Cloudflare/Tunnel/index.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/index.js +3 -0
- package/lib/Cloudflare/Tunnel/index.js.map +1 -1
- package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.d.ts +30 -0
- package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.d.ts.map +1 -0
- package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.js +100 -0
- package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.js.map +1 -0
- package/lib/Cloudflare/Vectorize/SearchIndexLocal.d.ts +42 -0
- package/lib/Cloudflare/Vectorize/SearchIndexLocal.d.ts.map +1 -0
- package/lib/Cloudflare/Vectorize/SearchIndexLocal.js +58 -0
- package/lib/Cloudflare/Vectorize/SearchIndexLocal.js.map +1 -0
- package/lib/Cloudflare/Vectorize/index.d.ts +1 -0
- package/lib/Cloudflare/Vectorize/index.d.ts.map +1 -1
- package/lib/Cloudflare/Vectorize/index.js +1 -0
- package/lib/Cloudflare/Vectorize/index.js.map +1 -1
- package/lib/Cloudflare/Workers/BrowserHttpClient.d.ts +32 -0
- package/lib/Cloudflare/Workers/BrowserHttpClient.d.ts.map +1 -0
- package/lib/Cloudflare/Workers/BrowserHttpClient.js +100 -0
- package/lib/Cloudflare/Workers/BrowserHttpClient.js.map +1 -0
- package/lib/Cloudflare/Workers/BrowserLocal.d.ts +37 -0
- package/lib/Cloudflare/Workers/BrowserLocal.d.ts.map +1 -0
- package/lib/Cloudflare/Workers/BrowserLocal.js +53 -0
- package/lib/Cloudflare/Workers/BrowserLocal.js.map +1 -0
- package/lib/Cloudflare/Workers/ConfigProvider.d.ts +8 -0
- package/lib/Cloudflare/Workers/ConfigProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/ConfigProvider.js +10 -1
- package/lib/Cloudflare/Workers/ConfigProvider.js.map +1 -1
- package/lib/Cloudflare/Workers/DurableObject.d.ts +137 -3
- package/lib/Cloudflare/Workers/DurableObject.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/DurableObject.js +141 -6
- package/lib/Cloudflare/Workers/DurableObject.js.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts +2 -185
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Vite.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Vite.js +81 -2
- package/lib/Cloudflare/Workers/Vite.js.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +15 -1
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.js +2 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBinding.d.ts +22 -1
- package/lib/Cloudflare/Workers/WorkerBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBinding.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBridge.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBridge.js +7 -2
- package/lib/Cloudflare/Workers/WorkerBridge.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerProvider.d.ts +81 -0
- package/lib/Cloudflare/Workers/WorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerProvider.js +450 -61
- package/lib/Cloudflare/Workers/WorkerProvider.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerRuntimeContext.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerRuntimeContext.js +11 -37
- package/lib/Cloudflare/Workers/WorkerRuntimeContext.js.map +1 -1
- package/lib/Cloudflare/Workers/index.d.ts +1 -0
- package/lib/Cloudflare/Workers/index.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/index.js +1 -0
- package/lib/Cloudflare/Workers/index.js.map +1 -1
- package/lib/Diff.d.ts +16 -0
- package/lib/Diff.d.ts.map +1 -1
- package/lib/Diff.js +33 -0
- package/lib/Diff.js.map +1 -1
- package/lib/GitHub/Secrets.d.ts +1 -1
- package/lib/GitHub/Secrets.js +1 -1
- package/lib/GitHub/Variables.d.ts +1 -1
- package/lib/GitHub/Variables.js +1 -1
- package/lib/Local/RpcSerialization.d.ts.map +1 -1
- package/lib/Local/RpcSerialization.js +6 -2
- package/lib/Local/RpcSerialization.js.map +1 -1
- package/lib/Local/RpcSpawner.d.ts.map +1 -1
- package/lib/Local/RpcSpawner.js +14 -8
- package/lib/Local/RpcSpawner.js.map +1 -1
- package/lib/Neon/AuthProvider.js +1 -1
- package/lib/Neon/AuthProvider.js.map +1 -1
- package/lib/Plan.d.ts.map +1 -1
- package/lib/Plan.js +11 -4
- package/lib/Plan.js.map +1 -1
- package/lib/Planetscale/Database.d.ts +2 -1
- package/lib/Planetscale/Database.d.ts.map +1 -1
- package/lib/Planetscale/MySQL/MySQLClusterSize.d.ts +41 -3
- package/lib/Planetscale/MySQL/MySQLClusterSize.d.ts.map +1 -1
- package/lib/Planetscale/MySQL/MySQLClusterSize.js +88 -11
- package/lib/Planetscale/MySQL/MySQLClusterSize.js.map +1 -1
- package/lib/Planetscale/MySQL/MySQLDatabase.d.ts +14 -0
- package/lib/Planetscale/MySQL/MySQLDatabase.d.ts.map +1 -1
- package/lib/Planetscale/MySQL/MySQLDatabase.js +24 -11
- package/lib/Planetscale/MySQL/MySQLDatabase.js.map +1 -1
- package/lib/Platform.d.ts.map +1 -1
- package/lib/Platform.js +11 -1
- package/lib/Platform.js.map +1 -1
- package/lib/Runtime.d.ts +23 -0
- package/lib/Runtime.d.ts.map +1 -1
- package/lib/Runtime.js +83 -0
- package/lib/Runtime.js.map +1 -1
- package/lib/RuntimeContext.d.ts +46 -0
- package/lib/RuntimeContext.d.ts.map +1 -1
- package/lib/RuntimeContext.js +60 -0
- package/lib/RuntimeContext.js.map +1 -1
- package/lib/Server/Process.d.ts +1 -1
- package/lib/Server/Process.d.ts.map +1 -1
- package/lib/Server/Process.js +8 -8
- package/lib/Server/Process.js.map +1 -1
- package/lib/Stack.js +1 -1
- package/lib/Stack.js.map +1 -1
- package/lib/State/HttpStateApi.d.ts +10 -10
- package/lib/Test/Alchemy.d.ts +74 -0
- package/lib/Test/Alchemy.d.ts.map +1 -0
- package/lib/Test/Alchemy.js +143 -0
- package/lib/Test/Alchemy.js.map +1 -0
- package/lib/Util/cached-function.d.ts +1 -1
- package/lib/Util/cached-function.d.ts.map +1 -1
- package/lib/Util/cached-function.js +2 -2
- package/lib/Util/cached-function.js.map +1 -1
- package/lib/Util/proxy-chain.js +3 -0
- package/lib/Util/proxy-chain.js.map +1 -1
- package/package.json +10 -10
- package/src/AWS/AuthProvider.ts +1 -1
- package/src/AWS/EC2/hosted.ts +2 -1
- package/src/AWS/ECS/Task.ts +2 -1
- package/src/AWS/Lambda/Function.ts +13 -47
- package/src/AWS/Lambda/MicrovmRuntimeContext.ts +11 -38
- package/src/Action.ts +39 -6
- package/src/ActionRuntimeContext.ts +68 -0
- package/src/Apply.ts +46 -8
- package/src/Auth/AuthProvider.ts +1 -1
- package/src/Auth/Lock.ts +5 -2
- package/src/Bundle/PurePlugin.ts +34 -1
- package/src/Bundle/Vite.ts +51 -1
- package/src/Cli/LoggingCli.ts +7 -4
- package/src/Cli/commands/_shared.ts +52 -0
- package/src/Cli/commands/login.ts +90 -14
- package/src/Cli/commands/profile.ts +7 -41
- package/src/Cloudflare/AI/LanguageModel.ts +25 -5
- package/src/Cloudflare/AI/QuerySearchLocal.ts +66 -0
- package/src/Cloudflare/AI/QuerySearchNamespaceLocal.ts +60 -0
- package/src/Cloudflare/AI/SearchHttpClient.ts +423 -0
- package/src/Cloudflare/AI/index.ts +2 -0
- package/src/Cloudflare/Auth/AuthProvider.ts +1 -1
- package/src/Cloudflare/Containers/ContainerBundle.ts +11 -1
- package/src/Cloudflare/Containers/ContainerPlatform.ts +14 -52
- package/src/Cloudflare/D1/QueryDatabaseHttpClient.ts +176 -0
- package/src/Cloudflare/D1/QueryDatabaseLocal.ts +66 -0
- package/src/Cloudflare/D1/index.ts +1 -0
- package/src/Cloudflare/DNS/DnsHttp.ts +24 -2
- package/src/Cloudflare/DNS/DnsLocal.ts +41 -0
- package/src/Cloudflare/DNS/ReadDnsHttp.ts +4 -5
- package/src/Cloudflare/DNS/ReadDnsLocal.ts +38 -0
- package/src/Cloudflare/DNS/ReadWriteDnsHttp.ts +5 -5
- package/src/Cloudflare/DNS/ReadWriteDnsLocal.ts +46 -0
- package/src/Cloudflare/DNS/WriteDnsHttp.ts +4 -5
- package/src/Cloudflare/DNS/WriteDnsLocal.ts +44 -0
- package/src/Cloudflare/DNS/index.ts +3 -0
- package/src/Cloudflare/Flagship/ReadFlagsHttpClient.ts +183 -0
- package/src/Cloudflare/Flagship/ReadFlagsLocal.ts +69 -0
- package/src/Cloudflare/Flagship/index.ts +1 -0
- package/src/Cloudflare/KV/NamespaceHttp.ts +25 -2
- package/src/Cloudflare/KV/NamespaceLocal.ts +42 -0
- package/src/Cloudflare/KV/ReadNamespaceHttp.ts +7 -6
- package/src/Cloudflare/KV/ReadNamespaceLocal.ts +35 -0
- package/src/Cloudflare/KV/ReadWriteNamespaceHttp.ts +11 -6
- package/src/Cloudflare/KV/ReadWriteNamespaceLocal.ts +42 -0
- package/src/Cloudflare/KV/WriteNamespaceHttp.ts +7 -6
- package/src/Cloudflare/KV/WriteNamespaceLocal.ts +35 -0
- package/src/Cloudflare/KV/index.ts +3 -0
- package/src/Cloudflare/Queues/QueueHttp.ts +24 -2
- package/src/Cloudflare/Queues/WriteQueueHttp.ts +16 -7
- package/src/Cloudflare/Queues/WriteQueueLocal.ts +64 -0
- package/src/Cloudflare/Queues/index.ts +1 -0
- package/src/Cloudflare/R2/BucketHttp.ts +20 -3
- package/src/Cloudflare/R2/BucketLocal.ts +47 -0
- package/src/Cloudflare/R2/ReadBucketHttp.ts +10 -5
- package/src/Cloudflare/R2/ReadBucketLocal.ts +33 -0
- package/src/Cloudflare/R2/ReadWriteBucketHttp.ts +11 -5
- package/src/Cloudflare/R2/ReadWriteBucketLocal.ts +36 -0
- package/src/Cloudflare/R2/WriteBucketHttp.ts +10 -5
- package/src/Cloudflare/R2/WriteBucketLocal.ts +33 -0
- package/src/Cloudflare/R2/index.ts +3 -0
- package/src/Cloudflare/Tunnel/ReadTunnel.ts +8 -9
- package/src/Cloudflare/Tunnel/ReadTunnelLocal.ts +33 -0
- package/src/Cloudflare/Tunnel/ReadWriteTunnel.ts +5 -5
- package/src/Cloudflare/Tunnel/ReadWriteTunnelLocal.ts +39 -0
- package/src/Cloudflare/Tunnel/TunnelBinding.ts +26 -2
- package/src/Cloudflare/Tunnel/TunnelLocalBinding.ts +38 -0
- package/src/Cloudflare/Tunnel/WarpConnector.ts +8 -5
- package/src/Cloudflare/Tunnel/WriteTunnel.ts +8 -9
- package/src/Cloudflare/Tunnel/WriteTunnelLocal.ts +33 -0
- package/src/Cloudflare/Tunnel/index.ts +3 -0
- package/src/Cloudflare/Vectorize/SearchIndexHttpClient.ts +183 -0
- package/src/Cloudflare/Vectorize/SearchIndexLocal.ts +70 -0
- package/src/Cloudflare/Vectorize/index.ts +1 -0
- package/src/Cloudflare/Workers/BrowserHttpClient.ts +201 -0
- package/src/Cloudflare/Workers/BrowserLocal.ts +65 -0
- package/src/Cloudflare/Workers/ConfigProvider.ts +15 -1
- package/src/Cloudflare/Workers/DurableObject.ts +227 -6
- package/src/Cloudflare/Workers/Vite.ts +93 -11
- package/src/Cloudflare/Workers/Worker.ts +19 -1
- package/src/Cloudflare/Workers/WorkerAsyncBindings.ts +6 -5
- package/src/Cloudflare/Workers/WorkerBinding.ts +20 -1
- package/src/Cloudflare/Workers/WorkerBridge.ts +12 -2
- package/src/Cloudflare/Workers/WorkerProvider.ts +664 -117
- package/src/Cloudflare/Workers/WorkerRuntimeContext.ts +14 -45
- package/src/Cloudflare/Workers/index.ts +1 -0
- package/src/Diff.ts +33 -0
- package/src/GitHub/Secrets.ts +1 -1
- package/src/GitHub/Variables.ts +1 -1
- package/src/Local/RpcSerialization.ts +6 -2
- package/src/Local/RpcSpawner.ts +21 -8
- package/src/Neon/AuthProvider.ts +1 -1
- package/src/Plan.ts +17 -4
- package/src/Planetscale/Database.ts +2 -1
- package/src/Planetscale/MySQL/MySQLClusterSize.ts +120 -21
- package/src/Planetscale/MySQL/MySQLDatabase.ts +84 -44
- package/src/Platform.ts +12 -3
- package/src/Runtime.ts +92 -0
- package/src/RuntimeContext.ts +79 -0
- package/src/Server/Process.ts +11 -18
- package/src/Stack.ts +1 -1
- package/src/Test/Alchemy.ts +282 -0
- package/src/Util/cached-function.ts +5 -5
- package/src/Util/proxy-chain.ts +3 -0
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alchemy",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.63",
|
|
4
4
|
"homepage": "https://alchemy.run",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Sam Goodwin <sam@alchemy.run>",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/alchemy-run/alchemy
|
|
9
|
+
"url": "git+https://github.com/alchemy-run/alchemy.git",
|
|
10
10
|
"directory": "packages/alchemy"
|
|
11
11
|
},
|
|
12
12
|
"bin": {
|
|
@@ -26,8 +26,7 @@
|
|
|
26
26
|
"bundle": "tsdown",
|
|
27
27
|
"bundle:watch": "tsdown --watch",
|
|
28
28
|
"publish:npm": "cp ../README.md . && bun publish && rm README.md",
|
|
29
|
-
"test": "
|
|
30
|
-
"test:fast": "FAST=1 vitest run",
|
|
29
|
+
"test": "alchemy-test",
|
|
31
30
|
"test:benchmark": "tsx --tsconfig tsconfig.test.json test/types.benchmark.ts",
|
|
32
31
|
"nuke": "cd ../../ && bun nuke"
|
|
33
32
|
},
|
|
@@ -313,15 +312,15 @@
|
|
|
313
312
|
"@alchemy.run/node-utils": "0.0.5",
|
|
314
313
|
"@aws-sdk/credential-providers": "^3.0.0",
|
|
315
314
|
"@clack/prompts": "^0.11.0",
|
|
316
|
-
"@distilled.cloud/aws": "0.29.
|
|
317
|
-
"@distilled.cloud/axiom": "0.29.
|
|
318
|
-
"@distilled.cloud/cloudflare": "0.29.
|
|
315
|
+
"@distilled.cloud/aws": "0.29.1",
|
|
316
|
+
"@distilled.cloud/axiom": "0.29.1",
|
|
317
|
+
"@distilled.cloud/cloudflare": "0.29.1",
|
|
319
318
|
"@distilled.cloud/cloudflare-rolldown-plugin": "0.13.5",
|
|
320
319
|
"@distilled.cloud/cloudflare-runtime": "0.13.5",
|
|
321
320
|
"@distilled.cloud/cloudflare-vite-plugin": "0.13.5",
|
|
322
|
-
"@distilled.cloud/core": "0.29.
|
|
323
|
-
"@distilled.cloud/neon": "0.29.
|
|
324
|
-
"@distilled.cloud/planetscale": "0.29.
|
|
321
|
+
"@distilled.cloud/core": "0.29.1",
|
|
322
|
+
"@distilled.cloud/neon": "0.29.1",
|
|
323
|
+
"@distilled.cloud/planetscale": "0.29.1",
|
|
325
324
|
"@effect/vitest": ">=4.0.0-beta.97|| >=4.0.0",
|
|
326
325
|
"@libsql/client": "^0.17.0",
|
|
327
326
|
"@octokit/rest": "^22.0.1",
|
|
@@ -348,6 +347,7 @@
|
|
|
348
347
|
"yaml": "^2.0.0"
|
|
349
348
|
},
|
|
350
349
|
"devDependencies": {
|
|
350
|
+
"alchemy-test": "0.0.0",
|
|
351
351
|
"@clack/prompts": "^0.11.0",
|
|
352
352
|
"@cloudflare/containers": "^0.3.7",
|
|
353
353
|
"@cloudflare/puppeteer": "^1.1.0",
|
package/src/AWS/AuthProvider.ts
CHANGED
|
@@ -272,7 +272,7 @@ export const AwsAuth = AuthProviderLayer<
|
|
|
272
272
|
? Effect.fail(
|
|
273
273
|
new AuthError({
|
|
274
274
|
message:
|
|
275
|
-
"AWS stored credentials not found. Run: alchemy
|
|
275
|
+
"AWS stored credentials not found. Run: alchemy login --configure",
|
|
276
276
|
}),
|
|
277
277
|
)
|
|
278
278
|
: Effect.succeed({
|
package/src/AWS/EC2/hosted.ts
CHANGED
|
@@ -188,6 +188,7 @@ export const createEc2HostedSupport = ({
|
|
|
188
188
|
import { BunServices } from "@effect/platform-bun";
|
|
189
189
|
import { BunHttpServer } from "alchemy/Http";
|
|
190
190
|
import { Stack } from "alchemy/Stack";
|
|
191
|
+
import { reifyBoundConfigProvider } from "alchemy/Runtime";
|
|
191
192
|
import * as Config from "effect/Config";
|
|
192
193
|
import * as ConfigProvider from "effect/ConfigProvider";
|
|
193
194
|
import * as Credentials from "@distilled.cloud/aws/Credentials";
|
|
@@ -233,7 +234,7 @@ const program = handler.pipe(
|
|
|
233
234
|
Layer.provideMerge(
|
|
234
235
|
Layer.succeed(
|
|
235
236
|
ConfigProvider.ConfigProvider,
|
|
236
|
-
ConfigProvider.fromEnv()
|
|
237
|
+
reifyBoundConfigProvider(ConfigProvider.fromEnv(), process.env)
|
|
237
238
|
)
|
|
238
239
|
),
|
|
239
240
|
)
|
package/src/AWS/ECS/Task.ts
CHANGED
|
@@ -585,6 +585,7 @@ export const TaskProvider = () =>
|
|
|
585
585
|
import { BunServices } from "@effect/platform-bun";
|
|
586
586
|
import { BunHttpServer } from "alchemy/Http";
|
|
587
587
|
import { Stack } from "alchemy/Stack";
|
|
588
|
+
import { reifyBoundConfigProvider } from "alchemy/Runtime";
|
|
588
589
|
import * as Config from "effect/Config";
|
|
589
590
|
import * as ConfigProvider from "effect/ConfigProvider";
|
|
590
591
|
import * as Credentials from "@distilled.cloud/aws/Credentials";
|
|
@@ -630,7 +631,7 @@ const program = handler.pipe(
|
|
|
630
631
|
Layer.provideMerge(
|
|
631
632
|
Layer.succeed(
|
|
632
633
|
ConfigProvider.ConfigProvider,
|
|
633
|
-
ConfigProvider.fromEnv()
|
|
634
|
+
reifyBoundConfigProvider(ConfigProvider.fromEnv(), process.env)
|
|
634
635
|
)
|
|
635
636
|
),
|
|
636
637
|
)
|
|
@@ -38,6 +38,7 @@ import { Platform, type Main, type PlatformProps } from "../../Platform.ts";
|
|
|
38
38
|
import type { LogLine, LogsInput } from "../../Provider.ts";
|
|
39
39
|
import * as Provider from "../../Provider.ts";
|
|
40
40
|
import { Resource, type ResourceBinding } from "../../Resource.ts";
|
|
41
|
+
import { packEnvValue, unpackEnvValue } from "../../RuntimeContext.ts";
|
|
41
42
|
import { Self } from "../../Self.ts";
|
|
42
43
|
import * as Serverless from "../../Serverless/index.ts";
|
|
43
44
|
import { Stack } from "../../Stack.ts";
|
|
@@ -585,55 +586,17 @@ export const Function: Platform<
|
|
|
585
586
|
set: (id: string, output: Output.Output) =>
|
|
586
587
|
Effect.sync(() => {
|
|
587
588
|
// Key is already canonical (see RuntimeContext.sanitizeKey); store it
|
|
588
|
-
// verbatim.
|
|
589
|
+
// verbatim. `packEnvValue` marker-packs Redacted values so they
|
|
590
|
+
// survive the Output → Lambda env var round-trip.
|
|
589
591
|
const key = id;
|
|
590
|
-
|
|
591
|
-
// round-trip. `JSON.stringify(Redacted)` would emit the literal
|
|
592
|
-
// string `"<redacted>"` and lose the value, so secrets are
|
|
593
|
-
// serialized with a `{_tag: "Redacted", value: ...}` marker
|
|
594
|
-
// that the runtime `get` path detects and rebuilds.
|
|
595
|
-
env[key] = output.pipe(
|
|
596
|
-
Output.map((value) =>
|
|
597
|
-
Redacted.isRedacted(value)
|
|
598
|
-
? JSON.stringify({
|
|
599
|
-
_tag: "Redacted",
|
|
600
|
-
value: Redacted.value(value),
|
|
601
|
-
})
|
|
602
|
-
: JSON.stringify(value),
|
|
603
|
-
),
|
|
604
|
-
);
|
|
592
|
+
env[key] = output.pipe(Output.map(packEnvValue));
|
|
605
593
|
return key;
|
|
606
594
|
}),
|
|
607
595
|
get: <T>(key: string) =>
|
|
608
|
-
//
|
|
609
|
-
//
|
|
610
|
-
//
|
|
611
|
-
|
|
612
|
-
// `Config` would re-enter that interceptor for the same key and
|
|
613
|
-
// recurse forever, allocating until the Lambda init OOMs. The Worker
|
|
614
|
-
// runtime reads from `WorkerEnvironment` for the same reason.
|
|
615
|
-
Effect.sync(() => {
|
|
616
|
-
// Key is already canonical (see RuntimeContext.sanitizeKey).
|
|
617
|
-
const val = process.env[key];
|
|
618
|
-
if (val === undefined) {
|
|
619
|
-
return undefined;
|
|
620
|
-
}
|
|
621
|
-
try {
|
|
622
|
-
const value = JSON.parse(val);
|
|
623
|
-
if (
|
|
624
|
-
typeof value === "object" &&
|
|
625
|
-
value?._tag === "Redacted" &&
|
|
626
|
-
"value" in value
|
|
627
|
-
) {
|
|
628
|
-
return Redacted.make(
|
|
629
|
-
(value as { value: unknown }).value,
|
|
630
|
-
) as unknown as T;
|
|
631
|
-
}
|
|
632
|
-
return value as T;
|
|
633
|
-
} catch {
|
|
634
|
-
return val as unknown as T; // assume it's just a string
|
|
635
|
-
}
|
|
636
|
-
}),
|
|
596
|
+
// Key is already canonical (see RuntimeContext.sanitizeKey). Read
|
|
597
|
+
// straight from `process.env` — see `unpackEnvValue` for why this
|
|
598
|
+
// must never resolve through `Config.string`.
|
|
599
|
+
Effect.sync(() => unpackEnvValue<T>(process.env[key])),
|
|
637
600
|
serve: (handler: HttpEffect) =>
|
|
638
601
|
// @ts-ignore
|
|
639
602
|
ctx.listen(makeFunctionHttpHandler(handler)),
|
|
@@ -940,7 +903,7 @@ export const FunctionProvider = () =>
|
|
|
940
903
|
(importPath) => `
|
|
941
904
|
import { layer as nodeServicesLayer } from "@effect/platform-node/NodeServices";
|
|
942
905
|
import { Stack } from "alchemy/Stack";
|
|
943
|
-
import { makeEntrypointLayer } from "alchemy/Runtime";
|
|
906
|
+
import { makeEntrypointLayer, reifyBoundConfigProvider } from "alchemy/Runtime";
|
|
944
907
|
import { registerLambdaExtension } from "alchemy/AWS/Lambda/RuntimeExtension";
|
|
945
908
|
import * as Config from "effect/Config";
|
|
946
909
|
import * as ConfigProvider from "effect/ConfigProvider";
|
|
@@ -1001,7 +964,10 @@ const entryLayer = layer.pipe(
|
|
|
1001
964
|
Layer.provideMerge(
|
|
1002
965
|
Layer.succeed(
|
|
1003
966
|
ConfigProvider.ConfigProvider,
|
|
1004
|
-
|
|
967
|
+
// Auto-bound \`Config\` values arrive in the env as
|
|
968
|
+
// \`{"_tag":"Redacted","value":...}\` markers; reify them so a \`Config\`
|
|
969
|
+
// re-read inside a handler decodes the raw source value.
|
|
970
|
+
reifyBoundConfigProvider(ConfigProvider.fromEnv(), process.env)
|
|
1005
971
|
)
|
|
1006
972
|
),
|
|
1007
973
|
Layer.provideMerge(
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import * as Config from "effect/Config";
|
|
2
1
|
import * as Effect from "effect/Effect";
|
|
3
2
|
import * as Option from "effect/Option";
|
|
4
|
-
import * as Redacted from "effect/Redacted";
|
|
5
3
|
import { HttpServer, type HttpEffect } from "../../Http.ts";
|
|
6
4
|
import * as Output from "../../Output.ts";
|
|
7
5
|
import { serveRpc } from "../../Rpc.ts";
|
|
6
|
+
import {
|
|
7
|
+
packEnvValueKeepRedacted,
|
|
8
|
+
unpackEnvValue,
|
|
9
|
+
} from "../../RuntimeContext.ts";
|
|
8
10
|
import * as Server from "../../Server/index.ts";
|
|
9
11
|
|
|
10
12
|
export const MicrovmImageTypeId = "AWS.Lambda.MicrovmImage" as const;
|
|
@@ -49,45 +51,16 @@ export const makeMicrovmRuntimeContext = (
|
|
|
49
51
|
set: (bindingId: string, output: Output.Output) =>
|
|
50
52
|
Effect.sync(() => {
|
|
51
53
|
const key = bindingId.replaceAll(/[^a-zA-Z0-9]/g, "_");
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
JSON.stringify({
|
|
57
|
-
_tag: "Redacted",
|
|
58
|
-
value: Redacted.value(value),
|
|
59
|
-
}),
|
|
60
|
-
)
|
|
61
|
-
: JSON.stringify(value),
|
|
62
|
-
),
|
|
63
|
-
);
|
|
54
|
+
// `packEnvValueKeepRedacted` keeps the Redacted wrapper on the
|
|
55
|
+
// outside so deploy-time code can route secrets while the inner
|
|
56
|
+
// marker lets the runtime `get` accessor rebuild the wrapper.
|
|
57
|
+
env[key] = output.pipe(Output.map(packEnvValueKeepRedacted));
|
|
64
58
|
return key;
|
|
65
59
|
}),
|
|
66
60
|
get: <T>(key: string) =>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
try: () => {
|
|
71
|
-
const parsed = JSON.parse(value) as T;
|
|
72
|
-
if (
|
|
73
|
-
typeof parsed === "object" &&
|
|
74
|
-
parsed !== null &&
|
|
75
|
-
(parsed as { _tag?: unknown })._tag === "Redacted" &&
|
|
76
|
-
"value" in parsed
|
|
77
|
-
) {
|
|
78
|
-
return Redacted.make((parsed as { value: unknown }).value) as T;
|
|
79
|
-
}
|
|
80
|
-
return parsed;
|
|
81
|
-
},
|
|
82
|
-
catch: (error) => error as Error,
|
|
83
|
-
}),
|
|
84
|
-
),
|
|
85
|
-
Effect.catch((cause) =>
|
|
86
|
-
Effect.die(
|
|
87
|
-
new Error(`Failed to get environment variable: ${key}`, { cause }),
|
|
88
|
-
),
|
|
89
|
-
),
|
|
90
|
-
),
|
|
61
|
+
// Read straight from `process.env` — see `unpackEnvValue` for why
|
|
62
|
+
// this must never resolve through `Config.string`.
|
|
63
|
+
Effect.sync(() => unpackEnvValue<T>(process.env[key]) as T),
|
|
91
64
|
run: ((effect: Effect.Effect<void, never, any>) =>
|
|
92
65
|
Effect.sync(() => {
|
|
93
66
|
runners.push(effect);
|
package/src/Action.ts
CHANGED
|
@@ -2,10 +2,12 @@ import * as Context from "effect/Context";
|
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import type { Pipeable } from "effect/Pipeable";
|
|
5
|
+
import { makeCaptureContext } from "./ActionRuntimeContext.ts";
|
|
5
6
|
import { toFqn } from "./FQN.ts";
|
|
6
7
|
import type { Input } from "./Input.ts";
|
|
7
8
|
import { CurrentNamespace, type NamespaceNode } from "./Namespace.ts";
|
|
8
9
|
import * as Output from "./Output.ts";
|
|
10
|
+
import { RuntimeContext } from "./RuntimeContext.ts";
|
|
9
11
|
import { Stack } from "./Stack.ts";
|
|
10
12
|
|
|
11
13
|
/**
|
|
@@ -35,6 +37,14 @@ export interface ActionLike<
|
|
|
35
37
|
readonly Type: Type;
|
|
36
38
|
readonly LogicalId: string;
|
|
37
39
|
readonly Input: In;
|
|
40
|
+
/**
|
|
41
|
+
* Resource Outputs referenced via `yield* output` inside the init Effect,
|
|
42
|
+
* keyed by the Output's sanitized key. They become dependency edges (the
|
|
43
|
+
* Action waits for these upstreams) and are resolved against the tracker at
|
|
44
|
+
* apply time, then exposed to the body through the resolve
|
|
45
|
+
* {@link RuntimeContext}. Empty when the Action captures nothing.
|
|
46
|
+
*/
|
|
47
|
+
readonly Captures: Record<string, Output.Output>;
|
|
38
48
|
/** Resolved runner — populated by the init effect (if any). */
|
|
39
49
|
readonly Run: (input: In) => Effect.Effect<Out, any, any>;
|
|
40
50
|
/** @internal phantom */
|
|
@@ -83,9 +93,14 @@ export type ActionInit<In extends object | undefined, Out, Req> = Effect.Effect<
|
|
|
83
93
|
// const rows = yield* Sync({ table: bucket.name });
|
|
84
94
|
// // rows: Output<{ rows: number }, never>
|
|
85
95
|
//
|
|
86
|
-
// Tagged form for split contract/implementation
|
|
96
|
+
// Tagged form for split contract/implementation — declare the type with an
|
|
97
|
+
// interface, build the value with the no-arg overload, then supply the runner
|
|
98
|
+
// via `.make` (add the returned Layer to the stack's `providers`, or provide it
|
|
99
|
+
// locally with `Effect.provide`). The init passed to `.make` runs under the
|
|
100
|
+
// same capture context as the inline form, so `yield* output` accessors work:
|
|
87
101
|
//
|
|
88
|
-
//
|
|
102
|
+
// interface Sync extends Action<"Sync", { table: string }, { rows: number }> {}
|
|
103
|
+
// const Sync = Action<Sync, { table: string }, { rows: number }>()("Sync");
|
|
89
104
|
// const SyncLive = Sync.make(Effect.gen(function* () { /* ... */ }));
|
|
90
105
|
|
|
91
106
|
export function Action<
|
|
@@ -187,14 +202,23 @@ const makeActionClass = (
|
|
|
187
202
|
`alchemy/Action<${type}>`,
|
|
188
203
|
);
|
|
189
204
|
|
|
205
|
+
// Outputs referenced via `yield* output` inside the init Effect land here,
|
|
206
|
+
// recorded by the capture RuntimeContext. Shared per definition — the init
|
|
207
|
+
// runs at most once (Effect.cached), so captures are inherently
|
|
208
|
+
// per-definition, matching how the init's `Req` bubbles per definition.
|
|
209
|
+
const captures: Record<string, Output.Output> = {};
|
|
210
|
+
const captureContext = makeCaptureContext(captures);
|
|
211
|
+
|
|
190
212
|
const constructor = (...args: [any] | [string, any]) => {
|
|
191
213
|
const [id, input] =
|
|
192
214
|
args.length === 1 ? [type, args[0]] : (args as [string, any]);
|
|
193
215
|
return Effect.gen(function* () {
|
|
194
216
|
const run = resolveRunner
|
|
195
|
-
? yield* resolveRunner
|
|
217
|
+
? yield* resolveRunner.pipe(
|
|
218
|
+
Effect.provideService(RuntimeContext, captureContext),
|
|
219
|
+
)
|
|
196
220
|
: ((yield* SelfTag!) as ActionRunner<any, any, any>);
|
|
197
|
-
return yield* registerAction(type, id, input, run);
|
|
221
|
+
return yield* registerAction(type, id, input, run, captures);
|
|
198
222
|
});
|
|
199
223
|
};
|
|
200
224
|
|
|
@@ -203,12 +227,19 @@ const makeActionClass = (
|
|
|
203
227
|
extra.Self = SelfTag;
|
|
204
228
|
// `.make(initOrRun)` — accepts either a direct runner or an init Effect.
|
|
205
229
|
// For init form we use `Layer.effect` so the init's Req surfaces on the
|
|
206
|
-
// Layer
|
|
230
|
+
// Layer, and run it under the capture RuntimeContext so `yield* output`
|
|
231
|
+
// accessors are recorded just like the inline form; for runners we use
|
|
232
|
+
// `Layer.succeed` (nothing to capture).
|
|
207
233
|
extra.make = <R>(
|
|
208
234
|
initOrRun: ActionRunner<any, any, R> | ActionInit<any, any, R>,
|
|
209
235
|
) =>
|
|
210
236
|
isRunnerEffect(initOrRun)
|
|
211
|
-
? Layer.effect(
|
|
237
|
+
? Layer.effect(
|
|
238
|
+
SelfTag,
|
|
239
|
+
(initOrRun as ActionInit<any, any, R>).pipe(
|
|
240
|
+
Effect.provideService(RuntimeContext, captureContext),
|
|
241
|
+
),
|
|
242
|
+
)
|
|
212
243
|
: Layer.succeed(SelfTag, initOrRun as ActionRunner<any, any, any>);
|
|
213
244
|
}
|
|
214
245
|
return Object.assign(constructor, extra);
|
|
@@ -223,6 +254,7 @@ const registerAction = <
|
|
|
223
254
|
id: string,
|
|
224
255
|
input: any,
|
|
225
256
|
run: ActionRunner<In, Out, any>,
|
|
257
|
+
captures: Record<string, Output.Output>,
|
|
226
258
|
): Effect.Effect<Output.ToOutput<Out, never>, never, Stack> =>
|
|
227
259
|
Effect.gen(function* () {
|
|
228
260
|
const stack = yield* Stack;
|
|
@@ -255,6 +287,7 @@ const registerAction = <
|
|
|
255
287
|
FQN: fqn,
|
|
256
288
|
LogicalId: id,
|
|
257
289
|
Input: input,
|
|
290
|
+
Captures: captures,
|
|
258
291
|
Run: run,
|
|
259
292
|
Output: undefined as any,
|
|
260
293
|
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import type { Output } from "./Output.ts";
|
|
3
|
+
import { type BaseRuntimeContext, RuntimeContext } from "./RuntimeContext.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Runtime context bridge that lets an {@link Action} read Resource Outputs.
|
|
7
|
+
*
|
|
8
|
+
* Actions are peculiar: their init Effect runs at plan/stack-eval time (before
|
|
9
|
+
* any resource exists) while their body runs at apply time (after upstreams are
|
|
10
|
+
* materialized). To make `yield* db.databaseId` work inside an Action we split
|
|
11
|
+
* the {@link RuntimeContext} into two cooperating halves that share nothing but
|
|
12
|
+
* a sanitized key:
|
|
13
|
+
*
|
|
14
|
+
* - {@link makeCaptureContext} is provided while the init Effect runs. Its
|
|
15
|
+
* `set(key, output)` records the referenced {@link Output} (so the engine can
|
|
16
|
+
* add a dependency edge and later resolve it) and its `get(key)` hands back a
|
|
17
|
+
* *deferred* accessor — an Effect that re-reads whatever `RuntimeContext` is
|
|
18
|
+
* ambient when it actually runs.
|
|
19
|
+
* - {@link makeResolveContext} is provided around the Action body at apply
|
|
20
|
+
* time. Its `get(key)` returns the already-resolved value for that key.
|
|
21
|
+
*
|
|
22
|
+
* Because the accessor produced at init re-reads `RuntimeContext`, yielding it
|
|
23
|
+
* inside the body resolves against the apply-time context — no shared mutable
|
|
24
|
+
* state, no infinite recursion (the resolve context's `get` is terminal).
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const base = (id: string): Omit<BaseRuntimeContext, "get" | "set"> => ({
|
|
28
|
+
Type: "Action",
|
|
29
|
+
id,
|
|
30
|
+
env: {},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Capture context — provided while an Action's init Effect runs. Records every
|
|
35
|
+
* Output referenced via `yield* output` into `captures`, keyed by the Output's
|
|
36
|
+
* sanitized key, and returns deferred accessors.
|
|
37
|
+
*/
|
|
38
|
+
export const makeCaptureContext = (
|
|
39
|
+
captures: Record<string, Output>,
|
|
40
|
+
): BaseRuntimeContext => ({
|
|
41
|
+
...base("capture"),
|
|
42
|
+
set: (key, output) =>
|
|
43
|
+
Effect.sync(() => {
|
|
44
|
+
captures[key] = output as unknown as Output;
|
|
45
|
+
return key;
|
|
46
|
+
}),
|
|
47
|
+
// Deferred: re-read the ambient RuntimeContext at run time. At apply this is
|
|
48
|
+
// the resolve context below; its `get` returns the materialized value. The
|
|
49
|
+
// `RuntimeContext` requirement is erased at the Action boundary (`Run` is
|
|
50
|
+
// typed `Effect<Out, any, any>`) and satisfied by the resolve context, so
|
|
51
|
+
// the accessor presents as `Effect<T | undefined>`.
|
|
52
|
+
get: (<T>(key: string) =>
|
|
53
|
+
Effect.flatMap(RuntimeContext, (ctx) =>
|
|
54
|
+
ctx.get<T>(key),
|
|
55
|
+
)) as BaseRuntimeContext["get"],
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Resolve context — provided around an Action body at apply time. `resolved`
|
|
60
|
+
* maps each captured key to its value (already evaluated against the tracker).
|
|
61
|
+
*/
|
|
62
|
+
export const makeResolveContext = (
|
|
63
|
+
resolved: Record<string, unknown>,
|
|
64
|
+
): BaseRuntimeContext => ({
|
|
65
|
+
...base("resolve"),
|
|
66
|
+
set: (key) => Effect.succeed(key),
|
|
67
|
+
get: <T>(key: string) => Effect.succeed(resolved[key] as T | undefined),
|
|
68
|
+
});
|
package/src/Apply.ts
CHANGED
|
@@ -3,6 +3,9 @@ import * as Deferred from "effect/Deferred";
|
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Option from "effect/Option";
|
|
5
5
|
import type { Simplify } from "effect/Types";
|
|
6
|
+
import type { ActionLike } from "./Action.ts";
|
|
7
|
+
import { makeResolveContext } from "./ActionRuntimeContext.ts";
|
|
8
|
+
import { RuntimeContext } from "./RuntimeContext.ts";
|
|
6
9
|
import {
|
|
7
10
|
Artifacts,
|
|
8
11
|
ArtifactStore,
|
|
@@ -16,7 +19,7 @@ import {
|
|
|
16
19
|
Cli,
|
|
17
20
|
} from "./Cli/Cli.ts";
|
|
18
21
|
import type { ApplyStatus } from "./Cli/Event.ts";
|
|
19
|
-
import { havePropsChanged } from "./Diff.ts";
|
|
22
|
+
import { havePropsChanged, stripUnresolved } from "./Diff.ts";
|
|
20
23
|
import type { Input } from "./Input.ts";
|
|
21
24
|
import { generateInstanceId, InstanceId } from "./InstanceId.ts";
|
|
22
25
|
import * as Output from "./Output.ts";
|
|
@@ -405,7 +408,14 @@ const executeNode = (
|
|
|
405
408
|
stack: stackName,
|
|
406
409
|
stage,
|
|
407
410
|
fqn,
|
|
408
|
-
|
|
411
|
+
// Early commits (`creating`/`replacing`) persist plan props that may
|
|
412
|
+
// still hold unresolved Output exprs; strip them so state stores only
|
|
413
|
+
// plain data (see stripUnresolved in Diff.ts).
|
|
414
|
+
value: {
|
|
415
|
+
...value,
|
|
416
|
+
props: stripUnresolved(value.props),
|
|
417
|
+
namespace,
|
|
418
|
+
} as S,
|
|
409
419
|
});
|
|
410
420
|
|
|
411
421
|
const scopedSession = {
|
|
@@ -1117,6 +1127,25 @@ const executeNode = (
|
|
|
1117
1127
|
// `--force` is set). The output value is written to `tracker[fqn].output`
|
|
1118
1128
|
// so downstream Output evaluation works identically to resource attrs.
|
|
1119
1129
|
|
|
1130
|
+
/**
|
|
1131
|
+
* Run an Action body, resolving any Outputs it captured via `yield* output`
|
|
1132
|
+
* during init against the current tracker and exposing them to the body through
|
|
1133
|
+
* the resolve {@link RuntimeContext}. See {@link makeCaptureContext}.
|
|
1134
|
+
*/
|
|
1135
|
+
const runAction = Effect.fn("apply.runAction")(function* (
|
|
1136
|
+
task: ActionLike,
|
|
1137
|
+
input: any,
|
|
1138
|
+
outputs: Record<string, any>,
|
|
1139
|
+
) {
|
|
1140
|
+
const resolved: Record<string, unknown> = {};
|
|
1141
|
+
for (const [key, output] of Object.entries(task.Captures)) {
|
|
1142
|
+
resolved[key] = yield* Output.evaluate(output, outputs);
|
|
1143
|
+
}
|
|
1144
|
+
return yield* task
|
|
1145
|
+
.Run(input)
|
|
1146
|
+
.pipe(Effect.provideService(RuntimeContext, makeResolveContext(resolved)));
|
|
1147
|
+
});
|
|
1148
|
+
|
|
1120
1149
|
const executeActionNode = (
|
|
1121
1150
|
fqn: string,
|
|
1122
1151
|
node: ActionApply,
|
|
@@ -1195,9 +1224,12 @@ const executeActionNode = (
|
|
|
1195
1224
|
// until its run actually starts.
|
|
1196
1225
|
yield* report("pending");
|
|
1197
1226
|
yield* waitForDeps(
|
|
1198
|
-
|
|
1199
|
-
(
|
|
1200
|
-
|
|
1227
|
+
[
|
|
1228
|
+
...new Set([
|
|
1229
|
+
...Object.keys(Output.resolveUpstream(node.input)),
|
|
1230
|
+
...Object.keys(Output.upstreamAny(task.Captures)),
|
|
1231
|
+
]),
|
|
1232
|
+
].filter((f) => f in readyStable),
|
|
1201
1233
|
);
|
|
1202
1234
|
|
|
1203
1235
|
const outputs = getOutputs();
|
|
@@ -1216,7 +1248,7 @@ const executeActionNode = (
|
|
|
1216
1248
|
});
|
|
1217
1249
|
yield* report("running");
|
|
1218
1250
|
|
|
1219
|
-
const result = yield* task
|
|
1251
|
+
const result = yield* runAction(task, resolvedInput, outputs);
|
|
1220
1252
|
|
|
1221
1253
|
yield* commit<RanActionState>({
|
|
1222
1254
|
kind: "action",
|
|
@@ -1440,7 +1472,7 @@ const converge = Effect.fn(function* (
|
|
|
1440
1472
|
} satisfies RunningActionState,
|
|
1441
1473
|
});
|
|
1442
1474
|
|
|
1443
|
-
const result = yield* node.def
|
|
1475
|
+
const result = yield* runAction(node.def, newInput, outputs);
|
|
1444
1476
|
|
|
1445
1477
|
yield* state.set({
|
|
1446
1478
|
stack: stackName,
|
|
@@ -1577,7 +1609,13 @@ const collectGarbage = Effect.fn(function* (
|
|
|
1577
1609
|
stack: stackName,
|
|
1578
1610
|
stage,
|
|
1579
1611
|
fqn,
|
|
1580
|
-
|
|
1612
|
+
// Same rule as the lifecycle commit above: state only stores
|
|
1613
|
+
// plain data, never unresolved Output exprs.
|
|
1614
|
+
value: {
|
|
1615
|
+
...value,
|
|
1616
|
+
props: stripUnresolved(value.props),
|
|
1617
|
+
namespace,
|
|
1618
|
+
} as S,
|
|
1581
1619
|
});
|
|
1582
1620
|
|
|
1583
1621
|
const report = (status: ApplyStatus) =>
|
package/src/Auth/AuthProvider.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { withLock } from "./Lock.ts";
|
|
|
12
12
|
* here so the redirect target lives in exactly one place across all
|
|
13
13
|
* provider OAuth clients.
|
|
14
14
|
*/
|
|
15
|
-
export const AUTH_LANDING_HOST = "https://
|
|
15
|
+
export const AUTH_LANDING_HOST = "https://alchemy.run";
|
|
16
16
|
export const AUTH_SUCCESS_URL = `${AUTH_LANDING_HOST}/auth/success`;
|
|
17
17
|
export const AUTH_ERROR_URL = `${AUTH_LANDING_HOST}/auth/error`;
|
|
18
18
|
|
package/src/Auth/Lock.ts
CHANGED
|
@@ -50,7 +50,10 @@ export const withLock = <A, E, R>(
|
|
|
50
50
|
try {
|
|
51
51
|
await fs.mkdir(lockDir, { recursive: true });
|
|
52
52
|
return await lock(lockPath, {
|
|
53
|
-
|
|
53
|
+
// A full single-process test run can build hundreds of provider
|
|
54
|
+
// layers concurrently. Each credential read briefly takes this
|
|
55
|
+
// lock, so tail waiters need enough budget to drain that queue.
|
|
56
|
+
retries: { retries: 2_400, minTimeout: 50, maxTimeout: 50 },
|
|
54
57
|
// The holder refreshes the lockfile mtime on a timer. Under heavy
|
|
55
58
|
// load (e.g. a full test run saturating every core) that timer can
|
|
56
59
|
// be starved for several seconds, so keep the stale threshold well
|
|
@@ -79,7 +82,7 @@ export const withLock = <A, E, R>(
|
|
|
79
82
|
) {
|
|
80
83
|
throw new Error(
|
|
81
84
|
`Timed out waiting for the alchemy auth lock '${lockPath}' — another alchemy ` +
|
|
82
|
-
`process has held it for over
|
|
85
|
+
`process has held it for over 120s. If no other alchemy process is running, ` +
|
|
83
86
|
`delete the lock file and retry.`,
|
|
84
87
|
{ cause: err },
|
|
85
88
|
);
|
package/src/Bundle/PurePlugin.ts
CHANGED
|
@@ -134,7 +134,7 @@ export const purePlugin = (
|
|
|
134
134
|
markSideEffectFreeOpt &&
|
|
135
135
|
!isEntry &&
|
|
136
136
|
isSideEffectFree(info.sideEffects);
|
|
137
|
-
const annotated =
|
|
137
|
+
const annotated = annotateModuleCached(code, id);
|
|
138
138
|
if (annotated === null) {
|
|
139
139
|
return markSideEffectFree ? { code, moduleSideEffects: false } : null;
|
|
140
140
|
}
|
|
@@ -433,6 +433,39 @@ interface AnnotatedModule {
|
|
|
433
433
|
readonly map: ReturnType<MagicString["generateMap"]>;
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
+
/**
|
|
437
|
+
* Process-wide memo of {@link annotateModule} results keyed by module id.
|
|
438
|
+
*
|
|
439
|
+
* Parsing with oxc + generating the sourcemap dominates bundling CPU (it
|
|
440
|
+
* showed up as ~60% of the main-thread profile of a test run), and the same
|
|
441
|
+
* modules — effect/alchemy dist files — are re-transformed for EVERY bundle
|
|
442
|
+
* built in the process. The single-process test runner builds dozens of
|
|
443
|
+
* worker bundles per run, so this cache eliminates all repeat parses. The
|
|
444
|
+
* stored `code` is compared on lookup, so a changed file (e.g. dev watch
|
|
445
|
+
* mode) never serves a stale result.
|
|
446
|
+
*/
|
|
447
|
+
const annotateCache = new Map<
|
|
448
|
+
string,
|
|
449
|
+
{ readonly code: string; readonly result: AnnotatedModule | null }
|
|
450
|
+
>();
|
|
451
|
+
const ANNOTATE_CACHE_MAX = 10_000;
|
|
452
|
+
|
|
453
|
+
const annotateModuleCached = (
|
|
454
|
+
code: string,
|
|
455
|
+
filename: string,
|
|
456
|
+
): AnnotatedModule | null => {
|
|
457
|
+
const cached = annotateCache.get(filename);
|
|
458
|
+
if (cached !== undefined && cached.code === code) {
|
|
459
|
+
return cached.result;
|
|
460
|
+
}
|
|
461
|
+
const result = annotateModule(code, filename);
|
|
462
|
+
if (annotateCache.size >= ANNOTATE_CACHE_MAX) {
|
|
463
|
+
annotateCache.clear();
|
|
464
|
+
}
|
|
465
|
+
annotateCache.set(filename, { code, result });
|
|
466
|
+
return result;
|
|
467
|
+
};
|
|
468
|
+
|
|
436
469
|
/**
|
|
437
470
|
* Parses `code` and inserts `/*#__PURE__*\/` before every top-level
|
|
438
471
|
* `CallExpression` / `NewExpression` callee. Returns `null` if the file
|