2018-12-08 15:38:48 +01:00
|
|
|
/* eslint no-unused-expressions: "warn" */
|
2021-06-13 15:31:44 +02:00
|
|
|
import buttons from '@freesewing/plugin-buttons'
|
2019-08-03 15:03:33 +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'
|
2021-06-13 15:31:44 +02:00
|
|
|
import mirror from '@freesewing/plugin-mirror'
|
2020-12-29 18:48:27 +01:00
|
|
|
import notches from '@freesewing/plugin-notches'
|
2019-08-03 15:03:33 +02:00
|
|
|
import title from '@freesewing/plugin-title'
|
|
|
|
import scalebox from '@freesewing/plugin-scalebox'
|
|
|
|
import round from '@freesewing/plugin-round'
|
|
|
|
import sprinkle from '@freesewing/plugin-sprinkle'
|
2020-06-27 18:31:51 +02:00
|
|
|
import measurements from '@freesewing/plugin-measurements'
|
2019-08-03 15:03:33 +02:00
|
|
|
import { version, name } from '../package.json'
|
2018-08-11 12:41:00 +02:00
|
|
|
|
2020-12-29 18:48:27 +01:00
|
|
|
let bundle = [
|
2021-06-13 15:31:44 +02:00
|
|
|
buttons,
|
2020-12-29 18:48:27 +01:00
|
|
|
cutonfold,
|
|
|
|
dimension,
|
|
|
|
grainline,
|
|
|
|
logo,
|
2021-06-13 15:31:44 +02:00
|
|
|
mirror,
|
2020-12-29 18:48:27 +01:00
|
|
|
notches,
|
|
|
|
title,
|
|
|
|
scalebox,
|
|
|
|
round,
|
|
|
|
sprinkle,
|
2021-04-24 10:16:31 +02:00
|
|
|
measurements,
|
2020-12-29 18:48:27 +01:00
|
|
|
]
|
2018-08-11 13:50:46 +02:00
|
|
|
|
|
|
|
function bundleHooks() {
|
2019-08-03 15:03:33 +02:00
|
|
|
let hooks = {}
|
2018-08-11 13:50:46 +02:00
|
|
|
for (let plugin of bundle) {
|
|
|
|
for (let i in plugin.hooks) {
|
2019-08-03 15:03:33 +02:00
|
|
|
if (typeof hooks[i] === 'undefined') hooks[i] = []
|
|
|
|
let hook = plugin.hooks[i]
|
|
|
|
if (typeof hook === 'function') hooks[i].push(hook)
|
|
|
|
else if (typeof hook === 'object') {
|
|
|
|
for (let method of hook) hooks[i].push(method)
|
2018-08-11 13:50:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
return hooks
|
2018-08-11 13:50:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function bundleMacros() {
|
2019-08-03 15:03:33 +02:00
|
|
|
let macros = {}
|
2018-08-11 13:50:46 +02:00
|
|
|
for (let plugin of bundle) {
|
2019-08-03 15:03:33 +02:00
|
|
|
for (let i in plugin.macros) macros[i] = plugin.macros[i]
|
2018-08-11 13:50:46 +02:00
|
|
|
}
|
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
return macros
|
2018-08-11 13:50:46 +02:00
|
|
|
}
|
|
|
|
|
2018-08-11 12:41:00 +02:00
|
|
|
export default {
|
|
|
|
name: name,
|
|
|
|
version: version,
|
2018-08-11 13:50:46 +02:00
|
|
|
hooks: bundleHooks(),
|
2021-04-24 10:16:31 +02:00
|
|
|
macros: bundleMacros(),
|
2019-08-03 15:03:33 +02:00
|
|
|
}
|