diff --git a/.github/workflows/bun.yml b/.github/workflows/bun.yml index 4f92ad3..52d140b 100644 --- a/.github/workflows/bun.yml +++ b/.github/workflows/bun.yml @@ -20,5 +20,5 @@ jobs: - name: Use Bun uses: antongolub/action-setup-bun@v1 - run: bun install - - run: make build + - run: bun run build - run: bun run mocha diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 4412d4a..44a2228 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -11,14 +11,14 @@ on: jobs: node-test: - name: Node.js tests (ESM) + name: Node.js tests runs-on: ubuntu-latest timeout-minutes: 10 strategy: matrix: - node-version: [16.x, 18.x] + node-version: [18.x, 20.x, 21.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: @@ -31,27 +31,6 @@ jobs: - run: npm run build --if-present - run: npm test - cjs-test: - name: Node.js tests (CommonJS) - - runs-on: ubuntu-latest - timeout-minutes: 10 - - strategy: - matrix: - node-version: [16.x, 18.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} (CommonJS) - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - run: npm ci - - run: npm run build --if-present - - run: make test-cjs - lint: name: Lint diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 52055f8..e5fe9a7 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - run: npm ci - run: npm test @@ -25,7 +25,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 registry-url: https://registry.npmjs.org/ - run: npm ci - run: npm publish @@ -39,11 +39,11 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - run: npm ci - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 registry-url: 'https://npm.pkg.github.com' scope: '@curveball' - run: npm publish diff --git a/.gitignore b/.gitignore index 14f5d7c..68e88e9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,7 @@ /node_modules # typescript output -/esm -/cjs +/dist # Directory used for running tests in CommonJS mode /cjs-test diff --git a/Makefile b/Makefile index 49a1cd8..9be815c 100644 --- a/Makefile +++ b/Makefile @@ -4,19 +4,12 @@ SOURCE_FILES:=$(shell find src/ -type f -name '*.ts') all: build .PHONY:build -build: cjs/build esm/build assets +build: dist/build assets .PHONY:test test: npx nyc mocha -.PHONY:test-cjs -test-cjs: - mkdir -p cjs-test - cd test; npx tsc --module commonjs --outdir ../cjs-test - echo '{"type": "commonjs"}' > cjs-test/package.json - cd cjs-test; npx mocha --no-package - .PHONY:lint lint: npx eslint --quiet 'src/**/*.ts' 'test/**/*.ts' @@ -37,22 +30,12 @@ start: build .PHONY:clean clean: - rm -rf dist esm cjs cjs-test - -cjs/build: $(SOURCE_FILES) - npx tsc --module commonjs --outDir cjs/ - echo '{"type": "commonjs"}' > cjs/package.json - @# Creating a small file to keep track of the last build time - touch cjs/build - - -esm/build: $(SOURCE_FILES) - npx tsc --module es2022 --outDir esm/ - echo '{"type": "module"}' > esm/package.json - @# Creating a small file to keep track of the last build time - touch esm/build + rm -rf dist +dist/build: $(SOURCE_FILES) + npx tsc + touch dist/build .PHONY:assets assets: assets/js/html-form-enhancer.js assets/js/serialize-json-form.js @@ -60,11 +43,9 @@ assets: assets/js/html-form-enhancer.js assets/js/serialize-json-form.js assets/js/html-form-enhancer.js: node_modules/html-form-enhancer/dist/html-form-enhancer.js mkdir -p assets/js cp node_modules/html-form-enhancer/dist/html-form-enhancer.* assets/js - touch cjs/build assets/js/serialize-json-form.js: node_modules/html-form-enhancer/dist/serialize-json-form.js cp node_modules/html-form-enhancer/dist/serialize-json-form.* assets/js - src/data/iana-links.json: node util/fetch-link-relation-data.mjs > src/data/iana-links.json diff --git a/changelog.md b/changelog.md index c4526de..6703688 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,17 @@ Changelog ========= +1.0.0 (????-??-??) +------------------ + +* Finally! Curveball v1. Only took 6 years. +* CommonJS support has been dropped. The previous version of this library + supported both CommonJS and ESM. The effort of this no longer feels worth it. + ESM is the future, so we're dropping CommonJS. +* Now requires Node 18. +* Upgraded to Typescript 5.3. + + 0.20.5 (2024-01-14) ------------------- diff --git a/package-lock.json b/package-lock.json index 619ff4e..95f1209 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.20.5", "license": "MIT", "dependencies": { - "@curveball/static": "^0.4.0", + "@curveball/static": "^1", "csv-parse": "^5.1.0", "highlight.js": "^11.2.0", "ketting": "^7.5.1", @@ -19,18 +19,18 @@ "react-dom": "^18.1.0" }, "devDependencies": { - "@curveball/kernel": "^0.21.0", - "@curveball/validator": "^0.10.0", + "@curveball/kernel": "^1.0.0", + "@curveball/validator": "^1", "@types/chai": "^4.3.11", "@types/markdown-it": "^13.0.7", "@types/mocha": "^10.0.1", - "@types/node": "^16.18.12", + "@types/node": "^18.19.7", "@types/node-fetch": "^2.6.1", "@types/react": "^18.0.12", "@types/react-dom": "^18.0.5", "@typescript-eslint/eslint-plugin": "^6.18.1", "@typescript-eslint/parser": "^6.18.1", - "chai": "^4.4.1", + "chai": "^5.0.0", "eslint": "^8.23.0", "html-form-enhancer": "^0.1.9", "jsdom": "^23.2.0", @@ -40,10 +40,10 @@ "typescript": "^5.3.3" }, "engines": { - "node": ">= 16" + "node": ">= 18" }, "peerDependencies": { - "@curveball/kernel": ">=0.21.0 <1" + "@curveball/kernel": "^1" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -565,23 +565,20 @@ } }, "node_modules/@curveball/controller": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@curveball/controller/-/controller-0.4.0.tgz", - "integrity": "sha512-4p/MqGZvAS7yQJVXK+tge5rzX+Yw1EmZpHh5g2aJHdyr9O9bWm/nC2Uljpq9epY/H4d1Vj03HysBXAPUjyhvAg==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@curveball/controller/-/controller-1.0.0.tgz", + "integrity": "sha512-ui6uS8i9YTB0dtz6qRYHblyG1oNoKYDuALH9WCPmsl0RS9mLXfjz9iXiigY7bgRtP24ybOM9MShu3MofXqrp+w==", "dev": true, "dependencies": { - "@curveball/http-errors": "^0.4.0" + "@curveball/http-errors": "^0.5.0" + }, + "engines": { + "node": ">= 18" }, "peerDependencies": { - "@curveball/kernel": ">=0.20.0 <1" + "@curveball/kernel": "^1" } }, - "node_modules/@curveball/controller/node_modules/@curveball/http-errors": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@curveball/http-errors/-/http-errors-0.4.1.tgz", - "integrity": "sha512-RJe0IOQQpgvCwUY8ZKK7/YgfWi1MqMzMrIHilwXHaMFykoVjpRNzaeO3FmrKSUlmJSb6vuPd37LEPNUne4PxZA==", - "dev": true - }, "node_modules/@curveball/http-errors": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/@curveball/http-errors/-/http-errors-0.5.0.tgz", @@ -591,9 +588,9 @@ } }, "node_modules/@curveball/kernel": { - "version": "0.21.2", - "resolved": "https://registry.npmjs.org/@curveball/kernel/-/kernel-0.21.2.tgz", - "integrity": "sha512-kj2VK+8ueY4R3qxEbwT+ir0LiLPhYjZfr86yPgdNiWZu+oaJ0gJ+ivD1uAQTB8pnZdcSJP6Lc1bfNS0y4X39rg==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@curveball/kernel/-/kernel-1.0.0.tgz", + "integrity": "sha512-zNi/4LvYLRua/wsjR9WwMNUsuIWZXoe0/5RjnjNra74WZR19tTewlOqMIkOermf6b2pYJ3pJt73P0YGhvZ8oaQ==", "dependencies": { "@curveball/http-errors": "^0.5.0", "@types/ws": "^8.5.3", @@ -602,63 +599,60 @@ "ws": "^8.5.0" }, "engines": { - "node": ">=14.4" + "node": ">=18" } }, "node_modules/@curveball/links": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@curveball/links/-/links-0.2.0.tgz", - "integrity": "sha512-ns5PY30LNJn9AArtKZ7HOREXdtaU4oXxvxq80nGVNAmJB1FIChzC+JtupfGJvVtFcY42q1lsZNKS7aA+bZRz5Q==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@curveball/links/-/links-1.0.0.tgz", + "integrity": "sha512-ehsPOdO2Izsj7eLm5eCL0xA85h7UV9lGpd0YSVPfRphOdNwSrneZQhPmEATLk3UBtM14wengpcTpWbH7lQ1f1A==", "dev": true, "dependencies": { "@types/http-link-header": "^1.0.2", "hal-types": "^1.2.1", "http-link-header": "^1.0.3" }, + "engines": { + "node": ">= 18" + }, "peerDependencies": { - "@curveball/kernel": ">=0.20.0 <1" + "@curveball/kernel": "^1" } }, "node_modules/@curveball/static": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@curveball/static/-/static-0.4.0.tgz", - "integrity": "sha512-CCZftQhdEFxeGdA0J/temQb2oZm/GoQhlaeXMeOOsC4HpbNuMJttoW+QnFFiPVqH31ao80INGZK1+tyIDGS31g==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@curveball/static/-/static-1.0.0.tgz", + "integrity": "sha512-Ih27a4zttvlEn64uIjpG/zyPn69Ew98VbEMQuegd5ly4tdnz/w8jGieBdcqrSNJ2EhfRGyMqI1/VH1c4dT0h4g==", "dependencies": { "mime-types": "^2.1.29" }, "engines": { - "node": ">= 16" + "node": ">= 18" }, "peerDependencies": { - "@curveball/kernel": ">=0.21.0 <1" + "@curveball/kernel": "^1" } }, "node_modules/@curveball/validator": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/@curveball/validator/-/validator-0.10.0.tgz", - "integrity": "sha512-d391q1bZoh3p68cD14m0uVXsPyZj2Nfcpz6fCpOMtaZcmy+f/8hrnv1VyJFsBB/bvWrzYUWbewSdTh4viGp4nw==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@curveball/validator/-/validator-1.0.0.tgz", + "integrity": "sha512-uKbSUL+ZIB9Uu3Vzq3OdrZXLBhYAPTtg35CNKKSLFB6C01mbHKG1eiAeU16y8LEwVcEToTgYNACeU3nAbC+l4A==", "dev": true, "dependencies": { - "@curveball/controller": "^0.4.0", - "@curveball/http-errors": "^0.4.0", - "@curveball/links": "^0.2.0", + "@curveball/controller": "^1.0.0", + "@curveball/http-errors": "^0.5.0", + "@curveball/links": "^1.0.0", "@stoplight/better-ajv-errors": "^1.0.1", "ajv": "^8.4.0", "ajv-formats": "^2.1.0" }, "engines": { - "node": ">= 14" + "node": ">= 18" }, "peerDependencies": { - "@curveball/kernel": ">=0.20.0 <1" + "@curveball/kernel": "^1" } }, - "node_modules/@curveball/validator/node_modules/@curveball/http-errors": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@curveball/http-errors/-/http-errors-0.4.1.tgz", - "integrity": "sha512-RJe0IOQQpgvCwUY8ZKK7/YgfWi1MqMzMrIHilwXHaMFykoVjpRNzaeO3FmrKSUlmJSb6vuPd37LEPNUne4PxZA==", - "dev": true - }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -722,12 +716,34 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@eslint/js": { "version": "8.56.0", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", @@ -751,6 +767,28 @@ "node": ">=10.10.0" } }, + "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -1051,9 +1089,12 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.18.70", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.70.tgz", - "integrity": "sha512-8eIk20G5VVVQNZNouHjLA2b8utE2NvGybLjMaF4lyhA9uhGwnmXF8o+icdXKGSQSNANJewXva/sFUoZLwAaYAg==" + "version": "18.19.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.7.tgz", + "integrity": "sha512-IGRJfoNX10N/PfrReRZ1br/7SQ+2vF/tK3KXNwzXz82D32z5dMQEoOlFew18nLSN+vMNcLY4GrKfzwi/yWI8/w==", + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/@types/node-fetch": { "version": "2.6.10", @@ -1259,30 +1300,6 @@ } } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/@typescript-eslint/utils": { "version": "6.18.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.18.1.tgz", @@ -1516,12 +1533,12 @@ } }, "node_modules/assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", "dev": true, "engines": { - "node": "*" + "node": ">=12" } }, "node_modules/asynckit": { @@ -1555,13 +1572,12 @@ } }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^1.0.0" } }, "node_modules/braces": { @@ -1676,21 +1692,19 @@ ] }, "node_modules/chai": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", - "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.0.0.tgz", + "integrity": "sha512-HO5p0oEKd5M6HEcwOkNAThAE3j960vIZvVcc0t2tI06Dd0ATu69cEnMB2wOhC5/ZyQ6m67w3ePjU/HzXsSsdBA==", "dev": true, "dependencies": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.3", - "deep-eql": "^4.1.3", - "get-func-name": "^2.0.2", - "loupe": "^2.3.6", - "pathval": "^1.1.1", - "type-detect": "^4.0.8" + "assertion-error": "^2.0.1", + "check-error": "^2.0.0", + "deep-eql": "^5.0.1", + "loupe": "^3.0.0", + "pathval": "^2.0.0" }, "engines": { - "node": ">=4" + "node": ">=12" } }, "node_modules/chalk": { @@ -1710,15 +1724,12 @@ } }, "node_modules/check-error": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", - "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.0.0.tgz", + "integrity": "sha512-tjLAOBHKVxtPoHe/SA7kNOMvhCRdCJ3vETdeY0RuAc9popf+hyaSV6ZEg9hr4cpWF7jmo/JSWEnLDrnijS9Tog==", "dev": true, - "dependencies": { - "get-func-name": "^2.0.2" - }, "engines": { - "node": "*" + "node": ">= 16" } }, "node_modules/chokidar": { @@ -1930,13 +1941,10 @@ "dev": true }, "node_modules/deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.1.tgz", + "integrity": "sha512-nwQCf6ne2gez3o1MxWifqkciwt0zhl0LO1/UwVu4uMBuPmflWM4oQ70XMqHqnBJA+nhzncaqL9HVL6KkHJ28lw==", "dev": true, - "dependencies": { - "type-detect": "^4.0.0" - }, "engines": { "node": ">=6" } @@ -2117,6 +2125,22 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/eslint-visitor-keys": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", @@ -2145,29 +2169,14 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/eslint/node_modules/eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, "node_modules/eslint/node_modules/json-schema-traverse": { @@ -2176,6 +2185,18 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/espree": { "version": "9.6.1", "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", @@ -2218,15 +2239,6 @@ "node": ">=0.10" } }, - "node_modules/esquery/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, "node_modules/esrecurse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", @@ -2239,7 +2251,7 @@ "node": ">=4.0" } }, - "node_modules/esrecurse/node_modules/estraverse": { + "node_modules/estraverse": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", @@ -2538,6 +2550,28 @@ "node": ">=10.13.0" } }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/globals": { "version": "13.24.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", @@ -3240,9 +3274,9 @@ } }, "node_modules/loupe": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", - "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.0.tgz", + "integrity": "sha512-qKl+FrLXUhFuHUoDJG7f8P8gEMHq9NFS0c6ghXG1J0rldmZFQZoNVv/vyirE9qwCIhWZDsvEFd1sbFu3GvRQFg==", "dev": true, "dependencies": { "get-func-name": "^2.0.1" @@ -3356,15 +3390,18 @@ } }, "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", "dev": true, "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^2.0.1" }, "engines": { - "node": "*" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/mocha": { @@ -3407,15 +3444,6 @@ "url": "https://opencollective.com/mochajs" } }, - "node_modules/mocha/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/mocha/node_modules/minimatch": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", @@ -3867,12 +3895,12 @@ } }, "node_modules/pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", + "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", "dev": true, "engines": { - "node": "*" + "node": ">= 14.16" } }, "node_modules/pct-encode": { @@ -4467,6 +4495,28 @@ "node": ">=8" } }, + "node_modules/test-exclude/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/test-exclude/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -4605,15 +4655,6 @@ "node": ">= 0.8.0" } }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/type-fest": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", @@ -4653,6 +4694,11 @@ "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.0.0.tgz", "integrity": "sha512-DffL94LsNOccVn4hyfRe5rdKa273swqeA5DJpMOeFmEn1wCDc7nAbbB0gXlgBCL7TNzeTv6G7XVWzan7iJtfig==" }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, "node_modules/universalify": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", diff --git a/package.json b/package.json index f40c8b2..1a89226 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,7 @@ "version": "0.20.5", "description": "Automatic API browser generator. A middleware that turns your JSON responses into HTML if accessed by a browser.", "type": "module", - "exports": { - "require": "./cjs/index.js", - "import": "./esm/index.js" - }, - "main": "cjs/index.js", + "exports": "./dist/index.js", "homepage": "https://github.com/curveball/browser#readme", "bugs": { "url": "https://github.com/curveball/browser" @@ -30,14 +26,15 @@ "lint": "make lint", "fix": "make fix", "tsc": "tsc", - "start": "make start" + "start": "make start", + "build": "make build" }, "repository": { "type": "git", "url": "git+https://github.com/curveball/browser" }, "dependencies": { - "@curveball/static": "^0.4.0", + "@curveball/static": "^1", "csv-parse": "^5.1.0", "highlight.js": "^11.2.0", "ketting": "^7.5.1", @@ -47,21 +44,21 @@ "react-dom": "^18.1.0" }, "peerDependencies": { - "@curveball/kernel": ">=0.21.0 <1" + "@curveball/kernel": "^1" }, "devDependencies": { - "@curveball/kernel": "^0.21.0", - "@curveball/validator": "^0.10.0", + "@curveball/kernel": "^1.0.0", + "@curveball/validator": "^1", "@types/chai": "^4.3.11", "@types/markdown-it": "^13.0.7", "@types/mocha": "^10.0.1", - "@types/node": "^16.18.12", + "@types/node": "^18.19.7", "@types/node-fetch": "^2.6.1", "@types/react": "^18.0.12", "@types/react-dom": "^18.0.5", "@typescript-eslint/eslint-plugin": "^6.18.1", "@typescript-eslint/parser": "^6.18.1", - "chai": "^4.4.1", + "chai": "^5.0.0", "eslint": "^8.23.0", "html-form-enhancer": "^0.1.9", "jsdom": "^23.2.0", @@ -71,13 +68,12 @@ "typescript": "^5.3.3" }, "engines": { - "node": ">= 16" + "node": ">= 18" }, "files": [ "package.json", "README.md", - "esm", - "cjs", + "dist", "LICENSE", "src", "assets" diff --git a/src/components/forms.tsx b/src/components/forms.tsx index d217c34..70309c8 100644 --- a/src/components/forms.tsx +++ b/src/components/forms.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { PageProps } from '../types'; +import { PageProps } from '../types.js'; import { TemplatedLinks } from './forms/templated-links.js'; import { ActionForm } from './forms/ketting-action.js'; import { ButtonForm } from './forms/ketting-action-button.js'; diff --git a/src/components/hal-body.tsx b/src/components/hal-body.tsx index e06ae86..a2b0650 100644 --- a/src/components/hal-body.tsx +++ b/src/components/hal-body.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { PageProps, JsonSchema } from '../types.js'; -import JsonViewer from './json-viewer'; +import JsonViewer from './json-viewer.js'; export function HalBody(props: PageProps) { diff --git a/src/components/links-table.tsx b/src/components/links-table.tsx index 80e3797..76495dd 100644 --- a/src/components/links-table.tsx +++ b/src/components/links-table.tsx @@ -3,12 +3,12 @@ import { Link } from 'ketting'; import { PageProps } from '../types.js'; // List of links from the IANA website, auto generated -import * as ianaLinks from '../data/iana-links.json' with { type: 'json' }; +import ianaLinks from '../data/iana-links.json'; // List of links from this project, overrides some IANA links with better // descriptions -import * as editorLinks from '../data/editor-links.json' with { type: 'json' }; +import editorLinks from '../data/editor-links.json'; //List of links from the Level 3 REST (https://level3.rest) specification. -import * as level3RestLinks from '../data/level3-rest-links.json' with { type: 'json' }; +import level3RestLinks from '../data/level3-rest-links.json'; type LinkDescriptions = Record; diff --git a/src/components/markdown-body.tsx b/src/components/markdown-body.tsx index 91ba1d3..421be09 100644 --- a/src/components/markdown-body.tsx +++ b/src/components/markdown-body.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import hljs from 'highlight.js'; -import * as md from 'markdown-it'; +import md from 'markdown-it'; import { PageProps } from '../types.js'; export function MarkdownBody(props: PageProps) { diff --git a/src/html-index.tsx b/src/html-index.tsx index a96f2a2..a0ba4ec 100644 --- a/src/html-index.tsx +++ b/src/html-index.tsx @@ -1,5 +1,5 @@ import { Context } from '@curveball/kernel'; -import { Options, JsonSchema } from './types'; +import { Options, JsonSchema } from './types.js'; import * as ReactDOMServer from 'react-dom/server'; import * as React from 'react'; diff --git a/src/index.ts b/src/index.ts index bba16fe..920dfc4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -105,7 +105,7 @@ const defaultNavigationLinks: NavigationLinkMap = { 'search': true, }; -export { Options } from './types'; +export { Options } from './types.js'; export default function browser(options?: Partial): Middleware { diff --git a/test/tsconfig.json b/test/tsconfig.json deleted file mode 100644 index 0580f76..0000000 --- a/test/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "module": "esnext", - "target": "es2020", - - "strict": true, - "noFallthroughCasesInSwitch": true, - "experimentalDecorators": true, - "noUnusedLocals": true, - - "moduleResolution": "node", - "sourceMap": true, - "outDir": "esm", - "baseUrl": ".", - "paths": { - "*": [ - "src/types/*" - ] - }, - "lib": [ - "DOM", - "ES2020" - ], - "declaration": true - }, - "include": [ - "**/*.ts" - ] -} diff --git a/tsconfig.json b/tsconfig.json index 408807c..72f8a6f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,14 @@ { "compilerOptions": { - "module": "esnext", - "target": "es2020", + "module": "node16", + "target": "es2022", "strict": true, "noFallthroughCasesInSwitch": true, - "experimentalDecorators": true, "noUnusedLocals": true, - "moduleResolution": "node", "sourceMap": true, - "outDir": "esm", + "outDir": "dist", "baseUrl": ".", "paths": { "*": [ @@ -19,7 +17,7 @@ }, "lib": [ "DOM", - "ES2020" + "ES2022" ], "declaration": true, "jsx": "react",