-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- remove deprecated options - less aggressive minification, to avoid warning messages on userland during build stage. - better tree-shaking. - upgraded dependencies - pass noCheck option to .d.ts files generation step (faster) - remove outdated comments Signed-off-by: Andres Correa Casablanca <[email protected]>
- Loading branch information
Showing
17 changed files
with
226 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,58 @@ | ||
import { dirname } from 'node:path' | ||
import { dirname, resolve } from 'node:path' | ||
import { fileURLToPath } from 'node:url' | ||
|
||
import { getTsconfig } from 'get-tsconfig' | ||
import { defineConfig } from 'rollup' | ||
import dts from 'rollup-plugin-dts' | ||
import { dts } from 'rollup-plugin-dts' | ||
import esbuild from 'rollup-plugin-esbuild' | ||
|
||
const projectDir = dirname(fileURLToPath(import.meta.url)) | ||
const tsconfig = getTsconfig(projectDir) | ||
const target = tsconfig?.config.compilerOptions?.target ?? 'es2020' | ||
const target = tsconfig?.config.compilerOptions?.target ?? 'es2022' | ||
|
||
const outputBaseConfig = { | ||
const baseConfig = { | ||
plugins: [ | ||
esbuild({ | ||
target: ['node18', 'node20', 'node22', target], | ||
loaders: { '.mts': 'ts' }, | ||
minify: true, | ||
keepNames: true, | ||
minifyIdentifiers: true, | ||
minifySyntax: true, | ||
minifyWhitespace: false, | ||
treeShaking: true, | ||
}), | ||
], | ||
external: ['node:crypto', 'node:fs/promises', 'node:path', 'node:url'], | ||
} | ||
|
||
const outputConfig = /** @type {import('rollup').OutputOptions} */ ({ | ||
format: 'esm', | ||
indent: '\t', // With any luck, some day esbuild will support this option | ||
sourcemap: true, | ||
}) | ||
|
||
export default defineConfig([ | ||
{ | ||
input: 'src/core.mts', | ||
output: [{ format: 'esm', file: 'dist/core.mjs', sourcemap: true }], | ||
...outputBaseConfig, | ||
output: [{ ...outputConfig, file: 'dist/core.mjs' }], | ||
...baseConfig, | ||
}, | ||
{ | ||
input: 'src/main.mts', | ||
output: [{ format: 'esm', file: 'dist/main.mjs', sourcemap: true }], | ||
output: [{ ...outputConfig, file: 'dist/main.mjs' }], | ||
external: ['#as/core'], | ||
...outputBaseConfig, | ||
...baseConfig, | ||
}, | ||
{ | ||
input: 'src/state.mts', | ||
output: [{ format: 'esm', file: 'dist/state.mjs', sourcemap: true }], | ||
...outputBaseConfig, | ||
output: [{ ...outputConfig, file: 'dist/state.mjs' }], | ||
...baseConfig, | ||
}, | ||
{ | ||
input: 'src/main.mts', | ||
output: [{ format: 'esm', file: 'dist/main.d.mts' }], | ||
external: ['#as/core'], | ||
plugins: [dts()], | ||
// TODO: When possible, pass `noCheck: true` instead of loading an entire tsconfig file | ||
plugins: [dts({ tsconfig: resolve(projectDir, 'tsconfig.dts.json') })], | ||
}, | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"noEmit": false, | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"noCheck": true | ||
} | ||
} |
Oops, something went wrong.