@teambit/typescript 0.0.568 → 0.0.569
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/cmds/check-types.cmd.ts +44 -0
- package/cmds/init.cmd.ts +0 -0
- package/package-tar/teambit-typescript-0.0.569.tgz +0 -0
- package/package.json +17 -32
- package/types/asset.d.ts +29 -0
- package/types/style.d.ts +42 -0
- package/typescript.composition.tsx +7 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
+
import { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';
|
|
3
|
+
import { Logger } from '@teambit/logger';
|
|
4
|
+
import { Workspace } from '@teambit/workspace';
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
import { TypescriptMain } from '../typescript.main.runtime';
|
|
7
|
+
|
|
8
|
+
export class CheckTypesCmd implements Command {
|
|
9
|
+
name = 'check-types [pattern]';
|
|
10
|
+
description = 'check typescript types';
|
|
11
|
+
alias = '';
|
|
12
|
+
group = 'development';
|
|
13
|
+
options = [
|
|
14
|
+
['a', 'all', 'check-types for all components, not only modified and new'],
|
|
15
|
+
['', 'strict', 'in case issues found, exit with code 1'],
|
|
16
|
+
] as CommandOptions;
|
|
17
|
+
|
|
18
|
+
constructor(private typescript: TypescriptMain, private workspace: Workspace, private logger: Logger) {}
|
|
19
|
+
|
|
20
|
+
async report([userPattern]: [string], { all = false, strict = false }: { all: boolean; strict: boolean }) {
|
|
21
|
+
if (!this.workspace) throw new ConsumerNotFound();
|
|
22
|
+
const components = await this.workspace.getComponentsByUserInput(all, userPattern);
|
|
23
|
+
this.logger.setStatusLine(`checking types for ${components.length} components`);
|
|
24
|
+
const files = this.typescript.getSupportedFilesForTsserver(components);
|
|
25
|
+
await this.typescript.initTsserverClientFromWorkspace({ printTypeErrors: true }, files);
|
|
26
|
+
const tsserver = this.typescript.getTsserverClient();
|
|
27
|
+
if (!tsserver) throw new Error(`unable to start tsserver`);
|
|
28
|
+
const start = Date.now();
|
|
29
|
+
await tsserver.getDiagnostic(files);
|
|
30
|
+
const end = Date.now() - start;
|
|
31
|
+
const msg = `completed type checking (${end / 1000} sec)`;
|
|
32
|
+
tsserver.killTsServer();
|
|
33
|
+
if (tsserver.lastDiagnostics.length) {
|
|
34
|
+
return {
|
|
35
|
+
code: strict ? 1 : 0,
|
|
36
|
+
data: chalk.red(`${msg}. found errors in ${tsserver.lastDiagnostics.length} files.`),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
code: 0,
|
|
41
|
+
data: chalk.green(`${msg}. no errors were found.`),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
package/cmds/init.cmd.ts
ADDED
|
File without changes
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/typescript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.569",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/typescript/typescript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.typescript",
|
|
8
8
|
"name": "typescript",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.569"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@teambit/harmony": "0.2.11",
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
"chalk": "2.4.2",
|
|
18
18
|
"@babel/runtime": "7.12.18",
|
|
19
19
|
"core-js": "^3.0.0",
|
|
20
|
-
"@teambit/compiler": "0.0.
|
|
21
|
-
"@teambit/typescript.modules.ts-config-mutator": "0.0.
|
|
22
|
-
"@teambit/bit-error": "0.0.
|
|
23
|
-
"@teambit/builder": "0.0.
|
|
24
|
-
"@teambit/isolator": "0.0.
|
|
25
|
-
"@teambit/logger": "0.0.
|
|
26
|
-
"@teambit/component": "0.0.
|
|
27
|
-
"@teambit/schema": "0.0.
|
|
28
|
-
"@teambit/cli": "0.0.
|
|
29
|
-
"@teambit/pkg": "0.0.
|
|
30
|
-
"@teambit/ts-server": "0.0.
|
|
31
|
-
"@teambit/workspace": "0.0.
|
|
20
|
+
"@teambit/compiler": "0.0.569",
|
|
21
|
+
"@teambit/typescript.modules.ts-config-mutator": "0.0.52",
|
|
22
|
+
"@teambit/bit-error": "0.0.381",
|
|
23
|
+
"@teambit/builder": "0.0.569",
|
|
24
|
+
"@teambit/isolator": "0.0.569",
|
|
25
|
+
"@teambit/logger": "0.0.481",
|
|
26
|
+
"@teambit/component": "0.0.569",
|
|
27
|
+
"@teambit/schema": "0.0.569",
|
|
28
|
+
"@teambit/cli": "0.0.395",
|
|
29
|
+
"@teambit/pkg": "0.0.569",
|
|
30
|
+
"@teambit/ts-server": "0.0.18",
|
|
31
|
+
"@teambit/workspace": "0.0.569"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"chai": "4.3.0",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"@types/jest": "^26.0.0",
|
|
41
41
|
"@types/react-dom": "^17.0.5",
|
|
42
42
|
"@types/node": "12.20.4",
|
|
43
|
-
"@teambit/typescript.aspect-docs.typescript": "0.0.
|
|
43
|
+
"@teambit/typescript.aspect-docs.typescript": "0.0.115"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@teambit/legacy": "1.0.
|
|
46
|
+
"@teambit/legacy": "1.0.181",
|
|
47
47
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
48
48
|
"react": "^16.8.0 || ^17.0.0"
|
|
49
49
|
},
|
|
@@ -71,27 +71,12 @@
|
|
|
71
71
|
"react": "-"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@teambit/legacy": "1.0.
|
|
74
|
+
"@teambit/legacy": "1.0.181",
|
|
75
75
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
76
76
|
"react": "^16.8.0 || ^17.0.0"
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
-
"files": [
|
|
81
|
-
"dist",
|
|
82
|
-
"!dist/tsconfig.tsbuildinfo",
|
|
83
|
-
"**/*.md",
|
|
84
|
-
"**/*.mdx",
|
|
85
|
-
"**/*.js",
|
|
86
|
-
"**/*.json",
|
|
87
|
-
"**/*.sass",
|
|
88
|
-
"**/*.scss",
|
|
89
|
-
"**/*.less",
|
|
90
|
-
"**/*.css",
|
|
91
|
-
"**/*.css",
|
|
92
|
-
"**/*.jpeg",
|
|
93
|
-
"**/*.gif"
|
|
94
|
-
],
|
|
95
80
|
"private": false,
|
|
96
81
|
"engines": {
|
|
97
82
|
"node": ">=12.22.0"
|
package/types/asset.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare module '*.png' {
|
|
2
|
+
const value: any;
|
|
3
|
+
export = value;
|
|
4
|
+
}
|
|
5
|
+
declare module '*.svg' {
|
|
6
|
+
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
|
+
|
|
8
|
+
export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
|
|
9
|
+
const src: string;
|
|
10
|
+
export default src;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// @TODO Gilad
|
|
14
|
+
declare module '*.jpg' {
|
|
15
|
+
const value: any;
|
|
16
|
+
export = value;
|
|
17
|
+
}
|
|
18
|
+
declare module '*.jpeg' {
|
|
19
|
+
const value: any;
|
|
20
|
+
export = value;
|
|
21
|
+
}
|
|
22
|
+
declare module '*.gif' {
|
|
23
|
+
const value: any;
|
|
24
|
+
export = value;
|
|
25
|
+
}
|
|
26
|
+
declare module '*.bmp' {
|
|
27
|
+
const value: any;
|
|
28
|
+
export = value;
|
|
29
|
+
}
|
package/types/style.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
declare module '*.module.css' {
|
|
2
|
+
const classes: { readonly [key: string]: string };
|
|
3
|
+
export default classes;
|
|
4
|
+
}
|
|
5
|
+
declare module '*.module.scss' {
|
|
6
|
+
const classes: { readonly [key: string]: string };
|
|
7
|
+
export default classes;
|
|
8
|
+
}
|
|
9
|
+
declare module '*.module.sass' {
|
|
10
|
+
const classes: { readonly [key: string]: string };
|
|
11
|
+
export default classes;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare module '*.module.less' {
|
|
15
|
+
const classes: { readonly [key: string]: string };
|
|
16
|
+
export default classes;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare module '*.less' {
|
|
20
|
+
const classes: { readonly [key: string]: string };
|
|
21
|
+
export default classes;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare module '*.css' {
|
|
25
|
+
const classes: { readonly [key: string]: string };
|
|
26
|
+
export default classes;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare module '*.sass' {
|
|
30
|
+
const classes: { readonly [key: string]: string };
|
|
31
|
+
export default classes;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare module '*.scss' {
|
|
35
|
+
const classes: { readonly [key: string]: string };
|
|
36
|
+
export default classes;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare module '*.mdx' {
|
|
40
|
+
const component: any;
|
|
41
|
+
export default component;
|
|
42
|
+
}
|