Skip to content

Commit

Permalink
Switch to ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
joelpurra committed Aug 6, 2021
1 parent bc78df7 commit 77757f0
Show file tree
Hide file tree
Showing 27 changed files with 1,089 additions and 5,441 deletions.
File renamed without changes.
6,244 changes: 925 additions & 5,319 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions package.json
Expand Up @@ -3,7 +3,8 @@
"version": "3.0.1",
"description": "USB Video Class (UVC) device configurator for the command line (CLI). Used for webcams, camcorders, etcetera.",
"homepage": "https://joelpurra.com/projects/uvcc/",
"main": "./dist/index.js",
"type": "module",
"exports": "./dist/index.js",
"types": "./dist/index.d.ts",
"bin": {
"uvcc": "./dist/index.js"
Expand Down Expand Up @@ -36,7 +37,8 @@
"filter-obj": "^2.0.2",
"find-up": "^5.0.0",
"map-obj": "^4.2.1",
"sort-keys": "^4.2.0",
"read-pkg-up": "^8.0.0",
"sort-keys": "^5.0.0",
"stream-to-promise": "^3.0.0",
"uvc-control": "github:joelpurra/node-uvc-control#v2",
"yargs": "^17.1.0"
Expand All @@ -48,15 +50,15 @@
"@types/stream-to-promise": "^2.2.1",
"@types/usb": "^1.5.3",
"@types/yargs": "^17.0.2",
"eslint-config-joelpurra": "github:joelpurra/eslint-config-joelpurra#semver:^v3.0.0",
"eslint-config-joelpurra": "github:joelpurra/eslint-config-joelpurra#semver:^v6.0.0",
"husky": "^4.3.8",
"rimraf": "^3.0.2",
"type-fest": "^0.20.2",
"typescript": "^4.3.5",
"xo": "^0.38.2"
"xo": "^0.43.0"
},
"engines": {
"node": ">=12.0.0"
"node": "^12.20.0 || ^14.13.1 || ^16.0.0"
},
"keywords": [
"usb",
Expand Down
4 changes: 2 additions & 2 deletions src/camera-control-helper-factory.ts
Expand Up @@ -16,15 +16,15 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import assert from "assert";
import assert from "node:assert";
import {
ReadonlyDeep,
} from "type-fest";
import Camera, {
UvcControl,
} from "uvc-control";

import CameraControlHelperClass from "./camera-control-helper";
import CameraControlHelperClass from "./camera-control-helper.js";

export default class CameraControlHelperFactory {
constructor(private readonly UVCControl: ReadonlyDeep<UvcControl>, private readonly CameraControlHelper: typeof CameraControlHelperClass) {
Expand Down
10 changes: 5 additions & 5 deletions src/camera-control-helper.ts
Expand Up @@ -16,20 +16,20 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import assert from "assert";
import arrayNonUniq from "array-non-uniq";
import filterObject from "filter-obj";
import assert from "node:assert";
import sortKeys from "sort-keys";
import {
ReadonlyDeep,
} from "type-fest";
import Camera,
{
CameraControl,
UvcControl,
} from "uvc-control";

import {
ReadonlyDeep,
} from "type-fest";
import WrappedError from "./utilities/wrapped-error";
import WrappedError from "./utilities/wrapped-error.js";

interface ControlFlags {
readonly isGettable: boolean;
Expand Down
8 changes: 4 additions & 4 deletions src/camera-factory.ts
Expand Up @@ -16,18 +16,18 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import assert from "assert";
import assert from "node:assert";
import {
ReadonlyDeep,
} from "type-fest";
import Camera, {
ConstructorOptions,
UvcControl,
} from "uvc-control";
import Output from "./output";
import toFormattedHex from "./utilities/to-formatted-hex";

import WrappedError from "./utilities/wrapped-error";
import Output from "./output.js";
import toFormattedHex from "./utilities/to-formatted-hex.js";
import WrappedError from "./utilities/wrapped-error.js";

interface GetFunctionArguments {
address: number | null;
Expand Down
10 changes: 5 additions & 5 deletions src/camera-helper-factory.ts
Expand Up @@ -16,15 +16,15 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import assert from "assert";
import Camera from "uvc-control";
import assert from "node:assert";
import {
ReadonlyDeep,
} from "type-fest";
import Camera from "uvc-control";

import CameraControlHelperFactory from "./camera-control-helper-factory";
import CameraHelperClass from "./camera-helper";
import Output from "./output";
import CameraControlHelperFactory from "./camera-control-helper-factory.js";
import CameraHelperClass from "./camera-helper.js";
import Output from "./output.js";

export default class CameraHelperFactory {
constructor(private readonly output: ReadonlyDeep<Output>, private readonly cameraControlHelperFactory: ReadonlyDeep<CameraControlHelperFactory>, private readonly CameraHelper: typeof CameraHelperClass) {
Expand Down
11 changes: 6 additions & 5 deletions src/camera-helper.ts
Expand Up @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import assert from "assert";
import Bluebird from "bluebird";
import assert from "node:assert";
import {
ReadonlyDeep,
} from "type-fest";
Expand All @@ -28,12 +28,12 @@ import Camera, {
ControlValues,
} from "uvc-control";

import CameraControlHelper from "./camera-control-helper";
import Output from "./output";
import CameraControlHelper from "./camera-control-helper.js";
import Output from "./output.js";
import {
UvccControls,
} from "./types/controls";
import isUvccControlValue from "./utilities/is-uvcc-control-value";
} from "./types/controls.js";
import isUvccControlValue from "./utilities/is-uvcc-control-value.js";

export type ControlsValues = Record<string, ControlValues>;
export type ControlRanges = Record<string, ControlRange>;
Expand Down Expand Up @@ -137,6 +137,7 @@ export default class CameraHelper {

await Bluebird.map(
controlNames,
// eslint-disable-next-line unicorn/no-array-method-this-argument
async (controlName) => {
const controlValues = configuration[controlName];

Expand Down
6 changes: 3 additions & 3 deletions src/command-handlers.ts
Expand Up @@ -16,16 +16,16 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import assert from "assert";
import assert from "node:assert";
import {
ReadonlyDeep,
} from "type-fest";

import Output from "./output";
import Output from "./output.js";
import {
CommandHandlerArgumentNames,
CommandName, Commands,
} from "./types/command";
} from "./types/command.js";

export default class CommandHandlers {
constructor(private readonly output: Output, private readonly commands: ReadonlyDeep<Commands>) {
Expand Down
6 changes: 3 additions & 3 deletions src/command-handlers/controls.ts
Expand Up @@ -16,17 +16,17 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import assert from "assert";
import assert from "node:assert";
import {
ReadonlyDeep,
} from "type-fest";

import CameraHelper from "../camera-helper";
import CameraHelper from "../camera-helper.js";
import {
Command,
CommandHandlerArgumentCameraHelper,
CommandHandlerArgumentNames,
} from "../types/command";
} from "../types/command.js";

export default class ControlsCommand implements Command {
constructor() {
Expand Down
6 changes: 3 additions & 3 deletions src/command-handlers/devices.ts
Expand Up @@ -16,13 +16,13 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import assert from "assert";
import assert from "node:assert";

import {
Command,
CommandHandlerArgumentNames,
} from "../types/command";
import UvcDeviceLister from "../uvc-device-lister";
} from "../types/command.js";
import UvcDeviceLister from "../uvc-device-lister.js";

export default class DevicesCommand implements Command {
constructor(private readonly uvcDeviceLister: UvcDeviceLister) {
Expand Down
10 changes: 5 additions & 5 deletions src/command-handlers/export.ts
Expand Up @@ -16,22 +16,22 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import assert from "assert";
import mapObj from "map-obj";
import assert from "node:assert";
import {
ReadonlyDeep,
} from "type-fest";

import CameraHelper from "../camera-helper";
import CameraHelper from "../camera-helper.js";
import {
Command,
CommandHandlerArgumentCameraHelper,
CommandHandlerArgumentNames,
} from "../types/command";
} from "../types/command.js";
import {
UvccControls,
} from "../types/controls";
import flattenControlValues from "../utilities/flatten-control-values";
} from "../types/controls.js";
import flattenControlValues from "../utilities/flatten-control-values.js";

export default class ExportCommand implements Command {
constructor() {
Expand Down
8 changes: 4 additions & 4 deletions src/command-handlers/get.ts
Expand Up @@ -16,21 +16,21 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import assert from "assert";
import assert from "node:assert";
import {
ReadonlyDeep,
} from "type-fest";
import {
ControlName,
} from "uvc-control";

import CameraHelper from "../camera-helper";
import CameraHelper from "../camera-helper.js";
import {
Command,
CommandHandlerArgumentCameraHelper,
CommandHandlerArgumentNames,
} from "../types/command";
import flattenControlValues from "../utilities/flatten-control-values";
} from "../types/command.js";
import flattenControlValues from "../utilities/flatten-control-values.js";

export default class GetCommand implements Command {
constructor() {
Expand Down
9 changes: 5 additions & 4 deletions src/command-handlers/import.ts
Expand Up @@ -16,20 +16,21 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import assert from "assert";
import Bluebird from "bluebird";
import assert from "node:assert";
import process from "node:process";
import streamToPromise from "stream-to-promise";
import {
ReadonlyDeep,
} from "type-fest";

import CameraHelper from "../camera-helper";
import CameraHelper from "../camera-helper.js";
import {
Command,
CommandHandlerArgumentCameraHelper,
CommandHandlerArgumentNames,
} from "../types/command";
import isUvccControls from "../utilities/is-uvcc-controls";
} from "../types/command.js";
import isUvccControls from "../utilities/is-uvcc-controls.js";

export default class ImportCommand implements Command {
constructor() {
Expand Down
6 changes: 3 additions & 3 deletions src/command-handlers/range.ts
Expand Up @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import assert from "assert";
import assert from "node:assert";
import {
ReadonlyDeep,
} from "type-fest";
Expand All @@ -25,12 +25,12 @@ import {
ControlRange,
} from "uvc-control";

import CameraHelper from "../camera-helper";
import CameraHelper from "../camera-helper.js";
import {
Command,
CommandHandlerArgumentCameraHelper,
CommandHandlerArgumentNames,
} from "../types/command";
} from "../types/command.js";

export default class RangeCommand implements Command {
constructor() {
Expand Down
6 changes: 3 additions & 3 deletions src/command-handlers/ranges.ts
Expand Up @@ -16,20 +16,20 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import assert from "assert";
import assert from "node:assert";
import {
ReadonlyDeep,
} from "type-fest";

import CameraHelper,
{
ControlRanges,
} from "../camera-helper";
} from "../camera-helper.js";
import {
Command,
CommandHandlerArgumentCameraHelper,
CommandHandlerArgumentNames,
} from "../types/command";
} from "../types/command.js";

export default class RangesCommand implements Command {
constructor() {
Expand Down
6 changes: 3 additions & 3 deletions src/command-handlers/set.ts
Expand Up @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import assert from "assert";
import assert from "node:assert";
import {
ReadonlyDeep,
} from "type-fest";
Expand All @@ -25,12 +25,12 @@ import {
ControlValue,
} from "uvc-control";

import CameraHelper from "../camera-helper";
import CameraHelper from "../camera-helper.js";
import {
Command,
CommandHandlerArgumentCameraHelper,
CommandHandlerArgumentNames,
} from "../types/command";
} from "../types/command.js";

export default class SetCommand implements Command {
constructor() {
Expand Down

0 comments on commit 77757f0

Please sign in to comment.