@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.
Files changed (61) hide show
  1. package/README.md +10 -9
  2. package/dist/cargo-inputs.d.mts +1 -0
  3. package/dist/cargo-inputs.mjs +149 -94
  4. package/dist/cargo-inputs.mjs.map +1 -1
  5. package/dist/changed.d.mts +1 -0
  6. package/dist/changed.mjs +178 -0
  7. package/dist/changed.mjs.map +1 -0
  8. package/dist/cli-contract-BY7vwgKc.mjs +41 -0
  9. package/dist/cli-contract-BY7vwgKc.mjs.map +1 -0
  10. package/dist/cli.mjs +757 -938
  11. package/dist/cli.mjs.map +1 -1
  12. package/dist/config.d.mts +3 -1
  13. package/dist/config.mjs +19 -9
  14. package/dist/config.mjs.map +1 -1
  15. package/dist/decision-rules.d.mts +1 -1
  16. package/dist/decision-rules.mjs +1 -1
  17. package/dist/{define-lint-preset-DKJku2ZR.mjs → define-lint-preset-CxzPzVuB.mjs} +15 -24
  18. package/dist/define-lint-preset-CxzPzVuB.mjs.map +1 -0
  19. package/dist/{package-vbK0Qycn.mjs → dependencies-v59cxwTD.mjs} +186 -165
  20. package/dist/dependencies-v59cxwTD.mjs.map +1 -0
  21. package/dist/{ignored-directories-CfACwIvu.mjs → ignored-directories-thSB0IAT.mjs} +13 -6
  22. package/dist/ignored-directories-thSB0IAT.mjs.map +1 -0
  23. package/dist/{index-BwiAHe_u.d.mts → index-DL7PSp7j.d.mts} +3 -3
  24. package/dist/lint.d.mts +1 -1
  25. package/dist/lint.mjs +1 -1
  26. package/dist/locked-closure-paths-Dtqs8uBU.mjs +7 -0
  27. package/dist/locked-closure-paths-Dtqs8uBU.mjs.map +1 -0
  28. package/dist/locked-inputs.d.mts +12 -0
  29. package/dist/locked-inputs.mjs +20 -0
  30. package/dist/locked-inputs.mjs.map +1 -0
  31. package/dist/oxlint.mjs +2 -1
  32. package/dist/oxlint.mjs.map +1 -1
  33. package/dist/package-Bdv6W97F.mjs +144 -0
  34. package/dist/package-Bdv6W97F.mjs.map +1 -0
  35. package/dist/project-DeQcAglt.mjs +464 -0
  36. package/dist/project-DeQcAglt.mjs.map +1 -0
  37. package/dist/publish.mjs +413 -169
  38. package/dist/publish.mjs.map +1 -1
  39. package/dist/reachable-Cc-255L3.mjs +13 -0
  40. package/dist/reachable-Cc-255L3.mjs.map +1 -0
  41. package/dist/{repository-files-CPfBA4mf.mjs → repository-files-aXwrITdF.mjs} +3 -2
  42. package/dist/repository-files-aXwrITdF.mjs.map +1 -0
  43. package/dist/{runtime-Dc5gCUSF.mjs → runtime-GbrDfB8K.mjs} +2 -2
  44. package/dist/{runtime-Dc5gCUSF.mjs.map → runtime-GbrDfB8K.mjs.map} +1 -1
  45. package/dist/started-once-CkTooI_o.mjs +13 -0
  46. package/dist/started-once-CkTooI_o.mjs.map +1 -0
  47. package/dist/{cli-contract-DdTV5DaG.mjs → syntax-ct2fFLtv.mjs} +9 -45
  48. package/dist/syntax-ct2fFLtv.mjs.map +1 -0
  49. package/dist/workspace-settings.mjs +8 -32
  50. package/dist/workspace-settings.mjs.map +1 -1
  51. package/package.json +41 -33
  52. package/skills/msch-checks/SKILL.md +1 -1
  53. package/skills/publishing/SKILL.md +6 -4
  54. package/skills/repository-config/SKILL.md +14 -9
  55. package/skills/workspace-settings/SKILL.md +33 -3
  56. package/src/app/vite.d.ts +2 -0
  57. package/dist/cli-contract-DdTV5DaG.mjs.map +0 -1
  58. package/dist/define-lint-preset-DKJku2ZR.mjs.map +0 -1
  59. package/dist/ignored-directories-CfACwIvu.mjs.map +0 -1
  60. package/dist/package-vbK0Qycn.mjs.map +0 -1
  61. package/dist/repository-files-CPfBA4mf.mjs.map +0 -1
