Files
suaveplan/openspec/archive/2026-05-19-fix-storage-uri-plugin-bundle-node-fetch-emit/tasks.md
2026-05-27 23:29:53 +01:00

40 lines
2.8 KiB
Markdown

# Tasks — Fix `storage-uri-plugin-bundle` `./node-fetch` subpath emit
## 1. Spec authoring
- [ ] 1.1 `proposal.md` (this change) — including `## Impact` per §14a
- [ ] 1.2 `specs/storage-uri-plugin-bundle/spec.md` — ADDED requirement with three scenarios, each with a `**Verified by:**` line
## 2. Implementation
- [ ] 2.1 Edit `packages/storage/storage-uri-plugin-bundle/vite.config.ts`:
- Change `lib: { entry: "src/index.ts", formats: ["es"] }` to multi-entry form: `lib: { entry: { index: "src/index.ts", "node-fetch/node-fetch": "src/node-fetch/node-fetch.ts" }, formats: ["es"] }`
- Keep `rollupOptions.output.preserveModules: true` and the existing `entryFileNames: "[name].js"` pattern
- Keep externals as-is (`node:fs/promises` and `node:url` are already there)
- [ ] 2.2 `bunx turbo build --filter=@suaveplan/storage-uri-plugin-bundle` and verify `dist/node-fetch/node-fetch.js` exists, is non-empty, and starts with valid ESM (`import` / `export` statements)
## 3. Tests
- [ ] 3.1 `tests/build/node-fetch-emit.test.ts`:
- Scenario `"build emits a non-empty dist/node-fetch/node-fetch.js"` — `node:fs.statSync` the artifact, assert `isFile()` and `size > 0`
- Scenario `"dist/index.js contains no node: imports"` — `node:fs.readFileSync` the root entry, regex-match `/from\s+["']node:/`, assert zero matches
- [ ] 3.2 `tests/build/node-fetch-runtime-import.test.ts`:
- Scenario `"emitted node-fetch.js exports nodeFileFetch as a function"` — `await import(...)` the emitted file, assert `typeof imported.nodeFileFetch === "function"`
- [ ] 3.3 Both new test files MUST set `{ timeout: 30000 }` on every `it(...)` (they shell out to a build under the hood — or alternatively they assume the build already ran in the same turbo pipeline; document the chosen approach in the test file's leading comment)
- [ ] 3.4 Verify every existing `src/node-fetch/node-fetch.test.ts` still passes — no behavior change
## 4. Pre-archive verification (5-gate triple)
- [ ] 4.1 `bun run check` — Biome 0/0/0/0
- [ ] 4.2 `bunx turbo lint typecheck test --filter=@suaveplan/storage-uri-plugin-bundle` — green
- [ ] 4.3 `bunx turbo test:coverage --filter=@suaveplan/storage-uri-plugin-bundle` — 100/100/100/100
- [ ] 4.4 `bun scripts/openspec-conformance.ts @suaveplan/storage-uri-plugin-bundle` — exit 0
- [ ] 4.5 `bunx turbo build --filter=@suaveplan/storage-uri-plugin-bundle` — green
- [ ] 4.6 Manual: `ls -la packages/storage/storage-uri-plugin-bundle/dist/node-fetch/` SHOULD list `node-fetch.js`, `node-fetch.js.map`, `node-fetch.d.ts`, `node-fetch.d.ts.map`
## 5. Archive
- [ ] 5.1 Fold the ADDED requirement into `openspec/specs/storage-uri-plugin-bundle/spec.md`
- [ ] 5.2 Move folder to `openspec/archive/2026-05-19-fix-storage-uri-plugin-bundle-node-fetch-emit/`
- [ ] 5.3 Refresh `MANIFEST.md` if dep graph shifted (it should not — only build config changes)