Repository navigation
v1.6.0 fixes TypeScript declaration and import errors, adds optional custom fetch support, and makes error handling and package verification more reliable. Existing CommonJS and default-import usage is preserved.
Fixes for package consumers
- TypeScript declaration error (#55): remove initializers that are invalid in
.d.tsambient declarations, fixingInitializers are not allowed in ambient contexts. - TypeScript constructor/import error (#57): align the declaration's CommonJS export with the actual exported class, fixing
TS2351: This expression is not constructablein the affected import scenarios. Compiled CommonJS and ESM TypeScript consumers are verified. - Response body failures: handle a rejected
response.text()promise inside the request error handler.parse()now returns an empty array for this failure, consistently with other handled request failures. - Malformed Google Sheets responses: check that the expected callback payload exists before extracting it; responses without that payload return an empty array directly.
- Option objects: use a safe own-property check so options created with
Object.create(null)or an overriddenhasOwnPropertydo not break option updates. Explicitfalsevalues remain supported.
Added
- A real named export:
PublicGoogleSheetsParseris available from both the source entry point and the built bundle, alongside the existing CommonJS constructor and default export. - Optional
fetchinjection: pass a request function in the constructor options or throughsetOption({ fetch }). This supports offline fixtures or caller-provided logging/retry behavior. Changing unrelated options retains the injected function. Omitting it keeps the existing browser/Node transport.
import { PublicGoogleSheetsParser } from 'public-google-sheets-parser'
const parser = new PublicGoogleSheetsParser('YOUR_SPREADSHEET_ID', {
fetch: (url) => fetch(url)
})
const rows = await parser.parse()The injected function receives the request URL and returns a promise for a response with ok and an asynchronous text() method. Automatic retries are not added by this release; they can be implemented in the supplied function.
Test and build improvements
- Make dist/integration test commands and coverage execution work on Windows as well as Linux.
- Replace live-network dependence in the default tests with deterministic fixtures while exercising the real parser and transport. Keep live Google Sheets integration checks available separately.
- Add regression checks for exports, request failures, GID selection, options, formatting, and browser usage. These checks protect existing behavior as well as the fixes above.
- Pin TypeScript for reproducible CommonJS/ESM consumer compilation and runtime checks.
- Run CI on Ubuntu and Windows with Node.js 22 and 24. Enforce 100% statement, branch, function, and line coverage.
Upgrade and verification
npm install public-google-sheets-parser@1.6.0The new fetch option is optional; existing constructor and parse() calls can continue unchanged. The package still has no runtime dependencies.
- CI run: all four environment jobs and both Codecov checks passed.
- Built and validated the actual npm tarball from the
v1.6.0tag before publication. - Installed the published package into a new consumer project with an empty npm cache. CommonJS/ESM exports, TypeScript compilation/runtime, the browser bundle, and live Google Sheets queries passed.
- Verified that registry integrity matches the tested tarball,
latestpoints to1.6.0, and jsDelivr/unpkg serve the same versioned browser bundle.
Release references
- Integration PR: #63, incorporating and superseding #60 and #62.
- Resolved issues: #55 and #57.
- Annotated tag
v1.6.0points to merge commit56c2977. - npm package
- Full changelog: v1.5.4...v1.6.0