src/process.js
function processFile(idx, count, filename, data, parsedDeclarations, pluggable) {
  const declarations = parsedDeclarations.files[filename];
  // Inject dependent declaration extraction to last file
  const dependentDeclarations = idx === count - 1 ? parsedDeclarations.dependentDeclarations : [];
  const variables = { global: {} };

  const globalDeclarationResultHandler = (declaration, value, sassValue) => {
    if(!variables.global[declaration.declaration]) {
      variables.global[declaration.declaration] = [];
    }
    const variableValue = pluggable.run(Pluggable.POST_VALUE, { value, sassValue }).value;
    variables.global[declaration.declaration].push({ declaration, value: variableValue });
  }

  const fileId = getFileId(filename);
  const injection = injectExtractionFunctions(fileId, declarations, dependentDeclarations, { globalDeclarationResultHandler });
  const injectedData = `${data}\n\n${injection.injectedData}`;
  const injectedFunctions = injection.injectedFunctions;

  return {
    fileId,
    declarations,
    variables,
    injectedData,
    injectedFunctions,
  };
}
function processFile(idx, count, filename, data, parsedDeclarations, pluggable) {
  const declarations = parsedDeclarations.files[filename];
  // Inject dependent declaration extraction to last file
  const dependentDeclarations = idx === count - 1 ? parsedDeclarations.dependentDeclarations : [];
  const variables = { global: {} };

  const globalDeclarationResultHandler = (declaration, value, sassValue) => {
    if(!variables.global[declaration.declaration]) {
      variables.global[declaration.declaration] = [];
    }
    const variableValue = pluggable.run(Pluggable.POST_VALUE, { value, sassValue }).value;
    variables.global[declaration.declaration].push({ declaration, value: variableValue });
  }

  const fileId = getFileId(filename);
  const injection = injectExtractionFunctions(fileId, declarations, dependentDeclarations, { globalDeclarationResultHandler });
  const injectedData = `${data}\n\n${injection.injectedData}`;
  const injectedFunctions = injection.injectedFunctions;

  return {
    fileId,
    declarations,
    variables,
    injectedData,
    injectedFunctions,
  };
}
function processFile ( idx , count , filename , data , parsedDeclarations , pluggable ) { const declarations = parsedDeclarations . files [ filename ] ; // Inject dependent declaration extraction to last file const dependentDeclarations = idx === count - 1 ? parsedDeclarations . dependentDeclarations : [ ] ; const variables = { global : { } } ; const globalDeclarationResultHandler = ( declaration , value , sassValue ) => { if ( ! variables . global [ declaration . declaration ] ) { variables . global [ declaration . declaration ] = [ ] ; } const variableValue = pluggable . run ( Pluggable . POST_VALUE , { value , sassValue } ) . value ; variables . global [ declaration . declaration ] . push ( { declaration , value : variableValue } ) ; } const fileId = getFileId ( filename ) ; const injection = injectExtractionFunctions ( fileId , declarations , dependentDeclarations , { globalDeclarationResultHandler } ) ; const injectedData = ` ${ data } \n \n ${ injection . injectedData } ` ; const injectedFunctions = injection . injectedFunctions ; return { fileId , declarations , variables , injectedData , injectedFunctions , } ; }
Process a single sass files to get declarations, injected source and functions
Process a single sass files to get declarations injected source and functions