Repository: sverweij/dependency-cruiser
Pull request #915 (2024-02-24 19:46:01)

chore: makes sources type:module ready & publish as type:module
## Description

- renames every module (that is not a test fixture or mock) with a .js extension to .cjs
- for _packaging_ only ensure the `package.json` has a `type: "module"` entry
  (during development time we still need the flexiblity of a package.json without - so we can tests scenarios without node throwing a hissy fit)

## Motivation and Context

dependency-cruiser has been ESM only since version 13. Until now it didn't advertise this in its package manifest. This is a non-standard way of doing ESM only modules. Then why didn't we do it the standard way? Well, glad you asked. Test fixtures and mocks are affected by the `"type": "module"` setting as well. As we have several tests that have .js files with commonjs in them, these got qualified as ESM - which jump-scares the nodejs ESM processor.

This PR circumvents this issue by
- not specifying a "type" in the manifest, so during development the .js modules in mocks and fixtures can still safely contain commonjs.
- when packaging _adding_ the `"type": "module"` to the manifest.

For this to work properly the last remnants of files still called ".js" but actually having commonjs content in `src` and `configs` needed to be renamed to .cjs. For good measure we did the same for all other `.js` module that wasn't a mock or fixture. 

## How Has This Been Tested?

- [x] green ci
- [x] throwing the new version against a few repositories (manually)

## Types of changes

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] Documentation only change
- [ ] Refactor (non-breaking change which fixes an issue without changing functionality)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist

- [x] :book:

  - My change doesn't require a documentation update, or ...
  - it _does_ and I have updated it

- [x] :balance_scale:
  - The contribution will be subject to [The MIT license](https://github.com/sverweij/dependency-cruiser/blob/main/LICENSE), and I'm OK with that.
  - The contribution is my own original work.
  - I am ok with the stuff in [**CONTRIBUTING.md**](https://github.com/sverweij/dependency-cruiser/blob/main/.github/CONTRIBUTING.md).


codeclimate[bot]: Code Climate has analyzed commit 0ea4e148 and detected **0 issues** on this pull request.

View more on [Code Climate](https://codeclimate.com/github/sverweij/dependency-cruiser/pull/915).

codeclimate[bot]: Code Climate has analyzed commit 4fdb75ab and detected **0 issues** on this pull request.

View more on [Code Climate](https://codeclimate.com/github/sverweij/dependency-cruiser/pull/915).


Patch:
diff --git a/.c8rc.json b/.c8rc.json
index 5d1cfc01..03fbb73b 100644
--- a/.c8rc.json
+++ b/.c8rc.json
@@ -12,11 +12,10 @@
     "coverage",
     "test",
     "tools",
-    "webpack.conf.js",
     "tmp*",
-    ".mocharc.js",
-    ".eslintrc.js",
-    "src/cli/tools/svg-in-html-snippets/script.snippet.js",
+    ".mocharc.cjs",
+    ".eslintrc.cjs",
+    "src/cli/tools/svg-in-html-snippets/script.snippet.cjs",
     "src/cli/init-config/get-user-input.mjs",
     "src/cli/listeners/*/index.mjs",
     "src/cli/listeners/{cli-feedback,ndjson}.mjs"
diff --git a/.codeclimate.yml b/.codeclimate.yml
index 241ed51e..28be17db 100644
--- a/.codeclimate.yml
+++ b/.codeclimate.yml
@@ -17,6 +17,6 @@ exclude_patterns:
   - "test/"
   - "types/"
   - "tools/"
-  - "src/report/dot-webpage/svg-in-html-snippets/script.js"
+  - "src/report/dot-webpage/svg-in-html-snippets/script.cjs"
   - "**/node_modules/"
   - "src/**/*.schema.mjs"
diff --git a/.dependency-cruiser.json b/.dependency-cruiser.json
index 609839a5..793266f2 100644
--- a/.dependency-cruiser.json
+++ b/.dependency-cruiser.json
@@ -41,7 +41,7 @@
           "^src/(main|utl|config-utl)/",
           "^src/report/dot-webpage/wrap-in-html[.]mjs$",
           "$1",
-          "^src/meta[.]js$",
+          "^src/meta[.]cjs$",
           "^src/extract/transpile/meta[.]mjs$"
         ],
         "dependencyTypesNot": ["npm", "core", "type-only"]
@@ -55,7 +55,7 @@
         "path": "(^src/report/)"
       },
       "to": {
-        "pathNot": ["$1", "^src/meta[.]js$", "^src/graph-utl", "^src/utl"],
+        "pathNot": ["$1", "^src/meta[.]cjs$", "^src/graph-utl", "^src/utl"],
         "dependencyTypesNot": ["npm", "core", "type-only"]
       }
     },
@@ -67,7 +67,7 @@
         "path": "(^src/extract/)"
       },
       "to": {
-        "pathNot": ["$1", "^src/meta[.]js$", "^src/graph-utl", "^src/utl"],
+        "pathNot": ["$1", "^src/meta[.]cjs$", "^src/graph-utl", "^src/utl"],
         "dependencyTypesNot": ["npm", "core", "type-only"],
         "exoticallyRequired": false
       }
