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

plexiform

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

plexiform - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

version-history.md

57

includes/process-md.js

@@ -6,3 +6,3 @@ /* jshint esversion: 6 */

const DEBUG_DUMP = true;
const DEBUG_DUMP = false;

@@ -23,17 +23,39 @@ function log() {

this.nesting = [this.root];
this.lastItemType = null;
if (mdstring) { this.parseString(mdstring); }
}
add(obj) {
log("ADD ITEM", obj);
if (obj && typeof obj.level === "number") {
let parent = this.parentByObject(obj);
if (parent && parent.children) {
// associate objects
parent.children.push(obj);
// manage nesting
if (obj.level > 0) {
this.nesting.splice(obj.level);
this.nesting[obj.level] = obj;
if (obj.type == "BLANK") {
log("IGNORE BLANK");
} else {
log("ADD ITEM", obj);
let parent = this.parentByObject(obj);
if (parent && parent.children) {
// associate objects
parent.children.push(obj);
// manage nesting
if (obj.level > 0) {
this.nesting.splice(obj.level);
this.nesting[obj.level] = obj;
}
}
// manage bullet groups in the parent (unbroken runs of bullet items)
if (obj.type == "BULLET" && parent && parent.bulletGroups) {
if (this.lastItemType != obj.type) {
parent.bulletGroups.push([]);
log("New Bullet Group");
}
parent.bulletGroups[parent.bulletGroups.length - 1].push(obj);
}
// manage quote groups in the parent (unbroken runs of quote items)
if (obj.type == "QUOTE" && parent && parent.quoteGroups) {
if (this.lastItemType != obj.type) {
log("New Quote Group");
parent.quoteGroups.push([]);
}
parent.quoteGroups[parent.quoteGroups.length - 1].push(obj);
}
}
this.lastItemType = obj.type;
}

@@ -60,7 +82,7 @@ }

.split("\n") // split on line breaks
.filter(l => l && l.length > 0) // retain only non-blank lines
//.filter(l => l && l.length > 0) // retain only non-blank lines
);
}
parseLines(lines) {
lines.forEach(line => this.add(new MdItem(this, line)));
lines.forEach(line => this.add(new MdItem(line)));
}

@@ -70,4 +92,3 @@ }

