flex-md 4.7.1 → 4.7.2

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
@@ -34,6 +34,11 @@ Flex-MD is a TypeScript library for building and enforcing **Markdown Output Con
34
34
  npm install flex-md
35
35
  ```
36
36
 
37
+ ## Runtime Compatibility
38
+
39
+ - Node LTS baseline: `>=18 <22` (see `engines` in `package.json`).
40
+ - Dual-surface consumption guidance for library authors is documented in [docs/consumption.md](./docs/consumption.md).
41
+
37
42
  ## Quick Start
38
43
 
39
44
  ### 1. Define your Output Format Spec (OFS) with System Parts
@@ -0,0 +1,25 @@
1
+ # athenices ai-gateway coordination
2
+
3
+ ## Primary signal
4
+
5
+ The primary consumer bug report in this ecosystem was observed through `@athenices/ai-gateway` in the `extractJsonFromFlexMd` path.
6
+
7
+ ## Coordination policy
8
+
9
+ 1. Prefer fixing the gateway loader behavior first.
10
+ 2. Keep `flex-md` package-level behavior documented and smoke-tested.
11
+ 3. Only change `flex-md` runtime format outputs (for example, introducing a true ESM build) if gateway-side fixes still leave reproducible runtime failures.
12
+
13
+ ## flex-md package notes
14
+
15
+ - `flex-md` currently exposes `import` and `require` export conditions.
16
+ - Both resolved runtime files are currently CommonJS output.
17
+ - Package-level smoke coverage includes:
18
+ - direct `require` and `import` checks from local build artifacts,
19
+ - package-name resolution checks via tarball install in a temp consumer.
20
+
21
+ ## woroces ai-skills interaction
22
+
23
+ `@woroces/ai-skills` uses dynamic `import("flex-md")` in `parseFlexMd` when the gateway does not provide parsed payloads.
24
+
25
+ Improving gateway payload behavior reduces reliance on this fallback import path.
@@ -0,0 +1,45 @@
1
+ # flex-md consumption (library authors)
2
+
3
+ This document is for library/tool authors (gateways, SDK adapters, orchestrators), not end-user apps.
4
+
5
+ ## Node support baseline
6
+
7
+ - `flex-md` supports Node LTS in the range `>=18 <22`.
8
+ - Release validation should run `npm run build` then `npm run test:smoke`.
9
+
10
+ ## Export map behavior
11
+
12
+ `flex-md` publishes conditional exports:
13
+
14
+ - `import` -> `./dist/index.js`
15
+ - `require` -> `./dist/index.cjs`
16
+ - `types` -> `./dist/index.d.ts`
17
+
18
+ Today, both runtime entries are CommonJS output. The `import` condition gives Node and bundlers a resolver path, but does not currently mean ESM syntax output.
19
+
20
+ ## CJS bridge during publish
21
+
22
+ Build flow:
23
+
24
+ 1. `tsc` emits CommonJS files into `dist/`
25
+ 2. `tsc -p tsconfig.cjs.json` emits CommonJS files into `dist-cjs/`
26
+ 3. `scripts/cjs-bridge.mjs` copies `dist-cjs/index.js` to `dist/index.cjs`
27
+
28
+ This keeps a stable `require` entry while preserving the package export conditions expected by consumers.
29
+
30
+ ## Supported consumption patterns
31
+
32
+ - CommonJS: `const flex = require("flex-md")`
33
+ - ESM runtime: `import * as flex from "flex-md"`
34
+ - Dynamic fallback import: `const flex = await import("flex-md")`
35
+
36
+ For runtime confidence, use package-based smoke tests (install from tarball and load by package name) instead of importing local `dist/` paths only.
37
+
38
+ ## Bundler caveats
39
+
40
+ Some bundlers treat the `import` condition as if it must point to ESM syntax. In those environments:
41
+
42
+ - prefer default package resolution first,
43
+ - then apply bundler-specific externalization/transpile settings if needed.
44
+
45
+ If a bug reproduces only under one bundler graph, treat that as a consumer integration issue and document the supported loader pattern for that environment.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flex-md",
3
- "version": "4.7.1",
3
+ "version": "4.7.2",
4
4
  "description": "Parse and stringify FlexMD: semi-structured Markdown with three powerful layers - Frames, Output Format Spec (OFS), and Detection/Extraction.",
5
5
  "license": "MIT",
6
6
  "author": "",
@@ -20,6 +20,9 @@
20
20
  "esm": true
21
21
  },
22
22
  "type": "commonjs",
23
+ "engines": {
24
+ "node": ">=18 <22"
25
+ },
23
26
  "main": "./dist/index.cjs",
24
27
  "module": "./dist/index.js",
25
28
  "types": "./dist/index.d.ts",
@@ -36,6 +39,7 @@
36
39
  "files": [
37
40
  "dist",
38
41
  "docs",
42
+ "athenices-ai-gateway.md",
39
43
  "README.md",
40
44
  "SPEC.md"
41
45
  ],
@@ -43,18 +47,12 @@
43
47
  "build": "tsc && tsc -p tsconfig.cjs.json && node ./scripts/cjs-bridge.mjs",
44
48
  "test": "vitest run",
45
49
  "test:watch": "vitest",
46
- "test:smoke": "node test/smoke-require.cjs && node test/smoke-import.mjs",
50
+ "test:smoke": "node test/smoke-require.cjs && node test/smoke-import.mjs && node test/smoke-package-resolution.cjs",
47
51
  "deps:latest": "npx npm-check-updates -u && npm install"
48
52
  },
49
- "devDependencies": {
50
- "@types/node": "^25.0.3",
51
- "tsx": "^4.21.0",
52
- "typescript": "^5.6.3",
53
- "vitest": "^4.0.16"
54
- },
53
+ "devDependencies": {},
55
54
  "dependencies": {
56
55
  "micro-logs": "^1.0.0",
57
- "nd": "^1.2.0",
58
56
  "nx-helpers": "^1.5.0",
59
57
  "nx-json-parser": "^1.3.0",
60
58
  "nx-md-parser": "^2.2.1"