Skip to content

Commit

Permalink
Remove global lodash
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbrand committed Dec 29, 2020
1 parent c1847a0 commit 9a2ded5
Show file tree
Hide file tree
Showing 32 changed files with 280 additions and 342 deletions.
220 changes: 0 additions & 220 deletions images/icons.svg

This file was deleted.

1 change: 1 addition & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = function(config) {
{ pattern: 'dist/*.css.map', included: false },
{ pattern: "dist/icons.js", served: true },
{ pattern: "dist/emojis.js", served: true },
"node_modules/lodash/lodash.min.js",
"dist/converse.js",
"dist/converse.css",
{ pattern: "dist/images/**/*.*", included: false },
Expand Down
54 changes: 22 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/preset-env": "^7.12.7",
"@converse/headless": "file:src/headless",
"@converse/skeletor": "conversejs/skeletor#56a284bd36a07977d69c08d78e7c8c0fc9fc5c87",
"@fortawesome/fontawesome-free": "5.14.0",
"autoprefixer": "^9.8.6",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"babel-plugin-lodash": "^3.3.4",
"bootstrap": "^4.3.1",
"bootstrap.native": "^2.0.27",
"bootstrap.native-loader": "2.0.0",
Expand Down Expand Up @@ -105,7 +107,6 @@
"lerna": "^3.22.1",
"lit-element": "^2.4.0",
"lit-html": "^1.2.1",
"lodash-template-webpack-loader": "jcbrand/lodash-template-webpack-loader",
"mini-css-extract-plugin": "^0.9.0",
"minimist": "^1.2.3",
"node-sass": "^4.14.1",
Expand Down
4 changes: 2 additions & 2 deletions spec/bookmarks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global mock, converse */
/* global mock, converse, _ */

const { Strophe, u, sizzle, $iq } = converse.env;

Expand Down Expand Up @@ -136,7 +136,7 @@ describe("A chat room", function () {
['rosterGroupsFetched'], {},
async function (done, _converse) {

const { u, _ } = converse.env;
const { u } = converse.env;
await mock.waitUntilDiscoConfirmed(
_converse, _converse.bare_jid,
[{'category': 'pubsub', 'type': 'pep'}],
Expand Down
3 changes: 1 addition & 2 deletions spec/chatbox.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*global mock, converse */
/*global mock, converse, _ */

const _ = converse.env._;
const $msg = converse.env.$msg;
const Strophe = converse.env.Strophe;
const u = converse.env.utils;
Expand Down
3 changes: 1 addition & 2 deletions spec/controlbox.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*global mock, converse */
/*global mock, converse, _ */

const _ = converse.env._;
const $msg = converse.env.$msg;
const u = converse.env.utils;
const Strophe = converse.env.Strophe;
Expand Down
4 changes: 2 additions & 2 deletions spec/headline.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*global mock */
/*global mock, converse, _ */

describe("A headlines box", function () {

Expand Down Expand Up @@ -147,7 +147,7 @@ describe("A headlines box", function () {
mock.initConverse(
['rosterGroupsFetched', 'chatBoxesFetched'], {}, function (done, _converse) {

const { $msg, _ } = converse.env;
const { $msg } = converse.env;
_converse.allow_non_roster_messaging = false;
const stanza = $msg({
'type': 'headline',
Expand Down
3 changes: 1 addition & 2 deletions spec/http-file-upload.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/*global mock, converse */
/*global mock, converse, _ */

const Strophe = converse.env.Strophe;
const $iq = converse.env.$iq;
const _ = converse.env._;
const sizzle = converse.env.sizzle;
const u = converse.env.utils;

Expand Down
4 changes: 2 additions & 2 deletions spec/messages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*global mock, converse */
/*global mock, converse, _ */

const { Promise, Strophe, $msg, dayjs, sizzle, _ } = converse.env;
const { Promise, Strophe, $msg, dayjs, sizzle } = converse.env;
const u = converse.env.utils;


Expand Down
3 changes: 1 addition & 2 deletions spec/modtools.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*global mock, converse */
/*global mock, converse, _ */

const _ = converse.env._;
const $iq = converse.env.$iq;
const $pres = converse.env.$pres;
const sizzle = converse.env.sizzle;
Expand Down
3 changes: 1 addition & 2 deletions spec/muc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*global mock, converse */
/*global mock, converse, _ */

const _ = converse.env._;
const $pres = converse.env.$pres;
const $iq = converse.env.$iq;
const $msg = converse.env.$msg;
Expand Down
4 changes: 2 additions & 2 deletions spec/notification.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*global mock, converse */
/*global mock, converse, _ */

const { Strophe, _ } = converse.env;
const { Strophe } = converse.env;
const $msg = converse.env.$msg;
const u = converse.env.utils;

Expand Down
4 changes: 2 additions & 2 deletions spec/omemo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*global mock, converse */
/*global mock, converse, _ */

const { $iq, $pres, $msg, _, omemo, Strophe } = converse.env;
const { $iq, $pres, $msg, omemo, Strophe } = converse.env;
const u = converse.env.utils;

async function deviceListFetched (_converse, jid) {
Expand Down
3 changes: 1 addition & 2 deletions spec/push.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/*global mock */
/*global mock, converse, _ */

const $iq = converse.env.$iq;
const Strophe = converse.env.Strophe;
const _ = converse.env._;
const sizzle = converse.env.sizzle;
const u = converse.env.utils;
const original_timeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
Expand Down
4 changes: 2 additions & 2 deletions spec/receipts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*global mock, converse */
/*global mock, converse, _ */

const { Promise, Strophe, $msg, sizzle, _ } = converse.env;
const { Promise, Strophe, $msg, sizzle } = converse.env;
const u = converse.env.utils;


Expand Down
4 changes: 2 additions & 2 deletions spec/register.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*global mock, converse */
/*global mock, converse, _ */

const Strophe = converse.env.Strophe;
const $iq = converse.env.$iq;
const { _, sizzle} = converse.env;
const { sizzle} = converse.env;
const u = converse.env.utils;

describe("The Registration Panel", function () {
Expand Down
5 changes: 2 additions & 3 deletions spec/room_registration.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*global mock */
/*global mock, converse, _ */

const _ = converse.env._,
$iq = converse.env.$iq,
const $iq = converse.env.$iq,
Strophe = converse.env.Strophe,
sizzle = converse.env.sizzle,
u = converse.env.utils;
Expand Down
3 changes: 1 addition & 2 deletions spec/roster.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/*global mock, converse */
/*global mock, converse, _ */

const $iq = converse.env.$iq;
const $pres = converse.env.$pres;
const Strophe = converse.env.Strophe;
const _ = converse.env._;
const sizzle = converse.env.sizzle;
const u = converse.env.utils;

Expand Down
2 changes: 1 addition & 1 deletion src/components/emoji-picker.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import "./emoji-picker-content.js";
import DOMNavigator from "../shared/dom-navigator";
import debounce from 'lodash/debounce';
import { BaseDropdown } from "./dropdown.js";
import { CustomElement } from './element.js';
import { __ } from '../i18n';
import { _converse, api, converse } from "@converse/headless/core";
import { debounce } from "lodash-es";
import { html } from "lit-element";
import { tpl_emoji_picker } from "../templates/emoji_picker.js";
import { until } from 'lit-html/directives/until.js';
Expand Down
14 changes: 2 additions & 12 deletions src/components/font-awesome.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
import { CustomElement } from './element.js';
import { html } from "lit-element";
import { unsafeSVG } from 'lit-html/directives/unsafe-svg.js';
import { until } from 'lit-html/directives/until.js';

import tpl_icons from 'templates/icons.js';

export class FontAwesome extends CustomElement {

constructor () {
super();
const promise = import(/*webpackChunkName: "icons" */ '../../images/icons.svg');
this.data = promise.then(d => html`${unsafeSVG(d.default())}`);
}

render () { // eslint-disable-line class-methods-use-this
return html`${until(this.data, '')}`;
return tpl_icons();
}
}

Expand Down
16 changes: 0 additions & 16 deletions src/converse.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @license Mozilla Public License (MPLv2)
*/

import _ from './lodash.noconflict';

import "@converse/headless/headless";
import "i18n";
import "shared/registry.js";
Expand Down Expand Up @@ -60,20 +58,6 @@ const WHITELISTED_PLUGINS = [
'converse-singleton'
];

// Use Mustache style syntax for variable interpolation
/* Configuration of Lodash templates (this config is distinct to the
* config of requirejs-tpl in main.js). This one is for normal inline templates.
*/
_.templateSettings = {
'escape': /\{\{\{([\s\S]+?)\}\}\}/g,
'evaluate': /\{\[([\s\S]+?)\]\}/g,
'interpolate': /\{\{([\s\S]+?)\}\}/g,
'imports': { '_': _ }
};

converse.env._ = _;


const initialize = converse.initialize;

converse.initialize = function (settings, callback) {
Expand Down
3 changes: 2 additions & 1 deletion src/headless/shared/connection.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import debounce from 'lodash/debounce';
import isElement from 'lodash/isElement';
import log from "../log.js";
import sizzle from 'sizzle';
import u from '@converse/headless/utils/core';
import { Strophe } from 'strophe.js/src/core';
import { _converse, api, clearSession, tearDown } from "../core.js";
import { debounce, isElement } from 'lodash';


const BOSH_WAIT = 59;
Expand Down
2 changes: 1 addition & 1 deletion src/headless/shared/rsm.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Copyright 2006-2017 Strophe (https://github.com/strophe/strophejs)
*/
import { _converse, converse } from "../core.js";
import { pick } from 'lodash-es'
import pick from 'lodash/pick';

const { Strophe, $build } = converse.env;

Expand Down
3 changes: 0 additions & 3 deletions src/lodash.noconflict.js

This file was deleted.

2 changes: 0 additions & 2 deletions src/templates/chatroom_bookmark_toggle.html

This file was deleted.

3 changes: 0 additions & 3 deletions src/templates/chatroom_dragresize.html

This file was deleted.

Loading

0 comments on commit 9a2ded5

Please sign in to comment.