Permalink
Browse files

Changed JS bundling from simple concat to webpack based.

This enables smarter bundling, explicit dependencies, makes way for
future support for ES6, better libraries integration (e.g. jQuery
is no longer exposed to window, so no overlap with other libs).

This disables, however, the possibility for external apps to
directly use CMS modules, only the bundles (which is how it should
be).

However, for backwards compatibility cms.base has a typeof require
check for now.
  • Loading branch information...
1 parent 7b9ee2a commit a44cf25d6d5fd63cd2e9bd2ad1b5e14ae15c7d7b @vxsx vxsx committed Jun 2, 2016
Showing with 13,511 additions and 10,784 deletions.
  1. +1 −1 .eslintrc.js
  2. +2 −0 CHANGELOG.txt
  3. +0 −10 cms/forms/widgets.py
  4. +0 −4 cms/forms/wizards.py
  5. +7 −0 cms/static/cms/js/admin.base.js
  6. +9 −0 cms/static/cms/js/admin.changeform.js
  7. +9 −0 cms/static/cms/js/admin.pagetree.js
  8. +4 −20 cms/static/cms/js/dist/bundle.admin.base.min.js
  9. +1 −1 cms/static/cms/js/dist/bundle.admin.changeform.min.js
  10. +0 −15 cms/static/cms/js/dist/bundle.admin.changelist.min.js
  11. +5 −8 cms/static/cms/js/dist/bundle.admin.pagetree.min.js
  12. +8 −58 cms/static/cms/js/dist/bundle.toolbar.min.js
  13. +817 −1 cms/static/cms/js/libs/jstree/jstree.grid.min.js
  14. +520 −524 cms/static/cms/js/modules/cms.base.js
  15. +66 −69 cms/static/cms/js/modules/cms.changeform.js
  16. +138 −184 cms/static/cms/js/modules/cms.changetracker.js
  17. +133 −140 cms/static/cms/js/modules/cms.clipboard.js
  18. +137 −146 cms/static/cms/js/modules/cms.messages.js
  19. +1,007 −1,013 cms/static/cms/js/modules/cms.modal.js
  20. +300 −310 cms/static/cms/js/modules/cms.navigation.js
  21. +86 −96 cms/static/cms/js/modules/cms.pagetree.dropdown.js
  22. +844 −842 cms/static/cms/js/modules/cms.pagetree.js
  23. +185 −190 cms/static/cms/js/modules/cms.pagetree.stickyheader.js
  24. +1,451 −1,456 cms/static/cms/js/modules/cms.plugins.js
  25. +388 −395 cms/static/cms/js/modules/cms.sideframe.js
  26. +539 −534 cms/static/cms/js/modules/cms.structureboard.js
  27. +692 −696 cms/static/cms/js/modules/cms.toolbar.js
  28. +151 −158 cms/static/cms/js/modules/cms.tooltip.js
  29. +1 −3 cms/static/cms/js/modules/jquery.transition.js
  30. +45 −0 cms/static/cms/js/modules/simplemap.js
  31. +22 −0 cms/static/cms/js/toolbar.js
  32. +7 −5 cms/templates/admin/cms/page/change_form.html
  33. +0 −2 cms/templates/admin/cms/page/tree/base.html
  34. +0 −2 cms/templates/cms/toolbar/toolbar_javascript.html
  35. +7 −3 cms/templates/cms/wizards/base.html
  36. +14 −14 cms/tests/frontend/integration/clipboard.js
  37. +1 −1 cms/tests/frontend/integration/createContent.js
  38. +5 −5 cms/tests/frontend/integration/dragndrop.js
  39. +9 −9 cms/tests/frontend/integration/modal.js
  40. +2 −2 cms/tests/frontend/integration/pagetree.js
  41. +2 −2 cms/tests/frontend/integration/publish.js
  42. +2 −2 cms/tests/frontend/integration/sideframe.js
  43. +2 −2 cms/tests/frontend/integration/toolbar.js
  44. +1 −1 cms/tests/frontend/integration/wizard.js
  45. +46 −47 cms/tests/frontend/karma.conf.js
  46. +8 −2 cms/tests/frontend/unit/cms.base.test.js
  47. +8 −1 cms/tests/frontend/unit/cms.changetracker.test.js
  48. +6 −0 cms/tests/frontend/unit/cms.clipboard.test.js
  49. +6 −2 cms/tests/frontend/unit/cms.messages.test.js
  50. +23 −0 cms/tests/frontend/unit/cms.modal.test.js
  51. +6 −0 cms/tests/frontend/unit/cms.navigation.test.js
  52. +7 −0 cms/tests/frontend/unit/cms.pagetree.dropdown.test.js
  53. +7 −0 cms/tests/frontend/unit/cms.pagetree.stickyheader.test.js
  54. +7 −0 cms/tests/frontend/unit/cms.pagetree.test.js
  55. +6 −0 cms/tests/frontend/unit/cms.plugins.test.js
  56. +7 −0 cms/tests/frontend/unit/cms.sideframe.test.js
  57. +5 −1 cms/tests/frontend/unit/cms.structureboard.test.js
  58. +7 −0 cms/tests/frontend/unit/cms.toolbar.test.js
  59. +8 −2 cms/tests/frontend/unit/cms.tooltip.test.js
  60. +29 −0 cms/tests/frontend/unit/index.js
  61. +6 −2 docs/contributing/code.rst
  62. +25 −73 gulpfile.js
  63. +5,583 −3,725 npm-shrinkwrap.json
  64. +8 −4 package.json
  65. +1 −1 test_requirements/requirements_base.txt
  66. +82 −0 webpack.config.js
