Translated using Weblate (Turkish)
[phpmyadmin.git] / webpack.config.js
blob01048f7eebbd35d948a01c0ce5b622698a94ee48
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 RtlCssPlugin = require('rtlcss-webpack-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         externals: {
99             jquery: 'jQuery',
100             codemirror: 'CodeMirror',
101         },
102         module: {
103             rules: [
104                 {
105                     test: /\.js$/,
106                     exclude: /node_modules/,
107                     use: {
108                         loader: 'babel-loader',
109                         options: {
110                             presets:  ['@babel/preset-env'],
111                         },
112                     },
113                 },
114             ],
115         },
116         plugins: [
117             new CopyPlugin({
118                 patterns: [
119                     { from: path.resolve(__dirname, 'node_modules/codemirror/addon/hint/sql-hint.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/addon/hint/sql-hint.js') },
120                     { from: path.resolve(__dirname, 'node_modules/codemirror/addon/hint/show-hint.css'), to: path.resolve(__dirname, 'js/vendor/codemirror/addon/hint/show-hint.css') },
121                     { from: path.resolve(__dirname, 'node_modules/codemirror/addon/hint/show-hint.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/addon/hint/show-hint.js') },
122                     { from: path.resolve(__dirname, 'node_modules/codemirror/addon/runmode/runmode.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/addon/runmode/runmode.js') },
123                     { from: path.resolve(__dirname, 'node_modules/codemirror/addon/lint/lint.css'), to: path.resolve(__dirname, 'js/vendor/codemirror/addon/lint/lint.css') },
124                     { from: path.resolve(__dirname, 'node_modules/codemirror/addon/lint/lint.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/addon/lint/lint.js') },
125                     { from: path.resolve(__dirname, 'node_modules/codemirror/lib/codemirror.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/lib/codemirror.js') },
126                     { from: path.resolve(__dirname, 'node_modules/codemirror/lib/codemirror.css'), to: path.resolve(__dirname, 'js/vendor/codemirror/lib/codemirror.css') },
127                     { from: path.resolve(__dirname, 'node_modules/codemirror/mode/sql/sql.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/mode/sql/sql.js') },
128                     { from: path.resolve(__dirname, 'node_modules/codemirror/mode/javascript/javascript.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/mode/javascript/javascript.js') },
129                     { from: path.resolve(__dirname, 'node_modules/codemirror/mode/xml/xml.js'), to: path.resolve(__dirname, 'js/vendor/codemirror/mode/xml/xml.js') },
130                     { from: path.resolve(__dirname, 'node_modules/codemirror/LICENSE'), to: path.resolve(__dirname, 'js/vendor/codemirror/LICENSE'), toType: 'file' },
131                     { from: path.resolve(__dirname, 'node_modules/jquery/dist/jquery.min.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery.min.js') },
132                     { from: path.resolve(__dirname, 'node_modules/jquery/dist/jquery.min.map'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery.min.map') },
133                     { from: path.resolve(__dirname, 'node_modules/jquery/LICENSE.txt'), to: path.resolve(__dirname, 'js/vendor/jquery/MIT-LICENSE.txt') },
134                     { from: path.resolve(__dirname, 'node_modules/jquery-migrate/dist/jquery-migrate.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery-migrate.js') },
135                     { from: path.resolve(__dirname, 'node_modules/jquery-ui-dist/jquery-ui.min.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery-ui.min.js') },
136                     { from: path.resolve(__dirname, 'node_modules/jquery-validation/dist/jquery.validate.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery.validate.js') },
137                     { from: path.resolve(__dirname, 'node_modules/jquery-validation/dist/additional-methods.js'), to: path.resolve(__dirname, 'js/vendor/jquery/additional-methods.js') },
138                     { from: path.resolve(__dirname, 'node_modules/js-cookie/src/js.cookie.js'), to: path.resolve(__dirname, 'js/vendor/js.cookie.js') },
139                     { from: path.resolve(__dirname, 'node_modules/bootstrap/dist/js/bootstrap.bundle.min.js'), to: path.resolve(__dirname, 'js/vendor/bootstrap/bootstrap.bundle.min.js') },
140                     { 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') },
141                     { from: path.resolve(__dirname, 'node_modules/@zxcvbn-ts/core/dist/zxcvbn-ts.js'), to: path.resolve(__dirname, 'js/vendor/zxcvbn-ts.js') },
142                     { from: path.resolve(__dirname, 'node_modules/@zxcvbn-ts/core/dist/zxcvbn-ts.js.map'), to: path.resolve(__dirname, 'js/vendor/zxcvbn-ts.js.map') },
143                     { from: path.resolve(__dirname, 'node_modules/tracekit/tracekit.js'), to: path.resolve(__dirname, 'js/vendor/tracekit.js') },
144                     { from: path.resolve(__dirname, 'node_modules/u2f-api-polyfill/u2f-api-polyfill.js'), to: path.resolve(__dirname, 'js/vendor/u2f-api-polyfill.js') },
145                     { from: path.resolve(__dirname, 'node_modules/jquery-uitablefilter/jquery.uitablefilter.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery.uitablefilter.js') },
146                     { from: path.resolve(__dirname, 'node_modules/tablesorter/dist/js/jquery.tablesorter.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery.tablesorter.js') },
147                     { from: path.resolve(__dirname, 'node_modules/jquery-debounce-throttle/index.js'), to: path.resolve(__dirname, 'js/vendor/jquery/jquery.debounce-1.0.6.js') },
148                     { 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') },
149                     { from: path.resolve(__dirname, 'node_modules/ol/ol.css'), to: path.resolve(__dirname, 'js/vendor/openlayers/theme/ol.css') },
150                     { from: path.resolve(__dirname, 'node_modules/locutus.sprintf/src/php/strings/sprintf.browser.js'), to: path.resolve(__dirname, 'js/vendor/sprintf.js') },
151                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.pieRenderer.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.pieRenderer.js') },
152                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.barRenderer.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.barRenderer.js') },
153                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.pointLabels.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.pointLabels.js') },
154                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.enhancedPieLegendRenderer.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.enhancedPieLegendRenderer.js') },
155                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.dateAxisRenderer.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.dateAxisRenderer.js') },
156                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.categoryAxisRenderer.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.categoryAxisRenderer.js') },
157                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.canvasTextRenderer.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.canvasTextRenderer.js') },
158                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.canvasAxisLabelRenderer.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js') },
159                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.cursor.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.cursor.js') },
160                     { from: path.resolve(__dirname, 'node_modules/updated-jqplot/build/plugins/jqplot.highlighter.js'), to: path.resolve(__dirname, 'js/vendor/jqplot/plugins/jqplot.highlighter.js') },
161                 ],
162             }),
163             new WebpackConcatPlugin({
164                 bundles: [
165                     {
166                         dest: './js/vendor/jqplot/jquery.jqplot.js',
167                         src: [
168                             './node_modules/updated-jqplot/build/jqplot.core.js',
169                             './node_modules/updated-jqplot/build/jqplot.axisLabelRenderer.js',
170                             './node_modules/updated-jqplot/build/jqplot.axisTickRenderer.js',
171                             './node_modules/updated-jqplot/build/jqplot.canvasGridRenderer.js',
172                             './node_modules/updated-jqplot/build/jqplot.divTitleRenderer.js',
173                             './node_modules/updated-jqplot/build/jqplot.linePattern.js',
174                             './node_modules/updated-jqplot/build/jqplot.lineRenderer.js',
175                             './node_modules/updated-jqplot/build/jqplot.linearAxisRenderer.js',
176                             './node_modules/updated-jqplot/build/jqplot.linearTickGenerator.js',
177                             './node_modules/updated-jqplot/build/jqplot.markerRenderer.js',
178                             './node_modules/updated-jqplot/build/jqplot.shadowRenderer.js',
179                             './node_modules/updated-jqplot/build/jqplot.shapeRenderer.js',
180                             './node_modules/updated-jqplot/build/jqplot.tableLegendRenderer.js',
181                             './node_modules/updated-jqplot/build/jqplot.themeEngine.js',
182                             './node_modules/updated-jqplot/build/jqplot.toImage.js',
183                             './node_modules/updated-jqplot/build/jsdate.js',
184                             './node_modules/updated-jqplot/build/jqplot.sprintf.js',
185                             './node_modules/updated-jqplot/build/jqplot.effects.core.js',
186                             './node_modules/updated-jqplot/build/jqplot.effects.blind.js',
187                         ],
188                     },
189                 ],
190             }),
191         ],
192     },
193     {
194         name: 'OpenLayers',
195         entry: './js/src/ol.mjs',
196         devtool: 'source-map',
197         mode: 'production',
198         performance: {
199             hints: false,
200             maxEntrypointSize: 512000,
201             maxAssetSize: 512000,
202         },
203         output: {
204             path: path.resolve('./js/vendor/openlayers'),
205             filename: 'OpenLayers.js',
206             library: 'ol',
207             libraryTarget: 'umd',
208             libraryExport: 'default',
209         },
210         plugins: [
211             new webpack.BannerPlugin({
212                 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)',
213             }),
214         ],
215     },
216     {
217         name: 'CSS',
218         mode: 'none',
219         devtool: 'source-map',
220         entry: {
221             'themes/bootstrap/css/theme': './themes/bootstrap/scss/theme.scss',
222             'themes/metro/css/blueeyes-theme': './themes/metro/scss/blueeyes-theme.scss',
223             'themes/metro/css/mono-theme': './themes/metro/scss/mono-theme.scss',
224             'themes/metro/css/redmond-theme': './themes/metro/scss/redmond-theme.scss',
225             'themes/metro/css/teal-theme': './themes/metro/scss/teal-theme.scss',
226             'themes/metro/css/theme': './themes/metro/scss/theme.scss',
227             'themes/original/css/theme': './themes/original/scss/theme.scss',
228             'themes/pmahomme/css/theme': './themes/pmahomme/scss/theme.scss',
229             'setup/styles': './setup/scss/styles.scss',
230         },
231         output: {
232             filename: 'build/css/[name].js',
233             path: path.resolve(__dirname, ''),
234         },
235         module: {
236             rules: [
237                 {
238                     test: /\.scss$/,
239                     use: [
240                         MiniCssExtractPlugin.loader,
241                         {
242                             loader: 'css-loader',
243                             options: {
244                                 url: false,
245                             },
246                         },
247                         {
248                             loader: 'postcss-loader',
249                             options: {
250                                 postcssOptions: {
251                                     plugins: [ autoprefixer() ],
252                                 },
253                             },
254                         },
255                         'sass-loader',
256                     ],
257                 },
258             ],
259         },
260         plugins: [
261             new MiniCssExtractPlugin({
262                 filename: '[name].css',
263                 chunkFilename: '[id].css',
264             }),
265             new RtlCssPlugin({
266                 filename: '[name].rtl.css',
267             }),
268         ],
269     },