@r_masseater/msch 0.60.2 → 0.61.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.
Files changed (35) hide show
  1. package/README.md +1 -0
  2. package/dist/{app-DcgzLzb0.mjs → app-BwjhFdKD.mjs} +2 -2
  3. package/dist/{app-DcgzLzb0.mjs.map → app-BwjhFdKD.mjs.map} +1 -1
  4. package/dist/cargo-inputs.mjs +1 -1
  5. package/dist/changed.mjs +1 -1
  6. package/dist/cli.mjs +429 -591
  7. package/dist/cli.mjs.map +1 -1
  8. package/dist/exits.mjs +1 -1
  9. package/dist/fix.d.mts +1 -0
  10. package/dist/fix.mjs +96 -0
  11. package/dist/fix.mjs.map +1 -0
  12. package/dist/lint-rules.mjs +3 -5
  13. package/dist/lint-rules.mjs.map +1 -1
  14. package/dist/oxlint.mjs +1 -1
  15. package/dist/pack-settings-FN4-vi6J.mjs +225 -0
  16. package/dist/pack-settings-FN4-vi6J.mjs.map +1 -0
  17. package/dist/{pass-records-BCT1Ls9c.mjs → pass-records-CFIrQmB5.mjs} +2 -2
  18. package/dist/{pass-records-BCT1Ls9c.mjs.map → pass-records-CFIrQmB5.mjs.map} +1 -1
  19. package/dist/{problem-BoHYLMQT.mjs → problem-D2HKNIVq.mjs} +2 -2
  20. package/dist/{problem-BoHYLMQT.mjs.map → problem-D2HKNIVq.mjs.map} +1 -1
  21. package/dist/publish.mjs +73 -64
  22. package/dist/publish.mjs.map +1 -1
  23. package/dist/{published-D87PrlyG.mjs → published-BIexKvdJ.mjs} +2 -2
  24. package/dist/{published-D87PrlyG.mjs.map → published-BIexKvdJ.mjs.map} +1 -1
  25. package/dist/{syntax-CTiXR0EJ.mjs → syntax-C0ddqOHc.mjs} +4 -3
  26. package/dist/syntax-C0ddqOHc.mjs.map +1 -0
  27. package/dist/text-position-DrvZ7k2Y.mjs +17 -0
  28. package/dist/text-position-DrvZ7k2Y.mjs.map +1 -0
  29. package/dist/{upstream-exits-DitN-yYH.mjs → upstream-exits-DgkAyuu-.mjs} +3 -15
  30. package/dist/upstream-exits-DgkAyuu-.mjs.map +1 -0
  31. package/dist/workspace-settings.mjs +1 -1
  32. package/package.json +3 -2
  33. package/skills/msch-checks/SKILL.md +10 -0
  34. package/dist/syntax-CTiXR0EJ.mjs.map +0 -1
  35. package/dist/upstream-exits-DitN-yYH.mjs.map +0 -1
package/dist/publish.mjs CHANGED
@@ -45,18 +45,61 @@ const succeeds = succeedsWith;
45
45
  const mustSucceed = mustSucceedWith;
46
46
  /** @internal */
47
47
  const outputOf = outputWith;
