Skip to content

Commit a2f6c13

Browse files
committed
chore: upgrade toolchain
1 parent 8b0be16 commit a2f6c13

File tree

15 files changed

+3988
-3930
lines changed

15 files changed

+3988
-3930
lines changed

.github/workflows/ci.yaml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
target: 'aarch64-pc-windows-msvc'
9797
build: |
9898
npm i -g @napi-rs/cli
99-
yarn workspaces foreach --no-private -j 1 --exclude @node-rs/jsonwebtoken run build --target aarch64-pc-windows-msvc
99+
yarn build --target aarch64-pc-windows-msvc
100100
101101
name: stable - ${{ matrix.settings.target }} - node@18
102102
runs-on: ${{ matrix.settings.host }}
@@ -115,7 +115,7 @@ jobs:
115115
uses: dtolnay/rust-toolchain@stable
116116
if: ${{ !matrix.settings.docker }}
117117
with:
118-
toolchain: nightly-2023-07-19
118+
toolchain: nightly-2023-10-25
119119
targets: ${{ matrix.settings.target }}
120120

121121
- name: Cache cargo registry
@@ -184,19 +184,21 @@ jobs:
184184
- uses: actions/checkout@v3
185185
- name: Build
186186
id: build
187-
uses: vmactions/freebsd-vm@v0
187+
uses: cross-platform-actions/action@v0.20.0
188188
env:
189189
DEBUG: 'napi:*'
190190
RUSTUP_HOME: /usr/local/rustup
191191
CARGO_HOME: /usr/local/cargo
192192
RUSTUP_IO_THREADS: 1
193193
with:
194-
envs: 'DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS'
195-
usesh: true
196-
mem: 3000
197-
prepare: |
198-
pkg install -y -f curl node libnghttp2 npm
199-
npm install -g yarn --ignore-scripts
194+
operating_system: freebsd
195+
version: '13.2'
196+
memory: 13G
197+
cpu_count: 3
198+
environment_variables: 'DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS'
199+
run: |
200+
sudo pkg install -y -f curl node libnghttp2 npm
201+
sudo npm install -g yarn --ignore-scripts
200202
curl https://sh.rustup.rs -sSf --output rustup.sh
201203
sh rustup.sh -y --profile minimal --default-toolchain stable
202204
export PATH="/usr/local/cargo/bin:$PATH"
@@ -206,7 +208,6 @@ jobs:
206208
node -v
207209
echo "~~~~ yarn --version ~~~~"
208210
yarn --version
209-
run: |
210211
export PATH="/usr/local/cargo/bin:$PATH"
211212
pwd
212213
ls -lah
@@ -241,7 +242,7 @@ jobs:
241242
target: 'x86_64-apple-darwin'
242243
- host: windows-latest
243244
target: 'x86_64-pc-windows-msvc'
244-
node: ['16', '18']
245+
node: ['18', '20']
245246
runs-on: ${{ matrix.settings.host }}
246247

247248
steps:
@@ -287,7 +288,7 @@ jobs:
287288
strategy:
288289
fail-fast: false
289290
matrix:
290-
node: ['16', '18']
291+
node: ['18', '20']
291292
runs-on: ubuntu-latest
292293

293294
steps:
@@ -339,7 +340,7 @@ jobs:
339340

340341
- name: Install dependencies
341342
run: |
342-
curl -sL https://rpm.nodesource.com/setup_16.x | bash -
343+
curl -sL https://rpm.nodesource.com/setup_18.x | bash -
343344
yum install nodejs -y
344345
npm install -g yarn
345346
yarn install --immutable --mode=skip-build
@@ -372,7 +373,7 @@ jobs:
372373
strategy:
373374
fail-fast: false
374375
matrix:
375-
node: ['16', '18']
376+
node: ['18', '20']
376377
runs-on: ubuntu-latest
377378

378379
steps:
@@ -421,7 +422,7 @@ jobs:
421422
strategy:
422423
fail-fast: false
423424
matrix:
424-
node: ['16', '18']
425+
node: ['18', '20']
425426
runs-on: ubuntu-latest
426427

427428
steps:
@@ -517,7 +518,7 @@ jobs:
517518
strategy:
518519
fail-fast: false
519520
matrix:
520-
node: ['16', '18']
521+
node: ['18', '20']
521522
runs-on: ubuntu-latest
522523

523524
steps:

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Install
2424
uses: dtolnay/rust-toolchain@stable
2525
with:
26-
toolchain: nightly-2023-07-19
26+
toolchain: nightly-2023-10-25
2727
components: rustfmt, clippy
2828

2929
- name: 'Install dependencies'

.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

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

.yarn/releases/yarn-3.6.4.cjs

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

.yarn/releases/yarn-4.0.0.cjs

Lines changed: 893 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,4 @@ nodeLinker: node-modules
22

33
npmRegistryServer: 'https://registry.npmjs.org/'
44

