@microsoft/dynwinrt-codegen 0.1.0-preview.1

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Leilei Zhang, Xiang Hong
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
Binary file
Binary file
package/cli.js ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env node
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ //
5
+ // Thin wrapper that invokes the platform-specific dynwinrt-codegen.exe.
6
+ // The Rust binary now emits .js + .d.ts directly (no SWC, no temp dir).
7
+
8
+ const { execFileSync } = require("child_process");
9
+ const path = require("path");
10
+
11
+ const args = process.argv.slice(2);
12
+
13
+ // We accept legacy flags `--source-map`, `--declaration`, `--no-declaration` for
14
+ // backwards compatibility but they are no-ops (the exe always emits .js + .d.ts).
15
+ const exeArgs = [];
16
+ for (let i = 0; i < args.length; i++) {
17
+ const a = args[i];
18
+ if (a === "--source-map" || a === "--declaration" || a === "--no-declaration") {
19
+ // no-op (Rust emit is final)
20
+ continue;
21
+ }
22
+ if (a === "--lang") {
23
+ const v = args[++i];
24
+ // ts and cjs are no longer separate targets — map to js silently
25
+ exeArgs.push("--lang", (v === "ts" || v === "cjs") ? "js" : v);
26
+ } else {
27
+ exeArgs.push(a);
28
+ }
29
+ }
30
+
31
+ const arch = process.arch === "arm64" ? "arm64" : "x64";
32
+ const exe = path.join(__dirname, "bin", arch, "dynwinrt-codegen.exe");
33
+
34
+ try {
35
+ execFileSync(exe, exeArgs, { stdio: "inherit" });
36
+ } catch (e) {
37
+ process.exit(e.status ?? 1);
38
+ }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@microsoft/dynwinrt-codegen",
3
+ "version": "0.1.0-preview.1",
4
+ "description": "Generate typed bindings from WinRT metadata (.winmd) files for use with @microsoft/dynwinrt",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/microsoft/dynwinrt"
9
+ },
10
+ "keywords": [
11
+ "winrt",
12
+ "winmd",
13
+ "codegen",
14
+ "typescript",
15
+ "windows",
16
+ "winappsdk"
17
+ ],
18
+ "os": [
19
+ "win32"
20
+ ],
21
+ "bin": {
22
+ "dynwinrt-codegen": "./cli.js"
23
+ },
24
+ "files": [
25
+ "bin/",
26
+ "cli.js",
27
+ "LICENSE"
28
+ ],
29
+ "dependencies": {
30
+
31
+ },
32
+ "publishConfig": {
33
+ "registry": "https://registry.npmjs.org",
34
+ "access": "public"
35
+ }
36
+ }