@r_masseater/msch 0.57.0 → 0.57.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cargo-inputs.mjs +1 -2
- package/dist/cargo-inputs.mjs.map +1 -1
- package/dist/changed.mjs +2 -2
- package/dist/cli.mjs +1015 -445
- package/dist/cli.mjs.map +1 -1
- package/dist/credential-broker-9FMyTp1H.mjs +44 -0
- package/dist/credential-broker-9FMyTp1H.mjs.map +1 -0
- package/dist/dependencies-B6p7x90y.mjs +215 -0
- package/dist/dependencies-B6p7x90y.mjs.map +1 -0
- package/dist/exits.mjs +1 -1
- package/dist/{ignored-directories-BTMTNuAx.mjs → ignored-directories-BgUqwuc4.mjs} +12 -3
- package/dist/ignored-directories-BgUqwuc4.mjs.map +1 -0
- package/dist/oxlint.mjs +1 -2
- package/dist/oxlint.mjs.map +1 -1
- package/dist/{project-CIY_lNiT.mjs → pass-records-BCT1Ls9c.mjs} +5 -55
- package/dist/{project-CIY_lNiT.mjs.map → pass-records-BCT1Ls9c.mjs.map} +1 -1
- package/dist/{problem-Q4Zyi4PR.mjs → problem-BoHYLMQT.mjs} +2 -2
- package/dist/{problem-Q4Zyi4PR.mjs.map → problem-BoHYLMQT.mjs.map} +1 -1
- package/dist/publish.mjs +49 -5
- package/dist/publish.mjs.map +1 -1
- package/dist/published-BNJdq0h1.mjs +510 -0
- package/dist/published-BNJdq0h1.mjs.map +1 -0
- package/dist/{syntax-BNRNY74H.mjs → syntax-CTiXR0EJ.mjs} +3 -3
- package/dist/{syntax-BNRNY74H.mjs.map → syntax-CTiXR0EJ.mjs.map} +1 -1
- package/dist/{check-upstream-exits-DsBS7bui.mjs → upstream-exits-DitN-yYH.mjs} +9 -91
- package/dist/upstream-exits-DitN-yYH.mjs.map +1 -0
- package/dist/wake.mjs +1 -1
- package/dist/workspace-settings.mjs +66 -4
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +3 -1
- package/dist/check-upstream-exits-DsBS7bui.mjs.map +0 -1
- package/dist/credential-broker-D8sFyowJ.mjs +0 -105
- package/dist/credential-broker-D8sFyowJ.mjs.map +0 -1
- package/dist/dependencies-CbvZost8.mjs +0 -688
- package/dist/dependencies-CbvZost8.mjs.map +0 -1
- package/dist/ignored-directories-BTMTNuAx.mjs.map +0 -1
- package/dist/package-DZbqpZfs.mjs +0 -144
- package/dist/package-DZbqpZfs.mjs.map +0 -1
- package/dist/reachable-Cc-255L3.mjs +0 -13
- package/dist/reachable-Cc-255L3.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { B as
|
|
3
|
-
import {
|
|
2
|
+
import { B as stringsIn, C as VERIFY_TASK, F as childrenOf$1, I as keyName, L as literalOf, N as workspaceConfigOf, P as KeySchema, R as nestedValues, S as RUN_TASKS, T as hasVerifyTask, _ as deployEntries, a as EntryManifestJson, c as publicEntriesOf, d as workspaceLinks, g as bundledEntries, i as publishedWorkspaces, l as targetsIn, m as lockedPackages, o as entryNameOf, p as lockedGraph, r as packedWorkspaces, s as isBinEntry, w as definesTask, y as shadcnUiOf, z as propertyValue } from "./published-BNJdq0h1.mjs";
|
|
3
|
+
import { a as publishedProjects, c as workspaceManifest, o as workspaceDirectories, r as readManifest, s as workspaceProjects, t as MANIFEST_FILE$3 } from "./dependencies-B6p7x90y.mjs";
|
|
4
|
+
import { C as valueKey, S as schemaTypeOf, _ as formatValues, a as nearestManifestDirectory, b as literalValuesOf, c as listConfigFiles, d as withProject, f as declarationKey, g as finiteValuesOf, h as locationOf, i as installedPackages, l as mentions$1, m as isObjectType, n as keepOnly, o as projectInputs, p as describeLibraryType, r as recordsIn, t as contentKey, u as typeScriptCompiler, v as isSubsetOf, w as vocabularyOf, x as sameValues, y as literalUnionOf } from "./pass-records-BCT1Ls9c.mjs";
|
|
4
5
|
import { a as groupOf$2, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-B5sRbxlz.mjs";
|
|
5
|
-
import { a as
|
|
6
|
+
import { a as workspaceDeviations, c as tomlSourceComments, i as cargoDeviations, l as yamlSourceComments, o as collectNodes, r as WORKSPACE_SECTIONS, s as isRecord, t as checkUpstreamExits, u as positionOf } from "./upstream-exits-DitN-yYH.mjs";
|
|
6
7
|
import { n as baseName, r as isInside, t as matcher } from "./app-B22Gq0no.mjs";
|
|
7
|
-
import { a as
|
|
8
|
-
import { a as problemAtPosition, i as problemAt$7, o as problemInFile, r as formatProblem, s as sortProblems, t as ProblemList } from "./problem-Q4Zyi4PR.mjs";
|
|
8
|
+
import { a as problemAtPosition, i as problemAt$8, o as problemInFile, r as formatProblem, s as sortProblems, t as ProblemList } from "./problem-BoHYLMQT.mjs";
|
|
9
9
|
import { n as JAPANESE, t as COMMENT_DIRECTIVES } from "./comment-directives-CXgB6xpE.mjs";
|
|
10
10
|
import { t as startedOnce } from "./started-once-muJbvD_I.mjs";
|
|
11
|
-
import { $ as
|
|
11
|
+
import { $ as isPropertyAssignment, A as getTextOfJSDocComment, B as isExpressionStatement, D as getJSDocTags, E as SyntaxKind, F as isCallExpression, G as isInterfaceDeclaration, H as isFunctionExpression, I as isClassDeclaration, J as isNewExpression, K as isModuleBlock, L as isElementAccessExpression, M as isArrowFunction, N as isBinaryExpression, P as isBlock, Q as isPropertyAccessExpression, R as isEnumDeclaration, T as SymbolFlags, U as isIdentifier, V as isFunctionDeclaration, W as isImportDeclaration, X as isObjectLiteralExpression, Y as isNumericLiteral, Z as isParenthesizedExpression, _ as referencedSymbols, a as declarationsOf, at as isStringLiteral, b as uniqueByReference, c as importedModulesOf, ct as isTypeReferenceNode, d as isInsideAny, dt as isVariableDeclarationList, et as isReturnStatement, f as isOutsideDeclaration, ft as isVariableStatement, g as propertyNamesOf, h as packageOf$1, i as contains, it as isSpreadElement, j as isArrayLiteralExpression, k as getNameOfDeclaration, l as isExternalDeclaration, lt as isUnionTypeNode, m as lineOf$3, n as childrenOf$2, nt as isSignatureDeclaration, o as declaresAType, ot as isTypeAliasDeclaration, p as isTypeDeclaration, q as isModuleDeclaration, r as columnOf, rt as isSourceFile, s as descendantsOf, st as isTypeLiteralNode, t as carriesTag, tt as isSatisfiesExpression, u as isGenericDeclaration, ut as isVariableDeclaration, w as SignatureKind, y as symbolAt, z as isExportDeclaration } from "./syntax-CTiXR0EJ.mjs";
|
|
12
12
|
import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-LT40e_l3.mjs";
|
|
13
13
|
import "./cli-contract-D7btWrEu.mjs";
|
|
14
|
+
import { builtinModules } from "node:module";
|
|
14
15
|
import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
15
|
-
import { Array, Config, Context, Effect, FileSystem, HashMap, HashSet, Metric, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, SchemaTransformation, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
16
|
+
import { Array, Boolean as Boolean$1, Config, Context, Effect, FileSystem, HashMap, HashSet, Metric, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, SchemaTransformation, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
16
17
|
import { updateWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-writer";
|
|
17
18
|
import { ChildProcess } from "effect/process";
|
|
18
19
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
@@ -20,9 +21,9 @@ import { parse as parse$1 } from "@pnpm/deps.path";
|
|
|
20
21
|
import { fileURLToPath } from "node:url";
|
|
21
22
|
import treeSitter from "@vscode/tree-sitter-wasm";
|
|
22
23
|
import { isMap, isPair, isScalar, isSeq, parse as parse$2, parseDocument, visit } from "yaml";
|
|
23
|
-
import semver from "semver";
|
|
24
|
-
import { stripVTControlCharacters } from "node:util";
|
|
25
24
|
import { rolldown } from "vite/rolldown";
|
|
25
|
+
import { stripVTControlCharacters } from "node:util";
|
|
26
|
+
import semver from "semver";
|
|
26
27
|
import { diagnosticDetail, lint, markdownPathspecs, y8Section } from "@r_masseater/y8";
|
|
27
28
|
import { lint as lint$1, wismPathspecs, wismSection } from "@r_masseater/wism";
|
|
28
29
|
import { fu4Section, lint as lint$2, workflowPathspecs } from "@r_masseater/fu4";
|
|
@@ -32,6 +33,98 @@ import { DockerfileParser } from "dockerfile-ast";
|
|
|
32
33
|
import { parse as parse$3 } from "sql-parser-cst";
|
|
33
34
|
import { getStaticTOMLValue, parseTOML } from "toml-eslint-parser";
|
|
34
35
|
import { findSkillFiles } from "@tanstack/intent";
|
|
36
|
+
// src/entities/workspace/model/run-tasks.ts
|
|
37
|
+
const TaskProperty = Schema.Struct({
|
|
38
|
+
type: Schema.Literal("Property"),
|
|
39
|
+
computed: Schema.Literal(false),
|
|
40
|
+
key: KeySchema,
|
|
41
|
+
value: Schema.Unknown,
|
|
42
|
+
start: Schema.Finite
|
|
43
|
+
});
|
|
44
|
+
const TaskObject = Schema.Struct({
|
|
45
|
+
type: Schema.Literal("ObjectExpression"),
|
|
46
|
+
properties: Schema.Array(Schema.Unknown)
|
|
47
|
+
});
|
|
48
|
+
const decodeTaskProperty = Schema.decodeUnknownOption(TaskProperty);
|
|
49
|
+
const decodeTaskObject = Schema.decodeUnknownOption(TaskObject);
|
|
50
|
+
const tasksIn = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap((tasks) => pipe(decodeTaskObject(tasks), Option.map(({ properties }) => properties), Option.getOrElse(() => []))), Array.flatMap((property) => Option.toArray(decodeTaskProperty(property))));
|
|
51
|
+
const runTasksOf = Effect.fn("runTasksOf")(function* runTasksOf(root, directory) {
|
|
52
|
+
const config = yield* workspaceConfigOf(root, directory);
|
|
53
|
+
return pipe(config, Option.map(({ file, source, program }) => ({
|
|
54
|
+
file,
|
|
55
|
+
source,
|
|
56
|
+
tasks: tasksIn(program)
|
|
57
|
+
})));
|
|
58
|
+
});
|
|
59
|
+
// src/entities/workspace/model/workspace-names.ts
|
|
60
|
+
const ALTERNATIVE$1 = "|";
|
|
61
|
+
const SCOPE$3 = /^@[^/]+\//u;
|
|
62
|
+
const SPECIAL$1 = /[$()*+.?[\\\]^{|}]/gu;
|
|
63
|
+
/** @internal */
|
|
64
|
+
const patternOf$1 = (names) => {
|
|
65
|
+
const alternatives = pipe(names, Array.map(String$1.replaceAll(SPECIAL$1, String.raw`\$&`)));
|
|
66
|
+
return new RegExp(`(?<![\\p{L}\\p{N}_-])(?:${Array.join(alternatives, ALTERNATIVE$1)})(?![\\p{L}\\p{N}_-])`, "gu");
|
|
67
|
+
};
|
|
68
|
+
const namedIn = (basename) => ({ directory, packageName }) => {
|
|
69
|
+
const unscoped = pipe(packageName, Option.map(String$1.replace(SCOPE$3, "")));
|
|
70
|
+
return {
|
|
71
|
+
directory,
|
|
72
|
+
names: pipe([
|
|
73
|
+
Option.some(directory),
|
|
74
|
+
Option.some(basename(directory)),
|
|
75
|
+
packageName,
|
|
76
|
+
unscoped
|
|
77
|
+
], Array.getSomes, Array.dedupe),
|
|
78
|
+
packageName
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
/** @internal */
|
|
82
|
+
const namedWorkspaces = Effect.fn("namedWorkspaces")(function* namedWorkspaces(root) {
|
|
83
|
+
const files = yield* RepositoryFiles;
|
|
84
|
+
const projects = yield* workspaceProjects(root);
|
|
85
|
+
return pipe(projects, Array.map(namedIn((directory) => files.basename(directory))));
|
|
86
|
+
});
|
|
87
|
+
// src/entities/workspace/model/cargo-crates.ts
|
|
88
|
+
const SEPARATOR$21 = "/";
|
|
89
|
+
const CrateTarget = Schema.Struct({ kind: Schema.Array(Schema.String) });
|
|
90
|
+
const CrateDependency = Schema.Struct({ path: Schema.optional(Schema.String) });
|
|
91
|
+
const CrateEntry = Schema.Struct({
|
|
92
|
+
name: Schema.String,
|
|
93
|
+
version: Schema.String,
|
|
94
|
+
manifest_path: Schema.String,
|
|
95
|
+
targets: Schema.Array(CrateTarget),
|
|
96
|
+
dependencies: Schema.Array(CrateDependency)
|
|
97
|
+
});
|
|
98
|
+
const CrateList = Schema.fromJsonString(Schema.Struct({ packages: Schema.Array(CrateEntry) }));
|
|
99
|
+
const decodeCrateList = Schema.decodeUnknownEffect(CrateList);
|
|
100
|
+
const crateOf$1 = (crate) => ({
|
|
101
|
+
name: crate.name,
|
|
102
|
+
version: crate.version,
|
|
103
|
+
manifest: crate.manifest_path,
|
|
104
|
+
kinds: pipe(crate.targets, Array.flatMap(({ kind }) => kind), Array.dedupe),
|
|
105
|
+
pathDependencies: pipe(crate.dependencies, Array.flatMap(({ path }) => Option.toArray(Option.fromUndefinedOr(path))))
|
|
106
|
+
});
|
|
107
|
+
/** @internal */
|
|
108
|
+
const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
109
|
+
const output = yield* (yield* ChildProcess.make("cargo", [
|
|
110
|
+
"metadata",
|
|
111
|
+
"--no-deps",
|
|
112
|
+
"--format-version",
|
|
113
|
+
"1",
|
|
114
|
+
"--offline"
|
|
115
|
+
], {
|
|
116
|
+
cwd: root,
|
|
117
|
+
extendEnv: true,
|
|
118
|
+
stdin: "ignore"
|
|
119
|
+
})).stdout.pipe(Stream.decodeText(), Stream.mkString);
|
|
120
|
+
const list = yield* decodeCrateList(output);
|
|
121
|
+
return pipe(list.packages, Array.map(crateOf$1));
|
|
122
|
+
}, Effect.scoped);
|
|
123
|
+
/** @internal */
|
|
124
|
+
const owningWorkspace = (directories) => (directory) => {
|
|
125
|
+
const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$21}`)(directory)));
|
|
126
|
+
return Array.last(Array.sort(owners, String$1.Order));
|
|
127
|
+
};
|
|
35
128
|
// src/features/check-overrides/model/override-findings.ts
|
|
36
129
|
const describeVersions = (versions) => Option.getOrElse(Option.liftPredicate(Array.join(versions, ","), (joined) => joined !== ""), () => "-");
|
|
37
130
|
const describeChanges = (report) => {
|
|
@@ -57,6 +150,56 @@ const overrideProblem = (located) => (report) => {
|
|
|
57
150
|
});
|
|
58
151
|
return Option.none();
|
|
59
152
|
};
|
|
153
|
+
// src/entities/project/model/implementation.ts
|
|
154
|
+
const MANIFEST_ENTRY = "package.json";
|
|
155
|
+
const SOURCE_ENTRY = "src";
|
|
156
|
+
const LOWER_LAYERS = ["entities", "shared"];
|
|
157
|
+
const PATH_SEPARATOR = "/";
|
|
158
|
+
const NOT_INSTALLED = [];
|
|
159
|
+
const walked = (directory) => Effect.gen(function* walkFrom() {
|
|
160
|
+
const files = yield* RepositoryFiles;
|
|
161
|
+
const found = yield* files.walkDirectory(directory);
|
|
162
|
+
return pipe(found, Array.map((file) => files.join(directory, file)));
|
|
163
|
+
});
|
|
164
|
+
const sourceFiles = Effect.fn("sourceFiles")(function* sourceFiles(root, moduleDirectory) {
|
|
165
|
+
const files = yield* RepositoryFiles;
|
|
166
|
+
const source = files.join(root, SOURCE_ENTRY);
|
|
167
|
+
const layers = pipe(LOWER_LAYERS, Array.map((layer) => files.join(source, layer)));
|
|
168
|
+
const nested = yield* Effect.forEach([files.dirname(moduleDirectory), ...layers], walked, { concurrency: 1 });
|
|
169
|
+
return Array.flatten(nested);
|
|
170
|
+
});
|
|
171
|
+
const bundleParts = Effect.fn("bundleParts")(function* bundleParts(root, moduleDirectory) {
|
|
172
|
+
const files = yield* RepositoryFiles;
|
|
173
|
+
const bundled = yield* walked(moduleDirectory);
|
|
174
|
+
return {
|
|
175
|
+
listed: [files.join(root, MANIFEST_ENTRY), ...bundled],
|
|
176
|
+
installed: NOT_INSTALLED
|
|
177
|
+
};
|
|
178
|
+
});
|
|
179
|
+
const sourceParts = Effect.fn("sourceParts")(function* sourceParts(root, moduleDirectory) {
|
|
180
|
+
return {
|
|
181
|
+
listed: yield* sourceFiles(root, moduleDirectory),
|
|
182
|
+
installed: yield* installedPackages(root, root)
|
|
183
|
+
};
|
|
184
|
+
});
|
|
185
|
+
/** @internal */
|
|
186
|
+
const implementationOf = Effect.fn("implementationOf")(function* implementationOf(moduleDirectory) {
|
|
187
|
+
const files = yield* RepositoryFiles;
|
|
188
|
+
const root = yield* nearestManifestDirectory(moduleDirectory);
|
|
189
|
+
const fromSource = String$1.startsWith(`${files.join(root, SOURCE_ENTRY)}${PATH_SEPARATOR}`)(moduleDirectory);
|
|
190
|
+
const parts = yield* Boolean$1.match(fromSource, {
|
|
191
|
+
onFalse: () => bundleParts(root, moduleDirectory),
|
|
192
|
+
onTrue: () => sourceParts(root, moduleDirectory)
|
|
193
|
+
});
|
|
194
|
+
return {
|
|
195
|
+
files: pipe(Array.sort(parts.listed, String$1.Order), Array.map((file) => [files.relative(root, file), file])),
|
|
196
|
+
installed: parts.installed
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
const implementationFingerprint = Effect.fn("implementationFingerprint")(function* implementationFingerprint(moduleDirectory) {
|
|
200
|
+
const implementation = yield* implementationOf(moduleDirectory);
|
|
201
|
+
return yield* contentKey(implementation.installed, implementation.files);
|
|
202
|
+
});
|
|
60
203
|
// src/features/check-overrides/model/override-records.ts
|
|
61
204
|
const RECORDS = [
|
|
62
205
|
NODE_MODULES,
|
|
@@ -228,8 +371,8 @@ const RESOLUTION_FILES = [
|
|
|
228
371
|
];
|
|
229
372
|
const RESOLUTION_CONCURRENCY = 2;
|
|
230
373
|
const SUCCEEDED$1 = 0;
|
|
231
|
-
const taggedError$
|
|
232
|
-
var OverrideResolutionFailed = class extends taggedError$
|
|
374
|
+
const taggedError$8 = Schema.TaggedError;
|
|
375
|
+
var OverrideResolutionFailed = class extends taggedError$8()("OverrideResolutionFailed", {
|
|
233
376
|
override: Schema.String,
|
|
234
377
|
output: Schema.String
|
|
235
378
|
}) {};
|
|
@@ -347,73 +490,103 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
347
490
|
overrides
|
|
348
491
|
}, keys));
|
|
349
492
|
});
|
|
493
|
+
// src/shared/lib/scanned-files.ts
|
|
494
|
+
const SCANNED_FILE = /(?:\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\/)(?:(?:Dockerfile|Containerfile)[^/]*|Makefile|justfile|\.tool-versions|[^./][^./]*))$/u;
|
|
495
|
+
const LOCKFILE$1 = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
|
|
496
|
+
const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
|
|
497
|
+
const READ_CONCURRENCY$33 = 64;
|
|
498
|
+
const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE$1.test(name);
|
|
499
|
+
const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
|
|
500
|
+
/** @internal */
|
|
501
|
+
const listedFiles = Effect.fn("listedFiles")(function* listedFiles(root) {
|
|
502
|
+
const files = yield* RepositoryFiles;
|
|
503
|
+
const names = yield* files.ownedFiles(root);
|
|
504
|
+
return pipe(names, Array.map((name) => ({
|
|
505
|
+
name,
|
|
506
|
+
file: files.join(root, name)
|
|
507
|
+
})));
|
|
508
|
+
});
|
|
509
|
+
/** @internal */
|
|
510
|
+
const presentFiles = Effect.fn("presentFiles")(function* presentFiles(listed) {
|
|
511
|
+
const files = yield* RepositoryFiles;
|
|
512
|
+
return yield* pipe(listed, Effect.filter(({ file }) => files.exists(file)));
|
|
513
|
+
});
|
|
514
|
+
/** @internal */
|
|
515
|
+
const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
|
|
516
|
+
const files = yield* RepositoryFiles;
|
|
517
|
+
const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
|
|
518
|
+
onNone: () => [],
|
|
519
|
+
onSome: (source) => problemsIn(entry, source)
|
|
520
|
+
}))), { concurrency: READ_CONCURRENCY$33 });
|
|
521
|
+
return Array.flatten(found);
|
|
522
|
+
});
|
|
350
523
|
// src/features/check-overrides/model/git-subpath.ts
|
|
351
524
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
352
525
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
353
|
-
const RULE$
|
|
526
|
+
const RULE$63 = "git-subpath-dependency";
|
|
354
527
|
const WHOLE_MATCH$4 = 0;
|
|
355
|
-
const problemAt$
|
|
528
|
+
const problemAt$7 = ({ file }, source) => (found) => ({
|
|
356
529
|
file,
|
|
357
530
|
...positionOf(source)(found.index ?? WHOLE_MATCH$4),
|
|
358
|
-
rule: RULE$
|
|
531
|
+
rule: RULE$63,
|
|
359
532
|
message: `Git subpath dependencies are banned. Publish the package to npm and depend on a released version instead of \`${String$1.trim(found[WHOLE_MATCH$4])}\`.`
|
|
360
533
|
});
|
|
361
|
-
const problemsIn$
|
|
534
|
+
const problemsIn$22 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$7(entry, source)));
|
|
362
535
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
363
536
|
/** @internal */
|
|
364
537
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
365
538
|
const listed = yield* listedFiles(root);
|
|
366
|
-
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$
|
|
539
|
+
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$22);
|
|
367
540
|
});
|
|
368
541
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
369
|
-
const RULE$
|
|
542
|
+
const RULE$62 = "unnamed-restriction";
|
|
370
543
|
const WHOLE_MATCH$3 = 0;
|
|
371
544
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
372
|
-
const problemsIn$
|
|
545
|
+
const problemsIn$21 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
|
|
373
546
|
file: entry.file,
|
|
374
547
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
375
|
-
rule: RULE$
|
|
548
|
+
rule: RULE$62,
|
|
376
549
|
message: `${found[WHOLE_MATCH$3]} is not used in this repository, because its name does not say what an entry protects. Ban a package in dependencyRules.banned, and write any other restriction as a rule in msch-lint whose name states the intent.`
|
|
377
550
|
})));
|
|
378
551
|
/** @internal */
|
|
379
552
|
const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
|
|
380
553
|
const listed = yield* listedFiles(root);
|
|
381
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
554
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$21);
|
|
382
555
|
});
|
|
383
556
|
// src/features/check-overrides/model/type-exemptions.ts
|
|
384
|
-
const RULE$
|
|
557
|
+
const RULE$61 = "named-type-exemption";
|
|
385
558
|
const WHOLE_MATCH$2 = 0;
|
|
386
559
|
const SPECIFIER = new RegExp(`["']?\\bfrom["']?\\s*:\\s*["'](?:file|lib|package)["']`, "gu");
|
|
387
|
-
const problemsIn$
|
|
560
|
+
const problemsIn$20 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array.map((found) => ({
|
|
388
561
|
file: entry.file,
|
|
389
562
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
390
|
-
rule: RULE$
|
|
563
|
+
rule: RULE$61,
|
|
391
564
|
message: "exempts a type from a lint rule by its name. Such a list is written by hand for every dependency and only grows. msch-lint/readonly-parameters reads where each type is declared and exempts the types of packages and of the language by itself, so remove the entry. For another rule, add a rule to msch-lint that reads the declaration."
|
|
392
565
|
})));
|
|
393
566
|
/** @internal */
|
|
394
567
|
const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkTypeExemptions(root) {
|
|
395
568
|
const listed = yield* listedFiles(root);
|
|
396
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
569
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$20);
|
|
397
570
|
});
|
|
398
571
|
// src/features/check-overrides/model/package-registry.ts
|
|
399
|
-
const RULE$
|
|
572
|
+
const RULE$60 = "package-registry";
|
|
400
573
|
const REGISTRY = "https://npm.flatt.tech/";
|
|
401
574
|
const TRAILING_SLASH = /\/$/u;
|
|
402
575
|
const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
|
|
403
576
|
const NPMRC = /(?:^|\/)\.npmrc$/u;
|
|
404
577
|
const WORKSPACE_REGISTRY = /^registry:/mu;
|
|
405
578
|
const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
|
|
406
|
-
const START$
|
|
579
|
+
const START$24 = 0;
|
|
407
580
|
const REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;
|
|
408
581
|
const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
|
|
409
582
|
const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
|
|
410
583
|
const withoutSlash = String$1.replace(TRAILING_SLASH, "");
|
|
411
584
|
const isGuarded = (registry) => withoutSlash(registry) === withoutSlash(REGISTRY);
|
|
412
|
-
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
585
|
+
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$24));
|
|
413
586
|
const workspaceProblem = (file, source, registry) => ({
|
|
414
587
|
file,
|
|
415
588
|
...positionOf(source)(offsetIn$1(WORKSPACE_REGISTRY.exec(source))),
|
|
416
|
-
rule: RULE$
|
|
589
|
+
rule: RULE$60,
|
|
417
590
|
message: Option.match(registry, {
|
|
418
591
|
onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$5}.`,
|
|
419
592
|
onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
|
|
@@ -421,9 +594,9 @@ const workspaceProblem = (file, source, registry) => ({
|
|
|
421
594
|
});
|
|
422
595
|
const npmrcProblems = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array.filter((found) => !Option.exists(groupOf$2("value")(found), isGuarded)), Array.map((found) => ({
|
|
423
596
|
file: entry.file,
|
|
424
|
-
...positionOf(source)(found.index ?? START$
|
|
425
|
-
rule: RULE$
|
|
426
|
-
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$
|
|
597
|
+
...positionOf(source)(found.index ?? START$24),
|
|
598
|
+
rule: RULE$60,
|
|
599
|
+
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$24])}\`. Remove the line.`
|
|
427
600
|
})));
|
|
428
601
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
|
|
429
602
|
const files = yield* RepositoryFiles;
|
|
@@ -442,7 +615,7 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
|
|
|
442
615
|
return [...yield* checkWorkspace(root), ...overrides];
|
|
443
616
|
});
|
|
444
617
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
445
|
-
const RULE$
|
|
618
|
+
const RULE$59 = "colocated-git-patterns";
|
|
446
619
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
447
620
|
const ROOT$3 = ".";
|
|
448
621
|
const NEGATION$1 = "!";
|
|
@@ -452,8 +625,8 @@ const FLOATING_PREFIX = `${ANY_DEPTH}/`;
|
|
|
452
625
|
const LEADING_SLASHES = /^\/+/u;
|
|
453
626
|
const TRAILING_SLASHES = /\/+$/u;
|
|
454
627
|
const SPACES = /\s+/u;
|
|
455
|
-
const FIRST$
|
|
456
|
-
const READ_CONCURRENCY$
|
|
628
|
+
const FIRST$22 = 1;
|
|
629
|
+
const READ_CONCURRENCY$32 = 16;
|
|
457
630
|
const withoutPrefix = (prefix, text) => {
|
|
458
631
|
if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
|
|
459
632
|
return text;
|
|
@@ -477,7 +650,7 @@ const entryOf$1 = (file, kind, directory) => (line, index) => {
|
|
|
477
650
|
file,
|
|
478
651
|
kind,
|
|
479
652
|
directory,
|
|
480
|
-
line: index + FIRST$
|
|
653
|
+
line: index + FIRST$22,
|
|
481
654
|
pattern,
|
|
482
655
|
values: Array.join(values, " ")
|
|
483
656
|
});
|
|
@@ -489,12 +662,12 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
489
662
|
const toEntry = entryOf$1(absolute, files.basename(file), files.dirname(file));
|
|
490
663
|
return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array.map(toEntry), Array.getSomes);
|
|
491
664
|
});
|
|
492
|
-
const patternProblem = (entry, message) => problemAtPosition(RULE$
|
|
665
|
+
const patternProblem = (entry, message) => problemAtPosition(RULE$59)(entry.file, {
|
|
493
666
|
line: entry.line,
|
|
494
|
-
column: FIRST$
|
|
667
|
+
column: FIRST$22
|
|
495
668
|
}, message);
|
|
496
669
|
const misplacedMessage = (kind, workspaces) => {
|
|
497
|
-
if (workspaces.length === FIRST$
|
|
670
|
+
if (workspaces.length === FIRST$22) {
|
|
498
671
|
const workspace = Array.join(workspaces, "");
|
|
499
672
|
return `matches only paths inside the workspace ${workspace}. Move it to ${workspace}/${kind} and write it relative to that directory.`;
|
|
500
673
|
}
|
|
@@ -544,17 +717,17 @@ const repeated = (entries) => (entry) => {
|
|
|
544
717
|
/** @internal */
|
|
545
718
|
const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
|
|
546
719
|
const patternFiles = yield* (yield* RepositoryFiles).matchingFiles(root, PATTERN_FILES);
|
|
547
|
-
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$
|
|
720
|
+
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$32 });
|
|
548
721
|
const entries = Array.flatten(read);
|
|
549
722
|
const workspaces = yield* workspaceDirectories(root);
|
|
550
|
-
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$
|
|
723
|
+
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$32 });
|
|
551
724
|
const repeatedFound = pipe(entries, Array.map(repeated(entries)));
|
|
552
725
|
return Array.getSomes([...misplacedFound, ...repeatedFound]);
|
|
553
726
|
});
|
|
554
727
|
// src/features/check-placement/model/colocated-tests.ts
|
|
555
|
-
const RULE$
|
|
556
|
-
const FIRST$
|
|
557
|
-
const READ_CONCURRENCY$
|
|
728
|
+
const RULE$58 = "colocated-test";
|
|
729
|
+
const FIRST$21 = 1;
|
|
730
|
+
const READ_CONCURRENCY$31 = 64;
|
|
558
731
|
const ROOT_SUBPATH = ".";
|
|
559
732
|
const NAME_GROUP = "name";
|
|
560
733
|
const SPECIFIER_GROUP = "specifier";
|
|
@@ -570,17 +743,17 @@ const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(
|
|
|
570
743
|
const EXCLUDED$8 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
571
744
|
const DIRECTORY_MESSAGE = "sits in a separate test directory. Put each test next to the module it tests, and test-only helpers next to the tests as <name>.test.support.ts.";
|
|
572
745
|
const SIBLING_MESSAGE = "refers to nothing in its own directory. Move the test next to the module it tests and import that module, or a helper beside it, with ./<name>.";
|
|
573
|
-
const Manifest$
|
|
746
|
+
const Manifest$8 = Schema.Struct({
|
|
574
747
|
name: Schema.optional(Schema.String),
|
|
575
748
|
exports: Schema.optional(Schema.Unknown)
|
|
576
749
|
});
|
|
577
|
-
const decodeManifest$
|
|
750
|
+
const decodeManifest$11 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$8));
|
|
578
751
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
579
|
-
const problemFor$
|
|
752
|
+
const problemFor$9 = (test, message) => ({
|
|
580
753
|
file: test.file,
|
|
581
|
-
line: FIRST$
|
|
582
|
-
column: FIRST$
|
|
583
|
-
rule: RULE$
|
|
754
|
+
line: FIRST$21,
|
|
755
|
+
column: FIRST$21,
|
|
756
|
+
rule: RULE$58,
|
|
584
757
|
message: `${test.base} ${message}`
|
|
585
758
|
});
|
|
586
759
|
const groupsOf$1 = (source, pattern, group) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((match) => pipe(Option.fromUndefinedOr(match.groups), Option.flatMap((groups) => Option.fromUndefinedOr(groups[group])))), Array.getSomes);
|
|
@@ -600,7 +773,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
600
773
|
if (Option.isNone(owner)) return [];
|
|
601
774
|
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$3));
|
|
602
775
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
603
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
776
|
+
return pipe(text, Option.flatMap(decodeManifest$11), Option.map(specifiersBeside({
|
|
604
777
|
join,
|
|
605
778
|
dirname: files.dirname,
|
|
606
779
|
directory: test.directory
|
|
@@ -620,10 +793,10 @@ const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
|
|
|
620
793
|
});
|
|
621
794
|
const inSeparateTestDirectory = (name) => SEPARATE_TEST_DIRECTORY.test(name) || SPEC_DIRECTORY.test(name) && SPEC_FILE.test(name);
|
|
622
795
|
const problemIn$8 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
623
|
-
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$
|
|
796
|
+
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$9(test, DIRECTORY_MESSAGE));
|
|
624
797
|
if (!TEST_FILE$2.test(test.name)) return Option.none();
|
|
625
798
|
if (yield* refersIn(context, test)) return Option.none();
|
|
626
|
-
return Option.some(problemFor$
|
|
799
|
+
return Option.some(problemFor$9(test, SIBLING_MESSAGE));
|
|
627
800
|
});
|
|
628
801
|
/** @internal */
|
|
629
802
|
const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
|
|
@@ -643,12 +816,12 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
643
816
|
directory: files.dirname(file)
|
|
644
817
|
};
|
|
645
818
|
}));
|
|
646
|
-
const found = yield* Effect.forEach(tests, (test) => problemIn$8(context, test), { concurrency: READ_CONCURRENCY$
|
|
819
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$8(context, test), { concurrency: READ_CONCURRENCY$31 });
|
|
647
820
|
return Array.getSomes(found);
|
|
648
821
|
});
|
|
649
822
|
// src/shared/lib/agent-docs.ts
|
|
650
823
|
const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
651
|
-
const READ_CONCURRENCY$
|
|
824
|
+
const READ_CONCURRENCY$30 = 16;
|
|
652
825
|
const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
|
|
653
826
|
const files = yield* RepositoryFiles;
|
|
654
827
|
const listed = yield* files.listedFiles(root);
|
|
@@ -657,32 +830,32 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
657
830
|
const file = files.join(root, name);
|
|
658
831
|
const problemOf = Option.flatMap(problemIn(file));
|
|
659
832
|
return files.readFile(file).pipe(Effect.map(problemOf));
|
|
660
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
833
|
+
}, { concurrency: READ_CONCURRENCY$30 });
|
|
661
834
|
return Array.getSomes(found);
|
|
662
835
|
});
|
|
663
836
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
664
837
|
const RECOMMENDED_LINES = 200;
|
|
665
|
-
const FIRST$
|
|
666
|
-
const RULE$
|
|
838
|
+
const FIRST$20 = 1;
|
|
839
|
+
const RULE$57 = "agent-docs-length";
|
|
667
840
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
668
|
-
const problemFor$
|
|
841
|
+
const problemFor$8 = (file) => (lines) => {
|
|
669
842
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
670
843
|
return Option.some({
|
|
671
844
|
file,
|
|
672
845
|
line: 201,
|
|
673
|
-
column: FIRST$
|
|
674
|
-
rule: RULE$
|
|
846
|
+
column: FIRST$20,
|
|
847
|
+
rule: RULE$57,
|
|
675
848
|
message: `has ${String(lines)} lines. Claude Code recommends under ${String(RECOMMENDED_LINES)} lines per file: longer files cost context and are followed less reliably. Cut what the code already tells, and move rules shared across repositories into skills.`
|
|
676
849
|
});
|
|
677
850
|
};
|
|
678
851
|
/** @internal */
|
|
679
|
-
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$
|
|
852
|
+
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$8(file)(lineCount(source)));
|
|
680
853
|
// src/features/check-placement/model/claude-link.ts
|
|
681
|
-
const RULE$
|
|
854
|
+
const RULE$56 = "claude-md-link";
|
|
682
855
|
const CLAUDE = "CLAUDE.md";
|
|
683
856
|
const AGENTS = "AGENTS.md";
|
|
684
|
-
const FIRST$
|
|
685
|
-
const READ_CONCURRENCY$
|
|
857
|
+
const FIRST$19 = 1;
|
|
858
|
+
const READ_CONCURRENCY$29 = 16;
|
|
686
859
|
const MESSAGE$16 = "CLAUDE.md must be a symbolic link to AGENTS.md";
|
|
687
860
|
/** @internal */
|
|
688
861
|
const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLinks(root) {
|
|
@@ -695,21 +868,21 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
695
868
|
const pointsElsewhere = pipe(target, Option.exists((value) => value !== AGENTS));
|
|
696
869
|
return pipe(Option.liftPredicate(file, () => !isLink || pointsElsewhere), Option.map((path) => ({
|
|
697
870
|
file: path,
|
|
698
|
-
line: FIRST$
|
|
699
|
-
column: FIRST$
|
|
700
|
-
rule: RULE$
|
|
871
|
+
line: FIRST$19,
|
|
872
|
+
column: FIRST$19,
|
|
873
|
+
rule: RULE$56,
|
|
701
874
|
message: MESSAGE$16
|
|
702
875
|
})));
|
|
703
876
|
});
|
|
704
877
|
const claude = pipe(listed, Array.filter((name) => files.basename(name) === CLAUDE));
|
|
705
|
-
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$
|
|
878
|
+
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$29 });
|
|
706
879
|
return Array.getSomes(found);
|
|
707
880
|
});
|
|
708
881
|
// src/features/check-placement/model/dangling-links.ts
|
|
709
|
-
const RULE$
|
|
882
|
+
const RULE$55 = "dangling-link";
|
|
710
883
|
const SEPARATOR$20 = "/";
|
|
711
|
-
const FIRST$
|
|
712
|
-
const READ_CONCURRENCY$
|
|
884
|
+
const FIRST$18 = 1;
|
|
885
|
+
const READ_CONCURRENCY$28 = 16;
|
|
713
886
|
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$20}`)(name);
|
|
714
887
|
/** @internal */
|
|
715
888
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
@@ -720,18 +893,18 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
720
893
|
const link = yield* files.readLink(file);
|
|
721
894
|
return pipe(link, Option.map((target) => files.relative(root, files.resolve(files.dirname(file), target))), Option.filter((target) => !pipe(listed, Array.some(holds(target)))), Option.map((target) => ({
|
|
722
895
|
file,
|
|
723
|
-
line: FIRST$
|
|
724
|
-
column: FIRST$
|
|
725
|
-
rule: RULE$
|
|
896
|
+
line: FIRST$18,
|
|
897
|
+
column: FIRST$18,
|
|
898
|
+
rule: RULE$55,
|
|
726
899
|
message: `is a link to ${target}, where no file is tracked. A fresh checkout gets a link to nothing, and GitHub Actions fails to load the repository's actions. Track a file there, such as .gitkeep, or delete the link.`
|
|
727
900
|
})));
|
|
728
901
|
});
|
|
729
|
-
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$
|
|
902
|
+
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$28 });
|
|
730
903
|
return Array.getSomes(found);
|
|
731
904
|
});
|
|
732
905
|
// src/features/check-placement/model/member-sources.ts
|
|
733
906
|
const ROOT_WORKSPACE$1 = ".";
|
|
734
|
-
const FIRST$
|
|
907
|
+
const FIRST$17 = 1;
|
|
735
908
|
const SEPARATOR$19 = "/";
|
|
736
909
|
const EXCLUDED$7 = [
|
|
737
910
|
":(exclude,attr:linguist-vendored)",
|
|
@@ -752,8 +925,8 @@ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
|
|
|
752
925
|
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
753
926
|
const fileProblem$1 = ({ file, rule, message }) => ({
|
|
754
927
|
file,
|
|
755
|
-
line: FIRST$
|
|
756
|
-
column: FIRST$
|
|
928
|
+
line: FIRST$17,
|
|
929
|
+
column: FIRST$17,
|
|
757
930
|
rule,
|
|
758
931
|
message
|
|
759
932
|
});
|
|
@@ -780,9 +953,9 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
|
|
|
780
953
|
}));
|
|
781
954
|
});
|
|
782
955
|
// src/features/check-placement/model/deployed-readme.ts
|
|
783
|
-
const RULE$
|
|
956
|
+
const RULE$54 = "deployed-readme";
|
|
784
957
|
const ROOT_DIRECTORY$2 = "";
|
|
785
|
-
const READ_CONCURRENCY$
|
|
958
|
+
const READ_CONCURRENCY$27 = 16;
|
|
786
959
|
const MISSING_MESSAGE$2 = "is missing. This workspace has an Alchemy stack that serves an address, so give it a README.md that says what it is and links its URL.";
|
|
787
960
|
const NO_URL_MESSAGE = "has no https:// URL. This workspace has an Alchemy stack that serves an address, so link the URL it is served at.";
|
|
788
961
|
const ADDRESS_KEYS = [
|
|
@@ -820,14 +993,14 @@ const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
820
993
|
const readme = yield* readReadme({
|
|
821
994
|
root,
|
|
822
995
|
directory,
|
|
823
|
-
rule: RULE$
|
|
996
|
+
rule: RULE$54,
|
|
824
997
|
missingMessage: MISSING_MESSAGE$2
|
|
825
998
|
});
|
|
826
999
|
return Result.match(readme, {
|
|
827
1000
|
onFailure: Option.some,
|
|
828
1001
|
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
829
1002
|
file,
|
|
830
|
-
rule: RULE$
|
|
1003
|
+
rule: RULE$54,
|
|
831
1004
|
message: NO_URL_MESSAGE
|
|
832
1005
|
})))
|
|
833
1006
|
});
|
|
@@ -838,40 +1011,40 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
|
|
|
838
1011
|
const listed = yield* files.listedFiles(root);
|
|
839
1012
|
const directories = yield* workspaceDirectories(root);
|
|
840
1013
|
const candidates = pipe(listed, Array.filter((file) => STACK_FILE.test(file)));
|
|
841
|
-
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$
|
|
1014
|
+
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$27 });
|
|
842
1015
|
const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$2))), Array.dedupe);
|
|
843
|
-
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$
|
|
1016
|
+
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$27 });
|
|
844
1017
|
return Array.getSomes(found);
|
|
845
1018
|
});
|
|
846
1019
|
// src/features/check-placement/model/nested-docs.ts
|
|
847
|
-
const RULE$
|
|
1020
|
+
const RULE$53 = "nested-docs";
|
|
848
1021
|
const CONFIG_FILE$7 = "vite.config.ts";
|
|
849
1022
|
const SEPARATOR$18 = "/";
|
|
850
|
-
const READ_CONCURRENCY$
|
|
1023
|
+
const READ_CONCURRENCY$26 = 64;
|
|
851
1024
|
const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
852
1025
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
853
1026
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
854
|
-
const MANIFEST$
|
|
1027
|
+
const MANIFEST$5 = "package.json";
|
|
855
1028
|
const MISSING_RULE = "workspace-agents-md";
|
|
856
1029
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
857
|
-
const taggedError$
|
|
858
|
-
var RootConfigUnreadable = class extends taggedError$
|
|
1030
|
+
const taggedError$7 = Schema.TaggedError;
|
|
1031
|
+
var RootConfigUnreadable = class extends taggedError$7()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
859
1032
|
const isNested = (name) => String$1.includes(SEPARATOR$18)(name);
|
|
860
|
-
const problemFor$
|
|
1033
|
+
const problemFor$7 = problemInFile(RULE$53);
|
|
861
1034
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
862
1035
|
const WORKSPACE_AGENT_DOCS_MESSAGE = "belongs only at the repository root or as AGENTS.md directly in a workspace, the directory that holds its package.json. Move what agents need there and delete this file.";
|
|
863
1036
|
const MISSING_MESSAGE$1 = "has no AGENTS.md next to it. This repository sets msch.workspaceAgentsMd, so every workspace describes what it is for and the rules that apply only there in its own AGENTS.md.";
|
|
864
1037
|
const README_MESSAGE = "is allowed below the root only in a workspace, the directory that holds its package.json. Move it into the workspace it describes.";
|
|
865
1038
|
const agentDocProblem = ({ file, base, directory }, allowed) => {
|
|
866
|
-
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$
|
|
1039
|
+
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$7(file, `${base} ${AGENT_DOCS_MESSAGE}`));
|
|
867
1040
|
if (base === WORKSPACE_AGENT_DOC && HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
868
|
-
return Option.some(problemFor$
|
|
1041
|
+
return Option.some(problemFor$7(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));
|
|
869
1042
|
};
|
|
870
1043
|
const readmeProblem = ({ file, base, directory }, allowed) => {
|
|
871
1044
|
if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
872
|
-
return Option.some(problemFor$
|
|
1045
|
+
return Option.some(problemFor$7(file, `${base} ${README_MESSAGE}`));
|
|
873
1046
|
};
|
|
874
|
-
const missingProblems = ({ required, directories, present, join }) => pipe(directories, Array.filter((directory) => required && !HashSet.has(present, join(directory, WORKSPACE_AGENT_DOC))), Array.map((directory) => problemInFile(MISSING_RULE)(join(directory, MANIFEST$
|
|
1047
|
+
const missingProblems = ({ required, directories, present, join }) => pipe(directories, Array.filter((directory) => required && !HashSet.has(present, join(directory, WORKSPACE_AGENT_DOC))), Array.map((directory) => problemInFile(MISSING_RULE)(join(directory, MANIFEST$5), MISSING_MESSAGE$1)));
|
|
875
1048
|
const problemIn$6 = Effect.fn("problemIn")(function* problemIn(root, allowed, name) {
|
|
876
1049
|
const files = yield* RepositoryFiles;
|
|
877
1050
|
const file = files.join(root, name);
|
|
@@ -904,7 +1077,7 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
904
1077
|
workspaces: pipe(directories, Array.map((directory) => files.join(root, directory)), HashSet.fromIterable),
|
|
905
1078
|
workspaceAgentDocs
|
|
906
1079
|
};
|
|
907
|
-
const found = yield* Effect.forEach(nested, (name) => problemIn$6(root, allowed, name), { concurrency: READ_CONCURRENCY$
|
|
1080
|
+
const found = yield* Effect.forEach(nested, (name) => problemIn$6(root, allowed, name), { concurrency: READ_CONCURRENCY$26 });
|
|
908
1081
|
const missing = missingProblems({
|
|
909
1082
|
required: workspaceAgentDocs,
|
|
910
1083
|
directories: pipe(directories, Array.map((directory) => files.join(root, directory))),
|
|
@@ -914,15 +1087,15 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
914
1087
|
return [...Array.getSomes(found), ...missing];
|
|
915
1088
|
});
|
|
916
1089
|
// src/features/check-placement/model/published-readme.ts
|
|
917
|
-
const RULE$
|
|
918
|
-
const READ_CONCURRENCY$
|
|
1090
|
+
const RULE$52 = "published-readme";
|
|
1091
|
+
const READ_CONCURRENCY$25 = 16;
|
|
919
1092
|
const MESSAGE$15 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
920
1093
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
921
1094
|
const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
|
|
922
1095
|
const readme = yield* readReadme({
|
|
923
1096
|
root,
|
|
924
1097
|
directory,
|
|
925
|
-
rule: RULE$
|
|
1098
|
+
rule: RULE$52,
|
|
926
1099
|
missingMessage: MISSING_MESSAGE
|
|
927
1100
|
});
|
|
928
1101
|
return Result.match(readme, {
|
|
@@ -933,7 +1106,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
933
1106
|
file,
|
|
934
1107
|
line,
|
|
935
1108
|
column,
|
|
936
|
-
rule: RULE$
|
|
1109
|
+
rule: RULE$52,
|
|
937
1110
|
message: MESSAGE$15
|
|
938
1111
|
};
|
|
939
1112
|
}))
|
|
@@ -942,17 +1115,17 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
942
1115
|
/** @internal */
|
|
943
1116
|
const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPublishedReadme(root) {
|
|
944
1117
|
const projects = yield* publishedProjects(root);
|
|
945
|
-
const found = yield* Effect.forEach(projects, (project) => problemIn$5(root, project), { concurrency: READ_CONCURRENCY$
|
|
1118
|
+
const found = yield* Effect.forEach(projects, (project) => problemIn$5(root, project), { concurrency: READ_CONCURRENCY$25 });
|
|
946
1119
|
return Array.getSomes(found);
|
|
947
1120
|
});
|
|
948
1121
|
// src/features/check-placement/model/published-tests.ts
|
|
949
|
-
const RULE$
|
|
1122
|
+
const RULE$51 = "published-tests";
|
|
950
1123
|
const MANIFEST_FILE$2 = "package.json";
|
|
951
1124
|
const FILE_START = 1;
|
|
952
1125
|
const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
|
|
953
1126
|
const MESSAGE$14 = "belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.";
|
|
954
1127
|
const testedIn = (listed) => (prefix) => pipe(listed, Array.some((file) => String$1.startsWith(prefix)(file) && TEST_FILE$1.test(file)));
|
|
955
|
-
const problemFor$
|
|
1128
|
+
const problemFor$6 = Effect.fn("problemFor")(function* problemFor(root, listed, { directory }) {
|
|
956
1129
|
const files = yield* RepositoryFiles;
|
|
957
1130
|
const absolute = files.join(root, directory);
|
|
958
1131
|
const prefix = `${absolute}/`;
|
|
@@ -961,7 +1134,7 @@ const problemFor$5 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
961
1134
|
file: files.join(absolute, MANIFEST_FILE$2),
|
|
962
1135
|
line: FILE_START,
|
|
963
1136
|
column: FILE_START,
|
|
964
|
-
rule: RULE$
|
|
1137
|
+
rule: RULE$51,
|
|
965
1138
|
message: MESSAGE$14
|
|
966
1139
|
});
|
|
967
1140
|
});
|
|
@@ -971,13 +1144,13 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
971
1144
|
const projects = yield* publishedProjects(root);
|
|
972
1145
|
const listed = yield* files.listedFiles(root);
|
|
973
1146
|
const absolute = pipe(listed, Array.map((file) => files.join(root, file)));
|
|
974
|
-
const found = yield* Effect.forEach(projects, (project) => problemFor$
|
|
1147
|
+
const found = yield* Effect.forEach(projects, (project) => problemFor$6(root, absolute, project), { concurrency: 1 });
|
|
975
1148
|
return Array.getSomes(found);
|
|
976
1149
|
});
|
|
977
1150
|
// src/features/check-placement/model/root-docs.ts
|
|
978
|
-
const RULE$
|
|
1151
|
+
const RULE$50 = "root-docs";
|
|
979
1152
|
const SEPARATOR$17 = "/";
|
|
980
|
-
const FIRST$
|
|
1153
|
+
const FIRST$16 = 1;
|
|
981
1154
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
982
1155
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
983
1156
|
const MESSAGE$13 = "is a hand-written document outside the places documents belong. Hand-written text goes only in the root README.md, AGENTS.md, CLAUDE.md, ARCHITECTURE.md and DESIGN.md, and under docs/. Move what is still true and not already told by the code into one of them, and delete this file.";
|
|
@@ -988,17 +1161,17 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
988
1161
|
const names = yield* files.listedFiles(root);
|
|
989
1162
|
return pipe(names, Array.filter(isStrayRootDoc), Array.map((name) => ({
|
|
990
1163
|
file: files.join(root, name),
|
|
991
|
-
line: FIRST$
|
|
992
|
-
column: FIRST$
|
|
993
|
-
rule: RULE$
|
|
1164
|
+
line: FIRST$16,
|
|
1165
|
+
column: FIRST$16,
|
|
1166
|
+
rule: RULE$50,
|
|
994
1167
|
message: `${name} ${MESSAGE$13}`
|
|
995
1168
|
})));
|
|
996
1169
|
});
|
|
997
1170
|
// src/features/check-placement/model/root-readme.ts
|
|
998
|
-
const RULE$
|
|
1171
|
+
const RULE$49 = "root-readme";
|
|
999
1172
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
1000
|
-
const READ_CONCURRENCY$
|
|
1001
|
-
const START$
|
|
1173
|
+
const READ_CONCURRENCY$24 = 16;
|
|
1174
|
+
const START$23 = 0;
|
|
1002
1175
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
1003
1176
|
const MARKETPLACE$1 = ".claude-plugin/marketplace.json";
|
|
1004
1177
|
const RELATIVE$1 = /^\.\//u;
|
|
@@ -1037,17 +1210,17 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
|
|
|
1037
1210
|
onNone: () => ownNames(plugins, names),
|
|
1038
1211
|
onSome: () => [directory]
|
|
1039
1212
|
}));
|
|
1040
|
-
const problemsIn$
|
|
1213
|
+
const problemsIn$19 = (file, source, plugins) => (workspace) => {
|
|
1041
1214
|
const message = messageFor(workspace.directory);
|
|
1042
1215
|
const at = positionOf(source);
|
|
1043
1216
|
const pattern = patternFor(plugins)(workspace);
|
|
1044
|
-
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$
|
|
1217
|
+
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$49)(file, at(found.index ?? START$23), message)));
|
|
1045
1218
|
};
|
|
1046
1219
|
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
|
|
1047
1220
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
1048
1221
|
return pipe(text, Option.match({
|
|
1049
1222
|
onNone: () => [],
|
|
1050
|
-
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$
|
|
1223
|
+
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$19(file, source, plugins)))
|
|
1051
1224
|
}));
|
|
1052
1225
|
});
|
|
1053
1226
|
/** @internal */
|
|
@@ -1058,7 +1231,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
1058
1231
|
const named = yield* namedWorkspaces(root);
|
|
1059
1232
|
const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
|
|
1060
1233
|
const plugins = yield* marketplacePlugins(root);
|
|
1061
|
-
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$
|
|
1234
|
+
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$24 });
|
|
1062
1235
|
return Array.flatten(found);
|
|
1063
1236
|
});
|
|
1064
1237
|
// src/features/check-placement/model/doc-placement.ts
|
|
@@ -1078,10 +1251,10 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
1078
1251
|
return Array.flatten(found);
|
|
1079
1252
|
});
|
|
1080
1253
|
// src/features/check-placement/model/docs-mirror.ts
|
|
1081
|
-
const RULE$
|
|
1254
|
+
const RULE$48 = "docs-mirror";
|
|
1082
1255
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
1083
1256
|
const MIRROR_LIMIT = 3;
|
|
1084
|
-
const READ_CONCURRENCY$
|
|
1257
|
+
const READ_CONCURRENCY$23 = 16;
|
|
1085
1258
|
const SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
|
|
1086
1259
|
const BEFORE = String.raw`(?<![\w@/.-])`;
|
|
1087
1260
|
const AFTER = String.raw`(?![\w@.-])`;
|
|
@@ -1097,20 +1270,20 @@ const firstMention = (source, workspace) => {
|
|
|
1097
1270
|
};
|
|
1098
1271
|
const ownerOf$3 = (doc) => (workspace) => String$1.startsWith(`${workspace.directory}/`)(doc);
|
|
1099
1272
|
const describe = (mentions) => pipe(mentions, Array.map(({ directory }) => `\`${directory}\``), Array.join(", "));
|
|
1100
|
-
const problemFor$
|
|
1273
|
+
const problemFor$5 = (file, source, mentions) => pipe(Array.head(mentions), Option.filter(() => mentions.length >= MIRROR_LIMIT), Option.map(({ offset }) => {
|
|
1101
1274
|
const { line, column } = positionOf(source)(offset);
|
|
1102
1275
|
return {
|
|
1103
1276
|
file,
|
|
1104
1277
|
line,
|
|
1105
1278
|
column,
|
|
1106
|
-
rule: RULE$
|
|
1279
|
+
rule: RULE$48,
|
|
1107
1280
|
message: `names ${String(mentions.length)} other workspaces (${describe(mentions)}). The workspace list and each package.json already declare them, so this copy goes stale. Point at the declaration instead of listing it.`
|
|
1108
1281
|
};
|
|
1109
1282
|
}), Option.toArray);
|
|
1110
1283
|
const othersIn = (doc, workspaces) => pipe(workspaces, Array.filter((workspace) => !ownerOf$3(doc)(workspace)));
|
|
1111
1284
|
const problemIn$4 = (workspaces) => (doc, file, source) => {
|
|
1112
1285
|
const mentions = pipe(othersIn(doc, workspaces), Array.flatMap((workspace) => Option.toArray(firstMention(source, workspace))));
|
|
1113
|
-
return problemFor$
|
|
1286
|
+
return problemFor$5(file, source, Array.sort(mentions, byOffset));
|
|
1114
1287
|
};
|
|
1115
1288
|
const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
|
|
1116
1289
|
const files = yield* RepositoryFiles;
|
|
@@ -1118,7 +1291,7 @@ const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
|
|
|
1118
1291
|
return yield* Effect.forEach(directories, (directory) => readManifest(files.join(root, directory)).pipe(Effect.map((manifest) => ({
|
|
1119
1292
|
directory,
|
|
1120
1293
|
names: [directory, ...pipe(manifest, Option.flatMap(({ name }) => Option.fromUndefinedOr(name)), Option.toArray)]
|
|
1121
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
1294
|
+
}))), { concurrency: READ_CONCURRENCY$23 });
|
|
1122
1295
|
});
|
|
1123
1296
|
/** @internal */
|
|
1124
1297
|
const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(root) {
|
|
@@ -1131,13 +1304,13 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
1131
1304
|
onNone: () => [],
|
|
1132
1305
|
onSome: (text) => problemIn$4(workspaces)(doc, file, text)
|
|
1133
1306
|
})));
|
|
1134
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
1307
|
+
}, { concurrency: READ_CONCURRENCY$23 });
|
|
1135
1308
|
return Array.flatten(found);
|
|
1136
1309
|
});
|
|
1137
1310
|
// src/features/check-placement/model/ignored-sources.ts
|
|
1138
|
-
const RULE$
|
|
1311
|
+
const RULE$47 = "ignored-sources";
|
|
1139
1312
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
1140
|
-
const FIRST$
|
|
1313
|
+
const FIRST$15 = 1;
|
|
1141
1314
|
const MESSAGE$12 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
1142
1315
|
/** @internal */
|
|
1143
1316
|
const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgnoredSources(root) {
|
|
@@ -1145,9 +1318,9 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
|
|
|
1145
1318
|
const ignored = yield* files.ignoredFiles(root, SOURCES);
|
|
1146
1319
|
return pipe(ignored, Array.map((file) => ({
|
|
1147
1320
|
file: files.join(root, file),
|
|
1148
|
-
line: FIRST$
|
|
1149
|
-
column: FIRST$
|
|
1150
|
-
rule: RULE$
|
|
1321
|
+
line: FIRST$15,
|
|
1322
|
+
column: FIRST$15,
|
|
1323
|
+
rule: RULE$47,
|
|
1151
1324
|
message: MESSAGE$12
|
|
1152
1325
|
})));
|
|
1153
1326
|
});
|
|
@@ -1178,8 +1351,8 @@ const checkPublicEntries = Effect.fn("checkPublicEntries")(function* checkPublic
|
|
|
1178
1351
|
return Array.flatten(entries);
|
|
1179
1352
|
});
|
|
1180
1353
|
// src/shared/lib/tree-sitter.ts
|
|
1181
|
-
const taggedError$
|
|
1182
|
-
var GrammarUnreadable = class extends taggedError$
|
|
1354
|
+
const taggedError$6 = Schema.TaggedError;
|
|
1355
|
+
var GrammarUnreadable = class extends taggedError$6()("GrammarUnreadable", {
|
|
1183
1356
|
grammar: Schema.String,
|
|
1184
1357
|
message: Schema.String
|
|
1185
1358
|
}) {};
|
|
@@ -1222,7 +1395,7 @@ const LAYERS = [
|
|
|
1222
1395
|
];
|
|
1223
1396
|
const RUST_FILE = /\.rs$/u;
|
|
1224
1397
|
const BINARY = /^src\/bin\/[^/]+\.rs$/u;
|
|
1225
|
-
const MANIFEST$
|
|
1398
|
+
const MANIFEST$4 = /(?:^|\/)Cargo\.toml$/u;
|
|
1226
1399
|
const MODULE_INDEX = "mod";
|
|
1227
1400
|
const CRATE_ROOTS = ["src/lib.rs", "src/main.rs"];
|
|
1228
1401
|
const OUTSIDE_ALLOWED = /^(?:build\.rs|benches\/.+)$/u;
|
|
@@ -1238,7 +1411,7 @@ const LAYER_DEPTH = 1;
|
|
|
1238
1411
|
const SOURCE_PREFIX$1 = `src/`;
|
|
1239
1412
|
const ROOT_CRATE = "";
|
|
1240
1413
|
const byLength = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
1241
|
-
const crateDirectories = (listed) => pipe(listed, Array.filter((name) => MANIFEST$
|
|
1414
|
+
const crateDirectories = (listed) => pipe(listed, Array.filter((name) => MANIFEST$4.test(name)), Array.map((name) => String$1.replace(MANIFEST$4, "")(name)));
|
|
1242
1415
|
const ownedBy = (crate, name) => {
|
|
1243
1416
|
if (crate === ROOT_CRATE) return {
|
|
1244
1417
|
crate,
|
|
@@ -9825,7 +9998,7 @@ const LAYER_ITEMS = [
|
|
|
9825
9998
|
"attribute_item",
|
|
9826
9999
|
"inner_attribute_item"
|
|
9827
10000
|
];
|
|
9828
|
-
const READ_CONCURRENCY$
|
|
10001
|
+
const READ_CONCURRENCY$22 = 64;
|
|
9829
10002
|
const EXCLUDED$6 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
9830
10003
|
const NONE$2 = [];
|
|
9831
10004
|
const ROOT_MESSAGE = "defines code in the crate root. Keep lib.rs and main.rs to mod declarations of layers, use, pub use and fn main, and put the code in a layer.";
|
|
@@ -9901,17 +10074,17 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
9901
10074
|
if (!Array.isReadonlyArrayNonEmpty(sources)) return NONE$2;
|
|
9902
10075
|
const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);
|
|
9903
10076
|
const parse = parsedWith(language);
|
|
9904
|
-
const read = yield* Effect.forEach(pipe(sources, Array.filter(isRead)), (source) => files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))), { concurrency: READ_CONCURRENCY$
|
|
10077
|
+
const read = yield* Effect.forEach(pipe(sources, Array.filter(isRead)), (source) => files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))), { concurrency: READ_CONCURRENCY$22 });
|
|
9905
10078
|
return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$4)];
|
|
9906
10079
|
});
|
|
9907
10080
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
9908
|
-
const RULE$
|
|
9909
|
-
const FIRST$
|
|
10081
|
+
const RULE$46 = "shadcn-ui-alias";
|
|
10082
|
+
const FIRST$14 = 1;
|
|
9910
10083
|
const problemOf$9 = (directory, { file, alias }) => ({
|
|
9911
10084
|
file,
|
|
9912
|
-
line: FIRST$
|
|
9913
|
-
column: FIRST$
|
|
9914
|
-
rule: RULE$
|
|
10085
|
+
line: FIRST$14,
|
|
10086
|
+
column: FIRST$14,
|
|
10087
|
+
rule: RULE$46,
|
|
9915
10088
|
message: `aliases.ui "${alias}" in ${directory}/components.json does not resolve to a directory through the imports of ${directory}/package.json. shadcn lint and msch then cannot tell which files are the design-system components. Point the alias at a "#/" import, such as "#/shared/ui", and map "#/*" to "./src/*".`
|
|
9916
10089
|
});
|
|
9917
10090
|
/** @internal */
|
|
@@ -9931,8 +10104,8 @@ const SOURCE_ALIAS = "#/*";
|
|
|
9931
10104
|
const SOURCE_TARGET = "./src/*";
|
|
9932
10105
|
const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
|
|
9933
10106
|
const ALIAS_MESSAGE = `points into src/ under its own name. Import source through "${SOURCE_ALIAS}": "${SOURCE_TARGET}" only, so an import names the layer and slice it uses instead of a folder alias.`;
|
|
9934
|
-
const Manifest$
|
|
9935
|
-
const decodeManifest$
|
|
10107
|
+
const Manifest$7 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
|
|
10108
|
+
const decodeManifest$10 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$7));
|
|
9936
10109
|
const targetsOf = (target) => {
|
|
9937
10110
|
if (Predicate.isString(target)) return [target];
|
|
9938
10111
|
if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
|
|
@@ -9943,7 +10116,7 @@ const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, w
|
|
|
9943
10116
|
const files = yield* RepositoryFiles;
|
|
9944
10117
|
const manifest = files.join(root, workspace, MANIFEST_FILE$3);
|
|
9945
10118
|
const text = yield* files.readFile(manifest);
|
|
9946
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10119
|
+
return pipe(text, Option.flatMap(decodeManifest$10), Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)), Option.map((imports) => Record.toEntries(imports)), Option.getOrElse(() => Array.empty()), Array.filter(intoSource), Array.map(([key]) => problemInFile(ALIAS_RULE)(manifest, `"${key}" ${ALIAS_MESSAGE}`)));
|
|
9947
10120
|
});
|
|
9948
10121
|
/** @internal */
|
|
9949
10122
|
const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
|
|
@@ -9976,17 +10149,17 @@ const SCRIPTS_DIRECTORY = "scripts";
|
|
|
9976
10149
|
const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
9977
10150
|
const SEPARATOR$13 = "/";
|
|
9978
10151
|
const CURRENT = "./";
|
|
9979
|
-
const READ_CONCURRENCY$
|
|
9980
|
-
const FIRST$
|
|
10152
|
+
const READ_CONCURRENCY$21 = 8;
|
|
10153
|
+
const FIRST$13 = 1;
|
|
9981
10154
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
9982
10155
|
const COMMAND$1 = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
9983
10156
|
const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
|
|
9984
|
-
const Manifest$
|
|
10157
|
+
const Manifest$6 = Schema.Struct({
|
|
9985
10158
|
bin: Schema.optional(Schema.Unknown),
|
|
9986
10159
|
main: Schema.optional(Schema.Unknown),
|
|
9987
10160
|
exports: Schema.optional(Schema.Unknown)
|
|
9988
10161
|
});
|
|
9989
|
-
const decodeManifest$
|
|
10162
|
+
const decodeManifest$9 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$6));
|
|
9990
10163
|
const NO_ENTRIES = {
|
|
9991
10164
|
all: [],
|
|
9992
10165
|
bins: []
|
|
@@ -10011,7 +10184,7 @@ const entriesOf$2 = (manifest) => {
|
|
|
10011
10184
|
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
10012
10185
|
const files = yield* RepositoryFiles;
|
|
10013
10186
|
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
|
|
10014
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10187
|
+
return pipe(text, Option.flatMap(decodeManifest$9), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
|
|
10015
10188
|
});
|
|
10016
10189
|
const isCommand$1 = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
|
|
10017
10190
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
@@ -10023,7 +10196,7 @@ const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
|
10023
10196
|
const files = yield* RepositoryFiles;
|
|
10024
10197
|
const listed = yield* files.listedFiles(root);
|
|
10025
10198
|
const workflows = pipe(listed, Array.filter(String$1.startsWith(WORKFLOW_DIRECTORY$1)));
|
|
10026
|
-
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$
|
|
10199
|
+
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$21 });
|
|
10027
10200
|
return pipe(Array.getSomes(texts), Array.join("\n"));
|
|
10028
10201
|
});
|
|
10029
10202
|
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$13));
|
|
@@ -10034,7 +10207,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.fi
|
|
|
10034
10207
|
message: `A task runs ${path}. Put each file that a task runs at ${BIN}/<name>.ts, the one place where every workspace keeps its commands, so that fallow and the other tools find it without a list of files.`
|
|
10035
10208
|
})));
|
|
10036
10209
|
const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
|
|
10037
|
-
const problemsIn$
|
|
10210
|
+
const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
|
|
10038
10211
|
const files = yield* RepositoryFiles;
|
|
10039
10212
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10040
10213
|
const entries = yield* declaredEntries(root, directory);
|
|
@@ -10050,8 +10223,8 @@ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, directo
|
|
|
10050
10223
|
const isRun = (path) => Array.contains(runPaths, path) || Array.contains(entries.bins, path) || String$1.includes(workspacePath(directory, path))(workflows);
|
|
10051
10224
|
const unrun = pipe(commands, Array.filter((path) => !isRun(path)), Array.map((path) => ({
|
|
10052
10225
|
file: files.join(root, directory, path),
|
|
10053
|
-
line: FIRST$
|
|
10054
|
-
column: FIRST$
|
|
10226
|
+
line: FIRST$13,
|
|
10227
|
+
column: FIRST$13,
|
|
10055
10228
|
rule: UNRUN,
|
|
10056
10229
|
message: `No task, package.json bin or workflow runs ${workspacePath(directory, path)}. Files in ${BIN}/ are entry points for fallow, so an unused one is never reported. Run it from a task or delete it.`
|
|
10057
10230
|
})));
|
|
@@ -10063,8 +10236,8 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
10063
10236
|
const isDirectory = yield* files.isDirectory(file);
|
|
10064
10237
|
return pipe(isDirectory, Option.filter(Boolean), Option.map(() => ({
|
|
10065
10238
|
file,
|
|
10066
|
-
line: FIRST$
|
|
10067
|
-
column: FIRST$
|
|
10239
|
+
line: FIRST$13,
|
|
10240
|
+
column: FIRST$13,
|
|
10068
10241
|
rule: SCRIPTS,
|
|
10069
10242
|
message: `${workspacePath(directory, SCRIPTS_DIRECTORY)} is a scripts directory. Put each command at ${BIN}/<name>.ts and the code that it shares in the package's own source, so that every workspace runs its commands the same way.`
|
|
10070
10243
|
})));
|
|
@@ -10073,34 +10246,34 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
10073
10246
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
10074
10247
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
10075
10248
|
const workflows = yield* workflowText(root);
|
|
10076
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$
|
|
10077
|
-
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10249
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$18(root, directory, workflows), { concurrency: READ_CONCURRENCY$21 });
|
|
10250
|
+
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$21 });
|
|
10078
10251
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
10079
10252
|
});
|
|
10080
10253
|
// src/features/check-repository-layout/model/crates.ts
|
|
10081
|
-
const RULE$
|
|
10254
|
+
const RULE$45 = "unverified-crate";
|
|
10082
10255
|
const VERSION_RULE = "release-version";
|
|
10083
10256
|
const MANIFEST_FILE$1 = "package.json";
|
|
10084
10257
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
10085
10258
|
const CARGO_FILE$1 = "Cargo.toml";
|
|
10086
10259
|
const CONFIG_FILE$6 = "vite.config.ts";
|
|
10087
10260
|
const SEPARATOR$12 = "/";
|
|
10088
|
-
const FIRST$
|
|
10089
|
-
const READ_CONCURRENCY$
|
|
10261
|
+
const FIRST$12 = 1;
|
|
10262
|
+
const READ_CONCURRENCY$20 = 8;
|
|
10090
10263
|
const PackageVersion = Schema.fromJsonString(Schema.Struct({ version: Schema.String }));
|
|
10091
|
-
const problemFor$
|
|
10264
|
+
const problemFor$4 = (crate, message) => ({
|
|
10092
10265
|
file: crate.manifest,
|
|
10093
|
-
line: FIRST$
|
|
10094
|
-
column: FIRST$
|
|
10095
|
-
rule: RULE$
|
|
10266
|
+
line: FIRST$12,
|
|
10267
|
+
column: FIRST$12,
|
|
10268
|
+
rule: RULE$45,
|
|
10096
10269
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
10097
10270
|
});
|
|
10098
10271
|
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
10099
10272
|
const files = yield* RepositoryFiles;
|
|
10100
10273
|
const workspace = owningWorkspace(directories)(files.relative(root, files.dirname(crate.manifest)));
|
|
10101
|
-
if (Option.isNone(workspace)) return Option.some(problemFor$
|
|
10274
|
+
if (Option.isNone(workspace)) return Option.some(problemFor$4(crate, "is outside every workspace package"));
|
|
10102
10275
|
if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$6))) return Option.none();
|
|
10103
|
-
return Option.some(problemFor$
|
|
10276
|
+
return Option.some(problemFor$4(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$6} has no verify task`));
|
|
10104
10277
|
});
|
|
10105
10278
|
const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemIn(root, directories, crate) {
|
|
10106
10279
|
const files = yield* RepositoryFiles;
|
|
@@ -10112,8 +10285,8 @@ const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemI
|
|
|
10112
10285
|
if (Option.isNone(version) || version.value === crate.version) return Option.none();
|
|
10113
10286
|
return Option.some({
|
|
10114
10287
|
file: crate.manifest,
|
|
10115
|
-
line: FIRST$
|
|
10116
|
-
column: FIRST$
|
|
10288
|
+
line: FIRST$12,
|
|
10289
|
+
column: FIRST$12,
|
|
10117
10290
|
rule: VERSION_RULE,
|
|
10118
10291
|
message: `crate ${crate.name} is version ${crate.version} but ${workspace.value}/${MANIFEST_FILE$1} is ${version.value}. msch-publish releases the version in package.json, so bump both in the same PR.`
|
|
10119
10292
|
});
|
|
@@ -10124,11 +10297,11 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
10124
10297
|
if (!(yield* files.exists(files.join(root, CARGO_FILE$1)))) return [];
|
|
10125
10298
|
const directories = yield* workspaceDirectories(root);
|
|
10126
10299
|
const crates = yield* cratesIn(root);
|
|
10127
|
-
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$3(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$
|
|
10300
|
+
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$3(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$20 });
|
|
10128
10301
|
return Array.getSomes(Array.flatten(found));
|
|
10129
10302
|
});
|
|
10130
10303
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
10131
|
-
const RULE$
|
|
10304
|
+
const RULE$44 = "deploy-entry-pattern";
|
|
10132
10305
|
const FALLOW_KEYS = [
|
|
10133
10306
|
"entry",
|
|
10134
10307
|
"entryPoints",
|
|
@@ -10146,7 +10319,7 @@ const NEGATED = "!";
|
|
|
10146
10319
|
const ROOT_WORKSPACE = ".";
|
|
10147
10320
|
const WRAP_OFFSET$1 = 1;
|
|
10148
10321
|
const NO_OFFSET = 0;
|
|
10149
|
-
const READ_CONCURRENCY$
|
|
10322
|
+
const READ_CONCURRENCY$19 = 8;
|
|
10150
10323
|
const MESSAGE$11 = "selects deploy entries by their name or location. A deploy entry is the file that an Alchemy resource names in main, and its name and place change with the code. Use workspaceSettings().lint.deployEntries in lint settings; fallow reads main from the stack by itself.";
|
|
10151
10324
|
const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
|
|
10152
10325
|
const FALLOW = {
|
|
@@ -10183,7 +10356,7 @@ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind
|
|
|
10183
10356
|
const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
|
|
10184
10357
|
return pipe(patternsIn(kind.keys)(parsed.program), Array.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
|
|
10185
10358
|
});
|
|
10186
|
-
const problemsIn$
|
|
10359
|
+
const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
10187
10360
|
const { root, file, kind, workspaces, entries } = request;
|
|
10188
10361
|
const files = yield* RepositoryFiles;
|
|
10189
10362
|
const path = files.join(root, file);
|
|
@@ -10199,7 +10372,7 @@ const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
10199
10372
|
return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
|
|
10200
10373
|
file: path,
|
|
10201
10374
|
...positionOf(text.value)(start - kind.offset),
|
|
10202
|
-
rule: RULE$
|
|
10375
|
+
rule: RULE$44,
|
|
10203
10376
|
message: `${pattern} ${MESSAGE$11}`
|
|
10204
10377
|
})));
|
|
10205
10378
|
});
|
|
@@ -10222,17 +10395,17 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10222
10395
|
}];
|
|
10223
10396
|
return [];
|
|
10224
10397
|
}));
|
|
10225
|
-
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$
|
|
10398
|
+
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$17({
|
|
10226
10399
|
root,
|
|
10227
10400
|
file,
|
|
10228
10401
|
kind,
|
|
10229
10402
|
workspaces,
|
|
10230
10403
|
entries
|
|
10231
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
10404
|
+
}), { concurrency: READ_CONCURRENCY$19 });
|
|
10232
10405
|
return Array.flatten(found);
|
|
10233
10406
|
});
|
|
10234
10407
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
10235
|
-
const RULE$
|
|
10408
|
+
const RULE$43 = "listed-entry";
|
|
10236
10409
|
const ENTRY_KEYS = [
|
|
10237
10410
|
"entry",
|
|
10238
10411
|
"entryPoints",
|
|
@@ -10242,7 +10415,7 @@ const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?
|
|
|
10242
10415
|
const WILDCARD$3 = /[*?{[]/u;
|
|
10243
10416
|
const SEPARATOR$11 = "/";
|
|
10244
10417
|
const WRAP_OFFSET = 1;
|
|
10245
|
-
const READ_CONCURRENCY$
|
|
10418
|
+
const READ_CONCURRENCY$18 = 8;
|
|
10246
10419
|
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
10247
10420
|
const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array.contains(ENTRY_KEYS, keyName(key))));
|
|
10248
10421
|
const entryPatternsIn = (node) => {
|
|
@@ -10253,7 +10426,7 @@ const entryPatternsIn = (node) => {
|
|
|
10253
10426
|
return pipe(childrenOf$1(node), Array.flatMap(entryPatternsIn));
|
|
10254
10427
|
};
|
|
10255
10428
|
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$11}`)(text))) || String$1.includes(SEPARATOR$11)(text) && !WILDCARD$3.test(text);
|
|
10256
|
-
const problemsIn$
|
|
10429
|
+
const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
10257
10430
|
const files = yield* RepositoryFiles;
|
|
10258
10431
|
const path = files.join(root, file);
|
|
10259
10432
|
const text = yield* files.readFile(path);
|
|
@@ -10262,7 +10435,7 @@ const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10262
10435
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
10263
10436
|
file: path,
|
|
10264
10437
|
...positionOf(text.value)(start),
|
|
10265
|
-
rule: RULE$
|
|
10438
|
+
rule: RULE$43,
|
|
10266
10439
|
message: `${pattern} names files one by one. Let fallow find the file through what declares it: package.json bin and exports, a tool's config file, or the main of the Alchemy resource that deploys it.`
|
|
10267
10440
|
})));
|
|
10268
10441
|
});
|
|
@@ -10270,15 +10443,15 @@ const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10270
10443
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
10271
10444
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10272
10445
|
const directories = yield* workspaceDirectories(root);
|
|
10273
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$
|
|
10446
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$16(root, file, directories), { concurrency: READ_CONCURRENCY$18 });
|
|
10274
10447
|
return Array.flatten(found);
|
|
10275
10448
|
});
|
|
10276
10449
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
10277
|
-
const RULE$
|
|
10450
|
+
const RULE$42 = "root-workspace-path";
|
|
10278
10451
|
const CONFIG_FILE$5 = "vite.config.ts";
|
|
10279
10452
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
10280
10453
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
10281
|
-
const FIRST$
|
|
10454
|
+
const FIRST$11 = 0;
|
|
10282
10455
|
const NEXT$2 = 1;
|
|
10283
10456
|
const isBoundary = (character, allowed) => character === "" || !allowed.test(character);
|
|
10284
10457
|
const mentions = (directory) => (text) => {
|
|
@@ -10286,14 +10459,14 @@ const mentions = (directory) => (text) => {
|
|
|
10286
10459
|
return pipe(Array.drop(parts, NEXT$2), Array.some((after, index) => {
|
|
10287
10460
|
const before = parts[index] ?? "";
|
|
10288
10461
|
const previous = String$1.slice(before.length - NEXT$2)(before);
|
|
10289
|
-
const following = String$1.slice(FIRST$
|
|
10462
|
+
const following = String$1.slice(FIRST$11, NEXT$2)(after);
|
|
10290
10463
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
10291
10464
|
}));
|
|
10292
10465
|
};
|
|
10293
|
-
const problemsIn$
|
|
10466
|
+
const problemsIn$15 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
10294
10467
|
file,
|
|
10295
10468
|
...positionOf(source)(found.start),
|
|
10296
|
-
rule: RULE$
|
|
10469
|
+
rule: RULE$42,
|
|
10297
10470
|
message: `${directory} is a workspace. The root ${CONFIG_FILE$5} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$5}: msch.lint, msch.devDependencies or its verify task.`
|
|
10298
10471
|
})));
|
|
10299
10472
|
/** @internal */
|
|
@@ -10304,13 +10477,13 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
10304
10477
|
if (Option.isNone(source)) return [];
|
|
10305
10478
|
const directories = yield* workspaceDirectories(root);
|
|
10306
10479
|
const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
|
|
10307
|
-
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$
|
|
10480
|
+
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$15(file, source.value, directories)));
|
|
10308
10481
|
});
|
|
10309
10482
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
10310
|
-
const RULE$
|
|
10483
|
+
const RULE$41 = "hidden-verify";
|
|
10311
10484
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
10312
|
-
const FIRST$
|
|
10313
|
-
const READ_CONCURRENCY$
|
|
10485
|
+
const FIRST$10 = 1;
|
|
10486
|
+
const READ_CONCURRENCY$17 = 8;
|
|
10314
10487
|
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
10315
10488
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10316
10489
|
if (Option.isNone(config)) return Option.none();
|
|
@@ -10319,21 +10492,21 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
10319
10492
|
const verified = yield* hasVerifyTask(file);
|
|
10320
10493
|
return Option.some({
|
|
10321
10494
|
file,
|
|
10322
|
-
line: FIRST$
|
|
10323
|
-
column: FIRST$
|
|
10324
|
-
rule: RULE$
|
|
10495
|
+
line: FIRST$10,
|
|
10496
|
+
column: FIRST$10,
|
|
10497
|
+
rule: RULE$41,
|
|
10325
10498
|
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$4}. The root verify reads ${CONFIG_FILE$4} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE$4}.`
|
|
10326
10499
|
}).pipe(Option.filter(() => verified));
|
|
10327
10500
|
});
|
|
10328
10501
|
/** @internal */
|
|
10329
10502
|
const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
|
|
10330
10503
|
const directories = yield* workspaceDirectories(root);
|
|
10331
|
-
const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10504
|
+
const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$17 });
|
|
10332
10505
|
return Array.getSomes(found);
|
|
10333
10506
|
});
|
|
10334
10507
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
10335
|
-
const RULE$
|
|
10336
|
-
const READ_CONCURRENCY$
|
|
10508
|
+
const RULE$40 = "shared-uncached-task";
|
|
10509
|
+
const READ_CONCURRENCY$16 = 8;
|
|
10337
10510
|
const SHARED = 2;
|
|
10338
10511
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
10339
10512
|
const UncachedTask = Schema.Struct({
|
|
@@ -10375,19 +10548,19 @@ const problemsOf$3 = (definitions) => {
|
|
|
10375
10548
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
10376
10549
|
file,
|
|
10377
10550
|
...position,
|
|
10378
|
-
rule: RULE$
|
|
10551
|
+
rule: RULE$40,
|
|
10379
10552
|
message: `The uncached task ${name} (${command}) is written the same way in ${Array.join(directories, ", ")}. Write it once in a shared helper and spread it into each run.tasks, so that a change to it reaches every workspace.`
|
|
10380
10553
|
})));
|
|
10381
10554
|
};
|
|
10382
10555
|
/** @internal */
|
|
10383
10556
|
const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function* checkSharedUncachedTasks(root) {
|
|
10384
10557
|
const directories = yield* workspaceDirectories(root);
|
|
10385
|
-
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10558
|
+
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$16 });
|
|
10386
10559
|
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$3));
|
|
10387
10560
|
});
|
|
10388
10561
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
10389
|
-
const RULE$
|
|
10390
|
-
const READ_CONCURRENCY$
|
|
10562
|
+
const RULE$39 = "unlocked-task";
|
|
10563
|
+
const READ_CONCURRENCY$15 = 8;
|
|
10391
10564
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
10392
10565
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
10393
10566
|
const commandOf = (task) => pipe(propertyValue("command")(task.value), Option.getOrElse(() => task.value), literalOf, Option.flatMap(decodeCommand), Option.flatMap((command) => Array.findFirst(Array.ensure(command), (line) => READS_DEPENDENCIES.test(line))));
|
|
@@ -10398,13 +10571,13 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
10398
10571
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array.filter(tracksLockfiles), Array.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
10399
10572
|
file,
|
|
10400
10573
|
...positionOf(source)(task.start),
|
|
10401
|
-
rule: RULE$
|
|
10574
|
+
rule: RULE$39,
|
|
10402
10575
|
message: `The task ${keyName(task.key)} runs ${command} with inputs written by hand. It then reruns after every lockfile change, and it does not rerun when a dependency of a dependency moves. Set cache to LOCKED from @r_masseater/msch/locked-inputs.`
|
|
10403
10576
|
})), Option.toArray)));
|
|
10404
10577
|
/** @internal */
|
|
10405
10578
|
const checkUnlockedTasks = Effect.fn("checkUnlockedTasks")(function* checkUnlockedTasks(root) {
|
|
10406
10579
|
const directories = yield* workspaceDirectories(root);
|
|
10407
|
-
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10580
|
+
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$15 });
|
|
10408
10581
|
return pipe(Array.getSomes(found), Array.flatMap(problemsOf$2));
|
|
10409
10582
|
});
|
|
10410
10583
|
// src/features/check-repository-layout/model/task-checks.ts
|
|
@@ -10503,11 +10676,11 @@ const scriptsIn = (field, base) => ({ text, offset }) => pipe(String$1.split(tex
|
|
|
10503
10676
|
offset
|
|
10504
10677
|
})));
|
|
10505
10678
|
const isFileInput = ([key]) => String$1.endsWith(FILE_INPUT_SUFFIX)(key) || key === DEPENDENCY_PATH_INPUT;
|
|
10506
|
-
const linesOf = ({ text, offset }) => pipe(String$1.split(text, LINE$1), Array.map((line) => ({
|
|
10679
|
+
const linesOf$1 = ({ text, offset }) => pipe(String$1.split(text, LINE$1), Array.map((line) => ({
|
|
10507
10680
|
text: line,
|
|
10508
10681
|
offset
|
|
10509
10682
|
})));
|
|
10510
|
-
const fileInputOf = (field) => ([key, value]) => pipe(stringOf(value), Option.toArray, Array.flatMap(linesOf), Array.flatMap(reference("glob", `${field}.with.${key}`)));
|
|
10683
|
+
const fileInputOf = (field) => ([key, value]) => pipe(stringOf(value), Option.toArray, Array.flatMap(linesOf$1), Array.flatMap(reference("glob", `${field}.with.${key}`)));
|
|
10511
10684
|
const fileInputsIn = (field, step) => pipe(entriesOf$1(childOf("with")(step)), Array.filter(isFileInput), Array.flatMap(fileInputOf(field)));
|
|
10512
10685
|
const stepReferences = (job, base) => (step, index) => {
|
|
10513
10686
|
const field = `jobs.${job}.steps[${index}]`;
|
|
@@ -10549,17 +10722,17 @@ const workflowReferences = (source) => {
|
|
|
10549
10722
|
];
|
|
10550
10723
|
};
|
|
10551
10724
|
const pathInputOf = (step) => childOf("path")(childOf("with")(step));
|
|
10552
|
-
const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray, Array.flatMap(linesOf), Array.map(({ text }) => joinPath(ROOT$2, text)), Array.filter(isLiteralPath));
|
|
10725
|
+
const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray, Array.flatMap(linesOf$1), Array.map(({ text }) => joinPath(ROOT$2, text)), Array.filter(isLiteralPath));
|
|
10553
10726
|
/** @internal */
|
|
10554
10727
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
10555
10728
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
10556
|
-
const RULE$
|
|
10729
|
+
const RULE$38 = "workflow-path";
|
|
10557
10730
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
10558
10731
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
10559
|
-
const READ_CONCURRENCY$
|
|
10732
|
+
const READ_CONCURRENCY$14 = 8;
|
|
10560
10733
|
const WILDCARD$2 = /[*?[]/u;
|
|
10561
10734
|
const SEPARATOR$9 = "/";
|
|
10562
|
-
const FIRST$
|
|
10735
|
+
const FIRST$9 = 0;
|
|
10563
10736
|
const EXPECTED = {
|
|
10564
10737
|
action: "a directory with action.yml",
|
|
10565
10738
|
directory: "a directory",
|
|
@@ -10600,7 +10773,7 @@ const RESOLVERS = {
|
|
|
10600
10773
|
};
|
|
10601
10774
|
const staticPrefix = (path) => {
|
|
10602
10775
|
const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD$2));
|
|
10603
|
-
if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$
|
|
10776
|
+
if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$9, -1)(prefix);
|
|
10604
10777
|
return prefix;
|
|
10605
10778
|
};
|
|
10606
10779
|
const isIgnored = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
@@ -10619,10 +10792,10 @@ const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, f
|
|
|
10619
10792
|
const problemOf$8 = (file, source) => (found) => ({
|
|
10620
10793
|
file,
|
|
10621
10794
|
...positionOf(source)(found.offset),
|
|
10622
|
-
rule: RULE$
|
|
10795
|
+
rule: RULE$38,
|
|
10623
10796
|
message: `${found.field} names ${found.path}, which is not ${EXPECTED[found.kind]} in this repository. Point it at a path that exists or remove it.`
|
|
10624
10797
|
});
|
|
10625
|
-
const problemsIn$
|
|
10798
|
+
const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
10626
10799
|
const files = yield* RepositoryFiles;
|
|
10627
10800
|
const file = files.join(root, workflow);
|
|
10628
10801
|
const source = yield* files.readFile(file);
|
|
@@ -10634,7 +10807,7 @@ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(root, workflo
|
|
|
10634
10807
|
/** @internal */
|
|
10635
10808
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
10636
10809
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10637
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$
|
|
10810
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$14(root, workflow), { concurrency: READ_CONCURRENCY$14 });
|
|
10638
10811
|
return Array.flatten(found);
|
|
10639
10812
|
});
|
|
10640
10813
|
// src/features/check-repository-layout/model/workflow-scale.ts
|
|
@@ -10645,15 +10818,15 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
|
|
|
10645
10818
|
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
10646
10819
|
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
10647
10820
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
10648
|
-
const START$
|
|
10649
|
-
const READ_CONCURRENCY$
|
|
10821
|
+
const START$22 = 0;
|
|
10822
|
+
const READ_CONCURRENCY$13 = 8;
|
|
10650
10823
|
const SEPARATOR$8 = "/";
|
|
10651
10824
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
10652
10825
|
const SPACE = " ";
|
|
10653
10826
|
const FILTER_MESSAGE = "A workflow that reacts to changes under listed paths needs a new entry for every package and drifts from the packages it is meant to cover. Run the generic pipeline on every push and let it decide from the workspace what changed.";
|
|
10654
10827
|
const packageMessage = (what, directory) => `${what} names the workspace ${directory}. A workflow or job made for one package does not scale: give the package a vp task and let the generic pipeline (verify, deploy, release, daily, task) find it.`;
|
|
10655
10828
|
const keysOf$1 = (node) => pipe(Option.liftPredicate(node, isMap), Option.map((map) => map.items), Option.getOrElse(() => []), Array.filter(isPair), Array.flatMap(({ key }) => Option.toArray(stringOf(key))));
|
|
10656
|
-
const problemAt$
|
|
10829
|
+
const problemAt$6 = ({ file, source }, rule, message) => (offset) => ({
|
|
10657
10830
|
file,
|
|
10658
10831
|
...positionOf(source)(offset),
|
|
10659
10832
|
rule,
|
|
@@ -10663,7 +10836,7 @@ const pathFiltersIn = (file, source) => {
|
|
|
10663
10836
|
const root = parseDocument(source).contents;
|
|
10664
10837
|
const triggers = pipe(entriesOf$1(childOf("on")(root)), Array.flatMap(([, trigger]) => keysOf$1(trigger)), Array.filter(({ text }) => Array.contains(FILTER_KEYS, text)));
|
|
10665
10838
|
const actions = pipe(scalarsIn(source), Array.filter(({ text }) => PATHS_FILTER_ACTION.test(text)));
|
|
10666
|
-
return pipe([...triggers, ...actions], Array.map(({ offset }) => problemAt$
|
|
10839
|
+
return pipe([...triggers, ...actions], Array.map(({ offset }) => problemAt$6({
|
|
10667
10840
|
file,
|
|
10668
10841
|
source
|
|
10669
10842
|
}, PATH_FILTER, FILTER_MESSAGE)(offset)));
|
|
@@ -10676,7 +10849,7 @@ const namesIn$1 = (name, source) => {
|
|
|
10676
10849
|
return [
|
|
10677
10850
|
{
|
|
10678
10851
|
text: name,
|
|
10679
|
-
offset: START$
|
|
10852
|
+
offset: START$22
|
|
10680
10853
|
},
|
|
10681
10854
|
...Option.toArray(stringOf(childOf("name")(root))),
|
|
10682
10855
|
...keysOf$1(childOf("jobs")(root))
|
|
@@ -10686,7 +10859,7 @@ const filtersIn = (source) => pipe(scalarsIn(source), Array.flatMap(({ text, off
|
|
|
10686
10859
|
text: value,
|
|
10687
10860
|
offset
|
|
10688
10861
|
})))));
|
|
10689
|
-
const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$
|
|
10862
|
+
const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$6(where, PACKAGE, packageMessage(what, directory))(offset)), Option.toArray);
|
|
10690
10863
|
const packagesIn = (workspaces, { file, name, source }) => {
|
|
10691
10864
|
const where = {
|
|
10692
10865
|
file,
|
|
@@ -10726,7 +10899,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
|
|
|
10726
10899
|
name: stem,
|
|
10727
10900
|
source: text
|
|
10728
10901
|
})]), Option.getOrElse(() => []));
|
|
10729
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
10902
|
+
}), { concurrency: READ_CONCURRENCY$13 });
|
|
10730
10903
|
const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf$1(ACTION, name), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
|
|
10731
10904
|
return [...Array.flatten(found), ...actions];
|
|
10732
10905
|
});
|
|
@@ -10745,27 +10918,28 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
|
|
|
10745
10918
|
], { concurrency: "unbounded" });
|
|
10746
10919
|
return Array.flatten(found);
|
|
10747
10920
|
});
|
|
10921
|
+
// src/shared/lib/package-name.ts
|
|
10922
|
+
const SCOPE$2 = "@";
|
|
10923
|
+
const SEPARATOR$7 = "/";
|
|
10924
|
+
const SCOPED_SEGMENTS = 2;
|
|
10925
|
+
const PLAIN_SEGMENTS = 1;
|
|
10926
|
+
const segmentCount = (specifier) => {
|
|
10927
|
+
if (String$1.startsWith(SCOPE$2)(specifier)) return SCOPED_SEGMENTS;
|
|
10928
|
+
return PLAIN_SEGMENTS;
|
|
10929
|
+
};
|
|
10930
|
+
const packageNameOf = (specifier) => pipe(String$1.split(specifier, SEPARATOR$7), Array.take(segmentCount(specifier)), Array.join(SEPARATOR$7));
|
|
10748
10931
|
// src/features/measure-install-size/model/import-graph.ts
|
|
10749
10932
|
const RELATIVE = /^\.\.?(?:\/|$)/u;
|
|
10750
|
-
const SUBPATH_IMPORT = "#";
|
|
10933
|
+
const SUBPATH_IMPORT$1 = "#";
|
|
10751
10934
|
const WILDCARD$1 = "*";
|
|
10752
|
-
const SCOPE$2 = "@";
|
|
10753
|
-
const SEPARATOR$7 = "/";
|
|
10754
10935
|
const SOURCE_SUFFIXES = [
|
|
10755
10936
|
"",
|
|
10756
10937
|
".ts",
|
|
10757
10938
|
".tsx",
|
|
10758
10939
|
"/index.ts"
|
|
10759
10940
|
];
|
|
10760
|
-
const SCOPED_SEGMENTS = 2;
|
|
10761
|
-
const PLAIN_SEGMENTS = 1;
|
|
10762
10941
|
const ImportsField = Schema.Struct({ imports: Schema.optional(Schema.Record(Schema.String, Schema.String)) });
|
|
10763
10942
|
const decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));
|
|
10764
|
-
const packageNameOf = (specifier) => {
|
|
10765
|
-
const segments = String$1.split(specifier, SEPARATOR$7);
|
|
10766
|
-
if (String$1.startsWith(SCOPE$2)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$7));
|
|
10767
|
-
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$7));
|
|
10768
|
-
};
|
|
10769
10943
|
const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
|
|
10770
10944
|
const runtimeSpecifierOf = (statement) => {
|
|
10771
10945
|
if (isImportDeclaration(statement)) {
|
|
@@ -10802,7 +10976,7 @@ const localFile = Effect.fn("localFile")(function* localFile({ directory, import
|
|
|
10802
10976
|
return yield* existingSource(files.resolve(directory, target.value));
|
|
10803
10977
|
});
|
|
10804
10978
|
const referenceOf$2 = (graph, from, specifier) => {
|
|
10805
|
-
if (RELATIVE.test(specifier) || String$1.startsWith(SUBPATH_IMPORT)(specifier)) return localFile(graph, from, specifier).pipe(Effect.map(Option.map(Result.succeed)));
|
|
10979
|
+
if (RELATIVE.test(specifier) || String$1.startsWith(SUBPATH_IMPORT$1)(specifier)) return localFile(graph, from, specifier).pipe(Effect.map(Option.map(Result.succeed)));
|
|
10806
10980
|
const name = packageNameOf(specifier);
|
|
10807
10981
|
return Effect.succeedSome(Result.fail(name));
|
|
10808
10982
|
};
|
|
@@ -10859,7 +11033,7 @@ const InstalledManifest = Schema.Struct({
|
|
|
10859
11033
|
peerDependencies: DependencyMap,
|
|
10860
11034
|
peerDependenciesMeta: PeerMeta
|
|
10861
11035
|
});
|
|
10862
|
-
const decodeManifest$
|
|
11036
|
+
const decodeManifest$8 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
10863
11037
|
const keysOf = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
10864
11038
|
const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
|
|
10865
11039
|
const installedNames = (manifest) => [
|
|
@@ -10870,7 +11044,7 @@ const installedNames = (manifest) => [
|
|
|
10870
11044
|
const childrenOf = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
10871
11045
|
const files = yield* RepositoryFiles;
|
|
10872
11046
|
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
|
|
10873
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
11047
|
+
return pipe(text, Option.flatMap(decodeManifest$8), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
|
|
10874
11048
|
});
|
|
10875
11049
|
const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
|
|
10876
11050
|
const files = yield* RepositoryFiles;
|
|
@@ -10927,30 +11101,30 @@ const INSTALL_SIZE = "install-size";
|
|
|
10927
11101
|
const STACK_DEPENDENCY = "stack-dependency";
|
|
10928
11102
|
const STACK_CATALOG = "catalog:stack";
|
|
10929
11103
|
const BUDGET_KEY = "installSize";
|
|
10930
|
-
const DEPENDENCIES_KEY = "\"dependencies\"";
|
|
11104
|
+
const DEPENDENCIES_KEY$1 = "\"dependencies\"";
|
|
10931
11105
|
const LISTED_LARGEST = 5;
|
|
10932
11106
|
const SIZE_CONCURRENCY = 32;
|
|
10933
11107
|
const MEGABYTE = 1e6;
|
|
10934
11108
|
const MEGABYTE_DIGITS = 1;
|
|
10935
|
-
const START$
|
|
11109
|
+
const START$21 = 0;
|
|
10936
11110
|
const SINGLE_ENTRY = 1;
|
|
10937
11111
|
const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
|
|
10938
11112
|
const usageHint = (dependency, entryCount) => {
|
|
10939
|
-
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$
|
|
11113
|
+
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$21 && dependency.entries.length < entryCount)) return "";
|
|
10940
11114
|
return ` (imported only from ${Array.join(dependency.entries, ", ")})`;
|
|
10941
11115
|
};
|
|
10942
|
-
const listed = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
|
|
11116
|
+
const listed$1 = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
|
|
10943
11117
|
const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun) {
|
|
10944
11118
|
const files = yield* RepositoryFiles;
|
|
10945
11119
|
const { workspace, total } = overrun;
|
|
10946
11120
|
const config = yield* files.readFile(workspace.configFile);
|
|
10947
11121
|
const source = Option.getOrElse(config, () => "");
|
|
10948
|
-
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$
|
|
11122
|
+
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$21);
|
|
10949
11123
|
return {
|
|
10950
11124
|
file: workspace.configFile,
|
|
10951
11125
|
...positionOf(source)(index),
|
|
10952
11126
|
rule: INSTALL_SIZE,
|
|
10953
|
-
message: `installing this package adds ${megabytes(total)} of dependencies besides its peers, over the ${workspace.installSize} in msch.publish.installSize. Largest: ${listed(overrun)}. Make a dependency imported only from some entries an optional peer, move one that the installing project already has to peerDependencies, or replace a heavy one. Raise installSize only when none of these applies.`
|
|
11127
|
+
message: `installing this package adds ${megabytes(total)} of dependencies besides its peers, over the ${workspace.installSize} in msch.publish.installSize. Largest: ${listed$1(overrun)}. Make a dependency imported only from some entries an optional peer, move one that the installing project already has to peerDependencies, or replace a heavy one. Raise installSize only when none of these applies.`
|
|
10954
11128
|
};
|
|
10955
11129
|
});
|
|
10956
11130
|
const measure = Effect.fn("measure")(function* measure({ workspace, provided }, direct) {
|
|
@@ -10962,7 +11136,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
|
|
|
10962
11136
|
const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
|
|
10963
11137
|
const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
|
|
10964
11138
|
const sizes = HashMap.fromIterable(measured);
|
|
10965
|
-
const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$
|
|
11139
|
+
const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$21)), Number$1.sumAll);
|
|
10966
11140
|
return {
|
|
10967
11141
|
closures,
|
|
10968
11142
|
sizeOf,
|
|
@@ -10995,11 +11169,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
|
|
|
10995
11169
|
})];
|
|
10996
11170
|
});
|
|
10997
11171
|
const stackProblems = (file, source, dependencies) => {
|
|
10998
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$
|
|
11172
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$21);
|
|
10999
11173
|
const rest = String$1.slice(section)(source);
|
|
11000
11174
|
return pipe(Record.toEntries(dependencies), Array.filter(([, specifier]) => specifier === STACK_CATALOG), Array.map(([name]) => ({
|
|
11001
11175
|
file,
|
|
11002
|
-
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
11176
|
+
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$21)),
|
|
11003
11177
|
rule: STACK_DEPENDENCY,
|
|
11004
11178
|
message: `${name} comes from the stack catalog, so every project that installs this package already has it. Move it to peerDependencies and keep it in devDependencies, so the installing project shares one copy.`
|
|
11005
11179
|
})));
|
|
@@ -11029,7 +11203,7 @@ const problemsOf$1 = Effect.fn("problemsOf")(function* problemsOf(workspace, fil
|
|
|
11029
11203
|
}, Record.keys(dependencies));
|
|
11030
11204
|
return [...stackProblems(file, source, dependencies), ...sized];
|
|
11031
11205
|
});
|
|
11032
|
-
const workspaceProblems = Effect.fn("workspaceProblems")(function* workspaceProblems(workspace) {
|
|
11206
|
+
const workspaceProblems$1 = Effect.fn("workspaceProblems")(function* workspaceProblems(workspace) {
|
|
11033
11207
|
const files = yield* RepositoryFiles;
|
|
11034
11208
|
const file = files.join(workspace.directory, MANIFEST_FILE$3);
|
|
11035
11209
|
const source = yield* files.readFile(file);
|
|
@@ -11041,11 +11215,359 @@ const workspaceProblems = Effect.fn("workspaceProblems")(function* workspaceProb
|
|
|
11041
11215
|
/** @internal */
|
|
11042
11216
|
const checkPublishedPackages = Effect.fn("checkPublishedPackages")(function* checkPublishedPackages(root) {
|
|
11043
11217
|
const workspaces = yield* publishedWorkspaces(root);
|
|
11044
|
-
const found = yield* Effect.forEach(workspaces, workspaceProblems, { concurrency: 1 });
|
|
11218
|
+
const found = yield* Effect.forEach(workspaces, workspaceProblems$1, { concurrency: 1 });
|
|
11219
|
+
return Array.flatten(found);
|
|
11220
|
+
});
|
|
11221
|
+
// src/shared/lib/bundle-error.ts
|
|
11222
|
+
const ERROR_LINE = /\[[A-Z_]+\]/u;
|
|
11223
|
+
const SHOWN_ERRORS = 3;
|
|
11224
|
+
const HEADER = "Build failed";
|
|
11225
|
+
const NO_DETAIL = "Run the bundle to see the error.";
|
|
11226
|
+
const linesOf = (error) => pipe(Option.liftPredicate(error, Predicate.isError), Option.map(({ message }) => message), Option.getOrElse(() => String(error)), stripVTControlCharacters, String$1.split("\n"), Array.map(String$1.trim), Array.filter(String$1.isNonEmpty));
|
|
11227
|
+
const bundleErrorDetail = (error) => {
|
|
11228
|
+
const lines = linesOf(error);
|
|
11229
|
+
return pipe(lines, Array.filter((line) => ERROR_LINE.test(line)), Array.take(SHOWN_ERRORS), Array.match({
|
|
11230
|
+
onEmpty: () => pipe(lines, Array.findFirst((line) => !String$1.startsWith(HEADER)(line)), Option.getOrElse(() => NO_DETAIL)),
|
|
11231
|
+
onNonEmpty: Array.join(" ")
|
|
11232
|
+
}));
|
|
11233
|
+
};
|
|
11234
|
+
// src/features/check-tree-shaking/model/consumer-bundle.ts
|
|
11235
|
+
const VIRTUAL_PREFIX = "\0";
|
|
11236
|
+
const VIRTUAL = `${VIRTUAL_PREFIX}tree-shaking-consumer`;
|
|
11237
|
+
const VIRTUAL_ID = /^\0tree-shaking-consumer$/u;
|
|
11238
|
+
const ABSOLUTE = /^(?:[A-Za-z]:)?[\\/]/u;
|
|
11239
|
+
const NODE_PROTOCOL = "node:";
|
|
11240
|
+
const SUBPATH_IMPORT = "#";
|
|
11241
|
+
const RELATIVE_PREFIX = ".";
|
|
11242
|
+
const NAMESPACE = "namespace";
|
|
11243
|
+
const Quoted = Schema.fromJsonString(Schema.String);
|
|
11244
|
+
const quote = (text) => pipe(Schema.encodeOption(Quoted)(text), Option.getOrElse(() => text));
|
|
11245
|
+
const builtins = new Set(builtinModules);
|
|
11246
|
+
const always = () => true;
|
|
11247
|
+
const never = () => false;
|
|
11248
|
+
const taggedError$5 = Schema.TaggedError;
|
|
11249
|
+
var BundleFailed = class extends taggedError$5()("BundleFailed", { detail: Schema.String }) {};
|
|
11250
|
+
const failed = (error) => BundleFailed.make({ detail: bundleErrorDetail(error) });
|
|
11251
|
+
const isBare = (specifier) => !String$1.startsWith(RELATIVE_PREFIX)(specifier) && !String$1.startsWith(SUBPATH_IMPORT)(specifier) && !ABSOLUTE.test(specifier) && !String$1.startsWith(VIRTUAL_PREFIX)(specifier);
|
|
11252
|
+
const isBuiltin = (specifier) => String$1.startsWith(NODE_PROTOCOL)(specifier) || builtins.has(packageNameOf(specifier));
|
|
11253
|
+
const isExternal = ({ bundled }) => (specifier, importer) => Predicate.isNotUndefined(importer) && isBare(specifier) && !Array.contains(bundled, packageNameOf(specifier));
|
|
11254
|
+
const consumerSource = ({ entry, member }) => Option.match(member, {
|
|
11255
|
+
onNone: () => `export * from ${quote(entry)};\n`,
|
|
11256
|
+
onSome: (name) => `import * as ${NAMESPACE} from ${quote(entry)};\nglobalThis.used = ${NAMESPACE}[${quote(name)}];\n`
|
|
11257
|
+
});
|
|
11258
|
+
const baseOptions = (scope, effectful) => ({
|
|
11259
|
+
platform: "node",
|
|
11260
|
+
logLevel: "silent",
|
|
11261
|
+
external: isExternal(scope),
|
|
11262
|
+
treeshake: { moduleSideEffects: effectful }
|
|
11263
|
+
});
|
|
11264
|
+
const consumerPlugin = (consumer) => [{
|
|
11265
|
+
name: "tree-shaking-consumer",
|
|
11266
|
+
resolveId: {
|
|
11267
|
+
filter: { id: VIRTUAL_ID },
|
|
11268
|
+
handler: () => VIRTUAL
|
|
11269
|
+
},
|
|
11270
|
+
load: {
|
|
11271
|
+
filter: { id: VIRTUAL_ID },
|
|
11272
|
+
handler: () => consumerSource(consumer)
|
|
11273
|
+
}
|
|
11274
|
+
}];
|
|
11275
|
+
const optionsFor = (scope, input, effectful) => {
|
|
11276
|
+
const base = baseOptions(scope, effectful);
|
|
11277
|
+
if (input.kind === "program") return {
|
|
11278
|
+
...base,
|
|
11279
|
+
input: input.file
|
|
11280
|
+
};
|
|
11281
|
+
return {
|
|
11282
|
+
...base,
|
|
11283
|
+
input: VIRTUAL,
|
|
11284
|
+
plugins: consumerPlugin(input.consumer)
|
|
11285
|
+
};
|
|
11286
|
+
};
|
|
11287
|
+
const isChunk = (item) => item.type === "chunk";
|
|
11288
|
+
const keptBy = (chunks) => ({
|
|
11289
|
+
modules: pipe(chunks, Array.flatMap((chunk) => Record.keys(chunk.modules)), Array.filter((id) => !String$1.startsWith(VIRTUAL_PREFIX)(id)), Array.dedupe, Array.sortBy(Order.String)),
|
|
11290
|
+
packages: pipe(chunks, Array.flatMap((chunk) => [...chunk.imports, ...chunk.dynamicImports]), Array.filter((specifier) => isBare(specifier) && !isBuiltin(specifier)), Array.map(packageNameOf), Array.dedupe, Array.sortBy(Order.String))
|
|
11291
|
+
});
|
|
11292
|
+
const generate = (options) => Effect.acquireUseRelease(Effect.tryPromise({
|
|
11293
|
+
try: () => rolldown(options),
|
|
11294
|
+
catch: failed
|
|
11295
|
+
}), (bundle) => Effect.tryPromise({
|
|
11296
|
+
try: () => bundle.generate({ format: "esm" }),
|
|
11297
|
+
catch: failed
|
|
11298
|
+
}), (bundle) => Effect.promise(() => bundle.close())).pipe(Effect.map(({ output }) => pipe(output, Array.filter(isChunk))));
|
|
11299
|
+
const keptIn = Effect.fn("keptIn")(function* keptIn(scope, input, effectful) {
|
|
11300
|
+
const chunks = yield* generate(optionsFor(scope, input, effectful));
|
|
11301
|
+
return keptBy(chunks);
|
|
11302
|
+
});
|
|
11303
|
+
const exportNamesOf = Effect.fn("exportNamesOf")(function* exportNamesOf(scope, entry) {
|
|
11304
|
+
const chunks = yield* generate(optionsFor(scope, {
|
|
11305
|
+
kind: "program",
|
|
11306
|
+
file: entry
|
|
11307
|
+
}, always));
|
|
11308
|
+
return pipe(chunks, Array.flatMap((chunk) => chunk.exports), Array.dedupe);
|
|
11309
|
+
});
|
|
11310
|
+
// src/features/check-tree-shaking/model/manifest.ts
|
|
11311
|
+
const Manifest$5 = Schema.Struct({
|
|
11312
|
+
name: Schema.optional(Schema.String),
|
|
11313
|
+
exports: Schema.optional(Schema.Unknown),
|
|
11314
|
+
bin: Schema.optional(Schema.Unknown),
|
|
11315
|
+
sideEffects: Schema.optional(Schema.Unknown),
|
|
11316
|
+
dependencies: Schema.optional(Schema.Record(Schema.String, Schema.String))
|
|
11317
|
+
});
|
|
11318
|
+
const decode = Schema.decodeOption(Schema.fromJsonString(Manifest$5));
|
|
11319
|
+
const manifestOf$1 = (text) => decode(text);
|
|
11320
|
+
const dependencyNames = (manifest) => pipe(Option.fromUndefinedOr(manifest.dependencies), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
11321
|
+
const isFileList = Schema.is(Schema.Array(Schema.String));
|
|
11322
|
+
const sourcesOf$1 = (workspace, target) => pipe(workspace.packEntries, Array.filter((entry) => entry.name === entryNameOf(target)), Array.map((entry) => entry.source));
|
|
11323
|
+
const listedSources = (declared, { workspace, join }) => new Set(pipe(declared, Array.flatMap((target) => Array.append(sourcesOf$1(workspace, target), join(target)))));
|
|
11324
|
+
const declaredBy$1 = ({ declared, locator }) => {
|
|
11325
|
+
if (declared === false) return {
|
|
11326
|
+
effectful: never,
|
|
11327
|
+
entries: /* @__PURE__ */ new Set(),
|
|
11328
|
+
complete: true,
|
|
11329
|
+
claimed: true
|
|
11330
|
+
};
|
|
11331
|
+
if (!isFileList(declared)) return {
|
|
11332
|
+
effectful: always,
|
|
11333
|
+
entries: /* @__PURE__ */ new Set(),
|
|
11334
|
+
complete: false,
|
|
11335
|
+
claimed: false
|
|
11336
|
+
};
|
|
11337
|
+
const sources = listedSources(declared, locator);
|
|
11338
|
+
return {
|
|
11339
|
+
effectful: (id) => sources.has(id),
|
|
11340
|
+
entries: sources,
|
|
11341
|
+
complete: false,
|
|
11342
|
+
claimed: true
|
|
11343
|
+
};
|
|
11344
|
+
};
|
|
11345
|
+
// src/features/check-tree-shaking/model/optional-peers.ts
|
|
11346
|
+
const RULE$37 = "optional-peer";
|
|
11347
|
+
const START$20 = 0;
|
|
11348
|
+
const SINGLE = 1;
|
|
11349
|
+
const DEPENDENCIES_KEY = "\"dependencies\"";
|
|
11350
|
+
const importsPackage = (name) => ({ packages }) => Array.contains(packages, name);
|
|
11351
|
+
const labelsOf = (importers) => pipe(importers, Array.map(({ entry }) => `\`${entry.label}\``), Array.dedupe, Array.join(", "));
|
|
11352
|
+
const problemFor$3 = (located, name, importers) => {
|
|
11353
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(located.source), () => START$20);
|
|
11354
|
+
const rest = String$1.slice(section)(located.source);
|
|
11355
|
+
return {
|
|
11356
|
+
file: located.file,
|
|
11357
|
+
...positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$20)),
|
|
11358
|
+
rule: RULE$37,
|
|
11359
|
+
message: `${name} is imported only from ${labelsOf(importers)}, so installing the other entries must not require it. Move it to peerDependencies, mark it optional in peerDependenciesMeta and keep it in devDependencies.`
|
|
11360
|
+
};
|
|
11361
|
+
};
|
|
11362
|
+
const optionalPeerProblems = ({ located, dependencies, used }) => {
|
|
11363
|
+
const libraries = pipe(used, Array.filter(({ entry }) => !isBinEntry(entry)));
|
|
11364
|
+
const bins = pipe(used, Array.filter(({ entry }) => isBinEntry(entry)));
|
|
11365
|
+
if (libraries.length <= SINGLE) return [];
|
|
11366
|
+
return pipe(dependencies, Array.flatMap((name) => {
|
|
11367
|
+
const importers = pipe(libraries, Array.filter(importsPackage(name)));
|
|
11368
|
+
const neededByBin = pipe(bins, Array.some(importsPackage(name)));
|
|
11369
|
+
if (!(importers.length > START$20 && importers.length < libraries.length) || neededByBin) return [];
|
|
11370
|
+
return [problemFor$3(located, name, importers)];
|
|
11371
|
+
}));
|
|
11372
|
+
};
|
|
11373
|
+
// src/features/check-tree-shaking/model/side-effects.ts
|
|
11374
|
+
const RULE$36 = "side-effects";
|
|
11375
|
+
const BUNDLE_CONCURRENCY$2 = 4;
|
|
11376
|
+
const START$19 = 0;
|
|
11377
|
+
const FIRST$8 = 1;
|
|
11378
|
+
const LISTED_PACKAGES = 4;
|
|
11379
|
+
const SIDE_EFFECTS_KEY = "\"sideEffects\"";
|
|
11380
|
+
const EXPORTS_KEY = "\"exports\"";
|
|
11381
|
+
const beyond = (kept, ideal) => ({
|
|
11382
|
+
modules: Array.difference(kept.modules, ideal.modules).length,
|
|
11383
|
+
packages: Array.difference(kept.packages, ideal.packages)
|
|
11384
|
+
});
|
|
11385
|
+
const memberExcess = Effect.fn("memberExcess")(function* memberExcess({ scope, effectful, entry }, member) {
|
|
11386
|
+
const input = {
|
|
11387
|
+
kind: "consumer",
|
|
11388
|
+
consumer: {
|
|
11389
|
+
entry: entry.source,
|
|
11390
|
+
member: Option.some(member)
|
|
11391
|
+
}
|
|
11392
|
+
};
|
|
11393
|
+
const kept = yield* keptIn(scope, input, effectful);
|
|
11394
|
+
const ideal = yield* keptIn(scope, input, never);
|
|
11395
|
+
const extra = beyond(kept, ideal);
|
|
11396
|
+
return Option.liftPredicate({
|
|
11397
|
+
label: entry.label,
|
|
11398
|
+
member,
|
|
11399
|
+
...extra
|
|
11400
|
+
}, ({ modules }) => modules > START$19);
|
|
11401
|
+
});
|
|
11402
|
+
const excessOf = Effect.fn("excessOf")(function* excessOf(subject) {
|
|
11403
|
+
const names = yield* exportNamesOf(subject.scope, subject.entry.source);
|
|
11404
|
+
const found = yield* Effect.forEach(names, (name) => memberExcess(subject, name), { concurrency: BUNDLE_CONCURRENCY$2 });
|
|
11405
|
+
return Array.getSomes(found);
|
|
11406
|
+
});
|
|
11407
|
+
const listed = (names) => {
|
|
11408
|
+
const shown = pipe(names, Array.take(LISTED_PACKAGES), Array.join(", "));
|
|
11409
|
+
if (names.length > LISTED_PACKAGES) return `${shown} and more`;
|
|
11410
|
+
return shown;
|
|
11411
|
+
};
|
|
11412
|
+
const importsOf = (packages) => Array.match(packages, {
|
|
11413
|
+
onEmpty: () => "",
|
|
11414
|
+
onNonEmpty: (names) => ` and imports ${listed(names)}`
|
|
11415
|
+
});
|
|
11416
|
+
const othersOf = (total) => {
|
|
11417
|
+
if (total <= FIRST$8) return "";
|
|
11418
|
+
return ` The same happens for ${String(total - FIRST$8)} other exports.`;
|
|
11419
|
+
};
|
|
11420
|
+
const messageOf$4 = (worst, total) => `importing \`${worst.member}\` from \`${worst.label}\` also bundles ${String(worst.modules)} modules${importsOf(worst.packages)}, which it does not use.${othersOf(total)} Declare "sideEffects": false in package.json so that a bundler drops what nothing imports, and keep a module that must run for its effect out of the package.`;
|
|
11421
|
+
const largest = Order.mapInput(Order.flip(Order.Number), (excess) => excess.modules);
|
|
11422
|
+
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$19));
|
|
11423
|
+
const sideEffectProblems = ({ file, source, excesses }) => pipe(excesses, Array.sortBy(largest), Array.head, Option.map((worst) => ({
|
|
11424
|
+
file,
|
|
11425
|
+
...positionOf(source)(keyIndex$1(source)),
|
|
11426
|
+
rule: RULE$36,
|
|
11427
|
+
message: messageOf$4(worst, excesses.length)
|
|
11428
|
+
})), Option.toArray);
|
|
11429
|
+
// src/features/check-tree-shaking/model/top-level-effects.ts
|
|
11430
|
+
const RULE$35 = "top-level-effect";
|
|
11431
|
+
const CODE$1 = /\.[cm]?[jt]sx?$/u;
|
|
11432
|
+
const READ_CONCURRENCY$12 = 16;
|
|
11433
|
+
const IMPORT_MESSAGE = "imports a module only for its effect, but sideEffects in package.json does not list this file, so a bundler drops the import. Import what the module exports, or list the entry that exists for its effect in sideEffects.";
|
|
11434
|
+
const STATEMENT_MESSAGE = "runs a statement at the top level for its effect, but sideEffects in package.json does not list this file, so a bundler drops the module when nothing it exports is used. Move the statement into a function that the caller runs, or list the entry that exists for its effect in sideEffects.";
|
|
11435
|
+
const isEffect = (statement) => {
|
|
11436
|
+
if (isExpressionStatement(statement)) return !isStringLiteral(statement.expression);
|
|
11437
|
+
return isImportDeclaration(statement) && Predicate.isUndefined(statement.importClause);
|
|
11438
|
+
};
|
|
11439
|
+
const messageOf$3 = (statement) => {
|
|
11440
|
+
if (isImportDeclaration(statement)) return IMPORT_MESSAGE;
|
|
11441
|
+
return STATEMENT_MESSAGE;
|
|
11442
|
+
};
|
|
11443
|
+
const problemsIn$13 = (api) => (file) => (source) => {
|
|
11444
|
+
const retained = api.createSourceFile(file, source);
|
|
11445
|
+
const problems = pipe(retained.sourceFile.statements, Array.fromIterable, Array.filter(isEffect), Array.map((statement) => problemAt$8({
|
|
11446
|
+
rule: RULE$35,
|
|
11447
|
+
message: messageOf$3(statement)
|
|
11448
|
+
})(statement)));
|
|
11449
|
+
retained.dispose();
|
|
11450
|
+
return problems;
|
|
11451
|
+
};
|
|
11452
|
+
/** @internal */
|
|
11453
|
+
const topLevelEffects = Effect.fn("topLevelEffects")(function* topLevelEffects(root, modules) {
|
|
11454
|
+
const files = yield* RepositoryFiles;
|
|
11455
|
+
const compiler = yield* typeScriptCompiler;
|
|
11456
|
+
const names = yield* files.ownedFiles(root);
|
|
11457
|
+
const owned = new Set(pipe(names, Array.map((name) => files.join(root, name))));
|
|
11458
|
+
const sources = pipe(modules, Array.filter((file) => owned.has(file) && CODE$1.test(file)));
|
|
11459
|
+
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$13(compiler.api)(file)), Option.getOrElse(() => [])))), { concurrency: READ_CONCURRENCY$12 });
|
|
11460
|
+
return Array.flatten(found);
|
|
11461
|
+
}, Effect.scoped);
|
|
11462
|
+
// src/features/check-tree-shaking/model/usage.ts
|
|
11463
|
+
const inputOf = (entry) => {
|
|
11464
|
+
if (isBinEntry(entry)) return {
|
|
11465
|
+
kind: "program",
|
|
11466
|
+
file: entry.source
|
|
11467
|
+
};
|
|
11468
|
+
return {
|
|
11469
|
+
kind: "consumer",
|
|
11470
|
+
consumer: {
|
|
11471
|
+
entry: entry.source,
|
|
11472
|
+
member: Option.none()
|
|
11473
|
+
}
|
|
11474
|
+
};
|
|
11475
|
+
};
|
|
11476
|
+
const usedBy = Effect.fn("usedBy")(function* usedBy(scope, entry) {
|
|
11477
|
+
const kept = yield* keptIn(scope, inputOf(entry), always);
|
|
11478
|
+
return {
|
|
11479
|
+
entry,
|
|
11480
|
+
packages: kept.packages,
|
|
11481
|
+
modules: kept.modules
|
|
11482
|
+
};
|
|
11483
|
+
});
|
|
11484
|
+
const modulesToScan = ({ used, declared }) => pipe(used, Array.filter(({ entry }) => !isBinEntry(entry)), Array.flatMap(({ modules }) => modules), Array.dedupe, Array.filter((module) => !declared.entries.has(module)));
|
|
11485
|
+
// src/features/check-tree-shaking/model/tree-shaking.ts
|
|
11486
|
+
const BUNDLE = "tree-shake-bundle";
|
|
11487
|
+
const BUNDLE_CONCURRENCY$1 = 4;
|
|
11488
|
+
const shapeOf = Effect.fn("shapeOf")(function* shapeOf({ workspace, manifest }) {
|
|
11489
|
+
const files = yield* RepositoryFiles;
|
|
11490
|
+
const join = (target) => files.join(workspace.directory, target);
|
|
11491
|
+
const entries = pipe(publicEntriesOf({
|
|
11492
|
+
manifest,
|
|
11493
|
+
join,
|
|
11494
|
+
packEntries: workspace.packEntries
|
|
11495
|
+
}), Array.dedupeWith((left, right) => left.source === right.source && isBinEntry(left) === isBinEntry(right)));
|
|
11496
|
+
return {
|
|
11497
|
+
scope: { bundled: workspace.alwaysBundle },
|
|
11498
|
+
declared: declaredBy$1({
|
|
11499
|
+
declared: manifest.sideEffects,
|
|
11500
|
+
locator: {
|
|
11501
|
+
workspace,
|
|
11502
|
+
join
|
|
11503
|
+
}
|
|
11504
|
+
}),
|
|
11505
|
+
entries
|
|
11506
|
+
};
|
|
11507
|
+
});
|
|
11508
|
+
const excessesOf = Effect.fn("excessesOf")(function* excessesOf({ scope, declared, entries }) {
|
|
11509
|
+
if (declared.complete) return [];
|
|
11510
|
+
const shaken = pipe(entries, Array.filter((entry) => !isBinEntry(entry) && !declared.entries.has(entry.source)));
|
|
11511
|
+
const found = yield* Effect.forEach(shaken, (entry) => excessOf({
|
|
11512
|
+
scope,
|
|
11513
|
+
effectful: declared.effectful,
|
|
11514
|
+
entry
|
|
11515
|
+
}), { concurrency: BUNDLE_CONCURRENCY$1 });
|
|
11516
|
+
return Array.flatten(found);
|
|
11517
|
+
});
|
|
11518
|
+
const effectsOf = Effect.fn("effectsOf")(function* effectsOf(root, declared, used) {
|
|
11519
|
+
if (!declared.claimed) return [];
|
|
11520
|
+
return yield* topLevelEffects(root, modulesToScan({
|
|
11521
|
+
used,
|
|
11522
|
+
declared
|
|
11523
|
+
}));
|
|
11524
|
+
});
|
|
11525
|
+
const analyse = Effect.fn("analyse")(function* analyse(pack) {
|
|
11526
|
+
const { root, located, manifest } = pack;
|
|
11527
|
+
const shape = yield* shapeOf(pack);
|
|
11528
|
+
const excesses = yield* excessesOf(shape);
|
|
11529
|
+
const used = yield* Effect.forEach(shape.entries, (entry) => usedBy(shape.scope, entry), { concurrency: BUNDLE_CONCURRENCY$1 });
|
|
11530
|
+
const effects = yield* effectsOf(root, shape.declared, used);
|
|
11531
|
+
return [
|
|
11532
|
+
...sideEffectProblems({
|
|
11533
|
+
file: located.file,
|
|
11534
|
+
source: located.source,
|
|
11535
|
+
excesses
|
|
11536
|
+
}),
|
|
11537
|
+
...effects,
|
|
11538
|
+
...optionalPeerProblems({
|
|
11539
|
+
located,
|
|
11540
|
+
dependencies: dependencyNames(manifest),
|
|
11541
|
+
used
|
|
11542
|
+
})
|
|
11543
|
+
];
|
|
11544
|
+
});
|
|
11545
|
+
const bundleProblem$1 = (file, error) => [problemInFile(BUNDLE)(file, `does not bundle for the tree-shaking check. ${error.detail}`)];
|
|
11546
|
+
const workspaceProblems = Effect.fn("workspaceProblems")(function* workspaceProblems(root, workspace) {
|
|
11547
|
+
const files = yield* RepositoryFiles;
|
|
11548
|
+
const file = files.join(workspace.directory, MANIFEST_FILE$3);
|
|
11549
|
+
const source = yield* files.readFile(file);
|
|
11550
|
+
const manifest = pipe(source, Option.flatMap(manifestOf$1));
|
|
11551
|
+
if (Option.isNone(source) || Option.isNone(manifest)) return [];
|
|
11552
|
+
const located = {
|
|
11553
|
+
file,
|
|
11554
|
+
source: source.value
|
|
11555
|
+
};
|
|
11556
|
+
return yield* analyse({
|
|
11557
|
+
root,
|
|
11558
|
+
workspace,
|
|
11559
|
+
located,
|
|
11560
|
+
manifest: manifest.value
|
|
11561
|
+
}).pipe(Effect.catchTag("BundleFailed", (error) => Effect.succeed(bundleProblem$1(file, error))));
|
|
11562
|
+
});
|
|
11563
|
+
/** @internal */
|
|
11564
|
+
const checkTreeShaking = Effect.fn("checkTreeShaking")(function* checkTreeShaking(root) {
|
|
11565
|
+
const workspaces = yield* packedWorkspaces(root);
|
|
11566
|
+
const found = yield* Effect.forEach(workspaces, (workspace) => workspaceProblems(root, workspace), { concurrency: 1 });
|
|
11045
11567
|
return Array.flatten(found);
|
|
11046
11568
|
});
|
|
11047
11569
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
11048
|
-
const RULE$
|
|
11570
|
+
const RULE$34 = "legacy-typescript";
|
|
11049
11571
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
11050
11572
|
const COMPILER = "typescript";
|
|
11051
11573
|
const CURRENT_MAJOR = 7;
|
|
@@ -11076,15 +11598,13 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
11076
11598
|
file,
|
|
11077
11599
|
line: lineOf$2(source)(legacy.id),
|
|
11078
11600
|
column: FIRST$7,
|
|
11079
|
-
rule: RULE$
|
|
11601
|
+
rule: RULE$34,
|
|
11080
11602
|
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
11081
11603
|
})));
|
|
11082
11604
|
});
|
|
11083
11605
|
// src/features/check-worker-bundles/model/worker-bundles.ts
|
|
11084
|
-
const RULE$
|
|
11606
|
+
const RULE$33 = "worker-bundle";
|
|
11085
11607
|
const BUNDLE_CONCURRENCY = 4;
|
|
11086
|
-
const SHOWN_ERRORS = 3;
|
|
11087
|
-
const ERROR_LINE = /\[[A-Z_]+\]/u;
|
|
11088
11608
|
const PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];
|
|
11089
11609
|
const CONDITIONS = [
|
|
11090
11610
|
"workerd",
|
|
@@ -11094,14 +11614,8 @@ const CONDITIONS = [
|
|
|
11094
11614
|
"module",
|
|
11095
11615
|
"default"
|
|
11096
11616
|
];
|
|
11097
|
-
const
|
|
11098
|
-
const
|
|
11099
|
-
const errorLines = (error) => pipe(Option.liftPredicate(error, Predicate.isError), Option.map(({ message }) => message), Option.getOrElse(() => String(error)), stripVTControlCharacters, String$1.split("\n"), Array.filter((line) => ERROR_LINE.test(line)), Array.take(SHOWN_ERRORS));
|
|
11100
|
-
const detailOf = (lines) => pipe(lines, Array.match({
|
|
11101
|
-
onEmpty: () => NO_DETAIL,
|
|
11102
|
-
onNonEmpty: Array.join(" ")
|
|
11103
|
-
}));
|
|
11104
|
-
const problemOf$7 = (file, lines) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detailOf(lines)}`);
|
|
11617
|
+
const problemFor$2 = problemInFile(RULE$33);
|
|
11618
|
+
const problemOf$7 = (file, detail) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);
|
|
11105
11619
|
const bundleProblem = (file) => Effect.gen(function* bundle() {
|
|
11106
11620
|
const built = yield* Effect.tryPromise({
|
|
11107
11621
|
try: () => rolldown({
|
|
@@ -11111,28 +11625,32 @@ const bundleProblem = (file) => Effect.gen(function* bundle() {
|
|
|
11111
11625
|
resolve: { conditionNames: CONDITIONS },
|
|
11112
11626
|
logLevel: "silent"
|
|
11113
11627
|
}),
|
|
11114
|
-
catch:
|
|
11628
|
+
catch: bundleErrorDetail
|
|
11115
11629
|
});
|
|
11116
11630
|
yield* Effect.tryPromise({
|
|
11117
11631
|
try: () => built.generate({ format: "esm" }),
|
|
11118
|
-
catch:
|
|
11632
|
+
catch: bundleErrorDetail
|
|
11119
11633
|
});
|
|
11120
11634
|
yield* Effect.promise(() => built.close());
|
|
11121
11635
|
}).pipe(Effect.match({
|
|
11122
11636
|
onSuccess: () => Option.none(),
|
|
11123
|
-
onFailure: (
|
|
11637
|
+
onFailure: (detail) => Option.some(problemOf$7(file, detail))
|
|
11124
11638
|
}));
|
|
11125
11639
|
/** @internal */
|
|
11126
11640
|
const checkWorkerBundles = Effect.fn("checkWorkerBundles")(function* checkWorkerBundles(root) {
|
|
11127
11641
|
const files = yield* RepositoryFiles;
|
|
11128
|
-
const entries = yield*
|
|
11642
|
+
const entries = yield* bundledEntries(root);
|
|
11129
11643
|
const found = yield* Effect.forEach(entries, (entry) => bundleProblem(files.join(root, entry)), { concurrency: BUNDLE_CONCURRENCY });
|
|
11130
11644
|
return Array.getSomes(found);
|
|
11131
11645
|
});
|
|
11132
11646
|
// src/app/build-checks.ts
|
|
11133
11647
|
/** @internal */
|
|
11134
11648
|
const checkBuilds = Effect.fn("checkBuilds")(function* checkBuilds(root) {
|
|
11135
|
-
const found = yield* Effect.all([
|
|
11649
|
+
const found = yield* Effect.all([
|
|
11650
|
+
checkTypescriptGeneration(root),
|
|
11651
|
+
checkWorkerBundles(root),
|
|
11652
|
+
checkTreeShaking(root)
|
|
11653
|
+
], { concurrency: "unbounded" });
|
|
11136
11654
|
return Array.flatten(found);
|
|
11137
11655
|
});
|
|
11138
11656
|
// src/features/check-value-owners/model/slots.ts
|
|
@@ -11218,7 +11736,7 @@ const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Ar
|
|
|
11218
11736
|
imports: importedFilesOf(checker)(sourceFile)
|
|
11219
11737
|
})), Array.filter((facts) => Array.isReadonlyArrayNonEmpty(facts.values) || Array.isReadonlyArrayNonEmpty(facts.imports)));
|
|
11220
11738
|
// src/features/check-value-owners/model/name-lists.ts
|
|
11221
|
-
const RULE$
|
|
11739
|
+
const RULE$32 = "hand-written-names";
|
|
11222
11740
|
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
11223
11741
|
const nameListOf = (site) => {
|
|
11224
11742
|
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
@@ -11233,7 +11751,7 @@ const listedProblem = ({ file, line, column, names, reason }) => ({
|
|
|
11233
11751
|
file,
|
|
11234
11752
|
line,
|
|
11235
11753
|
column,
|
|
11236
|
-
rule: RULE$
|
|
11754
|
+
rule: RULE$32,
|
|
11237
11755
|
message: `The names ${formatValues(names)} are listed by hand, but ${reason}`
|
|
11238
11756
|
});
|
|
11239
11757
|
const problemOf$6 = ({ list, reason }) => listedProblem({
|
|
@@ -11306,7 +11824,7 @@ const ownerValuesOf = (checker) => (declaration) => {
|
|
|
11306
11824
|
const type = checker.getTypeAtLocation(declaration.name);
|
|
11307
11825
|
return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));
|
|
11308
11826
|
};
|
|
11309
|
-
const annotationProblem = (message) => problemAt$
|
|
11827
|
+
const annotationProblem = (message) => problemAt$8({
|
|
11310
11828
|
rule: "owner-annotation",
|
|
11311
11829
|
message
|
|
11312
11830
|
});
|
|
@@ -11443,7 +11961,7 @@ const shapeProblem = (site, matches) => {
|
|
|
11443
11961
|
onNone: () => "Derive it from the library type, for example with Pick, instead of copying its properties.",
|
|
11444
11962
|
onSome: () => "Use the library type instead of copying it."
|
|
11445
11963
|
});
|
|
11446
|
-
return problemAt$
|
|
11964
|
+
return problemAt$8({
|
|
11447
11965
|
rule: "library-shape",
|
|
11448
11966
|
message: `This shape copies ${shown}. ${advice}`
|
|
11449
11967
|
})(site.node);
|
|
@@ -11548,7 +12066,7 @@ const derivedVerdict = (context) => (site) => {
|
|
|
11548
12066
|
const added = pipe(site.values, Array.filter((value) => !isSubsetOf([value], held)));
|
|
11549
12067
|
if (!Array.isReadonlyArrayNonEmpty(owners) || !Array.isReadonlyArrayNonEmpty(added)) return verdict([], []);
|
|
11550
12068
|
const message = `This set adds ${formatValues(added)} to ${describeOwners(owners)}. Add the values to the owner, or register the wider set as its own concept.`;
|
|
11551
|
-
return verdict([problemAt$
|
|
12069
|
+
return verdict([problemAt$8({
|
|
11552
12070
|
rule: "owner-extension",
|
|
11553
12071
|
message
|
|
11554
12072
|
})(site.node)], []);
|
|
@@ -11570,7 +12088,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
11570
12088
|
const owners = pipe(context.owners, Array.filter((owner) => isSubsetOf(site.values, owner.values)));
|
|
11571
12089
|
if (Array.isReadonlyArrayNonEmpty(owners)) {
|
|
11572
12090
|
const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;
|
|
11573
|
-
return verdict([problemAt$
|
|
12091
|
+
return verdict([problemAt$8({
|
|
11574
12092
|
rule: "owner-value-set",
|
|
11575
12093
|
message
|
|
11576
12094
|
})(site.node)], []);
|
|
@@ -11578,7 +12096,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
11578
12096
|
const candidates = libraryCandidates(context)(site);
|
|
11579
12097
|
if (Array.isReadonlyArrayNonEmpty(candidates)) {
|
|
11580
12098
|
const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;
|
|
11581
|
-
return verdict([problemAt$
|
|
12099
|
+
return verdict([problemAt$8({
|
|
11582
12100
|
rule: "library-value-set",
|
|
11583
12101
|
message
|
|
11584
12102
|
})(site.node)], []);
|
|
@@ -11609,7 +12127,7 @@ const isValuePosition = (node) => {
|
|
|
11609
12127
|
const { parent } = node;
|
|
11610
12128
|
return VALUE_PARENT_KINDS.has(parent.kind) || pipe(VALUE_SLOTS, Array.some((isSlot) => isSlot(node, parent)));
|
|
11611
12129
|
};
|
|
11612
|
-
const ownedLiteralProblem = (context) => (literal) => Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(Option.filter((contextual) => vocabularyOf(context.checker)(contextual).pipe(Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues))), Option.map(() => pipe(contextSymbolsOf(context.checker)(literal), Array.flatMap((symbol) => ownersBehind(context)(symbol, [])), uniqueByReference, Array.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Array.map(String)))))), Option.filter((owners) => Array.isReadonlyArrayNonEmpty(owners)), Option.map((owners) => problemAt$
|
|
12130
|
+
const ownedLiteralProblem = (context) => (literal) => Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(Option.filter((contextual) => vocabularyOf(context.checker)(contextual).pipe(Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues))), Option.map(() => pipe(contextSymbolsOf(context.checker)(literal), Array.flatMap((symbol) => ownersBehind(context)(symbol, [])), uniqueByReference, Array.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Array.map(String)))))), Option.filter((owners) => Array.isReadonlyArrayNonEmpty(owners)), Option.map((owners) => problemAt$8({
|
|
11613
12131
|
rule: "owned-literal",
|
|
11614
12132
|
message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`
|
|
11615
12133
|
})(literal)));
|
|
@@ -11913,21 +12431,21 @@ const handWrittenNameProblems = ({ repository, literals }) => (sites) => {
|
|
|
11913
12431
|
return pipe(lists, Array.map((list) => listedPath(list).pipe(Option.orElse(() => declared(list)), Option.orElse(() => subset(list)))), Array.getSomes);
|
|
11914
12432
|
};
|
|
11915
12433
|
// src/features/check-value-owners/model/repository-names.ts
|
|
11916
|
-
const MANIFEST$
|
|
12434
|
+
const MANIFEST$3 = "package.json";
|
|
11917
12435
|
const SEPARATOR$5 = "/";
|
|
11918
12436
|
const FIRST_SEGMENT = 1;
|
|
11919
12437
|
const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
|
|
11920
|
-
const decodeManifest$
|
|
12438
|
+
const decodeManifest$7 = Schema.decodeUnknownOption(ManifestJson);
|
|
11921
12439
|
const prefixesOf = (file) => {
|
|
11922
12440
|
const segments = pipe(file, String$1.split(SEPARATOR$5));
|
|
11923
12441
|
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$5))));
|
|
11924
12442
|
};
|
|
11925
12443
|
const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
|
|
11926
|
-
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$
|
|
12444
|
+
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$7), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
|
|
11927
12445
|
const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
|
|
11928
12446
|
const files = yield* RepositoryFiles;
|
|
11929
12447
|
const listed = yield* files.listedFiles(root);
|
|
11930
|
-
const names = yield* pipe(listed, Array.filter((file) => files.basename(file) === MANIFEST$
|
|
12448
|
+
const names = yield* pipe(listed, Array.filter((file) => files.basename(file) === MANIFEST$3), (items) => Effect.forEach(items, (manifest) => files.readFile(files.join(root, manifest)).pipe(Effect.map(nameOf)), { concurrency: 1 }));
|
|
11931
12449
|
const paths = pipe(listed, Array.flatMap(prefixesOf), Array.dedupe);
|
|
11932
12450
|
return {
|
|
11933
12451
|
root,
|
|
@@ -12035,7 +12553,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
12035
12553
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
12036
12554
|
}, Effect.scoped);
|
|
12037
12555
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
12038
|
-
const RULE$
|
|
12556
|
+
const RULE$31 = "namespace-destructuring";
|
|
12039
12557
|
const LOCAL = /^[.#/]/u;
|
|
12040
12558
|
const messageOf$1 = (name) => `Destructuring ${name}, which comes from a package, makes the bundler keep everything ${name} exports. Write ${name}.<member> where it is used.`;
|
|
12041
12559
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
@@ -12050,8 +12568,8 @@ const destructuredName = (declaration) => {
|
|
|
12050
12568
|
if (declaration.name.kind !== SyntaxKind.ObjectBindingPattern) return Option.none();
|
|
12051
12569
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
12052
12570
|
};
|
|
12053
|
-
const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$
|
|
12054
|
-
rule: RULE$
|
|
12571
|
+
const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$8({
|
|
12572
|
+
rule: RULE$31,
|
|
12055
12573
|
message: messageOf$1(name)
|
|
12056
12574
|
})), Option.map((report) => report(declaration)));
|
|
12057
12575
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
@@ -12059,7 +12577,7 @@ const namespaceDestructuringIn = () => (sourceFile) => {
|
|
|
12059
12577
|
return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$5(names)), Array.getSomes);
|
|
12060
12578
|
};
|
|
12061
12579
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
12062
|
-
const RULE$
|
|
12580
|
+
const RULE$30 = "pass-through-wrapper";
|
|
12063
12581
|
const SINGLE_STATEMENT = 1;
|
|
12064
12582
|
const SINGLE_DECLARATION = 1;
|
|
12065
12583
|
const THIS_PARAMETER = "this";
|
|
@@ -12155,8 +12673,8 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
12155
12673
|
};
|
|
12156
12674
|
const problemOf$4 = (checker) => (candidate) => {
|
|
12157
12675
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
12158
|
-
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$
|
|
12159
|
-
rule: RULE$
|
|
12676
|
+
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$8({
|
|
12677
|
+
rule: RULE$30,
|
|
12160
12678
|
message: messageOf(forward.callee.getText())
|
|
12161
12679
|
})(candidate.name)));
|
|
12162
12680
|
};
|
|
@@ -12182,7 +12700,7 @@ var plugins = [{
|
|
|
12182
12700
|
"description": "CLI for watashi (watashi.masseater.dev). Sends Claude Code transcripts from a Stop hook after masking secrets locally with h56m, and manages login and API tokens."
|
|
12183
12701
|
}];
|
|
12184
12702
|
// src/features/check-agent-settings/model/known-plugins.ts
|
|
12185
|
-
const RULE$
|
|
12703
|
+
const RULE$29 = "known-plugins";
|
|
12186
12704
|
const SETTINGS_FILE$2 = ".claude/settings.json";
|
|
12187
12705
|
const GITHUB$2 = "github";
|
|
12188
12706
|
const Source$1 = Schema.Struct({
|
|
@@ -12200,7 +12718,7 @@ const decodeSettings$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Settin
|
|
|
12200
12718
|
const REPOSITORY_NAME = "masseater/masseater.dev";
|
|
12201
12719
|
const MARKETPLACE = name;
|
|
12202
12720
|
const PLUGINS = pipe(plugins, Array.map(({ name }) => `${name}@${MARKETPLACE}`));
|
|
12203
|
-
const problem$1 = problemInFile(RULE$
|
|
12721
|
+
const problem$1 = problemInFile(RULE$29);
|
|
12204
12722
|
const fromGithub = ({ source }) => source.source === GITHUB$2 && source.repo === REPOSITORY_NAME;
|
|
12205
12723
|
const marketplaceKnown = (settings) => pipe(Option.fromUndefinedOr(settings.extraKnownMarketplaces), Option.flatMap(Record.get(MARKETPLACE)), Option.exists(fromGithub));
|
|
12206
12724
|
const pluginEnabled = (settings) => (plugin) => pipe(Option.fromUndefinedOr(settings.enabledPlugins), Option.flatMap(Record.get(plugin)), Option.getOrElse(() => false));
|
|
@@ -12221,20 +12739,20 @@ const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlu
|
|
|
12221
12739
|
return [...marketplaceProblems(file, settings), ...pluginProblems(file, settings)];
|
|
12222
12740
|
});
|
|
12223
12741
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
12224
|
-
const RULE$
|
|
12742
|
+
const RULE$28 = "missing-hook";
|
|
12225
12743
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
12226
12744
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
12227
12745
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12228
12746
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12229
12747
|
const PLUGIN_ROOT = "..";
|
|
12230
12748
|
const READ_CONCURRENCY$11 = 16;
|
|
12231
|
-
const START$
|
|
12749
|
+
const START$18 = 0;
|
|
12232
12750
|
const referenceOf$1 = (found) => pipe(groupOf$2("path")(found), Option.filter(() => Option.isNone(groupOf$2("optional")(found))), Option.map((path) => ({
|
|
12233
12751
|
path,
|
|
12234
|
-
index: found.index ?? START$
|
|
12752
|
+
index: found.index ?? START$18
|
|
12235
12753
|
})), Option.toArray);
|
|
12236
12754
|
const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$1));
|
|
12237
|
-
const problemsIn$
|
|
12755
|
+
const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
|
|
12238
12756
|
const files = yield* RepositoryFiles;
|
|
12239
12757
|
const text = yield* files.readFile(file);
|
|
12240
12758
|
if (Option.isNone(text)) return [];
|
|
@@ -12246,7 +12764,7 @@ const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
12246
12764
|
return pipe(missing, Array.map(({ path, index }) => ({
|
|
12247
12765
|
file,
|
|
12248
12766
|
...positionOf(source)(index),
|
|
12249
|
-
rule: RULE$
|
|
12767
|
+
rule: RULE$28,
|
|
12250
12768
|
message: `runs ${path}, which does not exist. The hook fails every time it fires. Point it at a file that exists or remove the hook.`
|
|
12251
12769
|
})));
|
|
12252
12770
|
});
|
|
@@ -12270,7 +12788,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
12270
12788
|
}];
|
|
12271
12789
|
return [];
|
|
12272
12790
|
}));
|
|
12273
|
-
const found = yield* Effect.forEach(hookFiles, problemsIn$
|
|
12791
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$12, { concurrency: READ_CONCURRENCY$11 });
|
|
12274
12792
|
return Array.flatten(found);
|
|
12275
12793
|
});
|
|
12276
12794
|
// src/features/check-documented-commands/model/task-graph.ts
|
|
@@ -12299,7 +12817,7 @@ const listedTasks = Effect.fn("listedTasks")(function* listedTasks(root) {
|
|
|
12299
12817
|
}, Effect.scoped, Effect.orElseSucceed(() => Option.none()));
|
|
12300
12818
|
const GivenTaskGraph = Context.Reference("msch/GivenTaskGraph", { defaultValue: () => Option.none() });
|
|
12301
12819
|
// src/features/check-documented-commands/model/commands.ts
|
|
12302
|
-
const RULE$
|
|
12820
|
+
const RULE$27 = "documented-commands";
|
|
12303
12821
|
const DOCUMENTS = ["*AGENTS.md", "*CLAUDE.md"];
|
|
12304
12822
|
const DOCUMENT_NAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
|
|
12305
12823
|
const COMMAND = /`vp run (?<args>[^`]+)`/gu;
|
|
@@ -12318,7 +12836,7 @@ const FILTER_ASSIGNMENT = "--filter=";
|
|
|
12318
12836
|
const RECURSIVE_FLAGS = /* @__PURE__ */ new Set(["-r", "--recursive"]);
|
|
12319
12837
|
const ROOT_FLAGS = /* @__PURE__ */ new Set(["-w", "--workspace-root"]);
|
|
12320
12838
|
const ONE$1 = 1;
|
|
12321
|
-
const START$
|
|
12839
|
+
const START$17 = 0;
|
|
12322
12840
|
const optionsOf = (args) => pipe(String$1.split(String$1.trim(args), WHITESPACE), Array.takeWhile((token) => token !== END_OF_OPTIONS));
|
|
12323
12841
|
const filterOf = (tokens) => pipe(tokens, Array.findFirstIndex((token) => FILTER_FLAGS.has(token)), Option.flatMap((index) => Array.get(tokens, index + ONE$1)), Option.orElse(() => pipe(tokens, Array.findFirst(String$1.startsWith(FILTER_ASSIGNMENT)), Option.map(String$1.slice(9)))));
|
|
12324
12842
|
const follows = (tokens) => (index) => pipe(Array.get(tokens, index - ONE$1), Option.exists((previous) => FILTER_FLAGS.has(previous)));
|
|
@@ -12374,11 +12892,11 @@ const whereOf = (scope, file) => {
|
|
|
12374
12892
|
return `the package that holds ${file}`;
|
|
12375
12893
|
};
|
|
12376
12894
|
const isMissing = (graph, file) => ({ task, scope }) => !pipe(packagesOf(graph, file)(scope), Array.some(hasTask(graph, task)));
|
|
12377
|
-
const problemsIn$
|
|
12895
|
+
const problemsIn$11 = (graph, absolute, { file, text }) => pipe(Array.fromIterable(String$1.matchAll(COMMAND)(text)), Array.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap(Record.get(ARGS)), Option.flatMap(parsed), Option.filter(isMissing(graph, file)), Option.map(({ task, scope }) => ({
|
|
12378
12896
|
file: absolute(file),
|
|
12379
|
-
...positionOf(text)(match.index ?? START$
|
|
12380
|
-
rule: RULE$
|
|
12381
|
-
message: `${match[START$
|
|
12897
|
+
...positionOf(text)(match.index ?? START$17),
|
|
12898
|
+
rule: RULE$27,
|
|
12899
|
+
message: `${match[START$17]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
|
|
12382
12900
|
})), Option.toArray)));
|
|
12383
12901
|
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$4), Array.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
|
|
12384
12902
|
/** @internal */
|
|
@@ -12402,14 +12920,14 @@ const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* c
|
|
|
12402
12920
|
file: absolute(Array.headNonEmpty(commanded).file),
|
|
12403
12921
|
line: ONE$1,
|
|
12404
12922
|
column: ONE$1,
|
|
12405
|
-
rule: RULE$
|
|
12923
|
+
rule: RULE$27,
|
|
12406
12924
|
message: "msch could not list the tasks with `vp run --json`"
|
|
12407
12925
|
}],
|
|
12408
|
-
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$
|
|
12926
|
+
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$11(found, absolute, document)))
|
|
12409
12927
|
});
|
|
12410
12928
|
});
|
|
12411
12929
|
// src/features/check-legacy-web/model/legacy-web.ts
|
|
12412
|
-
const RULE$
|
|
12930
|
+
const RULE$26 = "legacy-web";
|
|
12413
12931
|
const FIRST_COLUMN$3 = 1;
|
|
12414
12932
|
const SCANNER = fileURLToPath(new URL("./skills/modern-web-guidance/modern-web.mjs", import.meta.resolve("modern-web-guidance/package.json")));
|
|
12415
12933
|
const Finding = Schema.Struct({
|
|
@@ -12448,7 +12966,7 @@ const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root
|
|
|
12448
12966
|
file: files.join(root, file),
|
|
12449
12967
|
line,
|
|
12450
12968
|
column: FIRST_COLUMN$3,
|
|
12451
|
-
rule: RULE$
|
|
12969
|
+
rule: RULE$26,
|
|
12452
12970
|
message: `${ruleId}: ${message} Read the guide with \`modern-web-guidance retrieve ${guideId}\` and apply it.`
|
|
12453
12971
|
});
|
|
12454
12972
|
return pipe(scan.guides, Array.flatMap(({ guideId, rules }) => pipe(rules, Array.flatMap(({ ruleId, findings }) => pipe(findings, Array.map(problemOf(guideId, ruleId)))))));
|
|
@@ -12519,7 +13037,7 @@ const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|
|
|
|
12519
13037
|
const EXTENSION = /\.[^./]+$/u;
|
|
12520
13038
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
12521
13039
|
const READ_CONCURRENCY$10 = 64;
|
|
12522
|
-
const RULE$
|
|
13040
|
+
const RULE$25 = "shell-script";
|
|
12523
13041
|
const MESSAGE$10 = "is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only the SessionStart hook in .claude/settings.json, which installs the toolchain before TypeScript can run, stays a shell script.";
|
|
12524
13042
|
const HookSchema = Schema.Struct({
|
|
12525
13043
|
command: Schema.optional(Schema.String),
|
|
@@ -12552,7 +13070,7 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
|
|
|
12552
13070
|
};
|
|
12553
13071
|
const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
|
|
12554
13072
|
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$10 });
|
|
12555
|
-
return pipe(shell, Array.map((name) => problemInFile(RULE$
|
|
13073
|
+
return pipe(shell, Array.map((name) => problemInFile(RULE$25)(files.join(root, name), MESSAGE$10)));
|
|
12556
13074
|
});
|
|
12557
13075
|
// src/shared/lib/workflow-files.ts
|
|
12558
13076
|
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
@@ -12571,8 +13089,8 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
|
12571
13089
|
});
|
|
12572
13090
|
// src/shared/lib/workflow-run.ts
|
|
12573
13091
|
const RUN_KEY = "run";
|
|
12574
|
-
const START$
|
|
12575
|
-
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$
|
|
13092
|
+
const START$16 = 0;
|
|
13093
|
+
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$16));
|
|
12576
13094
|
const runScriptsOf = (source) => {
|
|
12577
13095
|
const found = [];
|
|
12578
13096
|
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
@@ -12587,7 +13105,7 @@ const runScriptsOf = (source) => {
|
|
|
12587
13105
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
12588
13106
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
12589
13107
|
const COMMENT = "#";
|
|
12590
|
-
const RULE$
|
|
13108
|
+
const RULE$24 = "workflow-script";
|
|
12591
13109
|
const ONE_COMMAND = 1;
|
|
12592
13110
|
const MESSAGE$9 = "runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.";
|
|
12593
13111
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
@@ -12596,14 +13114,14 @@ const runsMoreThanOneCommand = ({ text }) => {
|
|
|
12596
13114
|
const lines = pipe(String$1.split("\n")(text), Array.map(String$1.trim), Array.filter(isCommand));
|
|
12597
13115
|
return lines.length > ONE_COMMAND || pipe(lines, Array.some(chainsCommands));
|
|
12598
13116
|
};
|
|
12599
|
-
const problemsIn$
|
|
13117
|
+
const problemsIn$10 = (file) => (source) => {
|
|
12600
13118
|
const at = positionOf(source);
|
|
12601
|
-
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$
|
|
13119
|
+
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$24)(file, at(start), MESSAGE$9)));
|
|
12602
13120
|
};
|
|
12603
13121
|
/** @internal */
|
|
12604
13122
|
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
12605
13123
|
const workflows = yield* readWorkflows(root);
|
|
12606
|
-
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$
|
|
13124
|
+
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$10(file)(source)));
|
|
12607
13125
|
});
|
|
12608
13126
|
// src/features/check-scripts/model/script-checks.ts
|
|
12609
13127
|
/** @internal */
|
|
@@ -12726,7 +13244,7 @@ const AGENT_DOCS = [
|
|
|
12726
13244
|
...EXCLUDED$5
|
|
12727
13245
|
];
|
|
12728
13246
|
const READ_CONCURRENCY$8 = 16;
|
|
12729
|
-
const START$
|
|
13247
|
+
const START$15 = 0;
|
|
12730
13248
|
const FIRST$5 = 1;
|
|
12731
13249
|
const LINE = "\n";
|
|
12732
13250
|
const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
|
|
@@ -12736,7 +13254,7 @@ const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts))
|
|
|
12736
13254
|
const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
12737
13255
|
const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
12738
13256
|
const NO_SOURCES = [];
|
|
12739
|
-
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
13257
|
+
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$15));
|
|
12740
13258
|
const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
|
|
12741
13259
|
const offset = offsetOf$2(source, `"${name}"`);
|
|
12742
13260
|
return {
|
|
@@ -12832,7 +13350,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
12832
13350
|
return Array.flatten(found);
|
|
12833
13351
|
});
|
|
12834
13352
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
12835
|
-
const RULE$
|
|
13353
|
+
const RULE$23 = "package-script";
|
|
12836
13354
|
const LIFECYCLE = [
|
|
12837
13355
|
"preinstall",
|
|
12838
13356
|
"install",
|
|
@@ -12855,12 +13373,12 @@ const LIFECYCLE = [
|
|
|
12855
13373
|
const problemOf$3 = ({ file, position, name }) => ({
|
|
12856
13374
|
file,
|
|
12857
13375
|
...position,
|
|
12858
|
-
rule: RULE$
|
|
13376
|
+
rule: RULE$23,
|
|
12859
13377
|
message: `The script ${name} is not a lifecycle script. package.json scripts hold only the scripts the package manager runs by itself, such as prepare and prepack. Write ${name} as a task in run.tasks of this package's vite.config.ts, where its shape is type-checked.`
|
|
12860
13378
|
});
|
|
12861
13379
|
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
|
|
12862
13380
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
12863
|
-
const RULE$
|
|
13381
|
+
const RULE$22 = "vite-plus-block";
|
|
12864
13382
|
const MARKER = Array.join([
|
|
12865
13383
|
"<!--",
|
|
12866
13384
|
"VITE PLUS START",
|
|
@@ -12873,7 +13391,7 @@ const problemIn = (file) => (source) => {
|
|
|
12873
13391
|
return Option.some({
|
|
12874
13392
|
file,
|
|
12875
13393
|
...positionOf(source)(index.value),
|
|
12876
|
-
rule: RULE$
|
|
13394
|
+
rule: RULE$22,
|
|
12877
13395
|
message: MESSAGE$8
|
|
12878
13396
|
});
|
|
12879
13397
|
};
|
|
@@ -12929,7 +13447,7 @@ const checkFullHistoryCheckout = workflowCheck({
|
|
|
12929
13447
|
})
|
|
12930
13448
|
});
|
|
12931
13449
|
// src/features/check-workflows/model/publish-trigger.ts
|
|
12932
|
-
const RULE$
|
|
13450
|
+
const RULE$20 = "publish-trigger";
|
|
12933
13451
|
const PUBLISH = /\bmsch-publish\s+(?:plan|npm|release)\b/u;
|
|
12934
13452
|
const MANUAL = "workflow_dispatch";
|
|
12935
13453
|
const TRIGGER_KEY = "on";
|
|
@@ -12949,18 +13467,18 @@ const publishTriggerOffsetsOf = (source) => {
|
|
|
12949
13467
|
};
|
|
12950
13468
|
/** @internal */
|
|
12951
13469
|
const checkPublishTrigger = workflowCheck({
|
|
12952
|
-
rule: RULE$
|
|
13470
|
+
rule: RULE$20,
|
|
12953
13471
|
message: MESSAGE$6,
|
|
12954
13472
|
offsetsOf: publishTriggerOffsetsOf
|
|
12955
13473
|
});
|
|
12956
13474
|
// src/features/check-workflows/model/release-please.ts
|
|
12957
|
-
const RULE$
|
|
13475
|
+
const RULE$19 = "release-please";
|
|
12958
13476
|
const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
|
|
12959
13477
|
const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
|
|
12960
13478
|
const FIRST$4 = 1;
|
|
12961
13479
|
const MESSAGE$5 = "releases with release-please. Releases are manual: bump the version in a PR, then run the publish workflow, which runs `msch-publish` for the workspace.";
|
|
12962
13480
|
const checkReleasePleaseSteps = workflowCheck({
|
|
12963
|
-
rule: RULE$
|
|
13481
|
+
rule: RULE$19,
|
|
12964
13482
|
message: MESSAGE$5,
|
|
12965
13483
|
offsetsOf: scalarKeyOffsets({
|
|
12966
13484
|
name: "uses",
|
|
@@ -12974,7 +13492,7 @@ const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* c
|
|
|
12974
13492
|
file: files.join(root, name),
|
|
12975
13493
|
line: FIRST$4,
|
|
12976
13494
|
column: FIRST$4,
|
|
12977
|
-
rule: RULE$
|
|
13495
|
+
rule: RULE$19,
|
|
12978
13496
|
message: MESSAGE$5
|
|
12979
13497
|
})));
|
|
12980
13498
|
});
|
|
@@ -12986,17 +13504,17 @@ const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleas
|
|
|
12986
13504
|
// src/features/check-workflows/model/workflow-queue.ts
|
|
12987
13505
|
const CONCURRENCY_KEY = "concurrency";
|
|
12988
13506
|
const QUEUE_KEY = "queue";
|
|
12989
|
-
const RULE$
|
|
13507
|
+
const RULE$18 = "workflow-queue";
|
|
12990
13508
|
const MESSAGE$4 = "queues runs with `queue`. A queued group runs every old push one by one, so a long run holds back the newest commit for hours. Drop `queue`: a job that later pushes redo gets `cancel-in-progress: true`, and a deploy or release job keeps the default, which lets the running one finish and replaces the waiting one with the newest run.";
|
|
12991
13509
|
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
|
|
12992
13510
|
/** @internal */
|
|
12993
13511
|
const checkWorkflowQueues = workflowCheck({
|
|
12994
|
-
rule: RULE$
|
|
13512
|
+
rule: RULE$18,
|
|
12995
13513
|
message: MESSAGE$4,
|
|
12996
13514
|
offsetsOf: queueOffsetsOf
|
|
12997
13515
|
});
|
|
12998
13516
|
// src/features/check-workflows/model/workflow-commits.ts
|
|
12999
|
-
const RULE$
|
|
13517
|
+
const RULE$17 = "workflow-commit";
|
|
13000
13518
|
const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
|
|
13001
13519
|
const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
|
|
13002
13520
|
const MESSAGE$3 = "commits or pushes from a workflow. A bot commit leaves generated files out of review and races the next push. Regenerate the files in a commit hook (for example `.vite-hooks/pre-commit`) so they land in the author's commit, and let CI only check that they are current.";
|
|
@@ -13004,7 +13522,7 @@ const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source
|
|
|
13004
13522
|
const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
|
|
13005
13523
|
/** @internal */
|
|
13006
13524
|
const checkWorkflowCommits = workflowCheck({
|
|
13007
|
-
rule: RULE$
|
|
13525
|
+
rule: RULE$17,
|
|
13008
13526
|
message: MESSAGE$3,
|
|
13009
13527
|
offsetsOf: commitOffsetsOf
|
|
13010
13528
|
});
|
|
@@ -13105,7 +13623,7 @@ const COMMENT_NODES = [
|
|
|
13105
13623
|
"block_comment",
|
|
13106
13624
|
"multiline_comment"
|
|
13107
13625
|
];
|
|
13108
|
-
const START$
|
|
13626
|
+
const START$14 = 0;
|
|
13109
13627
|
const NEXT = 1;
|
|
13110
13628
|
const NONE$1 = [];
|
|
13111
13629
|
const loadGrammar = (grammar) => loadLanguage(grammar).pipe(Effect.mapBoth({
|
|
@@ -13155,7 +13673,7 @@ const markupComment = (source) => (node) => {
|
|
|
13155
13673
|
}];
|
|
13156
13674
|
};
|
|
13157
13675
|
const textComments = (grammars, grammar) => (text) => {
|
|
13158
|
-
const shift = shifted(text.startIndex ?? START$
|
|
13676
|
+
const shift = shifted(text.startIndex ?? START$14);
|
|
13159
13677
|
return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
|
|
13160
13678
|
};
|
|
13161
13679
|
const embeddedComments = (grammars) => (node) => {
|
|
@@ -13191,11 +13709,11 @@ const commentsWith = (grammars) => (reader, source) => {
|
|
|
13191
13709
|
}[reader](source);
|
|
13192
13710
|
};
|
|
13193
13711
|
// src/features/ban-comments/model/comments.ts
|
|
13194
|
-
const RULE$
|
|
13712
|
+
const RULE$16 = "comment";
|
|
13195
13713
|
const CONFIG_FILE$2 = "vite.config.ts";
|
|
13196
13714
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
13197
13715
|
const READ_CONCURRENCY$7 = 64;
|
|
13198
|
-
const START$
|
|
13716
|
+
const START$13 = 0;
|
|
13199
13717
|
const READERS$1 = [
|
|
13200
13718
|
[/\.(?:[cm]?jsx?)$/u, "javascript"],
|
|
13201
13719
|
[/\.(?:[cm]?ts)$/u, "typescript"],
|
|
@@ -13250,16 +13768,16 @@ const shebangReader = (source) => {
|
|
|
13250
13768
|
const readerOf = (name, source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
13251
13769
|
const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
|
|
13252
13770
|
const lineBefore = (source, index) => {
|
|
13253
|
-
const lines = pipe(source, String$1.slice(START$
|
|
13771
|
+
const lines = pipe(source, String$1.slice(START$13, index), String$1.split("\n"));
|
|
13254
13772
|
return Option.getOrElse(Array.last(lines), () => "");
|
|
13255
13773
|
};
|
|
13256
13774
|
const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
|
|
13257
|
-
const isShebang = ({ index, text }) => index === START$
|
|
13775
|
+
const isShebang = ({ index, text }) => index === START$13 && String$1.startsWith(SHEBANG)(text);
|
|
13258
13776
|
const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
|
|
13259
13777
|
const problemOf$2 = (file, source) => ({ index }) => ({
|
|
13260
13778
|
file,
|
|
13261
13779
|
...positionOf(source)(index),
|
|
13262
|
-
rule: RULE$
|
|
13780
|
+
rule: RULE$16,
|
|
13263
13781
|
message: MESSAGE$2
|
|
13264
13782
|
});
|
|
13265
13783
|
const settingsOf = ({ msch, lint }) => ({
|
|
@@ -13308,7 +13826,7 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
|
13308
13826
|
const toProblem = problemOf$2(file, source);
|
|
13309
13827
|
return Option.match(readerOf(name, source), {
|
|
13310
13828
|
onNone: () => Effect.succeed(NONE),
|
|
13311
|
-
onSome: (reader) => comments(reader, source).pipe(Effect.map(Array.filter(kept)), Effect.map(Array.map(toProblem)), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed([problemInFile(RULE$
|
|
13829
|
+
onSome: (reader) => comments(reader, source).pipe(Effect.map(Array.filter(kept)), Effect.map(Array.map(toProblem)), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed([problemInFile(RULE$16)(file, `msch could not read the comments in this file: ${message}`)])))
|
|
13312
13830
|
});
|
|
13313
13831
|
};
|
|
13314
13832
|
const found = yield* Effect.forEach(scanned, (entry) => files.readFile(entry.file).pipe(Effect.flatMap(Option.match({
|
|
@@ -13407,7 +13925,7 @@ const PYTHON = {
|
|
|
13407
13925
|
const checkPython = (root) => checkBannedTool(root, PYTHON);
|
|
13408
13926
|
// src/features/check-catalog-entries/model/catalog-entries.ts
|
|
13409
13927
|
const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
|
|
13410
|
-
const MANIFEST$
|
|
13928
|
+
const MANIFEST$2 = /(?:^|\/)package\.json$/u;
|
|
13411
13929
|
const CATALOG_PROTOCOL = "catalog:";
|
|
13412
13930
|
const DEFAULT_CATALOG = "default";
|
|
13413
13931
|
const VERSION_SEPARATOR = "||";
|
|
@@ -13421,7 +13939,7 @@ const UNUSED_RULE = "unused-catalog-entry";
|
|
|
13421
13939
|
const STALE_MESSAGE = "excludes a version from `minimumReleaseAge` that the lockfile no longer resolves. Remove the entry: it only exempted that one version while it was new.";
|
|
13422
13940
|
const UNUSED_MESSAGE = "is a catalog entry no package refers to. Remove it, so the catalog holds only versions in use.";
|
|
13423
13941
|
const FieldsSchema$1 = Schema.Record(Schema.String, Schema.Unknown);
|
|
13424
|
-
const decodeManifest$
|
|
13942
|
+
const decodeManifest$6 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema$1));
|
|
13425
13943
|
const decodeFields$2 = Schema.decodeUnknownOption(FieldsSchema$1);
|
|
13426
13944
|
const decodeString$2 = Schema.decodeUnknownOption(Schema.String);
|
|
13427
13945
|
const decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
@@ -13449,8 +13967,8 @@ const lockedKeys = (root) => lockedPackages(root).pipe(Effect.orElseSucceed(() =
|
|
|
13449
13967
|
const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root, settings) {
|
|
13450
13968
|
const files = yield* RepositoryFiles;
|
|
13451
13969
|
const listed = yield* files.listedFiles(root);
|
|
13452
|
-
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$
|
|
13453
|
-
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$
|
|
13970
|
+
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$2.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$6 });
|
|
13971
|
+
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$6(text))), Array.flatMap(referencesIn));
|
|
13454
13972
|
const fromOverrides = pipe(fieldsOf$2(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf));
|
|
13455
13973
|
return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
|
|
13456
13974
|
});
|
|
@@ -13461,17 +13979,17 @@ const lineOf$1 = (source) => (needle) => pipe(String$1.split(source, "\n"), Arra
|
|
|
13461
13979
|
const quoted$1 = (name) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(name);
|
|
13462
13980
|
const entryLine = (name) => new RegExp(`^\\s+["']?${quoted$1(name)}["']?:`, "u");
|
|
13463
13981
|
const excludeLine = (entry) => new RegExp(`^\\s+-\\s+["']?${quoted$1(entry)}["']?\\s*$`, "u");
|
|
13464
|
-
const problemAt$
|
|
13982
|
+
const problemAt$5 = ({ file, at }, rule, message) => (name, needle) => ({
|
|
13465
13983
|
file,
|
|
13466
13984
|
line: at(needle),
|
|
13467
13985
|
column: FIRST_COLUMN$1,
|
|
13468
13986
|
rule,
|
|
13469
13987
|
message: `\`${name}\` ${message}`
|
|
13470
13988
|
});
|
|
13471
|
-
const unusedIn = (located, settings, isUsed) => pipe(catalogEntries(settings), Array.filter(({ catalog, name }) => !isUsed(`${catalog}:${name}`)), Array.map(({ name }) => problemAt$
|
|
13989
|
+
const unusedIn = (located, settings, isUsed) => pipe(catalogEntries(settings), Array.filter(({ catalog, name }) => !isUsed(`${catalog}:${name}`)), Array.map(({ name }) => problemAt$5(located, UNUSED_RULE, UNUSED_MESSAGE)(name, entryLine(name))));
|
|
13472
13990
|
const staleIn = (located, settings, keys) => {
|
|
13473
13991
|
const excludes = Option.getOrElse(decodeStrings(settings["minimumReleaseAgeExclude"]), () => []);
|
|
13474
|
-
return pipe(Option.toArray(keys), Array.flatMap((locked) => pipe(excludes, Array.filter((entry) => !resolvedIn(locked)(entry)))), Array.map((entry) => problemAt$
|
|
13992
|
+
return pipe(Option.toArray(keys), Array.flatMap((locked) => pipe(excludes, Array.filter((entry) => !resolvedIn(locked)(entry)))), Array.map((entry) => problemAt$5(located, STALE_RULE, STALE_MESSAGE)(entry, excludeLine(entry))));
|
|
13475
13993
|
};
|
|
13476
13994
|
const findingsIn = Effect.fn("findingsIn")(function* findingsIn(root, file, settings) {
|
|
13477
13995
|
const read = yield* (yield* RepositoryFiles).readFile(file);
|
|
@@ -13499,7 +14017,7 @@ const CONFIG_FILE$1 = "vite.config.ts";
|
|
|
13499
14017
|
const RENOVATE_FILE$1 = "renovate.json";
|
|
13500
14018
|
const SOURCE = "masseater/skills";
|
|
13501
14019
|
const PRESET$1 = "github>masseater/ecosystems//libs/vite-plus-adopt/renovate";
|
|
13502
|
-
const START$
|
|
14020
|
+
const START$12 = 0;
|
|
13503
14021
|
const LOCAL_PREFIX = "./";
|
|
13504
14022
|
const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
|
|
13505
14023
|
const Source = Schema.Struct({
|
|
@@ -13510,9 +14028,9 @@ const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source
|
|
|
13510
14028
|
const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
|
|
13511
14029
|
const taggedError$1 = Schema.TaggedError;
|
|
13512
14030
|
var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
13513
|
-
const problemAt$
|
|
14031
|
+
const problemAt$4 = (rule, file, text) => (anchor, message) => ({
|
|
13514
14032
|
file,
|
|
13515
|
-
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$
|
|
14033
|
+
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$12))),
|
|
13516
14034
|
rule,
|
|
13517
14035
|
message
|
|
13518
14036
|
});
|
|
@@ -13532,20 +14050,20 @@ const declaredSkills = Effect.fn("declaredSkills")(function* declaredSkills(root
|
|
|
13532
14050
|
})));
|
|
13533
14051
|
});
|
|
13534
14052
|
const entryProblems = ({ file, text, sources }) => {
|
|
13535
|
-
const at = problemAt$
|
|
14053
|
+
const at = problemAt$4(ENTRY_RULE, file, text);
|
|
13536
14054
|
return pipe(Record.get(sources, SOURCE), Option.match({
|
|
13537
14055
|
onNone: () => [at("skills", `does not install ${SOURCE}. Add "${SOURCE}": { commit, root: "plugins/masseater-skills/skills", skills: "all" } to skills.`)],
|
|
13538
14056
|
onSome: (source) => pipe(Option.liftPredicate(source, ({ skills }) => skills !== "all"), Option.map(() => at(`"${SOURCE}"`, `picks skills from ${SOURCE} by name. Write skills: "all", so every repository gets each new skill with the next digest update.`)), Option.toArray)
|
|
13539
14057
|
}));
|
|
13540
14058
|
};
|
|
13541
14059
|
const literalPattern = (repository, commit) => new RegExp(`"${String$1.replaceAll(REGEX_SPECIAL, String.raw`\$&`)(repository)}": \\{\\s*commit: "${commit}"`, "u");
|
|
13542
|
-
const visibleProblems = ({ file, text, sources }) => pipe(Record.toEntries(sources), Array.filter(([repository]) => !String$1.startsWith(LOCAL_PREFIX)(repository)), Array.filter(([repository, { commit }]) => !literalPattern(repository, commit ?? "").test(text)), Array.map(([repository]) => problemAt$
|
|
14060
|
+
const visibleProblems = ({ file, text, sources }) => pipe(Record.toEntries(sources), Array.filter(([repository]) => !String$1.startsWith(LOCAL_PREFIX)(repository)), Array.filter(([repository, { commit }]) => !literalPattern(repository, commit ?? "").test(text)), Array.map(([repository]) => problemAt$4(VISIBLE_RULE, file, text)(repository, `declares ${repository} in a form the Renovate preset cannot read. Write "${repository}": { commit: "<sha>", ... } with commit first and as a string literal.`)));
|
|
13543
14061
|
const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root) {
|
|
13544
14062
|
const files = yield* RepositoryFiles;
|
|
13545
14063
|
const file = files.join(root, RENOVATE_FILE$1);
|
|
13546
14064
|
const text = yield* files.readFile(file);
|
|
13547
14065
|
if (pipe(text, Option.exists(String$1.includes(`"${PRESET$1}"`)))) return [];
|
|
13548
|
-
return [problemAt$
|
|
14066
|
+
return [problemAt$4(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET$1}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE$1}.`)];
|
|
13549
14067
|
});
|
|
13550
14068
|
/** @internal */
|
|
13551
14069
|
const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
|
|
@@ -13559,14 +14077,14 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
|
|
|
13559
14077
|
];
|
|
13560
14078
|
});
|
|
13561
14079
|
// src/features/check-skills/model/published-skills.ts
|
|
13562
|
-
const RULE$
|
|
14080
|
+
const RULE$15 = "published-skills";
|
|
13563
14081
|
const KEYWORD = "tanstack-intent";
|
|
13564
14082
|
const SKILLS = "skills";
|
|
13565
14083
|
const MANIFEST_FILE = "package.json";
|
|
13566
14084
|
const SKILL_FILE$1 = "SKILL.md";
|
|
13567
14085
|
const SUCCEEDED = 0;
|
|
13568
14086
|
const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
|
|
13569
|
-
const problemAt$
|
|
14087
|
+
const problemAt$3 = problemInFile(RULE$15);
|
|
13570
14088
|
const skillDirectoriesIn = (files, directory) => pipe(findSkillFiles(files.join(directory, SKILLS)), Array.filter((file) => files.basename(file) === SKILL_FILE$1), Array.map((file) => files.relative(directory, files.dirname(file))));
|
|
13571
14089
|
const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
|
|
13572
14090
|
const packagingMessages = ({ keywords, files }, skills) => {
|
|
@@ -13587,23 +14105,23 @@ const validationOf = Effect.fn("validationOf")(function* validationOf(directory)
|
|
|
13587
14105
|
const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
|
|
13588
14106
|
return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
|
|
13589
14107
|
}, Effect.scoped);
|
|
13590
|
-
const problemsIn$
|
|
14108
|
+
const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
|
|
13591
14109
|
const files = yield* RepositoryFiles;
|
|
13592
14110
|
const directory = files.join(root, project.directory);
|
|
13593
14111
|
const manifest = files.join(directory, MANIFEST_FILE);
|
|
13594
14112
|
const skills = skillDirectoriesIn(files, directory);
|
|
13595
|
-
if (!Array.isReadonlyArrayNonEmpty(skills)) return [problemAt$
|
|
14113
|
+
if (!Array.isReadonlyArrayNonEmpty(skills)) return [problemAt$3(manifest, `is published without agent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE$1}, so that repositories which approve them in the permissions of pnpm-workspace.yaml give their agents guidance for the installed version.`)];
|
|
13596
14114
|
const validation = yield* validationOf(directory).pipe(Effect.orElseSucceed(() => Option.none()));
|
|
13597
|
-
return [...pipe(packagingMessages(project, skills), Array.map((message) => problemAt$
|
|
14115
|
+
return [...pipe(packagingMessages(project, skills), Array.map((message) => problemAt$3(manifest, message))), ...pipe(validation, Option.map((output) => problemAt$3(files.join(directory, SKILLS), `fails intent validate:\n${output}`)), Option.toArray)];
|
|
13598
14116
|
});
|
|
13599
14117
|
/** @internal */
|
|
13600
14118
|
const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
|
|
13601
14119
|
const projects = yield* publishedProjects(root);
|
|
13602
|
-
const problems = yield* Effect.forEach(projects, (project) => problemsIn$
|
|
14120
|
+
const problems = yield* Effect.forEach(projects, (project) => problemsIn$9(root, project), { concurrency: 1 });
|
|
13603
14121
|
return Array.flatten(problems);
|
|
13604
14122
|
});
|
|
13605
14123
|
// src/features/check-skills/model/skill-files.ts
|
|
13606
|
-
const RULE$
|
|
14124
|
+
const RULE$14 = "skill-file";
|
|
13607
14125
|
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
13608
14126
|
const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
|
|
13609
14127
|
const MARKDOWN = ".md";
|
|
@@ -13620,7 +14138,7 @@ const GITHUB = "https://github.com/";
|
|
|
13620
14138
|
const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
|
|
13621
14139
|
const BLANK = /\s+/u;
|
|
13622
14140
|
const SEPARATOR$2 = "/";
|
|
13623
|
-
const START$
|
|
14141
|
+
const START$11 = 0;
|
|
13624
14142
|
const FIRST$3 = 1;
|
|
13625
14143
|
const READ_CONCURRENCY$5 = 16;
|
|
13626
14144
|
const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
|
|
@@ -13630,9 +14148,9 @@ const Frontmatter = Schema.Struct({
|
|
|
13630
14148
|
metadata: Schema.optional(Metadata)
|
|
13631
14149
|
});
|
|
13632
14150
|
const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
|
|
13633
|
-
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$
|
|
14151
|
+
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$11));
|
|
13634
14152
|
const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap((yaml) => decodeFrontmatter(parse$2(yaml))));
|
|
13635
|
-
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$
|
|
14153
|
+
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$11].length), Option.getOrElse(() => START$11));
|
|
13636
14154
|
const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
|
|
13637
14155
|
const nameProblems = ({ source, directory }, name, folder) => {
|
|
13638
14156
|
const bodyStart = bodyStartOf(source);
|
|
@@ -13660,16 +14178,16 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
|
|
|
13660
14178
|
]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
|
|
13661
14179
|
file: skill.file,
|
|
13662
14180
|
...positionOf(skill.source)(index),
|
|
13663
|
-
rule: RULE$
|
|
14181
|
+
rule: RULE$14,
|
|
13664
14182
|
message
|
|
13665
14183
|
})));
|
|
13666
14184
|
const linkOf = (found) => pipe(groupOf$2("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
|
|
13667
14185
|
target,
|
|
13668
|
-
index: found.index ?? START$
|
|
14186
|
+
index: found.index ?? START$11
|
|
13669
14187
|
})), Option.toArray);
|
|
13670
14188
|
const rangeOf$1 = (found) => {
|
|
13671
|
-
const start = found.index ?? START$
|
|
13672
|
-
return [start, start + found[START$
|
|
14189
|
+
const start = found.index ?? START$11;
|
|
14190
|
+
return [start, start + found[START$11].length];
|
|
13673
14191
|
};
|
|
13674
14192
|
const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
|
|
13675
14193
|
const linksIn = (source) => {
|
|
@@ -13687,11 +14205,11 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
|
|
|
13687
14205
|
return pipe(missing, Array.map(({ target, index }) => ({
|
|
13688
14206
|
file,
|
|
13689
14207
|
...positionOf(source)(index),
|
|
13690
|
-
rule: RULE$
|
|
14208
|
+
rule: RULE$14,
|
|
13691
14209
|
message: `links to ${target}, which does not exist. Fix the path or remove the link.`
|
|
13692
14210
|
})));
|
|
13693
14211
|
});
|
|
13694
|
-
const problemsIn$
|
|
14212
|
+
const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
|
|
13695
14213
|
const files = yield* RepositoryFiles;
|
|
13696
14214
|
const file = files.join(root, name);
|
|
13697
14215
|
const directory = files.dirname(name);
|
|
@@ -13703,7 +14221,7 @@ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
13703
14221
|
file: files.join(root, entry),
|
|
13704
14222
|
line: FIRST$3,
|
|
13705
14223
|
column: FIRST$3,
|
|
13706
|
-
rule: RULE$
|
|
14224
|
+
rule: RULE$14,
|
|
13707
14225
|
message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
|
|
13708
14226
|
})));
|
|
13709
14227
|
return [
|
|
@@ -13720,7 +14238,7 @@ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
13720
14238
|
const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
|
|
13721
14239
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
13722
14240
|
const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name)));
|
|
13723
|
-
const found = yield* Effect.forEach(skills, (name) => problemsIn$
|
|
14241
|
+
const found = yield* Effect.forEach(skills, (name) => problemsIn$8(root, listed, name), { concurrency: READ_CONCURRENCY$5 });
|
|
13724
14242
|
return Array.flatten(found);
|
|
13725
14243
|
});
|
|
13726
14244
|
// src/features/check-version-downgrades/model/version-entries.ts
|
|
@@ -13783,7 +14301,7 @@ const cargoEntries = (text) => {
|
|
|
13783
14301
|
};
|
|
13784
14302
|
const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
|
|
13785
14303
|
// src/features/check-version-downgrades/model/version-downgrade.ts
|
|
13786
|
-
const RULE$
|
|
14304
|
+
const RULE$13 = "version-downgrade";
|
|
13787
14305
|
const DEFAULT_BASE = "origin/main";
|
|
13788
14306
|
const READ_CONCURRENCY$4 = 16;
|
|
13789
14307
|
const READERS = [
|
|
@@ -13809,7 +14327,7 @@ const downgradesIn = ({ file, text, before, after }) => {
|
|
|
13809
14327
|
file,
|
|
13810
14328
|
line: lineOf(text, entry),
|
|
13811
14329
|
column: FIRST_LINE$1,
|
|
13812
|
-
rule: RULE$
|
|
14330
|
+
rule: RULE$13,
|
|
13813
14331
|
message: message(old, entry)
|
|
13814
14332
|
})), Option.toArray)));
|
|
13815
14333
|
};
|
|
@@ -13846,13 +14364,13 @@ const AUTOMERGE_RULE = "renovate-platform-automerge";
|
|
|
13846
14364
|
const CAP_RULE = "renovate-version-cap";
|
|
13847
14365
|
const PRESET_RULE = "renovate-msch-preset";
|
|
13848
14366
|
const PRESET = "github>masseater/ecosystems//libs/msch/renovate";
|
|
13849
|
-
const START$
|
|
14367
|
+
const START$10 = 0;
|
|
13850
14368
|
const READ_CONCURRENCY$3 = 16;
|
|
13851
14369
|
const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
|
|
13852
14370
|
const CAP_MESSAGE = "caps a dependency below a version with `allowedVersions`. A cap holds the dependency on an old version, which is a downgrade that never ends: fix what breaks on the new version instead.";
|
|
13853
14371
|
const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
|
|
13854
14372
|
const offsetsOf = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
|
|
13855
|
-
const problemsIn$
|
|
14373
|
+
const problemsIn$7 = (file, source) => {
|
|
13856
14374
|
const at = positionOf(source);
|
|
13857
14375
|
const found = (pattern, rule, message) => pipe(offsetsOf(pattern, source), Array.map((offset) => ({
|
|
13858
14376
|
file,
|
|
@@ -13865,7 +14383,7 @@ const problemsIn$6 = (file, source) => {
|
|
|
13865
14383
|
...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),
|
|
13866
14384
|
...pipe([{
|
|
13867
14385
|
file,
|
|
13868
|
-
...at(START$
|
|
14386
|
+
...at(START$10),
|
|
13869
14387
|
rule: PRESET_RULE,
|
|
13870
14388
|
message: PRESET_MESSAGE
|
|
13871
14389
|
}], Array.filter(() => !String$1.includes(`"${PRESET}"`)(source)))
|
|
@@ -13879,7 +14397,7 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
13879
14397
|
const file = files.join(root, name);
|
|
13880
14398
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
13881
14399
|
onNone: () => [],
|
|
13882
|
-
onSome: (source) => problemsIn$
|
|
14400
|
+
onSome: (source) => problemsIn$7(file, source)
|
|
13883
14401
|
})));
|
|
13884
14402
|
}, { concurrency: READ_CONCURRENCY$3 });
|
|
13885
14403
|
return Array.flatten(found);
|
|
@@ -13887,22 +14405,22 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
13887
14405
|
// src/features/find-invisible-characters/model/hidden-unicode.ts
|
|
13888
14406
|
const HIDDEN = /[\u00AD\u180E\u200B\u200C\u200E\u200F\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]|(?<![\p{Extended_Pictographic}\p{Emoji_Modifier}\uFE0F])\u200D|\u200D(?!\p{Extended_Pictographic})|[\u{E0000}-\u{E007F}]/gu;
|
|
13889
14407
|
const NUL = "\0";
|
|
13890
|
-
const START$
|
|
14408
|
+
const START$9 = 0;
|
|
13891
14409
|
const HEX = 16;
|
|
13892
14410
|
const CODE_POINT_WIDTH = 4;
|
|
13893
14411
|
const READ_CONCURRENCY$2 = 64;
|
|
13894
|
-
const RULE$
|
|
13895
|
-
const hexOf = (character) => pipe(String$1.codePointAt(START$
|
|
14412
|
+
const RULE$12 = "hidden-unicode";
|
|
14413
|
+
const hexOf = (character) => pipe(String$1.codePointAt(START$9)(character), Option.getOrElse(() => START$9), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
|
|
13896
14414
|
const problemOf$1 = (file, source) => (found) => {
|
|
13897
|
-
const hex = hexOf(found[START$
|
|
14415
|
+
const hex = hexOf(found[START$9]);
|
|
13898
14416
|
return {
|
|
13899
14417
|
file,
|
|
13900
|
-
...positionOf(source)(found.index ?? START$
|
|
13901
|
-
rule: RULE$
|
|
14418
|
+
...positionOf(source)(found.index ?? START$9),
|
|
14419
|
+
rule: RULE$12,
|
|
13902
14420
|
message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\u${hex}.`
|
|
13903
14421
|
};
|
|
13904
14422
|
};
|
|
13905
|
-
const problemsIn$
|
|
14423
|
+
const problemsIn$6 = (file, source) => {
|
|
13906
14424
|
if (String$1.includes(NUL)(source)) return [];
|
|
13907
14425
|
return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf$1(file, source)));
|
|
13908
14426
|
};
|
|
@@ -13914,25 +14432,25 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
|
|
|
13914
14432
|
const file = files.join(root, name);
|
|
13915
14433
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
13916
14434
|
onNone: () => [],
|
|
13917
|
-
onSome: (source) => problemsIn$
|
|
14435
|
+
onSome: (source) => problemsIn$6(file, source)
|
|
13918
14436
|
})));
|
|
13919
14437
|
}, { concurrency: READ_CONCURRENCY$2 });
|
|
13920
14438
|
return Array.flatten(found);
|
|
13921
14439
|
});
|
|
13922
14440
|
// src/features/find-unneeded-files/model/alchemy-patch.ts
|
|
13923
|
-
const RULE$
|
|
14441
|
+
const RULE$11 = "alchemy-patch";
|
|
13924
14442
|
const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
|
|
13925
14443
|
const ALCHEMY$1 = /^(?:alchemy|@alchemy\.run\/[^@]+)(?:@.*)?$/u;
|
|
13926
|
-
const START$
|
|
14444
|
+
const START$8 = 0;
|
|
13927
14445
|
const problemOf = (file, position, name) => ({
|
|
13928
14446
|
file,
|
|
13929
14447
|
...position,
|
|
13930
|
-
rule: RULE$
|
|
14448
|
+
rule: RULE$11,
|
|
13931
14449
|
message: `patches ${name}. A patch breaks on every Alchemy release. Define the missing setting as a custom resource in the stack and delete the patch.`
|
|
13932
14450
|
});
|
|
13933
|
-
const problemsIn$
|
|
14451
|
+
const problemsIn$5 = (file, patched) => (source) => {
|
|
13934
14452
|
const at = positionOf(source);
|
|
13935
|
-
const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$
|
|
14453
|
+
const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$8));
|
|
13936
14454
|
return pipe(patched, Array.filter((name) => ALCHEMY$1.test(name)), Array.map((name) => problemOf(file, at(offsetOf(name)), name)));
|
|
13937
14455
|
};
|
|
13938
14456
|
/** @internal */
|
|
@@ -13942,12 +14460,12 @@ const checkAlchemyPatch = Effect.fn("checkAlchemyPatch")(function* checkAlchemyP
|
|
|
13942
14460
|
const text = yield* files.readFile(file);
|
|
13943
14461
|
const manifest = yield* workspaceManifest(root);
|
|
13944
14462
|
const patched = pipe(manifest, Option.flatMap(({ patchedDependencies }) => Option.fromUndefinedOr(patchedDependencies)), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
13945
|
-
return pipe(text, Option.map(problemsIn$
|
|
14463
|
+
return pipe(text, Option.map(problemsIn$5(file, patched)), Option.getOrElse(() => []));
|
|
13946
14464
|
});
|
|
13947
14465
|
// src/features/find-unneeded-files/model/applied-packages.ts
|
|
13948
14466
|
const MSCH = "@r_masseater/msch";
|
|
13949
14467
|
const SCOPE$1 = "@r_masseater/";
|
|
13950
|
-
const RULE$
|
|
14468
|
+
const RULE$10 = "applied-package";
|
|
13951
14469
|
const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
|
|
13952
14470
|
const NOT_FOUND = -1;
|
|
13953
14471
|
const SEPARATOR$1 = "/";
|
|
@@ -13989,15 +14507,15 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
|
|
|
13989
14507
|
const names = pipe(manifest, Option.flatMap(({ dependencies }) => Option.fromUndefinedOr(dependencies)), Option.map(Record.keys), Option.getOrElse(() => []), Array.filter(String$1.startsWith(SCOPE$1)));
|
|
13990
14508
|
return yield* Effect.forEach(names, installedPackage, { concurrency: 1 });
|
|
13991
14509
|
});
|
|
13992
|
-
const problemAt$
|
|
14510
|
+
const problemAt$2 = (file, source) => (index, name) => ({
|
|
13993
14511
|
file,
|
|
13994
14512
|
...positionOf(source)(index),
|
|
13995
|
-
rule: RULE$
|
|
14513
|
+
rule: RULE$10,
|
|
13996
14514
|
message: `msch applies ${name}. Remove this use and let msch apply it.`
|
|
13997
14515
|
});
|
|
13998
14516
|
const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
|
|
13999
14517
|
const binPattern = (bin) => new RegExp(`(?<![\\w./@:-])${escaped(bin)}(?=[ \\t"'\`]|$)`, "gmu");
|
|
14000
|
-
const usesIn = (applied) => ({ file }, source) => pipe(applied, Array.flatMap((entry) => pipe([specifierPattern(entry), ...pipe(entry.bins, Array.map(binPattern))], Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map((found) => problemAt$
|
|
14518
|
+
const usesIn = (applied) => ({ file }, source) => pipe(applied, Array.flatMap((entry) => pipe([specifierPattern(entry), ...pipe(entry.bins, Array.map(binPattern))], Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map((found) => problemAt$2(file, source)(found.index ?? NOT_FOUND, entry.name)))));
|
|
14001
14519
|
const ownerOf$1 = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$1}`)(name)), Array.match({
|
|
14002
14520
|
onEmpty: () => "",
|
|
14003
14521
|
onNonEmpty: Array.max(BY_LENGTH)
|
|
@@ -14017,7 +14535,7 @@ const manifestUses = Effect.fn("manifestUses")(function* manifestUses(root, appl
|
|
|
14017
14535
|
declared: manifest
|
|
14018
14536
|
}), Option.match({
|
|
14019
14537
|
onNone: () => [],
|
|
14020
|
-
onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt$
|
|
14538
|
+
onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt$2(file, source)(index, name)), Option.toArray)))
|
|
14021
14539
|
}));
|
|
14022
14540
|
});
|
|
14023
14541
|
const sourceUses = Effect.fn("sourceUses")(function* sourceUses({ root, applied, directories, consumers }) {
|
|
@@ -14047,7 +14565,7 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
|
|
|
14047
14565
|
return yield* appliedPackageProblems(root, applied);
|
|
14048
14566
|
});
|
|
14049
14567
|
// src/features/find-unneeded-files/model/replaced-tools.ts
|
|
14050
|
-
const RULE$
|
|
14568
|
+
const RULE$9 = "replaced-tool";
|
|
14051
14569
|
const FIRST$2 = 1;
|
|
14052
14570
|
const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
|
|
14053
14571
|
const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
|
|
@@ -14128,7 +14646,7 @@ const problemFor$1 = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ patte
|
|
|
14128
14646
|
file,
|
|
14129
14647
|
line: FIRST$2,
|
|
14130
14648
|
column: FIRST$2,
|
|
14131
|
-
rule: RULE$
|
|
14649
|
+
rule: RULE$9,
|
|
14132
14650
|
message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
|
|
14133
14651
|
})));
|
|
14134
14652
|
/** @internal */
|
|
@@ -14157,7 +14675,7 @@ const SETUP_PATTERNS = [
|
|
|
14157
14675
|
];
|
|
14158
14676
|
const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
|
|
14159
14677
|
const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
|
|
14160
|
-
const START$
|
|
14678
|
+
const START$7 = 0;
|
|
14161
14679
|
const LAST_SEGMENT = 1;
|
|
14162
14680
|
const FIRST_LINE = 1;
|
|
14163
14681
|
const FIRST_COLUMN = 1;
|
|
@@ -14227,7 +14745,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
|
|
|
14227
14745
|
const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
|
|
14228
14746
|
return directoriesOf(roots);
|
|
14229
14747
|
});
|
|
14230
|
-
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$
|
|
14748
|
+
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$7), (end) => String$1.slice(START$7, end)(name));
|
|
14231
14749
|
const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
|
|
14232
14750
|
const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
|
|
14233
14751
|
const cargoProblems = (present, enabled) => {
|
|
@@ -14263,11 +14781,11 @@ const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneed
|
|
|
14263
14781
|
return yield* unneededIn(root, cargoEnabled(workspace.value));
|
|
14264
14782
|
});
|
|
14265
14783
|
// src/features/check-effect-diagnostics/model/effect-diagnostics.ts
|
|
14266
|
-
const RULE$
|
|
14784
|
+
const RULE$8 = "effect-diagnostics-once";
|
|
14267
14785
|
const PLUGIN = "@effect/language-service";
|
|
14268
14786
|
const CONFIG_PATHSPEC = ":(glob)**/tsconfig*.json";
|
|
14269
14787
|
const EXCLUDED$4 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14270
|
-
const START$
|
|
14788
|
+
const START$6 = 0;
|
|
14271
14789
|
const Plugin = Schema.Struct({
|
|
14272
14790
|
name: Schema.optional(Schema.String),
|
|
14273
14791
|
diagnostics: Schema.optional(Schema.Unknown)
|
|
@@ -14278,10 +14796,10 @@ const Config$1 = Schema.Struct({ compilerOptions: Schema.optional(CompilerOption
|
|
|
14278
14796
|
const decodeConfig = Schema.decodeUnknownOption(Schema.fromJsonString(Config$1));
|
|
14279
14797
|
const MESSAGE$1 = `The \`${PLUGIN}\` plugin reports the Effect diagnostics during the type check, and the \`effecttsgo\` lint rules that msch enables report the same ones again. Set \`"diagnostics": false\` on the plugin so that each finding is reported once, by the lint rules, with the severity msch sets.`;
|
|
14280
14798
|
const reportsDiagnostics = (plugin) => plugin.name === PLUGIN && plugin.diagnostics !== false;
|
|
14281
|
-
const problemsIn$
|
|
14799
|
+
const problemsIn$4 = (entry, source) => pipe(decodeConfig(source), Option.flatMap(({ compilerOptions }) => Option.fromUndefinedOr(compilerOptions)), Option.flatMap(({ plugins }) => Option.fromUndefinedOr(plugins)), Option.filter(Array.some(reportsDiagnostics)), Option.map(() => ({
|
|
14282
14800
|
file: entry.file,
|
|
14283
|
-
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$
|
|
14284
|
-
rule: RULE$
|
|
14801
|
+
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$6))),
|
|
14802
|
+
rule: RULE$8,
|
|
14285
14803
|
message: MESSAGE$1
|
|
14286
14804
|
})), Option.toArray);
|
|
14287
14805
|
/** @internal */
|
|
@@ -14291,15 +14809,15 @@ const checkEffectDiagnostics = Effect.fn("checkEffectDiagnostics")(function* che
|
|
|
14291
14809
|
return yield* scanText(pipe(configs, Array.map((name) => ({
|
|
14292
14810
|
name,
|
|
14293
14811
|
file: files.join(root, name)
|
|
14294
|
-
}))), problemsIn$
|
|
14812
|
+
}))), problemsIn$4);
|
|
14295
14813
|
});
|
|
14296
14814
|
// src/features/check-exact-versions/model/exact-versions.ts
|
|
14297
|
-
const RULE$
|
|
14815
|
+
const RULE$7 = "version-range";
|
|
14298
14816
|
const WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
14299
14817
|
const ALIAS = /^npm:(?:@[^/@]+\/)?[^@]+@(?<version>.+)$/u;
|
|
14300
14818
|
const PROTOCOL = /^[a-z+]+:/u;
|
|
14301
14819
|
const PATH_LIKE = "/";
|
|
14302
|
-
const START$
|
|
14820
|
+
const START$5 = 0;
|
|
14303
14821
|
const SECTIONS = [
|
|
14304
14822
|
"dependencies",
|
|
14305
14823
|
"devDependencies",
|
|
@@ -14309,7 +14827,7 @@ const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguis
|
|
|
14309
14827
|
const MESSAGE = "is a range. The lockfile decides the version anyway, so a range only lets the next install move it without a diff. Write the exact version the lockfile resolves; `msch-publish` widens `dependencies` and `peerDependencies` to `^` in the published package.";
|
|
14310
14828
|
const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
14311
14829
|
const decodeFields = Schema.decodeUnknownOption(FieldsSchema);
|
|
14312
|
-
const decodeManifest$
|
|
14830
|
+
const decodeManifest$5 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
|
|
14313
14831
|
const decodeString = Schema.decodeUnknownOption(Schema.String);
|
|
14314
14832
|
const fieldsOf = (value) => Option.getOrElse(decodeFields(value), () => ({}));
|
|
14315
14833
|
const versionOf = (specifier) => Option.getOrElse(groupOf$2("version")(ALIAS.exec(specifier)), () => specifier);
|
|
@@ -14323,16 +14841,16 @@ const specifiedIn = (held) => pipe(fieldsOf(held), Record.toEntries, Array.flatM
|
|
|
14323
14841
|
specifier
|
|
14324
14842
|
})), Option.toArray)));
|
|
14325
14843
|
const quoted = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(text);
|
|
14326
|
-
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
14844
|
+
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$5));
|
|
14327
14845
|
const problemsFor = (file, source, pattern) => (found) => pipe(found, Array.filter(({ specifier }) => isRange(specifier)), Array.map((range) => ({
|
|
14328
14846
|
file,
|
|
14329
14847
|
...positionOf(source)(offsetIn(source)(pattern(range))),
|
|
14330
|
-
rule: RULE$
|
|
14848
|
+
rule: RULE$7,
|
|
14331
14849
|
message: `\`${range.name}\` \`${range.specifier}\` ${MESSAGE}`
|
|
14332
14850
|
})));
|
|
14333
14851
|
const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted(name)}"\\s*:\\s*"${quoted(specifier)}"`, "u");
|
|
14334
14852
|
const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted(name)}["']?:`, "mu");
|
|
14335
|
-
const manifestProblems$
|
|
14853
|
+
const manifestProblems$2 = (entry, source) => pipe(decodeManifest$5(source), Option.map((manifest) => pipe(SECTIONS, Array.flatMap((section) => specifiedIn(manifest[section])), problemsFor(entry.file, source, manifestPattern))), Option.getOrElse(() => []));
|
|
14336
14854
|
const catalogSpecifiers = (settings) => [...specifiedIn(settings["catalog"]), ...pipe(fieldsOf(settings["catalogs"]), Record.values, Array.flatMap(specifiedIn))];
|
|
14337
14855
|
const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(root) {
|
|
14338
14856
|
const files = yield* RepositoryFiles;
|
|
@@ -14352,22 +14870,22 @@ const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactV
|
|
|
14352
14870
|
name,
|
|
14353
14871
|
file: files.join(root, name)
|
|
14354
14872
|
})));
|
|
14355
|
-
const fromManifests = yield* scanText(listed, manifestProblems$
|
|
14873
|
+
const fromManifests = yield* scanText(listed, manifestProblems$2);
|
|
14356
14874
|
const fromCatalogs = yield* catalogProblems(root);
|
|
14357
14875
|
return [...fromManifests, ...fromCatalogs];
|
|
14358
14876
|
});
|
|
14359
14877
|
// src/features/check-pack-settings/model/pack-settings.ts
|
|
14360
|
-
const RULE$
|
|
14878
|
+
const RULE$6 = "pack-publint";
|
|
14361
14879
|
const CONFIG_FILE = "vite.config.ts";
|
|
14362
14880
|
const PACK_KEY = "pack:";
|
|
14363
|
-
const START$
|
|
14881
|
+
const START$4 = 0;
|
|
14364
14882
|
const READ_CONCURRENCY$1 = 16;
|
|
14365
14883
|
const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14366
|
-
const Manifest$
|
|
14884
|
+
const Manifest$4 = Schema.Struct({
|
|
14367
14885
|
private: Schema.optional(Schema.Boolean),
|
|
14368
14886
|
publishConfig: Schema.optional(Schema.Unknown)
|
|
14369
14887
|
});
|
|
14370
|
-
const decodeManifest$
|
|
14888
|
+
const decodeManifest$4 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
|
|
14371
14889
|
const StrictPack = Schema.Struct({ publint: Schema.Struct({ strict: Schema.Literal(true) }) });
|
|
14372
14890
|
const isStrict = Schema.is(StrictPack);
|
|
14373
14891
|
const PackConfig = Schema.Struct({ pack: Schema.optional(Schema.Unknown) });
|
|
@@ -14378,11 +14896,11 @@ const isPublished$2 = (manifest) => manifest.private !== true && Predicate.isNot
|
|
|
14378
14896
|
const runsStrictPublint = (config) => pipe(decodePackConfig(config), Option.flatMap(({ pack }) => Option.fromUndefinedOr(pack)), Option.map((pack) => Array.ensure(pack)), Option.exists(Array.some(isStrict)));
|
|
14379
14897
|
const problemFor = (file, source) => ({
|
|
14380
14898
|
file,
|
|
14381
|
-
...positionOf(source)(Option.getOrElse(String$1.indexOf(PACK_KEY)(source), () => START$
|
|
14382
|
-
rule: RULE$
|
|
14899
|
+
...positionOf(source)(Option.getOrElse(String$1.indexOf(PACK_KEY)(source), () => START$4)),
|
|
14900
|
+
rule: RULE$6,
|
|
14383
14901
|
message: "This package is published, so its pack must run publint with `publint: { strict: true }`. Without it, publishConfig can point at files vp pack never writes, and the published package fails to import."
|
|
14384
14902
|
});
|
|
14385
|
-
const isPublishedManifest = (source) => pipe(source, Option.flatMap(decodeManifest$
|
|
14903
|
+
const isPublishedManifest = (source) => pipe(source, Option.flatMap(decodeManifest$4), Option.exists(isPublished$2));
|
|
14386
14904
|
const strictPublintIn = Effect.fn("strictPublintIn")(function* strictPublintIn(configFile) {
|
|
14387
14905
|
const config = yield* Effect.tryPromise({
|
|
14388
14906
|
try: () => resolveConfigFromFile(configFile),
|
|
@@ -14396,7 +14914,7 @@ const configProblems = Effect.fn("configProblems")(function* configProblems(conf
|
|
|
14396
14914
|
if (yield* strictPublintIn(configFile)) return [];
|
|
14397
14915
|
return [problemFor(configFile, source.value)];
|
|
14398
14916
|
});
|
|
14399
|
-
const problemsIn$
|
|
14917
|
+
const problemsIn$3 = Effect.fn("problemsIn")(function* problemsIn(root, manifestName) {
|
|
14400
14918
|
const files = yield* RepositoryFiles;
|
|
14401
14919
|
const manifest = yield* files.readFile(files.join(root, manifestName));
|
|
14402
14920
|
if (!isPublishedManifest(manifest)) return [];
|
|
@@ -14405,27 +14923,27 @@ const problemsIn$2 = Effect.fn("problemsIn")(function* problemsIn(root, manifest
|
|
|
14405
14923
|
/** @internal */
|
|
14406
14924
|
const checkPackSettings = Effect.fn("checkPackSettings")(function* checkPackSettings(root) {
|
|
14407
14925
|
const manifests = yield* (yield* RepositoryFiles).matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$2]);
|
|
14408
|
-
const found = yield* Effect.forEach(manifests, (name) => problemsIn$
|
|
14926
|
+
const found = yield* Effect.forEach(manifests, (name) => problemsIn$3(root, name), { concurrency: READ_CONCURRENCY$1 });
|
|
14409
14927
|
return Array.flatten(found);
|
|
14410
14928
|
});
|
|
14411
14929
|
// src/features/check-package-scope/model/package-scope.ts
|
|
14412
|
-
const RULE$
|
|
14930
|
+
const RULE$5 = "package-scope";
|
|
14413
14931
|
const SCOPE = "@r_masseater/";
|
|
14414
14932
|
const NAME_KEY = "\"name\"";
|
|
14415
|
-
const START$
|
|
14933
|
+
const START$3 = 0;
|
|
14416
14934
|
const EXCLUDED$1 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14417
|
-
const Manifest$
|
|
14935
|
+
const Manifest$3 = Schema.Struct({
|
|
14418
14936
|
name: Schema.optional(Schema.String),
|
|
14419
14937
|
private: Schema.optional(Schema.Boolean),
|
|
14420
14938
|
publishConfig: Schema.optional(Schema.Unknown)
|
|
14421
14939
|
});
|
|
14422
|
-
const decodeManifest$
|
|
14940
|
+
const decodeManifest$3 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$3));
|
|
14423
14941
|
const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
14424
14942
|
const unscopedName = (manifest) => pipe(Option.fromUndefinedOr(manifest.name), Option.filter((name) => !String$1.startsWith(SCOPE)(name)));
|
|
14425
|
-
const problemsIn$
|
|
14943
|
+
const problemsIn$2 = (entry, source) => pipe(decodeManifest$3(source), Option.filter(isPublished$1), Option.flatMap(unscopedName), Option.map((name) => ({
|
|
14426
14944
|
file: entry.file,
|
|
14427
|
-
...positionOf(source)(pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$
|
|
14428
|
-
rule: RULE$
|
|
14945
|
+
...positionOf(source)(pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$3))),
|
|
14946
|
+
rule: RULE$5,
|
|
14429
14947
|
message: `Packages are published only under the ${SCOPE} scope. Rename "${name}" to "${SCOPE}${String$1.replace(/^@[^/]+\//u, "")(name)}".`
|
|
14430
14948
|
})), Option.toArray);
|
|
14431
14949
|
/** @internal */
|
|
@@ -14435,10 +14953,10 @@ const checkPackageScope = Effect.fn("checkPackageScope")(function* checkPackageS
|
|
|
14435
14953
|
return yield* scanText(pipe(manifests, Array.map((name) => ({
|
|
14436
14954
|
name,
|
|
14437
14955
|
file: files.join(root, name)
|
|
14438
|
-
}))), problemsIn$
|
|
14956
|
+
}))), problemsIn$2);
|
|
14439
14957
|
});
|
|
14440
14958
|
// src/features/check-plugin-marketplace/model/plugin-marketplace.ts
|
|
14441
|
-
const RULE$
|
|
14959
|
+
const RULE$4 = "plugin-marketplace";
|
|
14442
14960
|
const PLUGIN_DIRECTORY = ".claude-plugin";
|
|
14443
14961
|
const PLUGIN_FILE = `${PLUGIN_DIRECTORY}/plugin.json`;
|
|
14444
14962
|
const MARKETPLACE_FILE = `${PLUGIN_DIRECTORY}/marketplace.json`;
|
|
@@ -14494,7 +15012,7 @@ const pluginIn = Effect.fn("pluginIn")(function* pluginIn(root, project) {
|
|
|
14494
15012
|
description: Option.getOrElse(project.description, () => "")
|
|
14495
15013
|
})));
|
|
14496
15014
|
});
|
|
14497
|
-
const problem = problemInFile(RULE$
|
|
15015
|
+
const problem = problemInFile(RULE$4);
|
|
14498
15016
|
const pluginsIn = Effect.fn("pluginsIn")(function* pluginsIn(root) {
|
|
14499
15017
|
const projects = yield* workspaceProjects(root);
|
|
14500
15018
|
const found = yield* Effect.forEach(projects, (project) => pluginIn(root, project), { concurrency: "unbounded" });
|
|
@@ -14539,10 +15057,10 @@ const checkPluginMarketplace = Effect.fn("checkPluginMarketplace")(function* che
|
|
|
14539
15057
|
return yield* rewrite(file, `${text}\n`);
|
|
14540
15058
|
});
|
|
14541
15059
|
// src/features/check-runtime-version/model/node-version.ts
|
|
14542
|
-
const RULE$
|
|
15060
|
+
const RULE$3 = "node-version";
|
|
14543
15061
|
const MINIMUM = 26;
|
|
14544
15062
|
const SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;
|
|
14545
|
-
const MANIFEST = /(?:^|\/)package\.json$/u;
|
|
15063
|
+
const MANIFEST$1 = /(?:^|\/)package\.json$/u;
|
|
14546
15064
|
const VERSION_FILE = /(?:^|\/)(?:\.node-version|\.nvmrc)$/u;
|
|
14547
15065
|
const DOCKERFILE = /(?:^|\/)(?:Dockerfile|Containerfile)[^/]*$/u;
|
|
14548
15066
|
const STEP_FILE = /^\.github\/.*\.ya?ml$|(?:^|\/)action\.ya?ml$/u;
|
|
@@ -14553,15 +15071,15 @@ const TOOL_VERSION = /^[ \t]*["']?(?:node|nodejs)["']?[ \t]*(?:=[ \t]*["']?|[ \t
|
|
|
14553
15071
|
const RANGE_FLOOR = /^(?:>=|\^|~|=)?[ \t]*v?(?<major>\d+)/u;
|
|
14554
15072
|
const ALTERNATIVE = "||";
|
|
14555
15073
|
const ENGINES_KEY = "\"engines\"";
|
|
14556
|
-
const START$
|
|
15074
|
+
const START$2 = 0;
|
|
14557
15075
|
const EXCLUDED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14558
15076
|
const Engines = Schema.Struct({ node: Schema.optional(Schema.String) });
|
|
14559
|
-
const Manifest$
|
|
15077
|
+
const Manifest$2 = Schema.Struct({
|
|
14560
15078
|
private: Schema.optional(Schema.Boolean),
|
|
14561
15079
|
publishConfig: Schema.optional(Schema.Unknown),
|
|
14562
15080
|
engines: Schema.optional(Engines)
|
|
14563
15081
|
});
|
|
14564
|
-
const decodeManifest$
|
|
15082
|
+
const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
|
|
14565
15083
|
const majorOf = (found) => pipe(groupOf$2("major")(found), Option.map(Number));
|
|
14566
15084
|
const isOld = (major) => major < MINIMUM;
|
|
14567
15085
|
const floorOf = (alternative) => majorOf(RANGE_FLOOR.exec(String$1.trim(alternative)));
|
|
@@ -14570,44 +15088,44 @@ const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
|
|
|
14570
15088
|
onSome: isOld
|
|
14571
15089
|
}));
|
|
14572
15090
|
const admitsOld = (range) => pipe(String$1.split(range, ALTERNATIVE), Array.some(floorIsOld));
|
|
14573
|
-
const problemAt = ({ entry, source, index }, message) => ({
|
|
15091
|
+
const problemAt$1 = ({ entry, source, index }, message) => ({
|
|
14574
15092
|
file: entry.file,
|
|
14575
15093
|
...positionOf(source)(index),
|
|
14576
|
-
rule: RULE$
|
|
15094
|
+
rule: RULE$3,
|
|
14577
15095
|
message
|
|
14578
15096
|
});
|
|
14579
|
-
const offsetOf = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
14580
|
-
const unstatedProblem = (entry, source) => problemAt({
|
|
15097
|
+
const offsetOf = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$2));
|
|
15098
|
+
const unstatedProblem = (entry, source) => problemAt$1({
|
|
14581
15099
|
entry,
|
|
14582
15100
|
source,
|
|
14583
|
-
index: START$
|
|
15101
|
+
index: START$2
|
|
14584
15102
|
}, `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to ">=${String(MINIMUM)}".`);
|
|
14585
|
-
const rangeProblem = (entry, source) => (range) => problemAt({
|
|
15103
|
+
const rangeProblem = (entry, source) => (range) => problemAt$1({
|
|
14586
15104
|
entry,
|
|
14587
15105
|
source,
|
|
14588
15106
|
index: offsetOf(source, ENGINES_KEY)
|
|
14589
15107
|
}, `${SUPPORTED} engines.node is "${range}", which admits an older one. Set it to ">=${String(MINIMUM)}".`);
|
|
14590
15108
|
const isPublished = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
14591
15109
|
const rangeOf = (manifest) => pipe(Option.fromUndefinedOr(manifest.engines), Option.flatMap(({ node }) => Option.fromUndefinedOr(node)));
|
|
14592
|
-
const manifestProblems = (entry, source) => {
|
|
14593
|
-
const manifest = decodeManifest$
|
|
15110
|
+
const manifestProblems$1 = (entry, source) => {
|
|
15111
|
+
const manifest = decodeManifest$2(source);
|
|
14594
15112
|
if (Option.isNone(manifest)) return [];
|
|
14595
15113
|
const range = rangeOf(manifest.value);
|
|
14596
15114
|
if (Option.isNone(range) && isPublished(manifest.value)) return [unstatedProblem(entry, source)];
|
|
14597
15115
|
return pipe(range, Option.filter(admitsOld), Option.map(rangeProblem(entry, source)), Option.toArray);
|
|
14598
15116
|
};
|
|
14599
|
-
const pinnedProblems = (pattern) => (entry, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.filter((found) => Option.exists(majorOf(found), isOld)), Array.map((found) => problemAt({
|
|
15117
|
+
const pinnedProblems = (pattern) => (entry, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.filter((found) => Option.exists(majorOf(found), isOld)), Array.map((found) => problemAt$1({
|
|
14600
15118
|
entry,
|
|
14601
15119
|
source,
|
|
14602
|
-
index: found.index ?? START$
|
|
14603
|
-
}, `${SUPPORTED} \`${String$1.trim(found[START$
|
|
14604
|
-
const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt({
|
|
15120
|
+
index: found.index ?? START$2
|
|
15121
|
+
}, `${SUPPORTED} \`${String$1.trim(found[START$2])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
|
|
15122
|
+
const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt$1({
|
|
14605
15123
|
entry,
|
|
14606
15124
|
source,
|
|
14607
|
-
index: START$
|
|
15125
|
+
index: START$2
|
|
14608
15126
|
}, `${SUPPORTED} This file pins ${String(major)}. Raise it to ${String(MINIMUM)} or later.`)), Option.toArray);
|
|
14609
|
-
const problemsIn = (entry, source) => {
|
|
14610
|
-
if (MANIFEST.test(entry.name)) return manifestProblems(entry, source);
|
|
15127
|
+
const problemsIn$1 = (entry, source) => {
|
|
15128
|
+
if (MANIFEST$1.test(entry.name)) return manifestProblems$1(entry, source);
|
|
14611
15129
|
if (VERSION_FILE.test(entry.name)) return versionFileProblems(entry, source);
|
|
14612
15130
|
if (DOCKERFILE.test(entry.name)) return pinnedProblems(BASE_IMAGE)(entry, source);
|
|
14613
15131
|
if (isToolVersions(entry)) return pinnedProblems(TOOL_VERSION)(entry, source);
|
|
@@ -14623,14 +15141,14 @@ const checkNodeVersion = Effect.fn("checkNodeVersion")(function* checkNodeVersio
|
|
|
14623
15141
|
name,
|
|
14624
15142
|
file: files.join(root, name)
|
|
14625
15143
|
})))];
|
|
14626
|
-
return yield* scanText(sources, problemsIn);
|
|
15144
|
+
return yield* scanText(sources, problemsIn$1);
|
|
14627
15145
|
});
|
|
14628
15146
|
// src/features/check-unused-workspaces/model/unused-workspaces.ts
|
|
14629
|
-
const RULE$
|
|
15147
|
+
const RULE$2 = "unused-workspace";
|
|
14630
15148
|
const CARGO_FILE = "Cargo.toml";
|
|
14631
15149
|
const ROOT_DIRECTORY = "";
|
|
14632
15150
|
const TASK_SEPARATOR = "#";
|
|
14633
|
-
const START = 0;
|
|
15151
|
+
const START$1 = 0;
|
|
14634
15152
|
const FIRST$1 = 1;
|
|
14635
15153
|
const READ_CONCURRENCY = 8;
|
|
14636
15154
|
const LIBRARY_KINDS = [
|
|
@@ -14644,14 +15162,14 @@ const PROGRAM_KINDS = [
|
|
|
14644
15162
|
"staticlib",
|
|
14645
15163
|
"dylib"
|
|
14646
15164
|
];
|
|
14647
|
-
const Manifest = Schema.Struct({
|
|
15165
|
+
const Manifest$1 = Schema.Struct({
|
|
14648
15166
|
name: Schema.optional(Schema.String),
|
|
14649
15167
|
private: Schema.optional(Schema.Boolean),
|
|
14650
15168
|
exports: Schema.optional(Schema.Unknown),
|
|
14651
15169
|
main: Schema.optional(Schema.Unknown),
|
|
14652
15170
|
bin: Schema.optional(Schema.Unknown)
|
|
14653
15171
|
});
|
|
14654
|
-
const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
|
|
15172
|
+
const decodeManifest$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$1));
|
|
14655
15173
|
const isDependedOn = (links) => ({ directory }) => pipe(links, Array.some(({ from, to }) => to === directory && from !== directory));
|
|
14656
15174
|
const isKind = (kinds) => (kind) => Array.contains(kinds, kind);
|
|
14657
15175
|
const isLibraryCrate = ({ kinds }) => pipe(kinds, Array.some(isKind(LIBRARY_KINDS))) && !pipe(kinds, Array.some(isKind(PROGRAM_KINDS)));
|
|
@@ -14677,7 +15195,7 @@ const cargoFacts = Effect.fn("cargoFacts")(function* cargoFacts(root, directorie
|
|
|
14677
15195
|
links: pipe(crates, Array.flatMap(({ manifest, pathDependencies }) => linksOf(manifest, pathDependencies)))
|
|
14678
15196
|
};
|
|
14679
15197
|
});
|
|
14680
|
-
const workspaceOfTask = (text) => pipe(String$1.indexOf(TASK_SEPARATOR)(text), Option.map((at) => String$1.slice(START, at)(text)), Option.filter(String$1.isNonEmpty));
|
|
15198
|
+
const workspaceOfTask = (text) => pipe(String$1.indexOf(TASK_SEPARATOR)(text), Option.map((at) => String$1.slice(START$1, at)(text)), Option.filter(String$1.isNonEmpty));
|
|
14681
15199
|
const taskTargets = Effect.fn("taskTargets")(function* taskTargets(root, directory) {
|
|
14682
15200
|
const config = yield* workspaceConfigOf(root, directory);
|
|
14683
15201
|
return pipe(config, Option.map(({ program }) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(({ text }) => Option.toArray(workspaceOfTask(text))))), Option.getOrElse(() => []));
|
|
@@ -14686,7 +15204,7 @@ const memberOf = Effect.fn("memberOf")(function* memberOf(request) {
|
|
|
14686
15204
|
const { root, directory, crateLibraries, deployed } = request;
|
|
14687
15205
|
const files = yield* RepositoryFiles;
|
|
14688
15206
|
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
|
|
14689
|
-
return pipe(text, Option.flatMap(decodeManifest), Option.map((manifest) => ({
|
|
15207
|
+
return pipe(text, Option.flatMap(decodeManifest$1), Option.map((manifest) => ({
|
|
14690
15208
|
directory,
|
|
14691
15209
|
name: Option.fromUndefinedOr(manifest.name),
|
|
14692
15210
|
library: Predicate.isNotUndefined(manifest.exports) || Predicate.isNotUndefined(manifest.main) || Array.contains(crateLibraries, directory),
|
|
@@ -14731,10 +15249,62 @@ const checkUnusedWorkspaces = Effect.fn("checkUnusedWorkspaces")(function* check
|
|
|
14731
15249
|
file: files.join(root, directory, MANIFEST_FILE$3),
|
|
14732
15250
|
line: FIRST$1,
|
|
14733
15251
|
column: FIRST$1,
|
|
14734
|
-
rule: RULE$
|
|
15252
|
+
rule: RULE$2,
|
|
14735
15253
|
message: `${directory} is a private library, and no other workspace depends on it through package.json, a Cargo path dependency or a task. Delete it, or depend on it from the code that uses it.`
|
|
14736
15254
|
})));
|
|
14737
15255
|
});
|
|
15256
|
+
// src/features/check-upstream-exits/model/scattered-deviations.ts
|
|
15257
|
+
const RULE$1 = "upstream-deviation-place";
|
|
15258
|
+
const MANIFEST = "package.json";
|
|
15259
|
+
const NESTED_WORKSPACE = "/pnpm-workspace.yaml";
|
|
15260
|
+
const NESTED_CARGO = "/Cargo.toml";
|
|
15261
|
+
const CARGO_CONFIG = /(?:^|\/)\.cargo\/config(?:\.toml)?$/u;
|
|
15262
|
+
const MANAGER_FIELDS = ["overrides", "resolutions"];
|
|
15263
|
+
const START = 0;
|
|
15264
|
+
const PLACE = "Upstream deviations live only in the root pnpm-workspace.yaml (overrides, patchedDependencies, packageExtensions) and the root Cargo.toml ([patch]), each with an exit condition.";
|
|
15265
|
+
const Fields = Schema.Record(Schema.String, Schema.Unknown);
|
|
15266
|
+
const Manifest = Schema.fromJsonString(Schema.Struct({
|
|
15267
|
+
pnpm: Schema.optional(Fields),
|
|
15268
|
+
overrides: Schema.optional(Schema.Unknown),
|
|
15269
|
+
resolutions: Schema.optional(Schema.Unknown)
|
|
15270
|
+
}));
|
|
15271
|
+
const decodeManifest = Schema.decodeUnknownOption(Manifest);
|
|
15272
|
+
const isManifest = (name) => name === MANIFEST || String$1.endsWith(`/${MANIFEST}`)(name);
|
|
15273
|
+
const problemAt = (entry, source) => (index, message) => ({
|
|
15274
|
+
file: entry.file,
|
|
15275
|
+
...positionOf(source)(index),
|
|
15276
|
+
rule: RULE$1,
|
|
15277
|
+
message
|
|
15278
|
+
});
|
|
15279
|
+
const keyIndex = (source, key) => Option.getOrElse(String$1.indexOf(`"${key}"`)(source), () => START);
|
|
15280
|
+
const fieldsIn = (source) => pipe(decodeManifest(source), Option.match({
|
|
15281
|
+
onNone: () => [],
|
|
15282
|
+
onSome: (manifest) => {
|
|
15283
|
+
const pnpm = Option.getOrElse(Option.fromUndefinedOr(manifest.pnpm), () => ({}));
|
|
15284
|
+
const pnpmFields = pipe(WORKSPACE_SECTIONS, Array.filter((key) => Record.has(pnpm, key)), Array.map((key) => ({
|
|
15285
|
+
name: `pnpm.${key}`,
|
|
15286
|
+
key
|
|
15287
|
+
})));
|
|
15288
|
+
const managerFields = pipe(MANAGER_FIELDS, Array.filter((key) => Option.isSome(Option.fromUndefinedOr(manifest[key]))), Array.map((key) => ({
|
|
15289
|
+
name: key,
|
|
15290
|
+
key
|
|
15291
|
+
})));
|
|
15292
|
+
return [...pnpmFields, ...managerFields];
|
|
15293
|
+
}
|
|
15294
|
+
}));
|
|
15295
|
+
const manifestProblems = (entry, source) => pipe(fieldsIn(source), Array.map(({ name, key }) => problemAt(entry, source)(keyIndex(source, key), `${name} in package.json is not allowed. ${PLACE} Move it there.`)));
|
|
15296
|
+
const firstEntryProblem = (entry, source, deviations) => pipe(Array.head(deviations.entries), Option.map(({ index }) => problemAt(entry, source)(index, `This file is not read for upstream deviations. ${PLACE}`)), Option.toArray);
|
|
15297
|
+
const problemsIn = (entry, source) => {
|
|
15298
|
+
if (isManifest(entry.name)) return manifestProblems(entry, source);
|
|
15299
|
+
if (String$1.endsWith(NESTED_WORKSPACE)(entry.name)) return firstEntryProblem(entry, source, workspaceDeviations(source));
|
|
15300
|
+
return firstEntryProblem(entry, source, cargoDeviations(source));
|
|
15301
|
+
};
|
|
15302
|
+
const isScanned = ({ name }) => isManifest(name) || String$1.endsWith(NESTED_WORKSPACE)(name) || String$1.endsWith(NESTED_CARGO)(name) || CARGO_CONFIG.test(name);
|
|
15303
|
+
/** @internal */
|
|
15304
|
+
const checkScatteredDeviations = Effect.fn("checkScatteredDeviations")(function* checkScatteredDeviations(root) {
|
|
15305
|
+
const listed = yield* listedFiles(root);
|
|
15306
|
+
return yield* scanText(pipe(listed, Array.filter(isScanned)), problemsIn);
|
|
15307
|
+
});
|
|
14738
15308
|
// src/features/check-workspace-descriptions/model/workspace-descriptions.ts
|
|
14739
15309
|
const RULE = "workspace-description";
|
|
14740
15310
|
const FIRST = 1;
|