Comparing version 1.25.0 to 1.25.1
@@ -0,1 +1,7 @@ | ||
## 23 January 2020 | ||
### [1.25.1](https://github.com/artdecocode/typal/compare/v1.25.0...v1.25.1) | ||
- [feature] Support `no-embed` attribute and inherit attributes for embedding. | ||
## 22 January 2020 | ||
@@ -2,0 +8,0 @@ |
@@ -73,3 +73,3 @@ #!/usr/bin/env node | ||
boolean:!0, short:"u"}, externs:{description:"Whether to generate externs for _GCC_.", boolean:!0, short:"e"}, types:{description:"Comma-separated location of files to read types from.", short:"t"}, template:{description:"Scans the input file for `@type` comment in functions' JSDoc, and inserts the annotations from types' files.", short:"T"}, migrate:{description:"Extracts types from JavaScript source code and saves them\ninto the types.xml file specified in the output option.", boolean:!0, short:"m"}, | ||
help:{description:"Print the help information and exit.", boolean:!0, short:"h"}, version:{description:"Show the version's number and exit.", boolean:!0, short:"v"}}, x = function(a = {}, b = process.argv) { | ||
help:{description:"Print the help information and exit.", boolean:!0, short:"h"}, version:{description:"Show the version's number and exit.", boolean:!0, short:"v"}}, w = function(a = {}, b = process.argv) { | ||
let [, , ...c] = b; | ||
@@ -86,7 +86,7 @@ const d = ea(c); | ||
try { | ||
const m = l.short, n = l.boolean, p = l.number, q = l.command, r = l.multiple; | ||
if (q && r && d.length) { | ||
const m = l.short, n = l.boolean, p = l.number, r = l.command, q = l.multiple; | ||
if (r && q && d.length) { | ||
k = d; | ||
} else { | ||
if (q && d.length) { | ||
if (r && d.length) { | ||
k = d[0]; | ||
@@ -114,3 +114,3 @@ } else { | ||
return a; | ||
}(fa), y = x.source, z = x.output, ia = x.closure, ja = x.useNamespace, ka = x.externs, la = x.types, ma = x.template, na = x.migrate, oa = x.help, pa = x.version; | ||
}(fa), y = w.source, z = w.output, ia = w.closure, ja = w.useNamespace, ka = w.externs, la = w.types, ma = w.template, na = w.migrate, oa = w.help, pa = w.version; | ||
function qa(a = {usage:{}}) { | ||
@@ -120,3 +120,3 @@ const {usage:b = {}, description:c, line:d, example:e} = a; | ||
const f = Object.values(b), [g] = a.reduce(([k = 0, m = 0], n) => { | ||
const p = b[n].split("\n").reduce((q, r) => r.length > q ? r.length : q, 0); | ||
const p = b[n].split("\n").reduce((r, q) => q.length > r ? q.length : r, 0); | ||
p > m && (m = p); | ||
@@ -132,6 +132,6 @@ n.length > k && (k = n.length); | ||
m = h(m, g); | ||
const [p, ...q] = n; | ||
const [p, ...r] = n; | ||
m = `${m}\t${p}`; | ||
const r = h("", g); | ||
n = q.map(t => `${r}\t${t}`); | ||
const q = h("", g); | ||
n = r.map(t => `${q}\t${t}`); | ||
return [...k, m, ...n]; | ||
@@ -329,3 +329,3 @@ }, []).map(k => `\t${k}`); | ||
} | ||
const M = (a, b) => { | ||
const Pa = (a, b) => { | ||
if (!(b instanceof Error)) { | ||
@@ -344,3 +344,3 @@ throw b; | ||
}; | ||
function Pa(a, b) { | ||
function Qa(a, b) { | ||
function c() { | ||
@@ -361,3 +361,3 @@ return b.filter(Oa).reduce((d, {re:e, replacement:f}) => { | ||
} catch (k) { | ||
M(g, k); | ||
Pa(g, k); | ||
} | ||
@@ -373,3 +373,3 @@ }); | ||
} | ||
;const Qa = a => new RegExp(`%%_RESTREAM_${a.toUpperCase()}_REPLACEMENT_(\\d+)_%%`, "g"), Ra = (a, b) => `%%_RESTREAM_${a.toUpperCase()}_REPLACEMENT_${b}_%%`, Sa = () => { | ||
;const Ra = a => new RegExp(`%%_RESTREAM_${a.toUpperCase()}_REPLACEMENT_(\\d+)_%%`, "g"), Sa = (a, b) => `%%_RESTREAM_${a.toUpperCase()}_REPLACEMENT_${b}_%%`, Ta = () => { | ||
var a = {S:/^\/\*\*? (documentary|typal) (.+?) externs (.*?)\*\/\n(?:([^\n][\s\S]+?\n))?$/mg}; | ||
@@ -379,3 +379,3 @@ return Object.keys(a).reduce((b, c) => { | ||
var d = a[c]; | ||
const {getReplacement:e = Ra, getRegex:f = Qa} = {}, g = f(c); | ||
const {getReplacement:e = Sa, getRegex:f = Ra} = {}, g = f(c); | ||
d = {name:c, re:d, regExp:g, getReplacement:e, map:{}, lastIndex:0}; | ||
@@ -385,3 +385,3 @@ } | ||
}, {}); | ||
}, Ta = a => { | ||
}, Ua = a => { | ||
var b = []; | ||
@@ -392,5 +392,5 @@ const c = a.map; | ||
delete c[e]; | ||
return Pa(d, Array.isArray(b) ? b : [b]); | ||
return Qa(d, Array.isArray(b) ? b : [b]); | ||
}}; | ||
}, Ua = a => { | ||
}, Va = a => { | ||
const b = a.map, c = a.getReplacement, d = a.name; | ||
@@ -404,6 +404,6 @@ return {re:a.re, replacement(e) { | ||
}; | ||
async function Va(a, b) { | ||
return Wa(a, b); | ||
async function Wa(a, b) { | ||
return Xa(a, b); | ||
} | ||
class Xa extends B { | ||
class Ya extends B { | ||
constructor(a, b) { | ||
@@ -416,5 +416,5 @@ super(b); | ||
async replace(a, b) { | ||
const c = new Xa(this.g, this.h); | ||
const c = new Ya(this.g, this.h); | ||
b && Object.assign(c, b); | ||
a = await Va(c, a); | ||
a = await Wa(c, a); | ||
c.j && (this.j = !0); | ||
@@ -447,3 +447,3 @@ b && Object.keys(b).forEach(d => { | ||
} catch (k) { | ||
M(f, k); | ||
Pa(f, k); | ||
} | ||
@@ -456,3 +456,3 @@ }); | ||
} catch (h) { | ||
M(f, h); | ||
Pa(f, h); | ||
} | ||
@@ -476,8 +476,8 @@ } else { | ||
} | ||
async function Wa(a, b) { | ||
async function Xa(a, b) { | ||
b instanceof va ? b.pipe(a) : a.end(b); | ||
return await F(a); | ||
} | ||
;function Ya() { | ||
var a = Za; | ||
;function Za() { | ||
var a = $a; | ||
let b = ""; | ||
@@ -493,3 +493,3 @@ const c = new B({transform(d, e, f) { | ||
} | ||
;const $a = (a, b, c, d) => { | ||
;const ab = (a, b, c, d) => { | ||
if (!a) { | ||
@@ -504,7 +504,7 @@ throw Error("The name of the property is not given"); | ||
return `${a}=${b}`; | ||
}, ab = ({number:a, L:b, boolean:c, type:d}) => b ? "string" : a ? "number" : c ? "boolean" : d ? d : "*", bb = a => `${/[^\w\d._]/.test(a) ? `(${a})` : a}|undefined`, O = a => a ? `/** | ||
}, bb = ({number:a, L:b, boolean:c, type:d}) => b ? "string" : a ? "number" : c ? "boolean" : d ? d : "*", cb = a => `${/[^\w\d._]/.test(a) ? `(${a})` : a}|undefined`, M = a => a ? `/** | ||
${a} | ||
*/ | ||
` : "/**\n */\n", P = a => ` * @suppress {nonStandardJsDocs} | ||
${a}`, cb = (a, b, c) => { | ||
${a}`, db = (a, b, c) => { | ||
a = `${a ? "" : "var "}${a ? `${a}.` : ""}${b}`; | ||
@@ -535,3 +535,3 @@ c && (a += ` = ${c}`); | ||
} | ||
}, db = (a, b, c = null) => { | ||
}, eb = (a, b, c = null) => { | ||
const {async:d, "void":e, "return":f = e ? "void" : "", ...g} = a; | ||
@@ -550,3 +550,3 @@ ({args:a = ""} = a); | ||
} | ||
;function eb(a, b, c) { | ||
;function fb(a, b, c) { | ||
const d = []; | ||
@@ -566,11 +566,11 @@ b.replace(a, (e, ...f) => { | ||
} | ||
;const fb = new RegExp(`${/([^\s>=/]+)/.source}(?:\\s*=\\s*${/(?:"([\s\S]*?)"|'([\s\S]*?)')/.source})?`, "g"), gb = new RegExp(`(?:\\s+((?:${fb.source}\\s*)*))`); | ||
;const gb = new RegExp(`${/([^\s>=/]+)/.source}(?:\\s*=\\s*${/(?:"([\s\S]*?)"|'([\s\S]*?)')/.source})?`, "g"), hb = new RegExp(`(?:\\s+((?:${gb.source}\\s*)*))`); | ||
const S = (a, b) => { | ||
a = (Array.isArray(a) ? a : [a]).join("|"); | ||
return eb(new RegExp(`<(${a})${gb.source}?(?:${/\s*\/>/.source}|${/>([\s\S]+?)?<\/\1>/.source})`, "g"), b, "t a v v1 v2 c".split(" ")).map(({t:c, a:d = "", c:e = ""}) => { | ||
return fb(new RegExp(`<(${a})${hb.source}?(?:${/\s*\/>/.source}|${/>([\s\S]+?)?<\/\1>/.source})`, "g"), b, "t a v v1 v2 c".split(" ")).map(({t:c, a:d = "", c:e = ""}) => { | ||
d = d.replace(/\/$/, "").trim(); | ||
d = hb(d); | ||
d = ib(d); | ||
return {content:e, props:d, tag:c}; | ||
}); | ||
}, hb = a => eb(fb, a, ["key", "val", "def", "f"]).reduce((b, {key:c, val:d}) => { | ||
}, ib = a => fb(gb, a, ["key", "val", "def", "f"]).reduce((b, {key:c, val:d}) => { | ||
if (void 0 === d) { | ||
@@ -582,3 +582,3 @@ return b[c] = !0, b; | ||
}, {}); | ||
const ib = a => a.split(/([!?=*(),:.<>{}|\s+])/g).filter(b => /\S/.test(b)).map(b => { | ||
const jb = a => a.split(/([!?=*(),:.<>{}|\s+])/g).filter(b => /\S/.test(b)).map(b => { | ||
switch(b) { | ||
@@ -600,3 +600,3 @@ case "function": | ||
}); | ||
function jb(a) { | ||
function kb(a) { | ||
let b = 0; | ||
@@ -758,7 +758,7 @@ const c = (e = 1) => a[b + e], d = (e = !0, f = []) => { | ||
} | ||
;function kb(a) { | ||
a = ib(a); | ||
return jb(a); | ||
;function lb(a) { | ||
a = jb(a); | ||
return kb(a); | ||
} | ||
;function lb(a, b, {name:c, string:d, "boolean":e, opt:f, number:g, type:h}, l) { | ||
;function mb(a, b, {name:c, string:d, "boolean":e, opt:f, number:g, type:h}, l) { | ||
if (!c) { | ||
@@ -769,3 +769,3 @@ throw Error("Argument does not have a name."); | ||
b && (a.description = Q(b)); | ||
b = ab({number:g, L:d, boolean:e, type:h}); | ||
b = bb({number:g, L:d, boolean:e, type:h}); | ||
l && (b = b.replace(new RegExp(`([!?])?${l}\\.`, "g"), "$1")); | ||
@@ -776,3 +776,3 @@ b.endsWith("=") && (b = b.replace(/=$/, ""), f = !0); | ||
} | ||
class mb { | ||
class nb { | ||
constructor() { | ||
@@ -788,8 +788,8 @@ this.name = null; | ||
} | ||
const nb = (a, b) => { | ||
const ob = (a, b) => { | ||
let c = a.lastIndexOf("</arg>"), d = a; | ||
var e = []; | ||
-1 != c && (c += 6, e = a.slice(0, c), d = a.slice(c), e = S("arg", e), e = e.map(({content:f, props:g}) => { | ||
const h = new mb; | ||
lb(h, f, g, b); | ||
const h = new nb; | ||
mb(h, f, g, b); | ||
return h; | ||
@@ -855,3 +855,3 @@ })); | ||
return d + c; | ||
}).join("\n"), ob = a => { | ||
}).join("\n"), pb = a => { | ||
const b = a.replace(/^\s*\n/gm, "").split("\n").reduce((c, d) => { | ||
@@ -863,3 +863,3 @@ [{length:d = 0} = {}] = /^\s*/.exec(d) || []; | ||
}; | ||
function pb(a, b = "") { | ||
function qb(a, b = "") { | ||
const c = b.split(/\s*,\s*/); | ||
@@ -869,3 +869,3 @@ return a.split(/\s*,\s*/).map(d => { | ||
if (d = /\/\* start example \*\/\r?\n([\s\S]+?)\r?\n\s*\/\* end example \*\//.exec(d)) { | ||
[, d] = d, e = ob(d); | ||
[, d] = d, e = pb(d); | ||
} | ||
@@ -880,3 +880,3 @@ c.forEach(f => { | ||
} | ||
function qb(a, {O:b = !0, T:c = !0} = {}) { | ||
function rb(a, {O:b = !0, T:c = !0} = {}) { | ||
const d = []; | ||
@@ -902,25 +902,25 @@ b && d.push(" * @example"); | ||
} | ||
function rb(a, b, c = new RegExp(`([!?])?${b}\\.`, "g")) { | ||
function sb(a, b, c = new RegExp(`([!?])?${b}\\.`, "g")) { | ||
b && (a.f && (a.f = a.f.replace(c, "$1")), a.type = a.type.replace(c, "$1")); | ||
} | ||
function sb(a, b = !1) { | ||
function tb(a, b = !1) { | ||
return b ? a.closureType : a.isParsedFunction ? a.toTypeScriptFunction(T) : a.type; | ||
} | ||
function tb(a, b = null, c = !1, d = !1) { | ||
function ub(a, b = null, c = !1, d = !1) { | ||
if (!a.name) { | ||
throw Error("Property does not have a name. Has it been constructed using fromXML?"); | ||
} | ||
b = $a(a.name, a.optional ? a.default : null, a.type, b); | ||
b = ab(a.name, a.optional ? a.default : null, a.type, b); | ||
b = a.optional ? `[${b}]` : b; | ||
var e = a.m; | ||
e = e ? ` ${e}` : ""; | ||
c = `{${sb(a, c)}} ${b}${e}`; | ||
d && (a = qb(a.examples, {O:!1, T:!1}).join("\n").replace(/\*/g, "\uff0a")) && (c += `\n${a}`); | ||
c = `{${tb(a, c)}} ${b}${e}`; | ||
d && (a = rb(a.examples, {O:!1, T:!1}).join("\n").replace(/\*/g, "\uff0a")) && (c += `\n${a}`); | ||
return c; | ||
} | ||
function ub(a, b = !1) { | ||
a = tb(a, null, b, !0); | ||
function vb(a, b = !1) { | ||
a = ub(a, null, b, !0); | ||
return ` * @prop ${U(a, !0)}`; | ||
} | ||
function vb(a, b) { | ||
function wb(a, b) { | ||
const c = [], {function:{args:d, return:e, variableArgs:f, this:g}} = a.parsed; | ||
@@ -932,3 +932,3 @@ d.map(h => T(h)).forEach((h, l) => { | ||
if (f) { | ||
const {M:h, X:l} = wb(a.args || []), k = [h, l].filter(Boolean).join(" "); | ||
const {M:h, X:l} = xb(a.args || []), k = [h, l].filter(Boolean).join(" "); | ||
c.push(` * @param {...${T(f)}} ${k}`); | ||
@@ -946,3 +946,3 @@ } | ||
} | ||
function xb(a) { | ||
function yb(a) { | ||
if (a.isParsedFunction) { | ||
@@ -954,3 +954,3 @@ const {function:{args:b, variableArgs:c}} = a.parsed, d = b.map((e, f) => { | ||
if (c) { | ||
const {M:e} = wb(a.args || []); | ||
const {M:e} = xb(a.args || []); | ||
d.push(`...${e}`); | ||
@@ -966,8 +966,8 @@ } | ||
e && (e = U(e), d.push(...e.split("\n"))); | ||
!a.optional && a.isParsedFunction ? (e = vb(a, c), d.push(...e)) : d.push(` * @type {${a.optional ? bb(a.closureType) : a.closureType}}`); | ||
c && a.examples.length && (a = qb(a.examples), d.push(...a)); | ||
!a.optional && a.isParsedFunction ? (e = wb(a, c), d.push(...e)) : d.push(` * @type {${a.optional ? cb(a.closureType) : a.closureType}}`); | ||
c && a.examples.length && (a = rb(a.examples), d.push(...a)); | ||
b && (d = d.map(f => `${b}${f}`)); | ||
return d.join("\n"); | ||
} | ||
function yb(a, b) { | ||
function zb(a, b) { | ||
const c = Object.assign(Object.create(Object.getPrototypeOf(a)), a); | ||
@@ -978,3 +978,3 @@ c.description = `An alias for \`${a.name}\`.`; | ||
} | ||
class zb { | ||
class Ab { | ||
constructor(a = null) { | ||
@@ -1029,3 +1029,3 @@ this.h = this.description = this.name = null; | ||
} | ||
b(a, {name:b, string:c, "boolean":d, opt:e, number:f, type:g, "default":h, closure:l, alias:k, aliases:m, example:n, "example-override":p = "", noParams:q, "static":r, initial:t, "template-no-return":u}) { | ||
b(a, {name:b, string:c, "boolean":d, opt:e, number:f, type:g, "default":h, closure:l, alias:k, aliases:m, example:n, "example-override":p = "", noParams:r, "static":q, initial:t, "template-no-return":u}) { | ||
if (!b) { | ||
@@ -1036,4 +1036,4 @@ throw Error("Property does not have a name."); | ||
a && (this.description = Q(a)); | ||
a = ab({number:f, L:c, boolean:d, type:g}); | ||
q && (this.s = q); | ||
a = bb({number:f, L:c, boolean:d, type:g}); | ||
r && (this.s = r); | ||
l && (this.f = l); | ||
@@ -1047,4 +1047,4 @@ this.type = a; | ||
m && (this.aliases = m.split(/\s*,\s*/)); | ||
r && (this.g = !0); | ||
n && (this.examples = pb(n, p)); | ||
q && (this.g = !0); | ||
n && (this.examples = qb(n, p)); | ||
u && (this.u = !0); | ||
@@ -1060,3 +1060,3 @@ } | ||
try { | ||
this.parsed = kb(this.closureType), this.isParsedFunction && !this.args && (this.args = []); | ||
this.parsed = lb(this.closureType), this.isParsedFunction && !this.args && (this.args = []); | ||
} catch (b) { | ||
@@ -1080,3 +1080,3 @@ this.parsed = null; | ||
C(a, b = "", c = !1) { | ||
a = tb(this, a, c); | ||
a = ub(this, a, c); | ||
const [d, ...e] = a.split("\n"); | ||
@@ -1086,3 +1086,3 @@ return [`@param ${d}`, ...e].map(f => `${b} * ${f}`).join("\n"); | ||
} | ||
const wb = a => { | ||
const xb = a => { | ||
let b = "args"; | ||
@@ -1093,3 +1093,3 @@ const {name:c = "", description:d} = a[a.length - 1] || {}; | ||
}; | ||
class W extends zb { | ||
class W extends Ab { | ||
constructor(...a) { | ||
@@ -1107,5 +1107,5 @@ super(...a); | ||
} | ||
;function Ab(a, b, c, d) { | ||
;function Bb(a, b, c, d) { | ||
var e = S("prop", a).map(({content:l, props:k}) => { | ||
const m = new zb; | ||
const m = new Ab; | ||
R(k, c); | ||
@@ -1117,8 +1117,8 @@ m.b(l, k); | ||
m = "static" == m; | ||
const {J:n, F:p} = nb(l, b); | ||
const {J:n, F:p} = ob(l, b); | ||
l = new W(p); | ||
const {W:q, H:r} = db(k, p, d); | ||
q.type = r; | ||
R(q, c); | ||
l.b(n, q); | ||
const {W:r, H:q} = eb(k, p, d); | ||
r.type = q; | ||
R(r, c); | ||
l.b(n, r); | ||
m && (l.g = !0); | ||
@@ -1134,3 +1134,3 @@ return l; | ||
} | ||
;const Bb = (a, b, c = {}) => { | ||
;const Cb = (a, b, c = {}) => { | ||
let d; | ||
@@ -1141,3 +1141,3 @@ if ("object" == typeof b) { | ||
try { | ||
(d = kb(b)) || console.log("Could not parse %s", b); | ||
(d = lb(b)) || console.log("Could not parse %s", b); | ||
} catch (e) { | ||
@@ -1178,8 +1178,8 @@ console.log("Could not parse %s", b), console.error(e.message); | ||
return `${g}: ${h}`; | ||
}), e += d.join(", "), e += " }") : a.application ? (e += Cb(a.name, b, f, c) + "<", d = a.application.map(g => X(g, b, c)), e += d.join(", "), e += ">") : a.union ? (e = e + f + "(", f = a.union.map(g => X(g, b, c)), e += f.join(d ? " \\| " : " | "), e += ")") : e += Cb("any" == a.name ? "*" : a.name, b, f, c); | ||
}), e += d.join(", "), e += " }") : a.application ? (e += Db(a.name, b, f, c) + "<", d = a.application.map(g => X(g, b, c)), e += d.join(", "), e += ">") : a.union ? (e = e + f + "(", f = a.union.map(g => X(g, b, c)), e += f.join(d ? " \\| " : " | "), e += ")") : e += Db("any" == a.name ? "*" : a.name, b, f, c); | ||
} | ||
return e; | ||
}, Cb = (a, b, c = "", d = {}) => { | ||
}, Db = (a, b, c = "", d = {}) => { | ||
const {flatten:e = !1, nameProcess:f, link:g = ({link:k}) => `#${k}`} = d; | ||
d = Db(b, a); | ||
d = Eb(b, a); | ||
c = `${c}${a}`; | ||
@@ -1194,3 +1194,3 @@ if (!d) { | ||
return l ? `<a href="${h}" title="${l.replace(/"/g, """)}">${b}</a>` : `[${b}](${h})`; | ||
}, Db = (a, b) => { | ||
}, Eb = (a, b) => { | ||
a = a.filter(({fullName:d}) => d == b); | ||
@@ -1203,3 +1203,3 @@ if (a.length) { | ||
}; | ||
function Eb(a, b = [], c = [], d = {}) { | ||
function Fb(a, b = [], c = [], d = {}) { | ||
const {narrow:e = !1, preprocessDesc:f} = d; | ||
@@ -1211,8 +1211,8 @@ if (!b.length) { | ||
let k; | ||
const m = n => Bb(c, n, {...l, nameProcess:d.nameProcess ? p => d.nameProcess(p, k) : void 0}); | ||
const m = n => Cb(c, n, {...l, nameProcess:d.nameProcess ? p => d.nameProcess(p, k) : void 0}); | ||
a = b.map((n, p) => { | ||
k = 0 < (p + 1) % 2; | ||
p = n.args && n.isParsedFunction ? n.toTypeScriptFunction(m) : m(n.parsed || n.type); | ||
const q = g || n.optional ? n.name : `${n.name}*`, r = n.hasDefault ? `\`${n.default}\`` : "-", t = f ? f(n.description) : n.description; | ||
return {prop:n, typeName:p, name:q, de:Fb(t, !e), d:r, Z:k}; | ||
const r = g || n.optional ? n.name : `${n.name}*`, q = n.hasDefault ? `\`${n.default}\`` : "-", t = f ? f(n.description) : n.description; | ||
return {prop:n, typeName:p, name:r, de:Gb(t, !e), d:q, Z:k}; | ||
}); | ||
@@ -1222,3 +1222,3 @@ if (e) { | ||
} | ||
a = a.map(({name:n, typeName:p, de:q, d:r, prop:t}) => [t.optional ? n : `__${n}__`, `<em>${p}</em>`, q, ...h ? [r] : []]); | ||
a = a.map(({name:n, typeName:p, de:r, d:q, prop:t}) => [t.optional ? n : `__${n}__`, `<em>${p}</em>`, r, ...h ? [q] : []]); | ||
b = ["Name", ...e ? ["Type & Description"] : ["Type", "Description"], ...h ? [g ? "Initial" : "Default"] : []]; | ||
@@ -1231,3 +1231,3 @@ return ` | ||
} | ||
const Fb = (a = "", b = !0) => { | ||
const Gb = (a = "", b = !0) => { | ||
null === a && (a = ""); | ||
@@ -1237,3 +1237,3 @@ b && (a = a.replace(/\|/g, "\\|")); | ||
}; | ||
const Gb = (a, b, c = {}) => { | ||
const Hb = (a, b, c = {}) => { | ||
function d(e) { | ||
@@ -1243,3 +1243,3 @@ e.replace(/^!?/, ""); | ||
} | ||
return a.split(/,\s*/).map(e => Bb(b, e, {flatten:!0, ...c, nameProcess:c.nameProcess ? f => { | ||
return a.split(/,\s*/).map(e => Cb(b, e, {flatten:!0, ...c, nameProcess:c.nameProcess ? f => { | ||
f = c.nameProcess(f); | ||
@@ -1249,9 +1249,9 @@ return /[_*~>]/.test(f) ? `<code>${f}</code>` : d(f); | ||
}; | ||
function Hb(a) { | ||
function Ib(a) { | ||
var b = a.h(); | ||
b = O(b.join("\n")); | ||
b += cb(a.namespace, a.name, Ib(a)); | ||
b = M(b.join("\n")); | ||
b += db(a.namespace, a.name, Jb(a)); | ||
const c = a.properties.reduce((d, e) => { | ||
d.push(e); | ||
const f = e.aliases.map(g => yb(e, g)); | ||
const f = e.aliases.map(g => zb(e, g)); | ||
d.push(...f); | ||
@@ -1261,14 +1261,14 @@ return d; | ||
let e = V(d); | ||
e = O(e); | ||
e += cb(`${a.fullName}${d.static ? "" : ".prototype"}`, d.name); | ||
return e += xb(d); | ||
e = M(e); | ||
e += db(`${a.fullName}${d.static ? "" : ".prototype"}`, d.name); | ||
return e += yb(d); | ||
}); | ||
return [b, ...c].join("\n"); | ||
} | ||
function Jb(a, b = !1) { | ||
function Kb(a, b = !1) { | ||
const c = `${a.extends ? "$" : ""}${a.name}`; | ||
return b ? `${a.ns}${c}` : c; | ||
} | ||
function Kb(a, b = !1, c = !1, d = b) { | ||
d = ` * @typedef {${(b ? a.closureType : a.type) || a.s()}}${` ${Jb(a, d)}${a.l}`}`; | ||
function Lb(a, b = !1, c = !1, d = b) { | ||
d = ` * @typedef {${(b ? a.closureType : a.type) || a.s()}}${` ${Kb(a, d)}${a.l}`}`; | ||
a = (a.properties ? a.properties.reduce((e, f) => { | ||
@@ -1279,11 +1279,11 @@ if (f.g) { | ||
e.push(f); | ||
const g = f.aliases.map(h => yb(f, h)); | ||
const g = f.aliases.map(h => zb(f, h)); | ||
e.push(...g); | ||
return e; | ||
}, []) : []).filter(e => e instanceof W ? !e.isConstructor : !0).map(e => ub(e, b)); | ||
}, []) : []).filter(e => e instanceof W ? !e.isConstructor : !0).map(e => vb(e, b)); | ||
a = [d, ...a].join("\n"); | ||
b && !c && (a = P(a)); | ||
return a = O(a); | ||
return a = M(a); | ||
} | ||
function Ib(a) { | ||
function Jb(a) { | ||
return a.args ? `function(${a.args.filter(({name:b}) => "this" != b).map(({name:b}) => b).join(", ")}) {}` : null; | ||
@@ -1307,3 +1307,3 @@ } | ||
} | ||
b(a, {name:b, type:c, desc:d, noToc:e, spread:f, noExpand:g, link:h, closure:l, constructor:k, "extends":m, "interface":n, record:p, example:q, "example-override":r}, t, u = null) { | ||
b(a, {name:b, type:c, desc:d, noToc:e, spread:f, noExpand:g, link:h, closure:l, constructor:k, "extends":m, "interface":n, record:p, example:r, "example-override":q}, t, u = null) { | ||
if (!b) { | ||
@@ -1326,7 +1326,7 @@ throw Error("Type does not have a name."); | ||
if (a) { | ||
const {properties:v, constructor:w} = Ab(a, u, this.file, this.fullName); | ||
w && (this.args = w.args); | ||
const {properties:v, constructor:x} = Bb(a, u, this.file, this.fullName); | ||
x && (this.args = x.args); | ||
this.properties = v; | ||
} | ||
q && (a = {example:q}, R(a, this.file), this.examples = pb(a.example, r)); | ||
r && (a = {example:r}, R(a, this.file), this.examples = qb(a.example, q)); | ||
} | ||
@@ -1348,12 +1348,12 @@ get u() { | ||
g(a = !1, b = !1, c = a) { | ||
const d = !!this.extends, e = Kb(this, a, b, c), f = []; | ||
const d = !!this.extends, e = Lb(this, a, b, c), f = []; | ||
if (this.namespace && a) { | ||
var g = ` * @typedef {${this.fullName}} ${this.name}${this.l}`; | ||
a && !b && (g = P(g)); | ||
g = O(g); | ||
g = M(g); | ||
f.push(g); | ||
} else { | ||
this.namespace && c && (g = ` * @typedef {${this.fullName}} ${this.name}${this.l}`, g = O(g), f.push(g)); | ||
this.namespace && c && (g = ` * @typedef {${this.fullName}} ${this.name}${this.l}`, g = M(g), f.push(g)); | ||
} | ||
d && (c = ` * @typedef {${Jb(this, c)} & ${this.extends.split(/,\s*/).join(" & ")}} ${c ? this.fullName : this.name}${this.l}`, a && !b && (c = P(c)), c = O(c), f.push(c)); | ||
d && (c = ` * @typedef {${Kb(this, c)} & ${this.extends.split(/,\s*/).join(" & ")}} ${c ? this.fullName : this.name}${this.l}`, a && !b && (c = P(c)), c = M(c), f.push(c)); | ||
f.push(e); | ||
@@ -1394,3 +1394,3 @@ return f.join(""); | ||
b && d.push(` * @${this.U}`); | ||
c && this.examples.length && (b = qb(this.examples), d.push(...b)); | ||
c && this.examples.length && (b = rb(this.examples), d.push(...b)); | ||
a && (d = d.map(f => `${a}${f}`)); | ||
@@ -1409,3 +1409,3 @@ return d; | ||
d = this.description ? ` ${this.description}` : ""; | ||
const h = this.spread ? Lb(this.properties) : e || f ? this.fullName : this.name; | ||
const h = this.spread ? Mb(this.properties) : e || f ? this.fullName : this.name; | ||
b = `${c || ""} * @param {${g}${h}} ${b ? `[${a}]` : a}${d}`; | ||
@@ -1418,4 +1418,4 @@ g = this.properties && !this.noExpand ? this.properties.map(l => l.C(a, c, e, f)) : []; | ||
var f = this.type ? `\`${this.type}\`` : "", g = f; | ||
this.link ? g = `[${f}](${this.link})` : !this.import && this.type && (g = Bb(a, this.type, b), f = g != this.type, g = Mb(g, f)); | ||
f = Mb(this.fullName); | ||
this.link ? g = `[${f}](${this.link})` : !this.import && this.type && (g = Cb(a, this.type, b), f = g != this.type, g = Nb(g, f)); | ||
f = Nb(this.fullName); | ||
f = this.import ? `[${f}](l-type)` : this.noToc ? `[${f}](l-type)` : `[${f}](t-type)`; | ||
@@ -1426,3 +1426,3 @@ const h = this.description ? `: ${this.description}` : ""; | ||
if (this.extends) { | ||
const k = Gb(this.extends, a, b), m = ` extends ${k}`; | ||
const k = Hb(this.extends, a, b), m = ` extends ${k}`; | ||
l = l || /_/.test(k); | ||
@@ -1435,7 +1435,7 @@ g = (l ? g + "<strong>" : g + "__") + (f + m); | ||
g = (l ? g + "</strong>" : g + "__") + h; | ||
a = Eb(this, this.properties, a, b); | ||
a = Fb(this, this.properties, a, b); | ||
return {LINE:g, table:a, displayInDetails:e}; | ||
} | ||
} | ||
const Mb = (a, b = !1) => `${b ? "<code>" : "`"}${a}${b ? "</code>" : "`"}`, Lb = (a = [], b = !1) => { | ||
const Nb = (a, b = !1) => `${b ? "<code>" : "`"}${a}${b ? "</code>" : "`"}`, Mb = (a = [], b = !1) => { | ||
a = a.reduce((c, d) => { | ||
@@ -1450,7 +1450,7 @@ c.push(d); | ||
let e = c.name, f = d; | ||
c.optional && !b ? e = `${c.name}?` : c.optional && b && (f = `(${bb(d)})`); | ||
c.optional && !b ? e = `${c.name}?` : c.optional && b && (f = `(${cb(d)})`); | ||
return `${e}: ${f}`; | ||
}).join(", ")} }`; | ||
}; | ||
class Nb extends Y { | ||
class Ob extends Y { | ||
constructor() { | ||
@@ -1475,7 +1475,7 @@ super(); | ||
} | ||
;function Ob(a, b) { | ||
;function Pb(a, b) { | ||
b = b.reduce((c, d) => ({...c, [d.fullName]:d}), {}); | ||
a.A = {...a.A, ...b}; | ||
} | ||
class Pb extends Xa { | ||
class Qb extends Ya { | ||
constructor(a, b = {}) { | ||
@@ -1485,3 +1485,3 @@ super(a); | ||
this.on("types", c => { | ||
Ob(this, c); | ||
Pb(this, c); | ||
}); | ||
@@ -1501,3 +1501,3 @@ this.on("namespace", c => { | ||
static get Import() { | ||
return Nb; | ||
return Ob; | ||
} | ||
@@ -1508,3 +1508,3 @@ get types() { | ||
} | ||
;class Qb extends Y { | ||
;class Rb extends Y { | ||
constructor() { | ||
@@ -1546,9 +1546,9 @@ super(); | ||
} | ||
;const Rb = (a, b) => { | ||
;const Sb = (a, b) => { | ||
const c = new RegExp(`([!?])?${a}\\.`, "g"); | ||
b.properties.forEach(d => { | ||
rb(d, a, c); | ||
sb(d, a, c); | ||
}); | ||
b.m(a); | ||
}, Sb = (a, b) => { | ||
}, Tb = (a, b) => { | ||
var {args:c = []} = a, d = c.map(({I:f}) => f).join(", "); | ||
@@ -1562,5 +1562,5 @@ let e = `new: ${a.fullName}`; | ||
c.examples = a.examples; | ||
rb(c, b); | ||
sb(c, b); | ||
a.properties.unshift(c); | ||
}, Ub = (a, b, c = null) => { | ||
}, Vb = (a, b, c = null) => { | ||
a = S("types", a); | ||
@@ -1574,5 +1574,5 @@ if (!a.length) { | ||
"record" == p && (p = "type", n.record = !0); | ||
const {alias:q, aliases:r, ...t} = n; | ||
const {alias:r, aliases:q, ...t} = n; | ||
c && R(t, c); | ||
var u = q ? [q] : r ? r.split(/, */) : []; | ||
var u = r ? [r] : q ? q.split(/, */) : []; | ||
switch(p) { | ||
@@ -1585,12 +1585,12 @@ case "type": | ||
u.forEach(v => { | ||
const w = new Y; | ||
c && (w.file = c); | ||
w.b(m, {...t, name:v}, g, b); | ||
k.push(w); | ||
const x = new Y; | ||
c && (x.file = c); | ||
x.b(m, {...t, name:v}, g, b); | ||
k.push(x); | ||
}); | ||
break; | ||
case "interface": | ||
n = Tb({content:m, props:n, ns:g, B:b, location:c}); | ||
n = Ub({content:m, props:n, ns:g, B:b, location:c}); | ||
n.forEach(v => { | ||
v.properties.some(({isConstructor:w}) => w) || Sb(v, b); | ||
v.properties.some(({isConstructor:x}) => x) || Tb(v, b); | ||
v.isInterface = !0; | ||
@@ -1601,5 +1601,5 @@ }); | ||
case "constructor": | ||
n = Tb({content:m, props:n, ns:g, B:b, location:c}); | ||
n = Ub({content:m, props:n, ns:g, B:b, location:c}); | ||
n.forEach(v => { | ||
v.properties.some(({isConstructor:w}) => w) || Sb(v, b); | ||
v.properties.some(({isConstructor:x}) => x) || Tb(v, b); | ||
v.isConstructor = !0; | ||
@@ -1610,14 +1610,14 @@ }); | ||
case "method": | ||
n = Tb({content:m, props:n, ns:g, B:b, isMethod:!0, location:c}); | ||
n = Ub({content:m, props:n, ns:g, B:b, isMethod:!0, location:c}); | ||
k.push(...n); | ||
break; | ||
case "import": | ||
u = new Nb, u.b(m, n, n.ns || n.from, b), h.push(u); | ||
u = new Ob, u.b(m, n, n.ns || n.from, b), h.push(u); | ||
} | ||
return k; | ||
}, []); | ||
b && l.forEach(k => Rb(b, k)); | ||
b && l.forEach(k => Sb(b, k)); | ||
return {namespace:f, types:l, imports:h, embeds:a}; | ||
}, Vb = (a, b, c, d, e = !1, f = null) => { | ||
const g = e ? new Qb : new Y; | ||
}, Wb = (a, b, c, d, e = !1, f = null) => { | ||
const g = e ? new Rb : new Y; | ||
g.file = f; | ||
@@ -1627,14 +1627,14 @@ f = a.search(/<(prop|function|fn|static) /); | ||
1 != f && (h = a.slice(0, f), l = a.slice(f)); | ||
const {F:k, J:m} = nb(h, d); | ||
const {F:k, J:m} = ob(h, d); | ||
g.b(e ? m : l, b, c, d); | ||
({H:a} = db(b, k)); | ||
({H:a} = eb(b, k)); | ||
e && (g.closureType = a); | ||
g.args || (g.args = k); | ||
return g; | ||
}, Tb = ({content:a, props:b, ns:c, B:d, isMethod:e = !1, location:f = null}) => { | ||
}, Ub = ({content:a, props:b, ns:c, B:d, isMethod:e = !1, location:f = null}) => { | ||
const g = [], {alias:h, aliases:l, ...k} = b; | ||
b = Vb(a, b, c, d, e, f); | ||
b = Wb(a, b, c, d, e, f); | ||
g.push(b); | ||
(h ? [h] : l ? l.split(/, */) : []).forEach(m => { | ||
m = Vb(a, {...k, name:m}, c, d, e, f); | ||
m = Wb(a, {...k, name:m}, c, d, e, f); | ||
m.description = `${m.description}${m.description ? " " : ""}Alias of \`${k.name}\`.`; | ||
@@ -1644,7 +1644,7 @@ g.push(m); | ||
return g; | ||
}, Wb = async(a, b = []) => { | ||
}, Xb = async(a, b = []) => { | ||
const c = await G(a); | ||
let d, e, f, g; | ||
try { | ||
({namespace:d = null, types:e, imports:f, embeds:g} = Ub(c, void 0, a)); | ||
({namespace:d = null, types:e, imports:f, embeds:g} = Vb(c, void 0, a)); | ||
} catch (h) { | ||
@@ -1657,15 +1657,15 @@ throw h.message = `Error while reading ${a}\n${h.message}`, h; | ||
}; | ||
const Xb = (a, b, c) => { | ||
const Yb = (a, b, c) => { | ||
b = b.map(d => d.g(!0, c)); | ||
a = a.map(d => { | ||
d = d.g(); | ||
return O(c ? d : P(d)); | ||
return M(c ? d : P(d)); | ||
}); | ||
return [...b, ...a].join(""); | ||
}, Yb = (a, b, c, d = !1) => { | ||
}, Zb = (a, b, c, d = !1) => { | ||
a = [...a.map(e => { | ||
{ | ||
let f; | ||
e.closureType ? f = ` * @typedef {${e.closureType}}` : e.u || (f = ` * @typedef {${Lb(e.properties, !0)}}`); | ||
f ? (e.description && (f = ` * ${e.description}\n${f}`), f = O(f), e = f += cb(e.namespace, e.name)) : e = Hb(e); | ||
e.closureType ? f = ` * @typedef {${e.closureType}}` : e.u || (f = ` * @typedef {${Mb(e.properties, !0)}}`); | ||
f ? (e.description && (f = ` * ${e.description}\n${f}`), f = M(f), e = f += db(e.namespace, e.name)) : e = Ib(e); | ||
} | ||
@@ -1678,26 +1678,30 @@ return e; | ||
}; | ||
async function Zb(a, b, c) { | ||
const [d, ...e] = c.split(/\s+/), f = e.includes("closure"), g = e.includes("externs"), h = e.includes("noSuppress"), l = e.includes("skipNsDecl"), k = e.includes("namespace"); | ||
let m = e.find(q => q.startsWith("ignore:")); | ||
m = m ? m.replace("ignore:", "").split(",") : []; | ||
let {o:n, w:p} = this.f; | ||
f && (n = !0); | ||
g && (p = !0); | ||
async function $b(a, b, c) { | ||
const [d, ...e] = c.split(/\s+/); | ||
var f = e.includes("closure"); | ||
const g = e.includes("externs"), h = e.includes("noSuppress"), l = e.includes("skipNsDecl"), k = e.includes("namespace"), m = e.includes("noEmbed") || e.includes("no-embed"); | ||
let n = e.find(q => q.startsWith("ignore:")); | ||
n = n ? n.replace("ignore:", "").split(",") : []; | ||
let {o:p, w:r} = this.f; | ||
f && (p = !0); | ||
g && (r = !0); | ||
try { | ||
this.i("Detected type marker: %s", c); | ||
const {types:q, imports:r, namespace:t, embeds:u} = await Wb(d, m); | ||
const {types:q, imports:t, namespace:u, embeds:v} = await Xb(d, n); | ||
this.emit("types", q); | ||
this.emit("types", r); | ||
let v = (await Promise.all(u.map(async({src:C, path:fc = C, ignore:N, namespace:gc, o:hc, w:ic, "no-suppress":jc}) => { | ||
C = [fc]; | ||
this.emit("types", t); | ||
f = []; | ||
m || (f = await Promise.all(v.map(async({src:C, path:gc = C, ignore:N = n.join(","), namespace:hc = k, o:ic = p, w:jc = r, "no-suppress":kc = h}) => { | ||
C = [gc]; | ||
N && C.push(`ignore:${N}`); | ||
gc && C.push("namespace"); | ||
hc && C.push("closure"); | ||
ic && C.push("ext"); | ||
jc && C.push("noSuppress"); | ||
hc && C.push("namespace"); | ||
ic && C.push("closure"); | ||
jc && C.push("ext"); | ||
kc && C.push("noSuppress"); | ||
N = C.join(" "); | ||
return await Zb.call(this, `\n /* typal-embed ${N} */\n`, "typal-embed", N); | ||
}))).join(""), w; | ||
n ? w = Xb(r, q, h) : p ? (w = Yb(q, t, this.b, l) + "\n", t && this.emit("namespace", t)) : k ? (t && this.emit("namespace", t), w = $b(r, q, !0)) : w = $b(r, q); | ||
return `/* ${b} ${c} */\n${w}${v}`; | ||
return await $b.call(this, `\n /* typal-embed ${N} */\n`, "typal-embed", N); | ||
}))); | ||
let x = f.join(""), O; | ||
p ? O = Yb(t, q, h) : r ? (O = Zb(q, u, this.b, l) + "\n", u && this.emit("namespace", u)) : k ? (u && this.emit("namespace", u), O = ac(t, q, !0)) : O = ac(t, q); | ||
return `/* ${b} ${c} */\n${O}${x}`; | ||
} catch (q) { | ||
@@ -1707,10 +1711,10 @@ return this.i("(%s) Could not process typedef-js: %s", c, q.message), process.env.b && console.error(q.stack), a; | ||
} | ||
const ac = {re:/^\/\*\*? (documentary|typal) (.+?) \*\/\n(?:([^\n][\s\S]+?\n))?$/mg, replacement:Zb}, $b = (a, b, c = !1) => { | ||
const bc = {re:/^\/\*\*? (documentary|typal) (.+?) \*\/\n(?:([^\n][\s\S]+?\n))?$/mg, replacement:$b}, ac = (a, b, c = !1) => { | ||
b = b.map(d => d.g(!1, !1, c)); | ||
a = a.map(d => d.g(c)).map(O).join(""); | ||
a = a.map(d => d.g(c)).map(M).join(""); | ||
b = b.join(""); | ||
return `${a}${b}`.replace(bc, " * @typedef"); | ||
}, bc = / \*\/\n\/\*\*\n \* @typedef/g; | ||
const dc = {re:/( *) \* @param {(.+?)} (\[)?([^\s\]]+)\]?(?: .+)?((?:\n(?: +)\* @param {(?:.+?)} \[?\4\]?(?:(?!\n\s*\*(?:\/|\s*@))[\s\S])*)*)/gm, replacement:cc}; | ||
function cc(a, b, c, d, e, f, g) { | ||
return `${a}${b}`.replace(cc, " * @typedef"); | ||
}, cc = / \*\/\n\/\*\*\n \* @typedef/g; | ||
const ec = {re:/( *) \* @param {(.+?)} (\[)?([^\s\]]+)\]?(?: .+)?((?:\n(?: +)\* @param {(?:.+?)} \[?\4\]?(?:(?!\n\s*\*(?:\/|\s*@))[\s\S])*)*)/gm, replacement:dc}; | ||
function dc(a, b, c, d, e, f, g) { | ||
const h = this.f.o, l = this.f.D; | ||
@@ -1722,14 +1726,14 @@ let k; | ||
{ | ||
let r = n = 0; | ||
for (; r < g;) { | ||
r += this.lines[n].length, n++; | ||
let q = n = 0; | ||
for (; q < g;) { | ||
q += this.lines[n].length, n++; | ||
} | ||
n = {line:n, P:b.length + 11}; | ||
} | ||
const {line:p, P:q} = n; | ||
this.i("%s:%s:%s", this.file, p, q); | ||
const {line:p, P:r} = n; | ||
this.i("%s:%s:%s", this.file, p, r); | ||
} | ||
}; | ||
try { | ||
k = kb(c); | ||
k = lb(c); | ||
} catch (n) { | ||
@@ -1746,3 +1750,3 @@ return this.i("Error while parsing the type %s", c), this.i(process.env.DEBUG ? n.stack : n.message), f(), a; | ||
c = Object.values(this.types).find(({name:n, fullName:p}) => h || l ? p == k.name : n == k.name); | ||
return !c || c instanceof Pb.Import ? a : c.C(e, d, b, k.nullable, h, l); | ||
return !c || c instanceof Qb.Import ? a : c.C(e, d, b, k.nullable, h, l); | ||
} | ||
@@ -1755,3 +1759,3 @@ const Z = (a, b, c, d, e) => { | ||
let h = b.includes(f); | ||
h || (h = ec.includes(f)); | ||
h || (h = fc.includes(f)); | ||
if (h) { | ||
@@ -1775,10 +1779,10 @@ return !0; | ||
} | ||
}, ec = "String Boolean Object Date Number Symbol Buffer Function".split(" "); | ||
var kc = (a, b = !1) => { | ||
var {S:c} = Sa(); | ||
const d = Ua(c); | ||
c = Ta(c); | ||
return new Pb(b ? [ac] : [ac, d, dc, c], a); | ||
}, fc = "String Boolean Object Date Number Symbol Buffer Function".split(" "); | ||
var lc = (a, b = !1) => { | ||
var {S:c} = Ta(); | ||
const d = Va(c); | ||
c = Ua(c); | ||
return new Qb(b ? [bc] : [bc, d, ec, c], a); | ||
}; | ||
const lc = /( *) \* @(fnType|methodType) {(.+?)}/gm, mc = (a, b, c, d, e, f, g = d) => `/** | ||
const mc = /( *) \* @(fnType|methodType) {(.+?)}/gm, nc = (a, b, c, d, e, f, g = d) => `/** | ||
${a} | ||
@@ -1789,3 +1793,3 @@ */ | ||
}`; | ||
class nc extends Xa { | ||
class oc extends Ya { | ||
constructor(a, b) { | ||
@@ -1800,8 +1804,8 @@ super([{re:/\/\*\*\s+( *) \* @constructor {(.+?)}[\s\S]+?(class\s+.+?\s+extends\s+(.+?)\s*){\s*}/gm, replacement(c, d, e, f, g) { | ||
var n = k.aliases; | ||
const p = k.static, q = k.async; | ||
let r = V(k, "", !0); | ||
r = oc(r, e); | ||
const p = k.static, r = k.async; | ||
let q = V(k, "", !0); | ||
q = pc(q, e); | ||
const t = k.args.map(({name:u}) => u).join(", "); | ||
k = mc(r, p, q, m, t, g); | ||
n = n.map(u => mc(r + `\n * @alias ${m} An alias for **${m}**.`, p, q, u, t, g, m)); | ||
k = nc(q, p, r, m, t, g); | ||
n = n.map(u => nc(q + `\n * @alias ${m} An alias for **${m}**.`, p, r, u, t, g, m)); | ||
return [k, ...n].join("\n"); | ||
@@ -1811,3 +1815,3 @@ }); | ||
c = [`/** | ||
${oc(V(h, "", !0), e)} | ||
${pc(V(h, "", !0), e)} | ||
*/ | ||
@@ -1824,3 +1828,3 @@ constructor(${l}) { | ||
return f; | ||
}}, {re:lc, async replacement(c, d, e, f) { | ||
}}, {re:mc, async replacement(c, d, e, f) { | ||
const g = f.split("."); | ||
@@ -1853,4 +1857,4 @@ let h, l; | ||
} | ||
const oc = (a, b) => a.replace(`\n * @return {${b}}`, "").replace(`\n * @return {!${b}}`, "").replace(`\n * @return {?${b}}`, ""); | ||
const pc = async a => a ? (await Promise.all(a.split(",").map(async b => { | ||
const pc = (a, b) => a.replace(`\n * @return {${b}}`, "").replace(`\n * @return {!${b}}`, "").replace(`\n * @return {?${b}}`, ""); | ||
const qc = async a => a ? (await Promise.all(a.split(",").map(async b => { | ||
var c = []; | ||
@@ -1860,3 +1864,3 @@ const d = await I(A, b); | ||
return c; | ||
}))).reduce((b, c) => [...b, ...c], []) : [], qc = async a => (await Promise.all(a.map(async b => ({...await Wb(b), location:b})))).reduce((b, {imports:c, types:d}) => { | ||
}))).reduce((b, c) => [...b, ...c], []) : [], rc = async a => (await Promise.all(a.map(async b => ({...await Xb(b), location:b})))).reduce((b, {imports:c, types:d}) => { | ||
b.push(...c); | ||
@@ -1866,4 +1870,4 @@ b.push(...d); | ||
}, []); | ||
async function rc() { | ||
const a = await pc(la), b = await qc(a); | ||
async function sc() { | ||
const a = await qc(la), b = await rc(a); | ||
await Promise.all(y.map(async c => { | ||
@@ -1873,9 +1877,9 @@ var d = await I(A, c); | ||
d.isFile() ? e = [c] : d.isDirectory() && (d = await K(c), e = L(d.content, c)); | ||
await sc(e, b, ma); | ||
await tc(e, b, ma); | ||
})); | ||
} | ||
const sc = async(a, b = [], c = null) => { | ||
const tc = async(a, b = [], c = null) => { | ||
await Promise.all(a.map(async d => { | ||
var e = await G(d); | ||
const f = new nc(b, d); | ||
const f = new oc(b, d); | ||
f.end(e); | ||
@@ -1886,4 +1890,4 @@ e = await F(f); | ||
}; | ||
var uc = async() => { | ||
const {o:a = !1, D:b = !1, w:c = !1, V:d, types:e} = {o:ia, w:ka, V:z, types:la, D:ja}, f = await pc(e); | ||
var vc = async() => { | ||
const {o:a = !1, D:b = !1, w:c = !1, V:d, types:e} = {o:ia, w:ka, V:z, types:la, D:ja}, f = await qc(e); | ||
await Promise.all(y.map(async g => { | ||
@@ -1893,10 +1897,10 @@ var h = await I(A, g); | ||
h.isFile() ? l = [g] : h.isDirectory() && (h = await K(g), l = L(h.content, g)); | ||
await tc(l, a, c, d, f, b); | ||
await uc(l, a, c, d, f, b); | ||
})); | ||
}; | ||
const tc = async(a, b = !1, c = !1, d = "", e = [], f = !1) => { | ||
const uc = async(a, b = !1, c = !1, d = "", e = [], f = !1) => { | ||
const g = []; | ||
await Promise.all(e.map(async h => { | ||
h = await G(h); | ||
const {types:l, imports:k} = Ub(h); | ||
const {types:l, imports:k} = Vb(h); | ||
g.push(l, k); | ||
@@ -1906,3 +1910,3 @@ })); | ||
var l = await G(h); | ||
const k = kc({o:b, w:c, D:f}, c); | ||
const k = lc({o:b, w:c, D:f}, c); | ||
g.forEach(m => k.emit("types", m)); | ||
@@ -1917,7 +1921,7 @@ k.file = h; | ||
}; | ||
const vc = a => { | ||
const wc = a => { | ||
let b; | ||
"true" == a ? b = !0 : "false" == a ? b = !1 : /^\d+$/.test(a) && (b = parseInt(a, 10)); | ||
return void 0 !== b ? b : a; | ||
}, wc = /^ \* @prop {(.+?)} (\[)?(.+?)(?:=(["'])?(.+?)\4)?(?:])?(?: (.+?))?(?: Default `(.+?)`.)?$/gm, xc = "type opt name quote defaultValue description Default".split(" "), Za = new RegExp(`^ \\* @typedef {(.+?)} (.+?)(?: (.+))?\\n((?:${/ \* @prop(?:erty)? .+\n/.source})*)`, "gm"), yc = (a, b, c, d) => { | ||
}, xc = /^ \* @prop {(.+?)} (\[)?(.+?)(?:=(["'])?(.+?)\4)?(?:])?(?: (.+?))?(?: Default `(.+?)`.)?$/gm, yc = "type opt name quote defaultValue description Default".split(" "), $a = new RegExp(`^ \\* @typedef {(.+?)} (.+?)(?: (.+))?\\n((?:${/ \* @prop(?:erty)? .+\n/.source})*)`, "gm"), zc = (a, b, c, d) => { | ||
d = d.length; | ||
@@ -1928,3 +1932,3 @@ a = a && "Object" != a ? ` type="${a}"` : ""; | ||
}; | ||
class zc extends B { | ||
class Ac extends B { | ||
constructor() { | ||
@@ -1934,3 +1938,3 @@ super({writableObjectMode:!0}); | ||
_transform({type:a, name:b, description:c, properties:d}, e, f) { | ||
a = a && a.startsWith("import") ? Ac(a, b) : yc(a, b, c, d); | ||
a = a && a.startsWith("import") ? Bc(a, b) : zc(a, b, c, d); | ||
this.push(a); | ||
@@ -1953,3 +1957,3 @@ d.forEach(({type:g, name:h, default:l, description:k, optional:m}) => { | ||
} | ||
const Ac = (a, b) => { | ||
const Bc = (a, b) => { | ||
const c = /import\((['"])(.+?)\1\)/.exec(a); | ||
@@ -1962,3 +1966,3 @@ if (!c) { | ||
}; | ||
class Bc extends B { | ||
class Cc extends B { | ||
constructor() { | ||
@@ -1968,11 +1972,11 @@ super({objectMode:!0}); | ||
_transform([, a, b, c, d], e, f) { | ||
d = eb(wc, d, xc).map(g => { | ||
d = fb(xc, d, yc).map(g => { | ||
const {defaultValue:h, Default:l, opt:k, name:m, type:n, ...p} = g; | ||
g = {...p, name:m, type:n, ...h ? {defaultValue:vc(h)} : {}, ...l ? {v:vc(l)} : {}, ...k ? {optional:!0} : {}}; | ||
g = {...p, name:m, type:n, ...h ? {defaultValue:wc(h)} : {}, ...l ? {v:wc(l)} : {}, ...k ? {optional:!0} : {}}; | ||
if (h || l) { | ||
if (h) { | ||
h !== l && void 0 !== g.v && (q = $a(m, l, n), console.error("%s[%s] does not match Default `%s`.", b, q, g.v)); | ||
h !== l && void 0 !== g.v && (r = ab(m, l, n), console.error("%s[%s] does not match Default `%s`.", b, r, g.v)); | ||
} else { | ||
var q = $a(m, l, n); | ||
console.error("%s[%s] got from Default.", b, q); | ||
var r = ab(m, l, n); | ||
console.error("%s[%s] got from Default.", b, r); | ||
} | ||
@@ -1989,4 +1993,4 @@ g.default = "defaultValue" in g ? g.defaultValue : g.v; | ||
} | ||
async function Cc(a) { | ||
const b = Ya(), c = new Bc, d = new zc; | ||
async function Dc(a) { | ||
const b = Za(), c = new Cc, d = new Ac; | ||
b.pipe(c).pipe(d); | ||
@@ -2010,6 +2014,6 @@ b.end(a); | ||
} | ||
;var Dc = async() => { | ||
;var Ec = async() => { | ||
await Promise.all(y.map(async a => { | ||
a = await G(a); | ||
a = await Cc(a); | ||
a = await Dc(a); | ||
z ? await H(z, a) : console.log(a); | ||
@@ -2027,3 +2031,3 @@ })); | ||
try { | ||
return na ? await Dc() : ma ? await rc() : await uc(); | ||
return na ? await Ec() : ma ? await sc() : await vc(); | ||
} catch (a) { | ||
@@ -2030,0 +2034,0 @@ process.env.DEBUG ? console.log(a.stack) : console.log(a.message); |
{ | ||
"name": "typal", | ||
"version": "1.25.0", | ||
"version": "1.25.1", | ||
"description": "Organises TypeDefs By Placing Them Into Types.Xml File To Be Embedded Into Source Code Compatible With VSCode And Google Closure Compiler, Generates Externs And Allows To Place Documentation In README Markdown.", | ||
@@ -5,0 +5,0 @@ "main": "compile/index.js", |
@@ -24,2 +24,3 @@ import { makeBlock } from '../' | ||
const useNamespace = args.includes('namespace') | ||
const noEmbed = args.includes('noEmbed') || args.includes('no-embed') | ||
@@ -45,5 +46,7 @@ let ignore = args.find((a) => { | ||
this.emit('types', imports) | ||
const em = await Promise.all(embeds.map(async ({ | ||
src, path: p = src, ignore: i, namespace: n, closure: c, | ||
externs: ext, 'no-suppress': nos, | ||
let em = [] | ||
if (!noEmbed) em = await Promise.all(embeds.map(async ({ | ||
src, path: p = src, ignore: i = ignore.join(','), | ||
namespace: n = useNamespace , closure: c = closure, | ||
externs: ext = externs, 'no-suppress': nos = noSuppress, | ||
}) => { | ||
@@ -50,0 +53,0 @@ const a = [p] |
Sorry, the diff of this file is not supported yet
485358
6123