@ghom/orm 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,6 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.ORM = void 0;
26
+ const url_1 = __importDefault(require("url"));
26
27
  const handler_1 = require("@ghom/handler");
27
28
  const knex_1 = __importDefault(require("knex"));
28
29
  const table_js_1 = require("./table.js");
@@ -46,7 +47,7 @@ class ORM extends handler_1.Handler {
46
47
  async init() {
47
48
  this.once("finish", async (pathList) => {
48
49
  const tables = await Promise.all(pathList.map(async (filepath) => {
49
- return Promise.resolve().then(() => __importStar(require(filepath))).then((file) => file.default);
50
+ return Promise.resolve().then(() => __importStar(require(require !== void 0 ? filepath : url_1.default.pathToFileURL(filepath).href))).then((file) => file.default);
50
51
  }));
51
52
  const migration = new table_js_1.Table({
52
53
  name: "migration",
@@ -1,3 +1,4 @@
1
+ import url from "url";
1
2
  import { Handler } from "@ghom/handler";
2
3
  import { default as knex } from "knex";
3
4
  import { Table } from "./table.js";
@@ -23,7 +24,7 @@ export class ORM extends Handler {
23
24
  async init() {
24
25
  this.once("finish", async (pathList) => {
25
26
  const tables = await Promise.all(pathList.map(async (filepath) => {
26
- return import(filepath).then((file) => file.default);
27
+ return import(require !== void 0 ? filepath : url.pathToFileURL(filepath).href).then((file) => file.default);
27
28
  }));
28
29
  const migration = new Table({
29
30
  name: "migration",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghom/orm",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "license": "MIT",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/app/orm.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import url from "url"
1
2
  import { Handler } from "@ghom/handler"
2
3
  import { Knex, default as knex } from "knex"
3
4
  import { MigrationData, Table } from "./table.js"
@@ -44,7 +45,9 @@ export class ORM extends Handler {
44
45
  this.once("finish", async (pathList) => {
45
46
  const tables: Table<any>[] = await Promise.all(
46
47
  pathList.map(async (filepath) => {
47
- return import(filepath).then((file) => file.default)
48
+ return import(
49
+ require !== void 0 ? filepath : url.pathToFileURL(filepath).href
50
+ ).then((file) => file.default)
48
51
  })
49
52
  )
50
53