@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/supervisor.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { InlineConfig, Plugin } from "vite";
|
|
2
|
+
import { join } from "node:path";
|
|
2
3
|
|
|
3
4
|
type DevServerModule = object;
|
|
5
|
+
type DevServerWatchEvent = "add" | "change" | "unlink";
|
|
4
6
|
|
|
5
7
|
type DevServerChangedModule = DevServerModule & {
|
|
6
8
|
importers: Iterable<DevServerModule>;
|
|
7
9
|
ssrModule?: Record<string, unknown> | null;
|
|
10
|
+
ssrTransformResult?: object | null;
|
|
8
11
|
};
|
|
9
12
|
|
|
10
13
|
type DevServerModuleGraph = {
|
|
@@ -12,20 +15,62 @@ type DevServerModuleGraph = {
|
|
|
12
15
|
invalidateModule(module: DevServerModule): void;
|
|
13
16
|
};
|
|
14
17
|
|
|
18
|
+
type DevServerConfig = {
|
|
19
|
+
configFile: string | undefined;
|
|
20
|
+
configFileDependencies: string[];
|
|
21
|
+
envDir: string | false;
|
|
22
|
+
mode: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
15
25
|
type DevServer = {
|
|
16
26
|
close(): Promise<void>;
|
|
27
|
+
config: DevServerConfig;
|
|
17
28
|
moduleGraph: DevServerModuleGraph;
|
|
18
29
|
ssrLoadModule(id: string): Promise<Record<string, unknown>>;
|
|
30
|
+
ssrFixStacktrace(cause: Error): void;
|
|
19
31
|
watcher: {
|
|
20
|
-
on(event:
|
|
32
|
+
on(event: DevServerWatchEvent, listener: (changedPath: string) => void): void;
|
|
21
33
|
};
|
|
22
34
|
};
|
|
23
35
|
|
|
36
|
+
const WRITE_STABILITY_THRESHOLD_MS = 50;
|
|
37
|
+
const WRITE_POLL_INTERVAL_MS = 10;
|
|
38
|
+
const ENV_FILE_SUFFIXES = ["", ".local"];
|
|
39
|
+
|
|
40
|
+
const envFilesForMode = (config: DevServerConfig): string[] => {
|
|
41
|
+
const envDir = config.envDir;
|
|
42
|
+
|
|
43
|
+
if (envDir === false) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return ENV_FILE_SUFFIXES.flatMap((suffix) => [
|
|
48
|
+
join(envDir, `.env${suffix}`),
|
|
49
|
+
join(envDir, `.env.${config.mode}${suffix}`),
|
|
50
|
+
]);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const isServerConfigFile = (config: DevServerConfig, changedPath: string): boolean => {
|
|
54
|
+
if (changedPath === config.configFile || config.configFileDependencies.includes(changedPath)) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return envFilesForMode(config).includes(changedPath);
|
|
59
|
+
};
|
|
60
|
+
|
|
24
61
|
const createDevServerConfig = (root: string, plugins: Plugin[]): InlineConfig => ({
|
|
25
62
|
root,
|
|
26
63
|
appType: "custom",
|
|
27
64
|
plugins,
|
|
28
|
-
server: {
|
|
65
|
+
server: {
|
|
66
|
+
middlewareMode: true,
|
|
67
|
+
watch: {
|
|
68
|
+
awaitWriteFinish: {
|
|
69
|
+
stabilityThreshold: WRITE_STABILITY_THRESHOLD_MS,
|
|
70
|
+
pollInterval: WRITE_POLL_INTERVAL_MS,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
29
74
|
optimizeDeps: { noDiscovery: true, include: [] },
|
|
30
75
|
ssr: {
|
|
31
76
|
external: true,
|
|
@@ -33,4 +78,10 @@ const createDevServerConfig = (root: string, plugins: Plugin[]): InlineConfig =>
|
|
|
33
78
|
},
|
|
34
79
|
});
|
|
35
80
|
|
|
36
|
-
export {
|
|
81
|
+
export {
|
|
82
|
+
createDevServerConfig,
|
|
83
|
+
type DevServer,
|
|
84
|
+
type DevServerChangedModule,
|
|
85
|
+
type DevServerWatchEvent,
|
|
86
|
+
isServerConfigFile,
|
|
87
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { PositionalArgDef, StringArgDef } from "citty";
|
|
2
|
-
import {
|
|
2
|
+
import { statSync } from "node:fs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
|
|
5
5
|
const DEFAULT_ENTRY_BASE = "src/index";
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const DEFAULT_ENTRY_EXTENSIONS = [".tsx", ".jsx", ".ts", ".js"];
|
|
7
|
+
const DEFAULT_ENTRY_CANDIDATES = DEFAULT_ENTRY_EXTENSIONS.map((extension) => `${DEFAULT_ENTRY_BASE}${extension}`);
|
|
8
8
|
const DEFAULT_ENTRY = `${DEFAULT_ENTRY_BASE}{${DEFAULT_ENTRY_EXTENSIONS.join(",")}}`;
|
|
9
9
|
|
|
10
10
|
const cwdArg: { cwd: StringArgDef } = {
|
|
@@ -24,23 +24,37 @@ const entryArg: { entry: PositionalArgDef; cwd: StringArgDef } = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const resolveCwd = (args: { cwd?: string }): string => (args.cwd ? resolve(args.cwd) : process.cwd());
|
|
27
|
+
const isFile = (path: string): boolean => statSync(path, { throwIfNoEntry: false })?.isFile() === true;
|
|
28
|
+
|
|
29
|
+
const missingDefaultEntryError = (cwd: string): Error =>
|
|
30
|
+
new Error(
|
|
31
|
+
`No entry file found in ${cwd}. Looked for ${DEFAULT_ENTRY_CANDIDATES.join(", ")}; ` +
|
|
32
|
+
"pass the entry file as an argument.",
|
|
33
|
+
);
|
|
27
34
|
|
|
28
35
|
const resolveDefaultEntry = (cwd: string): string => {
|
|
29
|
-
for (const
|
|
30
|
-
const
|
|
36
|
+
for (const candidate of DEFAULT_ENTRY_CANDIDATES) {
|
|
37
|
+
const path = resolve(cwd, candidate);
|
|
31
38
|
|
|
32
|
-
if (
|
|
33
|
-
return
|
|
39
|
+
if (isFile(path)) {
|
|
40
|
+
return path;
|
|
34
41
|
}
|
|
35
42
|
}
|
|
36
43
|
|
|
37
|
-
|
|
44
|
+
throw missingDefaultEntryError(cwd);
|
|
38
45
|
};
|
|
39
46
|
|
|
40
|
-
const
|
|
41
|
-
const
|
|
47
|
+
const resolveGivenEntry = (cwd: string, entry: string): string => {
|
|
48
|
+
const path = resolve(cwd, entry);
|
|
49
|
+
|
|
50
|
+
if (!isFile(path)) {
|
|
51
|
+
throw new Error(`No entry file at ${path}.`);
|
|
52
|
+
}
|
|
42
53
|
|
|
43
|
-
return
|
|
54
|
+
return path;
|
|
44
55
|
};
|
|
45
56
|
|
|
57
|
+
const resolveEntry = (cwd: string, entry: string | undefined): string =>
|
|
58
|
+
entry ? resolveGivenEntry(cwd, entry) : resolveDefaultEntry(cwd);
|
|
59
|
+
|
|
46
60
|
export { cwdArg, entryArg, resolveCwd, resolveEntry };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type ModuleLoader = {
|
|
2
|
+
ssrLoadModule(id: string): Promise<Record<string, unknown>>;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
const loadChains: WeakMap<object, Promise<void>> = new WeakMap();
|
|
6
|
+
|
|
7
|
+
const settled = async (load: Promise<unknown>): Promise<void> => {
|
|
8
|
+
try {
|
|
9
|
+
await load;
|
|
10
|
+
} catch {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const withExclusiveLoad = <T>(server: object, run: () => Promise<T>): Promise<T> => {
|
|
16
|
+
const pending = loadChains.get(server) ?? Promise.resolve();
|
|
17
|
+
|
|
18
|
+
const result = (async (): Promise<T> => {
|
|
19
|
+
await pending;
|
|
20
|
+
|
|
21
|
+
return run();
|
|
22
|
+
})();
|
|
23
|
+
|
|
24
|
+
loadChains.set(server, settled(result));
|
|
25
|
+
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const loadModuleExclusively = (server: ModuleLoader, id: string): Promise<Record<string, unknown>> =>
|
|
30
|
+
withExclusiveLoad(server, () => server.ssrLoadModule(id));
|
|
31
|
+
|
|
32
|
+
export { loadModuleExclusively, withExclusiveLoad };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ensureGeneratedIn } from "../codegen/run-codegen.js";
|
|
2
|
+
import { type CodegenContext, resolveCodegenContext } from "../codegen/store-resolver.js";
|
|
3
|
+
import { resolveCwd, resolveEntry } from "./entry-arg.js";
|
|
4
|
+
|
|
5
|
+
type ProjectArgs = { entry?: string; cwd?: string };
|
|
6
|
+
type PreparedProject = { cwd: string; entry: string };
|
|
7
|
+
type ResolvedProject = PreparedProject & { context: CodegenContext };
|
|
8
|
+
|
|
9
|
+
const resolveProject = async (args: ProjectArgs, mode: string): Promise<ResolvedProject> => {
|
|
10
|
+
const cwd = resolveCwd(args);
|
|
11
|
+
const context = await resolveCodegenContext(cwd, mode);
|
|
12
|
+
|
|
13
|
+
return { cwd, entry: resolveEntry(cwd, args.entry), context };
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const prepareProject = async (args: ProjectArgs, mode: string): Promise<PreparedProject> => {
|
|
17
|
+
const { cwd, entry, context } = await resolveProject(args, mode);
|
|
18
|
+
await ensureGeneratedIn(context, { shouldAnnounce: true, mode });
|
|
19
|
+
|
|
20
|
+
return { cwd, entry };
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { prepareProject, resolveProject };
|
|
@@ -5,17 +5,33 @@ type CliToolInvocation = {
|
|
|
5
5
|
tool: string;
|
|
6
6
|
args: string[];
|
|
7
7
|
target?: string;
|
|
8
|
+
shouldStream?: boolean;
|
|
8
9
|
options?: ExecFileSyncOptions;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
const
|
|
12
|
+
const streamingOptions = (options: ExecFileSyncOptions | undefined): ExecFileSyncOptions => ({
|
|
13
|
+
...options,
|
|
14
|
+
stdio: "inherit",
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const optionsFor = (shouldStream: boolean | undefined, options: ExecFileSyncOptions | undefined): ExecFileSyncOptions |
|
|
18
|
+
undefined => (shouldStream === true ? streamingOptions(options) : options);
|
|
19
|
+
|
|
20
|
+
const failureMessage = (tool: string, target: string | undefined, error: unknown): string => {
|
|
21
|
+
const details = formatChildProcessError(error);
|
|
22
|
+
const suffix = details ? `:\n${details}` : "";
|
|
23
|
+
const subject = target === undefined ? "" : ` for ${target}`;
|
|
24
|
+
|
|
25
|
+
return `${tool} failed${subject}${suffix}`;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const runCliTool = ({ tool, args, target, shouldStream, options }: CliToolInvocation): void => {
|
|
29
|
+
const executable = resolveExecutable(tool);
|
|
30
|
+
|
|
12
31
|
try {
|
|
13
|
-
execFileSync(
|
|
32
|
+
execFileSync(executable, args, optionsFor(shouldStream, options));
|
|
14
33
|
} catch (error) {
|
|
15
|
-
|
|
16
|
-
const suffix = details ? `:\n${details}` : "";
|
|
17
|
-
const subject = target === undefined ? "" : ` for ${target}`;
|
|
18
|
-
throw new Error(`${tool} failed${subject}${suffix}`, { cause: error });
|
|
34
|
+
throw new Error(failureMessage(tool, target, error), { cause: error });
|
|
19
35
|
}
|
|
20
36
|
};
|
|
21
37
|
|
|
@@ -2,12 +2,21 @@ import { mkdtempSync, rmSync } from "node:fs";
|
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
|
|
5
|
+
type RetainedStagingDir = {
|
|
6
|
+
getPath: () => string | null;
|
|
7
|
+
adopt: (dir: string) => string;
|
|
8
|
+
retain: () => string;
|
|
9
|
+
release: () => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
5
12
|
const removeTempDir = (dir: string): void => {
|
|
6
13
|
rmSync(dir, { recursive: true, force: true, maxRetries: 5 });
|
|
7
14
|
};
|
|
8
15
|
|
|
16
|
+
const createStagingDir = (prefix: string): string => mkdtempSync(join(tmpdir(), `gtkx-${prefix}-`));
|
|
17
|
+
|
|
9
18
|
const withStagingDir = <T>(prefix: string, produce: (dir: string) => T): T => {
|
|
10
|
-
const dir =
|
|
19
|
+
const dir = createStagingDir(prefix);
|
|
11
20
|
|
|
12
21
|
try {
|
|
13
22
|
return produce(dir);
|
|
@@ -16,4 +25,50 @@ const withStagingDir = <T>(prefix: string, produce: (dir: string) => T): T => {
|
|
|
16
25
|
}
|
|
17
26
|
};
|
|
18
27
|
|
|
19
|
-
|
|
28
|
+
const createRetainedStagingDir = (prefix: string): RetainedStagingDir => {
|
|
29
|
+
let path: string | null = null;
|
|
30
|
+
let cleanupProcessExit: (() => void) | null = null;
|
|
31
|
+
|
|
32
|
+
const release = (): void => {
|
|
33
|
+
if (path !== null && cleanupProcessExit) {
|
|
34
|
+
removeTempDir(path);
|
|
35
|
+
process.removeListener("exit", cleanupProcessExit);
|
|
36
|
+
cleanupProcessExit = null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
path = null;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const retain = (): string => {
|
|
43
|
+
if (path !== null) {
|
|
44
|
+
return path;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const dir = createStagingDir(prefix);
|
|
48
|
+
path = dir;
|
|
49
|
+
|
|
50
|
+
cleanupProcessExit = (): void => {
|
|
51
|
+
removeTempDir(dir);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
process.once("exit", cleanupProcessExit);
|
|
55
|
+
|
|
56
|
+
return dir;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const adopt = (dir: string): string => {
|
|
60
|
+
release();
|
|
61
|
+
path = dir;
|
|
62
|
+
|
|
63
|
+
return dir;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
getPath: () => path,
|
|
68
|
+
adopt,
|
|
69
|
+
retain,
|
|
70
|
+
release,
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export { createRetainedStagingDir, removeTempDir, type RetainedStagingDir, withStagingDir };
|
|
@@ -5,6 +5,7 @@ type WidgetIdResolver = (widget: Gtk.Widget) => string;
|
|
|
5
5
|
|
|
6
6
|
type WidgetFormatting = {
|
|
7
7
|
formatRole(role: Gtk.AccessibleRole): string;
|
|
8
|
+
getTypeTag(widget: Gtk.Widget): string;
|
|
8
9
|
getWidgetText(widget: Gtk.Widget): string | null;
|
|
9
10
|
};
|
|
10
11
|
|
|
@@ -36,7 +37,7 @@ const getChildren = (widget: Gtk.Widget): Gtk.Widget[] => {
|
|
|
36
37
|
|
|
37
38
|
const createNode = (widget: Gtk.Widget, expansion: Expansion): SerializedWidget => ({
|
|
38
39
|
id: expansion.resolveId(widget),
|
|
39
|
-
type:
|
|
40
|
+
type: expansion.testing.getTypeTag(widget),
|
|
40
41
|
role: expansion.testing.formatRole(widget.getAccessibleRole()),
|
|
41
42
|
name: widget.getName() || null,
|
|
42
43
|
text: expansion.testing.getWidgetText(widget),
|
|
@@ -88,4 +89,4 @@ const serializeWidget = (
|
|
|
88
89
|
return root;
|
|
89
90
|
};
|
|
90
91
|
|
|
91
|
-
export { serializeWidget
|
|
92
|
+
export { serializeWidget };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
type
|
|
1
|
+
type TestingPublicModule = typeof import("@gtkx/testing");
|
|
2
|
+
type TestingInternalModule = typeof import("@gtkx/testing/internal");
|
|
3
|
+
type TestingModule = TestingPublicModule & Pick<TestingInternalModule, "getTypeTag">;
|
|
2
4
|
type TestingModuleLoader = () => Promise<TestingModule>;
|
|
3
5
|
|
|
4
6
|
type TestingModuleCache = {
|
|
@@ -14,8 +16,14 @@ type TestingModuleState = {
|
|
|
14
16
|
|
|
15
17
|
const { setLoader: setTestingModuleLoader, load: loadTestingModule } = createTestingModuleCache();
|
|
16
18
|
|
|
17
|
-
function
|
|
18
|
-
return
|
|
19
|
+
function mergeTestingModule(publicApi: TestingPublicModule, internals: TestingInternalModule): TestingModule {
|
|
20
|
+
return { ...publicApi, getTypeTag: internals.getTypeTag };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function defaultLoader(): Promise<TestingModule> {
|
|
24
|
+
const [publicApi, internals] = await Promise.all([import("@gtkx/testing"), import("@gtkx/testing/internal")]);
|
|
25
|
+
|
|
26
|
+
return mergeTestingModule(publicApi, internals);
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
function missingTestingPackageError(cause: unknown): Error {
|
|
@@ -70,4 +78,11 @@ function createTestingModuleCache(): TestingModuleCache {
|
|
|
70
78
|
};
|
|
71
79
|
}
|
|
72
80
|
|
|
73
|
-
export {
|
|
81
|
+
export {
|
|
82
|
+
setTestingModuleLoader,
|
|
83
|
+
loadTestingModule,
|
|
84
|
+
mergeTestingModule,
|
|
85
|
+
type TestingInternalModule,
|
|
86
|
+
type TestingModule,
|
|
87
|
+
type TestingPublicModule,
|
|
88
|
+
};
|
package/src/refresh-runtime.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import RefreshRuntime from "react-refresh/runtime";
|
|
1
|
+
import RefreshRuntime, { type Family } from "react-refresh/runtime";
|
|
2
2
|
import "./refresh-globals.js";
|
|
3
3
|
|
|
4
4
|
type ComponentType = (...args: unknown[]) => unknown;
|
|
5
5
|
|
|
6
|
+
type PatchedExports = {
|
|
7
|
+
values: Set<unknown>;
|
|
8
|
+
families: Set<Family>;
|
|
9
|
+
};
|
|
10
|
+
|
|
6
11
|
function createModuleRegistration(moduleId: string): {
|
|
7
12
|
$RefreshReg$: (type: ComponentType, id: string) => void;
|
|
8
13
|
$RefreshSig$: typeof RefreshRuntime.createSignatureFunctionForTransform;
|
|
@@ -40,8 +45,49 @@ function isRefreshBoundary(moduleExports: Record<string, unknown>): boolean {
|
|
|
40
45
|
return Object.keys(moduleExports).some((k) => k !== "__esModule");
|
|
41
46
|
}
|
|
42
47
|
|
|
48
|
+
const exportedFamilies = (moduleExports: Record<string, unknown>): Set<Family> => {
|
|
49
|
+
const families: Set<Family> = new Set();
|
|
50
|
+
|
|
51
|
+
for (const key in moduleExports) {
|
|
52
|
+
const family = RefreshRuntime.getFamilyByType(moduleExports[key]);
|
|
53
|
+
|
|
54
|
+
if (family) {
|
|
55
|
+
families.add(family);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return families;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const patchedExports = (moduleExports: Record<string, unknown>): PatchedExports => ({
|
|
63
|
+
values: new Set(Object.values(moduleExports)),
|
|
64
|
+
families: exportedFamilies(moduleExports),
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const isPatchedExport = (patched: PatchedExports, value: unknown): boolean => {
|
|
68
|
+
if (patched.values.has(value)) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const family = RefreshRuntime.getFamilyByType(value);
|
|
73
|
+
|
|
74
|
+
return family !== undefined && patched.families.has(family);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const staleExportName = (previous: Record<string, unknown>, current: Record<string, unknown>): string | null => {
|
|
78
|
+
const patched = patchedExports(current);
|
|
79
|
+
|
|
80
|
+
for (const key in previous) {
|
|
81
|
+
if (!isPatchedExport(patched, previous[key])) {
|
|
82
|
+
return key;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return null;
|
|
87
|
+
};
|
|
88
|
+
|
|
43
89
|
function performRefresh(): void {
|
|
44
90
|
RefreshRuntime.performReactRefresh();
|
|
45
91
|
}
|
|
46
92
|
|
|
47
|
-
export { createModuleRegistration, isRefreshBoundary, performRefresh };
|
|
93
|
+
export { createModuleRegistration, isRefreshBoundary, performRefresh, staleExportName };
|
package/src/settings/schema.ts
CHANGED
|
@@ -25,5 +25,6 @@ const ASSET_EXTENSIONS = [
|
|
|
25
25
|
|
|
26
26
|
const ASSET_RE = new RegExp(String.raw`\.(?:${ASSET_EXTENSIONS.join("|")})$`, "i");
|
|
27
27
|
const ASSET_PATH_RE = new RegExp(String.raw`\.(?:${ASSET_EXTENSIONS.join("|")})(?:\?.*)?$`, "i");
|
|
28
|
+
const ASSET_MENTION_RE = new RegExp(String.raw`\.(?:${ASSET_EXTENSIONS.join("|")})`, "i");
|
|
28
29
|
|
|
29
|
-
export {
|
|
30
|
+
export { ASSET_MENTION_RE, ASSET_PATH_RE, ASSET_RE };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { ParseResult, ParserOptions, Plugin } from "vite";
|
|
2
|
+
import { extname } from "node:path";
|
|
3
|
+
import { parseSync } from "vite";
|
|
4
|
+
import { ASSET_MENTION_RE } from "./asset-extensions.js";
|
|
5
|
+
import { DATA_PREFIX, isAssetSpecifier, isDataAsset } from "./asset-specifier.js";
|
|
6
|
+
import { RESOURCE_PATH_EXPORT } from "./resource-shared.js";
|
|
7
|
+
import { stripQuery } from "./strip-query.js";
|
|
8
|
+
|
|
9
|
+
type SourceLanguage = NonNullable<ParserOptions["lang"]>;
|
|
10
|
+
type ParsedModule = ParseResult["module"];
|
|
11
|
+
type ImportStatement = ParsedModule["staticImports"][number];
|
|
12
|
+
type ExportStatement = ParsedModule["staticExports"][number];
|
|
13
|
+
type ExportEntry = ExportStatement["entries"][number];
|
|
14
|
+
type BindingEntry = { importName: { name: string | null }; isType: boolean };
|
|
15
|
+
type NamedBinding = { name: string; source: string };
|
|
16
|
+
|
|
17
|
+
const SOURCE_LANGUAGES: Map<string, SourceLanguage> = new Map([
|
|
18
|
+
[".cjs", "jsx"],
|
|
19
|
+
[".cts", "ts"],
|
|
20
|
+
[".js", "jsx"],
|
|
21
|
+
[".jsx", "jsx"],
|
|
22
|
+
[".mjs", "jsx"],
|
|
23
|
+
[".mts", "ts"],
|
|
24
|
+
[".ts", "ts"],
|
|
25
|
+
[".tsx", "tsx"],
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
const NODE_MODULES = /(?:^|\/)node_modules\//;
|
|
29
|
+
const VIRTUAL_PREFIX = "\0";
|
|
30
|
+
const DEFAULT_BINDING = "default";
|
|
31
|
+
const RESOURCE_BINDING = JSON.stringify(RESOURCE_PATH_EXPORT);
|
|
32
|
+
const DATA_IMPORT_EXAMPLE = `"${DATA_PREFIX}<path>"`;
|
|
33
|
+
const URL_FALLBACK = ", or import the default for the asset URL.";
|
|
34
|
+
|
|
35
|
+
const BUNDLE_ADVICE =
|
|
36
|
+
`An asset staged into the GResource bundle exports ${RESOURCE_BINDING} and a "resource://" default, and ` +
|
|
37
|
+
"nothing else.";
|
|
38
|
+
|
|
39
|
+
const QUERY_ADVICE =
|
|
40
|
+
"A query suffix hands the import to the Vite asset pipeline instead of the GResource bundle; drop the " +
|
|
41
|
+
`query to keep ${RESOURCE_BINDING}${URL_FALLBACK}`;
|
|
42
|
+
|
|
43
|
+
const RELATIVE_ADVICE =
|
|
44
|
+
`Only assets imported through "${DATA_PREFIX}" are staged into the GResource bundle and export ` +
|
|
45
|
+
`${RESOURCE_BINDING}; move the file under the data directory and import it as ` +
|
|
46
|
+
`${DATA_IMPORT_EXAMPLE}${URL_FALLBACK}`;
|
|
47
|
+
|
|
48
|
+
const boundName = (entry: BindingEntry): string | null => {
|
|
49
|
+
const { name } = entry.importName;
|
|
50
|
+
|
|
51
|
+
if (name === null || name === DEFAULT_BINDING || entry.isType) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return name;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const importBindings = (statement: ImportStatement): NamedBinding[] =>
|
|
59
|
+
statement.entries
|
|
60
|
+
.map((entry) => boundName(entry))
|
|
61
|
+
.filter((name) => name !== null)
|
|
62
|
+
.map((name) => ({ name, source: statement.moduleRequest.value }));
|
|
63
|
+
|
|
64
|
+
const exportBinding = (entry: ExportEntry): NamedBinding | null => {
|
|
65
|
+
const name = boundName(entry);
|
|
66
|
+
const source = entry.moduleRequest?.value;
|
|
67
|
+
|
|
68
|
+
return name === null || source === undefined ? null : { name, source };
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const exportBindings = (statement: ExportStatement): NamedBinding[] =>
|
|
72
|
+
statement.entries.map((entry) => exportBinding(entry)).filter((binding) => binding !== null);
|
|
73
|
+
|
|
74
|
+
const bindings = (parsed: ParsedModule): NamedBinding[] => [
|
|
75
|
+
...parsed.staticImports.flatMap((statement) => importBindings(statement)),
|
|
76
|
+
...parsed.staticExports.flatMap((statement) => exportBindings(statement)),
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
const isBacked = ({ name, source }: NamedBinding): boolean =>
|
|
80
|
+
isDataAsset(source) && name === RESOURCE_PATH_EXPORT;
|
|
81
|
+
|
|
82
|
+
const unbackedBinding = (parsed: ParsedModule): NamedBinding | undefined =>
|
|
83
|
+
bindings(parsed).find((binding) => isAssetSpecifier(binding.source) && !isBacked(binding));
|
|
84
|
+
|
|
85
|
+
const bundleAdvice = (source: string): string => {
|
|
86
|
+
if (isDataAsset(source)) {
|
|
87
|
+
return BUNDLE_ADVICE;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return source.startsWith(DATA_PREFIX) ? QUERY_ADVICE : RELATIVE_ADVICE;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const unbackedBindingError = (path: string, binding: NamedBinding): Error =>
|
|
94
|
+
new Error(
|
|
95
|
+
`${path}: ${JSON.stringify(binding.source)} does not export ${JSON.stringify(binding.name)}, which ` +
|
|
96
|
+
"gtkx build rejects and gtkx dev would bind as undefined. " +
|
|
97
|
+
bundleAdvice(binding.source),
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const isCheckedSource = (path: string): boolean => !path.startsWith(VIRTUAL_PREFIX) && !NODE_MODULES.test(path);
|
|
101
|
+
|
|
102
|
+
const checkAssetImports = (code: string, id: string): void => {
|
|
103
|
+
const path = stripQuery(id);
|
|
104
|
+
const lang = SOURCE_LANGUAGES.get(extname(path).toLowerCase());
|
|
105
|
+
|
|
106
|
+
if (lang === undefined || !isCheckedSource(path) || !ASSET_MENTION_RE.test(code)) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const parsed = parseSync(path, code, { lang });
|
|
111
|
+
|
|
112
|
+
if (parsed.errors.length > 0) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const binding = unbackedBinding(parsed.module);
|
|
117
|
+
|
|
118
|
+
if (binding !== undefined) {
|
|
119
|
+
throw unbackedBindingError(path, binding);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
function gtkxAssetImports(): Plugin {
|
|
124
|
+
return {
|
|
125
|
+
name: "gtkx:asset-imports",
|
|
126
|
+
enforce: "pre",
|
|
127
|
+
|
|
128
|
+
transform(code, id) {
|
|
129
|
+
checkAssetImports(code, id);
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export { gtkxAssetImports };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DATA_IMPORT_PREFIX } from "../internal/data-dir.js";
|
|
2
|
+
import { ASSET_PATH_RE, ASSET_RE } from "./asset-extensions.js";
|
|
3
|
+
|
|
4
|
+
const DATA_PREFIX = `${DATA_IMPORT_PREFIX}/`;
|
|
5
|
+
|
|
6
|
+
const isAssetSpecifier = (source: string): boolean => ASSET_PATH_RE.test(source);
|
|
7
|
+
const isDataAsset = (source: string): boolean => source.startsWith(DATA_PREFIX) && ASSET_RE.test(source);
|
|
8
|
+
|
|
9
|
+
export { DATA_PREFIX, isAssetSpecifier, isDataAsset };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Plugin } from "vite";
|
|
2
2
|
import { createConfigLoader } from "@gtkx/config/internal";
|
|
3
3
|
import createConfigPlugin from "@gtkx/config/vite-plugin";
|
|
4
|
+
import { gtkxAssetImports } from "./asset-imports.js";
|
|
4
5
|
import { gtkxCss } from "./css.js";
|
|
5
6
|
import { gtkxIcons } from "./icons.js";
|
|
6
7
|
import { gtkxReactCompiler } from "./react-compiler.js";
|
|
7
8
|
import { gtkxResources } from "./resources.js";
|
|
8
9
|
import { gtkxSettings } from "./settings.js";
|
|
10
|
+
import { gtkxStoreLinks } from "./store-links.js";
|
|
9
11
|
import { gtkxUndeclaredLibrary } from "./undeclared-library.js";
|
|
10
12
|
|
|
11
13
|
const gtkxVitePlugins = (mode?: string): Plugin[] => {
|
|
@@ -13,9 +15,11 @@ const gtkxVitePlugins = (mode?: string): Plugin[] => {
|
|
|
13
15
|
|
|
14
16
|
return [
|
|
15
17
|
createConfigPlugin({ name: "gtkx:config", loadConfig }),
|
|
18
|
+
gtkxStoreLinks(),
|
|
16
19
|
gtkxUndeclaredLibrary(loadConfig),
|
|
17
20
|
gtkxSettings(),
|
|
18
21
|
gtkxIcons(),
|
|
22
|
+
gtkxAssetImports(),
|
|
19
23
|
gtkxResources(loadConfig),
|
|
20
24
|
gtkxCss(),
|
|
21
25
|
gtkxReactCompiler(loadConfig),
|
|
@@ -5,6 +5,7 @@ const VIRTUAL_INIT = "\0gtkx-resources-init";
|
|
|
5
5
|
const BUNDLE_FILENAME = "gtkx.gresource";
|
|
6
6
|
const REL_SEPARATOR = "\0rel=";
|
|
7
7
|
const REFRESH_EXPORT = "__refresh";
|
|
8
|
+
const RESOURCE_PATH_EXPORT = "path";
|
|
8
9
|
const { isVirtual, toVirtualId, fromVirtualId } = createVirtualNamespace(VIRTUAL_PREFIX);
|
|
9
10
|
|
|
10
11
|
const escapeXml = (value: string): string =>
|
|
@@ -33,6 +34,7 @@ export {
|
|
|
33
34
|
BUNDLE_FILENAME,
|
|
34
35
|
REL_SEPARATOR,
|
|
35
36
|
REFRESH_EXPORT,
|
|
37
|
+
RESOURCE_PATH_EXPORT,
|
|
36
38
|
escapeXml,
|
|
37
39
|
isVirtual,
|
|
38
40
|
toVirtualId,
|