Files
2026-05-27 23:29:53 +01:00

2.2 KiB

Capability Spec Delta: storage-uri-plugin-bundle (fix-storage-uri-plugin-bundle-node-fetch-emit)

Package: @suaveplan/storage-uri-plugin-bundle Status: PROPOSED

Every requirement carries a **Verified by:** line.

ADDED Requirements

Requirement: ./node-fetch subpath emits a runnable .js artifact in dist/

The package's build SHALL emit dist/node-fetch/node-fetch.js (a real, non-empty ECMAScript module) alongside dist/node-fetch/node-fetch.d.ts so that runtime importers of @suaveplan/storage-uri-plugin-bundle/node-fetch resolve to a runnable file. The vite.config.ts SHALL declare src/node-fetch/node-fetch.ts as an explicit additional library entry — the universal-tier root barrel (src/index.ts) deliberately does NOT re-export nodeFileFetch (to keep node:* imports out of the universal surface), so rollup cannot discover the file via the root entry alone. The build SHALL preserve the existing universal-tier guarantee: dist/index.js SHALL still contain zero node:* imports.

Scenario: build emits a non-empty dist/node-fetch/node-fetch.js

  • WHEN the test runs node:fs.statSync(<package-root>/dist/node-fetch/node-fetch.js) after a clean bunx turbo build --filter=@suaveplan/storage-uri-plugin-bundle
  • THEN the stat succeeds, .isFile() is true, AND .size > 0

Scenario: emitted .js is dynamically importable and exports nodeFileFetch

  • WHEN the test invokes await import(<package-root>/dist/node-fetch/node-fetch.js) after a clean build
  • THEN the import resolves AND typeof imported.nodeFileFetch === "function"

Scenario: universal-tier root barrel remains node-free

  • WHEN the test reads dist/index.js and searches for node: (substring match, case-sensitive)
  • THEN no match is found (the root barrel imports no node:* modules; only the subpath entry pulls them)

Verified by: tests/build/node-fetch-emit.test.ts::"build emits a non-empty dist/node-fetch/node-fetch.js" AND tests/build/node-fetch-runtime-import.test.ts::"emitted node-fetch.js exports nodeFileFetch as a function" AND tests/build/node-fetch-emit.test.ts::"dist/index.js contains no node: imports"