@umami/shiso 0.44.0 → 0.46.0
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/index.css +50 -50
- package/dist/index.d.ts +56 -56
- package/dist/index.js +8 -9
- package/dist/index.mjs +8 -10
- package/package.json +1 -1
- package/server/index.d.ts +30 -30
- package/styles.css +1180 -1278
- package/dist/server.d.ts +0 -45
- package/dist/server.js +0 -159
package/dist/server.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// Generated by dts-bundle v0.7.3
|
|
2
|
-
// Dependencies for this module:
|
|
3
|
-
// ../../react
|
|
4
|
-
// ../../@/lib/types
|
|
5
|
-
|
|
6
|
-
declare module '@umami/shiso/server' {
|
|
7
|
-
import { ReactElement } from 'react';
|
|
8
|
-
import type { ShisoConfig } from '@/lib/types';
|
|
9
|
-
export const getContent: (file: string) => Promise<{
|
|
10
|
-
path: string;
|
|
11
|
-
meta: {
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
};
|
|
14
|
-
content: string;
|
|
15
|
-
code: string;
|
|
16
|
-
anchors: {
|
|
17
|
-
name: string;
|
|
18
|
-
id: string;
|
|
19
|
-
size: number;
|
|
20
|
-
}[];
|
|
21
|
-
} | null>;
|
|
22
|
-
export function next(type: string, config: ShisoConfig): {
|
|
23
|
-
generateMetadata: ({ params }: {
|
|
24
|
-
params: Promise<{
|
|
25
|
-
slug: string[];
|
|
26
|
-
}>;
|
|
27
|
-
}) => Promise<{
|
|
28
|
-
title: {
|
|
29
|
-
absolute: string;
|
|
30
|
-
default: any;
|
|
31
|
-
};
|
|
32
|
-
}>;
|
|
33
|
-
generateStaticParams: () => Promise<any>;
|
|
34
|
-
renderPage: (render: ({ type, content, config, }: {
|
|
35
|
-
type: string;
|
|
36
|
-
content: any;
|
|
37
|
-
config: ShisoConfig;
|
|
38
|
-
}) => ReactElement) => ({ params }: {
|
|
39
|
-
params: Promise<{
|
|
40
|
-
slug: string[];
|
|
41
|
-
}>;
|
|
42
|
-
}) => Promise<ReactElement<unknown, string | import("react").JSXElementConstructor<any>>>;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
package/dist/server.js
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { cache } from 'react';
|
|
38
|
-
import { compile } from '@mdx-js/mdx';
|
|
39
|
-
import remarkGfm from 'remark-gfm';
|
|
40
|
-
import rehypeHighlight from 'rehype-highlight';
|
|
41
|
-
import matter from 'gray-matter';
|
|
42
|
-
import fs from 'node:fs/promises';
|
|
43
|
-
import path from 'node:path';
|
|
44
|
-
import recursive from 'recursive-readdir';
|
|
45
|
-
export var getContent = cache(function (file) { return __awaiter(void 0, void 0, void 0, function () {
|
|
46
|
-
var postContent, _a, frontmatter, mdxContent, anchors_1, modifiedContent, code, _b, _c;
|
|
47
|
-
return __generator(this, function (_d) {
|
|
48
|
-
switch (_d.label) {
|
|
49
|
-
case 0:
|
|
50
|
-
_d.trys.push([0, 3, , 4]);
|
|
51
|
-
return [4 /*yield*/, fs.readFile(file, 'utf8')];
|
|
52
|
-
case 1:
|
|
53
|
-
postContent = _d.sent();
|
|
54
|
-
_a = matter(postContent), frontmatter = _a.data, mdxContent = _a.content;
|
|
55
|
-
anchors_1 = [];
|
|
56
|
-
modifiedContent = mdxContent
|
|
57
|
-
.split('\n')
|
|
58
|
-
.map(function (line) {
|
|
59
|
-
var match = line.match(/^(#+)\s+(.*)/);
|
|
60
|
-
if (match) {
|
|
61
|
-
var num = match[1], name_1 = match[2];
|
|
62
|
-
var id = name_1.toLowerCase().replace(/\s+/g, '-');
|
|
63
|
-
var size = num.length;
|
|
64
|
-
anchors_1.push({ name: name_1, id: id, size: size });
|
|
65
|
-
return "<h".concat(size, " id=\"").concat(id, "\">").concat(name_1.replace(/\{|\}/g, ''), "</h").concat(size, ">");
|
|
66
|
-
}
|
|
67
|
-
return line;
|
|
68
|
-
})
|
|
69
|
-
.join('\n');
|
|
70
|
-
_b = String;
|
|
71
|
-
return [4 /*yield*/, compile(modifiedContent, {
|
|
72
|
-
outputFormat: 'function-body',
|
|
73
|
-
remarkPlugins: [remarkGfm],
|
|
74
|
-
rehypePlugins: [rehypeHighlight],
|
|
75
|
-
})];
|
|
76
|
-
case 2:
|
|
77
|
-
code = _b.apply(void 0, [_d.sent()]);
|
|
78
|
-
return [2 /*return*/, {
|
|
79
|
-
path: file,
|
|
80
|
-
meta: frontmatter,
|
|
81
|
-
content: postContent,
|
|
82
|
-
code: code,
|
|
83
|
-
anchors: anchors_1,
|
|
84
|
-
}];
|
|
85
|
-
case 3:
|
|
86
|
-
_c = _d.sent();
|
|
87
|
-
return [2 /*return*/, null];
|
|
88
|
-
case 4: return [2 /*return*/];
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}); });
|
|
92
|
-
export function next(type, config) {
|
|
93
|
-
var dir = path.join(config.contentDir, type);
|
|
94
|
-
var _a = config[type].title, title = _a === void 0 ? 'Shiso' : _a;
|
|
95
|
-
function generateMetadata(_a) {
|
|
96
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
97
|
-
var name, file, content;
|
|
98
|
-
var _c, _d, _e;
|
|
99
|
-
var params = _b.params;
|
|
100
|
-
return __generator(this, function (_f) {
|
|
101
|
-
switch (_f.label) {
|
|
102
|
-
case 0: return [4 /*yield*/, params];
|
|
103
|
-
case 1:
|
|
104
|
-
name = ((_d = (_c = (_f.sent())) === null || _c === void 0 ? void 0 : _c.slug) === null || _d === void 0 ? void 0 : _d.join('/')) || 'index';
|
|
105
|
-
file = path.join(dir, "".concat(name, ".mdx"));
|
|
106
|
-
return [4 /*yield*/, getContent(file)];
|
|
107
|
-
case 2:
|
|
108
|
-
content = _f.sent();
|
|
109
|
-
return [2 /*return*/, {
|
|
110
|
-
title: {
|
|
111
|
-
absolute: "".concat((_e = content === null || content === void 0 ? void 0 : content.meta) === null || _e === void 0 ? void 0 : _e.title, " \u2013 ").concat(title),
|
|
112
|
-
default: title,
|
|
113
|
-
},
|
|
114
|
-
}];
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
function generateStaticParams() {
|
|
120
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
-
var files;
|
|
122
|
-
return __generator(this, function (_a) {
|
|
123
|
-
switch (_a.label) {
|
|
124
|
-
case 0: return [4 /*yield*/, recursive(dir)];
|
|
125
|
-
case 1:
|
|
126
|
-
files = _a.sent();
|
|
127
|
-
return [2 /*return*/, files
|
|
128
|
-
.map(function (file) {
|
|
129
|
-
return file.replace('.mdx', '').replace(dir, '').replace(/\\/g, '/').replace(/^\//, '');
|
|
130
|
-
})
|
|
131
|
-
.map(function (id) { return ({
|
|
132
|
-
id: id.split('/'),
|
|
133
|
-
}); })];
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
function renderPage(render) {
|
|
139
|
-
var _this = this;
|
|
140
|
-
return function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
141
|
-
var name, file, content;
|
|
142
|
-
var _c, _d;
|
|
143
|
-
var params = _b.params;
|
|
144
|
-
return __generator(this, function (_e) {
|
|
145
|
-
switch (_e.label) {
|
|
146
|
-
case 0: return [4 /*yield*/, params];
|
|
147
|
-
case 1:
|
|
148
|
-
name = ((_d = (_c = (_e.sent())) === null || _c === void 0 ? void 0 : _c.slug) === null || _d === void 0 ? void 0 : _d.join('/')) || 'index';
|
|
149
|
-
file = path.join(dir, "".concat(name, ".mdx"));
|
|
150
|
-
return [4 /*yield*/, getContent(file)];
|
|
151
|
-
case 2:
|
|
152
|
-
content = _e.sent();
|
|
153
|
-
return [2 /*return*/, render({ type: type, content: content, config: config })];
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
}); };
|
|
157
|
-
}
|
|
158
|
-
return { generateMetadata: generateMetadata, generateStaticParams: generateStaticParams, renderPage: renderPage };
|
|
159
|
-
}
|