1
0
Fork 0

Merge branch 'develop' into annotations

This commit is contained in:
joostdecock 2023-04-15 15:47:00 +02:00
commit b33a739f54
1392 changed files with 11722 additions and 8413 deletions

View file

@ -4,7 +4,7 @@ import { measurementsPlugin } from '../../plugin-measurements/src/index.mjs'
import { mirrorPlugin } from '../../plugin-mirror/src/index.mjs'
import { roundPlugin } from '../../plugin-round/src/index.mjs'
import { sprinklePlugin } from '../../plugin-sprinkle/src/index.mjs'
import { logoPlugin } from '../../plugin-logo/src/index.mjs'
import { pluginCutlist } from '../../plugin-cutlist/src/index.mjs'
import { name, version } from '../data.mjs'
const bundledPlugins = [
@ -13,39 +13,44 @@ const bundledPlugins = [
mirrorPlugin,
roundPlugin,
sprinklePlugin,
logoPlugin,
pluginCutlist,
]
function bundleHooks() {
const hooks = {}
for (const plugin of bundledPlugins) {
for (const i in plugin.hooks) {
if (typeof hooks[i] === 'undefined') hooks[i] = []
const 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)
}
const hooks = {}
const macros = {}
const store = []
function bundleHooks(plugin) {
for (const i in plugin.hooks) {
if (typeof hooks[i] === 'undefined') hooks[i] = []
const 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)
}
}
return hooks
}
function bundleMacros() {
const macros = {}
for (const plugin of bundledPlugins) {
for (const i in plugin.macros) macros[i] = plugin.macros[i]
}
function bundleMacros(plugin) {
for (const i in plugin.macros) macros[i] = plugin.macros[i]
}
return macros
function bundleStore(plugin) {
if (plugin.store) store.push(...plugin.store)
}
for (const plugin of bundledPlugins) {
bundleHooks(plugin)
bundleMacros(plugin)
bundleStore(plugin)
}
export const plugin = {
name,
version,
hooks: bundleHooks(),
macros: bundleMacros(),
hooks,
macros,
store,
}
// More specifically named exports