Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable esModuleInterop to ease the transition to ES modules #2057

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 { ConfigOptions, ConfigBackend } from './backend';
import * as constants from '../../lib/constants';
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
4 changes: 2 additions & 2 deletions src/config/backends/extlinux.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as _ from 'lodash';
import * as semver from 'semver';
import _ from 'lodash';
import semver from 'semver';

import { ConfigOptions, ConfigBackend } from './backend';
import {
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 { ConfigOptions, ConfigBackend } from './backend';
import * as constants from '../../lib/constants';
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 * as path from 'path';

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

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 hostUtils from '../lib/host-utils';
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
8 changes: 4 additions & 4 deletions src/device-api/v2.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as Bluebird from 'bluebird';
import * as express from 'express';
import Bluebird from 'bluebird';
import express from 'express';
import type { Response, NextFunction } from 'express';
import * as _ from 'lodash';
import _ from 'lodash';

import * as deviceState from '../device-state';
import * as apiBinder from '../api-binder';
Expand All @@ -28,7 +28,7 @@ import {
v2ServiceEndpointInputErrorMessage,
} from './messages';
import log from '../lib/supervisor-console';
import supervisorVersion = require('../lib/supervisor-version');
import supervisorVersion from '../lib/supervisor-version';
import { checkInt, checkTruthy } from '../lib/validation';
import { isVPNActive } from '../network';
import { doPurge, doRestart, safeStateClone } from './common';
Expand Down
2 changes: 1 addition & 1 deletion src/device-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash';
import { inspect } from 'util';
import { promises as fs } from 'fs';

Expand Down
8 changes: 4 additions & 4 deletions src/device-state.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as Bluebird from 'bluebird';
import Bluebird from 'bluebird';
import { stripIndent } from 'common-tags';
import { EventEmitter } from 'events';
import * as _ from 'lodash';
import _ from 'lodash';
import StrictEventEmitter from 'strict-event-emitter-types';
import { isRight } from 'fp-ts/lib/Either';
import Reporter from 'io-ts-reporters';
import prettyMs = require('pretty-ms');
import prettyMs from 'pretty-ms';

import * as config from './config';
import * as db from './db';
Expand All @@ -15,7 +15,7 @@ import * as globalEventBus from './event-bus';
import * as network from './network';
import * as deviceConfig from './device-config';

import constants = require('./lib/constants');
import constants from './lib/constants';
import * as dbus from './lib/dbus';
import {
InternalInconsistencyError,
Expand Down
Loading