8
0

ckeditor-rollup-plugin.js 734 B

123456789101112131415161718192021222324252627
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* jshint browser: false, node: true, strict: true */
  6. 'use strict';
  7. const resolveImportPathInContext = require( './compiler-utils/resolveimportpathincontext' );
  8. const path = require( 'path' );
  9. function ckeditorRollupPlugin( options ) {
  10. return {
  11. resolveId( importPath, requesterPath ) {
  12. if ( options.useMainPackageModules ) {
  13. const resolvedPath = resolveImportPathInContext( requesterPath, importPath, options.mainPackagePath );
  14. if ( resolvedPath ) {
  15. return path.join( resolvedPath.packagePath, resolvedPath.filePath );
  16. }
  17. }
  18. }
  19. };
  20. }
  21. module.exports = ckeditorRollupPlugin;