@r_masseater/msch 0.72.0 → 0.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/changed.mjs +3 -3
  2. package/dist/cli.mjs +161 -266
  3. package/dist/cli.mjs.map +1 -1
  4. package/dist/config.d.mts +1 -1
  5. package/dist/{dependencies-C3kCe35Q.mjs → dependencies-BAjtDvY4.mjs} +27 -55
  6. package/dist/dependencies-BAjtDvY4.mjs.map +1 -0
  7. package/dist/exits.mjs +1 -1
  8. package/dist/{index-CWZNFtdG.d.mts → index-CHxAqDok.d.mts} +3 -6
  9. package/dist/lint-rules.mjs +2 -2
  10. package/dist/lint-rules.mjs.map +1 -1
  11. package/dist/{manifest-texts-K650kDy8.mjs → manifest-texts-CfnH7ifu.mjs} +4 -6
  12. package/dist/manifest-texts-CfnH7ifu.mjs.map +1 -0
  13. package/dist/{pass-records-kbx5VgwI.mjs → pass-records-DylVXWk1.mjs} +5 -4
  14. package/dist/pass-records-DylVXWk1.mjs.map +1 -0
  15. package/dist/publish.mjs +45 -135
  16. package/dist/publish.mjs.map +1 -1
  17. package/dist/{published-CpfXkChq.mjs → published-Bj0gR5IF.mjs} +27 -91
  18. package/dist/published-Bj0gR5IF.mjs.map +1 -0
  19. package/dist/published.mjs +9 -9
  20. package/dist/published.mjs.map +1 -1
  21. package/dist/refs.mjs +1 -1
  22. package/dist/{runtime-Q9CzisOt.mjs → runtime-CFZ41rB0.mjs} +9 -2
  23. package/dist/runtime-CFZ41rB0.mjs.map +1 -0
  24. package/dist/wake.mjs +1 -1
  25. package/dist/workspace-manifest-CAVYfp66.mjs +8 -0
  26. package/dist/workspace-manifest-CAVYfp66.mjs.map +1 -0
  27. package/dist/workspace-settings.d.mts +1 -1
  28. package/dist/workspace-settings.mjs +8 -6
  29. package/dist/workspace-settings.mjs.map +1 -1
  30. package/package.json +9 -5
  31. package/dist/dependencies-C3kCe35Q.mjs.map +0 -1
  32. package/dist/export-subpaths-D6ZLYZGy.mjs +0 -17
  33. package/dist/export-subpaths-D6ZLYZGy.mjs.map +0 -1
  34. package/dist/manifest-texts-K650kDy8.mjs.map +0 -1
  35. package/dist/pass-records-kbx5VgwI.mjs.map +0 -1
  36. package/dist/published-CpfXkChq.mjs.map +0 -1
  37. package/dist/runtime-Q9CzisOt.mjs.map +0 -1
  38. package/dist/workspace-manifest-BC-1cRIJ.mjs +0 -20
  39. package/dist/workspace-manifest-BC-1cRIJ.mjs.map +0 -1
package/dist/publish.mjs CHANGED
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { t as runCli } from "./runtime-Q9CzisOt.mjs";
3
- import { n as importSpecifierOf, t as exportEntriesOf } from "./export-subpaths-D6ZLYZGy.mjs";
2
+ import { t as runCli } from "./runtime-CFZ41rB0.mjs";
4
3
  import { i as writeOutputs, n as actionsOidcToken, r as mask, t as BROKER } from "./credential-broker-9FMyTp1H.mjs";
