The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
| 1 | import { Task } from "@alchemy.run/aws/ECS/Task"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import pg from "pg"; |
| 4 | |
| 5 | /** |
| 6 | * Regression fixture for CommonJS dual-package resolution in bundled |
| 7 | * programs: `pg` is a CJS consumer whose `require("pg-pool")` used to |
| 8 | * receive pg-pool's ESM namespace (the bundlers' `conditionNames` listed |
| 9 | * `"import"`, which applies to BOTH import kinds, and pg-pool's `exports` |
| 10 | * lists `import` first) — the module then died AT LOAD with |
| 11 | * `TypeError: The superclass is not a constructor`, before any user code. |
| 12 | * |
| 13 | * Importing `pg` and constructing a Pool in a deployed task pins the whole |
| 14 | * path behaviorally: a mis-resolved bundle exits 1 at boot; a correct one |
| 15 | * logs the marker and exits 0. |
| 16 | */ |
| 17 | export class CjsDualPackageTask extends Task<CjsDualPackageTask>()("EcsCjsDualPackageTask") {} |
| 18 | |
| 19 | export default CjsDualPackageTask.make( |
| 20 | { |
| 21 | main: import.meta.filename, |
| 22 | // Docker Hub's `oven/bun`; the public.ecr.aws default mirror rate-limits |
| 23 | // anonymous pulls during local builds (see fixtures/task.ts). |
| 24 | image: "oven/bun:1", |
| 25 | cpu: 256, |
| 26 | memory: 512, |
| 27 | // Build/run on ARM64 so an image built on an Apple Silicon host matches |
| 28 | // the Fargate runtime architecture (Graviton). |
| 29 | runtimePlatform: { |
| 30 | cpuArchitecture: "ARM64", |
| 31 | operatingSystemFamily: "LINUX", |
| 32 | }, |
| 33 | taskName: "alchemy-test-ecs-cjs-dual", |
| 34 | }, |
| 35 | Effect.gen(function* () { |
| 36 | return { |
| 37 | run: Effect.gen(function* () { |
| 38 | // Constructing (not connecting) exercises pg-pool's BoundPool class |
| 39 | // — the exact site that died when Pool was a module namespace. |
| 40 | const pool = new pg.Pool({ |
| 41 | connectionString: "postgres://user:pass@localhost:5432/db", |
| 42 | }); |
| 43 | yield* Effect.log(`alchemy-cjs-dual-ran: query=${typeof pool.query === "function"}`); |
| 44 | yield* Effect.promise(() => pool.end()); |
| 45 | }), |
| 46 | }; |
| 47 | }), |
| 48 | ); |