Skip to content

Commit 604eb28

Browse files
committed
chore: wip
1 parent 3d42fd1 commit 604eb28

8 files changed

Lines changed: 157 additions & 3 deletions

File tree

packages/base-x/build.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import process from 'node:process'
2+
import { dts } from 'bun-plugin-dtsx'
3+
4+
console.log('Building...')
5+
6+
const result = await Bun.build({
7+
entrypoints: ['./src/index.ts'],
8+
outdir: './dist',
9+
minify: true,
10+
plugins: [
11+
dts(),
12+
],
13+
})
14+
15+
if (!result.success) {
16+
console.error('Build failed')
17+
18+
for (const message of result.logs) {
19+
// Bun will pretty print the message object
20+
console.error(message)
21+
}
22+
23+
process.exit(1)
24+
}
25+
26+
console.log('Build complete')

packages/base-x/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@
5454
"typecheck": "bun --bun tsc --noEmit"
5555
},
5656
"devDependencies": {
57-
"@stacksjs/docs": "^0.69.3",
58-
"@stacksjs/eslint-config": "^4.2.1-beta.1",
5957
"@types/bun": "^1.2.3",
6058
"bun-plugin-dtsx": "^0.21.9",
6159
"typescript": "^5.7.3"
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright (c) 2018 base-x contributors
33
// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
44
// Distributed under the MIT software license, see the accompanying
5-
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
5+
// @see http://www.opensource.org/licenses/mit-license.php
66

77
// Common alphabets and their bases
88
export const ALPHABETS = {
@@ -86,6 +86,12 @@ export function base(ALPHABET: Alphabet = ALPHABETS.BASE58): BaseConverter {
8686
const FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up
8787
const iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up
8888

89+
/**
90+
* Encodes a Uint8Array or string into a base-x encoded string.
91+
*
92+
* @param source - The input to encode.
93+
* @returns The base-x encoded string.
94+
*/
8995
function encode(source: Uint8Array | string): string {
9096
// eslint-disable-next-line no-empty
9197
if (source instanceof Uint8Array) { }
@@ -146,6 +152,12 @@ export function base(ALPHABET: Alphabet = ALPHABETS.BASE58): BaseConverter {
146152
return str
147153
}
148154

155+
/**
156+
* Decodes a base-x encoded string into a Uint8Array.
157+
*
158+
* @param source - The base-x encoded string to decode.
159+
* @returns The decoded Uint8Array.
160+
*/
149161
function decode(source: string): Uint8Array {
150162
if (typeof source !== 'string')
151163
throw new TypeError('Expected String')

packages/sha/build.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import process from 'node:process'
2+
import { dts } from 'bun-plugin-dtsx'
3+
4+
console.log('Building...')
5+
6+
const result = await Bun.build({
7+
entrypoints: ['./src/index.ts'],
8+
outdir: './dist',
9+
minify: true,
10+
plugins: [
11+
dts(),
12+
],
13+
})
14+
15+
if (!result.success) {
16+
console.error('Build failed')
17+
18+
for (const message of result.logs) {
19+
// Bun will pretty print the message object
20+
console.error(message)
21+
}
22+
23+
process.exit(1)
24+
}
25+
26+
console.log('Build complete')

packages/sha/package.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"name": "ts-sha",
3+
"type": "module",
4+
"version": "0.0.0",
5+
"description": "A SHA-1, SHA-256, SHA-384, SHA-512 hashing library.",
6+
"author": "Chris Breuer <chris@stacksjs.org> (https://github.com/chrisbbreuer)",
7+
"license": "MIT",
8+
"homepage": "https://github.com/stacksjs/ts-security#readme",
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/stacksjs/ts-security.git"
12+
},
13+
"bugs": {
14+
"url": "https://github.com/stacksjs/ts-security/issues"
15+
},
16+
"keywords": [
17+
"sha",
18+
"sha1",
19+
"sha256",
20+
"sha384",
21+
"sha512",
22+
"hashing",
23+
"crypto",
24+
"cryptography",
25+
"bun",
26+
"stacks",
27+
"node-forge",
28+
"typescript",
29+
"javascript"
30+
],
31+
"exports": {
32+
".": {
33+
"import": "./dist/index.js",
34+
"types": "./dist/index.d.ts"
35+
}
36+
},
37+
"module": "./dist/index.js",
38+
"types": "./dist/index.d.ts",
39+
"files": ["README.md", "dist"],
40+
"scripts": {
41+
"build": "bun build.ts",
42+
"lint": "bunx --bun eslint .",
43+
"lint:fix": "bunx --bun eslint . --fix",
44+
"fresh": "bunx rimraf node_modules/ bun.lock && bun i",
45+
"changelog": "bunx changelogen --output CHANGELOG.md",
46+
"prepublishOnly": "bun --bun run build",
47+
"release": "bun run changelog && bunx bumpp package.json --all",
48+
"test": "bun test",
49+
"typecheck": "bun --bun tsc --noEmit"
50+
},
51+
"devDependencies": {
52+
"@stacksjs/docs": "^0.69.3",
53+
"@types/bun": "^1.2.3",
54+
"bun-plugin-dtsx": "^0.21.9",
55+
"typescript": "^5.7.3"
56+
},
57+
"overrides": {
58+
"unconfig": "0.3.10"
59+
},
60+
"simple-git-hooks": {
61+
"pre-commit": "bun lint-staged"
62+
},
63+
"lint-staged": {
64+
"*.{js,ts}": "bunx eslint . --fix"
65+
}
66+
}

packages/sha/src/index.ts

Whitespace-only changes.

packages/ts-security/build.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import process from 'node:process'
2+
import { dts } from 'bun-plugin-dtsx'
3+
4+
console.log('Building...')
5+
6+
const result = await Bun.build({
7+
entrypoints: ['./src/index.ts'],
8+
outdir: './dist',
9+
minify: true,
10+
plugins: [
11+
dts(),
12+
],
13+
})
14+
15+
if (!result.success) {
16+
console.error('Build failed')
17+
18+
for (const message of result.logs) {
19+
// Bun will pretty print the message object
20+
console.error(message)
21+
}
22+
23+
process.exit(1)
24+
}
25+
26+
console.log('Build complete')

packages/ts-security/src/index.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)