@truffle/compile-solidity
Version:
Compiler helper and artifact manager for Solidity files
45 lines • 2.33 kB
JavaScript
;
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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Profiler = void 0;
// Compares .sol files to their .sol.js counterparts,
// determines which .sol files have been updated.
const profiler_1 = require("@truffle/profiler");
const loadParser_1 = require("./loadParser");
const shouldIncludePath_1 = require("./shouldIncludePath");
exports.Profiler = {
updated: (options) => __awaiter(void 0, void 0, void 0, function* () {
const profiler = new profiler_1.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, solc) => __awaiter(void 0, void 0, void 0, function* () {
// get parser
const parseImports = yield (0, loadParser_1.loadParser)(options, solc);
// generate profiler
const profiler = new profiler_1.Profiler({
parseImports,
shouldIncludePath: shouldIncludePath_1.shouldIncludePath
});
// invoke profiler
return yield profiler.requiredSources(options);
}),
requiredSourcesForSingleFile: (options) => __awaiter(void 0, void 0, void 0, function* () {
const parseImports = yield (0, loadParser_1.loadParser)(options);
const profiler = new profiler_1.Profiler({
parseImports,
shouldIncludePath: shouldIncludePath_1.shouldIncludePath
});
return profiler.requiredSourcesForSingleFile(options);
})
};
//# sourceMappingURL=index.js.map