dtwo 3.1.1 → 3.1.2
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export const requestIdleCallback = process.server ?
|
|
1
|
+
export const requestIdleCallback = process.server ? () => {
|
|
2
|
+
} : globalThis.requestIdleCallback || ((cb) => {
|
|
2
3
|
const start = Date.now();
|
|
3
4
|
const idleDeadline = {
|
|
4
5
|
didTimeout: false,
|
|
@@ -8,6 +9,7 @@ export const requestIdleCallback = process.server ? void 0 : globalThis.requestI
|
|
|
8
9
|
cb(idleDeadline);
|
|
9
10
|
}, 1);
|
|
10
11
|
});
|
|
11
|
-
export const cancelIdleCallback = process.server ?
|
|
12
|
+
export const cancelIdleCallback = process.server ? () => {
|
|
13
|
+
} : globalThis.cancelIdleCallback || ((id) => {
|
|
12
14
|
clearTimeout(id);
|
|
13
15
|
});
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { useDtwoApp } from "../dtwo.mjs";
|
|
2
2
|
import { requestIdleCallback } from "../compat/idle-callback.mjs";
|
|
3
3
|
export const onDtwoReady = (callback) => {
|
|
4
|
+
if (process.server) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
4
7
|
const dtwoApp = useDtwoApp();
|
|
5
8
|
if (dtwoApp.isHydrating) {
|
|
6
9
|
dtwoApp.hooks.hookOnce("app:suspense:resolve", () => {
|
|
@@ -13,7 +13,7 @@ globalThis.__publicAssetsURL = publicAssetsURL;
|
|
|
13
13
|
const getClientManifest = () => import("#build/dist/server/client.manifest.mjs").then((r) => r.default || r).then((r) => typeof r === "function" ? r() : r);
|
|
14
14
|
const getStaticRenderedHead = () => import("#head-static").then((r) => r.default || r);
|
|
15
15
|
const getServerEntry = () => import("#build/dist/server/server.mjs").then((r) => r.default || r);
|
|
16
|
-
const getSSRStyles = () => import("#build/dist/server/styles.mjs").then((r) => r.default || r);
|
|
16
|
+
const getSSRStyles = lazyCachedFunction(() => import("#build/dist/server/styles.mjs").then((r) => r.default || r));
|
|
17
17
|
const getSSRRenderer = lazyCachedFunction(async () => {
|
|
18
18
|
const manifest = await getClientManifest();
|
|
19
19
|
if (!manifest) {
|
|
@@ -48,7 +48,7 @@ export declare const NoScript: import("kdu").DefineComponent<{
|
|
|
48
48
|
translate: StringConstructor;
|
|
49
49
|
}, () => import("kdu").KNode<import("kdu").RendererNode, import("kdu").RendererElement, {
|
|
50
50
|
[key: string]: any;
|
|
51
|
-
}>[] | null | undefined, unknown, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin,
|
|
51
|
+
}>[] | null | undefined, unknown, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin, {}, string, import("kdu").KNodeProps & import("kdu").AllowedComponentProps & import("kdu").ComponentCustomProps, Readonly<import("kdu").ExtractPropTypes<{
|
|
52
52
|
title: StringConstructor;
|
|
53
53
|
body: BooleanConstructor;
|
|
54
54
|
renderPriority: (StringConstructor | NumberConstructor)[];
|
|
@@ -172,7 +172,7 @@ export declare const Link: import("kdu").DefineComponent<{
|
|
|
172
172
|
translate: StringConstructor;
|
|
173
173
|
}, () => import("kdu").KNode<import("kdu").RendererNode, import("kdu").RendererElement, {
|
|
174
174
|
[key: string]: any;
|
|
175
|
-
}>[] | null | undefined, unknown, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin,
|
|
175
|
+
}>[] | null | undefined, unknown, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin, {}, string, import("kdu").KNodeProps & import("kdu").AllowedComponentProps & import("kdu").ComponentCustomProps, Readonly<import("kdu").ExtractPropTypes<{
|
|
176
176
|
as: StringConstructor;
|
|
177
177
|
crossorigin: PropType<CrossOrigin>;
|
|
178
178
|
disabled: BooleanConstructor;
|
|
@@ -298,7 +298,7 @@ export declare const Base: import("kdu").DefineComponent<{
|
|
|
298
298
|
translate: StringConstructor;
|
|
299
299
|
}, () => import("kdu").KNode<import("kdu").RendererNode, import("kdu").RendererElement, {
|
|
300
300
|
[key: string]: any;
|
|
301
|
-
}>[] | null | undefined, unknown, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin,
|
|
301
|
+
}>[] | null | undefined, unknown, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin, {}, string, import("kdu").KNodeProps & import("kdu").AllowedComponentProps & import("kdu").ComponentCustomProps, Readonly<import("kdu").ExtractPropTypes<{
|
|
302
302
|
href: StringConstructor;
|
|
303
303
|
target: PropType<Target>;
|
|
304
304
|
accesskey: StringConstructor;
|
|
@@ -355,7 +355,7 @@ export declare const Title: import("kdu").DefineComponent<{
|
|
|
355
355
|
[x: string]: any;
|
|
356
356
|
}, () => import("kdu").KNode<import("kdu").RendererNode, import("kdu").RendererElement, {
|
|
357
357
|
[key: string]: any;
|
|
358
|
-
}>[] | null | undefined, {}, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin,
|
|
358
|
+
}>[] | null | undefined, {}, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin, {}, string, import("kdu").KNodeProps & import("kdu").AllowedComponentProps & import("kdu").ComponentCustomProps, Readonly<import("kdu").ExtractPropTypes<{
|
|
359
359
|
[x: string]: any;
|
|
360
360
|
}>>, {
|
|
361
361
|
[x: string]: any;
|
|
@@ -412,7 +412,7 @@ export declare const Meta: import("kdu").DefineComponent<{
|
|
|
412
412
|
translate: StringConstructor;
|
|
413
413
|
}, () => import("kdu").KNode<import("kdu").RendererNode, import("kdu").RendererElement, {
|
|
414
414
|
[key: string]: any;
|
|
415
|
-
}>[] | null | undefined, unknown, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin,
|
|
415
|
+
}>[] | null | undefined, unknown, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin, {}, string, import("kdu").KNodeProps & import("kdu").AllowedComponentProps & import("kdu").ComponentCustomProps, Readonly<import("kdu").ExtractPropTypes<{
|
|
416
416
|
charset: StringConstructor;
|
|
417
417
|
content: StringConstructor;
|
|
418
418
|
httpEquiv: PropType<HTTPEquiv>;
|
|
@@ -525,7 +525,7 @@ export declare const Style: import("kdu").DefineComponent<{
|
|
|
525
525
|
translate: StringConstructor;
|
|
526
526
|
}, () => import("kdu").KNode<import("kdu").RendererNode, import("kdu").RendererElement, {
|
|
527
527
|
[key: string]: any;
|
|
528
|
-
}>[] | null | undefined, unknown, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin,
|
|
528
|
+
}>[] | null | undefined, unknown, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin, {}, string, import("kdu").KNodeProps & import("kdu").AllowedComponentProps & import("kdu").ComponentCustomProps, Readonly<import("kdu").ExtractPropTypes<{
|
|
529
529
|
type: StringConstructor;
|
|
530
530
|
media: StringConstructor;
|
|
531
531
|
nonce: StringConstructor;
|
|
@@ -640,7 +640,7 @@ export declare const Html: import("kdu").DefineComponent<{
|
|
|
640
640
|
translate: StringConstructor;
|
|
641
641
|
}, () => import("kdu").KNode<import("kdu").RendererNode, import("kdu").RendererElement, {
|
|
642
642
|
[key: string]: any;
|
|
643
|
-
}>[] | null | undefined, unknown, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin,
|
|
643
|
+
}>[] | null | undefined, unknown, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin, {}, string, import("kdu").KNodeProps & import("kdu").AllowedComponentProps & import("kdu").ComponentCustomProps, Readonly<import("kdu").ExtractPropTypes<{
|
|
644
644
|
manifest: StringConstructor;
|
|
645
645
|
version: StringConstructor;
|
|
646
646
|
xmlns: StringConstructor;
|
|
@@ -742,7 +742,7 @@ export declare const Body: import("kdu").DefineComponent<{
|
|
|
742
742
|
translate: StringConstructor;
|
|
743
743
|
}, () => import("kdu").KNode<import("kdu").RendererNode, import("kdu").RendererElement, {
|
|
744
744
|
[key: string]: any;
|
|
745
|
-
}>[] | null | undefined, unknown, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin,
|
|
745
|
+
}>[] | null | undefined, unknown, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin, {}, string, import("kdu").KNodeProps & import("kdu").AllowedComponentProps & import("kdu").ComponentCustomProps, Readonly<import("kdu").ExtractPropTypes<{
|
|
746
746
|
renderPriority: (StringConstructor | NumberConstructor)[];
|
|
747
747
|
accesskey: StringConstructor;
|
|
748
748
|
autocapitalize: StringConstructor;
|
package/dist/index.mjs
CHANGED
|
@@ -7,6 +7,8 @@ import { encodePath, parseURL, stringifyQuery, parseQuery, joinURL, withTrailing
|
|
|
7
7
|
import { existsSync, readdirSync, statSync, promises } from 'node:fs';
|
|
8
8
|
import { genArrayFromRaw, genSafeVariableName, genImport, genDynamicImport, genObjectFromRawEntries, genString, genExport } from 'knitwork';
|
|
9
9
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
10
|
+
import { filename } from 'pathe/utils';
|
|
11
|
+
import { hash } from 'ohash';
|
|
10
12
|
import { kebabCase, splitByCase, pascalCase, camelCase } from 'scule';
|
|
11
13
|
import { createUnplugin } from '@dtwo/unplugin';
|
|
12
14
|
import { findStaticImports, findExports, parseStaticImport, resolvePath as resolvePath$1 } from 'mlly';
|
|
@@ -20,7 +22,7 @@ import { createRequire } from 'node:module';
|
|
|
20
22
|
import { createTransformer } from 'unctx/transform';
|
|
21
23
|
import { stripLiteral } from 'strip-literal';
|
|
22
24
|
import { createHole, scanHandlers, writeTypes, build as build$1, prepare, copyPublicAssets, prerender, createDevServer } from 'holepack';
|
|
23
|
-
import
|
|
25
|
+
import { defu } from 'defu';
|
|
24
26
|
import { dynamicEventHandler } from 'h3';
|
|
25
27
|
import { createHeadCore } from 'kdhead';
|
|
26
28
|
import { renderSSRHead } from '@kdhead/ssr';
|
|
@@ -30,7 +32,6 @@ import { debounce } from 'perfect-debounce';
|
|
|
30
32
|
import { resolveSchema, generateMarkdown, generateTypes } from 'untyped';
|
|
31
33
|
import untypedPlugin from 'untyped/babel-plugin';
|
|
32
34
|
import jiti from 'jiti';
|
|
33
|
-
import { hash } from 'ohash';
|
|
34
35
|
|
|
35
36
|
let _distDir = dirname(fileURLToPath(import.meta.url));
|
|
36
37
|
if (_distDir.match(/(chunks|shared)$/)) {
|
|
@@ -195,12 +196,11 @@ function prepareRoutes(routes, parent) {
|
|
|
195
196
|
return routes;
|
|
196
197
|
}
|
|
197
198
|
function normalizeRoutes(routes, metaImports = /* @__PURE__ */ new Set()) {
|
|
198
|
-
const dtwo = useDtwo();
|
|
199
199
|
return {
|
|
200
200
|
imports: metaImports,
|
|
201
201
|
routes: genArrayFromRaw(routes.map((page) => {
|
|
202
202
|
const file = normalize(page.file);
|
|
203
|
-
const metaImportName = genSafeVariableName(
|
|
203
|
+
const metaImportName = genSafeVariableName(filename(file) + hash(file)) + "Meta";
|
|
204
204
|
metaImports.add(genImport(`${file}?macro=true`, [{ name: "default", as: metaImportName }]));
|
|
205
205
|
let aliasCode = `${metaImportName}?.alias || []`;
|
|
206
206
|
if (Array.isArray(page.alias) && page.alias.length) {
|
|
@@ -538,6 +538,9 @@ const pagesModule = defineDtwoModule({
|
|
|
538
538
|
dtwo.options.wite.optimizeDeps = dtwo.options.wite.optimizeDeps || {};
|
|
539
539
|
dtwo.options.wite.optimizeDeps.include = dtwo.options.wite.optimizeDeps.include || [];
|
|
540
540
|
dtwo.options.wite.optimizeDeps.include.push("kdu-router");
|
|
541
|
+
dtwo.options.wite.resolve = dtwo.options.wite.resolve || {};
|
|
542
|
+
dtwo.options.wite.resolve.dedupe = dtwo.options.wite.resolve.dedupe || [];
|
|
543
|
+
dtwo.options.wite.resolve.dedupe.push("kdu-router");
|
|
541
544
|
addTemplate({
|
|
542
545
|
filename: "router.options.mjs",
|
|
543
546
|
getContents: async () => {
|
|
@@ -1427,7 +1430,7 @@ function addDeclarationTemplates(ctx, options) {
|
|
|
1427
1430
|
});
|
|
1428
1431
|
}
|
|
1429
1432
|
|
|
1430
|
-
const version = "3.1.
|
|
1433
|
+
const version = "3.1.2";
|
|
1431
1434
|
|
|
1432
1435
|
const _require = createRequire(import.meta.url);
|
|
1433
1436
|
const kduAppPatterns = (dtwo) => [
|
|
@@ -1867,7 +1870,7 @@ const schemaModule = defineDtwoModule({
|
|
|
1867
1870
|
const schemas = await Promise.all(
|
|
1868
1871
|
schemaDefs.map((schemaDef) => resolveSchema(schemaDef))
|
|
1869
1872
|
);
|
|
1870
|
-
const schema2 = defu
|
|
1873
|
+
const schema2 = defu(...schemas);
|
|
1871
1874
|
await dtwo.hooks.callHook("schema:resolved", schema2);
|
|
1872
1875
|
return schema2;
|
|
1873
1876
|
}
|
|
@@ -2113,7 +2116,7 @@ const clientPluginTemplate = {
|
|
|
2113
2116
|
const imports = [];
|
|
2114
2117
|
for (const plugin of clientPlugins) {
|
|
2115
2118
|
const path = relative(ctx.dtwo.options.rootDir, plugin.src);
|
|
2116
|
-
const variable = genSafeVariableName(
|
|
2119
|
+
const variable = genSafeVariableName(filename(plugin.src)).replace(/_(45|46|47)/g, "_") + "_" + hash(path);
|
|
2117
2120
|
exports.push(variable);
|
|
2118
2121
|
imports.push(genImport(plugin.src, variable));
|
|
2119
2122
|
}
|
|
@@ -2131,7 +2134,7 @@ const serverPluginTemplate = {
|
|
|
2131
2134
|
const imports = [];
|
|
2132
2135
|
for (const plugin of serverPlugins) {
|
|
2133
2136
|
const path = relative(ctx.dtwo.options.rootDir, plugin.src);
|
|
2134
|
-
const variable = genSafeVariableName(path).replace(/_(45|46|47)/g, "_") + "_" + hash(path);
|
|
2137
|
+
const variable = genSafeVariableName(filename(path)).replace(/_(45|46|47)/g, "_") + "_" + hash(path);
|
|
2135
2138
|
exports.push(variable);
|
|
2136
2139
|
imports.push(genImport(plugin.src, variable));
|
|
2137
2140
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtwo",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"repository": "d2js/dtwo",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -34,33 +34,33 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@d2js/devalue": "2.0.2",
|
|
37
|
-
"@dtwo/kit": "3.1.
|
|
38
|
-
"@dtwo/schema": "3.1.
|
|
37
|
+
"@dtwo/kit": "3.1.2",
|
|
38
|
+
"@dtwo/schema": "3.1.2",
|
|
39
39
|
"@dtwo/telemetry": "2.1.8",
|
|
40
|
-
"@dtwo/ui-templates": "1.1.
|
|
40
|
+
"@dtwo/ui-templates": "1.1.1",
|
|
41
41
|
"@dtwo/unplugin": "1.0.0",
|
|
42
|
-
"@dtwo/wite-builder": "3.1.
|
|
43
|
-
"@kdhead/ssr": "1.0.
|
|
44
|
-
"@kdujs/reactivity": "3.2.
|
|
45
|
-
"@kdujs/shared": "3.2.
|
|
46
|
-
"@kduse/head": "1.0.
|
|
42
|
+
"@dtwo/wite-builder": "3.1.2",
|
|
43
|
+
"@kdhead/ssr": "1.0.20",
|
|
44
|
+
"@kdujs/reactivity": "3.2.48",
|
|
45
|
+
"@kdujs/shared": "3.2.48",
|
|
46
|
+
"@kduse/head": "1.0.24",
|
|
47
47
|
"chokidar": "3.5.3",
|
|
48
48
|
"cookie-es": "0.5.0",
|
|
49
49
|
"defu": "6.1.2",
|
|
50
50
|
"destr": "1.2.2",
|
|
51
|
-
"dtwc": "3.1.
|
|
51
|
+
"dtwc": "3.1.2",
|
|
52
52
|
"escape-string-regexp": "5.0.0",
|
|
53
53
|
"estree-walker": "3.0.3",
|
|
54
54
|
"fs-extra": "11.1.0",
|
|
55
55
|
"globby": "13.1.3",
|
|
56
|
-
"h3": "1.0
|
|
56
|
+
"h3": "1.1.0",
|
|
57
57
|
"hash-sum": "2.0.0",
|
|
58
|
-
"holepack": "2.
|
|
58
|
+
"holepack": "2.1.1",
|
|
59
59
|
"hookable": "5.4.2",
|
|
60
60
|
"jiti": "1.16.2",
|
|
61
|
-
"kdhead": "1.0.
|
|
62
|
-
"kdimport": "2.0
|
|
63
|
-
"kdu": "3.2.
|
|
61
|
+
"kdhead": "1.0.20",
|
|
62
|
+
"kdimport": "2.1.0",
|
|
63
|
+
"kdu": "3.2.48",
|
|
64
64
|
"kdu-bundle-renderer": "1.0.0",
|
|
65
65
|
"kdu-devtools-stub": "0.1.0",
|
|
66
66
|
"kdu-router": "4.1.6",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"ufo": "1.0.1",
|
|
77
77
|
"ultrahtml": "1.2.0",
|
|
78
78
|
"unctx": "2.1.1",
|
|
79
|
-
"unenv": "1.0.
|
|
79
|
+
"unenv": "1.0.3",
|
|
80
80
|
"untyped": "1.2.2"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|