release: vite-plugin-earth@2.0.5

This commit is contained in:
小冰cc 2023-06-05 14:58:48 +08:00
parent 7956b654bd
commit 4d2294e6b2
6 changed files with 19 additions and 66 deletions

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>mars3d-vite</title>
<title>demo-mars3d</title>
<script type="module" src="/src/index.ts"></script>
</head>

View File

@ -9,12 +9,12 @@
"serve": "vite build && vite preview"
},
"devDependencies": {
"vite": "^3.0.4",
"vite": "^4.3.4",
"vite-plugin-earth": "link:.."
},
"dependencies": {
"@turf/turf": "^6.5.0",
"mars3d": "^3.5.0",
"mars3d-cesium": "^1.103.1"
"mars3d": "^3.5.4",
"mars3d-cesium": "^1.104.3"
}
}

View File

@ -8,47 +8,4 @@ import 'mars3d/dist/mars3d.css';
*
*
*/
const map = new mars3d.Map('mars3dContainer', {
scene: {
center: { lat: 30.054604, lng: 108.885436, alt: 17036414, heading: 0, pitch: -90 },
showSun: true,
showMoon: true,
showSkyBox: true,
showSkyAtmosphere: false, // 关闭球周边的白色轮廓 map.scene.skyAtmosphere = false
fog: true,
fxaa: true,
globe: {
showGroundAtmosphere: false, // 关闭大气(球表面白蒙蒙的效果)
depthTestAgainstTerrain: false,
baseColor: '#546a53'
},
cameraController: {
zoomFactor: 3.0,
minimumZoomDistance: 1,
maximumZoomDistance: 50000000,
enableRotate: true,
enableZoom: true
}
},
control: {
baseLayerPicker: true, // basemaps底图切换按钮
homeButton: true, // 视角复位按钮
sceneModePicker: true, // 二三维切换按钮
navigationHelpButton: true, // 帮助按钮
fullscreenButton: true, // 全屏按钮
contextmenu: { hasDefault: true } // 右键菜单
},
terrain: {
url: '//data.mars3d.cn/terrain',
show: true
},
basemaps: [
{
name: '天地图影像',
icon: 'img/basemaps/tdt_img.png',
type: 'tdt',
layer: 'img_d',
show: true
}
]
});
const map = new mars3d.Map('mars3dContainer', {});

View File

@ -4,8 +4,7 @@ import earth from 'vite-plugin-earth';
export default defineConfig({
plugins: [
earth({
useMars3D: true,
useCDN: { mars3d: '3.5.1' }
useMars3D: true
})
]
});

View File

@ -1,6 +1,6 @@
{
"name": "vite-plugin-earth",
"version": "2.0.4",
"version": "2.0.5",
"description": "Cesium & Mars3D library plugin for Vite",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
@ -48,13 +48,9 @@
"prettier": "^2.2.1",
"tsup": "^6.2.1",
"typescript": "^4.2.2",
"vite": "^3.0.4"
"vite": "^4.3.4"
},
"peerDependencies": {
"cesium": "^1.95.0",
"@turf/turf": "^6.5.0",
"mars3d-cesium": "^1.90.0",
"mars3d": "^3.2.0",
"vite": ">=2.7.1"
}
}

View File

@ -13,12 +13,13 @@ interface VitePluginEarthOptions {
cesiumBuildRootPath?: string;
cesiumBuildPath?: string;
useMars3D?: boolean;
useCDN?: {
useCDN?:
| {
mars3d?: string;
mars3dCesium?: string;
cesium?: string;
turf?: string;
};
}
| { cesium?: string };
}
export default function vitePluginEarth(options: VitePluginEarthOptions = {}): Plugin {
@ -27,14 +28,14 @@ export default function vitePluginEarth(options: VitePluginEarthOptions = {}): P
rebuildCesium = false,
devMinifyCesium = false,
cesiumBuildRootPath = `node_modules/${CESIUM_NAME}/Build`,
cesiumBuildPath = `node_modules/${CESIUM_NAME}/Build/Cesium/`,
cesiumBuildPath = `${cesiumBuildRootPath}/Cesium/`,
useMars3D = false,
useCDN = null
} = options;
// 默认使用的版本号
let cdnVersion = Object.assign(
{ mars3d: '3.5.0', mars3dCesium: '1.103.1', cesium: '1.103.0', turf: '6.5.0' },
{ mars3d: '3.5.0', mars3dCesium: '1.103.1', cesium: '1.105.0', turf: '6.5.0' },
useCDN
);
@ -80,7 +81,7 @@ export default function vitePluginEarth(options: VitePluginEarthOptions = {}): P
};
} else {
// build 2) copy Cesium.js later
let external = ['cesium'];
let external = [CESIUM_NAME];
let plugins = [externalGlobals({ cesium: 'Cesium' })];
if (useMars3D) {
@ -191,7 +192,7 @@ export default function vitePluginEarth(options: VitePluginEarthOptions = {}): P
tags.push({
tag: 'script',
attrs: {
src: normalizePath(path.join(CESIUM_BASE_URL, 'Cesium.js'))
src: normalizePath(path.join(base, `${CESIUM_NAME}/Cesium.js`))
}
});
}