5-
plugins:
6-
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
7-
spec: '@yarnpkg/plugin-workspace-tools'
8-
9-
yarnPath: .yarn/releases/yarn-3.6.4.cjs
5+
yarnPath: .yarn/releases/yarn-4.0.0.cjs

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-rs",
3-
"packageManager": "yarn@3.6.4",
3+
"packageManager": "yarn@4.0.0",
44
"version": "0.0.0",
55
"description": "Node & Rust bindings monorepo",
66
"author": "LongYinan <lynweklm@gmail.com>",
@@ -10,9 +10,9 @@
1010
"packages/*"
1111
],
1212
"scripts": {
13-
"artifacts": "yarn workspaces foreach --no-private run artifacts",
13+
"artifacts": "yarn workspaces foreach -A --no-private run artifacts",
1414
"bench": "lerna run bench --concurrency 1 --stream --no-prefix",
15-
"build": "yarn workspaces foreach --no-private -j 1 run build",
15+
"build": "yarn workspaces foreach -A --no-private -j 1 run build",
1616
"build:ts": "tsc -b tsconfig.project.json -verbose",
1717
"lint": "eslint . -c ./.eslintrc.yml \"packages/**/*.{ts,js}\"",
1818
"test": "ava",

packages/argon2/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ version = "0.0.0"
77
crate-type = ["cdylib"]
88

99
[dependencies]
10-
argon2 = "0.5"
10+
argon2 = { version = "0.5", features = ["rand"] }
1111
global_alloc = { path = "../../crates/alloc" }
1212
napi = { version = "2", default-features = false, features = ["napi3"] }
1313
napi-derive = { version = "2", default-features = false, features = [
1414
"type-def",
1515
] }
16-
rand = { version = "0.8", features = ["nightly", "simd_support", "getrandom"] }
16+
rand_core = { version = "0.6", features = ["getrandom"] }
1717

1818
[build-dependencies]
1919
napi-build = "2"

packages/argon2/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ use napi::bindgen_prelude::*;
77
use napi_derive::napi;
88

99
use argon2::{
10-
password_hash::{rand_core::OsRng, PasswordHasher, PasswordVerifier, SaltString},
10+
password_hash::{PasswordHasher, PasswordVerifier, SaltString},
1111
Argon2, Params,
1212
};
13+
use rand_core::OsRng;
1314

1415
#[napi]
1516
pub enum Algorithm {

packages/jsonwebtoken/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ napi = { version = "2", default-features = false, features = [
1515
"serde-json",
1616
] }
1717
napi-derive = { version = "2" }
18-
rand = "0.8"
18+
rand_core = { version = "0.6", features = ["std"] }
1919
serde = "1.0"
2020
serde_json = "1.0"
2121

packages/jsonwebtoken/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"aarch64-linux-android",
2626
"aarch64-unknown-linux-gnu",
2727
"aarch64-unknown-linux-musl",
28+
"aarch64-pc-windows-msvc",
2829
"armv7-unknown-linux-gnueabihf",
2930
"x86_64-unknown-linux-musl",
3031
"x86_64-unknown-freebsd",

packages/jsonwebtoken/src/sign.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
use jsonwebtoken::{self};
21
use napi::{bindgen_prelude::*, JsBuffer, JsBufferValue, Ref};
32
use napi_derive::napi;
4-
use std::borrow::Borrow;
53

64
use crate::{claims::Claims, header::Header};
75

@@ -68,7 +66,7 @@ pub struct SignTask {
6866
impl SignTask {
6967
#[inline]
7068
pub fn sign(claims: &Claims, header: &Header, key: &[u8]) -> Result<String> {
71-
let header: &jsonwebtoken::Header = &header.borrow().into();
69+
let header: &jsonwebtoken::Header = &header.into();
7270
let claims = &claims;
7371
let sign_key = &into_encoding_key(key, &header.alg)?;
7472

packages/jsonwebtoken/src/verify.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use napi::{bindgen_prelude::*, JsBuffer, JsBufferValue, Ref};
22
use napi_derive::napi;
3-
use std::borrow::Borrow;
43

54
use crate::{claims::Claims, validation::Validation};
65

@@ -66,7 +65,7 @@ pub struct VerifyTask {
6665

6766
impl VerifyTask {
6867
pub fn verify(token: &str, key: &[u8], validation: &Validation) -> Result<Claims> {
69-
let validation: &jsonwebtoken::Validation = &validation.borrow().into();
68+
let validation: &jsonwebtoken::Validation = &validation.into();
7069

7170
let first_alg = validation.algorithms.first().ok_or(Error::new(
7271
Status::InvalidArg,
@@ -112,7 +111,7 @@ pub fn verify(
112111
VerifyTask {
113112
token,
114113
key: AsyncKeyInput::from_either(key)?,
115-
validation: validation.unwrap_or(Validation::default()),
114+
validation: validation.unwrap_or_default(),
116115
},
117116
abort_signal,
118117
))
@@ -124,6 +123,6 @@ pub fn verify_sync(
124123
key: Either<String, Buffer>,
125124
validation: Option<Validation>,
126125
) -> Result<Claims> {
127-
let validation = validation.unwrap_or(Validation::default());
126+
let validation = validation.unwrap_or_default();
128127
VerifyTask::verify(&token, key.as_ref(), &validation)
129128
}

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2023-07-19
1+
nightly-2023-10-25

0 commit comments

Comments
 (0)