View
@@ -112,7 +112,7 @@ module.exports = {
"yoda": [2, "never", { "exceptRange": true }],
// Strict Mode
- "strict": [2, "function"],
+ "strict": 0, // not required with webpack
// Variables
"init-declarations": 0,
View
@@ -7,6 +7,8 @@
* Fixed a misleading message when modal iframe contents couldn't be accessed.
* Added a workaround for a bug when plugins couldn't be deleted in Firefox
with 1Password extension installed
+* Changed CMS JavaScript bundling from simple concatenation to webpack-based.
+ Using CMS Javascript modules directly is no longer possible.
=== 3.3.0 (2016-05-26) ===
View
@@ -24,10 +24,7 @@ class PageSelectWidget(MultiWidget):
class Media:
js = (
- 'cms/js/modules/jquery.noconflict.pre.js',
- 'cms/js/dist/bundle.admin.base.min.js',
'cms/js/widgets/forms.pageselectwidget.js',
- 'cms/js/modules/jquery.noconflict.post.js'
)
def __init__(self, site_choices=None, page_choices=None, attrs=None):
@@ -126,7 +123,6 @@ class Media:
)
}
js = (
- 'cms/js/dist/bundle.admin.base.min.js',
'cms/js/select2/select2.js',
'cms/js/widgets/forms.pagesmartlinkwidget.js',
)
@@ -195,10 +191,7 @@ class AppHookSelect(Select):
class Media:
js = (
- 'cms/js/modules/jquery.noconflict.pre.js',
- 'cms/js/dist/bundle.admin.base.min.js',
'cms/js/widgets/forms.apphookselect.js',
- 'cms/js/modules/jquery.noconflict.post.js'
)
def __init__(self, attrs=None, choices=(), app_namespaces={}):
@@ -251,10 +244,7 @@ class ApplicationConfigSelect(Select):
class Media:
js = (
- 'cms/js/modules/jquery.noconflict.pre.js',
- 'cms/js/dist/bundle.admin.base.min.js',
'cms/js/widgets/forms.apphookselect.js',
- 'cms/js/modules/jquery.noconflict.post.js'
)
def __init__(self, attrs=None, choices=(), app_configs={}):
@@ -83,11 +83,7 @@ class PageTypeSelect(forms.widgets.Select):
"""
class Media:
js = (
- 'cms/js/modules/jquery.noconflict.pre.js',
- 'cms/js/dist/bundle.admin.base.min.js',
- 'cms/js/modules/cms.base.js',
'cms/js/widgets/wizard.pagetypeselect.js',
- 'cms/js/modules/jquery.noconflict.post.js',
)
js = tuple(map(static_with_version, js))
@@ -0,0 +1,7 @@
+// polyfills
+require('./polyfills/function.prototype.bind.js');
+require('./libs/pep');
+
+var CMS = require('./modules/cms.base');
+
+window.CMS = CMS;
@@ -0,0 +1,9 @@
+// polyfills
+require('./polyfills/function.prototype.bind.js');
+require('./libs/pep');
+
+var CMS = require('./modules/cms.base');
+
+window.CMS = CMS;
+
+require('./modules/cms.changeform');
@@ -0,0 +1,9 @@
+// polyfills
+require('./polyfills/function.prototype.bind.js');
+require('./libs/pep');
+
+var CMS = require('./modules/cms.base');
+
+window.CMS = CMS;
+
+CMS.PageTree = require('./modules/cms.pagetree');
Oops, something went wrong.
@@ -1 +1 @@
-!function(t){"use strict";t(document).ready(function(){var a=t("#id_title"),n=t("#id_slug"),i=!1,e=!1;t('input[type="hidden"]').each(function(){t(this).parent(".form-row").hide()}),""===n.val()&&(e=!0),a.bind("keyup",function(){var t=a.val();window.UNIHANDECODER&&(t=window.UNIHANDECODER.decode(t)),e===!1&&""===n.val()&&(e=!0);var i=URLify(t,64);e&&n.val(i)}),a.trigger("keyup"),a.focus(),t("div.loading").each(function(){t(this).load(t(this).attr("rel"))}),n.add(a).bind("change",function(){t(this).data("changed",!0)}),CMS.API.changeLanguage=function(t){var e=!0;if(n.length&&(n.data("changed")||a.data("changed"))&&(i=!0),i){var d=gettext("Are you sure you want to change tabs without saving the page first?");e=confirm(d)}e&&(window.location.href=t)}})}(CMS.$);
+cmsWebpackJsonp([3],{0:function(n,a,i){i(4),i(5);var t=i(2);window.CMS=t,i(15)},15:function(n,a,i){var t=i(1);t(function(){var n=t("#id_title"),a=t("#id_slug"),i=!1,e=!1;t('input[type="hidden"]').each(function(){t(this).parent(".form-row").hide()}),""===a.val()&&(e=!0),n.bind("keyup",function(){var i=n.val();window.UNIHANDECODER&&(i=window.UNIHANDECODER.decode(i)),e===!1&&""===a.val()&&(e=!0);var t=URLify(i,64);e&&a.val(t)}),n.trigger("keyup"),n.focus(),t("div.loading").each(function(){t(this).load(t(this).attr("rel"))}),a.add(n).bind("change",function(){t(this).data("changed",!0)}),window.CMS.API.changeLanguage=function(t){var e=!0;if(a.length&&(a.data("changed")||n.data("changed"))&&(i=!0),i){var o=gettext("Are you sure you want to change tabs without saving the page first?");e=confirm(o)}e&&(window.location.href=t)}})}});
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.

0 comments on commit a44cf25

Please sign in to comment.