release: bump version to 0.83.0
ci / backend (push) Canceled after 0s
ci / frontend (push) Canceled after 0s
ci / delivery (push) Canceled after 0s

This commit is contained in:
linkong committed 2026-12-02 18:53:58 +08:00
1 parent 04cebdc504
commit 3b1b9ef68c
96 files changed
+8492 -1021

No files matched your search

+17 -1
View File
@@ -16,12 +16,16 @@ export function earthRuntimePlugin(root) {
const earth = join(root, 'public/earth')
const require = createRequire(join(root, 'package.json'))
const mediaPipePkgDir = dirname(require.resolve('@mediapipe/tasks-vision/package.json'))
const threeModulePath = join(dirname(require.resolve('three')), 'three.module.js')
let outDir = 'dist'
let compilation = null
async function compile() {
if (compilation) return compilation
compilation = compileEarthRuntime({ earthDir: earth }).catch((error) => {
compilation = compileEarthRuntime({
earthDir: earth,
importMapOverrides: { three: './vendor/three.module.js' },
}).catch((error) => {
compilation = null
throw error
})
@@ -41,6 +45,13 @@ export function earthRuntimePlugin(root) {
})
server.middlewares.use(async (req, res, next) => {
const url = (req.url || '').split('?')[0]
if (url === '/earth/vendor/three.module.js') {
if (!existsSync(threeModulePath)) return next()
res.setHeader('Cache-Control', 'no-cache')
res.setHeader('Content-Type', 'text/javascript; charset=utf-8')
res.end(readFileSync(threeModulePath))
return
}
if (url === '/earth/vendor/mediapipe/vision_bundle.mjs') {
const filePath = join(mediaPipePkgDir, 'vision_bundle.mjs')
if (!existsSync(filePath)) return next()
@@ -93,6 +104,11 @@ export function earthRuntimePlugin(root) {
this.emitFile({ type: 'asset', fileName: 'earth/index.html', source: html })
},
closeBundle() {
const targetThreeDir = resolve(root, outDir, 'earth/vendor')
mkdirSync(targetThreeDir, { recursive: true })
if (existsSync(threeModulePath)) {
cpSync(threeModulePath, join(targetThreeDir, 'three.module.js'))
}
const targetMediaPipeDir = resolve(root, outDir, 'earth/vendor/mediapipe')
mkdirSync(targetMediaPipeDir, { recursive: true })
const bundleSrc = join(mediaPipePkgDir, 'vision_bundle.mjs')