48
+ // src/features/publish-workspace/model/export-targets.ts
49
+ const PATTERN$1 = "*";
50
+ const MANIFEST_FILE$4 = "package.json";
51
+ const taggedError$4 = Schema.TaggedError;
52
+ /** @internal */
53
+ var MissingExportTargets = class extends taggedError$4()("MissingExportTargets", { message: Schema.String }) {};
54
+ const AnyExports = Schema.optionalKey(Schema.Unknown);
55
+ const PublishConfig$1 = Schema.Struct({ exports: AnyExports });
56
+ const PublishedExports = Schema.fromJsonString(Schema.Struct({
57
+ exports: AnyExports,
58
+ publishConfig: Schema.optionalKey(PublishConfig$1)
59
+ }));
60
+ const singleTarget = (target) => {
61
+ if (String$1.includes(PATTERN$1)(target)) return [];
62
+ return [target];
63
+ };
64
+ /** @internal */
65
+ const foldExports = (cases) => (exports) => {
66
+ if (Predicate.isString(exports)) return cases.string(exports);
67
+ if (Array.isArray(exports)) return cases.array(exports);
68
+ if (Predicate.isReadonlyObject(exports)) return cases.object(exports);
69
+ return cases.other();
70
+ };
71
+ /** @internal */
72
+ const exportTargetsOf = (exports) => foldExports({
73
+ string: singleTarget,
74
+ array: Array.flatMap(exportTargetsOf),
75
+ object: (record) => Array.flatMap(Record.values(record), exportTargetsOf),
76
+ other: () => []
77
+ })(exports);
78
+ const publishedExportsOf = (manifest) => pipe(Option.fromUndefinedOr(manifest.publishConfig), Option.flatMap((config) => Option.fromUndefinedOr(config.exports)), Option.orElse(() => Option.fromUndefinedOr(manifest.exports)), Option.getOrUndefined);
79
+ const missingMessage = (missing) => `The published exports point to files the build did not write: ${Array.join(missing, ", ")}`;
80
+ /** @internal */
81
+ const checkExportTargets = Effect.fn("publish.checkExportTargets")(function* checkExportTargets(directory) {
82
+ const fileSystem = yield* FileSystem.FileSystem;
83
+ const path = yield* Path.Path;
84
+ const manifest = yield* fileSystem.readFileString(path.join(directory, MANIFEST_FILE$4)).pipe(Effect.flatMap(Schema.decodeEffect(PublishedExports)));
85
+ const missing = yield* Effect.filter(exportTargetsOf(publishedExportsOf(manifest)), (target) => Effect.map(fileSystem.exists(path.join(directory, target)), (found) => !found));
86
+ return yield* pipe(missing, Array.match({
87
+ onEmpty: () => Effect.void,
88
+ onNonEmpty: (list) => Effect.fail(MissingExportTargets.make({ message: missingMessage(list) }))
89
+ }));
90
+ });
48
91
  // src/features/publish-workspace/model/compat-manifest.ts
49
92
  const PACKAGE_JSON_EXPORT = "./package.json";
50
- const PATTERN$1 = "*";
93
+ const PATTERN = "*";
51
94
  const ROOT_EXPORT = ".";
52
95
  const UNVERSIONED$2 = "0.0.0";
53
96
  const VITE = "vite";
54
97
  /** @internal */
55
98
  const VITE_PLUS = "vite-plus";
56
99
  const TYPES = "types";
57
- const taggedError$4 = Schema.TaggedError;
100
+ const taggedError$3 = Schema.TaggedError;
58
101
  /** @internal */
59
- var IncompatiblePackage = class extends taggedError$4()("IncompatiblePackage", { message: Schema.String }) {};
102
+ var IncompatiblePackage = class extends taggedError$3()("IncompatiblePackage", { message: Schema.String }) {};
60
103
  const Declared = Schema.Record(Schema.String, Schema.String);
61
104
  const VitePlusManifestJson = Schema.fromJsonString(Schema.Struct({ dependencies: Schema.optionalKey(Declared) }));
62
105
  const Bin = Schema.Union([Schema.String, Declared]);
@@ -65,7 +108,7 @@ const Native$1 = Schema.Struct({
65
108
  targets: Schema.Array(Schema.String)
66
109
  });
67
110
  const Engines = Schema.Struct({ node: Schema.optionalKey(Schema.String) });
