syncpack 12.2.0 → 12.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- 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 -4
- package/dist/bin-format/format.js +78 -53
- 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 +51 -19
- 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 +37 -45
- 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 -9
- package/dist/config/get-indent.d.ts +1 -1
- package/dist/config/get-indent.js +6 -9
- package/dist/config/get-sort-az.d.ts +1 -1
- package/dist/config/get-sort-az.js +6 -17
- package/dist/config/get-sort-exports.d.ts +2 -0
- package/dist/config/get-sort-exports.js +8 -0
- package/dist/config/get-sort-first.d.ts +1 -1
- package/dist/config/get-sort-first.js +6 -8
- 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 +16 -5
- package/dist/config/types.js +1 -2
- package/dist/constants.d.ts +7 -0
- package/dist/constants.js +25 -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 +9 -0
- package/dist/io/to-json.js +29 -0
- 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 -10
- package/dist/io/write-if-changed.js +9 -44
- 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/schema.json +24 -0
- 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,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.SemverGroup = void 0;
|
|
4
|
-
const effect_1 = require("effect");
|
|
5
|
-
var SemverGroup;
|
|
1
|
+
import { Data } from 'effect';
|
|
2
|
+
export var SemverGroup;
|
|
6
3
|
(function (SemverGroup) {
|
|
7
|
-
class ConfigError extends
|
|
4
|
+
class ConfigError extends Data.TaggedClass('SemverGroupConfigError') {
|
|
8
5
|
}
|
|
9
6
|
SemverGroup.ConfigError = ConfigError;
|
|
10
|
-
})(SemverGroup || (
|
|
7
|
+
})(SemverGroup || (SemverGroup = {}));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { SemverGroupConfig } from '../config/types';
|
|
3
|
-
import type { Instance } from '../get-instances/instance';
|
|
4
|
-
import { Report } from '../report';
|
|
5
|
-
import { Specifier } from '../specifier';
|
|
6
|
-
import type { NonSemverError } from '../specifier/lib/non-semver-error';
|
|
7
|
-
declare const WithRangeSemverGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { SemverGroupConfig } from '../config/types.js';
|
|
3
|
+
import type { Instance } from '../get-instances/instance.js';
|
|
4
|
+
import { Report } from '../report.js';
|
|
5
|
+
import { Specifier } from '../specifier/index.js';
|
|
6
|
+
import type { NonSemverError } from '../specifier/lib/non-semver-error.js';
|
|
7
|
+
declare const WithRangeSemverGroup_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> & {
|
|
8
8
|
readonly _tag: "WithRange";
|
|
9
|
-
}
|
|
9
|
+
};
|
|
10
10
|
export declare class WithRangeSemverGroup extends WithRangeSemverGroup_base<{
|
|
11
11
|
config: SemverGroupConfig.WithRange;
|
|
12
12
|
instances: Instance[];
|
|
@@ -15,8 +15,8 @@ export declare class WithRangeSemverGroup extends WithRangeSemverGroup_base<{
|
|
|
15
15
|
groupType: string;
|
|
16
16
|
constructor(isCatchAll: boolean, config: SemverGroupConfig.WithRange);
|
|
17
17
|
canAdd(_: Instance): boolean;
|
|
18
|
-
getFixed(specifier: Specifier.Any): Effect.Effect<
|
|
19
|
-
inspectAll(): Effect.Effect<
|
|
20
|
-
inspect(instance: Instance): Effect.Effect<
|
|
18
|
+
getFixed(specifier: Specifier.Any): Effect.Effect<Specifier.Any, NonSemverError>;
|
|
19
|
+
inspectAll(): Effect.Effect<(Report.SemverRangeMismatch | Report.UnsupportedMismatch | Report.Valid)[], never, never>;
|
|
20
|
+
inspect(instance: Instance): Effect.Effect<Report.UnsupportedMismatch | Report.SemverRangeMismatch | Report.Valid>;
|
|
21
21
|
}
|
|
22
22
|
export {};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const report_1 = require("../report");
|
|
7
|
-
const specifier_1 = require("../specifier");
|
|
8
|
-
class WithRangeSemverGroup extends effect_1.Data.TaggedClass('WithRange') {
|
|
1
|
+
import { Data, Effect, pipe } from 'effect';
|
|
2
|
+
import { setSemverRange } from '../lib/set-semver-range.js';
|
|
3
|
+
import { Report } from '../report.js';
|
|
4
|
+
import { Specifier } from '../specifier/index.js';
|
|
5
|
+
export class WithRangeSemverGroup extends Data.TaggedClass('WithRange') {
|
|
9
6
|
groupType = 'semverGroup';
|
|
10
7
|
constructor(isCatchAll, config) {
|
|
11
8
|
super({
|
|
@@ -19,31 +16,30 @@ class WithRangeSemverGroup extends effect_1.Data.TaggedClass('WithRange') {
|
|
|
19
16
|
return true;
|
|
20
17
|
}
|
|
21
18
|
getFixed(specifier) {
|
|
22
|
-
return
|
|
19
|
+
return pipe(specifier.getSemver(), Effect.map((semver) => setSemverRange(this.config.range, semver)), Effect.flatMap((nextSemver) => specifier.setSemver(nextSemver)));
|
|
23
20
|
}
|
|
24
21
|
inspectAll() {
|
|
25
|
-
return
|
|
22
|
+
return Effect.all(this.instances.map((instance) => this.inspect(instance)));
|
|
26
23
|
}
|
|
27
24
|
inspect(instance) {
|
|
28
|
-
const current =
|
|
29
|
-
return
|
|
25
|
+
const current = Specifier.create(instance, instance.rawSpecifier.raw);
|
|
26
|
+
return pipe(this.getFixed(current), Effect.match({
|
|
30
27
|
// if range is fixable
|
|
31
28
|
onSuccess: (valid) =>
|
|
32
29
|
// if it is pinned and matches its pin
|
|
33
30
|
instance.versionGroup._tag === 'Pinned' &&
|
|
34
31
|
instance.rawSpecifier.raw === instance.versionGroup.config.pinVersion
|
|
35
32
|
? // the pinned version takes precendence and is a match
|
|
36
|
-
new
|
|
33
|
+
new Report.Valid(current)
|
|
37
34
|
: // if it is already like this on disk
|
|
38
35
|
instance.rawSpecifier.raw === valid.raw
|
|
39
36
|
? // it is a match
|
|
40
|
-
new
|
|
37
|
+
new Report.Valid(current)
|
|
41
38
|
: // it is a mismatch and should be this one
|
|
42
|
-
new
|
|
39
|
+
new Report.SemverRangeMismatch(valid),
|
|
43
40
|
// if range is NOT fixable, it is a mismatch we can't auto-fix
|
|
44
41
|
// as it seems to not be semver
|
|
45
|
-
onFailure: () => new
|
|
42
|
+
onFailure: () => new Report.UnsupportedMismatch(instance),
|
|
46
43
|
}));
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
|
-
exports.WithRangeSemverGroup = WithRangeSemverGroup;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
2
|
import type { AliasResult } from 'npm-package-arg';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { NonSemverError } from './lib/non-semver-error';
|
|
3
|
+
import { BaseSpecifier } from './base.js';
|
|
4
|
+
import { Specifier } from './index.js';
|
|
5
|
+
import { NonSemverError } from './lib/non-semver-error.js';
|
|
6
6
|
type T = AliasResult;
|
|
7
7
|
/** @example "npm:imageoptim-cli@3.1.7" */
|
|
8
8
|
export declare class AliasSpecifier extends BaseSpecifier<T> {
|
|
@@ -10,8 +10,8 @@ export declare class AliasSpecifier extends BaseSpecifier<T> {
|
|
|
10
10
|
/** The public name referenced in config */
|
|
11
11
|
name: "alias";
|
|
12
12
|
/** Return the version portion if it is valid semver */
|
|
13
|
-
getSemver(): Effect.Effect<
|
|
13
|
+
getSemver(): Effect.Effect<string, NonSemverError>;
|
|
14
14
|
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
15
|
-
setSemver(version: string): Effect.Effect<
|
|
15
|
+
setSemver(version: string): Effect.Effect<Specifier.Any, NonSemverError>;
|
|
16
16
|
}
|
|
17
17
|
export {};
|
package/dist/specifier/alias.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const _1 = require(".");
|
|
6
|
-
const base_1 = require("./base");
|
|
7
|
-
const non_semver_error_1 = require("./lib/non-semver-error");
|
|
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';
|
|
8
5
|
/** @example "npm:imageoptim-cli@3.1.7" */
|
|
9
|
-
class AliasSpecifier extends
|
|
6
|
+
export class AliasSpecifier extends BaseSpecifier {
|
|
10
7
|
_tag = 'Alias';
|
|
11
8
|
/** The public name referenced in config */
|
|
12
9
|
name = 'alias';
|
|
13
10
|
/** Return the version portion if it is valid semver */
|
|
14
11
|
getSemver() {
|
|
15
|
-
return
|
|
16
|
-
?
|
|
17
|
-
:
|
|
12
|
+
return pipe(this.parse(), Effect.mapError(() => new NonSemverError({ specifier: this })), Effect.map((parsed) => parsed.subSpec), Effect.flatMap((subSpec) => ['range', 'version'].includes(subSpec.type) && subSpec.fetchSpec !== null
|
|
13
|
+
? Effect.succeed(subSpec.fetchSpec)
|
|
14
|
+
: NonSemverError.asEffect(this)));
|
|
18
15
|
}
|
|
19
16
|
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
20
17
|
setSemver(version) {
|
|
21
|
-
return
|
|
18
|
+
return pipe(this.parse(), Effect.mapError(() => new NonSemverError({ specifier: this })), Effect.map((parsed) => parsed.subSpec), Effect.map((subSpec) => subSpec.name || ''), Effect.map((name) => `npm:${name}@${version}`), Effect.map((raw) => Specifier.create(this.instance, raw)));
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
|
-
exports.AliasSpecifier = AliasSpecifier;
|
package/dist/specifier/base.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { NonSemverError } from './lib/non-semver-error';
|
|
5
|
-
import type { NpmPackageArgResult } from './lib/parse-specifier';
|
|
2
|
+
import type { Instance } from '../get-instances/instance.js';
|
|
3
|
+
import { Specifier } from './index.js';
|
|
4
|
+
import { NonSemverError } from './lib/non-semver-error.js';
|
|
5
|
+
import type { NpmPackageArgResult } from './lib/parse-specifier.js';
|
|
6
6
|
export declare class BaseSpecifier<T extends NpmPackageArgResult | unknown> {
|
|
7
7
|
/** should be overridden by sub classes */
|
|
8
8
|
_tag: string;
|
|
@@ -31,11 +31,11 @@ export declare class BaseSpecifier<T extends NpmPackageArgResult | unknown> {
|
|
|
31
31
|
* Parse the raw version specifier using
|
|
32
32
|
* https://github.com/npm/npm-package-arg
|
|
33
33
|
*/
|
|
34
|
-
protected parse(): Effect.Effect<
|
|
34
|
+
protected parse(): Effect.Effect<T, unknown>;
|
|
35
35
|
/** Return the version portion if it is valid semver */
|
|
36
|
-
getSemver(this: Specifier.Any): Effect.Effect<
|
|
36
|
+
getSemver(this: Specifier.Any): Effect.Effect<string, NonSemverError>;
|
|
37
37
|
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
38
|
-
setSemver(this: Specifier.Any, _version: string): Effect.Effect<
|
|
38
|
+
setSemver(this: Specifier.Any, _version: string): Effect.Effect<Specifier.Any, NonSemverError>;
|
|
39
39
|
/** Apply the given specifier to a new one with this instance bound to it */
|
|
40
40
|
replaceWith<T extends Specifier.Any>(specifier: T): T;
|
|
41
41
|
}
|
package/dist/specifier/base.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const non_semver_error_1 = require("./lib/non-semver-error");
|
|
7
|
-
const parse_specifier_1 = require("./lib/parse-specifier");
|
|
8
|
-
class BaseSpecifier {
|
|
1
|
+
import { Effect, pipe } from 'effect';
|
|
2
|
+
import { Specifier } from './index.js';
|
|
3
|
+
import { NonSemverError } from './lib/non-semver-error.js';
|
|
4
|
+
import { parseSpecifier } from './lib/parse-specifier.js';
|
|
5
|
+
export class BaseSpecifier {
|
|
9
6
|
/** should be overridden by sub classes */
|
|
10
7
|
_tag = 'Base';
|
|
11
8
|
/** should be overridden by sub classes */
|
|
@@ -40,19 +37,18 @@ class BaseSpecifier {
|
|
|
40
37
|
const name = this.instance.name;
|
|
41
38
|
const raw = this.raw;
|
|
42
39
|
const packageJsonFile = this.instance.packageJsonFile;
|
|
43
|
-
return
|
|
40
|
+
return pipe(Effect.try(() => parseSpecifier(name, raw, packageJsonFile)), Effect.tapError(() => Effect.logError(`parseSpecifier threw on ${name}@${raw} at ${packageJsonFile.jsonFile.shortPath}`)));
|
|
44
41
|
}
|
|
45
42
|
/** Return the version portion if it is valid semver */
|
|
46
43
|
getSemver() {
|
|
47
|
-
return
|
|
44
|
+
return NonSemverError.asEffect(this);
|
|
48
45
|
}
|
|
49
46
|
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
50
47
|
setSemver(_version) {
|
|
51
|
-
return
|
|
48
|
+
return NonSemverError.asEffect(this);
|
|
52
49
|
}
|
|
53
50
|
/** Apply the given specifier to a new one with this instance bound to it */
|
|
54
51
|
replaceWith(specifier) {
|
|
55
|
-
return
|
|
52
|
+
return Specifier.create(this.instance, specifier.raw);
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
|
-
exports.BaseSpecifier = BaseSpecifier;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Instance } from '../get-instances/instance';
|
|
2
|
-
import type { Delete } from '../version-group/lib/delete';
|
|
1
|
+
import type { Instance } from '../get-instances/instance.js';
|
|
2
|
+
import type { Delete } from '../version-group/lib/delete.js';
|
|
3
3
|
/** A instance which should be deleted */
|
|
4
4
|
export declare class DeleteSpecifier {
|
|
5
5
|
_tag: string;
|
|
@@ -11,7 +11,7 @@ export declare class DeleteSpecifier {
|
|
|
11
11
|
raw: Delete;
|
|
12
12
|
instance: Instance;
|
|
13
13
|
});
|
|
14
|
-
getSemver: (this: import(".").Specifier.Any) => import("effect/Effect").Effect<
|
|
15
|
-
setSemver: (this: import(".").Specifier.Any, _version: string) => import("effect/Effect").Effect<
|
|
16
|
-
replaceWith: <T extends import(".").Specifier.Any>(specifier: T) => T;
|
|
14
|
+
getSemver: (this: import("./index.js").Specifier.Any) => import("effect/Effect").Effect<string, import("./lib/non-semver-error.js").NonSemverError, never>;
|
|
15
|
+
setSemver: (this: import("./index.js").Specifier.Any, _version: string) => import("effect/Effect").Effect<import("./index.js").Specifier.Any, import("./lib/non-semver-error.js").NonSemverError, never>;
|
|
16
|
+
replaceWith: <T extends import("./index.js").Specifier.Any>(specifier: T) => T;
|
|
17
17
|
}
|
package/dist/specifier/delete.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DeleteSpecifier = void 0;
|
|
4
|
-
const base_1 = require("./base");
|
|
1
|
+
import { BaseSpecifier } from './base.js';
|
|
5
2
|
/** A instance which should be deleted */
|
|
6
|
-
class DeleteSpecifier {
|
|
3
|
+
export class DeleteSpecifier {
|
|
7
4
|
_tag = 'Delete';
|
|
8
5
|
/** The public name referenced in config */
|
|
9
6
|
name = 'delete';
|
|
@@ -13,8 +10,7 @@ class DeleteSpecifier {
|
|
|
13
10
|
this.raw = data.raw;
|
|
14
11
|
this.instance = data.instance;
|
|
15
12
|
}
|
|
16
|
-
getSemver =
|
|
17
|
-
setSemver =
|
|
18
|
-
replaceWith =
|
|
13
|
+
getSemver = BaseSpecifier.prototype.getSemver;
|
|
14
|
+
setSemver = BaseSpecifier.prototype.setSemver;
|
|
15
|
+
replaceWith = BaseSpecifier.prototype.replaceWith;
|
|
19
16
|
}
|
|
20
|
-
exports.DeleteSpecifier = DeleteSpecifier;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { NonSemverError } from './lib/non-semver-error';
|
|
5
|
-
import type { SpecificRegistryResult } from './lib/specific-registry-result';
|
|
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
6
|
type T = SpecificRegistryResult<'version'>;
|
|
7
7
|
/**
|
|
8
8
|
* An exact semver version
|
|
@@ -13,8 +13,8 @@ export declare class ExactSpecifier extends BaseSpecifier<T> {
|
|
|
13
13
|
/** The public name referenced in config */
|
|
14
14
|
name: "exact";
|
|
15
15
|
/** Return the semver version */
|
|
16
|
-
getSemver(): Effect.Effect<
|
|
16
|
+
getSemver(): Effect.Effect<string, NonSemverError>;
|
|
17
17
|
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
18
|
-
setSemver(version: string): Effect.Effect<
|
|
18
|
+
setSemver(version: string): Effect.Effect<Specifier.Any>;
|
|
19
19
|
}
|
|
20
20
|
export {};
|
package/dist/specifier/exact.js
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const _1 = require(".");
|
|
6
|
-
const base_1 = require("./base");
|
|
7
|
-
const non_semver_error_1 = require("./lib/non-semver-error");
|
|
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';
|
|
8
5
|
/**
|
|
9
6
|
* An exact semver version
|
|
10
7
|
* @example "1.4.4"
|
|
11
8
|
*/
|
|
12
|
-
class ExactSpecifier extends
|
|
9
|
+
export class ExactSpecifier extends BaseSpecifier {
|
|
13
10
|
_tag = 'Exact';
|
|
14
11
|
/** The public name referenced in config */
|
|
15
12
|
name = 'exact';
|
|
16
13
|
/** Return the semver version */
|
|
17
14
|
getSemver() {
|
|
18
|
-
return
|
|
15
|
+
return pipe(this.parse(), Effect.mapError(() => new NonSemverError({ specifier: this })), Effect.map((parsed) => parsed.fetchSpec));
|
|
19
16
|
}
|
|
20
17
|
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
21
18
|
setSemver(version) {
|
|
22
|
-
return
|
|
19
|
+
return Effect.succeed(Specifier.create(this.instance, version));
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
|
-
exports.ExactSpecifier = ExactSpecifier;
|
package/dist/specifier/file.d.ts
CHANGED
package/dist/specifier/file.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FileSpecifier = void 0;
|
|
4
|
-
const base_1 = require("./base");
|
|
1
|
+
import { BaseSpecifier } from './base.js';
|
|
5
2
|
/** @example */
|
|
6
|
-
class FileSpecifier extends
|
|
3
|
+
export class FileSpecifier extends BaseSpecifier {
|
|
7
4
|
_tag = 'File';
|
|
8
5
|
/** The public name referenced in config */
|
|
9
6
|
name = 'file';
|
|
10
7
|
}
|
|
11
|
-
exports.FileSpecifier = FileSpecifier;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
2
|
import type { HostedGitResult } from 'npm-package-arg';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { NonSemverError } from './lib/non-semver-error';
|
|
3
|
+
import { BaseSpecifier } from './base.js';
|
|
4
|
+
import { Specifier } from './index.js';
|
|
5
|
+
import { NonSemverError } from './lib/non-semver-error.js';
|
|
6
6
|
/** @example "git+https://github.com/user/foo" */
|
|
7
7
|
export declare class HostedGitSpecifier extends BaseSpecifier<HostedGitResult> {
|
|
8
8
|
_tag: string;
|
|
9
9
|
/** The public name referenced in config */
|
|
10
10
|
name: "hosted-git";
|
|
11
11
|
/** Return the git tag if it is valid semver */
|
|
12
|
-
getSemver(): Effect.Effect<
|
|
12
|
+
getSemver(): Effect.Effect<string, NonSemverError>;
|
|
13
13
|
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
14
|
-
setSemver(version: string): Effect.Effect<
|
|
14
|
+
setSemver(version: string): Effect.Effect<Specifier.Any, NonSemverError>;
|
|
15
15
|
}
|
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const is_semver_1 = require("../guards/is-semver");
|
|
7
|
-
const base_1 = require("./base");
|
|
8
|
-
const non_semver_error_1 = require("./lib/non-semver-error");
|
|
1
|
+
import { Effect, pipe } from 'effect';
|
|
2
|
+
import { isSemver } from '../guards/is-semver.js';
|
|
3
|
+
import { BaseSpecifier } from './base.js';
|
|
4
|
+
import { Specifier } from './index.js';
|
|
5
|
+
import { NonSemverError } from './lib/non-semver-error.js';
|
|
9
6
|
/** @example "git+https://github.com/user/foo" */
|
|
10
|
-
class HostedGitSpecifier extends
|
|
7
|
+
export class HostedGitSpecifier extends BaseSpecifier {
|
|
11
8
|
_tag = 'HostedGit';
|
|
12
9
|
/** The public name referenced in config */
|
|
13
10
|
name = 'hosted-git';
|
|
14
11
|
/** Return the git tag if it is valid semver */
|
|
15
12
|
getSemver() {
|
|
16
|
-
return
|
|
13
|
+
return pipe(this.parse(), Effect.mapError(() => new NonSemverError({ specifier: this })), Effect.map((parsed) => parsed.gitCommittish || ''), Effect.flatMap((gitCommittish) => isSemver(gitCommittish) ? Effect.succeed(gitCommittish) : NonSemverError.asEffect(this)));
|
|
17
14
|
}
|
|
18
15
|
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
19
16
|
setSemver(version) {
|
|
20
|
-
return
|
|
17
|
+
return pipe(this.parse(), Effect.mapError(() => new NonSemverError({ specifier: this })), Effect.map((parsed) => ({
|
|
21
18
|
gitCommittish: parsed.gitCommittish || '',
|
|
22
19
|
rawSpec: parsed.rawSpec || '',
|
|
23
|
-
})),
|
|
20
|
+
})), Effect.map(({ gitCommittish, rawSpec }) => rawSpec.replace(gitCommittish, version)), Effect.map((raw) => Specifier.create(this.instance, raw)));
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
|
-
exports.HostedGitSpecifier = HostedGitSpecifier;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { Instance } from '../get-instances/instance';
|
|
2
|
-
import { type Delete } from '../version-group/lib/delete';
|
|
3
|
-
import { AliasSpecifier } from './alias';
|
|
4
|
-
import { DeleteSpecifier } from './delete';
|
|
5
|
-
import { ExactSpecifier } from './exact';
|
|
6
|
-
import { FileSpecifier } from './file';
|
|
7
|
-
import { HostedGitSpecifier } from './hosted-git';
|
|
8
|
-
import { LatestSpecifier } from './latest';
|
|
9
|
-
import { RangeSpecifier } from './range';
|
|
10
|
-
import { TagSpecifier } from './tag';
|
|
11
|
-
import { UnsupportedSpecifier } from './unsupported';
|
|
12
|
-
import { UrlSpecifier } from './url';
|
|
13
|
-
import { WorkspaceProtocolSpecifier } from './workspace-protocol';
|
|
1
|
+
import type { Instance } from '../get-instances/instance.js';
|
|
2
|
+
import { type Delete } from '../version-group/lib/delete.js';
|
|
3
|
+
import { AliasSpecifier } from './alias.js';
|
|
4
|
+
import { DeleteSpecifier } from './delete.js';
|
|
5
|
+
import { ExactSpecifier } from './exact.js';
|
|
6
|
+
import { FileSpecifier } from './file.js';
|
|
7
|
+
import { HostedGitSpecifier } from './hosted-git.js';
|
|
8
|
+
import { LatestSpecifier } from './latest.js';
|
|
9
|
+
import { RangeSpecifier } from './range.js';
|
|
10
|
+
import { TagSpecifier } from './tag.js';
|
|
11
|
+
import { UnsupportedSpecifier } from './unsupported.js';
|
|
12
|
+
import { UrlSpecifier } from './url.js';
|
|
13
|
+
import { WorkspaceProtocolSpecifier } from './workspace-protocol.js';
|
|
14
14
|
export declare namespace Specifier {
|
|
15
15
|
const Alias: typeof AliasSpecifier;
|
|
16
16
|
const Delete: typeof DeleteSpecifier;
|
package/dist/specifier/index.js
CHANGED
|
@@ -1,41 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const url_1 = require("./url");
|
|
16
|
-
const workspace_protocol_1 = require("./workspace-protocol");
|
|
17
|
-
var Specifier;
|
|
1
|
+
import { DELETE } from '../version-group/lib/delete.js';
|
|
2
|
+
import { AliasSpecifier } from './alias.js';
|
|
3
|
+
import { DeleteSpecifier } from './delete.js';
|
|
4
|
+
import { ExactSpecifier } from './exact.js';
|
|
5
|
+
import { FileSpecifier } from './file.js';
|
|
6
|
+
import { HostedGitSpecifier } from './hosted-git.js';
|
|
7
|
+
import { LatestSpecifier } from './latest.js';
|
|
8
|
+
import { parseSpecifier } from './lib/parse-specifier.js';
|
|
9
|
+
import { RangeSpecifier } from './range.js';
|
|
10
|
+
import { TagSpecifier } from './tag.js';
|
|
11
|
+
import { UnsupportedSpecifier } from './unsupported.js';
|
|
12
|
+
import { UrlSpecifier } from './url.js';
|
|
13
|
+
import { WorkspaceProtocolSpecifier } from './workspace-protocol.js';
|
|
14
|
+
export var Specifier;
|
|
18
15
|
(function (Specifier) {
|
|
19
|
-
Specifier.Alias =
|
|
20
|
-
Specifier.Delete =
|
|
21
|
-
Specifier.Exact =
|
|
22
|
-
Specifier.File =
|
|
23
|
-
Specifier.HostedGit =
|
|
24
|
-
Specifier.Latest =
|
|
25
|
-
Specifier.Range =
|
|
26
|
-
Specifier.Tag =
|
|
27
|
-
Specifier.Unsupported =
|
|
28
|
-
Specifier.Url =
|
|
29
|
-
Specifier.WorkspaceProtocol =
|
|
16
|
+
Specifier.Alias = AliasSpecifier;
|
|
17
|
+
Specifier.Delete = DeleteSpecifier;
|
|
18
|
+
Specifier.Exact = ExactSpecifier;
|
|
19
|
+
Specifier.File = FileSpecifier;
|
|
20
|
+
Specifier.HostedGit = HostedGitSpecifier;
|
|
21
|
+
Specifier.Latest = LatestSpecifier;
|
|
22
|
+
Specifier.Range = RangeSpecifier;
|
|
23
|
+
Specifier.Tag = TagSpecifier;
|
|
24
|
+
Specifier.Unsupported = UnsupportedSpecifier;
|
|
25
|
+
Specifier.Url = UrlSpecifier;
|
|
26
|
+
Specifier.WorkspaceProtocol = WorkspaceProtocolSpecifier;
|
|
30
27
|
function create(instance, raw) {
|
|
31
|
-
if (raw ===
|
|
28
|
+
if (raw === DELETE)
|
|
32
29
|
return new Specifier.Delete({ instance, raw });
|
|
33
30
|
if (!raw)
|
|
34
31
|
return new Specifier.Unsupported({ instance, raw });
|
|
35
32
|
try {
|
|
36
33
|
if (raw === 'latest')
|
|
37
34
|
raw = '*';
|
|
38
|
-
const parsed =
|
|
35
|
+
const parsed = parseSpecifier(instance.name, raw, instance.packageJsonFile);
|
|
39
36
|
const type = parsed.type;
|
|
40
37
|
const data = { instance, raw };
|
|
41
38
|
if (raw === '*')
|
|
@@ -63,4 +60,4 @@ var Specifier;
|
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
62
|
Specifier.create = create;
|
|
66
|
-
})(Specifier || (
|
|
63
|
+
})(Specifier || (Specifier = {}));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { NonSemverError } from './lib/non-semver-error';
|
|
5
|
-
import type { SpecificRegistryResult } from './lib/specific-registry-result';
|
|
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
6
|
type T = SpecificRegistryResult<'range'>;
|
|
7
7
|
/**
|
|
8
8
|
* @example "*"
|
|
@@ -12,8 +12,8 @@ export declare class LatestSpecifier extends BaseSpecifier<T> {
|
|
|
12
12
|
/** The public name referenced in config */
|
|
13
13
|
name: "latest";
|
|
14
14
|
/** Return the semver version including the range */
|
|
15
|
-
getSemver(): Effect.Effect<
|
|
15
|
+
getSemver(): Effect.Effect<string, NonSemverError>;
|
|
16
16
|
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
17
|
-
setSemver(version: string): Effect.Effect<
|
|
17
|
+
setSemver(version: string): Effect.Effect<Specifier.Any>;
|
|
18
18
|
}
|
|
19
19
|
export {};
|
package/dist/specifier/latest.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const _1 = require(".");
|
|
6
|
-
const base_1 = require("./base");
|
|
7
|
-
const non_semver_error_1 = require("./lib/non-semver-error");
|
|
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';
|
|
8
5
|
/**
|
|
9
6
|
* @example "*"
|
|
10
7
|
*/
|
|
11
|
-
class LatestSpecifier extends
|
|
8
|
+
export class LatestSpecifier extends BaseSpecifier {
|
|
12
9
|
_tag = 'Latest';
|
|
13
10
|
/** The public name referenced in config */
|
|
14
11
|
name = 'latest';
|
|
15
12
|
/** Return the semver version including the range */
|
|
16
13
|
getSemver() {
|
|
17
|
-
return
|
|
14
|
+
return pipe(this.parse(), Effect.mapError(() => new NonSemverError({ specifier: this })), Effect.map((parsed) => parsed.fetchSpec));
|
|
18
15
|
}
|
|
19
16
|
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
20
17
|
setSemver(version) {
|
|
21
|
-
return
|
|
18
|
+
return Effect.succeed(Specifier.create(this.instance, version));
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
|
-
exports.LatestSpecifier = LatestSpecifier;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Specifier } from '
|
|
3
|
-
declare const NonSemverError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
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
4
|
readonly _tag: "NonSemverError";
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
6
|
export declare class NonSemverError extends NonSemverError_base<{
|
|
7
7
|
specifier: Specifier.Any;
|
|
8
8
|
}> {
|
|
9
|
-
static asEffect<T>(specifier: Specifier.Any): Effect.Effect<
|
|
9
|
+
static asEffect<T>(specifier: Specifier.Any): Effect.Effect<T, NonSemverError>;
|
|
10
10
|
}
|
|
11
11
|
export {};
|