@ditojs/server 1.29.0 → 2.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditojs/server",
3
- "version": "1.29.0",
3
+ "version": "2.0.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",
@@ -22,13 +22,15 @@
22
22
  "node >= 18"
23
23
  ],
24
24
  "dependencies": {
25
- "@ditojs/admin": "^1.29.0",
26
- "@ditojs/build": "^1.29.0",
27
- "@ditojs/router": "^1.29.0",
28
- "@ditojs/utils": "^1.29.0",
25
+ "@ditojs/admin": "^2.0.0",
26
+ "@ditojs/build": "^2.0.0",
27
+ "@ditojs/router": "^2.0.0",
28
+ "@ditojs/utils": "^2.0.0",
29
29
  "@koa/cors": "^4.0.0",
30
30
  "@koa/multer": "^3.0.2",
31
31
  "@originjs/vite-plugin-commonjs": "^1.0.3",
32
+ "@vitejs/plugin-vue": "^4.1.0",
33
+ "@vue/compiler-sfc": "^3.2.47",
32
34
  "ajv": "^8.12.0",
33
35
  "ajv-formats": "^2.1.1",
34
36
  "bcryptjs": "^2.4.3",
@@ -64,9 +66,7 @@
64
66
  "repl": "^0.1.3",
65
67
  "uuid": "^9.0.0",
66
68
  "vite": "^4.2.1",
67
- "vite-plugin-vue2": "^2.0.3",
68
- "vue": "^2.7.14",
69
- "vue-template-compiler": "^2.7.14"
69
+ "vue": "^3.2.47"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@aws-sdk/client-s3": "^3.0.0",
@@ -90,7 +90,7 @@
90
90
  "typescript": "^5.0.2"
91
91
  },
92
92
  "types": "types",
93
- "gitHead": "6e93fe59126eab3d5ee1961d9e03f0fbdc297fba",
93
+ "gitHead": "dde9462e778bce37bc4fa3e47127a9ba12a4d5e2",
94
94
  "scripts": {
95
95
  "types": "tsc --noEmit ./src/index.d.ts"
96
96
  },