@@ -86,7 +86,7 @@
       "severity": "error",
       "from": { "path": "(^bin/)" },
       "to": {
-        "pathNot": ["^src/cli", "^src/meta[.]js$"],
+        "pathNot": ["^src/cli", "^src/meta[.]cjs$"],
         "dependencyTypesNot": ["npm", "core", "type-only"]
       }
     },
@@ -312,7 +312,7 @@
       "mocks",
       "fixtures",
       "test/integration",
-      "src/report/dot-webpage/svg-in-html-snippets/script.js"
+      "src/report/dot-webpage/svg-in-html-snippets/script.cjs"
     ],
 
     /* list of module systems to cruise */
@@ -404,7 +404,7 @@
         "collapsePattern": ["^src/report/[^/]+", "^src/enrich/derive/[^/]+"],
         "filters": {
           "includeOnly": { "path": "^(src|bin)" },
-          "exclude": { "path": ["^src/meta[.]js$", "^src/utl/bus.+"] }
+          "exclude": { "path": ["^src/meta[.]cjs$", "^src/utl/bus.+"] }
         },
         "theme": {
           "replace": false,
@@ -471,7 +471,7 @@
             },
             {
               "criteria": {
-                "source": "^src/meta[.]js$|[.]schema[.]mjs$"
+                "source": "^src/meta[.]cjs$|[.]schema[.]mjs$"
               },
               "attributes": { "style": "filled" }
             },
