@tsonic/js 10.0.26 → 10.0.31

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/README.md CHANGED
@@ -1,31 +1,47 @@
1
1
  # @tsonic/js
2
2
 
3
- JavaScript-style APIs for **Tsonic** (TypeScript → .NET).
3
+ JavaScript-style APIs for **Tsonic**.
4
+
5
+ This package is part of Tsonic: https://tsonic.org.
4
6
 
5
7
  Use `@tsonic/js` when you want a JS-like standard library (`console`, `JSON`, `Map`, `Set`, `Date`, timers, etc.) while still compiling to a native binary with `tsonic`.
6
8
 
7
- ## Quick Start
9
+ ## Prerequisites
8
10
 
9
- ### New project
11
+ - Install the .NET 10 SDK (required by Tsonic): https://dotnet.microsoft.com/download
12
+ - Verify: `dotnet --version`
13
+
14
+ ## Quick Start
10
15
 
11
16
  ```bash
12
17
  mkdir my-app && cd my-app
13
- tsonic init
14
- tsonic add npm @tsonic/js
18
+ npx --yes tsonic@latest init
19
+ npx --yes tsonic@latest add npm @tsonic/js
20
+
21
+ # Replace the default App.ts with a JSRuntime example
22
+ cat > packages/my-app/src/App.ts <<'EOF'
23
+ import { console, JSON } from "@tsonic/js/index.js";
24
+
25
+ export function main(): void {
26
+ const value = JSON.parse<{ x: number }>('{"x": 1}');
27
+ console.log(JSON.stringify(value));
28
+ }
29
+ EOF
30
+
15
31
  npm run dev
16
32
  ```
17
33
 
18
- ### Existing project
34
+ ## Existing project
19
35
 
20
36
  ```bash
21
- tsonic add npm @tsonic/js
37
+ npx --yes tsonic@latest add npm @tsonic/js
22
38
  ```
23
39
 
24
40
  ## Versioning
25
41
 
26
- This repo is versioned by **.NET major**:
42
+ This repo is versioned by runtime major:
27
43
 
28
- - **.NET 10** → `versions/10/` → npm: `@tsonic/js@10.x`
44
+ - `10` → `versions/10/` → npm: `@tsonic/js@10.x`
29
45
 
30
46
  When publishing, run: `npm publish versions/10 --access public`
31
47
 
@@ -95,22 +111,7 @@ If you want Node-style modules (`fs`, `path`, `crypto`, `http`, …), use `@tson
95
111
 
96
112
  ## Development
97
113
 
98
- ### Regenerating Types
99
-
100
- To regenerate TypeScript declarations:
101
-
102
- ```bash
103
- ./__build/scripts/generate.sh
104
- ```
105
-
106
- **Prerequisites:**
107
- - .NET 10 SDK installed
108
- - `tsbindgen` repository at `../tsbindgen`
109
- - `js-runtime` repository at `../js-runtime` (built with `dotnet build -c Release`)
110
-
111
- **Environment variables:**
112
- - `DOTNET_VERSION` - .NET runtime version (default: `10.0.0`)
113
- - `DOTNET_HOME` - .NET installation directory (default: `$HOME/.dotnet`)
114
+ See `__build/` for regeneration scripts.
114
115
 
115
116
  ## License
116
117
 
@@ -62,9 +62,9 @@ export interface __Ext_Tsonic_JSRuntime_String {
62
62
 
63
63
  // Internal helper types for sticky extension scopes
64
64
  type __TsonicExtMapOf<T> = T extends { __tsonic_ext?: infer M } ? M : {};
65
- type __TsonicMergeExtMaps<A, B> = Omit<A, keyof B> & B;
65
+ type __TsonicMergeExtMaps<A, B> = A & B;
66
66
  type __TsonicWithExt<TShape, K extends string, TApplier> = { __tsonic_ext?: __TsonicMergeExtMaps<__TsonicExtMapOf<TShape>, { [P in K]: TApplier }> };
67
- type __TsonicPreferExt<A, B> = Omit<A, keyof B> & B;
67
+ type __TsonicPreferExt<A, B> = A & B;
68
68
 
69
69
  // Generic helper type for extension methods in namespace: Tsonic.JSRuntime
70
70
  type __TsonicExtSurface_Tsonic_JSRuntime<TShape> =
package/index.d.ts CHANGED
@@ -8,9 +8,6 @@ import * as Internal from './index/internal/index.js';
8
8
  // Primitive type aliases for flattened exports
9
9
  import type { sbyte, byte, short, ushort, int, uint, long, ulong, int128, uint128, half, float, double, decimal, nint, nuint, char } from '@tsonic/core/types.js';
10
10
 
11
- // Namespace imports for flattened exports
12
- import * as System_Internal from "@tsonic/dotnet/System.js";
13
-
14
11
  // Cross-namespace type imports for constraints
15
12
  import type { IEnumerable as IEnumerable__System_Collections_Generic, IEnumerator, KeyValuePair, List } from '@tsonic/dotnet/System.Collections.Generic.js';
16
13
  import type { IEnumerable } from '@tsonic/dotnet/System.Collections.js';
@@ -57,7 +54,7 @@ export declare function isFinite(value: double): boolean;
57
54
  export declare function isNaN(value: double): boolean;
58
55
  export declare function Number(value: unknown): double;
59
56
  export declare function parseFloat(str: string): double;
60
- export declare function parseInt(str: string, radix?: Nullable<System_Internal.Int32>): Nullable<System_Internal.Int64>;
57
+ export declare function parseInt(str: string, radix?: Nullable<int>): Nullable<long>;
61
58
  export declare function String(value: unknown): string;
62
59
  export declare const Infinity: double;
63
60
  export declare const NaN: double;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsonic/js",
3
- "version": "10.0.26",
3
+ "version": "10.0.31",
4
4
  "description": "TypeScript type definitions for JavaScript Runtime (JSRuntime) library",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -20,7 +20,7 @@
20
20
  "url": "https://github.com/tsoniclang/js.git"
21
21
  },
22
22
  "peerDependencies": {
23
- "@tsonic/dotnet": "10.0.26",
24
- "@tsonic/core": "10.0.26"
23
+ "@tsonic/dotnet": "10.0.31",
24
+ "@tsonic/core": "10.0.31"
25
25
  }
26
26
  }