How to use interpret - 10 common examples

To help you get started, we’ve selected a few interpret 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 facebookarchive / WebDriverAgent / Inspector / node_modules / webpack / bin / convert-argv.js View on Github external
} else if(!Array.isArray(moduleDescriptor)) {
					moduleDescriptor.register(require(moduleDescriptor.module));
				} else {
					for(var i = 0; i < moduleDescriptor.length; i++) {
						try {
							registerCompiler(moduleDescriptor[i]);
							break;
						} catch(e) {
							// do nothing
						}
					}
				}
			}
		}

		registerCompiler(interpret.extensions[ext]);
		options = require(configPath);
	}

	return processConfiguredOptions(options);

	function processConfiguredOptions(options) {
		if(typeof options !== "object" || options === null) {
			console.log("Config did not export an object.");
			process.exit(-1); // eslint-disable-line
		}

		// process Promise
		if(typeof options.then === "function") {
			return options.then(processConfiguredOptions);
		}
github trivago / parallel-webpack / src / loadConfigurationFile.js View on Github external
var jsVars = require('interpret').jsVariants,
    endsWith = require('lodash.endswith'),
    availableExts = Object.keys(jsVars),
    chalk = require('chalk');

// sort extensions to ensure that .babel.js and
// similar ones are always matched before .js
availableExts.sort(function(a, b) {
    var res = -(a.split(/\./).length - b.split(/\./).length);
    // all things being equal, we need to
    // prioritize .js as it is most likely
    if(res === 0) {
        if(a === '.js') {
            return -1;
        }
        if(b === '.js') {
            return 1;
        }
        return 0;
github TYRMars / ES6-StepPitGuide / es6 / node_modules / webpack / bin / convert-argv.js View on Github external
// Shortcuts
	if(argv.d) {
		argv.debug = true;
		argv["output-pathinfo"] = true;
		if(!argv.devtool) {
			argv.devtool = "eval-cheap-module-source-map";
		}
	}
	if(argv.p) {
		argv["optimize-minimize"] = true;
		argv["define"] = [].concat(argv["define"] || []).concat("process.env.NODE_ENV=\"production\"");
	}

	var configFileLoaded = false;
	var configFiles = [];
	var extensions = Object.keys(interpret.extensions).sort(function(a, b) {
		return a === ".js" ? -1 : b === ".js" ? 1 : a.length - b.length;
	});
	var defaultConfigFiles = ["webpack.config", "webpackfile"].map(function(filename) {
		return extensions.map(function(ext) {
			return {
				path: path.resolve(filename + ext),
				ext: ext
			};
		});
	}).reduce(function(a, i) {
		return a.concat(i);
	}, []);

	var i;
	if(argv.config) {
		var getConfigExtension = function getConfigExtension(configPath) {
github isiahmeadows / thallium / test / cli / loader-data.js View on Github external
function forEachDataExt(f) {
        for (var key in interpret.extensions) {
            if (hasOwn.call(interpret.extensions, key) &&
                    !hasOwn.call(interpret.jsVariants, key)) {
                f(key)
            }
        }
    }
github isiahmeadows / thallium / test / cli / loader-data.js View on Github external
function forEachDataExt(f) {
        for (var key in interpret.extensions) {
            if (hasOwn.call(interpret.extensions, key) &&
                    !hasOwn.call(interpret.jsVariants, key)) {
                f(key)
            }
        }
    }
github tamb / domponent / node_modules / webpack-cli / bin / utils / convert-argv.js View on Github external
argv.mode = "production";
		}
	}

	if (argv.output) {
		let output = argv.output;
		if (!path.isAbsolute(argv.o)) {
			output = path.resolve(process.cwd(), output);
		}
		argv["output-filename"] = path.basename(output);
		argv["output-path"] = path.dirname(output);
	}

	let configFileLoaded = false;
	let configFiles = [];
	const extensions = Object.keys(interpret.extensions).sort(function(a, b) {
		return a === ".js" ? -1 : b === ".js" ? 1 : a.length - b.length;
	});

	let i;
	if (argv.config) {
		const getConfigExtension = function getConfigExtension(configPath) {
			for (i = extensions.length - 1; i >= 0; i--) {
				const tmpExt = extensions[i];
				if (configPath.indexOf(tmpExt, configPath.length - tmpExt.length) > -1) {
					return tmpExt;
				}
			}
			return path.extname(configPath);
		};

		const mapConfigArg = function mapConfigArg(configArg) {
github TYRMars / ES6-StepPitGuide / es6 / node_modules / webpack / bin / convert-argv.js View on Github external
configFiles.forEach(function(file) {
			registerCompiler(interpret.extensions[file.ext]);
			options.push(requireConfig(file.path));
		});
		configFileLoaded = true;
github sx1989827 / DOClever / Desktop / node_modules / webpack / bin / convert-argv.js View on Github external
configFiles.forEach(function(file) {
			registerCompiler(interpret.extensions[file.ext]);
			options.push(requireConfig(file.path));
		});
		configFileLoaded = true;
github miukimiu / react-kawaii / node_modules / webpack / bin / convert-argv.js View on Github external
configFiles.forEach(function(file) {
			registerCompiler(interpret.extensions[file.ext]);
			options.push(requireConfig(file.path));
		});
		configFileLoaded = true;
github sx1989827 / DOClever / node_modules / webpack / bin / convert-argv.js View on Github external
configFiles.forEach(function(file) {
			registerCompiler(interpret.extensions[file.ext]);
			options.push(requireConfig(file.path));
		});
		configFileLoaded = true;

interpret

A dictionary of file extensions and associated module loaders.

MIT
Latest version published 2 years ago

Package Health Score

77 / 100
Full package analysis

Popular interpret functions