提交 55e4a125 编写于 作者: S shockey 提交者: GitHub

Merge pull request #2959 from swagger-api/feature/remove-babel-polyfill

Replace babel-polyfill with transform-runtime
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"stage-0" "stage-0"
], ],
"plugins": [ "plugins": [
"transform-runtime",
[ [
"module-alias", "module-alias",
[ [
......
此差异已折叠。
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AA2TA;;;;;;AAoIA;AAi7FA;AAmtCA;AAi0IA;AAioJA;AA2iGA;AAs+FA;AA4kFA;AA6jFA;AAm9CA;AA6jDA;AAgrCA;AA+/EA;;;;;AAu3BA;AA0qJA;;;;;;;;;;;;;;AAwoFA;AA+lIA;AA2hJA;AAo2HA;AA8lGA;AAwiEA;AAo4DA;AAk7DA;AAyHA;;;;;;AA6iGA;AA07FA;;;;;AAi8CA;AAgsFA;AAs2CA;AAilCA;AA+7CA;AA85DA;AA4zCA;AAs5FA;;;;;;;;;AAqlCA;AA2zIA;AAu7FA;AAmrFA;AA20EA","sourceRoot":""} {"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AAmqDA;AAorJA;AAiiCA;AAo1GA;AA4qHA;AAw8FA;AAujFA;AA0sDA;AAm/CA;AA+jDA;AAk/CA;;;;;AA60EA;AA8zJA;;;;;;;;;;;;;;AAyoFA;AA+lIA;AA4oJA;AAqvHA;AAknGA;AA4iEA;AA43DA;AAkqDA;AAidA;;;;;;AAkxGA;AA+1HA;AA0+DA;;;;;AAwiBA;AAgsFA;AA6kDA;AAq3CA;AA4wFA;AAk3CA;AA2iFA;;;;;;;;;AAwqEA;AA2zIA;AAu7FA;AAmrFA;AAi7EA;;;;;;AAiRA;AAuqHA;AAg8GA","sourceRoot":""}
\ No newline at end of file \ No newline at end of file
{"version":3,"file":"swagger-ui-standalone-preset.js","sources":["webpack:///swagger-ui-standalone-preset.js"],"mappings":"AAAA;;;;;AA0SA;AAgyGA;AAuxFA;;;;;;AAocA;AAkvFA;AAu+CA;AAo+CA;AAgrCA;AAuyEA","sourceRoot":""} {"version":3,"file":"swagger-ui-standalone-preset.js","sources":["webpack:///swagger-ui-standalone-preset.js"],"mappings":"AAAA;AA+uFA;;;;;AAyOA;AAo7GA;AAw0FA;;;;;;AAmZA;AA+uFA;AAy+CA;AAo+CA;AAirCA;AAuyEA","sourceRoot":""}
\ No newline at end of file \ No newline at end of file
此差异已折叠。
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;;;;;;AAizCA;AAoyHA;AAmyHA;AAukGA;AA+9BA;AA8jCA;AAyiCA;AAs5BA","sourceRoot":""} {"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;AAylFA;;;;;;AAw4CA;AA2pHA;AA48HA;AAkoGA;AA0zDA;AAmzCA;AA+xCA","sourceRoot":""}
\ No newline at end of file \ No newline at end of file
...@@ -147,7 +147,7 @@ module.exports = function(options) { ...@@ -147,7 +147,7 @@ module.exports = function(options) {
extensions: ["", ".web.js", ".js", ".jsx", ".json", ".less"], extensions: ["", ".web.js", ".js", ".jsx", ".json", ".less"],
packageAlias: 'browser', packageAlias: 'browser',
alias: { alias: {
base: "getbase/src/less/base" base: "getbase/src/less/base",
} }
}, },
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
"just-test-in-node": "mocha --recursive --compilers js:babel-core/register test/core test/components test/bugs test/swagger-ui-dist-package" "just-test-in-node": "mocha --recursive --compilers js:babel-core/register test/core test/components test/bugs test/swagger-ui-dist-package"
}, },
"dependencies": { "dependencies": {
"babel-polyfill": "^6.23.0",
"base64-js": "^1.2.0", "base64-js": "^1.2.0",
"brace": "0.7.0", "brace": "0.7.0",
"deep-extend": "0.4.1", "deep-extend": "0.4.1",
...@@ -83,6 +82,7 @@ ...@@ -83,6 +82,7 @@
"babel-eslint": "^7.1.1", "babel-eslint": "^7.1.1",
"babel-loader": "^6.3.2", "babel-loader": "^6.3.2",
"babel-plugin-module-alias": "^1.6.0", "babel-plugin-module-alias": "^1.6.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.22.0", "babel-preset-es2015": "^6.22.0",
"babel-preset-es2015-ie": "^6.6.2", "babel-preset-es2015-ie": "^6.6.2",
"babel-preset-react": "^6.23.0", "babel-preset-react": "^6.23.0",
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
"browserslist": [ "browserslist": [
"> 1%", "> 1%",
"last 2 versions", "last 2 versions",
"IE 10" "IE 11"
], ],
"optionalDependencies": { "optionalDependencies": {
"webpack-dev-server": "1.14.0" "webpack-dev-server": "1.14.0"
......
...@@ -117,6 +117,7 @@ module.exports = function SwaggerUI(opts) { ...@@ -117,6 +117,7 @@ module.exports = function SwaggerUI(opts) {
return downloadSpec() return downloadSpec()
} }
return system
} }
// Add presets // Add presets
......
import { fromJS } from "immutable" import { fromJS } from "immutable"
import { fromJSOrdered, validateParam } from "core/utils" import { fromJSOrdered, validateParam } from "core/utils"
import win from "../../window" import win from "../../window"
import findIndex from "lodash/findIndex"
import { import {
UPDATE_SPEC, UPDATE_SPEC,
...@@ -41,7 +42,7 @@ export default { ...@@ -41,7 +42,7 @@ export default {
[UPDATE_PARAM]: ( state, {payload} ) => { [UPDATE_PARAM]: ( state, {payload} ) => {
let { path, paramName, value, isXml } = payload let { path, paramName, value, isXml } = payload
return state.updateIn( [ "resolved", "paths", ...path, "parameters" ], fromJS([]), parameters => { return state.updateIn( [ "resolved", "paths", ...path, "parameters" ], fromJS([]), parameters => {
let index = parameters.findIndex( p => p.get( "name" ) === paramName ) const index = findIndex(parameters, p => p.get( "name" ) === paramName )
if (!(value instanceof win.File)) { if (!(value instanceof win.File)) {
value = fromJSOrdered( value ) value = fromJSOrdered( value )
} }
......
import Im from "immutable" import Im from "immutable"
import shallowEqual from "shallowequal"
import camelCase from "lodash/camelCase" import camelCase from "lodash/camelCase"
import upperFirst from "lodash/upperFirst" import upperFirst from "lodash/upperFirst"
...@@ -418,11 +417,6 @@ export function pascalCaseFilename(filename) { ...@@ -418,11 +417,6 @@ export function pascalCaseFilename(filename) {
return pascalCase(filename.replace(/\.[^./]*$/, "")) return pascalCase(filename.replace(/\.[^./]*$/, ""))
} }
// Only compare a set of props
export function shallowEqualKeys(a,b, keys) {
return !!keys.find(key => !shallowEqual(a[key], b[key]))
}
// Check if ... // Check if ...
// - new props // - new props
// - If immutable, use .is() // - If immutable, use .is()
......
// Promise global, Used ( at least ) by 'whatwg-fetch'. And required by IE 11
require("core-js/fn/promise")
...@@ -13,7 +13,7 @@ module.exports = require('./make-webpack-config.js')({ ...@@ -13,7 +13,7 @@ module.exports = require('./make-webpack-config.js')({
entry: { entry: {
'swagger-ui-bundle': [ 'swagger-ui-bundle': [
'babel-polyfill', './src/polyfills',
'./src/core/index.js' './src/core/index.js'
] ]
}, },
......
...@@ -13,6 +13,7 @@ module.exports = require('./make-webpack-config.js')({ ...@@ -13,6 +13,7 @@ module.exports = require('./make-webpack-config.js')({
entry: { entry: {
'swagger-ui-standalone-preset': [ 'swagger-ui-standalone-preset': [
'./src/polyfills',
'./src/standalone/index.js' './src/standalone/index.js'
] ]
}, },
......
var path = require('path') const path = require("path")
var fs = require('fs') const fs = require("fs")
var node_modules = fs.readdirSync('node_modules').filter(function(x) { return x !== '.bin' }) const nodeModules = fs.readdirSync("node_modules").filter(function(x) { return x !== ".bin" })
module.exports = require("./make-webpack-config.js")({
module.exports = require('./make-webpack-config.js')({
_special: { _special: {
separateStylesheets: true, separateStylesheets: true,
minimize: true, minimize: true,
...@@ -15,9 +14,9 @@ module.exports = require('./make-webpack-config.js')({ ...@@ -15,9 +14,9 @@ module.exports = require('./make-webpack-config.js')({
entry: { entry: {
"swagger-ui": [ "swagger-ui": [
'babel-polyfill', "./src/style/main.scss",
'./src/style/main.scss', "./src/polyfills",
'./src/core/index.js' "./src/core/index.js"
] ]
}, },
...@@ -25,11 +24,11 @@ module.exports = require('./make-webpack-config.js')({ ...@@ -25,11 +24,11 @@ module.exports = require('./make-webpack-config.js')({
// webpack injects some stuff into the resulting file, // webpack injects some stuff into the resulting file,
// these libs need to be pulled in to keep that working. // these libs need to be pulled in to keep that working.
var exceptionsForWebpack = ["ieee754", "base64-js"] var exceptionsForWebpack = ["ieee754", "base64-js"]
if(node_modules.indexOf(request) !== -1 || exceptionsForWebpack.indexOf(request) !== -1) { if(nodeModules.indexOf(request) !== -1 || exceptionsForWebpack.indexOf(request) !== -1) {
cb(null, 'commonjs ' + request) cb(null, "commonjs " + request)
return; return
} }
cb(); cb()
}, },
output: { output: {
......
...@@ -10,12 +10,12 @@ module.exports = require("./make-webpack-config")({ ...@@ -10,12 +10,12 @@ module.exports = require("./make-webpack-config")({
devtool: "eval", devtool: "eval",
entry: { entry: {
'swagger-ui-bundle': [ 'swagger-ui-bundle': [
'webpack/hot/dev-server', './src/polyfills',
'babel-polyfill', './src/core/index.js'
'./src/core/index.js',
], ],
'swagger-ui-standalone-preset': [ 'swagger-ui-standalone-preset': [
'webpack/hot/dev-server', 'webpack/hot/dev-server',
'./src/polyfills',
'./src/standalone/index.js', './src/standalone/index.js',
] ]
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册