@r_masseater/msch 0.96.0 → 0.97.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.
package/dist/cli.mjs CHANGED
@@ -13240,7 +13240,7 @@ const filtersIn = (source) => pipe(scalarsIn(source), Array$1.flatMap(({ text, o
13240
13240
  offset
13241
13241
  })))));
13242
13242
  const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$4(where, PACKAGE, packageMessage(what, directory))(offset)), Option.toArray);
13243
- const packagesIn = (workspaces, { file, name, source }) => {
13243
+ const packagesIn$1 = (workspaces, { file, name, source }) => {
13244
13244
  const where = {
13245
13245
  file,
13246
13246
  source
@@ -13273,7 +13273,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
13273
13273
  const found = yield* Effect.forEach(workflows, ({ name, stem }) => Effect.gen(function* problemsOf() {
13274
13274
  const file = files.join(root, name);
13275
13275
  const source = yield* files.readFile(file);
13276
- return pipe(source, Option.map((text) => [...pathFiltersIn(file, text), ...packagesIn(workspaces, {
13276
+ return pipe(source, Option.map((text) => [...pathFiltersIn(file, text), ...packagesIn$1(workspaces, {
13277
13277
  file,
13278
13278
  name: stem,
13279
13279
  source: text
@@ -13804,9 +13804,25 @@ const optionsFor = (scope, input, effectful) => {
13804
13804
  };
13805
13805
  };
13806
13806
  const isChunk = (item) => item.type === "chunk";
13807
+ const packagesIn = (specifiers) => pipe(specifiers, Array$1.filter((specifier) => isBare(specifier) && !isBuiltin$1(specifier)), Array$1.map(packageNameOf), Array$1.dedupe, Array$1.sortBy(Order.String));
13808
+ const importsOf$1 = (byFile) => (file) => Option.match(Record.get(byFile, file), {
13809
+ onNone: () => [],
13810
+ onSome: (chunk) => chunk.imports
13811
+ });
13812
+ const reachedFrom = (byFile, files) => {
13813
+ const next = pipe(files, Array$1.flatMap(importsOf$1(byFile)), Array$1.prependAll(files), Array$1.dedupe);
13814
+ if (next.length === files.length) return files;
13815
+ return reachedFrom(byFile, next);
13816
+ };
13817
+ const loadedAtStartup = (chunks) => {
13818
+ const byFile = Record.fromIterableWith(chunks, (chunk) => [chunk.fileName, chunk]);
13819
+ const entries = pipe(chunks, Array$1.filter((chunk) => chunk.isEntry), Array$1.map((chunk) => chunk.fileName));
13820
+ return pipe(reachedFrom(byFile, entries), Array$1.flatMap((file) => Option.toArray(Record.get(byFile, file))));
13821
+ };
13807
13822
  const keptBy = (chunks) => ({
13808
13823
  modules: pipe(chunks, Array$1.flatMap((chunk) => Record.keys(chunk.modules)), Array$1.filter((id) => !String$1.startsWith(VIRTUAL_PREFIX)(id)), Array$1.dedupe, Array$1.sortBy(Order.String)),
13809
- packages: pipe(chunks, Array$1.flatMap((chunk) => [...chunk.imports, ...chunk.dynamicImports]), Array$1.filter((specifier) => isBare(specifier) && !isBuiltin$1(specifier)), Array$1.map(packageNameOf), Array$1.dedupe, Array$1.sortBy(Order.String))
13824
+ packages: packagesIn(pipe(chunks, Array$1.flatMap((chunk) => [...chunk.imports, ...chunk.dynamicImports]))),
13825
+ startup: packagesIn(pipe(loadedAtStartup(chunks), Array$1.flatMap((chunk) => chunk.imports)))
13810
13826
  });
13811
13827
  const generate = (options) => Effect.acquireUseRelease(Effect.tryPromise({
13812
13828
  try: () => rolldown(options),
@@ -13874,6 +13890,7 @@ const SINGLE$1 = 1;
13874
13890
  const DEPENDENCIES_KEY = "\"dependencies\"";
13875
13891
  const PEER_META_KEY = "\"peerDependenciesMeta\"";
13876
13892
  const importsPackage = (name) => ({ packages }) => Array$1.contains(packages, name);
13893
+ const loadsAtStartup = (name) => ({ startup }) => Array$1.contains(startup, name);
13877
13894
  const labelsOf$1 = (importers) => pipe(importers, Array$1.map(({ entry }) => `\`${entry.label}\``), Array$1.dedupe, Array$1.join(", "));
13878
13895
  const positionIn = (located, key, name) => {
13879
13896
  const section = Option.getOrElse(String$1.indexOf(key)(located.source), () => START$25);
@@ -13906,8 +13923,8 @@ const requiredPeerProblems = ({ located, manifest, used }) => {
13906
13923
  const libraries = librariesIn(used);
13907
13924
  const stack = stackPackagesOf(manifest);
13908
13925
  return pipe(optionalPeerNames(manifest), Array$1.flatMap((name) => {
13909
- const bins = pipe(used, Array$1.filter((entry) => isBinEntry(entry.entry) && importsPackage(name)(entry)));
13910
- const everyLibrary = pipe(libraries, Option.liftPredicate((all) => Array$1.isReadonlyArrayNonEmpty(all) && pipe(all, Array$1.every(importsPackage(name)))), Option.getOrElse(() => []));
13926
+ const bins = pipe(used, Array$1.filter((entry) => isBinEntry(entry.entry) && loadsAtStartup(name)(entry)));
13927
+ const everyLibrary = pipe(libraries, Option.liftPredicate((all) => Array$1.isReadonlyArrayNonEmpty(all) && pipe(all, Array$1.every(loadsAtStartup(name)))), Option.getOrElse(() => []));
13911
13928
  const importers = Array$1.appendAll(bins, everyLibrary);
13912
13929
  if (!Array$1.isArrayNonEmpty(importers)) return [];
13913
13930
  return [{
@@ -14058,6 +14075,7 @@ const usedBy = Effect.fn("usedBy")(function* usedBy(scope, entry) {
14058
14075
  return {
14059
14076
  entry,
14060
14077
  packages: kept.packages,
14078
+ startup: kept.startup,
14061
14079
  modules: kept.modules
14062
14080
  };
14063
14081
  });