5
4
  import { Array, Config, Console, Duration, Effect, FileSystem, Option, Order, Path, Predicate, Record, Schedule, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
6
5
  import { ChildProcess, ChildProcessSpawner } from "effect/process";
6
+ import { PACKAGE_JSON_FILE, ROOT_SUBPATH, exportEntriesOf, importSpecifierOf, runtimeDependencyNames, unscopedNameOf } from "@r_masseater/kestrion";
7
+ import { decodePackageJson, readPackageJson, readRawPackageJson, readVersionedPackageJson, updatePackageJson, writePackageJson } from "@r_masseater/kestrion/npm";
7
8
  import semver from "semver";
8
9
  import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
9
10
  import { Base64 } from "effect/encoding";
@@ -51,16 +52,9 @@ const mustSucceed = mustSucceedWith;
51
52
  const outputOf = outputWith;
52
53
  // src/features/publish-workspace/model/export-targets.ts
53
54
  const PATTERN$1 = "*";
54
- const MANIFEST_FILE$4 = "package.json";
55
55
  const taggedError$3 = Schema.TaggedError;
56
56
  /** @internal */
57
57
  var MissingExportTargets = class extends taggedError$3()("MissingExportTargets", { message: Schema.String }) {};
58
- const AnyExports = Schema.optionalKey(Schema.Unknown);
59
- const PublishConfig$1 = Schema.Struct({ exports: AnyExports });
60
- const PublishedExports = Schema.fromJsonString(Schema.Struct({
61
- exports: AnyExports,
62
- publishConfig: Schema.optionalKey(PublishConfig$1)
63
- }));
64
58
  const singleTarget = (target) => {
65
59
  if (String$1.includes(PATTERN$1)(target)) return [];
66
60
  return [target];
@@ -85,7 +79,7 @@ const missingMessage = (missing) => `The published exports point to files the bu
85
79
  const checkExportTargets = Effect.fn("publish.checkExportTargets")(function* checkExportTargets(directory) {
86
80
  const fileSystem = yield* FileSystem.FileSystem;
87
81
  const path = yield* Path.Path;
88
- const manifest = yield* fileSystem.readFileString(path.join(directory, MANIFEST_FILE$4)).pipe(Effect.flatMap(Schema.decodeEffect(PublishedExports)));
82
+ const manifest = yield* readPackageJson(directory);
89
83
  const missing = yield* Effect.filter(exportTargetsOf(publishedExportsOf(manifest)), (target) => Effect.map(fileSystem.exists(path.join(directory, target)), (found) => !found));
90
84
  return yield* pipe(missing, Array.match({
91
85
  onEmpty: () => Effect.void,
@@ -103,32 +97,6 @@ const TYPES = "types";
103
97
  const taggedError$2 = Schema.TaggedError;
104
98
  /** @internal */
105
99
  var IncompatiblePackage = class extends taggedError$2()("IncompatiblePackage", { message: Schema.String }) {};
106
- const Declared = Schema.Record(Schema.String, Schema.String);
107
- const VitePlusManifestJson = Schema.fromJsonString(Schema.Struct({ dependencies: Schema.optionalKey(Declared) }));
108
- const Bin = Schema.Union([Schema.String, Declared]);
109
- const Native$1 = Schema.Struct({
110
- binary: Schema.String,
111
- targets: Schema.Array(Schema.String)
112
- });
113
- const Engines = Schema.Struct({ node: Schema.optionalKey(Schema.String) });
114
- const PublishConfig = Schema.Struct({
115
- exports: Schema.optionalKey(Schema.Unknown),
116
- bin: Schema.optionalKey(Bin)
117
- });
118
- /** @internal */
119
- const CompatManifestJson = Schema.fromJsonString(Schema.Struct({
120
- name: Schema.String,
121
- version: Schema.String,
122
- private: Schema.optionalKey(Schema.Boolean),
123
- native: Schema.optionalKey(Native$1),
124
- exports: Schema.optionalKey(Schema.Unknown),
125
- bin: Schema.optionalKey(Bin),
126
- dependencies: Schema.optionalKey(Declared),
127
- optionalDependencies: Schema.optionalKey(Declared),
128
- engines: Schema.optionalKey(Engines),
129
- peerDependencies: Schema.optionalKey(Declared),
130
- publishConfig: Schema.optionalKey(PublishConfig)
131
- }));
132
100
  const lowestOf = (range) => pipe(Option.fromNullishOr(semver.validRange(range)), Option.flatMap(() => Option.fromNullishOr(semver.minVersion(range))), Option.map(({ version }) => version));
133
101
  const floorOf = (version) => {
134
102
  if (semver.prerelease(version) !== null) return version;
@@ -148,7 +116,7 @@ const withoutViteOfVitePlus = (peers) => {
148
116
  return peers;
149
117
  };
150
118
  /** @internal */
151
- const viteAliasOf = (vitePlusManifest) => pipe(Schema.decodeOption(VitePlusManifestJson)(vitePlusManifest), Option.flatMapNullishOr(({ dependencies }) => dependencies), Option.flatMap(Record.get(VITE)), Option.map((spec) => `${VITE}@${spec}`));
119
+ const viteAliasOf = (vitePlusManifest) => pipe(decodePackageJson(vitePlusManifest), Option.flatMapNullishOr(({ dependencies }) => dependencies), Option.flatMap(Record.get(VITE)), Option.map((spec) => `${VITE}@${spec}`));
152
120
  const casesOf = (manifest, floor) => {
153
121
  const declared = withoutViteOfVitePlus(manifest.peerDependencies ?? {});
154
122
  const latest = `^${String(semver.major(floor))}`;
@@ -178,8 +146,8 @@ const compatCasesOf = (manifest) => pipe(nodeFloorOf(manifest), Option.match({
178
146
  const isTypesOnly = (target) => Predicate.isReadonlyObject(target) && pipe(Record.keys(target), Array.every((key) => key === TYPES));
179
147
  const exportedSubpaths = (exports) => pipe(exportEntriesOf(exports), Array.filter(([subpath, target]) => subpath !== PACKAGE_JSON_EXPORT && !String$1.includes(PATTERN)(subpath) && !isTypesOnly(target)), Array.map(([subpath]) => subpath));
180
148
  const subpathsOf = foldExports({
181
- string: () => ["."],
182
- array: () => ["."],
149
+ string: () => [ROOT_SUBPATH],
150
+ array: () => [ROOT_SUBPATH],
183
151
  object: exportedSubpaths,
184
152
  other: () => []
185
153
  });
@@ -198,13 +166,6 @@ const smokeTargetsOf = (manifest) => {
198
166
  bins: binFilesOf(bin)
199
167
  };
200
168
  };
201
- /** @internal */
202
- const compatManifestIn = Effect.fn("compat.manifestIn")(function* compatManifestIn(directory) {
203
- const fileSystem = yield* FileSystem.FileSystem;
204
- const path = yield* Path.Path;
205
- const text = yield* fileSystem.readFileString(path.join(directory, "package.json"));
206
- return yield* Schema.decodeEffect(CompatManifestJson)(text);
207
- });
208
169
  // src/features/publish-workspace/model/platforms.ts
209
170
  const RUNNERS = {
210
171
  linux: "ubuntu-latest",
@@ -263,7 +224,6 @@ const nativeReadme = ({ name, target }) => `# ${name}-${target}\n\nThe prebuilt
263
224
  // src/features/publish-workspace/model/native-package.ts
264
225
  const NPM_DIR = "npm";
265
226
  const NATIVE_DIR = "native";
266
- const MANIFEST_FILE$3 = "package.json";
267
227
  const KEPT_FIELDS = [
268
228
  "license",
269
229
  "repository",
@@ -271,14 +231,9 @@ const KEPT_FIELDS = [
271
231
  "bugs",
272
232
  "engines"
273
233
  ];
274
- /** @internal */
275
- const PackageJson = Schema.fromJsonString(Schema.Record(Schema.String, Schema.Unknown));
276
- const keptFields = Effect.fn("publish.keptFields")(function* keptFields(directory) {
277
- const fileSystem = yield* FileSystem.FileSystem;
278
- const path = yield* Path.Path;
279
- const text = yield* fileSystem.readFileString(path.join(directory, MANIFEST_FILE$3));
280
- const raw = yield* Schema.decodeEffect(PackageJson)(text);
281
- return pipe(raw, Record.filter((_value, key) => Array.contains(KEPT_FIELDS, key)));
234
+ const keptFields = Effect.fn("keptFields")(function* keptFields(directory) {
235
+ const fields = yield* readRawPackageJson(directory);
236
+ return pipe(fields, Record.filter((_value, key) => Array.contains(KEPT_FIELDS, key)));
282
237
  });
283
238
  /** @internal */
284
239
  const writeNative = Effect.fn("publish.writeNative")(function* writeNative(directory, native) {
@@ -289,11 +244,10 @@ const writeNative = Effect.fn("publish.writeNative")(function* writeNative(direc
289
244
  const file = nativeFileOf(native);
290
245
  yield* fileSystem.makeDirectory(target, { recursive: true });
291
246
  yield* fileSystem.copyFile(path.join(directory, NATIVE_DIR, file), path.join(target, file));
292
- const text = yield* Schema.encodeEffect(PackageJson)({
247
+ yield* Effect.all([writePackageJson(target, {
293
248
  ...kept,
294
249
  ...nativeFields(native)
295
- });
296
- yield* Effect.all([fileSystem.writeFileString(path.join(target, MANIFEST_FILE$3), text), fileSystem.writeFileString(path.join(target, "README.md"), nativeReadme(native))], { concurrency: "unbounded" });
250
+ }), fileSystem.writeFileString(path.join(target, "README.md"), nativeReadme(native))], { concurrency: "unbounded" });
297
251
  return target;
298
252
  });
299
253
  // src/features/publish-workspace/model/widened-ranges.ts
@@ -368,18 +322,13 @@ const nativeTarballs = Effect.fn("compat.native")(function* nativeTarballs(direc
368
322
  }));
369
323
  });
370
324
  // src/features/publish-workspace/model/compat-workspace.ts
371
- const dependencyNamesOf = (manifest) => pipe([
372
- manifest.dependencies,
373
- manifest.peerDependencies,
374
- manifest.optionalDependencies
375
- ], Array.flatMap((declared) => Record.keys(declared ?? {})));
376
325
  const closureOf = (known, names, seen) => {
377
326
  const [name, ...rest] = names;
378
327
  if (Predicate.isUndefined(name)) return seen;
379
328
  const found = Record.get(known, name);
380
329
  const reached = pipe(seen, Array.some((item) => item.manifest.name === name));
381
330
  if (Option.isNone(found) || reached) return closureOf(known, rest, seen);
382
- const inner = closureOf(known, dependencyNamesOf(found.value.manifest), [...seen, found.value]);
331
+ const inner = closureOf(known, runtimeDependencyNames(found.value.manifest), [...seen, found.value]);
383
332
  return closureOf(known, rest, inner);
384
333
  };
385
334
  const workspacesBeside = Effect.fn("compat.workspaces")(function* workspacesBeside(directory) {
@@ -387,7 +336,7 @@ const workspacesBeside = Effect.fn("compat.workspaces")(function* workspacesBesi
387
336
  const path = yield* Path.Path;
388
337
  const parent = path.dirname(path.resolve(directory));
389
338
  const entries = yield* fileSystem.readDirectory(parent);
390
- const found = yield* Effect.forEach(entries, (entry) => compatManifestIn(path.join(parent, entry)).pipe(Effect.map((manifest) => [{
339
+ const found = yield* Effect.forEach(entries, (entry) => readVersionedPackageJson(path.join(parent, entry)).pipe(Effect.map((manifest) => [{
391
340
  directory: path.join(parent, entry),
392
341
  manifest
393
342
  }]), Effect.orElseSucceed(() => [])), { concurrency: 1 });
@@ -409,7 +358,7 @@ const tarballsOf = Effect.fn("compat.tarballs")(function* tarballsOf({ directory
409
358
  /** @internal */
410
359
  const workspaceTarballs = Effect.fn("compat.local")(function* workspaceTarballs(directory, manifest) {
411
360
  const known = yield* workspacesBeside(directory);
412
- const reached = closureOf(known, dependencyNamesOf(manifest), [{
361
+ const reached = closureOf(known, runtimeDependencyNames(manifest), [{
413
362
  directory,
414
363
  manifest
415
364
  }]);
@@ -417,15 +366,16 @@ const workspaceTarballs = Effect.fn("compat.local")(function* workspaceTarballs(
417
366
  return Record.fromEntries(Array.flatten(packed));
418
367
  });
419
368
  // src/features/publish-workspace/model/compat.ts
420
- const MANIFEST_FILE$2 = "package.json";
421
369
  const INSTALL_FLAGS = ["--no-audit", "--no-fund"];
370
+ const NOT_LOADED = String.raw`ERR_(MODULE_NOT_FOUND|PACKAGE_|INVALID_PACKAGE|UNKNOWN_FILE|UNSUPPORTED_DIR|REQUIRE_ESM)|SyntaxError`;
422
371
  /** @internal */
423
- const CRASH = String.raw`/ERR_(MODULE_NOT_FOUND|PACKAGE_|INVALID_PACKAGE|UNKNOWN_FILE|UNSUPPORTED_DIR|REQUIRE_ESM)|SyntaxError|\n\s+at\s.+:\d+:\d+/u`;
372
+ const LOAD_FAILURE = `/${NOT_LOADED}/u`;
373
+ /** @internal */
374
+ const CRASH = String.raw`/${NOT_LOADED}|\n\s+at\s.+:\d+:\d+/u`;
424
375
  const BIN_ARGUMENTS = [["--help"], ["--compat-unknown-flag"]];
425
376
  const IMPORT_ONLY = "await import(process.argv[1])";
426
- const SPAWN_CHECKED = `import { spawnSync } from "node:child_process"; const { stderr } = spawnSync(process.execPath, process.argv.slice(1), { encoding: "utf8", stdio: ["ignore", "ignore", "pipe"], timeout: 60000 }); if (${CRASH}.test(stderr)) { process.stderr.write(stderr); process.exit(1); }`;
377
+ const spawnChecked = (failure) => `import { spawnSync } from "node:child_process"; const { stderr } = spawnSync(process.execPath, process.argv.slice(1), { encoding: "utf8", stdio: ["ignore", "ignore", "pipe"], timeout: 60000 }); if (${failure}.test(stderr)) { process.stderr.write(stderr); process.exit(1); }`;
427
378
  const Versions$1 = Schema.String.pipe(Schema.Array, Schema.fromJsonString);
428
- const ConsumerJson = Schema.fromJsonString(Schema.Record(Schema.String, Schema.Unknown));
429
379
  const installedNode = Effect.fn("compat.node")(function* installedNode(directory, range) {
430
380
  const path = yield* Path.Path;
431
381
  yield* (yield* FileSystem.FileSystem).makeDirectory(directory, { recursive: true });
@@ -455,21 +405,19 @@ const installedNode = Effect.fn("compat.node")(function* installedNode(directory
455
405
  binary: path.join(directory, "node_modules", "node", "bin", "node")
456
406
  };
457
407
  });
458
- const consumerJson = Effect.fn("compat.json")(function* consumerJson({ peers, tarballs }) {
459
- return yield* Schema.encodeEffect(ConsumerJson)({
460
- private: true,
461
- type: "module",
462
- dependencies: {
463
- ...peers,
464
- ...pipe(tarballs, Record.map((file) => `file:${file}`))
465
- },
466
- overrides: Record.fromIterableWith(Record.keys(tarballs), (sibling) => [sibling, `$${sibling}`])
467
- });
408
+ const consumerFields = ({ peers, tarballs }) => ({
409
+ private: true,
410
+ type: "module",
411
+ dependencies: {
412
+ ...peers,
413
+ ...pipe(tarballs, Record.map((file) => `file:${file}`))
414
+ },
415
+ overrides: Record.fromIterableWith(Record.keys(tarballs), (sibling) => [sibling, `$${sibling}`])
468
416
  });
469
417
  const withViteOfVitePlus = Effect.fn("compat.vite")(function* withViteOfVitePlus(directory) {
470
418
  const fileSystem = yield* FileSystem.FileSystem;
471
419
  const path = yield* Path.Path;
472
- const text = yield* fileSystem.readFileString(path.join(directory, "node_modules", VITE_PLUS, MANIFEST_FILE$2));
420
+ const text = yield* fileSystem.readFileString(path.join(directory, "node_modules", VITE_PLUS, PACKAGE_JSON_FILE));
473
421
  yield* Option.match(viteAliasOf(text), {
474
422
  onNone: () => Effect.void,
475
423
  onSome: (alias) => mustSucceed({
@@ -487,11 +435,9 @@ const withViteOfVitePlus = Effect.fn("compat.vite")(function* withViteOfVitePlus
487
435
  });
488
436
  const installedConsumer = Effect.fn("compat.consumer")(function* installedConsumer(root, consumer) {
489
437
  const fileSystem = yield* FileSystem.FileSystem;
490
- const path = yield* Path.Path;
491
- const directory = path.join(root, "consumer");
438
+ const directory = (yield* Path.Path).join(root, "consumer");
492
439
  yield* fileSystem.makeDirectory(directory, { recursive: true });
493
- const text = yield* consumerJson(consumer);
494
- yield* fileSystem.writeFileString(path.join(directory, MANIFEST_FILE$2), text);
440
+ yield* writePackageJson(directory, consumerFields(consumer));
495
441
  yield* mustSucceed({
496
442
  command: "npm",
497
443
  args: [
@@ -504,12 +450,12 @@ const installedConsumer = Effect.fn("compat.consumer")(function* installedConsum
504
450
  if (Record.has(consumer.peers, "vite-plus")) yield* withViteOfVitePlus(directory);
505
451
  return directory;
506
452
  });
507
- const loadsCleanly = ({ runtime, consumer, args }) => mustSucceed({
453
+ const loadsCleanly = ({ runtime, consumer, failure, args }) => mustSucceed({
508
454
  command: runtime,
509
455
  args: [
510
456
  "--input-type=module",
511
457
  "-e",
512
- SPAWN_CHECKED,
458
+ spawnChecked(failure),
513
459
  "--",
514
460
  ...args
515
461
  ],
@@ -530,6 +476,7 @@ const smoke = Effect.fn("compat.smoke")(function* smoke({ manifest, compat, runt
530
476
  yield* Effect.forEach(importsOf(manifest, compat), (specifier) => loadsCleanly({
531
477
  runtime,
532
478
  consumer,
479
+ failure: LOAD_FAILURE,
533
480
  args: [...importer, specifier]
534
481
  }), {
535
482
  concurrency: 1,
@@ -538,6 +485,7 @@ const smoke = Effect.fn("compat.smoke")(function* smoke({ manifest, compat, runt
538
485
  yield* Effect.forEach(runs, (args) => loadsCleanly({
539
486
  runtime,
540
487
  consumer,
488
+ failure: CRASH,
541
489
  args
542
490
  }), {
543
491
  concurrency: 1,
@@ -564,7 +512,7 @@ const runCase = Effect.fn("compat.case")(function* runCase({ manifest, tarballs,
564
512
  }, Effect.scoped);
565
513
  /** @internal */
566
514
  const checkCompat = Effect.fn("publish.compat")(function* checkCompat(directory) {
567
- const manifest = yield* compatManifestIn(directory);
515
+ const manifest = yield* readVersionedPackageJson(directory);
568
516
  const cases = compatCasesOf(manifest);
569
517
  if (Array.isReadonlyArrayEmpty(cases)) return yield* IncompatiblePackage.make({ message: `${manifest.name} declares no engines.node, so there is no supported Node.js range to check` });
570
518
  const tarballs = yield* workspaceTarballs(directory, manifest);
@@ -578,31 +526,10 @@ const checkCompat = Effect.fn("publish.compat")(function* checkCompat(directory)
578
526
  });
579
527
  }, Effect.scoped);
580
528
  // src/features/publish-workspace/model/manifest.ts
581
- const MANIFEST_FILE$1 = "package.json";
582
- const SCOPE = /^@[^/]+\//u;
583
529
  const UNVERSIONED$1 = "0.0.0";
584
530
  const ROOT = ".";
585
- const Native = Schema.Struct({
586
- binary: Schema.String,
587
- targets: Schema.Array(Schema.String)
588
- });
589
- const ManifestSchema = Schema.Struct({
590
- name: Schema.String,
591
- version: Schema.String,
592
- private: Schema.optionalKey(Schema.Boolean),
593
- dependencies: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),
594
- native: Schema.optionalKey(Native),
595
- "size-limit": Schema.optionalKey(Schema.Unknown)
596
- });
597
531
  /** @internal */
598
- const manifestIn = Effect.fn("publish.manifest")(function* manifestIn(directory) {
599
- const fileSystem = yield* FileSystem.FileSystem;
600
- const path = yield* Path.Path;
601
- const text = yield* fileSystem.readFileString(path.join(directory, MANIFEST_FILE$1));
602
- return yield* Schema.decodeEffect(Schema.fromJsonString(ManifestSchema))(text);
603
- });
604
- /** @internal */
605
- const releaseName = ({ name }) => String$1.replace(SCOPE, "")(name);
532
+ const releaseName = ({ name }) => unscopedNameOf(name);
606
533
  /** @internal */
607
534
  const isRoot = (directory) => directory === ROOT;
608
535
  /** @internal */
@@ -642,7 +569,7 @@ const failWhenMissing = (missing, manifest) => {
642
569
  };
643
570
  const missingDependencies = Effect.fn("publish.missingDependencies")(function* missingDependencies({ manifest, workspaces }) {
644
571
  const wanted = workspaceDependencies(manifest);
645
- const siblings = yield* Effect.forEach(workspaces, (directory) => manifestIn(directory).pipe(Effect.map((found) => ({
572
+ const siblings = yield* Effect.forEach(workspaces, (directory) => readVersionedPackageJson(directory).pipe(Effect.map((found) => ({
646
573
  directory,
647
574
  ...found
648
575
  }))), { concurrency: READ_CONCURRENCY });
@@ -921,7 +848,7 @@ const nativeOf = (manifest) => pipe(Option.fromUndefinedOr(manifest.native), Opt
921
848
  /** @internal */
922
849
  const planOf = Effect.fn("publish.plan")(function* planOf(directory) {
923
850
  const workspace = yield* workspaceOf(directory);
924
- const manifest = yield* manifestIn(workspace);
851
+ const manifest = yield* readVersionedPackageJson(workspace);
925
852
  const graph = yield* graphTasks;
926
853
  const tasks = tasksIn(graph, workspace);
927
854
  const npm = yield* needsNpm(workspace, manifest, workspacesOf(graph));
@@ -954,7 +881,7 @@ const untaggedCurrent = Effect.fn("publish.untaggedCurrent")(function* untaggedC
954
881
  })));
955
882
  });
956
883
  const pending = Effect.fn("publish.pending")(function* pending(graph, directory) {
957
- const manifest = yield* manifestIn(directory);
884
+ const manifest = yield* readVersionedPackageJson(directory);
958
885
  const builds = buildsOf(tasksIn(graph, directory));
959
886
  const needed = yield* Effect.all([
960
887
  unpublished(directory, manifest),
@@ -995,7 +922,7 @@ const writePlan = Effect.fn("publish.writePlan")(function* writePlan(plan) {
995
922
  // src/features/publish-workspace/model/compat-plan.ts
996
923
  const Directories = Schema.String.pipe(Schema.Array, Schema.fromJsonString);
997
924
  const isChecked = Effect.fn("compat.isChecked")(function* isChecked(directory) {
998
- const manifest = yield* compatManifestIn(directory);
925
+ const manifest = yield* readVersionedPackageJson(directory);
999
926
  return goesToNpm(manifest) && !Array.isReadonlyArrayEmpty(compatCasesOf(manifest));
1000
927
  });
1001
928
  /** @internal */
@@ -1007,16 +934,11 @@ const writeCompatPlan = Effect.fn("publish.compatPlan")(function* writeCompatPla
1007
934
  yield* writeOutputs({ directories: encoded });
1008
935
  });
1009
936
  // src/features/publish-workspace/model/npm.ts
1010
- const MANIFEST_FILE = "package.json";
1011
937
  const PUBLISH_FLAGS = [
1012
938
  "--provenance",
1013
939
  "--access",
1014
940
  "public"
1015
941
  ];
1016
- const PlatformManifest = Schema.fromJsonString(Schema.Struct({
1017
- name: Schema.String,
1018
- version: Schema.String
1019
- }));
1020
942
  const authEnv = Effect.fn("publish.authEnv")(function* authEnv() {
1021
943
  const token = yield* brokerCredential({
1022
944
  kind: "npm",
@@ -1045,9 +967,7 @@ const verifyPackage = Effect.fn("publish.verify")(function* verifyPackage(direct
1045
967
  yield* checkCompat(directory);
1046
968
  });
1047
969
  const publishNative = Effect.fn("publish.publishNative")(function* publishNative(target, env) {
1048
- const fileSystem = yield* FileSystem.FileSystem;
1049
- const path = yield* Path.Path;
1050
- const { name, version } = yield* fileSystem.readFileString(path.join(target, MANIFEST_FILE)).pipe(Effect.flatMap(Schema.decodeEffect(PlatformManifest)));
970
+ const { name, version } = yield* readVersionedPackageJson(target);
1051
971
  if (yield* onNpm({
1052
972
  directory: target,
1053
973
  name,
@@ -1068,17 +988,7 @@ const publishNative = Effect.fn("publish.publishNative")(function* publishNative
1068
988
  });
1069
989
  return name;
1070
990
  });
1071
- const addOptionalDependencies = Effect.fn("publish.optionalDependencies")(function* addOptionalDependencies(directory, names, version) {
1072
- const fileSystem = yield* FileSystem.FileSystem;
1073
- const file = (yield* Path.Path).join(directory, MANIFEST_FILE);
1074
- const manifest = yield* fileSystem.readFileString(file).pipe(Effect.flatMap(Schema.decodeEffect(PackageJson)));
1075
- const optionalDependencies = pipe(names, Array.map((name) => [name, version]), Record.fromEntries);
1076
- const updated = yield* Schema.encodeEffect(PackageJson)({
1077
- ...manifest,
1078
- optionalDependencies
1079
- });
1080
- yield* fileSystem.writeFileString(file, updated);
1081
- });
991
+ const addOptionalDependencies = (directory, names, version) => updatePackageJson(directory, { optionalDependencies: pipe(names, Array.map((name) => [name, version]), Record.fromEntries) }).pipe(Effect.withSpan("publish.optionalDependencies"));
1082
992
  const publishNatives = Effect.fn("publish.publishNatives")(function* publishNatives(directory, manifest, env) {
1083
993
  if (Predicate.isUndefined(manifest.native)) return;
1084
994
  const { binary, targets } = manifest.native;
@@ -1093,7 +1003,7 @@ const publishNatives = Effect.fn("publish.publishNatives")(function* publishNati
1093
1003
  });
1094
1004
  /** @internal */
1095
1005
  const publishToNpm = Effect.fn("publish.npm")(function* publishToNpm(directory) {
1096
- const manifest = yield* manifestIn(directory);
1006
+ const manifest = yield* readVersionedPackageJson(directory);
1097
1007
  if (yield* onNpm({
1098
1008
  directory,
1099
1009
  ...manifest
@@ -1207,7 +1117,7 @@ const uploadAssets = Effect.fn("publish.uploadAssets")(function* uploadAssets({
1207
1117
  });
1208
1118
  /** @internal */
1209
1119
  const publishRelease = Effect.fn("publish.release")(function* publishRelease(directory) {
1210
- const manifest = yield* manifestIn(directory);
1120
+ const manifest = yield* readVersionedPackageJson(directory);
1211
1121
  if (!isVersioned(manifest)) {
1212
1122
  yield* Effect.logInfo(`${manifest.name} has no version to publish`);
1213
1123
  return;