@r_masseater/msch 0.42.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -9
- package/dist/cargo-inputs.d.mts +1 -0
- package/dist/cargo-inputs.mjs +149 -94
- package/dist/cargo-inputs.mjs.map +1 -1
- package/dist/changed.d.mts +1 -0
- package/dist/changed.mjs +178 -0
- package/dist/changed.mjs.map +1 -0
- package/dist/cli-contract-BY7vwgKc.mjs +41 -0
- package/dist/cli-contract-BY7vwgKc.mjs.map +1 -0
- package/dist/cli.mjs +757 -938
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +3 -1
- package/dist/config.mjs +19 -9
- package/dist/config.mjs.map +1 -1
- package/dist/decision-rules.d.mts +1 -1
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-DKJku2ZR.mjs → define-lint-preset-CxzPzVuB.mjs} +15 -24
- package/dist/define-lint-preset-CxzPzVuB.mjs.map +1 -0
- package/dist/{package-vbK0Qycn.mjs → dependencies-v59cxwTD.mjs} +186 -165
- package/dist/dependencies-v59cxwTD.mjs.map +1 -0
- package/dist/{ignored-directories-CfACwIvu.mjs → ignored-directories-thSB0IAT.mjs} +13 -6
- package/dist/ignored-directories-thSB0IAT.mjs.map +1 -0
- package/dist/{index-BwiAHe_u.d.mts → index-DL7PSp7j.d.mts} +3 -3
- package/dist/lint.d.mts +1 -1
- package/dist/lint.mjs +1 -1
- package/dist/locked-closure-paths-Dtqs8uBU.mjs +7 -0
- package/dist/locked-closure-paths-Dtqs8uBU.mjs.map +1 -0
- package/dist/locked-inputs.d.mts +12 -0
- package/dist/locked-inputs.mjs +20 -0
- package/dist/locked-inputs.mjs.map +1 -0
- package/dist/oxlint.mjs +2 -1
- package/dist/oxlint.mjs.map +1 -1
- package/dist/package-Bdv6W97F.mjs +144 -0
- package/dist/package-Bdv6W97F.mjs.map +1 -0
- package/dist/project-DeQcAglt.mjs +464 -0
- package/dist/project-DeQcAglt.mjs.map +1 -0
- package/dist/publish.mjs +413 -169
- package/dist/publish.mjs.map +1 -1
- package/dist/reachable-Cc-255L3.mjs +13 -0
- package/dist/reachable-Cc-255L3.mjs.map +1 -0
- package/dist/{repository-files-CPfBA4mf.mjs → repository-files-aXwrITdF.mjs} +3 -2
- package/dist/repository-files-aXwrITdF.mjs.map +1 -0
- package/dist/{runtime-Dc5gCUSF.mjs → runtime-GbrDfB8K.mjs} +2 -2
- package/dist/{runtime-Dc5gCUSF.mjs.map → runtime-GbrDfB8K.mjs.map} +1 -1
- package/dist/started-once-CkTooI_o.mjs +13 -0
- package/dist/started-once-CkTooI_o.mjs.map +1 -0
- package/dist/{cli-contract-DdTV5DaG.mjs → syntax-ct2fFLtv.mjs} +9 -45
- package/dist/syntax-ct2fFLtv.mjs.map +1 -0
- package/dist/workspace-settings.mjs +8 -32
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +41 -33
- package/skills/msch-checks/SKILL.md +1 -1
- package/skills/publishing/SKILL.md +6 -4
- package/skills/repository-config/SKILL.md +14 -9
- package/skills/workspace-settings/SKILL.md +33 -3
- package/src/app/vite.d.ts +2 -0
- package/dist/cli-contract-DdTV5DaG.mjs.map +0 -1
- package/dist/define-lint-preset-DKJku2ZR.mjs.map +0 -1
- package/dist/ignored-directories-CfACwIvu.mjs.map +0 -1
- package/dist/package-vbK0Qycn.mjs.map +0 -1
- package/dist/repository-files-CPfBA4mf.mjs.map +0 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-
|
|
2
|
-
import {
|
|
1
|
+
import { n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-aXwrITdF.mjs";
|
|
2
|
+
import { n as FINGERPRINT_FILE, r as LOCK_FILE, t as CLOSURE_FILE } from "./locked-closure-paths-Dtqs8uBU.mjs";
|
|
3
|
+
import { t as reachable } from "./reachable-Cc-255L3.mjs";
|
|
4
|
+
import { Array, Effect, Match, Option, Order, Predicate, Record, Schema, Stream, String as String$1, pipe } from "effect";
|
|
5
|
+
import { ChildProcess } from "effect/process";
|
|
3
6
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
4
7
|
import { readWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-reader";
|
|
5
8
|
import { findWorkspaceProjectsNoCheck } from "@pnpm/workspace.projects-reader";
|
|
@@ -110,9 +113,9 @@ const stringsIn = (node) => {
|
|
|
110
113
|
};
|
|
111
114
|
// src/entities/workspace/model/workspace-config-source.ts
|
|
112
115
|
const SINGLE = 1;
|
|
113
|
-
const CONFIG_FILE
|
|
114
|
-
const taggedError$
|
|
115
|
-
var WorkspaceSettingsInvalid = class extends taggedError$
|
|
116
|
+
const CONFIG_FILE = "vite.config.ts";
|
|
117
|
+
const taggedError$2 = Schema.TaggedError;
|
|
118
|
+
var WorkspaceSettingsInvalid = class extends taggedError$2()("WorkspaceSettingsInvalid", {
|
|
116
119
|
file: Schema.String,
|
|
117
120
|
message: Schema.String
|
|
118
121
|
}) {};
|
|
@@ -147,7 +150,7 @@ const programOf = Effect.fn("programOf")(function* programOf(file, text) {
|
|
|
147
150
|
});
|
|
148
151
|
const workspaceConfigOf = Effect.fn("workspaceConfigOf")(function* workspaceConfigOf(root, directory) {
|
|
149
152
|
const files = yield* RepositoryFiles;
|
|
150
|
-
const file = files.join(root, directory, CONFIG_FILE
|
|
153
|
+
const file = files.join(root, directory, CONFIG_FILE);
|
|
151
154
|
const text = yield* files.readFile(file);
|
|
152
155
|
if (Option.isNone(text)) return Option.none();
|
|
153
156
|
const program = yield* programOf(file, text.value);
|
|
@@ -207,8 +210,8 @@ const runTasksOf = Effect.fn("runTasksOf")(function* runTasksOf(root, directory)
|
|
|
207
210
|
})));
|
|
208
211
|
});
|
|
209
212
|
// src/entities/workspace/model/workspace-unreadable.ts
|
|
210
|
-
const taggedError$
|
|
211
|
-
var WorkspaceUnreadable = class extends taggedError$
|
|
213
|
+
const taggedError$1 = Schema.TaggedError;
|
|
214
|
+
var WorkspaceUnreadable = class extends taggedError$1()("WorkspaceUnreadable", {
|
|
212
215
|
root: Schema.String,
|
|
213
216
|
reason: Schema.String
|
|
214
217
|
}) {};
|
|
@@ -222,7 +225,7 @@ const workspaceManifest = (root) => Effect.tryPromise({
|
|
|
222
225
|
})
|
|
223
226
|
}).pipe(Effect.map(Option.fromUndefinedOr), Effect.orElseSucceed(() => Option.none()));
|
|
224
227
|
// src/entities/workspace/model/workspace-projects.ts
|
|
225
|
-
const MANIFEST_FILE$
|
|
228
|
+
const MANIFEST_FILE$2 = "package.json";
|
|
226
229
|
const ROOT_DIRECTORY = "";
|
|
227
230
|
const byDirectory = Order.mapInput(String$1.Order, ({ directory }) => directory);
|
|
228
231
|
const projectsMatching = (root, patterns) => Effect.tryPromise({
|
|
@@ -262,7 +265,7 @@ const RootManifest = Schema.fromJsonString(Schema.Struct({
|
|
|
262
265
|
}));
|
|
263
266
|
const rootProject = Effect.fn("rootProject")(function* rootProject(root) {
|
|
264
267
|
const files = yield* RepositoryFiles;
|
|
265
|
-
const text = yield* files.readFile(files.join(root, MANIFEST_FILE$
|
|
268
|
+
const text = yield* files.readFile(files.join(root, MANIFEST_FILE$2));
|
|
266
269
|
return pipe(text, Option.flatMap(Schema.decodeOption(RootManifest)), Option.map((own) => ({
|
|
267
270
|
directory: ROOT_DIRECTORY,
|
|
268
271
|
packageName: Option.some(own.name),
|
|
@@ -277,7 +280,7 @@ const publishedProjects = Effect.fn("publishedProjects")(function* publishedProj
|
|
|
277
280
|
return pipe(Option.toArray(own), Array.appendAll(members), Array.filter(({ published }) => published));
|
|
278
281
|
});
|
|
279
282
|
// src/entities/workspace/model/workspace-patterns.ts
|
|
280
|
-
const SEPARATOR$
|
|
283
|
+
const SEPARATOR$1 = "/";
|
|
281
284
|
const NEGATION = "!";
|
|
282
285
|
const RELATIVE = "./";
|
|
283
286
|
const withoutRelative = (target) => {
|
|
@@ -285,9 +288,42 @@ const withoutRelative = (target) => {
|
|
|
285
288
|
return target;
|
|
286
289
|
};
|
|
287
290
|
const prefixed = (directory) => (pattern) => {
|
|
288
|
-
if (String$1.startsWith(NEGATION)(pattern)) return `${NEGATION}${directory}${SEPARATOR$
|
|
289
|
-
return `${directory}${SEPARATOR$
|
|
291
|
+
if (String$1.startsWith(NEGATION)(pattern)) return `${NEGATION}${directory}${SEPARATOR$1}${String$1.slice(1)(pattern)}`;
|
|
292
|
+
return `${directory}${SEPARATOR$1}${withoutRelative(pattern)}`;
|
|
290
293
|
};
|
|
294
|
+
// src/entities/workspace/model/shadcn-ui.ts
|
|
295
|
+
const SHADCN_FILE = "components.json";
|
|
296
|
+
const MANIFEST_FILE$1 = "package.json";
|
|
297
|
+
const WILDCARD$1 = "*";
|
|
298
|
+
const EVERYTHING = "/**";
|
|
299
|
+
const ShadcnConfig = Schema.Struct({ aliases: Schema.Struct({ ui: Schema.String }) });
|
|
300
|
+
const ManifestImports = Schema.Struct({ imports: Schema.optional(Schema.Record(Schema.String, Schema.String)) });
|
|
301
|
+
const decodeShadcnConfig = Schema.decodeUnknownOption(Schema.fromJsonString(ShadcnConfig));
|
|
302
|
+
const decodeManifestImports = Schema.decodeUnknownOption(Schema.fromJsonString(ManifestImports));
|
|
303
|
+
const withoutWildcard = String$1.replace(WILDCARD$1, "");
|
|
304
|
+
const importTarget = (alias) => ([key, target]) => {
|
|
305
|
+
if (!String$1.endsWith(WILDCARD$1)(key)) return Option.some(target).pipe(Option.filter(() => key === alias));
|
|
306
|
+
const prefix = withoutWildcard(key);
|
|
307
|
+
if (!String$1.startsWith(prefix)(alias)) return Option.none();
|
|
308
|
+
return Option.some(`${withoutWildcard(target)}${String$1.slice(prefix.length)(alias)}`);
|
|
309
|
+
};
|
|
310
|
+
const resolvedAlias = (imports, alias) => pipe(Record.toEntries(imports), Array.findFirst(importTarget(alias)), Option.map(withoutRelative));
|
|
311
|
+
const shadcnUiOf = Effect.fn("shadcnUiOf")(function* shadcnUiOf(root, directory) {
|
|
312
|
+
const files = yield* RepositoryFiles;
|
|
313
|
+
const file = files.join(root, directory, SHADCN_FILE);
|
|
314
|
+
const configText = yield* files.readFile(file);
|
|
315
|
+
const manifestText = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$1));
|
|
316
|
+
const imports = pipe(manifestText, Option.flatMap(decodeManifestImports), Option.flatMap((manifest) => Option.fromUndefinedOr(manifest.imports)));
|
|
317
|
+
return pipe(configText, Option.flatMap(decodeShadcnConfig), Option.map(({ aliases }) => ({
|
|
318
|
+
file,
|
|
319
|
+
alias: aliases.ui,
|
|
320
|
+
target: pipe(imports, Option.flatMap((map) => resolvedAlias(map, aliases.ui)))
|
|
321
|
+
})));
|
|
322
|
+
});
|
|
323
|
+
const shadcnUiIn = Effect.fn("shadcnUiIn")(function* shadcnUiIn(root, directory) {
|
|
324
|
+
const found = yield* shadcnUiOf(root, directory);
|
|
325
|
+
return pipe(found, Option.map(({ alias, target }) => `${prefixed(directory)(Option.getOrElse(target, () => alias))}${EVERYTHING}`));
|
|
326
|
+
});
|
|
291
327
|
// src/entities/workspace/model/workspace-names.ts
|
|
292
328
|
const ALTERNATIVE = "|";
|
|
293
329
|
const SCOPE = /^@[^/]+\//u;
|
|
@@ -318,7 +354,7 @@ const namedWorkspaces = Effect.fn("namedWorkspaces")(function* namedWorkspaces(r
|
|
|
318
354
|
});
|
|
319
355
|
// src/entities/workspace/model/deploy-entries.ts
|
|
320
356
|
const MAIN_KEY = "main";
|
|
321
|
-
const READ_CONCURRENCY
|
|
357
|
+
const READ_CONCURRENCY = 16;
|
|
322
358
|
const SCRIPT = /\.[cm]?tsx?$/u;
|
|
323
359
|
const SKIPPED = /\.test\.|\.d\.[cm]?ts$/u;
|
|
324
360
|
const ALCHEMY_IMPORT = /from\s+["'](?:alchemy|@alchemy\.run)(?:\/[^"']*)?["']/u;
|
|
@@ -339,12 +375,12 @@ const declaredIn = Effect.fn("declaredIn")(function* declaredIn(root, file) {
|
|
|
339
375
|
const deployEntries = Effect.fn("deployEntries")(function* deployEntries(root) {
|
|
340
376
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
341
377
|
const declaring = pipe(listed, Array.filter((file) => SCRIPT.test(file) && !SKIPPED.test(file)));
|
|
342
|
-
const found = yield* Effect.forEach(declaring, (file) => declaredIn(root, file), { concurrency: READ_CONCURRENCY
|
|
378
|
+
const found = yield* Effect.forEach(declaring, (file) => declaredIn(root, file), { concurrency: READ_CONCURRENCY });
|
|
343
379
|
return pipe(Array.flatten(found), Array.filter((file) => Array.contains(listed, file)), Array.dedupe);
|
|
344
380
|
});
|
|
345
381
|
// src/entities/workspace/model/lockfile-unreadable.ts
|
|
346
|
-
const taggedError
|
|
347
|
-
var LockfileUnreadable = class extends taggedError
|
|
382
|
+
const taggedError = Schema.TaggedError;
|
|
383
|
+
var LockfileUnreadable = class extends taggedError()("LockfileUnreadable", {
|
|
348
384
|
root: Schema.String,
|
|
349
385
|
reason: Schema.String
|
|
350
386
|
}) {};
|
|
@@ -361,8 +397,8 @@ const wantedLockfile = (root) => Effect.tryPromise({
|
|
|
361
397
|
const lockedPackages = (root) => wantedLockfile(root).pipe(Effect.map(Option.flatMap(({ packages }) => Option.fromUndefinedOr(packages))), Effect.map(Option.map(Record.keys)));
|
|
362
398
|
// src/entities/workspace/model/locked-graph.ts
|
|
363
399
|
const MANIFEST = "package.json";
|
|
364
|
-
const ROOT_IMPORTER = ".";
|
|
365
|
-
const importerManifest = (id) => Option.match(Option.liftPredicate(id, (found) => found === ROOT_IMPORTER), {
|
|
400
|
+
const ROOT_IMPORTER$1 = ".";
|
|
401
|
+
const importerManifest = (id) => Option.match(Option.liftPredicate(id, (found) => found === ROOT_IMPORTER$1), {
|
|
366
402
|
onNone: () => `${id}/${MANIFEST}`,
|
|
367
403
|
onSome: () => MANIFEST
|
|
368
404
|
});
|
|
@@ -383,6 +419,128 @@ const nodesOf = (lockfile) => [...pipe(Record.toEntries(lockfile.importers), Arr
|
|
|
383
419
|
})))];
|
|
384
420
|
/** @internal */
|
|
385
421
|
const lockedGraph = (root) => wantedLockfile(root).pipe(Effect.map(Option.map(nodesOf)));
|
|
422
|
+
// src/entities/workspace/model/locked-links.ts
|
|
423
|
+
const LINK = "link:";
|
|
424
|
+
const linkedPaths = (sections) => pipe(sections, Array.flatMap((resolved) => Record.values(resolved ?? {})), Array.filter(String$1.startsWith(LINK)), Array.map((reference) => String$1.slice(5)(reference)));
|
|
425
|
+
/** @internal */
|
|
426
|
+
const workspaceLinks = Effect.fn("workspaceLinks")(function* workspaceLinks(root) {
|
|
427
|
+
const files = yield* RepositoryFiles;
|
|
428
|
+
const lockfile = yield* wantedLockfile(root);
|
|
429
|
+
const linksOf = (id, paths) => {
|
|
430
|
+
const from = files.relative(root, files.join(root, id));
|
|
431
|
+
return pipe(paths, Array.map((path) => ({
|
|
432
|
+
from,
|
|
433
|
+
to: files.relative(root, files.join(root, id, path))
|
|
434
|
+
})));
|
|
435
|
+
};
|
|
436
|
+
return pipe(lockfile, Option.map(({ importers }) => pipe(Record.toEntries(importers), Array.flatMap(([id, project]) => linksOf(id, linkedPaths([
|
|
437
|
+
project.dependencies,
|
|
438
|
+
project.devDependencies,
|
|
439
|
+
project.optionalDependencies
|
|
440
|
+
]))))), Option.getOrElse(() => []));
|
|
441
|
+
});
|
|
442
|
+
// src/entities/workspace/model/locked-closures.ts
|
|
443
|
+
const IMPORTER = "importer:";
|
|
444
|
+
const ROOT_IMPORTER = ".";
|
|
445
|
+
const usedSections = ({ dependencies, optionalDependencies }) => [dependencies, optionalDependencies];
|
|
446
|
+
const packageEdges = (packages) => pipe(Record.toEntries(packages), Array.map(([id, snapshot]) => [id, pipe(usedSections(snapshot), Array.flatMap(depPathsOf))]));
|
|
447
|
+
const closureOf = (edges) => ({ own }) => {
|
|
448
|
+
const packages = pipe(reachable(edges, own), Array.filter((id) => !String$1.startsWith(IMPORTER)(id)));
|
|
449
|
+
return Array.sort(packages, String$1.Order);
|
|
450
|
+
};
|
|
451
|
+
/** @internal */
|
|
452
|
+
const lockedClosures = Effect.fn("lockedClosures")(function* lockedClosures(root) {
|
|
453
|
+
const files = yield* RepositoryFiles;
|
|
454
|
+
const lockfile = yield* wantedLockfile(root);
|
|
455
|
+
const nodesOf = (id, sections) => [...pipe(sections, Array.flatMap(depPathsOf)), ...pipe(linkedPaths(sections), Array.map((path) => files.relative(root, files.join(root, id, path))), Array.map((linked) => `${IMPORTER}${Option.getOrElse(Option.liftPredicate(linked, String$1.isNonEmpty), () => ROOT_IMPORTER)}`))];
|
|
456
|
+
return pipe(lockfile, Option.map(({ importers, packages }) => {
|
|
457
|
+
const found = pipe(Record.toEntries(importers), Array.map(([id, project]) => {
|
|
458
|
+
const used = usedSections(project);
|
|
459
|
+
return {
|
|
460
|
+
id,
|
|
461
|
+
own: nodesOf(id, [...used, project.devDependencies]),
|
|
462
|
+
used: nodesOf(id, used)
|
|
463
|
+
};
|
|
464
|
+
}));
|
|
465
|
+
const edges = Record.fromEntries([...pipe(found, Array.map(({ id, used }) => [`${IMPORTER}${id}`, used])), ...packageEdges(packages ?? {})]);
|
|
466
|
+
return Record.fromEntries(pipe(found, Array.map((importer) => [importer.id, closureOf(edges)(importer)])));
|
|
467
|
+
}));
|
|
468
|
+
});
|
|
469
|
+
// src/entities/workspace/model/locked-closure-files.ts
|
|
470
|
+
const LINE = "\n";
|
|
471
|
+
const FILE_CONCURRENCY = 16;
|
|
472
|
+
const writeChanged = Effect.fn("writeChanged")(function* writeChanged(file, text) {
|
|
473
|
+
const files = yield* RepositoryFiles;
|
|
474
|
+
const written = yield* files.readFile(file);
|
|
475
|
+
if (!Option.exists(written, (found) => found === text)) yield* files.writeFile(file, text);
|
|
476
|
+
});
|
|
477
|
+
const isWritten = Effect.fn("isWritten")(function* isWritten(root, fingerprint) {
|
|
478
|
+
const files = yield* RepositoryFiles;
|
|
479
|
+
const recorded = yield* files.readFile(files.join(root, FINGERPRINT_FILE));
|
|
480
|
+
const [hash, ...importers] = String$1.split(Option.getOrElse(recorded, () => ""), LINE);
|
|
481
|
+
if (hash !== fingerprint) return false;
|
|
482
|
+
const present = yield* Effect.forEach(importers, (importer) => files.exists(files.join(root, importer, CLOSURE_FILE)), { concurrency: FILE_CONCURRENCY });
|
|
483
|
+
return pipe(present, Array.every(Boolean));
|
|
484
|
+
});
|
|
485
|
+
const writeAll = Effect.fn("writeAll")(function* writeAll(root, fingerprint) {
|
|
486
|
+
const files = yield* RepositoryFiles;
|
|
487
|
+
const closures = yield* lockedClosures(root);
|
|
488
|
+
const entries = Record.toEntries(Option.getOrElse(closures, () => ({})));
|
|
489
|
+
yield* Effect.forEach(entries, ([importer, closure]) => writeChanged(files.join(root, importer, CLOSURE_FILE), Array.join(closure, LINE)), {
|
|
490
|
+
concurrency: FILE_CONCURRENCY,
|
|
491
|
+
discard: true
|
|
492
|
+
});
|
|
493
|
+
const importers = pipe(entries, Array.map(([importer]) => importer));
|
|
494
|
+
yield* files.writeFile(files.join(root, FINGERPRINT_FILE), Array.join([fingerprint, ...importers], LINE));
|
|
495
|
+
});
|
|
496
|
+
/** @internal */
|
|
497
|
+
const writeLockedClosures = Effect.fn("writeLockedClosures")(function* writeLockedClosures(root) {
|
|
498
|
+
const files = yield* RepositoryFiles;
|
|
499
|
+
const fingerprint = yield* files.hashFile(files.join(root, LOCK_FILE));
|
|
500
|
+
if (Option.isNone(fingerprint)) return;
|
|
501
|
+
if (!(yield* isWritten(root, fingerprint.value))) yield* writeAll(root, fingerprint.value);
|
|
502
|
+
});
|
|
503
|
+
// src/entities/workspace/model/cargo-crates.ts
|
|
504
|
+
const SEPARATOR = "/";
|
|
505
|
+
const CrateTarget = Schema.Struct({ kind: Schema.Array(Schema.String) });
|
|
506
|
+
const CrateDependency = Schema.Struct({ path: Schema.optional(Schema.String) });
|
|
507
|
+
const CrateEntry = Schema.Struct({
|
|
508
|
+
name: Schema.String,
|
|
509
|
+
version: Schema.String,
|
|
510
|
+
manifest_path: Schema.String,
|
|
511
|
+
targets: Schema.Array(CrateTarget),
|
|
512
|
+
dependencies: Schema.Array(CrateDependency)
|
|
513
|
+
});
|
|
514
|
+
const CrateList = Schema.fromJsonString(Schema.Struct({ packages: Schema.Array(CrateEntry) }));
|
|
515
|
+
const decodeCrateList = Schema.decodeUnknownEffect(CrateList);
|
|
516
|
+
const crateOf = (crate) => ({
|
|
517
|
+
name: crate.name,
|
|
518
|
+
version: crate.version,
|
|
519
|
+
manifest: crate.manifest_path,
|
|
520
|
+
kinds: pipe(crate.targets, Array.flatMap(({ kind }) => kind), Array.dedupe),
|
|
521
|
+
pathDependencies: pipe(crate.dependencies, Array.flatMap(({ path }) => Option.toArray(Option.fromUndefinedOr(path))))
|
|
522
|
+
});
|
|
523
|
+
/** @internal */
|
|
524
|
+
const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
525
|
+
const output = yield* (yield* ChildProcess.make("cargo", [
|
|
526
|
+
"metadata",
|
|
527
|
+
"--no-deps",
|
|
528
|
+
"--format-version",
|
|
529
|
+
"1",
|
|
530
|
+
"--offline"
|
|
531
|
+
], {
|
|
532
|
+
cwd: root,
|
|
533
|
+
extendEnv: true,
|
|
534
|
+
stdin: "ignore"
|
|
535
|
+
})).stdout.pipe(Stream.decodeText(), Stream.mkString);
|
|
536
|
+
const list = yield* decodeCrateList(output);
|
|
537
|
+
return pipe(list.packages, Array.map(crateOf));
|
|
538
|
+
}, Effect.scoped);
|
|
539
|
+
/** @internal */
|
|
540
|
+
const owningWorkspace = (directories) => (directory) => {
|
|
541
|
+
const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR}`)(directory)));
|
|
542
|
+
return Array.last(Array.sort(owners, String$1.Order));
|
|
543
|
+
};
|
|
386
544
|
// src/entities/package/model/dependencies.ts
|
|
387
545
|
const DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));
|
|
388
546
|
const PackageManifest = Schema.Struct({
|
|
@@ -397,7 +555,7 @@ const PackageManifest = Schema.Struct({
|
|
|
397
555
|
});
|
|
398
556
|
const MANIFEST_FILE = "package.json";
|
|
399
557
|
const WORKSPACE_PROTOCOL = "workspace:";
|
|
400
|
-
const ROOT_SUBPATH
|
|
558
|
+
const ROOT_SUBPATH = ".";
|
|
401
559
|
const SUBPATH_PREFIX = "./";
|
|
402
560
|
const WILDCARD = "*";
|
|
403
561
|
const TYPES_CONDITION = "types";
|
|
@@ -432,18 +590,18 @@ const anyConditionIn = (held, depth) => {
|
|
|
432
590
|
const targetPathsOf = (target) => Array.getSomes([typesConditionIn(target, ROOT_DEPTH), anyConditionIn(target, ROOT_DEPTH)]);
|
|
433
591
|
const subpathTargetsOf = (exportsField) => {
|
|
434
592
|
if (Predicate.isString(exportsField)) return [{
|
|
435
|
-
subpath: ROOT_SUBPATH
|
|
593
|
+
subpath: ROOT_SUBPATH,
|
|
436
594
|
target: exportsField
|
|
437
595
|
}];
|
|
438
596
|
const entries = conditionsOf(exportsField);
|
|
439
|
-
if (!pipe(entries, Array.some(([subpath]) => String$1.startsWith(ROOT_SUBPATH
|
|
597
|
+
if (!pipe(entries, Array.some(([subpath]) => String$1.startsWith(ROOT_SUBPATH)(subpath)))) return Array.match(entries, {
|
|
440
598
|
onEmpty: () => [],
|
|
441
599
|
onNonEmpty: () => [{
|
|
442
|
-
subpath: ROOT_SUBPATH
|
|
600
|
+
subpath: ROOT_SUBPATH,
|
|
443
601
|
target: exportsField
|
|
444
602
|
}]
|
|
445
603
|
});
|
|
446
|
-
return pipe(entries, Array.filter(([subpath]) => subpath === ROOT_SUBPATH
|
|
604
|
+
return pipe(entries, Array.filter(([subpath]) => subpath === ROOT_SUBPATH || String$1.startsWith(SUBPATH_PREFIX)(subpath)), Array.filter(([subpath]) => !String$1.includes(WILDCARD)(subpath)), Array.map(([subpath, target]) => ({
|
|
447
605
|
subpath,
|
|
448
606
|
target
|
|
449
607
|
})));
|
|
@@ -470,7 +628,7 @@ const importNameOf = (packageName) => {
|
|
|
470
628
|
};
|
|
471
629
|
const specifierFor = (packageName, subpath) => {
|
|
472
630
|
const importName = importNameOf(packageName);
|
|
473
|
-
if (subpath === ROOT_SUBPATH
|
|
631
|
+
if (subpath === ROOT_SUBPATH) return importName;
|
|
474
632
|
return `${importName}/${String$1.slice(2)(subpath)}`;
|
|
475
633
|
};
|
|
476
634
|
const rootEntryPaths = (manifest) => Array.getSomes([
|
|
@@ -490,7 +648,7 @@ const entriesOfDependency = Effect.fn("entriesOfDependency")(function* entriesOf
|
|
|
490
648
|
const manifest = yield* readManifest(directory);
|
|
491
649
|
if (Option.isNone(manifest)) return [];
|
|
492
650
|
const subpathEntries = yield* subpathEntriesOf(packageName, directory, manifest.value);
|
|
493
|
-
const rootSpecifier = specifierFor(packageName, ROOT_SUBPATH
|
|
651
|
+
const rootSpecifier = specifierFor(packageName, ROOT_SUBPATH);
|
|
494
652
|
if (pipe(subpathEntries, Array.some((entry) => entry.specifier === rootSpecifier))) return subpathEntries;
|
|
495
653
|
return [...(yield* firstDeclarationsAmong(directory, rootEntryPaths(manifest.value))).pipe(Option.map((declarationsPath) => ({
|
|
496
654
|
packageName,
|
|
@@ -515,143 +673,6 @@ const dependencyEntries = Effect.fn("dependencyEntries")(function* dependencyEnt
|
|
|
515
673
|
const entries = yield* Effect.forEach(declaredDependencies(manifest.value), (packageName) => entriesOfDependency(packageName, files.join(packageDirectory, NODE_MODULES, packageName)), { concurrency: 1 });
|
|
516
674
|
return Array.sort(Array.dedupeWith(entries.flat(), (left, right) => left.specifier === right.specifier), entryOrder);
|
|
517
675
|
});
|
|
518
|
-
|
|
519
|
-
const SOURCE = /\.[cm]?tsx?$/u;
|
|
520
|
-
const BUILT = /\.(?:d\.)?[cm]?[jt]s$/u;
|
|
521
|
-
const DECLARATION = ".d.";
|
|
522
|
-
const SEPARATOR$1 = "/";
|
|
523
|
-
const ROOT_SUBPATH = ".";
|
|
524
|
-
const BIN_LABEL = "bin";
|
|
525
|
-
const targetsIn = (held) => {
|
|
526
|
-
if (Predicate.isString(held)) return [held];
|
|
527
|
-
if (!Predicate.isObject(held)) return [];
|
|
528
|
-
return pipe(Record.values(held), Array.flatMap(targetsIn));
|
|
529
|
-
};
|
|
530
|
-
const subpathsOf = (exportsField) => {
|
|
531
|
-
if (!Predicate.isObject(exportsField)) return [[ROOT_SUBPATH, exportsField]];
|
|
532
|
-
const entries = Record.toEntries(exportsField);
|
|
533
|
-
if (pipe(entries, Array.some(([key]) => String$1.startsWith(ROOT_SUBPATH)(key)))) return entries;
|
|
534
|
-
return [[ROOT_SUBPATH, exportsField]];
|
|
535
|
-
};
|
|
536
|
-
const binsOf = (manifest) => {
|
|
537
|
-
if (Predicate.isString(manifest.bin)) {
|
|
538
|
-
const name = Option.getOrElse(Option.fromUndefinedOr(manifest.name), () => "");
|
|
539
|
-
return [[`${BIN_LABEL} ${name}`, manifest.bin]];
|
|
540
|
-
}
|
|
541
|
-
if (!Predicate.isObject(manifest.bin)) return [];
|
|
542
|
-
return pipe(Record.toEntries(manifest.bin), Array.map(([name, target]) => [`${BIN_LABEL} ${name}`, target]));
|
|
543
|
-
};
|
|
544
|
-
const baseNameOf = (target) => pipe(String$1.split(target, SEPARATOR$1), Array.last, Option.getOrElse(() => target), String$1.replace(BUILT, ""));
|
|
545
|
-
const sourceOf = ({ join, packEntries }) => (target) => {
|
|
546
|
-
if (SOURCE.test(target) && !String$1.includes(DECLARATION)(target)) return Option.some(join(target));
|
|
547
|
-
const name = baseNameOf(target);
|
|
548
|
-
return pipe(packEntries, Array.findFirst((entry) => entry.name === name), Option.map((entry) => entry.source));
|
|
549
|
-
};
|
|
550
|
-
const publicEntriesOf = (lookup) => pipe([...subpathsOf(lookup.manifest.exports), ...binsOf(lookup.manifest)], Array.flatMap(([label, held]) => pipe(targetsIn(held), Array.map(sourceOf(lookup)), Array.getSomes, Array.map((source) => ({
|
|
551
|
-
label,
|
|
552
|
-
source
|
|
553
|
-
})))), Array.dedupeWith((left, right) => left.label === right.label && left.source === right.source));
|
|
554
|
-
const EntryManifestFields = Schema.Struct({
|
|
555
|
-
name: Schema.optional(Schema.String),
|
|
556
|
-
exports: Schema.optional(Schema.Unknown),
|
|
557
|
-
bin: Schema.optional(Schema.Unknown)
|
|
558
|
-
});
|
|
559
|
-
const EntryManifestJson = Schema.fromJsonString(EntryManifestFields);
|
|
560
|
-
// src/entities/package/model/published.ts
|
|
561
|
-
const CONFIG_FILE = "vite.config.ts";
|
|
562
|
-
const SEPARATOR = "/";
|
|
563
|
-
const READ_CONCURRENCY = 16;
|
|
564
|
-
const SOURCE_EXTENSION = /\.[cm]?tsx?$/u;
|
|
565
|
-
const UNIT_BYTES = [
|
|
566
|
-
["B", 1],
|
|
567
|
-
["kB", 1e3],
|
|
568
|
-
["MB", 1e6]
|
|
569
|
-
];
|
|
570
|
-
const SizeText = Schema.TemplateLiteralParser([
|
|
571
|
-
Schema.Finite,
|
|
572
|
-
" ",
|
|
573
|
-
Schema.Literals([
|
|
574
|
-
"B",
|
|
575
|
-
"kB",
|
|
576
|
-
"MB"
|
|
577
|
-
])
|
|
578
|
-
]);
|
|
579
|
-
const PackEntry = Schema.Union([
|
|
580
|
-
Schema.String,
|
|
581
|
-
Schema.Array(Schema.String),
|
|
582
|
-
Schema.Record(Schema.String, Schema.String)
|
|
583
|
-
]);
|
|
584
|
-
const PackSettings = Schema.Struct({ entry: Schema.optional(PackEntry) });
|
|
585
|
-
const PackList = Schema.Union([PackSettings, Schema.Array(PackSettings)]);
|
|
586
|
-
const isEntryList = Schema.is(Schema.Array(Schema.String));
|
|
587
|
-
const WorkspaceConfig = Schema.Struct({
|
|
588
|
-
msch: Schema.Struct({ publish: Schema.Struct({ installSize: SizeText }) }),
|
|
589
|
-
pack: Schema.optional(PackList)
|
|
590
|
-
});
|
|
591
|
-
const PublicManifest = Schema.Struct({ private: Schema.optional(Schema.Literal(false)) });
|
|
592
|
-
const taggedError = Schema.TaggedError;
|
|
593
|
-
var WorkspaceConfigUnreadable = class extends taggedError()("WorkspaceConfigUnreadable", { file: Schema.String }) {};
|
|
594
|
-
const bytesPer = (unit) => pipe(UNIT_BYTES, Array.findFirst(([name]) => name === unit), Option.map(([, bytes]) => bytes), Option.getOrElse(() => NaN));
|
|
595
|
-
const nameOf = (source) => pipe(String$1.split(source, SEPARATOR), Array.last, Option.getOrElse(() => source), String$1.replace(SOURCE_EXTENSION, ""));
|
|
596
|
-
const entriesOf = (entry) => {
|
|
597
|
-
if (Predicate.isString(entry)) return [{
|
|
598
|
-
name: nameOf(entry),
|
|
599
|
-
source: entry
|
|
600
|
-
}];
|
|
601
|
-
if (isEntryList(entry)) return pipe(entry, Array.map((source) => ({
|
|
602
|
-
name: nameOf(source),
|
|
603
|
-
source
|
|
604
|
-
})));
|
|
605
|
-
return pipe(Record.toEntries(entry), Array.map(([name, source]) => ({
|
|
606
|
-
name,
|
|
607
|
-
source
|
|
608
|
-
})));
|
|
609
|
-
};
|
|
610
|
-
const packEntriesOf = (pack) => pipe(Option.fromUndefinedOr(pack), Option.map(Array.ensure), Option.getOrElse(() => []), Array.flatMap((setting) => pipe(Option.fromUndefinedOr(setting.entry), Option.match({
|
|
611
|
-
onNone: () => [],
|
|
612
|
-
onSome: entriesOf
|
|
613
|
-
}))));
|
|
614
|
-
const settingsIn = Effect.fn("settingsIn")(function* settingsIn(file) {
|
|
615
|
-
const config = yield* Effect.tryPromise({
|
|
616
|
-
try: () => resolveConfigFromFile(file),
|
|
617
|
-
catch: () => WorkspaceConfigUnreadable.make({ file })
|
|
618
|
-
}).pipe(Effect.option);
|
|
619
|
-
return pipe(config, Option.flatMap(Schema.decodeUnknownOption(WorkspaceConfig)));
|
|
620
|
-
});
|
|
621
|
-
const isPublicPackage = Effect.fn("isPublicPackage")(function* isPublicPackage(directory) {
|
|
622
|
-
const files = yield* RepositoryFiles;
|
|
623
|
-
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));
|
|
624
|
-
return Option.exists(text, (found) => Option.isSome(Schema.decodeOption(Schema.fromJsonString(PublicManifest))(found)));
|
|
625
|
-
});
|
|
626
|
-
const workspaceOf = (directory, configFile, join) => ({ msch, pack }) => {
|
|
627
|
-
const [amount, , unit] = msch.publish.installSize;
|
|
628
|
-
return {
|
|
629
|
-
directory,
|
|
630
|
-
configFile,
|
|
631
|
-
installSize: `${amount} ${unit}`,
|
|
632
|
-
installBudget: amount * bytesPer(unit),
|
|
633
|
-
packEntries: pipe(packEntriesOf(pack), Array.map((entry) => ({
|
|
634
|
-
name: entry.name,
|
|
635
|
-
source: join(entry.source)
|
|
636
|
-
})))
|
|
637
|
-
};
|
|
638
|
-
};
|
|
639
|
-
const publishedIn = Effect.fn("publishedIn")(function* publishedIn(root, configName) {
|
|
640
|
-
const files = yield* RepositoryFiles;
|
|
641
|
-
const configFile = files.join(root, configName);
|
|
642
|
-
const directory = files.dirname(configFile);
|
|
643
|
-
if (!(yield* isPublicPackage(directory))) return Option.none();
|
|
644
|
-
const settings = yield* settingsIn(configFile);
|
|
645
|
-
return pipe(settings, Option.map(workspaceOf(directory, configFile, (source) => files.join(directory, source))));
|
|
646
|
-
});
|
|
647
|
-
/** @internal */
|
|
648
|
-
const publishedWorkspaces = Effect.fn("publishedWorkspaces")(function* publishedWorkspaces(root) {
|
|
649
|
-
const files = yield* RepositoryFiles;
|
|
650
|
-
const names = yield* files.listedFiles(root);
|
|
651
|
-
const configs = pipe(names, Array.filter((name) => files.basename(name) === CONFIG_FILE && String$1.includes(SEPARATOR)(name)));
|
|
652
|
-
const found = yield* Effect.forEach(configs, (name) => publishedIn(root, name), { concurrency: READ_CONCURRENCY });
|
|
653
|
-
return Array.getSomes(found);
|
|
654
|
-
});
|
|
655
|
-
export { programOf as A, stringsIn as B, TEST_TASK as C, tasksOf as D, hasVerifyTask as E, childrenOf as F, keyName as I, literalOf as L, usedFrom as M, workspaceConfigOf as N, literalSettings as O, KeySchema as P, nestedValues as R, RUN_TASKS as S, definesTask as T, publishedProjects as _, publicEntriesOf as a, runTasksOf as b, readManifest as c, lockedPackages as d, deployEntries as f, withoutRelative as g, prefixed as h, EntryManifestJson as i, settingsInvalid as j, merged as k, workspaceDependencies as l, patternOf as m, entriesOf as n, MANIFEST_FILE as o, namedWorkspaces as p, publishedWorkspaces as r, dependencyEntries as s, PackEntry as t, lockedGraph as u, workspaceDirectories as v, VERIFY_TASK as w, NO_TASKS as x, workspaceManifest as y, propertyValue as z };
|
|
676
|
+
export { programOf as A, stringsIn as B, TEST_TASK as C, tasksOf as D, hasVerifyTask as E, childrenOf as F, keyName as I, literalOf as L, usedFrom as M, workspaceConfigOf as N, literalSettings as O, KeySchema as P, nestedValues as R, RUN_TASKS as S, definesTask as T, publishedProjects as _, cratesIn as a, runTasksOf as b, workspaceLinks as c, deployEntries as d, namedWorkspaces as f, prefixed as g, shadcnUiOf as h, workspaceDependencies as i, settingsInvalid as j, merged as k, lockedGraph as l, shadcnUiIn as m, dependencyEntries as n, owningWorkspace as o, patternOf as p, readManifest as r, writeLockedClosures as s, MANIFEST_FILE as t, lockedPackages as u, workspaceDirectories as v, VERIFY_TASK as w, NO_TASKS as x, workspaceManifest as y, propertyValue as z };
|
|
656
677
|
|
|
657
|
-
//# sourceMappingURL=
|
|
678
|
+
//# sourceMappingURL=dependencies-v59cxwTD.mjs.map
|