From 8a7338a3b7424863661f2e4aa11765a3c88b6586 Mon Sep 17 00:00:00 2001 From: Eric Newport Date: Tue, 10 Sep 2024 09:05:39 -0400 Subject: [PATCH] 0.23.1 - Added feature that scans the router stack to move the 404 route (the `*` route) to the end of the stack every time a new route is added, even if the route is added at runtime so that you can dynamically add routes while the app is running. - Updated various dependencies. --- CHANGELOG.md | 5 + README.md | 8 ++ lib/mapRoutes.js | 31 ++++- package-lock.json | 286 ++++++++++++++++++++++++++++---------- package.json | 8 +- test/errorPages.js | 8 +- test/paramFunctions.js | 4 +- test/publicFolder.js | 8 +- test/sourceParams.js | 3 +- test/util/appGenerator.js | 3 - test/viewEngine.js | 6 +- 11 files changed, 274 insertions(+), 96 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59bfdf617..03e03a64e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ - Put your changes here... +## 0.23.1 + +- Added feature that scans the router stack to move the 404 route (the `*` route) to the end of the stack every time a new route is added, even if the route is added at runtime so that you can dynamically add routes while the app is running. +- Updated various dependencies. + ## 0.23.0 - Removed `cores` feature since it is largely redundant now thanks to the widespread popularity of tools like pm2. Also removed various deprecated cluster module support as well. diff --git a/README.md b/README.md index 63068cd58..b33df3db1 100644 --- a/README.md +++ b/README.md @@ -1446,6 +1446,14 @@ Here's how to set up a development environment to hack on Roosevelt's code: If some of the automated tests fail for you when they shouldn't be, make sure you remove the `test/app` folder and kill any Node.js processes (e.g. `killall node`) before running the test suite again. +If you want to see the output from a generated test app in one of the tests, insert this block of code into the test: + +```javascript +testApp.stdout.on('data', (data) => { + console.log(data.toString()) +}) +``` + #### Support Roosevelt's development You can support Roosevelt's development and maintenance by [buying merch](https://curly-braces-merch.printify.me/products) or [donating](https://www.paypal.com/donate/?hosted_button_id=2L2X8GRXZCGJ6). Please note that donations are not tax-deductible. Thank you for your support! diff --git a/lib/mapRoutes.js b/lib/mapRoutes.js index 7e2d64b7f..ebab9058e 100644 --- a/lib/mapRoutes.js +++ b/lib/mapRoutes.js @@ -189,13 +189,40 @@ module.exports = app => { // load 404 controller last so that it doesn't supersede the others try { require(params.errorPages.notFound)(router, app) + + // define a function to move the 404 controller (the "*" route) to the end + function moveWildcardRouteToEnd (stack) { + const wildcardIndex = stack.findIndex(layer => layer.route && layer.route.path === '*') + if (wildcardIndex !== -1) { + const [wildcardRoute] = stack.splice(wildcardIndex, 1) + stack.push(wildcardRoute) + } + } + + // create a proxy to observe changes to router.stack + const stackProxy = new Proxy(router.stack, { + set (target, property, value) { + target[property] = value + moveWildcardRouteToEnd(target) + return true + }, + deleteProperty (target, property) { + delete target[property] + moveWildcardRouteToEnd(target) + return true + } + }) + + // replace router.stack with the proxy + router.stack = stackProxy + + // note there is a simlar object located at app._router.stack with the app's routes instead of the router's routes that we're not modifying + // this is because it seems app._router.stack routes (e.g. /reloadHttp/reload.js and /reloadHttps/reload.js) take precedence over any routes in router.stack } catch (e) { logger.error(`${appName} failed to load 404 controller file: ${params.errorPages.notFound}. Please make sure it is coded correctly. See documentation at http://github.com/rooseveltframework/roosevelt for examples.`) logger.error(e) } - // TODO: consider adding an object observer to move the 404 controller to the end of the stack anytime the router stack is mutated - // activate the router module app.use(prefix || '/', router) diff --git a/package-lock.json b/package-lock.json index c402aee73..465302cb4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,17 @@ { "name": "roosevelt", - "version": "0.23.0", + "version": "0.23.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "roosevelt", - "version": "0.23.0", + "version": "0.23.1", "license": "CC-BY-4.0", "dependencies": { "@colors/colors": "1.6.0", "app-module-path": "2.2.0", - "better-sqlite3": "11.2.1", + "better-sqlite3": "11.3.0", "better-sqlite3-session-store": "0.1.0", "clean-css": "5.3.3", "compression": "1.7.4", @@ -19,7 +19,7 @@ "csrf-csrf": "3.0.6", "es6-template-strings": "2.0.1", "execa": "9.3.1", - "express": "4.19.2", + "express": "4.20.0", "express-html-validator": "0.2.4", "express-session": "1.18.0", "formidable": "3.5.1", @@ -44,7 +44,7 @@ "devDependencies": { "c8": "10.1.2", "codecov": "3.8.3", - "eslint": "9.9.1", + "eslint": "9.10.0", "eslint-plugin-mocha": "10.5.0", "glob": "11.0.0", "less": "4.2.0", @@ -371,9 +371,9 @@ "license": "MIT" }, "node_modules/@eslint/js": { - "version": "9.9.1", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.9.1.tgz", - "integrity": "sha512-xIDQRsfg5hNBqHz04H1R3scSVwmI+KUbqjsQKHKQ1DAUSaUjYPReZZmS/5PNiKu1fUvzDd6H7DEDKACSEhu+TQ==", + "version": "9.10.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.10.0.tgz", + "integrity": "sha512-fuXtbiP5GWIn8Fz+LWoOMVf/Jxm+aajZYkhi6CuEm4SxymFM+eUWzbO9qXT+L0iCkL5+KGYMCSGxo686H19S1g==", "dev": true, "license": "MIT", "engines": { @@ -390,6 +390,19 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, + "node_modules/@eslint/plugin-kit": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.1.0.tgz", + "integrity": "sha512-autAXT203ixhqei9xt+qkYOvY8l6LAFIdT2UXc/RPNeUVfqRF1BV94GTJyVPFKT8nFM6MyVJhjLj9E8JWvf5zQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, "node_modules/@html-validate/stylish": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/@html-validate/stylish/-/stylish-4.2.0.tgz", @@ -497,9 +510,9 @@ } }, "node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "license": "MIT", "engines": { "node": ">=12" @@ -1387,9 +1400,9 @@ } }, "node_modules/better-sqlite3": { - "version": "11.2.1", - "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-11.2.1.tgz", - "integrity": "sha512-Xbt1d68wQnUuFIEVsbt6V+RG30zwgbtCGQ4QOcXVrOH0FE4eHk64FWZ9NUfRHS4/x1PXqwz/+KOrnXD7f0WieA==", + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-11.3.0.tgz", + "integrity": "sha512-iHt9j8NPYF3oKCNOO5ZI4JwThjt3Z6J6XrcwG85VNMVzv1ByqrHWv5VILEbCMFWDsoHhXvQ7oC8vgRXFAKgl9w==", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -1439,9 +1452,9 @@ } }, "node_modules/body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", "license": "MIT", "dependencies": { "bytes": "3.1.2", @@ -1452,7 +1465,7 @@ "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.11.0", + "qs": "6.13.0", "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" @@ -1471,6 +1484,21 @@ "node": ">= 0.8" } }, + "node_modules/body-parser/node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -1675,9 +1703,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001658", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001658.tgz", - "integrity": "sha512-N2YVqWbJELVdrnsW5p+apoQyYt51aBMSsBZki1XZEfeBCexcM/sf4xiAHcXQBkuOwJBXtWF7aW1sYX6tKebPHw==", + "version": "1.0.30001660", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001660.tgz", + "integrity": "sha512-GacvNTTuATm26qC74pt+ad1fW15mlQ/zuTzzY1ZoIzECTP8HURDfF43kNxPgf7H1jmelCBQTTbBNxdSXOA7Bqg==", "funding": [ { "type": "opencollective", @@ -2529,9 +2557,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.16", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.16.tgz", - "integrity": "sha512-2gQpi2WYobXmz2q23FrOBYTLcI1O/P4heW3eqX+ldmPVDQELRqhiebV380EhlGG12NtnX1qbK/FHpN0ba+7bLA==", + "version": "1.5.18", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.18.tgz", + "integrity": "sha512-1OfuVACu+zKlmjsNdcJuVQuVE61sZOLbNM4JAQ1Rvh6EOj0/EUKhMJjRH73InPlXSh8HIJk1cVZ8pyOV/FMdUQ==", "license": "ISC" }, "node_modules/emoji-regex": { @@ -2547,9 +2575,9 @@ "license": "MIT" }, "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", "license": "MIT", "engines": { "node": ">= 0.8" @@ -2890,9 +2918,9 @@ } }, "node_modules/eslint": { - "version": "9.9.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.9.1.tgz", - "integrity": "sha512-dHvhrbfr4xFQ9/dq+jcVneZMyRYLjggWjk6RVsIiHsP8Rz6yZ8LvZ//iU4TrZF+SXWG+JkNF2OyiZRvzgRDqMg==", + "version": "9.10.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.10.0.tgz", + "integrity": "sha512-Y4D0IgtBZfOcOUAIQTSXBKoNGfY0REGqHJG6+Q81vNippW5YlKjHFj4soMxamKK1NXHUWuBZTLdU3Km+L/pcHw==", "dev": true, "license": "MIT", "dependencies": { @@ -2900,7 +2928,8 @@ "@eslint-community/regexpp": "^4.11.0", "@eslint/config-array": "^0.18.0", "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "9.9.1", + "@eslint/js": "9.10.0", + "@eslint/plugin-kit": "^0.1.0", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.3.0", "@nodelib/fs.walk": "^1.2.8", @@ -2923,7 +2952,6 @@ "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", @@ -3446,37 +3474,37 @@ } }, "node_modules/express": { - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", - "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "version": "4.20.0", + "resolved": "https://registry.npmjs.org/express/-/express-4.20.0.tgz", + "integrity": "sha512-pLdae7I6QqShF5PnNTCVn4hI91Dx0Grkn2+IAsMTgMIKuQVte2dN9PeGSSAME2FR8anOhVA62QDIUaWVfEXVLw==", "license": "MIT", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.2", + "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", "finalhandler": "1.2.0", "fresh": "0.5.2", "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", + "merge-descriptors": "1.0.3", "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", + "path-to-regexp": "0.1.10", "proxy-addr": "~2.0.7", "qs": "6.11.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", + "send": "0.19.0", + "serve-static": "1.16.0", "setprototypeof": "1.2.0", "statuses": "2.0.1", "type-is": "~1.6.18", @@ -3743,6 +3771,15 @@ "node": ">= 0.8" } }, + "node_modules/finalhandler/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -5157,9 +5194,9 @@ } }, "node_modules/is-unicode-supported": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.0.0.tgz", - "integrity": "sha512-FRdAyx5lusK1iHG0TWpVtk9+1i+GjrzRffhDg4ovQ7mcidMQ6mj+MhKPmvh7Xwyv5gIS06ns49CA7Sqg7lC22Q==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.1.0.tgz", + "integrity": "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==", "license": "MIT", "engines": { "node": ">=18" @@ -5753,10 +5790,13 @@ } }, "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==", - "license": "MIT" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/merge-stream": { "version": "2.0.0", @@ -6852,9 +6892,9 @@ } }, "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==", + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", + "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==", "license": "MIT" }, "node_modules/picocolors": { @@ -7391,6 +7431,60 @@ "node": ">=18" } }, + "node_modules/reload/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/reload/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/reload/node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/reload/node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "license": "MIT", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -7667,9 +7761,9 @@ } }, "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", "license": "MIT", "dependencies": { "debug": "2.6.9", @@ -7690,6 +7784,15 @@ "node": ">= 0.8.0" } }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/send/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -7734,9 +7837,9 @@ "license": "MIT" }, "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.0.tgz", + "integrity": "sha512-pDLK8zwl2eKaYrs8mrPZBJua4hMplRWJ1tIFksVC3FtBEBnl8dxgeHtsaMS8DhS9i4fLObaon6ABoc4/hQGdPA==", "license": "MIT", "dependencies": { "encodeurl": "~1.0.2", @@ -7748,6 +7851,45 @@ "node": ">= 0.8.0" } }, + "node_modules/serve-static/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/serve-static/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/serve-static/node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/set-function-length": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", @@ -7972,9 +8114,9 @@ } }, "node_modules/source-map-js": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", - "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "dev": true, "license": "BSD-3-Clause", "engines": { @@ -8523,9 +8665,9 @@ "license": "MIT" }, "node_modules/string-width/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "license": "MIT", "engines": { "node": ">=12" @@ -8975,9 +9117,9 @@ } }, "node_modules/terser": { - "version": "5.31.6", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.31.6.tgz", - "integrity": "sha512-PQ4DAriWzKj+qgehQ7LK5bQqCFNMmlhjR2PFFLuqGCpuCAauxemVBWwWOxo3UIwWQx8+Pr61Df++r76wDmkQBg==", + "version": "5.32.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.32.0.tgz", + "integrity": "sha512-v3Gtw3IzpBJ0ugkxEX8U0W6+TnPKRRCWGh1jC/iM/e3Ki5+qvO1L1EAZ56bZasc64aXHwRHNIQEzm6//i5cemQ==", "license": "BSD-2-Clause", "dependencies": { "@jridgewell/source-map": "^0.3.3", @@ -9554,9 +9696,9 @@ } }, "node_modules/version-guard": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/version-guard/-/version-guard-1.1.2.tgz", - "integrity": "sha512-D8d+YxCUpoqtCnQzDxm6SF7DLU3gr2535T4khAtMq4osBahsQnmSxuwXFdrbAdDGG8Uokzfis/jvyeFPdmlc7w==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/version-guard/-/version-guard-1.1.3.tgz", + "integrity": "sha512-JwPr6erhX53EWH/HCSzfy1tTFrtPXUe927wdM1jqBBeYp1OM+qPHjWbsvv6pIBduqdgxxS+ScfG7S28pzyr2DQ==", "dev": true, "license": "0BSD", "engines": { @@ -9900,9 +10042,9 @@ } }, "node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "license": "MIT", "engines": { "node": ">=12" diff --git a/package.json b/package.json index cea13cfce..347d79344 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "url": "https://github.com/rooseveltframework/roosevelt/graphs/contributors" } ], - "version": "0.23.0", + "version": "0.23.1", "files": [ "defaultErrorPages", "lib", @@ -24,7 +24,7 @@ "dependencies": { "@colors/colors": "1.6.0", "app-module-path": "2.2.0", - "better-sqlite3": "11.2.1", + "better-sqlite3": "11.3.0", "better-sqlite3-session-store": "0.1.0", "clean-css": "5.3.3", "compression": "1.7.4", @@ -32,7 +32,7 @@ "csrf-csrf": "3.0.6", "es6-template-strings": "2.0.1", "execa": "9.3.1", - "express": "4.19.2", + "express": "4.20.0", "express-html-validator": "0.2.4", "express-session": "1.18.0", "formidable": "3.5.1", @@ -57,7 +57,7 @@ "devDependencies": { "c8": "10.1.2", "codecov": "3.8.3", - "eslint": "9.9.1", + "eslint": "9.10.0", "eslint-plugin-mocha": "10.5.0", "glob": "11.0.0", "less": "4.2.0", diff --git a/test/errorPages.js b/test/errorPages.js index 00953f284..60059ba22 100644 --- a/test/errorPages.js +++ b/test/errorPages.js @@ -52,8 +52,8 @@ describe('error pages', function () { .get('/randomURL') .expect(404, (err, res) => { if (err) { - assert.fail(err) testApp.send('stop') + assert.fail(err) } // data included on the 404 page const test1 = res.text.includes('404 Not Found') @@ -95,8 +95,8 @@ describe('error pages', function () { .get('/randomURL') .expect(404, (err, res) => { if (err) { - assert.fail(err) testApp.send('stop') + assert.fail(err) } // data included on the custom 404 page const test1 = res.text.includes('404 custom test error page') @@ -137,8 +137,8 @@ describe('error pages', function () { .get('/serverError') .expect(500, (err, res) => { if (err) { - assert.fail(err) testApp.send('stop') + assert.fail(err) } // data included on the custom 500 page const test1 = res.text.includes('500 custom test error page') @@ -176,8 +176,8 @@ describe('error pages', function () { .get('/serverError') .expect(500, (err, res) => { if (err) { - assert.fail(err) testApp.send('stop') + assert.fail(err) } // data included on the default 500 page const test1 = res.text.includes('500 Internal Server Error') diff --git a/test/paramFunctions.js b/test/paramFunctions.js index fbd1499bf..c0ba1b560 100644 --- a/test/paramFunctions.js +++ b/test/paramFunctions.js @@ -134,8 +134,8 @@ describe('Parameter Function Tests', function () { .send({ age: '3' }) .expect(200, (err, res) => { if (err) { - assert.fail(err) testApp.send('stop') + assert.fail(err) } testApp.send('stop') }) @@ -179,8 +179,8 @@ describe('Parameter Function Tests', function () { .send({ age: '3' }) .expect(200, (err, res) => { if (err) { - assert.fail(err) testApp.send('stop') + assert.fail(err) } testApp.send('stop') }) diff --git a/test/publicFolder.js b/test/publicFolder.js index 1bfd9d27d..8011c8df7 100644 --- a/test/publicFolder.js +++ b/test/publicFolder.js @@ -59,8 +59,8 @@ describe('Public Folder Tests', function () { .get('/HTMLTest') .expect(200, (err, res) => { if (err) { - assert.fail(err) testApp.send('stop') + assert.fail(err) } // if a 200 status, grab the favicon from the server @@ -68,8 +68,8 @@ describe('Public Folder Tests', function () { .get('/favicon.ico') .expect(200, (err, res) => { if (err) { - assert.fail(err) testApp.send('stop') + assert.fail(err) } // convert buffer to base64 const faviconData = res.body.toString('base64') @@ -109,8 +109,8 @@ describe('Public Folder Tests', function () { .get('/HTMLTest') .expect(200, (err, res) => { if (err) { - assert.fail(err) testApp.send('stop') + assert.fail(err) } // if we can get the page, send a request to get the favicon request('http://localhost:43711') @@ -160,8 +160,8 @@ describe('Public Folder Tests', function () { .get('/HTMLTest') .expect(200, (err, res) => { if (err) { - assert.fail(err) testApp.send('stop') + assert.fail(err) } // if we can get the page, send a request to get the favicon request('http://localhost:43711') diff --git a/test/sourceParams.js b/test/sourceParams.js index e2d114083..84d6e38b1 100644 --- a/test/sourceParams.js +++ b/test/sourceParams.js @@ -698,8 +698,7 @@ describe('sourceParams', () => { }) }) - // TODO: this feature is broken because of too many hardcoded checks for the default flags - // TODO: rewrite this test to not use cores becaues the cores feature was stripped + // TODO: this feature is broken because of too many hardcoded checks for the default flags; also rewrite this test to not use cores becaues the cores feature was stripped /* cut README content: diff --git a/test/util/appGenerator.js b/test/util/appGenerator.js index a800e79fb..ce514ff72 100644 --- a/test/util/appGenerator.js +++ b/test/util/appGenerator.js @@ -15,9 +15,6 @@ module.exports = params => { app.${params.method}()` // add a ipc listener for incrementing time with sinon - /* - * TODO: eliminate the need for this very silly way of appending this ipc listener - */ appTemplate += ` if (process.argv.includes('--hacky-sinon-timer')) { process.on('message', message => { diff --git a/test/viewEngine.js b/test/viewEngine.js index ace8f716a..657613463 100644 --- a/test/viewEngine.js +++ b/test/viewEngine.js @@ -52,8 +52,8 @@ describe('view engines', function () { .get('/teddyTest') .expect(200, (err, res) => { if (err) { - assert.fail(err) testApp.send('stop') + assert.fail(err) } // test that the values rendered on the page are correct const test1 = res.text.includes('Teddy Test') @@ -123,8 +123,8 @@ describe('view engines', function () { .get('/jcsTest') .expect(200, (err, res) => { if (err) { - assert.fail(err) testApp.send('stop') + assert.fail(err) } assert.strictEqual(res.text.includes('jcs Test'), true) assert.strictEqual(res.text.includes('jcsHeader'), true) @@ -231,8 +231,8 @@ describe('view engines', function () { .get('/teddyTest') .expect(200, (err, res) => { if (err) { - assert.fail(err) testApp.send('stop') + assert.fail(err) } // test the data rendered on the default teddy page const test1 = res.text.includes('Teddy Test')