-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathtsup.config.ts
More file actions
92 lines (90 loc) · 3.17 KB
/
Copy pathtsup.config.ts
File metadata and controls
92 lines (90 loc) · 3.17 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import { defineConfig } from "tsup";
import { resolve } from "node:path";
import { readFileSync } from "node:fs";
import { sourceAliases } from "../../scripts/package-subpaths.mjs";
const pkg = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf-8")) as {
version: string;
};
export default defineConfig({
entry: {
cli: "src/cli.ts",
runtimeVersion: "src/runtimeVersion.ts",
shaderTransitionWorker: "../producer/src/services/shaderTransitionWorker.ts",
},
format: ["esm"],
outDir: "dist",
target: "node22",
platform: "node",
bundle: true,
splitting: false,
sourcemap: false,
clean: true,
banner: {
js: `import { createRequire as __hf_createRequire } from "node:module";
import { fileURLToPath as __hf_fileURLToPath } from "node:url";
import { dirname as __hf_dirname } from "node:path";
var require = __hf_createRequire(import.meta.url);
var __filename = __hf_fileURLToPath(import.meta.url);
var __dirname = __hf_dirname(__filename);`,
},
external: [
"puppeteer-core",
"puppeteer",
"@puppeteer/browsers",
// Native module — its platform binary (@img/sharp-<os>-<arch>) must be
// resolved from node_modules at runtime, never bundled. Loaded lazily by
// the capture pipeline; runtime resolution comes from the `dependencies`
// entry in package.json.
"sharp",
"open",
"hono",
"hono/*",
"@hono/node-server",
"adm-zip",
"esbuild",
"giget",
"postcss",
// aws-lambda transitively pulls @aws-sdk/* + @smithy/* which include
// .browser.js conditional exports esbuild can't bundle cleanly into
// a node binary. Keep it external; the lambda subverb files dynamic-
// import it only when the user runs `hyperframes lambda *`, so the
// CLI's cold start doesn't load it. Runtime resolution comes from
// @hyperframes/aws-lambda being a `dependencies` entry in package.json.
"@hyperframes/aws-lambda",
"@hyperframes/aws-lambda/sdk",
// Same treatment for the GCP adapter: the cloudrun subverb files
// dynamic-import `@hyperframes/gcp-cloud-run/sdk` only when the user runs
// `hyperframes cloudrun *`. Keep it external; runtime resolution comes
// from the `dependencies`/workspace entry, not the bundled CLI.
"@hyperframes/gcp-cloud-run",
"@hyperframes/gcp-cloud-run/sdk",
"@hyperframes/gcp-cloud-run/terraform",
],
noExternal: [
"@hyperframes/core",
"@hyperframes/parsers",
"@hyperframes/studio-server",
"@hyperframes/lint",
"@hyperframes/producer",
"@hyperframes/engine",
"@clack/prompts",
"@clack/core",
"picocolors",
"linkedom",
"sisteransi",
"is-unicode-supported",
"citty",
],
define: {
__CLI_VERSION__: JSON.stringify(pkg.version),
},
esbuildOptions(options) {
options.alias = {
// Exact subpaths are generated from the same contracts as package
// exports, avoiding esbuild's root-alias prefix substitution trap.
...sourceAliases(resolve(__dirname, "../producer"), [".", "./distributed"]),
...sourceAliases(resolve(__dirname, "../engine"), [".", "./shader-transitions"]),
};
options.loader = { ...options.loader, ".browser.js": "text" };
},
});