@bbob/core
Advanced tools
Comparing version 1.0.5 to 1.1.0
@@ -6,2 +6,22 @@ # Change Log | ||
<a name="1.1.0"></a> | ||
# [1.1.0](https://github.com/JiLiZART/bbob/compare/@bbob/core@1.0.6...@bbob/core@1.1.0) (2018-08-09) | ||
### Features | ||
* **core:** add helper function to plugin api ([e189a39](https://github.com/JiLiZART/bbob/commit/e189a39)) | ||
* **core:** implement plugin api ([ee047e8](https://github.com/JiLiZART/bbob/commit/ee047e8)) | ||
<a name="1.0.6"></a> | ||
## [1.0.6](https://github.com/JiLiZART/bbob/compare/@bbob/core@1.0.5...@bbob/core@1.0.6) (2018-07-13) | ||
**Note:** Version bump only for package @bbob/core | ||
<a name="1.0.5"></a> | ||
@@ -8,0 +28,0 @@ ## [1.0.5](https://github.com/JiLiZART/bbob/compare/@bbob/core@1.0.4...@bbob/core@1.0.5) (2018-07-11) |
@@ -1,21 +0,49 @@ | ||
class BBob { | ||
constructor(plugins) { | ||
this.plugins = plugins; | ||
} | ||
const parser = require('@bbob/parser'); | ||
const render = require('@bbob/html'); | ||
// parse() { | ||
// | ||
// } | ||
// | ||
// stringify() { | ||
// | ||
// } | ||
// | ||
// process(input) { | ||
// | ||
// } | ||
const { iterate, match } = require('./utils'); | ||
function walk(cb) { | ||
return iterate(this, cb); | ||
} | ||
module.exports = function bbob(...plugins) { | ||
return new BBob(plugins); | ||
module.exports = function bbob(plugs) { | ||
const plugins = typeof plugs === 'function' ? [plugs] : plugs || []; | ||
let options = { | ||
skipParse: false, | ||
}; | ||
return { | ||
process(input, opts) { | ||
options = opts || {}; | ||
const parseFn = options.parser || parser; | ||
const renderFn = options.render || render; | ||
let tree = options.skipParse | ||
? input || [] | ||
: parseFn(input, options); | ||
tree.walk = walk; | ||
tree.match = match; | ||
plugins.forEach((plugin) => { | ||
tree = plugin(tree, { | ||
parse: parseFn, | ||
render: renderFn, | ||
iterate, | ||
match, | ||
}) || tree; | ||
}); | ||
return { | ||
get html() { | ||
return renderFn(tree, tree.options); | ||
}, | ||
tree, | ||
messages: tree.messages, | ||
}; | ||
}, | ||
}; | ||
}; |
{ | ||
"name": "@bbob/core", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"description": "BBob is a tool to transform BBCode markup useing presets", | ||
@@ -10,6 +10,8 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@bbob/html": "^1.0.6", | ||
"@bbob/parser": "^1.0.10", | ||
"@bbob/preset-html5": "^1.0.5" | ||
"@bbob/html": "^1.1.0", | ||
"@bbob/parser": "^1.2.0" | ||
}, | ||
"peerDependencies": { | ||
"@bbob/preset-html5": "^1.x" | ||
}, | ||
"repository": { | ||
@@ -16,0 +18,0 @@ "type": "git", |
@@ -1,2 +0,2 @@ | ||
# bbob | ||
# @bbob/core | ||
@@ -10,3 +10,5 @@ ## Usage | ||
const processor = bbob([presetHTML5]).process(code, {sync: true}).html | ||
const html = bbob([presetHTML5()]).process(code).html; | ||
console.log(html); // <span style="font-style: italic;">Text</span> | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4860
6
91
14
9
- Removed@bbob/preset-html5@^1.0.5
Updated@bbob/html@^1.1.0
Updated@bbob/parser@^1.2.0