syncpack 13.0.1 → 14.0.0-alpha.2

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 (233) hide show
  1. package/README.md +0 -3
  2. package/index.js +48 -0
  3. package/package.json +16 -73
  4. package/schema.json +917 -0
  5. package/syncpack.d.ts +122 -0
  6. package/LICENSE +0 -20
  7. package/dist/bin-fix-mismatches/fix-mismatches.d.ts +0 -16
  8. package/dist/bin-fix-mismatches/fix-mismatches.js +0 -115
  9. package/dist/bin-fix-mismatches/index.d.ts +0 -2
  10. package/dist/bin-fix-mismatches/index.js +0 -33
  11. package/dist/bin-format/format.d.ts +0 -13
  12. package/dist/bin-format/format.js +0 -92
  13. package/dist/bin-format/index.d.ts +0 -2
  14. package/dist/bin-format/index.js +0 -28
  15. package/dist/bin-lint/index.d.ts +0 -2
  16. package/dist/bin-lint/index.js +0 -17
  17. package/dist/bin-lint/lint.d.ts +0 -11
  18. package/dist/bin-lint/lint.js +0 -52
  19. package/dist/bin-lint-semver-ranges/index.d.ts +0 -2
  20. package/dist/bin-lint-semver-ranges/index.js +0 -30
  21. package/dist/bin-lint-semver-ranges/lint-semver-ranges.d.ts +0 -16
  22. package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +0 -92
  23. package/dist/bin-list/index.d.ts +0 -2
  24. package/dist/bin-list/index.js +0 -27
  25. package/dist/bin-list/list.d.ts +0 -14
  26. package/dist/bin-list/list.js +0 -151
  27. package/dist/bin-list-mismatches/index.d.ts +0 -2
  28. package/dist/bin-list-mismatches/index.js +0 -29
  29. package/dist/bin-list-mismatches/list-mismatches.d.ts +0 -18
  30. package/dist/bin-list-mismatches/list-mismatches.js +0 -224
  31. package/dist/bin-prompt/index.d.ts +0 -2
  32. package/dist/bin-prompt/index.js +0 -29
  33. package/dist/bin-prompt/prompt.d.ts +0 -11
  34. package/dist/bin-prompt/prompt.js +0 -95
  35. package/dist/bin-set-semver-ranges/index.d.ts +0 -2
  36. package/dist/bin-set-semver-ranges/index.js +0 -32
  37. package/dist/bin-set-semver-ranges/set-semver-ranges.d.ts +0 -11
  38. package/dist/bin-set-semver-ranges/set-semver-ranges.js +0 -61
  39. package/dist/bin-update/effects.d.ts +0 -52
  40. package/dist/bin-update/effects.js +0 -282
  41. package/dist/bin-update/index.d.ts +0 -2
  42. package/dist/bin-update/index.js +0 -24
  43. package/dist/bin-update/update.d.ts +0 -6
  44. package/dist/bin-update/update.js +0 -59
  45. package/dist/bin.d.ts +0 -2
  46. package/dist/bin.js +0 -37
  47. package/dist/config/get-custom-types.d.ts +0 -19
  48. package/dist/config/get-custom-types.js +0 -57
  49. package/dist/config/get-enabled-types.d.ts +0 -17
  50. package/dist/config/get-enabled-types.js +0 -109
  51. package/dist/config/get-filter.d.ts +0 -2
  52. package/dist/config/get-filter.js +0 -10
  53. package/dist/config/get-indent.d.ts +0 -2
  54. package/dist/config/get-indent.js +0 -9
  55. package/dist/config/get-sort-az.d.ts +0 -2
  56. package/dist/config/get-sort-az.js +0 -8
  57. package/dist/config/get-sort-exports.d.ts +0 -2
  58. package/dist/config/get-sort-exports.js +0 -9
  59. package/dist/config/get-sort-first.d.ts +0 -2
  60. package/dist/config/get-sort-first.js +0 -8
  61. package/dist/config/get-source.d.ts +0 -2
  62. package/dist/config/get-source.js +0 -8
  63. package/dist/config/tag.d.ts +0 -3
  64. package/dist/config/tag.js +0 -2
  65. package/dist/config/types.d.ts +0 -134
  66. package/dist/config/types.js +0 -1
  67. package/dist/constants.d.ts +0 -106
  68. package/dist/constants.js +0 -103
  69. package/dist/error-handlers/default-error-handlers.d.ts +0 -25
  70. package/dist/error-handlers/default-error-handlers.js +0 -80
  71. package/dist/get-context/index.d.ts +0 -23
  72. package/dist/get-context/index.js +0 -18
  73. package/dist/get-context/lib/key-by.d.ts +0 -6
  74. package/dist/get-context/lib/key-by.js +0 -12
  75. package/dist/get-instances/index.d.ts +0 -14
  76. package/dist/get-instances/index.js +0 -42
  77. package/dist/get-instances/instance.d.ts +0 -26
  78. package/dist/get-instances/instance.js +0 -35
  79. package/dist/get-package-json-files/get-file-paths.d.ts +0 -21
  80. package/dist/get-package-json-files/get-file-paths.js +0 -22
  81. package/dist/get-package-json-files/get-patterns/get-lerna-patterns.d.ts +0 -3
  82. package/dist/get-package-json-files/get-patterns/get-lerna-patterns.js +0 -12
  83. package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.d.ts +0 -3
  84. package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.js +0 -14
  85. package/dist/get-package-json-files/get-patterns/get-yarn-patterns.d.ts +0 -3
  86. package/dist/get-package-json-files/get-patterns/get-yarn-patterns.js +0 -16
  87. package/dist/get-package-json-files/get-patterns/index.d.ts +0 -8
  88. package/dist/get-package-json-files/get-patterns/index.js +0 -23
  89. package/dist/get-package-json-files/index.d.ts +0 -10
  90. package/dist/get-package-json-files/index.js +0 -8
  91. package/dist/get-package-json-files/package-json-file.d.ts +0 -54
  92. package/dist/get-package-json-files/package-json-file.js +0 -44
  93. package/dist/guards/can-add-to-group.d.ts +0 -5
  94. package/dist/guards/can-add-to-group.js +0 -58
  95. package/dist/guards/is-semver.d.ts +0 -2
  96. package/dist/guards/is-semver.js +0 -15
  97. package/dist/guards/is-valid-semver-range.d.ts +0 -3
  98. package/dist/guards/is-valid-semver-range.js +0 -14
  99. package/dist/index.d.ts +0 -2
  100. package/dist/index.js +0 -1
  101. package/dist/io/ask-for-choice.d.ts +0 -14
  102. package/dist/io/ask-for-choice.js +0 -17
  103. package/dist/io/ask-for-input.d.ts +0 -13
  104. package/dist/io/ask-for-input.js +0 -14
  105. package/dist/io/exit-if-invalid.d.ts +0 -4
  106. package/dist/io/exit-if-invalid.js +0 -9
  107. package/dist/io/glob-sync.d.ts +0 -11
  108. package/dist/io/glob-sync.js +0 -14
  109. package/dist/io/index.d.ts +0 -27
  110. package/dist/io/index.js +0 -26
  111. package/dist/io/read-config-file.d.ts +0 -7
  112. package/dist/io/read-config-file.js +0 -24
  113. package/dist/io/read-file-sync.d.ts +0 -12
  114. package/dist/io/read-file-sync.js +0 -9
  115. package/dist/io/read-json-file-sync.d.ts +0 -31
  116. package/dist/io/read-json-file-sync.js +0 -23
  117. package/dist/io/read-yaml-file-sync.d.ts +0 -12
  118. package/dist/io/read-yaml-file-sync.js +0 -9
  119. package/dist/io/to-formatted-json.d.ts +0 -9
  120. package/dist/io/to-formatted-json.js +0 -32
  121. package/dist/io/write-file-sync.d.ts +0 -12
  122. package/dist/io/write-file-sync.js +0 -10
  123. package/dist/io/write-if-changed.d.ts +0 -5
  124. package/dist/io/write-if-changed.js +0 -9
  125. package/dist/lib/format-repository-url.d.ts +0 -1
  126. package/dist/lib/format-repository-url.js +0 -40
  127. package/dist/lib/get-group-header.d.ts +0 -10
  128. package/dist/lib/get-group-header.js +0 -25
  129. package/dist/lib/get.d.ts +0 -11
  130. package/dist/lib/get.js +0 -44
  131. package/dist/lib/pad-start.d.ts +0 -1
  132. package/dist/lib/pad-start.js +0 -3
  133. package/dist/lib/ring-buffer.d.ts +0 -10
  134. package/dist/lib/ring-buffer.js +0 -20
  135. package/dist/lib/set-semver-range.d.ts +0 -3
  136. package/dist/lib/set-semver-range.js +0 -24
  137. package/dist/lib/show-help-on-error.d.ts +0 -2
  138. package/dist/lib/show-help-on-error.js +0 -32
  139. package/dist/lib/sort-by-name.d.ts +0 -5
  140. package/dist/lib/sort-by-name.js +0 -9
  141. package/dist/lib/with-logger.d.ts +0 -2
  142. package/dist/lib/with-logger.js +0 -28
  143. package/dist/option.d.ts +0 -10
  144. package/dist/option.js +0 -30
  145. package/dist/report.d.ts +0 -131
  146. package/dist/report.js +0 -129
  147. package/dist/schema.json +0 -614
  148. package/dist/semver-group/create-semver-groups.d.ts +0 -4
  149. package/dist/semver-group/create-semver-groups.js +0 -83
  150. package/dist/semver-group/disabled.d.ts +0 -26
  151. package/dist/semver-group/disabled.js +0 -28
  152. package/dist/semver-group/filtered-out.d.ts +0 -27
  153. package/dist/semver-group/filtered-out.js +0 -34
  154. package/dist/semver-group/ignored.d.ts +0 -22
  155. package/dist/semver-group/ignored.js +0 -24
  156. package/dist/semver-group/index.d.ts +0 -20
  157. package/dist/semver-group/index.js +0 -7
  158. package/dist/semver-group/with-range.d.ts +0 -22
  159. package/dist/semver-group/with-range.js +0 -45
  160. package/dist/specifier/alias.d.ts +0 -17
  161. package/dist/specifier/alias.js +0 -21
  162. package/dist/specifier/base.d.ts +0 -41
  163. package/dist/specifier/base.js +0 -54
  164. package/dist/specifier/delete.d.ts +0 -17
  165. package/dist/specifier/delete.js +0 -16
  166. package/dist/specifier/exact.d.ts +0 -20
  167. package/dist/specifier/exact.js +0 -21
  168. package/dist/specifier/file.d.ts +0 -8
  169. package/dist/specifier/file.js +0 -7
  170. package/dist/specifier/hosted-git.d.ts +0 -15
  171. package/dist/specifier/hosted-git.js +0 -24
  172. package/dist/specifier/index.d.ts +0 -28
  173. package/dist/specifier/index.js +0 -75
  174. package/dist/specifier/latest.d.ts +0 -19
  175. package/dist/specifier/latest.js +0 -20
  176. package/dist/specifier/lib/non-semver-error.d.ts +0 -11
  177. package/dist/specifier/lib/non-semver-error.js +0 -6
  178. package/dist/specifier/lib/parse-specifier.d.ts +0 -14
  179. package/dist/specifier/lib/parse-specifier.js +0 -18
  180. package/dist/specifier/lib/specific-registry-result.d.ts +0 -9
  181. package/dist/specifier/lib/specific-registry-result.js +0 -1
  182. package/dist/specifier/range.d.ts +0 -19
  183. package/dist/specifier/range.js +0 -20
  184. package/dist/specifier/tag.d.ts +0 -11
  185. package/dist/specifier/tag.js +0 -10
  186. package/dist/specifier/unsupported.d.ts +0 -7
  187. package/dist/specifier/unsupported.js +0 -7
  188. package/dist/specifier/url.d.ts +0 -8
  189. package/dist/specifier/url.js +0 -7
  190. package/dist/specifier/workspace-protocol.d.ts +0 -19
  191. package/dist/specifier/workspace-protocol.js +0 -35
  192. package/dist/strategy/lib/get-non-empty-string-prop.d.ts +0 -3
  193. package/dist/strategy/lib/get-non-empty-string-prop.js +0 -7
  194. package/dist/strategy/name-and-version-props.d.ts +0 -12
  195. package/dist/strategy/name-and-version-props.js +0 -60
  196. package/dist/strategy/named-version-string.d.ts +0 -11
  197. package/dist/strategy/named-version-string.js +0 -52
  198. package/dist/strategy/unnamed-version-string.d.ts +0 -11
  199. package/dist/strategy/unnamed-version-string.js +0 -45
  200. package/dist/strategy/versions-by-name.d.ts +0 -11
  201. package/dist/strategy/versions-by-name.js +0 -27
  202. package/dist/version-group/banned.d.ts +0 -17
  203. package/dist/version-group/banned.js +0 -26
  204. package/dist/version-group/create-version-groups.d.ts +0 -4
  205. package/dist/version-group/create-version-groups.js +0 -118
  206. package/dist/version-group/filtered-out.d.ts +0 -19
  207. package/dist/version-group/filtered-out.js +0 -30
  208. package/dist/version-group/ignored.d.ts +0 -17
  209. package/dist/version-group/ignored.js +0 -23
  210. package/dist/version-group/index.d.ts +0 -26
  211. package/dist/version-group/index.js +0 -7
  212. package/dist/version-group/lib/clean.d.ts +0 -2
  213. package/dist/version-group/lib/clean.js +0 -6
  214. package/dist/version-group/lib/delete.d.ts +0 -2
  215. package/dist/version-group/lib/delete.js +0 -1
  216. package/dist/version-group/lib/get-highest-version.d.ts +0 -6
  217. package/dist/version-group/lib/get-highest-version.js +0 -8
  218. package/dist/version-group/lib/get-lowest-version.d.ts +0 -6
  219. package/dist/version-group/lib/get-lowest-version.js +0 -8
  220. package/dist/version-group/lib/get-preferred-version.d.ts +0 -5
  221. package/dist/version-group/lib/get-preferred-version.js +0 -53
  222. package/dist/version-group/lib/get-range-score.d.ts +0 -2
  223. package/dist/version-group/lib/get-range-score.js +0 -20
  224. package/dist/version-group/lib/group-by.d.ts +0 -5
  225. package/dist/version-group/lib/group-by.js +0 -11
  226. package/dist/version-group/pinned.d.ts +0 -17
  227. package/dist/version-group/pinned.js +0 -26
  228. package/dist/version-group/same-range.d.ts +0 -19
  229. package/dist/version-group/same-range.js +0 -96
  230. package/dist/version-group/snapped-to.d.ts +0 -17
  231. package/dist/version-group/snapped-to.js +0 -71
  232. package/dist/version-group/standard.d.ts +0 -18
  233. package/dist/version-group/standard.js +0 -119
