@bemoje/monorepo 1.2.0 → 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.
Files changed (125) hide show
  1. package/lib/index.cjs +2496 -213
  2. package/lib/index.d.cts +2765 -26
  3. package/lib/index.d.ts +2765 -26
  4. package/lib/index.js +2469 -30
  5. package/package.json +178 -297
  6. package/lib/MonoRepo.cjs +0 -142
  7. package/lib/MonoRepo.d.cts +0 -10
  8. package/lib/MonoRepo.d.ts +0 -10
  9. package/lib/MonoRepo.js +0 -134
  10. package/lib/code/AbstractCode.cjs +0 -77
  11. package/lib/code/AbstractCode.d.cts +0 -30
  12. package/lib/code/AbstractCode.d.ts +0 -30
  13. package/lib/code/AbstractCode.js +0 -74
  14. package/lib/code/CodeBlock.cjs +0 -51
  15. package/lib/code/CodeBlock.d.cts +0 -22
  16. package/lib/code/CodeBlock.d.ts +0 -22
  17. package/lib/code/CodeBlock.js +0 -48
  18. package/lib/code/TsCode.cjs +0 -90
  19. package/lib/code/TsCode.d.cts +0 -10
  20. package/lib/code/TsCode.d.ts +0 -10
  21. package/lib/code/TsCode.js +0 -87
  22. package/lib/code/imports/ImportKeywords.cjs +0 -42
  23. package/lib/code/imports/ImportKeywords.d.cts +0 -10
  24. package/lib/code/imports/ImportKeywords.d.ts +0 -10
  25. package/lib/code/imports/ImportKeywords.js +0 -39
  26. package/lib/code/imports/ImportSpecifiers.cjs +0 -98
  27. package/lib/code/imports/ImportSpecifiers.d.cts +0 -10
  28. package/lib/code/imports/ImportSpecifiers.d.ts +0 -10
  29. package/lib/code/imports/ImportSpecifiers.js +0 -95
  30. package/lib/code/imports/ImportStatement.cjs +0 -89
  31. package/lib/code/imports/ImportStatement.d.cts +0 -10
  32. package/lib/code/imports/ImportStatement.d.ts +0 -10
  33. package/lib/code/imports/ImportStatement.js +0 -86
  34. package/lib/code/imports/ModuleSpecifier.cjs +0 -77
  35. package/lib/code/imports/ModuleSpecifier.d.cts +0 -10
  36. package/lib/code/imports/ModuleSpecifier.d.ts +0 -10
  37. package/lib/code/imports/ModuleSpecifier.js +0 -74
  38. package/lib/common/AbstractBase.cjs +0 -77
  39. package/lib/common/AbstractBase.d.cts +0 -3
  40. package/lib/common/AbstractBase.d.ts +0 -3
  41. package/lib/common/AbstractBase.js +0 -74
  42. package/lib/file/File.cjs +0 -118
  43. package/lib/file/File.d.cts +0 -10
  44. package/lib/file/File.d.ts +0 -10
  45. package/lib/file/File.js +0 -91
  46. package/lib/file/TestFile.cjs +0 -42
  47. package/lib/file/TestFile.d.cts +0 -10
  48. package/lib/file/TestFile.d.ts +0 -10
  49. package/lib/file/TestFile.js +0 -39
  50. package/lib/file/TsFile.cjs +0 -46
  51. package/lib/file/TsFile.d.cts +0 -10
  52. package/lib/file/TsFile.d.ts +0 -10
  53. package/lib/file/TsFile.js +0 -43
  54. package/lib/methods/findWorkspacePackageName.cjs +0 -17
  55. package/lib/methods/findWorkspacePackageName.d.cts +0 -6
  56. package/lib/methods/findWorkspacePackageName.d.ts +0 -6
  57. package/lib/methods/findWorkspacePackageName.js +0 -14
  58. package/lib/methods/getAllImports.cjs +0 -18
  59. package/lib/methods/getAllImports.d.cts +0 -17
  60. package/lib/methods/getAllImports.d.ts +0 -17
  61. package/lib/methods/getAllImports.js +0 -16
  62. package/lib/methods/getAllWorkspacePackageJsonPaths.cjs +0 -20
  63. package/lib/methods/getAllWorkspacePackageJsonPaths.d.cts +0 -6
  64. package/lib/methods/getAllWorkspacePackageJsonPaths.d.ts +0 -6
  65. package/lib/methods/getAllWorkspacePackageJsonPaths.js +0 -13
  66. package/lib/methods/getAllWorkspacePackageJsons.cjs +0 -20
  67. package/lib/methods/getAllWorkspacePackageJsons.d.cts +0 -6
  68. package/lib/methods/getAllWorkspacePackageJsons.d.ts +0 -6
  69. package/lib/methods/getAllWorkspacePackageJsons.js +0 -13
  70. package/lib/methods/getAllWorkspacePackageNames.cjs +0 -15
  71. package/lib/methods/getAllWorkspacePackageNames.d.cts +0 -6
  72. package/lib/methods/getAllWorkspacePackageNames.d.ts +0 -6
  73. package/lib/methods/getAllWorkspacePackageNames.js +0 -12
  74. package/lib/methods/getAllWorkspacePaths.cjs +0 -23
  75. package/lib/methods/getAllWorkspacePaths.d.cts +0 -6
  76. package/lib/methods/getAllWorkspacePaths.d.ts +0 -6
  77. package/lib/methods/getAllWorkspacePaths.js +0 -16
  78. package/lib/methods/getImportsRecursively.cjs +0 -176
  79. package/lib/methods/getImportsRecursively.d.cts +0 -37
  80. package/lib/methods/getImportsRecursively.d.ts +0 -37
  81. package/lib/methods/getImportsRecursively.js +0 -168
  82. package/lib/methods/getRepoPackageJson.cjs +0 -17
  83. package/lib/methods/getRepoPackageJson.d.cts +0 -6
  84. package/lib/methods/getRepoPackageJson.d.ts +0 -6
  85. package/lib/methods/getRepoPackageJson.js +0 -10
  86. package/lib/methods/getRepoPackageJsonPath.cjs +0 -17
  87. package/lib/methods/getRepoPackageJsonPath.d.cts +0 -6
  88. package/lib/methods/getRepoPackageJsonPath.d.ts +0 -6
  89. package/lib/methods/getRepoPackageJsonPath.js +0 -10
  90. package/lib/repo/Workspace.cjs +0 -383
  91. package/lib/repo/Workspace.d.cts +0 -10
  92. package/lib/repo/Workspace.d.ts +0 -10
  93. package/lib/repo/Workspace.js +0 -376
  94. package/lib/util/SemanticExtnamePrefix.cjs +0 -12
  95. package/lib/util/SemanticExtnamePrefix.d.cts +0 -14
  96. package/lib/util/SemanticExtnamePrefix.d.ts +0 -14
  97. package/lib/util/SemanticExtnamePrefix.js +0 -12
  98. package/lib/util/SemanticExtnamePrefixDescriptions.cjs +0 -12
  99. package/lib/util/SemanticExtnamePrefixDescriptions.d.cts +0 -15
  100. package/lib/util/SemanticExtnamePrefixDescriptions.d.ts +0 -15
  101. package/lib/util/SemanticExtnamePrefixDescriptions.js +0 -12
  102. package/lib/util/SemanticExtnamePrefixes.cjs +0 -9
  103. package/lib/util/SemanticExtnamePrefixes.d.cts +0 -97
  104. package/lib/util/SemanticExtnamePrefixes.d.ts +0 -97
  105. package/lib/util/SemanticExtnamePrefixes.js +0 -6
  106. package/lib/util/getRepoRootDirpath.cjs +0 -30
  107. package/lib/util/getRepoRootDirpath.d.cts +0 -6
  108. package/lib/util/getRepoRootDirpath.d.ts +0 -6
  109. package/lib/util/getRepoRootDirpath.js +0 -21
  110. package/lib/util/getWorkspaceDirpaths.cjs +0 -27
  111. package/lib/util/getWorkspaceDirpaths.d.cts +0 -6
  112. package/lib/util/getWorkspaceDirpaths.d.ts +0 -6
  113. package/lib/util/getWorkspaceDirpaths.js +0 -19
  114. package/lib/util/hasExtnamePrefix.cjs +0 -18
  115. package/lib/util/hasExtnamePrefix.d.cts +0 -38
  116. package/lib/util/hasExtnamePrefix.d.ts +0 -38
  117. package/lib/util/hasExtnamePrefix.js +0 -11
  118. package/lib/util/resolveModuleImportPath.cjs +0 -34
  119. package/lib/util/resolveModuleImportPath.d.cts +0 -8
  120. package/lib/util/resolveModuleImportPath.d.ts +0 -8
  121. package/lib/util/resolveModuleImportPath.js +0 -26
  122. package/lib/util/semverVersionBump.cjs +0 -28
  123. package/lib/util/semverVersionBump.d.cts +0 -22
  124. package/lib/util/semverVersionBump.d.ts +0 -22
  125. package/lib/util/semverVersionBump.js +0 -26
