@teambit/component-issues 0.0.136 → 0.0.138
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/circular-dependencies.ts +11 -0
- package/component-issue.ts +75 -0
- package/dist/circular-dependencies.js +12 -26
- package/dist/circular-dependencies.js.map +1 -1
- package/dist/component-issue.js +57 -79
- package/dist/component-issue.js.map +1 -1
- package/dist/duplicate-component-and-package.js +12 -26
- package/dist/duplicate-component-and-package.js.map +1 -1
- package/dist/external-env-without-version.js +15 -29
- package/dist/external-env-without-version.js.map +1 -1
- package/dist/import-non-main-files.js +10 -23
- package/dist/import-non-main-files.js.map +1 -1
- package/dist/index.js +10 -81
- package/dist/index.js.map +1 -1
- package/dist/issues-list.js +131 -263
- package/dist/issues-list.js.map +1 -1
- package/dist/legacy-inside-harmony.js +12 -26
- package/dist/legacy-inside-harmony.js.map +1 -1
- package/dist/merge-config-has-conflict.js +12 -26
- package/dist/merge-config-has-conflict.js.map +1 -1
- package/dist/missing-dependencies-on-fs.js +9 -22
- package/dist/missing-dependencies-on-fs.js.map +1 -1
- package/dist/missing-dists.js +12 -26
- package/dist/missing-dists.js.map +1 -1
- package/dist/missing-links-from-nm-to-src.js +12 -26
- package/dist/missing-links-from-nm-to-src.js.map +1 -1
- package/dist/missing-manually-configured-packages.js +12 -26
- package/dist/missing-manually-configured-packages.js.map +1 -1
- package/dist/missing-packages-dependencies-on-fs.js +14 -25
- package/dist/missing-packages-dependencies-on-fs.js.map +1 -1
- package/dist/multiple-envs.js +12 -27
- package/dist/multiple-envs.js.map +1 -1
- package/dist/non-loaded-env.js +12 -26
- package/dist/non-loaded-env.js.map +1 -1
- package/dist/parse-errors.js +9 -22
- package/dist/parse-errors.js.map +1 -1
- package/dist/relative-components-authored.js +36 -55
- package/dist/relative-components-authored.js.map +1 -1
- package/dist/relative-components.js +13 -26
- package/dist/relative-components.js.map +1 -1
- package/dist/removed-dependencies.js +12 -27
- package/dist/removed-dependencies.js.map +1 -1
- package/dist/resolve-errors.js +9 -22
- package/dist/resolve-errors.js.map +1 -1
- package/dist/tsconfig.json +32 -0
- package/dist/untracked-dependencies.js +32 -47
- package/dist/untracked-dependencies.js.map +1 -1
- package/duplicate-component-and-package.ts +11 -0
- package/external-env-without-version.ts +19 -0
- package/import-non-main-files.ts +8 -0
- package/index.ts +5 -0
- package/issues-list.ts +162 -0
- package/legacy-inside-harmony.ts +11 -0
- package/merge-config-has-conflict.ts +11 -0
- package/missing-dependencies-on-fs.ts +7 -0
- package/missing-dists.ts +11 -0
- package/missing-links-from-nm-to-src.ts +11 -0
- package/missing-manually-configured-packages.ts +10 -0
- package/missing-packages-dependencies-on-fs.ts +18 -0
- package/multiple-envs.ts +12 -0
- package/non-loaded-env.ts +11 -0
- package/package.json +7 -39
- package/parse-errors.ts +7 -0
- package/relative-components-authored.ts +49 -0
- package/relative-components.ts +12 -0
- package/removed-dependencies.ts +11 -0
- package/resolve-errors.ts +7 -0
- package/tsconfig.json +2 -11
- package/untracked-dependencies.ts +41 -0
- /package/dist/{preview-1703387662836.js → preview-1703647408454.js} +0 -0
package/parse-errors.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ComponentID } from '@teambit/component-id';
|
|
2
|
+
import { ComponentIssue } from './component-issue';
|
|
3
|
+
|
|
4
|
+
export type RelativeComponentsAuthoredEntry = {
|
|
5
|
+
importSource: string;
|
|
6
|
+
componentId: ComponentID;
|
|
7
|
+
relativePath: {
|
|
8
|
+
sourceRelativePath: string;
|
|
9
|
+
importSpecifiers?: any[];
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export class RelativeComponentsAuthored extends ComponentIssue {
|
|
14
|
+
description = 'components with relative import statements found';
|
|
15
|
+
solution = 'replace to module paths or use "bit link --rewire" to replace';
|
|
16
|
+
data: { [fileName: string]: RelativeComponentsAuthoredEntry[] } = {};
|
|
17
|
+
isCacheBlocker = false;
|
|
18
|
+
formatDataFunction = relativeComponentsAuthoredIssuesToString;
|
|
19
|
+
|
|
20
|
+
serialize(): string {
|
|
21
|
+
const obj = Object.keys(this.data).reduce((acc, fileName) => {
|
|
22
|
+
acc[fileName] = this.data[fileName].map((record) => ({
|
|
23
|
+
importSource: record.importSource,
|
|
24
|
+
componentId: record.componentId.serialize(),
|
|
25
|
+
relativePath: record.relativePath,
|
|
26
|
+
}));
|
|
27
|
+
return acc;
|
|
28
|
+
}, {});
|
|
29
|
+
return JSON.stringify(obj);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
deserialize(dataStr: string) {
|
|
33
|
+
const data = JSON.parse(dataStr);
|
|
34
|
+
Object.keys(data).forEach((fileName) => {
|
|
35
|
+
data[fileName] = data[fileName].map((record) => ({
|
|
36
|
+
importSource: record.importSource,
|
|
37
|
+
componentId: ComponentID.deserialize(record.componentId),
|
|
38
|
+
relativePath: record.relativePath,
|
|
39
|
+
}));
|
|
40
|
+
});
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function relativeComponentsAuthoredIssuesToString(relativeEntries: RelativeComponentsAuthoredEntry[]) {
|
|
46
|
+
const stringifyEntry = (entry: RelativeComponentsAuthoredEntry) =>
|
|
47
|
+
`"${entry.importSource}" (${entry.componentId.toString()})`;
|
|
48
|
+
return relativeEntries.map(stringifyEntry).join(', ');
|
|
49
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentID } from '@teambit/component-id';
|
|
2
|
+
import { ComponentIssue, deserializeWithBitId } from './component-issue';
|
|
3
|
+
|
|
4
|
+
export class RelativeComponents extends ComponentIssue {
|
|
5
|
+
description = 'components with relative import statements found';
|
|
6
|
+
solution = 'use module paths for imported components';
|
|
7
|
+
data: { [filePath: string]: ComponentID[] } = {};
|
|
8
|
+
isCacheBlocker = false;
|
|
9
|
+
deserialize(data: string) {
|
|
10
|
+
return deserializeWithBitId(data);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentIssue, ISSUE_FORMAT_SPACE } from './component-issue';
|
|
2
|
+
|
|
3
|
+
export class RemovedDependencies extends ComponentIssue {
|
|
4
|
+
description = 'removed dependencies';
|
|
5
|
+
solution = 'run "bit install <missing-dep>" or remove any unneeded references to that component from your code';
|
|
6
|
+
data: string[]; // deps ids
|
|
7
|
+
isTagBlocker = true;
|
|
8
|
+
dataToString() {
|
|
9
|
+
return ISSUE_FORMAT_SPACE + this.data.join(', ');
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentIssue } from './component-issue';
|
|
2
|
+
|
|
3
|
+
export class ResolveErrors extends ComponentIssue {
|
|
4
|
+
description = 'error found while resolving the file dependencies';
|
|
5
|
+
solution = 'see the log for the full error';
|
|
6
|
+
data: { [filePath: string]: string } = {};
|
|
7
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
"es2019",
|
|
5
5
|
"DOM",
|
|
6
6
|
"ES6",
|
|
7
|
-
"DOM.Iterable"
|
|
8
|
-
"ScriptHost"
|
|
7
|
+
"DOM.Iterable"
|
|
9
8
|
],
|
|
10
9
|
"target": "es2015",
|
|
11
10
|
"module": "CommonJS",
|
|
@@ -20,18 +19,10 @@
|
|
|
20
19
|
"moduleResolution": "node",
|
|
21
20
|
"esModuleInterop": true,
|
|
22
21
|
"rootDir": ".",
|
|
23
|
-
"resolveJsonModule": true
|
|
24
|
-
"emitDeclarationOnly": true,
|
|
25
|
-
"emitDecoratorMetadata": true,
|
|
26
|
-
"allowSyntheticDefaultImports": true,
|
|
27
|
-
"strictPropertyInitialization": false,
|
|
28
|
-
"strict": true,
|
|
29
|
-
"noImplicitAny": false,
|
|
30
|
-
"preserveConstEnums": true
|
|
22
|
+
"resolveJsonModule": true
|
|
31
23
|
},
|
|
32
24
|
"exclude": [
|
|
33
25
|
"dist",
|
|
34
|
-
"esm.mjs",
|
|
35
26
|
"package.json"
|
|
36
27
|
],
|
|
37
28
|
"include": [
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { ComponentIssue, ISSUE_FORMAT_SPACE, ISSUE_FORMAT_SPACE_COUNT } from './component-issue';
|
|
3
|
+
|
|
4
|
+
export const MISSING_NESTED_DEPS_SPACE = ' '.repeat(ISSUE_FORMAT_SPACE_COUNT + 2);
|
|
5
|
+
|
|
6
|
+
interface UntrackedFileEntry {
|
|
7
|
+
relativePath: string;
|
|
8
|
+
existing: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface UntrackedFileDependencyEntry {
|
|
12
|
+
nested: boolean;
|
|
13
|
+
untrackedFiles: Array<UntrackedFileEntry>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class UntrackedDependencies extends ComponentIssue {
|
|
17
|
+
description = 'untracked file dependencies';
|
|
18
|
+
solution = 'use "bit add <file>" to track untracked files as components';
|
|
19
|
+
data: { [filePath: string]: UntrackedFileDependencyEntry } = {};
|
|
20
|
+
dataToString() {
|
|
21
|
+
return Object.keys(this.data)
|
|
22
|
+
.map((k) => {
|
|
23
|
+
let space = ISSUE_FORMAT_SPACE;
|
|
24
|
+
if (this.data[k].nested) {
|
|
25
|
+
space = MISSING_NESTED_DEPS_SPACE;
|
|
26
|
+
}
|
|
27
|
+
return `${space}${k} -> ${untrackedFilesComponentIssueToString(this.data[k])}`;
|
|
28
|
+
})
|
|
29
|
+
.join('\n');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function untrackedFilesComponentIssueToString(value: UntrackedFileDependencyEntry) {
|
|
34
|
+
const colorizedMap = value.untrackedFiles.map((curr) => {
|
|
35
|
+
if (curr.existing) {
|
|
36
|
+
return `${chalk.yellow(curr.relativePath)}`;
|
|
37
|
+
}
|
|
38
|
+
return curr.relativePath;
|
|
39
|
+
});
|
|
40
|
+
return colorizedMap.join(', ');
|
|
41
|
+
}
|
|
File without changes
|