@powerlines/plugin-satori 0.1.301 → 0.1.303

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -4,8 +4,8 @@ import "./types/index.cjs";
4
4
  import { Plugin } from "powerlines";
5
5
 
6
6
  //#region src/index.d.ts
7
- declare module "powerlines" {
8
- interface UserConfig {
7
+ declare module "@powerlines/core" {
8
+ interface BaseConfig {
9
9
  satori?: SatoriPluginOptions;
10
10
  }
11
11
  }
package/dist/index.d.mts CHANGED
@@ -4,8 +4,8 @@ import "./types/index.mjs";
4
4
  import { Plugin } from "powerlines";
5
5
 
6
6
  //#region src/index.d.ts
7
- declare module "powerlines" {
8
- interface UserConfig {
7
+ declare module "@powerlines/core" {
8
+ interface BaseConfig {
9
9
  satori?: SatoriPluginOptions;
10
10
  }
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { findFileExtensionSafe } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport defu from \"defu\";\nimport type { Plugin } from \"powerlines\";\nimport { replacePathTokens } from \"powerlines/plugin-utils\";\nimport satori from \"satori\";\nimport { SatoriComponentModule } from \"./types/module\";\nimport {\n SatoriPluginContext,\n SatoriPluginOptions,\n SatoriPluginUserConfig\n} from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n export interface UserConfig {\n satori?: SatoriPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to use Untyped for code generation based on user-defined schemas.\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends SatoriPluginContext = SatoriPluginContext\n>(\n options: SatoriPluginOptions\n): Plugin<TContext> => {\n return {\n name: \"satori\",\n config() {\n return {\n satori: {\n defaultOptions: {},\n width: 1200,\n height: 630,\n fonts: [],\n ...options\n }\n } as Partial<SatoriPluginUserConfig>;\n },\n async configResolved() {\n if (!this.config.satori.path) {\n throw new Error(\n \"The Powerlines Satori plugin requires a \\`path\\` option to be specified.\"\n );\n }\n\n this.config.satori.inputs = (\n await Promise.all(\n toArray(this.config.satori.path).map(async path => {\n if (path.includes(\"*\")) {\n return listFiles(replacePathTokens(this, path));\n }\n\n return replacePathTokens(this, path);\n })\n )\n )\n .flat()\n .filter(\n path =>\n path &&\n [\"jsx\", \"tsx\"].includes(findFileExtensionSafe(path)) &&\n existsSync(path)\n );\n },\n async prepare() {\n await Promise.all(\n this.config.satori.inputs.map(async input => {\n try {\n const mod =\n await this.resolver.import<SatoriComponentModule>(input);\n if (mod && mod.default) {\n const result = await satori(\n mod.default,\n defu(mod.options ?? {}, this.config.satori.defaultOptions)\n );\n if (result) {\n await this.fs.write(\n this.config.satori.outputPath\n ? joinPaths(\n this.config.satori.outputPath,\n replacePath(\n input,\n joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.root\n )\n )\n )\n : input.replace(findFileExtensionSafe(input), \"svg\"),\n result\n );\n }\n }\n } catch (error) {\n this.debug(\n `Failed to load Satori schema from ${input}: ${(error as Error).message}`\n );\n }\n })\n );\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;AAiDA,MAAa,UAGX,YACqB;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO,EACL,QAAQ;IACN,gBAAgB,EAAE;IAClB,OAAO;IACP,QAAQ;IACR,OAAO,EAAE;IACT,GAAG;IACJ,EACF;;EAEH,MAAM,iBAAiB;AACrB,OAAI,CAAC,KAAK,OAAO,OAAO,KACtB,OAAM,IAAI,MACR,yEACD;AAGH,QAAK,OAAO,OAAO,UACjB,MAAM,QAAQ,IACZ,QAAQ,KAAK,OAAO,OAAO,KAAK,CAAC,IAAI,OAAM,SAAQ;AACjD,QAAI,KAAK,SAAS,IAAI,CACpB,QAAO,UAAU,kBAAkB,MAAM,KAAK,CAAC;AAGjD,WAAO,kBAAkB,MAAM,KAAK;KACpC,CACH,EAEA,MAAM,CACN,QACC,SACE,QACA,CAAC,OAAO,MAAM,CAAC,SAAS,sBAAsB,KAAK,CAAC,IACpD,WAAW,KAAK,CACnB;;EAEL,MAAM,UAAU;AACd,SAAM,QAAQ,IACZ,KAAK,OAAO,OAAO,OAAO,IAAI,OAAM,UAAS;AAC3C,QAAI;KACF,MAAM,MACJ,MAAM,KAAK,SAAS,OAA8B,MAAM;AAC1D,SAAI,OAAO,IAAI,SAAS;MACtB,MAAM,SAAS,MAAM,OACnB,IAAI,SACJ,KAAK,IAAI,WAAW,EAAE,EAAE,KAAK,OAAO,OAAO,eAAe,CAC3D;AACD,UAAI,OACF,OAAM,KAAK,GAAG,MACZ,KAAK,OAAO,OAAO,aACf,UACE,KAAK,OAAO,OAAO,YACnB,YACE,OACA,UACE,KAAK,gBAAgB,eACrB,KAAK,OAAO,KACb,CACF,CACF,GACD,MAAM,QAAQ,sBAAsB,MAAM,EAAE,MAAM,EACtD,OACD;;aAGE,OAAO;AACd,UAAK,MACH,qCAAqC,MAAM,IAAK,MAAgB,UACjE;;KAEH,CACH;;EAEJ;;AAGH,kBAAe"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { findFileExtensionSafe } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport defu from \"defu\";\nimport type { Plugin } from \"powerlines\";\nimport { replacePathTokens } from \"powerlines/plugin-utils\";\nimport satori from \"satori\";\nimport { SatoriComponentModule } from \"./types/module\";\nimport {\n SatoriPluginContext,\n SatoriPluginOptions,\n SatoriPluginUserConfig\n} from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface BaseConfig {\n satori?: SatoriPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to use Untyped for code generation based on user-defined schemas.\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends SatoriPluginContext = SatoriPluginContext\n>(\n options: SatoriPluginOptions\n): Plugin<TContext> => {\n return {\n name: \"satori\",\n config() {\n return {\n satori: {\n defaultOptions: {},\n width: 1200,\n height: 630,\n fonts: [],\n ...options\n }\n } as Partial<SatoriPluginUserConfig>;\n },\n async configResolved() {\n if (!this.config.satori.path) {\n throw new Error(\n \"The Powerlines Satori plugin requires a \\`path\\` option to be specified.\"\n );\n }\n\n this.config.satori.inputs = (\n await Promise.all(\n toArray(this.config.satori.path).map(async path => {\n if (path.includes(\"*\")) {\n return listFiles(replacePathTokens(this, path));\n }\n\n return replacePathTokens(this, path);\n })\n )\n )\n .flat()\n .filter(\n path =>\n path &&\n [\"jsx\", \"tsx\"].includes(findFileExtensionSafe(path)) &&\n existsSync(path)\n );\n },\n async prepare() {\n await Promise.all(\n this.config.satori.inputs.map(async input => {\n try {\n const mod =\n await this.resolver.import<SatoriComponentModule>(input);\n if (mod && mod.default) {\n const result = await satori(\n mod.default,\n defu(mod.options ?? {}, this.config.satori.defaultOptions)\n );\n if (result) {\n await this.fs.write(\n this.config.satori.outputPath\n ? joinPaths(\n this.config.satori.outputPath,\n replacePath(\n input,\n joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.root\n )\n )\n )\n : input.replace(findFileExtensionSafe(input), \"svg\"),\n result\n );\n }\n }\n } catch (error) {\n this.debug(\n `Failed to load Satori schema from ${input}: ${(error as Error).message}`\n );\n }\n })\n );\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;AAiDA,MAAa,UAGX,YACqB;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO,EACL,QAAQ;IACN,gBAAgB,EAAE;IAClB,OAAO;IACP,QAAQ;IACR,OAAO,EAAE;IACT,GAAG;IACJ,EACF;;EAEH,MAAM,iBAAiB;AACrB,OAAI,CAAC,KAAK,OAAO,OAAO,KACtB,OAAM,IAAI,MACR,yEACD;AAGH,QAAK,OAAO,OAAO,UACjB,MAAM,QAAQ,IACZ,QAAQ,KAAK,OAAO,OAAO,KAAK,CAAC,IAAI,OAAM,SAAQ;AACjD,QAAI,KAAK,SAAS,IAAI,CACpB,QAAO,UAAU,kBAAkB,MAAM,KAAK,CAAC;AAGjD,WAAO,kBAAkB,MAAM,KAAK;KACpC,CACH,EAEA,MAAM,CACN,QACC,SACE,QACA,CAAC,OAAO,MAAM,CAAC,SAAS,sBAAsB,KAAK,CAAC,IACpD,WAAW,KAAK,CACnB;;EAEL,MAAM,UAAU;AACd,SAAM,QAAQ,IACZ,KAAK,OAAO,OAAO,OAAO,IAAI,OAAM,UAAS;AAC3C,QAAI;KACF,MAAM,MACJ,MAAM,KAAK,SAAS,OAA8B,MAAM;AAC1D,SAAI,OAAO,IAAI,SAAS;MACtB,MAAM,SAAS,MAAM,OACnB,IAAI,SACJ,KAAK,IAAI,WAAW,EAAE,EAAE,KAAK,OAAO,OAAO,eAAe,CAC3D;AACD,UAAI,OACF,OAAM,KAAK,GAAG,MACZ,KAAK,OAAO,OAAO,aACf,UACE,KAAK,OAAO,OAAO,YACnB,YACE,OACA,UACE,KAAK,gBAAgB,eACrB,KAAK,OAAO,KACb,CACF,CACF,GACD,MAAM,QAAQ,sBAAsB,MAAM,EAAE,MAAM,EACtD,OACD;;aAGE,OAAO;AACd,UAAK,MACH,qCAAqC,MAAM,IAAK,MAAgB,UACjE;;KAEH,CACH;;EAEJ;;AAGH,kBAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-satori",
3
- "version": "0.1.301",
3
+ "version": "0.1.303",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin to use Satori to generate SVG files from jsx/tsx components.",
6
6
  "repository": {
@@ -117,11 +117,11 @@
117
117
  "@stryke/types": "^0.10.39",
118
118
  "defu": "^6.1.4",
119
119
  "jiti": "^2.6.1",
120
- "powerlines": "^0.39.10",
120
+ "powerlines": "^0.39.12",
121
121
  "satori": "^0.18.4"
122
122
  },
123
123
  "devDependencies": {
124
- "@powerlines/plugin-plugin": "^0.12.253",
124
+ "@powerlines/plugin-plugin": "^0.12.255",
125
125
  "@storm-software/config": "^1.135.11",
126
126
  "@types/node": "^25.3.3",
127
127
  "@types/react": "^19.2.14",
@@ -129,5 +129,5 @@
129
129
  },
130
130
  "publishConfig": { "access": "public" },
131
131
  "types": "./dist/index.d.cts",
132
- "gitHead": "905dbeee1a9e2658cf70489e977cafac62733e46"
132
+ "gitHead": "cb34e2756e722735631673a7c06509d2640284c1"
133
133
  }