Skip to content

Commit c68258a

Browse files
author
John Doe
committed
refactor: cfg rolldown 2
1 parent 5c60ec8 commit c68258a

File tree

8 files changed

+21
-6
lines changed

8 files changed

+21
-6
lines changed

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default tseslint.config(
2727
allow: [
2828
String.raw`^.*/eslint(\.base)?\.config\.[cm]?js$`,
2929
String.raw`^.*/code-pushup\.(config|preset)(\.m?[jt]s)?$`,
30+
String.raw`^.*/rolldown(\.base)?\.config\.[cm]?js$`,
3031
'^[./]+/tools/.*$',
3132
],
3233
depConstraints: [

nx.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"--max-warnings=0",
7676
"--no-warn-ignored",
7777
"--error-on-unmatched-pattern=false",
78-
"--format=./tools/eslint-formatter-multi/dist/src/index.js"
78+
"--format=./tools/eslint-formatter-multi/dist/index.js"
7979
],
8080
"env": {
8181
"ESLINT_FORMATTER_CONFIG": "{\"outputDir\":\"{projectRoot}/.eslint\"}"

packages/plugin-coverage/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
}
5959
},
6060
"files": [
61-
"src",
61+
"dist",
6262
"!**/*.tsbuildinfo"
6363
]
6464
}

packages/plugin-coverage/rolldown.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ const projectRoot = import.meta.dirname;
44

55
export default baseConfig({
66
projectRoot,
7+
entry: [`${projectRoot}/src/index.ts`, `${projectRoot}/src/bin.ts`],
78
});

packages/plugin-js-packages/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"zod": "^4.0.5"
4646
},
4747
"files": [
48-
"src",
48+
"dist",
4949
"!**/*.tsbuildinfo"
5050
]
5151
}

packages/plugin-js-packages/rolldown.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ const projectRoot = import.meta.dirname;
44

55
export default baseConfig({
66
projectRoot,
7+
entry: [`${projectRoot}/src/index.ts`, `${projectRoot}/src/bin.ts`],
78
});

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { bold, gray } from 'ansis';
22
import { type Options, bundleRequire } from 'bundle-require';
33
import { mkdir, readFile, readdir, rm, stat } from 'node:fs/promises';
44
import path from 'node:path';
5+
import { pathToFileURL } from 'node:url';
56
import type { Format, PersistConfig } from '@code-pushup/models';
67
import { formatBytes } from './formatting.js';
78
import { logMultipleResults } from './log-results.js';
@@ -77,7 +78,15 @@ export function logMultipleFileResults(
7778
}
7879

7980
export async function importModule<T = unknown>(options: Options): Promise<T> {
80-
const { mod } = await bundleRequire<object>(options);
81+
// Convert filepath to URL for proper ESM loading on Windows
82+
const filepath = path.isAbsolute(options.filepath)
83+
? pathToFileURL(options.filepath).toString()
84+
: options.filepath;
85+
86+
const { mod } = await bundleRequire<object>({
87+
...options,
88+
filepath,
89+
});
8190

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

rolldown.base.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,13 @@ function generateExportsField(
168168
export interface BaseConfigOptions {
169169
projectRoot: string;
170170
/**
171-
* Entry point pattern or file path
171+
* Entry point pattern or file path. Can be:
172+
* - A string for a single entry point
173+
* - An array of strings for multiple entry points
174+
* - An object mapping entry names to file paths
172175
* @default `${projectRoot}/src/index.ts`
173176
*/
174-
entry?: string;
177+
entry?: string | string[] | Record<string, string>;
175178
/**
176179
* Root directory for preserving module structure
177180
* @default 'src'

0 commit comments

Comments
 (0)