@powerlines/plugin-openapi 0.2.51 → 0.2.52
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-BgAdqTbb.d.mts +1 -0
- package/dist/index-CEgs-Dz2.d.cts +1 -0
- package/dist/index.cjs +1 -7
- package/dist/index.d.cts +7 -28
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +15 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/plugin-3Qf_dRX_.d.cts +1676 -0
- package/dist/plugin-3Qf_dRX_.d.cts.map +1 -0
- package/dist/plugin-B7fA9NoY.d.mts +1676 -0
- package/dist/plugin-B7fA9NoY.d.mts.map +1 -0
- package/dist/plugin-Bvn-he2n.mjs +1 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.d.cts +3 -25
- package/dist/types/index.d.mts +3 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/plugin.cjs +1 -1
- package/dist/types/plugin.d.cts +2 -25
- package/dist/types/plugin.d.mts +2 -0
- package/dist/types/plugin.mjs +1 -0
- package/dist/types-B7VYa_Pp.mjs +1 -0
- package/dist/types-DHkg7xmX.cjs +0 -0
- package/package.json +42 -24
- package/dist/index-CuW3WxDf.d.cts +0 -1587
- package/dist/index-CuW3WxDf.d.ts +0 -1587
- package/dist/index.d.ts +0 -36
- package/dist/index.js +0 -7
- package/dist/types/index.d.ts +0 -25
- package/dist/types/index.js +0 -1
- package/dist/types/plugin.d.ts +0 -25
- /package/dist/{types/plugin.js → plugin-DHXHjv16.cjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
* ⚡ Built by Storm Software
|
|
4
|
-
*
|
|
5
|
-
*****************************************/
|
|
6
|
-
|
|
7
|
-
var p=Object.defineProperty;var n=(o,t)=>p(o,"name",{value:t,configurable:true});const u=n((o={})=>({name:"openapi",config(){return {openapi:a__default.default(o,{schema:joinPaths.joinPaths(this.workspaceConfig.workspaceRoot,this.config.projectRoot,"schema.yaml"),cwd:joinPaths.joinPaths(this.workspaceConfig.workspaceRoot,this.config.projectRoot),outputPath:joinPaths.joinPaths("{builtinPath}","api"),silent:this.config.logLevel===null})}},async configResolved(){this.config.openapi.outputPath=paths.replacePathTokens(this,this.config.openapi.outputPath);},async prepare(){const t=await s__default.default(this.config.openapi.schema,this.config.openapi);this.config.openapi.outputPath?await this.fs.write(this.config.openapi.outputPath,s.astToString(t,{fileName:this.config.openapi.outputPath})):await this.emitBuiltin(s.astToString(t),"openapi");}}),"plugin");var I=u;exports.default=I;exports.plugin=u;Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
|
|
1
|
+
Object.defineProperty(exports,`__esModule`,{value:!0});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));require(`./plugin-DHXHjv16.cjs`),require(`./types-DHkg7xmX.cjs`);let c=require(`@stryke/path/join-paths`),l=require(`defu`);l=s(l);let u=require(`openapi-typescript`);u=s(u);let d=require(`@stryke/path/replace`);function f(e,t){return t&&t.replaceAll(`{workspaceRoot}`,e.workspaceConfig.workspaceRoot).replaceAll(`{root}`,e.config.projectRoot).replaceAll(`{projectRoot}`,e.config.projectRoot).replaceAll(`{sourceRoot}`,e.config.sourceRoot).replaceAll(`{powerlinesPath}`,e.powerlinesPath).replaceAll(`{cachePath}`,e.cachePath).replaceAll(`{dataPath}`,e.dataPath).replaceAll(`{logPath}`,e.envPaths.log).replaceAll(`{tempPath}`,e.envPaths.temp).replaceAll(`{configPath}`,e.envPaths.config).replaceAll(`{outputPath}`,e.config.output.outputPath).replaceAll(`{buildPath}`,e.config.output.buildPath).replaceAll(`{artifactsPath}`,(0,d.replacePath)(e.artifactsPath,e.workspaceConfig.workspaceRoot)).replaceAll(`{builtinPath}`,(0,d.replacePath)(e.builtinsPath,e.workspaceConfig.workspaceRoot)).replaceAll(`{entryPath}`,(0,d.replacePath)(e.entryPath,e.workspaceConfig.workspaceRoot))}const p=(e={})=>({name:`openapi`,config(){return{openapi:(0,l.default)(e,{schema:(0,c.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot,`schema.yaml`),cwd:(0,c.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot),outputPath:(0,c.joinPaths)(`{builtinPath}`,`api`),silent:this.config.logLevel===null})}},async configResolved(){this.config.openapi.outputPath=f(this,this.config.openapi.outputPath)},async prepare(){let e=await(0,u.default)(this.config.openapi.schema,this.config.openapi);this.config.openapi.outputPath?await this.fs.write(this.config.openapi.outputPath,(0,u.astToString)(e,{fileName:this.config.openapi.outputPath})):await this.emitBuiltin((0,u.astToString)(e),`openapi`)}});var m=p;exports.default=m,exports.plugin=p;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,29 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import 'openapi-typescript';
|
|
6
|
-
import '@storm-software/build-tools/types';
|
|
7
|
-
import '@storm-software/config-tools/types';
|
|
8
|
-
import '@storm-software/config/types';
|
|
9
|
-
import '@stryke/types/base';
|
|
10
|
-
import '@stryke/types/configuration';
|
|
11
|
-
import '@stryke/types/file';
|
|
12
|
-
import 'vite';
|
|
13
|
-
import '@stryke/env/get-env-paths';
|
|
14
|
-
import '@stryke/http/fetch';
|
|
15
|
-
import '@stryke/types/package-json';
|
|
16
|
-
import 'jiti';
|
|
17
|
-
import 'magic-string';
|
|
18
|
-
import 'oxc-parser';
|
|
19
|
-
import 'semver';
|
|
20
|
-
import 'ts-morph';
|
|
21
|
-
import 'undici';
|
|
22
|
-
import 'unplugin';
|
|
23
|
-
import '@stryke/fs/resolve';
|
|
24
|
-
import '@stryke/types/tsconfig';
|
|
25
|
-
import 'typescript';
|
|
26
|
-
import '@stryke/types/array';
|
|
1
|
+
import { a as __ΩOpenAPIPluginContext, c as __ΩOpenAPIPluginUserConfig, i as OpenAPIPluginUserConfig, l as Plugin, n as OpenAPIPluginOptions, o as __ΩOpenAPIPluginOptions, r as OpenAPIPluginResolvedConfig, s as __ΩOpenAPIPluginResolvedConfig, t as OpenAPIPluginContext } from "./plugin-3Qf_dRX_.cjs";
|
|
2
|
+
import "./index-CEgs-Dz2.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
27
5
|
|
|
28
6
|
/**
|
|
29
7
|
* A Powerlines plugin to integrate OpenAPI for code generation.
|
|
@@ -32,5 +10,6 @@ import '@stryke/types/array';
|
|
|
32
10
|
* @returns A Powerlines plugin instance.
|
|
33
11
|
*/
|
|
34
12
|
declare const plugin: <TContext extends OpenAPIPluginContext = OpenAPIPluginContext>(options?: OpenAPIPluginOptions) => Plugin<TContext>;
|
|
35
|
-
|
|
36
|
-
export { OpenAPIPluginContext, OpenAPIPluginOptions, plugin as default, plugin };
|
|
13
|
+
//#endregion
|
|
14
|
+
export { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig, __ΩOpenAPIPluginContext, __ΩOpenAPIPluginOptions, __ΩOpenAPIPluginResolvedConfig, __ΩOpenAPIPluginUserConfig, plugin as default, plugin };
|
|
15
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;AAqCA;;;;;AAIG,cAJU,MAIV,EAAA,CAAA,iBAHgB,oBAGhB,GAHuC,oBAGvC,CAAA,CAAA,OAAA,CAAA,EADQ,oBACR,EAAA,GAAA,MAAA,CAAO,QAAP,CAAA"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { a as __ΩOpenAPIPluginContext, c as __ΩOpenAPIPluginUserConfig, i as OpenAPIPluginUserConfig, l as Plugin, n as OpenAPIPluginOptions, o as __ΩOpenAPIPluginOptions, r as OpenAPIPluginResolvedConfig, s as __ΩOpenAPIPluginResolvedConfig, t as OpenAPIPluginContext } from "./plugin-B7fA9NoY.mjs";
|
|
2
|
+
import "./index-BgAdqTbb.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A Powerlines plugin to integrate OpenAPI for code generation.
|
|
8
|
+
*
|
|
9
|
+
* @param options - The plugin options.
|
|
10
|
+
* @returns A Powerlines plugin instance.
|
|
11
|
+
*/
|
|
12
|
+
declare const plugin: <TContext extends OpenAPIPluginContext = OpenAPIPluginContext>(options?: OpenAPIPluginOptions) => Plugin<TContext>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { OpenAPIPluginContext, OpenAPIPluginOptions, OpenAPIPluginResolvedConfig, OpenAPIPluginUserConfig, __ΩOpenAPIPluginContext, __ΩOpenAPIPluginOptions, __ΩOpenAPIPluginResolvedConfig, __ΩOpenAPIPluginUserConfig, plugin as default, plugin };
|
|
15
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;AAqCA;;;;;AAIG,cAJU,MAIV,EAAA,CAAA,iBAHgB,oBAGhB,GAHuC,oBAGvC,CAAA,CAAA,OAAA,CAAA,EADQ,oBACR,EAAA,GAAA,MAAA,CAAO,QAAP,CAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./plugin-Bvn-he2n.mjs";import"./types-B7VYa_Pp.mjs";import{joinPaths as e}from"@stryke/path/join-paths";import t from"defu";import n,{astToString as r}from"openapi-typescript";import{replacePath as i}from"@stryke/path/replace";function a(e,t){return t&&t.replaceAll(`{workspaceRoot}`,e.workspaceConfig.workspaceRoot).replaceAll(`{root}`,e.config.projectRoot).replaceAll(`{projectRoot}`,e.config.projectRoot).replaceAll(`{sourceRoot}`,e.config.sourceRoot).replaceAll(`{powerlinesPath}`,e.powerlinesPath).replaceAll(`{cachePath}`,e.cachePath).replaceAll(`{dataPath}`,e.dataPath).replaceAll(`{logPath}`,e.envPaths.log).replaceAll(`{tempPath}`,e.envPaths.temp).replaceAll(`{configPath}`,e.envPaths.config).replaceAll(`{outputPath}`,e.config.output.outputPath).replaceAll(`{buildPath}`,e.config.output.buildPath).replaceAll(`{artifactsPath}`,i(e.artifactsPath,e.workspaceConfig.workspaceRoot)).replaceAll(`{builtinPath}`,i(e.builtinsPath,e.workspaceConfig.workspaceRoot)).replaceAll(`{entryPath}`,i(e.entryPath,e.workspaceConfig.workspaceRoot))}const o=(i={})=>({name:`openapi`,config(){return{openapi:t(i,{schema:e(this.workspaceConfig.workspaceRoot,this.config.projectRoot,`schema.yaml`),cwd:e(this.workspaceConfig.workspaceRoot,this.config.projectRoot),outputPath:e(`{builtinPath}`,`api`),silent:this.config.logLevel===null})}},async configResolved(){this.config.openapi.outputPath=a(this,this.config.openapi.outputPath)},async prepare(){let e=await n(this.config.openapi.schema,this.config.openapi);this.config.openapi.outputPath?await this.fs.write(this.config.openapi.outputPath,r(e,{fileName:this.config.openapi.outputPath})):await this.emitBuiltin(r(e),`openapi`)}});var s=o;export{s as default,o as plugin};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../powerlines/src/plugin-utils/paths.ts","../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 { replacePath } from \"@stryke/path/replace\";\nimport { IsUndefined } from \"@stryke/types/base\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Replaces tokens in the given path string with their corresponding values from the context.\n *\n * @remarks\n * The following tokens are supported:\n * - `{workspaceRoot}` - The root directory of the workspace.\n * - `{root}` - The root directory of the project (same as `{projectRoot}`).\n * - `{projectRoot}` - The root directory of the project (same as `{root}`).\n * - `{sourceRoot}` - The source root directory of the project (usually `./src`).\n * - `{powerlinesPath}` - The directory where Powerlines is installed.\n * - `{cachePath}` - The environment's directory for cached files.\n * - `{dataPath}` - The environment's directory for data files.\n * - `{logPath}` - The environment's directory for log files.\n * - `{tempPath}` - The environment's directory for temporary files.\n * - `{configPath}` - The environment's directory for configuration files.\n * - `{outputPath}` - The configured output directory for the project.\n * - `{buildPath}` - The configured distribution directory for the project.\n * - `{artifactsPath}` - The configured directory for build artifacts.\n * - `{builtinPath}` - The configured directory for generated built-in plugins.\n * - `{entryPath}` - The configured directory for generated entry files.\n *\n * @param context - The context containing the values for the path tokens.\n * @param path - The path string with tokens to replace.\n * @returns The path string with tokens replaced by their corresponding values from the context.\n */\nexport function replacePathTokens(\n context: UnresolvedContext,\n path?: string\n): IsUndefined<typeof path> extends true ? undefined : string {\n if (!path) {\n return path as IsUndefined<typeof path> extends true ? undefined : string;\n }\n\n return path\n .replaceAll(\"{workspaceRoot}\", context.workspaceConfig.workspaceRoot)\n .replaceAll(\"{root}\", context.config.projectRoot)\n .replaceAll(\"{projectRoot}\", context.config.projectRoot)\n .replaceAll(\"{sourceRoot}\", context.config.sourceRoot)\n .replaceAll(\"{powerlinesPath}\", context.powerlinesPath)\n .replaceAll(\"{cachePath}\", context.cachePath)\n .replaceAll(\"{dataPath}\", context.dataPath)\n .replaceAll(\"{logPath}\", context.envPaths.log)\n .replaceAll(\"{tempPath}\", context.envPaths.temp)\n .replaceAll(\"{configPath}\", context.envPaths.config)\n .replaceAll(\"{outputPath}\", context.config.output.outputPath)\n .replaceAll(\"{buildPath}\", context.config.output.buildPath)\n .replaceAll(\n \"{artifactsPath}\",\n replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)\n )\n .replaceAll(\n \"{builtinPath}\",\n replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)\n )\n .replaceAll(\n \"{entryPath}\",\n replacePath(context.entryPath, context.workspaceConfig.workspaceRoot)\n );\n}\n","/* -------------------------------------------------------------------\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 { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport openapiTS, { astToString } from \"openapi-typescript\";\nimport { replacePathTokens } from \"powerlines/plugin-utils/paths\";\nimport { Plugin } from \"powerlines/types/plugin\";\nimport {\n OpenAPIPluginContext,\n OpenAPIPluginOptions,\n OpenAPIPluginUserConfig\n} from \"./types/plugin\";\n\nexport * from \"./types\";\n\n/**\n * A Powerlines plugin to integrate OpenAPI for code generation.\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends OpenAPIPluginContext = OpenAPIPluginContext\n>(\n options: OpenAPIPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"openapi\",\n config() {\n return {\n openapi: defu(options, {\n schema: joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.projectRoot,\n \"schema.yaml\"\n ),\n cwd: joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.projectRoot\n ),\n outputPath: joinPaths(\"{builtinPath}\", \"api\"),\n silent: this.config.logLevel === null\n })\n } as Partial<OpenAPIPluginUserConfig>;\n },\n async configResolved() {\n this.config.openapi.outputPath = replacePathTokens(\n this,\n this.config.openapi.outputPath\n );\n },\n async prepare() {\n const ast = await openapiTS(\n this.config.openapi.schema,\n this.config.openapi\n );\n\n if (this.config.openapi.outputPath) {\n await this.fs.write(\n this.config.openapi.outputPath,\n astToString(ast, {\n fileName: this.config.openapi.outputPath\n })\n );\n } else {\n await this.emitBuiltin(astToString(ast), \"openapi\");\n }\n }\n };\n};\n\nexport default plugin;\n"],"mappings":"0OA+CA,SAAgB,EACd,EACA,EAC4D,CAK5D,OAJK,GAIE,EACJ,WAAW,kBAAmB,EAAQ,gBAAgB,cAAc,CACpE,WAAW,SAAU,EAAQ,OAAO,YAAY,CAChD,WAAW,gBAAiB,EAAQ,OAAO,YAAY,CACvD,WAAW,eAAgB,EAAQ,OAAO,WAAW,CACrD,WAAW,mBAAoB,EAAQ,eAAe,CACtD,WAAW,cAAe,EAAQ,UAAU,CAC5C,WAAW,aAAc,EAAQ,SAAS,CAC1C,WAAW,YAAa,EAAQ,SAAS,IAAI,CAC7C,WAAW,aAAc,EAAQ,SAAS,KAAK,CAC/C,WAAW,eAAgB,EAAQ,SAAS,OAAO,CACnD,WAAW,eAAgB,EAAQ,OAAO,OAAO,WAAW,CAC5D,WAAW,cAAe,EAAQ,OAAO,OAAO,UAAU,CAC1D,WACC,kBACA,EAAY,EAAQ,cAAe,EAAQ,gBAAgB,cAAc,CAC1E,CACA,WACC,gBACA,EAAY,EAAQ,aAAc,EAAQ,gBAAgB,cAAc,CACzE,CACA,WACC,cACA,EAAY,EAAQ,UAAW,EAAQ,gBAAgB,cAAc,CACtE,CC1CL,MAAa,GAGX,EAAgC,EAAE,IAE3B,CACL,KAAM,UACN,QAAS,CACP,MAAO,CACL,QAAS,EAAK,EAAS,CACrB,OAAQ,EACN,KAAK,gBAAgB,cACrB,KAAK,OAAO,YACZ,cACD,CACD,IAAK,EACH,KAAK,gBAAgB,cACrB,KAAK,OAAO,YACb,CACD,WAAY,EAAU,gBAAiB,MAAM,CAC7C,OAAQ,KAAK,OAAO,WAAa,KAClC,CAAC,CACH,EAEH,MAAM,gBAAiB,CACrB,KAAK,OAAO,QAAQ,WAAa,EAC/B,KACA,KAAK,OAAO,QAAQ,WACrB,EAEH,MAAM,SAAU,CACd,IAAM,EAAM,MAAM,EAChB,KAAK,OAAO,QAAQ,OACpB,KAAK,OAAO,QACb,CAEG,KAAK,OAAO,QAAQ,WACtB,MAAM,KAAK,GAAG,MACZ,KAAK,OAAO,QAAQ,WACpB,EAAY,EAAK,CACf,SAAU,KAAK,OAAO,QAAQ,WAC/B,CAAC,CACH,CAED,MAAM,KAAK,YAAY,EAAY,EAAI,CAAE,UAAU,EAGxD,EAGH,IAAA,EAAe"}
|