Compare commits

..

6 Commits

Author SHA1 Message Date
91b3e273de v3.2.1
Some checks failed
Default (tags) / security (push) Successful in 45s
Default (tags) / test (push) Failing after 4m3s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-03-03 22:38:31 +00:00
e6a7b352f3 fix(watcher): ensure child processes are killed and awaited during shutdown; improve cleanup handlers; bump smartshell dependency to ^3.3.2 2026-03-03 22:38:31 +00:00
8c1b306313 v3.2.0
Some checks failed
Default (tags) / security (push) Successful in 33s
Default (tags) / test (push) Failing after 4m5s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-02-24 19:02:39 +00:00
a893e7a771 feat(bundle): add configurable bundle output modes and bundler options (support base64ts, production builds, includeFiles, maxLineLength) and route non-default outputs to a CustomBundleHandler 2026-02-24 19:02:39 +00:00
c330420eea v3.1.0
Some checks failed
Default (tags) / security (push) Successful in 41s
Default (tags) / test (push) Failing after 4m2s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-02-05 14:58:27 +00:00
df8b164434 feat(dev-server): add no-cache headers to built-in development server; update docs and bump dependencies 2026-02-05 14:58:27 +00:00
9 changed files with 192 additions and 72 deletions

View File

@@ -1,5 +1,28 @@
# Changelog
## 2026-03-03 - 3.2.1 - fix(watcher)
ensure child processes are killed and awaited during shutdown; improve cleanup handlers; bump smartshell dependency to ^3.3.2
- Await child process kill() calls in restart and stop to avoid race conditions and ensure proper termination.
- Add last-resort synchronous SIGKILL in process 'exit' handler to terminate orphaned child processes.
- Make SIGINT and timeout handlers async and await stop() to perform a clean shutdown before exiting.
- Bump @push.rocks/smartshell from ^3.3.0 to ^3.3.2 in package.json.
## 2026-02-24 - 3.2.0 - feat(bundle)
add configurable bundle output modes and bundler options (support base64ts, production builds, includeFiles, maxLineLength) and route non-default outputs to a CustomBundleHandler
- Added new ITswatchConfig fields: outputMode, bundler, production, includeFiles, maxLineLength
- tswatch now creates a CustomBundleHandler and uses it when outputMode is not 'bundle' (e.g. base64ts)
- Default bundling path now reads bundler and production from bundleConfig (defaults to 'esbuild' and false)
- Bumped dependency @git.zone/tsbundle to ^2.9.0
## 2026-02-05 - 3.1.0 - feat(dev-server)
add no-cache headers to built-in development server; update docs and bump dependencies
- Introduce noCache: true in ts/tswatch.classes.tswatch.ts to send Cache-Control: no-store, no-cache during development (prevents browser caching).
- Update documentation to describe no-caching behavior (readme.md and readme.hints.md).
- Bump dependencies: @git.zone/tstest ^3.1.8, @types/node ^25.2.1, @push.rocks/npmextra ^5.3.3, @push.rocks/taskbuffer ^4.2.0.
## 2026-01-24 - 3.0.1 - fix(deps)
downgrade @push.rocks/smartinteract to ^2.0.16

View File

