@bbob/preset
Advanced tools
Comparing version 3.0.2 to 4.0.0
@@ -7,19 +7,33 @@ (function (global, factory) { | ||
/* eslint-disable indent */ const isTagNode = (el)=>typeof el === 'object' && !!el.tag; | ||
function isTagNode(el) { | ||
return typeof el === 'object' && el !== null && 'tag' in el; | ||
} | ||
function process(tags, tree, core, options) { | ||
tree.walk((node)=>isTagNode(node) && tags[node.tag] ? tags[node.tag](node, core, options) : node); | ||
return tree.walk((node)=>{ | ||
if (isTagNode(node)) { | ||
const tag = node.tag; | ||
const tagCallback = tags[tag]; | ||
if (typeof tagCallback === "function") { | ||
return tagCallback(node, core, options); | ||
} | ||
} | ||
return node; | ||
}); | ||
} | ||
/** | ||
* Creates preset for @bbob/core | ||
* @param defTags {Object} | ||
* @param processor {Function} a processor function of tree | ||
* @returns {function(*=): function(*=, *=): void} | ||
* Create a preset plugin for @bbob/core | ||
*/ function createPreset(defTags, processor = process) { | ||
const presetFactory = (opts = {})=>{ | ||
const presetFactory = (opts)=>{ | ||
presetFactory.options = Object.assign(presetFactory.options || {}, opts); | ||
const presetExecutor = (tree, core)=>processor(defTags, tree, core, presetFactory.options); | ||
function presetExecutor(tree, core) { | ||
return processor(defTags, tree, core, presetFactory.options || {}); | ||
} | ||
presetExecutor.options = presetFactory.options; | ||
return presetExecutor; | ||
}; | ||
presetFactory.extend = (callback)=>createPreset(callback(defTags, presetFactory.options), processor); | ||
presetFactory.extend = function presetExtend(callback) { | ||
const newTags = callback(defTags, presetFactory.options); | ||
return createPreset(newTags, processor); | ||
}; | ||
return presetFactory; | ||
@@ -30,2 +44,3 @@ } | ||
exports.default = createPreset; | ||
exports.process = process; | ||
@@ -32,0 +47,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BbobPreset={})}(this,function(e){"use strict";let t=e=>"object"==typeof e&&!!e.tag;function o(e,o,n,i){o.walk(o=>t(o)&&e[o.tag]?e[o.tag](o,n,i):o)}function n(e,t=o){let i=(o={})=>{i.options=Object.assign(i.options||{},o);let n=(o,n)=>t(e,o,n,i.options);return n.options=i.options,n};return i.extend=o=>n(o(e,i.options),t),i}e.createPreset=n,e.default=n,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).BbobPreset={})}(this,function(e){"use strict";function t(e,t,n,o){return t.walk(t=>{if("object"==typeof t&&null!==t&&"tag"in t){let i=e[t.tag];if("function"==typeof i)return i(t,n,o)}return t})}function n(e,o=t){let i=t=>{function n(t,n){return o(e,t,n,i.options||{})}return i.options=Object.assign(i.options||{},t),n.options=i.options,n};return i.extend=function(t){return n(t(e,i.options),o)},i}e.createPreset=n,e.default=n,e.process=t,Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -1,21 +0,2 @@ | ||
/* eslint-disable indent */ const isTagNode = (el)=>typeof el === 'object' && !!el.tag; | ||
function process(tags, tree, core, options) { | ||
tree.walk((node)=>isTagNode(node) && tags[node.tag] ? tags[node.tag](node, core, options) : node); | ||
} | ||
/** | ||
* Creates preset for @bbob/core | ||
* @param defTags {Object} | ||
* @param processor {Function} a processor function of tree | ||
* @returns {function(*=): function(*=, *=): void} | ||
*/ function createPreset(defTags, processor = process) { | ||
const presetFactory = (opts = {})=>{ | ||
presetFactory.options = Object.assign(presetFactory.options || {}, opts); | ||
const presetExecutor = (tree, core)=>processor(defTags, tree, core, presetFactory.options); | ||
presetExecutor.options = presetFactory.options; | ||
return presetExecutor; | ||
}; | ||
presetFactory.extend = (callback)=>createPreset(callback(defTags, presetFactory.options), processor); | ||
return presetFactory; | ||
} | ||
export { createPreset }; | ||
export default createPreset; | ||
export { default } from "./preset"; | ||
export * from "./preset"; |
@@ -1,48 +0,29 @@ | ||
/* eslint-disable indent */ "use strict"; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _export(target, all) { | ||
for(var name in all)Object.defineProperty(target, name, { | ||
enumerable: true, | ||
get: all[name] | ||
}); | ||
} | ||
_export(exports, { | ||
createPreset: function() { | ||
return createPreset; | ||
}, | ||
default: function() { | ||
return _default; | ||
Object.defineProperty(exports, "default", { | ||
enumerable: true, | ||
get: function() { | ||
return _preset.default; | ||
} | ||
}); | ||
var isTagNode = function(el) { | ||
return typeof el === "object" && !!el.tag; | ||
}; | ||
function process(tags, tree, core, options) { | ||
tree.walk(function(node) { | ||
return isTagNode(node) && tags[node.tag] ? tags[node.tag](node, core, options) : node; | ||
var _preset = /*#__PURE__*/ _interop_require_default(_export_star(require("./preset"), exports)); | ||
function _export_star(from, to) { | ||
Object.keys(from).forEach(function(k) { | ||
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) { | ||
Object.defineProperty(to, k, { | ||
enumerable: true, | ||
get: function() { | ||
return from[k]; | ||
} | ||
}); | ||
} | ||
}); | ||
return from; | ||
} | ||
/** | ||
* Creates preset for @bbob/core | ||
* @param defTags {Object} | ||
* @param processor {Function} a processor function of tree | ||
* @returns {function(*=): function(*=, *=): void} | ||
*/ function createPreset(defTags, processor) { | ||
if (processor === void 0) processor = process; | ||
var presetFactory = function(opts) { | ||
if (opts === void 0) opts = {}; | ||
presetFactory.options = Object.assign(presetFactory.options || {}, opts); | ||
var presetExecutor = function(tree, core) { | ||
return processor(defTags, tree, core, presetFactory.options); | ||
}; | ||
presetExecutor.options = presetFactory.options; | ||
return presetExecutor; | ||
function _interop_require_default(obj) { | ||
return obj && obj.__esModule ? obj : { | ||
default: obj | ||
}; | ||
presetFactory.extend = function(callback) { | ||
return createPreset(callback(defTags, presetFactory.options), processor); | ||
}; | ||
return presetFactory; | ||
} | ||
var _default = createPreset; |
{ | ||
"name": "@bbob/preset", | ||
"version": "3.0.2", | ||
"version": "4.0.0", | ||
"description": "Base preset for creating extensible presets for @bbob/core", | ||
@@ -10,2 +10,16 @@ "keywords": [ | ||
], | ||
"files": [ | ||
"dist", | ||
"lib", | ||
"src", | ||
"es", | ||
"types" | ||
], | ||
"dependencies": { | ||
"@bbob/plugin-helper": "*", | ||
"@bbob/types": "*" | ||
}, | ||
"devDependencies": { | ||
"@bbob/core": "*" | ||
}, | ||
"main": "lib/index.js", | ||
@@ -16,2 +30,12 @@ "module": "es/index.js", | ||
"browserName": "BbobPreset", | ||
"types": "types/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./types/index.d.ts", | ||
"import": "./es/index.js", | ||
"require": "./lib/index.js", | ||
"browser": "./dist/index.min.js", | ||
"umd": "./dist/index.min.js" | ||
} | ||
}, | ||
"homepage": "https://github.com/JiLiZART/bbob", | ||
@@ -27,16 +51,6 @@ "author": "Nikolay Kostyurin <jilizart@gmail.com>", | ||
}, | ||
"scripts": { | ||
"build:commonjs": "../../scripts/pkg-task build-commonjs", | ||
"build:es": "../../scripts/pkg-task build-es", | ||
"build:umd": "../../scripts/pkg-task build-umd", | ||
"build": "npm run build:commonjs && npm run build:es && npm run build:umd", | ||
"test": "../../scripts/pkg-task test", | ||
"cover": "../../scripts/pkg-task cover", | ||
"lint": "../../scripts/pkg-task lint", | ||
"size": "../../scripts/pkg-task size", | ||
"bundlesize": "../../scripts/pkg-task bundlesize" | ||
}, | ||
"size-limit": [ | ||
{ | ||
"path": "lib/index.js" | ||
"path": "./dist/index.min.js", | ||
"size": "1 KB" | ||
} | ||
@@ -53,8 +67,14 @@ ], | ||
}, | ||
"files": [ | ||
"dist", | ||
"lib", | ||
"src", | ||
"es" | ||
] | ||
} | ||
"scripts": { | ||
"build:commonjs": "pkg-task", | ||
"build:es": "pkg-task", | ||
"build:umd": "pkg-task", | ||
"build": "pkg-task", | ||
"test": "pkg-task", | ||
"cover": "pkg-task", | ||
"lint": "pkg-task", | ||
"size": "pkg-task", | ||
"bundlesize": "pkg-task", | ||
"types": "pkg-task" | ||
} | ||
} |
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 2 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
38037
16
228
2
1
2
1
+ Added@bbob/plugin-helper@*
+ Added@bbob/types@*
+ Added@bbob/plugin-helper@4.2.0(transitive)
+ Added@bbob/types@4.2.0(transitive)