@plasius/environment 1.0.5 → 1.0.7

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/CHANGELOG.md CHANGED
@@ -8,6 +8,35 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ - **Added**
12
+ - (placeholder)
13
+
14
+ - **Changed**
15
+ - (placeholder)
16
+
17
+ - **Fixed**
18
+ - (placeholder)
19
+
20
+ - **Security**
21
+ - (placeholder)
22
+
23
+ ## [1.0.7] - 2026-03-01
24
+
25
+ - **Added**
26
+ - (placeholder)
27
+
28
+ - **Changed**
29
+ - (placeholder)
30
+
31
+ - **Fixed**
32
+ - Enforced CommonJS runtime compatibility for dual-build output by generating and validating `dist-cjs/package.json` (`type: commonjs`) during build and package verification.
33
+ - (placeholder)
34
+
35
+ - **Security**
36
+ - (placeholder)
37
+
38
+ ## [1.0.6] - 2026-03-01
39
+
11
40
  - **Added**
12
41
  - (placeholder)
13
42
 
@@ -76,7 +105,7 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
76
105
 
77
106
  ---
78
107
 
79
- [Unreleased]: https://github.com/Plasius-LTD/environment/compare/v1.0.5...HEAD
108
+ [Unreleased]: https://github.com/Plasius-LTD/environment/compare/v1.0.7...HEAD
80
109
 
81
110
  ## [1.0.0] - 2026-02-11
82
111
 
@@ -94,3 +123,5 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
94
123
  [1.0.3]: https://github.com/Plasius-LTD/environment/releases/tag/v1.0.3
95
124
  [1.0.4]: https://github.com/Plasius-LTD/environment/releases/tag/v1.0.4
96
125
  [1.0.5]: https://github.com/Plasius-LTD/environment/releases/tag/v1.0.5
126
+ [1.0.6]: https://github.com/Plasius-LTD/environment/releases/tag/v1.0.6
127
+ [1.0.7]: https://github.com/Plasius-LTD/environment/releases/tag/v1.0.7
package/README.md CHANGED
@@ -17,6 +17,12 @@ Public package providing environment context helpers for Plasius React applicati
17
17
  npm install @plasius/environment
18
18
  ```
19
19
 
20
+ ## Module formats
21
+
22
+ This package publishes dual ESM and CJS artifacts.
23
+ When CJS output is emitted under `dist-cjs/*.js` with `type: module`, `dist-cjs/package.json` is generated with `{ "type": "commonjs" }` to ensure Node `require(...)` compatibility.
24
+
25
+
20
26
  ## Usage
21
27
 
22
28
  ```ts
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,22 @@
1
+ # ADR-0003: Dual ESM and CJS Runtime Compatibility
2
+
3
+ - Date: 2026-03-01
4
+ - Status: Accepted
5
+
6
+ ## Context
7
+
8
+ `@plasius/environment` publishes dual ESM and CJS entry points. This package currently emits CJS output under `dist-cjs/*.js` while the repository root uses `type: module`. Without an explicit CommonJS boundary for `dist-cjs`, Node can interpret those files as ESM and fail at runtime for `require(...)` consumers.
9
+
10
+ ## Decision
11
+
12
+ Keep dual output and enforce a runtime-compatible CJS boundary by:
13
+
14
+ - generating `dist-cjs/package.json` with `{ "type": "commonjs" }` as part of `build:cjs`;
15
+ - validating this metadata in `pack:check`;
16
+ - ensuring the packed artifact includes `dist-cjs/package.json`.
17
+
18
+ ## Consequences
19
+
20
+ - Node CommonJS consumers can reliably load `@plasius/environment` via `require(...)`.
21
+ - ESM consumers remain unchanged.
22
+ - CD publish checks fail fast if CJS runtime compatibility metadata is missing.
@@ -2,3 +2,4 @@
2
2
 
3
3
  - [ADR-0001: Standalone @plasius/environment Package Scope](./adr-0001-environment-package-scope.md)
4
4
  - [ADR-0002: Public Repository Governance Baseline](./adr-0002-public-repo-governance.md)
5
+ - [ADR-0003: Dual ESM and CJS Runtime Compatibility](./adr-0003-dual-esm-cjs-runtime-compatibility.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasius/environment",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Plasius Environment provider/context",
5
5
  "keywords": [
6
6
  ".env",
@@ -14,18 +14,19 @@
14
14
  "build": "tsc --build --listEmittedFiles && rsync -av --include '*/' --include '*.module.css' --exclude '*' src/ dist/ || true && npm run build:cjs",
15
15
  "test": "vitest run",
16
16
  "test:watch": "vitest",
17
+ "typecheck": "tsc --noEmit",
17
18
  "test:coverage": "vitest run --coverage",
18
19
  "test:coverage:watch": "vitest --coverage",
19
20
  "clean": "rimraf dist-cjs dist tsconfig.tsbuildinfo",
20
21
  "reset:clean": "rm -rf node_modules package-lock.json && npm run clean",
21
22
  "audit:ts": "tsc --noEmit --pretty",
22
- "audit:eslint": "eslint \"{src,apps,packages}/**/*.{ts,tsx}\" --max-warnings=0 --ext .ts,.tsx",
23
+ "audit:eslint": "eslint . --max-warnings=0",
23
24
  "audit:deps": "npm ls --all --omit=optional --omit=peer > /dev/null 2>&1 || true",
24
- "audit:npm": "npm audit --audit-level=moderate || true",
25
+ "audit:npm": "npm audit --audit-level=high --omit=dev",
25
26
  "audit:test": "vitest run --coverage",
26
27
  "audit:all": "npm-run-all -l audit:ts audit:eslint audit:deps audit:npm audit:test",
27
- "build:cjs": "tsc -p tsconfig.json --module commonjs --moduleResolution node --outDir dist-cjs --tsBuildInfoFile dist-cjs/tsconfig.tsbuildinfo --listEmittedFiles && rsync -av --include '*/' --include '*.module.css' --exclude '*' src/ dist-cjs/ || true",
28
- "lint": "eslint .",
28
+ "build:cjs": "tsc -p tsconfig.json --module commonjs --moduleResolution node --outDir dist-cjs --tsBuildInfoFile dist-cjs/tsconfig.tsbuildinfo --listEmittedFiles && rsync -av --include '*/' --include '*.module.css' --exclude '*' src/ dist-cjs/ || true && node scripts/write-cjs-package-json.cjs",
29
+ "lint": "eslint . --max-warnings=0",
29
30
  "prepare": "npm run build",
30
31
  "pack:check": "node scripts/verify-public-package.cjs",
31
32
  "prepublishOnly": "npm run build && npm run pack:check"
@@ -36,6 +37,7 @@
36
37
  "react": "^19.1.0"
37
38
  },
38
39
  "devDependencies": {
40
+ "@eslint/js": "^10.0.1",
39
41
  "@testing-library/react": "^16.3.0",
40
42
  "@types/react": "^19.1.8",
41
43
  "@types/uuid": "^10.0.0",
@@ -44,6 +46,7 @@
44
46
  "@vitest/coverage-v8": "^4.0.18",
45
47
  "ajv": "^6.12.6",
46
48
  "eslint": "^10.0.1",
49
+ "globals": "^17.3.0",
47
50
  "npm-run-all": "^1.1.3",
48
51
  "react": "19.2.4",
49
52
  "react-dom": "19.2.4",