diff --git a/README.md b/README.md index 9434c8f..78b374c 100644 --- a/README.md +++ b/README.md @@ -151,8 +151,8 @@ Create a `myPlugin.ts` file: ```ts // 引用模块 -// import { start } from 'https://deno.land/x/stc@2.2.0/mod.ts' -import { start } from 'jsr:@loongwoo/stc@^2.2.0' +// import { start } from 'https://deno.land/x/stc@2.3.0/mod.ts' +import { start } from 'jsr:@loongwoo/stc@^2.3.0' // Defining plugins const myPlugin: IPlugin = { diff --git a/deno.json b/deno.json index 5202f57..fbe6069 100644 --- a/deno.json +++ b/deno.json @@ -1,12 +1,12 @@ { "name": "@loongwoo/stc", - "version": "2.2.0", + "version": "2.3.0", "exports": "./mod.ts", "tasks": { "pack": "deno run -A src/pack.ts", "dev": "deno task pack && deno run -A --watch=src src/main.ts --url='https://petstore3.swagger.io/api/v3/openapi.json' --lang=js", "serve": "deno run -A --watch=src src/service.ts", - "version": "echo '2.1.0' > release/version", + "version": "echo '2.3.0' > release/version", "build:npm": "deno run -A src/npm/build.ts", "build:mac": "deno compile -A --target x86_64-apple-darwin --output release/stc src/main.ts", "build:mac-m": "deno compile -A --target aarch64-apple-darwin --output release/stc-m src/main.ts", diff --git a/src/npm/pkg.json b/src/npm/pkg.json index 27e3355..5fb8e06 100644 --- a/src/npm/pkg.json +++ b/src/npm/pkg.json @@ -1,6 +1,6 @@ { "name": "@loongwoo/stc", - "version": "2.2.0", + "version": "2.3.0", "description": "A tool for converting OpenApi/Swagger/Apifox into code.", "type": "module", "module": "esm/mod.js", diff --git a/src/plugins/javascript/index.ts b/src/plugins/javascript/index.ts index de37d74..8ac3d5e 100644 --- a/src/plugins/javascript/index.ts +++ b/src/plugins/javascript/index.ts @@ -49,12 +49,12 @@ export const JavaScriptPlugin: IPlugin = { }; const _actionMapData = new Map(); - if (_tsTransform?.definition) { - _definition.content = await esTransform(_tsTransform.definition.content); + if (_tsTransform?.definition && _tsTransform.definition.content) { const _typeDeclaration = generateDeclarationFile( _tsTransform.definition.content, ); + _definition.content = await esTransform(_tsTransform.definition.content); actionDeclareData.set("_types", _typeDeclaration); } diff --git a/src/plugins/javascript/oxc.ts b/src/plugins/javascript/oxc.ts index 61f2818..37e9e79 100644 --- a/src/plugins/javascript/oxc.ts +++ b/src/plugins/javascript/oxc.ts @@ -1,4 +1,4 @@ -import oxc from "npm:oxc-transform@^0.29.0"; +import oxc from "npm:oxc-transform@^0.30.1"; import Logs from "../../console.ts";