1
0
Fork 0

[plugins] fix: Provide name in export. Fixes #280

This commit is contained in:
joostdecock 2025-04-24 08:47:55 +02:00
parent f9d68bd2e1
commit 5d71d6f87a
17 changed files with 34 additions and 17 deletions

View file

@ -45,7 +45,8 @@ for (const plugin of bundledPlugins) {
} }
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
store, store,
hooks, hooks,
macros, macros,

View file

@ -23,7 +23,8 @@ import { sewtogetherMacros, sewtogetherDefs } from './sewtogether.mjs'
import { flagStores } from './flag.mjs' import { flagStores } from './flag.mjs'
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
hooks: { hooks: {
preRender: [ preRender: [
function (svg) { function (svg) {

View file

@ -2,7 +2,8 @@ import about from '../about.json' with { type: 'json' }
import { pack } from './growing-packer.mjs' import { pack } from './growing-packer.mjs'
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
store: [['pack', pack]], store: [['pack', pack]],
} }

View file

@ -1,7 +1,8 @@
import about from '../about.json' with { type: 'json' } import about from '../about.json' with { type: 'json' }
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
hooks: { hooks: {
preSetDraft: function ({ settings, activeSet }) { preSetDraft: function ({ settings, activeSet }) {
const set = settings[Number(activeSet)] const set = settings[Number(activeSet)]

View file

@ -1,7 +1,8 @@
import about from '../about.json' with { type: 'json' } import about from '../about.json' with { type: 'json' }
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
macros: { macros: {
flip: function (so, { paths, points, snippets }) { flip: function (so, { paths, points, snippets }) {
const axis = so?.axis === 'y' ? 'y' : 'x' const axis = so?.axis === 'y' ? 'y' : 'x'

View file

@ -1,7 +1,8 @@
import about from '../about.json' with { type: 'json' } import about from '../about.json' with { type: 'json' }
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
macros: { macros: {
gore: function (so, { points, paths, Path }) { gore: function (so, { points, paths, Path }) {
const from = so.from const from = so.from

View file

@ -24,7 +24,8 @@ const translate = (locale, text, t, pattern) => {
} }
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
hooks: { insertText: translate }, hooks: { insertText: translate },
} }

View file

@ -1,7 +1,8 @@
import about from '../about.json' with { type: 'json' } import about from '../about.json' with { type: 'json' }
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
hooks: { hooks: {
preDraft: function ({ settings }) { preDraft: function ({ settings }) {
for (const set of settings) { for (const set of settings) {

View file

@ -36,7 +36,8 @@ const mirrorGen = (start, end) => {
const capFirst = (string) => string.charAt(0).toUpperCase() + string.slice(1) const capFirst = (string) => string.charAt(0).toUpperCase() + string.slice(1)
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
macros: { macros: {
mirror: function ({ mirror: function ({
mirror, mirror,

View file

@ -485,7 +485,8 @@ const hemMacro = function (
} }
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
macros: { macros: {
join: joinMacro, join: joinMacro,
offset: offsetMacro, offset: offsetMacro,

View file

@ -44,7 +44,8 @@ const keys = [
* The plugin object itself * The plugin object itself
*/ */
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
macros: { macros: {
rmringsector: function (id = 'ringsector', { points, paths, store, part }) { rmringsector: function (id = 'ringsector', { points, paths, store, part }) {
const storeRoot = ['parts', part.name, 'macros', '@freesewing/plugin-ringsector', 'ids', id] const storeRoot = ['parts', part.name, 'macros', '@freesewing/plugin-ringsector', 'ids', id]

View file

@ -7,7 +7,8 @@ const pointKeys = ['start', 'cp1', 'cp2', 'end']
const pathKeys = ['path'] const pathKeys = ['path']
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
macros: { macros: {
round: function (mc, { points, paths, Point, Path, store }) { round: function (mc, { points, paths, Point, Path, store }) {
const C = 0.55191502449 const C = 0.55191502449

View file

@ -1,7 +1,8 @@
import about from '../about.json' with { type: 'json' } import about from '../about.json' with { type: 'json' }
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
macros: { macros: {
sprinkle: function (so, { snippets, Snippet, points }) { sprinkle: function (so, { snippets, Snippet, points }) {
for (let pid of so.on) { for (let pid of so.on) {

View file

@ -1,7 +1,8 @@
import about from '../about.json' with { type: 'json' } import about from '../about.json' with { type: 'json' }
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
hooks: { hooks: {
preRender: function (svg, attributes = {}) { preRender: function (svg, attributes = {}) {
for (const key of Object.keys(attributes)) svg.attributes.set(key, attributes[key]) for (const key of Object.keys(attributes)) svg.attributes.set(key, attributes[key])

View file

@ -21,7 +21,8 @@ const grid = {
} }
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
hooks: { hooks: {
preRender: function (svg, data = {}) { preRender: function (svg, data = {}) {
const current = svg.attributes.get('class') const current = svg.attributes.get('class')

View file

@ -17,7 +17,8 @@ const delta = (start) => {
/* eslint-enable no-undef */ /* eslint-enable no-undef */
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
hooks: { hooks: {
preSetDraft: function (pattern) { preSetDraft: function (pattern) {
const time = now() const time = now()

View file

@ -1,7 +1,8 @@
import about from '../about.json' with { type: 'json' } import about from '../about.json' with { type: 'json' }
export const plugin = { export const plugin = {
...about, name: about.id,
version: about.version,
hooks: { hooks: {
preRender: function (svg) { preRender: function (svg) {
for (const key in svg.attributes.list) { for (const key in svg.attributes.list) {