syncpack 13.0.1 → 14.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -3
- package/index.js +48 -0
- package/package.json +16 -73
- package/schema.json +917 -0
- package/syncpack.d.ts +122 -0
- package/LICENSE +0 -20
- package/dist/bin-fix-mismatches/fix-mismatches.d.ts +0 -16
- package/dist/bin-fix-mismatches/fix-mismatches.js +0 -115
- package/dist/bin-fix-mismatches/index.d.ts +0 -2
- package/dist/bin-fix-mismatches/index.js +0 -33
- package/dist/bin-format/format.d.ts +0 -13
- package/dist/bin-format/format.js +0 -92
- package/dist/bin-format/index.d.ts +0 -2
- package/dist/bin-format/index.js +0 -28
- package/dist/bin-lint/index.d.ts +0 -2
- package/dist/bin-lint/index.js +0 -17
- package/dist/bin-lint/lint.d.ts +0 -11
- package/dist/bin-lint/lint.js +0 -52
- package/dist/bin-lint-semver-ranges/index.d.ts +0 -2
- package/dist/bin-lint-semver-ranges/index.js +0 -30
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.d.ts +0 -16
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +0 -92
- package/dist/bin-list/index.d.ts +0 -2
- package/dist/bin-list/index.js +0 -27
- package/dist/bin-list/list.d.ts +0 -14
- package/dist/bin-list/list.js +0 -151
- package/dist/bin-list-mismatches/index.d.ts +0 -2
- package/dist/bin-list-mismatches/index.js +0 -29
- package/dist/bin-list-mismatches/list-mismatches.d.ts +0 -18
- package/dist/bin-list-mismatches/list-mismatches.js +0 -224
- package/dist/bin-prompt/index.d.ts +0 -2
- package/dist/bin-prompt/index.js +0 -29
- package/dist/bin-prompt/prompt.d.ts +0 -11
- package/dist/bin-prompt/prompt.js +0 -95
- package/dist/bin-set-semver-ranges/index.d.ts +0 -2
- package/dist/bin-set-semver-ranges/index.js +0 -32
- package/dist/bin-set-semver-ranges/set-semver-ranges.d.ts +0 -11
- package/dist/bin-set-semver-ranges/set-semver-ranges.js +0 -61
- package/dist/bin-update/effects.d.ts +0 -52
- package/dist/bin-update/effects.js +0 -282
- package/dist/bin-update/index.d.ts +0 -2
- package/dist/bin-update/index.js +0 -24
- package/dist/bin-update/update.d.ts +0 -6
- package/dist/bin-update/update.js +0 -59
- package/dist/bin.d.ts +0 -2
- package/dist/bin.js +0 -37
- package/dist/config/get-custom-types.d.ts +0 -19
- package/dist/config/get-custom-types.js +0 -57
- package/dist/config/get-enabled-types.d.ts +0 -17
- package/dist/config/get-enabled-types.js +0 -109
- package/dist/config/get-filter.d.ts +0 -2
- package/dist/config/get-filter.js +0 -10
- package/dist/config/get-indent.d.ts +0 -2
- package/dist/config/get-indent.js +0 -9
- package/dist/config/get-sort-az.d.ts +0 -2
- package/dist/config/get-sort-az.js +0 -8
- package/dist/config/get-sort-exports.d.ts +0 -2
- package/dist/config/get-sort-exports.js +0 -9
- package/dist/config/get-sort-first.d.ts +0 -2
- package/dist/config/get-sort-first.js +0 -8
- package/dist/config/get-source.d.ts +0 -2
- package/dist/config/get-source.js +0 -8
- package/dist/config/tag.d.ts +0 -3
- package/dist/config/tag.js +0 -2
- package/dist/config/types.d.ts +0 -134
- package/dist/config/types.js +0 -1
- package/dist/constants.d.ts +0 -106
- package/dist/constants.js +0 -103
- package/dist/error-handlers/default-error-handlers.d.ts +0 -25
- package/dist/error-handlers/default-error-handlers.js +0 -80
- package/dist/get-context/index.d.ts +0 -23
- package/dist/get-context/index.js +0 -18
- package/dist/get-context/lib/key-by.d.ts +0 -6
- package/dist/get-context/lib/key-by.js +0 -12
- package/dist/get-instances/index.d.ts +0 -14
- package/dist/get-instances/index.js +0 -42
- package/dist/get-instances/instance.d.ts +0 -26
- package/dist/get-instances/instance.js +0 -35
- package/dist/get-package-json-files/get-file-paths.d.ts +0 -21
- package/dist/get-package-json-files/get-file-paths.js +0 -22
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.d.ts +0 -3
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.js +0 -12
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.d.ts +0 -3
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.js +0 -14
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.d.ts +0 -3
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.js +0 -16
- package/dist/get-package-json-files/get-patterns/index.d.ts +0 -8
- package/dist/get-package-json-files/get-patterns/index.js +0 -23
- package/dist/get-package-json-files/index.d.ts +0 -10
- package/dist/get-package-json-files/index.js +0 -8
- package/dist/get-package-json-files/package-json-file.d.ts +0 -54
- package/dist/get-package-json-files/package-json-file.js +0 -44
- package/dist/guards/can-add-to-group.d.ts +0 -5
- package/dist/guards/can-add-to-group.js +0 -58
- package/dist/guards/is-semver.d.ts +0 -2
- package/dist/guards/is-semver.js +0 -15
- package/dist/guards/is-valid-semver-range.d.ts +0 -3
- package/dist/guards/is-valid-semver-range.js +0 -14
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -1
- package/dist/io/ask-for-choice.d.ts +0 -14
- package/dist/io/ask-for-choice.js +0 -17
- package/dist/io/ask-for-input.d.ts +0 -13
- package/dist/io/ask-for-input.js +0 -14
- package/dist/io/exit-if-invalid.d.ts +0 -4
- package/dist/io/exit-if-invalid.js +0 -9
- package/dist/io/glob-sync.d.ts +0 -11
- package/dist/io/glob-sync.js +0 -14
- package/dist/io/index.d.ts +0 -27
- package/dist/io/index.js +0 -26
- package/dist/io/read-config-file.d.ts +0 -7
- package/dist/io/read-config-file.js +0 -24
- package/dist/io/read-file-sync.d.ts +0 -12
- package/dist/io/read-file-sync.js +0 -9
- package/dist/io/read-json-file-sync.d.ts +0 -31
- package/dist/io/read-json-file-sync.js +0 -23
- package/dist/io/read-yaml-file-sync.d.ts +0 -12
- package/dist/io/read-yaml-file-sync.js +0 -9
- package/dist/io/to-formatted-json.d.ts +0 -9
- package/dist/io/to-formatted-json.js +0 -32
- package/dist/io/write-file-sync.d.ts +0 -12
- package/dist/io/write-file-sync.js +0 -10
- package/dist/io/write-if-changed.d.ts +0 -5
- package/dist/io/write-if-changed.js +0 -9
- package/dist/lib/format-repository-url.d.ts +0 -1
- package/dist/lib/format-repository-url.js +0 -40
- package/dist/lib/get-group-header.d.ts +0 -10
- package/dist/lib/get-group-header.js +0 -25
- package/dist/lib/get.d.ts +0 -11
- package/dist/lib/get.js +0 -44
- package/dist/lib/pad-start.d.ts +0 -1
- package/dist/lib/pad-start.js +0 -3
- package/dist/lib/ring-buffer.d.ts +0 -10
- package/dist/lib/ring-buffer.js +0 -20
- package/dist/lib/set-semver-range.d.ts +0 -3
- package/dist/lib/set-semver-range.js +0 -24
- package/dist/lib/show-help-on-error.d.ts +0 -2
- package/dist/lib/show-help-on-error.js +0 -32
- package/dist/lib/sort-by-name.d.ts +0 -5
- package/dist/lib/sort-by-name.js +0 -9
- package/dist/lib/with-logger.d.ts +0 -2
- package/dist/lib/with-logger.js +0 -28
- package/dist/option.d.ts +0 -10
- package/dist/option.js +0 -30
- package/dist/report.d.ts +0 -131
- package/dist/report.js +0 -129
- package/dist/schema.json +0 -614
- package/dist/semver-group/create-semver-groups.d.ts +0 -4
- package/dist/semver-group/create-semver-groups.js +0 -83
- package/dist/semver-group/disabled.d.ts +0 -26
- package/dist/semver-group/disabled.js +0 -28
- package/dist/semver-group/filtered-out.d.ts +0 -27
- package/dist/semver-group/filtered-out.js +0 -34
- package/dist/semver-group/ignored.d.ts +0 -22
- package/dist/semver-group/ignored.js +0 -24
- package/dist/semver-group/index.d.ts +0 -20
- package/dist/semver-group/index.js +0 -7
- package/dist/semver-group/with-range.d.ts +0 -22
- package/dist/semver-group/with-range.js +0 -45
- package/dist/specifier/alias.d.ts +0 -17
- package/dist/specifier/alias.js +0 -21
- package/dist/specifier/base.d.ts +0 -41
- package/dist/specifier/base.js +0 -54
- package/dist/specifier/delete.d.ts +0 -17
- package/dist/specifier/delete.js +0 -16
- package/dist/specifier/exact.d.ts +0 -20
- package/dist/specifier/exact.js +0 -21
- package/dist/specifier/file.d.ts +0 -8
- package/dist/specifier/file.js +0 -7
- package/dist/specifier/hosted-git.d.ts +0 -15
- package/dist/specifier/hosted-git.js +0 -24
- package/dist/specifier/index.d.ts +0 -28
- package/dist/specifier/index.js +0 -75
- package/dist/specifier/latest.d.ts +0 -19
- package/dist/specifier/latest.js +0 -20
- package/dist/specifier/lib/non-semver-error.d.ts +0 -11
- package/dist/specifier/lib/non-semver-error.js +0 -6
- package/dist/specifier/lib/parse-specifier.d.ts +0 -14
- package/dist/specifier/lib/parse-specifier.js +0 -18
- package/dist/specifier/lib/specific-registry-result.d.ts +0 -9
- package/dist/specifier/lib/specific-registry-result.js +0 -1
- package/dist/specifier/range.d.ts +0 -19
- package/dist/specifier/range.js +0 -20
- package/dist/specifier/tag.d.ts +0 -11
- package/dist/specifier/tag.js +0 -10
- package/dist/specifier/unsupported.d.ts +0 -7
- package/dist/specifier/unsupported.js +0 -7
- package/dist/specifier/url.d.ts +0 -8
- package/dist/specifier/url.js +0 -7
- package/dist/specifier/workspace-protocol.d.ts +0 -19
- package/dist/specifier/workspace-protocol.js +0 -35
- package/dist/strategy/lib/get-non-empty-string-prop.d.ts +0 -3
- package/dist/strategy/lib/get-non-empty-string-prop.js +0 -7
- package/dist/strategy/name-and-version-props.d.ts +0 -12
- package/dist/strategy/name-and-version-props.js +0 -60
- package/dist/strategy/named-version-string.d.ts +0 -11
- package/dist/strategy/named-version-string.js +0 -52
- package/dist/strategy/unnamed-version-string.d.ts +0 -11
- package/dist/strategy/unnamed-version-string.js +0 -45
- package/dist/strategy/versions-by-name.d.ts +0 -11
- package/dist/strategy/versions-by-name.js +0 -27
- package/dist/version-group/banned.d.ts +0 -17
- package/dist/version-group/banned.js +0 -26
- package/dist/version-group/create-version-groups.d.ts +0 -4
- package/dist/version-group/create-version-groups.js +0 -118
- package/dist/version-group/filtered-out.d.ts +0 -19
- package/dist/version-group/filtered-out.js +0 -30
- package/dist/version-group/ignored.d.ts +0 -17
- package/dist/version-group/ignored.js +0 -23
- package/dist/version-group/index.d.ts +0 -26
- package/dist/version-group/index.js +0 -7
- package/dist/version-group/lib/clean.d.ts +0 -2
- package/dist/version-group/lib/clean.js +0 -6
- package/dist/version-group/lib/delete.d.ts +0 -2
- package/dist/version-group/lib/delete.js +0 -1
- package/dist/version-group/lib/get-highest-version.d.ts +0 -6
- package/dist/version-group/lib/get-highest-version.js +0 -8
- package/dist/version-group/lib/get-lowest-version.d.ts +0 -6
- package/dist/version-group/lib/get-lowest-version.js +0 -8
- package/dist/version-group/lib/get-preferred-version.d.ts +0 -5
- package/dist/version-group/lib/get-preferred-version.js +0 -53
- package/dist/version-group/lib/get-range-score.d.ts +0 -2
- package/dist/version-group/lib/get-range-score.js +0 -20
- package/dist/version-group/lib/group-by.d.ts +0 -5
- package/dist/version-group/lib/group-by.js +0 -11
- package/dist/version-group/pinned.d.ts +0 -17
- package/dist/version-group/pinned.js +0 -26
- package/dist/version-group/same-range.d.ts +0 -19
- package/dist/version-group/same-range.js +0 -96
- package/dist/version-group/snapped-to.d.ts +0 -17
- package/dist/version-group/snapped-to.js +0 -71
- package/dist/version-group/standard.d.ts +0 -18
- package/dist/version-group/standard.js +0 -119
|
@@ -1,26 +0,0 @@
|
|
|
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 type { Specifier } from '../specifier/index.js';
|
|
6
|
-
import type { NonSemverError } from '../specifier/lib/non-semver-error.js';
|
|
7
|
-
declare const DisabledSemverGroup_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
|
-
readonly _tag: "Disabled";
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Semver groups are disabled by default and, when that's the case, every
|
|
12
|
-
* instance is assigned to this group. This group will allow anything.
|
|
13
|
-
*/
|
|
14
|
-
export declare class DisabledSemverGroup extends DisabledSemverGroup_base<{
|
|
15
|
-
config: SemverGroupConfig.Disabled;
|
|
16
|
-
instances: Instance[];
|
|
17
|
-
isCatchAll: boolean;
|
|
18
|
-
}> {
|
|
19
|
-
groupType: string;
|
|
20
|
-
constructor(isCatchAll: boolean, config: SemverGroupConfig.Disabled);
|
|
21
|
-
canAdd(_: Instance): boolean;
|
|
22
|
-
getFixed(specifier: Specifier.Any): Effect.Effect<Specifier.Any, NonSemverError>;
|
|
23
|
-
inspectAll(): Effect.Effect<Report.Disabled[], never, never>;
|
|
24
|
-
inspect(instance: Instance): Effect.Effect<Report.Disabled>;
|
|
25
|
-
}
|
|
26
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Data, Effect } from 'effect';
|
|
2
|
-
import { Report } from '../report.js';
|
|
3
|
-
/**
|
|
4
|
-
* Semver groups are disabled by default and, when that's the case, every
|
|
5
|
-
* instance is assigned to this group. This group will allow anything.
|
|
6
|
-
*/
|
|
7
|
-
export class DisabledSemverGroup extends Data.TaggedClass('Disabled') {
|
|
8
|
-
groupType = 'semverGroup';
|
|
9
|
-
constructor(isCatchAll, config) {
|
|
10
|
-
super({
|
|
11
|
-
config,
|
|
12
|
-
instances: [],
|
|
13
|
-
isCatchAll,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
canAdd(_) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
getFixed(specifier) {
|
|
20
|
-
return Effect.succeed(specifier);
|
|
21
|
-
}
|
|
22
|
-
inspectAll() {
|
|
23
|
-
return Effect.all(this.instances.map(instance => this.inspect(instance)));
|
|
24
|
-
}
|
|
25
|
-
inspect(instance) {
|
|
26
|
-
return Effect.succeed(new Report.Disabled(instance));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
import type { Specifier } from '../specifier/index.js';
|
|
7
|
-
import type { NonSemverError } from '../specifier/lib/non-semver-error.js';
|
|
8
|
-
declare const FilteredOutSemverGroup_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> & {
|
|
9
|
-
readonly _tag: "FilteredOut";
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Instances which do not match a given `--filter` option are assigned to this
|
|
13
|
-
* group and nothing will be changed.
|
|
14
|
-
*/
|
|
15
|
-
export declare class FilteredOutSemverGroup extends FilteredOutSemverGroup_base<{
|
|
16
|
-
config: GroupConfig;
|
|
17
|
-
filter: string;
|
|
18
|
-
instances: Instance[];
|
|
19
|
-
}> {
|
|
20
|
-
groupType: string;
|
|
21
|
-
constructor(ctx: Ctx);
|
|
22
|
-
canAdd(instance: Instance): boolean;
|
|
23
|
-
getFixed(specifier: Specifier.Any): Effect.Effect<Specifier.Any, NonSemverError>;
|
|
24
|
-
inspectAll(): Effect.Effect<Report.FilteredOut[], never, never>;
|
|
25
|
-
inspect(instance: Instance): Effect.Effect<Report.FilteredOut>;
|
|
26
|
-
}
|
|
27
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Data, Effect } from 'effect';
|
|
2
|
-
import { getFilter } from '../config/get-filter.js';
|
|
3
|
-
import { Report } from '../report.js';
|
|
4
|
-
/**
|
|
5
|
-
* Instances which do not match a given `--filter` option are assigned to this
|
|
6
|
-
* group and nothing will be changed.
|
|
7
|
-
*/
|
|
8
|
-
export class FilteredOutSemverGroup extends Data.TaggedClass('FilteredOut') {
|
|
9
|
-
groupType = 'semverGroup';
|
|
10
|
-
constructor(ctx) {
|
|
11
|
-
super({
|
|
12
|
-
config: {
|
|
13
|
-
dependencies: ['**'],
|
|
14
|
-
dependencyTypes: ['**'],
|
|
15
|
-
label: 'Filtered out',
|
|
16
|
-
packages: ['**'],
|
|
17
|
-
},
|
|
18
|
-
filter: getFilter(ctx.config),
|
|
19
|
-
instances: [],
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
canAdd(instance) {
|
|
23
|
-
return instance.name.search(new RegExp(this.filter)) === -1;
|
|
24
|
-
}
|
|
25
|
-
getFixed(specifier) {
|
|
26
|
-
return Effect.succeed(specifier);
|
|
27
|
-
}
|
|
28
|
-
inspectAll() {
|
|
29
|
-
return Effect.all(this.instances.map(instance => this.inspect(instance)));
|
|
30
|
-
}
|
|
31
|
-
inspect(instance) {
|
|
32
|
-
return Effect.succeed(new Report.FilteredOut(instance));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
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 type { Specifier } from '../specifier/index.js';
|
|
6
|
-
import type { NonSemverError } from '../specifier/lib/non-semver-error.js';
|
|
7
|
-
declare const IgnoredSemverGroup_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
|
-
readonly _tag: "Ignored";
|
|
9
|
-
};
|
|
10
|
-
/** Every instance in this group is ignored and nothing will be changed */
|
|
11
|
-
export declare class IgnoredSemverGroup extends IgnoredSemverGroup_base<{
|
|
12
|
-
config: SemverGroupConfig.Ignored;
|
|
13
|
-
instances: Instance[];
|
|
14
|
-
}> {
|
|
15
|
-
groupType: string;
|
|
16
|
-
constructor(config: SemverGroupConfig.Ignored);
|
|
17
|
-
canAdd(_: Instance): boolean;
|
|
18
|
-
getFixed(specifier: Specifier.Any): Effect.Effect<Specifier.Any, NonSemverError>;
|
|
19
|
-
inspectAll(): Effect.Effect<Report.Ignored[], never, never>;
|
|
20
|
-
inspect(instance: Instance): Effect.Effect<Report.Ignored>;
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Data, Effect } from 'effect';
|
|
2
|
-
import { Report } from '../report.js';
|
|
3
|
-
/** Every instance in this group is ignored and nothing will be changed */
|
|
4
|
-
export class IgnoredSemverGroup extends Data.TaggedClass('Ignored') {
|
|
5
|
-
groupType = 'semverGroup';
|
|
6
|
-
constructor(config) {
|
|
7
|
-
super({
|
|
8
|
-
config,
|
|
9
|
-
instances: [],
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
canAdd(_) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
getFixed(specifier) {
|
|
16
|
-
return Effect.succeed(specifier);
|
|
17
|
-
}
|
|
18
|
-
inspectAll() {
|
|
19
|
-
return Effect.all(this.instances.map(instance => this.inspect(instance)));
|
|
20
|
-
}
|
|
21
|
-
inspect(instance) {
|
|
22
|
-
return Effect.succeed(new Report.Ignored(instance));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { DisabledSemverGroup } from './disabled.js';
|
|
2
|
-
import type { FilteredOutSemverGroup } from './filtered-out.js';
|
|
3
|
-
import type { IgnoredSemverGroup } from './ignored.js';
|
|
4
|
-
import type { WithRangeSemverGroup } from './with-range.js';
|
|
5
|
-
export declare namespace SemverGroup {
|
|
6
|
-
export type Disabled = DisabledSemverGroup;
|
|
7
|
-
export type FilteredOut = FilteredOutSemverGroup;
|
|
8
|
-
export type Ignored = IgnoredSemverGroup;
|
|
9
|
-
export type WithRange = WithRangeSemverGroup;
|
|
10
|
-
export type Any = Disabled | FilteredOut | Ignored | WithRange;
|
|
11
|
-
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> & {
|
|
12
|
-
readonly _tag: "SemverGroupConfigError";
|
|
13
|
-
};
|
|
14
|
-
export class ConfigError extends ConfigError_base<{
|
|
15
|
-
readonly config: unknown;
|
|
16
|
-
readonly error: string;
|
|
17
|
-
}> {
|
|
18
|
-
}
|
|
19
|
-
export {};
|
|
20
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
readonly _tag: "WithRange";
|
|
9
|
-
};
|
|
10
|
-
export declare class WithRangeSemverGroup extends WithRangeSemverGroup_base<{
|
|
11
|
-
config: SemverGroupConfig.WithRange;
|
|
12
|
-
instances: Instance[];
|
|
13
|
-
isCatchAll: boolean;
|
|
14
|
-
}> {
|
|
15
|
-
groupType: string;
|
|
16
|
-
constructor(isCatchAll: boolean, config: SemverGroupConfig.WithRange);
|
|
17
|
-
canAdd(_: Instance): boolean;
|
|
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
|
-
}
|
|
22
|
-
export {};
|
|
@@ -1,45 +0,0 @@
|
|
|
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') {
|
|
6
|
-
groupType = 'semverGroup';
|
|
7
|
-
constructor(isCatchAll, config) {
|
|
8
|
-
super({
|
|
9
|
-
config,
|
|
10
|
-
instances: [],
|
|
11
|
-
isCatchAll,
|
|
12
|
-
});
|
|
13
|
-
this.getFixed = this.getFixed.bind(this);
|
|
14
|
-
}
|
|
15
|
-
canAdd(_) {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
getFixed(specifier) {
|
|
19
|
-
return pipe(specifier.getSemver(), Effect.map(semver => setSemverRange(this.config.range, semver)), Effect.flatMap(nextSemver => specifier.setSemver(nextSemver)));
|
|
20
|
-
}
|
|
21
|
-
inspectAll() {
|
|
22
|
-
return Effect.all(this.instances.map(instance => this.inspect(instance)));
|
|
23
|
-
}
|
|
24
|
-
inspect(instance) {
|
|
25
|
-
const current = Specifier.create(instance, instance.rawSpecifier.raw);
|
|
26
|
-
return pipe(this.getFixed(current), Effect.match({
|
|
27
|
-
// if range is fixable
|
|
28
|
-
onSuccess: valid =>
|
|
29
|
-
// if it is pinned and matches its pin
|
|
30
|
-
instance.versionGroup._tag === 'Pinned' &&
|
|
31
|
-
instance.rawSpecifier.raw === instance.versionGroup.config.pinVersion
|
|
32
|
-
? // the pinned version takes precendence and is a match
|
|
33
|
-
new Report.Valid(current)
|
|
34
|
-
: // if it is already like this on disk
|
|
35
|
-
instance.rawSpecifier.raw === valid.raw
|
|
36
|
-
? // it is a match
|
|
37
|
-
new Report.Valid(current)
|
|
38
|
-
: // it is a mismatch and should be this one
|
|
39
|
-
new Report.SemverRangeMismatch(valid),
|
|
40
|
-
// if range is NOT fixable, it is a mismatch we can't auto-fix
|
|
41
|
-
// as it seems to not be semver
|
|
42
|
-
onFailure: () => new Report.UnsupportedMismatch(instance),
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
2
|
-
import type { AliasResult } from 'npm-package-arg';
|
|
3
|
-
import { BaseSpecifier } from './base.js';
|
|
4
|
-
import { Specifier } from './index.js';
|
|
5
|
-
import { NonSemverError } from './lib/non-semver-error.js';
|
|
6
|
-
type T = AliasResult;
|
|
7
|
-
/** @example "npm:imageoptim-cli@3.1.7" */
|
|
8
|
-
export declare class AliasSpecifier extends BaseSpecifier<T> {
|
|
9
|
-
_tag: string;
|
|
10
|
-
/** The public name referenced in config */
|
|
11
|
-
name: "alias";
|
|
12
|
-
/** Return the version portion if it is valid semver */
|
|
13
|
-
getSemver(): Effect.Effect<string, NonSemverError>;
|
|
14
|
-
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
15
|
-
setSemver(version: string): Effect.Effect<Specifier.Any, NonSemverError>;
|
|
16
|
-
}
|
|
17
|
-
export {};
|
package/dist/specifier/alias.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Effect, pipe } from 'effect';
|
|
2
|
-
import { BaseSpecifier } from './base.js';
|
|
3
|
-
import { Specifier } from './index.js';
|
|
4
|
-
import { NonSemverError } from './lib/non-semver-error.js';
|
|
5
|
-
/** @example "npm:imageoptim-cli@3.1.7" */
|
|
6
|
-
export class AliasSpecifier extends BaseSpecifier {
|
|
7
|
-
_tag = 'Alias';
|
|
8
|
-
/** The public name referenced in config */
|
|
9
|
-
name = 'alias';
|
|
10
|
-
/** Return the version portion if it is valid semver */
|
|
11
|
-
getSemver() {
|
|
12
|
-
return pipe(this.parse(), Effect.mapError(() => new NonSemverError({ specifier: this })), Effect.map(parsed => parsed.subSpec), Effect.flatMap(subSpec => ['range', 'version'].includes(subSpec.type) &&
|
|
13
|
-
subSpec.fetchSpec !== null
|
|
14
|
-
? Effect.succeed(subSpec.fetchSpec)
|
|
15
|
-
: NonSemverError.asEffect(this)));
|
|
16
|
-
}
|
|
17
|
-
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
18
|
-
setSemver(version) {
|
|
19
|
-
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)));
|
|
20
|
-
}
|
|
21
|
-
}
|
package/dist/specifier/base.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
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
|
-
export declare class BaseSpecifier<T extends NpmPackageArgResult | unknown> {
|
|
7
|
-
/** should be overridden by sub classes */
|
|
8
|
-
_tag: string;
|
|
9
|
-
/** should be overridden by sub classes */
|
|
10
|
-
name: string;
|
|
11
|
-
/** The raw semver/workspace:/git etc version value */
|
|
12
|
-
raw: string;
|
|
13
|
-
/**
|
|
14
|
-
* A `Specifier` describes the version specifier (eg "^1.4.4") of a given
|
|
15
|
-
* instance.
|
|
16
|
-
*
|
|
17
|
-
* Initially there will be a `Specifier` which describes the version as it is
|
|
18
|
-
* on disk, but other `Specifier`s will need to be created which reflect what
|
|
19
|
-
* the version should be once fixed – first for the instance's version group
|
|
20
|
-
* and second for its semver group.
|
|
21
|
-
*
|
|
22
|
-
* The intermediate and final variants of `Specifier` could differ along the
|
|
23
|
-
* way and whether we're linting the current state of the monorepo or
|
|
24
|
-
* determining whether possible fixes will ultimately still have a valid
|
|
25
|
-
* version and range, each one has a reference back to the original `Instance`
|
|
26
|
-
* for writing back to it when we do finally commit our fixes once verified.
|
|
27
|
-
*/
|
|
28
|
-
instance: Instance;
|
|
29
|
-
constructor(data: Pick<BaseSpecifier<T>, 'raw' | 'instance'>);
|
|
30
|
-
/**
|
|
31
|
-
* Parse the raw version specifier using
|
|
32
|
-
* https://github.com/npm/npm-package-arg
|
|
33
|
-
*/
|
|
34
|
-
protected parse(): Effect.Effect<T, unknown>;
|
|
35
|
-
/** Return the version portion if it is valid semver */
|
|
36
|
-
getSemver(this: Specifier.Any): Effect.Effect<string, NonSemverError>;
|
|
37
|
-
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
38
|
-
setSemver(this: Specifier.Any, _version: string): Effect.Effect<Specifier.Any, NonSemverError>;
|
|
39
|
-
/** Apply the given specifier to a new one with this instance bound to it */
|
|
40
|
-
replaceWith<T extends Specifier.Any>(specifier: T): T;
|
|
41
|
-
}
|
package/dist/specifier/base.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
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 {
|
|
6
|
-
/** should be overridden by sub classes */
|
|
7
|
-
_tag = 'Base';
|
|
8
|
-
/** should be overridden by sub classes */
|
|
9
|
-
name = 'base';
|
|
10
|
-
/** The raw semver/workspace:/git etc version value */
|
|
11
|
-
raw;
|
|
12
|
-
/**
|
|
13
|
-
* A `Specifier` describes the version specifier (eg "^1.4.4") of a given
|
|
14
|
-
* instance.
|
|
15
|
-
*
|
|
16
|
-
* Initially there will be a `Specifier` which describes the version as it is
|
|
17
|
-
* on disk, but other `Specifier`s will need to be created which reflect what
|
|
18
|
-
* the version should be once fixed – first for the instance's version group
|
|
19
|
-
* and second for its semver group.
|
|
20
|
-
*
|
|
21
|
-
* The intermediate and final variants of `Specifier` could differ along the
|
|
22
|
-
* way and whether we're linting the current state of the monorepo or
|
|
23
|
-
* determining whether possible fixes will ultimately still have a valid
|
|
24
|
-
* version and range, each one has a reference back to the original `Instance`
|
|
25
|
-
* for writing back to it when we do finally commit our fixes once verified.
|
|
26
|
-
*/
|
|
27
|
-
instance;
|
|
28
|
-
constructor(data) {
|
|
29
|
-
this.raw = data.raw;
|
|
30
|
-
this.instance = data.instance;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Parse the raw version specifier using
|
|
34
|
-
* https://github.com/npm/npm-package-arg
|
|
35
|
-
*/
|
|
36
|
-
parse() {
|
|
37
|
-
const name = this.instance.name;
|
|
38
|
-
const raw = this.raw;
|
|
39
|
-
const packageJsonFile = this.instance.packageJsonFile;
|
|
40
|
-
return pipe(Effect.try(() => parseSpecifier(name, raw, packageJsonFile)), Effect.tapError(() => Effect.logError(`parseSpecifier threw on ${name}@${raw} at ${packageJsonFile.jsonFile.shortPath}`)));
|
|
41
|
-
}
|
|
42
|
-
/** Return the version portion if it is valid semver */
|
|
43
|
-
getSemver() {
|
|
44
|
-
return NonSemverError.asEffect(this);
|
|
45
|
-
}
|
|
46
|
-
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
47
|
-
setSemver(_version) {
|
|
48
|
-
return NonSemverError.asEffect(this);
|
|
49
|
-
}
|
|
50
|
-
/** Apply the given specifier to a new one with this instance bound to it */
|
|
51
|
-
replaceWith(specifier) {
|
|
52
|
-
return Specifier.create(this.instance, specifier.raw);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Instance } from '../get-instances/instance.js';
|
|
2
|
-
import type { Delete } from '../version-group/lib/delete.js';
|
|
3
|
-
/** A instance which should be deleted */
|
|
4
|
-
export declare class DeleteSpecifier {
|
|
5
|
-
_tag: string;
|
|
6
|
-
/** The public name referenced in config */
|
|
7
|
-
name: "delete";
|
|
8
|
-
raw: Delete;
|
|
9
|
-
instance: Instance;
|
|
10
|
-
constructor(data: {
|
|
11
|
-
raw: Delete;
|
|
12
|
-
instance: Instance;
|
|
13
|
-
});
|
|
14
|
-
getSemver: (this: import("./index.js").Specifier.Any) => import("effect/Effect").Effect<string, import("./lib/non-semver-error.js").NonSemverError>;
|
|
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>;
|
|
16
|
-
replaceWith: <T extends import("./index.js").Specifier.Any>(specifier: T) => T;
|
|
17
|
-
}
|
package/dist/specifier/delete.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BaseSpecifier } from './base.js';
|
|
2
|
-
/** A instance which should be deleted */
|
|
3
|
-
export class DeleteSpecifier {
|
|
4
|
-
_tag = 'Delete';
|
|
5
|
-
/** The public name referenced in config */
|
|
6
|
-
name = 'delete';
|
|
7
|
-
raw;
|
|
8
|
-
instance;
|
|
9
|
-
constructor(data) {
|
|
10
|
-
this.raw = data.raw;
|
|
11
|
-
this.instance = data.instance;
|
|
12
|
-
}
|
|
13
|
-
getSemver = BaseSpecifier.prototype.getSemver;
|
|
14
|
-
setSemver = BaseSpecifier.prototype.setSemver;
|
|
15
|
-
replaceWith = BaseSpecifier.prototype.replaceWith;
|
|
16
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
2
|
-
import { BaseSpecifier } from './base.js';
|
|
3
|
-
import { Specifier } from './index.js';
|
|
4
|
-
import { NonSemverError } from './lib/non-semver-error.js';
|
|
5
|
-
import type { SpecificRegistryResult } from './lib/specific-registry-result.js';
|
|
6
|
-
type T = SpecificRegistryResult<'version'>;
|
|
7
|
-
/**
|
|
8
|
-
* An exact semver version
|
|
9
|
-
* @example "1.4.4"
|
|
10
|
-
*/
|
|
11
|
-
export declare class ExactSpecifier extends BaseSpecifier<T> {
|
|
12
|
-
_tag: string;
|
|
13
|
-
/** The public name referenced in config */
|
|
14
|
-
name: "exact";
|
|
15
|
-
/** Return the semver version */
|
|
16
|
-
getSemver(): Effect.Effect<string, NonSemverError>;
|
|
17
|
-
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
18
|
-
setSemver(version: string): Effect.Effect<Specifier.Any>;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
package/dist/specifier/exact.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Effect, pipe } from 'effect';
|
|
2
|
-
import { BaseSpecifier } from './base.js';
|
|
3
|
-
import { Specifier } from './index.js';
|
|
4
|
-
import { NonSemverError } from './lib/non-semver-error.js';
|
|
5
|
-
/**
|
|
6
|
-
* An exact semver version
|
|
7
|
-
* @example "1.4.4"
|
|
8
|
-
*/
|
|
9
|
-
export class ExactSpecifier extends BaseSpecifier {
|
|
10
|
-
_tag = 'Exact';
|
|
11
|
-
/** The public name referenced in config */
|
|
12
|
-
name = 'exact';
|
|
13
|
-
/** Return the semver version */
|
|
14
|
-
getSemver() {
|
|
15
|
-
return pipe(this.parse(), Effect.mapError(() => new NonSemverError({ specifier: this })), Effect.map(parsed => parsed.fetchSpec));
|
|
16
|
-
}
|
|
17
|
-
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
18
|
-
setSemver(version) {
|
|
19
|
-
return Effect.succeed(Specifier.create(this.instance, version));
|
|
20
|
-
}
|
|
21
|
-
}
|
package/dist/specifier/file.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { FileResult } from 'npm-package-arg';
|
|
2
|
-
import { BaseSpecifier } from './base.js';
|
|
3
|
-
/** @example */
|
|
4
|
-
export declare class FileSpecifier extends BaseSpecifier<FileResult> {
|
|
5
|
-
_tag: string;
|
|
6
|
-
/** The public name referenced in config */
|
|
7
|
-
name: "file";
|
|
8
|
-
}
|
package/dist/specifier/file.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
2
|
-
import type { HostedGitResult } from 'npm-package-arg';
|
|
3
|
-
import { BaseSpecifier } from './base.js';
|
|
4
|
-
import { Specifier } from './index.js';
|
|
5
|
-
import { NonSemverError } from './lib/non-semver-error.js';
|
|
6
|
-
/** @example "git+https://github.com/user/foo" */
|
|
7
|
-
export declare class HostedGitSpecifier extends BaseSpecifier<HostedGitResult> {
|
|
8
|
-
_tag: string;
|
|
9
|
-
/** The public name referenced in config */
|
|
10
|
-
name: "hosted-git";
|
|
11
|
-
/** Return the git tag if it is valid semver */
|
|
12
|
-
getSemver(): Effect.Effect<string, NonSemverError>;
|
|
13
|
-
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
14
|
-
setSemver(version: string): Effect.Effect<Specifier.Any, NonSemverError>;
|
|
15
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
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';
|
|
6
|
-
/** @example "git+https://github.com/user/foo" */
|
|
7
|
-
export class HostedGitSpecifier extends BaseSpecifier {
|
|
8
|
-
_tag = 'HostedGit';
|
|
9
|
-
/** The public name referenced in config */
|
|
10
|
-
name = 'hosted-git';
|
|
11
|
-
/** Return the git tag if it is valid semver */
|
|
12
|
-
getSemver() {
|
|
13
|
-
return pipe(this.parse(), Effect.mapError(() => new NonSemverError({ specifier: this })), Effect.map(parsed => parsed.gitCommittish || ''), Effect.flatMap(gitCommittish => isSemver(gitCommittish)
|
|
14
|
-
? Effect.succeed(gitCommittish)
|
|
15
|
-
: NonSemverError.asEffect(this)));
|
|
16
|
-
}
|
|
17
|
-
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
18
|
-
setSemver(version) {
|
|
19
|
-
return pipe(this.parse(), Effect.mapError(() => new NonSemverError({ specifier: this })), Effect.map(parsed => ({
|
|
20
|
-
gitCommittish: parsed.gitCommittish || '',
|
|
21
|
-
rawSpec: parsed.rawSpec || '',
|
|
22
|
-
})), Effect.map(({ gitCommittish, rawSpec }) => rawSpec.replace(gitCommittish, version)), Effect.map(raw => Specifier.create(this.instance, raw)));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
-
export declare namespace Specifier {
|
|
15
|
-
const Alias: typeof AliasSpecifier;
|
|
16
|
-
const Delete: typeof DeleteSpecifier;
|
|
17
|
-
const Exact: typeof ExactSpecifier;
|
|
18
|
-
const File: typeof FileSpecifier;
|
|
19
|
-
const HostedGit: typeof HostedGitSpecifier;
|
|
20
|
-
const Latest: typeof LatestSpecifier;
|
|
21
|
-
const Range: typeof RangeSpecifier;
|
|
22
|
-
const Tag: typeof TagSpecifier;
|
|
23
|
-
const Unsupported: typeof UnsupportedSpecifier;
|
|
24
|
-
const Url: typeof UrlSpecifier;
|
|
25
|
-
const WorkspaceProtocol: typeof WorkspaceProtocolSpecifier;
|
|
26
|
-
type Any = AliasSpecifier | DeleteSpecifier | ExactSpecifier | FileSpecifier | HostedGitSpecifier | LatestSpecifier | RangeSpecifier | TagSpecifier | UnsupportedSpecifier | UrlSpecifier | WorkspaceProtocolSpecifier;
|
|
27
|
-
function create(instance: Instance, raw: string | Delete): Specifier.Any;
|
|
28
|
-
}
|
package/dist/specifier/index.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
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;
|
|
15
|
-
(function (Specifier) {
|
|
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;
|
|
27
|
-
function create(instance, raw) {
|
|
28
|
-
if (raw === DELETE) {
|
|
29
|
-
return new Specifier.Delete({ instance, raw });
|
|
30
|
-
}
|
|
31
|
-
if (!raw) {
|
|
32
|
-
return new Specifier.Unsupported({ instance, raw });
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
const data = {
|
|
36
|
-
instance,
|
|
37
|
-
raw: raw === 'latest' ? '*' : raw,
|
|
38
|
-
};
|
|
39
|
-
const parsed = parseSpecifier(instance.name, data.raw, instance.packageJsonFile);
|
|
40
|
-
const type = parsed.type;
|
|
41
|
-
if (data.raw === '*') {
|
|
42
|
-
return new Specifier.Latest(data);
|
|
43
|
-
}
|
|
44
|
-
if (type === 'version') {
|
|
45
|
-
return new Specifier.Exact(data);
|
|
46
|
-
}
|
|
47
|
-
if (type === 'range') {
|
|
48
|
-
return new Specifier.Range(data);
|
|
49
|
-
}
|
|
50
|
-
if (type === 'workspaceProtocol') {
|
|
51
|
-
return new Specifier.WorkspaceProtocol(data);
|
|
52
|
-
}
|
|
53
|
-
if (type === 'alias') {
|
|
54
|
-
return new Specifier.Alias(data);
|
|
55
|
-
}
|
|
56
|
-
if (type === 'file' || type === 'directory') {
|
|
57
|
-
return new Specifier.File(data);
|
|
58
|
-
}
|
|
59
|
-
if (type === 'remote') {
|
|
60
|
-
return new Specifier.Url(data);
|
|
61
|
-
}
|
|
62
|
-
if (type === 'git') {
|
|
63
|
-
return new Specifier.HostedGit(data);
|
|
64
|
-
}
|
|
65
|
-
if (type === 'tag') {
|
|
66
|
-
return new Specifier.Tag(data);
|
|
67
|
-
}
|
|
68
|
-
return new Specifier.Unsupported(data);
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
return new Specifier.Unsupported({ instance, raw });
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
Specifier.create = create;
|
|
75
|
-
})(Specifier || (Specifier = {}));
|