@limrun/api 0.39.8 → 0.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/folder-sync-ignore.d.mts +15 -14
- package/folder-sync-ignore.d.mts.map +1 -1
- package/folder-sync-ignore.d.ts +15 -14
- package/folder-sync-ignore.d.ts.map +1 -1
- package/folder-sync-ignore.js +23 -21
- package/folder-sync-ignore.js.map +1 -1
- package/folder-sync-ignore.mjs +23 -21
- package/folder-sync-ignore.mjs.map +1 -1
- package/instance-client.d.mts +3 -3
- package/instance-client.d.ts +3 -3
- package/internal/android-basis-cache.d.mts +0 -1
- package/internal/android-basis-cache.d.mts.map +1 -1
- package/internal/android-basis-cache.d.ts +0 -1
- package/internal/android-basis-cache.d.ts.map +1 -1
- package/internal/android-basis-cache.js +29 -9
- package/internal/android-basis-cache.js.map +1 -1
- package/internal/android-basis-cache.mjs +29 -9
- package/internal/android-basis-cache.mjs.map +1 -1
- package/internal/seed-reconstruct.d.mts +39 -0
- package/internal/seed-reconstruct.d.mts.map +1 -0
- package/internal/seed-reconstruct.d.ts +39 -0
- package/internal/seed-reconstruct.d.ts.map +1 -0
- package/internal/seed-reconstruct.js +413 -0
- package/internal/seed-reconstruct.js.map +1 -0
- package/internal/seed-reconstruct.mjs +405 -0
- package/internal/seed-reconstruct.mjs.map +1 -0
- package/package.json +1 -1
- package/resources/ios-instances.d.mts +6 -0
- package/resources/ios-instances.d.mts.map +1 -1
- package/resources/ios-instances.d.ts +6 -0
- package/resources/ios-instances.d.ts.map +1 -1
- package/src/folder-sync-ignore.ts +30 -28
- package/src/instance-client.ts +3 -3
- package/src/internal/android-basis-cache.ts +38 -16
- package/src/internal/seed-reconstruct.ts +533 -0
- package/src/resources/ios-instances.ts +7 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.40.1 (2026-07-14)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.40.0...v0.40.1](https://github.com/limrun-inc/typescript-sdk/compare/v0.40.0...v0.40.1)
|
|
6
|
+
|
|
7
|
+
## 0.40.0 (2026-07-13)
|
|
8
|
+
|
|
9
|
+
Full Changelog: [v0.39.8...v0.40.0](https://github.com/limrun-inc/typescript-sdk/compare/v0.39.8...v0.40.0)
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **api:** ios add forceBundleId ([a6c22a0](https://github.com/limrun-inc/typescript-sdk/commit/a6c22a056b093ffb9316ba2326d7134ae4f8cb0f))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **ci:** bump @arethetypeswrong/cli to ^0.18.0 and run CI workflows on Node 24 ([722c87f](https://github.com/limrun-inc/typescript-sdk/commit/722c87febac166192ee4bf376e09bed33802898b))
|
|
19
|
+
|
|
3
20
|
## 0.39.8 (2026-07-11)
|
|
4
21
|
|
|
5
22
|
Full Changelog: [v0.39.7...v0.39.8](https://github.com/limrun-inc/typescript-sdk/compare/v0.39.7...v0.39.8)
|
package/folder-sync-ignore.d.mts
CHANGED
|
@@ -5,12 +5,12 @@ export type IgnoreFnOptions = {
|
|
|
5
5
|
additional?: IgnoreFn;
|
|
6
6
|
/**
|
|
7
7
|
* User-supplied force-includes (the CLI's --include): matches sync even when
|
|
8
|
-
* gitignored or covered by the default Xcode
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* parent the predicate must also match the parent directory
|
|
12
|
-
* with a trailing slash), e.g. `^ios/` reaches
|
|
13
|
-
* `GeneratedKit/` alone does not.
|
|
8
|
+
* covered by a built-in exclude, gitignored, or covered by the default Xcode
|
|
9
|
+
* excludes. The basis cache remains excluded to prevent sync loops. Note:
|
|
10
|
+
* the walk prunes excluded directories, so to rescue files under a
|
|
11
|
+
* wholly-excluded parent the predicate must also match the parent directory
|
|
12
|
+
* paths (probed with a trailing slash), e.g. `^ios/` reaches
|
|
13
|
+
* `ios/GeneratedKit/...` but `GeneratedKit/` alone does not.
|
|
14
14
|
*/
|
|
15
15
|
include?: IgnoreFn;
|
|
16
16
|
/**
|
|
@@ -27,21 +27,22 @@ export type IgnoreFnOptions = {
|
|
|
27
27
|
/**
|
|
28
28
|
* Builds the layered sync ignore predicate. First decisive answer wins:
|
|
29
29
|
*
|
|
30
|
-
* 1.
|
|
31
|
-
* 2. User include (--include): explicit intent beats
|
|
32
|
-
* 3.
|
|
33
|
-
* 4.
|
|
30
|
+
* 1. The basis cache: excluded, never overridable.
|
|
31
|
+
* 2. User include (--include): explicit intent beats every other exclusion.
|
|
32
|
+
* 3. `.git` and `.DS_Store`.
|
|
33
|
+
* 4. Default Xcode/dependency excludes (when xcodeDefaults is set).
|
|
34
|
+
* 5. Built-in force-include: `*.xcconfig` (gitignored xcconfigs are still
|
|
34
35
|
* required to reproduce the build remotely). Gitignored projects are NOT
|
|
35
36
|
* force-included: limbuild regenerates them from project.yml, and
|
|
36
37
|
* exact-version holdouts force-sync theirs with `--include`.
|
|
37
|
-
*
|
|
38
|
+
* 6. `.gitignore` chain: the root file, plus nested ones with git semantics
|
|
38
39
|
* when xcodeDefaults is set (rules bind relative to their containing
|
|
39
40
|
* directory, deeper files override shallower ones). Only a decisive
|
|
40
|
-
* *exclude* short-circuits; a negation re-include defers to layer
|
|
41
|
-
* Directory pruning in the walk means only layers 2 and
|
|
41
|
+
* *exclude* short-circuits; a negation re-include defers to layer 7.
|
|
42
|
+
* Directory pruning in the walk means only layers 2 and 5 can reach a
|
|
42
43
|
* file whose parent directory is gitignore-excluded, and only when the
|
|
43
44
|
* predicate matches the pruned parent directory paths too.
|
|
44
|
-
*
|
|
45
|
+
* 7. User ignore (--ignore).
|
|
45
46
|
*/
|
|
46
47
|
export declare function createIgnoreFn(rootDir: string, options: IgnoreFnOptions): Promise<IgnoreFn>;
|
|
47
48
|
//# sourceMappingURL=folder-sync-ignore.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder-sync-ignore.d.mts","sourceRoot":"","sources":["src/folder-sync-ignore.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC;AAEzD,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAE7F,MAAM,MAAM,eAAe,GAAG;IAC5B,+FAA+F;IAC/F,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB,CAAC;AAoDF
|
|
1
|
+
{"version":3,"file":"folder-sync-ignore.d.mts","sourceRoot":"","sources":["src/folder-sync-ignore.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC;AAEzD,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAE7F,MAAM,MAAM,eAAe,GAAG;IAC5B,+FAA+F;IAC/F,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB,CAAC;AAoDF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,CA0IjG"}
|
package/folder-sync-ignore.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ export type IgnoreFnOptions = {
|
|
|
5
5
|
additional?: IgnoreFn;
|
|
6
6
|
/**
|
|
7
7
|
* User-supplied force-includes (the CLI's --include): matches sync even when
|
|
8
|
-
* gitignored or covered by the default Xcode
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* parent the predicate must also match the parent directory
|
|
12
|
-
* with a trailing slash), e.g. `^ios/` reaches
|
|
13
|
-
* `GeneratedKit/` alone does not.
|
|
8
|
+
* covered by a built-in exclude, gitignored, or covered by the default Xcode
|
|
9
|
+
* excludes. The basis cache remains excluded to prevent sync loops. Note:
|
|
10
|
+
* the walk prunes excluded directories, so to rescue files under a
|
|
11
|
+
* wholly-excluded parent the predicate must also match the parent directory
|
|
12
|
+
* paths (probed with a trailing slash), e.g. `^ios/` reaches
|
|
13
|
+
* `ios/GeneratedKit/...` but `GeneratedKit/` alone does not.
|
|
14
14
|
*/
|
|
15
15
|
include?: IgnoreFn;
|
|
16
16
|
/**
|
|
@@ -27,21 +27,22 @@ export type IgnoreFnOptions = {
|
|
|
27
27
|
/**
|
|
28
28
|
* Builds the layered sync ignore predicate. First decisive answer wins:
|
|
29
29
|
*
|
|
30
|
-
* 1.
|
|
31
|
-
* 2. User include (--include): explicit intent beats
|
|
32
|
-
* 3.
|
|
33
|
-
* 4.
|
|
30
|
+
* 1. The basis cache: excluded, never overridable.
|
|
31
|
+
* 2. User include (--include): explicit intent beats every other exclusion.
|
|
32
|
+
* 3. `.git` and `.DS_Store`.
|
|
33
|
+
* 4. Default Xcode/dependency excludes (when xcodeDefaults is set).
|
|
34
|
+
* 5. Built-in force-include: `*.xcconfig` (gitignored xcconfigs are still
|
|
34
35
|
* required to reproduce the build remotely). Gitignored projects are NOT
|
|
35
36
|
* force-included: limbuild regenerates them from project.yml, and
|
|
36
37
|
* exact-version holdouts force-sync theirs with `--include`.
|
|
37
|
-
*
|
|
38
|
+
* 6. `.gitignore` chain: the root file, plus nested ones with git semantics
|
|
38
39
|
* when xcodeDefaults is set (rules bind relative to their containing
|
|
39
40
|
* directory, deeper files override shallower ones). Only a decisive
|
|
40
|
-
* *exclude* short-circuits; a negation re-include defers to layer
|
|
41
|
-
* Directory pruning in the walk means only layers 2 and
|
|
41
|
+
* *exclude* short-circuits; a negation re-include defers to layer 7.
|
|
42
|
+
* Directory pruning in the walk means only layers 2 and 5 can reach a
|
|
42
43
|
* file whose parent directory is gitignore-excluded, and only when the
|
|
43
44
|
* predicate matches the pruned parent directory paths too.
|
|
44
|
-
*
|
|
45
|
+
* 7. User ignore (--ignore).
|
|
45
46
|
*/
|
|
46
47
|
export declare function createIgnoreFn(rootDir: string, options: IgnoreFnOptions): Promise<IgnoreFn>;
|
|
47
48
|
//# sourceMappingURL=folder-sync-ignore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder-sync-ignore.d.ts","sourceRoot":"","sources":["src/folder-sync-ignore.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC;AAEzD,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAE7F,MAAM,MAAM,eAAe,GAAG;IAC5B,+FAA+F;IAC/F,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB,CAAC;AAoDF
|
|
1
|
+
{"version":3,"file":"folder-sync-ignore.d.ts","sourceRoot":"","sources":["src/folder-sync-ignore.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC;AAEzD,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAE7F,MAAM,MAAM,eAAe,GAAG;IAC5B,+FAA+F;IAC/F,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,YAAY,CAAC;CACpB,CAAC;AAoDF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,CA0IjG"}
|
package/folder-sync-ignore.js
CHANGED
|
@@ -55,21 +55,22 @@ const XCODE_DEFAULT_EXCLUDE_PREFIXES = [
|
|
|
55
55
|
/**
|
|
56
56
|
* Builds the layered sync ignore predicate. First decisive answer wins:
|
|
57
57
|
*
|
|
58
|
-
* 1.
|
|
59
|
-
* 2. User include (--include): explicit intent beats
|
|
60
|
-
* 3.
|
|
61
|
-
* 4.
|
|
58
|
+
* 1. The basis cache: excluded, never overridable.
|
|
59
|
+
* 2. User include (--include): explicit intent beats every other exclusion.
|
|
60
|
+
* 3. `.git` and `.DS_Store`.
|
|
61
|
+
* 4. Default Xcode/dependency excludes (when xcodeDefaults is set).
|
|
62
|
+
* 5. Built-in force-include: `*.xcconfig` (gitignored xcconfigs are still
|
|
62
63
|
* required to reproduce the build remotely). Gitignored projects are NOT
|
|
63
64
|
* force-included: limbuild regenerates them from project.yml, and
|
|
64
65
|
* exact-version holdouts force-sync theirs with `--include`.
|
|
65
|
-
*
|
|
66
|
+
* 6. `.gitignore` chain: the root file, plus nested ones with git semantics
|
|
66
67
|
* when xcodeDefaults is set (rules bind relative to their containing
|
|
67
68
|
* directory, deeper files override shallower ones). Only a decisive
|
|
68
|
-
* *exclude* short-circuits; a negation re-include defers to layer
|
|
69
|
-
* Directory pruning in the walk means only layers 2 and
|
|
69
|
+
* *exclude* short-circuits; a negation re-include defers to layer 7.
|
|
70
|
+
* Directory pruning in the walk means only layers 2 and 5 can reach a
|
|
70
71
|
* file whose parent directory is gitignore-excluded, and only when the
|
|
71
72
|
* predicate matches the pruned parent directory paths too.
|
|
72
|
-
*
|
|
73
|
+
* 7. User ignore (--ignore).
|
|
73
74
|
*/
|
|
74
75
|
async function createIgnoreFn(rootDir, options) {
|
|
75
76
|
const rootResolved = path_1.default.resolve(rootDir);
|
|
@@ -141,15 +142,7 @@ async function createIgnoreFn(rootDir, options) {
|
|
|
141
142
|
if (!normalized)
|
|
142
143
|
return false;
|
|
143
144
|
const withoutTrailingSlash = normalized.replace(/\/+$/, '');
|
|
144
|
-
// 1.
|
|
145
|
-
if (withoutTrailingSlash === '.git' ||
|
|
146
|
-
withoutTrailingSlash.startsWith('.git/') ||
|
|
147
|
-
withoutTrailingSlash.endsWith('/.git') ||
|
|
148
|
-
withoutTrailingSlash.includes('/.git/') ||
|
|
149
|
-
withoutTrailingSlash === '.DS_Store' ||
|
|
150
|
-
withoutTrailingSlash.endsWith('/.DS_Store')) {
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
145
|
+
// 1. The basis cache must not sync itself, even when --include matches.
|
|
153
146
|
if (shouldIgnoreBasisCache &&
|
|
154
147
|
(withoutTrailingSlash === basisCacheRelative ||
|
|
155
148
|
withoutTrailingSlash.startsWith(`${basisCacheRelative}/`))) {
|
|
@@ -158,7 +151,16 @@ async function createIgnoreFn(rootDir, options) {
|
|
|
158
151
|
// 2. User include.
|
|
159
152
|
if (options.include?.(normalized))
|
|
160
153
|
return false;
|
|
161
|
-
// 3.
|
|
154
|
+
// 3. Built-in excludes.
|
|
155
|
+
if (withoutTrailingSlash === '.git' ||
|
|
156
|
+
withoutTrailingSlash.startsWith('.git/') ||
|
|
157
|
+
withoutTrailingSlash.endsWith('/.git') ||
|
|
158
|
+
withoutTrailingSlash.includes('/.git/') ||
|
|
159
|
+
withoutTrailingSlash === '.DS_Store' ||
|
|
160
|
+
withoutTrailingSlash.endsWith('/.DS_Store')) {
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
// 4. Default Xcode/dependency excludes.
|
|
162
164
|
if (options.xcodeDefaults) {
|
|
163
165
|
for (const prefix of XCODE_DEFAULT_EXCLUDE_PREFIXES) {
|
|
164
166
|
if (normalized.startsWith(prefix))
|
|
@@ -167,13 +169,13 @@ async function createIgnoreFn(rootDir, options) {
|
|
|
167
169
|
if (normalized.includes('/xcuserdata/') || normalized.includes('.dSYM/'))
|
|
168
170
|
return true;
|
|
169
171
|
}
|
|
170
|
-
//
|
|
172
|
+
// 5. Built-in force-include: gitignored xcconfigs are still required to
|
|
171
173
|
// reproduce the build remotely. Gitignored .xcodeproj bundles are NOT
|
|
172
174
|
// force-included: limbuild regenerates them from project.yml, and
|
|
173
175
|
// exact-version holdouts force-sync theirs with --include.
|
|
174
176
|
if (withoutTrailingSlash.endsWith('.xcconfig'))
|
|
175
177
|
return false;
|
|
176
|
-
//
|
|
178
|
+
// 6. The .gitignore chain. Only a decisive *exclude* short-circuits; a
|
|
177
179
|
// negation re-include (decision.ignored === false) still falls through to
|
|
178
180
|
// the user --ignore layer, matching the pre-restructure precedence where
|
|
179
181
|
// gitignore never overrode --ignore for a re-included path.
|
|
@@ -195,7 +197,7 @@ async function createIgnoreFn(rootDir, options) {
|
|
|
195
197
|
}
|
|
196
198
|
return true;
|
|
197
199
|
}
|
|
198
|
-
//
|
|
200
|
+
// 7. User ignore.
|
|
199
201
|
if (options.additional?.(normalized))
|
|
200
202
|
return true;
|
|
201
203
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder-sync-ignore.js","sourceRoot":"","sources":["src/folder-sync-ignore.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"folder-sync-ignore.js","sourceRoot":"","sources":["src/folder-sync-ignore.ts"],"names":[],"mappings":";;AA2GA,wCA0IC;;AArPD,oDAAoB;AACpB,wDAAwB;AACxB,iDAAyC;AACzC,+BAAiC;AACjC,4DAAgD;AAEhD,MAAM,aAAa,GAAG,IAAA,gBAAS,EAAC,wBAAQ,CAAC,CAAC;AA+B1C,SAAS,qBAAqB,CAAC,YAAoB;IACjD,OAAO,YAAY;SAChB,KAAK,CAAC,cAAI,CAAC,GAAG,CAAC;SACf,IAAI,CAAC,GAAG,CAAC;SACT,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC1B,CAAC;AAOD,KAAK,UAAU,iBAAiB,CAAC,OAAe;IAC9C,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE;YAChE,GAAG,EAAE,OAAO;YACZ,SAAS,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;SAC7B,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;QAClC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;QACnC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,IAAI;gBAAE,SAAS;YACpB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAClB,IAAI,GAAG,GAAG,IAAI,CAAC,W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AO,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,EACjG,CAAC;gBACD,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,WAAW,CAAC;gBAC1C,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC3B,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBACtB,MAAM,GAAG,GAAG,oBAAoB,IAAI,kBAAkB,oBAAoB,0IAA0I,CAAC;oBACrN,IAAI,GAAG,EAAE,CAAC;wBACR,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;oBACnB,CAAC;yBAAM,CAAC;wBACN,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;oBACpC,CAAC;gBACH,CAAC;YACH,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,kBAAkB;QAClB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,UAAU,CAAC;YAAE,OAAO,IAAI,CAAC;QAClD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC"}
|
package/folder-sync-ignore.mjs
CHANGED
|
@@ -51,21 +51,22 @@ const XCODE_DEFAULT_EXCLUDE_PREFIXES = [
|
|
|
51
51
|
/**
|
|
52
52
|
* Builds the layered sync ignore predicate. First decisive answer wins:
|
|
53
53
|
*
|
|
54
|
-
* 1.
|
|
55
|
-
* 2. User include (--include): explicit intent beats
|
|
56
|
-
* 3.
|
|
57
|
-
* 4.
|
|
54
|
+
* 1. The basis cache: excluded, never overridable.
|
|
55
|
+
* 2. User include (--include): explicit intent beats every other exclusion.
|
|
56
|
+
* 3. `.git` and `.DS_Store`.
|
|
57
|
+
* 4. Default Xcode/dependency excludes (when xcodeDefaults is set).
|
|
58
|
+
* 5. Built-in force-include: `*.xcconfig` (gitignored xcconfigs are still
|
|
58
59
|
* required to reproduce the build remotely). Gitignored projects are NOT
|
|
59
60
|
* force-included: limbuild regenerates them from project.yml, and
|
|
60
61
|
* exact-version holdouts force-sync theirs with `--include`.
|
|
61
|
-
*
|
|
62
|
+
* 6. `.gitignore` chain: the root file, plus nested ones with git semantics
|
|
62
63
|
* when xcodeDefaults is set (rules bind relative to their containing
|
|
63
64
|
* directory, deeper files override shallower ones). Only a decisive
|
|
64
|
-
* *exclude* short-circuits; a negation re-include defers to layer
|
|
65
|
-
* Directory pruning in the walk means only layers 2 and
|
|
65
|
+
* *exclude* short-circuits; a negation re-include defers to layer 7.
|
|
66
|
+
* Directory pruning in the walk means only layers 2 and 5 can reach a
|
|
66
67
|
* file whose parent directory is gitignore-excluded, and only when the
|
|
67
68
|
* predicate matches the pruned parent directory paths too.
|
|
68
|
-
*
|
|
69
|
+
* 7. User ignore (--ignore).
|
|
69
70
|
*/
|
|
70
71
|
export async function createIgnoreFn(rootDir, options) {
|
|
71
72
|
const rootResolved = path.resolve(rootDir);
|
|
@@ -137,15 +138,7 @@ export async function createIgnoreFn(rootDir, options) {
|
|
|
137
138
|
if (!normalized)
|
|
138
139
|
return false;
|
|
139
140
|
const withoutTrailingSlash = normalized.replace(/\/+$/, '');
|
|
140
|
-
// 1.
|
|
141
|
-
if (withoutTrailingSlash === '.git' ||
|
|
142
|
-
withoutTrailingSlash.startsWith('.git/') ||
|
|
143
|
-
withoutTrailingSlash.endsWith('/.git') ||
|
|
144
|
-
withoutTrailingSlash.includes('/.git/') ||
|
|
145
|
-
withoutTrailingSlash === '.DS_Store' ||
|
|
146
|
-
withoutTrailingSlash.endsWith('/.DS_Store')) {
|
|
147
|
-
return true;
|
|
148
|
-
}
|
|
141
|
+
// 1. The basis cache must not sync itself, even when --include matches.
|
|
149
142
|
if (shouldIgnoreBasisCache &&
|
|
150
143
|
(withoutTrailingSlash === basisCacheRelative ||
|
|
151
144
|
withoutTrailingSlash.startsWith(`${basisCacheRelative}/`))) {
|
|
@@ -154,7 +147,16 @@ export async function createIgnoreFn(rootDir, options) {
|
|
|
154
147
|
// 2. User include.
|
|
155
148
|
if (options.include?.(normalized))
|
|
156
149
|
return false;
|
|
157
|
-
// 3.
|
|
150
|
+
// 3. Built-in excludes.
|
|
151
|
+
if (withoutTrailingSlash === '.git' ||
|
|
152
|
+
withoutTrailingSlash.startsWith('.git/') ||
|
|
153
|
+
withoutTrailingSlash.endsWith('/.git') ||
|
|
154
|
+
withoutTrailingSlash.includes('/.git/') ||
|
|
155
|
+
withoutTrailingSlash === '.DS_Store' ||
|
|
156
|
+
withoutTrailingSlash.endsWith('/.DS_Store')) {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
// 4. Default Xcode/dependency excludes.
|
|
158
160
|
if (options.xcodeDefaults) {
|
|
159
161
|
for (const prefix of XCODE_DEFAULT_EXCLUDE_PREFIXES) {
|
|
160
162
|
if (normalized.startsWith(prefix))
|
|
@@ -163,13 +165,13 @@ export async function createIgnoreFn(rootDir, options) {
|
|
|
163
165
|
if (normalized.includes('/xcuserdata/') || normalized.includes('.dSYM/'))
|
|
164
166
|
return true;
|
|
165
167
|
}
|
|
166
|
-
//
|
|
168
|
+
// 5. Built-in force-include: gitignored xcconfigs are still required to
|
|
167
169
|
// reproduce the build remotely. Gitignored .xcodeproj bundles are NOT
|
|
168
170
|
// force-included: limbuild regenerates them from project.yml, and
|
|
169
171
|
// exact-version holdouts force-sync theirs with --include.
|
|
170
172
|
if (withoutTrailingSlash.endsWith('.xcconfig'))
|
|
171
173
|
return false;
|
|
172
|
-
//
|
|
174
|
+
// 6. The .gitignore chain. Only a decisive *exclude* short-circuits; a
|
|
173
175
|
// negation re-include (decision.ignored === false) still falls through to
|
|
174
176
|
// the user --ignore layer, matching the pre-restructure precedence where
|
|
175
177
|
// gitignore never overrode --ignore for a re-included path.
|
|
@@ -191,7 +193,7 @@ export async function createIgnoreFn(rootDir, options) {
|
|
|
191
193
|
}
|
|
192
194
|
return true;
|
|
193
195
|
}
|
|
194
|
-
//
|
|
196
|
+
// 7. User ignore.
|
|
195
197
|
if (options.additional?.(normalized))
|
|
196
198
|
return true;
|
|
197
199
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder-sync-ignore.mjs","sourceRoot":"","sources":["src/folder-sync-ignore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,SAA0B,MAAM,QAAQ,CAAC;AAEhD,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AA+B1C,SAAS,qBAAqB,CAAC,YAAoB;IACjD,OAAO,YAAY;SAChB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;SACf,IAAI,CAAC,GAAG,CAAC;SACT,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC1B,CAAC;AAOD,KAAK,UAAU,iBAAiB,CAAC,OAAe;IAC9C,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE;YAChE,GAAG,EAAE,OAAO;YACZ,SAAS,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;SAC7B,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;QAClC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;QACnC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,IAAI;gBAAE,SAAS;YACpB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAClB,IAAI,GAAG,GAAG,IAAI,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}
|
package/instance-client.d.mts
CHANGED
|
@@ -109,9 +109,9 @@ export type InstanceClient = {
|
|
|
109
109
|
launchMode?: 'ForegroundIfRunning' | 'RelaunchIfRunning';
|
|
110
110
|
basisCacheDir?: string;
|
|
111
111
|
/**
|
|
112
|
-
* Called while
|
|
113
|
-
* `(0,
|
|
114
|
-
*
|
|
112
|
+
* Called while missing basis-seed ranges are downloaded from the instance. Fires
|
|
113
|
+
* once with `(0, requiredDownloadBytes)` before transfer, then repeatedly as bytes
|
|
114
|
+
* arrive. A full-download fallback restarts progress with the complete seed size.
|
|
115
115
|
*/
|
|
116
116
|
onBasisDownloadProgress?: (downloadedBytes: number, totalBytes: number) => void;
|
|
117
117
|
/** Called after every successful sync, including watch-triggered re-syncs. */
|
package/instance-client.d.ts
CHANGED
|
@@ -109,9 +109,9 @@ export type InstanceClient = {
|
|
|
109
109
|
launchMode?: 'ForegroundIfRunning' | 'RelaunchIfRunning';
|
|
110
110
|
basisCacheDir?: string;
|
|
111
111
|
/**
|
|
112
|
-
* Called while
|
|
113
|
-
* `(0,
|
|
114
|
-
*
|
|
112
|
+
* Called while missing basis-seed ranges are downloaded from the instance. Fires
|
|
113
|
+
* once with `(0, requiredDownloadBytes)` before transfer, then repeatedly as bytes
|
|
114
|
+
* arrive. A full-download fallback restarts progress with the complete seed size.
|
|
115
115
|
*/
|
|
116
116
|
onBasisDownloadProgress?: (downloadedBytes: number, totalBytes: number) => void;
|
|
117
117
|
/** Called after every successful sync, including watch-triggered re-syncs. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android-basis-cache.d.mts","sourceRoot":"","sources":["../src/internal/android-basis-cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"android-basis-cache.d.mts","sourceRoot":"","sources":["../src/internal/android-basis-cache.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;QACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACjF,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnE,CAAC;AAEF,KAAK,OAAO,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAgCjF;;;;;;;;GAQG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,OAAO,EACZ,uBAAuB,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,GAC9E,OAAO,CAAC,IAAI,CAAC,CAwFf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android-basis-cache.d.ts","sourceRoot":"","sources":["../src/internal/android-basis-cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"android-basis-cache.d.ts","sourceRoot":"","sources":["../src/internal/android-basis-cache.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;QACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACjF,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnE,CAAC;AAEF,KAAK,OAAO,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAgCjF;;;;;;;;GAQG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,OAAO,EACZ,uBAAuB,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,GAC9E,OAAO,CAAC,IAAI,CAAC,CAwFf"}
|
|
@@ -7,6 +7,7 @@ const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
|
7
7
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
8
|
const download_file_1 = require("./download-file.js");
|
|
9
9
|
const proxy_transport_1 = require("./proxy-transport.js");
|
|
10
|
+
const seed_reconstruct_1 = require("./seed-reconstruct.js");
|
|
10
11
|
function buildSyncStateUrl(apiUrl) {
|
|
11
12
|
return `${apiUrl}/sync/state`;
|
|
12
13
|
}
|
|
@@ -69,16 +70,16 @@ async function bootstrapAndroidBasisCache(apkPath, basisCacheDir, apiUrl, token,
|
|
|
69
70
|
for (const seed of seeds) {
|
|
70
71
|
serverShas.add(seed.sha256.toLowerCase());
|
|
71
72
|
}
|
|
73
|
+
let staleBasisPath;
|
|
72
74
|
if (fs_1.default.existsSync(basisPath)) {
|
|
73
75
|
const basisSha = (await sha256FileHex(basisPath)).toLowerCase();
|
|
74
76
|
if (serverShas.has(basisSha)) {
|
|
75
77
|
return;
|
|
76
78
|
}
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
// instance), so drop the stale basis and re-seed below.
|
|
79
|
+
// Keep the stale basis temporarily: even though the instance cannot use it
|
|
80
|
+
// directly, many of its blocks may be reusable while reconstructing a seed.
|
|
80
81
|
log('debug', `local basis ${basisSha} unknown to instance; re-seeding basis cache`);
|
|
81
|
-
|
|
82
|
+
staleBasisPath = basisPath;
|
|
82
83
|
}
|
|
83
84
|
const localSha = (await sha256FileHex(apkPath)).toLowerCase();
|
|
84
85
|
if (serverShas.has(localSha)) {
|
|
@@ -91,12 +92,31 @@ async function bootstrapAndroidBasisCache(apkPath, basisCacheDir, apiUrl, token,
|
|
|
91
92
|
}
|
|
92
93
|
const seed = seeds[0];
|
|
93
94
|
if (!seed) {
|
|
95
|
+
if (staleBasisPath) {
|
|
96
|
+
await fs_1.default.promises.rm(staleBasisPath, { force: true });
|
|
97
|
+
}
|
|
94
98
|
return;
|
|
95
99
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
const seedUrl = buildSyncSeedUrl(apiUrl, seed.sha256);
|
|
101
|
+
try {
|
|
102
|
+
const result = await (0, seed_reconstruct_1.reconstructSeedFromLocalFiles)({
|
|
103
|
+
signatureUrl: `${seedUrl}.sig`,
|
|
104
|
+
seedUrl,
|
|
105
|
+
token,
|
|
106
|
+
sourcePaths: staleBasisPath ? [apkPath, staleBasisPath] : [apkPath],
|
|
107
|
+
outputPath: basisPath,
|
|
108
|
+
expectedSha256: seed.sha256,
|
|
109
|
+
...(onBasisDownloadProgress ? { onProgress: onBasisDownloadProgress } : {}),
|
|
110
|
+
});
|
|
111
|
+
log('debug', `reconstructed Android basis seed ${seed.sha256}: matched=${result.matchedBlocks} downloaded=${result.downloadedBytes}`);
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
log('debug', `basis seed reconstruction unavailable; downloading full seed: ${err instanceof Error ? err.message : String(err)}`);
|
|
115
|
+
// A failed reconstruction never replaces basisPath, so it is safe to
|
|
116
|
+
// truncate the stale basis in place for the full-download fallback.
|
|
117
|
+
onBasisDownloadProgress?.(0, seed.size ?? 0);
|
|
118
|
+
await (0, download_file_1.downloadFileToLocalPath)(seedUrl, token, basisPath, onBasisDownloadProgress);
|
|
119
|
+
log('debug', `seeded Android basis cache from full instance seed: ${seed.sha256}`);
|
|
120
|
+
}
|
|
101
121
|
}
|
|
102
122
|
//# sourceMappingURL=android-basis-cache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android-basis-cache.js","sourceRoot":"","sources":["../src/internal/android-basis-cache.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"android-basis-cache.js","sourceRoot":"","sources":["../src/internal/android-basis-cache.ts"],"names":[],"mappings":";;AAyDA,gEA+FC;;AAxJD,4DAA4B;AAC5B,oDAAoB;AACpB,wDAAwB;AAExB,sDAA0D;AAC1D,0DAAuD;AACvD,4DAAmE;AAYnE,SAAS,iBAAiB,CAAC,MAAc;IACvC,OAAO,GAAG,MAAM,aAAa,CAAC;AAChC,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAc,EAAE,MAAc;IACtD,OAAO,GAAG,MAAM,eAAe,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;AAC9D,CAAC;AAED,KAAK,UAAU,aAAa,CAAC,QAAgB;IAC3C,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,IAAI,GAAG,gBAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACzC,MAAM,MAAM,GAAG,YAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAC7C,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAA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AA6B,EAAC;YACjD,YAAY,EAAE,GAAG,OAAO,MAAM;YAC9B,OAAO;YACP,KAAK;YACL,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YACnE,UAAU,EAAE,SAAS;YACrB,cAAc,EAAE,IAAI,CAAC,MAAM;YAC3B,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,uBAAuB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5E,CAAC,CAAC;QACH,GAAG,CACD,OAAO,EACP,oCAAoC,IAAI,CAAC,MAAM,aAAa,MAAM,CAAC,aAAa,eAAe,MAAM,CAAC,eAAe,EAAE,CACxH,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,GAAG,CACD,OAAO,EACP,iEACE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CACjD,EAAE,CACH,CAAC;QACF,qEAAqE;QACrE,oEAAoE;QACpE,uBAAuB,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;QAC7C,MAAM,IAAA,uCAAuB,EAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,uBAAuB,CAAC,CAAC;QAClF,GAAG,CAAC,OAAO,EAAE,uDAAuD,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACrF,CAAC;AACH,CAAC"}
|
|
@@ -3,6 +3,7 @@ import fs from 'fs';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { downloadFileToLocalPath } from "./download-file.mjs";
|
|
5
5
|
import { nodeProxyTransport } from "./proxy-transport.mjs";
|
|
6
|
+
import { reconstructSeedFromLocalFiles } from "./seed-reconstruct.mjs";
|
|
6
7
|
function buildSyncStateUrl(apiUrl) {
|
|
7
8
|
return `${apiUrl}/sync/state`;
|
|
8
9
|
}
|
|
@@ -65,16 +66,16 @@ export async function bootstrapAndroidBasisCache(apkPath, basisCacheDir, apiUrl,
|
|
|
65
66
|
for (const seed of seeds) {
|
|
66
67
|
serverShas.add(seed.sha256.toLowerCase());
|
|
67
68
|
}
|
|
69
|
+
let staleBasisPath;
|
|
68
70
|
if (fs.existsSync(basisPath)) {
|
|
69
71
|
const basisSha = (await sha256FileHex(basisPath)).toLowerCase();
|
|
70
72
|
if (serverShas.has(basisSha)) {
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
// instance), so drop the stale basis and re-seed below.
|
|
75
|
+
// Keep the stale basis temporarily: even though the instance cannot use it
|
|
76
|
+
// directly, many of its blocks may be reusable while reconstructing a seed.
|
|
76
77
|
log('debug', `local basis ${basisSha} unknown to instance; re-seeding basis cache`);
|
|
77
|
-
|
|
78
|
+
staleBasisPath = basisPath;
|
|
78
79
|
}
|
|
79
80
|
const localSha = (await sha256FileHex(apkPath)).toLowerCase();
|
|
80
81
|
if (serverShas.has(localSha)) {
|
|
@@ -87,12 +88,31 @@ export async function bootstrapAndroidBasisCache(apkPath, basisCacheDir, apiUrl,
|
|
|
87
88
|
}
|
|
88
89
|
const seed = seeds[0];
|
|
89
90
|
if (!seed) {
|
|
91
|
+
if (staleBasisPath) {
|
|
92
|
+
await fs.promises.rm(staleBasisPath, { force: true });
|
|
93
|
+
}
|
|
90
94
|
return;
|
|
91
95
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
const seedUrl = buildSyncSeedUrl(apiUrl, seed.sha256);
|
|
97
|
+
try {
|
|
98
|
+
const result = await reconstructSeedFromLocalFiles({
|
|
99
|
+
signatureUrl: `${seedUrl}.sig`,
|
|
100
|
+
seedUrl,
|
|
101
|
+
token,
|
|
102
|
+
sourcePaths: staleBasisPath ? [apkPath, staleBasisPath] : [apkPath],
|
|
103
|
+
outputPath: basisPath,
|
|
104
|
+
expectedSha256: seed.sha256,
|
|
105
|
+
...(onBasisDownloadProgress ? { onProgress: onBasisDownloadProgress } : {}),
|
|
106
|
+
});
|
|
107
|
+
log('debug', `reconstructed Android basis seed ${seed.sha256}: matched=${result.matchedBlocks} downloaded=${result.downloadedBytes}`);
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
log('debug', `basis seed reconstruction unavailable; downloading full seed: ${err instanceof Error ? err.message : String(err)}`);
|
|
111
|
+
// A failed reconstruction never replaces basisPath, so it is safe to
|
|
112
|
+
// truncate the stale basis in place for the full-download fallback.
|
|
113
|
+
onBasisDownloadProgress?.(0, seed.size ?? 0);
|
|
114
|
+
await downloadFileToLocalPath(seedUrl, token, basisPath, onBasisDownloadProgress);
|
|
115
|
+
log('debug', `seeded Android basis cache from full instance seed: ${seed.sha256}`);
|
|
116
|
+
}
|
|
97
117
|
}
|
|
98
118
|
//# sourceMappingURL=android-basis-cache.mjs.map
|