1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

10 Commits

Author SHA1 Message Date
0bcd60de30 release v2.0.3 2025-06-12 15:45:17 +08:00
15889989d0 chore: update README.md 2025-06-12 15:42:51 +08:00
9fa52eaa15 Old README.md 独立出来 2025-06-12 15:41:59 +08:00
bdd972f2ea vite.config.js -> vite.config.ts 2025-06-12 15:39:15 +08:00
5d12bd51e2 release v2.0.2 2025-06-12 15:27:24 +08:00
486e3e839f 更新 README.md 完善 Usage 部分 2025-06-12 15:26:49 +08:00
d013dbe3ec 更新 README.md 2025-06-12 07:41:03 +08:00
52c6655b7a release 2.0.1 2025-06-12 07:20:48 +08:00
266517ac08 chore: 升级 GitHub Action 文件相关依赖版本 2025-06-12 07:19:01 +08:00
d32625d649 chore: 移除 package-lock.json,避免影响 GitHub Action CI 流程 (yarn) 2025-06-12 07:12:29 +08:00
11 changed files with 260 additions and 3688 deletions

View File

@@ -12,11 +12,11 @@ jobs:
name: 'Build-Test'
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '22'
- name: Install Deps
run: yarn install
- name: Build
@@ -27,18 +27,18 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node_version: ['16']
node_version: ['22']
include:
- os: macos-latest
node_version: 16
node_version: 22
- os: windows-latest
node_version: 16
node_version: 22
name: 'Demo-Build-Test: node-${{ matrix.node_version }}, ${{ matrix.os }}'
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
- name: Package Install deps

View File

@@ -7,15 +7,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies and build
run: npm install && npm run build
- name: Publish package on NPM
- name: Publish package on NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

1
.gitignore vendored
View File

@@ -4,3 +4,4 @@ dist
demo/public
yarn.lock
pnpm-lock.yaml
package-lock.json

19
.publish.md Normal file
View File

@@ -0,0 +1,19 @@
## 发包步骤
https://www.npmjs.com/package/vite-plugin-cesium-next
```sh
# nrm use npm
# npm adduser
npm publish
# nrm use taobao
```
然后去 npmmirror 镜像源站点击同步一下
https://npmmirror.com/package/vite-plugin-cesium-next
## 撤包步骤
```
npm unpublish vite-plugin-cesium-next@<version> --force
```

136
README-old.md Normal file
View File

