@plasius/sharedassets 1.0.3 → 1.0.4

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
@@ -20,6 +20,21 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
20
20
  - **Security**
21
21
  - (placeholder)
22
22
 
23
+ ## [1.0.4] - 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
+
23
38
  ## [1.0.3] - 2026-03-01
24
39
 
25
40
  - **Added**
@@ -90,7 +105,7 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
90
105
 
91
106
  ---
92
107
 
93
- [Unreleased]: https://github.com/Plasius-LTD/sharedassets/compare/v1.0.3...HEAD
108
+ [Unreleased]: https://github.com/Plasius-LTD/sharedassets/compare/v1.0.4...HEAD
94
109
 
95
110
  ## [1.0.0] - 2026-02-11
96
111
 
@@ -109,3 +124,4 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
109
124
  [1.0.1]: https://github.com/Plasius-LTD/sharedassets/releases/tag/v1.0.1
110
125
  [1.0.2]: https://github.com/Plasius-LTD/sharedassets/releases/tag/v1.0.2
111
126
  [1.0.3]: https://github.com/Plasius-LTD/sharedassets/releases/tag/v1.0.3
127
+ [1.0.4]: https://github.com/Plasius-LTD/sharedassets/releases/tag/v1.0.4
package/README.md CHANGED
@@ -17,6 +17,12 @@ Public package containing shared static assets for Plasius frontend applications
17
17
  npm install @plasius/sharedassets
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/sharedassets` 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/sharedassets` 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/sharedassets Package Scope](./adr-0001-sharedassets-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/sharedassets",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Plasius shared asset library, allowing devs to utilise common components",
5
5
  "keywords": [
6
6
  "Components",
@@ -25,7 +25,7 @@
25
25
  "audit:npm": "npm audit --audit-level=high --omit=dev",
26
26
  "audit:test": "vitest run --coverage",
27
27
  "audit:all": "npm-run-all -l audit:ts audit:eslint audit:deps audit:npm audit:test",
28
- "build:cjs": "tsc -p tsconfig.json --module commonjs --moduleResolution node --outDir dist-cjs --tsBuildInfoFile dist-cjs/tsconfig.tsbuildinfo && rsync -av --include '*/' --include '*.module.css' --include '*.svg' --exclude '*' src/ dist-cjs/ || true",
28
+ "build:cjs": "tsc -p tsconfig.json --module commonjs --moduleResolution node --outDir dist-cjs --tsBuildInfoFile dist-cjs/tsconfig.tsbuildinfo && rsync -av --include '*/' --include '*.module.css' --include '*.svg' --exclude '*' src/ dist-cjs/ || true && node scripts/write-cjs-package-json.cjs",
29
29
  "lint": "eslint . --max-warnings=0",
30
30
  "prepare": "npm run build",
31
31
  "pack:check": "node scripts/verify-public-package.cjs",