mirror of
https://github.com/enso-org/enso.git
synced 2024-11-26 17:06:48 +03:00
858e646328
- related #7954 Changelog: - update: Ydoc starts with the language server on the `localhost:1234` by default. The hostname and ports can be configured by setting environment variables `LANGUAGE_SERVER_YDOC_HOSTNAME` and `LANGUAGE_SERVER_YDOC_PORT` - update: by default `npm dev run` uses the node Ydoc server. You can control it with `POLYGLOT_YDOC_SERVER` env variable. For example, ``` env POLYGLOT_YDOC_SERVER='true' npm --workspace=enso-gui2 run dev ``` To connect to the Ydoc server running on the 1234 port (the one started with the language server) ⠀ ``` env POLYGLOT_YDOC_SERVER='ws://127.0.0.1:1235' npm --workspace=enso-gui2 run dev ``` To connect to the provided URL. Can be useful for debugging when you start a separate Ydoc process. - update: run `npm install` before the engine build. It is required to create the Ydoc JS bundle.
57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
import * as fs from 'node:fs'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { defineConfig, type Plugin } from 'vite'
|
|
import defaultConfig from './vite.config'
|
|
|
|
const root = defaultConfig.root
|
|
const cacheDir = defaultConfig.cacheDir
|
|
const publicDir = defaultConfig.publicDir
|
|
const envDir = defaultConfig.envDir
|
|
const resolve = defaultConfig.resolve
|
|
|
|
export default defineConfig({
|
|
root,
|
|
cacheDir,
|
|
publicDir,
|
|
envDir,
|
|
resolve,
|
|
plugins: [usePolyglotFfi()],
|
|
define: {
|
|
...defaultConfig.define,
|
|
self: 'globalThis',
|
|
},
|
|
build: {
|
|
minify: false, // For debugging
|
|
emptyOutDir: true,
|
|
outDir: '../../lib/java/ydoc-server/target/ydoc-server-bundle',
|
|
rollupOptions: {
|
|
input: {
|
|
ydocServer: fileURLToPath(new URL('ydoc-server/indexPolyglot.ts', import.meta.url)),
|
|
},
|
|
output: {
|
|
entryFileNames: `assets/[name].js`,
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
/**
|
|
* Use `ffiPolyglot` module as `ffi` interface during the build.
|
|
*/
|
|
function usePolyglotFfi(): Plugin {
|
|
const ffiPolyglot = fileURLToPath(new URL('./shared/ast/ffiPolyglot.ts', import.meta.url))
|
|
const ffiBackup = fileURLToPath(new URL('./shared/ast/ffiBackup.ts', import.meta.url))
|
|
const ffi = fileURLToPath(new URL('./shared/ast/ffi.ts', import.meta.url))
|
|
|
|
return {
|
|
name: 'use-polyglot-ffi',
|
|
options: () => {
|
|
fs.renameSync(ffi, ffiBackup)
|
|
fs.copyFileSync(ffiPolyglot, ffi)
|
|
},
|
|
buildEnd: () => {
|
|
fs.renameSync(ffiBackup, ffi)
|
|
},
|
|
}
|
|
}
|