@alauda/doom 1.10.12 → 1.12.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/assets/alert.svg +1 -0
- package/assets/angle-down.svg +1 -0
- package/assets/assistant.svg +1 -0
- package/assets/close.svg +1 -0
- package/assets/logout.svg +1 -0
- package/assets/new-chat.svg +1 -0
- package/assets/question-circle.svg +1 -0
- package/assets/send.svg +1 -0
- package/lib/cli/export.js +1 -1
- package/lib/cli/load-config.js +11 -6
- package/lib/global/Intelligence/AIAssistant/Chat/ChatRefDocs/index.d.ts +5 -0
- package/lib/global/Intelligence/AIAssistant/Chat/ChatRefDocs/index.js +16 -0
- package/lib/global/Intelligence/AIAssistant/Chat/ThinkingProcess/index.d.ts +4 -0
- package/lib/global/Intelligence/AIAssistant/Chat/ThinkingProcess/index.js +6 -0
- package/lib/global/Intelligence/AIAssistant/Chat/index.d.ts +7 -0
- package/lib/global/Intelligence/AIAssistant/Chat/index.js +8 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/ApiErrorAlert/index.d.ts +5 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/ApiErrorAlert/index.js +22 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/Button/index.d.ts +8 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/Button/index.js +5 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/CaptchaInput/index.d.ts +10 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/CaptchaInput/index.js +14 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/FocusInput/index.d.ts +6 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/FocusInput/index.js +19 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/FormItem/index.d.ts +16 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/FormItem/index.js +27 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/Input/index.d.ts +7 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/Input/index.js +5 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/LoginForm/index.d.ts +3 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/LoginForm/index.js +88 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/LoginForm/types.d.ts +18 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/LoginForm/utils.d.ts +3 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/LoginForm/utils.js +7 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/Radio.d.ts +7 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/Radio.js +11 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/RadioGroup.d.ts +11 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/RadioGroup.js +21 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/context.d.ts +7 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/context.js +2 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/index.d.ts +2 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/Radio/index.js +2 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/index.d.ts +4 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/index.js +10 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/types.d.ts +9 -0
- package/lib/global/Intelligence/AIAssistant/Preamble/types.js +1 -0
- package/lib/global/Intelligence/AIAssistant/ResizableUserInput/index.d.ts +8 -0
- package/lib/global/Intelligence/AIAssistant/ResizableUserInput/index.js +54 -0
- package/lib/global/Intelligence/AIAssistant/Thinking.d.ts +1 -0
- package/lib/global/Intelligence/AIAssistant/Thinking.js +15 -0
- package/lib/global/Intelligence/AIAssistant/index.d.ts +6 -0
- package/lib/global/Intelligence/AIAssistant/index.js +122 -0
- package/lib/global/Intelligence/AIAssistant/types.d.ts +14 -0
- package/lib/global/Intelligence/AIAssistant/types.js +1 -0
- package/lib/global/Intelligence/AIAssistant/utils.d.ts +8 -0
- package/lib/global/Intelligence/AIAssistant/utils.js +29 -0
- package/lib/global/Intelligence/constants.d.ts +6 -0
- package/lib/global/Intelligence/constants.js +21 -0
- package/lib/global/Intelligence/context.d.ts +18 -0
- package/lib/global/Intelligence/context.js +31 -0
- package/lib/global/Intelligence/index.d.ts +2 -0
- package/lib/global/Intelligence/index.js +33 -0
- package/lib/global/Intelligence/types.d.ts +32 -0
- package/lib/global/Intelligence/types.js +6 -0
- package/lib/global/Intelligence/utils.d.ts +3 -0
- package/lib/global/Intelligence/utils.js +32 -0
- package/lib/global/VersionsNav/NavMenuSingleItem.js +2 -2
- package/lib/plugins/index.d.ts +0 -1
- package/lib/plugins/index.js +0 -1
- package/lib/runtime/components/OpenAPIPath.js +2 -3
- package/lib/runtime/components/Overview.js +3 -6
- package/lib/runtime/components/_utils.d.ts +1 -1
- package/lib/runtime/components/_utils.js +2 -4
- package/lib/runtime/hooks/index.d.ts +5 -3
- package/lib/runtime/hooks/index.js +5 -3
- package/lib/runtime/hooks/useInterval.d.ts +1 -0
- package/lib/runtime/hooks/useInterval.js +19 -0
- package/lib/runtime/hooks/useMemoizedFn.d.ts +1 -0
- package/lib/runtime/hooks/useMemoizedFn.js +12 -0
- package/lib/runtime/hooks/useTranslation.d.ts +1 -1
- package/lib/runtime/translation.d.ts +148 -0
- package/lib/runtime/translation.js +111 -0
- package/package.json +32 -30
- package/styles/ai-assistant.module.scss +61 -0
- package/styles/chat-ref-docs.module.scss +50 -0
- package/styles/chat.module.scss +72 -0
- package/styles/global.scss +2 -0
- package/styles/intelligence.module.scss +26 -0
- package/styles/intelligence.scss +168 -0
- package/styles/preamble.module.scss +27 -0
- package/styles/resizable-user-input.module.scss +60 -0
- package/LICENSE +0 -21
- package/README.md +0 -29
- package/lib/cli/export-pdf-core/generatePdf.d.ts +0 -25
- package/lib/cli/export-pdf-core/generatePdf.js +0 -91
- package/lib/cli/export-pdf-core/index.d.ts +0 -3
- package/lib/cli/export-pdf-core/index.js +0 -3
- package/lib/cli/export-pdf-core/types.d.ts +0 -15
- package/lib/cli/export-pdf-core/utils/convertPathToPosix.d.ts +0 -8
- package/lib/cli/export-pdf-core/utils/convertPathToPosix.js +0 -26
- package/lib/cli/export-pdf-core/utils/getUrlLink.d.ts +0 -4
- package/lib/cli/export-pdf-core/utils/getUrlLink.js +0 -7
- package/lib/cli/export-pdf-core/utils/index.d.ts +0 -3
- package/lib/cli/export-pdf-core/utils/index.js +0 -3
- package/lib/cli/export-pdf-core/utils/mergePDF.d.ts +0 -26
- package/lib/cli/export-pdf-core/utils/mergePDF.js +0 -137
- package/lib/cli/html-export-pdf/core/index.d.ts +0 -3
- package/lib/cli/html-export-pdf/core/index.js +0 -3
- package/lib/cli/html-export-pdf/core/outline.d.ts +0 -47
- package/lib/cli/html-export-pdf/core/outline.js +0 -217
- package/lib/cli/html-export-pdf/core/postprocesser.d.ts +0 -14
- package/lib/cli/html-export-pdf/core/postprocesser.js +0 -36
- package/lib/cli/html-export-pdf/core/printer.d.ts +0 -59
- package/lib/cli/html-export-pdf/core/printer.js +0 -235
- package/lib/cli/html-export-pdf/index.d.ts +0 -2
- package/lib/cli/html-export-pdf/index.js +0 -2
- package/lib/cli/html-export-pdf/utils/cliProgress.d.ts +0 -13
- package/lib/cli/html-export-pdf/utils/cliProgress.js +0 -80
- package/lib/cli/html-export-pdf/utils/fs.d.ts +0 -5
- package/lib/cli/html-export-pdf/utils/fs.js +0 -18
- package/lib/cli/html-export-pdf/utils/getAbsFileName.d.ts +0 -1
- package/lib/cli/html-export-pdf/utils/getAbsFileName.js +0 -4
- package/lib/cli/html-export-pdf/utils/getDirname.d.ts +0 -1
- package/lib/cli/html-export-pdf/utils/getDirname.js +0 -5
- package/lib/cli/html-export-pdf/utils/index.d.ts +0 -7
- package/lib/cli/html-export-pdf/utils/index.js +0 -7
- package/lib/cli/html-export-pdf/utils/isValidUrl.d.ts +0 -1
- package/lib/cli/html-export-pdf/utils/isValidUrl.js +0 -3
- package/lib/cli/html-export-pdf/utils/optionsCustomProcessing.d.ts +0 -2
- package/lib/cli/html-export-pdf/utils/optionsCustomProcessing.js +0 -6
- package/lib/cli/html-export-pdf/utils/replaceExt.d.ts +0 -1
- package/lib/cli/html-export-pdf/utils/replaceExt.js +0 -19
- package/lib/cli/merge-pdfs/formatDate.d.ts +0 -1
- package/lib/cli/merge-pdfs/formatDate.js +0 -23
- package/lib/cli/merge-pdfs/index.d.ts +0 -8
- package/lib/cli/merge-pdfs/index.js +0 -62
- package/lib/plugins/sitemap/index.d.ts +0 -16
- package/lib/plugins/sitemap/index.js +0 -51
- package/pyodide/README.md +0 -90
- package/pyodide/console.html +0 -259
- package/pyodide/ffi.d.ts +0 -1118
- package/pyodide/micropip-0.8.0-py3-none-any.whl +0 -0
- package/pyodide/package.json +0 -59
- package/pyodide/packaging-24.2-py3-none-any.whl +0 -0
- package/pyodide/pyodide-lock.json +0 -1
- package/pyodide/pyodide.asm.js +0 -17
- package/pyodide/pyodide.asm.wasm +0 -0
- package/pyodide/pyodide.d.ts +0 -1627
- package/pyodide/pyodide.js +0 -6
- package/pyodide/pyodide.js.map +0 -1
- package/pyodide/pyodide.mjs +0 -4
- package/pyodide/pyodide.mjs.map +0 -1
- package/pyodide/pypdf-3.8.1-py3-none-any.whl +0 -0
- package/pyodide/python_stdlib.zip +0 -0
- package/pyodide/repodata.json +0 -1
- /package/lib/{cli/export-pdf-core → global/Intelligence/AIAssistant/Preamble/LoginForm}/types.js +0 -0
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { Presets, SingleBar } from 'cli-progress';
|
|
2
|
-
import { blue, cyan, dim, green, yellow } from 'yoctocolors';
|
|
3
|
-
function replaceTitle(title) {
|
|
4
|
-
return title.length ? `|| ${title}` : '';
|
|
5
|
-
}
|
|
6
|
-
export function createProgress(indeterminate = false) {
|
|
7
|
-
function getSpinner(n = 0) {
|
|
8
|
-
return [cyan('●'), green('◆'), blue('■'), yellow('▲')][n % 4];
|
|
9
|
-
}
|
|
10
|
-
let current = 0;
|
|
11
|
-
let spinner = 0;
|
|
12
|
-
let text = 'Generating';
|
|
13
|
-
let title = '';
|
|
14
|
-
let timer;
|
|
15
|
-
const progress = new SingleBar({
|
|
16
|
-
clearOnComplete: false,
|
|
17
|
-
hideCursor: true,
|
|
18
|
-
format: ` {spin} {text} ${indeterminate ? dim(yellow('...')) : ' {bar} {value}/{total}'} {title} `,
|
|
19
|
-
linewrap: false,
|
|
20
|
-
barsize: 30,
|
|
21
|
-
}, Presets.shades_grey);
|
|
22
|
-
return {
|
|
23
|
-
bar: progress,
|
|
24
|
-
start(total) {
|
|
25
|
-
progress.start(total, 0, {
|
|
26
|
-
spin: getSpinner(spinner),
|
|
27
|
-
text,
|
|
28
|
-
title: replaceTitle(title),
|
|
29
|
-
});
|
|
30
|
-
timer = setInterval(() => {
|
|
31
|
-
spinner += 1;
|
|
32
|
-
progress.update({
|
|
33
|
-
spin: getSpinner(spinner),
|
|
34
|
-
text,
|
|
35
|
-
title: replaceTitle(title),
|
|
36
|
-
});
|
|
37
|
-
}, 200);
|
|
38
|
-
},
|
|
39
|
-
updateNumber(v) {
|
|
40
|
-
current = v;
|
|
41
|
-
progress.update(v, {
|
|
42
|
-
spin: getSpinner(spinner),
|
|
43
|
-
text,
|
|
44
|
-
title: replaceTitle(title),
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
increment(step, { txt, headTitle } = {
|
|
48
|
-
txt: '',
|
|
49
|
-
headTitle: '',
|
|
50
|
-
}) {
|
|
51
|
-
text = txt?.length ? txt : text;
|
|
52
|
-
title = headTitle?.length ? headTitle : title;
|
|
53
|
-
progress.increment(step, {
|
|
54
|
-
spin: getSpinner(spinner),
|
|
55
|
-
text,
|
|
56
|
-
title: replaceTitle(title),
|
|
57
|
-
});
|
|
58
|
-
},
|
|
59
|
-
updateText(t) {
|
|
60
|
-
text = t;
|
|
61
|
-
progress.update(current, {
|
|
62
|
-
spin: getSpinner(spinner),
|
|
63
|
-
text,
|
|
64
|
-
title: replaceTitle(title),
|
|
65
|
-
});
|
|
66
|
-
},
|
|
67
|
-
updateTitle(t) {
|
|
68
|
-
title = t;
|
|
69
|
-
progress.update(current, {
|
|
70
|
-
spin: getSpinner(spinner),
|
|
71
|
-
text,
|
|
72
|
-
title: replaceTitle(title),
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
stop() {
|
|
76
|
-
clearInterval(timer);
|
|
77
|
-
progress.stop();
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { existsSync, promises as fs } from 'node:fs';
|
|
2
|
-
import { dirname } from 'node:path';
|
|
3
|
-
/**
|
|
4
|
-
* Write file safely
|
|
5
|
-
*/
|
|
6
|
-
export async function writeFileSafe(path, data = '') {
|
|
7
|
-
const directory = dirname(path);
|
|
8
|
-
if (!existsSync(directory)) {
|
|
9
|
-
await fs.mkdir(directory, { recursive: true });
|
|
10
|
-
}
|
|
11
|
-
try {
|
|
12
|
-
await fs.writeFile(path, data);
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getAbsFileName(metaURL: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getDirname(metaURL: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isValidUrl(url: string): boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function replaceExt(npath: string, ext: string): string;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
function startsWithSingleDot(filePath) {
|
|
3
|
-
const first2chars = filePath.slice(0, 2);
|
|
4
|
-
return first2chars === `.${path.sep}` || first2chars === './';
|
|
5
|
-
}
|
|
6
|
-
export function replaceExt(npath, ext) {
|
|
7
|
-
if (typeof npath !== 'string' || npath.length === 0) {
|
|
8
|
-
return npath;
|
|
9
|
-
}
|
|
10
|
-
const nFileName = path.basename(npath, path.extname(npath)) + ext;
|
|
11
|
-
const nFilepath = path.join(path.dirname(npath), nFileName);
|
|
12
|
-
// Because `path.join` removes the head './' from the given path.
|
|
13
|
-
// This removal can cause a problem when passing the result to `require` or
|
|
14
|
-
// `import`.
|
|
15
|
-
if (startsWithSingleDot(npath)) {
|
|
16
|
-
return `.${path.sep}${nFilepath}`;
|
|
17
|
-
}
|
|
18
|
-
return nFilepath;
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function formatDate(date: Date): string;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export function formatDate(date) {
|
|
2
|
-
const year = date.getFullYear();
|
|
3
|
-
const month = date.getMonth() + 1;
|
|
4
|
-
const day = date.getDate();
|
|
5
|
-
const hour = date.getHours();
|
|
6
|
-
const minute = date.getMinutes();
|
|
7
|
-
const second = date.getSeconds();
|
|
8
|
-
const paddedMonth = `00${month}`.slice(-2);
|
|
9
|
-
const paddedDay = `00${day}`.slice(-2);
|
|
10
|
-
const paddedHour = `00${hour}`.slice(-2);
|
|
11
|
-
const paddedMinute = `00${minute}`.slice(-2);
|
|
12
|
-
const paddedSecond = `00${second}`.slice(-2);
|
|
13
|
-
const str = `D:${year}${paddedMonth}${paddedDay}${paddedHour}${paddedMinute}${paddedSecond}`;
|
|
14
|
-
let offset = date.getTimezoneOffset();
|
|
15
|
-
const rel = offset === 0 ? 'Z' : offset > 0 ? '-' : '+';
|
|
16
|
-
offset = Math.abs(offset);
|
|
17
|
-
const hoursOffset = Math.floor(offset / 60);
|
|
18
|
-
const minutesOffset = offset - hoursOffset * 60;
|
|
19
|
-
const paddedHoursOffset = `00${hoursOffset}`.slice(-2);
|
|
20
|
-
const paddedMinutesOffset = `00${minutesOffset}`.slice(-2);
|
|
21
|
-
// D:YYYYMMDDHHmmSSOHH'mm'
|
|
22
|
-
return `${str}${rel}${paddedHoursOffset}'${paddedMinutesOffset}'`;
|
|
23
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @see https://www.uuidgenerator.net/version4
|
|
3
|
-
* UUID v4
|
|
4
|
-
*/
|
|
5
|
-
export declare const MERGE_PDF_NAME = "66699f18-ad5a-43c2-a96e-97bddaef0e6b.pdf";
|
|
6
|
-
export declare const MOUNT_DIR: string;
|
|
7
|
-
export declare function mergePDFs(entries: string[]): Promise<Uint8Array<ArrayBufferLike>>;
|
|
8
|
-
export default mergePDFs;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { yellowBright } from 'yoctocolors';
|
|
3
|
-
import _pyodide from '../../../pyodide/pyodide.js';
|
|
4
|
-
import { pkgResolve } from '../../utils/helpers.js';
|
|
5
|
-
import { formatDate } from './formatDate.js';
|
|
6
|
-
/**
|
|
7
|
-
* @see https://www.uuidgenerator.net/version4
|
|
8
|
-
* UUID v4
|
|
9
|
-
*/
|
|
10
|
-
export const MERGE_PDF_NAME = '66699f18-ad5a-43c2-a96e-97bddaef0e6b.pdf';
|
|
11
|
-
export const MOUNT_DIR = '/' + '991e729a-8f2e-472a-8402-c26bb03b5ea3';
|
|
12
|
-
export async function mergePDFs(entries) {
|
|
13
|
-
if (entries.length < 2) {
|
|
14
|
-
process.stdout.write(yellowBright('At least two PDF files.\n'));
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
const pyodideDir = pkgResolve('pyodide');
|
|
18
|
-
const pyodide = await _pyodide.loadPyodide({
|
|
19
|
-
indexURL: pyodideDir,
|
|
20
|
-
});
|
|
21
|
-
await pyodide.loadPackage('micropip');
|
|
22
|
-
const micropip = pyodide.pyimport('micropip');
|
|
23
|
-
pyodide.FS.mkdirTree(MOUNT_DIR);
|
|
24
|
-
pyodide.FS.mount(
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
26
|
-
pyodide.FS.filesystems.NODEFS, // type-coverage:ignore-line -- out of control
|
|
27
|
-
{ root: pyodideDir }, MOUNT_DIR);
|
|
28
|
-
/**
|
|
29
|
-
* @see https://github.com/pyodide/pyodide/issues/3246#issuecomment-1312210155
|
|
30
|
-
* You need to prefix the path with emfs: or it will be treated as a url
|
|
31
|
-
*/
|
|
32
|
-
await micropip.install(`emfs:${MOUNT_DIR}/pypdf-3.8.1-py3-none-any.whl`);
|
|
33
|
-
const tempFileNameArr = [];
|
|
34
|
-
entries.forEach((filePath) => {
|
|
35
|
-
const tempFileName = `/${filePath.split('/').join('-')}`;
|
|
36
|
-
tempFileNameArr.push(tempFileName);
|
|
37
|
-
pyodide.FS.writeFile(tempFileName, readFileSync(filePath));
|
|
38
|
-
});
|
|
39
|
-
const curDate = formatDate(new Date());
|
|
40
|
-
await pyodide.runPythonAsync(`
|
|
41
|
-
from pypdf import PdfWriter
|
|
42
|
-
from json import loads
|
|
43
|
-
|
|
44
|
-
writer = PdfWriter()
|
|
45
|
-
writer.add_metadata(
|
|
46
|
-
{
|
|
47
|
-
"/CreationDate": "${curDate}",
|
|
48
|
-
"/ModDate": "${curDate}",
|
|
49
|
-
"/Creator": "doom",
|
|
50
|
-
"/Producer": "pypdf - doom",
|
|
51
|
-
}
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
for path in loads('${JSON.stringify(tempFileNameArr)}'):
|
|
55
|
-
writer.append(path)
|
|
56
|
-
|
|
57
|
-
writer.write("/${MERGE_PDF_NAME}")
|
|
58
|
-
writer.close()
|
|
59
|
-
`);
|
|
60
|
-
return pyodide.FS.readFile(`/${MERGE_PDF_NAME}`);
|
|
61
|
-
}
|
|
62
|
-
export default mergePDFs;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type RspressPlugin } from '@rspress/core';
|
|
2
|
-
export type ChangeFreq = 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
|
|
3
|
-
export type Priority = '0.0' | '0.1' | '0.2' | '0.3' | '0.4' | '0.5' | '0.6' | '0.7' | '0.8' | '0.9' | '1.0';
|
|
4
|
-
export interface Sitemap {
|
|
5
|
-
loc: string;
|
|
6
|
-
lastmod?: string;
|
|
7
|
-
changefreq?: ChangeFreq;
|
|
8
|
-
priority?: Priority;
|
|
9
|
-
}
|
|
10
|
-
export interface Options {
|
|
11
|
-
domain?: string;
|
|
12
|
-
customMaps?: Record<string, Sitemap>;
|
|
13
|
-
defaultPriority?: Priority;
|
|
14
|
-
defaultChangeFreq?: ChangeFreq;
|
|
15
|
-
}
|
|
16
|
-
export declare function sitemapPlugin(options?: Options): RspressPlugin;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// based on https://github.com/jl917/rspress-plugin-sitemap/blob/master/src/index.ts
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import { dirname } from 'node:path';
|
|
4
|
-
import { logger } from '@rspress/core';
|
|
5
|
-
const generateNode = (sitemap) => {
|
|
6
|
-
let result = '<url>';
|
|
7
|
-
for (const [tag, value] of Object.entries(sitemap)) {
|
|
8
|
-
result += `<${tag}>${value}</${tag}>`;
|
|
9
|
-
}
|
|
10
|
-
result += '</url>';
|
|
11
|
-
return result;
|
|
12
|
-
};
|
|
13
|
-
const generateXml = (sitemaps) => {
|
|
14
|
-
logger.log(`Generate sitemap.xml for ${sitemaps.length} pages.`);
|
|
15
|
-
return `<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">${sitemaps.reduce((node, sitemap) => node + generateNode(sitemap), '')}</urlset>`;
|
|
16
|
-
};
|
|
17
|
-
export function sitemapPlugin(options) {
|
|
18
|
-
options = {
|
|
19
|
-
domain: 'https://rspress.dev',
|
|
20
|
-
customMaps: {},
|
|
21
|
-
defaultChangeFreq: 'monthly',
|
|
22
|
-
defaultPriority: '0.5',
|
|
23
|
-
...options,
|
|
24
|
-
};
|
|
25
|
-
const sitemaps = [];
|
|
26
|
-
const set = new Set();
|
|
27
|
-
return {
|
|
28
|
-
name: 'rspress-plugin-sitemap',
|
|
29
|
-
extendPageData(pageData, isProd) {
|
|
30
|
-
if (!isProd || set.has(pageData.routePath)) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
set.add(pageData.routePath);
|
|
34
|
-
sitemaps.push({
|
|
35
|
-
loc: `${options.domain}${pageData.routePath}`,
|
|
36
|
-
lastmod: fs.statSync(pageData._filepath).mtime.toISOString(),
|
|
37
|
-
priority: pageData.routePath === '/' ? '1.0' : options.defaultPriority,
|
|
38
|
-
changefreq: options.defaultChangeFreq,
|
|
39
|
-
...options.customMaps?.[pageData.routePath],
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
afterBuild(config, isProd) {
|
|
43
|
-
if (!isProd) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const outputPath = `${config.outDir || 'doc_build'}/sitemap.xml`;
|
|
47
|
-
fs.mkdirSync(dirname(outputPath), { recursive: true });
|
|
48
|
-
fs.writeFileSync(outputPath, generateXml(sitemaps));
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
}
|
package/pyodide/README.md
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
# Pyodide JavaScript package
|
|
2
|
-
|
|
3
|
-
<a href="https://www.npmjs.com/package/pyodide"><img src="https://img.shields.io/npm/v/pyodide" alt="npm"></a>
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
Download and extract Pyodide packages from [Github
|
|
8
|
-
releases](https://github.com/pyodide/pyodide/releases)
|
|
9
|
-
(`pyodide-build-*.tar.bz2`). The version of the release needs to match exactly the version of this package.
|
|
10
|
-
|
|
11
|
-
Then you can load Pyodide in Node.js as follows,
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
// hello_python.js
|
|
15
|
-
const { loadPyodide } = require("pyodide");
|
|
16
|
-
|
|
17
|
-
async function hello_python() {
|
|
18
|
-
let pyodide = await loadPyodide({
|
|
19
|
-
indexURL: "<pyodide artifacts folder>",
|
|
20
|
-
});
|
|
21
|
-
return pyodide.runPythonAsync("1+1");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
hello_python().then((result) => {
|
|
25
|
-
console.log("Python says that 1+1 =", result);
|
|
26
|
-
});
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
$ node hello_python.js
|
|
31
|
-
Loading distutils
|
|
32
|
-
Loaded distutils
|
|
33
|
-
Python says that 1+1= 2
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Or you can use the REPL. To start the Node.js REPL with support for top level
|
|
37
|
-
await, use `node --experimental-repl-await`:
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
$ node --experimental-repl-await
|
|
41
|
-
Welcome to Node.js v18.5.0.
|
|
42
|
-
Type ".help" for more information.
|
|
43
|
-
> const { loadPyodide } = require("pyodide");
|
|
44
|
-
undefined
|
|
45
|
-
> let pyodide = await loadPyodide();
|
|
46
|
-
Loading distutils
|
|
47
|
-
Loaded distutils
|
|
48
|
-
undefined
|
|
49
|
-
> await pyodide.runPythonAsync("1+1");
|
|
50
|
-
2
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Node.js versions <0.17
|
|
54
|
-
|
|
55
|
-
- `Node.js` versions 14.x and 16.x: to use certain features of Pyodide you
|
|
56
|
-
need to manually install `node-fetch`, e.g. by doing `npm install node-fetch`.
|
|
57
|
-
|
|
58
|
-
- `Node.js v14.x`: you need to pass the option `--experimental-wasm-bigint`
|
|
59
|
-
when starting Node. Note that this flag is not documented by `node --help`
|
|
60
|
-
and moreover, if you pass `--experimental-wasm-bigint` to node >14 it is an
|
|
61
|
-
error:
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
$ node -v
|
|
65
|
-
v14.20.0
|
|
66
|
-
|
|
67
|
-
$ node --experimental-wasm-bigint hello_python.js
|
|
68
|
-
warning: no blob constructor, cannot create blobs with mimetypes
|
|
69
|
-
warning: no BlobBuilder
|
|
70
|
-
Loading distutils
|
|
71
|
-
Loaded distutils
|
|
72
|
-
Python says that 1+1= 2
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
See the [documentation](https://pyodide.org/en/stable/) fore more details.
|
|
76
|
-
|
|
77
|
-
## Details
|
|
78
|
-
|
|
79
|
-
The JavaScript code in this package is responsible for the following tasks:
|
|
80
|
-
|
|
81
|
-
1. Defines the public [JavaScript API](https://pyodide.org/en/stable/usage/api/js-api.html)
|
|
82
|
-
- Package loading code to allow loading of other Python packages.
|
|
83
|
-
- Can load
|
|
84
|
-
[micropip](https://pyodide.org/en/stable/usage/api/micropip-api.html) to
|
|
85
|
-
bootstrap loading of pure Python wheels
|
|
86
|
-
2. Loads the CPython interpreter and the core/pyodide emscripten application
|
|
87
|
-
which embeds the interpreter.
|
|
88
|
-
3. Injects the `js/pyodide` JavaScript API into `sys.modules`. This is the
|
|
89
|
-
final runtime dependency for `core/pyodide` & `py/pyodide`, so after this step
|
|
90
|
-
the interpreter is fully up and running.
|