@qvac/sdk 0.23.0 → 0.24.0
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/NOTICE +115 -58
- package/README.md +10 -13
- package/dist/examples/asr/parakeet-sortformer.js +24 -14
- package/dist/examples/asr/parakeet-transcribepsy-filesystem.js +40 -11
- package/dist/examples/asr/parakeet-unified-coreml.js +14 -9
- package/dist/examples/asr/whispercpp-prompt.js +9 -5
- package/dist/examples/assess-model-fit.d.ts +7 -9
- package/dist/examples/assess-model-fit.js +22 -43
- package/dist/examples/calc-tokens.d.ts +2 -0
- package/dist/examples/calc-tokens.js +21 -0
- package/dist/examples/classification/classify-image.js +11 -5
- package/dist/examples/completion-stop-reason.d.ts +3 -3
- package/dist/examples/completion-stop-reason.js +4 -4
- package/dist/examples/diffusion-flux3-klein.d.ts +2 -0
- package/dist/examples/diffusion-flux3-klein.js +102 -0
- package/dist/examples/diffusion-moss-image.d.ts +2 -0
- package/dist/examples/diffusion-moss-image.js +126 -0
- package/dist/examples/diffusion-qwen-image-21.js +15 -4
- package/dist/examples/embed-multimodal.d.ts +2 -0
- package/dist/examples/embed-multimodal.js +80 -0
- package/dist/examples/embed-p2p.js +2 -2
- package/dist/examples/image/megaloc.d.ts +2 -0
- package/dist/examples/image/megaloc.js +37 -0
- package/dist/examples/llamacpp-multimodal.js +18 -0
- package/dist/examples/rag/rag-hyperdb/pipeline.js +2 -2
- package/dist/examples/rag/rag-turbovec.js +2 -2
- package/dist/examples/sessions.d.ts +17 -0
- package/dist/examples/sessions.js +63 -0
- package/dist/examples/tools/llamacpp-deferred-tools.js +8 -4
- package/dist/scripts/check-resource-collectors-packaging.js +7 -6
- package/dist/scripts/contract/build-contract.d.ts +2 -1
- package/dist/scripts/contract/build-contract.js +13 -1
- package/dist/scripts/contract/constants-registry.d.ts +17 -0
- package/dist/scripts/contract/constants-registry.js +8 -2
- package/dist/scripts/contract/method-shapes.d.ts +4 -0
- package/dist/scripts/contract/method-shapes.js +4 -0
- package/dist/scripts/enforce-inference-versions.d.ts +1 -1
- package/dist/scripts/enforce-inference-versions.js +28 -18
- package/dist/scripts/generate-bare-kit-runtimes.js +101 -69
- package/dist/src/client/api/assess-model-fit.d.ts +17 -17
- package/dist/src/client/api/assess-model-fit.js +18 -31
- package/dist/src/client/api/audio-edit.d.ts +5 -3
- package/dist/src/client/api/audio-edit.js +5 -3
- package/dist/src/client/api/audio-gen-result.js +134 -45
- package/dist/src/client/api/audio-gen.d.ts +40 -3
- package/dist/src/client/api/audio-gen.js +40 -3
- package/dist/src/client/api/audio-understand.d.ts +2 -2
- package/dist/src/client/api/audio-understand.js +2 -2
- package/dist/src/client/api/batch-completion.js +2 -1
- package/dist/src/client/api/calc-tokens.d.ts +33 -0
- package/dist/src/client/api/calc-tokens.js +44 -0
- package/dist/src/client/api/cancel.d.ts +2 -2
- package/dist/src/client/api/cancel.js +2 -2
- package/dist/src/client/api/classify.d.ts +12 -5
- package/dist/src/client/api/classify.js +17 -5
- package/dist/src/client/api/client-request-id.d.ts +0 -15
- package/dist/src/client/api/client-request-id.js +15 -12
- package/dist/src/client/api/completion-stream.d.ts +8 -1
- package/dist/src/client/api/completion-stream.js +10 -1
- package/dist/src/client/api/delete-cache.d.ts +9 -2
- package/dist/src/client/api/delete-cache.js +13 -3
- package/dist/src/client/api/diffusion.d.ts +20 -4
- package/dist/src/client/api/diffusion.js +23 -5
- package/dist/src/client/api/embed.d.ts +82 -29
- package/dist/src/client/api/embed.js +64 -19
- package/dist/src/client/api/get-model-info.d.ts +2 -2
- package/dist/src/client/api/get-model-info.js +2 -2
- package/dist/src/client/api/get-system-resources.d.ts +2 -2
- package/dist/src/client/api/get-system-resources.js +2 -2
- package/dist/src/client/api/heartbeat.d.ts +3 -2
- package/dist/src/client/api/heartbeat.js +3 -2
- package/dist/src/client/api/index.d.ts +4 -3
- package/dist/src/client/api/index.js +2 -1
- package/dist/src/client/api/invoke-plugin.d.ts +8 -2
- package/dist/src/client/api/invoke-plugin.js +17 -2
- package/dist/src/client/api/load-model.js +5 -2
- package/dist/src/client/api/ocr.d.ts +5 -3
- package/dist/src/client/api/ocr.js +44 -21
- package/dist/src/client/api/rag.d.ts +1 -1
- package/dist/src/client/api/rag.js +1 -1
- package/dist/src/client/api/registry.d.ts +17 -7
- package/dist/src/client/api/registry.js +37 -12
- package/dist/src/client/api/resume.d.ts +2 -1
- package/dist/src/client/api/resume.js +2 -2
- package/dist/src/client/api/rpc-server.d.ts +4 -4
- package/dist/src/client/api/rpc-server.js +10 -10
- package/dist/src/client/api/state.d.ts +2 -2
- package/dist/src/client/api/state.js +2 -2
- package/dist/src/client/api/subscribe-logs.d.ts +2 -2
- package/dist/src/client/api/subscribe-logs.js +2 -2
- package/dist/src/client/api/suspend.d.ts +4 -2
- package/dist/src/client/api/suspend.js +4 -3
- package/dist/src/client/api/text-to-speech.d.ts +14 -5
- package/dist/src/client/api/text-to-speech.js +83 -29
- package/dist/src/client/api/transcribe.d.ts +6 -2
- package/dist/src/client/api/transcribe.js +7 -1
- package/dist/src/client/api/unload-model.d.ts +19 -7
- package/dist/src/client/api/unload-model.js +29 -11
- package/dist/src/client/api/upscale.d.ts +6 -3
- package/dist/src/client/api/upscale.js +9 -4
- package/dist/src/client/api/vector-index.d.ts +50 -16
- package/dist/src/client/api/vector-index.js +100 -48
- package/dist/src/client/api/video-request.d.ts +5 -5
- package/dist/src/client/api/video.d.ts +3 -2
- package/dist/src/client/api/video.js +3 -2
- package/dist/src/client/api/vla.d.ts +9 -5
- package/dist/src/client/api/vla.js +17 -8
- package/dist/src/client/api/world.d.ts +5 -5
- package/dist/src/client/api/world.js +4 -4
- package/dist/src/client/init-hooks.d.ts +6 -4
- package/dist/src/client/init-hooks.js +12 -15
- package/dist/src/client/logging-stream-registry.d.ts +6 -3
- package/dist/src/client/logging-stream-registry.js +31 -12
- package/dist/src/client/rpc/bundle-stamp.d.ts +29 -0
- package/dist/src/client/rpc/bundle-stamp.js +75 -0
- package/dist/src/client/rpc/expo-home-dir.d.ts +2 -0
- package/dist/src/client/rpc/expo-home-dir.js +4 -0
- package/dist/src/client/rpc/expo-rpc-client.js +189 -135
- package/dist/src/client/rpc/node-rpc-client.js +322 -413
- package/dist/src/client/rpc/pear-runtime.d.ts +12 -0
- package/dist/src/client/rpc/pear-runtime.js +12 -0
- package/dist/src/client/rpc/rpc-client.d.ts +5 -4
- package/dist/src/client/rpc/rpc-client.js +126 -23
- package/dist/src/client/rpc/rpc-error.js +21 -2
- package/dist/src/client/rpc/unbundled-harness.d.ts +16 -0
- package/dist/src/client/rpc/unbundled-harness.js +27 -0
- package/dist/src/client/rpc/worker-failure.d.ts +27 -0
- package/dist/src/client/rpc/worker-failure.js +61 -0
- package/dist/src/client/session-registry.d.ts +75 -0
- package/dist/src/client/session-registry.js +149 -0
- package/dist/src/client/session.d.ts +125 -0
- package/dist/src/client/session.js +148 -0
- package/dist/src/commands/bundle/addons.d.ts +14 -0
- package/dist/src/commands/bundle/addons.js +65 -0
- package/dist/src/commands/bundle/constants.js +1 -0
- package/dist/src/commands/bundle/entry-gen.d.ts +1 -5
- package/dist/src/commands/bundle/entry-gen.js +17 -50
- package/dist/src/commands/bundle/index.d.ts +59 -13
- package/dist/src/commands/bundle/index.js +345 -121
- package/dist/src/commands/bundle/link.d.ts +58 -0
- package/dist/src/commands/bundle/link.js +135 -0
- package/dist/src/commands/bundle/node-support.d.ts +13 -0
- package/dist/src/commands/bundle/node-support.js +23 -0
- package/dist/src/commands/bundle/read-bundle.d.ts +9 -0
- package/dist/src/commands/bundle/read-bundle.js +27 -0
- package/dist/src/commands/bundle/resolve-sdk-import.d.ts +6 -0
- package/dist/src/commands/bundle/resolve-sdk-import.js +24 -28
- package/dist/src/commands/bundle/scratch.d.ts +35 -0
- package/dist/src/commands/bundle/scratch.js +178 -0
- package/dist/src/commands/bundle/targets.d.ts +14 -0
- package/dist/src/commands/bundle/targets.js +37 -0
- package/dist/src/commands/host-prebuilds/index.d.ts +5 -4
- package/dist/src/commands/host-prebuilds/index.js +9 -7
- package/dist/src/commands/index.d.ts +4 -3
- package/dist/src/commands/verify/abi.d.ts +20 -14
- package/dist/src/commands/verify/abi.js +11 -79
- package/dist/src/commands/verify/bare-kit-runtime.d.ts +20 -22
- package/dist/src/commands/verify/bare-kit-runtime.js +102 -150
- package/dist/src/commands/verify/bare-kit-runtimes.d.ts +10 -9
- package/dist/src/commands/verify/bare-kit-runtimes.js +21 -21
- package/dist/src/commands/verify/bundle-source.js +25 -21
- package/dist/src/commands/verify/engines-advice.d.ts +2 -8
- package/dist/src/commands/verify/engines-advice.js +7 -54
- package/dist/src/commands/verify/index.d.ts +30 -29
- package/dist/src/commands/verify/index.js +92 -200
- package/dist/src/commands/verify/prebuilds.d.ts +3 -5
- package/dist/src/commands/verify/prebuilds.js +1 -2
- package/dist/src/commands/verify/resource-collectors.d.ts +0 -6
- package/dist/src/commands/verify/resource-collectors.js +1 -50
- package/dist/src/commands/verify/sidecar-runtime.d.ts +6 -0
- package/dist/src/commands/verify/sidecar-runtime.js +51 -0
- package/dist/src/expo/plugins/withBareKit.d.ts +59 -0
- package/dist/src/expo/plugins/withBareKit.js +204 -0
- package/dist/src/expo/plugins/withMobileBundle.d.ts +4 -11
- package/dist/src/expo/plugins/withMobileBundle.js +36 -57
- package/dist/src/expo/plugins/withQvacSDK.d.ts +1 -0
- package/dist/src/expo/plugins/withQvacSDK.js +3 -0
- package/dist/src/index.d.ts +6 -5
- package/dist/src/index.js +10 -14
- package/dist/src/logging/utils.js +10 -2
- package/dist/src/plugin-ids.d.ts +2 -1
- package/dist/src/plugin-ids.js +2 -0
- package/dist/src/schemas/public.d.ts +1 -1
- package/dist/src/schemas/public.js +1 -1
- package/dist/src/schemas/sdk-errors-client.d.ts +5 -6
- package/dist/src/schemas/sdk-errors-client.js +30 -36
- package/dist/src/schemas/sdk-errors-server.d.ts +11 -1
- package/dist/src/schemas/sdk-errors-server.js +60 -2
- package/dist/src/server/rpc/rpc-utils.d.ts +25 -4
- package/dist/src/server/rpc/rpc-utils.js +39 -5
- package/dist/src/utils/errors-client.d.ts +37 -29
- package/dist/src/utils/errors-client.js +50 -41
- package/dist/src/utils/errors-server.d.ts +59 -1
- package/dist/src/utils/errors-server.js +110 -1
- package/dist/src/utils/withTimeout.js +34 -17
- package/dist/src/worker/handle-request.js +25 -22
- package/dist/src/worker/handler-utils.d.ts +2 -6
- package/dist/src/worker/handler-utils.js +2 -20
- package/dist/src/worker/index.d.ts +2 -4
- package/dist/src/worker/index.js +23 -35
- package/dist/src/worker/plugins/ggml-image-embedding.d.ts +2 -0
- package/dist/src/worker/plugins/ggml-image-embedding.js +1 -0
- package/dist/src/worker/shim.d.ts +4 -0
- package/dist/src/worker/shim.js +7 -0
- package/dist/src/worker/start.d.ts +9 -0
- package/dist/src/worker/start.js +16 -0
- package/dist/src/worker/unbundled-shim.d.ts +2 -0
- package/dist/src/worker/unbundled-shim.js +4 -0
- package/docs/system-resources-support-matrix.md +27 -19
- package/package.json +62 -51
- package/src/electron-forge/index.cjs +65 -91
- package/dist/examples/model-fit-ui/server.d.ts +0 -24
- package/dist/examples/model-fit-ui/server.js +0 -221
- package/dist/src/client/rpc/ensure-worker-ready.d.ts +0 -9
- package/dist/src/client/rpc/ensure-worker-ready.js +0 -17
- package/dist/src/client/rpc/init-timeout.d.ts +0 -26
- package/dist/src/client/rpc/init-timeout.js +0 -25
- package/dist/src/client/rpc/ipc-socket-path.d.ts +0 -11
- package/dist/src/client/rpc/ipc-socket-path.js +0 -30
- package/dist/src/client/rpc/worker-startup-error.d.ts +0 -12
- package/dist/src/client/rpc/worker-startup-error.js +0 -13
- package/dist/src/commands/bundle/bare-pack.d.ts +0 -21
- package/dist/src/commands/bundle/bare-pack.js +0 -77
- package/dist/src/commands/bundle/manifest.d.ts +0 -25
- package/dist/src/commands/bundle/manifest.js +0 -192
- package/dist/src/expo/plugins/link-addons.d.ts +0 -18
- package/dist/src/expo/plugins/link-addons.js +0 -65
- package/dist/src/pear/pre.d.ts +0 -21
- package/dist/src/pear/pre.js +0 -450
- package/dist/src/server/env.d.ts +0 -22
- package/dist/src/server/env.js +0 -59
- package/dist/src/server/utils/qvac-paths.d.ts +0 -2
- package/dist/src/server/utils/qvac-paths.js +0 -5
- package/dist/src/server/utils/worker-lock.d.ts +0 -3
- package/dist/src/server/utils/worker-lock.js +0 -67
- package/dist/src/worker/create-server.d.ts +0 -8
- package/dist/src/worker/create-server.js +0 -51
- package/dist/src/worker/lifecycle.d.ts +0 -23
- package/dist/src/worker/lifecycle.js +0 -149
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
import { promises as fsp } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { resolveConfigFileInProject, loadConfigFromPath } from '../../client/config-loader/resolve-config.node.js';
|
|
4
3
|
import { createCollectDiagnostics, formatAddonId } from '../../commands/verify/addon-source.js';
|
|
5
4
|
import { collectAddonsFromBundle, InvalidBundleSourceError } from '../../commands/verify/bundle-source.js';
|
|
6
5
|
import { collectAddonsFromNodeModules, InvalidNodeModulesSourceError } from '../../commands/verify/node-modules-source.js';
|
|
7
|
-
import { checkPrebuilds
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { checkPrebuilds } from '../../commands/verify/prebuilds.js';
|
|
7
|
+
import { resolvePearRuntime, resolveSidecarRuntime } from '../../commands/verify/sidecar-runtime.js';
|
|
8
|
+
import { checkAbi } from '../../commands/verify/abi.js';
|
|
9
|
+
import { BARE_KIT_PLATFORMS, bareKitPlatformOf, resolveBareKitRuntime } from '../../commands/verify/bare-kit-runtime.js';
|
|
10
10
|
import { buildEnginesAdvice, formatEnginesAdvice } from '../../commands/verify/engines-advice.js';
|
|
11
|
+
import { bundleTargetOf } from '../../client/rpc/bundle-stamp.js';
|
|
12
|
+
import { isBundleTarget } from '../../commands/bundle/targets.js';
|
|
13
|
+
/** The Bare that each target runs a bundle on for desktop hosts. */
|
|
14
|
+
export const DESKTOP_RUNTIMES = {
|
|
15
|
+
'bare-sidecar': 'bare-sidecar',
|
|
16
|
+
'react-native': 'bare-sidecar',
|
|
17
|
+
'pear-runtime': 'pear-runtime',
|
|
18
|
+
'bare-kit': 'bare-kit-kotlin'
|
|
19
|
+
};
|
|
11
20
|
export async function verifyBundle(options) {
|
|
12
|
-
const { projectRoot, addonsSource, hosts
|
|
21
|
+
const { projectRoot, addonsSource, hosts } = options;
|
|
13
22
|
const resolvedAddonsSource = path.isAbsolute(addonsSource)
|
|
14
23
|
? addonsSource
|
|
15
24
|
: path.resolve(projectRoot, addonsSource);
|
|
@@ -19,8 +28,9 @@ export async function verifyBundle(options) {
|
|
|
19
28
|
resolvedAddonsSource,
|
|
20
29
|
sourceKind: null,
|
|
21
30
|
hosts,
|
|
22
|
-
|
|
31
|
+
runtimes: [],
|
|
23
32
|
addons: [],
|
|
33
|
+
advice: [],
|
|
24
34
|
issues: [
|
|
25
35
|
{
|
|
26
36
|
code: 'invalid-source',
|
|
@@ -31,75 +41,6 @@ export async function verifyBundle(options) {
|
|
|
31
41
|
]
|
|
32
42
|
};
|
|
33
43
|
}
|
|
34
|
-
let invalidRuntimeVersion = null;
|
|
35
|
-
if (bareRuntimeVersion !== undefined && normalizeVersion(bareRuntimeVersion) === null) {
|
|
36
|
-
invalidRuntimeVersion = {
|
|
37
|
-
code: 'invalid-runtime-version',
|
|
38
|
-
level: 'error',
|
|
39
|
-
providedValue: bareRuntimeVersion,
|
|
40
|
-
source: 'flag',
|
|
41
|
-
message: `bareRuntimeVersion "${bareRuntimeVersion}" is not a valid semver. ` +
|
|
42
|
-
'Use a version like 1.15.0 (with optional v-prefix and pre-release tag) or omit it to use auto-detection.'
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
let configRuntimeVersion;
|
|
46
|
-
let resolvedConfigPath = null;
|
|
47
|
-
let configLoadFailed = null;
|
|
48
|
-
try {
|
|
49
|
-
resolvedConfigPath = await resolveConfigFileInProject(projectRoot, configPath ?? undefined);
|
|
50
|
-
if (resolvedConfigPath !== null) {
|
|
51
|
-
const config = await loadConfigFromPath(resolvedConfigPath);
|
|
52
|
-
if (typeof config.bareRuntimeVersion === 'string') {
|
|
53
|
-
configRuntimeVersion = config.bareRuntimeVersion;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
59
|
-
if (configPath !== undefined) {
|
|
60
|
-
return {
|
|
61
|
-
addonsSource,
|
|
62
|
-
resolvedAddonsSource,
|
|
63
|
-
sourceKind: null,
|
|
64
|
-
hosts,
|
|
65
|
-
runtime: null,
|
|
66
|
-
addons: [],
|
|
67
|
-
issues: [
|
|
68
|
-
{
|
|
69
|
-
code: 'invalid-source',
|
|
70
|
-
level: 'error',
|
|
71
|
-
addonsSource,
|
|
72
|
-
message: `Failed to load config from '${configPath}': ${message}`
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
if (resolvedConfigPath !== null) {
|
|
78
|
-
configLoadFailed = {
|
|
79
|
-
code: 'config-load-failed',
|
|
80
|
-
level: 'warning',
|
|
81
|
-
configPath: resolvedConfigPath,
|
|
82
|
-
reason: message,
|
|
83
|
-
message: `Found ${formatConfigLabel(projectRoot, resolvedConfigPath)} but failed to load it: ${message}. ` +
|
|
84
|
-
'Falling back to auto-detection for Bare runtime; the project-pinned ' +
|
|
85
|
-
'`bareRuntimeVersion` is being ignored. Fix the config file or pass `configPath` explicitly to surface it as an error.'
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
if (invalidRuntimeVersion === null &&
|
|
90
|
-
bareRuntimeVersion === undefined &&
|
|
91
|
-
configRuntimeVersion !== undefined &&
|
|
92
|
-
normalizeVersion(configRuntimeVersion) === null) {
|
|
93
|
-
invalidRuntimeVersion = {
|
|
94
|
-
code: 'invalid-runtime-version',
|
|
95
|
-
level: 'error',
|
|
96
|
-
providedValue: configRuntimeVersion,
|
|
97
|
-
source: 'config',
|
|
98
|
-
message: `\`bareRuntimeVersion\` in ${formatConfigLabel(projectRoot, resolvedConfigPath ?? undefined)} ` +
|
|
99
|
-
`"${configRuntimeVersion}" is not a valid semver. ` +
|
|
100
|
-
'Use a version like 1.15.0 (with optional v-prefix and pre-release tag), or remove the field to use auto-detection.'
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
44
|
const sourceKind = await detectSourceKind(resolvedAddonsSource);
|
|
104
45
|
if (sourceKind === null) {
|
|
105
46
|
return {
|
|
@@ -107,8 +48,9 @@ export async function verifyBundle(options) {
|
|
|
107
48
|
resolvedAddonsSource,
|
|
108
49
|
sourceKind: null,
|
|
109
50
|
hosts,
|
|
110
|
-
|
|
51
|
+
runtimes: [],
|
|
111
52
|
addons: [],
|
|
53
|
+
advice: [],
|
|
112
54
|
issues: [
|
|
113
55
|
{
|
|
114
56
|
code: 'invalid-source',
|
|
@@ -147,8 +89,9 @@ export async function verifyBundle(options) {
|
|
|
147
89
|
resolvedAddonsSource,
|
|
148
90
|
sourceKind,
|
|
149
91
|
hosts,
|
|
150
|
-
|
|
92
|
+
runtimes: [],
|
|
151
93
|
addons: [],
|
|
94
|
+
advice: [],
|
|
152
95
|
issues: [
|
|
153
96
|
{
|
|
154
97
|
code: 'invalid-source',
|
|
@@ -162,10 +105,6 @@ export async function verifyBundle(options) {
|
|
|
162
105
|
throw error;
|
|
163
106
|
}
|
|
164
107
|
const issues = [];
|
|
165
|
-
if (configLoadFailed !== null)
|
|
166
|
-
issues.push(configLoadFailed);
|
|
167
|
-
if (invalidRuntimeVersion !== null)
|
|
168
|
-
issues.push(invalidRuntimeVersion);
|
|
169
108
|
issues.push(...buildInvalidPackageJsonIssues(diagnostics.invalidPackageJsons));
|
|
170
109
|
if (sourceKind === 'bare-pack-bundle' && diagnostics.emptyResolutions) {
|
|
171
110
|
issues.push({
|
|
@@ -182,71 +121,86 @@ export async function verifyBundle(options) {
|
|
|
182
121
|
const prebuildIssues = await checkPrebuilds({ addon, hosts });
|
|
183
122
|
issues.push(...prebuildIssues);
|
|
184
123
|
}
|
|
185
|
-
|
|
186
|
-
|
|
124
|
+
const desktopRuntime = options.desktopRuntime ??
|
|
125
|
+
(sourceKind === 'bare-pack-bundle' ? stampedDesktopRuntime(resolvedAddonsSource) : undefined);
|
|
126
|
+
const runtimes = [];
|
|
187
127
|
const advice = [];
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
128
|
+
const malformed = new Set();
|
|
129
|
+
const platformOf = (host) => bareKitPlatformOf(host) ?? (desktopRuntime === 'bare-kit-kotlin' ? 'android' : null);
|
|
130
|
+
for (const platform of BARE_KIT_PLATFORMS) {
|
|
131
|
+
const platformHosts = hosts.filter((host) => platformOf(host) === platform);
|
|
132
|
+
if (platformHosts.length === 0)
|
|
133
|
+
continue;
|
|
134
|
+
const resolution = await resolveBareKitRuntime({
|
|
135
|
+
platform,
|
|
195
136
|
projectRoot,
|
|
196
|
-
|
|
197
|
-
explicit,
|
|
137
|
+
bareStowDir: options.bareStowDir,
|
|
198
138
|
network: options.network,
|
|
199
139
|
onProgress: options.onProgress,
|
|
200
140
|
fetchText: options.fetchText
|
|
201
141
|
});
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
if (seen.has(issue.message))
|
|
212
|
-
return false;
|
|
213
|
-
seen.add(issue.message);
|
|
142
|
+
runtimes.push({ platform, hosts: platformHosts, resolution });
|
|
143
|
+
const abiIssues = checkAbi({
|
|
144
|
+
addons: addonsLinkedOn(addons, platformHosts),
|
|
145
|
+
runtime: resolution,
|
|
146
|
+
packages: enginesPackages(diagnostics.packages),
|
|
147
|
+
hosts: platformHosts
|
|
148
|
+
}).filter((issue) => {
|
|
149
|
+
// A malformed range is a property of the package, so it is reported once.
|
|
150
|
+
if (issue.code !== 'malformed-engines-bare')
|
|
214
151
|
return true;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
152
|
+
if (malformed.has(issue.message))
|
|
153
|
+
return false;
|
|
154
|
+
malformed.add(issue.message);
|
|
155
|
+
return true;
|
|
156
|
+
});
|
|
157
|
+
issues.push(...abiIssues);
|
|
158
|
+
const failures = abiIssues.flatMap((issue) => issue.code === 'abi-mismatch' || issue.code === 'engines-mismatch'
|
|
159
|
+
? [
|
|
160
|
+
failureOf(issue.code === 'abi-mismatch' ? issue.addon : issue.package, issue.enginesBare)
|
|
161
|
+
]
|
|
162
|
+
: []);
|
|
163
|
+
if (failures.length > 0 && resolution.resolved) {
|
|
164
|
+
advice.push(await buildEnginesAdvice({
|
|
165
|
+
projectRoot,
|
|
166
|
+
hosts: platformHosts,
|
|
167
|
+
runtime: resolution.runtime,
|
|
168
|
+
failures,
|
|
169
|
+
packages: diagnostics.packages,
|
|
170
|
+
network: options.network,
|
|
171
|
+
onProgress: options.onProgress,
|
|
172
|
+
fetchPackageMetadata: options.fetchPackageMetadata
|
|
173
|
+
}));
|
|
234
174
|
}
|
|
235
175
|
}
|
|
236
|
-
const
|
|
176
|
+
const desktopHosts = hosts.filter((host) => platformOf(host) === null);
|
|
177
|
+
if (desktopHosts.length > 0) {
|
|
178
|
+
const resolution = desktopRuntime === 'pear-runtime'
|
|
179
|
+
? resolvePearRuntime(projectRoot)
|
|
180
|
+
: resolveSidecarRuntime(projectRoot);
|
|
181
|
+
runtimes.push({ platform: 'desktop', hosts: desktopHosts, resolution });
|
|
182
|
+
issues.push(...checkAbi({
|
|
183
|
+
addons: addonsLinkedOn(addons, desktopHosts),
|
|
184
|
+
runtime: resolution,
|
|
185
|
+
packages: enginesPackages(diagnostics.packages),
|
|
186
|
+
hosts: desktopHosts
|
|
187
|
+
}).filter((issue) => issue.code !== 'malformed-engines-bare' || !malformed.has(issue.message)));
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
237
190
|
addonsSource,
|
|
238
191
|
resolvedAddonsSource,
|
|
239
192
|
sourceKind,
|
|
240
193
|
hosts,
|
|
241
|
-
|
|
194
|
+
runtimes,
|
|
242
195
|
addons,
|
|
243
|
-
issues
|
|
196
|
+
issues,
|
|
197
|
+
advice
|
|
244
198
|
};
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
return
|
|
199
|
+
}
|
|
200
|
+
/** The desktop runtime of the target `bundleSdk` recorded in the harness package of a bundle. */
|
|
201
|
+
function stampedDesktopRuntime(bundlePath) {
|
|
202
|
+
const target = bundleTargetOf(bundlePath);
|
|
203
|
+
return target !== undefined && isBundleTarget(target) ? DESKTOP_RUNTIMES[target] : undefined;
|
|
250
204
|
}
|
|
251
205
|
/** `name@version` ids as built by `formatAddonId`; scoped names keep their leading `@`. */
|
|
252
206
|
function failureOf(id, enginesBare) {
|
|
@@ -259,7 +213,7 @@ function failureOf(id, enginesBare) {
|
|
|
259
213
|
: { name: id.slice(0, at), version, enginesBare };
|
|
260
214
|
}
|
|
261
215
|
/**
|
|
262
|
-
* Addons
|
|
216
|
+
* Addons the given hosts load: those the bundle links on one of them.
|
|
263
217
|
* Without link information (`linkedHosts` unset), every addon counts, as in
|
|
264
218
|
* `checkPrebuilds`.
|
|
265
219
|
*/
|
|
@@ -281,47 +235,6 @@ function enginesPackages(records) {
|
|
|
281
235
|
}
|
|
282
236
|
return [...byId.values()];
|
|
283
237
|
}
|
|
284
|
-
/**
|
|
285
|
-
* Mobile hosts run the Bare build inside react-native-bare-kit; desktop hosts
|
|
286
|
-
* run `bare-runtime` (or `bare`). An explicit version applies to every host.
|
|
287
|
-
* Without react-native-bare-kit installed, mobile hosts fall back to the
|
|
288
|
-
* desktop detection so projects that only bundle for mobile keep a runtime.
|
|
289
|
-
*/
|
|
290
|
-
async function resolveRuntimeGroups(options) {
|
|
291
|
-
const { projectRoot, hosts, explicit } = options;
|
|
292
|
-
if (explicit !== null) {
|
|
293
|
-
return [
|
|
294
|
-
{
|
|
295
|
-
hosts,
|
|
296
|
-
resolution: await resolveBareRuntime({
|
|
297
|
-
projectRoot,
|
|
298
|
-
explicitVersion: explicit.version,
|
|
299
|
-
explicitSource: explicit.source
|
|
300
|
-
})
|
|
301
|
-
}
|
|
302
|
-
];
|
|
303
|
-
}
|
|
304
|
-
const mobileHosts = hosts.filter(isMobileHost);
|
|
305
|
-
const desktopHosts = hosts.filter((host) => !isMobileHost(host));
|
|
306
|
-
const groups = [];
|
|
307
|
-
if (mobileHosts.length > 0) {
|
|
308
|
-
groups.push({
|
|
309
|
-
hosts: mobileHosts,
|
|
310
|
-
resolution: isReactNativeBareKitInstalled(projectRoot)
|
|
311
|
-
? await resolveMobileBareRuntime({
|
|
312
|
-
projectRoot,
|
|
313
|
-
network: options.network,
|
|
314
|
-
onProgress: options.onProgress,
|
|
315
|
-
fetchText: options.fetchText
|
|
316
|
-
})
|
|
317
|
-
: await resolveBareRuntime({ projectRoot })
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
if (desktopHosts.length > 0) {
|
|
321
|
-
groups.push({ hosts: desktopHosts, resolution: await resolveBareRuntime({ projectRoot }) });
|
|
322
|
-
}
|
|
323
|
-
return groups;
|
|
324
|
-
}
|
|
325
238
|
function buildInvalidPackageJsonIssues(records) {
|
|
326
239
|
return records.map((record) => {
|
|
327
240
|
const issue = {
|
|
@@ -384,28 +297,15 @@ export function formatVerifyBundleResult(result) {
|
|
|
384
297
|
sections.push(...formatMissingPrebuilds(result.issues));
|
|
385
298
|
sections.push(...formatAbiMismatches(result.issues));
|
|
386
299
|
sections.push(...formatEnginesMismatches(result.issues));
|
|
387
|
-
for (const advice of result.advice
|
|
300
|
+
for (const advice of result.advice)
|
|
388
301
|
sections.push(...formatEnginesAdvice(advice));
|
|
389
|
-
sections.push(...formatInvalidRuntimeVersions(result.issues));
|
|
390
302
|
sections.push(...formatMalformedEnginesBare(result.issues));
|
|
391
|
-
sections.push(...formatConfigLoadFailed(result.issues));
|
|
392
303
|
sections.push(...formatInvalidPackageJsons(result.issues));
|
|
393
304
|
sections.push(...formatEmptyBundleResolutions(result.issues));
|
|
394
305
|
sections.push(...formatUnknownRuntime(result.issues));
|
|
395
306
|
sections.push(...formatInvalidSources(result.issues));
|
|
396
307
|
return sections.join('\n').trimEnd();
|
|
397
308
|
}
|
|
398
|
-
function formatConfigLoadFailed(issues) {
|
|
399
|
-
const matches = issues.filter((issue) => issue.code === 'config-load-failed');
|
|
400
|
-
if (matches.length === 0)
|
|
401
|
-
return [];
|
|
402
|
-
const lines = [' Config load failed:'];
|
|
403
|
-
for (const issue of matches) {
|
|
404
|
-
lines.push(` - ${issue.message}`);
|
|
405
|
-
}
|
|
406
|
-
lines.push('');
|
|
407
|
-
return lines;
|
|
408
|
-
}
|
|
409
309
|
function formatMissingPrebuilds(issues) {
|
|
410
310
|
const matches = issues.filter((issue) => issue.code === 'missing-prebuild');
|
|
411
311
|
if (matches.length === 0)
|
|
@@ -426,7 +326,7 @@ function formatAbiMismatches(issues) {
|
|
|
426
326
|
const lines = [' ABI mismatch:'];
|
|
427
327
|
for (const issue of matches) {
|
|
428
328
|
lines.push(` - ${issue.addon} requires bare ${issue.enginesBare}, ` +
|
|
429
|
-
`runtime is ${issue.runtimeVersion}`);
|
|
329
|
+
`runtime is ${issue.runtimeVersion}${onHosts(issue.hosts)}`);
|
|
430
330
|
}
|
|
431
331
|
lines.push('');
|
|
432
332
|
return lines;
|
|
@@ -438,11 +338,14 @@ function formatEnginesMismatches(issues) {
|
|
|
438
338
|
const lines = [' engines.bare mismatch:'];
|
|
439
339
|
for (const issue of matches) {
|
|
440
340
|
lines.push(` - ${issue.package} requires bare ${issue.enginesBare}, ` +
|
|
441
|
-
`runtime is ${issue.runtimeVersion}`);
|
|
341
|
+
`runtime is ${issue.runtimeVersion}${onHosts(issue.hosts)}`);
|
|
442
342
|
}
|
|
443
343
|
lines.push('');
|
|
444
344
|
return lines;
|
|
445
345
|
}
|
|
346
|
+
function onHosts(hosts) {
|
|
347
|
+
return hosts === undefined ? '' : ` on ${hosts.join(', ')}`;
|
|
348
|
+
}
|
|
446
349
|
function formatUnknownRuntime(issues) {
|
|
447
350
|
const matches = issues.filter((issue) => issue.code === 'unknown-runtime-version');
|
|
448
351
|
if (matches.length === 0)
|
|
@@ -476,17 +379,6 @@ function formatInvalidSources(issues) {
|
|
|
476
379
|
lines.push('');
|
|
477
380
|
return lines;
|
|
478
381
|
}
|
|
479
|
-
function formatInvalidRuntimeVersions(issues) {
|
|
480
|
-
const matches = issues.filter((issue) => issue.code === 'invalid-runtime-version');
|
|
481
|
-
if (matches.length === 0)
|
|
482
|
-
return [];
|
|
483
|
-
const lines = [' Invalid Bare runtime version:'];
|
|
484
|
-
for (const issue of matches) {
|
|
485
|
-
lines.push(` - ${issue.message}`);
|
|
486
|
-
}
|
|
487
|
-
lines.push('');
|
|
488
|
-
return lines;
|
|
489
|
-
}
|
|
490
382
|
function formatInvalidPackageJsons(issues) {
|
|
491
383
|
const matches = issues.filter((issue) => issue.code === 'invalid-package-json');
|
|
492
384
|
if (matches.length === 0)
|
|
@@ -7,11 +7,9 @@ export interface MissingPrebuildIssue {
|
|
|
7
7
|
message: string;
|
|
8
8
|
packageRoot: string;
|
|
9
9
|
/**
|
|
10
|
-
* The per-platform package to declare for this
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* Never set for desktop hosts, whose platform packages install as the
|
|
14
|
-
* addon's os/cpu-filtered optionalDependencies.
|
|
10
|
+
* The per-platform package to declare for this host, at the exact version
|
|
11
|
+
* it must be installed at. Set when the addon's `#host-addon` map names one
|
|
12
|
+
* and it is either not installed or installed at another version.
|
|
15
13
|
*/
|
|
16
14
|
platformPackage?: PlatformPackagePin;
|
|
17
15
|
}
|
|
@@ -87,8 +87,7 @@ export async function checkPrebuilds(options) {
|
|
|
87
87
|
packageRoot: addon.packageRoot,
|
|
88
88
|
message: describeMissingPrebuild(addon, host, locations, platformPackage, platformLocation)
|
|
89
89
|
};
|
|
90
|
-
const needsPin =
|
|
91
|
-
(platformLocation === undefined || platformLocation.mismatchedVersion !== undefined);
|
|
90
|
+
const needsPin = platformLocation === undefined || platformLocation.mismatchedVersion !== undefined;
|
|
92
91
|
if (platformPackage !== null && addon.version !== undefined && needsPin) {
|
|
93
92
|
issue.platformPackage = { name: platformPackage, version: addon.version };
|
|
94
93
|
}
|
|
@@ -7,7 +7,6 @@ export declare const RESOURCE_COLLECTOR_SIZE_BUDGETS: {
|
|
|
7
7
|
export interface ResourceCollectorAcceptanceOptions {
|
|
8
8
|
projectRoot: string;
|
|
9
9
|
bundlePath: string;
|
|
10
|
-
manifestPath: string;
|
|
11
10
|
hosts: string[];
|
|
12
11
|
budgets?: ResourceCollectorSizeBudgets;
|
|
13
12
|
}
|
|
@@ -37,7 +36,6 @@ export type ResourceCollectorAcceptanceIssue = {
|
|
|
37
36
|
code: 'missing-collector';
|
|
38
37
|
level: 'error';
|
|
39
38
|
package: string;
|
|
40
|
-
location: 'bundle' | 'manifest';
|
|
41
39
|
message: string;
|
|
42
40
|
} | {
|
|
43
41
|
code: 'missing-prebuild';
|
|
@@ -45,10 +43,6 @@ export type ResourceCollectorAcceptanceIssue = {
|
|
|
45
43
|
package: string;
|
|
46
44
|
host: string;
|
|
47
45
|
message: string;
|
|
48
|
-
} | {
|
|
49
|
-
code: 'invalid-manifest';
|
|
50
|
-
level: 'error';
|
|
51
|
-
message: string;
|
|
52
46
|
} | {
|
|
53
47
|
code: 'measurement-failed';
|
|
54
48
|
level: 'error';
|
|
@@ -21,13 +21,9 @@ export async function acceptResourceCollectorPackaging(options) {
|
|
|
21
21
|
const collectors = new Map(addons
|
|
22
22
|
.filter((addon) => isResourceCollectorPackage(addon.name))
|
|
23
23
|
.map((addon) => [addon.name, addon]));
|
|
24
|
-
const manifestResult = await readAddonsManifest(options.manifestPath);
|
|
25
|
-
const manifestAddons = new Set(manifestResult.manifest?.addons);
|
|
26
24
|
const issues = [];
|
|
27
25
|
const entriesByHost = new Map(options.hosts.map((host) => [host, []]));
|
|
28
26
|
const budgets = options.budgets ?? RESOURCE_COLLECTOR_SIZE_BUDGETS;
|
|
29
|
-
if (manifestResult.issue !== undefined)
|
|
30
|
-
issues.push(manifestResult.issue);
|
|
31
27
|
for (const packageName of RESOURCE_COLLECTOR_PACKAGES) {
|
|
32
28
|
const collector = collectors.get(packageName);
|
|
33
29
|
if (collector === undefined) {
|
|
@@ -35,21 +31,10 @@ export async function acceptResourceCollectorPackaging(options) {
|
|
|
35
31
|
code: 'missing-collector',
|
|
36
32
|
level: 'error',
|
|
37
33
|
package: packageName,
|
|
38
|
-
location: 'bundle',
|
|
39
34
|
message: `${packageName} is missing from the linked worker bundle graph.`
|
|
40
35
|
});
|
|
41
|
-
}
|
|
42
|
-
if (manifestResult.manifest !== undefined && !manifestAddons.has(packageName)) {
|
|
43
|
-
issues.push({
|
|
44
|
-
code: 'missing-collector',
|
|
45
|
-
level: 'error',
|
|
46
|
-
package: packageName,
|
|
47
|
-
location: 'manifest',
|
|
48
|
-
message: `${packageName} is missing from ${options.manifestPath}.`
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
if (collector === undefined)
|
|
52
36
|
continue;
|
|
37
|
+
}
|
|
53
38
|
for (const host of options.hosts) {
|
|
54
39
|
const hostDir = path.join(collector.packageRoot, 'prebuilds', host);
|
|
55
40
|
const files = await listBarePrebuildFiles(hostDir);
|
|
@@ -226,37 +211,3 @@ function measurementFailedIssue(packageName, host, cause) {
|
|
|
226
211
|
function isResourceCollectorPackage(packageName) {
|
|
227
212
|
return RESOURCE_COLLECTOR_PACKAGES.some((collector) => collector === packageName);
|
|
228
213
|
}
|
|
229
|
-
async function readAddonsManifest(manifestPath) {
|
|
230
|
-
let parsed;
|
|
231
|
-
try {
|
|
232
|
-
parsed = JSON.parse(await fsp.readFile(manifestPath, 'utf8'));
|
|
233
|
-
}
|
|
234
|
-
catch (error) {
|
|
235
|
-
return {
|
|
236
|
-
issue: invalidManifestIssue(manifestPath, error)
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
if (!isAddonsManifest(parsed)) {
|
|
240
|
-
return {
|
|
241
|
-
issue: invalidManifestIssue(manifestPath, 'manifest does not match the expected shape')
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
return { manifest: parsed };
|
|
245
|
-
}
|
|
246
|
-
function isAddonsManifest(value) {
|
|
247
|
-
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
248
|
-
return false;
|
|
249
|
-
const manifest = value;
|
|
250
|
-
return (manifest['version'] === 1 &&
|
|
251
|
-
typeof manifest['bundleId'] === 'string' &&
|
|
252
|
-
Array.isArray(manifest['addons']) &&
|
|
253
|
-
manifest['addons'].every((addon) => typeof addon === 'string'));
|
|
254
|
-
}
|
|
255
|
-
function invalidManifestIssue(manifestPath, cause) {
|
|
256
|
-
const reason = cause instanceof Error ? cause.message : String(cause);
|
|
257
|
-
return {
|
|
258
|
-
code: 'invalid-manifest',
|
|
259
|
-
level: 'error',
|
|
260
|
-
message: `Could not read a valid addon manifest at ${manifestPath}: ${reason}.`
|
|
261
|
-
};
|
|
262
|
-
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BareRuntimeResolution } from '../../commands/verify/abi.js';
|
|
2
|
+
/** The Bare that the bare-sidecar `from` resolves runs desktop workers on, from its `versions.json`. */
|
|
3
|
+
export declare function resolveSidecarRuntime(from: string): BareRuntimeResolution;
|
|
4
|
+
/** The Bare of the bare-sidecar that the project's pear-runtime starts workers with. */
|
|
5
|
+
export declare function resolvePearRuntime(projectRoot: string): BareRuntimeResolution;
|
|
6
|
+
//# sourceMappingURL=sidecar-runtime.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { findInAncestorNodeModules } from '../../expo/plugins/find-in-ancestor-node-modules.js';
|
|
4
|
+
function unresolved(reason, triedPaths) {
|
|
5
|
+
return { resolved: false, error: { reason, triedPaths } };
|
|
6
|
+
}
|
|
7
|
+
function readJson(file) {
|
|
8
|
+
try {
|
|
9
|
+
return JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** The Bare that the bare-sidecar `from` resolves runs desktop workers on, from its `versions.json`. */
|
|
16
|
+
export function resolveSidecarRuntime(from) {
|
|
17
|
+
const dir = findInAncestorNodeModules(from, 'bare-sidecar');
|
|
18
|
+
if (dir === null) {
|
|
19
|
+
return unresolved('bare-sidecar is not installed, so the desktop Bare version is unknown', [
|
|
20
|
+
path.join(from, 'node_modules', 'bare-sidecar')
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
const versionsPath = path.join(dir, 'versions.json');
|
|
24
|
+
const bare = readJson(versionsPath)?.['bare'];
|
|
25
|
+
if (typeof bare !== 'string') {
|
|
26
|
+
return unresolved(`${versionsPath} does not name the Bare version`, [versionsPath]);
|
|
27
|
+
}
|
|
28
|
+
const version = readJson(path.join(dir, 'package.json'))?.['version'];
|
|
29
|
+
const packageVersion = typeof version === 'string' ? version : 'unknown';
|
|
30
|
+
return {
|
|
31
|
+
resolved: true,
|
|
32
|
+
runtime: {
|
|
33
|
+
version: bare,
|
|
34
|
+
source: 'bare-sidecar',
|
|
35
|
+
packageVersion,
|
|
36
|
+
detail: `bare-sidecar ${packageVersion} at ${dir}`
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** The Bare of the bare-sidecar that the project's pear-runtime starts workers with. */
|
|
41
|
+
export function resolvePearRuntime(projectRoot) {
|
|
42
|
+
const dir = findInAncestorNodeModules(projectRoot, 'pear-runtime');
|
|
43
|
+
if (dir === null) {
|
|
44
|
+
return unresolved('pear-runtime is not installed, so the desktop Bare version is unknown', [
|
|
45
|
+
path.join(projectRoot, 'node_modules', 'pear-runtime')
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
48
|
+
// pnpm links pear-runtime into node_modules; its bare-sidecar sits next to
|
|
49
|
+
// the real directory in the store, not next to the link.
|
|
50
|
+
return resolveSidecarRuntime(fs.realpathSync(dir));
|
|
51
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import configPlugins from '@expo/config-plugins';
|
|
2
|
+
import type { ExpoConfig } from 'expo/config';
|
|
3
|
+
/**
|
|
4
|
+
* Expo plugin: adds the Bare Kit module that `withMobileBundle` writes to the
|
|
5
|
+
* app, as a Gradle module on Android and a local Swift package on iOS, and
|
|
6
|
+
* raises the app's Kotlin to the version Bare Kit needs. Fails when
|
|
7
|
+
* expo-bare-kit is also configured, since both write Bare Kit and the native
|
|
8
|
+
* addons into the app.
|
|
9
|
+
*/
|
|
10
|
+
declare function withBareKit(config: ExpoConfig): ExpoConfig;
|
|
11
|
+
export declare function includeModule(settings: string): string;
|
|
12
|
+
export declare function addModuleDependency(appBuildGradle: string): string;
|
|
13
|
+
/** bare-kit-kotlin is published on JitPack. */
|
|
14
|
+
export declare function addJitPack(buildGradle: string): string;
|
|
15
|
+
type GradleProperties = configPlugins.AndroidConfig.Properties.PropertiesItem[];
|
|
16
|
+
export declare function raiseKotlinVersion(properties: GradleProperties): void;
|
|
17
|
+
interface PbxEntry {
|
|
18
|
+
value: string;
|
|
19
|
+
comment: string;
|
|
20
|
+
}
|
|
21
|
+
interface XcodeObjects {
|
|
22
|
+
PBXNativeTarget: Record<string, {
|
|
23
|
+
name?: string;
|
|
24
|
+
packageProductDependencies?: PbxEntry[];
|
|
25
|
+
}>;
|
|
26
|
+
PBXFileReference: Record<string, unknown>;
|
|
27
|
+
PBXBuildFile: Record<string, unknown>;
|
|
28
|
+
PBXGroup: Record<string, {
|
|
29
|
+
children: PbxEntry[];
|
|
30
|
+
}>;
|
|
31
|
+
XCLocalSwiftPackageReference?: Record<string, unknown>;
|
|
32
|
+
XCSwiftPackageProductDependency?: Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
export interface XcodeProject {
|
|
35
|
+
hash: {
|
|
36
|
+
project: {
|
|
37
|
+
objects: XcodeObjects;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
generateUuid(): string;
|
|
41
|
+
getFirstProject(): {
|
|
42
|
+
firstProject: {
|
|
43
|
+
mainGroup: string;
|
|
44
|
+
packageReferences?: PbxEntry[];
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
pbxFrameworksBuildPhaseObj(target: string): {
|
|
48
|
+
files: PbxEntry[];
|
|
49
|
+
} | null;
|
|
50
|
+
pbxResourcesBuildPhaseObj(target: string): {
|
|
51
|
+
files: PbxEntry[];
|
|
52
|
+
} | null;
|
|
53
|
+
}
|
|
54
|
+
/** Links the product of the local Swift package at `relativePath`, named the same, into `target`. */
|
|
55
|
+
export declare function addSwiftPackage(project: XcodeProject, target: string, relativePath: string): void;
|
|
56
|
+
/** Copies the folder at `relativePath` into the app bundle as is. */
|
|
57
|
+
export declare function addFolderResource(project: XcodeProject, target: string, relativePath: string): void;
|
|
58
|
+
export default withBareKit;
|
|
59
|
+
//# sourceMappingURL=withBareKit.d.ts.map
|