feat: support cache on cloudflare page

This commit is contained in:
Ou
2024-10-03 23:11:10 +08:00
parent ee93bf176e
commit f2711fd80f
8 changed files with 157 additions and 250 deletions
+10 -2
View File
@@ -9,6 +9,9 @@
"build": "vite build",
"lint": "eslint .",
"favicon": "tsx ./scripts/favicon.ts",
"start": "PORT=4444 node dist/output/server/index.mjs",
"preview": "CF_PAGES=1 pnpm run build && wrangler pages dev",
"deploy": "CF_PAGES=1 pnpm run build && wrangler pages deploy",
"test": "vitest"
},
"dependencies": {
@@ -20,14 +23,15 @@
"@tanstack/react-router": "^1.58.9",
"@tanstack/router-devtools": "^1.58.9",
"@unocss/reset": "^0.62.4",
"better-sqlite3": "^9.4.3",
"cheerio": "^1.0.0",
"clsx": "^2.1.1",
"dayjs": "^1.11.13",
"db0": "npm:@ourongxing/db0@latest",
"fast-xml-parser": "^4.5.0",
"favicons-scraper": "^1.3.2",
"iconv-lite": "^0.6.3",
"jotai": "^2.10.0",
"libsql": "^0.4.5",
"overlayscrollbars": "^2.10.0",
"overlayscrollbars-react": "^0.5.6",
"react": "^18.3.1",
@@ -48,7 +52,6 @@
"eslint": "^9.11.1",
"eslint-plugin-react-hooks": "^5.1.0-rc-778e1ed2-20240926",
"eslint-plugin-react-refresh": "^0.4.12",
"nitro-cloudflare-dev": "^0.1.6",
"nitropack": "^2.9.7",
"ofetch": "^1.4.0",
"tsx": "^4.19.1",
@@ -60,5 +63,10 @@
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^2.1.1",
"wrangler": "^3.79.0"
},
"pnpm": {
"overrides": {
"db0": "npm:@ourongxing/db0@latest"
}
}
}
+120 -230
View File
@@ -4,6 +4,9 @@ settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
overrides:
db0: npm:@ourongxing/db0@latest
importers:
.:
@@ -32,9 +35,6 @@ importers:
'@unocss/reset':
specifier: ^0.62.4
version: 0.62.4
better-sqlite3:
specifier: ^9.4.3
version: 9.6.0
cheerio:
specifier: ^1.0.0
version: 1.0.0
@@ -44,6 +44,9 @@ importers:
dayjs:
specifier: ^1.11.13
version: 1.11.13
db0:
specifier: npm:@ourongxing/db0@latest
version: '@ourongxing/[email protected]([email protected])'
fast-xml-parser:
specifier: ^4.5.0
version: 4.5.0
@@ -56,6 +59,9 @@ importers:
jotai:
specifier: ^2.10.0
version: 2.10.0(@types/[email protected])([email protected])
libsql:
specifier: ^0.4.5
version: 0.4.5
overlayscrollbars:
specifier: ^2.10.0
version: 2.10.0
@@ -111,12 +117,9 @@ importers:
eslint-plugin-react-refresh:
specifier: ^0.4.12
version: 0.4.12([email protected]([email protected]))
nitro-cloudflare-dev:
specifier: ^0.1.6
version: 0.1.6
nitropack:
specifier: ^2.9.7
version: 2.9.7([email protected])([email protected])([email protected])
version: 2.9.7([email protected])([email protected])([email protected])
ofetch:
specifier: ^1.4.0
version: 1.4.0
@@ -137,7 +140,7 @@ importers:
version: 5.4.8(@types/[email protected])([email protected])
vite-plugin-with-nitro:
specifier: 0.0.0-beta.4
version: 0.0.0-beta.4([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected]))
version: 0.0.0-beta.4([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected]))
vite-tsconfig-paths:
specifier: ^5.0.1
version: 5.0.1([email protected])([email protected](@types/[email protected])([email protected]))
@@ -1160,10 +1163,48 @@ packages:
'@jridgewell/[email protected]':
resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==}
'@libsql/[email protected]':
resolution: {integrity: sha512-xLdnn0NrgSk6OMi716FFs/27Hs33jtSd2fkKi/72Ey/qBtPWcB1BMurDQekzi0yAcfQTjGqIz7tpOibyjiEPyQ==}
cpu: [arm64]
os: [darwin]
'@libsql/[email protected]':
resolution: {integrity: sha512-rZsEWj0H7oCqd5Y2pe0RzKmuQXC2OB1RbnFy4CvjeAjT6MP6mFp+Vx9mTCAUuJMhuoSVMsFPUJRpAQznl9E3Tg==}
cpu: [x64]
os: [darwin]
'@libsql/[email protected]':
resolution: {integrity: sha512-VR09iu6KWGJ6fauCn59u/jJ9OA+/A2yQ0dr2HDN2zkRueLC6D2oGYt4gPfLZPFKf+WJpVMtIhNfd+Ru9MMaFkA==}
cpu: [arm64]
os: [linux]
'@libsql/[email protected]':
resolution: {integrity: sha512-74hvD5ej4rBshhxFGNYU16a3m8B/NjIPvhlZ/flG1Oeydfo6AuUXSSNFi+H5+zi9/uWuzyz5TLVeQcraoUV10A==}
cpu: [arm64]
os: [linux]
'@libsql/[email protected]':
resolution: {integrity: sha512-gb5WObGO3+rbuG8h9font1N02iF+zgYAgY0wNa8BNiZ5A9UolZKFxiqGFS7eHaAYfemHJKKTT+aAt3X2p5TibA==}
cpu: [x64]
os: [linux]
'@libsql/[email protected]':
resolution: {integrity: sha512-JfyE6OVC5X4Nr4cFF77VhB1o+hBRxAqYT9YdeqnWdAQSYc/ASi5HnRALLAQEsGacFPZZ32pixfraQmPE3iJFfw==}
cpu: [x64]
os: [linux]
'@libsql/[email protected]':
resolution: {integrity: sha512-57GGurNJhOhq3XIopLdGnCoQ4kQAcmbmzzFoC4tpvDE/KSbwZ/13zqJWhQA41nMGk/PKM1XKfKmbIybKx1+eqA==}
cpu: [x64]
os: [win32]
'@mapbox/[email protected]':
resolution: {integrity: sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==}
hasBin: true
'@neon-rs/[email protected]':
resolution: {integrity: sha512-kTPhdZyTQxB+2wpiRcFWrDcejc4JI6tkPuS7UZCG4l6Zvc5kU/gGQ/ozvHTh1XR5tS+UlfAfGuPajjzQjCiHCw==}
'@netlify/[email protected]':
resolution: {integrity: sha512-+6wtYdoz0yE06dSa9XkP47tw5zm6g13QMeCwM3MmHx1vn8hzwFa51JtmfraprdkL7amvb7gaNM+OOhQU1h6T8A==}
engines: {node: '>=14.0.0'}
@@ -1204,6 +1245,20 @@ packages:
resolution: {integrity: sha512-T8TbSnGsxo6TDBJx/Sgv/BlVJL3tshxZP7Aq5R1mSnM5OcHY2dQaxLMu2+E8u3gN0MLOzdjurqN4ZRVuzQycOQ==}
engines: {node: '>=8.0'}
'@ourongxing/[email protected]':
resolution: {integrity: sha512-Lm1BXhVZbuwd7rrJwQqv5JrKkq7KExzhu9WzSEwUEb0qUX7iM6P0V0bk4t0rR2y2DMlrbYDwzVaR5e8iKxy/QA==}
peerDependencies:
'@libsql/client': ^0.14.0
drizzle-orm: ^0.33.0
libsql: ^0.4.5
peerDependenciesMeta:
'@libsql/client':
optional: true
drizzle-orm:
optional: true
libsql:
optional: true
'@ourongxing/[email protected]':
resolution: {integrity: sha512-xxqpu/yvKwgl4hTe6dmlLbmsWO63rg0wt/RkCQmZv3+h9sLgsT8fUmOJRge/so/q/YKLYL0+Y6bJdPxXD3criQ==}
hasBin: true
@@ -2038,9 +2093,6 @@ packages:
[email protected]:
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
[email protected]:
resolution: {integrity: sha512-yR5HATnqeYNVnkaUTf4bOP2dJSnyhP4puJN/QPRyx4YkBEEUxib422n2XzPqDEHjQQqazoYoADdAm5vE15+dAQ==}
[email protected]:
resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==}
engines: {node: '>=8'}
@@ -2051,9 +2103,6 @@ packages:
[email protected]:
resolution: {integrity: sha512-VUpsf/qykW0heRlC8LooCq28Kxn3mAqKohhDG/49rrsQ1dT1CXyj/pgXS+5BSRzFTR/3DyIBOqQOrGyZOh71Aw==}
[email protected]:
resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==}
[email protected]:
resolution: {integrity: sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==}
@@ -2082,9 +2131,6 @@ packages:
[email protected]:
resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
[email protected]:
resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==}
[email protected]:
resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==}
@@ -2160,9 +2206,6 @@ packages:
resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==}
engines: {node: '>= 8.10.0'}
[email protected]:
resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==}
[email protected]:
resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==}
engines: {node: '>=10'}
@@ -2317,20 +2360,6 @@ packages:
[email protected]:
resolution: {integrity: sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==}
[email protected]:
resolution: {integrity: sha512-Ft6eCwONYxlwLjBXSJxw0t0RYtA5gW9mq8JfBXn9TtC0nDPlqePAhpv9v4g9aONBi6JI1OXHTKKkUYGd+BOrCA==}
peerDependencies:
'@libsql/client': ^0.5.2
better-sqlite3: ^9.4.3
drizzle-orm: ^0.29.4
peerDependenciesMeta:
'@libsql/client':
optional: true
better-sqlite3:
optional: true
drizzle-orm:
optional: true
[email protected]:
resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
peerDependencies:
@@ -2356,18 +2385,10 @@ packages:
supports-color:
optional: true
[email protected]:
resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==}
engines: {node: '>=10'}
[email protected]:
resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==}
engines: {node: '>=6'}
[email protected]:
resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==}
engines: {node: '>=4.0.0'}
[email protected]:
resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}
@@ -2405,6 +2426,10 @@ packages:
engines: {node: '>=0.10'}
hasBin: true
[email protected]:
resolution: {integrity: sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==}
engines: {node: '>=8'}
[email protected]:
resolution: {integrity: sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==}
engines: {node: '>=8'}
@@ -2466,9 +2491,6 @@ packages:
[email protected]:
resolution: {integrity: sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==}
[email protected]:
resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==}
[email protected]:
resolution: {integrity: sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==}
engines: {node: '>=10.13.0'}
@@ -2821,10 +2843,6 @@ packages:
resolution: {integrity: sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw==}
engines: {node: '>=6'}
[email protected]:
resolution: {integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==}
engines: {node: '>=6'}
[email protected]:
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
@@ -2906,9 +2924,6 @@ packages:
[email protected]:
resolution: {integrity: sha512-I8ZuJ/qG92NWX8i5x1Y8qyj3vizhXS31OxjKDu3LKP+7/qBgfIKValiZIEwoVoJKUHlhWtYrktkxV1XsX+pPlg==}
[email protected]:
resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
[email protected]:
resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==}
engines: {node: '>=14.14'}
@@ -2961,9 +2976,6 @@ packages:
resolution: {integrity: sha512-8EHPljDvs7qKykr6uw8b+lqLiUc/vUg+KVTI0uND4s63TdsZM2Xus3mflvF0DDG9SiM4RlCkFGL+7aAjRmV7KA==}
hasBin: true
[email protected]:
resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==}
[email protected]:
resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
engines: {node: '>= 6'}
@@ -3112,9 +3124,6 @@ packages:
[email protected]:
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
[email protected]:
resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==}
[email protected]:
resolution: {integrity: sha512-lhYo5qNTQp3EvSSp3sRvXMbVQTLrvGV6DycRMJ5dm2BLMiJ30wpXKdDdgX+GmJZ5uQMucwRKHamXSst3Sj/Giw==}
@@ -3328,6 +3337,11 @@ packages:
resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}
engines: {node: '>= 0.8.0'}
[email protected]:
resolution: {integrity: sha512-sorTJV6PNt94Wap27Sai5gtVLIea4Otb2LUiAUyr3p6BPOScGMKGt5F1b5X/XgkNtcsDKeX5qfeBDj+PdShclQ==}
cpu: [x64, arm64, wasm32]
os: [darwin, linux, win32]
[email protected]:
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
@@ -3434,10 +3448,6 @@ packages:
resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==}
engines: {node: '>=12'}
[email protected]:
resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==}
engines: {node: '>=10'}
[email protected]:
resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==}
engines: {node: '>=4'}
@@ -3462,9 +3472,6 @@ packages:
resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==}
engines: {node: '>=16 || 14 >=14.17'}
[email protected]:
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
[email protected]:
resolution: {integrity: sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==}
engines: {node: '>=8'}
@@ -3481,9 +3488,6 @@ packages:
resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==}
engines: {node: '>= 8'}
[email protected]:
resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==}
[email protected]:
resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==}
engines: {node: '>=10'}
@@ -3521,18 +3525,12 @@ packages:
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
hasBin: true
[email protected]:
resolution: {integrity: sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==}
[email protected]:
resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==}
[email protected]:
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
[email protected]:
resolution: {integrity: sha512-7YcLTJsTZSZZ89XrTEaDEnFsVWbppBgLO0Rr5n3Nf93gKHTBkBfeGH8//8FVwV2poi6SabVbJ0a2eoJRoII81w==}
[email protected]:
resolution: {integrity: sha512-aKXvtNrWkOCMsQbsk4A0qQdBjrJ1ZcvwlTQevI/LAgLWLYc5L7Q/YiYxGLal4ITyNSlzir1Cm1D2ZxnYhmpMEw==}
engines: {node: ^16.11.0 || >=17.0.0}
@@ -3543,10 +3541,6 @@ packages:
xml2js:
optional: true
[email protected]:
resolution: {integrity: sha512-7vbj10trelExNjFSBm5kTvZXXa7pZyKWx9RCKIyqe6I9Ev3IzGpQoqBP3a+cOdxY+pWj6VkP28n/2wWysBHD/A==}
engines: {node: '>=10'}
[email protected]:
resolution: {integrity: sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==}
@@ -3767,11 +3761,6 @@ packages:
resolution: {integrity: sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==}
engines: {node: ^10 || ^12 || >=14}
[email protected]:
resolution: {integrity: sha512-UnNke3IQb6sgarcZIDU3gbMeTp/9SSU1DAIkil7PrqG1vZlBtY5msYccSKSHDqa3hNg436IXK+SNImReuA1wEQ==}
engines: {node: '>=10'}
hasBin: true
[email protected]:
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
engines: {node: '>= 0.8.0'}
@@ -3795,9 +3784,6 @@ packages:
resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==}
engines: {node: '>= 0.6.0'}
[email protected]:
resolution: {integrity: sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==}
[email protected]:
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
@@ -3821,10 +3807,6 @@ packages:
[email protected]:
resolution: {integrity: sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg==}
[email protected]:
resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==}
hasBin: true
[email protected]:
resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==}
peerDependencies:
@@ -4060,12 +4042,6 @@ packages:
resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
engines: {node: '>=14'}
[email protected]:
resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==}
[email protected]:
resolution: {integrity: sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==}
[email protected]:
resolution: {integrity: sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==}
engines: {node: '>= 10'}
@@ -4195,10 +4171,6 @@ packages:
resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==}
engines: {node: '>=8'}
[email protected]:
resolution: {integrity: sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==}
engines: {node: '>=0.10.0'}
[email protected]:
resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}
engines: {node: '>=8'}
@@ -4244,13 +4216,6 @@ packages:
resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==}
engines: {node: '>=6'}
[email protected]:
resolution: {integrity: sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==}
[email protected]:
resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==}
engines: {node: '>=6'}
[email protected]:
resolution: {integrity: sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==}
@@ -4362,9 +4327,6 @@ packages:
engines: {node: '>=18.0.0'}
hasBin: true
[email protected]:
resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==}
[email protected]:
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
engines: {node: '>= 0.8.0'}
@@ -5531,6 +5493,27 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.0
'@libsql/[email protected]':
optional: true
'@libsql/[email protected]':
optional: true
'@libsql/[email protected]':
optional: true
'@libsql/[email protected]':
optional: true
'@libsql/[email protected]':
optional: true
'@libsql/[email protected]':
optional: true
'@libsql/[email protected]':
optional: true
'@mapbox/[email protected]([email protected])':
dependencies:
detect-libc: 2.0.3
@@ -5546,6 +5529,8 @@ snapshots:
- encoding
- supports-color
'@neon-rs/[email protected]': {}
'@netlify/[email protected]':
dependencies:
'@netlify/serverless-functions-api': 1.19.1
@@ -5586,6 +5571,10 @@ snapshots:
'@oozcitak/[email protected]': {}
'@ourongxing/[email protected]([email protected])':
optionalDependencies:
libsql: 0.4.5
'@ourongxing/[email protected](@eslint-react/[email protected]([email protected]([email protected]))([email protected]))(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))(@vue/[email protected])([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected]))':
dependencies:
'@antfu/install-pkg': 0.4.1
@@ -6482,11 +6471,6 @@ snapshots:
[email protected]: {}
[email protected]:
dependencies:
bindings: 1.5.0
prebuild-install: 7.1.2
[email protected]: {}
[email protected]:
@@ -6495,12 +6479,6 @@ snapshots:
[email protected]: {}
[email protected]:
dependencies:
buffer: 5.7.1
inherits: 2.0.4
readable-stream: 3.6.2
[email protected]: {}
[email protected]: {}
@@ -6529,11 +6507,6 @@ snapshots:
[email protected]: {}
[email protected]:
dependencies:
base64-js: 1.5.1
ieee754: 1.2.1
[email protected]:
dependencies:
base64-js: 1.5.1
@@ -6640,8 +6613,6 @@ snapshots:
optionalDependencies:
fsevents: 2.3.3
[email protected]: {}
[email protected]: {}
[email protected]: {}
@@ -6773,10 +6744,6 @@ snapshots:
[email protected]: {}
[email protected]([email protected]):
optionalDependencies:
better-sqlite3: 9.6.0
[email protected]:
dependencies:
ms: 2.0.0
@@ -6789,14 +6756,8 @@ snapshots:
dependencies:
ms: 2.1.3
[email protected]:
dependencies:
mimic-response: 3.1.0
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]: {}
@@ -6817,6 +6778,8 @@ snapshots:
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]:
@@ -6873,10 +6836,6 @@ snapshots:
iconv-lite: 0.6.3
optional: true
[email protected]:
dependencies:
once: 1.4.0
[email protected]:
dependencies:
graceful-fs: 4.2.11
@@ -7475,8 +7434,6 @@ snapshots:
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]: {}
@@ -7551,8 +7508,6 @@ snapshots:
dependencies:
js-yaml: 3.14.1
[email protected]: {}
[email protected]:
dependencies:
graceful-fs: 4.2.11
@@ -7612,8 +7567,6 @@ snapshots:
pathe: 1.1.2
tar: 6.2.1
[email protected]: {}
[email protected]:
dependencies:
is-glob: 4.0.3
@@ -7782,8 +7735,6 @@ snapshots:
[email protected]: {}
[email protected]: {}
[email protected]:
dependencies:
css-in-js-utils: 3.1.0
@@ -7965,6 +7916,19 @@ snapshots:
prelude-ls: 1.2.1
type-check: 0.4.0
[email protected]:
dependencies:
'@neon-rs/load': 0.0.4
detect-libc: 2.0.2
optionalDependencies:
'@libsql/darwin-arm64': 0.4.5
'@libsql/darwin-x64': 0.4.5
'@libsql/linux-arm64-gnu': 0.4.5
'@libsql/linux-arm64-musl': 0.4.5
'@libsql/linux-x64-gnu': 0.4.5
'@libsql/linux-x64-musl': 0.4.5
'@libsql/win32-x64-msvc': 0.4.5
[email protected]: {}
[email protected]:
@@ -8086,8 +8050,6 @@ snapshots:
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]:
@@ -8125,8 +8087,6 @@ snapshots:
dependencies:
brace-expansion: 2.0.1
[email protected]: {}
[email protected]:
dependencies:
yallist: 4.0.0
@@ -8140,8 +8100,6 @@ snapshots:
minipass: 3.3.6
yallist: 4.0.0
[email protected]: {}
[email protected]: {}
[email protected]:
@@ -8176,19 +8134,11 @@ snapshots:
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]: {}
nitro[email protected]:
dependencies:
consola: 3.2.3
mlly: 1.7.1
pkg-types: 1.2.0
[email protected]([email protected])([email protected])([email protected]):
nitro[email protected]([email protected])([email protected])([email protected]):
dependencies:
'@cloudflare/kv-asset-handler': 0.3.4
'@netlify/functions': 2.8.1
@@ -8211,7 +8161,7 @@ snapshots:
cookie-es: 1.2.2
croner: 8.1.1
crossws: 0.2.4
db0: 0.1.4([email protected])
db0: '@ourongxing/[email protected]([email protected])'
defu: 6.1.4
destr: 2.0.3
dot-prop: 8.0.2
@@ -8269,19 +8219,15 @@ snapshots:
- '@planetscale/database'
- '@upstash/redis'
- '@vercel/kv'
- better-sqlite3
- drizzle-orm
- encoding
- idb-keyval
- libsql
- magicast
- supports-color
- uWebSockets.js
- webpack-sources
[email protected]:
dependencies:
semver: 7.6.3
[email protected]: {}
[email protected]: {}
@@ -8502,21 +8448,6 @@ snapshots:
picocolors: 1.1.0
source-map-js: 1.2.1
[email protected]:
dependencies:
detect-libc: 2.0.3
expand-template: 2.0.3
github-from-package: 0.0.0
minimist: 1.2.8
mkdirp-classic: 0.5.3
napi-build-utils: 1.0.2
node-abi: 3.68.0
pump: 3.0.2
rc: 1.2.8
simple-get: 4.0.1
tar-fs: 2.1.1
tunnel-agent: 0.6.0
[email protected]: {}
[email protected]: {}
@@ -8529,11 +8460,6 @@ snapshots:
[email protected]: {}
[email protected]:
dependencies:
end-of-stream: 1.4.4
once: 1.4.0
[email protected]: {}
[email protected]: {}
@@ -8553,13 +8479,6 @@ snapshots:
defu: 6.1.4
destr: 2.0.3
[email protected]:
dependencies:
deep-extend: 0.6.0
ini: 1.3.8
minimist: 1.2.8
strip-json-comments: 2.0.1
[email protected]([email protected]):
dependencies:
loose-envify: 1.4.0
@@ -8831,14 +8750,6 @@ snapshots:
[email protected]: {}
[email protected]: {}
[email protected]:
dependencies:
decompress-response: 6.0.0
once: 1.4.0
simple-concat: 1.0.1
[email protected]:
dependencies:
'@polka/url': 1.0.0-next.28
@@ -8967,8 +8878,6 @@ snapshots:
dependencies:
min-indent: 1.0.1
[email protected]: {}
[email protected]: {}
[email protected]:
@@ -9004,21 +8913,6 @@ snapshots:
[email protected]: {}
[email protected]:
dependencies:
chownr: 1.1.4
mkdirp-classic: 0.5.3
pump: 3.0.2
tar-stream: 2.2.0
[email protected]:
dependencies:
bl: 4.1.0
end-of-stream: 1.4.4
fs-constants: 1.0.0
inherits: 2.0.4
readable-stream: 3.6.2
[email protected]:
dependencies:
b4a: 1.6.6
@@ -9112,10 +9006,6 @@ snapshots:
optionalDependencies:
fsevents: 2.3.3
[email protected]:
dependencies:
safe-buffer: 5.2.1
[email protected]:
dependencies:
prelude-ls: 1.2.1
@@ -9319,13 +9209,13 @@ snapshots:
- supports-color
- terser
[email protected]([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])):
[email protected]([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])):
dependencies:
esbuild: 0.24.0
fast-glob: 3.3.2
front-matter: 4.0.2
h3: 1.12.0
nitropack: 2.9.7([email protected])([email protected])([email protected])
nitropack: 2.9.7([email protected])([email protected])([email protected])
vite: 5.4.8(@types/[email protected])([email protected])
xmlbuilder2: 3.1.1
transitivePeerDependencies:
@@ -9341,10 +9231,10 @@ snapshots:
- '@planetscale/database'
- '@upstash/redis'
- '@vercel/kv'
- better-sqlite3
- drizzle-orm
- encoding
- idb-keyval
- libsql
- magicast
- supports-color
- uWebSockets.js
+8 -4
View File
@@ -1,18 +1,22 @@
import { TTL } from "@shared/consts"
import type { CacheInfo } from "@shared/types"
import type { Database } from "db0"
export class Cache {
private db
constructor(db: any) {
constructor(db: Database) {
this.db = db
this.db.exec(`
}
async init() {
await this.db.prepare(`
CREATE TABLE IF NOT EXISTS cache (
id TEXT PRIMARY KEY,
data TEXT,
updated INTEGER,
expires INTEGER
);
`)
`).run()
}
async set(key: string, value: any) {
@@ -23,7 +27,7 @@ export class Cache {
}
async get(key: string): Promise<CacheInfo> {
const row = await this.db.prepare(`SELECT id, data, updated, expires FROM cache WHERE id = ?`).get(key)
const row: any = await this.db.prepare(`SELECT id, data, updated, expires FROM cache WHERE id = ?`).get(key)
return row
? {
...row,
+3 -2
View File
@@ -11,6 +11,7 @@ export default defineEventHandler(async (event) => {
const db = useDatabase()
const cacheStore = db ? new Cache(db) : undefined
if (cacheStore) {
await cacheStore.init()
const cache = await cacheStore.get(id)
if (cache) {
if (!latest && cache.expires > Date.now()) {
@@ -29,14 +30,14 @@ export default defineEventHandler(async (event) => {
if (!sources[id]) {
const data = await fallback(id)
if (cacheStore) cacheStore.set(id, data)
if (cacheStore) await cacheStore.set(id, data)
return {
status: "success",
data,
}
} else {
const data = await sources[id]()
if (cacheStore) cacheStore.set(id, data)
if (cacheStore) await cacheStore.set(id, data)
return {
status: "success",
data,
+2 -2
View File
@@ -15,7 +15,7 @@ const columns = [
"国际视野",
] as const
export async function zaobao(type: typeof columns[number] = "中国聚焦"): Promise<SourceInfo> {
const response = await $fetch("https://www.kzaobao.com/top.html", {
const response: ArrayBuffer = await $fetch("https://www.kzaobao.com/top.html", {
responseType: "arrayBuffer",
})
const base = "https://www.kzaobao.com"
@@ -23,7 +23,7 @@ export async function zaobao(type: typeof columns[number] = "中国聚焦"): Pro
const $ = cheerio.load(utf8String)
// const all = []
// columns.forEach((column, index) => {
const $main = $(`#cd0${2}`)
const $main = $(`#cd0${columns.indexOf(type) + 1}`)
const news: NewsItem[] = []
$main.find("tr").each((_, el) => {
const a = $(el).find("h3>a")
+2 -2
View File
@@ -1,6 +1,6 @@
import dayjs from "dayjs"
import utcPlugin from "dayjs/plugin/utc"
import timezonePlugin from "dayjs/plugin/timezone"
import utcPlugin from "dayjs/plugin/utc.js"
import timezonePlugin from "dayjs/plugin/timezone.js"
dayjs.extend(utcPlugin)
dayjs.extend(timezonePlugin)
+3
View File
@@ -0,0 +1,3 @@
import { fileURLToPath } from "node:url"
export const projectDir = fileURLToPath(new URL("..", import.meta.url))
+9 -8
View File
@@ -1,12 +1,14 @@
import process from "node:process"
import { fileURLToPath } from "node:url"
import nitroCloudflareBindings from "nitro-cloudflare-dev"
import { join } from "node:path"
import { defineConfig } from "vite"
import react from "@vitejs/plugin-react-swc"
import nitro from "vite-plugin-with-nitro"
import { TanStackRouterVite } from "@tanstack/router-plugin/vite"
import tsconfigPath from "vite-tsconfig-paths"
import unocss from "unocss/vite"
import { projectDir } from "./shared/dir"
const isCF = process.env.CF_PAGES
export default defineConfig({
resolve: {
@@ -21,13 +23,12 @@ export default defineConfig({
react(),
nitro({ ssr: false }, {
srcDir: "server",
modules: [nitroCloudflareBindings],
experimental: {
database: true,
},
database: {
default: {
connector: "cloudflare-d1",
connector: isCF ? "cloudflare-d1" : "libsql",
options: {
bindingName: "CACHE_DB",
},
@@ -35,14 +36,14 @@ export default defineConfig({
},
devDatabase: {
default: {
connector: "sqlite",
connector: "libsql",
},
},
alias: {
"@shared": fileURLToPath(new URL("shared", import.meta.url)),
"#": fileURLToPath(new URL("server", import.meta.url)),
"@shared": join(projectDir, "shared"),
"#": join(projectDir, "server"),
},
preset: "cloudflare-pages",
preset: isCF ? "cloudflare-pages" : "node-server",
}),
],
})