dtwo 3.1.2 → 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-boundary.mjs +1 -1
- package/dist/app/components/dtwo-error-page.kdu +46 -46
- package/dist/app/components/dtwo-island.mjs +3 -1
- package/dist/app/components/dtwo-loading-indicator.mjs +5 -3
- package/dist/app/components/dtwo-root.kdu +5 -3
- package/dist/app/components/island-renderer.mjs +1 -1
- package/dist/app/components/layout.mjs +1 -1
- package/dist/app/composables/component.mjs +1 -1
- package/dist/app/composables/error.d.ts +1 -1
- package/dist/app/composables/fetch.d.ts +7 -6
- package/dist/app/composables/fetch.mjs +7 -1
- package/dist/app/composables/head.d.ts +2 -0
- package/dist/app/composables/head.mjs +1 -0
- package/dist/app/composables/index.d.ts +3 -1
- package/dist/app/composables/index.mjs +2 -1
- package/dist/app/composables/payload.mjs +6 -6
- package/dist/app/composables/preload.mjs +1 -1
- package/dist/app/composables/router.mjs +1 -1
- package/dist/app/composables/ssr.d.ts +1 -0
- package/dist/app/composables/ssr.mjs +7 -0
- 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/entry-spa.d.ts +2 -0
- package/dist/app/entry-spa.mjs +2 -0
- package/dist/app/entry.mjs +1 -1
- package/dist/app/index.d.ts +0 -2
- package/dist/app/index.mjs +0 -1
- 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/cross-origin-prefetch.client.mjs +2 -1
- package/dist/app/plugins/debug.mjs +1 -1
- package/dist/app/plugins/payload.client.mjs +3 -1
- package/dist/app/plugins/preload.server.mjs +1 -1
- package/dist/app/plugins/router.d.ts +1 -1
- package/dist/app/plugins/router.mjs +5 -2
- package/dist/app/types/augments.d.ts +28 -28
- package/dist/components/runtime/server-component.mjs +4 -1
- package/dist/core/runtime/hole/renderer.mjs +6 -2
- package/dist/head/runtime/composables.d.ts +1 -1
- package/dist/head/runtime/composables.mjs +1 -1
- package/dist/head/runtime/index.d.ts +1 -1
- package/dist/head/runtime/lib/kduse-head.plugin.mjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +9173 -271
- package/dist/pages/runtime/app.kdu +5 -5
- package/dist/pages/runtime/page.mjs +1 -1
- package/dist/pages/runtime/plugins/prefetch.client.mjs +2 -1
- package/dist/pages/runtime/plugins/router.mjs +6 -2
- package/dist/pages/runtime/router.options.mjs +1 -1
- package/dist/pages/runtime/validate.mjs +23 -2
- package/package.json +31 -27
- 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>
|
|
@@ -2,7 +2,7 @@ import { computed, defineComponent, h, provide, reactive, onMounted, nextTick, S
|
|
|
2
2
|
import { RouterView } from "kdu-router";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { generateRouteKey, wrapInKeepAlive } from "./utils.mjs";
|
|
5
|
-
import { useDtwoApp } from "#app";
|
|
5
|
+
import { useDtwoApp } from "#app/dtwo";
|
|
6
6
|
import { _wrapIf } from "#app/components/utils";
|
|
7
7
|
import { appPageTransition as defaultPageTransition, appKeepalive as defaultKeepaliveConfig } from "#build/dtwo.config.mjs";
|
|
8
8
|
export default defineComponent({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { hasProtocol } from "ufo";
|
|
2
|
-
import { defineDtwoPlugin, useDtwoApp
|
|
2
|
+
import { defineDtwoPlugin, useDtwoApp } from "#app/dtwo";
|
|
3
|
+
import { useRouter } from "#app/composables/router";
|
|
3
4
|
import layouts from "#build/layouts";
|
|
4
5
|
import { namedMiddleware } from "#build/middleware";
|
|
5
6
|
export default defineDtwoPlugin(() => {
|
|
@@ -7,7 +7,11 @@ import {
|
|
|
7
7
|
} from "kdu-router";
|
|
8
8
|
import { createError } from "h3";
|
|
9
9
|
import { withoutBase, isEqual } from "ufo";
|
|
10
|
-
import { callWithDtwo, defineDtwoPlugin, useRuntimeConfig
|
|
10
|
+
import { callWithDtwo, defineDtwoPlugin, useRuntimeConfig } from "#app/dtwo";
|
|
11
|
+
import { showError, clearError, useError } from "#app/composables/error";
|
|
12
|
+
import { useRequestEvent } from "#app/composables/ssr";
|
|
13
|
+
import { useState } from "#app/composables/state";
|
|
14
|
+
import { navigateTo } from "#app/composables/router";
|
|
11
15
|
import _routes from "#build/routes";
|
|
12
16
|
import routerOptions from "#build/router.options";
|
|
13
17
|
import { globalMiddleware, namedMiddleware } from "#build/middleware";
|
|
@@ -132,7 +136,7 @@ export default defineDtwoPlugin(async (dtwoApp) => {
|
|
|
132
136
|
})]);
|
|
133
137
|
} else if (process.server) {
|
|
134
138
|
const currentURL = to.fullPath || "/";
|
|
135
|
-
if (!isEqual(currentURL, initialURL)) {
|
|
139
|
+
if (!isEqual(currentURL, initialURL, { trailingSlash: true })) {
|
|
136
140
|
const event = await callWithDtwo(dtwoApp, useRequestEvent);
|
|
137
141
|
const options = { redirectCode: event.node.res.statusCode !== 200 ? event.node.res.statusCode || 302 : 302 };
|
|
138
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.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"repository": "d2js/dtwo",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -13,9 +13,13 @@
|
|
|
13
13
|
"exports": {
|
|
14
14
|
".": "./dist/index.mjs",
|
|
15
15
|
"./config": {
|
|
16
|
+
"types": "./config.d.ts",
|
|
16
17
|
"import": "./config.mjs",
|
|
17
|
-
"require": "./config.cjs"
|
|
18
|
-
|
|
18
|
+
"require": "./config.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./schema": {
|
|
21
|
+
"types": "./schema.d.ts",
|
|
22
|
+
"import": "./schema.mjs"
|
|
19
23
|
},
|
|
20
24
|
"./app": "./dist/app/index.mjs",
|
|
21
25
|
"./package.json": "./package.json"
|
|
@@ -30,53 +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.1
|
|
38
|
-
"@dtwo/schema": "3.1
|
|
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.1
|
|
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.
|
|
63
|
+
"holepack": "2.2.2",
|
|
59
64
|
"hookable": "5.4.2",
|
|
60
|
-
"jiti": "1.
|
|
61
|
-
"kdhead": "1.
|
|
62
|
-
"kdimport": "2.
|
|
65
|
+
"jiti": "1.17.1",
|
|
66
|
+
"kdhead": "1.8.10",
|
|
67
|
+
"kdimport": "2.2.4",
|
|
63
68
|
"kdu": "3.2.48",
|
|
64
|
-
"kdu-bundle-renderer": "1.0.
|
|
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
|
-
"strip-literal": "1.0.
|
|
76
|
-
"ufo": "1.0
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"unenv": "1.0.3",
|
|
80
|
+
"strip-literal": "1.0.1",
|
|
81
|
+
"ufo": "1.1.0",
|
|
82
|
+
"unctx": "2.1.2",
|
|
83
|
+
"unenv": "1.2.0",
|
|
80
84
|
"untyped": "1.2.2"
|
|
81
85
|
},
|
|
82
86
|
"devDependencies": {
|
|
@@ -85,7 +89,7 @@
|
|
|
85
89
|
"unbuild": "1.1.1"
|
|
86
90
|
},
|
|
87
91
|
"engines": {
|
|
88
|
-
"node": "^14.
|
|
92
|
+
"node": "^14.18.0 || ^16.10.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
89
93
|
},
|
|
90
94
|
"scripts": {}
|
|
91
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']
|