Skip to content

Commit 21ab71b

Browse files
fix: ssr render err for map (#41)
* fix: ssr render err for map * chore: changeset * chore: version (beta) (#40) * build: add mako * chore: changets * chore: types for webpack-bundle-analyzer * ci: typo --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent a3f150c commit 21ab71b

15 files changed

+83
-19
lines changed

.changeset/odd-ways-draw.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@antv/gpt-vis': minor
3+
---
4+
5+
fix: ssr render err for map

.changeset/pre.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"mode": "exit",
3+
"tag": "beta",
4+
"initialVersions": {
5+
"@antv/gpt-vis": "0.2.2"
6+
},
7+
"changesets": ["odd-ways-draw"]
8+
}

.dumirc.ts

+10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineConfig } from 'dumi';
2+
import os from 'node:os';
23

34
export default defineConfig({
45
outputPath: 'docs-dist',
@@ -13,6 +14,15 @@ Powered by <a herf="https://antv.antgroup.com">AntV</a>`,
1314
github: 'https://github.com/antvis/GPT-Vis',
1415
},
1516
},
17+
// ssr:
18+
// process.env.NODE_ENV === 'production'
19+
// ? {
20+
// builder: 'mako',
21+
// }
22+
// : false,
23+
hash: true,
24+
mfsu: false,
25+
mako: ['Darwin', 'Linux'].includes(os.type()) ? {} : false,
1626
externals: {
1727
'mapbox-gl': 'window.mapboxgl',
1828
'maplibre-gl': 'window.maplibregl',

.fatherrc.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default defineConfig({
1717
},
1818
platform: 'browser',
1919
targets: {
20-
chrome: 51,
20+
chrome: 80,
2121
},
2222
externals: {
2323
lodash: '_',

.github/workflows/preview.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222
surge_token: ${{ secrets.SURGE_TOKEN }}
2323
github_token: ${{ secrets.GITHUB_TOKEN }}
2424
dist: docs-dist
25-
build: pn docs:build
25+
build: pnpm docs:build

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,5 @@ jspm_packages/
7878
# Build
7979
dist
8080
docs-dist
81+
server
8182
.dumi

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @antv/gpt-vis
22

3+
## 0.3.0-beta.0
4+
5+
### Minor Changes
6+
7+
- [`62d0c56`](https://github.com/antvis/GPT-Vis/commit/62d0c5644ed7a310de17f0accd71f4ca5d603a83) Thanks [@lvisei](https://github.com/lvisei)! - fix: ssr render err for map
8+
39
## 0.2.2
410

511
### Patch Changes

mako.config.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"optimization": {
3+
"skipModules": false,
4+
"concatenateModules": false
5+
},
6+
"codeSplitting": {
7+
"strategy": "auto"
8+
}
9+
}

package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@antv/gpt-vis",
3-
"version": "0.2.2",
3+
"version": "0.3.0-beta.0",
44
"description": "Components for GPTs, generative AI, and LLM projects. Not only UI Components.",
55
"keywords": [
66
"antv",
@@ -23,6 +23,10 @@
2323
"typings": "dist/esm/index.d.ts",
2424
"jsdelivr": "dist/umd/index.min.js",
2525
"unpkg": "dist/umd/index.min.js",
26+
"browser": {
27+
"./src/export-map.ts": "./src/export-map.browser.ts",
28+
"./dist/esm/export-map.js": "./dist/esm/export-map.browser.js"
29+
},
2630
"files": [
2731
"dist",
2832
"README.md",
@@ -70,6 +74,7 @@
7074
"@types/jest": "^29.5.14",
7175
"@types/lodash": "^4.17.13",
7276
"@types/react": "^18.0.0",
77+
"@types/webpack-bundle-analyzer": "^4.7.0",
7378
"antd": "^5.0.0",
7479
"dumi": "^2.4.13",
7580
"eslint": "^9.14.0",

src/export-map.browser.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// organize-imports-ignore
2+
export { default as Map, type MapProps } from './Map';
3+
export { default as PinMap, type PinMapProps } from './PinMap';
4+
export { default as HeatMap, type HeatMapProps } from './HeatMap';
5+
export { default as PathMap, type PathMapProps } from './PathMap';

src/export-map.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Map Components mock for use in environments without `document` / `window`, like ssr pre render
2+
import type { FC } from 'react';
3+
4+
function MockMap() {
5+
return null;
6+
}
7+
8+
import { type HeatMapProps } from './HeatMap';
9+
import { type MapProps } from './Map';
10+
import { type PathMapProps } from './PathMap';
11+
import { type PinMapProps } from './PinMap';
12+
13+
export const Map: FC<MapProps> = MockMap;
14+
export const HeatMap: FC<HeatMapProps> = MockMap;
15+
export const PathMap: FC<PathMapProps> = MockMap;
16+
export const PinMap: FC<PinMapProps> = MockMap;
17+
18+
export type { HeatMapProps, MapProps, PathMapProps, PinMapProps };

src/export.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
// organize-imports-ignore
12
import { ChartType } from './types';
23

34
/********** plot chart **********/
45
import { default as Area, type AreaProps } from './Area';
56
import { default as Bar, type BarProps } from './Bar';
67
import { default as Column, type ColumnProps } from './Column';
78
import { default as DualAxes, type DualAxesProps } from './DualAxes';
8-
import { default as HeatMap, type HeatMapProps } from './HeatMap';
99
import { default as Histogram, type HistogramProps } from './Histogram';
1010
import { default as Line, type LineProps } from './Line';
1111
import { default as Pie, type PieProps } from './Pie';
@@ -20,12 +20,18 @@ import { default as FlowDiagram, type FlowDiagramProps } from './FlowDiagram';
2020
import { default as MindMap, type MindMapProps } from './MindMap';
2121
import { default as NetworkGraph, type NetworkGraphProps } from './NetworkGraph';
2222
export { default as IndentedTree, type IndentedTreeProps } from './IndentedTree';
23-
export { default as Map, type MapProps } from './Map';
2423
export { default as OrganizationChart, type OrganizationChartProps } from './OrganizationChart';
2524

2625
/********** map chart **********/
27-
import { default as PathMap, type PathMapProps } from './PathMap';
28-
import { default as PinMap, type PinMapProps } from './PinMap';
26+
export { Map, type MapProps } from './export-map';
27+
import {
28+
PinMap,
29+
type PinMapProps,
30+
HeatMap,
31+
type HeatMapProps,
32+
PathMap,
33+
type PathMapProps,
34+
} from './export-map';
2935

3036
/********** NTV **********/
3137
export { VisText, type VisTextProps } from './Text';
@@ -77,10 +83,8 @@ export const DEFAULT_CHART_COMPONENTS: Record<string, React.FC<any>> = {
7783
[ChartType.Area]: Area,
7884
[ChartType.Scatter]: Scatter,
7985
[ChartType.PinMap]: PinMap,
80-
[ChartType.PathMap]: PathMap,
8186
[ChartType.HeatMap]: HeatMap,
8287
[ChartType.MindMap]: MindMap,
8388
[ChartType.FlowDiagram]: FlowDiagram,
8489
[ChartType.NetworkGraph]: NetworkGraph,
85-
[ChartType.FishboneDiagram]: FishboneDiagram,
8690
};

src/version.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export default '0.2.2';
1+
export default '0.3.0-beta.0';

tsconfig.eslint.json

+1-9
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,5 @@
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
44
"noEmit": true
5-
},
6-
// paths intend to lint
7-
"include": [
8-
"./*.?*.ts",
9-
"src",
10-
// test workspace lint
11-
"__tests__"
12-
],
13-
"exclude": ["node_modules", "dist"]
5+
}
146
}

tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
"@antv/gpt-vis": ["./src/index.ts"]
1515
}
1616
},
17+
"include": ["./*.?*.ts", "src", "__tests__"],
1718
"exclude": ["node_modules", "dist"]
1819
}

0 commit comments

Comments
 (0)