@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.
- package/lib/index.cjs +2496 -213
- package/lib/index.d.cts +2765 -26
- package/lib/index.d.ts +2765 -26
- package/lib/index.js +2469 -30
- package/package.json +178 -297
- package/lib/MonoRepo.cjs +0 -142
- package/lib/MonoRepo.d.cts +0 -10
- package/lib/MonoRepo.d.ts +0 -10
- package/lib/MonoRepo.js +0 -134
- package/lib/code/AbstractCode.cjs +0 -77
- package/lib/code/AbstractCode.d.cts +0 -30
- package/lib/code/AbstractCode.d.ts +0 -30
- package/lib/code/AbstractCode.js +0 -74
- package/lib/code/CodeBlock.cjs +0 -51
- package/lib/code/CodeBlock.d.cts +0 -22
- package/lib/code/CodeBlock.d.ts +0 -22
- package/lib/code/CodeBlock.js +0 -48
- package/lib/code/TsCode.cjs +0 -90
- package/lib/code/TsCode.d.cts +0 -10
- package/lib/code/TsCode.d.ts +0 -10
- package/lib/code/TsCode.js +0 -87
- package/lib/code/imports/ImportKeywords.cjs +0 -42
- 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 -39
- package/lib/code/imports/ImportSpecifiers.cjs +0 -98
- 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 -95
- package/lib/code/imports/ImportStatement.cjs +0 -89
- 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 -86
- package/lib/code/imports/ModuleSpecifier.cjs +0 -77
- 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 -74
- package/lib/common/AbstractBase.cjs +0 -77
- package/lib/common/AbstractBase.d.cts +0 -3
- package/lib/common/AbstractBase.d.ts +0 -3
- package/lib/common/AbstractBase.js +0 -74
- package/lib/file/File.cjs +0 -118
- package/lib/file/File.d.cts +0 -10
- package/lib/file/File.d.ts +0 -10
- package/lib/file/File.js +0 -91
- package/lib/file/TestFile.cjs +0 -42
- package/lib/file/TestFile.d.cts +0 -10
- package/lib/file/TestFile.d.ts +0 -10
- package/lib/file/TestFile.js +0 -39
- package/lib/file/TsFile.cjs +0 -46
- package/lib/file/TsFile.d.cts +0 -10
- package/lib/file/TsFile.d.ts +0 -10
- package/lib/file/TsFile.js +0 -43
- package/lib/methods/findWorkspacePackageName.cjs +0 -17
- package/lib/methods/findWorkspacePackageName.d.cts +0 -6
- package/lib/methods/findWorkspacePackageName.d.ts +0 -6
- package/lib/methods/findWorkspacePackageName.js +0 -14
- package/lib/methods/getAllImports.cjs +0 -18
- package/lib/methods/getAllImports.d.cts +0 -17
- package/lib/methods/getAllImports.d.ts +0 -17
- package/lib/methods/getAllImports.js +0 -16
- package/lib/methods/getAllWorkspacePackageJsonPaths.cjs +0 -20
- package/lib/methods/getAllWorkspacePackageJsonPaths.d.cts +0 -6
- package/lib/methods/getAllWorkspacePackageJsonPaths.d.ts +0 -6
- package/lib/methods/getAllWorkspacePackageJsonPaths.js +0 -13
- package/lib/methods/getAllWorkspacePackageJsons.cjs +0 -20
- package/lib/methods/getAllWorkspacePackageJsons.d.cts +0 -6
- package/lib/methods/getAllWorkspacePackageJsons.d.ts +0 -6
- package/lib/methods/getAllWorkspacePackageJsons.js +0 -13
- package/lib/methods/getAllWorkspacePackageNames.cjs +0 -15
- package/lib/methods/getAllWorkspacePackageNames.d.cts +0 -6
- package/lib/methods/getAllWorkspacePackageNames.d.ts +0 -6
- package/lib/methods/getAllWorkspacePackageNames.js +0 -12
- package/lib/methods/getAllWorkspacePaths.cjs +0 -23
- package/lib/methods/getAllWorkspacePaths.d.cts +0 -6
- package/lib/methods/getAllWorkspacePaths.d.ts +0 -6
- package/lib/methods/getAllWorkspacePaths.js +0 -16
- package/lib/methods/getImportsRecursively.cjs +0 -176
- package/lib/methods/getImportsRecursively.d.cts +0 -37
- package/lib/methods/getImportsRecursively.d.ts +0 -37
- package/lib/methods/getImportsRecursively.js +0 -168
- package/lib/methods/getRepoPackageJson.cjs +0 -17
- package/lib/methods/getRepoPackageJson.d.cts +0 -6
- package/lib/methods/getRepoPackageJson.d.ts +0 -6
- package/lib/methods/getRepoPackageJson.js +0 -10
- package/lib/methods/getRepoPackageJsonPath.cjs +0 -17
- package/lib/methods/getRepoPackageJsonPath.d.cts +0 -6
- package/lib/methods/getRepoPackageJsonPath.d.ts +0 -6
- package/lib/methods/getRepoPackageJsonPath.js +0 -10
- package/lib/repo/Workspace.cjs +0 -383
- package/lib/repo/Workspace.d.cts +0 -10
- package/lib/repo/Workspace.d.ts +0 -10
- package/lib/repo/Workspace.js +0 -376
- package/lib/util/SemanticExtnamePrefix.cjs +0 -12
- package/lib/util/SemanticExtnamePrefix.d.cts +0 -14
- package/lib/util/SemanticExtnamePrefix.d.ts +0 -14
- package/lib/util/SemanticExtnamePrefix.js +0 -12
- package/lib/util/SemanticExtnamePrefixDescriptions.cjs +0 -12
- package/lib/util/SemanticExtnamePrefixDescriptions.d.cts +0 -15
- package/lib/util/SemanticExtnamePrefixDescriptions.d.ts +0 -15
- package/lib/util/SemanticExtnamePrefixDescriptions.js +0 -12
- package/lib/util/SemanticExtnamePrefixes.cjs +0 -9
- package/lib/util/SemanticExtnamePrefixes.d.cts +0 -97
- package/lib/util/SemanticExtnamePrefixes.d.ts +0 -97
- package/lib/util/SemanticExtnamePrefixes.js +0 -6
- 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 -21
- package/lib/util/getWorkspaceDirpaths.cjs +0 -27
- package/lib/util/getWorkspaceDirpaths.d.cts +0 -6
- package/lib/util/getWorkspaceDirpaths.d.ts +0 -6
- package/lib/util/getWorkspaceDirpaths.js +0 -19
- package/lib/util/hasExtnamePrefix.cjs +0 -18
- package/lib/util/hasExtnamePrefix.d.cts +0 -38
- package/lib/util/hasExtnamePrefix.d.ts +0 -38
- package/lib/util/hasExtnamePrefix.js +0 -11
- package/lib/util/resolveModuleImportPath.cjs +0 -34
- package/lib/util/resolveModuleImportPath.d.cts +0 -8
- package/lib/util/resolveModuleImportPath.d.ts +0 -8
- package/lib/util/resolveModuleImportPath.js +0 -26
- package/lib/util/semverVersionBump.cjs +0 -28
- package/lib/util/semverVersionBump.d.cts +0 -22
- package/lib/util/semverVersionBump.d.ts +0 -22
- package/lib/util/semverVersionBump.js +0 -26
package/lib/code/TsCode.cjs
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var AbstractCode = require('./AbstractCode');
|
|
4
|
-
var ImportStatement = require('./imports/ImportStatement');
|
|
5
|
-
var composition = require('@mono/composition');
|
|
6
|
-
var decorators = require('@mono/decorators');
|
|
7
|
-
var regex = require('@mono/regex');
|
|
8
|
-
var tscode = require('@mono/tscode');
|
|
9
|
-
var array = require('es-toolkit/array');
|
|
10
|
-
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
14
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
-
}
|
|
19
|
-
__name(_ts_decorate, "_ts_decorate");
|
|
20
|
-
function _ts_metadata(k, v) {
|
|
21
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
-
}
|
|
23
|
-
__name(_ts_metadata, "_ts_metadata");
|
|
24
|
-
class TsCode extends AbstractCode.AbstractCode {
|
|
25
|
-
static {
|
|
26
|
-
__name(this, "TsCode");
|
|
27
|
-
}
|
|
28
|
-
static inspector = composition.Inspector.compose(TsCode, {
|
|
29
|
-
keys: [
|
|
30
|
-
"imports"
|
|
31
|
-
]
|
|
32
|
-
});
|
|
33
|
-
#code;
|
|
34
|
-
get code() {
|
|
35
|
-
return this.#code;
|
|
36
|
-
}
|
|
37
|
-
constructor(parent, code) {
|
|
38
|
-
super(parent);
|
|
39
|
-
this.#code = code;
|
|
40
|
-
}
|
|
41
|
-
toString() {
|
|
42
|
-
return this.code;
|
|
43
|
-
}
|
|
44
|
-
requires(format = "modules") {
|
|
45
|
-
if (format === "lines") {
|
|
46
|
-
return this.code.split(/\r*\n/).filter((line) => {
|
|
47
|
-
return this.requireRegex.test(line);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return array.uniq(Array.from(this.code.matchAll(this.requireRegex)).map((o) => {
|
|
51
|
-
return o[1];
|
|
52
|
-
}));
|
|
53
|
-
}
|
|
54
|
-
get imports() {
|
|
55
|
-
const statements = tscode.tsExtractImports(this.code).map((o) => {
|
|
56
|
-
return o.match;
|
|
57
|
-
});
|
|
58
|
-
return statements.map((line) => {
|
|
59
|
-
return new ImportStatement.ImportStatement(this, this.codeIndexRangeOf(line));
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
get exportedClassNames() {
|
|
63
|
-
return regex.rexec(/^export (abstract )?class (?<name>\w+)/gm, this.code).map((o) => {
|
|
64
|
-
return o.groups?.name;
|
|
65
|
-
}).filter(Boolean);
|
|
66
|
-
}
|
|
67
|
-
get dependencies() {
|
|
68
|
-
return this.imports.map((imp) => {
|
|
69
|
-
return imp.module.dependency;
|
|
70
|
-
}).filter(Boolean).sort();
|
|
71
|
-
}
|
|
72
|
-
get requireRegex() {
|
|
73
|
-
return /require\(["'](.+)["']\)/g;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
_ts_decorate([
|
|
77
|
-
decorators.lazyProp,
|
|
78
|
-
_ts_metadata("design:type", Array),
|
|
79
|
-
_ts_metadata("design:paramtypes", [])
|
|
80
|
-
], TsCode.prototype, "imports", null);
|
|
81
|
-
TsCode = _ts_decorate([
|
|
82
|
-
composition.Parenting.compose,
|
|
83
|
-
_ts_metadata("design:type", Function),
|
|
84
|
-
_ts_metadata("design:paramtypes", [
|
|
85
|
-
typeof P === "undefined" ? Object : P,
|
|
86
|
-
String
|
|
87
|
-
])
|
|
88
|
-
], TsCode);
|
|
89
|
-
|
|
90
|
-
exports.TsCode = TsCode;
|
package/lib/code/TsCode.d.cts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import '../AbstractBase-J4h6nW8k.cjs';
|
|
2
|
-
import './AbstractCode.cjs';
|
|
3
|
-
export { e as TsCode } from '../MonoRepo-BgdabVzT.cjs';
|
|
4
|
-
import 'util';
|
|
5
|
-
import 'mnemonist';
|
|
6
|
-
import '../is-never.d-CgQ1j0-8.cjs';
|
|
7
|
-
import 'typescript';
|
|
8
|
-
import 'depcheck';
|
|
9
|
-
import './CodeBlock.cjs';
|
|
10
|
-
import 'fs';
|
package/lib/code/TsCode.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import '../AbstractBase-J4h6nW8k.js';
|
|
2
|
-
import './AbstractCode.js';
|
|
3
|
-
export { e as TsCode } from '../MonoRepo-BFFUDAYn.js';
|
|
4
|
-
import 'util';
|
|
5
|
-
import 'mnemonist';
|
|
6
|
-
import '../is-never.d-CgQ1j0-8.js';
|
|
7
|
-
import 'typescript';
|
|
8
|
-
import 'depcheck';
|
|
9
|
-
import './CodeBlock.js';
|
|
10
|
-
import 'fs';
|
package/lib/code/TsCode.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { __name } from '../chunk-SHUYVCID.js';
|
|
2
|
-
import { AbstractCode } from './AbstractCode';
|
|
3
|
-
import { ImportStatement } from './imports/ImportStatement';
|
|
4
|
-
import { Inspector, Parenting } from '@mono/composition';
|
|
5
|
-
import { lazyProp } from '@mono/decorators';
|
|
6
|
-
import { rexec } from '@mono/regex';
|
|
7
|
-
import { tsExtractImports } from '@mono/tscode';
|
|
8
|
-
import { uniq } from 'es-toolkit/array';
|
|
9
|
-
|
|
10
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
11
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
-
}
|
|
16
|
-
__name(_ts_decorate, "_ts_decorate");
|
|
17
|
-
function _ts_metadata(k, v) {
|
|
18
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
19
|
-
}
|
|
20
|
-
__name(_ts_metadata, "_ts_metadata");
|
|
21
|
-
class TsCode extends AbstractCode {
|
|
22
|
-
static {
|
|
23
|
-
__name(this, "TsCode");
|
|
24
|
-
}
|
|
25
|
-
static inspector = Inspector.compose(TsCode, {
|
|
26
|
-
keys: [
|
|
27
|
-
"imports"
|
|
28
|
-
]
|
|
29
|
-
});
|
|
30
|
-
#code;
|
|
31
|
-
get code() {
|
|
32
|
-
return this.#code;
|
|
33
|
-
}
|
|
34
|
-
constructor(parent, code) {
|
|
35
|
-
super(parent);
|
|
36
|
-
this.#code = code;
|
|
37
|
-
}
|
|
38
|
-
toString() {
|
|
39
|
-
return this.code;
|
|
40
|
-
}
|
|
41
|
-
requires(format = "modules") {
|
|
42
|
-
if (format === "lines") {
|
|
43
|
-
return this.code.split(/\r*\n/).filter((line) => {
|
|
44
|
-
return this.requireRegex.test(line);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
return uniq(Array.from(this.code.matchAll(this.requireRegex)).map((o) => {
|
|
48
|
-
return o[1];
|
|
49
|
-
}));
|
|
50
|
-
}
|
|
51
|
-
get imports() {
|
|
52
|
-
const statements = tsExtractImports(this.code).map((o) => {
|
|
53
|
-
return o.match;
|
|
54
|
-
});
|
|
55
|
-
return statements.map((line) => {
|
|
56
|
-
return new ImportStatement(this, this.codeIndexRangeOf(line));
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
get exportedClassNames() {
|
|
60
|
-
return rexec(/^export (abstract )?class (?<name>\w+)/gm, this.code).map((o) => {
|
|
61
|
-
return o.groups?.name;
|
|
62
|
-
}).filter(Boolean);
|
|
63
|
-
}
|
|
64
|
-
get dependencies() {
|
|
65
|
-
return this.imports.map((imp) => {
|
|
66
|
-
return imp.module.dependency;
|
|
67
|
-
}).filter(Boolean).sort();
|
|
68
|
-
}
|
|
69
|
-
get requireRegex() {
|
|
70
|
-
return /require\(["'](.+)["']\)/g;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
_ts_decorate([
|
|
74
|
-
lazyProp,
|
|
75
|
-
_ts_metadata("design:type", Array),
|
|
76
|
-
_ts_metadata("design:paramtypes", [])
|
|
77
|
-
], TsCode.prototype, "imports", null);
|
|
78
|
-
TsCode = _ts_decorate([
|
|
79
|
-
Parenting.compose,
|
|
80
|
-
_ts_metadata("design:type", Function),
|
|
81
|
-
_ts_metadata("design:paramtypes", [
|
|
82
|
-
typeof P === "undefined" ? Object : P,
|
|
83
|
-
String
|
|
84
|
-
])
|
|
85
|
-
], TsCode);
|
|
86
|
-
|
|
87
|
-
export { TsCode };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var CodeBlock = require('../CodeBlock');
|
|
4
|
-
var composition = require('@mono/composition');
|
|
5
|
-
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
9
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13
|
-
}
|
|
14
|
-
__name(_ts_decorate, "_ts_decorate");
|
|
15
|
-
class ImportKeywords extends CodeBlock.CodeBlock {
|
|
16
|
-
static {
|
|
17
|
-
__name(this, "ImportKeywords");
|
|
18
|
-
}
|
|
19
|
-
static inspector = composition.Inspector.compose(ImportKeywords, {
|
|
20
|
-
keys: [
|
|
21
|
-
"code"
|
|
22
|
-
]
|
|
23
|
-
});
|
|
24
|
-
get keywords() {
|
|
25
|
-
return this.code.split(/\s+/).map((s) => {
|
|
26
|
-
return s.trim();
|
|
27
|
-
}).filter((s) => {
|
|
28
|
-
return !!s;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
has(kw) {
|
|
32
|
-
return this.keywords.includes(kw);
|
|
33
|
-
}
|
|
34
|
-
get isType() {
|
|
35
|
-
return this.has("type");
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
ImportKeywords = _ts_decorate([
|
|
39
|
-
composition.Parenting.compose
|
|
40
|
-
], ImportKeywords);
|
|
41
|
-
|
|
42
|
-
exports.ImportKeywords = ImportKeywords;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import '../../AbstractBase-J4h6nW8k.cjs';
|
|
2
|
-
import '../CodeBlock.cjs';
|
|
3
|
-
export { I as ImportKeywords } from '../../MonoRepo-BgdabVzT.cjs';
|
|
4
|
-
import 'util';
|
|
5
|
-
import 'mnemonist';
|
|
6
|
-
import '../AbstractCode.cjs';
|
|
7
|
-
import '../../is-never.d-CgQ1j0-8.cjs';
|
|
8
|
-
import 'typescript';
|
|
9
|
-
import 'depcheck';
|
|
10
|
-
import 'fs';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import '../../AbstractBase-J4h6nW8k.js';
|
|
2
|
-
import '../CodeBlock.js';
|
|
3
|
-
export { I as ImportKeywords } from '../../MonoRepo-BFFUDAYn.js';
|
|
4
|
-
import 'util';
|
|
5
|
-
import 'mnemonist';
|
|
6
|
-
import '../AbstractCode.js';
|
|
7
|
-
import '../../is-never.d-CgQ1j0-8.js';
|
|
8
|
-
import 'typescript';
|
|
9
|
-
import 'depcheck';
|
|
10
|
-
import 'fs';
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { __name } from '../../chunk-SHUYVCID.js';
|
|
2
|
-
import { CodeBlock } from '../CodeBlock';
|
|
3
|
-
import { Inspector, Parenting } from '@mono/composition';
|
|
4
|
-
|
|
5
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
6
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
-
}
|
|
11
|
-
__name(_ts_decorate, "_ts_decorate");
|
|
12
|
-
class ImportKeywords extends CodeBlock {
|
|
13
|
-
static {
|
|
14
|
-
__name(this, "ImportKeywords");
|
|
15
|
-
}
|
|
16
|
-
static inspector = Inspector.compose(ImportKeywords, {
|
|
17
|
-
keys: [
|
|
18
|
-
"code"
|
|
19
|
-
]
|
|
20
|
-
});
|
|
21
|
-
get keywords() {
|
|
22
|
-
return this.code.split(/\s+/).map((s) => {
|
|
23
|
-
return s.trim();
|
|
24
|
-
}).filter((s) => {
|
|
25
|
-
return !!s;
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
has(kw) {
|
|
29
|
-
return this.keywords.includes(kw);
|
|
30
|
-
}
|
|
31
|
-
get isType() {
|
|
32
|
-
return this.has("type");
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
ImportKeywords = _ts_decorate([
|
|
36
|
-
Parenting.compose
|
|
37
|
-
], ImportKeywords);
|
|
38
|
-
|
|
39
|
-
export { ImportKeywords };
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var CodeBlock = require('../CodeBlock');
|
|
4
|
-
var composition = require('@mono/composition');
|
|
5
|
-
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
9
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13
|
-
}
|
|
14
|
-
__name(_ts_decorate, "_ts_decorate");
|
|
15
|
-
class ImportSpecifiers extends CodeBlock.CodeBlock {
|
|
16
|
-
static {
|
|
17
|
-
__name(this, "ImportSpecifiers");
|
|
18
|
-
}
|
|
19
|
-
static inspector = composition.Inspector.compose(ImportSpecifiers, {
|
|
20
|
-
keys: [
|
|
21
|
-
"import",
|
|
22
|
-
"type"
|
|
23
|
-
],
|
|
24
|
-
autoAddBooleanKeys: false
|
|
25
|
-
});
|
|
26
|
-
get codeWithoutTypeKeyword() {
|
|
27
|
-
return this.code.replaceAll(/\s*\btype\b\s*/g, " ");
|
|
28
|
-
}
|
|
29
|
-
get type() {
|
|
30
|
-
if (this.isMixedImport) {
|
|
31
|
-
return "mixed";
|
|
32
|
-
}
|
|
33
|
-
if (this.isNamedImport) {
|
|
34
|
-
return "named";
|
|
35
|
-
}
|
|
36
|
-
if (this.isNamespaceImport) {
|
|
37
|
-
return "namespace";
|
|
38
|
-
}
|
|
39
|
-
return "default";
|
|
40
|
-
}
|
|
41
|
-
get isDefaultImport() {
|
|
42
|
-
return /[$A-Z_a-z][\w$]*/.test(this.codeWithoutTypeKeyword) && !this.isNamespaceImport;
|
|
43
|
-
}
|
|
44
|
-
get isNamedImport() {
|
|
45
|
-
return /{[^}]+}/.test(this.codeWithoutTypeKeyword);
|
|
46
|
-
}
|
|
47
|
-
get isMixedImport() {
|
|
48
|
-
return /([$A-Z_a-z][\w$]*),\s*{[^}]+}/.test(this.codeWithoutTypeKeyword);
|
|
49
|
-
}
|
|
50
|
-
get isNamespaceImport() {
|
|
51
|
-
return /\*\s+as\s+([$A-Z_a-z][\w$]*)/.test(this.codeWithoutTypeKeyword);
|
|
52
|
-
}
|
|
53
|
-
get namedImportsArray() {
|
|
54
|
-
return this.code.replace("\n", " ").match(/{([^}]+)}/)?.[1].split(",").map((specifier) => {
|
|
55
|
-
return specifier.trim();
|
|
56
|
-
}).filter((s) => {
|
|
57
|
-
return !!s;
|
|
58
|
-
}) || [];
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Splits the import specifier into an array of specifiers as if to split into individual import statements.
|
|
62
|
-
* @example `{A,B} => {A},{B}`
|
|
63
|
-
*/
|
|
64
|
-
splitSpecifiers() {
|
|
65
|
-
return this.isNamedImport ? this.namedImportsArray.map((n) => {
|
|
66
|
-
return this.code.startsWith("type ") ? `type { ${n} }` : `{ ${n} }`;
|
|
67
|
-
}) : [
|
|
68
|
-
this.code
|
|
69
|
-
];
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Returns the keys added to the global namespace by this import specifier.
|
|
73
|
-
*/
|
|
74
|
-
get importedNamesArray() {
|
|
75
|
-
return this.codeWithoutTypeKeyword.replace(/[\w*]+ as \w+/, (m) => {
|
|
76
|
-
return m.split(" as ")[1];
|
|
77
|
-
}).replaceAll(/[{}]/g, " ").split(",").map((s) => {
|
|
78
|
-
return s.trim();
|
|
79
|
-
}).filter(Boolean);
|
|
80
|
-
}
|
|
81
|
-
get defaultImport() {
|
|
82
|
-
return this.codeWithoutTypeKeyword.match(/^([$A-Z_a-z][\w$]*)\s*(,|)/)?.[1] || void 0;
|
|
83
|
-
}
|
|
84
|
-
get namespaceImport() {
|
|
85
|
-
return this.codeWithoutTypeKeyword.match(/^\*\s+as\s+([$A-Z_a-z][\w$]*)/)?.[1] || void 0;
|
|
86
|
-
}
|
|
87
|
-
get hasNamedImport() {
|
|
88
|
-
return !!this.namedImportsArray.length;
|
|
89
|
-
}
|
|
90
|
-
get hasDefaultImport() {
|
|
91
|
-
return !!this.defaultImport;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
ImportSpecifiers = _ts_decorate([
|
|
95
|
-
composition.Parenting.compose
|
|
96
|
-
], ImportSpecifiers);
|
|
97
|
-
|
|
98
|
-
exports.ImportSpecifiers = ImportSpecifiers;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import '../../AbstractBase-J4h6nW8k.cjs';
|
|
2
|
-
import '../CodeBlock.cjs';
|
|
3
|
-
export { a as ImportSpecifiers } from '../../MonoRepo-BgdabVzT.cjs';
|
|
4
|
-
import 'util';
|
|
5
|
-
import 'mnemonist';
|
|
6
|
-
import '../AbstractCode.cjs';
|
|
7
|
-
import '../../is-never.d-CgQ1j0-8.cjs';
|
|
8
|
-
import 'typescript';
|
|
9
|
-
import 'depcheck';
|
|
10
|
-
import 'fs';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import '../../AbstractBase-J4h6nW8k.js';
|
|
2
|
-
import '../CodeBlock.js';
|
|
3
|
-
export { a as ImportSpecifiers } from '../../MonoRepo-BFFUDAYn.js';
|
|
4
|
-
import 'util';
|
|
5
|
-
import 'mnemonist';
|
|
6
|
-
import '../AbstractCode.js';
|
|
7
|
-
import '../../is-never.d-CgQ1j0-8.js';
|
|
8
|
-
import 'typescript';
|
|
9
|
-
import 'depcheck';
|
|
10
|
-
import 'fs';
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { __name } from '../../chunk-SHUYVCID.js';
|
|
2
|
-
import { CodeBlock } from '../CodeBlock';
|
|
3
|
-
import { Inspector, Parenting } from '@mono/composition';
|
|
4
|
-
|
|
5
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
6
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
-
}
|
|
11
|
-
__name(_ts_decorate, "_ts_decorate");
|
|
12
|
-
class ImportSpecifiers extends CodeBlock {
|
|
13
|
-
static {
|
|
14
|
-
__name(this, "ImportSpecifiers");
|
|
15
|
-
}
|
|
16
|
-
static inspector = Inspector.compose(ImportSpecifiers, {
|
|
17
|
-
keys: [
|
|
18
|
-
"import",
|
|
19
|
-
"type"
|
|
20
|
-
],
|
|
21
|
-
autoAddBooleanKeys: false
|
|
22
|
-
});
|
|
23
|
-
get codeWithoutTypeKeyword() {
|
|
24
|
-
return this.code.replaceAll(/\s*\btype\b\s*/g, " ");
|
|
25
|
-
}
|
|
26
|
-
get type() {
|
|
27
|
-
if (this.isMixedImport) {
|
|
28
|
-
return "mixed";
|
|
29
|
-
}
|
|
30
|
-
if (this.isNamedImport) {
|
|
31
|
-
return "named";
|
|
32
|
-
}
|
|
33
|
-
if (this.isNamespaceImport) {
|
|
34
|
-
return "namespace";
|
|
35
|
-
}
|
|
36
|
-
return "default";
|
|
37
|
-
}
|
|
38
|
-
get isDefaultImport() {
|
|
39
|
-
return /[$A-Z_a-z][\w$]*/.test(this.codeWithoutTypeKeyword) && !this.isNamespaceImport;
|
|
40
|
-
}
|
|
41
|
-
get isNamedImport() {
|
|
42
|
-
return /{[^}]+}/.test(this.codeWithoutTypeKeyword);
|
|
43
|
-
}
|
|
44
|
-
get isMixedImport() {
|
|
45
|
-
return /([$A-Z_a-z][\w$]*),\s*{[^}]+}/.test(this.codeWithoutTypeKeyword);
|
|
46
|
-
}
|
|
47
|
-
get isNamespaceImport() {
|
|
48
|
-
return /\*\s+as\s+([$A-Z_a-z][\w$]*)/.test(this.codeWithoutTypeKeyword);
|
|
49
|
-
}
|
|
50
|
-
get namedImportsArray() {
|
|
51
|
-
return this.code.replace("\n", " ").match(/{([^}]+)}/)?.[1].split(",").map((specifier) => {
|
|
52
|
-
return specifier.trim();
|
|
53
|
-
}).filter((s) => {
|
|
54
|
-
return !!s;
|
|
55
|
-
}) || [];
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Splits the import specifier into an array of specifiers as if to split into individual import statements.
|
|
59
|
-
* @example `{A,B} => {A},{B}`
|
|
60
|
-
*/
|
|
61
|
-
splitSpecifiers() {
|
|
62
|
-
return this.isNamedImport ? this.namedImportsArray.map((n) => {
|
|
63
|
-
return this.code.startsWith("type ") ? `type { ${n} }` : `{ ${n} }`;
|
|
64
|
-
}) : [
|
|
65
|
-
this.code
|
|
66
|
-
];
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Returns the keys added to the global namespace by this import specifier.
|
|
70
|
-
*/
|
|
71
|
-
get importedNamesArray() {
|
|
72
|
-
return this.codeWithoutTypeKeyword.replace(/[\w*]+ as \w+/, (m) => {
|
|
73
|
-
return m.split(" as ")[1];
|
|
74
|
-
}).replaceAll(/[{}]/g, " ").split(",").map((s) => {
|
|
75
|
-
return s.trim();
|
|
76
|
-
}).filter(Boolean);
|
|
77
|
-
}
|
|
78
|
-
get defaultImport() {
|
|
79
|
-
return this.codeWithoutTypeKeyword.match(/^([$A-Z_a-z][\w$]*)\s*(,|)/)?.[1] || void 0;
|
|
80
|
-
}
|
|
81
|
-
get namespaceImport() {
|
|
82
|
-
return this.codeWithoutTypeKeyword.match(/^\*\s+as\s+([$A-Z_a-z][\w$]*)/)?.[1] || void 0;
|
|
83
|
-
}
|
|
84
|
-
get hasNamedImport() {
|
|
85
|
-
return !!this.namedImportsArray.length;
|
|
86
|
-
}
|
|
87
|
-
get hasDefaultImport() {
|
|
88
|
-
return !!this.defaultImport;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
ImportSpecifiers = _ts_decorate([
|
|
92
|
-
Parenting.compose
|
|
93
|
-
], ImportSpecifiers);
|
|
94
|
-
|
|
95
|
-
export { ImportSpecifiers };
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var CodeBlock = require('../CodeBlock');
|
|
4
|
-
var ImportKeywords = require('./ImportKeywords');
|
|
5
|
-
var ImportSpecifiers = require('./ImportSpecifiers');
|
|
6
|
-
var composition = require('@mono/composition');
|
|
7
|
-
var ModuleSpecifier = require('./ModuleSpecifier');
|
|
8
|
-
var TsFile = require('../../file/TsFile');
|
|
9
|
-
var decorators = require('@mono/decorators');
|
|
10
|
-
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
14
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
-
}
|
|
19
|
-
__name(_ts_decorate, "_ts_decorate");
|
|
20
|
-
function _ts_metadata(k, v) {
|
|
21
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
-
}
|
|
23
|
-
__name(_ts_metadata, "_ts_metadata");
|
|
24
|
-
class ImportStatement extends CodeBlock.CodeBlock {
|
|
25
|
-
static {
|
|
26
|
-
__name(this, "ImportStatement");
|
|
27
|
-
}
|
|
28
|
-
static inspector = composition.Inspector.compose(ImportStatement, {
|
|
29
|
-
keys: [
|
|
30
|
-
"keywords",
|
|
31
|
-
"specifiers",
|
|
32
|
-
"module"
|
|
33
|
-
],
|
|
34
|
-
inspect: {
|
|
35
|
-
compact: true
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
toOneLine() {
|
|
39
|
-
return this.code.replaceAll(/\r?\n/g, " ").replaceAll(/\s{2,}/g, " ").replace(/,\s+}/, " }");
|
|
40
|
-
}
|
|
41
|
-
get keywords() {
|
|
42
|
-
const match = this.code.match(/^import\s+(?:type\s+)?/);
|
|
43
|
-
const code = match[0].trim();
|
|
44
|
-
return new ImportKeywords.ImportKeywords(this, this.codeIndexRangeOf(code));
|
|
45
|
-
}
|
|
46
|
-
get specifiers() {
|
|
47
|
-
const match = this.code.match(/import\s+([^"']+)\s+from\s+/);
|
|
48
|
-
const code = match ? match[1].trim() : "";
|
|
49
|
-
if (!code) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
return new ImportSpecifiers.ImportSpecifiers(this, this.codeIndexRangeOf(code));
|
|
53
|
-
}
|
|
54
|
-
get module() {
|
|
55
|
-
const match = this.code.match(/(?:from|import)\s+["']([^"']+)["']/);
|
|
56
|
-
const code = match[1].trim();
|
|
57
|
-
return new ModuleSpecifier.ModuleSpecifier(this, this.codeIndexRangeOf(code));
|
|
58
|
-
}
|
|
59
|
-
split() {
|
|
60
|
-
return this.specifiers?.splitSpecifiers().map((specifier) => {
|
|
61
|
-
return `import ${specifier} from '${this.module.from}'`;
|
|
62
|
-
}) ?? [
|
|
63
|
-
this.code
|
|
64
|
-
];
|
|
65
|
-
}
|
|
66
|
-
get filepath() {
|
|
67
|
-
return this.getParentDeep(TsFile.TsFile).path;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
_ts_decorate([
|
|
71
|
-
decorators.lazyProp,
|
|
72
|
-
_ts_metadata("design:type", void 0),
|
|
73
|
-
_ts_metadata("design:paramtypes", [])
|
|
74
|
-
], ImportStatement.prototype, "keywords", null);
|
|
75
|
-
_ts_decorate([
|
|
76
|
-
decorators.lazyProp,
|
|
77
|
-
_ts_metadata("design:type", void 0),
|
|
78
|
-
_ts_metadata("design:paramtypes", [])
|
|
79
|
-
], ImportStatement.prototype, "specifiers", null);
|
|
80
|
-
_ts_decorate([
|
|
81
|
-
decorators.lazyProp,
|
|
82
|
-
_ts_metadata("design:type", void 0),
|
|
83
|
-
_ts_metadata("design:paramtypes", [])
|
|
84
|
-
], ImportStatement.prototype, "module", null);
|
|
85
|
-
ImportStatement = _ts_decorate([
|
|
86
|
-
composition.Parenting.compose
|
|
87
|
-
], ImportStatement);
|
|
88
|
-
|
|
89
|
-
exports.ImportStatement = ImportStatement;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import '../../AbstractBase-J4h6nW8k.cjs';
|
|
2
|
-
import '../CodeBlock.cjs';
|
|
3
|
-
export { b as ImportStatement } from '../../MonoRepo-BgdabVzT.cjs';
|
|
4
|
-
import 'util';
|
|
5
|
-
import 'mnemonist';
|
|
6
|
-
import '../AbstractCode.cjs';
|
|
7
|
-
import '../../is-never.d-CgQ1j0-8.cjs';
|
|
8
|
-
import 'typescript';
|
|
9
|
-
import 'depcheck';
|
|
10
|
-
import 'fs';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import '../../AbstractBase-J4h6nW8k.js';
|
|
2
|
-
import '../CodeBlock.js';
|
|
3
|
-
export { b as ImportStatement } from '../../MonoRepo-BFFUDAYn.js';
|
|
4
|
-
import 'util';
|
|
5
|
-
import 'mnemonist';
|
|
6
|
-
import '../AbstractCode.js';
|
|
7
|
-
import '../../is-never.d-CgQ1j0-8.js';
|
|
8
|
-
import 'typescript';
|
|
9
|
-
import 'depcheck';
|
|
10
|
-
import 'fs';
|