UNPKG

1.1 kBPlain TextView Raw
1import * as path from 'path';
2import ts from 'typescript';
3import { LinkedContracts } from './compile/types';
4import { compileContract as compileContractBase, CompileContractResult } from './compileContract';
5import { getSemanticDiagnostics as getSemanticDiagnosticsBase } from './getSemanticDiagnostics';
6import { throwOnDiagnosticErrorOrWarning } from './utils';
7
8export const getSemanticDiagnostics = (
9 filePath: string,
10 languageService: ts.LanguageService,
11 smartContractDir: string = path.dirname(require.resolve('@neo-one/smart-contract')),
12): ReadonlyArray<ts.Diagnostic> => getSemanticDiagnosticsBase({ filePath, languageService, smartContractDir });
13
14export const compileContract = (
15 filePath: string,
16 contractName: string,
17 linked: LinkedContracts = {},
18 ignoreWarnings = false,
19): CompileContractResult => {
20 const result = compileContractBase({ filePath, name: contractName, linked });
21
22 throwOnDiagnosticErrorOrWarning(result.diagnostics, ignoreWarnings);
23
24 return result;
25};
26
27export { CompileContractResult, LinkedContracts };
28export { scan, Contracts } from './scan';