Conversation
Replaces webpack 5 + babel-loader + @babel/preset-env + @babel/core with a single 'vite' devDependency. Vite uses esbuild internally and targets esnext, matching the WebAssembly hard requirement of the library's runtime. - Add vite.config.js using Vite library mode. Produces the same two outputs as before (dist/ARFset.js as ESM, dist/ARFset.umd.js as UMD exposing window.ARFset) with no consumer-visible change in shape. - Delete webpack.config.cjs. - Replace 5 devDependencies (webpack, webpack-cli, babel-loader, @babel/core, @babel/preset-env) with 1 (vite). - Update scripts: build-es6 -> 'vite build', dev-es6 -> 'vite build --watch'. - Drop the obsolete 'watch' script (legacy js/ directory is gone). - Preserve the hand-written dist/ARFset.d.ts across builds via emptyOutDir: false. Refs #26 Refs #31
Two complementary layers:
Vitest covers the pure JS paths that don't need wasm:
- Utils.string2Uint8Data, fetchRemoteData, fetchRemoteDataBlob
(fetch is stubbed via vi.fn so no network is touched)
- ARFset constructor (option handling, defaults, initial fields,
version banner) with the wasm wrapper mocked out so importing
src/ARFset.js stays cheap
Playwright drives a real Chromium against example_es6.html, waits
for the canvas to be populated by display(), and asserts the canvas
has non-empty pixel content. This exercises the full wasm -> JS ->
canvas path end to end.
Scripts:
npm test -> vitest run
npm run test:watch -> vitest in watch mode
npm run test:e2e:install -> playwright install --with-deps chromium
(one-shot per machine)
npm run test:e2e -> playwright test
devDependencies added: vitest, @playwright/test, http-server
(needed for Playwright's webServer block).
Refs #28
Refs #31
Two jobs that run on every PR and on pushes to dev/master: - unit (fast): npm ci + vitest. No emsdk, no wasm. - build-and-e2e: clones submodules, sets up emsdk via mymindstorm/setup-emsdk@v14 (cached), builds wasm (npm run build), builds JS bundles (npm run build-es6), installs Chromium, runs Playwright. Uploads the playwright-report/ directory on failure for triage. concurrency.cancel-in-progress lets a new push to the same PR abort the previous run automatically. No auto-publish on tag yet; release is still a manual npm publish. Refs #29 Refs #31
- exclude test artifacts files from git
…specs Vitest discovers any *.test.js / *.spec.js by default and tried to import tests/e2e/marker-load.spec.js, where @playwright/test's test() errors out because it's invoked outside the Playwright runner.
provide tests and CI to the project
Replace the 6-line stub README with a full quick-start, API reference, architecture diagram, build-from-source instructions, and 0.3.x -> 0.4.x migration notes. - Quick-start sections for both ESM (import) and UMD (<script>) paths - API table for ARFset constructor options and methods - Documented events (nftMarker, imageEv) dispatched on document - Mermaid flowchart of the user -> JS -> wasm -> canvas data flow, with a link into emscripten/ARimageFsetDisplay.cpp - Build prerequisites (Node 22+, emsdk + EMSDK env, Python, submodules) and the four common npm scripts (build, build-es6, test, test:e2e) - Migration block contrasting the old window.ARfset global with the new ARFsetModule.ARFset class Also removes the empty-string contributors entry from package.json that npm publish would otherwise warn about. Refs #30 Refs #31
Replace the 6-line stub README with a full quick-start, API reference, architecture diagram, build-from-source instructions, and 0.3.x -> 0.4.x migration notes. - Quick-start sections for both ESM (import) and UMD (<script>) paths - API table for ARFset constructor options and methods - Documented events (nftMarker, imageEv) dispatched on document - Mermaid flowchart of the user -> JS -> wasm -> canvas data flow, with a link into emscripten/ARimageFsetDisplay.cpp - Build prerequisites (Node 22+, emsdk + EMSDK env, Python, submodules) and the four common npm scripts (build, build-es6, test, test:e2e) - Migration block contrasting the old window.ARfset global with the new ARFsetModule.ARFset class Also removes the empty-string contributors entry from package.json that npm publish would otherwise warn about. Refs #30 Refs #31
…into feat/docs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Roll-up of the toolchain, tests, CI, and docs work that landed on
devsince the previousmastercut. Closes the modernization roadmap (#31).Build toolchain
webpack,webpack-cli,babel-loader,@babel/core,@babel/preset-env) collapse to one (vite). Library mode emits the same two outputs as before:dist/ARFset.js(ESM) anddist/ARFset.umd.js(UMD withwindow.ARFset).TOTAL_MEMORY→INITIAL_MEMORYintools/makem.cjs(the former was renamed in emscripten 1.39.x and now warns).tools/makem.js→tools/makem.cjsso Node treats the build script as CommonJS now thatpackage.jsonhas"type": "module".Tests
Utils(string2Uint8Data,fetchRemoteData,fetchRemoteDataBlob—fetchstubbed) and theARFsetconstructor (option defaults, partial overrides, initial fields, version banner; the wasm wrapper is mocked at import time).example/example_es6.html, waits fordisplay()to paint the canvas, and asserts non-empty pixel content + zero console errors.vitest.config.jsscopes Vitest discovery totests/unit/**/*.test.jsso it doesn't try to collect the Playwright spec.playwright.config.jsbootshttp-serverautomatically via thewebServerblock.CI
.github/workflows/ci.ymlwith two parallel jobs:npm ci+vitest run, no emsdk.mymindstorm/setup-emsdk@v14(cached),npm run build(wasm),npm run build-es6(JS bundles), installs Chromium, runs Playwright. Uploadsplaywright-report/as an artifact on failure for triage.concurrency.cancel-in-progressaborts superseded runs on the same PR/branch.Docs
import) and<script>paths.nftMarker/imageEvevents.user → ARFset → fetch → wasm FS → wasm → nftMarker event → canvas).0.3.x → 0.4.xmigration block.contributorsentry frompackage.json(npm publish was warning on it).test-results/,playwright-report/,playwright/.cache/,coverage/in.gitignore.Test plan
npm testpasses locally (Vitest, 12 tests)npm run buildproducesarfset_wasm.{js,wasm}andarfset_ES6_wasm.js— no asm.js artifactsnpm run build-es6producesdist/ARFset.js(ESM) anddist/ARFset.umd.js(UMD)dist/ARFset.d.tsis preserved across buildsexample/example_es6.htmlandexample/demo.htmlbehave identically to devCloses
Closes #26
Closes #27
Closes #28
Closes #29
Closes #30
Closes #31