Commit 6dc9e8ed authored by JC Brand's avatar JC Brand

Use webpack for module bundling

parent d920c2a8
......@@ -2,7 +2,7 @@
"presets": [
["@babel/preset-env", {
"targets": {
"browsers": ["last 2 versions", "safari >= 10", "IE >= 11"]
"browsers": ["last 2 versions", "safari >= 10", "IE >= 11"]
}
}]
]
......
......@@ -15,6 +15,7 @@ OXIPNG ?= oxipng
PAPER =
PO2JSON ?= ./node_modules/.bin/po2json
RJS ?= ./node_modules/.bin/r.js
WEBPACK ?= ./node_modules/.bin/npx
SASS ?= ./.bundle/bin/sass
SED ?= sed
SPHINXBUILD ?= ./bin/sphinx-build
......@@ -155,7 +156,7 @@ watch: dev
.PHONY: watchjs
watchjs: dev
$(BABEL) --source-maps --watch=./src --out-dir=./builds
./node_modules/.bin/npx webpack --mode=development --watch
transpile: dev src
$(BABEL) --source-maps --out-dir=./builds ./src
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -20,8 +20,8 @@
<!-- *********************************************************************** -->
<![if gte IE 11]>
<link type="text/css" rel="stylesheet" media="screen" href="https://cdn.conversejs.org/css/converse.min.css" />
<script src="https://cdn.conversejs.org/dist/converse.min.js"></script>
<link type="text/css" rel="stylesheet" media="screen" href="css/converse.css" />
<script src="dist/converse.js"></script>
<![endif]>
</head>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -12,10 +12,10 @@
(function (root, factory) {
define(["converse-core",
"converse-muc",
"tpl!chatroom_bookmark_form",
"tpl!chatroom_bookmark_toggle",
"tpl!bookmark",
"tpl!bookmarks_list"
"templates/chatroom_bookmark_form.html",
"templates/chatroom_bookmark_toggle.html",
"templates/bookmark.html",
"templates/bookmarks_list.html"
],
factory);
}(this, function (
......
......@@ -9,7 +9,7 @@
"converse-core",
"emojione",
"filesize",
"tpl!chatboxes",
"templates/chatboxes.html",
"backbone.overview",
"form-utils"
], factory);
......
......@@ -5,26 +5,25 @@
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
define([
"converse-core",
define(["converse-core",
"bootstrap",
"emojione",
"xss",
"tpl!action",
"tpl!chatbox",
"tpl!chatbox_head",
"tpl!chatbox_message_form",
"tpl!emojis",
"tpl!error_message",
"tpl!help_message",
"tpl!info",
"tpl!new_day",
"tpl!user_details_modal",
"tpl!toolbar_fileupload",
"tpl!spinner",
"tpl!spoiler_button",
"tpl!status_message",
"tpl!toolbar",
"templates/action.html",
"templates/chatbox.html",
"templates/chatbox_head.html",
"templates/chatbox_message_form.html",
"templates/emojis.html",
"templates/error_message.html",
"templates/help_message.html",
"templates/info.html",
"templates/new_day.html",
"templates/user_details_modal.html",
"templates/toolbar_fileupload.html",
"templates/spinner.html",
"templates/spoiler_button.html",
"templates/status_message.html",
"templates/toolbar.html",
"converse-modal",
"converse-chatboxes",
"converse-message-view"
......
......@@ -10,10 +10,10 @@
define(["converse-core",
"bootstrap",
"lodash.fp",
"tpl!converse_brand_heading",
"tpl!controlbox",
"tpl!controlbox_toggle",
"tpl!login_panel",
"templates/converse_brand_heading.html",
"templates/controlbox.html",
"templates/controlbox_toggle.html",
"templates/login_panel.html",
"converse-chatview",
"converse-rosterview",
"converse-profile"
......
......@@ -8,7 +8,7 @@
(function (root, factory) {
define(["converse-core",
"tpl!dragresize",
"templates/dragresize.html",
"converse-chatview",
"converse-controlbox"
], factory);
......
......@@ -8,7 +8,7 @@
(function (root, factory) {
define(["converse-core",
"tpl!inverse_brand_heading",
"templates/inverse_brand_heading.html",
"converse-chatview",
"converse-controlbox",
"converse-muc",
......
......@@ -9,7 +9,7 @@
(function (root, factory) {
define([
"converse-core",
"tpl!chatbox",
"templates/chatbox.html",
"converse-chatview",
], factory);
}(this, function (converse, tpl_chatbox) {
......
......@@ -10,12 +10,12 @@
"xss",
"emojione",
"filesize",
"tpl!action",
"tpl!csn",
"tpl!file_progress",
"tpl!info",
"tpl!message",
"tpl!spoiler_message"
"templates/action.html",
"templates/csn.html",
"templates/file_progress.html",
"templates/info.html",
"templates/message.html",
"templates/spoiler_message.html"
], factory);
}(this, function (
converse,
......
......@@ -8,10 +8,10 @@
(function (root, factory) {
define(["converse-core",
"tpl!chatbox_minimize",
"tpl!toggle_chats",
"tpl!trimmed_chat",
"tpl!chats_panel",
"templates/chatbox_minimize.html",
"templates/toggle_chats.html",
"templates/trimmed_chat.html",
"templates/chats_panel.html",
"converse-chatview"
], factory);
}(this, function (
......
......@@ -8,7 +8,7 @@
if (typeof define === 'function' && define.amd) {
define([
"converse-core",
"tpl!alert_modal",
"templates/alert_modal.html",
"bootstrap",
"backbone.vdomview"
], factory);
......
......@@ -8,26 +8,26 @@
define([
"converse-core",
"muc-utils",
"tpl!add_chatroom_modal",
"tpl!chatarea",
"tpl!chatroom",
"tpl!chatroom_disconnect",
"tpl!chatroom_features",
"tpl!chatroom_form",
"tpl!chatroom_head",
"tpl!chatroom_invite",
"tpl!chatroom_nickname_form",
"tpl!chatroom_password_form",
"tpl!chatroom_sidebar",
"tpl!chatroom_toolbar",
"tpl!info",
"tpl!list_chatrooms_modal",
"tpl!occupant",
"tpl!room_description",
"tpl!room_item",
"tpl!room_panel",
"tpl!rooms_results",
"tpl!spinner",
"templates/add_chatroom_modal.html",
"templates/chatarea.html",
"templates/chatroom.html",
"templates/chatroom_disconnect.html",
"templates/chatroom_features.html",
"templates/chatroom_form.html",
"templates/chatroom_head.html",
"templates/chatroom_invite.html",
"templates/chatroom_nickname_form.html",
"templates/chatroom_password_form.html",
"templates/chatroom_sidebar.html",
"templates/chatroom_toolbar.html",
"templates/info.html",
"templates/list_chatrooms_modal.html",
"templates/occupant.html",
"templates/room_description.html",
"templates/room_item.html",
"templates/room_panel.html",
"templates/rooms_results.html",
"templates/spinner.html",
"awesomplete",
"converse-modal"
], factory);
......
......@@ -9,11 +9,11 @@
(function (root, factory) {
define(["converse-core",
"bootstrap",
"tpl!alert",
"tpl!chat_status_modal",
"tpl!profile_modal",
"tpl!profile_view",
"tpl!status_option",
"templates/alert.html",
"templates/chat_status_modal.html",
"templates/profile_modal.html",
"templates/profile_view.html",
"templates/status_option.html",
"converse-vcard",
"converse-modal"
], factory);
......
......@@ -12,13 +12,13 @@
(function (root, factory) {
define(["form-utils",
"converse-core",
"tpl!form_username",
"tpl!register_link",
"tpl!register_panel",
"tpl!registration_form",
"tpl!registration_request",
"tpl!form_input",
"tpl!spinner",
"templates/form_username.html",
"templates/register_link.html",
"templates/register_panel.html",
"templates/registration_form.html",
"templates/registration_request.html",
"templates/form_input.html",
"templates/spinner.html",
"converse-controlbox"
], factory);
}(this, function (
......
......@@ -13,8 +13,8 @@
define(["utils",
"converse-core",
"converse-muc",
"tpl!rooms_list",
"tpl!rooms_list_item"
"templates/rooms_list.html",
"templates/rooms_list_item.html"
], factory);
}(this, function (utils, converse, muc, tpl_rooms_list, tpl_rooms_list_item) {
const { Backbone, Promise, Strophe, b64_sha1, sizzle, _ } = converse.env;
......
......@@ -6,14 +6,14 @@
(function (root, factory) {
define(["converse-core",
"tpl!add_contact_modal",
"tpl!group_header",
"tpl!pending_contact",
"tpl!requesting_contact",
"tpl!roster",
"tpl!roster_filter",
"tpl!roster_item",
"tpl!search_contact",
"templates/add_contact_modal.html",
"templates/group_header.html",
"templates/pending_contact.html",
"templates/requesting_contact.html",
"templates/roster.html",
"templates/roster_filter.html",
"templates/roster_item.html",
"templates/search_contact.html",
"awesomplete",
"converse-chatboxes",
"converse-modal"
......
......@@ -5,7 +5,7 @@
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
define(["converse-core", "crypto", "tpl!vcard"], factory);
define(["converse-core", "crypto", "templates/vcard.html"], factory);
}(this, function (converse, CryptoJS, tpl_vcard) {
"use strict";
const { Backbone, Promise, Strophe, SHA1, _, $iq, $build, b64_sha1, moment, sizzle } = converse.env;
......
......@@ -21,7 +21,6 @@ if (typeof define !== 'undefined') {
"converse-muc-views",
"converse-muc-views", // Views related to MUC
"converse-notification", // HTML5 Notifications
"converse-otr", // Off-the-record encryption for one-on-one messages
"converse-ping", // XEP-0199 XMPP Ping
"converse-roster",
"converse-register", // XEP-0077 In-band registration
......
/*global define */
define(['lodash'], function (_) {
if (!_.isUndefined(require) && !_.isUndefined(require.s)) {
/* XXX: This is a hack to make sure that the compiled templates have
* access to the _ object.
*
* Otherwise we sometimes get errors like this:
*
* TypeError: Cannot read property 'escape' of undefined
* at eval (./src/templates/chatroom_sidebar.html:6)
*/
var lodashLoader = require.s.contexts._.config.lodashLoader;
lodashLoader.templateSettings.imports = { '_': _ };
require.config({'lodashLoader': lodashLoader});
}
return _.noConflict();
});
......@@ -16,10 +16,10 @@
"backbone",
"strophe",
"uri",
"tpl!audio",
"tpl!file",
"tpl!image",
"tpl!video"
"templates/audio.html",
"templates/file.html",
"templates/image.html",
"templates/video.html"
], factory);
} else {
// Used by the mockups
......
......@@ -12,15 +12,15 @@
"sizzle",
"lodash.noconflict",
"utils",
"tpl!field",
"tpl!select_option",
"tpl!form_select",
"tpl!form_textarea",
"tpl!form_checkbox",
"tpl!form_username",
"tpl!form_input",
"tpl!form_captcha",
"tpl!form_url",
"templates/field.html",
"templates/select_option.html",
"templates/form_select.html",
"templates/form_textarea.html",
"templates/form_checkbox.html",
"templates/form_username.html",
"templates/form_input.html",
"templates/form_captcha.html",
"templates/form_url.html",
], factory);
}(this, function (
sizzle,
......
/*global path, __dirname, module */
'use strict'
const path = require('path');
const config = {
entry: path.resolve(__dirname, 'src/converse.js'),
externals: [{
"window": "window"
}],
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'converse.js'
},
devtool: 'source-map',
module: {
rules: [{
test: /\.html$/,
exclude: /node_modules/,
use: [{
loader: 'lodash-template-webpack-loader',
options: {
"escape": /\{\{\{([\s\S]+?)\}\}\}/g,
"evaluate": /\{\[([\s\S]+?)\]\}/g,
"interpolate": /\{\{([\s\S]+?)\}\}/g,
// By default, template places the values from your data in the
// local scope via the with statement. However, you can specify
// a single variable name with the variable setting. This can
// significantly improve the speed at which a template is able
// to render.
"variable": 'o',
"prependFilenameComment": __dirname
}
}]
}, {
test: /\.js$/,
exclude: /(node_modules|spec|mockup)/,
use: {
loader: 'babel-loader',
options: {
presets: [
["@babel/preset-env", {
"targets": {
"browsers": [">1%", "not ie 11", "not op_mini all"]
}
}]
]
}
}
}],
},
resolve: {
modules: [
'node_modules',
path.resolve(__dirname, "src"),
],
alias: {
"IPv6": path.resolve(__dirname, "node_modules/urijs/src/IPv6"),
"SecondLevelDomains": path.resolve(__dirname, "node_modules/urijs/src/SecondLevelDomains"),
"awesomplete": path.resolve(__dirname, "node_modules/awesomplete-avoid-xss/awesomplete"),
"backbone": path.resolve(__dirname, "node_modules/backbone/backbone"),
"backbone.browserStorage": path.resolve(__dirname, "node_modules/backbone.browserStorage/backbone.browserStorage"),
"backbone.nativeview": path.resolve(__dirname, "node_modules/backbone.nativeview/backbone.nativeview"),
"backbone.noconflict": path.resolve(__dirname, "src/backbone.noconflict"),
"backbone.orderedlistview": path.resolve(__dirname, "node_modules/backbone.overview/dist/backbone.orderedlistview"),
"backbone.overview": path.resolve(__dirname, "node_modules/backbone.overview/dist/backbone.overview"),
"backbone.vdomview": path.resolve(__dirname, "node_modules/backbone.vdomview/dist/backbone.vdomview"),
"bootstrap": path.resolve(__dirname, "node_modules/bootstrap.native/dist/bootstrap-native-v4"),
"crypto": path.resolve(__dirname, "node_modules/otr/build/dep/crypto"),
"emojione": path.resolve(__dirname, "node_modules/emojione/lib/js/emojione"),
"es6-promise": path.resolve(__dirname, "node_modules/es6-promise/dist/es6-promise.auto"),
"filesize": path.resolve(__dirname, "node_modules/filesize/lib/filesize"),
"form-utils": path.resolve(__dirname, "src/utils/form"),
"i18n": path.resolve(__dirname, "src/i18n"),
"jed": path.resolve(__dirname, "node_modules/jed/jed"),
"jquery": path.resolve(__dirname, "src/jquery-stub"),
"lodash": path.resolve(__dirname, "node_modules/lodash/lodash"),
"lodash.converter": path.resolve(__dirname, "3rdparty/lodash.fp"),
"lodash.fp": path.resolve(__dirname, "src/lodash.fp"),
"lodash.noconflict": path.resolve(__dirname, "src/lodash.noconflict"),
"message-utils": path.resolve(__dirname, "src/utils/message"),
"muc-utils": path.resolve(__dirname, "src/utils/muc"),
"pluggable": path.resolve(__dirname, "node_modules/pluggable.js/dist/pluggable"),
"polyfill": path.resolve(__dirname, "src/polyfill"),
"punycode": path.resolve(__dirname, "node_modules/urijs/src/punycode"),
"sizzle": path.resolve(__dirname, "node_modules/sizzle/dist/sizzle"),
"snabbdom": path.resolve(__dirname, "node_modules/snabbdom/dist/snabbdom"),
"snabbdom-attributes": path.resolve(__dirname, "node_modules/snabbdom/dist/snabbdom-attributes"),
"snabbdom-class": path.resolve(__dirname, "node_modules/snabbdom/dist/snabbdom-class"),
"snabbdom-dataset": path.resolve(__dirname, "node_modules/snabbdom/dist/snabbdom-dataset"),
"snabbdom-eventlisteners": path.resolve(__dirname, "node_modules/snabbdom/dist/snabbdom-eventlisteners"),
"snabbdom-props": path.resolve(__dirname, "node_modules/snabbdom/dist/snabbdom-props"),
"snabbdom-style": path.resolve(__dirname, "node_modules/snabbdom/dist/snabbdom-style"),
"strophe": path.resolve(__dirname, "node_modules/strophe.js/strophe"),
"strophe.ping": path.resolve(__dirname, "node_modules/strophejs-plugin-ping/strophe.ping"),
"strophe.rsm": path.resolve(__dirname, "node_modules/strophejs-plugin-rsm/strophe.rsm"),
"tovnode": path.resolve(__dirname, "node_modules/snabbdom/dist/tovnode"),
"underscore": path.resolve(__dirname, "src/underscore-shim"),
"uri": path.resolve(__dirname, "node_modules/urijs/src/URI"),
"utils": path.resolve(__dirname, "src/utils/core"),
"vdom-parser": path.resolve(__dirname, "node_modules/vdom-parser/dist"),
"xss": path.resolve(__dirname, "node_modules/xss/dist/xss"),
"xss.noconflict": path.resolve(__dirname, "node_modules/xss.noconflict"),
"converse-bookmarks": path.resolve(__dirname, "src/converse-bookmarks"),
"converse-chatboxes": path.resolve(__dirname, "src/converse-chatboxes"),
"converse-caps": path.resolve(__dirname, "src/converse-caps"),
"converse-chatview": path.resolve(__dirname, "src/converse-chatview"),
"converse-controlbox": path.resolve(__dirname, "src/converse-controlbox"),
"converse-core": path.resolve(__dirname, "src/converse-core"),
"converse-disco": path.resolve(__dirname, "src/converse-disco"),
"converse-dragresize": path.resolve(__dirname, "src/converse-dragresize"),
"converse-embedded": path.resolve(__dirname, "src/converse-embedded"),
"converse-fullscreen": path.resolve(__dirname, "src/converse-fullscreen"),
"converse-headline": path.resolve(__dirname, "src/converse-headline"),
"converse-mam": path.resolve(__dirname, "src/converse-mam"),
"converse-message-view": path.resolve(__dirname, "src/converse-message-view"),
"converse-minimize": path.resolve(__dirname, "src/converse-minimize"),
"converse-modal": path.resolve(__dirname, "src/converse-modal"),
"converse-muc": path.resolve(__dirname, "src/converse-muc"),
"converse-muc-views": path.resolve(__dirname, "src/converse-muc-views"),
"converse-notification": path.resolve(__dirname, "src/converse-notification"),
"converse-ping": path.resolve(__dirname, "src/converse-ping"),
"converse-profile": path.resolve(__dirname, "src/converse-profile"),
"converse-register": path.resolve(__dirname, "src/converse-register"),
"converse-roomslist": path.resolve(__dirname, "src/converse-roomslist"),
"converse-roster": path.resolve(__dirname, "src/converse-roster"),
"converse-rosterview": path.resolve(__dirname, "src/converse-rosterview"),
"converse-singleton": path.resolve(__dirname, "src/converse-singleton"),
"converse-vcard": path.resolve(__dirname, "src/converse-vcard")
}
}
}
module.exports = config;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment