typenative 0.7.0 → 0.7.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.
Files changed (217) hide show
  1. package/bin/node/assert.js +2 -2
  2. package/bin/node/child_process.js +66 -8
  3. package/bin/node/fs.js +1012 -4
  4. package/bin/node/histogram.js +1991 -0
  5. package/bin/node/process.js +14 -2
  6. package/bin/node/sqlite.js +1488 -5
  7. package/bin/node/stream.js +2 -1
  8. package/bin/node/system_extra.js +3 -270
  9. package/bin/node/test.js +39 -1
  10. package/bin/node/test_report.js +47 -1
  11. package/bin/node/test_run.js +57 -2
  12. package/bin/node/util.js +8 -5
  13. package/bin/node/webassembly.js +20 -5
  14. package/bin/node/webview.js +3257 -244
  15. package/bin/node/zlib.js +118 -14
  16. package/bin/node/zlib_iter.js +585 -0
  17. package/bin/transpiler.js +1370 -258
  18. package/bin/version.js +1 -1
  19. package/govendor/software.sslmate.com/src/go-pkcs12/.gitattributes +10 -0
  20. package/govendor/software.sslmate.com/src/go-pkcs12/LICENSE +28 -0
  21. package/govendor/software.sslmate.com/src/go-pkcs12/README.md +31 -0
  22. package/govendor/software.sslmate.com/src/go-pkcs12/bmp-string.go +63 -0
  23. package/govendor/software.sslmate.com/src/go-pkcs12/crypto.go +331 -0
  24. package/govendor/software.sslmate.com/src/go-pkcs12/errors.go +23 -0
  25. package/govendor/software.sslmate.com/src/go-pkcs12/go.mod +3 -0
  26. package/govendor/software.sslmate.com/src/go-pkcs12/internal/rc2/rc2.go +271 -0
  27. package/govendor/software.sslmate.com/src/go-pkcs12/mac.go +202 -0
  28. package/govendor/software.sslmate.com/src/go-pkcs12/pbkdf.go +184 -0
  29. package/govendor/software.sslmate.com/src/go-pkcs12/pkcs12.go +1000 -0
  30. package/govendor/software.sslmate.com/src/go-pkcs12/safebags.go +107 -0
  31. package/package.json +10 -1
  32. package/types/tsconfig.json +17 -0
  33. package/types/typenative-npm.d.ts +492 -12
  34. package/types/typenative.d.ts +88 -2
  35. package/.gitattributes +0 -1
  36. package/.github/workflows/ci.yml +0 -68
  37. package/.github/workflows/npm-publish-github-packages.yml +0 -88
  38. package/CHANGELOG.md +0 -1746
  39. package/CONTRIBUTION.md +0 -133
  40. package/conformance.md +0 -1497
  41. package/examples/README.md +0 -114
  42. package/examples/angular-templates/README.md +0 -141
  43. package/examples/angular-templates/bench.mjs +0 -173
  44. package/examples/angular-templates/dom-type-globals.d.ts +0 -21
  45. package/examples/angular-templates/dom-type-stubs.ts +0 -21
  46. package/examples/angular-templates/main.ts +0 -135
  47. package/examples/angular-templates/parity.mjs +0 -157
  48. package/examples/angular-templates/run-node.mjs +0 -69
  49. package/examples/angular-templates/vendor/angular/compiler/LICENSE +0 -21
  50. package/examples/desktop-notes/README.md +0 -106
  51. package/examples/desktop-notes/bench.mjs +0 -125
  52. package/examples/desktop-notes/main.ts +0 -131
  53. package/examples/desktop-notes/package-lock.json +0 -726
  54. package/examples/desktop-notes/package.json +0 -9
  55. package/examples/desktop-notes/ui.ts +0 -176
  56. package/examples/dupe-finder/README.md +0 -78
  57. package/examples/dupe-finder/bench.mjs +0 -120
  58. package/examples/dupe-finder/main.ts +0 -87
  59. package/examples/fibonacci/README.md +0 -89
  60. package/examples/fibonacci/bench.mjs +0 -87
  61. package/examples/fibonacci/main.ts +0 -21
  62. package/examples/hello-world/README.md +0 -62
  63. package/examples/hello-world/bench.mjs +0 -66
  64. package/examples/hello-world/main.ts +0 -7
  65. package/examples/json-server/README.md +0 -132
  66. package/examples/json-server/bench.mjs +0 -263
  67. package/examples/json-server/main.ts +0 -67
  68. package/examples/mandelbrot-png/README.md +0 -63
  69. package/examples/mandelbrot-png/bench.mjs +0 -95
  70. package/examples/mandelbrot-png/main.ts +0 -98
  71. package/examples/mandelbrot-png/preview.png +0 -0
  72. package/examples/marked-cli/README.md +0 -174
  73. package/examples/marked-cli/bench.mjs +0 -178
  74. package/examples/marked-cli/main.ts +0 -410
  75. package/examples/marked-cli/parity.mjs +0 -185
  76. package/examples/marked-cli/vendor/marked/LICENSE +0 -44
  77. package/examples/marked-cli/vendor/marked/VENDOR.md +0 -26
  78. package/examples/openai-chat/README.md +0 -148
  79. package/examples/openai-chat/bench.mjs +0 -175
  80. package/examples/openai-chat/main.ts +0 -488
  81. package/examples/react-compiler/README.md +0 -185
  82. package/examples/react-compiler/bench.mjs +0 -181
  83. package/examples/react-compiler/main.ts +0 -324
  84. package/examples/react-compiler/parity.mjs +0 -362
  85. package/examples/react-compiler/run-node.mjs +0 -90
  86. package/examples/react-compiler/vendor/babel/LICENSE +0 -22
  87. package/examples/react-compiler/vendor/babel/helper-globals/data/builtin-lower.json +0 -15
  88. package/examples/react-compiler/vendor/babel/helper-globals/data/builtin-upper.json +0 -51
  89. package/examples/react-compiler/vendor/charcodes/package.json +0 -25
  90. package/examples/react-compiler/vendor/invariant/LICENSE +0 -21
  91. package/examples/react-compiler/vendor/invariant/invariant.cjs +0 -51
  92. package/examples/react-compiler/vendor/invariant/invariant.d.cts +0 -11
  93. package/examples/react-compiler/vendor/invariant/types/LICENSE +0 -21
  94. package/examples/react-compiler/vendor/jridgewell/gen-mapping/LICENSE +0 -19
  95. package/examples/react-compiler/vendor/jridgewell/resolve-uri/LICENSE +0 -19
  96. package/examples/react-compiler/vendor/jridgewell/sourcemap-codec/LICENSE +0 -19
  97. package/examples/react-compiler/vendor/jridgewell/trace-mapping/LICENSE +0 -19
  98. package/examples/react-compiler/vendor/js-tokens/LICENSE +0 -21
  99. package/examples/react-compiler/vendor/js-tokens/index.cjs +0 -23
  100. package/examples/react-compiler/vendor/js-tokens/index.d.cts +0 -13
  101. package/examples/react-compiler/vendor/jsesc/LICENSE-MIT.txt +0 -20
  102. package/examples/react-compiler/vendor/jsesc/jsesc.cjs +0 -337
  103. package/examples/react-compiler/vendor/jsesc/jsesc.d.cts +0 -384
  104. package/examples/react-compiler/vendor/jsesc/types/LICENSE +0 -21
  105. package/examples/react-compiler/vendor/picocolors/LICENSE +0 -15
  106. package/examples/react-compiler/vendor/picocolors/picocolors.cjs +0 -75
  107. package/examples/react-compiler/vendor/picocolors/picocolors.d.cts +0 -5
  108. package/examples/react-compiler/vendor/picocolors/types.d.ts +0 -51
  109. package/examples/react-compiler/vendor/react-compiler/LICENSE +0 -21
  110. package/examples/react-compiler/vendor/stubs/babel-core.ts +0 -31
  111. package/examples/react-compiler/vendor/stubs/debug.ts +0 -18
  112. package/examples/react-compiler/vendor/stubs/js-tokens.d.ts +0 -13
  113. package/examples/react-compiler/vendor/stubs/pretty-format.ts +0 -18
  114. package/examples/react-compiler/vendor/zod/LICENSE +0 -21
  115. package/examples/react-compiler/vendor/zod-validation-error/LICENSE +0 -9
  116. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/NonEmptyArray.ts +0 -5
  117. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/joinPath.ts +0 -49
  118. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/joinValues.ts +0 -48
  119. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/stringify.ts +0 -50
  120. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/titleCase.ts +0 -6
  121. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/MessageBuilder.ts +0 -126
  122. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/ValidationError.ts +0 -39
  123. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/custom.ts +0 -12
  124. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/errorMap.ts +0 -78
  125. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/index.ts +0 -2
  126. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidElement.ts +0 -12
  127. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidKey.ts +0 -12
  128. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidStringFormat.ts +0 -131
  129. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidType.ts +0 -54
  130. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidUnion.ts +0 -12
  131. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidValue.ts +0 -40
  132. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/notMultipleOf.ts +0 -12
  133. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/tooBig.ts +0 -76
  134. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/tooSmall.ts +0 -76
  135. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/types.ts +0 -27
  136. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/unrecognizedKeys.ts +0 -27
  137. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromError.ts +0 -13
  138. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromZodError.ts +0 -61
  139. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromZodIssue.ts +0 -38
  140. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/index.ts +0 -20
  141. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isValidationError.ts +0 -5
  142. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isValidationErrorLike.ts +0 -8
  143. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isZodErrorLike.ts +0 -11
  144. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/toValidationError.ts +0 -20
  145. package/examples/react-compiler/vendor.mjs +0 -688
  146. package/examples/todo-cli/README.md +0 -69
  147. package/examples/todo-cli/bench.mjs +0 -89
  148. package/examples/todo-cli/main.ts +0 -92
  149. package/examples/yaml-cli/README.md +0 -152
  150. package/examples/yaml-cli/bench.mjs +0 -265
  151. package/examples/yaml-cli/main.ts +0 -251
  152. package/examples/yaml-cli/parity.mjs +0 -156
  153. package/examples/yaml-cli/vendor/yaml/LICENSE +0 -13
  154. package/examples/yaml-cli/vendor/yaml/VENDOR.md +0 -25
  155. package/performance/README.md +0 -248
  156. package/performance/any-dynamic.ts +0 -21
  157. package/performance/any-record-view.ts +0 -20
  158. package/performance/arr-for-of.ts +0 -29
  159. package/performance/arr-hof.ts +0 -21
  160. package/performance/arr-push-index.ts +0 -15
  161. package/performance/arr-push-local.ts +0 -39
  162. package/performance/arr-slice-concat.ts +0 -24
  163. package/performance/arr-sort.ts +0 -21
  164. package/performance/async-await.ts +0 -24
  165. package/performance/async-promise-all.ts +0 -38
  166. package/performance/bigint-arith.ts +0 -36
  167. package/performance/buf-encode.ts +0 -29
  168. package/performance/class-accessors.ts +0 -48
  169. package/performance/class-dispatch.ts +0 -52
  170. package/performance/date-format.ts +0 -18
  171. package/performance/events-emit.ts +0 -27
  172. package/performance/exc-throw-rare.ts +0 -25
  173. package/performance/exc-try-catch.ts +0 -26
  174. package/performance/fn-closures.ts +0 -29
  175. package/performance/fn-recursion-tree.ts +0 -31
  176. package/performance/fn-rest-spread.ts +0 -43
  177. package/performance/gen-for-of.ts +0 -46
  178. package/performance/gen-next.ts +0 -32
  179. package/performance/iter-helpers.ts +0 -38
  180. package/performance/json-any.ts +0 -30
  181. package/performance/json-roundtrip.ts +0 -27
  182. package/performance/map-delete.ts +0 -24
  183. package/performance/map-iterate.ts +0 -26
  184. package/performance/map-number-keys.ts +0 -37
  185. package/performance/map-string-keys.ts +0 -22
  186. package/performance/num-arith-loop.ts +0 -14
  187. package/performance/num-bitwise.ts +0 -21
  188. package/performance/num-hash-imul.ts +0 -36
  189. package/performance/num-mod-int.ts +0 -16
  190. package/performance/num-to-string.ts +0 -16
  191. package/performance/obj-alloc.ts +0 -32
  192. package/performance/obj-keys-entries.ts +0 -44
  193. package/performance/obj-optional-chain.ts +0 -42
  194. package/performance/obj-record-dict.ts +0 -24
  195. package/performance/obj-spread-destructure.ts +0 -40
  196. package/performance/regex-exec.ts +0 -29
  197. package/performance/regex-replace-fn.ts +0 -24
  198. package/performance/regex-site.ts +0 -28
  199. package/performance/set-ops.ts +0 -20
  200. package/performance/str-char-scan.ts +0 -35
  201. package/performance/str-concat-plus.ts +0 -18
  202. package/performance/str-concat.ts +0 -24
  203. package/performance/str-methods.ts +0 -24
  204. package/performance/str-short-scan.ts +0 -26
  205. package/performance/str-split-join.ts +0 -23
  206. package/performance/str-switch-compare.ts +0 -50
  207. package/performance/str-template.ts +0 -16
  208. package/performance/str-unicode.ts +0 -25
  209. package/performance/typed-array.ts +0 -30
  210. package/performance/union-switch.ts +0 -57
  211. package/performance/union-typeof.ts +0 -40
  212. package/performance/wasm-call.ts +0 -63
  213. package/tsparser/check.go +0 -158
  214. package/tsparser/go.mod +0 -14
  215. package/tsparser/go.sum +0 -22
  216. package/tsparser/main.go +0 -363
  217. package/tsparser/tsparser.exe +0 -4
