src/extract.js
function makeExtractionCompileOptions(compileOptions, entryFilename, extractions, importer) {
  const extractionCompileOptions = Object.assign({}, compileOptions);
  const extractionFunctions = {};

  // Copy all extraction function for each file into one object for compilation
  Object.keys(extractions).forEach(extractionKey => {
    Object.assign(extractionFunctions, extractions[extractionKey].injectedFunctions);
  });

  extractionCompileOptions.functions = Object.assign(extractionFunctions, compileOptions.functions);
  extractionCompileOptions.data = extractions[entryFilename].injectedData;
  if(!makeExtractionCompileOptions.imported) {
    extractionCompileOptions.importer = importer;
  }

  return extractionCompileOptions;
}
function makeExtractionCompileOptions(compileOptions, entryFilename, extractions, importer) {
  const extractionCompileOptions = Object.assign({}, compileOptions);
  const extractionFunctions = {};

  // Copy all extraction function for each file into one object for compilation
  Object.keys(extractions).forEach(extractionKey => {
    Object.assign(extractionFunctions, extractions[extractionKey].injectedFunctions);
  });

  extractionCompileOptions.functions = Object.assign(extractionFunctions, compileOptions.functions);
  extractionCompileOptions.data = extractions[entryFilename].injectedData;
  if(!makeExtractionCompileOptions.imported) {
    extractionCompileOptions.importer = importer;
  }

  return extractionCompileOptions;
}
function makeExtractionCompileOptions ( compileOptions , entryFilename , extractions , importer ) { const extractionCompileOptions = Object . assign ( { } , compileOptions ) ; const extractionFunctions = { } ; // Copy all extraction function for each file into one object for compilation Object . keys ( extractions ) . forEach ( extractionKey => { Object . assign ( extractionFunctions , extractions [ extractionKey ] . injectedFunctions ) ; } ) ; extractionCompileOptions . functions = Object . assign ( extractionFunctions , compileOptions . functions ) ; extractionCompileOptions . data = extractions [ entryFilename ] . injectedData ; if ( ! makeExtractionCompileOptions . imported ) { extractionCompileOptions . importer = importer ; } return extractionCompileOptions ; }
Make the compilation option for the extraction rendering
Set the data to be rendered to the injected source
Add compilation functions and custom importer for injected sources
Make the compilation option for the extraction rendering Set the data to be rendered to the injected source Add compilation functions and custom importer for injected sources