1 line
5.1 KiB
Plaintext
1 line
5.1 KiB
Plaintext
|
{"version":3,"sources":["../../src/paths/extensions.ts"],"names":["getExtensions","platforms","extensions","workflows","Array","isArray","fileExtensions","workflow","platform","extension","push","filter","Boolean","join","getLanguageExtensionsInOrder","isTS","isModern","isReact","addLanguage","lang","unshift","getManagedExtensions","languageOptions","_addMiscellaneousExtensions","getBareExtensions","includes"],"mappings":";;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAQO,SAASA,aAAT,CACLC,SADK,EAELC,UAFK,EAGLC,SAHK,EAIK;AACV;AACA,yBAAOC,KAAK,CAACC,OAAN,CAAcJ,SAAd,CAAP,EAAiC,iCAAjC;AACA,yBAAOG,KAAK,CAACC,OAAN,CAAcH,UAAd,CAAP,EAAkC,kCAAlC;AACA,yBAAOE,KAAK,CAACC,OAAN,CAAcF,SAAd,CAAP,EAAiC,iCAAjC;AAEA,QAAMG,cAAc,GAAG,EAAvB,CANU,CAOV;;AACA,OAAK,MAAMC,QAAX,IAAuB,CAAC,GAAGJ,SAAJ,EAAe,EAAf,CAAvB,EAA2C;AACzC;AACA,SAAK,MAAMK,QAAX,IAAuB,CAAC,GAAGP,SAAJ,EAAe,EAAf,CAAvB,EAA2C;AACzC;AACA,WAAK,MAAMQ,SAAX,IAAwBP,UAAxB,EAAoC;AAClCI,QAAAA,cAAc,CAACI,IAAf,CAAoB,CAACF,QAAD,EAAWD,QAAX,EAAqBE,SAArB,EAAgCE,MAAhC,CAAuCC,OAAvC,EAAgDC,IAAhD,CAAqD,GAArD,CAApB;AACD;AACF;AACF;;AACD,SAAOP,cAAP;AACD;;AAEM,SAASQ,4BAAT,CAAsC;AAC3CC,EAAAA,IAD2C;AAE3CC,EAAAA,QAF2C;AAG3CC,EAAAA;AAH2C,CAAtC,EAIuB;AAC5B;AACA,QAAMC,WAAW,GAAIC,IAAD,IAA4B,CAACA,IAAD,EAAOF,OAAO,IAAK,GAAEE,IAAK,GAA1B,E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,CAAmB,KAAnB,CAAJ,EAA+B;AAC7BnB,IAAAA,cAAc,CAACI,IAAf,CAAoB,MAApB;AACD;;AACD,SAAOJ,cAAP;AACD","sourcesContent":["import assert from 'assert';\n\nexport type LanguageOptions = {\n isTS: boolean;\n isModern: boolean;\n isReact: boolean;\n};\n\nexport function getExtensions(\n platforms: string[],\n extensions: string[],\n workflows: string[]\n): string[] {\n // In the past we used spread operators to collect the values so now we enforce type safety on them.\n assert(Array.isArray(platforms), 'Expected: `platforms: string[]`');\n assert(Array.isArray(extensions), 'Expected: `extensions: string[]`');\n assert(Array.isArray(workflows), 'Expected: `workflows: string[]`');\n\n const fileExtensions = [];\n // support .expo files\n for (const workflow of [...workflows, '']) {\n // Ensure order is correct: [platformA.js, platformB.js, js]\n for (const platform of [...platforms, '']) {\n // Support both TypeScript and JavaScript\n for (const extension of extensions) {\n fileExtensions.push([platform, workflow, extension].filter(Boolean).join('.'));\n }\n }\n }\n return fileExtensions;\n}\n\nexport function getLanguageExtensionsInOrder({\n isTS,\n isModern,\n isReact,\n}: LanguageOptions): string[] {\n // @ts-ignore: filter removes false type\n const addLanguage = (lang: string): string[] => [lang, isReact && `${lang}x`].filter(Boolean);\n\n // Support JavaScript\n let extensions = addLanguage('js');\n\n if (isModern) {\n extensions.unshift('mjs');\n }\n if (isTS) {\n extensions = [...addLanguage('ts'), ...extensions];\n }\n\n return extensions;\n}\n\nexport function getManagedExtensions(\n platforms: string[],\n languageOptions: LanguageOptions = { isTS: true, isModern: true, isRea
|