@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
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import type { Plugin, Rollup } from "vite";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { parseSync } from "vite";
|
|
4
|
+
import type { AssetEmitter } from "./asset-emitter.js";
|
|
5
|
+
import { prependBanner } from "../internal/banner.js";
|
|
6
|
+
import { fontFileName, FONTS_DIR } from "../internal/font-path.js";
|
|
7
|
+
import { stagedFontStatus } from "../internal/font-staging.js";
|
|
8
|
+
import { SOURCE_ID_RE, sourceLanguage } from "../internal/source-imports.js";
|
|
9
|
+
import { xdgDataDirsBanner } from "../internal/xdg-banner.js";
|
|
10
|
+
import { parseFontSpecifier } from "./asset-specifier.js";
|
|
11
|
+
import { fontFamilyNames } from "./font-name.js";
|
|
12
|
+
import { stripQuery } from "./strip-query.js";
|
|
13
|
+
import { createVirtualNamespace } from "./virtual-module.js";
|
|
14
|
+
|
|
15
|
+
type PluginState = {
|
|
16
|
+
isBuild: boolean;
|
|
17
|
+
root: string;
|
|
18
|
+
emitted: Set<string>;
|
|
19
|
+
importers: Map<string, string>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type ResolveContext = Parameters<typeof resolveToVirtual>[0];
|
|
23
|
+
type ResolveRequest = Parameters<typeof resolveToVirtual>[1];
|
|
24
|
+
|
|
25
|
+
type RetainedFontModuleId = {
|
|
26
|
+
id: string;
|
|
27
|
+
moduleSideEffects: true;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type LoadContext = AssetEmitter & {
|
|
31
|
+
addWatchFile: (file: string) => void;
|
|
32
|
+
error: (message: string) => never;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const FONT_QUERY = "?font";
|
|
36
|
+
const FONT_ID_RE = /\?font$/;
|
|
37
|
+
const VIRTUAL_PREFIX = "\0gtkx-font:";
|
|
38
|
+
const VIRTUAL_ID_RE = new RegExp(`^${VIRTUAL_PREFIX}`);
|
|
39
|
+
const { isVirtual, fromVirtualId, resolveToVirtual } = createVirtualNamespace(VIRTUAL_PREFIX);
|
|
40
|
+
|
|
41
|
+
const unreadableFontError = (filePath: string): string =>
|
|
42
|
+
`Cannot read a font family name from ${filePath}; ?font expects a TrueType, OpenType, ` +
|
|
43
|
+
"TrueType Collection, WOFF, or WOFF2 font";
|
|
44
|
+
|
|
45
|
+
const unstagedFontError = (filePath: string, importer: string): string =>
|
|
46
|
+
`${filePath} was not staged before the toolkit started, so ${importer} would resolve its family to a ` +
|
|
47
|
+
"fallback font. Fonts are staged from ?font imports found in source files under the project root; move " +
|
|
48
|
+
"the import there, or restart to pick it up.";
|
|
49
|
+
|
|
50
|
+
const resolveFontId = async (
|
|
51
|
+
ctx: ResolveContext,
|
|
52
|
+
state: PluginState,
|
|
53
|
+
request: ResolveRequest,
|
|
54
|
+
): Promise<RetainedFontModuleId | undefined> => {
|
|
55
|
+
if (parseFontSpecifier(request.source) === null) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const virtualId = await resolveToVirtual(ctx, request);
|
|
60
|
+
|
|
61
|
+
if (virtualId === undefined) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
state.importers.set(virtualId, request.importer ?? state.root);
|
|
66
|
+
|
|
67
|
+
return { id: virtualId, moduleSideEffects: true };
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const emitFont = (ctx: LoadContext, state: PluginState, filePath: string, content: Buffer): void => {
|
|
71
|
+
const fileName = `${FONTS_DIR}/${fontFileName(filePath, content)}`;
|
|
72
|
+
|
|
73
|
+
if (state.emitted.has(fileName)) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
state.emitted.add(fileName);
|
|
78
|
+
ctx.emitFile({ type: "asset", fileName, source: content });
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const loadFontModule = (ctx: LoadContext, state: PluginState, id: string): string | undefined => {
|
|
82
|
+
if (!isVirtual(id)) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const filePath = stripQuery(fromVirtualId(id));
|
|
87
|
+
const content = readFileSync(filePath);
|
|
88
|
+
const [family] = fontFamilyNames(content);
|
|
89
|
+
|
|
90
|
+
if (family === undefined) {
|
|
91
|
+
return ctx.error(unreadableFontError(filePath));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
ctx.addWatchFile(filePath);
|
|
95
|
+
|
|
96
|
+
if (state.isBuild) {
|
|
97
|
+
emitFont(ctx, state, filePath, content);
|
|
98
|
+
} else if (stagedFontStatus(filePath, content) === "absent") {
|
|
99
|
+
return ctx.error(unstagedFontError(filePath, state.importers.get(id) ?? state.root));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return `export default ${JSON.stringify(family)};`;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const hasSideEffectFontImport = (code: string, id: string): boolean => {
|
|
106
|
+
const lang = sourceLanguage(stripQuery(id));
|
|
107
|
+
|
|
108
|
+
if (lang === undefined || !code.includes(FONT_QUERY)) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const parsed = parseSync(id, code, { lang });
|
|
113
|
+
|
|
114
|
+
if (parsed.errors.length > 0) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return parsed.module.staticImports.some(
|
|
119
|
+
(statement) => statement.entries.length === 0 && parseFontSpecifier(statement.moduleRequest.value) !== null,
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const retainSideEffectFontImport = (
|
|
124
|
+
code: string,
|
|
125
|
+
id: string,
|
|
126
|
+
): { code: string; moduleSideEffects: true } | null =>
|
|
127
|
+
hasSideEffectFontImport(code, id)
|
|
128
|
+
? { code, moduleSideEffects: true }
|
|
129
|
+
: null;
|
|
130
|
+
|
|
131
|
+
const fontBanner = (state: PluginState) => (chunk: Rollup.RenderedChunk): string =>
|
|
132
|
+
state.emitted.size === 0 ? "" : xdgDataDirsBanner(chunk);
|
|
133
|
+
|
|
134
|
+
function gtkxFont(): Plugin {
|
|
135
|
+
const state: PluginState = { isBuild: false, root: "", emitted: new Set(), importers: new Map() };
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
name: "gtkx:font",
|
|
139
|
+
enforce: "pre",
|
|
140
|
+
|
|
141
|
+
configResolved(config) {
|
|
142
|
+
state.isBuild = config.command === "build";
|
|
143
|
+
state.root = config.root;
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
resolveId: {
|
|
147
|
+
filter: { id: FONT_ID_RE },
|
|
148
|
+
|
|
149
|
+
handler(source, importer, options) {
|
|
150
|
+
return resolveFontId(this, state, { source, importer, options });
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
load: {
|
|
155
|
+
filter: { id: VIRTUAL_ID_RE },
|
|
156
|
+
|
|
157
|
+
handler(id) {
|
|
158
|
+
return loadFontModule(this, state, id);
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
transform: {
|
|
163
|
+
filter: { id: SOURCE_ID_RE, code: FONT_QUERY },
|
|
164
|
+
|
|
165
|
+
handler(code, id) {
|
|
166
|
+
return retainSideEffectFontImport(code, id);
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
outputOptions(options) {
|
|
171
|
+
if (!state.isBuild) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return prependBanner(options, fontBanner(state));
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export { gtkxFont };
|
package/src/vite-plugins/i18n.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ConfigLoader } from "@gtkx/config";
|
|
2
2
|
import type { Plugin, ResolvedConfig } from "vite";
|
|
3
3
|
import { createConfigLoader } from "@gtkx/config/internal";
|
|
4
|
+
import { isPathWithin, logger, toPosixPath } from "@gtkx/utils";
|
|
4
5
|
import { existsSync, mkdirSync } from "node:fs";
|
|
5
6
|
import { createRequire } from "node:module";
|
|
6
7
|
import { dirname, join, posix, relative, resolve } from "node:path";
|
|
@@ -10,16 +11,31 @@ import {
|
|
|
10
11
|
LOCALE_DIRNAME,
|
|
11
12
|
resolveCatalogProject,
|
|
12
13
|
synchronizeCatalogs,
|
|
14
|
+
type WrittenCatalog,
|
|
13
15
|
} from "../i18n/catalogs.js";
|
|
14
|
-
import { extractSourceCatalog } from "../i18n/source-messages.js";
|
|
15
|
-
import {
|
|
16
|
+
import { extractSourceCatalog, SourceExtractionError } from "../i18n/source-messages.js";
|
|
17
|
+
import { emitI18nTypes } from "../i18n/types.js";
|
|
18
|
+
import { discoverSourceFiles, sourceLanguage } from "../internal/source-imports.js";
|
|
16
19
|
import { stripQuery } from "./strip-query.js";
|
|
17
20
|
|
|
21
|
+
type CatalogWriteListener = (catalogs: WrittenCatalog[]) => void;
|
|
22
|
+
|
|
23
|
+
type I18nPluginOptions = {
|
|
24
|
+
entryPath: string;
|
|
25
|
+
loadConfig?: ConfigLoader | undefined;
|
|
26
|
+
onCatalogsWritten?: CatalogWriteListener | undefined;
|
|
27
|
+
shouldPreserveMetadataMessages?: boolean | undefined;
|
|
28
|
+
shouldRecoverExtractionErrors?: boolean | undefined;
|
|
29
|
+
};
|
|
30
|
+
|
|
18
31
|
type I18nState = {
|
|
19
32
|
entryPath: string;
|
|
20
33
|
i18nRoot: string;
|
|
21
34
|
outDir: string;
|
|
22
35
|
project: CatalogProject | null;
|
|
36
|
+
extraction: Promise<void>;
|
|
37
|
+
hotUpdateTimestamp: number | null;
|
|
38
|
+
onCatalogsWritten: CatalogWriteListener;
|
|
23
39
|
};
|
|
24
40
|
|
|
25
41
|
const BOOTSTRAP_SPECIFIER = "@gtkx/i18n/bootstrap";
|
|
@@ -32,7 +48,7 @@ const isI18nLocaleModule = (state: I18nState, id: string): boolean => {
|
|
|
32
48
|
return false;
|
|
33
49
|
}
|
|
34
50
|
|
|
35
|
-
const path = relative(state.i18nRoot, stripQuery(id))
|
|
51
|
+
const path = toPosixPath(relative(state.i18nRoot, stripQuery(id)));
|
|
36
52
|
|
|
37
53
|
return LOCALE_MODULE_PATHS.has(path);
|
|
38
54
|
};
|
|
@@ -93,6 +109,7 @@ const buildCatalogs = (state: I18nState): void => {
|
|
|
93
109
|
const extractProjectMessages = async (
|
|
94
110
|
state: I18nState,
|
|
95
111
|
shouldPreserveMetadataMessages: boolean,
|
|
112
|
+
shouldSynchronizeCatalogs: boolean,
|
|
96
113
|
): Promise<void> => {
|
|
97
114
|
const project = state.project;
|
|
98
115
|
|
|
@@ -103,15 +120,98 @@ const extractProjectMessages = async (
|
|
|
103
120
|
const srcDir = join(project.root, "src");
|
|
104
121
|
const sourceFiles = discoverSourceFiles(existsSync(srcDir) ? srcDir : project.root);
|
|
105
122
|
await extractSourceCatalog(project, sourceFiles, shouldPreserveMetadataMessages);
|
|
106
|
-
|
|
123
|
+
|
|
124
|
+
if (shouldSynchronizeCatalogs) {
|
|
125
|
+
state.onCatalogsWritten(synchronizeCatalogs(project));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
await emitI18nTypes(project.root);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const settleExtraction = async (pending: Promise<void>): Promise<void> => {
|
|
132
|
+
try {
|
|
133
|
+
await pending;
|
|
134
|
+
} catch {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const queueExtraction = (
|
|
140
|
+
state: I18nState,
|
|
141
|
+
shouldPreserveMetadataMessages: boolean,
|
|
142
|
+
shouldSynchronizeCatalogs: boolean,
|
|
143
|
+
): Promise<void> => {
|
|
144
|
+
const prior = state.extraction;
|
|
145
|
+
const pending = (async (): Promise<void> => {
|
|
146
|
+
await settleExtraction(prior);
|
|
147
|
+
await extractProjectMessages(
|
|
148
|
+
state,
|
|
149
|
+
shouldPreserveMetadataMessages,
|
|
150
|
+
shouldSynchronizeCatalogs,
|
|
151
|
+
);
|
|
152
|
+
})();
|
|
153
|
+
|
|
154
|
+
state.extraction = pending;
|
|
155
|
+
|
|
156
|
+
return pending;
|
|
107
157
|
};
|
|
108
158
|
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
159
|
+
const isProjectSource = (state: I18nState, path: string): boolean => {
|
|
160
|
+
const project = state.project;
|
|
161
|
+
|
|
162
|
+
if (project === null || sourceLanguage(path) === undefined) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const srcDir = join(project.root, "src");
|
|
167
|
+
const sourceRoot = existsSync(srcDir) ? srcDir : project.root;
|
|
168
|
+
|
|
169
|
+
return isPathWithin(sourceRoot, path);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const refreshProjectMessages = async (
|
|
173
|
+
state: I18nState,
|
|
174
|
+
shouldPreserveMetadataMessages: boolean,
|
|
175
|
+
shouldSynchronizeCatalogs = false,
|
|
176
|
+
): Promise<void> => {
|
|
177
|
+
try {
|
|
178
|
+
await queueExtraction(state, shouldPreserveMetadataMessages, shouldSynchronizeCatalogs);
|
|
179
|
+
} catch (error) {
|
|
180
|
+
logger.error(error instanceof Error ? error.message : String(error));
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const recoverInitialSourceExtraction = async (
|
|
185
|
+
state: I18nState,
|
|
186
|
+
shouldPreserveMetadataMessages: boolean,
|
|
187
|
+
): Promise<void> => {
|
|
188
|
+
try {
|
|
189
|
+
await queueExtraction(state, shouldPreserveMetadataMessages, true);
|
|
190
|
+
} catch (error) {
|
|
191
|
+
if (!(error instanceof SourceExtractionError)) {
|
|
192
|
+
throw error;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
logger.error(error.message);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const gtkxI18n = ({
|
|
200
|
+
entryPath,
|
|
201
|
+
loadConfig = createConfigLoader(),
|
|
202
|
+
onCatalogsWritten = (): void => undefined,
|
|
112
203
|
shouldPreserveMetadataMessages = true,
|
|
113
|
-
|
|
114
|
-
|
|
204
|
+
shouldRecoverExtractionErrors = false,
|
|
205
|
+
}: I18nPluginOptions): Plugin => {
|
|
206
|
+
const state: I18nState = {
|
|
207
|
+
entryPath,
|
|
208
|
+
extraction: Promise.resolve(),
|
|
209
|
+
hotUpdateTimestamp: null,
|
|
210
|
+
i18nRoot: "",
|
|
211
|
+
outDir: "",
|
|
212
|
+
project: null,
|
|
213
|
+
onCatalogsWritten,
|
|
214
|
+
};
|
|
115
215
|
|
|
116
216
|
return {
|
|
117
217
|
name: "gtkx:i18n",
|
|
@@ -119,7 +219,19 @@ const gtkxI18n = (
|
|
|
119
219
|
|
|
120
220
|
configResolved: (config) => applyResolvedConfig(state, config, loadConfig),
|
|
121
221
|
|
|
122
|
-
buildStart: () =>
|
|
222
|
+
buildStart: () => shouldRecoverExtractionErrors
|
|
223
|
+
? recoverInitialSourceExtraction(state, shouldPreserveMetadataMessages)
|
|
224
|
+
: queueExtraction(state, shouldPreserveMetadataMessages, true),
|
|
225
|
+
|
|
226
|
+
hotUpdate(options) {
|
|
227
|
+
if (!isProjectSource(state, options.file) || state.hotUpdateTimestamp === options.timestamp) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
state.hotUpdateTimestamp = options.timestamp;
|
|
232
|
+
|
|
233
|
+
return refreshProjectMessages(state, shouldPreserveMetadataMessages);
|
|
234
|
+
},
|
|
123
235
|
|
|
124
236
|
transform(code, id) {
|
|
125
237
|
if (isI18nLocaleModule(state, id)) {
|
|
@@ -143,4 +255,4 @@ const gtkxI18n = (
|
|
|
143
255
|
};
|
|
144
256
|
};
|
|
145
257
|
|
|
146
|
-
export { gtkxI18n };
|
|
258
|
+
export { type CatalogWriteListener, gtkxI18n };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { UserConfig } from "vite";
|
|
2
|
+
import type { Plugin } from "vitest/config";
|
|
3
|
+
import { createConfigLoader, viteProjectRoot } from "@gtkx/config/internal";
|
|
4
|
+
import { stageProjectIcons } from "../internal/icon-staging.js";
|
|
5
|
+
import { prependXdgDataDir } from "../internal/xdg-data-dirs.js";
|
|
6
|
+
|
|
7
|
+
function gtkxIconWorkerEnv(configFile?: string): Plugin {
|
|
8
|
+
const loadConfig = createConfigLoader({ configFile });
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
name: "gtkx:icon-worker-env",
|
|
12
|
+
enforce: "pre",
|
|
13
|
+
|
|
14
|
+
async config(config: UserConfig) {
|
|
15
|
+
const loaded = await loadConfig.load(viteProjectRoot(config));
|
|
16
|
+
|
|
17
|
+
const shareDir = stageProjectIcons(
|
|
18
|
+
loaded.root,
|
|
19
|
+
loaded.config.applicationId,
|
|
20
|
+
loaded.config.applicationIcon,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
if (shareDir === null) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const existing = config.test?.env?.XDG_DATA_DIRS ?? process.env.XDG_DATA_DIRS;
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
test: { env: { XDG_DATA_DIRS: prependXdgDataDir(shareDir, existing) } },
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { gtkxIconWorkerEnv };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ConfigLoader } from "@gtkx/config";
|
|
2
2
|
import type { Plugin, UserConfig } from "vite";
|
|
3
|
-
import { createConfigLoader } from "@gtkx/config/internal";
|
|
3
|
+
import { createConfigLoader, viteProjectRoot } from "@gtkx/config/internal";
|
|
4
4
|
import { info } from "@gtkx/utils";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { join } from "node:path";
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
type ResolvedApplicationIcon,
|
|
13
13
|
} from "../internal/icon-path.js";
|
|
14
14
|
import { type ListedFile, listFilesRecursive } from "../internal/list-files.js";
|
|
15
|
+
import { xdgDataDirsBanner } from "../internal/xdg-banner.js";
|
|
15
16
|
|
|
16
17
|
type PluginState = {
|
|
17
18
|
applicationId: string;
|
|
@@ -20,13 +21,6 @@ type PluginState = {
|
|
|
20
21
|
|
|
21
22
|
const ICONS_DIR = "icons";
|
|
22
23
|
|
|
23
|
-
const XDG_ENV_BANNER = [
|
|
24
|
-
"process.env.XDG_DATA_DIRS = [",
|
|
25
|
-
" decodeURIComponent(new URL(\".\", import.meta.url).pathname),",
|
|
26
|
-
" process.env.XDG_DATA_DIRS || \"/usr/local/share:/usr/share\",",
|
|
27
|
-
"].join(\":\");",
|
|
28
|
-
].join("\n");
|
|
29
|
-
|
|
30
24
|
const findIconFiles = (state: PluginState): ListedFile[] => {
|
|
31
25
|
if (state.source.kind === "theme") {
|
|
32
26
|
return listFilesRecursive(state.source.path);
|
|
@@ -43,7 +37,7 @@ const findIconFiles = (state: PluginState): ListedFile[] => {
|
|
|
43
37
|
};
|
|
44
38
|
|
|
45
39
|
const applyUserConfig = async (state: PluginState, config: UserConfig, loadConfig: ConfigLoader): Promise<void> => {
|
|
46
|
-
const { config: gtkxConfig, root } = await loadConfig.load(config
|
|
40
|
+
const { config: gtkxConfig, root } = await loadConfig.load(viteProjectRoot(config));
|
|
47
41
|
state.applicationId = gtkxConfig.applicationId;
|
|
48
42
|
state.source = resolveApplicationIcon(root, gtkxConfig.applicationId, gtkxConfig.applicationIcon);
|
|
49
43
|
};
|
|
@@ -78,7 +72,7 @@ function gtkxIcons(loadConfig: ConfigLoader = createConfigLoader()): Plugin {
|
|
|
78
72
|
return;
|
|
79
73
|
}
|
|
80
74
|
|
|
81
|
-
return prependBanner(options,
|
|
75
|
+
return prependBanner(options, xdgDataDirsBanner);
|
|
82
76
|
},
|
|
83
77
|
|
|
84
78
|
buildEnd() {
|
|
@@ -2,11 +2,11 @@ import type { Plugin } from "vite";
|
|
|
2
2
|
import { createConfigLoader } from "@gtkx/config/internal";
|
|
3
3
|
import createConfigPlugin from "@gtkx/config/vite-plugin";
|
|
4
4
|
import type { BuildManifestCollector } from "../internal/build-manifest.js";
|
|
5
|
-
import { gtkxAnimated } from "./animated.js";
|
|
6
5
|
import { gtkxAssetImports } from "./asset-imports.js";
|
|
7
6
|
import { gtkxBuiltUrl } from "./built-url.js";
|
|
8
7
|
import { gtkxCss } from "./css.js";
|
|
9
|
-
import {
|
|
8
|
+
import { gtkxFont } from "./font.js";
|
|
9
|
+
import { type CatalogWriteListener, gtkxI18n } from "./i18n.js";
|
|
10
10
|
import { gtkxIcons } from "./icons.js";
|
|
11
11
|
import { gtkxReactCompiler } from "./react-compiler.js";
|
|
12
12
|
import { gtkxResources } from "./resources.js";
|
|
@@ -14,26 +14,49 @@ import { gtkxSettings } from "./settings.js";
|
|
|
14
14
|
import { gtkxStoreLinks } from "./store-links.js";
|
|
15
15
|
import { gtkxUndeclaredLibrary } from "./undeclared-library.js";
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
type GtkxVitePluginOptions = {
|
|
18
|
+
buildManifest?: BuildManifestCollector | undefined;
|
|
19
|
+
configFile?: string | undefined;
|
|
20
|
+
entryPath?: string | undefined;
|
|
21
|
+
mode?: string | undefined;
|
|
22
|
+
onCatalogsWritten?: CatalogWriteListener | undefined;
|
|
23
|
+
shouldPreserveI18nMetadata?: boolean | undefined;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const gtkxVitePlugins = (options: GtkxVitePluginOptions = {}): Plugin[] => {
|
|
27
|
+
const {
|
|
28
|
+
buildManifest,
|
|
29
|
+
configFile,
|
|
30
|
+
entryPath,
|
|
31
|
+
mode,
|
|
32
|
+
onCatalogsWritten,
|
|
33
|
+
shouldPreserveI18nMetadata = true,
|
|
34
|
+
} = options;
|
|
35
|
+
const loadConfig = createConfigLoader({
|
|
36
|
+
...(mode !== undefined && { mode }),
|
|
37
|
+
...(configFile !== undefined && { configFile }),
|
|
38
|
+
});
|
|
24
39
|
|
|
25
40
|
return [
|
|
26
41
|
createConfigPlugin({ name: "gtkx:config", loadConfig }),
|
|
27
|
-
...(entryPath === undefined
|
|
42
|
+
...(entryPath === undefined
|
|
43
|
+
? []
|
|
44
|
+
: [gtkxI18n({
|
|
45
|
+
entryPath,
|
|
46
|
+
loadConfig,
|
|
47
|
+
onCatalogsWritten,
|
|
48
|
+
shouldPreserveMetadataMessages: shouldPreserveI18nMetadata,
|
|
49
|
+
shouldRecoverExtractionErrors: mode === "development",
|
|
50
|
+
})]),
|
|
28
51
|
gtkxStoreLinks(),
|
|
29
52
|
gtkxUndeclaredLibrary(loadConfig),
|
|
30
|
-
gtkxSettings(
|
|
53
|
+
gtkxSettings(buildManifest),
|
|
31
54
|
gtkxIcons(loadConfig),
|
|
32
|
-
gtkxAssetImports(
|
|
55
|
+
gtkxAssetImports(),
|
|
33
56
|
gtkxBuiltUrl(),
|
|
57
|
+
gtkxFont(),
|
|
34
58
|
gtkxResources(loadConfig, entryPath),
|
|
35
59
|
gtkxCss(),
|
|
36
|
-
gtkxAnimated(loadConfig),
|
|
37
60
|
gtkxReactCompiler(loadConfig),
|
|
38
61
|
];
|
|
39
62
|
};
|
|
@@ -5,7 +5,6 @@ import { arch, platform } from "node:os";
|
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
import { stripQuery } from "./strip-query.js";
|
|
7
7
|
|
|
8
|
-
const EMITTED_BINDING_SPECIFIER = "./gtkx.node";
|
|
9
8
|
const BINDING_FILENAME = "gtkx.node";
|
|
10
9
|
|
|
11
10
|
function resolveBinaryPath(projectRequire: ReturnType<typeof createRequire>, currentArch: string): string {
|
|
@@ -97,10 +96,6 @@ function gtkxNative(root: string): Plugin {
|
|
|
97
96
|
});
|
|
98
97
|
},
|
|
99
98
|
|
|
100
|
-
resolveId(id) {
|
|
101
|
-
return id === EMITTED_BINDING_SPECIFIER ? { id, external: true } : null;
|
|
102
|
-
},
|
|
103
|
-
|
|
104
99
|
transform(code, id) {
|
|
105
100
|
return transformLoader(code, id, loaderPath(), bindingReferenceId);
|
|
106
101
|
},
|