@bemoje/monorepo 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/MonoRepo.cjs +7288 -60
- package/lib/MonoRepo.js +7267 -40
- package/lib/code/AbstractCode.cjs +5507 -16
- package/lib/code/AbstractCode.js +5500 -12
- package/lib/code/CodeBlock.cjs +5582 -19
- package/lib/code/CodeBlock.js +5574 -14
- package/lib/code/TsCode.cjs +7307 -27
- package/lib/code/TsCode.js +7295 -21
- package/lib/code/imports/ImportKeywords.cjs +5620 -10
- package/lib/code/imports/ImportKeywords.js +5614 -7
- package/lib/code/imports/ImportSpecifiers.cjs +5620 -10
- package/lib/code/imports/ImportSpecifiers.js +5614 -7
- package/lib/code/imports/ImportStatement.cjs +7321 -38
- package/lib/code/imports/ImportStatement.js +7301 -24
- package/lib/code/imports/ModuleSpecifier.cjs +7311 -16
- package/lib/code/imports/ModuleSpecifier.js +7299 -10
- package/lib/common/AbstractBase.cjs +570 -9
- package/lib/common/AbstractBase.js +565 -5
- package/lib/file/File.cjs +5424 -46
- package/lib/file/File.js +5419 -20
- package/lib/file/TestFile.cjs +7344 -18
- package/lib/file/TestFile.js +7334 -14
- package/lib/file/TsFile.cjs +7342 -20
- package/lib/file/TsFile.js +7331 -15
- package/lib/index.cjs +7695 -212
- package/lib/index.js +7672 -30
- package/lib/methods/findWorkspacePackageName.cjs +71 -2
- package/lib/methods/findWorkspacePackageName.js +66 -2
- package/lib/methods/getAllImports.cjs +2 -0
- package/lib/methods/getAllImports.js +3 -1
- package/lib/methods/getAllWorkspacePackageJsonPaths.cjs +42 -5
- package/lib/methods/getAllWorkspacePackageJsonPaths.js +40 -4
- package/lib/methods/getAllWorkspacePackageJsons.cjs +48 -2
- package/lib/methods/getAllWorkspacePackageJsons.js +47 -2
- package/lib/methods/getAllWorkspacePackageNames.cjs +62 -2
- package/lib/methods/getAllWorkspacePackageNames.js +57 -2
- package/lib/methods/getAllWorkspacePaths.cjs +32 -5
- package/lib/methods/getAllWorkspacePaths.js +30 -4
- package/lib/methods/getImportsRecursively.cjs +7422 -21
- package/lib/methods/getImportsRecursively.js +7412 -14
- package/lib/methods/getRepoPackageJson.cjs +25 -2
- package/lib/methods/getRepoPackageJson.js +24 -2
- package/lib/methods/getRepoPackageJsonPath.cjs +21 -4
- package/lib/methods/getRepoPackageJsonPath.js +20 -4
- package/lib/repo/Workspace.cjs +7059 -72
- package/lib/repo/Workspace.js +7034 -49
- package/lib/util/SemanticExtnamePrefix.cjs +2 -1
- package/lib/util/SemanticExtnamePrefix.js +2 -3
- package/lib/util/SemanticExtnamePrefixDescriptions.cjs +2 -1
- package/lib/util/SemanticExtnamePrefixDescriptions.js +2 -3
- package/lib/util/SemanticExtnamePrefixes.cjs +11 -2
- package/lib/util/SemanticExtnamePrefixes.js +10 -2
- package/lib/util/getRepoRootDirpath.cjs +1 -1
- package/lib/util/getRepoRootDirpath.js +3 -2
- package/lib/util/getWorkspaceDirpaths.cjs +18 -3
- package/lib/util/getWorkspaceDirpaths.js +18 -3
- package/lib/util/hasExtnamePrefix.cjs +15 -6
- package/lib/util/hasExtnamePrefix.js +17 -3
- package/lib/util/resolveModuleImportPath.cjs +24 -7
- package/lib/util/resolveModuleImportPath.js +22 -6
- package/lib/util/semverVersionBump.cjs +2 -0
- package/lib/util/semverVersionBump.js +3 -1
- package/package.json +2 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/util/SemanticExtnamePrefixDescriptions.ts
|
|
4
|
+
var SemanticExtnamePrefixDescriptions = {
|
|
4
5
|
d: "declarations",
|
|
5
6
|
test: "vitest test suite",
|
|
6
7
|
examples: "contains working and tested example usage code. Included in git, but ignored by most repo tools",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const SemanticExtnamePrefixDescriptions = {
|
|
1
|
+
// src/util/SemanticExtnamePrefixDescriptions.ts
|
|
2
|
+
var SemanticExtnamePrefixDescriptions = {
|
|
4
3
|
d: "declarations",
|
|
5
4
|
test: "vitest test suite",
|
|
6
5
|
examples: "contains working and tested example usage code. Included in git, but ignored by most repo tools",
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
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
|
+
};
|
|
4
12
|
|
|
5
|
-
|
|
13
|
+
// src/util/SemanticExtnamePrefixes.ts
|
|
14
|
+
var SemanticExtnamePrefixes_default = Object.values(SemanticExtnamePrefix);
|
|
6
15
|
|
|
7
16
|
module.exports = SemanticExtnamePrefixes_default;
|
|
8
17
|
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
};
|
|
3
10
|
|
|
11
|
+
// src/util/SemanticExtnamePrefixes.ts
|
|
4
12
|
var SemanticExtnamePrefixes_default = Object.values(SemanticExtnamePrefix);
|
|
5
13
|
|
|
6
14
|
export { SemanticExtnamePrefixes_default as default };
|
|
@@ -12,7 +12,7 @@ var path__default = /*#__PURE__*/_interopDefault(path);
|
|
|
12
12
|
|
|
13
13
|
var __defProp = Object.defineProperty;
|
|
14
14
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
15
|
-
|
|
15
|
+
var getRepoRootDirpath = onetime__default.default(/* @__PURE__ */ __name(function getRepoRootDirpath2() {
|
|
16
16
|
return (/* @__PURE__ */ __name(function recurse(dirpath = process.cwd()) {
|
|
17
17
|
dirpath = path__default.default.normalizeSafe(dirpath);
|
|
18
18
|
const pkgpath = path__default.default.joinSafe(dirpath, "package.json");
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { __name } from '../chunk-SHUYVCID.js';
|
|
2
1
|
import fs from 'fs-extra';
|
|
3
2
|
import onetime from 'onetime';
|
|
4
3
|
import path from 'upath';
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var getRepoRootDirpath = onetime(/* @__PURE__ */ __name(function getRepoRootDirpath2() {
|
|
7
8
|
return (/* @__PURE__ */ __name(function recurse(dirpath = process.cwd()) {
|
|
8
9
|
dirpath = path.normalizeSafe(dirpath);
|
|
9
10
|
const pkgpath = path.joinSafe(dirpath, "package.json");
|
|
@@ -1,19 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var fs = require('fs-extra');
|
|
4
|
-
var
|
|
5
|
-
var glob = require('glob');
|
|
4
|
+
var onetime = require('onetime');
|
|
6
5
|
var path = require('upath');
|
|
6
|
+
var glob = require('glob');
|
|
7
7
|
|
|
8
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
|
|
10
10
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
11
|
+
var onetime__default = /*#__PURE__*/_interopDefault(onetime);
|
|
11
12
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
12
13
|
|
|
13
14
|
var __defProp = Object.defineProperty;
|
|
14
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"));
|
|
15
30
|
function getWorkspaceDirpaths() {
|
|
16
|
-
const rootDirpath = getRepoRootDirpath
|
|
31
|
+
const rootDirpath = getRepoRootDirpath();
|
|
17
32
|
const pkg = fs__default.default.readJsonSync(path__default.default.joinSafe(rootDirpath, "package.json"));
|
|
18
33
|
if (!pkg.workspaces) {
|
|
19
34
|
throw new Error(`No workspaces found in package.json at ${rootDirpath}`);
|
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
import { __name } from '../chunk-SHUYVCID.js';
|
|
2
1
|
import fs from 'fs-extra';
|
|
3
|
-
import
|
|
4
|
-
import { globSync } from 'glob';
|
|
2
|
+
import onetime from 'onetime';
|
|
5
3
|
import path from 'upath';
|
|
4
|
+
import { globSync } from 'glob';
|
|
6
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"));
|
|
7
22
|
function getWorkspaceDirpaths() {
|
|
8
23
|
const rootDirpath = getRepoRootDirpath();
|
|
9
24
|
const pkg = fs.readJsonSync(path.joinSafe(rootDirpath, "package.json"));
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
5
|
|
|
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
|
+
};
|
|
6
15
|
|
|
7
|
-
|
|
16
|
+
// src/util/SemanticExtnamePrefixes.ts
|
|
17
|
+
var SemanticExtnamePrefixes_default = Object.values(SemanticExtnamePrefix);
|
|
8
18
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function hasExtnamePrefix(tsFilepath, prefixes = SemanticExtnamePrefixes__default.default) {
|
|
19
|
+
// src/util/hasExtnamePrefix.ts
|
|
20
|
+
function hasExtnamePrefix(tsFilepath, prefixes = SemanticExtnamePrefixes_default) {
|
|
12
21
|
return new RegExp(`[.](${[
|
|
13
22
|
prefixes
|
|
14
23
|
].flat(2).join("|")})[.][^/\\\\]+$`).test(tsFilepath);
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
-
|
|
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) {
|
|
5
19
|
return new RegExp(`[.](${[
|
|
6
20
|
prefixes
|
|
7
21
|
].flat(2).join("|")})[.][^/\\\\]+$`).test(tsFilepath);
|
|
@@ -1,21 +1,38 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var typescript = require('typescript');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
var fs2 = require('fs-extra/esm');
|
|
5
|
+
var fs = require('fs-extra');
|
|
6
|
+
var onetime = require('onetime');
|
|
7
|
+
var path = require('upath');
|
|
7
8
|
|
|
8
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
10
|
|
|
11
|
+
var fs2__default = /*#__PURE__*/_interopDefault(fs2);
|
|
10
12
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
11
|
-
var
|
|
13
|
+
var onetime__default = /*#__PURE__*/_interopDefault(onetime);
|
|
14
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
12
15
|
|
|
13
16
|
var __defProp = Object.defineProperty;
|
|
14
17
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
18
|
+
var getRepoRootDirpath = onetime__default.default(/* @__PURE__ */ __name(function getRepoRootDirpath2() {
|
|
19
|
+
return (/* @__PURE__ */ __name(function recurse(dirpath = process.cwd()) {
|
|
20
|
+
dirpath = path__default.default.normalizeSafe(dirpath);
|
|
21
|
+
const pkgpath = path__default.default.joinSafe(dirpath, "package.json");
|
|
22
|
+
if (fs__default.default.existsSync(pkgpath) && fs__default.default.readJsonSync(pkgpath)?.workspaces) {
|
|
23
|
+
return dirpath;
|
|
24
|
+
}
|
|
25
|
+
const parent = path__default.default.dirname(dirpath);
|
|
26
|
+
if (parent !== dirpath) {
|
|
27
|
+
return recurse(parent);
|
|
28
|
+
}
|
|
29
|
+
throw new Error(`Could not find repo root from process.cwd(): ${process.cwd()}`);
|
|
30
|
+
}, "recurse"))();
|
|
31
|
+
}, "getRepoRootDirpath"));
|
|
15
32
|
function resolveModuleImportPath(filepath, importFrom) {
|
|
16
|
-
const rootdir = getRepoRootDirpath
|
|
33
|
+
const rootdir = getRepoRootDirpath();
|
|
17
34
|
const result = typescript.resolveModuleName(importFrom, filepath, {
|
|
18
|
-
paths:
|
|
35
|
+
paths: fs2__default.default.readJsonSync(path__default.default.joinSafe(rootdir, "tsconfig.paths.json")).compilerOptions.paths,
|
|
19
36
|
allowJs: true,
|
|
20
37
|
allowArbitraryExtensions: true,
|
|
21
38
|
allowImportingTsExtensions: true,
|
|
@@ -25,7 +42,7 @@ function resolveModuleImportPath(filepath, importFrom) {
|
|
|
25
42
|
}, typescript.createCompilerHost({}, true));
|
|
26
43
|
const f = result.resolvedModule?.resolvedFileName;
|
|
27
44
|
if (f) {
|
|
28
|
-
result.resolvedModule.resolvedFileName =
|
|
45
|
+
result.resolvedModule.resolvedFileName = path__default.default.relative(rootdir, f);
|
|
29
46
|
}
|
|
30
47
|
return result.resolvedModule;
|
|
31
48
|
}
|
|
@@ -1,13 +1,29 @@
|
|
|
1
|
-
import { __name } from '../chunk-SHUYVCID.js';
|
|
2
1
|
import { resolveModuleName, createCompilerHost } from 'typescript';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import fs2 from 'fs-extra/esm';
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
import onetime from 'onetime';
|
|
5
|
+
import path from 'upath';
|
|
6
6
|
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var getRepoRootDirpath = onetime(/* @__PURE__ */ __name(function getRepoRootDirpath2() {
|
|
10
|
+
return (/* @__PURE__ */ __name(function recurse(dirpath = process.cwd()) {
|
|
11
|
+
dirpath = path.normalizeSafe(dirpath);
|
|
12
|
+
const pkgpath = path.joinSafe(dirpath, "package.json");
|
|
13
|
+
if (fs.existsSync(pkgpath) && fs.readJsonSync(pkgpath)?.workspaces) {
|
|
14
|
+
return dirpath;
|
|
15
|
+
}
|
|
16
|
+
const parent = path.dirname(dirpath);
|
|
17
|
+
if (parent !== dirpath) {
|
|
18
|
+
return recurse(parent);
|
|
19
|
+
}
|
|
20
|
+
throw new Error(`Could not find repo root from process.cwd(): ${process.cwd()}`);
|
|
21
|
+
}, "recurse"))();
|
|
22
|
+
}, "getRepoRootDirpath"));
|
|
7
23
|
function resolveModuleImportPath(filepath, importFrom) {
|
|
8
24
|
const rootdir = getRepoRootDirpath();
|
|
9
25
|
const result = resolveModuleName(importFrom, filepath, {
|
|
10
|
-
paths:
|
|
26
|
+
paths: fs2.readJsonSync(path.joinSafe(rootdir, "tsconfig.paths.json")).compilerOptions.paths,
|
|
11
27
|
allowJs: true,
|
|
12
28
|
allowArbitraryExtensions: true,
|
|
13
29
|
allowImportingTsExtensions: true,
|
|
@@ -17,7 +33,7 @@ function resolveModuleImportPath(filepath, importFrom) {
|
|
|
17
33
|
}, createCompilerHost({}, true));
|
|
18
34
|
const f = result.resolvedModule?.resolvedFileName;
|
|
19
35
|
if (f) {
|
|
20
|
-
result.resolvedModule.resolvedFileName =
|
|
36
|
+
result.resolvedModule.resolvedFileName = path.relative(rootdir, f);
|
|
21
37
|
}
|
|
22
38
|
return result.resolvedModule;
|
|
23
39
|
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
|
|
6
|
+
// src/util/semverVersionBump.ts
|
|
5
7
|
function semverVersionBump(version, level) {
|
|
6
8
|
const arr = (typeof version === "string" ? version.split(".") : version).map(Number);
|
|
7
9
|
switch (level) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
2
3
|
|
|
4
|
+
// src/util/semverVersionBump.ts
|
|
3
5
|
function semverVersionBump(version, level) {
|
|
4
6
|
const arr = (typeof version === "string" ? version.split(".") : version).map(Number);
|
|
5
7
|
switch (level) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemoje/monorepo",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Monorepo workspace management, package discovery, and TypeScript code processing utilities.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"monorepo",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"utilities"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
+
"ansi-colors": "^4.1.3",
|
|
15
16
|
"es-toolkit": "^1.45.1",
|
|
16
17
|
"fs-extra": "^11.3.4",
|
|
17
18
|
"glob": "^11.1.0",
|