Skip to content

Commit

Permalink
Remove CJS build and require Node 20
Browse files Browse the repository at this point in the history
  • Loading branch information
filipsobol committed Mar 1, 2025
1 parent 7db0cf5 commit 34f9389
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 48 deletions.
39 changes: 15 additions & 24 deletions packages/sonda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"performance",
"devtools"
],
"engines": {
"node": ">=20"
},
"license": "MIT",
"type": "module",
"repository": {
Expand All @@ -31,63 +34,51 @@
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
"import": "./dist/index.mjs"
},
"./angular": {
"types": "./dist/entrypoints/angular.d.ts",
"import": "./dist/entrypoints/angular.mjs",
"require": "./dist/entrypoints/angular.cjs"
"import": "./dist/entrypoints/angular.mjs"
},
"./astro": {
"types": "./dist/entrypoints/astro.d.ts",
"import": "./dist/entrypoints/astro.mjs",
"require": "./dist/entrypoints/astro.cjs"
"import": "./dist/entrypoints/astro.mjs"
},
"./esbuild": {
"types": "./dist/entrypoints/esbuild.d.ts",
"import": "./dist/entrypoints/esbuild.mjs",
"require": "./dist/entrypoints/esbuild.cjs"
"import": "./dist/entrypoints/esbuild.mjs"
},
"./next": {
"types": "./dist/entrypoints/next.d.ts",
"import": "./dist/entrypoints/next.mjs",
"require": "./dist/entrypoints/next.cjs"
"import": "./dist/entrypoints/next.mjs"
},
"./nuxt": {
"types": "./dist/entrypoints/nuxt.d.ts",
"import": "./dist/entrypoints/nuxt.mjs",
"require": "./dist/entrypoints/nuxt.cjs"
"import": "./dist/entrypoints/nuxt.mjs"
},
"./rollup": {
"types": "./dist/entrypoints/rollup.d.ts",
"import": "./dist/entrypoints/rollup.mjs",
"require": "./dist/entrypoints/rollup.cjs"
"import": "./dist/entrypoints/rollup.mjs"
},
"./rolldown": {
"types": "./dist/entrypoints/rollup.d.ts",
"import": "./dist/entrypoints/rollup.mjs",
"require": "./dist/entrypoints/rollup.cjs"
"import": "./dist/entrypoints/rollup.mjs"
},
"./sveltekit": {
"types": "./dist/entrypoints/sveltekit.d.ts",
"import": "./dist/entrypoints/sveltekit.mjs",
"require": "./dist/entrypoints/sveltekit.cjs"
"import": "./dist/entrypoints/sveltekit.mjs"
},
"./rspack": {
"types": "./dist/entrypoints/webpack.d.ts",
"import": "./dist/entrypoints/webpack.mjs",
"require": "./dist/entrypoints/webpack.cjs"
"import": "./dist/entrypoints/webpack.mjs"
},
"./vite": {
"types": "./dist/entrypoints/rollup.d.ts",
"import": "./dist/entrypoints/rollup.mjs",
"require": "./dist/entrypoints/rollup.cjs"
"import": "./dist/entrypoints/rollup.mjs"
},
"./webpack": {
"types": "./dist/entrypoints/webpack.d.ts",
"import": "./dist/entrypoints/webpack.mjs",
"require": "./dist/entrypoints/webpack.cjs"
"import": "./dist/entrypoints/webpack.mjs"
},
"./package.json": "./package.json"
},
Expand Down
32 changes: 8 additions & 24 deletions packages/sonda/rolldown.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ import pkg from './package.json' with { type: 'json' };
// Remove old build folder
await rm( 'dist', { recursive: true, force: true } );

const sharedOptions = defineConfig( {
export default defineConfig( {
output: {
dir: 'dist',
format: 'esm',
sourcemap: true,
entryFileNames: '[name].mjs',
chunkFileNames: '[name].mjs',
},
input: {
'index': 'src/index.ts',
'entrypoints/angular': 'src/entrypoints/angular.ts',
Expand All @@ -31,26 +38,3 @@ const sharedOptions = defineConfig( {
}
}
} );

export default defineConfig( [
{
output: {
dir: 'dist',
format: 'esm',
sourcemap: true,
entryFileNames: '[name].mjs',
chunkFileNames: '[name].mjs',
},
...sharedOptions
},
{
output: {
dir: 'dist',
format: 'cjs',
sourcemap: true,
entryFileNames: '[name].cjs',
chunkFileNames: '[name].cjs',
},
...sharedOptions
}
] );
17 changes: 17 additions & 0 deletions packages/sonda/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,26 @@ export interface ReportOutput extends Sizes {
export interface ReportOutputInput extends Sizes {}

export interface JsonReport {
/**
* List of all source input files.
*/
inputs: Record<string, ReportInput>;

/**
* List of all generated output files.
*/
outputs: Record<string, ReportOutput>;

/**
* List of all detected external dependencies and their paths. If
* a dependency has more than one path, it's likely duplicated and
* bundled in multiple copies.
*/
dependencies: Record<string, Array<string>>;

/**
* List of issues detected in the outputs.
*/
issues: {
duplicateDependencies?: Array<string>
}
Expand Down

0 comments on commit 34f9389

Please sign in to comment.