Skip to content

Commit

Permalink
feat: expose plugins and presets on SwaggerUI global symbol (#9189)
Browse files Browse the repository at this point in the history
Part of this commit is also:
- complete plugins consolidation
- complete presets consolidation
- build system consolidation

Refs #9188
  • Loading branch information
char0n authored Sep 5, 2023
1 parent 8137a8b commit edd1153
Show file tree
Hide file tree
Showing 118 changed files with 28,110 additions and 826 deletions.
10 changes: 10 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[production]
> 1%
last 2 versions
Firefox ESR
not dead

[development]
last 1 chrome version
last 1 firefox version
last 1 safari version
124 changes: 68 additions & 56 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,74 +1,98 @@
module.exports = {
"env": {
"commonjs": {
"esm": {
"presets": [
[
"@babel/preset-env",
"@babel/env",
{
"debug": false,
"modules": "commonjs",
"targets": {
"node": "8"
},
"forceAllTransforms": false,
"ignoreBrowserslistConfig": true
"debug": true,
"modules": false,
"ignoreBrowserslistConfig": false,
"useBuiltIns": false,
"include": [
"@babel/plugin-proposal-logical-assignment-operators"
]
}
],
"@babel/preset-react",
"@babel/preset-react"
],
"plugins": [
[
"@babel/plugin-transform-modules-commonjs",
"@babel/plugin-transform-runtime",
{
"corejs": 3,
"absoluteRuntime": false,
"version": "^7.11.2"
}
],
[
"transform-react-remove-prop-types",
{
"loose": true
"additionalLibraries": [
"react-immutable-proptypes"
]
}
],
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread",
"@babel/plugin-proposal-optional-chaining",
[
"babel-plugin-module-resolver",
{
"alias": {
"root": ".",
"core": "./src/core",
}
}
]
]
},
"es": {
"test": {
"presets": [
[
"@babel/preset-env",
"@babel/env",
{
"debug": false,
"modules": false
"targets": {
"node": "16.13.2"
},
"ignoreBrowserslistConfig": true,
"useBuiltIns": false,
}
],
"@babel/preset-react",
"@babel/preset-react"
],
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"absoluteRuntime": false,
"corejs": 3,
"absoluteRuntime": false,
"version": "^7.11.2"
}
],
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread",
"@babel/plugin-proposal-optional-chaining",
[
"transform-react-remove-prop-types",
{
"additionalLibraries": [
"react-immutable-proptypes"
]
}
],
[
"babel-plugin-module-resolver",
{
"alias": {
"root": ".",
"core": "./src/core",
}
}
]
]
},
"development": {
"presets": [
[
"@babel/env",
{
"targets": {
"browsers": [
/* benefit of C/S/FF/Edge only? */
"> 1%",
"last 2 versions",
"Firefox ESR",
"not dead"
]
},
"ignoreBrowserslistConfig": false,
"useBuiltIns": false,
"corejs": { version: 3 },
"include": [
"@babel/plugin-proposal-logical-assignment-operators"
]
Expand All @@ -85,8 +109,6 @@ module.exports = {
"version": "^7.11.2"
}
],
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-optional-chaining",
[
"transform-react-remove-prop-types",
{
Expand All @@ -100,33 +122,31 @@ module.exports = {
{
"alias": {
"root": ".",
"components": "./src/core/components",
"containers": "./src/core/containers",
"core": "./src/core",
"plugins": "./src/plugins",
"img": "./src/img",
"corePlugins": "./src/core/plugins",
"less": "./src/less"
}
}
]
]
},
"test": {
"production": {
"presets": [
[
"@babel/env",
{
"targets": {
"node": "10"
},
"ignoreBrowserslistConfig": false,
"useBuiltIns": false,
"corejs": { version: 3 }
"include": [
"@babel/plugin-proposal-logical-assignment-operators"
]
}
],
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-transform-class-properties",
"@babel/plugin-transform-nullish-coalescing-operator",
"@babel/plugin-transform-object-rest-spread",
"@babel/plugin-transform-optional-chaining",
[
"@babel/plugin-transform-runtime",
{
Expand All @@ -135,8 +155,6 @@ module.exports = {
"version": "^7.11.2"
}
],
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-optional-chaining",
[
"transform-react-remove-prop-types",
{
Expand All @@ -150,18 +168,12 @@ module.exports = {
{
"alias": {
"root": ".",
"components": "./src/core/components",
"containers": "./src/core/containers",
"core": "./src/core",
"plugins": "./src/plugins",
"img": "./src/img",
"corePlugins": "./src/core/plugins",
"less": "./src/less"
}
}
]
]
}
},
}
}

3 changes: 3 additions & 0 deletions config/jest/jest.unit.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ module.exports = {
'<rootDir>/test/unit/components/online-validator-badge.jsx',
'<rootDir>/test/unit/components/live-response.jsx',
],
moduleNameMapper: {
'^.+\\.svg$': 'jest-transform-stub'
},
transformIgnorePatterns: ['/node_modules/(?!(sinon)/)'],
silent: true, // set to `false` to allow console.* calls to be printed
};
27,309 changes: 27,306 additions & 3 deletions dist/swagger-ui-es-bundle-core.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Welcome to the Swagger UI documentation!
- [Overview](customization/overview.md)
- [Plugin API](customization/plugin-api.md)
- [Custom layout](customization/custom-layout.md)
- [Adding plugin](customization/add-plugin.md)
- [Plug-Points](customization/plug-points.md)

## Development

Expand Down
File renamed without changes.
Loading

0 comments on commit edd1153

Please sign in to comment.