@gtkx/cli 1.0.0 → 1.2.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/README.md +1 -1
- package/dist/builder.d.ts +1 -1
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +20 -3
- package/dist/builder.js.map +1 -1
- package/dist/cli.js +6 -2
- package/dist/cli.js.map +1 -1
- package/dist/codegen/freshness.js +2 -2
- package/dist/codegen/freshness.js.map +1 -1
- package/dist/codegen/report.d.ts.map +1 -1
- package/dist/codegen/report.js +3 -0
- package/dist/codegen/report.js.map +1 -1
- package/dist/codegen/run-codegen.d.ts +9 -5
- package/dist/codegen/run-codegen.d.ts.map +1 -1
- package/dist/codegen/run-codegen.js +31 -20
- package/dist/codegen/run-codegen.js.map +1 -1
- package/dist/codegen/store-resolver.d.ts +1 -1
- package/dist/codegen/store-resolver.d.ts.map +1 -1
- package/dist/codegen/store-resolver.js.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +5 -6
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/codegen.d.ts.map +1 -1
- package/dist/commands/codegen.js +11 -1
- package/dist/commands/codegen.js.map +1 -1
- package/dist/commands/deploy.d.ts +22 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +44 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +4 -4
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/docs.d.ts +2 -2
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +28 -4
- package/dist/commands/docs.js.map +1 -1
- package/dist/deploy/depends.d.ts +8 -0
- package/dist/deploy/depends.d.ts.map +1 -0
- package/dist/deploy/depends.js +27 -0
- package/dist/deploy/depends.js.map +1 -0
- package/dist/deploy/download.d.ts +20 -0
- package/dist/deploy/download.d.ts.map +1 -0
- package/dist/deploy/download.js +98 -0
- package/dist/deploy/download.js.map +1 -0
- package/dist/deploy/freedesktop/copyright.d.ts +4 -0
- package/dist/deploy/freedesktop/copyright.d.ts.map +1 -0
- package/dist/deploy/freedesktop/copyright.js +33 -0
- package/dist/deploy/freedesktop/copyright.js.map +1 -0
- package/dist/deploy/freedesktop/dbus-service.d.ts +4 -0
- package/dist/deploy/freedesktop/dbus-service.d.ts.map +1 -0
- package/dist/deploy/freedesktop/dbus-service.js +15 -0
- package/dist/deploy/freedesktop/dbus-service.js.map +1 -0
- package/dist/deploy/freedesktop/desktop-entry.d.ts +4 -0
- package/dist/deploy/freedesktop/desktop-entry.d.ts.map +1 -0
- package/dist/deploy/freedesktop/desktop-entry.js +73 -0
- package/dist/deploy/freedesktop/desktop-entry.js.map +1 -0
- package/dist/deploy/freedesktop/ini.d.ts +7 -0
- package/dist/deploy/freedesktop/ini.d.ts.map +1 -0
- package/dist/deploy/freedesktop/ini.js +22 -0
- package/dist/deploy/freedesktop/ini.js.map +1 -0
- package/dist/deploy/freedesktop/metainfo-sections.d.ts +13 -0
- package/dist/deploy/freedesktop/metainfo-sections.d.ts.map +1 -0
- package/dist/deploy/freedesktop/metainfo-sections.js +73 -0
- package/dist/deploy/freedesktop/metainfo-sections.js.map +1 -0
- package/dist/deploy/freedesktop/metainfo.d.ts +4 -0
- package/dist/deploy/freedesktop/metainfo.d.ts.map +1 -0
- package/dist/deploy/freedesktop/metainfo.js +29 -0
- package/dist/deploy/freedesktop/metainfo.js.map +1 -0
- package/dist/deploy/freedesktop/mime-package.d.ts +4 -0
- package/dist/deploy/freedesktop/mime-package.d.ts.map +1 -0
- package/dist/deploy/freedesktop/mime-package.js +16 -0
- package/dist/deploy/freedesktop/mime-package.js.map +1 -0
- package/dist/deploy/freedesktop/validate.d.ts +4 -0
- package/dist/deploy/freedesktop/validate.d.ts.map +1 -0
- package/dist/deploy/freedesktop/validate.js +81 -0
- package/dist/deploy/freedesktop/validate.js.map +1 -0
- package/dist/deploy/freedesktop/xml.d.ts +11 -0
- package/dist/deploy/freedesktop/xml.d.ts.map +1 -0
- package/dist/deploy/freedesktop/xml.js +33 -0
- package/dist/deploy/freedesktop/xml.js.map +1 -0
- package/dist/deploy/git.d.ts +4 -0
- package/dist/deploy/git.d.ts.map +1 -0
- package/dist/deploy/git.js +17 -0
- package/dist/deploy/git.js.map +1 -0
- package/dist/deploy/install-hints.d.ts +5 -0
- package/dist/deploy/install-hints.d.ts.map +1 -0
- package/dist/deploy/install-hints.js +88 -0
- package/dist/deploy/install-hints.js.map +1 -0
- package/dist/deploy/nfpm/config.d.ts +8 -0
- package/dist/deploy/nfpm/config.d.ts.map +1 -0
- package/dist/deploy/nfpm/config.js +119 -0
- package/dist/deploy/nfpm/config.js.map +1 -0
- package/dist/deploy/nfpm/contents.d.ts +12 -0
- package/dist/deploy/nfpm/contents.d.ts.map +1 -0
- package/dist/deploy/nfpm/contents.js +48 -0
- package/dist/deploy/nfpm/contents.js.map +1 -0
- package/dist/deploy/nfpm/description.d.ts +5 -0
- package/dist/deploy/nfpm/description.d.ts.map +1 -0
- package/dist/deploy/nfpm/description.js +5 -0
- package/dist/deploy/nfpm/description.js.map +1 -0
- package/dist/deploy/nfpm/optional.d.ts +5 -0
- package/dist/deploy/nfpm/optional.d.ts.map +1 -0
- package/dist/deploy/nfpm/optional.js +4 -0
- package/dist/deploy/nfpm/optional.js.map +1 -0
- package/dist/deploy/nfpm/pack.d.ts +5 -0
- package/dist/deploy/nfpm/pack.d.ts.map +1 -0
- package/dist/deploy/nfpm/pack.js +32 -0
- package/dist/deploy/nfpm/pack.js.map +1 -0
- package/dist/deploy/node-runtime/download.d.ts +3 -0
- package/dist/deploy/node-runtime/download.d.ts.map +1 -0
- package/dist/deploy/node-runtime/download.js +39 -0
- package/dist/deploy/node-runtime/download.js.map +1 -0
- package/dist/deploy/node-runtime/elf.d.ts +7 -0
- package/dist/deploy/node-runtime/elf.d.ts.map +1 -0
- package/dist/deploy/node-runtime/elf.js +100 -0
- package/dist/deploy/node-runtime/elf.js.map +1 -0
- package/dist/deploy/node-runtime/guard.d.ts +4 -0
- package/dist/deploy/node-runtime/guard.d.ts.map +1 -0
- package/dist/deploy/node-runtime/guard.js +22 -0
- package/dist/deploy/node-runtime/guard.js.map +1 -0
- package/dist/deploy/node-runtime/index.d.ts +4 -0
- package/dist/deploy/node-runtime/index.d.ts.map +1 -0
- package/dist/deploy/node-runtime/index.js +61 -0
- package/dist/deploy/node-runtime/index.js.map +1 -0
- package/dist/deploy/payload/copy-tree.d.ts +7 -0
- package/dist/deploy/payload/copy-tree.d.ts.map +1 -0
- package/dist/deploy/payload/copy-tree.js +36 -0
- package/dist/deploy/payload/copy-tree.js.map +1 -0
- package/dist/deploy/payload/icons.d.ts +6 -0
- package/dist/deploy/payload/icons.d.ts.map +1 -0
- package/dist/deploy/payload/icons.js +53 -0
- package/dist/deploy/payload/icons.js.map +1 -0
- package/dist/deploy/payload/launcher.d.ts +5 -0
- package/dist/deploy/payload/launcher.d.ts.map +1 -0
- package/dist/deploy/payload/launcher.js +22 -0
- package/dist/deploy/payload/launcher.js.map +1 -0
- package/dist/deploy/payload/schemas.d.ts +4 -0
- package/dist/deploy/payload/schemas.d.ts.map +1 -0
- package/dist/deploy/payload/schemas.js +17 -0
- package/dist/deploy/payload/schemas.js.map +1 -0
- package/dist/deploy/payload/stage.d.ts +15 -0
- package/dist/deploy/payload/stage.d.ts.map +1 -0
- package/dist/deploy/payload/stage.js +100 -0
- package/dist/deploy/payload/stage.js.map +1 -0
- package/dist/deploy/registry.d.ts +7 -0
- package/dist/deploy/registry.d.ts.map +1 -0
- package/dist/deploy/registry.js +30 -0
- package/dist/deploy/registry.js.map +1 -0
- package/dist/deploy/run-deploy.d.ts +11 -0
- package/dist/deploy/run-deploy.d.ts.map +1 -0
- package/dist/deploy/run-deploy.js +157 -0
- package/dist/deploy/run-deploy.js.map +1 -0
- package/dist/deploy/settings/arch.d.ts +4 -0
- package/dist/deploy/settings/arch.d.ts.map +1 -0
- package/dist/deploy/settings/arch.js +13 -0
- package/dist/deploy/settings/arch.js.map +1 -0
- package/dist/deploy/settings/categories.d.ts +4 -0
- package/dist/deploy/settings/categories.d.ts.map +1 -0
- package/dist/deploy/settings/categories.js +29 -0
- package/dist/deploy/settings/categories.js.map +1 -0
- package/dist/deploy/settings/exec.d.ts +6 -0
- package/dist/deploy/settings/exec.d.ts.map +1 -0
- package/dist/deploy/settings/exec.js +20 -0
- package/dist/deploy/settings/exec.js.map +1 -0
- package/dist/deploy/settings/identity.d.ts +18 -0
- package/dist/deploy/settings/identity.d.ts.map +1 -0
- package/dist/deploy/settings/identity.js +73 -0
- package/dist/deploy/settings/identity.js.map +1 -0
- package/dist/deploy/settings/index.d.ts +11 -0
- package/dist/deploy/settings/index.d.ts.map +1 -0
- package/dist/deploy/settings/index.js +103 -0
- package/dist/deploy/settings/index.js.map +1 -0
- package/dist/deploy/settings/package-manifest.d.ts +16 -0
- package/dist/deploy/settings/package-manifest.d.ts.map +1 -0
- package/dist/deploy/settings/package-manifest.js +42 -0
- package/dist/deploy/settings/package-manifest.js.map +1 -0
- package/dist/deploy/settings/paths.d.ts +9 -0
- package/dist/deploy/settings/paths.d.ts.map +1 -0
- package/dist/deploy/settings/paths.js +82 -0
- package/dist/deploy/settings/paths.js.map +1 -0
- package/dist/deploy/settings/screenshots.d.ts +8 -0
- package/dist/deploy/settings/screenshots.d.ts.map +1 -0
- package/dist/deploy/settings/screenshots.js +79 -0
- package/dist/deploy/settings/screenshots.js.map +1 -0
- package/dist/deploy/settings/starter.d.ts +4 -0
- package/dist/deploy/settings/starter.d.ts.map +1 -0
- package/dist/deploy/settings/starter.js +28 -0
- package/dist/deploy/settings/starter.js.map +1 -0
- package/dist/deploy/settings/version.d.ts +9 -0
- package/dist/deploy/settings/version.d.ts.map +1 -0
- package/dist/deploy/settings/version.js +37 -0
- package/dist/deploy/settings/version.js.map +1 -0
- package/dist/deploy/targets/appimage.d.ts +4 -0
- package/dist/deploy/targets/appimage.d.ts.map +1 -0
- package/dist/deploy/targets/appimage.js +105 -0
- package/dist/deploy/targets/appimage.js.map +1 -0
- package/dist/deploy/targets/deb.d.ts +4 -0
- package/dist/deploy/targets/deb.d.ts.map +1 -0
- package/dist/deploy/targets/deb.js +4 -0
- package/dist/deploy/targets/deb.js.map +1 -0
- package/dist/deploy/targets/flatpak-manifest.d.ts +6 -0
- package/dist/deploy/targets/flatpak-manifest.d.ts.map +1 -0
- package/dist/deploy/targets/flatpak-manifest.js +48 -0
- package/dist/deploy/targets/flatpak-manifest.js.map +1 -0
- package/dist/deploy/targets/flatpak-pnpm.d.ts +15 -0
- package/dist/deploy/targets/flatpak-pnpm.d.ts.map +1 -0
- package/dist/deploy/targets/flatpak-pnpm.js +69 -0
- package/dist/deploy/targets/flatpak-pnpm.js.map +1 -0
- package/dist/deploy/targets/flatpak-prebuilt.d.ts +8 -0
- package/dist/deploy/targets/flatpak-prebuilt.d.ts.map +1 -0
- package/dist/deploy/targets/flatpak-prebuilt.js +43 -0
- package/dist/deploy/targets/flatpak-prebuilt.js.map +1 -0
- package/dist/deploy/targets/flatpak-source.d.ts +5 -0
- package/dist/deploy/targets/flatpak-source.d.ts.map +1 -0
- package/dist/deploy/targets/flatpak-source.js +119 -0
- package/dist/deploy/targets/flatpak-source.js.map +1 -0
- package/dist/deploy/targets/flatpak-sources.d.ts +19 -0
- package/dist/deploy/targets/flatpak-sources.d.ts.map +1 -0
- package/dist/deploy/targets/flatpak-sources.js +122 -0
- package/dist/deploy/targets/flatpak-sources.js.map +1 -0
- package/dist/deploy/targets/flatpak.d.ts +4 -0
- package/dist/deploy/targets/flatpak.d.ts.map +1 -0
- package/dist/deploy/targets/flatpak.js +113 -0
- package/dist/deploy/targets/flatpak.js.map +1 -0
- package/dist/deploy/targets/nfpm-target.d.ts +5 -0
- package/dist/deploy/targets/nfpm-target.d.ts.map +1 -0
- package/dist/deploy/targets/nfpm-target.js +26 -0
- package/dist/deploy/targets/nfpm-target.js.map +1 -0
- package/dist/deploy/targets/rpm.d.ts +4 -0
- package/dist/deploy/targets/rpm.d.ts.map +1 -0
- package/dist/deploy/targets/rpm.js +4 -0
- package/dist/deploy/targets/rpm.js.map +1 -0
- package/dist/deploy/tools.d.ts +20 -0
- package/dist/deploy/tools.d.ts.map +1 -0
- package/dist/deploy/tools.js +106 -0
- package/dist/deploy/tools.js.map +1 -0
- package/dist/deploy/types.d.ts +140 -0
- package/dist/deploy/types.d.ts.map +1 -0
- package/dist/deploy/types.js +2 -0
- package/dist/deploy/types.js.map +1 -0
- package/dist/deploy/vendored/appimagetool.d.ts +7 -0
- package/dist/deploy/vendored/appimagetool.d.ts.map +1 -0
- package/dist/deploy/vendored/appimagetool.js +42 -0
- package/dist/deploy/vendored/appimagetool.js.map +1 -0
- package/dist/deploy/vendored/nfpm.d.ts +3 -0
- package/dist/deploy/vendored/nfpm.d.ts.map +1 -0
- package/dist/deploy/vendored/nfpm.js +60 -0
- package/dist/deploy/vendored/nfpm.js.map +1 -0
- package/dist/dev/change-queue.d.ts +11 -0
- package/dist/dev/change-queue.d.ts.map +1 -0
- package/dist/dev/change-queue.js +34 -0
- package/dist/dev/change-queue.js.map +1 -0
- package/dist/dev/failure-tracker.d.ts +10 -0
- package/dist/dev/failure-tracker.d.ts.map +1 -0
- package/dist/dev/failure-tracker.js +61 -0
- package/dist/dev/failure-tracker.js.map +1 -0
- package/dist/dev/missing-import.d.ts +4 -0
- package/dist/dev/missing-import.d.ts.map +1 -0
- package/dist/dev/missing-import.js +23 -0
- package/dist/dev/missing-import.js.map +1 -0
- package/dist/dev/runner-deps.d.ts.map +1 -1
- package/dist/dev/runner-deps.js +25 -6
- package/dist/dev/runner-deps.js.map +1 -1
- package/dist/dev/runner.d.ts +8 -4
- package/dist/dev/runner.d.ts.map +1 -1
- package/dist/dev/runner.js +334 -66
- package/dist/dev/runner.js.map +1 -1
- package/dist/dev/supervisor.d.ts +1 -2
- package/dist/dev/supervisor.d.ts.map +1 -1
- package/dist/dev/supervisor.js +1 -1
- package/dist/dev/supervisor.js.map +1 -1
- package/dist/dev/vite-dev-server.d.ts +13 -2
- package/dist/dev/vite-dev-server.d.ts.map +1 -1
- package/dist/dev/vite-dev-server.js +30 -2
- package/dist/dev/vite-dev-server.js.map +1 -1
- package/dist/internal/entry-arg.d.ts +1 -7
- package/dist/internal/entry-arg.d.ts.map +1 -1
- package/dist/internal/entry-arg.js +18 -11
- package/dist/internal/entry-arg.js.map +1 -1
- package/dist/internal/module-loads.d.ts +7 -0
- package/dist/internal/module-loads.d.ts.map +1 -0
- package/dist/internal/module-loads.js +21 -0
- package/dist/internal/module-loads.js.map +1 -0
- package/dist/internal/prepare-project.d.ts +16 -0
- package/dist/internal/prepare-project.d.ts.map +1 -0
- package/dist/internal/prepare-project.js +15 -0
- package/dist/internal/prepare-project.js.map +1 -0
- package/dist/internal/run-cli-tool.d.ts +2 -1
- package/dist/internal/run-cli-tool.d.ts.map +1 -1
- package/dist/internal/run-cli-tool.js +15 -6
- package/dist/internal/run-cli-tool.js.map +1 -1
- package/dist/internal/staging-dir.d.ts +8 -1
- package/dist/internal/staging-dir.d.ts.map +1 -1
- package/dist/internal/staging-dir.js +38 -2
- package/dist/internal/staging-dir.js.map +1 -1
- package/dist/mcp/serialize-widget.d.ts +2 -1
- package/dist/mcp/serialize-widget.d.ts.map +1 -1
- package/dist/mcp/serialize-widget.js +1 -1
- package/dist/mcp/serialize-widget.js.map +1 -1
- package/dist/mcp/testing-loader.d.ts +5 -2
- package/dist/mcp/testing-loader.d.ts.map +1 -1
- package/dist/mcp/testing-loader.js +7 -3
- package/dist/mcp/testing-loader.js.map +1 -1
- package/dist/refresh-runtime.d.ts +2 -1
- package/dist/refresh-runtime.d.ts.map +1 -1
- package/dist/refresh-runtime.js +32 -2
- package/dist/refresh-runtime.js.map +1 -1
- package/dist/settings/schema.d.ts +1 -2
- package/dist/settings/schema.d.ts.map +1 -1
- package/dist/settings/schema.js +1 -1
- package/dist/settings/schema.js.map +1 -1
- package/dist/vite-plugins/asset-extensions.d.ts +2 -1
- package/dist/vite-plugins/asset-extensions.d.ts.map +1 -1
- package/dist/vite-plugins/asset-extensions.js +2 -1
- package/dist/vite-plugins/asset-extensions.js.map +1 -1
- package/dist/vite-plugins/asset-imports.d.ts +4 -0
- package/dist/vite-plugins/asset-imports.d.ts.map +1 -0
- package/dist/vite-plugins/asset-imports.js +88 -0
- package/dist/vite-plugins/asset-imports.js.map +1 -0
- package/dist/vite-plugins/asset-specifier.d.ts +5 -0
- package/dist/vite-plugins/asset-specifier.d.ts.map +1 -0
- package/dist/vite-plugins/asset-specifier.js +7 -0
- package/dist/vite-plugins/asset-specifier.js.map +1 -0
- package/dist/vite-plugins/esm-extension.d.ts +4 -0
- package/dist/vite-plugins/esm-extension.d.ts.map +1 -0
- package/dist/vite-plugins/esm-extension.js +4 -0
- package/dist/vite-plugins/esm-extension.js.map +1 -0
- package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts +1 -3
- package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts.map +1 -1
- package/dist/vite-plugins/fast-refresh/swc-refresh.js +1 -1
- package/dist/vite-plugins/fast-refresh/swc-refresh.js.map +1 -1
- package/dist/vite-plugins/index.d.ts.map +1 -1
- package/dist/vite-plugins/index.js +4 -0
- package/dist/vite-plugins/index.js.map +1 -1
- package/dist/vite-plugins/resource-shared.d.ts +2 -1
- package/dist/vite-plugins/resource-shared.d.ts.map +1 -1
- package/dist/vite-plugins/resource-shared.js +2 -1
- package/dist/vite-plugins/resource-shared.js.map +1 -1
- package/dist/vite-plugins/resources.d.ts.map +1 -1
- package/dist/vite-plugins/resources.js +30 -29
- package/dist/vite-plugins/resources.js.map +1 -1
- package/dist/vite-plugins/self-contained.d.ts +4 -0
- package/dist/vite-plugins/self-contained.d.ts.map +1 -0
- package/dist/vite-plugins/self-contained.js +244 -0
- package/dist/vite-plugins/self-contained.js.map +1 -0
- package/dist/vite-plugins/settings.d.ts.map +1 -1
- package/dist/vite-plugins/settings.js +19 -40
- package/dist/vite-plugins/settings.js.map +1 -1
- package/dist/vite-plugins/store-links.d.ts +4 -0
- package/dist/vite-plugins/store-links.d.ts.map +1 -0
- package/dist/vite-plugins/store-links.js +19 -0
- package/dist/vite-plugins/store-links.js.map +1 -0
- package/dist/vite-plugins/undeclared-library.d.ts.map +1 -1
- package/dist/vite-plugins/undeclared-library.js +51 -12
- package/dist/vite-plugins/undeclared-library.js.map +1 -1
- package/dist/vite-plugins/worker.d.ts.map +1 -1
- package/dist/vite-plugins/worker.js +3 -1
- package/dist/vite-plugins/worker.js.map +1 -1
- package/env.d.ts +106 -25
- package/package.json +20 -13
- package/src/builder.ts +22 -4
- package/src/cli.ts +7 -2
- package/src/codegen/freshness.ts +2 -2
- package/src/codegen/report.ts +4 -0
- package/src/codegen/run-codegen.ts +48 -24
- package/src/codegen/store-resolver.ts +1 -1
- package/src/commands/build.ts +5 -6
- package/src/commands/codegen.ts +14 -1
- package/src/commands/deploy.ts +47 -0
- package/src/commands/dev.ts +4 -4
- package/src/commands/docs.ts +40 -4
- package/src/deploy/depends.ts +42 -0
- package/src/deploy/download.ts +148 -0
- package/src/deploy/freedesktop/copyright.ts +41 -0
- package/src/deploy/freedesktop/dbus-service.ts +19 -0
- package/src/deploy/freedesktop/desktop-entry.ts +102 -0
- package/src/deploy/freedesktop/ini.ts +39 -0
- package/src/deploy/freedesktop/metainfo-sections.ts +116 -0
- package/src/deploy/freedesktop/metainfo.ts +46 -0
- package/src/deploy/freedesktop/mime-package.ts +28 -0
- package/src/deploy/freedesktop/validate.ts +124 -0
- package/src/deploy/freedesktop/xml.ts +53 -0
- package/src/deploy/git.ts +20 -0
- package/src/deploy/install-hints.ts +111 -0
- package/src/deploy/nfpm/config.ts +153 -0
- package/src/deploy/nfpm/contents.ts +69 -0
- package/src/deploy/nfpm/description.ts +11 -0
- package/src/deploy/nfpm/optional.ts +8 -0
- package/src/deploy/nfpm/pack.ts +44 -0
- package/src/deploy/node-runtime/download.ts +48 -0
- package/src/deploy/node-runtime/elf.ts +145 -0
- package/src/deploy/node-runtime/guard.ts +29 -0
- package/src/deploy/node-runtime/index.ts +80 -0
- package/src/deploy/payload/copy-tree.ts +51 -0
- package/src/deploy/payload/icons.ts +80 -0
- package/src/deploy/payload/launcher.ts +27 -0
- package/src/deploy/payload/schemas.ts +27 -0
- package/src/deploy/payload/stage.ts +145 -0
- package/src/deploy/registry.ts +40 -0
- package/src/deploy/run-deploy.ts +241 -0
- package/src/deploy/settings/arch.ts +18 -0
- package/src/deploy/settings/categories.ts +39 -0
- package/src/deploy/settings/exec.ts +29 -0
- package/src/deploy/settings/identity.ts +133 -0
- package/src/deploy/settings/index.ts +189 -0
- package/src/deploy/settings/package-manifest.ts +68 -0
- package/src/deploy/settings/paths.ts +115 -0
- package/src/deploy/settings/screenshots.ts +125 -0
- package/src/deploy/settings/starter.ts +41 -0
- package/src/deploy/settings/version.ts +59 -0
- package/src/deploy/targets/appimage.ts +140 -0
- package/src/deploy/targets/deb.ts +6 -0
- package/src/deploy/targets/flatpak-manifest.ts +61 -0
- package/src/deploy/targets/flatpak-pnpm.ts +115 -0
- package/src/deploy/targets/flatpak-prebuilt.ts +59 -0
- package/src/deploy/targets/flatpak-source.ts +181 -0
- package/src/deploy/targets/flatpak-sources.ts +198 -0
- package/src/deploy/targets/flatpak.ts +144 -0
- package/src/deploy/targets/nfpm-target.ts +33 -0
- package/src/deploy/targets/rpm.ts +6 -0
- package/src/deploy/tools.ts +156 -0
- package/src/deploy/types.ts +174 -0
- package/src/deploy/vendored/appimagetool.ts +57 -0
- package/src/deploy/vendored/nfpm.ts +79 -0
- package/src/dev/change-queue.ts +59 -0
- package/src/dev/failure-tracker.ts +92 -0
- package/src/dev/missing-import.ts +32 -0
- package/src/dev/runner-deps.ts +34 -6
- package/src/dev/runner.ts +506 -102
- package/src/dev/supervisor.ts +0 -3
- package/src/dev/vite-dev-server.ts +54 -3
- package/src/internal/entry-arg.ts +25 -11
- package/src/internal/module-loads.ts +32 -0
- package/src/internal/prepare-project.ts +23 -0
- package/src/internal/run-cli-tool.ts +22 -6
- package/src/internal/staging-dir.ts +57 -2
- package/src/mcp/serialize-widget.ts +3 -2
- package/src/mcp/testing-loader.ts +19 -4
- package/src/refresh-runtime.ts +48 -2
- package/src/settings/schema.ts +0 -1
- package/src/vite-plugins/asset-extensions.ts +2 -1
- package/src/vite-plugins/asset-imports.ts +134 -0
- package/src/vite-plugins/asset-specifier.ts +9 -0
- package/src/vite-plugins/esm-extension.ts +4 -0
- package/src/vite-plugins/fast-refresh/swc-refresh.ts +1 -1
- package/src/vite-plugins/index.ts +4 -0
- package/src/vite-plugins/resource-shared.ts +2 -0
- package/src/vite-plugins/resources.ts +33 -33
- package/src/vite-plugins/self-contained.ts +352 -0
- package/src/vite-plugins/settings.ts +21 -48
- package/src/vite-plugins/store-links.ts +25 -0
- package/src/vite-plugins/undeclared-library.ts +74 -12
- package/src/vite-plugins/worker.ts +4 -1
- package/dist/internal.d.ts +0 -3
- package/dist/internal.d.ts.map +0 -1
- package/dist/internal.js +0 -3
- package/dist/internal.js.map +0 -1
- package/src/internal.ts +0 -2
package/src/dev/runner.ts
CHANGED
|
@@ -1,24 +1,37 @@
|
|
|
1
|
+
import type { ApplicationInstance } from "@gtkx/runtime/internal";
|
|
1
2
|
import type { InlineConfig, Plugin } from "vite";
|
|
2
|
-
import { error } from "@gtkx/utils";
|
|
3
|
+
import { error, warn } from "@gtkx/utils";
|
|
4
|
+
import { loadModuleExclusively, withExclusiveLoad } from "../internal/module-loads.js";
|
|
5
|
+
import { createChangeQueue, type WatchedChange } from "./change-queue.js";
|
|
6
|
+
import { createFailureTracker, type FailureTracker } from "./failure-tracker.js";
|
|
7
|
+
import { isMissingImport, missingImportName } from "./missing-import.js";
|
|
3
8
|
import { createRefreshTracker, type RefreshTracker } from "./refresh-tracker.js";
|
|
4
9
|
import { RESTART_EXIT_CODE } from "./supervisor.js";
|
|
5
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
createDevServerConfig,
|
|
12
|
+
type DevServer,
|
|
13
|
+
type DevServerChangedModule,
|
|
14
|
+
type DevServerWatchEvent,
|
|
15
|
+
isServerConfigFile,
|
|
16
|
+
} from "./vite-dev-server.js";
|
|
17
|
+
|
|
18
|
+
type LoadAppModule = (id: string) => Promise<Record<string, unknown>>;
|
|
6
19
|
|
|
7
20
|
type DevRunnerDeps = {
|
|
8
21
|
createServer(config: InlineConfig): Promise<DevServer>;
|
|
9
|
-
waitForApplicationId(timeoutMs: number): Promise<string | null>;
|
|
22
|
+
waitForApplicationId(timeoutMs: number, shouldKeepWaiting: () => boolean): Promise<string | null>;
|
|
10
23
|
getConfiguredApplicationId(root: string): Promise<string | undefined>;
|
|
11
|
-
startMcpClient(
|
|
12
|
-
applicationId: string,
|
|
13
|
-
loadAppModule: (id: string) => Promise<Record<string, unknown>>,
|
|
14
|
-
): Promise<unknown>;
|
|
24
|
+
startMcpClient(applicationId: string, loadAppModule: LoadAppModule): Promise<unknown>;
|
|
15
25
|
stopMcpClient(): void;
|
|
16
26
|
watchApplicationShutdown(onShutdown: () => void): void;
|
|
17
|
-
|
|
27
|
+
watchUncaughtErrors(onUncaughtError: (cause: unknown) => void): void;
|
|
28
|
+
getApplicationInstance(): ApplicationInstance;
|
|
18
29
|
installShutdownHandlers(onSignal: () => void | Promise<void>): void;
|
|
19
30
|
quitDefaultApplication(): void;
|
|
20
31
|
performRefresh: () => void;
|
|
21
32
|
isRefreshBoundary(module: Record<string, unknown>): boolean;
|
|
33
|
+
staleExportName(previous: Record<string, unknown>, current: Record<string, unknown>): string | null;
|
|
34
|
+
readFileRevision(path: string): Promise<string>;
|
|
22
35
|
plugins(): Plugin[];
|
|
23
36
|
log(message: string): void;
|
|
24
37
|
exit(code: number): never;
|
|
@@ -33,48 +46,304 @@ type ShutdownController = {
|
|
|
33
46
|
shutdown: (quitApplication: () => void) => Promise<void>;
|
|
34
47
|
};
|
|
35
48
|
|
|
49
|
+
type DevSession = {
|
|
50
|
+
server: DevServer;
|
|
51
|
+
deps: DevRunnerDeps;
|
|
52
|
+
controller: ShutdownController;
|
|
53
|
+
refreshTracker: RefreshTracker;
|
|
54
|
+
failure: FailureTracker;
|
|
55
|
+
pendingSaves: Map<string, string>;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
type SettledLoad = {
|
|
59
|
+
loadedExports: Record<string, unknown>;
|
|
60
|
+
isSettled: boolean;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
type SettleAttempt = {
|
|
64
|
+
loadedExports: Record<string, unknown> | null;
|
|
65
|
+
module: DevServerChangedModule;
|
|
66
|
+
};
|
|
67
|
+
|
|
36
68
|
const APPLICATION_MOUNT_TIMEOUT_MS = 10_000;
|
|
69
|
+
const OWNED_ID_EXIT_CODE = 1;
|
|
70
|
+
const LOAD_ATTEMPT_LIMIT = 5;
|
|
71
|
+
const WATCH_EVENTS: DevServerWatchEvent[] = ["add", "change", "unlink"];
|
|
72
|
+
const SKIP_REASON = `did not settle in ${String(LOAD_ATTEMPT_LIMIT)} attempts; save it again to patch the window.`;
|
|
73
|
+
const DROPPED_REFRESH = "Fast Refresh dropped";
|
|
74
|
+
const SAVE_ACTION = "File changed";
|
|
75
|
+
const RETRY_ACTION = "Retrying pending save";
|
|
76
|
+
|
|
77
|
+
const announceFailure = (server: DevServer, cause: unknown): void => {
|
|
78
|
+
if (cause instanceof Error) {
|
|
79
|
+
server.ssrFixStacktrace(cause);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
error("Application error; keeping the dev server up. Fix the error and save again.", cause);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const parkSession = (session: DevSession): void => {
|
|
86
|
+
session.deps.log("Waiting for a change to restart the application...");
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const requestRestart = async (session: DevSession): Promise<never> => {
|
|
90
|
+
session.deps.log("Full restart (process restart)");
|
|
91
|
+
|
|
92
|
+
try {
|
|
93
|
+
await session.server.close();
|
|
94
|
+
} catch (error_) {
|
|
95
|
+
error("Error closing server before the restart:", error_);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return session.deps.exit(RESTART_EXIT_CODE);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const requiresRestart = (session: DevSession, module: DevServerChangedModule): boolean => {
|
|
102
|
+
if (session.failure.isDown()) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const loadedExports = module.ssrModule;
|
|
107
|
+
|
|
108
|
+
if (!loadedExports) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return !session.deps.isRefreshBoundary(loadedExports);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const invalidateChangedModule = (session: DevSession, module: DevServerChangedModule): void => {
|
|
116
|
+
session.server.moduleGraph.invalidateModule(module);
|
|
117
|
+
|
|
118
|
+
for (const importer of module.importers) {
|
|
119
|
+
session.server.moduleGraph.invalidateModule(importer);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const isEvaluationCurrent = (
|
|
124
|
+
session: DevSession,
|
|
125
|
+
changedPath: string,
|
|
126
|
+
loadedExports: Record<string, unknown>,
|
|
127
|
+
): boolean => {
|
|
128
|
+
const evaluated = session.server.moduleGraph.getModuleById(changedPath);
|
|
129
|
+
|
|
130
|
+
if (!evaluated?.ssrTransformResult) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return evaluated.ssrModule === loadedExports;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const loadInvalidatedModule = (
|
|
138
|
+
session: DevSession,
|
|
139
|
+
changedPath: string,
|
|
140
|
+
module: DevServerChangedModule,
|
|
141
|
+
): Promise<SettledLoad> =>
|
|
142
|
+
withExclusiveLoad(session.server, async () => {
|
|
143
|
+
const revision = await session.deps.readFileRevision(changedPath);
|
|
144
|
+
invalidateChangedModule(session, module);
|
|
145
|
+
const loadedExports = await session.server.ssrLoadModule(changedPath);
|
|
146
|
+
const settledRevision = await session.deps.readFileRevision(changedPath);
|
|
147
|
+
|
|
148
|
+
return {
|
|
149
|
+
loadedExports,
|
|
150
|
+
isSettled: settledRevision === revision && isEvaluationCurrent(session, changedPath, loadedExports),
|
|
151
|
+
};
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
const settleAttempt = async (
|
|
155
|
+
session: DevSession,
|
|
156
|
+
changedPath: string,
|
|
157
|
+
module: DevServerChangedModule,
|
|
158
|
+
): Promise<SettleAttempt> => {
|
|
159
|
+
const { loadedExports, isSettled } = await loadInvalidatedModule(session, changedPath, module);
|
|
160
|
+
|
|
161
|
+
if (isSettled) {
|
|
162
|
+
return { loadedExports, module };
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return { loadedExports: null, module: session.server.moduleGraph.getModuleById(changedPath) ?? module };
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const loadSettledExports = async (
|
|
169
|
+
session: DevSession,
|
|
170
|
+
changedPath: string,
|
|
171
|
+
changedModule: DevServerChangedModule,
|
|
172
|
+
): Promise<Record<string, unknown> | null> => {
|
|
173
|
+
let module = changedModule;
|
|
174
|
+
|
|
175
|
+
for (let round = 0; round < LOAD_ATTEMPT_LIMIT && !session.controller.isShuttingDown(); round++) {
|
|
176
|
+
const attempt = await settleAttempt(session, changedPath, module);
|
|
177
|
+
|
|
178
|
+
if (attempt.loadedExports) {
|
|
179
|
+
return attempt.loadedExports;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
module = attempt.module;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return null;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const droppedExportName = (previous: Record<string, unknown>, current: Record<string, unknown>): string | null => {
|
|
189
|
+
const kept = new Set(Object.keys(current));
|
|
190
|
+
|
|
191
|
+
for (const name of Object.keys(previous)) {
|
|
192
|
+
if (!kept.has(name)) {
|
|
193
|
+
return name;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
37
196
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
197
|
+
return null;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const unpatchedExportReason = (
|
|
201
|
+
session: DevSession,
|
|
202
|
+
previous: Record<string, unknown> | null,
|
|
203
|
+
current: Record<string, unknown>,
|
|
204
|
+
): string | null => {
|
|
205
|
+
if (!previous) {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const dropped = droppedExportName(previous, current);
|
|
210
|
+
|
|
211
|
+
if (dropped !== null) {
|
|
212
|
+
return `no longer exports ${dropped}, which its importers still hold`;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const stale = session.deps.staleExportName(previous, current);
|
|
216
|
+
|
|
217
|
+
if (stale === null) {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return `renamed the component it exports as ${stale}, which the window is still rendering`;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const refreshChangedModule = async (
|
|
225
|
+
session: DevSession,
|
|
226
|
+
changedPath: string,
|
|
227
|
+
changedModule: DevServerChangedModule,
|
|
228
|
+
previous: Record<string, unknown> | null,
|
|
229
|
+
): Promise<void> => {
|
|
230
|
+
const loadedExports = await loadSettledExports(session, changedPath, changedModule);
|
|
231
|
+
|
|
232
|
+
if (session.controller.isShuttingDown()) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (!loadedExports) {
|
|
237
|
+
warn(`Fast Refresh skipped: ${changedPath} ${SKIP_REASON}`);
|
|
238
|
+
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (!session.deps.isRefreshBoundary(loadedExports)) {
|
|
243
|
+
await requestRestart(session);
|
|
244
|
+
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const unpatched = unpatchedExportReason(session, previous, loadedExports);
|
|
249
|
+
|
|
250
|
+
if (unpatched !== null) {
|
|
251
|
+
warn(`${DROPPED_REFRESH}: ${changedPath} ${unpatched}`);
|
|
252
|
+
await requestRestart(session);
|
|
253
|
+
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
41
256
|
|
|
42
|
-
|
|
257
|
+
session.pendingSaves.delete(changedPath);
|
|
258
|
+
session.deps.log("Running Fast Refresh...");
|
|
259
|
+
session.deps.performRefresh();
|
|
260
|
+
session.deps.log("Fast Refresh complete");
|
|
43
261
|
};
|
|
44
262
|
|
|
45
|
-
const
|
|
46
|
-
const module = server.moduleGraph.getModuleById(changedPath);
|
|
263
|
+
const applyModuleChange = async (session: DevSession, changedPath: string, action: string): Promise<void> => {
|
|
264
|
+
const module = session.server.moduleGraph.getModuleById(changedPath);
|
|
47
265
|
|
|
48
266
|
if (!module) {
|
|
49
267
|
return;
|
|
50
268
|
}
|
|
51
269
|
|
|
52
|
-
deps.log(
|
|
53
|
-
const loadedExports = module.ssrModule;
|
|
270
|
+
session.deps.log(`${action}: ${changedPath}`);
|
|
54
271
|
|
|
55
|
-
if (
|
|
56
|
-
await requestRestart(
|
|
272
|
+
if (requiresRestart(session, module)) {
|
|
273
|
+
await requestRestart(session);
|
|
57
274
|
|
|
58
275
|
return;
|
|
59
276
|
}
|
|
60
277
|
|
|
61
|
-
|
|
278
|
+
await refreshChangedModule(session, changedPath, module, module.ssrModule ?? null);
|
|
279
|
+
};
|
|
62
280
|
|
|
63
|
-
|
|
64
|
-
|
|
281
|
+
const awaitMissingImport = (session: DevSession, changedPath: string, cause: unknown): void => {
|
|
282
|
+
const missingName = missingImportName(cause);
|
|
283
|
+
|
|
284
|
+
if (missingName === null) {
|
|
285
|
+
session.pendingSaves.delete(changedPath);
|
|
286
|
+
|
|
287
|
+
return;
|
|
65
288
|
}
|
|
66
289
|
|
|
67
|
-
|
|
290
|
+
session.pendingSaves.set(changedPath, missingName);
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
const applySave = async (session: DevSession, changedPath: string, action: string): Promise<void> => {
|
|
294
|
+
try {
|
|
295
|
+
await applyModuleChange(session, changedPath, action);
|
|
296
|
+
} catch (error_) {
|
|
297
|
+
if (session.controller.isShuttingDown()) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
awaitMissingImport(session, changedPath, error_);
|
|
302
|
+
error("Hot reload failed:", error_);
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
const savesAwaiting = (session: DevSession, createdPath: string): string[] =>
|
|
307
|
+
[...session.pendingSaves]
|
|
308
|
+
.filter(([, missingName]) => isMissingImport(createdPath, missingName))
|
|
309
|
+
.map(([changedPath]) => changedPath);
|
|
310
|
+
|
|
311
|
+
const retryPendingSaves = async (session: DevSession, waiting: string[]): Promise<void> => {
|
|
312
|
+
for (const changedPath of waiting) {
|
|
313
|
+
if (session.controller.isShuttingDown()) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
session.pendingSaves.delete(changedPath);
|
|
318
|
+
await applySave(session, changedPath, RETRY_ACTION);
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
const handleFileCreate = async (session: DevSession, createdPath: string): Promise<void> => {
|
|
323
|
+
const waiting = savesAwaiting(session, createdPath);
|
|
324
|
+
|
|
325
|
+
if (waiting.length === 0) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
session.deps.log(`File created: ${createdPath}`);
|
|
330
|
+
|
|
331
|
+
if (session.failure.isDown()) {
|
|
332
|
+
await requestRestart(session);
|
|
68
333
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
await retryPendingSaves(session, waiting);
|
|
338
|
+
};
|
|
73
339
|
|
|
340
|
+
const handleFileRemove = async (session: DevSession, removedPath: string): Promise<void> => {
|
|
341
|
+
if (!session.server.moduleGraph.getModuleById(removedPath)) {
|
|
74
342
|
return;
|
|
75
343
|
}
|
|
76
344
|
|
|
77
|
-
|
|
345
|
+
session.deps.log(`File removed: ${removedPath}`);
|
|
346
|
+
await requestRestart(session);
|
|
78
347
|
};
|
|
79
348
|
|
|
80
349
|
const createShutdownController = (server: DevServer, deps: DevRunnerDeps): ShutdownController => {
|
|
@@ -95,91 +364,188 @@ const createShutdownController = (server: DevServer, deps: DevRunnerDeps): Shutd
|
|
|
95
364
|
};
|
|
96
365
|
};
|
|
97
366
|
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
367
|
+
const restartForServerConfig = async (session: DevSession, changedPath: string): Promise<void> => {
|
|
368
|
+
session.deps.log(`Server config changed: ${changedPath}`);
|
|
369
|
+
await requestRestart(session);
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
const applyChange = async (session: DevSession, change: WatchedChange): Promise<void> => {
|
|
373
|
+
if (session.controller.isShuttingDown()) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if (isServerConfigFile(session.server.config, change.path)) {
|
|
378
|
+
await restartForServerConfig(session, change.path);
|
|
379
|
+
|
|
380
|
+
return;
|
|
103
381
|
}
|
|
382
|
+
|
|
383
|
+
if (change.event === "add") {
|
|
384
|
+
await handleFileCreate(session, change.path);
|
|
385
|
+
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
if (change.event === "unlink") {
|
|
390
|
+
await handleFileRemove(session, change.path);
|
|
391
|
+
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
await applySave(session, change.path, SAVE_ACTION);
|
|
104
396
|
};
|
|
105
397
|
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
(changedPath) => {
|
|
109
|
-
if (controller.isShuttingDown()) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
398
|
+
const watchProjectFiles = (session: DevSession): void => {
|
|
399
|
+
const queue = createChangeQueue((change) => applyChange(session, change));
|
|
112
400
|
|
|
113
|
-
|
|
114
|
-
|
|
401
|
+
for (const event of WATCH_EVENTS) {
|
|
402
|
+
session.server.watcher.on(event, (path) => {
|
|
403
|
+
queue.enqueue({ event, path });
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
};
|
|
115
407
|
|
|
116
|
-
const onShutdownSignal =
|
|
117
|
-
(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
408
|
+
const onShutdownSignal = (session: DevSession): (() => Promise<void>) => async () => {
|
|
409
|
+
if (session.controller.isShuttingDown()) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
122
412
|
|
|
123
|
-
|
|
413
|
+
session.deps.log("Received shutdown signal - stopping dev runner...");
|
|
124
414
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
415
|
+
await session.controller.shutdown(() => {
|
|
416
|
+
session.deps.quitDefaultApplication();
|
|
417
|
+
});
|
|
418
|
+
};
|
|
129
419
|
|
|
130
|
-
const closeAndExit = async (
|
|
131
|
-
deps: DevRunnerDeps,
|
|
132
|
-
controller: ShutdownController,
|
|
133
|
-
code = 0,
|
|
134
|
-
): Promise<never> => {
|
|
420
|
+
const closeAndExit = async (session: DevSession, code = 0): Promise<never> => {
|
|
135
421
|
try {
|
|
136
|
-
await controller.shutdown((): void => undefined);
|
|
422
|
+
await session.controller.shutdown((): void => undefined);
|
|
137
423
|
} catch (error_) {
|
|
138
424
|
error("Error closing server:", error_);
|
|
139
425
|
|
|
140
|
-
return deps.exit(1);
|
|
426
|
+
return session.deps.exit(1);
|
|
141
427
|
}
|
|
142
428
|
|
|
143
|
-
return deps.exit(code);
|
|
429
|
+
return session.deps.exit(code);
|
|
144
430
|
};
|
|
145
431
|
|
|
146
|
-
const
|
|
147
|
-
(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
432
|
+
const isSessionInactive = (session: DevSession): boolean => {
|
|
433
|
+
if (session.controller.isShuttingDown()) {
|
|
434
|
+
return true;
|
|
435
|
+
}
|
|
152
436
|
|
|
153
|
-
|
|
154
|
-
|
|
437
|
+
if (!session.failure.isDown()) {
|
|
438
|
+
return false;
|
|
439
|
+
}
|
|
155
440
|
|
|
156
|
-
|
|
157
|
-
}
|
|
441
|
+
parkSession(session);
|
|
158
442
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
443
|
+
return true;
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
const stopForApplicationQuit = (session: DevSession): Promise<never> => {
|
|
447
|
+
session.deps.log("Application quit - stopping dev runner...");
|
|
448
|
+
|
|
449
|
+
return closeAndExit(session);
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
const settleUnmount = (session: DevSession, wasRefreshing: boolean): void => {
|
|
453
|
+
if (isSessionInactive(session)) {
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
if (!wasRefreshing) {
|
|
458
|
+
void stopForApplicationQuit(session);
|
|
459
|
+
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
session.deps.log("Application unmounted during Fast Refresh - restarting dev runner...");
|
|
464
|
+
session.deps.exit(RESTART_EXIT_CODE);
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
const handleApplicationShutdown = (session: DevSession): void => {
|
|
468
|
+
if (isSessionInactive(session)) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
const wasRefreshing = session.refreshTracker.isRefreshing();
|
|
473
|
+
|
|
474
|
+
session.failure.settleUnmount(() => {
|
|
475
|
+
settleUnmount(session, wasRefreshing);
|
|
476
|
+
});
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
const onApplicationShutdown = (session: DevSession): (() => void) => () => {
|
|
480
|
+
handleApplicationShutdown(session);
|
|
481
|
+
};
|
|
162
482
|
|
|
163
483
|
const refusedExitCode = (): number => (process.exitCode === undefined ? 1 : Number(process.exitCode));
|
|
164
484
|
|
|
165
|
-
const connectApplication = async (
|
|
166
|
-
deps
|
|
167
|
-
|
|
168
|
-
liveApplicationId: string,
|
|
169
|
-
tracked: { refreshTracker: RefreshTracker; controller: ShutdownController },
|
|
170
|
-
): Promise<void> => {
|
|
171
|
-
deps.watchApplicationShutdown(onApplicationShutdown(deps, tracked.refreshTracker, tracked.controller));
|
|
485
|
+
const connectApplication = async (session: DevSession, liveApplicationId: string): Promise<void> => {
|
|
486
|
+
const { deps, server } = session;
|
|
487
|
+
deps.watchApplicationShutdown(onApplicationShutdown(session));
|
|
172
488
|
const applicationId = (await deps.getConfiguredApplicationId(process.cwd())) ?? liveApplicationId;
|
|
173
489
|
deps.log(`Connected application ID: ${applicationId}`);
|
|
174
|
-
await deps.startMcpClient(applicationId, (id) => server
|
|
490
|
+
await deps.startMcpClient(applicationId, (id) => loadModuleExclusively(server, id));
|
|
175
491
|
};
|
|
176
492
|
|
|
177
|
-
const
|
|
178
|
-
deps
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
)
|
|
182
|
-
|
|
493
|
+
const stopForOwnedApplicationId = async (session: DevSession, liveApplicationId: string): Promise<void> => {
|
|
494
|
+
session.deps.log(
|
|
495
|
+
`Another process already owns ${liveApplicationId}, so this session can never show a window - ` +
|
|
496
|
+
"stopping dev runner. Quit that instance or change applicationId, then start gtkx dev again.",
|
|
497
|
+
);
|
|
498
|
+
|
|
499
|
+
await closeAndExit(session, OWNED_ID_EXIT_CODE);
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
const stopForStoppedApplication = async (session: DevSession, instance: ApplicationInstance): Promise<void> => {
|
|
503
|
+
if (session.failure.hasReported()) {
|
|
504
|
+
session.deps.log("Application stopped before the dev runner attached.");
|
|
505
|
+
session.failure.fail();
|
|
506
|
+
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
if (instance === "shutDown") {
|
|
511
|
+
await stopForApplicationQuit(session);
|
|
512
|
+
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
session.deps.log("Application refused its command line - stopping dev runner...");
|
|
517
|
+
await closeAndExit(session, refusedExitCode());
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
const connectLiveApplication = async (session: DevSession, liveApplicationId: string): Promise<void> => {
|
|
521
|
+
const instance = session.deps.getApplicationInstance();
|
|
522
|
+
|
|
523
|
+
if (instance === "primary") {
|
|
524
|
+
await connectApplication(session, liveApplicationId);
|
|
525
|
+
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if (instance === "remote") {
|
|
530
|
+
await stopForOwnedApplicationId(session, liveApplicationId);
|
|
531
|
+
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
await stopForStoppedApplication(session, instance);
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
const attachApplication = async (session: DevSession): Promise<void> => {
|
|
539
|
+
const { deps, failure } = session;
|
|
540
|
+
|
|
541
|
+
const liveApplicationId = await deps.waitForApplicationId(
|
|
542
|
+
APPLICATION_MOUNT_TIMEOUT_MS,
|
|
543
|
+
() => !failure.isDown(),
|
|
544
|
+
);
|
|
545
|
+
|
|
546
|
+
if (failure.isDown()) {
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
183
549
|
|
|
184
550
|
if (liveApplicationId === null) {
|
|
185
551
|
deps.log("Entry did not mount an application - MCP client not started.");
|
|
@@ -187,30 +553,68 @@ const attachApplication = async (
|
|
|
187
553
|
return;
|
|
188
554
|
}
|
|
189
555
|
|
|
190
|
-
|
|
191
|
-
|
|
556
|
+
await connectLiveApplication(session, liveApplicationId);
|
|
557
|
+
};
|
|
192
558
|
|
|
193
|
-
|
|
559
|
+
const loadEntry = async (session: DevSession, entryPath: string): Promise<void> => {
|
|
560
|
+
session.deps.log(`Loading entry: ${entryPath}`);
|
|
561
|
+
|
|
562
|
+
try {
|
|
563
|
+
await loadModuleExclusively(session.server, entryPath);
|
|
564
|
+
} catch (error_) {
|
|
565
|
+
awaitMissingImport(session, entryPath, error_);
|
|
566
|
+
session.failure.fail(error_);
|
|
194
567
|
}
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
const hasApplicationStopped = (instance: ApplicationInstance): boolean =>
|
|
571
|
+
instance === "shutDown" || instance === "unregistered";
|
|
195
572
|
|
|
196
|
-
|
|
573
|
+
const isApplicationLost = (session: DevSession): boolean =>
|
|
574
|
+
session.failure.hasReported() && hasApplicationStopped(session.deps.getApplicationInstance());
|
|
575
|
+
|
|
576
|
+
const announceReady = (session: DevSession): void => {
|
|
577
|
+
if (isApplicationLost(session)) {
|
|
578
|
+
session.failure.fail();
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
if (isSessionInactive(session)) {
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
session.deps.log("HMR enabled - watching for changes...");
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
const createSession = (server: DevServer, deps: DevRunnerDeps): DevSession => {
|
|
589
|
+
const refreshTracker = createRefreshTracker(deps.performRefresh);
|
|
590
|
+
|
|
591
|
+
return {
|
|
592
|
+
server,
|
|
593
|
+
deps: { ...deps, performRefresh: refreshTracker.performRefresh },
|
|
594
|
+
controller: createShutdownController(server, deps),
|
|
595
|
+
refreshTracker,
|
|
596
|
+
failure: createFailureTracker((cause) => {
|
|
597
|
+
announceFailure(server, cause);
|
|
598
|
+
}, refreshTracker.isRefreshing),
|
|
599
|
+
pendingSaves: new Map(),
|
|
600
|
+
};
|
|
197
601
|
};
|
|
198
602
|
|
|
199
603
|
const createDevRunner = (deps: DevRunnerDeps): DevRunner => ({
|
|
200
604
|
async run(entryPath: string): Promise<void> {
|
|
201
|
-
const
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
await
|
|
211
|
-
|
|
605
|
+
const server = await deps.createServer(createDevServerConfig(process.cwd(), deps.plugins()));
|
|
606
|
+
const session = createSession(server, deps);
|
|
607
|
+
deps.installShutdownHandlers(onShutdownSignal(session));
|
|
608
|
+
|
|
609
|
+
deps.watchUncaughtErrors((cause) => {
|
|
610
|
+
session.failure.report(cause);
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
watchProjectFiles(session);
|
|
614
|
+
await loadEntry(session, entryPath);
|
|
615
|
+
await attachApplication(session);
|
|
616
|
+
announceReady(session);
|
|
212
617
|
},
|
|
213
618
|
});
|
|
214
619
|
|
|
215
|
-
export type { DevServer } from "./vite-dev-server.js";
|
|
216
620
|
export { createDevRunner, type DevRunnerDeps };
|