@hitch42/applet 0.1.0-beta.2 → 0.1.0-beta.3

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/dist/applet.js CHANGED
@@ -82,23 +82,23 @@ async function main() {
82
82
  const noLogFlags = values.run === void 0 && values.filter === void 0 && values.level === void 0 && values.limit === void 0 && values.live === void 0 && values.search === void 0 && values.since === void 0;
83
83
  const noModeFlags = values["client-only"] === void 0 && values["server-only"] === void 0;
84
84
  if (positionals.length === 1 && positionals[0] === "bootstrap" && values.changeset === void 0 && noModeFlags && noGitFlags && noVariableFlags && noLogFlags) {
85
- await (await import("./init-CQRsnd3i.js")).runBootstrap({ install: values["no-install"] !== true });
85
+ await (await import("./init-BjWWDqqX.js")).runBootstrap({ install: values["no-install"] !== true });
86
86
  return;
87
87
  }
88
88
  if (positionals.length === 1 && positionals[0] === "generate" && values["no-install"] === void 0 && noModeFlags && noGitFlags && noVariableFlags && noLogFlags) {
89
- await (await import("./generate-CefnB-bp.js")).runGenerate({ changesetId: values.changeset });
89
+ await (await import("./generate-CRVA0Ll5.js")).runGenerate({ changesetId: values.changeset });
90
90
  return;
91
91
  }
92
92
  if (positionals.length === 1 && positionals[0] === "build" && values["no-install"] === void 0 && noModeFlags && noGitFlags && noVariableFlags && noLogFlags) {
93
- await (await import("./build-CMluoV6q.js")).runBuild({ changesetId: values.changeset });
93
+ await (await import("./build-BqoQ-uNz.js")).runBuild({ changesetId: values.changeset });
94
94
  return;
95
95
  }
96
96
  if (positionals.length === 1 && positionals[0] === "deploy" && values["no-install"] === void 0 && noModeFlags && noGitFlags && noVariableFlags && noLogFlags) {
97
- await (await import("./deploy-DKB-Tef7.js")).runDeploy({ changesetId: values.changeset });
97
+ await (await import("./deploy-DP2Bg6nt.js")).runDeploy({ changesetId: values.changeset });
98
98
  return;
99
99
  }
100
100
  if (positionals.length === 2 && positionals[0] === "init" && values.changeset === void 0 && noModeFlags && noVariableFlags && noLogFlags) {
101
- await (await import("./init-CQRsnd3i.js")).runInit(positionals[1], {
101
+ await (await import("./init-BjWWDqqX.js")).runInit(positionals[1], {
102
102
  commit: values["no-commit"] !== true,
103
103
  git: values["no-git"] !== true,
104
104
  install: values["no-install"] !== true
@@ -106,7 +106,7 @@ async function main() {
106
106
  return;
107
107
  }
108
108
  if (positionals.length === 2 && positionals[0] === "new" && values.changeset === void 0 && noGitFlags && noVariableFlags && noLogFlags) {
109
- await (await import("./init-CQRsnd3i.js")).runNew({
109
+ await (await import("./init-BjWWDqqX.js")).runNew({
110
110
  code: positionals[1],
111
111
  clientOnly: values["client-only"],
112
112
  install: values["no-install"] !== true,
@@ -0,0 +1,2 @@
1
+ import { n as runBuild } from "./build-Ch3pALLA.js";
2
+ export { runBuild };
@@ -1,4 +1,4 @@
1
- import { r as prepareAppletProject } from "./project-CEmDnlKa.js";
1
+ import { r as prepareAppletProject } from "./project-MN3mFxeE.js";
2
2
  import { rm } from "node:fs/promises";
3
3
  import { resolve } from "node:path";
4
4
  import { spawn } from "node:child_process";
@@ -1,5 +1,5 @@
1
1
  import { t as fetchWithOrgAuth } from "./auth-DaVK0k5R.js";
2
- import { t as buildApplet } from "./build-BRkmrUcj.js";
2
+ import { t as buildApplet } from "./build-Ch3pALLA.js";
3
3
  import { createRequire } from "node:module";
4
4
  import { readFile, readdir } from "node:fs/promises";
5
5
  import { relative, resolve, sep } from "node:path";
@@ -1,6 +1,6 @@
1
1
  import { i as resolveInstanceUrl, n as organizationInstanceUrl, t as fetchWithOrgAuth } from "./auth-DaVK0k5R.js";
2
2
  import { t as loadAppletConfig } from "./load-config-BnxocLAQ.js";
3
- import { r as prepareAppletProject } from "./project-CEmDnlKa.js";
3
+ import { r as prepareAppletProject } from "./project-MN3mFxeE.js";
4
4
  import { createRequire } from "node:module";
5
5
  import { existsSync } from "node:fs";
6
6
  import { access, mkdir, mkdtemp, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
@@ -352,12 +352,24 @@ async function responseJson(response) {
352
352
  }
353
353
  }
354
354
  async function loadAuthenticatedSpec(orgCode, options) {
355
+ const ciPath = (options.store?.env ?? process.env).HITCH_CI_OPENAPI_PATH;
356
+ if (ciPath !== void 0) try {
357
+ return JSON.parse(await readFile(ciPath, "utf8"));
358
+ } catch (error) {
359
+ throw new Error(`Failed to read the CI OpenAPI input from ${ciPath}.`, { cause: error });
360
+ }
355
361
  const fetcher = options.fetch ?? globalThis.fetch;
356
362
  const response = await fetchWithOrgAuth(orgCode, options, (instanceUrl, accessToken) => fetcher(`${instanceUrl}/api/v1/openapi.json${options.changesetId === void 0 ? "" : `?changeset_id=${encodeURIComponent(options.changesetId)}`}`, { headers: { Authorization: `Bearer ${accessToken}` } }));
357
363
  if (!response.ok) throw new Error(`Failed to load the organization's OpenAPI spec (${response.status}).`);
358
364
  return responseJson(response);
359
365
  }
360
366
  async function loadThemeStylesheet(orgCode, options) {
367
+ const ciPath = (options.store?.env ?? process.env).HITCH_CI_THEME_PATH;
368
+ if (ciPath !== void 0) try {
369
+ return await readFile(ciPath, "utf8");
370
+ } catch (error) {
371
+ throw new Error(`Failed to read the CI theme input from ${ciPath}.`, { cause: error });
372
+ }
361
373
  const fetcher = options.fetch ?? globalThis.fetch;
362
374
  const instanceUrl = await resolveInstanceUrl(void 0, options.store);
363
375
  const response = await fetcher(`${organizationInstanceUrl(instanceUrl, orgCode)}/theme.css`);
@@ -0,0 +1,2 @@
1
+ import { n as runGenerate } from "./generate-BuszZ9-U.js";
2
+ export { runGenerate };
@@ -1,8 +1,8 @@
1
1
  import { a as ORG_CODE_PATTERN, i as APPLET_CODE_PATTERN } from "./manifest-DyoJ1MIL.js";
2
2
  import { i as resolveInstanceUrl, r as resolveAuthForOrg } from "./auth-DaVK0k5R.js";
3
- import { n as runGenerate } from "./generate-BFmIzHaR.js";
3
+ import { n as runGenerate } from "./generate-BuszZ9-U.js";
4
4
  import { n as loadAppletSourceDefinition, r as readWorkspaceConfig } from "./load-config-BnxocLAQ.js";
5
- import { a as writeWorkspaceSupport, i as writeAppletSupport, n as loadCliManifest, t as assertWorkspaceCli } from "./project-CEmDnlKa.js";
5
+ import { a as writeWorkspaceSupport, i as writeAppletSupport, n as loadCliManifest, t as assertWorkspaceCli } from "./project-MN3mFxeE.js";
6
6
  import { access, cp, mkdir, readdir, writeFile } from "node:fs/promises";
7
7
  import { relative, resolve } from "node:path";
8
8
  import { spawn } from "node:child_process";
@@ -170,15 +170,21 @@ async function writeWorkspaceSupport(root, config, cli) {
170
170
  if (resolvedCli === void 0) throw new Error("The CLI package manifest is not published.");
171
171
  assertWorkspaceCli(config, resolvedCli);
172
172
  const skillTarget = resolve(root, ".agents/skills/hitch-applets");
173
+ const deployWorkflowTarget = resolve(root, ".github/workflows/hitch.yml");
173
174
  const agents = await readFile(new URL("../scaffold/AGENTS.md", import.meta.url), "utf8");
174
- await Promise.all([mkdir(resolve(root, ".agents/skills"), { recursive: true }), rm(skillTarget, {
175
- force: true,
176
- recursive: true
177
- })]);
175
+ await Promise.all([
176
+ mkdir(resolve(root, ".agents/skills"), { recursive: true }),
177
+ mkdir(resolve(root, ".github/workflows"), { recursive: true }),
178
+ rm(skillTarget, {
179
+ force: true,
180
+ recursive: true
181
+ })
182
+ ]);
178
183
  await Promise.all([
179
184
  cp(new URL("../scaffold/.agents/skills/hitch-applets", import.meta.url), skillTarget, { recursive: true }),
180
185
  writeFile(resolve(root, "package.json"), `${JSON.stringify(workspacePackage(config.org), null, 2)}\n`),
181
186
  writeFile(resolve(root, "pnpm-workspace.yaml"), workspaceFile(resolvedCli)),
187
+ existsSync(deployWorkflowTarget) ? void 0 : cp(new URL("../scaffold/.github/workflows/hitch.yml", import.meta.url), deployWorkflowTarget),
182
188
  writeFile(resolve(root, ".node-version"), "24\n"),
183
189
  writeGitignore(root),
184
190
  writeFile(resolve(root, "AGENTS.md"), agents)
package/dist/vite.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as APPLET_CODE_PATTERN, n as appletManifestSchema, r as appletSourceDefinitionSchema } from "./manifest-DyoJ1MIL.js";
2
2
  import { i as resolveInstanceUrl, n as organizationInstanceUrl } from "./auth-DaVK0k5R.js";
3
- import { c as writeClientEntry, i as writeRegisterDeclaration, l as writeManifestGen, r as syncContract, s as writeAppletRoot, u as writeServerEntry } from "./generate-BFmIzHaR.js";
3
+ import { c as writeClientEntry, i as writeRegisterDeclaration, l as writeManifestGen, r as syncContract, s as writeAppletRoot, u as writeServerEntry } from "./generate-BuszZ9-U.js";
4
4
  import { i as resolveWorkspaceOrg } from "./load-config-BnxocLAQ.js";
5
5
  import { existsSync } from "node:fs";
6
6
  import { appendFile, readFile, readdir, rm, writeFile } from "node:fs/promises";
@@ -239,7 +239,10 @@ function applet(sourceDefinition, options = {}) {
239
239
  hasServer ? writeServerEntry(root, hasHitchGen, manifest.code) : void 0,
240
240
  hasHitchGen ? void 0 : writeRegisterDeclaration(resolve(root, ".hitch"))
241
241
  ]);
242
- return { base: `/${manifest.code}/` };
242
+ return {
243
+ base: `/${manifest.code}/`,
244
+ ...hasServer && { environments: { worker: { build: { rollupOptions: { output: { codeSplitting: false } } } } } }
245
+ };
243
246
  },
244
247
  configResolved(config) {
245
248
  apiManifest = resolveAppletConfig(config.root).manifest;
@@ -313,7 +316,7 @@ function applet(sourceDefinition, options = {}) {
313
316
  const workerDir = outputOptions.dir ?? resolve(buildRootOutDir, "worker");
314
317
  const mainModule = Object.values(bundle).find((output) => output.type === "chunk" && output.isEntry)?.fileName;
315
318
  const strayModules = (await readdir(workerDir, { recursive: true })).filter((path) => /\.(js|mjs)$/.test(path) && path !== mainModule);
316
- if (strayModules.length > 0) throw new Error(`The applet server must bundle to a single worker/index.js module; found: ${strayModules.join(", ")}. Avoid dynamic import() in server code.`);
319
+ if (strayModules.length > 0) throw new Error(`The applet server must bundle to a single worker/index.js module; found: ${strayModules.join(", ")}.`);
317
320
  console.log(`server → ${relative(requireAppletConfig().root, resolve(workerDir, mainModule ?? ""))}`);
318
321
  }
319
322
  }
@@ -350,7 +353,7 @@ function applet(sourceDefinition, options = {}) {
350
353
  routesDirectory: "src/client/routes",
351
354
  routeFileIgnorePattern: "__root",
352
355
  virtualRouteConfig
353
- }), react()] : [],
356
+ }), react({ compiler: true })] : [],
354
357
  cloudflarePlugins
355
358
  ];
356
359
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitch42/applet",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.3",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "applet": "./dist/applet.js"
@@ -66,6 +66,7 @@
66
66
  "clsx": "^2.1.1",
67
67
  "croner": "^10.0.1",
68
68
  "lucide-react": "^1.33.0",
69
+ "oxc-transform-react": "^0.149.0",
69
70
  "react-aria-components": "^1.20.0",
70
71
  "shadcn": "^4.16.1",
71
72
  "streamdown": "^2.6.0",
@@ -0,0 +1,21 @@
1
+ name: Deploy Hitch applets
2
+
3
+ on:
4
+ push:
5
+ paths:
6
+ - "applets/**"
7
+ - ".github/workflows/hitch.yml"
8
+ - "hitch.config.ts"
9
+ - "pnpm-lock.yaml"
10
+ - "pnpm-workspace.yaml"
11
+
12
+ permissions: {}
13
+
14
+ jobs:
15
+ deploy:
16
+ if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
17
+ permissions:
18
+ contents: read
19
+ id-token: write
20
+ # Hitch verifies the called workflow's commit SHA from the OIDC token.
21
+ uses: hitch-42/actions/.github/workflows/deploy.yml@main
@@ -1,2 +0,0 @@
1
- import { n as runBuild } from "./build-BRkmrUcj.js";
2
- export { runBuild };
@@ -1,2 +0,0 @@
1
- import { n as runGenerate } from "./generate-BFmIzHaR.js";
2
- export { runGenerate };