Socket
Socket
Sign inDemoInstall

@sanity/block-content-to-tree

Package Overview
Dependencies
Maintainers
7
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/block-content-to-tree - npm Package Compare versions

Comparing version 0.2.4-next to 0.3.0

11

package.json
{
"name": "@sanity/block-content-to-tree",
"description":
"Converts the flat Sanity block content structure into a generic tree structure for easier transformation into other formats.",
"version": "0.2.4-next",
"description": "Converts the flat Sanity block content structure into a generic tree structure for easier transformation into other formats.",
"version": "0.3.0",
"main": "lib/index.js",
"umd": "umd/index.min.js",
"scripts": {
"browserify":
"NODE_ENV=production BROWSERIFY_ENV=build browserify -t envify -g uglifyify lib/index.js -o umd/index.js --standalone=BlockContentAdapter",
"build":
"npm run clean && npm run compile && npm run browserify && npm run minify && npm run size",
"browserify": "NODE_ENV=production BROWSERIFY_ENV=build browserify -t envify -g uglifyify lib/index.js -o umd/index.js --standalone=BlockContentAdapter",
"build": "npm run clean && npm run compile && npm run browserify && npm run minify && npm run size",
"size": "node -r babel-register src/scripts/print-bundle-size",

@@ -14,0 +11,0 @@ "watch": "npm run compile -- --watch",

@@ -5,5 +5,5 @@ (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.BlockContentAdapter = 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";var objectAssign=require("object-assign");module.exports=function(e,r){var t={children:[]},n=[t];return e.forEach(function(e){var t=objectAssign({},e);delete t.text,delete t.marks,delete t._type;var i=e.marks.sort(),s=1;if(n.length>1)for(s;s<n.length;s++){var c=n[s].markKey;if(!i.includes(c))break;var a=i.indexOf(c);i.splice(a,1)}n=n.slice(0,s);var l=n.slice(-1)[0];i.forEach(function(e){var t={type:"span",children:[],mark:r.markDefs.find(function(r){return r._key===e})||e,markKey:e};l.children.push(t),n.push(t),l=t}),Object.keys(t).length?l.children.push({type:"span",attributes:t,children:[e.text]}):l.children.push(e.text)}),t.children};
},{"object-assign":8}],3:[function(require,module,exports){
"use strict";function getStaticKey(t){return checksum(JSON.stringify(t)).toString(36).replace(/[^A-Za-z0-9]/g,"")}function getRandomKey(t,e){return Math.random().toString(36).slice(2,e+2)}function checksum(t){var e=0,n=t.length;if(0===n)return e;for(var r=0;r<n;r++)e=(e<<5)-e+t.charCodeAt(r),e&=e;return e}module.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.length||8;return e.staticKeys?getStaticKey(t,n):getRandomKey(t,n)};
},{}],4:[function(require,module,exports){

@@ -13,3 +13,2 @@ "use strict";module.exports=require("./BlockContentToTree");

"use strict";function migrate(e,r){if("block"===e._type)return migrateBlock(e,r);if(Array.isArray(e))return e.map(function(e){return migrateBlock(e,r)});throw new Error("Unrecognized block structure passed to migrate()")}function migrateBlock(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e.spans)return e;var t=[],n=e.spans.map(function(e){return Object.keys(e).reduce(function(n,s){if("marks"===s)return n;if(knownSpanKeys.includes(s))return n[s]=e[s],n;if(!(Object.keys(e[s]).length>0))return n;var a=generateKey(e[s],r);return n.marks=[a].concat(e.marks),t.push(objectAssign({},e[s],{_type:s,_key:a})),n},{marks:e.marks||[]})}),s=objectAssign({},e,{children:n,markDefs:t});return delete s.spans,s}var objectAssign=require("object-assign"),generateKey=require("./generateKey"),knownSpanKeys=["_type","_key","text"];module.exports=migrate;
},{"./generateKey":3,"object-assign":8}],6:[function(require,module,exports){

@@ -20,2 +19,3 @@ "use strict";function isList(t){var e=t._type,i=t.listItem;return"block"===e&&!!i}function isText(t){return"block"===t._type&&!isList(t)}function getInternalBlockType(t){return isText(t)?"text":isList(t)?"list":"custom"}module.exports={isList:isList,isText:isText,getInternalBlockType:getInternalBlockType};

"use strict";var nestContent=require("./ContentNester"),block=function(t){var e={type:"block",style:t.style,children:nestContent(t.children,t)};return t.extra&&(e.extra=t.extra),e},list=function(t){return{type:"list",itemStyle:t[0].listItem,items:t.map(function(t){var e={type:"block",style:t.style,children:nestContent(t.children,t)};return t.extra&&(e.extra=t.extra),e})}};module.exports={block:block,list:list};
},{"./ContentNester":2}],8:[function(require,module,exports){

@@ -22,0 +22,0 @@ "use strict";function toObject(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function shouldUseNative(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(r).map(function(e){return r[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}var getOwnPropertySymbols=Object.getOwnPropertySymbols,hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;module.exports=shouldUseNative()?Object.assign:function(e,r){for(var t,n,o=toObject(e),a=1;a<arguments.length;a++){t=Object(arguments[a]);for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);if(getOwnPropertySymbols){n=getOwnPropertySymbols(t);for(var c=0;c<n.length;c++)propIsEnumerable.call(t,n[c])&&(o[n[c]]=t[n[c]])}}return o};

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc