syncpack 12.0.1 → 12.2.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/README.md +5 -5
- package/dist/bin-fix-mismatches/fix-mismatches.js +8 -19
- package/dist/bin-fix-mismatches/index.js +3 -1
- package/dist/bin-format/index.js +1 -1
- package/dist/bin-lint/index.js +1 -1
- package/dist/bin-lint-semver-ranges/index.js +3 -1
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +7 -7
- package/dist/bin-list/index.js +3 -1
- package/dist/bin-list/list.d.ts +2 -0
- package/dist/bin-list/list.js +78 -50
- package/dist/bin-list-mismatches/index.js +3 -1
- package/dist/bin-list-mismatches/list-mismatches.d.ts +4 -5
- package/dist/bin-list-mismatches/list-mismatches.js +185 -220
- package/dist/bin-prompt/index.js +2 -0
- package/dist/bin-prompt/prompt.js +7 -3
- package/dist/bin-set-semver-ranges/index.js +3 -1
- package/dist/bin-update/effects.js +6 -6
- package/dist/bin-update/index.js +2 -0
- package/dist/bin-update/update.js +3 -3
- package/dist/config/get-custom-types.js +2 -1
- package/dist/config/types.d.ts +15 -7
- package/dist/constants.d.ts +71 -8
- package/dist/constants.js +34 -1
- package/dist/get-instances/instance.d.ts +2 -1
- package/dist/get-instances/instance.js +4 -3
- package/dist/guards/can-add-to-group.js +14 -7
- package/dist/io/index.d.ts +2 -2
- package/dist/io/index.js +1 -1
- package/dist/io/read-config-file-sync.js +1 -1
- package/dist/option.d.ts +2 -1
- package/dist/option.js +4 -0
- package/dist/report.d.ts +64 -99
- package/dist/report.js +81 -16
- package/dist/schema.json +202 -77
- package/dist/semver-group/create-semver-groups.js +6 -0
- package/dist/semver-group/disabled.js +1 -3
- package/dist/semver-group/filtered-out.js +1 -3
- package/dist/semver-group/ignored.js +1 -3
- package/dist/semver-group/index.d.ts +1 -2
- package/dist/semver-group/with-range.d.ts +1 -1
- package/dist/semver-group/with-range.js +7 -15
- package/dist/specifier/alias.d.ts +2 -0
- package/dist/specifier/alias.js +3 -1
- package/dist/specifier/base.d.ts +4 -2
- package/dist/specifier/base.js +3 -1
- package/dist/specifier/delete.d.ts +4 -2
- package/dist/specifier/delete.js +3 -1
- package/dist/specifier/{version.d.ts → exact.d.ts} +3 -1
- package/dist/specifier/{version.js → exact.js} +6 -4
- package/dist/specifier/file.d.ts +2 -0
- package/dist/specifier/file.js +3 -1
- package/dist/specifier/hosted-git.d.ts +2 -0
- package/dist/specifier/hosted-git.js +3 -1
- package/dist/specifier/index.d.ts +5 -4
- package/dist/specifier/index.js +7 -3
- package/dist/specifier/latest.d.ts +19 -0
- package/dist/specifier/latest.js +24 -0
- package/dist/specifier/lib/parse-specifier.js +1 -1
- package/dist/specifier/range.d.ts +2 -1
- package/dist/specifier/range.js +3 -2
- package/dist/specifier/tag.d.ts +2 -0
- package/dist/specifier/tag.js +3 -1
- package/dist/specifier/unsupported.d.ts +2 -0
- package/dist/specifier/unsupported.js +3 -1
- package/dist/specifier/url.d.ts +2 -0
- package/dist/specifier/url.js +3 -1
- package/dist/specifier/workspace-protocol.d.ts +2 -0
- package/dist/specifier/workspace-protocol.js +6 -3
- package/dist/strategy/name-and-version-props.js +4 -4
- package/dist/version-group/banned.js +1 -3
- package/dist/version-group/create-version-groups.js +11 -0
- package/dist/version-group/filtered-out.js +1 -1
- package/dist/version-group/ignored.js +1 -1
- package/dist/version-group/index.d.ts +1 -2
- package/dist/version-group/pinned.js +3 -3
- package/dist/version-group/same-range.js +9 -14
- package/dist/version-group/snapped-to.js +12 -22
- package/dist/version-group/standard.js +44 -55
- package/package.json +7 -7
|
@@ -26,9 +26,7 @@ class DisabledSemverGroup extends effect_1.Data.TaggedClass('Disabled') {
|
|
|
26
26
|
return effect_1.Effect.all(this.instances.map((instance) => this.inspect(instance)));
|
|
27
27
|
}
|
|
28
28
|
inspect(instance) {
|
|
29
|
-
return effect_1.Effect.succeed(new report_1.Report.Disabled(
|
|
30
|
-
instance,
|
|
31
|
-
}));
|
|
29
|
+
return effect_1.Effect.succeed(new report_1.Report.Disabled(instance));
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
exports.DisabledSemverGroup = DisabledSemverGroup;
|
|
@@ -32,9 +32,7 @@ class FilteredOutSemverGroup extends effect_1.Data.TaggedClass('FilteredOut') {
|
|
|
32
32
|
return effect_1.Effect.all(this.instances.map((instance) => this.inspect(instance)));
|
|
33
33
|
}
|
|
34
34
|
inspect(instance) {
|
|
35
|
-
return effect_1.Effect.succeed(new report_1.Report.FilteredOut(
|
|
36
|
-
instance,
|
|
37
|
-
}));
|
|
35
|
+
return effect_1.Effect.succeed(new report_1.Report.FilteredOut(instance));
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
38
|
exports.FilteredOutSemverGroup = FilteredOutSemverGroup;
|
|
@@ -22,9 +22,7 @@ class IgnoredSemverGroup extends effect_1.Data.TaggedClass('Ignored') {
|
|
|
22
22
|
return effect_1.Effect.all(this.instances.map((instance) => this.inspect(instance)));
|
|
23
23
|
}
|
|
24
24
|
inspect(instance) {
|
|
25
|
-
return effect_1.Effect.succeed(new report_1.Report.Ignored(
|
|
26
|
-
instance,
|
|
27
|
-
}));
|
|
25
|
+
return effect_1.Effect.succeed(new report_1.Report.Ignored(instance));
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
28
|
exports.IgnoredSemverGroup = IgnoredSemverGroup;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Data } from 'effect';
|
|
2
|
-
import type { Union } from 'ts-toolbelt';
|
|
3
2
|
import type { DisabledSemverGroup } from './disabled';
|
|
4
3
|
import type { FilteredOutSemverGroup } from './filtered-out';
|
|
5
4
|
import type { IgnoredSemverGroup } from './ignored';
|
|
@@ -9,7 +8,7 @@ export declare namespace SemverGroup {
|
|
|
9
8
|
export type FilteredOut = FilteredOutSemverGroup;
|
|
10
9
|
export type Ignored = IgnoredSemverGroup;
|
|
11
10
|
export type WithRange = WithRangeSemverGroup;
|
|
12
|
-
export type Any =
|
|
11
|
+
export type Any = Disabled | FilteredOut | Ignored | WithRange;
|
|
13
12
|
const ConfigError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
14
13
|
readonly _tag: "SemverGroupConfigError";
|
|
15
14
|
}>;
|
|
@@ -16,7 +16,7 @@ export declare class WithRangeSemverGroup extends WithRangeSemverGroup_base<{
|
|
|
16
16
|
constructor(isCatchAll: boolean, config: SemverGroupConfig.WithRange);
|
|
17
17
|
canAdd(_: Instance): boolean;
|
|
18
18
|
getFixed(specifier: Specifier.Any): Effect.Effect<never, NonSemverError, Specifier.Any>;
|
|
19
|
-
inspectAll(): Effect.Effect<never, never, (Report.
|
|
19
|
+
inspectAll(): Effect.Effect<never, never, (Report.SemverRangeMismatch | Report.UnsupportedMismatch | Report.Valid)[]>;
|
|
20
20
|
inspect(instance: Instance): Effect.Effect<never, never, Report.UnsupportedMismatch | Report.SemverRangeMismatch | Report.Valid>;
|
|
21
21
|
}
|
|
22
22
|
export {};
|
|
@@ -25,32 +25,24 @@ class WithRangeSemverGroup extends effect_1.Data.TaggedClass('WithRange') {
|
|
|
25
25
|
return effect_1.Effect.all(this.instances.map((instance) => this.inspect(instance)));
|
|
26
26
|
}
|
|
27
27
|
inspect(instance) {
|
|
28
|
-
const current = specifier_1.Specifier.create(instance, instance.rawSpecifier);
|
|
28
|
+
const current = specifier_1.Specifier.create(instance, instance.rawSpecifier.raw);
|
|
29
29
|
return (0, effect_1.pipe)(this.getFixed(current), effect_1.Effect.match({
|
|
30
30
|
// if range is fixable
|
|
31
31
|
onSuccess: (valid) =>
|
|
32
32
|
// if it is pinned and matches its pin
|
|
33
33
|
instance.versionGroup._tag === 'Pinned' &&
|
|
34
|
-
instance.rawSpecifier === instance.versionGroup.config.pinVersion
|
|
34
|
+
instance.rawSpecifier.raw === instance.versionGroup.config.pinVersion
|
|
35
35
|
? // the pinned version takes precendence and is a match
|
|
36
|
-
new report_1.Report.Valid(
|
|
37
|
-
specifier: current,
|
|
38
|
-
})
|
|
36
|
+
new report_1.Report.Valid(current)
|
|
39
37
|
: // if it is already like this on disk
|
|
40
|
-
instance.rawSpecifier === valid.raw
|
|
38
|
+
instance.rawSpecifier.raw === valid.raw
|
|
41
39
|
? // it is a match
|
|
42
|
-
new report_1.Report.Valid(
|
|
43
|
-
specifier: current,
|
|
44
|
-
})
|
|
40
|
+
new report_1.Report.Valid(current)
|
|
45
41
|
: // it is a mismatch and should be this one
|
|
46
|
-
new report_1.Report.SemverRangeMismatch(
|
|
47
|
-
fixable: valid,
|
|
48
|
-
}),
|
|
42
|
+
new report_1.Report.SemverRangeMismatch(valid),
|
|
49
43
|
// if range is NOT fixable, it is a mismatch we can't auto-fix
|
|
50
44
|
// as it seems to not be semver
|
|
51
|
-
onFailure: () => new report_1.Report.UnsupportedMismatch(
|
|
52
|
-
unfixable: instance,
|
|
53
|
-
}),
|
|
45
|
+
onFailure: () => new report_1.Report.UnsupportedMismatch(instance),
|
|
54
46
|
}));
|
|
55
47
|
}
|
|
56
48
|
}
|
|
@@ -7,6 +7,8 @@ type T = AliasResult;
|
|
|
7
7
|
/** @example "npm:imageoptim-cli@3.1.7" */
|
|
8
8
|
export declare class AliasSpecifier extends BaseSpecifier<T> {
|
|
9
9
|
_tag: string;
|
|
10
|
+
/** The public name referenced in config */
|
|
11
|
+
name: "alias";
|
|
10
12
|
/** Return the version portion if it is valid semver */
|
|
11
13
|
getSemver(): Effect.Effect<never, NonSemverError, string>;
|
|
12
14
|
/** Get a new `Specifier` from the given semver version applied to this one */
|
package/dist/specifier/alias.js
CHANGED
|
@@ -7,7 +7,9 @@ const base_1 = require("./base");
|
|
|
7
7
|
const non_semver_error_1 = require("./lib/non-semver-error");
|
|
8
8
|
/** @example "npm:imageoptim-cli@3.1.7" */
|
|
9
9
|
class AliasSpecifier extends base_1.BaseSpecifier {
|
|
10
|
-
_tag = '
|
|
10
|
+
_tag = 'Alias';
|
|
11
|
+
/** The public name referenced in config */
|
|
12
|
+
name = 'alias';
|
|
11
13
|
/** Return the version portion if it is valid semver */
|
|
12
14
|
getSemver() {
|
|
13
15
|
return (0, effect_1.pipe)(this.parse(), effect_1.Effect.mapError(() => new non_semver_error_1.NonSemverError({ specifier: this })), effect_1.Effect.map((parsed) => parsed.subSpec), effect_1.Effect.flatMap((subSpec) => ['range', 'version'].includes(subSpec.type) && subSpec.fetchSpec !== null
|
package/dist/specifier/base.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ import type { NpmPackageArgResult } from './lib/parse-specifier';
|
|
|
6
6
|
export declare class BaseSpecifier<T extends NpmPackageArgResult | unknown> {
|
|
7
7
|
/** should be overridden by sub classes */
|
|
8
8
|
_tag: string;
|
|
9
|
+
/** should be overridden by sub classes */
|
|
10
|
+
name: string;
|
|
9
11
|
/** The raw semver/workspace:/git etc version value */
|
|
10
12
|
raw: string;
|
|
11
13
|
/**
|
|
@@ -31,9 +33,9 @@ export declare class BaseSpecifier<T extends NpmPackageArgResult | unknown> {
|
|
|
31
33
|
*/
|
|
32
34
|
protected parse(): Effect.Effect<never, unknown, T>;
|
|
33
35
|
/** Return the version portion if it is valid semver */
|
|
34
|
-
getSemver(): Effect.Effect<never, NonSemverError, string>;
|
|
36
|
+
getSemver(this: Specifier.Any): Effect.Effect<never, NonSemverError, string>;
|
|
35
37
|
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
36
|
-
setSemver(_version: string): Effect.Effect<never, NonSemverError, Specifier.Any>;
|
|
38
|
+
setSemver(this: Specifier.Any, _version: string): Effect.Effect<never, NonSemverError, Specifier.Any>;
|
|
37
39
|
/** Apply the given specifier to a new one with this instance bound to it */
|
|
38
40
|
replaceWith<T extends Specifier.Any>(specifier: T): T;
|
|
39
41
|
}
|
package/dist/specifier/base.js
CHANGED
|
@@ -7,7 +7,9 @@ const non_semver_error_1 = require("./lib/non-semver-error");
|
|
|
7
7
|
const parse_specifier_1 = require("./lib/parse-specifier");
|
|
8
8
|
class BaseSpecifier {
|
|
9
9
|
/** should be overridden by sub classes */
|
|
10
|
-
_tag = '
|
|
10
|
+
_tag = 'Base';
|
|
11
|
+
/** should be overridden by sub classes */
|
|
12
|
+
name = 'base';
|
|
11
13
|
/** The raw semver/workspace:/git etc version value */
|
|
12
14
|
raw;
|
|
13
15
|
/**
|
|
@@ -3,13 +3,15 @@ import type { Delete } from '../version-group/lib/delete';
|
|
|
3
3
|
/** A instance which should be deleted */
|
|
4
4
|
export declare class DeleteSpecifier {
|
|
5
5
|
_tag: string;
|
|
6
|
+
/** The public name referenced in config */
|
|
7
|
+
name: "delete";
|
|
6
8
|
raw: Delete;
|
|
7
9
|
instance: Instance;
|
|
8
10
|
constructor(data: {
|
|
9
11
|
raw: Delete;
|
|
10
12
|
instance: Instance;
|
|
11
13
|
});
|
|
12
|
-
getSemver: () => import("effect/Effect").Effect<never, import("./lib/non-semver-error").NonSemverError, string>;
|
|
13
|
-
setSemver: (_version: string) => import("effect/Effect").Effect<never, import("./lib/non-semver-error").NonSemverError, import(".").Specifier.Any>;
|
|
14
|
+
getSemver: (this: import(".").Specifier.Any) => import("effect/Effect").Effect<never, import("./lib/non-semver-error").NonSemverError, string>;
|
|
15
|
+
setSemver: (this: import(".").Specifier.Any, _version: string) => import("effect/Effect").Effect<never, import("./lib/non-semver-error").NonSemverError, import(".").Specifier.Any>;
|
|
14
16
|
replaceWith: <T extends import(".").Specifier.Any>(specifier: T) => T;
|
|
15
17
|
}
|
package/dist/specifier/delete.js
CHANGED
|
@@ -4,7 +4,9 @@ exports.DeleteSpecifier = void 0;
|
|
|
4
4
|
const base_1 = require("./base");
|
|
5
5
|
/** A instance which should be deleted */
|
|
6
6
|
class DeleteSpecifier {
|
|
7
|
-
_tag = '
|
|
7
|
+
_tag = 'Delete';
|
|
8
|
+
/** The public name referenced in config */
|
|
9
|
+
name = 'delete';
|
|
8
10
|
raw;
|
|
9
11
|
instance;
|
|
10
12
|
constructor(data) {
|
|
@@ -8,8 +8,10 @@ type T = SpecificRegistryResult<'version'>;
|
|
|
8
8
|
* An exact semver version
|
|
9
9
|
* @example "1.4.4"
|
|
10
10
|
*/
|
|
11
|
-
export declare class
|
|
11
|
+
export declare class ExactSpecifier extends BaseSpecifier<T> {
|
|
12
12
|
_tag: string;
|
|
13
|
+
/** The public name referenced in config */
|
|
14
|
+
name: "exact";
|
|
13
15
|
/** Return the semver version */
|
|
14
16
|
getSemver(): Effect.Effect<never, NonSemverError, string>;
|
|
15
17
|
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ExactSpecifier = void 0;
|
|
4
4
|
const effect_1 = require("effect");
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
const base_1 = require("./base");
|
|
@@ -9,8 +9,10 @@ const non_semver_error_1 = require("./lib/non-semver-error");
|
|
|
9
9
|
* An exact semver version
|
|
10
10
|
* @example "1.4.4"
|
|
11
11
|
*/
|
|
12
|
-
class
|
|
13
|
-
_tag = '
|
|
12
|
+
class ExactSpecifier extends base_1.BaseSpecifier {
|
|
13
|
+
_tag = 'Exact';
|
|
14
|
+
/** The public name referenced in config */
|
|
15
|
+
name = 'exact';
|
|
14
16
|
/** Return the semver version */
|
|
15
17
|
getSemver() {
|
|
16
18
|
return (0, effect_1.pipe)(this.parse(), effect_1.Effect.mapError(() => new non_semver_error_1.NonSemverError({ specifier: this })), effect_1.Effect.map((parsed) => parsed.fetchSpec));
|
|
@@ -20,4 +22,4 @@ class VersionSpecifier extends base_1.BaseSpecifier {
|
|
|
20
22
|
return effect_1.Effect.succeed(_1.Specifier.create(this.instance, version));
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
|
-
exports.
|
|
25
|
+
exports.ExactSpecifier = ExactSpecifier;
|
package/dist/specifier/file.d.ts
CHANGED
package/dist/specifier/file.js
CHANGED
|
@@ -4,6 +4,8 @@ exports.FileSpecifier = void 0;
|
|
|
4
4
|
const base_1 = require("./base");
|
|
5
5
|
/** @example */
|
|
6
6
|
class FileSpecifier extends base_1.BaseSpecifier {
|
|
7
|
-
_tag = '
|
|
7
|
+
_tag = 'File';
|
|
8
|
+
/** The public name referenced in config */
|
|
9
|
+
name = 'file';
|
|
8
10
|
}
|
|
9
11
|
exports.FileSpecifier = FileSpecifier;
|
|
@@ -6,6 +6,8 @@ import { NonSemverError } from './lib/non-semver-error';
|
|
|
6
6
|
/** @example "git+https://github.com/user/foo" */
|
|
7
7
|
export declare class HostedGitSpecifier extends BaseSpecifier<HostedGitResult> {
|
|
8
8
|
_tag: string;
|
|
9
|
+
/** The public name referenced in config */
|
|
10
|
+
name: "hosted-git";
|
|
9
11
|
/** Return the git tag if it is valid semver */
|
|
10
12
|
getSemver(): Effect.Effect<never, NonSemverError, string>;
|
|
11
13
|
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
@@ -8,7 +8,9 @@ const base_1 = require("./base");
|
|
|
8
8
|
const non_semver_error_1 = require("./lib/non-semver-error");
|
|
9
9
|
/** @example "git+https://github.com/user/foo" */
|
|
10
10
|
class HostedGitSpecifier extends base_1.BaseSpecifier {
|
|
11
|
-
_tag = '
|
|
11
|
+
_tag = 'HostedGit';
|
|
12
|
+
/** The public name referenced in config */
|
|
13
|
+
name = 'hosted-git';
|
|
12
14
|
/** Return the git tag if it is valid semver */
|
|
13
15
|
getSemver() {
|
|
14
16
|
return (0, effect_1.pipe)(this.parse(), effect_1.Effect.mapError(() => new non_semver_error_1.NonSemverError({ specifier: this })), effect_1.Effect.map((parsed) => parsed.gitCommittish || ''), effect_1.Effect.flatMap((gitCommittish) => (0, is_semver_1.isSemver)(gitCommittish) ? effect_1.Effect.succeed(gitCommittish) : non_semver_error_1.NonSemverError.asEffect(this)));
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import type { Union } from 'ts-toolbelt';
|
|
2
1
|
import type { Instance } from '../get-instances/instance';
|
|
3
2
|
import { type Delete } from '../version-group/lib/delete';
|
|
4
3
|
import { AliasSpecifier } from './alias';
|
|
5
4
|
import { DeleteSpecifier } from './delete';
|
|
5
|
+
import { ExactSpecifier } from './exact';
|
|
6
6
|
import { FileSpecifier } from './file';
|
|
7
7
|
import { HostedGitSpecifier } from './hosted-git';
|
|
8
|
+
import { LatestSpecifier } from './latest';
|
|
8
9
|
import { RangeSpecifier } from './range';
|
|
9
10
|
import { TagSpecifier } from './tag';
|
|
10
11
|
import { UnsupportedSpecifier } from './unsupported';
|
|
11
12
|
import { UrlSpecifier } from './url';
|
|
12
|
-
import { VersionSpecifier } from './version';
|
|
13
13
|
import { WorkspaceProtocolSpecifier } from './workspace-protocol';
|
|
14
14
|
export declare namespace Specifier {
|
|
15
15
|
const Alias: typeof AliasSpecifier;
|
|
16
16
|
const Delete: typeof DeleteSpecifier;
|
|
17
|
+
const Exact: typeof ExactSpecifier;
|
|
17
18
|
const File: typeof FileSpecifier;
|
|
18
19
|
const HostedGit: typeof HostedGitSpecifier;
|
|
20
|
+
const Latest: typeof LatestSpecifier;
|
|
19
21
|
const Range: typeof RangeSpecifier;
|
|
20
22
|
const Tag: typeof TagSpecifier;
|
|
21
23
|
const Unsupported: typeof UnsupportedSpecifier;
|
|
22
24
|
const Url: typeof UrlSpecifier;
|
|
23
|
-
const Version: typeof VersionSpecifier;
|
|
24
25
|
const WorkspaceProtocol: typeof WorkspaceProtocolSpecifier;
|
|
25
|
-
type Any =
|
|
26
|
+
type Any = AliasSpecifier | DeleteSpecifier | ExactSpecifier | FileSpecifier | HostedGitSpecifier | LatestSpecifier | RangeSpecifier | TagSpecifier | UnsupportedSpecifier | UrlSpecifier | WorkspaceProtocolSpecifier;
|
|
26
27
|
function create(instance: Instance, raw: string | Delete): Specifier.Any;
|
|
27
28
|
}
|
package/dist/specifier/index.js
CHANGED
|
@@ -4,26 +4,28 @@ exports.Specifier = void 0;
|
|
|
4
4
|
const delete_1 = require("../version-group/lib/delete");
|
|
5
5
|
const alias_1 = require("./alias");
|
|
6
6
|
const delete_2 = require("./delete");
|
|
7
|
+
const exact_1 = require("./exact");
|
|
7
8
|
const file_1 = require("./file");
|
|
8
9
|
const hosted_git_1 = require("./hosted-git");
|
|
10
|
+
const latest_1 = require("./latest");
|
|
9
11
|
const parse_specifier_1 = require("./lib/parse-specifier");
|
|
10
12
|
const range_1 = require("./range");
|
|
11
13
|
const tag_1 = require("./tag");
|
|
12
14
|
const unsupported_1 = require("./unsupported");
|
|
13
15
|
const url_1 = require("./url");
|
|
14
|
-
const version_1 = require("./version");
|
|
15
16
|
const workspace_protocol_1 = require("./workspace-protocol");
|
|
16
17
|
var Specifier;
|
|
17
18
|
(function (Specifier) {
|
|
18
19
|
Specifier.Alias = alias_1.AliasSpecifier;
|
|
19
20
|
Specifier.Delete = delete_2.DeleteSpecifier;
|
|
21
|
+
Specifier.Exact = exact_1.ExactSpecifier;
|
|
20
22
|
Specifier.File = file_1.FileSpecifier;
|
|
21
23
|
Specifier.HostedGit = hosted_git_1.HostedGitSpecifier;
|
|
24
|
+
Specifier.Latest = latest_1.LatestSpecifier;
|
|
22
25
|
Specifier.Range = range_1.RangeSpecifier;
|
|
23
26
|
Specifier.Tag = tag_1.TagSpecifier;
|
|
24
27
|
Specifier.Unsupported = unsupported_1.UnsupportedSpecifier;
|
|
25
28
|
Specifier.Url = url_1.UrlSpecifier;
|
|
26
|
-
Specifier.Version = version_1.VersionSpecifier;
|
|
27
29
|
Specifier.WorkspaceProtocol = workspace_protocol_1.WorkspaceProtocolSpecifier;
|
|
28
30
|
function create(instance, raw) {
|
|
29
31
|
if (raw === delete_1.DELETE)
|
|
@@ -36,8 +38,10 @@ var Specifier;
|
|
|
36
38
|
const parsed = (0, parse_specifier_1.parseSpecifier)(instance.name, raw, instance.packageJsonFile);
|
|
37
39
|
const type = parsed.type;
|
|
38
40
|
const data = { instance, raw };
|
|
41
|
+
if (raw === '*')
|
|
42
|
+
return new Specifier.Latest(data);
|
|
39
43
|
if (type === 'version')
|
|
40
|
-
return new Specifier.
|
|
44
|
+
return new Specifier.Exact(data);
|
|
41
45
|
if (type === 'range')
|
|
42
46
|
return new Specifier.Range(data);
|
|
43
47
|
if (type === 'workspaceProtocol')
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import { Specifier } from '.';
|
|
3
|
+
import { BaseSpecifier } from './base';
|
|
4
|
+
import { NonSemverError } from './lib/non-semver-error';
|
|
5
|
+
import type { SpecificRegistryResult } from './lib/specific-registry-result';
|
|
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<never, NonSemverError, string>;
|
|
16
|
+
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
17
|
+
setSemver(version: string): Effect.Effect<never, never, Specifier.Any>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LatestSpecifier = void 0;
|
|
4
|
+
const effect_1 = require("effect");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
const base_1 = require("./base");
|
|
7
|
+
const non_semver_error_1 = require("./lib/non-semver-error");
|
|
8
|
+
/**
|
|
9
|
+
* @example "*"
|
|
10
|
+
*/
|
|
11
|
+
class LatestSpecifier extends base_1.BaseSpecifier {
|
|
12
|
+
_tag = 'Latest';
|
|
13
|
+
/** The public name referenced in config */
|
|
14
|
+
name = 'latest';
|
|
15
|
+
/** Return the semver version including the range */
|
|
16
|
+
getSemver() {
|
|
17
|
+
return (0, effect_1.pipe)(this.parse(), effect_1.Effect.mapError(() => new non_semver_error_1.NonSemverError({ specifier: this })), effect_1.Effect.map((parsed) => parsed.fetchSpec));
|
|
18
|
+
}
|
|
19
|
+
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
20
|
+
setSemver(version) {
|
|
21
|
+
return effect_1.Effect.succeed(_1.Specifier.create(this.instance, version));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.LatestSpecifier = LatestSpecifier;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.parseSpecifier = void 0;
|
|
7
7
|
const npm_package_arg_1 = __importDefault(require("npm-package-arg"));
|
|
8
8
|
function parseSpecifier(name, specifier, packageJsonFile) {
|
|
9
|
-
if (specifier === 'workspace:*' || specifier === 'workspace:~') {
|
|
9
|
+
if (specifier === 'workspace:*' || specifier === 'workspace:~' || specifier === 'workspace:^') {
|
|
10
10
|
const parsed = npm_package_arg_1.default.resolve(name, packageJsonFile.jsonFile.dirPath, specifier.replace('workspace:', 'file:'));
|
|
11
11
|
return {
|
|
12
12
|
escapedName: parsed.escapedName,
|
|
@@ -5,11 +5,12 @@ import { NonSemverError } from './lib/non-semver-error';
|
|
|
5
5
|
import type { SpecificRegistryResult } from './lib/specific-registry-result';
|
|
6
6
|
type T = SpecificRegistryResult<'range'>;
|
|
7
7
|
/**
|
|
8
|
-
* @example "*"
|
|
9
8
|
* @example "^1.2.3"
|
|
10
9
|
*/
|
|
11
10
|
export declare class RangeSpecifier extends BaseSpecifier<T> {
|
|
12
11
|
_tag: string;
|
|
12
|
+
/** The public name referenced in config */
|
|
13
|
+
name: "range";
|
|
13
14
|
/** Return the semver version including the range */
|
|
14
15
|
getSemver(): Effect.Effect<never, NonSemverError, string>;
|
|
15
16
|
/** Get a new `Specifier` from the given semver version applied to this one */
|
package/dist/specifier/range.js
CHANGED
|
@@ -6,11 +6,12 @@ const _1 = require(".");
|
|
|
6
6
|
const base_1 = require("./base");
|
|
7
7
|
const non_semver_error_1 = require("./lib/non-semver-error");
|
|
8
8
|
/**
|
|
9
|
-
* @example "*"
|
|
10
9
|
* @example "^1.2.3"
|
|
11
10
|
*/
|
|
12
11
|
class RangeSpecifier extends base_1.BaseSpecifier {
|
|
13
|
-
_tag = '
|
|
12
|
+
_tag = 'Range';
|
|
13
|
+
/** The public name referenced in config */
|
|
14
|
+
name = 'range';
|
|
14
15
|
/** Return the semver version including the range */
|
|
15
16
|
getSemver() {
|
|
16
17
|
return (0, effect_1.pipe)(this.parse(), effect_1.Effect.mapError(() => new non_semver_error_1.NonSemverError({ specifier: this })), effect_1.Effect.map((parsed) => parsed.fetchSpec));
|
package/dist/specifier/tag.d.ts
CHANGED
package/dist/specifier/tag.js
CHANGED
|
@@ -7,6 +7,8 @@ const base_1 = require("./base");
|
|
|
7
7
|
* @example "made-up-by-some-dev"
|
|
8
8
|
*/
|
|
9
9
|
class TagSpecifier extends base_1.BaseSpecifier {
|
|
10
|
-
_tag = '
|
|
10
|
+
_tag = 'Tag';
|
|
11
|
+
/** The public name referenced in config */
|
|
12
|
+
name = 'tag';
|
|
11
13
|
}
|
|
12
14
|
exports.TagSpecifier = TagSpecifier;
|
|
@@ -4,6 +4,8 @@ exports.UnsupportedSpecifier = void 0;
|
|
|
4
4
|
const base_1 = require("./base");
|
|
5
5
|
/** A specifier not supported by the `npm` package manager */
|
|
6
6
|
class UnsupportedSpecifier extends base_1.BaseSpecifier {
|
|
7
|
-
_tag = '
|
|
7
|
+
_tag = 'Unsupported';
|
|
8
|
+
/** The public name referenced in config */
|
|
9
|
+
name = 'unsupported';
|
|
8
10
|
}
|
|
9
11
|
exports.UnsupportedSpecifier = UnsupportedSpecifier;
|
package/dist/specifier/url.d.ts
CHANGED
package/dist/specifier/url.js
CHANGED
|
@@ -4,6 +4,8 @@ exports.UrlSpecifier = void 0;
|
|
|
4
4
|
const base_1 = require("./base");
|
|
5
5
|
/** @example "http://x.com/foo.tgz" */
|
|
6
6
|
class UrlSpecifier extends base_1.BaseSpecifier {
|
|
7
|
-
_tag = '
|
|
7
|
+
_tag = 'Url';
|
|
8
|
+
/** The public name referenced in config */
|
|
9
|
+
name = 'url';
|
|
8
10
|
}
|
|
9
11
|
exports.UrlSpecifier = UrlSpecifier;
|
|
@@ -6,6 +6,8 @@ import type { WorkspaceProtocolResult } from './lib/parse-specifier';
|
|
|
6
6
|
/** Represents "workspace:*" and "workspace:~" */
|
|
7
7
|
export declare class WorkspaceProtocolSpecifier extends BaseSpecifier<WorkspaceProtocolResult> {
|
|
8
8
|
_tag: string;
|
|
9
|
+
/** The public name referenced in config */
|
|
10
|
+
name: "workspace-protocol";
|
|
9
11
|
/**
|
|
10
12
|
* Return an equivalent value which actually is semver, so that it can be used
|
|
11
13
|
* with tools which expect values which conform to the spec. This value is
|
|
@@ -6,7 +6,9 @@ const _1 = require(".");
|
|
|
6
6
|
const base_1 = require("./base");
|
|
7
7
|
/** Represents "workspace:*" and "workspace:~" */
|
|
8
8
|
class WorkspaceProtocolSpecifier extends base_1.BaseSpecifier {
|
|
9
|
-
_tag = '
|
|
9
|
+
_tag = 'WorkspaceProtocol';
|
|
10
|
+
/** The public name referenced in config */
|
|
11
|
+
name = 'workspace-protocol';
|
|
10
12
|
/**
|
|
11
13
|
* Return an equivalent value which actually is semver, so that it can be used
|
|
12
14
|
* with tools which expect values which conform to the spec. This value is
|
|
@@ -16,11 +18,12 @@ class WorkspaceProtocolSpecifier extends base_1.BaseSpecifier {
|
|
|
16
18
|
if (this.raw === 'workspace:*') {
|
|
17
19
|
return effect_1.Effect.succeed('*');
|
|
18
20
|
}
|
|
19
|
-
if (this.raw === 'workspace:~') {
|
|
21
|
+
if (this.raw === 'workspace:~' || this.raw === 'workspace:^') {
|
|
22
|
+
const range = this.raw.replace('workspace:', '');
|
|
20
23
|
const local = ctx.packageJsonFilesByName[this.instance.name];
|
|
21
24
|
const version = local?.jsonFile?.contents?.version;
|
|
22
25
|
if (version)
|
|
23
|
-
return effect_1.Effect.succeed(
|
|
26
|
+
return effect_1.Effect.succeed(`${range}${version}`);
|
|
24
27
|
}
|
|
25
28
|
return effect_1.Effect.succeed('0.0.0');
|
|
26
29
|
}
|
|
@@ -24,10 +24,10 @@ class NameAndVersionPropsStrategy {
|
|
|
24
24
|
// add the version prop
|
|
25
25
|
effect_1.Effect.bind('version', () => (0, effect_1.pipe)((0, get_non_empty_string_prop_1.getNonEmptyStringProp)(this.path, file),
|
|
26
26
|
/**
|
|
27
|
-
* In order to report
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* In order to report a `MissingLocalVersion`, we need to ensure that
|
|
28
|
+
* a value is returned for `local` package .version properties so we
|
|
29
|
+
* can know that `this.name` is a package developed in this repo but
|
|
30
|
+
* that its version is missing.
|
|
31
31
|
*
|
|
32
32
|
* Not doing this results in the invalid local package being ignored
|
|
33
33
|
* and each installation of it being checked for mismatches amongst
|
|
@@ -23,9 +23,7 @@ class BannedVersionGroup extends effect_1.Data.TaggedClass('Banned') {
|
|
|
23
23
|
reports: instances.map((instance) =>
|
|
24
24
|
// ✘ package should not be used
|
|
25
25
|
// ✓ is a mismatch we can auto-fix
|
|
26
|
-
new report_1.Report.Banned(
|
|
27
|
-
fixable: specifier_1.Specifier.create(instance, delete_1.DELETE),
|
|
28
|
-
})),
|
|
26
|
+
new report_1.Report.Banned(specifier_1.Specifier.create(instance, delete_1.DELETE))),
|
|
29
27
|
})));
|
|
30
28
|
}
|
|
31
29
|
}
|
|
@@ -40,10 +40,14 @@ function createVersionGroups(ctx) {
|
|
|
40
40
|
: ['**'];
|
|
41
41
|
const dependencies = (0, is_array_of_strings_1.isArrayOfStrings)(config.dependencies) ? config.dependencies : ['**'];
|
|
42
42
|
const packages = (0, is_array_of_strings_1.isArrayOfStrings)(config.packages) ? config.packages : ['**'];
|
|
43
|
+
const specifierTypes = (0, is_array_of_strings_1.isArrayOfStrings)(config.specifierTypes)
|
|
44
|
+
? config.specifierTypes
|
|
45
|
+
: ['**'];
|
|
43
46
|
if (config.isBanned === true) {
|
|
44
47
|
versionGroups.push(effect_1.Effect.succeed(new banned_1.BannedVersionGroup({
|
|
45
48
|
dependencies,
|
|
46
49
|
dependencyTypes,
|
|
50
|
+
specifierTypes,
|
|
47
51
|
isBanned: true,
|
|
48
52
|
label,
|
|
49
53
|
packages,
|
|
@@ -53,6 +57,7 @@ function createVersionGroups(ctx) {
|
|
|
53
57
|
versionGroups.push(effect_1.Effect.succeed(new ignored_1.IgnoredVersionGroup({
|
|
54
58
|
dependencies,
|
|
55
59
|
dependencyTypes,
|
|
60
|
+
specifierTypes,
|
|
56
61
|
isIgnored: true,
|
|
57
62
|
label,
|
|
58
63
|
packages,
|
|
@@ -62,6 +67,7 @@ function createVersionGroups(ctx) {
|
|
|
62
67
|
versionGroups.push(effect_1.Effect.succeed(new pinned_1.PinnedVersionGroup({
|
|
63
68
|
dependencies,
|
|
64
69
|
dependencyTypes,
|
|
70
|
+
specifierTypes,
|
|
65
71
|
label,
|
|
66
72
|
packages,
|
|
67
73
|
pinVersion: config.pinVersion,
|
|
@@ -71,6 +77,7 @@ function createVersionGroups(ctx) {
|
|
|
71
77
|
versionGroups.push(effect_1.Effect.succeed(new snapped_to_1.SnappedToVersionGroup({
|
|
72
78
|
dependencies,
|
|
73
79
|
dependencyTypes,
|
|
80
|
+
specifierTypes,
|
|
74
81
|
label,
|
|
75
82
|
packages,
|
|
76
83
|
snapTo: config.snapTo,
|
|
@@ -80,6 +87,7 @@ function createVersionGroups(ctx) {
|
|
|
80
87
|
versionGroups.push(effect_1.Effect.succeed(new same_range_1.SameRangeVersionGroup(ctx, {
|
|
81
88
|
dependencies,
|
|
82
89
|
dependencyTypes,
|
|
90
|
+
specifierTypes,
|
|
83
91
|
label,
|
|
84
92
|
packages,
|
|
85
93
|
policy: config.policy,
|
|
@@ -89,6 +97,7 @@ function createVersionGroups(ctx) {
|
|
|
89
97
|
versionGroups.push(effect_1.Effect.succeed(new standard_1.StandardVersionGroup(false, {
|
|
90
98
|
dependencies,
|
|
91
99
|
dependencyTypes,
|
|
100
|
+
specifierTypes,
|
|
92
101
|
label,
|
|
93
102
|
packages,
|
|
94
103
|
preferVersion: config.preferVersion === 'lowestSemver' ? 'lowestSemver' : 'highestSemver',
|
|
@@ -98,6 +107,8 @@ function createVersionGroups(ctx) {
|
|
|
98
107
|
}
|
|
99
108
|
versionGroups.push(effect_1.Effect.succeed(new standard_1.StandardVersionGroup(true, {
|
|
100
109
|
dependencies: ['**'],
|
|
110
|
+
dependencyTypes: ['**'],
|
|
111
|
+
specifierTypes: ['**'],
|
|
101
112
|
label: 'Default Version Group',
|
|
102
113
|
packages: ['**'],
|
|
103
114
|
preferVersion: 'highestSemver',
|
|
@@ -27,7 +27,7 @@ class FilteredOutVersionGroup extends effect_1.Data.TaggedClass('FilteredOut') {
|
|
|
27
27
|
name,
|
|
28
28
|
reports: instances.map((instance) =>
|
|
29
29
|
// ✓ is ignored and dismissed as valid
|
|
30
|
-
new report_1.Report.FilteredOut(
|
|
30
|
+
new report_1.Report.FilteredOut(instance)),
|
|
31
31
|
})));
|
|
32
32
|
}
|
|
33
33
|
}
|