wildpig 1.1.3 → 1.1.5
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/package.json +1 -1
- package/scripts/WildPig.ts +1 -2
- package/scripts/packageStatic.ts +1 -13
- package/scripts/prepareRoutes.ts +3 -4
- package/public/render.js +0 -27996
- package/public/render.js.br +0 -0
package/package.json
CHANGED
package/scripts/WildPig.ts
CHANGED
|
@@ -22,9 +22,8 @@ export const startServer = () => {
|
|
|
22
22
|
"content-type": "image/x-icon",
|
|
23
23
|
}
|
|
24
24
|
}),
|
|
25
|
-
"/render.js": () => new Response((readFileSync("./public/render.js
|
|
25
|
+
"/render.js": () => new Response((readFileSync("./public/render.js")), {
|
|
26
26
|
headers: {
|
|
27
|
-
"Content-Encoding": "br",
|
|
28
27
|
"Content-Type": "text/javascript; charset=utf-8",
|
|
29
28
|
"Cache-Control": isDev ? "no-cache" : "public, max-age=31536000, immutable"
|
|
30
29
|
}
|
package/scripts/packageStatic.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Bun from "bun";
|
|
2
|
-
import fs
|
|
3
|
-
import { brotliCompressSync, constants } from "node:zlib";
|
|
2
|
+
import fs from "node:fs";
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
export const packageStatic = async () => {
|
|
@@ -11,17 +10,6 @@ export const packageStatic = async () => {
|
|
|
11
10
|
format: "esm",
|
|
12
11
|
minify: true,
|
|
13
12
|
});
|
|
14
|
-
// 将 ./public/render.js 转为 ./public/render.br
|
|
15
|
-
writeFileSync("./dist/public/render.js.br", brotliCompressSync(
|
|
16
|
-
Buffer.from(readFileSync("./dist/public/render.js")),
|
|
17
|
-
{
|
|
18
|
-
params: {
|
|
19
|
-
[constants.BROTLI_PARAM_QUALITY]: 11, // 最高质量
|
|
20
|
-
[constants.BROTLI_PARAM_LGWIN]: 16, // 最大窗口 16 MB
|
|
21
|
-
[constants.BROTLI_PARAM_MODE]: constants.BROTLI_MODE_TEXT, // 针对文本优化
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
));
|
|
25
13
|
|
|
26
14
|
/** 打包ico */
|
|
27
15
|
fs.copyFileSync("./public/favicon.ico", "./dist/public/favicon.ico");
|
package/scripts/prepareRoutes.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { scanMetaRoutes, scanRoutes } from "./genRoutes";
|
|
3
|
-
import {
|
|
3
|
+
import { gzipSync } from "bun";
|
|
4
4
|
|
|
5
5
|
const isDev = process.env.NODE_ENV === "development";
|
|
6
6
|
|
|
@@ -16,10 +16,9 @@ if(isDev){
|
|
|
16
16
|
await Bun.build({
|
|
17
17
|
entrypoints: ["./public/render.tsx"],
|
|
18
18
|
outdir: "./public",
|
|
19
|
-
format: "esm"
|
|
19
|
+
format: "esm",
|
|
20
|
+
minify: true,
|
|
20
21
|
});
|
|
21
|
-
// 将 ./public/render.js 转为 ./public/render.br
|
|
22
|
-
writeFileSync("./public/render.js.br", brotliCompressSync(Buffer.from(readFileSync("./public/render.js"))));
|
|
23
22
|
|
|
24
23
|
}else{
|
|
25
24
|
routes = require("#/build/built-routes.ts").default;
|