dumi 2.0.12 → 2.0.13

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,8 +1,13 @@
1
1
  import { AtomAsset, ExamplePresetAsset } from 'dumi-assets-types';
2
+ import type { TypeMap } from 'dumi-assets-types/typings/atom/props/types';
2
3
  import { type FC } from 'react';
3
4
  interface IAtomRendererProps {
4
5
  type: AtomAsset['type'];
5
6
  value: ExamplePresetAsset['value'];
7
+ processor?: typeof builtInProcessor;
6
8
  }
9
+ declare type Entity = TypeMap['element'] | TypeMap['function'] | TypeMap['dom'];
10
+ declare type Exports = Record<string, any>;
11
+ declare function builtInProcessor(entity: Entity, entryExports: Exports): any;
7
12
  export declare const AtomRenderer: FC<IAtomRendererProps>;
8
13
  export {};
@@ -88,8 +88,12 @@ export var AtomRenderer = function AtomRenderer(props) {
88
88
  switch (props.type) {
89
89
  case 'COMPONENT':
90
90
  return translatePresetToReact(props.value, function (entity) {
91
- // TODO: support custom processor
92
- return builtInProcessor(entity, entryExports);
91
+ var _props$processor, _props$processor2;
92
+
93
+ return (// support custom processor
94
+ (_props$processor = (_props$processor2 = props.processor) === null || _props$processor2 === void 0 ? void 0 : _props$processor2.call(props, entity, entryExports)) !== null && _props$processor !== void 0 ? _props$processor : // fallback to built-in processor
95
+ builtInProcessor(entity, entryExports)
96
+ );
93
97
  });
94
98
 
95
99
  default:
@@ -90,6 +90,10 @@ var derivative_default = (api) => {
90
90
  memo.mfsu = false;
91
91
  } else {
92
92
  memo.mfsu.strategy = "normal";
93
+ memo.mfsu.shared = {
94
+ react: { singleton: true },
95
+ "react-dom": { singleton: true }
96
+ };
93
97
  import_constants.CLIENT_DEPS.forEach((pkg) => {
94
98
  memo.alias ?? (memo.alias = {});
95
99
  memo.alias[pkg] = (0, import_plugin_utils.winPath)(import_path.default.dirname(require.resolve(`${pkg}/package.json`)));
@@ -28,6 +28,7 @@ module.exports = __toCommonJS(parser_exports);
28
28
  var import_assert = __toESM(require("assert"));
29
29
  var import_meta = require("./meta");
30
30
  var parser_default = (api) => {
31
+ let prevData;
31
32
  const writeAtomsMetaFile = (data) => {
32
33
  api.writeTmpFile({
33
34
  noPluginDir: true,
@@ -40,7 +41,8 @@ var parser_default = (api) => {
40
41
  enableBy: api.EnableBy.config,
41
42
  config: {
42
43
  schema: (Joi) => Joi.object({
43
- unpkgHost: Joi.string().uri()
44
+ unpkgHost: Joi.string().uri().optional(),
45
+ resolveFilter: Joi.function().optional()
44
46
  })
45
47
  }
46
48
  });
@@ -60,14 +62,19 @@ var parser_default = (api) => {
60
62
  resolveFilter: api.config.apiParser.resolveFilter
61
63
  });
62
64
  if (api.env === "development") {
63
- api.service.atomParser.watch(writeAtomsMetaFile);
65
+ api.service.atomParser.watch((data) => {
66
+ prevData = data;
67
+ writeAtomsMetaFile(prevData);
68
+ });
64
69
  }
65
70
  });
66
- if (api.env === "production") {
67
- api.onGenerateFiles(async () => {
71
+ api.onGenerateFiles(async () => {
72
+ if (api.env === "production") {
68
73
  writeAtomsMetaFile(await api.service.atomParser.parse());
69
- });
70
- }
74
+ } else if (prevData) {
75
+ writeAtomsMetaFile(prevData);
76
+ }
77
+ });
71
78
  };
72
79
  // Annotate the CommonJS export names for ESM import in node:
73
80
  0 && (module.exports = {});
@@ -42,6 +42,9 @@ var ReactDemoVisitor = class extends import_Visitor.default {
42
42
  argument: n.expression
43
43
  };
44
44
  }
45
+ visitTsType(n) {
46
+ return n;
47
+ }
45
48
  };
46
49
  var ReactTechStack = class {
47
50
  constructor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dumi",
3
- "version": "2.0.12",
3
+ "version": "2.0.13",
4
4
  "description": "📖 Documentation Generator of React Component",
5
5
  "keywords": [
6
6
  "generator",
@@ -94,9 +94,9 @@
94
94
  font-weight: 500;
95
95
  background: linear-gradient(
96
96
  to top,
97
- rgb(255 255 255 / 100%),
98
- rgb(255 255 255 / 100%) 50%,
99
- rgb(255 255 255 / 0%)
97
+ rgba(255, 255, 255, 100%),
98
+ rgba(255, 255, 255, 100%) 50%,
99
+ rgba(255, 255, 255, 0%)
100
100
  )
101
101
  100%;
102
102
 
@@ -23,15 +23,15 @@
23
23
  left: 0;
24
24
  background-image: linear-gradient(
25
25
  to right,
26
- rgb(0 0 0 / 10%),
27
- rgb(0 0 0 / 0%)
26
+ rgba(0, 0, 0, 10%),
27
+ rgba(0, 0, 0, 0%)
28
28
  );
29
29
 
30
30
  [data-prefers-color='dark'] & {
31
31
  background-image: linear-gradient(
32
32
  to right,
33
- rgb(0 0 0 / 50%),
34
- rgb(0 0 0 / 0%)
33
+ rgba(0, 0, 0, 50%),
34
+ rgba(0, 0, 0, 0%)
35
35
  );
36
36
  }
37
37
  }
@@ -40,15 +40,15 @@
40
40
  right: 0;
41
41
  background-image: linear-gradient(
42
42
  to left,
43
- rgb(0 0 0 / 10%),
44
- rgb(0 0 0 / 0%)
43
+ rgba(0, 0, 0, 10%),
44
+ rgba(0, 0, 0, 0%)
45
45
  );
46
46
 
47
47
  [data-prefers-color='dark'] & {
48
48
  background-image: linear-gradient(
49
49
  to left,
50
- rgb(0 0 0 / 50%),
51
- rgb(0 0 0 / 0%)
50
+ rgba(0, 0, 0, 50%),
51
+ rgba(0, 0, 0, 0%)
52
52
  );
53
53
  }
54
54
  }
@@ -18,7 +18,7 @@ body {
18
18
  right: 0;
19
19
  left: 0;
20
20
  bottom: 0;
21
- background-color: rgb(0 0 0 / 50%);
21
+ background-color: rgba(0, 0, 0, 50%);
22
22
  transition: all 0.1s;
23
23
  }
24
24
 
@@ -110,7 +110,7 @@
110
110
  background-color: #fff;
111
111
  border-top-left-radius: 10px;
112
112
  border-top-right-radius: 10px;
113
- box-shadow: 0 8px 24px 0 rgb(0 0 0 / 5%);
113
+ box-shadow: 0 8px 24px 0 rgba(0, 0, 0, 5%);
114
114
 
115
115
  @media @mobile {
116
116
  max-width: initial;
@@ -16,7 +16,7 @@
16
16
 
17
17
  > span {
18
18
  color: transparent;
19
- text-shadow: 0 10px 20px rgb(22 119 255 / 15%);
19
+ text-shadow: 0 10px 20px rgba(22, 119, 255, 15%);
20
20
  background: linear-gradient(30deg, #91d6ff 30%, #66a6ff);
21
21
  background-clip: text;
22
22
  }
@@ -75,11 +75,11 @@
75
75
  overflow: hidden;
76
76
 
77
77
  &&-ping-left {
78
- box-shadow: 5px 0 5px -5px rgb(0 0 0 / 10%) inset;
78
+ box-shadow: 5px 0 5px -5px rgba(0, 0, 0, 10%) inset;
79
79
  }
80
80
 
81
81
  &&-ping-right ~ * > .@{prefix}-tabs-nav-more {
82
- box-shadow: 0 0 5px rgb(0 0 0 / 10%);
82
+ box-shadow: 0 0 5px rgba(0, 0, 0, 10%);
83
83
  }
84
84
  }
85
85
 
@@ -81,7 +81,7 @@
81
81
  margin-top: 18px;
82
82
  background-color: #fff;
83
83
  border-radius: 8px;
84
- box-shadow: 0 4px 30px rgb(0 0 0 / 20%);
84
+ box-shadow: 0 4px 30px rgba(0, 0, 0, 20%);
85
85
 
86
86
  &::before {
87
87
  content: '';
@@ -116,7 +116,7 @@
116
116
  justify-content: center;
117
117
 
118
118
  &-mask {
119
- background-color: rgb(0 0 0 / 45%);
119
+ background-color: rgba(0, 0, 0, 45%);
120
120
  width: 100%;
121
121
  height: 100%;
122
122
  }
@@ -128,7 +128,8 @@
128
128
  width: 500px;
129
129
  padding: 12px;
130
130
  box-sizing: border-box;
131
- box-shadow: inset 1px 1px 0 0 hsl(0deg 0% 100% / 50%), 0 3px 8px 0 #555a64;
131
+ box-shadow: inset 1px 1px 0 0 hsla(0deg, 0%, 100%, 50%),
132
+ 0 3px 8px 0 #555a64;
132
133
  border-radius: 8px;
133
134
  max-height: calc(100% - 120px);
134
135
  display: flex;
@@ -22,7 +22,7 @@
22
22
  padding-inline-start: 32px;
23
23
  background-color: @c-site-bg;
24
24
  border-top: 1px solid @c-border-light;
25
- box-shadow: 0 0 20px rgb(0 0 0 / 10%);
25
+ box-shadow: 0 0 20px rgba(0, 0, 0, 10%);
26
26
  transition: 0.2s all;
27
27
 
28
28
  .@{prefix}-doc-layout:not([data-mobile-sidebar-active]) & {
@@ -24,7 +24,7 @@
24
24
  white-space: nowrap;
25
25
  background-color: #000;
26
26
  border-radius: 2px;
27
- box-shadow: 0 4px 10px rgb(0 0 0 / 10%);
27
+ box-shadow: 0 4px 10px rgba(0, 0, 0, 10%);
28
28
  box-sizing: border-box;
29
29
  }
30
30