diff --git a/.eslintrc.js b/.eslintrc.cjs
similarity index 97%
rename from .eslintrc.js
rename to .eslintrc.cjs
index 3d967b10..8783d8ae 100644
--- a/.eslintrc.js
+++ b/.eslintrc.cjs
@@ -61,7 +61,7 @@ module.exports = {
     "coverage",
     "tmp",
     "src/**/*.schema.mjs",
-    "src/report/dot-webpage/svg-in-html-snippets/script.js",
+    "src/report/dot-webpage/svg-in-html-snippets/script.cjs",
     "test/integration/**",
     "test/*/__fixtures__/**",
     "test/*/*/__fixtures__/**",
diff --git a/.gitattributes b/.gitattributes
index b146d528..44f7e5f0 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -8,7 +8,7 @@
 *.ogg binary
 
 src/schema/** linguist-generated
-src/meta.js linguist-generated
+src/meta.cjs linguist-generated
 **/*.template.js linguist-generated
 doc/** linguist-documentation
 docs/** linguist-documentation
\ No newline at end of file
diff --git a/.mocharc.js b/.mocharc.cjs
similarity index 100%
rename from .mocharc.js
rename to .mocharc.cjs
diff --git a/Makefile b/Makefile
index 5b512289..0e4f7b23 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ GENERATED_SOURCES=src/schema/baseline-violations.schema.mjs \
 	src/schema/baseline-violations.schema.json \
 	src/schema/configuration.schema.json \
 	src/schema/cruise-result.schema.json \
-	src/meta.js
+	src/meta.cjs
 
 SCHEMA_SOURCES=tools/schema/baseline-violations.schema.mjs \
 	tools/schema/cache-options.mjs \
@@ -71,6 +71,6 @@ src/%.schema.mjs: tools/%.schema.mjs $(SCHEMA_SOURCES) tools/generate-schemas.ut
 src/%.schema.json: tools/%.schema.mjs $(SCHEMA_SOURCES) tools/generate-schemas.utl.mjs
 	$(NODE) ./tools/generate-schemas.utl.mjs $@
 
-src/meta.js: package.json tools/generate-meta.utl.mjs
+src/meta.cjs: package.json tools/generate-meta.utl.mjs
 	$(NODE) ./tools/generate-meta.utl.mjs < $< > $@
 	npx prettier --write $@
diff --git a/bin/depcruise-baseline.mjs b/bin/depcruise-baseline.mjs
index 1f6def3f..62810b8e 100755
--- a/bin/depcruise-baseline.mjs
+++ b/bin/depcruise-baseline.mjs
@@ -2,7 +2,7 @@
 import { program } from "commander";
 import assertNodeEnvironmentSuitable from "#cli/assert-node-environment-suitable.mjs";
 import cli from "#cli/index.mjs";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 function formatError(pError) {
   process.stderr.write(pError.message);
diff --git a/bin/depcruise-fmt.mjs b/bin/depcruise-fmt.mjs
index 2a970c16..aaad0267 100755
--- a/bin/depcruise-fmt.mjs
+++ b/bin/depcruise-fmt.mjs
@@ -3,7 +3,7 @@
 import { program } from "commander";
 import assertNodeEnvironmentSuitable from "#cli/assert-node-environment-suitable.mjs";
 import format from "#cli/format.mjs";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 function formatError(pError) {
   process.stderr.write(pError.message);
diff --git a/bin/dependency-cruise.mjs b/bin/dependency-cruise.mjs
index 13884651..1e07fe94 100755
--- a/bin/dependency-cruise.mjs
+++ b/bin/dependency-cruise.mjs
@@ -3,7 +3,7 @@ import { EOL } from "node:os";
 import { program, Option } from "commander";
 import assertNodeEnvironmentSuitable from "#cli/assert-node-environment-suitable.mjs";
 import cli from "#cli/index.mjs";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 try {
   assertNodeEnvironmentSuitable();
diff --git a/configs/recommended-strict.js b/configs/recommended-strict.cjs
similarity index 74%
rename from configs/recommended-strict.js
rename to configs/recommended-strict.cjs
index 1c150c6b..cea4630d 100644
--- a/configs/recommended-strict.js
+++ b/configs/recommended-strict.cjs
@@ -1,4 +1,4 @@
-const recommended = require("./recommended");
+const recommended = require("./recommended.cjs");
 
 module.exports = {
   ...recommended,
diff --git a/configs/recommended-warn-only.js b/configs/recommended-warn-only.cjs
similarity index 74%
rename from configs/recommended-warn-only.js
rename to configs/recommended-warn-only.cjs
index 9c64cba3..c31a0faf 100644
--- a/configs/recommended-warn-only.js
+++ b/configs/recommended-warn-only.cjs
@@ -1,4 +1,4 @@
-const recommended = require("./recommended");
+const recommended = require("./recommended.cjs");
 
 module.exports = {
   ...recommended,
diff --git a/configs/recommended.js b/configs/recommended.cjs
similarity index 54%
rename from configs/recommended.js
rename to configs/recommended.cjs
index 20d7ac1e..375a2042 100644
--- a/configs/recommended.js
+++ b/configs/recommended.cjs
@@ -1,10 +1,10 @@
-const noCircular = require("./rules/no-circular");
-const noDeprecatedCore = require("./rules/no-deprecated-core");
-const noDuplicateDependencyTypes = require("./rules/no-duplicate-dependency-types");
-const noNonPackageJson = require("./rules/no-non-package-json");
-const noOrphans = require("./rules/no-orphans");
-const notToDeprecated = require("./rules/not-to-deprecated");
-const notToUnresolvable = require("./rules/not-to-unresolvable");
+const noCircular = require("./rules/no-circular.cjs");
+const noDeprecatedCore = require("./rules/no-deprecated-core.cjs");
+const noDuplicateDependencyTypes = require("./rules/no-duplicate-dependency-types.cjs");
+const noNonPackageJson = require("./rules/no-non-package-json.cjs");
+const noOrphans = require("./rules/no-orphans.cjs");
+const notToDeprecated = require("./rules/not-to-deprecated.cjs");
+const notToUnresolvable = require("./rules/not-to-unresolvable.cjs");
 
 module.exports = {
   forbidden: [
diff --git a/configs/rules/no-circular.js b/configs/rules/no-circular.cjs
similarity index 100%
rename from configs/rules/no-circular.js
rename to configs/rules/no-circular.cjs
diff --git a/configs/rules/no-deprecated-core.js b/configs/rules/no-deprecated-core.cjs
similarity index 100%
rename from configs/rules/no-deprecated-core.js
rename to configs/rules/no-deprecated-core.cjs
diff --git a/configs/rules/no-duplicate-dependency-types.js b/configs/rules/no-duplicate-dependency-types.cjs
similarity index 100%
rename from configs/rules/no-duplicate-dependency-types.js
rename to configs/rules/no-duplicate-dependency-types.cjs
diff --git a/configs/rules/no-non-package-json.js b/configs/rules/no-non-package-json.cjs
similarity index 100%
rename from configs/rules/no-non-package-json.js
rename to configs/rules/no-non-package-json.cjs
diff --git a/configs/rules/no-orphans.js b/configs/rules/no-orphans.cjs
similarity index 100%
rename from configs/rules/no-orphans.js
rename to configs/rules/no-orphans.cjs
diff --git a/configs/rules/not-to-deprecated.js b/configs/rules/not-to-deprecated.cjs
similarity index 100%
rename from configs/rules/not-to-deprecated.js
rename to configs/rules/not-to-deprecated.cjs
diff --git a/configs/rules/not-to-unresolvable.js b/configs/rules/not-to-unresolvable.cjs
similarity index 100%
rename from configs/rules/not-to-unresolvable.js
rename to configs/rules/not-to-unresolvable.cjs
diff --git a/package.json b/package.json
index ff820d63..f86ed853 100644
--- a/package.json
+++ b/package.json
@@ -119,7 +119,7 @@
   "types": "types/dependency-cruiser.d.mts",
   "files": [
     "bin",
-    "configs/**/*.js",
+    "configs/**/*.cjs",
     "configs/plugins/",
     "src",
     "!src/**/*.json",
@@ -156,8 +156,8 @@
     "depcruise:report:view": "node ./bin/dependency-cruise.mjs src bin test configs types --output-type err-html --config configs/.dependency-cruiser-show-metrics-config.mjs --output-to - | browser",
     "depcruise:focus": "node ./bin/dependency-cruise.mjs src bin test configs types tools --progress --no-cache --output-type text --focus",
     "depcruise:reaches": "node ./bin/dependency-cruise.mjs src bin test configs types tools --progress --no-cache --config configs/.dependency-cruiser-unlimited.mjs --output-type text --reaches",
-    "format": "prettier --log-level warn --write \"src/**/*.js\" \"configs/**/*.js\" \"tools/**/*.mjs\" \"bin/*\" \"types/*.d.mts\" \"test/**/*.spec.{cjs,js}\" \"test/**/*.{spec,utl}.mjs\"",
-    "format:check": "prettier --log-level warn --check \"src/**/*.js\" \"configs/**/*.js\" \"tools/**/*.mjs\" \"bin/*\" \"types/*.d.mts\" \"test/**/*.spec.{cjs,js}\" \"test/**/*.{spec,utl}.mjs\"",
+    "format": "prettier --log-level warn --write \"src/**/*.cjs\" \"configs/**/*.cjs\" \"tools/**/*.mjs\" \"bin/*\" \"types/*.d.mts\" \"test/**/*.spec.{cjs,js}\" \"test/**/*.{spec,utl}.mjs\"",
+    "format:check": "prettier --log-level warn --check \"src/**/*.cjs\" \"configs/**/*.cjs\" \"tools/**/*.mjs\" \"bin/*\" \"types/*.d.mts\" \"test/**/*.spec.{cjs,js}\" \"test/**/*.{spec,utl}.mjs\"",
     "lint": "npm-run-all --parallel --aggregate-output lint:eslint format:check lint:types",
     "lint:eslint": "eslint bin/dependency-cruise.mjs bin src test configs tools/**/*.mjs --cache --cache-location node_modules/.cache/eslint/",
     "lint:eslint:fix": "eslint --fix bin src test configs tools/**/*.mjs --cache --cache-location node_modules/.cache/eslint/",
@@ -167,7 +167,7 @@
     "lint:types:tsc": "tsc --project types/tsconfig.json",
     "lint:types:lint": "eslint --no-ignore --config types/.eslintrc.json types/*.d.mts",
     "lint:types:fix": "eslint --no-ignore --config types/.eslintrc.json --fix types/*.d.mts",
-    "prepack": "clean-pkg-json --dry --keep overrides --keep resolutions | jq '.scripts = {test: \"echo for test, build and static analysis scripts: see the github repository\"}' > smaller-package.json && mv smaller-package.json package.json",
+    "prepack": "clean-pkg-json --dry --keep overrides --keep resolutions | jq '.scripts = {test: \"echo for test, build and static analysis scripts: see the github repository\"}' | jq '.type = \"module\"' > smaller-package.json && mv smaller-package.json package.json",
     "postpack": "git restore package.json",
     "prepare": "husky install",
     "scm:push": "run-p --aggregate-output scm:push:*",
diff --git a/src/cli/assert-node-environment-suitable.mjs b/src/cli/assert-node-environment-suitable.mjs
index 3f8f0f6c..4408f11f 100644
--- a/src/cli/assert-node-environment-suitable.mjs
+++ b/src/cli/assert-node-environment-suitable.mjs
@@ -1,5 +1,5 @@
 import satisfies from "semver/functions/satisfies.js";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 export default function assertNodeEnvironmentSuitable(pNodeVersion) {
   // not using default parameter here because the check should run
diff --git a/src/cli/init-config/normalize-init-options.mjs b/src/cli/init-config/normalize-init-options.mjs
index 29cf4ba4..cdd56ffd 100644
--- a/src/cli/init-config/normalize-init-options.mjs
+++ b/src/cli/init-config/normalize-init-options.mjs
@@ -6,7 +6,7 @@ import {
   toSourceLocationArray,
 } from "./environment-helpers.mjs";
 import findExtensions from "./find-extensions.mjs";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 /**
  * @param {import("./types.js").IInitConfig} pInitOptions
diff --git a/src/cli/tools/wrap-stream-in-html.mjs b/src/cli/tools/wrap-stream-in-html.mjs
index 4c9d523c..2775155c 100755
--- a/src/cli/tools/wrap-stream-in-html.mjs
+++ b/src/cli/tools/wrap-stream-in-html.mjs
@@ -10,7 +10,7 @@ const STYLESHEET_FILE = fileURLToPath(
 );
 const SCRIPT_FILE = fileURLToPath(
   new URL(
-    "../../report/dot-webpage/svg-in-html-snippets/script.js",
+    "../../report/dot-webpage/svg-in-html-snippets/script.cjs",
     import.meta.url,
   ),
 );
diff --git a/src/config-utl/extract-babel-config.mjs b/src/config-utl/extract-babel-config.mjs
index fa954d06..f8cef5b0 100644
--- a/src/config-utl/extract-babel-config.mjs
+++ b/src/config-utl/extract-babel-config.mjs
@@ -4,7 +4,7 @@ import { extname } from "node:path";
 import json5 from "json5";
 import tryImport from "semver-try-require";
 import makeAbsolute from "./make-absolute.mjs";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 async function getJSConfig(pBabelConfigFileName) {
   let lReturnValue = {};
diff --git a/src/config-utl/extract-ts-config.mjs b/src/config-utl/extract-ts-config.mjs
index 9e3ce4c7..501e0e59 100644
--- a/src/config-utl/extract-ts-config.mjs
+++ b/src/config-utl/extract-ts-config.mjs
@@ -1,6 +1,6 @@
 import { dirname, resolve } from "node:path";
 import tryImport from "semver-try-require";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 const typescript = await tryImport(
   "typescript",
diff --git a/src/extract/ast-extractors/extract-typescript-deps.mjs b/src/extract/ast-extractors/extract-typescript-deps.mjs
index 10c0c0df..351485b5 100644
--- a/src/extract/ast-extractors/extract-typescript-deps.mjs
+++ b/src/extract/ast-extractors/extract-typescript-deps.mjs
@@ -1,7 +1,7 @@
 /* eslint-disable max-lines */
 /* eslint-disable no-inline-comments */
 import tryImport from "semver-try-require";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 /** @type {import("typescript")} */
 const typescript = await tryImport(
diff --git a/src/extract/ast-extractors/swc-dependency-visitor.mjs b/src/extract/ast-extractors/swc-dependency-visitor.mjs
index c0c73ea5..b0f36ba5 100644
--- a/src/extract/ast-extractors/swc-dependency-visitor.mjs
+++ b/src/extract/ast-extractors/swc-dependency-visitor.mjs
@@ -1,7 +1,7 @@
 /* eslint-disable no-inline-comments */
 /* eslint-disable max-classes-per-file */
 import tryImport from "semver-try-require";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 /** @type {import('@swc/core/Visitor')} */
 const { Visitor } = await tryImport(
diff --git a/src/extract/parse/to-swc-ast.mjs b/src/extract/parse/to-swc-ast.mjs
index 9890a2e9..ac9c510c 100644
--- a/src/extract/parse/to-swc-ast.mjs
+++ b/src/extract/parse/to-swc-ast.mjs
@@ -1,6 +1,6 @@
 import tryImport from "semver-try-require";
 import memoize from "lodash/memoize.js";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 /** @type {import('@swc/core')} */
 const swc = await tryImport("@swc/core", meta.supportedTranspilers.swc);
diff --git a/src/extract/parse/to-typescript-ast.mjs b/src/extract/parse/to-typescript-ast.mjs
index d4b7746c..2ab33660 100644
--- a/src/extract/parse/to-typescript-ast.mjs
+++ b/src/extract/parse/to-typescript-ast.mjs
@@ -2,7 +2,7 @@ import { readFileSync } from "node:fs";
 import tryImport from "semver-try-require";
 import memoize from "lodash/memoize.js";
 import transpile from "../transpile/index.mjs";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 import getExtension from "#utl/get-extension.mjs";
 
 /** @type {import('typescript')} */
diff --git a/src/extract/transpile/babel-wrap.mjs b/src/extract/transpile/babel-wrap.mjs
index 1f02712b..59955eb4 100644
--- a/src/extract/transpile/babel-wrap.mjs
+++ b/src/extract/transpile/babel-wrap.mjs
@@ -1,5 +1,5 @@
 import tryImport from "semver-try-require";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 const babel = await tryImport("@babel/core", meta.supportedTranspilers.babel);
 
diff --git a/src/extract/transpile/coffeescript-wrap.mjs b/src/extract/transpile/coffeescript-wrap.mjs
index 3ecbf97b..4e96387c 100644
--- a/src/extract/transpile/coffeescript-wrap.mjs
+++ b/src/extract/transpile/coffeescript-wrap.mjs
@@ -1,5 +1,5 @@
 import tryImport from "semver-try-require";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 /*
  * coffeescript's npm repo was renamed from coffee-script to coffeescript
diff --git a/src/extract/transpile/index.mjs b/src/extract/transpile/index.mjs
index 1ca3413a..7f798d70 100644
--- a/src/extract/transpile/index.mjs
+++ b/src/extract/transpile/index.mjs
@@ -80,7 +80,7 @@ export function getWrapper(pExtension, pTranspilerOptions) {
  *
  * @see section "supportedTranspilers" in [package.json](../../../package.json)
  *      for supported versions of transpilers
- * @see [meta.js](meta.js) for the extension -> transpiler mapping
+ * @see [meta.cjs](meta.cjs) for the extension -> transpiler mapping
  *
  * @param  {{ extension:string; source:string; filename:string; }} pFileRecord      Record with source code, an extension and a filename
  * @param  {any} pTranspilerOptions (optional) object with options influencing
@@ -91,7 +91,7 @@ export function getWrapper(pExtension, pTranspilerOptions) {
  */
 export default function transpile(
   { extension, source, filename },
-  pTranspilerOptions
+  pTranspilerOptions,
 ) {
   const lWrapper = getWrapper(extension, pTranspilerOptions);
 
diff --git a/src/extract/transpile/livescript-wrap.mjs b/src/extract/transpile/livescript-wrap.mjs
index adb97ef0..4567c245 100644
--- a/src/extract/transpile/livescript-wrap.mjs
+++ b/src/extract/transpile/livescript-wrap.mjs
@@ -1,5 +1,5 @@
 import tryImport from "semver-try-require";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 const livescript = await tryImport(
   "livescript",
diff --git a/src/extract/transpile/meta.mjs b/src/extract/transpile/meta.mjs
index d57a8318..ae5cd9af 100644
--- a/src/extract/transpile/meta.mjs
+++ b/src/extract/transpile/meta.mjs
@@ -1,6 +1,6 @@
 /* eslint security/detect-object-injection : 0*/
 import tryAvailable from "./try-import-available.mjs";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 function gotCoffee() {
   return (
diff --git a/src/extract/transpile/svelte-wrap.mjs b/src/extract/transpile/svelte-wrap.mjs
index 12db1b03..741ce674 100644
--- a/src/extract/transpile/svelte-wrap.mjs
+++ b/src/extract/transpile/svelte-wrap.mjs
@@ -1,6 +1,6 @@
 import tryImport from "semver-try-require";
 import preProcess from "./svelte-preprocess.mjs";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 const { compile } = await tryImport(
   "svelte/compiler",
diff --git a/src/extract/transpile/typescript-wrap.mjs b/src/extract/transpile/typescript-wrap.mjs
index 96492b32..cd87afbb 100644
--- a/src/extract/transpile/typescript-wrap.mjs
+++ b/src/extract/transpile/typescript-wrap.mjs
@@ -1,5 +1,5 @@
 import tryImport from "semver-try-require";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 const typescript = await tryImport(
   "typescript",
diff --git a/src/extract/transpile/vue-template-wrap.cjs b/src/extract/transpile/vue-template-wrap.cjs
index 6c667844..2c053007 100644
--- a/src/extract/transpile/vue-template-wrap.cjs
+++ b/src/extract/transpile/vue-template-wrap.cjs
@@ -1,7 +1,7 @@
 const { EOL } = require("node:os");
 const isEmpty = require("lodash/isEmpty");
 const tryRequire = require("semver-try-require");
-const meta = require("#meta.js");
+const meta = require("#meta.cjs");
 
 /*
  * vue-template-compiler was replaced by @vue/compiler-sfc for Vue3.
diff --git a/src/meta.js b/src/meta.cjs
similarity index 100%
rename from src/meta.js
rename to src/meta.cjs
diff --git a/src/report/dot-webpage/svg-in-html-snippets/script.js b/src/report/dot-webpage/svg-in-html-snippets/script.cjs
similarity index 100%
rename from src/report/dot-webpage/svg-in-html-snippets/script.js
rename to src/report/dot-webpage/svg-in-html-snippets/script.cjs
diff --git a/src/report/dot-webpage/wrap-in-html.mjs b/src/report/dot-webpage/wrap-in-html.mjs
index 7edd8ccb..196d28f7 100755
--- a/src/report/dot-webpage/wrap-in-html.mjs
+++ b/src/report/dot-webpage/wrap-in-html.mjs
@@ -5,7 +5,7 @@ const STYLESHEET_FILE = fileURLToPath(
   new URL("svg-in-html-snippets/style.css", import.meta.url),
 );
 const SCRIPT_FILE = fileURLToPath(
-  new URL("svg-in-html-snippets/script.js", import.meta.url),
+  new URL("svg-in-html-snippets/script.cjs", import.meta.url),
 );
 
 /**
diff --git a/src/report/error-html/index.mjs b/src/report/error-html/index.mjs
index ba8197b2..110739a5 100644
--- a/src/report/error-html/index.mjs
+++ b/src/report/error-html/index.mjs
@@ -4,7 +4,7 @@ import {
   determineTo,
 } from "./utl.mjs";
 import template from "./error-html-template.mjs";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 function getViolatedRuleRowClass(pViolatedRule) {
   return pViolatedRule.unviolated ? ' class="unviolated"' : "";
diff --git a/src/report/error-html/utl.mjs b/src/report/error-html/utl.mjs
index 07365ed5..192d73b8 100644
--- a/src/report/error-html/utl.mjs
+++ b/src/report/error-html/utl.mjs
@@ -1,6 +1,6 @@
 import has from "lodash/has.js";
 import { formatViolation, formatPercentage } from "../utl/index.mjs";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 function getFormattedAllowedRule(pRuleSetUsed) {
   const lAllowed = pRuleSetUsed?.allowed ?? [];
diff --git a/src/report/markdown.mjs b/src/report/markdown.mjs
index 70edd171..baeb906a 100644
--- a/src/report/markdown.mjs
+++ b/src/report/markdown.mjs
@@ -1,5 +1,5 @@
 import errorHtmlUtl from "./error-html/utl.mjs";
-import meta from "#meta.js";
+import meta from "#meta.cjs";
 
 const { aggregateViolations, determineTo, determineFromExtras } = errorHtmlUtl;
 
diff --git a/types/options.d.mts b/types/options.d.mts
index b0ecd01e..b0f82484 100644
--- a/types/options.d.mts
+++ b/types/options.d.mts
@@ -61,7 +61,7 @@ export interface ICruiseOptions {
    *
    * This ain't in none of the json schemas, but is used internally _instead_
    * of the rule set defined on global configuration level. Judo
-   * (a.o. flattening out extended rule sets) done in ../src/cli/normalize-options.js
+   * (a.o. flattening out extended rule sets) done in ../src/cli/normalize-cli-options.mjs
    */
   ruleSet?: IFlattenedRuleSet;
   /**


Test patch:
diff --git a/test/configs/no-orphans.spec.mjs b/test/configs/no-orphans.spec.mjs
index adf6a050..7328c08b 100644
--- a/test/configs/no-orphans.spec.mjs
+++ b/test/configs/no-orphans.spec.mjs
@@ -1,5 +1,5 @@
 import { equal } from "node:assert/strict";
-import noOrphansRule from "../../configs/rules/no-orphans.js";
+import noOrphansRule from "../../configs/rules/no-orphans.cjs";
 import matchModuleRule from "#validate/match-module-rule.mjs";
 
 describe("[I] configs/rules/no-orphans", () => {
diff --git a/test/report/d2/__mocks__/20-real-world-sample.mjs b/test/report/d2/__mocks__/20-real-world-sample.mjs
index 65650781..20c1666c 100644
--- a/test/report/d2/__mocks__/20-real-world-sample.mjs
+++ b/test/report/d2/__mocks__/20-real-world-sample.mjs
@@ -737,7 +737,7 @@ export default {
         },
         {
           dynamic: false,
-          module: "#meta.js",
+          module: "#meta.cjs",
           moduleSystem: "es6",
           exoticallyRequired: false,
           resolved: "src/meta.js",