UNPKG

dependency-cruiser

Version:

Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.

19 lines (14 loc) 574 B
import tryImport from "#utl/try-import.mjs"; import meta from "#meta.cjs"; const babel = await tryImport("@babel/core", meta.supportedTranspilers.babel); export default { isAvailable: () => babel !== false, version: () => `@babel/core@${babel.version}`, transpile: (pSource, pFileName, pTranspileOptions = {}) => babel.transformSync(pSource, { ...(pTranspileOptions.babelConfig || {}), // Some babel plugins assume a piece of source to have a filename. // See https://github.com/sverweij/dependency-cruiser/issues/410 filename: pFileName, }).code, };