@hatk/hatk 0.0.1-alpha.0 → 0.0.1-alpha.2

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/cli.js CHANGED
@@ -135,7 +135,7 @@ export default defineQuery('${name}', async (ctx) => {
135
135
  })
136
136
  })
137
137
  `,
138
- label: (name) => `import type { LabelRuleContext } from 'hatk/labels'
138
+ label: (name) => `import type { LabelRuleContext } from '@hatk/hatk/labels'
139
139
 
140
140
  export default {
141
141
  definition: {
@@ -151,7 +151,7 @@ export default {
151
151
  },
152
152
  }
153
153
  `,
154
- og: (name) => `import type { OpengraphContext, OpengraphResult } from 'hatk/opengraph'
154
+ og: (name) => `import type { OpengraphContext, OpengraphResult } from '@hatk/hatk/opengraph'
155
155
 
156
156
  export default {
157
157
  path: '/og/${name}/:id',
@@ -187,7 +187,7 @@ function xrpcImportPath(nsid) {
187
187
  }
188
188
  const testTemplates = {
189
189
  feed: (name) => `import { describe, test, expect, beforeAll, afterAll } from 'vitest'
190
- import { createTestContext } from 'hatk/test'
190
+ import { createTestContext } from '@hatk/hatk/test'
191
191
 
192
192
  let ctx: Awaited<ReturnType<typeof createTestContext>>
193
193
 
@@ -207,7 +207,7 @@ describe('${name} feed', () => {
207
207
  })
208
208
  `,
209
209
  xrpc: (name) => `import { describe, test, expect, beforeAll, afterAll } from 'vitest'
210
- import { createTestContext } from 'hatk/test'
210
+ import { createTestContext } from '@hatk/hatk/test'
211
211
 
212
212
  let ctx: Awaited<ReturnType<typeof createTestContext>>
213
213
 
@@ -797,7 +797,7 @@ RUN npm ci --omit=dev
797
797
  COPY . .
798
798
  RUN node_modules/.bin/hatk build
799
799
  EXPOSE 3000
800
- CMD ["node", "--experimental-strip-types", "--no-warnings", "node_modules/hatk/src/main.ts", "config.yaml"]
800
+ CMD ["node", "--no-warnings", "node_modules/@hatk/hatk/dist/main.js", "config.yaml"]
801
801
  `);
802
802
  const pkgDeps = { '@hatk/oauth-client': '*', hatk: '*' };
803
803
  const pkgDevDeps = {
@@ -899,7 +899,7 @@ export default {
899
899
  }
900
900
  `);
901
901
  writeFileSync(join(dir, 'vite.config.ts'), `import { sveltekit } from '@sveltejs/kit/vite'
902
- import { hatk } from 'hatk/vite-plugin'
902
+ import { hatk } from '@hatk/hatk/vite-plugin'
903
903
  import { defineConfig } from 'vite'
904
904
 
905
905
  export default defineConfig({
@@ -1118,10 +1118,10 @@ else if (command === 'generate') {
1118
1118
  // Collect which wrappers are used (only from entries with a main type)
1119
1119
  const usedWrappers = new Set(entries.filter((e) => e.defType).map((e) => wrapperMap[e.defType]));
1120
1120
  let out = '// Auto-generated from lexicons. Do not edit.\n';
1121
- out += `import type { ${[...usedWrappers].sort().join(', ')}, LexServerParams, Checked, Prettify, StrictArg } from 'hatk/lex-types'\n`;
1122
- out += `import type { XrpcContext } from 'hatk/xrpc'\n`;
1123
- out += `import { defineFeed as _defineFeed, type FeedResult, type FeedContext, type HydrateContext } from 'hatk/feeds'\n`;
1124
- out += `import { seed as _seed, type SeedOpts } from 'hatk/seed'\n`;
1121
+ out += `import type { ${[...usedWrappers].sort().join(', ')}, LexServerParams, Checked, Prettify, StrictArg } from '@hatk/hatk/lex-types'\n`;
1122
+ out += `import type { XrpcContext } from '@hatk/hatk/xrpc'\n`;
1123
+ out += `import { defineFeed as _defineFeed, type FeedResult, type FeedContext, type HydrateContext } from '@hatk/hatk/feeds'\n`;
1124
+ out += `import { seed as _seed, type SeedOpts } from '@hatk/hatk/seed'\n`;
1125
1125
  // Emit ALL lexicons as `const ... = {...} as const` (including defs-only)
1126
1126
  out += `\n// ─── Lexicon Definitions ────────────────────────────────────────────\n\n`;
1127
1127
  for (const { nsid } of entries) {
@@ -1276,8 +1276,8 @@ else if (command === 'generate') {
1276
1276
  out += `}\n`;
1277
1277
  // Emit Ctx helper for typesafe XRPC handler contexts
1278
1278
  out += `\n// ─── XRPC Helpers ───────────────────────────────────────────────────\n\n`;
1279
- out += `export type { HydrateContext } from 'hatk/feeds'\n`;
1280
- out += `export { InvalidRequestError, NotFoundError } from 'hatk/xrpc'\n`;
1279
+ out += `export type { HydrateContext } from '@hatk/hatk/feeds'\n`;
1280
+ out += `export { InvalidRequestError, NotFoundError } from '@hatk/hatk/xrpc'\n`;
1281
1281
  out += `export type Ctx<K extends keyof XrpcSchema & keyof Registry> = XrpcContext<\n`;
1282
1282
  out += ` LexServerParams<Registry[K], Registry>,\n`;
1283
1283
  out += ` RecordRegistry,\n`;
@@ -1324,7 +1324,7 @@ else if (command === 'generate') {
1324
1324
  // Patch imports to include LexDef if needed
1325
1325
  if (hasLexDef) {
1326
1326
  usedWrappers.add('LexDef');
1327
- out = out.replace(/import type \{ ([^}]+) \} from 'hatk\/lex-types'/, `import type { ${[...usedWrappers].sort().join(', ')}, LexServerParams, Checked, Prettify, StrictArg } from 'hatk/lex-types'`);
1327
+ out = out.replace(/import type \{ ([^}]+) \} from '@hatk\/hatk\/lex-types'/, `import type { ${[...usedWrappers].sort().join(', ')}, LexServerParams, Checked, Prettify, StrictArg } from '@hatk/hatk/lex-types'`);
1328
1328
  }
1329
1329
  writeFileSync(outPath, out);
1330
1330
  console.log(`Generated ${outPath} with ${entries.length} types: ${entries.map((e) => capitalize(varNames.get(e.nsid))).join(', ')}`);
@@ -1436,7 +1436,7 @@ else if (command === 'dev') {
1436
1436
  }
1437
1437
  else {
1438
1438
  // No frontend — just run the hatk server directly
1439
- const mainPath = resolve(import.meta.dirname, 'main.ts');
1439
+ const mainPath = resolve(import.meta.dirname, 'main.js');
1440
1440
  execSync(`npx tsx ${mainPath} config.yaml`, { stdio: 'inherit', cwd: process.cwd() });
1441
1441
  }
1442
1442
  }
@@ -1649,7 +1649,7 @@ else if (command === 'schema') {
1649
1649
  }
1650
1650
  else if (command === 'start') {
1651
1651
  try {
1652
- const mainPath = resolve(import.meta.dirname, 'main.ts');
1652
+ const mainPath = resolve(import.meta.dirname, 'main.js');
1653
1653
  execSync(`npx tsx ${mainPath} config.yaml`, { stdio: 'inherit', cwd: process.cwd() });
1654
1654
  }
1655
1655
  catch (e) {
@@ -61,7 +61,7 @@ export function hatk(opts) {
61
61
  };
62
62
  },
63
63
  configureServer(server) {
64
- const mainPath = resolve(import.meta.dirname, 'main.ts');
64
+ const mainPath = resolve(import.meta.dirname, 'main.js');
65
65
  const watchDirs = ['xrpc', 'feeds', 'labels', 'jobs', 'setup', 'lexicons'].filter((d) => existsSync(d));
66
66
  const watchArgs = watchDirs.flatMap((d) => ['--watch-path', d]);
67
67
  serverProcess = spawn('npx', ['tsx', 'watch', ...watchArgs, mainPath, 'config.yaml'], {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hatk/hatk",
3
- "version": "0.0.1-alpha.0",
3
+ "version": "0.0.1-alpha.2",
4
4
  "bin": {
5
5
  "hatk": "dist/cli.js"
6
6
  },