@gtkx/cli 2.0.0-beta.1 → 2.0.0-beta.10
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 +43 -40
- package/bin/gtkx-dev-runner.js +5 -1
- package/bin/gtkx.js +5 -1
- package/dist/builder.d.ts +1 -0
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +44 -12
- package/dist/builder.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +14 -2
- package/dist/cli.js.map +1 -1
- package/dist/codegen/config-dependencies.d.ts +3 -0
- package/dist/codegen/config-dependencies.d.ts.map +1 -0
- package/dist/codegen/config-dependencies.js +355 -0
- package/dist/codegen/config-dependencies.js.map +1 -0
- package/dist/codegen/freshness.d.ts.map +1 -1
- package/dist/codegen/freshness.js +5 -1
- package/dist/codegen/freshness.js.map +1 -1
- package/dist/codegen/reference.d.ts.map +1 -1
- package/dist/codegen/reference.js +1 -0
- package/dist/codegen/reference.js.map +1 -1
- package/dist/codegen/run-codegen.d.ts +6 -3
- package/dist/codegen/run-codegen.d.ts.map +1 -1
- package/dist/codegen/run-codegen.js +42 -18
- package/dist/codegen/run-codegen.js.map +1 -1
- package/dist/codegen/store-resolver.d.ts +3 -1
- package/dist/codegen/store-resolver.d.ts.map +1 -1
- package/dist/codegen/store-resolver.js +7 -4
- package/dist/codegen/store-resolver.js.map +1 -1
- package/dist/commands/build.d.ts +5 -0
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +83 -10
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/cleanup.d.ts +9 -0
- package/dist/commands/cleanup.d.ts.map +1 -0
- package/dist/commands/cleanup.js +42 -0
- package/dist/commands/cleanup.js.map +1 -0
- package/dist/commands/codegen.d.ts +1 -0
- package/dist/commands/codegen.d.ts.map +1 -1
- package/dist/commands/codegen.js +6 -5
- package/dist/commands/codegen.js.map +1 -1
- package/dist/commands/deploy.d.ts +5 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +10 -2
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +9 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +31 -4
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +1 -0
- package/dist/commands/docs.js.map +1 -1
- package/dist/deploy/depends.d.ts.map +1 -1
- package/dist/deploy/depends.js +24 -2
- package/dist/deploy/depends.js.map +1 -1
- package/dist/deploy/download.d.ts +7 -3
- package/dist/deploy/download.d.ts.map +1 -1
- package/dist/deploy/download.js +19 -20
- package/dist/deploy/download.js.map +1 -1
- package/dist/deploy/freedesktop/metainfo.d.ts.map +1 -1
- package/dist/deploy/freedesktop/metainfo.js +41 -2
- package/dist/deploy/freedesktop/metainfo.js.map +1 -1
- package/dist/deploy/freedesktop/validate.d.ts.map +1 -1
- package/dist/deploy/freedesktop/validate.js +58 -14
- package/dist/deploy/freedesktop/validate.js.map +1 -1
- package/dist/deploy/native-addon.d.ts +5 -0
- package/dist/deploy/native-addon.d.ts.map +1 -0
- package/dist/deploy/native-addon.js +134 -0
- package/dist/deploy/native-addon.js.map +1 -0
- package/dist/deploy/nfpm/config.d.ts +3 -2
- package/dist/deploy/nfpm/config.d.ts.map +1 -1
- package/dist/deploy/nfpm/config.js +7 -4
- package/dist/deploy/nfpm/config.js.map +1 -1
- package/dist/deploy/nfpm/contents.d.ts.map +1 -1
- package/dist/deploy/nfpm/contents.js +8 -0
- package/dist/deploy/nfpm/contents.js.map +1 -1
- package/dist/deploy/node-runtime/download.js +2 -2
- package/dist/deploy/node-runtime/download.js.map +1 -1
- package/dist/deploy/node-runtime/elf.d.ts +4 -1
- package/dist/deploy/node-runtime/elf.d.ts.map +1 -1
- package/dist/deploy/node-runtime/elf.js +34 -5
- package/dist/deploy/node-runtime/elf.js.map +1 -1
- package/dist/deploy/node-runtime/guard.d.ts.map +1 -1
- package/dist/deploy/node-runtime/guard.js +7 -14
- package/dist/deploy/node-runtime/guard.js.map +1 -1
- package/dist/deploy/node-runtime/index.d.ts +3 -1
- package/dist/deploy/node-runtime/index.d.ts.map +1 -1
- package/dist/deploy/node-runtime/index.js +103 -10
- package/dist/deploy/node-runtime/index.js.map +1 -1
- package/dist/deploy/node-runtime/sonames.d.ts +5 -0
- package/dist/deploy/node-runtime/sonames.d.ts.map +1 -0
- package/dist/deploy/node-runtime/sonames.js +13 -0
- package/dist/deploy/node-runtime/sonames.js.map +1 -0
- package/dist/deploy/notices/node-runtime.js +2 -2
- package/dist/deploy/notices/node-runtime.js.map +1 -1
- package/dist/deploy/payload/launcher.d.ts.map +1 -1
- package/dist/deploy/payload/launcher.js +14 -1
- package/dist/deploy/payload/launcher.js.map +1 -1
- package/dist/deploy/payload/stage.d.ts +2 -1
- package/dist/deploy/payload/stage.d.ts.map +1 -1
- package/dist/deploy/payload/stage.js +46 -5
- package/dist/deploy/payload/stage.js.map +1 -1
- package/dist/deploy/run-deploy.d.ts +2 -0
- package/dist/deploy/run-deploy.d.ts.map +1 -1
- package/dist/deploy/run-deploy.js +197 -52
- package/dist/deploy/run-deploy.js.map +1 -1
- package/dist/deploy/settings/arch.d.ts +9 -3
- package/dist/deploy/settings/arch.d.ts.map +1 -1
- package/dist/deploy/settings/arch.js +27 -6
- package/dist/deploy/settings/arch.js.map +1 -1
- package/dist/deploy/settings/build-manifest.d.ts +6 -1
- package/dist/deploy/settings/build-manifest.d.ts.map +1 -1
- package/dist/deploy/settings/build-manifest.js +15 -4
- package/dist/deploy/settings/build-manifest.js.map +1 -1
- package/dist/deploy/settings/extra-files.d.ts +1 -1
- package/dist/deploy/settings/extra-files.d.ts.map +1 -1
- package/dist/deploy/settings/extra-files.js +25 -3
- package/dist/deploy/settings/extra-files.js.map +1 -1
- package/dist/deploy/settings/index.d.ts +3 -1
- package/dist/deploy/settings/index.d.ts.map +1 -1
- package/dist/deploy/settings/index.js +4 -2
- package/dist/deploy/settings/index.js.map +1 -1
- package/dist/deploy/settings/libraries.d.ts.map +1 -1
- package/dist/deploy/settings/libraries.js +2 -1
- package/dist/deploy/settings/libraries.js.map +1 -1
- package/dist/deploy/settings/paths.d.ts +4 -2
- package/dist/deploy/settings/paths.d.ts.map +1 -1
- package/dist/deploy/settings/paths.js +121 -12
- package/dist/deploy/settings/paths.js.map +1 -1
- package/dist/deploy/targets/appimage.d.ts.map +1 -1
- package/dist/deploy/targets/appimage.js +1 -0
- package/dist/deploy/targets/appimage.js.map +1 -1
- package/dist/deploy/targets/flatpak-pnpm.js +4 -4
- package/dist/deploy/targets/flatpak-pnpm.js.map +1 -1
- package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak-source.js +13 -2
- package/dist/deploy/targets/flatpak-source.js.map +1 -1
- package/dist/deploy/targets/flatpak.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak.js +1 -0
- package/dist/deploy/targets/flatpak.js.map +1 -1
- package/dist/deploy/targets/nfpm-target.d.ts.map +1 -1
- package/dist/deploy/targets/nfpm-target.js +13 -7
- package/dist/deploy/targets/nfpm-target.js.map +1 -1
- package/dist/deploy/types.d.ts +5 -2
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/deploy/types.js.map +1 -1
- package/dist/deploy/vendored/appimagetool.js +2 -2
- package/dist/deploy/vendored/appimagetool.js.map +1 -1
- package/dist/deploy/vendored/nfpm.js +1 -1
- package/dist/deploy/vendored/nfpm.js.map +1 -1
- package/dist/dev/catalog-writes.d.ts +8 -0
- package/dist/dev/catalog-writes.d.ts.map +1 -0
- package/dist/dev/catalog-writes.js +26 -0
- package/dist/dev/catalog-writes.js.map +1 -0
- package/dist/dev/entry-env.d.ts +2 -1
- package/dist/dev/entry-env.d.ts.map +1 -1
- package/dist/dev/entry-env.js +2 -1
- package/dist/dev/entry-env.js.map +1 -1
- package/dist/dev/font-dir.d.ts +3 -0
- package/dist/dev/font-dir.d.ts.map +1 -0
- package/dist/dev/font-dir.js +9 -0
- package/dist/dev/font-dir.js.map +1 -0
- package/dist/dev/headless.d.ts +3 -0
- package/dist/dev/headless.d.ts.map +1 -0
- package/dist/dev/headless.js +35 -0
- package/dist/dev/headless.js.map +1 -0
- package/dist/dev/runner-deps.d.ts +1 -1
- package/dist/dev/runner-deps.d.ts.map +1 -1
- package/dist/dev/runner-deps.js +12 -7
- 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 +10 -3
- package/dist/dev/runner-main.js.map +1 -1
- package/dist/dev/runner.d.ts +2 -0
- package/dist/dev/runner.d.ts.map +1 -1
- package/dist/dev/runner.js +26 -7
- package/dist/dev/runner.js.map +1 -1
- package/dist/dev/supervisor.d.ts +3 -1
- package/dist/dev/supervisor.d.ts.map +1 -1
- package/dist/dev/supervisor.js +132 -29
- package/dist/dev/supervisor.js.map +1 -1
- package/dist/dev/vite-dev-server.d.ts +1 -1
- package/dist/dev/vite-dev-server.d.ts.map +1 -1
- package/dist/dev/vite-dev-server.js +14 -2
- package/dist/dev/vite-dev-server.js.map +1 -1
- package/dist/dev/watch-ignore.d.ts +3 -0
- package/dist/dev/watch-ignore.d.ts.map +1 -0
- package/dist/dev/watch-ignore.js +11 -0
- package/dist/dev/watch-ignore.js.map +1 -0
- package/dist/i18n/catalogs.d.ts +6 -2
- package/dist/i18n/catalogs.d.ts.map +1 -1
- package/dist/i18n/catalogs.js +10 -7
- package/dist/i18n/catalogs.js.map +1 -1
- package/dist/i18n/source-messages.d.ts +3 -1
- package/dist/i18n/source-messages.d.ts.map +1 -1
- package/dist/i18n/source-messages.js +973 -9
- package/dist/i18n/source-messages.js.map +1 -1
- package/dist/internal/agent-rules.d.ts.map +1 -1
- package/dist/internal/agent-rules.js +7 -2
- package/dist/internal/agent-rules.js.map +1 -1
- package/dist/internal/banner.d.ts +4 -2
- package/dist/internal/banner.d.ts.map +1 -1
- package/dist/internal/banner.js +19 -5
- package/dist/internal/banner.js.map +1 -1
- package/dist/internal/build-manifest.d.ts +5 -2
- package/dist/internal/build-manifest.d.ts.map +1 -1
- package/dist/internal/build-manifest.js +15 -2
- package/dist/internal/build-manifest.js.map +1 -1
- package/dist/internal/build-output.d.ts +8 -0
- package/dist/internal/build-output.d.ts.map +1 -0
- package/dist/internal/build-output.js +116 -0
- package/dist/internal/build-output.js.map +1 -0
- package/dist/internal/cache-root.d.ts +3 -0
- package/dist/internal/cache-root.d.ts.map +1 -0
- package/dist/internal/cache-root.js +9 -0
- package/dist/internal/cache-root.js.map +1 -0
- package/dist/internal/compile-cache-store.d.ts +4 -0
- package/dist/internal/compile-cache-store.d.ts.map +1 -0
- package/dist/internal/compile-cache-store.js +41 -0
- package/dist/internal/compile-cache-store.js.map +1 -0
- package/dist/internal/compile-cache.d.ts +4 -0
- package/dist/internal/compile-cache.d.ts.map +1 -0
- package/dist/internal/compile-cache.js +16 -0
- package/dist/internal/compile-cache.js.map +1 -0
- package/dist/internal/deploy-out-dir.d.ts +4 -0
- package/dist/internal/deploy-out-dir.d.ts.map +1 -0
- package/dist/internal/deploy-out-dir.js +5 -0
- package/dist/internal/deploy-out-dir.js.map +1 -0
- package/dist/internal/docs-elements.d.ts +1 -0
- package/dist/internal/docs-elements.d.ts.map +1 -1
- package/dist/internal/docs-elements.js +5 -4
- package/dist/internal/docs-elements.js.map +1 -1
- package/dist/internal/entry-arg.d.ts +4 -1
- package/dist/internal/entry-arg.d.ts.map +1 -1
- package/dist/internal/entry-arg.js +7 -1
- package/dist/internal/entry-arg.js.map +1 -1
- package/dist/internal/errors.d.ts +2 -1
- 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/font-path.d.ts +4 -0
- package/dist/internal/font-path.d.ts.map +1 -0
- package/dist/internal/font-path.js +12 -0
- package/dist/internal/font-path.js.map +1 -0
- package/dist/internal/font-staging.d.ts +6 -0
- package/dist/internal/font-staging.d.ts.map +1 -0
- package/dist/internal/font-staging.js +94 -0
- package/dist/internal/font-staging.js.map +1 -0
- package/dist/internal/icon-staging.d.ts +3 -0
- package/dist/internal/icon-staging.d.ts.map +1 -0
- package/dist/internal/icon-staging.js +40 -0
- package/dist/internal/icon-staging.js.map +1 -0
- package/dist/internal/import-scan.d.ts +4 -0
- package/dist/internal/import-scan.d.ts.map +1 -0
- package/dist/internal/import-scan.js +138 -0
- package/dist/internal/import-scan.js.map +1 -0
- package/dist/internal/module-hash.d.ts +3 -0
- package/dist/internal/module-hash.d.ts.map +1 -0
- package/dist/internal/module-hash.js +19 -0
- package/dist/internal/module-hash.js.map +1 -0
- package/dist/internal/output-directory.d.ts +15 -0
- package/dist/internal/output-directory.d.ts.map +1 -0
- package/dist/internal/output-directory.js +490 -0
- package/dist/internal/output-directory.js.map +1 -0
- package/dist/internal/parent-process.d.ts +12 -0
- package/dist/internal/parent-process.d.ts.map +1 -0
- package/dist/internal/parent-process.js +74 -0
- package/dist/internal/parent-process.js.map +1 -0
- package/dist/internal/prepare-project.d.ts +3 -0
- package/dist/internal/prepare-project.d.ts.map +1 -1
- package/dist/internal/prepare-project.js +9 -3
- package/dist/internal/prepare-project.js.map +1 -1
- package/dist/internal/react-compiler-cache.d.ts +13 -0
- package/dist/internal/react-compiler-cache.d.ts.map +1 -0
- package/dist/internal/react-compiler-cache.js +182 -0
- package/dist/internal/react-compiler-cache.js.map +1 -0
- package/dist/internal/source-imports.d.ts +7 -2
- package/dist/internal/source-imports.d.ts.map +1 -1
- package/dist/internal/source-imports.js +31 -11
- package/dist/internal/source-imports.js.map +1 -1
- package/dist/internal/staging-file.d.ts +5 -0
- package/dist/internal/staging-file.d.ts.map +1 -0
- package/dist/internal/staging-file.js +35 -0
- package/dist/internal/staging-file.js.map +1 -0
- package/dist/internal/xdg-banner.d.ts +4 -0
- package/dist/internal/xdg-banner.d.ts.map +1 -0
- package/dist/internal/xdg-banner.js +11 -0
- package/dist/internal/xdg-banner.js.map +1 -0
- package/dist/internal/xdg-data-dirs.d.ts +2 -1
- package/dist/internal/xdg-data-dirs.d.ts.map +1 -1
- package/dist/internal/xdg-data-dirs.js +1 -1
- package/dist/internal/xdg-data-dirs.js.map +1 -1
- package/dist/mcp/client.js +2 -2
- package/dist/mcp/client.js.map +1 -1
- package/dist/settings/schema.d.ts.map +1 -1
- package/dist/settings/schema.js +3 -8
- package/dist/settings/schema.js.map +1 -1
- package/dist/vite-plugins/asset-extensions.d.ts.map +1 -1
- package/dist/vite-plugins/asset-extensions.js +2 -0
- package/dist/vite-plugins/asset-extensions.js.map +1 -1
- package/dist/vite-plugins/asset-imports.d.ts.map +1 -1
- package/dist/vite-plugins/asset-imports.js +20 -6
- package/dist/vite-plugins/asset-imports.js.map +1 -1
- package/dist/vite-plugins/asset-specifier.d.ts +5 -1
- package/dist/vite-plugins/asset-specifier.d.ts.map +1 -1
- package/dist/vite-plugins/asset-specifier.js +10 -1
- package/dist/vite-plugins/asset-specifier.js.map +1 -1
- package/dist/vite-plugins/build-manifest.d.ts +5 -1
- package/dist/vite-plugins/build-manifest.d.ts.map +1 -1
- package/dist/vite-plugins/build-manifest.js +2 -1
- package/dist/vite-plugins/build-manifest.js.map +1 -1
- package/dist/vite-plugins/built-url.d.ts.map +1 -1
- package/dist/vite-plugins/built-url.js +5 -2
- package/dist/vite-plugins/built-url.js.map +1 -1
- package/dist/vite-plugins/css.d.ts.map +1 -1
- package/dist/vite-plugins/css.js +13 -5
- package/dist/vite-plugins/css.js.map +1 -1
- package/dist/vite-plugins/ensure-store.d.ts +1 -1
- package/dist/vite-plugins/ensure-store.d.ts.map +1 -1
- package/dist/vite-plugins/ensure-store.js +2 -2
- package/dist/vite-plugins/ensure-store.js.map +1 -1
- package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts +6 -1
- package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts.map +1 -1
- package/dist/vite-plugins/fast-refresh/refresh-filter.js +3 -1
- package/dist/vite-plugins/fast-refresh/refresh-filter.js.map +1 -1
- package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts.map +1 -1
- package/dist/vite-plugins/fast-refresh/swc-refresh.js +23 -14
- package/dist/vite-plugins/fast-refresh/swc-refresh.js.map +1 -1
- package/dist/vite-plugins/font-name.d.ts +3 -0
- package/dist/vite-plugins/font-name.d.ts.map +1 -0
- package/dist/vite-plugins/font-name.js +406 -0
- package/dist/vite-plugins/font-name.js.map +1 -0
- package/dist/vite-plugins/font-worker-env.d.ts +4 -0
- package/dist/vite-plugins/font-worker-env.d.ts.map +1 -0
- package/dist/vite-plugins/font-worker-env.js +19 -0
- package/dist/vite-plugins/font-worker-env.js.map +1 -0
- package/dist/vite-plugins/font.d.ts +4 -0
- package/dist/vite-plugins/font.d.ts.map +1 -0
- package/dist/vite-plugins/font.js +111 -0
- package/dist/vite-plugins/font.js.map +1 -0
- package/dist/vite-plugins/i18n.d.ts +11 -2
- package/dist/vite-plugins/i18n.d.ts.map +1 -1
- package/dist/vite-plugins/i18n.js +74 -8
- package/dist/vite-plugins/i18n.js.map +1 -1
- package/dist/vite-plugins/icon-worker-env.d.ts +4 -0
- package/dist/vite-plugins/icon-worker-env.d.ts.map +1 -0
- package/dist/vite-plugins/icon-worker-env.js +23 -0
- package/dist/vite-plugins/icon-worker-env.js.map +1 -0
- package/dist/vite-plugins/icons.d.ts.map +1 -1
- package/dist/vite-plugins/icons.js +4 -9
- package/dist/vite-plugins/icons.js.map +1 -1
- package/dist/vite-plugins/index.d.ts +10 -1
- package/dist/vite-plugins/index.d.ts.map +1 -1
- package/dist/vite-plugins/index.js +17 -3
- package/dist/vite-plugins/index.js.map +1 -1
- package/dist/vite-plugins/native.d.ts.map +1 -1
- package/dist/vite-plugins/native.js +0 -4
- package/dist/vite-plugins/native.js.map +1 -1
- package/dist/vite-plugins/react-compiler.d.ts.map +1 -1
- package/dist/vite-plugins/react-compiler.js +57 -18
- package/dist/vite-plugins/react-compiler.js.map +1 -1
- package/dist/vite-plugins/resource-shared.d.ts +3 -1
- package/dist/vite-plugins/resource-shared.d.ts.map +1 -1
- package/dist/vite-plugins/resource-shared.js +3 -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 +9 -6
- package/dist/vite-plugins/resources.js.map +1 -1
- package/dist/vite-plugins/self-contained.d.ts.map +1 -1
- package/dist/vite-plugins/self-contained.js +159 -158
- package/dist/vite-plugins/self-contained.js.map +1 -1
- package/dist/vite-plugins/settings-worker-env.d.ts +1 -1
- package/dist/vite-plugins/settings-worker-env.d.ts.map +1 -1
- package/dist/vite-plugins/settings-worker-env.js +4 -4
- package/dist/vite-plugins/settings-worker-env.js.map +1 -1
- package/dist/vite-plugins/settings.d.ts.map +1 -1
- package/dist/vite-plugins/settings.js +25 -14
- package/dist/vite-plugins/settings.js.map +1 -1
- package/dist/vite-plugins/store-links.d.ts.map +1 -1
- package/dist/vite-plugins/store-links.js +9 -5
- package/dist/vite-plugins/store-links.js.map +1 -1
- package/dist/vite-plugins/undeclared-library.d.ts.map +1 -1
- package/dist/vite-plugins/undeclared-library.js +18 -15
- 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 +21 -13
- package/dist/vite-plugins/worker.js.map +1 -1
- package/dist/vitest-plugin.d.ts +4 -3
- package/dist/vitest-plugin.d.ts.map +1 -1
- package/dist/vitest-plugin.js +12 -8
- package/dist/vitest-plugin.js.map +1 -1
- package/env.d.ts +9 -0
- package/package.json +18 -13
- package/src/builder.ts +45 -12
- package/src/cli.ts +15 -2
- package/src/codegen/config-dependencies.ts +470 -0
- package/src/codegen/freshness.ts +5 -1
- package/src/codegen/reference.ts +1 -0
- package/src/codegen/run-codegen.ts +51 -21
- package/src/codegen/store-resolver.ts +9 -4
- package/src/commands/build.ts +13 -2
- package/src/commands/cleanup.ts +48 -0
- package/src/commands/codegen.ts +6 -5
- package/src/commands/deploy.ts +10 -2
- package/src/commands/dev.ts +45 -4
- package/src/commands/docs.ts +1 -0
- package/src/deploy/depends.ts +30 -3
- package/src/deploy/download.ts +33 -24
- package/src/deploy/freedesktop/metainfo.ts +73 -21
- package/src/deploy/freedesktop/validate.ts +80 -15
- package/src/deploy/native-addon.ts +183 -0
- package/src/deploy/nfpm/config.ts +13 -4
- package/src/deploy/nfpm/contents.ts +8 -0
- package/src/deploy/node-runtime/download.ts +2 -2
- package/src/deploy/node-runtime/elf.ts +46 -5
- package/src/deploy/node-runtime/guard.ts +10 -14
- package/src/deploy/node-runtime/index.ts +148 -12
- package/src/deploy/node-runtime/sonames.ts +17 -0
- package/src/deploy/notices/node-runtime.ts +2 -2
- package/src/deploy/payload/launcher.ts +20 -1
- package/src/deploy/payload/stage.ts +76 -5
- package/src/deploy/run-deploy.ts +227 -72
- package/src/deploy/settings/arch.ts +40 -8
- package/src/deploy/settings/build-manifest.ts +28 -3
- package/src/deploy/settings/extra-files.ts +30 -4
- package/src/deploy/settings/index.ts +7 -2
- package/src/deploy/settings/libraries.ts +2 -1
- package/src/deploy/settings/paths.ts +80 -13
- package/src/deploy/targets/appimage.ts +1 -0
- package/src/deploy/targets/flatpak-pnpm.ts +4 -4
- package/src/deploy/targets/flatpak-source.ts +15 -2
- package/src/deploy/targets/flatpak.ts +1 -0
- package/src/deploy/targets/nfpm-target.ts +14 -6
- package/src/deploy/types.ts +5 -1
- package/src/deploy/vendored/appimagetool.ts +2 -2
- package/src/deploy/vendored/nfpm.ts +1 -1
- package/src/dev/catalog-writes.ts +35 -0
- package/src/dev/entry-env.ts +2 -1
- package/src/dev/font-dir.ts +11 -0
- package/src/dev/headless.ts +40 -0
- package/src/dev/runner-deps.ts +20 -7
- package/src/dev/runner-main.ts +12 -3
- package/src/dev/runner.ts +37 -7
- package/src/dev/supervisor.ts +183 -32
- package/src/dev/vite-dev-server.ts +20 -2
- package/src/dev/watch-ignore.ts +16 -0
- package/src/i18n/catalogs.ts +21 -8
- package/src/i18n/source-messages.ts +1446 -29
- package/src/internal/agent-rules.ts +7 -2
- package/src/internal/banner.ts +27 -6
- package/src/internal/build-manifest.ts +25 -1
- package/src/internal/build-output.ts +171 -0
- package/src/internal/cache-root.ts +12 -0
- package/src/internal/compile-cache-store.ts +50 -0
- package/src/internal/compile-cache.ts +20 -0
- package/src/internal/deploy-out-dir.ts +8 -0
- package/src/internal/docs-elements.ts +10 -4
- package/src/internal/entry-arg.ts +8 -1
- package/src/internal/errors.ts +1 -1
- package/src/internal/font-path.ts +15 -0
- package/src/internal/font-staging.ts +131 -0
- package/src/internal/icon-staging.ts +58 -0
- package/src/internal/import-scan.ts +206 -0
- package/src/internal/module-hash.ts +22 -0
- package/src/internal/output-directory.ts +699 -0
- package/src/internal/parent-process.ts +110 -0
- package/src/internal/prepare-project.ts +11 -5
- package/src/internal/react-compiler-cache.ts +246 -0
- package/src/internal/source-imports.ts +57 -12
- package/src/internal/staging-file.ts +42 -0
- package/src/internal/xdg-banner.ts +13 -0
- package/src/internal/xdg-data-dirs.ts +1 -1
- package/src/mcp/client.ts +2 -2
- package/src/settings/schema.ts +4 -10
- package/src/vite-plugins/asset-extensions.ts +2 -0
- package/src/vite-plugins/asset-imports.ts +23 -5
- package/src/vite-plugins/asset-specifier.ts +17 -0
- package/src/vite-plugins/build-manifest.ts +7 -1
- package/src/vite-plugins/built-url.ts +6 -2
- package/src/vite-plugins/css.ts +16 -5
- package/src/vite-plugins/ensure-store.ts +2 -2
- package/src/vite-plugins/fast-refresh/refresh-filter.ts +10 -1
- package/src/vite-plugins/fast-refresh/swc-refresh.ts +33 -14
- package/src/vite-plugins/font-name.ts +582 -0
- package/src/vite-plugins/font-worker-env.ts +25 -0
- package/src/vite-plugins/font.ts +180 -0
- package/src/vite-plugins/i18n.ts +122 -11
- package/src/vite-plugins/icon-worker-env.ts +36 -0
- package/src/vite-plugins/icons.ts +4 -10
- package/src/vite-plugins/index.ts +34 -9
- package/src/vite-plugins/native.ts +0 -5
- package/src/vite-plugins/react-compiler.ts +83 -19
- package/src/vite-plugins/resource-shared.ts +4 -0
- package/src/vite-plugins/resources.ts +11 -5
- package/src/vite-plugins/self-contained.ts +184 -185
- package/src/vite-plugins/settings-worker-env.ts +4 -4
- package/src/vite-plugins/settings.ts +36 -16
- package/src/vite-plugins/store-links.ts +10 -5
- package/src/vite-plugins/undeclared-library.ts +19 -15
- package/src/vite-plugins/worker.ts +31 -15
- package/src/vitest-plugin.ts +12 -8
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
|
|
3
|
+
type ProcessIdentity = {
|
|
4
|
+
pid: number;
|
|
5
|
+
parentId: number;
|
|
6
|
+
processGroupId: number;
|
|
7
|
+
startTime: string;
|
|
8
|
+
state: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type ProcessGroupOwner = Pick<ProcessIdentity, "pid" | "startTime">;
|
|
12
|
+
type ProcessGroupOwnerCapture = { isCaptured: true; owner: ProcessGroupOwner | undefined } |
|
|
13
|
+
{ isCaptured: false; error: Error };
|
|
14
|
+
|
|
15
|
+
const initialParentId = process.ppid;
|
|
16
|
+
const STOPPED_PROCESS_STATES: Set<string> = new Set(["Z", "X", "x"]);
|
|
17
|
+
|
|
18
|
+
const processIdentity = (pid: number): ProcessIdentity => {
|
|
19
|
+
const stat = readFileSync(`/proc/${String(pid)}/stat`, "utf8");
|
|
20
|
+
const fields = stat.slice(stat.lastIndexOf(") ") + 2).split(" ");
|
|
21
|
+
const state = fields[0];
|
|
22
|
+
const parentId = Number(fields[1]);
|
|
23
|
+
const processGroupId = Number(fields[2]);
|
|
24
|
+
const startTime = fields[19];
|
|
25
|
+
|
|
26
|
+
if (
|
|
27
|
+
state === undefined ||
|
|
28
|
+
startTime === undefined ||
|
|
29
|
+
!Number.isSafeInteger(parentId) ||
|
|
30
|
+
!Number.isSafeInteger(processGroupId)
|
|
31
|
+
) {
|
|
32
|
+
throw new Error(`Failed to identify process ${String(pid)}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return { pid, parentId, processGroupId, startTime, state };
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const ancestorFor = (process: ProcessIdentity, ancestorId: number): ProcessIdentity | undefined => {
|
|
39
|
+
let current = process;
|
|
40
|
+
|
|
41
|
+
while (current.parentId > 1) {
|
|
42
|
+
const parent = processIdentity(current.parentId);
|
|
43
|
+
|
|
44
|
+
if (parent.pid === ancestorId) {
|
|
45
|
+
return parent;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
current = parent;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return undefined;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const processGroupOwner = (process: ProcessIdentity): ProcessGroupOwner => {
|
|
55
|
+
if (process.processGroupId !== process.pid || STOPPED_PROCESS_STATES.has(process.state)) {
|
|
56
|
+
throw new Error(`Failed to identify process group ${String(process.pid)}`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return { pid: process.pid, startTime: process.startTime };
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const processGroupOwnerFor = (process: ProcessIdentity): ProcessGroupOwner | undefined => {
|
|
63
|
+
if (process.processGroupId === process.pid) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const groupLeader = processGroupOwner(processIdentity(process.processGroupId));
|
|
68
|
+
const owner = ancestorFor(process, groupLeader.pid);
|
|
69
|
+
|
|
70
|
+
if (owner !== undefined) {
|
|
71
|
+
return groupLeader;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const currentGroupLeader = processGroupOwner(processIdentity(groupLeader.pid));
|
|
75
|
+
|
|
76
|
+
if (currentGroupLeader.startTime !== groupLeader.startTime) {
|
|
77
|
+
throw new Error(`Failed to identify process group ${String(groupLeader.pid)}`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return undefined;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const captureProcessGroupOwner = (): ProcessGroupOwnerCapture => {
|
|
84
|
+
try {
|
|
85
|
+
const initialProcess = processIdentity(process.pid);
|
|
86
|
+
|
|
87
|
+
if (initialProcess.parentId !== initialParentId) {
|
|
88
|
+
throw new Error("The process that launched GTKX exited during startup");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return { isCaptured: true, owner: processGroupOwnerFor(initialProcess) };
|
|
92
|
+
} catch (error) {
|
|
93
|
+
return {
|
|
94
|
+
isCaptured: false,
|
|
95
|
+
error: error instanceof Error ? error : new Error("Failed to identify the process that launched GTKX"),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const capturedProcessGroupOwner = captureProcessGroupOwner();
|
|
101
|
+
|
|
102
|
+
const getInitialProcessGroupOwner = (): ProcessGroupOwner | undefined => {
|
|
103
|
+
if (!capturedProcessGroupOwner.isCaptured) {
|
|
104
|
+
throw capturedProcessGroupOwner.error;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return capturedProcessGroupOwner.owner;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export { getInitialProcessGroupOwner, initialParentId };
|
|
@@ -2,22 +2,28 @@ import { ensureGeneratedIn } from "../codegen/run-codegen.js";
|
|
|
2
2
|
import { type CodegenContext, resolveCodegenContext } from "../codegen/store-resolver.js";
|
|
3
3
|
import { resolveCwd, resolveEntry } from "./entry-arg.js";
|
|
4
4
|
|
|
5
|
-
type ProjectArgs = { entry?: string; cwd?: string };
|
|
6
|
-
type PreparedProject = { cwd: string; entry: string };
|
|
5
|
+
type ProjectArgs = { entry?: string; cwd?: string; config?: string };
|
|
6
|
+
type PreparedProject = { cwd: string; entry: string; configFile: string; configDependencies: string[] };
|
|
7
7
|
type ResolvedProject = PreparedProject & { context: CodegenContext };
|
|
8
8
|
|
|
9
9
|
const resolveProject = async (args: ProjectArgs, mode: string): Promise<ResolvedProject> => {
|
|
10
10
|
const cwd = resolveCwd(args);
|
|
11
|
-
const context = await resolveCodegenContext(cwd, mode);
|
|
11
|
+
const context = await resolveCodegenContext(cwd, mode, args.config);
|
|
12
12
|
|
|
13
|
-
return {
|
|
13
|
+
return {
|
|
14
|
+
cwd,
|
|
15
|
+
entry: resolveEntry(cwd, args.entry),
|
|
16
|
+
configFile: context.configFile,
|
|
17
|
+
configDependencies: context.configDependencies,
|
|
18
|
+
context,
|
|
19
|
+
};
|
|
14
20
|
};
|
|
15
21
|
|
|
16
22
|
const prepareProject = async (args: ProjectArgs, mode: string): Promise<PreparedProject> => {
|
|
17
23
|
const { cwd, entry, context } = await resolveProject(args, mode);
|
|
18
24
|
await ensureGeneratedIn(context, { shouldAnnounce: true, mode });
|
|
19
25
|
|
|
20
|
-
return { cwd, entry };
|
|
26
|
+
return { cwd, entry, configFile: context.configFile, configDependencies: context.configDependencies };
|
|
21
27
|
};
|
|
22
28
|
|
|
23
29
|
export { prepareProject, resolveProject };
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import type { ResolvedReactCompilerOptions } from "@gtkx/config/internal";
|
|
2
|
+
import { isRecord } from "@gtkx/utils";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { mkdirSync, readdirSync, readFileSync, rmSync, statSync } from "node:fs";
|
|
5
|
+
import { createRequire } from "node:module";
|
|
6
|
+
import { dirname, join } from "node:path";
|
|
7
|
+
import packageManifest from "../../package.json" with { type: "json" };
|
|
8
|
+
import { moduleHash } from "./module-hash.js";
|
|
9
|
+
import { isStagingOwnerRunning, STAGING_SUFFIX, writeAtomically } from "./staging-file.js";
|
|
10
|
+
|
|
11
|
+
type CompilerOutput = { code: string; map?: string };
|
|
12
|
+
|
|
13
|
+
type ReactCompilerCache = {
|
|
14
|
+
keyFor: (code: string, id: string) => string;
|
|
15
|
+
read: (key: string) => CompilerOutput | undefined;
|
|
16
|
+
write: (key: string, output: CompilerOutput) => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type ToolchainWalk = {
|
|
20
|
+
identities: Set<string>;
|
|
21
|
+
queue: [string, string][];
|
|
22
|
+
visited: Set<string>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const CACHE_NAME = "gtkx-react-compiler";
|
|
26
|
+
const CACHE_VERSION = "1";
|
|
27
|
+
const ENTRY_SUFFIX = ".json";
|
|
28
|
+
const GENERATION_LENGTH = 16;
|
|
29
|
+
const MAX_ENTRIES = 2048;
|
|
30
|
+
const TOOLCHAIN_PACKAGES = ["@babel/core", "@babel/preset-typescript", "babel-plugin-react-compiler"];
|
|
31
|
+
const PLUGIN_MODULE = ["..", "vite-plugins", "react-compiler"];
|
|
32
|
+
const toolchain: { value: string | undefined } = { value: undefined };
|
|
33
|
+
|
|
34
|
+
const readText = (path: string): string | undefined => {
|
|
35
|
+
try {
|
|
36
|
+
return readFileSync(path, "utf8");
|
|
37
|
+
} catch {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const readManifest = (path: string): unknown => {
|
|
43
|
+
const contents = readText(path);
|
|
44
|
+
|
|
45
|
+
if (contents === undefined) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
return JSON.parse(contents) as unknown;
|
|
51
|
+
} catch {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const manifestIdentity = (value: unknown): string | undefined =>
|
|
57
|
+
isRecord(value) && typeof value.name === "string" && typeof value.version === "string"
|
|
58
|
+
? `${value.name}@${value.version}`
|
|
59
|
+
: undefined;
|
|
60
|
+
|
|
61
|
+
const tryResolve = (resolver: NodeJS.Require, specifier: string): string | undefined => {
|
|
62
|
+
try {
|
|
63
|
+
return resolver.resolve(specifier);
|
|
64
|
+
} catch {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const manifestNear = (entry: string, name: string): string | undefined => {
|
|
70
|
+
for (let dir = dirname(entry); dir !== dirname(dir); dir = dirname(dir)) {
|
|
71
|
+
const candidate = join(dir, "package.json");
|
|
72
|
+
|
|
73
|
+
if (manifestIdentity(readManifest(candidate))?.startsWith(`${name}@`) === true) {
|
|
74
|
+
return candidate;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return undefined;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const manifestPathFor = (name: string, from: string): string | undefined => {
|
|
82
|
+
const resolver = createRequire(from);
|
|
83
|
+
const direct = tryResolve(resolver, `${name}/package.json`);
|
|
84
|
+
|
|
85
|
+
if (direct !== undefined) {
|
|
86
|
+
return direct;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const entry = tryResolve(resolver, name);
|
|
90
|
+
|
|
91
|
+
return entry === undefined ? undefined : manifestNear(entry, name);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const visitPackage = (name: string, from: string, walk: ToolchainWalk): void => {
|
|
95
|
+
const path = manifestPathFor(name, from);
|
|
96
|
+
|
|
97
|
+
if (path === undefined || walk.visited.has(path)) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
walk.visited.add(path);
|
|
102
|
+
const manifest = readManifest(path);
|
|
103
|
+
const identity = manifestIdentity(manifest);
|
|
104
|
+
|
|
105
|
+
if (identity !== undefined) {
|
|
106
|
+
walk.identities.add(identity);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (isRecord(manifest) && isRecord(manifest.dependencies)) {
|
|
110
|
+
const dependencies = Object.keys(manifest.dependencies);
|
|
111
|
+
walk.queue.push(...dependencies.map((dependency): [string, string] => [dependency, path]));
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const computeToolchainKey = (): string => {
|
|
116
|
+
const walk: ToolchainWalk = {
|
|
117
|
+
identities: new Set(),
|
|
118
|
+
queue: TOOLCHAIN_PACKAGES.map((name): [string, string] => [name, import.meta.filename]),
|
|
119
|
+
visited: new Set(),
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
for (const [name, from] of walk.queue) {
|
|
123
|
+
visitPackage(name, from, walk);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const identities = [...walk.identities].toSorted((left, right) => left.localeCompare(right));
|
|
127
|
+
|
|
128
|
+
return createHash("sha256").update(identities.join(",")).digest("hex");
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const toolchainKey = (): string => (toolchain.value ??= computeToolchainKey());
|
|
132
|
+
|
|
133
|
+
const entryTime = (path: string): number => {
|
|
134
|
+
try {
|
|
135
|
+
return statSync(path).mtimeMs;
|
|
136
|
+
} catch {
|
|
137
|
+
return 0;
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const pruneEntries = (dir: string, names: string[]): void => {
|
|
142
|
+
const keys = names.filter((name) => name.endsWith(ENTRY_SUFFIX)).map((name) => name.slice(0, -ENTRY_SUFFIX.length));
|
|
143
|
+
|
|
144
|
+
if (keys.length <= MAX_ENTRIES) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const ordered = keys
|
|
149
|
+
.map((key) => ({ key, time: entryTime(join(dir, `${key}${ENTRY_SUFFIX}`)) }))
|
|
150
|
+
.toSorted((left, right) => left.time - right.time);
|
|
151
|
+
const expired = ordered.slice(0, keys.length - MAX_ENTRIES / 2);
|
|
152
|
+
|
|
153
|
+
for (const entry of expired) {
|
|
154
|
+
rmSync(join(dir, `${entry.key}${ENTRY_SUFFIX}`), { force: true });
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const pruneGenerations = (root: string, generation: string): void => {
|
|
159
|
+
const names = readdirSync(root);
|
|
160
|
+
|
|
161
|
+
for (const name of names) {
|
|
162
|
+
if (name !== generation) {
|
|
163
|
+
rmSync(join(root, name), { force: true, recursive: true });
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const isRetained = (name: string): boolean =>
|
|
169
|
+
name.endsWith(ENTRY_SUFFIX) || (name.endsWith(STAGING_SUFFIX) && isStagingOwnerRunning(name));
|
|
170
|
+
|
|
171
|
+
const pruneStaging = (dir: string, names: string[]): void => {
|
|
172
|
+
for (const name of names) {
|
|
173
|
+
if (!isRetained(name)) {
|
|
174
|
+
rmSync(join(dir, name), { force: true });
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const prepareCacheDir = (root: string, generation: string): string | null => {
|
|
180
|
+
const dir = join(root, generation);
|
|
181
|
+
|
|
182
|
+
try {
|
|
183
|
+
mkdirSync(dir, { recursive: true });
|
|
184
|
+
pruneGenerations(root, generation);
|
|
185
|
+
const names = readdirSync(dir);
|
|
186
|
+
pruneStaging(dir, names);
|
|
187
|
+
pruneEntries(dir, names);
|
|
188
|
+
|
|
189
|
+
return dir;
|
|
190
|
+
} catch {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const compilerOutput = (value: unknown): CompilerOutput | undefined => {
|
|
196
|
+
if (!isRecord(value) || typeof value.code !== "string") {
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return typeof value.map === "string" ? { code: value.code, map: value.map } : { code: value.code };
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const readEntry = (dir: string, key: string): CompilerOutput | undefined =>
|
|
204
|
+
compilerOutput(readManifest(join(dir, `${key}${ENTRY_SUFFIX}`)));
|
|
205
|
+
|
|
206
|
+
const writeEntry = (dir: string, key: string, output: CompilerOutput): void => {
|
|
207
|
+
writeAtomically(join(dir, `${key}${ENTRY_SUFFIX}`), JSON.stringify(output));
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const pluginHash = (): string => moduleHash(join(import.meta.dirname, ...PLUGIN_MODULE));
|
|
211
|
+
|
|
212
|
+
const cacheIdentity = (options: ResolvedReactCompilerOptions, generation: string): string =>
|
|
213
|
+
[
|
|
214
|
+
CACHE_VERSION,
|
|
215
|
+
packageManifest.version,
|
|
216
|
+
pluginHash(),
|
|
217
|
+
generation,
|
|
218
|
+
JSON.stringify(options),
|
|
219
|
+
String(process.env.NODE_ENV),
|
|
220
|
+
].join("\0");
|
|
221
|
+
|
|
222
|
+
const createReactCompilerCache = (
|
|
223
|
+
cacheDir: string,
|
|
224
|
+
options: ResolvedReactCompilerOptions,
|
|
225
|
+
): ReactCompilerCache | null => {
|
|
226
|
+
const root = join(cacheDir, CACHE_NAME);
|
|
227
|
+
const generation = toolchainKey().slice(0, GENERATION_LENGTH);
|
|
228
|
+
const dir = prepareCacheDir(root, generation);
|
|
229
|
+
|
|
230
|
+
if (dir === null) {
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const identity = cacheIdentity(options, generation);
|
|
235
|
+
|
|
236
|
+
return {
|
|
237
|
+
keyFor: (code, id) =>
|
|
238
|
+
createHash("sha256").update(identity).update("\0").update(id).update("\0").update(code).digest("hex"),
|
|
239
|
+
read: (key) => readEntry(dir, key),
|
|
240
|
+
write: (key, output) => {
|
|
241
|
+
writeEntry(dir, key, output);
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
export { type CompilerOutput, createReactCompilerCache, type ReactCompilerCache };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ESTree, ParseResult, ParserOptions } from "vite";
|
|
2
2
|
import { sortStringsBy } from "@gtkx/utils";
|
|
3
|
-
import { globSync, readFileSync } from "node:fs";
|
|
3
|
+
import { existsSync, globSync, readFileSync } from "node:fs";
|
|
4
4
|
import { extname, join } from "node:path";
|
|
5
5
|
import { parseSync, Visitor } from "vite";
|
|
6
6
|
|
|
@@ -21,6 +21,8 @@ const SOURCE_LANGUAGES: Map<string, SourceLanguage> = new Map([
|
|
|
21
21
|
[".tsx", "tsx"],
|
|
22
22
|
]);
|
|
23
23
|
|
|
24
|
+
const SOURCE_ID_RE = /\.[cm]?[jt]sx?(?:\?.*)?$/i;
|
|
25
|
+
|
|
24
26
|
const sourceLanguage = (path: string): SourceLanguage | undefined => {
|
|
25
27
|
if (path.endsWith(".d.ts") || path.endsWith(".d.mts")) {
|
|
26
28
|
return undefined;
|
|
@@ -29,11 +31,19 @@ const sourceLanguage = (path: string): SourceLanguage | undefined => {
|
|
|
29
31
|
return SOURCE_LANGUAGES.get(extname(path).toLowerCase());
|
|
30
32
|
};
|
|
31
33
|
|
|
34
|
+
const SOURCE_DIR = "src";
|
|
35
|
+
|
|
36
|
+
const sourceDirFor = (root: string): string => {
|
|
37
|
+
const sourceDir = join(root, SOURCE_DIR);
|
|
38
|
+
|
|
39
|
+
return existsSync(sourceDir) ? sourceDir : root;
|
|
40
|
+
};
|
|
41
|
+
|
|
32
42
|
const discoverSourceFiles = (dir: string): string[] =>
|
|
33
43
|
sortStringsBy(
|
|
34
44
|
globSync("**/{*,.*}", {
|
|
35
45
|
cwd: dir,
|
|
36
|
-
exclude: ["**/{build,coverage,dist,node_modules,out-tsc}/**"],
|
|
46
|
+
exclude: ["**/{build,coverage,dist,node_modules,out-tsc}/**", "**/.gtkx-output-*/**", "**/.git/**"],
|
|
37
47
|
withFileTypes: true,
|
|
38
48
|
})
|
|
39
49
|
.filter((entry) => entry.isFile())
|
|
@@ -89,8 +99,9 @@ const collectDynamicImportSources = (program: ESTree.Program, found: string[]):
|
|
|
89
99
|
}).visit(program);
|
|
90
100
|
};
|
|
91
101
|
|
|
92
|
-
const
|
|
102
|
+
const parseSourceWith = (
|
|
93
103
|
path: string,
|
|
104
|
+
code: string,
|
|
94
105
|
staticSources: (module: ParsedModule) => string[],
|
|
95
106
|
): SourceImport[] | null => {
|
|
96
107
|
const lang = sourceLanguage(path);
|
|
@@ -102,7 +113,7 @@ const parseImportsInWith = (
|
|
|
102
113
|
let parsed: ParseResult;
|
|
103
114
|
|
|
104
115
|
try {
|
|
105
|
-
parsed = parseSync(path,
|
|
116
|
+
parsed = parseSync(path, code, { lang });
|
|
106
117
|
} catch {
|
|
107
118
|
return null;
|
|
108
119
|
}
|
|
@@ -112,24 +123,58 @@ const parseImportsInWith = (
|
|
|
112
123
|
}
|
|
113
124
|
|
|
114
125
|
const sources = staticSources(parsed.module);
|
|
115
|
-
|
|
126
|
+
|
|
127
|
+
if (parsed.module.dynamicImports.length > 0) {
|
|
128
|
+
collectDynamicImportSources(parsed.program, sources);
|
|
129
|
+
}
|
|
116
130
|
|
|
117
131
|
return [...new Set(sources)].map((source) => ({ importer: path, source }));
|
|
118
132
|
};
|
|
119
133
|
|
|
134
|
+
const readSource = (path: string): string | null => {
|
|
135
|
+
try {
|
|
136
|
+
return readFileSync(path, "utf8");
|
|
137
|
+
} catch {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const parseImportsInWith = (
|
|
143
|
+
path: string,
|
|
144
|
+
staticSources: (module: ParsedModule) => string[],
|
|
145
|
+
): SourceImport[] | null => {
|
|
146
|
+
if (sourceLanguage(path) === undefined) {
|
|
147
|
+
return [];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const code = readSource(path);
|
|
151
|
+
|
|
152
|
+
return code === null ? null : parseSourceWith(path, code, staticSources);
|
|
153
|
+
};
|
|
154
|
+
|
|
120
155
|
const parseImportsIn = (path: string): SourceImport[] | null => parseImportsInWith(path, staticImportSources);
|
|
121
156
|
|
|
122
157
|
const parseRuntimeImportsIn = (path: string): SourceImport[] | null =>
|
|
123
158
|
parseImportsInWith(path, staticRuntimeImportSources);
|
|
124
159
|
|
|
125
160
|
const importsIn = (path: string): SourceImport[] => parseImportsIn(path) ?? [];
|
|
126
|
-
const importKey = (entry: SourceImport): string => `${entry.importer}\0${entry.source}`;
|
|
127
161
|
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
const imports = files.flatMap((path) => importsIn(path));
|
|
162
|
+
const importSourcesIn = (path: string, code: string): string[] | null =>
|
|
163
|
+
parseSourceWith(path, code, staticImportSources)?.map((entry) => entry.source) ?? null;
|
|
131
164
|
|
|
132
|
-
|
|
133
|
-
};
|
|
165
|
+
const importKey = (entry: SourceImport): string => `${entry.importer}\0${entry.source}`;
|
|
134
166
|
|
|
135
|
-
|
|
167
|
+
const sortSourceImports = (imports: SourceImport[]): SourceImport[] => sortStringsBy(imports, importKey);
|
|
168
|
+
|
|
169
|
+
export {
|
|
170
|
+
discoverSourceFiles,
|
|
171
|
+
importSourcesIn,
|
|
172
|
+
importsIn,
|
|
173
|
+
parseRuntimeImportsIn,
|
|
174
|
+
readSource,
|
|
175
|
+
SOURCE_ID_RE,
|
|
176
|
+
sortSourceImports,
|
|
177
|
+
sourceDirFor,
|
|
178
|
+
sourceLanguage,
|
|
179
|
+
type SourceImport,
|
|
180
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { errorCode } from "@gtkx/utils";
|
|
2
|
+
import { renameSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
|
|
4
|
+
const STAGING_SUFFIX = ".tmp";
|
|
5
|
+
const STAGING_OWNER_RE = /\.(\d+)\.\d+\.tmp$/;
|
|
6
|
+
const FOREIGN_OWNER_CODE = "EPERM";
|
|
7
|
+
const staging = { count: 0 };
|
|
8
|
+
|
|
9
|
+
const stagingPath = (path: string): string => {
|
|
10
|
+
staging.count += 1;
|
|
11
|
+
|
|
12
|
+
return `${path}.${String(process.pid)}.${String(staging.count)}${STAGING_SUFFIX}`;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const isStagingOwnerRunning = (name: string): boolean => {
|
|
16
|
+
const owner = STAGING_OWNER_RE.exec(name);
|
|
17
|
+
|
|
18
|
+
if (owner === null) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
process.kill(Number(owner[1]), 0);
|
|
24
|
+
|
|
25
|
+
return true;
|
|
26
|
+
} catch (error) {
|
|
27
|
+
return errorCode(error) === FOREIGN_OWNER_CODE;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const writeAtomically = (path: string, contents: string): void => {
|
|
32
|
+
const temporary = stagingPath(path);
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
writeFileSync(temporary, contents);
|
|
36
|
+
renameSync(temporary, path);
|
|
37
|
+
} catch {
|
|
38
|
+
rmSync(temporary, { force: true });
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { isStagingOwnerRunning, STAGING_SUFFIX, writeAtomically };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Rollup } from "vite";
|
|
2
|
+
import { outputRootUrlExpression } from "./banner.js";
|
|
3
|
+
import { XDG_DATA_DIRS_DEFAULT } from "./xdg-data-dirs.js";
|
|
4
|
+
|
|
5
|
+
const xdgDataDirsBanner = (chunk: Rollup.RenderedChunk): string => [
|
|
6
|
+
"globalThis.process.env.XDG_DATA_DIRS = (() => {",
|
|
7
|
+
` const root = ${outputRootUrlExpression(chunk)};`,
|
|
8
|
+
` const dirs = globalThis.process.env.XDG_DATA_DIRS || ${JSON.stringify(XDG_DATA_DIRS_DEFAULT)};`,
|
|
9
|
+
" return dirs.split(\":\").includes(root) ? dirs : `${root}:${dirs}`;",
|
|
10
|
+
"})();",
|
|
11
|
+
].join("\n");
|
|
12
|
+
|
|
13
|
+
export { xdgDataDirsBanner };
|
package/src/mcp/client.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as Gio from "@gtkx/gi/gio";
|
|
2
2
|
import * as Gtk from "@gtkx/gi/gtk";
|
|
3
3
|
import {
|
|
4
|
-
DEFAULT_SOCKET_PATH,
|
|
5
4
|
isConnectionClosedError,
|
|
6
5
|
type JSONRPCRequest,
|
|
7
6
|
ProtocolConnection,
|
|
7
|
+
resolveMcpSocketPath,
|
|
8
8
|
type Result,
|
|
9
9
|
} from "@gtkx/mcp/internal";
|
|
10
10
|
import { error, errorMessage, info, normalizeError } from "@gtkx/utils";
|
|
@@ -65,7 +65,7 @@ class McpClient {
|
|
|
65
65
|
private registry = new WidgetRegistry();
|
|
66
66
|
|
|
67
67
|
constructor(options: McpClientOptions) {
|
|
68
|
-
this.socketPath = options.socketPath
|
|
68
|
+
this.socketPath = resolveMcpSocketPath(options.socketPath);
|
|
69
69
|
this.applicationId = options.applicationId;
|
|
70
70
|
}
|
|
71
71
|
|
package/src/settings/schema.ts
CHANGED
|
@@ -11,8 +11,9 @@ import {
|
|
|
11
11
|
} from "node:fs";
|
|
12
12
|
import { tmpdir } from "node:os";
|
|
13
13
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
14
|
+
import type { SourceImport } from "../internal/source-imports.js";
|
|
14
15
|
import { I18N_TYPES_FILENAME, i18nTypesPath } from "../i18n/types.js";
|
|
15
|
-
import {
|
|
16
|
+
import { discoverProjectImports } from "../internal/import-scan.js";
|
|
16
17
|
import { removeTempDir } from "../internal/staging-dir.js";
|
|
17
18
|
import {
|
|
18
19
|
isBareRelativeAsset,
|
|
@@ -30,7 +31,6 @@ type SchemaEnvResult = {
|
|
|
30
31
|
|
|
31
32
|
const SCHEMA_SUFFIX = ".gschema.xml";
|
|
32
33
|
const STAGED_NAME_LENGTH = 16;
|
|
33
|
-
const SOURCE_DIR = "src";
|
|
34
34
|
const RESOURCE_QUERY = "?resource=";
|
|
35
35
|
const ICON_QUERY = "?icon=";
|
|
36
36
|
|
|
@@ -69,12 +69,6 @@ const projectRelativeSchemaPath = (root: string, filePath: string): string | nul
|
|
|
69
69
|
|
|
70
70
|
const getRelativeModuleSpecifier = (filePath: string): string => `*/${basename(filePath)}`;
|
|
71
71
|
|
|
72
|
-
const sourceDirFor = (root: string): string => {
|
|
73
|
-
const sourceDir = join(root, SOURCE_DIR);
|
|
74
|
-
|
|
75
|
-
return existsSync(sourceDir) ? sourceDir : root;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
72
|
const isRelativeImport = (source: string): boolean => source.startsWith("./") || source.startsWith("../");
|
|
79
73
|
|
|
80
74
|
const schemaFileFor = ({ importer, source }: SourceImport): string | null =>
|
|
@@ -184,7 +178,7 @@ const assertUniqueSchemaBasenames = (schemaFiles: string[]): void => {
|
|
|
184
178
|
};
|
|
185
179
|
|
|
186
180
|
const stageAndCompileProjectSchemas = (root: string): string | null => {
|
|
187
|
-
const imports =
|
|
181
|
+
const imports = discoverProjectImports(root);
|
|
188
182
|
const schemaFiles = findImportedSchemaFiles(imports);
|
|
189
183
|
assertUniqueSchemaBasenames(schemaFiles);
|
|
190
184
|
|
|
@@ -257,7 +251,7 @@ const didWriteChanges = (path: string, content: string): boolean => {
|
|
|
257
251
|
};
|
|
258
252
|
|
|
259
253
|
const emitSchemaEnv = (rootDir: string): SchemaEnvResult => {
|
|
260
|
-
const imports =
|
|
254
|
+
const imports = discoverProjectImports(rootDir);
|
|
261
255
|
const importedFiles = findImportedSchemaFiles(imports);
|
|
262
256
|
assertUniqueSchemaBasenames(importedFiles);
|
|
263
257
|
const imported = parseProjectSchemas(importedFiles, getRelativeModuleSpecifier);
|