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

symply

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

symply - npm Package Compare versions

Comparing version 0.1.15 to 0.1.16

18

dist/configuration.js

@@ -24,3 +24,3 @@ "use strict";

*----------------------------------------------------------------------------*/
this.debugOutput = false;
this._debugOutput = false;
this._ignoreMissingProperties = false;

@@ -39,2 +39,3 @@ this._formatOutputHTML = false;

this.partialsDirectoryPath = 'partials';
this.helpersDirectoryPath = 'helpers';
this.viewsDirectoryPath = 'views';

@@ -46,2 +47,5 @@ this.layoutsDirectoryPath = 'layouts';

}
get debugOutput() {
return this._debugOutput;
}
get formatOutputHTML() {

@@ -70,3 +74,3 @@ return this._formatOutputHTML;

setModuleModeConfiguration(config) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
this.partials = lodash_1.default.defaultTo((_a = config.entities) === null || _a === void 0 ? void 0 : _a.partials, this.partials);

@@ -77,3 +81,3 @@ this.layouts = lodash_1.default.defaultTo((_b = config.entities) === null || _b === void 0 ? void 0 : _b.layouts, this.layouts);

this.helpers = lodash_1.default.defaultTo((_e = config.entities) === null || _e === void 0 ? void 0 : _e.helpers, this.helpers);
this.debugOutput = lodash_1.default.defaultTo(config.debugOutput, this.debugOutput);
this._debugOutput = lodash_1.default.defaultTo(config.debugOutput, this._debugOutput);
this._ignoreMissingProperties = lodash_1.default.defaultTo(config.ignoreMissingProperties, this.ignoreMissingProperties);

@@ -92,4 +96,5 @@ this._formatOutputHTML = lodash_1.default.defaultTo(config.formatOutputHTML, this._formatOutputHTML);

this.partialsDirectoryPath = this.getDirectoryPathAndAddPrefixIfNeeded((_j = config.paths) === null || _j === void 0 ? void 0 : _j.partialsDirectoryPath, this.partialsDirectoryPath);
this.viewsDirectoryPath = this.getDirectoryPathAndAddPrefixIfNeeded((_k = config.paths) === null || _k === void 0 ? void 0 : _k.viewsDirectoryPath, this.viewsDirectoryPath);
this.layoutsDirectoryPath = this.getDirectoryPathAndAddPrefixIfNeeded((_l = config.paths) === null || _l === void 0 ? void 0 : _l.layoutsDirectoryPath, this.layoutsDirectoryPath);
this.helpersDirectoryPath = this.getDirectoryPathAndAddPrefixIfNeeded((_k = config.paths) === null || _k === void 0 ? void 0 : _k.helpersDirectoryPath, this.helpersDirectoryPath);
this.viewsDirectoryPath = this.getDirectoryPathAndAddPrefixIfNeeded((_l = config.paths) === null || _l === void 0 ? void 0 : _l.viewsDirectoryPath, this.viewsDirectoryPath);
this.layoutsDirectoryPath = this.getDirectoryPathAndAddPrefixIfNeeded((_m = config.paths) === null || _m === void 0 ? void 0 : _m.layoutsDirectoryPath, this.layoutsDirectoryPath);
this.globalsFilePath = this.getDirectoryPathAndAddPrefixIfNeeded(undefined, this.globalsFilePath);

@@ -138,2 +143,5 @@ this.helpersFilePath = this.getDirectoryPathAndAddPrefixIfNeeded(undefined, this.helpersFilePath);

}
getHelpersDirectoryPath() {
return this.helpersDirectoryPath;
}
getViewsDirectoryPath() {

@@ -140,0 +148,0 @@ return this.viewsDirectoryPath;

@@ -30,2 +30,3 @@ "use strict";

const logger_1 = __importDefault(require("../logger"));
const flat_1 = __importDefault(require("flat"));
function load() {

@@ -42,4 +43,9 @@ const globalsFilePath = filesystem.joinAndResolvePath(configuration_1.default.getGlobalsFilePath());

Object.assign(result, configuration_1.default.getGlobals());
if (configuration_1.default.debugOutput) {
logger_1.default.debug('Registered globals:');
logger_1.default.log(flat_1.default.flatten(result));
logger_1.default.log();
}
return result;
}
exports.load = load;

@@ -26,15 +26,54 @@ "use strict";

exports.load = void 0;
const path_1 = __importDefault(require("path"));
const configuration_1 = __importDefault(require("../configuration"));
const filesystem = __importStar(require("../filesystem"));
const logger_1 = __importDefault(require("../logger"));
const chalk_1 = __importDefault(require("chalk"));
const HELPERS_EXTENTION = '.js';
function load() {
const helpersPath = filesystem.joinAndResolvePath(configuration_1.default.getHelpersFilePath());
let result = {};
if (filesystem.existsSync(helpersPath)) {
const helpersCode = filesystem.getFileContents(helpersPath);
result = eval(helpersCode);
/*-----------------------------------------------------------------------------
* Import namespaced helpers from /helpers
*----------------------------------------------------------------------------*/
const helpersPath = configuration_1.default.getHelpersDirectoryPath();
const helpersFileList = filesystem.scanFiles(helpersPath, true, false, true);
// change nested helpers files names to include its enclosing folder
helpersFileList.forEach((fileWithHelpers) => {
if (fileWithHelpers.dirname !== helpersPath) {
const enclosingDirName = fileWithHelpers.dirname.replace(helpersPath + path_1.default.sep, '');
fileWithHelpers.name = enclosingDirName + path_1.default.sep + fileWithHelpers.name;
fileWithHelpers.dirname = helpersPath;
}
return fileWithHelpers;
});
const result = helpersFileList.reduce((acc, helpersFile) => {
const helpersCode = helpersFile.contents;
const helpersObj = eval(helpersCode);
Object.keys(helpersObj).forEach((helperName) => {
const helperHashKey = `${getHelpersFileName(helpersFile.name)}.${helperName}`;
acc[helperHashKey] = helpersObj[helperName];
});
return acc;
}, {});
/*-----------------------------------------------------------------------------
* Add extra global helpers from symply-helpers.js
*----------------------------------------------------------------------------*/
const SymplyHelpersPath = filesystem.joinAndResolvePath(configuration_1.default.getHelpersFilePath());
if (filesystem.existsSync(SymplyHelpersPath)) {
const helpersCode = filesystem.getFileContents(SymplyHelpersPath);
Object.assign(result, eval(helpersCode));
}
/* [Module mode] Add extra helpers if there are any available */
Object.assign(result, configuration_1.default.getHelpers());
if (configuration_1.default.debugOutput) {
logger_1.default.debug('Registered helpers:');
Object.keys(result).forEach((key) => {
logger_1.default.log(chalk_1.default.green(key));
});
logger_1.default.log();
}
return result;
}
exports.load = load;
function getHelpersFileName(fileName) {
return fileName.replace(new RegExp(HELPERS_EXTENTION + '$'), '');
}

@@ -29,2 +29,4 @@ "use strict";

const configuration_1 = __importDefault(require("../configuration"));
const logger_1 = __importDefault(require("../logger"));
const chalk_1 = __importDefault(require("chalk"));
// TODO: add support for md and txt formats

@@ -34,3 +36,12 @@ const LAYOUT_EXTENSION = '.html';

const layoutsPath = configuration_1.default.getLayoutsDirectoryPath();
const layouts = filesystem.scanFiles(layoutsPath, true, false, false);
const layouts = filesystem.scanFiles(layoutsPath, true, false, true);
// change nestes layouts names to include its enclosing folder
layouts.forEach((layout) => {
if (layout.dirname !== layoutsPath) {
const enclosingDirName = layout.dirname.replace(layoutsPath + path_1.default.sep, '');
layout.name = enclosingDirName + path_1.default.sep + layout.name;
layout.dirname = layoutsPath;
}
return layout;
});
const result = layouts.reduce((acc, layout) => {

@@ -42,2 +53,9 @@ acc[getLayoutName(layout.name)] = layout.contents;

Object.assign(result, configuration_1.default.getLayouts());
if (configuration_1.default.debugOutput) {
logger_1.default.debug('Registered layouts:');
Object.keys(result).forEach((key) => {
logger_1.default.log(chalk_1.default.green(key));
});
logger_1.default.log();
}
return result;

@@ -47,3 +65,3 @@ }

function getLayoutName(fileName) {
return path_1.default.basename(fileName, LAYOUT_EXTENSION);
return fileName.replace(new RegExp(LAYOUT_EXTENSION + '$'), '');
}

@@ -29,2 +29,4 @@ "use strict";

const configuration_1 = __importDefault(require("../configuration"));
const logger_1 = __importDefault(require("../logger"));
const chalk_1 = __importDefault(require("chalk"));
// TODO: add support for .md and .txt formats

@@ -36,3 +38,3 @@ const PARTIAL_EXTENTION = '.html';

// change nestes partials names to include its enclosing folder
partials.map((partial) => {
partials.forEach((partial) => {
if (partial.dirname !== partialsPath) {

@@ -51,2 +53,9 @@ const enclosingDirName = partial.dirname.replace(partialsPath + path_1.default.sep, '');

Object.assign(result, configuration_1.default.getPartials());
if (configuration_1.default.debugOutput) {
logger_1.default.debug('Registered partials:');
Object.keys(result).forEach((key) => {
logger_1.default.log(chalk_1.default.green(key));
});
logger_1.default.log();
}
return result;

@@ -53,0 +62,0 @@ }

@@ -30,2 +30,4 @@ "use strict";

const configuration_1 = __importDefault(require("../configuration"));
const logger_1 = __importDefault(require("../logger"));
const chalk_1 = __importDefault(require("chalk"));
// TODO add support for nested dir structure

@@ -40,5 +42,14 @@ var VIEW_EXTENSION;

const viewsPath = configuration_1.default.getViewsDirectoryPath();
const views = filesystem.scanFiles(viewsPath, true, false, false);
const views = filesystem.scanFiles(viewsPath, true, false, true);
let parsedContents;
let viewName;
// change nestes views names to include its enclosing folder
views.forEach((view) => {
if (view.dirname !== viewsPath) {
const enclosingDirName = view.dirname.replace(viewsPath + path_1.default.sep, '');
view.name = enclosingDirName + path_1.default.sep + view.name;
view.dirname = viewsPath;
}
return view;
});
const result = views.reduce((acc, view) => {

@@ -70,2 +81,9 @@ const fileName = view.name;

Object.assign(result, configuration_1.default.getViews());
if (configuration_1.default.debugOutput) {
logger_1.default.debug('Registered views:');
Object.keys(result).forEach((key) => {
logger_1.default.log(chalk_1.default.green(key));
});
logger_1.default.log();
}
return result;

@@ -75,3 +93,3 @@ }

function getViewName(fileName, extension) {
return path_1.default.basename(fileName, extension);
return fileName.replace(new RegExp(extension + '$'), '');
}

@@ -45,2 +45,10 @@ "use strict";

},
debug(...strings) {
if (configuration_1.default.ansiLogging) {
console.log(chalk_1.default.yellowBright('DEBUG'), ...strings);
}
else {
console.log('DEBUG', strip_ansi_1.default(strings.join(' ')));
}
},
};
{
"name": "symply",
"version": "0.1.15",
"version": "0.1.16",
"description": "A simple static site generator.",

@@ -22,6 +22,8 @@ "author": "Oleg Legun <oleg.legun@gmail.com>",

"lint": "npx eslint . --ext .js,.jsx,.ts,.tsx",
"test": "npm run compile && tape test/**/*.js | tap-spec"
"test": "npm run compile && tape test/**/*.js | tap-spec",
"publish-npm": "npm publish"
},
"dependencies": {
"chalk": "3.0.0",
"flat": "^5.0.2",
"fs-extra": "10.0.0",

@@ -37,2 +39,3 @@ "handlebars": "4.7.7",

"devDependencies": {
"@types/flat": "^5.0.2",
"@types/fs-extra": "^9.0.11",

@@ -39,0 +42,0 @@ "@types/html-minifier": "^4.0.0",

@@ -99,2 +99,7 @@ interface SymplyConfiguration extends Partial<Symply.SystemConfiguration> {

/**
* Override default __helpers__ directory path.
* @default 'helpers'
**/
helpersDirectoryPath: string
/**
* Override default __views__ directory path.

@@ -101,0 +106,0 @@ * @default 'views'

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