Move to the new file-pointer syntax
Summary: Harmonize file pointer behavior across JDD, sealious, sealgen Remove ghosts of previous tests Reviewers: #reviewers Subscribers: jenkins-user Differential Revision: https://hub.sealcode.org/D1446
This commit is contained in:
parent
45c852e25d
commit
85fb1d29c7
181
package-lock.json
generated
181
package-lock.json
generated
@ -14,11 +14,13 @@
|
|||||||
"@hotwired/turbo": "^8.0.2",
|
"@hotwired/turbo": "^8.0.2",
|
||||||
"@koa/router": "^12.0.1",
|
"@koa/router": "^12.0.1",
|
||||||
"@playwright/test": "^1.36.1",
|
"@playwright/test": "^1.36.1",
|
||||||
"@sealcode/jdd": "^0.3.5",
|
"@sealcode/file-manager": "^1.0.2",
|
||||||
"@sealcode/sealgen": "^0.14.16",
|
"@sealcode/jdd": "^0.4.5",
|
||||||
|
"@sealcode/sealgen": "^0.15.6",
|
||||||
"@sealcode/ts-predicates": "^0.6.2",
|
"@sealcode/ts-predicates": "^0.6.2",
|
||||||
"@types/kill-port": "^2.0.0",
|
"@types/kill-port": "^2.0.0",
|
||||||
"@types/leaflet": "^1.9.8",
|
"@types/leaflet": "^1.9.8",
|
||||||
|
"escape-goat": "^4.0.0",
|
||||||
"get-port": "^7.0.0",
|
"get-port": "^7.0.0",
|
||||||
"js-convert-case": "^4.2.0",
|
"js-convert-case": "^4.2.0",
|
||||||
"koa-responsive-image-router": "^0.2.24",
|
"koa-responsive-image-router": "^0.2.24",
|
||||||
@ -27,7 +29,7 @@
|
|||||||
"nodemon": "^3.0.1",
|
"nodemon": "^3.0.1",
|
||||||
"object-path": "^0.11.8",
|
"object-path": "^0.11.8",
|
||||||
"qs": "^6.12.0",
|
"qs": "^6.12.0",
|
||||||
"sealious": "^0.18.3",
|
"sealious": "^0.19.6",
|
||||||
"stimulus": "^2.0.0",
|
"stimulus": "^2.0.0",
|
||||||
"tempstream": "^0.3.15",
|
"tempstream": "^0.3.15",
|
||||||
"vitest": "^1.1.0"
|
"vitest": "^1.1.0"
|
||||||
@ -304,9 +306,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/runtime": {
|
"node_modules/@babel/runtime": {
|
||||||
"version": "7.24.1",
|
"version": "7.24.4",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.1.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.4.tgz",
|
||||||
"integrity": "sha512-+BIznRzyqBf+2wCTxcKE3wDjfGeCoVE61KSHGpkzqrLi8qxqFwBeUFyId2cxkTmm55fzDGnm0+yCxaxygrLUnQ==",
|
"integrity": "sha512-dkxf7+hn8mFBwKjs9bvBlArzLVxVbS8usaPUDd5p2a9JCL9tB8OaOVN1isD4+Xyk4ns89/xeOmbQvgdK7IIVdA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"regenerator-runtime": "^0.14.0"
|
"regenerator-runtime": "^0.14.0"
|
||||||
},
|
},
|
||||||
@ -858,16 +860,30 @@
|
|||||||
"ansi-html-stream": "index.js"
|
"ansi-html-stream": "index.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@sealcode/jdd": {
|
"node_modules/@sealcode/file-manager": {
|
||||||
"version": "0.3.5",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@sealcode/jdd/-/jdd-0.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/@sealcode/file-manager/-/file-manager-1.0.2.tgz",
|
||||||
"integrity": "sha512-VE8FRfmLuSgXIxIWeNvJjND64531EiHXjquHgIBIlbPOUCjp3Vx+nUrEZgyFyI//QN5ieNJVZhwOIV7gnfGNxg==",
|
"integrity": "sha512-BOMgC90QffE9cVFKkLVTjDbUJ5WB9YqcmS4fwqFxgnnC3YlH9xb9rff3iGXSkKOHm0kCeSjq0Ohasxtq/z72WQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sealcode/ts-predicates": "^0.5.3",
|
"@types/mime-types": "^2.1.4",
|
||||||
"koa-responsive-image-router": "^0.2.19",
|
"@types/uuid": "^9.0.8",
|
||||||
"locreq": "^2.4.1",
|
"locreq": "^3.0.0",
|
||||||
"marked": "^12.0.0",
|
|
||||||
"mime-types": "^2.1.35",
|
"mime-types": "^2.1.35",
|
||||||
|
"uuid": "^9.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@sealcode/jdd": {
|
||||||
|
"version": "0.4.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sealcode/jdd/-/jdd-0.4.5.tgz",
|
||||||
|
"integrity": "sha512-N4DWR/+WEosJwkaul4BGB6CuGRkNHAfbNF5hGTCwYZRIFStYCThMGg2odXt6zt8eWbf9Cwt9pPKIQ+ZQHgpJFA==",
|
||||||
|
"dependencies": {
|
||||||
|
"@sealcode/file-manager": "^1.0.2",
|
||||||
|
"@sealcode/ts-predicates": "^0.5.3",
|
||||||
|
"escape-goat": "^4.0.0",
|
||||||
|
"koa-responsive-image-router": "^0.2.19",
|
||||||
|
"locreq": "^3.0.0",
|
||||||
|
"marked": "^12.0.0",
|
||||||
|
"mri": "^1.2.0",
|
||||||
"tempstream": "^0.3.4",
|
"tempstream": "^0.3.4",
|
||||||
"uuid": "^9.0.1"
|
"uuid": "^9.0.1"
|
||||||
}
|
}
|
||||||
@ -877,29 +893,19 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@sealcode/ts-predicates/-/ts-predicates-0.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/@sealcode/ts-predicates/-/ts-predicates-0.5.3.tgz",
|
||||||
"integrity": "sha512-EZI7e8EY8gI1pw2bKdevjl+fBJbcSlpNkCZ8XoEOV3cHakPujiT6M4l775RDkfxJSbLX7jhOBkhgPNDfmCpZbg=="
|
"integrity": "sha512-EZI7e8EY8gI1pw2bKdevjl+fBJbcSlpNkCZ8XoEOV3cHakPujiT6M4l775RDkfxJSbLX7jhOBkhgPNDfmCpZbg=="
|
||||||
},
|
},
|
||||||
"node_modules/@sealcode/jdd/node_modules/@types/node": {
|
|
||||||
"version": "14.18.63",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.63.tgz",
|
|
||||||
"integrity": "sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ=="
|
|
||||||
},
|
|
||||||
"node_modules/@sealcode/jdd/node_modules/locreq": {
|
|
||||||
"version": "2.4.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/locreq/-/locreq-2.4.1.tgz",
|
|
||||||
"integrity": "sha512-Itfhlus87Q9GcQKEK5LXZngD5YpUbANC9mr5UFghLSBIg6gVVG21AWX45+JVyaqBxILQkB+dBW0i2KlSVzGfeQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"@types/node": "^14.14.16"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@sealcode/sealgen": {
|
"node_modules/@sealcode/sealgen": {
|
||||||
"version": "0.14.16",
|
"version": "0.15.6",
|
||||||
"resolved": "https://registry.npmjs.org/@sealcode/sealgen/-/sealgen-0.14.16.tgz",
|
"resolved": "https://registry.npmjs.org/@sealcode/sealgen/-/sealgen-0.15.6.tgz",
|
||||||
"integrity": "sha512-kWrykFO+LX6qFubetiSXk1fdPtXSFiYpUdX5PT2L/dlfVFX+F+YcPihIwsVucIC/MaYUDR4p5QiHQnt/WXWSFQ==",
|
"integrity": "sha512-XVmgGwSjzxQXEscvvHiAT6CTcuIV9c4Klb0pDYqNRtXlvZsoJHbhTsp+1Uua9vQh0NRe6Y+V2airw8eLr+ZZpg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@koa/router": "^12.0.1",
|
"@koa/router": "^12.0.1",
|
||||||
|
"@sealcode/file-manager": "^1.0.2",
|
||||||
"@sealcode/ts-predicates": "^0.4.3",
|
"@sealcode/ts-predicates": "^0.4.3",
|
||||||
"deepmerge": "^4.3.1",
|
"deepmerge": "^4.3.1",
|
||||||
"esbuild": "^0.20.0",
|
"esbuild": "^0.20.0",
|
||||||
|
"escape-goat": "^4.0.0",
|
||||||
"google-fonts-helper": "^3.4.1",
|
"google-fonts-helper": "^3.4.1",
|
||||||
|
"is-what": "^4.1.16",
|
||||||
"js-convert-case": "^4.2.0",
|
"js-convert-case": "^4.2.0",
|
||||||
"locreq": "^3.0.0",
|
"locreq": "^3.0.0",
|
||||||
"md5": "^2.3.0",
|
"md5": "^2.3.0",
|
||||||
@ -913,12 +919,12 @@
|
|||||||
"yargs": "^17.6.2"
|
"yargs": "^17.6.2"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"sealgen": "dist/cli.js"
|
"sealgen": "lib/cli.js"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"koa": "^2.13.0",
|
"koa": "^2.13.0",
|
||||||
"koa-responsive-image-router": "^0.2.24",
|
"koa-responsive-image-router": "^0.2.24",
|
||||||
"sealious": "^0.18.1"
|
"sealious": "^0.19.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@sealcode/sealgen/node_modules/@sealcode/ts-predicates": {
|
"node_modules/@sealcode/sealgen/node_modules/@sealcode/ts-predicates": {
|
||||||
@ -1100,9 +1106,9 @@
|
|||||||
"integrity": "sha512-miV7Z8zvOnRn0ZjbP/D/qb1VWHrWkKOnfC764SJvnCeIziW4pZy3tPK/542seSgccGAXlPQd/seuNyVAS/p5Ug=="
|
"integrity": "sha512-miV7Z8zvOnRn0ZjbP/D/qb1VWHrWkKOnfC764SJvnCeIziW4pZy3tPK/542seSgccGAXlPQd/seuNyVAS/p5Ug=="
|
||||||
},
|
},
|
||||||
"node_modules/@types/color-name": {
|
"node_modules/@types/color-name": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.4.tgz",
|
||||||
"integrity": "sha512-87W6MJCKZYDhLAx/J1ikW8niMvmGRyY+rpUxWpL1cO7F8Uu5CHuQoFv+R0/L5pgNdW4jTyda42kv60uwVIPjLw=="
|
"integrity": "sha512-hulKeREDdLFesGQjl96+4aoJSHY5b2GRjagzzcqCfIrWhe5vkCqIvrLbqzBaI1q94Vg8DNJZZqTR5ocdWmWclg=="
|
||||||
},
|
},
|
||||||
"node_modules/@types/connect": {
|
"node_modules/@types/connect": {
|
||||||
"version": "3.4.38",
|
"version": "3.4.38",
|
||||||
@ -1314,6 +1320,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz",
|
||||||
"integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w=="
|
"integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w=="
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/mime-types": {
|
||||||
|
"version": "2.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/mime-types/-/mime-types-2.1.4.tgz",
|
||||||
|
"integrity": "sha512-lfU4b34HOri+kAY5UheuFMWPDOI+OPceBSHZKp69gEyTL/mmJ4cnU6Y/rlme3UL3GyOn6Y42hyIEw0/q8sWx5w=="
|
||||||
|
},
|
||||||
"node_modules/@types/mjml": {
|
"node_modules/@types/mjml": {
|
||||||
"version": "4.7.4",
|
"version": "4.7.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/mjml/-/mjml-4.7.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/mjml/-/mjml-4.7.4.tgz",
|
||||||
@ -1428,8 +1439,7 @@
|
|||||||
"node_modules/@types/uuid": {
|
"node_modules/@types/uuid": {
|
||||||
"version": "9.0.8",
|
"version": "9.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz",
|
||||||
"integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==",
|
"integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@types/webidl-conversions": {
|
"node_modules/@types/webidl-conversions": {
|
||||||
"version": "7.0.3",
|
"version": "7.0.3",
|
||||||
@ -2531,9 +2541,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/bson": {
|
"node_modules/bson": {
|
||||||
"version": "6.5.0",
|
"version": "6.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/bson/-/bson-6.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/bson/-/bson-6.6.0.tgz",
|
||||||
"integrity": "sha512-DXf1BTAS8vKyR90BO4x5v3rKVarmkdkzwOrnYDFdjAY694ILNDkmA3uRh1xXJEl+C1DAh8XCvAQ+Gh3kzubtpg==",
|
"integrity": "sha512-BVINv2SgcMjL4oYbBuCQTpE3/VKOSxrOA8Cj/wQP7izSzlBGVomdm+TcUd0Pzy0ytLSSDweCKQ6X3f5veM5LQA==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.20.1"
|
"node": ">=16.20.1"
|
||||||
}
|
}
|
||||||
@ -3627,9 +3637,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/es-abstract": {
|
"node_modules/es-abstract": {
|
||||||
"version": "1.23.2",
|
"version": "1.23.3",
|
||||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.2.tgz",
|
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz",
|
||||||
"integrity": "sha512-60s3Xv2T2p1ICykc7c+DNDPLDMm9t4QxCOUU0K9JxiLjM3C1zB9YVdN7tjxrFd4+AkZ8CdX1ovUga4P2+1e+/w==",
|
"integrity": "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"array-buffer-byte-length": "^1.0.1",
|
"array-buffer-byte-length": "^1.0.1",
|
||||||
"arraybuffer.prototype.slice": "^1.0.3",
|
"arraybuffer.prototype.slice": "^1.0.3",
|
||||||
@ -3670,11 +3680,11 @@
|
|||||||
"safe-regex-test": "^1.0.3",
|
"safe-regex-test": "^1.0.3",
|
||||||
"string.prototype.trim": "^1.2.9",
|
"string.prototype.trim": "^1.2.9",
|
||||||
"string.prototype.trimend": "^1.0.8",
|
"string.prototype.trimend": "^1.0.8",
|
||||||
"string.prototype.trimstart": "^1.0.7",
|
"string.prototype.trimstart": "^1.0.8",
|
||||||
"typed-array-buffer": "^1.0.2",
|
"typed-array-buffer": "^1.0.2",
|
||||||
"typed-array-byte-length": "^1.0.1",
|
"typed-array-byte-length": "^1.0.1",
|
||||||
"typed-array-byte-offset": "^1.0.2",
|
"typed-array-byte-offset": "^1.0.2",
|
||||||
"typed-array-length": "^1.0.5",
|
"typed-array-length": "^1.0.6",
|
||||||
"unbox-primitive": "^1.0.2",
|
"unbox-primitive": "^1.0.2",
|
||||||
"which-typed-array": "^1.1.15"
|
"which-typed-array": "^1.1.15"
|
||||||
},
|
},
|
||||||
@ -3803,11 +3813,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/escape-goat": {
|
"node_modules/escape-goat": {
|
||||||
"version": "3.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-4.0.0.tgz",
|
||||||
"integrity": "sha512-w3PwNZJwRxlp47QGzhuEBldEqVHHhh8/tIPcl6ecf2Bou99cdAt0knihBV0Ecc7CGxYduXVBDheH1K2oADRlvw==",
|
"integrity": "sha512-2Sd4ShcWxbx6OY1IHyla/CVNwvg7XwZVoXZHcSu9w9SReNP1EzzD5T8NWKIR38fIqEns9kDWKUQTXXAmlDrdPg==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
@ -5554,6 +5564,17 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/is-what": {
|
||||||
|
"version": "4.1.16",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-what/-/is-what-4.1.16.tgz",
|
||||||
|
"integrity": "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.13"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/mesqueeb"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/is-windows": {
|
"node_modules/is-windows": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
|
||||||
@ -5854,9 +5875,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/js-beautify/node_modules/minimatch": {
|
"node_modules/js-beautify/node_modules/minimatch": {
|
||||||
"version": "9.0.3",
|
"version": "9.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz",
|
||||||
"integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==",
|
"integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"brace-expansion": "^2.0.1"
|
"brace-expansion": "^2.0.1"
|
||||||
},
|
},
|
||||||
@ -6677,17 +6698,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mime": {
|
"node_modules/mime": {
|
||||||
"version": "4.0.1",
|
"version": "2.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/mime/-/mime-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz",
|
||||||
"integrity": "sha512-5lZ5tyrIfliMXzFtkYyekWbtRXObT9OWa8IwQ5uxTBDHucNNwniRqo0yInflj+iYi5CBa6qxadGzGarDfuEOxA==",
|
"integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==",
|
||||||
"funding": [
|
|
||||||
"https://github.com/sponsors/broofa"
|
|
||||||
],
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"mime": "bin/cli.js"
|
"mime": "cli.js"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16"
|
"node": ">=4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mime-db": {
|
"node_modules/mime-db": {
|
||||||
@ -6881,9 +6899,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mjml-cli/node_modules/minimatch": {
|
"node_modules/mjml-cli/node_modules/minimatch": {
|
||||||
"version": "9.0.3",
|
"version": "9.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz",
|
||||||
"integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==",
|
"integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"brace-expansion": "^2.0.1"
|
"brace-expansion": "^2.0.1"
|
||||||
},
|
},
|
||||||
@ -7315,7 +7333,6 @@
|
|||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
|
||||||
"integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==",
|
"integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==",
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
@ -8154,9 +8171,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/path-scurry/node_modules/lru-cache": {
|
"node_modules/path-scurry/node_modules/lru-cache": {
|
||||||
"version": "10.2.0",
|
"version": "10.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.1.tgz",
|
||||||
"integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==",
|
"integrity": "sha512-tS24spDe/zXhWbNPErCHs/AGOzbKGHT+ybSBqmdLm8WZ1xXLWvH8Qn71QPAlqVhd0qUTWjy+Kl9JmISgDdEjsA==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "14 || >=16.14"
|
"node": "14 || >=16.14"
|
||||||
}
|
}
|
||||||
@ -9033,11 +9050,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/sealious": {
|
"node_modules/sealious": {
|
||||||
"version": "0.18.3",
|
"version": "0.19.7",
|
||||||
"resolved": "https://registry.npmjs.org/sealious/-/sealious-0.18.3.tgz",
|
"resolved": "https://registry.npmjs.org/sealious/-/sealious-0.19.7.tgz",
|
||||||
"integrity": "sha512-WxwThRgsTCHxIUVzp6MAK65jBp7lnqPqex8rLondalx62I6E9r2gg0uC1am3/ziZSWgFdpkGKQoiOry0FZyHuw==",
|
"integrity": "sha512-yhKSd+AsFqzCc7UUK4aBIk/YZS7XrvcGJLJyR9m8cVSzN9dmP3glx4xL+gogBOG+SirsDw6FQZz9VKdhshzVUA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@koa/router": "^12.0.1",
|
"@koa/router": "^12.0.1",
|
||||||
|
"@sealcode/file-manager": "^1.0.1",
|
||||||
"@sealcode/ts-predicates": "^0.4.3",
|
"@sealcode/ts-predicates": "^0.4.3",
|
||||||
"@types/bluebird": "^3.5.30",
|
"@types/bluebird": "^3.5.30",
|
||||||
"@types/boom": "^7.3.0",
|
"@types/boom": "^7.3.0",
|
||||||
@ -9079,7 +9097,6 @@
|
|||||||
"koa-send": "^5.0.1",
|
"koa-send": "^5.0.1",
|
||||||
"koa-static": "^5.0.0",
|
"koa-static": "^5.0.0",
|
||||||
"locreq": "^3.0.0",
|
"locreq": "^3.0.0",
|
||||||
"mime": "^4.0.1",
|
|
||||||
"mjml": "^4.2.0",
|
"mjml": "^4.2.0",
|
||||||
"mongodb": "^6.5.0",
|
"mongodb": "^6.5.0",
|
||||||
"nodemailer": "^6.4.6",
|
"nodemailer": "^6.4.6",
|
||||||
@ -10984,6 +11001,17 @@
|
|||||||
"url": "https://github.com/fb55/entities?sponsor=1"
|
"url": "https://github.com/fb55/entities?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/web-resource-inliner/node_modules/escape-goat": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-w3PwNZJwRxlp47QGzhuEBldEqVHHhh8/tIPcl6ecf2Bou99cdAt0knihBV0Ecc7CGxYduXVBDheH1K2oADRlvw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/web-resource-inliner/node_modules/htmlparser2": {
|
"node_modules/web-resource-inliner/node_modules/htmlparser2": {
|
||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-5.0.1.tgz",
|
||||||
@ -10998,17 +11026,6 @@
|
|||||||
"url": "https://github.com/fb55/htmlparser2?sponsor=1"
|
"url": "https://github.com/fb55/htmlparser2?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/web-resource-inliner/node_modules/mime": {
|
|
||||||
"version": "2.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz",
|
|
||||||
"integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==",
|
|
||||||
"bin": {
|
|
||||||
"mime": "cli.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/webidl-conversions": {
|
"node_modules/webidl-conversions": {
|
||||||
"version": "7.0.0",
|
"version": "7.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
|
||||||
|
10
package.json
10
package.json
@ -14,7 +14,7 @@
|
|||||||
"watch": "multiple-scripts-tmux -p watch",
|
"watch": "multiple-scripts-tmux -p watch",
|
||||||
"reset-db": "docker-compose down && docker-compose up -d",
|
"reset-db": "docker-compose down && docker-compose up -d",
|
||||||
"install-test-deps": "npx playwright install firefox",
|
"install-test-deps": "npx playwright install firefox",
|
||||||
"pretest-cmd": "npm run build",
|
"pretest-cmd": "rm -rf dist && npm run build",
|
||||||
"test-cmd": "vitest --config ./src/back/vitest.config.ts",
|
"test-cmd": "vitest --config ./src/back/vitest.config.ts",
|
||||||
"test-cmd-once": "vitest run --config ./src/back/vitest.config.ts",
|
"test-cmd-once": "vitest run --config ./src/back/vitest.config.ts",
|
||||||
"test": "npm run test-cmd -- --ui",
|
"test": "npm run test-cmd -- --ui",
|
||||||
@ -38,11 +38,13 @@
|
|||||||
"@hotwired/turbo": "^8.0.2",
|
"@hotwired/turbo": "^8.0.2",
|
||||||
"@koa/router": "^12.0.1",
|
"@koa/router": "^12.0.1",
|
||||||
"@playwright/test": "^1.36.1",
|
"@playwright/test": "^1.36.1",
|
||||||
"@sealcode/jdd": "^0.3.5",
|
"@sealcode/file-manager": "^1.0.2",
|
||||||
"@sealcode/sealgen": "^0.14.16",
|
"@sealcode/jdd": "^0.4.5",
|
||||||
|
"@sealcode/sealgen": "^0.15.6",
|
||||||
"@sealcode/ts-predicates": "^0.6.2",
|
"@sealcode/ts-predicates": "^0.6.2",
|
||||||
"@types/kill-port": "^2.0.0",
|
"@types/kill-port": "^2.0.0",
|
||||||
"@types/leaflet": "^1.9.8",
|
"@types/leaflet": "^1.9.8",
|
||||||
|
"escape-goat": "^4.0.0",
|
||||||
"get-port": "^7.0.0",
|
"get-port": "^7.0.0",
|
||||||
"js-convert-case": "^4.2.0",
|
"js-convert-case": "^4.2.0",
|
||||||
"koa-responsive-image-router": "^0.2.24",
|
"koa-responsive-image-router": "^0.2.24",
|
||||||
@ -51,7 +53,7 @@
|
|||||||
"nodemon": "^3.0.1",
|
"nodemon": "^3.0.1",
|
||||||
"object-path": "^0.11.8",
|
"object-path": "^0.11.8",
|
||||||
"qs": "^6.12.0",
|
"qs": "^6.12.0",
|
||||||
"sealious": "^0.18.3",
|
"sealious": "^0.19.6",
|
||||||
"stimulus": "^2.0.0",
|
"stimulus": "^2.0.0",
|
||||||
"tempstream": "^0.3.15",
|
"tempstream": "^0.3.15",
|
||||||
"vitest": "^1.1.0"
|
"vitest": "^1.1.0"
|
||||||
|
@ -11,8 +11,10 @@ import {
|
|||||||
MONGO_HOST,
|
MONGO_HOST,
|
||||||
MONGO_PORT,
|
MONGO_PORT,
|
||||||
PORT,
|
PORT,
|
||||||
|
UPLOADS_FS_DIR,
|
||||||
} from "./config.js";
|
} from "./config.js";
|
||||||
import ADMIN_CREDENTIALS from "./default-admin-credentials.js";
|
import ADMIN_CREDENTIALS from "./default-admin-credentials.js";
|
||||||
|
import { TheFileManager } from "./file-manager.js";
|
||||||
import { module_dirname } from "./utils/module_dirname.js";
|
import { module_dirname } from "./utils/module_dirname.js";
|
||||||
const locreq = _locreq(module_dirname(import.meta.url));
|
const locreq = _locreq(module_dirname(import.meta.url));
|
||||||
|
|
||||||
@ -25,8 +27,9 @@ declare module "koa" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default class TheApp extends App {
|
export default class TheApp extends App {
|
||||||
|
FileManager = TheFileManager;
|
||||||
config = {
|
config = {
|
||||||
upload_path: locreq.resolve("uploaded_files"),
|
upload_path: UPLOADS_FS_DIR,
|
||||||
datastore_mongo: {
|
datastore_mongo: {
|
||||||
host: MONGO_HOST,
|
host: MONGO_HOST,
|
||||||
port: MONGO_PORT,
|
port: MONGO_PORT,
|
||||||
|
@ -25,3 +25,6 @@ export const IMAGE_CACHE_FS_DIR =
|
|||||||
process.env.IMAGE_CACHE_FS_DIR || locreq.resolve("cache/images");
|
process.env.IMAGE_CACHE_FS_DIR || locreq.resolve("cache/images");
|
||||||
export const SMARTCROP_CACHE_FS_DIR =
|
export const SMARTCROP_CACHE_FS_DIR =
|
||||||
process.env.IMAGE_CACHE_FS_DIR || locreq.resolve("cache/smartcrop");
|
process.env.IMAGE_CACHE_FS_DIR || locreq.resolve("cache/smartcrop");
|
||||||
|
|
||||||
|
export const UPLOADS_FS_DIR =
|
||||||
|
process.env.UPLOADS_FS_DIR || locreq.resolve("uploaded_files");
|
||||||
|
7
src/back/file-manager.ts
Normal file
7
src/back/file-manager.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { FileManager } from "@sealcode/file-manager";
|
||||||
|
import { UPLOADS_FS_DIR } from "./config.js";
|
||||||
|
|
||||||
|
export const TheFileManager = new FileManager(
|
||||||
|
UPLOADS_FS_DIR,
|
||||||
|
"/api/v1/uploaded-files" // this value comes from Sealious, currently not customizable
|
||||||
|
);
|
@ -1,7 +1,7 @@
|
|||||||
import type { FlatTemplatable } from "tempstream";
|
import type { FlatTemplatable } from "tempstream";
|
||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import type {
|
import type {
|
||||||
ExtractStructuredComponentArgumentsValues,
|
ExtractStructuredComponentArgumentsParsed,
|
||||||
JDDContext,
|
JDDContext,
|
||||||
} from "@sealcode/jdd";
|
} from "@sealcode/jdd";
|
||||||
import { Component, ComponentArguments } from "@sealcode/jdd";
|
import { Component, ComponentArguments } from "@sealcode/jdd";
|
||||||
@ -31,7 +31,7 @@ export class AutoscrollingImages extends Component<typeof component_arguments> {
|
|||||||
interval,
|
interval,
|
||||||
imagesPerPage,
|
imagesPerPage,
|
||||||
images,
|
images,
|
||||||
}: ExtractStructuredComponentArgumentsValues<typeof component_arguments>,
|
}: ExtractStructuredComponentArgumentsParsed<typeof component_arguments>,
|
||||||
{ render_image }: JDDContext
|
{ render_image }: JDDContext
|
||||||
): FlatTemplatable {
|
): FlatTemplatable {
|
||||||
const imageNumberPerPage = parseInt(imagesPerPage);
|
const imageNumberPerPage = parseInt(imagesPerPage);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { FlatTemplatable } from "tempstream";
|
import type { FlatTemplatable } from "tempstream";
|
||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import type {
|
import type {
|
||||||
ExtractStructuredComponentArgumentsValues,
|
ExtractStructuredComponentArgumentsParsed,
|
||||||
JDDContext,
|
JDDContext,
|
||||||
} from "@sealcode/jdd";
|
} from "@sealcode/jdd";
|
||||||
import { Component, ComponentArguments } from "@sealcode/jdd";
|
import { Component, ComponentArguments } from "@sealcode/jdd";
|
||||||
@ -35,7 +35,7 @@ export class FaqComponent extends Component<typeof component_arguments> {
|
|||||||
content,
|
content,
|
||||||
faq,
|
faq,
|
||||||
button,
|
button,
|
||||||
}: ExtractStructuredComponentArgumentsValues<typeof component_arguments>,
|
}: ExtractStructuredComponentArgumentsParsed<typeof component_arguments>,
|
||||||
{ render_markdown }: JDDContext
|
{ render_markdown }: JDDContext
|
||||||
): FlatTemplatable {
|
): FlatTemplatable {
|
||||||
const buttonText = button.buttonText.toUpperCase();
|
const buttonText = button.buttonText.toUpperCase();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { FlatTemplatable } from "tempstream";
|
import type { FlatTemplatable } from "tempstream";
|
||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import type {
|
import type {
|
||||||
ExtractStructuredComponentArgumentsValues,
|
ExtractStructuredComponentArgumentsParsed,
|
||||||
JDDContext,
|
JDDContext,
|
||||||
} from "@sealcode/jdd";
|
} from "@sealcode/jdd";
|
||||||
import { Component, ComponentArguments } from "@sealcode/jdd";
|
import { Component, ComponentArguments } from "@sealcode/jdd";
|
||||||
@ -30,7 +30,7 @@ export class HeaderWithImage extends Component<typeof component_arguments> {
|
|||||||
content,
|
content,
|
||||||
image_with_alt,
|
image_with_alt,
|
||||||
button,
|
button,
|
||||||
}: ExtractStructuredComponentArgumentsValues<typeof component_arguments>,
|
}: ExtractStructuredComponentArgumentsParsed<typeof component_arguments>,
|
||||||
{ render_markdown, render_image }: JDDContext
|
{ render_markdown, render_image }: JDDContext
|
||||||
): FlatTemplatable {
|
): FlatTemplatable {
|
||||||
const buttonText = button.text.toUpperCase();
|
const buttonText = button.text.toUpperCase();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { FlatTemplatable } from "tempstream";
|
import type { FlatTemplatable } from "tempstream";
|
||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import type {
|
import type {
|
||||||
ExtractStructuredComponentArgumentsValues,
|
ExtractStructuredComponentArgumentsParsed,
|
||||||
JDDContext,
|
JDDContext,
|
||||||
} from "@sealcode/jdd";
|
} from "@sealcode/jdd";
|
||||||
import { Component, ComponentArguments } from "@sealcode/jdd";
|
import { Component, ComponentArguments } from "@sealcode/jdd";
|
||||||
@ -23,7 +23,7 @@ export class ImageDemo extends Component<typeof component_arguments> {
|
|||||||
{
|
{
|
||||||
image_with_alt,
|
image_with_alt,
|
||||||
multiple_images,
|
multiple_images,
|
||||||
}: ExtractStructuredComponentArgumentsValues<typeof component_arguments>,
|
}: ExtractStructuredComponentArgumentsParsed<typeof component_arguments>,
|
||||||
{ render_image }: JDDContext
|
{ render_image }: JDDContext
|
||||||
): FlatTemplatable {
|
): FlatTemplatable {
|
||||||
return (
|
return (
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type { FlatTemplatable } from "tempstream";
|
import type { FlatTemplatable } from "tempstream";
|
||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import type { ExtractStructuredComponentArgumentsValues } from "@sealcode/jdd";
|
import type { ExtractStructuredComponentArgumentsParsed } from "@sealcode/jdd";
|
||||||
import { Component, ComponentArguments } from "@sealcode/jdd";
|
import { Component, ComponentArguments } from "@sealcode/jdd";
|
||||||
|
|
||||||
const coordinates = new ComponentArguments.ShortText();
|
const coordinates = new ComponentArguments.ShortText();
|
||||||
@ -51,7 +51,7 @@ export class MapWithPins extends Component<typeof component_arguments> {
|
|||||||
|
|
||||||
toHTML({
|
toHTML({
|
||||||
pins,
|
pins,
|
||||||
}: ExtractStructuredComponentArgumentsValues<
|
}: ExtractStructuredComponentArgumentsParsed<
|
||||||
typeof component_arguments
|
typeof component_arguments
|
||||||
>): FlatTemplatable {
|
>): FlatTemplatable {
|
||||||
return (
|
return (
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import type {
|
import type {
|
||||||
ExtractStructuredComponentArgumentsValues,
|
ExtractStructuredComponentArgumentsParsed,
|
||||||
JDDContext,
|
JDDContext,
|
||||||
} from "@sealcode/jdd";
|
} from "@sealcode/jdd";
|
||||||
import { Component, ComponentArguments } from "@sealcode/jdd";
|
import { Component, ComponentArguments } from "@sealcode/jdd";
|
||||||
@ -27,7 +27,7 @@ export class NiceBox extends Component<typeof component_arguments> {
|
|||||||
title,
|
title,
|
||||||
content,
|
content,
|
||||||
images,
|
images,
|
||||||
}: ExtractStructuredComponentArgumentsValues<typeof component_arguments>,
|
}: ExtractStructuredComponentArgumentsParsed<typeof component_arguments>,
|
||||||
{ render_markdown, render_image }: JDDContext
|
{ render_markdown, render_image }: JDDContext
|
||||||
): Promise<Readable> {
|
): Promise<Readable> {
|
||||||
return (
|
return (
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type { FlatTemplatable } from "tempstream";
|
import type { FlatTemplatable } from "tempstream";
|
||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import type { ExtractStructuredComponentArgumentsValues } from "@sealcode/jdd";
|
import type { ExtractStructuredComponentArgumentsParsed } from "@sealcode/jdd";
|
||||||
import { Component, ComponentArguments, isTableHeader } from "@sealcode/jdd";
|
import { Component, ComponentArguments, isTableHeader } from "@sealcode/jdd";
|
||||||
|
|
||||||
const component_arguments = {
|
const component_arguments = {
|
||||||
@ -25,7 +25,7 @@ export class Table extends Component<typeof component_arguments> {
|
|||||||
|
|
||||||
toHTML({
|
toHTML({
|
||||||
table,
|
table,
|
||||||
}: ExtractStructuredComponentArgumentsValues<
|
}: ExtractStructuredComponentArgumentsParsed<
|
||||||
typeof component_arguments
|
typeof component_arguments
|
||||||
>): FlatTemplatable {
|
>): FlatTemplatable {
|
||||||
return (
|
return (
|
||||||
|
16
src/back/jdd-context.ts
Normal file
16
src/back/jdd-context.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import type { JDDContext } from "@sealcode/jdd";
|
||||||
|
import type { FilePointer } from "@sealcode/file-manager";
|
||||||
|
import { makeSimpleJDDContext } from "@sealcode/jdd";
|
||||||
|
import { TheFileManager } from "./file-manager.js";
|
||||||
|
import { imageRouter } from "./image-router.js";
|
||||||
|
|
||||||
|
export const jdd_context: JDDContext = {
|
||||||
|
...makeSimpleJDDContext(TheFileManager),
|
||||||
|
render_image: async (image: string | FilePointer | null, args) => {
|
||||||
|
if (!image) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
const file = await TheFileManager.toPointer(image);
|
||||||
|
return imageRouter.image(await file.getPath(), args);
|
||||||
|
},
|
||||||
|
};
|
@ -1,10 +1,12 @@
|
|||||||
import type { Image } from "@sealcode/jdd";
|
import type { Image } from "@sealcode/jdd";
|
||||||
import type { StatefulPage } from "@sealcode/sealgen";
|
import type { StatefulPage } from "@sealcode/sealgen";
|
||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
|
import { jdd_context } from "../../jdd-context.js";
|
||||||
import type { ComponentPreviewState } from "../components.sreact.js";
|
import type { ComponentPreviewState } from "../components.sreact.js";
|
||||||
import { jdd_context } from "../jdd-context.js";
|
|
||||||
import type { ComponentPreviewActions } from "./component-preview-actions.js";
|
import type { ComponentPreviewActions } from "./component-preview-actions.js";
|
||||||
import { printArgPath } from "./print-arg-path.js";
|
import { printArgPath } from "./print-arg-path.js";
|
||||||
|
import { htmlEscape } from "escape-goat";
|
||||||
|
import type { FilePointer } from "@sealcode/file-manager";
|
||||||
|
|
||||||
export function ComponentInputImage<State extends ComponentPreviewState>({
|
export function ComponentInputImage<State extends ComponentPreviewState>({
|
||||||
arg_path,
|
arg_path,
|
||||||
@ -14,7 +16,7 @@ export function ComponentInputImage<State extends ComponentPreviewState>({
|
|||||||
state: State;
|
state: State;
|
||||||
arg_path: string[];
|
arg_path: string[];
|
||||||
arg: Image;
|
arg: Image;
|
||||||
value: string;
|
value: FilePointer | null;
|
||||||
page: StatefulPage<ComponentPreviewState, typeof ComponentPreviewActions>;
|
page: StatefulPage<ComponentPreviewState, typeof ComponentPreviewActions>;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
@ -43,9 +45,7 @@ export function ComponentInputImage<State extends ComponentPreviewState>({
|
|||||||
<input
|
<input
|
||||||
type="hidden"
|
type="hidden"
|
||||||
name={`$.component_args${printArgPath(arg_path)}.old`}
|
name={`$.component_args${printArgPath(arg_path)}.old`}
|
||||||
value={(value || "")
|
value={htmlEscape(value?.token || "")}
|
||||||
.replaceAll('"', """)
|
|
||||||
.replaceAll("\n", "\\n")}
|
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
import type { List } from "@sealcode/jdd";
|
import type { ComponentArgument, List } from "@sealcode/jdd";
|
||||||
import type { StatefulPage } from "@sealcode/sealgen";
|
import type { StatefulPage } from "@sealcode/sealgen";
|
||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import type { ComponentPreviewState } from "../components.sreact.js";
|
import type { ComponentPreviewState } from "../components.sreact.js";
|
||||||
import { jdd_context } from "../jdd-context.js";
|
|
||||||
import { ComponentInput } from "./component-input.js";
|
import { ComponentInput } from "./component-input.js";
|
||||||
import type { ComponentPreviewActions } from "./component-preview-actions.js";
|
import type { ComponentPreviewActions } from "./component-preview-actions.js";
|
||||||
|
|
||||||
export async function ComponentInputList<State extends ComponentPreviewState, T>({
|
export async function ComponentInputList<
|
||||||
|
State extends ComponentPreviewState,
|
||||||
|
T extends ComponentArgument<unknown>
|
||||||
|
>({
|
||||||
state,
|
state,
|
||||||
arg_path,
|
arg_path,
|
||||||
arg,
|
arg,
|
||||||
@ -50,8 +52,7 @@ export async function ComponentInputList<State extends ComponentPreviewState, T>
|
|||||||
action: "add_array_item",
|
action: "add_array_item",
|
||||||
label: "➕",
|
label: "➕",
|
||||||
},
|
},
|
||||||
arg_path,
|
arg_path
|
||||||
await arg.item_type.getExampleValue(jdd_context)
|
|
||||||
)}
|
)}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
);
|
);
|
||||||
|
@ -3,7 +3,6 @@ import { isTableHeader } from "@sealcode/jdd";
|
|||||||
import type { StatefulPage } from "@sealcode/sealgen";
|
import type { StatefulPage } from "@sealcode/sealgen";
|
||||||
import { TempstreamJSX } from "tempstream";
|
import { TempstreamJSX } from "tempstream";
|
||||||
import type { ComponentPreviewState } from "../components.sreact.js";
|
import type { ComponentPreviewState } from "../components.sreact.js";
|
||||||
import { jdd_context } from "../jdd-context.js";
|
|
||||||
import { ComponentInput } from "./component-input.js";
|
import { ComponentInput } from "./component-input.js";
|
||||||
import type { ComponentPreviewActions } from "./component-preview-actions.js";
|
import type { ComponentPreviewActions } from "./component-preview-actions.js";
|
||||||
|
|
||||||
@ -35,8 +34,6 @@ export async function ComponentInputTable<
|
|||||||
if (!value) {
|
if (!value) {
|
||||||
value = arg.getEmptyValue();
|
value = arg.getEmptyValue();
|
||||||
}
|
}
|
||||||
const empty_cell_value = arg.cell_type.getExampleValue(jdd_context);
|
|
||||||
const empty_header_value = arg.header_type.getExampleValue(jdd_context);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@ -171,8 +168,7 @@ export async function ComponentInputTable<
|
|||||||
src="${add_column_right_icon.url}"
|
src="${add_column_right_icon.url}"
|
||||||
/>`,
|
/>`,
|
||||||
},
|
},
|
||||||
arg_path,
|
arg_path
|
||||||
empty_cell_value
|
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
) : (
|
) : (
|
||||||
@ -197,7 +193,6 @@ export async function ComponentInputTable<
|
|||||||
/>`,
|
/>`,
|
||||||
},
|
},
|
||||||
arg_path,
|
arg_path,
|
||||||
empty_cell_value,
|
|
||||||
arg.getColumnsCount(value)
|
arg.getColumnsCount(value)
|
||||||
)}
|
)}
|
||||||
{page.makeActionButton(
|
{page.makeActionButton(
|
||||||
@ -212,7 +207,6 @@ export async function ComponentInputTable<
|
|||||||
/>`,
|
/>`,
|
||||||
},
|
},
|
||||||
arg_path,
|
arg_path,
|
||||||
empty_header_value,
|
|
||||||
arg.getColumnsCount(value),
|
arg.getColumnsCount(value),
|
||||||
"header"
|
"header"
|
||||||
)}
|
)}
|
||||||
|
@ -12,6 +12,7 @@ import { ComponentInputTable } from "./component-input-table.js";
|
|||||||
import { printArgPath } from "./print-arg-path.js";
|
import { printArgPath } from "./print-arg-path.js";
|
||||||
import type { ComponentPreviewActions } from "./component-preview-actions.js";
|
import type { ComponentPreviewActions } from "./component-preview-actions.js";
|
||||||
import { is, predicates } from "@sealcode/ts-predicates";
|
import { is, predicates } from "@sealcode/ts-predicates";
|
||||||
|
import type { FilePointer } from "@sealcode/file-manager";
|
||||||
|
|
||||||
export const actionName = "Components";
|
export const actionName = "Components";
|
||||||
const absoluteUrlPattern = "http(s?)(://)((www.)?)(([^.]+).)?([a-zA-z0-9-_]+)";
|
const absoluteUrlPattern = "http(s?)(://)((www.)?)(([^.]+).)?([a-zA-z0-9-_]+)";
|
||||||
@ -70,7 +71,7 @@ export function ComponentInput<State extends ComponentPreviewState, T>({
|
|||||||
arg_path,
|
arg_path,
|
||||||
arg,
|
arg,
|
||||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
value: value as string,
|
value: value as FilePointer,
|
||||||
page,
|
page,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import type { TableData } from "@sealcode/jdd";
|
import type { ComponentArgument, List, Table, TableData } from "@sealcode/jdd";
|
||||||
import { isTableData, isTableRegularRow } from "@sealcode/jdd";
|
import { isTableData, isTableRegularRow } from "@sealcode/jdd";
|
||||||
import objectPath from "object-path";
|
import objectPath from "object-path";
|
||||||
import { registry } from "../../jdd-components/components.js";
|
import { registry } from "../../jdd-components/components.js";
|
||||||
|
import { jdd_context } from "../../jdd-context.js";
|
||||||
import type { ComponentPreviewState } from "../components.sreact.js";
|
import type { ComponentPreviewState } from "../components.sreact.js";
|
||||||
import { jdd_context } from "../jdd-context.js";
|
|
||||||
|
|
||||||
function moveElement<T>(array: Array<T>, fromIndex: number, toIndex: number): Array<T> {
|
function moveElement<T>(array: Array<T>, fromIndex: number, toIndex: number): Array<T> {
|
||||||
const element = array.splice(fromIndex, 1)[0];
|
const element = array.splice(fromIndex, 1)[0];
|
||||||
@ -12,17 +12,30 @@ function moveElement<T>(array: Array<T>, fromIndex: number, toIndex: number): Ar
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const ComponentPreviewActions = <const>{
|
export const ComponentPreviewActions = <const>{
|
||||||
add_array_item: (
|
add_array_item: async (
|
||||||
state: ComponentPreviewState,
|
state: ComponentPreviewState,
|
||||||
_: Record<string, string>,
|
_: Record<string, string>,
|
||||||
arg_path: string[],
|
arg_path: string[]
|
||||||
empty_value: unknown
|
|
||||||
) => {
|
) => {
|
||||||
const component_args = state.component_args;
|
const component_args = state.component_args;
|
||||||
|
const component = registry.get(state.component);
|
||||||
|
if (!component) {
|
||||||
|
console.error("unknown component: ", state.component);
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
|
const argument = component.getArgumentAtPath(
|
||||||
|
arg_path,
|
||||||
|
state.component_args
|
||||||
|
) as List<ComponentArgument<unknown>> | null;
|
||||||
|
if (!argument) {
|
||||||
|
console.error("Didn't find a list argument at this path", arg_path);
|
||||||
|
return state;
|
||||||
|
}
|
||||||
objectPath.insert(
|
objectPath.insert(
|
||||||
component_args,
|
component_args,
|
||||||
arg_path,
|
arg_path,
|
||||||
empty_value,
|
await argument.item_type.getExampleValue(jdd_context),
|
||||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
((objectPath.get(component_args, arg_path) as unknown[]) || []).length
|
((objectPath.get(component_args, arg_path) as unknown[]) || []).length
|
||||||
);
|
);
|
||||||
@ -67,22 +80,39 @@ export const ComponentPreviewActions = <const>{
|
|||||||
component_args: (await component?.getExampleValues(jdd_context)) || {},
|
component_args: (await component?.getExampleValues(jdd_context)) || {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
add_table_row: (
|
add_table_row: async (
|
||||||
state: ComponentPreviewState,
|
state: ComponentPreviewState,
|
||||||
_: Record<string, string>,
|
_: Record<string, string>,
|
||||||
arg_path: string[],
|
arg_path: string[],
|
||||||
empty_value: unknown,
|
|
||||||
columns: number,
|
columns: number,
|
||||||
type: "header" | "row" = "row"
|
type: "header" | "row" = "row"
|
||||||
) => {
|
) => {
|
||||||
const component_args = state.component_args;
|
const component_args = state.component_args;
|
||||||
let row;
|
let row;
|
||||||
|
const component = registry.get(state.component);
|
||||||
|
if (!component) {
|
||||||
|
console.error("Unknown component: ", state.component);
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
|
const argument = component.getArgumentAtPath(
|
||||||
|
arg_path,
|
||||||
|
state.component_args
|
||||||
|
) as Table<unknown, unknown> | null;
|
||||||
|
if (!argument) {
|
||||||
|
console.error("Unknown component at path", arg_path);
|
||||||
|
return state;
|
||||||
|
}
|
||||||
if (type == "header") {
|
if (type == "header") {
|
||||||
row = { type: "header", header_content: empty_value };
|
row = {
|
||||||
|
type: "header",
|
||||||
|
header_content: await argument.header_type.getExampleValue(jdd_context),
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
const cells = [];
|
const cells = [];
|
||||||
for (let i = 0; i < columns; i++) {
|
for (let i = 0; i < columns; i++) {
|
||||||
cells.push(empty_value);
|
// eslint-disable-next-line no-await-in-loop
|
||||||
|
cells.push(await argument.cell_type.getExampleValue(jdd_context));
|
||||||
}
|
}
|
||||||
row = { type: "row", cells };
|
row = { type: "row", cells };
|
||||||
}
|
}
|
||||||
@ -100,13 +130,22 @@ export const ComponentPreviewActions = <const>{
|
|||||||
};
|
};
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
add_table_column: (
|
add_table_column: async (
|
||||||
state: ComponentPreviewState,
|
state: ComponentPreviewState,
|
||||||
_: Record<string, string>,
|
_: Record<string, string>,
|
||||||
arg_path: string[],
|
arg_path: string[]
|
||||||
empty_value: unknown
|
|
||||||
) => {
|
) => {
|
||||||
const component_args = state.component_args;
|
const component_args = state.component_args;
|
||||||
|
const component = registry.get(state.component);
|
||||||
|
if (!component) {
|
||||||
|
console.error("Unknown component: ", state.component);
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
const argument = component.getArgumentAtPath(arg_path, state.component_args);
|
||||||
|
if (!argument) {
|
||||||
|
console.error("Unknown component at path", arg_path);
|
||||||
|
return state;
|
||||||
|
}
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||||
const tableData: TableData<unknown, unknown> = objectPath.get(
|
const tableData: TableData<unknown, unknown> = objectPath.get(
|
||||||
component_args,
|
component_args,
|
||||||
@ -119,7 +158,8 @@ export const ComponentPreviewActions = <const>{
|
|||||||
for (const i in tableData.rows) {
|
for (const i in tableData.rows) {
|
||||||
const row = tableData.rows[i];
|
const row = tableData.rows[i];
|
||||||
if (isTableRegularRow(row)) {
|
if (isTableRegularRow(row)) {
|
||||||
row.cells.push(empty_value);
|
// eslint-disable-next-line no-await-in-loop
|
||||||
|
row.cells.push(await argument.getExampleValue(jdd_context));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
objectPath.set(component_args, arg_path, tableData);
|
objectPath.set(component_args, arg_path, tableData);
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { render, renderEarlyAssets } from "@sealcode/jdd";
|
import { render, renderEarlyAssets } from "@sealcode/jdd";
|
||||||
import { StatefulPage, to_base64 } from "@sealcode/sealgen";
|
import { StatefulPage } from "@sealcode/sealgen";
|
||||||
import { hasShape, predicates } from "@sealcode/ts-predicates";
|
import { hasShape, predicates } from "@sealcode/ts-predicates";
|
||||||
import type { BaseContext } from "koa";
|
import type { BaseContext } from "koa";
|
||||||
import type { Templatable } from "tempstream";
|
import type { Templatable } from "tempstream";
|
||||||
import { tempstream, TempstreamJSX } from "tempstream";
|
import { tempstream, TempstreamJSX } from "tempstream";
|
||||||
import html, { defaultHead } from "../html.js";
|
import html, { defaultHead } from "../html.js";
|
||||||
import { registry } from "../jdd-components/components.js";
|
import { registry } from "../jdd-components/components.js";
|
||||||
|
import { jdd_context } from "../jdd-context.js";
|
||||||
import { ComponentInput } from "./component-preview/component-input.js";
|
import { ComponentInput } from "./component-preview/component-input.js";
|
||||||
import { ComponentPreviewActions } from "./component-preview/component-preview-actions.js";
|
import { ComponentPreviewActions } from "./component-preview/component-preview-actions.js";
|
||||||
import { jdd_context } from "./jdd-context.js";
|
|
||||||
|
|
||||||
export const actionName = "Components";
|
export const actionName = "Components";
|
||||||
|
|
||||||
@ -33,6 +33,43 @@ export default new (class ComponentsPage extends StatefulPage<
|
|||||||
return initial_state;
|
return initial_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async serializeState(_context: BaseContext, state: ComponentPreviewState) {
|
||||||
|
const component = registry.get(state.component);
|
||||||
|
const result = JSON.stringify({
|
||||||
|
...state,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||||
|
component_args: component
|
||||||
|
? await component.convertParsedToStorage(
|
||||||
|
jdd_context,
|
||||||
|
state.component_args
|
||||||
|
)
|
||||||
|
: {},
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
async deserializeState(_context: BaseContext, state_string: string) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||||
|
const raw = JSON.parse(state_string);
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions, @typescript-eslint/no-unsafe-member-access
|
||||||
|
const component = registry.get(raw.component as string);
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||||
|
const result = {
|
||||||
|
...raw,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||||
|
component_args: component
|
||||||
|
? // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
||||||
|
await component.convertStorageToParsed(
|
||||||
|
jdd_context,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
||||||
|
raw.component_args || {}
|
||||||
|
)
|
||||||
|
: {},
|
||||||
|
};
|
||||||
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
|
return result as ComponentPreviewState;
|
||||||
|
}
|
||||||
|
|
||||||
wrapInLayout(
|
wrapInLayout(
|
||||||
ctx: BaseContext,
|
ctx: BaseContext,
|
||||||
content: Templatable,
|
content: Templatable,
|
||||||
@ -62,20 +99,6 @@ export default new (class ComponentsPage extends StatefulPage<
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapInForm(state: ComponentPreviewState, content: Templatable): Templatable {
|
|
||||||
// overwriting this method in order to add enctype to form
|
|
||||||
return (
|
|
||||||
<form action="./" method="POST" enctype="multipart/form-data">
|
|
||||||
<input
|
|
||||||
name="state"
|
|
||||||
type="hidden"
|
|
||||||
value={to_base64(JSON.stringify(state))}
|
|
||||||
/>
|
|
||||||
{content}
|
|
||||||
</form>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async preprocessOverrides(
|
async preprocessOverrides(
|
||||||
state: ComponentPreviewState,
|
state: ComponentPreviewState,
|
||||||
overrides: Record<string, unknown>
|
overrides: Record<string, unknown>
|
||||||
@ -95,11 +118,7 @@ export default new (class ComponentsPage extends StatefulPage<
|
|||||||
async ([arg_name, arg]) => {
|
async ([arg_name, arg]) => {
|
||||||
const value = overrides.component_args[arg_name];
|
const value = overrides.component_args[arg_name];
|
||||||
if (value) {
|
if (value) {
|
||||||
const new_value = await arg.parseFormInput(
|
const new_value = await arg.receivedToParsed(jdd_context, value);
|
||||||
jdd_context,
|
|
||||||
value,
|
|
||||||
arg_name
|
|
||||||
);
|
|
||||||
overrides.component_args[arg_name] = new_value;
|
overrides.component_args[arg_name] = new_value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,7 +130,7 @@ export default new (class ComponentsPage extends StatefulPage<
|
|||||||
|
|
||||||
containerSizes = ["320", "600", "800", "1024", "1300", "1920"];
|
containerSizes = ["320", "600", "800", "1024", "1300", "1920"];
|
||||||
|
|
||||||
render(_ctx: BaseContext, state: ComponentPreviewState) {
|
render(ctx: BaseContext, state: ComponentPreviewState) {
|
||||||
const all_components = registry.getAll();
|
const all_components = registry.getAll();
|
||||||
const component =
|
const component =
|
||||||
registry.get(state.component) || Object.values(all_components)[0];
|
registry.get(state.component) || Object.values(all_components)[0];
|
||||||
@ -158,7 +177,7 @@ export default new (class ComponentsPage extends StatefulPage<
|
|||||||
)}
|
)}
|
||||||
<input type="submit" value="Preview" />
|
<input type="submit" value="Preview" />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<code>{JSON.stringify(state)}</code>
|
<code>{this.serializeState(ctx, state)}</code>
|
||||||
</div>
|
</div>
|
||||||
<div class="resize-gutter" data-component-debugger-target="gutter"></div>
|
<div class="resize-gutter" data-component-debugger-target="gutter"></div>
|
||||||
<div class="component-preview" data-component-debugger-target="preview">
|
<div class="component-preview" data-component-debugger-target="preview">
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
import type { JDDContext } from "@sealcode/jdd";
|
|
||||||
import { simpleJDDContext } from "@sealcode/jdd";
|
|
||||||
import { imageRouter } from "../image-router.js";
|
|
||||||
|
|
||||||
export const jdd_context: JDDContext = {
|
|
||||||
...simpleJDDContext,
|
|
||||||
render_image: async (image_id, args) => {
|
|
||||||
if (!image_id) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
const image_pointer = await simpleJDDContext.decode_file(image_id);
|
|
||||||
if (!image_pointer) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return imageRouter.image(image_pointer.path, args);
|
|
||||||
},
|
|
||||||
};
|
|
Loading…
x
Reference in New Issue
Block a user