Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ssr render err for map #41

Merged
merged 7 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/odd-ways-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@antv/gpt-vis': minor
---

fix: ssr render err for map
8 changes: 8 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mode": "exit",
"tag": "beta",
"initialVersions": {
"@antv/gpt-vis": "0.2.2"
},
"changesets": ["odd-ways-draw"]
}
10 changes: 10 additions & 0 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from 'dumi';
import os from 'node:os';

export default defineConfig({
outputPath: 'docs-dist',
Expand All @@ -13,6 +14,15 @@ Powered by <a herf="https://antv.antgroup.com">AntV</a>`,
github: 'https://github.com/antvis/GPT-Vis',
},
},
// ssr:
// process.env.NODE_ENV === 'production'
// ? {
// builder: 'mako',
// }
// : false,
hash: true,
mfsu: false,
mako: ['Darwin', 'Linux'].includes(os.type()) ? {} : false,
externals: {
'mapbox-gl': 'window.mapboxgl',
'maplibre-gl': 'window.maplibregl',
Expand Down
2 changes: 1 addition & 1 deletion .fatherrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default defineConfig({
},
platform: 'browser',
targets: {
chrome: 51,
chrome: 80,
},
externals: {
lodash: '_',
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
surge_token: ${{ secrets.SURGE_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dist: docs-dist
build: pn docs:build
build: pnpm docs:build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,5 @@ jspm_packages/
# Build
dist
docs-dist
server
.dumi
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @antv/gpt-vis

## 0.3.0-beta.0

### Minor Changes

- [`62d0c56`](https://github.com/antvis/GPT-Vis/commit/62d0c5644ed7a310de17f0accd71f4ca5d603a83) Thanks [@lvisei](https://github.com/lvisei)! - fix: ssr render err for map

## 0.2.2

### Patch Changes
Expand Down
9 changes: 9 additions & 0 deletions mako.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"optimization": {
"skipModules": false,
"concatenateModules": false
},
"codeSplitting": {
"strategy": "auto"
}
}
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/gpt-vis",
"version": "0.2.2",
"version": "0.3.0-beta.0",
"description": "Components for GPTs, generative AI, and LLM projects. Not only UI Components.",
"keywords": [
"antv",
Expand All @@ -23,6 +23,10 @@
"typings": "dist/esm/index.d.ts",
"jsdelivr": "dist/umd/index.min.js",
"unpkg": "dist/umd/index.min.js",
"browser": {
"./src/export-map.ts": "./src/export-map.browser.ts",
"./dist/esm/export-map.js": "./dist/esm/export-map.browser.js"
},
"files": [
"dist",
"README.md",
Expand Down Expand Up @@ -70,6 +74,7 @@
"@types/jest": "^29.5.14",
"@types/lodash": "^4.17.13",
"@types/react": "^18.0.0",
"@types/webpack-bundle-analyzer": "^4.7.0",
"antd": "^5.0.0",
"dumi": "^2.4.13",
"eslint": "^9.14.0",
Expand Down
5 changes: 5 additions & 0 deletions src/export-map.browser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// organize-imports-ignore
export { default as Map, type MapProps } from './Map';
export { default as PinMap, type PinMapProps } from './PinMap';
export { default as HeatMap, type HeatMapProps } from './HeatMap';
export { default as PathMap, type PathMapProps } from './PathMap';
18 changes: 18 additions & 0 deletions src/export-map.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Map Components mock for use in environments without `document` / `window`, like ssr pre render
import type { FC } from 'react';

function MockMap() {
return null;
}

import { type HeatMapProps } from './HeatMap';
import { type MapProps } from './Map';
import { type PathMapProps } from './PathMap';
import { type PinMapProps } from './PinMap';

export const Map: FC<MapProps> = MockMap;
export const HeatMap: FC<HeatMapProps> = MockMap;
export const PathMap: FC<PathMapProps> = MockMap;
export const PinMap: FC<PinMapProps> = MockMap;

export type { HeatMapProps, MapProps, PathMapProps, PinMapProps };
16 changes: 10 additions & 6 deletions src/export.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// organize-imports-ignore
import { ChartType } from './types';

/********** plot chart **********/
import { default as Area, type AreaProps } from './Area';
import { default as Bar, type BarProps } from './Bar';
import { default as Column, type ColumnProps } from './Column';
import { default as DualAxes, type DualAxesProps } from './DualAxes';
import { default as HeatMap, type HeatMapProps } from './HeatMap';
import { default as Histogram, type HistogramProps } from './Histogram';
import { default as Line, type LineProps } from './Line';
import { default as Pie, type PieProps } from './Pie';
Expand All @@ -20,12 +20,18 @@ import { default as FlowDiagram, type FlowDiagramProps } from './FlowDiagram';
import { default as MindMap, type MindMapProps } from './MindMap';
import { default as NetworkGraph, type NetworkGraphProps } from './NetworkGraph';
export { default as IndentedTree, type IndentedTreeProps } from './IndentedTree';
export { default as Map, type MapProps } from './Map';
export { default as OrganizationChart, type OrganizationChartProps } from './OrganizationChart';

/********** map chart **********/
import { default as PathMap, type PathMapProps } from './PathMap';
import { default as PinMap, type PinMapProps } from './PinMap';
export { Map, type MapProps } from './export-map';
import {
PinMap,
type PinMapProps,
HeatMap,
type HeatMapProps,
PathMap,
type PathMapProps,
} from './export-map';

/********** NTV **********/
export { VisText, type VisTextProps } from './Text';
Expand Down Expand Up @@ -77,10 +83,8 @@ export const DEFAULT_CHART_COMPONENTS: Record<string, React.FC<any>> = {
[ChartType.Area]: Area,
[ChartType.Scatter]: Scatter,
[ChartType.PinMap]: PinMap,
[ChartType.PathMap]: PathMap,
[ChartType.HeatMap]: HeatMap,
[ChartType.MindMap]: MindMap,
[ChartType.FlowDiagram]: FlowDiagram,
[ChartType.NetworkGraph]: NetworkGraph,
[ChartType.FishboneDiagram]: FishboneDiagram,
};
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default '0.2.2';
export default '0.3.0-beta.0';
10 changes: 1 addition & 9 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,5 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": true
},
// paths intend to lint
"include": [
"./*.?*.ts",
"src",
// test workspace lint
"__tests__"
],
"exclude": ["node_modules", "dist"]
}
}
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
"@antv/gpt-vis": ["./src/index.ts"]
}
},
"include": ["./*.?*.ts", "src", "__tests__"],
"exclude": ["node_modules", "dist"]
}
Loading