@openapi-to/plugin-msw
Advanced tools
+16
-11
@@ -5,4 +5,4 @@ 'use strict'; | ||
| var core = require('@openapi-to/core'); | ||
| var tsMorph = require('ts-morph'); | ||
| var utils = require('@openapi-to/core/utils'); | ||
| var tsMorph = require('ts-morph'); | ||
@@ -555,17 +555,19 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; } | ||
| // src/plugin.ts | ||
| var stateMap = /* @__PURE__ */ new WeakMap(); | ||
| var definePlugin = core.createPlugin((_pluginConfig) => { | ||
| const project = new tsMorph.Project(); | ||
| const dependencies = [ | ||
| ..._pluginConfig?.responseDefaultType === "faker" ? [] : [], | ||
| core.pluginEnum.TsType | ||
| ]; | ||
| const pluginConfig = { | ||
| importWithExtension: _pluginConfig?.importWithExtension ?? true, | ||
| responseDefaultType: _pluginConfig?.responseDefaultType || "" | ||
| }; | ||
| return { | ||
| dependencies, | ||
| dependencies: [ | ||
| ..._pluginConfig?.responseDefaultType === "faker" ? [] : [], | ||
| core.pluginEnum.TsType | ||
| ], | ||
| name: core.pluginEnum.MSW, | ||
| hooks: { | ||
| buildStart: async (ctx) => { | ||
| stateMap.set(ctx.openapiToSingleConfig, { | ||
| project: new tsMorph.Project(), | ||
| pluginConfig: { | ||
| importWithExtension: _pluginConfig?.importWithExtension ?? true, | ||
| responseDefaultType: _pluginConfig?.responseDefaultType || "" | ||
| } | ||
| }); | ||
| }, | ||
@@ -575,2 +577,5 @@ tagStart: async (tagData, ctx) => { | ||
| operation: async (operation, ctx) => { | ||
| const { project, pluginConfig } = stateMap.get( | ||
| ctx.openapiToSingleConfig | ||
| ); | ||
| const requestName = `${operation.accessor.operationName}Handler`; | ||
@@ -577,0 +582,0 @@ const filePath = path__default.default.join( |
+16
-11
| import { createRequire } from 'module'; | ||
| import path from 'node:path'; | ||
| import { createPlugin, pluginEnum } from '@openapi-to/core'; | ||
| import { StructureKind, Project, VariableDeclarationKind } from 'ts-morph'; | ||
| import { formatterModuleSpecifier, getRelativePath, URLPath } from '@openapi-to/core/utils'; | ||
| import { Project, StructureKind, VariableDeclarationKind } from 'ts-morph'; | ||
@@ -549,17 +549,19 @@ createRequire(import.meta.url); | ||
| // src/plugin.ts | ||
| var stateMap = /* @__PURE__ */ new WeakMap(); | ||
| var definePlugin = createPlugin((_pluginConfig) => { | ||
| const project = new Project(); | ||
| const dependencies = [ | ||
| ..._pluginConfig?.responseDefaultType === "faker" ? [] : [], | ||
| pluginEnum.TsType | ||
| ]; | ||
| const pluginConfig = { | ||
| importWithExtension: _pluginConfig?.importWithExtension ?? true, | ||
| responseDefaultType: _pluginConfig?.responseDefaultType || "" | ||
| }; | ||
| return { | ||
| dependencies, | ||
| dependencies: [ | ||
| ..._pluginConfig?.responseDefaultType === "faker" ? [] : [], | ||
| pluginEnum.TsType | ||
| ], | ||
| name: pluginEnum.MSW, | ||
| hooks: { | ||
| buildStart: async (ctx) => { | ||
| stateMap.set(ctx.openapiToSingleConfig, { | ||
| project: new Project(), | ||
| pluginConfig: { | ||
| importWithExtension: _pluginConfig?.importWithExtension ?? true, | ||
| responseDefaultType: _pluginConfig?.responseDefaultType || "" | ||
| } | ||
| }); | ||
| }, | ||
@@ -569,2 +571,5 @@ tagStart: async (tagData, ctx) => { | ||
| operation: async (operation, ctx) => { | ||
| const { project, pluginConfig } = stateMap.get( | ||
| ctx.openapiToSingleConfig | ||
| ); | ||
| const requestName = `${operation.accessor.operationName}Handler`; | ||
@@ -571,0 +576,0 @@ const filePath = path.join( |
+6
-6
| { | ||
| "name": "@openapi-to/plugin-msw", | ||
| "version": "3.2.0", | ||
| "version": "3.2.1", | ||
| "sideEffects": false, | ||
@@ -25,6 +25,6 @@ "type": "module", | ||
| "utility-types": "^3.11.0", | ||
| "@openapi-to/config-ts": "3.2.0", | ||
| "@openapi-to/plugin-zod": "3.2.0", | ||
| "@openapi-to/config-tsup": "3.2.0", | ||
| "@openapi-to/plugin-ts-type": "3.2.0" | ||
| "@openapi-to/config-ts": "3.2.1", | ||
| "@openapi-to/plugin-zod": "3.2.1", | ||
| "@openapi-to/plugin-ts-type": "3.2.1", | ||
| "@openapi-to/config-tsup": "3.2.1" | ||
| }, | ||
@@ -37,3 +37,3 @@ "keywords": [], | ||
| "ts-morph": "^23.0.0", | ||
| "@openapi-to/core": "3.2.0" | ||
| "@openapi-to/core": "3.2.1" | ||
| }, | ||
@@ -40,0 +40,0 @@ "publishConfig": { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
41336
1.07%1208
0.83%2
-33.33%+ Added
- Removed
Updated