-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove compiled version of start-up-visualizer from source code in favour of externally hosted (for now - https://ij-perf.develar.org) In general, nothing stops us to continue providing because still it is small text only js file, but not clear does it worth it or not. Migrate from parcel to webpack because: 1. SRI support — https://github.com/waysact/webpack-subresource-integrity (parcel issue: parcel-bundler/parcel#2003) 2. Full typescript support (including type checking) — https://github.com/TypeStrong/ts-loader & https://github.com/Realytics/fork-ts-checker-webpack-plugin (parcel issue: parcel-bundler/parcel#1378) 3. Externals support — https://webpack.js.org/configuration/externals/ (parcel issue: parcel-bundler/parcel#144) There is workaround, but still because of lack type checking for typescript parcel is no-go. So, parcel is good for very small projects during experimenting but not suitable for any production usage. Yeach, a lot of things in webpack can be simplified without sacrificing user-friendly (so funny bug that documented flag `optimize-minimize` doesn't work if `mode` also specified - and so on), but as no webpack alternatives at the moment, it is ok to write monstrous webpack.config.js
- Loading branch information
Showing
22 changed files
with
1,980 additions
and
3,619 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
platform/built-in-server/src/org/jetbrains/ide/StartUpMeasurementService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | ||
package org.jetbrains.ide | ||
|
||
import com.intellij.ide.StartUpPerformanceReporter | ||
import com.intellij.openapi.application.ApplicationManager | ||
import com.intellij.openapi.application.ex.ApplicationInfoEx | ||
import com.intellij.openapi.startup.StartupActivity | ||
import com.intellij.util.io.hostName | ||
import com.intellij.util.net.NetUtils | ||
import io.netty.buffer.Unpooled | ||
import io.netty.channel.ChannelHandlerContext | ||
import io.netty.handler.codec.http.FullHttpRequest | ||
import io.netty.handler.codec.http.HttpRequest | ||
import io.netty.handler.codec.http.QueryStringDecoder | ||
import org.jetbrains.io.response | ||
|
||
internal class StartUpMeasurementService : RestService() { | ||
override fun getServiceName() = "startUpMeasurement" | ||
|
||
override fun isAccessible(request: HttpRequest): Boolean { | ||
if (super.isAccessible(request)) { | ||
return true | ||
} | ||
|
||
// expose externally to use visualizer front-end | ||
// personal data is not exposed (but someone can say that 3rd plugin class names should be not exposed), | ||
// so, limit to dev builds only (EAP builds are not allowed too) or app in an internal mode (and still only for known hosts) | ||
return isTrustedHostName(request) && ApplicationInfoEx.getInstanceEx().build.isSnapshot || ApplicationManager.getApplication().isInternal | ||
} | ||
|
||
override fun isHostTrusted(request: FullHttpRequest, urlDecoder: QueryStringDecoder): Boolean { | ||
return isTrustedHostName(request) || super.isHostTrusted(request, urlDecoder) | ||
} | ||
|
||
override fun execute(urlDecoder: QueryStringDecoder, request: FullHttpRequest, context: ChannelHandlerContext): String? { | ||
val lastReport = StartupActivity.POST_STARTUP_ACTIVITY.findExtensionOrFail(StartUpPerformanceReporter::class.java).lastReport!! | ||
val response = response("application/json", Unpooled.wrappedBuffer(lastReport)) | ||
sendResponse(request, context, response) | ||
return null | ||
} | ||
} | ||
|
||
private fun isTrustedHostName(request: HttpRequest): Boolean { | ||
val hostName = request.hostName ?: return false | ||
return hostName == "ij-perf.develar.org" || NetUtils.isLocalhost(hostName) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
node_modules/ | ||
.cache/ | ||
dist/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,12 +12,9 @@ | |
|
||
<!-- for security reasons official source of scripts is not used - versioned URL must be used --> | ||
<!-- jsdelivr cannot handle amcharts package (>50MB), so, use https://www.srihash.org/ to compute integrity --> | ||
<script src="https://cdn.jsdelivr.net/gh/amcharts/[email protected]/dist/script/core.js" integrity="sha384-PlKsP/oQhuEJevVS1tTQ/cYJBNgqwZqOXgKuPFqvBNkv23cnGg2AFhcuWqiGlYSX" crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/amcharts/[email protected]/dist/script/charts.js" integrity="sha384-aly+R8ukAs/wzeo5YvKZznHxXi48TS3WCHBE8YnuVUKGO1ta/+yzwUV5QphoyPxY" crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/amcharts/[email protected]/dist/script/themes/animated.js" integrity="sha384-2WR4/PAikFSwy8DTue1g8Cb6Bht0j1T3VoB1WthzSBLIf98n5BHhNHtOmfcPsqvk" crossorigin="anonymous"></script> | ||
|
||
<script defer src="amd.js"></script> | ||
<script defer src="out/index.js"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/amcharts/[email protected]/dist/script/core.js" integrity="sha384-PsQiHaSv7tAeZR6KSjTw51TF0NcswEHzG6mqFYN6ncdtAY50NWHwuyjWQK2q7LA/" crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/amcharts/[email protected]/dist/script/charts.js" integrity="sha384-bPDXFb1ACdfO04ncNlNWC3q0orsZZ0Sok39fO9ztr/3kt7OuKZyEGnIlb6f3Nr4w" crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/amcharts/[email protected]/dist/script/themes/animated.js" integrity="sha384-2WR4/PAikFSwy8DTue1g8Cb6Bht0j1T3VoB1WthzSBLIf98n5BHhNHtOmfcPsqvk" crossorigin="anonymous"></script> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.