@r_masseater/msch 0.115.3 → 0.115.4

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/cli.mjs CHANGED
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { i as nodeRepositoryFiles, n as NODE_MODULES$1, o as TOOL_NAME$1, r as RepositoryFiles, s as groupOf, t as MSCH_CACHE } from "./repository-files-BU_wY36C.mjs";
3
3
  import { $ as isIdentifier, A as uniqueByReference, B as getTextOfJSDocComment, C as moduleSpecifierOf, D as resolvedSymbol, E as referencedSymbols, F as SymbolFlags, G as isCallExpression, H as isArrowFunction, I as SyntaxKind, J as isEnumDeclaration, K as isClassDeclaration, L as getJSDocTags, M as IndexKind, N as InternalSymbolName, O as symbolAt, P as SignatureKind, Q as isFunctionExpression, R as getLeadingCommentRanges, S as moduleSpecifierLiteralOf, St as isVariableStatement, T as propertyNamesOf, U as isBinaryExpression, V as isArrayLiteralExpression, W as isBlock, X as isExpressionStatement, Y as isExportDeclaration, Z as isFunctionDeclaration, _ as isGenericDeclaration, _t as isTypeLiteralNode, a as problemAtPosition, at as isNumericLiteral, b as isTypeDeclaration, bt as isVariableDeclaration, c as carriesTag, ct as isPropertyAccessExpression, d as contains, dt as isSatisfiesExpression, et as isImportDeclaration, f as declarationsOf, ft as isSignatureDeclaration, g as isExternalDeclaration, gt as isTypeAliasDeclaration, h as importedModulesOf, ht as isStringLiteral, i as problemAt$6, it as isNewExpression, j as API, k as symbolAtLocation, l as childrenOf$3, lt as isPropertyAssignment, m as descendantsOf, mt as isSpreadElement, nt as isModuleBlock, o as problemInFile, ot as isObjectLiteralExpression, p as declaresAType, pt as isSourceFile, q as isElementAccessExpression, r as formatProblem, rt as isModuleDeclaration, s as sortProblems, st as isParenthesizedExpression, t as ProblemList, tt as isInterfaceDeclaration, u as columnOf, ut as isReturnStatement, v as isInsideAny, vt as isTypeReferenceNode, w as packageOf$1, x as lineOf$5, xt as isVariableDeclarationList, y as isOutsideDeclaration, yt as isUnionTypeNode, z as getNameOfDeclaration } from "./problem-DaWjnZyW.mjs";
4
- import { S as workspaceDependencies$1, _ as shadcnUiOf, a as workspaceConfigs, b as installedManifest, c as publicEntriesOf, d as splitFrontmatter, h as deployEntries, i as publishedWorkspaces, l as isIndexSkill, m as bundledEntries, o as entryNameOf, p as workspaceLinks, r as packedWorkspaces, s as isBinEntry, u as FRONTMATTER, x as readManifest, y as dependencyEntries } from "./published-J2q6skGp.mjs";
4
+ import { i as workspaceDependencies$1, n as installedManifest, r as readManifest, t as dependencyEntries } from "./dependencies-CgIp-gS1.mjs";
5
5
  import { C as keyName, D as stringsIn, E as propertyValue, S as childrenOf$4, T as nestedValues, a as workspaceManifest, b as workspaceConfigOf, c as TASK_NAMES, d as definesTask, f as hasVerifyTask, i as workspaceProjects, l as TEST_TASK_NAMES, n as unmatchedWorkspacePatterns, r as workspaceDirectories, s as RUN_TASKS, t as publishedProjects, u as VERIFY_TASK, w as literalOf, x as KeySchema } from "./workspace-projects-DYfp6Tpn.mjs";
6
6
  import { a as parent, i as join, n as isInside, t as baseName$1 } from "./path-DUttmo2s.mjs";
7
+ import { _ as shadcnUiOf, a as workspaceConfigs, c as publicEntriesOf, d as splitFrontmatter, h as deployEntries, i as publishedWorkspaces, l as isIndexSkill, m as bundledEntries, o as entryNameOf, p as workspaceLinks, r as packedWorkspaces, s as isBinEntry, u as FRONTMATTER } from "./published-BITU3twH.mjs";
7
8
  import { i as USAGE_SPOOL, n as DECISION_TIMEOUT_MS, r as JAPANESE, t as DECISION_MODEL } from "./config-W6Uy7bV8.mjs";
8
9
  import { a as CI_TASKS, c as meteredCommand, f as isIgnored, h as patternOf$1, m as namedWorkspaces, n as builtTextRuleNames, o as MSCH_TASK_COMMANDS, r as secretsOf, s as MSCH_VERIFY_COMMANDS, t as TEXT_IGNORES, u as existsAt } from "./repository-text-DEyMe2S6.mjs";
