@sanity/core-loader
Advanced tools
Comparing version 1.3.7 to 1.3.8
@@ -40,2 +40,9 @@ # Changelog | ||
## [1.3.8](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.3.7...core-loader-v1.3.8) (2024-01-22) | ||
### Bug Fixes | ||
* **core-loader:** allow recursively calling encodeDataAttribute.scope ([#732](https://github.com/sanity-io/visual-editing/issues/732)) ([3d62bc6](https://github.com/sanity-io/visual-editing/commit/3d62bc62803fdfdce56b45e17a8f34d9f28c719e)) | ||
## [1.3.6](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.3.5...core-loader-v1.3.6) (2024-01-10) | ||
@@ -42,0 +49,0 @@ |
@@ -15,2 +15,3 @@ import { ContentSourceMap } from '@sanity/client/csm' | ||
studioUrl: Exclude<StegaConfig['studioUrl'], undefined> | undefined, | ||
basePath?: StudioPathLike, | ||
): EncodeDataAttributeFunction | ||
@@ -17,0 +18,0 @@ |
@@ -1,1 +0,1 @@ | ||
import{getPublishedId as t,studioPath as e,studioPathToJsonPath as r,resolveEditInfo as i,jsonPathToStudioPath as n}from"@sanity/client/csm";function s(t){return"function"==typeof t?t():t}function o(t,e){return Array.isArray(t)?[void 0,t]:[t,e]}function a(t,e,r){return{typed:t,output:e,issues:r}}function p(t,e){return{reason:t?.reason,validation:e.validation,origin:t?.origin||"value",message:e.message,input:e.input,requirement:e?.requirement,path:e.path,abortEarly:t?.abortEarly,abortPipeEarly:t?.abortPipeEarly,skipPipe:t?.skipPipe}}function u(t,e){return{reason:e,origin:t?.origin,abortEarly:t?.abortEarly,abortPipeEarly:t?.abortPipeEarly,skipPipe:t?.skipPipe}}function f(t,e,r,i,n){let s,o=t;if(e?.length&&!r?.skipPipe)for(const t of e){const e=t._parse(o);if(e.issues){s=s||u(r,i);for(const t of e.issues){const e=p(s,t);n?n.push(e):n=[e]}if(s.abortEarly||s.abortPipeEarly)break}else o=e.output}return a(!0,o,n)}function c(t,e,r,i,n,o,a){return{typed:!1,output:n,issues:[{reason:e,validation:r,origin:t?.origin||"value",message:s(i),input:n,path:o,issues:a,abortEarly:t?.abortEarly,abortPipeEarly:t?.abortPipeEarly,skipPipe:t?.skipPipe}]}}function y(t){return null!==t&&Array.isArray(t)}function l(t){let e="";for(const r of t)"string"!=typeof r?"number"!=typeof r?y(r)?(e&&(e+=":"),e+=`${r.join(",")}}`):r._key&&(e&&(e+=":"),e+=`${r._key}`):(e&&(e+=":"),e+=`${r}`):(e&&(e+="."),e+=r);return e}const h=function(t,e){const[r="Invalid type",i]=o(t,e);return{type:"string",async:!1,message:r,pipe:i,_parse(t,e){return"string"!=typeof t?c(e,"type","string",this.message,t):f(t,this.pipe,e,"string")}}}([function(t,e="Invalid length"){return{type:"min_length",async:!1,message:e,requirement:t,_parse(t){return t.length<this.requirement?function(t,e,r,i,n){return{issues:[{validation:t,message:s(e),input:r,requirement:i,path:n}]}}(this.type,this.message,t,this.requirement):{output:t}}}}(1)]),b={type:"optional",async:!1,wrapped:h,default:d,_parse(t,e){if(void 0===t){const e="function"==typeof(r=this).default?r.default():r.default;if(void 0===e)return a(!0,t);t=e}var r;return this.wrapped._parse(t,e)}},g=function(t,e,r,i){const[n,s="Invalid type",p]=function(t,e,r){if(!t||"object"==typeof t&&!Array.isArray(t)){const[i,n]=o(e,r);return[t,i,n]}const[i,n]=o(t,e);return[void 0,i,n]}(e,r,i);let u;return{type:"object",async:!1,entries:t,rest:n,message:s,pipe:p,_parse(t,e){if(!t||"object"!=typeof t)return c(e,"type","object",this.message,t);u=u||Object.entries(this.entries);let r,i=!0;const n={};for(const[s,o]of u){const a=t[s],p=o._parse(a,e);if(p.issues){const n={type:"object",input:t,key:s,value:a};for(const t of p.issues)t.path?t.path.unshift(n):t.path=[n],r?.push(t);if(r||(r=p.issues),e?.abortEarly){i=!1;break}}p.typed||(i=!1),(void 0!==p.output||s in t)&&(n[s]=p.output)}if(this.rest&&(!e?.abortEarly||!r))for(const s in t)if(!(s in this.entries)){const o=t[s],a=this.rest._parse(o,e);if(a.issues){const n={type:"object",input:t,key:s,value:o};for(const t of a.issues)t.path?t.path.unshift(n):t.path=[n],r?.push(t);if(r||(r=a.issues),e?.abortEarly){i=!1;break}}a.typed||(i=!1),n[s]=a.output}return i?f(n,this.pipe,e,"object",r):a(!1,n,r)}}}({id:h,path:h,type:b,baseUrl:h,workspace:b,tool:b});var d;function m(r){const{id:i,path:n,baseUrl:s,tool:o,workspace:a,type:p}=r;if(function(t){return e=t,!g._parse(e,{abortEarly:!0,skipPipe:r?.skipPipe}).issues;var e,r}(r))return[["id",t(i)],["type",p],["path",l(e.fromString(n))],["base",encodeURIComponent(s)],["workspace",a],["tool",o]].filter((([,t])=>!!t)).map((t=>t.join("="))).join(";")}const k=(t,s,o,a)=>{if(!s||!o)return;const p=r(a),u=i({resultPath:p,resultSourceMap:s,studioUrl:o});return u?m({baseUrl:u.baseUrl,workspace:u.workspace,tool:u.tool,type:u.type,id:u.id,path:"string"==typeof u.path?u.path:e.toString(n(u.path))}):void 0};function v(t,r,i){const n=t=>k(0,r,i,t);return n.scope=function(t){const r="string"==typeof t?e.fromString(t):t;return function(t){const i="string"==typeof t?e.fromString(t):t;return n([...r,...i])}},n}export{v as defineEncodeDataAttribute,k as encodeDataAttribute};//# sourceMappingURL=encode-data-attribute.js.map | ||
import{getPublishedId as t,studioPath as e,studioPathToJsonPath as r,resolveEditInfo as i,jsonPathToStudioPath as s}from"@sanity/client/csm";function n(t){return"function"==typeof t?t():t}function o(t,e){return Array.isArray(t)?[void 0,t]:[t,e]}function a(t,e,r){return{typed:t,output:e,issues:r}}function p(t,e){return{reason:t?.reason,validation:e.validation,origin:t?.origin||"value",message:e.message,input:e.input,requirement:e?.requirement,path:e.path,abortEarly:t?.abortEarly,abortPipeEarly:t?.abortPipeEarly,skipPipe:t?.skipPipe}}function u(t,e){return{reason:e,origin:t?.origin,abortEarly:t?.abortEarly,abortPipeEarly:t?.abortPipeEarly,skipPipe:t?.skipPipe}}function c(t,e,r,i,s){let n,o=t;if(e?.length&&!r?.skipPipe)for(const t of e){const e=t._parse(o);if(e.issues){n=n||u(r,i);for(const t of e.issues){const e=p(n,t);s?s.push(e):s=[e]}if(n.abortEarly||n.abortPipeEarly)break}else o=e.output}return a(!0,o,s)}function f(t,e,r,i,s,o,a){return{typed:!1,output:s,issues:[{reason:e,validation:r,origin:t?.origin||"value",message:n(i),input:s,path:o,issues:a,abortEarly:t?.abortEarly,abortPipeEarly:t?.abortPipeEarly,skipPipe:t?.skipPipe}]}}function y(t){return null!==t&&Array.isArray(t)}function l(t){let e="";for(const r of t)"string"!=typeof r?"number"!=typeof r?y(r)?(e&&(e+=":"),e+=`${r.join(",")}}`):r._key&&(e&&(e+=":"),e+=`${r._key}`):(e&&(e+=":"),e+=`${r}`):(e&&(e+="."),e+=r);return e}const h=function(t,e){const[r="Invalid type",i]=o(t,e);return{type:"string",async:!1,message:r,pipe:i,_parse(t,e){return"string"!=typeof t?f(e,"type","string",this.message,t):c(t,this.pipe,e,"string")}}}([function(t,e="Invalid length"){return{type:"min_length",async:!1,message:e,requirement:t,_parse(t){return t.length<this.requirement?function(t,e,r,i,s){return{issues:[{validation:t,message:n(e),input:r,requirement:i,path:s}]}}(this.type,this.message,t,this.requirement):{output:t}}}}(1)]),b={type:"optional",async:!1,wrapped:h,default:d,_parse(t,e){if(void 0===t){const e="function"==typeof(r=this).default?r.default():r.default;if(void 0===e)return a(!0,t);t=e}var r;return this.wrapped._parse(t,e)}},g=function(t,e,r,i){const[s,n="Invalid type",p]=function(t,e,r){if(!t||"object"==typeof t&&!Array.isArray(t)){const[i,s]=o(e,r);return[t,i,s]}const[i,s]=o(t,e);return[void 0,i,s]}(e,r,i);let u;return{type:"object",async:!1,entries:t,rest:s,message:n,pipe:p,_parse(t,e){if(!t||"object"!=typeof t)return f(e,"type","object",this.message,t);u=u||Object.entries(this.entries);let r,i=!0;const s={};for(const[n,o]of u){const a=t[n],p=o._parse(a,e);if(p.issues){const s={type:"object",input:t,key:n,value:a};for(const t of p.issues)t.path?t.path.unshift(s):t.path=[s],r?.push(t);if(r||(r=p.issues),e?.abortEarly){i=!1;break}}p.typed||(i=!1),(void 0!==p.output||n in t)&&(s[n]=p.output)}if(this.rest&&(!e?.abortEarly||!r))for(const n in t)if(!(n in this.entries)){const o=t[n],a=this.rest._parse(o,e);if(a.issues){const s={type:"object",input:t,key:n,value:o};for(const t of a.issues)t.path?t.path.unshift(s):t.path=[s],r?.push(t);if(r||(r=a.issues),e?.abortEarly){i=!1;break}}a.typed||(i=!1),s[n]=a.output}return i?c(s,this.pipe,e,"object",r):a(!1,s,r)}}}({id:h,path:h,type:b,baseUrl:h,workspace:b,tool:b});var d;function m(r){const{id:i,path:s,baseUrl:n,tool:o,workspace:a,type:p}=r;if(function(t){return e=t,!g._parse(e,{abortEarly:!0,skipPipe:r?.skipPipe}).issues;var e,r}(r))return[["id",t(i)],["type",p],["path",l(e.fromString(s))],["base",encodeURIComponent(n)],["workspace",a],["tool",o]].filter((([,t])=>!!t)).map((t=>t.join("="))).join(";")}const k=(t,n,o,a)=>{if(!n||!o)return;const p=r(a),u=i({resultPath:p,resultSourceMap:n,studioUrl:o});return u?m({baseUrl:u.baseUrl,workspace:u.workspace,tool:u.tool,type:u.type,id:u.id,path:"string"==typeof u.path?u.path:e.toString(s(u.path))}):void 0};function v(t,r,i,s){const n=t=>t?"string"==typeof t?e.fromString(t):t:[],o=n(s);return Object.assign((t=>k(0,r,i,[...o,...n(t)])),{scope:e=>v(t,r,i,[...o,...n(e)])})}export{v as defineEncodeDataAttribute,k as encodeDataAttribute};//# sourceMappingURL=encode-data-attribute.js.map |
{ | ||
"name": "@sanity/core-loader", | ||
"version": "1.3.7", | ||
"version": "1.3.8", | ||
"homepage": "https://github.com/sanity-io/visual-editing/tree/main/packages/core-loader#readme", | ||
@@ -130,3 +130,3 @@ "bugs": { | ||
"eslint-plugin-simple-import-sort": "^10.0.0", | ||
"happy-dom": "^13.1.4", | ||
"happy-dom": "^13.2.1", | ||
"nanostores": "0.9.5", | ||
@@ -133,0 +133,0 @@ "typescript": "^5.3.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
425704