Skip to content

Commit 89f05c6

Browse files
authored
Merge pull request #8 from halvardssm/feat/lots
feat(types): Added types package feat(lexer): Added lexer package feat(lexer): Added general purpose string tokenizer feat(json): Added json package feat(json): Added jsonpath feat(wasm): Refactored WASM chore(ci): Updated ci
2 parents 76de73f + f73cd0f commit 89f05c6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+29639
-7878
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
deno:
20-
- v1.x
20+
- v2.x
2121
- canary
2222
os:
2323
- ubuntu-latest
@@ -29,19 +29,13 @@ jobs:
2929
uses: actions/checkout@v4
3030

3131
- name: Set up Deno
32-
uses: denoland/setup-deno@v1
32+
uses: denoland/setup-deno@v2
3333
with:
3434
deno-version: ${{ matrix.deno }}
3535

3636
- name: Run tests
3737
run: deno task test
3838

39-
- name: Run tests (simulate Deno 2)
40-
if: matrix.deno == 'canary'
41-
run: deno task test
42-
env:
43-
DENO_FUTURE: 1
44-
4539
- name: Generate lcov
4640
run: deno task cov:gen
4741

@@ -53,30 +47,24 @@ jobs:
5347
name: ${{ matrix.os }}-${{ matrix.deno }}
5448

5549
check:
56-
runs-on: ${{ matrix.os }}
50+
runs-on: ubuntu-latest
5751
timeout-minutes: 5
58-
strategy:
59-
fail-fast: false
60-
matrix:
61-
os:
62-
- ubuntu-latest
63-
- windows-latest
6452
steps:
6553
- name: Clone repository
6654
uses: actions/checkout@v4
6755
with:
6856
persist-credentials: false
6957

7058
- name: Set up Deno
71-
uses: denoland/setup-deno@v1
59+
uses: denoland/setup-deno@v2
7260
with:
7361
deno-version: canary
7462

7563
- name: Format & Lint
7664
run: deno task check
7765

7866
- name: Build
79-
run: deno task build:check
67+
run: deno task build:wasm:check
8068

8169
publish-dry-run:
8270
runs-on: ubuntu-latest
@@ -90,7 +78,7 @@ jobs:
9078
uses: actions/checkout@v4
9179

9280
- name: Set up Deno
93-
uses: denoland/setup-deno@v1
81+
uses: denoland/setup-deno@v2
9482
with:
9583
deno-version: canary
9684

.github/workflows/version_bump.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: version_bump
2+
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
7+
on: workflow_dispatch
8+
9+
jobs:
10+
build:
11+
name: version bump
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 5
14+
15+
steps:
16+
- name: Clone repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Deno
20+
uses: denoland/setup-deno@v2
21+
with:
22+
deno-version: canary
23+
24+
- name: Run version bump
25+
run: |
26+
git fetch --unshallow origin
27+
deno run -A jsr:@deno/bump-workspaces@^0.1/cli
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
GIT_USER_NAME: ${{ github.actor }}
31+
GIT_USER_EMAIL: ${{ github.actor}}@users.noreply.github.com
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: publish
1+
name: workspace publish
22

33
on:
44
release:
55
types: [published]
6+
workflow_dispatch:
67

78
jobs:
89
publish:
@@ -18,15 +19,15 @@ jobs:
1819
uses: actions/checkout@v4
1920

2021
- name: Set up Deno
21-
uses: denoland/setup-deno@v1
22+
uses: denoland/setup-deno@v2
2223
with:
2324
deno-version: canary
2425

2526
- name: Format & Lint
2627
run: deno task check
2728

2829
- name: Build
29-
run: deno task build:check
30+
run: deno task build:wasm:check
3031

3132
- name: Test
3233
run: deno task test

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.DS_Store
22
.idea
3-
.vscode/settings.json
3+
.vscode/*
4+
!.vscode/settings.json
45
.fleet
56
.vim
67
**/cov/
@@ -9,4 +10,4 @@ html_cov/
910
cov.lcov
1011
coverage/
1112
docs/
12-
crypto/hash/_wasm/target
13+
_wasm/target

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"deno.enable": true,
3+
"deno.unstable": true
4+
}

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ console.log(dump(buffer));
5050
utility for text encoding.
5151
- [http](https://jsr.io/@stdext/http): The http package contains utility for
5252
fetching and http servers
53+
- [json](https://jsr.io/@stdext/json): The json package, contains helpers for
54+
json parsing, querying (jsonpath) and processing
55+
- [lexer](https://jsr.io/@stdext/lexer): The lexer package contains general
56+
purpose lexers/tokenizers
57+
- [types](https://jsr.io/@stdext/types): The types package, contains general
58+
purpose type helpers
5359

5460
## Versioning
5561

@@ -68,6 +74,21 @@ implemented.
6874
For modules that use Rust to compile to WASM, we allow the usage of third-party
6975
crates if necessary, but this will be considered on a case-by-case basis.
7076

77+
## WASM
78+
79+
All wasm code is generated from the rust workspace in the [\_wasm](./_wasm)
80+
folder.
81+
82+
To generate the wasm code:
83+
84+
```sh
85+
deno task build:wasm
86+
```
87+
88+
This will call the [build_wasm.ts](./_tools/build_wasm.ts) script and will place
89+
each generated lib in its respective package based on its prefix. See script for
90+
more details.
91+
7192
## Deprecation Policy
7293

7394
We follow the

_tools/build_wasm.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { parse } from "@std/toml";
2+
import { resolve } from "@std/path";
3+
4+
const isCheck = Deno.args.some((a) => a === "--check");
5+
const failFast = Deno.args.some((a) => a === "--fail-fast");
6+
7+
const rawCargo = Deno.readTextFileSync("./_wasm/Cargo.toml");
8+
9+
const parsedCargo = parse(rawCargo) as { workspace: { members: string[] } };
10+
11+
let didFail = false;
12+
13+
for (const member of parsedCargo.workspace.members) {
14+
const [folder] = member.split("_");
15+
const outPath = resolve(
16+
folder,
17+
"_wasm",
18+
);
19+
20+
const args: string[] = [
21+
"run",
22+
"-A",
23+
"jsr:@deno/wasmbuild@0.17.1",
24+
"--js-ext",
25+
"mjs",
26+
"--sync",
27+
"--project",
28+
member,
29+
"--out",
30+
outPath,
31+
];
32+
33+
if (isCheck) {
34+
args.push("--check");
35+
}
36+
37+
const command = new Deno.Command(Deno.execPath(), {
38+
args: args,
39+
cwd: "./_wasm",
40+
});
41+
const child = command.spawn();
42+
const status = await child.status;
43+
if (!status.success) {
44+
didFail = true;
45+
}
46+
if (failFast && didFail) {
47+
Deno.exit(1);
48+
}
49+
}
50+
51+
Deno.exit(didFail ? 1 : 0);

_tools/bump_version.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)