From 608006232fe452d295b8d9eb798c9c6a9dac1900 Mon Sep 17 00:00:00 2001 From: Jamie Wong Date: Wed, 1 Aug 2018 00:41:45 -0700 Subject: [PATCH] Reorganize directory structure (#104) While it was kind of nice having everything at the top level, the number of files is now getting a bit unwieldy and hard to understand, so I took a stab at organizing the directories without introducing too much nesting. Test Plan: - Ran `npm run serve` to ensure that local builds still work - Ran `npm run prepack` then `open dist/release/index.html` to ensure that release builds still work - Ran `scripts/deploy.sh` to ensure that the deployed version of the site will still work when I eventually redeploy - Ran `npm run jest` to ensure that tests still work correctly --- favicon-16x16.png => assets/favicon-16x16.png | Bin favicon-32x32.png => assets/favicon-32x32.png | Bin favicon.ico => assets/favicon.ico | Bin index.html => assets/index.html | 2 +- reset.css => assets/reset.css | 0 cli.js => bin/cli.js | 2 +- package.json | 38 +++++------------- build-release.sh => scripts/build-release.sh | 4 +- deploy.sh => scripts/deploy.sh | 2 +- .../generate-file-format-schema-json.js | 2 +- test-setup.sh => scripts/test-setup.sh | 0 canvas-context.ts => src/gl/canvas-context.ts | 4 +- .../gl/flamechart-color-pass-renderer.ts | 2 +- .../gl/flamechart-renderer.ts | 8 ++-- .../gl/overlay-rectangle-renderer.ts | 2 +- .../gl/rectangle-batch-renderer.ts | 4 +- row-atlas.ts => src/gl/row-atlas.ts | 6 +-- .../gl/texture-cached-renderer.ts | 2 +- .../__snapshots__/bg-flamegraph.test.ts.snap | 0 .../import}/__snapshots__/chrome.test.ts.snap | 0 .../__snapshots__/firefox.test.ts.snap | 0 .../__snapshots__/instruments.test.ts.snap | 0 .../__snapshots__/stackprof.test.ts.snap | 0 .../__snapshots__/v8proflog.test.ts.snap | 0 {import => src/import}/bg-flamegraph.test.ts | 2 +- {import => src/import}/bg-flamegraph.ts | 2 +- {import => src/import}/chrome.test.ts | 2 +- {import => src/import}/chrome.ts | 6 +-- {import => src/import}/file-system-entry.ts | 0 {import => src/import}/firefox.test.ts | 2 +- {import => src/import}/firefox.ts | 6 +-- {import => src/import}/index.ts | 6 +-- {import => src/import}/instruments.test.ts | 2 +- {import => src/import}/instruments.ts | 6 +-- {import => src/import}/stackprof.test.ts | 2 +- {import => src/import}/stackprof.ts | 4 +- {import => src/import}/v8proflog.test.ts | 2 +- {import => src/import}/v8proflog.ts | 6 +-- .../__snapshots__}/file-format.test.ts.snap | 0 color.ts => src/lib/color.ts | 0 demangle-cpp.ts => src/lib/demangle-cpp.ts | 0 .../lib/emscripten.test.ts | 0 emscripten.ts => src/lib/emscripten.ts | 0 .../lib/file-format-spec.ts | 0 .../lib/file-format.test.ts | 0 file-format.ts => src/lib/file-format.ts | 2 +- flamechart.ts => src/lib/flamechart.ts | 0 hash-params.ts => src/lib/hash-params.ts | 0 .../lib/lru-cache.test.ts | 0 lru-cache.ts => src/lib/lru-cache.ts | 0 math.test.ts => src/lib/math.test.ts | 0 math.ts => src/lib/math.ts | 0 profile.test.ts => src/lib/profile.test.ts | 0 profile.ts => src/lib/profile.ts | 0 stats.ts => src/lib/stats.ts | 0 test-utils.ts => src/lib/test-utils.ts | 2 +- text-utils.ts => src/lib/text-utils.ts | 0 {app-state => src/lib}/typed-redux.ts | 0 utils.test.ts => src/lib/utils.test.ts | 0 utils.ts => src/lib/utils.ts | 0 .../lib/value-formatters.test.ts | 0 .../lib/value-formatters.ts | 0 speedscope.tsx => src/speedscope.tsx | 8 ++-- {app-state => src/store}/actions.ts | 10 ++--- .../store}/flamechart-view-state.ts | 6 +-- {app-state => src/store}/getters.ts | 12 +++--- {app-state => src/store}/index.ts | 6 +-- .../store}/sandwich-view-state.ts | 6 +-- .../typings/preact-redux.d.ts | 0 regl.d.ts => src/typings/regl.d.ts | 0 application.tsx => src/views/application.tsx | 20 ++++----- .../views/callee-flamegraph-view.ts | 14 +++---- color-chit.tsx => src/views/color-chit.tsx | 0 .../views/flamechart-detail-view.tsx | 6 +-- .../views/flamechart-minimap-view.tsx | 12 +++--- .../views/flamechart-pan-zoom-view.tsx | 12 +++--- .../views/flamechart-style.ts | 0 .../views/flamechart-view-container.tsx | 18 ++++----- .../views/flamechart-view.tsx | 8 ++-- .../views/flamechart-wrapper.tsx | 10 ++--- hovertip.tsx => src/views/hovertip.tsx | 2 +- .../views/inverted-caller-flamegraph-view.ts | 14 +++---- .../views/profile-table-view.tsx | 12 +++--- .../views/sandwich-view.tsx | 8 ++-- .../views/scrollable-list-view.tsx | 0 style.ts => src/views/style.ts | 0 86 files changed, 149 insertions(+), 165 deletions(-) rename favicon-16x16.png => assets/favicon-16x16.png (100%) rename favicon-32x32.png => assets/favicon-32x32.png (100%) rename favicon.ico => assets/favicon.ico (100%) rename index.html => assets/index.html (99%) rename reset.css => assets/reset.css (100%) rename cli.js => bin/cli.js (98%) rename build-release.sh => scripts/build-release.sh (68%) rename deploy.sh => scripts/deploy.sh (97%) rename generate-file-format-schema-json.js => scripts/generate-file-format-schema-json.js (81%) rename test-setup.sh => scripts/test-setup.sh (100%) rename canvas-context.ts => src/gl/canvas-context.ts (98%) rename flamechart-color-pass-renderer.ts => src/gl/flamechart-color-pass-renderer.ts (98%) rename flamechart-renderer.ts => src/gl/flamechart-renderer.ts (98%) rename overlay-rectangle-renderer.ts => src/gl/overlay-rectangle-renderer.ts (98%) rename rectangle-batch-renderer.ts => src/gl/rectangle-batch-renderer.ts (98%) rename row-atlas.ts => src/gl/row-atlas.ts (95%) rename texture-cached-renderer.ts => src/gl/texture-cached-renderer.ts (98%) rename {import => src/import}/__snapshots__/bg-flamegraph.test.ts.snap (100%) rename {import => src/import}/__snapshots__/chrome.test.ts.snap (100%) rename {import => src/import}/__snapshots__/firefox.test.ts.snap (100%) rename {import => src/import}/__snapshots__/instruments.test.ts.snap (100%) rename {import => src/import}/__snapshots__/stackprof.test.ts.snap (100%) rename {import => src/import}/__snapshots__/v8proflog.test.ts.snap (100%) rename {import => src/import}/bg-flamegraph.test.ts (69%) rename {import => src/import}/bg-flamegraph.ts (91%) rename {import => src/import}/chrome.test.ts (82%) rename {import => src/import}/chrome.ts (96%) rename {import => src/import}/file-system-entry.ts (100%) rename {import => src/import}/firefox.test.ts (69%) rename {import => src/import}/firefox.ts (96%) rename {import => src/import}/index.ts (96%) rename {import => src/import}/instruments.test.ts (97%) rename {import => src/import}/instruments.ts (99%) rename {import => src/import}/stackprof.test.ts (69%) rename {import => src/import}/stackprof.ts (90%) rename {import => src/import}/v8proflog.test.ts (69%) rename {import => src/import}/v8proflog.ts (96%) rename {__snapshots__ => src/lib/__snapshots__}/file-format.test.ts.snap (100%) rename color.ts => src/lib/color.ts (100%) rename demangle-cpp.ts => src/lib/demangle-cpp.ts (100%) rename emscripten.test.ts => src/lib/emscripten.test.ts (100%) rename emscripten.ts => src/lib/emscripten.ts (100%) rename file-format-spec.ts => src/lib/file-format-spec.ts (100%) rename file-format.test.ts => src/lib/file-format.test.ts (100%) rename file-format.ts => src/lib/file-format.ts (98%) rename flamechart.ts => src/lib/flamechart.ts (100%) rename hash-params.ts => src/lib/hash-params.ts (100%) rename lru-cache.test.ts => src/lib/lru-cache.test.ts (100%) rename lru-cache.ts => src/lib/lru-cache.ts (100%) rename math.test.ts => src/lib/math.test.ts (100%) rename math.ts => src/lib/math.ts (100%) rename profile.test.ts => src/lib/profile.test.ts (100%) rename profile.ts => src/lib/profile.ts (100%) rename stats.ts => src/lib/stats.ts (100%) rename test-utils.ts => src/lib/test-utils.ts (98%) rename text-utils.ts => src/lib/text-utils.ts (100%) rename {app-state => src/lib}/typed-redux.ts (100%) rename utils.test.ts => src/lib/utils.test.ts (100%) rename utils.ts => src/lib/utils.ts (100%) rename value-formatters.test.ts => src/lib/value-formatters.test.ts (100%) rename value-formatters.ts => src/lib/value-formatters.ts (100%) rename speedscope.tsx => src/speedscope.tsx (75%) rename {app-state => src/store}/actions.ts (90%) rename {app-state => src/store}/flamechart-view-state.ts (93%) rename {app-state => src/store}/getters.ts (84%) rename {app-state => src/store}/index.ts (94%) rename {app-state => src/store}/sandwich-view-state.ts (93%) rename preact-redux.d.ts => src/typings/preact-redux.d.ts (100%) rename regl.d.ts => src/typings/regl.d.ts (100%) rename application.tsx => src/views/application.tsx (97%) rename callee-flamegraph-view.ts => src/views/callee-flamegraph-view.ts (87%) rename color-chit.tsx => src/views/color-chit.tsx (100%) rename flamechart-detail-view.tsx => src/views/flamechart-detail-view.tsx (96%) rename flamechart-minimap-view.tsx => src/views/flamechart-minimap-view.tsx (97%) rename flamechart-pan-zoom-view.tsx => src/views/flamechart-pan-zoom-view.tsx (98%) rename flamechart-style.ts => src/views/flamechart-style.ts (100%) rename flamechart-view-container.tsx => src/views/flamechart-view-container.tsx (87%) rename flamechart-view.tsx => src/views/flamechart-view.tsx (96%) rename flamechart-wrapper.tsx => src/views/flamechart-wrapper.tsx (93%) rename hovertip.tsx => src/views/hovertip.tsx (98%) rename inverted-caller-flamegraph-view.ts => src/views/inverted-caller-flamegraph-view.ts (88%) rename profile-table-view.tsx => src/views/profile-table-view.tsx (96%) rename sandwich-view.tsx => src/views/sandwich-view.tsx (94%) rename scrollable-list-view.tsx => src/views/scrollable-list-view.tsx (100%) rename style.ts => src/views/style.ts (100%) diff --git a/favicon-16x16.png b/assets/favicon-16x16.png similarity index 100% rename from favicon-16x16.png rename to assets/favicon-16x16.png diff --git a/favicon-32x32.png b/assets/favicon-32x32.png similarity index 100% rename from favicon-32x32.png rename to assets/favicon-32x32.png diff --git a/favicon.ico b/assets/favicon.ico similarity index 100% rename from favicon.ico rename to assets/favicon.ico diff --git a/index.html b/assets/index.html similarity index 99% rename from index.html rename to assets/index.html index 323e75c..962822b 100644 --- a/index.html +++ b/assets/index.html @@ -166,7 +166,7 @@ - + \ No newline at end of file diff --git a/reset.css b/assets/reset.css similarity index 100% rename from reset.css rename to assets/reset.css diff --git a/cli.js b/bin/cli.js similarity index 98% rename from cli.js rename to bin/cli.js index 884a273..14ccc07 100755 --- a/cli.js +++ b/bin/cli.js @@ -52,7 +52,7 @@ async function main() { } if (process.argv.includes('--version') || process.argv.includes('-v')) { - console.log('v' + require('./package.json').version) + console.log('v' + require('../package.json').version) return } diff --git a/package.json b/package.json index ec190e3..da0d4f5 100644 --- a/package.json +++ b/package.json @@ -4,27 +4,20 @@ "description": "", "main": "index.js", "bin": { - "speedscope": "./cli.js" + "speedscope": "./bin/cli.js" }, "scripts": { - "deploy": "./deploy.sh", - "prepack": "./build-release.sh", - "prettier": "prettier --write './**/*.ts' './**/*.tsx'", - "lint": "eslint './**/*.ts' './**/*.tsx'", - "jest": "./test-setup.sh && jest", + "deploy": "./scripts/deploy.sh", + "prepack": "./scripts/build-release.sh", + "prettier": "prettier --write 'src/**/*.ts' 'src/**/*.tsx'", + "lint": "eslint 'src/**/*.ts' 'src/**/*.tsx'", + "jest": "./scripts/test-setup.sh && jest", "coverage": "npm run jest -- --coverage && coveralls < coverage/lcov.info", "test": "tsc --noEmit && npm run lint && npm run coverage", - "serve": "parcel index.html --open --no-autoinstall" + "serve": "parcel assets/index.html --open --no-autoinstall" }, - "files": [ - "cli.js", - "dist/release/**", - "!*.map" - ], - "browserslist": [ - "last 2 Chrome versions", - "last 2 Firefox versions" - ], + "files": ["bin/cli.js", "dist/release/**", "!*.map"], + "browserslist": ["last 2 Chrome versions", "last 2 Firefox versions"], "author": "", "license": "MIT", "devDependencies": { @@ -57,17 +50,8 @@ "^.+\\.tsx?$": "ts-jest" }, "testRegex": "\\.test\\.tsx?$", - "collectCoverageFrom": [ - "**/*.{ts,tsx}", - "!**/*.d.{ts,tsx}" - ], - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "jsx", - "json" - ] + "collectCoverageFrom": ["**/*.{ts,tsx}", "!**/*.d.{ts,tsx}"], + "moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json"] }, "dependencies": { "opn": "5.3.0" diff --git a/build-release.sh b/scripts/build-release.sh similarity index 68% rename from build-release.sh rename to scripts/build-release.sh index a7d506d..e0f93bf 100755 --- a/build-release.sh +++ b/scripts/build-release.sh @@ -16,7 +16,7 @@ date > "$OUTDIR"/release.txt git rev-parse HEAD >> "$OUTDIR"/release.txt # Place a json schema for the file format into the build directory too -node generate-file-format-schema-json.js > "$OUTDIR"/file-format-schema.json +node scripts/generate-file-format-schema-json.js > "$OUTDIR"/file-format-schema.json # Build the compiled assets -node_modules/.bin/parcel build index.html --no-cache --out-dir "$OUTDIR" --public-url "./" --detailed-report \ No newline at end of file +node_modules/.bin/parcel build assets/index.html --no-cache --out-dir "$OUTDIR" --public-url "./" --detailed-report \ No newline at end of file diff --git a/deploy.sh b/scripts/deploy.sh similarity index 97% rename from deploy.sh rename to scripts/deploy.sh index 9496ddb..a360106 100755 --- a/deploy.sh +++ b/scripts/deploy.sh @@ -10,7 +10,7 @@ set -e OUTDIR=`pwd`/dist/release echo $OUTDIR -./build-release.sh +./scripts/build-release.sh # Create a shallow clone of the repository TMPDIR=`mktemp -d -t speedscope-release` diff --git a/generate-file-format-schema-json.js b/scripts/generate-file-format-schema-json.js similarity index 81% rename from generate-file-format-schema-json.js rename to scripts/generate-file-format-schema-json.js index c1f8175..355ac71 100644 --- a/generate-file-format-schema-json.js +++ b/scripts/generate-file-format-schema-json.js @@ -3,7 +3,7 @@ const child_process = require('child_process') // Convert the file-format-spec.ts file into a json schema file let jsonSchema = child_process.execSync( - 'node_modules/.bin/quicktype --lang schema ./file-format-spec.ts', + 'node_modules/.bin/quicktype --lang schema ./src/lib/file-format-spec.ts', { encoding: 'utf8', }, diff --git a/test-setup.sh b/scripts/test-setup.sh similarity index 100% rename from test-setup.sh rename to scripts/test-setup.sh diff --git a/canvas-context.ts b/src/gl/canvas-context.ts similarity index 98% rename from canvas-context.ts rename to src/gl/canvas-context.ts index 1e8f6f1..2107fc0 100644 --- a/canvas-context.ts +++ b/src/gl/canvas-context.ts @@ -13,9 +13,9 @@ import { TextureRenderer, TextureRendererProps, } from './texture-cached-renderer' -import {StatsPanel} from './stats' +import {StatsPanel} from '../lib/stats' -import {Vec2, Rect} from './math' +import {Vec2, Rect} from '../lib/math' import { FlamechartColorPassRenderer, FlamechartColorPassRenderProps, diff --git a/flamechart-color-pass-renderer.ts b/src/gl/flamechart-color-pass-renderer.ts similarity index 98% rename from flamechart-color-pass-renderer.ts rename to src/gl/flamechart-color-pass-renderer.ts index a56fece..5ddc980 100644 --- a/flamechart-color-pass-renderer.ts +++ b/src/gl/flamechart-color-pass-renderer.ts @@ -1,5 +1,5 @@ import regl from 'regl' -import {Vec2, Rect, AffineTransform} from './math' +import {Vec2, Rect, AffineTransform} from '../lib/math' export interface FlamechartColorPassRenderProps { rectInfoTexture: regl.Texture diff --git a/flamechart-renderer.ts b/src/gl/flamechart-renderer.ts similarity index 98% rename from flamechart-renderer.ts rename to src/gl/flamechart-renderer.ts index 16cff2c..8076725 100644 --- a/flamechart-renderer.ts +++ b/src/gl/flamechart-renderer.ts @@ -1,10 +1,10 @@ import regl from 'regl' -import {Flamechart} from './flamechart' +import {Flamechart} from '../lib/flamechart' import {RectangleBatch} from './rectangle-batch-renderer' import {CanvasContext} from './canvas-context' -import {Vec2, Rect, AffineTransform} from './math' -import {Color} from './color' -import {KeyedSet} from './utils' +import {Vec2, Rect, AffineTransform} from '../lib/math' +import {Color} from '../lib/color' +import {KeyedSet} from '../lib/utils' import {RowAtlas} from './row-atlas' const MAX_BATCH_SIZE = 10000 diff --git a/overlay-rectangle-renderer.ts b/src/gl/overlay-rectangle-renderer.ts similarity index 98% rename from overlay-rectangle-renderer.ts rename to src/gl/overlay-rectangle-renderer.ts index 9d3c8b0..5f00175 100644 --- a/overlay-rectangle-renderer.ts +++ b/src/gl/overlay-rectangle-renderer.ts @@ -1,5 +1,5 @@ import regl from 'regl' -import {AffineTransform, Rect} from './math' +import {AffineTransform, Rect} from '../lib/math' export interface ViewportRectangleRendererProps { configSpaceToPhysicalViewSpace: AffineTransform diff --git a/rectangle-batch-renderer.ts b/src/gl/rectangle-batch-renderer.ts similarity index 98% rename from rectangle-batch-renderer.ts rename to src/gl/rectangle-batch-renderer.ts index 5944438..4655985 100644 --- a/rectangle-batch-renderer.ts +++ b/src/gl/rectangle-batch-renderer.ts @@ -1,6 +1,6 @@ import regl from 'regl' -import {Rect, Vec2, AffineTransform} from './math' -import {Color} from './color' +import {Rect, Vec2, AffineTransform} from '../lib/math' +import {Color} from '../lib/color' export class RectangleBatch { private rectCapacity = 1000 diff --git a/row-atlas.ts b/src/gl/row-atlas.ts similarity index 95% rename from row-atlas.ts rename to src/gl/row-atlas.ts index b564d16..be2d50e 100644 --- a/row-atlas.ts +++ b/src/gl/row-atlas.ts @@ -1,9 +1,9 @@ import regl from 'regl' -import {LRUCache} from './lru-cache' +import {LRUCache} from '../lib/lru-cache' import {RectangleBatch} from './rectangle-batch-renderer' import {CanvasContext} from './canvas-context' -import {Rect, Vec2} from './math' -import {Color} from './color' +import {Rect, Vec2} from '../lib/math' +import {Color} from '../lib/color' export class RowAtlas { texture: regl.Texture diff --git a/texture-cached-renderer.ts b/src/gl/texture-cached-renderer.ts similarity index 98% rename from texture-cached-renderer.ts rename to src/gl/texture-cached-renderer.ts index af313b5..41d1195 100644 --- a/texture-cached-renderer.ts +++ b/src/gl/texture-cached-renderer.ts @@ -1,5 +1,5 @@ import regl from 'regl' -import {Vec2, Rect, AffineTransform} from './math' +import {Vec2, Rect, AffineTransform} from '../lib/math' export interface TextureRendererProps { texture: regl.Texture diff --git a/import/__snapshots__/bg-flamegraph.test.ts.snap b/src/import/__snapshots__/bg-flamegraph.test.ts.snap similarity index 100% rename from import/__snapshots__/bg-flamegraph.test.ts.snap rename to src/import/__snapshots__/bg-flamegraph.test.ts.snap diff --git a/import/__snapshots__/chrome.test.ts.snap b/src/import/__snapshots__/chrome.test.ts.snap similarity index 100% rename from import/__snapshots__/chrome.test.ts.snap rename to src/import/__snapshots__/chrome.test.ts.snap diff --git a/import/__snapshots__/firefox.test.ts.snap b/src/import/__snapshots__/firefox.test.ts.snap similarity index 100% rename from import/__snapshots__/firefox.test.ts.snap rename to src/import/__snapshots__/firefox.test.ts.snap diff --git a/import/__snapshots__/instruments.test.ts.snap b/src/import/__snapshots__/instruments.test.ts.snap similarity index 100% rename from import/__snapshots__/instruments.test.ts.snap rename to src/import/__snapshots__/instruments.test.ts.snap diff --git a/import/__snapshots__/stackprof.test.ts.snap b/src/import/__snapshots__/stackprof.test.ts.snap similarity index 100% rename from import/__snapshots__/stackprof.test.ts.snap rename to src/import/__snapshots__/stackprof.test.ts.snap diff --git a/import/__snapshots__/v8proflog.test.ts.snap b/src/import/__snapshots__/v8proflog.test.ts.snap similarity index 100% rename from import/__snapshots__/v8proflog.test.ts.snap rename to src/import/__snapshots__/v8proflog.test.ts.snap diff --git a/import/bg-flamegraph.test.ts b/src/import/bg-flamegraph.test.ts similarity index 69% rename from import/bg-flamegraph.test.ts rename to src/import/bg-flamegraph.test.ts index 7d81c15..2cef442 100644 --- a/import/bg-flamegraph.test.ts +++ b/src/import/bg-flamegraph.test.ts @@ -1,4 +1,4 @@ -import {checkProfileSnapshot} from '../test-utils' +import {checkProfileSnapshot} from '../lib/test-utils' test('importFromBGFlameGraph', async () => { await checkProfileSnapshot('./sample/profiles/stackcollapse/simple.txt') diff --git a/import/bg-flamegraph.ts b/src/import/bg-flamegraph.ts similarity index 91% rename from import/bg-flamegraph.ts rename to src/import/bg-flamegraph.ts index 56ba6a5..6eef38b 100644 --- a/import/bg-flamegraph.ts +++ b/src/import/bg-flamegraph.ts @@ -1,6 +1,6 @@ // https://github.com/brendangregg/FlameGraph#2-fold-stacks -import {Profile, FrameInfo, StackListProfileBuilder} from '../profile' +import {Profile, FrameInfo, StackListProfileBuilder} from '../lib/profile' interface BGSample { stack: FrameInfo[] diff --git a/import/chrome.test.ts b/src/import/chrome.test.ts similarity index 82% rename from import/chrome.test.ts rename to src/import/chrome.test.ts index 4ae52bc..e8cc08d 100644 --- a/import/chrome.test.ts +++ b/src/import/chrome.test.ts @@ -1,4 +1,4 @@ -import {checkProfileSnapshot} from '../test-utils' +import {checkProfileSnapshot} from '../lib/test-utils' test('importFromChromeCPUProfile', async () => { await checkProfileSnapshot('./sample/profiles/Chrome/65/simple.cpuprofile') diff --git a/import/chrome.ts b/src/import/chrome.ts similarity index 96% rename from import/chrome.ts rename to src/import/chrome.ts index dca5d6f..1129d20 100644 --- a/import/chrome.ts +++ b/src/import/chrome.ts @@ -1,6 +1,6 @@ -import {Profile, FrameInfo, CallTreeProfileBuilder} from '../profile' -import {getOrInsert, lastOf} from '../utils' -import {TimeFormatter} from '../value-formatters' +import {Profile, FrameInfo, CallTreeProfileBuilder} from '../lib/profile' +import {getOrInsert, lastOf} from '../lib/utils' +import {TimeFormatter} from '../lib/value-formatters' interface TimelineEvent { pid: number diff --git a/import/file-system-entry.ts b/src/import/file-system-entry.ts similarity index 100% rename from import/file-system-entry.ts rename to src/import/file-system-entry.ts diff --git a/import/firefox.test.ts b/src/import/firefox.test.ts similarity index 69% rename from import/firefox.test.ts rename to src/import/firefox.test.ts index 984ad03..774cfd9 100644 --- a/import/firefox.test.ts +++ b/src/import/firefox.test.ts @@ -1,4 +1,4 @@ -import {checkProfileSnapshot} from '../test-utils' +import {checkProfileSnapshot} from '../lib/test-utils' test('importFromFirefox', async () => { await checkProfileSnapshot('./sample/profiles/Firefox/59/simple-firefox.json') diff --git a/import/firefox.ts b/src/import/firefox.ts similarity index 96% rename from import/firefox.ts rename to src/import/firefox.ts index d23435b..3918818 100644 --- a/import/firefox.ts +++ b/src/import/firefox.ts @@ -1,6 +1,6 @@ -import {Profile, FrameInfo, CallTreeProfileBuilder} from '../profile' -import {getOrInsert, lastOf} from '../utils' -import {TimeFormatter} from '../value-formatters' +import {Profile, FrameInfo, CallTreeProfileBuilder} from '../lib/profile' +import {getOrInsert, lastOf} from '../lib/utils' +import {TimeFormatter} from '../lib/value-formatters' interface Allocations { frames: any[] diff --git a/import/index.ts b/src/import/index.ts similarity index 96% rename from import/index.ts rename to src/import/index.ts index 39f958a..43f6b6b 100644 --- a/import/index.ts +++ b/src/import/index.ts @@ -1,4 +1,4 @@ -import {Profile} from '../profile' +import {Profile} from '../lib/profile' import {FileSystemDirectoryEntry} from './file-system-entry' import {importFromChromeCPUProfile, importFromChromeTimeline} from './chrome' @@ -6,8 +6,8 @@ import {importFromStackprof} from './stackprof' import {importFromInstrumentsDeepCopy, importFromInstrumentsTrace} from './instruments' import {importFromBGFlameGraph} from './bg-flamegraph' import {importFromFirefox} from './firefox' -import {importSpeedscopeProfiles} from '../file-format' -import {FileFormat} from '../file-format-spec' +import {importSpeedscopeProfiles} from '../lib/file-format' +import {FileFormat} from '../lib/file-format-spec' import {importFromV8ProfLog} from './v8proflog' export async function importProfile(fileName: string, contents: string): Promise { diff --git a/import/instruments.test.ts b/src/import/instruments.test.ts similarity index 97% rename from import/instruments.test.ts rename to src/import/instruments.test.ts index fe5a9f8..72cf7d1 100644 --- a/import/instruments.test.ts +++ b/src/import/instruments.test.ts @@ -1,6 +1,6 @@ import * as fs from 'fs' import * as path from 'path' -import {dumpProfile, checkProfileSnapshot} from '../test-utils' +import {dumpProfile, checkProfileSnapshot} from '../lib/test-utils' import * as JSZip from 'jszip' import {FileSystemEntry} from './file-system-entry' diff --git a/import/instruments.ts b/src/import/instruments.ts similarity index 99% rename from import/instruments.ts rename to src/import/instruments.ts index 7ccf854..e74fe63 100644 --- a/import/instruments.ts +++ b/src/import/instruments.ts @@ -1,10 +1,10 @@ // This file contains methods to import data from OS X Instruments.app // https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/index.html -import {Profile, FrameInfo, CallTreeProfileBuilder, StackListProfileBuilder} from '../profile' -import {sortBy, getOrThrow, getOrInsert, lastOf, getOrElse, zeroPad} from '../utils' +import {Profile, FrameInfo, CallTreeProfileBuilder, StackListProfileBuilder} from '../lib/profile' +import {sortBy, getOrThrow, getOrInsert, lastOf, getOrElse, zeroPad} from '../lib/utils' import * as pako from 'pako' -import {ByteFormatter, TimeFormatter} from '../value-formatters' +import {ByteFormatter, TimeFormatter} from '../lib/value-formatters' import {FileSystemDirectoryEntry, FileSystemEntry, FileSystemFileEntry} from './file-system-entry' function parseTSV(contents: string): T[] { diff --git a/import/stackprof.test.ts b/src/import/stackprof.test.ts similarity index 69% rename from import/stackprof.test.ts rename to src/import/stackprof.test.ts index d862c68..f5fb850 100644 --- a/import/stackprof.test.ts +++ b/src/import/stackprof.test.ts @@ -1,4 +1,4 @@ -import {checkProfileSnapshot} from '../test-utils' +import {checkProfileSnapshot} from '../lib/test-utils' test('importFromStackprof', async () => { await checkProfileSnapshot('./sample/profiles/stackprof/simple-stackprof.json') diff --git a/import/stackprof.ts b/src/import/stackprof.ts similarity index 90% rename from import/stackprof.ts rename to src/import/stackprof.ts index c575fed..1ef5461 100644 --- a/import/stackprof.ts +++ b/src/import/stackprof.ts @@ -1,7 +1,7 @@ // https://github.com/tmm1/stackprof -import {Profile, FrameInfo, StackListProfileBuilder} from '../profile' -import {TimeFormatter} from '../value-formatters' +import {Profile, FrameInfo, StackListProfileBuilder} from '../lib/profile' +import {TimeFormatter} from '../lib/value-formatters' interface StackprofFrame { name: string diff --git a/import/v8proflog.test.ts b/src/import/v8proflog.test.ts similarity index 69% rename from import/v8proflog.test.ts rename to src/import/v8proflog.test.ts index be4ef29..861c1e7 100644 --- a/import/v8proflog.test.ts +++ b/src/import/v8proflog.test.ts @@ -1,4 +1,4 @@ -import {checkProfileSnapshot} from '../test-utils' +import {checkProfileSnapshot} from '../lib/test-utils' test('importFromV8ProfLog', async () => { await checkProfileSnapshot('./sample/profiles/node/8.5.0/simple.v8log.json') diff --git a/import/v8proflog.ts b/src/import/v8proflog.ts similarity index 96% rename from import/v8proflog.ts rename to src/import/v8proflog.ts index dc710bc..e024be1 100644 --- a/import/v8proflog.ts +++ b/src/import/v8proflog.ts @@ -1,6 +1,6 @@ -import {Profile, FrameInfo, StackListProfileBuilder} from '../profile' -import {getOrInsert, sortBy} from '../utils' -import {TimeFormatter} from '../value-formatters' +import {Profile, FrameInfo, StackListProfileBuilder} from '../lib/profile' +import {getOrInsert, sortBy} from '../lib/utils' +import {TimeFormatter} from '../lib/value-formatters' // This imports profiles generated by a combination of the following commands: // diff --git a/__snapshots__/file-format.test.ts.snap b/src/lib/__snapshots__/file-format.test.ts.snap similarity index 100% rename from __snapshots__/file-format.test.ts.snap rename to src/lib/__snapshots__/file-format.test.ts.snap diff --git a/color.ts b/src/lib/color.ts similarity index 100% rename from color.ts rename to src/lib/color.ts diff --git a/demangle-cpp.ts b/src/lib/demangle-cpp.ts similarity index 100% rename from demangle-cpp.ts rename to src/lib/demangle-cpp.ts diff --git a/emscripten.test.ts b/src/lib/emscripten.test.ts similarity index 100% rename from emscripten.test.ts rename to src/lib/emscripten.test.ts diff --git a/emscripten.ts b/src/lib/emscripten.ts similarity index 100% rename from emscripten.ts rename to src/lib/emscripten.ts diff --git a/file-format-spec.ts b/src/lib/file-format-spec.ts similarity index 100% rename from file-format-spec.ts rename to src/lib/file-format-spec.ts diff --git a/file-format.test.ts b/src/lib/file-format.test.ts similarity index 100% rename from file-format.test.ts rename to src/lib/file-format.test.ts diff --git a/file-format.ts b/src/lib/file-format.ts similarity index 98% rename from file-format.ts rename to src/lib/file-format.ts index 1ee4ff7..2d2e0b6 100644 --- a/file-format.ts +++ b/src/lib/file-format.ts @@ -22,7 +22,7 @@ export function exportProfile(profile: Profile): FileFormat.File { } const file: FileFormat.File = { - version: require('./package.json').version, + version: require('../../package.json').version, $schema: 'https://www.speedscope.app/file-format-schema.json', shared: {frames}, profiles: [eventedProfile], diff --git a/flamechart.ts b/src/lib/flamechart.ts similarity index 100% rename from flamechart.ts rename to src/lib/flamechart.ts diff --git a/hash-params.ts b/src/lib/hash-params.ts similarity index 100% rename from hash-params.ts rename to src/lib/hash-params.ts diff --git a/lru-cache.test.ts b/src/lib/lru-cache.test.ts similarity index 100% rename from lru-cache.test.ts rename to src/lib/lru-cache.test.ts diff --git a/lru-cache.ts b/src/lib/lru-cache.ts similarity index 100% rename from lru-cache.ts rename to src/lib/lru-cache.ts diff --git a/math.test.ts b/src/lib/math.test.ts similarity index 100% rename from math.test.ts rename to src/lib/math.test.ts diff --git a/math.ts b/src/lib/math.ts similarity index 100% rename from math.ts rename to src/lib/math.ts diff --git a/profile.test.ts b/src/lib/profile.test.ts similarity index 100% rename from profile.test.ts rename to src/lib/profile.test.ts diff --git a/profile.ts b/src/lib/profile.ts similarity index 100% rename from profile.ts rename to src/lib/profile.ts diff --git a/stats.ts b/src/lib/stats.ts similarity index 100% rename from stats.ts rename to src/lib/stats.ts diff --git a/test-utils.ts b/src/lib/test-utils.ts similarity index 98% rename from test-utils.ts rename to src/lib/test-utils.ts index 26644f5..95d3aa0 100644 --- a/test-utils.ts +++ b/src/lib/test-utils.ts @@ -1,7 +1,7 @@ import * as fs from 'fs' import * as path from 'path' import {Profile, CallTreeNode, Frame} from './profile' -import {importProfile} from './import' +import {importProfile} from '../import' import {exportProfile, importSpeedscopeProfiles} from './file-format' interface DumpedProfile { diff --git a/text-utils.ts b/src/lib/text-utils.ts similarity index 100% rename from text-utils.ts rename to src/lib/text-utils.ts diff --git a/app-state/typed-redux.ts b/src/lib/typed-redux.ts similarity index 100% rename from app-state/typed-redux.ts rename to src/lib/typed-redux.ts diff --git a/utils.test.ts b/src/lib/utils.test.ts similarity index 100% rename from utils.test.ts rename to src/lib/utils.test.ts diff --git a/utils.ts b/src/lib/utils.ts similarity index 100% rename from utils.ts rename to src/lib/utils.ts diff --git a/value-formatters.test.ts b/src/lib/value-formatters.test.ts similarity index 100% rename from value-formatters.test.ts rename to src/lib/value-formatters.test.ts diff --git a/value-formatters.ts b/src/lib/value-formatters.ts similarity index 100% rename from value-formatters.ts rename to src/lib/value-formatters.ts diff --git a/speedscope.tsx b/src/speedscope.tsx similarity index 75% rename from speedscope.tsx rename to src/speedscope.tsx index 627a74d..3a22220 100644 --- a/speedscope.tsx +++ b/src/speedscope.tsx @@ -1,10 +1,10 @@ import {h, render} from 'preact' -import {createApplicationStore, ApplicationState} from './app-state' +import {createApplicationStore, ApplicationState} from './store' import {Provider} from 'preact-redux' -import {createContainer} from './app-state/typed-redux' -import {Application} from './application' +import {createContainer} from './lib/typed-redux' +import {Application} from './views/application' -console.log(`speedscope v${require('./package.json').version}`) +console.log(`speedscope v${require('../package.json').version}`) declare const module: any if (module.hot) { diff --git a/app-state/actions.ts b/src/store/actions.ts similarity index 90% rename from app-state/actions.ts rename to src/store/actions.ts index c4eebf6..f2e38e8 100644 --- a/app-state/actions.ts +++ b/src/store/actions.ts @@ -1,10 +1,10 @@ -import {actionCreator} from './typed-redux' -import {Profile, CallTreeNode, Frame} from '../profile' -import {SortMethod} from '../profile-table-view' +import {actionCreator} from '../lib/typed-redux' +import {Profile, CallTreeNode, Frame} from '../lib/profile' +import {SortMethod} from '../views/profile-table-view' import {ViewMode} from '.' import {FlamechartID} from './flamechart-view-state' -import {Rect, Vec2} from '../math' -import {HashParams} from '../hash-params' +import {Rect, Vec2} from '../lib/math' +import {HashParams} from '../lib/hash-params' export namespace actions { // Set the top-level profile from which other data will be derived diff --git a/app-state/flamechart-view-state.ts b/src/store/flamechart-view-state.ts similarity index 93% rename from app-state/flamechart-view-state.ts rename to src/store/flamechart-view-state.ts index 6a70851..2fb78fb 100644 --- a/app-state/flamechart-view-state.ts +++ b/src/store/flamechart-view-state.ts @@ -1,6 +1,6 @@ -import {CallTreeNode} from '../profile' -import {Rect, Vec2} from '../math' -import {Reducer} from './typed-redux' +import {CallTreeNode} from '../lib/profile' +import {Rect, Vec2} from '../lib/math' +import {Reducer} from '../lib/typed-redux' import {actions} from './actions' export enum FlamechartID { diff --git a/app-state/getters.ts b/src/store/getters.ts similarity index 84% rename from app-state/getters.ts rename to src/store/getters.ts index 5c1c885..b2a6a22 100644 --- a/app-state/getters.ts +++ b/src/store/getters.ts @@ -1,9 +1,9 @@ -import {Frame, Profile} from '../profile' -import {triangle, memoizeByReference, memoizeByShallowEquality} from '../utils' -import {RowAtlas} from '../row-atlas' -import {CanvasContext} from '../canvas-context' -import {Color} from '../color' -import {FlamechartRowAtlasKey} from '../flamechart-renderer' +import {Frame, Profile} from '../lib/profile' +import {triangle, memoizeByReference, memoizeByShallowEquality} from '../lib/utils' +import {RowAtlas} from '../gl/row-atlas' +import {CanvasContext} from '../gl/canvas-context' +import {Color} from '../lib/color' +import {FlamechartRowAtlasKey} from '../gl/flamechart-renderer' export const createGetColorBucketForFrame = memoizeByReference( (frameToColorBucket: Map) => { diff --git a/app-state/index.ts b/src/store/index.ts similarity index 94% rename from app-state/index.ts rename to src/store/index.ts index 0f8e0cb..c648476 100644 --- a/app-state/index.ts +++ b/src/store/index.ts @@ -6,15 +6,15 @@ import {actions} from './actions' */ import * as redux from 'redux' -import {setter, Reducer} from './typed-redux' -import {Profile} from '../profile' +import {setter, Reducer} from '../lib/typed-redux' +import {Profile} from '../lib/profile' import { createFlamechartViewStateReducer, FlamechartID, FlamechartViewState, } from './flamechart-view-state' import {SandwichViewState, sandwichView} from './sandwich-view-state' -import {HashParams, getHashParams} from '../hash-params' +import {HashParams, getHashParams} from '../lib/hash-params' export const enum ViewMode { CHRONO_FLAME_CHART, diff --git a/app-state/sandwich-view-state.ts b/src/store/sandwich-view-state.ts similarity index 93% rename from app-state/sandwich-view-state.ts rename to src/store/sandwich-view-state.ts index 58ac665..0ce5cdc 100644 --- a/app-state/sandwich-view-state.ts +++ b/src/store/sandwich-view-state.ts @@ -1,11 +1,11 @@ -import {SortMethod, SortField, SortDirection} from '../profile-table-view' -import {Frame} from '../profile' +import {SortMethod, SortField, SortDirection} from '../views/profile-table-view' +import {Frame} from '../lib/profile' import { FlamechartViewState, FlamechartID, createFlamechartViewStateReducer, } from './flamechart-view-state' -import {Reducer} from './typed-redux' +import {Reducer} from '../lib/typed-redux' import {actions} from './actions' export interface SandwichViewState { diff --git a/preact-redux.d.ts b/src/typings/preact-redux.d.ts similarity index 100% rename from preact-redux.d.ts rename to src/typings/preact-redux.d.ts diff --git a/regl.d.ts b/src/typings/regl.d.ts similarity index 100% rename from regl.d.ts rename to src/typings/regl.d.ts diff --git a/application.tsx b/src/views/application.tsx similarity index 97% rename from application.tsx rename to src/views/application.tsx index ef4a410..6be4118 100644 --- a/application.tsx +++ b/src/views/application.tsx @@ -1,19 +1,19 @@ import {h, Component} from 'preact' import {StyleSheet, css} from 'aphrodite' -import {FileSystemDirectoryEntry} from './import/file-system-entry' +import {FileSystemDirectoryEntry} from '../import/file-system-entry' -import {Profile, Frame} from './profile' +import {Profile, Frame} from '../lib/profile' import {FontFamily, FontSize, Colors, Sizes, Duration} from './style' -import {importEmscriptenSymbolMap} from './emscripten' +import {importEmscriptenSymbolMap} from '../lib/emscripten' import {SandwichViewContainer} from './sandwich-view' -import {saveToFile} from './file-format' -import {ApplicationState, ViewMode, canUseXHR} from './app-state' -import {actions} from './app-state/actions' -import {Dispatch, StatelessComponent, WithDispatch} from './app-state/typed-redux' +import {saveToFile} from '../lib/file-format' +import {ApplicationState, ViewMode, canUseXHR} from '../store' +import {actions} from '../store/actions' +import {Dispatch, StatelessComponent, WithDispatch} from '../lib/typed-redux' import {LeftHeavyFlamechartView, ChronoFlamechartView} from './flamechart-view-container' -import {getProfileToView} from './app-state/getters' +import {getProfileToView} from '../store/getters' -const importModule = import('./import') +const importModule = import('../import') // Force eager loading of the module importModule.then(() => {}) async function importProfile(fileName: string, contents: string): Promise { @@ -24,7 +24,7 @@ async function importFromFileSystemDirectoryEntry(entry: FileSystemDirectoryEntr } declare function require(x: string): any -const exampleProfileURL = require('./sample/profiles/stackcollapse/perf-vertx-stacks-01-collapsed-all.txt') +const exampleProfileURL = require('../../sample/profiles/stackcollapse/perf-vertx-stacks-01-collapsed-all.txt') interface ToolbarProps extends ApplicationState { setViewMode(order: ViewMode): void diff --git a/callee-flamegraph-view.ts b/src/views/callee-flamegraph-view.ts similarity index 87% rename from callee-flamegraph-view.ts rename to src/views/callee-flamegraph-view.ts index 1985f98..e6a0827 100644 --- a/callee-flamegraph-view.ts +++ b/src/views/callee-flamegraph-view.ts @@ -1,15 +1,15 @@ -import {memoizeByShallowEquality} from './utils' -import {Profile, Frame} from './profile' -import {Flamechart} from './flamechart' +import {memoizeByShallowEquality} from '../lib/utils' +import {Profile, Frame} from '../lib/profile' +import {Flamechart} from '../lib/flamechart' import {createMemoizedFlamechartRenderer} from './flamechart-view-container' -import {createContainer} from './app-state/typed-redux' -import {ApplicationState} from './app-state' +import {createContainer} from '../lib/typed-redux' +import {ApplicationState} from '../store' import { getCanvasContext, createGetColorBucketForFrame, createGetCSSColorForFrame, -} from './app-state/getters' -import {FlamechartID} from './app-state/flamechart-view-state' +} from '../store/getters' +import {FlamechartID} from '../store/flamechart-view-state' import {FlamechartWrapper} from './flamechart-wrapper' const getCalleeProfile = memoizeByShallowEquality< diff --git a/color-chit.tsx b/src/views/color-chit.tsx similarity index 100% rename from color-chit.tsx rename to src/views/color-chit.tsx diff --git a/flamechart-detail-view.tsx b/src/views/flamechart-detail-view.tsx similarity index 96% rename from flamechart-detail-view.tsx rename to src/views/flamechart-detail-view.tsx index 26c0f10..26a7ab5 100644 --- a/flamechart-detail-view.tsx +++ b/src/views/flamechart-detail-view.tsx @@ -1,10 +1,10 @@ import {StyleDeclarationValue, css} from 'aphrodite' import {h, Component} from 'preact' import {style} from './flamechart-style' -import {formatPercent} from './utils' -import {Frame, CallTreeNode} from './profile' +import {formatPercent} from '../lib/utils' +import {Frame, CallTreeNode} from '../lib/profile' import {ColorChit} from './color-chit' -import {Flamechart} from './flamechart' +import {Flamechart} from '../lib/flamechart' interface StatisticsTableProps { title: string diff --git a/flamechart-minimap-view.tsx b/src/views/flamechart-minimap-view.tsx similarity index 97% rename from flamechart-minimap-view.tsx rename to src/views/flamechart-minimap-view.tsx index af84bfe..664535d 100644 --- a/flamechart-minimap-view.tsx +++ b/src/views/flamechart-minimap-view.tsx @@ -1,13 +1,13 @@ import {h, Component} from 'preact' import {css} from 'aphrodite' -import {Flamechart} from './flamechart' -import {Rect, Vec2, AffineTransform, clamp} from './math' -import {FlamechartRenderer} from './flamechart-renderer' +import {Flamechart} from '../lib/flamechart' +import {Rect, Vec2, AffineTransform, clamp} from '../lib/math' +import {FlamechartRenderer} from '../gl/flamechart-renderer' import {style} from './flamechart-style' import {FontFamily, FontSize, Colors, Sizes, commonStyle} from './style' -import {CanvasContext} from './canvas-context' -import {TextureCachedRenderer} from './texture-cached-renderer' -import {cachedMeasureTextWidth} from './text-utils' +import {CanvasContext} from '../gl/canvas-context' +import {TextureCachedRenderer} from '../gl/texture-cached-renderer' +import {cachedMeasureTextWidth} from '../lib/text-utils' interface FlamechartMinimapViewProps { flamechart: Flamechart diff --git a/flamechart-pan-zoom-view.tsx b/src/views/flamechart-pan-zoom-view.tsx similarity index 98% rename from flamechart-pan-zoom-view.tsx rename to src/views/flamechart-pan-zoom-view.tsx index 188f746..799c7a9 100644 --- a/flamechart-pan-zoom-view.tsx +++ b/src/views/flamechart-pan-zoom-view.tsx @@ -1,10 +1,10 @@ -import {Rect, AffineTransform, Vec2, clamp} from './math' -import {CallTreeNode} from './profile' -import {Flamechart, FlamechartFrame} from './flamechart' -import {CanvasContext} from './canvas-context' -import {FlamechartRenderer} from './flamechart-renderer' +import {Rect, AffineTransform, Vec2, clamp} from '../lib/math' +import {CallTreeNode} from '../lib/profile' +import {Flamechart, FlamechartFrame} from '../lib/flamechart' +import {CanvasContext} from '../gl/canvas-context' +import {FlamechartRenderer} from '../gl/flamechart-renderer' import {Sizes, FontSize, Colors, FontFamily, commonStyle} from './style' -import {cachedMeasureTextWidth, ELLIPSIS, trimTextMid} from './text-utils' +import {cachedMeasureTextWidth, ELLIPSIS, trimTextMid} from '../lib/text-utils' import {style} from './flamechart-style' import {h, Component} from 'preact' import {css} from 'aphrodite' diff --git a/flamechart-style.ts b/src/views/flamechart-style.ts similarity index 100% rename from flamechart-style.ts rename to src/views/flamechart-style.ts diff --git a/flamechart-view-container.tsx b/src/views/flamechart-view-container.tsx similarity index 87% rename from flamechart-view-container.tsx rename to src/views/flamechart-view-container.tsx index 0da890d..c85cdd6 100644 --- a/flamechart-view-container.tsx +++ b/src/views/flamechart-view-container.tsx @@ -1,18 +1,18 @@ -import {FlamechartID, FlamechartViewState} from './app-state/flamechart-view-state' -import {CanvasContext} from './canvas-context' -import {Flamechart} from './flamechart' -import {FlamechartRenderer, FlamechartRendererOptions} from './flamechart-renderer' -import {Dispatch, createContainer, WithoutDispatch} from './app-state/typed-redux' -import {Frame, Profile} from './profile' -import {memoizeByShallowEquality} from './utils' -import {ApplicationState} from './app-state' +import {FlamechartID, FlamechartViewState} from '../store/flamechart-view-state' +import {CanvasContext} from '../gl/canvas-context' +import {Flamechart} from '../lib/flamechart' +import {FlamechartRenderer, FlamechartRendererOptions} from '../gl/flamechart-renderer' +import {Dispatch, createContainer, WithoutDispatch} from '../lib/typed-redux' +import {Frame, Profile} from '../lib/profile' +import {memoizeByShallowEquality} from '../lib/utils' +import {ApplicationState} from '../store' import {FlamechartView} from './flamechart-view' import { getRowAtlas, createGetColorBucketForFrame, getCanvasContext, createGetCSSColorForFrame, -} from './app-state/getters' +} from '../store/getters' export type FlamechartViewProps = { id: FlamechartID diff --git a/flamechart-view.tsx b/src/views/flamechart-view.tsx similarity index 96% rename from flamechart-view.tsx rename to src/views/flamechart-view.tsx index 09dc639..9b6e98b 100644 --- a/flamechart-view.tsx +++ b/src/views/flamechart-view.tsx @@ -1,10 +1,10 @@ import {h, Component} from 'preact' import {css} from 'aphrodite' -import {CallTreeNode} from './profile' +import {CallTreeNode} from '../lib/profile' -import {Rect, Vec2, AffineTransform, clamp} from './math' -import {formatPercent} from './utils' +import {Rect, Vec2, AffineTransform, clamp} from '../lib/math' +import {formatPercent} from '../lib/utils' import {FlamechartMinimapView} from './flamechart-minimap-view' import {style} from './flamechart-style' @@ -12,7 +12,7 @@ import {Sizes, commonStyle} from './style' import {FlamechartDetailView} from './flamechart-detail-view' import {FlamechartPanZoomView} from './flamechart-pan-zoom-view' import {Hovertip} from './hovertip' -import {actions} from './app-state/actions' +import {actions} from '../store/actions' import {FlamechartViewProps} from './flamechart-view-container' interface EmptyState { diff --git a/flamechart-wrapper.tsx b/src/views/flamechart-wrapper.tsx similarity index 93% rename from flamechart-wrapper.tsx rename to src/views/flamechart-wrapper.tsx index 0748be6..cbfc7e4 100644 --- a/flamechart-wrapper.tsx +++ b/src/views/flamechart-wrapper.tsx @@ -1,14 +1,14 @@ -import {CallTreeNode} from './profile' +import {CallTreeNode} from '../lib/profile' import {StyleSheet, css} from 'aphrodite' import {h} from 'preact' import {commonStyle, Colors} from './style' -import {Rect, AffineTransform, Vec2, clamp} from './math' +import {Rect, AffineTransform, Vec2, clamp} from '../lib/math' import {FlamechartPanZoomView} from './flamechart-pan-zoom-view' -import {noop, formatPercent} from './utils' +import {noop, formatPercent} from '../lib/utils' import {Hovertip} from './hovertip' -import {actions} from './app-state/actions' +import {actions} from '../store/actions' import {FlamechartViewProps} from './flamechart-view-container' -import {StatelessComponent} from './app-state/typed-redux' +import {StatelessComponent} from '../lib/typed-redux' export class FlamechartWrapper extends StatelessComponent { private clampViewportToFlamegraph(viewportRect: Rect) { diff --git a/hovertip.tsx b/src/views/hovertip.tsx similarity index 98% rename from hovertip.tsx rename to src/views/hovertip.tsx index 9ef4f41..290e305 100644 --- a/hovertip.tsx +++ b/src/views/hovertip.tsx @@ -1,4 +1,4 @@ -import {Vec2} from './math' +import {Vec2} from '../lib/math' import {Sizes, Colors, FontSize, FontFamily, ZIndex} from './style' import {css, StyleSheet} from 'aphrodite' import {h, Component} from 'preact' diff --git a/inverted-caller-flamegraph-view.ts b/src/views/inverted-caller-flamegraph-view.ts similarity index 88% rename from inverted-caller-flamegraph-view.ts rename to src/views/inverted-caller-flamegraph-view.ts index 270ffeb..582ba6f 100644 --- a/inverted-caller-flamegraph-view.ts +++ b/src/views/inverted-caller-flamegraph-view.ts @@ -1,16 +1,16 @@ -import {memoizeByShallowEquality} from './utils' -import {Profile, Frame} from './profile' -import {Flamechart} from './flamechart' +import {memoizeByShallowEquality} from '../lib/utils' +import {Profile, Frame} from '../lib/profile' +import {Flamechart} from '../lib/flamechart' import {createMemoizedFlamechartRenderer} from './flamechart-view-container' -import {createContainer} from './app-state/typed-redux' -import {ApplicationState} from './app-state' +import {createContainer} from '../lib/typed-redux' +import {ApplicationState} from '../store' import { getCanvasContext, createGetColorBucketForFrame, createGetCSSColorForFrame, getProfileWithRecursionFlattened, -} from './app-state/getters' -import {FlamechartID} from './app-state/flamechart-view-state' +} from '../store/getters' +import {FlamechartID} from '../store/flamechart-view-state' import {FlamechartWrapper} from './flamechart-wrapper' const getInvertedCallerProfile = memoizeByShallowEquality( diff --git a/profile-table-view.tsx b/src/views/profile-table-view.tsx similarity index 96% rename from profile-table-view.tsx rename to src/views/profile-table-view.tsx index 7403eeb..0a5d837 100644 --- a/profile-table-view.tsx +++ b/src/views/profile-table-view.tsx @@ -1,14 +1,14 @@ import {h, Component} from 'preact' import {StyleSheet, css} from 'aphrodite' -import {Profile, Frame} from './profile' -import {sortBy, formatPercent} from './utils' +import {Profile, Frame} from '../lib/profile' +import {sortBy, formatPercent} from '../lib/utils' import {FontSize, Colors, Sizes, commonStyle} from './style' import {ColorChit} from './color-chit' import {ScrollableListView, ListItem} from './scrollable-list-view' -import {actions} from './app-state/actions' -import {Dispatch, createContainer} from './app-state/typed-redux' -import {ApplicationState} from './app-state' -import {createGetCSSColorForFrame} from './app-state/getters' +import {actions} from '../store/actions' +import {Dispatch, createContainer} from '../lib/typed-redux' +import {ApplicationState} from '../store' +import {createGetCSSColorForFrame} from '../store/getters' export enum SortField { SYMBOL_NAME, diff --git a/sandwich-view.tsx b/src/views/sandwich-view.tsx similarity index 94% rename from sandwich-view.tsx rename to src/views/sandwich-view.tsx index 281dea0..08a17e0 100644 --- a/sandwich-view.tsx +++ b/src/views/sandwich-view.tsx @@ -1,11 +1,11 @@ -import {Frame} from './profile' +import {Frame} from '../lib/profile' import {StyleSheet, css} from 'aphrodite' import {ProfileTableViewContainer} from './profile-table-view' import {h} from 'preact' import {commonStyle, Sizes, Colors, FontSize} from './style' -import {actions} from './app-state/actions' -import {createContainer, Dispatch, StatelessComponent} from './app-state/typed-redux' -import {ApplicationState} from './app-state' +import {actions} from '../store/actions' +import {createContainer, Dispatch, StatelessComponent} from '../lib/typed-redux' +import {ApplicationState} from '../store' import {InvertedCallerFlamegraphView} from './inverted-caller-flamegraph-view' import {CalleeFlamegraphView} from './callee-flamegraph-view' diff --git a/scrollable-list-view.tsx b/src/views/scrollable-list-view.tsx similarity index 100% rename from scrollable-list-view.tsx rename to src/views/scrollable-list-view.tsx diff --git a/style.ts b/src/views/style.ts similarity index 100% rename from style.ts rename to src/views/style.ts