@@ -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,6 +0,0 @@
1
- import '../chunk-SHUYVCID.js';
2
- import { SemanticExtnamePrefix } from './SemanticExtnamePrefix';
3
-
4
- var SemanticExtnamePrefixes_default = Object.values(SemanticExtnamePrefix);
5
-
6
- 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
- const 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,6 +0,0 @@
1
- /**
2
- * Get the root directory path of the monorepo by finding the package.json with workspaces configuration.
3
- */
4
- declare const getRepoRootDirpath: () => string;
5
-
6
- export { getRepoRootDirpath };
@@ -1,6 +0,0 @@
1
- /**
2
- * Get the root directory path of the monorepo by finding the package.json with workspaces configuration.
3
- */
4
- declare const getRepoRootDirpath: () => string;
5
-
6
- export { getRepoRootDirpath };
@@ -1,21 +0,0 @@
1
- import { __name } from '../chunk-SHUYVCID.js';
2
- import fs from 'fs-extra';
3
- import onetime from 'onetime';
4
- import path from 'upath';
5
-
6
- const getRepoRootDirpath = onetime(/* @__PURE__ */ __name(function getRepoRootDirpath2() {
7
- return (/* @__PURE__ */ __name(function recurse(dirpath = process.cwd()) {
8
- dirpath = path.normalizeSafe(dirpath);
9
- const pkgpath = path.joinSafe(dirpath, "package.json");
10
- if (fs.existsSync(pkgpath) && fs.readJsonSync(pkgpath)?.workspaces) {
11
- return dirpath;
12
- }
13
- const parent = path.dirname(dirpath);
14
- if (parent !== dirpath) {
15
- return recurse(parent);
16
- }
17
- throw new Error(`Could not find repo root from process.cwd(): ${process.cwd()}`);
18
- }, "recurse"))();
19
- }, "getRepoRootDirpath"));
20
-
21
- export { getRepoRootDirpath };
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- var fs = require('fs-extra');
4
- var getRepoRootDirpath = require('./getRepoRootDirpath');
5
- var glob = require('glob');
6
- var path = require('upath');
7
-
8
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
-
10
- var fs__default = /*#__PURE__*/_interopDefault(fs);
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
- function getWorkspaceDirpaths() {
16
- const rootDirpath = getRepoRootDirpath.getRepoRootDirpath();
17
- const pkg = fs__default.default.readJsonSync(path__default.default.joinSafe(rootDirpath, "package.json"));
18
- if (!pkg.workspaces) {
19
- throw new Error(`No workspaces found in package.json at ${rootDirpath}`);
20
- }
21
- return pkg.workspaces.flatMap((workspace) => {
22
- return glob.globSync(workspace);
23
- }).map(path__default.default.normalizeSafe);
24
- }
25
- __name(getWorkspaceDirpaths, "getWorkspaceDirpaths");
26
-
27
- exports.getWorkspaceDirpaths = getWorkspaceDirpaths;
@@ -1,6 +0,0 @@
1
- /**
2
- * Get all workspace directory paths by reading the workspace patterns from the root package.json.
3
- */
4
- declare function getWorkspaceDirpaths(): string[];
5
-
6
- export { getWorkspaceDirpaths };
@@ -1,6 +0,0 @@
1
- /**
2
- * Get all workspace directory paths by reading the workspace patterns from the root package.json.
3
- */
4
- declare function getWorkspaceDirpaths(): string[];
5
-
6
- export { getWorkspaceDirpaths };
@@ -1,19 +0,0 @@
1
- import { __name } from '../chunk-SHUYVCID.js';
2
- import fs from 'fs-extra';
3
- import { getRepoRootDirpath } from './getRepoRootDirpath';
4
- import { globSync } from 'glob';
5
- import path from 'upath';
6
-
7
- function getWorkspaceDirpaths() {
8
- const rootDirpath = getRepoRootDirpath();
9
- const pkg = fs.readJsonSync(path.joinSafe(rootDirpath, "package.json"));
10
- if (!pkg.workspaces) {
11
- throw new Error(`No workspaces found in package.json at ${rootDirpath}`);
12
- }
13
- return pkg.workspaces.flatMap((workspace) => {
14
- return globSync(workspace);
15
- }).map(path.normalizeSafe);
16
- }
17
- __name(getWorkspaceDirpaths, "getWorkspaceDirpaths");
18
-
19
- export { getWorkspaceDirpaths };
@@ -1,18 +0,0 @@
1
- 'use strict';
2
-
3
- var SemanticExtnamePrefixes = require('./SemanticExtnamePrefixes');
4
-
5
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
-
7
- var SemanticExtnamePrefixes__default = /*#__PURE__*/_interopDefault(SemanticExtnamePrefixes);
8
-
9
- var __defProp = Object.defineProperty;
10
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
11
- function hasExtnamePrefix(tsFilepath, prefixes = SemanticExtnamePrefixes__default.default) {
12
- return new RegExp(`[.](${[
13
- prefixes
14
- ].flat(2).join("|")})[.][^/\\\\]+$`).test(tsFilepath);
15
- }
16
- __name(hasExtnamePrefix, "hasExtnamePrefix");
17
-
18
- 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,11 +0,0 @@
1
- import { __name } from '../chunk-SHUYVCID.js';
2
- import SemanticExtnamePrefixes from './SemanticExtnamePrefixes';
3
-
4
- function hasExtnamePrefix(tsFilepath, prefixes = SemanticExtnamePrefixes) {
5
- return new RegExp(`[.](${[
6
- prefixes
7
- ].flat(2).join("|")})[.][^/\\\\]+$`).test(tsFilepath);
8
- }
9
- __name(hasExtnamePrefix, "hasExtnamePrefix");
10
-
11
- export { hasExtnamePrefix };
@@ -1,34 +0,0 @@
1
- 'use strict';
2
-
3
- var typescript = require('typescript');
4
- var fs = require('fs-extra/esm');
5
- var getRepoRootDirpath = require('./getRepoRootDirpath');
6
- var upath = require('upath');
7
-
8
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
-
10
- var fs__default = /*#__PURE__*/_interopDefault(fs);
11
- var upath__default = /*#__PURE__*/_interopDefault(upath);
12
-
13
- var __defProp = Object.defineProperty;
14
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
15
- function resolveModuleImportPath(filepath, importFrom) {
16
- const rootdir = getRepoRootDirpath.getRepoRootDirpath();
17
- const result = typescript.resolveModuleName(importFrom, filepath, {
18
- paths: fs__default.default.readJsonSync(upath__default.default.joinSafe(rootdir, "tsconfig.paths.json")).compilerOptions.paths,
19
- allowJs: true,
20
- allowArbitraryExtensions: true,
21
- allowImportingTsExtensions: true,
22
- allowSyntheticDefaultImports: true,
23
- esModuleInterop: true,
24
- strict: false
25
- }, typescript.createCompilerHost({}, true));
26
- const f = result.resolvedModule?.resolvedFileName;
27
- if (f) {
28
- result.resolvedModule.resolvedFileName = upath__default.default.relative(rootdir, f);
29
- }
30
- return result.resolvedModule;
31
- }
32
- __name(resolveModuleImportPath, "resolveModuleImportPath");
33
-
34
- exports.resolveModuleImportPath = resolveModuleImportPath;
@@ -1,8 +0,0 @@
1
- import * as typescript from 'typescript';
2
-
3
- /**
4
- * Returns the resolved import path (relative from repo root)
5
- */
6
- declare function resolveModuleImportPath(filepath: string, importFrom: string): typescript.ResolvedModuleFull | undefined;
7
-
8
- export { resolveModuleImportPath };
@@ -1,8 +0,0 @@
1
- import * as typescript from 'typescript';
2
-
3
- /**
4
- * Returns the resolved import path (relative from repo root)
5
- */
6
- declare function resolveModuleImportPath(filepath: string, importFrom: string): typescript.ResolvedModuleFull | undefined;
7
-
8
- export { resolveModuleImportPath };
@@ -1,26 +0,0 @@
1
- import { __name } from '../chunk-SHUYVCID.js';
2
- import { resolveModuleName, createCompilerHost } from 'typescript';
3
- import fs from 'fs-extra/esm';
4
- import { getRepoRootDirpath } from './getRepoRootDirpath';
5
- import upath from 'upath';
6
-
7
- function resolveModuleImportPath(filepath, importFrom) {
8
- const rootdir = getRepoRootDirpath();
9
- const result = resolveModuleName(importFrom, filepath, {
10
- paths: fs.readJsonSync(upath.joinSafe(rootdir, "tsconfig.paths.json")).compilerOptions.paths,
11
- allowJs: true,
12
- allowArbitraryExtensions: true,
13
- allowImportingTsExtensions: true,
14
- allowSyntheticDefaultImports: true,
15
- esModuleInterop: true,
16
- strict: false
17
- }, createCompilerHost({}, true));
18
- const f = result.resolvedModule?.resolvedFileName;
19
- if (f) {
20
- result.resolvedModule.resolvedFileName = upath.relative(rootdir, f);
21
- }
22
- return result.resolvedModule;
23
- }
24
- __name(resolveModuleImportPath, "resolveModuleImportPath");
25
-
26
- export { resolveModuleImportPath };
@@ -1,28 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- function semverVersionBump(version, level) {
6
- const arr = (typeof version === "string" ? version.split(".") : version).map(Number);
7
- switch (level) {
8
- case "major": {
9
- arr[0] += 1;
10
- arr[1] = 0;
11
- arr[2] = 0;
12
- break;
13
- }
14
- case "minor": {
15
- arr[1] += 1;
16
- arr[2] = 0;
17
- break;
18
- }
19
- case "patch": {
20
- arr[2] += 1;
21
- break;
22
- }
23
- }
24
- return arr.join(".");
25
- }
26
- __name(semverVersionBump, "semverVersionBump");
27
-
28
- exports.semverVersionBump = semverVersionBump;
@@ -1,22 +0,0 @@
1
- /**
2
- * Bumps the semantic versioning (SemVer) of a given version string or array based on the specified level.
3
- * The function supports 'major', 'minor', and 'patch' levels.
4
- *
5
- * @remarks
6
- * This function will mutate the original version if it's an array.
7
- *
8
- * @param version - The current version. It can be a string (e.g., '1.0.0') or an array of strings or numbers (e.g., ['1', '0', '0'] or [1, 0, 0]).
9
- * @param level - The level of the version bump. It can be 'major', 'minor', or 'patch'.
10
- *
11
- * @returns The bumped version as a string.
12
- *
13
- * @example
14
- * ```ts
15
- * semverVersionBump('1.0.0', 'major'); // '2.0.0'
16
- * semverVersionBump([1, 0, 4], 'minor'); // '1.1.0'
17
- * semverVersionBump(['1', '0', '0'], 'patch'); // '1.0.1'
18
- * ```
19
- */
20
- declare function semverVersionBump(version: string | string[] | number[], level: 'major' | 'minor' | 'patch'): string;
21
-
22
- export { semverVersionBump };
@@ -1,22 +0,0 @@
1
- /**
2
- * Bumps the semantic versioning (SemVer) of a given version string or array based on the specified level.
3
- * The function supports 'major', 'minor', and 'patch' levels.
4
- *
5
- * @remarks
6
- * This function will mutate the original version if it's an array.
7
- *
8
- * @param version - The current version. It can be a string (e.g., '1.0.0') or an array of strings or numbers (e.g., ['1', '0', '0'] or [1, 0, 0]).
9
- * @param level - The level of the version bump. It can be 'major', 'minor', or 'patch'.
10
- *
11
- * @returns The bumped version as a string.
12
- *
13
- * @example
14
- * ```ts
15
- * semverVersionBump('1.0.0', 'major'); // '2.0.0'
16
- * semverVersionBump([1, 0, 4], 'minor'); // '1.1.0'
17
- * semverVersionBump(['1', '0', '0'], 'patch'); // '1.0.1'
18
- * ```
19
- */
20
- declare function semverVersionBump(version: string | string[] | number[], level: 'major' | 'minor' | 'patch'): string;
21
-
22
- export { semverVersionBump };
@@ -1,26 +0,0 @@
1
- import { __name } from '../chunk-SHUYVCID.js';
2
-
3
- function semverVersionBump(version, level) {
4
- const arr = (typeof version === "string" ? version.split(".") : version).map(Number);
5
- switch (level) {
6
- case "major": {
7
- arr[0] += 1;
8
- arr[1] = 0;
9
- arr[2] = 0;
10
- break;
11
- }
12
- case "minor": {
13
- arr[1] += 1;
14
- arr[2] = 0;
15
- break;
16
- }
17
- case "patch": {
18
- arr[2] += 1;
19
- break;
20
- }
21
- }
22
- return arr.join(".");
23
- }
24
- __name(semverVersionBump, "semverVersionBump");
25
-
26
- export { semverVersionBump };