Skip to content

release: v1.1.4 - make require() a synchronous wrapper around the ESM… - #81

Merged
cldmv-bot[bot] merged 20 commits into
masterfrom
next
Oct 5, 2026
Merged

cldmv-bot[bot] merged 20 commits into
masterfrom
next

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

@cldmv/jsonv v1.1.4 Changelog

Release Date: October 2026
Release Type: Patch
Branch: release/1.1.4


Overview

Version 1.1.4 fixes the CommonJS entry points. Until now require("@cldmv/jsonv"), and every require("@cldmv/jsonv/<year>"), returned a Promise of the ESM module rather than the API, so CommonJS code had to await it. require() now returns the same exports as import, synchronously, loaded through Node's require(esm).

Existing await require("@cldmv/jsonv") code keeps working unchanged. Two cases do change and are covered in the upgrade notes below: code that chained .then() on the require() result, and CommonJS code on Node.js versions without require(esm). The ESM API is untouched. The dev toolchain is also refreshed (@cldmv/fix-headers 2.2.0, @cldmv/configs 1.2.4, @cldmv/vitest-runner 1.5.1, typescript-eslint 8.71.0); none of it ships in the package.


🐛 Bug Fixes

require() is a synchronous wrapper around the ESM build (#80)

The CommonJS build went through a generated loader.cjs that did module.exports = (async () => await import("../index.mjs"))(), so require() handed back a Promise. Every generated .cjs file is now a thin wrapper, module.exports = require("<esm file>"), so require() returns the same module namespace object as import:

const { parse } = require("@cldmv/jsonv");
parse("{ a: 1 }"); // { a: 1 }

const jsonv2021 = require("@cldmv/jsonv/2021");

The rest of the CommonJS build was tidied along the way:

  • The async loader.cjs is no longer generated, and dist/cjs is rebuilt from scratch on every build so a removed wrapper can't linger.
  • @cldmv/jsonv/year-resolver now has a CommonJS wrapper. The "./*" export already pointed require at dist/cjs/years/year-resolver.cjs, but that file was never built, so require("@cldmv/jsonv/year-resolver") failed outright. @cldmv/jsonv/loader and the year modules are wrapped the same way.
  • On Node.js without require(esm) (before 20.19.0, or 22.0–22.11), the wrappers throw an ERR_REQUIRE_ESM error whose message names the required Node.js versions and points to import(), instead of failing with a bare loader error.

🔧 CI & tooling

  • New tests/cjs/entry.test.cjs (node:test), run by npm test and npm run coverage after Vitest through a new test:cjs script. It checks against the built dist/ that require() of the entry and of a year module returns the same exports as import, and that the Node.js version check fires when require(esm) is unavailable.

📚 Documentation

  • NEW: docs/changelog/v1/v1.1.4.md — this changelog.
  • docs/versioning-and-exports.md — notes that require() is synchronous and states its Node.js requirement.
  • README — restructured to the CLDMV README layout (badges, What's New, Installation with Node.js requirements, Documentation index, Links), with the changelog history backfilled for every earlier release under docs/changelog/v1/.

🔧 Dependencies

All development-only:

  • @cldmv/vitest-runner 1.4.3 → 1.5.1 (#77)
  • typescript-eslint 8.70.1 → 8.71.0 (#77)
  • @cldmv/fix-headers ^2.1.1 → ^2.2.0, resolved to 2.2.0. The range was first raised to ^2.1.4 (#83) and then to ^2.2.0 (#85). Version 2.1.4 no longer writes a JavaScript comment into JSON or Markdown files, processes every repeated --input, and never walks dependency folders such as node_modules. Version 2.2.0 changes @Last modified by only when a file's content was edited, so header-only rewrites keep the recorded editor.
  • @cldmv/configs ^1.2.0 → ^1.2.4, resolved to 1.2.4. The shared fix-headers config now sets forceAuthorUpdate and forceLastModifiedAuthorUpdate to false (#85).
  • No file headers were restamped: each fix-headers bump changed only package.json and the lockfile.

Upgrade notes

  • await require(...) keeps working. Awaiting a non-Promise returns it unchanged, so CommonJS code written against the old Promise-returning entry needs no change.
  • .then() on the require() result no longer works. require("@cldmv/jsonv").then((jsonv) => ...) now throws TypeError: ... .then is not a function, because the result is the module itself. Use the result directly (const jsonv = require("@cldmv/jsonv")), or await it.
  • CommonJS needs Node.js ^20.19.0 or >=22.12.0. On older Node.js, where await require("@cldmv/jsonv") used to resolve through the async loader, require() now throws ERR_REQUIRE_ESM with a message pointing to import(). Load the package with await import("@cldmv/jsonv") there. The engines field (>=18.0.0) and ESM import support are unchanged.
👥 Contributors

coverage

Metric Coverage
Statements 98.7%
Branches 97.3%
Functions 100.0%
Lines 98.8%

Avg: 98.7% · 640792e · Node lts/*

Co-authored-by: Shinrai Shinrai@users.noreply.github.com

Shinrai and others added 8 commits October 2, 2026 16:14
The Required PR Check mirror job was skipped on the `pull_request` run of
an in-repo feature PR, with a conditional name keeping the skipped check
off `✅ Required PR Check`. GitHub never evaluates a skipped job's
`name:`, so every in-repo PR showed the raw expression as a check name.

The job now uses `if: always()` and never skips, so its name is always
evaluated. On the in-repo PR path it lands on
`⏭️ Required PR Check (reported by the push run)` and passes as a no-op;
the push run still posts `✅ Required PR Check`. Every path that posts
the required name keeps `needs: ci`, so that check still only exists
once the full test matrix for the SHA has finished.

Synced from CLDMV/.github#351 (CLDMV/.github#350).
Bumps the minor group with 2 updates in the / directory: [@cldmv/vitest-runner](https://github.com/CLDMV/vitest-runner) and [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint).


Updates `@cldmv/vitest-runner` from 1.4.3 to 1.5.1
- [Release notes](https://github.com/CLDMV/vitest-runner/releases)
- [Commits](CLDMV/vitest-runner@v1.4.3...v1.5.1)

Updates `typescript-eslint` from 8.70.1 to 8.71.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.71.0/packages/typescript-eslint)

---
updated-dependencies:
- dependency-name: "@cldmv/vitest-runner"
  dependency-version: 1.5.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: minor
- dependency-name: typescript-eslint
  dependency-version: 8.71.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: minor
...

Signed-off-by: dependabot[bot] <support@github.com>
The CommonJS entry went through a generated loader.cjs that did
`module.exports = (async () => await import("../index.mjs"))()`, so
require("@cldmv/jsonv") - and every require("@cldmv/jsonv/<year>") -
returned a Promise of the ESM namespace instead of the API.

- scripts/build-cjs.mjs: every generated .cjs file is now a thin wrapper,
  `module.exports = require("<esm file>")`, loaded through Node's
  synchronous require(esm). require() returns the same exports as import.
  The async loader.cjs is no longer generated, dist/cjs is rebuilt from
  scratch, and dist/years/year-resolver.mjs now gets a CJS wrapper too
  (the "./*" export already pointed require at one that did not exist).
- Where Node.js has no require(esm) (before 20.19 / 22.12) the wrappers
  throw ERR_REQUIRE_ESM with a message pointing to import() instead of a
  bare loader error. engines is unchanged.
- tests/cjs: node:test checks against the built dist/, run by `npm test`
  and `npm run coverage` after Vitest: require() of the entry and of a
  year module returns the same exports as import, and the version check
  fires when require(esm) is off.
- docs: note that require() is synchronous and its Node.js requirement.

Existing `await require("@cldmv/jsonv")` code keeps working, since
awaiting a non-promise returns it unchanged; only code that chained
.then() on the require() result changes.
@cldmv-bot cldmv-bot Bot added ! release → master v4 flow: persistent next → master release PR (carries the next feature release) release Marks a pull request as a pending release — merge to publish a new version semver: patch This release contains only backwards-compatible bug fixes type: bug Something is broken or not behaving as expected area: tests Touches test files, fixtures, or test infrastructure type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments labels Oct 3, 2026
@cldmv-bot

cldmv-bot Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor Author

🔒 Dependency Review

  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ✅ 0 package(s) with unknown licenses
  • ✅ 0 denied package(s)
  • ✅ 0 package(s) with OpenSSF Scorecard score < 3

Full job summary

@cldmv-bot

cldmv-bot Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Bundle size increased

File Raw Δ Raw Gzipped Δ Gzipped
dist/api-types.mjs 56 B — 76 B —
dist/ast-types.mjs 551 B — 377 B —
dist/cjs/index.cjs 667 B +551 B (+475.0%) ⚠️ 433 B +312 B
dist/cjs/loader.cjs 0 B −174 B (-100.0%) ✅ 0 B −161 B
dist/cjs/years/2011.cjs 680 B +503 B (+284.2%) ⚠️ 442 B +280 B
dist/cjs/years/2012.cjs 680 B +503 B (+284.2%) ⚠️ 442 B +280 B
dist/cjs/years/2013.cjs 680 B +503 B (+284.2%) ⚠️ 443 B +280 B
dist/cjs/years/2014.cjs 680 B +503 B (+284.2%) ⚠️ 443 B +280 B
dist/cjs/years/2015.cjs 680 B +503 B (+284.2%) ⚠️ 443 B +280 B
dist/cjs/years/2016.cjs 680 B +503 B (+284.2%) ⚠️ 443 B +280 B
dist/cjs/years/2017.cjs 680 B +503 B (+284.2%) ⚠️ 443 B +280 B
dist/cjs/years/2018.cjs 680 B +503 B (+284.2%) ⚠️ 443 B +280 B
dist/cjs/years/2019.cjs 680 B +503 B (+284.2%) ⚠️ 442 B +279 B
dist/cjs/years/2020.cjs 680 B +503 B (+284.2%) ⚠️ 442 B +280 B
dist/cjs/years/2021.cjs 680 B +503 B (+284.2%) ⚠️ 442 B +280 B
dist/cjs/years/2022.cjs 680 B +503 B (+284.2%) ⚠️ 441 B +279 B
dist/cjs/years/2023.cjs 680 B +503 B (+284.2%) ⚠️ 442 B +280 B
dist/cjs/years/2024.cjs 680 B +503 B (+284.2%) ⚠️ 443 B +280 B
dist/cjs/years/2025.cjs 680 B +503 B (+284.2%) ⚠️ 443 B +280 B
dist/cjs/years/2026.cjs 680 B +503 B (+284.2%) ⚠️ 443 B +280 B
dist/cjs/years/2027.cjs 680 B +503 B (+284.2%) ⚠️ 443 B +280 B
dist/cjs/years/2028.cjs 680 B +503 B (+284.2%) ⚠️ 442 B +279 B
dist/cjs/years/2029.cjs 680 B +503 B (+284.2%) ⚠️ 442 B +279 B
dist/cjs/years/2030.cjs 680 B +503 B (+284.2%) ⚠️ 442 B +280 B
dist/cjs/years/2031.cjs 680 B +503 B (+284.2%) ⚠️ 443 B +280 B
dist/cjs/years/loader.cjs 684 B +503 B (+277.9%) ⚠️ 441 B +281 B
dist/cjs/years/year-resolver.cjs 698 B +698 B (+100.0%) ⚠️ 446 B +446 B
dist/diagnose.mjs 8.3 kB — 2.0 kB —
dist/errors.mjs 7.3 kB — 2.2 kB —
dist/index.mjs 4.2 kB — 1.2 kB —
dist/lexer/lexer-types.mjs 4.8 kB — 1.9 kB —
dist/lexer/lexer.mjs 54.9 kB — 10.5 kB —
dist/parser.mjs 53.8 kB — 13.7 kB —
dist/stringify.mjs 10.9 kB — 2.6 kB —
dist/types/api-types.d.mts 6.5 kB — 2.1 kB —
dist/types/api-types.d.mts.map 2.9 kB — 608 B —
dist/types/ast-types.d.mts 8.0 kB — 2.9 kB —
dist/types/ast-types.d.mts.map 2.7 kB — 736 B —
dist/types/cjs/index.d.cts 86 B — 74 B —
dist/types/cjs/years/2011.d.cts 102 B — 82 B —
dist/types/cjs/years/2012.d.cts 102 B — 82 B —
dist/types/cjs/years/2013.d.cts 102 B — 82 B —
dist/types/cjs/years/2014.d.cts 102 B — 82 B —
dist/types/cjs/years/2015.d.cts 102 B — 82 B —
dist/types/cjs/years/2016.d.cts 102 B — 82 B —
dist/types/cjs/years/2017.d.cts 102 B — 82 B —
dist/types/cjs/years/2018.d.cts 102 B — 82 B —
dist/types/cjs/years/2019.d.cts 102 B — 82 B —
dist/types/cjs/years/2020.d.cts 102 B — 82 B —
dist/types/cjs/years/2021.d.cts 102 B — 82 B —
dist/types/cjs/years/2022.d.cts 102 B — 82 B —
dist/types/cjs/years/2023.d.cts 102 B — 82 B —
dist/types/cjs/years/2024.d.cts 102 B — 82 B —
dist/types/cjs/years/2025.d.cts 102 B — 82 B —
dist/types/cjs/years/2026.d.cts 102 B — 82 B —
dist/types/cjs/years/2027.d.cts 102 B — 82 B —
dist/types/cjs/years/2028.d.cts 102 B — 82 B —
dist/types/cjs/years/2029.d.cts 102 B — 82 B —
dist/types/cjs/years/2030.d.cts 102 B — 82 B —
dist/types/cjs/years/2031.d.cts 102 B — 82 B —
dist/types/cjs/years/loader.d.cts 40 B — 60 B —
dist/types/cjs/years/year-resolver.d.cts 47 B +47 B (+100.0%) ⚠️ 63 B +63 B
dist/types/diagnose.d.mts 653 B — 344 B —
dist/types/diagnose.d.mts.map 319 B — 208 B —
dist/types/errors.d.mts 6.8 kB — 2.1 kB —
dist/types/errors.d.mts.map 1.1 kB — 345 B —
dist/types/index.d.mts 4.8 kB — 1.5 kB —
dist/types/index.d.mts.map 1.8 kB — 557 B —
dist/types/lexer/lexer-types.d.mts 6.3 kB — 2.5 kB —
dist/types/lexer/lexer-types.d.mts.map 2.1 kB — 717 B —
dist/types/lexer/lexer.d.mts 9.9 kB — 3.3 kB —
dist/types/lexer/lexer.d.mts.map 2.2 kB — 636 B —
dist/types/parser.d.mts 15.5 kB — 5.2 kB —
dist/types/parser.d.mts.map 3.1 kB — 907 B —
dist/types/stringify.d.mts 1.5 kB — 618 B —
dist/types/stringify.d.mts.map 691 B — 304 B —
dist/types/years/2011.d.mts 2.1 kB — 882 B —
dist/types/years/2011.d.mts.map 1.2 kB — 409 B —
dist/types/years/2015.d.mts 1.8 kB — 784 B —
dist/types/years/2015.d.mts.map 1.2 kB — 409 B —
dist/types/years/2020.d.mts 1.8 kB — 743 B —
dist/types/years/2020.d.mts.map 1.2 kB — 408 B —
dist/types/years/2021.d.mts 1.8 kB — 779 B —
dist/types/years/2021.d.mts.map 1.2 kB — 409 B —
dist/types/years/loader.d.mts 1.9 kB — 782 B —
dist/types/years/loader.d.mts.map 485 B — 243 B —
dist/types/years/year-resolver.d.mts 1.4 kB — 600 B —
dist/types/years/year-resolver.d.mts.map 503 B — 250 B —
dist/years/2011.mjs 2.5 kB — 943 B —
dist/years/2012.mjs 105 B — 95 B —
dist/years/2013.mjs 105 B — 95 B —
dist/years/2014.mjs 105 B — 95 B —
dist/years/2015.mjs 2.3 kB — 841 B —
dist/years/2016.mjs 105 B — 95 B —
dist/years/2017.mjs 105 B — 95 B —
dist/years/2018.mjs 105 B — 95 B —
dist/years/2019.mjs 105 B — 95 B —
dist/years/2020.mjs 2.2 kB — 812 B —
dist/years/2021.mjs 2.3 kB — 852 B —
dist/years/2022.mjs 105 B — 95 B —
dist/years/2023.mjs 105 B — 95 B —
dist/years/2024.mjs 105 B — 95 B —
dist/years/2025.mjs 105 B — 95 B —
dist/years/2026.mjs 105 B — 95 B —
dist/years/2027.mjs 105 B — 95 B —
dist/years/2028.mjs 105 B — 95 B —
dist/years/2029.mjs 105 B — 95 B —
dist/years/2030.mjs 105 B — 96 B —
dist/years/2031.mjs 105 B — 96 B —
dist/years/loader.mjs 2.8 kB — 1.0 kB —
dist/years/year-resolver.mjs 1.8 kB — 713 B —
Total 272.2 kB +11.9 kB 85.5 kB +6.7 kB

📊 Generated by bundle-size. Brotli sizes also measured but omitted from the table for brevity.

Shinrai and others added 12 commits October 3, 2026 16:56
Adds a per-version changelog under docs/changelog/v1/ for every shipped
release that had none (v1.0.0-v1.0.10, v1.1.0, v1.1.2, v1.1.3), written
from each release's diff against the previous one. v1.0.3-v1.0.6 were
released on GitHub only and never published to npm; v1.0.4 has no tag.
Adds docs/changelog/v1/v1.1.4.md for the pending release (#80: require()
returns the API synchronously; #77 dev dependency bumps) and reorganizes
the README to the CLDMV layout: intro, badges incl. coverage, What's New
(v1.1.4 Latest plus four recent releases linking their changelog files),
key features, installation with Node.js requirements, quick start, the
existing API/errors/AST/reference sections, a documentation index,
contributing, links and license. The quick-start example now escapes its
inner template literal, and the build-step list no longer names the
plugin step that build stopped running in v1.0.2.
Bumps @cldmv/fix-headers to 2.1.4 (JSON/Markdown/extension-less files never get a JS comment; dependency folders never walked). Ran fix:headers: 0 files restamped.
Restamping the file headers under 2.2.0 changed no headers (0 files restamped).
Shared fix-headers config 1.2.4 no longer forces author updates. Restamping the file headers changed no headers (0 files restamped).
@cldmv-bot
cldmv-bot Bot merged commit 059f51f into master Oct 5, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Touches test files, fixtures, or test infrastructure ! release → master v4 flow: persistent next → master release PR (carries the next feature release) release Marks a pull request as a pending release — merge to publish a new version semver: patch This release contains only backwards-compatible bug fixes type: bug Something is broken or not behaving as expected type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant