Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions packages/cli/rolldown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,28 @@ export default defineConfig({
if (source === '../../binding/index.js' || source === '../binding/index.js') {
return true;
}
if (source === '../versions.js') {
return true;
}
return false;
},
plugins: [
{
name: 'fix-binding-path',
// Rewrite the binding import path for the output directory.
// Source files import from ../../binding/index.js (relative to src/*/).
// Output is in dist/global/, so the correct path is ../../binding/index.js (two dirs up).
// Rolldown normalizes it to ../binding/index.js which is wrong.
name: 'fix-external-paths',
// Rewrite external import paths for the output directory (dist/global/).
// Rolldown normalizes relative paths from source locations, but the output
// is two directories deep (dist/global/), so the paths need adjustment.
renderChunk(code) {
if (code.includes('../binding/index.js')) {
return { code: code.replaceAll('../binding/index.js', '../../binding/index.js') };
let result = code;
// ../../binding/index.js → Rolldown normalizes to ../binding/index.js, needs ../../
if (result.includes('../binding/index.js')) {
result = result.replaceAll('../binding/index.js', '../../binding/index.js');
}
return null;
// ../versions.js → Rolldown normalizes to ./versions.js, needs ../
if (result.includes('./versions.js')) {
result = result.replaceAll('./versions.js', '../versions.js');
}
return result !== code ? { code: result } : null;
},
},
{
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/migration/migrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ export async function migrateEslintToOxlint(

// Steps 1-2: Only run @oxlint/migrate if there's an eslint config at root
if (eslintConfigFile) {
const migratePackage = '@oxlint/migrate';
// Pin @oxlint/migrate to the bundled oxlint version.
// @ts-expect-error — resolved at runtime from dist/global/ → dist/versions.js
const { versions } = await import('../versions.js');
const migratePackage = `@oxlint/migrate@${versions.oxlint}`;

// Step 1: Generate .oxlintrc.json from ESLint config
spinner.start('Migrating ESLint config to Oxlint...');
Expand Down
Loading