@@ -0,0 +1,464 @@
1
+ import { H as isModuleDeclaration, at as isVariableDeclaration, b as InternalSymbolName, c as isGenericDeclaration, h as resolvedSymbol, i as declarationsOf, p as propertyNamesOf, u as isTypeDeclaration, v as API, w as getLeadingCommentRanges, y as IndexKind } from "./syntax-ct2fFLtv.mjs";
2
+ import { i as workspaceDependencies, n as dependencyEntries, r as readManifest, t as MANIFEST_FILE } from "./dependencies-v59cxwTD.mjs";
3
+ import { n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-aXwrITdF.mjs";
4
+ import { Array, Boolean, Effect, Function, Number, Option, Order, Schema, String as String$1, pipe } from "effect";
5
+ // src/shared/lib/values.ts
6
+ const SCHEMA_TYPE_PROPERTIES = ["Type", "_output"];
7
+ const MINIMUM_SET_SIZE = 2;
8
+ const DATA_FIRST_ARITY = 2;
9
+ const valueKey = (value) => `${typeof value}:${String(value)}`;
10
+ const literalValueOf = (type) => {
11
+ if (type.isStringLiteralType() || type.isNumberLiteralType()) return Option.some(type.value);
12
+ return Option.none();
13
+ };
14
+ const literalValuesOf = (types) => {
15
+ const values = pipe(types, Array.map((member) => literalValueOf(member)), Array.getSomes, Array.dedupeWith((left, right) => valueKey(left) === valueKey(right)));
16
+ if (values.length !== types.length || values.length < MINIMUM_SET_SIZE) return Option.none();
17
+ return Option.some(values);
18
+ };
19
+ const literalUnionOf = (type) => {
20
+ if (!type.isUnionType()) return Option.none();
21
+ return literalValuesOf(type.getTypes());
22
+ };
23
+ const elementTypeOf = (checker, type) => {
24
+ if (!checker.isArrayLikeType(type)) return Option.none();
25
+ return Option.fromUndefinedOr(checker.getIndexTypeOfType(type, IndexKind.Number));
26
+ };
27
+ const schemaTypeOf = (checker) => (type) => Array.findFirst(SCHEMA_TYPE_PROPERTIES, (name) => Option.fromUndefinedOr(checker.getPropertyOfType(type, name))).pipe(Option.map((property) => checker.getTypeOfSymbol(property)));
28
+ const finiteValuesOf = (checker) => (type) => literalUnionOf(type).pipe(Option.orElse(() => elementTypeOf(checker, type).pipe(Option.flatMap(literalUnionOf))), Option.orElse(() => schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf))));
29
+ const vocabularyOf = (checker) => (type) => {
30
+ if (!type.isUnionType()) return Option.none();
31
+ const optionalIds = /* @__PURE__ */ new Set([checker.getUndefinedType().id, checker.getNullType().id]);
32
+ const members = pipe(type.getTypes(), Array.filter((member) => !optionalIds.has(member.id)));
33
+ const values = Array.getSomes(pipe(members, Array.map((member) => literalValueOf(member))));
34
+ if (values.length < MINIMUM_SET_SIZE) return Option.none();
35
+ return Option.some({
36
+ values,
37
+ admitsUnnamedValues: values.length !== members.length
38
+ });
39
+ };
40
+ const isSubsetOf = Function.dual(DATA_FIRST_ARITY, (subset, superset) => {
41
+ const held = new Set(pipe(superset, Array.map((value) => valueKey(value))));
42
+ return pipe(subset, Array.every((value) => held.has(valueKey(value))));
43
+ });
44
+ const sameValues = Function.dual(DATA_FIRST_ARITY, (left, right) => left.length === right.length && isSubsetOf(left, right));
45
+ const valueText = (value) => {
46
+ if (typeof value === "string") return `"${value}"`;
47
+ return String(value);
48
+ };
49
+ const formatValues = (values) => pipe(values, Array.map(valueText), Array.join(" | "));
50
+ // src/entities/project/model/library.ts
51
+ const NAMESPACE_DEPTH_LIMIT = 8;
52
+ const EMPTY_INDEX = {
53
+ vocabularies: [],
54
+ shapes: []
55
+ };
56
+ const isObjectType = (checker) => (type) => !type.isUnionType() && !type.isLiteralType() && checker.getApparentType(type).id === type.id && Array.isReadonlyArrayNonEmpty(checker.getPropertiesOfType(type));
57
+ const describeLibraryType = (type) => `${type.typeName} from ${type.specifier}`;
58
+ const locationOf = (declaration) => ({
59
+ file: declaration.getSourceFile().fileName,
60
+ pos: declaration.pos,
61
+ kind: declaration.kind
62
+ });
63
+ const declarationKey = (location) => `${location.file}#${String(location.pos)}#${String(location.kind)}`;
64
+ const shapeOf = (checker) => (source, declaration, type) => Array.filter([{
65
+ ...source,
66
+ declaration: locationOf(declaration),
67
+ propertyNames: propertyNamesOf(checker)(type)
68
+ }], () => isObjectType(checker)(type));
69
+ const declaredTypeIndex = (walk, exported) => {
70
+ const declaration = Array.findFirst(declarationsOf(exported.symbol), isTypeDeclaration);
71
+ if (Option.isNone(declaration) || isGenericDeclaration(declaration.value)) return EMPTY_INDEX;
72
+ const located = {
73
+ specifier: walk.entry.specifier,
74
+ typeName: exported.typeName
75
+ };
76
+ const type = walk.checker.getDeclaredTypeOfSymbol(exported.symbol);
77
+ return {
78
+ vocabularies: vocabularyOf(walk.checker)(type).pipe(Option.map((vocabulary) => ({
79
+ ...located,
80
+ vocabulary
81
+ })), Option.toArray),
82
+ shapes: shapeOf(walk.checker)({
83
+ ...located,
84
+ form: "declared"
85
+ }, declaration.value, type)
86
+ };
87
+ };
88
+ const schemaTypeIndex = (walk, located) => (declaration, schemaType) => ({
89
+ vocabularies: vocabularyOf(walk.checker)(schemaType).pipe(Option.map((vocabulary) => ({
90
+ ...located,
91
+ vocabulary
92
+ })), Option.toArray),
93
+ shapes: shapeOf(walk.checker)({
94
+ ...located,
95
+ form: "schema"
96
+ }, declaration, schemaType)
97
+ });
98
+ const schemaValueIndex = (walk, exported) => {
99
+ const declaration = Array.findFirst(declarationsOf(exported.symbol), isVariableDeclaration);
100
+ if (Option.isNone(declaration)) return EMPTY_INDEX;
101
+ const valueType = walk.checker.getTypeOfSymbolAtLocation(exported.symbol, declaration.value);
102
+ const located = {
103
+ specifier: walk.entry.specifier,
104
+ typeName: `(typeof ${exported.typeName})["Type"]`
105
+ };
106
+ return Option.match(schemaTypeOf(walk.checker)(valueType), {
107
+ onNone: () => EMPTY_INDEX,
108
+ onSome: (schemaType) => schemaTypeIndex(walk, located)(declaration.value, schemaType)
109
+ });
110
+ };
111
+ const mergeIndexes = (indexes) => ({
112
+ vocabularies: pipe(indexes, Array.flatMap((index) => index.vocabularies)),
113
+ shapes: pipe(indexes, Array.flatMap((index) => index.shapes))
114
+ });
115
+ const isNamespace = (symbol) => pipe(declarationsOf(symbol), Array.some((declaration) => isModuleDeclaration(declaration)));
116
+ const indexUnder = (walk, visit) => {
117
+ const symbol = resolvedSymbol(walk.checker)(visit.exported);
118
+ const named = {
119
+ symbol,
120
+ typeName: `${visit.qualifier}${visit.exported.name}`
121
+ };
122
+ const own = mergeIndexes([declaredTypeIndex(walk, named), schemaValueIndex(walk, named)]);
123
+ if (!isNamespace(symbol) || visit.ancestors.length >= NAMESPACE_DEPTH_LIMIT || visit.ancestors.includes(symbol)) return own;
124
+ const nested = pipe(walk.checker.getExportsOfModule(symbol), Array.map((member) => indexUnder(walk, {
125
+ exported: member,
126
+ qualifier: `${named.typeName}.`,
127
+ ancestors: [...visit.ancestors, symbol]
128
+ })));
129
+ return mergeIndexes([own, ...nested]);
130
+ };
131
+ const exportAssignmentOf = (moduleSymbol) => Option.fromUndefinedOr(moduleSymbol.getExports().get(InternalSymbolName.ExportEquals));
132
+ const indexOfEntry = (checker) => (entry) => {
133
+ const moduleSymbol = Option.fromUndefinedOr(checker.getSymbolOfSourceFile(entry.declarationsPath));
134
+ if (Option.isNone(moduleSymbol)) return EMPTY_INDEX;
135
+ const walk = {
136
+ checker,
137
+ entry
138
+ };
139
+ const roots = Option.match(exportAssignmentOf(moduleSymbol.value), {
140
+ onNone: () => checker.getExportsOfModule(moduleSymbol.value),
141
+ onSome: (assigned) => [resolvedSymbol(checker)(assigned)]
142
+ });
143
+ return mergeIndexes(pipe(roots, Array.map((exported) => indexUnder(walk, {
144
+ exported,
145
+ qualifier: "",
146
+ ancestors: []
147
+ }))));
148
+ };
149
+ const libraryCache = () => {
150
+ const indexes = /* @__PURE__ */ new Map();
151
+ return { indexOf: (entry, compute) => Option.match(Option.fromUndefinedOr(indexes.get(entry.declarationsPath)), {
152
+ onSome: (index) => ({
153
+ index,
154
+ cached: true
155
+ }),
156
+ onNone: () => {
157
+ const index = compute();
158
+ indexes.set(entry.declarationsPath, index);
159
+ return {
160
+ index,
161
+ cached: false
162
+ };
163
+ }
164
+ }) };
165
+ };
166
+ const indexEntry = (cache) => (checker) => (entry) => Effect.sync(() => cache.indexOf(entry, () => indexOfEntry(checker)(entry))).pipe(Effect.tap(({ index, cached }) => Effect.annotateCurrentSpan({
167
+ "msch.library.cached": cached,
168
+ "msch.library.vocabularies": index.vocabularies.length,
169
+ "msch.library.shapes": index.shapes.length
170
+ })), Effect.map(({ index }) => index), Effect.withSpan("indexLibraryEntry", { attributes: { "msch.library.specifier": entry.specifier } }));
171
+ const libraryIndex = (cache) => (checker) => (entries) => pipe(entries, (items) => Effect.forEach(items, indexEntry(cache)(checker), { concurrency: 1 }), Effect.map(mergeIndexes), Effect.withSpan("libraryIndex"));
172
+ // src/entities/project/model/telemetry.ts
173
+ const RSS_LINE = /^VmRSS:\s+(?<kib>\d+) kB$/mu;
174
+ const BYTES_PER_KIB = 1024;
175
+ const UNKNOWN_RSS = 0;
176
+ const kibibytesIn = (status) => Option.fromNullishOr(RSS_LINE.exec(status)).pipe(Option.flatMap((match) => Option.fromUndefinedOr(match.groups)), Option.flatMap((groups) => Option.fromUndefinedOr(groups["kib"])));
177
+ const residentBytesOf = (pid) => Effect.gen(function* residentBytes() {
178
+ const status = yield* (yield* RepositoryFiles).readFile(`/proc/${pid}/status`);
179
+ return pipe(status, Option.flatMap(kibibytesIn), Option.flatMap(Number.parse), Option.map((kib) => kib * BYTES_PER_KIB), Option.getOrElse(() => UNKNOWN_RSS));
180
+ });
181
+ const childPids = Effect.gen(function* childPids() {
182
+ const files = yield* RepositoryFiles;
183
+ const pid = String(process.pid);
184
+ const children = yield* files.readFile(`/proc/${pid}/task/${pid}/children`);
185
+ return pipe(children, Option.map((text) => pipe(String$1.trim(text), String$1.split(" "), Array.filter(String$1.isNonEmpty))), Option.getOrElse(() => []));
186
+ });
187
+ const annotateMemory = Effect.gen(function* annotateMemory() {
188
+ const own = yield* residentBytesOf(String(process.pid));
189
+ const pids = yield* childPids;
190
+ const children = yield* Effect.forEach(pids, (pid) => residentBytesOf(pid), { concurrency: 1 });
191
+ const { heapUsed } = process.memoryUsage();
192
+ yield* Effect.annotateCurrentSpan({
193
+ "process.memory.rss": own,
194
+ "process.memory.heap_used": heapUsed,
195
+ "msch.compiler.memory.rss": Number.sumAll(children)
196
+ });
197
+ });
198
+ const annotateResources = (api) => Effect.gen(function* annotateCompiler() {
199
+ yield* annotateMemory;
200
+ const { totals } = api.getTimingInfo();
201
+ yield* Effect.annotateCurrentSpan({
202
+ "msch.compiler.requests": totals.requestCount,
203
+ "msch.compiler.round_trip_ms": totals.roundTripMs,
204
+ "msch.compiler.server_ms": totals.serverTimeMs
205
+ });
206
+ });
207
+ // src/entities/project/model/project.ts
208
+ const CONFIG_PATHSPEC = `:(glob)**/tsconfig.json`;
209
+ const HIDDEN_PREFIX$1 = ".";
210
+ const SKIPPED_DIRECTORIES = /* @__PURE__ */ new Set([
211
+ NODE_MODULES,
212
+ "dist",
213
+ "coverage"
214
+ ]);
215
+ const isVisible = (file) => pipe(String$1.split(file, "/"), Array.every((segment) => !String$1.startsWith(HIDDEN_PREFIX$1)(segment) && !SKIPPED_DIRECTORIES.has(segment)));
216
+ const listConfigFiles = (root) => Effect.gen(function* configFilesUnder() {
217
+ const files = yield* RepositoryFiles;
218
+ const listed = yield* files.matchingFiles(root, [CONFIG_PATHSPEC]);
219
+ const visible = pipe(listed, Array.filter(isVisible), Array.map((file) => files.join(root, file)));
220
+ return Array.sort(visible, Order.String);
221
+ });
222
+ const parseConfig = (api) => (configPath) => Option.some(api.parseConfigFile(configPath)).pipe(Option.filter((parsed) => Array.isReadonlyArrayNonEmpty(parsed.fileNames)));
223
+ const nearestPackageDirectory = (directory, root) => Effect.gen(function* nearestPackage() {
224
+ const files = yield* RepositoryFiles;
225
+ const hasManifest = yield* files.exists(files.join(directory, MANIFEST_FILE));
226
+ const parent = files.dirname(directory);
227
+ if (hasManifest || directory === root || parent === directory) return directory;
228
+ return yield* nearestPackageDirectory(parent, root);
229
+ });
230
+ const packageDirectoryOf = (root) => (directory) => nearestPackageDirectory(directory, root);
231
+ const packageInfoOf = Effect.fn("packageInfoOf")(function* packageInfoOf(configPath, root) {
232
+ const files = yield* RepositoryFiles;
233
+ const directory = yield* nearestPackageDirectory(files.dirname(configPath), root);
234
+ const manifest = yield* readManifest(directory);
235
+ return {
236
+ directory,
237
+ name: manifest.pipe(Option.flatMap((found) => Option.fromUndefinedOr(found.name))),
238
+ workspaceDependencies: manifest.pipe(Option.map(workspaceDependencies), Option.getOrElse(() => []))
239
+ };
240
+ });
241
+ const NO_CHECK_PRAGMA = /^\/\/\s*@ts-nocheck/u;
242
+ const FILE_START = 0;
243
+ const skipsTypeChecking = (sourceFile) => pipe(getLeadingCommentRanges(sourceFile.text, FILE_START) ?? [], Array.some((range) => NO_CHECK_PRAGMA.test(String$1.slice(range.pos, range.end)(sourceFile.text))));
244
+ const buildProject = Effect.fn("buildProject")(function* buildProject({ compiler: { api, libraries }, generated }, parsed, info) {
245
+ const entries = yield* dependencyEntries(info.directory);
246
+ const program = yield* Effect.sync(() => api.createProgram([...parsed.fileNames, ...pipe(entries, Array.map((entry) => entry.declarationsPath))], {
247
+ ...parsed.options,
248
+ noEmit: true
249
+ })).pipe(Effect.withSpan("createProgram"));
250
+ const { checker } = program.getProject();
251
+ const library = yield* libraryIndex(libraries)(checker)(entries);
252
+ const projectFiles = new Set(pipe(parsed.fileNames, Array.filter((fileName) => !generated.includes(fileName))));
253
+ return {
254
+ packageName: info.name,
255
+ workspaceDependencies: info.workspaceDependencies,
256
+ program,
257
+ checker,
258
+ sourceFiles: pipe(program.getSourceFileNames(), Array.filter((fileName) => projectFiles.has(fileName)), Array.flatMap((fileName) => Option.toArray(Option.fromUndefinedOr(program.getSourceFile(fileName)))), Array.filter((sourceFile) => !sourceFile.isDeclarationFile && !skipsTypeChecking(sourceFile))),
259
+ library
260
+ };
261
+ });
262
+ const typeScriptCompiler = Effect.acquireRelease(Effect.sync(() => ({
263
+ api: new API({ collectTiming: true }),
264
+ libraries: libraryCache()
265
+ })), ({ api }) => Effect.sync(() => {
266
+ api.close();
267
+ }));
268
+ const loadProject = Effect.fn("loadProject")(function* loadProject(workspace, configPath) {
269
+ const { compiler, root } = workspace;
270
+ const parsed = parseConfig(compiler.api)(configPath);
271
+ if (Option.isNone(parsed)) return Option.none();
272
+ const info = yield* packageInfoOf(configPath, root);
273
+ const project = yield* buildProject(workspace, parsed.value, info);
274
+ yield* Effect.annotateCurrentSpan({
275
+ "msch.project.config": configPath,
276
+ "msch.project.program_files": project.program.getSourceFileNames().length,
277
+ "msch.project.source_files": project.sourceFiles.length
278
+ });
279
+ yield* annotateResources(compiler.api);
280
+ return Option.some(project);
281
+ });
282
+ const releaseProject = (project) => Effect.sync(() => {
283
+ project.program.dispose();
284
+ });
285
+ const withProject = (workspace) => (configPath) => (work) => Effect.acquireUseRelease(loadProject(workspace, configPath), (loaded) => Option.match(loaded, {
286
+ onNone: () => Effect.succeedNone,
287
+ onSome: (project) => work(project).pipe(Effect.asSome)
288
+ }), (loaded) => Option.match(loaded, {
289
+ onNone: () => Effect.void,
290
+ onSome: releaseProject
291
+ }));
292
+ const mentions = (needle) => ({ api }) => (configPath) => Effect.gen(function* mentionsNeedle() {
293
+ const files = yield* RepositoryFiles;
294
+ const fileNames = Option.match(parseConfig(api)(configPath), {
295
+ onNone: () => [],
296
+ onSome: (parsed) => parsed.fileNames
297
+ });
298
+ const texts = yield* Effect.forEach(fileNames, (fileName) => files.readFile(fileName), { concurrency: 1 });
299
+ const includesNeedle = String$1.includes(needle);
300
+ return pipe(texts, Array.some((text) => Option.exists(text, includesNeedle)));
301
+ });
302
+ // src/entities/project/model/inputs.ts
303
+ const SEPARATOR = "/";
304
+ const SCOPE_PREFIX = "@";
305
+ const HIDDEN_PREFIX = ".";
306
+ const encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));
307
+ const nearestManifestDirectory = Effect.fn("nearestManifestDirectory")(function* nearestManifestDirectory(start) {
308
+ const files = yield* RepositoryFiles;
309
+ let directory = start;
310
+ let parent = files.dirname(directory);
311
+ while (parent !== directory && !(yield* files.exists(files.join(directory, "package.json")))) {
312
+ directory = parent;
313
+ parent = files.dirname(directory);
314
+ }
315
+ return directory;
316
+ });
317
+ const dependenciesOf = Effect.fn("dependenciesOf")(function* dependenciesOf(directory) {
318
+ const files = yield* RepositoryFiles;
319
+ const manifest = yield* readManifest(directory);
320
+ const names = Option.match(manifest, {
321
+ onNone: () => [],
322
+ onSome: workspaceDependencies
323
+ });
324
+ return yield* Effect.forEach(names, (name) => files.realPath(files.join(directory, NODE_MODULES, name)), { concurrency: 1 });
325
+ });
326
+ const workspaceClosure = Effect.fn("workspaceClosure")(function* workspaceClosure(start) {
327
+ const seen = /* @__PURE__ */ new Set([start]);
328
+ const queue = [start];
329
+ for (const directory of queue) {
330
+ const next = yield* dependenciesOf(directory);
331
+ for (const dependency of next) if (!seen.has(dependency)) {
332
+ seen.add(dependency);
333
+ queue.push(dependency);
334
+ }
335
+ }
336
+ return [...seen];
337
+ });
338
+ const isUnder = (prefixes) => (file) => pipe(prefixes, Array.some((prefix) => String$1.startsWith(prefix)(file)));
339
+ const closureOf = Effect.fn("closureOf")(function* closureOf(root, configPath) {
340
+ const files = yield* RepositoryFiles;
341
+ const directory = yield* packageDirectoryOf(root)(files.dirname(configPath));
342
+ const directories = yield* workspaceClosure(directory);
343
+ return {
344
+ directories,
345
+ prefixes: pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR}`))
346
+ };
347
+ });
348
+ const scopedNames = (modules) => (name) => Effect.gen(function* listScope() {
349
+ const files = yield* RepositoryFiles;
350
+ if (!String$1.startsWith(SCOPE_PREFIX)(name)) return [name];
351
+ const scoped = yield* files.readDirectory(files.join(modules, name));
352
+ return pipe(scoped, Array.map((entry) => `${name}${SEPARATOR}${entry}`));
353
+ });
354
+ const installedNames = Effect.fn("installedNames")(function* installedNames(modules) {
355
+ const listed = yield* (yield* RepositoryFiles).readDirectory(modules);
356
+ const nested = yield* pipe(listed, Array.filter((name) => !String$1.startsWith(HIDDEN_PREFIX)(name)), (items) => Effect.forEach(items, scopedNames(modules), { concurrency: 1 }));
357
+ return Array.flatten(nested);
358
+ });
359
+ const installedPackages = Effect.fn("installedPackages")(function* installedPackages(root, directory) {
360
+ const files = yield* RepositoryFiles;
361
+ const modules = files.join(directory, NODE_MODULES);
362
+ const names = yield* installedNames(modules);
363
+ return yield* Effect.forEach(names, (name) => files.realPath(files.join(modules, name)).pipe(Effect.map((found) => files.relative(root, found))), { concurrency: 1 });
364
+ });
365
+ const dependencyVersions = Effect.fn("dependencyVersions")(function* dependencyVersions(root, directories) {
366
+ const installed = yield* Effect.forEach(Array.dedupe([root, ...directories]), (directory) => installedPackages(root, directory), { concurrency: 1 });
367
+ return Array.sort(Array.dedupe(Array.flatten(installed)), Order.String);
368
+ });
369
+ const projectInputs = ({ workspace: { compiler, root }, listed }) => (configPath) => Effect.gen(function* collectInputs() {
370
+ const files = yield* RepositoryFiles;
371
+ const parsed = parseConfig(compiler.api)(configPath);
372
+ if (Option.isNone(parsed)) return Option.none();
373
+ const closure = yield* closureOf(root, configPath);
374
+ const dependencies = yield* dependencyVersions(root, closure.directories);
375
+ const options = yield* encodeOptions(parsed.value.options).pipe(Effect.orElseSucceed(() => ""));
376
+ const sources = pipe(parsed.value.fileNames, Array.map((fileName) => files.relative(root, fileName)));
377
+ const shared = pipe(listed, Array.filter(isUnder(closure.prefixes)));
378
+ return Option.some({
379
+ options,
380
+ files: Array.sort(Array.dedupe([...sources, ...shared]), Order.String),
381
+ dependencies
382
+ });
383
+ });
384
+ // src/shared/lib/pass-records.ts
385
+ const PASSED = "";
386
+ const UNREADABLE = "";
387
+ const FIELD_SEPARATOR = "\0";
388
+ const LINE_SEPARATOR = "\n";
389
+ const contentKey = Effect.fn("contentKey")(function* contentKey(salt, named) {
390
+ const files = yield* RepositoryFiles;
391
+ const entries = yield* Effect.forEach(named, ([name, file]) => files.hashFile(file).pipe(Effect.map((found) => `${name}${FIELD_SEPARATOR}${Option.getOrElse(found, () => UNREADABLE)}`)), { concurrency: 1 });
392
+ return yield* files.hash(Array.join([...salt, ...entries], LINE_SEPARATOR));
393
+ });
394
+ const recordsIn = Effect.fn("recordsIn")(function* recordsIn(directory) {
395
+ return {
396
+ directory,
397
+ passed: yield* (yield* RepositoryFiles).readDirectory(directory)
398
+ };
399
+ });
400
+ const keepOnly = Effect.fn("keepOnly")(function* keepOnly(records, keys) {
401
+ const files = yield* RepositoryFiles;
402
+ const stale = pipe(records.passed, Array.filter((key) => !Array.contains(keys, key)));
403
+ yield* Effect.forEach(stale, (key) => files.removeFile(files.join(records.directory, key)), {
404
+ concurrency: 1,
405
+ discard: true
406
+ });
407
+ yield* Effect.forEach(keys, (key) => files.writeFile(files.join(records.directory, key), PASSED), {
408
+ concurrency: 1,
409
+ discard: true
410
+ });
411
+ });
412
+ // src/entities/project/model/implementation.ts
413
+ const MANIFEST_ENTRY = "package.json";
414
+ const SOURCE_ENTRY = "src";
415
+ const LOWER_LAYERS = ["entities", "shared"];
416
+ const PATH_SEPARATOR = "/";
417
+ const NOT_INSTALLED = [];
418
+ const walked = (directory) => Effect.gen(function* walkFrom() {
419
+ const files = yield* RepositoryFiles;
420
+ const found = yield* files.walkDirectory(directory);
421
+ return pipe(found, Array.map((file) => files.join(directory, file)));
422
+ });
423
+ const sourceFiles = Effect.fn("sourceFiles")(function* sourceFiles(root, moduleDirectory) {
424
+ const files = yield* RepositoryFiles;
425
+ const source = files.join(root, SOURCE_ENTRY);
426
+ const layers = pipe(LOWER_LAYERS, Array.map((layer) => files.join(source, layer)));
427
+ const nested = yield* Effect.forEach([files.dirname(moduleDirectory), ...layers], walked, { concurrency: 1 });
428
+ return Array.flatten(nested);
429
+ });
430
+ const bundleParts = Effect.fn("bundleParts")(function* bundleParts(root, moduleDirectory) {
431
+ const files = yield* RepositoryFiles;
432
+ const bundled = yield* walked(moduleDirectory);
433
+ return {
434
+ listed: [files.join(root, MANIFEST_ENTRY), ...bundled],
435
+ installed: NOT_INSTALLED
436
+ };
437
+ });
438
+ const sourceParts = Effect.fn("sourceParts")(function* sourceParts(root, moduleDirectory) {
439
+ return {
440
+ listed: yield* sourceFiles(root, moduleDirectory),
441
+ installed: yield* installedPackages(root, root)
442
+ };
443
+ });
444
+ /** @internal */
445
+ const implementationOf = Effect.fn("implementationOf")(function* implementationOf(moduleDirectory) {
446
+ const files = yield* RepositoryFiles;
447
+ const root = yield* nearestManifestDirectory(moduleDirectory);
448
+ const fromSource = String$1.startsWith(`${files.join(root, SOURCE_ENTRY)}${PATH_SEPARATOR}`)(moduleDirectory);
449
+ const parts = yield* Boolean.match(fromSource, {
450
+ onFalse: () => bundleParts(root, moduleDirectory),
451
+ onTrue: () => sourceParts(root, moduleDirectory)
452
+ });
453
+ return {
454
+ files: pipe(Array.sort(parts.listed, String$1.Order), Array.map((file) => [files.relative(root, file), file])),
455
+ installed: parts.installed
456
+ };
457
+ });
458
+ const implementationFingerprint = Effect.fn("implementationFingerprint")(function* implementationFingerprint(moduleDirectory) {
459
+ const implementation = yield* implementationOf(moduleDirectory);
460
+ return yield* contentKey(implementation.installed, implementation.files);
461
+ });
462
+ export { valueKey as C, schemaTypeOf as S, formatValues as _, installedPackages as a, literalValuesOf as b, listConfigFiles as c, withProject as d, declarationKey as f, finiteValuesOf as g, locationOf as h, recordsIn as i, mentions as l, isObjectType as m, contentKey as n, projectInputs as o, describeLibraryType as p, keepOnly as r, workspaceClosure as s, implementationFingerprint as t, typeScriptCompiler as u, isSubsetOf as v, vocabularyOf as w, sameValues as x, literalUnionOf as y };
463
+
464
+ //# sourceMappingURL=project-DeQcAglt.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-DeQcAglt.mjs","names":["Arr","Fn","Arr","Num","Str","Arr","HIDDEN_PREFIX","Str","Arr","Arr","Str","Arr","Arr","Str","Bool"],"sources":["../src/shared/lib/values.ts","../src/entities/project/model/library.ts","../src/entities/project/model/telemetry.ts","../src/entities/project/model/project.ts","../src/entities/project/model/inputs.ts","../src/shared/lib/pass-records.ts","../src/entities/project/model/implementation.ts"],"sourcesContent":["import { Array as Arr, Function as Fn, Option, pipe } from \"effect\";\n\nimport { IndexKind } from \"./compiler.ts\";\nimport type { Checker, Type } from \"./compiler.ts\";\n\nexport type Value = string | number;\n\nexport interface Vocabulary {\n readonly values: readonly Value[];\n readonly admitsUnnamedValues: boolean;\n}\n\nconst SCHEMA_TYPE_PROPERTIES = [\"Type\", \"_output\"] as const;\n\nconst MINIMUM_SET_SIZE = 2;\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const valueKey = (value: Value): string => `${typeof value}:${String(value)}`;\n\nconst literalValueOf = (type: Type): Option.Option<Value> => {\n if (type.isStringLiteralType() || type.isNumberLiteralType()) {\n return Option.some(type.value);\n }\n return Option.none();\n};\n\nexport const literalValuesOf = (types: readonly Type[]): Option.Option<readonly Value[]> => {\n const values = pipe(\n types,\n Arr.map((member) => literalValueOf(member)),\n Arr.getSomes,\n Arr.dedupeWith((left, right) => valueKey(left) === valueKey(right)),\n );\n if (values.length !== types.length || values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some(values);\n};\n\nexport const literalUnionOf = (type: Type): Option.Option<readonly Value[]> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n return literalValuesOf(type.getTypes());\n};\n\nconst elementTypeOf = (checker: Checker, type: Type): Option.Option<Type> => {\n if (!checker.isArrayLikeType(type)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(checker.getIndexTypeOfType(type, IndexKind.Number));\n};\n\nexport const schemaTypeOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Type> =>\n Arr.findFirst(SCHEMA_TYPE_PROPERTIES, (name) =>\n Option.fromUndefinedOr(checker.getPropertyOfType(type, name)),\n ).pipe(Option.map((property) => checker.getTypeOfSymbol(property)));\n\nexport const finiteValuesOf =\n (checker: Checker) =>\n (type: Type): Option.Option<readonly Value[]> =>\n literalUnionOf(type).pipe(\n Option.orElse(() => elementTypeOf(checker, type).pipe(Option.flatMap(literalUnionOf))),\n Option.orElse(() => schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf))),\n );\n\nexport const vocabularyOf =\n (checker: Checker) =>\n (type: Type): Option.Option<Vocabulary> => {\n if (!type.isUnionType()) {\n return Option.none();\n }\n const optionalIds = new Set([checker.getUndefinedType().id, checker.getNullType().id]);\n const members = pipe(\n type.getTypes(),\n Arr.filter((member) => !optionalIds.has(member.id)),\n );\n const values = Arr.getSomes(\n pipe(\n members,\n Arr.map((member) => literalValueOf(member)),\n ),\n );\n if (values.length < MINIMUM_SET_SIZE) {\n return Option.none();\n }\n return Option.some({ values, admitsUnnamedValues: values.length !== members.length });\n };\n\nexport const isSubsetOf: {\n (superset: readonly Value[]): (subset: readonly Value[]) => boolean;\n (subset: readonly Value[], superset: readonly Value[]): boolean;\n} = Fn.dual(DATA_FIRST_ARITY, (subset: readonly Value[], superset: readonly Value[]): boolean => {\n const held = new Set(\n pipe(\n superset,\n Arr.map((value) => valueKey(value)),\n ),\n );\n return pipe(\n subset,\n Arr.every((value) => held.has(valueKey(value))),\n );\n});\n\nexport const sameValues: {\n (right: readonly Value[]): (left: readonly Value[]) => boolean;\n (left: readonly Value[], right: readonly Value[]): boolean;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (left: readonly Value[], right: readonly Value[]): boolean =>\n left.length === right.length && isSubsetOf(left, right),\n);\n\nconst valueText = (value: Value): string => {\n if (typeof value === \"string\") {\n return `\"${value}\"`;\n }\n return String(value);\n};\n\nexport const formatValues = (values: readonly Value[]): string =>\n pipe(values, Arr.map(valueText), Arr.join(\" | \"));\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { DependencyEntry } from \"#/entities/package/@x/project.ts\";\nimport {\n InternalSymbolName,\n isModuleDeclaration,\n isVariableDeclaration,\n} from \"#/shared/lib/compiler.ts\";\nimport type {\n Checker,\n Declaration,\n Node,\n SyntaxKind,\n TypeSymbol,\n Type,\n} from \"#/shared/lib/compiler.ts\";\nimport {\n declarationsOf,\n isGenericDeclaration,\n isTypeDeclaration,\n propertyNamesOf,\n resolvedSymbol,\n} from \"#/shared/lib/syntax.ts\";\nimport { schemaTypeOf, vocabularyOf } from \"#/shared/lib/values.ts\";\nimport type { Vocabulary } from \"#/shared/lib/values.ts\";\n\nexport interface LibraryType {\n readonly specifier: string;\n readonly typeName: string;\n}\n\nexport interface LibraryVocabulary extends LibraryType {\n readonly vocabulary: Vocabulary;\n}\n\nexport interface DeclarationLocation {\n readonly file: string;\n readonly pos: number;\n readonly kind: SyntaxKind;\n}\n\nexport interface LibraryShape extends LibraryType {\n readonly form: \"declared\" | \"schema\";\n readonly declaration: DeclarationLocation;\n readonly propertyNames: readonly string[];\n}\n\nexport interface LibraryIndex {\n readonly vocabularies: readonly LibraryVocabulary[];\n readonly shapes: readonly LibraryShape[];\n}\n\ninterface Walk {\n readonly checker: Checker;\n readonly entry: DependencyEntry;\n}\n\ninterface Visit {\n readonly exported: TypeSymbol;\n readonly qualifier: string;\n readonly ancestors: readonly TypeSymbol[];\n}\n\ninterface Exported {\n readonly symbol: TypeSymbol;\n readonly typeName: string;\n}\n\nconst NAMESPACE_DEPTH_LIMIT = 8;\nconst EMPTY_INDEX: LibraryIndex = { vocabularies: [], shapes: [] };\n\nexport const isObjectType =\n (checker: Checker) =>\n (type: Type): boolean =>\n !type.isUnionType() &&\n !type.isLiteralType() &&\n checker.getApparentType(type).id === type.id &&\n Arr.isReadonlyArrayNonEmpty(checker.getPropertiesOfType(type));\n\nexport const describeLibraryType = (type: LibraryType): string =>\n `${type.typeName} from ${type.specifier}`;\n\nexport const locationOf = (declaration: Node): DeclarationLocation => ({\n file: declaration.getSourceFile().fileName,\n pos: declaration.pos,\n kind: declaration.kind,\n});\n\nexport const declarationKey = (location: DeclarationLocation): string =>\n `${location.file}#${String(location.pos)}#${String(location.kind)}`;\n\ntype ShapeSource = LibraryType & Pick<LibraryShape, \"form\">;\n\nconst shapeOf =\n (checker: Checker) =>\n (source: ShapeSource, declaration: Declaration, type: Type): readonly LibraryShape[] =>\n Arr.filter(\n [\n {\n ...source,\n declaration: locationOf(declaration),\n propertyNames: propertyNamesOf(checker)(type),\n },\n ],\n () => isObjectType(checker)(type),\n );\n\nconst declaredTypeIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isTypeDeclaration);\n if (Option.isNone(declaration) || isGenericDeclaration(declaration.value)) {\n return EMPTY_INDEX;\n }\n const located = { specifier: walk.entry.specifier, typeName: exported.typeName };\n const type = walk.checker.getDeclaredTypeOfSymbol(exported.symbol);\n const vocabularies = vocabularyOf(walk.checker)(type).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n );\n const shapes = shapeOf(walk.checker)({ ...located, form: \"declared\" }, declaration.value, type);\n return { vocabularies, shapes };\n};\n\nconst schemaTypeIndex =\n (walk: Walk, located: LibraryType) =>\n (declaration: Declaration, schemaType: Type): LibraryIndex => ({\n vocabularies: vocabularyOf(walk.checker)(schemaType).pipe(\n Option.map((vocabulary) => ({ ...located, vocabulary })),\n Option.toArray,\n ),\n shapes: shapeOf(walk.checker)({ ...located, form: \"schema\" }, declaration, schemaType),\n });\n\nconst schemaValueIndex = (walk: Walk, exported: Exported): LibraryIndex => {\n const declaration = Arr.findFirst(declarationsOf(exported.symbol), isVariableDeclaration);\n if (Option.isNone(declaration)) {\n return EMPTY_INDEX;\n }\n const valueType = walk.checker.getTypeOfSymbolAtLocation(exported.symbol, declaration.value);\n const located = {\n specifier: walk.entry.specifier,\n typeName: `(typeof ${exported.typeName})[\"Type\"]`,\n };\n return Option.match(schemaTypeOf(walk.checker)(valueType), {\n onNone: () => EMPTY_INDEX,\n onSome: (schemaType) => schemaTypeIndex(walk, located)(declaration.value, schemaType),\n });\n};\n\nconst mergeIndexes = (indexes: readonly LibraryIndex[]): LibraryIndex => ({\n vocabularies: pipe(\n indexes,\n Arr.flatMap((index) => index.vocabularies),\n ),\n shapes: pipe(\n indexes,\n Arr.flatMap((index) => index.shapes),\n ),\n});\n\nconst isNamespace = (symbol: TypeSymbol): boolean =>\n pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isModuleDeclaration(declaration)),\n );\n\nconst indexUnder = (walk: Walk, visit: Visit): LibraryIndex => {\n const symbol = resolvedSymbol(walk.checker)(visit.exported);\n const named = { symbol, typeName: `${visit.qualifier}${visit.exported.name}` };\n const own = mergeIndexes([declaredTypeIndex(walk, named), schemaValueIndex(walk, named)]);\n if (\n !isNamespace(symbol) ||\n visit.ancestors.length >= NAMESPACE_DEPTH_LIMIT ||\n visit.ancestors.includes(symbol)\n ) {\n return own;\n }\n const nested = pipe(\n walk.checker.getExportsOfModule(symbol),\n Arr.map((member) =>\n indexUnder(walk, {\n exported: member,\n qualifier: `${named.typeName}.`,\n ancestors: [...visit.ancestors, symbol],\n }),\n ),\n );\n return mergeIndexes([own, ...nested]);\n};\n\nconst exportAssignmentOf = (moduleSymbol: TypeSymbol): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(moduleSymbol.getExports().get(InternalSymbolName.ExportEquals));\n\nconst indexOfEntry =\n (checker: Checker) =>\n (entry: DependencyEntry): LibraryIndex => {\n const moduleSymbol = Option.fromUndefinedOr(\n checker.getSymbolOfSourceFile(entry.declarationsPath),\n );\n if (Option.isNone(moduleSymbol)) {\n return EMPTY_INDEX;\n }\n const walk: Walk = { checker, entry };\n const roots = Option.match(exportAssignmentOf(moduleSymbol.value), {\n onNone: () => checker.getExportsOfModule(moduleSymbol.value),\n onSome: (assigned) => [resolvedSymbol(checker)(assigned)],\n });\n return mergeIndexes(\n pipe(\n roots,\n Arr.map((exported) => indexUnder(walk, { exported, qualifier: \"\", ancestors: [] })),\n ),\n );\n };\n\nexport interface CachedIndex {\n readonly index: LibraryIndex;\n readonly cached: boolean;\n}\n\nexport interface LibraryCache {\n readonly indexOf: (entry: DependencyEntry, compute: () => LibraryIndex) => CachedIndex;\n}\n\nexport const libraryCache = (): LibraryCache => {\n const indexes = new Map<string, LibraryIndex>();\n return {\n indexOf: (entry, compute) =>\n Option.match(Option.fromUndefinedOr(indexes.get(entry.declarationsPath)), {\n onSome: (index) => ({ index, cached: true }),\n onNone: () => {\n const index = compute();\n indexes.set(entry.declarationsPath, index);\n return { index, cached: false };\n },\n }),\n };\n};\n\nconst indexEntry =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entry: DependencyEntry): Effect.Effect<LibraryIndex> =>\n Effect.sync(() => cache.indexOf(entry, () => indexOfEntry(checker)(entry))).pipe(\n Effect.tap(({ index, cached }) =>\n Effect.annotateCurrentSpan({\n \"msch.library.cached\": cached,\n \"msch.library.vocabularies\": index.vocabularies.length,\n \"msch.library.shapes\": index.shapes.length,\n }),\n ),\n Effect.map(({ index }) => index),\n Effect.withSpan(\"indexLibraryEntry\", {\n attributes: { \"msch.library.specifier\": entry.specifier },\n }),\n );\n\nexport const libraryIndex =\n (cache: LibraryCache) =>\n (checker: Checker) =>\n (entries: readonly DependencyEntry[]): Effect.Effect<LibraryIndex> =>\n pipe(\n entries,\n (items) => Effect.forEach(items, indexEntry(cache)(checker), { concurrency: 1 }),\n Effect.map(mergeIndexes),\n Effect.withSpan(\"libraryIndex\"),\n );\n","import { Array as Arr, Effect, Number as Num, Option, String as Str, pipe } from \"effect\";\n\nimport type { API } from \"#/shared/lib/compiler.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nconst RSS_LINE = /^VmRSS:\\s+(?<kib>\\d+) kB$/mu;\nconst BYTES_PER_KIB = 1024;\nconst UNKNOWN_RSS = 0;\n\nconst kibibytesIn = (status: string): Option.Option<string> =>\n Option.fromNullishOr(RSS_LINE.exec(status)).pipe(\n Option.flatMap((match) => Option.fromUndefinedOr(match.groups)),\n Option.flatMap((groups) => Option.fromUndefinedOr(groups[\"kib\"])),\n );\n\nconst residentBytesOf = (pid: string): Effect.Effect<number, never, RepositoryFiles> =>\n Effect.gen(function* residentBytes() {\n const files = yield* RepositoryFiles;\n const status = yield* files.readFile(`/proc/${pid}/status`);\n return pipe(\n status,\n Option.flatMap(kibibytesIn),\n Option.flatMap(Num.parse),\n Option.map((kib) => kib * BYTES_PER_KIB),\n Option.getOrElse(() => UNKNOWN_RSS),\n );\n });\n\nconst childPids = Effect.gen(function* childPids() {\n const files = yield* RepositoryFiles;\n const pid = String(process.pid);\n const children = yield* files.readFile(`/proc/${pid}/task/${pid}/children`);\n return pipe(\n children,\n Option.map((text) => pipe(Str.trim(text), Str.split(\" \"), Arr.filter(Str.isNonEmpty))),\n Option.getOrElse((): readonly string[] => []),\n );\n});\n\nconst annotateMemory = Effect.gen(function* annotateMemory() {\n const own = yield* residentBytesOf(String(process.pid));\n const pids = yield* childPids;\n const children = yield* Effect.forEach(pids, (pid) => residentBytesOf(pid), { concurrency: 1 });\n const { heapUsed } = process.memoryUsage();\n yield* Effect.annotateCurrentSpan({\n \"process.memory.rss\": own,\n \"process.memory.heap_used\": heapUsed,\n \"msch.compiler.memory.rss\": Num.sumAll(children),\n });\n});\n\nexport const annotateResources = (api: API): Effect.Effect<void, never, RepositoryFiles> =>\n Effect.gen(function* annotateCompiler() {\n yield* annotateMemory;\n const { totals } = api.getTimingInfo();\n yield* Effect.annotateCurrentSpan({\n \"msch.compiler.requests\": totals.requestCount,\n \"msch.compiler.round_trip_ms\": totals.roundTripMs,\n \"msch.compiler.server_ms\": totals.serverTimeMs,\n });\n });\n","import { Array as Arr, Effect, Option, Order, String as Str, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n dependencyEntries,\n readManifest,\n workspaceDependencies,\n} from \"#/entities/package/@x/project.ts\";\nimport { API, getLeadingCommentRanges } from \"#/shared/lib/compiler.ts\";\nimport type { Checker, ParsedCommandLine, Program, SourceFile } from \"#/shared/lib/compiler.ts\";\nimport type { Problem } from \"#/shared/lib/problem.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { libraryCache, libraryIndex } from \"./library.ts\";\nimport type { LibraryCache, LibraryIndex } from \"./library.ts\";\nimport { annotateResources } from \"./telemetry.ts\";\n\nexport interface Project {\n readonly packageName: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n readonly program: Program;\n readonly checker: Checker;\n readonly sourceFiles: readonly SourceFile[];\n readonly library: LibraryIndex;\n}\n\nexport type SourceCheck = (checker: Checker) => (sourceFile: SourceFile) => readonly Problem[];\n\ninterface PackageInfo {\n readonly directory: string;\n readonly name: Option.Option<string>;\n readonly workspaceDependencies: readonly string[];\n}\n\nconst CONFIG_FILE = \"tsconfig.json\";\nconst CONFIG_PATHSPEC = `:(glob)**/${CONFIG_FILE}`;\nconst HIDDEN_PREFIX = \".\";\nconst SKIPPED_DIRECTORIES: ReadonlySet<string> = new Set([NODE_MODULES, \"dist\", \"coverage\"]);\n\nconst isVisible = (file: string): boolean =>\n pipe(\n Str.split(file, \"/\"),\n Arr.every(\n (segment) => !Str.startsWith(HIDDEN_PREFIX)(segment) && !SKIPPED_DIRECTORIES.has(segment),\n ),\n );\n\nexport const listConfigFiles = (\n root: string,\n): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* configFilesUnder() {\n const files = yield* RepositoryFiles;\n const listed = yield* files.matchingFiles(root, [CONFIG_PATHSPEC]);\n const visible = pipe(\n listed,\n Arr.filter(isVisible),\n Arr.map((file) => files.join(root, file)),\n );\n return Arr.sort(visible, Order.String);\n });\n\nexport const parseConfig =\n (api: API) =>\n (configPath: string): Option.Option<ParsedCommandLine> =>\n Option.some(api.parseConfigFile(configPath)).pipe(\n Option.filter((parsed) => Arr.isReadonlyArrayNonEmpty(parsed.fileNames)),\n );\n\nconst nearestPackageDirectory = (\n directory: string,\n root: string,\n): Effect.Effect<string, never, RepositoryFiles> =>\n Effect.gen(function* nearestPackage() {\n const files = yield* RepositoryFiles;\n const hasManifest = yield* files.exists(files.join(directory, MANIFEST_FILE));\n const parent = files.dirname(directory);\n if (hasManifest || directory === root || parent === directory) {\n return directory;\n }\n return yield* nearestPackageDirectory(parent, root);\n });\n\nexport const packageDirectoryOf =\n (root: string) =>\n (directory: string): Effect.Effect<string, never, RepositoryFiles> =>\n nearestPackageDirectory(directory, root);\n\nconst packageInfoOf = Effect.fn(\"packageInfoOf\")(function* packageInfoOf(\n configPath: string,\n root: string,\n) {\n const files = yield* RepositoryFiles;\n const directory = yield* nearestPackageDirectory(files.dirname(configPath), root);\n const manifest = yield* readManifest(directory);\n return {\n directory,\n name: manifest.pipe(Option.flatMap((found) => Option.fromUndefinedOr(found.name))),\n workspaceDependencies: manifest.pipe(\n Option.map(workspaceDependencies),\n Option.getOrElse(() => []),\n ),\n } satisfies PackageInfo;\n});\n\nconst NO_CHECK_PRAGMA = /^\\/\\/\\s*@ts-nocheck/u;\nconst FILE_START = 0;\n\nconst skipsTypeChecking = (sourceFile: SourceFile): boolean =>\n pipe(\n getLeadingCommentRanges(sourceFile.text, FILE_START) ?? [],\n Arr.some((range) => NO_CHECK_PRAGMA.test(Str.slice(range.pos, range.end)(sourceFile.text))),\n );\n\nconst buildProject = Effect.fn(\"buildProject\")(function* buildProject(\n { compiler: { api, libraries }, generated }: Workspace,\n parsed: ParsedCommandLine,\n info: PackageInfo,\n) {\n const entries = yield* dependencyEntries(info.directory);\n const program = yield* Effect.sync(() =>\n api.createProgram(\n [\n ...parsed.fileNames,\n ...pipe(\n entries,\n Arr.map((entry) => entry.declarationsPath),\n ),\n ],\n { ...parsed.options, noEmit: true },\n ),\n ).pipe(Effect.withSpan(\"createProgram\"));\n const { checker } = program.getProject();\n const library = yield* libraryIndex(libraries)(checker)(entries);\n const projectFiles: ReadonlySet<string> = new Set(\n pipe(\n parsed.fileNames,\n Arr.filter((fileName) => !generated.includes(fileName)),\n ),\n );\n return {\n packageName: info.name,\n workspaceDependencies: info.workspaceDependencies,\n program,\n checker,\n sourceFiles: pipe(\n program.getSourceFileNames(),\n Arr.filter((fileName) => projectFiles.has(fileName)),\n Arr.flatMap((fileName) =>\n Option.toArray(Option.fromUndefinedOr(program.getSourceFile(fileName))),\n ),\n Arr.filter((sourceFile) => !sourceFile.isDeclarationFile && !skipsTypeChecking(sourceFile)),\n ),\n library,\n } satisfies Project;\n});\n\nexport interface Compiler {\n readonly api: API;\n readonly libraries: LibraryCache;\n}\n\nexport interface Workspace {\n readonly compiler: Compiler;\n readonly root: string;\n readonly generated: readonly string[];\n}\n\nexport const typeScriptCompiler = Effect.acquireRelease(\n Effect.sync((): Compiler => ({\n api: new API({ collectTiming: true }),\n libraries: libraryCache(),\n })),\n ({ api }) =>\n Effect.sync(() => {\n api.close();\n }),\n);\n\nconst loadProject = Effect.fn(\"loadProject\")(function* loadProject(\n workspace: Workspace,\n configPath: string,\n) {\n const { compiler, root } = workspace;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none<Project>();\n }\n const info = yield* packageInfoOf(configPath, root);\n const project = yield* buildProject(workspace, parsed.value, info);\n yield* Effect.annotateCurrentSpan({\n \"msch.project.config\": configPath,\n \"msch.project.program_files\": project.program.getSourceFileNames().length,\n \"msch.project.source_files\": project.sourceFiles.length,\n });\n yield* annotateResources(compiler.api);\n return Option.some(project);\n});\n\nconst releaseProject = (project: Project): Effect.Effect<void> =>\n Effect.sync(() => {\n project.program.dispose();\n });\n\nexport const withProject =\n (workspace: Workspace) =>\n (configPath: string) =>\n <Value, Failure, Requirements>(\n work: (project: Project) => Effect.Effect<Value, Failure, Requirements>,\n ): Effect.Effect<Option.Option<Value>, Failure, Requirements | RepositoryFiles> =>\n Effect.acquireUseRelease(\n loadProject(workspace, configPath),\n (loaded) =>\n Option.match(loaded, {\n onNone: () => Effect.succeedNone,\n onSome: (project) => work(project).pipe(Effect.asSome),\n }),\n (loaded) => Option.match(loaded, { onNone: () => Effect.void, onSome: releaseProject }),\n );\n\nexport const mentions =\n (needle: string) =>\n ({ api }: Compiler) =>\n (configPath: string): Effect.Effect<boolean, never, RepositoryFiles> =>\n Effect.gen(function* mentionsNeedle() {\n const files = yield* RepositoryFiles;\n const fileNames = Option.match(parseConfig(api)(configPath), {\n onNone: (): readonly string[] => [],\n onSome: (parsed): readonly string[] => parsed.fileNames,\n });\n const texts = yield* Effect.forEach(fileNames, (fileName) => files.readFile(fileName), {\n concurrency: 1,\n });\n const includesNeedle = Str.includes(needle);\n return pipe(\n texts,\n Arr.some((text) => Option.exists(text, includesNeedle)),\n );\n });\n","import { Array as Arr, Effect, Option, Order, Schema, String as Str, pipe } from \"effect\";\n\nimport {\n MANIFEST_FILE,\n readManifest,\n workspaceDependencies,\n} from \"#/entities/package/@x/project.ts\";\nimport { NODE_MODULES, RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { packageDirectoryOf, parseConfig } from \"./project.ts\";\nimport type { Workspace } from \"./project.ts\";\n\nexport interface ProjectInputs {\n readonly options: string;\n readonly files: readonly string[];\n readonly dependencies: readonly string[];\n}\n\nconst SEPARATOR = \"/\";\nconst SCOPE_PREFIX = \"@\";\nconst HIDDEN_PREFIX = \".\";\n\nconst encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));\n\nexport const nearestManifestDirectory = Effect.fn(\"nearestManifestDirectory\")(\n function* nearestManifestDirectory(start: string) {\n const files = yield* RepositoryFiles;\n let directory = start;\n let parent = files.dirname(directory);\n while (parent !== directory && !(yield* files.exists(files.join(directory, MANIFEST_FILE)))) {\n directory = parent;\n parent = files.dirname(directory);\n }\n return directory;\n },\n);\n\nconst dependenciesOf = Effect.fn(\"dependenciesOf\")(function* dependenciesOf(directory: string) {\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(directory);\n const names = Option.match(manifest, {\n onNone: (): readonly string[] => [],\n onSome: workspaceDependencies,\n });\n return yield* Effect.forEach(\n names,\n (name) => files.realPath(files.join(directory, NODE_MODULES, name)),\n {\n concurrency: 1,\n },\n );\n});\n\nexport const workspaceClosure = Effect.fn(\"workspaceClosure\")(function* workspaceClosure(\n start: string,\n) {\n const seen = new Set([start]);\n const queue = [start];\n for (const directory of queue) {\n const next = yield* dependenciesOf(directory);\n for (const dependency of next) {\n if (!seen.has(dependency)) {\n seen.add(dependency);\n queue.push(dependency);\n }\n }\n }\n return [...seen];\n});\n\nconst isUnder =\n (prefixes: readonly string[]) =>\n (file: string): boolean =>\n pipe(\n prefixes,\n Arr.some((prefix) => Str.startsWith(prefix)(file)),\n );\n\nconst closureOf = Effect.fn(\"closureOf\")(function* closureOf(root: string, configPath: string) {\n const files = yield* RepositoryFiles;\n const directory = yield* packageDirectoryOf(root)(files.dirname(configPath));\n const directories = yield* workspaceClosure(directory);\n const prefixes = pipe(\n directories,\n Arr.map((found) => `${files.relative(root, found)}${SEPARATOR}`),\n );\n return { directories, prefixes };\n});\n\nconst scopedNames =\n (modules: string) =>\n (name: string): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* listScope() {\n const files = yield* RepositoryFiles;\n if (!Str.startsWith(SCOPE_PREFIX)(name)) {\n return [name];\n }\n const scoped = yield* files.readDirectory(files.join(modules, name));\n return pipe(\n scoped,\n Arr.map((entry) => `${name}${SEPARATOR}${entry}`),\n );\n });\n\nconst installedNames = Effect.fn(\"installedNames\")(function* installedNames(modules: string) {\n const files = yield* RepositoryFiles;\n const listed = yield* files.readDirectory(modules);\n const nested = yield* pipe(\n listed,\n Arr.filter((name) => !Str.startsWith(HIDDEN_PREFIX)(name)),\n (items) => Effect.forEach(items, scopedNames(modules), { concurrency: 1 }),\n );\n return Arr.flatten(nested);\n});\n\nexport const installedPackages = Effect.fn(\"installedPackages\")(function* installedPackages(\n root: string,\n directory: string,\n) {\n const files = yield* RepositoryFiles;\n const modules = files.join(directory, NODE_MODULES);\n const names = yield* installedNames(modules);\n return yield* Effect.forEach(\n names,\n (name) =>\n files\n .realPath(files.join(modules, name))\n .pipe(Effect.map((found) => files.relative(root, found))),\n { concurrency: 1 },\n );\n});\n\nconst dependencyVersions = Effect.fn(\"dependencyVersions\")(function* dependencyVersions(\n root: string,\n directories: readonly string[],\n) {\n const installed = yield* Effect.forEach(\n Arr.dedupe([root, ...directories]),\n (directory) => installedPackages(root, directory),\n { concurrency: 1 },\n );\n return Arr.sort(Arr.dedupe(Arr.flatten(installed)), Order.String);\n});\n\nexport interface InputScope {\n readonly workspace: Workspace;\n readonly listed: readonly string[];\n}\n\nexport const projectInputs =\n ({ workspace: { compiler, root }, listed }: InputScope) =>\n (configPath: string): Effect.Effect<Option.Option<ProjectInputs>, never, RepositoryFiles> =>\n Effect.gen(function* collectInputs() {\n const files = yield* RepositoryFiles;\n const parsed = parseConfig(compiler.api)(configPath);\n if (Option.isNone(parsed)) {\n return Option.none();\n }\n const closure = yield* closureOf(root, configPath);\n const dependencies = yield* dependencyVersions(root, closure.directories);\n const options = yield* encodeOptions(parsed.value.options).pipe(\n Effect.orElseSucceed(() => \"\"),\n );\n const sources = pipe(\n parsed.value.fileNames,\n Arr.map((fileName) => files.relative(root, fileName)),\n );\n const shared = pipe(listed, Arr.filter(isUnder(closure.prefixes)));\n return Option.some({\n options,\n files: Arr.sort(Arr.dedupe([...sources, ...shared]), Order.String),\n dependencies,\n });\n });\n","import { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\nconst PASSED = \"\";\nconst UNREADABLE = \"\";\nconst FIELD_SEPARATOR = \"\\0\";\nconst LINE_SEPARATOR = \"\\n\";\n\nexport interface Records {\n readonly directory: string;\n readonly passed: readonly string[];\n}\n\nexport type NamedFile = readonly [name: string, file: string];\n\nexport const contentKey = Effect.fn(\"contentKey\")(function* contentKey(\n salt: readonly string[],\n named: readonly NamedFile[],\n) {\n const files = yield* RepositoryFiles;\n const entries = yield* Effect.forEach(\n named,\n ([name, file]) =>\n files\n .hashFile(file)\n .pipe(\n Effect.map(\n (found) => `${name}${FIELD_SEPARATOR}${Option.getOrElse(found, () => UNREADABLE)}`,\n ),\n ),\n { concurrency: 1 },\n );\n return yield* files.hash(Arr.join([...salt, ...entries], LINE_SEPARATOR));\n});\n\nexport const recordsIn = Effect.fn(\"recordsIn\")(function* recordsIn(directory: string) {\n const files = yield* RepositoryFiles;\n const present = yield* files.readDirectory(directory);\n return { directory, passed: present } satisfies Records;\n});\n\nexport const keepOnly = Effect.fn(\"keepOnly\")(function* keepOnly(\n records: Records,\n keys: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const stale = pipe(\n records.passed,\n Arr.filter((key) => !Arr.contains(keys, key)),\n );\n yield* Effect.forEach(stale, (key) => files.removeFile(files.join(records.directory, key)), {\n concurrency: 1,\n discard: true,\n });\n yield* Effect.forEach(\n keys,\n (key) => files.writeFile(files.join(records.directory, key), PASSED),\n { concurrency: 1, discard: true },\n );\n});\n","import { Array as Arr, Boolean as Bool, Effect, String as Str, pipe } from \"effect\";\n\nimport { contentKey } from \"#/shared/lib/pass-records.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { installedPackages, nearestManifestDirectory } from \"./inputs.ts\";\n\nconst MANIFEST_ENTRY = \"package.json\";\nconst SOURCE_ENTRY = \"src\";\nconst LOWER_LAYERS = [\"entities\", \"shared\"] as const;\nconst PATH_SEPARATOR = \"/\";\nconst NOT_INSTALLED: readonly string[] = [];\n\nconst walked = (directory: string): Effect.Effect<readonly string[], never, RepositoryFiles> =>\n Effect.gen(function* walkFrom() {\n const files = yield* RepositoryFiles;\n const found = yield* files.walkDirectory(directory);\n return pipe(\n found,\n Arr.map((file) => files.join(directory, file)),\n );\n });\n\nconst sourceFiles = Effect.fn(\"sourceFiles\")(function* sourceFiles(\n root: string,\n moduleDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const source = files.join(root, SOURCE_ENTRY);\n const layers = pipe(\n LOWER_LAYERS,\n Arr.map((layer) => files.join(source, layer)),\n );\n const nested = yield* Effect.forEach([files.dirname(moduleDirectory), ...layers], walked, {\n concurrency: 1,\n });\n return Arr.flatten(nested);\n});\n\nconst bundleParts = Effect.fn(\"bundleParts\")(function* bundleParts(\n root: string,\n moduleDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const bundled = yield* walked(moduleDirectory);\n return { listed: [files.join(root, MANIFEST_ENTRY), ...bundled], installed: NOT_INSTALLED };\n});\n\nconst sourceParts = Effect.fn(\"sourceParts\")(function* sourceParts(\n root: string,\n moduleDirectory: string,\n) {\n const listed = yield* sourceFiles(root, moduleDirectory);\n const installed = yield* installedPackages(root, root);\n return { listed, installed };\n});\n\n/** @internal */\nexport const implementationOf = Effect.fn(\"implementationOf\")(function* implementationOf(\n moduleDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const root = yield* nearestManifestDirectory(moduleDirectory);\n const fromSource = Str.startsWith(`${files.join(root, SOURCE_ENTRY)}${PATH_SEPARATOR}`)(\n moduleDirectory,\n );\n const parts = yield* Bool.match(fromSource, {\n onFalse: () => bundleParts(root, moduleDirectory),\n onTrue: () => sourceParts(root, moduleDirectory),\n });\n return {\n files: pipe(\n Arr.sort(parts.listed, Str.Order),\n Arr.map((file) => [files.relative(root, file), file] as const),\n ),\n installed: parts.installed,\n };\n});\n\nexport const implementationFingerprint = Effect.fn(\"implementationFingerprint\")(\n function* implementationFingerprint(moduleDirectory: string) {\n const implementation = yield* implementationOf(moduleDirectory);\n return yield* contentKey(implementation.installed, implementation.files);\n },\n);\n"],"mappings":";;;;;AAYA,MAAM,yBAAyB,CAAC,QAAQ,SAAS;AAEjD,MAAM,mBAAmB;AAEzB,MAAM,mBAAmB;AAEzB,MAAa,YAAY,UAAyB,GAAG,OAAO,MAAM,GAAG,OAAO,KAAK;AAEjF,MAAM,kBAAkB,SAAqC;CAC3D,IAAI,KAAK,oBAAoB,KAAK,KAAK,oBAAoB,GACzD,OAAO,OAAO,KAAK,KAAK,KAAK;CAE/B,OAAO,OAAO,KAAK;AACrB;AAEA,MAAa,mBAAmB,UAA4D;CAC1F,MAAM,SAAS,KACb,OACAA,MAAI,KAAK,WAAW,eAAe,MAAM,CAAC,GAC1CA,MAAI,UACJA,MAAI,YAAY,MAAM,UAAU,SAAS,IAAI,MAAM,SAAS,KAAK,CAAC,CACpE;CACA,IAAI,OAAO,WAAW,MAAM,UAAU,OAAO,SAAS,kBACpD,OAAO,OAAO,KAAK;CAErB,OAAO,OAAO,KAAK,MAAM;AAC3B;AAE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