@layerzerolabs/build-utils-rust 1.2.63 → 1.2.65
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/package.json +4 -5
- package/tests/resolve/discover.test.ts +2 -2
- package/tests/resolve/fixtures/mixed-deps.toml +1 -1
- package/tests/resolve/fixtures/oapp-with-stale-deps.toml +1 -1
- package/tests/resolve/fixtures/program-with-deps.toml +1 -1
- package/tests/resolve/fixtures/program-with-macros.toml +2 -2
- package/tests/resolve/fixtures/program-workspace-member.toml +1 -1
- package/tests/resolve/fixtures/with-features.toml +1 -1
- package/tests/resolve/fixtures/workspace-with-path-deps.toml +1 -1
- package/tests/resolve/index.test.ts +21 -16
- package/tests/resolve/rewrite.test.ts +17 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/build-utils-rust",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.65",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"commander": "13.1.0",
|
|
20
20
|
"smol-toml": "^1.7.0",
|
|
21
|
-
"@layerzerolabs/logger-node": "1.2.
|
|
21
|
+
"@layerzerolabs/logger-node": "1.2.65"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^24.13.3",
|
|
25
25
|
"tsup": "^8.4.0",
|
|
26
26
|
"tsx": "^4.21.0",
|
|
27
27
|
"vitest": "^4.1.10",
|
|
28
|
-
"@layerzerolabs/typescript-configuration": "1.2.
|
|
29
|
-
"@layerzerolabs/tsup-configuration": "1.2.
|
|
28
|
+
"@layerzerolabs/typescript-configuration": "1.2.65",
|
|
29
|
+
"@layerzerolabs/tsup-configuration": "1.2.65"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "restricted",
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"externalRepoConfig": {
|
|
36
36
|
"targets": [
|
|
37
37
|
"audit-external",
|
|
38
|
-
"console-solana-v1-internal",
|
|
39
38
|
"everdawn-externalization",
|
|
40
39
|
"gasolina-audit",
|
|
41
40
|
"lz-labs-sidecar",
|
|
@@ -151,13 +151,13 @@ describe('buildDependenciesPathMap', () => {
|
|
|
151
151
|
createCrate(rbac);
|
|
152
152
|
createCrate(oapp);
|
|
153
153
|
const targets = [
|
|
154
|
-
await toTarget('
|
|
154
|
+
await toTarget('rbac-solana-contracts', rbac, depsDir),
|
|
155
155
|
await toTarget('oapp-solana-contracts', oapp, depsDir),
|
|
156
156
|
];
|
|
157
157
|
|
|
158
158
|
const pathMap = buildDependenciesPathMap(targets);
|
|
159
159
|
|
|
160
|
-
expect(pathMap.get(rbac)).toBe(join(depsDir, '
|
|
160
|
+
expect(pathMap.get(rbac)).toBe(join(depsDir, 'rbac-solana-contracts'));
|
|
161
161
|
expect(pathMap.get(oapp)).toBe(join(depsDir, 'oapp-solana-contracts'));
|
|
162
162
|
});
|
|
163
163
|
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
name = "my-program"
|
|
3
3
|
|
|
4
4
|
[dependencies]
|
|
5
|
-
rbac = { path = "../../dependencies/
|
|
6
|
-
rbac-macros = { path = "../../dependencies/
|
|
5
|
+
rbac = { path = "../../dependencies/rbac-solana-contracts" }
|
|
6
|
+
rbac-macros = { path = "../../dependencies/rbac-solana-contracts/macros" }
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
[dependencies]
|
|
2
|
-
rbac = { path = "dependencies/
|
|
2
|
+
rbac = { path = "dependencies/rbac-solana-contracts", features = ["idl-build"] }
|
|
@@ -37,22 +37,22 @@ describe('resolveDependencies — single crate mode', () => {
|
|
|
37
37
|
|
|
38
38
|
createCrate(root, fixture('program-with-deps.toml'));
|
|
39
39
|
|
|
40
|
-
const rbacSource = join(root, 'node_modules', '@layerzerolabs', '
|
|
40
|
+
const rbacSource = join(root, 'node_modules', '@layerzerolabs', 'rbac-solana-contracts');
|
|
41
41
|
createCrate(rbacSource, fixture('minimal.toml'));
|
|
42
42
|
writeFileSync(join(rbacSource, 'package.json'), '{}');
|
|
43
43
|
|
|
44
44
|
await resolveDependencies({ cwd: root });
|
|
45
45
|
|
|
46
|
-
expect(existsSync(join(root, 'dependencies', '
|
|
47
|
-
true,
|
|
48
|
-
);
|
|
49
|
-
expect(existsSync(join(root, 'dependencies', 'utils-solana-rbac', 'src', 'lib.rs'))).toBe(
|
|
46
|
+
expect(existsSync(join(root, 'dependencies', 'rbac-solana-contracts', 'Cargo.toml'))).toBe(
|
|
50
47
|
true,
|
|
51
48
|
);
|
|
49
|
+
expect(
|
|
50
|
+
existsSync(join(root, 'dependencies', 'rbac-solana-contracts', 'src', 'lib.rs')),
|
|
51
|
+
).toBe(true);
|
|
52
52
|
// package.json should NOT be copied
|
|
53
|
-
expect(
|
|
54
|
-
|
|
55
|
-
);
|
|
53
|
+
expect(
|
|
54
|
+
existsSync(join(root, 'dependencies', 'rbac-solana-contracts', 'package.json')),
|
|
55
|
+
).toBe(false);
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
58
|
|
|
@@ -65,13 +65,13 @@ describe('resolveDependencies — workspace mode ([workspace] members)', () => {
|
|
|
65
65
|
const programDir = join(root, 'programs', 'my_program');
|
|
66
66
|
createCrate(programDir, fixture('program-workspace-member.toml'));
|
|
67
67
|
|
|
68
|
-
const rbacSource = join(root, 'node_modules', '@layerzerolabs', '
|
|
68
|
+
const rbacSource = join(root, 'node_modules', '@layerzerolabs', 'rbac-solana-contracts');
|
|
69
69
|
createCrate(rbacSource, fixture('minimal.toml'));
|
|
70
70
|
writeFileSync(join(rbacSource, 'package.json'), '{}');
|
|
71
71
|
|
|
72
72
|
await resolveDependencies({ cwd: root });
|
|
73
73
|
|
|
74
|
-
expect(existsSync(join(root, 'dependencies', '
|
|
74
|
+
expect(existsSync(join(root, 'dependencies', 'rbac-solana-contracts', 'Cargo.toml'))).toBe(
|
|
75
75
|
true,
|
|
76
76
|
);
|
|
77
77
|
expect(existsSync(join(programDir, 'dependencies'))).toBe(false);
|
|
@@ -89,7 +89,12 @@ describe('resolveDependencies — transitive dep rewriting', () => {
|
|
|
89
89
|
createCrate(oappSource, fixture('oapp-with-stale-deps.toml'));
|
|
90
90
|
writeFileSync(join(oappSource, 'package.json'), '{}');
|
|
91
91
|
|
|
92
|
-
const rbacSource = join(
|
|
92
|
+
const rbacSource = join(
|
|
93
|
+
oappSource,
|
|
94
|
+
'node_modules',
|
|
95
|
+
'@layerzerolabs',
|
|
96
|
+
'rbac-solana-contracts',
|
|
97
|
+
);
|
|
93
98
|
createCrate(rbacSource, fixture('minimal.toml'));
|
|
94
99
|
writeFileSync(join(rbacSource, 'package.json'), '{}');
|
|
95
100
|
|
|
@@ -98,7 +103,7 @@ describe('resolveDependencies — transitive dep rewriting', () => {
|
|
|
98
103
|
const copiedOappToml = readToml(
|
|
99
104
|
join(root, 'dependencies', 'oapp-solana-contracts', 'Cargo.toml'),
|
|
100
105
|
);
|
|
101
|
-
expect(copiedOappToml).toContain('path = "../
|
|
106
|
+
expect(copiedOappToml).toContain('path = "../rbac-solana-contracts"');
|
|
102
107
|
});
|
|
103
108
|
|
|
104
109
|
it('strips root-only Cargo tables from copied dependency manifests', async () => {
|
|
@@ -397,7 +402,7 @@ describe('resolveDependencies — excludes integration test dirs from vendored c
|
|
|
397
402
|
const root = join(TMP, 'exclude-integration-tests');
|
|
398
403
|
createCrate(root, fixture('program-with-deps.toml'));
|
|
399
404
|
|
|
400
|
-
const dep = join(root, 'node_modules', '@layerzerolabs', '
|
|
405
|
+
const dep = join(root, 'node_modules', '@layerzerolabs', 'rbac-solana-contracts');
|
|
401
406
|
createCrate(dep, fixture('minimal.toml'));
|
|
402
407
|
writeFileSync(join(dep, 'package.json'), '{}');
|
|
403
408
|
// Both spellings are used across the stellar contracts (hyphen: oft/oft-core;
|
|
@@ -409,7 +414,7 @@ describe('resolveDependencies — excludes integration test dirs from vendored c
|
|
|
409
414
|
|
|
410
415
|
await resolveDependencies({ cwd: root });
|
|
411
416
|
|
|
412
|
-
const vendored = join(root, 'dependencies', '
|
|
417
|
+
const vendored = join(root, 'dependencies', 'rbac-solana-contracts');
|
|
413
418
|
expect(existsSync(join(vendored, 'src', 'lib.rs'))).toBe(true);
|
|
414
419
|
expect(existsSync(join(vendored, 'integration-tests'))).toBe(false);
|
|
415
420
|
expect(existsSync(join(vendored, 'integration_tests'))).toBe(false);
|
|
@@ -421,13 +426,13 @@ describe('resolveDependencies — single-crate consumer (no [workspace])', () =>
|
|
|
421
426
|
const root = join(TMP, 'leaf-consumer');
|
|
422
427
|
createCrate(root, fixture('program-with-deps.toml')); // bare [package], no [workspace]
|
|
423
428
|
|
|
424
|
-
const rbacSource = join(root, 'node_modules', '@layerzerolabs', '
|
|
429
|
+
const rbacSource = join(root, 'node_modules', '@layerzerolabs', 'rbac-solana-contracts');
|
|
425
430
|
createCrate(rbacSource, fixture('minimal.toml'));
|
|
426
431
|
writeFileSync(join(rbacSource, 'package.json'), '{}');
|
|
427
432
|
|
|
428
433
|
await resolveDependencies({ cwd: root });
|
|
429
434
|
|
|
430
|
-
expect(existsSync(join(root, 'dependencies', '
|
|
435
|
+
expect(existsSync(join(root, 'dependencies', 'rbac-solana-contracts', 'Cargo.toml'))).toBe(
|
|
431
436
|
true,
|
|
432
437
|
);
|
|
433
438
|
});
|
|
@@ -41,14 +41,14 @@ describe('rewriteCargoToml', () => {
|
|
|
41
41
|
writeToml(cargoToml, fixture('mixed-deps.toml'));
|
|
42
42
|
|
|
43
43
|
const ctx: RewriteContext = {
|
|
44
|
-
pathMap: new Map([['/real/rbac', join(depsDir, '
|
|
45
|
-
discovered: new Map([['
|
|
44
|
+
pathMap: new Map([['/real/rbac', join(depsDir, 'rbac-solana-contracts')]]),
|
|
45
|
+
discovered: new Map([['rbac-solana-contracts', '/real/rbac']]),
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
await rewriteCargoToml(crateDir, cargoToml, ctx);
|
|
49
49
|
const result = readToml(cargoToml);
|
|
50
50
|
|
|
51
|
-
expect(result).toContain('rbac = { path = "../../dependencies/
|
|
51
|
+
expect(result).toContain('rbac = { path = "../../dependencies/rbac-solana-contracts" }');
|
|
52
52
|
expect(result).toContain('anchor-lang = { version = "0.32.1" }');
|
|
53
53
|
expect(result).toContain('num_enum = { version = "0.7" }');
|
|
54
54
|
});
|
|
@@ -62,17 +62,17 @@ describe('rewriteCargoToml', () => {
|
|
|
62
62
|
|
|
63
63
|
const ctx: RewriteContext = {
|
|
64
64
|
pathMap: new Map([
|
|
65
|
-
['/real/rbac', join(depsDir, '
|
|
66
|
-
['/real/rbac/macros', join(depsDir, '
|
|
65
|
+
['/real/rbac', join(depsDir, 'rbac-solana-contracts')],
|
|
66
|
+
['/real/rbac/macros', join(depsDir, 'rbac-solana-contracts', 'macros')],
|
|
67
67
|
]),
|
|
68
|
-
discovered: new Map([['
|
|
68
|
+
discovered: new Map([['rbac-solana-contracts', '/real/rbac']]),
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
await rewriteCargoToml(crateDir, cargoToml, ctx);
|
|
72
72
|
const result = readToml(cargoToml);
|
|
73
73
|
|
|
74
74
|
expect(result).toContain(
|
|
75
|
-
'rbac-macros = { path = "../../dependencies/
|
|
75
|
+
'rbac-macros = { path = "../../dependencies/rbac-solana-contracts/macros" }',
|
|
76
76
|
);
|
|
77
77
|
});
|
|
78
78
|
|
|
@@ -167,15 +167,15 @@ describe('rewriteCargoToml', () => {
|
|
|
167
167
|
writeToml(cargoToml, fixture('with-features.toml'));
|
|
168
168
|
|
|
169
169
|
const ctx: RewriteContext = {
|
|
170
|
-
pathMap: new Map([['/real/rbac', join(depsDir, '
|
|
171
|
-
discovered: new Map([['
|
|
170
|
+
pathMap: new Map([['/real/rbac', join(depsDir, 'rbac-solana-contracts')]]),
|
|
171
|
+
discovered: new Map([['rbac-solana-contracts', '/real/rbac']]),
|
|
172
172
|
};
|
|
173
173
|
|
|
174
174
|
await rewriteCargoToml(TMP, cargoToml, ctx);
|
|
175
175
|
const result = readToml(cargoToml);
|
|
176
176
|
|
|
177
177
|
expect(result).toContain('features = ["idl-build"]');
|
|
178
|
-
expect(result).toContain('path = "dependencies/
|
|
178
|
+
expect(result).toContain('path = "dependencies/rbac-solana-contracts"');
|
|
179
179
|
});
|
|
180
180
|
|
|
181
181
|
it('does not modify file when no path deps match and no workspace', async () => {
|
|
@@ -240,15 +240,15 @@ describe('rewriteCargoToml', () => {
|
|
|
240
240
|
writeToml(cargoToml, fixture('workspace-with-path-deps.toml'));
|
|
241
241
|
|
|
242
242
|
const ctx: RewriteContext = {
|
|
243
|
-
pathMap: new Map([['/real/rbac', join(depsDir, '
|
|
244
|
-
discovered: new Map([['
|
|
243
|
+
pathMap: new Map([['/real/rbac', join(depsDir, 'rbac-solana-contracts')]]),
|
|
244
|
+
discovered: new Map([['rbac-solana-contracts', '/real/rbac']]),
|
|
245
245
|
};
|
|
246
246
|
|
|
247
247
|
await rewriteCargoToml(TMP, cargoToml, ctx);
|
|
248
248
|
const result = readToml(cargoToml);
|
|
249
249
|
|
|
250
250
|
expect(result).not.toContain('[workspace]');
|
|
251
|
-
expect(result).toContain('path = "dependencies/
|
|
251
|
+
expect(result).toContain('path = "dependencies/rbac-solana-contracts"');
|
|
252
252
|
expect(result).toContain('name = "oapp"');
|
|
253
253
|
});
|
|
254
254
|
|
|
@@ -274,17 +274,17 @@ describe('rewriteCargoToml — path dep syntax variants', () => {
|
|
|
274
274
|
const cargoToml = join(TMP, 'Cargo.toml');
|
|
275
275
|
writeToml(
|
|
276
276
|
cargoToml,
|
|
277
|
-
'[package]\nname = "x"\n\n[dependencies.rbac]\npath = "dependencies/
|
|
277
|
+
'[package]\nname = "x"\n\n[dependencies.rbac]\npath = "dependencies/rbac-solana-contracts"\n',
|
|
278
278
|
);
|
|
279
279
|
|
|
280
280
|
const ctx: RewriteContext = {
|
|
281
|
-
pathMap: new Map([['/real/rbac', join(TMP, 'deps', '
|
|
282
|
-
discovered: new Map([['
|
|
281
|
+
pathMap: new Map([['/real/rbac', join(TMP, 'deps', 'rbac-solana-contracts')]]),
|
|
282
|
+
discovered: new Map([['rbac-solana-contracts', '/real/rbac']]),
|
|
283
283
|
};
|
|
284
284
|
|
|
285
285
|
await rewriteCargoToml(TMP, cargoToml, ctx);
|
|
286
286
|
expect(depPath(readParsed(cargoToml), 'dependencies', 'rbac')).toBe(
|
|
287
|
-
join('deps', '
|
|
287
|
+
join('deps', 'rbac-solana-contracts'),
|
|
288
288
|
);
|
|
289
289
|
});
|
|
290
290
|
|