brustjs 0.1.10-alpha → 0.1.12-alpha

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.
@@ -4,6 +4,9 @@
4
4
  * client doesn't need.
5
5
  */
6
6
 
7
+ // BrustActionError is kept for backward compatibility with tests/fixtures/app
8
+ // (AvatarUpload.tsx, NoteForm.tsx, WhoAmI.tsx) until Task M1 migrates those
9
+ // usages to the new treaty client.
7
10
  export class BrustActionError extends Error {
8
11
  constructor(
9
12
  message: string,
@@ -15,107 +18,5 @@ export class BrustActionError extends Error {
15
18
  }
16
19
  }
17
20
 
18
- /** Untyped server-fn shape used as the generic constraint. The client never
19
- * sees BrustRequest, so we type the leading req as `any` here — the helper
20
- * strips it from the call site via DropReq<F>. */
21
- export type ServerFn = (req: any, ...args: any[]) => Promise<any>
22
-
23
- /** Drop the leading `req` arg from F's parameter list. */
24
- type DropReq<F> = F extends (req: any, ...args: infer A) => infer R ? (...args: A) => R : never
25
-
26
- /** Build a typed RPC stub for an action.
27
- *
28
- * Usage:
29
- * import type * as srv from '../actions'
30
- * const createNote = action<typeof srv.createNote>('createNote')
31
- * const { id } = await createNote('hello') // typed Promise<{ id: string }>
32
- *
33
- * @param id The action id — matches the named export from a `'use server'`
34
- * file discovered by `brust.scanActions()`. Use `withMiddleware`
35
- * to attach per-action middleware on the server side.
36
- */
37
- export function action<F extends ServerFn>(id: string): DropReq<F> {
38
- return (async (...args: unknown[]) => {
39
- const res = await fetch(`/_brust/action/${encodeURIComponent(id)}`, {
40
- method: 'POST',
41
- headers: { 'Content-Type': 'application/json' },
42
- body: JSON.stringify(args),
43
- })
44
- const text = await res.text()
45
- if (!res.ok) {
46
- const parsed = safeParse(text)
47
- const message =
48
- parsed &&
49
- typeof parsed === 'object' &&
50
- parsed !== null &&
51
- 'error' in parsed &&
52
- parsed.error &&
53
- typeof parsed.error === 'object' &&
54
- 'message' in parsed.error &&
55
- typeof parsed.error.message === 'string'
56
- ? parsed.error.message
57
- : text || 'action failed'
58
- throw new BrustActionError(message, res.status, parsed ?? text)
59
- }
60
- return text ? JSON.parse(text) : undefined
61
- }) as DropReq<F>
62
- }
63
-
64
- function safeParse(s: string): unknown | null {
65
- try {
66
- return JSON.parse(s)
67
- } catch {
68
- return null
69
- }
70
- }
71
-
72
- type FormActionFn<F> = F extends (req: any, fd: FormData) => infer R ? (fd: FormData) => R : never
73
-
74
- /** Build a typed RPC stub for a form-receiving action.
75
- *
76
- * The server handler MUST be declared with signature
77
- * `(req: BrustRequest, fd: FormData) => Promise<R>`. The framework parses
78
- * the request's multipart or form-urlencoded body server-side and passes
79
- * a FormData instance to the handler.
80
- *
81
- * Usage:
82
- * import type * as srv from '../actions'
83
- * const uploadAvatar = formAction<typeof srv.uploadAvatar>('uploadAvatar')
84
- * const result = await uploadAvatar(new FormData(form))
85
- *
86
- * @param id The action id — matches the named export from a `'use server'`
87
- * file discovered by `brust.scanActions()`.
88
- */
89
- export function formAction<F extends (req: any, fd: FormData) => unknown>(
90
- id: string,
91
- ): FormActionFn<F> {
92
- return (async (fd: FormData) => {
93
- if (!(fd instanceof FormData)) {
94
- throw new TypeError('formAction expects a FormData argument')
95
- }
96
- // DO NOT set Content-Type manually. fetch() auto-sets
97
- // 'multipart/form-data; boundary=<random>' when body is a FormData;
98
- // overriding loses the boundary and the server can't parse the body.
99
- const res = await fetch(`/_brust/action/${encodeURIComponent(id)}`, {
100
- method: 'POST',
101
- body: fd,
102
- })
103
- const text = await res.text()
104
- if (!res.ok) {
105
- const parsed = safeParse(text)
106
- const message =
107
- parsed &&
108
- typeof parsed === 'object' &&
109
- parsed !== null &&
110
- 'error' in parsed &&
111
- parsed.error &&
112
- typeof parsed.error === 'object' &&
113
- 'message' in parsed.error &&
114
- typeof parsed.error.message === 'string'
115
- ? parsed.error.message
116
- : text || 'action failed'
117
- throw new BrustActionError(message, res.status, parsed ?? text)
118
- }
119
- return text ? JSON.parse(text) : undefined
120
- }) as FormActionFn<F>
121
- }
21
+ export { client } from '../treaty.ts'
22
+ export type { TreatyResponse, ClientOptions } from '../treaty.ts'
@@ -0,0 +1,179 @@
1
+ import type { BrustRequest, Middleware } from './routes.ts'
2
+ import type { StandardSchemaV1, InferOutput } from './standard-schema.ts'
3
+
4
+ const RESPOND = Symbol('brust.respond')
5
+ export interface ActionResponseSentinel {
6
+ readonly [RESPOND]: true
7
+ status: number
8
+ body: unknown
9
+ headers?: Record<string, string>
10
+ }
11
+ export function isRespondSentinel(v: unknown): v is ActionResponseSentinel {
12
+ return typeof v === 'object' && v !== null && (v as Record<symbol, unknown>)[RESPOND] === true
13
+ }
14
+ export function makeRespond() {
15
+ return (
16
+ body: unknown,
17
+ init?: { status?: number; headers?: Record<string, string> },
18
+ ): ActionResponseSentinel => ({
19
+ [RESPOND]: true,
20
+ status: init?.status ?? 200,
21
+ body,
22
+ headers: init?.headers,
23
+ })
24
+ }
25
+
26
+ export interface ActionContext<
27
+ Body = unknown,
28
+ Params = Record<string, string>,
29
+ Query = Record<string, string>,
30
+ > {
31
+ req: BrustRequest
32
+ body: Body
33
+ params: Params
34
+ query: Query
35
+ headers: Record<string, string>
36
+ respond: (
37
+ body: unknown,
38
+ init?: { status?: number; headers?: Record<string, string> },
39
+ ) => ActionResponseSentinel
40
+ }
41
+ type Handler<B, P, Q, R> = (ctx: ActionContext<B, P, Q>) => R | Promise<R>
42
+
43
+ export interface EndpointOptions {
44
+ body?: StandardSchemaV1
45
+ query?: StandardSchemaV1
46
+ middleware?: Middleware[]
47
+ /** Build-time MCP tool description (read by the manifest extractor). */
48
+ description?: string
49
+ }
50
+ export interface EndpointDef {
51
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD'
52
+ path: string
53
+ handler: (ctx: ActionContext) => unknown
54
+ body?: StandardSchemaV1
55
+ query?: StandardSchemaV1
56
+ middleware: Middleware[]
57
+ }
58
+
59
+ type ParamKeys<P extends string> = P extends `${string}{${infer K}}${infer Rest}`
60
+ ? (K extends `*${infer C}` ? C : K) | ParamKeys<Rest>
61
+ : never
62
+ type Params<P extends string> = [ParamKeys<P>] extends [never]
63
+ ? Record<string, string>
64
+ : { [K in ParamKeys<P>]: string }
65
+ type BodyOf<O> = O extends { body: infer S }
66
+ ? S extends StandardSchemaV1
67
+ ? InferOutput<S>
68
+ : unknown
69
+ : unknown
70
+ type QueryOf<O> = O extends { query: infer S }
71
+ ? S extends StandardSchemaV1
72
+ ? InferOutput<S>
73
+ : unknown
74
+ : Record<string, string>
75
+
76
+ export type EndpointEntry = { input: unknown; output: unknown }
77
+ export type EndpointMap = Record<string, Partial<Record<EndpointDef['method'], EndpointEntry>>>
78
+
79
+ export function isValidEndpointPath(p: string): boolean {
80
+ return typeof p === 'string' && p.length > 0 && p.startsWith('/') && !/[\s?#]/.test(p)
81
+ }
82
+
83
+ // biome-ignore lint/complexity/noBannedTypes: `{}` is the intersection identity for `Acc & {...}` endpoint-type accumulation; Record<string,never> would poison the intersection
84
+ export interface ActionsBuilder<Acc extends EndpointMap = {}> {
85
+ endpoints: EndpointDef[]
86
+ use(mw: Middleware): ActionsBuilder<Acc>
87
+ get<P extends string, O extends EndpointOptions, R>(
88
+ path: P,
89
+ handler: Handler<BodyOf<O>, Params<P>, QueryOf<O>, R>,
90
+ opts?: O,
91
+ ): ActionsBuilder<Acc & { [K in P]: { GET: { input: QueryOf<O>; output: Awaited<R> } } }>
92
+ post<P extends string, O extends EndpointOptions, R>(
93
+ path: P,
94
+ handler: Handler<BodyOf<O>, Params<P>, QueryOf<O>, R>,
95
+ opts?: O,
96
+ ): ActionsBuilder<Acc & { [K in P]: { POST: { input: BodyOf<O>; output: Awaited<R> } } }>
97
+ put<P extends string, O extends EndpointOptions, R>(
98
+ path: P,
99
+ handler: Handler<BodyOf<O>, Params<P>, QueryOf<O>, R>,
100
+ opts?: O,
101
+ ): ActionsBuilder<Acc & { [K in P]: { PUT: { input: BodyOf<O>; output: Awaited<R> } } }>
102
+ patch<P extends string, O extends EndpointOptions, R>(
103
+ path: P,
104
+ handler: Handler<BodyOf<O>, Params<P>, QueryOf<O>, R>,
105
+ opts?: O,
106
+ ): ActionsBuilder<Acc & { [K in P]: { PATCH: { input: BodyOf<O>; output: Awaited<R> } } }>
107
+ delete<P extends string, O extends EndpointOptions, R>(
108
+ path: P,
109
+ handler: Handler<BodyOf<O>, Params<P>, QueryOf<O>, R>,
110
+ opts?: O,
111
+ ): ActionsBuilder<Acc & { [K in P]: { DELETE: { input: BodyOf<O>; output: Awaited<R> } } }>
112
+ head<P extends string, O extends EndpointOptions, R>(
113
+ path: P,
114
+ handler: Handler<BodyOf<O>, Params<P>, QueryOf<O>, R>,
115
+ opts?: O,
116
+ ): ActionsBuilder<Acc & { [K in P]: { HEAD: { input: QueryOf<O>; output: Awaited<R> } } }>
117
+ }
118
+
119
+ export function defineActions(): ActionsBuilder {
120
+ const endpoints: EndpointDef[] = []
121
+ const globalMw: Middleware[] = []
122
+ const seen = new Set<string>()
123
+ function add(
124
+ method: EndpointDef['method'],
125
+ path: string,
126
+ handler: (c: ActionContext) => unknown,
127
+ opts?: EndpointOptions,
128
+ ) {
129
+ if (!isValidEndpointPath(path))
130
+ throw new Error(
131
+ `defineActions: invalid endpoint path ${JSON.stringify(path)} (must start with '/', no whitespace/?#)`,
132
+ )
133
+ const key = `${method} ${path}`
134
+ if (seen.has(key)) throw new Error(`defineActions: duplicate endpoint ${key}`)
135
+ seen.add(key)
136
+ endpoints.push({
137
+ method,
138
+ path,
139
+ handler,
140
+ body: opts?.body,
141
+ query: opts?.query,
142
+ middleware: [...globalMw, ...(opts?.middleware ?? [])],
143
+ })
144
+ }
145
+ const builder = {
146
+ endpoints,
147
+ use(mw: Middleware) {
148
+ globalMw.push(mw)
149
+ return builder
150
+ },
151
+ get(p: string, h: any, o?: EndpointOptions) {
152
+ add('GET', p, h, o)
153
+ return builder
154
+ },
155
+ post(p: string, h: any, o?: EndpointOptions) {
156
+ add('POST', p, h, o)
157
+ return builder
158
+ },
159
+ put(p: string, h: any, o?: EndpointOptions) {
160
+ add('PUT', p, h, o)
161
+ return builder
162
+ },
163
+ patch(p: string, h: any, o?: EndpointOptions) {
164
+ add('PATCH', p, h, o)
165
+ return builder
166
+ },
167
+ delete(p: string, h: any, o?: EndpointOptions) {
168
+ add('DELETE', p, h, o)
169
+ return builder
170
+ },
171
+ head(p: string, h: any, o?: EndpointOptions) {
172
+ add('HEAD', p, h, o)
173
+ return builder
174
+ },
175
+ }
176
+ return builder as unknown as ActionsBuilder
177
+ }
178
+
179
+ export { RESPOND }
@@ -22,6 +22,12 @@ export declare function configureDevMode(enabled: boolean): void
22
22
 
23
23
  export declare function configureIslandsDir(path: string): NapiResult<undefined>
24
24
 
25
+ /** Per-endpoint registration descriptor passed to `register_actions`. */
26
+ export interface EndpointReg {
27
+ method: string
28
+ path: string
29
+ }
30
+
25
31
  export declare function islandCacheClear(): void
26
32
 
27
33
  export declare function islandCacheGet(key: string): CachedIslandJs | null
@@ -213,12 +219,10 @@ export declare function napiWsSend(connId: bigint, data: Buffer, isBinary: boole
213
219
  export declare function napiWsSignalOpen(connId: bigint, status: number, body: Buffer, contentType: string, subprotocol: string): NapiResult<undefined>
214
220
 
215
221
  /**
216
- * Register the set of action ids that Rust will accept on
217
- * /_brust/action/<id>. Called once at boot from the main thread.
218
- * Validates charset and rejects duplicates. Replaces any previous set
219
- * (no incremental registration in MVP — register once at boot).
222
+ * Register action endpoints. Replaces any previous router state.
223
+ * Returns the number of endpoints registered.
220
224
  */
221
- export declare function registerActions(ids: Array<string>): NapiResult<number>
225
+ export declare function registerActions(endpoints: Array<EndpointReg>): NapiResult<number>
222
226
 
223
227
  export declare function registerRenderer(buf: Uint8Array, f: (arg: number | string) => Promise<number>): NapiResult<number>
224
228
 
@@ -246,6 +250,8 @@ export interface ServeOptions {
246
250
  entry: string
247
251
  /** Optional performance tunables. Omit to keep framework defaults. */
248
252
  tuning?: ServeTuning
253
+ /** Optional action prefix override. Defaults to `/_brust/action`. */
254
+ actionPrefix?: string
249
255
  }
250
256
 
251
257
  /**
package/runtime/index.js CHANGED
@@ -77,8 +77,8 @@ function requireNative() {
77
77
  try {
78
78
  const binding = require('brustjs-android-arm64')
79
79
  const bindingPackageVersion = require('brustjs-android-arm64/package.json').version
80
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
82
  }
83
83
  return binding
84
84
  } catch (e) {
@@ -93,8 +93,8 @@ function requireNative() {
93
93
  try {
94
94
  const binding = require('brustjs-android-arm-eabi')
95
95
  const bindingPackageVersion = require('brustjs-android-arm-eabi/package.json').version
96
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
98
  }
99
99
  return binding
100
100
  } catch (e) {
@@ -114,8 +114,8 @@ function requireNative() {
114
114
  try {
115
115
  const binding = require('brustjs-win32-x64-gnu')
116
116
  const bindingPackageVersion = require('brustjs-win32-x64-gnu/package.json').version
117
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
117
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
119
  }
120
120
  return binding
121
121
  } catch (e) {
@@ -130,8 +130,8 @@ function requireNative() {
130
130
  try {
131
131
  const binding = require('brustjs-win32-x64-msvc')
132
132
  const bindingPackageVersion = require('brustjs-win32-x64-msvc/package.json').version
133
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
135
  }
136
136
  return binding
137
137
  } catch (e) {
@@ -147,8 +147,8 @@ function requireNative() {
147
147
  try {
148
148
  const binding = require('brustjs-win32-ia32-msvc')
149
149
  const bindingPackageVersion = require('brustjs-win32-ia32-msvc/package.json').version
150
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -163,8 +163,8 @@ function requireNative() {
163
163
  try {
164
164
  const binding = require('brustjs-win32-arm64-msvc')
165
165
  const bindingPackageVersion = require('brustjs-win32-arm64-msvc/package.json').version
166
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
168
  }
169
169
  return binding
170
170
  } catch (e) {
@@ -182,8 +182,8 @@ function requireNative() {
182
182
  try {
183
183
  const binding = require('brustjs-darwin-universal')
184
184
  const bindingPackageVersion = require('brustjs-darwin-universal/package.json').version
185
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
187
  }
188
188
  return binding
189
189
  } catch (e) {
@@ -198,8 +198,8 @@ function requireNative() {
198
198
  try {
199
199
  const binding = require('brustjs-darwin-x64')
200
200
  const bindingPackageVersion = require('brustjs-darwin-x64/package.json').version
201
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
203
  }
204
204
  return binding
205
205
  } catch (e) {
@@ -214,8 +214,8 @@ function requireNative() {
214
214
  try {
215
215
  const binding = require('brustjs-darwin-arm64')
216
216
  const bindingPackageVersion = require('brustjs-darwin-arm64/package.json').version
217
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
219
  }
220
220
  return binding
221
221
  } catch (e) {
@@ -234,8 +234,8 @@ function requireNative() {
234
234
  try {
235
235
  const binding = require('brustjs-freebsd-x64')
236
236
  const bindingPackageVersion = require('brustjs-freebsd-x64/package.json').version
237
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
239
  }
240
240
  return binding
241
241
  } catch (e) {
@@ -250,8 +250,8 @@ function requireNative() {
250
250
  try {
251
251
  const binding = require('brustjs-freebsd-arm64')
252
252
  const bindingPackageVersion = require('brustjs-freebsd-arm64/package.json').version
253
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
255
  }
256
256
  return binding
257
257
  } catch (e) {
@@ -271,8 +271,8 @@ function requireNative() {
271
271
  try {
272
272
  const binding = require('brustjs-linux-x64-musl')
273
273
  const bindingPackageVersion = require('brustjs-linux-x64-musl/package.json').version
274
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
276
  }
277
277
  return binding
278
278
  } catch (e) {
@@ -287,8 +287,8 @@ function requireNative() {
287
287
  try {
288
288
  const binding = require('brustjs-linux-x64-gnu')
289
289
  const bindingPackageVersion = require('brustjs-linux-x64-gnu/package.json').version
290
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
292
  }
293
293
  return binding
294
294
  } catch (e) {
@@ -305,8 +305,8 @@ function requireNative() {
305
305
  try {
306
306
  const binding = require('brustjs-linux-arm64-musl')
307
307
  const bindingPackageVersion = require('brustjs-linux-arm64-musl/package.json').version
308
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
310
  }
311
311
  return binding
312
312
  } catch (e) {
@@ -321,8 +321,8 @@ function requireNative() {
321
321
  try {
322
322
  const binding = require('brustjs-linux-arm64-gnu')
323
323
  const bindingPackageVersion = require('brustjs-linux-arm64-gnu/package.json').version
324
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
326
  }
327
327
  return binding
328
328
  } catch (e) {
@@ -339,8 +339,8 @@ function requireNative() {
339
339
  try {
340
340
  const binding = require('brustjs-linux-arm-musleabihf')
341
341
  const bindingPackageVersion = require('brustjs-linux-arm-musleabihf/package.json').version
342
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
344
  }
345
345
  return binding
346
346
  } catch (e) {
@@ -355,8 +355,8 @@ function requireNative() {
355
355
  try {
356
356
  const binding = require('brustjs-linux-arm-gnueabihf')
357
357
  const bindingPackageVersion = require('brustjs-linux-arm-gnueabihf/package.json').version
358
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
360
  }
361
361
  return binding
362
362
  } catch (e) {
@@ -373,8 +373,8 @@ function requireNative() {
373
373
  try {
374
374
  const binding = require('brustjs-linux-loong64-musl')
375
375
  const bindingPackageVersion = require('brustjs-linux-loong64-musl/package.json').version
376
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
378
  }
379
379
  return binding
380
380
  } catch (e) {
@@ -389,8 +389,8 @@ function requireNative() {
389
389
  try {
390
390
  const binding = require('brustjs-linux-loong64-gnu')
391
391
  const bindingPackageVersion = require('brustjs-linux-loong64-gnu/package.json').version
392
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
394
  }
395
395
  return binding
396
396
  } catch (e) {
@@ -407,8 +407,8 @@ function requireNative() {
407
407
  try {
408
408
  const binding = require('brustjs-linux-riscv64-musl')
409
409
  const bindingPackageVersion = require('brustjs-linux-riscv64-musl/package.json').version
410
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
412
  }
413
413
  return binding
414
414
  } catch (e) {
@@ -423,8 +423,8 @@ function requireNative() {
423
423
  try {
424
424
  const binding = require('brustjs-linux-riscv64-gnu')
425
425
  const bindingPackageVersion = require('brustjs-linux-riscv64-gnu/package.json').version
426
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
428
  }
429
429
  return binding
430
430
  } catch (e) {
@@ -440,8 +440,8 @@ function requireNative() {
440
440
  try {
441
441
  const binding = require('brustjs-linux-ppc64-gnu')
442
442
  const bindingPackageVersion = require('brustjs-linux-ppc64-gnu/package.json').version
443
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -456,8 +456,8 @@ function requireNative() {
456
456
  try {
457
457
  const binding = require('brustjs-linux-s390x-gnu')
458
458
  const bindingPackageVersion = require('brustjs-linux-s390x-gnu/package.json').version
459
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -476,8 +476,8 @@ function requireNative() {
476
476
  try {
477
477
  const binding = require('brustjs-openharmony-arm64')
478
478
  const bindingPackageVersion = require('brustjs-openharmony-arm64/package.json').version
479
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
481
  }
482
482
  return binding
483
483
  } catch (e) {
@@ -492,8 +492,8 @@ function requireNative() {
492
492
  try {
493
493
  const binding = require('brustjs-openharmony-x64')
494
494
  const bindingPackageVersion = require('brustjs-openharmony-x64/package.json').version
495
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
497
  }
498
498
  return binding
499
499
  } catch (e) {
@@ -508,8 +508,8 @@ function requireNative() {
508
508
  try {
509
509
  const binding = require('brustjs-openharmony-arm')
510
510
  const bindingPackageVersion = require('brustjs-openharmony-arm/package.json').version
511
- if (bindingPackageVersion !== '0.1.10-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
- throw new Error(`Native binding package version mismatch, expected 0.1.10-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '0.1.12-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
+ throw new Error(`Native binding package version mismatch, expected 0.1.12-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
513
  }
514
514
  return binding
515
515
  } catch (e) {