@cldmv/fix-headers 2.6.1 → 2.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,17 +14,17 @@ Headers stay correct without hand-editing: `@Date` follows the file's real creat
14
14
 
15
15
  ## ✨ What's New
16
16
 
17
- ### Latest: v2.6.1 (November 2026)
17
+ ### Latest: v2.6.3 (December 2026)
18
18
 
19
- - **Dev tooling only, no behaviour changes** — the repository moves to `@cldmv/vitest-runner` 1.11.3 and `@cldmv/configs` 1.5.0, and `dependabot.yml` takes the CLDMV/.github v4.47.0 groups ([#219](https://github.com/CLDMV/fix-headers/pull/219)). fix-headers works exactly as in v2.6.0.
20
- - [View full v2.6.1 Changelog](https://github.com/CLDMV/fix-headers/blob/master/docs/changelog/v2/v2.6.1.md)
19
+ - **Dev-tooling bump only** — the repository moves to `@cldmv/configs` 1.6.0 ([#227](https://github.com/CLDMV/fix-headers/pull/227)). Options and header output are unchanged.
20
+ - [View full v2.6.3 Changelog](https://github.com/CLDMV/fix-headers/blob/master/docs/changelog/v2/v2.6.3.md)
21
21
 
22
22
  ### Recent Releases
23
23
 
24
+ - **v2.6.2** (November 2026) — `require()` keeps `.default` and the ESM names: `require(x).default` and `const { fixHeaders } = require(x)` work ([Changelog](https://github.com/CLDMV/fix-headers/blob/master/docs/changelog/v2/v2.6.2.md))
25
+ - **v2.6.1** (November 2026) — dev tooling only: `@cldmv/vitest-runner` 1.11.3, `@cldmv/configs` 1.5.0 and the v4.47.0 `dependabot.yml` groups ([Changelog](https://github.com/CLDMV/fix-headers/blob/master/docs/changelog/v2/v2.6.1.md))
24
26
  - **v2.6.0** (November 2026) — headerless `tsc` declarations take their source's header dates and author (new `tsconfig` option), the generic CommonJS shim, and `types/` generated at build time ([Changelog](https://github.com/CLDMV/fix-headers/blob/master/docs/changelog/v2/v2.6.0.md))
25
27
  - **v2.5.1** (November 2026) — `dist/` is built one file per module instead of a bundle, and the CLI (`dist/cli.mjs`) imports the library; `bin/` is no longer published ([Changelog](https://github.com/CLDMV/fix-headers/blob/master/docs/changelog/v2/v2.5.1.md))
26
- - **v2.5.0** (November 2026) — generated declarations carrying `tsc`'s copy of their source's header are restamped for where they ship; `rewriteDeclarationCopies: false` opts out ([Changelog](https://github.com/CLDMV/fix-headers/blob/master/docs/changelog/v2/v2.5.0.md))
27
- - **v2.4.0** (November 2026) — `@Filename` is written without a leading slash (`src/index.mjs`), and declarations carrying `tsc`'s copy of their source's header are skipped ([Changelog](https://github.com/CLDMV/fix-headers/blob/master/docs/changelog/v2/v2.4.0.md))
28
28
 
29
29
  📚 For complete release notes, see the [docs/changelog/](https://github.com/CLDMV/fix-headers/tree/master/docs/changelog/) folder.
30
30
 
package/dist/index.cjs CHANGED
@@ -17,9 +17,9 @@
17
17
  * @fileoverview CommonJS entry point: the generic CLDMV drop-in shim
18
18
  * (CLDMV/.github docs/conventions/package-layout.md).
19
19
  *
20
- * It returns what `import` gives: the single distinct exported value when there is one
21
- * (here `fixHeaders`, which is also the default export), so `require("@cldmv/fix-headers")`
22
- * is the function itself; otherwise the module object. scripts/build.mjs copies it
20
+ * It returns what `import` gives, in the usual CommonJS shape: when every export is one value
21
+ * (here `fixHeaders`, which is also the default export), `require("@cldmv/fix-headers")` is
22
+ * that function, carrying `.default` and `.fixHeaders`; otherwise the module object. scripts/build.mjs copies it
23
23
  * verbatim into dist/, where `./index.mjs` resolves to the built entry.
24
24
  * @module fix-headers/cjs-entry
25
25
  */
@@ -33,12 +33,21 @@ if (!process.features?.require_module) {
33
33
  throw error;
34
34
  }
35
35
 
36
- // Same exports as `import`. One distinct exported value (aliases of it count once) comes back as that value,
37
- // so require(x)(...) works; anything else comes back as the module object ({ default, ...named }).
36
+ // Same exports as `import`, in the usual CommonJS shape. When every export is one function or object
37
+ // (a default plus a named alias, or a single named export), require(x) is that value, so require(x)(...)
38
+ // works, and it carries .default and every exported name. Anything else is the module object
39
+ // ({ default, ...named }).
38
40
  const esm = require("./index.mjs");
39
- const values = new Set(
40
- Object.keys(esm)
41
- .filter((key) => key !== "__esModule")
42
- .map((key) => esm[key])
43
- );
44
- module.exports = values.size === 1 ? values.values().next().value : esm;
41
+ const keys = Object.keys(esm).filter((key) => key !== "__esModule");
42
+ const values = new Set(keys.map((key) => esm[key]));
43
+ let entry = esm;
44
+ if (values.size === 1) {
45
+ const value = esm[keys[0]];
46
+ if (value !== null && (typeof value === "function" || typeof value === "object")) {
47
+ for (const key of new Set(["default", ...keys])) {
48
+ if (!(key in value)) value[key] = value;
49
+ }
50
+ entry = value;
51
+ }
52
+ }
53
+ module.exports = entry;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cldmv/fix-headers",
3
- "version": "2.6.1",
3
+ "version": "2.6.3",
4
4
  "description": "Multi-language project header normalizer with auto-detection and override support.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -93,11 +93,11 @@
93
93
  "license": "Apache-2.0",
94
94
  "sideEffects": false,
95
95
  "devDependencies": {
96
- "@cldmv/configs": "^1.5.0",
97
- "@cldmv/eslint-plugin-jsonv": "^1.0.10",
98
- "@cldmv/jsonv": "^1.0.9",
99
- "@cldmv/prettier-plugin-jsonv": "^1.0.6",
100
- "@cldmv/vitest-runner": "^1.11.3",
96
+ "@cldmv/configs": "^1.6.0",
97
+ "@cldmv/eslint-plugin-jsonv": "^2.0.0",
98
+ "@cldmv/jsonv": "^1.2.4",
99
+ "@cldmv/prettier-plugin-jsonv": "^1.2.4",
100
+ "@cldmv/vitest-runner": "^1.11.4",
101
101
  "@eslint/css": "^2.0.0",
102
102
  "@eslint/js": "^10.0.1",
103
103
  "@eslint/json": "^2.1.0",