@@ -13,6 +13,7 @@ interface Function {
13
13
  call(thisArg: any, ...argArray: any[]): any;
14
14
  /** `thisArg` is ignored for plain functions; the bound arguments are fixed */
15
15
  bind(thisArg: any, ...argArray: any[]): any;
16
+ [Symbol.metadata]: DecoratorMetadata | null;
16
17
  }
17
18
 
18
19
  // With strict, f.call / f.apply / f.bind are checked against f's signature
@@ -129,6 +130,9 @@ interface AsyncGenerator<T = any, TReturn = any, TNext = any> extends AsyncItera
129
130
  interface Disposable {
130
131
  [Symbol.dispose](): void;
131
132
  }
133
+ interface AsyncDisposable {
134
+ [Symbol.asyncDispose](): Promise<void>;
135
+ }
132
136
 
133
137
  // await unwraps one thenable layer at a time (TypeScript's own definition,
134
138
  // which the checker relates to T for generic T)
@@ -945,7 +949,7 @@ declare var Date: DateConstructor;
945
949
  // --- Promise (lowered to goroutines over channels) ---
946
950
 
947
951
  interface Promise<T> {
948
- then(onfulfilled?: (value: T) => any): void;
952
+ then<TResult = T>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>): Promise<TResult>;
949
953
  catch(onrejected?: (reason: any) => any): Promise<T>;
