@truffle/compile-solidity
Version:
Compiler helper and artifact manager for Solidity files
43 lines • 2.12 kB
JavaScript
// Compares .sol files to their .sol.js counterparts,
// determines which .sol files have been updated.
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
const debug = require("debug")("compile:profiler");
const { Profiler } = require("@truffle/profiler");
const { loadParser } = require("./loadParser");
const { shouldIncludePath } = require("./shouldIncludePath");
module.exports = {
updated: (options) => __awaiter(this, void 0, void 0, function* () {
const profiler = yield new Profiler({});
return yield profiler.updated(options);
}),
// Returns the minimal set of sources to pass to solc as compilations targets,
// as well as the complete set of sources so solc can resolve the comp targets' imports.
requiredSources: (options) => __awaiter(this, void 0, void 0, function* () {
// get parser
const parseImports = yield loadParser(options);
// generate profiler
const profiler = new Profiler({
parseImports,
shouldIncludePath
});
// invoke profiler
return yield profiler.requiredSources(options);
}),
requiredSourcesForSingleFile: (options) => __awaiter(this, void 0, void 0, function* () {
const parseImports = yield loadParser(options);
const profiler = new Profiler({
parseImports,
shouldIncludePath
});
return profiler.requiredSourcesForSingleFile(options);
})
};
//# sourceMappingURL=index.js.map