@seneca/doc
Advanced tools
+11
-5
@@ -13,3 +13,2 @@ /* Copyright (c) 2019 voxgig and other contributors, MIT License */ | ||
| update_source: function(source, injections) { | ||
| // console.log('INJS: ', injections) | ||
| Object.values(injections).forEach(inj => { | ||
@@ -21,6 +20,13 @@ inj.forEach(({ name, text }) => { | ||
| ) | ||
| source = source.replace( | ||
| re, | ||
| '<!--START:' + name + '-->\n' + text + '\n<!--END:' + name + '-->' | ||
| ) | ||
| let html = | ||
| '<!--START:' + | ||
| name + | ||
| '-->\n' + | ||
| text.replace(/\$/g, '$$$$') + | ||
| '\n<!--END:' + | ||
| name + | ||
| '-->' | ||
| source = source.replace(re, html) | ||
| }) | ||
@@ -27,0 +33,0 @@ }) |
+5
-2
@@ -28,3 +28,3 @@ /* Copyright (c) 2019 voxgig and other contributors, MIT License */ | ||
| // local_options has double role here - fix this - separate into seneca options and doc options! | ||
| let seneca_options = { ...local_options } | ||
| let seneca_options = { legacy: false, ...local_options } | ||
| delete seneca_options.top | ||
@@ -38,3 +38,6 @@ | ||
| seneca.use('promisify').use(__dirname + '/../', { generating: true }) | ||
| const plugin_options = seneca.options().legacy.options | ||
| ? { generating: true } | ||
| : {} | ||
| seneca.use('promisify').use(__dirname + '/../', plugin_options) | ||
@@ -41,0 +44,0 @@ if ('function' === typeof local_init) { |
+33
-3
@@ -14,2 +14,3 @@ /* Copyright (c) 2019-2023 voxgig and other contributors, MIT License */ | ||
| const joi_schema = plugin.def.options_schema | ||
| const options_shape = plugin.def.options_shape | ||
@@ -23,3 +24,3 @@ if ( | ||
| intern.walk_options('', b, joidesc) | ||
| intern.walk_joi_options('', b, joidesc) | ||
@@ -35,2 +36,4 @@ b.push('\n\nSet plugin options when loading with:\n```js\n') | ||
| `) | ||
| } else if (options_shape) { | ||
| intern.walk_gubu_options('', b, options_shape) | ||
| } else { | ||
@@ -40,3 +43,3 @@ b.push('*None.*') | ||
| return [ | ||
| let out = [ | ||
| { | ||
@@ -47,2 +50,4 @@ name: 'options', | ||
| ] | ||
| return out | ||
| }, | ||
@@ -168,3 +173,3 @@ | ||
| const intern = (module.exports.intern = { | ||
| walk_options: function(prefix, b, joidesc) { | ||
| walk_joi_options: function(prefix, b, joidesc) { | ||
| if (joidesc.keys) { | ||
@@ -184,2 +189,19 @@ Object.keys(joidesc.keys).forEach(optname => { | ||
| walk_gubu_options: function(prefix, b, shape) { | ||
| let spec = shape?.gubu ? shape.spec() : null | ||
| if (spec && 'object' === spec.t) { | ||
| Object.keys(spec.v).forEach(optname => { | ||
| intern.walk_gubu_options( | ||
| (prefix ? prefix + '.' : '') + optname, | ||
| b, | ||
| spec.v[optname] | ||
| ) | ||
| }) | ||
| } else { | ||
| const opt_md = '* `' + prefix + '` : ' | ||
| b.push(opt_md + shape.t + intern.gubuflags(shape)) | ||
| // TODO: meta description | ||
| } | ||
| }, | ||
| action_params: function(rules) { | ||
@@ -240,2 +262,10 @@ const self = this | ||
| gubuflags: function(shape) { | ||
| if (shape.r) { | ||
| return ' <i><small>required</small></i>' | ||
| } | ||
| return '' | ||
| }, | ||
| // order alpha but top level names (sys,role) go first | ||
@@ -242,0 +272,0 @@ nicepat: function(orig, top) { |
+4
-4
| { | ||
| "name": "@seneca/doc", | ||
| "version": "5.0.1", | ||
| "version": "6.0.0", | ||
| "description": "Documentation helper for Seneca plugins.", | ||
@@ -49,7 +49,7 @@ "main": "doc.js", | ||
| "@hapi/joi": "^17.1.1", | ||
| "seneca": "^3.32.0", | ||
| "seneca-promisify": "^3.6.0" | ||
| "seneca": "^3.34.0", | ||
| "seneca-promisify": "^3.7.1" | ||
| }, | ||
| "devDependencies": { | ||
| "jest": "^29.6.4", | ||
| "jest": "^29.7.0", | ||
| "seneca-joi": "^7.0.2", | ||
@@ -56,0 +56,0 @@ "seneca-plugin-validator": "^0.6.1" |
+8
-2
@@ -15,5 +15,9 @@  | ||
| [](https://deepscan.io/dashboard#view=project&tid=5016&pid=25451&bid=796879) | ||
| [](https://codeclimate.com/github/voxgig/seneca-doc/maintainability) | ||
| [](https://codeclimate.com/github/senecajs/seneca-doc/maintainability) | ||
| |  | This open source module is sponsored and supported by [Voxgig](https://www.voxgig.com). | | ||
| |---|---| | ||
| Documentation helper for [Seneca](senecajs.org) plugins. | ||
@@ -121,3 +125,5 @@ | ||
| *None.* | ||
| * `test` : boolean | ||
| * `errors` : object | ||
| * `init$` : boolean | ||
@@ -124,0 +130,0 @@ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
27292
4.34%606
5.76%235
2.62%Updated
Updated