2018-08-11 13:50:46 +02:00
|
|
|
import cutonfold from "@freesewing/plugin-cutonfold";
|
|
|
|
import dimension from "@freesewing/plugin-dimension";
|
|
|
|
import grainline from "@freesewing/plugin-grainline";
|
|
|
|
import logo from "@freesewing/plugin-logo";
|
|
|
|
import title from "@freesewing/plugin-title";
|
2018-08-20 14:06:24 +02:00
|
|
|
import scalebox from "@freesewing/plugin-scalebox";
|
2018-08-11 12:41:00 +02:00
|
|
|
import { version, name } from "../package.json";
|
|
|
|
|
2018-08-20 14:06:24 +02:00
|
|
|
let bundle = [cutonfold, dimension, grainline, logo, title, scalebox];
|
2018-08-11 13:50:46 +02:00
|
|
|
|
|
|
|
function bundleHooks() {
|
|
|
|
let hooks = {};
|
|
|
|
for (let plugin of bundle) {
|
|
|
|
for (let i in plugin.hooks) {
|
|
|
|
if (typeof hooks[i] === "undefined") hooks[i] = [];
|
|
|
|
let hook = plugin.hooks[i];
|
|
|
|
if (typeof hook === "function") hooks[i].push(hook);
|
|
|
|
else if (typeof hook === "array") {
|
|
|
|
for (let method of hook) hooks[i].push(method);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return hooks;
|
|
|
|
}
|
|
|
|
|
|
|
|
function bundleMacros() {
|
|
|
|
let macros = {};
|
|
|
|
for (let plugin of bundle) {
|
|
|
|
for (let i in plugin.macros) macros[i] = plugin.macros[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return macros;
|
|
|
|
}
|
|
|
|
|
2018-08-11 12:41:00 +02:00
|
|
|
export default {
|
|
|
|
name: name,
|
|
|
|
version: version,
|
2018-08-11 13:50:46 +02:00
|
|
|
hooks: bundleHooks(),
|
|
|
|
macros: bundleMacros()
|
2018-08-11 12:41:00 +02:00
|
|
|
};
|