Feat: es modules (#139)
* All file imports change from commonjs to es-module * Improved plex error responses back from api * Converted viewHistory to es module * Es-module requires file extension, updated all imports * Fix esmodule not having __dirname defined in scope * Replace dynamic-require with fs readFileSync * Short message service module function is exported as default * Resolved lint issues & ignore import/extension rule until typescript * All tests file imports changed from commonjs to es-module * Import json fixtures with new helper
This commit was merged in pull request #139.
This commit is contained in:
+3
-3
@@ -1,5 +1,5 @@
|
||||
const assert = require("assert");
|
||||
const establishedDatabase = require("../database/database");
|
||||
import assert from "assert";
|
||||
import establishedDatabase from "../database/database.js";
|
||||
|
||||
class Cache {
|
||||
constructor(database) {
|
||||
@@ -45,4 +45,4 @@ class Cache {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Cache;
|
||||
export default Cache;
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
const moviedb = require("km-moviedb");
|
||||
const redisCache = require("../cache/redis");
|
||||
import moviedb from "km-moviedb";
|
||||
import redisCache from "../cache/redis.js";
|
||||
|
||||
const { Movie, Show, Person, Credits, ReleaseDates } = require("./types");
|
||||
import { Movie, Show, Person, Credits, ReleaseDates } from "./types.js";
|
||||
|
||||
class TMDBNotFoundError extends Error {
|
||||
constructor(message) {
|
||||
@@ -339,4 +339,4 @@ class TMDB {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TMDB;
|
||||
export default TMDB;
|
||||
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
const Movie = require("./types/movie");
|
||||
const Show = require("./types/show");
|
||||
const Person = require("./types/person");
|
||||
const Credits = require("./types/credits");
|
||||
const ReleaseDates = require("./types/releaseDates");
|
||||
import Movie from "./types/movie.js";
|
||||
import Show from "./types/show.js";
|
||||
import Person from "./types/person.js";
|
||||
import Credits from "./types/credits.js";
|
||||
import ReleaseDates from "./types/releaseDates.js";
|
||||
|
||||
module.exports = { Movie, Show, Person, Credits, ReleaseDates };
|
||||
export { Movie, Show, Person, Credits, ReleaseDates };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable camelcase */
|
||||
const Movie = require("./movie");
|
||||
const Show = require("./show");
|
||||
import Movie from "./movie.js";
|
||||
import Show from "./show.js";
|
||||
|
||||
class CreditedMovie extends Movie {}
|
||||
class CreditedShow extends Show {}
|
||||
@@ -113,4 +113,4 @@ class Credits {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Credits;
|
||||
export default Credits;
|
||||
|
||||
@@ -113,4 +113,4 @@ class Movie {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Movie;
|
||||
export default Movie;
|
||||
|
||||
@@ -69,4 +69,4 @@ class Person {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Person;
|
||||
export default Person;
|
||||
|
||||
@@ -89,4 +89,4 @@ class ReleaseDates {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ReleaseDates;
|
||||
export default ReleaseDates;
|
||||
|
||||
@@ -86,4 +86,4 @@ class Show {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Show;
|
||||
export default Show;
|
||||
|
||||
Reference in New Issue
Block a user