@@ -1,19 +0,0 @@
1
- import { Effect } from 'effect';
2
- import { BaseSpecifier } from './base.js';
3
- import { Specifier } from './index.js';
4
- import { NonSemverError } from './lib/non-semver-error.js';
5
- import type { SpecificRegistryResult } from './lib/specific-registry-result.js';
6
- type T = SpecificRegistryResult<'range'>;
7
- /**
8
- * @example "*"
9
- */
10
- export declare class LatestSpecifier extends BaseSpecifier<T> {
11
- _tag: string;
12
- /** The public name referenced in config */
13
- name: "latest";
14
- /** Return the semver version including the range */
15
- getSemver(): Effect.Effect<string, NonSemverError>;
16
- /** Get a new `Specifier` from the given semver version applied to this one */
17
- setSemver(version: string): Effect.Effect<Specifier.Any>;
18
- }
19
- export {};
@@ -1,20 +0,0 @@
1
- import { Effect, pipe } from 'effect';
2
- import { BaseSpecifier } from './base.js';
3
- import { Specifier } from './index.js';
4
- import { NonSemverError } from './lib/non-semver-error.js';
5
- /**
6
- * @example "*"
7
- */
8
- export class LatestSpecifier extends BaseSpecifier {
9
- _tag = 'Latest';
10
- /** The public name referenced in config */
11
- name = 'latest';
12
- /** Return the semver version including the range */
13
- getSemver() {
14
- return pipe(this.parse(), Effect.mapError(() => new NonSemverError({ specifier: this })), Effect.map(parsed => parsed.fetchSpec));
15
- }
16
- /** Get a new `Specifier` from the given semver version applied to this one */
17
- setSemver(version) {
18
- return Effect.succeed(Specifier.create(this.instance, version));
19
- }
20
- }
@@ -1,11 +0,0 @@
1
- import { Effect } from 'effect';
2
- import type { Specifier } from '../index.js';
3
- declare const NonSemverError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Readonly<A> & {
4
- readonly _tag: "NonSemverError";
5
- };
6
- export declare class NonSemverError extends NonSemverError_base<{
7
- specifier: Specifier.Any;
8
- }> {
9
- static asEffect<T>(specifier: Specifier.Any): Effect.Effect<T, NonSemverError>;
10
- }
11
- export {};
@@ -1,6 +0,0 @@
1
- import { Data, Effect } from 'effect';
2
- export class NonSemverError extends Data.TaggedClass('NonSemverError') {
3
- static asEffect(specifier) {
4
- return Effect.fail(new NonSemverError({ specifier }));
5
- }
6
- }
@@ -1,14 +0,0 @@
1
- import npa from 'npm-package-arg';
2
- import type { PackageJsonFile } from '../../get-package-json-files/package-json-file.js';
3
- /** Extends npm/npm-package-arg to support "workspace:*" */
4
- export interface WorkspaceProtocolResult {
5
- type: 'workspaceProtocol';
6
- raw: string;
7
- name: string | null;
8
- escapedName: string | null;
9
- scope: string | null;
10
- rawSpec: string;
11
- saveSpec: string;
12
- }
13
- export type NpmPackageArgResult = ReturnType<typeof npa.resolve> | WorkspaceProtocolResult;
14
- export declare function parseSpecifier(name: string, specifier: string, packageJsonFile: PackageJsonFile): NpmPackageArgResult;
@@ -1,18 +0,0 @@
1
- import npa from 'npm-package-arg';
2
- export function parseSpecifier(name, specifier, packageJsonFile) {
3
- if (specifier === 'workspace:*' ||
4
- specifier === 'workspace:~' ||
5
- specifier === 'workspace:^') {
6
- const parsed = npa.resolve(name, packageJsonFile.jsonFile.dirPath, specifier.replace('workspace:', 'file:'));
7
- return {
8
- escapedName: parsed.escapedName,
9
- name: parsed.name,
10
- raw: parsed.raw.replace('file:', 'workspace:'),
11
- rawSpec: parsed.rawSpec.replace('file:', 'workspace:'),
12
- saveSpec: parsed.saveSpec.replace('file:', 'workspace:'),
13
- scope: parsed.scope,
14
- type: 'workspaceProtocol',
15
- };
16
- }
17
- return npa.resolve(name, specifier, packageJsonFile.jsonFile.dirPath);
18
- }
@@ -1,9 +0,0 @@
1
- import type { RegistryResult } from 'npm-package-arg';
2
- /**
3
- * A helper to create specific classes for each of the possible
4
- * `RegistryResult` types from npm/npm-package-arg. Instead of grouping them
5
- * together we are being more specific
6
- */
7
- export type SpecificRegistryResult<T extends RegistryResult['type'] | 'local'> = Omit<RegistryResult, 'type'> & {
8
- type: T;
9
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,19 +0,0 @@
1
- import { Effect } from 'effect';
2
- import { BaseSpecifier } from './base.js';
3
- import { Specifier } from './index.js';
4
- import { NonSemverError } from './lib/non-semver-error.js';
5
- import type { SpecificRegistryResult } from './lib/specific-registry-result.js';
6
- type T = SpecificRegistryResult<'range'>;
7
- /**
8
- * @example "^1.2.3"
9
- */
10
- export declare class RangeSpecifier extends BaseSpecifier<T> {
11
- _tag: string;
12
- /** The public name referenced in config */
13
- name: "range";
14
- /** Return the semver version including the range */
15
- getSemver(): Effect.Effect<string, NonSemverError>;
16
- /** Get a new `Specifier` from the given semver version applied to this one */
17
- setSemver(version: string): Effect.Effect<Specifier.Any>;
18
- }
19
- export {};
@@ -1,20 +0,0 @@
1
- import { Effect, pipe } from 'effect';
2
- import { BaseSpecifier } from './base.js';
3
- import { Specifier } from './index.js';
4
- import { NonSemverError } from './lib/non-semver-error.js';
5
- /**
6
- * @example "^1.2.3"
7
- */
8
- export class RangeSpecifier extends BaseSpecifier {
9
- _tag = 'Range';
10
- /** The public name referenced in config */
11
- name = 'range';
12
- /** Return the semver version including the range */
13
- getSemver() {
14
- return pipe(this.parse(), Effect.mapError(() => new NonSemverError({ specifier: this })), Effect.map(parsed => parsed.fetchSpec));
15
- }
16
- /** Get a new `Specifier` from the given semver version applied to this one */
17
- setSemver(version) {
18
- return Effect.succeed(Specifier.create(this.instance, version));
19
- }
20
- }
@@ -1,11 +0,0 @@
1
- import { BaseSpecifier } from './base.js';
2
- import type { SpecificRegistryResult } from './lib/specific-registry-result.js';
3
- /**
4
- * @example "latest"
5
- * @example "made-up-by-some-dev"
6
- */
7
- export declare class TagSpecifier extends BaseSpecifier<SpecificRegistryResult<'tag'>> {
8
- _tag: string;
9
- /** The public name referenced in config */
10
- name: "tag";
11
- }
@@ -1,10 +0,0 @@
1
- import { BaseSpecifier } from './base.js';
2
- /**
3
- * @example "latest"
4
- * @example "made-up-by-some-dev"
5
- */
6
- export class TagSpecifier extends BaseSpecifier {
7
- _tag = 'Tag';
8
- /** The public name referenced in config */
9
- name = 'tag';
10
- }
@@ -1,7 +0,0 @@
1
- import { BaseSpecifier } from './base.js';
2
- /** A specifier not supported by the `npm` package manager */
3
- export declare class UnsupportedSpecifier extends BaseSpecifier<unknown> {
4
- _tag: string;
5
- /** The public name referenced in config */
6
- name: "unsupported";
7
- }
@@ -1,7 +0,0 @@
1
- import { BaseSpecifier } from './base.js';
2
- /** A specifier not supported by the `npm` package manager */
3
- export class UnsupportedSpecifier extends BaseSpecifier {
4
- _tag = 'Unsupported';
5
- /** The public name referenced in config */
6
- name = 'unsupported';
7
- }
@@ -1,8 +0,0 @@
1
- import type { URLResult } from 'npm-package-arg';
2
- import { BaseSpecifier } from './base.js';
3
- /** @example "http://x.com/foo.tgz" */
4
- export declare class UrlSpecifier extends BaseSpecifier<URLResult> {
5
- _tag: string;
6
- /** The public name referenced in config */
7
- name: "url";
8
- }
@@ -1,7 +0,0 @@
1
- import { BaseSpecifier } from './base.js';
2
- /** @example "http://x.com/foo.tgz" */
3
- export class UrlSpecifier extends BaseSpecifier {
4
- _tag = 'Url';
5
- /** The public name referenced in config */
6
- name = 'url';
7
- }
@@ -1,19 +0,0 @@
1
- import { Effect } from 'effect';
2
- import type { Ctx } from '../get-context/index.js';
3
- import { BaseSpecifier } from './base.js';
4
- import { Specifier } from './index.js';
5
- import type { WorkspaceProtocolResult } from './lib/parse-specifier.js';
6
- /** Represents "workspace:*" and "workspace:~" */
7
- export declare class WorkspaceProtocolSpecifier extends BaseSpecifier<WorkspaceProtocolResult> {
8
- _tag: string;
9
- /** The public name referenced in config */
10
- name: "workspace-protocol";
11
- /**
12
- * Return an equivalent value which actually is semver, so that it can be used
13
- * with tools which expect values which conform to the spec. This value is
14
- * used only when sorting versions.
15
- */
16
- getSemverEquivalent(ctx: Ctx): Effect.Effect<string>;
17
- getSemver(): Effect.Effect<string>;
18
- setSemver(version: string): Effect.Effect<Specifier.Any>;
19
- }
@@ -1,35 +0,0 @@
1
- import { Effect } from 'effect';
2
- import { BaseSpecifier } from './base.js';
3
- import { Specifier } from './index.js';
4
- /** Represents "workspace:*" and "workspace:~" */
5
- export class WorkspaceProtocolSpecifier extends BaseSpecifier {
6
- _tag = 'WorkspaceProtocol';
7
- /** The public name referenced in config */
8
- name = 'workspace-protocol';
9
- /**
10
- * Return an equivalent value which actually is semver, so that it can be used
11
- * with tools which expect values which conform to the spec. This value is
12
- * used only when sorting versions.
13
- */
14
- getSemverEquivalent(ctx) {
15
- if (this.raw === 'workspace:*') {
16
- return Effect.succeed('*');
17
- }
18
- if (this.raw === 'workspace:~' || this.raw === 'workspace:^') {
19
- const range = this.raw.replace('workspace:', '');
20
- const local = ctx.packageJsonFilesByName[this.instance.name];
21
- const version = local?.jsonFile?.contents?.version;
22
- if (version) {
23
- return Effect.succeed(`${range}${version}`);
24
- }
25
- }
26
- return Effect.succeed('0.0.0');
27
- }
28
- // @TODO: this name is inaccurate, check how it is used and change logic or rename
29
- getSemver() {
30
- return Effect.succeed(this.raw);
31
- }
32
- setSemver(version) {
33
- return Effect.succeed(Specifier.create(this.instance, version));
34
- }
35
- }
@@ -1,3 +0,0 @@
1
- import { Effect } from 'effect';
2
- import type { PackageJsonFile } from '../../get-package-json-files/package-json-file.js';
3
- export declare function getNonEmptyStringProp(propPath: string, file: PackageJsonFile): Effect.Effect<string, unknown>;
@@ -1,7 +0,0 @@
1
- import { Effect, Option, pipe } from 'effect';
2
- import { isNonEmptyString } from 'tightrope/guard/is-non-empty-string.js';
3
- import { get } from '../../lib/get.js';
4
- const getOptionOfNonEmptyString = Option.liftPredicate(isNonEmptyString);
5
- export function getNonEmptyStringProp(propPath, file) {
6
- return pipe(get(file.jsonFile.contents, ...propPath.split('.')), Effect.flatMap(value => getOptionOfNonEmptyString(value)), Effect.tapError(() => Effect.logDebug(`<${file.jsonFile.shortPath}>.${propPath} is not a non-empty string`)));
7
- }
@@ -1,12 +0,0 @@
1
- import { Effect } from 'effect';
2
- import type { PackageJsonFile } from '../get-package-json-files/package-json-file.js';
3
- import type { Delete } from '../version-group/lib/delete.js';
4
- export declare class NameAndVersionPropsStrategy {
5
- _tag: string;
6
- name: string;
7
- path: string;
8
- namePath: string;
9
- constructor(name: string, path: string, namePath: string);
10
- read(file: PackageJsonFile): Effect.Effect<[string, string][]>;
11
- write(file: PackageJsonFile, [, version]: [string, string | Delete]): Effect.Effect<PackageJsonFile>;
12
- }
@@ -1,60 +0,0 @@
1
- import { Effect, Option, identity, pipe } from 'effect';
2
- import { isObject } from 'tightrope/guard/is-object.js';
3
- import { get } from '../lib/get.js';
4
- import { DELETE } from '../version-group/lib/delete.js';
5
- import { getNonEmptyStringProp } from './lib/get-non-empty-string-prop.js';
6
- const getOptionOfObject = Option.liftPredicate((isObject));
7
- export class NameAndVersionPropsStrategy {
8
- _tag = 'name~version';
9
- name;
10
- path;
11
- namePath;
12
- constructor(name, path, namePath) {
13
- this.name = name;
14
- this.path = path;
15
- this.namePath = namePath;
16
- }
17
- read(file) {
18
- return pipe(Effect.Do,
19
- // get the name prop
20
- Effect.bind('name', () => getNonEmptyStringProp(this.namePath, file)),
21
- // add the version prop
22
- Effect.bind('version', () => pipe(getNonEmptyStringProp(this.path, file),
23
- /**
24
- * In order to report a `MissingLocalVersion`, we need to ensure that
25
- * a value is returned for `local` package .version properties so we
26
- * can know that `this.name` is a package developed in this repo but
27
- * that its version is missing.
28
- *
29
- * Not doing this results in the invalid local package being ignored
30
- * and each installation of it being checked for mismatches amongst
31
- * themselves.
32
- */
33
- this.name === 'local'
34
- ? Effect.catchAll(() => Effect.succeed('PACKAGE_JSON_HAS_NO_VERSION'))
35
- : Effect.map(identity))),
36
- // if both are non empty strings, we can return them
37
- Effect.map(({ name, version }) => [[name, version]]), Effect.tapError(() => Effect.logDebug(`NameAndVersionPropsStrategy#${this.name} found nothing at <${file.jsonFile.shortPath}>.${this.path} & .${this.namePath}`)),
38
- // if either are invalid, default to empty
39
- Effect.catchAll(() => Effect.succeed([])));
40
- }
41
- write(file, [, version]) {
42
- const path = this.path;
43
- const { contents } = file.jsonFile;
44
- const isNestedPath = path.includes('.');
45
- const nextValue = version === DELETE ? undefined : version;
46
- if (isNestedPath) {
47
- const fullPath = path.split('.');
48
- const pathToParent = fullPath.slice(0, fullPath.length - 1).join('.');
49
- const key = fullPath.slice(-1).join('');
50
- return pipe(get(contents, ...pathToParent.split('.')), Effect.flatMap(getOptionOfObject), Effect.flatMap(parent => Effect.try(() => {
51
- parent[key] = nextValue;
52
- file.applyEdit(fullPath, nextValue);
53
- })), Effect.tapError(() => Effect.logDebug(`strategy ${this._tag} with name ${this.name} failed to write to <${file.jsonFile.shortPath}>.${this.path}`)), Effect.catchAll(() => Effect.succeed(file)), Effect.map(() => file));
54
- }
55
- return pipe(getOptionOfObject(contents), Effect.flatMap(parent => Effect.try(() => {
56
- parent[this.path] = nextValue;
57
- file.applyEdit([this.path], nextValue);
58
- })), Effect.tapError(() => Effect.logDebug(`strategy ${this._tag} with name ${this.name} failed to write to <${file.jsonFile.shortPath}>.${this.path}`)), Effect.catchAll(() => Effect.succeed(file)), Effect.map(() => file));
59
- }
60
- }
@@ -1,11 +0,0 @@
1
- import { Effect } from 'effect';
2
- import type { PackageJsonFile } from '../get-package-json-files/package-json-file.js';
3
- import type { Delete } from '../version-group/lib/delete.js';
4
- export declare class NamedVersionStringStrategy {
5
- _tag: string;
6
- name: string;
7
- path: string;
8
- constructor(name: string, path: string);
9
- read(file: PackageJsonFile): Effect.Effect<[string, string][]>;
10
- write(file: PackageJsonFile, [name, version]: [string, string | Delete]): Effect.Effect<PackageJsonFile>;
11
- }
@@ -1,52 +0,0 @@
1
- import { Effect, Option, pipe } from 'effect';
2
- import { isNonEmptyObject } from 'tightrope/guard/is-non-empty-object.js';
3
- import { isNonEmptyString } from 'tightrope/guard/is-non-empty-string.js';
4
- import { get } from '../lib/get.js';
5
- import { DELETE } from '../version-group/lib/delete.js';
6
- import { getNonEmptyStringProp } from './lib/get-non-empty-string-prop.js';
7
- const getOptionOfNonEmptyString = Option.liftPredicate(isNonEmptyString);
8
- const getOptionOfNonEmptyObject = Option.liftPredicate((isNonEmptyObject));
9
- export class NamedVersionStringStrategy {
10
- _tag = 'name@version';
11
- name;
12
- path;
13
- constructor(name, path) {
14
- this.name = name;
15
- this.path = path;
16
- }
17
- read(file) {
18
- const path = this.path;
19
- return pipe(
20
- // get version prop
21
- getNonEmptyStringProp(path, file),
22
- // if it is a non empty string, we can read it
23
- Effect.map(value => value.split(/@(.*)/)),
24
- // check the string was properly formed
25
- Effect.flatMap(([name, version]) => Effect.all([
26
- getOptionOfNonEmptyString(name),
27
- getOptionOfNonEmptyString(version),
28
- ])),
29
- // return an array of one entry if valid
30
- Effect.map(([name, version]) => [[name, version]]), Effect.tapError(() => Effect.logDebug(`NamedVersionStringStrategy#${this.name} found nothing at <${file.jsonFile.shortPath}>.${this.path}`)),
31
- // if value is invalid, default to empty
32
- Effect.catchAll(() => Effect.succeed([])));
33
- }
34
- write(file, [name, version]) {
35
- const { contents } = file.jsonFile;
36
- const isNestedPath = this.path.includes('.');
37
- const nextValue = version === DELETE ? undefined : `${name}@${version}`;
38
- if (isNestedPath) {
39
- const fullPath = this.path.split('.');
40
- const pathToParent = fullPath.slice(0, fullPath.length - 1).join('.');
41
- const key = fullPath.slice(-1).join('');
42
- return pipe(get(contents, ...pathToParent.split('.')), Effect.flatMap(getOptionOfNonEmptyObject), Effect.flatMap(parent => Effect.try(() => {
43
- parent[key] = nextValue;
44
- file.applyEdit(fullPath, nextValue);
45
- })), Effect.tapError(() => Effect.logDebug(`strategy ${this._tag} with name ${this.name} failed to write to <${file.jsonFile.shortPath}>.${this.path}`)), Effect.catchAll(() => Effect.succeed(file)), Effect.map(() => file));
46
- }
47
- return pipe(getOptionOfNonEmptyObject(contents), Effect.flatMap(parent => Effect.try(() => {
48
- parent[this.path] = nextValue;
49
- file.applyEdit([this.path], nextValue);
50
- })), Effect.tapError(() => Effect.logDebug(`strategy ${this._tag} with name ${this.name} failed to write to <${file.jsonFile.shortPath}>.${this.path}`)), Effect.catchAll(() => Effect.succeed(file)), Effect.map(() => file));
51
- }
52
- }
@@ -1,11 +0,0 @@
1
- import { Effect } from 'effect';
2
- import type { PackageJsonFile } from '../get-package-json-files/package-json-file.js';
3
- import type { Delete } from '../version-group/lib/delete.js';
4
- export declare class UnnamedVersionStringStrategy {
5
- _tag: string;
6
- name: string;
7
- path: string;
8
- constructor(name: string, path: string);
9
- read(file: PackageJsonFile): Effect.Effect<[string, string][]>;
10
- write(file: PackageJsonFile, [, version]: [string, string | Delete]): Effect.Effect<PackageJsonFile>;
11
- }
@@ -1,45 +0,0 @@
1
- import { Effect, Option, pipe } from 'effect';
2
- import { isNonEmptyObject } from 'tightrope/guard/is-non-empty-object.js';
3
- import { get } from '../lib/get.js';
4
- import { DELETE } from '../version-group/lib/delete.js';
5
- import { getNonEmptyStringProp } from './lib/get-non-empty-string-prop.js';
6
- const getOptionOfNonEmptyObject = Option.liftPredicate((isNonEmptyObject));
7
- export class UnnamedVersionStringStrategy {
8
- _tag = 'version';
9
- name;
10
- path;
11
- constructor(name, path) {
12
- this.name = name;
13
- this.path = path;
14
- }
15
- read(file) {
16
- return pipe(
17
- // get version prop
18
- getNonEmptyStringProp(this.path, file),
19
- // if it is a non empty string, we can read it
20
- Effect.map((version) => {
21
- const name = this.path.split('.').slice(-1).join('');
22
- return [[name, version]];
23
- }), Effect.tapError(() => Effect.logDebug(`UnnamedVersionStringStrategy#${this.name} found nothing at <${file.jsonFile.shortPath}>.${this.path}`)),
24
- // if value is invalid, default to empty
25
- Effect.catchAll(() => Effect.succeed([])));
26
- }
27
- write(file, [, version]) {
28
- const { contents } = file.jsonFile;
29
- const isNestedPath = this.path.includes('.');
30
- const nextValue = version === DELETE ? undefined : version;
31
- if (isNestedPath) {
32
- const fullPath = this.path.split('.');
33
- const pathToParent = fullPath.slice(0, fullPath.length - 1).join('.');
34
- const key = fullPath.slice(-1).join('');
35
- return pipe(get(contents, ...pathToParent.split('.')), Effect.flatMap(getOptionOfNonEmptyObject), Effect.flatMap(parent => Effect.try(() => {
36
- parent[key] = nextValue;
37
- file.applyEdit(fullPath, nextValue);
38
- })), Effect.tapError(() => Effect.logDebug(`strategy ${this._tag} with name ${this.name} failed to write to <${file.jsonFile.shortPath}>.${this.path}`)), Effect.catchAll(() => Effect.succeed(file)), Effect.map(() => file));
39
- }
40
- return pipe(getOptionOfNonEmptyObject(contents), Effect.flatMap(parent => Effect.try(() => {
41
- parent[this.path] = nextValue;
42
- file.applyEdit([this.path], nextValue);
43
- })), Effect.tapError(() => Effect.logDebug(`strategy ${this._tag} with name ${this.name} failed to write to <${file.jsonFile.shortPath}>.${this.path}`)), Effect.catchAll(() => Effect.succeed(file)), Effect.map(() => file));
44
- }
45
- }
@@ -1,11 +0,0 @@
1
- import { Effect } from 'effect';
2
- import type { PackageJsonFile } from '../get-package-json-files/package-json-file.js';
3
- import type { Delete } from '../version-group/lib/delete.js';
4
- export declare class VersionsByNameStrategy {
5
- _tag: string;
6
- name: string;
7
- path: string;
8
- constructor(name: string, path: string);
9
- read(file: PackageJsonFile): Effect.Effect<[string, string][]>;
10
- write(file: PackageJsonFile, [name, version]: [string, string | Delete]): Effect.Effect<PackageJsonFile>;
11
- }
@@ -1,27 +0,0 @@
1
- import { Effect, Option, pipe } from 'effect';
2
- import { isNonEmptyObject } from 'tightrope/guard/is-non-empty-object.js';
3
- import { get } from '../lib/get.js';
4
- import { DELETE } from '../version-group/lib/delete.js';
5
- const getOptionOfNonEmptyObject = Option.liftPredicate((isNonEmptyObject));
6
- export class VersionsByNameStrategy {
7
- _tag = 'versionsByName';
8
- name;
9
- path;
10
- constructor(name, path) {
11
- this.name = name;
12
- this.path = path;
13
- }
14
- read(file) {
15
- return pipe(get(file.jsonFile.contents, ...this.path.split('.')), Effect.flatMap(value => getOptionOfNonEmptyObject(value)), Effect.map(obj => Object.entries(obj)), Effect.tapError(() => Effect.logDebug(`VersionsByNameStrategy#${this.name} found nothing at <${file.jsonFile.shortPath}>.${this.path}`)),
16
- // if value is invalid, default to empty
17
- Effect.catchAll(() => Effect.succeed([])));
18
- }
19
- write(file, [name, version]) {
20
- const nextValue = version === DELETE ? undefined : version;
21
- const fullPath = this.path.split('.');
22
- return pipe(get(file.jsonFile.contents, ...fullPath), Effect.flatMap(getOptionOfNonEmptyObject), Effect.flatMap(parent => Effect.try(() => {
23
- parent[name] = nextValue;
24
- file.applyEdit(fullPath.concat(name), nextValue);
25
- })), Effect.tapError(() => Effect.logDebug(`strategy ${this._tag} with name ${this.name} failed to write to <${file.jsonFile.shortPath}>.${this.path}.${name}`)), Effect.catchAll(() => Effect.succeed(file)), Effect.map(() => file));
26
- }
27
- }
@@ -1,17 +0,0 @@
1
- import { Effect } from 'effect';
2
- import type { VersionGroupConfig } from '../config/types.js';
3
- import type { Instance } from '../get-instances/instance.js';
4
- import { Report } from '../report.js';
5
- declare const BannedVersionGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Readonly<A> & {
6
- readonly _tag: "Banned";
7
- };
8
- export declare class BannedVersionGroup extends BannedVersionGroup_base<{
9
- config: VersionGroupConfig.Banned;
10
- instances: Instance[];
11
- }> {
12
- groupType: string;
13
- constructor(config: VersionGroupConfig.Banned);
14
- canAdd(_: Instance): boolean;
15
- inspectAll(): Effect.Effect<Report.Version.Group[]>;
16
- }
17
- export {};
@@ -1,26 +0,0 @@
1
- import { Data, Effect } from 'effect';
2
- import { Report } from '../report.js';
3
- import { Specifier } from '../specifier/index.js';
4
- import { DELETE } from './lib/delete.js';
5
- import { groupBy } from './lib/group-by.js';
6
- export class BannedVersionGroup extends Data.TaggedClass('Banned') {
7
- groupType = 'versionGroup';
8
- constructor(config) {
9
- super({
10
- config,
11
- instances: [],
12
- });
13
- }
14
- canAdd(_) {
15
- return true;
16
- }
17
- inspectAll() {
18
- return Effect.succeed(Object.entries(groupBy('name', this.instances)).map(([name, instances]) => ({
19
- name,
20
- reports: instances.map(instance =>
21
- // ✘ package should not be used
22
- // ✓ is a mismatch we can auto-fix
23
- new Report.Banned(Specifier.create(instance, DELETE))),
24
- })));
25
- }
26
- }
@@ -1,4 +0,0 @@
1
- import { Effect } from 'effect';
2
- import type { Ctx } from '../get-context/index.js';
3
- import { VersionGroup } from './index.js';
4
- export declare function createVersionGroups(ctx: Ctx): Effect.Effect<VersionGroup.Any[], VersionGroup.ConfigError>;