optimade
Version:
Aggregating Optimade client for the online materials databases
24 lines (16 loc) • 2.43 kB
Markdown
## Why
`npm publish` cannot complete because the `prepublishOnly` script (`npm run build && npm run prefetch`) fails on modern Node. Two pinned dependencies are incompatible with the current toolchain: `rollup-plugin-typescript2@0.28.0` ships a default `include` glob that the transitive `@rollup/pluginutils@3` picomatch cannot match, so TypeScript sources are never transformed and the rollup build crashes; and `node-abort-controller@3.0.1` is a polyfill that is incompatible with the native `fetch`/`AbortController` shipped since Node 18, causing `prefetch.js` to throw `this.removeEventListener is not a function`. Both issues must be fixed so that releases can be cut from a current Node environment.
## What Changes
- Upgrade `rollup-plugin-typescript2` from `^0.28.0` to `^0.37.0` so that it pulls `@rollup/pluginutils@^4`, whose micromatch correctly handles the default `**/*.ts+(|x)` include pattern. This makes `rollup --config` transform `.ts` files again and produce `dist/index.mjs` and `dist/index.js`.
- Remove the `node-abort-controller` runtime dependency and the `global.AbortController = AbortController` override in `prefetch.js`, relying on the native `AbortController` available in Node 18+. This eliminates the `removeEventListener` crash during `prefetch`.
- No public API of the `optimade` package changes; the published artifact (`dist/`) and entry points remain identical.
## Capabilities
### New Capabilities
- `publish-build-pipeline`: Requirements for the `prepublishOnly` pipeline (lint → rollup build → prefetch) running under a supported Node version, ensuring `dist/` is produced and the prefetch step does not crash the publish flow.
### Modified Capabilities
<!-- None: no existing specs in openspec/specs/. -->
## Impact
- **Dependencies**: `devDependencies.rollup-plugin-typescript2` bumped `^0.28.0` → `^0.37.0`; `dependencies.node-abort-controller` removed.
- **Code**: `prefetch.js` drops the polyfill import and `global.AbortController` override; `src/utils.ts` is unchanged (it already uses the global `AbortController`).
- **Tooling**: `npm publish` (and `npm publish --dry-run`) on Node 18+ should run `prepublishOnly` to completion without a non-zero exit.
- **Runtime**: Consumers on Node < 18 would lose the `AbortController` polyfill; this is acceptable because Node 16 is EOL and the package's `fetchWithTimeout` requires a native `fetch`/`AbortController` anyway.