-
Notifications
You must be signed in to change notification settings - Fork 571
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #188
- Loading branch information
Showing
34 changed files
with
201 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { describe } from "vitest"; | ||
import { compressToUTF16, decompressFromUTF16 } from "."; | ||
import { runTestSet } from "../__tests__/testFunctions"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { _compress } from "../_compress"; | ||
|
||
export function compressToUTF16(input: string | null) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { _decompress } from "../_decompress"; | ||
|
||
export function decompressFromUTF16(compressed: string | null) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
export { compressToUTF16 } from "./compressToUTF16"; | ||
export { decompressFromUTF16 } from "./decompressFromUTF16"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { describe } from "vitest"; | ||
import { compressToUint8Array, decompressFromUint8Array } from "."; | ||
import { runTestSet } from "../__tests__/testFunctions"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { compress } from "../stock/compress"; | ||
|
||
export function compressToUint8Array(uncompressed: string | null): Uint8Array { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { decompress } from "../stock/decompress"; | ||
|
||
export function decompressFromUint8Array(compressed: Uint8Array | null): string | null { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
export { compressToUint8Array } from "./compressToUint8Array"; | ||
export { decompressFromUint8Array } from "./decompressFromUint8Array"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
/* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
import { test, expect } from "vitest"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
export type Dictionary = Record<string, number>; | ||
export type PendingDictionary = Record<string, true>; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
export interface DecompressionTracker { | ||
val: number; | ||
position: number; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
// Copyright (c) 2013 Pieroxy <[email protected]> | ||
// This work is free. You can redistribute it and/or modify it | ||
// under the terms of the WTFPL, Version 2 | ||
// For more information see LICENSE.txt or http://www.wtfpl.net/ | ||
// | ||
// This lib is part of the lz-string project. | ||
// For more information, the home page: | ||
// http://pieroxy.net/blog/pages/lz-string/index.html | ||
// | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
// Base64 compression / decompression for already compressed content (gif, png, jpg, mp3, ...) | ||
// version 1.4.1 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { describe } from "vitest"; | ||
import { compressToBase64, decompressFromBase64 } from "."; | ||
import { runTestSet } from "../__tests__/testFunctions"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { _compress } from "../_compress"; | ||
import keyStrBase64 from "./keyStrBase64"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { _decompress } from "../_decompress"; | ||
import { getBaseValue } from "../getBaseValue"; | ||
import keyStrBase64 from "./keyStrBase64"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
export { compressToBase64 } from "./compressToBase64"; | ||
export { decompressFromBase64 } from "./decompressFromBase64"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
export default "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { _compress } from "../_compress"; | ||
import keyStrUriSafe from "./keyStrUriSafe"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import keyStrUriSafe from "./keyStrUriSafe"; | ||
import { _decompress } from "../_decompress"; | ||
import { getBaseValue } from "../getBaseValue"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { describe, expect, test } from "vitest"; | ||
import { compressToEncodedURIComponent, decompressFromEncodedURIComponent } from "."; | ||
import { runTestSet, test_longString_fn, test_tattooSource } from "../__tests__/testFunctions"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
export { compressToEncodedURIComponent } from "./compressToEncodedURI"; | ||
export { decompressFromEncodedURIComponent } from "./decompressFromEncodedURI"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
export default "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
export type Dictionary = Record<string, number>; | ||
export type DictionaryCollection = Record<string, Dictionary>; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
// Copyright (c) 2013 Pieroxy <[email protected]> | ||
// This work is free. You can redistribute it and/or modify it | ||
// under the terms of the WTFPL, Version 2 | ||
// For more information see LICENSE.txt or http://www.wtfpl.net/ | ||
// | ||
// For more information, the home page: | ||
// http://pieroxy.net/blog/pages/lz-string/testing.html | ||
// | ||
// LZ-based compression algorithm, version 1.4.5 | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { _compress } from "./_compress"; | ||
import { _decompress } from "./_decompress"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { _compress } from "../_compress"; | ||
|
||
export function compress(input: string | null) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { _decompress } from "../_decompress"; | ||
|
||
export function decompress(compressed: string | null) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
export { compress } from "./compress"; | ||
export { decompress } from "./decompress"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { describe } from "vitest"; | ||
import { compress, decompress } from "."; | ||
import { runTestSet } from "../__tests__/testFunctions"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { describe } from "vitest"; | ||
import LZString from "../dist/index.cjs"; | ||
import { runAllTests } from "./testFunctions"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { describe } from "vitest"; | ||
import LZString from "../dist/index.js"; | ||
import { runAllTests } from "./testFunctions"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
import { test, expect, describe } from "vitest"; | ||
import { | ||
test_allUtf16, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
/** Simple value */ | ||
export const test_hw = "Hello world!"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2013 Pieroxy <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
/// <reference types="vitest" /> | ||
import { parse, relative, resolve } from "path"; | ||
import { resolve } from "path"; | ||
import { defineConfig } from "vite"; | ||
import dts from "vite-plugin-dts"; | ||
import eslint from "vite-plugin-eslint"; | ||
import tsconfigPaths from "vite-tsconfig-paths"; | ||
|
||
const root = resolve(__dirname, "src"); | ||
|
||
export default defineConfig({ | ||
plugins: [tsconfigPaths(), dts({ rollupTypes: true }), eslint()], | ||
build: { | ||
|
@@ -26,13 +30,8 @@ export default defineConfig({ | |
}, | ||
{ | ||
format: "es", | ||
chunkFileNames: "[name].js", | ||
manualChunks: (id: string) => { | ||
const { dir, name } = parse(relative(root, id)); | ||
|
||
// If it's in node_modules then don't export | ||
return dir.startsWith(".") ? null : name || "common"; | ||
}, | ||
preserveModules: true, | ||
entryFileNames: "[name].js", | ||
}, | ||
{ | ||
format: "umd", | ||
|