File tree Expand file tree Collapse file tree 6 files changed +58
-14
lines changed
Expand file tree Collapse file tree 6 files changed +58
-14
lines changed Original file line number Diff line number Diff line change 11node_modules
22lib
33dist
4- tsconfig.tsbuildinfo
4+ cjs
5+ * .tsbuildinfo
56.vscode
67.DS_STORE
78.idea
Original file line number Diff line number Diff line change 66 "access" : " public"
77 },
88 "description" : " API definitions for JourneyApps PowerSync" ,
9- "main" : " dist/index.js" ,
10- "types" : " lib/index.d.ts" ,
119 "type" : " module" ,
10+ "main" : " dist/bundle.cjs" ,
11+ "module" : " dist/bundle.mjs" ,
12+ "types" : " lib/index.d.ts" ,
13+ "exports" : {
14+ "." : {
15+ "import" : " ./dist/bundle.mjs" ,
16+ "require" : " ./dist/bundle.cjs" ,
17+ "default" : " ./dist/bundle.mjs" ,
18+ "types" : " ./lib/index.d.ts"
19+ }
20+ },
1221 "author" : " JOURNEYAPPS" ,
1322 "license" : " Apache-2.0" ,
1423 "files" : [
2433 },
2534 "homepage" : " https://docs.powersync.com" ,
2635 "scripts" : {
27- "build" : " tsc -b && rollup -c rollup.config.mjs" ,
28- "clean" : " rm -rf lib tsconfig.tsbuildinfo dist " ,
36+ "build" : " tsc -b && rollup -c rollup.config.mjs && rollup -c rollup-cjs.config.mjs " ,
37+ "clean" : " rm -rf lib dist tsconfig.tsbuildinfo" ,
2938 "test" : " vitest"
3039 },
3140 "dependencies" : {
Original file line number Diff line number Diff line change 1+ import commonjs from '@rollup/plugin-commonjs' ;
2+ import inject from '@rollup/plugin-inject' ;
3+ import json from '@rollup/plugin-json' ;
4+ import nodeResolve from '@rollup/plugin-node-resolve' ;
5+ import terser from '@rollup/plugin-terser' ;
6+
7+ export default ( commandLineArgs ) => {
8+ const sourcemap = ( commandLineArgs . sourceMap || 'true' ) == 'true' ;
9+
10+ // Clears rollup CLI warning https://github.com/rollup/rollup/issues/2694
11+ delete commandLineArgs . sourceMap ;
12+
13+ return {
14+ // esm input is better, even for cjs output
15+ input : 'lib/index.js' ,
16+ output : {
17+ file : 'dist/bundle.cjs' ,
18+ format : 'cjs' ,
19+ sourcemap : sourcemap
20+ } ,
21+ plugins : [
22+ json ( ) ,
23+ nodeResolve ( { preferBuiltins : false , browser : true } ) ,
24+ commonjs ( { } ) ,
25+ inject ( {
26+ Buffer : [ 'buffer' , 'Buffer' ] ,
27+ ReadableStream : [ 'web-streams-polyfill/ponyfill' , 'ReadableStream' ] ,
28+ // Used by can-ndjson-stream
29+ TextDecoder : [ 'text-encoding' , 'TextDecoder' ]
30+ } ) ,
31+ terser ( )
32+ ] ,
33+ // This makes life easier
34+ external : [
35+ // This has dynamic logic - makes bundling hard
36+ 'cross-fetch' ,
37+ // TODO: make the useDefaults logic better. Currently need access to this package directly
38+ 'js-logger'
39+ ]
40+ } ;
41+ } ;
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export default (commandLineArgs) => {
1313 return {
1414 input : 'lib/index.js' ,
1515 output : {
16- file : 'dist/index.js ' ,
16+ file : 'dist/bundle.mjs ' ,
1717 format : 'esm' ,
1818 sourcemap : sourcemap
1919 } ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 55 "jsx" : " react" ,
66 "types" : [" node" ],
77 "rootDir" : " src" ,
8- "outDir" : " ./lib/esm " ,
8+ "outDir" : " ./lib" ,
99 "lib" : [" esnext" ],
1010 "declaration" : true ,
1111 "module" : " node16" ,
You can’t perform that action at this time.
0 commit comments