Skip to content

Commit e2b89bb

Browse files
author
Michael Hladky
committed
refactor: use jiti in favour of bundle-require
1 parent f74d2dd commit e2b89bb

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
"husky": "^8.0.0",
103103
"inquirer": "^9.3.7",
104104
"jest-extended": "^6.0.0",
105-
"jiti": "2.4.2",
105+
"jiti": "^2.4.2",
106106
"jsdom": "~24.0.0",
107107
"jsonc-eslint-parser": "^2.4.0",
108108
"knip": "^5.33.3",

packages/utils/src/lib/file-system.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import ansis from 'ansis';
2-
import { type Options, bundleRequire } from 'bundle-require';
2+
import { type JitiOptions, createJiti } from 'jiti';
33
import { mkdir, readFile, readdir, rm, stat } from 'node:fs/promises';
44
import path from 'node:path';
55
import type { Format, PersistConfig } from '@code-pushup/models';
@@ -77,8 +77,11 @@ export function logMultipleFileResults(
7777
);
7878
}
7979

80-
export async function importModule<T = unknown>(options: Options): Promise<T> {
81-
const { mod } = await bundleRequire<object>(options);
80+
const jitiImport = createJiti(process.cwd());
81+
export async function importModule<T = unknown>({
82+
filepath,
83+
}: JitiOptions): Promise<T> {
84+
const { mod } = await jitiImport(filepath);
8285

8386
if (typeof mod === 'object' && 'default' in mod) {
8487
return mod.default as T;

0 commit comments

Comments
 (0)