8
0

getrealimportpath.js 689 B

1234567891011121314151617181920
  1. /**
  2. * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. /* eslint-env node */
  6. const NON_CKEDITOR5_PACKAGES = {
  7. 'cloud-services-core': 'ckeditor-cloud-services-core'
  8. };
  9. module.exports = function getRealImportPath( modulePath ) {
  10. for ( const shortPkgName of Object.keys( NON_CKEDITOR5_PACKAGES ) ) {
  11. if ( modulePath.startsWith( shortPkgName ) ) {
  12. return modulePath.replace( new RegExp( '^' + shortPkgName ), `@ckeditor/${ NON_CKEDITOR5_PACKAGES[ shortPkgName ] }/src` );
  13. }
  14. }
  15. return modulePath.replace( /^([^/]+)\//, '@ckeditor/ckeditor5-$1/src/' );
  16. };