@ditojs/server 2.38.0 → 2.39.0
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/package.json +11 -11
- package/src/controllers/AdminController.js +23 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.39.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Dito.js Server – Dito.js is a declarative and modern web framework, based on Objection.js, Koa.js and Vue.js",
|
|
6
6
|
"repository": "https://github.com/ditojs/dito/tree/master/packages/server",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"node >= 18"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@ditojs/admin": "^2.
|
|
29
|
-
"@ditojs/build": "^2.
|
|
30
|
-
"@ditojs/router": "^2.
|
|
31
|
-
"@ditojs/utils": "^2.
|
|
28
|
+
"@ditojs/admin": "^2.39.0",
|
|
29
|
+
"@ditojs/build": "^2.39.0",
|
|
30
|
+
"@ditojs/router": "^2.39.0",
|
|
31
|
+
"@ditojs/utils": "^2.39.0",
|
|
32
32
|
"@koa/cors": "^5.0.0",
|
|
33
33
|
"@koa/multer": "^3.0.2",
|
|
34
34
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"mime-types": "^2.1.35",
|
|
57
57
|
"multer": "^1.4.5-lts.1",
|
|
58
58
|
"multer-s3": "https://github.com/ditojs/multer-s3#dito",
|
|
59
|
-
"nanoid": "^5.0.
|
|
59
|
+
"nanoid": "^5.0.9",
|
|
60
60
|
"parse-duration": "^1.1.0",
|
|
61
61
|
"passport-local": "^1.0.0",
|
|
62
62
|
"passthrough-counter": "^1.0.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"pino-pretty": "^13.0.0",
|
|
67
67
|
"pluralize": "^8.0.0",
|
|
68
68
|
"repl": "^0.1.3",
|
|
69
|
-
"type-fest": "^4.
|
|
69
|
+
"type-fest": "^4.29.0",
|
|
70
70
|
"uuid": "^11.0.3"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
@@ -76,19 +76,19 @@
|
|
|
76
76
|
"objection": "^3.0.1"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@aws-sdk/client-s3": "^3.
|
|
80
|
-
"@aws-sdk/lib-storage": "^3.
|
|
79
|
+
"@aws-sdk/client-s3": "^3.701.0",
|
|
80
|
+
"@aws-sdk/lib-storage": "^3.701.0",
|
|
81
81
|
"@types/koa-bodyparser": "^4.3.12",
|
|
82
82
|
"@types/koa-compress": "^4.0.6",
|
|
83
83
|
"@types/koa-response-time": "^2.1.5",
|
|
84
84
|
"@types/koa-session": "^6.4.5",
|
|
85
85
|
"@types/koa-static": "^4.0.4",
|
|
86
86
|
"@types/koa__cors": "^5.0.0",
|
|
87
|
-
"@types/node": "^22.
|
|
87
|
+
"@types/node": "^22.10.0",
|
|
88
88
|
"knex": "^3.1.0",
|
|
89
89
|
"objection": "^3.1.5",
|
|
90
90
|
"typescript": "^5.7.2"
|
|
91
91
|
},
|
|
92
92
|
"types": "types",
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "8e08282d852341622dc3555f810e18aa9d2ac7ab"
|
|
94
94
|
}
|
|
@@ -115,22 +115,10 @@ export class AdminController extends Controller {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
async setupViteServer() {
|
|
118
|
-
const
|
|
119
|
-
(await this.app.loadAdminViteConfig()) ||
|
|
120
|
-
this.defineViteConfig()
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
const development = this.mode === 'development'
|
|
124
|
-
const server = await createServer({
|
|
125
|
-
...config,
|
|
118
|
+
const defaultConfig = {
|
|
126
119
|
server: {
|
|
127
120
|
middlewareMode: true,
|
|
128
|
-
|
|
129
|
-
// Use a random free port instead of vite's default 24678, since we
|
|
130
|
-
// may be running multiple servers in parallel (e.g. e2e and dev).
|
|
131
|
-
port: await getRandomFreePort()
|
|
132
|
-
},
|
|
133
|
-
...(development && {
|
|
121
|
+
...(this.mode === 'development' && {
|
|
134
122
|
watch: {
|
|
135
123
|
// Watch the @ditojs packages while in dev mode, although they are
|
|
136
124
|
// inside the node_modules folder.
|
|
@@ -138,7 +126,22 @@ export class AdminController extends Controller {
|
|
|
138
126
|
}
|
|
139
127
|
})
|
|
140
128
|
}
|
|
141
|
-
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const viteConfig = (
|
|
132
|
+
(await this.app.loadAdminViteConfig()) ||
|
|
133
|
+
this.defineViteConfig()
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
const config = assignDeeply(defaultConfig, viteConfig)
|
|
137
|
+
|
|
138
|
+
if (config.server?.hmr?.port === 0) {
|
|
139
|
+
// Setting the port to 0 means use a random free port instead of vite's
|
|
140
|
+
// default 24678, since we may be running multiple servers in parallel.
|
|
141
|
+
config.server.hmr.port = await getRandomFreePort()
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const server = await createServer(config)
|
|
142
145
|
|
|
143
146
|
this.closed = false
|
|
144
147
|
|
|
@@ -159,7 +162,7 @@ export class AdminController extends Controller {
|
|
|
159
162
|
}
|
|
160
163
|
|
|
161
164
|
defineViteConfig(config = {}) {
|
|
162
|
-
const
|
|
165
|
+
const isDevelopment = this.mode === 'development'
|
|
163
166
|
|
|
164
167
|
const cwd = process.cwd()
|
|
165
168
|
const root = this.getPath('root')
|
|
@@ -193,7 +196,7 @@ export class AdminController extends Controller {
|
|
|
193
196
|
}
|
|
194
197
|
}
|
|
195
198
|
],
|
|
196
|
-
build:
|
|
199
|
+
build: isDevelopment
|
|
197
200
|
? {}
|
|
198
201
|
: {
|
|
199
202
|
outDir: this.getPath('dist'),
|
|
@@ -226,7 +229,7 @@ export class AdminController extends Controller {
|
|
|
226
229
|
},
|
|
227
230
|
css: {
|
|
228
231
|
postcss: getPostCssConfig(),
|
|
229
|
-
devSourcemap:
|
|
232
|
+
devSourcemap: isDevelopment,
|
|
230
233
|
preprocessorOptions: {
|
|
231
234
|
scss: {
|
|
232
235
|
// https://sass-lang.com/documentation/breaking-changes/legacy-js-api/
|
|
@@ -236,10 +239,10 @@ export class AdminController extends Controller {
|
|
|
236
239
|
}
|
|
237
240
|
},
|
|
238
241
|
optimizeDeps: {
|
|
239
|
-
exclude:
|
|
242
|
+
exclude: isDevelopment ? ditoPackages : [],
|
|
240
243
|
include: [
|
|
241
244
|
...(
|
|
242
|
-
|
|
245
|
+
isDevelopment
|
|
243
246
|
? // https://discuss.prosemirror.net/t/rangeerror-adding-different-instances-of-a-keyed-plugin-plugin/4242/13
|
|
244
247
|
[
|
|
245
248
|
'prosemirror-state',
|