MCPcopy Index your code
hub / github.com/QwikDev/qwik / buildPlatformBinding

Function buildPlatformBinding

scripts/binding-platform.ts:7–49  ·  view source on GitHub ↗
(config: BuildConfig)

Source from the content-addressed store, hash-verified

5import { ensureDir, type BuildConfig } from './util.ts';
6
7export async function buildPlatformBinding(config: BuildConfig) {
8 await new Promise((resolve, reject) => {
9 try {
10 ensureDir(config.distQwikPkgDir);
11 ensureDir(config.distBindingsDir);
12
13 const cmd = `napi`;
14 const args = [
15 `build`,
16 `--cargo-name`,
17 'qwik_napi',
18 `--platform`,
19 `--config=packages/qwik/src/napi/napi.config.json`,
20 config.distBindingsDir,
21 ];
22
23 if (config.platformTarget) {
24 args.push(`--target`, config.platformTarget);
25 }
26 if (!config.dev) {
27 args.push(`--release`);
28 args.push(`--strip`);
29 }
30
31 const napiCwd = join(config.rootDir);
32
33 const child = spawn(cmd, args, { stdio: 'inherit', cwd: napiCwd });
34 child.on('error', reject);
35
36 child.on('close', (code) => {
37 if (code === 0) {
38 resolve(child.stdout);
39 } else {
40 reject(`napi exited with code ${code}`);
41 }
42 });
43 } catch (e) {
44 reject(e);
45 }
46 });
47
48 console.log('🐯 native binding');
49}
50
51// TODO only download current target and wasm
52export async function copyPlatformBindingWasm(config: BuildConfig) {

Callers 1

buildFunction · 0.90

Calls 4

ensureDirFunction · 0.90
joinFunction · 0.85
onMethod · 0.80
resolveFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…