@adpt/core
Version:
AdaptJS core library
43 lines • 1.57 kB
JavaScript
;
/*
* Copyright 2019 Unbounded Systems, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* This is a helper module that allows for lazy loading the typescript
* module, yet still giving access to the static types we use.
* This allows adapt (and the adapt CLI in particular) to not require
* typescript and instead use the version of typescript installed in a
* given project.
*/
const utils_1 = require("@adpt/utils");
let tsmod_;
function tsmod() {
if (!tsmod_) {
try {
// tslint:disable-next-line:no-var-requires
tsmod_ = require("typescript");
}
catch (err) {
throw new utils_1.UserError(`Unable to load typescript module. This operation may only be ` +
`possible from within an Adapt project directory`);
}
}
if (!tsmod_)
throw new utils_1.InternalError(`tsmod_ cannot be null`);
return tsmod_;
}
exports.tsmod = tsmod;
//# sourceMappingURL=tsmod.js.map