class MdItem {
constructor(mdDom, mdLine) {
//this.mdDom = mdDom; // avoid circular refs
constructor(mdLine) {
this.raw = mdLine; //

@@ -87,4 +108,10 @@ this.ws_tabs = null; //

this.options = {}; //
// these collections managed by MdDom
this.children = [];
if (mdDom && mdLine) {
this.bulletGroups = [];
this.quoteGroups = [];
if (!mdLine || mdLine.match(/^\s*$/)) {
this.type = "BLANK";
} else {
[, this.ws_tabs = "", this.ws_spaces = "", this.md = "", this.rol = ""] = mdLine.match(/^(\t*)((?: {2})*)(#{1,5}|-|>)?\s*(.*?)\s*$/);

@@ -91,0 +118,0 @@

@@ -31,3 +31,3 @@ #!/usr/bin/env node

name: "Plexiform",
version: "3.0.0",
version: "3.1.0",
author: "Raith"

@@ -66,3 +66,2 @@ };

var spec_name = argv.options.spec || null;
var spec_processor = argv.options.processor || null;
var output_folder = argv.options.output || null;

@@ -76,4 +75,2 @@

if (spec_name) console.log(` resolved = ${require.resolve(spec_name)}`);
console.log(`spec_processor = ${spec_processor}`);
if (spec_processor) console.log(` resolved = ${require.resolve(spec_processor)}`);
console.log(`output_folder = ${output_folder}`);

@@ -104,6 +101,6 @@ console.log("Module paths:", module.paths);

plexiform init [--force]
plexiform init [--force] [--build <build_name>] [--spec <spec_name>] [--process <spec_processor>] [--output <output_folder>]
plexiform init [--force] [--build <build_name>] [--spec <spec_name>] [--output <output_folder>]
plexiform build [--save]
plexiform build --build <build_name> [--spec <spec_name>] [--process <spec_processor>] [--output <output_folder>] [--save]
plexiform build --build <build_name> [--spec <spec_name>] [--output <output_folder>] [--save]

@@ -128,15 +125,11 @@ plexiform gallery list

This should refer to a file with extension ".js" in the CWD or modules path (for require).
It is a node module which exports a single method named "build" with signature (spec, utils): void which will perform your build.
It is a node module which exports a method named "build" with signature (spec, utils) => void which will perform your build.
It may also export a method named "process" with signature (input) => specification_object which will process a non-json specification file.
<spec_name>
This should refer to a "json" or "md" file, relative to the CWD.
It will expose a specification object, either directly (json) or post-processing (md), which is consumable by the build method.
This should refer to a "json", "md", or other file, relative to the CWD.
It will expose a specification object, either directly (json) or via the build's "process" method.
If using md then it will be parsed into plexiform's proprietary MdDom object prior to passing into the process method.
Any other filetypes are passed in raw.
<spec_processor>
This should refer to a file with extension ".js" in the CWD or modules path (for require).
It is a node module which exports a single method named "process" and which turns your spec file into a suitable config object.
If your spec file has the extension ".md" then it will be parsed by Plexiform into a proprietary MdDom object prior to being processed by the specified spec_processor.
NOTE: The spec_processor is *always* and *only* invoked if the spec_name extension is anything other than ".js" or ".json".
NOTE: If the --save switch is applied then the processed spec is stringified to a file with the original spec_name plus the ".json" extension, with FORCED overwriting!

@@ -169,7 +162,5 @@

spec_name = spec_name || "./path/to/my_app_spec.json|md";
spec_processor = spec_processor || "plexiform-build-api/process-config";
output_folder = output_folder || ".";
let configcontent = `{
"build_name": "${build_name}",
"spec_processor": "${spec_processor}",
"spec_name": "${spec_name}",

@@ -189,3 +180,3 @@ "output_folder": "${output_folder}"

pconfig = require(plexiformconfigname);
({ build_name, spec_name, spec_processor, output_folder } = pconfig);
({ build_name, spec_name, output_folder } = pconfig);
console.log("Loaded");

@@ -222,3 +213,3 @@ } catch (e) {

try {
var processor = require(spec_processor).process;
var processor = require(build_name).process;
spec = processor(specobj);

@@ -233,3 +224,3 @@ console.log(`Processed spec using "${spec_processor}"`);

} catch (e2) {
console.log(`ERROR! Not able to process spec using "${spec_processor}"`);
console.log(`ERROR! Not able to process spec using "process" method of ${build_name}"`);
}

@@ -236,0 +227,0 @@ }

{
"name": "plexiform",
"version": "3.0.0",
"version": "3.1.0",
"description": "A very simple template-driven generator.",

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

# Plexiform
> **v3.0.0**
> **v3.1.0**

@@ -23,7 +23,7 @@ | In this document |

## Not a module
## Install Globally, not Locally
Please note that this is not a Node module, it is a Node script for running in the shell.
Please note that this is not a Node module, it is a command line tool.
I apologise if my `npm` etiquette is lacking, please forgive a first-timer :)
Therefore it should be installed globally, not locally.

@@ -42,2 +42,18 @@ ## Getting started

## Specification processing
The simplest specification file is in JSON format, and is directly 'required' in and processed by the build script.
But you can use a specification written in any format, as long as your build script also offers a `process` method to turn it into a suitable object.
If you wish to express your specification in markdown then a further feature is built-in...
## MdDom
To make your specifications neater, plexiform offers the proprietary MdDom markdown parser.
If your specification file has the ".md" extension then it will be pre-processed into a reasonably usefully deconstructed object model. It is that which is then passed in to your build script's `process` method.
Markdown specifications are recommended as they are both readable and freely parsed.
## Gallery

@@ -44,0 +60,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