dtwo 3.2.0 → 3.2.1
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/LICENSE +21 -21
- package/app.d.ts +1 -1
- package/bin/dtwo.mjs +2 -2
- package/config.cjs +7 -7
- package/config.d.ts +2 -2
- package/config.mjs +5 -5
- package/dist/app/components/client-only.mjs +75 -75
- package/dist/app/components/dev-only.mjs +11 -11
- package/dist/app/components/dtwo-error-page.kdu +46 -46
- package/dist/app/components/dtwo-loading-indicator.mjs +4 -2
- package/dist/app/components/dtwo-root.kdu +2 -2
- package/dist/app/composables/error.d.ts +1 -1
- package/dist/app/composables/payload.mjs +4 -4
- package/dist/app/composables/router.mjs +1 -1
- package/dist/app/config.d.ts +1 -1
- package/dist/app/dtwo.d.ts +5 -2
- package/dist/app/dtwo.mjs +5 -0
- package/dist/app/plugins/chunk-reload.client.d.ts +2 -0
- package/dist/app/plugins/chunk-reload.client.mjs +26 -0
- package/dist/app/plugins/router.mjs +1 -2
- package/dist/app/types/augments.d.ts +28 -28
- package/dist/core/runtime/hole/renderer.mjs +6 -2
- package/dist/head/runtime/composables.d.ts +1 -1
- package/dist/head/runtime/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +9081 -294
- package/dist/pages/runtime/app.kdu +5 -5
- package/dist/pages/runtime/plugins/router.mjs +1 -1
- package/dist/pages/runtime/validate.mjs +23 -2
- package/package.json +27 -22
- package/schema.d.ts +1 -0
- package/schema.mjs +1 -0
- package/types.d.ts +1 -1
- package/README.md +0 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<DtwoLayout>
|
|
3
|
-
<DtwoPage />
|
|
4
|
-
</DtwoLayout>
|
|
5
|
-
</template>
|
|
1
|
+
<template>
|
|
2
|
+
<DtwoLayout>
|
|
3
|
+
<DtwoPage />
|
|
4
|
+
</DtwoLayout>
|
|
5
|
+
</template>
|
|
@@ -136,7 +136,7 @@ export default defineDtwoPlugin(async (dtwoApp) => {
|
|
|
136
136
|
})]);
|
|
137
137
|
} else if (process.server) {
|
|
138
138
|
const currentURL = to.fullPath || "/";
|
|
139
|
-
if (!isEqual(currentURL, initialURL)) {
|
|
139
|
+
if (!isEqual(currentURL, initialURL, { trailingSlash: true })) {
|
|
140
140
|
const event = await callWithDtwo(dtwoApp, useRequestEvent);
|
|
141
141
|
const options = { redirectCode: event.node.res.statusCode !== 200 ? event.node.res.statusCode || 302 : 302 };
|
|
142
142
|
await callWithDtwo(dtwoApp, navigateTo, [currentURL, options]);
|
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createError, showError } from "#app/composables/error";
|
|
2
|
+
import { callWithDtwo, useDtwoApp } from "#app/dtwo";
|
|
3
|
+
import { defineDtwoRouteMiddleware, useRouter } from "#app/composables/router";
|
|
2
4
|
export default defineDtwoRouteMiddleware(async (to) => {
|
|
3
5
|
if (!to.meta?.validate) {
|
|
4
6
|
return;
|
|
5
7
|
}
|
|
8
|
+
const dtwoApp = useDtwoApp();
|
|
9
|
+
const router = useRouter();
|
|
6
10
|
const result = await Promise.resolve(to.meta.validate(to));
|
|
7
11
|
if (result === true) {
|
|
8
12
|
return;
|
|
9
13
|
}
|
|
10
|
-
|
|
14
|
+
if (process.server) {
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
const error = createError({
|
|
18
|
+
statusCode: 404,
|
|
19
|
+
statusMessage: `Page Not Found: ${to.fullPath}`
|
|
20
|
+
});
|
|
21
|
+
const unsub = router.beforeResolve((final) => {
|
|
22
|
+
unsub();
|
|
23
|
+
if (final === to) {
|
|
24
|
+
const unsub2 = router.afterEach(async () => {
|
|
25
|
+
unsub2();
|
|
26
|
+
await callWithDtwo(dtwoApp, showError, [error]);
|
|
27
|
+
window.history.pushState({}, "", to.fullPath);
|
|
28
|
+
});
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
11
32
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtwo",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"repository": "d2js/dtwo",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"import": "./config.mjs",
|
|
18
18
|
"require": "./config.cjs"
|
|
19
19
|
},
|
|
20
|
+
"./schema": {
|
|
21
|
+
"types": "./schema.d.ts",
|
|
22
|
+
"import": "./schema.mjs"
|
|
23
|
+
},
|
|
20
24
|
"./app": "./dist/app/index.mjs",
|
|
21
25
|
"./package.json": "./package.json"
|
|
22
26
|
},
|
|
@@ -30,52 +34,53 @@
|
|
|
30
34
|
"bin",
|
|
31
35
|
"types.d.ts",
|
|
32
36
|
"dist",
|
|
33
|
-
"config.*"
|
|
37
|
+
"config.*",
|
|
38
|
+
"schema.*"
|
|
34
39
|
],
|
|
35
40
|
"dependencies": {
|
|
36
41
|
"@d2js/devalue": "2.0.2",
|
|
37
|
-
"@dtwo/kit": "3.2.
|
|
38
|
-
"@dtwo/schema": "3.2.
|
|
39
|
-
"@dtwo/telemetry": "2.1.
|
|
42
|
+
"@dtwo/kit": "3.2.1",
|
|
43
|
+
"@dtwo/schema": "3.2.1",
|
|
44
|
+
"@dtwo/telemetry": "2.1.10",
|
|
40
45
|
"@dtwo/ui-templates": "1.1.1",
|
|
41
|
-
"@dtwo/unplugin": "1.
|
|
42
|
-
"@dtwo/
|
|
43
|
-
"@kdhead/ssr": "1.
|
|
46
|
+
"@dtwo/unplugin": "1.4.0",
|
|
47
|
+
"@dtwo/lahm-builder": "3.2.1",
|
|
48
|
+
"@kdhead/ssr": "1.8.10",
|
|
44
49
|
"@kdujs/reactivity": "3.2.48",
|
|
45
50
|
"@kdujs/shared": "3.2.48",
|
|
46
|
-
"@kduse/head": "1.
|
|
51
|
+
"@kduse/head": "1.3.1-1",
|
|
47
52
|
"chokidar": "3.5.3",
|
|
48
53
|
"cookie-es": "0.5.0",
|
|
49
54
|
"defu": "6.1.2",
|
|
50
55
|
"destr": "1.2.2",
|
|
51
|
-
"dtwc": "3.2.
|
|
56
|
+
"dtwc": "3.2.1",
|
|
52
57
|
"escape-string-regexp": "5.0.0",
|
|
53
58
|
"estree-walker": "3.0.3",
|
|
54
59
|
"fs-extra": "11.1.0",
|
|
55
60
|
"globby": "13.1.3",
|
|
56
|
-
"h3": "1.
|
|
61
|
+
"h3": "1.5.0",
|
|
57
62
|
"hash-sum": "2.0.0",
|
|
58
|
-
"holepack": "2.2.
|
|
63
|
+
"holepack": "2.2.2",
|
|
59
64
|
"hookable": "5.4.2",
|
|
60
|
-
"jiti": "1.17.
|
|
61
|
-
"kdhead": "1.
|
|
65
|
+
"jiti": "1.17.1",
|
|
66
|
+
"kdhead": "1.8.10",
|
|
62
67
|
"kdimport": "2.2.4",
|
|
63
68
|
"kdu": "3.2.48",
|
|
64
|
-
"kdu-bundle-renderer": "1.0.1",
|
|
69
|
+
"kdu-bundle-renderer": "1.0.2-1",
|
|
65
70
|
"kdu-devtools-stub": "0.1.0",
|
|
66
71
|
"kdu-router": "4.1.6",
|
|
67
72
|
"knitwork": "1.0.0",
|
|
68
|
-
"magic-string": "0.
|
|
69
|
-
"mlly": "1.1.
|
|
70
|
-
"ofetch": "1.0.
|
|
73
|
+
"magic-string": "0.29.0",
|
|
74
|
+
"mlly": "1.1.1",
|
|
75
|
+
"ofetch": "1.0.1",
|
|
71
76
|
"ohash": "1.0.0",
|
|
72
77
|
"pathe": "1.1.0",
|
|
73
78
|
"perfect-debounce": "0.1.3",
|
|
74
79
|
"scule": "1.0.0",
|
|
75
80
|
"strip-literal": "1.0.1",
|
|
76
|
-
"ufo": "1.0
|
|
77
|
-
"unctx": "2.1.
|
|
78
|
-
"unenv": "1.
|
|
81
|
+
"ufo": "1.1.0",
|
|
82
|
+
"unctx": "2.1.2",
|
|
83
|
+
"unenv": "1.2.0",
|
|
79
84
|
"untyped": "1.2.2"
|
|
80
85
|
},
|
|
81
86
|
"devDependencies": {
|
|
@@ -84,7 +89,7 @@
|
|
|
84
89
|
"unbuild": "1.1.1"
|
|
85
90
|
},
|
|
86
91
|
"engines": {
|
|
87
|
-
"node": "^14.
|
|
92
|
+
"node": "^14.18.0 || ^16.10.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
88
93
|
},
|
|
89
94
|
"scripts": {}
|
|
90
95
|
}
|
package/schema.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@dtwo/schema'
|
package/schema.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@dtwo/schema'
|
package/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="holepack" />
|
|
2
2
|
export * from './dist/index'
|
|
3
3
|
|
|
4
|
-
import type { SchemaDefinition } from '
|
|
4
|
+
import type { SchemaDefinition } from 'dtwo/schema'
|
|
5
5
|
|
|
6
6
|
declare global {
|
|
7
7
|
const defineDtwoConfig: typeof import('dtwo/config')['defineDtwoConfig']
|