@bbki.ng/site 5.4.19 → 5.4.20

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @bbki.ng/site
2
2
 
3
+ ## 5.4.20
4
+
5
+ ### Patch Changes
6
+
7
+ - c06c91f: bug fix
8
+ - Updated dependencies [c06c91f]
9
+ - @bbki.ng/components@5.2.11
10
+
3
11
  ## 5.4.19
4
12
 
5
13
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/site",
3
- "version": "5.4.19",
3
+ "version": "5.4.20",
4
4
  "description": "code behind bbki.ng",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -13,26 +13,22 @@
13
13
  "@tailwindcss/vite": "4.1.17",
14
14
  "classnames": "2.3.1",
15
15
  "react": "^18.0.0",
16
- "react-cusdis": "^2.1.3",
17
16
  "react-dom": "^18.0.0",
18
17
  "react-hotkeys-hook": "^3.4.3",
19
18
  "react-router-dom": "6",
20
19
  "sonner": "1.4.0",
21
20
  "swr": "^2.2.5",
22
- "vaul": "1.1.2",
23
- "@bbki.ng/components": "5.2.10",
24
- "@bbki.ng/stylebase": "3.1.3"
21
+ "@bbki.ng/components": "5.2.11"
25
22
  },
26
23
  "devDependencies": {
27
24
  "@eslint/compat": "^1.0.0",
28
25
  "@eslint/js": "^8.57.0",
29
- "@mdx-js/mdx": "2.0.0-next.9",
30
- "@mdx-js/react": "^1.6.22",
31
- "@mdx-js/rollup": "3.0.0",
26
+ "@mdx-js/mdx": "^3.0.0",
27
+ "@mdx-js/react": "^3.0.0",
28
+ "@mdx-js/rollup": "^3.0.0",
32
29
  "@tailwindcss/postcss": "4.1.17",
33
30
  "@tailwindcss/typography": "^0.5.0",
34
- "@types/jest": "^27.0.3",
35
- "@types/node": "^16.11.1",
31
+ "@types/node": "^20.0.0",
36
32
  "@types/react": "^18.0.15",
37
33
  "@types/react-dom": "^18.0.6",
38
34
  "@typescript-eslint/eslint-plugin": "^7.0.0",
@@ -45,12 +41,8 @@
45
41
  "eslint-plugin-react-hooks": "^4.6.0",
46
42
  "eslint-plugin-unicorn": "^51.0.0",
47
43
  "globals": "^14.0.0",
48
- "husky": "^7.0.0",
49
- "jest": "^27.4.5",
50
- "lint-staged": "^11.2.1",
51
44
  "postcss": "^8.3.9",
52
45
  "prettier": "^3.2.0",
53
- "pretty-quick": "^3.1.1",
54
46
  "rehype-autolink-headings": "^6.1.1",
55
47
  "rehype-highlight": "^5.0.0",
56
48
  "rehype-slug": "^5.0.1",
@@ -60,18 +52,16 @@
60
52
  "remark-parse": "^10.0.0",
61
53
  "remark-toc": "^8.0.1",
62
54
  "rollup-plugin-visualizer": "6.0.5",
63
- "sass": "^1.42.1",
64
55
  "tailwindcss": "^4.1.17",
65
- "ts-jest": "^27.1.1",
66
- "typescript": "^4.5.4",
56
+ "typescript": "^5.3.0",
67
57
  "vite": "5.0.0",
68
58
  "vite-plugin-cross-origin-isolation": "0.1.6",
69
59
  "vite-plugin-glsl": "1.2.1",
70
60
  "vite-plugin-mdx": "^3.5.8",
71
61
  "vite-plugin-pwa": "0.19",
72
62
  "workbox-window": "^6.3.0",
73
- "@bbki.ng/config": "1.0.2",
74
- "@bbki.ng/stylebase": "3.1.3"
63
+ "@bbki.ng/config": "1.0.3",
64
+ "@bbki.ng/stylebase": "3.1.4"
75
65
  },
76
66
  "author": "bbbottle",
77
67
  "license": "MIT",
@@ -81,8 +71,6 @@
81
71
  "prettier": "@bbki.ng/config/prettier",
82
72
  "homepage": "https://github.com/bbbottle/bbki.ng#readme",
