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

ezal

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ezal - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

20

dist/init.js

@@ -31,13 +31,13 @@ "use strict";

'template/page.md': `---
title: $title$
date: $date$
updated: $date$
---`,
title: $title$
date: $date$
updated: $date$
---`,
'template/post.md': `---
title: $title$
date: $date$
updated: $date$
categories:
tags:
---`,
title: $title$
date: $date$
updated: $date$
categories:
tags:
---`,
'themes/default/config.yml': '',

@@ -44,0 +44,0 @@ };

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

// stylus objects
stylus: {},
stylus: { var: {}, function: {} },
// render functions

@@ -63,0 +63,0 @@ render: {},

@@ -46,15 +46,29 @@ "use strict";

exports.initStylus = initStylus;
function difineStyleOption(style, options) {
for (const key in options) {
if (Object.prototype.hasOwnProperty.call(options, key)) {
style.define(key, options[key]);
}
}
}
function renderStylus(stylusContext, options = {}, paths, filename) {
return stylus_1.default.render(stylusContext, {
paths,
filename,
globals: Object.assign({
config: globalOptions.config,
theme: globalOptions.theme,
pages: globalOptions.pages,
posts: globalOptions.posts,
categories: globalOptions.categories,
tags: globalOptions.tags,
}, globalOptions.stylus, options),
let style = (0, stylus_1.default)(stylusContext);
let stylusOptions = Object.assign({
config: globalOptions.config,
theme: globalOptions.theme,
pages: globalOptions.pages,
posts: globalOptions.posts,
categories: globalOptions.categories,
tags: globalOptions.tags,
}, globalOptions.stylus.var, options);
style.define('get', ({ string }) => {
let target = stylusOptions;
string.split('.').forEach((key) => {
target = target[key];
});
return target;
});
style.set('paths', paths);
style.set('filename', filename);
return style.render();
}

@@ -61,0 +75,0 @@ ;

@@ -25,3 +25,14 @@ // Type definitions for Ezal 0.0.3

export let stylus: {
[x: string | number | symbol] : any,
/**
* Set variables that can be obtained in stylus by get('keyName.keyName')
*/
var: {
[x: string | number | symbol] : any,
},
/**
* Set the functions that can be called in stylus
*/
function: {
[x: string | number | symbol] : Function,
}
}

@@ -28,0 +39,0 @@ export namespace render {

{
"name": "ezal",
"version": "0.0.4",
"version": "0.0.5",
"description": "",

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

@@ -19,13 +19,13 @@ import { defaultConfig } from "./config";

'template/page.md': `---
title: $title$
date: $date$
updated: $date$
---`,
'template/post.md': `---
title: $title$
date: $date$
updated: $date$
categories:
tags:
---`,
title: $title$
date: $date$
updated: $date$
---`,
'template/post.md': `---
title: $title$
date: $date$
updated: $date$
categories:
tags:
---`,
'themes/default/config.yml': '',

@@ -32,0 +32,0 @@ };

@@ -22,3 +22,6 @@ import { info } from "./console";

pug: object;
stylus: object;
stylus: {
var: object,
function: object,
};
render: {

@@ -47,3 +50,3 @@ markdown?: Function;

// stylus objects
stylus: {},
stylus: {var:{}, function: {}},
// render functions

@@ -50,0 +53,0 @@ render: {},

@@ -5,2 +5,3 @@ import { readdirSync } from "fs";

import stylus from "stylus";
type StylusRenderer = import("stylus/lib/renderer");

@@ -32,15 +33,40 @@ let styleBase: string;

}
function difineStyleOption(style: StylusRenderer, options: any) {
for (const key in options) {
if (Object.prototype.hasOwnProperty.call(options, key)) {
style.define(key, options[key]);
}
}
}
function renderStylus(stylusContext: string, options: any = {}, paths: any, filename: any) {
return stylus.render(stylusContext, {
paths,
filename,
globals: Object.assign({
config: globalOptions.config,
theme: globalOptions.theme,
pages: globalOptions.pages,
posts: globalOptions.posts,
categories: globalOptions.categories,
tags: globalOptions.tags,
}, globalOptions.stylus, options),
let style = stylus(stylusContext);
let stylusOptions = Object.assign({
config: globalOptions.config,
theme: globalOptions.theme,
pages: globalOptions.pages,
posts: globalOptions.posts,
categories: globalOptions.categories,
tags: globalOptions.tags,
}, globalOptions.stylus.var, options);
style.define('get', ({string})=>{
let target = stylusOptions;
string.split('.').forEach((key: string)=>{
target = target[key];
});
return target;
});
for (const key in globalOptions.stylus.function) {
if (!Object.prototype.hasOwnProperty.call(globalOptions.stylus.function, key)) {
continue;
}
if (typeof globalOptions.stylus.function[key] !== 'function') {
continue;
}
style.define(key, globalOptions.stylus.function[key]);
}
style.set('paths', paths);
style.set('filename', filename);
return style.render();
}

@@ -47,0 +73,0 @@

@@ -14,4 +14,3 @@ {

"esModuleInterop": true,
"resolveJsonModule": true,
"watch": true
"resolveJsonModule": true
},

@@ -18,0 +17,0 @@ "include": ["./source/**/*"],

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