@teambit/formatter 0.0.570 → 0.0.572
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/dist/formatter.d.ts +1 -0
- package/dist/formatter.js.map +1 -1
- package/dist/formatter.main.runtime.d.ts +3 -1
- package/dist/formatter.main.runtime.js +3 -0
- package/dist/formatter.main.runtime.js.map +1 -1
- package/dist/formatter.service.d.ts +1 -0
- package/dist/formatter.service.js +7 -1
- package/dist/formatter.service.js.map +1 -1
- package/dist/{preview-1679062502420.js → preview-1679542267429.js} +2 -2
- package/formatter.service.tsx +9 -1
- package/package-tar/teambit-formatter-0.0.572.tgz +0 -0
- package/package.json +9 -9
- package/package-tar/teambit-formatter-0.0.570.tgz +0 -0
package/dist/formatter.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export declare type FormatResults = {
|
|
|
29
29
|
errors: Error[];
|
|
30
30
|
};
|
|
31
31
|
export interface Formatter {
|
|
32
|
+
id: string;
|
|
32
33
|
format(context: FormatterContext): Promise<FormatResults>;
|
|
33
34
|
formatSnippet(snippet: string): Promise<string>;
|
|
34
35
|
check(context: FormatterContext): Promise<FormatResults>;
|
package/dist/formatter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["formatter.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { FormatterContext } from './formatter-context';\n\nexport type ComponentFormatResult = {\n /**\n * the formatted component.\n */\n component: Component;\n\n /**\n * format results for each file of the component.\n */\n results: FileFormatResult[];\n};\n\nexport type FileFormatResult = {\n /**\n * path of the formatted file.\n */\n filePath: string;\n\n /**\n * Does the file has formatting issues (needs format)\n */\n hasIssues: boolean;\n\n /**\n * The new file content after the formatting\n */\n newContent?: string;\n};\n\nexport type FormatResults = {\n results: ComponentFormatResult[];\n errors: Error[];\n};\n\nexport interface Formatter {\n format(context: FormatterContext): Promise<FormatResults>;\n formatSnippet(snippet: string): Promise<string>;\n check(context: FormatterContext): Promise<FormatResults>;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["formatter.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { FormatterContext } from './formatter-context';\n\nexport type ComponentFormatResult = {\n /**\n * the formatted component.\n */\n component: Component;\n\n /**\n * format results for each file of the component.\n */\n results: FileFormatResult[];\n};\n\nexport type FileFormatResult = {\n /**\n * path of the formatted file.\n */\n filePath: string;\n\n /**\n * Does the file has formatting issues (needs format)\n */\n hasIssues: boolean;\n\n /**\n * The new file content after the formatting\n */\n newContent?: string;\n};\n\nexport type FormatResults = {\n results: ComponentFormatResult[];\n errors: Error[];\n};\n\nexport interface Formatter {\n id: string;\n format(context: FormatterContext): Promise<FormatResults>;\n formatSnippet(snippet: string): Promise<string>;\n check(context: FormatterContext): Promise<FormatResults>;\n}\n"],"mappings":""}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { CLIMain } from '@teambit/cli';
|
|
2
2
|
import { Component, ComponentMain } from '@teambit/component';
|
|
3
|
-
import { EnvsMain } from '@teambit/envs';
|
|
3
|
+
import { EnvsMain, ExecutionContext } from '@teambit/envs';
|
|
4
4
|
import { LoggerMain } from '@teambit/logger';
|
|
5
5
|
import { Workspace } from '@teambit/workspace';
|
|
6
6
|
import { FormatterService } from './formatter.service';
|
|
7
7
|
import { FormatTask } from './format.task';
|
|
8
8
|
import { FormatterOptions } from './formatter-context';
|
|
9
|
+
import { Formatter } from './formatter';
|
|
9
10
|
export declare type FormatterConfig = {};
|
|
10
11
|
export declare class FormatterMain {
|
|
11
12
|
private envs;
|
|
@@ -20,6 +21,7 @@ export declare class FormatterMain {
|
|
|
20
21
|
* check format an array of components.
|
|
21
22
|
*/
|
|
22
23
|
check(components: Component[], opts: FormatterOptions): Promise<import("@teambit/envs").EnvsExecutionResult<import("./formatter").FormatResults>>;
|
|
24
|
+
getFormatter(context: ExecutionContext, options: FormatterOptions): Formatter;
|
|
23
25
|
private toFormatServiceOptions;
|
|
24
26
|
/**
|
|
25
27
|
* create a format task for build pipelines.
|
|
@@ -102,6 +102,9 @@ class FormatterMain {
|
|
|
102
102
|
const formatResults = envsRuntime.run(this.formatterService, this.toFormatServiceOptions(opts, true));
|
|
103
103
|
return formatResults;
|
|
104
104
|
}
|
|
105
|
+
getFormatter(context, options) {
|
|
106
|
+
return this.formatterService.getFormatter(context, options);
|
|
107
|
+
}
|
|
105
108
|
toFormatServiceOptions(opts, check = false) {
|
|
106
109
|
return _objectSpread(_objectSpread({}, opts), {}, {
|
|
107
110
|
check
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FormatterMain","constructor","envs","formatterService","format","components","opts","envsRuntime","createEnvironment","formatResults","run","toFormatServiceOptions","check","createTask","name","FormatTask","FormatterAspect","id","provider","cli","component","loggerAspect","workspace","config","logger","createLogger","FormatterService","formatterAspect","registerService","register","FormatCmd","getHost","MainRuntime","EnvsAspect","CLIAspect","ComponentAspect","LoggerAspect","WorkspaceAspect","addRuntime"],"sources":["formatter.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Component, ComponentAspect, ComponentMain } from '@teambit/component';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { FormatterAspect } from './formatter.aspect';\nimport { FormatterService } from './formatter.service';\nimport { FormatTask } from './format.task';\nimport { FormatCmd } from './format.cmd';\nimport { FormatterOptions } from './formatter-context';\n\nexport type FormatterConfig = {};\nexport class FormatterMain {\n static runtime = MainRuntime;\n\n constructor(private envs: EnvsMain, private formatterService: FormatterService) {}\n\n /**\n * format an array of components.\n */\n async format(components: Component[], opts: FormatterOptions) {\n const envsRuntime = await this.envs.createEnvironment(components);\n const formatResults = envsRuntime.run(this.formatterService, this.toFormatServiceOptions(opts, false));\n return formatResults;\n }\n\n /**\n * check format an array of components.\n */\n async check(components: Component[], opts: FormatterOptions) {\n const envsRuntime = await this.envs.createEnvironment(components);\n const formatResults = envsRuntime.run(this.formatterService, this.toFormatServiceOptions(opts, true));\n return formatResults;\n }\n\n private toFormatServiceOptions(opts: FormatterOptions, check = false): FormatterOptions {\n return {\n ...opts,\n check,\n };\n }\n\n /**\n * create a format task for build pipelines.\n * @param name name of the task.\n */\n createTask(name?: string): FormatTask {\n return new FormatTask(FormatterAspect.id, name);\n }\n\n static dependencies = [EnvsAspect, CLIAspect, ComponentAspect, LoggerAspect, WorkspaceAspect];\n\n static defaultConfig: FormatterConfig = {};\n\n static async provider(\n [envs, cli, component, loggerAspect, workspace]: [EnvsMain, CLIMain, ComponentMain, LoggerMain, Workspace],\n config: FormatterConfig\n ) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const logger = loggerAspect.createLogger(FormatterAspect.id);\n const formatterService = new FormatterService(config);\n const formatterAspect = new FormatterMain(envs, formatterService);\n envs.registerService(formatterService);\n cli.register(new FormatCmd(formatterAspect, component.getHost(), workspace));\n\n return formatterAspect;\n }\n}\n\nFormatterAspect.addRuntime(FormatterMain);\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAyC;AAAA;
|
|
1
|
+
{"version":3,"names":["FormatterMain","constructor","envs","formatterService","format","components","opts","envsRuntime","createEnvironment","formatResults","run","toFormatServiceOptions","check","getFormatter","context","options","createTask","name","FormatTask","FormatterAspect","id","provider","cli","component","loggerAspect","workspace","config","logger","createLogger","FormatterService","formatterAspect","registerService","register","FormatCmd","getHost","MainRuntime","EnvsAspect","CLIAspect","ComponentAspect","LoggerAspect","WorkspaceAspect","addRuntime"],"sources":["formatter.main.runtime.ts"],"sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Component, ComponentAspect, ComponentMain } from '@teambit/component';\nimport { EnvsAspect, EnvsMain, ExecutionContext } from '@teambit/envs';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { FormatterAspect } from './formatter.aspect';\nimport { FormatterService } from './formatter.service';\nimport { FormatTask } from './format.task';\nimport { FormatCmd } from './format.cmd';\nimport { FormatterOptions } from './formatter-context';\nimport { Formatter } from './formatter';\n\nexport type FormatterConfig = {};\nexport class FormatterMain {\n static runtime = MainRuntime;\n\n constructor(private envs: EnvsMain, private formatterService: FormatterService) {}\n\n /**\n * format an array of components.\n */\n async format(components: Component[], opts: FormatterOptions) {\n const envsRuntime = await this.envs.createEnvironment(components);\n const formatResults = envsRuntime.run(this.formatterService, this.toFormatServiceOptions(opts, false));\n return formatResults;\n }\n\n /**\n * check format an array of components.\n */\n async check(components: Component[], opts: FormatterOptions) {\n const envsRuntime = await this.envs.createEnvironment(components);\n const formatResults = envsRuntime.run(this.formatterService, this.toFormatServiceOptions(opts, true));\n return formatResults;\n }\n\n getFormatter(context: ExecutionContext, options: FormatterOptions): Formatter {\n return this.formatterService.getFormatter(context, options);\n }\n\n private toFormatServiceOptions(opts: FormatterOptions, check = false): FormatterOptions {\n return {\n ...opts,\n check,\n };\n }\n\n /**\n * create a format task for build pipelines.\n * @param name name of the task.\n */\n createTask(name?: string): FormatTask {\n return new FormatTask(FormatterAspect.id, name);\n }\n\n static dependencies = [EnvsAspect, CLIAspect, ComponentAspect, LoggerAspect, WorkspaceAspect];\n\n static defaultConfig: FormatterConfig = {};\n\n static async provider(\n [envs, cli, component, loggerAspect, workspace]: [EnvsMain, CLIMain, ComponentMain, LoggerMain, Workspace],\n config: FormatterConfig\n ) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const logger = loggerAspect.createLogger(FormatterAspect.id);\n const formatterService = new FormatterService(config);\n const formatterAspect = new FormatterMain(envs, formatterService);\n envs.registerService(formatterService);\n cli.register(new FormatCmd(formatterAspect, component.getHost(), workspace));\n\n return formatterAspect;\n }\n}\n\nFormatterAspect.addRuntime(FormatterMain);\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAyC;AAAA;AAKlC,MAAMA,aAAa,CAAC;EAGzBC,WAAW,CAASC,IAAc,EAAUC,gBAAkC,EAAE;IAAA,KAA5DD,IAAc,GAAdA,IAAc;IAAA,KAAUC,gBAAkC,GAAlCA,gBAAkC;EAAG;;EAEjF;AACF;AACA;EACE,MAAMC,MAAM,CAACC,UAAuB,EAAEC,IAAsB,EAAE;IAC5D,MAAMC,WAAW,GAAG,MAAM,IAAI,CAACL,IAAI,CAACM,iBAAiB,CAACH,UAAU,CAAC;IACjE,MAAMI,aAAa,GAAGF,WAAW,CAACG,GAAG,CAAC,IAAI,CAACP,gBAAgB,EAAE,IAAI,CAACQ,sBAAsB,CAACL,IAAI,EAAE,KAAK,CAAC,CAAC;IACtG,OAAOG,aAAa;EACtB;;EAEA;AACF;AACA;EACE,MAAMG,KAAK,CAACP,UAAuB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F,CAACoC,kBAAU,EAAEC,gBAAS,EAAEC,4BAAe,EAAEC,sBAAY,EAAEC,4BAAe,CAAC;AAAA,gCA1ClFxC,aAAa,mBA4CgB,CAAC,CAAC;AAiB5CmB,4BAAe,CAACsB,UAAU,CAACzC,aAAa,CAAC"}
|
|
@@ -11,6 +11,7 @@ export declare class FormatterService implements EnvService<FormatResults> {
|
|
|
11
11
|
name: string;
|
|
12
12
|
constructor(formatterConfig: FormatterConfig);
|
|
13
13
|
run(context: ExecutionContext, options: FormatterOptions): Promise<FormatResults>;
|
|
14
|
+
getFormatter(context: ExecutionContext, options: FormatterOptions): Formatter;
|
|
14
15
|
private optionsWithDefaults;
|
|
15
16
|
private mergeContext;
|
|
16
17
|
render(env: EnvDefinition): JSX.Element;
|
|
@@ -49,10 +49,16 @@ class FormatterService {
|
|
|
49
49
|
async run(context, options) {
|
|
50
50
|
const mergedOpts = this.optionsWithDefaults(options);
|
|
51
51
|
const formatterContext = this.mergeContext(mergedOpts, context);
|
|
52
|
-
const formatter =
|
|
52
|
+
const formatter = this.getFormatter(context, options);
|
|
53
53
|
const results = options.check ? await formatter.check(formatterContext) : await formatter.format(formatterContext);
|
|
54
54
|
return results;
|
|
55
55
|
}
|
|
56
|
+
getFormatter(context, options) {
|
|
57
|
+
const mergedOpts = this.optionsWithDefaults(options);
|
|
58
|
+
const formatterContext = this.mergeContext(mergedOpts, context);
|
|
59
|
+
const formatter = context.env.getFormatter(formatterContext);
|
|
60
|
+
return formatter;
|
|
61
|
+
}
|
|
56
62
|
optionsWithDefaults(options) {
|
|
57
63
|
return (0, _lodash().defaults)(options, this.formatterConfig);
|
|
58
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FormatterService","constructor","formatterConfig","run","context","options","mergedOpts","optionsWithDefaults","formatterContext","mergeContext","formatter","
|
|
1
|
+
{"version":3,"names":["FormatterService","constructor","formatterConfig","run","context","options","mergedOpts","optionsWithDefaults","formatterContext","mergeContext","formatter","getFormatter","results","check","format","env","defaults","Object","assign","render","descriptor","getDescriptor","id","displayName","version","config","highlight","language","ignoreIllegals","transform","undefined","icon","displayConfig"],"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;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQO,MAAMA,gBAAgB,CAAsC;EAGjEC,WAAW,CAASC,eAAgC,EAAE;IAAA,KAAlCA,eAAgC,GAAhCA,eAAgC;IAAA,8CAF7C,WAAW;EAEqC;EAEvD,MAAMC,GAAG,CAACC,OAAyB,EAAEC,OAAyB,EAA0B;IACtF,MAAMC,UAAU,GAAG,IAAI,CAACC,mBAAmB,CAACF,OAAO,CAAC;IACpD,MAAMG,gBAAkC,GAAG,IAAI,CAACC,YAAY,CAACH,UAAU,EAAEF,OAAO,CAAC;IACjF,MAAMM,SAAS,GAAG,IAAI,CAACC,YAAY,CAACP,OAAO,EAAEC,OAAO,CAAC;IAErD,MAAMO,OAAO,GAAGP,OAAO,CAACQ,KAAK,GAAG,MAAMH,SAAS,CAACG,KAAK,CAACL,gBAAgB,CAAC,GAAG,MAAME,SAAS,CAACI,MAAM,CAACN,gBAAgB,CAAC;IAClH,OAAOI,OAAO;EAChB;EAEAD,YAAY,CAACP,OAAyB,EAAEC,OAAyB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EE,QAAQ,EAAE,YAAY;MAAEC,cAAc,EAAE;IAAK,CAAC,CAAC,CACjG,eACP,+BAAC,cAAO,OAAG,CACN;EAEX;EAEAC,SAAS,CAACd,GAAQ,EAAEX,OAAmB,EAA0C;IAC/E;IACA,IAAI,EAACW,GAAG,aAAHA,GAAG,eAAHA,GAAG,CAAEL,SAAS,GAAE,OAAOoB,SAAS;IACrC,OAAO;MACLnB,YAAY,EAAE,MAAMI,GAAG,CAACL,SAAS,EAAE,CAACN,OAAO;IAC7C,CAAC;EACH;EAEAiB,aAAa,CAACN,GAAkB,EAAE;IAChC,IAAI,CAACA,GAAG,CAACA,GAAG,CAACJ,YAAY,EAAE,OAAOmB,SAAS;IAC3C,MAAMxB,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;MACLc,EAAE,EAAEZ,SAAS,CAACY,EAAE;MAChBS,IAAI,EAAErB,SAAS,CAACqB,IAAI;MACpBN,MAAM,EAAEf,SAAS,CAACsB,aAAa,GAAGtB,SAAS,CAACsB,aAAa,EAAE,GAAGF,SAAS;MACvEN,OAAO,EAAEd,SAAS,CAACc,OAAO,GAAGd,SAAS,CAACc,OAAO,EAAE,GAAG,GAAG;MACtDD,WAAW,EAAEb,SAAS,CAACa,WAAW,GAAGb,SAAS,CAACa,WAAW,GAAG;IAC/D,CAAC;EACH;AACF;AAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_formatter@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_formatter@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_formatter@0.0.572/dist/formatter.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.defender_formatter@0.0.572/dist/formatter.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/formatter.service.tsx
CHANGED
|
@@ -18,12 +18,20 @@ export class FormatterService implements EnvService<FormatResults> {
|
|
|
18
18
|
async run(context: ExecutionContext, options: FormatterOptions): Promise<FormatResults> {
|
|
19
19
|
const mergedOpts = this.optionsWithDefaults(options);
|
|
20
20
|
const formatterContext: FormatterContext = this.mergeContext(mergedOpts, context);
|
|
21
|
-
const formatter
|
|
21
|
+
const formatter = this.getFormatter(context, options);
|
|
22
22
|
|
|
23
23
|
const results = options.check ? await formatter.check(formatterContext) : await formatter.format(formatterContext);
|
|
24
24
|
return results;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
getFormatter(context: ExecutionContext, options: FormatterOptions): Formatter {
|
|
28
|
+
const mergedOpts = this.optionsWithDefaults(options);
|
|
29
|
+
const formatterContext: FormatterContext = this.mergeContext(mergedOpts, context);
|
|
30
|
+
const formatter: Formatter = context.env.getFormatter(formatterContext);
|
|
31
|
+
|
|
32
|
+
return formatter;
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
private optionsWithDefaults(options: FormatterOptions): FormatterOptions {
|
|
28
36
|
return defaults(options, this.formatterConfig);
|
|
29
37
|
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/formatter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.572",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/defender/formatter",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.defender",
|
|
8
8
|
"name": "formatter",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.572"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"core-js": "^3.0.0",
|
|
18
18
|
"@babel/runtime": "7.20.0",
|
|
19
19
|
"@teambit/harmony": "0.4.6",
|
|
20
|
-
"@teambit/cli": "0.0.
|
|
21
|
-
"@teambit/component": "0.0.
|
|
22
|
-
"@teambit/envs": "0.0.
|
|
23
|
-
"@teambit/workspace": "0.0.
|
|
24
|
-
"@teambit/builder": "0.0.
|
|
25
|
-
"@teambit/logger": "0.0.
|
|
20
|
+
"@teambit/cli": "0.0.684",
|
|
21
|
+
"@teambit/component": "0.0.1021",
|
|
22
|
+
"@teambit/envs": "0.0.1021",
|
|
23
|
+
"@teambit/workspace": "0.0.1021",
|
|
24
|
+
"@teambit/builder": "0.0.1021",
|
|
25
|
+
"@teambit/logger": "0.0.777"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/lodash": "4.14.165",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@teambit/defender.content.formatter-overview": "1.96.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@teambit/legacy": "1.0.
|
|
38
|
+
"@teambit/legacy": "1.0.464",
|
|
39
39
|
"react": "^16.8.0 || ^17.0.0",
|
|
40
40
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
41
41
|
},
|
|
Binary file
|