Commit Graph

506 Commits

Author SHA1 Message Date
2bc762a89b feat: 更新 ESLint 配置
Some checks failed
/ surge (push) Successful in 2m34s
/ build-and-deploy-to-vercel (push) Successful in 2m46s
/ lint-build-and-check (push) Has been cancelled
/ playwright (push) Has been cancelled
2025-04-02 11:27:09 +08:00
9ed4c0bc6b chore(deps): update dependency primelocale to ^2.1.2
Some checks failed
/ build-and-deploy-to-vercel (push) Successful in 2m35s
/ lint-build-and-check (push) Successful in 4m44s
/ surge (push) Successful in 2m42s
/ playwright (push) Failing after 11m51s
2025-04-02 10:01:34 +08:00
9daafb9157 chore(deps): update yanhao98/composite-actions digest to 502d85b
Some checks failed
/ build-and-deploy-to-vercel (push) Successful in 2m40s
/ surge (push) Successful in 2m52s
/ lint-build-and-check (push) Successful in 4m22s
/ playwright (push) Has been cancelled
2025-04-02 09:54:08 +08:00
162f9a9a13 feat: 添加 vite-plugin-checker 插件,配置 ESLint 和 Vue 类型检查
Some checks failed
/ playwright (push) Has been cancelled
/ surge (push) Has been cancelled
/ build-and-deploy-to-vercel (push) Has been cancelled
/ lint-build-and-check (push) Has been cancelled
2025-04-02 09:51:35 +08:00
15980dd551 feat: 添加 husky 钩子,支持 commit-msg 和 post-merge 自动提示,更新 pre-commit 钩子中文提示
Some checks failed
/ surge (push) Successful in 2m30s
/ build-and-deploy-to-vercel (push) Successful in 2m43s
/ lint-build-and-check (push) Successful in 4m53s
/ playwright (push) Failing after 19m31s
2025-04-01 19:18:31 +08:00
da515f4dfc feat: 添加卫星管理功能,新增 SatelliteOptions 接口,更新相关组件以支持卫星实体的添加和移除
Some checks failed
/ build-and-deploy-to-vercel (push) Successful in 2m45s
/ lint-build-and-check (push) Successful in 4m28s
/ surge (push) Successful in 2m46s
/ playwright (push) Failing after 12m11s
2025-04-01 18:00:25 +08:00
13681003fb fix: 更新代码注释规范,强调注释应解释逻辑和设计意图,禁止描述代码状态或历史 2025-04-01 18:00:18 +08:00
21660cd9fa fix: 整理代码 2025-04-01 16:34:05 +08:00
99b5aeb042 feat: 重构地面站管理逻辑,新增 GroundStationState 接口,优化组件间数据传递 2025-04-01 16:20:22 +08:00
c829eaaf71 fix: 更新代码注释规范,强调注释应解释复杂逻辑和设计意图,而非重复代码或描述位置 2025-04-01 16:15:39 +08:00
f32c52867f fix: 更新代码注释规范,强调注释应解释复杂逻辑而非重复代码 2025-04-01 15:28:35 +08:00
5c92482122 fix: 修正移除站点逻辑,确保从选中项中正确移除已删除的站点
Some checks failed
/ build-and-deploy-to-vercel (push) Successful in 2m34s
/ lint-build-and-check (push) Successful in 4m26s
/ playwright (push) Failing after 11m51s
/ surge (push) Successful in 2m32s
2025-04-01 14:32:32 +08:00
302151eea8 fix: 修正页面加载路径,确保测试正确访问首页
Some checks failed
/ build-and-deploy-to-vercel (push) Successful in 2m30s
/ lint-build-and-check (push) Successful in 4m28s
/ surge (push) Successful in 2m43s
/ playwright (push) Failing after 14m27s
2025-04-01 12:14:45 +08:00
9166bca070 fix: 调整类型检查步骤的位置,确保构建后进行类型检查
Some checks failed
/ build-and-deploy-to-vercel (push) Successful in 3m6s
/ lint-build-and-check (push) Successful in 4m8s
/ playwright (push) Has been cancelled
/ surge (push) Has been cancelled
2025-04-01 11:58:55 +08:00
8f2a77702b feat: InspiraUI
Some checks failed
/ surge (push) Successful in 2m41s
/ build-and-deploy-to-vercel (push) Successful in 2m59s
/ lint-build-and-check (push) Has been cancelled
/ playwright (push) Has been cancelled
2025-04-01 11:55:16 +08:00
db2c210a09 fix: message.not-used [no ci] 2025-04-01 09:23:16 +08:00
7072f171e0 refactor: 重构 Cesium 相关代码
All checks were successful
/ build-and-deploy-to-vercel (push) Successful in 2m53s
/ lint-build-and-check (push) Successful in 4m23s
/ surge (push) Successful in 3m14s
/ playwright (push) Successful in 5m51s
2025-04-01 01:51:02 +08:00
2c6a4287d2 feat: 整理 HCesiumViewerCls 相关
All checks were successful
/ build-and-deploy-to-vercel (push) Successful in 3m10s
/ lint-build-and-check (push) Successful in 4m25s
/ surge (push) Successful in 2m42s
/ playwright (push) Successful in 5m15s
2025-03-31 20:43:13 +08:00
4636f9fde4 feat: 添加 Cesium Viewer 组件及相关功能,优化项目结构和配置
All checks were successful
/ build-and-deploy-to-vercel (push) Successful in 2m45s
/ lint-build-and-check (push) Successful in 4m30s
/ surge (push) Successful in 2m57s
/ playwright (push) Successful in 6m56s
2025-03-31 19:43:56 +08:00
32bc83e16e chore(deps): update dependency vite to ^6.2.4
Some checks are pending
renovate/stability-days Updates have not met minimum release age requirement
/ build-and-deploy-to-vercel (push) Successful in 2m31s
/ lint-build-and-check (push) Successful in 4m20s
/ surge (push) Successful in 2m30s
/ playwright (push) Successful in 5m16s
2025-03-31 18:35:50 +08:00
12d5ee979f feat: 优化响应式布局,使用 CSS 支持的单位调整屏幕高度和宽度
Some checks failed
/ build-and-deploy-to-vercel (push) Successful in 2m42s
/ lint-build-and-check (push) Successful in 4m25s
/ surge (push) Successful in 2m18s
/ playwright (push) Failing after 5m2s
2025-03-31 15:30:45 +08:00
3edb7392ce feat: 全局 FluidCursor
Some checks failed
/ surge (push) Successful in 2m20s
/ build-and-deploy-to-vercel (push) Successful in 2m42s
/ lint-build-and-check (push) Successful in 4m24s
/ playwright (push) Has been cancelled
2025-03-31 15:25:40 +08:00
b16c038be9 feat: 删除 OrbPro 相关文件和依赖,清理代码库
Some checks failed
/ build-and-deploy-to-vercel (push) Successful in 2m59s
/ lint-build-and-check (push) Successful in 4m5s
/ surge (push) Successful in 2m34s
/ playwright (push) Failing after 5m1s
2025-03-31 15:15:54 +08:00
aea90d1f0d feat: 优化首页模板,移除不必要的条件渲染,调整样式以适应全屏
All checks were successful
/ build-and-deploy-to-vercel (push) Successful in 3m8s
/ lint-build-and-check (push) Successful in 5m25s
/ surge (push) Successful in 3m24s
/ playwright (push) Successful in 4m33s
2025-03-31 14:47:13 +08:00
334b2485f5 feat: 添加 InspiraUI 组件和模式背景功能,更新依赖项
All checks were successful
/ build-and-deploy-to-vercel (push) Successful in 3m0s
/ lint-build-and-check (push) Successful in 4m44s
/ playwright (push) Successful in 3m18s
/ surge (push) Successful in 3m1s
2025-03-31 14:11:30 +08:00
6e18e0f737 feat: 添加 headless 测试支持和修复接口请求页面的路径
All checks were successful
/ build-and-deploy-to-vercel (push) Successful in 3m18s
/ lint-build-and-check (push) Successful in 4m16s
/ surge (push) Successful in 2m46s
/ playwright (push) Successful in 5m34s
2025-03-31 12:36:39 +08:00
5ba87212b9 feat: 添加 oxlint 配置文件并更新 lint 脚本
Some checks failed
/ build-and-deploy-to-vercel (push) Successful in 2m53s
/ lint-build-and-check (push) Successful in 4m15s
/ playwright (push) Failing after 6m44s
/ surge (push) Successful in 2m53s
2025-03-31 01:41:17 +08:00
3adafb58d5 chore: 移除不必要的 oxlint lint 脚本
Some checks failed
/ build-and-deploy-to-vercel (push) Successful in 3m2s
/ lint-build-and-check (push) Successful in 4m13s
/ surge (push) Successful in 2m58s
/ playwright (push) Failing after 5m16s
2025-03-31 00:57:16 +08:00
2fd7f2fcbc feat: 更新配置和依赖项,启用 oxc 插件,移除 cdnImport 插件
Some checks failed
/ lint-build-and-check (push) Failing after 36s
/ playwright (push) Has been cancelled
/ build-and-deploy-to-vercel (push) Has been cancelled
/ surge (push) Has been cancelled
2025-03-31 00:55:50 +08:00
0cc1730b2c feat: 更新依赖
Some checks failed
/ lint-build-and-check (push) Failing after 38s
/ build-and-deploy-to-vercel (push) Successful in 3m4s
/ playwright (push) Failing after 5m32s
/ surge (push) Successful in 2m18s
2025-03-31 00:38:50 +08:00
8d0ed93ee0 feat: 添加 InspiraUI 组件
Some checks failed
/ lint-build-and-check (push) Failing after 37s
/ playwright (push) Failing after 4m50s
/ surge (push) Successful in 2m32s
2025-03-30 23:45:01 +08:00
05d6a71da8 feat: <Isolate />
Some checks failed
/ build-and-deploy-to-vercel (push) Successful in 3m2s
/ lint-build-and-check (push) Successful in 4m31s
/ surge (push) Successful in 2m27s
/ playwright (push) Failing after 5m21s
2025-03-30 22:58:32 +08:00
4b109a0829 chore(deps): 更新多个依赖项版本
All checks were successful
/ build-and-deploy-to-vercel (push) Successful in 3m3s
/ lint-build-and-check (push) Successful in 4m31s
/ surge (push) Successful in 2m46s
/ playwright (push) Successful in 4m31s
2025-03-28 09:58:16 +08:00
0cf585be90 手动修复
All checks were successful
/ build-and-deploy-to-vercel (push) Successful in 3m10s
/ lint-build-and-check (push) Successful in 4m20s
/ surge (push) Successful in 2m59s
/ playwright (push) Successful in 5m50s
2025-03-28 00:43:59 +08:00
ba91e845d5 帮我把 @unhead/vue 的版本升级到 v2.0.2
Some checks failed
/ surge (push) Failing after 1m1s
/ playwright (push) Has been skipped
/ lint-build-and-check (push) Failing after 1m31s
---
title: Migrate Your TypeScript App To Unhead v2
description: Learn about how to migrate to TypeScript Unhead v2 from v1.
navigation:
  title: Upgrade Guide
