You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
6.6 KiB
1 line
6.6 KiB
3 years ago
|
{"version":3,"sources":["../src/Explorer.ts"],"names":["Explorer","ExplorerBase","constructor","options","search","searchFrom","process","cwd","startDirectory","result","searchFromDirectory","dir","absoluteDir","path","resolve","run","searchDirectory","nextDir","nextDirectoryToSearch","transformResult","config","transform","searchCache","place","searchPlaces","placeResult","loadSearchPlace","shouldSearchStopWithResult","filepath","join","fileContents","createCosmiconfigResult","loadFileContent","content","trim","undefined","loader","getLoaderEntryForFile","loaderResult","fileContent","loadedContentToCosmiconfigResult","load","validateFilePath","absoluteFilePath","runLoad","throwNotFound","loadCache"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;AAGA,MAAMA,QAAN,SAAuBC,0BAAvB,CAAqD;AAC5CC,EAAAA,WAAW,CAACC,OAAD,EAA2B;AAC3C,UAAMA,OAAN;AACD;;AAEkB,QAANC,MAAM,CACjBC,UAAkB,GAAGC,OAAO,CAACC,GAAR,EADJ,EAEW;AAC5B,UAAMC,cAAc,GAAG,MAAM,gCAAaH,UAAb,CAA7B;AACA,UAAMI,MAAM,GAAG,MAAM,KAAKC,mBAAL,CAAyBF,cAAzB,CAArB;AAEA,WAAOC,MAAP;AACD;;AAEgC,QAAnBC,mBAAmB,CAACC,GAAD,EAA0C;AACzE,UAAMC,WAAW,GAAGC,cAAKC,OAAL,CAAaR,OAAO,CAACC,GAAR,EAAb,EAA4BI,GAA5B,CAApB;;AAEA,UAAMI,GAAG,GAAG,YAAwC;AAClD,YAAMN,MAAM,GAAG,MAAM,KAAKO,eAAL,CAAqBJ,WAArB,CAArB;AACA,YAAMK,OAAO,GAAG,KAAKC,qBAAL,CAA2BN,WAA3B,EAAwCH,MAAxC,CAAhB;;AAEA,UAAIQ,OAAJ,EAAa;AACX,eAAO,KAAKP,mBAAL,CAAyBO,OAAzB,CAAP;AACD;;AAED,YAAME,eAAe,GAAG,M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nCH,QADmC,EAEnCK,OAFmC,EAGP;AAC5B,UAAMM,WAAW,GAAG,MAAM,KAAKP,eAAL,CAAqBJ,QAArB,EAA+BK,OAA/B,CAA1B;AACA,UAAMxB,MAAM,GAAG,KAAK+B,gCAAL,CAAsCZ,QAAtC,EAAgDW,WAAhD,CAAf;AAEA,WAAO9B,MAAP;AACD;;AAEgB,QAAJgC,IAAI,CAACb,QAAD,EAA+C;AAC9D,SAAKc,gBAAL,CAAsBd,QAAtB;;AACA,UAAMe,gBAAgB,GAAG9B,cAAKC,OAAL,CAAaR,OAAO,CAACC,GAAR,EAAb,EAA4BqB,QAA5B,CAAzB;;AAEA,UAAMgB,OAAO,GAAG,YAAwC;AACtD,YAAMd,YAAY,GAAG,MAAM,wBAASa,gBAAT,EAA2B;AACpDE,QAAAA,aAAa,EAAE;AADqC,OAA3B,CAA3B;AAIA,YAAMpC,MAAM,GAAG,MAAM,KAAKsB,uBAAL,CACnBY,gBADmB,EAEnBb,YAFmB,CAArB;AAKA,YAAMX,eAAe,GAAG,MAAM,KAAKC,MAAL,CAAYC,SAAZ,CAAsBZ,MAAtB,CAA9B;AAEA,aAAOU,eAAP;AACD,KAbD;;AAeA,QAAI,KAAK2B,SAAT,EAAoB;AAClB,aAAO,gCAAa,KAAKA,SAAlB,EAA6BH,gBAA7B,EAA+CC,OAA/C,CAAP;AACD;;AAED,WAAOA,OAAO,EAAd;AACD;;AA/GkD","sourcesContent":["import path from 'path';\nimport { ExplorerBase } from './ExplorerBase';\nimport { readFile } from './readFile';\nimport { cacheWrapper } from './cacheWrapper';\nimport { getDirectory } from './getDirectory';\nimport { CosmiconfigResult, ExplorerOptions, LoadedFileContent } from './types';\n\nclass Explorer extends ExplorerBase<ExplorerOptions> {\n public constructor(options: ExplorerOptions) {\n super(options);\n }\n\n public async search(\n searchFrom: string = process.cwd(),\n ): Promise<CosmiconfigResult> {\n const startDirectory = await getDirectory(searchFrom);\n const result = await this.searchFromDirectory(startDirectory);\n\n return result;\n }\n\n private async searchFromDirectory(dir: string): Promise<CosmiconfigResult> {\n const absoluteDir = path.resolve(process.cwd(), dir);\n\n const run = async (): Promise<CosmiconfigResult
|