add web-app stub

This commit is contained in:
2026-08-19 14:57:14 +02:00
parent 05c0f4e37c
commit 49a59cfad6
15 changed files with 2001 additions and 2 deletions
Generated
+4
View File
@@ -161,9 +161,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"r-efi",
"rand_core",
"wasm-bindgen",
]
[[package]]
@@ -472,8 +474,10 @@ version = "0.1.0"
dependencies = [
"colored",
"derive_more",
"getrandom",
"indicatif",
"rand",
"rayon",
"tabular",
"wasm-bindgen",
]
+7
View File
@@ -9,6 +9,7 @@ edition = "2021"
[lib]
name = "wordle_solver"
path = "src/lib/lib.rs"
crate-type = ["cdylib", "rlib"]
[[bin]]
name = "wordle-solver"
@@ -21,7 +22,13 @@ path = "src/app/wordle_simulation.rs"
[dependencies]
colored = "3.1.1"
derive_more = { version = "2.1.1", features = [ "debug", "display" ] }
getrandom = { version = "0.4.3", optional = true }
indicatif = { version = "0.18.6", features = ["rayon"] }
rand = "0.10.2"
rayon = "1.12.0"
tabular = { version = "0.2.0", features = ["ansi-cell"] }
wasm-bindgen = { version = "0.2.127", optional = true }
[features]
default = []
wasm-bindgen = ["dep:wasm-bindgen", "getrandom/wasm_js"]
+8 -1
View File
@@ -65,7 +65,14 @@
};
devShells.default = pkgs.mkShell {
buildInputs = [rust-toolchain];
buildInputs = [
rust-toolchain
pkgs.typescript-language-server
pkgs.vscode-langservers-extracted
pkgs.wasm-bindgen-cli
pkgs.wasm-pack
pkgs.yarn
];
};
};
};
+1
View File
@@ -1,3 +1,4 @@
[toolchain]
channel = "1.96.0"
components = [ "rustfmt", "rustc-dev", "rust-analyzer", "rust-src"]
targets = [ "wasm32-unknown-unknown" ] # beside the standard system target
-1
View File
@@ -1,4 +1,3 @@
use std::collections::hash_map;
use std::io;
use std::io::Write;
use std::path::Path;
+2
View File
@@ -1,4 +1,6 @@
pub mod game;
pub mod pattern;
pub mod solver;
#[cfg(feature = "wasm-bindgen")]
pub mod wasm;
pub mod word_list;
+10
View File
@@ -0,0 +1,10 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
fn alert(s: &str);
}
#[wasm_bindgen]
pub fn greet() {
alert("Hello, wasm-on-web!");
}
+24
View File
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
+12
View File
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>WASM Demo</title>
</head>
<body>
<button id="my-button">Do greet</button>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
+29
View File
@@ -0,0 +1,29 @@
{
"name": "web",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"build": "run-s wasm-pack:release tsc vite:build",
"dev": "run-s wasm-pack:dev vite:dev",
"tsc": "tsc",
"vite:build": "vite build",
"vite:dev": "vite -c vite.config.dev.ts",
"vite:preview": "vite preview",
"wasm-pack:dev": "wasm-pack build --dev --features wasm-bindgen --manifest-path ../Cargo.toml",
"wasm-pack:release": "wasm-pack build --features wasm-bindgen --manifest-path ../Cargo.toml"
},
"devDependencies": {
"npm-run-all": "^4.1.5",
"typescript": "~6.0.2",
"vite": "^8.2.0",
"vite-plugin-top-level-await": "^1.6.0",
"vite-plugin-wasm": "^3.6.0",
"vite-plugin-wasm-pack-watcher": "^1.0.1"
},
"dependencies": {
"esbuild": "^0.28.2",
"rollup": "^4.62.4",
"wordle-solver": "link:../pkg"
}
}
+7
View File
@@ -0,0 +1,7 @@
import { greet } from "wordle-solver";
const button = document.getElementById("my-button")!;
button.addEventListener("click", () => {
greet();
});
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"target": "es2023",
"module": "esnext",
"lib": ["ES2023", "DOM"],
"types": ["vite/client"],
"allowArbitraryExtensions": true,
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
}
+12
View File
@@ -0,0 +1,12 @@
import { defineConfig } from "vite";
import wasm from "vite-plugin-wasm";
import wasmPackWatchPlugin from "vite-plugin-wasm-pack-watcher";
export default defineConfig({
build: {
watch: {
include: ["src/**/*.ts", "../src/**/*.rs"],
},
},
plugins: [wasmPackWatchPlugin(), wasm()],
});
+6
View File
@@ -0,0 +1,6 @@
import { defineConfig } from "vite";
import wasm from "vite-plugin-wasm";
export default defineConfig({
plugins: [wasm()],
});
+1855
View File
File diff suppressed because it is too large Load Diff