---

## Introduction

With the release of Unhead v2, we now have first-class support for other frameworks. However, this guide will focus on
the changes that affec TypeScript users.

The high-level of Unhead v2 was to remove deprecations and remove the implicit context implementation.

### Legacy Support

Unhead v2 is mostly fully backwards compatible with Unhead v1.

While not recommended, if upgrading is not possible for you, you can change your imports to the following:

```diff [TypeScript]
-import { createServerHead, useHead } from 'unhead'
+import { createServerHead, useHead } from 'unhead/legacy'
```

This will be removed in a future minor version, so you should lock your dependencies to the version that works for you.

## Client / Server Subpath Exports

🚦 Impact Level: Critical

**⚠️ Breaking Changes:**

- `createServerHead()`{lang="ts"} and `createHead()`{lang="ts"} exports from `unhead` are removed

The path where you import `createHead` from has been updated to be a subpath export.

Please follow the updated installation instructions or simply update the import to use the subpath.

**Client bundle:**

```diff
-import { createServerHead } from 'unhead'
+import { createHead } from 'unhead/client'

// avoids bundling server plugins
createHead()
```

**Server bundle:**

```diff
-import { createServerHead } from 'unhead'
+import { createHead } from 'unhead/server'

// avoids bundling server plugins
-createServerHead()
+createHead()
```

## Removed Implicit Context

🚦 Impact Level: Critical

**⚠️ Breaking Changes:**

- `getActiveHead()`{lang="ts"}, `activeHead`{lang="ts"} exports are removed

The implicit context implementation kept a global instance of Unhead available so that you could use the `useHead()`{lang="ts"} composables
anywhere in your application.

```ts
useHead({
  title: 'This just worked!'
})
```

While safe client side, this was a leaky abstraction server side and led to memory leaks in some cases.

In v2, the core composables no longer have access to the Unhead instance. Instead, you must pass the Unhead instance to the composables.

::note
Passing the instance is only relevant if you're importing from `unhead`. In JavaScript frameworks we tie the context to the framework itself so you
don't need to worry about this.
::

::code-group

```ts [TypeScript v2]
import { useHead } from 'unhead'

// example of getting the instance
const unheadInstance = useMyApp().unhead
useHead(unheadInstance, {
  title: 'Looks good'
})
```

```ts [TypeScript v1]
import { useHead } from 'unhead'

useHead({
  title: 'Just worked! But with SSR issues'
})
```

::

## Removed `vmid`, `hid`, `children`, `body`

🚦 Impact Level: High

For legacy support with Vue Meta we allowed end users to provide deprecated properties:  `vmid`, `hid`, `children` and `body`.

You must either update these properties to the appropriate replacement, remove them, or you can use the `DeprecationsPlugin`.

**Meta tags with `vmid`, `hid`**

These are already deduped magically so you can safely remove them there.

```diff
useHead({
  meta: [{
    name: 'description',
-   vmid: 'description'
-   hid: 'description'
  }]
})
```

**Other Tags with `vmid`, `hid`**

Use `key` if you need the deduplication feature. This is useful for tags that may change from server to client
rendering.

```diff
useHead({
  script: [{
-   vmid: 'my-key'
-   hid: 'my-key'
+   key: 'my-key',
  }]
})
```

**Using `children`**

The `children` key is a direct replacement of `innerHTML` which you should use instead.

::Caution
When migrating your code ensure that you're not dynamically setting `innerHTML` as this can lead to XSS vulnerabilities.
::

```diff
useHead({
  script: [
      {
-        children: '..'
+        innerHTML: '..'
      }
   ]
})
```

**Using `body`**

The `body` key should be updated to use the Tag Position feature.

```diff
useHead({
  script: [
      {
-        body: true
+        tagPosition: 'bodyClose'
      }
   ]
})
```

**Use Deprecations Plugin**

```ts
import { createHead } from 'unhead'
import { DeprecationsPlugin } from 'unhead/plugins'

const unhead = createHead({
  plugins: [DeprecationsPlugin]
})
```

## Opt-in Template Params & Tag Alias Sorting

🚦 Impact Level: High

To reduce the bundle size and improve performance, we've moved the template params and tag alias sorting to optional plugins.

If you'd like to continue using these, please opt-in to the plugins.

```ts
import { AliasSortingPlugin, TemplateParamsPlugin } from 'unhead/plugins'

createHead({
  plugins: [TemplateParamsPlugin, AliasSortingPlugin]
})
```

## Vue 2 Support

🚦 Impact Level: Critical

Unhead v2 no longer supports Vue v2. If you're using Vue v2, you will need to lock your dependencies to the latest v1 version of Unhead.

## Promise Input Support

🚦 Impact Level: Medium

If you have promises as input they will no longer be resolved, either await the promise before passing it along or register the optional promises plugin.

**Option 1: Await Promise**

```diff
useHead({
  link: [
    {
-     href: import('~/assets/MyFont.css?url'),
+     href: await import('~/assets/MyFont.css?url'),
      rel: 'stylesheet',
      type: 'text/css'
    }
  ]
})
```

**Option 2: Promise Plugin**

```ts
import { PromisePlugin } from 'unhead/plugins'

const unhead = createHead({
  plugins: [PromisePlugin]
})
```

## Updated `useScript()`{lang="ts"}

🚦 Impact Level: High

**⚠️ Breaking Changes:**

- Script instance is no longer augmented as a proxy and promise
- `script.proxy`{lang="ts"} is rewritten for simpler, more stable behavior
- `stub()`{lang="ts"} and runtime hook `script:instance-fn` are removed

**Replacing promise usage**

If you're using the script as a promise you should instead opt to use the `onLoaded()` functions.

```diff
const script = useScript()

-script.then(() => console.log('loaded')
+script.onLoaded(() => console.log('loaded'))
```

**Replacing proxy usage**

If you're accessing the underlying API directly from the script instance, you will now need to only access it from the `.proxy`.

```diff
const script = useScript('..', {
  use() { return { foo: [] } }
})

-script.foo.push('bar')
+script.proxy.foo.push('bar')
```

**Replacing `stub()`**

If you were using stub for anything you should replace this with either custom `use()` behavior.

```diff
const script = useScript('...', {
-  stub() { return { foo: import.meta.server ? [] : undefined } }
})

+script.proxy = {} // your own implementation
```

## Tag Sorting Updated

🚦 Impact Level: :UBadge{color="success" variant="subtle" size="sm" label="Low"}

An optional [Capo.js](https://rviscomi.github.io/capo.js/) plugin was added to Unhead, in v2 we make this the default sorting behavior.

::warning
As all head tags may be re-ordered this will break any snapshot tests that you have in place and in some rare cases may lead to performance regressions.
::

You can opt-out of Capo.js sorting by providing the option.

```ts
createHead({
  disableCapoSorting: true,
})
```

## Default SSR Tags

🚦 Impact Level: Low

When SSR Unhead will now insert important default tags for you:
- `<meta charset="utf-8">`
- `<meta name="viewport" content="width=device-width, initial-scale=1">`
- `<html lang="en">`

If you were previously relying on these being left empty, you may need to either disable them by using `disableDefaultTags` or insert tags
to override them.

```ts
import { createHead, useHead } from 'unhead/server'

// disable when creating the head instance
const head = createHead({
  disableDefaults: true,
})

useHead(head, {
  htmlAttrs: {
    lang: 'fr'
  }
})
```

## CJS Exports Removed

🚦 Impact Level: Low

CommonJS exports have been removed in favor of ESM only.

```diff
-const { createHead } = require('unhead/client')
+import { createHead } from 'unhead/client'
```

## Deprecated `@unhead/schema`

🚦 Impact Level: Low

The `@unhead/schema` package is now deprecated and will be removed in a future version. You should instead import
the schema from `unhead/types` or `unhead`.

```diff
-import { HeadTag } from '@unhead/schema'
+import { HeadTag } from 'unhead/types'
```
2025-03-28 00:06:28 +08:00
ea50699dc1 feat: 移动 depcheck 工作流到 lint.yaml,删除旧的 depcheck.yaml 文件
All checks were successful
/ build-and-deploy-to-vercel (push) Successful in 3m55s
/ lint-build-and-check (push) Successful in 5m39s
/ surge (push) Successful in 3m32s
/ playwright (push) Successful in 4m13s
2025-03-27 22:55:36 +08:00
dcbdba3a55 docs: 添加 Vuetify 相关链接到 UseIntersectionObserverInfiniteLoading 组件
All checks were successful
/ depcheck (push) Successful in 2m30s
/ lint-build-and-check (push) Successful in 2m39s
/ build-and-deploy-to-vercel (push) Successful in 3m4s
/ playwright (push) Successful in 4m48s
/ surge (push) Successful in 2m38s
2025-03-27 11:24:16 +08:00
a6389aee36 chore(deps): update dependency eslint-plugin-oxlint to ^0.15.15
All checks were successful
/ depcheck (push) Successful in 2m24s
/ lint-build-and-check (push) Successful in 2m33s
/ build-and-deploy-to-vercel (push) Successful in 3m19s
/ surge (push) Successful in 2m27s
/ playwright (push) Successful in 4m43s
2025-03-26 20:32:09 +08:00
a05ca276ca chore(deps): update dependency eslint-plugin-unicorn to v58
Some checks failed
/ depcheck (push) Successful in 2m22s
/ lint-build-and-check (push) Successful in 2m43s
/ playwright (push) Has been cancelled
/ surge (push) Has been cancelled
/ build-and-deploy-to-vercel (push) Has been cancelled
2025-03-26 20:29:15 +08:00
6dc43a1812 chore(deps): update yanhao98/composite-actions digest to 33959a3
All checks were successful
/ lint-build-and-check (push) Successful in 2m45s
/ depcheck (push) Successful in 2m59s
/ build-and-deploy-to-vercel (push) Successful in 2m59s
/ surge (push) Successful in 2m30s
/ playwright (push) Successful in 4m57s
2025-03-26 01:51:21 +08:00
fa8d02f08d feat: 移除 size-limit 依赖及相关工作流配置
All checks were successful
/ depcheck (push) Successful in 2m39s
/ lint-build-and-check (push) Successful in 3m1s
/ build-and-deploy-to-vercel (push) Successful in 3m4s
/ playwright (push) Successful in 4m41s
/ surge (push) Successful in 2m27s
2025-03-25 11:42:13 +08:00
68406f5681 feat: 添加 size-limit 依赖
Some checks failed
/ lint-build-and-check (push) Successful in 2m31s
/ depcheck (push) Failing after 2m46s
/ build-and-deploy-to-vercel (push) Successful in 2m53s
/ surge (push) Successful in 2m32s
/ playwright (push) Successful in 3m50s
2025-03-25 10:54:13 +08:00
fb095ea5be fix: createUtils4uAutoImports
Some checks failed
/ depcheck (push) Failing after 2m39s
/ lint-build-and-check (push) Successful in 2m48s
/ surge (push) Successful in 2m53s
/ build-and-deploy-to-vercel (push) Successful in 2m57s
/ playwright (push) Has been cancelled
2025-03-25 10:49:06 +08:00
b475a7bbdd feat: 添加构建大小统计到 depcheck 工作流,并移除 playwright 工作流中的重复统计
Some checks failed
/ lint-build-and-check (push) Failing after 52s
/ build-and-deploy-to-vercel (push) Failing after 1m3s
/ surge (push) Failing after 1m6s
/ playwright (push) Has been skipped
/ depcheck (push) Failing after 2m41s
2025-03-25 10:39:18 +08:00
2df09cf33f feat: 整理目录结构
Some checks failed
/ playwright (push) Has been skipped
/ surge (push) Failing after 36s
/ lint-build-and-check (push) Failing after 55s
/ build-and-deploy-to-vercel (push) Failing after 1m13s
/ depcheck (push) Has been cancelled
2025-03-25 10:36:19 +08:00
2482608a2e feat: 添加 FlowbiteSidebar 组件及路由定义
All checks were successful
/ depcheck (push) Successful in 2m19s
/ lint-build-and-check (push) Successful in 2m52s
/ build-and-deploy-to-vercel (push) Successful in 3m0s
/ surge (push) Successful in 2m43s
/ playwright (push) Successful in 3m26s
2025-03-25 01:03:03 +08:00
4ac0e0c138 fix: 修复导入名称以匹配 vite-plugin-webfont-dl 的更新
All checks were successful
/ lint-build-and-check (push) Successful in 2m52s
/ depcheck (push) Successful in 2m52s
/ build-and-deploy-to-vercel (push) Successful in 3m9s
/ playwright (push) Successful in 3m51s
/ surge (push) Successful in 2m22s
2025-03-24 10:36:14 +08:00
a8a06c589c chore(deps): update unplugin packages
All checks were successful
renovate/stability-days Updates have met minimum release age requirement
/ lint-build-and-check (push) Successful in 2m36s
/ depcheck (push) Successful in 2m48s
/ build-and-deploy-to-vercel (push) Successful in 3m35s
/ surge (push) Successful in 2m41s
/ playwright (push) Successful in 5m31s
2025-03-24 03:14:23 +08:00
295f2d0c95 feat: 添加主题配置支持并优化 UI 组件页面的暗黑模式样式
All checks were successful
/ lint-build-and-check (push) Successful in 2m38s
/ depcheck (push) Successful in 3m7s
/ build-and-deploy-to-vercel (push) Successful in 3m22s
/ playwright (push) Successful in 4m49s
/ surge (push) Successful in 2m36s
2025-03-24 01:19:00 +08:00
cf95ef7e8e feat: 添加输入组件并更新 UI 组件页面布局
All checks were successful
/ depcheck (push) Successful in 2m31s
/ lint-build-and-check (push) Successful in 2m34s
/ build-and-deploy-to-vercel (push) Successful in 3m37s
/ surge (push) Successful in 2m54s
/ playwright (push) Successful in 5m22s
2025-03-24 00:54:43 +08:00