documentary
Advanced tools
Comparing version 1.35.7 to 1.35.8
@@ -27,4 +27,5 @@ const { join, dirname, relative, parse, sep, resolve } = require('path'); | ||
let t = null | ||
const f = types.filter(({ import: i, external }) => !i && !external) | ||
if (wiki) { | ||
t = types.filter(({ import: i }) => !i).reduce((acc, type) => { | ||
t = f.reduce((acc, type) => { | ||
const { name, appearsIn, description, originalNs } = type | ||
@@ -47,3 +48,3 @@ const [ai] = appearsIn.map((file) => { | ||
} else { | ||
t = types.filter(({ import: i }) => !i).reduce((acc, type) => { | ||
t = f.reduce((acc, type) => { | ||
const { name, description, originalNs } = type | ||
@@ -50,0 +51,0 @@ const rr = `${github}#${gl(type)}` |
@@ -77,6 +77,9 @@ const { h } = require('preact'); | ||
*/ | ||
function link({ documentary, type, children }) { | ||
function link({ documentary, type, children, external }) { | ||
documentary.pretty(false) | ||
const foundType = documentary.allTypesWithIncluded.find(({ fullName }) => { | ||
return fullName == type | ||
const foundType = documentary.allTypesWithIncluded.find((t) => { | ||
const { fullName, external: e } = t | ||
if (fullName != type) return false | ||
if (external) return e | ||
return true | ||
}) | ||
@@ -83,0 +86,0 @@ if (!foundType) throw new Error(`Type ${type} not found.`) |
@@ -40,2 +40,3 @@ const { h } = require('preact'); | ||
if (refType.typeLink) return `${refType.typeLink}${l}` | ||
if (!wiki) return l | ||
@@ -42,0 +43,0 @@ // semi-hack |
@@ -14,2 +14,11 @@ const { Replaceable, replace } = require('../../stdlib'); | ||
const tryRequire = (loc) => { | ||
const p = `${loc}/package.json` | ||
const { typedefs: td } = require(p) | ||
const pl = require.resolve(p) | ||
if (td) loc = join(dirname(pl), td) | ||
else throw new Error(`typedefs field not found in ${loc}/package.json`) | ||
return loc | ||
} | ||
const extract = async (location, { recordOriginalNs, rootNamespace }) => { | ||
@@ -148,2 +157,3 @@ const xml = await read(location) | ||
if (!i.iconEven) i.iconEven = iconEven | ||
i.external = true | ||
}) | ||
@@ -227,3 +237,4 @@ return !ii.length | ||
}, | ||
'include-typedefs'({ children, icon, 'icon-alt': iconAlt, 'icon-odd': iconOdd, 'icon-even': iconEven }) { | ||
'include-typedefs'({ children, icon, 'icon-alt': iconAlt, | ||
'icon-odd': iconOdd, 'icon-even': iconEven }) { | ||
let [loc] = children | ||
@@ -234,9 +245,12 @@ loc = loc.trim() || 'typedefs.json' | ||
// if a package is referenced | ||
const p = `${loc}/package.json` | ||
const { typedefs: td } = require(p) | ||
const pl = require.resolve(p) | ||
if (td) loc = join(dirname(pl), td) | ||
else throw new Error(`typedefs field not found in ${loc}/package.json`) | ||
loc = tryRequire(loc) | ||
} catch (err) { | ||
loc = resolve(loc) | ||
if (process.env.DOCUMENTARY_DEV) { | ||
try { | ||
const nm = join(process.cwd(), 'node_modules', loc) | ||
loc = tryRequire(nm) | ||
} catch (e) { | ||
loc = resolve(loc) | ||
} | ||
} else loc = resolve(loc) | ||
} | ||
@@ -248,2 +262,3 @@ data = require(loc) | ||
const t = { | ||
external: true, | ||
fullName: k, | ||
@@ -250,0 +265,0 @@ icon, iconAlt, iconOdd, iconEven, |
@@ -0,1 +1,8 @@ | ||
## 22 December 2019 | ||
### [1.35.8](https://github.com/artdecocode/documentary/compare/v1.35.7...v1.35.8) | ||
- [feature] Support `external` in links. | ||
- [fix] Correct link to _types_ on the same page. | ||
## 21 December 2019 | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "documentary", | ||
"version": "1.35.7", | ||
"version": "1.35.8", | ||
"description": "Documentation Compiler To Generate The Table Of Contents, Embed Examples With Their Output, Make Markdown Tables, Maintain Typedefs For JavaScript And README, Watch Changes To Push, Use Macros And Prettify API Titles.", | ||
@@ -5,0 +5,0 @@ "main": "build", |
@@ -8,2 +8,3 @@ #!/usr/bin/env node | ||
}) | ||
require('./doc') | ||
require('./doc') | ||
process.env.DOCUMENTARY_DEV = true |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
469469
5230
38