balena-cli
Version:
The official balena Command Line Interface
43 lines • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.stripIndent = exports.getCliUx = exports.getCliForm = exports.getVisuals = exports.getBalenaSdk = exports.onceAsync = void 0;
const { version } = require('../../package.json');
const once = (fn) => {
let cached;
return () => {
if (!cached) {
cached = fn();
}
return cached;
};
};
const onceAsync = (fn) => {
let cached;
return async () => {
if (!cached) {
cached = await fn();
}
return cached;
};
};
exports.onceAsync = onceAsync;
const cliXBalenaClientHeaderInterceptor = {
request($request) {
if ($request.headers['X-Balena-Client']) {
$request.headers['X-Balena-Client'] = `balena-cli/${version}`;
}
return $request;
},
};
exports.getBalenaSdk = once(() => {
const sdk = require('balena-sdk').fromSharedOptions();
if (!sdk.interceptors.includes(cliXBalenaClientHeaderInterceptor)) {
sdk.interceptors.push(cliXBalenaClientHeaderInterceptor);
}
return sdk;
});
exports.getVisuals = once(() => require('resin-cli-visuals'));
exports.getCliForm = once(() => require('resin-cli-form'));
exports.getCliUx = once(() => require('@oclif/core/ux').ux);
exports.stripIndent = require('common-tags/lib/stripIndent');
//# sourceMappingURL=lazy.js.map