950
954
  finally(onfinally?: () => void): Promise<T>;
951
955
  }
@@ -1108,6 +1112,8 @@ interface SymbolConstructor {
1108
1112
  readonly toStringTag: unique symbol;
1109
1113
  /** A class's static [Symbol.hasInstance](x) decides x instanceof C */
1110
1114
  readonly hasInstance: unique symbol;
1115
+ /** Class decorator metadata key (C[Symbol.metadata]) */
1116
+ readonly metadata: unique symbol;
1111
1117
  for(key: string): symbol;
1112
1118
  keyFor(sym: symbol): string | undefined;
1113
1119
  }
@@ -1118,12 +1124,26 @@ interface Symbol {
1118
1124
  readonly description: string;
1119
1125
  }
1120
1126
 
1121
- // --- Decorators (class and class-method decorators are lowered) ---
1127
+ // --- Decorators (TC39 Stage 3 class, method, getter, setter, field, and accessor decorators) ---
1128
+
1129
+ type DecoratorMetadataObject = Record<PropertyKey, unknown> & object;
1130
+
1131
+ type DecoratorMetadata = typeof globalThis extends { Symbol: { readonly metadata: symbol } } ? DecoratorMetadataObject : DecoratorMetadataObject | undefined;
1132
+
1133
+ type ClassMemberDecoratorContext =
1134
+ | ClassMethodDecoratorContext
1135
+ | ClassGetterDecoratorContext
1136
+ | ClassSetterDecoratorContext
1137
+ | ClassFieldDecoratorContext
1138
+ | ClassAccessorDecoratorContext;
1139
+
1140
+ type DecoratorContext = ClassDecoratorContext | ClassMemberDecoratorContext;
1122
1141
 
