Debian Codegraph @

debian/build.js

raw symbols SCIP
1 /* This file is inspired by debian/build.js in the jquery package and on gruntfile.js
2 */
3 ({
4 baseUrl: "ui",
5 name: "widget",
6 out: "jquery-ui.js",
7 preserveLicenseComments: false,
8 // We have multiple minify steps
9 optimize: "none",
10 findNestedDependencies: true,
11 // Avoid breaking semicolons inserted by r.js
12 skipSemiColonInsertion: true,
13 // otherwise define(xxx, function(){}) gets added
14 skipModuleInsertion: true,
15 wrap: {
16 startFile: "debian/intro.js",
17 endFile: "debian/outro.js",
18 },
19 // prevent jquery from being included
20 paths: {
21 jquery: "empty:"
22 },
23 include: [
24 "position.js",
25 "data.js",
26 "disable-selection.js",
27 "effect.js",
28 "effects/effect-blind.js",
29 "effects/effect-bounce.js",
30 "effects/effect-clip.js",
31 "effects/effect-drop.js",
32 "effects/effect-explode.js",
33 "effects/effect-fade.js",
34 "effects/effect-fold.js",
35 "effects/effect-highlight.js",
36 "effects/effect-puff.js",
37 "effects/effect-pulsate.js",
38 "effects/effect-scale.js",
39 "effects/effect-shake.js",
40 "effects/effect-size.js",
41 "effects/effect-slide.js",
42 "effects/effect-transfer.js",
43 "focusable.js",
44 "form-reset-mixin.js",
45 "jquery-1-7.js",
46 "keycode.js",
47 "labels.js",
48 "scroll-parent.js",
49 "tabbable.js",
50 "unique-id.js",
51 "widgets/accordion.js",
52 "widgets/autocomplete.js",
53 "widgets/button.js",
54 "widgets/checkboxradio.js",
55 "widgets/controlgroup.js",
56 "widgets/datepicker.js",
57 "widgets/dialog.js",
58 "plugin.js",
59 "widgets/draggable.js",
60 "widgets/droppable.js",
61 "widgets/menu.js",
62 "widgets/mouse.js",
63 "widgets/progressbar.js",
64 "widgets/resizable.js",
65 "widgets/selectable.js",
66 "widgets/selectmenu.js",
67 "widgets/slider.js",
68 "widgets/sortable.js",
69 "widgets/spinner.js",
70 "widgets/tabs.js",
71 "widgets/tooltip.js"
72 ],
73 rawText: {},
74 /**
75 * @param {String} name
76 * @param {String} path
77 * @param {String} contents The contents to be written (including their AMD wrappers)
78 */
79 onBuildWrite: function( name, path, contents ) {
80 function capitalize(word){
81 return word.substring(0,1).toUpperCase() + word.substring(1);
82 }
83 contents = contents.replace(/\( function\( factory[\s\S]*?function\( \$\s*\)[^\n]+/mig, '');
84 contents = contents.replace(/[\n]{1}\} \) \);/ig, '');
85 // Next line works, except they should capitalize first character
86 contents = contents.replace(/[\n]{1}return \$\.effects\.define\( \"[a-z]+/g, function(c){ return "\nvar effectsEffect" + capitalize(c.replace(/[\n]{1}return \$\.effects\.define\( \"/, '')) + ' = ' + c.replace(/[\n]{1}return /, ''); });
87
88 contents = contents.replace(/[\n]{1}return \$\.widget\( \"ui\.[a-z]+/g, function(c){ return "\nvar widgets" + capitalize(c.replace(/[\n]{1}return \$\.widget\( \"ui\./, '')) + ' = ' + c.replace(/[\n]{1}return /, ''); });
89
90 contents = contents.replace(/[\n]{1}return \$\.ui\.[a-zA-Z]+ \=/g, function(c){ return "\nvar " + c.replace(/[\n]{1}return \$\.ui\./, '').replace(/ =/, '') + ' = ' + c.replace(/[\n]{1}return /, ''); });
91
92 contents = contents.replace(/[\n]{1}return \$\.ui\.[a-z]+/g, function(c){ return "\nvar widgets" + capitalize(c.replace(/[\n]{1}return \$\.ui\./, '')) + ' = ' + c.replace(/[\n]{1}return /, ''); });
93
94 contents = contents.replace(/[\n]{1}return \$\.fn\.extend\( \{[\n]{1}\t[a-zA-Z]+/ig, function(c){ return "\nvar " + c.replace(/[\n]{1}return \$\.fn\.extend\( \{[\n]{1}\t/ig, '') + ' = ' + c.replace(/[\n]{1}return /, ''); });
95
96 contents = contents.replace(/[\n]{1}return \$\.fn\.[a-zA-Z]+/g, function(c){ return "\nvar " + c.replace(/[\n]{1}return \$\.fn\./g, '') + ' = ' + c.replace(/[\n]{1}return /, ''); });
97
98 // very specific (1 case)
99 contents = contents.replace(/return \$\.extend\( \$\.expr\[ \":\" \], \{[\n]{1}\tdata/, 'var data = $.extend( $.expr[ ":" ], {' + "\n\tdata");
100 contents = contents.replace(/return \$\.extend\( \$\.expr\[ \":\" \], \{[\n]{1}\ttabbable/, 'var tabbable = $.extend( $.expr[ ":" ], {' + "\n\ttabbable");
101
102 contents = contents.replace(/[\n]{1}return \$\.[a-z]+/g, function(c){ return "\nvar " + c.replace(/[\n]{1}return \$\./, '') + ' = ' + c.replace(/[\n]{1}return /, ''); });
103
104 // Some fixes
105 contents = contents.replace('var effects ', 'var effect ');
106 contents = contents.replace(/[\n]{1}return effect;/, "\n" + 'var effectsEffectTransfer = effect;');
107 contents = contents.replace('widgetsPosition', 'position');
108 contents = contents.replace('widgetsFocusable', 'focusable');
109 contents = contents.replace('var datepicker ', 'var widgetsDatepicker ');
110 contents = contents.replace(/[\n]{1}var keyCode/, "\nvar keycode");
111
112 return contents;
113 }
114 })
115
116