How to use module-definition - 1 common examples

To help you get started, we’ve selected a few module-definition examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dependents / node-precinct / index.js View on Github external
} catch (e) {
      // In case a previous call had it populated
      precinct.ast = null;
      debug('could not parse content: %s', e.message);
      return dependencies;
    }
  // SASS files shouldn't be parsed by Acorn
  } else {
    ast = content;

    if (typeof content === 'object') {
      precinct.ast = content;
    }
  }

  type = type || getModuleType.fromSource(ast);
  debug('module type: ', type);

  var theDetective;
  var mixedMode = options.es6 && options.es6.mixedImports;

  switch (type) {
    case 'commonjs':
      theDetective = mixedMode ? detectiveEs6Cjs : detectiveCjs;
      break;
    case 'css':
      theDetective = detectivePostcss;
      break;
    case 'amd':
      theDetective = detectiveAmd;
      break;
    case 'es6':

module-definition

Determines if a file is using a CommonJS or AMD module definition

MIT
Latest version published 9 months ago

Package Health Score

73 / 100
Full package analysis

Popular module-definition functions

Similar packages