@webority/canvas-kit 0.143.1 → 0.144.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/renames.js +1 -1
- package/package.json +1 -1
package/dist/renames.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as e,readFileSync as t,readdirSync as n}from"node:fs";import{join as r}from"node:path";var i=/^\d+\.\d+\.\d+\.json$/,a=/^on[A-Z]/;function o(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<Math.max(n.length,r.length);e++){let t=(n[e]??0)-(r[e]??0);if(t!==0)return t}return 0}function s(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!a.test(e)))}function c(e){try{return JSON.parse(t(e,`utf8`))}catch(t){throw Error(`${e} is not valid JSON: ${t.message}`)}}function l(e,t){return e.has(t)||e.set(t,{name:t,props:{},values:{},added:{},removed:{}}),e.get(t)}function u(e,t){let n=new Map,r={};for(let r of e.componentProps??[])if(r.package===t)for(let e of r.components){let t=l(n,e);r.to!==void 0&&(t.props[r.prop]=r.to),r.values!==void 0&&(t.values[r.to??r.prop]={...r.values}),r.to===void 0&&r.values===void 0&&r.flag!==void 0&&(t.removed[r.prop]=r.flag)}for(let r of e.components??[]){if(r.package!==t)continue;let e=l(n,r.from);r.to!==r.from&&(e.to=r.to),Object.assign(e.props,r.renameProps);for(let[t,n]of Object.entries(r.valueMaps))e.values[t]={...e.values[t],...n};Object.assign(e.added,r.addProps),Object.assign(e.removed,r.removeProps)}for(let n of e.props??[])if(n.package===t)for(let e of n.props)r[e]={...r[e],[n.from]:n.to};return{entries:n,values:r}}function d({tableVersion:e,version:t,libraryPackage:n,warnings:r,component:i,prop:a,target:s,declared:c}){if(c.has(s))return!0;if(o(e,t)===0)throw Error(`${e}: ${i}.${a} renames to ${s}, which ${n} ${t} does not declare`);return r.push(`${e}: ${i}.${a} renames to ${s}, which this kit does not declare; left out.`),!1}function f(e,{libraryPackage:t,version:n,components:r,warnings:i}){let a=e.version,{entries:o,values:c}=u(e,t),l=[];for(let e of o.values()){
|
|
1
|
+
import{existsSync as e,readFileSync as t,readdirSync as n}from"node:fs";import{join as r}from"node:path";var i=/^\d+\.\d+\.\d+\.json$/,a=/^on[A-Z]/;function o(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<Math.max(n.length,r.length);e++){let t=(n[e]??0)-(r[e]??0);if(t!==0)return t}return 0}function s(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!a.test(e)))}function c(e){try{return JSON.parse(t(e,`utf8`))}catch(t){throw Error(`${e} is not valid JSON: ${t.message}`)}}function l(e,t){return e.has(t)||e.set(t,{name:t,props:{},values:{},added:{},removed:{}}),e.get(t)}function u(e,t){let n=new Map,r={};for(let r of e.componentProps??[])if(r.package===t)for(let e of r.components){let t=l(n,e);r.to!==void 0&&(t.props[r.prop]=r.to),r.values!==void 0&&(t.values[r.to??r.prop]={...r.values}),r.to===void 0&&r.values===void 0&&r.flag!==void 0&&(t.removed[r.prop]=r.flag)}for(let r of e.components??[]){if(r.package!==t)continue;let e=l(n,r.from);r.to!==r.from&&(e.to=r.to),Object.assign(e.props,r.renameProps);for(let[t,n]of Object.entries(r.valueMaps))e.values[t]={...e.values[t],...n};Object.assign(e.added,r.addProps),Object.assign(e.removed,r.removeProps)}for(let n of e.props??[])if(n.package===t)for(let e of n.props)r[e]={...r[e],[n.from]:n.to};return{entries:n,values:r}}function d({tableVersion:e,version:t,libraryPackage:n,warnings:r,component:i,prop:a,target:s,declared:c}){if(c.has(s))return!0;if(o(e,t)===0)throw Error(`${e}: ${i}.${a} renames to ${s}, which ${n} ${t} does not declare`);return r.push(`${e}: ${i}.${a} renames to ${s}, which this kit does not declare; left out.`),!1}function f(e,{libraryPackage:t,version:n,components:r,warnings:i}){let a=e.version,{entries:o,values:c}=u(e,t),l=[];for(let e of o.values()){let o=e.to??e.name,c=r.find(e=>e.name===o);if(!c){i.push(`${a}: ${o} is not a component of this kit; the renames of ${e.name} are left out.`);continue}let u=new Set(c.props.map(e=>e.name)),f=(r,o)=>d({tableVersion:a,version:n,libraryPackage:t,warnings:i,component:e.name,prop:r,target:o,declared:u}),p={};for(let[t,n]of Object.entries(s(e.props)))f(t,n)&&(p[t]=n);let m={};for(let[t,n]of Object.entries(s(e.values)))f(t,t)&&(m[t]=n);let h=s(e.added),g=s(e.removed);(e.to!==void 0||Object.keys(p).length+Object.keys(m).length+Object.keys(h).length+Object.keys(g).length!==0)&&l.push({name:e.name,...e.to===void 0?{}:{to:e.to},props:p,values:m,added:h,removed:g})}return{version:a,components:l,values:s(c)}}function p(t,a,s,l){if(!e(t))throw Error(`${t} does not exist. Set renames in canvas-kit.json to the folder of rename tables.`);let u=n(t).filter(e=>i.test(e)).map(e=>c(r(t,e))).filter(e=>o(e.version,s)<=0).sort((e,t)=>o(e.version,t.version)),d=[];return{renames:u.map(e=>f(e,{libraryPackage:a,version:s,components:l,warnings:d})),warnings:d}}function m(e,t,n,r){return p(e,t,n,r).renames}function h(e,t,n){return e.filter(e=>o(e.version,t)>0&&o(e.version,n)<=0).sort((e,t)=>o(e.version,t.version))}export{m as readRenames,p as readRenamesWithWarnings,h as renamesBetween};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/canvas-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.144.1",
|
|
4
4
|
"description": "Builds product kits for Webority Canvas: a kit bundle, its manifest, and the spec shape the renderers answer.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"private": false,
|