Skip to content

Commit dc1a39c

Browse files
committed
fix(build): add eplixit helpers support
This commit adds backward compatible support for older swagger-ui versions. Refs swagger-api/swagger-ui#6210
1 parent 8f79c91 commit dc1a39c

File tree

6 files changed

+16
-282
lines changed

6 files changed

+16
-282
lines changed

.babelrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
"loose": true
2121
}],
2222
"@babel/proposal-class-properties",
23-
"@babel/proposal-object-rest-spread",
24-
"add-module-exports"
23+
"@babel/proposal-object-rest-spread"
2524
]
2625
},
2726
"es": {

package-lock.json

Lines changed: 0 additions & 277 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"node": ">=10.21.0",
77
"npm": ">=6.14.5"
88
},
9-
"main": "lib/index.js",
9+
"main": "lib/commonjs.js",
1010
"module": "es/index.js",
1111
"jsnext:main": "es/index.js",
1212
"unpkg": "dist/swagger-client.browser.min.js",
@@ -73,7 +73,6 @@
7373
"@commitlint/config-conventional": "=9.0.1",
7474
"@release-it/conventional-changelog": "=1.1.0",
7575
"babel-loader": "=8.1.0",
76-
"babel-plugin-add-module-exports": "=1.0.2",
7776
"babel-plugin-lodash": "=3.3.4",
7877
"cross-env": "=7.0.2",
7978
"eslint": "=7.4.0",

src/commonjs.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict'; // eslint-disable-line
2+
3+
const { default: SwaggerClient } = require('./index');
4+
5+
// add backwards compatibility with older versions of swagger-ui
6+
// by exporting one single symbol.
7+
// Refs https://github.com/swagger-api/swagger-ui/issues/6210
8+
9+
module.exports = SwaggerClient;

src/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,8 @@ Swagger.prototype.applyDefaults = function applyDefaults() {
102102
}
103103
};
104104

105+
// add backwards compatibility with older versions of swagger-ui
106+
// Refs https://github.com/swagger-api/swagger-ui/issues/6210
107+
export const { helpers } = Swagger;
108+
105109
export default Swagger;

test/build-artifacts/commonjs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// commonjs import is here by design to test native node.js require function on artifact
2-
const SwaggerClient = require('../../lib');
2+
const SwaggerClient = require('../../lib/commonjs');
33

44
describe('babel commonjs artifact', () => {
55
test('should export a function', () => {

0 commit comments

Comments
 (0)