@plasius/chatbot 1.1.4 → 1.1.6

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
@@ -17,6 +17,7 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
17
17
  - Replaced `audit:deps` from `depcheck` to `npm ls --all --omit=optional --omit=peer > /dev/null 2>&1 || true` to avoid deprecated dependency-chain risk.
18
18
 
19
19
  - **Fixed**
20
+ - Enforced CommonJS runtime compatibility for dual-build output by generating and validating `dist-cjs/package.json` (`type: commonjs`) during build and package verification.
20
21
  - (placeholder)
21
22
 
22
23
  - **Security**
package/README.md CHANGED
@@ -17,6 +17,12 @@ Public package for chatbot UI/state integrations used in Plasius applications.
17
17
  npm install @plasius/chatbot
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/chatbot` 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/chatbot` 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/chatbot Package Scope](./adr-0001-chatbot-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/chatbot",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "OpenAI Chatbot",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  "audit:npm": "npm audit --audit-level=high --omit=dev",
22
22
  "audit:test": "vitest run --coverage",
23
23
  "audit:all": "npm-run-all -l audit:ts audit:eslint audit:deps audit:npm audit:test",
24
- "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",
24
+ "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",
25
25
  "lint": "eslint . --max-warnings=0",
26
26
  "prepare": "npm run build",
27
27
  "demo:run": "npm run build && node demo/example.mjs",
@@ -32,8 +32,8 @@
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
34
  "@plasius/entity-manager": "^1.0.6",
35
- "@plasius/error": "^1.0.5",
36
- "@plasius/profile": "^1.0.7",
35
+ "@plasius/error": "^1.0.6",
36
+ "@plasius/profile": "^1.0.9",
37
37
  "@plasius/schema": "^1.2.2",
38
38
  "emoji-picker-react": "^4.12.2",
39
39
  "react": "19.2.4",