New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

leafdoc

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leafdoc - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

spec/e2e/javascript-identifiers/identifiers.js

5

changelog.md
# 2.1.0(2020-09-08)
* Implemented a new namespace-level directive: `relationship`
* Relationships show as UML-class-diagram-like arrows (properly styled) in the `graphviz-class-diagram` templates.
# 2.0.1 (2020-09-08)

@@ -3,0 +8,0 @@

58

dist/leafdoc.cjs.js

@@ -99,2 +99,8 @@ 'use strict';

// Comparison helper. Inspired from https://github.com/helpers/handlebars-helpers
Handlebars.registerHelper('equals', function equalityHelper(a, b) {
return a == b;
});
// One or more lines starting with whitespace and two or more forward slashes,

@@ -137,3 +143,3 @@ // or

// TODO: An identifier shall allow an underscore or dollar at the beginning, as JS does.
var identifier = xRegExp.build('^({{ID_Start}} ( {{ID_Continue}} | \\. | : )*)$', {
var identifier = xRegExp.build('^(({{ID_Start}} | _ | \$) ( {{ID_Continue}} | \\. | : )*)$', {
ID_Start: unicodeRegExpIDStart, // eslint-disable-line camelcase

@@ -162,2 +168,7 @@ ID_Continue: unicodeRegExpIDContinue // eslint-disable-line camelcase

// Parses a UML-like relationship definition
var relationshipDefinition = xRegExp("^\n(?<type> \\S+ ) \\s*\n(?<namespace> [^,\\s]+ ) \\s*\n(, \\s* (?<cardinalityFrom> [^,\\s]*) )? \\s*\n(, \\s* (?<cardinalityTo> [^,\\s]*) )? \\s*\n(, \\s* (?<label> .+ )? )?\n\\s* $", 'nx');
// Trivial file/Str parser.

@@ -353,3 +364,3 @@ // Assumes that the whole string is leafdoc docstrings.

// 🍂method addStr(str: String, filename?: String): this
// Parses the given string for Leafdoc comments.
// Parses the given string for Leafdoc directives.
Leafdoc.prototype.addStr = function addStr (str, filename) {

@@ -383,3 +394,2 @@ var assign;

console.log(path.extname(filename), filename);
var parser = path.extname(filename) === '.leafdoc' ?

@@ -410,14 +420,5 @@ trivialParser :

// var match = regex.exec(line);// Skips extra comment characters
// var lineStr = match[1];
// Might happen in some binary files
// console.log(line);
// break;
// }
var lineIsValid = false;
var parsedCharacters = 0;
// console.log('Line: ', i, line);
// var match = regex.exec(line);
var match = (void 0);

@@ -435,5 +436,3 @@ // In "param foo, bar", directive is "param" and content is "foo, bar"

if (lineIsValid) {
// console.log('After having matched a line:', match);
var trailing = line.substr(parsedCharacters + 1).trim();
// console.log('After having matched a line:', trailing);
if (trailing) {

@@ -450,4 +449,2 @@ directives.push(['comment', trailing]);

// console.log('directives', directives);
for (var i$2 in directives) {

@@ -459,4 +456,2 @@ var directive = directives[i$2][0],

// console.log(directive, '-', content);
if (directive === 'class' || directive === 'namespace') {

@@ -489,3 +484,2 @@ ns = content.trim();

// console.log(scope, '-', directive, '-', content);

@@ -501,17 +495,28 @@

supersections: {},
inherits: []
inherits: [],
relationships: [],
};
}
currentNamespace = namespaces[ns];
if (directive === 'aka') {
namespaces[ns].aka.push(content);
currentNamespace.aka.push(content);
}
if (directive === 'comment') {
namespaces[ns].comments.push(content);
currentNamespace.comments.push(content);
}
if (directive === 'inherits') {
namespaces[ns].inherits.push(content);
currentNamespace.inherits.push(content);
}
currentNamespace = namespaces[ns];
if (directive === 'relationship') {
var split = relationshipDefinition.exec(content);
currentNamespace.relationships.push({
type: split[1],
namespace: split[2],
cardinalityFrom: split[3],
cardinalityTo: split[4],
label: split[5],
});
}
}

@@ -752,3 +757,4 @@

supersections: out,
inherits: namespace.inherits
inherits: namespace.inherits,
relationships: namespace.relationships
});

@@ -755,0 +761,0 @@ };

@@ -262,3 +262,3 @@ # Leafdoc-generated API reference

<td><code>this</code></td>
<td>Parses the given string for Leafdoc comments.
<td>Parses the given string for Leafdoc directives.
directive.</td>

@@ -265,0 +265,0 @@ </tr>

{
"name": "leafdoc",
"version": "2.0.1",
"version": "2.1.0",
"description": "A lightweight NaturalDocs-like LeafletJS-style documentation generator",

@@ -5,0 +5,0 @@ "main": "dist/leafdoc.cjs.js",

@@ -101,3 +101,3 @@

🍂alternative
🍂method on(types: String, fn: Function): this
🍂method on(types: [String], fn: Function): this
Given an array of event types (strings), attaches `fn` as an event handler to each of them.

@@ -108,6 +108,7 @@ */

* `🍂inherits (parent)` means that a class or namespace inherits all documentables
* `🍂inherits [parent]` means that a class or namespace inherits all documentables
from another class or namespace.
* `🍂relationship [relationshiptype] [namespace] ()` is specific to thegraphviz
* `🍂uninheritable` is applied only to *sections*, and hides them from the
documentation of children classes.
* `🍂miniclass [name] [(parentname)]` defines a class/namespace that shall display *inside* the parent namespace (specified between parentheses); most useful for very concide classes/data structs that are useful only within the context of the parent namespace.

@@ -179,3 +180,41 @@ ### Shorthand syntax

### Relationships format
Relationships are meaningful for class diagrams. They correspond with the UML class diagram
The syntax is:
```
🍂relationship type namespace [ ,cardinalityFrom [ ,cardinalityTo [ ,label ]]]
```
The following relationship `type`s are implemented for display in the `graphviz-class-diagram` templates:
- `associated`
- `implements`
- `dependsOn`
- `aggregationOf`
- `compositionOf`
Note that class inheritance is a separate directive (`🍂inherits`) .
`namespace` must be an identifier; `cardinalityFrom` and `cardinalityTo` must not have commas in them.
Some examples of how `🍂relationship` works:
```
🍂namespace ConcreteClass
🍂relationship implements AbstractClass
```
```
🍂namespace Classroom
🍂relationship aggregationOf Student, 0..n, 1..n
🍂relationship aggregationOf Teacher, 1, 0..n
```
```
🍂namespace Caller
🍂relationship associated Callee ,, calls
```
### Output customization

@@ -253,3 +292,3 @@

Run `apt-get install ttf-ancient-fonts` and don't ask why the fallback file for emojis is packaged as "ancient fonts".
Run `apt-get install fonts-symbola`.

@@ -256,0 +295,0 @@ ### I cannot type 🍂 in my keyboard!

@@ -49,2 +49,3 @@ {

],
"relationships": [],
"id": "childclass"

@@ -97,4 +98,5 @@ },

"inherits": [],
"relationships": [],
"id": "parentclass"
}
}
}

