From b5852cab869849dc15375c2d9101976b30d72a63 Mon Sep 17 00:00:00 2001 From: Evert Pot Date: Mon, 15 Jan 2024 00:29:06 -0500 Subject: [PATCH 1/6] Set curveball packages to v1 --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index f40c8b2..20c39c8 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "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,11 +47,11 @@ "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", + "@curveball/validator": "^1", "@types/chai": "^4.3.11", "@types/markdown-it": "^13.0.7", "@types/mocha": "^10.0.1", From f20abe0f67ae4a407b5b119a95c9405c45ce0db1 Mon Sep 17 00:00:00 2001 From: Evert Pot Date: Mon, 15 Jan 2024 00:36:16 -0500 Subject: [PATCH 2/6] Dropping CommonJS and releasing 1.0 --- .github/workflows/bun.yml | 2 +- .github/workflows/node.yml | 25 +- .github/workflows/npm-publish.yml | 8 +- .gitignore | 3 +- Makefile | 43 +-- changelog.md | 11 + package-lock.json | 488 ++++++++++++++++++++---------- package.json | 25 +- test/tsconfig.json | 29 -- tsconfig.json | 14 +- 10 files changed, 371 insertions(+), 277 deletions(-) delete mode 100644 test/tsconfig.json 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..19daaf3 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 .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,34 +30,8 @@ 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 - - - -.PHONY:assets -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 - + rm -rf dist -src/data/iana-links.json: - node util/fetch-link-relation-data.mjs > src/data/iana-links.json +dist/build: $(SOURCE_FILES) + npx tsc + touch dist/build 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..716246f 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,31 +19,33 @@ "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", + "@types/sinon": "^17.0.3", "@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", "mocha": "^10.2.0", "nyc": "^15.1.0", + "sinon": "^17.0.1", "ts-node": "^10.9.1", "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 +567,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 +590,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 +601,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 +718,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 +769,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", @@ -961,6 +1001,50 @@ "node": ">= 8" } }, + "node_modules/@sinonjs/commons": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", + "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "11.2.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-11.2.2.tgz", + "integrity": "sha512-G2piCSxQ7oWOxwGSAyFHfPIsyeJGXYtc6mFbnFA+kRXkiEnTl8c/8jul2S329iFBnDI9HGoeWWAZvuvOkZccgw==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, + "node_modules/@sinonjs/samsam": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-8.0.0.tgz", + "integrity": "sha512-Bp8KUVlLp8ibJZrnvq2foVhP0IVX2CIprMJPK0vqGqgrDa0OHVKeZyBykqskkrdxV6yKBPmGasO8LVjAKR3Gew==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^2.0.0", + "lodash.get": "^4.4.2", + "type-detect": "^4.0.8" + } + }, + "node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", + "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/text-encoding": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.2.tgz", + "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==", + "dev": true + }, "node_modules/@stoplight/better-ajv-errors": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@stoplight/better-ajv-errors/-/better-ajv-errors-1.0.3.tgz", @@ -1051,9 +1135,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", @@ -1103,6 +1190,21 @@ "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", "dev": true }, + "node_modules/@types/sinon": { + "version": "17.0.3", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-17.0.3.tgz", + "integrity": "sha512-j3uovdn8ewky9kRBG19bOwaZbexJu/XjtkHyjvUgt4xfPFz18dcORIMqnYh66Fx3Powhcr85NT5+er3+oViapw==", + "dev": true, + "dependencies": { + "@types/sinonjs__fake-timers": "*" + } + }, + "node_modules/@types/sinonjs__fake-timers": { + "version": "8.1.5", + "resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.5.tgz", + "integrity": "sha512-mQkU2jY8jJEF7YHjHvsQO8+3ughTL1mcnn96igfhONmR+fUPSKIkefQYpSe8bsly2Ep7oQbn/6VG5/9/0qcArQ==", + "dev": true + }, "node_modules/@types/ws": { "version": "8.5.10", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz", @@ -1259,30 +1361,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 +1594,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 +1633,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 +1753,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 +1785,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 +2002,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 +2186,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 +2230,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 +2246,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 +2300,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 +2312,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 +2611,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", @@ -3129,6 +3224,12 @@ "node": ">=0.10.0" } }, + "node_modules/just-extend": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz", + "integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==", + "dev": true + }, "node_modules/ketting": { "version": "7.5.1", "resolved": "https://registry.npmjs.org/ketting/-/ketting-7.5.1.tgz", @@ -3206,6 +3307,12 @@ "integrity": "sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ==", "dev": true }, + "node_modules/lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", + "dev": true + }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -3240,9 +3347,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 +3463,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 +3517,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", @@ -3481,6 +3582,19 @@ "node": ">= 0.6" } }, + "node_modules/nise": { + "version": "5.1.7", + "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.7.tgz", + "integrity": "sha512-wWtNUhkT7k58uvWTB/Gy26eA/EJKtPZFVAhEilN5UYVmmGRYOURbejRUyKm0Uu9XVEW7K5nBOZfR8VMB4QR2RQ==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^3.0.0", + "@sinonjs/fake-timers": "^11.2.2", + "@sinonjs/text-encoding": "^0.7.2", + "just-extend": "^6.2.0", + "path-to-regexp": "^6.2.1" + } + }, "node_modules/node-fetch": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", @@ -3857,6 +3971,12 @@ "node": ">=8" } }, + "node_modules/path-to-regexp": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", + "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==", + "dev": true + }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -3867,12 +3987,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": { @@ -4330,6 +4450,33 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "node_modules/sinon": { + "version": "17.0.1", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-17.0.1.tgz", + "integrity": "sha512-wmwE19Lie0MLT+ZYNpDymasPHUKTaZHUH/pKEubRXIzySv9Atnlw+BUMGCzWgV7b7wO+Hw6f1TEOr0IUnmU8/g==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^3.0.0", + "@sinonjs/fake-timers": "^11.2.2", + "@sinonjs/samsam": "^8.0.0", + "diff": "^5.1.0", + "nise": "^5.1.5", + "supports-color": "^7.2.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/sinon" + } + }, + "node_modules/sinon/node_modules/diff": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz", + "integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -4467,6 +4614,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", @@ -4653,6 +4822,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 20c39c8..3a85dae 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,7 +26,8 @@ "lint": "make lint", "fix": "make fix", "tsc": "tsc", - "start": "make start" + "start": "make start", + "build": "make build" }, "repository": { "type": "git", @@ -50,37 +47,37 @@ "@curveball/kernel": "^1" }, "devDependencies": { - "@curveball/kernel": "^1", + "@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", + "@types/sinon": "^17.0.3", "@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", "mocha": "^10.2.0", "nyc": "^15.1.0", + "sinon": "^17.0.1", "ts-node": "^10.9.1", "typescript": "^5.3.3" }, "engines": { - "node": ">= 16" + "node": ">= 18" }, "files": [ "package.json", "README.md", - "esm", - "cjs", + "dist", "LICENSE", - "src", - "assets" + "src" ], "mocha": { "loader": [ 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..a00d825 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,11 +17,9 @@ }, "lib": [ "DOM", - "ES2020" + "ES2022" ], - "declaration": true, - "jsx": "react", - "resolveJsonModule": true + "declaration": true }, "include": [ "src/**/*" From b5047ff9942857238e27093069e41550817402be Mon Sep 17 00:00:00 2001 From: Evert Pot Date: Mon, 15 Jan 2024 00:44:56 -0500 Subject: [PATCH 3/6] Fix ESM imports --- src/components/forms.tsx | 2 +- src/components/hal-body.tsx | 2 +- src/components/links-table.tsx | 6 +++--- src/components/markdown-body.tsx | 2 +- src/html-index.tsx | 2 +- src/index.ts | 2 +- tsconfig.json | 4 +++- 7 files changed, 11 insertions(+), 9 deletions(-) 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/tsconfig.json b/tsconfig.json index a00d825..72f8a6f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,7 +19,9 @@ "DOM", "ES2022" ], - "declaration": true + "declaration": true, + "jsx": "react", + "resolveJsonModule": true }, "include": [ "src/**/*" From aa2a8fb190416aba78d6ae9d743c142c5f769ad8 Mon Sep 17 00:00:00 2001 From: Evert Pot Date: Mon, 15 Jan 2024 00:49:25 -0500 Subject: [PATCH 4/6] Restore some removed makefile targets unique to the browser package --- Makefile | 18 +++++++++++++++++- package.json | 3 ++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 19daaf3..d798a6d 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ SOURCE_FILES:=$(shell find src/ -type f -name '*.ts') all: build .PHONY:build -build: dist/build +build: dist/build assets .PHONY:test test: @@ -32,6 +32,22 @@ start: build clean: 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 + +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/package.json b/package.json index 3a85dae..c21d618 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,8 @@ "README.md", "dist", "LICENSE", - "src" + "src", + "assets" ], "mocha": { "loader": [ From 9d3e7d1468e42888d43ce3699dc84fd6d5989800 Mon Sep 17 00:00:00 2001 From: Evert Pot Date: Mon, 15 Jan 2024 00:50:34 -0500 Subject: [PATCH 5/6] Remove sinon --- package-lock.json | 128 ---------------------------------------------- package.json | 2 - 2 files changed, 130 deletions(-) diff --git a/package-lock.json b/package-lock.json index 716246f..95f1209 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,6 @@ "@types/node-fetch": "^2.6.1", "@types/react": "^18.0.12", "@types/react-dom": "^18.0.5", - "@types/sinon": "^17.0.3", "@typescript-eslint/eslint-plugin": "^6.18.1", "@typescript-eslint/parser": "^6.18.1", "chai": "^5.0.0", @@ -37,7 +36,6 @@ "jsdom": "^23.2.0", "mocha": "^10.2.0", "nyc": "^15.1.0", - "sinon": "^17.0.1", "ts-node": "^10.9.1", "typescript": "^5.3.3" }, @@ -1001,50 +999,6 @@ "node": ">= 8" } }, - "node_modules/@sinonjs/commons": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", - "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", - "dev": true, - "dependencies": { - "type-detect": "4.0.8" - } - }, - "node_modules/@sinonjs/fake-timers": { - "version": "11.2.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-11.2.2.tgz", - "integrity": "sha512-G2piCSxQ7oWOxwGSAyFHfPIsyeJGXYtc6mFbnFA+kRXkiEnTl8c/8jul2S329iFBnDI9HGoeWWAZvuvOkZccgw==", - "dev": true, - "dependencies": { - "@sinonjs/commons": "^3.0.0" - } - }, - "node_modules/@sinonjs/samsam": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-8.0.0.tgz", - "integrity": "sha512-Bp8KUVlLp8ibJZrnvq2foVhP0IVX2CIprMJPK0vqGqgrDa0OHVKeZyBykqskkrdxV6yKBPmGasO8LVjAKR3Gew==", - "dev": true, - "dependencies": { - "@sinonjs/commons": "^2.0.0", - "lodash.get": "^4.4.2", - "type-detect": "^4.0.8" - } - }, - "node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", - "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", - "dev": true, - "dependencies": { - "type-detect": "4.0.8" - } - }, - "node_modules/@sinonjs/text-encoding": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.2.tgz", - "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==", - "dev": true - }, "node_modules/@stoplight/better-ajv-errors": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@stoplight/better-ajv-errors/-/better-ajv-errors-1.0.3.tgz", @@ -1190,21 +1144,6 @@ "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", "dev": true }, - "node_modules/@types/sinon": { - "version": "17.0.3", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-17.0.3.tgz", - "integrity": "sha512-j3uovdn8ewky9kRBG19bOwaZbexJu/XjtkHyjvUgt4xfPFz18dcORIMqnYh66Fx3Powhcr85NT5+er3+oViapw==", - "dev": true, - "dependencies": { - "@types/sinonjs__fake-timers": "*" - } - }, - "node_modules/@types/sinonjs__fake-timers": { - "version": "8.1.5", - "resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.5.tgz", - "integrity": "sha512-mQkU2jY8jJEF7YHjHvsQO8+3ughTL1mcnn96igfhONmR+fUPSKIkefQYpSe8bsly2Ep7oQbn/6VG5/9/0qcArQ==", - "dev": true - }, "node_modules/@types/ws": { "version": "8.5.10", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz", @@ -3224,12 +3163,6 @@ "node": ">=0.10.0" } }, - "node_modules/just-extend": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz", - "integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==", - "dev": true - }, "node_modules/ketting": { "version": "7.5.1", "resolved": "https://registry.npmjs.org/ketting/-/ketting-7.5.1.tgz", @@ -3307,12 +3240,6 @@ "integrity": "sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ==", "dev": true }, - "node_modules/lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", - "dev": true - }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -3582,19 +3509,6 @@ "node": ">= 0.6" } }, - "node_modules/nise": { - "version": "5.1.7", - "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.7.tgz", - "integrity": "sha512-wWtNUhkT7k58uvWTB/Gy26eA/EJKtPZFVAhEilN5UYVmmGRYOURbejRUyKm0Uu9XVEW7K5nBOZfR8VMB4QR2RQ==", - "dev": true, - "dependencies": { - "@sinonjs/commons": "^3.0.0", - "@sinonjs/fake-timers": "^11.2.2", - "@sinonjs/text-encoding": "^0.7.2", - "just-extend": "^6.2.0", - "path-to-regexp": "^6.2.1" - } - }, "node_modules/node-fetch": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", @@ -3971,12 +3885,6 @@ "node": ">=8" } }, - "node_modules/path-to-regexp": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", - "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==", - "dev": true - }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -4450,33 +4358,6 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, - "node_modules/sinon": { - "version": "17.0.1", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-17.0.1.tgz", - "integrity": "sha512-wmwE19Lie0MLT+ZYNpDymasPHUKTaZHUH/pKEubRXIzySv9Atnlw+BUMGCzWgV7b7wO+Hw6f1TEOr0IUnmU8/g==", - "dev": true, - "dependencies": { - "@sinonjs/commons": "^3.0.0", - "@sinonjs/fake-timers": "^11.2.2", - "@sinonjs/samsam": "^8.0.0", - "diff": "^5.1.0", - "nise": "^5.1.5", - "supports-color": "^7.2.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/sinon" - } - }, - "node_modules/sinon/node_modules/diff": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz", - "integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -4774,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", diff --git a/package.json b/package.json index c21d618..1a89226 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,6 @@ "@types/node-fetch": "^2.6.1", "@types/react": "^18.0.12", "@types/react-dom": "^18.0.5", - "@types/sinon": "^17.0.3", "@typescript-eslint/eslint-plugin": "^6.18.1", "@typescript-eslint/parser": "^6.18.1", "chai": "^5.0.0", @@ -65,7 +64,6 @@ "jsdom": "^23.2.0", "mocha": "^10.2.0", "nyc": "^15.1.0", - "sinon": "^17.0.1", "ts-node": "^10.9.1", "typescript": "^5.3.3" }, From ada0435dd65ebebc548d1b0c3043f41ac1153628 Mon Sep 17 00:00:00 2001 From: Evert Pot Date: Mon, 15 Jan 2024 00:51:59 -0500 Subject: [PATCH 6/6] remove bad line --- Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile b/Makefile index d798a6d..9be815c 100644 --- a/Makefile +++ b/Makefile @@ -43,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