@gtkx/cli 1.6.0 → 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 +47 -44
- 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 +49 -16
- package/dist/codegen/freshness.js.map +1 -1
- package/dist/codegen/reference.d.ts.map +1 -1
- package/dist/codegen/reference.js +2 -7
- package/dist/codegen/reference.js.map +1 -1
- package/dist/codegen/report.d.ts.map +1 -1
- package/dist/codegen/report.js +5 -16
- package/dist/codegen/report.js.map +1 -1
- package/dist/codegen/run-codegen.d.ts +9 -8
- package/dist/codegen/run-codegen.d.ts.map +1 -1
- package/dist/codegen/run-codegen.js +60 -113
- package/dist/codegen/run-codegen.js.map +1 -1
- package/dist/codegen/store-resolver.d.ts +3 -2
- package/dist/codegen/store-resolver.d.ts.map +1 -1
- package/dist/codegen/store-resolver.js +14 -20
- 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 +6 -15
- 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/copyright.d.ts.map +1 -1
- package/dist/deploy/freedesktop/copyright.js +2 -13
- package/dist/deploy/freedesktop/copyright.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/freedesktop/xml.d.ts.map +1 -1
- package/dist/deploy/freedesktop/xml.js +21 -25
- package/dist/deploy/freedesktop/xml.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/license.d.ts.map +1 -1
- package/dist/deploy/node-runtime/license.js +2 -9
- package/dist/deploy/node-runtime/license.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/notices/packages.d.ts.map +1 -1
- package/dist/deploy/notices/packages.js +3 -10
- package/dist/deploy/notices/packages.js.map +1 -1
- package/dist/deploy/payload/copy-tree.d.ts.map +1 -1
- package/dist/deploy/payload/copy-tree.js +3 -3
- package/dist/deploy/payload/copy-tree.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 +47 -8
- 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 +17 -17
- 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 +3 -19
- package/dist/deploy/settings/libraries.js.map +1 -1
- package/dist/deploy/settings/paths.d.ts +4 -3
- package/dist/deploy/settings/paths.d.ts.map +1 -1
- package/dist/deploy/settings/paths.js +118 -19
- package/dist/deploy/settings/paths.js.map +1 -1
- package/dist/deploy/settings/screenshots.d.ts.map +1 -1
- package/dist/deploy/settings/screenshots.js +6 -31
- package/dist/deploy/settings/screenshots.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 +17 -6
- package/dist/deploy/targets/flatpak-source.js.map +1 -1
- package/dist/deploy/targets/flatpak-sources.js +1 -1
- package/dist/deploy/targets/flatpak-sources.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 +11 -5
- 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/schema-dir.d.ts +1 -1
- package/dist/dev/schema-dir.d.ts.map +1 -1
- package/dist/dev/schema-dir.js +2 -4
- package/dist/dev/schema-dir.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 +12 -8
- package/dist/i18n/catalogs.js.map +1 -1
- package/dist/i18n/metadata-templates.d.ts.map +1 -1
- package/dist/i18n/metadata-templates.js +2 -1
- package/dist/i18n/metadata-templates.js.map +1 -1
- package/dist/i18n/source-messages.d.ts +5 -21
- package/dist/i18n/source-messages.d.ts.map +1 -1
- package/dist/i18n/source-messages.js +1037 -92
- package/dist/i18n/source-messages.js.map +1 -1
- package/dist/i18n/types.d.ts +6 -7
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/i18n/types.js +83 -96
- package/dist/i18n/types.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 +6 -5
- 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-path.d.ts.map +1 -1
- package/dist/internal/icon-path.js +5 -16
- package/dist/internal/icon-path.js.map +1 -1
- 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 +38 -49
- 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/render.d.ts +0 -1
- package/dist/settings/render.d.ts.map +1 -1
- package/dist/settings/render.js +1 -11
- package/dist/settings/render.js.map +1 -1
- package/dist/settings/schema.d.ts +2 -2
- package/dist/settings/schema.d.ts.map +1 -1
- package/dist/settings/schema.js +24 -70
- 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 +1 -2
- package/dist/vite-plugins/asset-imports.d.ts.map +1 -1
- package/dist/vite-plugins/asset-imports.js +36 -35
- package/dist/vite-plugins/asset-imports.js.map +1 -1
- package/dist/vite-plugins/asset-specifier.d.ts +5 -3
- package/dist/vite-plugins/asset-specifier.d.ts.map +1 -1
- package/dist/vite-plugins/asset-specifier.js +10 -4
- 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 +75 -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 +19 -7
- 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 +40 -102
- 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 +5 -7
- package/dist/vite-plugins/settings-worker-env.js.map +1 -1
- package/dist/vite-plugins/settings.d.ts +1 -2
- package/dist/vite-plugins/settings.d.ts.map +1 -1
- package/dist/vite-plugins/settings.js +32 -27
- 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 +25 -25
- 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 -14
- 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 +28 -17
- 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 +70 -17
- package/src/codegen/reference.ts +2 -8
- package/src/codegen/report.ts +5 -21
- package/src/codegen/run-codegen.ts +73 -160
- package/src/codegen/store-resolver.ts +16 -27
- 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 +6 -17
- package/src/deploy/depends.ts +30 -3
- package/src/deploy/download.ts +33 -24
- package/src/deploy/freedesktop/copyright.ts +2 -14
- package/src/deploy/freedesktop/metainfo.ts +73 -21
- package/src/deploy/freedesktop/validate.ts +80 -15
- package/src/deploy/freedesktop/xml.ts +24 -32
- 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/license.ts +2 -8
- package/src/deploy/node-runtime/sonames.ts +17 -0
- package/src/deploy/notices/node-runtime.ts +2 -2
- package/src/deploy/notices/packages.ts +3 -11
- package/src/deploy/payload/copy-tree.ts +3 -4
- package/src/deploy/payload/launcher.ts +20 -1
- package/src/deploy/payload/stage.ts +78 -11
- package/src/deploy/run-deploy.ts +227 -72
- package/src/deploy/settings/arch.ts +40 -8
- package/src/deploy/settings/build-manifest.ts +30 -17
- package/src/deploy/settings/extra-files.ts +30 -4
- package/src/deploy/settings/index.ts +7 -2
- package/src/deploy/settings/libraries.ts +2 -22
- package/src/deploy/settings/paths.ts +78 -21
- package/src/deploy/settings/screenshots.ts +8 -46
- package/src/deploy/targets/appimage.ts +1 -0
- package/src/deploy/targets/flatpak-pnpm.ts +4 -4
- package/src/deploy/targets/flatpak-source.ts +19 -6
- package/src/deploy/targets/flatpak-sources.ts +1 -1
- 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 +13 -5
- package/src/dev/runner.ts +37 -7
- package/src/dev/schema-dir.ts +2 -4
- 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 +23 -9
- package/src/i18n/metadata-templates.ts +2 -1
- package/src/i18n/source-messages.ts +1641 -262
- package/src/i18n/types.ts +97 -131
- 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 +11 -5
- 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-path.ts +6 -19
- 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 +64 -55
- 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/render.ts +1 -13
- package/src/settings/schema.ts +23 -91
- package/src/vite-plugins/asset-extensions.ts +2 -0
- package/src/vite-plugins/asset-imports.ts +39 -45
- package/src/vite-plugins/asset-specifier.ts +17 -5
- 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 +123 -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 +36 -13
- 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 +47 -144
- package/src/vite-plugins/self-contained.ts +184 -185
- package/src/vite-plugins/settings-worker-env.ts +5 -7
- package/src/vite-plugins/settings.ts +44 -33
- package/src/vite-plugins/store-links.ts +10 -5
- package/src/vite-plugins/undeclared-library.ts +30 -32
- package/src/vite-plugins/worker.ts +31 -16
- package/src/vitest-plugin.ts +12 -8
- package/dist/i18n/binding-extractor.d.ts +0 -30
- package/dist/i18n/binding-extractor.d.ts.map +0 -1
- package/dist/i18n/binding-extractor.js +0 -1324
- package/dist/i18n/binding-extractor.js.map +0 -1
- package/dist/i18n/extractor-plugin.d.ts +0 -8
- package/dist/i18n/extractor-plugin.d.ts.map +0 -1
- package/dist/i18n/extractor-plugin.js +0 -247
- package/dist/i18n/extractor-plugin.js.map +0 -1
- package/dist/internal/data-dir.d.ts +0 -4
- package/dist/internal/data-dir.d.ts.map +0 -1
- package/dist/internal/data-dir.js +0 -52
- package/dist/internal/data-dir.js.map +0 -1
- package/dist/vite-plugins/animated.d.ts +0 -5
- package/dist/vite-plugins/animated.d.ts.map +0 -1
- package/dist/vite-plugins/animated.js +0 -325
- package/dist/vite-plugins/animated.js.map +0 -1
- package/src/i18n/binding-extractor.ts +0 -1969
- package/src/i18n/extractor-plugin.ts +0 -413
- package/src/internal/data-dir.ts +0 -70
- package/src/vite-plugins/animated.ts +0 -486
|
@@ -14,6 +14,13 @@ const cwdArg: { cwd: StringArgDef } = {
|
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
const configArg: { config: StringArgDef } = {
|
|
18
|
+
config: {
|
|
19
|
+
type: "string",
|
|
20
|
+
description: "Project-relative configuration file (default: gtkx.config.*)",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
17
24
|
const entryArg: { entry: PositionalArgDef; cwd: StringArgDef } = {
|
|
18
25
|
entry: {
|
|
19
26
|
type: "positional",
|
|
@@ -57,4 +64,4 @@ const resolveGivenEntry = (cwd: string, entry: string): string => {
|
|
|
57
64
|
const resolveEntry = (cwd: string, entry: string | undefined): string =>
|
|
58
65
|
entry ? resolveGivenEntry(cwd, entry) : resolveDefaultEntry(cwd);
|
|
59
66
|
|
|
60
|
-
export { cwdArg, entryArg, resolveCwd, resolveEntry };
|
|
67
|
+
export { configArg, cwdArg, entryArg, resolveCwd, resolveEntry };
|
package/src/internal/errors.ts
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { basename, extname } from "node:path";
|
|
3
|
+
|
|
4
|
+
const FONTS_DIR = "fonts";
|
|
5
|
+
const DIGEST_LENGTH = 8;
|
|
6
|
+
|
|
7
|
+
const fontFileName = (sourcePath: string, content: Buffer): string => {
|
|
8
|
+
const extension = extname(sourcePath).toLowerCase();
|
|
9
|
+
const stem = basename(sourcePath, extname(sourcePath));
|
|
10
|
+
const digest = createHash("sha1").update(content).digest("hex").slice(0, DIGEST_LENGTH);
|
|
11
|
+
|
|
12
|
+
return `${stem}-${digest}${extension}`;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { fontFileName, FONTS_DIR };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { sortStrings } from "@gtkx/utils";
|
|
2
|
+
import { lstatSync, mkdirSync, readFileSync, symlinkSync } from "node:fs";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
5
|
+
import { parseFontSpecifier } from "../vite-plugins/asset-specifier.js";
|
|
6
|
+
import { fontFileName, FONTS_DIR } from "./font-path.js";
|
|
7
|
+
import { discoverSourceFiles, importsIn, type SourceImport, sourceLanguage } from "./source-imports.js";
|
|
8
|
+
import { createRetainedStagingDir } from "./staging-dir.js";
|
|
9
|
+
|
|
10
|
+
type FontStagingStatus = "absent" | "staged" | "unmanaged";
|
|
11
|
+
|
|
12
|
+
const FONT_DIR_ENV = "GTKX_DEV_FONT_DIR";
|
|
13
|
+
const FONT_QUERY = "?font";
|
|
14
|
+
const fontStaging = createRetainedStagingDir("fonts");
|
|
15
|
+
|
|
16
|
+
const isRelativeImport = (source: string): boolean => source.startsWith("./") || source.startsWith("../");
|
|
17
|
+
|
|
18
|
+
const existingPath = (path: string): string | null =>
|
|
19
|
+
lstatSync(path, { throwIfNoEntry: false }) === undefined ? null : path;
|
|
20
|
+
|
|
21
|
+
const resolveRelativeImport = (importer: string, assetSource: string): string | null =>
|
|
22
|
+
existingPath(resolve(dirname(importer), assetSource));
|
|
23
|
+
|
|
24
|
+
const resolveAbsoluteImport = (root: string, assetSource: string): string | null =>
|
|
25
|
+
existingPath(assetSource) ?? existingPath(join(root, assetSource));
|
|
26
|
+
|
|
27
|
+
const resolvePackageImport = (importer: string, assetSource: string): string | null => {
|
|
28
|
+
try {
|
|
29
|
+
return createRequire(importer).resolve(assetSource);
|
|
30
|
+
} catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const resolveFontImport = (root: string, importer: string, assetSource: string): string | null => {
|
|
36
|
+
if (isRelativeImport(assetSource)) {
|
|
37
|
+
return resolveRelativeImport(importer, assetSource);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (isAbsolute(assetSource)) {
|
|
41
|
+
return resolveAbsoluteImport(root, assetSource);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return resolvePackageImport(importer, assetSource);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const fontFileFor = (root: string, { importer, source }: SourceImport): string | null => {
|
|
48
|
+
const specifier = parseFontSpecifier(source);
|
|
49
|
+
|
|
50
|
+
return specifier === null ? null : resolveFontImport(root, importer, specifier.assetSource);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const hasFontImportMention = (filePath: string): boolean => {
|
|
54
|
+
if (sourceLanguage(filePath) === undefined) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
return readFileSync(filePath, "utf8").includes(FONT_QUERY);
|
|
60
|
+
} catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const projectFontFiles = (root: string): string[] => {
|
|
66
|
+
const files = discoverSourceFiles(root)
|
|
67
|
+
.filter((path) => hasFontImportMention(path))
|
|
68
|
+
.flatMap((path) => importsIn(path))
|
|
69
|
+
.map((entry) => fontFileFor(root, entry))
|
|
70
|
+
.filter((path): path is string => path !== null);
|
|
71
|
+
|
|
72
|
+
return sortStrings(new Set(files));
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const stagedPath = (fontsDir: string, sourcePath: string, content: Buffer): string =>
|
|
76
|
+
join(fontsDir, fontFileName(sourcePath, content));
|
|
77
|
+
|
|
78
|
+
const stageFont = (fontsDir: string, sourcePath: string): void => {
|
|
79
|
+
const target = stagedPath(fontsDir, sourcePath, readFileSync(sourcePath));
|
|
80
|
+
|
|
81
|
+
if (existingPath(target) !== null) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
symlinkSync(sourcePath, target, "file");
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const stagedFontsDir = (): string | null => {
|
|
89
|
+
const shareDir = process.env[FONT_DIR_ENV];
|
|
90
|
+
|
|
91
|
+
return shareDir === undefined || shareDir.length === 0 ? null : join(shareDir, FONTS_DIR);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const stagedFontStatus = (sourcePath: string, content: Buffer): FontStagingStatus => {
|
|
95
|
+
const fontsDir = stagedFontsDir();
|
|
96
|
+
|
|
97
|
+
if (fontsDir === null) {
|
|
98
|
+
return "unmanaged";
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return existingPath(stagedPath(fontsDir, sourcePath, content)) === null ? "absent" : "staged";
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const isUnstagedFont = (fontsDir: string, sourcePath: string): boolean =>
|
|
105
|
+
existingPath(stagedPath(fontsDir, sourcePath, readFileSync(sourcePath))) === null;
|
|
106
|
+
|
|
107
|
+
const hasUnstagedFontImport = (root: string, filePath: string): boolean => {
|
|
108
|
+
const fontsDir = stagedFontsDir();
|
|
109
|
+
|
|
110
|
+
if (fontsDir === null || !hasFontImportMention(filePath)) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return projectFontFiles(root).some((sourcePath) => isUnstagedFont(fontsDir, sourcePath));
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const stageProjectFonts = (root: string): string => {
|
|
118
|
+
const shareDir = fontStaging.retain();
|
|
119
|
+
const fontsDir = join(shareDir, FONTS_DIR);
|
|
120
|
+
mkdirSync(fontsDir, { recursive: true });
|
|
121
|
+
|
|
122
|
+
for (const sourcePath of projectFontFiles(root)) {
|
|
123
|
+
stageFont(fontsDir, sourcePath);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
process.env[FONT_DIR_ENV] = shareDir;
|
|
127
|
+
|
|
128
|
+
return shareDir;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export { hasUnstagedFontImport, stagedFontStatus, stageProjectFonts };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { isPathInside } from "@gtkx/utils";
|
|
2
|
+
import { statSync } from "node:fs";
|
|
3
|
+
import { basename, extname, isAbsolute, join, resolve } from "node:path";
|
|
3
4
|
|
|
4
5
|
type ResolvedApplicationIcon = { kind: "file"; path: string } |
|
|
5
6
|
{ kind: "none" } |
|
|
@@ -10,20 +11,6 @@ const SCALABLE_DIR = "hicolor/scalable/apps";
|
|
|
10
11
|
const SIZE_PATTERN = /^(?<width>[1-9]\d{0,3})x(?<height>[1-9]\d{0,3})$/;
|
|
11
12
|
const SIZE_SEPARATORS = /[-_.]/;
|
|
12
13
|
|
|
13
|
-
const isInside = (parent: string, candidate: string): boolean => {
|
|
14
|
-
const rel = relative(parent, candidate);
|
|
15
|
-
|
|
16
|
-
return rel.length > 0 && !rel.startsWith("..") && !isAbsolute(rel);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const getStats = (path: string): Stats | undefined => {
|
|
20
|
-
try {
|
|
21
|
-
return statSync(path, { throwIfNoEntry: false });
|
|
22
|
-
} catch {
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
14
|
const iconExtension = (file: string): string => {
|
|
28
15
|
const extension = extname(file).toLowerCase();
|
|
29
16
|
|
|
@@ -37,7 +24,7 @@ const iconExtension = (file: string): string => {
|
|
|
37
24
|
const defaultIconFiles = (root: string, applicationId: string): string[] =>
|
|
38
25
|
[...ICON_EXTENSIONS]
|
|
39
26
|
.map((extension) => join(root, `${applicationId}${extension}`))
|
|
40
|
-
.filter((path) =>
|
|
27
|
+
.filter((path) => statSync(path, { throwIfNoEntry: false })?.isFile() === true);
|
|
41
28
|
|
|
42
29
|
const resolveDefaultApplicationIcon = (root: string, applicationId: string): ResolvedApplicationIcon => {
|
|
43
30
|
const files = defaultIconFiles(root, applicationId);
|
|
@@ -76,11 +63,11 @@ const resolveApplicationIcon = (
|
|
|
76
63
|
|
|
77
64
|
const path = resolve(root, configured);
|
|
78
65
|
|
|
79
|
-
if (!
|
|
66
|
+
if (!isPathInside(root, path)) {
|
|
80
67
|
throw new Error(`Cannot use "${configured}" as the application icon: it is outside ${root}`);
|
|
81
68
|
}
|
|
82
69
|
|
|
83
|
-
const stats =
|
|
70
|
+
const stats = statSync(path, { throwIfNoEntry: false });
|
|
84
71
|
|
|
85
72
|
if (stats?.isDirectory() === true) {
|
|
86
73
|
return { kind: "theme", path };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { mkdirSync, rmSync, symlinkSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { relativeIconPath, resolveApplicationIcon, type ResolvedApplicationIcon } from "./icon-path.js";
|
|
4
|
+
import { createRetainedStagingDir, type RetainedStagingDir } from "./staging-dir.js";
|
|
5
|
+
|
|
6
|
+
const ICONS_DIR = "icons";
|
|
7
|
+
const stagingDirs: Map<string, RetainedStagingDir> = new Map();
|
|
8
|
+
|
|
9
|
+
const stagingFor = (root: string): RetainedStagingDir => {
|
|
10
|
+
const existing = stagingDirs.get(root);
|
|
11
|
+
|
|
12
|
+
if (existing !== undefined) {
|
|
13
|
+
return existing;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const staging = createRetainedStagingDir("icons");
|
|
17
|
+
stagingDirs.set(root, staging);
|
|
18
|
+
|
|
19
|
+
return staging;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const resetIconsDir = (shareDir: string): string => {
|
|
23
|
+
const iconsDir = join(shareDir, ICONS_DIR);
|
|
24
|
+
rmSync(iconsDir, { recursive: true, force: true });
|
|
25
|
+
|
|
26
|
+
return iconsDir;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const stageIconSource = (
|
|
30
|
+
iconsDir: string,
|
|
31
|
+
applicationId: string,
|
|
32
|
+
source: Exclude<ResolvedApplicationIcon, { kind: "none" }>,
|
|
33
|
+
): void => {
|
|
34
|
+
if (source.kind === "theme") {
|
|
35
|
+
symlinkSync(source.path, iconsDir, "dir");
|
|
36
|
+
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const target = join(iconsDir, relativeIconPath(applicationId, source.path));
|
|
41
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
42
|
+
symlinkSync(source.path, target, "file");
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const stageProjectIcons = (root: string, applicationId: string, configured: string | undefined): string | null => {
|
|
46
|
+
const source = resolveApplicationIcon(root, applicationId, configured);
|
|
47
|
+
|
|
48
|
+
if (source.kind === "none") {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const shareDir = stagingFor(root).retain();
|
|
53
|
+
stageIconSource(resetIconsDir(shareDir), applicationId, source);
|
|
54
|
+
|
|
55
|
+
return shareDir;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export { stageProjectIcons };
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { isRecord } from "@gtkx/utils";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync } from "node:fs";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
import { basename, dirname, join } from "node:path";
|
|
6
|
+
import packageManifest from "../../package.json" with { type: "json" };
|
|
7
|
+
import { moduleHash } from "./module-hash.js";
|
|
8
|
+
import {
|
|
9
|
+
discoverSourceFiles,
|
|
10
|
+
importSourcesIn,
|
|
11
|
+
readSource,
|
|
12
|
+
sortSourceImports,
|
|
13
|
+
sourceDirFor,
|
|
14
|
+
type SourceImport,
|
|
15
|
+
} from "./source-imports.js";
|
|
16
|
+
import { isStagingOwnerRunning, STAGING_SUFFIX, writeAtomically } from "./staging-file.js";
|
|
17
|
+
|
|
18
|
+
type ScannedFile = {
|
|
19
|
+
hash: string;
|
|
20
|
+
sources: string[];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type ScanIndex = Map<string, ScannedFile>;
|
|
24
|
+
|
|
25
|
+
type ScanCache = Map<string, ScanIndex>;
|
|
26
|
+
|
|
27
|
+
type ScanResult = {
|
|
28
|
+
index: ScanIndex;
|
|
29
|
+
isChanged: boolean;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const CACHE_FILE = ["node_modules", ".gtkx", "import-scan.json"];
|
|
33
|
+
const PARSER_MANIFEST = "vite/package.json";
|
|
34
|
+
const UNKNOWN_PARSER = "unknown";
|
|
35
|
+
const SCANNER_MODULES = ["source-imports", "import-scan"];
|
|
36
|
+
const identity: { value: string | undefined } = { value: undefined };
|
|
37
|
+
|
|
38
|
+
const scanCachePath = (root: string): string => join(root, ...CACHE_FILE);
|
|
39
|
+
|
|
40
|
+
const hashSource = (code: string): string => createHash("sha256").update(code).digest("hex");
|
|
41
|
+
|
|
42
|
+
const readJson = (path: string): unknown => {
|
|
43
|
+
try {
|
|
44
|
+
return JSON.parse(readFileSync(path, "utf8")) as unknown;
|
|
45
|
+
} catch {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const parserVersion = (): string => {
|
|
51
|
+
const manifest = readJson(createRequire(import.meta.url).resolve(PARSER_MANIFEST));
|
|
52
|
+
|
|
53
|
+
return isRecord(manifest) && typeof manifest.version === "string" ? manifest.version : UNKNOWN_PARSER;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const scannerHash = (): string =>
|
|
57
|
+
SCANNER_MODULES.map((name) => moduleHash(join(import.meta.dirname, name))).join("-");
|
|
58
|
+
|
|
59
|
+
const cacheVersion = (): string =>
|
|
60
|
+
(identity.value ??= `${packageManifest.version}+${parserVersion()}+${scannerHash()}`);
|
|
61
|
+
|
|
62
|
+
const isStringArray = (value: unknown): value is string[] =>
|
|
63
|
+
Array.isArray(value) && value.every((entry) => typeof entry === "string");
|
|
64
|
+
|
|
65
|
+
const scannedFile = (value: unknown): ScannedFile | null => {
|
|
66
|
+
if (!isRecord(value)) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const { hash, sources } = value;
|
|
71
|
+
|
|
72
|
+
return typeof hash === "string" && isStringArray(sources) ? { hash, sources } : null;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const scanIndexFrom = (value: unknown): ScanIndex => {
|
|
76
|
+
const index: ScanIndex = new Map();
|
|
77
|
+
|
|
78
|
+
if (!isRecord(value)) {
|
|
79
|
+
return index;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
for (const [file, entry] of Object.entries(value)) {
|
|
83
|
+
const scanned = scannedFile(entry);
|
|
84
|
+
|
|
85
|
+
if (scanned !== null) {
|
|
86
|
+
index.set(file, scanned);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return index;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const readCache = (path: string): ScanCache => {
|
|
94
|
+
const parsed = readJson(path);
|
|
95
|
+
const cache: ScanCache = new Map();
|
|
96
|
+
|
|
97
|
+
if (!isRecord(parsed) || parsed.version !== cacheVersion() || !isRecord(parsed.dirs)) {
|
|
98
|
+
return cache;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
for (const [dir, files] of Object.entries(parsed.dirs)) {
|
|
102
|
+
if (existsSync(dir)) {
|
|
103
|
+
cache.set(dir, scanIndexFrom(files));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return cache;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const pruneStaging = (path: string): void => {
|
|
111
|
+
const dir = dirname(path);
|
|
112
|
+
const prefix = `${basename(path)}.`;
|
|
113
|
+
|
|
114
|
+
let names: string[];
|
|
115
|
+
|
|
116
|
+
try {
|
|
117
|
+
names = readdirSync(dir);
|
|
118
|
+
} catch {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
for (const name of names) {
|
|
123
|
+
if (name.startsWith(prefix) && name.endsWith(STAGING_SUFFIX) && !isStagingOwnerRunning(name)) {
|
|
124
|
+
rmSync(join(dir, name), { force: true });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const cachePayload = (cache: ScanCache): unknown => ({
|
|
130
|
+
version: cacheVersion(),
|
|
131
|
+
dirs: Object.fromEntries([...cache].map(([dir, index]) => [dir, Object.fromEntries(index)])),
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const writeCache = (path: string, cache: ScanCache): void => {
|
|
135
|
+
try {
|
|
136
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
137
|
+
} catch {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
pruneStaging(path);
|
|
142
|
+
writeAtomically(path, JSON.stringify(cachePayload(cache)));
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/* eslint-disable-next-line unicorn/consistent-boolean-name -- the boolean reports whether the file was rescanned */
|
|
146
|
+
const scanFile = (path: string, previous: ScanIndex, index: ScanIndex): boolean => {
|
|
147
|
+
const code = readSource(path);
|
|
148
|
+
|
|
149
|
+
if (code === null) {
|
|
150
|
+
return previous.has(path);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const hash = hashSource(code);
|
|
154
|
+
const cached = previous.get(path);
|
|
155
|
+
|
|
156
|
+
if (cached?.hash === hash) {
|
|
157
|
+
index.set(path, cached);
|
|
158
|
+
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const sources = importSourcesIn(path, code);
|
|
163
|
+
|
|
164
|
+
if (sources === null) {
|
|
165
|
+
return previous.has(path);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
index.set(path, { hash, sources });
|
|
169
|
+
|
|
170
|
+
return true;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const scanSourceDir = (dir: string, previous: ScanIndex): ScanResult => {
|
|
174
|
+
const index: ScanIndex = new Map();
|
|
175
|
+
let isChanged = false;
|
|
176
|
+
|
|
177
|
+
for (const path of discoverSourceFiles(dir)) {
|
|
178
|
+
if (scanFile(path, previous, index)) {
|
|
179
|
+
isChanged = true;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return { index, isChanged: isChanged || index.size !== previous.size };
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const toSourceImports = (index: ScanIndex): SourceImport[] =>
|
|
187
|
+
sortSourceImports(
|
|
188
|
+
[...index].flatMap(([importer, { sources }]) => sources.map((source) => ({ importer, source }))),
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
const discoverProjectImports = (root: string): SourceImport[] => {
|
|
192
|
+
const dir = sourceDirFor(root);
|
|
193
|
+
const path = scanCachePath(root);
|
|
194
|
+
const cache = readCache(path);
|
|
195
|
+
const previous = cache.get(dir) ?? new Map<string, ScannedFile>();
|
|
196
|
+
const { index, isChanged } = scanSourceDir(dir, previous);
|
|
197
|
+
|
|
198
|
+
if (isChanged || !cache.has(dir)) {
|
|
199
|
+
cache.set(dir, index);
|
|
200
|
+
writeCache(path, cache);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return toSourceImports(index);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export { discoverProjectImports };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
|
|
4
|
+
const MODULE_EXTENSIONS = [".js", ".ts"];
|
|
5
|
+
const MODULE_HASH_LENGTH = 16;
|
|
6
|
+
const UNKNOWN_MODULE = "unknown";
|
|
7
|
+
|
|
8
|
+
const moduleHash = (base: string): string => {
|
|
9
|
+
for (const extension of MODULE_EXTENSIONS) {
|
|
10
|
+
try {
|
|
11
|
+
const contents = readFileSync(`${base}${extension}`);
|
|
12
|
+
|
|
13
|
+
return createHash("sha256").update(contents).digest("hex").slice(0, MODULE_HASH_LENGTH);
|
|
14
|
+
} catch {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return UNKNOWN_MODULE;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { moduleHash };
|