@@ -819,12 +819,13 @@ export class Application extends Koa {
819
819
  addedFiles.length > 0 ||
820
820
  removedFiles.length > 0
821
821
  ) {
822
- const changeCount = (files, increment) => (
823
- files.length > 0 &&
824
- AssetModel.query(trx)
825
- .whereIn('key', files.map(file => file.key))
826
- .increment('count', increment)
827
- )
822
+ const changeCount = async (files, increment) => {
823
+ if (files.length > 0) {
824
+ await AssetModel.query(trx)
825
+ .whereIn('key', files.map(file => file.key))
826
+ .increment('count', increment)
827
+ }
828
+ }
828
829
  await Promise.all([
829
830
  changeCount(addedFiles, 1),
830
831
  changeCount(removedFiles, -1)
package/src/cli/index.js CHANGED
@@ -18,9 +18,9 @@ function getCommand(commands, parts) {
18
18
  }
19
19
 
20
20
  function setSilent(silent) {
21
- const oldValue = process.env.DITO_SILENT
21
+ const wasSilent = process.env.DITO_SILENT
22
22
  process.env.DITO_SILENT = silent
23
- return oldValue
23
+ return wasSilent
24
24
  }
25
25
 
26
26
  async function execute() {
@@ -2,15 +2,11 @@ import path from 'path'
2
2
  import Koa from 'koa'
3
3
  import serve from 'koa-static'
4
4
  import { defineConfig, createServer } from 'vite'
5
- import { createVuePlugin } from 'vite-plugin-vue2'
5
+ import createVuePlugin from '@vitejs/plugin-vue'
6
6
  import {
7
7
  viteCommonjs as createCommonJsPlugin
8
8
  } from '@originjs/vite-plugin-commonjs'
9
- import {
10
- createRollupImportsResolver,
11
- testModuleIdentifier,
12
- getPostCssConfig
13
- } from '@ditojs/build'
9
+ import { testModuleIdentifier, getPostCssConfig } from '@ditojs/build'
14
10
  import { merge } from '@ditojs/utils'
15
11
  import { Controller } from './Controller.js'
16
12
  import { handleConnectMiddleware } from '../middleware/index.js'
@@ -210,7 +206,9 @@ export class AdminController extends Controller {
210
206
  } else if (id.startsWith(cwd)) {
211
207
  return 'common'
212
208
  } else {
213
- const module = id.match(/node_modules\/([^/$]*)/)?.[1] || ''
209
+ const module = (
210
+ id.match(/node_modules\/((?:@[^/]*\/)?[^/$]*)/)?.[1] || ''
211
+ )
214
212
  return testModuleIdentifier(module, coreDependencies)
215
213
  ? 'core'
216
214
  : 'vendor'
@@ -226,7 +224,16 @@ export class AdminController extends Controller {
226
224
  optimizeDeps: {
227
225
  exclude: development ? ditoPackages : [],
228
226
  include: [
229
- ...(development ? [] : ditoPackages),
227
+ ...(development
228
+ // https://discuss.prosemirror.net/t/rangeerror-adding-different-instances-of-a-keyed-plugin-plugin/4242/13
229
+ ? [
230
+ 'prosemirror-state',
231
+ 'prosemirror-transform',
232
+ 'prosemirror-model',
233
+ 'prosemirror-view'
234
+ ]
235
+ : ditoPackages
236
+ ),
230
237
  ...nonEsmDependencies
231
238
  ]
232
239
  },
@@ -237,8 +244,7 @@ export class AdminController extends Controller {
237
244
  {
238
245
  find: '@',
239
246
  replacement: root
240
- },
241
- createRollupImportsResolver({ cwd: root })
247
+ }
242
248
  ]
243
249
  }
244
250
  }, config))
@@ -254,11 +260,7 @@ const ditoPackages = [
254
260
  const nonEsmDependencies = [
255
261
  // All non-es modules need to be explicitly included here, and some of
256
262
  // them only work due to the use of `createCommonJsPlugin()`.
257
- 'vue-color',
258
- 'vue-js-modal',
259
- 'vue-multiselect',
260
- 'vue-notification',
261
- 'lowlight'
263
+ '@lk77/vue3-color'
262
264
  ]
263
265
 
264
266
  const coreDependencies = [
@@ -270,29 +272,21 @@ const coreDependencies = [
270
272
  // a json file?
271
273
 
272
274
  'vue',
273
- 'vue-color',
274
- 'vue-js-modal',
275
+ '@lk77/vue3-color',
276
+ '@kyvg/vue3-notification',
275
277
  'vue-multiselect',
276
- 'vue-notification',
277
278
  'vue-router',
278
279
  'vue-upload-component',
279
- 'vuedraggable',
280
-
281
- 'core-js',
282
- 'lowlight',
280
+ 'tinycolor2',
281
+ 'sortablejs-vue3',
283
282
  'sortablejs',
284
- 'tiptap',
285
- 'tiptap-*',
286
- 'tslib',
283
+ '@tiptap/*',
287
284
  'prosemirror-*',
288
285
  'codeflask',
289
286
  'rope-sequence',
290
- 'tinycolor2',
291
- 'fault',
292
287
  'filesize',
293
288
  'filesize-parser',
294
- 'format',
295
- 'highlight.js',
289
+ 'tslib',
296
290
  'orderedmap',
297
291
  'w3c-keyname'
298
292
  ]
package/types/index.d.ts CHANGED
@@ -1571,6 +1571,7 @@ export class QueryBuilder<
1571
1571
  SingleQueryBuilderType: QueryBuilder<M, M>
1572
1572
  NumberQueryBuilderType: QueryBuilder<M, number>
1573
1573
  PageQueryBuilderType: QueryBuilder<M, objection.Page<M>>
1574
+ MaybeSingleQueryBuilderType: QueryBuilder<M, M | undefined>
1574
1575
  }
1575
1576
  export interface QueryBuilder<M extends Model, R = M[]> extends KnexHelper {}
1576
1577