wiki-server 0.26.0 → 0.26.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/page.js CHANGED
@@ -76,19 +76,22 @@ export default argv => {
76
76
  // create a list of plugin pages.
77
77
  const pluginPages = new Map()
78
78
 
79
- Object.keys(packageJson.dependencies)
80
- .filter(depend => depend.startsWith('wiki-plugin'))
81
- .forEach(plugin => {
82
- const pagesPath = path.join(path.dirname(require.resolve(`${plugin}/package`)), 'pages')
83
- fs.readdir(pagesPath, { withFileTypes: true }, (err, entries) => {
84
- if (err) return
85
- entries.forEach(entry => {
86
- if (entry.isFile() && !pluginPages.has(entry.name)) {
87
- pluginPages.set(entry.name, { pluginName: plugin, pluginPath: entry.parentPath })
88
- }
89
- })
79
+ const dependencyPlugins = Object.keys(packageJson.dependencies).filter(depend => depend.startsWith('wiki-plugin'))
80
+ const plugins = dependencyPlugins.length
81
+ ? dependencyPlugins
82
+ : Object.keys(packageJson.devDependencies).filter(depend => depend.startsWith('wiki-plugin'))
83
+
84
+ plugins.forEach(plugin => {
85
+ const pagesPath = path.join(path.dirname(require.resolve(`${plugin}/package`)), 'pages')
86
+ fs.readdir(pagesPath, { withFileTypes: true }, (err, entries) => {
87
+ if (err) return
88
+ entries.forEach(entry => {
89
+ if (entry.isFile() && !pluginPages.has(entry.name)) {
90
+ pluginPages.set(entry.name, { pluginName: plugin, pluginPath: entry.parentPath })
91
+ }
90
92
  })
91
93
  })
94
+ })
92
95
 
93
96
  // #### Private utility methods. ####
94
97
  const load_parse = (loc, cb, annotations = {}) => {
package/lib/server.js CHANGED
@@ -256,10 +256,22 @@ export default async argv => {
256
256
 
257
257
  // use logger, at least in development, probably needs a param to configure (or turn off).
258
258
  // use stream to direct to somewhere other than stdout.
259
- logger.token('vhost', (req, res) => {
260
- return colorString(wikiName)
261
- })
262
- app.use(logger(':vhost :method :url :status :res[content-length] - :response-time ms'))
259
+ const vhost = colorString(wikiName)
260
+ app.use(
261
+ logger((tokens, req, res) => {
262
+ return [
263
+ vhost,
264
+ tokens.method(req, res),
265
+ tokens.url(req, res),
266
+ tokens.status(req, res),
267
+ tokens.res(req, res, 'content-length'),
268
+ '-',
269
+ tokens['response-time'](req, res),
270
+ 'ms',
271
+ ].join(' ')
272
+ }),
273
+ )
274
+
263
275
  app.use(cookieParser())
264
276
  app.use(bodyParser.json({ limit: argv.uploadLimit }))
265
277
  app.use(bodyParser.urlencoded({ extended: true, limit: argv.uploadLimit }))
@@ -437,12 +449,17 @@ export default async argv => {
437
449
  })
438
450
  }
439
451
 
452
+ // in test (wiki-server) the plugins are listed as devDependencues, so we need to fallback to
453
+ // using devDEpendencies when there are no plugins in dependencies.
454
+ const dependencyPlugins = Object.keys(packageJson.dependencies).filter(depend => depend.startsWith('wiki-plugin'))
455
+ const plugins = dependencyPlugins.length
456
+ ? dependencyPlugins
457
+ : Object.keys(packageJson.devDependencies).filter(depend => depend.startsWith('wiki-plugin'))
458
+
440
459
  Promise.all(
441
- Object.keys(packageJson.dependencies)
442
- .filter(depend => depend.startsWith('wiki-plugin'))
443
- .map(plugin => {
444
- return getPackageFactory(plugin)
445
- }),
460
+ plugins.map(plugin => {
461
+ return getPackageFactory(plugin)
462
+ }),
446
463
  ).then(() => res.end(JSON.stringify(factories)))
447
464
  })
448
465
 
@@ -623,14 +640,21 @@ export default async argv => {
623
640
 
624
641
  // Returns a list of installed plugins. (does this get called anymore!)
625
642
  app.get('/system/plugins.json', cors, (req, res) => {
643
+ // create a list of plugin pages.
626
644
  try {
627
- const pluginNames = Object.keys(require.main.require('./package').dependencies)
628
- .filter(depend => depend.startsWith('wiki-plugin'))
629
- .map(name => name.slice(12))
645
+ const dependencyPlugins = Object.keys(packageJson.dependencies).filter(depend => depend.startsWith('wiki-plugin'))
646
+ const plugins = dependencyPlugins.length
647
+ ? dependencyPlugins
648
+ : Object.keys(packageJson.devDependencies).filter(depend => depend.startsWith('wiki-plugin'))
649
+ const pluginNames = plugins.map(name => name.slice(12))
630
650
  res.send(pluginNames)
631
651
  } catch (e) {
632
652
  return res.e(e)
633
653
  }
654
+ // Object.keys(packageJson.dependencies)
655
+ // .filter(depend => depend.startsWith('wiki-plugin'))
656
+ // .map(name => name.slice(12))
657
+ // .then(names => res.send(names))
634
658
  })
635
659
  //{
636
660
  const sitemapLoc = path.join(argv.status, 'sitemap.json')
package/lib/sitemap.js CHANGED
@@ -233,7 +233,7 @@ export default argv => {
233
233
  itself.emit('finished')
234
234
  }
235
235
  itself.isWorking = () => {
236
- working
236
+ return working
237
237
  }
238
238
 
239
239
  itself.createSitemap = pagehandler => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wiki-server",
3
3
  "description": "A Federated Wiki Server",
4
- "version": "0.26.0",
4
+ "version": "0.26.2",
5
5
  "type": "module",
6
6
  "author": {
7
7
  "name": "Ward Cunningham",
@@ -34,14 +34,13 @@
34
34
  "dependencies": {
35
35
  "body-parser": "^2.2.1",
36
36
  "client-sessions": "^0.8.0",
37
- "coffeescript": "^2.5.0",
38
37
  "cookie-parser": "^1.4.4",
39
38
  "dompurify": "^3.3.0",
40
39
  "errorhandler": "^1.5.1",
41
40
  "express": "^5.1.0",
42
41
  "express-hbs": "^2.5.0",
43
42
  "flates": "0.0.5",
44
- "jsdom": "^27.2.0",
43
+ "jsdom": "^28.1.0",
45
44
  "method-override": "^3.0.0",
46
45
  "minisearch": "^7.2.0",
47
46
  "morgan": "^1.10.1",
@@ -51,14 +50,14 @@
51
50
  "scripts": {
52
51
  "prettier:format": "prettier --write './**/*.js'",
53
52
  "prettier:check": "prettier --check ./**/*.js",
54
- "test": "cd test; node --test",
55
- "watch": "cd test; node --test --watch",
53
+ "test": "node --test",
54
+ "watch": "node --test --watch",
56
55
  "update-authors": "node scripts/update-authors.js"
57
56
  },
58
57
  "devDependencies": {
59
- "@eslint/js": "^9.39.1",
60
- "eslint": "^9.39.1",
61
- "globals": "^16.5.0",
58
+ "@eslint/js": "^10.0.1",
59
+ "eslint": "^10.0.0",
60
+ "globals": "^17.3.0",
62
61
  "grunt-git-authors": "^3.2.0",
63
62
  "prettier": "^3.7.3",
64
63
  "supertest": "^7.1.4",