@kylincloud/flamegraph 0.35.6 → 0.35.7

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/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@kylincloud/flamegraph",
3
- "version": "0.35.6",
3
+ "version": "0.35.7",
4
4
  "description": "KylinCloud flamegraph renderer (Pyroscope-based)",
5
5
  "license": "Apache-2.0",
6
- "main": "dist/index.cjs.js",
6
+ "main": "dist/index.node.cjs.js",
7
7
  "module": "dist/index.esm.js",
8
+ "browser": "dist/index.esm.js",
8
9
  "types": "dist/index.d.ts",
9
10
  "sideEffects": [
10
11
  "*.css",
@@ -14,10 +15,8 @@
14
15
  ".": {
15
16
  "types": "./dist/index.d.ts",
16
17
  "import": "./dist/index.esm.js",
17
- "require": "./dist/index.cjs.js"
18
- },
19
- "./dist/index.esm.css": "./dist/index.esm.css",
20
- "./dist/index.cjs.css": "./dist/index.cjs.css"
18
+ "require": "./dist/index.node.cjs.js"
19
+ }
21
20
  },
22
21
  "files": [
23
22
  "dist/**/*",
@@ -27,41 +26,37 @@
27
26
  "LICENSE",
28
27
  "package.json"
29
28
  ],
30
- "scripts": {
31
- "clean": "rm -rf dist",
32
- "build": "pnpm run clean && pnpm run build:types && pnpm run build:js",
33
- "build:types": "tsc -p tsconfig.build.json --emitDeclarationOnly",
34
- "build:js": "node scripts/build-esbuild.mjs",
35
- "type-check": "tsc -p tsconfig.build.json --noEmit",
36
- "export:vendor": "npm run build && node scripts/export-vendor.mjs",
37
- "lint": "eslint ./ --cache --fix"
38
- },
39
29
  "peerDependencies": {
30
+ "@pyroscope/models": "^0.4.7",
31
+ "graphviz-react": "^1.2.5",
40
32
  "react": ">=16.14.0",
41
- "react-dom": ">=16.14.0"
33
+ "react-dom": ">=16.14.0",
34
+ "true-myth": "^5.1.2",
35
+ "zod": "^3.11.6"
42
36
  },
43
37
  "dependencies": {
44
38
  "@fortawesome/free-solid-svg-icons": "^7.1.0",
45
39
  "@fortawesome/react-fontawesome": "^3.1.1",
46
- "@pyroscope/models": "^0.4.7",
47
40
  "@react-hook/resize-observer": "^2.0.2",
48
41
  "@szhsin/react-menu": "^4.5.1",
49
42
  "classnames": "^2.5.1",
50
43
  "clsx": "^2.1.1",
51
44
  "color": "^5.0.3",
52
45
  "d3-scale": "^4.0.2",
53
- "graphviz-react": "^1.2.5",
54
46
  "lodash.debounce": "^4.0.8",
55
47
  "lodash.groupby": "^4.6.0",
56
48
  "lodash.map": "^4.6.0",
57
49
  "react-debounce-input": "^3.3.0",
58
50
  "react-svg-spinner": "^1.0.4",
59
- "true-myth": "^5.1.2",
60
- "ts-essentials": "^10.1.1",
61
- "zod": "^3.22.4"
51
+ "ts-essentials": "^10.1.1"
62
52
  },
63
53
  "devDependencies": {
64
54
  "@fortawesome/fontawesome-common-types": "^7.1.0",
55
+ "@rollup/plugin-commonjs": "^29.0.0",
56
+ "@rollup/plugin-json": "^6.1.0",
57
+ "@rollup/plugin-node-resolve": "^16.0.3",
58
+ "@rollup/plugin-terser": "^0.4.4",
59
+ "@rollup/plugin-typescript": "^12.3.0",
65
60
  "@types/classnames": "^2.3.4",
66
61
  "@types/color": "^4.2.0",
67
62
  "@types/d3-scale": "^4.0.9",
@@ -71,14 +66,21 @@
71
66
  "@types/node": "^24.10.1",
72
67
  "@types/react": "18.2.66",
73
68
  "@types/react-dom": "18.2.22",
74
- "esbuild": "^0.27.1",
75
- "esbuild-sass-plugin": "^3.3.1",
76
69
  "eslint": "^9.0.0",
77
70
  "postcss": "^8.5.6",
78
- "postcss-modules": "^6.0.1",
79
71
  "rollup": "^4.53.3",
72
+ "rollup-plugin-postcss": "^4.0.2",
80
73
  "sass": "^1.94.2",
81
74
  "tslib": "^2.8.1",
82
75
  "typescript": "5.4.5"
76
+ },
77
+ "scripts": {
78
+ "clean": "rm -rf dist",
79
+ "build": "pnpm run clean && pnpm run build:types && pnpm run build:js && pnpm run build:assets",
80
+ "build:types": "tsc -p tsconfig.build.json --emitDeclarationOnly",
81
+ "build:js": "rollup -c",
82
+ "build:assets": "cp src/logo-v3-small.svg dist/logo-v3-small.svg || true",
83
+ "type-check": "tsc -p tsconfig.build.json --noEmit",
84
+ "lint": "eslint ./ --cache --fix"
83
85
  }
