@steambrew/ttc 3.0.0 → 3.1.1
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/.claude/settings.local.json +10 -0
- package/bun.lock +0 -69
- package/dist/index.js +87 -18
- package/package.json +2 -2
- package/src/check-health.ts +3 -2
- package/src/index.ts +6 -3
- package/src/logger.ts +6 -1
- package/src/plugin-json.d.ts +16 -0
- package/src/query-parser.ts +10 -2
- package/src/static-embed.ts +3 -1
- package/src/transpiler.ts +75 -11
package/bun.lock
CHANGED
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"glob": "^11.0.2",
|
|
26
26
|
"magic-string": "^0.30.17",
|
|
27
27
|
"rollup": "^4.42.0",
|
|
28
|
-
"rollup-plugin-esbuild": "^6.2.1",
|
|
29
28
|
"rollup-plugin-inject-process-env": "^1.3.1",
|
|
30
29
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
31
30
|
"rollup-plugin-scss": "^4.0.1",
|
|
@@ -235,58 +234,6 @@
|
|
|
235
234
|
|
|
236
235
|
"@babel/types": ["@babel/types@7.27.6", "", { "dependencies": { "@babel/helper-string-parser": "7.27.1", "@babel/helper-validator-identifier": "7.27.1" } }, "sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q=="],
|
|
237
236
|
|
|
238
|
-
"@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.27.3", "", { "os": "aix", "cpu": "ppc64" }, "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg=="],
|
|
239
|
-
|
|
240
|
-
"@esbuild/android-arm": ["@esbuild/android-arm@0.27.3", "", { "os": "android", "cpu": "arm" }, "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA=="],
|
|
241
|
-
|
|
242
|
-
"@esbuild/android-arm64": ["@esbuild/android-arm64@0.27.3", "", { "os": "android", "cpu": "arm64" }, "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg=="],
|
|
243
|
-
|
|
244
|
-
"@esbuild/android-x64": ["@esbuild/android-x64@0.27.3", "", { "os": "android", "cpu": "x64" }, "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ=="],
|
|
245
|
-
|
|
246
|
-
"@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.27.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg=="],
|
|
247
|
-
|
|
248
|
-
"@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.27.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg=="],
|
|
249
|
-
|
|
250
|
-
"@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.27.3", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w=="],
|
|
251
|
-
|
|
252
|
-
"@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.27.3", "", { "os": "freebsd", "cpu": "x64" }, "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA=="],
|
|
253
|
-
|
|
254
|
-
"@esbuild/linux-arm": ["@esbuild/linux-arm@0.27.3", "", { "os": "linux", "cpu": "arm" }, "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw=="],
|
|
255
|
-
|
|
256
|
-
"@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.27.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg=="],
|
|
257
|
-
|
|
258
|
-
"@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.27.3", "", { "os": "linux", "cpu": "ia32" }, "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg=="],
|
|
259
|
-
|
|
260
|
-
"@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.27.3", "", { "os": "linux", "cpu": "none" }, "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA=="],
|
|
261
|
-
|
|
262
|
-
"@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.27.3", "", { "os": "linux", "cpu": "none" }, "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw=="],
|
|
263
|
-
|
|
264
|
-
"@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.27.3", "", { "os": "linux", "cpu": "ppc64" }, "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA=="],
|
|
265
|
-
|
|
266
|
-
"@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.27.3", "", { "os": "linux", "cpu": "none" }, "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ=="],
|
|
267
|
-
|
|
268
|
-
"@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.27.3", "", { "os": "linux", "cpu": "s390x" }, "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw=="],
|
|
269
|
-
|
|
270
|
-
"@esbuild/linux-x64": ["@esbuild/linux-x64@0.27.3", "", { "os": "linux", "cpu": "x64" }, "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA=="],
|
|
271
|
-
|
|
272
|
-
"@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.27.3", "", { "os": "none", "cpu": "arm64" }, "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA=="],
|
|
273
|
-
|
|
274
|
-
"@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.27.3", "", { "os": "none", "cpu": "x64" }, "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA=="],
|
|
275
|
-
|
|
276
|
-
"@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.27.3", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw=="],
|
|
277
|
-
|
|
278
|
-
"@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.27.3", "", { "os": "openbsd", "cpu": "x64" }, "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ=="],
|
|
279
|
-
|
|
280
|
-
"@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.27.3", "", { "os": "none", "cpu": "arm64" }, "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g=="],
|
|
281
|
-
|
|
282
|
-
"@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.27.3", "", { "os": "sunos", "cpu": "x64" }, "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA=="],
|
|
283
|
-
|
|
284
|
-
"@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.27.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA=="],
|
|
285
|
-
|
|
286
|
-
"@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.27.3", "", { "os": "win32", "cpu": "ia32" }, "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q=="],
|
|
287
|
-
|
|
288
|
-
"@esbuild/win32-x64": ["@esbuild/win32-x64@0.27.3", "", { "os": "win32", "cpu": "x64" }, "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA=="],
|
|
289
|
-
|
|
290
237
|
"@isaacs/cliui": ["@isaacs/cliui@8.0.2", "", { "dependencies": { "string-width": "5.1.2", "string-width-cjs": "npm:string-width@4.2.3", "strip-ansi": "7.1.0", "strip-ansi-cjs": "npm:strip-ansi@6.0.1", "wrap-ansi": "8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="],
|
|
291
238
|
|
|
292
239
|
"@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.8", "", { "dependencies": { "@jridgewell/set-array": "1.2.1", "@jridgewell/sourcemap-codec": "1.5.0", "@jridgewell/trace-mapping": "0.3.25" } }, "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA=="],
|
|
@@ -457,10 +404,6 @@
|
|
|
457
404
|
|
|
458
405
|
"emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
|
|
459
406
|
|
|
460
|
-
"es-module-lexer": ["es-module-lexer@1.7.0", "", {}, "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA=="],
|
|
461
|
-
|
|
462
|
-
"esbuild": ["esbuild@0.27.3", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.27.3", "@esbuild/android-arm": "0.27.3", "@esbuild/android-arm64": "0.27.3", "@esbuild/android-x64": "0.27.3", "@esbuild/darwin-arm64": "0.27.3", "@esbuild/darwin-x64": "0.27.3", "@esbuild/freebsd-arm64": "0.27.3", "@esbuild/freebsd-x64": "0.27.3", "@esbuild/linux-arm": "0.27.3", "@esbuild/linux-arm64": "0.27.3", "@esbuild/linux-ia32": "0.27.3", "@esbuild/linux-loong64": "0.27.3", "@esbuild/linux-mips64el": "0.27.3", "@esbuild/linux-ppc64": "0.27.3", "@esbuild/linux-riscv64": "0.27.3", "@esbuild/linux-s390x": "0.27.3", "@esbuild/linux-x64": "0.27.3", "@esbuild/netbsd-arm64": "0.27.3", "@esbuild/netbsd-x64": "0.27.3", "@esbuild/openbsd-arm64": "0.27.3", "@esbuild/openbsd-x64": "0.27.3", "@esbuild/openharmony-arm64": "0.27.3", "@esbuild/sunos-x64": "0.27.3", "@esbuild/win32-arm64": "0.27.3", "@esbuild/win32-ia32": "0.27.3", "@esbuild/win32-x64": "0.27.3" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg=="],
|
|
463
|
-
|
|
464
407
|
"escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="],
|
|
465
408
|
|
|
466
409
|
"estree-walker": ["estree-walker@2.0.2", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="],
|
|
@@ -481,8 +424,6 @@
|
|
|
481
424
|
|
|
482
425
|
"gensync": ["gensync@1.0.0-beta.2", "", {}, "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg=="],
|
|
483
426
|
|
|
484
|
-
"get-tsconfig": ["get-tsconfig@4.13.6", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw=="],
|
|
485
|
-
|
|
486
427
|
"glob": ["glob@11.0.2", "", { "dependencies": { "foreground-child": "3.3.1", "jackspeak": "4.1.1", "minimatch": "10.0.1", "minipass": "7.1.2", "package-json-from-dist": "1.0.1", "path-scurry": "2.0.0" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-YT7U7Vye+t5fZ/QMkBFrTJ7ZQxInIUjwyAjVj84CYXqgBdv30MFUPGnBR6sQaVq6Is15wYJUsnzTuWaGRBhBAQ=="],
|
|
487
428
|
|
|
488
429
|
"globals": ["globals@11.12.0", "", {}, "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA=="],
|
|
@@ -545,8 +486,6 @@
|
|
|
545
486
|
|
|
546
487
|
"path-scurry": ["path-scurry@2.0.0", "", { "dependencies": { "lru-cache": "11.1.0", "minipass": "7.1.2" } }, "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg=="],
|
|
547
488
|
|
|
548
|
-
"pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="],
|
|
549
|
-
|
|
550
489
|
"picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
|
|
551
490
|
|
|
552
491
|
"picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="],
|
|
@@ -567,12 +506,8 @@
|
|
|
567
506
|
|
|
568
507
|
"resolve": ["resolve@1.22.10", "", { "dependencies": { "is-core-module": "2.16.1", "path-parse": "1.0.7", "supports-preserve-symlinks-flag": "1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w=="],
|
|
569
508
|
|
|
570
|
-
"resolve-pkg-maps": ["resolve-pkg-maps@1.0.0", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="],
|
|
571
|
-
|
|
572
509
|
"rollup": ["rollup@4.42.0", "", { "dependencies": { "@types/estree": "1.0.7" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.42.0", "@rollup/rollup-android-arm64": "4.42.0", "@rollup/rollup-darwin-arm64": "4.42.0", "@rollup/rollup-darwin-x64": "4.42.0", "@rollup/rollup-freebsd-arm64": "4.42.0", "@rollup/rollup-freebsd-x64": "4.42.0", "@rollup/rollup-linux-arm-gnueabihf": "4.42.0", "@rollup/rollup-linux-arm-musleabihf": "4.42.0", "@rollup/rollup-linux-arm64-gnu": "4.42.0", "@rollup/rollup-linux-arm64-musl": "4.42.0", "@rollup/rollup-linux-loongarch64-gnu": "4.42.0", "@rollup/rollup-linux-powerpc64le-gnu": "4.42.0", "@rollup/rollup-linux-riscv64-gnu": "4.42.0", "@rollup/rollup-linux-riscv64-musl": "4.42.0", "@rollup/rollup-linux-s390x-gnu": "4.42.0", "@rollup/rollup-linux-x64-gnu": "4.42.0", "@rollup/rollup-linux-x64-musl": "4.42.0", "@rollup/rollup-win32-arm64-msvc": "4.42.0", "@rollup/rollup-win32-ia32-msvc": "4.42.0", "@rollup/rollup-win32-x64-msvc": "4.42.0", "fsevents": "2.3.3" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-LW+Vse3BJPyGJGAJt1j8pWDKPd73QM8cRXYK1IxOBgL2AGLu7Xd2YOW0M2sLUBCkF5MshXXtMApyEAEzMVMsnw=="],
|
|
573
510
|
|
|
574
|
-
"rollup-plugin-esbuild": ["rollup-plugin-esbuild@6.2.1", "", { "dependencies": { "debug": "^4.4.0", "es-module-lexer": "^1.6.0", "get-tsconfig": "^4.10.0", "unplugin-utils": "^0.2.4" }, "peerDependencies": { "esbuild": ">=0.18.0", "rollup": "^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0" } }, "sha512-jTNOMGoMRhs0JuueJrJqbW8tOwxumaWYq+V5i+PD+8ecSCVkuX27tGW7BXqDgoULQ55rO7IdNxPcnsWtshz3AA=="],
|
|
575
|
-
|
|
576
511
|
"rollup-plugin-inject-process-env": ["rollup-plugin-inject-process-env@1.3.1", "", { "dependencies": { "magic-string": "0.25.9" } }, "sha512-kKDoL30IZr0wxbNVJjq+OS92RJSKRbKV6B5eNW4q3mZTFqoWDh6lHy+mPDYuuGuERFNKXkG+AKxvYqC9+DRpKQ=="],
|
|
577
512
|
|
|
578
513
|
"rollup-plugin-polyfill-node": ["rollup-plugin-polyfill-node@0.13.0", "", { "dependencies": { "@rollup/plugin-inject": "5.0.5" }, "peerDependencies": { "rollup": "4.42.0" } }, "sha512-FYEvpCaD5jGtyBuBFcQImEGmTxDTPbiHjJdrYIp+mFIwgXiXabxvKUK7ZT9P31ozu2Tqm9llYQMRWsfvTMTAOw=="],
|
|
@@ -633,8 +568,6 @@
|
|
|
633
568
|
|
|
634
569
|
"unicode-property-aliases-ecmascript": ["unicode-property-aliases-ecmascript@2.1.0", "", {}, "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w=="],
|
|
635
570
|
|
|
636
|
-
"unplugin-utils": ["unplugin-utils@0.2.5", "", { "dependencies": { "pathe": "^2.0.3", "picomatch": "^4.0.3" } }, "sha512-gwXJnPRewT4rT7sBi/IvxKTjsms7jX7QIDLOClApuZwR49SXbrB1z2NLUZ+vDHyqCj/n58OzRRqaW+B8OZi8vg=="],
|
|
637
|
-
|
|
638
571
|
"update-browserslist-db": ["update-browserslist-db@1.1.3", "", { "dependencies": { "escalade": "3.2.0", "picocolors": "1.1.1" }, "peerDependencies": { "browserslist": "4.25.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw=="],
|
|
639
572
|
|
|
640
573
|
"which": ["which@2.0.2", "", { "dependencies": { "isexe": "2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
|
|
@@ -663,8 +596,6 @@
|
|
|
663
596
|
|
|
664
597
|
"strip-ansi-cjs/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
|
|
665
598
|
|
|
666
|
-
"unplugin-utils/picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
|
|
667
|
-
|
|
668
599
|
"wrap-ansi-cjs/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
|
669
600
|
|
|
670
601
|
"wrap-ansi-cjs/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "8.0.0", "is-fullwidth-code-point": "3.0.0", "strip-ansi": "6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
|
package/dist/index.js
CHANGED
|
@@ -11,21 +11,20 @@ import resolve, { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
|
11
11
|
import replace from '@rollup/plugin-replace';
|
|
12
12
|
import terser from '@rollup/plugin-terser';
|
|
13
13
|
import typescript from '@rollup/plugin-typescript';
|
|
14
|
-
import esbuild from 'rollup-plugin-esbuild';
|
|
15
14
|
import url from '@rollup/plugin-url';
|
|
16
15
|
import nodePolyfills from 'rollup-plugin-polyfill-node';
|
|
17
|
-
import { rollup } from 'rollup';
|
|
16
|
+
import { watch, rollup } from 'rollup';
|
|
18
17
|
import { minify_sync } from 'terser';
|
|
19
18
|
import scss from 'rollup-plugin-scss';
|
|
20
19
|
import * as sass from 'sass';
|
|
21
20
|
import dotenv from 'dotenv';
|
|
22
21
|
import injectProcessEnv from 'rollup-plugin-inject-process-env';
|
|
22
|
+
import { performance } from 'perf_hooks';
|
|
23
23
|
import * as parser from '@babel/parser';
|
|
24
24
|
import { createFilter } from '@rollup/pluginutils';
|
|
25
25
|
import * as glob from 'glob';
|
|
26
26
|
import MagicString from 'magic-string';
|
|
27
27
|
import _traverse from '@babel/traverse';
|
|
28
|
-
import { performance as performance$1 } from 'perf_hooks';
|
|
29
28
|
|
|
30
29
|
const version = JSON.parse(readFileSync(path.resolve(dirname(fileURLToPath(import.meta.url)), '../package.json'), 'utf8')).version;
|
|
31
30
|
const Logger = {
|
|
@@ -39,7 +38,7 @@ const Logger = {
|
|
|
39
38
|
},
|
|
40
39
|
error(message, loc) {
|
|
41
40
|
if (loc) {
|
|
42
|
-
console.error(`${chalk.
|
|
41
|
+
console.error(`${chalk.red(loc + ':')} ${message}`);
|
|
43
42
|
}
|
|
44
43
|
else {
|
|
45
44
|
console.error(`${chalk.red('error:')} ${message}`);
|
|
@@ -60,6 +59,10 @@ const Logger = {
|
|
|
60
59
|
meta.push(`${envCount} env var${envCount > 1 ? 's' : ''}`);
|
|
61
60
|
console.log(`${chalk.green('Finished')} ${buildType} in ${elapsed} ` + chalk.dim('(' + meta.join(', ') + ')'));
|
|
62
61
|
},
|
|
62
|
+
failed({ elapsedMs, buildType }) {
|
|
63
|
+
const elapsed = `${(elapsedMs / 1000).toFixed(2)}s`;
|
|
64
|
+
console.error(`${chalk.red('Failed')} ${buildType} in ${elapsed} ` + chalk.dim(`(ttc v${version})`));
|
|
65
|
+
},
|
|
63
66
|
};
|
|
64
67
|
|
|
65
68
|
const PrintParamHelp = () => {
|
|
@@ -70,6 +73,7 @@ const PrintParamHelp = () => {
|
|
|
70
73
|
'options:',
|
|
71
74
|
' --build <dev|prod> build type (prod enables minification)',
|
|
72
75
|
' --target <path> plugin directory (default: current directory)',
|
|
76
|
+
' --watch enable watch mode for continuous rebuilding',
|
|
73
77
|
' --no-update skip update check',
|
|
74
78
|
' --help show this message',
|
|
75
79
|
'',
|
|
@@ -81,7 +85,7 @@ var BuildType;
|
|
|
81
85
|
BuildType[BuildType["ProdBuild"] = 1] = "ProdBuild";
|
|
82
86
|
})(BuildType || (BuildType = {}));
|
|
83
87
|
const ValidateParameters = (args) => {
|
|
84
|
-
let typeProp = BuildType.DevBuild, targetProp = process.cwd(), isMillennium = false;
|
|
88
|
+
let typeProp = BuildType.DevBuild, targetProp = process.cwd(), isMillennium = false, watch = false;
|
|
85
89
|
if (args.includes('--help')) {
|
|
86
90
|
PrintParamHelp();
|
|
87
91
|
process.exit();
|
|
@@ -117,11 +121,15 @@ const ValidateParameters = (args) => {
|
|
|
117
121
|
if (args[i] == '--millennium-internal') {
|
|
118
122
|
isMillennium = true;
|
|
119
123
|
}
|
|
124
|
+
if (args[i] === '--watch') {
|
|
125
|
+
watch = true;
|
|
126
|
+
}
|
|
120
127
|
}
|
|
121
128
|
return {
|
|
122
129
|
type: typeProp,
|
|
123
130
|
targetPlugin: targetProp,
|
|
124
|
-
isMillennium
|
|
131
|
+
isMillennium,
|
|
132
|
+
watch,
|
|
125
133
|
};
|
|
126
134
|
};
|
|
127
135
|
|
|
@@ -416,6 +424,7 @@ function constSysfsExpr(options = {}) {
|
|
|
416
424
|
fileName: path.relative(searchBasePath, singleFilePath),
|
|
417
425
|
};
|
|
418
426
|
embeddedContent = JSON.stringify(fileInfo);
|
|
427
|
+
this.addWatchFile(singleFilePath);
|
|
419
428
|
}
|
|
420
429
|
catch (fileError) {
|
|
421
430
|
let message = String(fileError instanceof Error ? fileError.message : fileError ?? 'Unknown file read error');
|
|
@@ -439,6 +448,7 @@ function constSysfsExpr(options = {}) {
|
|
|
439
448
|
filePath: fullPath,
|
|
440
449
|
fileName: path.relative(searchBasePath, fullPath),
|
|
441
450
|
});
|
|
451
|
+
this.addWatchFile(fullPath);
|
|
442
452
|
}
|
|
443
453
|
catch (fileError) {
|
|
444
454
|
let message = String(fileError instanceof Error ? fileError.message : fileError ?? 'Unknown file read error');
|
|
@@ -555,6 +565,8 @@ function stripPluginPrefix(message) {
|
|
|
555
565
|
message = message.replace(/^@?[\w-]+\/[\w-]+\s+/, '');
|
|
556
566
|
return message;
|
|
557
567
|
}
|
|
568
|
+
class BuildFailedError extends Error {
|
|
569
|
+
}
|
|
558
570
|
class MillenniumBuild {
|
|
559
571
|
isExternal(id) {
|
|
560
572
|
const hint = this.forbidden.get(id);
|
|
@@ -564,6 +576,25 @@ class MillenniumBuild {
|
|
|
564
576
|
}
|
|
565
577
|
return this.externals.has(id);
|
|
566
578
|
}
|
|
579
|
+
async watchConfig(input, sysfsPlugin, isMillennium) {
|
|
580
|
+
return {
|
|
581
|
+
input,
|
|
582
|
+
plugins: await this.plugins(sysfsPlugin),
|
|
583
|
+
onwarn: (warning) => {
|
|
584
|
+
const msg = stripPluginPrefix(warning.message);
|
|
585
|
+
const loc = logLocation(warning);
|
|
586
|
+
if (warning.plugin === 'typescript') {
|
|
587
|
+
Logger.error(msg, loc);
|
|
588
|
+
}
|
|
589
|
+
else {
|
|
590
|
+
Logger.warn(msg, loc);
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
context: 'window',
|
|
594
|
+
external: (id) => this.isExternal(id),
|
|
595
|
+
output: this.output(isMillennium),
|
|
596
|
+
};
|
|
597
|
+
}
|
|
567
598
|
async build(input, sysfsPlugin, isMillennium) {
|
|
568
599
|
let hasErrors = false;
|
|
569
600
|
const config = {
|
|
@@ -586,7 +617,7 @@ class MillenniumBuild {
|
|
|
586
617
|
};
|
|
587
618
|
await (await rollup(config)).write(config.output);
|
|
588
619
|
if (hasErrors)
|
|
589
|
-
|
|
620
|
+
throw new BuildFailedError();
|
|
590
621
|
}
|
|
591
622
|
}
|
|
592
623
|
class FrontendBuild extends MillenniumBuild {
|
|
@@ -598,9 +629,7 @@ class FrontendBuild extends MillenniumBuild {
|
|
|
598
629
|
this.forbidden = new Map([['@steambrew/webkit', 'use @steambrew/client in the frontend module']]);
|
|
599
630
|
}
|
|
600
631
|
plugins(sysfsPlugin) {
|
|
601
|
-
const tsPlugin = this.props.minify
|
|
602
|
-
? typescript({ tsconfig: resolveTsConfig(this.frontendDir), compilerOptions: { outDir: undefined } })
|
|
603
|
-
: esbuild({ tsconfig: resolveTsConfig(this.frontendDir) });
|
|
632
|
+
const tsPlugin = typescript({ tsconfig: resolveTsConfig(this.frontendDir), compilerOptions: { noCheck: !this.props.minify, outDir: undefined } });
|
|
604
633
|
return [
|
|
605
634
|
tsPlugin,
|
|
606
635
|
url({ include: ['**/*.gif', '**/*.webm', '**/*.svg'], limit: 0, fileName: '[hash][extname]' }),
|
|
@@ -649,9 +678,7 @@ class WebkitBuild extends MillenniumBuild {
|
|
|
649
678
|
this.forbidden = new Map([['@steambrew/client', 'use @steambrew/webkit in the webkit module']]);
|
|
650
679
|
}
|
|
651
680
|
async plugins(sysfsPlugin) {
|
|
652
|
-
const tsPlugin = this.props.minify
|
|
653
|
-
? typescript({ tsconfig: './webkit/tsconfig.json' })
|
|
654
|
-
: esbuild({ tsconfig: './webkit/tsconfig.json' });
|
|
681
|
+
const tsPlugin = typescript({ tsconfig: './webkit/tsconfig.json', compilerOptions: { noCheck: !this.props.minify } });
|
|
655
682
|
const base = [
|
|
656
683
|
insertMillennium(BuildTarget.Webkit, this.props),
|
|
657
684
|
tsPlugin,
|
|
@@ -684,10 +711,47 @@ class WebkitBuild extends MillenniumBuild {
|
|
|
684
711
|
};
|
|
685
712
|
}
|
|
686
713
|
}
|
|
687
|
-
|
|
714
|
+
function RunWatchMode(frontendConfig, webkitConfig) {
|
|
715
|
+
const configs = webkitConfig ? [frontendConfig, webkitConfig] : [frontendConfig];
|
|
716
|
+
const watcher = watch(configs);
|
|
717
|
+
console.log(chalk.blueBright.bold('watch'), 'watching for file changes...');
|
|
718
|
+
watcher.on('event', async (event) => {
|
|
719
|
+
if (event.code === 'BUNDLE_START') {
|
|
720
|
+
const label = event.output.some((f) => f.includes('index.js')) ? 'frontend' : 'webkit';
|
|
721
|
+
console.log(chalk.yellowBright.bold('watch'), `rebuilding ${label}...`);
|
|
722
|
+
}
|
|
723
|
+
else if (event.code === 'BUNDLE_END') {
|
|
724
|
+
const label = event.output.some((f) => f.includes('index.js')) ? 'frontend' : 'webkit';
|
|
725
|
+
console.log(chalk.greenBright.bold('watch'), `${label} built in ${chalk.green(`${event.duration}ms`)}`);
|
|
726
|
+
await event.result.close();
|
|
727
|
+
}
|
|
728
|
+
else if (event.code === 'ERROR') {
|
|
729
|
+
const err = event.error;
|
|
730
|
+
const msg = stripPluginPrefix(err?.message ?? String(err));
|
|
731
|
+
Logger.error(msg, logLocation(err));
|
|
732
|
+
if (event.result)
|
|
733
|
+
await event.result.close();
|
|
734
|
+
}
|
|
735
|
+
});
|
|
736
|
+
const shutdown = () => {
|
|
737
|
+
console.log(chalk.yellowBright.bold('watch'), 'stopping...');
|
|
738
|
+
watcher.close();
|
|
739
|
+
process.exit(0);
|
|
740
|
+
};
|
|
741
|
+
process.on('SIGINT', shutdown);
|
|
742
|
+
process.on('SIGUSR2', shutdown);
|
|
743
|
+
}
|
|
744
|
+
const TranspilerPluginComponent = async (pluginJson, props) => {
|
|
688
745
|
const webkitDir = './webkit/index.tsx';
|
|
689
746
|
const frontendDir = getFrontendDir(pluginJson);
|
|
690
747
|
const sysfs = constSysfsExpr();
|
|
748
|
+
const isMillennium = props.isMillennium ?? false;
|
|
749
|
+
if (props.watch) {
|
|
750
|
+
const frontendConfig = await new FrontendBuild(frontendDir, props).watchConfig(resolveEntryFile(frontendDir), sysfs.plugin, isMillennium);
|
|
751
|
+
const webkitConfig = fs.existsSync(webkitDir) ? await new WebkitBuild(props).watchConfig(webkitDir, sysfs.plugin, isMillennium) : null;
|
|
752
|
+
RunWatchMode(frontendConfig, webkitConfig);
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
691
755
|
try {
|
|
692
756
|
await new FrontendBuild(frontendDir, props).build(resolveEntryFile(frontendDir), sysfs.plugin, isMillennium);
|
|
693
757
|
if (fs.existsSync(webkitDir)) {
|
|
@@ -701,7 +765,10 @@ const TranspilerPluginComponent = async (isMillennium, pluginJson, props) => {
|
|
|
701
765
|
});
|
|
702
766
|
}
|
|
703
767
|
catch (exception) {
|
|
704
|
-
|
|
768
|
+
if (!(exception instanceof BuildFailedError)) {
|
|
769
|
+
Logger.error(stripPluginPrefix(exception?.message ?? String(exception)), logLocation(exception));
|
|
770
|
+
}
|
|
771
|
+
Logger.failed({ elapsedMs: performance.now() - global.PerfStartTime, buildType: props.minify ? 'prod' : 'dev' });
|
|
705
772
|
process.exit(1);
|
|
706
773
|
}
|
|
707
774
|
};
|
|
@@ -722,16 +789,18 @@ const StartCompilerModule = () => {
|
|
|
722
789
|
.then((json) => {
|
|
723
790
|
const props = {
|
|
724
791
|
minify: bTersePlugin,
|
|
725
|
-
pluginName: json
|
|
792
|
+
pluginName: json.name,
|
|
793
|
+
watch: parameters.watch || false,
|
|
794
|
+
isMillennium: bIsMillennium,
|
|
726
795
|
};
|
|
727
|
-
TranspilerPluginComponent(
|
|
796
|
+
TranspilerPluginComponent(json, props);
|
|
728
797
|
})
|
|
729
798
|
.catch(() => {
|
|
730
799
|
process.exit();
|
|
731
800
|
});
|
|
732
801
|
};
|
|
733
802
|
const Initialize = () => {
|
|
734
|
-
global.PerfStartTime = performance
|
|
803
|
+
global.PerfStartTime = performance.now();
|
|
735
804
|
// Check for --no-update flag
|
|
736
805
|
if (process.argv.includes('--no-update')) {
|
|
737
806
|
StartCompilerModule();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steambrew/ttc",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "rollup -c",
|
|
12
|
+
"dev": "rollup -c -w",
|
|
12
13
|
"prepare": "bun run build"
|
|
13
14
|
},
|
|
14
15
|
"publishConfig": {
|
|
@@ -39,7 +40,6 @@
|
|
|
39
40
|
"glob": "^11.0.2",
|
|
40
41
|
"magic-string": "^0.30.17",
|
|
41
42
|
"rollup": "^4.42.0",
|
|
42
|
-
"rollup-plugin-esbuild": "^6.2.1",
|
|
43
43
|
"rollup-plugin-inject-process-env": "^1.3.1",
|
|
44
44
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
45
45
|
"rollup-plugin-scss": "^4.0.1",
|
package/src/check-health.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { existsSync, readFile } from 'fs';
|
|
3
3
|
import { Logger } from './logger';
|
|
4
|
+
import { PluginJson } from './plugin-json';
|
|
4
5
|
|
|
5
|
-
export const ValidatePlugin = (bIsMillennium: boolean, target: string): Promise<
|
|
6
|
-
return new Promise<
|
|
6
|
+
export const ValidatePlugin = (bIsMillennium: boolean, target: string): Promise<PluginJson> => {
|
|
7
|
+
return new Promise<PluginJson>((resolve, reject) => {
|
|
7
8
|
if (!existsSync(target)) {
|
|
8
9
|
Logger.error(`target path does not exist: ${target}`);
|
|
9
10
|
reject();
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { BuildType, ValidateParameters } from './query-parser';
|
|
9
9
|
import { CheckForUpdates } from './version-control';
|
|
10
10
|
import { ValidatePlugin } from './check-health';
|
|
11
|
+
import { PluginJson } from './plugin-json';
|
|
11
12
|
import { TranspilerPluginComponent, TranspilerProps } from './transpiler';
|
|
12
13
|
import { performance } from 'perf_hooks';
|
|
13
14
|
|
|
@@ -25,13 +26,15 @@ const StartCompilerModule = () => {
|
|
|
25
26
|
const bTersePlugin = parameters.type == BuildType.ProdBuild;
|
|
26
27
|
|
|
27
28
|
ValidatePlugin(bIsMillennium, parameters.targetPlugin)
|
|
28
|
-
.then((json:
|
|
29
|
+
.then((json: PluginJson) => {
|
|
29
30
|
const props: TranspilerProps = {
|
|
30
31
|
minify: bTersePlugin,
|
|
31
|
-
pluginName: json
|
|
32
|
+
pluginName: json.name,
|
|
33
|
+
watch: parameters.watch || false,
|
|
34
|
+
isMillennium: bIsMillennium,
|
|
32
35
|
};
|
|
33
36
|
|
|
34
|
-
TranspilerPluginComponent(
|
|
37
|
+
TranspilerPluginComponent(json, props);
|
|
35
38
|
})
|
|
36
39
|
.catch(() => {
|
|
37
40
|
process.exit();
|
package/src/logger.ts
CHANGED
|
@@ -25,7 +25,7 @@ const Logger = {
|
|
|
25
25
|
|
|
26
26
|
error(message: string, loc?: string) {
|
|
27
27
|
if (loc) {
|
|
28
|
-
console.error(`${chalk.
|
|
28
|
+
console.error(`${chalk.red(loc + ':')} ${message}`);
|
|
29
29
|
} else {
|
|
30
30
|
console.error(`${chalk.red('error:')} ${message}`);
|
|
31
31
|
}
|
|
@@ -44,6 +44,11 @@ const Logger = {
|
|
|
44
44
|
if (envCount) meta.push(`${envCount} env var${envCount > 1 ? 's' : ''}`);
|
|
45
45
|
console.log(`${chalk.green('Finished')} ${buildType} in ${elapsed} ` + chalk.dim('(' + meta.join(', ') + ')'));
|
|
46
46
|
},
|
|
47
|
+
|
|
48
|
+
failed({ elapsedMs, buildType }: Pick<DoneOptions, 'elapsedMs' | 'buildType'>) {
|
|
49
|
+
const elapsed = `${(elapsedMs / 1000).toFixed(2)}s`;
|
|
50
|
+
console.error(`${chalk.red('Failed')} ${buildType} in ${elapsed} ` + chalk.dim(`(ttc v${version})`));
|
|
51
|
+
},
|
|
47
52
|
};
|
|
48
53
|
|
|
49
54
|
export { Logger };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* generated from https://raw.githubusercontent.com/SteamClientHomebrew/Millennium/main/src/sys/plugin-schema.json
|
|
3
|
+
*/
|
|
4
|
+
export interface PluginJson {
|
|
5
|
+
backend?: string;
|
|
6
|
+
common_name?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
frontend?: string;
|
|
9
|
+
include?: string[];
|
|
10
|
+
name: string;
|
|
11
|
+
splash_image?: string;
|
|
12
|
+
thumbnail?: string;
|
|
13
|
+
useBackend?: boolean;
|
|
14
|
+
venv?: string;
|
|
15
|
+
version?: string;
|
|
16
|
+
}
|
package/src/query-parser.ts
CHANGED
|
@@ -9,6 +9,7 @@ export const PrintParamHelp = () => {
|
|
|
9
9
|
'options:',
|
|
10
10
|
' --build <dev|prod> build type (prod enables minification)',
|
|
11
11
|
' --target <path> plugin directory (default: current directory)',
|
|
12
|
+
' --watch enable watch mode for continuous rebuilding',
|
|
12
13
|
' --no-update skip update check',
|
|
13
14
|
' --help show this message',
|
|
14
15
|
'',
|
|
@@ -25,12 +26,14 @@ export interface ParameterProps {
|
|
|
25
26
|
type: BuildType;
|
|
26
27
|
targetPlugin: string; // path
|
|
27
28
|
isMillennium?: boolean;
|
|
29
|
+
watch?: boolean;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
export const ValidateParameters = (args: Array<string>): ParameterProps => {
|
|
31
33
|
let typeProp: BuildType = BuildType.DevBuild,
|
|
32
34
|
targetProp: string = process.cwd(),
|
|
33
|
-
isMillennium: boolean = false
|
|
35
|
+
isMillennium: boolean = false,
|
|
36
|
+
watch: boolean = false;
|
|
34
37
|
|
|
35
38
|
if (args.includes('--help')) {
|
|
36
39
|
PrintParamHelp();
|
|
@@ -73,11 +76,16 @@ export const ValidateParameters = (args: Array<string>): ParameterProps => {
|
|
|
73
76
|
if (args[i] == '--millennium-internal') {
|
|
74
77
|
isMillennium = true;
|
|
75
78
|
}
|
|
79
|
+
|
|
80
|
+
if (args[i] === '--watch') {
|
|
81
|
+
watch = true;
|
|
82
|
+
}
|
|
76
83
|
}
|
|
77
84
|
|
|
78
85
|
return {
|
|
79
86
|
type: typeProp,
|
|
80
87
|
targetPlugin: targetProp,
|
|
81
|
-
isMillennium
|
|
88
|
+
isMillennium,
|
|
89
|
+
watch,
|
|
82
90
|
};
|
|
83
91
|
};
|
package/src/static-embed.ts
CHANGED
|
@@ -206,7 +206,8 @@ export default function constSysfsExpr(options: EmbedPluginOptions = {}): SysfsP
|
|
|
206
206
|
fileName: path.relative(searchBasePath, singleFilePath),
|
|
207
207
|
};
|
|
208
208
|
embeddedContent = JSON.stringify(fileInfo);
|
|
209
|
-
|
|
209
|
+
this.addWatchFile(singleFilePath);
|
|
210
|
+
} catch (fileError: unknown) {
|
|
210
211
|
let message = String(fileError instanceof Error ? fileError.message : fileError ?? 'Unknown file read error');
|
|
211
212
|
this.error(`Error reading file ${singleFilePath}: ${message}`, node.loc?.start.index);
|
|
212
213
|
return;
|
|
@@ -230,6 +231,7 @@ export default function constSysfsExpr(options: EmbedPluginOptions = {}): SysfsP
|
|
|
230
231
|
filePath: fullPath,
|
|
231
232
|
fileName: path.relative(searchBasePath, fullPath),
|
|
232
233
|
});
|
|
234
|
+
this.addWatchFile(fullPath);
|
|
233
235
|
} catch (fileError: unknown) {
|
|
234
236
|
let message = String(fileError instanceof Error ? fileError.message : fileError ?? 'Unknown file read error');
|
|
235
237
|
this.warn(`Error reading file ${fullPath}: ${message}`);
|
package/src/transpiler.ts
CHANGED
|
@@ -5,10 +5,10 @@ import resolve, { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
|
5
5
|
import replace from '@rollup/plugin-replace';
|
|
6
6
|
import terser from '@rollup/plugin-terser';
|
|
7
7
|
import typescript from '@rollup/plugin-typescript';
|
|
8
|
-
import esbuild from 'rollup-plugin-esbuild';
|
|
9
8
|
import url from '@rollup/plugin-url';
|
|
10
9
|
import nodePolyfills from 'rollup-plugin-polyfill-node';
|
|
11
|
-
import
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
import { InputPluginOption, OutputBundle, OutputOptions, Plugin, RollupOptions, rollup, watch as rollupWatch } from 'rollup';
|
|
12
12
|
import { minify_sync } from 'terser';
|
|
13
13
|
import scss from 'rollup-plugin-scss';
|
|
14
14
|
import * as sass from 'sass';
|
|
@@ -17,8 +17,10 @@ import path from 'path';
|
|
|
17
17
|
import { pathToFileURL } from 'url';
|
|
18
18
|
import dotenv from 'dotenv';
|
|
19
19
|
import injectProcessEnv from 'rollup-plugin-inject-process-env';
|
|
20
|
+
import { performance } from 'perf_hooks';
|
|
20
21
|
import { ExecutePluginModule, InitializePlugins } from './plugin-api';
|
|
21
22
|
import { Logger } from './logger';
|
|
23
|
+
import { PluginJson } from './plugin-json';
|
|
22
24
|
import constSysfsExpr from './static-embed';
|
|
23
25
|
|
|
24
26
|
const env = dotenv.config().parsed ?? {};
|
|
@@ -42,6 +44,8 @@ declare const __call_server_method__: (methodName: string, kwargs: any) => any;
|
|
|
42
44
|
export interface TranspilerProps {
|
|
43
45
|
minify: boolean;
|
|
44
46
|
pluginName: string;
|
|
47
|
+
watch?: boolean;
|
|
48
|
+
isMillennium?: boolean;
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
enum BuildTarget {
|
|
@@ -130,6 +134,8 @@ function stripPluginPrefix(message: string): string {
|
|
|
130
134
|
return message;
|
|
131
135
|
}
|
|
132
136
|
|
|
137
|
+
class BuildFailedError extends Error {}
|
|
138
|
+
|
|
133
139
|
abstract class MillenniumBuild {
|
|
134
140
|
protected abstract readonly externals: ReadonlySet<string>;
|
|
135
141
|
protected abstract readonly forbidden: ReadonlyMap<string, string>;
|
|
@@ -145,6 +151,25 @@ abstract class MillenniumBuild {
|
|
|
145
151
|
return this.externals.has(id);
|
|
146
152
|
}
|
|
147
153
|
|
|
154
|
+
async watchConfig(input: string, sysfsPlugin: InputPluginOption, isMillennium: boolean): Promise<RollupOptions> {
|
|
155
|
+
return {
|
|
156
|
+
input,
|
|
157
|
+
plugins: await this.plugins(sysfsPlugin),
|
|
158
|
+
onwarn: (warning) => {
|
|
159
|
+
const msg = stripPluginPrefix(warning.message);
|
|
160
|
+
const loc = logLocation(warning);
|
|
161
|
+
if (warning.plugin === 'typescript') {
|
|
162
|
+
Logger.error(msg, loc);
|
|
163
|
+
} else {
|
|
164
|
+
Logger.warn(msg, loc);
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
context: 'window',
|
|
168
|
+
external: (id) => this.isExternal(id),
|
|
169
|
+
output: this.output(isMillennium),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
148
173
|
async build(input: string, sysfsPlugin: InputPluginOption, isMillennium: boolean): Promise<void> {
|
|
149
174
|
let hasErrors = false;
|
|
150
175
|
|
|
@@ -168,7 +193,7 @@ abstract class MillenniumBuild {
|
|
|
168
193
|
|
|
169
194
|
await (await rollup(config)).write(config.output as OutputOptions);
|
|
170
195
|
|
|
171
|
-
if (hasErrors)
|
|
196
|
+
if (hasErrors) throw new BuildFailedError();
|
|
172
197
|
}
|
|
173
198
|
}
|
|
174
199
|
|
|
@@ -184,9 +209,7 @@ class FrontendBuild extends MillenniumBuild {
|
|
|
184
209
|
}
|
|
185
210
|
|
|
186
211
|
protected plugins(sysfsPlugin: InputPluginOption): InputPluginOption[] {
|
|
187
|
-
const tsPlugin = this.props.minify
|
|
188
|
-
? typescript({ tsconfig: resolveTsConfig(this.frontendDir), compilerOptions: { outDir: undefined } })
|
|
189
|
-
: esbuild({ tsconfig: resolveTsConfig(this.frontendDir) });
|
|
212
|
+
const tsPlugin = typescript({ tsconfig: resolveTsConfig(this.frontendDir), compilerOptions: { noCheck: !this.props.minify, outDir: undefined } });
|
|
190
213
|
|
|
191
214
|
return [
|
|
192
215
|
tsPlugin,
|
|
@@ -239,9 +262,7 @@ class WebkitBuild extends MillenniumBuild {
|
|
|
239
262
|
}
|
|
240
263
|
|
|
241
264
|
protected async plugins(sysfsPlugin: InputPluginOption): Promise<InputPluginOption[]> {
|
|
242
|
-
const tsPlugin = this.props.minify
|
|
243
|
-
? typescript({ tsconfig: './webkit/tsconfig.json' })
|
|
244
|
-
: esbuild({ tsconfig: './webkit/tsconfig.json' });
|
|
265
|
+
const tsPlugin = typescript({ tsconfig: './webkit/tsconfig.json', compilerOptions: { noCheck: !this.props.minify } });
|
|
245
266
|
|
|
246
267
|
const base: InputPluginOption[] = [
|
|
247
268
|
insertMillennium(BuildTarget.Webkit, this.props),
|
|
@@ -278,10 +299,50 @@ class WebkitBuild extends MillenniumBuild {
|
|
|
278
299
|
}
|
|
279
300
|
}
|
|
280
301
|
|
|
281
|
-
|
|
302
|
+
function RunWatchMode(frontendConfig: RollupOptions, webkitConfig: RollupOptions | null): void {
|
|
303
|
+
const configs = webkitConfig ? [frontendConfig, webkitConfig] : [frontendConfig];
|
|
304
|
+
const watcher = rollupWatch(configs);
|
|
305
|
+
|
|
306
|
+
console.log(chalk.blueBright.bold('watch'), 'watching for file changes...');
|
|
307
|
+
|
|
308
|
+
watcher.on('event', async (event) => {
|
|
309
|
+
if (event.code === 'BUNDLE_START') {
|
|
310
|
+
const label = (event.output as readonly string[]).some((f) => f.includes('index.js')) ? 'frontend' : 'webkit';
|
|
311
|
+
console.log(chalk.yellowBright.bold('watch'), `rebuilding ${label}...`);
|
|
312
|
+
} else if (event.code === 'BUNDLE_END') {
|
|
313
|
+
const label = (event.output as readonly string[]).some((f) => f.includes('index.js')) ? 'frontend' : 'webkit';
|
|
314
|
+
console.log(chalk.greenBright.bold('watch'), `${label} built in ${chalk.green(`${event.duration}ms`)}`);
|
|
315
|
+
await event.result.close();
|
|
316
|
+
} else if (event.code === 'ERROR') {
|
|
317
|
+
const err = event.error;
|
|
318
|
+
const msg = stripPluginPrefix(err?.message ?? String(err));
|
|
319
|
+
Logger.error(msg, logLocation(err as any));
|
|
320
|
+
if (event.result) await event.result.close();
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
const shutdown = () => {
|
|
325
|
+
console.log(chalk.yellowBright.bold('watch'), 'stopping...');
|
|
326
|
+
watcher.close();
|
|
327
|
+
process.exit(0);
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
process.on('SIGINT', shutdown);
|
|
331
|
+
process.on('SIGUSR2', shutdown);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export const TranspilerPluginComponent = async (pluginJson: PluginJson, props: TranspilerProps) => {
|
|
282
335
|
const webkitDir = './webkit/index.tsx';
|
|
283
336
|
const frontendDir = getFrontendDir(pluginJson);
|
|
284
337
|
const sysfs = constSysfsExpr();
|
|
338
|
+
const isMillennium = props.isMillennium ?? false;
|
|
339
|
+
|
|
340
|
+
if (props.watch) {
|
|
341
|
+
const frontendConfig = await new FrontendBuild(frontendDir, props).watchConfig(resolveEntryFile(frontendDir), sysfs.plugin, isMillennium);
|
|
342
|
+
const webkitConfig = fs.existsSync(webkitDir) ? await new WebkitBuild(props).watchConfig(webkitDir, sysfs.plugin, isMillennium) : null;
|
|
343
|
+
RunWatchMode(frontendConfig, webkitConfig);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
285
346
|
|
|
286
347
|
try {
|
|
287
348
|
await new FrontendBuild(frontendDir, props).build(resolveEntryFile(frontendDir), sysfs.plugin, isMillennium);
|
|
@@ -297,7 +358,10 @@ export const TranspilerPluginComponent = async (isMillennium: boolean, pluginJso
|
|
|
297
358
|
envCount: Object.keys(env).length || undefined,
|
|
298
359
|
});
|
|
299
360
|
} catch (exception: any) {
|
|
300
|
-
|
|
361
|
+
if (!(exception instanceof BuildFailedError)) {
|
|
362
|
+
Logger.error(stripPluginPrefix(exception?.message ?? String(exception)), logLocation(exception));
|
|
363
|
+
}
|
|
364
|
+
Logger.failed({ elapsedMs: performance.now() - global.PerfStartTime, buildType: props.minify ? 'prod' : 'dev' });
|
|
301
365
|
process.exit(1);
|
|
302
366
|
}
|
|
303
367
|
};
|