toiljs 0.0.121 → 0.0.123

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,79 @@
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ import react from '@vitejs/plugin-react';
4
+ import { webdriverio } from '@vitest/browser-webdriverio';
5
+ import { defineConfig } from 'vitest/config';
6
+ export function defineTestConfig(options = {}) {
7
+ const root = path.resolve(options.root ?? process.cwd());
8
+ const browserBinary = process.env.TOIL_TEST_BROWSER_BINARY;
9
+ const driverBinary = process.env.TOIL_TEST_CHROMEDRIVER;
10
+ const setup = fileURLToPath(new URL('./setup.js', import.meta.url));
11
+ return defineConfig({
12
+ root,
13
+ publicDir: path.join(root, 'client/public'),
14
+ plugins: [react()],
15
+ resolve: {
16
+ alias: { client: path.join(root, 'client'), shared: path.join(root, 'shared') },
17
+ dedupe: ['react', 'react-dom'],
18
+ },
19
+ test: {
20
+ coverage: {
21
+ provider: 'v8',
22
+ reporter: ['text', 'html', 'json', 'lcov'],
23
+ reportsDirectory: path.join(root, 'coverage'),
24
+ include: ['client/**/*.{ts,tsx}', 'shared/**/*.{ts,tsx}'],
25
+ exclude: ['**/*.d.ts', '**/*.{test,spec}.{ts,tsx}', 'shared/server.ts'],
26
+ },
27
+ projects: [
28
+ {
29
+ extends: true,
30
+ test: {
31
+ name: 'unit',
32
+ environment: 'node',
33
+ include: [
34
+ ...(options.unitInclude ?? [
35
+ '{client,tests,test}/**/*.{test,spec}.{ts,tsx}',
36
+ ]),
37
+ ],
38
+ exclude: [
39
+ '**/*.browser.{test,spec}.{ts,tsx}',
40
+ '**/node_modules/**',
41
+ '**/build/**',
42
+ ],
43
+ setupFiles: [setup],
44
+ },
45
+ },
46
+ {
47
+ extends: true,
48
+ test: {
49
+ name: 'browser',
50
+ include: [
51
+ ...(options.browserInclude ?? [
52
+ '{client,tests,test}/**/*.browser.{test,spec}.{ts,tsx}',
53
+ ]),
54
+ ],
55
+ setupFiles: [setup],
56
+ browser: {
57
+ enabled: true,
58
+ headless: options.headless ?? true,
59
+ provider: webdriverio({
60
+ logLevel: 'error',
61
+ capabilities: {
62
+ 'wdio:enforceWebDriverClassic': true,
63
+ ...(driverBinary
64
+ ? { 'wdio:chromedriverOptions': { binary: driverBinary } }
65
+ : {}),
66
+ 'goog:chromeOptions': {
67
+ ...(browserBinary ? { binary: browserBinary } : {}),
68
+ args: [...(options.chromeArgs ?? [])],
69
+ },
70
+ },
71
+ }),
72
+ instances: [{ browser: 'chrome' }],
73
+ },
74
+ },
75
+ },
76
+ ],
77
+ },
78
+ });
79
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import * as Toil from 'toiljs/client';
2
+ import { DataReader, DataWriter, FastMap, FastSet } from 'toiljs/io';
3
+ Object.assign(globalThis, {
4
+ Toil,
5
+ DataReader,
6
+ DataWriter,
7
+ FastMap,
8
+ FastSet,
9
+ Server: Toil.Server,
10
+ parseError: Toil.parseError,
11
+ });
@@ -0,0 +1,12 @@
1
+ export default function Docs() {
2
+ const { slug } = Toil.useParams();
3
+ return (
4
+ <main>
5
+ <h1>Docs</h1>
6
+ <p>
7
+ Catch-all route <code>client/routes/docs/[...slug].tsx</code> matched: <code>{slug}</code>
8
+ </p>
9
+ <Toil.Link href="/">Back home</Toil.Link>
10
+ </main>
11
+ );
12
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "toiljs",
3
3
  "type": "module",
4
- "version": "0.0.121",
4
+ "version": "0.0.123",
5
5
  "author": "Dacely",
6
6
  "description": "The modern React framework: a file-based React frontend and a ToilScript-compiled WebAssembly backend.",
7
7
  "repository": {
@@ -77,6 +77,16 @@
77
77
  "./oxlint": {
78
78
  "types": "./presets/oxlint.d.ts",
79
79
  "default": "./presets/oxlint.js"
80
+ },
81
+ "./vitest": {
82
+ "types": "./build/testing/config.d.ts",
83
+ "import": "./build/testing/config.js",
84
+ "default": "./build/testing/config.js"
85
+ },
86
+ "./vitest/setup": {
87
+ "types": "./build/testing/setup.d.ts",
88
+ "import": "./build/testing/setup.js",
89
+ "default": "./build/testing/setup.js"
80
90
  }
81
91
  },
82
92
  "bin": {
@@ -105,7 +115,7 @@
105
115
  "watch": "tsc -p tsconfig.json --watch",
106
116
  "prepublishOnly": "npm run build",
107
117
  "gen:docs": "node scripts/gen-toil-docs.mjs",
108
- "build": "npm run build:shared && npm run build:logger && npm run build:io && npm run build:client && npm run build:backend && npm run build:devserver && npm run build:compiler && npm run build:cli",
118
+ "build": "npm run build:shared && npm run build:logger && npm run build:io && npm run build:client && npm run build:backend && npm run build:devserver && npm run build:compiler && npm run build:cli && npm run build:testing",
109
119
  "build:shared": "tsc -p tsconfig.shared.json",
110
120
  "build:logger": "tsc -p tsconfig.logger.json",
111
121
  "build:client": "tsc -p tsconfig.client.json",
@@ -115,6 +125,7 @@
115
125
  "build:compiler": "npm run gen:docs && tsc -p tsconfig.compiler.json",
116
126
  "build:cli": "tsc -p tsconfig.cli.json --noEmit && esbuild src/cli/index.ts --bundle --platform=node --format=esm --outfile=build/cli/index.js --external:toiljs/*",
117
127
  "test": "vitest run --coverage",
128
+ "test:create": "npm run build && node scripts/test-create-install.mjs",
118
129
  "test:watch": "vitest",
119
130
  "test:ui": "vitest --ui",
120
131
  "test:coverage": "vitest run --coverage",
@@ -123,7 +134,8 @@
123
134
  "lint": "oxlint --type-aware src",
124
135
  "docs": "npm run build && node scripts/gen-api-docs.mjs",
125
136
  "setup": "npm i && npm run build",
126
- "typecheck": "tsc --noEmit -p tsconfig.json"
137
+ "typecheck": "tsc --noEmit -p tsconfig.json",
138
+ "build:testing": "tsc -p tsconfig.testing.json"
127
139
  },
128
140
  "dependencies": {
129
141
  "@dacely/hyper-express": "^6.17.4",
@@ -131,19 +143,19 @@
131
143
  "@dacely/toilscript-loader": "^0.1.0",
132
144
  "@noble/curves": "^2.4.0",
133
145
  "@stylistic/eslint-plugin": "^5.10.0",
134
- "@vitejs/plugin-react": "^6.1.1",
146
+ "@vitejs/plugin-react": "^6.1.2",
135
147
  "eslint-plugin-react-hooks": "^7.1.1",
136
148
  "hash-wasm": "^4.12.0",
137
- "juice": "^12.1.3",
138
- "nodemailer": "^10.0.10",
139
- "oxc-parser": "^0.150.0",
140
- "oxlint": "^1.83.0",
141
- "oxlint-tsgolint": "^7.0.2001",
149
+ "juice": "^12.2.0",
150
+ "nodemailer": "^10.0.16",
151
+ "oxc-parser": "^0.153.0",
152
+ "oxlint": "^1.87.0",
153
+ "oxlint-tsgolint": "^7.0.2003",
142
154
  "picocolors": "^1.1.1",
143
155
  "semver": "^7.8.5",
144
- "sharp": "^0.35.4",
156
+ "sharp": "^0.35.5",
145
157
  "toilscript": ">=0.1.63",
146
- "vite": "^8.3.0",
158
+ "vite": "^8.3.4",
147
159
  "vite-imagetools": "^12.0.1",
148
160
  "vite-plugin-node-polyfills": "^0.28.0"
149
161
  },
@@ -152,32 +164,51 @@
152
164
  "react": "^19.3.0",
153
165
  "react-dom": "^19.3.0",
154
166
  "toilscript": ">=0.1.63",
155
- "typescript": ">=7.0.2 <8.0.0"
167
+ "vitest": "^5.0.3",
168
+ "@vitest/browser-webdriverio": "^5.0.0",
169
+ "@vitest/coverage-v8": "^5.0.3",
170
+ "webdriverio": "^10.0.2"
156
171
  },
157
172
  "overrides": {
158
173
  "elliptic": "file:./stubs/elliptic"
159
174
  },
160
175
  "devDependencies": {
161
- "@babel/core": "^8.0.5",
162
- "@babel/preset-env": "^8.0.5",
163
- "@babel/preset-typescript": "^8.0.1",
176
+ "@babel/core": "^8.0.7",
177
+ "@babel/preset-env": "^8.0.7",
178
+ "@babel/preset-typescript": "^8.0.7",
164
179
  "@clack/prompts": "^1.8.1",
165
180
  "@testing-library/dom": "^10.4.2",
166
181
  "@testing-library/react": "^16.3.3",
167
- "@types/node": "^26.5.1",
168
- "@types/nodemailer": "^8.0.1",
182
+ "@types/node": "^26.6.5",
183
+ "@types/nodemailer": "^8.0.2",
169
184
  "@types/react": "^19.3.0",
170
185
  "@types/react-dom": "^19.3.0",
171
186
  "@types/semver": "^7.8.0",
172
- "@vitest/coverage-v8": "^5.0.0",
173
- "@vitest/ui": "^5.0.0",
187
+ "@vitest/browser-webdriverio": "^5.0.0",
188
+ "@vitest/coverage-v8": "^5.0.3",
189
+ "@vitest/ui": "^5.0.3",
174
190
  "esbuild": "^0.28.2",
175
- "jsdom": "^30.0.1",
191
+ "jsdom": "^30.1.2",
176
192
  "micromatch": "^4.0.8",
177
- "prettier": "^3.9.6",
193
+ "prettier": "^3.9.9",
178
194
  "react": "^19.3.0",
179
195
  "react-dom": "^19.3.0",
180
196
  "typescript": "^7.0.2",
181
- "vitest": "^5.0.0"
197
+ "vitest": "^5.0.3",
198
+ "webdriverio": "^10.0.2"
199
+ },
200
+ "peerDependenciesMeta": {
201
+ "vitest": {
202
+ "optional": true
203
+ },
204
+ "@vitest/browser-webdriverio": {
205
+ "optional": true
206
+ },
207
+ "@vitest/coverage-v8": {
208
+ "optional": true
209
+ },
210
+ "webdriverio": {
211
+ "optional": true
212
+ }
182
213
  }
183
214
  }
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "./tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "module": "ESNext",
5
+ "target": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "rootDir": "src/testing",
8
+ "outDir": "build/testing",
9
+ "types": ["node"],
10
+ "tsBuildInfoFile": "build/testing/.tsbuildinfo"
11
+ },
12
+ "include": ["src/testing/**/*"]
13
+ }