@@ -56,4 +56,5 @@ {

"inherits": [],
"relationships": [],
"id": "math"
}
}
}

@@ -93,4 +93,5 @@ {

"inherits": [],
"relationships": [],
"id": "singletonobject"
}
}

@@ -310,4 +310,5 @@ {

"inherits": [],
"relationships": [],
"id": "domevent"
}
}

@@ -84,2 +84,3 @@ {

],
"relationships": [],
"id": "map"

@@ -157,2 +158,3 @@ },

],
"relationships": [],
"id": "evented"

@@ -261,2 +263,3 @@ },

"inherits": [],
"relationships": [],
"id": "class"

@@ -355,2 +358,3 @@ },

],
"relationships": [],
"id": "layer"

@@ -368,2 +372,3 @@ },

],
"relationships": [],
"id": "marker"

@@ -412,2 +417,62 @@ },

"id": "tilelayer-method"
},
"option": {
"name": "option",
"aka": [],
"comments": [],
"sections": {
"__default": {
"name": "__default",
"aka": [],
"comments": [],
"uninheritable": false,
"documentables": {
"minZoom": {
"name": "minZoom",
"aka": [],
"comments": [],
"params": {},
"type": "Number",
"optional": false,
"defaultValue": "0",
"id": "tilelayer-minzoom"
},
"maxZoom": {
"name": "maxZoom",
"aka": [],
"comments": [],
"params": {},
"type": "Number",
"optional": false,
"defaultValue": "18",
"id": "tilelayer-maxzoom"
},
"zoomOffset": {
"name": "zoomOffset",
"aka": [],
"comments": [],
"params": {},
"type": "Number",
"optional": false,
"defaultValue": "0",
"id": "tilelayer-zoomoffset"
},
"zoomReverse": {
"name": "zoomReverse",
"aka": [],
"comments": [
""
],
"params": {},
"type": "Boolean",
"optional": false,
"defaultValue": "false",
"id": "tilelayer-zoomreverse"
}
},
"type": "option",
"id": "tilelayer-option"
}
},
"id": "tilelayer-option"
}