@@ -1,6 +1,6 @@
{
"name": "@git.zone/tswatch",
"version": "3.0.1",
"version": "3.2.1",
"private": false,
"description": "A development tool for automatically watching and re-compiling TypeScript projects upon detecting file changes, enhancing developer workflows.",
"exports": {
@@ -19,25 +19,25 @@
},
"devDependencies": {
"@git.zone/tsbuild": "^4.1.2",
"@git.zone/tstest": "^3.1.6",
"@types/node": "^25.0.10"
"@git.zone/tstest": "^3.1.8",
"@types/node": "^25.2.1"
},
"dependencies": {
"@api.global/typedserver": "^8.3.0",
"@git.zone/tsbundle": "^2.8.3",
"@git.zone/tsbundle": "^2.9.0",
"@git.zone/tsrun": "^2.0.1",
"@push.rocks/early": "^4.0.4",
"@push.rocks/lik": "^6.2.2",
"@push.rocks/npmextra": "^5.1.2",
"@push.rocks/npmextra": "^5.3.3",
"@push.rocks/smartcli": "^4.0.20",
"@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartfs": "^1.3.1",
"@push.rocks/smartinteract": "^2.0.16",
"@push.rocks/smartlog": "^3.1.10",
"@push.rocks/smartlog-destination-local": "^9.0.2",
"@push.rocks/smartshell": "^3.3.0",
"@push.rocks/smartshell": "^3.3.2",
"@push.rocks/smartwatch": "^6.3.0",
"@push.rocks/taskbuffer": "^3.5.0"
"@push.rocks/taskbuffer": "^4.2.0"
},
"files": [
"ts/**/*",

167
pnpm-lock.yaml generated
View File

@@ -12,8 +12,8 @@ importers:
specifier: ^8.3.0
version: 8.3.0(@tiptap/pm@2.27.2)
'@git.zone/tsbundle':
specifier: ^2.8.3
version: 2.8.3
specifier: ^2.9.0
version: 2.9.0
'@git.zone/tsrun':
specifier: ^2.0.1
version: 2.0.1
@@ -24,7 +24,7 @@ importers:
specifier: ^6.2.2
version: 6.2.2
'@push.rocks/npmextra':
specifier: ^5.1.2
specifier: ^5.3.3
version: 5.3.3
'@push.rocks/smartcli':
specifier: ^4.0.20
@@ -45,24 +45,24 @@ importers:
specifier: ^9.0.2
version: 9.0.2
'@push.rocks/smartshell':
specifier: ^3.3.0
version: 3.3.0
specifier: ^3.3.2
version: 3.3.2
'@push.rocks/smartwatch':
specifier: ^6.3.0
version: 6.3.0
'@push.rocks/taskbuffer':
specifier: ^3.5.0
version: 3.5.0
specifier: ^4.2.0
version: 4.2.0
devDependencies:
'@git.zone/tsbuild':
specifier: ^4.1.2
version: 4.1.2
'@git.zone/tstest':
specifier: ^3.1.6
version: 3.1.6(@aws-sdk/credential-providers@3.855.0)(@push.rocks/smartserve@2.0.1)(socks@2.8.7)(typescript@5.9.3)
specifier: ^3.1.8
version: 3.1.8(@aws-sdk/credential-providers@3.855.0)(@push.rocks/smartserve@2.0.1)(socks@2.8.7)(typescript@5.9.3)
'@types/node':
specifier: ^25.0.10
version: 25.0.10
specifier: ^25.2.1
version: 25.2.1
packages:
@@ -426,12 +426,18 @@ packages:
'@design.estate/dees-domtools@2.3.7':
resolution: {integrity: sha512-MXoDBrP7JTOpni8b12aFXHJKnKBoQppM8cYBuL9cesRmCVGdB7p39XMRQ7dRyMhmmyr66L3cOczhiCV6febCwg==}
'@design.estate/dees-domtools@2.3.8':
resolution: {integrity: sha512-jUG9GMvPxKMwmRIZ9oLTL3c8hHvHuiwIk8cTrYnuZzGO/uJJ5/czk9o6LRXUuCOOG7TRLtqgOpK8EEQgaadfZA==}
'@design.estate/dees-element@2.1.3':
resolution: {integrity: sha512-TjXWxVcdSPaT1IOk31ckfxvAZnJLuTxhFGsNCKoh63/UE2FVf6slp8//UFvN+ADigiA9ZsY0azkY99XbJCwDDA==}
'@design.estate/dees-element@2.1.5':
resolution: {integrity: sha512-czUOFvBiUKi34I+/keDRDc71fuORZS0NfbSuD2jJ4D1ODiTPjaZ6A6SkdQ2QqCEzVsx73XF99Pu8pxPnaOLnHg==}
'@design.estate/dees-element@2.1.6':
resolution: {integrity: sha512-7zyHkUjB8UEQgT9VbB2IJtc/yuPt9CI5JGel3b6BxA1kecY64ceIjFvof1uIkc0QP8q2fMLLY45r1c+9zDTjzg==}
'@design.estate/dees-wcctools@3.7.1':
resolution: {integrity: sha512-BiNWghUoC05RTQOGVCTK+wis6d18LyLY+2p8vHC0q2OBw9hrPoY8k9EplpQgY40MvP0sTXWUwaa7VPXra8ASjA==}
@@ -624,8 +630,8 @@ packages:
resolution: {integrity: sha512-S518ulKveO76pS6jrAELrnFaCw5nDAIZD9j6QzVmLYDiZuJmlRwPK3/2E8ugQ+b7ffpkwJ9MT685ooEGDcWQ4Q==}
hasBin: true
'@git.zone/tsbundle@2.8.3':
resolution: {integrity: sha512-9q+KbVGKUTDNND+jDiJuk4bPH/mtiA2B0EWtV+/NyvgZfIbpe/ItHemyIvXB4RAqncMdBhzXquCFCvGjAhwVIQ==}
'@git.zone/tsbundle@2.9.0':
resolution: {integrity: sha512-itXX/oiJjrRHUlIGTHUEqSwPuGwsG4Cq8kh7aqFOm8mYzJwtXYE1gBqLJTWZma6gI5n+xAk5qTxTyfikuPgWQA==}
hasBin: true
'@git.zone/tspublish@1.11.0':
@@ -636,8 +642,8 @@ packages:
resolution: {integrity: sha512-NEcnsjvlC1o3Z6SS3VhKCf6Ev+Sh4EAinmggslrIR/ppMrvjDbXNFXoyr3PB+GLeSAR0JRZ1fGvVYjpEzjBdIg==}
hasBin: true
'@git.zone/tstest@3.1.6':
resolution: {integrity: sha512-xRGc6wO4rJ6mohPCMIBDRH+oNjiIvX6Jeo8v/Y5o5VyKSHFmqol7FCKSBrojMcqgBpESnLHFPJAAOmT9W3JV8Q==}
'@git.zone/tstest@3.1.8':
resolution: {integrity: sha512-nmiLGeOkKMkLDyIk5BUBLx5ExskFbKHKlPdrWCARPVFkU4cAAiuIyJWVfLwISoS0TO/zSInLqArPwIc76yvaNw==}
hasBin: true
'@happy-dom/global-registrator@15.11.7':
@@ -966,12 +972,12 @@ packages:
'@push.rocks/smarterror@2.0.1':
resolution: {integrity: sha512-iCcH1D8tlDJgMFsaJ6lhdOTKhbU0KoprNv9MRP9o7691QOx4JEDXiHtr/lNtxVo8BUtdb9CF6kazaknO9KuORA==}
'@push.rocks/smartexit@1.0.23':
resolution: {integrity: sha512-WmwKYcwbHBByoABhHHB+PAjr5475AtD/xBh1mDcqPrFsOOUOZq3BBUdpq25wI3ccu/SZB5IwaimiVzadls6HkA==}
'@push.rocks/smartexit@1.1.0':
resolution: {integrity: sha512-GD8VLIbxQuwvhPXwK4eH162XAYSj+M3wGKWGNO3i1iY4bj8P3BARcgsWx6/ntN3aCo5ygWtrevrfD5iecYY2Ng==}
'@push.rocks/smartexit@1.1.1':
resolution: {integrity: sha512-UwcVJbp7vzzDM9RQmnfTaVOJ+DK127lAC5gwyfKU2GfPAv0Jng62Sv601otP+jnly9nRt5fUuttNHDl34Mjn3g==}
'@push.rocks/smartexpect@2.5.0':
resolution: {integrity: sha512-yoyuCoQ3tTiAriuvF+/09fNbVfFnacudL2SwHSzPhX/ugaE7VTSWXQ9A34eKOWvil0MPyDcOY36fVZDxvrPd8A==}
@@ -1092,8 +1098,8 @@ packages:
'@push.rocks/smartserve@2.0.1':
resolution: {integrity: sha512-YQb2qexfCzCqOlLWBBXKMg6xG4zahCPAxomz/KEKAwHtW6wMTtuHKSTSkRTQ0vl9jssLMAmRz2OyafiL9XGJXQ==}
'@push.rocks/smartshell@3.3.0':
resolution: {integrity: sha512-m0w618H6YBs+vXGz1CgS4nPi5CUAnqRtckcS9/koGwfcIx1IpjqmiP47BoCTbdgcv0IPUxQVBG1IXTHPuZ8Z5g==}
'@push.rocks/smartshell@3.3.2':
resolution: {integrity: sha512-xDakRUYBO/WDXlBvS2IbreAvXke/oUul2hcna953a1Bv5gMPOSVBVFsFIaUEqTzAQ5/1YjjEhbnjPeXq87jgkA==}
'@push.rocks/smartsitemap@2.0.4':
resolution: {integrity: sha512-76dYWG/o/EjV4vYCK7ZKM35T9xgrI+oHEiiIE6E2MDaFIU6QnSfciTfbscH5nc0vxx8Ah+I0HPEJO94BM2S39w==}
@@ -1144,6 +1150,9 @@ packages:
'@push.rocks/taskbuffer@3.5.0':
resolution: {integrity: sha512-Y9WwIEIyp6oVFdj06j84tfrZIvjhbMb3DF52rYxlTeYLk3W7RPhSg1bGPCbtkXWeKdBrSe37V90BkOG7Qq8Pqg==}
'@push.rocks/taskbuffer@4.2.0':
resolution: {integrity: sha512-ttoBe5y/WXkAo5/wSMcC/Y4Zbyw4XG8kwAsEaqnAPCxa3M9MI1oV/yM1e9gU1IH97HVPidzbTxRU5/PcHDdUsg==}
'@push.rocks/webrequest@3.0.37':
resolution: {integrity: sha512-fLN7kP6GeHFxE4UH4r9C9pjcQb0QkJxHeAMwXvbOqB9hh0MFNKhtGU7GoaTn8SVRGRMPc9UqZVNwo6u5l8Wn0A==}
@@ -1863,8 +1872,8 @@ packages:
'@types/node@22.19.7':
resolution: {integrity: sha512-MciR4AKGHWl7xwxkBa6xUGxQJ4VBOmPTF7sL+iGzuahOFaO0jHCsuEfS80pan1ef4gWId1oWOweIhrDEYLuaOw==}
'@types/node@25.0.10':
resolution: {integrity: sha512-zWW5KPngR/yvakJgGOmZ5vTBemDoSqF3AcV/LrO5u5wTWyEAVVh+IT39G4gtyAkh3CtTZs8aX/yRM82OfzHJRg==}
'@types/node@25.2.1':
resolution: {integrity: sha512-CPrnr8voK8vC6eEtyRzvMpgp3VyVRhgclonE7qYi6P9sXwYb59ucfrnmFBTaP0yUi8Gk4yZg/LlTJULGxvTNsg==}
'@types/ping@0.4.4':
resolution: {integrity: sha512-ifvo6w2f5eJYlXm+HiVx67iJe8WZp87sfa683nlqED5Vnt9Z93onkokNoWqOG21EaE8fMxyKPobE+mkPEyxsdw==}
@@ -5373,6 +5382,32 @@ snapshots:
- supports-color
- vue
'@design.estate/dees-domtools@2.3.8':
dependencies:
'@api.global/typedrequest': 3.2.5
'@design.estate/dees-comms': 1.0.30
'@push.rocks/lik': 6.2.2
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartjson': 5.2.0
'@push.rocks/smartmarkdown': 3.0.3
'@push.rocks/smartpromise': 4.2.3
'@push.rocks/smartrouter': 1.3.3
'@push.rocks/smartrx': 3.0.10
'@push.rocks/smartstate': 2.0.27
'@push.rocks/smartstring': 4.1.0
'@push.rocks/smarturl': 3.1.0
'@push.rocks/webrequest': 3.0.37
'@push.rocks/websetup': 3.0.19
'@push.rocks/webstore': 2.0.20
'@tempfix/lenis': 1.3.20
lit: 3.3.2
sweet-scroll: 4.0.0
transitivePeerDependencies:
- '@nuxt/kit'
- react
- supports-color
- vue
'@design.estate/dees-element@2.1.3':
dependencies:
'@design.estate/dees-domtools': 2.3.6
@@ -5397,6 +5432,18 @@ snapshots:
- supports-color
- vue
'@design.estate/dees-element@2.1.6':
dependencies:
'@design.estate/dees-domtools': 2.3.8
'@push.rocks/isounique': 1.0.5
'@push.rocks/smartrx': 3.0.10
lit: 3.3.2
transitivePeerDependencies:
- '@nuxt/kit'
- react
- supports-color
- vue
'@design.estate/dees-wcctools@3.7.1':
dependencies:
'@design.estate/dees-domtools': 2.3.7
@@ -5542,7 +5589,7 @@ snapshots:
- supports-color
- vue
'@git.zone/tsbundle@2.8.3':
'@git.zone/tsbundle@2.9.0':
dependencies:
'@push.rocks/early': 4.0.4
'@push.rocks/npmextra': 5.3.3
@@ -5580,7 +5627,7 @@ snapshots:
'@push.rocks/smartnpm': 2.0.6
'@push.rocks/smartpath': 6.0.0
'@push.rocks/smartrequest': 5.0.1
'@push.rocks/smartshell': 3.3.0
'@push.rocks/smartshell': 3.3.2
transitivePeerDependencies:
- '@nuxt/kit'
- aws-crt
@@ -5593,13 +5640,13 @@ snapshots:
'@git.zone/tsrun@2.0.1':
dependencies:
'@push.rocks/smartfile': 13.1.2
'@push.rocks/smartshell': 3.3.0
'@push.rocks/smartshell': 3.3.2
tsx: 4.21.0
'@git.zone/tstest@3.1.6(@aws-sdk/credential-providers@3.855.0)(@push.rocks/smartserve@2.0.1)(socks@2.8.7)(typescript@5.9.3)':
'@git.zone/tstest@3.1.8(@aws-sdk/credential-providers@3.855.0)(@push.rocks/smartserve@2.0.1)(socks@2.8.7)(typescript@5.9.3)':
dependencies:
'@api.global/typedserver': 3.0.80(@push.rocks/smartserve@2.0.1)
'@git.zone/tsbundle': 2.8.3
'@git.zone/tsbundle': 2.9.0
'@git.zone/tsrun': 2.0.1
'@push.rocks/consolecolor': 2.0.3
'@push.rocks/qenv': 6.1.3
@@ -5618,7 +5665,7 @@ snapshots:
'@push.rocks/smartpromise': 4.2.3
'@push.rocks/smartrequest': 5.0.1
'@push.rocks/smarts3': 3.0.3
'@push.rocks/smartshell': 3.3.0
'@push.rocks/smartshell': 3.3.2
'@push.rocks/smarttime': 4.1.1
'@types/ws': 8.18.1
figures: 6.1.0
@@ -6260,14 +6307,14 @@ snapshots:
clean-stack: 1.3.0
make-error-cause: 2.3.0
'@push.rocks/smartexit@1.0.23':
'@push.rocks/smartexit@1.1.0':
dependencies:
'@push.rocks/lik': 6.2.2
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartpromise': 4.2.3
tree-kill: 1.2.2
'@push.rocks/smartexit@1.1.0':
'@push.rocks/smartexit@1.1.1':
dependencies:
'@push.rocks/lik': 6.2.2
'@push.rocks/smartdelay': 3.0.5
@@ -6532,7 +6579,7 @@ snapshots:
'@push.rocks/smartpuppeteer@2.0.5(typescript@5.9.3)':
dependencies:
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartshell': 3.3.0
'@push.rocks/smartshell': 3.3.2
puppeteer: 24.36.0(typescript@5.9.3)
tree-kill: 1.2.2
transitivePeerDependencies:
@@ -6603,10 +6650,10 @@ snapshots:
- bufferutil
- utf-8-validate
'@push.rocks/smartshell@3.3.0':
'@push.rocks/smartshell@3.3.2':
dependencies:
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartexit': 1.0.23
'@push.rocks/smartexit': 1.1.1
'@push.rocks/smartpromise': 4.2.3
'@types/which': 3.0.4
tree-kill: 1.2.2
@@ -6748,6 +6795,22 @@ snapshots:
- supports-color
- vue
'@push.rocks/taskbuffer@4.2.0':
dependencies:
'@design.estate/dees-element': 2.1.6
'@push.rocks/lik': 6.2.2
'@push.rocks/smartdelay': 3.0.5
'@push.rocks/smartlog': 3.1.10
'@push.rocks/smartpromise': 4.2.3
'@push.rocks/smartrx': 3.0.10
'@push.rocks/smarttime': 4.1.1
'@push.rocks/smartunique': 3.0.9
transitivePeerDependencies:
- '@nuxt/kit'
- react
- supports-color
- vue
'@push.rocks/webrequest@3.0.37':
dependencies:
'@push.rocks/smartdelay': 3.0.5
@@ -7483,27 +7546,27 @@ snapshots:
'@types/bn.js@5.2.0':
dependencies:
'@types/node': 25.0.10
'@types/node': 25.2.1
'@types/body-parser@1.19.6':
dependencies:
'@types/connect': 3.4.38
'@types/node': 25.0.10
'@types/node': 25.2.1
'@types/buffer-json@2.0.3': {}
'@types/clean-css@4.2.11':
dependencies:
'@types/node': 25.0.10
'@types/node': 25.2.1
source-map: 0.6.1
'@types/connect@3.4.38':
dependencies:
'@types/node': 25.0.10
'@types/node': 25.2.1
'@types/cors@2.8.19':
dependencies:
'@types/node': 25.0.10
'@types/node': 25.2.1
'@types/debug@4.1.12':
dependencies:
@@ -7511,7 +7574,7 @@ snapshots:
'@types/dns-packet@5.6.5':
dependencies:
'@types/node': 25.0.10
'@types/node': 25.2.1
'@types/elliptic@6.4.18':
dependencies:
@@ -7519,7 +7582,7 @@ snapshots:
'@types/express-serve-static-core@5.1.1':
dependencies:
'@types/node': 25.0.10
'@types/node': 25.2.1
'@types/qs': 6.14.0
'@types/range-parser': 1.2.7
'@types/send': 1.2.1
@@ -7533,7 +7596,7 @@ snapshots:
'@types/fs-extra@11.0.4':
dependencies:
'@types/jsonfile': 6.1.4
'@types/node': 25.0.10
'@types/node': 25.2.1
'@types/hast@3.0.4':
dependencies:
@@ -7555,7 +7618,7 @@ snapshots:
'@types/jsonfile@6.1.4':
dependencies:
'@types/node': 25.0.10
'@types/node': 25.2.1
'@types/linkify-it@5.0.0': {}
@@ -7578,17 +7641,17 @@ snapshots:
'@types/mute-stream@0.0.4':
dependencies:
'@types/node': 25.0.10
'@types/node': 25.2.1
'@types/node-forge@1.3.14':
dependencies:
'@types/node': 25.0.10
'@types/node': 25.2.1
'@types/node@22.19.7':
dependencies:
undici-types: 6.21.0
'@types/node@25.0.10':
'@types/node@25.2.1':
dependencies:
undici-types: 7.16.0
@@ -7606,22 +7669,22 @@ snapshots:
'@types/send@1.2.1':
dependencies:
'@types/node': 25.0.10
'@types/node': 25.2.1
'@types/serve-static@2.2.0':
dependencies:
'@types/http-errors': 2.0.5
'@types/node': 25.0.10
'@types/node': 25.2.1
'@types/symbol-tree@3.2.5': {}
'@types/tar-stream@3.1.4':
dependencies:
'@types/node': 25.0.10
'@types/node': 25.2.1
'@types/through2@2.0.41':
dependencies:
'@types/node': 25.0.10
'@types/node': 25.2.1
'@types/trusted-types@2.0.7': {}
@@ -7647,11 +7710,11 @@ snapshots:
'@types/ws@8.18.1':
dependencies:
'@types/node': 25.0.10
'@types/node': 25.2.1
'@types/yauzl@2.10.3':
dependencies:
'@types/node': 25.0.10
'@types/node': 25.2.1
optional: true
'@ungap/structured-clone@1.3.0': {}
@@ -8097,7 +8160,7 @@ snapshots:
engine.io@6.6.4:
dependencies:
'@types/cors': 2.8.19
'@types/node': 25.0.10
'@types/node': 25.2.1
accepts: 1.3.8
base64id: 2.0.0
cookie: 0.7.2

View File

@@ -82,6 +82,7 @@ tswatch is now a config-driven TypeScript file watcher. Configuration is read fr
- Gzip compression
- Live reload injection (configurable)
- SPA fallback support
- No-cache headers (prevents browser caching during development)
## Project Structure

View File

@@ -371,6 +371,7 @@ Config:
The built-in development server (enabled in `element` and `website` presets) features:
- **Live Reload** - Automatically refreshes browser on changes
- **No Caching** - Prevents browser caching during development (sends `Cache-Control: no-store, no-cache` headers)
- **CORS** - Cross-origin requests enabled
- **Compression** - Gzip compression for faster loading
- **SPA Fallback** - Single-page application routing support

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/tswatch',
version: '3.0.1',
version: '3.2.1',
description: 'A development tool for automatically watching and re-compiling TypeScript projects upon detecting file changes, enhancing developer workflows.'
}

View File

@@ -44,6 +44,16 @@ export interface IBundleConfig {
watchPatterns?: string[];
/** If true, trigger server reload after bundling (default: true) */
triggerReload?: boolean;
/** Output mode: 'bundle' writes JS, 'base64ts' writes base64-encoded TS (default: 'bundle') */
outputMode?: 'bundle' | 'base64ts';
/** Bundler to use (default: 'esbuild') */
bundler?: 'esbuild' | 'rolldown' | 'rspack';
/** Whether to produce a production build (default: false) */
production?: boolean;
/** Files to include alongside the bundle */
includeFiles?: (string | { from: string; to: string })[];
/** Max chars per line for base64ts output. 0 or undefined = unlimited */
maxLineLength?: number;
}
/**

View File

@@ -18,6 +18,7 @@ export class TsWatch {
public typedserver: plugins.typedserver.TypedServer | null = null;
private tsbundle = new plugins.tsbundle.TsBundle();
private customBundleHandler = new plugins.tsbundle.CustomBundleHandler();
private htmlHandler = new plugins.tsbundle.HtmlHandler();
private assetsHandler = new plugins.tsbundle.AssetsHandler();
@@ -89,6 +90,7 @@ export class TsWatch {
port: port,
compression: true,
spaFallback: true,
noCache: true,
securityHeaders: {
crossOriginOpenerPolicy: 'same-origin',
crossOriginEmbedderPolicy: 'require-corp',
@@ -127,10 +129,22 @@ export class TsWatch {
} else if (fromPath.endsWith('/') || !fromPath.includes('.')) {
// Assets directory copy
await this.assetsHandler.processAssets();
} else if (bundleConfig.outputMode && bundleConfig.outputMode !== 'bundle') {
// Non-default outputMode (e.g. base64ts) — use CustomBundleHandler
await this.customBundleHandler.processSingleBundle({
from: bundleConfig.from,
to: bundleConfig.to,
outputMode: bundleConfig.outputMode,
bundler: bundleConfig.bundler || 'esbuild',
production: bundleConfig.production || false,
includeFiles: bundleConfig.includeFiles,
maxLineLength: bundleConfig.maxLineLength,
});
} else {
// TypeScript bundling
// Standard TypeScript bundling (default)
await this.tsbundle.build(paths.cwd, fromPath, toPath, {
bundler: 'esbuild',
bundler: bundleConfig.bundler || 'esbuild',
production: bundleConfig.production || false,
});
}

View File

@@ -154,7 +154,7 @@ export class Watcher {
if (this.options.commandToExecute) {
if (this.currentExecution && this.options.restart) {
logger.log('ok', `[${name}] restarting: ${this.options.commandToExecute}`);
this.currentExecution.kill();
await this.currentExecution.kill();
} else if (!this.currentExecution) {
logger.log('ok', `[${name}] executing: ${this.options.commandToExecute}`);
}
@@ -184,24 +184,32 @@ export class Watcher {
* this method sets up a clean exit strategy
*/
private async setupCleanup() {
// Last-resort synchronous cleanup — 'exit' event cannot await async work.
// By this point, SIGINT handler should have already called stop().
process.on('exit', () => {
console.log('');
console.log('now exiting!');
this.stop();
process.exit(0);
if (this.currentExecution && !this.currentExecution.childProcess.killed) {
const pid = this.currentExecution.childProcess.pid;
if (pid) {
try {
process.kill(pid, 'SIGKILL');
} catch {
// Process may already be dead
}
}
}
});
process.on('SIGINT', () => {
process.on('SIGINT', async () => {
console.log('');
console.log('ok! got SIGINT We are exiting! Just cleaning up to exit neatly :)');
this.stop();
await this.stop();
process.exit(0);
});
// handle timeout
if (this.options.timeout) {
plugins.smartdelay.delayFor(this.options.timeout).then(() => {
plugins.smartdelay.delayFor(this.options.timeout).then(async () => {
console.log(`timed out afer ${this.options.timeout} milliseconds! exiting!`);
this.stop();
await this.stop();
process.exit(0);
});
}
@@ -216,7 +224,7 @@ export class Watcher {
}
await this.smartwatchInstance.stop();
if (this.currentExecution && !this.currentExecution.childProcess.killed) {
this.currentExecution.kill();
await this.currentExecution.kill();
}
}
}