UNPKG

10.7 kBJavaScriptView Raw
1//import typescript from 'rollup-plugin-typescript2';
2//import postcss from 'rollup-plugin-postcss-modules';
3//import autoprefixer from 'autoprefixer'
4//import buble from 'rollup-plugin-buble';
5import { terser } from "rollup-plugin-terser";
6import resolve from '@rollup/plugin-node-resolve';
7import cjs from '@rollup/plugin-commonjs';
8//import json from '@rollup/plugin-json';
9//import alias from '@rollup/plugin-alias';
10//import babel from 'rollup-plugin-babel';
11//import postcss from 'rollup-plugin-postcss';
12import copy from 'rollup-plugin-copy-watch';
13//import copyAssets from "rollup-plugin-copy-assets";
14import nodePolyfills from 'rollup-plugin-node-polyfills';
15import globals from 'rollup-plugin-node-globals';
16
17export default [
18 { input: '@appfibre/plugins/dist/core',
19 output: [ { file: 'plugins/dev/core.js', format: 'iife', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types'} }
20 , { file: 'plugins/dev/core.cjs.js', format: 'cjs', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types'} }
21 , { file: 'plugins/dev/core.umd.js', format: 'umd', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types'} }
22 , { file: 'plugins/dev/core.es.js', format: 'es', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types'} }
23 ],
24 plugins: [ resolve({mainFields: ['main']}),
25 cjs(),
26 copy({ watch: 'node_modules/@appfibre/plugins/unit', targets: [{ src: 'node_modules/@appfibre/plugins/unit/*.spec.json', dest: 'plugins/tests' }]})
27 ]
28 },
29 { input: '@appfibre/plugins/dist/core',
30 output: [ { file: 'plugins/core.js', format: 'iife', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types'} }
31 , { file: 'plugins/core.cjs.js', format: 'cjs', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types'} }
32 , { file: 'plugins/core.umd.js', format: 'umd', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types'} }
33 , { file: 'plugins/core.es.js', format: 'es', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types'} }
34 ],
35 plugins: [ resolve({mainFields: ['main']}),
36 cjs(),
37 terser()
38 ]
39 },
40
41 { input: '@appfibre/plugins/dist/test',
42 output: [ { file: 'plugins/dev/test.js', format: 'iife', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types', 'util':'util'} }
43 , { file: 'plugins/dev/test.cjs.js', format: 'cjs', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types', 'util':'util'} }
44 , { file: 'plugins/dev/test.umd.js', format: 'umd', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types', 'util':'util'} }
45 , { file: 'plugins/dev/test.es.js', format: 'es', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types', 'util':'util'} }
46 ],
47 plugins: [ resolve({mainFields: ['main']}),
48 cjs()
49 ],
50 external: ['util']
51 },
52 { input: '@appfibre/plugins/dist/test',
53 output: [ { file: 'plugins/test.js', format: 'iife', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types', 'util':'util'} }
54 , { file: 'plugins/test.cjs.js', format: 'cjs', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types', 'util':'util'} }
55 , { file: 'plugins/test.umd.js', format: 'umd', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types', 'util':'util'} }
56 , { file: 'plugins/test.es.js', format: 'es', sourcemap: true, name: 'plugins', globals: { "@appfibre/types": 'types', 'util':'util'} }
57 ],
58 plugins: [ resolve({mainFields: ['main']}),
59 cjs(),
60 terser()
61 ],
62 external: ['util']
63 },
64
65
66 { input: '@appfibre/plugins/dist/server',
67 output: [ { file: 'plugins/dev/server.cjs.js', format: 'cjs', sourcemap: true, name: 'server', globals: { "@appfibre/types": 'types'} }
68 ],
69 plugins: [ resolve({mainFields: ['main']}),
70 cjs()
71 ]
72 },
73 { input: '@appfibre/plugins/dist/server',
74 output: [ { file: 'plugins/server.cjs.js', format: 'cjs', sourcemap: true, name: 'server', globals: { "@appfibre/types": 'types'} }
75 ],
76 plugins: [ resolve({mainFields: ['main']}),
77 cjs(),
78 terser()
79 ]
80 },
81
82
83 { input: '@appfibre/browser/dist/index',
84 output: [ { file: 'index.js', format: 'cjs', sourcemap: true, name: 'index', globals: { "@appfibre/types": 'types'} }
85 ],
86 plugins: [ nodePolyfills(), resolve({mainFields: ['main']}), cjs(), terser()]
87 },
88 { input: '@appfibre/browser/dist/main',
89 output: [ { file: 'main.js', format: 'iife', sourcemap: true, name: 'main', globals: {global: 'globalThis'} }
90 ],
91 plugins: [ nodePolyfills(), resolve({mainFields: ['main'], browser: true}), cjs(), globals(), terser() ]
92 }
93]
94
95
96/*
97const pkg = require('./package.json');
98const external = Object.keys(pkg.dependencies);
99
100export default
101 [
102 { input: 'lib/system.js',
103 output: [ { file: 'webapp-systemjs.js', format: 'iife', sourcemap: true, name: 'webapp', globals: { "@appfibre/types": 'types', "@appfibre/core": 'core','@appfibre/webapp': 'webapp', 'systemjs-plugin-babel': 'babel', 'systemjs-babel-build': 'systemjsBabelBuild'} }
104 , { file: 'cjs/webapp-systemjs.js', format: 'cjs', sourcemap: true, name: 'webapp', globals: { "@appfibre/types": 'types', "@appfibre/core": 'core','@appfibre/webapp': 'webapp', 'systemjs-plugin-babel': 'babel', 'systemjs-babel-build': 'systemjsBabelBuild'} }
105 , { file: 'umd/webapp-systemjs.js', format: 'umd', sourcemap: true, name: 'webapp', globals: { "@appfibre/types": 'types', "@appfibre/core": 'core','@appfibre/webapp': 'webapp', 'systemjs-plugin-babel': 'babel', 'systemjs-babel-build': 'systemjsBabelBuild'} }
106 , { file: 'es/webapp-systemjs.js', format: 'es', sourcemap: true, name: 'webapp', globals: { "@appfibre/types": 'types', "@appfibre/core": 'core','@appfibre/webapp': 'webapp', 'systemjs-plugin-babel': 'babel', 'systemjs-babel-build': 'systemjsBabelBuild'} }
107 ],
108 plugins: [ resolve({mainFields: ['main']}),
109 cjs(),
110 babel({
111 babelrc: false,
112 presets: [
113 [ '@babel/env', { modules: false, targets: { ie: '9', } } ]
114 ]})
115 ]
116 },
117 { input: 'lib/polyfill.js',
118 output: [ { file: 'webapp-systemjs-polyfill.js', format: 'iife', sourcemap: true, name: 'appfibre_polyfill'}
119 , { file: 'cjs/webapp-systemjs-polyfill.js', format: 'cjs', sourcemap: true, name: 'appfibre_polyfill'}
120 , { file: 'umd/webapp-systemjs-polyfill.js', format: 'umd', sourcemap: true, name: 'appfibre_polyfill'}
121 , { file: 'es/webapp-systemjs-polyfill.js', format: 'es', sourcemap: true, name: 'appfibre_polyfill'}
122 ],
123 plugins: [ resolve()
124 , cjs()
125 , babel( {
126 babelrc: false,
127 presets: [ [ '@babel/env', { modules: false, targets: { android: '30', chrome: '35', ie: '9', safari: '5' }, useBuiltIns: 'entry', corejs: '3' } ] ],
128 })
129 ],
130 },
131 {
132 input: 'lib/rollup.js',
133 output: [ { file: 'rollup-plugin-jst.js', format: 'iife', sourcemap: true, name: 'appfibre_rollup', globals: { "@appfibre/core": 'core' } }
134 , { file: 'cjs/rollup-plugin-jst.js', format: 'cjs', sourcemap: true, name: 'appfibre_rollup', globals: { "@appfibre/core": 'core' } }
135 , { file: 'umd/rollup-plugin-jst.js', format: 'umd', sourcemap: true, name: 'appfibre_rollup', globals: { "@appfibre/core": 'core' } }
136 , { file: 'es/rollup-plugin-jst.js', format: 'es', sourcemap: true, name: 'appfibre_rollup', globals: { "@appfibre/core": 'core' } }
137 ],
138 plugins: [ /cjs()
139 ],
140 external
141
142 },
143 { input: '@appfibre/webcomponents',
144 plugins: [ //postcss({extract: true, plugins: [autoprefixer()], writeDefinitions: true })
145 resolve({mainFields: ['main'], browser: true})
146 , cjs()
147 , postcss({extract: false, plugins: [], extensions: ['.css'] })
148 //, buble({namedFunctionExpressions: false})
149 ],
150 output: [ { file: 'webcomponents-appfibre.js', format: 'iife', sourcemap: true, name: "appfibre_webcomponents", globals: { '@appfibre/types': 'appfibre' } }
151 , { file: 'umd/webcomponents-appfibre.js', format: 'umd', sourcemap: true, name: "appfibre_webcomponents", globals: { '@appfibre/types': 'appfibre' } }
152 , { file: 'cjs/webcomponents-appfibre.js', format: 'cjs', sourcemap: true, name: "appfibre_webcomponents", globals: { '@appfibre/types': 'appfibre' } }
153 , { file: 'es/webcomponents-appfibre.js', format: 'es', sourcemap: true, name: "appfibre_webcomponents", globals: { '@appfibre/types': 'appfibre' } }
154 ]
155 //, external: ['@appfibre/webapp', '@appfibre/types']
156 },
157 {
158 input: '@appfibre/webcomponents/dist/codemirror',
159 plugins: [ //postcss({extract: true, plugins: [autoprefixer()], writeDefinitions: true })
160 resolve({mainFields: ['main'], browser: true})
161 , cjs()
162 , postcss({extract: false, plugins: [], extensions: ['.css'] })
163 //, buble({namedFunctionExpressions: false})
164 ],
165 output: [ { file: 'webcomponents-codemirror.js', format: 'iife', sourcemap: true, name: "codemirror" }
166 , { file: 'umd/webcomponents-codemirror.js', format: 'umd', sourcemap: true, name: "codemirror" }
167 , { file: 'cjs/webcomponents-codemirror.js', format: 'cjs', sourcemap: true, name: "codemirror" }
168 , { file: 'es/webcomponents-codemirror.js', format: 'es', sourcemap: true, name: "codemirror" }
169 ]
170 }
171
172]
173
174*/
\No newline at end of file