83
73
  "scripts": {
84
- "test": "jest",
85
- "test:cov": "jest --coverage",
86
74
  "dev": "NODE_ENV=development && vite --host",
87
75
  "build": "tsc && vite build",
88
76
  "serve": "vite preview"
package/vite.config.js CHANGED
@@ -1,27 +1,27 @@
1
- import path from "path";
2
- import { defineConfig } from "vite";
3
- import { VitePWA } from "vite-plugin-pwa";
4
- import mdx from "@mdx-js/rollup";
5
- import remarkGfm from "remark-gfm";
6
- import remarkParse from "remark-parse";
7
- import remarkToc from "remark-toc";
8
- import crossOriginIsolation from "vite-plugin-cross-origin-isolation";
9
- import tailwindcss from "@tailwindcss/vite";
10
- import remarkFrontMatter from "remark-frontmatter";
11
- import { remarkMdxFrontmatter } from "remark-mdx-frontmatter";
12
- import rehypeSlug from "rehype-slug";
13
- import rehypeHighlight from "rehype-highlight";
14
- import rehypeAutolinkHeadings from "rehype-autolink-headings";
15
- import react from "@vitejs/plugin-react";
16
- import glsl from "vite-plugin-glsl";
17
- import { visualizer } from "rollup-plugin-visualizer";
1
+ import path from 'path';
2
+ import { defineConfig } from 'vite';
3
+ import { VitePWA } from 'vite-plugin-pwa';
4
+ import mdx from '@mdx-js/rollup';
5
+ import remarkGfm from 'remark-gfm';
6
+ import remarkParse from 'remark-parse';
7
+ import remarkToc from 'remark-toc';
8
+ import crossOriginIsolation from 'vite-plugin-cross-origin-isolation';
9
+ import tailwindcss from '@tailwindcss/vite';
10
+ import remarkFrontMatter from 'remark-frontmatter';
11
+ import { remarkMdxFrontmatter } from 'remark-mdx-frontmatter';
12
+ import rehypeSlug from 'rehype-slug';
13
+ import rehypeHighlight from 'rehype-highlight';
14
+ import rehypeAutolinkHeadings from 'rehype-autolink-headings';
15
+ import react from '@vitejs/plugin-react';
16
+ import glsl from 'vite-plugin-glsl';
17
+ import { visualizer } from 'rollup-plugin-visualizer';
18
18
 
19
19
  const options = {
20
20
  remarkPlugins: [
21
21
  remarkParse,
22
- [remarkToc, { maxDepth: 3, heading: "目录", tight: true }],
23
- [remarkFrontMatter, { type: "yaml", marker: "-" }],
24
- [remarkMdxFrontmatter, { name: "meta" }],
22
+ [remarkToc, { maxDepth: 3, heading: '目录', tight: true }],
23
+ [remarkFrontMatter, { type: 'yaml', marker: '-' }],
24
+ [remarkMdxFrontmatter, { name: 'meta' }],
25
25
  remarkGfm,
26
26
  ],
27
27
  rehypePlugins: [rehypeHighlight, rehypeSlug, rehypeAutolinkHeadings],
@@ -31,15 +31,15 @@ const options = {
31
31
  export default defineConfig({
32
32
  server: {
33
33
  proxy: {
34
- "/api/streaming": {
35
- target: "http://localhost:8787",
36
- rewrite: (path) => path.replace(/^\/api/, ""),
34
+ '/api/streaming': {
35
+ target: 'http://localhost:8787',
36
+ rewrite: path => path.replace(/^\/api/, ''),
37
37
  },
38
38
  },
39
39
  },
40
40
  resolve: {
41
41
  alias: {
42
- "@": path.resolve(__dirname, "./src/blog"),
42
+ '@': path.resolve(__dirname, './src/blog'),
43
43
  // "@bbki.ng/commponents": path.resolve(__dirname, "../components/lib"),
44
44
  },
45
45
  // preserveSymlinks: true,
@@ -51,8 +51,8 @@ export default defineConfig({
51
51
  output: {
52
52
  manualChunks: (id, meta) => {
53
53
  console.log(id);
54
- if (id.includes("node_modules")) {
55
- return "vendor";
54
+ if (id.includes('node_modules')) {
55
+ return 'vendor';
56
56
  }
57
57
  },
58
58
  },
@@ -62,7 +62,7 @@ export default defineConfig({
62
62
  GLOBAL_BBKING_VERSION: JSON.stringify(process.env.npm_package_version),
63
63
  },
64
64
  esbuild: {
65
- logOverride: { "this-is-undefined-in-esm": "silent" },
65
+ logOverride: { 'this-is-undefined-in-esm': 'silent' },
66
66
  },
67
67
  plugins: [
68
68
  react(),
@@ -70,52 +70,19 @@ export default defineConfig({
70
70
  glsl(),
71
71
  tailwindcss(),
72
72
  VitePWA({
73
- injectRegister: "auto",
74
- includeAssets: [
75
- "favicon.svg",
76
- "robots.txt",
77
- "apple-touch-icon.png",
78
- "Logo.svg",
79
- ],
73
+ injectRegister: 'auto',
74
+ includeAssets: ['favicon.svg', 'robots.txt', 'apple-touch-icon.png', 'Logo.svg'],
80
75
  devOptions: {
81
76
  enabled: true,
82
77
  },
83
78
  workbox: {
84
79
  cleanupOutdatedCaches: true,
85
80
  runtimeCaching: [
86
- {
87
- urlPattern:
88
- /^https:\/\/zjh-im-res\.oss-cn-shenzhen\.aliyuncs\.com\/.*/i,
89
- handler: "CacheFirst",
90
- options: {
91
- cacheName: "oss-resource-cache",
92
- expiration: {
93
- maxEntries: 100,
94
- maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
95
- },
96
- cacheableResponse: {
97
- statuses: [0, 200],
98
- },
99
- },
100
- },
101
- {
102
- urlPattern: /new-content-handler/,
103
- method: "GET",
104
- handler: ({ event, data }) => {
105
- const url = new URL(event.request.url);
106
- const sharedContent = url.searchParams.get("text");
107
-
108
- // post the shared content to the main thread
109
- if (sharedContent) {
110
- window.postMessage(sharedContent, {});
111
- }
112
- },
113
- },
114
81
  {
115
82
  urlPattern: /^https:\/\/fonts\.gstatic.com\.com\/.*/i,
116
- handler: "CacheFirst",
83
+ handler: 'CacheFirst',
117
84
  options: {
118
- cacheName: "fonts",
85
+ cacheName: 'fonts',
119
86
  expiration: {
120
87
  maxEntries: 100,
121
88
  maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
@@ -128,36 +95,36 @@ export default defineConfig({
128
95
  ],
129
96
  },
130
97
  manifest: {
131
- name: "bbki.ng",
132
- description: "A personal blog.",
133
- theme_color: "#ffffff",
134
- display: "fullscreen",
135
- start_url: "/",
98
+ name: 'bbki.ng',
99
+ description: 'A personal blog.',
100
+ theme_color: '#ffffff',
101
+ display: 'fullscreen',
102
+ start_url: '/',
136
103
  share_target: {
137
- action: "/new-content-handler/",
138
- method: "GET",
104
+ action: '/new-content-handler/',
105
+ method: 'GET',
139
106
  params: {
140
- title: "title",
141
- text: "text",
142
- url: "url",
107
+ title: 'title',
108
+ text: 'text',
109
+ url: 'url',
143
110
  },
144
111
  },
145
112
  icons: [
146
113
  {
147
- src: "pwa-192x192.png",
148
- sizes: "192x192",
149
- type: "image/png",
114
+ src: 'pwa-192x192.png',
115
+ sizes: '192x192',
116
+ type: 'image/png',
150
117
  },
151
118
  {
152
- src: "pwa-512x512.png",
153
- sizes: "512x512",
154
- type: "image/png",
119
+ src: 'pwa-512x512.png',
120
+ sizes: '512x512',
121
+ type: 'image/png',
155
122
  },
156
123
  {
157
- src: "pwa-512x512.png",
158
- sizes: "512x512",
159
- type: "image/png",
160
- purpose: "any maskable",
124
+ src: 'pwa-512x512.png',
125
+ sizes: '512x512',
126
+ type: 'image/png',
127
+ purpose: 'any maskable',
161
128
  },
162
129
  ],
163
130
  },
package/jest.config.js DELETED
@@ -1,15 +0,0 @@
1
- /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2
- const config = {
3
- preset: "ts-jest",
4
- testEnvironment: "jsdom",
5
- collectCoverageFrom: [
6
- "src/utils/index.ts",
7
- "!**/node_modules/**",
8
- "!**/vendor/**",
9
- ],
10
- moduleNameMapper: {
11
- "@/(.*)$": "<rootDir>/src/blog/$1",
12
- },
13
- };
14
-
15
- export default config;
@@ -1,56 +0,0 @@
1
- import {
2
- delay,
3
- floatNumberToPercentageString,
4
- getEnv,
5
- minDelay,
6
- } from "@/utils";
7
-
8
- jest.useFakeTimers();
9
- jest.spyOn(window, "setTimeout");
10
-
11
- describe("floatNumberToPercentageString", () => {
12
- it("should return percentage string correctly", () => {
13
- expect(floatNumberToPercentageString(0.8)).toBe("80%");
14
- });
15
- });
16
-
17
- describe("delay", () => {
18
- it("should delay correctly", () => {
19
- delay(5000);
20
- expect(setTimeout).toHaveBeenCalledTimes(1);
21
- expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 5000);
22
- });
23
- });
24
-
25
- describe("minDelay", () => {
26
- it("should delay at least specific duration", () => {
27
- const promise = delay(1000);
28
- expect(minDelay(promise, 2000)).toEqual(promise);
29
- expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 2000);
30
- });
31
- });
32
-
33
- describe("getEnv", () => {
34
- it("should return development when href start with http://localhost", () => {
35
- const locationSpy = jest.spyOn(window, "location", "get");
36
- locationSpy.mockImplementation(
37
- () =>
38
- ({
39
- href: "http://localhost:3000",
40
- } as Location)
41
- );
42
- expect(getEnv()).toEqual("development");
43
- locationSpy.mockRestore();
44
- });
45
- it("should return production when href is NOT start with http://localhost", () => {
46
- const locationSpy = jest.spyOn(window, "location", "get");
47
- locationSpy.mockImplementation(
48
- () =>
49
- ({
50
- href: "https://bbki.ng",
51
- } as Location)
52
- );
53
- expect(getEnv()).toEqual("production");
54
- locationSpy.mockRestore();
55
- });
56
- });