@t8/docsgen 0.1.6 → 0.1.8
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/dist/bin.js +15 -9
- package/dist/css/base.css +0 -3
- package/dist/css/index.css +19 -16
- package/package.json +1 -1
- package/src/bin/getConfig.ts +18 -9
- package/src/css/base.css +0 -3
- package/src/css/index.css +19 -16
package/dist/bin.js
CHANGED
|
@@ -130,6 +130,18 @@ function toConfig(metadata) {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
// src/bin/getConfig.ts
|
|
133
|
+
async function addMetadata(config2) {
|
|
134
|
+
try {
|
|
135
|
+
let rawContent = await fetchText(getLocation(config2, "package.json"));
|
|
136
|
+
let metadata = JSON.parse(rawContent);
|
|
137
|
+
return {
|
|
138
|
+
...toConfig(metadata),
|
|
139
|
+
...config2
|
|
140
|
+
};
|
|
141
|
+
} catch {
|
|
142
|
+
return config2;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
133
145
|
var config = null;
|
|
134
146
|
async function getConfig() {
|
|
135
147
|
if (config) return config;
|
|
@@ -151,15 +163,9 @@ async function getConfig() {
|
|
|
151
163
|
...localConfig,
|
|
152
164
|
...A(args)
|
|
153
165
|
};
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
config = {
|
|
158
|
-
...toConfig(metadata),
|
|
159
|
-
...config
|
|
160
|
-
};
|
|
161
|
-
} catch {
|
|
162
|
-
}
|
|
166
|
+
if (config.entries)
|
|
167
|
+
config.entries = await Promise.all(config.entries.map(addMetadata));
|
|
168
|
+
else await addMetadata(config);
|
|
163
169
|
if (!config.root?.endsWith("/")) config.root = `${config.root ?? ""}/`;
|
|
164
170
|
return config;
|
|
165
171
|
}
|
package/dist/css/base.css
CHANGED
package/dist/css/index.css
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
background:
|
|
8
|
-
linear-gradient(to bottom, #90eec6, #9a70ce) 50% 50% / cover no-repeat;
|
|
9
|
-
}
|
|
1
|
+
:root {
|
|
2
|
+
--g0: color(
|
|
3
|
+
from var(--b1) srgb calc(0.5 * r + 0.5) calc(0.5 * g + 0.5)
|
|
4
|
+
calc(0.5 * b + 0.5)
|
|
5
|
+
);
|
|
6
|
+
--g1: color(from var(--g1) xyz calc(0.25 * x) calc(1.5 * y) calc(0.5 * z));
|
|
10
7
|
}
|
|
11
8
|
@media (prefers-color-scheme: dark) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
:root {
|
|
10
|
+
--g0: color(
|
|
11
|
+
from var(--b1) srgb calc(0.5 * r + 0.3) calc(0.5 * g + 0.3)
|
|
12
|
+
calc(0.5 * b + 0.3)
|
|
13
|
+
);
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
html {
|
|
17
|
+
background:
|
|
18
|
+
linear-gradient(to bottom right, var(--g1), var(--g0)) 50% 50% / cover
|
|
19
|
+
no-repeat;
|
|
20
|
+
}
|
|
21
|
+
@media (max-width: 840px) {
|
|
22
|
+
html {
|
|
20
23
|
background:
|
|
21
|
-
linear-gradient(to bottom,
|
|
24
|
+
linear-gradient(to bottom, var(--g1), var(--g0)) 50% 50% / cover no-repeat;
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
body {
|
package/package.json
CHANGED
package/src/bin/getConfig.ts
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { parseArgs } from "args-json";
|
|
2
2
|
import type { BinConfig } from "../types/BinConfig";
|
|
3
|
+
import type { EntryConfig } from "../types/EntryConfig";
|
|
3
4
|
import type { PackageMetadata } from "../types/PackageMetadata";
|
|
4
5
|
import { fetchText } from "./fetchText";
|
|
5
6
|
import { getLocation } from "./getLocation";
|
|
6
7
|
import { toConfig } from "./toConfig";
|
|
7
8
|
|
|
9
|
+
async function addMetadata(config: EntryConfig) {
|
|
10
|
+
try {
|
|
11
|
+
let rawContent = await fetchText(getLocation(config, "package.json"));
|
|
12
|
+
let metadata = JSON.parse(rawContent) as PackageMetadata;
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
...toConfig(metadata),
|
|
16
|
+
...config,
|
|
17
|
+
};
|
|
18
|
+
} catch {
|
|
19
|
+
return config;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
8
23
|
let config: BinConfig | null = null;
|
|
9
24
|
|
|
10
25
|
export async function getConfig(): Promise<BinConfig> {
|
|
@@ -32,15 +47,9 @@ export async function getConfig(): Promise<BinConfig> {
|
|
|
32
47
|
...parseArgs<BinConfig>(args),
|
|
33
48
|
};
|
|
34
49
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
config = {
|
|
40
|
-
...toConfig(metadata),
|
|
41
|
-
...config,
|
|
42
|
-
};
|
|
43
|
-
} catch {}
|
|
50
|
+
if (config.entries)
|
|
51
|
+
config.entries = await Promise.all(config.entries.map(addMetadata));
|
|
52
|
+
else await addMetadata(config);
|
|
44
53
|
|
|
45
54
|
if (!config.root?.endsWith("/")) config.root = `${config.root ?? ""}/`;
|
|
46
55
|
|
package/src/css/base.css
CHANGED
package/src/css/index.css
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
background:
|
|
8
|
-
linear-gradient(to bottom, #90eec6, #9a70ce) 50% 50% / cover no-repeat;
|
|
9
|
-
}
|
|
1
|
+
:root {
|
|
2
|
+
--g0: color(
|
|
3
|
+
from var(--b1) srgb calc(0.5 * r + 0.5) calc(0.5 * g + 0.5)
|
|
4
|
+
calc(0.5 * b + 0.5)
|
|
5
|
+
);
|
|
6
|
+
--g1: color(from var(--g1) xyz calc(0.25 * x) calc(1.5 * y) calc(0.5 * z));
|
|
10
7
|
}
|
|
11
8
|
@media (prefers-color-scheme: dark) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
:root {
|
|
10
|
+
--g0: color(
|
|
11
|
+
from var(--b1) srgb calc(0.5 * r + 0.3) calc(0.5 * g + 0.3)
|
|
12
|
+
calc(0.5 * b + 0.3)
|
|
13
|
+
);
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
html {
|
|
17
|
+
background:
|
|
18
|
+
linear-gradient(to bottom right, var(--g1), var(--g0)) 50% 50% / cover
|
|
19
|
+
no-repeat;
|
|
20
|
+
}
|
|
21
|
+
@media (max-width: 840px) {
|
|
22
|
+
html {
|
|
20
23
|
background:
|
|
21
|
-
linear-gradient(to bottom,
|
|
24
|
+
linear-gradient(to bottom, var(--g1), var(--g0)) 50% 50% / cover no-repeat;
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
body {
|