1123
1142
  interface ClassDecoratorContext<Class extends abstract new (...args: any) => any = abstract new (...args: any) => any> {
1124
1143
  readonly kind: 'class';
1125
1144
  readonly name: string | undefined;
1126
1145
  addInitializer(initializer: (this: Class) => void): void;
1146
+ readonly metadata: DecoratorMetadata;
1127
1147
  }
1128
1148
 
1129
1149
  interface ClassMethodDecoratorContext<
@@ -1139,6 +1159,72 @@ interface ClassMethodDecoratorContext<
1139
1159
  get(object: This): Value;
1140
1160
  };
1141
1161
  addInitializer(initializer: (this: This) => void): void;
1162
+ readonly metadata: DecoratorMetadata;
1163
+ }
1164
+
1165
+ interface ClassGetterDecoratorContext<This = unknown, Value = unknown> {
1166
+ readonly kind: 'getter';
1167
+ readonly name: string | symbol;
1168
+ readonly static: boolean;
1169
+ readonly private: boolean;
1170
+ readonly access: {
1171
+ has(object: This): boolean;
1172
+ get(object: This): Value;
1173
+ };
1174
+ addInitializer(initializer: (this: This) => void): void;
1175
+ readonly metadata: DecoratorMetadata;
1176
+ }
1177
+
1178
+ interface ClassSetterDecoratorContext<This = unknown, Value = unknown> {
1179
+ readonly kind: 'setter';
1180
+ readonly name: string | symbol;
1181
+ readonly static: boolean;
1182
+ readonly private: boolean;
1183
+ readonly access: {
1184
+ has(object: This): boolean;
1185
+ set(object: This, value: Value): void;
1186
+ };
1187
+ addInitializer(initializer: (this: This) => void): void;
1188
+ readonly metadata: DecoratorMetadata;
1189
+ }
1190
+
1191
+ interface ClassAccessorDecoratorContext<This = unknown, Value = unknown> {
1192
+ readonly kind: 'accessor';
1193
+ readonly name: string | symbol;
1194
+ readonly static: boolean;
1195
+ readonly private: boolean;
1196
+ readonly access: {
1197
+ has(object: This): boolean;
1198
+ get(object: This): Value;
1199
+ set(object: This, value: Value): void;
1200
+ };
1201
+ addInitializer(initializer: (this: This) => void): void;
1202
+ readonly metadata: DecoratorMetadata;
1203
+ }
1204
+
1205
+ interface ClassAccessorDecoratorTarget<This, Value> {
1206
+ get(this: This): Value;
1207
+ set(this: This, value: Value): void;
1208
+ }
1209
+
1210
+ interface ClassAccessorDecoratorResult<This, Value> {
1211
+ get?(this: This): Value;
1212
+ set?(this: This, value: Value): void;
1213
+ init?(this: This, value: Value): Value;
1214
+ }
1215
+
1216
+ interface ClassFieldDecoratorContext<This = unknown, Value = unknown> {
1217
+ readonly kind: 'field';
1218
+ readonly name: string | symbol;
1219
+ readonly static: boolean;
1220
+ readonly private: boolean;
1221
+ readonly access: {
1222
+ has(object: This): boolean;
1223
+ get(object: This): Value;
1224
+ set(object: This, value: Value): void;
1225
+ };
1226
+ addInitializer(initializer: (this: This) => void): void;
1227
+ readonly metadata: DecoratorMetadata;
1142
1228
  }
