@ossy/platform 1.15.2 → 1.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/server.js +12 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ossy/platform",
3
- "version": "1.15.2",
3
+ "version": "1.15.3",
4
4
  "description": "Ossy application server runtime",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,8 +22,8 @@
22
22
  "author": "Ossy <yourfriends@ossy.se> (https://ossy.se)",
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "@ossy/router": "^1.16.2",
26
- "@ossy/sdk": "^1.16.2",
25
+ "@ossy/router": "^1.16.3",
26
+ "@ossy/sdk": "^1.16.3",
27
27
  "cookie-parser": "^1.4.7",
28
28
  "dotenv": ">=16.0.0 <17.0.0",
29
29
  "express": ">=5.0.0 <6.0.0",
@@ -32,5 +32,5 @@
32
32
  "files": [
33
33
  "src"
34
34
  ],
35
- "gitHead": "00aca40bd8fcf8510c4a854cb388a780ddb751f7"
35
+ "gitHead": "57ef30cf0b510dfb09b5b964cff3d847b9825360"
36
36
  }
package/src/server.js CHANGED
@@ -34,9 +34,19 @@ function loadManifest (buildDir) {
34
34
  // The manifest is a flat `entries` array discriminated by `type`. Bucket
35
35
  // them once at boot so the per-request hot path stays a simple lookup.
36
36
  const entries = Array.isArray(manifest.entries) ? manifest.entries : []
37
- const pages = entries.filter((e) => e.type === 'page')
38
- const apis = entries.filter((e) => e.type === 'api')
37
+ // OssyRouter does `Object.entries(page.path)` on each route at lookup time,
38
+ // so a single malformed entry (missing `path`) crashes every request. The
39
+ // build is supposed to reject these — this is belt-and-suspenders for older
40
+ // builds and any future loosening of the build-time check.
41
+ const validRoutable = (e) => e.path !== undefined && e.path !== null
42
+ const pages = entries.filter((e) => e.type === 'page' && validRoutable(e))
43
+ const apis = entries.filter((e) => e.type === 'api' && validRoutable(e))
39
44
  const tasks = entries.filter((e) => e.type === 'task')
45
+ for (const e of entries) {
46
+ if ((e.type === 'page' || e.type === 'api') && !validRoutable(e)) {
47
+ console.warn(`[@ossy/platform][server] Skipping ${e.type} "${e.id}" — manifest entry has no path.`)
48
+ }
49
+ }
40
50
  return {
41
51
  entries,
42
52
  pages,