Compare commits

...
11 changed files with 16 additions and 63 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ var commonRules = [
{ test: /\.(woff|woff2)(\?.*)?$/, { test: /\.(woff|woff2)(\?.*)?$/,
loader: "url-loader?limit=100000" }, loader: "url-loader?limit=100000" },
{ test: /\.(ttf|eot)(\?.*)?$/, { test: /\.(ttf|eot)(\?.*)?$/,
loader: "file-loader" }, loader: "file-loader" }
] ]
module.exports = function(rules, options) { module.exports = function(rules, options) {
+1 -2
View File
@@ -154,8 +154,7 @@
"uglifyjs-webpack-plugin": "^1.2.5", "uglifyjs-webpack-plugin": "^1.2.5",
"url-loader": "0.5.9", "url-loader": "0.5.9",
"webpack": "^2.6.1", "webpack": "^2.6.1",
"webpack-bundle-size-analyzer": "^2.5.0", "webpack-bundle-size-analyzer": "^2.5.0"
"webpack-strip-block": "^0.2.0"
}, },
"config": { "config": {
"deps_check_dir": ".deps_check" "deps_check_dir": ".deps_check"
+6
View File
@@ -131,6 +131,9 @@ module.exports = function SwaggerUI(opts) {
var system = store.getSystem() var system = store.getSystem()
const downloadSpec = (fetchedConfig) => { const downloadSpec = (fetchedConfig) => {
if(typeof constructorConfig !== "object") {
return system
}
let localConfig = system.specSelectors.getLocalConfig ? system.specSelectors.getLocalConfig() : {} let localConfig = system.specSelectors.getLocalConfig ? system.specSelectors.getLocalConfig() : {}
let mergedConfig = deepExtend({}, localConfig, constructorConfig, fetchedConfig || {}, queryConfig) let mergedConfig = deepExtend({}, localConfig, constructorConfig, fetchedConfig || {}, queryConfig)
@@ -140,7 +143,10 @@ module.exports = function SwaggerUI(opts) {
} }
store.setConfigs(mergedConfig) store.setConfigs(mergedConfig)
if(system.configsActions) {
system.configsActions.loaded() system.configsActions.loaded()
}
if (fetchedConfig !== null) { if (fetchedConfig !== null) {
if (!queryConfig.url && typeof mergedConfig.spec === "object" && Object.keys(mergedConfig.spec).length) { if (!queryConfig.url && typeof mergedConfig.spec === "object" && Object.keys(mergedConfig.spec).length) {
-7
View File
@@ -104,10 +104,6 @@ export const resolveSpec = (json, url) => ({specActions, specSelectors, errActio
let specStr = specSelectors.specStr() let specStr = specSelectors.specStr()
/* develblock:start */
require("root/src/perf").start("resolve")
/* develblock:end */
return resolve({ return resolve({
fetch, fetch,
spec: json, spec: json,
@@ -135,9 +131,6 @@ export const resolveSpec = (json, url) => ({specActions, specSelectors, errActio
errActions.newThrownErrBatch(preparedErrors) errActions.newThrownErrBatch(preparedErrors)
} }
/* develblock:start */
require("root/src/perf").stop("resolve")
/* develblock:end */
return specActions.updateResolved(spec) return specActions.updateResolved(spec)
}) })
} }
+1 -9
View File
@@ -42,15 +42,7 @@ export default {
}, },
[UPDATE_RESOLVED]: (state, action) => { [UPDATE_RESOLVED]: (state, action) => {
/* develblock:start */ return state.setIn(["resolved"], fromJSOrdered(action.payload))
require("root/src/perf").start("UPDATE_RESOLVED")
/* develblock:end */
const resolved = fromJSOrdered(action.payload)
/* develblock:start */
require("root/src/perf").stop("UPDATE_RESOLVED")
/* develblock:end */
return state.setIn(["resolved"], resolved)
}, },
[UPDATE_RESOLVED_SUBTREE]: (state, action) => { [UPDATE_RESOLVED_SUBTREE]: (state, action) => {
+1 -1
View File
@@ -12,7 +12,7 @@ export const updateJsonSpec = (ori, {specActions}) => (...args) => {
// Trigger resolution of any path-level $refs. // Trigger resolution of any path-level $refs.
const [json] = args const [json] = args
const pathItems = get(json, ["paths"]) const pathItems = get(json, ["paths"]) || {}
const pathItemKeys = Object.keys(pathItems) const pathItemKeys = Object.keys(pathItems)
pathItemKeys.forEach(k => { pathItemKeys.forEach(k => {
+3 -9
View File
@@ -15,15 +15,9 @@ const idFn = a => a
function createStoreWithMiddleware(rootReducer, initialState, getSystem) { function createStoreWithMiddleware(rootReducer, initialState, getSystem) {
let middlwares = [ let middlwares = [
/* develblock:start */ // createLogger( {
// Measure actions // stateTransformer: state => state && state.toJS()
() => next => action => { // } ),
require("root/src/perf").start("action:"+action.type)
const res = next(action)
require("root/src/perf").stop("action:"+action.type)
return res
},
/* develblock:end */
systemThunkMiddleware( getSystem ) systemThunkMiddleware( getSystem )
] ]
-16
View File
@@ -1,16 +0,0 @@
// This uses experimental console methods, to track performance
module.exports = {
start(str) {
/* develblock:start */
// eslint-disable-next-line no-console
console.time(str)
/* develblock:end */
},
stop(str) {
/* develblock:start */
// eslint-disable-next-line no-console
console.timeEnd(str)
/* develblock:end */
}
}
+1 -11
View File
@@ -15,17 +15,7 @@ let rules = [
}, },
{ loader: "babel-loader?retainLines=true" } { loader: "babel-loader?retainLines=true" }
] ]
}, }
// This will strip out blocks of code that start with:
/* develblock:start */
// And end with
/* develblock:end */
{
test: /\.jsx?$/,
enforce: "pre",
exclude: /(node_modules|\.spec\.js)/,
loader: "webpack-strip-block"
},
] ]
rules = rules.concat(styleRules) rules = rules.concat(styleRules)
+1 -1
View File
@@ -35,7 +35,7 @@ const rules = [
} }
} }
] ]
}, }
] ]
module.exports = require("./make-webpack-config")(rules, { module.exports = require("./make-webpack-config")(rules, {
-5
View File
@@ -5,9 +5,4 @@ config.plugins = config.plugins.filter(plugin => {
return plugin.constructor.name !== "UglifyJsPlugin" return plugin.constructor.name !== "UglifyJsPlugin"
}) })
config.module.rules = config.module.rules.filter(rule => {
// Disable minification
return rule.loader != "webpack-strip-block"
})
module.exports = config module.exports = config