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

@flecks/dox

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flecks/dox - npm Package Compare versions

Comparing version 4.0.9 to 4.0.10

5

build/generate.js

@@ -309,3 +309,6 @@ const {

let fleck = root;
if ('build/flecks.bootstrap.js' !== path) {
if (path.match(/@flecks\/core\.config(?:\.[^.]+)*/)) {
fleck = join(root, path).split('/').slice(0, -4).join('/');
}
else if ('build/flecks.bootstrap.js' !== path) {
fleck = join(fleck, path.startsWith('src') ? path.slice(4) : path);

@@ -312,0 +315,0 @@ fleck = join(dirname(fleck), basename(fleck, extname(fleck)));

34

build/parser.js

@@ -16,4 +16,7 @@ const {readFile} = require('fs/promises');

buildFileVisitor,
buildFileVisitorRaw,
configVisitor,
configVisitorRaw,
hookBaseVisitor,
hookExportVisitor,
hookImplementationVisitor,

@@ -108,3 +111,3 @@ hookInvocationVisitor,

exports.parseHookSpecificationSource = async (path, source, options) => {
exports.parseHookSpecificationSource = async (source, options) => {
const ast = await exports.parseCode(source, options);

@@ -124,6 +127,33 @@ const hookSpecifications = [];

exports.parseHookExportSource = async (source, options, fn) => {
traverse(await exports.parseCode(source, options), hookExportVisitor(fn));
};
exports.parseSource = async (path, source, root, request, options) => {
if (path.match(/build\/flecks\.hooks\.js$/)) {
return exports.parseHookSpecificationSource(path, source, options);
return exports.parseHookSpecificationSource(source, options);
}
if (path.match(/@flecks\/build\.files(?:\.[^.]+)*/)) {
const buildFiles = [];
exports.parseHookExportSource(source, options, (node) => {
buildFileVisitorRaw(node, (buildFile) => {
buildFiles.push(buildFile);
});
});
return {buildFiles};
}
if (path.match(/@flecks\/core\.config(?:\.[^.]+)*/)) {
const configs = [];
exports.parseHookExportSource(source, options, (node) => {
configVisitorRaw(node, (config) => {
const {description, key, location: {start: {index: start}, end: {index: end}}} = config;
configs.push({
defaultValue: source.slice(start, end),
description,
key,
});
});
});
return {config: configs};
}
return exports.parseNormalSource(path, source, root, request, options);

@@ -130,0 +160,0 @@ };

@@ -16,2 +16,3 @@ const {

} = require('@babel/types');
const {Flecks} = require('@flecks/core/build/flecks');
const {parse: parseComment} = require('comment-parser');

@@ -128,32 +129,36 @@

exports.buildFileVisitorRaw = (node, fn) => {
if (isArrayExpression(node)) {
node.elements
.map((element) => {
let filename;
if (isStringLiteral(element)) {
filename = element.value;
}
if (!filename) {
return undefined;
}
return {
filename,
description: (
(element.leadingComments?.length > 0)
? element.leadingComments.pop().value.split('\n')
.map((line) => line.trim())
.map((line) => line.replace(/^\*/, ''))
.map((line) => line.trim())
.join('\n')
.trim()
: undefined
),
};
})
.filter((buildFile) => buildFile)
.forEach(fn);
}
};
exports.buildFileVisitor = (fn) => exports.hookVisitor('@flecks/build.files')(
(property) => {
functionResultVisitor(property.value, (node) => {
if (isArrayExpression(node)) {
node.elements
.map((element) => {
let filename;
if (isStringLiteral(element)) {
filename = element.value;
}
if (!filename) {
return undefined;
}
return {
filename,
description: (
(element.leadingComments?.length > 0)
? element.leadingComments.pop().value.split('\n')
.map((line) => line.trim())
.map((line) => line.replace(/^\*/, ''))
.map((line) => line.trim())
.join('\n')
.trim()
: undefined
),
};
})
.filter((buildFile) => buildFile)
.forEach(fn);
}
exports.buildFileVisitorRaw(node, fn);
});

@@ -163,24 +168,28 @@ },

exports.configVisitorRaw = (node, fn) => {
if (isObjectExpression(node)) {
node.properties.forEach((property) => {
if (isIdentifier(property.key) || isStringLiteral(property.key)) {
fn({
key: property.key.name || property.key.value,
description: (property.leadingComments?.length > 0)
? property.leadingComments.pop().value.split('\n')
.map((line) => line.trim())
.map((line) => line.replace(/^\*/, ''))
.map((line) => line.trim())
.filter((line) => !!line)
.join(' ')
.trim()
: undefined,
location: property.value.loc,
});
}
});
}
};
exports.configVisitor = (fn) => exports.hookVisitor('@flecks/core.config')(
(property) => {
functionResultVisitor(property.value, (node) => {
if (isObjectExpression(node)) {
node.properties.forEach((property) => {
if (isIdentifier(property.key) || isStringLiteral(property.key)) {
fn({
key: property.key.name || property.key.value,
description: (property.leadingComments?.length > 0)
? property.leadingComments.pop().value.split('\n')
.map((line) => line.trim())
.map((line) => line.replace(/^\*/, ''))
.map((line) => line.trim())
.filter((line) => !!line)
.join(' ')
.trim()
: undefined,
location: property.value.loc,
});
}
});
}
exports.configVisitorRaw(node, fn);
});

@@ -299,1 +308,28 @@ },

});
exports.hookExportVisitor = (fn) => ({
AssignmentExpression(path) {
const {left, right} = path.node;
if (isMemberExpression(left)) {
if (isIdentifier(left.object) && 'exports' === left.object.name) {
if (isIdentifier(left.property) && 'hook' === left.property.name) {
if (isFunction(right)) {
functionResultVisitor(right, fn);
}
}
}
}
},
ExportNamedDeclaration(path) {
if (isVariableDeclaration(path.node.declaration)) {
if ('hook' === Flecks.get(path, 'node.declaration.declarations[0].id.name')) {
if (isFunction(path.node.declaration.declarations[0].id.init)) {
functionResultVisitor(path.node.declaration.declarations[0].id.init, fn);
}
}
}
if (isFunction(path.node.declaration)) {
functionResultVisitor(path.node.declaration, fn);
}
},
});
{
"name": "@flecks/dox",
"version": "4.0.9",
"version": "4.0.10",
"author": "cha0s",

@@ -5,0 +5,0 @@ "license": "MIT",

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