Skip to content

Commit 9b047ca

Browse files
committed
Use rollup typescript plugin
1 parent eb3a81d commit 9b047ca

File tree

3 files changed

+47
-11
lines changed

3 files changed

+47
-11
lines changed

packages/common/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"author": "JOURNEYAPPS",
3636
"license": "Apache-2.0",
3737
"files": [
38-
"lib",
3938
"dist",
4039
"src"
4140
],
@@ -48,15 +47,14 @@
4847
},
4948
"homepage": "https://docs.powersync.com",
5049
"scripts": {
51-
"build": "tsc -b && rollup -c rollup.config.mjs",
52-
"build:prod": "tsc -b && rollup -c rollup.config.mjs",
50+
"build": "rollup -c rollup.config.mjs",
51+
"build:prod": "rollup -c rollup.config.mjs",
5352
"clean": "rm -rf lib dist tsconfig.tsbuildinfo",
5453
"test": "vitest",
5554
"test:exports": "attw --pack ."
5655
},
5756
"dependencies": {
5857
"async-mutex": "^0.5.0",
59-
"bson": "^6.10.4",
6058
"buffer": "^6.0.3",
6159
"event-iterator": "^2.0.0"
6260
},
@@ -65,12 +63,14 @@
6563
"@rollup/plugin-inject": "^5.0.5",
6664
"@rollup/plugin-json": "^6.1.0",
6765
"@rollup/plugin-node-resolve": "^16.0.3",
66+
"@rollup/plugin-typescript": "^12.3.0",
6867
"@types/node": "^20.5.9",
6968
"@types/uuid": "^9.0.1",
7069
"rollup": "^4.52.5",
7170
"cross-fetch": "^4.1.0",
7271
"js-logger": "^1.6.1",
7372
"rsocket-core": "1.0.0-alpha.3",
74-
"rsocket-websocket-client": "1.0.0-alpha.3"
73+
"rsocket-websocket-client": "1.0.0-alpha.3",
74+
"bson": "^6.10.4"
7575
}
7676
}

packages/common/rollup.config.mjs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import inject from '@rollup/plugin-inject';
55
import json from '@rollup/plugin-json';
66
import nodeResolve from '@rollup/plugin-node-resolve';
77
import { dts } from 'rollup-plugin-dts';
8+
import typescript from '@rollup/plugin-typescript';
89

910
function defineBuild(isNode) {
1011
const suffix = isNode ? '.node' : '';
1112

1213
return {
13-
input: 'lib/index.js',
14+
input: 'src/index.ts',
1415
output: [
1516
{
1617
file: `dist/bundle${suffix}.mjs`,
@@ -25,8 +26,13 @@ function defineBuild(isNode) {
2526
],
2627
plugins: [
2728
[
29+
typescript({
30+
tsconfig: './tsconfig.json',
31+
outDir: 'dist',
32+
sourceMap: true
33+
}),
2834
json(),
29-
nodeResolve({ preferBuiltins: false, browser: true }),
35+
nodeResolve({ preferBuiltins: false, browser: !isNode }),
3036
commonjs({}),
3137
inject({
3238
Buffer: isNode ? ['node:buffer', 'Buffer'] : ['buffer/', 'Buffer']
@@ -45,9 +51,14 @@ export default () => {
4551
defineBuild(false),
4652
defineBuild(true),
4753
{
48-
input: './lib/index.d.ts',
54+
input: 'src/index.ts',
4955
output: [{ file: 'dist/index.d.cts', format: 'cjs' }],
5056
plugins: [dts()]
57+
},
58+
{
59+
input: 'src/index.ts',
60+
output: [{ file: 'dist/index.d.ts', format: 'es' }],
61+
plugins: [dts()]
5162
}
5263
];
5364
};

pnpm-lock.yaml

Lines changed: 28 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)