84
86
  }
package/src/index.node.ts CHANGED
@@ -1,19 +1,28 @@
1
- /* eslint-disable import/prefer-default-export */
2
- // eslint-disable-next-line import/no-extraneous-dependencies
3
- import Box from './shims/Box';
4
- import Flamegraph from './FlameGraph/FlameGraphComponent/Flamegraph';
5
- import { DefaultPalette } from './FlameGraph/FlameGraphComponent/colorPalette';
6
- import { FlamegraphRenderer } from './FlamegraphRenderer';
7
- import { convertJaegerTraceToProfile } from './convert/convertJaegerTraceToProfile';
8
- import { diffTwoProfiles } from './convert/diffTwoProfiles';
9
- import { subtract } from './convert/subtract';
1
+ // src/index.node.ts
10
2
 
3
+ // Node 入口:不引入全局样式,只导出组件和工具函数
4
+ import Box from './shims/Box'
5
+ import Flamegraph from './FlameGraph/FlameGraphComponent/Flamegraph'
6
+ import { FlamegraphRenderer } from './FlamegraphRenderer'
7
+ import { DefaultPalette } from './FlameGraph/FlameGraphComponent/colorPalette'
8
+ import { convertJaegerTraceToProfile } from './convert/convertJaegerTraceToProfile'
9
+ import { diffTwoProfiles } from './convert/diffTwoProfiles'
10
+
11
+ // ---- 对外导出 API(值) ----
11
12
  export {
12
13
  Flamegraph,
13
- DefaultPalette,
14
14
  FlamegraphRenderer,
15
15
  Box,
16
+ DefaultPalette,
16
17
  convertJaegerTraceToProfile,
17
- diffTwoProfiles,
18
- subtract,
19
- };
18
+ diffTwoProfiles
19
+ }
20
+
21
+ // ---- 对外导出 i18n 能力 ----
22
+ export {
23
+ defaultMessages as flamegraphDefaultMessages,
24
+ zhCNMessages as flamegraphZhCNMessages,
25
+ FlamegraphI18nProvider
26
+ } from './i18n'
27
+
28
+ export type { FlamegraphMessages } from './i18n'
package/src/index.tsx CHANGED
@@ -1,10 +1,36 @@
1
1
  // src/index.tsx
2
2
 
3
- // 主渲染组件
4
- export { default as FlamegraphRenderer } from './FlameGraph/FlameGraphRenderer';
3
+ // 把全局样式纳入构建流程:使用方只要 import 本库,就会自动注入样式
4
+ import './sass/flamegraph.scss'
5
5
 
6
- // 容器组件
7
- export { default as Box } from './shims/Box';
6
+ // 基础 UI 组件 & 渲染器
7
+ import Box from './shims/Box'
8
+ import Flamegraph from './FlameGraph/FlameGraphComponent/Flamegraph'
9
+ import { FlamegraphRenderer } from './FlamegraphRenderer'
10
+ import { DefaultPalette } from './FlameGraph/FlameGraphComponent/colorPalette'
8
11
 
9
- // i18n(包含 flamegraphZhCNMessages 等)
10
- export * from './i18n';
12
+ // 数据转换工具
13
+ import { convertJaegerTraceToProfile } from './convert/convertJaegerTraceToProfile'
14
+ import { diffTwoProfiles } from './convert/diffTwoProfiles'
15
+
16
+ // ---- 对外导出 API(值) ----
17
+ export {
18
+ // 组件
19
+ Flamegraph,
20
+ FlamegraphRenderer,
21
+ Box,
22
+ DefaultPalette,
23
+ // 工具函数
24
+ convertJaegerTraceToProfile,
25
+ diffTwoProfiles
26
+ }
27
+
28
+ // ---- 对外导出 i18n 能力 ----
29
+ export {
30
+ defaultMessages as flamegraphDefaultMessages,
31
+ zhCNMessages as flamegraphZhCNMessages,
32
+ FlamegraphI18nProvider
33
+ } from './i18n'
34
+
35
+ // 只导出类型(不会出现在 JS 里)
36
+ export type { FlamegraphMessages } from './i18n'