From b8c7df3b1cc7c46adeaf71398254bcb237c787db Mon Sep 17 00:00:00 2001 From: leileizhang Date: Wed, 5 Aug 2026 12:35:34 +0800 Subject: [PATCH] Reorganize repository assets and add Node MSIX packaging guidance --- .github/agents/e2e-test.md | 14 +- .github/copilot-instructions.md | 10 +- .github/skills/classic-com-abi/SKILL.md | 4 +- .github/workflows/build.yml | 2 +- .github/workflows/python-release.yml | 24 +- .github/workflows/winui-arm64.yml | 2 +- .gitignore | 13 +- .pipelines/ci.yml | 2 +- CLAUDE.md | 11 +- Cargo.toml | 2 +- README.md | 19 +- bench-electron/out/preload/index.js | 7 - .../electron}/electron.vite.config.ts | 0 benchmarks/electron/out/preload/index.js | 7 + .../electron}/package-lock.json | 6 +- .../electron}/package.json | 2 +- .../electron}/src/main/index.ts | 2 +- .../electron}/src/preload/index.d.ts | 0 .../electron}/src/preload/index.ts | 0 .../electron}/src/renderer/index.html | 0 .../electron}/src/renderer/src/App.tsx | 0 .../electron}/src/renderer/src/main.tsx | 0 .../electron}/tsconfig.json | 0 .../electron}/tsconfig.node.json | 0 .../electron}/tsconfig.web.json | 0 .../samples => benchmarks/js}/bench_3way.ts | 6 +- .../js/samples => benchmarks/js}/benchmark.ts | 6 +- benchmarks/js/dynamic/bench.ts | 30 ++ .../js/dynamic}/package.json | 0 .../js/dynamic}/tsconfig.json | 2 +- .../js/static-cpp}/binding.gyp | 0 .../js/static-cpp}/find_sdk.js | 0 .../js/static-cpp}/package-lock.json | 0 .../js/static-cpp}/package.json | 0 .../js/static-cpp}/static_bench.cpp | 0 .../js/static-rust}/Cargo.toml | 0 .../js/static-rust}/build.rs | 0 .../js/static-rust}/src/lib.rs | 0 bindings/js/benchmark/bench.ts | 24 -- bindings/js/package.json | 2 +- bindings/js/tsconfig.json | 4 +- bindings/py/README.md | 2 +- design.md | 1 - .../{ => architecture}/classic-com-support.md | 8 +- BENCHMARK.md => docs/benchmarks/BENCHMARK.md | 2 +- .../benchmarks/BENCHMARK_ANALYSIS.md | 6 +- docs/guides/node/dev-mode.md | 4 + .../python}/python-ui-ecosystem.md | 0 docs/guides/windows/msix-packaging.md | 377 ++++++++++++++++++ .../status/PYTHON_CHECKLIST.md | 2 +- TODO.md => docs/status/TODO.md | 2 +- .../python}/test_python_codegen_wheel.ps1 | 3 +- .../python}/test_python_runtime_wheel.ps1 | 3 +- .../release/python}/verify_python_release.py | 2 +- .../js/samples => samples/js}/array_struct.ts | 2 +- {bindings/js/samples => samples/js}/ocr.ts | 2 +- {bindings/js/samples => samples/js}/picker.ts | 2 +- .../samples => samples/js}/test_progress.ts | 2 +- .../js}/test_register_interface.ts | 2 +- tests/{ => e2e}/e2e_specs.json | 0 tests/{ => e2e}/e2e_specs.schema.json | 0 tests/{ => e2e}/e2e_test.ps1 | 22 +- tests/{ => e2e}/python_winui_e2e.ps1 | 2 +- tests/{ => e2e}/runners/com/dtm.mjs | 4 +- .../runners/com/electron-hwnd-buffer.mjs | 0 .../runners/com/file-open-dialog.mjs | 2 +- .../{ => e2e}/runners/com/file-operation.mjs | 2 +- tests/{ => e2e}/runners/com/hwnd.mjs | 4 +- .../{ => e2e}/runners/com/module-commonjs.cjs | 2 +- tests/{ => e2e}/runners/com/persist-file.mjs | 2 +- .../runners/com/pointer-reject-object.mjs | 2 +- tests/{ => e2e}/runners/com/smtc.mjs | 4 +- tests/{ => e2e}/runners/com/taskbarlist.mjs | 2 +- .../runners/com/wic-imaging-factory.mjs | 2 +- tests/{ => e2e}/runners/py_runner.py | 2 +- tests/{ => e2e}/runners/py_winui_runner.py | 0 .../runners/ts_issue_regression_child.mjs | 0 tests/{ => e2e}/runners/ts_runner.ts | 2 +- .../typecheck/python_generated_api.py | 0 79 files changed, 543 insertions(+), 134 deletions(-) delete mode 100644 bench-electron/out/preload/index.js rename {bench-electron => benchmarks/electron}/electron.vite.config.ts (100%) create mode 100644 benchmarks/electron/out/preload/index.js rename {bench-electron => benchmarks/electron}/package-lock.json (99%) rename {bench-electron => benchmarks/electron}/package.json (93%) rename {bench-electron => benchmarks/electron}/src/main/index.ts (99%) rename {bench-electron => benchmarks/electron}/src/preload/index.d.ts (100%) rename {bench-electron => benchmarks/electron}/src/preload/index.ts (100%) rename {bench-electron => benchmarks/electron}/src/renderer/index.html (100%) rename {bench-electron => benchmarks/electron}/src/renderer/src/App.tsx (100%) rename {bench-electron => benchmarks/electron}/src/renderer/src/main.tsx (100%) rename {bench-electron => benchmarks/electron}/tsconfig.json (100%) rename {bench-electron => benchmarks/electron}/tsconfig.node.json (100%) rename {bench-electron => benchmarks/electron}/tsconfig.web.json (100%) rename {bindings/js/samples => benchmarks/js}/bench_3way.ts (98%) rename {bindings/js/samples => benchmarks/js}/benchmark.ts (98%) create mode 100644 benchmarks/js/dynamic/bench.ts rename {bindings/js/benchmark => benchmarks/js/dynamic}/package.json (100%) rename {bindings/js/benchmark => benchmarks/js/dynamic}/tsconfig.json (75%) rename {bindings/js/static-bench-cpp => benchmarks/js/static-cpp}/binding.gyp (100%) rename {bindings/js/static-bench-cpp => benchmarks/js/static-cpp}/find_sdk.js (100%) rename {bindings/js/static-bench-cpp => benchmarks/js/static-cpp}/package-lock.json (100%) rename {bindings/js/static-bench-cpp => benchmarks/js/static-cpp}/package.json (100%) rename {bindings/js/static-bench-cpp => benchmarks/js/static-cpp}/static_bench.cpp (100%) rename {bindings/js/static-bench-rust => benchmarks/js/static-rust}/Cargo.toml (100%) rename {bindings/js/static-bench-rust => benchmarks/js/static-rust}/build.rs (100%) rename {bindings/js/static-bench-rust => benchmarks/js/static-rust}/src/lib.rs (100%) delete mode 100644 bindings/js/benchmark/bench.ts rename docs/{ => architecture}/classic-com-support.md (99%) rename BENCHMARK.md => docs/benchmarks/BENCHMARK.md (98%) rename BENCHMARK_ANALYSIS.md => docs/benchmarks/BENCHMARK_ANALYSIS.md (97%) rename docs/{ => guides/python}/python-ui-ecosystem.md (100%) create mode 100644 docs/guides/windows/msix-packaging.md rename PYTHON_CHECKLIST.md => docs/status/PYTHON_CHECKLIST.md (99%) rename TODO.md => docs/status/TODO.md (99%) rename {scripts => eng/release/python}/test_python_codegen_wheel.ps1 (94%) rename {scripts => eng/release/python}/test_python_runtime_wheel.ps1 (94%) rename {scripts => eng/release/python}/verify_python_release.py (99%) rename {bindings/js/samples => samples/js}/array_struct.ts (99%) rename {bindings/js/samples => samples/js}/ocr.ts (99%) rename {bindings/js/samples => samples/js}/picker.ts (98%) rename {bindings/js/samples => samples/js}/test_progress.ts (99%) rename {bindings/js/samples => samples/js}/test_register_interface.ts (98%) rename tests/{ => e2e}/e2e_specs.json (100%) rename tests/{ => e2e}/e2e_specs.schema.json (100%) rename tests/{ => e2e}/e2e_test.ps1 (94%) rename tests/{ => e2e}/python_winui_e2e.ps1 (98%) rename tests/{ => e2e}/runners/com/dtm.mjs (94%) rename tests/{ => e2e}/runners/com/electron-hwnd-buffer.mjs (100%) rename tests/{ => e2e}/runners/com/file-open-dialog.mjs (87%) rename tests/{ => e2e}/runners/com/file-operation.mjs (91%) rename tests/{ => e2e}/runners/com/hwnd.mjs (88%) rename tests/{ => e2e}/runners/com/module-commonjs.cjs (90%) rename tests/{ => e2e}/runners/com/persist-file.mjs (89%) rename tests/{ => e2e}/runners/com/pointer-reject-object.mjs (91%) rename tests/{ => e2e}/runners/com/smtc.mjs (97%) rename tests/{ => e2e}/runners/com/taskbarlist.mjs (98%) rename tests/{ => e2e}/runners/com/wic-imaging-factory.mjs (90%) rename tests/{ => e2e}/runners/py_runner.py (99%) rename tests/{ => e2e}/runners/py_winui_runner.py (100%) rename tests/{ => e2e}/runners/ts_issue_regression_child.mjs (100%) rename tests/{ => e2e}/runners/ts_runner.ts (99%) rename tests/{ => e2e}/typecheck/python_generated_api.py (100%) diff --git a/.github/agents/e2e-test.md b/.github/agents/e2e-test.md index c0a982d5..cc61b294 100644 --- a/.github/agents/e2e-test.md +++ b/.github/agents/e2e-test.md @@ -16,21 +16,21 @@ You run and manage the dynwinrt end-to-end test suite. ```powershell # Run all E2E tests -.\tests\e2e_test.ps1 -SkipBuild +.\tests\e2e\e2e_test.ps1 -SkipBuild # Python only -.\tests\e2e_test.ps1 -SkipBuild -Lang py +.\tests\e2e\e2e_test.ps1 -SkipBuild -Lang py # Classic COM only (requires Windows.Win32.winmd) -.\tests\e2e_test.ps1 -SkipBuild -Lang com +.\tests\e2e\e2e_test.ps1 -SkipBuild -Lang com # Full build + test -.\tests\e2e_test.ps1 +.\tests\e2e\e2e_test.ps1 ``` ## Adding test cases -Add entries to `tests/e2e_specs.json`. See `tests/e2e_specs.schema.json` for the field definitions. +Add entries to `tests/e2e/e2e_specs.json`. See `tests/e2e/e2e_specs.schema.json` for the field definitions. Safe WinRT APIs to test (no extra dependencies): - `Windows.Foundation`: Uri, PropertyValue, WwwFormUrlDecoder, MemoryBuffer @@ -42,6 +42,6 @@ Avoid APIs that need WinAppSDK, network, or user interaction. ## Diagnosing failures -1. Check `tests/e2e_generated/results_py.json` or `results_ts.json` for structured failure details -2. Inspect generated code in `tests/e2e_generated/python_bindings/`, `ts/`, or `com/` +1. Check `tests/e2e/e2e_generated/results_py.json` or `results_ts.json` for structured failure details +2. Inspect generated code in `tests/e2e/e2e_generated/python_bindings/`, `ts/`, or `com/` 3. Common issues: circular imports in codegen, naming mismatch (Python snake_case vs TS camelCase) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 20048eb5..d7c19a32 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -40,7 +40,7 @@ cargo run -p dynwinrt-codegen -- generate --namespace Windows.Foundation --class cargo run -p dynwinrt-codegen -- generate --namespace Windows.Foundation --class-name Uri --lang py --output ./generated # E2E test (full pipeline: winmd → generate → call real WinRT APIs) -.\tests\e2e_test.ps1 -SkipBuild -Lang py +.\tests\e2e\e2e_test.ps1 -SkipBuild -Lang py ``` ## E2E Testing @@ -49,15 +49,15 @@ The E2E test framework validates the full pipeline: reading .winmd metadata → ### How it works -1. **Test specs** are defined in `tests/e2e_specs.json` (schema: `tests/e2e_specs.schema.json`) — each entry describes: +1. **Test specs** are defined in `tests/e2e/e2e_specs.json` (schema: `tests/e2e/e2e_specs.schema.json`) — each entry describes: - `instantiate`: how to create an instance (`activate`, `static_factory`, or `none`) - `checks`: array of assertions (`property_equals`, `property_exists`, `method_equals`, `method_result_contains`, `static_equals`, `static_not_null`) -2. **Runners** (`tests/runners/py_runner.py`, `tests/runners/ts_runner.ts`, and `tests/runners/com/*.mjs`) execute generated WinRT and Classic COM bindings. +2. **Runners** (`tests/e2e/runners/py_runner.py`, `tests/e2e/runners/ts_runner.ts`, and `tests/e2e/runners/com/*.mjs`) execute generated WinRT and Classic COM bindings. -3. **Orchestrator** (`tests/e2e_test.ps1`) handles build, temporary code generation, and runner invocation. Use `-Lang com` for the Classic COM suite; it requires `DYNWINRT_WIN32_WINMD` or an installed `Microsoft.Windows.SDK.Win32Metadata` package. +3. **Orchestrator** (`tests/e2e/e2e_test.ps1`) handles build, temporary code generation, and runner invocation. Use `-Lang com` for the Classic COM suite; it requires `DYNWINRT_WIN32_WINMD` or an installed `Microsoft.Windows.SDK.Win32Metadata` package. -4. **Adding new test cases**: Add entries to `e2e_specs.json`: +4. **Adding new test cases**: Add entries to `tests/e2e/e2e_specs.json`: ```json { "namespace": "Windows.Foundation", diff --git a/.github/skills/classic-com-abi/SKILL.md b/.github/skills/classic-com-abi/SKILL.md index 5a33489a..d87520bc 100644 --- a/.github/skills/classic-com-abi/SKILL.md +++ b/.github/skills/classic-com-abi/SKILL.md @@ -11,9 +11,9 @@ Use this skill for changes under: - `bindings/js/src/com.rs`; - `tools/dynwinrt-codegen/src/com_metadata.rs`; - `tools/dynwinrt-codegen/src/codegen/com/`; or -- Classic COM runners in `tests/runners/com/`. +- Classic COM runners in `tests/e2e/runners/com/`. -Read [`docs/classic-com-support.md`](../../../docs/classic-com-support.md) +Read [`docs/architecture/classic-com-support.md`](../../../docs/architecture/classic-com-support.md) before changing supported types or claiming support for an interface. ## Core principle diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5a0b9950..57f78466 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -96,7 +96,7 @@ jobs: .\bindings\py\.venv\Scripts\python.exe -m pytest bindings\py\tests -q .\bindings\py\.venv\Scripts\python.exe -m mypy.stubtest dynwinrt_py --allowlist bindings\py\stubtest_allowlist.txt --ignore-disjoint-bases - name: Run E2E tests - run: .\tests\e2e_test.ps1 -SkipBuild + run: .\tests\e2e\e2e_test.ps1 -SkipBuild # dynwinrt-codegen (x64 + arm64) dynwinrt-codegen: diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index d542c2a8..fd5a2ab2 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -10,8 +10,8 @@ on: - '.github/workflows/python-release.yml' - 'bindings/py/**' - 'crates/dynwinrt/**' - - 'scripts/test_python_*_wheel.ps1' - - 'scripts/verify_python_release.py' + - 'eng/release/python/test_python_*_wheel.ps1' + - 'eng/release/python/verify_python_release.py' - 'tools/dynwinrt-codegen/**' - 'Cargo.lock' - 'Cargo.toml' @@ -60,7 +60,7 @@ jobs: $version = [regex]::Match($cargo, '(?m)^version = "([^"]+)"$').Groups[1].Value if (-not $version) { throw 'Could not read bindings/py Cargo version' } - $arguments = @('scripts\verify_python_release.py', 'source') + $arguments = @('eng\release\python\verify_python_release.py', 'source') if ($env:RELEASE_VERSION) { $arguments += @('--release-version', $env:RELEASE_VERSION) } @@ -112,7 +112,7 @@ jobs: if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } $wheel = @(Get-ChildItem artifacts\runtime\*.whl) if ($wheel.Count -ne 1) { throw "Expected one runtime wheel, found $($wheel.Count)" } - python scripts\verify_python_release.py wheel ` + python eng\release\python\verify_python_release.py wheel ` --wheel $wheel[0].FullName ` --package dynwinrt-py ` --version $env:VERSION ` @@ -159,7 +159,7 @@ jobs: if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } $wheel = @(Get-ChildItem artifacts\runtime\*.whl) if ($wheel.Count -ne 1) { throw "Expected one runtime wheel, found $($wheel.Count)" } - python scripts\verify_python_release.py wheel ` + python eng\release\python\verify_python_release.py wheel ` --wheel $wheel[0].FullName ` --package dynwinrt-py ` --version $env:VERSION ` @@ -195,7 +195,7 @@ jobs: if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } $wheel = @(Get-ChildItem artifacts\codegen\*.whl) if ($wheel.Count -ne 1) { throw "Expected one codegen wheel, found $($wheel.Count)" } - python scripts\verify_python_release.py wheel ` + python eng\release\python\verify_python_release.py wheel ` --wheel $wheel[0].FullName ` --package dynwinrt-codegen ` --version $env:VERSION ` @@ -233,7 +233,7 @@ jobs: if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } $wheel = @(Get-ChildItem artifacts\codegen\*.whl) if ($wheel.Count -ne 1) { throw "Expected one codegen wheel, found $($wheel.Count)" } - python scripts\verify_python_release.py wheel ` + python eng\release\python\verify_python_release.py wheel ` --wheel $wheel[0].FullName ` --package dynwinrt-codegen ` --version $env:VERSION ` @@ -264,10 +264,10 @@ jobs: run: | python -m pip install "packaging>=24,<27" --quiet $wheel = @(Get-ChildItem artifacts\codegen\*.whl) - python scripts\verify_python_release.py wheel --wheel $wheel[0].FullName ` + python eng\release\python\verify_python_release.py wheel --wheel $wheel[0].FullName ` --package dynwinrt-codegen --version '${{ needs.validate.outputs.version }}' ` --python-tag py3 --abi-tag none --platform-tag win_amd64 - .\scripts\test_python_codegen_wheel.ps1 -Python (Get-Command python).Source ` + .\eng\release\python\test_python_codegen_wheel.ps1 -Python (Get-Command python).Source ` -WheelDirectory artifacts\codegen ` -Version '${{ needs.validate.outputs.version }}' -Architecture x64 @@ -289,7 +289,7 @@ jobs: shell: pwsh run: | python -m pip install "packaging>=24,<27" --quiet - .\scripts\test_python_codegen_wheel.ps1 -Python (Get-Command python).Source ` + .\eng\release\python\test_python_codegen_wheel.ps1 -Python (Get-Command python).Source ` -WheelDirectory artifacts\codegen ` -Version '${{ needs.validate.outputs.version }}' -Architecture arm64 @@ -321,7 +321,7 @@ jobs: - name: Import wheel and call Windows.Foundation.Uri shell: pwsh run: | - .\scripts\test_python_runtime_wheel.ps1 -Python (Get-Command python).Source ` + .\eng\release\python\test_python_runtime_wheel.ps1 -Python (Get-Command python).Source ` -RuntimeWheelDirectory artifacts\runtime ` -CodegenWheelDirectory artifacts\codegen ` -Version '${{ needs.validate.outputs.version }}' ` @@ -356,7 +356,7 @@ jobs: - name: Import native wheel and call Windows.Foundation.Uri shell: pwsh run: | - .\scripts\test_python_runtime_wheel.ps1 -Python (Get-Command python).Source ` + .\eng\release\python\test_python_runtime_wheel.ps1 -Python (Get-Command python).Source ` -RuntimeWheelDirectory artifacts\runtime ` -CodegenWheelDirectory artifacts\codegen ` -Version '${{ needs.validate.outputs.version }}' ` diff --git a/.github/workflows/winui-arm64.yml b/.github/workflows/winui-arm64.yml index 765f84c6..f95b01ef 100644 --- a/.github/workflows/winui-arm64.yml +++ b/.github/workflows/winui-arm64.yml @@ -82,7 +82,7 @@ jobs: - name: Run live Python WinUI ARM64 E2E shell: pwsh run: | - .\tests\python_winui_e2e.ps1 ` + .\tests\e2e\python_winui_e2e.ps1 ` -WinuiWinmd $env:WINUI_WINMD ` -RefList $env:WINUI_REFS ` -BootstrapDll $env:WINUI_BOOTSTRAP ` diff --git a/.gitignore b/.gitignore index 9be59a2a..3d125e27 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,9 @@ mono_crash.* [Dd]ebugPublic/ [Rr]elease/ [Rr]eleases/ +!eng/release/ +!eng/release/python/ +!eng/release/python/** x64/ x86/ [Ww][Ii][Nn]32/ @@ -433,11 +436,15 @@ target **/generated **/node_modules tools/dynwinrt-codegen/npm/bin/**/*.exe -bench-electron/out/ +!benchmarks/electron/out/ +benchmarks/electron/out/* +!benchmarks/electron/out/preload/ +benchmarks/electron/out/preload/* +!benchmarks/electron/out/preload/index.js **/build # Claude Code local settings **/settings.local.json -# Generated E2E projections are recreated and removed by tests/e2e_test.ps1. -tests/e2e_generated/ +# Generated E2E projections are recreated and removed by tests/e2e/e2e_test.ps1. +tests/e2e/e2e_generated/ .python-release/ diff --git a/.pipelines/ci.yml b/.pipelines/ci.yml index 71da2f28..f9d154b6 100644 --- a/.pipelines/ci.yml +++ b/.pipelines/ci.yml @@ -252,4 +252,4 @@ extends: cd bindings/py if (Test-Path .venv) { .venv/Scripts/Activate.ps1 } cd ../.. - .\tests\e2e_test.ps1 -SkipBuild + .\tests\e2e\e2e_test.ps1 -SkipBuild diff --git a/CLAUDE.md b/CLAUDE.md index 87295f99..f9e5b429 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -16,8 +16,11 @@ dynwinrt/ │ └── py/ # Python bindings (PyO3) ├── tools/ │ └── dynwinrt-codegen/ # Code generator (JS + .d.ts and Python from .winmd) -├── tests/ # Integration tests & sample projects -└── bench-electron/ # Electron benchmark app +├── tests/e2e/ # Cross-language E2E specs, runners, and scripts +├── benchmarks/ # Electron and JS/native benchmarks +├── samples/ # JavaScript and Python samples +├── docs/ # Architecture, benchmark, guide, and status docs +└── eng/release/python/ # Python release verification helpers ``` ## Build Commands @@ -175,12 +178,12 @@ let result = value.wait()?; ## Known Limitations - Delegate callbacks support up to 2 ABI parameters (covers ~95% of WinRT delegates) -- No DispatcherQueue / XAML hosting support (data APIs only, no UI framework) — WinUI-style controls need composition/aggregation of runtime classes, which the codegen skips (see composable `.ctor` note in `TODO.md`) +- No DispatcherQueue / XAML hosting support (data APIs only, no UI framework) — WinUI-style controls need composition/aggregation of runtime classes, which the codegen skips (see composable `.ctor` note in `docs/status/TODO.md`) - Python binding does not yet support async/await integration with `asyncio` ## Environment Setup — updated invariant -`initialize_winappsdk()` currently `.expect(...)`s the `WINAPPSDK_BOOTSTRAP_DLL_PATH` environment variable at `crates/dynwinrt/src/winapp.rs:43`. Auto-detection from `~/.winapp/packages/`, `~/.nuget/packages/microsoft.windowsappsdk.*/`, and Program Files install paths is tracked in `TODO.md` P0. +`initialize_winappsdk()` currently `.expect(...)`s the `WINAPPSDK_BOOTSTRAP_DLL_PATH` environment variable at `crates/dynwinrt/src/winapp.rs:43`. Auto-detection from `~/.winapp/packages/`, `~/.nuget/packages/microsoft.windowsappsdk.*/`, and Program Files install paths is tracked in `docs/status/TODO.md` P0. ## Implementation Notes diff --git a/Cargo.toml b/Cargo.toml index 6ca4716b..d6db3a6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ members = [ "crates/dynwinrt", "bindings/js", - "bindings/js/static-bench-rust", + "benchmarks/js/static-rust", "bindings/py", "tools/dynwinrt-codegen", ] diff --git a/README.md b/README.md index 0206fb8d..5304a9a2 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ console.log(uri.host); // "example.com" Classic COM bindings import their runtime API from the separate `@microsoft/dynwinrt/com` subpath. It is part of the same npm package; the package root remains the WinRT-only API. See -[Classic COM support](docs/classic-com-support.md) for the supported ABI, +[Classic COM support](docs/architecture/classic-com-support.md) for the supported ABI, common-interface test matrix, unsupported native types, and ownership rules. Generated bindings project unambiguous public WinRT activation metadata as JavaScript @@ -114,8 +114,16 @@ dynwinrt/ │ └── py/ # Python bindings (PyO3; release workflow ready) ├── tools/ │ └── dynwinrt-codegen/ # @microsoft/dynwinrt-codegen — typed-binding generator -├── tests/ # Integration tests + sample E2E projects -└── bench-electron/ # Electron benchmark app +├── tests/ +│ └── e2e/ # Cross-language E2E specs, runners, and scripts +├── benchmarks/ +│ ├── electron/ # Electron IPC benchmark app +│ └── js/ # Dynamic and static JS/native benchmarks +├── samples/ +│ ├── js/ # JavaScript/TypeScript samples +│ └── python/ # Python samples +├── docs/ # Architecture, benchmark, guide, and status docs +└── eng/release/python/ # Python release verification helpers ``` ## Build from source @@ -142,7 +150,10 @@ Rust installation at consumption time. Release and trusted-publishing instructions are in [`bindings/py/README.md`](bindings/py/README.md). Python runtime, codegen, packaging, and WinUI readiness are tracked in -[`PYTHON_CHECKLIST.md`](PYTHON_CHECKLIST.md). +[`docs/status/PYTHON_CHECKLIST.md`](docs/status/PYTHON_CHECKLIST.md). + +For deployment, see +[Package a dynwinrt Node.js application as MSIX](docs/guides/windows/msix-packaging.md). ## Codegen CLI reference diff --git a/bench-electron/out/preload/index.js b/bench-electron/out/preload/index.js deleted file mode 100644 index aea20958..00000000 --- a/bench-electron/out/preload/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -const electron = require("electron"); -const api = { - ipc: (channel) => electron.ipcRenderer.invoke(channel), - logResults: (lines) => electron.ipcRenderer.invoke("log-results", lines) -}; -electron.contextBridge.exposeInMainWorld("api", api); diff --git a/bench-electron/electron.vite.config.ts b/benchmarks/electron/electron.vite.config.ts similarity index 100% rename from bench-electron/electron.vite.config.ts rename to benchmarks/electron/electron.vite.config.ts diff --git a/benchmarks/electron/out/preload/index.js b/benchmarks/electron/out/preload/index.js new file mode 100644 index 00000000..a0beeb90 --- /dev/null +++ b/benchmarks/electron/out/preload/index.js @@ -0,0 +1,7 @@ +let electron = require("electron"); +//#region src/preload/index.ts +electron.contextBridge.exposeInMainWorld("api", { + ipc: (channel) => electron.ipcRenderer.invoke(channel), + logResults: (lines) => electron.ipcRenderer.invoke("log-results", lines) +}); +//#endregion diff --git a/bench-electron/package-lock.json b/benchmarks/electron/package-lock.json similarity index 99% rename from bench-electron/package-lock.json rename to benchmarks/electron/package-lock.json index 49cf8494..b32d9d22 100644 --- a/bench-electron/package-lock.json +++ b/benchmarks/electron/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@microsoft/dynwinrt": "file:../bindings/js" + "@microsoft/dynwinrt": "file:../../bindings/js" }, "devDependencies": { "@electron-toolkit/preload": "^3.0.1", @@ -25,7 +25,7 @@ "vite": "^8.0.16" } }, - "../bindings/js": { + "../../bindings/js": { "name": "@microsoft/dynwinrt", "version": "0.1.0", "license": "MIT", @@ -478,7 +478,7 @@ } }, "node_modules/@microsoft/dynwinrt": { - "resolved": "../bindings/js", + "resolved": "../../bindings/js", "link": true }, "node_modules/@napi-rs/wasm-runtime": { diff --git a/bench-electron/package.json b/benchmarks/electron/package.json similarity index 93% rename from bench-electron/package.json rename to benchmarks/electron/package.json index 89b4300a..e1e3b084 100644 --- a/bench-electron/package.json +++ b/benchmarks/electron/package.json @@ -10,7 +10,7 @@ "preview": "electron-vite preview" }, "dependencies": { - "@microsoft/dynwinrt": "file:../bindings/js" + "@microsoft/dynwinrt": "file:../../bindings/js" }, "devDependencies": { "@electron-toolkit/preload": "^3.0.1", diff --git a/bench-electron/src/main/index.ts b/benchmarks/electron/src/main/index.ts similarity index 99% rename from bench-electron/src/main/index.ts rename to benchmarks/electron/src/main/index.ts index a70add6d..bd385b9e 100644 --- a/bench-electron/src/main/index.ts +++ b/benchmarks/electron/src/main/index.ts @@ -19,7 +19,7 @@ import { // Static C++/WinRT benchmark addon const require = createRequire(import.meta.url) const CppBench = require( - join(__dirname, '../../../bindings/js/static-bench-cpp/build/Release/static_bench.node') + join(__dirname, '../../../js/static-cpp/build/Release/static_bench.node') ) as { uriCreate: (url: string) => unknown uriGetHost: (url: string) => string diff --git a/bench-electron/src/preload/index.d.ts b/benchmarks/electron/src/preload/index.d.ts similarity index 100% rename from bench-electron/src/preload/index.d.ts rename to benchmarks/electron/src/preload/index.d.ts diff --git a/bench-electron/src/preload/index.ts b/benchmarks/electron/src/preload/index.ts similarity index 100% rename from bench-electron/src/preload/index.ts rename to benchmarks/electron/src/preload/index.ts diff --git a/bench-electron/src/renderer/index.html b/benchmarks/electron/src/renderer/index.html similarity index 100% rename from bench-electron/src/renderer/index.html rename to benchmarks/electron/src/renderer/index.html diff --git a/bench-electron/src/renderer/src/App.tsx b/benchmarks/electron/src/renderer/src/App.tsx similarity index 100% rename from bench-electron/src/renderer/src/App.tsx rename to benchmarks/electron/src/renderer/src/App.tsx diff --git a/bench-electron/src/renderer/src/main.tsx b/benchmarks/electron/src/renderer/src/main.tsx similarity index 100% rename from bench-electron/src/renderer/src/main.tsx rename to benchmarks/electron/src/renderer/src/main.tsx diff --git a/bench-electron/tsconfig.json b/benchmarks/electron/tsconfig.json similarity index 100% rename from bench-electron/tsconfig.json rename to benchmarks/electron/tsconfig.json diff --git a/bench-electron/tsconfig.node.json b/benchmarks/electron/tsconfig.node.json similarity index 100% rename from bench-electron/tsconfig.node.json rename to benchmarks/electron/tsconfig.node.json diff --git a/bench-electron/tsconfig.web.json b/benchmarks/electron/tsconfig.web.json similarity index 100% rename from bench-electron/tsconfig.web.json rename to benchmarks/electron/tsconfig.web.json diff --git a/bindings/js/samples/bench_3way.ts b/benchmarks/js/bench_3way.ts similarity index 98% rename from bindings/js/samples/bench_3way.ts rename to benchmarks/js/bench_3way.ts index 25b3cca4..b2585779 100644 --- a/bindings/js/samples/bench_3way.ts +++ b/benchmarks/js/bench_3way.ts @@ -13,12 +13,12 @@ import { DynWinRtValue, DynWinRtType, DynWinRtMethodSig, DynWinRtStruct, WinGuid, roInitialize, RustStaticBench, rawGetString, rawGetI32, -} from '../dist/winrt.js' +} from '../../bindings/js/dist/winrt.js' import { createRequire } from 'node:module' const require = createRequire(import.meta.url) -const CppBench = require('../static-bench-cpp/build/Release/static_bench.node') -const RustRawBench = require('../static-bench-rust/static_bench_rust.node') +const CppBench = require('./static-cpp/build/Release/static_bench.node') +const RustRawBench = require('./static-rust/static_bench_rust.node') roInitialize(1) diff --git a/bindings/js/samples/benchmark.ts b/benchmarks/js/benchmark.ts similarity index 98% rename from bindings/js/samples/benchmark.ts rename to benchmarks/js/benchmark.ts index ad87132c..45379c66 100644 --- a/bindings/js/samples/benchmark.ts +++ b/benchmarks/js/benchmark.ts @@ -16,7 +16,7 @@ * 6. batch — realistic workload * * All method handles and objects are pre-created. - * Run: npx tsx samples/benchmark.ts + * Run from bindings/js: npx tsx ../../benchmarks/js/benchmark.ts */ import { DynWinRtValue, @@ -25,11 +25,11 @@ import { DynWinRtStruct, WinGuid, roInitialize, -} from '../dist/winrt.js' +} from '../../bindings/js/dist/winrt.js' import { createRequire } from 'node:module' const require = createRequire(import.meta.url) -const CppBench = require('../static-bench/build/Release/static_bench.node') +const CppBench = require('./static-cpp/build/Release/static_bench.node') roInitialize(1) diff --git a/benchmarks/js/dynamic/bench.ts b/benchmarks/js/dynamic/bench.ts new file mode 100644 index 00000000..6c7cc7f5 --- /dev/null +++ b/benchmarks/js/dynamic/bench.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createRequire } from 'node:module' + +const requireFromBinding = createRequire( + new URL('../../../bindings/js/package.json', import.meta.url), +) +const { Bench } = requireFromBinding('tinybench') as typeof import('tinybench') +const { plus100 } = requireFromBinding('./index.js') as { + plus100(value: number): number +} + +function add(a: number) { + return a + 100 +} + +const bench = new Bench() + +bench.add('Native a + 100', () => { + plus100(10) +}) + +bench.add('JavaScript a + 100', () => { + add(10) +}) + +await bench.run() + +console.table(bench.table()) diff --git a/bindings/js/benchmark/package.json b/benchmarks/js/dynamic/package.json similarity index 100% rename from bindings/js/benchmark/package.json rename to benchmarks/js/dynamic/package.json diff --git a/bindings/js/benchmark/tsconfig.json b/benchmarks/js/dynamic/tsconfig.json similarity index 75% rename from bindings/js/benchmark/tsconfig.json rename to benchmarks/js/dynamic/tsconfig.json index 659905b0..9d489f04 100644 --- a/bindings/js/benchmark/tsconfig.json +++ b/benchmarks/js/dynamic/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../tsconfig.json", + "extends": "../../../bindings/js/tsconfig.json", "compilerOptions": { "module": "NodeNext", "moduleResolution": "NodeNext", diff --git a/bindings/js/static-bench-cpp/binding.gyp b/benchmarks/js/static-cpp/binding.gyp similarity index 100% rename from bindings/js/static-bench-cpp/binding.gyp rename to benchmarks/js/static-cpp/binding.gyp diff --git a/bindings/js/static-bench-cpp/find_sdk.js b/benchmarks/js/static-cpp/find_sdk.js similarity index 100% rename from bindings/js/static-bench-cpp/find_sdk.js rename to benchmarks/js/static-cpp/find_sdk.js diff --git a/bindings/js/static-bench-cpp/package-lock.json b/benchmarks/js/static-cpp/package-lock.json similarity index 100% rename from bindings/js/static-bench-cpp/package-lock.json rename to benchmarks/js/static-cpp/package-lock.json diff --git a/bindings/js/static-bench-cpp/package.json b/benchmarks/js/static-cpp/package.json similarity index 100% rename from bindings/js/static-bench-cpp/package.json rename to benchmarks/js/static-cpp/package.json diff --git a/bindings/js/static-bench-cpp/static_bench.cpp b/benchmarks/js/static-cpp/static_bench.cpp similarity index 100% rename from bindings/js/static-bench-cpp/static_bench.cpp rename to benchmarks/js/static-cpp/static_bench.cpp diff --git a/bindings/js/static-bench-rust/Cargo.toml b/benchmarks/js/static-rust/Cargo.toml similarity index 100% rename from bindings/js/static-bench-rust/Cargo.toml rename to benchmarks/js/static-rust/Cargo.toml diff --git a/bindings/js/static-bench-rust/build.rs b/benchmarks/js/static-rust/build.rs similarity index 100% rename from bindings/js/static-bench-rust/build.rs rename to benchmarks/js/static-rust/build.rs diff --git a/bindings/js/static-bench-rust/src/lib.rs b/benchmarks/js/static-rust/src/lib.rs similarity index 100% rename from bindings/js/static-bench-rust/src/lib.rs rename to benchmarks/js/static-rust/src/lib.rs diff --git a/bindings/js/benchmark/bench.ts b/bindings/js/benchmark/bench.ts deleted file mode 100644 index 252b10e3..00000000 --- a/bindings/js/benchmark/bench.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { Bench } from 'tinybench' - -import { plus100 } from '../index.js' - -function add(a: number) { - return a + 100 -} - -const bench = new Bench() - -bench.add('Native a + 100', () => { - plus100(10) -}) - -bench.add('JavaScript a + 100', () => { - add(10) -}) - -await bench.run() - -console.table(bench.table()) diff --git a/bindings/js/package.json b/bindings/js/package.json index 779bdace..2b05ea10 100644 --- a/bindings/js/package.json +++ b/bindings/js/package.json @@ -62,7 +62,7 @@ }, "scripts": { "artifacts": "napi artifacts", - "bench": "node --import @oxc-node/core/register benchmark/bench.ts", + "bench": "node --import @oxc-node/core/register ../../benchmarks/js/dynamic/bench.ts", "build": "napi build --no-const-enum --platform --release -o dist && npm run build:entrypoints", "build:debug": "napi --no-const-enum build --platform -o dist && npm run build:entrypoints", "build:entrypoints": "node scripts/generate-entrypoints.mjs", diff --git a/bindings/js/tsconfig.json b/bindings/js/tsconfig.json index 550951b8..568b2a5c 100644 --- a/bindings/js/tsconfig.json +++ b/bindings/js/tsconfig.json @@ -9,6 +9,6 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true }, - "include": ["."], - "exclude": ["node_modules", "benchmark", "__test__"] + "include": [".", "../../samples/js"], + "exclude": ["node_modules", "__test__"] } diff --git a/bindings/py/README.md b/bindings/py/README.md index 7142fe6a..f6f677a8 100644 --- a/bindings/py/README.md +++ b/bindings/py/README.md @@ -238,7 +238,7 @@ The live x64 smoke test accepts explicit WinAppSDK metadata and bootstrap inputs: ```powershell -.\tests\python_winui_e2e.ps1 ` +.\tests\e2e\python_winui_e2e.ps1 ` -WinuiWinmd ` -RefList ` -BootstrapDll ` diff --git a/design.md b/design.md index 77939b9f..308e91fa 100644 --- a/design.md +++ b/design.md @@ -170,4 +170,3 @@ HRESULT Method_Out_Pointer(void* funPtr, ComPtr self, void* outValue) { * [PyWinRT](https://github.com/pywinrt/pywinrt) Static C++/WinRT-based projections demonstrated significant versioning and distribution challenges. * [lazy-winrt](https://github.com/JesseCol/lazy-winrt) **"Lazy-WinRT" Prototype**: This prototype validated the feasibility and potential performance of parsing WinMDs and invoking methods dynamically. * [dynwinrt](https://github.com/microsoft/dynwinrt) — Rust-based implementation inspired by Lazy-WinRT. Ships the core runtime, JS bindings via `napi-rs`, Python bindings via `PyO3`, and the `dynwinrt-codegen` code-generation tool. - diff --git a/docs/classic-com-support.md b/docs/architecture/classic-com-support.md similarity index 99% rename from docs/classic-com-support.md rename to docs/architecture/classic-com-support.md index 6bb38688..5160f132 100644 --- a/docs/classic-com-support.md +++ b/docs/architecture/classic-com-support.md @@ -677,9 +677,9 @@ hardware, and whether it adds a distinct ABI shape. Ten unique Classic COM interfaces are currently exercised. Core live tests are in -[`crates/dynwinrt/src/com.rs`](../crates/dynwinrt/src/com.rs). The nine Node -runners are in [`tests/runners/com`](../tests/runners/com) and are generated -and executed by [`tests/e2e_test.ps1`](../tests/e2e_test.ps1). +[`crates/dynwinrt/src/com.rs`](../../crates/dynwinrt/src/com.rs). The nine Node +runners are in [`tests/e2e/runners/com`](../../tests/e2e/runners/com) and are generated +and executed by [`tests/e2e/e2e_test.ps1`](../../tests/e2e/e2e_test.ps1). | Interface | Test layer | Representative coverage | |---|---|---| @@ -716,7 +716,7 @@ Run the live Classic COM suite with: ```powershell $env:DYNWINRT_WIN32_WINMD = "C:\path\to\Windows.Win32.winmd" -.\tests\e2e_test.ps1 -SkipBuild -Lang com +.\tests\e2e\e2e_test.ps1 -SkipBuild -Lang com ``` ## Reference counting and ownership diff --git a/BENCHMARK.md b/docs/benchmarks/BENCHMARK.md similarity index 98% rename from BENCHMARK.md rename to docs/benchmarks/BENCHMARK.md index dec3ca66..90e6cda3 100644 --- a/BENCHMARK.md +++ b/docs/benchmarks/BENCHMARK.md @@ -74,5 +74,5 @@ For Electron desktop apps, **the choice between static C++/WinRT and dynamic dyn ## How to Run ```bash -cd bench-electron && npm install && npm run dev +cd benchmarks/electron && npm install && npm run dev ``` diff --git a/BENCHMARK_ANALYSIS.md b/docs/benchmarks/BENCHMARK_ANALYSIS.md similarity index 97% rename from BENCHMARK_ANALYSIS.md rename to docs/benchmarks/BENCHMARK_ANALYSIS.md index 6e2023be..ef1eaace 100644 --- a/BENCHMARK_ANALYSIS.md +++ b/docs/benchmarks/BENCHMARK_ANALYSIS.md @@ -163,10 +163,10 @@ The ~35 ns gap between raw napi + dynwinrt (72 ns) and C++ static (37 ns) is dyn ```bash # 4-way benchmark (C++ / Rust raw / Rust napi-rs / Dynamic) cd bindings/js && npm run build -cd bindings/js/static-bench-cpp && npm install && npm run build +cd benchmarks/js/static-cpp && npm install && npm run build cargo build -p static-bench-rust --release -cp target/release/static_bench_rust.dll bindings/js/static-bench-rust/static_bench_rust.node -cd bindings/js && npx tsx samples/bench_3way.ts +cp target/release/static_bench_rust.dll benchmarks/js/static-rust/static_bench_rust.node +cd bindings/js && npx tsx ../../benchmarks/js/bench_3way.ts # Rust core engine (no JS overhead) cargo bench -p dynwinrt --bench bench diff --git a/docs/guides/node/dev-mode.md b/docs/guides/node/dev-mode.md index 891a09f6..d83fc578 100644 --- a/docs/guides/node/dev-mode.md +++ b/docs/guides/node/dev-mode.md @@ -164,6 +164,10 @@ The generated bindings under `.winapp/bindings/`, your `Package.appxmanifest`, a For end users installing the MSIX, no dev mode / no `winapp run` — Windows registers the package the normal way at install time. +For the framework-independent executable, layout, certificate, signing, and +clean-machine workflow, see +[Package a dynwinrt Node.js application as MSIX](../windows/msix-packaging.md). + ## Troubleshooting ### `mynode.exe : The term 'mynode.exe' is not recognized...` diff --git a/docs/python-ui-ecosystem.md b/docs/guides/python/python-ui-ecosystem.md similarity index 100% rename from docs/python-ui-ecosystem.md rename to docs/guides/python/python-ui-ecosystem.md diff --git a/docs/guides/windows/msix-packaging.md b/docs/guides/windows/msix-packaging.md new file mode 100644 index 00000000..50cb91a8 --- /dev/null +++ b/docs/guides/windows/msix-packaging.md @@ -0,0 +1,377 @@ +# Package a dynwinrt Node.js application as MSIX + +This guide shows how to package a Node.js application that uses +`@microsoft/dynwinrt` into an MSIX with +[WinApp CLI](https://github.com/microsoft/WinAppCli) 0.5.0. + +The process first creates an application-specific Node +[Single Executable Application (SEA)](https://nodejs.org/api/single-executable-applications.html). +The executable, application JavaScript, generated WinRT bindings, and dynwinrt +native runtime are then staged together and packaged as a signed MSIX. + +The installed application appears in the Start menu and launches with package +identity. + +## 1. Initialize the Node.js project + +Create a Node.js project: + +```powershell +mkdir my-dynwinrt-app +cd my-dynwinrt-app +npm init -y +npm install --save-dev @microsoft/winappcli@0.5.0 +npx winapp init . --use-defaults --add-js-bindings +``` + +`winapp init` creates the manifest and assets, installs matching dynwinrt +runtime/codegen packages, and generates bindings under `.winapp\bindings`. + +For setup and restore details, see the +[WinApp CLI Electron setup guide](https://github.com/microsoft/WinAppCli/blob/main/docs/guides/electron/setup.md). +Its initialization steps also apply to a plain Node.js project; the +Electron-specific debug-identity steps are not needed here. + +## 2. Build the application and Node SEA executable + +Build the application JavaScript first. The examples below assume the entry +module is emitted as `dist\main.js`. + +Install postject, the tool used by Node to inject the SEA blob: + +```powershell +npm install --save-dev postject@1.0.0-alpha.6 +``` + +Create `sea-bootstrap.cjs`. The bootstrap is embedded in the executable, then +loads the external application files from the installed package: + +```javascript +const { createRequire } = require('node:module') +const path = require('node:path') + +const packageRoot = path.dirname(process.execPath) +process.chdir(packageRoot) + +const externalRequire = createRequire(path.join(packageRoot, 'main.js')) +externalRequire('./main.js') +``` + +Create `sea-config.json`: + +```json +{ + "main": "sea-bootstrap.cjs", + "output": "build/sea-prep.blob", + "disableExperimentalSEAWarning": true, + "useSnapshot": false, + "useCodeCache": false +} +``` + +Download a pinned `node.exe` directly from the +[official Node.js distribution](https://nodejs.org/dist/) and save it as the +application executable. This example uses Node.js 24.19.0 x64: + +Node.js does not publish a separate SEA executable. The regular official +`node.exe` already contains SEA support; postject turns a copy of it into the +application executable by injecting the blob and enabling its SEA fuse. + +```powershell +New-Item .\build -ItemType Directory -Force + +$nodeVersion = "24.19.0" +$nodeUrl = "https://nodejs.org/dist/v$nodeVersion/win-x64/node.exe" +$nodeSha256 = "3602f2bb1a10f2cbab4c36886218a33c1ab3db87290e73b033c46c77147d0237" +$nodeExe = ".\build\MyApp.exe" + +Invoke-WebRequest $nodeUrl -OutFile $nodeExe + +$actualSha256 = ( + Get-FileHash $nodeExe -Algorithm SHA256 +).Hash.ToLowerInvariant() +if ($actualSha256 -ne $nodeSha256) { + throw "Node.js executable SHA256 mismatch" +} +``` + +Before modifying it, use the downloaded executable to generate the SEA +preparation blob: + +```powershell +& $nodeExe --experimental-sea-config .\sea-config.json +``` + +The official Node executable is Authenticode-signed. Injection changes the +file, so remove that signature before running postject: + +```powershell +npx winapp tool signtool remove ` + /s .\build\MyApp.exe +``` + +Inject the blob and enable Node's SEA fuse: + +```powershell +npx postject ` + .\build\MyApp.exe ` + NODE_SEA_BLOB ` + .\build\sea-prep.blob ` + --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 +``` + +Postject updates `build\MyApp.exe` in place. The resulting executable starts +the packaged `main.js`. + +Before continuing, make sure these files exist: + +```text +build\MyApp.exe +dist\main.js +``` + +For x64 and ARM64, build separate executables and use the matching +`dynwinrt.node`. + +## 3. Configure the manifest and assets + +`winapp init` already generated `Package.appxmanifest` and the image assets. +Update the app name, publisher, version, and any required capabilities. + +To replace the generated artwork: + +```powershell +npx winapp manifest update-assets ` + .\packaging\logo.svg ` + --manifest .\Package.appxmanifest +``` + +## 4. Stage the runtime files + +Create the package layout and copy the files needed at runtime: + +```powershell +New-Item @( + ".\layout\.winapp", + ".\layout\node_modules\@microsoft", + ".\artifacts" +) -ItemType Directory -Force + +Copy-Item .\build\MyApp.exe .\layout +Copy-Item .\dist\* .\layout -Recurse +Copy-Item .\Package.appxmanifest .\layout +Copy-Item .\Assets .\layout\Assets -Recurse +Copy-Item .\package.json .\layout +Copy-Item .\.winapp\bindings .\layout\.winapp\bindings -Recurse +Copy-Item ` + .\node_modules\@microsoft\dynwinrt ` + .\layout\node_modules\@microsoft\dynwinrt ` + -Recurse +``` + +Adjust `build` and `dist` if the project uses different output directories. + +## 5. Create a development certificate + +For local testing: + +```powershell +npx winapp cert generate ` + --manifest .\layout\Package.appxmanifest ` + --output .\artifacts\devcert.pfx ` + --export-cer ` + --password password +``` + +Trust it once from an elevated terminal: + +```powershell +npx winapp cert install .\artifacts\devcert.pfx ` + --password password +``` + +The generated certificate is for development only. Never commit the PFX or its +password. + +Sign the final SEA executable after injection: + +```powershell +npx winapp sign ` + .\layout\MyApp.exe ` + .\artifacts\devcert.pfx ` + --password password +``` + +## 6. Build the MSIX + +```powershell +npx winapp pack ` + .\layout ` + --manifest .\layout\Package.appxmanifest ` + --executable MyApp.exe ` + --output .\artifacts\Contoso.DynWinRTApp_1.0.0.0_x64.msix ` + --cert .\artifacts\devcert.pfx ` + --cert-password password +``` + +WinApp CLI detects the executable architecture, resolves the manifest token, +generates PRI resources, creates the MSIX, and signs it. + +Inspect the result when diagnosing packaging issues: + +```powershell +npx winapp tool makeappx unpack ` + /p .\artifacts\Contoso.DynWinRTApp_1.0.0.0_x64.msix ` + /d .\artifacts\unpacked ` + /o + +Get-AuthenticodeSignature ` + .\artifacts\Contoso.DynWinRTApp_1.0.0.0_x64.msix +``` + +Here `/p` is the input package, `/d` is the unpack destination, and `/o` +allows overwriting an existing destination. + +## 7. Install and launch + +```powershell +Add-AppxPackage ` + .\artifacts\Contoso.DynWinRTApp_1.0.0.0_x64.msix +``` + +Launch through the registered application identity: + +```powershell +$package = Get-AppxPackage -Name Contoso.DynWinRTApp +$app = Get-StartApps | + Where-Object AppID -Like "$($package.PackageFamilyName)!*" | + Select-Object -First 1 + +Start-Process explorer.exe ` + -ArgumentList "shell:AppsFolder\$($app.AppID)" +``` + +Verify the identity from application code: + +```javascript +const { hasPackageIdentity } = require('@microsoft/dynwinrt') + +if (!hasPackageIdentity()) { + throw new Error('The process was not launched with package identity') +} +``` + +Uninstall the development package: + +```powershell +Get-AppxPackage -Name Contoso.DynWinRTApp | Remove-AppxPackage +``` + +## Windows App Runtime applications + +A Node.js application that only calls stock `Windows.*` APIs does not need a +Windows App Runtime dependency. + +A Node.js application that calls `Microsoft.Windows.*` or WinUI APIs can +either: + +- declare the matching Windows App Runtime framework package; or +- use `npx winapp pack --self-contained`. + +A framework-dependent packaged process must not call the unpackaged Windows +App SDK bootstrap path. Package activation resolves the declared framework. +Keep metadata, runtime files, generated projections, and native extensions on +the same Windows App SDK version. + +## Optional: test the layout before packaging + +Use `winapp run` when the application needs package identity during +development. See [Node.js development mode](../node/dev-mode.md) for the +registration, launch, and cleanup workflows. + +## Writable application data + +The installed package directory is immutable. The Node.js application must +store logs, databases, caches, and user state elsewhere. + +Packaged desktop applications can virtualize `%LOCALAPPDATA%` paths under: + +```text +%LOCALAPPDATA%\Packages\\LocalCache\Local\ +``` + +Use `Windows.Storage.ApplicationData` for package-scoped state. Use an +explicit external location if data must survive uninstall. Test upgrade, +uninstall, and reinstall behavior for the selected location. + +## x64 and ARM64 + +Build and test one layout per native architecture: + +```text +publish\ + x64\ + MyApp.exe + node_modules\@microsoft\dynwinrt\... + arm64\ + MyApp.exe + node_modules\@microsoft\dynwinrt\... +``` + +For ARM64, repeat the SEA build with the same Node version's +[`win-arm64/node.exe`](https://nodejs.org/dist/v24.19.0/win-arm64/node.exe) +and the ARM64 dynwinrt runtime. + +WinApp CLI 0.5.0 can create a multi-architecture bundle directly: + +```powershell +npx winapp pack ` + .\publish\x64 ` + .\publish\arm64 ` + --manifest .\layout\Package.appxmanifest ` + --executable MyApp.exe ` + --output .\artifacts\Contoso.DynWinRTApp_1.0.0.0_x64_arm64.msixbundle ` + --cert .\artifacts\devcert.pfx ` + --cert-password password +``` + +This produces one `.msixbundle` at `--output`. The bundle contains separate +x64 and ARM64 MSIX packages, and Windows installs the matching architecture. + +WinApp CLI validates that package identity, capabilities, and dependencies are +consistent across slices and stamps each package with the detected PE +architecture. + +## Production release + +Use Microsoft Store signing or an organization signing service when possible. +If CI uses a protected PFX, keep building and signing in separate jobs and +timestamp the signatures: + +```powershell +$password = $env:MSIX_CERT_PASSWORD + +npx winapp sign .\layout\MyApp.exe .\secure\release.pfx ` + --password $password ` + --timestamp https://timestamp.digicert.com + +npx winapp pack .\layout ` + --manifest .\layout\Package.appxmanifest ` + --executable MyApp.exe ` + --output .\artifacts\Contoso.DynWinRTApp_1.0.0.0_x64.msix + +npx winapp sign .\artifacts\Contoso.DynWinRTApp_1.0.0.0_x64.msix ` + .\secure\release.pfx ` + --password $password ` + --timestamp https://timestamp.digicert.com +``` + +Before publishing, test the exact signed artifact on a clean x64 and ARM64 +machine: + +- install and uninstall; +- Start menu/AUMID activation; +- package identity and capabilities; +- framework and VC runtime dependencies; +- upgrade with preserved state; and +- absence of source files, build tools, and certificates in the package. diff --git a/PYTHON_CHECKLIST.md b/docs/status/PYTHON_CHECKLIST.md similarity index 99% rename from PYTHON_CHECKLIST.md rename to docs/status/PYTHON_CHECKLIST.md index 7e74d573..5578b7ff 100644 --- a/PYTHON_CHECKLIST.md +++ b/docs/status/PYTHON_CHECKLIST.md @@ -3,7 +3,7 @@ This checklist tracks the path from the current source-built Python prototype to a distributable, typed, and reliable WinRT projection. -See [`docs/python-ui-ecosystem.md`](docs/python-ui-ecosystem.md) for research on +See [`docs/guides/python/python-ui-ecosystem.md`](../guides/python/python-ui-ecosystem.md) for research on Python UI frameworks, static pywinrt adoption, real integrations, and the value of a dynamic projection. diff --git a/TODO.md b/docs/status/TODO.md similarity index 99% rename from TODO.md rename to docs/status/TODO.md index db9508c6..34356602 100644 --- a/TODO.md +++ b/docs/status/TODO.md @@ -159,7 +159,7 @@ Kept for reference; git history is the source of truth. Grouped by area. - [x] `winapp init --add-js-bindings` toolchain integration - [x] `package.json` repository URL corrected to `github.com/microsoft/dynwinrt` - [x] Cargo.toml files have `authors`, `license`, `description`, `repository`; `bindings/py/pyproject.toml` has authors/license/urls -- [x] Electron benchmark app under `bench-electron/` — full IPC round-trip static vs dynamic +- [x] Electron benchmark app under `benchmarks/electron/` — full IPC round-trip static vs dynamic ### Cleanup - [x] `[resolve]` debug `eprintln!` removed from `meta.rs` diff --git a/scripts/test_python_codegen_wheel.ps1 b/eng/release/python/test_python_codegen_wheel.ps1 similarity index 94% rename from scripts/test_python_codegen_wheel.ps1 rename to eng/release/python/test_python_codegen_wheel.ps1 index 797c7ded..aa1bf6e5 100644 --- a/scripts/test_python_codegen_wheel.ps1 +++ b/eng/release/python/test_python_codegen_wheel.ps1 @@ -9,7 +9,8 @@ param( ) $ErrorActionPreference = 'Stop' -$root = Join-Path $PWD ".python-release\codegen-$Architecture" +$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..\..')).Path +$root = Join-Path $repoRoot ".python-release\codegen-$Architecture" Remove-Item $root -Recurse -Force -ErrorAction SilentlyContinue New-Item $root -ItemType Directory -Force | Out-Null diff --git a/scripts/test_python_runtime_wheel.ps1 b/eng/release/python/test_python_runtime_wheel.ps1 similarity index 94% rename from scripts/test_python_runtime_wheel.ps1 rename to eng/release/python/test_python_runtime_wheel.ps1 index 2bb55d79..14e48c71 100644 --- a/scripts/test_python_runtime_wheel.ps1 +++ b/eng/release/python/test_python_runtime_wheel.ps1 @@ -12,7 +12,8 @@ param( $ErrorActionPreference = 'Stop' $label = $PythonMinor.Replace('.', '') -$root = Join-Path $PWD ".python-release\runtime-$Architecture-cp$label" +$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..\..')).Path +$root = Join-Path $repoRoot ".python-release\runtime-$Architecture-cp$label" Remove-Item $root -Recurse -Force -ErrorAction SilentlyContinue New-Item $root -ItemType Directory -Force | Out-Null diff --git a/scripts/verify_python_release.py b/eng/release/python/verify_python_release.py similarity index 99% rename from scripts/verify_python_release.py rename to eng/release/python/verify_python_release.py index 8ddb091d..c0600fbe 100644 --- a/scripts/verify_python_release.py +++ b/eng/release/python/verify_python_release.py @@ -15,7 +15,7 @@ from packaging.version import Version -ROOT = Path(__file__).resolve().parents[1] +ROOT = Path(__file__).resolve().parents[3] RUNTIME_REQUIRES = ">=3.11,<3.15" CODEGEN_REQUIRES = ">=3.8,<3.15" RUNTIME_MINORS = tuple(f"3.{minor}" for minor in range(11, 15)) diff --git a/bindings/js/samples/array_struct.ts b/samples/js/array_struct.ts similarity index 99% rename from bindings/js/samples/array_struct.ts rename to samples/js/array_struct.ts index a553897a..84fb1407 100644 --- a/bindings/js/samples/array_struct.ts +++ b/samples/js/array_struct.ts @@ -18,7 +18,7 @@ import { DynWinRtStruct, WinGuid, roInitialize, -} from '../dist/winrt.js' +} from '../../bindings/js/dist/winrt.js' // Initialize WinRT (MTA) roInitialize(1) diff --git a/bindings/js/samples/ocr.ts b/samples/js/ocr.ts similarity index 99% rename from bindings/js/samples/ocr.ts rename to samples/js/ocr.ts index 8cf0a8e5..f06be49f 100644 --- a/bindings/js/samples/ocr.ts +++ b/samples/js/ocr.ts @@ -14,7 +14,7 @@ import { WinGuid, hasPackageIdentity, initWinappsdk, -} from '../dist/winrt.js' +} from '../../bindings/js/dist/winrt.js' // ====================================================================== // IIDs diff --git a/bindings/js/samples/picker.ts b/samples/js/picker.ts similarity index 98% rename from bindings/js/samples/picker.ts rename to samples/js/picker.ts index 577b792e..0fddd283 100644 --- a/bindings/js/samples/picker.ts +++ b/samples/js/picker.ts @@ -8,7 +8,7 @@ import { DynWinRtType, DynWinRtMethodSig, WinGuid, -} from '../dist/winrt.js' +} from '../../bindings/js/dist/winrt.js' // ====================================================================== // Register interfaces (once) diff --git a/bindings/js/samples/test_progress.ts b/samples/js/test_progress.ts similarity index 99% rename from bindings/js/samples/test_progress.ts rename to samples/js/test_progress.ts index 67f95f7c..dd890a5a 100644 --- a/bindings/js/samples/test_progress.ts +++ b/samples/js/test_progress.ts @@ -12,7 +12,7 @@ import { DynWinRtMethodSig, WinGuid, roInitialize, -} from '../dist/winrt.js' +} from '../../bindings/js/dist/winrt.js' roInitialize(1) diff --git a/bindings/js/samples/test_register_interface.ts b/samples/js/test_register_interface.ts similarity index 98% rename from bindings/js/samples/test_register_interface.ts rename to samples/js/test_register_interface.ts index 16bdd83e..619bbed0 100644 --- a/bindings/js/samples/test_register_interface.ts +++ b/samples/js/test_register_interface.ts @@ -11,7 +11,7 @@ import { DynWinRtMethodSig, WinGuid, roInitialize, -} from '../dist/winrt.js' +} from '../../bindings/js/dist/winrt.js' roInitialize(1) diff --git a/tests/e2e_specs.json b/tests/e2e/e2e_specs.json similarity index 100% rename from tests/e2e_specs.json rename to tests/e2e/e2e_specs.json diff --git a/tests/e2e_specs.schema.json b/tests/e2e/e2e_specs.schema.json similarity index 100% rename from tests/e2e_specs.schema.json rename to tests/e2e/e2e_specs.schema.json diff --git a/tests/e2e_test.ps1 b/tests/e2e/e2e_test.ps1 similarity index 94% rename from tests/e2e_test.ps1 rename to tests/e2e/e2e_test.ps1 index 9dc94c9c..815ff670 100644 --- a/tests/e2e_test.ps1 +++ b/tests/e2e/e2e_test.ps1 @@ -6,11 +6,11 @@ # Test logic lives in runners/py_runner.py, runners/ts_runner.ts, and runners/com/*.mjs. # # Usage: -# .\tests\e2e_test.ps1 # Full (build + generate + test) -# .\tests\e2e_test.ps1 -SkipBuild # Skip build step -# .\tests\e2e_test.ps1 -Lang py # Python only -# .\tests\e2e_test.ps1 -Lang ts # TypeScript only -# .\tests\e2e_test.ps1 -Lang com # Classic COM only +# .\tests\e2e\e2e_test.ps1 # Full (build + generate + test) +# .\tests\e2e\e2e_test.ps1 -SkipBuild # Skip build step +# .\tests\e2e\e2e_test.ps1 -Lang py # Python only +# .\tests\e2e\e2e_test.ps1 -Lang ts # TypeScript only +# .\tests\e2e\e2e_test.ps1 -Lang com # Classic COM only param( [switch]$SkipBuild, @@ -20,10 +20,10 @@ param( $ErrorActionPreference = "Stop" $langWasExplicit = $PSBoundParameters.ContainsKey("Lang") -$root = Split-Path $PSScriptRoot -Parent +$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent $specsFile = Join-Path $PSScriptRoot "e2e_specs.json" -$e2eDir = Join-Path $root "tests\e2e_generated" -$runnersDir = Join-Path $root "tests\runners" +$e2eDir = Join-Path $PSScriptRoot "e2e_generated" +$runnersDir = Join-Path $PSScriptRoot "runners" $pyBindingsDir = Join-Path $e2eDir "python_bindings" $comBindingsDir = Join-Path $e2eDir "com" $comShellDir = Join-Path $comBindingsDir "shell" @@ -176,8 +176,8 @@ foreach ($l in @($Lang | Where-Object { $_ -in @("py", "ts") })) { if ("com" -in $Lang) { Write-Host "`n--- Generate (Classic COM) ---" -ForegroundColor Yellow - $comRuntimeImport = "../../../../../bindings/js/dist/com.js" - $winrtRuntimeImport = "../../../../bindings/js/dist/winrt.js" + $comRuntimeImport = "../../../../../../bindings/js/dist/com.js" + $winrtRuntimeImport = "../../../../../bindings/js/dist/winrt.js" & cargo run -p dynwinrt-codegen --release --quiet -- generate ` --winmd $win32Winmd ` @@ -231,7 +231,7 @@ if ("py" -in $Lang) { $previousMypyPath = $env:MYPYPATH try { $env:MYPYPATH = $e2eDir - python -m mypy --strict (Join-Path $root "tests\typecheck\python_generated_api.py") + python -m mypy --strict (Join-Path $PSScriptRoot "typecheck\python_generated_api.py") if ($LASTEXITCODE -ne 0) { Write-Error "Python static type check failed"; exit 1 } } finally { $env:MYPYPATH = $previousMypyPath diff --git a/tests/python_winui_e2e.ps1 b/tests/e2e/python_winui_e2e.ps1 similarity index 98% rename from tests/python_winui_e2e.ps1 rename to tests/e2e/python_winui_e2e.ps1 index 5bd1722a..259522f7 100644 --- a/tests/python_winui_e2e.ps1 +++ b/tests/e2e/python_winui_e2e.ps1 @@ -20,7 +20,7 @@ param( $ErrorActionPreference = "Stop" $caller = (Get-Location).Path -$root = Split-Path $PSScriptRoot -Parent +$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent function Resolve-CallerPath([string]$Path) { if ([System.IO.Path]::IsPathRooted($Path)) { diff --git a/tests/runners/com/dtm.mjs b/tests/e2e/runners/com/dtm.mjs similarity index 94% rename from tests/runners/com/dtm.mjs rename to tests/e2e/runners/com/dtm.mjs index 9dd8696f..cb9ac679 100644 --- a/tests/runners/com/dtm.mjs +++ b/tests/e2e/runners/com/dtm.mjs @@ -4,9 +4,9 @@ // E2E: real Node.js proof that IDataTransferManagerInterop returns a live // WinRT object through the HWND interop pattern: // IDataTransferManagerInterop::GetForWindow(HWND, REFIID, void**) -// Run: .\tests\e2e_test.ps1 -SkipBuild -Lang com +// Run: .\tests\e2e\e2e_test.ps1 -SkipBuild -Lang com -import { DynCom, DynComMethodSig, WinGuid } from '../../../bindings/js/dist/com.js'; +import { DynCom, DynComMethodSig, WinGuid } from '../../../../bindings/js/dist/com.js'; import { IDataTransferManagerInterop } from '../../e2e_generated/com/shell/com/IDataTransferManagerInterop.js'; import { acquireHwndBigInt } from './hwnd.mjs'; diff --git a/tests/runners/com/electron-hwnd-buffer.mjs b/tests/e2e/runners/com/electron-hwnd-buffer.mjs similarity index 100% rename from tests/runners/com/electron-hwnd-buffer.mjs rename to tests/e2e/runners/com/electron-hwnd-buffer.mjs diff --git a/tests/runners/com/file-open-dialog.mjs b/tests/e2e/runners/com/file-open-dialog.mjs similarity index 87% rename from tests/runners/com/file-open-dialog.mjs rename to tests/e2e/runners/com/file-open-dialog.mjs index 5cfd2655..61b3ec51 100644 --- a/tests/runners/com/file-open-dialog.mjs +++ b/tests/e2e/runners/com/file-open-dialog.mjs @@ -2,7 +2,7 @@ // Licensed under the MIT License. import assert from 'node:assert/strict'; -import { DynCom } from '../../../bindings/js/dist/com.js'; +import { DynCom } from '../../../../bindings/js/dist/com.js'; import { FileOpenDialog } from '../../e2e_generated/com/shell/com/FileOpenDialog.js'; DynCom.initialize(0); diff --git a/tests/runners/com/file-operation.mjs b/tests/e2e/runners/com/file-operation.mjs similarity index 91% rename from tests/runners/com/file-operation.mjs rename to tests/e2e/runners/com/file-operation.mjs index a0791d11..f1f0a9fe 100644 --- a/tests/runners/com/file-operation.mjs +++ b/tests/e2e/runners/com/file-operation.mjs @@ -2,7 +2,7 @@ // Licensed under the MIT License. import assert from 'node:assert/strict'; -import { DynCom } from '../../../bindings/js/dist/com.js'; +import { DynCom } from '../../../../bindings/js/dist/com.js'; import { FILEOPERATION_FLAGS } from '../../e2e_generated/com/shell/com/FILEOPERATION_FLAGS.js'; import { FileOperation } from '../../e2e_generated/com/shell/com/FileOperation.js'; diff --git a/tests/runners/com/hwnd.mjs b/tests/e2e/runners/com/hwnd.mjs similarity index 88% rename from tests/runners/com/hwnd.mjs rename to tests/e2e/runners/com/hwnd.mjs index 4afa0c1f..cf7012ef 100644 --- a/tests/runners/com/hwnd.mjs +++ b/tests/e2e/runners/com/hwnd.mjs @@ -11,8 +11,8 @@ // napi `createTestHwnd()` export, which creates a hidden `WS_POPUP` // window in the Node process using the pre-registered `STATIC` class. -import { DynCom } from '../../../bindings/js/dist/com.js'; -import { roInitialize } from '../../../bindings/js/dist/winrt.js'; +import { DynCom } from '../../../../bindings/js/dist/com.js'; +import { roInitialize } from '../../../../bindings/js/dist/winrt.js'; roInitialize(1); diff --git a/tests/runners/com/module-commonjs.cjs b/tests/e2e/runners/com/module-commonjs.cjs similarity index 90% rename from tests/runners/com/module-commonjs.cjs rename to tests/e2e/runners/com/module-commonjs.cjs index c18a5c7e..983a4721 100644 --- a/tests/runners/com/module-commonjs.cjs +++ b/tests/e2e/runners/com/module-commonjs.cjs @@ -2,7 +2,7 @@ // Licensed under the MIT License. const assert = require('node:assert/strict'); -const { DynCom } = require('../../../bindings/js/dist/com.js'); +const { DynCom } = require('../../../../bindings/js/dist/com.js'); const barrel = require('../../e2e_generated/com/shell/com/index.js'); const deep = require('../../e2e_generated/com/shell/com/TaskbarList.js'); diff --git a/tests/runners/com/persist-file.mjs b/tests/e2e/runners/com/persist-file.mjs similarity index 89% rename from tests/runners/com/persist-file.mjs rename to tests/e2e/runners/com/persist-file.mjs index 25c5ff0b..b841b6f3 100644 --- a/tests/runners/com/persist-file.mjs +++ b/tests/e2e/runners/com/persist-file.mjs @@ -2,7 +2,7 @@ // Licensed under the MIT License. import assert from 'node:assert/strict'; -import { DynCom } from '../../../bindings/js/dist/com.js'; +import { DynCom } from '../../../../bindings/js/dist/com.js'; import { IID_IPersistFile, IPersistFile, diff --git a/tests/runners/com/pointer-reject-object.mjs b/tests/e2e/runners/com/pointer-reject-object.mjs similarity index 91% rename from tests/runners/com/pointer-reject-object.mjs rename to tests/e2e/runners/com/pointer-reject-object.mjs index 30be9322..6f3ca87f 100644 --- a/tests/runners/com/pointer-reject-object.mjs +++ b/tests/e2e/runners/com/pointer-reject-object.mjs @@ -2,7 +2,7 @@ // DynWinRtValue inputs. Borrowing an owned COM object's raw pointer here would // make it indistinguishable from an owned raw pointer to adoptComPointer(), // which can double-release the original wrapper's COM object. -import { DynCom, WinGuid } from '../../../bindings/js/dist/com.js'; +import { DynCom, WinGuid } from '../../../../bindings/js/dist/com.js'; // iidPointer() returns a DynWinRtValue — a representative value input. const someValue = DynCom.iidPointer(WinGuid.parse('a5caee9b-8708-49d1-8d36-67d25a8da00c')); diff --git a/tests/runners/com/smtc.mjs b/tests/e2e/runners/com/smtc.mjs similarity index 97% rename from tests/runners/com/smtc.mjs rename to tests/e2e/runners/com/smtc.mjs index 4cb90582..1afe17b8 100644 --- a/tests/runners/com/smtc.mjs +++ b/tests/e2e/runners/com/smtc.mjs @@ -13,9 +13,9 @@ // real SMTC member (isPlayEnabled) to prove the returned object is a live, // usable SystemMediaTransportControls, not just a valid IInspectable pointer. // -// Run: .\tests\e2e_test.ps1 -SkipBuild -Lang com +// Run: .\tests\e2e\e2e_test.ps1 -SkipBuild -Lang com -import { DynCom, DynComMethodSig, WinGuid } from '../../../bindings/js/dist/com.js'; +import { DynCom, DynComMethodSig, WinGuid } from '../../../../bindings/js/dist/com.js'; // Classic-COM interop wrapper: gets the SMTC pointer from an HWND. import { ISystemMediaTransportControlsInterop } from '../../e2e_generated/com/interop/com/ISystemMediaTransportControlsInterop.js'; import { acquireHwndBigInt } from './hwnd.mjs'; diff --git a/tests/runners/com/taskbarlist.mjs b/tests/e2e/runners/com/taskbarlist.mjs similarity index 98% rename from tests/runners/com/taskbarlist.mjs rename to tests/e2e/runners/com/taskbarlist.mjs index efef00cc..1ab1e410 100644 --- a/tests/runners/com/taskbarlist.mjs +++ b/tests/e2e/runners/com/taskbarlist.mjs @@ -4,7 +4,7 @@ // Phase 2 E2E: real Node.js proof that the generated natural ITaskbarList3 // wrapper drives live Windows classic COM (ITaskbarList3) via CoCreateInstance. // -// Run: .\tests\e2e_test.ps1 -SkipBuild -Lang com +// Run: .\tests\e2e\e2e_test.ps1 -SkipBuild -Lang com import { ITaskbarList3, diff --git a/tests/runners/com/wic-imaging-factory.mjs b/tests/e2e/runners/com/wic-imaging-factory.mjs similarity index 90% rename from tests/runners/com/wic-imaging-factory.mjs rename to tests/e2e/runners/com/wic-imaging-factory.mjs index b6551df0..1761c417 100644 --- a/tests/runners/com/wic-imaging-factory.mjs +++ b/tests/e2e/runners/com/wic-imaging-factory.mjs @@ -2,7 +2,7 @@ // Licensed under the MIT License. import assert from 'node:assert/strict'; -import { DynCom } from '../../../bindings/js/dist/com.js'; +import { DynCom } from '../../../../bindings/js/dist/com.js'; import { IID_IWICImagingFactory, IWICImagingFactory, diff --git a/tests/runners/py_runner.py b/tests/e2e/runners/py_runner.py similarity index 99% rename from tests/runners/py_runner.py rename to tests/e2e/runners/py_runner.py index 16c60de4..9b14b99b 100644 --- a/tests/runners/py_runner.py +++ b/tests/e2e/runners/py_runner.py @@ -8,7 +8,7 @@ and executes checks against real WinRT APIs. Usage: - python tests/runners/py_runner.py --specs tests/e2e_specs.json --generated tests/e2e_generated/python_bindings --output results.json + python tests/e2e/runners/py_runner.py --specs tests/e2e/e2e_specs.json --generated tests/e2e/e2e_generated/python_bindings --output results.json """ import argparse diff --git a/tests/runners/py_winui_runner.py b/tests/e2e/runners/py_winui_runner.py similarity index 100% rename from tests/runners/py_winui_runner.py rename to tests/e2e/runners/py_winui_runner.py diff --git a/tests/runners/ts_issue_regression_child.mjs b/tests/e2e/runners/ts_issue_regression_child.mjs similarity index 100% rename from tests/runners/ts_issue_regression_child.mjs rename to tests/e2e/runners/ts_issue_regression_child.mjs diff --git a/tests/runners/ts_runner.ts b/tests/e2e/runners/ts_runner.ts similarity index 99% rename from tests/runners/ts_runner.ts rename to tests/e2e/runners/ts_runner.ts index 7ec1bd2e..863175dd 100644 --- a/tests/runners/ts_runner.ts +++ b/tests/e2e/runners/ts_runner.ts @@ -8,7 +8,7 @@ * and executes checks against real WinRT APIs. * * Usage: - * npx tsx tests/runners/ts_runner.ts --specs tests/e2e_specs.json --generated tests/e2e_generated/ts --runtime bindings/js/dist/winrt.js [--output results.json] + * npx tsx tests/e2e/runners/ts_runner.ts --specs tests/e2e/e2e_specs.json --generated tests/e2e/e2e_generated/ts --runtime bindings/js/dist/winrt.js [--output results.json] */ import { strict as assert } from 'node:assert'; diff --git a/tests/typecheck/python_generated_api.py b/tests/e2e/typecheck/python_generated_api.py similarity index 100% rename from tests/typecheck/python_generated_api.py rename to tests/e2e/typecheck/python_generated_api.py