Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions packages/core/src/node/build-static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
DEVTOOLS_RPC_DUMP_MANIFEST_FILENAME,
} from '@vitejs/devtools-kit/constants'
import { colors as c } from 'devframe/utils/colors'
import { resolveStaticAssetsSource } from 'devframe/utils/remote-assets'
import { dirname, join, relative, resolve } from 'pathe'
import { MARK_NODE } from './constants'
import { createViteDevToolsUi } from './ui'
Expand Down Expand Up @@ -50,10 +51,19 @@ export async function buildStaticDevTools(options: BuildStaticOptions): Promise<
await fs.writeFile(assetPath, (getContent as () => string | Uint8Array)())
}

for (const { baseUrl, distDir } of context.views.buildStaticDirs) {
console.log(c.cyan`${MARK_NODE} Copying static files from ${distDir} to ${join(outDir, baseUrl)}`)
await fs.mkdir(join(outDir, baseUrl), { recursive: true })
await fs.cp(distDir, join(outDir, baseUrl), { recursive: true })
const projectStorageDir = context.host.getStorageDir('project')
for (const { baseUrl, source } of context.views.buildStaticDirs) {
const targetDir = join(outDir, baseUrl)
await fs.mkdir(targetDir, { recursive: true })
const resolved = resolveStaticAssetsSource(source, projectStorageDir)
if (typeof resolved === 'string') {
console.log(c.cyan`${MARK_NODE} Copying static files from ${resolved} to ${targetDir}`)
await fs.cp(resolved, targetDir, { recursive: true })
}
else {
console.log(c.cyan`${MARK_NODE} Downloading remote static files to ${targetDir}`)
await resolved.materialize(targetDir)
}
}

const { renderDockImportsMap } = await import('./plugins/server')
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/node/cli-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ export async function start(options: StartOptions) {
const { createServer } = await import('node:http')
const { defineHandler, H3, sendRedirect, toNodeHandler } = await import('h3')
const { mountStaticHandler } = await import('devframe/utils/serve-static')
const { resolveStaticAssetsSource } = await import('devframe/utils/remote-assets')

const app = new H3()

for (const { baseUrl, distDir } of devtools.context.views.buildStaticDirs)
mountStaticHandler(app, baseUrl, distDir)
const projectStorageDir = devtools.context.host.getStorageDir('project')
for (const { baseUrl, source } of devtools.context.views.buildStaticDirs)
mountStaticHandler(app, baseUrl, resolveStaticAssetsSource(source, projectStorageDir))

app.use('/', defineHandler(event => sendRedirect(event, DEVTOOLS_MOUNT_PATH, 302)))

Expand Down
20 changes: 15 additions & 5 deletions packages/kit/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export * from './vite-plugin'
export type {
ConnectionMeta,
DevframeCapabilities as DevToolsCapabilities,
DevframeDiagnosticsDefinition as DevToolsDiagnosticsDefinition,
DevframeDiagnosticsHost as DevToolsDiagnosticsHost,
DevframeDiagnosticsLogger as DevToolsDiagnosticsLogger,
DevframeHost as DevToolsHost,
Expand All @@ -23,11 +22,9 @@ export type {
DevframeRpcServerFunctions as DevToolsRpcServerFunctions,
DevframeRpcSharedStates as DevToolsRpcSharedStates,
DevframeViewHost as DevToolsViewHost,
EntriesToObject,
EventEmitter,
EventsMap,
EventUnsubscribe,
PartialWithoutId,
RpcBroadcastOptions,
RpcDefinitionsFilter,
RpcDefinitionsToFunctions,
Expand All @@ -37,11 +34,24 @@ export type {
RpcStreamingChannel,
RpcStreamingChannelOptions,
RpcStreamingHost,
Thenable,
} from '@devframes/hub/types'

// `EntriesToObject` and `Thenable` moved from `@devframes/hub/types` to
// `devframe/rpc` upstream (devframe 0.9.0-beta.5+) — they're RPC-shape
// helpers, not hub-augmented context types.
export type { EntriesToObject, Thenable } from 'devframe/rpc'

// `DevframeNodeContext` is the base framework-neutral context — hub does
// not re-export it because hub itself ships `DevframeHubContext` as the
// canonical hub-augmented surface. The kit aliases it for back-compat
// with code that referenced `DevToolsNodeContext` directly.
export type { DevframeNodeContext as DevToolsNodeContext } from 'devframe/types'
//
// `DevframeDiagnosticsDefinition` (the return type of `defineDiagnostics`)
// was replaced upstream by `DevframeDefineDiagnosticsOptions` (the options
// bag passed into it) as part of devframe 0.9's dead-code cleanup.
// `PartialWithoutId` was reduced to an internal `@devframes/hub/node` type
// and is no longer part of the public API surface.
export type {
DevframeDefineDiagnosticsOptions as DevToolsDefineDiagnosticsOptions,
DevframeNodeContext as DevToolsNodeContext,
} from 'devframe/types'
2 changes: 1 addition & 1 deletion packages/oxc/src/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fileURLToPath } from 'node:url'
import { devframeViteBridge } from '@devframes/vite/dev-spa'
import { devframeViteBridge } from '@devframes/vite/single'
import { defineNuxtConfig } from 'nuxt/config'
import { alias } from '../../../alias'
import { oxcDevframe } from './node/devframe'
Expand Down
Loading
Loading