9
10
  import { t as startedOnce } from "./started-once-muJbvD_I.mjs";
@@ -44,7 +45,7 @@ import { Base64 } from "effect/encoding";
44
45
  import { CALLS_METRIC, mergeTallies, talliesIn, usageMetricsOf } from "@r_masseater/masseater-utils/usage-meter/report";
45
46
  // package.json
46
47
  var name = "@r_masseater/msch";
47
- var version = "0.115.3";
48
+ var version = "0.115.4";
48
49
  var homepage = "https://github.com/masseater/ecosystems/tree/main/libs/msch#readme";
49
50
  var repository = {
50
51
  "type": "git",
@@ -1191,6 +1192,119 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
1191
1192
  });
1192
1193
  // src/entities/package/model/stack-catalog.ts
1193
1194
  const STACK_CATALOG = "catalog:stack";
1195
+ // src/entities/package/model/specifiers.ts
1196
+ const START$32 = 0;
1197
+ const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
1198
+ const decodeFields$1 = Schema.decodeUnknownOption(FieldsSchema);
1199
+ const decodeString$1 = Schema.decodeUnknownOption(Schema.String);
1200
+ /** @internal */
1201
+ const fieldsOf = (value) => Option.getOrElse(decodeFields$1(value), () => ({}));
1202
+ /** @internal */
1203
+ const namedCatalogsOf = (settings) => Record.toEntries(fieldsOf(settings["catalogs"]));
1204
+ /** @internal */
1205
+ const specifiedIn = (held) => pipe(fieldsOf(held), Record.toEntries, Array$1.flatMap(([name, value]) => pipe(decodeString$1(value), Option.map((specifier) => ({
1206
+ name,
1207
+ specifier
1208
+ })), Option.toArray)));
1209
+ /** @internal */
1210
+ const quoted$1 = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(text);
1211
+ /** @internal */
1212
+ const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted$1(name)}"\\s*:\\s*"${quoted$1(specifier)}"`, "u");
1213
+ /** @internal */
1214
+ const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$32));
1215
+ const SECTIONS$1 = [
1216
+ "dependencies",
1217
+ "devDependencies",
1218
+ "optionalDependencies"
1219
+ ];
1220
+ /** @internal */
1221
+ const manifestSpecifiers = (source) => pipe(decodePackageJson(source), Option.map((manifest) => pipe(SECTIONS$1, Array$1.flatMap((section) => specifiedIn(manifest[section])))), Option.getOrElse(() => []));
1222
+ // src/entities/package/model/published-manifest.ts
1223
+ const EXCLUDED$9 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
1224
+ const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
1225
+ const publishedManifestOf = (source) => pipe(source, Option.flatMap(decodePackageJson), Option.filter(isPublished$1));
1226
+ /** @internal */
1227
+ const scanPublishedManifests = Effect.fn("scanPublishedManifests")(function* scanPublishedManifests(root, problemsIn) {
1228
+ const files = yield* RepositoryFiles;
1229
+ const manifests = yield* files.matchingFiles(root, [`:(glob)**/${PACKAGE_JSON_FILE}`, ...EXCLUDED$9]);
1230
+ return yield* scanText(pipe(manifests, Array$1.map((name) => ({
1231
+ name,
1232
+ file: files.join(root, name)
1233
+ }))), (entry, source) => pipe(publishedManifestOf(Option.some(source)), Option.map((manifest) => problemsIn({
1234
+ entry,
1235
+ source,
1236
+ manifest
1237
+ })), Option.getOrElse(() => [])));
1238
+ });
1239
+ // src/shared/config/self.ts
1240
+ const GIT_PREFIX = /^git\+/u;
1241
+ const GIT_SUFFIX = /\.git$/u;
1242
+ const GITHUB$6 = "https://github.com/";
1243
+ const SELF_NAME = name;
1244
+ const SELF_HOMEPAGE = homepage;
1245
+ const SELF_DIRECTORY = repository.directory;
1246
+ const RENOVATE_PRESET = `github>${pipe(repository.url, String$1.replace(GIT_PREFIX, ""), String$1.replace(GIT_SUFFIX, ""), String$1.replace(GITHUB$6, ""))}//${SELF_DIRECTORY}/renovate`;
1247
+ // src/features/check-overrides/model/removed-peers.ts
1248
+ const RULE$74 = "removed-peer";
1249
+ const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
1250
+ const REMOVED = "-";
1251
+ const PARENT_SEPARATOR = ">";
1252
+ const VERSION_SEPARATOR = "@";
1253
+ const SCOPED_START = 1;
1254
+ const packageNameOf$1 = (selector) => pipe(String$1.indexOf(VERSION_SEPARATOR)(String$1.slice(SCOPED_START)(selector)), Option.match({
1255
+ onNone: () => selector,
1256
+ onSome: (index) => String$1.takeLeft(selector, index + SCOPED_START)
1257
+ }));
1258
+ const removalOf$1 = (key) => Array$1.matchRight(String$1.split(key, PARENT_SEPARATOR), {
1259
+ onEmpty: () => Option.none(),
1260
+ onNonEmpty: (parents, target) => Option.some({
1261
+ key,
1262
+ target: packageNameOf$1(target),
1263
+ parent: pipe(Array$1.last(parents), Option.map(packageNameOf$1))
1264
+ })
1265
+ });
1266
+ const removesPeer = ({ target, parent }) => ({ peer, dependent }) => peer === target && Option.match(parent, {
1267
+ onNone: () => true,
1268
+ onSome: (name) => name === dependent
1269
+ });
1270
+ const isRemoval = (value) => value === REMOVED;
1271
+ const problemAt$4 = (file, { key, line, column }) => ({ peer, dependent }) => ({
1272
+ file,
1273
+ line,
1274
+ column,
1275
+ rule: RULE$74,
1276
+ message: `msch runs ${dependent}, which needs ${peer} as a peer, so removing ${peer} with the override ${key} breaks msch. Remove the override.`
1277
+ });
1278
+ const removalsIn = (overrides) => pipe(overrides, Record.filter(isRemoval));
1279
+ const firstRemovedPeer = (peers) => (removal) => pipe(peers, Array$1.findFirst(removesPeer(removal)));
1280
+ const removedPeerProblems = (peers) => ({ file, source, overrides }) => pipe(overrideKeysOf(source)(removalsIn(overrides)), Array$1.flatMap((located) => pipe(removalOf$1(located.key), Option.flatMap(firstRemovedPeer(peers)), Option.map(problemAt$4(file, located)), Option.toArray)));
1281
+ const requiredPeersOf$1 = (dependent, manifest) => pipe(Record.keys(manifest.peerDependencies ?? {}), Array$1.difference(optionalPeerNames(manifest)), Array$1.map((peer) => ({
1282
+ peer,
1283
+ dependent
1284
+ })));
1285
+ const mschPeers = Effect.fn("mschPeers")(function* mschPeers() {
1286
+ const files = yield* RepositoryFiles;
1287
+ const own = findPackageJson(SELF_NAME, import.meta.url);
1288
+ if (Option.isNone(own)) return [];
1289
+ const manifest = yield* readManifest(files.dirname(own.value));
1290
+ const dependencies = pipe(manifest, Option.map(({ dependencies: held }) => Record.keys(held ?? {})), Option.getOrElse(() => []));
1291
+ const found = yield* Effect.forEach(dependencies, (dependency) => Effect.map(installedManifest(dependency, own.value), (installed) => pipe(installed, Option.map((held) => requiredPeersOf$1(dependency, held)), Option.getOrElse(() => []))), { concurrency: 1 });
1292
+ return Array$1.flatten(found);
1293
+ });
1294
+ /** @internal */
1295
+ const checkRemovedPeers = Effect.fn("checkRemovedPeers")(function* checkRemovedPeers(root) {
1296
+ const files = yield* RepositoryFiles;
1297
+ const overrides = yield* workspaceOverrides(root);
1298
+ if (!pipe(Record.values(overrides), Array$1.some(isRemoval))) return [];
1299
+ const file = files.join(root, WORKSPACE_FILE$5);
1300
+ const source = yield* files.readFile(file);
1301
+ const peers = yield* mschPeers();
1302
+ return removedPeerProblems(peers)({
1303
+ file,
1304
+ source: Option.getOrElse(source, () => ""),
1305
+ overrides
1306
+ });
1307
+ });
1194
1308
  // ../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
