poops 1.9.0 → 1.9.2

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.
package/lib/markups.js CHANGED
@@ -222,7 +222,10 @@ export default class Markups {
222
222
  }
223
223
 
224
224
  markupDefaultExcludes.push('_*')
225
- markupDefaultExcludes = [...new Set(markupDefaultExcludes)]
225
+ // The excludes fill one extglob segment, so a path with a separator
226
+ // ('../node_modules' as a sass load path) makes the whole pattern match
227
+ // nothing — a silent zero-page build. Only bare names can exclude here.
228
+ markupDefaultExcludes = [...new Set(markupDefaultExcludes)].filter((p) => !/[\\/]/.test(p))
226
229
 
227
230
  return `!(${markupDefaultExcludes.join('|')})/**/*.+(${this.engine.markupExtensions})`
228
231
  }
package/lib/server.js CHANGED
@@ -63,16 +63,25 @@ export function parseRange(header, size) {
63
63
  }
64
64
 
65
65
  export function createStaticHandler(base) {
66
+ // Drop any trailing separator — `serve.base: "/"` resolves to `<cwd>/`, and the
67
+ // containment check below would then compare against `<cwd>//` and reject everything
68
+ base = path.resolve(base)
66
69
  const notFoundPage = path.join(base, '404.html')
67
70
 
68
71
  const notFound = (res) => {
69
72
  res.statusCode = 404
70
- if (pathExists(notFoundPage)) {
71
- res.setHeader('Content-Type', 'text/html; charset=utf-8')
72
- fs.createReadStream(notFoundPage).on('error', () => res.destroy()).pipe(res)
73
- } else {
74
- res.end('Not Found')
73
+ if (!pathExists(notFoundPage)) return res.end('Not Found')
74
+ res.setHeader('Content-Type', 'text/html; charset=utf-8')
75
+ // 404.html lives at the site root but is served at any depth — its relative
76
+ // asset paths would resolve against /a/ for /a/b, so pin them with <base>
77
+ let html
78
+ try {
79
+ html = fs.readFileSync(notFoundPage, 'utf8')
80
+ } catch {
81
+ return res.end('Not Found')
75
82
  }
83
+ if (!/<base[\s>]/i.test(html)) html = html.replace(/<head([^>]*)>/i, '<head$1><base href="/">')
84
+ res.end(html)
76
85
  }
77
86
 
78
87
  return (req, res) => {
@@ -100,7 +109,13 @@ export function createStaticHandler(base) {
100
109
  try {
101
110
  stat = fs.statSync(filePath)
102
111
  } catch {
103
- return notFound(res)
112
+ // GitHub Pages-style extensionless URLs: /a/b serves a/b.html, URL unchanged
113
+ try {
114
+ stat = fs.statSync(filePath + '.html')
115
+ filePath += '.html'
116
+ } catch {
117
+ return notFound(res)
118
+ }
104
119
  }
105
120
 
106
121
  if (stat.isDirectory()) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "poops",
3
3
  "description": "Straightforward, no-bullshit bundler for the web.",
4
- "version": "1.9.0",
4
+ "version": "1.9.2",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "poops.js",
@@ -80,6 +80,7 @@
80
80
  "eslint": "^9.39.3",
81
81
  "jest": "^30.2.0",
82
82
  "neostandard": "^0.12.2",
83
+ "poops-docs-theme": "^1.0.0",
83
84
  "postcss": "^8.5.8",
84
85
  "react": "^19.2.4",
85
86
  "react-dom": "^19.2.4",