Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

glob-docs

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glob-docs - npm Package Compare versions

Comparing version 0.0.7-alpha to 0.0.8-alpha

2

package.json
{
"name": "glob-docs",
"version": "0.0.7-alpha",
"version": "0.0.8-alpha",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -75,4 +75,5 @@ /*!

const tagName = docTagInstance.tag.toLowerCase();
const insertId = `insert-${tagName}`;
const insertId = `insert-${docTagInstance.options.insert ? docTagInstance.options.insert : tagName}`;
const defaultInsertId = 'insert-default';
let insertTag = this._docTagsById[insertId];

@@ -93,2 +94,3 @@

this.addedDocTags.push(docTagInstance.id);
insertTag.addChild(docTagInstance);

@@ -105,6 +107,6 @@ this.aggregatedDocTags.push(docTagInstance);

const currentDocTag = this._docTagsById[docTag.id];
if(parentDocTag && !this.globalTags.includes(currentDocTag.tag)) {
if (!parentDocTag.childrenIds.includes(currentDocTag.id)) {
// avoid infinity recursivity
if (!rootIds.includes(currentDocTag.id)) {

@@ -210,2 +212,12 @@ parentDocTag.addChild(currentDocTag);

for (const [key, value] of Object.entries(blobDocs._docTagsByFilename)) {
for (const item of value) {
let prefix = '';
if (item.options.level) {
prefix = `H${item.options.level}:`;
}
console.log(`${item.node.relativeFilepath}`, '-', `${prefix}${item.tag}(id=${item.id})`);
}
}
// generates files into folder

@@ -212,0 +224,0 @@ buildDocs({

@@ -8,2 +8,3 @@ const fs = require('fs');

for(let tagId in source) {
const docTag = blobDocs._docTagsById[tagId];

@@ -46,4 +47,2 @@

// console.log(replacersPoints);
for (let filename in replacersPoints) {

@@ -50,0 +49,0 @@ console.log(`Updating ${filename}`);

@@ -23,3 +23,3 @@ const utils = require('./utils');

const node = new DocTag(docTag, {id, token, params});
const node = new DocTag(docTag, {...params, id, token});

@@ -26,0 +26,0 @@ node.registerMergeParser(merge);

@@ -9,3 +9,3 @@ class DocTag {

this.id = options.id;
this.parentId = null;
this.parentId = options.parentId;
this.options = options;

@@ -12,0 +12,0 @@ this.metatags = {};

@@ -12,9 +12,8 @@ const utils = require('./utils');

const params = {
type: 'default',
id: 'default',
...utils.parseTagParams(value)
};
const tagType = params.type ? params.type : '';
const id = utils.toId(`${token}-${tagType}`);
const node = new DocTag(docTag, {id, token, params });
const id = utils.toId(`${token}-${params.id}`);
const node = new DocTag(docTag, {...params, id, token});

@@ -21,0 +20,0 @@ node.registerMergeParser(merge);

@@ -69,3 +69,3 @@ const utils = require('./utils');

const node = new DocTag(docTag, {id, token, params});
const node = new DocTag(docTag, {...params, id, token});
node.registerMergeParser(merge);

@@ -72,0 +72,0 @@

@@ -5,3 +5,3 @@ const utils = require('./utils');

function merge({docTag, blobDocs}) {
function merge({blobDocs, docTag}) {
// Adds only root elements

@@ -14,5 +14,7 @@ if (!docTag.parentId) {

function parse(docTag) {
const { token, value } = docTag.tagValue;
const { token, options, value } = docTag.tagValue;
const sections = utils.arrayTrim(value.split('>'));
const params = utils.parseTagParams(options);
const items = sections.map((title, index) => {

@@ -34,3 +36,3 @@ if (title.trim() == "") {

// creates DocTag of all sections.
const node = new DocTag(docTag, {id, level, title, token});
const node = new DocTag(docTag, {...params, id, level, title, token});

@@ -37,0 +39,0 @@ // register merge parser

@@ -5,3 +5,3 @@ const utils = require('./utils');

function merge({docTag, blobDocs}) {
const todoRootId = 'todo-root';
const todoRootId = 'todo-default';

@@ -19,6 +19,5 @@ // Checks if docTag exists

tagValue,
node: {
filename: todoRootId
}
}, {id: todoRootId});
filename: docTag.node.filename,
relativeFilepath: docTag.node.relativeFilepath
}, {id: todoRootId, ...tagValue});
}

@@ -39,3 +38,3 @@

const params = utils.parseTagParams(value);
const node = new DocTag(docTag, {id, token, params });
const node = new DocTag(docTag, {...params, id, token});
node.registerMergeParser(merge);

@@ -42,0 +41,0 @@

const DOC_TAG = '@DOC|';
module.exports.toId = (text) => {
return text
.toLowerCase()
.replace(/[^\w ]+/g,' ')
.replace(/ +/g,'-')
.replace(/^-|-$/, '');
const id = text.toLowerCase()
.replace(/[^\w ]+/g,' ')
.replace(/ +/g,'-')
.replace(/^-|-$/, '');
return id;
};

@@ -17,4 +17,5 @@

try {
const result = /[^(]+\((?<params>[^)]+)\)/.exec(text);
const result = /\((?<params>[^)]+)\)/.exec(text);
const params = result.groups.params.split(',');
return params.reduce((prev, current) => {

@@ -50,3 +51,3 @@ let [key, value] = current.trim().split('=');

const lines = sourceFile.sourceCodeLines;
let jumpLines = parseInt(prevTag.options.params.jumpLines);
let jumpLines = parseInt(prevTag.options.jumpLines);
jumpLines = isNaN(jumpLines) ? 0 : jumpLines;

@@ -53,0 +54,0 @@

@@ -1,2 +0,2 @@

const TOKE_PATTERN = /\@DOC\|(?<token>[^\:]+)(\:?|\n)(?<value>[^\n]+)?/;
const TOKEN_PATTERN = /\@DOC\|(?<token>[^\:\()]+)(?<options>\([^)]+\)\:)?(\:?|\n)(?<value>[^\n]+)?/;

@@ -9,3 +9,3 @@ module.exports = function(scannedFiles) {

if (line.indexOf('@DOC|') > -1) {
let result = TOKE_PATTERN.exec(line);
let result = TOKEN_PATTERN.exec(line);

@@ -12,0 +12,0 @@ let groups = {};

@@ -33,3 +33,3 @@ function createLink(childTag, label, options) {

let fileLink = '';
if (options.code.showSourceFile && docTag.options.params.showSourceFile) {
if (options.code.showSourceFile && docTag.options.showSourceFile) {
let sourceLabel = [

@@ -42,3 +42,3 @@ docTag.node.relativeFilepath,

if (docTag.options.params.autoIndent) {
if (docTag.options.autoIndent) {
let sourceLines = docTag.metatags.codeSource.split('\n');

@@ -78,3 +78,3 @@ let count = 0;

return fileLink + [
`\`\`\`${docTag.options.params.lang}`,
`\`\`\`${docTag.options.lang}`,
docTag.metatags.codeSource,

@@ -85,3 +85,3 @@ '```'

TODO: ({ options, docTag }) => {
if (docTag.id === 'todo-root') {
if (docTag.id === 'todo-default') {
return '## TODO';

@@ -88,0 +88,0 @@ }

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