@bemoje/monorepo 1.2.1 → 1.2.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/lib/index.cjs +19 -5219
- package/lib/index.d.cts +2765 -26
- package/lib/index.d.ts +2765 -26
- package/lib/index.js +14 -5217
- package/package.json +178 -298
- package/lib/MonoRepo.cjs +0 -7370
- package/lib/MonoRepo.d.cts +0 -10
- package/lib/MonoRepo.d.ts +0 -10
- package/lib/MonoRepo.js +0 -7361
- package/lib/code/AbstractCode.cjs +0 -5568
- package/lib/code/AbstractCode.d.cts +0 -30
- package/lib/code/AbstractCode.d.ts +0 -30
- package/lib/code/AbstractCode.js +0 -5562
- package/lib/code/CodeBlock.cjs +0 -5614
- package/lib/code/CodeBlock.d.cts +0 -22
- package/lib/code/CodeBlock.d.ts +0 -22
- package/lib/code/CodeBlock.js +0 -5608
- package/lib/code/TsCode.cjs +0 -7370
- package/lib/code/TsCode.d.cts +0 -10
- package/lib/code/TsCode.d.ts +0 -10
- package/lib/code/TsCode.js +0 -7361
- package/lib/code/imports/ImportKeywords.cjs +0 -5652
- package/lib/code/imports/ImportKeywords.d.cts +0 -10
- package/lib/code/imports/ImportKeywords.d.ts +0 -10
- package/lib/code/imports/ImportKeywords.js +0 -5646
- package/lib/code/imports/ImportSpecifiers.cjs +0 -5708
- package/lib/code/imports/ImportSpecifiers.d.cts +0 -10
- package/lib/code/imports/ImportSpecifiers.d.ts +0 -10
- package/lib/code/imports/ImportSpecifiers.js +0 -5702
- package/lib/code/imports/ImportStatement.cjs +0 -7372
- package/lib/code/imports/ImportStatement.d.cts +0 -10
- package/lib/code/imports/ImportStatement.d.ts +0 -10
- package/lib/code/imports/ImportStatement.js +0 -7363
- package/lib/code/imports/ModuleSpecifier.cjs +0 -7372
- package/lib/code/imports/ModuleSpecifier.d.cts +0 -10
- package/lib/code/imports/ModuleSpecifier.d.ts +0 -10
- package/lib/code/imports/ModuleSpecifier.js +0 -7363
- package/lib/common/AbstractBase.cjs +0 -638
- package/lib/common/AbstractBase.d.cts +0 -3
- package/lib/common/AbstractBase.d.ts +0 -3
- package/lib/common/AbstractBase.js +0 -634
- package/lib/file/File.cjs +0 -5496
- package/lib/file/File.d.cts +0 -10
- package/lib/file/File.d.ts +0 -10
- package/lib/file/File.js +0 -5490
- package/lib/file/TestFile.cjs +0 -7368
- package/lib/file/TestFile.d.cts +0 -10
- package/lib/file/TestFile.d.ts +0 -10
- package/lib/file/TestFile.js +0 -7359
- package/lib/file/TsFile.cjs +0 -7368
- package/lib/file/TsFile.d.cts +0 -10
- package/lib/file/TsFile.d.ts +0 -10
- package/lib/file/TsFile.js +0 -7359
- package/lib/methods/findWorkspacePackageName.cjs +0 -86
- package/lib/methods/findWorkspacePackageName.d.cts +0 -6
- package/lib/methods/findWorkspacePackageName.d.ts +0 -6
- package/lib/methods/findWorkspacePackageName.js +0 -78
- package/lib/methods/getAllImports.cjs +0 -20
- package/lib/methods/getAllImports.d.cts +0 -17
- package/lib/methods/getAllImports.d.ts +0 -17
- package/lib/methods/getAllImports.js +0 -18
- package/lib/methods/getAllWorkspacePackageJsonPaths.cjs +0 -57
- package/lib/methods/getAllWorkspacePackageJsonPaths.d.cts +0 -6
- package/lib/methods/getAllWorkspacePackageJsonPaths.d.ts +0 -6
- package/lib/methods/getAllWorkspacePackageJsonPaths.js +0 -49
- package/lib/methods/getAllWorkspacePackageJsons.cjs +0 -66
- package/lib/methods/getAllWorkspacePackageJsons.d.cts +0 -6
- package/lib/methods/getAllWorkspacePackageJsons.d.ts +0 -6
- package/lib/methods/getAllWorkspacePackageJsons.js +0 -58
- package/lib/methods/getAllWorkspacePackageNames.cjs +0 -75
- package/lib/methods/getAllWorkspacePackageNames.d.cts +0 -6
- package/lib/methods/getAllWorkspacePackageNames.d.ts +0 -6
- package/lib/methods/getAllWorkspacePackageNames.js +0 -67
- package/lib/methods/getAllWorkspacePaths.cjs +0 -50
- package/lib/methods/getAllWorkspacePaths.d.cts +0 -6
- package/lib/methods/getAllWorkspacePaths.d.ts +0 -6
- package/lib/methods/getAllWorkspacePaths.js +0 -42
- package/lib/methods/getImportsRecursively.cjs +0 -7577
- package/lib/methods/getImportsRecursively.d.cts +0 -37
- package/lib/methods/getImportsRecursively.d.ts +0 -37
- package/lib/methods/getImportsRecursively.js +0 -7566
- package/lib/methods/getRepoPackageJson.cjs +0 -40
- package/lib/methods/getRepoPackageJson.d.cts +0 -6
- package/lib/methods/getRepoPackageJson.d.ts +0 -6
- package/lib/methods/getRepoPackageJson.js +0 -32
- package/lib/methods/getRepoPackageJsonPath.cjs +0 -34
- package/lib/methods/getRepoPackageJsonPath.d.cts +0 -6
- package/lib/methods/getRepoPackageJsonPath.d.ts +0 -6
- package/lib/methods/getRepoPackageJsonPath.js +0 -26
- package/lib/repo/Workspace.cjs +0 -7370
- package/lib/repo/Workspace.d.cts +0 -10
- package/lib/repo/Workspace.d.ts +0 -10
- package/lib/repo/Workspace.js +0 -7361
- package/lib/util/SemanticExtnamePrefix.cjs +0 -13
- package/lib/util/SemanticExtnamePrefix.d.cts +0 -14
- package/lib/util/SemanticExtnamePrefix.d.ts +0 -14
- package/lib/util/SemanticExtnamePrefix.js +0 -11
- package/lib/util/SemanticExtnamePrefixDescriptions.cjs +0 -13
- package/lib/util/SemanticExtnamePrefixDescriptions.d.cts +0 -15
- package/lib/util/SemanticExtnamePrefixDescriptions.d.ts +0 -15
- package/lib/util/SemanticExtnamePrefixDescriptions.js +0 -11
- package/lib/util/SemanticExtnamePrefixes.cjs +0 -18
- package/lib/util/SemanticExtnamePrefixes.d.cts +0 -97
- package/lib/util/SemanticExtnamePrefixes.d.ts +0 -97
- package/lib/util/SemanticExtnamePrefixes.js +0 -14
- package/lib/util/getRepoRootDirpath.cjs +0 -30
- package/lib/util/getRepoRootDirpath.d.cts +0 -6
- package/lib/util/getRepoRootDirpath.d.ts +0 -6
- package/lib/util/getRepoRootDirpath.js +0 -22
- package/lib/util/getWorkspaceDirpaths.cjs +0 -42
- package/lib/util/getWorkspaceDirpaths.d.cts +0 -6
- package/lib/util/getWorkspaceDirpaths.d.ts +0 -6
- package/lib/util/getWorkspaceDirpaths.js +0 -34
- package/lib/util/hasExtnamePrefix.cjs +0 -27
- package/lib/util/hasExtnamePrefix.d.cts +0 -38
- package/lib/util/hasExtnamePrefix.d.ts +0 -38
- package/lib/util/hasExtnamePrefix.js +0 -25
- package/lib/util/resolveModuleImportPath.cjs +0 -51
- package/lib/util/resolveModuleImportPath.d.cts +0 -8
- package/lib/util/resolveModuleImportPath.d.ts +0 -8
- package/lib/util/resolveModuleImportPath.js +0 -42
- package/lib/util/semverVersionBump.cjs +0 -30
- package/lib/util/semverVersionBump.d.cts +0 -22
- package/lib/util/semverVersionBump.d.ts +0 -22
- package/lib/util/semverVersionBump.js +0 -28
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// src/util/SemanticExtnamePrefix.ts
|
|
4
|
-
var SemanticExtnamePrefix = {
|
|
5
|
-
d: "d",
|
|
6
|
-
test: "test",
|
|
7
|
-
examples: "examples",
|
|
8
|
-
benchmark: "benchmark",
|
|
9
|
-
temp: "temp",
|
|
10
|
-
wip: "wip"
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
exports.SemanticExtnamePrefix = SemanticExtnamePrefix;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Constants for semantic filename prefixes used to categorize files by their purpose.
|
|
3
|
-
*/
|
|
4
|
-
type SemanticExtnamePrefix = (typeof SemanticExtnamePrefix)[keyof typeof SemanticExtnamePrefix];
|
|
5
|
-
declare const SemanticExtnamePrefix: {
|
|
6
|
-
readonly d: "d";
|
|
7
|
-
readonly test: "test";
|
|
8
|
-
readonly examples: "examples";
|
|
9
|
-
readonly benchmark: "benchmark";
|
|
10
|
-
readonly temp: "temp";
|
|
11
|
-
readonly wip: "wip";
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { SemanticExtnamePrefix };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Constants for semantic filename prefixes used to categorize files by their purpose.
|
|
3
|
-
*/
|
|
4
|
-
type SemanticExtnamePrefix = (typeof SemanticExtnamePrefix)[keyof typeof SemanticExtnamePrefix];
|
|
5
|
-
declare const SemanticExtnamePrefix: {
|
|
6
|
-
readonly d: "d";
|
|
7
|
-
readonly test: "test";
|
|
8
|
-
readonly examples: "examples";
|
|
9
|
-
readonly benchmark: "benchmark";
|
|
10
|
-
readonly temp: "temp";
|
|
11
|
-
readonly wip: "wip";
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { SemanticExtnamePrefix };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// src/util/SemanticExtnamePrefixDescriptions.ts
|
|
4
|
-
var SemanticExtnamePrefixDescriptions = {
|
|
5
|
-
d: "declarations",
|
|
6
|
-
test: "vitest test suite",
|
|
7
|
-
examples: "contains working and tested example usage code. Included in git, but ignored by most repo tools",
|
|
8
|
-
benchmark: "benchmark files, included in git, but ignored by most repo tools.",
|
|
9
|
-
temp: "temporary files, ignored by git, build, tests, etc.",
|
|
10
|
-
wip: "work in progress, ignored by git, build, tests, etc."
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
exports.SemanticExtnamePrefixDescriptions = SemanticExtnamePrefixDescriptions;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SemanticExtnamePrefix } from './SemanticExtnamePrefix.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A record mapping semantic extname prefixes to their descriptions.
|
|
5
|
-
*
|
|
6
|
-
* - `d`: Declaration files
|
|
7
|
-
* - `test`: Vitest test suite files
|
|
8
|
-
* - `examples`: Files containing working and tested example usage code (included in git, but ignored by most repo tools)
|
|
9
|
-
* - `benchmark`: Benchmark files (included in git, but ignored by most repo tools)
|
|
10
|
-
* - `temp`: Temporary files (ignored by git, build, tests, etc.)
|
|
11
|
-
* - `wip`: Work in progress files (ignored by git, build, tests, etc.)
|
|
12
|
-
*/
|
|
13
|
-
declare const SemanticExtnamePrefixDescriptions: Record<SemanticExtnamePrefix, string>;
|
|
14
|
-
|
|
15
|
-
export { SemanticExtnamePrefixDescriptions };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SemanticExtnamePrefix } from './SemanticExtnamePrefix.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A record mapping semantic extname prefixes to their descriptions.
|
|
5
|
-
*
|
|
6
|
-
* - `d`: Declaration files
|
|
7
|
-
* - `test`: Vitest test suite files
|
|
8
|
-
* - `examples`: Files containing working and tested example usage code (included in git, but ignored by most repo tools)
|
|
9
|
-
* - `benchmark`: Benchmark files (included in git, but ignored by most repo tools)
|
|
10
|
-
* - `temp`: Temporary files (ignored by git, build, tests, etc.)
|
|
11
|
-
* - `wip`: Work in progress files (ignored by git, build, tests, etc.)
|
|
12
|
-
*/
|
|
13
|
-
declare const SemanticExtnamePrefixDescriptions: Record<SemanticExtnamePrefix, string>;
|
|
14
|
-
|
|
15
|
-
export { SemanticExtnamePrefixDescriptions };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// src/util/SemanticExtnamePrefixDescriptions.ts
|
|
2
|
-
var SemanticExtnamePrefixDescriptions = {
|
|
3
|
-
d: "declarations",
|
|
4
|
-
test: "vitest test suite",
|
|
5
|
-
examples: "contains working and tested example usage code. Included in git, but ignored by most repo tools",
|
|
6
|
-
benchmark: "benchmark files, included in git, but ignored by most repo tools.",
|
|
7
|
-
temp: "temporary files, ignored by git, build, tests, etc.",
|
|
8
|
-
wip: "work in progress, ignored by git, build, tests, etc."
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export { SemanticExtnamePrefixDescriptions };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// src/util/SemanticExtnamePrefix.ts
|
|
4
|
-
var SemanticExtnamePrefix = {
|
|
5
|
-
d: "d",
|
|
6
|
-
test: "test",
|
|
7
|
-
examples: "examples",
|
|
8
|
-
benchmark: "benchmark",
|
|
9
|
-
temp: "temp",
|
|
10
|
-
wip: "wip"
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
// src/util/SemanticExtnamePrefixes.ts
|
|
14
|
-
var SemanticExtnamePrefixes_default = Object.values(SemanticExtnamePrefix);
|
|
15
|
-
|
|
16
|
-
module.exports = SemanticExtnamePrefixes_default;
|
|
17
|
-
|
|
18
|
-
module.exports = exports.default;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { SemanticExtnamePrefix } from './SemanticExtnamePrefix.cjs';
|
|
2
|
-
import { I as IsNever } from '../is-never.d-CgQ1j0-8.cjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
Convert a union type to an intersection type using [distributive conditional types](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
|
|
6
|
-
|
|
7
|
-
Inspired by [this Stack Overflow answer](https://stackoverflow.com/a/50375286/2172153).
|
|
8
|
-
|
|
9
|
-
@example
|
|
10
|
-
```
|
|
11
|
-
import type {UnionToIntersection} from 'type-fest';
|
|
12
|
-
|
|
13
|
-
type Union = {the(): void} | {great(arg: string): void} | {escape: boolean};
|
|
14
|
-
|
|
15
|
-
type Intersection = UnionToIntersection<Union>;
|
|
16
|
-
//=> {the(): void} & {great(arg: string): void} & {escape: boolean}
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
@category Type
|
|
20
|
-
*/
|
|
21
|
-
type UnionToIntersection<Union> = (
|
|
22
|
-
// `extends unknown` is always going to be the case and is used to convert the
|
|
23
|
-
// `Union` into a [distributive conditional
|
|
24
|
-
// type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
|
|
25
|
-
Union extends unknown
|
|
26
|
-
// The union type is used as the only argument to a function since the union
|
|
27
|
-
// of function arguments is an intersection.
|
|
28
|
-
? (distributedUnion: Union) => void
|
|
29
|
-
// This won't happen.
|
|
30
|
-
: never
|
|
31
|
-
// Infer the `Intersection` type since TypeScript represents the positional
|
|
32
|
-
// arguments of unions of functions as an intersection of the union.
|
|
33
|
-
) extends ((mergedIntersection: infer Intersection) => void)
|
|
34
|
-
// The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`
|
|
35
|
-
? Intersection & Union
|
|
36
|
-
: never;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
Returns the last element of a union type.
|
|
40
|
-
|
|
41
|
-
@example
|
|
42
|
-
```
|
|
43
|
-
type Last = LastOfUnion<1 | 2 | 3>;
|
|
44
|
-
//=> 3
|
|
45
|
-
```
|
|
46
|
-
*/
|
|
47
|
-
type LastOfUnion<T> =
|
|
48
|
-
UnionToIntersection<T extends any ? () => T : never> extends () => (infer R)
|
|
49
|
-
? R
|
|
50
|
-
: never;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
Convert a union type into an unordered tuple type of its elements.
|
|
54
|
-
|
|
55
|
-
"Unordered" means the elements of the tuple are not guaranteed to be in the same order as in the union type. The arrangement can appear random and may change at any time.
|
|
56
|
-
|
|
57
|
-
This can be useful when you have objects with a finite set of keys and want a type defining only the allowed keys, but do not want to repeat yourself.
|
|
58
|
-
|
|
59
|
-
@example
|
|
60
|
-
```
|
|
61
|
-
import type {UnionToTuple} from 'type-fest';
|
|
62
|
-
|
|
63
|
-
type Numbers = 1 | 2 | 3;
|
|
64
|
-
type NumbersTuple = UnionToTuple<Numbers>;
|
|
65
|
-
//=> [1, 2, 3]
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
@example
|
|
69
|
-
```
|
|
70
|
-
import type {UnionToTuple} from 'type-fest';
|
|
71
|
-
|
|
72
|
-
const pets = {
|
|
73
|
-
dog: '🐶',
|
|
74
|
-
cat: '🐱',
|
|
75
|
-
snake: '🐍',
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
type Pet = keyof typeof pets;
|
|
79
|
-
//=> 'dog' | 'cat' | 'snake'
|
|
80
|
-
|
|
81
|
-
const petList = Object.keys(pets) as UnionToTuple<Pet>;
|
|
82
|
-
//=> ['dog', 'cat', 'snake']
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
@category Array
|
|
86
|
-
*/
|
|
87
|
-
type UnionToTuple<T, L = LastOfUnion<T>> =
|
|
88
|
-
IsNever<T> extends false
|
|
89
|
-
? [...UnionToTuple<Exclude<T, L>>, L]
|
|
90
|
-
: [];
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Array of all semantic extension prefixes used to categorize files by their purpose.
|
|
94
|
-
*/
|
|
95
|
-
declare const _default: UnionToTuple<SemanticExtnamePrefix>;
|
|
96
|
-
|
|
97
|
-
export = _default;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { SemanticExtnamePrefix } from './SemanticExtnamePrefix.js';
|
|
2
|
-
import { I as IsNever } from '../is-never.d-CgQ1j0-8.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
Convert a union type to an intersection type using [distributive conditional types](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
|
|
6
|
-
|
|
7
|
-
Inspired by [this Stack Overflow answer](https://stackoverflow.com/a/50375286/2172153).
|
|
8
|
-
|
|
9
|
-
@example
|
|
10
|
-
```
|
|
11
|
-
import type {UnionToIntersection} from 'type-fest';
|
|
12
|
-
|
|
13
|
-
type Union = {the(): void} | {great(arg: string): void} | {escape: boolean};
|
|
14
|
-
|
|
15
|
-
type Intersection = UnionToIntersection<Union>;
|
|
16
|
-
//=> {the(): void} & {great(arg: string): void} & {escape: boolean}
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
@category Type
|
|
20
|
-
*/
|
|
21
|
-
type UnionToIntersection<Union> = (
|
|
22
|
-
// `extends unknown` is always going to be the case and is used to convert the
|
|
23
|
-
// `Union` into a [distributive conditional
|
|
24
|
-
// type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
|
|
25
|
-
Union extends unknown
|
|
26
|
-
// The union type is used as the only argument to a function since the union
|
|
27
|
-
// of function arguments is an intersection.
|
|
28
|
-
? (distributedUnion: Union) => void
|
|
29
|
-
// This won't happen.
|
|
30
|
-
: never
|
|
31
|
-
// Infer the `Intersection` type since TypeScript represents the positional
|
|
32
|
-
// arguments of unions of functions as an intersection of the union.
|
|
33
|
-
) extends ((mergedIntersection: infer Intersection) => void)
|
|
34
|
-
// The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`
|
|
35
|
-
? Intersection & Union
|
|
36
|
-
: never;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
Returns the last element of a union type.
|
|
40
|
-
|
|
41
|
-
@example
|
|
42
|
-
```
|
|
43
|
-
type Last = LastOfUnion<1 | 2 | 3>;
|
|
44
|
-
//=> 3
|
|
45
|
-
```
|
|
46
|
-
*/
|
|
47
|
-
type LastOfUnion<T> =
|
|
48
|
-
UnionToIntersection<T extends any ? () => T : never> extends () => (infer R)
|
|
49
|
-
? R
|
|
50
|
-
: never;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
Convert a union type into an unordered tuple type of its elements.
|
|
54
|
-
|
|
55
|
-
"Unordered" means the elements of the tuple are not guaranteed to be in the same order as in the union type. The arrangement can appear random and may change at any time.
|
|
56
|
-
|
|
57
|
-
This can be useful when you have objects with a finite set of keys and want a type defining only the allowed keys, but do not want to repeat yourself.
|
|
58
|
-
|
|
59
|
-
@example
|
|
60
|
-
```
|
|
61
|
-
import type {UnionToTuple} from 'type-fest';
|
|
62
|
-
|
|
63
|
-
type Numbers = 1 | 2 | 3;
|
|
64
|
-
type NumbersTuple = UnionToTuple<Numbers>;
|
|
65
|
-
//=> [1, 2, 3]
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
@example
|
|
69
|
-
```
|
|
70
|
-
import type {UnionToTuple} from 'type-fest';
|
|
71
|
-
|
|
72
|
-
const pets = {
|
|
73
|
-
dog: '🐶',
|
|
74
|
-
cat: '🐱',
|
|
75
|
-
snake: '🐍',
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
type Pet = keyof typeof pets;
|
|
79
|
-
//=> 'dog' | 'cat' | 'snake'
|
|
80
|
-
|
|
81
|
-
const petList = Object.keys(pets) as UnionToTuple<Pet>;
|
|
82
|
-
//=> ['dog', 'cat', 'snake']
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
@category Array
|
|
86
|
-
*/
|
|
87
|
-
type UnionToTuple<T, L = LastOfUnion<T>> =
|
|
88
|
-
IsNever<T> extends false
|
|
89
|
-
? [...UnionToTuple<Exclude<T, L>>, L]
|
|
90
|
-
: [];
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Array of all semantic extension prefixes used to categorize files by their purpose.
|
|
94
|
-
*/
|
|
95
|
-
declare const _default: UnionToTuple<SemanticExtnamePrefix>;
|
|
96
|
-
|
|
97
|
-
export { _default as default };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// src/util/SemanticExtnamePrefix.ts
|
|
2
|
-
var SemanticExtnamePrefix = {
|
|
3
|
-
d: "d",
|
|
4
|
-
test: "test",
|
|
5
|
-
examples: "examples",
|
|
6
|
-
benchmark: "benchmark",
|
|
7
|
-
temp: "temp",
|
|
8
|
-
wip: "wip"
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// src/util/SemanticExtnamePrefixes.ts
|
|
12
|
-
var SemanticExtnamePrefixes_default = Object.values(SemanticExtnamePrefix);
|
|
13
|
-
|
|
14
|
-
export { SemanticExtnamePrefixes_default as default };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fs = require('fs-extra');
|
|
4
|
-
var onetime = require('onetime');
|
|
5
|
-
var path = require('upath');
|
|
6
|
-
|
|
7
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
-
|
|
9
|
-
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
10
|
-
var onetime__default = /*#__PURE__*/_interopDefault(onetime);
|
|
11
|
-
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
12
|
-
|
|
13
|
-
var __defProp = Object.defineProperty;
|
|
14
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
15
|
-
var getRepoRootDirpath = onetime__default.default(/* @__PURE__ */ __name(function getRepoRootDirpath2() {
|
|
16
|
-
return (/* @__PURE__ */ __name(function recurse(dirpath = process.cwd()) {
|
|
17
|
-
dirpath = path__default.default.normalizeSafe(dirpath);
|
|
18
|
-
const pkgpath = path__default.default.joinSafe(dirpath, "package.json");
|
|
19
|
-
if (fs__default.default.existsSync(pkgpath) && fs__default.default.readJsonSync(pkgpath)?.workspaces) {
|
|
20
|
-
return dirpath;
|
|
21
|
-
}
|
|
22
|
-
const parent = path__default.default.dirname(dirpath);
|
|
23
|
-
if (parent !== dirpath) {
|
|
24
|
-
return recurse(parent);
|
|
25
|
-
}
|
|
26
|
-
throw new Error(`Could not find repo root from process.cwd(): ${process.cwd()}`);
|
|
27
|
-
}, "recurse"))();
|
|
28
|
-
}, "getRepoRootDirpath"));
|
|
29
|
-
|
|
30
|
-
exports.getRepoRootDirpath = getRepoRootDirpath;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import onetime from 'onetime';
|
|
3
|
-
import path from 'upath';
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
var getRepoRootDirpath = onetime(/* @__PURE__ */ __name(function getRepoRootDirpath2() {
|
|
8
|
-
return (/* @__PURE__ */ __name(function recurse(dirpath = process.cwd()) {
|
|
9
|
-
dirpath = path.normalizeSafe(dirpath);
|
|
10
|
-
const pkgpath = path.joinSafe(dirpath, "package.json");
|
|
11
|
-
if (fs.existsSync(pkgpath) && fs.readJsonSync(pkgpath)?.workspaces) {
|
|
12
|
-
return dirpath;
|
|
13
|
-
}
|
|
14
|
-
const parent = path.dirname(dirpath);
|
|
15
|
-
if (parent !== dirpath) {
|
|
16
|
-
return recurse(parent);
|
|
17
|
-
}
|
|
18
|
-
throw new Error(`Could not find repo root from process.cwd(): ${process.cwd()}`);
|
|
19
|
-
}, "recurse"))();
|
|
20
|
-
}, "getRepoRootDirpath"));
|
|
21
|
-
|
|
22
|
-
export { getRepoRootDirpath };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fs = require('fs-extra');
|
|
4
|
-
var onetime = require('onetime');
|
|
5
|
-
var path = require('upath');
|
|
6
|
-
var glob = require('glob');
|
|
7
|
-
|
|
8
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
|
|
10
|
-
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
11
|
-
var onetime__default = /*#__PURE__*/_interopDefault(onetime);
|
|
12
|
-
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
13
|
-
|
|
14
|
-
var __defProp = Object.defineProperty;
|
|
15
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
16
|
-
var getRepoRootDirpath = onetime__default.default(/* @__PURE__ */ __name(function getRepoRootDirpath2() {
|
|
17
|
-
return (/* @__PURE__ */ __name(function recurse(dirpath = process.cwd()) {
|
|
18
|
-
dirpath = path__default.default.normalizeSafe(dirpath);
|
|
19
|
-
const pkgpath = path__default.default.joinSafe(dirpath, "package.json");
|
|
20
|
-
if (fs__default.default.existsSync(pkgpath) && fs__default.default.readJsonSync(pkgpath)?.workspaces) {
|
|
21
|
-
return dirpath;
|
|
22
|
-
}
|
|
23
|
-
const parent = path__default.default.dirname(dirpath);
|
|
24
|
-
if (parent !== dirpath) {
|
|
25
|
-
return recurse(parent);
|
|
26
|
-
}
|
|
27
|
-
throw new Error(`Could not find repo root from process.cwd(): ${process.cwd()}`);
|
|
28
|
-
}, "recurse"))();
|
|
29
|
-
}, "getRepoRootDirpath"));
|
|
30
|
-
function getWorkspaceDirpaths() {
|
|
31
|
-
const rootDirpath = getRepoRootDirpath();
|
|
32
|
-
const pkg = fs__default.default.readJsonSync(path__default.default.joinSafe(rootDirpath, "package.json"));
|
|
33
|
-
if (!pkg.workspaces) {
|
|
34
|
-
throw new Error(`No workspaces found in package.json at ${rootDirpath}`);
|
|
35
|
-
}
|
|
36
|
-
return pkg.workspaces.flatMap((workspace) => {
|
|
37
|
-
return glob.globSync(workspace);
|
|
38
|
-
}).map(path__default.default.normalizeSafe);
|
|
39
|
-
}
|
|
40
|
-
__name(getWorkspaceDirpaths, "getWorkspaceDirpaths");
|
|
41
|
-
|
|
42
|
-
exports.getWorkspaceDirpaths = getWorkspaceDirpaths;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import onetime from 'onetime';
|
|
3
|
-
import path from 'upath';
|
|
4
|
-
import { globSync } from 'glob';
|
|
5
|
-
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
-
var getRepoRootDirpath = onetime(/* @__PURE__ */ __name(function getRepoRootDirpath2() {
|
|
9
|
-
return (/* @__PURE__ */ __name(function recurse(dirpath = process.cwd()) {
|
|
10
|
-
dirpath = path.normalizeSafe(dirpath);
|
|
11
|
-
const pkgpath = path.joinSafe(dirpath, "package.json");
|
|
12
|
-
if (fs.existsSync(pkgpath) && fs.readJsonSync(pkgpath)?.workspaces) {
|
|
13
|
-
return dirpath;
|
|
14
|
-
}
|
|
15
|
-
const parent = path.dirname(dirpath);
|
|
16
|
-
if (parent !== dirpath) {
|
|
17
|
-
return recurse(parent);
|
|
18
|
-
}
|
|
19
|
-
throw new Error(`Could not find repo root from process.cwd(): ${process.cwd()}`);
|
|
20
|
-
}, "recurse"))();
|
|
21
|
-
}, "getRepoRootDirpath"));
|
|
22
|
-
function getWorkspaceDirpaths() {
|
|
23
|
-
const rootDirpath = getRepoRootDirpath();
|
|
24
|
-
const pkg = fs.readJsonSync(path.joinSafe(rootDirpath, "package.json"));
|
|
25
|
-
if (!pkg.workspaces) {
|
|
26
|
-
throw new Error(`No workspaces found in package.json at ${rootDirpath}`);
|
|
27
|
-
}
|
|
28
|
-
return pkg.workspaces.flatMap((workspace) => {
|
|
29
|
-
return globSync(workspace);
|
|
30
|
-
}).map(path.normalizeSafe);
|
|
31
|
-
}
|
|
32
|
-
__name(getWorkspaceDirpaths, "getWorkspaceDirpaths");
|
|
33
|
-
|
|
34
|
-
export { getWorkspaceDirpaths };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
|
|
6
|
-
// src/util/SemanticExtnamePrefix.ts
|
|
7
|
-
var SemanticExtnamePrefix = {
|
|
8
|
-
d: "d",
|
|
9
|
-
test: "test",
|
|
10
|
-
examples: "examples",
|
|
11
|
-
benchmark: "benchmark",
|
|
12
|
-
temp: "temp",
|
|
13
|
-
wip: "wip"
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// src/util/SemanticExtnamePrefixes.ts
|
|
17
|
-
var SemanticExtnamePrefixes_default = Object.values(SemanticExtnamePrefix);
|
|
18
|
-
|
|
19
|
-
// src/util/hasExtnamePrefix.ts
|
|
20
|
-
function hasExtnamePrefix(tsFilepath, prefixes = SemanticExtnamePrefixes_default) {
|
|
21
|
-
return new RegExp(`[.](${[
|
|
22
|
-
prefixes
|
|
23
|
-
].flat(2).join("|")})[.][^/\\\\]+$`).test(tsFilepath);
|
|
24
|
-
}
|
|
25
|
-
__name(hasExtnamePrefix, "hasExtnamePrefix");
|
|
26
|
-
|
|
27
|
-
exports.hasExtnamePrefix = hasExtnamePrefix;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { SemanticExtnamePrefix } from './SemanticExtnamePrefix.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
Create a type that represents either the value or an array of the value.
|
|
5
|
-
|
|
6
|
-
@see {@link Promisable}
|
|
7
|
-
|
|
8
|
-
@example
|
|
9
|
-
```
|
|
10
|
-
import type {Arrayable} from 'type-fest';
|
|
11
|
-
|
|
12
|
-
function bundle(input: string, output: Arrayable<string>) {
|
|
13
|
-
const outputList = Array.isArray(output) ? output : [output];
|
|
14
|
-
|
|
15
|
-
// …
|
|
16
|
-
|
|
17
|
-
for (const output of outputList) {
|
|
18
|
-
console.log(`write ${input} to: ${output}`);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
bundle('src/index.js', 'dist/index.js');
|
|
23
|
-
bundle('src/index.js', ['dist/index.cjs', 'dist/index.mjs']);
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
@category Array
|
|
27
|
-
*/
|
|
28
|
-
type Arrayable<T> =
|
|
29
|
-
T
|
|
30
|
-
// TODO: Use `readonly T[]` when this issue is resolved: https://github.com/microsoft/TypeScript/issues/17002
|
|
31
|
-
| T[];
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Checks if a file path has any of the specified semantic extension prefixes (e.g., .test.ts).
|
|
35
|
-
*/
|
|
36
|
-
declare function hasExtnamePrefix(tsFilepath: string, prefixes?: Arrayable<SemanticExtnamePrefix>): boolean;
|
|
37
|
-
|
|
38
|
-
export { hasExtnamePrefix };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { SemanticExtnamePrefix } from './SemanticExtnamePrefix.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
Create a type that represents either the value or an array of the value.
|
|
5
|
-
|
|
6
|
-
@see {@link Promisable}
|
|
7
|
-
|
|
8
|
-
@example
|
|
9
|
-
```
|
|
10
|
-
import type {Arrayable} from 'type-fest';
|
|
11
|
-
|
|
12
|
-
function bundle(input: string, output: Arrayable<string>) {
|
|
13
|
-
const outputList = Array.isArray(output) ? output : [output];
|
|
14
|
-
|
|
15
|
-
// …
|
|
16
|
-
|
|
17
|
-
for (const output of outputList) {
|
|
18
|
-
console.log(`write ${input} to: ${output}`);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
bundle('src/index.js', 'dist/index.js');
|
|
23
|
-
bundle('src/index.js', ['dist/index.cjs', 'dist/index.mjs']);
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
@category Array
|
|
27
|
-
*/
|
|
28
|
-
type Arrayable<T> =
|
|
29
|
-
T
|
|
30
|
-
// TODO: Use `readonly T[]` when this issue is resolved: https://github.com/microsoft/TypeScript/issues/17002
|
|
31
|
-
| T[];
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Checks if a file path has any of the specified semantic extension prefixes (e.g., .test.ts).
|
|
35
|
-
*/
|
|
36
|
-
declare function hasExtnamePrefix(tsFilepath: string, prefixes?: Arrayable<SemanticExtnamePrefix>): boolean;
|
|
37
|
-
|
|
38
|
-
export { hasExtnamePrefix };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// src/util/SemanticExtnamePrefix.ts
|
|
5
|
-
var SemanticExtnamePrefix = {
|
|
6
|
-
d: "d",
|
|
7
|
-
test: "test",
|
|
8
|
-
examples: "examples",
|
|
9
|
-
benchmark: "benchmark",
|
|
10
|
-
temp: "temp",
|
|
11
|
-
wip: "wip"
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// src/util/SemanticExtnamePrefixes.ts
|
|
15
|
-
var SemanticExtnamePrefixes_default = Object.values(SemanticExtnamePrefix);
|
|
16
|
-
|
|
17
|
-
// src/util/hasExtnamePrefix.ts
|
|
18
|
-
function hasExtnamePrefix(tsFilepath, prefixes = SemanticExtnamePrefixes_default) {
|
|
19
|
-
return new RegExp(`[.](${[
|
|
20
|
-
prefixes
|
|
21
|
-
].flat(2).join("|")})[.][^/\\\\]+$`).test(tsFilepath);
|
|
22
|
-
}
|
|
23
|
-
__name(hasExtnamePrefix, "hasExtnamePrefix");
|
|
24
|
-
|
|
25
|
-
export { hasExtnamePrefix };
|