dtwo 3.1.0-0 → 3.1.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 CHANGED
@@ -1,4 +1,4 @@
1
- MIT License
1
+ The MIT License (MIT)
2
2
 
3
3
  Copyright (c) 2022 - Dtwo Team
4
4
 
@@ -17,7 +17,7 @@ declare global {
17
17
  }
18
18
  }
19
19
 
20
- declare module '@kdujs/runtime-core' {
20
+ declare module 'kdu' {
21
21
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
22
22
  interface App<HostElement> {
23
23
  $dtwo: DtwoApp
package/dist/index.mjs CHANGED
@@ -708,7 +708,7 @@ const componentsTypeTemplate = {
708
708
  `typeof ${genDynamicImport(isAbsolute(c.filePath) ? relative(buildDir, c.filePath).replace(/(?<=\w)\.(?!kdu)\w+$/g, "") : c.filePath.replace(/(?<=\w)\.(?!kdu)\w+$/g, ""), { wrapper: false })}['${c.export}']`
709
709
  ]);
710
710
  return `// Generated by components discovery
711
- declare module '@kdujs/runtime-core' {
711
+ declare module 'kdu' {
712
712
  export interface GlobalComponents {
713
713
  ${componentTypes.map(([pascalName, type]) => ` '${pascalName}': ${type}`).join("\n")}
714
714
  ${componentTypes.map(([pascalName, type]) => ` 'Lazy${pascalName}': ${type}`).join("\n")}
@@ -890,10 +890,11 @@ function findComponent(components, name, mode) {
890
890
  if (component) {
891
891
  return component;
892
892
  }
893
- if (mode === "server" && !component) {
893
+ const otherModeComponent = components.find((component2) => id === component2.pascalName);
894
+ if (mode === "server" && otherModeComponent) {
894
895
  return components.find((c) => c.pascalName === "ServerPlaceholder");
895
896
  }
896
- return components.find((component2) => id === component2.pascalName);
897
+ return otherModeComponent;
897
898
  }
898
899
 
899
900
  const PLACEHOLDER_RE = /^(k-slot|#)(fallback|placeholder)/;
@@ -1426,7 +1427,7 @@ function addDeclarationTemplates(ctx, options) {
1426
1427
  });
1427
1428
  }
1428
1429
 
1429
- const version = "3.1.0-0";
1430
+ const version = "3.1.1";
1430
1431
 
1431
1432
  const _require = createRequire(import.meta.url);
1432
1433
  const kduAppPatterns = (dtwo) => [
@@ -1477,6 +1478,7 @@ const ImportProtectionPlugin = createUnplugin(function(options) {
1477
1478
  };
1478
1479
  });
1479
1480
 
1481
+ const TRANSFORM_MARKER = "/* _processed_dtwo_unctx_transform */\n";
1480
1482
  const UnctxTransformPlugin = (dtwo) => {
1481
1483
  const transformer = createTransformer({
1482
1484
  asyncFunctions: ["defineDtwoPlugin", "defineDtwoRouteMiddleware"]
@@ -1489,14 +1491,20 @@ const UnctxTransformPlugin = (dtwo) => {
1489
1491
  name: "unctx:transform",
1490
1492
  enforce: "post",
1491
1493
  transformInclude(id) {
1494
+ if (id.includes("macro=true")) {
1495
+ return true;
1496
+ }
1492
1497
  id = normalize(id).replace(/\?.*$/, "");
1493
1498
  return app?.plugins.some((i) => i.src === id) || app?.middleware.some((m) => m.path === id);
1494
1499
  },
1495
1500
  transform(code, id) {
1501
+ if (code.startsWith(TRANSFORM_MARKER)) {
1502
+ return;
1503
+ }
1496
1504
  const result = transformer.transform(code);
1497
1505
  if (result) {
1498
1506
  return {
1499
- code: result.code,
1507
+ code: TRANSFORM_MARKER + result.code,
1500
1508
  map: options.sourcemap ? result.magicString.generateMap({ source: id, includeContent: true }) : void 0
1501
1509
  };
1502
1510
  }
@@ -1947,8 +1955,10 @@ async function initDtwo(dtwo) {
1947
1955
  };
1948
1956
  addWitePlugin(ImportProtectionPlugin.wite(config));
1949
1957
  addWebpackPlugin(ImportProtectionPlugin.webpack(config));
1950
- addWitePlugin(UnctxTransformPlugin(dtwo).wite({ sourcemap: dtwo.options.sourcemap.server || dtwo.options.sourcemap.client }));
1951
- addWebpackPlugin(UnctxTransformPlugin(dtwo).webpack({ sourcemap: dtwo.options.sourcemap.server || dtwo.options.sourcemap.client }));
1958
+ dtwo.hook("modules:done", () => {
1959
+ addWitePlugin(UnctxTransformPlugin(dtwo).wite({ sourcemap: dtwo.options.sourcemap.server || dtwo.options.sourcemap.client }));
1960
+ addWebpackPlugin(UnctxTransformPlugin(dtwo).webpack({ sourcemap: dtwo.options.sourcemap.server || dtwo.options.sourcemap.client }));
1961
+ });
1952
1962
  if (!dtwo.options.dev) {
1953
1963
  const removeFromServer = ["onBeforeMount", "onMounted", "onBeforeUpdate", "onRenderTracked", "onRenderTriggered", "onActivated", "onDeactivated", "onBeforeUnmount"];
1954
1964
  const removeFromClient = ["onServerPrefetch", "onRenderTracked", "onRenderTriggered"];
@@ -2073,7 +2083,7 @@ const kduShim = {
2073
2083
  filename: "types/kdu-shim.d.ts",
2074
2084
  getContents: () => [
2075
2085
  "declare module '*.kdu' {",
2076
- " import { DefineComponent } from '@kdujs/runtime-core'",
2086
+ " import { DefineComponent } from 'kdu'",
2077
2087
  " const component: DefineComponent<{}, {}, any>",
2078
2088
  " export default component",
2079
2089
  "}"
@@ -2150,7 +2160,7 @@ declare module '#app' {
2150
2160
  interface DtwoApp extends DtwoAppInjections { }
2151
2161
  }
2152
2162
 
2153
- declare module '@kdujs/runtime-core' {
2163
+ declare module 'kdu' {
2154
2164
  interface ComponentCustomProperties extends DtwoAppInjections { }
2155
2165
  }
2156
2166
 
@@ -1,19 +1,48 @@
1
- import type { DefineComponent, KeepAliveProps, TransitionProps } from 'kdu';
2
- declare const _default: DefineComponent<{
1
+ import type { KNode, KeepAliveProps, TransitionProps } from 'kdu';
2
+ import type { RouteLocationNormalizedLoaded } from 'kdu-router';
3
+ declare const _default: import("kdu").DefineComponent<{
4
+ name: {
5
+ type: StringConstructor;
6
+ };
7
+ transition: {
8
+ type: () => boolean | TransitionProps;
9
+ default: undefined;
10
+ };
11
+ keepalive: {
12
+ type: () => boolean | KeepAliveProps;
13
+ default: undefined;
14
+ };
15
+ route: {
16
+ type: () => RouteLocationNormalized;
17
+ };
18
+ pageKey: {
19
+ type: () => string | ((route: RouteLocationNormalizedLoaded) => string);
20
+ default: null;
21
+ };
22
+ }, () => KNode<import("kdu").RendererNode, import("kdu").RendererElement, {
3
23
  [key: string]: any;
4
- name?: string | undefined;
5
- transition?: boolean | TransitionProps | undefined;
6
- keepalive?: boolean | KeepAliveProps | undefined;
7
- route?: any;
8
- pageKey?: string | ((route: RouteLocationNormalizedLoaded) => string) | undefined;
9
- }, {}, {}, import("kdu").ComputedOptions, import("kdu").MethodOptions, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin, {}, string, import("kdu").KNodeProps & import("kdu").AllowedComponentProps & import("kdu").ComponentCustomProps, Readonly<import("kdu").ExtractPropTypes<{
10
- [key: string]: any;
11
- name?: string | undefined;
12
- transition?: boolean | TransitionProps | undefined;
13
- keepalive?: boolean | KeepAliveProps | undefined;
14
- route?: any;
15
- pageKey?: string | ((route: RouteLocationNormalizedLoaded) => string) | undefined;
24
+ }>, unknown, {}, {}, import("kdu").ComponentOptionsMixin, import("kdu").ComponentOptionsMixin, {}, string, import("kdu").KNodeProps & import("kdu").AllowedComponentProps & import("kdu").ComponentCustomProps, Readonly<import("kdu").ExtractPropTypes<{
25
+ name: {
26
+ type: StringConstructor;
27
+ };
28
+ transition: {
29
+ type: () => boolean | TransitionProps;
30
+ default: undefined;
31
+ };
32
+ keepalive: {
33
+ type: () => boolean | KeepAliveProps;
34
+ default: undefined;
35
+ };
36
+ route: {
37
+ type: () => RouteLocationNormalized;
38
+ };
39
+ pageKey: {
40
+ type: () => string | ((route: RouteLocationNormalizedLoaded) => string);
41
+ default: null;
42
+ };
16
43
  }>>, {
17
- [x: string]: any;
44
+ keepalive: boolean | KeepAliveProps;
45
+ transition: boolean | TransitionProps;
46
+ pageKey: string | ((route: RouteLocationNormalizedLoaded) => string);
18
47
  }>;
19
48
  export default _default;
@@ -1,8 +1,2 @@
1
- import type DtwoPage from '../page';
2
- declare module '@kdujs/runtime-core' {
3
- interface GlobalComponents {
4
- DtwoPage: typeof DtwoPage;
5
- }
6
- }
7
1
  declare const _default: any;
8
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtwo",
3
- "version": "3.1.0-0",
3
+ "version": "3.1.1",
4
4
  "repository": "d2js/dtwo",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -34,21 +34,21 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@d2js/devalue": "2.0.2",
37
- "@dtwo/kit": "3.1.0-0",
38
- "@dtwo/schema": "3.1.0-0",
37
+ "@dtwo/kit": "3.1.1",
38
+ "@dtwo/schema": "3.1.1",
39
39
  "@dtwo/telemetry": "2.1.8",
40
40
  "@dtwo/ui-templates": "1.1.0",
41
41
  "@dtwo/unplugin": "1.0.0",
42
- "@dtwo/wite-builder": "3.1.0-0",
42
+ "@dtwo/wite-builder": "3.1.1",
43
43
  "@kdhead/ssr": "1.0.19",
44
44
  "@kdujs/reactivity": "3.2.45",
45
45
  "@kdujs/shared": "3.2.45",
46
46
  "@kduse/head": "1.0.15",
47
47
  "chokidar": "3.5.3",
48
48
  "cookie-es": "0.5.0",
49
- "defu": "6.1.1",
49
+ "defu": "6.1.2",
50
50
  "destr": "1.2.2",
51
- "dtwc": "3.1.0-0",
51
+ "dtwc": "3.1.1",
52
52
  "escape-string-regexp": "5.0.0",
53
53
  "estree-walker": "3.0.3",
54
54
  "fs-extra": "11.1.0",
@@ -69,7 +69,7 @@
69
69
  "mlly": "1.1.0",
70
70
  "ofetch": "1.0.0",
71
71
  "ohash": "1.0.0",
72
- "pathe": "1.0.0",
72
+ "pathe": "1.1.0",
73
73
  "perfect-debounce": "0.1.3",
74
74
  "scule": "1.0.0",
75
75
  "strip-literal": "1.0.0",
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 { Schema, SchemaDefinition } from '@dtwo/schema'
4
+ import type { SchemaDefinition } from '@dtwo/schema'
5
5
 
6
6
  declare global {
7
7
  const defineDtwoConfig: typeof import('dtwo/config')['defineDtwoConfig']