@powerlines/plugin-asyncapi 0.1.305 → 0.1.307

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
@@ -3,8 +3,8 @@ import "./types/index.cjs";
3
3
  import { Plugin } from "powerlines";
4
4
 
5
5
  //#region src/index.d.ts
6
- declare module "powerlines" {
7
- interface UserConfig {
6
+ declare module "@powerlines/core" {
7
+ interface BaseConfig {
8
8
  asyncapi?: AsyncAPIPluginOptions;
9
9
  }
10
10
  }
package/dist/index.d.mts CHANGED
@@ -3,8 +3,8 @@ import "./types/index.mjs";
3
3
  import { Plugin } from "powerlines";
4
4
 
5
5
  //#region src/index.d.ts
6
- declare module "powerlines" {
7
- interface UserConfig {
6
+ declare module "@powerlines/core" {
7
+ interface BaseConfig {
8
8
  asyncapi?: AsyncAPIPluginOptions;
9
9
  }
10
10
  }
@@ -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 { Generator } from \"@asyncapi/generator\";\nimport { isAsyncAPIDocument } from \"@asyncapi/parser/esm/document\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { isPackageExists } from \"@stryke/fs/package-fns\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport defu from \"defu\";\nimport type { Plugin } from \"powerlines\";\nimport { replacePathTokens } from \"powerlines/plugin-utils\";\nimport type {\n AsyncAPIPluginContext,\n AsyncAPIPluginOptions\n} from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n export interface UserConfig {\n asyncapi?: AsyncAPIPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to integrate AsyncAPI for code generation.\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends AsyncAPIPluginContext = AsyncAPIPluginContext\n>(\n options: AsyncAPIPluginOptions\n): Plugin<TContext> => {\n return {\n name: \"asyncapi\",\n config() {\n return {\n asyncapi: defu(options, {\n schema: joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.root,\n \"schema.yaml\"\n ),\n output: \"string\",\n install: false,\n compile: false,\n debug:\n this.config.mode === \"development\" ||\n this.config.logLevel === \"debug\" ||\n this.config.logLevel === \"trace\",\n targetDir: joinPaths(this.builtinsPath, \"asyncapi\")\n })\n };\n },\n async configResolved() {\n if (!this.config.asyncapi.schema) {\n throw new Error(\n 'AsyncAPI schema is required. Please specify it in the plugin options or your Powerlines configuration under \"asyncapi.schema\".'\n );\n }\n\n if (\n !this.config.asyncapi.document ||\n !isAsyncAPIDocument(this.config.asyncapi.document)\n ) {\n if (isAsyncAPIDocument(this.config.asyncapi.schema)) {\n this.config.asyncapi.document = this.config.asyncapi.schema;\n } else if (existsSync(this.config.asyncapi.schema.toString())) {\n const document = await this.fs.read(\n this.config.asyncapi.schema.toString()\n );\n if (!document) {\n throw new Error(\n `Failed to read AsyncAPI schema from file: ${this.config.asyncapi.schema.toString()}`\n );\n }\n\n this.config.asyncapi.document = document;\n } else {\n const document = await this.fetch(\n this.config.asyncapi.schema.toString()\n );\n if (!document) {\n throw new Error(\n `Failed to fetch AsyncAPI schema from endpoint: ${this.config.asyncapi.schema.toString()}`\n );\n }\n\n this.config.asyncapi.document = await document.text();\n }\n }\n\n if (!this.config.asyncapi.templateName) {\n throw new Error(\n 'AsyncAPI template name is required. Please specify it in the plugin options or your Powerlines configuration under \"asyncapi.templateName\".'\n );\n }\n\n if (!this.config.asyncapi.outputPath) {\n throw new Error(\n 'AsyncAPI output path is required. Please specify it in the plugin options or your Powerlines configuration under \"asyncapi.outputPath\".'\n );\n }\n\n if (\n !existsSync(this.config.asyncapi.templateName) &&\n !isPackageExists(this.config.asyncapi.templateName)\n ) {\n this.devDependencies[this.config.asyncapi.templateName] = \"latest\";\n }\n\n this.config.asyncapi.outputPath = replacePathTokens(\n this,\n this.config.asyncapi.outputPath\n );\n },\n async prepare() {\n const generator = new Generator(\n this.config.asyncapi.templateName,\n this.config.asyncapi.outputPath,\n this.config.asyncapi\n );\n\n await generator.generate(this.config.asyncapi.document);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;AA6CA,MAAa,UAGX,YACqB;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO,EACL,UAAU,KAAK,SAAS;IACtB,QAAQ,UACN,KAAK,gBAAgB,eACrB,KAAK,OAAO,MACZ,cACD;IACD,QAAQ;IACR,SAAS;IACT,SAAS;IACT,OACE,KAAK,OAAO,SAAS,iBACrB,KAAK,OAAO,aAAa,WACzB,KAAK,OAAO,aAAa;IAC3B,WAAW,UAAU,KAAK,cAAc,WAAW;IACpD,CAAC,EACH;;EAEH,MAAM,iBAAiB;AACrB,OAAI,CAAC,KAAK,OAAO,SAAS,OACxB,OAAM,IAAI,MACR,mIACD;AAGH,OACE,CAAC,KAAK,OAAO,SAAS,YACtB,CAAC,mBAAmB,KAAK,OAAO,SAAS,SAAS,CAElD,KAAI,mBAAmB,KAAK,OAAO,SAAS,OAAO,CACjD,MAAK,OAAO,SAAS,WAAW,KAAK,OAAO,SAAS;YAC5C,WAAW,KAAK,OAAO,SAAS,OAAO,UAAU,CAAC,EAAE;IAC7D,MAAM,WAAW,MAAM,KAAK,GAAG,KAC7B,KAAK,OAAO,SAAS,OAAO,UAAU,CACvC;AACD,QAAI,CAAC,SACH,OAAM,IAAI,MACR,6CAA6C,KAAK,OAAO,SAAS,OAAO,UAAU,GACpF;AAGH,SAAK,OAAO,SAAS,WAAW;UAC3B;IACL,MAAM,WAAW,MAAM,KAAK,MAC1B,KAAK,OAAO,SAAS,OAAO,UAAU,CACvC;AACD,QAAI,CAAC,SACH,OAAM,IAAI,MACR,kDAAkD,KAAK,OAAO,SAAS,OAAO,UAAU,GACzF;AAGH,SAAK,OAAO,SAAS,WAAW,MAAM,SAAS,MAAM;;AAIzD,OAAI,CAAC,KAAK,OAAO,SAAS,aACxB,OAAM,IAAI,MACR,gJACD;AAGH,OAAI,CAAC,KAAK,OAAO,SAAS,WACxB,OAAM,IAAI,MACR,4IACD;AAGH,OACE,CAAC,WAAW,KAAK,OAAO,SAAS,aAAa,IAC9C,CAAC,gBAAgB,KAAK,OAAO,SAAS,aAAa,CAEnD,MAAK,gBAAgB,KAAK,OAAO,SAAS,gBAAgB;AAG5D,QAAK,OAAO,SAAS,aAAa,kBAChC,MACA,KAAK,OAAO,SAAS,WACtB;;EAEH,MAAM,UAAU;AAOd,SANkB,IAAI,UACpB,KAAK,OAAO,SAAS,cACrB,KAAK,OAAO,SAAS,YACrB,KAAK,OAAO,SACb,CAEe,SAAS,KAAK,OAAO,SAAS,SAAS;;EAE1D;;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 { Generator } from \"@asyncapi/generator\";\nimport { isAsyncAPIDocument } from \"@asyncapi/parser/esm/document\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { isPackageExists } from \"@stryke/fs/package-fns\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport defu from \"defu\";\nimport type { Plugin } from \"powerlines\";\nimport { replacePathTokens } from \"powerlines/plugin-utils\";\nimport type {\n AsyncAPIPluginContext,\n AsyncAPIPluginOptions\n} from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface BaseConfig {\n asyncapi?: AsyncAPIPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to integrate AsyncAPI for code generation.\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends AsyncAPIPluginContext = AsyncAPIPluginContext\n>(\n options: AsyncAPIPluginOptions\n): Plugin<TContext> => {\n return {\n name: \"asyncapi\",\n config() {\n return {\n asyncapi: defu(options, {\n schema: joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.root,\n \"schema.yaml\"\n ),\n output: \"string\",\n install: false,\n compile: false,\n debug:\n this.config.mode === \"development\" ||\n this.config.logLevel === \"debug\" ||\n this.config.logLevel === \"trace\",\n targetDir: joinPaths(this.builtinsPath, \"asyncapi\")\n })\n };\n },\n async configResolved() {\n if (!this.config.asyncapi.schema) {\n throw new Error(\n 'AsyncAPI schema is required. Please specify it in the plugin options or your Powerlines configuration under \"asyncapi.schema\".'\n );\n }\n\n if (\n !this.config.asyncapi.document ||\n !isAsyncAPIDocument(this.config.asyncapi.document)\n ) {\n if (isAsyncAPIDocument(this.config.asyncapi.schema)) {\n this.config.asyncapi.document = this.config.asyncapi.schema;\n } else if (existsSync(this.config.asyncapi.schema.toString())) {\n const document = await this.fs.read(\n this.config.asyncapi.schema.toString()\n );\n if (!document) {\n throw new Error(\n `Failed to read AsyncAPI schema from file: ${this.config.asyncapi.schema.toString()}`\n );\n }\n\n this.config.asyncapi.document = document;\n } else {\n const document = await this.fetch(\n this.config.asyncapi.schema.toString()\n );\n if (!document) {\n throw new Error(\n `Failed to fetch AsyncAPI schema from endpoint: ${this.config.asyncapi.schema.toString()}`\n );\n }\n\n this.config.asyncapi.document = await document.text();\n }\n }\n\n if (!this.config.asyncapi.templateName) {\n throw new Error(\n 'AsyncAPI template name is required. Please specify it in the plugin options or your Powerlines configuration under \"asyncapi.templateName\".'\n );\n }\n\n if (!this.config.asyncapi.outputPath) {\n throw new Error(\n 'AsyncAPI output path is required. Please specify it in the plugin options or your Powerlines configuration under \"asyncapi.outputPath\".'\n );\n }\n\n if (\n !existsSync(this.config.asyncapi.templateName) &&\n !isPackageExists(this.config.asyncapi.templateName)\n ) {\n this.devDependencies[this.config.asyncapi.templateName] = \"latest\";\n }\n\n this.config.asyncapi.outputPath = replacePathTokens(\n this,\n this.config.asyncapi.outputPath\n );\n },\n async prepare() {\n const generator = new Generator(\n this.config.asyncapi.templateName,\n this.config.asyncapi.outputPath,\n this.config.asyncapi\n );\n\n await generator.generate(this.config.asyncapi.document);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;AA6CA,MAAa,UAGX,YACqB;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO,EACL,UAAU,KAAK,SAAS;IACtB,QAAQ,UACN,KAAK,gBAAgB,eACrB,KAAK,OAAO,MACZ,cACD;IACD,QAAQ;IACR,SAAS;IACT,SAAS;IACT,OACE,KAAK,OAAO,SAAS,iBACrB,KAAK,OAAO,aAAa,WACzB,KAAK,OAAO,aAAa;IAC3B,WAAW,UAAU,KAAK,cAAc,WAAW;IACpD,CAAC,EACH;;EAEH,MAAM,iBAAiB;AACrB,OAAI,CAAC,KAAK,OAAO,SAAS,OACxB,OAAM,IAAI,MACR,mIACD;AAGH,OACE,CAAC,KAAK,OAAO,SAAS,YACtB,CAAC,mBAAmB,KAAK,OAAO,SAAS,SAAS,CAElD,KAAI,mBAAmB,KAAK,OAAO,SAAS,OAAO,CACjD,MAAK,OAAO,SAAS,WAAW,KAAK,OAAO,SAAS;YAC5C,WAAW,KAAK,OAAO,SAAS,OAAO,UAAU,CAAC,EAAE;IAC7D,MAAM,WAAW,MAAM,KAAK,GAAG,KAC7B,KAAK,OAAO,SAAS,OAAO,UAAU,CACvC;AACD,QAAI,CAAC,SACH,OAAM,IAAI,MACR,6CAA6C,KAAK,OAAO,SAAS,OAAO,UAAU,GACpF;AAGH,SAAK,OAAO,SAAS,WAAW;UAC3B;IACL,MAAM,WAAW,MAAM,KAAK,MAC1B,KAAK,OAAO,SAAS,OAAO,UAAU,CACvC;AACD,QAAI,CAAC,SACH,OAAM,IAAI,MACR,kDAAkD,KAAK,OAAO,SAAS,OAAO,UAAU,GACzF;AAGH,SAAK,OAAO,SAAS,WAAW,MAAM,SAAS,MAAM;;AAIzD,OAAI,CAAC,KAAK,OAAO,SAAS,aACxB,OAAM,IAAI,MACR,gJACD;AAGH,OAAI,CAAC,KAAK,OAAO,SAAS,WACxB,OAAM,IAAI,MACR,4IACD;AAGH,OACE,CAAC,WAAW,KAAK,OAAO,SAAS,aAAa,IAC9C,CAAC,gBAAgB,KAAK,OAAO,SAAS,aAAa,CAEnD,MAAK,gBAAgB,KAAK,OAAO,SAAS,gBAAgB;AAG5D,QAAK,OAAO,SAAS,aAAa,kBAChC,MACA,KAAK,OAAO,SAAS,WACtB;;EAEH,MAAM,UAAU;AAOd,SANkB,IAAI,UACpB,KAAK,OAAO,SAAS,cACrB,KAAK,OAAO,SAAS,YACrB,KAAK,OAAO,SACb,CAEe,SAAS,KAAK,OAAO,SAAS,SAAS;;EAE1D;;AAGH,kBAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-asyncapi",
3
- "version": "0.1.305",
3
+ "version": "0.1.307",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin to generate project code from AsyncAPI specifications.",
6
6
  "repository": {
@@ -96,13 +96,13 @@
96
96
  "@stryke/http": "^0.12.35",
97
97
  "@stryke/path": "^0.26.6",
98
98
  "defu": "^6.1.4",
99
- "powerlines": "^0.39.9"
99
+ "powerlines": "^0.39.11"
100
100
  },
101
101
  "devDependencies": {
102
- "@powerlines/plugin-plugin": "^0.12.252",
102
+ "@powerlines/plugin-plugin": "^0.12.254",
103
103
  "@types/node": "^25.3.3"
104
104
  },
105
105
  "publishConfig": { "access": "public" },
106
106
  "types": "./dist/index.d.cts",
107
- "gitHead": "645a902416b92ae709b2ae786c21d3ec0be09258"
107
+ "gitHead": "e63eb5a0ecd0e5ee3e030388ad1c534b3ecb2136"
108
108
  }