1195
1309
  const balanced = (a, b, str) => {
1196
1310
  const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
@@ -3298,119 +3412,6 @@ const matcher = (patterns) => {
3298
3412
  };
3299
3413
  String$1.startsWith(NEGATION$1);
3300
3414
  String$1.slice(1);
3301
- // src/entities/package/model/specifiers.ts
3302
- const START$32 = 0;
3303
- const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
3304
- const decodeFields$1 = Schema.decodeUnknownOption(FieldsSchema);
3305
- const decodeString$1 = Schema.decodeUnknownOption(Schema.String);
3306
- /** @internal */
3307
- const fieldsOf = (value) => Option.getOrElse(decodeFields$1(value), () => ({}));
3308
- /** @internal */
3309
- const namedCatalogsOf = (settings) => Record.toEntries(fieldsOf(settings["catalogs"]));
3310
- /** @internal */
3311
- const specifiedIn = (held) => pipe(fieldsOf(held), Record.toEntries, Array$1.flatMap(([name, value]) => pipe(decodeString$1(value), Option.map((specifier) => ({
3312
- name,
3313
- specifier
3314
- })), Option.toArray)));
3315
- /** @internal */
3316
- const quoted$1 = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(text);
3317
- /** @internal */
3318
- const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted$1(name)}"\\s*:\\s*"${quoted$1(specifier)}"`, "u");
3319
- /** @internal */
3320
- const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$32));
3321
- const SECTIONS$1 = [
3322
- "dependencies",
3323
- "devDependencies",
3324
- "optionalDependencies"
3325
- ];
3326
- /** @internal */
3327
- const manifestSpecifiers = (source) => pipe(decodePackageJson(source), Option.map((manifest) => pipe(SECTIONS$1, Array$1.flatMap((section) => specifiedIn(manifest[section])))), Option.getOrElse(() => []));
3328
- // src/entities/package/model/published-manifest.ts
3329
- const EXCLUDED$9 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
3330
- const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
3331
- const publishedManifestOf = (source) => pipe(source, Option.flatMap(decodePackageJson), Option.filter(isPublished$1));
3332
- /** @internal */
3333
- const scanPublishedManifests = Effect.fn("scanPublishedManifests")(function* scanPublishedManifests(root, problemsIn) {
3334
- const files = yield* RepositoryFiles;
3335
- const manifests = yield* files.matchingFiles(root, [`:(glob)**/${PACKAGE_JSON_FILE}`, ...EXCLUDED$9]);
3336
- return yield* scanText(pipe(manifests, Array$1.map((name) => ({
3337
- name,
3338
- file: files.join(root, name)
3339
- }))), (entry, source) => pipe(publishedManifestOf(Option.some(source)), Option.map((manifest) => problemsIn({
3340
- entry,
3341
- source,
3342
- manifest
3343
- })), Option.getOrElse(() => [])));
3344
- });
3345
- // src/shared/config/self.ts
3346
- const GIT_PREFIX = /^git\+/u;
3347
- const GIT_SUFFIX = /\.git$/u;
3348
- const GITHUB$6 = "https://github.com/";
3349
- const SELF_NAME = name;
3350
- const SELF_HOMEPAGE = homepage;
3351
- const SELF_DIRECTORY = repository.directory;
3352
- const RENOVATE_PRESET = `github>${pipe(repository.url, String$1.replace(GIT_PREFIX, ""), String$1.replace(GIT_SUFFIX, ""), String$1.replace(GITHUB$6, ""))}//${SELF_DIRECTORY}/renovate`;
3353
- // src/features/check-overrides/model/removed-peers.ts
3354
- const RULE$74 = "removed-peer";
3355
- const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
3356
- const REMOVED = "-";
3357
- const PARENT_SEPARATOR = ">";
3358
- const VERSION_SEPARATOR = "@";
3359
- const SCOPED_START = 1;
3360
- const packageNameOf$1 = (selector) => pipe(String$1.indexOf(VERSION_SEPARATOR)(String$1.slice(SCOPED_START)(selector)), Option.match({
3361
- onNone: () => selector,
3362
- onSome: (index) => String$1.takeLeft(selector, index + SCOPED_START)
3363
- }));
3364
- const removalOf$1 = (key) => Array$1.matchRight(String$1.split(key, PARENT_SEPARATOR), {
3365
- onEmpty: () => Option.none(),
3366
- onNonEmpty: (parents, target) => Option.some({
3367
- key,
3368
- target: packageNameOf$1(target),
3369
- parent: pipe(Array$1.last(parents), Option.map(packageNameOf$1))
3370
- })
3371
- });
3372
- const removesPeer = ({ target, parent }) => ({ peer, dependent }) => peer === target && Option.match(parent, {
3373
- onNone: () => true,
3374
- onSome: (name) => name === dependent
3375
- });
3376
- const isRemoval = (value) => value === REMOVED;
3377
- const problemAt$4 = (file, { key, line, column }) => ({ peer, dependent }) => ({
3378
- file,
3379
- line,
3380
- column,
3381
- rule: RULE$74,
3382
- message: `msch runs ${dependent}, which needs ${peer} as a peer, so removing ${peer} with the override ${key} breaks msch. Remove the override.`
3383
- });
3384
- const removalsIn = (overrides) => pipe(overrides, Record.filter(isRemoval));
3385
- const firstRemovedPeer = (peers) => (removal) => pipe(peers, Array$1.findFirst(removesPeer(removal)));
3386
- const removedPeerProblems = (peers) => ({ file, source, overrides }) => pipe(overrideKeysOf(source)(removalsIn(overrides)), Array$1.flatMap((located) => pipe(removalOf$1(located.key), Option.flatMap(firstRemovedPeer(peers)), Option.map(problemAt$4(file, located)), Option.toArray)));
3387
- const requiredPeersOf$1 = (dependent, manifest) => pipe(Record.keys(manifest.peerDependencies ?? {}), Array$1.difference(optionalPeerNames(manifest)), Array$1.map((peer) => ({
3388
- peer,
3389
- dependent
3390
- })));
3391
- const mschPeers = Effect.fn("mschPeers")(function* mschPeers() {
3392
- const files = yield* RepositoryFiles;
3393
- const own = findPackageJson(SELF_NAME, import.meta.url);
3394
- if (Option.isNone(own)) return [];
3395
- const manifest = yield* readManifest(files.dirname(own.value));
3396
- const dependencies = pipe(manifest, Option.map(({ dependencies: held }) => Record.keys(held ?? {})), Option.getOrElse(() => []));
3397
- const found = yield* Effect.forEach(dependencies, (dependency) => Effect.map(installedManifest(dependency, own.value), (installed) => pipe(installed, Option.map((held) => requiredPeersOf$1(dependency, held)), Option.getOrElse(() => []))), { concurrency: 1 });
3398
- return Array$1.flatten(found);
3399
- });
3400
- /** @internal */
3401
- const checkRemovedPeers = Effect.fn("checkRemovedPeers")(function* checkRemovedPeers(root) {
3402
- const files = yield* RepositoryFiles;
3403
- const overrides = yield* workspaceOverrides(root);
3404
- if (!pipe(Record.values(overrides), Array$1.some(isRemoval))) return [];
3405
- const file = files.join(root, WORKSPACE_FILE$5);
3406
- const source = yield* files.readFile(file);
3407
- const peers = yield* mschPeers();
3408
- return removedPeerProblems(peers)({
3409
- file,
3410
- source: Option.getOrElse(source, () => ""),
3411
- overrides
3412
- });
3413
- });
3414
3415
  // src/features/check-placement/model/colocated-git-patterns.ts
