@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
package/src/i18n/types.ts
CHANGED
|
@@ -1,154 +1,120 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { I18nextToolkitConfig, Logger, Plugin } from "i18next-cli";
|
|
2
|
+
import { runTypesGenerator } from "i18next-cli";
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
4
|
import { dirname, join } from "node:path";
|
|
3
|
-
import type { SourceMessage } from "./source-messages.js";
|
|
4
|
-
|
|
5
|
-
type I18nTypesResult = {
|
|
6
|
-
isWritten: boolean;
|
|
7
|
-
path: string;
|
|
8
|
-
};
|
|
9
5
|
|
|
6
|
+
const CONTEXT_SEPARATOR = "\u{4}";
|
|
7
|
+
const DEFAULT_NAMESPACE = "translation";
|
|
10
8
|
const I18N_TYPES_FILENAME = "i18n.d.ts";
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const stringType = (values: string[]): string =>
|
|
14
|
-
[...new Set(values)].map((value) => JSON.stringify(value)).join(" | ");
|
|
15
|
-
|
|
16
|
-
const contextField = (context: string | null): string =>
|
|
17
|
-
context === null ? "" : ` context: ${JSON.stringify(context)};`;
|
|
18
|
-
|
|
19
|
-
const hasInterpolation = (values: string[]): boolean => values.some((value) => INTERPOLATION_PATTERN.test(value));
|
|
9
|
+
const I18N_RESOURCES_FILENAME = "i18n-resources.d.ts";
|
|
20
10
|
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
const generatedDir = (root: string): string => join(root, "node_modules", ".gtkx");
|
|
12
|
+
const i18nResourceDir = (root: string): string => join(generatedDir(root), "i18n");
|
|
13
|
+
const i18nTypesPath = (root: string): string => join(generatedDir(root), I18N_TYPES_FILENAME);
|
|
14
|
+
const i18nResourcesPath = (root: string): string => join(generatedDir(root), I18N_RESOURCES_FILENAME);
|
|
24
15
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
`required: ${String(isRequired)}; value: ${JSON.stringify(message.msgid)} }`
|
|
28
|
-
);
|
|
16
|
+
const clearI18nResources = (root: string): void => {
|
|
17
|
+
rmSync(i18nResourceDir(root), { force: true, recursive: true });
|
|
29
18
|
};
|
|
30
19
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
const i18nToolkitConfig = (
|
|
21
|
+
root: string,
|
|
22
|
+
sourceFiles: string[],
|
|
23
|
+
plugins: Plugin[] = [],
|
|
24
|
+
): I18nextToolkitConfig => ({
|
|
25
|
+
locales: ["en"],
|
|
26
|
+
plugins,
|
|
27
|
+
extract: {
|
|
28
|
+
contextSeparator: CONTEXT_SEPARATOR,
|
|
29
|
+
defaultNS: DEFAULT_NAMESPACE,
|
|
30
|
+
disablePlurals: false,
|
|
31
|
+
extractFromComments: false,
|
|
32
|
+
functions: ["t"],
|
|
33
|
+
generateBasePluralForms: false,
|
|
34
|
+
input: sourceFiles,
|
|
35
|
+
keySeparator: ".",
|
|
36
|
+
nsSeparator: false,
|
|
37
|
+
output: join(i18nResourceDir(root), "{{language}}", "{{namespace}}.json"),
|
|
38
|
+
pluralSeparator: "_",
|
|
39
|
+
primaryLanguage: "en",
|
|
40
|
+
removeUnusedKeys: true,
|
|
41
|
+
transComponents: ["Trans", "TransWithoutContext"],
|
|
42
|
+
useTranslationNames: ["useTranslation"],
|
|
43
|
+
warnOnConflicts: "error",
|
|
44
|
+
},
|
|
45
|
+
types: {
|
|
46
|
+
input: join(i18nResourceDir(root), "en", "*.json"),
|
|
47
|
+
output: i18nTypesPath(root),
|
|
48
|
+
resourcesFile: i18nResourcesPath(root),
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const declarations = (): string => `import type Resources from "./i18n-resources.js";
|
|
53
|
+
|
|
54
|
+
declare module "@gtkx/i18n" {
|
|
55
|
+
interface I18nResources extends Resources {}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
const writeChanged = (path: string, content: string): void => {
|
|
60
|
+
let current: string | null;
|
|
35
61
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const requirePlural = (message: SourceMessage): string => {
|
|
44
|
-
if (message.plural === null) {
|
|
45
|
-
throw new Error("Plural translation metadata requires a plural source string");
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return message.plural;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const pluralVariant = (message: SourceMessage): string => {
|
|
52
|
-
const plural = requirePlural(message);
|
|
53
|
-
const values = [message.singular, plural];
|
|
54
|
-
const isInterpolated = hasInterpolation(values);
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
`{${contextField(message.context)} defaultValue: ${JSON.stringify(plural)}; ` +
|
|
58
|
-
`interpolated: ${String(isInterpolated)}; kind: "plural"; required: true; ` +
|
|
59
|
-
`value: ${stringType(values)} }`
|
|
60
|
-
);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const pluralDefaultsVariant = (message: SourceMessage): string => {
|
|
64
|
-
const plural = requirePlural(message);
|
|
65
|
-
const values = [message.singular, plural];
|
|
66
|
-
const isInterpolated = hasInterpolation(values);
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
`{${contextField(message.context)} defaultValueOne: ${JSON.stringify(message.singular)}; ` +
|
|
70
|
-
`defaultValueOther: ${JSON.stringify(plural)}; interpolated: ${String(isInterpolated)}; ` +
|
|
71
|
-
`kind: "pluralDefaults"; required: true; value: ${stringType(values)} }`
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const variantsFor = (message: SourceMessage): string[] => {
|
|
76
|
-
if (message.kind === "plural") {
|
|
77
|
-
return [pluralVariant(message)];
|
|
62
|
+
try {
|
|
63
|
+
current = readFileSync(path, "utf8");
|
|
64
|
+
} catch {
|
|
65
|
+
current = null;
|
|
78
66
|
}
|
|
79
67
|
|
|
80
|
-
if (
|
|
81
|
-
return
|
|
68
|
+
if (current === content) {
|
|
69
|
+
return;
|
|
82
70
|
}
|
|
83
71
|
|
|
84
|
-
|
|
72
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
73
|
+
writeFileSync(path, content);
|
|
85
74
|
};
|
|
86
75
|
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
76
|
+
const typegenLogger = (): { errors: string[]; logger: Logger } => {
|
|
77
|
+
const errors: string[] = [];
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
errors,
|
|
81
|
+
logger: {
|
|
82
|
+
error(value) {
|
|
83
|
+
errors.push(String(value));
|
|
84
|
+
},
|
|
85
|
+
info() {
|
|
86
|
+
return;
|
|
87
|
+
},
|
|
88
|
+
warn() {
|
|
89
|
+
return;
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
};
|
|
103
93
|
};
|
|
104
94
|
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
];
|
|
95
|
+
const emitI18nTypes = async (root: string): Promise<void> => {
|
|
96
|
+
const typesPath = i18nTypesPath(root);
|
|
97
|
+
const resourcesPath = i18nResourcesPath(root);
|
|
98
|
+
writeChanged(typesPath, declarations());
|
|
99
|
+
const { errors, logger } = typegenLogger();
|
|
100
|
+
await runTypesGenerator(i18nToolkitConfig(root, []), { logger, quiet: true });
|
|
111
101
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return [...generatedHeader(), "export {};", ""].join("\n");
|
|
102
|
+
if (errors.length > 0 || !existsSync(typesPath) || !existsSync(resourcesPath)) {
|
|
103
|
+
throw new Error(errors.join("\n") || "i18next type generation did not produce its outputs");
|
|
115
104
|
}
|
|
116
|
-
|
|
117
|
-
return [
|
|
118
|
-
...generatedHeader(),
|
|
119
|
-
'import "@gtkx/i18n";',
|
|
120
|
-
"",
|
|
121
|
-
'declare module "@gtkx/i18n" {',
|
|
122
|
-
" interface TranslationRegistry {",
|
|
123
|
-
...renderRegistry(messages),
|
|
124
|
-
" }",
|
|
125
|
-
"}",
|
|
126
|
-
"",
|
|
127
|
-
].join("\n");
|
|
128
105
|
};
|
|
129
106
|
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return readFileSync(path, "utf8");
|
|
135
|
-
} catch {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
107
|
+
const clearI18nTypes = (root: string): void => {
|
|
108
|
+
rmSync(i18nTypesPath(root), { force: true });
|
|
109
|
+
rmSync(i18nResourcesPath(root), { force: true });
|
|
110
|
+
clearI18nResources(root);
|
|
138
111
|
};
|
|
139
112
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
149
|
-
writeFileSync(path, content);
|
|
150
|
-
|
|
151
|
-
return { isWritten: true, path };
|
|
113
|
+
export {
|
|
114
|
+
I18N_TYPES_FILENAME,
|
|
115
|
+
clearI18nResources,
|
|
116
|
+
clearI18nTypes,
|
|
117
|
+
emitI18nTypes,
|
|
118
|
+
i18nToolkitConfig,
|
|
119
|
+
i18nTypesPath,
|
|
152
120
|
};
|
|
153
|
-
|
|
154
|
-
export { I18N_TYPES_FILENAME, emitI18nTypes, i18nTypesPath };
|
|
@@ -18,9 +18,13 @@ const TOP_LEVEL_HEADING = /^# /m;
|
|
|
18
18
|
const rulesBody = (heading: string): string[] => [
|
|
19
19
|
`${heading} GTKX`,
|
|
20
20
|
"",
|
|
21
|
-
"
|
|
22
|
-
"GJS, and almost none of it is valid here. Check the rules below against what you are
|
|
21
|
+
"GTKX applications are Adwaita-first, with GTK4 underneath. Most GNOME UI code in your training data is C, " +
|
|
22
|
+
"PyGObject, Vala or GJS, and almost none of it is valid here. Check the rules below against what you are " +
|
|
23
|
+
"about to write.",
|
|
23
24
|
"",
|
|
25
|
+
"- Start application shells with `AdwApplication` and `AdwApplicationWindow`. Freeform windows normally use " +
|
|
26
|
+
"`AdwToolbarView` and `AdwHeaderBar`; navigation containers own their Adwaita chrome. Prefer Adwaita for " +
|
|
27
|
+
"structure, navigation, dialogs, rows, and adaptive patterns; use GTK4 for lower-level primitives.",
|
|
24
28
|
"- Children are JSX, never `.append()`, `pack_start()`, `set_child()` or `add()`.",
|
|
25
29
|
'- Signals are props: `onClicked`, not `widget.connect("clicked", ...)`.',
|
|
26
30
|
"- Props are camelCase: `marginTop`, not `margin-top` or `margin_top`.",
|
|
@@ -37,6 +41,7 @@ const rulesBody = (heading: string): string[] => [
|
|
|
37
41
|
"| --- | --- |",
|
|
38
42
|
"| `gtkx dev` | Run the app with fast refresh |",
|
|
39
43
|
"| `gtkx codegen` | Regenerate bindings and this reference |",
|
|
44
|
+
"| `gtkx cleanup` | Remove stale headless runtime and compile cache directories |",
|
|
40
45
|
"| `tsc --noEmit` | Typecheck |",
|
|
41
46
|
"| `vitest run` | Run the tests |",
|
|
42
47
|
"",
|
package/src/internal/banner.ts
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
import type { Rollup } from "vite";
|
|
2
|
+
import { posix } from "node:path";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
type Banner = string | Rollup.AddonFunction;
|
|
5
|
+
|
|
6
|
+
const renderBanner = async (banner: Banner, chunk: Rollup.RenderedChunk): Promise<string> =>
|
|
7
|
+
typeof banner === "function" ? banner(chunk) : banner;
|
|
8
|
+
|
|
9
|
+
const prependBanner = (options: Rollup.OutputOptions, banner: Banner): Rollup.OutputOptions => {
|
|
4
10
|
const existing = options.banner;
|
|
5
11
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
return {
|
|
13
|
+
...options,
|
|
14
|
+
banner: async (chunk) => {
|
|
15
|
+
const prefix = await renderBanner(banner, chunk);
|
|
16
|
+
const suffix = existing === undefined ? "" : await renderBanner(existing, chunk);
|
|
17
|
+
|
|
18
|
+
if (prefix.length === 0) {
|
|
19
|
+
return suffix;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return suffix.length === 0 ? prefix : `${prefix}\n${suffix}`;
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const outputRootUrlExpression = (chunk: Rollup.RenderedChunk): string => {
|
|
28
|
+
const relativeRoot = posix.relative(posix.dirname(chunk.fileName), ".");
|
|
29
|
+
const specifier = relativeRoot.length === 0 ? "./" : `${relativeRoot}/`;
|
|
9
30
|
|
|
10
|
-
return
|
|
31
|
+
return `decodeURIComponent(new URL(${JSON.stringify(specifier)}, import.meta.url).pathname)`;
|
|
11
32
|
};
|
|
12
33
|
|
|
13
|
-
export { prependBanner };
|
|
34
|
+
export { outputRootUrlExpression, prependBanner };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
|
|
1
3
|
type RecordedPackage = {
|
|
2
4
|
name: string;
|
|
3
5
|
version: string | null;
|
|
@@ -7,6 +9,8 @@ type RecordedPackage = {
|
|
|
7
9
|
type BuildManifest = {
|
|
8
10
|
generator: typeof BUILD_MANIFEST_GENERATOR;
|
|
9
11
|
formatVersion: typeof BUILD_MANIFEST_FORMAT_VERSION;
|
|
12
|
+
configFile: string;
|
|
13
|
+
configDigest: string;
|
|
10
14
|
schemas: string[];
|
|
11
15
|
packages: RecordedPackage[];
|
|
12
16
|
};
|
|
@@ -17,7 +21,26 @@ type BuildManifestCollector = {
|
|
|
17
21
|
|
|
18
22
|
const BUILD_MANIFEST_FILENAME = "gtkx-schemas.json";
|
|
19
23
|
const BUILD_MANIFEST_GENERATOR = "gtkx-build";
|
|
20
|
-
const BUILD_MANIFEST_FORMAT_VERSION =
|
|
24
|
+
const BUILD_MANIFEST_FORMAT_VERSION = 2;
|
|
25
|
+
|
|
26
|
+
const canonicalConfig = (value: unknown): unknown => {
|
|
27
|
+
if (Array.isArray(value)) {
|
|
28
|
+
return value.map((entry) => canonicalConfig(entry));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (typeof value !== "object" || value === null) {
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return Object.fromEntries(
|
|
36
|
+
Object.entries(value)
|
|
37
|
+
.toSorted(([left], [right]) => left.localeCompare(right))
|
|
38
|
+
.map(([key, entry]) => [key, canonicalConfig(entry)]),
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const configDigest = (config: unknown): string =>
|
|
43
|
+
createHash("sha256").update(JSON.stringify(canonicalConfig(config))).digest("hex");
|
|
21
44
|
|
|
22
45
|
const createBuildManifestCollector = (): BuildManifestCollector => ({ schemas: [] });
|
|
23
46
|
|
|
@@ -25,6 +48,7 @@ export {
|
|
|
25
48
|
BUILD_MANIFEST_FILENAME,
|
|
26
49
|
BUILD_MANIFEST_FORMAT_VERSION,
|
|
27
50
|
BUILD_MANIFEST_GENERATOR,
|
|
51
|
+
configDigest,
|
|
28
52
|
createBuildManifestCollector,
|
|
29
53
|
type BuildManifest,
|
|
30
54
|
type BuildManifestCollector,
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { isPathInside, isRecord } from "@gtkx/utils";
|
|
2
|
+
import { lstatSync, readdirSync } from "node:fs";
|
|
3
|
+
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
4
|
+
import {
|
|
5
|
+
BUILD_MANIFEST_FILENAME,
|
|
6
|
+
BUILD_MANIFEST_GENERATOR,
|
|
7
|
+
} from "./build-manifest.js";
|
|
8
|
+
import {
|
|
9
|
+
type OutputDirectoryTransaction,
|
|
10
|
+
prepareOutputDirectory,
|
|
11
|
+
readRegularFile,
|
|
12
|
+
} from "./output-directory.js";
|
|
13
|
+
|
|
14
|
+
const DEFAULT_BUILD_OUT_DIR = "dist";
|
|
15
|
+
const PRESERVED_BUILD_ENTRIES: ReadonlySet<string> = new Set([".git"]);
|
|
16
|
+
|
|
17
|
+
type PreparedBuildOutDir = Disposable & { commit: () => void; path: string };
|
|
18
|
+
|
|
19
|
+
const hasSymlinkComponent = (root: string, target: string): boolean => {
|
|
20
|
+
let current = root;
|
|
21
|
+
|
|
22
|
+
for (const segment of relative(root, target).split(sep)) {
|
|
23
|
+
current = join(current, segment);
|
|
24
|
+
|
|
25
|
+
if (lstatSync(current, { throwIfNoEntry: false })?.isSymbolicLink() === true) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return false;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const isGtkxBuildDirectory = (path: string): boolean => {
|
|
34
|
+
const manifest = join(path, BUILD_MANIFEST_FILENAME);
|
|
35
|
+
const contents = readRegularFile(manifest);
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const parsed: unknown = contents === null ? null : JSON.parse(contents);
|
|
39
|
+
|
|
40
|
+
return isRecord(parsed) && parsed.generator === BUILD_MANIFEST_GENERATOR;
|
|
41
|
+
} catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const isReusableBuildDirectory = (path: string): boolean => {
|
|
47
|
+
const stats = lstatSync(path, { throwIfNoEntry: false });
|
|
48
|
+
|
|
49
|
+
if (stats === undefined) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return stats.isDirectory() && (readdirSync(path).length === 0 || isGtkxBuildDirectory(path));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const outputName = (root: string, path: string): string => relative(root, path) || ".";
|
|
57
|
+
|
|
58
|
+
const gtkxBuildAncestor = (root: string, outDir: string): string | null => {
|
|
59
|
+
let ancestor = dirname(outDir);
|
|
60
|
+
|
|
61
|
+
while (isPathInside(root, ancestor)) {
|
|
62
|
+
if (isGtkxBuildDirectory(ancestor)) {
|
|
63
|
+
return ancestor;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
ancestor = dirname(ancestor);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return null;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const childDirectories = (parent: string): string[] =>
|
|
73
|
+
readdirSync(parent, { withFileTypes: true })
|
|
74
|
+
.filter((entry) => entry.isDirectory())
|
|
75
|
+
.map((entry) => join(parent, entry.name));
|
|
76
|
+
|
|
77
|
+
const gtkxBuildDescendant = (root: string): string | null => {
|
|
78
|
+
const pending = childDirectories(root);
|
|
79
|
+
|
|
80
|
+
while (pending.length > 0) {
|
|
81
|
+
const path = pending.pop();
|
|
82
|
+
|
|
83
|
+
if (path === undefined) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (isGtkxBuildDirectory(path)) {
|
|
88
|
+
return path;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
pending.push(...childDirectories(path));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return null;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const assertSafeBuildLocation = (root: string, outDir: string): void => {
|
|
98
|
+
if (!isPathInside(root, outDir)) {
|
|
99
|
+
throw new Error(`Build output ${outDir} must be below the project root ${root}`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (hasSymlinkComponent(root, outDir)) {
|
|
103
|
+
throw new Error(`Build output ${outputName(root, outDir)} passes through a symbolic link`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const ancestor = gtkxBuildAncestor(root, outDir);
|
|
107
|
+
|
|
108
|
+
if (ancestor !== null) {
|
|
109
|
+
throw new Error(
|
|
110
|
+
`Build output ${outputName(root, outDir)} is nested inside the earlier GTKX build ` +
|
|
111
|
+
outputName(root, ancestor),
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const nonReusableBuildOutputError = (root: string, outDir: string): Error => {
|
|
117
|
+
const stats = lstatSync(outDir, { throwIfNoEntry: false });
|
|
118
|
+
|
|
119
|
+
if (stats?.isDirectory() !== true) {
|
|
120
|
+
return new Error(`Build output ${outputName(root, outDir)} exists and is not a directory`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const descendant = gtkxBuildDescendant(outDir);
|
|
124
|
+
|
|
125
|
+
if (descendant !== null) {
|
|
126
|
+
return new Error(
|
|
127
|
+
`Build output ${outputName(root, outDir)} contains the earlier GTKX build ` +
|
|
128
|
+
outputName(root, descendant),
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return new Error(
|
|
133
|
+
`Build output ${outputName(root, outDir)} is nonempty and is not an earlier GTKX build`,
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const resolveBuildOutDir = (root: string, configured?: string): string => {
|
|
138
|
+
const selected = configured ?? DEFAULT_BUILD_OUT_DIR;
|
|
139
|
+
const outDir = resolve(root, selected);
|
|
140
|
+
|
|
141
|
+
assertSafeBuildLocation(root, outDir);
|
|
142
|
+
|
|
143
|
+
if (!isReusableBuildDirectory(outDir)) {
|
|
144
|
+
throw nonReusableBuildOutputError(root, outDir);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return outDir;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const prepareBuildOutDir = (root: string, outDir: string): PreparedBuildOutDir => {
|
|
151
|
+
assertSafeBuildLocation(root, outDir);
|
|
152
|
+
const prepared = prepareOutputDirectory(root, outDir, isReusableBuildDirectory);
|
|
153
|
+
|
|
154
|
+
if (prepared.status === "unsafe") {
|
|
155
|
+
throw new Error(`Build output ${outputName(root, outDir)} became unsafe while preparing it`);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const transaction: OutputDirectoryTransaction = prepared.transaction;
|
|
159
|
+
|
|
160
|
+
return {
|
|
161
|
+
path: transaction.path,
|
|
162
|
+
commit: () => {
|
|
163
|
+
transaction.commit(PRESERVED_BUILD_ENTRIES, isGtkxBuildDirectory);
|
|
164
|
+
},
|
|
165
|
+
[Symbol.dispose]: () => {
|
|
166
|
+
transaction[Symbol.dispose]();
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export { prepareBuildOutDir, resolveBuildOutDir };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
|
|
4
|
+
const CACHE_NAMESPACE = "gtkx";
|
|
5
|
+
|
|
6
|
+
const cacheRoot = (): string => {
|
|
7
|
+
const base = process.env.XDG_CACHE_HOME;
|
|
8
|
+
|
|
9
|
+
return join(base !== undefined && base.length > 0 ? base : join(homedir(), ".cache"), CACHE_NAMESPACE);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { cacheRoot };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { readdirSync, rmSync } from "node:fs";
|
|
2
|
+
import * as nodeModule from "node:module";
|
|
3
|
+
import { basename, join } from "node:path";
|
|
4
|
+
import { cacheRoot } from "./cache-root.js";
|
|
5
|
+
import { COMPILE_CACHE_SEGMENT } from "./compile-cache.js";
|
|
6
|
+
|
|
7
|
+
const RUNTIME_PREFIX = `v${process.versions.node}-${process.arch}-`;
|
|
8
|
+
|
|
9
|
+
const currentNamespace = (): string | undefined => {
|
|
10
|
+
if (typeof nodeModule.getCompileCacheDir !== "function") {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const dir = nodeModule.getCompileCacheDir();
|
|
15
|
+
|
|
16
|
+
return dir === undefined ? undefined : basename(dir);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const isStale = (name: string, namespace: string | undefined): boolean =>
|
|
20
|
+
namespace === undefined ? !name.startsWith(RUNTIME_PREFIX) : name !== namespace;
|
|
21
|
+
|
|
22
|
+
const findStaleCompileCaches = (): string[] => {
|
|
23
|
+
const namespace = currentNamespace();
|
|
24
|
+
const dir = join(cacheRoot(), COMPILE_CACHE_SEGMENT);
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
return readdirSync(dir, { withFileTypes: true })
|
|
28
|
+
.filter((entry) => entry.isDirectory() && isStale(entry.name, namespace))
|
|
29
|
+
.map((entry) => join(dir, entry.name));
|
|
30
|
+
} catch {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const reapStaleCompileCaches = (candidates: string[]): string[] => {
|
|
36
|
+
const removed: string[] = [];
|
|
37
|
+
|
|
38
|
+
for (const candidate of candidates) {
|
|
39
|
+
try {
|
|
40
|
+
rmSync(candidate, { recursive: true, force: true });
|
|
41
|
+
removed.push(candidate);
|
|
42
|
+
} catch {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return removed;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { findStaleCompileCaches, reapStaleCompileCaches };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as nodeModule from "node:module";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { cacheRoot } from "./cache-root.js";
|
|
4
|
+
|
|
5
|
+
const COMPILE_CACHE_SEGMENT = "compile-cache";
|
|
6
|
+
const DISABLE_COMPILE_CACHE_ENV = "GTKX_DISABLE_COMPILE_CACHE";
|
|
7
|
+
|
|
8
|
+
const enableToolchainCompileCache = (): void => {
|
|
9
|
+
if (process.env[DISABLE_COMPILE_CACHE_ENV] === "1") {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (typeof nodeModule.enableCompileCache !== "function") {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
nodeModule.enableCompileCache(join(cacheRoot(), COMPILE_CACHE_SEGMENT));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { COMPILE_CACHE_SEGMENT, enableToolchainCompileCache };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
|
|
3
|
+
const DEFAULT_DEPLOY_OUT_DIR = "build";
|
|
4
|
+
|
|
5
|
+
const deployOutDirFor = (root: string, configured: string | undefined): string =>
|
|
6
|
+
resolve(root, configured ?? DEFAULT_DEPLOY_OUT_DIR);
|
|
7
|
+
|
|
8
|
+
export { DEFAULT_DEPLOY_OUT_DIR, deployOutDirFor };
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type ElementProps,
|
|
3
|
+
type OmittedProps,
|
|
4
|
+
resolveStore,
|
|
5
|
+
} from "@gtkx/codegen";
|
|
6
|
+
import { readBuiltinElementsForDocs } from "@gtkx/codegen/internal";
|
|
2
7
|
import { existsSync } from "node:fs";
|
|
3
8
|
|
|
4
9
|
type DocsElements = {
|
|
5
10
|
props: ElementProps;
|
|
6
11
|
omittedProps: OmittedProps;
|
|
12
|
+
acceptedChildTypes: Record<string, string[]>;
|
|
7
13
|
};
|
|
8
14
|
|
|
9
15
|
const resolveDocsElements = async (cwd: string): Promise<DocsElements> => {
|
|
10
|
-
const { gi
|
|
16
|
+
const { gi } = resolveStore(cwd);
|
|
11
17
|
|
|
12
18
|
if (!existsSync(gi.storeDir)) {
|
|
13
|
-
return { props: {}, omittedProps: {} };
|
|
19
|
+
return { props: {}, omittedProps: {}, acceptedChildTypes: {} };
|
|
14
20
|
}
|
|
15
21
|
|
|
16
|
-
const { props, omittedProps } = await
|
|
22
|
+
const { props, omittedProps, acceptedChildTypes } = await readBuiltinElementsForDocs();
|
|
17
23
|
|
|
18
|
-
return { props, omittedProps };
|
|
24
|
+
return { props, omittedProps, acceptedChildTypes };
|
|
19
25
|
};
|
|
20
26
|
|
|
21
27
|
export { resolveDocsElements };
|