@teambit/prettier 1.0.331 → 1.0.333
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<testsuites tests="0" failures="0" errors="0" skipped="0">
|
|
3
|
-
<testsuite name="teambit.defender/prettier@1.0.
|
|
3
|
+
<testsuite name="teambit.defender/prettier@1.0.333" tests="0" failures="0" errors="0" skipped="0"/>
|
|
4
4
|
</testsuites>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.defender/prettier-preview"]=t():e["teambit.defender/prettier-preview"]=t()}(self,(()=>(()=>{"use strict";var e={
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.defender/prettier-preview"]=t():e["teambit.defender/prettier-preview"]=t()}(self,(()=>(()=>{"use strict";var e={75134:(e,t,o)=>{var r={id:"teambit.defender/prettier@1.0.333",homepage:"https://bit.cloud/teambit/defender/prettier",exported:!0};function i(){const e=n(o(41594));return i=function(){return e},e}function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,i.__bit_component=r,n.__bit_component=r;const d=()=>i().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},i().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/brands/logo-prettier.svg"}));d.__bit_component=r,t.Logo=d},41594:e=>{e.exports=React}},t={};function o(r){var i=t[r];if(void 0!==i)return i.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,o),n.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};o.r(r),o.d(r,{compositions:()=>i,compositions_metadata:()=>d,overview:()=>n});const i=[o(75134)],n=[],d={compositions:[{displayName:"Logo",identifier:"Logo"}]};return r})()));
|
package/artifacts/schema.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_prettier","data","_interopRequireDefault","require","_pMapSeries","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","PrettierFormatter","constructor","logger","options","prettierModule","PrettierLib","displayConfig","JSON","stringify","format","context","run","formatSnippet","snippet","filePath","parser","ext","split","pop","supportInfo","getSupportInfo","language","languages","find","lang","extensions","includes","parsers","optsWithFilePath","assign","filepath","check","longProcessLogger","createLongProcessLogger","components","length","resultsP","mapSeries","component","logProgress","id","toString","mergedOpts","getOptions","filesP","filesystem","files","map","file","sourceCode","contents","addFilePathToOpts","checkFormatResults","formatResults","hasIssues","newContent","undefined","Buffer","from","write","relative","Promise","all","results","errors","path","version","exports"],"sources":["prettier.formatter.ts"],"sourcesContent":["import { AbstractVinyl } from '@teambit/
|
|
1
|
+
{"version":3,"names":["_prettier","data","_interopRequireDefault","require","_pMapSeries","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","PrettierFormatter","constructor","logger","options","prettierModule","PrettierLib","displayConfig","JSON","stringify","format","context","run","formatSnippet","snippet","filePath","parser","ext","split","pop","supportInfo","getSupportInfo","language","languages","find","lang","extensions","includes","parsers","optsWithFilePath","assign","filepath","check","longProcessLogger","createLongProcessLogger","components","length","resultsP","mapSeries","component","logProgress","id","toString","mergedOpts","getOptions","filesP","filesystem","files","map","file","sourceCode","contents","addFilePathToOpts","checkFormatResults","formatResults","hasIssues","newContent","undefined","Buffer","from","write","relative","Promise","all","results","errors","path","version","exports"],"sources":["prettier.formatter.ts"],"sourcesContent":["import { AbstractVinyl } from '@teambit/component.sources';\nimport {\n Formatter,\n FormatterContext,\n FormatResults,\n FileFormatResult,\n ComponentFormatResult,\n} from '@teambit/formatter';\nimport PrettierLib, { Options as PrettierModuleOptions } from 'prettier';\nimport mapSeries from 'p-map-series';\nimport { Logger } from '@teambit/logger';\nimport { ExecutionContext } from '@teambit/envs';\n// import { PrettierOptions } from './prettier.main.runtime';\n\nexport class PrettierFormatter implements Formatter {\n constructor(\n private logger: Logger,\n\n private options: PrettierModuleOptions,\n\n /**\n * reference to the prettier module.\n */\n private prettierModule = PrettierLib\n ) {}\n\n id = 'prettier-formatter';\n displayName = 'Prettier';\n\n displayConfig() {\n return JSON.stringify(this.options, null, 2);\n }\n\n async format(context: FormatterContext): Promise<FormatResults> {\n return this.run(context);\n }\n\n async formatSnippet(snippet: string, filePath?: string): Promise<string> {\n let parser;\n\n if (filePath) {\n const ext = filePath.split('.').pop();\n const supportInfo = this.prettierModule.getSupportInfo();\n const language = supportInfo.languages.find((lang) => lang.extensions && lang.extensions.includes(`.${ext}`));\n\n if (language) {\n parser = language.parsers[0];\n }\n }\n\n parser = parser || 'babel';\n\n const optsWithFilePath = Object.assign({}, this.options, { filepath: filePath, parser });\n\n return this.prettierModule.format(snippet, optsWithFilePath);\n }\n\n async check(context: FormatterContext): Promise<FormatResults> {\n return this.run(context);\n }\n\n private async run(context: FormatterContext & ExecutionContext): Promise<FormatResults> {\n const check = !!context.check;\n const longProcessLogger = this.logger.createLongProcessLogger('formatting components', context.components.length);\n const resultsP = mapSeries(context.components, async (component): Promise<ComponentFormatResult> => {\n longProcessLogger.logProgress(component.id.toString());\n const mergedOpts = this.getOptions(this.options, context);\n const filesP = component.filesystem.files.map(async (file): Promise<FileFormatResult> => {\n const sourceCode = file.contents.toString('utf8');\n const optsWithFilePath = this.addFilePathToOpts(mergedOpts, file);\n const checkFormatResults = await this.prettierModule.check(sourceCode, optsWithFilePath);\n const formatResults = await this.prettierModule.format(sourceCode, optsWithFilePath);\n\n const hasIssues = !checkFormatResults;\n const newContent = typeof formatResults === 'string' && hasIssues ? formatResults : undefined;\n\n if (!check && newContent) {\n file.contents = Buffer.from(newContent);\n await file.write(undefined, true);\n }\n\n return {\n filePath: file.relative,\n hasIssues,\n newContent,\n };\n });\n\n const files = await Promise.all(filesP);\n\n return {\n component,\n results: files,\n };\n });\n\n const results = await resultsP;\n\n return {\n results,\n errors: [],\n };\n }\n\n /**\n * get options for eslint.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n private getOptions(options: PrettierModuleOptions, context: FormatterContext): PrettierModuleOptions {\n return options;\n }\n\n private addFilePathToOpts(options: PrettierModuleOptions, file: AbstractVinyl): PrettierModuleOptions {\n return Object.assign({}, options, { filepath: file.path });\n }\n\n version() {\n return this.prettierModule.version;\n }\n}\n"],"mappings":";;;;;;AAQA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAqC,SAAAC,uBAAAG,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,EAAA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O9D,MAAM,CAAC2C,MAAM,CAAC,CAAC,CAAC,EAAE1B,OAAO,EAAE;MAAE2B,QAAQ,EAAEkB,IAAI,CAACiB;IAAK,CAAC,CAAC;EAC5D;EAEAC,OAAOA,CAAA,EAAG;IACR,OAAO,IAAI,CAAC9D,cAAc,CAAC8D,OAAO;EACpC;AACF;AAACC,OAAA,CAAAnE,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.defender_prettier@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.defender_prettier@1.0.333/dist/prettier.composition.js';
|
|
2
2
|
;
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
package/package.json
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/prettier",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.333",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/defender/prettier",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.defender",
|
|
8
8
|
"name": "prettier",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.333"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"p-map-series": "2.1.0",
|
|
13
13
|
"prettier": "2.8.8",
|
|
14
14
|
"@teambit/harmony": "0.4.6",
|
|
15
|
-
"@teambit/
|
|
16
|
-
"@teambit/
|
|
17
|
-
"@teambit/
|
|
18
|
-
"@teambit/
|
|
15
|
+
"@teambit/component.sources": "0.0.2",
|
|
16
|
+
"@teambit/envs": "1.0.333",
|
|
17
|
+
"@teambit/formatter": "1.0.333",
|
|
18
|
+
"@teambit/logger": "0.0.1003",
|
|
19
|
+
"@teambit/cli": "0.0.910",
|
|
19
20
|
"@teambit/defender.prettier.config-mutator": "0.0.100",
|
|
20
|
-
"@teambit/workspace-config-files": "1.0.
|
|
21
|
+
"@teambit/workspace-config-files": "1.0.333"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@types/prettier": "2.7.3",
|