From 911fcd38315a18f8845c6e2624c8567ae171998b Mon Sep 17 00:00:00 2001 From: Rafid Aslam Date: Sun, 8 Jan 2017 13:43:10 +0700 Subject: [PATCH] deps: Upgrade and move `codepointat` from `static/third` to `npm` - Remove `codepointat` from `static/third` and fetch it from `npm`. - Upgrade `codepointat` to 0.2.0. - Bump up the `PROVISION_VERSION` to 4.1. Part of #1709. --- docs/THIRDPARTY | 4 -- frontend_tests/zjsunit/index.js | 2 +- package.json | 1 + .../codepointat.js | 45 ------------------- version.py | 2 +- zproject/settings.py | 2 +- 6 files changed, 4 insertions(+), 52 deletions(-) delete mode 100644 static/third/string-prototype-codepointat/codepointat.js diff --git a/docs/THIRDPARTY b/docs/THIRDPARTY index 6ea75dc6f4..d747470958 100644 --- a/docs/THIRDPARTY +++ b/docs/THIRDPARTY @@ -170,10 +170,6 @@ Files: static/third/marked/* Copyright: 2011-2013, Christopher Jeffrey License: Expat -Files: static/third/string-prototype-codepointat/* -Copyright: 2014 Mathias Bynens -License: Expat - Files: static/third/sockjs/sockjs-0.3.4.js Copyright: 2011-2012 VMware, Inc. 2012 Douglas Crockford diff --git a/frontend_tests/zjsunit/index.js b/frontend_tests/zjsunit/index.js index 5f4dc687ab..47aa4cf1ef 100644 --- a/frontend_tests/zjsunit/index.js +++ b/frontend_tests/zjsunit/index.js @@ -1,5 +1,5 @@ global.assert = require('assert'); -require('third/string-prototype-codepointat/codepointat.js'); +require('node_modules/string.prototype.codepointat/codepointat.js'); global.Dict = require('js/dict'); global._ = require('third/underscore/underscore.js'); diff --git a/package.json b/package.json index 589e1000a1..4ed6639e88 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "jquery": "1.12.1", "jquery-validation": "1.15.1", "plotly.js": "1.19.2", + "string.prototype.codepointat": "0.2.0", "webpack": "1.12.2", "winchan": "0.2.0", "zxcvbn": "4.4.1" diff --git a/static/third/string-prototype-codepointat/codepointat.js b/static/third/string-prototype-codepointat/codepointat.js deleted file mode 100644 index 55d7f05921..0000000000 --- a/static/third/string-prototype-codepointat/codepointat.js +++ /dev/null @@ -1,45 +0,0 @@ -/*! http://mths.be/codepointat v0.1.0 by @mathias */ -if (!String.prototype.codePointAt) { - (function () { - 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` - var codePointAt = function (position) { - if (this === null) { - throw TypeError(); - } - var string = String(this); - var size = string.length; - // `ToInteger` - var index = position ? Number(position) : 0; - if (isNaN(index)) { - index = 0; - } - // Account for out-of-bounds indices: - if (index < 0 || index >= size) { - return undefined; - } - // Get the first code unit - var first = string.charCodeAt(index); - var second; - if ( // check if it’s the start of a surrogate pair - first >= 0xD800 && first <= 0xDBFF && // high surrogate - size > index + 1 // there is a next code unit - ) { - second = string.charCodeAt(index + 1); - if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate - // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; - } - } - return first; - }; - if (Object.defineProperty) { - Object.defineProperty(String.prototype, 'codePointAt', { - 'value': codePointAt, - 'configurable': true, - 'writable': true - }); - } else { - String.prototype.codePointAt = codePointAt; - } - }()); -} diff --git a/version.py b/version.py index b4415a6a45..c3e666fb10 100644 --- a/version.py +++ b/version.py @@ -1,2 +1,2 @@ ZULIP_VERSION = "1.4.1+git" -PROVISION_VERSION = '4.0' +PROVISION_VERSION = '4.1' diff --git a/zproject/settings.py b/zproject/settings.py index 194c1ca7b3..d6a42dc26f 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -767,8 +767,8 @@ JS_SPECS = { 'third/jquery-perfect-scrollbar/js/perfect-scrollbar.js', 'third/lazyload/lazyload.js', 'third/spectrum/spectrum.js', - 'third/string-prototype-codepointat/codepointat.js', 'third/sockjs/sockjs-0.3.4.js', + 'node_modules/string.prototype.codepointat/codepointat.js', 'node_modules/winchan/winchan.js', 'third/handlebars/handlebars.runtime.js', 'third/marked/lib/marked.js',