brustjs 0.1.38-alpha → 0.1.40-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.
- package/README.md +34 -0
- package/example/pokedex/components/ThemeToggle.tsx +11 -3
- package/package.json +16 -8
- package/runtime/cli/build.ts +123 -26
- package/runtime/cli/dev.ts +21 -0
- package/runtime/cli/help.ts +19 -0
- package/runtime/cli/jinja-staleness.ts +55 -7
- package/runtime/cli/native-routes-emit.ts +29 -7
- package/runtime/cli/ssg.ts +257 -0
- package/runtime/dev/coordinator.ts +16 -4
- package/runtime/dev/watcher.ts +16 -5
- package/runtime/index.js +52 -52
- package/runtime/index.ts +68 -3
- package/runtime/islands/bootstrap.ts +23 -0
- package/runtime/islands/build.ts +23 -1
- package/runtime/islands/native-render.ts +16 -3
- package/runtime/md/emit.ts +544 -0
- package/runtime/md/render.ts +469 -0
- package/runtime/md/routes.ts +347 -0
- package/runtime/md/scan.ts +175 -0
- package/runtime/native/build.ts +9 -1
- package/runtime/native/index.ts +4 -1
- package/runtime/native/runtime.ts +33 -2
- package/runtime/routes.ts +13 -0
- package/runtime/store/signal.ts +40 -3
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
// SSG route selection + static export. `collectStaticPaths` decides which
|
|
2
|
+
// flattened routes can be prerendered to static HTML and where each one lands
|
|
3
|
+
// on disk (pure, no fs access); `exportStatic` boots the just-built dist once,
|
|
4
|
+
// crawls the included routes, and writes the static site + assets.
|
|
5
|
+
|
|
6
|
+
import { existsSync } from 'node:fs'
|
|
7
|
+
import { cp, mkdir, rm } from 'node:fs/promises'
|
|
8
|
+
import { createServer } from 'node:net'
|
|
9
|
+
import { dirname, join } from 'node:path'
|
|
10
|
+
|
|
11
|
+
/** Structural subset of routes.ts FlatRoute that SSG selection needs. The
|
|
12
|
+
* `routes` array the app's routes module exports satisfies this (build.ts
|
|
13
|
+
* already imports it for CSS/native emit — no introspection endpoint). */
|
|
14
|
+
export interface FlatRouteLike {
|
|
15
|
+
/** Full path Rust matches against (e.g. '/', '/docs/intro', '/pokemon/{name}'). */
|
|
16
|
+
fullPath: string
|
|
17
|
+
/** Chain of Route nodes from root to leaf, inclusive. Only the LEAF node
|
|
18
|
+
* can carry sse/websocket (defineRoutes forbids children on those). */
|
|
19
|
+
chain: { sse?: unknown; websocket?: unknown }[]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface SsgRouteDecision {
|
|
23
|
+
/** Normalized fullPath (trailing slash stripped; '/' stays '/'). */
|
|
24
|
+
fullPath: string
|
|
25
|
+
include: boolean
|
|
26
|
+
reason?: 'dynamic-param' | 'wildcard' | 'sse' | 'websocket'
|
|
27
|
+
outFile: string // 'index.html' | 'docs/intro/index.html' …
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Strip trailing slashes ('/docs/intro/' → '/docs/intro'); root stays '/'. */
|
|
31
|
+
function normalizePath(p: string): string {
|
|
32
|
+
let s = p.startsWith('/') ? p : `/${p}`
|
|
33
|
+
while (s.length > 1 && s.endsWith('/')) s = s.slice(0, -1)
|
|
34
|
+
return s
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** '/' → 'index.html'; '/docs/intro' → 'docs/intro/index.html'. Input must be
|
|
38
|
+
* normalized (no trailing slash). */
|
|
39
|
+
function outFileFor(normalized: string): string {
|
|
40
|
+
if (normalized === '/') return 'index.html'
|
|
41
|
+
return `${normalized.slice(1)}/index.html`
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Decide, for every flattened route, whether it can be statically prerendered
|
|
45
|
+
* and which file it maps to. Deterministic: trailing-slash duplicates collapse
|
|
46
|
+
* to one decision (first occurrence wins) and output is sorted by fullPath. */
|
|
47
|
+
export function collectStaticPaths(flatRoutes: FlatRouteLike[]): SsgRouteDecision[] {
|
|
48
|
+
const seen = new Set<string>()
|
|
49
|
+
const decisions: SsgRouteDecision[] = []
|
|
50
|
+
|
|
51
|
+
for (const route of flatRoutes) {
|
|
52
|
+
const fullPath = normalizePath(route.fullPath)
|
|
53
|
+
if (seen.has(fullPath)) continue
|
|
54
|
+
seen.add(fullPath)
|
|
55
|
+
|
|
56
|
+
const leaf = route.chain[route.chain.length - 1]
|
|
57
|
+
let reason: SsgRouteDecision['reason']
|
|
58
|
+
if (/\{[^/]*\}/.test(fullPath)) {
|
|
59
|
+
reason = 'dynamic-param'
|
|
60
|
+
} else if (fullPath.includes('*')) {
|
|
61
|
+
reason = 'wildcard'
|
|
62
|
+
} else if (leaf?.sse != null) {
|
|
63
|
+
reason = 'sse'
|
|
64
|
+
} else if (leaf?.websocket != null) {
|
|
65
|
+
reason = 'websocket'
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const decision: SsgRouteDecision = {
|
|
69
|
+
fullPath,
|
|
70
|
+
include: reason === undefined,
|
|
71
|
+
outFile: outFileFor(fullPath),
|
|
72
|
+
}
|
|
73
|
+
if (reason !== undefined) decision.reason = reason
|
|
74
|
+
decisions.push(decision)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
decisions.sort((a, b) => (a.fullPath < b.fullPath ? -1 : a.fullPath > b.fullPath ? 1 : 0))
|
|
78
|
+
return decisions
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ----- static export -----
|
|
82
|
+
|
|
83
|
+
const READY_LINE = '[brust] listening on' // println! in brust-core server/mod.rs
|
|
84
|
+
const READY_TIMEOUT_MS = 30_000
|
|
85
|
+
const CRAWL_CONCURRENCY = 4
|
|
86
|
+
/** Grace period after SIGINT before escalating to SIGKILL — an orphaned server
|
|
87
|
+
* breaks later port-sensitive tests/builds. */
|
|
88
|
+
const KILL_GRACE_MS = 5_000
|
|
89
|
+
|
|
90
|
+
/** Bind-then-release an ephemeral port (same pattern as the integration suite —
|
|
91
|
+
* deliberately copied, tests/ must not be imported from runtime/). */
|
|
92
|
+
async function freePort(): Promise<number> {
|
|
93
|
+
return await new Promise((resolve, reject) => {
|
|
94
|
+
const srv = createServer()
|
|
95
|
+
srv.unref()
|
|
96
|
+
srv.on('error', reject)
|
|
97
|
+
srv.listen(0, '127.0.0.1', () => {
|
|
98
|
+
const p = (srv.address() as import('node:net').AddressInfo).port
|
|
99
|
+
srv.close(() => resolve(p))
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Read the child's stdout until the brust listening line appears (30s cap).
|
|
105
|
+
* Captures stdout AND stderr into `capture` so a boot failure surfaces the
|
|
106
|
+
* child's own output. After readiness both pipes keep draining in the
|
|
107
|
+
* background — a full pipe would block the child mid-crawl. */
|
|
108
|
+
async function waitForListening(
|
|
109
|
+
proc: ReturnType<typeof Bun.spawn>,
|
|
110
|
+
capture: { stdout: string; stderr: string },
|
|
111
|
+
): Promise<void> {
|
|
112
|
+
const dec = new TextDecoder()
|
|
113
|
+
|
|
114
|
+
const stderr = proc.stderr as ReadableStream<Uint8Array> | undefined
|
|
115
|
+
if (stderr) {
|
|
116
|
+
void (async () => {
|
|
117
|
+
try {
|
|
118
|
+
for await (const chunk of stderr) capture.stderr += dec.decode(chunk, { stream: true })
|
|
119
|
+
} catch {
|
|
120
|
+
/* child killed mid-read */
|
|
121
|
+
}
|
|
122
|
+
})()
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const reader = (proc.stdout as ReadableStream<Uint8Array>).getReader()
|
|
126
|
+
const ready = (async () => {
|
|
127
|
+
while (true) {
|
|
128
|
+
const { value, done } = await reader.read()
|
|
129
|
+
if (done) throw new Error('server exited before printing the listening line')
|
|
130
|
+
capture.stdout += dec.decode(value, { stream: true })
|
|
131
|
+
if (capture.stdout.includes(READY_LINE)) return
|
|
132
|
+
}
|
|
133
|
+
})()
|
|
134
|
+
ready.catch(() => {}) // if the timeout wins the race, don't leave an unhandled rejection
|
|
135
|
+
|
|
136
|
+
let timer: ReturnType<typeof setTimeout> | undefined
|
|
137
|
+
const timeout = new Promise<never>((_, reject) => {
|
|
138
|
+
timer = setTimeout(
|
|
139
|
+
() => reject(new Error(`server not ready within ${READY_TIMEOUT_MS}ms`)),
|
|
140
|
+
READY_TIMEOUT_MS,
|
|
141
|
+
)
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
try {
|
|
145
|
+
await Promise.race([ready, timeout])
|
|
146
|
+
} catch (err) {
|
|
147
|
+
throw new Error(
|
|
148
|
+
`${(err as Error).message}\n--- child stdout ---\n${capture.stdout}\n--- child stderr ---\n${capture.stderr}`,
|
|
149
|
+
)
|
|
150
|
+
} finally {
|
|
151
|
+
clearTimeout(timer)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
void (async () => {
|
|
155
|
+
try {
|
|
156
|
+
while (!(await reader.read()).done) {
|
|
157
|
+
/* discard — drain only */
|
|
158
|
+
}
|
|
159
|
+
} catch {
|
|
160
|
+
/* child killed mid-read */
|
|
161
|
+
}
|
|
162
|
+
})()
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Boot the just-built dist on a free port, crawl every included route, and
|
|
166
|
+
* write the static site to `staticOut` (clobbered first). ANY non-200 fails
|
|
167
|
+
* the whole export — the partial output is removed and the error rethrown.
|
|
168
|
+
* Asset copy preserves the live server's URL shape: islands + css under
|
|
169
|
+
* /_brust/, public/ root-mapped (runtime/index.ts configurePublicDir). */
|
|
170
|
+
export async function exportStatic(opts: {
|
|
171
|
+
distDir: string // the just-built outDir
|
|
172
|
+
entryDir: string // app dir (for public/)
|
|
173
|
+
staticOut: string // e.g. dist/static (clobbered first)
|
|
174
|
+
routes: SsgRouteDecision[]
|
|
175
|
+
}): Promise<{ written: string[]; skipped: SsgRouteDecision[] }> {
|
|
176
|
+
const { distDir, entryDir, staticOut, routes } = opts
|
|
177
|
+
const included = routes.filter((r) => r.include)
|
|
178
|
+
const skipped = routes.filter((r) => !r.include)
|
|
179
|
+
|
|
180
|
+
await rm(staticOut, { recursive: true, force: true })
|
|
181
|
+
await mkdir(staticOut, { recursive: true })
|
|
182
|
+
|
|
183
|
+
const written: string[] = []
|
|
184
|
+
if (included.length > 0) {
|
|
185
|
+
const port = await freePort()
|
|
186
|
+
const proc = Bun.spawn(['bun', join(distDir, 'index.js')], {
|
|
187
|
+
env: { ...process.env, BRUST_PORT: String(port), BRUST_WORKERS: '1' },
|
|
188
|
+
stdout: 'pipe',
|
|
189
|
+
stderr: 'pipe',
|
|
190
|
+
})
|
|
191
|
+
try {
|
|
192
|
+
await waitForListening(proc, { stdout: '', stderr: '' })
|
|
193
|
+
|
|
194
|
+
let next = 0
|
|
195
|
+
const crawlOne = async (d: SsgRouteDecision) => {
|
|
196
|
+
const resp = await fetch(`http://127.0.0.1:${port}${d.fullPath}`)
|
|
197
|
+
const body = await resp.text()
|
|
198
|
+
if (resp.status !== 200) {
|
|
199
|
+
throw new Error(`GET ${d.fullPath} → ${resp.status}\n${body.slice(0, 500)}`)
|
|
200
|
+
}
|
|
201
|
+
const outPath = join(staticOut, d.outFile)
|
|
202
|
+
await mkdir(dirname(outPath), { recursive: true })
|
|
203
|
+
await Bun.write(outPath, body)
|
|
204
|
+
written.push(d.outFile)
|
|
205
|
+
}
|
|
206
|
+
const workers = Array.from(
|
|
207
|
+
{ length: Math.min(CRAWL_CONCURRENCY, included.length) },
|
|
208
|
+
async () => {
|
|
209
|
+
while (true) {
|
|
210
|
+
const i = next++
|
|
211
|
+
if (i >= included.length) return
|
|
212
|
+
await crawlOne(included[i])
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
)
|
|
216
|
+
// Let every worker settle BEFORE failing — an in-flight write racing the
|
|
217
|
+
// cleanup rm below would resurrect a partial staticOut.
|
|
218
|
+
const settled = await Promise.allSettled(workers)
|
|
219
|
+
const failed = settled.find((s): s is PromiseRejectedResult => s.status === 'rejected')
|
|
220
|
+
if (failed) throw failed.reason
|
|
221
|
+
} catch (err) {
|
|
222
|
+
// No partial site: a failed crawl removes everything it wrote.
|
|
223
|
+
await rm(staticOut, { recursive: true, force: true }).catch(() => {})
|
|
224
|
+
throw err
|
|
225
|
+
} finally {
|
|
226
|
+
// ALWAYS kill the child — an orphaned server breaks later port users.
|
|
227
|
+
// Bounded even past SIGKILL: a build tool must never hang on a child that
|
|
228
|
+
// a shell wrapper kept alive; CI timeouts are not a cleanup strategy.
|
|
229
|
+
proc.kill('SIGINT')
|
|
230
|
+
const hardKill = setTimeout(() => proc.kill('SIGKILL'), KILL_GRACE_MS)
|
|
231
|
+
const exited = await Promise.race([
|
|
232
|
+
proc.exited.then(() => true),
|
|
233
|
+
new Promise<false>((r) => setTimeout(() => r(false), KILL_GRACE_MS + 3_000)),
|
|
234
|
+
])
|
|
235
|
+
clearTimeout(hardKill)
|
|
236
|
+
if (!exited) {
|
|
237
|
+
console.warn('[brust build] ssg: dist server did not exit after SIGKILL — abandoning it')
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const islandsSrc = join(distDir, 'islands')
|
|
243
|
+
if (existsSync(islandsSrc)) {
|
|
244
|
+
await cp(islandsSrc, join(staticOut, '_brust', 'islands'), { recursive: true })
|
|
245
|
+
}
|
|
246
|
+
const cssSrc = join(distDir, 'css')
|
|
247
|
+
if (existsSync(cssSrc)) {
|
|
248
|
+
await cp(cssSrc, join(staticOut, '_brust', 'css'), { recursive: true })
|
|
249
|
+
}
|
|
250
|
+
const publicSrc = join(entryDir, 'public')
|
|
251
|
+
if (existsSync(publicSrc)) {
|
|
252
|
+
await cp(publicSrc, staticOut, { recursive: true })
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
written.sort()
|
|
256
|
+
return { written, skipped }
|
|
257
|
+
}
|
|
@@ -40,6 +40,12 @@ export class Coordinator {
|
|
|
40
40
|
case 'ts':
|
|
41
41
|
case 'html':
|
|
42
42
|
case 'islands':
|
|
43
|
+
// 'md' (task 2.9) takes the SAME full path as a .tsx edit: buildIslands
|
|
44
|
+
// (wired in index.ts) re-runs emitMdArtifacts — the md re-splice — and
|
|
45
|
+
// the worker restart is REQUIRED because loadIslandManifest caches
|
|
46
|
+
// per-isolate (islands/native-render.ts), so a re-emitted
|
|
47
|
+
// .islands.json sidecar is never re-read by a live worker.
|
|
48
|
+
case 'md':
|
|
43
49
|
// Stale frozen island renders must not survive a source edit.
|
|
44
50
|
this.deps.clearIslandCache?.()
|
|
45
51
|
// Rebuild island CLIENT chunks. The watcher classifies every `.tsx`
|
|
@@ -51,11 +57,15 @@ export class Coordinator {
|
|
|
51
57
|
// dev-server restart (the chunk on disk stays stale). buildIslands
|
|
52
58
|
// re-scans routes + re-bundles into the served `.brust/islands` dir.
|
|
53
59
|
await this.deps.buildIslands()
|
|
60
|
+
// Reload native-route templates BEFORE restarting the workers:
|
|
61
|
+
// napiLoadJinjaTemplates operates on the PROCESS-GLOBAL Rust
|
|
62
|
+
// minijinja env (it does not depend on the workers), so reloading
|
|
63
|
+
// first closes the stale-serve window where freshly spawned workers
|
|
64
|
+
// answer requests against the OLD jinja. The browser reload is
|
|
65
|
+
// broadcast last, after the new workers are up.
|
|
66
|
+
await this.deps.reEmitJinja()
|
|
54
67
|
await this.deps.workers.terminateAll()
|
|
55
68
|
await this.deps.workers.spawnAll()
|
|
56
|
-
// Reload native-route templates (process-global minijinja env — does
|
|
57
|
-
// not depend on the workers) just before telling the browser to reload.
|
|
58
|
-
await this.deps.reEmitJinja()
|
|
59
69
|
await this.deps.broadcast({ type: 'reload' })
|
|
60
70
|
break
|
|
61
71
|
case 'css':
|
|
@@ -108,7 +118,9 @@ function formatStart(ev: { paths: string[]; kind: ChangeKind }): string {
|
|
|
108
118
|
? 'component css update'
|
|
109
119
|
: ev.kind === 'islands'
|
|
110
120
|
? 'islands rebuild'
|
|
111
|
-
: '
|
|
121
|
+
: ev.kind === 'md'
|
|
122
|
+
? 'md update'
|
|
123
|
+
: 'hotreload'
|
|
112
124
|
return `${icon} ${label} ${ev.paths[0]}`
|
|
113
125
|
}
|
|
114
126
|
|
package/runtime/dev/watcher.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { watch, type FSWatcher } from 'node:fs'
|
|
2
2
|
import path from 'node:path'
|
|
3
3
|
|
|
4
|
-
export type ChangeKind = 'ts' | 'css' | 'component-css' | 'html' | 'islands'
|
|
4
|
+
export type ChangeKind = 'ts' | 'css' | 'component-css' | 'html' | 'islands' | 'md'
|
|
5
5
|
|
|
6
6
|
const IGNORE_DIR_SEGMENTS = new Set(['node_modules', '.git', '.brust', 'dist'])
|
|
7
7
|
const TS_RE = /\.(tsx?|jsx?)$/
|
|
8
8
|
const TEST_RE = /\.test\.(tsx?|jsx?)$/
|
|
9
9
|
|
|
10
10
|
/** Classify a changed path. Returns null when the path should be ignored.
|
|
11
|
-
* `root` is used to compute the relative path for ignore-segment matching.
|
|
12
|
-
|
|
11
|
+
* `root` is used to compute the relative path for ignore-segment matching.
|
|
12
|
+
* `hasMdRoutes` gates the `'md'` kind (S4): when the app has no md routes, a
|
|
13
|
+
* project `.md` edit (README.md, notes) must not trigger the full reload path
|
|
14
|
+
* (island rebuild + worker restart) — it classifies as null instead. Defaults
|
|
15
|
+
* to true for backward compatibility with callers that don't thread the flag. */
|
|
16
|
+
export function classifyPath(absPath: string, root: string, hasMdRoutes = true): ChangeKind | null {
|
|
13
17
|
const rel = path.relative(root, absPath)
|
|
14
18
|
const segs = rel.split(path.sep)
|
|
15
19
|
for (const s of segs) {
|
|
@@ -24,6 +28,10 @@ export function classifyPath(absPath: string, root: string): ChangeKind | null {
|
|
|
24
28
|
// any other .css (including .module.css) is component CSS
|
|
25
29
|
if (absPath.endsWith('.css')) return 'component-css'
|
|
26
30
|
if (absPath.endsWith('.html')) return 'html'
|
|
31
|
+
// md pages (task 2.9): a content edit re-splices the md templates and takes
|
|
32
|
+
// the full ts-edit reload path (worker restart — see coordinator). Only when
|
|
33
|
+
// the app actually has md routes — otherwise .md files are inert (null).
|
|
34
|
+
if (absPath.endsWith('.md')) return hasMdRoutes ? 'md' : null
|
|
27
35
|
if (TS_RE.test(absPath)) return 'ts'
|
|
28
36
|
return null
|
|
29
37
|
}
|
|
@@ -65,6 +73,9 @@ export function _testCoalesce(debounceMs: number, flush: (paths: string[]) => vo
|
|
|
65
73
|
export interface CreateWatcherOptions {
|
|
66
74
|
root: string
|
|
67
75
|
debounceMs?: number
|
|
76
|
+
/** Whether the app has md routes — gates `.md` classification (see
|
|
77
|
+
* classifyPath). Defaults to true (back-compat). */
|
|
78
|
+
hasMdRoutes?: boolean
|
|
68
79
|
onChange: (ev: { paths: string[]; kind: ChangeKind }) => void
|
|
69
80
|
}
|
|
70
81
|
|
|
@@ -78,13 +89,13 @@ export interface Watcher {
|
|
|
78
89
|
* that subsumes the others). */
|
|
79
90
|
export function createWatcher(opts: CreateWatcherOptions): Watcher {
|
|
80
91
|
const debounceMs = opts.debounceMs ?? 50
|
|
81
|
-
const kindPriority: ChangeKind[] = ['islands', 'ts', 'html', 'css', 'component-css']
|
|
92
|
+
const kindPriority: ChangeKind[] = ['islands', 'ts', 'md', 'html', 'css', 'component-css']
|
|
82
93
|
|
|
83
94
|
const coalesce = _testCoalesce(debounceMs, (paths) => {
|
|
84
95
|
const kinds = new Set<ChangeKind>()
|
|
85
96
|
const keep: string[] = []
|
|
86
97
|
for (const p of paths) {
|
|
87
|
-
const k = classifyPath(p, opts.root)
|
|
98
|
+
const k = classifyPath(p, opts.root, opts.hasMdRoutes ?? true)
|
|
88
99
|
if (k === null) continue
|
|
89
100
|
kinds.add(k)
|
|
90
101
|
keep.push(p)
|
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.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
80
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
96
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
117
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
133
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
150
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
166
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
185
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
201
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
217
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
237
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
253
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
274
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
290
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
308
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
324
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
342
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
358
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
376
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
392
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
410
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
426
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
443
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
459
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
479
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
495
|
+
if (bindingPackageVersion !== '0.1.40-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.40-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.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
511
|
+
if (bindingPackageVersion !== '0.1.40-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.40-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|