@@ -418,2 +483,3 @@ },

],
"relationships": [],
"id": "tilelayer"

@@ -443,3 +509,2 @@ },

"comments": [
"",
""

@@ -464,2 +529,77 @@ ],

"id": "gridlayer-method"
},
"option": {
"name": "option",
"aka": [],
"comments": [],
"sections": {
"__default": {
"name": "__default",
"aka": [],
"comments": [],
"uninheritable": false,
"documentables": {
"tileSize": {
"name": "tileSize",
"aka": [],
"comments": [],
"params": {},
"type": "Number|Point",
"optional": false,
"defaultValue": "256",
"id": "gridlayer-tilesize"
},
"opacity": {
"name": "opacity",
"aka": [],
"comments": [],
"params": {},
"type": "Number",
"optional": false,
"defaultValue": "1.0",
"id": "gridlayer-opacity"
},
"minZoom": {
"name": "minZoom",
"aka": [],
"comments": [],
"params": {},
"type": "Number",
"optional": false,
"defaultValue": "0",
"id": "gridlayer-minzoom"
},
"maxZoom": {
"name": "maxZoom",
"aka": [],
"comments": [],
"params": {},
"type": "Number",
"optional": false,
"defaultValue": "undefined",
"id": "gridlayer-maxzoom"
},
"noWrap": {
"name": "noWrap",
"aka": [],
"comments": [
"",
"",
"",
"",
"",
""
],
"params": {},
"type": "Boolean",
"optional": false,
"defaultValue": "false",
"id": "gridlayer-nowrap"
}
},
"type": "option",
"id": "gridlayer-option"
}
},
"id": "gridlayer-option"
}

@@ -470,4 +610,5 @@ },

],
"relationships": [],
"id": "gridlayer"
}
}
}

@@ -84,2 +84,3 @@ {

],
"relationships": [],
"id": "map"

@@ -157,2 +158,3 @@ },

],
"relationships": [],
"id": "evented"

@@ -261,2 +263,3 @@ },

"inherits": [],
"relationships": [],
"id": "class"

@@ -355,2 +358,3 @@ },

],
"relationships": [],
"id": "layer"

@@ -368,2 +372,3 @@ },

],
"relationships": [],
"id": "marker"

@@ -477,2 +482,3 @@ },

],
"relationships": [],
"id": "tilelayer"

@@ -601,4 +607,5 @@ },

],
"relationships": [],
"id": "gridlayer"
}
}

@@ -72,4 +72,5 @@ {

"inherits": [],
"relationships": [],
"id": "map"
}
}

@@ -14,4 +14,5 @@ {

"inherits": [],
"relationships": [],
"id": "svg"
}
}

@@ -286,4 +286,5 @@ {

"inherits": [],
"relationships": [],
"id": "treenode"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc