Skip to content

Commit 4f0157c

Browse files
authored
perf(deps): shrink the install footprint (#392)
1 parent 4bf8fca commit 4f0157c

50 files changed

Lines changed: 357 additions & 200 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

alias.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const alias = {
2828
'devframe/utils/agent-tool-name': r('devframe/src/utils/agent-tool-name.ts'),
2929
'devframe/utils/colors': r('devframe/src/utils/colors.ts'),
3030
'devframe/utils/crypto-token': r('devframe/src/utils/crypto-token.ts'),
31+
'devframe/utils/debounce': r('devframe/src/utils/debounce.ts'),
3132
'devframe/utils/events': r('devframe/src/utils/events.ts'),
3233
'devframe/utils/hash': r('devframe/src/utils/hash.ts'),
3334
'devframe/utils/launch-editor': r('devframe/src/utils/launch-editor.ts'),
@@ -41,6 +42,7 @@ export const alias = {
4142
'devframe/utils/shared-state': r('devframe/src/utils/shared-state.ts'),
4243
'devframe/utils/streaming-channel': r('devframe/src/utils/streaming-channel.ts'),
4344
'devframe/utils/structured-clone': r('devframe/src/utils/structured-clone.ts'),
45+
'devframe/utils/url': r('devframe/src/utils/url.ts'),
4446
'devframe/utils/when': r('devframe/src/utils/when.ts'),
4547
'devframe/adapters/cac': r('devframe/src/adapters/cac.ts'),
4648
'devframe/adapters/dev': r('devframe/src/adapters/dev.ts'),

docs/app/pages/logos.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<script setup lang="ts">
22
// Shadows the comark-docs layer's brand-assets page with devframe's assets.
3-
import { joinURL } from 'ufo'
43
import logoSvg from '../../public/logo.svg?raw'
54
65
definePageMeta({
@@ -11,7 +10,7 @@ const title = 'Brand assets'
1110
const description = 'Logos and assets for Devframe. Download SVG or PNG, or copy the raw SVG source directly.'
1211
1312
const site = useSiteConfig()
14-
const canonicalUrl = computed(() => joinURL(site.url, '/logos'))
13+
const canonicalUrl = computed(() => new URL('/logos', site.url).href)
1514
1615
useRobotsRule('index, follow')
1716

docs/content/8.references/8.utilities.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@ randomDigits(6) // '047204', uniform, leading zeros preserved
9696
timingSafeEqual(input, secret) // constant-time string comparison
9797
```
9898

99+
### `devframe/utils/debounce`
100+
101+
Promise-aware debounce, bundled in so integrations reuse it without adding a `perfect-debounce` dependency.
102+
103+
```ts
104+
import { debounce } from 'devframe/utils/debounce'
105+
106+
const save = debounce((state: State) => write(state), 100)
107+
save(next) // coalesces bursts; returns a promise, plus `.cancel()` / `.flush()` / `.isPending()`
108+
```
109+
99110
### `devframe/utils/events`
100111

101112
Typed event emitter.
@@ -123,6 +134,20 @@ state.mutate((draft) => {
123134
state.value() // => count is 1
124135
```
125136

137+
### `devframe/utils/url`
138+
139+
URL path-joining and slash-normalization helpers (browser-safe, zero-dep).
140+
141+
```ts
142+
import { joinURL, withBase, withProtocol, withTrailingSlash } from 'devframe/utils/url'
143+
144+
joinURL('/__devframe', '__renderers', 'vue.mjs') // '/__devframe/__renderers/vue.mjs'
145+
withBase('meta.json', '/__devframe/') // '/__devframe/meta.json'
146+
withProtocol('http://localhost:7777/ws', 'ws://') // 'ws://localhost:7777/ws'
147+
```
148+
149+
Also exports `withLeadingSlash`, `withoutLeadingSlash`, `withoutTrailingSlash`, and `cleanDoubleSlashes`.
150+
126151
### `devframe/utils/streaming-channel`
127152

128153
Sink/reader primitives for streamed RPC payloads, via `ctx.rpc.streaming`; see [Streaming](/guide/streaming).

docs/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
"comark-docs": "catalog:docs",
2121
"d3-shape": "catalog:frontend",
2222
"nuxt": "catalog:build",
23-
"shiki": "catalog:deps",
24-
"ufo": "catalog:deps"
23+
"shiki": "catalog:deps"
2524
},
2625
"devDependencies": {
2726
"@types/d3-shape": "catalog:types"

packages/agentic/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@
4141
"dependencies": {
4242
"@modelcontextprotocol/client": "catalog:deps",
4343
"@modelcontextprotocol/server": "catalog:deps",
44-
"@standard-schema/spec": "catalog:deps",
4544
"h3": "catalog:deps",
46-
"pathe": "catalog:deps",
47-
"ufo": "catalog:deps"
45+
"pathe": "catalog:deps"
4846
},
4947
"devDependencies": {
48+
"@standard-schema/spec": "catalog:deps",
5049
"@types/node": "catalog:types",
5150
"devframe": "workspace:*",
5251
"tsdown": "catalog:build",

packages/agentic/src/connect/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { StdioServerTransport } from '@modelcontextprotocol/server/stdio'
66
import { diagnostics, listLiveDevframeInstances, probeDevframeOrigin } from 'devframe/internal'
77
import { toAgentToolName } from 'devframe/utils/agent-tool-name'
88
import { Diagnostic } from 'devframe/utils/nostics'
9-
import { joinURL } from 'ufo'
9+
import { joinURL } from 'devframe/utils/url'
1010

1111
export interface ConnectServerOptions {
1212
/**

packages/agentic/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ throw new Error(
1212
+ ' • import from "devframe/adapters/mcp" to serve a devframe over MCP\n'
1313
+ ' • run "devframe connect" for the stdio discovery gateway\n',
1414
)
15+
16+
// An explicit empty module so dts emit has something to say about this entry.
17+
export {}

packages/devframe/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"./utils/agent-tool-name": "./dist/utils/agent-tool-name.mjs",
4949
"./utils/colors": "./dist/utils/colors.mjs",
5050
"./utils/crypto-token": "./dist/utils/crypto-token.mjs",
51+
"./utils/debounce": "./dist/utils/debounce.mjs",
5152
"./utils/events": "./dist/utils/events.mjs",
5253
"./utils/get-port": "./dist/utils/get-port.mjs",
5354
"./utils/hash": "./dist/utils/hash.mjs",
@@ -62,6 +63,7 @@
6263
"./utils/shared-state": "./dist/utils/shared-state.mjs",
6364
"./utils/streaming-channel": "./dist/utils/streaming-channel.mjs",
6465
"./utils/structured-clone": "./dist/utils/structured-clone.mjs",
66+
"./utils/url": "./dist/utils/url.mjs",
6567
"./utils/when": "./dist/utils/when.mjs",
6668
"./package.json": "./package.json"
6769
},
@@ -93,22 +95,21 @@
9395
}
9496
},
9597
"dependencies": {
96-
"@standard-schema/spec": "catalog:deps",
97-
"birpc": "catalog:deps",
9898
"crossws": "catalog:deps",
9999
"h3": "catalog:deps",
100-
"mrmime": "catalog:deps",
101100
"nostics": "catalog:deps",
102-
"pathe": "catalog:deps",
103-
"ufo": "catalog:deps"
101+
"pathe": "catalog:deps"
104102
},
105103
"devDependencies": {
106104
"@devframes/agentic": "workspace:*",
105+
"@standard-schema/spec": "catalog:deps",
106+
"birpc": "catalog:deps",
107107
"cac": "catalog:deps",
108108
"get-port-please": "catalog:deps",
109109
"immer": "catalog:deps",
110110
"launch-editor": "catalog:deps",
111111
"mlly": "catalog:build",
112+
"mrmime": "catalog:deps",
112113
"obug": "catalog:deps",
113114
"ohash": "catalog:deps",
114115
"p-limit": "catalog:deps",

packages/devframe/src/adapters/_shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import type { AgenticMcpModule } from '../node/agentic'
22
import type { DevframeAgentHost } from '../types/agent'
33
import type { ConnectionMeta } from '../types/context'
44
import type { DevframeDefinition, DevframeDeploymentKind, McpAuthorization, McpSetting } from '../types/devframe'
5+
import { cleanDoubleSlashes, withLeadingSlash, withoutLeadingSlash, withTrailingSlash } from 'devframe/utils/url'
56
import { getPort } from 'get-port-please'
6-
import { cleanDoubleSlashes, withLeadingSlash, withoutLeadingSlash, withTrailingSlash } from 'ufo'
77
import { DEVFRAME_MCP_ROUTE } from '../constants'
88
import { importAgenticMcp, isAgenticInstalled, warnAgenticMcpMissingOnce } from '../node/agentic'
99

packages/devframe/src/adapters/dev.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import type { StaticAssetsSource } from '../types/remote-assets'
66
import type { DevframeNodeRpcSession, DevframeNodeRpcSessionMeta } from '../types/rpc'
77
import { createServer } from 'node:http'
88
import { open } from 'devframe/utils/open'
9+
import { withBase } from 'devframe/utils/url'
910
import { H3, toNodeHandler } from 'h3'
10-
import { withBase } from 'ufo'
1111
import { diagnostics } from '../node/diagnostics'
1212
import { normalizeHttpServerUrl } from '../node/utils'
1313
import { normalizeBasePath, resolveBasePath, resolveDevServerPort } from './_shared'

0 commit comments

Comments
 (0)