@gtkx/cli 2.0.0-beta.1 → 2.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -40
- package/bin/gtkx-dev-runner.js +5 -1
- package/bin/gtkx.js +5 -1
- package/dist/builder.d.ts +1 -0
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +44 -12
- package/dist/builder.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +14 -2
- package/dist/cli.js.map +1 -1
- package/dist/codegen/config-dependencies.d.ts +3 -0
- package/dist/codegen/config-dependencies.d.ts.map +1 -0
- package/dist/codegen/config-dependencies.js +355 -0
- package/dist/codegen/config-dependencies.js.map +1 -0
- package/dist/codegen/freshness.d.ts.map +1 -1
- package/dist/codegen/freshness.js +5 -1
- package/dist/codegen/freshness.js.map +1 -1
- package/dist/codegen/reference.d.ts.map +1 -1
- package/dist/codegen/reference.js +1 -0
- package/dist/codegen/reference.js.map +1 -1
- package/dist/codegen/run-codegen.d.ts +6 -3
- package/dist/codegen/run-codegen.d.ts.map +1 -1
- package/dist/codegen/run-codegen.js +42 -18
- package/dist/codegen/run-codegen.js.map +1 -1
- package/dist/codegen/store-resolver.d.ts +3 -1
- package/dist/codegen/store-resolver.d.ts.map +1 -1
- package/dist/codegen/store-resolver.js +7 -4
- package/dist/codegen/store-resolver.js.map +1 -1
- package/dist/commands/build.d.ts +5 -0
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +83 -10
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/cleanup.d.ts +9 -0
- package/dist/commands/cleanup.d.ts.map +1 -0
- package/dist/commands/cleanup.js +42 -0
- package/dist/commands/cleanup.js.map +1 -0
- package/dist/commands/codegen.d.ts +1 -0
- package/dist/commands/codegen.d.ts.map +1 -1
- package/dist/commands/codegen.js +6 -5
- package/dist/commands/codegen.js.map +1 -1
- package/dist/commands/deploy.d.ts +5 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +10 -2
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +9 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +31 -4
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +1 -0
- package/dist/commands/docs.js.map +1 -1
- package/dist/deploy/depends.d.ts.map +1 -1
- package/dist/deploy/depends.js +24 -2
- package/dist/deploy/depends.js.map +1 -1
- package/dist/deploy/download.d.ts +7 -3
- package/dist/deploy/download.d.ts.map +1 -1
- package/dist/deploy/download.js +19 -20
- package/dist/deploy/download.js.map +1 -1
- package/dist/deploy/freedesktop/metainfo.d.ts.map +1 -1
- package/dist/deploy/freedesktop/metainfo.js +41 -2
- package/dist/deploy/freedesktop/metainfo.js.map +1 -1
- package/dist/deploy/freedesktop/validate.d.ts.map +1 -1
- package/dist/deploy/freedesktop/validate.js +58 -14
- package/dist/deploy/freedesktop/validate.js.map +1 -1
- package/dist/deploy/native-addon.d.ts +5 -0
- package/dist/deploy/native-addon.d.ts.map +1 -0
- package/dist/deploy/native-addon.js +134 -0
- package/dist/deploy/native-addon.js.map +1 -0
- package/dist/deploy/nfpm/config.d.ts +3 -2
- package/dist/deploy/nfpm/config.d.ts.map +1 -1
- package/dist/deploy/nfpm/config.js +7 -4
- package/dist/deploy/nfpm/config.js.map +1 -1
- package/dist/deploy/nfpm/contents.d.ts.map +1 -1
- package/dist/deploy/nfpm/contents.js +8 -0
- package/dist/deploy/nfpm/contents.js.map +1 -1
- package/dist/deploy/node-runtime/download.js +2 -2
- package/dist/deploy/node-runtime/download.js.map +1 -1
- package/dist/deploy/node-runtime/elf.d.ts +4 -1
- package/dist/deploy/node-runtime/elf.d.ts.map +1 -1
- package/dist/deploy/node-runtime/elf.js +34 -5
- package/dist/deploy/node-runtime/elf.js.map +1 -1
- package/dist/deploy/node-runtime/guard.d.ts.map +1 -1
- package/dist/deploy/node-runtime/guard.js +7 -14
- package/dist/deploy/node-runtime/guard.js.map +1 -1
- package/dist/deploy/node-runtime/index.d.ts +3 -1
- package/dist/deploy/node-runtime/index.d.ts.map +1 -1
- package/dist/deploy/node-runtime/index.js +103 -10
- package/dist/deploy/node-runtime/index.js.map +1 -1
- package/dist/deploy/node-runtime/sonames.d.ts +5 -0
- package/dist/deploy/node-runtime/sonames.d.ts.map +1 -0
- package/dist/deploy/node-runtime/sonames.js +13 -0
- package/dist/deploy/node-runtime/sonames.js.map +1 -0
- package/dist/deploy/notices/node-runtime.js +2 -2
- package/dist/deploy/notices/node-runtime.js.map +1 -1
- package/dist/deploy/payload/launcher.d.ts.map +1 -1
- package/dist/deploy/payload/launcher.js +14 -1
- package/dist/deploy/payload/launcher.js.map +1 -1
- package/dist/deploy/payload/stage.d.ts +2 -1
- package/dist/deploy/payload/stage.d.ts.map +1 -1
- package/dist/deploy/payload/stage.js +46 -5
- package/dist/deploy/payload/stage.js.map +1 -1
- package/dist/deploy/run-deploy.d.ts +2 -0
- package/dist/deploy/run-deploy.d.ts.map +1 -1
- package/dist/deploy/run-deploy.js +197 -52
- package/dist/deploy/run-deploy.js.map +1 -1
- package/dist/deploy/settings/arch.d.ts +9 -3
- package/dist/deploy/settings/arch.d.ts.map +1 -1
- package/dist/deploy/settings/arch.js +27 -6
- package/dist/deploy/settings/arch.js.map +1 -1
- package/dist/deploy/settings/build-manifest.d.ts +6 -1
- package/dist/deploy/settings/build-manifest.d.ts.map +1 -1
- package/dist/deploy/settings/build-manifest.js +15 -4
- package/dist/deploy/settings/build-manifest.js.map +1 -1
- package/dist/deploy/settings/extra-files.d.ts +1 -1
- package/dist/deploy/settings/extra-files.d.ts.map +1 -1
- package/dist/deploy/settings/extra-files.js +25 -3
- package/dist/deploy/settings/extra-files.js.map +1 -1
- package/dist/deploy/settings/index.d.ts +3 -1
- package/dist/deploy/settings/index.d.ts.map +1 -1
- package/dist/deploy/settings/index.js +4 -2
- package/dist/deploy/settings/index.js.map +1 -1
- package/dist/deploy/settings/libraries.d.ts.map +1 -1
- package/dist/deploy/settings/libraries.js +2 -1
- package/dist/deploy/settings/libraries.js.map +1 -1
- package/dist/deploy/settings/paths.d.ts +4 -2
- package/dist/deploy/settings/paths.d.ts.map +1 -1
- package/dist/deploy/settings/paths.js +121 -12
- package/dist/deploy/settings/paths.js.map +1 -1
- package/dist/deploy/targets/appimage.d.ts.map +1 -1
- package/dist/deploy/targets/appimage.js +1 -0
- package/dist/deploy/targets/appimage.js.map +1 -1
- package/dist/deploy/targets/flatpak-pnpm.js +4 -4
- package/dist/deploy/targets/flatpak-pnpm.js.map +1 -1
- package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak-source.js +13 -2
- package/dist/deploy/targets/flatpak-source.js.map +1 -1
- package/dist/deploy/targets/flatpak.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak.js +1 -0
- package/dist/deploy/targets/flatpak.js.map +1 -1
- package/dist/deploy/targets/nfpm-target.d.ts.map +1 -1
- package/dist/deploy/targets/nfpm-target.js +13 -7
- package/dist/deploy/targets/nfpm-target.js.map +1 -1
- package/dist/deploy/types.d.ts +5 -2
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/deploy/types.js.map +1 -1
- package/dist/deploy/vendored/appimagetool.js +2 -2
- package/dist/deploy/vendored/appimagetool.js.map +1 -1
- package/dist/deploy/vendored/nfpm.js +1 -1
- package/dist/deploy/vendored/nfpm.js.map +1 -1
- package/dist/dev/catalog-writes.d.ts +8 -0
- package/dist/dev/catalog-writes.d.ts.map +1 -0
- package/dist/dev/catalog-writes.js +26 -0
- package/dist/dev/catalog-writes.js.map +1 -0
- package/dist/dev/entry-env.d.ts +2 -1
- package/dist/dev/entry-env.d.ts.map +1 -1
- package/dist/dev/entry-env.js +2 -1
- package/dist/dev/entry-env.js.map +1 -1
- package/dist/dev/font-dir.d.ts +3 -0
- package/dist/dev/font-dir.d.ts.map +1 -0
- package/dist/dev/font-dir.js +9 -0
- package/dist/dev/font-dir.js.map +1 -0
- package/dist/dev/headless.d.ts +3 -0
- package/dist/dev/headless.d.ts.map +1 -0
- package/dist/dev/headless.js +35 -0
- package/dist/dev/headless.js.map +1 -0
- package/dist/dev/runner-deps.d.ts +1 -1
- package/dist/dev/runner-deps.d.ts.map +1 -1
- package/dist/dev/runner-deps.js +12 -7
- package/dist/dev/runner-deps.js.map +1 -1
- package/dist/dev/runner-main.d.ts.map +1 -1
- package/dist/dev/runner-main.js +10 -3
- package/dist/dev/runner-main.js.map +1 -1
- package/dist/dev/runner.d.ts +2 -0
- package/dist/dev/runner.d.ts.map +1 -1
- package/dist/dev/runner.js +26 -7
- package/dist/dev/runner.js.map +1 -1
- package/dist/dev/supervisor.d.ts +3 -1
- package/dist/dev/supervisor.d.ts.map +1 -1
- package/dist/dev/supervisor.js +132 -29
- package/dist/dev/supervisor.js.map +1 -1
- package/dist/dev/vite-dev-server.d.ts +1 -1
- package/dist/dev/vite-dev-server.d.ts.map +1 -1
- package/dist/dev/vite-dev-server.js +14 -2
- package/dist/dev/vite-dev-server.js.map +1 -1
- package/dist/dev/watch-ignore.d.ts +3 -0
- package/dist/dev/watch-ignore.d.ts.map +1 -0
- package/dist/dev/watch-ignore.js +11 -0
- package/dist/dev/watch-ignore.js.map +1 -0
- package/dist/i18n/catalogs.d.ts +6 -2
- package/dist/i18n/catalogs.d.ts.map +1 -1
- package/dist/i18n/catalogs.js +10 -7
- package/dist/i18n/catalogs.js.map +1 -1
- package/dist/i18n/source-messages.d.ts +3 -1
- package/dist/i18n/source-messages.d.ts.map +1 -1
- package/dist/i18n/source-messages.js +973 -9
- package/dist/i18n/source-messages.js.map +1 -1
- package/dist/internal/agent-rules.d.ts.map +1 -1
- package/dist/internal/agent-rules.js +7 -2
- package/dist/internal/agent-rules.js.map +1 -1
- package/dist/internal/banner.d.ts +4 -2
- package/dist/internal/banner.d.ts.map +1 -1
- package/dist/internal/banner.js +19 -5
- package/dist/internal/banner.js.map +1 -1
- package/dist/internal/build-manifest.d.ts +5 -2
- package/dist/internal/build-manifest.d.ts.map +1 -1
- package/dist/internal/build-manifest.js +15 -2
- package/dist/internal/build-manifest.js.map +1 -1
- package/dist/internal/build-output.d.ts +8 -0
- package/dist/internal/build-output.d.ts.map +1 -0
- package/dist/internal/build-output.js +116 -0
- package/dist/internal/build-output.js.map +1 -0
- package/dist/internal/cache-root.d.ts +3 -0
- package/dist/internal/cache-root.d.ts.map +1 -0
- package/dist/internal/cache-root.js +9 -0
- package/dist/internal/cache-root.js.map +1 -0
- package/dist/internal/compile-cache-store.d.ts +4 -0
- package/dist/internal/compile-cache-store.d.ts.map +1 -0
- package/dist/internal/compile-cache-store.js +41 -0
- package/dist/internal/compile-cache-store.js.map +1 -0
- package/dist/internal/compile-cache.d.ts +4 -0
- package/dist/internal/compile-cache.d.ts.map +1 -0
- package/dist/internal/compile-cache.js +16 -0
- package/dist/internal/compile-cache.js.map +1 -0
- package/dist/internal/deploy-out-dir.d.ts +4 -0
- package/dist/internal/deploy-out-dir.d.ts.map +1 -0
- package/dist/internal/deploy-out-dir.js +5 -0
- package/dist/internal/deploy-out-dir.js.map +1 -0
- package/dist/internal/docs-elements.d.ts +1 -0
- package/dist/internal/docs-elements.d.ts.map +1 -1
- package/dist/internal/docs-elements.js +5 -4
- package/dist/internal/docs-elements.js.map +1 -1
- package/dist/internal/entry-arg.d.ts +4 -1
- package/dist/internal/entry-arg.d.ts.map +1 -1
- package/dist/internal/entry-arg.js +7 -1
- package/dist/internal/entry-arg.js.map +1 -1
- package/dist/internal/errors.d.ts +2 -1
- package/dist/internal/errors.d.ts.map +1 -1
- package/dist/internal/errors.js +1 -1
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/font-path.d.ts +4 -0
- package/dist/internal/font-path.d.ts.map +1 -0
- package/dist/internal/font-path.js +12 -0
- package/dist/internal/font-path.js.map +1 -0
- package/dist/internal/font-staging.d.ts +6 -0
- package/dist/internal/font-staging.d.ts.map +1 -0
- package/dist/internal/font-staging.js +94 -0
- package/dist/internal/font-staging.js.map +1 -0
- package/dist/internal/icon-staging.d.ts +3 -0
- package/dist/internal/icon-staging.d.ts.map +1 -0
- package/dist/internal/icon-staging.js +40 -0
- package/dist/internal/icon-staging.js.map +1 -0
- package/dist/internal/import-scan.d.ts +4 -0
- package/dist/internal/import-scan.d.ts.map +1 -0
- package/dist/internal/import-scan.js +138 -0
- package/dist/internal/import-scan.js.map +1 -0
- package/dist/internal/module-hash.d.ts +3 -0
- package/dist/internal/module-hash.d.ts.map +1 -0
- package/dist/internal/module-hash.js +19 -0
- package/dist/internal/module-hash.js.map +1 -0
- package/dist/internal/output-directory.d.ts +15 -0
- package/dist/internal/output-directory.d.ts.map +1 -0
- package/dist/internal/output-directory.js +490 -0
- package/dist/internal/output-directory.js.map +1 -0
- package/dist/internal/parent-process.d.ts +12 -0
- package/dist/internal/parent-process.d.ts.map +1 -0
- package/dist/internal/parent-process.js +74 -0
- package/dist/internal/parent-process.js.map +1 -0
- package/dist/internal/prepare-project.d.ts +3 -0
- package/dist/internal/prepare-project.d.ts.map +1 -1
- package/dist/internal/prepare-project.js +9 -3
- package/dist/internal/prepare-project.js.map +1 -1
- package/dist/internal/react-compiler-cache.d.ts +13 -0
- package/dist/internal/react-compiler-cache.d.ts.map +1 -0
- package/dist/internal/react-compiler-cache.js +182 -0
- package/dist/internal/react-compiler-cache.js.map +1 -0
- package/dist/internal/source-imports.d.ts +7 -2
- package/dist/internal/source-imports.d.ts.map +1 -1
- package/dist/internal/source-imports.js +31 -11
- package/dist/internal/source-imports.js.map +1 -1
- package/dist/internal/staging-file.d.ts +5 -0
- package/dist/internal/staging-file.d.ts.map +1 -0
- package/dist/internal/staging-file.js +35 -0
- package/dist/internal/staging-file.js.map +1 -0
- package/dist/internal/xdg-banner.d.ts +4 -0
- package/dist/internal/xdg-banner.d.ts.map +1 -0
- package/dist/internal/xdg-banner.js +11 -0
- package/dist/internal/xdg-banner.js.map +1 -0
- package/dist/internal/xdg-data-dirs.d.ts +2 -1
- package/dist/internal/xdg-data-dirs.d.ts.map +1 -1
- package/dist/internal/xdg-data-dirs.js +1 -1
- package/dist/internal/xdg-data-dirs.js.map +1 -1
- package/dist/mcp/client.js +2 -2
- package/dist/mcp/client.js.map +1 -1
- package/dist/settings/schema.d.ts.map +1 -1
- package/dist/settings/schema.js +3 -8
- package/dist/settings/schema.js.map +1 -1
- package/dist/vite-plugins/asset-extensions.d.ts.map +1 -1
- package/dist/vite-plugins/asset-extensions.js +2 -0
- package/dist/vite-plugins/asset-extensions.js.map +1 -1
- package/dist/vite-plugins/asset-imports.d.ts.map +1 -1
- package/dist/vite-plugins/asset-imports.js +20 -6
- package/dist/vite-plugins/asset-imports.js.map +1 -1
- package/dist/vite-plugins/asset-specifier.d.ts +5 -1
- package/dist/vite-plugins/asset-specifier.d.ts.map +1 -1
- package/dist/vite-plugins/asset-specifier.js +10 -1
- package/dist/vite-plugins/asset-specifier.js.map +1 -1
- package/dist/vite-plugins/build-manifest.d.ts +5 -1
- package/dist/vite-plugins/build-manifest.d.ts.map +1 -1
- package/dist/vite-plugins/build-manifest.js +2 -1
- package/dist/vite-plugins/build-manifest.js.map +1 -1
- package/dist/vite-plugins/built-url.d.ts.map +1 -1
- package/dist/vite-plugins/built-url.js +5 -2
- package/dist/vite-plugins/built-url.js.map +1 -1
- package/dist/vite-plugins/css.d.ts.map +1 -1
- package/dist/vite-plugins/css.js +13 -5
- package/dist/vite-plugins/css.js.map +1 -1
- package/dist/vite-plugins/ensure-store.d.ts +1 -1
- package/dist/vite-plugins/ensure-store.d.ts.map +1 -1
- package/dist/vite-plugins/ensure-store.js +2 -2
- package/dist/vite-plugins/ensure-store.js.map +1 -1
- package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts +6 -1
- package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts.map +1 -1
- package/dist/vite-plugins/fast-refresh/refresh-filter.js +3 -1
- package/dist/vite-plugins/fast-refresh/refresh-filter.js.map +1 -1
- package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts.map +1 -1
- package/dist/vite-plugins/fast-refresh/swc-refresh.js +23 -14
- package/dist/vite-plugins/fast-refresh/swc-refresh.js.map +1 -1
- package/dist/vite-plugins/font-name.d.ts +3 -0
- package/dist/vite-plugins/font-name.d.ts.map +1 -0
- package/dist/vite-plugins/font-name.js +406 -0
- package/dist/vite-plugins/font-name.js.map +1 -0
- package/dist/vite-plugins/font-worker-env.d.ts +4 -0
- package/dist/vite-plugins/font-worker-env.d.ts.map +1 -0
- package/dist/vite-plugins/font-worker-env.js +19 -0
- package/dist/vite-plugins/font-worker-env.js.map +1 -0
- package/dist/vite-plugins/font.d.ts +4 -0
- package/dist/vite-plugins/font.d.ts.map +1 -0
- package/dist/vite-plugins/font.js +111 -0
- package/dist/vite-plugins/font.js.map +1 -0
- package/dist/vite-plugins/i18n.d.ts +11 -2
- package/dist/vite-plugins/i18n.d.ts.map +1 -1
- package/dist/vite-plugins/i18n.js +74 -8
- package/dist/vite-plugins/i18n.js.map +1 -1
- package/dist/vite-plugins/icon-worker-env.d.ts +4 -0
- package/dist/vite-plugins/icon-worker-env.d.ts.map +1 -0
- package/dist/vite-plugins/icon-worker-env.js +23 -0
- package/dist/vite-plugins/icon-worker-env.js.map +1 -0
- package/dist/vite-plugins/icons.d.ts.map +1 -1
- package/dist/vite-plugins/icons.js +4 -9
- package/dist/vite-plugins/icons.js.map +1 -1
- package/dist/vite-plugins/index.d.ts +10 -1
- package/dist/vite-plugins/index.d.ts.map +1 -1
- package/dist/vite-plugins/index.js +17 -3
- package/dist/vite-plugins/index.js.map +1 -1
- package/dist/vite-plugins/native.d.ts.map +1 -1
- package/dist/vite-plugins/native.js +0 -4
- package/dist/vite-plugins/native.js.map +1 -1
- package/dist/vite-plugins/react-compiler.d.ts.map +1 -1
- package/dist/vite-plugins/react-compiler.js +57 -18
- package/dist/vite-plugins/react-compiler.js.map +1 -1
- package/dist/vite-plugins/resource-shared.d.ts +3 -1
- package/dist/vite-plugins/resource-shared.d.ts.map +1 -1
- package/dist/vite-plugins/resource-shared.js +3 -1
- package/dist/vite-plugins/resource-shared.js.map +1 -1
- package/dist/vite-plugins/resources.d.ts.map +1 -1
- package/dist/vite-plugins/resources.js +9 -6
- package/dist/vite-plugins/resources.js.map +1 -1
- package/dist/vite-plugins/self-contained.d.ts.map +1 -1
- package/dist/vite-plugins/self-contained.js +159 -158
- package/dist/vite-plugins/self-contained.js.map +1 -1
- package/dist/vite-plugins/settings-worker-env.d.ts +1 -1
- package/dist/vite-plugins/settings-worker-env.d.ts.map +1 -1
- package/dist/vite-plugins/settings-worker-env.js +4 -4
- package/dist/vite-plugins/settings-worker-env.js.map +1 -1
- package/dist/vite-plugins/settings.d.ts.map +1 -1
- package/dist/vite-plugins/settings.js +25 -14
- package/dist/vite-plugins/settings.js.map +1 -1
- package/dist/vite-plugins/store-links.d.ts.map +1 -1
- package/dist/vite-plugins/store-links.js +9 -5
- package/dist/vite-plugins/store-links.js.map +1 -1
- package/dist/vite-plugins/undeclared-library.d.ts.map +1 -1
- package/dist/vite-plugins/undeclared-library.js +18 -15
- package/dist/vite-plugins/undeclared-library.js.map +1 -1
- package/dist/vite-plugins/worker.d.ts.map +1 -1
- package/dist/vite-plugins/worker.js +21 -13
- package/dist/vite-plugins/worker.js.map +1 -1
- package/dist/vitest-plugin.d.ts +4 -3
- package/dist/vitest-plugin.d.ts.map +1 -1
- package/dist/vitest-plugin.js +12 -8
- package/dist/vitest-plugin.js.map +1 -1
- package/env.d.ts +9 -0
- package/package.json +18 -13
- package/src/builder.ts +45 -12
- package/src/cli.ts +15 -2
- package/src/codegen/config-dependencies.ts +470 -0
- package/src/codegen/freshness.ts +5 -1
- package/src/codegen/reference.ts +1 -0
- package/src/codegen/run-codegen.ts +51 -21
- package/src/codegen/store-resolver.ts +9 -4
- package/src/commands/build.ts +13 -2
- package/src/commands/cleanup.ts +48 -0
- package/src/commands/codegen.ts +6 -5
- package/src/commands/deploy.ts +10 -2
- package/src/commands/dev.ts +45 -4
- package/src/commands/docs.ts +1 -0
- package/src/deploy/depends.ts +30 -3
- package/src/deploy/download.ts +33 -24
- package/src/deploy/freedesktop/metainfo.ts +73 -21
- package/src/deploy/freedesktop/validate.ts +80 -15
- package/src/deploy/native-addon.ts +183 -0
- package/src/deploy/nfpm/config.ts +13 -4
- package/src/deploy/nfpm/contents.ts +8 -0
- package/src/deploy/node-runtime/download.ts +2 -2
- package/src/deploy/node-runtime/elf.ts +46 -5
- package/src/deploy/node-runtime/guard.ts +10 -14
- package/src/deploy/node-runtime/index.ts +148 -12
- package/src/deploy/node-runtime/sonames.ts +17 -0
- package/src/deploy/notices/node-runtime.ts +2 -2
- package/src/deploy/payload/launcher.ts +20 -1
- package/src/deploy/payload/stage.ts +76 -5
- package/src/deploy/run-deploy.ts +227 -72
- package/src/deploy/settings/arch.ts +40 -8
- package/src/deploy/settings/build-manifest.ts +28 -3
- package/src/deploy/settings/extra-files.ts +30 -4
- package/src/deploy/settings/index.ts +7 -2
- package/src/deploy/settings/libraries.ts +2 -1
- package/src/deploy/settings/paths.ts +80 -13
- package/src/deploy/targets/appimage.ts +1 -0
- package/src/deploy/targets/flatpak-pnpm.ts +4 -4
- package/src/deploy/targets/flatpak-source.ts +15 -2
- package/src/deploy/targets/flatpak.ts +1 -0
- package/src/deploy/targets/nfpm-target.ts +14 -6
- package/src/deploy/types.ts +5 -1
- package/src/deploy/vendored/appimagetool.ts +2 -2
- package/src/deploy/vendored/nfpm.ts +1 -1
- package/src/dev/catalog-writes.ts +35 -0
- package/src/dev/entry-env.ts +2 -1
- package/src/dev/font-dir.ts +11 -0
- package/src/dev/headless.ts +40 -0
- package/src/dev/runner-deps.ts +20 -7
- package/src/dev/runner-main.ts +12 -3
- package/src/dev/runner.ts +37 -7
- package/src/dev/supervisor.ts +183 -32
- package/src/dev/vite-dev-server.ts +20 -2
- package/src/dev/watch-ignore.ts +16 -0
- package/src/i18n/catalogs.ts +21 -8
- package/src/i18n/source-messages.ts +1446 -29
- package/src/internal/agent-rules.ts +7 -2
- package/src/internal/banner.ts +27 -6
- package/src/internal/build-manifest.ts +25 -1
- package/src/internal/build-output.ts +171 -0
- package/src/internal/cache-root.ts +12 -0
- package/src/internal/compile-cache-store.ts +50 -0
- package/src/internal/compile-cache.ts +20 -0
- package/src/internal/deploy-out-dir.ts +8 -0
- package/src/internal/docs-elements.ts +10 -4
- package/src/internal/entry-arg.ts +8 -1
- package/src/internal/errors.ts +1 -1
- package/src/internal/font-path.ts +15 -0
- package/src/internal/font-staging.ts +131 -0
- package/src/internal/icon-staging.ts +58 -0
- package/src/internal/import-scan.ts +206 -0
- package/src/internal/module-hash.ts +22 -0
- package/src/internal/output-directory.ts +699 -0
- package/src/internal/parent-process.ts +110 -0
- package/src/internal/prepare-project.ts +11 -5
- package/src/internal/react-compiler-cache.ts +246 -0
- package/src/internal/source-imports.ts +57 -12
- package/src/internal/staging-file.ts +42 -0
- package/src/internal/xdg-banner.ts +13 -0
- package/src/internal/xdg-data-dirs.ts +1 -1
- package/src/mcp/client.ts +2 -2
- package/src/settings/schema.ts +4 -10
- package/src/vite-plugins/asset-extensions.ts +2 -0
- package/src/vite-plugins/asset-imports.ts +23 -5
- package/src/vite-plugins/asset-specifier.ts +17 -0
- package/src/vite-plugins/build-manifest.ts +7 -1
- package/src/vite-plugins/built-url.ts +6 -2
- package/src/vite-plugins/css.ts +16 -5
- package/src/vite-plugins/ensure-store.ts +2 -2
- package/src/vite-plugins/fast-refresh/refresh-filter.ts +10 -1
- package/src/vite-plugins/fast-refresh/swc-refresh.ts +33 -14
- package/src/vite-plugins/font-name.ts +582 -0
- package/src/vite-plugins/font-worker-env.ts +25 -0
- package/src/vite-plugins/font.ts +180 -0
- package/src/vite-plugins/i18n.ts +122 -11
- package/src/vite-plugins/icon-worker-env.ts +36 -0
- package/src/vite-plugins/icons.ts +4 -10
- package/src/vite-plugins/index.ts +34 -9
- package/src/vite-plugins/native.ts +0 -5
- package/src/vite-plugins/react-compiler.ts +83 -19
- package/src/vite-plugins/resource-shared.ts +4 -0
- package/src/vite-plugins/resources.ts +11 -5
- package/src/vite-plugins/self-contained.ts +184 -185
- package/src/vite-plugins/settings-worker-env.ts +4 -4
- package/src/vite-plugins/settings.ts +36 -16
- package/src/vite-plugins/store-links.ts +10 -5
- package/src/vite-plugins/undeclared-library.ts +19 -15
- package/src/vite-plugins/worker.ts +31 -15
- package/src/vitest-plugin.ts +12 -8
package/src/builder.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { loadConfig } from "@gtkx/config";
|
|
2
|
+
import { join, posix, relative, resolve } from "node:path";
|
|
2
3
|
import { type InlineConfig, mergeConfig, build as viteBuild } from "vite";
|
|
3
|
-
import { createBuildManifestCollector } from "./internal/build-manifest.js";
|
|
4
|
+
import { configDigest, createBuildManifestCollector } from "./internal/build-manifest.js";
|
|
4
5
|
import { gtkxBuildManifest } from "./vite-plugins/build-manifest.js";
|
|
5
6
|
import { BUNDLE_FILENAME, ESM_EXTENSION } from "./vite-plugins/esm-extension.js";
|
|
6
7
|
import { gtkxVitePlugins } from "./vite-plugins/index.js";
|
|
@@ -10,6 +11,7 @@ import { gtkxWorker } from "./vite-plugins/worker.js";
|
|
|
10
11
|
|
|
11
12
|
type BuildOptions = {
|
|
12
13
|
entry: string;
|
|
14
|
+
configFile?: string | undefined;
|
|
13
15
|
shouldPreserveI18nMetadata?: boolean | undefined;
|
|
14
16
|
vite?: InlineConfig | undefined;
|
|
15
17
|
};
|
|
@@ -27,23 +29,33 @@ const buildDefaults: InlineConfig = {
|
|
|
27
29
|
minify: true,
|
|
28
30
|
cssMinify: false,
|
|
29
31
|
},
|
|
30
|
-
define: {
|
|
31
|
-
"process.env.NODE_ENV": JSON.stringify(BUILD_MODE),
|
|
32
|
-
},
|
|
33
32
|
};
|
|
34
33
|
|
|
35
|
-
const
|
|
36
|
-
const { entry, shouldPreserveI18nMetadata = true
|
|
37
|
-
const root = viteConfig?.root ?? process.cwd();
|
|
38
|
-
const assetsDir = viteConfig?.build?.assetsDir ?? DEFAULT_ASSETS_DIR;
|
|
34
|
+
const forcedConfig = async (options: BuildOptions, root: string, assetsDir: string): Promise<InlineConfig> => {
|
|
35
|
+
const { entry, shouldPreserveI18nMetadata = true } = options;
|
|
39
36
|
const buildManifest = createBuildManifestCollector();
|
|
37
|
+
const loadedConfig = await loadConfig(root, { mode: BUILD_MODE, configFile: options.configFile });
|
|
38
|
+
const buildConfigIdentity = {
|
|
39
|
+
configFile: posix.normalize(relative(root, loadedConfig.configFile).replaceAll("\\", "/")),
|
|
40
|
+
configDigest: configDigest(loadedConfig.config),
|
|
41
|
+
};
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
return {
|
|
44
|
+
mode: BUILD_MODE,
|
|
45
|
+
define: {
|
|
46
|
+
"process.env.NODE_ENV": JSON.stringify(BUILD_MODE),
|
|
47
|
+
},
|
|
42
48
|
plugins: [
|
|
43
|
-
...gtkxVitePlugins(
|
|
49
|
+
...gtkxVitePlugins({
|
|
50
|
+
mode: BUILD_MODE,
|
|
51
|
+
entryPath: entry,
|
|
52
|
+
buildManifest,
|
|
53
|
+
shouldPreserveI18nMetadata,
|
|
54
|
+
configFile: options.configFile,
|
|
55
|
+
}),
|
|
44
56
|
gtkxWorker(),
|
|
45
57
|
gtkxNative(root),
|
|
46
|
-
gtkxBuildManifest(root, buildManifest),
|
|
58
|
+
gtkxBuildManifest(root, buildManifest, buildConfigIdentity),
|
|
47
59
|
gtkxSelfContained(),
|
|
48
60
|
],
|
|
49
61
|
build: {
|
|
@@ -58,11 +70,32 @@ const build = async (options: BuildOptions): Promise<string> => {
|
|
|
58
70
|
},
|
|
59
71
|
},
|
|
60
72
|
};
|
|
73
|
+
};
|
|
61
74
|
|
|
75
|
+
const buildProduction = async (options: BuildOptions): Promise<string> => {
|
|
76
|
+
const viteConfig = options.vite;
|
|
77
|
+
const root = resolve(viteConfig?.root ?? process.cwd());
|
|
78
|
+
const assetsDir = viteConfig?.build?.assetsDir ?? DEFAULT_ASSETS_DIR;
|
|
79
|
+
const forced = await forcedConfig(options, root, assetsDir);
|
|
62
80
|
const merged: InlineConfig = mergeConfig(mergeConfig(buildDefaults, viteConfig ?? {}), forced);
|
|
63
81
|
await viteBuild({ ...merged, ssr: { ...merged.ssr, noExternal: true } });
|
|
64
82
|
|
|
65
83
|
return join(merged.build?.outDir ?? DEFAULT_OUT_DIR, ENTRY_FILE_NAMES);
|
|
66
84
|
};
|
|
67
85
|
|
|
86
|
+
const build = async (options: BuildOptions): Promise<string> => {
|
|
87
|
+
const callerNodeEnv = process.env.NODE_ENV;
|
|
88
|
+
process.env.NODE_ENV = BUILD_MODE;
|
|
89
|
+
|
|
90
|
+
try {
|
|
91
|
+
return await buildProduction(options);
|
|
92
|
+
} finally {
|
|
93
|
+
if (callerNodeEnv === undefined) {
|
|
94
|
+
delete process.env.NODE_ENV;
|
|
95
|
+
} else {
|
|
96
|
+
process.env.NODE_ENV = callerNodeEnv;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
68
101
|
export { build };
|
package/src/cli.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
import { assertSupportedNodeVersion } from "@gtkx/config/internal";
|
|
1
2
|
import { defineCommand, runMain } from "citty";
|
|
2
3
|
import packageManifest from "../package.json" with { type: "json" };
|
|
3
4
|
import { splitApplicationArgs } from "./internal/application-args.js";
|
|
4
|
-
import { withErrorBoundary } from "./internal/errors.js";
|
|
5
|
+
import { printError, withErrorBoundary } from "./internal/errors.js";
|
|
6
|
+
import "./internal/parent-process.js";
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
assertSupportedNodeVersion();
|
|
10
|
+
} catch (error) {
|
|
11
|
+
printError(error);
|
|
12
|
+
}
|
|
5
13
|
|
|
6
14
|
const version = packageManifest.version;
|
|
7
15
|
const { cliArgs } = splitApplicationArgs(process.argv.slice(2));
|
|
@@ -10,7 +18,7 @@ const main = defineCommand({
|
|
|
10
18
|
meta: {
|
|
11
19
|
name: "gtkx",
|
|
12
20
|
version,
|
|
13
|
-
description: "CLI for GTKX: create and develop
|
|
21
|
+
description: "CLI for GTKX: create and develop Adwaita-first GNOME applications",
|
|
14
22
|
},
|
|
15
23
|
subCommands: {
|
|
16
24
|
dev: async () => {
|
|
@@ -48,6 +56,11 @@ const main = defineCommand({
|
|
|
48
56
|
|
|
49
57
|
return withErrorBoundary(scaffoldCommand);
|
|
50
58
|
},
|
|
59
|
+
cleanup: async () => {
|
|
60
|
+
const { cleanup } = await import("./commands/cleanup.js");
|
|
61
|
+
|
|
62
|
+
return withErrorBoundary(cleanup);
|
|
63
|
+
},
|
|
51
64
|
},
|
|
52
65
|
});
|
|
53
66
|
|
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
import { parseSync, traverse, types } from "@babel/core";
|
|
2
|
+
import { parseJSON, parseJSON5, parseJSONC, parseTOML, parseYAML } from "confbox";
|
|
3
|
+
import { createJiti, type Jiti } from "jiti";
|
|
4
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
5
|
+
import { basename, dirname, extname, isAbsolute, join, resolve, sep } from "node:path";
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
|
+
|
|
8
|
+
const MODULE_EXTENSIONS: ReadonlySet<string> = new Set([
|
|
9
|
+
".cjs",
|
|
10
|
+
".cts",
|
|
11
|
+
".js",
|
|
12
|
+
".mjs",
|
|
13
|
+
".mts",
|
|
14
|
+
".ts",
|
|
15
|
+
]);
|
|
16
|
+
const RESOLVABLE_EXTENSIONS = [
|
|
17
|
+
".js",
|
|
18
|
+
".ts",
|
|
19
|
+
".mjs",
|
|
20
|
+
".cjs",
|
|
21
|
+
".mts",
|
|
22
|
+
".cts",
|
|
23
|
+
".json",
|
|
24
|
+
".jsonc",
|
|
25
|
+
".json5",
|
|
26
|
+
".yaml",
|
|
27
|
+
".yml",
|
|
28
|
+
".toml",
|
|
29
|
+
];
|
|
30
|
+
const JAVASCRIPT_FALLBACKS: Readonly<Record<string, string[]>> = {
|
|
31
|
+
".cjs": [".cts"],
|
|
32
|
+
".js": [".ts"],
|
|
33
|
+
".jsx": [".tsx"],
|
|
34
|
+
".mjs": [".mts"],
|
|
35
|
+
};
|
|
36
|
+
const DATA_PARSERS: Readonly<Record<string, (source: string) => unknown>> = {
|
|
37
|
+
".json": parseJSON,
|
|
38
|
+
".json5": parseJSON5,
|
|
39
|
+
".jsonc": parseJSONC,
|
|
40
|
+
".toml": parseTOML,
|
|
41
|
+
".yaml": parseYAML,
|
|
42
|
+
".yml": parseYAML,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
type PackageImports = { file: string; imports: Record<string, unknown>; root: string };
|
|
46
|
+
type ModuleSources = { all: string[]; extended: string[] };
|
|
47
|
+
|
|
48
|
+
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
49
|
+
typeof value === "object" && value !== null && !Array.isArray(value);
|
|
50
|
+
|
|
51
|
+
const parserPlugins = (path: string): ("decorators" | "jsx" | "typescript")[] => {
|
|
52
|
+
const extension = extname(path).toLowerCase();
|
|
53
|
+
|
|
54
|
+
return [
|
|
55
|
+
"decorators",
|
|
56
|
+
...([".cts", ".mts", ".ts"].includes(extension) ? ["typescript" as const] : []),
|
|
57
|
+
];
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
function expressionSources(value: types.Expression): string[] {
|
|
61
|
+
if (types.isStringLiteral(value)) {
|
|
62
|
+
return [value.value];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (types.isArrayExpression(value)) {
|
|
66
|
+
return value.elements.flatMap((element) =>
|
|
67
|
+
types.isExpression(element) ? expressionSources(element) : []);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return types.isObjectExpression(value)
|
|
71
|
+
? value.properties.flatMap((property) => sourcePropertySources(property))
|
|
72
|
+
: [];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const isNamedProperty = (property: types.ObjectProperty, name: string): boolean =>
|
|
76
|
+
(types.isIdentifier(property.key) && property.key.name === name) ||
|
|
77
|
+
(types.isStringLiteral(property.key) && property.key.value === name);
|
|
78
|
+
|
|
79
|
+
function sourcePropertySources(
|
|
80
|
+
property: types.ObjectMethod | types.ObjectProperty | types.SpreadElement,
|
|
81
|
+
): string[] {
|
|
82
|
+
return types.isObjectProperty(property) &&
|
|
83
|
+
isNamedProperty(property, "source") &&
|
|
84
|
+
types.isExpression(property.value)
|
|
85
|
+
? expressionSources(property.value)
|
|
86
|
+
: [];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const extendsSources = (value: types.Expression): string[] => expressionSources(value);
|
|
90
|
+
|
|
91
|
+
const isExtendsProperty = (property: types.ObjectProperty): boolean =>
|
|
92
|
+
isNamedProperty(property, "extends");
|
|
93
|
+
|
|
94
|
+
type ParsedModule = NonNullable<ReturnType<typeof parseSync>>;
|
|
95
|
+
|
|
96
|
+
const parseModule = (path: string): ParsedModule | undefined => {
|
|
97
|
+
try {
|
|
98
|
+
return parseSync(readFileSync(path, "utf8"), {
|
|
99
|
+
ast: true,
|
|
100
|
+
babelrc: false,
|
|
101
|
+
configFile: false,
|
|
102
|
+
filename: path,
|
|
103
|
+
parserOpts: { allowReturnOutsideFunction: true, plugins: parserPlugins(path) },
|
|
104
|
+
sourceType: "unambiguous",
|
|
105
|
+
}) ?? undefined;
|
|
106
|
+
} catch {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const addSource = (sources: Set<string>, source: types.StringLiteral | null | undefined): void => {
|
|
112
|
+
if (source !== null && source !== undefined) {
|
|
113
|
+
sources.add(source.value);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const requireSource = (call: types.CallExpression): types.StringLiteral | undefined =>
|
|
118
|
+
types.isIdentifier(call.callee, { name: "require" }) && types.isStringLiteral(call.arguments[0])
|
|
119
|
+
? call.arguments[0]
|
|
120
|
+
: undefined;
|
|
121
|
+
|
|
122
|
+
const importEqualsSource = (declaration: types.TSImportEqualsDeclaration): types.StringLiteral | undefined => {
|
|
123
|
+
const { moduleReference } = declaration;
|
|
124
|
+
|
|
125
|
+
return types.isTSExternalModuleReference(moduleReference) ? moduleReference.expression : undefined;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const propertySources = (property: types.ObjectProperty): string[] =>
|
|
129
|
+
isExtendsProperty(property) && types.isExpression(property.value)
|
|
130
|
+
? extendsSources(property.value)
|
|
131
|
+
: [];
|
|
132
|
+
|
|
133
|
+
const collectModuleSources = (ast: ParsedModule): ModuleSources => {
|
|
134
|
+
const sources: Set<string> = new Set();
|
|
135
|
+
const extended: Set<string> = new Set();
|
|
136
|
+
|
|
137
|
+
traverse(ast, {
|
|
138
|
+
CallExpression: (nodePath) => {
|
|
139
|
+
addSource(sources, requireSource(nodePath.node));
|
|
140
|
+
},
|
|
141
|
+
ExportAllDeclaration: (nodePath) => {
|
|
142
|
+
addSource(sources, nodePath.node.source);
|
|
143
|
+
},
|
|
144
|
+
ExportNamedDeclaration: (nodePath) => {
|
|
145
|
+
addSource(sources, nodePath.node.source);
|
|
146
|
+
},
|
|
147
|
+
ImportDeclaration: (nodePath) => {
|
|
148
|
+
addSource(sources, nodePath.node.source);
|
|
149
|
+
},
|
|
150
|
+
ImportExpression: (nodePath) => {
|
|
151
|
+
const { source } = nodePath.node;
|
|
152
|
+
addSource(sources, types.isStringLiteral(source) ? source : undefined);
|
|
153
|
+
},
|
|
154
|
+
ObjectProperty: (nodePath) => {
|
|
155
|
+
for (const source of propertySources(nodePath.node)) {
|
|
156
|
+
sources.add(source);
|
|
157
|
+
extended.add(source);
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
TSImportEqualsDeclaration: (nodePath) => {
|
|
161
|
+
addSource(sources, importEqualsSource(nodePath.node));
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
return { all: [...sources], extended: [...extended] };
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const moduleSources = (path: string): ModuleSources => {
|
|
169
|
+
const ast = parseModule(path);
|
|
170
|
+
|
|
171
|
+
return ast === undefined ? { all: [], extended: [] } : collectModuleSources(ast);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
function parsedExtendsSources(value: unknown): string[] {
|
|
175
|
+
if (typeof value === "string") {
|
|
176
|
+
return [value];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (Array.isArray(value)) {
|
|
180
|
+
return value.flatMap((item) => parsedExtendsSources(item));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return objectExtendsSources(value);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const objectExtendsSources = (value: unknown): string[] => {
|
|
187
|
+
if (typeof value !== "object" || value === null) {
|
|
188
|
+
return [];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return "source" in value ? parsedExtendsSources(value.source) : [];
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const configExtendsSources = (value: unknown): string[] => {
|
|
195
|
+
if (typeof value !== "object" || value === null) {
|
|
196
|
+
return [];
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return "extends" in value ? parsedExtendsSources(value.extends) : [];
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const dataSources = (path: string): string[] => {
|
|
203
|
+
const parser = DATA_PARSERS[extname(path).toLowerCase()];
|
|
204
|
+
|
|
205
|
+
if (parser === undefined) {
|
|
206
|
+
return [];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
try {
|
|
210
|
+
return configExtendsSources(parser(readFileSync(path, "utf8")));
|
|
211
|
+
} catch {
|
|
212
|
+
return [];
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const extensionCandidates = (path: string): string[] => {
|
|
217
|
+
const extension = extname(path).toLowerCase();
|
|
218
|
+
|
|
219
|
+
if (extension.length === 0) {
|
|
220
|
+
return RESOLVABLE_EXTENSIONS.map((candidate) => `${path}${candidate}`);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const stem = path.slice(0, -extension.length);
|
|
224
|
+
|
|
225
|
+
return (JAVASCRIPT_FALLBACKS[extension] ?? []).map((candidate) => `${stem}${candidate}`);
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const targetCandidates = (target: string, configName: string): string[] => {
|
|
229
|
+
const extension = extname(target);
|
|
230
|
+
|
|
231
|
+
if (extension.length > 0) {
|
|
232
|
+
return [target, ...extensionCandidates(target)];
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return [
|
|
236
|
+
target,
|
|
237
|
+
...extensionCandidates(target),
|
|
238
|
+
join(target, configName),
|
|
239
|
+
...RESOLVABLE_EXTENSIONS.map((candidate) => join(target, `index${candidate}`)),
|
|
240
|
+
];
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const localSourceTarget = (source: string, importer: string): string | undefined => {
|
|
244
|
+
const clean = source.split(/[?#]/u, 1)[0] ?? "";
|
|
245
|
+
|
|
246
|
+
if (clean.startsWith("file:")) {
|
|
247
|
+
return fileURLToPath(clean);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (!isAbsolute(clean) && !clean.startsWith(".")) {
|
|
251
|
+
return undefined;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return resolve(dirname(importer), clean);
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
const unresolvedCandidates = (source: string, importer: string, configName: string): string[] => {
|
|
258
|
+
const target = localSourceTarget(source, importer);
|
|
259
|
+
|
|
260
|
+
if (target === undefined) {
|
|
261
|
+
return [];
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return targetCandidates(target, configName);
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
const nearestPackageFile = (importer: string): string | undefined => {
|
|
268
|
+
let directory = dirname(importer);
|
|
269
|
+
let previous = "";
|
|
270
|
+
|
|
271
|
+
while (directory !== previous) {
|
|
272
|
+
const candidate = join(directory, "package.json");
|
|
273
|
+
|
|
274
|
+
if (existsSync(candidate)) {
|
|
275
|
+
return candidate;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
previous = directory;
|
|
279
|
+
directory = dirname(directory);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return undefined;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
const readPackageImports = (importer: string): PackageImports | undefined => {
|
|
286
|
+
const file = nearestPackageFile(importer);
|
|
287
|
+
|
|
288
|
+
if (file === undefined) {
|
|
289
|
+
return undefined;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
try {
|
|
293
|
+
const manifest = parseJSON(readFileSync(file, "utf8"));
|
|
294
|
+
|
|
295
|
+
return isRecord(manifest) && isRecord(manifest.imports)
|
|
296
|
+
? { file, imports: manifest.imports, root: dirname(file) }
|
|
297
|
+
: undefined;
|
|
298
|
+
} catch {
|
|
299
|
+
return undefined;
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
function stringTargets(value: unknown): string[] {
|
|
304
|
+
if (typeof value === "string") {
|
|
305
|
+
return [value];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (Array.isArray(value)) {
|
|
309
|
+
return value.flatMap((item) => stringTargets(item));
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return isRecord(value)
|
|
313
|
+
? Object.values(value).flatMap((item) => stringTargets(item))
|
|
314
|
+
: [];
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
const importPatternMatch = (pattern: string, source: string): string | undefined => {
|
|
318
|
+
if (pattern === source) {
|
|
319
|
+
return "";
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const wildcard = pattern.indexOf("*");
|
|
323
|
+
|
|
324
|
+
if (wildcard === -1) {
|
|
325
|
+
return undefined;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const prefix = pattern.slice(0, wildcard);
|
|
329
|
+
const suffix = pattern.slice(wildcard + 1);
|
|
330
|
+
|
|
331
|
+
return source.startsWith(prefix) && source.endsWith(suffix)
|
|
332
|
+
? source.slice(prefix.length, source.length - suffix.length)
|
|
333
|
+
: undefined;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const packageImportTargets = (source: string, imports: Record<string, unknown>): string[] =>
|
|
337
|
+
Object.entries(imports).flatMap(([pattern, value]) => {
|
|
338
|
+
const match = importPatternMatch(pattern, source);
|
|
339
|
+
|
|
340
|
+
return match === undefined
|
|
341
|
+
? []
|
|
342
|
+
: stringTargets(value).map((target) => target.split("*").join(match));
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
const packageImportDependencies = (source: string, importer: string, configName: string): string[] => {
|
|
346
|
+
if (!source.startsWith("#")) {
|
|
347
|
+
return [];
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const packageImports = readPackageImports(importer);
|
|
351
|
+
|
|
352
|
+
if (packageImports === undefined) {
|
|
353
|
+
return [];
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
const targets = packageImportTargets(source, packageImports.imports)
|
|
357
|
+
.filter((target) => target.startsWith("."))
|
|
358
|
+
.flatMap((target) => targetCandidates(resolve(packageImports.root, target), configName));
|
|
359
|
+
|
|
360
|
+
return [packageImports.file, ...targets];
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
const normalizedResolvedPath = (path: string): string =>
|
|
364
|
+
path.startsWith("file:") ? fileURLToPath(path) : path;
|
|
365
|
+
|
|
366
|
+
const resolvedSourcePath = (source: string, importer: string, jiti: Jiti): string | undefined => {
|
|
367
|
+
try {
|
|
368
|
+
const path = jiti.esmResolve(source, {
|
|
369
|
+
parentURL: pathToFileURL(importer).href,
|
|
370
|
+
try: true,
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
return path === undefined ? undefined : normalizedResolvedPath(path);
|
|
374
|
+
} catch {
|
|
375
|
+
return undefined;
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
const sourceDependencies = (
|
|
380
|
+
source: string,
|
|
381
|
+
importer: string,
|
|
382
|
+
configName: string,
|
|
383
|
+
jiti: Jiti,
|
|
384
|
+
): string[] => {
|
|
385
|
+
const dependency = resolvedSourcePath(source, importer, jiti);
|
|
386
|
+
const packageDependencies = packageImportDependencies(source, importer, configName);
|
|
387
|
+
|
|
388
|
+
return dependency === undefined
|
|
389
|
+
? [...unresolvedCandidates(source, importer, configName), ...packageDependencies]
|
|
390
|
+
: [dependency, ...packageDependencies];
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
const configLayerDirectory = (path: string, configName: string, configRoot: string): string => {
|
|
394
|
+
const segments = configName.split(/[\\/]/u).filter((segment) => segment.length > 0);
|
|
395
|
+
let directory = resolve(path);
|
|
396
|
+
let remaining = segments.length;
|
|
397
|
+
|
|
398
|
+
while (remaining > 0) {
|
|
399
|
+
directory = dirname(directory);
|
|
400
|
+
remaining -= 1;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
return resolve(directory, ...segments) === resolve(path) ? directory : resolve(configRoot);
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
const c12SourceDependencies = (
|
|
407
|
+
source: string,
|
|
408
|
+
importer: string,
|
|
409
|
+
configName: string,
|
|
410
|
+
configRoot: string,
|
|
411
|
+
): string[] => {
|
|
412
|
+
const clean = source.split(/[?#]/u, 1)[0] ?? "";
|
|
413
|
+
|
|
414
|
+
if (clean === "." || (!isAbsolute(clean) && !clean.startsWith("."))) {
|
|
415
|
+
return [];
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const cwd = configLayerDirectory(importer, configName, configRoot);
|
|
419
|
+
const extension = extname(clean);
|
|
420
|
+
const target = (extension.length === 0 || extension === basename(clean))
|
|
421
|
+
? resolve(cwd, clean, configName)
|
|
422
|
+
: resolve(cwd, clean);
|
|
423
|
+
|
|
424
|
+
return targetCandidates(target, configName);
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
const directDependencies = (path: string, configName: string, configRoot: string): string[] => {
|
|
428
|
+
const module = MODULE_EXTENSIONS.has(extname(path).toLowerCase()) ? moduleSources(path) : undefined;
|
|
429
|
+
const sources = module?.all ?? dataSources(path);
|
|
430
|
+
const extended = module?.extended ?? sources;
|
|
431
|
+
const jiti = createJiti(path, {
|
|
432
|
+
extensions: RESOLVABLE_EXTENSIONS,
|
|
433
|
+
fsCache: false,
|
|
434
|
+
moduleCache: false,
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
return [
|
|
438
|
+
...sources.flatMap((source) => sourceDependencies(source, path, configName, jiti)),
|
|
439
|
+
...extended.flatMap((source) => c12SourceDependencies(source, path, configName, configRoot)),
|
|
440
|
+
]
|
|
441
|
+
.filter((dependency) => !dependency.includes(`${sep}node_modules${sep}`));
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
const resolveConfigDependencies = (
|
|
445
|
+
configFile: string,
|
|
446
|
+
configName = basename(configFile),
|
|
447
|
+
configRoot = dirname(configFile),
|
|
448
|
+
): string[] => {
|
|
449
|
+
const dependencies: Set<string> = new Set();
|
|
450
|
+
const pending = [resolve(configFile)];
|
|
451
|
+
|
|
452
|
+
while (pending.length > 0) {
|
|
453
|
+
const path = pending.pop();
|
|
454
|
+
|
|
455
|
+
if (path === undefined) {
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
if (dependencies.has(path)) {
|
|
460
|
+
continue;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
dependencies.add(path);
|
|
464
|
+
pending.push(...directDependencies(path, configName, configRoot));
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
return [...dependencies];
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
export { resolveConfigDependencies };
|
package/src/codegen/freshness.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Config } from "@gtkx/config";
|
|
2
2
|
import { resolveGirPath, resolveLibraries } from "@gtkx/codegen";
|
|
3
|
+
import { resolveBoundLibraries } from "@gtkx/codegen/internal";
|
|
3
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
5
|
import { basename, dirname, join } from "node:path";
|
|
5
6
|
import { type CodegenStore, resolveCodegenStore } from "./store-resolver.js";
|
|
@@ -86,7 +87,10 @@ const hasStoreExports = (storeDir: string, required: string[], forbidden: string
|
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
const isGiStoreStale = (store: CodegenStore, libraries: string[]): boolean => {
|
|
89
|
-
const required = [
|
|
90
|
+
const required = [
|
|
91
|
+
PACKAGE_EXPORT,
|
|
92
|
+
...resolveBoundLibraries(libraries).map((library) => namespaceExport(library)),
|
|
93
|
+
];
|
|
90
94
|
|
|
91
95
|
return !hasStoreExports(store.giStoreDir, required);
|
|
92
96
|
};
|
package/src/codegen/reference.ts
CHANGED
|
@@ -38,6 +38,7 @@ const writeReference = async (options: WriteReferenceOptions): Promise<Reference
|
|
|
38
38
|
basePath: REFERENCE_PATH,
|
|
39
39
|
linkStyle: "file",
|
|
40
40
|
props: builtin.props,
|
|
41
|
+
acceptedChildTypes: builtin.acceptedChildTypes,
|
|
41
42
|
omittedProps: mergeOmittedProps(builtin.omittedProps, resolveOmittedProps(config.elements)),
|
|
42
43
|
isForced: options.isForced === true,
|
|
43
44
|
});
|