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

fib-pug

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fib-pug - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

.editorconfig

6

index.js
/**
* only test in fibjs 0.21 and pug@2.0.0-rc.4
* test in:
* - fibjs 0.21, pug@2.0.0-rc.4
* - fibjs 0.22, pug@2.0.0-rc.4
* - fibjs 0.24, pug@2.0.0-rc.4
*
*/
const vm = require('vm');
const sbox = new vm.SandBox({

@@ -7,0 +11,0 @@ fs: require('fs'),

23

package.json
{
"name": "fib-pug",
"version": "0.0.1",
"version": "0.0.2",
"description": "pug run in fibjs",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"pretest": "npm run clean:test",
"ci": "fibjs test/index.spec.js",
"test": "fibjs test/index.spec.js",
"clean:test": "rm -rf test/**/*.html"
},

@@ -23,9 +26,19 @@ "repository": {

"homepage": "https://github.com/fibjs/fib-pug#readme",
"tested": {
"fibjs": "0.21.1",
"pug": "2.0.0-rc.4"
"ci": {
"type": "travis",
"version": [
"0.21.0",
"0.22.0",
"0.23.0",
"0.24.0"
]
},
"dependencies": {
"pug": "^2.0.0-rc.4"
},
"devDependencies": {
"@fibjs/ci": "^2.0.0",
"jstransformer-stylus": "^1.5.0",
"jstransformer-typescript": "^1.1.0"
}
}
# fib-pug
[![Build Status](https://travis-ci.org/richardo2016/fib-pug.svg?branch=master)](https://travis-ci.org/richardo2016/fib-pug)
[![NPM version](https://img.shields.io/npm/v/fib-pug.svg)](https://www.npmjs.org/package/fib-pug)
[pugjs]:https://github.com/pugjs/pug

@@ -8,2 +12,7 @@ [semver]:https://www.npmjs.com/package/semver

## Usage
```bash
npm i -S fib-pug
```
## I/O

@@ -14,6 +23,2 @@ As of `fs` module, luckily, fibjs has similar API with nodejs, we can run pugjs in fibjs, just do some magic hack with fibjs's `sandbox` module.

```javascript
/**
* only test in fibjs 0.21 and pug@2.0.0-rc.4
*
*/
const vm = require('vm');

@@ -66,1 +71,13 @@ const sbox = new vm.SandBox({

```
## Specical Features
### Filters
[jstransformer-stylus]:https://www.npmjs.com/package/jstransformer-stylus
[jstransformer-typescript]:https://www.npmjs.com/package/jstransformer-typescript
If you don't know about this feature, learn more about it [here](https://pugjs.org/language/filters.html)
`pug` takes `jstransformer-*`-like packages(such as [jstransformer-stylus]) as default filter. That is, if you write `:stylus` in pug, it would try to find `jstransformer-stylus` in nodejs's common pattern.
Some `jstransformer-*`-like packages may be incompatible with fibjs, You can also customize filter as you like. View more sample usages for **filter** [here](/test/filters)

@@ -7,2 +7,3 @@ #!/usr/bin/env fibjs

const fs = require('fs')
const path = require('path')

@@ -20,3 +21,3 @@ const pug = require('../')

const pugRaw = 'div\n\t!= testVar'
const locals = {testVar: '测试变量'}
const locals = { testVar: '测试变量' }
const html = pug.compile(pugRaw)(locals)

@@ -27,3 +28,3 @@ assert.equal('<div>测试变量</div>', html);

it('测试另一段从文件里读取的 raw text', () => {
const pugRaw = fs.readTextFile('./fib-pug.1.pug')
const pugRaw = fs.readTextFile(path.join(__dirname, './fib-pug.1.pug'))
const html = pug.compile(pugRaw)()

@@ -42,3 +43,3 @@ assert.equal('<div>我是一个 pug 文件, 在 fibjs 的驱动下跑 pug 包.</div>', html);

it('测试另一段从文件里读取的 raw text', () => {
const pugRaw = fs.readTextFile('./fib-pug.1.pug')
const pugRaw = fs.readTextFile(path.join(__dirname, './fib-pug.1.pug'))
const html = pug.render(pugRaw)

@@ -51,7 +52,10 @@ assert.equal('<div>我是一个 pug 文件, 在 fibjs 的驱动下跑 pug 包.</div>', html);

it('basic', () => {
const html = pug.renderFile('./fib-pug.1.pug')
const html = pug.renderFile(path.join(__dirname, './fib-pug.1.pug'))
assert.equal('<div>我是一个 pug 文件, 在 fibjs 的驱动下跑 pug 包.</div>', html);
})
})
// all sub-test must be placed before `test.run()`
require('./filters/index.spec')
test.run()
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