Skip to content

Commit

Permalink
Enable esModuleInterop to ease the transition to ES modules
Browse files Browse the repository at this point in the history
Change-type: patch
  • Loading branch information
Page- committed Nov 11, 2022
1 parent d766e3d commit 103c890
Show file tree
Hide file tree
Showing 120 changed files with 223 additions and 241 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"balena-auth": "^4.1.2",
"balena-register-device": "^8.0.0",
"balena-request": "^11.5.9",
"blinking": "0.0.5",
"blinking": "0.0.7-publish-declaration-9a93191e1e6d09a0562f656dde396061dd1ad29b-1",
"bluebird": "^3.7.2",
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
Expand Down
4 changes: 2 additions & 2 deletions src/api-binder/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as Bluebird from 'bluebird';
import Bluebird from 'bluebird';
import { stripIndent } from 'common-tags';
import { isLeft } from 'fp-ts/lib/Either';
import * as t from 'io-ts';
import * as _ from 'lodash';
import _ from 'lodash';
import { PinejsClientRequest } from 'pinejs-client-request';
import * as url from 'url';
import * as deviceRegister from '../lib/register-device';
Expand Down
2 changes: 1 addition & 1 deletion src/api-binder/report.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as url from 'url';
import * as _ from 'lodash';
import _ from 'lodash';
import { delay } from 'bluebird';
import { CoreOptions } from 'request';
import { performance } from 'perf_hooks';
Expand Down
4 changes: 2 additions & 2 deletions src/compose/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';

import Network from './network';
Expand All @@ -14,7 +14,7 @@ import {
} from './composition-steps';
import * as targetStateCache from '../device-state/target-state-cache';
import * as dockerUtils from '../lib/docker-utils';
import constants = require('../lib/constants');
import constants from '../lib/constants';

import { getStepsFromStrategy } from './update-strategies';

Expand Down
4 changes: 2 additions & 2 deletions src/compose/application-manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { EventEmitter } from 'events';
import StrictEventEmitter from 'strict-event-emitter-types';

Expand All @@ -10,7 +10,7 @@ import proxyvisor from '../proxyvisor';

import * as dbFormat from '../device-state/db-format';
import { validateTargetContracts } from '../lib/contracts';
import constants = require('../lib/constants');
import constants from '../lib/constants';
import { docker } from '../lib/docker-utils';
import log from '../lib/supervisor-console';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/compose/composition-steps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';

import * as config from '../config';

Expand Down
6 changes: 3 additions & 3 deletions src/compose/images.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as Bluebird from 'bluebird';
import * as Docker from 'dockerode';
import Bluebird from 'bluebird';
import Docker from 'dockerode';
import { EventEmitter } from 'events';
import * as _ from 'lodash';
import _ from 'lodash';
import StrictEventEmitter from 'strict-event-emitter-types';

import * as config from '../config';
Expand Down
6 changes: 3 additions & 3 deletions src/compose/network-manager.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as Bluebird from 'bluebird';
import * as _ from 'lodash';
import Bluebird from 'bluebird';
import _ from 'lodash';

import * as constants from '../lib/constants';
import { docker } from '../lib/docker-utils';
import { isNotFoundError } from '../lib/errors';
import logTypes = require('../lib/log-types');
import * as logTypes from '../lib/log-types';
import log from '../lib/supervisor-console';

import * as logger from '../logger';
Expand Down
4 changes: 2 additions & 2 deletions src/compose/network.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as _ from 'lodash';
import _ from 'lodash';
import * as dockerode from 'dockerode';

import { docker } from '../lib/docker-utils';
import logTypes = require('../lib/log-types');
import * as logTypes from '../lib/log-types';
import * as logger from '../logger';
import log from '../lib/supervisor-console';
import * as ComposeUtils from './utils';
Expand Down
2 changes: 1 addition & 1 deletion src/compose/ports.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { TypedError } from 'typed-error';

// Adapted from https://github.com/docker/docker-py/blob/master/docker/utils/ports.py#L3
Expand Down
2 changes: 1 addition & 1 deletion src/compose/sanitise.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';

import { ConfigMap, ServiceComposeConfig } from './types/service';

