@kosmojs/lib 0.4.4 → 0.5.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/README.md CHANGED
@@ -1,16 +1,23 @@
1
1
  # @kosmojs/lib
2
2
 
3
- TODO: Add package description
3
+ Internal toolkit shared by the CLI and the generators.
4
4
 
5
- ## Installation
5
+ ## Scope
6
6
 
7
- ```sh
8
- npm install -D @kosmojs/lib
9
- ```
7
+ Published because [`@kosmojs/cli`](https://www.npmjs.com/package/@kosmojs/cli),
8
+ [`@kosmojs/dev`](https://www.npmjs.com/package/@kosmojs/dev) and the generators depend on it - **not** intended for direct use.
9
+ It carries no stability guarantee across releases and can change shape in a patch.
10
+
11
+ It holds the pieces those packages need in common: TypeScript AST helpers for resolving validation types,
12
+ the generator base and file-deployment helpers, path and route utilities, the Handlebars render layer, and Vite helpers.
13
+
14
+ If you are writing a generator, depend on the documented contract in `@kosmojs/core/generators` instead.
10
15
 
11
16
  ## Documentation
12
17
 
13
- See [kosmojs.dev](https://kosmojs.dev)
18
+ - [Why code generation](https://kosmojs.dev/essentials/why-codegen.html)
19
+
20
+ Full documentation at [kosmojs.dev](https://kosmojs.dev).
14
21
 
15
22
  ## License
16
23
 
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@kosmojs/lib",
4
- "version": "0.4.4",
4
+ "version": "0.5.2",
5
+ "description": "Shared internals for the KosmoJS CLI and generators (not a public API)",
5
6
  "author": "Slee Woo",
6
7
  "license": "MIT",
7
8
  "repository": {
@@ -19,22 +20,23 @@
19
20
  }
20
21
  },
21
22
  "dependencies": {
22
- "@kosmojs/core": "^0.4.4",
23
- "@topcli/spinner": "^4.2.1",
23
+ "@kosmojs/core": "^0.5.2",
24
+ "@topcli/spinner": "^5.0.0",
24
25
  "crc": "^4.3.2",
25
26
  "handlebars": "^4.7.9",
26
27
  "mrmime": "^2.0.1",
28
+ "oxfmt": "^0.67.0",
27
29
  "path-to-regexp": "^8.4.2",
28
- "picomatch": "^4.0.5",
30
+ "picomatch": "^4.0.7",
29
31
  "tfusion": "^0.2.2",
30
32
  "tinyglobby": "^0.2.17",
31
33
  "ts-morph": "^28.0.0"
32
34
  },
33
35
  "devDependencies": {
34
36
  "@koa/router": "^15.7.0",
35
- "@kosmojs/lib": "^0.4.4",
37
+ "@kosmojs/lib": "^0.5.2",
36
38
  "@types/picomatch": "^4.0.3",
37
- "hono": "^4.13.3",
39
+ "hono": "^4.13.7",
38
40
  "rou3": "^0.9.2",
39
41
  "vite": "^8.2.2"
40
42
  },
@@ -0,0 +1,2 @@
1
+ import { type FormatConfig } from "oxfmt";
2
+ export declare const formatCode: (code: string, filename: string, config?: FormatConfig) => Promise<string>;
@@ -1,7 +1,7 @@
1
- import type { GeneratorFactory, GeneratorSignature, ResolvedEntry, SourceFolder, VirtualModule, WatcherEvent } from "@kosmojs/core";
2
- export declare const defineGenerator: <O extends object, R extends boolean = false>({ meta, factory, dependencies, devDependencies, }: Omit<GeneratorSignature, "factory"> & {
1
+ import type { GeneratorFactory, GeneratorSignature, ResolvedEntry, SourceFolder, WatcherEvent } from "@kosmojs/core";
2
+ export declare const defineGenerator: <O extends object, R extends boolean = false>({ meta, factory, dependencies, devDependencies, }: Omit<GeneratorSignature<O>, "factory"> & {
3
3
  factory: (f: SourceFolder, o?: O) => GeneratorFactory;
4
- }) => [R] extends [true] ? ((o: O) => GeneratorSignature) & Pick<GeneratorSignature, "meta" | "dependencies" | "devDependencies"> : ((o?: O) => GeneratorSignature) & Pick<GeneratorSignature, "meta" | "dependencies" | "devDependencies">;
4
+ }) => [R] extends [true] ? (o: O) => GeneratorSignature<O> : (o?: O) => GeneratorSignature<O>;
5
5
  export declare const defineGeneratorFactory: <O extends object>(factory: (f: SourceFolder, o?: O) => GeneratorFactory) => (f: SourceFolder, o?: O) => GeneratorFactory;
6
6
  /**
7
7
  * Filter watched API routes by event.
@@ -25,9 +25,3 @@ export declare const createWatchedApiRouteEntriesFilter: (event: WatcherEvent |
25
25
  * and any route referencing the updated file (shared types).
26
26
  * */
27
27
  export declare const createWatchedPageRouteEntriesFilter: (event: WatcherEvent | undefined, eventsOfInterest: Array<WatcherEvent["kind"]>) => ({ kind, entry }: ResolvedEntry) => boolean;
28
- /**
29
- * Gather virtual modules declared by a folder's generators.
30
- * Feed the result to `vitePlugins.virtualModules()`,
31
- * with `kind: "ssr"` on the SSR builds and `kind: "csr"` everywhere else.
32
- * */
33
- export declare const collectVirtualModules: (sourceFolder: SourceFolder, generators: Array<GeneratorSignature>) => Array<VirtualModule>;
package/pkg/generic.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import { type UserConfig } from "vite";
2
2
  export declare const mergeConfigs: (...configs: Array<UserConfig | undefined>) => UserConfig;
3
3
  export declare const escapeTemplateLiterals: (origin: string) => string;
4
+ export declare const containsPathTraversalPatterns: (str: string) => boolean;
package/pkg/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  export * from "./ast";
2
+ export * from "./format";
2
3
  export * from "./generators";
3
4
  export * from "./generic";
4
5
  export * from "./paths";
5
6
  export * from "./render";
6
7
  export * from "./routes";
7
8
  export * from "./spinner";
9
+ export * from "./tsconfig";
8
10
  export * from "./vite";