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,19 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
2
|
-
import { BaseSpecifier } from './base.js';
|
|
3
|
-
import { Specifier } from './index.js';
|
|
4
|
-
import { NonSemverError } from './lib/non-semver-error.js';
|
|
5
|
-
import type { SpecificRegistryResult } from './lib/specific-registry-result.js';
|
|
6
|
-
type T = SpecificRegistryResult<'range'>;
|
|
7
|
-
/**
|
|
8
|
-
* @example "*"
|
|
9
|
-
*/
|
|
10
|
-
export declare class LatestSpecifier extends BaseSpecifier<T> {
|
|
11
|
-
_tag: string;
|
|
12
|
-
/** The public name referenced in config */
|
|
13
|
-
name: "latest";
|
|
14
|
-
/** Return the semver version including the range */
|
|
15
|
-
getSemver(): Effect.Effect<string, NonSemverError>;
|
|
16
|
-
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
17
|
-
setSemver(version: string): Effect.Effect<Specifier.Any>;
|
|
18
|
-
}
|
|
19
|
-
export {};
|
package/dist/specifier/latest.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Effect, pipe } from 'effect';
|
|
2
|
-
import { BaseSpecifier } from './base.js';
|
|
3
|
-
import { Specifier } from './index.js';
|
|
4
|
-
import { NonSemverError } from './lib/non-semver-error.js';
|
|
5
|
-
/**
|
|
6
|
-
* @example "*"
|
|
7
|
-
*/
|
|
8
|
-
export class LatestSpecifier extends BaseSpecifier {
|
|
9
|
-
_tag = 'Latest';
|
|
10
|
-
/** The public name referenced in config */
|
|
11
|
-
name = 'latest';
|
|
12
|
-
/** Return the semver version including the range */
|
|
13
|
-
getSemver() {
|
|
14
|
-
return pipe(this.parse(), Effect.mapError(() => new NonSemverError({ specifier: this })), Effect.map(parsed => parsed.fetchSpec));
|
|
15
|
-
}
|
|
16
|
-
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
17
|
-
setSemver(version) {
|
|
18
|
-
return Effect.succeed(Specifier.create(this.instance, version));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
2
|
-
import type { Specifier } from '../index.js';
|
|
3
|
-
declare const NonSemverError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Readonly<A> & {
|
|
4
|
-
readonly _tag: "NonSemverError";
|
|
5
|
-
};
|
|
6
|
-
export declare class NonSemverError extends NonSemverError_base<{
|
|
7
|
-
specifier: Specifier.Any;
|
|
8
|
-
}> {
|
|
9
|
-
static asEffect<T>(specifier: Specifier.Any): Effect.Effect<T, NonSemverError>;
|
|
10
|
-
}
|
|
11
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import npa from 'npm-package-arg';
|
|
2
|
-
import type { PackageJsonFile } from '../../get-package-json-files/package-json-file.js';
|
|
3
|
-
/** Extends npm/npm-package-arg to support "workspace:*" */
|
|
4
|
-
export interface WorkspaceProtocolResult {
|
|
5
|
-
type: 'workspaceProtocol';
|
|
6
|
-
raw: string;
|
|
7
|
-
name: string | null;
|
|
8
|
-
escapedName: string | null;
|
|
9
|
-
scope: string | null;
|
|
10
|
-
rawSpec: string;
|
|
11
|
-
saveSpec: string;
|
|
12
|
-
}
|
|
13
|
-
export type NpmPackageArgResult = ReturnType<typeof npa.resolve> | WorkspaceProtocolResult;
|
|
14
|
-
export declare function parseSpecifier(name: string, specifier: string, packageJsonFile: PackageJsonFile): NpmPackageArgResult;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import npa from 'npm-package-arg';
|
|
2
|
-
export function parseSpecifier(name, specifier, packageJsonFile) {
|
|
3
|
-
if (specifier === 'workspace:*' ||
|
|
4
|
-
specifier === 'workspace:~' ||
|
|
5
|
-
specifier === 'workspace:^') {
|
|
6
|
-
const parsed = npa.resolve(name, packageJsonFile.jsonFile.dirPath, specifier.replace('workspace:', 'file:'));
|
|
7
|
-
return {
|
|
8
|
-
escapedName: parsed.escapedName,
|
|
9
|
-
name: parsed.name,
|
|
10
|
-
raw: parsed.raw.replace('file:', 'workspace:'),
|
|
11
|
-
rawSpec: parsed.rawSpec.replace('file:', 'workspace:'),
|
|
12
|
-
saveSpec: parsed.saveSpec.replace('file:', 'workspace:'),
|
|
13
|
-
scope: parsed.scope,
|
|
14
|
-
type: 'workspaceProtocol',
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return npa.resolve(name, specifier, packageJsonFile.jsonFile.dirPath);
|
|
18
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { RegistryResult } from 'npm-package-arg';
|
|
2
|
-
/**
|
|
3
|
-
* A helper to create specific classes for each of the possible
|
|
4
|
-
* `RegistryResult` types from npm/npm-package-arg. Instead of grouping them
|
|
5
|
-
* together we are being more specific
|
|
6
|
-
*/
|
|
7
|
-
export type SpecificRegistryResult<T extends RegistryResult['type'] | 'local'> = Omit<RegistryResult, 'type'> & {
|
|
8
|
-
type: T;
|
|
9
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
2
|
-
import { BaseSpecifier } from './base.js';
|
|
3
|
-
import { Specifier } from './index.js';
|
|
4
|
-
import { NonSemverError } from './lib/non-semver-error.js';
|
|
5
|
-
import type { SpecificRegistryResult } from './lib/specific-registry-result.js';
|
|
6
|
-
type T = SpecificRegistryResult<'range'>;
|
|
7
|
-
/**
|
|
8
|
-
* @example "^1.2.3"
|
|
9
|
-
*/
|
|
10
|
-
export declare class RangeSpecifier extends BaseSpecifier<T> {
|
|
11
|
-
_tag: string;
|
|
12
|
-
/** The public name referenced in config */
|
|
13
|
-
name: "range";
|
|
14
|
-
/** Return the semver version including the range */
|
|
15
|
-
getSemver(): Effect.Effect<string, NonSemverError>;
|
|
16
|
-
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
17
|
-
setSemver(version: string): Effect.Effect<Specifier.Any>;
|
|
18
|
-
}
|
|
19
|
-
export {};
|
package/dist/specifier/range.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Effect, pipe } from 'effect';
|
|
2
|
-
import { BaseSpecifier } from './base.js';
|
|
3
|
-
import { Specifier } from './index.js';
|
|
4
|
-
import { NonSemverError } from './lib/non-semver-error.js';
|
|
5
|
-
/**
|
|
6
|
-
* @example "^1.2.3"
|
|
7
|
-
*/
|
|
8
|
-
export class RangeSpecifier extends BaseSpecifier {
|
|
9
|
-
_tag = 'Range';
|
|
10
|
-
/** The public name referenced in config */
|
|
11
|
-
name = 'range';
|
|
12
|
-
/** Return the semver version including the range */
|
|
13
|
-
getSemver() {
|
|
14
|
-
return pipe(this.parse(), Effect.mapError(() => new NonSemverError({ specifier: this })), Effect.map(parsed => parsed.fetchSpec));
|
|
15
|
-
}
|
|
16
|
-
/** Get a new `Specifier` from the given semver version applied to this one */
|
|
17
|
-
setSemver(version) {
|
|
18
|
-
return Effect.succeed(Specifier.create(this.instance, version));
|
|
19
|
-
}
|
|
20
|
-
}
|
package/dist/specifier/tag.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { BaseSpecifier } from './base.js';
|
|
2
|
-
import type { SpecificRegistryResult } from './lib/specific-registry-result.js';
|
|
3
|
-
/**
|
|
4
|
-
* @example "latest"
|
|
5
|
-
* @example "made-up-by-some-dev"
|
|
6
|
-
*/
|
|
7
|
-
export declare class TagSpecifier extends BaseSpecifier<SpecificRegistryResult<'tag'>> {
|
|
8
|
-
_tag: string;
|
|
9
|
-
/** The public name referenced in config */
|
|
10
|
-
name: "tag";
|
|
11
|
-
}
|
package/dist/specifier/tag.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BaseSpecifier } from './base.js';
|
|
2
|
-
/** A specifier not supported by the `npm` package manager */
|
|
3
|
-
export declare class UnsupportedSpecifier extends BaseSpecifier<unknown> {
|
|
4
|
-
_tag: string;
|
|
5
|
-
/** The public name referenced in config */
|
|
6
|
-
name: "unsupported";
|
|
7
|
-
}
|
package/dist/specifier/url.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { URLResult } from 'npm-package-arg';
|
|
2
|
-
import { BaseSpecifier } from './base.js';
|
|
3
|
-
/** @example "http://x.com/foo.tgz" */
|
|
4
|
-
export declare class UrlSpecifier extends BaseSpecifier<URLResult> {
|
|
5
|
-
_tag: string;
|
|
6
|
-
/** The public name referenced in config */
|
|
7
|
-
name: "url";
|
|
8
|
-
}
|
package/dist/specifier/url.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
2
|
-
import type { Ctx } from '../get-context/index.js';
|
|
3
|
-
import { BaseSpecifier } from './base.js';
|
|
4
|
-
import { Specifier } from './index.js';
|
|
5
|
-
import type { WorkspaceProtocolResult } from './lib/parse-specifier.js';
|
|
6
|
-
/** Represents "workspace:*" and "workspace:~" */
|
|
7
|
-
export declare class WorkspaceProtocolSpecifier extends BaseSpecifier<WorkspaceProtocolResult> {
|
|
8
|
-
_tag: string;
|
|
9
|
-
/** The public name referenced in config */
|
|
10
|
-
name: "workspace-protocol";
|
|
11
|
-
/**
|
|
12
|
-
* Return an equivalent value which actually is semver, so that it can be used
|
|
13
|
-
* with tools which expect values which conform to the spec. This value is
|
|
14
|
-
* used only when sorting versions.
|
|
15
|
-
*/
|
|
16
|
-
getSemverEquivalent(ctx: Ctx): Effect.Effect<string>;
|
|
17
|
-
getSemver(): Effect.Effect<string>;
|
|
18
|
-
setSemver(version: string): Effect.Effect<Specifier.Any>;
|
|
19
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
2
|
-
import { BaseSpecifier } from './base.js';
|
|
3
|
-
import { Specifier } from './index.js';
|
|
4
|
-
/** Represents "workspace:*" and "workspace:~" */
|
|
5
|
-
export class WorkspaceProtocolSpecifier extends BaseSpecifier {
|
|
6
|
-
_tag = 'WorkspaceProtocol';
|
|
7
|
-
/** The public name referenced in config */
|
|
8
|
-
name = 'workspace-protocol';
|
|
9
|
-
/**
|
|
10
|
-
* Return an equivalent value which actually is semver, so that it can be used
|
|
11
|
-
* with tools which expect values which conform to the spec. This value is
|
|
12
|
-
* used only when sorting versions.
|
|
13
|
-
*/
|
|
14
|
-
getSemverEquivalent(ctx) {
|
|
15
|
-
if (this.raw === 'workspace:*') {
|
|
16
|
-
return Effect.succeed('*');
|
|
17
|
-
}
|
|
18
|
-
if (this.raw === 'workspace:~' || this.raw === 'workspace:^') {
|
|
19
|
-
const range = this.raw.replace('workspace:', '');
|
|
20
|
-
const local = ctx.packageJsonFilesByName[this.instance.name];
|
|
21
|
-
const version = local?.jsonFile?.contents?.version;
|
|
22
|
-
if (version) {
|
|
23
|
-
return Effect.succeed(`${range}${version}`);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return Effect.succeed('0.0.0');
|
|
27
|
-
}
|
|
28
|
-
// @TODO: this name is inaccurate, check how it is used and change logic or rename
|
|
29
|
-
getSemver() {
|
|
30
|
-
return Effect.succeed(this.raw);
|
|
31
|
-
}
|
|
32
|
-
setSemver(version) {
|
|
33
|
-
return Effect.succeed(Specifier.create(this.instance, version));
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Effect, Option, pipe } from 'effect';
|
|
2
|
-
import { isNonEmptyString } from 'tightrope/guard/is-non-empty-string.js';
|
|
3
|
-
import { get } from '../../lib/get.js';
|
|
4
|
-
const getOptionOfNonEmptyString = Option.liftPredicate(isNonEmptyString);
|
|
5
|
-
export function getNonEmptyStringProp(propPath, file) {
|
|
6
|
-
return pipe(get(file.jsonFile.contents, ...propPath.split('.')), Effect.flatMap(value => getOptionOfNonEmptyString(value)), Effect.tapError(() => Effect.logDebug(`<${file.jsonFile.shortPath}>.${propPath} is not a non-empty string`)));
|
|
7
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
2
|
-
import type { PackageJsonFile } from '../get-package-json-files/package-json-file.js';
|
|
3
|
-
import type { Delete } from '../version-group/lib/delete.js';
|
|
4
|
-
export declare class NameAndVersionPropsStrategy {
|
|
5
|
-
_tag: string;
|
|
6
|
-
name: string;
|
|
7
|
-
path: string;
|
|
8
|
-
namePath: string;
|
|
9
|
-
constructor(name: string, path: string, namePath: string);
|
|
10
|
-
read(file: PackageJsonFile): Effect.Effect<[string, string][]>;
|
|
11
|
-
write(file: PackageJsonFile, [, version]: [string, string | Delete]): Effect.Effect<PackageJsonFile>;
|
|
12
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Effect, Option, identity, pipe } from 'effect';
|
|
2
|
-
import { isObject } from 'tightrope/guard/is-object.js';
|
|
3
|
-
import { get } from '../lib/get.js';
|
|
4
|
-
import { DELETE } from '../version-group/lib/delete.js';
|
|
5
|
-
import { getNonEmptyStringProp } from './lib/get-non-empty-string-prop.js';
|
|
6
|
-
const getOptionOfObject = Option.liftPredicate((isObject));
|
|
7
|
-
export class NameAndVersionPropsStrategy {
|
|
8
|
-
_tag = 'name~version';
|
|
9
|
-
name;
|
|
10
|
-
path;
|
|
11
|
-
namePath;
|
|
12
|
-
constructor(name, path, namePath) {
|
|
13
|
-
this.name = name;
|
|
14
|
-
this.path = path;
|
|
15
|
-
this.namePath = namePath;
|
|
16
|
-
}
|
|
17
|
-
read(file) {
|
|
18
|
-
return pipe(Effect.Do,
|
|
19
|
-
// get the name prop
|
|
20
|
-
Effect.bind('name', () => getNonEmptyStringProp(this.namePath, file)),
|
|
21
|
-
// add the version prop
|
|
22
|
-
Effect.bind('version', () => pipe(getNonEmptyStringProp(this.path, file),
|
|
23
|
-
/**
|
|
24
|
-
* In order to report a `MissingLocalVersion`, we need to ensure that
|
|
25
|
-
* a value is returned for `local` package .version properties so we
|
|
26
|
-
* can know that `this.name` is a package developed in this repo but
|
|
27
|
-
* that its version is missing.
|
|
28
|
-
*
|
|
29
|
-
* Not doing this results in the invalid local package being ignored
|
|
30
|
-
* and each installation of it being checked for mismatches amongst
|
|
31
|
-
* themselves.
|
|
32
|
-
*/
|
|
33
|
-
this.name === 'local'
|
|
34
|
-
? Effect.catchAll(() => Effect.succeed('PACKAGE_JSON_HAS_NO_VERSION'))
|
|
35
|
-
: Effect.map(identity))),
|
|
36
|
-
// if both are non empty strings, we can return them
|
|
37
|
-
Effect.map(({ name, version }) => [[name, version]]), Effect.tapError(() => Effect.logDebug(`NameAndVersionPropsStrategy#${this.name} found nothing at <${file.jsonFile.shortPath}>.${this.path} & .${this.namePath}`)),
|
|
38
|
-
// if either are invalid, default to empty
|
|
39
|
-
Effect.catchAll(() => Effect.succeed([])));
|
|
40
|
-
}
|
|
41
|
-
write(file, [, version]) {
|
|
42
|
-
const path = this.path;
|
|
43
|
-
const { contents } = file.jsonFile;
|
|
44
|
-
const isNestedPath = path.includes('.');
|
|
45
|
-
const nextValue = version === DELETE ? undefined : version;
|
|
46
|
-
if (isNestedPath) {
|
|
47
|
-
const fullPath = path.split('.');
|
|
48
|
-
const pathToParent = fullPath.slice(0, fullPath.length - 1).join('.');
|
|
49
|
-
const key = fullPath.slice(-1).join('');
|
|
50
|
-
return pipe(get(contents, ...pathToParent.split('.')), Effect.flatMap(getOptionOfObject), Effect.flatMap(parent => Effect.try(() => {
|
|
51
|
-
parent[key] = nextValue;
|
|
52
|
-
file.applyEdit(fullPath, nextValue);
|
|
53
|
-
})), Effect.tapError(() => Effect.logDebug(`strategy ${this._tag} with name ${this.name} failed to write to <${file.jsonFile.shortPath}>.${this.path}`)), Effect.catchAll(() => Effect.succeed(file)), Effect.map(() => file));
|
|
54
|
-
}
|
|
55
|
-
return pipe(getOptionOfObject(contents), Effect.flatMap(parent => Effect.try(() => {
|
|
56
|
-
parent[this.path] = nextValue;
|
|
57
|
-
file.applyEdit([this.path], nextValue);
|
|
58
|
-
})), Effect.tapError(() => Effect.logDebug(`strategy ${this._tag} with name ${this.name} failed to write to <${file.jsonFile.shortPath}>.${this.path}`)), Effect.catchAll(() => Effect.succeed(file)), Effect.map(() => file));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
2
|
-
import type { PackageJsonFile } from '../get-package-json-files/package-json-file.js';
|
|
3
|
-
import type { Delete } from '../version-group/lib/delete.js';
|
|
4
|
-
export declare class NamedVersionStringStrategy {
|
|
5
|
-
_tag: string;
|
|
6
|
-
name: string;
|
|
7
|
-
path: string;
|
|
8
|
-
constructor(name: string, path: string);
|
|
9
|
-
read(file: PackageJsonFile): Effect.Effect<[string, string][]>;
|
|
10
|
-
write(file: PackageJsonFile, [name, version]: [string, string | Delete]): Effect.Effect<PackageJsonFile>;
|
|
11
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Effect, Option, pipe } from 'effect';
|
|
2
|
-
import { isNonEmptyObject } from 'tightrope/guard/is-non-empty-object.js';
|
|
3
|
-
import { isNonEmptyString } from 'tightrope/guard/is-non-empty-string.js';
|
|
4
|
-
import { get } from '../lib/get.js';
|
|
5
|
-
import { DELETE } from '../version-group/lib/delete.js';
|
|
6
|
-
import { getNonEmptyStringProp } from './lib/get-non-empty-string-prop.js';
|
|
7
|
-
const getOptionOfNonEmptyString = Option.liftPredicate(isNonEmptyString);
|
|
8
|
-
const getOptionOfNonEmptyObject = Option.liftPredicate((isNonEmptyObject));
|
|
9
|
-
export class NamedVersionStringStrategy {
|
|
10
|
-
_tag = 'name@version';
|
|
11
|
-
name;
|
|
12
|
-
path;
|
|
13
|
-
constructor(name, path) {
|
|
14
|
-
this.name = name;
|
|
15
|
-
this.path = path;
|
|
16
|
-
}
|
|
17
|
-
read(file) {
|
|
18
|
-
const path = this.path;
|
|
19
|
-
return pipe(
|
|
20
|
-
// get version prop
|
|
21
|
-
getNonEmptyStringProp(path, file),
|
|
22
|
-
// if it is a non empty string, we can read it
|
|
23
|
-
Effect.map(value => value.split(/@(.*)/)),
|
|
24
|
-
// check the string was properly formed
|
|
25
|
-
Effect.flatMap(([name, version]) => Effect.all([
|
|
26
|
-
getOptionOfNonEmptyString(name),
|
|
27
|
-
getOptionOfNonEmptyString(version),
|
|
28
|
-
])),
|
|
29
|
-
// return an array of one entry if valid
|
|
30
|
-
Effect.map(([name, version]) => [[name, version]]), Effect.tapError(() => Effect.logDebug(`NamedVersionStringStrategy#${this.name} found nothing at <${file.jsonFile.shortPath}>.${this.path}`)),
|
|
31
|
-
// if value is invalid, default to empty
|
|
32
|
-
Effect.catchAll(() => Effect.succeed([])));
|
|
33
|
-
}
|
|
34
|
-
write(file, [name, version]) {
|
|
35
|
-
const { contents } = file.jsonFile;
|
|
36
|
-
const isNestedPath = this.path.includes('.');
|
|
37
|
-
const nextValue = version === DELETE ? undefined : `${name}@${version}`;
|
|
38
|
-
if (isNestedPath) {
|
|
39
|
-
const fullPath = this.path.split('.');
|
|
40
|
-
const pathToParent = fullPath.slice(0, fullPath.length - 1).join('.');
|
|
41
|
-
const key = fullPath.slice(-1).join('');
|
|
42
|
-
return pipe(get(contents, ...pathToParent.split('.')), Effect.flatMap(getOptionOfNonEmptyObject), Effect.flatMap(parent => Effect.try(() => {
|
|
43
|
-
parent[key] = nextValue;
|
|
44
|
-
file.applyEdit(fullPath, nextValue);
|
|
45
|
-
})), Effect.tapError(() => Effect.logDebug(`strategy ${this._tag} with name ${this.name} failed to write to <${file.jsonFile.shortPath}>.${this.path}`)), Effect.catchAll(() => Effect.succeed(file)), Effect.map(() => file));
|
|
46
|
-
}
|
|
47
|
-
return pipe(getOptionOfNonEmptyObject(contents), Effect.flatMap(parent => Effect.try(() => {
|
|
48
|
-
parent[this.path] = nextValue;
|
|
49
|
-
file.applyEdit([this.path], nextValue);
|
|
50
|
-
})), Effect.tapError(() => Effect.logDebug(`strategy ${this._tag} with name ${this.name} failed to write to <${file.jsonFile.shortPath}>.${this.path}`)), Effect.catchAll(() => Effect.succeed(file)), Effect.map(() => file));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
2
|
-
import type { PackageJsonFile } from '../get-package-json-files/package-json-file.js';
|
|
3
|
-
import type { Delete } from '../version-group/lib/delete.js';
|
|
4
|
-
export declare class UnnamedVersionStringStrategy {
|
|
5
|
-
_tag: string;
|
|
6
|
-
name: string;
|
|
7
|
-
path: string;
|
|
8
|
-
constructor(name: string, path: string);
|
|
9
|
-
read(file: PackageJsonFile): Effect.Effect<[string, string][]>;
|
|
10
|
-
write(file: PackageJsonFile, [, version]: [string, string | Delete]): Effect.Effect<PackageJsonFile>;
|
|
11
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Effect, Option, pipe } from 'effect';
|
|
2
|
-
import { isNonEmptyObject } from 'tightrope/guard/is-non-empty-object.js';
|
|
3
|
-
import { get } from '../lib/get.js';
|
|
4
|
-
import { DELETE } from '../version-group/lib/delete.js';
|
|
5
|
-
import { getNonEmptyStringProp } from './lib/get-non-empty-string-prop.js';
|
|
6
|
-
const getOptionOfNonEmptyObject = Option.liftPredicate((isNonEmptyObject));
|
|
7
|
-
export class UnnamedVersionStringStrategy {
|
|
8
|
-
_tag = 'version';
|
|
9
|
-
name;
|
|
10
|
-
path;
|
|
11
|
-
constructor(name, path) {
|
|
12
|
-
this.name = name;
|
|
13
|
-
this.path = path;
|
|
14
|
-
}
|
|
15
|
-
read(file) {
|
|
16
|
-
return pipe(
|
|
17
|
-
// get version prop
|
|
18
|
-
getNonEmptyStringProp(this.path, file),
|
|
19
|
-
// if it is a non empty string, we can read it
|
|
20
|
-
Effect.map((version) => {
|
|
21
|
-
const name = this.path.split('.').slice(-1).join('');
|
|
22
|
-
return [[name, version]];
|
|
23
|
-
}), Effect.tapError(() => Effect.logDebug(`UnnamedVersionStringStrategy#${this.name} found nothing at <${file.jsonFile.shortPath}>.${this.path}`)),
|
|
24
|
-
// if value is invalid, default to empty
|
|
25
|
-
Effect.catchAll(() => Effect.succeed([])));
|
|
26
|
-
}
|
|
27
|
-
write(file, [, version]) {
|
|
28
|
-
const { contents } = file.jsonFile;
|
|
29
|
-
const isNestedPath = this.path.includes('.');
|
|
30
|
-
const nextValue = version === DELETE ? undefined : version;
|
|
31
|
-
if (isNestedPath) {
|
|
32
|
-
const fullPath = this.path.split('.');
|
|
33
|
-
const pathToParent = fullPath.slice(0, fullPath.length - 1).join('.');
|
|
34
|
-
const key = fullPath.slice(-1).join('');
|
|
35
|
-
return pipe(get(contents, ...pathToParent.split('.')), Effect.flatMap(getOptionOfNonEmptyObject), Effect.flatMap(parent => Effect.try(() => {
|
|
36
|
-
parent[key] = nextValue;
|
|
37
|
-
file.applyEdit(fullPath, nextValue);
|
|
38
|
-
})), Effect.tapError(() => Effect.logDebug(`strategy ${this._tag} with name ${this.name} failed to write to <${file.jsonFile.shortPath}>.${this.path}`)), Effect.catchAll(() => Effect.succeed(file)), Effect.map(() => file));
|
|
39
|
-
}
|
|
40
|
-
return pipe(getOptionOfNonEmptyObject(contents), Effect.flatMap(parent => Effect.try(() => {
|
|
41
|
-
parent[this.path] = nextValue;
|
|
42
|
-
file.applyEdit([this.path], nextValue);
|
|
43
|
-
})), Effect.tapError(() => Effect.logDebug(`strategy ${this._tag} with name ${this.name} failed to write to <${file.jsonFile.shortPath}>.${this.path}`)), Effect.catchAll(() => Effect.succeed(file)), Effect.map(() => file));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
2
|
-
import type { PackageJsonFile } from '../get-package-json-files/package-json-file.js';
|
|
3
|
-
import type { Delete } from '../version-group/lib/delete.js';
|
|
4
|
-
export declare class VersionsByNameStrategy {
|
|
5
|
-
_tag: string;
|
|
6
|
-
name: string;
|
|
7
|
-
path: string;
|
|
8
|
-
constructor(name: string, path: string);
|
|
9
|
-
read(file: PackageJsonFile): Effect.Effect<[string, string][]>;
|
|
10
|
-
write(file: PackageJsonFile, [name, version]: [string, string | Delete]): Effect.Effect<PackageJsonFile>;
|
|
11
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Effect, Option, pipe } from 'effect';
|
|
2
|
-
import { isNonEmptyObject } from 'tightrope/guard/is-non-empty-object.js';
|
|
3
|
-
import { get } from '../lib/get.js';
|
|
4
|
-
import { DELETE } from '../version-group/lib/delete.js';
|
|
5
|
-
const getOptionOfNonEmptyObject = Option.liftPredicate((isNonEmptyObject));
|
|
6
|
-
export class VersionsByNameStrategy {
|
|
7
|
-
_tag = 'versionsByName';
|
|
8
|
-
name;
|
|
9
|
-
path;
|
|
10
|
-
constructor(name, path) {
|
|
11
|
-
this.name = name;
|
|
12
|
-
this.path = path;
|
|
13
|
-
}
|
|
14
|
-
read(file) {
|
|
15
|
-
return pipe(get(file.jsonFile.contents, ...this.path.split('.')), Effect.flatMap(value => getOptionOfNonEmptyObject(value)), Effect.map(obj => Object.entries(obj)), Effect.tapError(() => Effect.logDebug(`VersionsByNameStrategy#${this.name} found nothing at <${file.jsonFile.shortPath}>.${this.path}`)),
|
|
16
|
-
// if value is invalid, default to empty
|
|
17
|
-
Effect.catchAll(() => Effect.succeed([])));
|
|
18
|
-
}
|
|
19
|
-
write(file, [name, version]) {
|
|
20
|
-
const nextValue = version === DELETE ? undefined : version;
|
|
21
|
-
const fullPath = this.path.split('.');
|
|
22
|
-
return pipe(get(file.jsonFile.contents, ...fullPath), Effect.flatMap(getOptionOfNonEmptyObject), Effect.flatMap(parent => Effect.try(() => {
|
|
23
|
-
parent[name] = nextValue;
|
|
24
|
-
file.applyEdit(fullPath.concat(name), nextValue);
|
|
25
|
-
})), Effect.tapError(() => Effect.logDebug(`strategy ${this._tag} with name ${this.name} failed to write to <${file.jsonFile.shortPath}>.${this.path}.${name}`)), Effect.catchAll(() => Effect.succeed(file)), Effect.map(() => file));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
2
|
-
import type { VersionGroupConfig } from '../config/types.js';
|
|
3
|
-
import type { Instance } from '../get-instances/instance.js';
|
|
4
|
-
import { Report } from '../report.js';
|
|
5
|
-
declare const BannedVersionGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Readonly<A> & {
|
|
6
|
-
readonly _tag: "Banned";
|
|
7
|
-
};
|
|
8
|
-
export declare class BannedVersionGroup extends BannedVersionGroup_base<{
|
|
9
|
-
config: VersionGroupConfig.Banned;
|
|
10
|
-
instances: Instance[];
|
|
11
|
-
}> {
|
|
12
|
-
groupType: string;
|
|
13
|
-
constructor(config: VersionGroupConfig.Banned);
|
|
14
|
-
canAdd(_: Instance): boolean;
|
|
15
|
-
inspectAll(): Effect.Effect<Report.Version.Group[]>;
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Data, Effect } from 'effect';
|
|
2
|
-
import { Report } from '../report.js';
|
|
3
|
-
import { Specifier } from '../specifier/index.js';
|
|
4
|
-
import { DELETE } from './lib/delete.js';
|
|
5
|
-
import { groupBy } from './lib/group-by.js';
|
|
6
|
-
export class BannedVersionGroup extends Data.TaggedClass('Banned') {
|
|
7
|
-
groupType = 'versionGroup';
|
|
8
|
-
constructor(config) {
|
|
9
|
-
super({
|
|
10
|
-
config,
|
|
11
|
-
instances: [],
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
canAdd(_) {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
inspectAll() {
|
|
18
|
-
return Effect.succeed(Object.entries(groupBy('name', this.instances)).map(([name, instances]) => ({
|
|
19
|
-
name,
|
|
20
|
-
reports: instances.map(instance =>
|
|
21
|
-
// ✘ package should not be used
|
|
22
|
-
// ✓ is a mismatch we can auto-fix
|
|
23
|
-
new Report.Banned(Specifier.create(instance, DELETE))),
|
|
24
|
-
})));
|
|
25
|
-
}
|
|
26
|
-
}
|