mirror of
https://codeberg.org/demostf/inspector.git
synced 2026-06-03 10:04:09 +02:00
flake reorg, enable panic hook
This commit is contained in:
parent
f64ffd6cfb
commit
667569052c
18 changed files with 200 additions and 165 deletions
|
|
@ -1,6 +1,8 @@
|
|||
install:
|
||||
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
||||
- if not defined RUSTFLAGS rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly
|
||||
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName
|
||||
rustup-init.exe
|
||||
- if not defined RUSTFLAGS rustup-init.exe -y --default-host
|
||||
x86_64-pc-windows-msvc --default-toolchain nightly
|
||||
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
|
||||
- rustc -V
|
||||
- cargo -V
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
name: "Build"
|
||||
name: "CI"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
checks:
|
||||
runs-on: nix
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: https://codeberg.org/icewind/attic-action@v1
|
||||
with:
|
||||
name: ci
|
||||
instance: https://cache.icewind.me
|
||||
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||
- run: nix build
|
||||
name: link
|
||||
instance: https://cache.icewind.link
|
||||
authToken: "${{ secrets.ATTIC_TOKEN }}"
|
||||
- run: nix flake check --keep-going
|
||||
|
|
|
|||
40
.travis.yml
40
.travis.yml
|
|
@ -5,7 +5,6 @@ cache: cargo
|
|||
|
||||
matrix:
|
||||
include:
|
||||
|
||||
# Builds with wasm-pack.
|
||||
- rust: beta
|
||||
env: RUST_BACKTRACE=1
|
||||
|
|
@ -13,10 +12,13 @@ matrix:
|
|||
firefox: latest
|
||||
chrome: stable
|
||||
before_script:
|
||||
- (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update)
|
||||
- (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers "^0.2" cargo-generate)
|
||||
- (test -x $HOME/.cargo/bin/cargo-install-update || cargo install
|
||||
cargo-update)
|
||||
- (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers
|
||||
"^0.2" cargo-generate)
|
||||
- cargo install-update -a
|
||||
- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f
|
||||
- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||
-s -- -f
|
||||
script:
|
||||
- cargo generate --git . --name testing
|
||||
# Having a broken Cargo.toml (in that it has curlies in fields) anywhere
|
||||
|
|
@ -30,8 +32,10 @@ matrix:
|
|||
- rust: nightly
|
||||
env: RUST_BACKTRACE=1
|
||||
before_script:
|
||||
- (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update)
|
||||
- (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers "^0.2" cargo-generate)
|
||||
- (test -x $HOME/.cargo/bin/cargo-install-update || cargo install
|
||||
cargo-update)
|
||||
- (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers
|
||||
"^0.2" cargo-generate)
|
||||
- cargo install-update -a
|
||||
- rustup target add wasm32-unknown-unknown
|
||||
script:
|
||||
|
|
@ -42,17 +46,23 @@ matrix:
|
|||
- cargo check --target wasm32-unknown-unknown
|
||||
- cargo check --no-default-features
|
||||
- cargo check --target wasm32-unknown-unknown --no-default-features
|
||||
- cargo check --no-default-features --features console_error_panic_hook
|
||||
- cargo check --target wasm32-unknown-unknown --no-default-features --features console_error_panic_hook
|
||||
- cargo check --no-default-features --features "console_error_panic_hook wee_alloc"
|
||||
- cargo check --target wasm32-unknown-unknown --no-default-features --features "console_error_panic_hook wee_alloc"
|
||||
- cargo check --no-default-features
|
||||
--features console_error_panic_hook
|
||||
- cargo check --target wasm32-unknown-unknown --no-default-features
|
||||
--features console_error_panic_hook
|
||||
- cargo check --no-default-features
|
||||
--features "console_error_panic_hook wee_alloc"
|
||||
- cargo check --target wasm32-unknown-unknown --no-default-features
|
||||
--features "console_error_panic_hook wee_alloc"
|
||||
|
||||
# Builds on beta.
|
||||
- rust: beta
|
||||
env: RUST_BACKTRACE=1
|
||||
before_script:
|
||||
- (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update)
|
||||
- (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers "^0.2" cargo-generate)
|
||||
- (test -x $HOME/.cargo/bin/cargo-install-update || cargo install
|
||||
cargo-update)
|
||||
- (test -x $HOME/.cargo/bin/cargo-generate || cargo install --vers
|
||||
"^0.2" cargo-generate)
|
||||
- cargo install-update -a
|
||||
- rustup target add wasm32-unknown-unknown
|
||||
script:
|
||||
|
|
@ -63,7 +73,9 @@ matrix:
|
|||
- cargo check --target wasm32-unknown-unknown
|
||||
- cargo check --no-default-features
|
||||
- cargo check --target wasm32-unknown-unknown --no-default-features
|
||||
- cargo check --no-default-features --features console_error_panic_hook
|
||||
- cargo check --target wasm32-unknown-unknown --no-default-features --features console_error_panic_hook
|
||||
- cargo check --no-default-features
|
||||
--features console_error_panic_hook
|
||||
- cargo check --target wasm32-unknown-unknown --no-default-features
|
||||
--features console_error_panic_hook
|
||||
# Note: no enabling the `wee_alloc` feature here because it requires
|
||||
# nightly for now.
|
||||
|
|
|
|||
1
wasm/Cargo.lock → Cargo.lock
generated
1
wasm/Cargo.lock → Cargo.lock
generated
|
|
@ -80,7 +80,6 @@ dependencies = [
|
|||
"js-sys",
|
||||
"serde",
|
||||
"serde-wasm-bindgen",
|
||||
"serde_json",
|
||||
"tf-demo-parser",
|
||||
"wasm-bindgen",
|
||||
"wee_alloc",
|
||||
|
|
@ -14,7 +14,6 @@ default = ["console_error_panic_hook"]
|
|||
bitbuffer = "0.11.1"
|
||||
tf-demo-parser = "0.6"
|
||||
serde = { version = "1.0.219", features = ["derive"] }
|
||||
serde_json = "1.0.140"
|
||||
js-sys = "0.3.77"
|
||||
wasm-bindgen = { version = "0.2.100" }
|
||||
serde-wasm-bindgen = "0.6.5"
|
||||
|
|
@ -28,8 +27,6 @@ console_error_panic_hook = { version = "0.1.7", optional = true }
|
|||
# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
|
||||
# compared to the default allocator's ~10K. It is slower than the default
|
||||
# allocator, however.
|
||||
#
|
||||
# Unfortunately, `wee_alloc` requires nightly Rust when targeting wasm for now.
|
||||
wee_alloc = { version = "0.4.5", optional = true }
|
||||
|
||||
|
||||
122
flake.lock
generated
122
flake.lock
generated
|
|
@ -1,77 +1,103 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"crane": {
|
||||
"locked": {
|
||||
"lastModified": 1748460882,
|
||||
"narHash": "sha256-nm8eV2p7m4t3eSgqlDJM8pvZaAPifd4LsoSPndufAIY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0ec1b79c9f7111d5df758d106bfa9aedad362ca0",
|
||||
"lastModified": 1748970125,
|
||||
"narHash": "sha256-UDyigbDGv8fvs9aS95yzFfOKkEjx1LO3PL3DsKopohA=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "323b5746d89e04b22554b061522dfce9e4c49b18",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "release-25.05",
|
||||
"type": "indirect"
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay",
|
||||
"utils": "utils"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"flakelight": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1748140821,
|
||||
"narHash": "sha256-GZcjWLQtDifSYMd1ueLDmuVTcQQdD5mONIBTqABooOk=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "476b2ba7dc99ddbf70b1f45357dbbdbdbdfb4422",
|
||||
"lastModified": 1750683087,
|
||||
"narHash": "sha256-CkmobghX9K9soC4DoorFo/vlWXxpf8xuZyoCsOnWzqM=",
|
||||
"owner": "nix-community",
|
||||
"repo": "flakelight",
|
||||
"rev": "aa93e0e1ecdccc70c7a185f60c562effbfe3c8d9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"owner": "nix-community",
|
||||
"repo": "flakelight",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"mill-scale": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
"crane": "crane",
|
||||
"flakelight": [
|
||||
"flakelight"
|
||||
],
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"lastModified": 1751058017,
|
||||
"narHash": "sha256-Pa6Nnkp9sW7ufONQE9jvIDb1rUQUjVsAVZRGU9R3xp0=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "8907224f8770afd89894b4c927d86c9c249d5593",
|
||||
"revCount": 54,
|
||||
"type": "git",
|
||||
"url": "https://codeberg.org/icewind/mill-scale.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://codeberg.org/icewind/mill-scale.git"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1750838302,
|
||||
"narHash": "sha256-aVkL3/yu50oQzi2YuKo0ceiCypVZpZXYd2P2p1FMJM4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "7284e2decc982b81a296ab35aa46e804baaa1cfe",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-25.05",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flakelight": "flakelight",
|
||||
"mill-scale": "mill-scale",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"mill-scale",
|
||||
"flakelight",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1750214276,
|
||||
"narHash": "sha256-1kniuhH70q4TAC/xIvjFYH46aHiLrbIlcr6fdrRwO1A=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "f9b2b2b1327ff6beab4662b8ea41689e0a57b8d4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
52
flake.nix
52
flake.nix
|
|
@ -1,46 +1,32 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/release-25.05";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
nixpkgs.url = "nixpkgs/nixos-25.05";
|
||||
flakelight = {
|
||||
url = "github:nix-community/flakelight";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
mill-scale = {
|
||||
url = "git+https://codeberg.org/icewind/mill-scale.git";
|
||||
inputs.flakelight.follows = "flakelight";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
utils,
|
||||
rust-overlay,
|
||||
}:
|
||||
utils.lib.eachDefaultSystem (system: let
|
||||
overlays = [
|
||||
(import rust-overlay)
|
||||
};
|
||||
outputs = {mill-scale, ...}:
|
||||
mill-scale ./. {
|
||||
withOverlays = [
|
||||
(import ./nix/overlay.nix)
|
||||
];
|
||||
pkgs = import nixpkgs {
|
||||
inherit system overlays;
|
||||
};
|
||||
in rec {
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
cargo-edit
|
||||
bacon
|
||||
wasm-pack
|
||||
nodejs_20
|
||||
node2nix
|
||||
wasm-bindgen-cli
|
||||
json-schema-to-typescript
|
||||
];
|
||||
|
||||
toolchain = pkgs:
|
||||
pkgs.rust-bin.stable.latest.default.override {
|
||||
targets = ["wasm32-unknown-unknown"];
|
||||
};
|
||||
|
||||
packages = rec {
|
||||
inherit (pkgs) json-schema-to-typescript demo-inspector demo-inspector-wasm demo-inspector-node-modules;
|
||||
default = demo-inspector;
|
||||
packages = {
|
||||
json-schema-to-typescript = pkgs: pkgs.json-schema-to-typescript;
|
||||
demo-inspector = pkgs: pkgs.demo-inspector;
|
||||
demo-inspector-wasm = pkgs: pkgs.demo-inspector-wasm;
|
||||
};
|
||||
})
|
||||
// {
|
||||
|
||||
overlays.default = import ./nix/overlay.nix;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
importNpmLock,
|
||||
demo-inspector-wasm,
|
||||
nodejs,
|
||||
}: importNpmLock.buildNodeModules {
|
||||
}:
|
||||
importNpmLock.buildNodeModules {
|
||||
npmRoot = ../www;
|
||||
derivationArgs = {
|
||||
npmDeps = importNpmLock {
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@
|
|||
rust-bin,
|
||||
wasm-pack,
|
||||
binaryen,
|
||||
lib
|
||||
lib,
|
||||
}: let
|
||||
deps = (builtins.fromTOML (builtins.readFile ../wasm/Cargo.toml)).dependencies;
|
||||
deps = (builtins.fromTOML (builtins.readFile ../Cargo.toml)).dependencies;
|
||||
wasm-bindgen-version = lib.strings.removePrefix "=" deps.wasm-bindgen.version;
|
||||
wasm-bindgen-cli = rustPlatform.buildRustPackage rec {
|
||||
pname = "wasm-bindgen-cli";
|
||||
|
|
@ -37,10 +37,10 @@ in
|
|||
version = "0.1.0";
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ../wasm/Cargo.lock;
|
||||
lockFile = ../Cargo.lock;
|
||||
};
|
||||
|
||||
src = ../wasm;
|
||||
src = ../.;
|
||||
|
||||
WASM_PACK_CACHE = "/build/cache";
|
||||
nativeBuildInputs = [rust-wasm wasm-pack wasm-bindgen-cli binaryen];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
{ lib, buildNpmPackage, fetchFromGitHub }:
|
||||
|
||||
{
|
||||
lib,
|
||||
buildNpmPackage,
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
buildNpmPackage rec {
|
||||
pname = "json-schema-to-typescript";
|
||||
version = "13.1.2";
|
||||
|
|
@ -23,6 +26,6 @@ buildNpmPackage rec {
|
|||
description = "Compile JSONSchema to TypeScript type declarations";
|
||||
homepage = "https://github.com/bcherny/json-schema-to-typescript";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ icewind1991 ];
|
||||
maintainers = with maintainers; [icewind1991];
|
||||
};
|
||||
}
|
||||
|
|
@ -36,6 +36,9 @@ pub struct Parser {
|
|||
impl Parser {
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new(input: Vec<u8>, progress: Function) -> Self {
|
||||
#[cfg(feature = "console_error_panic_hook")]
|
||||
console_error_panic_hook::set_once();
|
||||
|
||||
let buffer = BitReadBuffer::new_owned(input, LittleEndian);
|
||||
let mut stream = BitReadStream::new(buffer);
|
||||
let header = Header::read(&mut stream).unwrap();
|
||||
14
www/package-lock.json
generated
14
www/package-lock.json
generated
|
|
@ -8,7 +8,7 @@
|
|||
"name": "create-wasm-app",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"demo-inspector": "file:../wasm/pkg",
|
||||
"demo-inspector": "file:../pkg",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-dropzone": "^14.2.2",
|
||||
|
|
@ -44,7 +44,13 @@
|
|||
"webpack-dev-server": "^4.10.1"
|
||||
}
|
||||
},
|
||||
"../wasm/pkg": {},
|
||||
"../pkg": {
|
||||
"name": "demo-inspector",
|
||||
"version": "0.1.0"
|
||||
},
|
||||
"../wasm/pkg": {
|
||||
"extraneous": true
|
||||
},
|
||||
"node_modules/@ampproject/remapping": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz",
|
||||
|
|
@ -2548,7 +2554,7 @@
|
|||
}
|
||||
},
|
||||
"node_modules/demo-inspector": {
|
||||
"resolved": "../wasm/pkg",
|
||||
"resolved": "../pkg",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/depd": {
|
||||
|
|
@ -9987,7 +9993,7 @@
|
|||
"dev": true
|
||||
},
|
||||
"demo-inspector": {
|
||||
"version": "file:../wasm/pkg"
|
||||
"version": "file:../pkg"
|
||||
},
|
||||
"depd": {
|
||||
"version": "1.1.2",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
"start": "webpack serve --hot"
|
||||
},
|
||||
"dependencies": {
|
||||
"demo-inspector": "file:../wasm/pkg",
|
||||
"demo-inspector": "file:../pkg",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-dropzone": "^14.2.2",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue