@r_masseater/vite-plus-adopt 0.22.0 → 0.23.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/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as runVpa } from "./vpa-ijEo-ufB.mjs";
2
+ import { t as runVpa } from "./vpa-C8WOY6iR.mjs";
3
3
  import { Effect, Path, Stdio } from "effect";
4
4
  import { runMain } from "@r_masseater/node-main";
5
5
  // src/app/run-cli.ts
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { i as VpToolsError, n as findCiDrift, r as loadViteConfig, t as runVpa } from "./vpa-ijEo-ufB.mjs";
1
+ export { i as VpToolsError, n as findCiDrift, r as loadViteConfig, t as runVpa } from "./vpa-C8WOY6iR.mjs";
@@ -12,11 +12,11 @@ import { loadBuiltinPlugins } from "textlint/lib/src/loader/TextlintrcLoader.js"
12
12
  import { normalizeTextlintPresetSubRuleKey } from "@textlint/utils";
13
13
  import { format as format$1, makeDetector } from "@r_masseater/h56m";
14
14
  import { isMap, isNode, isPair, isScalar, isSeq, parse, parseDocument, visit } from "yaml";
15
+ import { readWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-reader";
15
16
  import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";
16
17
  import { minimatch } from "minimatch";
17
18
  import { Tar } from "effect/encoding";
18
19
  import { findWorkspaceProjectsNoCheck } from "@pnpm/workspace.projects-reader";
19
- import { readWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-reader";
20
20
  import { intersects, valid, validRange } from "semver";
21
21
  // src/shared/lib/errors.ts
22
22
  const taggedError = Schema.TaggedError;
@@ -404,10 +404,11 @@ const fieldOf = (key) => (node) => pipe(Option.liftPredicate(node, isMap), Optio
404
404
  const usesOf = fieldOf("uses");
405
405
  /** @internal */
406
406
  const lineStart = ({ source, offset }) => pipe(source, String$1.slice(FIRST$1, offset), String$1.lastIndexOf(NEWLINE$1), Option.map((index) => index + NEXT$1), Option.getOrElse(() => FIRST$1));
407
+ const rangeOf$1 = (node) => pipe(Option.liftPredicate(node, isMap), Option.flatMapNullishOr(({ range }) => range));
407
408
  /** @internal */
408
- const startOf = (node) => pipe(Option.liftPredicate(node, isMap), Option.flatMapNullishOr(({ range }) => range), Option.map(([start]) => start));
409
+ const startOf = (node) => pipe(rangeOf$1(node), Option.map(([start]) => start));
409
410
  /** @internal */
410
- const endOf = (node) => pipe(Option.liftPredicate(node, isMap), Option.flatMapNullishOr(({ range }) => range), Option.map((range) => range[RANGE_END]));
411
+ const endOf = (node) => pipe(rangeOf$1(node), Option.map((range) => range[RANGE_END]));
411
412
  const insertAt = (text) => ({ start, end, text: insert }) => pipe(text, String$1.slice(FIRST$1, start)) + insert + pipe(text, String$1.slice(end));
412
413
  /** @internal */
413
414
  const applyEdits = ({ source, edits }) => pipe(Array.sort(edits, ByStartDescending), Array.match({
@@ -886,6 +887,26 @@ const syncCi = (root) => planned(root).pipe(Effect.flatMap(({ changes }) => Effe
886
887
  ...SEQUENTIAL,
887
888
  discard: true
888
889
  })));
890
+ // package.json
891
+ var name = "@r_masseater/vite-plus-adopt";
892
+ var version = "0.23.1";
893
+ // src/features/sync-ci/model/installed-version.ts
894
+ const RANGE_PREFIX = /^[\^~]/u;
895
+ const pnpm$1 = attempt("pnpm");
896
+ /** @internal */
897
+ const staleProblem = ({ installed, declared }) => pipe(declared, Option.map(String$1.replace(RANGE_PREFIX, "")), Option.filter((exact) => exact !== installed), Option.map((exact) => `vpa ${installed} is installed, but the repository declares ${exact}, so the files it writes would not match what the current checks expect. Run \`vp install\`, then run \`vpa ci\` again.`));
898
+ const declaredIn = (root) => pnpm$1(() => readWorkspaceManifest(root)).pipe(Effect.map((workspace) => pipe(Option.fromNullishOr(workspace), Option.flatMapNullishOr(({ catalog }) => catalog), Option.flatMapNullishOr((catalog) => catalog[name]))));
899
+ /** @internal */
900
+ const guardInstalledVersion = (root) => declaredIn(root).pipe(Effect.map((declared) => staleProblem({
901
+ installed: version,
902
+ declared
903
+ })), Effect.flatMap(Option.match({
904
+ onNone: () => Effect.void,
905
+ onSome: (problem) => Effect.fail(checksFailed(problem))
906
+ })));
907
+ // src/features/sync-ci/model/run-ci.ts
908
+ /** @internal */
909
+ const runCi = (root) => guardInstalledVersion(root).pipe(Effect.andThen(syncCi(root)));
889
910
  // src/shared/config/skills.ts
890
911
  const Repository = Schema.String.check(Schema.isPattern(/^[\w-][\w.-]*\/[\w.-]+$/u));
891
912
  const LocalDirectory = Schema.String.check(Schema.isPattern(/^\.\/[\w.-]+(?:\/[\w.-]+)*$/u));
@@ -1609,7 +1630,7 @@ const lintMessage = (toMessage) => (root, rest) => pipe(Array.head(rest), Option
1609
1630
  const readMessage = (file) => FileSystem.FileSystem.pipe(Effect.flatMap((fs) => fs.readFileString(file)));
1610
1631
  /** @internal */
1611
1632
  const HOOKS = {
1612
- ci: syncCi,
1633
+ ci: runCi,
1613
1634
  "--prepare": prepare,
1614
1635
  "--staged": stagedSecrets,
1615
1636
  "--commit-msg": lintMessage(readMessage),
@@ -1873,4 +1894,4 @@ const runVpa = Function.dual(2, (root, args) => pipe(args, Array.match({
1873
1894
  })));
1874
1895
  export { VpToolsError as i, findCiDrift as n, loadViteConfig as r, runVpa as t };
1875
1896
 
1876
- //# sourceMappingURL=vpa-ijEo-ufB.mjs.map
1897
+ //# sourceMappingURL=vpa-C8WOY6iR.mjs.map