Removed the confirmation box for marking items in the user panel as read
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / js / require.build.js
1 (function () {
2 var config = {
3 mainConfigFile: 'require.config.js',
4 name: "WoltLabSuite/_Meta",
5 out: "WoltLabSuite.Core.min.js",
6 useStrict: true,
7 preserveLicenseComments: false,
8 optimize: 'uglify2',
9 uglify2: {
10 compress: {
11 sequences: true,
12 properties: true,
13 dead_code: true,
14 conditionals: true,
15 comparisons: true,
16 booleans: true,
17 loops: true,
18 hoist_funs: true,
19 hoist_vars: true,
20 if_return: true,
21 join_vars: true,
22 cascade: true,
23 /* this is basically the `--define` argument */
24 global_defs: {
25 COMPILER_TARGET_DEFAULT: true
26 }
27 }
28 },
29 paths: {
30 "requireLib": "require",
31
32 "jquery": "empty:"
33 },
34 deps: [
35 "require.config",
36 "wcf.globalHelper"
37 ],
38 include: [
39 "closest",
40 "requireLib",
41 "require.linearExecution"
42 ],
43 excludeShallow: [
44 'WoltLabSuite/_Meta'
45 ],
46 rawText: {
47 'WoltLabSuite/_Meta': 'define([], function() {});'
48 },
49 onBuildRead: function(moduleName, path, contents) {
50 if (!process.versions.node) {
51 throw new Error('You need to run node.js');
52 }
53
54 if (moduleName === 'WoltLabSuite/_Meta') {
55 if (global.allModules === undefined) {
56 var fs = module.require('fs'),
57 path = module.require('path');
58 global.allModules = [];
59
60 var queue = ['WoltLabSuite'];
61 var folder;
62 while (folder = queue.shift()) {
63 var files = fs.readdirSync(folder);
64 for (var i = 0; i < files.length; i++) {
65 var filename = path.join(folder, files[i]).replace(/\\/g, '/');
66 if (filename === 'WoltLabSuite/Core/Acp') continue;
67
68 if (path.extname(filename) === '.js') {
69 global.allModules.push(filename);
70 }
71 else if (fs.statSync(filename).isDirectory()) {
72 queue.push(filename);
73 }
74 }
75 }
76 }
77
78 return 'define([' + global.allModules.map(function (item) { return "'" + item.replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/\.js$/, '') + "'"; }).join(', ') + '], function() { });';
79 }
80
81 return contents;
82 }
83 };
84
85 var _isSupportedBuildUrl = require._isSupportedBuildUrl;
86 require._isSupportedBuildUrl = function (url) {
87 var result = _isSupportedBuildUrl(url);
88 if (!result) return result;
89
90 if (Object.keys(config.rawText).map(function (item) { return (process.cwd() + '/' + item + '.js').replace(/\\/g, '/'); }).indexOf(url.replace(/\\/g, '/')) !== -1) return result;
91
92 var fs = module.require('fs');
93 try {
94 fs.statSync(url);
95 }
96 catch (e) {
97 console.log('Unable to find module:', url, 'ignoring.');
98
99 return false;
100 }
101 return true;
102 };
103
104 if (module) module.exports = config;
105
106 return config;
107 })();