@gtkx/cli 1.0.0-rc.4 → 1.1.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 +5 -5
- package/dist/builder.d.ts +2 -2
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +21 -3
- package/dist/builder.js.map +1 -1
- package/dist/cli.js +9 -3
- package/dist/cli.js.map +1 -1
- package/dist/codegen/freshness.d.ts.map +1 -1
- package/dist/codegen/freshness.js +2 -4
- package/dist/codegen/freshness.js.map +1 -1
- package/dist/codegen/run-codegen.d.ts +8 -5
- package/dist/codegen/run-codegen.d.ts.map +1 -1
- package/dist/codegen/run-codegen.js +25 -19
- 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 +7 -5
- 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 +27 -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 +85 -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 +153 -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 +15 -0
- package/dist/deploy/settings/package-manifest.d.ts.map +1 -0
- package/dist/deploy/settings/package-manifest.js +41 -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-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 +110 -0
- package/dist/deploy/targets/flatpak-source.js.map +1 -0
- package/dist/deploy/targets/flatpak-sources.d.ts +17 -0
- package/dist/deploy/targets/flatpak-sources.d.ts.map +1 -0
- package/dist/deploy/targets/flatpak-sources.js +108 -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 +112 -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 +18 -0
- package/dist/deploy/tools.d.ts.map +1 -0
- package/dist/deploy/tools.js +92 -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/entry-env.d.ts +3 -0
- package/dist/dev/entry-env.d.ts.map +1 -0
- package/dist/dev/entry-env.js +3 -0
- package/dist/dev/entry-env.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 -5
- package/dist/dev/runner-deps.js.map +1 -1
- package/dist/dev/runner-main.d.ts.map +1 -1
- package/dist/dev/runner-main.js +3 -3
- package/dist/dev/runner-main.js.map +1 -1
- package/dist/dev/runner.d.ts +8 -3
- package/dist/dev/runner.d.ts.map +1 -1
- package/dist/dev/runner.js +343 -65
- package/dist/dev/runner.js.map +1 -1
- package/dist/dev/supervisor.d.ts +10 -4
- package/dist/dev/supervisor.d.ts.map +1 -1
- package/dist/dev/supervisor.js +23 -4
- 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/application-args.d.ts +6 -0
- package/dist/internal/application-args.d.ts.map +1 -0
- package/dist/internal/application-args.js +10 -0
- package/dist/internal/application-args.js.map +1 -0
- 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/errors.d.ts +1 -2
- package/dist/internal/errors.d.ts.map +1 -1
- package/dist/internal/errors.js +1 -1
- package/dist/internal/errors.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 +11 -0
- package/dist/internal/run-cli-tool.d.ts.map +1 -0
- package/dist/internal/run-cli-tool.js +24 -0
- package/dist/internal/run-cli-tool.js.map +1 -0
- 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/client.d.ts +1 -1
- package/dist/mcp/client.d.ts.map +1 -1
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/handlers.d.ts +1 -1
- package/dist/mcp/handlers.d.ts.map +1 -1
- package/dist/mcp/handlers.js +78 -41
- package/dist/mcp/handlers.js.map +1 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/serialize-widget.d.ts +4 -3
- package/dist/mcp/serialize-widget.d.ts.map +1 -1
- package/dist/mcp/serialize-widget.js +47 -17
- 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/mcp/widget-properties.d.ts +6 -0
- package/dist/mcp/widget-properties.d.ts.map +1 -0
- package/dist/mcp/widget-properties.js +102 -0
- package/dist/mcp/widget-properties.js.map +1 -0
- 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/compile.d.ts.map +1 -1
- package/dist/settings/compile.js +8 -12
- package/dist/settings/compile.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-emitter.d.ts +9 -0
- package/dist/vite-plugins/asset-emitter.d.ts.map +1 -0
- package/dist/vite-plugins/asset-emitter.js +2 -0
- package/dist/vite-plugins/asset-emitter.js.map +1 -0
- package/dist/vite-plugins/asset-extensions.d.ts +2 -2
- 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/built-url.d.ts.map +1 -1
- package/dist/vite-plugins/built-url.js +14 -10
- package/dist/vite-plugins/built-url.js.map +1 -1
- package/dist/vite-plugins/ensure-store.d.ts +4 -0
- package/dist/vite-plugins/ensure-store.d.ts.map +1 -0
- package/dist/vite-plugins/ensure-store.js +10 -0
- package/dist/vite-plugins/ensure-store.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/icons.d.ts.map +1 -1
- package/dist/vite-plugins/icons.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/react-compiler.d.ts +1 -1
- package/dist/vite-plugins/react-compiler.d.ts.map +1 -1
- package/dist/vite-plugins/react-compiler.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 +1 -1
- package/dist/vite-plugins/resources.d.ts.map +1 -1
- package/dist/vite-plugins/resources.js +36 -44
- 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 +1 -1
- 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 +4 -0
- package/dist/vite-plugins/worker.d.ts.map +1 -0
- package/dist/vite-plugins/worker.js +138 -0
- package/dist/vite-plugins/worker.js.map +1 -0
- package/dist/vitest-plugin.d.ts +7 -0
- package/dist/vitest-plugin.d.ts.map +1 -1
- package/dist/vitest-plugin.js +14 -1
- package/dist/vitest-plugin.js.map +1 -1
- package/env.d.ts +106 -25
- package/package.json +23 -12
- package/src/builder.ts +24 -5
- package/src/cli.ts +10 -3
- package/src/codegen/freshness.ts +2 -4
- package/src/codegen/run-codegen.ts +37 -23
- 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 +7 -5
- package/src/commands/docs.ts +39 -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 +108 -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 +235 -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 +66 -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-prebuilt.ts +59 -0
- package/src/deploy/targets/flatpak-source.ts +168 -0
- package/src/deploy/targets/flatpak-sources.ts +171 -0
- package/src/deploy/targets/flatpak.ts +143 -0
- package/src/deploy/targets/nfpm-target.ts +33 -0
- package/src/deploy/targets/rpm.ts +6 -0
- package/src/deploy/tools.ts +135 -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/entry-env.ts +3 -0
- package/src/dev/failure-tracker.ts +92 -0
- package/src/dev/missing-import.ts +32 -0
- package/src/dev/runner-deps.ts +34 -5
- package/src/dev/runner-main.ts +3 -4
- package/src/dev/runner.ts +524 -89
- package/src/dev/supervisor.ts +51 -11
- package/src/dev/vite-dev-server.ts +54 -3
- package/src/internal/application-args.ts +13 -0
- package/src/internal/entry-arg.ts +25 -11
- package/src/internal/errors.ts +1 -1
- package/src/internal/module-loads.ts +32 -0
- package/src/internal/prepare-project.ts +23 -0
- package/src/internal/run-cli-tool.ts +38 -0
- package/src/internal/staging-dir.ts +57 -2
- package/src/mcp/client.ts +1 -1
- package/src/mcp/handlers.ts +123 -56
- package/src/mcp/index.ts +1 -0
- package/src/mcp/serialize-widget.ts +73 -22
- package/src/mcp/testing-loader.ts +19 -4
- package/src/mcp/widget-properties.ts +153 -0
- package/src/refresh-runtime.ts +48 -2
- package/src/settings/compile.ts +8 -11
- package/src/settings/schema.ts +0 -1
- package/src/vite-plugins/asset-emitter.ts +5 -0
- 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/built-url.ts +19 -13
- package/src/vite-plugins/ensure-store.ts +14 -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/icons.ts +2 -5
- package/src/vite-plugins/index.ts +4 -0
- package/src/vite-plugins/react-compiler.ts +2 -1
- package/src/vite-plugins/resource-shared.ts +2 -0
- package/src/vite-plugins/resources.ts +43 -52
- package/src/vite-plugins/self-contained.ts +352 -0
- package/src/vite-plugins/settings.ts +23 -50
- package/src/vite-plugins/store-links.ts +25 -0
- package/src/vite-plugins/undeclared-library.ts +75 -13
- package/src/vite-plugins/worker.ts +238 -0
- package/src/vitest-plugin.ts +15 -1
- package/dist/internal/resolve-cli-tool.d.ts +0 -3
- package/dist/internal/resolve-cli-tool.d.ts.map +0 -1
- package/dist/internal/resolve-cli-tool.js +0 -27
- package/dist/internal/resolve-cli-tool.js.map +0 -1
- package/src/internal/resolve-cli-tool.ts +0 -37
|
@@ -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,4 +1,20 @@
|
|
|
1
1
|
import type { Plugin } from "vite";
|
|
2
|
+
import { posix } from "node:path";
|
|
3
|
+
|
|
4
|
+
const EXECUTABLE_URL_BASE = "`file://${process.execPath}`";
|
|
5
|
+
const LEADING_SLASHES = /^\/+/;
|
|
6
|
+
|
|
7
|
+
const executableRelativeUrl = (target: string): string => {
|
|
8
|
+
const specifier = JSON.stringify(target.replace(LEADING_SLASHES, "./"));
|
|
9
|
+
|
|
10
|
+
return `decodeURIComponent(new URL(${specifier}, ${EXECUTABLE_URL_BASE}).pathname)`;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const bundleRelativeUrl = (filename: string): string => {
|
|
14
|
+
const specifier = JSON.stringify(`./${filename}`);
|
|
15
|
+
|
|
16
|
+
return `decodeURIComponent(new URL(${specifier}, import.meta.url).pathname)`;
|
|
17
|
+
};
|
|
2
18
|
|
|
3
19
|
const renderAssetUrl = (
|
|
4
20
|
filename: string,
|
|
@@ -9,21 +25,11 @@ const renderAssetUrl = (
|
|
|
9
25
|
return undefined;
|
|
10
26
|
}
|
|
11
27
|
|
|
12
|
-
if (assetBase) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
runtime:
|
|
17
|
-
`require("path").join(${executableDir},` +
|
|
18
|
-
`${JSON.stringify(assetBase)},${JSON.stringify(filename)})`,
|
|
19
|
-
};
|
|
28
|
+
if (assetBase === undefined) {
|
|
29
|
+
return { runtime: bundleRelativeUrl(filename) };
|
|
20
30
|
}
|
|
21
31
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
runtime: `new URL(${filenameLiteral}, import.meta.url).pathname`,
|
|
26
|
-
};
|
|
32
|
+
return { runtime: executableRelativeUrl(posix.join(assetBase, filename)) };
|
|
27
33
|
};
|
|
28
34
|
|
|
29
35
|
function gtkxBuiltUrl(assetBase?: string): Plugin {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
import { ensureGenerated } from "../codegen/run-codegen.js";
|
|
3
|
+
|
|
4
|
+
const TEST_MODE = "test";
|
|
5
|
+
|
|
6
|
+
const gtkxEnsureStore = (): Plugin => ({
|
|
7
|
+
name: "gtkx:ensure-store",
|
|
8
|
+
|
|
9
|
+
async config() {
|
|
10
|
+
await ensureGenerated(process.cwd(), { shouldAnnounce: true, mode: TEST_MODE });
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { gtkxEnsureStore };
|
|
@@ -2,6 +2,7 @@ import type { Plugin, UserConfig } from "vite";
|
|
|
2
2
|
import { info } from "@gtkx/utils";
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
+
import type { AssetEmitter } from "./asset-emitter.js";
|
|
5
6
|
import { prependBanner } from "../internal/banner.js";
|
|
6
7
|
import { resolveDataDir } from "../internal/data-dir.js";
|
|
7
8
|
import { type ListedFile, listFilesRecursive } from "../internal/list-files.js";
|
|
@@ -10,10 +11,6 @@ type PluginState = {
|
|
|
10
11
|
iconsDir: string | null;
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
type PluginContext = {
|
|
14
|
-
emitFile: (file: { type: "asset"; fileName: string; source: Buffer }) => void;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
14
|
const ICONS_DIR = "icons";
|
|
18
15
|
|
|
19
16
|
const XDG_ENV_BANNER = [
|
|
@@ -33,7 +30,7 @@ const resolveIconsDir = (config: UserConfig): string | null => {
|
|
|
33
30
|
return dataDir === null ? null : join(root, dataDir, ICONS_DIR);
|
|
34
31
|
};
|
|
35
32
|
|
|
36
|
-
const emitIcons = (ctx:
|
|
33
|
+
const emitIcons = (ctx: AssetEmitter, icons: ListedFile[]): void => {
|
|
37
34
|
for (const { absPath, rel } of icons) {
|
|
38
35
|
ctx.emitFile({ type: "asset", fileName: join(ICONS_DIR, rel), source: readFileSync(absPath) });
|
|
39
36
|
}
|
|
@@ -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),
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { ConfigLoader } from "@gtkx/config";
|
|
1
2
|
import type { ResolvedReactCompilerOptions } from "@gtkx/config/internal";
|
|
2
3
|
import type { Plugin, ResolvedConfig, UserConfig } from "vite";
|
|
3
4
|
import { transformAsync } from "@babel/core";
|
|
4
5
|
import babelPresetTypescriptNs from "@babel/preset-typescript";
|
|
5
|
-
import {
|
|
6
|
+
import { createConfigLoader } from "@gtkx/config/internal";
|
|
6
7
|
import babelPluginReactCompilerNs from "babel-plugin-react-compiler";
|
|
7
8
|
|
|
8
9
|
type ReactCompilerState = {
|
|
@@ -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,
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import type { ConfigLoader } from "@gtkx/config";
|
|
1
2
|
import type { Plugin, ResolvedConfig, UserConfig, ViteDevServer } from "vite";
|
|
2
|
-
import {
|
|
3
|
-
import { error,
|
|
4
|
-
import {
|
|
5
|
-
import { copyFileSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
|
-
import { tmpdir } from "node:os";
|
|
3
|
+
import { createConfigLoader } from "@gtkx/config/internal";
|
|
4
|
+
import { error, info, sortStrings } from "@gtkx/utils";
|
|
5
|
+
import { copyFileSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
6
|
import { dirname, join } from "node:path";
|
|
8
|
-
import {
|
|
7
|
+
import type { AssetEmitter } from "./asset-emitter.js";
|
|
8
|
+
import { resolveDataDir } from "../internal/data-dir.js";
|
|
9
9
|
import { type ListedFile, listFilesRecursive } from "../internal/list-files.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { loadModuleExclusively } from "../internal/module-loads.js";
|
|
11
|
+
import { runCliTool } from "../internal/run-cli-tool.js";
|
|
12
|
+
import { createRetainedStagingDir, type RetainedStagingDir, withStagingDir } from "../internal/staging-dir.js";
|
|
13
|
+
import { ASSET_RE } from "./asset-extensions.js";
|
|
14
|
+
import { DATA_PREFIX, isDataAsset } from "./asset-specifier.js";
|
|
13
15
|
import { renderInitModule } from "./resource-init-module.js";
|
|
14
16
|
import {
|
|
15
17
|
BUNDLE_FILENAME,
|
|
@@ -18,10 +20,10 @@ import {
|
|
|
18
20
|
isVirtual,
|
|
19
21
|
REFRESH_EXPORT,
|
|
20
22
|
REL_SEPARATOR,
|
|
23
|
+
RESOURCE_PATH_EXPORT,
|
|
21
24
|
toVirtualId,
|
|
22
25
|
VIRTUAL_INIT,
|
|
23
26
|
} from "./resource-shared.js";
|
|
24
|
-
import { stripQuery } from "./strip-query.js";
|
|
25
27
|
|
|
26
28
|
type ResourceEntry = {
|
|
27
29
|
sourcePath: string;
|
|
@@ -34,16 +36,16 @@ type PluginState = {
|
|
|
34
36
|
isBuild: boolean;
|
|
35
37
|
entries: Map<string, ResourceEntry>;
|
|
36
38
|
sourcePaths: Set<string>;
|
|
37
|
-
|
|
39
|
+
stagingDir: RetainedStagingDir;
|
|
38
40
|
devBundlePath: string;
|
|
39
41
|
server: ViteDevServer | null;
|
|
40
42
|
compiledSignature: string;
|
|
41
43
|
dataDir: string | null;
|
|
42
44
|
};
|
|
43
45
|
|
|
44
|
-
const DATA_PREFIX = `${DATA_IMPORT_PREFIX}/`;
|
|
45
46
|
const RESOURCE_COMPILER = "glib-compile-resources";
|
|
46
47
|
const MANIFEST_PREFIX = "/";
|
|
48
|
+
const DEV_STAGING_PREFIX = "resources-dev";
|
|
47
49
|
|
|
48
50
|
const deriveResourcePrefix = (applicationId: string): string => `/${applicationId.replaceAll(".", "/")}`;
|
|
49
51
|
|
|
@@ -83,28 +85,22 @@ const stageBundle = (dir: string, entries: Map<string, ResourceEntry>): string =
|
|
|
83
85
|
};
|
|
84
86
|
|
|
85
87
|
const runCompiler = (sourceDir: string, manifest: string, outputPath: string): Buffer => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
manifest,
|
|
91
|
-
]);
|
|
92
|
-
} catch (error) {
|
|
93
|
-
const details = formatChildProcessError(error);
|
|
94
|
-
const suffix = details ? `:\n${details}` : "";
|
|
95
|
-
throw new Error(`${RESOURCE_COMPILER} failed${suffix}`, { cause: error });
|
|
96
|
-
}
|
|
88
|
+
runCliTool({
|
|
89
|
+
tool: RESOURCE_COMPILER,
|
|
90
|
+
args: [`--sourcedir=${sourceDir}`, `--target=${outputPath}`, manifest],
|
|
91
|
+
});
|
|
97
92
|
|
|
98
93
|
return readFileSync(outputPath);
|
|
99
94
|
};
|
|
100
95
|
|
|
101
96
|
const ensureStagingDir = (state: PluginState): void => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
97
|
+
state.devBundlePath = join(state.stagingDir.retain(), BUNDLE_FILENAME);
|
|
98
|
+
};
|
|
105
99
|
|
|
106
|
-
|
|
107
|
-
state.
|
|
100
|
+
const releaseStagingDir = (state: PluginState): void => {
|
|
101
|
+
state.stagingDir.release();
|
|
102
|
+
state.devBundlePath = "";
|
|
103
|
+
state.compiledSignature = "";
|
|
108
104
|
};
|
|
109
105
|
|
|
110
106
|
const entriesSignature = (state: PluginState): string => sortStrings(state.entries.keys()).join("\0");
|
|
@@ -129,7 +125,7 @@ const reregisterDevBundle = async (state: PluginState): Promise<void> => {
|
|
|
129
125
|
return;
|
|
130
126
|
}
|
|
131
127
|
|
|
132
|
-
const mod = await server
|
|
128
|
+
const mod = await loadModuleExclusively(server, VIRTUAL_INIT);
|
|
133
129
|
const refresh: unknown = mod[REFRESH_EXPORT];
|
|
134
130
|
|
|
135
131
|
if (isRefreshHook(refresh)) {
|
|
@@ -180,25 +176,15 @@ const registerEntry = (state: PluginState, absPath: string, rel: string): Resour
|
|
|
180
176
|
|
|
181
177
|
const isTrackedSource = (state: PluginState, file: string): boolean => state.sourcePaths.has(file);
|
|
182
178
|
|
|
183
|
-
const dataAssetSource = (source: string): string | null => {
|
|
184
|
-
const clean = stripQuery(source);
|
|
185
|
-
|
|
186
|
-
if (!clean.startsWith(DATA_PREFIX) || !ASSET_PATH_RE.test(clean)) {
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return clean;
|
|
191
|
-
};
|
|
192
|
-
|
|
193
179
|
const resolvedAssetId = (
|
|
194
180
|
resolved: { id: string; external: boolean | string } | null,
|
|
195
|
-
|
|
181
|
+
source: string,
|
|
196
182
|
): string | undefined => {
|
|
197
183
|
if (!resolved || resolved.external) {
|
|
198
184
|
return undefined;
|
|
199
185
|
}
|
|
200
186
|
|
|
201
|
-
return toVirtualId(resolved.id) + REL_SEPARATOR +
|
|
187
|
+
return toVirtualId(resolved.id) + REL_SEPARATOR + source.slice(DATA_PREFIX.length);
|
|
202
188
|
};
|
|
203
189
|
|
|
204
190
|
const loadInitModule = (state: PluginState): string => {
|
|
@@ -225,14 +211,11 @@ const loadAssetModule = (state: PluginState, virtualId: string): string => {
|
|
|
225
211
|
`import { ensureRegistered } from ${JSON.stringify(VIRTUAL_INIT)};`,
|
|
226
212
|
"ensureRegistered();",
|
|
227
213
|
`export default ${JSON.stringify(uri)};`,
|
|
228
|
-
`export const
|
|
214
|
+
`export const ${RESOURCE_PATH_EXPORT} = ${JSON.stringify(entry.resourcePath)};`,
|
|
229
215
|
].join("\n");
|
|
230
216
|
};
|
|
231
217
|
|
|
232
|
-
const emitBuildBundle = (
|
|
233
|
-
ctx: { emitFile: (asset: { type: "asset"; fileName: string; source: Buffer }) => string },
|
|
234
|
-
state: PluginState,
|
|
235
|
-
): void => {
|
|
218
|
+
const emitBuildBundle = (ctx: AssetEmitter, state: PluginState): void => {
|
|
236
219
|
if (!state.isBuild || state.entries.size === 0) {
|
|
237
220
|
return;
|
|
238
221
|
}
|
|
@@ -280,6 +263,12 @@ const attachResourceWatcher = (state: PluginState, server: ViteDevServer): void
|
|
|
280
263
|
void refreshTrackedSource(state, file);
|
|
281
264
|
};
|
|
282
265
|
|
|
266
|
+
const onClose = (): void => {
|
|
267
|
+
releaseStagingDir(state);
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
server.httpServer?.once("close", onClose);
|
|
271
|
+
server.watcher.once("close", onClose);
|
|
283
272
|
server.watcher.on("change", onFileEvent);
|
|
284
273
|
server.watcher.on("add", onFileEvent);
|
|
285
274
|
};
|
|
@@ -313,7 +302,7 @@ function gtkxResources(loadConfig: ConfigLoader = createConfigLoader()): Plugin
|
|
|
313
302
|
isBuild: false,
|
|
314
303
|
entries: new Map(),
|
|
315
304
|
sourcePaths: new Set(),
|
|
316
|
-
|
|
305
|
+
stagingDir: createRetainedStagingDir(DEV_STAGING_PREFIX),
|
|
317
306
|
devBundlePath: "",
|
|
318
307
|
server: null,
|
|
319
308
|
compiledSignature: "",
|
|
@@ -342,15 +331,13 @@ function gtkxResources(loadConfig: ConfigLoader = createConfigLoader()): Plugin
|
|
|
342
331
|
return VIRTUAL_INIT;
|
|
343
332
|
}
|
|
344
333
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
if (clean === null) {
|
|
334
|
+
if (!isDataAsset(source)) {
|
|
348
335
|
return;
|
|
349
336
|
}
|
|
350
337
|
|
|
351
|
-
const resolved = await this.resolve(
|
|
338
|
+
const resolved = await this.resolve(source, importer, { ...opts, skipSelf: true });
|
|
352
339
|
|
|
353
|
-
return resolvedAssetId(resolved,
|
|
340
|
+
return resolvedAssetId(resolved, source);
|
|
354
341
|
},
|
|
355
342
|
|
|
356
343
|
load(id) {
|
|
@@ -360,6 +347,10 @@ function gtkxResources(loadConfig: ConfigLoader = createConfigLoader()): Plugin
|
|
|
360
347
|
buildEnd() {
|
|
361
348
|
emitBuildBundle(this, state);
|
|
362
349
|
},
|
|
350
|
+
|
|
351
|
+
closeBundle() {
|
|
352
|
+
releaseStagingDir(state);
|
|
353
|
+
},
|
|
363
354
|
};
|
|
364
355
|
}
|
|
365
356
|
|