2018-12-08 15:38:48 +01:00
|
|
|
/* eslint no-unused-expressions: "warn" */
|
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-12-21 17:00:53 +01:00
|
|
|
import round from "@freesewing/plugin-round";
|
2018-12-22 14:03:14 +01:00
|
|
|
import sprinkle from "@freesewing/plugin-sprinkle";
|
2018-08-11 12:41:00 +02:00
|
|
|
import { version, name } from "../package.json";
|
|
|
|
|
2018-12-22 14:03:14 +01:00
|
|
|
let bundle = [
|
|
|
|
cutonfold,
|
|
|
|
dimension,
|
|
|
|
grainline,
|
|
|
|
logo,
|
|
|
|
title,
|
|
|
|
scalebox,
|
|
|
|
round,
|
|
|
|
sprinkle
|
|
|
|
];
|
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);
|
2018-12-08 15:38:48 +01:00
|
|
|
else if (typeof hook === "object") {
|
2018-08-11 13:50:46 +02:00
|
|
|
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
|
|
|
};
|