Skip to content

Commit 8ff5b4a

Browse files
authored
Merge pull request #8 from L4Ph/vite6-beta
Vite6 beta
2 parents 0aa7345 + fed0ec5 commit 8ff5b4a

File tree

5 files changed

+5
-58
lines changed

5 files changed

+5
-58
lines changed

bun.lockb

15.5 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"tailwindcss": "^4.0.0-alpha.25",
5353
"tslib": "^2.7.0",
5454
"typescript": "^5.6.2",
55-
"vite": "^5.4.8"
55+
"vite": "^6.0.0-beta.2"
5656
},
5757
"module": "index.ts"
5858
}

src/routes/utils/compression.ts

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -32,60 +32,6 @@ export async function decompressFromBase64(input: string): Promise<string> {
3232
return textDecoder.decode(decompressed);
3333
}
3434

35-
export async function compressToUTF16(input: string): Promise<string> {
36-
const upstream = createUpstream(textEncoder.encode(input));
37-
const compression = new CompressionStream("deflate");
38-
const stream = upstream.pipeThrough(compression);
39-
const compressed = await new Response(stream).arrayBuffer();
40-
41-
let compressedBytes = new Uint8Array(compressed);
42-
43-
if (compressedBytes.length % 2 !== 0) {
44-
const paddedBytes = new Uint8Array(compressedBytes.length + 1);
45-
paddedBytes.set(compressedBytes);
46-
paddedBytes[compressedBytes.length] = 0; // 奇数個配列の場合、最後のバイトに 0 をパディング
47-
compressedBytes = paddedBytes;
48-
}
49-
50-
const compressedUint16Array = new Uint16Array(compressedBytes.buffer);
51-
return String.fromCharCode(...compressedUint16Array);
52-
}
53-
54-
export async function decompressFromUTF16(input: string): Promise<string> {
55-
const compressedUint16Array = new Uint16Array(
56-
input.split("").map((c) => c.charCodeAt(0)),
57-
);
58-
let compressedBytes = new Uint8Array(compressedUint16Array.buffer);
59-
60-
if (compressedBytes[compressedBytes.length - 1] === 0) {
61-
compressedBytes = compressedBytes.slice(0, compressedBytes.length - 1); // パディングされた 0 を削除
62-
}
63-
64-
const upstream = createUpstream(compressedBytes);
65-
const decompression = new DecompressionStream("deflate");
66-
const stream = upstream.pipeThrough(decompression);
67-
const decompressed = await new Response(stream).arrayBuffer();
68-
return textDecoder.decode(decompressed);
69-
}
70-
71-
export async function compressToUint8Array(input: string): Promise<Uint8Array> {
72-
const upstream = createUpstream(textEncoder.encode(input));
73-
const compression = new CompressionStream("deflate");
74-
const stream = upstream.pipeThrough(compression);
75-
const compressed = await new Response(stream).arrayBuffer();
76-
return new Uint8Array(compressed);
77-
}
78-
79-
export async function decompressFromUint8Array(
80-
input: Uint8Array,
81-
): Promise<string> {
82-
const upstream = createUpstream(input);
83-
const decompression = new DecompressionStream("deflate");
84-
const stream = upstream.pipeThrough(decompression);
85-
const decompressed = await new Response(stream).arrayBuffer();
86-
return textDecoder.decode(decompressed);
87-
}
88-
8935
export async function compressToEncodedURIComponent(
9036
input: string,
9137
): Promise<string> {

svelte.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
88
const config = {
99
preprocess: vitePreprocess(),
1010
kit: {
11-
adapter: adapter(),
11+
adapter: adapter({
12+
precompress: true,
13+
strict: true,
14+
}),
1215
alias: {
1316
"@/*": "./src/lib/*",
1417
},

vite.config.js renamed to vite.config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { defineConfig } from "vite";
22
import { sveltekit } from "@sveltejs/kit/vite";
3-
// @ts-ignore
4-
import { fileURLToPath } from "node:url";
53
import tailwindcss from "@tailwindcss/vite";
64

75
const host = process.env.TAURI_DEV_HOST;

0 commit comments

Comments
 (0)