tegami 1.0.2 → 1.1.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/dist/_accessExpressionAsString-QhbUZzwv.js +44 -0
- package/dist/_assertGuard-BBn2NbSz.js +91 -0
- package/dist/_createStandardSchema-BGQyz-uA.js +89 -0
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/{draft-BqHcSCeX.js → draft-DsxZOCOb.js} +212 -55
- package/dist/{generate-Rvz4Lu98.js → generate-Bg86OJP4.js} +1 -1
- package/dist/generators/simple.d.ts +1 -1
- package/dist/{graph-gThXu8Cz.js → graph-BmXTJZxx.js} +18 -19
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/{npm-5cG02krT.js → npm-BLkgWr-D.js} +289 -42
- package/dist/plugins/cargo.d.ts +1 -1
- package/dist/plugins/cargo.js +583 -159
- package/dist/plugins/git.d.ts +1 -1
- package/dist/plugins/git.js +1 -2
- package/dist/plugins/github.d.ts +1 -1
- package/dist/plugins/github.js +39 -12
- package/dist/plugins/gitlab.d.ts +1 -1
- package/dist/plugins/gitlab.js +2 -2
- package/dist/plugins/go.d.ts +1 -1
- package/dist/plugins/go.js +246 -32
- package/dist/providers/npm.d.ts +1 -1
- package/dist/providers/npm.js +1 -1
- package/dist/shared-C_iSTp_s.js +115 -0
- package/dist/{types-DHddSAez.d.ts → types-VvvN6oyT.d.ts} +258 -377
- package/dist/utils/index.d.ts +5 -1
- package/dist/utils/index.js +2 -2
- package/package.json +7 -3
- package/dist/shared-C92toqVI.js +0 -32
package/dist/plugins/cargo.js
CHANGED
|
@@ -1,77 +1,502 @@
|
|
|
1
1
|
import { n as execFailure } from "../error-BhMYq9iW.js";
|
|
2
|
-
import {
|
|
2
|
+
import { t as _accessExpressionAsString } from "../_accessExpressionAsString-QhbUZzwv.js";
|
|
3
|
+
import { t as _assertGuard } from "../_assertGuard-BBn2NbSz.js";
|
|
4
|
+
import { n as WorkspacePackage } from "../graph-BmXTJZxx.js";
|
|
3
5
|
import { readFile, writeFile } from "node:fs/promises";
|
|
4
6
|
import path from "node:path";
|
|
5
7
|
import { x } from "tinyexec";
|
|
6
8
|
import * as semver$1 from "semver";
|
|
7
|
-
import z from "zod";
|
|
8
9
|
import { glob } from "tinyglobby";
|
|
9
10
|
import initToml, { edit, parse as parse$1 } from "@rainbowatcher/toml-edit-js";
|
|
10
11
|
//#region src/plugins/cargo/schema.ts
|
|
11
|
-
const
|
|
12
|
-
package
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"
|
|
73
|
-
}))
|
|
74
|
-
|
|
12
|
+
const assertCargoManifest = (() => {
|
|
13
|
+
const _io0 = (input) => (void 0 === input["package"] || "object" === typeof input["package"] && null !== input["package"] && _io1(input["package"])) && (void 0 === input.workspace || "object" === typeof input.workspace && null !== input.workspace && false === Array.isArray(input.workspace) && _io3(input.workspace)) && (void 0 === input.dependencies || "object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) && _io5(input.dependencies)) && (void 0 === input["dev-dependencies"] || "object" === typeof input["dev-dependencies"] && null !== input["dev-dependencies"] && false === Array.isArray(input["dev-dependencies"]) && _io5(input["dev-dependencies"])) && (void 0 === input["build-dependencies"] || "object" === typeof input["build-dependencies"] && null !== input["build-dependencies"] && false === Array.isArray(input["build-dependencies"]) && _io5(input["build-dependencies"])) && (void 0 === input.target || "object" === typeof input.target && null !== input.target && false === Array.isArray(input.target) && _io10(input.target));
|
|
14
|
+
const _io1 = (input) => "string" === typeof input.name && null !== input.version && void 0 !== input.version && ("string" === typeof input.version || "object" === typeof input.version && null !== input.version && _io2(input.version)) && null !== input.publish && (void 0 === input.publish || "boolean" === typeof input.publish || "object" === typeof input.publish && null !== input.publish && _io2(input.publish));
|
|
15
|
+
const _io2 = (input) => true === input.workspace;
|
|
16
|
+
const _io3 = (input) => (void 0 === input.members || Array.isArray(input.members) && input.members.every((elem) => "string" === typeof elem)) && (void 0 === input.exclude || Array.isArray(input.exclude) && input.exclude.every((elem) => "string" === typeof elem)) && (void 0 === input["package"] || "object" === typeof input["package"] && null !== input["package"] && false === Array.isArray(input["package"]) && _io4(input["package"])) && (void 0 === input.dependencies || "object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) && _io5(input.dependencies)) && (void 0 === input["dev-dependencies"] || "object" === typeof input["dev-dependencies"] && null !== input["dev-dependencies"] && false === Array.isArray(input["dev-dependencies"]) && _io5(input["dev-dependencies"])) && (void 0 === input["build-dependencies"] || "object" === typeof input["build-dependencies"] && null !== input["build-dependencies"] && false === Array.isArray(input["build-dependencies"]) && _io5(input["build-dependencies"]));
|
|
17
|
+
const _io4 = (input) => (void 0 === input.version || "string" === typeof input.version) && (void 0 === input.publish || "boolean" === typeof input.publish);
|
|
18
|
+
const _io5 = (input) => Object.keys(input).every((key) => {
|
|
19
|
+
const value = input[key];
|
|
20
|
+
if (void 0 === value) return true;
|
|
21
|
+
return null !== value && void 0 !== value && ("string" === typeof value || "object" === typeof value && null !== value && _iu0(value));
|
|
22
|
+
});
|
|
23
|
+
const _io6 = (input) => true === input.workspace && (void 0 === input["package"] || "string" === typeof input["package"]) && (void 0 === input.features || Array.isArray(input.features) && input.features.every((elem) => "string" === typeof elem)) && (void 0 === input.optional || "boolean" === typeof input.optional) && (void 0 === input["default-features"] || "boolean" === typeof input["default-features"]);
|
|
24
|
+
const _io7 = (input) => "string" === typeof input.path && (void 0 === input.version || "string" === typeof input.version) && (void 0 === input["package"] || "string" === typeof input["package"]) && (void 0 === input.features || Array.isArray(input.features) && input.features.every((elem) => "string" === typeof elem)) && (void 0 === input.optional || "boolean" === typeof input.optional) && (void 0 === input["default-features"] || "boolean" === typeof input["default-features"]);
|
|
25
|
+
const _io8 = (input) => "string" === typeof input.git && (void 0 === input.branch || "string" === typeof input.branch) && (void 0 === input.tag || "string" === typeof input.tag) && (void 0 === input.rev || "string" === typeof input.rev) && (void 0 === input.version || "string" === typeof input.version) && (void 0 === input["package"] || "string" === typeof input["package"]) && (void 0 === input.features || Array.isArray(input.features) && input.features.every((elem) => "string" === typeof elem)) && (void 0 === input.optional || "boolean" === typeof input.optional) && (void 0 === input["default-features"] || "boolean" === typeof input["default-features"]);
|
|
26
|
+
const _io9 = (input) => "string" === typeof input.version && (void 0 === input.registry || "string" === typeof input.registry) && (void 0 === input["package"] || "string" === typeof input["package"]) && (void 0 === input.features || Array.isArray(input.features) && input.features.every((elem) => "string" === typeof elem)) && (void 0 === input.optional || "boolean" === typeof input.optional) && (void 0 === input["default-features"] || "boolean" === typeof input["default-features"]);
|
|
27
|
+
const _io10 = (input) => Object.keys(input).every((key) => {
|
|
28
|
+
const value = input[key];
|
|
29
|
+
if (void 0 === value) return true;
|
|
30
|
+
return "object" === typeof value && null !== value && false === Array.isArray(value) && _io11(value);
|
|
31
|
+
});
|
|
32
|
+
const _io11 = (input) => (void 0 === input.dependencies || "object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) && _io5(input.dependencies)) && (void 0 === input["dev-dependencies"] || "object" === typeof input["dev-dependencies"] && null !== input["dev-dependencies"] && false === Array.isArray(input["dev-dependencies"]) && _io5(input["dev-dependencies"])) && (void 0 === input["build-dependencies"] || "object" === typeof input["build-dependencies"] && null !== input["build-dependencies"] && false === Array.isArray(input["build-dependencies"]) && _io5(input["build-dependencies"]));
|
|
33
|
+
const _iu0 = (input) => (() => {
|
|
34
|
+
if (void 0 !== input.workspace) return _io6(input);
|
|
35
|
+
else if (void 0 !== input.path) return _io7(input);
|
|
36
|
+
else if (void 0 !== input.git) return _io8(input);
|
|
37
|
+
else return _io9(input);
|
|
38
|
+
})();
|
|
39
|
+
const _ao0 = (input, _path, _exceptionable = true) => (void 0 === input["package"] || ("object" === typeof input["package"] && null !== input["package"] || _assertGuard(_exceptionable, {
|
|
40
|
+
method: "typia.createAssert",
|
|
41
|
+
path: _path + "[\"package\"]",
|
|
42
|
+
expected: "(__type | undefined)",
|
|
43
|
+
value: input["package"]
|
|
44
|
+
}, _errorFactory)) && _ao1(input["package"], _path + "[\"package\"]", _exceptionable) || _assertGuard(_exceptionable, {
|
|
45
|
+
method: "typia.createAssert",
|
|
46
|
+
path: _path + "[\"package\"]",
|
|
47
|
+
expected: "(__type | undefined)",
|
|
48
|
+
value: input["package"]
|
|
49
|
+
}, _errorFactory)) && (void 0 === input.workspace || ("object" === typeof input.workspace && null !== input.workspace && false === Array.isArray(input.workspace) || _assertGuard(_exceptionable, {
|
|
50
|
+
method: "typia.createAssert",
|
|
51
|
+
path: _path + ".workspace",
|
|
52
|
+
expected: "(CargoWorkspace | undefined)",
|
|
53
|
+
value: input.workspace
|
|
54
|
+
}, _errorFactory)) && _ao3(input.workspace, _path + ".workspace", _exceptionable) || _assertGuard(_exceptionable, {
|
|
55
|
+
method: "typia.createAssert",
|
|
56
|
+
path: _path + ".workspace",
|
|
57
|
+
expected: "(CargoWorkspace | undefined)",
|
|
58
|
+
value: input.workspace
|
|
59
|
+
}, _errorFactory)) && (void 0 === input.dependencies || ("object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) || _assertGuard(_exceptionable, {
|
|
60
|
+
method: "typia.createAssert",
|
|
61
|
+
path: _path + ".dependencies",
|
|
62
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
63
|
+
value: input.dependencies
|
|
64
|
+
}, _errorFactory)) && _ao5(input.dependencies, _path + ".dependencies", _exceptionable) || _assertGuard(_exceptionable, {
|
|
65
|
+
method: "typia.createAssert",
|
|
66
|
+
path: _path + ".dependencies",
|
|
67
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
68
|
+
value: input.dependencies
|
|
69
|
+
}, _errorFactory)) && (void 0 === input["dev-dependencies"] || ("object" === typeof input["dev-dependencies"] && null !== input["dev-dependencies"] && false === Array.isArray(input["dev-dependencies"]) || _assertGuard(_exceptionable, {
|
|
70
|
+
method: "typia.createAssert",
|
|
71
|
+
path: _path + "[\"dev-dependencies\"]",
|
|
72
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
73
|
+
value: input["dev-dependencies"]
|
|
74
|
+
}, _errorFactory)) && _ao5(input["dev-dependencies"], _path + "[\"dev-dependencies\"]", _exceptionable) || _assertGuard(_exceptionable, {
|
|
75
|
+
method: "typia.createAssert",
|
|
76
|
+
path: _path + "[\"dev-dependencies\"]",
|
|
77
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
78
|
+
value: input["dev-dependencies"]
|
|
79
|
+
}, _errorFactory)) && (void 0 === input["build-dependencies"] || ("object" === typeof input["build-dependencies"] && null !== input["build-dependencies"] && false === Array.isArray(input["build-dependencies"]) || _assertGuard(_exceptionable, {
|
|
80
|
+
method: "typia.createAssert",
|
|
81
|
+
path: _path + "[\"build-dependencies\"]",
|
|
82
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
83
|
+
value: input["build-dependencies"]
|
|
84
|
+
}, _errorFactory)) && _ao5(input["build-dependencies"], _path + "[\"build-dependencies\"]", _exceptionable) || _assertGuard(_exceptionable, {
|
|
85
|
+
method: "typia.createAssert",
|
|
86
|
+
path: _path + "[\"build-dependencies\"]",
|
|
87
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
88
|
+
value: input["build-dependencies"]
|
|
89
|
+
}, _errorFactory)) && (void 0 === input.target || ("object" === typeof input.target && null !== input.target && false === Array.isArray(input.target) || _assertGuard(_exceptionable, {
|
|
90
|
+
method: "typia.createAssert",
|
|
91
|
+
path: _path + ".target",
|
|
92
|
+
expected: "(Record<string, CargoTargetSection> | undefined)",
|
|
93
|
+
value: input.target
|
|
94
|
+
}, _errorFactory)) && _ao10(input.target, _path + ".target", _exceptionable) || _assertGuard(_exceptionable, {
|
|
95
|
+
method: "typia.createAssert",
|
|
96
|
+
path: _path + ".target",
|
|
97
|
+
expected: "(Record<string, CargoTargetSection> | undefined)",
|
|
98
|
+
value: input.target
|
|
99
|
+
}, _errorFactory));
|
|
100
|
+
const _ao1 = (input, _path, _exceptionable = true) => ("string" === typeof input.name || _assertGuard(_exceptionable, {
|
|
101
|
+
method: "typia.createAssert",
|
|
102
|
+
path: _path + ".name",
|
|
103
|
+
expected: "string",
|
|
104
|
+
value: input.name
|
|
105
|
+
}, _errorFactory)) && (null !== input.version || _assertGuard(_exceptionable, {
|
|
106
|
+
method: "typia.createAssert",
|
|
107
|
+
path: _path + ".version",
|
|
108
|
+
expected: "(CargoInherit | string)",
|
|
109
|
+
value: input.version
|
|
110
|
+
}, _errorFactory)) && (void 0 !== input.version || _assertGuard(_exceptionable, {
|
|
111
|
+
method: "typia.createAssert",
|
|
112
|
+
path: _path + ".version",
|
|
113
|
+
expected: "(CargoInherit | string)",
|
|
114
|
+
value: input.version
|
|
115
|
+
}, _errorFactory)) && ("string" === typeof input.version || ("object" === typeof input.version && null !== input.version || _assertGuard(_exceptionable, {
|
|
116
|
+
method: "typia.createAssert",
|
|
117
|
+
path: _path + ".version",
|
|
118
|
+
expected: "(CargoInherit | string)",
|
|
119
|
+
value: input.version
|
|
120
|
+
}, _errorFactory)) && _ao2(input.version, _path + ".version", _exceptionable) || _assertGuard(_exceptionable, {
|
|
121
|
+
method: "typia.createAssert",
|
|
122
|
+
path: _path + ".version",
|
|
123
|
+
expected: "(CargoInherit | string)",
|
|
124
|
+
value: input.version
|
|
125
|
+
}, _errorFactory)) && (null !== input.publish || _assertGuard(_exceptionable, {
|
|
126
|
+
method: "typia.createAssert",
|
|
127
|
+
path: _path + ".publish",
|
|
128
|
+
expected: "(CargoInherit | boolean | undefined)",
|
|
129
|
+
value: input.publish
|
|
130
|
+
}, _errorFactory)) && (void 0 === input.publish || "boolean" === typeof input.publish || ("object" === typeof input.publish && null !== input.publish || _assertGuard(_exceptionable, {
|
|
131
|
+
method: "typia.createAssert",
|
|
132
|
+
path: _path + ".publish",
|
|
133
|
+
expected: "(CargoInherit | boolean | undefined)",
|
|
134
|
+
value: input.publish
|
|
135
|
+
}, _errorFactory)) && _ao2(input.publish, _path + ".publish", _exceptionable) || _assertGuard(_exceptionable, {
|
|
136
|
+
method: "typia.createAssert",
|
|
137
|
+
path: _path + ".publish",
|
|
138
|
+
expected: "(CargoInherit | boolean | undefined)",
|
|
139
|
+
value: input.publish
|
|
140
|
+
}, _errorFactory));
|
|
141
|
+
const _ao2 = (input, _path, _exceptionable = true) => true === input.workspace || _assertGuard(_exceptionable, {
|
|
142
|
+
method: "typia.createAssert",
|
|
143
|
+
path: _path + ".workspace",
|
|
144
|
+
expected: "true",
|
|
145
|
+
value: input.workspace
|
|
146
|
+
}, _errorFactory);
|
|
147
|
+
const _ao3 = (input, _path, _exceptionable = true) => (void 0 === input.members || (Array.isArray(input.members) || _assertGuard(_exceptionable, {
|
|
148
|
+
method: "typia.createAssert",
|
|
149
|
+
path: _path + ".members",
|
|
150
|
+
expected: "(Array<string> | undefined)",
|
|
151
|
+
value: input.members
|
|
152
|
+
}, _errorFactory)) && input.members.every((elem, _index7) => "string" === typeof elem || _assertGuard(_exceptionable, {
|
|
153
|
+
method: "typia.createAssert",
|
|
154
|
+
path: _path + ".members[" + _index7 + "]",
|
|
155
|
+
expected: "string",
|
|
156
|
+
value: elem
|
|
157
|
+
}, _errorFactory)) || _assertGuard(_exceptionable, {
|
|
158
|
+
method: "typia.createAssert",
|
|
159
|
+
path: _path + ".members",
|
|
160
|
+
expected: "(Array<string> | undefined)",
|
|
161
|
+
value: input.members
|
|
162
|
+
}, _errorFactory)) && (void 0 === input.exclude || (Array.isArray(input.exclude) || _assertGuard(_exceptionable, {
|
|
163
|
+
method: "typia.createAssert",
|
|
164
|
+
path: _path + ".exclude",
|
|
165
|
+
expected: "(Array<string> | undefined)",
|
|
166
|
+
value: input.exclude
|
|
167
|
+
}, _errorFactory)) && input.exclude.every((elem, _index8) => "string" === typeof elem || _assertGuard(_exceptionable, {
|
|
168
|
+
method: "typia.createAssert",
|
|
169
|
+
path: _path + ".exclude[" + _index8 + "]",
|
|
170
|
+
expected: "string",
|
|
171
|
+
value: elem
|
|
172
|
+
}, _errorFactory)) || _assertGuard(_exceptionable, {
|
|
173
|
+
method: "typia.createAssert",
|
|
174
|
+
path: _path + ".exclude",
|
|
175
|
+
expected: "(Array<string> | undefined)",
|
|
176
|
+
value: input.exclude
|
|
177
|
+
}, _errorFactory)) && (void 0 === input["package"] || ("object" === typeof input["package"] && null !== input["package"] && false === Array.isArray(input["package"]) || _assertGuard(_exceptionable, {
|
|
178
|
+
method: "typia.createAssert",
|
|
179
|
+
path: _path + "[\"package\"]",
|
|
180
|
+
expected: "(__type.o1 | undefined)",
|
|
181
|
+
value: input["package"]
|
|
182
|
+
}, _errorFactory)) && _ao4(input["package"], _path + "[\"package\"]", _exceptionable) || _assertGuard(_exceptionable, {
|
|
183
|
+
method: "typia.createAssert",
|
|
184
|
+
path: _path + "[\"package\"]",
|
|
185
|
+
expected: "(__type.o1 | undefined)",
|
|
186
|
+
value: input["package"]
|
|
187
|
+
}, _errorFactory)) && (void 0 === input.dependencies || ("object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) || _assertGuard(_exceptionable, {
|
|
188
|
+
method: "typia.createAssert",
|
|
189
|
+
path: _path + ".dependencies",
|
|
190
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
191
|
+
value: input.dependencies
|
|
192
|
+
}, _errorFactory)) && _ao5(input.dependencies, _path + ".dependencies", _exceptionable) || _assertGuard(_exceptionable, {
|
|
193
|
+
method: "typia.createAssert",
|
|
194
|
+
path: _path + ".dependencies",
|
|
195
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
196
|
+
value: input.dependencies
|
|
197
|
+
}, _errorFactory)) && (void 0 === input["dev-dependencies"] || ("object" === typeof input["dev-dependencies"] && null !== input["dev-dependencies"] && false === Array.isArray(input["dev-dependencies"]) || _assertGuard(_exceptionable, {
|
|
198
|
+
method: "typia.createAssert",
|
|
199
|
+
path: _path + "[\"dev-dependencies\"]",
|
|
200
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
201
|
+
value: input["dev-dependencies"]
|
|
202
|
+
}, _errorFactory)) && _ao5(input["dev-dependencies"], _path + "[\"dev-dependencies\"]", _exceptionable) || _assertGuard(_exceptionable, {
|
|
203
|
+
method: "typia.createAssert",
|
|
204
|
+
path: _path + "[\"dev-dependencies\"]",
|
|
205
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
206
|
+
value: input["dev-dependencies"]
|
|
207
|
+
}, _errorFactory)) && (void 0 === input["build-dependencies"] || ("object" === typeof input["build-dependencies"] && null !== input["build-dependencies"] && false === Array.isArray(input["build-dependencies"]) || _assertGuard(_exceptionable, {
|
|
208
|
+
method: "typia.createAssert",
|
|
209
|
+
path: _path + "[\"build-dependencies\"]",
|
|
210
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
211
|
+
value: input["build-dependencies"]
|
|
212
|
+
}, _errorFactory)) && _ao5(input["build-dependencies"], _path + "[\"build-dependencies\"]", _exceptionable) || _assertGuard(_exceptionable, {
|
|
213
|
+
method: "typia.createAssert",
|
|
214
|
+
path: _path + "[\"build-dependencies\"]",
|
|
215
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
216
|
+
value: input["build-dependencies"]
|
|
217
|
+
}, _errorFactory));
|
|
218
|
+
const _ao4 = (input, _path, _exceptionable = true) => (void 0 === input.version || "string" === typeof input.version || _assertGuard(_exceptionable, {
|
|
219
|
+
method: "typia.createAssert",
|
|
220
|
+
path: _path + ".version",
|
|
221
|
+
expected: "(string | undefined)",
|
|
222
|
+
value: input.version
|
|
223
|
+
}, _errorFactory)) && (void 0 === input.publish || "boolean" === typeof input.publish || _assertGuard(_exceptionable, {
|
|
224
|
+
method: "typia.createAssert",
|
|
225
|
+
path: _path + ".publish",
|
|
226
|
+
expected: "(boolean | undefined)",
|
|
227
|
+
value: input.publish
|
|
228
|
+
}, _errorFactory));
|
|
229
|
+
const _ao5 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every((key) => {
|
|
230
|
+
const value = input[key];
|
|
231
|
+
if (void 0 === value) return true;
|
|
232
|
+
return (null !== value || _assertGuard(_exceptionable, {
|
|
233
|
+
method: "typia.createAssert",
|
|
234
|
+
path: _path + _accessExpressionAsString(key),
|
|
235
|
+
expected: "(CargoGitDependency | CargoPathDependency | CargoRegistryDependency | CargoWorkspaceDependency | string)",
|
|
236
|
+
value
|
|
237
|
+
}, _errorFactory)) && (void 0 !== value || _assertGuard(_exceptionable, {
|
|
238
|
+
method: "typia.createAssert",
|
|
239
|
+
path: _path + _accessExpressionAsString(key),
|
|
240
|
+
expected: "(CargoGitDependency | CargoPathDependency | CargoRegistryDependency | CargoWorkspaceDependency | string)",
|
|
241
|
+
value
|
|
242
|
+
}, _errorFactory)) && ("string" === typeof value || ("object" === typeof value && null !== value || _assertGuard(_exceptionable, {
|
|
243
|
+
method: "typia.createAssert",
|
|
244
|
+
path: _path + _accessExpressionAsString(key),
|
|
245
|
+
expected: "(CargoGitDependency | CargoPathDependency | CargoRegistryDependency | CargoWorkspaceDependency | string)",
|
|
246
|
+
value
|
|
247
|
+
}, _errorFactory)) && _au0(value, _path + _accessExpressionAsString(key), _exceptionable) || _assertGuard(_exceptionable, {
|
|
248
|
+
method: "typia.createAssert",
|
|
249
|
+
path: _path + _accessExpressionAsString(key),
|
|
250
|
+
expected: "(CargoGitDependency | CargoPathDependency | CargoRegistryDependency | CargoWorkspaceDependency | string)",
|
|
251
|
+
value
|
|
252
|
+
}, _errorFactory));
|
|
253
|
+
});
|
|
254
|
+
const _ao6 = (input, _path, _exceptionable = true) => (true === input.workspace || _assertGuard(_exceptionable, {
|
|
255
|
+
method: "typia.createAssert",
|
|
256
|
+
path: _path + ".workspace",
|
|
257
|
+
expected: "true",
|
|
258
|
+
value: input.workspace
|
|
259
|
+
}, _errorFactory)) && (void 0 === input["package"] || "string" === typeof input["package"] || _assertGuard(_exceptionable, {
|
|
260
|
+
method: "typia.createAssert",
|
|
261
|
+
path: _path + "[\"package\"]",
|
|
262
|
+
expected: "(string | undefined)",
|
|
263
|
+
value: input["package"]
|
|
264
|
+
}, _errorFactory)) && (void 0 === input.features || (Array.isArray(input.features) || _assertGuard(_exceptionable, {
|
|
265
|
+
method: "typia.createAssert",
|
|
266
|
+
path: _path + ".features",
|
|
267
|
+
expected: "(Array<string> | undefined)",
|
|
268
|
+
value: input.features
|
|
269
|
+
}, _errorFactory)) && input.features.every((elem, _index9) => "string" === typeof elem || _assertGuard(_exceptionable, {
|
|
270
|
+
method: "typia.createAssert",
|
|
271
|
+
path: _path + ".features[" + _index9 + "]",
|
|
272
|
+
expected: "string",
|
|
273
|
+
value: elem
|
|
274
|
+
}, _errorFactory)) || _assertGuard(_exceptionable, {
|
|
275
|
+
method: "typia.createAssert",
|
|
276
|
+
path: _path + ".features",
|
|
277
|
+
expected: "(Array<string> | undefined)",
|
|
278
|
+
value: input.features
|
|
279
|
+
}, _errorFactory)) && (void 0 === input.optional || "boolean" === typeof input.optional || _assertGuard(_exceptionable, {
|
|
280
|
+
method: "typia.createAssert",
|
|
281
|
+
path: _path + ".optional",
|
|
282
|
+
expected: "(boolean | undefined)",
|
|
283
|
+
value: input.optional
|
|
284
|
+
}, _errorFactory)) && (void 0 === input["default-features"] || "boolean" === typeof input["default-features"] || _assertGuard(_exceptionable, {
|
|
285
|
+
method: "typia.createAssert",
|
|
286
|
+
path: _path + "[\"default-features\"]",
|
|
287
|
+
expected: "(boolean | undefined)",
|
|
288
|
+
value: input["default-features"]
|
|
289
|
+
}, _errorFactory));
|
|
290
|
+
const _ao7 = (input, _path, _exceptionable = true) => ("string" === typeof input.path || _assertGuard(_exceptionable, {
|
|
291
|
+
method: "typia.createAssert",
|
|
292
|
+
path: _path + ".path",
|
|
293
|
+
expected: "string",
|
|
294
|
+
value: input.path
|
|
295
|
+
}, _errorFactory)) && (void 0 === input.version || "string" === typeof input.version || _assertGuard(_exceptionable, {
|
|
296
|
+
method: "typia.createAssert",
|
|
297
|
+
path: _path + ".version",
|
|
298
|
+
expected: "(string | undefined)",
|
|
299
|
+
value: input.version
|
|
300
|
+
}, _errorFactory)) && (void 0 === input["package"] || "string" === typeof input["package"] || _assertGuard(_exceptionable, {
|
|
301
|
+
method: "typia.createAssert",
|
|
302
|
+
path: _path + "[\"package\"]",
|
|
303
|
+
expected: "(string | undefined)",
|
|
304
|
+
value: input["package"]
|
|
305
|
+
}, _errorFactory)) && (void 0 === input.features || (Array.isArray(input.features) || _assertGuard(_exceptionable, {
|
|
306
|
+
method: "typia.createAssert",
|
|
307
|
+
path: _path + ".features",
|
|
308
|
+
expected: "(Array<string> | undefined)",
|
|
309
|
+
value: input.features
|
|
310
|
+
}, _errorFactory)) && input.features.every((elem, _index10) => "string" === typeof elem || _assertGuard(_exceptionable, {
|
|
311
|
+
method: "typia.createAssert",
|
|
312
|
+
path: _path + ".features[" + _index10 + "]",
|
|
313
|
+
expected: "string",
|
|
314
|
+
value: elem
|
|
315
|
+
}, _errorFactory)) || _assertGuard(_exceptionable, {
|
|
316
|
+
method: "typia.createAssert",
|
|
317
|
+
path: _path + ".features",
|
|
318
|
+
expected: "(Array<string> | undefined)",
|
|
319
|
+
value: input.features
|
|
320
|
+
}, _errorFactory)) && (void 0 === input.optional || "boolean" === typeof input.optional || _assertGuard(_exceptionable, {
|
|
321
|
+
method: "typia.createAssert",
|
|
322
|
+
path: _path + ".optional",
|
|
323
|
+
expected: "(boolean | undefined)",
|
|
324
|
+
value: input.optional
|
|
325
|
+
}, _errorFactory)) && (void 0 === input["default-features"] || "boolean" === typeof input["default-features"] || _assertGuard(_exceptionable, {
|
|
326
|
+
method: "typia.createAssert",
|
|
327
|
+
path: _path + "[\"default-features\"]",
|
|
328
|
+
expected: "(boolean | undefined)",
|
|
329
|
+
value: input["default-features"]
|
|
330
|
+
}, _errorFactory));
|
|
331
|
+
const _ao8 = (input, _path, _exceptionable = true) => ("string" === typeof input.git || _assertGuard(_exceptionable, {
|
|
332
|
+
method: "typia.createAssert",
|
|
333
|
+
path: _path + ".git",
|
|
334
|
+
expected: "string",
|
|
335
|
+
value: input.git
|
|
336
|
+
}, _errorFactory)) && (void 0 === input.branch || "string" === typeof input.branch || _assertGuard(_exceptionable, {
|
|
337
|
+
method: "typia.createAssert",
|
|
338
|
+
path: _path + ".branch",
|
|
339
|
+
expected: "(string | undefined)",
|
|
340
|
+
value: input.branch
|
|
341
|
+
}, _errorFactory)) && (void 0 === input.tag || "string" === typeof input.tag || _assertGuard(_exceptionable, {
|
|
342
|
+
method: "typia.createAssert",
|
|
343
|
+
path: _path + ".tag",
|
|
344
|
+
expected: "(string | undefined)",
|
|
345
|
+
value: input.tag
|
|
346
|
+
}, _errorFactory)) && (void 0 === input.rev || "string" === typeof input.rev || _assertGuard(_exceptionable, {
|
|
347
|
+
method: "typia.createAssert",
|
|
348
|
+
path: _path + ".rev",
|
|
349
|
+
expected: "(string | undefined)",
|
|
350
|
+
value: input.rev
|
|
351
|
+
}, _errorFactory)) && (void 0 === input.version || "string" === typeof input.version || _assertGuard(_exceptionable, {
|
|
352
|
+
method: "typia.createAssert",
|
|
353
|
+
path: _path + ".version",
|
|
354
|
+
expected: "(string | undefined)",
|
|
355
|
+
value: input.version
|
|
356
|
+
}, _errorFactory)) && (void 0 === input["package"] || "string" === typeof input["package"] || _assertGuard(_exceptionable, {
|
|
357
|
+
method: "typia.createAssert",
|
|
358
|
+
path: _path + "[\"package\"]",
|
|
359
|
+
expected: "(string | undefined)",
|
|
360
|
+
value: input["package"]
|
|
361
|
+
}, _errorFactory)) && (void 0 === input.features || (Array.isArray(input.features) || _assertGuard(_exceptionable, {
|
|
362
|
+
method: "typia.createAssert",
|
|
363
|
+
path: _path + ".features",
|
|
364
|
+
expected: "(Array<string> | undefined)",
|
|
365
|
+
value: input.features
|
|
366
|
+
}, _errorFactory)) && input.features.every((elem, _index11) => "string" === typeof elem || _assertGuard(_exceptionable, {
|
|
367
|
+
method: "typia.createAssert",
|
|
368
|
+
path: _path + ".features[" + _index11 + "]",
|
|
369
|
+
expected: "string",
|
|
370
|
+
value: elem
|
|
371
|
+
}, _errorFactory)) || _assertGuard(_exceptionable, {
|
|
372
|
+
method: "typia.createAssert",
|
|
373
|
+
path: _path + ".features",
|
|
374
|
+
expected: "(Array<string> | undefined)",
|
|
375
|
+
value: input.features
|
|
376
|
+
}, _errorFactory)) && (void 0 === input.optional || "boolean" === typeof input.optional || _assertGuard(_exceptionable, {
|
|
377
|
+
method: "typia.createAssert",
|
|
378
|
+
path: _path + ".optional",
|
|
379
|
+
expected: "(boolean | undefined)",
|
|
380
|
+
value: input.optional
|
|
381
|
+
}, _errorFactory)) && (void 0 === input["default-features"] || "boolean" === typeof input["default-features"] || _assertGuard(_exceptionable, {
|
|
382
|
+
method: "typia.createAssert",
|
|
383
|
+
path: _path + "[\"default-features\"]",
|
|
384
|
+
expected: "(boolean | undefined)",
|
|
385
|
+
value: input["default-features"]
|
|
386
|
+
}, _errorFactory));
|
|
387
|
+
const _ao9 = (input, _path, _exceptionable = true) => ("string" === typeof input.version || _assertGuard(_exceptionable, {
|
|
388
|
+
method: "typia.createAssert",
|
|
389
|
+
path: _path + ".version",
|
|
390
|
+
expected: "string",
|
|
391
|
+
value: input.version
|
|
392
|
+
}, _errorFactory)) && (void 0 === input.registry || "string" === typeof input.registry || _assertGuard(_exceptionable, {
|
|
393
|
+
method: "typia.createAssert",
|
|
394
|
+
path: _path + ".registry",
|
|
395
|
+
expected: "(string | undefined)",
|
|
396
|
+
value: input.registry
|
|
397
|
+
}, _errorFactory)) && (void 0 === input["package"] || "string" === typeof input["package"] || _assertGuard(_exceptionable, {
|
|
398
|
+
method: "typia.createAssert",
|
|
399
|
+
path: _path + "[\"package\"]",
|
|
400
|
+
expected: "(string | undefined)",
|
|
401
|
+
value: input["package"]
|
|
402
|
+
}, _errorFactory)) && (void 0 === input.features || (Array.isArray(input.features) || _assertGuard(_exceptionable, {
|
|
403
|
+
method: "typia.createAssert",
|
|
404
|
+
path: _path + ".features",
|
|
405
|
+
expected: "(Array<string> | undefined)",
|
|
406
|
+
value: input.features
|
|
407
|
+
}, _errorFactory)) && input.features.every((elem, _index12) => "string" === typeof elem || _assertGuard(_exceptionable, {
|
|
408
|
+
method: "typia.createAssert",
|
|
409
|
+
path: _path + ".features[" + _index12 + "]",
|
|
410
|
+
expected: "string",
|
|
411
|
+
value: elem
|
|
412
|
+
}, _errorFactory)) || _assertGuard(_exceptionable, {
|
|
413
|
+
method: "typia.createAssert",
|
|
414
|
+
path: _path + ".features",
|
|
415
|
+
expected: "(Array<string> | undefined)",
|
|
416
|
+
value: input.features
|
|
417
|
+
}, _errorFactory)) && (void 0 === input.optional || "boolean" === typeof input.optional || _assertGuard(_exceptionable, {
|
|
418
|
+
method: "typia.createAssert",
|
|
419
|
+
path: _path + ".optional",
|
|
420
|
+
expected: "(boolean | undefined)",
|
|
421
|
+
value: input.optional
|
|
422
|
+
}, _errorFactory)) && (void 0 === input["default-features"] || "boolean" === typeof input["default-features"] || _assertGuard(_exceptionable, {
|
|
423
|
+
method: "typia.createAssert",
|
|
424
|
+
path: _path + "[\"default-features\"]",
|
|
425
|
+
expected: "(boolean | undefined)",
|
|
426
|
+
value: input["default-features"]
|
|
427
|
+
}, _errorFactory));
|
|
428
|
+
const _ao10 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every((key) => {
|
|
429
|
+
const value = input[key];
|
|
430
|
+
if (void 0 === value) return true;
|
|
431
|
+
return ("object" === typeof value && null !== value && false === Array.isArray(value) || _assertGuard(_exceptionable, {
|
|
432
|
+
method: "typia.createAssert",
|
|
433
|
+
path: _path + _accessExpressionAsString(key),
|
|
434
|
+
expected: "CargoTargetSection",
|
|
435
|
+
value
|
|
436
|
+
}, _errorFactory)) && _ao11(value, _path + _accessExpressionAsString(key), _exceptionable) || _assertGuard(_exceptionable, {
|
|
437
|
+
method: "typia.createAssert",
|
|
438
|
+
path: _path + _accessExpressionAsString(key),
|
|
439
|
+
expected: "CargoTargetSection",
|
|
440
|
+
value
|
|
441
|
+
}, _errorFactory);
|
|
442
|
+
});
|
|
443
|
+
const _ao11 = (input, _path, _exceptionable = true) => (void 0 === input.dependencies || ("object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) || _assertGuard(_exceptionable, {
|
|
444
|
+
method: "typia.createAssert",
|
|
445
|
+
path: _path + ".dependencies",
|
|
446
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
447
|
+
value: input.dependencies
|
|
448
|
+
}, _errorFactory)) && _ao5(input.dependencies, _path + ".dependencies", _exceptionable) || _assertGuard(_exceptionable, {
|
|
449
|
+
method: "typia.createAssert",
|
|
450
|
+
path: _path + ".dependencies",
|
|
451
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
452
|
+
value: input.dependencies
|
|
453
|
+
}, _errorFactory)) && (void 0 === input["dev-dependencies"] || ("object" === typeof input["dev-dependencies"] && null !== input["dev-dependencies"] && false === Array.isArray(input["dev-dependencies"]) || _assertGuard(_exceptionable, {
|
|
454
|
+
method: "typia.createAssert",
|
|
455
|
+
path: _path + "[\"dev-dependencies\"]",
|
|
456
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
457
|
+
value: input["dev-dependencies"]
|
|
458
|
+
}, _errorFactory)) && _ao5(input["dev-dependencies"], _path + "[\"dev-dependencies\"]", _exceptionable) || _assertGuard(_exceptionable, {
|
|
459
|
+
method: "typia.createAssert",
|
|
460
|
+
path: _path + "[\"dev-dependencies\"]",
|
|
461
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
462
|
+
value: input["dev-dependencies"]
|
|
463
|
+
}, _errorFactory)) && (void 0 === input["build-dependencies"] || ("object" === typeof input["build-dependencies"] && null !== input["build-dependencies"] && false === Array.isArray(input["build-dependencies"]) || _assertGuard(_exceptionable, {
|
|
464
|
+
method: "typia.createAssert",
|
|
465
|
+
path: _path + "[\"build-dependencies\"]",
|
|
466
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
467
|
+
value: input["build-dependencies"]
|
|
468
|
+
}, _errorFactory)) && _ao5(input["build-dependencies"], _path + "[\"build-dependencies\"]", _exceptionable) || _assertGuard(_exceptionable, {
|
|
469
|
+
method: "typia.createAssert",
|
|
470
|
+
path: _path + "[\"build-dependencies\"]",
|
|
471
|
+
expected: "(Record<string, CargoDependency> | undefined)",
|
|
472
|
+
value: input["build-dependencies"]
|
|
473
|
+
}, _errorFactory));
|
|
474
|
+
const _au0 = (input, _path, _exceptionable = true) => (() => {
|
|
475
|
+
if (void 0 !== input.workspace) return _ao6(input, _path, _exceptionable);
|
|
476
|
+
else if (void 0 !== input.path) return _ao7(input, _path, _exceptionable);
|
|
477
|
+
else if (void 0 !== input.git) return _ao8(input, _path, _exceptionable);
|
|
478
|
+
else return _ao9(input, _path, _exceptionable);
|
|
479
|
+
})();
|
|
480
|
+
const __is = (input) => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
481
|
+
let _errorFactory;
|
|
482
|
+
return (input, errorFactory) => {
|
|
483
|
+
if (false === __is(input)) {
|
|
484
|
+
_errorFactory = errorFactory;
|
|
485
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input && false === Array.isArray(input) || _assertGuard(true, {
|
|
486
|
+
method: "typia.createAssert",
|
|
487
|
+
path: _path + "",
|
|
488
|
+
expected: "CargoManifest",
|
|
489
|
+
value: input
|
|
490
|
+
}, _errorFactory)) && _ao0(input, _path + "", true) || _assertGuard(true, {
|
|
491
|
+
method: "typia.createAssert",
|
|
492
|
+
path: _path + "",
|
|
493
|
+
expected: "CargoManifest",
|
|
494
|
+
value: input
|
|
495
|
+
}, _errorFactory))(input, "$input", true);
|
|
496
|
+
}
|
|
497
|
+
return input;
|
|
498
|
+
};
|
|
499
|
+
})();
|
|
75
500
|
//#endregion
|
|
76
501
|
//#region src/plugins/cargo.ts
|
|
77
502
|
const DEP_FIELDS = [
|
|
@@ -79,17 +504,33 @@ const DEP_FIELDS = [
|
|
|
79
504
|
"dev-dependencies",
|
|
80
505
|
"build-dependencies"
|
|
81
506
|
];
|
|
507
|
+
var CargoToml = class {
|
|
508
|
+
path;
|
|
509
|
+
content;
|
|
510
|
+
data;
|
|
511
|
+
dependencies;
|
|
512
|
+
workspace;
|
|
513
|
+
constructor(path, content, data) {
|
|
514
|
+
this.path = path;
|
|
515
|
+
this.content = content;
|
|
516
|
+
this.data = data;
|
|
517
|
+
}
|
|
518
|
+
listDependencies(graph) {
|
|
519
|
+
return this.dependencies ??= listDependencies(graph, this);
|
|
520
|
+
}
|
|
521
|
+
patch(path, value) {
|
|
522
|
+
this.content = edit(this.content, path, value);
|
|
523
|
+
}
|
|
524
|
+
};
|
|
82
525
|
var CargoPackage = class extends WorkspacePackage {
|
|
83
526
|
path;
|
|
84
527
|
file;
|
|
85
|
-
workspaceFile;
|
|
86
528
|
manager = "cargo";
|
|
87
529
|
manifest;
|
|
88
|
-
constructor(path, file
|
|
530
|
+
constructor(path, file) {
|
|
89
531
|
super();
|
|
90
532
|
this.path = path;
|
|
91
533
|
this.file = file;
|
|
92
|
-
this.workspaceFile = workspaceFile;
|
|
93
534
|
this.manifest = file.data;
|
|
94
535
|
}
|
|
95
536
|
get name() {
|
|
@@ -98,7 +539,7 @@ var CargoPackage = class extends WorkspacePackage {
|
|
|
98
539
|
get version() {
|
|
99
540
|
const packageVersion = this.manifest.package.version;
|
|
100
541
|
if (typeof packageVersion === "string") return packageVersion;
|
|
101
|
-
const inherited = this.
|
|
542
|
+
const inherited = this.file.workspace?.data.workspace.package;
|
|
102
543
|
if (packageVersion.workspace && inherited?.version) return inherited.version;
|
|
103
544
|
throw new Error(`Invalid Cargo.toml in "${this.path}".`);
|
|
104
545
|
}
|
|
@@ -106,20 +547,17 @@ var CargoPackage = class extends WorkspacePackage {
|
|
|
106
547
|
const packageInfo = this.manifest.package;
|
|
107
548
|
if (typeof packageInfo.version === "string") {
|
|
108
549
|
packageInfo.version = version;
|
|
109
|
-
|
|
550
|
+
this.file.patch("package.version", version);
|
|
110
551
|
return;
|
|
111
552
|
}
|
|
112
|
-
if (packageInfo.version.workspace && this.
|
|
113
|
-
this.
|
|
114
|
-
|
|
553
|
+
if (packageInfo.version.workspace && this.file.workspace?.data.workspace.package) {
|
|
554
|
+
this.file.workspace.data.workspace.package.version = version;
|
|
555
|
+
this.file.workspace.patch("workspace.package.version", version);
|
|
115
556
|
return;
|
|
116
557
|
}
|
|
117
558
|
throw new Error(`Invalid Cargo.toml in "${this.path}".`);
|
|
118
559
|
}
|
|
119
560
|
};
|
|
120
|
-
function patchFile(file, path, value) {
|
|
121
|
-
file.content = edit(file.content, path, value);
|
|
122
|
-
}
|
|
123
561
|
function cargo({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
124
562
|
return {
|
|
125
563
|
name: "cargo",
|
|
@@ -141,13 +579,9 @@ function cargo({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
141
579
|
if (!(pkg instanceof CargoPackage) || !this.cargo) return;
|
|
142
580
|
let shouldPublish = true;
|
|
143
581
|
if (typeof pkg.manifest.package.publish === "boolean") shouldPublish = pkg.manifest.package.publish;
|
|
144
|
-
else if (pkg.manifest.package.publish?.workspace) shouldPublish = pkg.
|
|
582
|
+
else if (pkg.manifest.package.publish?.workspace) shouldPublish = pkg.file.workspace?.data.workspace?.package?.publish ?? shouldPublish;
|
|
145
583
|
const wait = [];
|
|
146
|
-
for (const {
|
|
147
|
-
const resolved = resolveLinkedDep(pkg.workspaceFile, pkg.file, this.cargo.graph, tablePath, rawName, spec);
|
|
148
|
-
if (!resolved) continue;
|
|
149
|
-
wait.push(resolved.linked.id);
|
|
150
|
-
}
|
|
584
|
+
for (const { resolved } of pkg.file.listDependencies(this.cargo.graph)) if (resolved) wait.push(resolved.id);
|
|
151
585
|
return {
|
|
152
586
|
shouldPublish,
|
|
153
587
|
wait
|
|
@@ -181,14 +615,13 @@ function cargo({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
181
615
|
const bumped = draft.getPackageDraft(pkg.id)?.bumpVersion(pkg);
|
|
182
616
|
if (bumped) pkg.setVersion(bumped);
|
|
183
617
|
}
|
|
184
|
-
for (const
|
|
185
|
-
|
|
186
|
-
if (!resolved || !resolved.range || !resolved.setRange || semver$1.satisfies(resolved.linked.version, resolved.range)) continue;
|
|
618
|
+
for (const file of graph.files.values()) for (const { range, resolved, setRange } of file.listDependencies(graph)) {
|
|
619
|
+
if (!resolved || !range || !setRange || semver$1.satisfies(resolved.version, range)) continue;
|
|
187
620
|
let updatedRange;
|
|
188
|
-
if (
|
|
189
|
-
else if (
|
|
190
|
-
else updatedRange = resolved.
|
|
191
|
-
|
|
621
|
+
if (range.startsWith("^")) updatedRange = `^${resolved.version}`;
|
|
622
|
+
else if (range.startsWith("~")) updatedRange = `~${resolved.version}`;
|
|
623
|
+
else updatedRange = resolved.version;
|
|
624
|
+
setRange(updatedRange);
|
|
192
625
|
}
|
|
193
626
|
await Promise.all(Array.from(graph.files.values(), (file) => writeFile(file.path, file.content + "\n")));
|
|
194
627
|
},
|
|
@@ -199,7 +632,7 @@ function cargo({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
199
632
|
}
|
|
200
633
|
};
|
|
201
634
|
}
|
|
202
|
-
function depsPolicy({
|
|
635
|
+
function depsPolicy({ cargo }, getBumpDepType = ({ kind }) => {
|
|
203
636
|
switch (kind) {
|
|
204
637
|
case "dependencies": return "patch";
|
|
205
638
|
case "build-dependencies":
|
|
@@ -208,25 +641,24 @@ function depsPolicy({ graph, cargo }, getBumpDepType = ({ kind }) => {
|
|
|
208
641
|
}) {
|
|
209
642
|
const cargoGraph = cargo.graph;
|
|
210
643
|
const dependentMap = /* @__PURE__ */ new Map();
|
|
211
|
-
for (const pkg of cargoGraph.packages.values()) for (const {
|
|
212
|
-
const resolved = resolveLinkedDep(pkg.workspaceFile, pkg.file, cargoGraph, tablePath, name, spec);
|
|
644
|
+
for (const pkg of cargoGraph.packages.values()) for (const { resolved, path, spec, range } of pkg.file.listDependencies(cargoGraph)) {
|
|
213
645
|
if (!resolved) continue;
|
|
214
|
-
const
|
|
215
|
-
const
|
|
216
|
-
const
|
|
646
|
+
const refs = dependentMap.get(resolved.id);
|
|
647
|
+
const kind = path[path.length - 2];
|
|
648
|
+
const name = path[path.length - 1];
|
|
217
649
|
if (refs) refs.push({
|
|
218
650
|
dependent: pkg,
|
|
219
651
|
kind,
|
|
220
652
|
name,
|
|
221
653
|
spec,
|
|
222
|
-
version:
|
|
654
|
+
version: range
|
|
223
655
|
});
|
|
224
|
-
else dependentMap.set(id, [{
|
|
656
|
+
else dependentMap.set(resolved.id, [{
|
|
225
657
|
dependent: pkg,
|
|
226
658
|
kind,
|
|
227
659
|
name,
|
|
228
660
|
spec,
|
|
229
|
-
version:
|
|
661
|
+
version: range
|
|
230
662
|
}]);
|
|
231
663
|
}
|
|
232
664
|
return {
|
|
@@ -235,11 +667,10 @@ function depsPolicy({ graph, cargo }, getBumpDepType = ({ kind }) => {
|
|
|
235
667
|
if (!(pkg instanceof CargoPackage)) return;
|
|
236
668
|
const deps = dependentMap.get(pkg.id);
|
|
237
669
|
if (!deps) return;
|
|
238
|
-
const group = graph.getPackageGroup(pkg.id);
|
|
239
670
|
const bumped = plan.bumpVersion(pkg);
|
|
240
671
|
if (!bumped) return;
|
|
241
672
|
for (const dep of deps) {
|
|
242
|
-
if (group?.options.syncBump &&
|
|
673
|
+
if (pkg.group?.options.syncBump && dep.dependent.group === pkg.group) continue;
|
|
243
674
|
if (dep.version && semver$1.satisfies(bumped, dep.version)) continue;
|
|
244
675
|
const bumpType = getBumpDepType(dep);
|
|
245
676
|
if (bumpType === false) continue;
|
|
@@ -261,11 +692,7 @@ async function buildEntry(dir) {
|
|
|
261
692
|
try {
|
|
262
693
|
const filePath = path.join(dir, "Cargo.toml");
|
|
263
694
|
const content = await readFile(filePath, "utf8");
|
|
264
|
-
return
|
|
265
|
-
path: filePath,
|
|
266
|
-
data: cargoManifestSchema.parse(parse$1(content)),
|
|
267
|
-
content
|
|
268
|
-
};
|
|
695
|
+
return new CargoToml(filePath, content, assertCargoManifest(parse$1(content)));
|
|
269
696
|
} catch {
|
|
270
697
|
return;
|
|
271
698
|
}
|
|
@@ -277,21 +704,23 @@ async function resolveCargoGraph(cwd) {
|
|
|
277
704
|
};
|
|
278
705
|
const root = await buildEntry(cwd);
|
|
279
706
|
if (!root) return out;
|
|
280
|
-
const rootWorkspace = root.data.workspace;
|
|
281
707
|
out.files.set(root.path, root);
|
|
282
708
|
if (root.data.package) {
|
|
283
|
-
const pkg = new CargoPackage(cwd, root
|
|
709
|
+
const pkg = new CargoPackage(cwd, root);
|
|
284
710
|
out.packages.set(pkg.name, pkg);
|
|
285
711
|
}
|
|
286
|
-
if (
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
712
|
+
if (root.data.workspace?.members) {
|
|
713
|
+
root.workspace = root;
|
|
714
|
+
const dirs = await expandWorkspaceMembers(cwd, root.data.workspace.members, root.data.workspace.exclude);
|
|
715
|
+
await Promise.all(dirs.map(async (dir) => {
|
|
716
|
+
const entry = await buildEntry(dir);
|
|
717
|
+
if (!entry || !entry.data.package) return;
|
|
718
|
+
entry.workspace = root;
|
|
719
|
+
const pkg = new CargoPackage(dir, entry);
|
|
720
|
+
out.files.set(entry.path, entry);
|
|
721
|
+
out.packages.set(pkg.name, pkg);
|
|
722
|
+
}));
|
|
723
|
+
}
|
|
295
724
|
return out;
|
|
296
725
|
}
|
|
297
726
|
async function expandWorkspaceMembers(cwd, members, exclude = []) {
|
|
@@ -307,41 +736,41 @@ async function expandWorkspaceMembers(cwd, members, exclude = []) {
|
|
|
307
736
|
return item.endsWith(path.sep) ? item.slice(0, -1) : item;
|
|
308
737
|
});
|
|
309
738
|
}
|
|
310
|
-
function
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
field
|
|
331
|
-
]
|
|
332
|
-
});
|
|
739
|
+
function listDependencies(graph, file) {
|
|
740
|
+
const out = [];
|
|
741
|
+
function scan(obj, prefix = []) {
|
|
742
|
+
for (const field of DEP_FIELDS) {
|
|
743
|
+
const table = obj[field];
|
|
744
|
+
if (!table) continue;
|
|
745
|
+
const tablePath = [...prefix, field];
|
|
746
|
+
for (const [key, spec] of Object.entries(table)) {
|
|
747
|
+
const { linked, range, setRange } = resolveLinkedDep(file, graph, tablePath, key, spec) ?? {};
|
|
748
|
+
out.push({
|
|
749
|
+
path: [...tablePath, key],
|
|
750
|
+
spec,
|
|
751
|
+
resolved: linked,
|
|
752
|
+
range,
|
|
753
|
+
setRange: setRange && ((v) => {
|
|
754
|
+
table[key] = setRange(v);
|
|
755
|
+
})
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
}
|
|
333
759
|
}
|
|
334
|
-
|
|
760
|
+
scan(file.data);
|
|
761
|
+
if (file.data.target) for (const [key, config] of Object.entries(file.data.target)) scan(config, ["target", key]);
|
|
762
|
+
if (file.data.workspace) scan(file.data.workspace);
|
|
763
|
+
return out;
|
|
335
764
|
}
|
|
336
|
-
function resolveLinkedDep(
|
|
765
|
+
function resolveLinkedDep(file, graph, tablePath, key, spec) {
|
|
337
766
|
if (typeof spec === "string") {
|
|
338
|
-
const linked = graph.packages.get(
|
|
767
|
+
const linked = graph.packages.get(key);
|
|
339
768
|
if (!linked) return;
|
|
340
769
|
return {
|
|
341
770
|
linked,
|
|
342
771
|
range: spec,
|
|
343
772
|
setRange(v) {
|
|
344
|
-
|
|
773
|
+
file.patch([...tablePath, key].join("."), v);
|
|
345
774
|
return v;
|
|
346
775
|
}
|
|
347
776
|
};
|
|
@@ -349,17 +778,12 @@ function resolveLinkedDep(workspaceFile, file, graph, tablePath, rawName, spec)
|
|
|
349
778
|
if ("git" in spec) return;
|
|
350
779
|
if ("workspace" in spec) {
|
|
351
780
|
const kind = tablePath[tablePath.length - 1];
|
|
352
|
-
const entry =
|
|
781
|
+
const entry = file.workspace?.data.workspace?.[kind]?.[key];
|
|
353
782
|
if (!entry) return;
|
|
354
|
-
const resolved = resolveLinkedDep(
|
|
355
|
-
if (!resolved
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
setRange(v) {
|
|
359
|
-
workspaceFile.data.workspace[kind][rawName] = resolved.setRange(v);
|
|
360
|
-
return spec;
|
|
361
|
-
}
|
|
362
|
-
};
|
|
783
|
+
const resolved = resolveLinkedDep(file.workspace, graph, ["workspace", kind], key, entry);
|
|
784
|
+
if (!resolved) return;
|
|
785
|
+
delete resolved.setRange;
|
|
786
|
+
return resolved;
|
|
363
787
|
}
|
|
364
788
|
if ("path" in spec) {
|
|
365
789
|
const pkgPath = path.resolve(path.dirname(file.path), spec.path);
|
|
@@ -369,9 +793,9 @@ function resolveLinkedDep(workspaceFile, file, graph, tablePath, rawName, spec)
|
|
|
369
793
|
linked: pkg,
|
|
370
794
|
range: spec.version,
|
|
371
795
|
setRange(v) {
|
|
372
|
-
|
|
796
|
+
file.patch([
|
|
373
797
|
...tablePath,
|
|
374
|
-
|
|
798
|
+
key,
|
|
375
799
|
"version"
|
|
376
800
|
].join("."), v);
|
|
377
801
|
return {
|
|
@@ -383,15 +807,15 @@ function resolveLinkedDep(workspaceFile, file, graph, tablePath, rawName, spec)
|
|
|
383
807
|
}
|
|
384
808
|
return;
|
|
385
809
|
}
|
|
386
|
-
const linked = graph.packages.get(spec.package ??
|
|
810
|
+
const linked = graph.packages.get(spec.package ?? key);
|
|
387
811
|
if (!linked) return;
|
|
388
812
|
return {
|
|
389
813
|
linked,
|
|
390
814
|
range: spec.version,
|
|
391
815
|
setRange(v) {
|
|
392
|
-
|
|
816
|
+
file.patch([
|
|
393
817
|
...tablePath,
|
|
394
|
-
|
|
818
|
+
key,
|
|
395
819
|
"version"
|
|
396
820
|
].join("."), v);
|
|
397
821
|
return {
|