1- import babel from '@rollup/plugin-babel' ;
2- import resolve from '@rollup/plugin-node-resolve' ;
3- import commonjs from '@rollup/plugin-commonjs' ;
4- import alias from '@rollup/plugin-alias' ;
5- import peerDepsExternal from 'rollup-plugin-peer-deps-external' ;
1+ import babel from "@rollup/plugin-babel" ;
2+ import resolve from "@rollup/plugin-node-resolve" ;
3+ import commonjs from "@rollup/plugin-commonjs" ;
4+ import alias from "@rollup/plugin-alias" ;
5+ import tsconfigPaths from "rollup-plugin-tsconfig-paths" ;
6+ import peerDepsExternal from "rollup-plugin-peer-deps-external" ;
7+ import json from '@rollup/plugin-json' ;
68
7- const bundle = ( name , globalName , { globals = { } , ...baseConfig } , umdConfig ) => {
9+ const bundle = (
10+ name ,
11+ globalName ,
12+ { globals = { } , ...baseConfig } ,
13+ umdConfig
14+ ) => {
815 const baseUmdConfig = {
916 ...( umdConfig || baseConfig ) ,
1017 plugins : [
1118 commonjs ( {
12- extensions : [ ' .js' ] ,
19+ extensions : [ " .js" ] ,
1320 } ) ,
1421 resolve ( {
15- extensions : [ ' .ts' , ' .js' , ' .json' ] ,
16- mainFields : [ ' browser' , ' module' , ' main' ] ,
22+ extensions : [ " .ts" , " .js" , " .json" ] ,
23+ mainFields : [ " browser" , " module" , " main" ] ,
1724 } ) ,
1825 babel ( {
19- extensions : [ ' .js' , ' .jsx' , ' .ts' , ' .tsx' ] ,
20- exclude : [ ' node_modules/**' , / \/ c o r e - j s \/ / ] ,
21- babelHelpers : ' runtime' ,
26+ extensions : [ " .js" , " .jsx" , " .ts" , " .tsx" ] ,
27+ exclude : [ " node_modules/**" , / \/ c o r e - j s \/ / ] ,
28+ babelHelpers : " runtime" ,
2229 presets : [
23- ' @babel/preset-react' ,
24- ' @babel/preset-typescript' ,
30+ " @babel/preset-react" ,
31+ " @babel/preset-typescript" ,
2532 [
26- ' @babel/preset-env' ,
33+ " @babel/preset-env" ,
2734 {
2835 shippedProposals : true ,
29- useBuiltIns : ' usage' ,
36+ useBuiltIns : " usage" ,
3037 corejs : 3 ,
3138 } ,
3239 ] ,
3340 ] ,
3441 plugins : [
3542 [
36- ' @babel/plugin-transform-runtime' ,
43+ " @babel/plugin-transform-runtime" ,
3744 {
3845 corejs : false ,
3946 helpers : true ,
@@ -45,7 +52,7 @@ const bundle = (name, globalName, { globals = {}, ...baseConfig }, umdConfig) =>
4552 } ) ,
4653 alias ( {
4754 entries : {
48- ' @cubejs-client/core' : ' ../cubejs-client-core/dist /index.js' ,
55+ " @cubejs-client/core" : " ../cubejs-client-core/src /index.ts" ,
4956 } ,
5057 } ) ,
5158 ] ,
@@ -69,26 +76,34 @@ const bundle = (name, globalName, { globals = {}, ...baseConfig }, umdConfig) =>
6976 {
7077 ...baseConfig ,
7178 plugins : [
79+ json ( ) ,
80+ tsconfigPaths ( ) ,
81+ resolve ( {
82+ extensions : [ ".mjs" , ".js" , ".jsx" , ".ts" , ".tsx" , ".json" ] ,
83+ browser : false ,
84+ preferBuiltins : true ,
85+ } ) ,
86+ commonjs ( ) ,
7287 peerDepsExternal ( ) ,
7388 babel ( {
74- extensions : [ ' .js' , ' .jsx' , ' .ts' , ' .tsx' ] ,
75- exclude : ' node_modules/**' ,
76- babelHelpers : ' runtime' ,
89+ extensions : [ " .js" , " .jsx" , " .ts" , " .tsx" ] ,
90+ exclude : " node_modules/**" ,
91+ babelHelpers : " runtime" ,
7792 presets : [
78- ' @babel/preset-react' ,
79- ' @babel/preset-typescript' ,
93+ " @babel/preset-react" ,
94+ " @babel/preset-typescript" ,
8095 [
81- ' @babel/preset-env' ,
96+ " @babel/preset-env" ,
8297 {
8398 shippedProposals : true ,
84- useBuiltIns : ' usage' ,
99+ useBuiltIns : " usage" ,
85100 corejs : 3 ,
86101 } ,
87102 ] ,
88103 ] ,
89104 plugins : [
90105 [
91- ' @babel/plugin-transform-runtime' ,
106+ " @babel/plugin-transform-runtime" ,
92107 {
93108 corejs : false ,
94109 helpers : true ,
@@ -102,15 +117,22 @@ const bundle = (name, globalName, { globals = {}, ...baseConfig }, umdConfig) =>
102117 output : [
103118 {
104119 file : `packages/${ name } /dist/${ name } .js` ,
105- format : ' cjs' ,
120+ format : " cjs" ,
106121 sourcemap : true ,
107- }
122+ } ,
108123 ] ,
109124 } ,
110125 // ES module (for bundlers) build.
111126 {
112127 ...baseConfig ,
113128 plugins : [
129+ tsconfigPaths ( ) ,
130+ resolve ( {
131+ extensions : [ ".mjs" , ".js" , ".jsx" , ".ts" , ".tsx" , ".json" ] ,
132+ browser : true ,
133+ preferBuiltins : false ,
134+ } ) ,
135+ commonjs ( ) ,
114136 peerDepsExternal ( ) ,
115137 babel ( {
116138 extensions : [ '.js' , '.jsx' , '.ts' , '.tsx' ] ,
@@ -134,41 +156,41 @@ const bundle = (name, globalName, { globals = {}, ...baseConfig }, umdConfig) =>
134156} ;
135157
136158export default bundle (
137- ' cubejs-client-core' ,
138- ' cubejs' ,
159+ " cubejs-client-core" ,
160+ " cubejs" ,
139161 {
140- input : ' packages/cubejs-client-core/dist/ src/index.js' ,
162+ input : " packages/cubejs-client-core/src/index.ts" ,
141163 } ,
142164 {
143- input : 'packages/cubejs-client-core/dist/ src/index.umd.js ' ,
165+ input : 'packages/cubejs-client-core/src/index.umd.ts ' ,
144166 }
145167)
146- . concat (
147- bundle ( 'cubejs-client-ws-transport' , 'CubejsWebSocketTransport' , {
148- input : 'packages/cubejs-client-ws-transport/src/index.ts' ,
149- } )
150- )
151- . concat (
152- bundle ( 'cubejs-client-react' , 'cubejsReact' , {
153- input : 'packages/cubejs-client-react/src/index.js' ,
154- external : [ 'react' , 'prop-types' ] ,
155- } )
156- )
157- . concat (
158- bundle ( 'cubejs-client-vue' , 'cubejsVue' , {
159- input : 'packages/cubejs-client-vue/src/index.js' ,
160- external : [ 'vue' ] ,
161- globals : {
162- vue : 'Vue' ,
163- } ,
164- } )
165- )
166- . concat (
167- bundle ( 'cubejs-client-vue3' , 'cubejsVue3' , {
168- input : 'packages/cubejs-client-vue3/src/index.js' ,
169- external : [ 'vue' ] ,
170- globals : {
171- vue : 'Vue' ,
172- } ,
173- } )
174- ) ;
168+ . concat (
169+ bundle ( 'cubejs-client-ws-transport' , 'CubejsWebSocketTransport' , {
170+ input : 'packages/cubejs-client-ws-transport/src/index.ts' ,
171+ } )
172+ )
173+ . concat (
174+ bundle ( 'cubejs-client-react' , 'cubejsReact' , {
175+ input : 'packages/cubejs-client-react/src/index.js' ,
176+ external : [ 'react' , 'prop-types' ] ,
177+ } )
178+ )
179+ . concat (
180+ bundle ( 'cubejs-client-vue' , 'cubejsVue' , {
181+ input : 'packages/cubejs-client-vue/src/index.js' ,
182+ external : [ 'vue' ] ,
183+ globals : {
184+ vue : 'Vue' ,
185+ } ,
186+ } )
187+ )
188+ . concat (
189+ bundle ( 'cubejs-client-vue3' , 'cubejsVue3' , {
190+ input : 'packages/cubejs-client-vue3/src/index.js' ,
191+ external : [ 'vue' ] ,
192+ globals : {
193+ vue : 'Vue' ,
194+ } ,
195+ } )
196+ ) ;
0 commit comments