diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 00000000..4c79f68b
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,10 @@
+# Change Log
+
+All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+
+
+## [1.3.0](https://github.com/imgix/imgix-core-js/compare/1.2.1...1.3.0) (2019-05-07)
+
+* deprecate domain sharding ([#39](https://github.com/imgix/imgix-core-js/pull/39))
+
diff --git a/bower.json b/bower.json
index bf230b4b..289afdf1 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "imgix-core-js",
- "version": "1.2.1",
+ "version": "1.3.0",
"homepage": "https://github.com/imgix/imgix-core-js",
"authors": [
"Kelly Sutton ",
diff --git a/dist/imgix-core-js.js b/dist/imgix-core-js.js
index 93cb6c47..b5f99954 100644
--- a/dist/imgix-core-js.js
+++ b/dist/imgix-core-js.js
@@ -14,7 +14,7 @@
var Base64 = _jsBase64.Base64 || _jsBase64;
var crc = _crc;
- var VERSION = '1.2.1';
+ var VERSION = '1.3.0';
var SHARD_STRATEGY_CRC = 'crc';
var SHARD_STRATEGY_CYCLE = 'cycle';
var DOMAIN_REGEX = /^(?:[a-z\d\-_]{1,62}\.){0,125}(?:[a-z\d](?:\-(?=\-*[a-z\d])|[a-z]|\d){0,62}\.)[a-z\d]{1,63}$/i;
@@ -46,6 +46,9 @@
if (!Array.isArray(this.settings.domains)) {
this.settings.domains = [this.settings.domains];
}
+ else {
+ console.warn("Warning: Domain sharding has been deprecated and will be removed in the next major version.");
+ }
if (!this.settings.host && this.settings.domains.length === 0) {
throw new Error('ImgixClient must be passed valid domain(s)');
diff --git a/dist/imgix-core-js.min.js b/dist/imgix-core-js.min.js
index 89cb4873..8beeb300 100644
--- a/dist/imgix-core-js.min.js
+++ b/dist/imgix-core-js.min.js
@@ -1 +1 @@
-(function(global,factory){if(typeof define==="function"&&define.amd){define("Imgix",["exports","md5","js-base64","crc"],factory)}else if(typeof exports!=="undefined"){module.exports=factory(exports,require("md5"),require("js-base64").Base64,require("crc"))}else{var mod={exports:{}};global.ImgixClient=factory(mod.exports,global.md5,global.Base64,global.crc)}})(this,function(exports,_md5,_jsBase64,_crc){var md5=_md5;var Base64=_jsBase64.Base64||_jsBase64;var crc=_crc;var VERSION="1.2.1";var SHARD_STRATEGY_CRC="crc";var SHARD_STRATEGY_CYCLE="cycle";var DOMAIN_REGEX=/^(?:[a-z\d\-_]{1,62}\.){0,125}(?:[a-z\d](?:\-(?=\-*[a-z\d])|[a-z]|\d){0,62}\.)[a-z\d]{1,63}$/i;var DEFAULTS={host:null,domains:[],useHTTPS:true,includeLibraryParam:true,shard_strategy:SHARD_STRATEGY_CRC};var ImgixClient=function(){function ImgixClient(opts){var key,val;this.settings={};this._shard_next_index=0;for(key in DEFAULTS){val=DEFAULTS[key];this.settings[key]=val}for(key in opts){val=opts[key];this.settings[key]=val}if(!Array.isArray(this.settings.domains)){this.settings.domains=[this.settings.domains]}if(!this.settings.host&&this.settings.domains.length===0){throw new Error("ImgixClient must be passed valid domain(s)")}if(this.settings.shard_strategy!==SHARD_STRATEGY_CRC&&this.settings.shard_strategy!==SHARD_STRATEGY_CYCLE){throw new Error("Shard strategy must be one of "+SHARD_STRATEGY_CRC+" or "+SHARD_STRATEGY_CYCLE)}if(this.settings.host){console.warn("'host' argument is deprecated; use 'domains' instead.");if(this.settings.domains.length==0)this.settings.domains[0]=this.settings.host}this.settings.domains.forEach(function(domain){if(DOMAIN_REGEX.exec(domain)==null){throw new Error("Domains must be passed in as fully-qualified "+"domain names and should not include a protocol or any path "+'element, i.e. "example.imgix.net".')}});if(this.settings.includeLibraryParam){this.settings.libraryParam="js-"+VERSION}this.settings.urlPrefix=this.settings.useHTTPS?"https://":"http://"}ImgixClient.prototype.buildURL=function(path,params){path=this._sanitizePath(path);if(params==null){params={}}var queryParams=this._buildParams(params);if(!!this.settings.secureURLToken){queryParams=this._signParams(path,queryParams)}return this.settings.urlPrefix+this._getDomain(path)+path+queryParams};ImgixClient.prototype._getDomain=function(path){if(this.settings.shard_strategy===SHARD_STRATEGY_CYCLE){var domain=this.settings.domains[this._shard_next_index];this._shard_next_index=(this._shard_next_index+1)%this.settings.domains.length;return domain}else if(this.settings.shard_strategy===SHARD_STRATEGY_CRC){return this.settings.domains[crc.crc32(path)%this.settings.domains.length]}};ImgixClient.prototype._sanitizePath=function(path){path=path.replace(/^\//,"");if(/^https?:\/\//.test(path)){path=encodeURIComponent(path)}else{path=encodeURI(path)}return"/"+path};ImgixClient.prototype._buildParams=function(params){if(this.settings.libraryParam){params.ixlib=this.settings.libraryParam}var queryParams=[];var key,val,encodedKey,encodedVal;for(key in params){val=params[key];encodedKey=encodeURIComponent(key);encodedVal;if(key.substr(-2)==="64"){encodedVal=Base64.encodeURI(val)}else{encodedVal=encodeURIComponent(val)}queryParams.push(encodedKey+"="+encodedVal)}if(queryParams[0]){queryParams[0]="?"+queryParams[0]}return queryParams.join("&")};ImgixClient.prototype._signParams=function(path,queryParams){var signatureBase=this.settings.secureURLToken+path+queryParams;var signature=md5(signatureBase);if(queryParams.length>0){return queryParams=queryParams+"&s="+signature}else{return queryParams="?s="+signature}};ImgixClient.VERSION=VERSION;ImgixClient.SHARD_STRATEGY_CRC=SHARD_STRATEGY_CRC;ImgixClient.SHARD_STRATEGY_CYCLE=SHARD_STRATEGY_CYCLE;return ImgixClient}();return ImgixClient});
\ No newline at end of file
+(function(global,factory){if(typeof define==="function"&&define.amd){define("Imgix",["exports","md5","js-base64","crc"],factory)}else if(typeof exports!=="undefined"){module.exports=factory(exports,require("md5"),require("js-base64").Base64,require("crc"))}else{var mod={exports:{}};global.ImgixClient=factory(mod.exports,global.md5,global.Base64,global.crc)}})(this,function(exports,_md5,_jsBase64,_crc){var md5=_md5;var Base64=_jsBase64.Base64||_jsBase64;var crc=_crc;var VERSION="1.3.0";var SHARD_STRATEGY_CRC="crc";var SHARD_STRATEGY_CYCLE="cycle";var DOMAIN_REGEX=/^(?:[a-z\d\-_]{1,62}\.){0,125}(?:[a-z\d](?:\-(?=\-*[a-z\d])|[a-z]|\d){0,62}\.)[a-z\d]{1,63}$/i;var DEFAULTS={host:null,domains:[],useHTTPS:true,includeLibraryParam:true,shard_strategy:SHARD_STRATEGY_CRC};var ImgixClient=function(){function ImgixClient(opts){var key,val;this.settings={};this._shard_next_index=0;for(key in DEFAULTS){val=DEFAULTS[key];this.settings[key]=val}for(key in opts){val=opts[key];this.settings[key]=val}if(!Array.isArray(this.settings.domains)){this.settings.domains=[this.settings.domains]}else{console.warn("Warning: Domain sharding has been deprecated and will be removed in the next major version.")}if(!this.settings.host&&this.settings.domains.length===0){throw new Error("ImgixClient must be passed valid domain(s)")}if(this.settings.shard_strategy!==SHARD_STRATEGY_CRC&&this.settings.shard_strategy!==SHARD_STRATEGY_CYCLE){throw new Error("Shard strategy must be one of "+SHARD_STRATEGY_CRC+" or "+SHARD_STRATEGY_CYCLE)}if(this.settings.host){console.warn("'host' argument is deprecated; use 'domains' instead.");if(this.settings.domains.length==0)this.settings.domains[0]=this.settings.host}this.settings.domains.forEach(function(domain){if(DOMAIN_REGEX.exec(domain)==null){throw new Error("Domains must be passed in as fully-qualified "+"domain names and should not include a protocol or any path "+'element, i.e. "example.imgix.net".')}});if(this.settings.includeLibraryParam){this.settings.libraryParam="js-"+VERSION}this.settings.urlPrefix=this.settings.useHTTPS?"https://":"http://"}ImgixClient.prototype.buildURL=function(path,params){path=this._sanitizePath(path);if(params==null){params={}}var queryParams=this._buildParams(params);if(!!this.settings.secureURLToken){queryParams=this._signParams(path,queryParams)}return this.settings.urlPrefix+this._getDomain(path)+path+queryParams};ImgixClient.prototype._getDomain=function(path){if(this.settings.shard_strategy===SHARD_STRATEGY_CYCLE){var domain=this.settings.domains[this._shard_next_index];this._shard_next_index=(this._shard_next_index+1)%this.settings.domains.length;return domain}else if(this.settings.shard_strategy===SHARD_STRATEGY_CRC){return this.settings.domains[crc.crc32(path)%this.settings.domains.length]}};ImgixClient.prototype._sanitizePath=function(path){path=path.replace(/^\//,"");if(/^https?:\/\//.test(path)){path=encodeURIComponent(path)}else{path=encodeURI(path)}return"/"+path};ImgixClient.prototype._buildParams=function(params){if(this.settings.libraryParam){params.ixlib=this.settings.libraryParam}var queryParams=[];var key,val,encodedKey,encodedVal;for(key in params){val=params[key];encodedKey=encodeURIComponent(key);encodedVal;if(key.substr(-2)==="64"){encodedVal=Base64.encodeURI(val)}else{encodedVal=encodeURIComponent(val)}queryParams.push(encodedKey+"="+encodedVal)}if(queryParams[0]){queryParams[0]="?"+queryParams[0]}return queryParams.join("&")};ImgixClient.prototype._signParams=function(path,queryParams){var signatureBase=this.settings.secureURLToken+path+queryParams;var signature=md5(signatureBase);if(queryParams.length>0){return queryParams=queryParams+"&s="+signature}else{return queryParams="?s="+signature}};ImgixClient.VERSION=VERSION;ImgixClient.SHARD_STRATEGY_CRC=SHARD_STRATEGY_CRC;ImgixClient.SHARD_STRATEGY_CYCLE=SHARD_STRATEGY_CYCLE;return ImgixClient}();return ImgixClient});
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index f789b643..e5e983af 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "imgix-core-js",
- "version": "1.2.1",
+ "version": "1.3.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index e5585a52..8503ac70 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "imgix-core-js",
"description": "Common boilerplate for all imgix JavaScript-based functionality.",
- "version": "1.2.1",
+ "version": "1.3.0",
"repository": "https://github.com/imgix/imgix-core-js",
"scripts": {
"assert_version": "node assert_version.js",
diff --git a/src/imgix-core-js.js b/src/imgix-core-js.js
index c6af3c41..b5f99954 100644
--- a/src/imgix-core-js.js
+++ b/src/imgix-core-js.js
@@ -14,7 +14,7 @@
var Base64 = _jsBase64.Base64 || _jsBase64;
var crc = _crc;
- var VERSION = '1.2.1';
+ var VERSION = '1.3.0';
var SHARD_STRATEGY_CRC = 'crc';
var SHARD_STRATEGY_CYCLE = 'cycle';
var DOMAIN_REGEX = /^(?:[a-z\d\-_]{1,62}\.){0,125}(?:[a-z\d](?:\-(?=\-*[a-z\d])|[a-z]|\d){0,62}\.)[a-z\d]{1,63}$/i;