@web-ts-toolkit/express-runtime 0.27.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli-api.d.mts +4 -0
- package/cli-api.d.ts +4 -0
- package/cli-api.js +36 -6
- package/cli-api.mjs +35 -4
- package/cli.js +36 -6
- package/package.json +1 -1
package/cli-api.d.mts
CHANGED
|
@@ -16,6 +16,8 @@ type Subcommand = 'dev' | 'build' | 'start' | 'build-serverless' | 'start-server
|
|
|
16
16
|
interface DevArgs {
|
|
17
17
|
appPath: string;
|
|
18
18
|
options: Omit<LocalServerOptions, 'init' | 'onShutdown'>;
|
|
19
|
+
/** Optional tsconfig path for consumers that need TS path resolution. */
|
|
20
|
+
tsconfigPath?: string;
|
|
19
21
|
/** Modules to preload before loading the app (repeatable `--require`). */
|
|
20
22
|
require: string[];
|
|
21
23
|
/** Env files to load before loading the app (repeatable `--env`). */
|
|
@@ -30,6 +32,7 @@ interface DevArgs {
|
|
|
30
32
|
interface BuildArgs {
|
|
31
33
|
appPath: string;
|
|
32
34
|
initPath?: string;
|
|
35
|
+
tsconfigPath?: string;
|
|
33
36
|
outDir: string;
|
|
34
37
|
outName: string;
|
|
35
38
|
format: 'cjs' | 'esm';
|
|
@@ -40,6 +43,7 @@ interface BuildArgs {
|
|
|
40
43
|
interface BuildEntryContentArgs {
|
|
41
44
|
entryContent: string;
|
|
42
45
|
tempEntryFilename: string;
|
|
46
|
+
tsconfigPath?: string;
|
|
43
47
|
outDir: string;
|
|
44
48
|
outName: string;
|
|
45
49
|
format: 'cjs' | 'esm';
|
package/cli-api.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ type Subcommand = 'dev' | 'build' | 'start' | 'build-serverless' | 'start-server
|
|
|
16
16
|
interface DevArgs {
|
|
17
17
|
appPath: string;
|
|
18
18
|
options: Omit<LocalServerOptions, 'init' | 'onShutdown'>;
|
|
19
|
+
/** Optional tsconfig path for consumers that need TS path resolution. */
|
|
20
|
+
tsconfigPath?: string;
|
|
19
21
|
/** Modules to preload before loading the app (repeatable `--require`). */
|
|
20
22
|
require: string[];
|
|
21
23
|
/** Env files to load before loading the app (repeatable `--env`). */
|
|
@@ -30,6 +32,7 @@ interface DevArgs {
|
|
|
30
32
|
interface BuildArgs {
|
|
31
33
|
appPath: string;
|
|
32
34
|
initPath?: string;
|
|
35
|
+
tsconfigPath?: string;
|
|
33
36
|
outDir: string;
|
|
34
37
|
outName: string;
|
|
35
38
|
format: 'cjs' | 'esm';
|
|
@@ -40,6 +43,7 @@ interface BuildArgs {
|
|
|
40
43
|
interface BuildEntryContentArgs {
|
|
41
44
|
entryContent: string;
|
|
42
45
|
tempEntryFilename: string;
|
|
46
|
+
tsconfigPath?: string;
|
|
43
47
|
outDir: string;
|
|
44
48
|
outName: string;
|
|
45
49
|
format: 'cjs' | 'esm';
|
package/cli-api.js
CHANGED
|
@@ -232,12 +232,14 @@ Dev options:
|
|
|
232
232
|
--shutdown-timeout <ms> Max ms to wait for in-flight requests (default: 5000)
|
|
233
233
|
--require <module> Module(s) to preload before app load (repeatable)
|
|
234
234
|
--env <path> Env file(s) to load (repeatable; existing env vars are not overridden)
|
|
235
|
+
--tsconfig <path> Tsconfig used by config-aware consumers for TS path resolution
|
|
235
236
|
--watch <paths> Comma-separated paths to watch for restart (repeatable; dev only)
|
|
236
237
|
--ext <extensions> Comma-separated extensions to watch (default: ts,js,mjs,cjs,json)
|
|
237
238
|
--delay <ms> Debounce ms before restarting on change (default: 500)
|
|
238
239
|
|
|
239
240
|
Build options:
|
|
240
241
|
--init <path> Init hook module (default export, async function)
|
|
242
|
+
--tsconfig <path> Use a custom tsconfig for bundling
|
|
241
243
|
--out-dir <path> Output directory (default: dist)
|
|
242
244
|
--out-name <name> Output filename without extension (default: app)
|
|
243
245
|
--format <cjs|esm> Output format (default: cjs)
|
|
@@ -255,6 +257,7 @@ Start options:
|
|
|
255
257
|
|
|
256
258
|
Build-serverless options:
|
|
257
259
|
--init <path> Init hook module (default export, async function)
|
|
260
|
+
--tsconfig <path> Use a custom tsconfig for bundling
|
|
258
261
|
--out-dir <path> Output directory (default: dist)
|
|
259
262
|
--out-name <name> Output filename without extension (default: handler)
|
|
260
263
|
--format <cjs|esm> Output format (default: cjs)
|
|
@@ -326,6 +329,7 @@ function parseDevArgs(argv) {
|
|
|
326
329
|
const watchPaths = [];
|
|
327
330
|
let watchExt;
|
|
328
331
|
let watchDelay;
|
|
332
|
+
let tsconfigPath;
|
|
329
333
|
let appPath;
|
|
330
334
|
for (let index = 0; index < argv.length; index += 1) {
|
|
331
335
|
const arg = argv[index];
|
|
@@ -392,6 +396,15 @@ function parseDevArgs(argv) {
|
|
|
392
396
|
}
|
|
393
397
|
continue;
|
|
394
398
|
}
|
|
399
|
+
if (arg === "--tsconfig") {
|
|
400
|
+
tsconfigPath = readValue(argv, index, arg);
|
|
401
|
+
index += 1;
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
if (arg.startsWith("--tsconfig=")) {
|
|
405
|
+
tsconfigPath = arg.slice("--tsconfig=".length);
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
395
408
|
if (arg === "--watch") {
|
|
396
409
|
index = parseRepeatable(argv, index, arg, watchPaths);
|
|
397
410
|
continue;
|
|
@@ -441,6 +454,7 @@ function parseDevArgs(argv) {
|
|
|
441
454
|
return {
|
|
442
455
|
appPath,
|
|
443
456
|
options,
|
|
457
|
+
tsconfigPath,
|
|
444
458
|
require: requireModules,
|
|
445
459
|
env: envFiles,
|
|
446
460
|
watch: watchPaths,
|
|
@@ -450,8 +464,8 @@ function parseDevArgs(argv) {
|
|
|
450
464
|
}
|
|
451
465
|
function parseStartLikeArgs(argv, subcommandName) {
|
|
452
466
|
for (const arg of argv) {
|
|
453
|
-
if (arg === "--watch" || arg.startsWith("--watch=") || arg === "--ext" || arg.startsWith("--ext=") || arg === "--delay" || arg.startsWith("--delay=")) {
|
|
454
|
-
throw new Error(`--watch/--ext/--delay are not supported with the ${subcommandName} subcommand`);
|
|
467
|
+
if (arg === "--watch" || arg.startsWith("--watch=") || arg === "--tsconfig" || arg.startsWith("--tsconfig=") || arg === "--ext" || arg.startsWith("--ext=") || arg === "--delay" || arg.startsWith("--delay=")) {
|
|
468
|
+
throw new Error(`--watch/--tsconfig/--ext/--delay are not supported with the ${subcommandName} subcommand`);
|
|
455
469
|
}
|
|
456
470
|
}
|
|
457
471
|
return parseDevArgs(argv);
|
|
@@ -479,6 +493,7 @@ function parseBuildArgs(argv, outNameDefault) {
|
|
|
479
493
|
const external = [];
|
|
480
494
|
const result = {
|
|
481
495
|
initPath: void 0,
|
|
496
|
+
tsconfigPath: void 0,
|
|
482
497
|
outDir: "dist",
|
|
483
498
|
outName: outNameDefault,
|
|
484
499
|
format: "cjs",
|
|
@@ -503,6 +518,15 @@ function parseBuildArgs(argv, outNameDefault) {
|
|
|
503
518
|
result.initPath = arg.slice("--init=".length);
|
|
504
519
|
continue;
|
|
505
520
|
}
|
|
521
|
+
if (arg === "--tsconfig") {
|
|
522
|
+
result.tsconfigPath = readValue(argv, index, arg);
|
|
523
|
+
index += 1;
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
526
|
+
if (arg.startsWith("--tsconfig=")) {
|
|
527
|
+
result.tsconfigPath = arg.slice("--tsconfig=".length);
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
506
530
|
if (arg === "--out-dir") {
|
|
507
531
|
result.outDir = readValue(argv, index, arg);
|
|
508
532
|
index += 1;
|
|
@@ -695,6 +719,7 @@ function buildChildArgs(args) {
|
|
|
695
719
|
if (args.options.signals === false) result.push("--no-signals");
|
|
696
720
|
if (args.options.shutdownTimeout !== void 0)
|
|
697
721
|
result.push("--shutdown-timeout", String(args.options.shutdownTimeout));
|
|
722
|
+
if (args.tsconfigPath !== void 0) result.push("--tsconfig", args.tsconfigPath);
|
|
698
723
|
for (const r of args.require) result.push("--require", r);
|
|
699
724
|
for (const e of args.env) result.push("--env", e);
|
|
700
725
|
return result;
|
|
@@ -802,6 +827,7 @@ async function buildBundleFromEntryContent(args) {
|
|
|
802
827
|
await build({
|
|
803
828
|
config: false,
|
|
804
829
|
entry: { [args.outName]: tempEntryPath },
|
|
830
|
+
tsconfig: args.tsconfigPath,
|
|
805
831
|
format: [args.format],
|
|
806
832
|
target: args.target,
|
|
807
833
|
outDir: args.outDir,
|
|
@@ -857,7 +883,11 @@ function applyServerlessResult(result, res) {
|
|
|
857
883
|
if (r.headers && typeof r.headers === "object") {
|
|
858
884
|
for (const [key, value] of Object.entries(r.headers)) {
|
|
859
885
|
if (value !== void 0) {
|
|
860
|
-
|
|
886
|
+
if (Array.isArray(value) && key.toLowerCase() === "set-cookie") {
|
|
887
|
+
res.setHeader(key, value);
|
|
888
|
+
} else {
|
|
889
|
+
res.setHeader(key, Array.isArray(value) ? value.join(",") : value);
|
|
890
|
+
}
|
|
861
891
|
}
|
|
862
892
|
}
|
|
863
893
|
}
|
|
@@ -918,7 +948,7 @@ async function loadHandler(handlerPath) {
|
|
|
918
948
|
}
|
|
919
949
|
return exported;
|
|
920
950
|
}
|
|
921
|
-
var import_node_url, import_node_path, import_node_fs, import_node_module, import_node_child_process,
|
|
951
|
+
var import_node_url, import_node_path, import_node_fs, import_node_module, import_node_child_process, CLI_VERSION, DEFAULT_WATCH_EXTENSIONS, DEFAULT_WATCH_DELAY, moduleRequire, TEMP_BUILD_ENTRY_FILENAME, TEMP_SERVERLESS_ENTRY_FILENAME;
|
|
922
952
|
var init_cli_utils = __esm({
|
|
923
953
|
"src/cli-utils.ts"() {
|
|
924
954
|
"use strict";
|
|
@@ -928,12 +958,11 @@ var init_cli_utils = __esm({
|
|
|
928
958
|
import_node_module = require("module");
|
|
929
959
|
import_node_child_process = require("child_process");
|
|
930
960
|
init_index();
|
|
931
|
-
import_meta = {};
|
|
932
961
|
CLI_VERSION = "0.0.0-PLACEHOLDER";
|
|
933
962
|
DEFAULT_WATCH_EXTENSIONS = ["ts", "js", "mjs", "cjs", "json"];
|
|
934
963
|
DEFAULT_WATCH_DELAY = 500;
|
|
935
964
|
moduleRequire = (0, import_node_module.createRequire)(
|
|
936
|
-
|
|
965
|
+
(0, import_node_url.pathToFileURL)((0, import_node_path.resolve)(process.cwd(), "__wtt_runtime_preload__.js"))
|
|
937
966
|
);
|
|
938
967
|
TEMP_BUILD_ENTRY_FILENAME = ".express-runtime-build-entry.ts";
|
|
939
968
|
TEMP_SERVERLESS_ENTRY_FILENAME = ".express-runtime-build-serverless-entry.ts";
|
|
@@ -999,6 +1028,7 @@ async function runBuildEntryCommand(args, options) {
|
|
|
999
1028
|
await buildBundleFromEntryContent({
|
|
1000
1029
|
entryContent: options.generateEntry(args.appPath, args.initPath),
|
|
1001
1030
|
tempEntryFilename: options.tempEntryFilename,
|
|
1031
|
+
tsconfigPath: args.tsconfigPath,
|
|
1002
1032
|
outDir: args.outDir,
|
|
1003
1033
|
outName: args.outName,
|
|
1004
1034
|
format: args.format,
|
package/cli-api.mjs
CHANGED
|
@@ -40,12 +40,14 @@ Dev options:
|
|
|
40
40
|
--shutdown-timeout <ms> Max ms to wait for in-flight requests (default: 5000)
|
|
41
41
|
--require <module> Module(s) to preload before app load (repeatable)
|
|
42
42
|
--env <path> Env file(s) to load (repeatable; existing env vars are not overridden)
|
|
43
|
+
--tsconfig <path> Tsconfig used by config-aware consumers for TS path resolution
|
|
43
44
|
--watch <paths> Comma-separated paths to watch for restart (repeatable; dev only)
|
|
44
45
|
--ext <extensions> Comma-separated extensions to watch (default: ts,js,mjs,cjs,json)
|
|
45
46
|
--delay <ms> Debounce ms before restarting on change (default: 500)
|
|
46
47
|
|
|
47
48
|
Build options:
|
|
48
49
|
--init <path> Init hook module (default export, async function)
|
|
50
|
+
--tsconfig <path> Use a custom tsconfig for bundling
|
|
49
51
|
--out-dir <path> Output directory (default: dist)
|
|
50
52
|
--out-name <name> Output filename without extension (default: app)
|
|
51
53
|
--format <cjs|esm> Output format (default: cjs)
|
|
@@ -63,6 +65,7 @@ Start options:
|
|
|
63
65
|
|
|
64
66
|
Build-serverless options:
|
|
65
67
|
--init <path> Init hook module (default export, async function)
|
|
68
|
+
--tsconfig <path> Use a custom tsconfig for bundling
|
|
66
69
|
--out-dir <path> Output directory (default: dist)
|
|
67
70
|
--out-name <name> Output filename without extension (default: handler)
|
|
68
71
|
--format <cjs|esm> Output format (default: cjs)
|
|
@@ -136,6 +139,7 @@ function parseDevArgs(argv) {
|
|
|
136
139
|
const watchPaths = [];
|
|
137
140
|
let watchExt;
|
|
138
141
|
let watchDelay;
|
|
142
|
+
let tsconfigPath;
|
|
139
143
|
let appPath;
|
|
140
144
|
for (let index = 0; index < argv.length; index += 1) {
|
|
141
145
|
const arg = argv[index];
|
|
@@ -202,6 +206,15 @@ function parseDevArgs(argv) {
|
|
|
202
206
|
}
|
|
203
207
|
continue;
|
|
204
208
|
}
|
|
209
|
+
if (arg === "--tsconfig") {
|
|
210
|
+
tsconfigPath = readValue(argv, index, arg);
|
|
211
|
+
index += 1;
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (arg.startsWith("--tsconfig=")) {
|
|
215
|
+
tsconfigPath = arg.slice("--tsconfig=".length);
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
205
218
|
if (arg === "--watch") {
|
|
206
219
|
index = parseRepeatable(argv, index, arg, watchPaths);
|
|
207
220
|
continue;
|
|
@@ -251,6 +264,7 @@ function parseDevArgs(argv) {
|
|
|
251
264
|
return {
|
|
252
265
|
appPath,
|
|
253
266
|
options,
|
|
267
|
+
tsconfigPath,
|
|
254
268
|
require: requireModules,
|
|
255
269
|
env: envFiles,
|
|
256
270
|
watch: watchPaths,
|
|
@@ -260,8 +274,8 @@ function parseDevArgs(argv) {
|
|
|
260
274
|
}
|
|
261
275
|
function parseStartLikeArgs(argv, subcommandName) {
|
|
262
276
|
for (const arg of argv) {
|
|
263
|
-
if (arg === "--watch" || arg.startsWith("--watch=") || arg === "--ext" || arg.startsWith("--ext=") || arg === "--delay" || arg.startsWith("--delay=")) {
|
|
264
|
-
throw new Error(`--watch/--ext/--delay are not supported with the ${subcommandName} subcommand`);
|
|
277
|
+
if (arg === "--watch" || arg.startsWith("--watch=") || arg === "--tsconfig" || arg.startsWith("--tsconfig=") || arg === "--ext" || arg.startsWith("--ext=") || arg === "--delay" || arg.startsWith("--delay=")) {
|
|
278
|
+
throw new Error(`--watch/--tsconfig/--ext/--delay are not supported with the ${subcommandName} subcommand`);
|
|
265
279
|
}
|
|
266
280
|
}
|
|
267
281
|
return parseDevArgs(argv);
|
|
@@ -289,6 +303,7 @@ function parseBuildArgs(argv, outNameDefault) {
|
|
|
289
303
|
const external = [];
|
|
290
304
|
const result = {
|
|
291
305
|
initPath: void 0,
|
|
306
|
+
tsconfigPath: void 0,
|
|
292
307
|
outDir: "dist",
|
|
293
308
|
outName: outNameDefault,
|
|
294
309
|
format: "cjs",
|
|
@@ -313,6 +328,15 @@ function parseBuildArgs(argv, outNameDefault) {
|
|
|
313
328
|
result.initPath = arg.slice("--init=".length);
|
|
314
329
|
continue;
|
|
315
330
|
}
|
|
331
|
+
if (arg === "--tsconfig") {
|
|
332
|
+
result.tsconfigPath = readValue(argv, index, arg);
|
|
333
|
+
index += 1;
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
if (arg.startsWith("--tsconfig=")) {
|
|
337
|
+
result.tsconfigPath = arg.slice("--tsconfig=".length);
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
316
340
|
if (arg === "--out-dir") {
|
|
317
341
|
result.outDir = readValue(argv, index, arg);
|
|
318
342
|
index += 1;
|
|
@@ -494,7 +518,7 @@ function loadEnvFiles(paths) {
|
|
|
494
518
|
}
|
|
495
519
|
}
|
|
496
520
|
var moduleRequire = createRequire(
|
|
497
|
-
|
|
521
|
+
pathToFileURL(pathResolve(process.cwd(), "__wtt_runtime_preload__.js"))
|
|
498
522
|
);
|
|
499
523
|
async function preloadModules(modules) {
|
|
500
524
|
for (const mod of modules) {
|
|
@@ -508,6 +532,7 @@ function buildChildArgs(args) {
|
|
|
508
532
|
if (args.options.signals === false) result.push("--no-signals");
|
|
509
533
|
if (args.options.shutdownTimeout !== void 0)
|
|
510
534
|
result.push("--shutdown-timeout", String(args.options.shutdownTimeout));
|
|
535
|
+
if (args.tsconfigPath !== void 0) result.push("--tsconfig", args.tsconfigPath);
|
|
511
536
|
for (const r of args.require) result.push("--require", r);
|
|
512
537
|
for (const e of args.env) result.push("--env", e);
|
|
513
538
|
return result;
|
|
@@ -617,6 +642,7 @@ async function buildBundleFromEntryContent(args) {
|
|
|
617
642
|
await build({
|
|
618
643
|
config: false,
|
|
619
644
|
entry: { [args.outName]: tempEntryPath },
|
|
645
|
+
tsconfig: args.tsconfigPath,
|
|
620
646
|
format: [args.format],
|
|
621
647
|
target: args.target,
|
|
622
648
|
outDir: args.outDir,
|
|
@@ -672,7 +698,11 @@ function applyServerlessResult(result, res) {
|
|
|
672
698
|
if (r.headers && typeof r.headers === "object") {
|
|
673
699
|
for (const [key, value] of Object.entries(r.headers)) {
|
|
674
700
|
if (value !== void 0) {
|
|
675
|
-
|
|
701
|
+
if (Array.isArray(value) && key.toLowerCase() === "set-cookie") {
|
|
702
|
+
res.setHeader(key, value);
|
|
703
|
+
} else {
|
|
704
|
+
res.setHeader(key, Array.isArray(value) ? value.join(",") : value);
|
|
705
|
+
}
|
|
676
706
|
}
|
|
677
707
|
}
|
|
678
708
|
}
|
|
@@ -762,6 +792,7 @@ async function runBuildEntryCommand(args, options) {
|
|
|
762
792
|
await buildBundleFromEntryContent({
|
|
763
793
|
entryContent: options.generateEntry(args.appPath, args.initPath),
|
|
764
794
|
tempEntryFilename: options.tempEntryFilename,
|
|
795
|
+
tsconfigPath: args.tsconfigPath,
|
|
765
796
|
outDir: args.outDir,
|
|
766
797
|
outName: args.outName,
|
|
767
798
|
format: args.format,
|
package/cli.js
CHANGED
|
@@ -232,12 +232,14 @@ Dev options:
|
|
|
232
232
|
--shutdown-timeout <ms> Max ms to wait for in-flight requests (default: 5000)
|
|
233
233
|
--require <module> Module(s) to preload before app load (repeatable)
|
|
234
234
|
--env <path> Env file(s) to load (repeatable; existing env vars are not overridden)
|
|
235
|
+
--tsconfig <path> Tsconfig used by config-aware consumers for TS path resolution
|
|
235
236
|
--watch <paths> Comma-separated paths to watch for restart (repeatable; dev only)
|
|
236
237
|
--ext <extensions> Comma-separated extensions to watch (default: ts,js,mjs,cjs,json)
|
|
237
238
|
--delay <ms> Debounce ms before restarting on change (default: 500)
|
|
238
239
|
|
|
239
240
|
Build options:
|
|
240
241
|
--init <path> Init hook module (default export, async function)
|
|
242
|
+
--tsconfig <path> Use a custom tsconfig for bundling
|
|
241
243
|
--out-dir <path> Output directory (default: dist)
|
|
242
244
|
--out-name <name> Output filename without extension (default: app)
|
|
243
245
|
--format <cjs|esm> Output format (default: cjs)
|
|
@@ -255,6 +257,7 @@ Start options:
|
|
|
255
257
|
|
|
256
258
|
Build-serverless options:
|
|
257
259
|
--init <path> Init hook module (default export, async function)
|
|
260
|
+
--tsconfig <path> Use a custom tsconfig for bundling
|
|
258
261
|
--out-dir <path> Output directory (default: dist)
|
|
259
262
|
--out-name <name> Output filename without extension (default: handler)
|
|
260
263
|
--format <cjs|esm> Output format (default: cjs)
|
|
@@ -326,6 +329,7 @@ function parseDevArgs(argv) {
|
|
|
326
329
|
const watchPaths = [];
|
|
327
330
|
let watchExt;
|
|
328
331
|
let watchDelay;
|
|
332
|
+
let tsconfigPath;
|
|
329
333
|
let appPath;
|
|
330
334
|
for (let index = 0; index < argv.length; index += 1) {
|
|
331
335
|
const arg = argv[index];
|
|
@@ -392,6 +396,15 @@ function parseDevArgs(argv) {
|
|
|
392
396
|
}
|
|
393
397
|
continue;
|
|
394
398
|
}
|
|
399
|
+
if (arg === "--tsconfig") {
|
|
400
|
+
tsconfigPath = readValue(argv, index, arg);
|
|
401
|
+
index += 1;
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
if (arg.startsWith("--tsconfig=")) {
|
|
405
|
+
tsconfigPath = arg.slice("--tsconfig=".length);
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
395
408
|
if (arg === "--watch") {
|
|
396
409
|
index = parseRepeatable(argv, index, arg, watchPaths);
|
|
397
410
|
continue;
|
|
@@ -441,6 +454,7 @@ function parseDevArgs(argv) {
|
|
|
441
454
|
return {
|
|
442
455
|
appPath,
|
|
443
456
|
options,
|
|
457
|
+
tsconfigPath,
|
|
444
458
|
require: requireModules,
|
|
445
459
|
env: envFiles,
|
|
446
460
|
watch: watchPaths,
|
|
@@ -450,8 +464,8 @@ function parseDevArgs(argv) {
|
|
|
450
464
|
}
|
|
451
465
|
function parseStartLikeArgs(argv, subcommandName) {
|
|
452
466
|
for (const arg of argv) {
|
|
453
|
-
if (arg === "--watch" || arg.startsWith("--watch=") || arg === "--ext" || arg.startsWith("--ext=") || arg === "--delay" || arg.startsWith("--delay=")) {
|
|
454
|
-
throw new Error(`--watch/--ext/--delay are not supported with the ${subcommandName} subcommand`);
|
|
467
|
+
if (arg === "--watch" || arg.startsWith("--watch=") || arg === "--tsconfig" || arg.startsWith("--tsconfig=") || arg === "--ext" || arg.startsWith("--ext=") || arg === "--delay" || arg.startsWith("--delay=")) {
|
|
468
|
+
throw new Error(`--watch/--tsconfig/--ext/--delay are not supported with the ${subcommandName} subcommand`);
|
|
455
469
|
}
|
|
456
470
|
}
|
|
457
471
|
return parseDevArgs(argv);
|
|
@@ -479,6 +493,7 @@ function parseBuildArgs(argv, outNameDefault) {
|
|
|
479
493
|
const external = [];
|
|
480
494
|
const result = {
|
|
481
495
|
initPath: void 0,
|
|
496
|
+
tsconfigPath: void 0,
|
|
482
497
|
outDir: "dist",
|
|
483
498
|
outName: outNameDefault,
|
|
484
499
|
format: "cjs",
|
|
@@ -503,6 +518,15 @@ function parseBuildArgs(argv, outNameDefault) {
|
|
|
503
518
|
result.initPath = arg.slice("--init=".length);
|
|
504
519
|
continue;
|
|
505
520
|
}
|
|
521
|
+
if (arg === "--tsconfig") {
|
|
522
|
+
result.tsconfigPath = readValue(argv, index, arg);
|
|
523
|
+
index += 1;
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
526
|
+
if (arg.startsWith("--tsconfig=")) {
|
|
527
|
+
result.tsconfigPath = arg.slice("--tsconfig=".length);
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
506
530
|
if (arg === "--out-dir") {
|
|
507
531
|
result.outDir = readValue(argv, index, arg);
|
|
508
532
|
index += 1;
|
|
@@ -695,6 +719,7 @@ function buildChildArgs(args) {
|
|
|
695
719
|
if (args.options.signals === false) result.push("--no-signals");
|
|
696
720
|
if (args.options.shutdownTimeout !== void 0)
|
|
697
721
|
result.push("--shutdown-timeout", String(args.options.shutdownTimeout));
|
|
722
|
+
if (args.tsconfigPath !== void 0) result.push("--tsconfig", args.tsconfigPath);
|
|
698
723
|
for (const r of args.require) result.push("--require", r);
|
|
699
724
|
for (const e of args.env) result.push("--env", e);
|
|
700
725
|
return result;
|
|
@@ -802,6 +827,7 @@ async function buildBundleFromEntryContent(args) {
|
|
|
802
827
|
await build({
|
|
803
828
|
config: false,
|
|
804
829
|
entry: { [args.outName]: tempEntryPath },
|
|
830
|
+
tsconfig: args.tsconfigPath,
|
|
805
831
|
format: [args.format],
|
|
806
832
|
target: args.target,
|
|
807
833
|
outDir: args.outDir,
|
|
@@ -857,7 +883,11 @@ function applyServerlessResult(result, res) {
|
|
|
857
883
|
if (r.headers && typeof r.headers === "object") {
|
|
858
884
|
for (const [key, value] of Object.entries(r.headers)) {
|
|
859
885
|
if (value !== void 0) {
|
|
860
|
-
|
|
886
|
+
if (Array.isArray(value) && key.toLowerCase() === "set-cookie") {
|
|
887
|
+
res.setHeader(key, value);
|
|
888
|
+
} else {
|
|
889
|
+
res.setHeader(key, Array.isArray(value) ? value.join(",") : value);
|
|
890
|
+
}
|
|
861
891
|
}
|
|
862
892
|
}
|
|
863
893
|
}
|
|
@@ -918,7 +948,7 @@ async function loadHandler(handlerPath) {
|
|
|
918
948
|
}
|
|
919
949
|
return exported;
|
|
920
950
|
}
|
|
921
|
-
var import_node_url, import_node_path, import_node_fs, import_node_module, import_node_child_process,
|
|
951
|
+
var import_node_url, import_node_path, import_node_fs, import_node_module, import_node_child_process, CLI_VERSION, DEFAULT_WATCH_EXTENSIONS, DEFAULT_WATCH_DELAY, moduleRequire, TEMP_BUILD_ENTRY_FILENAME, TEMP_SERVERLESS_ENTRY_FILENAME;
|
|
922
952
|
var init_cli_utils = __esm({
|
|
923
953
|
"src/cli-utils.ts"() {
|
|
924
954
|
"use strict";
|
|
@@ -928,12 +958,11 @@ var init_cli_utils = __esm({
|
|
|
928
958
|
import_node_module = require("module");
|
|
929
959
|
import_node_child_process = require("child_process");
|
|
930
960
|
init_src();
|
|
931
|
-
import_meta = {};
|
|
932
961
|
CLI_VERSION = "0.0.0-PLACEHOLDER";
|
|
933
962
|
DEFAULT_WATCH_EXTENSIONS = ["ts", "js", "mjs", "cjs", "json"];
|
|
934
963
|
DEFAULT_WATCH_DELAY = 500;
|
|
935
964
|
moduleRequire = (0, import_node_module.createRequire)(
|
|
936
|
-
|
|
965
|
+
(0, import_node_url.pathToFileURL)((0, import_node_path.resolve)(process.cwd(), "__wtt_runtime_preload__.js"))
|
|
937
966
|
);
|
|
938
967
|
TEMP_BUILD_ENTRY_FILENAME = ".express-runtime-build-entry.ts";
|
|
939
968
|
TEMP_SERVERLESS_ENTRY_FILENAME = ".express-runtime-build-serverless-entry.ts";
|
|
@@ -998,6 +1027,7 @@ async function runBuildEntryCommand(args, options) {
|
|
|
998
1027
|
await buildBundleFromEntryContent({
|
|
999
1028
|
entryContent: options.generateEntry(args.appPath, args.initPath),
|
|
1000
1029
|
tempEntryFilename: options.tempEntryFilename,
|
|
1030
|
+
tsconfigPath: args.tsconfigPath,
|
|
1001
1031
|
outDir: args.outDir,
|
|
1002
1032
|
outName: args.outName,
|
|
1003
1033
|
format: args.format,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@web-ts-toolkit/express-runtime",
|
|
3
3
|
"description": "Express app factory plus serverless handler and local dev server helpers",
|
|
4
4
|
"homepage": "https://web-ts-toolkit.pages.dev/docs/packages/express-runtime",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.29.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"keywords": [
|
|
8
8
|
"express",
|