The four free functions in boot.tsx become one kernel class holding what
must exist before cordis: the parsed BootManifest, the ClientModuleSystem
instance, and the loading-page handles. Context/Loader setup runs in
parallel with the immediately-tier prefetch, but entry creation awaits the
prefetch: materialization is tree.import's synchronous require, so
cross-package require edges (i18n -> runtime/client) need every
immediately-tier factory registered first — unbarriered creation raced
10-25% of boots. The kernel adopts the modules entry (writes the
__DSH_MODULES__ slot pre-cordis, creates the entry first, skips its graph
row), and provide('modules') now lives in the adoption apply. apps/web
drops its host-package edges (composition is apps/cli's job).
38 lines
2.0 KiB
TypeScript
38 lines
2.0 KiB
TypeScript
import { fileURLToPath } from 'node:url'
|
|
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
const src = (rel: string): string => fileURLToPath(new URL(rel, import.meta.url))
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
// Workspace packages resolve to SOURCE: package.json exports point at lib
|
|
// for Node/type consumers, but the browser bundle must compile src directly
|
|
// so CSS rides vite's pipeline instead of the CSS-externalized lib bundle.
|
|
// Only the shell's normal-package surface is aliased — plugin packages are
|
|
// NEVER bundled here (web2 shell self-sufficiency); they arrive as runtime
|
|
// bundles through the client module system. Order matters — subpath
|
|
// aliases must win over bare-name prefixes.
|
|
alias: [
|
|
// Browserization of the vendored cordis Loader: its only node-only
|
|
// import; the two process probes are mapped by `define` below.
|
|
{ find: /^node:module$/, replacement: src('./src/node-module-stub.ts') },
|
|
{ find: /^@deepseek-ai\/dsh-client-web$/, replacement: src('../../packages/client/web/src/boot.tsx') },
|
|
{ find: /^@deepseek-ai\/dsh-client-web-react$/, replacement: src('../../packages/client/web-react/src/index.ts') },
|
|
{ find: /^@deepseek-ai\/dsh-client-ui-slots$/, replacement: src('../../packages/client/ui-slots/src/index.ts') },
|
|
{ find: /^@deepseek-ai\/dsh-client-ui-primitives$/, replacement: src('../../packages/client/ui-primitives/src/index.ts') },
|
|
{ find: /^@deepseek-ai\/dsh-client-modules\/client$/, replacement: src('../../packages/client/modules/src/client/index.ts') },
|
|
],
|
|
},
|
|
define: {
|
|
// vendored loader internal.ts: fromInternal() probes the Node major —
|
|
// "0.0.0" takes neither branch, returning undefined (exactly the empty
|
|
// internal slot the shell boot fills with the client module loader).
|
|
'process.versions.node': '"0.0.0"',
|
|
'process.execArgv': '[]',
|
|
// vendored loader index.ts: envData falls to its default branch.
|
|
'process.env.CORDIS_SHARED': 'undefined',
|
|
},
|
|
})
|