1143
1229
 
1144
1230
  // bigint values (*big.Int): toString(radix)
package/.gitattributes DELETED
@@ -1 +0,0 @@
1
- govendor/** linguist-vendored
@@ -1,68 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- pull_request:
6
-
7
- jobs:
8
- # Every probe through the Node CLI, on each OS a generated binary can target
9
- conformance:
10
- strategy:
11
- fail-fast: false
12
- matrix:
13
- os: [ubuntu-latest, windows-latest, macos-latest]
14
- runs-on: ${{ matrix.os }}
15
- steps:
16
- - uses: actions/checkout@v4
17
-
18
- - uses: actions/setup-node@v4
19
- with:
20
- node-version: 26
21
- cache: npm
22
-
23
- - uses: actions/setup-go@v5
24
- with:
25
- go-version: '1.26'
26
- cache-dependency-path: tsparser/go.sum
27
-
28
- - run: npm ci
29
-
30
- - run: npm run build
31
-
32
- - run: npm ci
33
- working-directory: conformance
34
-
35
- - run: npm run check:go-types
36
-
37
- - run: npm run conformance:parallel
38
-
39
- # The self-hosted compiler: same probes, and it must reproduce its own Go
40
- native:
41
- runs-on: ubuntu-latest
42
- # Normally ~5–8 min (the self-compile is ~2); fail fast if a probe runs away
43
- timeout-minutes: 25
44
- steps:
45
- - uses: actions/checkout@v4
46
-
47
- - uses: actions/setup-node@v4
48
- with:
49
- node-version: 26
50
- cache: npm
51
-
52
- - uses: actions/setup-go@v5
53
- with:
54
- go-version: '1.26'
55
- cache-dependency-path: tsparser/go.sum
56
-
57
- - run: npm ci
58
-
59
- - run: npm run build
60
-
61
- - run: npm ci
62
- working-directory: conformance
63
-
64
- - run: npm run build:native
65
-
66
- - run: npm run bootstrap:check
67
-
68
- - run: node scripts/conformance-parallel.mjs --native
@@ -1,88 +0,0 @@
1
- # Triggered by tags matching "TypeNative_{version}" (e.g. TypeNative_0.0.18)
2
- # Runs tests, creates a GitHub release, and publishes to npm.
3
- #
4
- # Uses npm Trusted Publishing (OIDC) — no NPM_TOKEN secret needed.
5
- # One-time setup on npmjs.com:
6
- # typenative package page → Settings → Publishing access → Trusted Publisher → Connect GitHub
7
- # - Organization or user: danisss9
8
- # - Repository: typenative
9
- # - Workflow filename: npm-publish-github-packages.yml
10
- # - Environment name: (leave blank)
11
- # Requires npm >= 11.5.1 (ensured below) and the `id-token: write` permission.
12
-
13
- name: Release & Publish
14
-
15
- on:
16
- push:
17
- tags:
18
- - 'TypeNative_*'
19
-
20
- jobs:
21
- test:
22
- runs-on: ubuntu-latest
23
- steps:
24
- - uses: actions/checkout@v4
25
- - uses: actions/setup-node@v4
26
- with:
27
- node-version: 26
28
- - uses: actions/setup-go@v5
29
- with:
30
- go-version: '1.26'
31
- - run: npm ci
32
- # Test what gets published: bin/ rebuilt from src/, not the committed copy
33
- - run: npm run build
34
- - run: npm ci
35
- working-directory: conformance
36
- - run: npm run conformance:parallel
37
-
38
- release:
39
- needs: test
40
- runs-on: ubuntu-latest
41
- permissions:
42
- contents: write
43
- steps:
44
- - uses: actions/checkout@v4
45
-
46
- - name: Extract version from tag
47
- id: version
48
- run: echo "VERSION=${GITHUB_REF_NAME#TypeNative_}" >> $GITHUB_OUTPUT
49
-
50
- - name: Create GitHub Release
51
- uses: softprops/action-gh-release@v2
52
- with:
53
- name: TypeNative v${{ steps.version.outputs.VERSION }}
54
- tag_name: ${{ github.ref_name }}
55
- generate_release_notes: true
56
-
57
- publish-npm:
58
- needs: test
59
- runs-on: ubuntu-latest
60
- permissions:
61
- id-token: write # required for npm Trusted Publishing (OIDC)
62
- contents: read
63
- steps:
64
- - uses: actions/checkout@v4
65
-
66
- - uses: actions/setup-node@v4
67
- with:
68
- node-version: 26
69
- registry-url: https://registry.npmjs.org/
70
-
71
- # Trusted Publishing (OIDC) requires npm >= 11.5.1 — ensure we have it
72
- - run: npm install -g npm@latest
73
-
74
- - name: Extract version from tag
75
- id: version
76
- run: echo "VERSION=${GITHUB_REF_NAME#TypeNative_}" >> $GITHUB_OUTPUT
77
-
78
- - name: Sync package.json version to tag
79
- run: npm version ${{ steps.version.outputs.VERSION }} --no-git-tag-version --allow-same-version
80
-
81
- - run: npm ci
82
-
83
- # Publish bin/ built from this commit (prebuild also stamps the tag's version)
84
- - run: npm run build
85
-
86
- # Authenticates via OIDC (id-token: write) — no NODE_AUTH_TOKEN needed.
87
- # Provenance is included automatically; the flag is kept for explicitness.
88
- - run: npm publish --provenance --access public