Translated using Weblate (Slovenian)
[phpmyadmin.git] / webpack.config.js
blobeae7944aad3ee37cf31028d2830e72fa57b97945
1 const path = require('path');
2 const webpack = require('webpack');
3 const autoprefixer = require('autoprefixer');
4 const CopyPlugin = require('copy-webpack-plugin');
5 const WebpackConcatPlugin = require('webpack-concat-files-plugin');
6 const MiniCssExtractPlugin = require('mini-css-extract-plugin');
7 const WebpackRTLPlugin = require('webpack-rtl-plugin');
9 module.exports = [
10     {
11         mode: 'none',
12         devtool: 'source-map',
13         entry: {
14             'ajax': './js/src/ajax.js',
15             'chart': './js/src/chart.js',
16             'codemirror/addon/lint/sql-lint': './js/src/codemirror/addon/lint/sql-lint.js',
17             'common': './js/src/common.js',
18             'config': './js/src/config.js',
19             'console': './js/src/console.js',
20             'cross_framing_protection': './js/src/cross_framing_protection.js',
21             'datetimepicker': './js/src/datetimepicker.js',
22             'database/central_columns': './js/src/database/central_columns.js',
23             'database/events': './js/src/database/events.js',
24             'database/multi_table_query': './js/src/database/multi_table_query.js',
25             'database/operations': './js/src/database/operations.js',
26             'database/qbe': './js/src/database/qbe.js',
27             'database/query_generator': './js/src/database/query_generator.js',
28             'database/routines': './js/src/database/routines.js',
29             'database/search': './js/src/database/search.js',
30             'database/structure': './js/src/database/structure.js',
31             'database/tracking': './js/src/database/tracking.js',
32             'database/triggers': './js/src/database/triggers.js',
33             'designer/database': './js/src/designer/database.js',
34             'designer/history': './js/src/designer/history.js',
35             'designer/init': './js/src/designer/init.js',
36             'designer/move': './js/src/designer/move.js',
37             'designer/objects': './js/src/designer/objects.js',
38             'designer/page': './js/src/designer/page.js',
39             'doclinks': './js/src/doclinks.js',
40             'drag_drop_import': './js/src/drag_drop_import.js',
41             'error_report': './js/src/error_report.js',
42             'export': './js/src/export.js',
43             'export_output': './js/src/export_output.js',
44             'functions': './js/src/functions.js',
45             'gis_data_editor': './js/src/gis_data_editor.js',
46             'home': './js/src/home.js',
47             'import': './js/src/import.js',
48             'indexes': './js/src/indexes.js',
49             'jqplot/plugins/jqplot.byteFormatter': './js/src/jqplot/plugins/jqplot.byteFormatter.js',
50             'jquery.sortable-table': './js/src/jquery.sortable-table.js',
51             'keyhandler': './js/src/keyhandler.js',
52             'makegrid': './js/src/makegrid.js',
53             'menu_resizer': './js/src/menu_resizer.js',
54             'multi_column_sort': './js/src/multi_column_sort.js',
55             'name-conflict-fixes': './js/src/name-conflict-fixes.js',
56             'navigation': './js/src/navigation.js',
57             'normalization': './js/src/normalization.js',
58             'page_settings': './js/src/page_settings.js',
59             'replication': './js/src/replication.js',
60             'server/databases': './js/src/server/databases.js',
61             'server/plugins': './js/src/server/plugins.js',
62             'server/privileges': './js/src/server/privileges.js',
63             'server/status/monitor': './js/src/server/status/monitor.js',
64             'server/status/processes': './js/src/server/status/processes.js',
65             'server/status/queries': './js/src/server/status/queries.js',
66             'server/status/sorter': './js/src/server/status/sorter.js',
67             'server/status/variables': './js/src/server/status/variables.js',
68             'server/user_groups': './js/src/server/user_groups.js',
69             'server/variables': './js/src/server/variables.js',
70             'setup/ajax': './js/src/setup/ajax.js',
71             'setup/scripts': './js/src/setup/scripts.js',
72             'shortcuts_handler': './js/src/shortcuts_handler.js',
73             'sql': './js/src/sql.js',
74             'table/change': './js/src/table/change.js',
75             'table/chart': './js/src/table/chart.js',
76             'table/find_replace': './js/src/table/find_replace.js',
77             'table/gis_visualization': './js/src/table/gis_visualization.js',
78             'table/operations': './js/src/table/operations.js',
79             'table/relation': './js/src/table/relation.js',
80             'table/select': './js/src/table/select.js',
81             'table/structure': './js/src/table/structure.js',
82             'table/tracking': './js/src/table/tracking.js',
83             'table/zoom_plot_jqplot': './js/src/table/zoom_plot_jqplot.js',
84             'transformations/image_upload': './js/src/transformations/image_upload.js',
85             'transformations/json': './js/src/transformations/json.js',
86             'transformations/json_editor': './js/src/transformations/json_editor.js',
87             'transformations/sql_editor': './js/src/transformations/sql_editor.js',
88             'transformations/xml': './js/src/transformations/xml.js',
89             'transformations/xml_editor': './js/src/transformations/xml_editor.js',
90             'u2f': './js/src/u2f.js',
91             'validator-messages': './js/src/validator-messages.js',
92         },
93         output: {
94             filename: '[name].js',
95             path: path.resolve(__dirname, 'js/dist'),
96             iife: false,
97         },
98         module: {
99             rules: [
100                 {
101                     test: /\.js$/,
102                     exclude: /node_modules/,
103                     use: {
104                         loader: 'babel-loader',
105                         options: {
106                             presets:  ['@babel/preset-env'],
107                         },
108                     },
109                 },
110             ],
111         },
112         plugins: [
113             new CopyPlugin({
114                 patterns: [
115                     { from: path.resolve(__dirname, 'node_modules/codemirror/addon/hint/sql-hint.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/addon/hint/sql-hint.js') },
116                     { from: path.resolve(__dirname, 'node_modules/codemirror/addon/hint/show-hint.css'), to: path.resolve(__dirname, 'js/vendor/codemirror/addon/hint/show-hint.css') },
117                     { from: path.resolve(__dirname, 'node_modules/codemirror/addon/hint/show-hint.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/addon/hint/show-hint.js') },
118                     { from: path.resolve(__dirname, 'node_modules/codemirror/addon/runmode/runmode.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/addon/runmode/runmode.js') },
119                     { from: path.resolve(__dirname, 'node_modules/codemirror/addon/lint/lint.css'), to: path.resolve(__dirname, 'js/vendor/codemirror/addon/lint/lint.css') },
120                     { from: path.resolve(__dirname, 'node_modules/codemirror/addon/lint/lint.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/addon/lint/lint.js') },
121                     { from: path.resolve(__dirname, 'node_modules/codemirror/lib/codemirror.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/lib/codemirror.js') },
122                     { from: path.resolve(__dirname, 'node_modules/codemirror/lib/codemirror.css'), to: path.resolve(__dirname, 'js/vendor/codemirror/lib/codemirror.css') },
123                     { from: path.resolve(__dirname, 'node_modules/codemirror/mode/sql/sql.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/mode/sql/sql.js') },
124                     { from: path.resolve(__dirname, 'node_modules/codemirror/mode/javascript/javascript.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/mode/javascript/javascript.js') },
125                     { from: path.resolve(__dirname, 'node_modules/codemirror/mode/xml/xml.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/mode/xml/xml.js') },
126                     { from: path.resolve(__dirname, 'node_modules/codemirror/LICENSE'), to: path.resolve(__dirname, 'js/vendor/codemirror/LICENSE'), toType: 'file' },
127                     { from: path.resolve(__dirname, 'node_modules/jquery/dist/jquery.min.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery.min.js') },
128                     { from: path.resolve(__dirname, 'node_modules/jquery/dist/jquery.min.map'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery.min.map') },
129                     { from: path.resolve(__dirname, 'node_modules/jquery/LICENSE.txt'), to: path.resolve(__dirname, 'js/vendor/jquery/MIT-LICENSE.txt') },
130                     { from: path.resolve(__dirname, 'node_modules/jquery-migrate/dist/jquery-migrate.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery-migrate.js') },
131                     { from: path.resolve(__dirname, 'node_modules/jquery-mousewheel/jquery.mousewheel.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery.mousewheel.js') },
132                     { from: path.resolve(__dirname, 'node_modules/jquery-ui-dist/jquery-ui.min.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery-ui.min.js') },
133                     { from: path.resolve(__dirname, 'node_modules/jquery-validation/dist/jquery.validate.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery.validate.js') },
134                     { from: path.resolve(__dirname, 'node_modules/jquery-validation/dist/additional-methods.js'), to: path.resolve(__dirname, 'js/vendor/jquery/additional-methods.js') },
135                     { from: path.resolve(__dirname, 'node_modules/js-cookie/src/js.cookie.js'), to: path.resolve(__dirname, 'js/vendor/js.cookie.js') },
136                     { from: path.resolve(__dirname, 'node_modules/bootstrap/dist/js/bootstrap.bundle.min.js'), to: path.resolve(__dirname, 'js/vendor/bootstrap/bootstrap.bundle.min.js') },
137                     { from: path.resolve(__dirname, 'node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map'), to: path.resolve(__dirname, 'js/vendor/bootstrap/bootstrap.bundle.min.js.map') },
138                     { from: path.resolve(__dirname, 'node_modules/@zxcvbn-ts/core/dist/zxcvbn-ts.js'), to: path.resolve(__dirname, 'js/vendor/zxcvbn-ts.js') },
139                     { from: path.resolve(__dirname, 'node_modules/@zxcvbn-ts/core/dist/zxcvbn-ts.js.map'), to: path.resolve(__dirname, 'js/vendor/zxcvbn-ts.js.map') },
140                     { from: path.resolve(__dirname, 'node_modules/tracekit/tracekit.js'), to: path.resolve(__dirname, 'js/vendor/tracekit.js') },
141                     { from: path.resolve(__dirname, 'node_modules/u2f-api-polyfill/u2f-api-polyfill.js'), to: path.resolve(__dirname, 'js/vendor/u2f-api-polyfill.js') },
142                     { from: path.resolve(__dirname, 'node_modules/stickyfilljs/dist/stickyfill.min.js'), to: path.resolve(__dirname, 'js/vendor/stickyfill.min.js') },
143                     { from: path.resolve(__dirname, 'node_modules/kbwood-jquery-svg/jquery.svg.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery.svg.js') },
144                     { from: path.resolve(__dirname, 'node_modules/jquery-uitablefilter/jquery.uitablefilter.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery.uitablefilter.js') },
145                     { from: path.resolve(__dirname, 'node_modules/tablesorter/dist/js/jquery.tablesorter.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery.tablesorter.js') },
146                     { from: path.resolve(__dirname, 'node_modules/jquery-debounce-throttle/index.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery.debounce-1.0.6.js') },
147                     { from: path.resolve(__dirname, 'node_modules/jquery-ui-timepicker-addon/dist/jquery-ui-timepicker-addon.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery-ui-timepicker-addon.js') },
148                     { from: path.resolve(__dirname, 'node_modules/ol/ol.css'), to: path.resolve(__dirname, 'js/vendor/openlayers/theme/ol.css') },
149                     { from: path.resolve(__dirname, 'node_modules/locutus.sprintf/src/php/strings/sprintf.browser.js'), to: path.resolve(__dirname, 'js/vendor/sprintf.js') },
150                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.pieRenderer.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.pieRenderer.js') },
151                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.barRenderer.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.barRenderer.js') },
152                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.pointLabels.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.pointLabels.js') },
153                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.enhancedPieLegendRenderer.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.enhancedPieLegendRenderer.js') },
154                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.dateAxisRenderer.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.dateAxisRenderer.js') },
155                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.categoryAxisRenderer.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.categoryAxisRenderer.js') },
156                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.canvasTextRenderer.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.canvasTextRenderer.js') },
157                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.canvasAxisLabelRenderer.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js') },
158                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.cursor.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.cursor.js') },
159                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.highlighter.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.highlighter.js') },
160                 ],
161             }),
162             new WebpackConcatPlugin({
163                 bundles: [
164                     {
165                         dest: './js/vendor/jqplot/jquery.jqplot.js',
166                         src: [
167                             './node_modules/updated-jqplot/build/jqplot.core.js',
168                             './node_modules/updated-jqplot/build/jqplot.axisLabelRenderer.js',
169                             './node_modules/updated-jqplot/build/jqplot.axisTickRenderer.js',
170                             './node_modules/updated-jqplot/build/jqplot.canvasGridRenderer.js',
171                             './node_modules/updated-jqplot/build/jqplot.divTitleRenderer.js',
172                             './node_modules/updated-jqplot/build/jqplot.linePattern.js',
173                             './node_modules/updated-jqplot/build/jqplot.lineRenderer.js',
174                             './node_modules/updated-jqplot/build/jqplot.linearAxisRenderer.js',
175                             './node_modules/updated-jqplot/build/jqplot.linearTickGenerator.js',
176                             './node_modules/updated-jqplot/build/jqplot.markerRenderer.js',
177                             './node_modules/updated-jqplot/build/jqplot.shadowRenderer.js',
178                             './node_modules/updated-jqplot/build/jqplot.shapeRenderer.js',
179                             './node_modules/updated-jqplot/build/jqplot.tableLegendRenderer.js',
180                             './node_modules/updated-jqplot/build/jqplot.themeEngine.js',
181                             './node_modules/updated-jqplot/build/jqplot.toImage.js',
182                             './node_modules/updated-jqplot/build/jsdate.js',
183                             './node_modules/updated-jqplot/build/jqplot.sprintf.js',
184                             './node_modules/updated-jqplot/build/jqplot.effects.core.js',
185                             './node_modules/updated-jqplot/build/jqplot.effects.blind.js',
186                         ],
187                     },
188                 ],
189             }),
190         ],
191     },
192     {
193         name: 'OpenLayers',
194         entry: './js/src/ol.mjs',
195         devtool: 'source-map',
196         mode: 'production',
197         performance: {
198             hints: false,
199             maxEntrypointSize: 512000,
200             maxAssetSize: 512000,
201         },
202         output: {
203             path: path.resolve('./js/vendor/openlayers'),
204             filename: 'OpenLayers.js',
205             library: 'ol',
206             libraryTarget: 'umd',
207             libraryExport: 'default',
208         },
209         plugins: [
210             new webpack.BannerPlugin({
211                 banner: 'OpenLayers (https://openlayers.org/)\nCopyright 2005-present, OpenLayers Contributors All rights reserved.\nLicensed under BSD 2-Clause License (https://github.com/openlayers/openlayers/blob/main/LICENSE.md)',
212             }),
213         ],
214     },
215     {
216         name: 'CSS',
217         mode: 'none',
218         devtool: 'source-map',
219         entry: {
220             'themes/bootstrap/css/theme': './themes/bootstrap/scss/theme.scss',
221             'themes/metro/css/blueeyes-theme': './themes/metro/scss/blueeyes-theme.scss',
222             'themes/metro/css/mono-theme': './themes/metro/scss/mono-theme.scss',
223             'themes/metro/css/redmond-theme': './themes/metro/scss/redmond-theme.scss',
224             'themes/metro/css/teal-theme': './themes/metro/scss/teal-theme.scss',
225             'themes/metro/css/theme': './themes/metro/scss/theme.scss',
226             'themes/original/css/theme': './themes/original/scss/theme.scss',
227             'themes/pmahomme/css/theme': './themes/pmahomme/scss/theme.scss',
228             'setup/styles': './setup/scss/styles.scss',
229         },
230         output: {
231             filename: 'build/css/[name].js',
232             path: path.resolve(__dirname, ''),
233         },
234         module: {
235             rules: [
236                 {
237                     test: /\.scss$/,
238                     use: [
239                         MiniCssExtractPlugin.loader,
240                         {
241                             loader: 'css-loader',
242                             options: {
243                                 url: false,
244                             },
245                         },
246                         {
247                             loader: 'postcss-loader',
248                             options: {
249                                 postcssOptions: {
250                                     plugins: [ autoprefixer() ],
251                                 },
252                             },
253                         },
254                         'sass-loader',
255                     ],
256                 },
257             ],
258         },
259         plugins: [
260             new MiniCssExtractPlugin({
261                 filename: '[name].css',
262                 chunkFilename: '[id].css',
263             }),
264             new WebpackRTLPlugin({
265                 filename: '[name].rtl.css',
266                 minify: false,
267             }),
268         ],
269     },