Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,39 @@ jobs:
yarn test:scripts
yarn changelog:check

typescript:
name: TypeScript ${{ matrix.typescript }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# The `typescript` peer accepts ^5 || ^6 || ^7: type-check and build the library and its
# declarations under each supported major that the toolchain (vue-tsc) runs on.
typescript: ['5.9', '6.0']

steps:
- name: Checkout code
uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '22'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Install TypeScript ${{ matrix.typescript }}
env:
TYPESCRIPT_RANGE: ~${{ matrix.typescript }}.0
run: |
yarn add --dev --ignore-scripts "typescript@${TYPESCRIPT_RANGE}"
node -e "const v=require('typescript').version;console.log('TypeScript',v);if(!v.startsWith(process.argv[1]+'.'))process.exit(1)" "${{ matrix.typescript }}"

- name: Type-check and build
run: yarn build

test:
runs-on: ubuntu-latest

Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,29 @@ versioning follows [SemVer](https://semver.org/).

<!-- Generated by `scripts/build-changelog.mjs`; edit `changelog/X.Y.Z.md`. -->

## [2.1.1](https://github.com/FicSysFR/jsonforms_builder/compare/2.1.0...2.1.1) - 2026-11-17

### 🐛 Fixes

- The `typescript` peer dependency is now optional and accepts `^5 || ^6 || ^7`: TypeScript is only
needed to type-check the host or to consume `./source`, and the former required `^5` peer made
TypeScript 6 hosts fail strict peer resolution (`23170e1`).
- Sources pass TypeScript 6's default `strict` mode, which matters to hosts type-checking the
`./source` export; `strict` is now explicit in the library configuration (`49ebe1a`).
- The npm package ships `THIRD_PARTY_NOTICES.md`, with the MIT notices of the JSON Forms derived
code and of Day.js, which `dist/` bundles; the Day.js notice was missing (`87dd86a`).

### 📝 Documentation

- Installation guide (FR/EN) and README: optional `typescript` peer and license notices to
reproduce when redistributing the library.

### 🔧 Internal

- CI type-checks and builds the library under TypeScript 5.9 and 6.0; the package audit enforces
the optional `typescript` peer and a notice section for every bundled third-party package
(`49ebe1a`, `87dd86a`).

## [2.1.0](https://github.com/FicSysFR/jsonforms_builder/compare/2.0.2...2.1.0) - 2026-10-19

### ✨ Features
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ yarn add @ficsysfr/jsonforms_builder @jsonforms/core @jsonforms/vue @nuxt/ui

`@nuxt/ui`, `@jsonforms/core`, `@jsonforms/vue`, and `vue` are **peerDependencies**: the library does not ship any Nuxt UI components; it imports them from the host app installation.

`typescript` is an **optional** peerDependency (`^5 || ^6 || ^7`): it only matters for the
host's type-checking or the `./source` export, never at runtime.

The package is BSD-3-Clause licensed (`LICENSE`) and ships `THIRD_PARTY_NOTICES.md` (MIT notices
of the JSON Forms derived code and of the bundled Day.js): reproduce both when redistributing.

## Usage

```vue
Expand Down
52 changes: 47 additions & 5 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# Third-Party Notices

This project includes source code derived from the JSON Forms project, which is licensed under the MIT License by EclipseSource Munich (2017-2019). The MIT License text is reproduced below in accordance with its terms.
`@ficsysfr/jsonforms_builder` is licensed under the BSD-3-Clause License (see `LICENSE`). This file
ships with the npm package and reproduces the notices of the third-party code it contains.

The playground example corpus is derived from two EclipseSource repositories, both MIT licensed:
Every other runtime dependency (Vue, JSON Forms, Nuxt UI, Tiptap, `@internationalized/date`,
`defu`, `radash`) stays external: it is installed by the host application and keeps its own
license file in `node_modules`.

- [`eclipsesource/jsonforms`](https://github.com/eclipsesource/jsonforms) — `packages/examples`
- [`eclipsesource/jsonforms-vuetify-renderers`](https://github.com/eclipsesource/jsonforms-vuetify-renderers) — `example/src/examples` (files prefixed `vuetify-`)
## JSON Forms (MIT License, derived source)

## JSON Forms (MIT License)
This project includes source code derived from the JSON Forms project, which is licensed under the
MIT License by EclipseSource Munich (2017-2019). The derived code is part of `src/` and of the
compiled `dist/` files.

```
The MIT License
Expand All @@ -33,3 +37,41 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
```

## Day.js (`dayjs`, MIT License, bundled)

The compiled `dist/` files bundle Day.js and its `customParseFormat` plugin
(<https://github.com/iamkun/dayjs>), so that hosts do not have to pre-bundle a CommonJS
dependency.

```
MIT License

Copyright (c) 2018-present, iamkun

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

## Repository only: playground example corpus

The playground example corpus (not part of the npm package) is derived from two EclipseSource
repositories, both under the JSON Forms MIT License reproduced above:

- [`eclipsesource/jsonforms`](https://github.com/eclipsesource/jsonforms) — `packages/examples`
- [`eclipsesource/jsonforms-vuetify-renderers`](https://github.com/eclipsesource/jsonforms-vuetify-renderers) — `example/src/examples` (files prefixed `vuetify-`)
28 changes: 28 additions & 0 deletions changelog/2.1.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
version: 2.1.1
date: 2026-11-17
title: TypeScript 6 compatibility and third-party notices
previous: 2.1.0
prerelease: false
---

### 🐛 Fixes

- The `typescript` peer dependency is now optional and accepts `^5 || ^6 || ^7`: TypeScript is only
needed to type-check the host or to consume `./source`, and the former required `^5` peer made
TypeScript 6 hosts fail strict peer resolution (`23170e1`).
- Sources pass TypeScript 6's default `strict` mode, which matters to hosts type-checking the
`./source` export; `strict` is now explicit in the library configuration (`49ebe1a`).
- The npm package ships `THIRD_PARTY_NOTICES.md`, with the MIT notices of the JSON Forms derived
code and of Day.js, which `dist/` bundles; the Day.js notice was missing (`87dd86a`).

### 📝 Documentation

- Installation guide (FR/EN) and README: optional `typescript` peer and license notices to
reproduce when redistributing the library.

### 🔧 Internal

- CI type-checks and builds the library under TypeScript 5.9 and 6.0; the package audit enforces
the optional `typescript` peer and a notice section for every bundled third-party package
(`49ebe1a`, `87dd86a`).
10 changes: 10 additions & 0 deletions docs/en/guide/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ unchanged apart from the import path.

`@nuxt/ui`, `@jsonforms/core`, `@jsonforms/vue` and `vue` are **peerDependencies**: the library bundles no Nuxt UI component of its own; it imports them from the host application’s installation.

`typescript` is an **optional** peerDependency (`^5 || ^6 || ^7`): it only matters for the
host’s type-checking or the `./source` export, never at runtime.

## Licenses

The library is BSD-3-Clause licensed (`LICENSE`). The npm package also ships
`THIRD_PARTY_NOTICES.md`: the MIT notices of the code derived from JSON Forms and of Day.js, which
is bundled into `dist/`. An application that redistributes the library reproduces both files in
its third-party notices.

## Requirements

- Node.js ≥ 22
Expand Down
10 changes: 10 additions & 0 deletions docs/guide/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ les exports publics restent identiques en dehors du chemin d'import.

`@nuxt/ui`, `@jsonforms/core`, `@jsonforms/vue` et `vue` sont des **peerDependencies** : la bibliothèque n’embarque aucun composant Nuxt UI ; elle les importe depuis l’installation de l’application hôte.

`typescript` est une peerDependency **optionnelle** (`^5 || ^6 || ^7`) : elle ne sert qu’au
contrôle de types de l’hôte ou à l’export `./source`, et n’est jamais requise à l’exécution.

## Licences

La bibliothèque est sous licence BSD-3-Clause (`LICENSE`). Le paquet npm livre aussi
`THIRD_PARTY_NOTICES.md` : notices MIT du code dérivé de JSON Forms et de Day.js, embarqué dans
`dist/`. Une application qui redistribue la bibliothèque reproduit ces deux fichiers dans ses
notices tierces.

## Prérequis

- Node.js ≥ 22
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"dist/**/*",
"src/**/*",
"README.md",
"LICENSE"
"LICENSE",
"THIRD_PARTY_NOTICES.md"
],
"scripts": {
"prebuild": "rimraf dist",
Expand Down Expand Up @@ -121,9 +122,14 @@
"@jsonforms/core": "^3.6",
"@jsonforms/vue": "^3.6",
"@nuxt/ui": "^4.10",
"typescript": "^5",
"typescript": "^5 || ^6 || ^7",
"vue": "^3.5"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/",
Expand Down
43 changes: 43 additions & 0 deletions scripts/package.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const PACKAGE_SPECS = [
'package.json',
'README.md',
'LICENSE',
'THIRD_PARTY_NOTICES.md',
'dist/index.d.ts',
'dist/json-formbuilder.es.js',
'dist/json-formbuilder.cjs.js',
Expand Down Expand Up @@ -142,6 +143,46 @@ export function validatePackResult(result, spec, expectedVersion) {
if (errors.length > 0) throw new Error(`${spec.name}:\n- ${errors.join('\n- ')}`)
}

/**
* TypeScript is only needed to type-check hosts or to consume `./source`: the compiled
* entries ship declarations that every supported TypeScript major reads. A required peer
* would make TypeScript 6 hosts fail strict peer resolution for no runtime reason.
*/
export const TYPESCRIPT_PEER_RANGE = '^5 || ^6 || ^7'

/**
* Third-party packages compiled into `dist/` rather than left external in `vite.config.ts`.
* Their licenses require the notice to travel with every copy, so each one needs a section in
* `THIRD_PARTY_NOTICES.md`, which the library tarball must ship.
*/
export const BUNDLED_THIRD_PARTY_PACKAGES = ['dayjs']

export function validateThirdPartyNotices(notices) {
const missing = BUNDLED_THIRD_PARTY_PACKAGES.filter(
(name) => !new RegExp(`^## .*\\(\`${name}\`, `, 'm').test(notices),
)
if (missing.length > 0) {
throw new Error(`THIRD_PARTY_NOTICES.md lacks a section for bundled ${missing.join(', ')}`)
}
}

export function validateLibraryManifest(manifest) {
const errors = []
if (!manifest.files?.includes('THIRD_PARTY_NOTICES.md')) {
errors.push('files must publish THIRD_PARTY_NOTICES.md')
}
const typescriptPeer = manifest.peerDependencies?.typescript
if (typescriptPeer !== undefined) {
if (typescriptPeer !== TYPESCRIPT_PEER_RANGE) {
errors.push(`typescript peer must be ${TYPESCRIPT_PEER_RANGE}, got ${typescriptPeer}`)
}
if (manifest.peerDependenciesMeta?.typescript?.optional !== true) {
errors.push('typescript peer must be optional (peerDependenciesMeta.typescript.optional)')
}
}
if (errors.length > 0) throw new Error(`${manifest.name}:\n- ${errors.join('\n- ')}`)
}

function validateManifests() {
const manifests = PACKAGE_SPECS.map((spec) => ({
spec,
Expand All @@ -161,6 +202,8 @@ function validateManifests() {
}

const library = manifests[0].manifest
validateLibraryManifest(library)
validateThirdPartyNotices(readFileSync(join(root, 'THIRD_PARTY_NOTICES.md'), 'utf8'))
for (const target of [
library.main,
library.module,
Expand Down
47 changes: 46 additions & 1 deletion scripts/tests/package.test.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
import { PACKAGE_SPECS, validatePackResult } from '../package.mjs'
import {
BUNDLED_THIRD_PARTY_PACKAGES,
PACKAGE_SPECS,
validateLibraryManifest,
validatePackResult,
validateThirdPartyNotices,
} from '../package.mjs'

const libraryManifest = () =>
JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8'))

test('library manifest satisfies the published peer contract', () => {
assert.doesNotThrow(() => validateLibraryManifest(libraryManifest()))
})

test('library manifest rejects a required or TypeScript 6 incompatible typescript peer', () => {
const required = libraryManifest()
required.peerDependencies.typescript = '^5 || ^6 || ^7'
delete required.peerDependenciesMeta
assert.throws(() => validateLibraryManifest(required), /typescript.*optional/)

const outdated = libraryManifest()
outdated.peerDependencies.typescript = '^5'
assert.throws(() => validateLibraryManifest(outdated), /typescript.*\^5 \|\| \^6 \|\| \^7/)

const absent = libraryManifest()
delete absent.peerDependencies.typescript
delete absent.peerDependenciesMeta?.typescript
assert.doesNotThrow(() => validateLibraryManifest(absent))
})

function validResult(spec) {
return {
Expand Down Expand Up @@ -38,3 +68,18 @@ test('package audit enforces name, version and size budgets', () => {
result.size = spec.maximumPackedSize + 1
assert.throws(() => validatePackResult(result, spec, '2.0.2'), /expected package name/)
})

test('library package ships the third-party notices', () => {
assert.ok(PACKAGE_SPECS[0].required.includes('THIRD_PARTY_NOTICES.md'))

const unlisted = libraryManifest()
unlisted.files = unlisted.files.filter((entry) => entry !== 'THIRD_PARTY_NOTICES.md')
assert.throws(() => validateLibraryManifest(unlisted), /THIRD_PARTY_NOTICES\.md/)
})

test('third-party notices cover every package bundled into dist', () => {
const notices = readFileSync(new URL('../../THIRD_PARTY_NOTICES.md', import.meta.url), 'utf8')
assert.doesNotThrow(() => validateThirdPartyNotices(notices))
assert.ok(BUNDLED_THIRD_PARTY_PACKAGES.includes('dayjs'))
assert.throws(() => validateThirdPartyNotices(notices.replaceAll('dayjs', 'removed')), /dayjs/)
})
2 changes: 1 addition & 1 deletion src/common/control-wrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export default defineComponent({
* @see help — description is always rendered; cf. template comment.
*/
fieldUi(): Record<string, string> {
return this.uiProps?.('formField')?.ui ?? {}
return (this.uiProps?.('formField')?.ui ?? {}) as Record<string, string>
},
},
})
Expand Down
2 changes: 1 addition & 1 deletion src/controls/file-upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const isMultipleFileSchema = schemaMatches((schema) => {

const items = schema.items

return Boolean(items) && hasType(items, 'string')
return items !== undefined && hasType(items, 'string')
})

/**
Expand Down
10 changes: 9 additions & 1 deletion src/i18n/createJsonFormsTranslator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ export const createJsonFormsTranslator = (
},
}

return (key, defaultMessage, values) => {
// `Translator` ties the return type to `defaultMessage`: a string default always yields a
// string, which the branches below honour; only a missing default can yield `undefined`.
const translate = (
key: string,
defaultMessage?: string,
values?: Parameters<typeof interpolateAjvErrorMessage>[1],
): string | undefined => {
const fromMessages = options.messages ? (get(options.messages, key) as unknown) : undefined
const fromAjv = get(ajvDict, key) as unknown
const raw =
Expand All @@ -68,4 +74,6 @@ export const createJsonFormsTranslator = (

return returnUndefinedWhenMissing ? undefined : ''
}

return translate as Translator
}
Loading
Loading