-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild-base-server.sh
More file actions
executable file
·53 lines (43 loc) · 2.5 KB
/
Copy pathbuild-base-server.sh
File metadata and controls
executable file
·53 lines (43 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
set -eu -o pipefail
# Build server bundle
# --define replaces import.meta.url references with __imu (defined in --banner).
# Shebang is for npm bin entry; harmless when VSCode spawns via node
# (Node treats #! as a comment in CJS modules).
# See esbuild-lib.sh for rationale on the __imu shim.
# shellcheck source=scripts/esbuild-lib.sh
source "$(dirname "$0")/esbuild-lib.sh"
esbuild ./server/src/server.ts --bundle --outfile=server/out/server.js \
--external:vscode --external:esbuild-wasm --format=cjs --platform=node \
--banner:js="$imu_banner_with_shebang" \
"$imu_define" \
"$@"
# The SSL compile worker is a second entry point, not part of the server bundle: a worker thread is
# started from its own file, and it must sit beside server.js because that is where it is looked up.
# No shebang - it is loaded by the Worker constructor, never executed directly.
esbuild ./server/src/fallout-ssl/compile-worker.ts --bundle --outfile=server/out/compile-worker.js \
--external:vscode --external:esbuild-wasm --format=cjs --platform=node \
--banner:js="$imu_banner" \
"$imu_define" \
"$@"
# The TSSL compile worker, a third entry point for the same reason: it is started as a worker thread
# from its own file, beside server.js. It carries ts-morph, so it is the one bundle here that is large
# on its own - keeping it out of server.js is what stops every server start paying for that.
esbuild ./server/src/tssl/compile-worker.ts --bundle --outfile=server/out/tssl-compile-worker.js \
--external:vscode --external:esbuild-wasm --format=cjs --platform=node \
--banner:js="$imu_banner" \
"$imu_define" \
"$@"
# The WebAssembly compiler's wrapper. Copied rather than bundled: it is forked as a file, and the module
# it loads is resolved from server/node_modules at run time. It must sit beside server.js, which is where
# ssl_compiler.ts looks for it - the same relative path that finds it next to the source.
cp server/src/sslc/sslc-wrapper.mjs server/out/
# Copy tree-sitter WASM files
copy_wasm_to server/out
# Diagnostics-only grammars (MSG/TRA): parsed by the server for parse-error
# diagnostics, but unused by the format CLI - so they ship to server/out only and
# are not part of the shared copy_wasm_to helper (which also feeds format/out).
cp grammars/fallout-msg/tree-sitter-fallout_msg.wasm server/out/
cp grammars/weidu-tra/tree-sitter-weidu_tra.wasm server/out/
# Copy TD runtime declarations (used by the TD TypeScript plugin)
cp transpilers/td/src/td-runtime.d.ts server/out/