syncpack 12.3.0 → 12.3.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.
- package/dist/bin-fix-mismatches/fix-mismatches.d.ts +9 -9
- package/dist/bin-fix-mismatches/fix-mismatches.js +43 -54
- package/dist/bin-fix-mismatches/index.js +26 -31
- package/dist/bin-format/format.d.ts +6 -6
- package/dist/bin-format/format.js +27 -32
- package/dist/bin-format/index.js +20 -25
- package/dist/bin-lint/index.js +15 -20
- package/dist/bin-lint/lint.d.ts +4 -4
- package/dist/bin-lint/lint.js +28 -35
- package/dist/bin-lint-semver-ranges/index.js +24 -29
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.d.ts +8 -8
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +34 -44
- package/dist/bin-list/index.js +24 -29
- package/dist/bin-list/list.d.ts +7 -7
- package/dist/bin-list/list.js +55 -64
- package/dist/bin-list-mismatches/index.js +24 -29
- package/dist/bin-list-mismatches/list-mismatches.d.ts +10 -10
- package/dist/bin-list-mismatches/list-mismatches.js +62 -70
- package/dist/bin-prompt/index.js +26 -31
- package/dist/bin-prompt/prompt.d.ts +4 -4
- package/dist/bin-prompt/prompt.js +41 -48
- package/dist/bin-set-semver-ranges/index.js +26 -31
- package/dist/bin-set-semver-ranges/set-semver-ranges.d.ts +4 -4
- package/dist/bin-set-semver-ranges/set-semver-ranges.js +26 -30
- package/dist/bin-update/effects.d.ts +18 -18
- package/dist/bin-update/effects.js +77 -106
- package/dist/bin-update/index.js +23 -28
- package/dist/bin-update/update.d.ts +5 -5
- package/dist/bin-update/update.js +33 -40
- package/dist/bin.js +8 -5
- package/dist/config/get-custom-types.d.ts +9 -9
- package/dist/config/get-custom-types.js +22 -27
- package/dist/config/get-enabled-types.d.ts +8 -8
- package/dist/config/get-enabled-types.js +42 -48
- package/dist/config/get-filter.d.ts +1 -1
- package/dist/config/get-filter.js +6 -10
- package/dist/config/get-indent.d.ts +1 -1
- package/dist/config/get-indent.js +6 -10
- package/dist/config/get-sort-az.d.ts +1 -1
- package/dist/config/get-sort-az.js +6 -10
- package/dist/config/get-sort-exports.d.ts +1 -1
- package/dist/config/get-sort-exports.js +6 -10
- package/dist/config/get-sort-first.d.ts +1 -1
- package/dist/config/get-sort-first.js +6 -10
- package/dist/config/get-source.d.ts +1 -1
- package/dist/config/get-source.js +4 -8
- package/dist/config/tag.d.ts +1 -1
- package/dist/config/tag.js +2 -5
- package/dist/config/types.d.ts +2 -5
- package/dist/config/types.js +1 -2
- package/dist/constants.js +7 -10
- package/dist/error-handlers/default-error-handlers.d.ts +10 -10
- package/dist/error-handlers/default-error-handlers.js +55 -61
- package/dist/get-context/index.d.ts +5 -5
- package/dist/get-context/index.js +13 -17
- package/dist/get-context/lib/key-by.js +1 -5
- package/dist/get-instances/index.d.ts +7 -7
- package/dist/get-instances/index.js +19 -23
- package/dist/get-instances/instance.d.ts +7 -7
- package/dist/get-instances/instance.js +4 -8
- package/dist/get-package-json-files/get-file-paths.d.ts +7 -7
- package/dist/get-package-json-files/get-file-paths.js +10 -15
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.d.ts +2 -2
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.js +8 -12
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.d.ts +2 -2
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.js +8 -12
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.d.ts +2 -2
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.js +14 -18
- package/dist/get-package-json-files/get-patterns/index.d.ts +3 -3
- package/dist/get-package-json-files/get-patterns/index.js +11 -15
- package/dist/get-package-json-files/index.d.ts +8 -8
- package/dist/get-package-json-files/index.js +6 -10
- package/dist/get-package-json-files/package-json-file.d.ts +6 -6
- package/dist/get-package-json-files/package-json-file.js +8 -12
- package/dist/guards/can-add-to-group.d.ts +4 -4
- package/dist/guards/can-add-to-group.js +10 -14
- package/dist/guards/is-semver.js +3 -7
- package/dist/guards/is-valid-semver-range.d.ts +1 -1
- package/dist/guards/is-valid-semver-range.js +12 -16
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/io/ask-for-choice.d.ts +5 -5
- package/dist/io/ask-for-choice.js +5 -9
- package/dist/io/ask-for-input.d.ts +5 -5
- package/dist/io/ask-for-input.js +5 -9
- package/dist/io/exit-if-invalid.d.ts +3 -3
- package/dist/io/exit-if-invalid.js +5 -9
- package/dist/io/glob-sync.d.ts +5 -5
- package/dist/io/glob-sync.js +4 -9
- package/dist/io/index.d.ts +8 -8
- package/dist/io/index.js +12 -38
- package/dist/io/read-config-file.d.ts +7 -0
- package/dist/io/read-config-file.js +22 -0
- package/dist/io/read-file-sync.d.ts +5 -5
- package/dist/io/read-file-sync.js +4 -9
- package/dist/io/read-json-file-sync.d.ts +8 -8
- package/dist/io/read-json-file-sync.js +10 -16
- package/dist/io/read-yaml-file-sync.d.ts +5 -5
- package/dist/io/read-yaml-file-sync.js +4 -8
- package/dist/io/to-json.d.ts +2 -2
- package/dist/io/to-json.js +8 -12
- package/dist/io/write-file-sync.d.ts +5 -5
- package/dist/io/write-file-sync.js +5 -10
- package/dist/io/write-if-changed.d.ts +4 -4
- package/dist/io/write-if-changed.js +9 -16
- package/dist/lib/format-repository-url.js +1 -5
- package/dist/lib/get-group-header.d.ts +2 -2
- package/dist/lib/get-group-header.js +4 -12
- package/dist/lib/get.d.ts +10 -10
- package/dist/lib/get.js +15 -19
- package/dist/lib/pad-start.js +1 -5
- package/dist/lib/ring-buffer.js +1 -5
- package/dist/lib/set-semver-range.d.ts +1 -1
- package/dist/lib/set-semver-range.js +8 -12
- package/dist/lib/show-help-on-error.js +3 -10
- package/dist/lib/sort-by-name.js +1 -5
- package/dist/lib/with-logger.d.ts +1 -1
- package/dist/lib/with-logger.js +17 -24
- package/dist/option.d.ts +1 -1
- package/dist/option.js +8 -14
- package/dist/report.d.ts +2 -2
- package/dist/report.js +2 -5
- package/dist/semver-group/create-semver-groups.d.ts +3 -3
- package/dist/semver-group/create-semver-groups.js +28 -32
- package/dist/semver-group/disabled.d.ts +11 -11
- package/dist/semver-group/disabled.js +6 -10
- package/dist/semver-group/filtered-out.d.ts +12 -12
- package/dist/semver-group/filtered-out.js +8 -12
- package/dist/semver-group/ignored.d.ts +11 -11
- package/dist/semver-group/ignored.js +6 -10
- package/dist/semver-group/index.d.ts +6 -7
- package/dist/semver-group/index.js +4 -7
- package/dist/semver-group/with-range.d.ts +11 -11
- package/dist/semver-group/with-range.js +13 -17
- package/dist/specifier/alias.d.ts +5 -5
- package/dist/specifier/alias.js +9 -13
- package/dist/specifier/base.d.ts +7 -7
- package/dist/specifier/base.js +9 -13
- package/dist/specifier/delete.d.ts +5 -5
- package/dist/specifier/delete.js +5 -9
- package/dist/specifier/exact.d.ts +6 -6
- package/dist/specifier/exact.js +7 -11
- package/dist/specifier/file.d.ts +1 -1
- package/dist/specifier/file.js +2 -6
- package/dist/specifier/hosted-git.d.ts +5 -5
- package/dist/specifier/hosted-git.js +9 -13
- package/dist/specifier/index.d.ts +13 -13
- package/dist/specifier/index.js +28 -31
- package/dist/specifier/latest.d.ts +6 -6
- package/dist/specifier/latest.js +7 -11
- package/dist/specifier/lib/non-semver-error.d.ts +5 -5
- package/dist/specifier/lib/non-semver-error.js +3 -7
- package/dist/specifier/lib/parse-specifier.d.ts +1 -1
- package/dist/specifier/lib/parse-specifier.js +4 -11
- package/dist/specifier/lib/specific-registry-result.js +1 -2
- package/dist/specifier/range.d.ts +6 -6
- package/dist/specifier/range.js +7 -11
- package/dist/specifier/tag.d.ts +2 -2
- package/dist/specifier/tag.js +2 -6
- package/dist/specifier/unsupported.d.ts +1 -1
- package/dist/specifier/unsupported.js +2 -6
- package/dist/specifier/url.d.ts +1 -1
- package/dist/specifier/url.js +2 -6
- package/dist/specifier/workspace-protocol.d.ts +7 -7
- package/dist/specifier/workspace-protocol.js +9 -13
- package/dist/strategy/lib/get-non-empty-string-prop.d.ts +2 -2
- package/dist/strategy/lib/get-non-empty-string-prop.js +6 -10
- package/dist/strategy/name-and-version-props.d.ts +4 -4
- package/dist/strategy/name-and-version-props.js +19 -23
- package/dist/strategy/named-version-string.d.ts +4 -4
- package/dist/strategy/named-version-string.js +20 -24
- package/dist/strategy/unnamed-version-string.d.ts +4 -4
- package/dist/strategy/unnamed-version-string.js +17 -21
- package/dist/strategy/versions-by-name.d.ts +4 -4
- package/dist/strategy/versions-by-name.js +11 -15
- package/dist/version-group/banned.d.ts +7 -7
- package/dist/version-group/banned.js +8 -12
- package/dist/version-group/create-version-groups.d.ts +3 -3
- package/dist/version-group/create-version-groups.js +34 -38
- package/dist/version-group/filtered-out.d.ts +8 -8
- package/dist/version-group/filtered-out.js +8 -12
- package/dist/version-group/ignored.d.ts +7 -7
- package/dist/version-group/ignored.js +6 -10
- package/dist/version-group/index.d.ts +9 -10
- package/dist/version-group/index.js +4 -7
- package/dist/version-group/lib/clean.js +4 -11
- package/dist/version-group/lib/delete.js +1 -4
- package/dist/version-group/lib/get-highest-version.d.ts +2 -2
- package/dist/version-group/lib/get-highest-version.js +3 -7
- package/dist/version-group/lib/get-lowest-version.d.ts +2 -2
- package/dist/version-group/lib/get-lowest-version.js +3 -7
- package/dist/version-group/lib/get-preferred-version.d.ts +4 -4
- package/dist/version-group/lib/get-preferred-version.js +17 -24
- package/dist/version-group/lib/get-range-score.js +13 -17
- package/dist/version-group/lib/group-by.js +1 -5
- package/dist/version-group/pinned.d.ts +7 -7
- package/dist/version-group/pinned.js +8 -12
- package/dist/version-group/same-range.d.ts +8 -8
- package/dist/version-group/same-range.js +23 -30
- package/dist/version-group/snapped-to.d.ts +7 -7
- package/dist/version-group/snapped-to.js +20 -24
- package/dist/version-group/standard.d.ts +7 -7
- package/dist/version-group/standard.js +29 -33
- package/package.json +30 -37
- package/dist/io/read-config-file-sync.d.ts +0 -7
- package/dist/io/read-config-file-sync.js +0 -26
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { GroupConfig } from '../config/types';
|
|
3
|
-
import type { Ctx } from '../get-context';
|
|
4
|
-
import type { Instance } from '../get-instances/instance';
|
|
5
|
-
import { Report } from '../report';
|
|
6
|
-
declare const FilteredOutVersionGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { GroupConfig } from '../config/types.js';
|
|
3
|
+
import type { Ctx } from '../get-context/index.js';
|
|
4
|
+
import type { Instance } from '../get-instances/instance.js';
|
|
5
|
+
import { Report } from '../report.js';
|
|
6
|
+
declare const FilteredOutVersionGroup_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> & {
|
|
7
7
|
readonly _tag: "FilteredOut";
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
export declare class FilteredOutVersionGroup extends FilteredOutVersionGroup_base<{
|
|
10
10
|
config: GroupConfig;
|
|
11
11
|
filter: string;
|
|
@@ -14,6 +14,6 @@ export declare class FilteredOutVersionGroup extends FilteredOutVersionGroup_bas
|
|
|
14
14
|
groupType: string;
|
|
15
15
|
constructor(ctx: Ctx);
|
|
16
16
|
canAdd(instance: Instance): boolean;
|
|
17
|
-
inspectAll(): Effect.Effect<
|
|
17
|
+
inspectAll(): Effect.Effect<Report.Version.Group[]>;
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const report_1 = require("../report");
|
|
7
|
-
const group_by_1 = require("./lib/group-by");
|
|
8
|
-
class FilteredOutVersionGroup extends effect_1.Data.TaggedClass('FilteredOut') {
|
|
1
|
+
import { Data, Effect } from 'effect';
|
|
2
|
+
import { getFilter } from '../config/get-filter.js';
|
|
3
|
+
import { Report } from '../report.js';
|
|
4
|
+
import { groupBy } from './lib/group-by.js';
|
|
5
|
+
export class FilteredOutVersionGroup extends Data.TaggedClass('FilteredOut') {
|
|
9
6
|
groupType = 'versionGroup';
|
|
10
7
|
constructor(ctx) {
|
|
11
8
|
super({
|
|
@@ -15,7 +12,7 @@ class FilteredOutVersionGroup extends effect_1.Data.TaggedClass('FilteredOut') {
|
|
|
15
12
|
label: 'Filtered out',
|
|
16
13
|
packages: ['**'],
|
|
17
14
|
},
|
|
18
|
-
filter:
|
|
15
|
+
filter: getFilter(ctx.config),
|
|
19
16
|
instances: [],
|
|
20
17
|
});
|
|
21
18
|
}
|
|
@@ -23,12 +20,11 @@ class FilteredOutVersionGroup extends effect_1.Data.TaggedClass('FilteredOut') {
|
|
|
23
20
|
return instance.name.search(new RegExp(this.filter)) === -1;
|
|
24
21
|
}
|
|
25
22
|
inspectAll() {
|
|
26
|
-
return
|
|
23
|
+
return Effect.succeed(Object.entries(groupBy('name', this.instances)).map(([name, instances]) => ({
|
|
27
24
|
name,
|
|
28
25
|
reports: instances.map((instance) =>
|
|
29
26
|
// ✓ is ignored and dismissed as valid
|
|
30
|
-
new
|
|
27
|
+
new Report.FilteredOut(instance)),
|
|
31
28
|
})));
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
|
-
exports.FilteredOutVersionGroup = FilteredOutVersionGroup;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { VersionGroupConfig } from '../config/types';
|
|
3
|
-
import type { Instance } from '../get-instances/instance';
|
|
4
|
-
import { Report } from '../report';
|
|
5
|
-
declare const IgnoredVersionGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
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 IgnoredVersionGroup_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
6
|
readonly _tag: "Ignored";
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
export declare class IgnoredVersionGroup extends IgnoredVersionGroup_base<{
|
|
9
9
|
config: VersionGroupConfig.Ignored;
|
|
10
10
|
instances: Instance[];
|
|
@@ -12,6 +12,6 @@ export declare class IgnoredVersionGroup extends IgnoredVersionGroup_base<{
|
|
|
12
12
|
groupType: string;
|
|
13
13
|
constructor(config: VersionGroupConfig.Ignored);
|
|
14
14
|
canAdd(_: Instance): boolean;
|
|
15
|
-
inspectAll(): Effect.Effect<
|
|
15
|
+
inspectAll(): Effect.Effect<Report.Version.Group[]>;
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const report_1 = require("../report");
|
|
6
|
-
const group_by_1 = require("./lib/group-by");
|
|
7
|
-
class IgnoredVersionGroup extends effect_1.Data.TaggedClass('Ignored') {
|
|
1
|
+
import { Data, Effect } from 'effect';
|
|
2
|
+
import { Report } from '../report.js';
|
|
3
|
+
import { groupBy } from './lib/group-by.js';
|
|
4
|
+
export class IgnoredVersionGroup extends Data.TaggedClass('Ignored') {
|
|
8
5
|
groupType = 'versionGroup';
|
|
9
6
|
constructor(config) {
|
|
10
7
|
super({
|
|
@@ -16,12 +13,11 @@ class IgnoredVersionGroup extends effect_1.Data.TaggedClass('Ignored') {
|
|
|
16
13
|
return true;
|
|
17
14
|
}
|
|
18
15
|
inspectAll() {
|
|
19
|
-
return
|
|
16
|
+
return Effect.succeed(Object.entries(groupBy('name', this.instances)).map(([name, instances]) => ({
|
|
20
17
|
name,
|
|
21
18
|
reports: instances.map((instance) =>
|
|
22
19
|
// ✓ is ignored and dismissed as valid
|
|
23
|
-
new
|
|
20
|
+
new Report.Ignored(instance)),
|
|
24
21
|
})));
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
|
-
exports.IgnoredVersionGroup = IgnoredVersionGroup;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type { StandardVersionGroup } from './standard';
|
|
1
|
+
import type { BannedVersionGroup } from './banned.js';
|
|
2
|
+
import type { FilteredOutVersionGroup } from './filtered-out.js';
|
|
3
|
+
import type { IgnoredVersionGroup } from './ignored.js';
|
|
4
|
+
import type { PinnedVersionGroup } from './pinned.js';
|
|
5
|
+
import type { SameRangeVersionGroup } from './same-range.js';
|
|
6
|
+
import type { SnappedToVersionGroup } from './snapped-to.js';
|
|
7
|
+
import type { StandardVersionGroup } from './standard.js';
|
|
9
8
|
export declare namespace VersionGroup {
|
|
10
9
|
export type Banned = BannedVersionGroup;
|
|
11
10
|
export type FilteredOut = FilteredOutVersionGroup;
|
|
@@ -15,9 +14,9 @@ export declare namespace VersionGroup {
|
|
|
15
14
|
export type SnappedTo = SnappedToVersionGroup;
|
|
16
15
|
export type Standard = StandardVersionGroup;
|
|
17
16
|
export type Any = Banned | FilteredOut | Ignored | Pinned | SameRange | SnappedTo | Standard;
|
|
18
|
-
const ConfigError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
17
|
+
const ConfigError_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> & {
|
|
19
18
|
readonly _tag: "VersionGroupConfigError";
|
|
20
|
-
}
|
|
19
|
+
};
|
|
21
20
|
export class ConfigError extends ConfigError_base<{
|
|
22
21
|
readonly config: unknown;
|
|
23
22
|
readonly error: string;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.VersionGroup = void 0;
|
|
4
|
-
const effect_1 = require("effect");
|
|
5
|
-
var VersionGroup;
|
|
1
|
+
import { Data } from 'effect';
|
|
2
|
+
export var VersionGroup;
|
|
6
3
|
(function (VersionGroup) {
|
|
7
|
-
class ConfigError extends
|
|
4
|
+
class ConfigError extends Data.TaggedClass('VersionGroupConfigError') {
|
|
8
5
|
}
|
|
9
6
|
VersionGroup.ConfigError = ConfigError;
|
|
10
|
-
})(VersionGroup || (
|
|
7
|
+
})(VersionGroup || (VersionGroup = {}));
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.clean = void 0;
|
|
7
|
-
const coerce_1 = __importDefault(require("semver/functions/coerce"));
|
|
8
|
-
const valid_1 = __importDefault(require("semver/functions/valid"));
|
|
1
|
+
import coerce from 'semver/functions/coerce.js';
|
|
2
|
+
import valid from 'semver/functions/valid.js';
|
|
9
3
|
/** Convert eg "1" to "1.0.0" which the semver lib does not understand */
|
|
10
|
-
function clean(v) {
|
|
11
|
-
return (
|
|
4
|
+
export function clean(v) {
|
|
5
|
+
return valid(coerce(v)) || '';
|
|
12
6
|
}
|
|
13
|
-
exports.clean = clean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Specifier } from '../../specifier';
|
|
1
|
+
import type { Specifier } from '../../specifier/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* From an array of instances where every instance contains a valid semver
|
|
4
4
|
* version, return the highest version number
|
|
5
5
|
*/
|
|
6
|
-
export declare function getHighestVersion(specifiers: Specifier.Any[]): import("effect/Effect").Effect<
|
|
6
|
+
export declare function getHighestVersion(specifiers: Specifier.Any[]): import("effect/Effect").Effect<Specifier.Any, import("../../specifier/lib/non-semver-error.js").NonSemverError, never>;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getHighestVersion = void 0;
|
|
4
|
-
const get_preferred_version_1 = require("./get-preferred-version");
|
|
1
|
+
import { getPreferredVersion } from './get-preferred-version.js';
|
|
5
2
|
/**
|
|
6
3
|
* From an array of instances where every instance contains a valid semver
|
|
7
4
|
* version, return the highest version number
|
|
8
5
|
*/
|
|
9
|
-
function getHighestVersion(specifiers) {
|
|
10
|
-
return
|
|
6
|
+
export function getHighestVersion(specifiers) {
|
|
7
|
+
return getPreferredVersion('highestSemver', specifiers);
|
|
11
8
|
}
|
|
12
|
-
exports.getHighestVersion = getHighestVersion;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Specifier } from '../../specifier';
|
|
1
|
+
import type { Specifier } from '../../specifier/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* From an array of instances where every instance contains a valid semver
|
|
4
4
|
* version, return the lowest version number
|
|
5
5
|
*/
|
|
6
|
-
export declare function getLowestVersion(specifiers: Specifier.Any[]): import("effect/Effect").Effect<
|
|
6
|
+
export declare function getLowestVersion(specifiers: Specifier.Any[]): import("effect/Effect").Effect<Specifier.Any, import("../../specifier/lib/non-semver-error.js").NonSemverError, never>;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLowestVersion = void 0;
|
|
4
|
-
const get_preferred_version_1 = require("./get-preferred-version");
|
|
1
|
+
import { getPreferredVersion } from './get-preferred-version.js';
|
|
5
2
|
/**
|
|
6
3
|
* From an array of instances where every instance contains a valid semver
|
|
7
4
|
* version, return the lowest version number
|
|
8
5
|
*/
|
|
9
|
-
function getLowestVersion(specifiers) {
|
|
10
|
-
return
|
|
6
|
+
export function getLowestVersion(specifiers) {
|
|
7
|
+
return getPreferredVersion('lowestSemver', specifiers);
|
|
11
8
|
}
|
|
12
|
-
exports.getLowestVersion = getLowestVersion;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import type { VersionGroupConfig } from '../../config/types';
|
|
3
|
-
import type { Specifier } from '../../specifier';
|
|
4
|
-
import type { NonSemverError } from '../../specifier/lib/non-semver-error';
|
|
5
|
-
export declare function getPreferredVersion(preferVersion: VersionGroupConfig.Standard['preferVersion'], specifiers: Specifier.Any[]): Effect.Effect<
|
|
2
|
+
import type { VersionGroupConfig } from '../../config/types.js';
|
|
3
|
+
import type { Specifier } from '../../specifier/index.js';
|
|
4
|
+
import type { NonSemverError } from '../../specifier/lib/non-semver-error.js';
|
|
5
|
+
export declare function getPreferredVersion(preferVersion: VersionGroupConfig.Standard['preferVersion'], specifiers: Specifier.Any[]): Effect.Effect<Specifier.Any, NonSemverError>;
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const gt_1 = __importDefault(require("semver/functions/gt"));
|
|
9
|
-
const lt_1 = __importDefault(require("semver/functions/lt"));
|
|
10
|
-
const clean_1 = require("./clean");
|
|
11
|
-
const get_range_score_1 = require("./get-range-score");
|
|
12
|
-
function getPreferredVersion(preferVersion, specifiers) {
|
|
13
|
-
return (0, effect_1.pipe)(
|
|
1
|
+
import { Effect, pipe } from 'effect';
|
|
2
|
+
import gt from 'semver/functions/gt.js';
|
|
3
|
+
import lt from 'semver/functions/lt.js';
|
|
4
|
+
import { clean } from './clean.js';
|
|
5
|
+
import { getRangeScore } from './get-range-score.js';
|
|
6
|
+
export function getPreferredVersion(preferVersion, specifiers) {
|
|
7
|
+
return pipe(
|
|
14
8
|
// every instance must have a semver version
|
|
15
|
-
|
|
9
|
+
Effect.all(specifiers.map((specifier) => pipe(specifier.getSemver(), Effect.map((semver) => ({ semver, specifier }))))),
|
|
16
10
|
// comparing semver can error on some loose ranges, all must succeed
|
|
17
|
-
|
|
11
|
+
Effect.map((semvers) => semvers.sort((a, b) => compareSemver(a.semver, b.semver))),
|
|
18
12
|
// get the preferred value from the list
|
|
19
|
-
|
|
13
|
+
Effect.map((sorted) => sorted[preferVersion === 'lowestSemver' ? 0 : sorted.length - 1]),
|
|
20
14
|
// return just the specifier
|
|
21
|
-
|
|
15
|
+
Effect.map((preferred) => preferred?.specifier));
|
|
22
16
|
}
|
|
23
|
-
exports.getPreferredVersion = getPreferredVersion;
|
|
24
17
|
const EQ = 0;
|
|
25
18
|
const LT = -1;
|
|
26
19
|
const GT = 1;
|
|
@@ -35,14 +28,14 @@ function compareSemver(a, b) {
|
|
|
35
28
|
return GT;
|
|
36
29
|
if (b === '*')
|
|
37
30
|
return LT;
|
|
38
|
-
const cleanA =
|
|
39
|
-
const cleanB =
|
|
40
|
-
if ((
|
|
31
|
+
const cleanA = clean(a);
|
|
32
|
+
const cleanB = clean(b);
|
|
33
|
+
if (gt(cleanA, cleanB))
|
|
41
34
|
return GT;
|
|
42
|
-
if ((
|
|
35
|
+
if (lt(cleanA, cleanB))
|
|
43
36
|
return LT;
|
|
44
|
-
const scoreA =
|
|
45
|
-
const scoreB =
|
|
37
|
+
const scoreA = getRangeScore(a);
|
|
38
|
+
const scoreB = getRangeScore(b);
|
|
46
39
|
if (scoreA < scoreB)
|
|
47
40
|
return LT;
|
|
48
41
|
if (scoreA > scoreB)
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRangeScore = void 0;
|
|
4
|
-
const constants_1 = require("../../constants");
|
|
1
|
+
import { RANGE } from '../../constants.js';
|
|
5
2
|
const scoresByRange = {
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
3
|
+
[RANGE.ANY]: 9,
|
|
4
|
+
[RANGE.WORKSPACE]: 8,
|
|
5
|
+
[RANGE.GT]: 7,
|
|
6
|
+
[RANGE.GTE]: 6,
|
|
7
|
+
[RANGE.MINOR]: 5,
|
|
8
|
+
[RANGE.LOOSE]: 4,
|
|
9
|
+
[RANGE.PATCH]: 3,
|
|
10
|
+
[RANGE.EXACT]: 2,
|
|
11
|
+
[RANGE.LTE]: 1,
|
|
12
|
+
[RANGE.LT]: 0,
|
|
16
13
|
};
|
|
17
14
|
/** Rank a Semver Range according to its greediness */
|
|
18
|
-
function getRangeScore(version) {
|
|
19
|
-
const range = version.indexOf('.x') !== -1 ?
|
|
15
|
+
export function getRangeScore(version) {
|
|
16
|
+
const range = version.indexOf('.x') !== -1 ? RANGE.LOOSE : version.slice(0, version.search(/[0-9]/));
|
|
20
17
|
return scoresByRange[range] || 0;
|
|
21
18
|
}
|
|
22
|
-
exports.getRangeScore = getRangeScore;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.groupBy = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Convert an array of objects to an object, where each property of the new
|
|
6
3
|
* object is an array whose members share the same value for the given key.
|
|
7
4
|
*/
|
|
8
|
-
function groupBy(key, array) {
|
|
5
|
+
export function groupBy(key, array) {
|
|
9
6
|
return array.reduce((objectsByKeyValue, obj) => {
|
|
10
7
|
const value = obj[key];
|
|
11
8
|
objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
|
|
12
9
|
return objectsByKeyValue;
|
|
13
10
|
}, {});
|
|
14
11
|
}
|
|
15
|
-
exports.groupBy = groupBy;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { VersionGroupConfig } from '../config/types';
|
|
3
|
-
import type { Instance } from '../get-instances/instance';
|
|
4
|
-
import { Report } from '../report';
|
|
5
|
-
declare const PinnedVersionGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
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 PinnedVersionGroup_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
6
|
readonly _tag: "Pinned";
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
export declare class PinnedVersionGroup extends PinnedVersionGroup_base<{
|
|
9
9
|
config: VersionGroupConfig.Pinned;
|
|
10
10
|
instances: Instance[];
|
|
@@ -12,6 +12,6 @@ export declare class PinnedVersionGroup extends PinnedVersionGroup_base<{
|
|
|
12
12
|
groupType: string;
|
|
13
13
|
constructor(config: VersionGroupConfig.Pinned);
|
|
14
14
|
canAdd(_: Instance): boolean;
|
|
15
|
-
inspectAll(): Effect.Effect<
|
|
15
|
+
inspectAll(): Effect.Effect<Report.Version.Group[]>;
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const specifier_1 = require("../specifier");
|
|
7
|
-
const group_by_1 = require("./lib/group-by");
|
|
8
|
-
class PinnedVersionGroup extends effect_1.Data.TaggedClass('Pinned') {
|
|
1
|
+
import { Data, Effect, pipe } from 'effect';
|
|
2
|
+
import { Report } from '../report.js';
|
|
3
|
+
import { Specifier } from '../specifier/index.js';
|
|
4
|
+
import { groupBy } from './lib/group-by.js';
|
|
5
|
+
export class PinnedVersionGroup extends Data.TaggedClass('Pinned') {
|
|
9
6
|
groupType = 'versionGroup';
|
|
10
7
|
constructor(config) {
|
|
11
8
|
super({
|
|
@@ -17,14 +14,13 @@ class PinnedVersionGroup extends effect_1.Data.TaggedClass('Pinned') {
|
|
|
17
14
|
return true;
|
|
18
15
|
}
|
|
19
16
|
inspectAll() {
|
|
20
|
-
return
|
|
17
|
+
return Effect.all(Object.entries(groupBy('name', this.instances)).map(([name, instances]) => pipe(instances, Effect.forEach((instance) => pipe(Effect.succeed(Specifier.create(instance, this.config.pinVersion)), Effect.map((expected) => instance.rawSpecifier.raw === expected.raw
|
|
21
18
|
? // ✓ pinned takes precedence over any semver group
|
|
22
19
|
// ✓ current version matches expected
|
|
23
|
-
new
|
|
20
|
+
new Report.Valid(expected)
|
|
24
21
|
: // ✓ pinned takes precedence over any semver group
|
|
25
22
|
// ✘ current version mismatches expected
|
|
26
23
|
// ✓ is a mismatch we can auto-fix
|
|
27
|
-
new
|
|
24
|
+
new Report.PinnedMismatch(expected)))), Effect.map((reports) => ({ name, reports })))));
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
|
-
exports.PinnedVersionGroup = PinnedVersionGroup;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { VersionGroupConfig } from '../config/types';
|
|
3
|
-
import type { Ctx } from '../get-context';
|
|
4
|
-
import type { Instance } from '../get-instances/instance';
|
|
5
|
-
import { Report } from '../report';
|
|
6
|
-
declare const SameRangeVersionGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { VersionGroupConfig } from '../config/types.js';
|
|
3
|
+
import type { Ctx } from '../get-context/index.js';
|
|
4
|
+
import type { Instance } from '../get-instances/instance.js';
|
|
5
|
+
import { Report } from '../report.js';
|
|
6
|
+
declare const SameRangeVersionGroup_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> & {
|
|
7
7
|
readonly _tag: "SameRange";
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
export declare class SameRangeVersionGroup extends SameRangeVersionGroup_base<{
|
|
10
10
|
ctx: Ctx;
|
|
11
11
|
config: VersionGroupConfig.SameRange;
|
|
@@ -14,6 +14,6 @@ export declare class SameRangeVersionGroup extends SameRangeVersionGroup_base<{
|
|
|
14
14
|
groupType: string;
|
|
15
15
|
constructor(ctx: Ctx, config: VersionGroupConfig.SameRange);
|
|
16
16
|
canAdd(_: Instance): boolean;
|
|
17
|
-
inspectAll(): Effect.Effect<
|
|
17
|
+
inspectAll(): Effect.Effect<Report.Version.Group[]>;
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const intersects_1 = __importDefault(require("semver/ranges/intersects"));
|
|
9
|
-
const uniq_1 = require("tightrope/array/uniq");
|
|
10
|
-
const report_1 = require("../report");
|
|
11
|
-
const specifier_1 = require("../specifier");
|
|
12
|
-
const group_by_1 = require("./lib/group-by");
|
|
13
|
-
class SameRangeVersionGroup extends effect_1.Data.TaggedClass('SameRange') {
|
|
1
|
+
import { Data, Effect, pipe } from 'effect';
|
|
2
|
+
import intersects from 'semver/ranges/intersects.js';
|
|
3
|
+
import { uniq } from 'tightrope/array/uniq.js';
|
|
4
|
+
import { Report } from '../report.js';
|
|
5
|
+
import { Specifier } from '../specifier/index.js';
|
|
6
|
+
import { groupBy } from './lib/group-by.js';
|
|
7
|
+
export class SameRangeVersionGroup extends Data.TaggedClass('SameRange') {
|
|
14
8
|
groupType = 'versionGroup';
|
|
15
9
|
constructor(ctx, config) {
|
|
16
10
|
super({
|
|
@@ -23,31 +17,31 @@ class SameRangeVersionGroup extends effect_1.Data.TaggedClass('SameRange') {
|
|
|
23
17
|
return true;
|
|
24
18
|
}
|
|
25
19
|
inspectAll() {
|
|
26
|
-
return
|
|
27
|
-
onFailure: () =>
|
|
20
|
+
return Effect.all(Object.entries(groupBy('name', this.instances)).flatMap(([name, instances]) => pipe(instances, Effect.partition((instance) => pipe(Effect.succeed(Specifier.create(instance, instance.rawSpecifier.raw)), Effect.flatMap((specifier) => pipe(specifier.getSemver(), Effect.matchEffect({
|
|
21
|
+
onFailure: () => Effect.fail(
|
|
28
22
|
// ✘ expected version is not semver
|
|
29
23
|
// ✘ is a mismatch we can't auto-fix
|
|
30
|
-
new
|
|
31
|
-
onSuccess: () =>
|
|
32
|
-
onFailure: () =>
|
|
24
|
+
new Report.UnsupportedMismatch(specifier.instance)),
|
|
25
|
+
onSuccess: () => pipe(specifier.instance.semverGroup.getFixed(specifier), Effect.matchEffect({
|
|
26
|
+
onFailure: () => Effect.fail(
|
|
33
27
|
// ✓ expected version is semver
|
|
34
28
|
// ✘ expected version is not fixable by its semver group
|
|
35
29
|
// ✘ is a mismatch we can't auto-fix
|
|
36
|
-
new
|
|
30
|
+
new Report.UnsupportedMismatch(specifier.instance)),
|
|
37
31
|
onSuccess: (valid) => specifier.instance.rawSpecifier.raw === valid.raw
|
|
38
|
-
?
|
|
32
|
+
? Effect.succeed(
|
|
39
33
|
// ✓ expected version is semver
|
|
40
34
|
// ✓ expected version matches its semver group
|
|
41
35
|
// ✓ current version matches expected
|
|
42
|
-
new
|
|
43
|
-
:
|
|
36
|
+
new Report.Valid(specifier))
|
|
37
|
+
: Effect.fail(
|
|
44
38
|
// ✓ expected version is semver
|
|
45
39
|
// ✓ expected version matches its semver group
|
|
46
40
|
// ✘ current version mismatches expected
|
|
47
41
|
// ✓ is a mismatch we can auto-fix
|
|
48
|
-
new
|
|
42
|
+
new Report.SemverRangeMismatch(valid)),
|
|
49
43
|
})),
|
|
50
|
-
}))))),
|
|
44
|
+
}))))), Effect.map(([allMismatches, allMatches]) => allMismatches.length === 0
|
|
51
45
|
? allMatches.map((thisMatch) => {
|
|
52
46
|
if (thisMatch.specifier.instance.strategy.name === 'local') {
|
|
53
47
|
// ✓ every instance is valid on its own
|
|
@@ -72,16 +66,15 @@ class SameRangeVersionGroup extends effect_1.Data.TaggedClass('SameRange') {
|
|
|
72
66
|
// ✓ current version matches expected
|
|
73
67
|
// ! is not the original local package
|
|
74
68
|
// ✘ current specifier does not match every other specifier
|
|
75
|
-
return new
|
|
69
|
+
return new Report.SameRangeMismatch(thisMatch.specifier.instance, uniq(mismatches.map((report) => String(report.specifier.instance.rawSpecifier.raw))));
|
|
76
70
|
})
|
|
77
71
|
: // ✘ not every instance is valid on its own
|
|
78
72
|
// ! report on their validity individually ! when all are valid
|
|
79
73
|
// they can progress to being checked for having compatible
|
|
80
74
|
// ranges
|
|
81
|
-
[...allMatches, ...allMismatches]),
|
|
75
|
+
[...allMatches, ...allMismatches]), Effect.map((reports) => ({ name, reports })))));
|
|
82
76
|
}
|
|
83
77
|
}
|
|
84
|
-
exports.SameRangeVersionGroup = SameRangeVersionGroup;
|
|
85
78
|
/** Find all ranges/versions which this semver version does not cover */
|
|
86
79
|
function getRangeMismatches(ctx, report, others) {
|
|
87
80
|
return others.filter((other) => !matchesRange(ctx, report, other));
|
|
@@ -89,7 +82,7 @@ function getRangeMismatches(ctx, report, others) {
|
|
|
89
82
|
/** Does semver version `a` match semver version `b`? */
|
|
90
83
|
function matchesRange(ctx, a, b) {
|
|
91
84
|
const loose = true;
|
|
92
|
-
return (
|
|
85
|
+
return intersects(unwrapSemver(ctx, a.specifier), unwrapSemver(ctx, b.specifier), loose);
|
|
93
86
|
}
|
|
94
87
|
/** Get the semver version synchronously from a specifier known to contain semver */
|
|
95
88
|
function unwrapSemver(ctx, specifier) {
|
|
@@ -97,7 +90,7 @@ function unwrapSemver(ctx, specifier) {
|
|
|
97
90
|
return specifier.raw;
|
|
98
91
|
}
|
|
99
92
|
if (specifier._tag === 'WorkspaceProtocol') {
|
|
100
|
-
return
|
|
93
|
+
return Effect.runSync(specifier.getSemverEquivalent(ctx));
|
|
101
94
|
}
|
|
102
|
-
return
|
|
95
|
+
return Effect.runSync(specifier.getSemver());
|
|
103
96
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { VersionGroupConfig } from '../config/types';
|
|
3
|
-
import type { Instance } from '../get-instances/instance';
|
|
4
|
-
import { Report } from '../report';
|
|
5
|
-
declare const SnappedToVersionGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
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 SnappedToVersionGroup_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
6
|
readonly _tag: "SnappedTo";
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
export declare class SnappedToVersionGroup extends SnappedToVersionGroup_base<{
|
|
9
9
|
config: VersionGroupConfig.SnappedTo;
|
|
10
10
|
instances: Instance[];
|
|
@@ -12,6 +12,6 @@ export declare class SnappedToVersionGroup extends SnappedToVersionGroup_base<{
|
|
|
12
12
|
groupType: string;
|
|
13
13
|
constructor(config: VersionGroupConfig.SnappedTo);
|
|
14
14
|
canAdd(_: Instance): boolean;
|
|
15
|
-
inspectAll(): Effect.Effect<
|
|
15
|
+
inspectAll(): Effect.Effect<Report.Version.Group[]>;
|
|
16
16
|
}
|
|
17
17
|
export {};
|