alchemy 2.0.0-beta.41 → 2.0.0-beta.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alchemy",
3
- "version": "2.0.0-beta.41",
3
+ "version": "2.0.0-beta.42",
4
4
  "homepage": "https://alchemy.run",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Sam Goodwin <sam@alchemy.run>",
@@ -681,8 +681,16 @@ export const Worker: Platform<
681
681
  Req | Providers
682
682
  >;
683
683
  } = Platform(WorkerTypeId, {
684
- onCreate: bindWorkerAsyncBindings,
685
- createRuntimeContext: makeWorkerRuntimeContext,
684
+ // Both hooks are wrapped in arrows so the imported references are resolved
685
+ // at call time rather than at module-load time. Worker.ts forms import
686
+ // cycles with both WorkerAsyncBindings.ts (which imports `isWorker` here)
687
+ // and WorkerRuntimeContext.ts (which imports `WorkerTypeId`/`WorkerEnvironment`
688
+ // here). Reading either binding eagerly here hits TDZ when Bun loads the
689
+ // package from node_modules in a different module-init order than the local
690
+ // workspace.
691
+ onCreate: (resource, props) =>
692
+ bindWorkerAsyncBindings(resource as Worker, props),
693
+ createRuntimeContext: (id) => makeWorkerRuntimeContext(id),
686
694
  });
687
695
 
688
696
  class MissingDurableObjectNamespaces extends Data.TaggedError(