68
- const PublishConfig$1 = Schema.Struct({
111
+ const PublishConfig = Schema.Struct({
69
112
  exports: Schema.optionalKey(Schema.Unknown),
70
113
  bin: Schema.optionalKey(Bin)
71
114
  });
@@ -81,7 +124,7 @@ const CompatManifestJson = Schema.fromJsonString(Schema.Struct({
81
124
  optionalDependencies: Schema.optionalKey(Declared),
82
125
  engines: Schema.optionalKey(Engines),
83
126
  peerDependencies: Schema.optionalKey(Declared),
84
- publishConfig: Schema.optionalKey(PublishConfig$1)
127
+ publishConfig: Schema.optionalKey(PublishConfig)
85
128
  }));
86
129
  const lowestOf = (range) => pipe(Option.fromNullishOr(semver.validRange(range)), Option.flatMap(() => Option.fromNullishOr(semver.minVersion(range))), Option.map(({ version }) => version));
87
130
  const floorOf = (version) => {
@@ -124,15 +167,17 @@ const isTypesOnly = (target) => Option.match(target, {
124
167
  onNone: () => false,
125
168
  onSome: (value) => Predicate.isReadonlyObject(value) && pipe(Record.keys(value), Array.every((key) => key === TYPES))
126
169
  });
127
- const subpathsOf = (exports) => {
128
- if (Predicate.isString(exports)) return [ROOT_EXPORT];
129
- if (Predicate.isReadonlyObject(exports)) {
130
- const keys = Record.keys(exports);
131
- if (pipe(keys, Array.every(String$1.startsWith(ROOT_EXPORT)))) return pipe(keys, Array.filter((key) => key !== PACKAGE_JSON_EXPORT && !String$1.includes(PATTERN$1)(key)), Array.filter((key) => !isTypesOnly(Record.get(exports, key))));
132
- return [ROOT_EXPORT];
133
- }
134
- return [];
170
+ const exportedSubpaths = (exports) => {
171
+ const keys = Record.keys(exports);
172
+ if (!pipe(keys, Array.every(String$1.startsWith(ROOT_EXPORT)))) return [ROOT_EXPORT];
173
+ return pipe(keys, Array.filter((key) => key !== PACKAGE_JSON_EXPORT && !String$1.includes(PATTERN)(key)), Array.filter((key) => !isTypesOnly(Record.get(exports, key))));
135
174
  };
175
+ const subpathsOf = foldExports({
176
+ string: () => [ROOT_EXPORT],
177
+ array: () => [ROOT_EXPORT],
178
+ object: exportedSubpaths,
179
+ other: () => []
180
+ });
136
181
  const specifierOf = (name, subpath) => {
137
182
  if (subpath === ROOT_EXPORT) return name;
138
183
  return `${name}${String$1.replace(ROOT_EXPORT, "")(subpath)}`;
@@ -217,7 +262,7 @@ const nativeReadme = ({ name, target }) => `# ${name}-${target}\n\nThe prebuilt
217
262
  // src/features/publish-workspace/model/native-package.ts
218
263
  const NPM_DIR = "npm";
219
264
  const NATIVE_DIR = "native";
220
- const MANIFEST_FILE$4 = "package.json";
265
+ const MANIFEST_FILE$3 = "package.json";
221
266
  const KEPT_FIELDS = [
222
267
  "license",
223
268
  "repository",
@@ -230,7 +275,7 @@ const PackageJson = Schema.fromJsonString(Schema.Record(Schema.String, Schema.Un
230
275
  const keptFields = Effect.fn("publish.keptFields")(function* keptFields(directory) {
231
276
  const fileSystem = yield* FileSystem.FileSystem;
232
277
  const path = yield* Path.Path;
233
- const text = yield* fileSystem.readFileString(path.join(directory, MANIFEST_FILE$4));
278
+ const text = yield* fileSystem.readFileString(path.join(directory, MANIFEST_FILE$3));
234
279
  const raw = yield* Schema.decodeEffect(PackageJson)(text);
235
280
  return pipe(raw, Record.filter((_value, key) => Array.contains(KEPT_FIELDS, key)));
236
281
  });
@@ -247,7 +292,7 @@ const writeNative = Effect.fn("publish.writeNative")(function* writeNative(direc
247
292
  ...kept,
248
293
  ...nativeFields(native)
249
294
  });
250
- yield* Effect.all([fileSystem.writeFileString(path.join(target, MANIFEST_FILE$4), text), fileSystem.writeFileString(path.join(target, "README.md"), nativeReadme(native))], { concurrency: "unbounded" });
295
+ yield* Effect.all([fileSystem.writeFileString(path.join(target, MANIFEST_FILE$3), text), fileSystem.writeFileString(path.join(target, "README.md"), nativeReadme(native))], { concurrency: "unbounded" });
251
296
  return target;
252
297
  });
253
298
  // src/features/publish-workspace/model/widened-ranges.ts
@@ -371,7 +416,7 @@ const workspaceTarballs = Effect.fn("compat.local")(function* workspaceTarballs(
371
416
  return Record.fromEntries(Array.flatten(packed));
372
417
  });
373
418
  // src/features/publish-workspace/model/compat.ts
374
- const MANIFEST_FILE$3 = "package.json";
419
+ const MANIFEST_FILE$2 = "package.json";
375
420
  const INSTALL_FLAGS = ["--no-audit", "--no-fund"];
376
421
  const LOAD_FAILURE = String.raw`/ERR_(MODULE_NOT_FOUND|PACKAGE_|INVALID_PACKAGE|UNKNOWN_FILE|UNSUPPORTED_DIR|REQUIRE_ESM)|SyntaxError/u`;
377
422
  const IMPORT_ONLY = "await import(process.argv[1])";
@@ -407,21 +452,21 @@ const installedNode = Effect.fn("compat.node")(function* installedNode(directory
407
452
  binary: path.join(directory, "node_modules", "node", "bin", "node")
408
453
  };
409
454
  });
410
- const fileEntries = (tarballs) => pipe(Record.toEntries(tarballs), Array.map(([name, file]) => [name, `file:${file}`]));
411
- const siblingOverrides = (tarballs) => pipe(Record.keys(tarballs), Array.map((sibling) => [sibling, `$${sibling}`]));
412
455
  const consumerJson = Effect.fn("compat.json")(function* consumerJson({ peers, tarballs }) {
413
- const dependencies = Record.fromEntries([...Record.toEntries(peers), ...fileEntries(tarballs)]);
414
456
  return yield* Schema.encodeEffect(ConsumerJson)({
415
457
  private: true,
416
458
  type: "module",
417
- dependencies,
418
- overrides: Record.fromEntries(siblingOverrides(tarballs))
459
+ dependencies: {
460
+ ...peers,
461
+ ...pipe(tarballs, Record.map((file) => `file:${file}`))
462
+ },
463
+ overrides: Record.fromIterableWith(Record.keys(tarballs), (sibling) => [sibling, `$${sibling}`])
419
464
  });
420
465
  });
421
466
  const withViteOfVitePlus = Effect.fn("compat.vite")(function* withViteOfVitePlus(directory) {
422
467
  const fileSystem = yield* FileSystem.FileSystem;
423
468
  const path = yield* Path.Path;
424
- const text = yield* fileSystem.readFileString(path.join(directory, "node_modules", VITE_PLUS, MANIFEST_FILE$3));
469
+ const text = yield* fileSystem.readFileString(path.join(directory, "node_modules", VITE_PLUS, MANIFEST_FILE$2));
425
470
  yield* Option.match(viteAliasOf(text), {
426
471
  onNone: () => Effect.void,
427
472
  onSome: (alias) => mustSucceed({
@@ -443,7 +488,7 @@ const installedConsumer = Effect.fn("compat.consumer")(function* installedConsum
443
488
  const directory = path.join(root, "consumer");
444
489
  yield* fileSystem.makeDirectory(directory, { recursive: true });
445
490
  const text = yield* consumerJson(consumer);
446
- yield* fileSystem.writeFileString(path.join(directory, MANIFEST_FILE$3), text);
491
+ yield* fileSystem.writeFileString(path.join(directory, MANIFEST_FILE$2), text);
447
492
  yield* mustSucceed({
448
493
  command: "npm",
449
494
  args: [
@@ -521,7 +566,7 @@ const checkCompat = Effect.fn("publish.compat")(function* checkCompat(directory)
521
566
  });
522
567
  }, Effect.scoped);
523
568
  // src/features/publish-workspace/model/manifest.ts
524
- const MANIFEST_FILE$2 = "package.json";
569
+ const MANIFEST_FILE$1 = "package.json";
525
570
  const SCOPE = /^@[^/]+\//u;
526
571
  const UNVERSIONED$1 = "0.0.0";
527
572
  const ROOT = ".";
@@ -541,7 +586,7 @@ const ManifestSchema = Schema.Struct({
541
586
  const manifestIn = Effect.fn("publish.manifest")(function* manifestIn(directory) {
542
587
  const fileSystem = yield* FileSystem.FileSystem;
543
588
  const path = yield* Path.Path;
544
- const text = yield* fileSystem.readFileString(path.join(directory, MANIFEST_FILE$2));
589
+ const text = yield* fileSystem.readFileString(path.join(directory, MANIFEST_FILE$1));
545
590
  return yield* Schema.decodeEffect(Schema.fromJsonString(ManifestSchema))(text);
546
591
  });
547
592
  /** @internal */
@@ -572,9 +617,9 @@ const onNpm = ({ directory, name, version }) => succeeds({
572
617
  ],
573
618
  cwd: directory
574
619
  });
575
- const taggedError$3 = Schema.TaggedError;
620
+ const taggedError$2 = Schema.TaggedError;
576
621
  /** @internal */
577
- var UnpublishedDependencies = class extends taggedError$3()("UnpublishedDependencies", { message: Schema.String }) {};
622
+ var UnpublishedDependencies = class extends taggedError$2()("UnpublishedDependencies", { message: Schema.String }) {};
578
623
  const workspaceDependencies = (manifest) => pipe(Option.fromUndefinedOr(manifest.dependencies), Option.map((dependencies) => pipe(dependencies, Record.filter(String$1.startsWith(WORKSPACE_PROTOCOL)), Record.keys)), Option.getOrElse(() => []));
579
624
  const failWhenMissing = (missing, manifest) => {
580
625
  if (Array.isReadonlyArrayEmpty(missing)) return Effect.void;
@@ -897,42 +942,6 @@ const writeCompatPlan = Effect.fn("publish.compatPlan")(function* writeCompatPla
897
942
  yield* Effect.logInfo(encoded);
898
943
  yield* writeOutputs({ directories: encoded });
899
944
  });
900
- // src/features/publish-workspace/model/export-targets.ts
901
- const PATTERN = "*";
902
- const MANIFEST_FILE$1 = "package.json";
903
- const taggedError$2 = Schema.TaggedError;
904
- /** @internal */
905
- var MissingExportTargets = class extends taggedError$2()("MissingExportTargets", { message: Schema.String }) {};
906
- const AnyExports = Schema.optionalKey(Schema.Unknown);
907
- const PublishConfig = Schema.Struct({ exports: AnyExports });
908
- const PublishedExports = Schema.fromJsonString(Schema.Struct({
909
- exports: AnyExports,
910
- publishConfig: Schema.optionalKey(PublishConfig)
911
- }));
912
- const singleTarget = (target) => {
913
- if (String$1.includes(PATTERN)(target)) return [];
914
- return [target];
915
- };
916
- /** @internal */
917
- const exportTargetsOf = (exports) => {
918
- if (Predicate.isString(exports)) return singleTarget(exports);
919
- if (Array.isArray(exports)) return pipe(exports, Array.flatMap((entry) => exportTargetsOf(entry)));
920
- if (Predicate.isReadonlyObject(exports)) return pipe(Record.values(exports), Array.flatMap((entry) => exportTargetsOf(entry)));
921
- return [];
922
- };
923
- const publishedExportsOf = (manifest) => pipe(Option.fromUndefinedOr(manifest.publishConfig), Option.flatMap((config) => Option.fromUndefinedOr(config.exports)), Option.orElse(() => Option.fromUndefinedOr(manifest.exports)), Option.getOrUndefined);
924
- const missingMessage = (missing) => `The published exports point to files the build did not write: ${Array.join(missing, ", ")}`;
925
- /** @internal */
926
- const checkExportTargets = Effect.fn("publish.checkExportTargets")(function* checkExportTargets(directory) {
927
- const fileSystem = yield* FileSystem.FileSystem;
928
- const path = yield* Path.Path;
929
- const manifest = yield* fileSystem.readFileString(path.join(directory, MANIFEST_FILE$1)).pipe(Effect.flatMap(Schema.decodeEffect(PublishedExports)));
930
- const missing = yield* Effect.filter(exportTargetsOf(publishedExportsOf(manifest)), (target) => Effect.map(fileSystem.exists(path.join(directory, target)), (found) => !found));
931
- return yield* pipe(missing, Array.match({
932
- onEmpty: () => Effect.void,
933
- onNonEmpty: (list) => Effect.fail(MissingExportTargets.make({ message: missingMessage(list) }))
934
- }));
935
- });
936
945
  // src/features/publish-workspace/model/npm.ts
937
946
  const MANIFEST_FILE = "package.json";
938
947
  const PUBLISH_FLAGS = [