feat: compile ts through tsdown (#18908)

* feat: build ts via tsdown

* feat: exec tsdown

* fix

* fix

* fix

* feat: use tsdown shims

* chore: run rolldown lifecycle script

* fix: use shims

---------
This commit is contained in:
DIYgod
2025-04-22 22:29:11 +08:00
committed by GitHub
parent ebae0a4b5b
commit 83e701b592
596 changed files with 211 additions and 1398 deletions
+1
View File
@@ -2,3 +2,4 @@ lib/routes-deprecated
lib/router.js
babel.config.js
scripts/docker/minify-docker.js
dist
+1
View File
@@ -29,6 +29,7 @@ export default [{
'lib/router.js',
'**/babel.config.js',
'scripts/docker/minify-docker.js',
'dist',
],
}, ...compat.extends(
'eslint:recommended',
+11 -3
View File
@@ -27,8 +27,10 @@ let namespaces: Record<
> = {};
switch (process.env.NODE_ENV) {
case 'test':
case 'production':
namespaces = (await import('../assets/build/routes.js')).default;
break;
case 'test':
// @ts-expect-error
namespaces = await import('../assets/build/routes.json');
break;
@@ -89,6 +91,7 @@ const sortRoutes = (
string,
Route & {
location: string;
module?: () => Promise<{ route: Route }>;
}
>
) =>
@@ -126,8 +129,13 @@ for (const namespace in namespaces) {
const wrappedHandler: Handler = async (ctx) => {
if (!ctx.get('data')) {
if (typeof routeData.handler !== 'function') {
const { route } = await import(`./routes/${namespace}/${routeData.location}`);
routeData.handler = route.handler;
if (process.env.NODE_ENV === 'test') {
const { route } = await import(`./routes/${namespace}/${routeData.location}`);
routeData.handler = route.handler;
} else if (routeData.module) {
const { route } = await routeData.module();
routeData.handler = route.handler;
}
}
ctx.set('data', await routeData.handler(ctx));
}
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import { getSubPath } from '@/utils/common-utils';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import { getSubPath } from '@/utils/common-utils';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { art } from '@/utils/render';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { art } from '@/utils/render';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { config } from '@/config';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import path from 'node:path';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { art } from '@/utils/render';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { config } from '@/config';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-3
View File
@@ -1,6 +1,3 @@
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { load } from 'cheerio';
import { art } from '@/utils/render';
-3
View File
@@ -1,6 +1,3 @@
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
import { load } from 'cheerio';
-3
View File
@@ -2,7 +2,6 @@ import { type Data, type DataItem, type Route, ViewType } from '@/types';
import { art } from '@/utils/render';
import cache from '@/utils/cache';
import { getCurrentPath } from '@/utils/helpers';
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
@@ -10,8 +9,6 @@ import { type CheerioAPI, type Cheerio, type Element, load } from 'cheerio';
import { type Context } from 'hono';
import path from 'node:path';
const __dirname = getCurrentPath(import.meta.url);
export const handler = async (ctx: Context): Promise<Data> => {
const { category = 'newly' } = ctx.req.param();
const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10);
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { art } from '@/utils/render';
-3
View File
@@ -1,6 +1,3 @@
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
+1 -3
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { load } from 'cheerio';
@@ -98,7 +96,7 @@ export const route: Route = {
Fill in the field in the path with the part of the corresponding page URL after \`https://1x.com/gallery/\` or \`https://1x.com/photo/\`. Here are the examples:
If you subscribe to [Abstract Awarded](https://1x.com/gallery/abstract/awarded), you should fill in the path with the part \`abstract/awarded\` from the page URL \`https://1x.com/gallery/abstract/awarded\`. In this case, the route will be [\`/1x/abstract/awarded\`](https://rsshub.app/1x/abstract/awarded).
If you subscribe to [Wildlife Published](https://1x.com/gallery/wildlife/published), you should fill in the path with the part \`wildlife/published\` from the page URL \`https://1x.com/gallery/wildlife/published\`. In this case, the route will be [\`/1x/wildlife/published\`](https://rsshub.app/1x/wildlife/published).
:::`,
categories: ['design', 'picture'],
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import ofetch from '@/utils/ofetch';
-2
View File
@@ -1,12 +1,10 @@
import { Data, DataItem, Route } from '@/types';
import got from '@/utils/got';
import { getCurrentPath } from '@/utils/helpers';
import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
import { load } from 'cheerio';
import { Context } from 'hono';
import path from 'node:path';
const __dirname = getCurrentPath(import.meta.url);
export const route: Route = {
path: '/:filters?/:order?',
+6 -8
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
@@ -135,23 +133,23 @@ export const route: Route = {
| [安卓软件](https://www.423down.com/apk) |
| --------------------------------------- |
| [apk](https://rsshub.app/423down/apk) |
#### 电脑软件
| [原创软件](https://www.423down.com/zd423) | [媒体播放](https://www.423down.com/multimedia) | [网页浏览](https://www.423down.com/browser) | [图形图像](https://www.423down.com/image) | [聊天软件](https://www.423down.com/im) |
| ----------------------------------------- | --------------------------------------------------- | --------------------------------------------- | ----------------------------------------- | -------------------------------------- |
| [zd423](https://rsshub.app/423down/zd423) | [multimedia](https://rsshub.app/423down/multimedia) | [browser](https://rsshub.app/423down/browser) | [image](https://rsshub.app/423down/image) | [im](https://rsshub.app/423down/im) |
| [办公软件](https://www.423down.com/work) | [上传下载](https://www.423down.com/down) | [实用软件](https://www.423down.com/softtool) | [系统辅助](https://www.423down.com/systemsoft) | [系统必备](https://www.423down.com/systemplus) |
| ---------------------------------------- | ---------------------------------------- | ----------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- |
| [work](https://rsshub.app/423down/work) | [down](https://rsshub.app/423down/down) | [softtool](https://rsshub.app/423down/softtool) | [systemsoft](https://rsshub.app/423down/systemsoft) | [systemplus](https://rsshub.app/423down/systemplus) |
| [安全软件](https://www.423down.com/security) | [补丁相关](https://www.423down.com/patch) | [硬件相关](https://www.423down.com/hardware) |
| ----------------------------------------------- | ----------------------------------------- | ----------------------------------------------- |
| [security](https://rsshub.app/423down/security) | [patch](https://rsshub.app/423down/patch) | [hardware](https://rsshub.app/423down/hardware) |
#### 操作系统
| [Windows 11](https://www.423down.com/win11) | [Windows 10](https://www.423down.com/win10) | [Windows 7](https://www.423down.com/win7) | [Windows XP](https://www.423down.com/win7/winxp) | [WinPE](https://www.423down.com/pe-system) |
| ------------------------------------------- | ------------------------------------------- | ----------------------------------------- | --------------------------------------------------- | ------------------------------------------------- |
| [win11](https://rsshub.app/423down/win11) | [win10](https://rsshub.app/423down/win10) | [win7](https://rsshub.app/423down/win7) | [win7/winxp](https://rsshub.app/423down/win7/winxp) | [pe-system](https://rsshub.app/423down/pe-system) |
-3
View File
@@ -1,6 +1,3 @@
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import path from 'node:path';
import { art } from '@/utils/render';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import ofetch from '@/utils/ofetch';
-2
View File
@@ -1,6 +1,4 @@
import { Route, ViewType } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
-3
View File
@@ -1,6 +1,3 @@
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { load } from 'cheerio';
import iconv from 'iconv-lite';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import path from 'node:path';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-3
View File
@@ -1,6 +1,3 @@
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
import { load } from 'cheerio';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import ofetch from '@/utils/ofetch';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import { load } from 'cheerio';
-3
View File
@@ -2,7 +2,6 @@ import { type Data, type DataItem, type Route, ViewType } from '@/types';
import { art } from '@/utils/render';
import cache from '@/utils/cache';
import { getCurrentPath } from '@/utils/helpers';
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';
@@ -11,8 +10,6 @@ import { type CheerioAPI, type Cheerio, type Element, load } from 'cheerio';
import { type Context } from 'hono';
import path from 'node:path';
const __dirname = getCurrentPath(import.meta.url);
export const handler = async (ctx: Context): Promise<Data> => {
const limit: number = Number.parseInt(ctx.req.query('limit') ?? '24', 10);
-3
View File
@@ -2,7 +2,6 @@ import { type Data, type DataItem, type Route, ViewType } from '@/types';
import { art } from '@/utils/render';
import cache from '@/utils/cache';
import { getCurrentPath } from '@/utils/helpers';
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';
@@ -11,8 +10,6 @@ import { type CheerioAPI, type Cheerio, type Element, load } from 'cheerio';
import { type Context } from 'hono';
import path from 'node:path';
const __dirname = getCurrentPath(import.meta.url);
export const handler = async (ctx: Context): Promise<Data> => {
const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10);
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-3
View File
@@ -1,6 +1,3 @@
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import { load } from 'cheerio';
import ofetch from '@/utils/ofetch';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-3
View File
@@ -1,6 +1,3 @@
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import ofetch from '@/utils/ofetch';
import { CheerioAPI } from 'cheerio';
import timezone from '@/utils/timezone';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
-3
View File
@@ -1,6 +1,3 @@
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import path from 'node:path';
import { art } from '@/utils/render';
-3
View File
@@ -7,13 +7,10 @@ import { type DataItem, type Route, type Data, ViewType } from '@/types';
import { art } from '@/utils/render';
import cache from '@/utils/cache';
import { getCurrentPath } from '@/utils/helpers';
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';
const __dirname = getCurrentPath(import.meta.url);
export const handler = async (ctx: Context): Promise<Data> => {
const { category = 'new' } = ctx.req.param();
const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10);
-3
View File
@@ -7,12 +7,9 @@ import { type DataItem, type Route, type Data, ViewType } from '@/types';
import { art } from '@/utils/render';
import cache from '@/utils/cache';
import { getCurrentPath } from '@/utils/helpers';
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
const __dirname = getCurrentPath(import.meta.url);
export const handler = async (ctx: Context): Promise<Data> => {
const { category } = ctx.req.param();
const limit: number = Number.parseInt(ctx.req.query('limit') ?? '1', 10);
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import { getSubPath } from '@/utils/common-utils';
import cache from '@/utils/cache';
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { art } from '@/utils/render';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-2
View File
@@ -1,14 +1,12 @@
import { Data, DataItem, Route } from '@/types';
import cache from '@/utils/cache';
import got, { Options } from '@/utils/got';
import { getCurrentPath } from '@/utils/helpers';
import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
import { load } from 'cheerio';
import dayjs from 'dayjs';
import { Context } from 'hono';
import path from 'node:path';
const __dirname = getCurrentPath(import.meta.url);
export const route: Route = {
path: '/programs',
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import { getSubPath } from '@/utils/common-utils';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { art } from '@/utils/render';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { art } from '@/utils/render';
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { load } from 'cheerio';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-3
View File
@@ -2,7 +2,6 @@ import { type Data, type DataItem, type Route, ViewType } from '@/types';
import { art } from '@/utils/render';
import cache from '@/utils/cache';
import { getCurrentPath } from '@/utils/helpers';
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
@@ -10,8 +9,6 @@ import { type CheerioAPI, type Cheerio, type Element, load } from 'cheerio';
import { type Context } from 'hono';
import path from 'node:path';
const __dirname = getCurrentPath(import.meta.url);
export const handler = async (ctx: Context): Promise<Data> => {
const { category = 'all' } = ctx.req.param();
const limit: number = Number.parseInt(ctx.req.query('limit') ?? '10', 10);
-3
View File
@@ -2,7 +2,6 @@ import { type Data, type DataItem, type Route, ViewType } from '@/types';
import { art } from '@/utils/render';
import cache from '@/utils/cache';
import { getCurrentPath } from '@/utils/helpers';
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
@@ -10,8 +9,6 @@ import { type CheerioAPI, type Cheerio, type Element, load } from 'cheerio';
import { type Context } from 'hono';
import path from 'node:path';
const __dirname = getCurrentPath(import.meta.url);
export const handler = async (ctx: Context): Promise<Data> => {
const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10);
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
+1 -2
View File
@@ -5,9 +5,8 @@ import path from 'node:path';
import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
import timezone from '@/utils/timezone';
import { getCurrentPath } from '@/utils/helpers';
const render = (work: Work, link: string) => art(path.join(getCurrentPath(import.meta.url), 'templates', 'work.art'), { work, link });
const render = (work: Work, link: string) => art(path.join(__dirname, 'templates/work.art'), { work, link });
export const route: Route = {
path: '/works/:order?/:subtitle?/:sort?',
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
-2
View File
@@ -1,6 +1,4 @@
import { Route, ViewType } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { art } from '@/utils/render';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import { load } from 'cheerio';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import { load } from 'cheerio';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { load } from 'cheerio';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { load } from 'cheerio';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { art } from '@/utils/render';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import getData from './_base';
-3
View File
@@ -1,6 +1,3 @@
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
@@ -6,9 +6,6 @@ import { config } from '@/config';
import { art } from '@/utils/render';
import path from 'node:path';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
// 合并不同 subjectType 的 type 映射
const getTypeNames = (subjectType) => {
const commonTypeNames = {
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
+1 -4
View File
@@ -7,9 +7,6 @@ import path from 'node:path';
import { Media, PostResponse } from './types';
import { config } from '@/config';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
export const route: Route = {
path: '/post/list/:sort?',
example: '/bc3ts/post/list',
@@ -31,7 +28,7 @@ export const route: Route = {
const baseUrl = 'https://web.bc3ts.net';
const renderMedia = (media: Media[]) => art(path.join(__dirname, 'templates', 'media.art'), { media });
const renderMedia = (media: Media[]) => art(path.join(__dirname, 'templates/media.art'), { media });
async function handler(ctx) {
const { sort = '1' } = ctx.req.param();
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-2
View File
@@ -5,9 +5,7 @@ import { parseDate } from '@/utils/parse-date';
import crypto from 'node:crypto';
import path from 'node:path';
import { art } from '@/utils/render';
import { getCurrentPath } from '@/utils/helpers';
import { getAppreciatedQuery, getProfileProjectsAndSelectionsQuery, getProjectPageQuery } from './queries';
const __dirname = getCurrentPath(import.meta.url);
export const route: Route = {
path: '/:user/:type?',
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import path from 'node:path';
-3
View File
@@ -1,6 +1,3 @@
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import { config } from '@/config';
import md5 from '@/utils/md5';
import ofetch from '@/utils/ofetch';
+2 -2
View File
@@ -2,8 +2,8 @@ import { Route } from '@/types';
import parser from '@/utils/rss-parser';
import { parseDate } from '@/utils/parse-date';
import dayjs from 'dayjs';
import localizedFormat from 'dayjs/plugin/localizedFormat';
import 'dayjs/locale/zh-cn';
import localizedFormat from 'dayjs/plugin/localizedFormat.js';
import 'dayjs/locale/zh-cn.js';
dayjs.extend(localizedFormat);
export const route: Route = {
-3
View File
@@ -1,6 +1,3 @@
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import { load } from 'cheerio';
import path from 'node:path';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import queryString from 'query-string';
-2
View File
@@ -1,6 +1,4 @@
import { Route, ViewType } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import { parseDate } from '@/utils/parse-date';
-2
View File
@@ -1,6 +1,4 @@
import { Route, ViewType } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import { parseDate } from '@/utils/parse-date';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-2
View File
@@ -6,8 +6,6 @@ import timezone from '@/utils/timezone';
import cache from '@/utils/cache';
import { art } from '@/utils/render';
import path from 'node:path';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
interface Book {
bibId: string;
-3
View File
@@ -1,6 +1,3 @@
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import { load } from 'cheerio';
import got from '@/utils/got';
import { art } from '@/utils/render';
-3
View File
@@ -1,6 +1,3 @@
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
import { load } from 'cheerio';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-3
View File
@@ -1,6 +1,3 @@
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { load } from 'cheerio';
import { art } from '@/utils/render';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';
-3
View File
@@ -2,13 +2,10 @@ import type { Data, DataItem, Route } from '@/types';
import type { PostsResponse } from './types';
import { customFetch, parseUserData } from './utils';
import { API_HOST, CDN_HOST, HOST } from './constant';
import { getCurrentPath } from '@/utils/helpers';
import { art } from '@/utils/render';
import { parseDate } from '@/utils/parse-date';
import path from 'node:path';
const __dirname = getCurrentPath(import.meta.url);
export const route: Route = {
path: ['/likes/:user'],
categories: ['social-media', 'popular'],
-3
View File
@@ -2,13 +2,10 @@ import type { Data, DataItem, Route } from '@/types';
import type { PostsResponse } from './types';
import { customFetch, parseUserData } from './utils';
import { API_HOST, CDN_HOST, HOST } from './constant';
import { getCurrentPath } from '@/utils/helpers';
import { art } from '@/utils/render';
import { parseDate } from '@/utils/parse-date';
import path from 'node:path';
const __dirname = getCurrentPath(import.meta.url);
export const route: Route = {
path: ['/timeline/:user'],
categories: ['social-media', 'popular'],
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import { load } from 'cheerio';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import { getSubPath } from '@/utils/common-utils';
import got from '@/utils/got';
-2
View File
@@ -1,6 +1,4 @@
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import cache from '@/utils/cache';
import got from '@/utils/got';

Some files were not shown because too many files have changed in this diff Show More