@@ -0,0 +1,136 @@
# ⚡ vite-plugin-cesium
[![npm](https://img.shields.io/npm/v/vite-plugin-cesium.svg)](https://www.npmjs.com/package/vite-plugin-cesium)
[![npm](https://img.shields.io/npm/dt/vite-plugin-cesium)](https://www.npmjs.com/package/vite-plugin-cesium)
Easily set up a [`Cesium`] project in [`Vite`].
[`cesium`]: https://github.com/CesiumGS/cesium
[`vite`]: https://github.com/vitejs/vite
**update** if you just wanna a scaffolding by using this plugin, try a simply command `yarn create cesium`, click [create-cesium](https://www.npmjs.com/package/create-cesium) for more info.
Chinese tutorial: [中文教程](https://zhuanlan.zhihu.com/p/354856692)
## Install
```bash
npm i cesium vite-plugin-cesium vite -D
# yarn add cesium vite-plugin-cesium vite -D
```
## Usage
add this plugin to `vite.config.js`
```js
import { defineConfig } from 'vite';
import cesium from 'vite-plugin-cesium';
export default defineConfig({
plugins: [cesium()]
});
```
add dev command to `package.json`
```json
"scripts": {
"dev": "vite",
"build": "vite build"
}
```
run:
`yarn dev`
## Options
**rebuildCesium**
- **Type :** `boolean`
- **Default :** `false`
Default copy min cesium file to dist. if `true` will rebuild cesium from source.
```js
import { defineConfig } from 'vite';
import cesium from 'vite-plugin-cesium';
export default defineConfig({
plugins: [
cesium({
rebuildCesium: true
})
]
});
```
## Demo
`src/index.js`
```js
import { Viewer } from 'cesium';
import './css/main.css';
const viewer = new Viewer('cesiumContainer');
```
> or if you like global Cesium object you can write as
```js
import * as Cesium from 'cesium';
const viewer = new Cesium.Viewer('cesiumContainer');
```
`index.html`
```html
<!DOCTYPE html>
<html lang="en">
<head>
<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>cesium-vite</title>
<script type="module" src="/src/index.js"></script>
</head>
<body>
<div id="cesiumContainer"></div>
</body>
</html>
```
`src/css/main.css`
```css
html,
body,
#cesiumContainer {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
```
Add `dev` and `build` commands to `package.json`
```
"scripts": {
"dev": "vite",
"build": "vite build"
},
```
Run `yarn dev`
For full demo project please check [./demo](https://github.com/nshen/vite-plugin-cesium/tree/main/demo) folder.
##
## License
MIT

201
README.md
View File

@@ -3,174 +3,79 @@
> 本仓库 fork 自 [nshen/vite-plugin-cesium](https://github.com/nshen/vite-plugin-cesium)
本仓库在原仓库代码基础上,主要针对性修复/优化了以下问题
- 相对路径问题:本仓库已支持在 vite.config.ts 中配置以下类型的 base: `'./'`, `'/'`, `'/foo/bar'`, `''`, `(不设置)` (新创建的项目 base 默认为 `'./'`,而原仓库针对 `'./'` 没有做很好的处理)
- 资源请求路径:当 base 形如 `'/foo/bar'`cesium 静态文件由 `/cesium...` 改为请求 `/foo/bar/cesium...`
鉴于原仓库作者可能不再维护此项目(详见:[issue](https://github.com/nshen/vite-plugin-cesium/issues/62#issuecomment-2957419669)),故 fork 本仓库 ([coder-xiaomo/vite-plugin-cesium-next](https://github.com/coder-xiaomo/vite-plugin-cesium-next)) 继续维护,欢迎提交 Issue / Pr
鉴于原仓库作者可能不再维护此项目(详见:[issue](https://github.com/nshen/vite-plugin-cesium/issues/62#issuecomment-2957419669)),故 fork 本仓库 ([coder-xiaomo/vite-plugin-cesium-next](https://github.com/coder-xiaomo/vite-plugin-cesium-next)) 继续维护,欢迎提交 Issue / Pr
## Install
```bash
npm i cesium vite-plugin-cesium-text vite -D
# yarn add cesium vite-plugin-cesium-text vite -D
# 记得安装 cesium 依赖哦
npm i vite-plugin-cesium-next -D
# yarn add vite-plugin-cesium-text -D
```
## Usage
add this plugin to `vite.config.js`
add this plugin to `vite.config.ts`
```js
import { defineConfig } from 'vite';
import cesium from 'vite-plugin-cesium-next'; // 👈 添加这一行
export default defineConfig({
// ...
plugins: [
// ...
cesium(), // 👈 添加这一行
// 👇 添加这一行
// usage: https://github.com/coder-xiaomo/vite-plugin-cesium-next#usage
cesium(),
// 或者如果你需要自定义配置,可以这样写 👇
// cesium({ /* 这里可以添加配置 */ }),
]
});
```
---
以下是原仓库 README
# ⚡ vite-plugin-cesium
[![npm](https://img.shields.io/npm/v/vite-plugin-cesium.svg)](https://www.npmjs.com/package/vite-plugin-cesium)
[![npm](https://img.shields.io/npm/dt/vite-plugin-cesium)](https://www.npmjs.com/package/vite-plugin-cesium)
Easily set up a [`Cesium`] project in [`Vite`].
[`cesium`]: https://github.com/CesiumGS/cesium
[`vite`]: https://github.com/vitejs/vite
**update** if you just wanna a scaffolding by using this plugin, try a simply command `yarn create cesium`, click [create-cesium](https://www.npmjs.com/package/create-cesium) for more info.
Chinese tutorial: [中文教程](https://zhuanlan.zhihu.com/p/354856692)
## Install
```bash
npm i cesium vite-plugin-cesium vite -D
# yarn add cesium vite-plugin-cesium vite -D
```
## Usage
add this plugin to `vite.config.js`
```js
import { defineConfig } from 'vite';
import cesium from 'vite-plugin-cesium';
export default defineConfig({
plugins: [cesium()]
});
```
add dev command to `package.json`
```json
"scripts": {
"dev": "vite",
"build": "vite build"
}
```
run:
`yarn dev`
## Options
**rebuildCesium**
- **Type :** `boolean`
- **Default :** `false`
Default copy min cesium file to dist. if `true` will rebuild cesium from source.
```js
import { defineConfig } from 'vite';
import cesium from 'vite-plugin-cesium';
export default defineConfig({
plugins: [
cesium({
rebuildCesium: true
})
]
/* 这里可以添加自定义配置 */
/**
* 以下情况需要配置 `viteBase: '/'`
* 如果你的 baseUrl 是 './', 同时使用了 vue-router 的 history 模式路由
* 当存在二级或以上路由时, 相对路径获取 Cesium 静态资源会找不到
* 此时请将这里 viteBase 请配置为 '/'
*
* 以下情况可不配置 viteBase:
* 如果 baseUrl 是 / 开头的, 可不配置 viteBase, 插件会自动获取 vite.config.ts 内 base 配置
* 如果 vue-router 使用的是 hash 模式路由 (形如: `#/foo/bar`), 不影响静态资源地址, 可不配置 viteBase
* 如果 vue-router 使用的是 history 模式路由, 使用 Cesium 的所有页面:
* - 若只有一级路由 (形如: `/foo`), 不需要配置 viteBase
* - 若存在多级路由 (形如: `/foo/bar`), ⚠需要配置 viteBase
*
* default: 自动获取
*/
viteBase: '/', // type: string
/**
* rebuild cesium library
*/
rebuildCesium: false, // type: boolean
/**
*/
devMinifyCesium: false, // type: boolean
/**
*/
cesiumBuildRootPath: 'node_modules/cesium/Build', // type: string
/**
*/
cesiumBuildPath: 'node_modules/cesium/Build/Cesium/', // type: string
/**
*/
cesiumBaseUrl: 'cesium/', // type: string
}),
],
});
```
## Demo
`src/index.js`
```js
import { Viewer } from 'cesium';
import './css/main.css';
const viewer = new Viewer('cesiumContainer');
```
> or if you like global Cesium object you can write as
```js
import * as Cesium from 'cesium';
const viewer = new Cesium.Viewer('cesiumContainer');
```
`index.html`
```html
<!DOCTYPE html>
<html lang="en">
<head>
<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>cesium-vite</title>
<script type="module" src="/src/index.js"></script>
</head>
<body>
<div id="cesiumContainer"></div>
</body>
</html>
```
`src/css/main.css`
```css
html,
body,
#cesiumContainer {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
```
Add `dev` and `build` commands to `package.json`
```
"scripts": {
"dev": "vite",
"build": "vite build"
},
```
Run `yarn dev`
For full demo project please check [./demo](https://github.com/nshen/vite-plugin-cesium/tree/main/demo) folder.
##
## License
MIT

499
demo/package-lock.json generated
View File

@@ -1,499 +0,0 @@
{
"name": "cesium-demo",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cesium-demo",
"version": "1.0.0",
"license": "MIT",
"devDependencies": {
"cesium": "1.129.0",
"vite": "file:../node_modules/vite",
"vite-plugin-cesium-next": "file:.."
}
},
"..": {
"version": "2.0.0",
"dev": true,
"license": "MIT",
"dependencies": {
"fs-extra": "^11.3.0",
"rollup-plugin-external-globals": "^0.6.1",
"serve-static": "^1.16.2"
},
"devDependencies": {
"@tsconfig/node22": "^22.0.2",
"@types/fs-extra": "^11.0.4",
"@types/node": "^22.15.31",
"@types/serve-static": "^1.15.8",
"prettier": "^3.5.3",
"tsup": "^8.5.0",
"typescript": "^5.8.3",
"vite": "^6.1.0"
},
"peerDependencies": {
"cesium": "^1.95.0",
"vite": ">=6.0.0"
}
},
"../node_modules/vite": {
"version": "6.3.5",
"dev": true,
"license": "MIT",
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.4.4",
"picomatch": "^4.0.2",
"postcss": "^8.5.3",
"rollup": "^4.34.9",
"tinyglobby": "^0.2.13"
},
"bin": {
"vite": "bin/vite.js"
},
"engines": {
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
},
"funding": {
"url": "https://github.com/vitejs/vite?sponsor=1"
},
"optionalDependencies": {
"fsevents": "~2.3.3"
},
"peerDependencies": {
"@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
"jiti": ">=1.21.0",
"less": "*",
"lightningcss": "^1.21.0",
"sass": "*",
"sass-embedded": "*",
"stylus": "*",
"sugarss": "*",
"terser": "^5.16.0",
"tsx": "^4.8.1",
"yaml": "^2.4.2"
},
"peerDependenciesMeta": {
"@types/node": {
"optional": true
},
"jiti": {
"optional": true
},
"less": {
"optional": true
},
"lightningcss": {
"optional": true
},
"sass": {
"optional": true
},
"sass-embedded": {
"optional": true
},
"stylus": {
"optional": true
},
"sugarss": {
"optional": true
},
"terser": {
"optional": true
},
"tsx": {
"optional": true
},
"yaml": {
"optional": true
}
}
},
"node_modules/@cesium/engine": {
"version": "17.0.0",
"resolved": "https://registry.npmmirror.com/@cesium/engine/-/engine-17.0.0.tgz",
"integrity": "sha512-bvLWmWVY4QX9rfcx/zfBzA8R1xR8KzmaCDOVL6pFkNZeYmRtt8JN//IICYR3P45lznlcb0Dklw1iCb37t4tvLA==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@tweenjs/tween.js": "^25.0.0",
"@zip.js/zip.js": "^2.7.34",
"autolinker": "^4.0.0",
"bitmap-sdf": "^1.0.3",
"dompurify": "^3.0.2",
"draco3d": "^1.5.1",
"earcut": "^3.0.0",
"grapheme-splitter": "^1.0.4",
"jsep": "^1.3.8",
"kdbush": "^4.0.1",
"ktx-parse": "^1.0.0",
"lerc": "^2.0.0",
"mersenne-twister": "^1.1.0",
"meshoptimizer": "^0.23.0",
"pako": "^2.0.4",
"protobufjs": "^7.1.0",
"rbush": "3.0.1",
"topojson-client": "^3.1.0",
"urijs": "^1.19.7"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@cesium/widgets": {
"version": "12.0.0",
"resolved": "https://registry.npmmirror.com/@cesium/widgets/-/widgets-12.0.0.tgz",
"integrity": "sha512-5Re06LU8lRPEZInHrpOCGBiLoj9VNJ0JJtPrzdnw1qhIDpf3v1W75OJf59k8CCFvUYkZzuTTi8qTVbpzmcbOuw==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@cesium/engine": "^17.0.0",
"nosleep.js": "^0.12.0"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@protobufjs/aspromise": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
"integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==",
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/base64": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/@protobufjs/base64/-/base64-1.1.2.tgz",
"integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==",
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/codegen": {
"version": "2.0.4",
"resolved": "https://registry.npmmirror.com/@protobufjs/codegen/-/codegen-2.0.4.tgz",
"integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==",
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/eventemitter": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
"integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==",
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/fetch": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/@protobufjs/fetch/-/fetch-1.1.0.tgz",
"integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
"@protobufjs/aspromise": "^1.1.1",
"@protobufjs/inquire": "^1.1.0"
}
},
"node_modules/@protobufjs/float": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/@protobufjs/float/-/float-1.0.2.tgz",
"integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==",
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/inquire": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/@protobufjs/inquire/-/inquire-1.1.0.tgz",
"integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==",
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/path": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/@protobufjs/path/-/path-1.1.2.tgz",
"integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==",
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/pool": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/@protobufjs/pool/-/pool-1.1.0.tgz",
"integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==",
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/utf8": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/@protobufjs/utf8/-/utf8-1.1.0.tgz",
"integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==",
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/@tweenjs/tween.js": {
"version": "25.0.0",
"resolved": "https://registry.npmmirror.com/@tweenjs/tween.js/-/tween.js-25.0.0.tgz",
"integrity": "sha512-XKLA6syeBUaPzx4j3qwMqzzq+V4uo72BnlbOjmuljLrRqdsd3qnzvZZoxvMHZ23ndsRS4aufU6JOZYpCbU6T1A==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/node": {
"version": "24.0.0",
"resolved": "https://registry.npmmirror.com/@types/node/-/node-24.0.0.tgz",
"integrity": "sha512-yZQa2zm87aRVcqDyH5+4Hv9KYgSdgwX1rFnGvpbzMaC7YAljmhBET93TPiTd3ObwTL+gSpIzPKg5BqVxdCvxKg==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~7.8.0"
}
},
"node_modules/@types/trusted-types": {
"version": "2.0.7",
"resolved": "https://registry.npmmirror.com/@types/trusted-types/-/trusted-types-2.0.7.tgz",
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
"dev": true,
"license": "MIT",
"optional": true
},
"node_modules/@zip.js/zip.js": {
"version": "2.7.62",
"resolved": "https://registry.npmmirror.com/@zip.js/zip.js/-/zip.js-2.7.62.tgz",
"integrity": "sha512-OaLvZ8j4gCkLn048ypkZu29KX30r8/OfFF2w4Jo5WXFr+J04J+lzJ5TKZBVgFXhlvSkqNFQdfnY1Q8TMTCyBVA==",
"dev": true,
"license": "BSD-3-Clause",
"engines": {
"bun": ">=0.7.0",
"deno": ">=1.0.0",
"node": ">=16.5.0"
}
},
"node_modules/autolinker": {
"version": "4.1.5",
"resolved": "https://registry.npmmirror.com/autolinker/-/autolinker-4.1.5.tgz",
"integrity": "sha512-vEfYZPmvVOIuE567XBVCsx8SBgOYtjB2+S1iAaJ+HgH+DNjAcrHem2hmAeC9yaNGWayicv4yR+9UaJlkF3pvtw==",
"dev": true,
"license": "MIT",
"dependencies": {
"tslib": "^2.8.1"
},
"engines": {
"pnpm": ">=10.10.0"
}
},
"node_modules/bitmap-sdf": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/bitmap-sdf/-/bitmap-sdf-1.0.4.tgz",
"integrity": "sha512-1G3U4n5JE6RAiALMxu0p1XmeZkTeCwGKykzsLTCqVzfSDaN6S7fKnkIkfejogz+iwqBWc0UYAIKnKHNN7pSfDg==",
"dev": true,
"license": "MIT"
},
"node_modules/cesium": {
"version": "1.129.0",
"resolved": "https://registry.npmmirror.com/cesium/-/cesium-1.129.0.tgz",
"integrity": "sha512-XDEJKLnr8s5/Q/1wcdZVEJCgx+xbgfDzkVKd9OxRZzYttazip6KffusMHexRdExVMPfDcTohuqcuHNxj9CUNFA==",
"dev": true,
"license": "Apache-2.0",
"workspaces": [
"packages/engine",
"packages/widgets"
],
"dependencies": {
"@cesium/engine": "^17.0.0",
"@cesium/widgets": "^12.0.0"
},
"engines": {
"node": ">=18.18.0"
}
},
"node_modules/commander": {
"version": "2.20.3",
"resolved": "https://registry.npmmirror.com/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true,
"license": "MIT"
},
"node_modules/dompurify": {
"version": "3.2.6",
"resolved": "https://registry.npmmirror.com/dompurify/-/dompurify-3.2.6.tgz",
"integrity": "sha512-/2GogDQlohXPZe6D6NOgQvXLPSYBqIWMnZ8zzOhn09REE4eyAzb+Hed3jhoM9OkuaJ8P6ZGTTVWQKAi8ieIzfQ==",
"dev": true,
"license": "(MPL-2.0 OR Apache-2.0)",
"optionalDependencies": {
"@types/trusted-types": "^2.0.7"
}
},
"node_modules/draco3d": {
"version": "1.5.7",
"resolved": "https://registry.npmmirror.com/draco3d/-/draco3d-1.5.7.tgz",
"integrity": "sha512-m6WCKt/erDXcw+70IJXnG7M3awwQPAsZvJGX5zY7beBqpELw6RDGkYVU0W43AFxye4pDZ5i2Lbyc/NNGqwjUVQ==",
"dev": true,
"license": "Apache-2.0"
},
"node_modules/earcut": {
"version": "3.0.1",
"resolved": "https://registry.npmmirror.com/earcut/-/earcut-3.0.1.tgz",
"integrity": "sha512-0l1/0gOjESMeQyYaK5IDiPNvFeu93Z/cO0TjZh9eZ1vyCtZnA7KMZ8rQggpsJHIbGSdrqYq9OhuveadOVHCshw==",
"dev": true,
"license": "ISC"
},
"node_modules/grapheme-splitter": {
"version": "1.0.4",
"resolved": "https://registry.npmmirror.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz",
"integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==",
"dev": true,
"license": "MIT"
},
"node_modules/jsep": {
"version": "1.4.0",
"resolved": "https://registry.npmmirror.com/jsep/-/jsep-1.4.0.tgz",
"integrity": "sha512-B7qPcEVE3NVkmSJbaYxvv4cHkVW7DQsZz13pUMrfS8z8Q/BuShN+gcTXrUlPiGqM2/t/EEaI030bpxMqY8gMlw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 10.16.0"
}
},
"node_modules/kdbush": {
"version": "4.0.2",
"resolved": "https://registry.npmmirror.com/kdbush/-/kdbush-4.0.2.tgz",
"integrity": "sha512-WbCVYJ27Sz8zi9Q7Q0xHC+05iwkm3Znipc2XTlrnJbsHMYktW4hPhXUE8Ys1engBrvffoSCqbil1JQAa7clRpA==",
"dev": true,
"license": "ISC"
},
"node_modules/ktx-parse": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/ktx-parse/-/ktx-parse-1.0.0.tgz",
"integrity": "sha512-Z31kVizz4DF/6vo9YiSYVBhuXAfyQy9bGxlW3+mB5OELoZjfXVZQpRoctsx8IEDKxBd6SagXKo7qRvu38i8Jfg==",
"dev": true,
"license": "MIT"
},
"node_modules/lerc": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/lerc/-/lerc-2.0.0.tgz",
"integrity": "sha512-7qo1Mq8ZNmaR4USHHm615nEW2lPeeWJ3bTyoqFbd35DLx0LUH7C6ptt5FDCTAlbIzs3+WKrk5SkJvw8AFDE2hg==",
"dev": true,
"license": "Apache-2.0"
},
"node_modules/long": {
"version": "5.3.2",
"resolved": "https://registry.npmmirror.com/long/-/long-5.3.2.tgz",
"integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==",
"dev": true,
"license": "Apache-2.0"
},
"node_modules/mersenne-twister": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/mersenne-twister/-/mersenne-twister-1.1.0.tgz",
"integrity": "sha512-mUYWsMKNrm4lfygPkL3OfGzOPTR2DBlTkBNHM//F6hGp8cLThY897crAlk3/Jo17LEOOjQUrNAx6DvgO77QJkA==",
"dev": true,
"license": "MIT"
},
"node_modules/meshoptimizer": {
"version": "0.23.0",
"resolved": "https://registry.npmmirror.com/meshoptimizer/-/meshoptimizer-0.23.0.tgz",
"integrity": "sha512-zAZcfhHE3wBbwEN8MfCMI9PKRyOpz8491wcR2dxkv3IlNwDZrq2hEs5JZVtzfBrmjWhBZZtZZUO0OBSNFq5iUQ==",
"dev": true,
"license": "MIT"
},
"node_modules/nosleep.js": {
"version": "0.12.0",
"resolved": "https://registry.npmmirror.com/nosleep.js/-/nosleep.js-0.12.0.tgz",
"integrity": "sha512-9d1HbpKLh3sdWlhXMhU6MMH+wQzKkrgfRkYV0EBdvt99YJfj0ilCJrWRDYG2130Tm4GXbEoTCx5b34JSaP+HhA==",
"dev": true,
"license": "MIT"
},
"node_modules/pako": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/pako/-/pako-2.1.0.tgz",
"integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==",
"dev": true,
"license": "(MIT AND Zlib)"
},
"node_modules/protobufjs": {
"version": "7.5.3",
"resolved": "https://registry.npmmirror.com/protobufjs/-/protobufjs-7.5.3.tgz",
"integrity": "sha512-sildjKwVqOI2kmFDiXQ6aEB0fjYTafpEvIBs8tOR8qI4spuL9OPROLVu2qZqi/xgCfsHIwVqlaF8JBjWFHnKbw==",
"dev": true,
"hasInstallScript": true,
"license": "BSD-3-Clause",
"dependencies": {
"@protobufjs/aspromise": "^1.1.2",
"@protobufjs/base64": "^1.1.2",
"@protobufjs/codegen": "^2.0.4",
"@protobufjs/eventemitter": "^1.1.0",
"@protobufjs/fetch": "^1.1.0",
"@protobufjs/float": "^1.0.2",
"@protobufjs/inquire": "^1.1.0",
"@protobufjs/path": "^1.1.2",
"@protobufjs/pool": "^1.1.0",
"@protobufjs/utf8": "^1.1.0",
"@types/node": ">=13.7.0",
"long": "^5.0.0"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/quickselect": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/quickselect/-/quickselect-2.0.0.tgz",
"integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==",
"dev": true,
"license": "ISC"
},
"node_modules/rbush": {
"version": "3.0.1",
"resolved": "https://registry.npmmirror.com/rbush/-/rbush-3.0.1.tgz",
"integrity": "sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==",
"dev": true,
"license": "MIT",
"dependencies": {
"quickselect": "^2.0.0"
}
},
"node_modules/topojson-client": {
"version": "3.1.0",
"resolved": "https://registry.npmmirror.com/topojson-client/-/topojson-client-3.1.0.tgz",
"integrity": "sha512-605uxS6bcYxGXw9qi62XyrV6Q3xwbndjachmNxu8HWTtVPxZfEJN9fd/SZS1Q54Sn2y0TMyMxFj/cJINqGHrKw==",
"dev": true,
"license": "ISC",
"dependencies": {
"commander": "2"
},
"bin": {
"topo2geo": "bin/topo2geo",
"topomerge": "bin/topomerge",
"topoquantize": "bin/topoquantize"
}
},
"node_modules/tslib": {
"version": "2.8.1",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"dev": true,
"license": "0BSD"
},
"node_modules/undici-types": {
"version": "7.8.0",
"resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-7.8.0.tgz",
"integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
"dev": true,
"license": "MIT"
},
"node_modules/urijs": {
"version": "1.19.11",
"resolved": "https://registry.npmmirror.com/urijs/-/urijs-1.19.11.tgz",
"integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==",
"dev": true,
"license": "MIT"
},
"node_modules/vite": {
"resolved": "../node_modules/vite",
"link": true
},
"node_modules/vite-plugin-cesium-next": {
"resolved": "..",
"link": true
}
}
}

3019
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "vite-plugin-cesium-next",
"version": "2.0.0",
"version": "2.0.3",
"description": "Cesium library plugin for Vite",
"main": "./dist/index.js",
"module": "./dist/index.mjs",

View File

@@ -6,24 +6,59 @@ import { HtmlTagDescriptor, normalizePath, Plugin, UserConfig } from 'vite';
interface VitePluginCesiumOptions {
/**
* rebuild cesium library, default: false
* 以下情况需要配置 `viteBase: '/'`
* 如果你的 baseUrl 是 './', 同时使用了 vue-router 的 history 模式路由
* 当存在二级或以上路由时, 相对路径获取 Cesium 静态资源会找不到
* 此时请将这里 viteBase 请配置为 '/'
*
* 以下情况可不配置 viteBase:
* 如果 baseUrl 是 / 开头的, 可不配置 viteBase, 插件会自动获取 vite.config.ts 内 base 配置
* 如果 vue-router 使用的是 hash 模式路由 (形如: `#/foo/bar`), 不影响静态资源地址, 可不配置 viteBase
* 如果 vue-router 使用的是 history 模式路由, 使用 Cesium 的所有页面:
* - 若只有一级路由 (形如: `/foo`), 不需要配置 viteBase
* - 若存在多级路由 (形如: `/foo/bar`), ⚠需要配置 viteBase
*
* default: 自动获取
*/
viteBase?: string;
/**
* rebuild cesium library
*
* default: false
*/
rebuildCesium?: boolean;
/**
* default: false
*/
devMinifyCesium?: boolean;
/**
* default: 'node_modules/cesium/Build'
*/
cesiumBuildRootPath?: string;
/**
* default: 'node_modules/cesium/Build/Cesium/'
*/
cesiumBuildPath?: string;
/**
* default: 'cesium/'
*/
cesiumBaseUrl?: string;
viteBase?: string;
}
export default function vitePluginCesium(options: VitePluginCesiumOptions = {}): Plugin {
const {
viteBase = undefined,
rebuildCesium = false,
devMinifyCesium = false,
cesiumBuildRootPath = 'node_modules/cesium/Build',
cesiumBuildPath = 'node_modules/cesium/Build/Cesium/',
cesiumBaseUrl = 'cesium/',
viteBase = undefined,
} = options;
const CESIUM_BASE_URL = cesiumBaseUrl.endsWith('/')

View File

@@ -1,6 +0,0 @@
# https://tea.xyz/what-is-this-file
---
version: 1.0.0
codeOwners:
- '0x5763B690102Cd5167Ad247a598a13018B84fF77f'
quorum: 1