embedoc 0.14.6 → 0.14.7

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/cli-contract.yaml CHANGED
@@ -3,7 +3,7 @@ cli_contracts: 0.1.0
3
3
 
4
4
  info:
5
5
  title: embedoc CLI
6
- version: 0.14.6
6
+ version: 0.14.7
7
7
  description: >-
8
8
  In-place document generator that auto-updates marker blocks in documents
9
9
  and source code while preserving manually edited sections. Supports
@@ -55,7 +55,7 @@ Expecting `+z.join(", ")+", got '"+(this.terminals_[L]||L)+"'":ge="Parse error o
55
55
  `,h+=i.repeat("-",s.indent+p+3+_.pos)+`^
56
56
  `;for(let g=1;g<=s.linesAfter&&!(f+g>=l.length);g++){let E=e(r.buffer,a[f+g],l[f+g],r.position-(a[f]-a[f+g]),m);h+=i.repeat(" ",s.indent)+t((r.line+g+1).toString(),p)+" | "+E.str+`
57
57
  `}return h.replace(/\n$/,"")}return Hr=n,Hr}var Wr,Oa;function Ce(){if(Oa)return Wr;Oa=1;let i=hn(),e=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],t=["scalar","sequence","mapping"];function n(s){let o={};return s!==null&&Object.keys(s).forEach(function(a){s[a].forEach(function(l){o[String(l)]=a})}),o}function r(s,o){if(o=o||{},Object.keys(o).forEach(function(a){if(e.indexOf(a)===-1)throw new i('Unknown option "'+a+'" is met in definition of "'+s+'" YAML type.')}),this.options=o,this.tag=s,this.kind=o.kind||null,this.resolve=o.resolve||function(){return!0},this.construct=o.construct||function(a){return a},this.instanceOf=o.instanceOf||null,this.predicate=o.predicate||null,this.represent=o.represent||null,this.representName=o.representName||null,this.defaultStyle=o.defaultStyle||null,this.multi=o.multi||!1,this.styleAliases=n(o.styleAliases||null),t.indexOf(this.kind)===-1)throw new i('Unknown kind "'+this.kind+'" is specified for "'+s+'" YAML type.')}return Wr=r,Wr}var jr,Pa;function Ka(){if(Pa)return jr;Pa=1;let i=hn(),e=Ce();function t(s,o){let a=[];return s[o].forEach(function(l){let c=a.length;a.forEach(function(f,h){f.tag===l.tag&&f.kind===l.kind&&f.multi===l.multi&&(c=h)}),a[c]=l}),a}function n(){let s={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function o(a){a.multi?(s.multi[a.kind].push(a),s.multi.fallback.push(a)):s[a.kind][a.tag]=s.fallback[a.tag]=a}for(let a=0,l=arguments.length;a<l;a+=1)arguments[a].forEach(o);return s}function r(s){return this.extend(s)}return r.prototype.extend=function(o){let a=[],l=[];if(o instanceof e)l.push(o);else if(Array.isArray(o))l=l.concat(o);else if(o&&(Array.isArray(o.implicit)||Array.isArray(o.explicit)))o.implicit&&(a=a.concat(o.implicit)),o.explicit&&(l=l.concat(o.explicit));else throw new i("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");a.forEach(function(f){if(!(f instanceof e))throw new i("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(f.loadKind&&f.loadKind!=="scalar")throw new i("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(f.multi)throw new i("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),l.forEach(function(f){if(!(f instanceof e))throw new i("Specified list of YAML types (or a single Type object) contains a non-Type object.")});let c=Object.create(r.prototype);return c.implicit=(this.implicit||[]).concat(a),c.explicit=(this.explicit||[]).concat(l),c.compiledImplicit=t(c,"implicit"),c.compiledExplicit=t(c,"explicit"),c.compiledTypeMap=n(c.compiledImplicit,c.compiledExplicit),c},jr=r,jr}var Vr,Ra;function Qa(){if(Ra)return Vr;Ra=1;let i=Ce();return Vr=new i("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Vr}var Ur,Ia;function Xa(){if(Ia)return Ur;Ia=1;let i=Ce();return Ur=new i("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Ur}var Gr,La;function Za(){if(La)return Gr;La=1;let i=Ce();return Gr=new i("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Gr}var zr,Da;function el(){if(Da)return zr;Da=1;let i=Ka();return zr=new i({explicit:[Qa(),Xa(),Za()]}),zr}var $r,Ta;function tl(){if(Ta)return $r;Ta=1;let i=Ce();function e(r){if(r===null)return!0;let s=r.length;return s===1&&r==="~"||s===4&&(r==="null"||r==="Null"||r==="NULL")}function t(){return null}function n(r){return r===null}return $r=new i("tag:yaml.org,2002:null",{kind:"scalar",resolve:e,construct:t,predicate:n,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),$r}var Yr,Na;function nl(){if(Na)return Yr;Na=1;let i=Ce();function e(r){if(r===null)return!1;let s=r.length;return s===4&&(r==="true"||r==="True"||r==="TRUE")||s===5&&(r==="false"||r==="False"||r==="FALSE")}function t(r){return r==="true"||r==="True"||r==="TRUE"}function n(r){return Object.prototype.toString.call(r)==="[object Boolean]"}return Yr=new i("tag:yaml.org,2002:bool",{kind:"scalar",resolve:e,construct:t,predicate:n,represent:{lowercase:function(r){return r?"true":"false"},uppercase:function(r){return r?"TRUE":"FALSE"},camelcase:function(r){return r?"True":"False"}},defaultStyle:"lowercase"}),Yr}var Jr,Ma;function il(){if(Ma)return Jr;Ma=1;let i=un(),e=Ce();function t(c){return c>=48&&c<=57||c>=65&&c<=70||c>=97&&c<=102}function n(c){return c>=48&&c<=55}function r(c){return c>=48&&c<=57}function s(c){if(c===null)return!1;let f=c.length,h=0,p=!1;if(!f)return!1;let m=c[h];if((m==="-"||m==="+")&&(m=c[++h]),m==="0"){if(h+1===f)return!0;if(m=c[++h],m==="b"){for(h++;h<f;h++){if(m=c[h],m!=="0"&&m!=="1")return!1;p=!0}return p&&isFinite(o(c))}if(m==="x"){for(h++;h<f;h++){if(!t(c.charCodeAt(h)))return!1;p=!0}return p&&isFinite(o(c))}if(m==="o"){for(h++;h<f;h++){if(!n(c.charCodeAt(h)))return!1;p=!0}return p&&isFinite(o(c))}}for(;h<f;h++){if(!r(c.charCodeAt(h)))return!1;p=!0}return p?isFinite(o(c)):!1}function o(c){let f=c,h=1,p=f[0];if((p==="-"||p==="+")&&(p==="-"&&(h=-1),f=f.slice(1),p=f[0]),f==="0")return 0;if(p==="0"){if(f[1]==="b")return h*parseInt(f.slice(2),2);if(f[1]==="x")return h*parseInt(f.slice(2),16);if(f[1]==="o")return h*parseInt(f.slice(2),8)}return h*parseInt(f,10)}function a(c){return o(c)}function l(c){return Object.prototype.toString.call(c)==="[object Number]"&&c%1===0&&!i.isNegativeZero(c)}return Jr=new e("tag:yaml.org,2002:int",{kind:"scalar",resolve:s,construct:a,predicate:l,represent:{binary:function(c){return c>=0?"0b"+c.toString(2):"-0b"+c.toString(2).slice(1)},octal:function(c){return c>=0?"0o"+c.toString(8):"-0o"+c.toString(8).slice(1)},decimal:function(c){return c.toString(10)},hexadecimal:function(c){return c>=0?"0x"+c.toString(16).toUpperCase():"-0x"+c.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Jr}var Kr,Fa;function rl(){if(Fa)return Kr;Fa=1;let i=un(),e=Ce(),t=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),n=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function r(c){return c===null||!t.test(c)?!1:isFinite(parseFloat(c,10))?!0:n.test(c)}function s(c){let f=c.toLowerCase(),h=f[0]==="-"?-1:1;return"+-".indexOf(f[0])>=0&&(f=f.slice(1)),f===".inf"?h===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:f===".nan"?NaN:h*parseFloat(f,10)}let o=/^[-+]?[0-9]+e/;function a(c,f){if(isNaN(c))switch(f){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===c)switch(f){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===c)switch(f){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(i.isNegativeZero(c))return"-0.0";let h=c.toString(10);return o.test(h)?h.replace("e",".e"):h}function l(c){return Object.prototype.toString.call(c)==="[object Number]"&&(c%1!==0||i.isNegativeZero(c))}return Kr=new e("tag:yaml.org,2002:float",{kind:"scalar",resolve:r,construct:s,predicate:l,represent:a,defaultStyle:"lowercase"}),Kr}var Qr,Ba;function sl(){return Ba||(Ba=1,Qr=el().extend({implicit:[tl(),nl(),il(),rl()]})),Qr}var Xr,qa;function ol(){return qa||(qa=1,Xr=sl()),Xr}var Zr,Ha;function al(){if(Ha)return Zr;Ha=1;let i=Ce(),e=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),t=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function n(o){return o===null?!1:e.exec(o)!==null||t.exec(o)!==null}function r(o){let a=0,l=null,c=e.exec(o);if(c===null&&(c=t.exec(o)),c===null)throw new Error("Date resolve error");let f=+c[1],h=+c[2]-1,p=+c[3];if(!c[4])return new Date(Date.UTC(f,h,p));let m=+c[4],_=+c[5],g=+c[6];if(c[7]){for(a=c[7].slice(0,3);a.length<3;)a+="0";a=+a}if(c[9]){let b=+c[10],S=+(c[11]||0);l=(b*60+S)*6e4,c[9]==="-"&&(l=-l)}let E=new Date(Date.UTC(f,h,p,m,_,g,a));return l&&E.setTime(E.getTime()-l),E}function s(o){return o.toISOString()}return Zr=new i("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:n,construct:r,instanceOf:Date,represent:s}),Zr}var es,Wa;function ll(){if(Wa)return es;Wa=1;let i=Ce();function e(t){return t==="<<"||t===null}return es=new i("tag:yaml.org,2002:merge",{kind:"scalar",resolve:e}),es}var ts,ja;function cl(){if(ja)return ts;ja=1;let i=Ce(),e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
58
- \r`;function t(o){if(o===null)return!1;let a=0,l=o.length,c=e;for(let f=0;f<l;f++){let h=c.indexOf(o.charAt(f));if(!(h>64)){if(h<0)return!1;a+=6}}return a%8===0}function n(o){let a=o.replace(/[\r\n=]/g,""),l=a.length,c=e,f=0,h=[];for(let m=0;m<l;m++)m%4===0&&m&&(h.push(f>>16&255),h.push(f>>8&255),h.push(f&255)),f=f<<6|c.indexOf(a.charAt(m));let p=l%4*6;return p===0?(h.push(f>>16&255),h.push(f>>8&255),h.push(f&255)):p===18?(h.push(f>>10&255),h.push(f>>2&255)):p===12&&h.push(f>>4&255),new Uint8Array(h)}function r(o){let a="",l=0,c=o.length,f=e;for(let p=0;p<c;p++)p%3===0&&p&&(a+=f[l>>18&63],a+=f[l>>12&63],a+=f[l>>6&63],a+=f[l&63]),l=(l<<8)+o[p];let h=c%3;return h===0?(a+=f[l>>18&63],a+=f[l>>12&63],a+=f[l>>6&63],a+=f[l&63]):h===2?(a+=f[l>>10&63],a+=f[l>>4&63],a+=f[l<<2&63],a+=f[64]):h===1&&(a+=f[l>>2&63],a+=f[l<<4&63],a+=f[64],a+=f[64]),a}function s(o){return Object.prototype.toString.call(o)==="[object Uint8Array]"}return ts=new i("tag:yaml.org,2002:binary",{kind:"scalar",resolve:t,construct:n,predicate:s,represent:r}),ts}var ns,Va;function ul(){if(Va)return ns;Va=1;let i=Ce(),e=Object.prototype.hasOwnProperty,t=Object.prototype.toString;function n(s){if(s===null)return!0;let o=[],a=s;for(let l=0,c=a.length;l<c;l+=1){let f=a[l],h=!1;if(t.call(f)!=="[object Object]")return!1;let p;for(p in f)if(e.call(f,p))if(!h)h=!0;else return!1;if(!h)return!1;if(o.indexOf(p)===-1)o.push(p);else return!1}return!0}function r(s){return s!==null?s:[]}return ns=new i("tag:yaml.org,2002:omap",{kind:"sequence",resolve:n,construct:r}),ns}var is,Ua;function hl(){if(Ua)return is;Ua=1;let i=Ce(),e=Object.prototype.toString;function t(r){if(r===null)return!0;let s=r,o=new Array(s.length);for(let a=0,l=s.length;a<l;a+=1){let c=s[a];if(e.call(c)!=="[object Object]")return!1;let f=Object.keys(c);if(f.length!==1)return!1;o[a]=[f[0],c[f[0]]]}return!0}function n(r){if(r===null)return[];let s=r,o=new Array(s.length);for(let a=0,l=s.length;a<l;a+=1){let c=s[a],f=Object.keys(c);o[a]=[f[0],c[f[0]]]}return o}return is=new i("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:t,construct:n}),is}var rs,Ga;function fl(){if(Ga)return rs;Ga=1;let i=Ce(),e=Object.prototype.hasOwnProperty;function t(r){if(r===null)return!0;let s=r;for(let o in s)if(e.call(s,o)&&s[o]!==null)return!1;return!0}function n(r){return r!==null?r:{}}return rs=new i("tag:yaml.org,2002:set",{kind:"mapping",resolve:t,construct:n}),rs}var ss,za;function as(){return za||(za=1,ss=ol().extend({implicit:[al(),ll()],explicit:[cl(),ul(),hl(),fl()]})),ss}var $a;function Cf(){if($a)return li;$a=1;let i=un(),e=hn(),t=Ef(),n=as(),r=Object.prototype.hasOwnProperty,s=1,o=2,a=3,l=4,c=1,f=2,h=3,p=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,m=/[\x85\u2028\u2029]/,_=/[,\[\]{}]/,g=/^(?:!|!!|![0-9A-Za-z-]+!)$/,E=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function b(u){return Object.prototype.toString.call(u)}function S(u){return u===10||u===13}function O(u){return u===9||u===32}function L(u){return u===9||u===32||u===10||u===13}function B(u){return u===44||u===91||u===93||u===123||u===125}function U(u){if(u>=48&&u<=57)return u-48;let y=u|32;return y>=97&&y<=102?y-97+10:-1}function J(u){return u===120?2:u===117?4:u===85?8:0}function he(u){return u>=48&&u<=57?u-48:-1}function le(u){switch(u){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
58
+ \r`;function t(o){if(o===null)return!1;let a=0,l=o.length,c=e;for(let f=0;f<l;f++){let h=c.indexOf(o.charAt(f));if(!(h>64)){if(h<0)return!1;a+=6}}return a%8===0}function n(o){let a=o.replace(/[\r\n=]/g,""),l=a.length,c=e,f=0,h=[];for(let m=0;m<l;m++)m%4===0&&m&&(h.push(f>>16&255),h.push(f>>8&255),h.push(f&255)),f=f<<6|c.indexOf(a.charAt(m));let p=l%4*6;return p===0?(h.push(f>>16&255),h.push(f>>8&255),h.push(f&255)):p===18?(h.push(f>>10&255),h.push(f>>2&255)):p===12&&h.push(f>>4&255),new Uint8Array(h)}function r(o){let a="",l=0,c=o.length,f=e;for(let p=0;p<c;p++)p%3===0&&p&&(a+=f[l>>18&63],a+=f[l>>12&63],a+=f[l>>6&63],a+=f[l&63]),l=(l<<8)+o[p];let h=c%3;return h===0?(a+=f[l>>18&63],a+=f[l>>12&63],a+=f[l>>6&63],a+=f[l&63]):h===2?(a+=f[l>>10&63],a+=f[l>>4&63],a+=f[l<<2&63],a+=f[64]):h===1&&(a+=f[l>>2&63],a+=f[l<<4&63],a+=f[64],a+=f[64]),a}function s(o){return Object.prototype.toString.call(o)==="[object Uint8Array]"}return ts=new i("tag:yaml.org,2002:binary",{kind:"scalar",resolve:t,construct:n,predicate:s,represent:r}),ts}var ns,Va;function ul(){if(Va)return ns;Va=1;let i=Ce(),e=Object.prototype.hasOwnProperty,t=Object.prototype.toString;function n(s){if(s===null)return!0;let o={},a=s;for(let l=0,c=a.length;l<c;l+=1){let f=a[l],h=!1;if(t.call(f)!=="[object Object]")return!1;let p;for(p in f)if(e.call(f,p))if(!h)h=!0;else return!1;if(!h||e.call(o,p))return!1;Object.defineProperty(o,p,{value:!0})}return!0}function r(s){return s!==null?s:[]}return ns=new i("tag:yaml.org,2002:omap",{kind:"sequence",resolve:n,construct:r}),ns}var is,Ua;function hl(){if(Ua)return is;Ua=1;let i=Ce(),e=Object.prototype.toString;function t(r){if(r===null)return!0;let s=r,o=new Array(s.length);for(let a=0,l=s.length;a<l;a+=1){let c=s[a];if(e.call(c)!=="[object Object]")return!1;let f=Object.keys(c);if(f.length!==1)return!1;o[a]=[f[0],c[f[0]]]}return!0}function n(r){if(r===null)return[];let s=r,o=new Array(s.length);for(let a=0,l=s.length;a<l;a+=1){let c=s[a],f=Object.keys(c);o[a]=[f[0],c[f[0]]]}return o}return is=new i("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:t,construct:n}),is}var rs,Ga;function fl(){if(Ga)return rs;Ga=1;let i=Ce(),e=Object.prototype.hasOwnProperty;function t(r){if(r===null)return!0;let s=r;for(let o in s)if(e.call(s,o)&&s[o]!==null)return!1;return!0}function n(r){return r!==null?r:{}}return rs=new i("tag:yaml.org,2002:set",{kind:"mapping",resolve:t,construct:n}),rs}var ss,za;function as(){return za||(za=1,ss=ol().extend({implicit:[al(),ll()],explicit:[cl(),ul(),hl(),fl()]})),ss}var $a;function Cf(){if($a)return li;$a=1;let i=un(),e=hn(),t=Ef(),n=as(),r=Object.prototype.hasOwnProperty,s=1,o=2,a=3,l=4,c=1,f=2,h=3,p=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,m=/[\x85\u2028\u2029]/,_=/[,\[\]{}]/,g=/^(?:!|!!|![0-9A-Za-z-]+!)$/,E=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function b(u){return Object.prototype.toString.call(u)}function S(u){return u===10||u===13}function O(u){return u===9||u===32}function L(u){return u===9||u===32||u===10||u===13}function B(u){return u===44||u===91||u===93||u===123||u===125}function U(u){if(u>=48&&u<=57)return u-48;let y=u|32;return y>=97&&y<=102?y-97+10:-1}function J(u){return u===120?2:u===117?4:u===85?8:0}function he(u){return u>=48&&u<=57?u-48:-1}function le(u){switch(u){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
59
59
  `;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function se(u){return u<=65535?String.fromCharCode(u):String.fromCharCode((u-65536>>10)+55296,(u-65536&1023)+56320)}function G(u,y,x){y==="__proto__"?Object.defineProperty(u,y,{configurable:!0,enumerable:!0,writable:!0,value:x}):u[y]=x}let ce=new Array(256),V=new Array(256);for(let u=0;u<256;u++)ce[u]=le(u)?1:0,V[u]=le(u);function z(u,y){this.input=u,this.filename=y.filename||null,this.schema=y.schema||n,this.onWarning=y.onWarning||null,this.legacy=y.legacy||!1,this.json=y.json||!1,this.listener=y.listener||null,this.maxDepth=typeof y.maxDepth=="number"?y.maxDepth:100,this.maxTotalMergeKeys=typeof y.maxTotalMergeKeys=="number"?y.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=u.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function ge(u,y){let x={name:u.filename,buffer:u.input.slice(0,-1),position:u.position,line:u.line,column:u.position-u.lineStart};return x.snippet=t(x),new e(y,x)}function T(u,y){throw ge(u,y)}function te(u,y){u.onWarning&&u.onWarning.call(null,ge(u,y))}function _e(u,y,x){let A=u.anchorMapTransactions;if(A.length!==0){let v=A[A.length-1];r.call(v,y)||(v[y]={existed:r.call(u.anchorMap,y),value:u.anchorMap[y]})}u.anchorMap[y]=x}function Ie(u){u.anchorMapTransactions.push(Object.create(null))}function Ee(u){let y=u.anchorMapTransactions.pop(),x=u.anchorMapTransactions;if(x.length===0)return;let A=x[x.length-1],v=Object.keys(y);for(let D=0,d=v.length;D<d;D+=1){let w=v[D];r.call(A,w)||(A[w]=y[w])}}function gt(u){let y=u.anchorMapTransactions.pop(),x=Object.keys(y);for(let A=x.length-1;A>=0;A-=1){let v=y[x[A]];v.existed?u.anchorMap[x[A]]=v.value:delete u.anchorMap[x[A]]}}function _t(u){return{position:u.position,line:u.line,lineStart:u.lineStart,lineIndent:u.lineIndent,firstTabInLine:u.firstTabInLine,tag:u.tag,anchor:u.anchor,kind:u.kind,result:u.result}}function Bt(u,y){u.position=y.position,u.line=y.line,u.lineStart=y.lineStart,u.lineIndent=y.lineIndent,u.firstTabInLine=y.firstTabInLine,u.tag=y.tag,u.anchor=y.anchor,u.kind=y.kind,u.result=y.result}let Xn={YAML:function(y,x,A){y.version!==null&&T(y,"duplication of %YAML directive"),A.length!==1&&T(y,"YAML directive accepts exactly one argument");let v=/^([0-9]+)\.([0-9]+)$/.exec(A[0]);v===null&&T(y,"ill-formed argument of the YAML directive");let D=parseInt(v[1],10),d=parseInt(v[2],10);D!==1&&T(y,"unacceptable YAML version of the document"),y.version=A[0],y.checkLineBreaks=d<2,d!==1&&d!==2&&te(y,"unsupported YAML version of the document")},TAG:function(y,x,A){let v;A.length!==2&&T(y,"TAG directive accepts exactly two arguments");let D=A[0];v=A[1],g.test(D)||T(y,"ill-formed tag handle (first argument) of the TAG directive"),r.call(y.tagMap,D)&&T(y,'there is a previously declared suffix for "'+D+'" tag handle'),E.test(v)||T(y,"ill-formed tag prefix (second argument) of the TAG directive");try{v=decodeURIComponent(v)}catch{T(y,"tag prefix is malformed: "+v)}y.tagMap[D]=v}};function Le(u,y,x,A){if(y<x){let v=u.input.slice(y,x);if(A)for(let D=0,d=v.length;D<d;D+=1){let w=v.charCodeAt(D);w===9||w>=32&&w<=1114111||T(u,"expected valid JSON character")}else p.test(v)&&T(u,"the stream contains non-printable characters");u.result+=v}}function yt(u,y,x,A){i.isObject(x)||T(u,"cannot merge mappings; the provided source object is unacceptable");let v=Object.keys(x);for(let D=0,d=v.length;D<d;D+=1){let w=v[D];u.maxTotalMergeKeys!==-1&&++u.totalMergeKeys>u.maxTotalMergeKeys&&T(u,"merge keys exceeded maxTotalMergeKeys ("+u.maxTotalMergeKeys+")"),r.call(y,w)||(G(y,w,x[w]),A[w]=!0)}}function st(u,y,x,A,v,D,d,w,R){if(Array.isArray(v)){v=Array.prototype.slice.call(v);for(let C=0,k=v.length;C<k;C+=1)Array.isArray(v[C])&&T(u,"nested arrays are not supported inside keys"),typeof v=="object"&&b(v[C])==="[object Object]"&&(v[C]="[object Object]")}if(typeof v=="object"&&b(v)==="[object Object]"&&(v="[object Object]"),v=String(v),y===null&&(y={}),A==="tag:yaml.org,2002:merge")if(Array.isArray(D))for(let C=0,k=D.length;C<k;C+=1)yt(u,y,D[C],x);else yt(u,y,D,x);else!u.json&&!r.call(x,v)&&r.call(y,v)&&(u.line=d||u.line,u.lineStart=w||u.lineStart,u.position=R||u.position,T(u,"duplicated mapping key")),G(y,v,D),delete x[v];return y}function qt(u){let y=u.input.charCodeAt(u.position);y===10?u.position++:y===13?(u.position++,u.input.charCodeAt(u.position)===10&&u.position++):T(u,"a line break is expected"),u.line+=1,u.lineStart=u.position,u.firstTabInLine=-1}function ie(u,y,x){let A=0,v=u.input.charCodeAt(u.position);for(;v!==0;){for(;O(v);)v===9&&u.firstTabInLine===-1&&(u.firstTabInLine=u.position),v=u.input.charCodeAt(++u.position);if(y&&v===35)do v=u.input.charCodeAt(++u.position);while(v!==10&&v!==13&&v!==0);if(S(v))for(qt(u),v=u.input.charCodeAt(u.position),A++,u.lineIndent=0;v===32;)u.lineIndent++,v=u.input.charCodeAt(++u.position);else break}return x!==-1&&A!==0&&u.lineIndent<x&&te(u,"deficient indentation"),A}function Ht(u){let y=u.position,x=u.input.charCodeAt(y);return!!((x===45||x===46)&&x===u.input.charCodeAt(y+1)&&x===u.input.charCodeAt(y+2)&&(y+=3,x=u.input.charCodeAt(y),x===0||L(x)))}function ot(u,y){y===1?u.result+=" ":y>1&&(u.result+=i.repeat(`
60
60
  `,y-1))}function Zn(u,y,x){let A,v,D,d,w,R,C=u.kind,k=u.result,I=u.input.charCodeAt(u.position);if(L(I)||B(I)||I===35||I===38||I===42||I===33||I===124||I===62||I===39||I===34||I===37||I===64||I===96)return!1;if(I===63||I===45){let P=u.input.charCodeAt(u.position+1);if(L(P)||x&&B(P))return!1}for(u.kind="scalar",u.result="",A=v=u.position,D=!1;I!==0;){if(I===58){let P=u.input.charCodeAt(u.position+1);if(L(P)||x&&B(P))break}else if(I===35){let P=u.input.charCodeAt(u.position-1);if(L(P))break}else{if(u.position===u.lineStart&&Ht(u)||x&&B(I))break;if(S(I))if(d=u.line,w=u.lineStart,R=u.lineIndent,ie(u,!1,-1),u.lineIndent>=y){D=!0,I=u.input.charCodeAt(u.position);continue}else{u.position=v,u.line=d,u.lineStart=w,u.lineIndent=R;break}}D&&(Le(u,A,v,!1),ot(u,u.line-d),A=v=u.position,D=!1),O(I)||(v=u.position+1),I=u.input.charCodeAt(++u.position)}return Le(u,A,v,!1),u.result?!0:(u.kind=C,u.result=k,!1)}function ei(u,y){let x,A,v=u.input.charCodeAt(u.position);if(v!==39)return!1;for(u.kind="scalar",u.result="",u.position++,x=A=u.position;(v=u.input.charCodeAt(u.position))!==0;)if(v===39)if(Le(u,x,u.position,!0),v=u.input.charCodeAt(++u.position),v===39)x=u.position,u.position++,A=u.position;else return!0;else S(v)?(Le(u,x,A,!0),ot(u,ie(u,!1,y)),x=A=u.position):u.position===u.lineStart&&Ht(u)?T(u,"unexpected end of the document within a single quoted scalar"):(u.position++,O(v)||(A=u.position));T(u,"unexpected end of the stream within a single quoted scalar")}function an(u,y){let x,A,v,D=u.input.charCodeAt(u.position);if(D!==34)return!1;for(u.kind="scalar",u.result="",u.position++,x=A=u.position;(D=u.input.charCodeAt(u.position))!==0;){if(D===34)return Le(u,x,u.position,!0),u.position++,!0;if(D===92){if(Le(u,x,u.position,!0),D=u.input.charCodeAt(++u.position),S(D))ie(u,!1,y);else if(D<256&&ce[D])u.result+=V[D],u.position++;else if((v=J(D))>0){let d=v,w=0;for(;d>0;d--)D=u.input.charCodeAt(++u.position),(v=U(D))>=0?w=(w<<4)+v:T(u,"expected hexadecimal character");u.result+=se(w),u.position++}else T(u,"unknown escape sequence");x=A=u.position}else S(D)?(Le(u,x,A,!0),ot(u,ie(u,!1,y)),x=A=u.position):u.position===u.lineStart&&Ht(u)?T(u,"unexpected end of the document within a double quoted scalar"):(u.position++,O(D)||(A=u.position))}T(u,"unexpected end of the stream within a double quoted scalar")}function ti(u,y){let x=!0,A,v,D,d=u.tag,w,R=u.anchor,C,k,I,P,M=Object.create(null),N,q,H,Y=u.input.charCodeAt(u.position);if(Y===91)C=93,P=!1,w=[];else if(Y===123)C=125,P=!0,w={};else return!1;for(u.anchor!==null&&_e(u,u.anchor,w),Y=u.input.charCodeAt(++u.position);Y!==0;){if(ie(u,!0,y),Y=u.input.charCodeAt(u.position),Y===C)return u.position++,u.tag=d,u.anchor=R,u.kind=P?"mapping":"sequence",u.result=w,!0;if(x?Y===44&&T(u,"expected the node content, but found ','"):T(u,"missed comma between flow collection entries"),q=N=H=null,k=I=!1,Y===63){let X=u.input.charCodeAt(u.position+1);L(X)&&(k=I=!0,u.position++,ie(u,!0,y))}A=u.line,v=u.lineStart,D=u.position,lt(u,y,s,!1,!0),q=u.tag,N=u.result,ie(u,!0,y),Y=u.input.charCodeAt(u.position),(I||u.line===A)&&Y===58&&(k=!0,Y=u.input.charCodeAt(++u.position),ie(u,!0,y),lt(u,y,s,!1,!0),H=u.result),P?st(u,w,M,q,N,H,A,v,D):k?w.push(st(u,null,M,q,N,H,A,v,D)):w.push(N),ie(u,!0,y),Y=u.input.charCodeAt(u.position),Y===44?(x=!0,Y=u.input.charCodeAt(++u.position)):x=!1}T(u,"unexpected end of the stream within a flow collection")}function ni(u,y){let x,A=c,v=!1,D=!1,d=y,w=0,R=!1,C,k=u.input.charCodeAt(u.position);if(k===124)x=!1;else if(k===62)x=!0;else return!1;for(u.kind="scalar",u.result="";k!==0;)if(k=u.input.charCodeAt(++u.position),k===43||k===45)c===A?A=k===43?h:f:T(u,"repeat of a chomping mode identifier");else if((C=he(k))>=0)C===0?T(u,"bad explicit indentation width of a block scalar; it cannot be less than one"):D?T(u,"repeat of an indentation width identifier"):(d=y+C-1,D=!0);else break;if(O(k)){do k=u.input.charCodeAt(++u.position);while(O(k));if(k===35)do k=u.input.charCodeAt(++u.position);while(!S(k)&&k!==0)}for(;k!==0;){for(qt(u),u.lineIndent=0,k=u.input.charCodeAt(u.position);(!D||u.lineIndent<d)&&k===32;)u.lineIndent++,k=u.input.charCodeAt(++u.position);if(!D&&u.lineIndent>d&&(d=u.lineIndent),S(k)){w++;continue}if(!D&&d===0&&T(u,"missing indentation for block scalar"),u.lineIndent<d){A===h?u.result+=i.repeat(`
61
61
  `,v?1+w:w):A===c&&v&&(u.result+=`
@@ -875,7 +875,7 @@ ${t.trim()}
875
875
  `):c;await Yy(s,h,{encoding:n.output?.encoding??"utf-8"})}}catch(a){o.success=!1,o.error=a instanceof Error?a:new Error(String(a))}return o}async function rb(i,e,t,n,r={}){let s=[];if(!e.generators||e.generators.length===0)return r.verbose&&console.log(`No generators defined for datasource: ${i}`),s;let o=n.templates_dir??".embedoc/templates",a=await t.getAll();r.verbose&&console.log(`Found ${a.length} records in datasource: ${i}`);for(let l of e.generators)if(!(r.generatorName&&l.template!==r.generatorName)){r.verbose&&console.log(` Generator: ${l.template}`);for(let c of a){let f=await ib(c,l,o,n,r.dryRun);s.push(f),r.verbose&&(f.skipped?console.log(` Skipped (exists): ${f.filePath}`):f.success?console.log(` Generated: ${f.filePath}`):console.log(` Failed: ${f.filePath} - ${f.error?.message}`))}}return s}async function uf(i,e,t={}){let n=[];if(!i.datasources)return n;for(let[r,s]of Object.entries(i.datasources)){if(t.datasourceName&&r!==t.datasourceName||!s.generators||s.generators.length===0)continue;let o=e[r];if(!o){t.verbose&&console.warn(`Datasource not initialized: ${r}`);continue}t.verbose&&console.log(`
876
876
  Processing datasource: ${r}`);let a=await rb(r,s,o,i,t);n.push(...a)}return n}Nn();import{readFile as sb}from"node:fs/promises";import{resolve as it,relative as ba}from"node:path";var sn=class{nodes=new Map;config;renderersDir;embeds;constructor(e,t){this.config=e,this.embeds=t,this.renderersDir=it(e.renderers_dir??e.embeds_dir??".embedoc/renderers")}getOrCreateNode(e,t){let n=it(t),r=this.nodes.get(n);return r||(r={type:e,path:n,dependsOn:new Set,dependedBy:new Set},this.nodes.set(n,r)),r}addDependency(e,t){let n=this.nodes.get(it(e)),r=this.nodes.get(it(t));n&&r&&(n.dependsOn.add(r.path),r.dependedBy.add(n.path))}async analyzeDocument(e,t){let n=it(e),r=this.getOrCreateNode("document",n);try{let s=await sb(n,{encoding:"utf-8"}),o=Ji(t.comment_style,this.config.comment_styles),{content:a}=$i(s),l=Yi(a,o),c=new Set(l.map(f=>f.templateName));for(let f of c){let h=this.embeds[f];if(h){let p=`embed:${f}`,m=this.getOrCreateNode("embed",p);if(r.dependsOn.add(m.path),m.dependedBy.add(r.path),h.dependsOn)for(let _ of h.dependsOn){let g=this.config.datasources?.[_];if(g?.path){let E=it(g.path),b=this.getOrCreateNode("datasource",E);m.dependsOn.add(b.path),b.dependedBy.add(m.path)}}}}}catch{}}async build(){this.nodes.clear();for(let e of this.config.targets){let t=await ft(e.pattern,{ignore:e.exclude??[],nodir:!0});for(let n of t)await this.analyzeDocument(n,e)}}getAffectedDocuments(e){let t=it(e),n=new Set,r=this.nodes.get(t);if(!r){for(let a of this.nodes.values())if(a.type==="datasource"&&a.path===t){r=a;break}}if(!r&&e.endsWith(".ts")){let a=e.split("/").pop()?.replace(".ts","");if(a&&a!=="index"){let l=`embed:${a}`;if(r=this.nodes.get(it(l)),!r){let c=a.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"");r=this.nodes.get(it(`embed:${c}`))}}}if(!r)return this.nodes.get(t)?.type==="document"?[t]:[];let s=new Set,o=[r];for(;o.length>0;){let a=o.shift();if(!s.has(a.path)){s.add(a.path),a.type==="document"&&n.add(a.path);for(let l of a.dependedBy){let c=this.nodes.get(l);c&&!s.has(l)&&o.push(c)}}}return Array.from(n)}getWatchPaths(){let e=[];if(this.config.datasources)for(let t of Object.values(this.config.datasources))t.path&&e.push(it(t.path));return e.push(this.renderersDir),e}dump(){console.log(`
877
877
  === Dependency Graph ===`);for(let[e,t]of this.nodes){if(console.log(`
878
- [${t.type}] ${ba(process.cwd(),e)}`),t.dependsOn.size>0){console.log(" depends on:");for(let n of t.dependsOn)console.log(` - ${ba(process.cwd(),n)}`)}if(t.dependedBy.size>0){console.log(" depended by:");for(let n of t.dependedBy)console.log(` - ${ba(process.cwd(),n)}`)}}}};var lb={version:"0.14.6"};async function va(i){let e=rt(i),t=await df(e,{encoding:"utf-8"});return i.endsWith(".json")?JSON.parse(t):Xe.load(t)}async function on(i){try{return await ob(i),!0}catch{return!1}}function ff(i){return i.renderers_dir?i.renderers_dir:i.embeds_dir?(console.warn(j.default.yellow('Warning: "embeds_dir" is deprecated. Use "renderers_dir" instead.')),i.embeds_dir):".embedoc/renderers"}async function Sa(i){let e=rt(i,"index.ts"),t=rt(i,"index.js");try{if(await on(e)){let n=await mf(e,import.meta.url);return n.embeds??n.default?.embeds??{}}return await on(t)?(await import(pf(t).href)).embeds??{}:{}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(j.default.yellow(`Warning: Could not load renderers from ${i}: ${r}`)),{}}}async function xa(i){let e=rt(i,"index.ts"),t=rt(i,"index.js"),n={datasourceTypes:{},inlineFormats:{}};try{let r;return await on(e)?r=await mf(e,import.meta.url):await on(t)&&(r=await import(pf(t).href)),r?{datasourceTypes:r.datasourceTypes??r.default?.datasourceTypes??{},inlineFormats:r.inlineFormats??r.default?.inlineFormats??{}}:n}catch(r){let s=r instanceof Error?r.message:String(r);return console.warn(j.default.yellow(`Warning: Could not load custom datasources from ${i}: ${s}`)),n}}var cb={init:async i=>{try{console.log(j.default.cyan(`\u{1F4C1} Initializing embedoc...
878
+ [${t.type}] ${ba(process.cwd(),e)}`),t.dependsOn.size>0){console.log(" depends on:");for(let n of t.dependsOn)console.log(` - ${ba(process.cwd(),n)}`)}if(t.dependedBy.size>0){console.log(" depended by:");for(let n of t.dependedBy)console.log(` - ${ba(process.cwd(),n)}`)}}}};var lb={version:"0.14.7"};async function va(i){let e=rt(i),t=await df(e,{encoding:"utf-8"});return i.endsWith(".json")?JSON.parse(t):Xe.load(t)}async function on(i){try{return await ob(i),!0}catch{return!1}}function ff(i){return i.renderers_dir?i.renderers_dir:i.embeds_dir?(console.warn(j.default.yellow('Warning: "embeds_dir" is deprecated. Use "renderers_dir" instead.')),i.embeds_dir):".embedoc/renderers"}async function Sa(i){let e=rt(i,"index.ts"),t=rt(i,"index.js");try{if(await on(e)){let n=await mf(e,import.meta.url);return n.embeds??n.default?.embeds??{}}return await on(t)?(await import(pf(t).href)).embeds??{}:{}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(j.default.yellow(`Warning: Could not load renderers from ${i}: ${r}`)),{}}}async function xa(i){let e=rt(i,"index.ts"),t=rt(i,"index.js"),n={datasourceTypes:{},inlineFormats:{}};try{let r;return await on(e)?r=await mf(e,import.meta.url):await on(t)&&(r=await import(pf(t).href)),r?{datasourceTypes:r.datasourceTypes??r.default?.datasourceTypes??{},inlineFormats:r.inlineFormats??r.default?.inlineFormats??{}}:n}catch(r){let s=r instanceof Error?r.message:String(r);return console.warn(j.default.yellow(`Warning: Could not load custom datasources from ${i}: ${s}`)),n}}var cb={init:async i=>{try{console.log(j.default.cyan(`\u{1F4C1} Initializing embedoc...
879
879
  `));let e=[],t=[],n=async(l,c)=>{let f=rt(l);if(!i.force&&await on(f)){t.push(l);return}let h=f.substring(0,f.lastIndexOf("/"));await ab(h,{recursive:!0}),await hf(f,c,{encoding:"utf-8"}),e.push(l)};await n("embedoc.config.yaml",`version: "1.0"
880
880
 
881
881
  targets: