An esbuild plugin (v0.0.6) that parses Swagger/OpenAPI specifications (YAML and JSON) during the build process. It transforms imports of files named with 'swagger.(yaml|json)' into parsed JSON objects. Released under MIT license, it targets Node.js >=16 and is designed for esbuild bundling workflows. Differentiated by its lightweight, zero-config approach for integrating OpenAPI specs into esbuild builds, though it is in early development with no active maintenance cadence.
npm install esbuild-plugin-swagger-spec-parserNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to configure esbuild with the plugin and import a swagger spec file.
Rename your spec files to include 'swagger' in the filename, e.g., 'openapi.swagger.yaml'.
Add '/// <reference path="../node_modules/esbuild-plugin-swagger-spec-parser/dist/custom.d.ts" />' at the top of your TypeScript files.
Pin version and test upgrades.
Run 'npm install esbuild-plugin-swagger-spec-parser' or 'yarn add esbuild-plugin-swagger-spec-parser'.
Use named import: 'import { SwaggerSpecParser } from 'esbuild-plugin-swagger-spec-parser''Rename file to include 'swagger' before extension, e.g., 'openapi.swagger.yaml'.