Skip to content

Commit e42ae45

Browse files
committed
fix: node exclusive exports
1 parent 206bd5f commit e42ae45

File tree

4 files changed

+42
-12
lines changed

4 files changed

+42
-12
lines changed

packages/attachments/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@
3030
"default": "./dist/index.cjs",
3131
"types": "./dist/index.d.cts"
3232
}
33+
},
34+
"./node": {
35+
"node": {
36+
"import": {
37+
"default": "./lib/node.js",
38+
"types": "./lib/node.d.ts"
39+
},
40+
"require": {
41+
"default": "./dist/node.cjs",
42+
"types": "./dist/node.d.cts"
43+
}
44+
},
45+
"default": null
3346
}
3447
},
3548
"files": [

packages/attachments/rollup.config.js

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ export default (commandLineArgs) => {
1010
// Clears rollup CLI warning https://github.com/rollup/rollup/issues/2694
1111
delete commandLineArgs.sourceMap;
1212

13+
const plugins = [
14+
resolve(),
15+
commonjs(),
16+
typescript({
17+
tsconfig: './tsconfig.json',
18+
outDir: 'dist',
19+
sourceMap
20+
})
21+
];
22+
1323
return [
1424
{
1525
input: 'src/index.ts',
@@ -19,22 +29,29 @@ export default (commandLineArgs) => {
1929
sourcemap: sourceMap,
2030
exports: 'named'
2131
},
22-
plugins: [
23-
resolve(),
24-
commonjs(),
25-
typescript({
26-
tsconfig: './tsconfig.json',
27-
outDir: 'dist',
28-
sourceMap
29-
})
30-
],
32+
plugins,
3133
external: ['@powersync/common', 'expo-file-system', 'base64-arraybuffer']
3234
},
33-
// This is required to avoid https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseESM.md
35+
{
36+
input: 'src/node.ts',
37+
output: {
38+
format: 'cjs',
39+
file: 'dist/node.cjs',
40+
sourcemap: sourceMap,
41+
exports: 'named'
42+
},
43+
plugins,
44+
external: ['@powersync/common', 'fs', 'path']
45+
},
3446
{
3547
input: './lib/index.d.ts',
3648
output: [{ file: 'dist/index.d.cts', format: 'cjs' }],
3749
plugins: [dts()]
50+
},
51+
{
52+
input: './lib/node.d.ts',
53+
output: [{ file: 'dist/node.d.cts', format: 'cjs' }],
54+
plugins: [dts()]
3855
}
3956
];
40-
};
57+
};

packages/attachments/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export * from './Schema.js';
22
export * from './LocalStorageAdapter.js';
3-
export * from './storageAdapters/NodeFileSystemAdapter.js';
43
export * from './storageAdapters/IndexDBFileSystemAdapter.js';
54
export * from './storageAdapters/ExpoFileSystemAdapter.js';
65
export * from './RemoteStorageAdapter.js';

packages/attachments/src/node.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './storageAdapters/NodeFileSystemAdapter.js';

0 commit comments

Comments
 (0)