@devtools-ui/flame-graph 0.4.1--canary.62.3837 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # @devtools-ui/flame-graph
2
+
3
+ ## Overview
4
+
5
+ `@devtools-ui/flame-graph` is a component package designed to be leveraged by a [Player-UI assets plugin](https://player-ui.github.io/next/plugins).
6
+
7
+ It provides a `flame-graph` component for visualizing profiling data.
8
+
9
+ ## Installation
10
+
11
+ To install `@devtools-ui/flame-graph`, you can use pnpm or yarn:
12
+
13
+ ```sh
14
+ pnpm i @devtools-ui/flame-graph
15
+ ```
16
+
17
+ or
18
+
19
+ ```sh
20
+ yarn add @devtools-ui/flame-graph
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ You can leverage this asset through the `@devtools-ui/plugin`:
26
+
27
+ ```ts
28
+ import { FlameGraph } from "@devtools-ui/plugin";
29
+
30
+ // and use it to define your Player-UI content:
31
+ myFlow = {
32
+ id: "my_flow",
33
+ views: [<FlameGraph binding={b`my_binding`} height={100} width={200} />],
34
+ };
35
+ ```
36
+
37
+ For more information on how to author Player-UI content using DSL, please check our [Player-UI docs](https://player-ui.github.io/next/dsl#tsxjsx-content-authoring-player-dsl).
38
+
39
+ Or, your can leverage this asset in your own plugin:
40
+
41
+ ```ts
42
+ // TransformPlugin.ts
43
+ import type { Player, PlayerPlugin } from "@player-ui/player";
44
+ import { AssetTransformPlugin } from "@player-ui/asset-transform-plugin";
45
+ import { flameGraphTransform } from "@devtools-ui/flame-graph";
46
+
47
+ export class TransformsPlugin implements PlayerPlugin {
48
+ name = "my-plugin-transforms";
49
+
50
+ apply(player: Player) {
51
+ player.registerPlugin(
52
+ new AssetTransformPlugin([[{ type: "flame-graph" }, flameGraphTransform]])
53
+ );
54
+ }
55
+ }
56
+ ```
57
+
58
+ ```ts
59
+ // AssetRegistryPlugin.ts
60
+ import React from "react";
61
+ import type { Player } from "@player-ui/player";
62
+ import type {
63
+ ExtendedPlayerPlugin,
64
+ ReactPlayer,
65
+ ReactPlayerPlugin,
66
+ } from "@player-ui/react";
67
+ import { AssetProviderPlugin } from "@player-ui/asset-provider-plugin-react";
68
+ import { TransformsPlugin } from "./TransformPlugin";
69
+ import { FlameGraphAsset, FlameGraphComponent } from "@devtools-ui/flame-graph";
70
+
71
+ export class AssetsRegistryPlugin
72
+ implements ReactPlayerPlugin, ExtendedPlayerPlugin<[FlameGraphAsset]>
73
+ {
74
+ name = "my-plugin";
75
+
76
+ applyReact(reactPlayer: ReactPlayer) {
77
+ reactPlayer.registerPlugin(
78
+ new AssetProviderPlugin([["flame-graph", FlameGraphComponent]])
79
+ );
80
+ }
81
+
82
+ apply(player: Player) {
83
+ player.registerPlugin(new TransformsPlugin());
84
+ }
85
+ }
86
+ ```
package/package.json CHANGED
@@ -1,10 +1,15 @@
1
1
  {
2
+ "sideEffects": false,
3
+ "files": [
4
+ "dist",
5
+ "src",
6
+ "types"
7
+ ],
2
8
  "name": "@devtools-ui/flame-graph",
3
- "version": "0.4.1--canary.62.3837",
9
+ "version": "0.4.1",
4
10
  "main": "dist/cjs/index.cjs",
5
11
  "module": "dist/index.legacy-esm.js",
6
12
  "types": "types/index.d.ts",
7
- "sideEffects": false,
8
13
  "exports": {
9
14
  "./package.json": "./package.json",
10
15
  "./dist/index.css": "./dist/index.css",
@@ -14,11 +19,6 @@
14
19
  "default": "./dist/cjs/index.cjs"
15
20
  }
16
21
  },
17
- "files": [
18
- "dist",
19
- "src",
20
- "types"
21
- ],
22
22
  "dependencies": {
23
23
  "@chakra-ui/react": "^2.8.2",
24
24
  "@emotion/react": "^11.11.4",
@@ -1,5 +1,5 @@
1
1
  import type { Asset } from "@player-ui/types";
2
- export type ProfilerNode = {
2
+ export declare type ProfilerNode = {
3
3
  /** hook name */
4
4
  name: string;
5
5
  startTime?: number;