Expand Down
6 changes: 3 additions & 3 deletions src/compose/service-manager.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as Bluebird from 'bluebird';
import Bluebird from 'bluebird';
import * as Dockerode from 'dockerode';
import { EventEmitter } from 'events';
import { isLeft } from 'fp-ts/lib/Either';
import * as JSONStream from 'JSONStream';
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';
import StrictEventEmitter from 'strict-event-emitter-types';

Expand All @@ -12,7 +12,7 @@ import { docker } from '../lib/docker-utils';
import * as logger from '../logger';

import { PermissiveNumber } from '../config/types';
import constants = require('../lib/constants');
import constants from '../lib/constants';
import {
InternalInconsistencyError,
isNotFoundError,
Expand Down
4 changes: 2 additions & 2 deletions src/compose/service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { detailedDiff as diff } from 'deep-object-diff';
import * as Dockerode from 'dockerode';
import Duration = require('duration-js');
import * as _ from 'lodash';
import Duration from 'duration-js';
import _ from 'lodash';
import * as path from 'path';

import { DockerPortOptions, PortMap } from './ports';
Expand Down
4 changes: 2 additions & 2 deletions src/compose/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Dockerode from 'dockerode';
import Duration = require('duration-js');
import * as _ from 'lodash';
import Duration from 'duration-js';
import _ from 'lodash';
import { parse as parseCommand } from 'shell-quote';

import * as constants from '../lib/constants';
Expand Down
4 changes: 2 additions & 2 deletions src/compose/volume-manager.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as _ from 'lodash';
import _ from 'lodash';
import * as Path from 'path';
import { VolumeInspectInfo } from 'dockerode';

import constants = require('../lib/constants');
import constants from '../lib/constants';
import { isNotFoundError, InternalInconsistencyError } from '../lib/errors';
import { safeRename } from '../lib/fs-utils';
import { docker } from '../lib/docker-utils';
Expand Down
8 changes: 4 additions & 4 deletions src/compose/volume.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as Docker from 'dockerode';
import isEqual = require('lodash/isEqual');
import omitBy = require('lodash/omitBy');
import Docker from 'dockerode';
import isEqual from 'lodash/isEqual';
import omitBy from 'lodash/omitBy';

import constants = require('../lib/constants');
import constants from '../lib/constants';
import { docker } from '../lib/docker-utils';
import { InternalInconsistencyError } from '../lib/errors';
import * as LogTypes from '../lib/log-types';
Expand Down
2 changes: 1 addition & 1 deletion src/config/backends/backend.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';

export interface ConfigOptions {
[key: string]: string | string[];
Expand Down
2 changes: 1 addition & 1 deletion src/config/backends/config-fs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';
import * as path from 'path';

Expand Down
2 changes: 1 addition & 1 deletion src/config/backends/config-txt.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';

import { ConfigOptions, ConfigBackend } from './backend';
Expand Down
2 changes: 1 addition & 1 deletion src/config/backends/extlinux-file.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';

import { ConfigOptions } from './backend';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/config/backends/extlinux.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';
import * as semver from 'semver';

Expand Down
2 changes: 1 addition & 1 deletion src/config/backends/extra-uEnv.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';

import { ConfigOptions, ConfigBackend } from './backend';
Expand Down
2 changes: 1 addition & 1 deletion src/config/backends/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';

import { Extlinux } from './extlinux';
import { ExtraUEnv } from './extra-uEnv';
Expand Down
2 changes: 1 addition & 1 deletion src/config/backends/odmdata.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';

import { ConfigOptions, ConfigBackend } from './backend';
Expand Down
4 changes: 2 additions & 2 deletions src/config/backends/splash-image.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Bluebird from 'bluebird';
import * as _ from 'lodash';
import Bluebird from 'bluebird';
import _ from 'lodash';
import { promises as fs } from 'fs';
import * as path from 'path';

Expand Down
4 changes: 2 additions & 2 deletions src/config/configJson.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Bluebird from 'bluebird';
import * as _ from 'lodash';
import Bluebird from 'bluebird';
import _ from 'lodash';
import { promises as fs } from 'fs';
import * as path from 'path';

Expand Down
11 changes: 5 additions & 6 deletions src/config/functions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as Bluebird from 'bluebird';
import * as _ from 'lodash';
import * as memoizee from 'memoizee';
import _ from 'lodash';
import memoizee from 'memoizee';
import { promises as fs } from 'fs';

import supervisorVersion = require('../lib/supervisor-version');
import supervisorVersion from '../lib/supervisor-version';

import * as config from '.';
import * as constants from '../lib/constants';
Expand All @@ -12,8 +11,8 @@ import * as macAddress from '../lib/mac-address';
import log from '../lib/supervisor-console';

export const fnSchema = {
version: () => {
return Bluebird.resolve(supervisorVersion);
version: async () => {
return supervisorVersion;
},
currentApiKey: () => {
return config
Expand Down
4 changes: 2 additions & 2 deletions src/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EventEmitter } from 'events';
import type { Knex } from 'knex';
import * as _ from 'lodash';
import _ from 'lodash';
import StrictEventEmitter from 'strict-event-emitter-types';
import { inspect } from 'util';
import { generateUniqueKey } from '../lib/register-device';
Expand Down Expand Up @@ -86,7 +86,7 @@ export async function get<T extends SchemaTypeKey>(
// we can validate the output of the function as well, ensuring that the type matches
const promiseValue = FnSchema.fnSchema[fnKey]();
return promiseValue
.then((value: unknown) => {
.then((value) => {
const decoded = schemaTypes[key].type.decode(value);

return checkValueDecode(decoded, key, value) && decoded.right;
Expand Down
2 changes: 1 addition & 1 deletion src/config/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { either, isRight } from 'fp-ts/lib/Either';
import * as t from 'io-ts';
import * as _ from 'lodash';
import _ from 'lodash';

import { InternalInconsistencyError } from '../lib/errors';
import { checkBooleanish, checkTruthy } from '../lib/validation';
Expand Down
4 changes: 2 additions & 2 deletions src/config/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as _ from 'lodash';
import * as Bluebird from 'bluebird';
import _ from 'lodash';
import Bluebird from 'bluebird';

import * as config from '../config';
import * as constants from '../lib/constants';
Expand Down
2 changes: 1 addition & 1 deletion src/db.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { knex, Knex } from 'knex';
import * as path from 'path';
import * as _ from 'lodash';
import _ from 'lodash';

import * as constants from './lib/constants';

Expand Down
6 changes: 3 additions & 3 deletions src/device-api/api-keys.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as _ from 'lodash';
import * as express from 'express';
import * as memoizee from 'memoizee';
import _ from 'lodash';
import express from 'express';
import memoizee from 'memoizee';
import { TypedError } from 'typed-error';

import * as db from '../db';
Expand Down
4 changes: 2 additions & 2 deletions src/device-api/common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Bluebird from 'bluebird';
import * as _ from 'lodash';
import Bluebird from 'bluebird';
import _ from 'lodash';

import * as logger from '../logger';
import * as deviceState from '../device-state';
Expand Down
6 changes: 3 additions & 3 deletions src/device-api/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as express from 'express';
import * as _ from 'lodash';
import express from 'express';
import _ from 'lodash';

import * as middleware from './middleware';
import * as apiKeys from './api-keys';
import * as eventTracker from '../event-tracker';
import { reportCurrentState } from '../device-state';
import proxyvisor from '../proxyvisor';
import blink = require('../lib/blink');
import blink from '../lib/blink';
import log from '../lib/supervisor-console';

import type { Server } from 'http';
Expand Down
2 changes: 1 addition & 1 deletion src/device-api/middleware/errors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';

import { UpdatesLockedError } from '../../lib/errors';
import log from '../../lib/supervisor-console';
Expand Down
2 changes: 1 addition & 1 deletion src/device-api/middleware/logging.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as morgan from 'morgan';
import morgan from 'morgan';
import { Request } from 'express';

import log from '../../lib/supervisor-console';
Expand Down
4 changes: 2 additions & 2 deletions src/device-api/v1.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as express from 'express';
import * as _ from 'lodash';
import express from 'express';
import _ from 'lodash';

import { doRestart, doPurge } from './common';
import { AuthorizedRequest } from './api-keys';
Expand Down
Loading

0 comments on commit 103c890

Please sign in to comment.