3415
3416
  const RULE$73 = "colocated-git-patterns";
3416
3417
  const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
@@ -14068,7 +14069,12 @@ var BundleFailed = class extends taggedError$11()("BundleFailed", { detail: Sche
14068
14069
  const failed = (error) => BundleFailed.make({ detail: bundleErrorDetail(error) });
14069
14070
  const isBare = (specifier) => !String$1.startsWith(RELATIVE_PREFIX)(specifier) && !String$1.startsWith(SUBPATH_IMPORT)(specifier) && !ABSOLUTE.test(specifier) && !String$1.startsWith(VIRTUAL_PREFIX)(specifier);
14070
14071
  const isBuiltin$1 = (specifier) => String$1.startsWith(NODE_PROTOCOL)(specifier) || builtins.has(packageNameOf(specifier));
14071
- const isExternal = ({ declared, bundled }) => (specifier, importer) => Predicate.isNotUndefined(importer) && isBare(specifier) && (isBuiltin$1(specifier) || Array$1.contains(declared, packageNameOf(specifier)) && !Array$1.contains(bundled, packageNameOf(specifier)));
14072
+ const matchesPattern = (name) => (pattern) => {
14073
+ if (Predicate.isString(pattern)) return pattern === name;
14074
+ return pattern.test(name);
14075
+ };
14076
+ const isBundledBy = (bundled, name) => pipe(bundled, Array$1.some(matchesPattern(name)));
14077
+ const isExternal = ({ declared, bundled }) => (specifier, importer) => Predicate.isNotUndefined(importer) && isBare(specifier) && (isBuiltin$1(specifier) || Array$1.contains(declared, packageNameOf(specifier)) && !isBundledBy(bundled, packageNameOf(specifier)));
14072
14078
  const consumerSource = ({ entry, member }) => Option.match(member, {
14073
14079
  onNone: () => `export * from ${quote(entry)};\n`,
14074
14080
  onSome: (name) => `import * as ${NAMESPACE} from ${quote(entry)};\nglobalThis.used = ${NAMESPACE}[${quote(name)}];\n`