@gtkx/cli 0.20.0 → 1.0.0-rc.1
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 +173 -0
- package/bin/gtkx-dev-runner.js +9 -0
- package/dist/builder.d.ts +2 -50
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +22 -48
- package/dist/builder.js.map +1 -1
- package/dist/cli.d.ts +1 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +11 -124
- package/dist/cli.js.map +1 -1
- package/dist/codegen/freshness.d.ts +11 -0
- package/dist/codegen/freshness.d.ts.map +1 -0
- package/dist/codegen/freshness.js +42 -0
- package/dist/codegen/freshness.js.map +1 -0
- package/dist/codegen/report.d.ts +3 -0
- package/dist/codegen/report.d.ts.map +1 -0
- package/dist/codegen/report.js +16 -0
- package/dist/codegen/report.js.map +1 -0
- package/dist/codegen/run-codegen.d.ts +35 -0
- package/dist/codegen/run-codegen.d.ts.map +1 -0
- package/dist/codegen/run-codegen.js +133 -0
- package/dist/codegen/run-codegen.js.map +1 -0
- package/dist/codegen/store-resolver.d.ts +21 -0
- package/dist/codegen/store-resolver.d.ts.map +1 -0
- package/dist/codegen/store-resolver.js +52 -0
- package/dist/codegen/store-resolver.js.map +1 -0
- package/dist/commands/build.d.ts +9 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +33 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/codegen.d.ts +9 -0
- package/dist/commands/codegen.d.ts.map +1 -0
- package/dist/commands/codegen.js +40 -0
- package/dist/commands/codegen.js.map +1 -0
- package/dist/commands/dev.d.ts +5 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +21 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/docs.d.ts +19 -0
- package/dist/commands/docs.d.ts.map +1 -0
- package/dist/commands/docs.js +59 -0
- package/dist/commands/docs.js.map +1 -0
- package/dist/dev/icon-dir.d.ts +2 -0
- package/dist/dev/icon-dir.d.ts.map +1 -0
- package/dist/dev/icon-dir.js +13 -0
- package/dist/dev/icon-dir.js.map +1 -0
- package/dist/dev/refresh-tracker.d.ts +6 -0
- package/dist/dev/refresh-tracker.d.ts.map +1 -0
- package/dist/dev/refresh-tracker.js +18 -0
- package/dist/dev/refresh-tracker.js.map +1 -0
- package/dist/dev/runner-deps.d.ts +3 -0
- package/dist/dev/runner-deps.d.ts.map +1 -0
- package/dist/dev/runner-deps.js +39 -0
- package/dist/dev/runner-deps.js.map +1 -0
- package/dist/dev/runner-main.d.ts +2 -0
- package/dist/dev/runner-main.d.ts.map +1 -0
- package/dist/dev/runner-main.js +28 -0
- package/dist/dev/runner-main.js.map +1 -0
- package/dist/dev/runner.d.ts +23 -0
- package/dist/dev/runner.d.ts.map +1 -0
- package/dist/dev/runner.js +88 -0
- package/dist/dev/runner.js.map +1 -0
- package/dist/dev/schema-dir.d.ts +2 -0
- package/dist/dev/schema-dir.d.ts.map +1 -0
- package/dist/dev/schema-dir.js +10 -0
- package/dist/dev/schema-dir.js.map +1 -0
- package/dist/dev/supervisor.d.ts +17 -0
- package/dist/dev/supervisor.d.ts.map +1 -0
- package/dist/dev/supervisor.js +142 -0
- package/dist/dev/supervisor.js.map +1 -0
- package/dist/dev/vite-dev-server.d.ts +21 -0
- package/dist/dev/vite-dev-server.d.ts.map +1 -0
- package/dist/dev/vite-dev-server.js +12 -0
- package/dist/dev/vite-dev-server.js.map +1 -0
- package/dist/internal/banner.d.ts +3 -0
- package/dist/internal/banner.d.ts.map +1 -0
- package/dist/internal/banner.js +8 -0
- package/dist/internal/banner.js.map +1 -0
- package/dist/internal/data-dir.d.ts +3 -0
- package/dist/internal/data-dir.d.ts.map +1 -0
- package/dist/internal/data-dir.js +37 -0
- package/dist/internal/data-dir.js.map +1 -0
- package/dist/internal/entry-arg.d.ts +19 -0
- package/dist/internal/entry-arg.d.ts.map +1 -0
- package/dist/internal/entry-arg.js +33 -0
- package/dist/internal/entry-arg.js.map +1 -0
- package/dist/internal/errors.d.ts +4 -0
- package/dist/internal/errors.d.ts.map +1 -0
- package/dist/internal/errors.js +27 -0
- package/dist/internal/errors.js.map +1 -0
- package/dist/internal/list-files.d.ts +6 -0
- package/dist/internal/list-files.d.ts.map +1 -0
- package/dist/internal/list-files.js +13 -0
- package/dist/internal/list-files.js.map +1 -0
- package/dist/internal/resolve-cli-tool.d.ts +2 -0
- package/dist/internal/resolve-cli-tool.d.ts.map +1 -0
- package/dist/internal/resolve-cli-tool.js +20 -0
- package/dist/internal/resolve-cli-tool.js.map +1 -0
- package/dist/internal/staging-dir.d.ts +3 -0
- package/dist/internal/staging-dir.d.ts.map +1 -0
- package/dist/internal/staging-dir.js +16 -0
- package/dist/internal/staging-dir.js.map +1 -0
- package/dist/internal/xdg-data-dirs.d.ts +2 -0
- package/dist/internal/xdg-data-dirs.d.ts.map +1 -0
- package/dist/internal/xdg-data-dirs.js +8 -0
- package/dist/internal/xdg-data-dirs.js.map +1 -0
- package/dist/mcp/client.d.ts +23 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/client.js +157 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/handlers.d.ts +8 -0
- package/dist/mcp/handlers.d.ts.map +1 -0
- package/dist/mcp/handlers.js +119 -0
- package/dist/mcp/handlers.js.map +1 -0
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +17 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/serialize-widget.d.ts +10 -0
- package/dist/mcp/serialize-widget.d.ts.map +1 -0
- package/dist/mcp/serialize-widget.js +20 -0
- package/dist/mcp/serialize-widget.js.map +1 -0
- package/dist/mcp/testing-loader.d.ts +6 -0
- package/dist/mcp/testing-loader.d.ts.map +1 -0
- package/dist/mcp/testing-loader.js +25 -0
- package/dist/mcp/testing-loader.js.map +1 -0
- package/dist/mcp/widget-registry.d.ts +13 -0
- package/dist/mcp/widget-registry.d.ts.map +1 -0
- package/dist/mcp/widget-registry.js +38 -0
- package/dist/mcp/widget-registry.js.map +1 -0
- package/dist/refresh-runtime.d.ts +10 -20
- package/dist/refresh-runtime.d.ts.map +1 -1
- package/dist/refresh-runtime.js +12 -36
- package/dist/refresh-runtime.js.map +1 -1
- package/dist/settings/compile.d.ts +2 -0
- package/dist/settings/compile.d.ts.map +1 -0
- package/dist/settings/compile.js +19 -0
- package/dist/settings/compile.js.map +1 -0
- package/dist/settings/parser.d.ts +23 -0
- package/dist/settings/parser.d.ts.map +1 -0
- package/dist/settings/parser.js +117 -0
- package/dist/settings/parser.js.map +1 -0
- package/dist/settings/render.d.ts +4 -0
- package/dist/settings/render.d.ts.map +1 -0
- package/dist/settings/render.js +148 -0
- package/dist/settings/render.js.map +1 -0
- package/dist/settings/schema.d.ts +13 -0
- package/dist/settings/schema.d.ts.map +1 -0
- package/dist/settings/schema.js +103 -0
- package/dist/settings/schema.js.map +1 -0
- package/dist/vite-plugins/asset-extensions.d.ts +4 -0
- package/dist/vite-plugins/asset-extensions.d.ts.map +1 -0
- package/dist/vite-plugins/asset-extensions.js +27 -0
- package/dist/vite-plugins/asset-extensions.js.map +1 -0
- package/dist/vite-plugins/built-url.d.ts +3 -0
- package/dist/vite-plugins/built-url.d.ts.map +1 -0
- package/dist/{vite-plugin-gtkx-built-url.js → vite-plugins/built-url.js} +4 -17
- package/dist/vite-plugins/built-url.js.map +1 -0
- package/dist/vite-plugins/css.d.ts +3 -0
- package/dist/vite-plugins/css.d.ts.map +1 -0
- package/dist/vite-plugins/css.js +30 -0
- package/dist/vite-plugins/css.js.map +1 -0
- package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts +7 -0
- package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts.map +1 -0
- package/dist/vite-plugins/fast-refresh/refresh-filter.js +15 -0
- package/dist/vite-plugins/fast-refresh/refresh-filter.js.map +1 -0
- package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts +5 -0
- package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts.map +1 -0
- package/dist/vite-plugins/fast-refresh/swc-refresh.js +66 -0
- package/dist/vite-plugins/fast-refresh/swc-refresh.js.map +1 -0
- package/dist/vite-plugins/icons.d.ts +3 -0
- package/dist/vite-plugins/icons.d.ts.map +1 -0
- package/dist/vite-plugins/icons.js +47 -0
- package/dist/vite-plugins/icons.js.map +1 -0
- package/dist/vite-plugins/index.d.ts +3 -0
- package/dist/vite-plugins/index.d.ts.map +1 -0
- package/dist/vite-plugins/index.js +21 -0
- package/dist/vite-plugins/index.js.map +1 -0
- package/dist/vite-plugins/native.d.ts +3 -0
- package/dist/vite-plugins/native.d.ts.map +1 -0
- package/dist/vite-plugins/native.js +60 -0
- package/dist/vite-plugins/native.js.map +1 -0
- package/dist/vite-plugins/react-compiler.d.ts +4 -0
- package/dist/vite-plugins/react-compiler.d.ts.map +1 -0
- package/dist/vite-plugins/react-compiler.js +56 -0
- package/dist/vite-plugins/react-compiler.js.map +1 -0
- package/dist/vite-plugins/react-dom-prebundle.d.ts +3 -0
- package/dist/vite-plugins/react-dom-prebundle.d.ts.map +1 -0
- package/dist/vite-plugins/react-dom-prebundle.js +11 -0
- package/dist/vite-plugins/react-dom-prebundle.js.map +1 -0
- package/dist/vite-plugins/resource-init-module.d.ts +5 -0
- package/dist/vite-plugins/resource-init-module.d.ts.map +1 -0
- package/dist/vite-plugins/resource-init-module.js +50 -0
- package/dist/vite-plugins/resource-init-module.js.map +1 -0
- package/dist/vite-plugins/resource-shared.d.ts +6 -0
- package/dist/vite-plugins/resource-shared.d.ts.map +1 -0
- package/dist/vite-plugins/resource-shared.js +21 -0
- package/dist/vite-plugins/resource-shared.js.map +1 -0
- package/dist/vite-plugins/resources.d.ts +4 -0
- package/dist/vite-plugins/resources.d.ts.map +1 -0
- package/dist/vite-plugins/resources.js +220 -0
- package/dist/vite-plugins/resources.js.map +1 -0
- package/dist/vite-plugins/settings-worker-env.d.ts +3 -0
- package/dist/vite-plugins/settings-worker-env.d.ts.map +1 -0
- package/dist/vite-plugins/settings-worker-env.js +21 -0
- package/dist/vite-plugins/settings-worker-env.js.map +1 -0
- package/dist/vite-plugins/settings.d.ts +3 -0
- package/dist/vite-plugins/settings.d.ts.map +1 -0
- package/dist/vite-plugins/settings.js +190 -0
- package/dist/vite-plugins/settings.js.map +1 -0
- package/dist/vite-plugins/undeclared-library.d.ts +3 -0
- package/dist/vite-plugins/undeclared-library.d.ts.map +1 -0
- package/dist/vite-plugins/undeclared-library.js +47 -0
- package/dist/vite-plugins/undeclared-library.js.map +1 -0
- package/dist/vite-plugins/virtual-module.d.ts +22 -0
- package/dist/vite-plugins/virtual-module.d.ts.map +1 -0
- package/dist/vite-plugins/virtual-module.js +18 -0
- package/dist/vite-plugins/virtual-module.js.map +1 -0
- package/dist/vitest-plugin.d.ts +10 -0
- package/dist/vitest-plugin.d.ts.map +1 -0
- package/dist/vitest-plugin.js +12 -0
- package/dist/vitest-plugin.js.map +1 -0
- package/env.d.ts +131 -3
- package/package.json +32 -38
- package/src/babel-modules.d.ts +13 -0
- package/src/builder.ts +28 -76
- package/src/cli.ts +22 -0
- package/src/codegen/freshness.ts +52 -0
- package/src/codegen/report.ts +20 -0
- package/src/codegen/run-codegen.ts +185 -0
- package/src/codegen/store-resolver.ts +75 -0
- package/src/commands/build.ts +37 -0
- package/src/commands/codegen.ts +44 -0
- package/src/commands/dev.ts +25 -0
- package/src/commands/docs.ts +66 -0
- package/src/dev/icon-dir.ts +11 -0
- package/src/dev/refresh-tracker.ts +21 -0
- package/src/dev/runner-deps.ts +42 -0
- package/src/dev/runner-main.ts +33 -0
- package/src/dev/runner.ts +126 -0
- package/src/dev/schema-dir.ts +11 -0
- package/src/dev/supervisor.ts +178 -0
- package/src/dev/vite-dev-server.ts +34 -0
- package/src/internal/banner.ts +9 -0
- package/src/internal/data-dir.ts +39 -0
- package/src/internal/entry-arg.ts +38 -0
- package/src/internal/errors.ts +28 -0
- package/src/internal/list-files.ts +17 -0
- package/src/internal/resolve-cli-tool.ts +21 -0
- package/src/internal/staging-dir.ts +16 -0
- package/src/internal/xdg-data-dirs.ts +7 -0
- package/src/mcp/client.ts +177 -0
- package/src/mcp/handlers.ts +156 -0
- package/src/mcp/index.ts +22 -0
- package/src/mcp/serialize-widget.ts +34 -0
- package/src/mcp/testing-loader.ts +32 -0
- package/src/mcp/widget-registry.ts +43 -0
- package/src/refresh-runtime.ts +12 -41
- package/src/settings/compile.ts +19 -0
- package/src/settings/parser.ts +154 -0
- package/src/settings/render.ts +167 -0
- package/src/settings/schema.ts +115 -0
- package/src/vite-plugins/asset-extensions.ts +28 -0
- package/src/{vite-plugin-gtkx-built-url.ts → vite-plugins/built-url.ts} +3 -16
- package/src/vite-plugins/css.ts +38 -0
- package/src/vite-plugins/fast-refresh/refresh-filter.ts +18 -0
- package/src/vite-plugins/fast-refresh/swc-refresh.ts +79 -0
- package/src/vite-plugins/icons.ts +58 -0
- package/src/vite-plugins/index.ts +22 -0
- package/src/vite-plugins/native.ts +74 -0
- package/src/vite-plugins/react-compiler.ts +70 -0
- package/src/vite-plugins/react-dom-prebundle.ts +14 -0
- package/src/vite-plugins/resource-init-module.ts +54 -0
- package/src/vite-plugins/resource-shared.ts +27 -0
- package/src/vite-plugins/resources.ts +272 -0
- package/src/vite-plugins/settings-worker-env.ts +25 -0
- package/src/vite-plugins/settings.ts +221 -0
- package/src/vite-plugins/undeclared-library.ts +69 -0
- package/src/vite-plugins/virtual-module.ts +37 -0
- package/src/vitest-plugin.ts +14 -0
- package/dist/create.d.ts +0 -54
- package/dist/create.d.ts.map +0 -1
- package/dist/create.js +0 -221
- package/dist/create.js.map +0 -1
- package/dist/dev-server.d.ts +0 -38
- package/dist/dev-server.d.ts.map +0 -1
- package/dist/dev-server.js +0 -128
- package/dist/dev-server.js.map +0 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +0 -1
- package/dist/mcp-client.d.ts +0 -31
- package/dist/mcp-client.d.ts.map +0 -1
- package/dist/mcp-client.js +0 -430
- package/dist/mcp-client.js.map +0 -1
- package/dist/templates.d.ts +0 -9
- package/dist/templates.d.ts.map +0 -1
- package/dist/templates.js +0 -16
- package/dist/templates.js.map +0 -1
- package/dist/vite-plugin-gtkx-assets.d.ts +0 -20
- package/dist/vite-plugin-gtkx-assets.d.ts.map +0 -1
- package/dist/vite-plugin-gtkx-assets.js +0 -57
- package/dist/vite-plugin-gtkx-assets.js.map +0 -1
- package/dist/vite-plugin-gtkx-built-url.d.ts +0 -18
- package/dist/vite-plugin-gtkx-built-url.d.ts.map +0 -1
- package/dist/vite-plugin-gtkx-built-url.js.map +0 -1
- package/dist/vite-plugin-gtkx-native.d.ts +0 -14
- package/dist/vite-plugin-gtkx-native.d.ts.map +0 -1
- package/dist/vite-plugin-gtkx-native.js +0 -53
- package/dist/vite-plugin-gtkx-native.js.map +0 -1
- package/dist/vite-plugin-gtkx-refresh.d.ts +0 -8
- package/dist/vite-plugin-gtkx-refresh.d.ts.map +0 -1
- package/dist/vite-plugin-gtkx-refresh.js +0 -37
- package/dist/vite-plugin-gtkx-refresh.js.map +0 -1
- package/dist/vite-plugin-swc-ssr-refresh.d.ts +0 -8
- package/dist/vite-plugin-swc-ssr-refresh.d.ts.map +0 -1
- package/dist/vite-plugin-swc-ssr-refresh.js +0 -46
- package/dist/vite-plugin-swc-ssr-refresh.js.map +0 -1
- package/src/cli.tsx +0 -154
- package/src/create.ts +0 -310
- package/src/dev-server.tsx +0 -162
- package/src/index.ts +0 -3
- package/src/mcp-client.ts +0 -518
- package/src/templates.ts +0 -26
- package/src/vite-plugin-gtkx-assets.ts +0 -69
- package/src/vite-plugin-gtkx-native.ts +0 -64
- package/src/vite-plugin-gtkx-refresh.ts +0 -54
- package/src/vite-plugin-swc-ssr-refresh.ts +0 -61
- package/templates/claude/EXAMPLES.md.ejs +0 -744
- package/templates/claude/SKILL.md.ejs +0 -93
- package/templates/claude/WIDGETS.md.ejs +0 -820
- package/templates/config/vitest.config.ts.ejs +0 -11
- package/templates/gitignore.ejs +0 -4
- package/templates/package.json.ejs +0 -16
- package/templates/src/app.tsx.ejs +0 -32
- package/templates/src/dev.tsx.ejs +0 -5
- package/templates/src/gtkx-env.d.ts.ejs +0 -1
- package/templates/src/index.tsx.ejs +0 -5
- package/templates/tests/app.test.tsx.ejs +0 -16
- package/templates/tsconfig.json.ejs +0 -14
package/dist/templates.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import ejs from "ejs";
|
|
4
|
-
const getTemplatesDir = () => {
|
|
5
|
-
return join(import.meta.dirname, "..", "templates");
|
|
6
|
-
};
|
|
7
|
-
const renderTemplate = (templatePath, context) => {
|
|
8
|
-
const templateContent = readFileSync(templatePath, "utf-8");
|
|
9
|
-
return ejs.render(templateContent, context);
|
|
10
|
-
};
|
|
11
|
-
export const renderFile = (templateName, context) => {
|
|
12
|
-
const templatesDir = getTemplatesDir();
|
|
13
|
-
const templatePath = join(templatesDir, templateName);
|
|
14
|
-
return renderTemplate(templatePath, context);
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=templates.js.map
|
package/dist/templates.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,GAAG,MAAM,KAAK,CAAC;AAUtB,MAAM,eAAe,GAAG,GAAW,EAAE;IACjC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,YAAoB,EAAE,OAAwB,EAAU,EAAE;IAC9E,MAAM,eAAe,GAAG,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC5D,OAAO,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,YAAoB,EAAE,OAAwB,EAAU,EAAE;IACjF,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACtD,OAAO,cAAc,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from "vite";
|
|
2
|
-
/**
|
|
3
|
-
* Vite plugin that resolves static asset imports to filesystem paths
|
|
4
|
-
* and handles CSS imports for GTK applications.
|
|
5
|
-
*
|
|
6
|
-
* **Non-CSS assets:** In dev mode, asset imports resolve to the absolute
|
|
7
|
-
* source file path. In build mode, Vite's built-in asset pipeline handles
|
|
8
|
-
* emission and hashing; the `renderBuiltUrl` config in the builder
|
|
9
|
-
* converts the URL to a filesystem path via `import.meta.url`.
|
|
10
|
-
*
|
|
11
|
-
* **CSS imports (`import "./style.css"`):** Transformed into a module that
|
|
12
|
-
* calls `injectGlobal` from `@gtkx/css` with the file's contents, injecting
|
|
13
|
-
* the styles into the GTK CSS provider at runtime.
|
|
14
|
-
*
|
|
15
|
-
* **CSS URL imports (`import path from "./style.css?url"`):** Handled by
|
|
16
|
-
* Vite's built-in `?url` mechanism, which emits the file as an asset and
|
|
17
|
-
* resolves it to a filesystem path via `renderBuiltUrl`.
|
|
18
|
-
*/
|
|
19
|
-
export declare function gtkxAssets(): Plugin;
|
|
20
|
-
//# sourceMappingURL=vite-plugin-gtkx-assets.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-gtkx-assets.d.ts","sourceRoot":"","sources":["../src/vite-plugin-gtkx-assets.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAMnC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,IAAI,MAAM,CA4CnC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
const ASSET_RE = /\.(png|jpe?g|gif|svg|webp|webm|mp4|ogg|mp3|wav|flac|aac|woff2?|eot|ttf|otf|ico|avif|data)$/i;
|
|
3
|
-
const CSS_RE = /\.css$/i;
|
|
4
|
-
const VIRTUAL_PREFIX = "\0gtkx:";
|
|
5
|
-
/**
|
|
6
|
-
* Vite plugin that resolves static asset imports to filesystem paths
|
|
7
|
-
* and handles CSS imports for GTK applications.
|
|
8
|
-
*
|
|
9
|
-
* **Non-CSS assets:** In dev mode, asset imports resolve to the absolute
|
|
10
|
-
* source file path. In build mode, Vite's built-in asset pipeline handles
|
|
11
|
-
* emission and hashing; the `renderBuiltUrl` config in the builder
|
|
12
|
-
* converts the URL to a filesystem path via `import.meta.url`.
|
|
13
|
-
*
|
|
14
|
-
* **CSS imports (`import "./style.css"`):** Transformed into a module that
|
|
15
|
-
* calls `injectGlobal` from `@gtkx/css` with the file's contents, injecting
|
|
16
|
-
* the styles into the GTK CSS provider at runtime.
|
|
17
|
-
*
|
|
18
|
-
* **CSS URL imports (`import path from "./style.css?url"`):** Handled by
|
|
19
|
-
* Vite's built-in `?url` mechanism, which emits the file as an asset and
|
|
20
|
-
* resolves it to a filesystem path via `renderBuiltUrl`.
|
|
21
|
-
*/
|
|
22
|
-
export function gtkxAssets() {
|
|
23
|
-
let isBuild = false;
|
|
24
|
-
return {
|
|
25
|
-
name: "gtkx:assets",
|
|
26
|
-
enforce: "pre",
|
|
27
|
-
config() {
|
|
28
|
-
return {
|
|
29
|
-
assetsInclude: [ASSET_RE],
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
configResolved(config) {
|
|
33
|
-
isBuild = config.command === "build";
|
|
34
|
-
},
|
|
35
|
-
async resolveId(source, importer, options) {
|
|
36
|
-
if (!CSS_RE.test(source)) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const resolved = await this.resolve(source, importer, { ...options, skipSelf: true });
|
|
40
|
-
if (!resolved || resolved.external)
|
|
41
|
-
return;
|
|
42
|
-
return `${VIRTUAL_PREFIX + resolved.id}?inject`;
|
|
43
|
-
},
|
|
44
|
-
load(id) {
|
|
45
|
-
if (id.startsWith(VIRTUAL_PREFIX) && id.endsWith("?inject")) {
|
|
46
|
-
const filePath = id.slice(VIRTUAL_PREFIX.length, -"?inject".length);
|
|
47
|
-
const content = readFileSync(filePath, "utf-8");
|
|
48
|
-
return [`import { injectGlobal } from "@gtkx/css";`, `injectGlobal(${JSON.stringify(content)});`].join("\n");
|
|
49
|
-
}
|
|
50
|
-
if (isBuild || !ASSET_RE.test(id)) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
return `export default ${JSON.stringify(id)};`;
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=vite-plugin-gtkx-assets.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-gtkx-assets.js","sourceRoot":"","sources":["../src/vite-plugin-gtkx-assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,MAAM,QAAQ,GAAG,6FAA6F,CAAC;AAC/G,MAAM,MAAM,GAAG,SAAS,CAAC;AACzB,MAAM,cAAc,GAAG,SAAS,CAAC;AAEjC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,UAAU;IACtB,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,OAAO;QACH,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,KAAK;QAEd,MAAM;YACF,OAAO;gBACH,aAAa,EAAE,CAAC,QAAQ,CAAC;aAC5B,CAAC;QACN,CAAC;QAED,cAAc,CAAC,MAAM;YACjB,OAAO,GAAG,MAAM,CAAC,OAAO,KAAK,OAAO,CAAC;QACzC,CAAC;QAED,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO;YACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;gBACvB,OAAO;YACX,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YACtF,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ;gBAAE,OAAO;YAE3C,OAAO,GAAG,cAAc,GAAG,QAAQ,CAAC,EAAE,SAAS,CAAC;QACpD,CAAC;QAED,IAAI,CAAC,EAAE;YACH,IAAI,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC1D,MAAM,QAAQ,GAAG,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;gBACpE,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;gBAChD,OAAO,CAAC,2CAA2C,EAAE,gBAAgB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAClG,IAAI,CACP,CAAC;YACN,CAAC;YAED,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;gBAChC,OAAO;YACX,CAAC;YAED,OAAO,kBAAkB,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC;QACnD,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from "vite";
|
|
2
|
-
/**
|
|
3
|
-
* Vite plugin that configures `renderBuiltUrl` for resolving asset imports
|
|
4
|
-
* to filesystem paths at runtime.
|
|
5
|
-
*
|
|
6
|
-
* When `assetBase` is provided, assets resolve relative to the executable
|
|
7
|
-
* directory using `path.join(path.dirname(process.execPath), assetBase, filename)`.
|
|
8
|
-
* This supports FHS-compliant layouts where assets live in `../share/<app>/`.
|
|
9
|
-
*
|
|
10
|
-
* When `assetBase` is omitted, assets resolve relative to the bundle file
|
|
11
|
-
* via `import.meta.url`, which works when assets are co-located with the
|
|
12
|
-
* executable.
|
|
13
|
-
*
|
|
14
|
-
* Only applies when the user has not already configured
|
|
15
|
-
* `experimental.renderBuiltUrl` in their Vite config.
|
|
16
|
-
*/
|
|
17
|
-
export declare function gtkxBuiltUrl(assetBase?: string): Plugin;
|
|
18
|
-
//# sourceMappingURL=vite-plugin-gtkx-built-url.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-gtkx-built-url.d.ts","sourceRoot":"","sources":["../src/vite-plugin-gtkx-built-url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CA8BvD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-gtkx-built-url.js","sourceRoot":"","sources":["../src/vite-plugin-gtkx-built-url.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,YAAY,CAAC,SAAkB;IAC3C,OAAO;QACH,IAAI,EAAE,gBAAgB;QAEtB,MAAM,CAAC,UAAU;YACb,IAAI,UAAU,CAAC,YAAY,EAAE,cAAc,EAAE,CAAC;gBAC1C,OAAO;YACX,CAAC;YAED,OAAO;gBACH,YAAY,EAAE;oBACV,cAAc,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE;wBAC7B,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;4BACnB,OAAO;wBACX,CAAC;wBAED,IAAI,SAAS,EAAE,CAAC;4BACZ,OAAO;gCACH,OAAO,EAAE,kEAAkE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG;6BACtI,CAAC;wBACN,CAAC;wBAED,OAAO;4BACH,OAAO,EAAE,WAAW,IAAI,CAAC,SAAS,CAAC,KAAK,QAAQ,EAAE,CAAC,6BAA6B;yBACnF,CAAC;oBACN,CAAC;iBACJ;aACJ,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from "vite";
|
|
2
|
-
/**
|
|
3
|
-
* Vite plugin that embeds the native `.node` binary into the build output.
|
|
4
|
-
*
|
|
5
|
-
* During production builds, resolves the platform-specific `.node` binary,
|
|
6
|
-
* copies it into the output directory as `gtkx.node`, and transforms the
|
|
7
|
-
* `loadNativeBinding` function in `@gtkx/native` to load `./gtkx.node`
|
|
8
|
-
* directly. This makes the bundle self-contained with no `node_modules`
|
|
9
|
-
* dependency at runtime.
|
|
10
|
-
*
|
|
11
|
-
* @param root - Project root directory used to resolve native packages
|
|
12
|
-
*/
|
|
13
|
-
export declare function gtkxNative(root: string): Plugin;
|
|
14
|
-
//# sourceMappingURL=vite-plugin-gtkx-native.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-gtkx-native.d.ts","sourceRoot":"","sources":["../src/vite-plugin-gtkx-native.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAKnC;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA2C/C"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
import { arch, platform } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
const LOAD_NATIVE_BINDING_RE = /function loadNativeBinding\(\) \{[\s\S]*?\n\}/;
|
|
6
|
-
const NODE_OS_IMPORT_RE = /import\s*\{[^}]*\}\s*from\s*["']node:os["'];?\n?/;
|
|
7
|
-
/**
|
|
8
|
-
* Vite plugin that embeds the native `.node` binary into the build output.
|
|
9
|
-
*
|
|
10
|
-
* During production builds, resolves the platform-specific `.node` binary,
|
|
11
|
-
* copies it into the output directory as `gtkx.node`, and transforms the
|
|
12
|
-
* `loadNativeBinding` function in `@gtkx/native` to load `./gtkx.node`
|
|
13
|
-
* directly. This makes the bundle self-contained with no `node_modules`
|
|
14
|
-
* dependency at runtime.
|
|
15
|
-
*
|
|
16
|
-
* @param root - Project root directory used to resolve native packages
|
|
17
|
-
*/
|
|
18
|
-
export function gtkxNative(root) {
|
|
19
|
-
const projectRequire = createRequire(join(root, "package.json"));
|
|
20
|
-
let nativeIndexPath;
|
|
21
|
-
return {
|
|
22
|
-
name: "gtkx:native",
|
|
23
|
-
enforce: "pre",
|
|
24
|
-
buildStart() {
|
|
25
|
-
const currentPlatform = platform();
|
|
26
|
-
const currentArch = arch();
|
|
27
|
-
const packageName = `@gtkx/native-linux-${currentArch}`;
|
|
28
|
-
if (currentPlatform !== "linux") {
|
|
29
|
-
throw new Error(`Unsupported build platform: ${currentPlatform}. Only Linux is supported.`);
|
|
30
|
-
}
|
|
31
|
-
if (currentArch !== "x64" && currentArch !== "arm64") {
|
|
32
|
-
throw new Error(`Unsupported build architecture: ${currentArch}. Only x64 and arm64 are supported.`);
|
|
33
|
-
}
|
|
34
|
-
nativeIndexPath = projectRequire.resolve("@gtkx/native");
|
|
35
|
-
const nodePath = projectRequire.resolve(`${packageName}/index.node`);
|
|
36
|
-
const source = readFileSync(nodePath);
|
|
37
|
-
this.emitFile({
|
|
38
|
-
type: "asset",
|
|
39
|
-
fileName: "gtkx.node",
|
|
40
|
-
source,
|
|
41
|
-
});
|
|
42
|
-
},
|
|
43
|
-
transform(code, id) {
|
|
44
|
-
if (id !== nativeIndexPath) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
return code
|
|
48
|
-
.replace(NODE_OS_IMPORT_RE, "")
|
|
49
|
-
.replace(LOAD_NATIVE_BINDING_RE, 'function loadNativeBinding() { return require("./gtkx.node"); }');
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=vite-plugin-gtkx-native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-gtkx-native.js","sourceRoot":"","sources":["../src/vite-plugin-gtkx-native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,MAAM,sBAAsB,GAAG,+CAA+C,CAAC;AAC/E,MAAM,iBAAiB,GAAG,kDAAkD,CAAC;AAE7E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACnC,MAAM,cAAc,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC;IACjE,IAAI,eAAuB,CAAC;IAE5B,OAAO;QACH,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,KAAK;QAEd,UAAU;YACN,MAAM,eAAe,GAAG,QAAQ,EAAE,CAAC;YACnC,MAAM,WAAW,GAAG,IAAI,EAAE,CAAC;YAC3B,MAAM,WAAW,GAAG,sBAAsB,WAAW,EAAE,CAAC;YAExD,IAAI,eAAe,KAAK,OAAO,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,+BAA+B,eAAe,4BAA4B,CAAC,CAAC;YAChG,CAAC;YAED,IAAI,WAAW,KAAK,KAAK,IAAI,WAAW,KAAK,OAAO,EAAE,CAAC;gBACnD,MAAM,IAAI,KAAK,CAAC,mCAAmC,WAAW,qCAAqC,CAAC,CAAC;YACzG,CAAC;YAED,eAAe,GAAG,cAAc,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;YAEzD,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,WAAW,aAAa,CAAC,CAAC;YACrE,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;YAEtC,IAAI,CAAC,QAAQ,CAAC;gBACV,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,WAAW;gBACrB,MAAM;aACT,CAAC,CAAC;QACP,CAAC;QAED,SAAS,CAAC,IAAI,EAAE,EAAE;YACd,IAAI,EAAE,KAAK,eAAe,EAAE,CAAC;gBACzB,OAAO;YACX,CAAC;YAED,OAAO,IAAI;iBACN,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;iBAC9B,OAAO,CAAC,sBAAsB,EAAE,iEAAiE,CAAC,CAAC;QAC5G,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-gtkx-refresh.d.ts","sourceRoot":"","sources":["../src/vite-plugin-gtkx-refresh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,KAAK,kBAAkB,GAAG;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAOF,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,MAAM,CAyCpE"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
const defaultInclude = /\.[tj]sx?$/;
|
|
2
|
-
const defaultExclude = /node_modules/;
|
|
3
|
-
const refreshRuntimePath = "@gtkx/cli/refresh-runtime";
|
|
4
|
-
export function gtkxRefresh(options = {}) {
|
|
5
|
-
const include = options.include ?? defaultInclude;
|
|
6
|
-
const exclude = options.exclude ?? defaultExclude;
|
|
7
|
-
return {
|
|
8
|
-
name: "gtkx:refresh",
|
|
9
|
-
enforce: "post",
|
|
10
|
-
transform(code, id, transformOptions) {
|
|
11
|
-
if (!transformOptions?.ssr) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
if (!include.test(id)) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
if (exclude.test(id)) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const hasRefreshReg = code.includes("$RefreshReg$");
|
|
21
|
-
const hasRefreshSig = code.includes("$RefreshSig$");
|
|
22
|
-
if (!hasRefreshReg && !hasRefreshSig) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const moduleIdJson = JSON.stringify(id);
|
|
26
|
-
const header = `
|
|
27
|
-
import { createModuleRegistration as __createModuleRegistration__ } from "${refreshRuntimePath}";
|
|
28
|
-
const { $RefreshReg$, $RefreshSig$ } = __createModuleRegistration__(${moduleIdJson});
|
|
29
|
-
`;
|
|
30
|
-
return {
|
|
31
|
-
code: header + code,
|
|
32
|
-
map: null,
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=vite-plugin-gtkx-refresh.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-gtkx-refresh.js","sourceRoot":"","sources":["../src/vite-plugin-gtkx-refresh.ts"],"names":[],"mappings":"AAOA,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAAM,cAAc,GAAG,cAAc,CAAC;AAEtC,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAEvD,MAAM,UAAU,WAAW,CAAC,UAA8B,EAAE;IACxD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,cAAc,CAAC;IAClD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,cAAc,CAAC;IAElD,OAAO;QACH,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,MAAM;QAEf,SAAS,CAAC,IAAI,EAAE,EAAE,EAAE,gBAAgB;YAChC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE,CAAC;gBACzB,OAAO;YACX,CAAC;YAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;gBACpB,OAAO;YACX,CAAC;YAED,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;gBACnB,OAAO;YACX,CAAC;YAED,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;YACpD,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;YAEpD,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnC,OAAO;YACX,CAAC;YAED,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;YAExC,MAAM,MAAM,GAAG;4EACiD,kBAAkB;sEACxB,YAAY;CACjF,CAAC;YAEU,OAAO;gBACH,IAAI,EAAE,MAAM,GAAG,IAAI;gBACnB,GAAG,EAAE,IAAI;aACZ,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from "vite";
|
|
2
|
-
type SwcSsrRefreshOptions = {
|
|
3
|
-
include?: RegExp;
|
|
4
|
-
exclude?: RegExp;
|
|
5
|
-
};
|
|
6
|
-
export declare function swcSsrRefresh(options?: SwcSsrRefreshOptions): Plugin;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=vite-plugin-swc-ssr-refresh.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-swc-ssr-refresh.d.ts","sourceRoot":"","sources":["../src/vite-plugin-swc-ssr-refresh.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,KAAK,oBAAoB,GAAG;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAKF,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,MAAM,CAiDxE"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { transform } from "@swc/core";
|
|
2
|
-
const defaultInclude = /\.[tj]sx?$/;
|
|
3
|
-
const defaultExclude = /node_modules/;
|
|
4
|
-
export function swcSsrRefresh(options = {}) {
|
|
5
|
-
const include = options.include ?? defaultInclude;
|
|
6
|
-
const exclude = options.exclude ?? defaultExclude;
|
|
7
|
-
return {
|
|
8
|
-
name: "gtkx:swc-ssr-refresh",
|
|
9
|
-
enforce: "pre",
|
|
10
|
-
async transform(code, id, transformOptions) {
|
|
11
|
-
if (!transformOptions?.ssr) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
if (!include.test(id)) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
if (exclude.test(id)) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const isTsx = id.endsWith(".tsx");
|
|
21
|
-
const isTs = id.endsWith(".ts") || isTsx;
|
|
22
|
-
const swcOptions = {
|
|
23
|
-
filename: id,
|
|
24
|
-
sourceFileName: id,
|
|
25
|
-
sourceMaps: true,
|
|
26
|
-
jsc: {
|
|
27
|
-
parser: isTs ? { syntax: "typescript", tsx: isTsx } : { syntax: "ecmascript", jsx: true },
|
|
28
|
-
transform: {
|
|
29
|
-
react: {
|
|
30
|
-
runtime: "automatic",
|
|
31
|
-
development: true,
|
|
32
|
-
refresh: true,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
target: "es2022",
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
const result = await transform(code, swcOptions);
|
|
39
|
-
return {
|
|
40
|
-
code: result.code,
|
|
41
|
-
map: result.map,
|
|
42
|
-
};
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=vite-plugin-swc-ssr-refresh.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-swc-ssr-refresh.js","sourceRoot":"","sources":["../src/vite-plugin-swc-ssr-refresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,SAAS,EAAE,MAAM,WAAW,CAAC;AAQlE,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAAM,cAAc,GAAG,cAAc,CAAC;AAEtC,MAAM,UAAU,aAAa,CAAC,UAAgC,EAAE;IAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,cAAc,CAAC;IAClD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,cAAc,CAAC;IAElD,OAAO;QACH,IAAI,EAAE,sBAAsB;QAC5B,OAAO,EAAE,KAAK;QAEd,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,EAAE,gBAAgB;YACtC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE,CAAC;gBACzB,OAAO;YACX,CAAC;YAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;gBACpB,OAAO;YACX,CAAC;YAED,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;gBACnB,OAAO;YACX,CAAC;YAED,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAClC,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;YAEzC,MAAM,UAAU,GAAe;gBAC3B,QAAQ,EAAE,EAAE;gBACZ,cAAc,EAAE,EAAE;gBAClB,UAAU,EAAE,IAAI;gBAChB,GAAG,EAAE;oBACD,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,IAAI,EAAE;oBACzF,SAAS,EAAE;wBACP,KAAK,EAAE;4BACH,OAAO,EAAE,WAAW;4BACpB,WAAW,EAAE,IAAI;4BACjB,OAAO,EAAE,IAAI;yBAChB;qBACJ;oBACD,MAAM,EAAE,QAAQ;iBACnB;aACJ,CAAC;YAEF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YAEjD,OAAO;gBACH,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,GAAG,EAAE,MAAM,CAAC,GAAG;aAClB,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
|
package/src/cli.tsx
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import "./refresh-runtime.js";
|
|
4
|
-
|
|
5
|
-
import { createRequire } from "node:module";
|
|
6
|
-
import { resolve } from "node:path";
|
|
7
|
-
import { events } from "@gtkx/ffi";
|
|
8
|
-
import type * as Gio from "@gtkx/ffi/gio";
|
|
9
|
-
import { render } from "@gtkx/react";
|
|
10
|
-
import { defineCommand, runMain } from "citty";
|
|
11
|
-
import { build } from "./builder.js";
|
|
12
|
-
import { createApp } from "./create.js";
|
|
13
|
-
import { createDevServer } from "./dev-server.js";
|
|
14
|
-
import { startMcpClient, stopMcpClient } from "./mcp-client.js";
|
|
15
|
-
|
|
16
|
-
const require = createRequire(import.meta.url);
|
|
17
|
-
const { version } = require("../package.json") as { version: string };
|
|
18
|
-
|
|
19
|
-
interface AppModule {
|
|
20
|
-
default: () => React.ReactNode;
|
|
21
|
-
appId?: string;
|
|
22
|
-
appFlags?: Gio.ApplicationFlags;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const dev = defineCommand({
|
|
26
|
-
meta: {
|
|
27
|
-
name: "dev",
|
|
28
|
-
description: "Start development server with HMR",
|
|
29
|
-
},
|
|
30
|
-
args: {
|
|
31
|
-
entry: {
|
|
32
|
-
type: "positional",
|
|
33
|
-
description: "Entry file (e.g., src/app.tsx)",
|
|
34
|
-
required: true,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
async run({ args }) {
|
|
38
|
-
const entryPath = resolve(process.cwd(), args.entry);
|
|
39
|
-
console.log(`[gtkx] Starting dev server for ${entryPath}`);
|
|
40
|
-
|
|
41
|
-
const server = await createDevServer({
|
|
42
|
-
entry: entryPath,
|
|
43
|
-
vite: {
|
|
44
|
-
root: process.cwd(),
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const mod = (await server.ssrLoadModule(entryPath)) as AppModule;
|
|
49
|
-
const App = mod.default;
|
|
50
|
-
const appId = mod.appId ?? "org.gtkx.dev";
|
|
51
|
-
const appFlags = mod.appFlags;
|
|
52
|
-
|
|
53
|
-
if (typeof App !== "function") {
|
|
54
|
-
console.error("[gtkx] Entry file must export a default function component");
|
|
55
|
-
process.exit(1);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
console.log(`[gtkx] Rendering app with ID: ${appId}`);
|
|
59
|
-
render(<App />, appId, appFlags);
|
|
60
|
-
|
|
61
|
-
await startMcpClient(appId);
|
|
62
|
-
events.on("stop", () => {
|
|
63
|
-
stopMcpClient();
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
console.log("[gtkx] HMR enabled - watching for changes...");
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const buildCmd = defineCommand({
|
|
71
|
-
meta: {
|
|
72
|
-
name: "build",
|
|
73
|
-
description: "Build application for production",
|
|
74
|
-
},
|
|
75
|
-
args: {
|
|
76
|
-
entry: {
|
|
77
|
-
type: "positional",
|
|
78
|
-
description: "Entry file (default: src/index.tsx)",
|
|
79
|
-
required: false,
|
|
80
|
-
},
|
|
81
|
-
"asset-base": {
|
|
82
|
-
type: "string",
|
|
83
|
-
description: "Asset base path relative to executable directory (e.g., ../share/my-app)",
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
async run({ args }) {
|
|
87
|
-
const entry = resolve(process.cwd(), args.entry ?? "src/index.tsx");
|
|
88
|
-
console.log(`[gtkx] Building ${entry}`);
|
|
89
|
-
|
|
90
|
-
await build({
|
|
91
|
-
entry,
|
|
92
|
-
assetBase: args["asset-base"],
|
|
93
|
-
vite: {
|
|
94
|
-
root: process.cwd(),
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
console.log("[gtkx] Build complete: dist/bundle.js");
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
const create = defineCommand({
|
|
103
|
-
meta: {
|
|
104
|
-
name: "create",
|
|
105
|
-
description: "Create a new GTKX application",
|
|
106
|
-
},
|
|
107
|
-
args: {
|
|
108
|
-
name: {
|
|
109
|
-
type: "positional",
|
|
110
|
-
description: "Project name",
|
|
111
|
-
required: false,
|
|
112
|
-
},
|
|
113
|
-
"app-id": {
|
|
114
|
-
type: "string",
|
|
115
|
-
description: "App ID (e.g., com.example.myapp)",
|
|
116
|
-
},
|
|
117
|
-
pm: {
|
|
118
|
-
type: "string",
|
|
119
|
-
description: "Package manager (pnpm, npm, yarn)",
|
|
120
|
-
},
|
|
121
|
-
testing: {
|
|
122
|
-
type: "string",
|
|
123
|
-
description: "Testing setup (vitest, none)",
|
|
124
|
-
},
|
|
125
|
-
"claude-skills": {
|
|
126
|
-
type: "boolean",
|
|
127
|
-
description: "Include Claude Code skills for AI assistance",
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
async run({ args }) {
|
|
131
|
-
await createApp({
|
|
132
|
-
name: args.name,
|
|
133
|
-
appId: args["app-id"],
|
|
134
|
-
packageManager: args.pm as "pnpm" | "npm" | "yarn" | undefined,
|
|
135
|
-
testing: args.testing as "vitest" | "none" | undefined,
|
|
136
|
-
claudeSkills: args["claude-skills"],
|
|
137
|
-
});
|
|
138
|
-
},
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
const main = defineCommand({
|
|
142
|
-
meta: {
|
|
143
|
-
name: "gtkx",
|
|
144
|
-
version,
|
|
145
|
-
description: "CLI for GTKX - create and develop GTK4 React applications",
|
|
146
|
-
},
|
|
147
|
-
subCommands: {
|
|
148
|
-
dev,
|
|
149
|
-
build: buildCmd,
|
|
150
|
-
create,
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
runMain(main);
|