wiki-server 0.26.0-rc.7 → 0.26.0-rc.9
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 +26 -4
- package/lib/server.js +29 -8
- package/package.json +3 -3
package/lib/page.js
CHANGED
|
@@ -22,16 +22,38 @@
|
|
|
22
22
|
|
|
23
23
|
import fs from 'node:fs'
|
|
24
24
|
import path from 'node:path'
|
|
25
|
-
import
|
|
25
|
+
import url from 'node:url'
|
|
26
26
|
import events from 'node:events'
|
|
27
27
|
|
|
28
28
|
import { createRequire } from 'node:module'
|
|
29
29
|
const require = createRequire(import.meta.url)
|
|
30
30
|
|
|
31
31
|
// Use dynamic import to load package.json from the main application's working directory
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const wikiPackageImport = async () => {
|
|
33
|
+
let done = false
|
|
34
|
+
return new Promise(resolve => {
|
|
35
|
+
import('wiki/package.json', { with: { type: 'json' } })
|
|
36
|
+
.then(imported => {
|
|
37
|
+
done = true
|
|
38
|
+
resolve(imported.default)
|
|
39
|
+
})
|
|
40
|
+
.catch(e => {
|
|
41
|
+
return e
|
|
42
|
+
})
|
|
43
|
+
.then(async () => {
|
|
44
|
+
if (done) return
|
|
45
|
+
const packageJsonPath = path.join(process.cwd(), 'package.json')
|
|
46
|
+
const packageJsonUrl = url.pathToFileURL(packageJsonPath).href
|
|
47
|
+
import(packageJsonUrl, { with: { type: 'json' } })
|
|
48
|
+
.then(imported => {
|
|
49
|
+
resolve(imported.default)
|
|
50
|
+
})
|
|
51
|
+
.catch(e => console.error('problems importing package', e))
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const packageJson = await wikiPackageImport()
|
|
35
57
|
|
|
36
58
|
// import random_id from './random_id.cjs'; // Uncomment if needed
|
|
37
59
|
import synopsis from 'wiki-client/lib/synopsis.js' // Add correct extension if necessary
|
package/lib/server.js
CHANGED
|
@@ -58,10 +58,33 @@ import { warn } from 'node:console'
|
|
|
58
58
|
import { createRequire } from 'module'
|
|
59
59
|
const require = createRequire(import.meta.url)
|
|
60
60
|
|
|
61
|
-
// Use
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
|
|
61
|
+
// Use import to load package.json from the main application's working directory
|
|
62
|
+
//const { default: packageJson } = await import('wiki/package.json', { with: { type: 'json' } })
|
|
63
|
+
const wikiPackageImport = async () => {
|
|
64
|
+
let done = false
|
|
65
|
+
return new Promise(resolve => {
|
|
66
|
+
import('wiki/package.json', { with: { type: 'json' } })
|
|
67
|
+
.then(imported => {
|
|
68
|
+
done = true
|
|
69
|
+
resolve(imported.default)
|
|
70
|
+
})
|
|
71
|
+
.catch(e => {
|
|
72
|
+
return e
|
|
73
|
+
})
|
|
74
|
+
.then(async () => {
|
|
75
|
+
if (done) return
|
|
76
|
+
const packageJsonPath = path.join(process.cwd(), 'package.json')
|
|
77
|
+
const packageJsonUrl = url.pathToFileURL(packageJsonPath).href
|
|
78
|
+
import(packageJsonUrl, { with: { type: 'json' } })
|
|
79
|
+
.then(imported => {
|
|
80
|
+
resolve(imported.default)
|
|
81
|
+
})
|
|
82
|
+
.catch(e => console.error('problems importing package', e))
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const packageJson = await wikiPackageImport()
|
|
65
88
|
|
|
66
89
|
const render = page => {
|
|
67
90
|
return (
|
|
@@ -703,10 +726,8 @@ export default async argv => {
|
|
|
703
726
|
const getPackageVersion = packageName => {
|
|
704
727
|
return new Promise(resolve => {
|
|
705
728
|
try {
|
|
706
|
-
// Use
|
|
707
|
-
|
|
708
|
-
const packageJsonUrl = url.pathToFileURL(packageJsonPath).href
|
|
709
|
-
import(packageJsonUrl, { with: { type: 'json' } }).then(({ default: packageJson }) => {
|
|
729
|
+
// Use import to load package.json from the main application's working directory
|
|
730
|
+
import(`${packageName}/package.json`, { with: { type: 'json' } }).then(({ default: packageJson }) => {
|
|
710
731
|
resolve({ [packageName]: packageJson.version })
|
|
711
732
|
})
|
|
712
733
|
} catch (error) {
|
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-rc.
|
|
4
|
+
"version": "0.26.0-rc.9",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Ward Cunningham",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
],
|
|
33
33
|
"main": "index.js",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"body-parser": "^2.2.
|
|
35
|
+
"body-parser": "^2.2.1",
|
|
36
36
|
"client-sessions": "^0.8.0",
|
|
37
37
|
"coffeescript": "^2.5.0",
|
|
38
38
|
"cookie-parser": "^1.4.4",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"eslint": "^9.39.1",
|
|
61
61
|
"globals": "^16.5.0",
|
|
62
62
|
"grunt-git-authors": "^3.2.0",
|
|
63
|
-
"prettier": "^3.
|
|
63
|
+
"prettier": "^3.7.3",
|
|
64
64
|
"supertest": "^7.1.4",
|
|
65
65
|
"wiki-client": "^0.31.6",
|
|
66
66
|
"wiki-plugin-activity": "0.7",
|