@tegami/dart 1.1.0 → 1.1.2
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/index.d.ts +12 -12
- package/dist/index.js +379 -32
- package/package.json +8 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
|
+
import { Document } from "yaml";
|
|
1
2
|
import { BumpType, TegamiPlugin, WorkspacePackage } from "tegami";
|
|
2
|
-
import z from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/schema.d.ts
|
|
5
|
-
declare const pubspecSchema: z.ZodObject<{
|
|
6
|
-
name: z.ZodOptional<z.ZodString>;
|
|
7
|
-
version: z.ZodOptional<z.ZodString>;
|
|
8
|
-
publish_to: z.ZodOptional<z.ZodString>;
|
|
9
|
-
resolution: z.ZodOptional<z.ZodString>;
|
|
10
|
-
workspace: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
11
|
-
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<DartDependency, unknown, z.core.$ZodTypeInternals<DartDependency, unknown>>>>;
|
|
12
|
-
dev_dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<DartDependency, unknown, z.core.$ZodTypeInternals<DartDependency, unknown>>>>;
|
|
13
|
-
dependency_overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<DartDependency, unknown, z.core.$ZodTypeInternals<DartDependency, unknown>>>>;
|
|
14
|
-
}, z.core.$loose>;
|
|
15
5
|
type DartDependency = string | {
|
|
16
6
|
version?: string;
|
|
17
7
|
hosted?: string | {
|
|
@@ -23,12 +13,22 @@ type DartDependency = string | {
|
|
|
23
13
|
sdk?: string;
|
|
24
14
|
[key: string]: unknown;
|
|
25
15
|
};
|
|
26
|
-
|
|
16
|
+
interface Pubspec {
|
|
17
|
+
name?: string;
|
|
18
|
+
version?: string;
|
|
19
|
+
publish_to?: string;
|
|
20
|
+
resolution?: string;
|
|
21
|
+
workspace?: string[];
|
|
22
|
+
dependencies?: Record<string, DartDependency>;
|
|
23
|
+
dev_dependencies?: Record<string, DartDependency>;
|
|
24
|
+
dependency_overrides?: Record<string, DartDependency>;
|
|
25
|
+
}
|
|
27
26
|
//#endregion
|
|
28
27
|
//#region src/index.d.ts
|
|
29
28
|
declare const DEP_FIELDS: readonly ["dependencies", "dev_dependencies", "dependency_overrides"];
|
|
30
29
|
interface PubspecFile {
|
|
31
30
|
path: string;
|
|
31
|
+
doc: Document;
|
|
32
32
|
data: Pubspec;
|
|
33
33
|
}
|
|
34
34
|
declare class DartPackage extends WorkspacePackage {
|
package/dist/index.js
CHANGED
|
@@ -1,34 +1,377 @@
|
|
|
1
1
|
import { readFile, writeFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { dump, load } from "js-yaml";
|
|
4
3
|
import * as semver from "semver";
|
|
5
4
|
import { glob } from "tinyglobby";
|
|
6
5
|
import { x } from "tinyexec";
|
|
6
|
+
import { parseDocument } from "yaml";
|
|
7
7
|
import { WorkspacePackage } from "tegami";
|
|
8
8
|
import { execFailure, isCI, joinPath } from "tegami/utils";
|
|
9
|
-
|
|
9
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.0.1_typescript@6.0.3/node_modules/typia/lib/TypeGuardError.mjs
|
|
10
|
+
/**
|
|
11
|
+
* Error thrown when type assertion fails.
|
|
12
|
+
*
|
|
13
|
+
* Thrown by {@link assert}, {@link assertGuard}, and other assert-family
|
|
14
|
+
* functions when input doesn't match expected type `T`. Contains detailed
|
|
15
|
+
* information about the first assertion failure:
|
|
16
|
+
*
|
|
17
|
+
* - `method`: Which typia function threw (e.g., `"typia.assert"`)
|
|
18
|
+
* - `path`: Property path where error occurred (e.g., `"input.user.age"`)
|
|
19
|
+
* - `expected`: Expected type string (e.g., `"number & ExclusiveMinimum<19>"`)
|
|
20
|
+
* - `value`: Actual value that failed validation
|
|
21
|
+
*
|
|
22
|
+
* @template T Expected type (for type safety)
|
|
23
|
+
*/
|
|
24
|
+
var TypeGuardError = class extends Error {
|
|
25
|
+
/**
|
|
26
|
+
* Name of the typia method that threw this error.
|
|
27
|
+
*
|
|
28
|
+
* E.g., `"typia.assert"`, `"typia.assertEquals"`, `"typia.assertGuard"`.
|
|
29
|
+
*/
|
|
30
|
+
method;
|
|
31
|
+
/**
|
|
32
|
+
* Property path where assertion failed.
|
|
33
|
+
*
|
|
34
|
+
* Uses dot notation for nested properties. `undefined` if error occurred at
|
|
35
|
+
* root level.
|
|
36
|
+
*
|
|
37
|
+
* E.g., `"input.age"`, `"input.profile.email"`, `"input[0].name"`.
|
|
38
|
+
*/
|
|
39
|
+
path;
|
|
40
|
+
/**
|
|
41
|
+
* String representation of expected type.
|
|
42
|
+
*
|
|
43
|
+
* E.g., `"string"`, `"number & ExclusiveMinimum<19>"`, `"{ name: string; age:
|
|
44
|
+
* number }"`.
|
|
45
|
+
*/
|
|
46
|
+
expected;
|
|
47
|
+
/**
|
|
48
|
+
* Actual value that failed assertion.
|
|
49
|
+
*
|
|
50
|
+
* The raw value at the error path, useful for debugging.
|
|
51
|
+
*/
|
|
52
|
+
value;
|
|
53
|
+
/**
|
|
54
|
+
* Optional human-readable error description.
|
|
55
|
+
*
|
|
56
|
+
* Primarily for AI agent libraries or custom validation scenarios needing
|
|
57
|
+
* additional context. Standard assertions rely on `path`, `expected`, and
|
|
58
|
+
* `value` for error reporting.
|
|
59
|
+
*/
|
|
60
|
+
description;
|
|
61
|
+
/**
|
|
62
|
+
* Phantom property for TypeScript type safety.
|
|
63
|
+
*
|
|
64
|
+
* Not used at runtime—exists only to preserve generic type `T` in the type
|
|
65
|
+
* system. Always `undefined`.
|
|
66
|
+
*
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
fake_expected_typed_value_;
|
|
70
|
+
/**
|
|
71
|
+
* Creates a new TypeGuardError instance.
|
|
72
|
+
*
|
|
73
|
+
* @param props Error properties
|
|
74
|
+
*/
|
|
75
|
+
constructor(props) {
|
|
76
|
+
super(props.message || `Error on ${props.method}(): invalid type${props.path ? ` on ${props.path}` : ""}, expect to be ${props.expected}`);
|
|
77
|
+
const proto = new.target.prototype;
|
|
78
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(this, proto);
|
|
79
|
+
else this.__proto__ = proto;
|
|
80
|
+
this.method = props.method;
|
|
81
|
+
this.path = props.path;
|
|
82
|
+
this.expected = props.expected;
|
|
83
|
+
this.value = props.value;
|
|
84
|
+
if (props.description || props.value === void 0) this.description = props.description ?? [
|
|
85
|
+
"The value at this path is `undefined`.",
|
|
86
|
+
"",
|
|
87
|
+
`Please fill the \`${props.expected}\` typed value next time.`
|
|
88
|
+
].join("\n");
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.0.1_typescript@6.0.3/node_modules/typia/lib/internal/_assertGuard.mjs
|
|
93
|
+
const _assertGuard = (exceptionable, props, factory) => {
|
|
94
|
+
if (exceptionable === true) if (factory) throw factory(props);
|
|
95
|
+
else throw new TypeGuardError(props);
|
|
96
|
+
return false;
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region ../../node_modules/.pnpm/typia@12.1.1_@types+node@26.0.1_typescript@6.0.3/node_modules/typia/lib/internal/_accessExpressionAsString.mjs
|
|
100
|
+
const _accessExpressionAsString = (str) => variable(str) ? `.${str}` : `[${JSON.stringify(str)}]`;
|
|
101
|
+
const variable = (str) => reserved(str) === false && /^[a-zA-Z_$][a-zA-Z_$0-9]*$/g.test(str);
|
|
102
|
+
const reserved = (str) => RESERVED.has(str);
|
|
103
|
+
const RESERVED = /* @__PURE__ */ new Set([
|
|
104
|
+
"break",
|
|
105
|
+
"case",
|
|
106
|
+
"catch",
|
|
107
|
+
"class",
|
|
108
|
+
"const",
|
|
109
|
+
"continue",
|
|
110
|
+
"debugger",
|
|
111
|
+
"default",
|
|
112
|
+
"delete",
|
|
113
|
+
"do",
|
|
114
|
+
"else",
|
|
115
|
+
"enum",
|
|
116
|
+
"export",
|
|
117
|
+
"extends",
|
|
118
|
+
"false",
|
|
119
|
+
"finally",
|
|
120
|
+
"for",
|
|
121
|
+
"function",
|
|
122
|
+
"if",
|
|
123
|
+
"import",
|
|
124
|
+
"in",
|
|
125
|
+
"instanceof",
|
|
126
|
+
"new",
|
|
127
|
+
"null",
|
|
128
|
+
"return",
|
|
129
|
+
"super",
|
|
130
|
+
"switch",
|
|
131
|
+
"this",
|
|
132
|
+
"throw",
|
|
133
|
+
"true",
|
|
134
|
+
"try",
|
|
135
|
+
"typeof",
|
|
136
|
+
"var",
|
|
137
|
+
"void",
|
|
138
|
+
"while",
|
|
139
|
+
"with"
|
|
140
|
+
]);
|
|
141
|
+
//#endregion
|
|
10
142
|
//#region src/schema.ts
|
|
11
|
-
const
|
|
12
|
-
version
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
143
|
+
const assertPubspec = (() => {
|
|
144
|
+
const _io0 = (input) => (void 0 === input.name || "string" === typeof input.name) && (void 0 === input.version || "string" === typeof input.version) && (void 0 === input.publish_to || "string" === typeof input.publish_to) && (void 0 === input.resolution || "string" === typeof input.resolution) && (void 0 === input.workspace || Array.isArray(input.workspace) && input.workspace.every((elem) => "string" === typeof elem)) && (void 0 === input.dependencies || "object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) && _io1(input.dependencies)) && (void 0 === input.dev_dependencies || "object" === typeof input.dev_dependencies && null !== input.dev_dependencies && false === Array.isArray(input.dev_dependencies) && _io1(input.dev_dependencies)) && (void 0 === input.dependency_overrides || "object" === typeof input.dependency_overrides && null !== input.dependency_overrides && false === Array.isArray(input.dependency_overrides) && _io1(input.dependency_overrides));
|
|
145
|
+
const _io1 = (input) => Object.keys(input).every((key) => {
|
|
146
|
+
const value = input[key];
|
|
147
|
+
if (void 0 === value) return true;
|
|
148
|
+
return null !== value && void 0 !== value && ("string" === typeof value || "object" === typeof value && null !== value && false === Array.isArray(value) && _io2(value));
|
|
149
|
+
});
|
|
150
|
+
const _io2 = (input) => (void 0 === input.version || "string" === typeof input.version) && null !== input.hosted && (void 0 === input.hosted || "string" === typeof input.hosted || "object" === typeof input.hosted && null !== input.hosted && _io3(input.hosted)) && (void 0 === input.path || "string" === typeof input.path) && (void 0 === input.sdk || "string" === typeof input.sdk) && Object.keys(input).every((key) => {
|
|
151
|
+
if ([
|
|
152
|
+
"version",
|
|
153
|
+
"hosted",
|
|
154
|
+
"path",
|
|
155
|
+
"git",
|
|
156
|
+
"sdk"
|
|
157
|
+
].some((prop) => key === prop)) return true;
|
|
158
|
+
if (void 0 === input[key]) return true;
|
|
159
|
+
return true;
|
|
160
|
+
});
|
|
161
|
+
const _io3 = (input) => (void 0 === input.name || "string" === typeof input.name) && "string" === typeof input.url;
|
|
162
|
+
const _ao0 = (input, _path, _exceptionable = true) => (void 0 === input.name || "string" === typeof input.name || _assertGuard(_exceptionable, {
|
|
163
|
+
method: "typia.createAssert",
|
|
164
|
+
path: _path + ".name",
|
|
165
|
+
expected: "(string | undefined)",
|
|
166
|
+
value: input.name
|
|
167
|
+
}, _errorFactory)) && (void 0 === input.version || "string" === typeof input.version || _assertGuard(_exceptionable, {
|
|
168
|
+
method: "typia.createAssert",
|
|
169
|
+
path: _path + ".version",
|
|
170
|
+
expected: "(string | undefined)",
|
|
171
|
+
value: input.version
|
|
172
|
+
}, _errorFactory)) && (void 0 === input.publish_to || "string" === typeof input.publish_to || _assertGuard(_exceptionable, {
|
|
173
|
+
method: "typia.createAssert",
|
|
174
|
+
path: _path + ".publish_to",
|
|
175
|
+
expected: "(string | undefined)",
|
|
176
|
+
value: input.publish_to
|
|
177
|
+
}, _errorFactory)) && (void 0 === input.resolution || "string" === typeof input.resolution || _assertGuard(_exceptionable, {
|
|
178
|
+
method: "typia.createAssert",
|
|
179
|
+
path: _path + ".resolution",
|
|
180
|
+
expected: "(string | undefined)",
|
|
181
|
+
value: input.resolution
|
|
182
|
+
}, _errorFactory)) && (void 0 === input.workspace || (Array.isArray(input.workspace) || _assertGuard(_exceptionable, {
|
|
183
|
+
method: "typia.createAssert",
|
|
184
|
+
path: _path + ".workspace",
|
|
185
|
+
expected: "(Array<string> | undefined)",
|
|
186
|
+
value: input.workspace
|
|
187
|
+
}, _errorFactory)) && input.workspace.every((elem, _index2) => "string" === typeof elem || _assertGuard(_exceptionable, {
|
|
188
|
+
method: "typia.createAssert",
|
|
189
|
+
path: _path + ".workspace[" + _index2 + "]",
|
|
190
|
+
expected: "string",
|
|
191
|
+
value: elem
|
|
192
|
+
}, _errorFactory)) || _assertGuard(_exceptionable, {
|
|
193
|
+
method: "typia.createAssert",
|
|
194
|
+
path: _path + ".workspace",
|
|
195
|
+
expected: "(Array<string> | undefined)",
|
|
196
|
+
value: input.workspace
|
|
197
|
+
}, _errorFactory)) && (void 0 === input.dependencies || ("object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) || _assertGuard(_exceptionable, {
|
|
198
|
+
method: "typia.createAssert",
|
|
199
|
+
path: _path + ".dependencies",
|
|
200
|
+
expected: "(Record<string, DartDependency> | undefined)",
|
|
201
|
+
value: input.dependencies
|
|
202
|
+
}, _errorFactory)) && _ao1(input.dependencies, _path + ".dependencies", _exceptionable) || _assertGuard(_exceptionable, {
|
|
203
|
+
method: "typia.createAssert",
|
|
204
|
+
path: _path + ".dependencies",
|
|
205
|
+
expected: "(Record<string, DartDependency> | undefined)",
|
|
206
|
+
value: input.dependencies
|
|
207
|
+
}, _errorFactory)) && (void 0 === input.dev_dependencies || ("object" === typeof input.dev_dependencies && null !== input.dev_dependencies && false === Array.isArray(input.dev_dependencies) || _assertGuard(_exceptionable, {
|
|
208
|
+
method: "typia.createAssert",
|
|
209
|
+
path: _path + ".dev_dependencies",
|
|
210
|
+
expected: "(Record<string, DartDependency> | undefined)",
|
|
211
|
+
value: input.dev_dependencies
|
|
212
|
+
}, _errorFactory)) && _ao1(input.dev_dependencies, _path + ".dev_dependencies", _exceptionable) || _assertGuard(_exceptionable, {
|
|
213
|
+
method: "typia.createAssert",
|
|
214
|
+
path: _path + ".dev_dependencies",
|
|
215
|
+
expected: "(Record<string, DartDependency> | undefined)",
|
|
216
|
+
value: input.dev_dependencies
|
|
217
|
+
}, _errorFactory)) && (void 0 === input.dependency_overrides || ("object" === typeof input.dependency_overrides && null !== input.dependency_overrides && false === Array.isArray(input.dependency_overrides) || _assertGuard(_exceptionable, {
|
|
218
|
+
method: "typia.createAssert",
|
|
219
|
+
path: _path + ".dependency_overrides",
|
|
220
|
+
expected: "(Record<string, DartDependency> | undefined)",
|
|
221
|
+
value: input.dependency_overrides
|
|
222
|
+
}, _errorFactory)) && _ao1(input.dependency_overrides, _path + ".dependency_overrides", _exceptionable) || _assertGuard(_exceptionable, {
|
|
223
|
+
method: "typia.createAssert",
|
|
224
|
+
path: _path + ".dependency_overrides",
|
|
225
|
+
expected: "(Record<string, DartDependency> | undefined)",
|
|
226
|
+
value: input.dependency_overrides
|
|
227
|
+
}, _errorFactory));
|
|
228
|
+
const _ao1 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every((key) => {
|
|
229
|
+
const value = input[key];
|
|
230
|
+
if (void 0 === value) return true;
|
|
231
|
+
return (null !== value || _assertGuard(_exceptionable, {
|
|
232
|
+
method: "typia.createAssert",
|
|
233
|
+
path: _path + _accessExpressionAsString(key),
|
|
234
|
+
expected: "(__type | string)",
|
|
235
|
+
value
|
|
236
|
+
}, _errorFactory)) && (void 0 !== value || _assertGuard(_exceptionable, {
|
|
237
|
+
method: "typia.createAssert",
|
|
238
|
+
path: _path + _accessExpressionAsString(key),
|
|
239
|
+
expected: "(__type | string)",
|
|
240
|
+
value
|
|
241
|
+
}, _errorFactory)) && ("string" === typeof value || ("object" === typeof value && null !== value && false === Array.isArray(value) || _assertGuard(_exceptionable, {
|
|
242
|
+
method: "typia.createAssert",
|
|
243
|
+
path: _path + _accessExpressionAsString(key),
|
|
244
|
+
expected: "(__type | string)",
|
|
245
|
+
value
|
|
246
|
+
}, _errorFactory)) && _ao2(value, _path + _accessExpressionAsString(key), _exceptionable) || _assertGuard(_exceptionable, {
|
|
247
|
+
method: "typia.createAssert",
|
|
248
|
+
path: _path + _accessExpressionAsString(key),
|
|
249
|
+
expected: "(__type | string)",
|
|
250
|
+
value
|
|
251
|
+
}, _errorFactory));
|
|
252
|
+
});
|
|
253
|
+
const _ao2 = (input, _path, _exceptionable = true) => (void 0 === input.version || "string" === typeof input.version || _assertGuard(_exceptionable, {
|
|
254
|
+
method: "typia.createAssert",
|
|
255
|
+
path: _path + ".version",
|
|
256
|
+
expected: "(string | undefined)",
|
|
257
|
+
value: input.version
|
|
258
|
+
}, _errorFactory)) && (null !== input.hosted || _assertGuard(_exceptionable, {
|
|
259
|
+
method: "typia.createAssert",
|
|
260
|
+
path: _path + ".hosted",
|
|
261
|
+
expected: "(__type.o1 | string | undefined)",
|
|
262
|
+
value: input.hosted
|
|
263
|
+
}, _errorFactory)) && (void 0 === input.hosted || "string" === typeof input.hosted || ("object" === typeof input.hosted && null !== input.hosted || _assertGuard(_exceptionable, {
|
|
264
|
+
method: "typia.createAssert",
|
|
265
|
+
path: _path + ".hosted",
|
|
266
|
+
expected: "(__type.o1 | string | undefined)",
|
|
267
|
+
value: input.hosted
|
|
268
|
+
}, _errorFactory)) && _ao3(input.hosted, _path + ".hosted", _exceptionable) || _assertGuard(_exceptionable, {
|
|
269
|
+
method: "typia.createAssert",
|
|
270
|
+
path: _path + ".hosted",
|
|
271
|
+
expected: "(__type.o1 | string | undefined)",
|
|
272
|
+
value: input.hosted
|
|
273
|
+
}, _errorFactory)) && (void 0 === input.path || "string" === typeof input.path || _assertGuard(_exceptionable, {
|
|
274
|
+
method: "typia.createAssert",
|
|
275
|
+
path: _path + ".path",
|
|
276
|
+
expected: "(string | undefined)",
|
|
277
|
+
value: input.path
|
|
278
|
+
}, _errorFactory)) && (void 0 === input.sdk || "string" === typeof input.sdk || _assertGuard(_exceptionable, {
|
|
279
|
+
method: "typia.createAssert",
|
|
280
|
+
path: _path + ".sdk",
|
|
281
|
+
expected: "(string | undefined)",
|
|
282
|
+
value: input.sdk
|
|
283
|
+
}, _errorFactory)) && (false === _exceptionable || Object.keys(input).every((key) => {
|
|
284
|
+
if ([
|
|
285
|
+
"version",
|
|
286
|
+
"hosted",
|
|
287
|
+
"path",
|
|
288
|
+
"git",
|
|
289
|
+
"sdk"
|
|
290
|
+
].some((prop) => key === prop)) return true;
|
|
291
|
+
if (void 0 === input[key]) return true;
|
|
292
|
+
return true;
|
|
293
|
+
}));
|
|
294
|
+
const _ao3 = (input, _path, _exceptionable = true) => (void 0 === input.name || "string" === typeof input.name || _assertGuard(_exceptionable, {
|
|
295
|
+
method: "typia.createAssert",
|
|
296
|
+
path: _path + ".name",
|
|
297
|
+
expected: "(string | undefined)",
|
|
298
|
+
value: input.name
|
|
299
|
+
}, _errorFactory)) && ("string" === typeof input.url || _assertGuard(_exceptionable, {
|
|
300
|
+
method: "typia.createAssert",
|
|
301
|
+
path: _path + ".url",
|
|
302
|
+
expected: "string",
|
|
303
|
+
value: input.url
|
|
304
|
+
}, _errorFactory));
|
|
305
|
+
const __is = (input) => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
306
|
+
let _errorFactory;
|
|
307
|
+
return (input, errorFactory) => {
|
|
308
|
+
if (false === __is(input)) {
|
|
309
|
+
_errorFactory = errorFactory;
|
|
310
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input && false === Array.isArray(input) || _assertGuard(true, {
|
|
311
|
+
method: "typia.createAssert",
|
|
312
|
+
path: _path + "",
|
|
313
|
+
expected: "Pubspec",
|
|
314
|
+
value: input
|
|
315
|
+
}, _errorFactory)) && _ao0(input, _path + "", true) || _assertGuard(true, {
|
|
316
|
+
method: "typia.createAssert",
|
|
317
|
+
path: _path + "",
|
|
318
|
+
expected: "Pubspec",
|
|
319
|
+
value: input
|
|
320
|
+
}, _errorFactory))(input, "$input", true);
|
|
321
|
+
}
|
|
322
|
+
return input;
|
|
323
|
+
};
|
|
324
|
+
})();
|
|
325
|
+
const assertHostedPackage = (() => {
|
|
326
|
+
const _io0 = (input) => void 0 === input.versions || Array.isArray(input.versions) && input.versions.every((elem) => "object" === typeof elem && null !== elem && _io1(elem));
|
|
327
|
+
const _io1 = (input) => "string" === typeof input.version;
|
|
328
|
+
const _ao0 = (input, _path, _exceptionable = true) => void 0 === input.versions || (Array.isArray(input.versions) || _assertGuard(_exceptionable, {
|
|
329
|
+
method: "typia.createAssert",
|
|
330
|
+
path: _path + ".versions",
|
|
331
|
+
expected: "(Array<__type> | undefined)",
|
|
332
|
+
value: input.versions
|
|
333
|
+
}, _errorFactory)) && input.versions.every((elem, _index2) => ("object" === typeof elem && null !== elem || _assertGuard(_exceptionable, {
|
|
334
|
+
method: "typia.createAssert",
|
|
335
|
+
path: _path + ".versions[" + _index2 + "]",
|
|
336
|
+
expected: "__type",
|
|
337
|
+
value: elem
|
|
338
|
+
}, _errorFactory)) && _ao1(elem, _path + ".versions[" + _index2 + "]", _exceptionable) || _assertGuard(_exceptionable, {
|
|
339
|
+
method: "typia.createAssert",
|
|
340
|
+
path: _path + ".versions[" + _index2 + "]",
|
|
341
|
+
expected: "__type",
|
|
342
|
+
value: elem
|
|
343
|
+
}, _errorFactory)) || _assertGuard(_exceptionable, {
|
|
344
|
+
method: "typia.createAssert",
|
|
345
|
+
path: _path + ".versions",
|
|
346
|
+
expected: "(Array<__type> | undefined)",
|
|
347
|
+
value: input.versions
|
|
348
|
+
}, _errorFactory);
|
|
349
|
+
const _ao1 = (input, _path, _exceptionable = true) => "string" === typeof input.version || _assertGuard(_exceptionable, {
|
|
350
|
+
method: "typia.createAssert",
|
|
351
|
+
path: _path + ".version",
|
|
352
|
+
expected: "string",
|
|
353
|
+
value: input.version
|
|
354
|
+
}, _errorFactory);
|
|
355
|
+
const __is = (input) => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input);
|
|
356
|
+
let _errorFactory;
|
|
357
|
+
return (input, errorFactory) => {
|
|
358
|
+
if (false === __is(input)) {
|
|
359
|
+
_errorFactory = errorFactory;
|
|
360
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input && false === Array.isArray(input) || _assertGuard(true, {
|
|
361
|
+
method: "typia.createAssert",
|
|
362
|
+
path: _path + "",
|
|
363
|
+
expected: "HostedPackage",
|
|
364
|
+
value: input
|
|
365
|
+
}, _errorFactory)) && _ao0(input, _path + "", true) || _assertGuard(true, {
|
|
366
|
+
method: "typia.createAssert",
|
|
367
|
+
path: _path + "",
|
|
368
|
+
expected: "HostedPackage",
|
|
369
|
+
value: input
|
|
370
|
+
}, _errorFactory))(input, "$input", true);
|
|
371
|
+
}
|
|
372
|
+
return input;
|
|
373
|
+
};
|
|
374
|
+
})();
|
|
32
375
|
//#endregion
|
|
33
376
|
//#region src/index.ts
|
|
34
377
|
const DEP_FIELDS = [
|
|
@@ -57,13 +400,10 @@ var DartPackage = class extends WorkspacePackage {
|
|
|
57
400
|
}
|
|
58
401
|
setVersion(version) {
|
|
59
402
|
this.file.data.version = version;
|
|
403
|
+
this.file.doc.setIn(["version"], version);
|
|
60
404
|
}
|
|
61
405
|
async write() {
|
|
62
|
-
await writeFile(path.join(this.path, "pubspec.yaml"),
|
|
63
|
-
lineWidth: -1,
|
|
64
|
-
noRefs: true,
|
|
65
|
-
sortKeys: false
|
|
66
|
-
}));
|
|
406
|
+
await writeFile(path.join(this.path, "pubspec.yaml"), this.file.doc.toString({ lineWidth: 0 }));
|
|
67
407
|
}
|
|
68
408
|
};
|
|
69
409
|
function dart({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
@@ -126,7 +466,13 @@ function dart({ updateLockFile = true, bumpDep: getBumpDepType } = {}) {
|
|
|
126
466
|
if (!ref.linked.version) continue;
|
|
127
467
|
const range = getDependencyRange(ref.spec);
|
|
128
468
|
if (!range || satisfiesDartRange(ref.linked.version, range)) continue;
|
|
129
|
-
|
|
469
|
+
const nextRange = updateConstraintRange(range, ref.linked.version);
|
|
470
|
+
ref.table[ref.name] = setDependencyRange(ref.spec, nextRange);
|
|
471
|
+
ref.dependent.file.doc.setIn(typeof ref.spec === "object" && ref.spec !== null ? [
|
|
472
|
+
ref.kind,
|
|
473
|
+
ref.name,
|
|
474
|
+
"version"
|
|
475
|
+
] : [ref.kind, ref.name], nextRange);
|
|
130
476
|
}
|
|
131
477
|
writes.push(pkg.write());
|
|
132
478
|
}
|
|
@@ -260,10 +606,11 @@ async function collectWorkspaceFiles(root, files) {
|
|
|
260
606
|
async function readPubspec(dir) {
|
|
261
607
|
const filePath = path.join(dir, "pubspec.yaml");
|
|
262
608
|
try {
|
|
263
|
-
const
|
|
609
|
+
const doc = parseDocument(await readFile(filePath, "utf8"));
|
|
264
610
|
return {
|
|
265
611
|
path: filePath,
|
|
266
|
-
|
|
612
|
+
doc,
|
|
613
|
+
data: assertPubspec(doc.toJS())
|
|
267
614
|
};
|
|
268
615
|
} catch {
|
|
269
616
|
return;
|
|
@@ -277,7 +624,7 @@ async function isPackagePublished(name, version, hostedUrl) {
|
|
|
277
624
|
} });
|
|
278
625
|
if (response.status === 404) return false;
|
|
279
626
|
if (!response.ok) return false;
|
|
280
|
-
return
|
|
627
|
+
return assertHostedPackage(await response.json()).versions?.some((entry) => entry.version === version) ?? false;
|
|
281
628
|
}
|
|
282
629
|
//#endregion
|
|
283
630
|
export { DartPackage, dart, isPackagePublished, updateConstraintRange };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tegami/dart",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Dart pub workspace support and pub.dev publishing for Tegami",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Fuma Nama",
|
|
@@ -20,22 +20,25 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"js-yaml": "^5.2.0",
|
|
24
23
|
"semver": "^7.8.5",
|
|
25
24
|
"tinyexec": "^1.2.4",
|
|
26
25
|
"tinyglobby": "^0.2.17",
|
|
27
|
-
"
|
|
26
|
+
"yaml": "^2.9.0"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
29
|
"@types/node": "^26.0.1",
|
|
31
30
|
"@types/semver": "^7.7.1",
|
|
32
31
|
"tsdown": "^0.22.3",
|
|
33
32
|
"typescript": "6.0.3",
|
|
33
|
+
"typia": "^12.1.1",
|
|
34
34
|
"@repo/typescript-config": "0.0.0",
|
|
35
|
-
"tegami": "1.1.
|
|
35
|
+
"tegami": "1.1.2"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"tegami": "1.1.
|
|
38
|
+
"tegami": "1.1.2"
|
|
39
|
+
},
|
|
40
|
+
"inlinedDependencies": {
|
|
41
|
+
"typia": "12.1.1"
|
|
39
42
|
},
|
|
40
43
|
"scripts": {
|
|
41
44
|
"types:check": "tsc --noEmit",
|