@teambit/formatter 1.0.107 → 1.0.109
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/artifacts/preview/static/css/teambit.defender/formatter-preview.b2eac932.css +264 -0
- package/artifacts/preview/teambit_defender_formatter-preview.js +304 -0
- package/dist/format.cmd.d.ts +4 -4
- package/dist/format.cmd.js +2 -3
- package/dist/format.cmd.js.map +1 -1
- package/dist/formatter-context.d.ts +1 -1
- package/dist/formatter.composition.d.ts +2 -2
- package/dist/formatter.d.ts +3 -3
- package/dist/formatter.main.runtime.d.ts +1 -1
- package/dist/formatter.service.d.ts +4 -4
- package/dist/formatter.service.js +4 -4
- package/dist/formatter.service.js.map +1 -1
- package/dist/{preview-1703590665075.js → preview-1703698405864.js} +2 -2
- package/package.json +18 -25
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
package/dist/format.cmd.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ComponentFactory, ComponentID } from '@teambit/component';
|
|
|
4
4
|
import { Workspace } from '@teambit/workspace';
|
|
5
5
|
import { FormatterMain } from './formatter.main.runtime';
|
|
6
6
|
import { ComponentFormatResult, FormatResults } from './formatter';
|
|
7
|
-
export
|
|
7
|
+
export type FormatCmdOptions = {
|
|
8
8
|
changed?: boolean;
|
|
9
9
|
json?: boolean;
|
|
10
10
|
check?: boolean;
|
|
@@ -12,16 +12,16 @@ export declare type FormatCmdOptions = {
|
|
|
12
12
|
/**
|
|
13
13
|
* A type for result with componentId instead of the entire component, as when output to console, we don't want to print all the component
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type JsonComponentFormatResult = Omit<ComponentFormatResult, 'component'> & {
|
|
16
16
|
componentId: ComponentID;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type JsonFormatDataResults = Omit<FormatResults, 'results'> & {
|
|
19
19
|
results: JsonComponentFormatResult[];
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
22
|
* A type for result with componentId instead of the entire component, as when output to console, we don't want to print all the component
|
|
23
23
|
*/
|
|
24
|
-
export
|
|
24
|
+
export type JsonFormatResults = {
|
|
25
25
|
duration: TimerResponse;
|
|
26
26
|
data: JsonFormatDataResults;
|
|
27
27
|
code: number;
|
package/dist/format.cmd.js
CHANGED
|
@@ -126,8 +126,7 @@ class FormatCmd {
|
|
|
126
126
|
exports.FormatCmd = FormatCmd;
|
|
127
127
|
function toJsonFormatResults(results) {
|
|
128
128
|
const newResults = results.results.map(res => {
|
|
129
|
-
|
|
130
|
-
const resultsWithoutComponent = (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.results.map(result => {
|
|
129
|
+
const resultsWithoutComponent = res.data?.results.map(result => {
|
|
131
130
|
return {
|
|
132
131
|
componentId: result.component.id,
|
|
133
132
|
results: result.results
|
|
@@ -137,7 +136,7 @@ function toJsonFormatResults(results) {
|
|
|
137
136
|
});
|
|
138
137
|
return {
|
|
139
138
|
results: (0, _lodash().compact)((0, _lodash().flatten)(newResults)),
|
|
140
|
-
errors: results
|
|
139
|
+
errors: results?.errors
|
|
141
140
|
};
|
|
142
141
|
}
|
|
143
142
|
|
package/dist/format.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_timer","data","require","_chalk","_interopRequireDefault","_lodash","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","FormatCmd","constructor","formatter","componentHost","workspace","report","components","formatterOptions","duration","code","componentsIdsToFormat","json","title","chalk","bold","cyan","length","toString","name","componentsOutputs","getAllComponentsResultOutput","results","check","seconds","summery","formatterCmdOptions","timer","Timer","create","start","componentsIds","getIdsToFormat","changed","componentsToFormat","getMany","opts","formatterResults","format","jsonFormatterResults","toJsonFormatResults","timerResponse","stop","statusCode","getStatusCode","map","comp","id","hasIssues","some","file","resolveMultipleComponentIds","getNewAndModifiedIds","listIds","componentsResult","context","allResults","getOneComponentResultOutput","join","componentResult","componentId","ignoreVersion","filesWithIssues","filter","fileResult","green","subTitle","red","files","getOneComponentFileResultOutput","filePath","exports","newResults","res","_res$data","resultsWithoutComponent","result","component","compact","flatten","errors"],"sources":["format.cmd.ts"],"sourcesContent":["import { TimerResponse, Timer } from '@teambit/legacy/dist/toolbox/timer';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { ComponentFactory, ComponentID } from '@teambit/component';\nimport chalk from 'chalk';\nimport { EnvsExecutionResult } from '@teambit/envs';\nimport { Workspace } from '@teambit/workspace';\nimport { compact, flatten } from 'lodash';\nimport { FormatterMain } from './formatter.main.runtime';\nimport { ComponentFormatResult, FormatResults, FileFormatResult } from './formatter';\nimport { FormatterOptions } from './formatter-context';\n\nexport type FormatCmdOptions = {\n changed?: boolean;\n json?: boolean;\n check?: boolean;\n};\n\ntype OutputContext = {\n check?: boolean;\n};\n\n/**\n * A type for result with componentId instead of the entire component, as when output to console, we don't want to print all the component\n */\nexport type JsonComponentFormatResult = Omit<ComponentFormatResult, 'component'> & {\n componentId: ComponentID;\n};\n\nexport type JsonFormatDataResults = Omit<FormatResults, 'results'> & { results: JsonComponentFormatResult[] };\n/**\n * A type for result with componentId instead of the entire component, as when output to console, we don't want to print all the component\n */\nexport type JsonFormatResults = {\n duration: TimerResponse;\n data: JsonFormatDataResults;\n code: number;\n componentsIdsToFormat: string[];\n};\n\nexport class FormatCmd implements Command {\n name = 'format [component...]';\n description = 'format components in the development workspace';\n group = 'development';\n helpUrl = 'reference/formatting/formatter-overview';\n options = [\n ['c', 'changed', 'format only new and modified components'],\n ['', 'check', 'will output a human-friendly message and a list of unformatted files, if any'],\n ['j', 'json', 'return the format results in json format'],\n ] as CommandOptions;\n\n constructor(\n private formatter: FormatterMain,\n private componentHost: ComponentFactory,\n private workspace: Workspace\n ) {}\n\n async report([components = []]: [string[]], formatterOptions: FormatCmdOptions) {\n const { duration, data, code, componentsIdsToFormat } = await this.json([components], formatterOptions);\n\n const title = chalk.bold(\n `formatting total of ${chalk.cyan(\n componentsIdsToFormat.length.toString()\n )} component(s) in workspace '${chalk.cyan(this.componentHost.name)}`\n );\n\n const componentsOutputs = this.getAllComponentsResultOutput(data.results, { check: formatterOptions.check });\n\n const { seconds } = duration;\n const summery = `formatted ${chalk.cyan(componentsIdsToFormat.length.toString())} components in ${chalk.cyan(\n seconds.toString()\n )}.`;\n\n return {\n data: `${title}\\n\\n${componentsOutputs}\\n\\n${summery}`,\n code,\n };\n }\n\n async json([components = []]: [string[]], formatterCmdOptions: FormatCmdOptions): Promise<JsonFormatResults> {\n const timer = Timer.create();\n timer.start();\n const componentsIds = await this.getIdsToFormat(components, formatterCmdOptions.changed);\n const componentsToFormat = await this.workspace.getMany(componentsIds);\n const opts: FormatterOptions = {};\n const formatterResults = formatterCmdOptions.check\n ? await this.formatter.check(componentsToFormat, opts)\n : await this.formatter.format(componentsToFormat, opts);\n const jsonFormatterResults = toJsonFormatResults(formatterResults);\n const timerResponse = timer.stop();\n const statusCode = this.getStatusCode(jsonFormatterResults, formatterCmdOptions.check);\n\n return {\n duration: timerResponse,\n data: jsonFormatterResults,\n code: statusCode,\n componentsIdsToFormat: componentsToFormat.map((comp) => comp.id.toString()),\n };\n }\n\n private getStatusCode(results: JsonFormatDataResults, check = false): number {\n if (!check) return 0;\n const hasIssues = results.results.some((comp) => comp.results.some((file) => file.hasIssues));\n if (hasIssues) return 1;\n return 0;\n }\n\n private async getIdsToFormat(components: string[], changed = false): Promise<ComponentID[]> {\n if (components.length) {\n return this.workspace.resolveMultipleComponentIds(components);\n }\n if (changed) {\n return this.workspace.getNewAndModifiedIds();\n }\n return this.componentHost.listIds();\n }\n\n private getAllComponentsResultOutput(componentsResult: JsonComponentFormatResult[], context: OutputContext) {\n const allResults = componentsResult.map((comp) => this.getOneComponentResultOutput(comp, context));\n return allResults.join('\\n\\n');\n }\n\n private getOneComponentResultOutput(componentResult: JsonComponentFormatResult, context: OutputContext) {\n const title = chalk.bold.cyan(componentResult.componentId.toString({ ignoreVersion: true }));\n const filesWithIssues = componentResult.results.filter((fileResult) => fileResult.hasIssues);\n if (!filesWithIssues || !filesWithIssues.length) {\n return `${title}\\n${chalk.green('no issues found')}`;\n }\n let subTitle = chalk.green('the following files have been re-formatted:');\n if (context.check) {\n subTitle = chalk.red('issues found in the following files:');\n }\n const files = filesWithIssues.map(this.getOneComponentFileResultOutput);\n return `${title}\\n${subTitle}\\n${files.join('\\n')}`;\n }\n\n private getOneComponentFileResultOutput(fileResult: FileFormatResult) {\n return fileResult.filePath;\n }\n}\n\nfunction toJsonFormatResults(results: EnvsExecutionResult<FormatResults>): JsonFormatDataResults {\n const newResults = results.results.map((res) => {\n const resultsWithoutComponent = res.data?.results.map((result) => {\n return {\n componentId: result.component.id,\n results: result.results,\n };\n });\n return compact(resultsWithoutComponent);\n });\n return {\n results: compact(flatten(newResults)),\n errors: results?.errors,\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0C,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAA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5B;AACF;AAACC,OAAA,CAAAtE,SAAA,GAAAA,SAAA;AAED,SAASuC,mBAAmBA,CAAClB,OAA2C,EAAyB;EAC/F,MAAMkD,UAAU,GAAGlD,OAAO,CAACA,OAAO,CAACuB,GAAG,CAAE4B,GAAG,IAAK;IAAA,IAAAC,SAAA;IAC9C,MAAMC,uBAAuB,IAAAD,SAAA,GAAGD,GAAG,CAACpG,IAAI,cAAAqG,SAAA,uBAARA,SAAA,CAAUpD,OAAO,CAACuB,GAAG,CAAE+B,MAAM,IAAK;MAChE,OAAO;QACLhB,WAAW,EAAEgB,MAAM,CAACC,SAAS,CAAC9B,EAAE;QAChCzB,OAAO,EAAEsD,MAAM,CAACtD;MAClB,CAAC;IACH,CAAC,CAAC;IACF,OAAO,IAAAwD,iBAAO,EAACH,uBAAuB,CAAC;EACzC,CAAC,CAAC;EACF,OAAO;IACLrD,OAAO,EAAE,IAAAwD,iBAAO,EAAC,IAAAC,iBAAO,EAACP,UAAU,CAAC,CAAC;IACrCQ,MAAM,EAAE1D,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAE0D;EACnB,CAAC;AACH"}
|
|
1
|
+
{"version":3,"names":["_timer","data","require","_chalk","_interopRequireDefault","_lodash","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","FormatCmd","constructor","formatter","componentHost","workspace","report","components","formatterOptions","duration","code","componentsIdsToFormat","json","title","chalk","bold","cyan","length","toString","name","componentsOutputs","getAllComponentsResultOutput","results","check","seconds","summery","formatterCmdOptions","timer","Timer","create","start","componentsIds","getIdsToFormat","changed","componentsToFormat","getMany","opts","formatterResults","format","jsonFormatterResults","toJsonFormatResults","timerResponse","stop","statusCode","getStatusCode","map","comp","id","hasIssues","some","file","resolveMultipleComponentIds","getNewAndModifiedIds","listIds","componentsResult","context","allResults","getOneComponentResultOutput","join","componentResult","componentId","ignoreVersion","filesWithIssues","filter","fileResult","green","subTitle","red","files","getOneComponentFileResultOutput","filePath","exports","newResults","res","resultsWithoutComponent","result","component","compact","flatten","errors"],"sources":["format.cmd.ts"],"sourcesContent":["import { TimerResponse, Timer } from '@teambit/legacy/dist/toolbox/timer';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { ComponentFactory, ComponentID } from '@teambit/component';\nimport chalk from 'chalk';\nimport { EnvsExecutionResult } from '@teambit/envs';\nimport { Workspace } from '@teambit/workspace';\nimport { compact, flatten } from 'lodash';\nimport { FormatterMain } from './formatter.main.runtime';\nimport { ComponentFormatResult, FormatResults, FileFormatResult } from './formatter';\nimport { FormatterOptions } from './formatter-context';\n\nexport type FormatCmdOptions = {\n changed?: boolean;\n json?: boolean;\n check?: boolean;\n};\n\ntype OutputContext = {\n check?: boolean;\n};\n\n/**\n * A type for result with componentId instead of the entire component, as when output to console, we don't want to print all the component\n */\nexport type JsonComponentFormatResult = Omit<ComponentFormatResult, 'component'> & {\n componentId: ComponentID;\n};\n\nexport type JsonFormatDataResults = Omit<FormatResults, 'results'> & { results: JsonComponentFormatResult[] };\n/**\n * A type for result with componentId instead of the entire component, as when output to console, we don't want to print all the component\n */\nexport type JsonFormatResults = {\n duration: TimerResponse;\n data: JsonFormatDataResults;\n code: number;\n componentsIdsToFormat: string[];\n};\n\nexport class FormatCmd implements Command {\n name = 'format [component...]';\n description = 'format components in the development workspace';\n group = 'development';\n helpUrl = 'reference/formatting/formatter-overview';\n options = [\n ['c', 'changed', 'format only new and modified components'],\n ['', 'check', 'will output a human-friendly message and a list of unformatted files, if any'],\n ['j', 'json', 'return the format results in json format'],\n ] as CommandOptions;\n\n constructor(\n private formatter: FormatterMain,\n private componentHost: ComponentFactory,\n private workspace: Workspace\n ) {}\n\n async report([components = []]: [string[]], formatterOptions: FormatCmdOptions) {\n const { duration, data, code, componentsIdsToFormat } = await this.json([components], formatterOptions);\n\n const title = chalk.bold(\n `formatting total of ${chalk.cyan(\n componentsIdsToFormat.length.toString()\n )} component(s) in workspace '${chalk.cyan(this.componentHost.name)}`\n );\n\n const componentsOutputs = this.getAllComponentsResultOutput(data.results, { check: formatterOptions.check });\n\n const { seconds } = duration;\n const summery = `formatted ${chalk.cyan(componentsIdsToFormat.length.toString())} components in ${chalk.cyan(\n seconds.toString()\n )}.`;\n\n return {\n data: `${title}\\n\\n${componentsOutputs}\\n\\n${summery}`,\n code,\n };\n }\n\n async json([components = []]: [string[]], formatterCmdOptions: FormatCmdOptions): Promise<JsonFormatResults> {\n const timer = Timer.create();\n timer.start();\n const componentsIds = await this.getIdsToFormat(components, formatterCmdOptions.changed);\n const componentsToFormat = await this.workspace.getMany(componentsIds);\n const opts: FormatterOptions = {};\n const formatterResults = formatterCmdOptions.check\n ? await this.formatter.check(componentsToFormat, opts)\n : await this.formatter.format(componentsToFormat, opts);\n const jsonFormatterResults = toJsonFormatResults(formatterResults);\n const timerResponse = timer.stop();\n const statusCode = this.getStatusCode(jsonFormatterResults, formatterCmdOptions.check);\n\n return {\n duration: timerResponse,\n data: jsonFormatterResults,\n code: statusCode,\n componentsIdsToFormat: componentsToFormat.map((comp) => comp.id.toString()),\n };\n }\n\n private getStatusCode(results: JsonFormatDataResults, check = false): number {\n if (!check) return 0;\n const hasIssues = results.results.some((comp) => comp.results.some((file) => file.hasIssues));\n if (hasIssues) return 1;\n return 0;\n }\n\n private async getIdsToFormat(components: string[], changed = false): Promise<ComponentID[]> {\n if (components.length) {\n return this.workspace.resolveMultipleComponentIds(components);\n }\n if (changed) {\n return this.workspace.getNewAndModifiedIds();\n }\n return this.componentHost.listIds();\n }\n\n private getAllComponentsResultOutput(componentsResult: JsonComponentFormatResult[], context: OutputContext) {\n const allResults = componentsResult.map((comp) => this.getOneComponentResultOutput(comp, context));\n return allResults.join('\\n\\n');\n }\n\n private getOneComponentResultOutput(componentResult: JsonComponentFormatResult, context: OutputContext) {\n const title = chalk.bold.cyan(componentResult.componentId.toString({ ignoreVersion: true }));\n const filesWithIssues = componentResult.results.filter((fileResult) => fileResult.hasIssues);\n if (!filesWithIssues || !filesWithIssues.length) {\n return `${title}\\n${chalk.green('no issues found')}`;\n }\n let subTitle = chalk.green('the following files have been re-formatted:');\n if (context.check) {\n subTitle = chalk.red('issues found in the following files:');\n }\n const files = filesWithIssues.map(this.getOneComponentFileResultOutput);\n return `${title}\\n${subTitle}\\n${files.join('\\n')}`;\n }\n\n private getOneComponentFileResultOutput(fileResult: FileFormatResult) {\n return fileResult.filePath;\n }\n}\n\nfunction toJsonFormatResults(results: EnvsExecutionResult<FormatResults>): JsonFormatDataResults {\n const newResults = results.results.map((res) => {\n const resultsWithoutComponent = res.data?.results.map((result) => {\n return {\n componentId: result.component.id,\n results: result.results,\n };\n });\n return compact(resultsWithoutComponent);\n });\n return {\n results: compact(flatten(newResults)),\n errors: results?.errors,\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0C,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAA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A2C,EAAyB;EAC/F,MAAMkD,UAAU,GAAGlD,OAAO,CAACA,OAAO,CAACuB,GAAG,CAAE4B,GAAG,IAAK;IAC9C,MAAMC,uBAAuB,GAAGD,GAAG,CAACpG,IAAI,EAAEiD,OAAO,CAACuB,GAAG,CAAE8B,MAAM,IAAK;MAChE,OAAO;QACLf,WAAW,EAAEe,MAAM,CAACC,SAAS,CAAC7B,EAAE;QAChCzB,OAAO,EAAEqD,MAAM,CAACrD;MAClB,CAAC;IACH,CAAC,CAAC;IACF,OAAO,IAAAuD,iBAAO,EAACH,uBAAuB,CAAC;EACzC,CAAC,CAAC;EACF,OAAO;IACLpD,OAAO,EAAE,IAAAuD,iBAAO,EAAC,IAAAC,iBAAO,EAACN,UAAU,CAAC,CAAC;IACrCO,MAAM,EAAEzD,OAAO,EAAEyD;EACnB,CAAC;AACH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const Logo: () =>
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Logo: () => JSX.Element;
|
package/dist/formatter.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from '@teambit/component';
|
|
2
2
|
import { FormatterContext } from './formatter-context';
|
|
3
|
-
export
|
|
3
|
+
export type ComponentFormatResult = {
|
|
4
4
|
/**
|
|
5
5
|
* the formatted component.
|
|
6
6
|
*/
|
|
@@ -10,7 +10,7 @@ export declare type ComponentFormatResult = {
|
|
|
10
10
|
*/
|
|
11
11
|
results: FileFormatResult[];
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type FileFormatResult = {
|
|
14
14
|
/**
|
|
15
15
|
* path of the formatted file.
|
|
16
16
|
*/
|
|
@@ -24,7 +24,7 @@ export declare type FileFormatResult = {
|
|
|
24
24
|
*/
|
|
25
25
|
newContent?: string;
|
|
26
26
|
};
|
|
27
|
-
export
|
|
27
|
+
export type FormatResults = {
|
|
28
28
|
results: ComponentFormatResult[];
|
|
29
29
|
errors: Error[];
|
|
30
30
|
};
|
|
@@ -7,7 +7,7 @@ import { FormatterService } from './formatter.service';
|
|
|
7
7
|
import { FormatTask } from './format.task';
|
|
8
8
|
import { FormatterOptions } from './formatter-context';
|
|
9
9
|
import { Formatter } from './formatter';
|
|
10
|
-
export
|
|
10
|
+
export type FormatterConfig = {};
|
|
11
11
|
export declare class FormatterMain {
|
|
12
12
|
private envs;
|
|
13
13
|
private formatterService;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { EnvService, ExecutionContext, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';
|
|
3
3
|
import { Formatter, FormatResults } from './formatter';
|
|
4
4
|
import { FormatterOptions } from './formatter-context';
|
|
5
5
|
import { FormatterConfig } from './formatter.main.runtime';
|
|
6
|
-
|
|
6
|
+
type FormatterTransformationMap = ServiceTransformationMap & {
|
|
7
7
|
getFormatter: () => Formatter;
|
|
8
8
|
};
|
|
9
9
|
export declare class FormatterService implements EnvService<FormatResults> {
|
|
@@ -14,7 +14,7 @@ export declare class FormatterService implements EnvService<FormatResults> {
|
|
|
14
14
|
getFormatter(context: ExecutionContext, options: FormatterOptions): Formatter;
|
|
15
15
|
private optionsWithDefaults;
|
|
16
16
|
private mergeContext;
|
|
17
|
-
render(env: EnvDefinition):
|
|
17
|
+
render(env: EnvDefinition): JSX.Element;
|
|
18
18
|
transform(env: Env, context: EnvContext): FormatterTransformationMap | undefined;
|
|
19
19
|
getDescriptor(env: EnvDefinition): {
|
|
20
20
|
id: any;
|
|
@@ -22,6 +22,6 @@ export declare class FormatterService implements EnvService<FormatResults> {
|
|
|
22
22
|
config: any;
|
|
23
23
|
version: any;
|
|
24
24
|
displayName: any;
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
26
|
}
|
|
27
27
|
export {};
|
|
@@ -64,19 +64,19 @@ class FormatterService {
|
|
|
64
64
|
render(env) {
|
|
65
65
|
const descriptor = this.getDescriptor(env);
|
|
66
66
|
return /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
67
|
-
key: descriptor
|
|
67
|
+
key: descriptor?.id
|
|
68
68
|
}, /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
69
69
|
color: "cyan"
|
|
70
|
-
}, "configured formatter: "), /*#__PURE__*/_react().default.createElement(_ink().Text, null, descriptor
|
|
70
|
+
}, "configured formatter: "), /*#__PURE__*/_react().default.createElement(_ink().Text, null, descriptor?.id, " (", descriptor?.displayName, " @ ", descriptor?.version, ")"), /*#__PURE__*/_react().default.createElement(_ink().Newline, null), /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
71
71
|
color: "cyan"
|
|
72
|
-
}, "formatter config:"), /*#__PURE__*/_react().default.createElement(_ink().Newline, null), /*#__PURE__*/_react().default.createElement(_ink().Text, null,
|
|
72
|
+
}, "formatter config:"), /*#__PURE__*/_react().default.createElement(_ink().Newline, null), /*#__PURE__*/_react().default.createElement(_ink().Text, null, descriptor?.config && (0, _cliHighlight().default)(descriptor?.config, {
|
|
73
73
|
language: 'javascript',
|
|
74
74
|
ignoreIllegals: true
|
|
75
75
|
})), /*#__PURE__*/_react().default.createElement(_ink().Newline, null));
|
|
76
76
|
}
|
|
77
77
|
transform(env, context) {
|
|
78
78
|
// Old env
|
|
79
|
-
if (!
|
|
79
|
+
if (!env?.formatter) return undefined;
|
|
80
80
|
return {
|
|
81
81
|
getFormatter: () => env.formatter()(context)
|
|
82
82
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_lodash","data","require","_react","_interopRequireDefault","_ink","_cliHighlight","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","FormatterService","constructor","formatterConfig","run","context","options","mergedOpts","optionsWithDefaults","formatterContext","mergeContext","formatter","getFormatter","results","check","format","env","defaults","assign","render","descriptor","getDescriptor","createElement","Text","id","color","displayName","version","Newline","config","highlight","language","ignoreIllegals","transform","undefined","icon","displayConfig","exports"],"sources":["formatter.service.tsx"],"sourcesContent":["import { defaults } from 'lodash';\nimport React from 'react';\nimport { EnvService, ExecutionContext, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport { Text, Newline } from 'ink';\nimport highlight from 'cli-highlight';\nimport { Formatter, FormatResults } from './formatter';\nimport { FormatterContext, FormatterOptions } from './formatter-context';\nimport { FormatterConfig } from './formatter.main.runtime';\n\ntype FormatterTransformationMap = ServiceTransformationMap & {\n getFormatter: () => Formatter;\n};\nexport class FormatterService implements EnvService<FormatResults> {\n name = 'formatter';\n\n constructor(private formatterConfig: FormatterConfig) {}\n\n async run(context: ExecutionContext, options: FormatterOptions): Promise<FormatResults> {\n const mergedOpts = this.optionsWithDefaults(options);\n const formatterContext: FormatterContext = this.mergeContext(mergedOpts, context);\n const formatter = this.getFormatter(context, options);\n\n const results = options.check ? await formatter.check(formatterContext) : await formatter.format(formatterContext);\n return results;\n }\n\n getFormatter(context: ExecutionContext, options: FormatterOptions): Formatter {\n const mergedOpts = this.optionsWithDefaults(options);\n const formatterContext: FormatterContext = this.mergeContext(mergedOpts, context);\n const formatter: Formatter = context.env.getFormatter(formatterContext);\n\n return formatter;\n }\n\n private optionsWithDefaults(options: FormatterOptions): FormatterOptions {\n return defaults(options, this.formatterConfig);\n }\n\n private mergeContext(options: FormatterOptions, context?: ExecutionContext): FormatterContext {\n const formatterContext: FormatterContext = Object.assign({}, options, context);\n return formatterContext;\n }\n\n render(env: EnvDefinition) {\n const descriptor = this.getDescriptor(env);\n\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured formatter: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text color=\"cyan\">formatter config:</Text>\n <Newline />\n <Text>\n {descriptor?.config && highlight(descriptor?.config, { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n transform(env: Env, context: EnvContext): FormatterTransformationMap | undefined {\n // Old env\n if (!env?.formatter) return undefined;\n return {\n getFormatter: () => env.formatter()(context),\n };\n }\n\n getDescriptor(env: EnvDefinition) {\n if (!env.env.getFormatter) return undefined;\n const mergedOpts = this.optionsWithDefaults({});\n const formatterContext = this.mergeContext(mergedOpts);\n const formatter = env.env.getFormatter(formatterContext);\n\n return {\n id: formatter.id,\n icon: formatter.icon,\n config: formatter.displayConfig ? formatter.displayConfig() : undefined,\n version: formatter.version ? formatter.version() : '?',\n displayName: formatter.displayName ? formatter.displayName : '?',\n };\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,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;AAEA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAI,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsC,SAAAG,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,G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AAI,CAACC,mBAAmB,CAACF,OAAO,CAAC;IACpD,MAAMG,gBAAkC,GAAG,IAAI,CAACC,YAAY,CAACH,UAAU,EAAEF,OAAO,CAAC;IACjF,MAAMM,SAAoB,GAAGN,OAAO,CAACW,GAAG,CAACJ,YAAY,CAACH,gBAAgB,CAAC;IAEvE,OAAOE,SAAS;EAClB;EAEQH,mBAAmBA,CAACF,OAAyB,EAAoB;IACvE,OAAO,IAAAW,kBAAQ,EAACX,OAAO,EAAE,IAAI,CAACH,eAAe,CAAC;EAChD;EAEQO,YAAYA,CAACJ,OAAyB,EAAED,OAA0B,EAAoB;IAC5F,MAAMI,gBAAkC,GAAGxB,MAAM,CAACiC,MAAM,CAAC,CAAC,CAAC,EAAEZ,OAAO,EAAED,OAAO,CAAC;IAC9E,OAAOI,gBAAgB;EACzB;EAEAU,MAAMA,CAACH,GAAkB,EAAE;IACzB,MAAMI,UAAU,GAAG,IAAI,CAACC,aAAa,CAACL,GAAG,CAAC;IAE1C,oBACE1C,MAAA,GAAAM,OAAA,CAAA0C,aAAA,CAAC9C,IAAA,GAAA+C,IAAI;MAACzC,GAAG,EAAEsC,UAAU,
|
|
1
|
+
{"version":3,"names":["_lodash","data","require","_react","_interopRequireDefault","_ink","_cliHighlight","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","FormatterService","constructor","formatterConfig","run","context","options","mergedOpts","optionsWithDefaults","formatterContext","mergeContext","formatter","getFormatter","results","check","format","env","defaults","assign","render","descriptor","getDescriptor","createElement","Text","id","color","displayName","version","Newline","config","highlight","language","ignoreIllegals","transform","undefined","icon","displayConfig","exports"],"sources":["formatter.service.tsx"],"sourcesContent":["import { defaults } from 'lodash';\nimport React from 'react';\nimport { EnvService, ExecutionContext, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport { Text, Newline } from 'ink';\nimport highlight from 'cli-highlight';\nimport { Formatter, FormatResults } from './formatter';\nimport { FormatterContext, FormatterOptions } from './formatter-context';\nimport { FormatterConfig } from './formatter.main.runtime';\n\ntype FormatterTransformationMap = ServiceTransformationMap & {\n getFormatter: () => Formatter;\n};\nexport class FormatterService implements EnvService<FormatResults> {\n name = 'formatter';\n\n constructor(private formatterConfig: FormatterConfig) {}\n\n async run(context: ExecutionContext, options: FormatterOptions): Promise<FormatResults> {\n const mergedOpts = this.optionsWithDefaults(options);\n const formatterContext: FormatterContext = this.mergeContext(mergedOpts, context);\n const formatter = this.getFormatter(context, options);\n\n const results = options.check ? await formatter.check(formatterContext) : await formatter.format(formatterContext);\n return results;\n }\n\n getFormatter(context: ExecutionContext, options: FormatterOptions): Formatter {\n const mergedOpts = this.optionsWithDefaults(options);\n const formatterContext: FormatterContext = this.mergeContext(mergedOpts, context);\n const formatter: Formatter = context.env.getFormatter(formatterContext);\n\n return formatter;\n }\n\n private optionsWithDefaults(options: FormatterOptions): FormatterOptions {\n return defaults(options, this.formatterConfig);\n }\n\n private mergeContext(options: FormatterOptions, context?: ExecutionContext): FormatterContext {\n const formatterContext: FormatterContext = Object.assign({}, options, context);\n return formatterContext;\n }\n\n render(env: EnvDefinition) {\n const descriptor = this.getDescriptor(env);\n\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured formatter: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text color=\"cyan\">formatter config:</Text>\n <Newline />\n <Text>\n {descriptor?.config && highlight(descriptor?.config, { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n transform(env: Env, context: EnvContext): FormatterTransformationMap | undefined {\n // Old env\n if (!env?.formatter) return undefined;\n return {\n getFormatter: () => env.formatter()(context),\n };\n }\n\n getDescriptor(env: EnvDefinition) {\n if (!env.env.getFormatter) return undefined;\n const mergedOpts = this.optionsWithDefaults({});\n const formatterContext = this.mergeContext(mergedOpts);\n const formatter = env.env.getFormatter(formatterContext);\n\n return {\n id: formatter.id,\n icon: formatter.icon,\n config: formatter.displayConfig ? formatter.displayConfig() : undefined,\n version: formatter.version ? formatter.version() : '?',\n displayName: formatter.displayName ? formatter.displayName : '?',\n };\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,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;AAEA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAI,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsC,SAAAG,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAAA;AAAA,SAAAM,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAA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AQ,EAAE,YAAY;MAAEC,cAAc,EAAE;IAAK,CAAC,CACjG,CAAC,eACP1D,MAAA,GAAAM,OAAA,CAAA0C,aAAA,CAAC9C,IAAA,GAAAoD,OAAO,MAAE,CACN,CAAC;EAEX;EAEAK,SAASA,CAACjB,GAAQ,EAAEX,OAAmB,EAA0C;IAC/E;IACA,IAAI,CAACW,GAAG,EAAEL,SAAS,EAAE,OAAOuB,SAAS;IACrC,OAAO;MACLtB,YAAY,EAAEA,CAAA,KAAMI,GAAG,CAACL,SAAS,CAAC,CAAC,CAACN,OAAO;IAC7C,CAAC;EACH;EAEAgB,aAAaA,CAACL,GAAkB,EAAE;IAChC,IAAI,CAACA,GAAG,CAACA,GAAG,CAACJ,YAAY,EAAE,OAAOsB,SAAS;IAC3C,MAAM3B,UAAU,GAAG,IAAI,CAACC,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAC/C,MAAMC,gBAAgB,GAAG,IAAI,CAACC,YAAY,CAACH,UAAU,CAAC;IACtD,MAAMI,SAAS,GAAGK,GAAG,CAACA,GAAG,CAACJ,YAAY,CAACH,gBAAgB,CAAC;IAExD,OAAO;MACLe,EAAE,EAAEb,SAAS,CAACa,EAAE;MAChBW,IAAI,EAAExB,SAAS,CAACwB,IAAI;MACpBN,MAAM,EAAElB,SAAS,CAACyB,aAAa,GAAGzB,SAAS,CAACyB,aAAa,CAAC,CAAC,GAAGF,SAAS;MACvEP,OAAO,EAAEhB,SAAS,CAACgB,OAAO,GAAGhB,SAAS,CAACgB,OAAO,CAAC,CAAC,GAAG,GAAG;MACtDD,WAAW,EAAEf,SAAS,CAACe,WAAW,GAAGf,SAAS,CAACe,WAAW,GAAG;IAC/D,CAAC;EACH;AACF;AAACW,OAAA,CAAApC,gBAAA,GAAAA,gBAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_formatter@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_formatter@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_formatter@1.0.109/dist/formatter.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_formatter@1.0.109/dist/formatter.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/formatter",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.109",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/defender/formatter",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.defender",
|
|
8
8
|
"name": "formatter",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.109"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -14,30 +14,26 @@
|
|
|
14
14
|
"graphql-tag": "2.12.1",
|
|
15
15
|
"cli-highlight": "2.1.9",
|
|
16
16
|
"ink": "3.2.0",
|
|
17
|
-
"core-js": "^3.0.0",
|
|
18
|
-
"@babel/runtime": "7.20.0",
|
|
19
17
|
"@teambit/harmony": "0.4.6",
|
|
20
|
-
"@teambit/cli": "0.0.
|
|
21
|
-
"@teambit/component": "1.0.
|
|
22
|
-
"@teambit/envs": "1.0.
|
|
23
|
-
"@teambit/workspace": "1.0.
|
|
24
|
-
"@teambit/builder": "1.0.
|
|
25
|
-
"@teambit/logger": "0.0.
|
|
18
|
+
"@teambit/cli": "0.0.841",
|
|
19
|
+
"@teambit/component": "1.0.109",
|
|
20
|
+
"@teambit/envs": "1.0.109",
|
|
21
|
+
"@teambit/workspace": "1.0.109",
|
|
22
|
+
"@teambit/builder": "1.0.109",
|
|
23
|
+
"@teambit/logger": "0.0.934"
|
|
26
24
|
},
|
|
27
25
|
"devDependencies": {
|
|
28
26
|
"@types/lodash": "4.14.165",
|
|
29
|
-
"@types/react": "^17.0.8",
|
|
30
27
|
"@types/mocha": "9.1.0",
|
|
31
|
-
"@types/
|
|
32
|
-
"@types/
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@teambit/defender.content.formatter-overview": "1.96.1"
|
|
28
|
+
"@types/jest": "^29.2.2",
|
|
29
|
+
"@types/testing-library__jest-dom": "^5.9.5",
|
|
30
|
+
"@teambit/defender.content.formatter-overview": "1.96.1",
|
|
31
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.14"
|
|
36
32
|
},
|
|
37
33
|
"peerDependencies": {
|
|
38
|
-
"
|
|
39
|
-
"react": "^
|
|
40
|
-
"
|
|
34
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
35
|
+
"@types/react": "^18.2.12",
|
|
36
|
+
"@teambit/legacy": "1.0.624"
|
|
41
37
|
},
|
|
42
38
|
"license": "Apache-2.0",
|
|
43
39
|
"optionalDependencies": {},
|
|
@@ -51,7 +47,7 @@
|
|
|
51
47
|
},
|
|
52
48
|
"private": false,
|
|
53
49
|
"engines": {
|
|
54
|
-
"node": ">=
|
|
50
|
+
"node": ">=16.0.0"
|
|
55
51
|
},
|
|
56
52
|
"repository": {
|
|
57
53
|
"type": "git",
|
|
@@ -60,12 +56,9 @@
|
|
|
60
56
|
"keywords": [
|
|
61
57
|
"bit",
|
|
62
58
|
"bit-aspect",
|
|
59
|
+
"bit-core-aspect",
|
|
63
60
|
"components",
|
|
64
61
|
"collaboration",
|
|
65
|
-
"web"
|
|
66
|
-
"react",
|
|
67
|
-
"react-components",
|
|
68
|
-
"angular",
|
|
69
|
-
"angular-components"
|
|
62
|
+
"web"
|
|
70
63
|
]
|
|
71
64
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"lib": [
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"DOM.Iterable",
|
|
8
|
-
"ScriptHost"
|
|
4
|
+
"esnext",
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.Iterable"
|
|
9
7
|
],
|
|
10
|
-
"target": "
|
|
11
|
-
"module": "
|
|
12
|
-
"jsx": "react",
|
|
13
|
-
"allowJs": true,
|
|
14
|
-
"composite": true,
|
|
8
|
+
"target": "es2020",
|
|
9
|
+
"module": "es2020",
|
|
10
|
+
"jsx": "react-jsx",
|
|
15
11
|
"declaration": true,
|
|
16
12
|
"sourceMap": true,
|
|
17
|
-
"skipLibCheck": true,
|
|
18
13
|
"experimentalDecorators": true,
|
|
19
|
-
"
|
|
14
|
+
"skipLibCheck": true,
|
|
20
15
|
"moduleResolution": "node",
|
|
21
16
|
"esModuleInterop": true,
|
|
22
|
-
"rootDir": ".",
|
|
23
17
|
"resolveJsonModule": true,
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"strictPropertyInitialization": false,
|
|
28
|
-
"strict": true,
|
|
29
|
-
"noImplicitAny": false,
|
|
30
|
-
"preserveConstEnums": true
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"outDir": "dist",
|
|
20
|
+
"emitDeclarationOnly": true
|
|
31
21
|
},
|
|
32
22
|
"exclude": [
|
|
23
|
+
"artifacts",
|
|
24
|
+
"public",
|
|
33
25
|
"dist",
|
|
26
|
+
"node_modules",
|
|
27
|
+
"package.json",
|
|
34
28
|
"esm.mjs",
|
|
35
|
-
"
|
|
29
|
+
"**/*.cjs",
|
|
30
|
+
"./dist"
|
|
36
31
|
],
|
|
37
32
|
"include": [
|
|
38
33
|
"**/*",
|
package/types/asset.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ declare module '*.png' {
|
|
|
5
5
|
declare module '*.svg' {
|
|
6
6
|
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
7
|
|
|
8
|
-
export const ReactComponent: FunctionComponent<
|
|
8
|
+
export const ReactComponent: FunctionComponent<
|
|
9
|
+
SVGProps<SVGSVGElement> & { title?: string }
|
|
10
|
+
>;
|
|
9
11
|
const src: string;
|
|
10
12
|
export default src;
|
|
11
13
|
}
|
|
12
|
-
|
|
13
|
-
// @TODO Gilad
|
|
14
14
|
declare module '*.jpg' {
|
|
15
15
|
const value: any;
|
|
16
16
|
export = value;
|
|
@@ -27,3 +27,15 @@ declare module '*.bmp' {
|
|
|
27
27
|
const value: any;
|
|
28
28
|
export = value;
|
|
29
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
|
+
}
|