@teambit/validator 0.0.0-2acf50c609da9a80d35091c6a35460916350da90

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.
@@ -0,0 +1,4 @@
1
+ import { ValidatorAspect } from './validator.aspect';
2
+ export type { ValidatorMain } from './validator.main.runtime';
3
+ export { ValidatorAspect };
4
+ export default ValidatorAspect;
package/dist/index.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ValidatorAspect", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _validator().ValidatorAspect;
10
+ }
11
+ });
12
+ exports.default = void 0;
13
+ function _validator() {
14
+ const data = require("./validator.aspect");
15
+ _validator = function () {
16
+ return data;
17
+ };
18
+ return data;
19
+ }
20
+ var _default = exports.default = _validator().ValidatorAspect;
21
+
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_validator","data","require","_default","exports","default","ValidatorAspect"],"sources":["index.ts"],"sourcesContent":["import { ValidatorAspect } from './validator.aspect';\nexport type { ValidatorMain } from './validator.main.runtime';\nexport { ValidatorAspect };\nexport default ValidatorAspect;\n"],"mappings":";;;;;;;;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAqD,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAGtCC,4BAAe","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ ;
2
+ ;
3
+
4
+ export const compositions = [];
5
+ export const overview = [];
6
+
7
+ export const compositions_metadata = {"compositions":[]};
@@ -0,0 +1,27 @@
1
+ import type { Command, CommandOptions } from '@teambit/cli';
2
+ import type { Logger } from '@teambit/logger';
3
+ import type { Workspace } from '@teambit/workspace';
4
+ import type { ValidatorMain } from './validator.main.runtime';
5
+ export declare class ValidateCmd implements Command {
6
+ private validator;
7
+ private workspace;
8
+ private logger;
9
+ name: string;
10
+ description: string;
11
+ extendedDescription: string;
12
+ arguments: {
13
+ name: string;
14
+ description: string;
15
+ }[];
16
+ alias: string;
17
+ group: string;
18
+ options: CommandOptions;
19
+ constructor(validator: ValidatorMain, workspace: Workspace, logger: Logger);
20
+ report([pattern]: [string], { all, continueOnError }: {
21
+ all: boolean;
22
+ continueOnError: boolean;
23
+ }): Promise<{
24
+ code: number;
25
+ data: string;
26
+ }>;
27
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ValidateCmd = void 0;
7
+ function _workspace() {
8
+ const data = require("@teambit/workspace");
9
+ _workspace = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _chalk() {
15
+ const data = _interopRequireDefault(require("chalk"));
16
+ _chalk = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _legacy() {
22
+ const data = require("@teambit/legacy.constants");
23
+ _legacy = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
29
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
30
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
31
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
32
+ class ValidateCmd {
33
+ constructor(validator, workspace, logger) {
34
+ this.validator = validator;
35
+ this.workspace = workspace;
36
+ this.logger = logger;
37
+ _defineProperty(this, "name", 'validate [component-pattern]');
38
+ _defineProperty(this, "description", 'run type-checking, linting, and testing in sequence');
39
+ _defineProperty(this, "extendedDescription", `validates components by running check-types, lint, and test commands in sequence.
40
+ stops at the first failure and returns a non-zero exit code.
41
+ by default validates only new and modified components. use --all to validate all components.`);
42
+ _defineProperty(this, "arguments", [{
43
+ name: 'component-pattern',
44
+ description: _legacy().COMPONENT_PATTERN_HELP
45
+ }]);
46
+ _defineProperty(this, "alias", '');
47
+ _defineProperty(this, "group", 'testing');
48
+ _defineProperty(this, "options", [['a', 'all', 'validate all components, not only modified and new'], ['c', 'continue-on-error', 'run all validation checks even when errors are found']]);
49
+ }
50
+ async report([pattern], {
51
+ all = false,
52
+ continueOnError = false
53
+ }) {
54
+ if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
55
+ this.logger.console(_chalk().default.bold('\n🔍 Running validation checks...\n'));
56
+ const startTime = Date.now();
57
+ const components = await this.workspace.getComponentsByUserInput(pattern ? false : all, pattern, true);
58
+ if (components.length === 0) {
59
+ this.logger.console(_chalk().default.yellow('No components found to validate'));
60
+ return {
61
+ code: 0,
62
+ data: 'No components found to validate'
63
+ };
64
+ }
65
+ this.logger.console(`Validating ${components.length} component(s)\n`);
66
+ const result = await this.validator.validate(components, continueOnError);
67
+ const totalTime = ((Date.now() - startTime) / 1000).toFixed(2);
68
+ if (result.code !== 0) {
69
+ this.logger.console(_chalk().default.red(`\n✗ Validation failed\n`));
70
+ return {
71
+ code: result.code,
72
+ data: `Validation failed after ${totalTime} seconds`
73
+ };
74
+ }
75
+ this.logger.console(_chalk().default.green(`\n✓ All validation checks passed in ${totalTime} seconds\n`));
76
+ return {
77
+ code: 0,
78
+ data: `Validation completed successfully in ${totalTime} seconds`
79
+ };
80
+ }
81
+ }
82
+ exports.ValidateCmd = ValidateCmd;
83
+
84
+ //# sourceMappingURL=validate.cmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_workspace","data","require","_chalk","_interopRequireDefault","_legacy","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ValidateCmd","constructor","validator","workspace","logger","name","description","COMPONENT_PATTERN_HELP","report","pattern","all","continueOnError","OutsideWorkspaceError","console","chalk","bold","startTime","Date","now","components","getComponentsByUserInput","length","yellow","code","result","validate","totalTime","toFixed","red","green","exports"],"sources":["validate.cmd.ts"],"sourcesContent":["import type { Command, CommandOptions } from '@teambit/cli';\nimport type { Logger } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { OutsideWorkspaceError } from '@teambit/workspace';\nimport chalk from 'chalk';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { ValidatorMain } from './validator.main.runtime';\n\nexport class ValidateCmd implements Command {\n name = 'validate [component-pattern]';\n description = 'run type-checking, linting, and testing in sequence';\n extendedDescription = `validates components by running check-types, lint, and test commands in sequence.\nstops at the first failure and returns a non-zero exit code.\nby default validates only new and modified components. use --all to validate all components.`;\n arguments = [{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP }];\n alias = '';\n group = 'testing';\n options = [\n ['a', 'all', 'validate all components, not only modified and new'],\n ['c', 'continue-on-error', 'run all validation checks even when errors are found'],\n ] as CommandOptions;\n\n constructor(\n private validator: ValidatorMain,\n private workspace: Workspace,\n private logger: Logger\n ) {}\n\n async report(\n [pattern]: [string],\n { all = false, continueOnError = false }: { all: boolean; continueOnError: boolean }\n ) {\n if (!this.workspace) throw new OutsideWorkspaceError();\n\n this.logger.console(chalk.bold('\\n🔍 Running validation checks...\\n'));\n\n const startTime = Date.now();\n const components = await this.workspace.getComponentsByUserInput(pattern ? false : all, pattern, true);\n\n if (components.length === 0) {\n this.logger.console(chalk.yellow('No components found to validate'));\n return { code: 0, data: 'No components found to validate' };\n }\n\n this.logger.console(`Validating ${components.length} component(s)\\n`);\n\n const result = await this.validator.validate(components, continueOnError);\n const totalTime = ((Date.now() - startTime) / 1000).toFixed(2);\n\n if (result.code !== 0) {\n this.logger.console(chalk.red(`\\n✗ Validation failed\\n`));\n return { code: result.code, data: `Validation failed after ${totalTime} seconds` };\n }\n\n this.logger.console(chalk.green(`\\n✓ All validation checks passed in ${totalTime} seconds\\n`));\n return { code: 0, data: `Validation completed successfully in ${totalTime} seconds` };\n }\n}\n"],"mappings":";;;;;;AAGA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmE,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CA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C,GAAG,EAAED,OAAO,EAAE,IAAI,CAAC;IAEtG,IAAIU,UAAU,CAACE,MAAM,KAAK,CAAC,EAAE;MAC3B,IAAI,CAACjB,MAAM,CAACS,OAAO,CAACC,gBAAK,CAACQ,MAAM,CAAC,iCAAiC,CAAC,CAAC;MACpE,OAAO;QAAEC,IAAI,EAAE,CAAC;QAAEjD,IAAI,EAAE;MAAkC,CAAC;IAC7D;IAEA,IAAI,CAAC8B,MAAM,CAACS,OAAO,CAAC,cAAcM,UAAU,CAACE,MAAM,iBAAiB,CAAC;IAErE,MAAMG,MAAM,GAAG,MAAM,IAAI,CAACtB,SAAS,CAACuB,QAAQ,CAACN,UAAU,EAAER,eAAe,CAAC;IACzE,MAAMe,SAAS,GAAG,CAAC,CAACT,IAAI,CAACC,GAAG,CAAC,CAAC,GAAGF,SAAS,IAAI,IAAI,EAAEW,OAAO,CAAC,CAAC,CAAC;IAE9D,IAAIH,MAAM,CAACD,IAAI,KAAK,CAAC,EAAE;MACrB,IAAI,CAACnB,MAAM,CAACS,OAAO,CAACC,gBAAK,CAACc,GAAG,CAAC,yBAAyB,CAAC,CAAC;MACzD,OAAO;QAAEL,IAAI,EAAEC,MAAM,CAACD,IAAI;QAAEjD,IAAI,EAAE,2BAA2BoD,SAAS;MAAW,CAAC;IACpF;IAEA,IAAI,CAACtB,MAAM,CAACS,OAAO,CAACC,gBAAK,CAACe,KAAK,CAAC,uCAAuCH,SAAS,YAAY,CAAC,CAAC;IAC9F,OAAO;MAAEH,IAAI,EAAE,CAAC;MAAEjD,IAAI,EAAE,wCAAwCoD,SAAS;IAAW,CAAC;EACvF;AACF;AAACI,OAAA,CAAA9B,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import { Aspect } from '@teambit/harmony';
2
+ export declare const ValidatorAspect: Aspect;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ValidatorAspect = void 0;
7
+ function _harmony() {
8
+ const data = require("@teambit/harmony");
9
+ _harmony = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ const ValidatorAspect = exports.ValidatorAspect = _harmony().Aspect.create({
15
+ id: 'teambit.defender/validator'
16
+ });
17
+
18
+ //# sourceMappingURL=validator.aspect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_harmony","data","require","ValidatorAspect","exports","Aspect","create","id"],"sources":["validator.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const ValidatorAspect = Aspect.create({\n id: 'teambit.defender/validator',\n});\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAGE,iBAAM,CAACC,MAAM,CAAC;EAC3CC,EAAE,EAAE;AACN,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ import type { CLIMain } from '@teambit/cli';
2
+ import type { LoggerMain, Logger } from '@teambit/logger';
3
+ import type { Workspace } from '@teambit/workspace';
4
+ import type { TypescriptMain } from '@teambit/typescript';
5
+ import type { LinterMain } from '@teambit/linter';
6
+ import type { TesterMain } from '@teambit/tester';
7
+ import type { Component } from '@teambit/component';
8
+ export type ValidationResult = {
9
+ code: number;
10
+ message: string;
11
+ };
12
+ export declare class ValidatorMain {
13
+ private workspace;
14
+ private typescript;
15
+ private linter;
16
+ private tester;
17
+ private logger;
18
+ static runtime: import("@teambit/harmony").RuntimeDefinition;
19
+ static dependencies: import("@teambit/harmony").Aspect[];
20
+ constructor(workspace: Workspace, typescript: TypescriptMain, linter: LinterMain, tester: TesterMain, logger: Logger);
21
+ validate(components: Component[], continueOnError?: boolean): Promise<ValidationResult>;
22
+ private checkTypes;
23
+ private lint;
24
+ private test;
25
+ static provider([cli, workspace, loggerAspect, typescript, linter, tester]: [
26
+ CLIMain,
27
+ Workspace,
28
+ LoggerMain,
29
+ TypescriptMain,
30
+ LinterMain,
31
+ TesterMain
32
+ ]): Promise<ValidatorMain>;
33
+ }
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ValidatorMain = void 0;
7
+ function _cli() {
8
+ const data = require("@teambit/cli");
9
+ _cli = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _logger() {
15
+ const data = require("@teambit/logger");
16
+ _logger = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _workspace() {
22
+ const data = require("@teambit/workspace");
23
+ _workspace = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _typescript() {
29
+ const data = require("@teambit/typescript");
30
+ _typescript = function () {
31
+ return data;
32
+ };
33
+ return data;
34
+ }
35
+ function _linter() {
36
+ const data = require("@teambit/linter");
37
+ _linter = function () {
38
+ return data;
39
+ };
40
+ return data;
41
+ }
42
+ function _tester() {
43
+ const data = require("@teambit/tester");
44
+ _tester = function () {
45
+ return data;
46
+ };
47
+ return data;
48
+ }
49
+ function _chalk() {
50
+ const data = _interopRequireDefault(require("chalk"));
51
+ _chalk = function () {
52
+ return data;
53
+ };
54
+ return data;
55
+ }
56
+ function _validator() {
57
+ const data = require("./validator.aspect");
58
+ _validator = function () {
59
+ return data;
60
+ };
61
+ return data;
62
+ }
63
+ function _validate() {
64
+ const data = require("./validate.cmd");
65
+ _validate = function () {
66
+ return data;
67
+ };
68
+ return data;
69
+ }
70
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
71
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
72
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
73
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
74
+ class ValidatorMain {
75
+ constructor(workspace, typescript, linter, tester, logger) {
76
+ this.workspace = workspace;
77
+ this.typescript = typescript;
78
+ this.linter = linter;
79
+ this.tester = tester;
80
+ this.logger = logger;
81
+ }
82
+ async validate(components, continueOnError = false) {
83
+ // Step 1: Check types
84
+ this.logger.console(_chalk().default.cyan('1/3 Type Checking...'));
85
+ const checkTypesResult = await this.checkTypes(components);
86
+ this.logger.console(checkTypesResult.message);
87
+ if (checkTypesResult.code !== 0 && !continueOnError) return checkTypesResult;
88
+
89
+ // Step 2: Lint
90
+ this.logger.console(_chalk().default.cyan('\n2/3 Linting...'));
91
+ const lintResult = await this.lint(components);
92
+ this.logger.console(lintResult.message);
93
+ if (lintResult.code !== 0 && !continueOnError) return lintResult;
94
+
95
+ // Step 3: Test
96
+ this.logger.console(_chalk().default.cyan('\n3/3 Testing...'));
97
+ const testResult = await this.test(components);
98
+ this.logger.console(testResult.message);
99
+
100
+ // When continueOnError is true, return the first error found, or success if all passed
101
+ if (continueOnError) {
102
+ if (checkTypesResult.code !== 0) return checkTypesResult;
103
+ if (lintResult.code !== 0) return lintResult;
104
+ }
105
+ return testResult;
106
+ }
107
+ async checkTypes(components) {
108
+ const files = this.typescript.getSupportedFilesForTsserver(components);
109
+ await this.typescript.initTsserverClientFromWorkspace({
110
+ aggregateDiagnosticData: false,
111
+ printTypeErrors: true
112
+ }, files);
113
+ const tsserver = this.typescript.getTsserverClient();
114
+ if (!tsserver) throw new Error('unable to start tsserver');
115
+ await tsserver.getDiagnostic(files);
116
+ const errorCount = tsserver.lastDiagnostics.length;
117
+ tsserver.killTsServer();
118
+ return {
119
+ code: errorCount > 0 ? 1 : 0,
120
+ message: errorCount > 0 ? `found errors in ${errorCount} files` : 'no type errors found'
121
+ };
122
+ }
123
+ async lint(components) {
124
+ const linterResults = await this.linter.lint(components, {});
125
+ let totalErrors = 0;
126
+ let totalWarnings = 0;
127
+ const dirtyComponents = [];
128
+ linterResults.results.forEach(res => {
129
+ if (res.data) {
130
+ const componentErrors = (res.data.totalErrorCount || 0) + (res.data.totalFatalErrorCount || 0);
131
+ totalErrors += componentErrors;
132
+ totalWarnings += res.data.totalWarningCount || 0;
133
+
134
+ // Show detailed output for components with errors
135
+ res.data.results.forEach(compResult => {
136
+ const hasErrors = compResult.totalErrorCount > 0 || (compResult.totalFatalErrorCount || 0) > 0;
137
+ if (hasErrors && compResult.output) {
138
+ const compTitle = _chalk().default.bold.cyan(compResult.component.id.toString({
139
+ ignoreVersion: true
140
+ }));
141
+ dirtyComponents.push(`${compTitle}\n${compResult.output}`);
142
+ }
143
+ });
144
+ }
145
+ });
146
+ let message = '';
147
+ if (dirtyComponents.length > 0) {
148
+ message = dirtyComponents.join('\n\n') + '\n\n';
149
+ }
150
+ message += totalErrors > 0 ? `found ${totalErrors} error(s) and ${totalWarnings} warning(s)` : totalWarnings > 0 ? `found ${totalWarnings} warning(s), no errors` : 'no linting issues found';
151
+ return {
152
+ code: totalErrors > 0 ? 1 : 0,
153
+ message
154
+ };
155
+ }
156
+ async test(components) {
157
+ if (components.length === 0) {
158
+ return {
159
+ code: 0,
160
+ message: 'no components found to test'
161
+ };
162
+ }
163
+ const tests = await this.tester.test(components, {
164
+ watch: false,
165
+ debug: false
166
+ });
167
+ const hasErrors = tests.hasErrors();
168
+ return {
169
+ code: hasErrors ? 1 : 0,
170
+ message: hasErrors ? 'tests failed' : `all tests passed for ${components.length} component(s)`
171
+ };
172
+ }
173
+ static async provider([cli, workspace, loggerAspect, typescript, linter, tester]) {
174
+ const logger = loggerAspect.createLogger(_validator().ValidatorAspect.id);
175
+ const validator = new ValidatorMain(workspace, typescript, linter, tester, logger);
176
+ cli.register(new (_validate().ValidateCmd)(validator, workspace, logger));
177
+ return validator;
178
+ }
179
+ }
180
+ exports.ValidatorMain = ValidatorMain;
181
+ _defineProperty(ValidatorMain, "runtime", _cli().MainRuntime);
182
+ _defineProperty(ValidatorMain, "dependencies", [_cli().CLIAspect, _workspace().WorkspaceAspect, _logger().LoggerAspect, _typescript().TypescriptAspect, _linter().LinterAspect, _tester().TesterAspect]);
183
+ _validator().ValidatorAspect.addRuntime(ValidatorMain);
184
+
185
+ //# sourceMappingURL=validator.main.runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_cli","data","require","_logger","_workspace","_typescript","_linter","_tester","_chalk","_interopRequireDefault","_validator","_validate","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ValidatorMain","constructor","workspace","typescript","linter","tester","logger","validate","components","continueOnError","console","chalk","cyan","checkTypesResult","checkTypes","message","code","lintResult","lint","testResult","test","files","getSupportedFilesForTsserver","initTsserverClientFromWorkspace","aggregateDiagnosticData","printTypeErrors","tsserver","getTsserverClient","Error","getDiagnostic","errorCount","lastDiagnostics","length","killTsServer","linterResults","totalErrors","totalWarnings","dirtyComponents","results","forEach","res","componentErrors","totalErrorCount","totalFatalErrorCount","totalWarningCount","compResult","hasErrors","output","compTitle","bold","component","id","toString","ignoreVersion","push","join","tests","watch","debug","provider","cli","loggerAspect","createLogger","ValidatorAspect","validator","register","ValidateCmd","exports","MainRuntime","CLIAspect","WorkspaceAspect","LoggerAspect","TypescriptAspect","LinterAspect","TesterAspect","addRuntime"],"sources":["validator.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { CLIAspect, MainRuntime } from '@teambit/cli';\nimport type { LoggerMain, Logger } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport type { TypescriptMain } from '@teambit/typescript';\nimport { TypescriptAspect } from '@teambit/typescript';\nimport type { LinterMain } from '@teambit/linter';\nimport { LinterAspect } from '@teambit/linter';\nimport type { TesterMain } from '@teambit/tester';\nimport { TesterAspect } from '@teambit/tester';\nimport type { Component } from '@teambit/component';\nimport chalk from 'chalk';\nimport { ValidatorAspect } from './validator.aspect';\nimport { ValidateCmd } from './validate.cmd';\n\nexport type ValidationResult = {\n code: number;\n message: string;\n};\n\nexport class ValidatorMain {\n static runtime = MainRuntime;\n static dependencies = [CLIAspect, WorkspaceAspect, LoggerAspect, TypescriptAspect, LinterAspect, TesterAspect];\n\n constructor(\n private workspace: Workspace,\n private typescript: TypescriptMain,\n private linter: LinterMain,\n private tester: TesterMain,\n private logger: Logger\n ) {}\n\n async validate(components: Component[], continueOnError = false): Promise<ValidationResult> {\n // Step 1: Check types\n this.logger.console(chalk.cyan('1/3 Type Checking...'));\n const checkTypesResult = await this.checkTypes(components);\n this.logger.console(checkTypesResult.message);\n if (checkTypesResult.code !== 0 && !continueOnError) return checkTypesResult;\n\n // Step 2: Lint\n this.logger.console(chalk.cyan('\\n2/3 Linting...'));\n const lintResult = await this.lint(components);\n this.logger.console(lintResult.message);\n if (lintResult.code !== 0 && !continueOnError) return lintResult;\n\n // Step 3: Test\n this.logger.console(chalk.cyan('\\n3/3 Testing...'));\n const testResult = await this.test(components);\n this.logger.console(testResult.message);\n\n // When continueOnError is true, return the first error found, or success if all passed\n if (continueOnError) {\n if (checkTypesResult.code !== 0) return checkTypesResult;\n if (lintResult.code !== 0) return lintResult;\n }\n return testResult;\n }\n\n private async checkTypes(components: Component[]): Promise<ValidationResult> {\n const files = this.typescript.getSupportedFilesForTsserver(components);\n\n await this.typescript.initTsserverClientFromWorkspace(\n { aggregateDiagnosticData: false, printTypeErrors: true },\n files\n );\n\n const tsserver = this.typescript.getTsserverClient();\n if (!tsserver) throw new Error('unable to start tsserver');\n\n await tsserver.getDiagnostic(files);\n const errorCount = tsserver.lastDiagnostics.length;\n tsserver.killTsServer();\n\n return {\n code: errorCount > 0 ? 1 : 0,\n message: errorCount > 0 ? `found errors in ${errorCount} files` : 'no type errors found',\n };\n }\n\n private async lint(components: Component[]): Promise<ValidationResult> {\n const linterResults = await this.linter.lint(components, {});\n\n let totalErrors = 0;\n let totalWarnings = 0;\n const dirtyComponents: string[] = [];\n\n linterResults.results.forEach((res) => {\n if (res.data) {\n const componentErrors = (res.data.totalErrorCount || 0) + (res.data.totalFatalErrorCount || 0);\n totalErrors += componentErrors;\n totalWarnings += res.data.totalWarningCount || 0;\n\n // Show detailed output for components with errors\n res.data.results.forEach((compResult) => {\n const hasErrors = compResult.totalErrorCount > 0 || (compResult.totalFatalErrorCount || 0) > 0;\n if (hasErrors && compResult.output) {\n const compTitle = chalk.bold.cyan(compResult.component.id.toString({ ignoreVersion: true }));\n dirtyComponents.push(`${compTitle}\\n${compResult.output}`);\n }\n });\n }\n });\n\n let message = '';\n if (dirtyComponents.length > 0) {\n message = dirtyComponents.join('\\n\\n') + '\\n\\n';\n }\n message +=\n totalErrors > 0\n ? `found ${totalErrors} error(s) and ${totalWarnings} warning(s)`\n : totalWarnings > 0\n ? `found ${totalWarnings} warning(s), no errors`\n : 'no linting issues found';\n\n return {\n code: totalErrors > 0 ? 1 : 0,\n message,\n };\n }\n\n private async test(components: Component[]): Promise<ValidationResult> {\n if (components.length === 0) {\n return { code: 0, message: 'no components found to test' };\n }\n\n const tests = await this.tester.test(components, { watch: false, debug: false });\n const hasErrors = tests.hasErrors();\n\n return {\n code: hasErrors ? 1 : 0,\n message: hasErrors ? 'tests failed' : `all tests passed for ${components.length} component(s)`,\n };\n }\n\n static async provider([cli, workspace, loggerAspect, typescript, linter, tester]: [\n CLIMain,\n Workspace,\n LoggerMain,\n TypescriptMain,\n LinterMain,\n TesterMain,\n ]) {\n const logger = loggerAspect.createLogger(ValidatorAspect.id);\n const validator = new ValidatorMain(workspace, typescript, linter, tester, logger);\n cli.register(new ValidateCmd(validator, workspace, logger));\n return validator;\n }\n}\n\nVal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G,cAAc,GAAG,wBAAwBtC,UAAU,CAACwB,MAAM;IACjF,CAAC;EACH;EAEA,aAAa2B,QAAQA,CAAC,CAACC,GAAG,EAAE1D,SAAS,EAAE2D,YAAY,EAAE1D,UAAU,EAAEC,MAAM,EAAEC,MAAM,CAO9E,EAAE;IACD,MAAMC,MAAM,GAAGuD,YAAY,CAACC,YAAY,CAACC,4BAAe,CAACZ,EAAE,CAAC;IAC5D,MAAMa,SAAS,GAAG,IAAIhE,aAAa,CAACE,SAAS,EAAEC,UAAU,EAAEC,MAAM,EAAEC,MAAM,EAAEC,MAAM,CAAC;IAClFsD,GAAG,CAACK,QAAQ,CAAC,KAAIC,uBAAW,EAACF,SAAS,EAAE9D,SAAS,EAAEI,MAAM,CAAC,CAAC;IAC3D,OAAO0D,SAAS;EAClB;AACF;AAACG,OAAA,CAAAnE,aAAA,GAAAA,aAAA;AAAAlB,eAAA,CA/HYkB,aAAa,aACPoE,kBAAW;AAAAtF,eAAA,CADjBkB,aAAa,kBAEF,CAACqE,gBAAS,EAAEC,4BAAe,EAAEC,sBAAY,EAAEC,8BAAgB,EAAEC,sBAAY,EAAEC,sBAAY,CAAC;AA+HhHX,4BAAe,CAACY,UAAU,CAAC3E,aAAa,CAAC","ignoreList":[]}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@teambit/validator",
3
+ "version": "0.0.0-2acf50c609da9a80d35091c6a35460916350da90",
4
+ "homepage": "https://bit.cloud/teambit/defender/validator",
5
+ "main": "dist/index.js",
6
+ "componentId": {
7
+ "scope": "teambit.defender",
8
+ "name": "validator",
9
+ "version": "2acf50c609da9a80d35091c6a35460916350da90"
10
+ },
11
+ "dependencies": {
12
+ "chalk": "4.1.2",
13
+ "@teambit/legacy.constants": "0.0.19",
14
+ "@teambit/harmony": "0.4.7",
15
+ "@teambit/cli": "0.0.0-25fc2928086ea08e2e55cd44ebc3b3a54d840149",
16
+ "@teambit/logger": "0.0.0-07aa006a5fb830984dc7b2673d983171ba5e9ff1",
17
+ "@teambit/workspace": "0.0.0-d55ddba79edf774a36ffe8fc9dccb8d9806929a1",
18
+ "@teambit/component": "0.0.0-185d05cb8e333775ac9a15683757a38ab4540735",
19
+ "@teambit/linter": "0.0.0-d3d8cb472805c41e9e8c3b012b9a663237021154",
20
+ "@teambit/tester": "0.0.0-7dd3256866ec8dfb83083a2785877c1a1ce12e7e",
21
+ "@teambit/typescript": "0.0.0-5afd3bdd684fa4d3ea81e96973c619afe87a6e58"
22
+ },
23
+ "devDependencies": {
24
+ "@teambit/harmony.envs.core-aspect-env": "0.0.79"
25
+ },
26
+ "peerDependencies": {},
27
+ "license": "Apache-2.0",
28
+ "optionalDependencies": {},
29
+ "peerDependenciesMeta": {},
30
+ "exports": {
31
+ ".": {
32
+ "node": {
33
+ "require": "./dist/index.js",
34
+ "import": "./dist/esm.mjs"
35
+ },
36
+ "default": "./dist/index.js"
37
+ },
38
+ "./dist/*": "./dist/*",
39
+ "./artifacts/*": "./artifacts/*",
40
+ "./*": "./*.ts"
41
+ },
42
+ "private": false,
43
+ "engines": {
44
+ "node": ">=16.0.0"
45
+ },
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "https://github.com/teambit/bit"
49
+ },
50
+ "keywords": [
51
+ "bit",
52
+ "bit-aspect",
53
+ "bit-core-aspect",
54
+ "components",
55
+ "collaboration",
56
+ "web"
57
+ ]
58
+ }
@@ -0,0 +1,41 @@
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<
9
+ SVGProps<SVGSVGElement> & { title?: string }
10
+ >;
11
+ const src: string;
12
+ export default src;
13
+ }
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
+ }
30
+ declare module '*.otf' {
31
+ const value: any;
32
+ export = value;
33
+ }
34
+ declare module '*.woff' {
35
+ const value: any;
36
+ export = value;
37
+ }
38
+ declare module '*.woff2' {
39
+ const value: any;
40
+ export = value;
41
+ }
@@ -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
+ }