slate-plain-serializer
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -10,2 +10,12 @@ | ||
### `0.4.0` — October 27, 2017 | ||
###### BREAKING | ||
- **Remove all previously deprecated code paths.** This helps to reduce some of the complexity in Slate by not having to handle these code paths anymore. And it helps to reduce file size. When upgrading, it's _highly_ recommended that you upgrade to the previous version first and ensure there are no deprecation warnings being logged, then upgrade to this version. | ||
--- | ||
### `0.3.0` — October 27, 2017 | ||
@@ -12,0 +22,0 @@ |
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.SlatePlainSerializer = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
// shim for using process in browser | ||
var process = module.exports = {}; | ||
// cached from whatever global is present so that test runners that stub it | ||
// don't break things. But we need to wrap it in a try catch in case it is | ||
// wrapped in strict mode code which doesn't define any globals. It's inside a | ||
// function because try/catches deoptimize in certain engines. | ||
var cachedSetTimeout; | ||
var cachedClearTimeout; | ||
function defaultSetTimout() { | ||
throw new Error('setTimeout has not been defined'); | ||
} | ||
function defaultClearTimeout () { | ||
throw new Error('clearTimeout has not been defined'); | ||
} | ||
(function () { | ||
try { | ||
if (typeof setTimeout === 'function') { | ||
cachedSetTimeout = setTimeout; | ||
} else { | ||
cachedSetTimeout = defaultSetTimout; | ||
} | ||
} catch (e) { | ||
cachedSetTimeout = defaultSetTimout; | ||
} | ||
try { | ||
if (typeof clearTimeout === 'function') { | ||
cachedClearTimeout = clearTimeout; | ||
} else { | ||
cachedClearTimeout = defaultClearTimeout; | ||
} | ||
} catch (e) { | ||
cachedClearTimeout = defaultClearTimeout; | ||
} | ||
} ()) | ||
function runTimeout(fun) { | ||
if (cachedSetTimeout === setTimeout) { | ||
//normal enviroments in sane situations | ||
return setTimeout(fun, 0); | ||
} | ||
// if setTimeout wasn't available but was latter defined | ||
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { | ||
cachedSetTimeout = setTimeout; | ||
return setTimeout(fun, 0); | ||
} | ||
try { | ||
// when when somebody has screwed with setTimeout but no I.E. maddness | ||
return cachedSetTimeout(fun, 0); | ||
} catch(e){ | ||
try { | ||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
return cachedSetTimeout.call(null, fun, 0); | ||
} catch(e){ | ||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error | ||
return cachedSetTimeout.call(this, fun, 0); | ||
} | ||
} | ||
} | ||
function runClearTimeout(marker) { | ||
if (cachedClearTimeout === clearTimeout) { | ||
//normal enviroments in sane situations | ||
return clearTimeout(marker); | ||
} | ||
// if clearTimeout wasn't available but was latter defined | ||
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { | ||
cachedClearTimeout = clearTimeout; | ||
return clearTimeout(marker); | ||
} | ||
try { | ||
// when when somebody has screwed with setTimeout but no I.E. maddness | ||
return cachedClearTimeout(marker); | ||
} catch (e){ | ||
try { | ||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
return cachedClearTimeout.call(null, marker); | ||
} catch (e){ | ||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. | ||
// Some versions of I.E. have different rules for clearTimeout vs setTimeout | ||
return cachedClearTimeout.call(this, marker); | ||
} | ||
} | ||
} | ||
var queue = []; | ||
var draining = false; | ||
var currentQueue; | ||
var queueIndex = -1; | ||
function cleanUpNextTick() { | ||
if (!draining || !currentQueue) { | ||
return; | ||
} | ||
draining = false; | ||
if (currentQueue.length) { | ||
queue = currentQueue.concat(queue); | ||
} else { | ||
queueIndex = -1; | ||
} | ||
if (queue.length) { | ||
drainQueue(); | ||
} | ||
} | ||
function drainQueue() { | ||
if (draining) { | ||
return; | ||
} | ||
var timeout = runTimeout(cleanUpNextTick); | ||
draining = true; | ||
var len = queue.length; | ||
while(len) { | ||
currentQueue = queue; | ||
queue = []; | ||
while (++queueIndex < len) { | ||
if (currentQueue) { | ||
currentQueue[queueIndex].run(); | ||
} | ||
} | ||
queueIndex = -1; | ||
len = queue.length; | ||
} | ||
currentQueue = null; | ||
draining = false; | ||
runClearTimeout(timeout); | ||
} | ||
process.nextTick = function (fun) { | ||
var args = new Array(arguments.length - 1); | ||
if (arguments.length > 1) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
args[i - 1] = arguments[i]; | ||
} | ||
} | ||
queue.push(new Item(fun, args)); | ||
if (queue.length === 1 && !draining) { | ||
runTimeout(drainQueue); | ||
} | ||
}; | ||
// v8 likes predictible objects | ||
function Item(fun, array) { | ||
this.fun = fun; | ||
this.array = array; | ||
} | ||
Item.prototype.run = function () { | ||
this.fun.apply(null, this.array); | ||
}; | ||
process.title = 'browser'; | ||
process.browser = true; | ||
process.env = {}; | ||
process.argv = []; | ||
process.version = ''; // empty string to avoid regexp issues | ||
process.versions = {}; | ||
function noop() {} | ||
process.on = noop; | ||
process.addListener = noop; | ||
process.once = noop; | ||
process.off = noop; | ||
process.removeListener = noop; | ||
process.removeAllListeners = noop; | ||
process.emit = noop; | ||
process.binding = function (name) { | ||
throw new Error('process.binding is not supported'); | ||
}; | ||
process.cwd = function () { return '/' }; | ||
process.chdir = function (dir) { | ||
throw new Error('process.chdir is not supported'); | ||
}; | ||
process.umask = function() { return 0; }; | ||
},{}],2:[function(require,module,exports){ | ||
(function (process){ | ||
'use strict'; | ||
@@ -190,120 +7,5 @@ | ||
}); | ||
/* eslint-disable no-console */ | ||
/** | ||
* Is in development? | ||
* | ||
* @type {Boolean} | ||
*/ | ||
var IS_DEV = typeof process !== 'undefined' && process.env && process.env.NODE_ENV !== 'production'; | ||
/** | ||
* Has console? | ||
* | ||
* @type {Boolean} | ||
*/ | ||
var HAS_CONSOLE = typeof console != 'undefined' && typeof console.log == 'function' && typeof console.warn == 'function' && typeof console.error == 'function'; | ||
/** | ||
* Log a `message` at `level`. | ||
* | ||
* @param {String} level | ||
* @param {String} message | ||
* @param {Any} ...args | ||
*/ | ||
function log(level, message) { | ||
if (!IS_DEV) { | ||
return; | ||
} | ||
if (HAS_CONSOLE) { | ||
var _console; | ||
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
args[_key - 2] = arguments[_key]; | ||
} | ||
(_console = console)[level].apply(_console, [message].concat(args)); | ||
} | ||
} | ||
/** | ||
* Log an error `message`. | ||
* | ||
* @param {String} message | ||
* @param {Any} ...args | ||
*/ | ||
function error(message) { | ||
if (HAS_CONSOLE) { | ||
var _console2; | ||
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { | ||
args[_key2 - 1] = arguments[_key2]; | ||
} | ||
(_console2 = console).error.apply(_console2, [message].concat(args)); | ||
} | ||
} | ||
/** | ||
* Log a warning `message` in development only. | ||
* | ||
* @param {String} message | ||
* @param {Any} ...args | ||
*/ | ||
function warn(message) { | ||
for (var _len3 = arguments.length, args = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { | ||
args[_key3 - 1] = arguments[_key3]; | ||
} | ||
log.apply(undefined, ['warn', 'Warning: ' + message].concat(args)); | ||
} | ||
/** | ||
* Log a deprecation warning `message`, with helpful `version` number in | ||
* development only. | ||
* | ||
* @param {String} version | ||
* @param {String} message | ||
* @param {Any} ...args | ||
*/ | ||
function deprecate(version, message) { | ||
for (var _len4 = arguments.length, args = Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) { | ||
args[_key4 - 2] = arguments[_key4]; | ||
} | ||
log.apply(undefined, ['warn', 'Deprecation (' + version + '): ' + message].concat(args)); | ||
} | ||
/** | ||
* Export. | ||
* | ||
* @type {Function} | ||
*/ | ||
exports.default = { | ||
deprecate: deprecate, | ||
error: error, | ||
warn: warn | ||
}; | ||
}).call(this,require('_process')) | ||
},{"_process":1}],3:[function(require,module,exports){ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _slateDevLogger = require('slate-dev-logger'); | ||
var _slateDevLogger2 = _interopRequireDefault(_slateDevLogger); | ||
var _slate = (window.Slate); | ||
@@ -313,4 +15,2 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -337,7 +37,2 @@ * Deserialize a plain text `string` to a Slate value. | ||
if (options.toRaw) { | ||
_slateDevLogger2.default.deprecate('0.23.0', 'The `options.toRaw` argument of the `Plain` serializer is deprecated, use `options.toJSON` instead.'); | ||
toJSON = options.toRaw; | ||
} | ||
if (_immutable.Set.isSet(defaultMarks)) { | ||
@@ -414,3 +109,3 @@ defaultMarks = defaultMarks.toArray(); | ||
},{"slate-dev-logger":2}]},{},[3])(3) | ||
},{}]},{},[1])(1) | ||
}); |
@@ -1,1 +0,1 @@ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.SlatePlainSerializer=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run()}}queueIndex=-1;len=queue.length}currentQueue=null;draining=false;runClearTimeout(timeout)}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue)}};function Item(fun,array){this.fun=fun;this.array=array}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}],2:[function(require,module,exports){(function(process){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var IS_DEV=typeof process!=="undefined"&&process.env&&process.env.NODE_ENV!=="production";var HAS_CONSOLE=typeof console!="undefined"&&typeof console.log=="function"&&typeof console.warn=="function"&&typeof console.error=="function";function log(level,message){if(!IS_DEV){return}if(HAS_CONSOLE){var _console;for(var _len=arguments.length,args=Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key]}(_console=console)[level].apply(_console,[message].concat(args))}}function error(message){if(HAS_CONSOLE){var _console2;for(var _len2=arguments.length,args=Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2]}(_console2=console).error.apply(_console2,[message].concat(args))}}function warn(message){for(var _len3=arguments.length,args=Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){args[_key3-1]=arguments[_key3]}log.apply(undefined,["warn","Warning: "+message].concat(args))}function deprecate(version,message){for(var _len4=arguments.length,args=Array(_len4>2?_len4-2:0),_key4=2;_key4<_len4;_key4++){args[_key4-2]=arguments[_key4]}log.apply(undefined,["warn","Deprecation ("+version+"): "+message].concat(args))}exports.default={deprecate:deprecate,error:error,warn:warn}}).call(this,require("_process"))},{_process:1}],3:[function(require,module,exports){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function deserialize(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.defaultBlock,a=void 0===r?"line":r,i=t.defaultMarks,o=void 0===i?[]:i,n=t.toJSON,l=void 0!==n&&n;t.toRaw&&(_slateDevLogger2.default.deprecate("0.23.0","The `options.toRaw` argument of the `Plain` serializer is deprecated, use `options.toJSON` instead."),l=t.toRaw),_immutable.Set.isSet(o)&&(o=o.toArray()),a=_slate.Node.createProperties(a),o=o.map(_slate.Mark.createProperties);var s={kind:"value",document:{kind:"document",data:{},nodes:e.split("\n").map(function(e){return _extends({},a,{kind:"block",isVoid:!1,data:{},nodes:[{kind:"text",leaves:[{kind:"leaf",text:e,marks:o}]}]})})}};return l?s:_slate.Value.fromJSON(s)}function serialize(e){return serializeNode(e.document)}function serializeNode(e){return"document"==e.kind||"block"==e.kind&&_slate.Block.isBlockList(e.nodes)?e.nodes.map(serializeNode).join("\n"):e.text}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},_slateDevLogger=require("slate-dev-logger"),_slateDevLogger2=_interopRequireDefault(_slateDevLogger),_slate=window.Slate,_immutable=window.Immutable;exports.default={deserialize:deserialize,serialize:serialize}},{"slate-dev-logger":2}]},{},[3])(3)}); | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.SlatePlainSerializer=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";function deserialize(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.defaultBlock,r=void 0===i?"line":i,a=t.defaultMarks,n=void 0===a?[]:a,o=t.toJSON,s=void 0!==o&&o;_immutable.Set.isSet(n)&&(n=n.toArray()),r=_slate.Node.createProperties(r),n=n.map(_slate.Mark.createProperties);var l={kind:"value",document:{kind:"document",data:{},nodes:e.split("\n").map(function(e){return _extends({},r,{kind:"block",isVoid:!1,data:{},nodes:[{kind:"text",leaves:[{kind:"leaf",text:e,marks:n}]}]})})}};return s?l:_slate.Value.fromJSON(l)}function serialize(e){return serializeNode(e.document)}function serializeNode(e){return"document"==e.kind||"block"==e.kind&&_slate.Block.isBlockList(e.nodes)?e.nodes.map(serializeNode).join("\n"):e.text}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},_slate=window.Slate,_immutable=window.Immutable;exports.default={deserialize:deserialize,serialize:serialize}},{}]},{},[1])(1)}); |
@@ -9,6 +9,2 @@ 'use strict'; | ||
var _slateDevLogger = require('slate-dev-logger'); | ||
var _slateDevLogger2 = _interopRequireDefault(_slateDevLogger); | ||
var _slate = require('slate'); | ||
@@ -18,4 +14,2 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -42,7 +36,2 @@ * Deserialize a plain text `string` to a Slate value. | ||
if (options.toRaw) { | ||
_slateDevLogger2.default.deprecate('0.23.0', 'The `options.toRaw` argument of the `Plain` serializer is deprecated, use `options.toJSON` instead.'); | ||
toJSON = options.toRaw; | ||
} | ||
if (_immutable.Set.isSet(defaultMarks)) { | ||
@@ -49,0 +38,0 @@ defaultMarks = defaultMarks.toArray(); |
{ | ||
"name": "slate-plain-serializer", | ||
"description": "A plain text serializer for Slate editors.", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"license": "MIT", | ||
@@ -9,7 +9,7 @@ "repository": "git://github.com/ianstormtaylor/slate.git", | ||
"dependencies": { | ||
"slate-dev-logger": "^0.1.25" | ||
"slate-dev-logger": "^0.1.26" | ||
}, | ||
"peerDependencies": { | ||
"immutable": "^3.8.0", | ||
"slate": "^0.29.1" | ||
"slate": "^0.30.0" | ||
}, | ||
@@ -20,4 +20,4 @@ "devDependencies": { | ||
"mocha": "^2.5.3", | ||
"slate": "^0.29.1", | ||
"slate-hyperscript": "^0.3.1", | ||
"slate": "^0.30.0", | ||
"slate-hyperscript": "^0.4.0", | ||
"uglify-js": "^2.7.0" | ||
@@ -24,0 +24,0 @@ }, |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
5
10815
184
+ Addedslate@0.30.7(transitive)
- Removedslate@0.29.1(transitive)
Updatedslate-dev-logger@^0.1.26