Add generated file
This PR adds generated files under pkg/client and vendor folder.
This commit is contained in:
1
vendor/golang.org/x/tools/cmd/heapview/client/.clang-format
generated
vendored
Normal file
1
vendor/golang.org/x/tools/cmd/heapview/client/.clang-format
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
BasedOnStyle: Google
|
1
vendor/golang.org/x/tools/cmd/heapview/client/.gitignore
generated
vendored
Normal file
1
vendor/golang.org/x/tools/cmd/heapview/client/.gitignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/node_modules/
|
45
vendor/golang.org/x/tools/cmd/heapview/client/README.md
generated
vendored
Normal file
45
vendor/golang.org/x/tools/cmd/heapview/client/README.md
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# Go Heap Viewer Client
|
||||
|
||||
This directory contains the client Typescript code for the Go
|
||||
heap viewer.
|
||||
|
||||
## Typescript Tooling
|
||||
|
||||
Below are instructions for downloading tooling and files to
|
||||
help make the development process more convenient. These tools
|
||||
are not required for contributing or running the heap viewer-
|
||||
they are just meant as development aids.
|
||||
|
||||
## Node and NPM
|
||||
|
||||
We use npm to manage the dependencies for these tools. There are
|
||||
a couple of ways of installing npm on your system, but we recommend
|
||||
using nvm.
|
||||
|
||||
Run the following command to install nvm:
|
||||
|
||||
[shell]$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash
|
||||
|
||||
or see the instructions on [the nvm github page](github.com/creationix/nvm)
|
||||
for alternative methods. This will put the nvm tool in your home directory
|
||||
and edit your path to add nvm, node and other tools you install using them.
|
||||
Once nvm is installed, use
|
||||
|
||||
[shell]$ nvm install node
|
||||
|
||||
then
|
||||
|
||||
[shell]$ nvm use node
|
||||
|
||||
to install node.js.
|
||||
|
||||
Once node is installed, you can install typescript using
|
||||
|
||||
[shell]$ npm install -g typescript
|
||||
|
||||
Finally, import type definitions into this project by running
|
||||
|
||||
[shell]$ npm install
|
||||
|
||||
in this directory. They will be imported into the node_packages directory
|
||||
and be automatically available to the Typescript compiler.
|
195
vendor/golang.org/x/tools/cmd/heapview/client/main.ts
generated
vendored
Normal file
195
vendor/golang.org/x/tools/cmd/heapview/client/main.ts
generated
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
/**
|
||||
* An enum of types of actions that might be requested
|
||||
* by the app.
|
||||
*/
|
||||
enum Action {
|
||||
TOGGLE_SIDEBAR, // Toggle the sidebar.
|
||||
NAVIGATE_ABOUT, // Go to the about page.
|
||||
}
|
||||
|
||||
const TITLE = 'Go Heap Viewer';
|
||||
|
||||
/**
|
||||
* A type of event that signals to the AppElement controller
|
||||
* that something shoud be done. For the most part, the structure
|
||||
* of the app will be that elements' state will mostly be controlled
|
||||
* by parent elements. Elements will issue actions that the AppElement
|
||||
* will handle, and the app will be re-rendered down the DOM
|
||||
* hierarchy.
|
||||
*/
|
||||
class ActionEvent extends Event {
|
||||
static readonly EVENT_TYPE = 'action-event'
|
||||
constructor(public readonly action: Action) { super(ActionEvent.EVENT_TYPE); }
|
||||
}
|
||||
|
||||
/**
|
||||
* A hamburger menu element. Triggers a TOGGLE_SIDE action to toggle the
|
||||
* sidebar.
|
||||
*/
|
||||
export class HamburgerElement extends HTMLElement {
|
||||
static readonly NAME = 'heap-hamburger';
|
||||
|
||||
createdCallback() {
|
||||
this.appendChild(document.createTextNode('☰'));
|
||||
this.onclick =
|
||||
() => { this.dispatchEvent(new ActionEvent(Action.TOGGLE_SIDEBAR)) };
|
||||
}
|
||||
}
|
||||
document.registerElement(HamburgerElement.NAME, HamburgerElement);
|
||||
|
||||
/**
|
||||
* A heading for the page with a hamburger menu and a title.
|
||||
*/
|
||||
export class HeadingElement extends HTMLElement {
|
||||
static readonly NAME = 'heap-heading';
|
||||
|
||||
createdCallback() {
|
||||
this.style.display = 'block';
|
||||
this.style.backgroundColor = '#2196F3';
|
||||
this.style.webkitUserSelect = 'none';
|
||||
this.style.cursor = 'default';
|
||||
this.style.color = '#FFFFFF';
|
||||
this.style.padding = '10px';
|
||||
|
||||
const div = document.createElement('div');
|
||||
div.style.margin = '0px';
|
||||
div.style.fontSize = '2em';
|
||||
div.appendChild(document.createElement(HamburgerElement.NAME));
|
||||
div.appendChild(document.createTextNode(' ' + TITLE));
|
||||
this.appendChild(div);
|
||||
}
|
||||
}
|
||||
document.registerElement(HeadingElement.NAME, HeadingElement);
|
||||
|
||||
/**
|
||||
* A sidebar that has navigation for the app.
|
||||
*/
|
||||
export class SidebarElement extends HTMLElement {
|
||||
static readonly NAME = 'heap-sidebar';
|
||||
|
||||
createdCallback() {
|
||||
this.style.display = 'none';
|
||||
this.style.backgroundColor = '#9E9E9E';
|
||||
this.style.width = '15em';
|
||||
|
||||
const aboutButton = document.createElement('button');
|
||||
aboutButton.innerText = 'about';
|
||||
aboutButton.onclick =
|
||||
() => { this.dispatchEvent(new ActionEvent(Action.NAVIGATE_ABOUT)) };
|
||||
this.appendChild(aboutButton);
|
||||
}
|
||||
|
||||
toggle() {
|
||||
this.style.display = this.style.display === 'none' ? 'block' : 'none';
|
||||
}
|
||||
}
|
||||
document.registerElement(SidebarElement.NAME, SidebarElement);
|
||||
|
||||
/**
|
||||
* A Container for the main content in the app.
|
||||
* TODO(matloob): Implement main content.
|
||||
*/
|
||||
export class MainContentElement extends HTMLElement {
|
||||
static readonly NAME = 'heap-container';
|
||||
|
||||
attachedCallback() {
|
||||
this.style.backgroundColor = '#E0E0E0';
|
||||
this.style.height = '100%';
|
||||
this.style.flex = '1';
|
||||
}
|
||||
}
|
||||
document.registerElement(MainContentElement.NAME, MainContentElement);
|
||||
|
||||
/**
|
||||
* A container and controller for the whole app.
|
||||
* Contains the heading, side drawer and main panel.
|
||||
*/
|
||||
class AppElement extends HTMLElement {
|
||||
static readonly NAME = 'heap-app';
|
||||
private sidebar: SidebarElement;
|
||||
private mainContent: MainContentElement;
|
||||
|
||||
attachedCallback() {
|
||||
document.title = TITLE;
|
||||
|
||||
this.addEventListener(
|
||||
ActionEvent.EVENT_TYPE, e => this.handleAction(e as ActionEvent),
|
||||
/* capture */ true);
|
||||
|
||||
this.render();
|
||||
}
|
||||
|
||||
render() {
|
||||
this.style.display = 'block';
|
||||
this.style.height = '100vh';
|
||||
this.style.width = '100vw';
|
||||
this.appendChild(document.createElement(HeadingElement.NAME));
|
||||
|
||||
const bodyDiv = document.createElement('div');
|
||||
bodyDiv.style.height = '100%';
|
||||
bodyDiv.style.display = 'flex';
|
||||
this.sidebar =
|
||||
document.createElement(SidebarElement.NAME) as SidebarElement;
|
||||
bodyDiv.appendChild(this.sidebar);
|
||||
this.mainContent =
|
||||
document.createElement(MainContentElement.NAME) as MainContentElement;
|
||||
bodyDiv.appendChild(this.mainContent);
|
||||
this.appendChild(bodyDiv);
|
||||
|
||||
this.renderRoute();
|
||||
}
|
||||
|
||||
renderRoute() {
|
||||
this.mainContent.innerHTML = ''
|
||||
switch (window.location.pathname) {
|
||||
case '/about':
|
||||
this.mainContent.appendChild(
|
||||
document.createElement(AboutPageElement.NAME));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
handleAction(event: ActionEvent) {
|
||||
switch (event.action) {
|
||||
case Action.TOGGLE_SIDEBAR:
|
||||
this.sidebar.toggle();
|
||||
break;
|
||||
case Action.NAVIGATE_ABOUT:
|
||||
window.history.pushState({}, '', '/about');
|
||||
this.renderRoute();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
document.registerElement(AppElement.NAME, AppElement);
|
||||
|
||||
/**
|
||||
* An about page.
|
||||
*/
|
||||
class AboutPageElement extends HTMLElement {
|
||||
static readonly NAME = 'heap-about';
|
||||
|
||||
createdCallback() { this.textContent = TITLE; }
|
||||
}
|
||||
document.registerElement(AboutPageElement.NAME, AboutPageElement);
|
||||
|
||||
/**
|
||||
* Resets body's margin and padding, and sets font.
|
||||
*/
|
||||
function clearStyle(document: Document) {
|
||||
const styleElement = document.createElement('style') as HTMLStyleElement;
|
||||
document.head.appendChild(styleElement);
|
||||
const styleSheet = styleElement.sheet as CSSStyleSheet;
|
||||
styleSheet.insertRule(
|
||||
'* {font-family: Roboto,Helvetica; box-sizing: border-box}', 0);
|
||||
styleSheet.insertRule('body {margin: 0px; padding:0px}', 0);
|
||||
}
|
||||
|
||||
export function main() {
|
||||
clearStyle(document);
|
||||
document.body.appendChild(document.createElement(AppElement.NAME));
|
||||
}
|
29
vendor/golang.org/x/tools/cmd/heapview/client/main_test.ts
generated
vendored
Normal file
29
vendor/golang.org/x/tools/cmd/heapview/client/main_test.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
import {HamburgerElement, HeadingElement, SidebarElement, main} from './main';
|
||||
|
||||
describe('main', () => {
|
||||
it('sets the document\'s title', () => {
|
||||
main();
|
||||
expect(document.title).toBe('Go Heap Viewer');
|
||||
});
|
||||
|
||||
it('has a heading', () => {
|
||||
main();
|
||||
expect(document.querySelector(HeadingElement.NAME)).toBeDefined();
|
||||
});
|
||||
|
||||
it('has a sidebar', () => {
|
||||
main();
|
||||
const hamburger = document.querySelector(HamburgerElement.NAME);
|
||||
const sidebar =
|
||||
document.querySelector(SidebarElement.NAME) as SidebarElement;
|
||||
expect(sidebar.style.display).toBe('none');
|
||||
|
||||
// Click on the hamburger. Sidebar should then be visible.
|
||||
hamburger.dispatchEvent(new Event('click'));
|
||||
expect(sidebar.style.display).toBe('block');
|
||||
})
|
||||
});
|
35
vendor/golang.org/x/tools/cmd/heapview/client/package.json
generated
vendored
Normal file
35
vendor/golang.org/x/tools/cmd/heapview/client/package.json
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"//": [
|
||||
"Copyright 2016 The Go Authors. All rights reserved.",
|
||||
"Use of this source code is governed by a BSD-style",
|
||||
"license that can be found in the LICENSE file.",
|
||||
|
||||
"This file exists to help import typescript typings",
|
||||
"for web features used in this project. Neither the",
|
||||
"typings nor node or npm are required to do development",
|
||||
"on the code in this project.",
|
||||
|
||||
"If you do have npm installed, use the `npm i` command",
|
||||
"in this directory to install the typings."
|
||||
],
|
||||
"private": true,
|
||||
"name": "@golangtools/heapview",
|
||||
"version": "0.0.0",
|
||||
"devDependencies": {
|
||||
"@types/webcomponents.js": "latest",
|
||||
"@types/whatwg-fetch": "latest",
|
||||
"@types/jasmine": "latest",
|
||||
|
||||
"jasmine-core": "latest",
|
||||
"karma": "latest",
|
||||
"karma-jasmine": "latest",
|
||||
"karma-chrome-launcher": "latest",
|
||||
|
||||
"clang-format": "latest"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "karma start testing/karma.conf.js",
|
||||
"format": "find . | grep '\\(test_main\\.js\\|\\.ts\\)$' | xargs clang-format -i",
|
||||
"lint": "tslint --project ."
|
||||
}
|
||||
}
|
22
vendor/golang.org/x/tools/cmd/heapview/client/testing/karma.conf.js
generated
vendored
Normal file
22
vendor/golang.org/x/tools/cmd/heapview/client/testing/karma.conf.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
module.exports = config => {
|
||||
config.set({
|
||||
frameworks: ['jasmine'],
|
||||
basePath: '../../../..',
|
||||
files: [
|
||||
'third_party/webcomponents/customelements.js',
|
||||
'third_party/typescript/typescript.js',
|
||||
'third_party/moduleloader/moduleloader.js',
|
||||
'cmd/heapview/client/testing/test_main.js',
|
||||
{pattern: 'cmd/heapview/client/**/*.ts', included: false},
|
||||
],
|
||||
browsers: ['Chrome'],
|
||||
plugins: [
|
||||
'karma-jasmine',
|
||||
'karma-chrome-launcher'
|
||||
],
|
||||
})
|
||||
}
|
32
vendor/golang.org/x/tools/cmd/heapview/client/testing/test_main.js
generated
vendored
Normal file
32
vendor/golang.org/x/tools/cmd/heapview/client/testing/test_main.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Configure module loader.
|
||||
System.transpiler = 'typescript'
|
||||
System.typescriptOptions = {
|
||||
target: ts.ScriptTarget.ES2015
|
||||
};
|
||||
System.locate = (load) => load.name + '.ts';
|
||||
|
||||
// Determine set of test files.
|
||||
var tests = [];
|
||||
for (var file in window.__karma__.files) {
|
||||
if (window.__karma__.files.hasOwnProperty(file)) {
|
||||
if (/_test\.ts$/.test(file)) {
|
||||
tests.push(file.slice(0, -3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Steal loaded callback so we can block until we're
|
||||
// done loading all test modules.
|
||||
var loadedCallback = window.__karma__.loaded.bind(window.__karma__);
|
||||
window.__karma__.loaded = () => {};
|
||||
|
||||
// Load all test modules, and then call loadedCallback.
|
||||
var promises = [];
|
||||
for (var i = 0; i < tests.length; i++) {
|
||||
promises.push(System.import(tests[i]));
|
||||
}
|
||||
Promise.all(promises).then(loadedCallback);
|
16
vendor/golang.org/x/tools/cmd/heapview/client/tsconfig.json
generated
vendored
Normal file
16
vendor/golang.org/x/tools/cmd/heapview/client/tsconfig.json
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// This file contains configuration for the Typescript
|
||||
// compiler if you're running it locally for typechecking
|
||||
// and other tooling. The Typescript compiler is
|
||||
// not necessary to do development on this project.
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"strictNullChecks": true,
|
||||
"target": "es2015"
|
||||
}
|
||||
}
|
40
vendor/golang.org/x/tools/cmd/heapview/client/tslint.json
generated
vendored
Normal file
40
vendor/golang.org/x/tools/cmd/heapview/client/tslint.json
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// This tslint file is based on a configuration used at
|
||||
// Google.
|
||||
|
||||
{
|
||||
"rules": {
|
||||
"class-name": true,
|
||||
"forin": true,
|
||||
"interface-name": [true, "never-prefix"],
|
||||
"jsdoc-format": true,
|
||||
"label-position": true,
|
||||
"label-undefined": true,
|
||||
"new-parens": true,
|
||||
"no-angle-bracket-type-assertion": true,
|
||||
"no-construct": true,
|
||||
"no-debugger": true,
|
||||
"no-namespace": [true, "allow-declarations"],
|
||||
"no-reference": true,
|
||||
"no-require-imports": true,
|
||||
"no-unused-expression": true,
|
||||
"no-unused-variable": true,
|
||||
"no-use-before-declare": true,
|
||||
"no-var-keyword": true,
|
||||
"semicolon": [true, "always"],
|
||||
"switch-default": true,
|
||||
"triple-equals": [true, "allow-null-check"],
|
||||
"use-isnan": true,
|
||||
"variable-name": [
|
||||
true,
|
||||
"check-format",
|
||||
"ban-keywords",
|
||||
"allow-leading-underscore",
|
||||
"allow-trailing-underscore",
|
||||
"allow-pascal-case"
|
||||
]
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user