Skip to content

Commit ffd5fd3

Browse files
committed
CI: attest standalone build files. Bump devdeps.
1 parent 8d3a769 commit ffd5fd3

File tree

8 files changed

+58
-40
lines changed

8 files changed

+58
-40
lines changed

.github/workflows/release.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ on:
33
release:
44
types: [created]
55
jobs:
6-
release-js:
7-
name: 'jsbt v0.3.1' # Should match commit below
8-
uses: paulmillr/jsbt/.github/workflows/release.yml@c45f03360e0171b138f04568d2fdd35d7bbc0d35
6+
test-js:
7+
name: 'jsbt v0.3.3' # Should match commit below
8+
uses: paulmillr/jsbt/.github/workflows/release.yml@c9a9f2cd6b4841aa3117b174e9ea468b1650e5ea
9+
with:
10+
build-path: test/build
911
secrets:
1012
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
1113
permissions:
1214
contents: write
1315
id-token: write
16+
attestations: write

.github/workflows/test-js.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ on:
44
- pull_request
55
jobs:
66
test-js:
7-
name: 'jsbt v0.3.1' # Should match commit below
8-
uses: paulmillr/jsbt/.github/workflows/test-js.yml@c45f03360e0171b138f04568d2fdd35d7bbc0d35
7+
name: 'jsbt v0.3.3' # Should match commit below
8+
uses: paulmillr/jsbt/.github/workflows/test-js.yml@c9a9f2cd6b4841aa3117b174e9ea468b1650e5ea

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ Used in:
1414

1515
## Usage
1616

17-
> npm install micro-packed
17+
> `npm install micro-packed`
18+
19+
> `jsr add jsr:@paulmillr/micro-packed`
1820
1921
```ts
2022
import * as P from 'micro-packed';

package-lock.json

+14-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@
5151
"url": "git+https://github.com/paulmillr/micro-packed.git"
5252
},
5353
"devDependencies": {
54-
"@paulmillr/jsbt": "0.3.1",
54+
"@paulmillr/jsbt": "0.3.3",
5555
"fast-check": "3.0.0",
5656
"micro-bmark": "0.4.0",
5757
"micro-should": "0.5.1",
58-
"prettier": "3.3.2",
59-
"typescript": "5.5.2"
58+
"prettier": "3.5.2",
59+
"typescript": "5.8.2"
6060
},
6161
"keywords": [
6262
"encode",

src/_type_test.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as P from './index.js';
21
import * as base from '@scure/base';
2+
import * as P from './index.ts';
33
// Should not be included in npm package. For typescript testing only
44
const assertType = <T>(_value: T) => {};
55

@@ -101,14 +101,14 @@ const tree = P.struct({
101101
assertType<P.CoderType<Tree>>(tree);
102102

103103
// tsEnum
104-
enum Test {
105-
a = 0x00,
106-
b = 0x01,
107-
c = 0x02,
108-
}
109-
assertType<base.Coder<number, 'a' | 'b' | 'c'>>(P.coders.tsEnum(Test));
110-
const e = P.apply(P.U8, P.coders.tsEnum(Test));
111-
assertType<P.CoderType<'a' | 'b' | 'c'>>(e);
104+
// enum Test {
105+
// a = 0x00,
106+
// b = 0x01,
107+
// c = 0x02,
108+
// }
109+
// assertType<base.Coder<number, 'a' | 'b' | 'c'>>(P.coders.tsEnum(Test));
110+
// const e = P.apply(P.U8, P.coders.tsEnum(Test));
111+
// assertType<P.CoderType<'a' | 'b' | 'c'>>(e);
112112
// TODO: remove map && replace with this?
113113

114114
// match

src/debugger.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { base64, hex } from '@scure/base';
2-
import * as P from './index.js';
3-
const Path = P._TEST.Path; // Very internal stuff, for debug only.
2+
import * as P from './index.ts';
3+
const Path = P._TEST.Path; // Internal, debug-only
44

55
const UNKNOWN = '(???)';
66
const codes = { esc: 27, nl: 10 };

src/index.ts

+19-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import type { Coder as BaseCoder } from '@scure/base';
2-
import { hex as baseHex, utf8 } from '@scure/base';
1+
import { hex as baseHex, utf8, type Coder as BaseCoder } from '@scure/base';
32

43
/**
54
* Define complex binary structures using composable primitives.
@@ -483,17 +482,27 @@ export type Writer = {
483482
*/
484483
class _Reader implements Reader {
485484
pos = 0;
485+
readonly data: Bytes;
486+
readonly opts: ReaderOpts;
487+
readonly stack: PathStack;
488+
private parent: _Reader | undefined;
489+
private parentOffset: number;
486490
private bitBuf = 0;
487491
private bitPos = 0;
488492
private bs: Uint32Array | undefined; // bitset
489493
private view: DataView;
490494
constructor(
491-
readonly data: Bytes,
492-
readonly opts: ReaderOpts = {},
493-
readonly stack: PathStack = [],
494-
private parent: _Reader | undefined = undefined,
495-
private parentOffset: number = 0
495+
data: Bytes,
496+
opts: ReaderOpts = {},
497+
stack: PathStack = [],
498+
parent: _Reader | undefined = undefined,
499+
parentOffset: number = 0
496500
) {
501+
this.data = data;
502+
this.opts = opts;
503+
this.stack = stack;
504+
this.parent = parent;
505+
this.parentOffset = parentOffset;
497506
this.view = createView(data);
498507
}
499508
/** Internal method for pointers. */
@@ -633,6 +642,7 @@ class _Reader implements Reader {
633642
*/
634643
class _Writer implements Writer {
635644
pos: number = 0;
645+
readonly stack: PathStack;
636646
// We could have a single buffer here and re-alloc it with
637647
// x1.5-2 size each time it full, but it will be slower:
638648
// basic/encode bench: 395ns -> 560ns
@@ -643,7 +653,8 @@ class _Writer implements Writer {
643653
private viewBuf = new Uint8Array(8);
644654
private view: DataView;
645655
private finished = false;
646-
constructor(readonly stack: PathStack = []) {
656+
constructor(stack: PathStack = []) {
657+
this.stack = stack;
647658
this.view = createView(this.viewBuf);
648659
}
649660
pushObj(obj: StructOut, objFn: _PathObjFn): void {

0 commit comments

Comments
 (0)