@tailorkit/vite 0.1.0-beta.43 → 0.1.0-beta.45

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/builder.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createTailorKitUploadManifest, tailorkitUploadManifestSchema } from "./upload-manifest.mjs";
2
2
  import { loadTailorKitConfig } from "./config-loader.mjs";
3
- import { d as appDatabasePaths, r as getClientSourceFiles, s as checkAppSchema, u as drizzleGenerateArguments } from "./file-routes-BYuuJaSg.mjs";
3
+ import { d as appDatabasePaths, r as getClientSourceFiles, s as checkAppSchema, u as drizzleGenerateArguments } from "./file-routes-CFV4aVRG.mjs";
4
4
  import { spawn } from "node:child_process";
5
5
  import { access } from "node:fs/promises";
6
6
  import path from "node:path";
@@ -0,0 +1,22 @@
1
+ import * as v from "valibot";
2
+ //#region src/config/config.ts
3
+ const logosConfigSchema = v.object({
4
+ dark: v.optional(v.pipe(v.string(), v.minLength(1))),
5
+ light: v.optional(v.pipe(v.string(), v.minLength(1)))
6
+ });
7
+ const tailorkitConfigSchema = v.strictObject({
8
+ appId: v.optional(v.pipe(v.string(), v.minLength(1))),
9
+ description: v.optional(v.nullable(v.pipe(v.string(), v.trim(), v.maxLength(255)))),
10
+ host: v.pipe(v.string(), v.url()),
11
+ logos: v.optional(logosConfigSchema),
12
+ name: v.pipe(v.string(), v.trim(), v.minLength(1)),
13
+ server: v.optional(v.strictObject({
14
+ entry: v.optional(v.pipe(v.string(), v.minLength(1)), "src/server.ts"),
15
+ migrations: v.optional(v.pipe(v.string(), v.minLength(1)))
16
+ })),
17
+ slug: v.pipe(v.string(), v.minLength(3), v.maxLength(32), v.regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/u))
18
+ });
19
+ const defineConfig = (config) => config;
20
+ const defineTailorKitConfig = defineConfig;
21
+ //#endregion
22
+ export { defineTailorKitConfig as n, tailorkitConfigSchema as r, defineConfig as t };
@@ -1,24 +1,25 @@
1
- import { z } from "zod";
1
+ import * as v from "valibot";
2
2
  //#region src/config/config.d.ts
3
- declare const tailorkitConfigSchema: z.ZodObject<{
4
- appId: z.ZodOptional<z.ZodString>;
5
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
- host: z.ZodURL;
7
- logos: z.ZodOptional<z.ZodObject<{
8
- dark: z.ZodOptional<z.ZodString>;
9
- light: z.ZodOptional<z.ZodString>;
10
- }, z.core.$strip>>;
11
- name: z.ZodOptional<z.ZodString>;
12
- server: z.ZodOptional<z.ZodObject<{
13
- entry: z.ZodDefault<z.ZodString>;
14
- migrations: z.ZodOptional<z.ZodString>;
15
- }, z.core.$strict>>;
16
- }, z.core.$strict>;
3
+ declare const tailorkitConfigSchema: v.StrictObjectSchema<{
4
+ readonly appId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
5
+ readonly description: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 255, undefined>]>, undefined>, undefined>;
6
+ readonly host: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UrlAction<string, undefined>]>;
7
+ readonly logos: v.OptionalSchema<v.ObjectSchema<{
8
+ readonly dark: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
9
+ readonly light: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
10
+ }, undefined>, undefined>;
11
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
12
+ readonly server: v.OptionalSchema<v.StrictObjectSchema<{
13
+ readonly entry: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, "src/server.ts">;
14
+ readonly migrations: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
15
+ }, undefined>, undefined>;
16
+ readonly slug: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 3, undefined>, v.MaxLengthAction<string, 32, undefined>, v.RegexAction<string, undefined>]>;
17
+ }, undefined>;
17
18
  /**
18
19
  * App configuration exported from `tailorkit.config.ts`.
19
20
  * Relative paths resolve from the app root: the Vite config directory when building.
20
21
  */
21
- interface TailorKitConfig extends z.input<typeof tailorkitConfigSchema> {
22
+ interface TailorKitConfig extends v.InferInput<typeof tailorkitConfigSchema> {
22
23
  /**
23
24
  * ID of the app on the TailorKit host, used for deployment.
24
25
  * When omitted, the first deployment creates an app and saves its ID here.
@@ -57,11 +58,10 @@ interface TailorKitConfig extends z.input<typeof tailorkitConfigSchema> {
57
58
  };
58
59
  /**
59
60
  * App name applied during deployment, including updates to an existing app.
60
- * When omitted, new apps use the package.json name or app directory name,
61
- * and existing apps keep their current name.
62
- * @default undefined
61
+ * Trimmed to remove surrounding whitespace; must not be blank.
62
+ * Required; has no default.
63
63
  */
64
- name?: string;
64
+ name: string;
65
65
  /**
66
66
  * Enables the private app backend and its database migrations when present.
67
67
  * Set to `{}` to use the default paths; omit for a client-only app.
@@ -81,8 +81,14 @@ interface TailorKitConfig extends z.input<typeof tailorkitConfigSchema> {
81
81
  */
82
82
  migrations?: string;
83
83
  };
84
+ /**
85
+ * Permanent app slug used when creating an app during deployment.
86
+ * Use 3–32 lowercase letters or digits, separated by single hyphens.
87
+ * Existing linked apps keep their slug. Required; has no default.
88
+ */
89
+ slug: string;
84
90
  }
85
- type ResolvedTailorKitConfig = z.output<typeof tailorkitConfigSchema>;
91
+ type ResolvedTailorKitConfig = v.InferOutput<typeof tailorkitConfigSchema>;
86
92
  declare const defineConfig: (config: TailorKitConfig) => TailorKitConfig;
87
93
  declare const defineTailorKitConfig: typeof defineConfig;
88
94
  //#endregion
@@ -1,4 +1,4 @@
1
- import { t as ResolvedTailorKitConfig } from "./config-D-xd9bbd.mjs";
1
+ import { t as ResolvedTailorKitConfig } from "./config-DeQBAkM1.mjs";
2
2
  //#region src/config/loader.d.ts
3
3
  export interface LoadedTailorKitConfig {
4
4
  config: ResolvedTailorKitConfig;
@@ -1,4 +1,5 @@
1
- import { r as tailorkitConfigSchema } from "./config-DRdCISw8.mjs";
1
+ import { r as tailorkitConfigSchema } from "./config-Cw3z9NGB.mjs";
2
+ import * as v from "valibot";
2
3
  import path from "node:path";
3
4
  import { cosmiconfig } from "cosmiconfig";
4
5
  //#region src/config/loader.ts
@@ -12,7 +13,7 @@ const loadTailorKitConfig = async (configPath, cwd = process.cwd()) => {
12
13
  const result = configPath === void 0 ? await explorer.search(searchFrom) : await explorer.load(path.resolve(searchFrom, configPath));
13
14
  if (result === null) throw new Error(`Could not find tailorkit config from ${searchFrom}.`);
14
15
  return {
15
- config: tailorkitConfigSchema.parse(result.config),
16
+ config: v.parse(tailorkitConfigSchema, result.config),
16
17
  filepath: result.filepath,
17
18
  root: path.dirname(result.filepath)
18
19
  };
package/dist/config.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { i as defineTailorKitConfig, n as TailorKitConfig, r as defineConfig } from "./config-D-xd9bbd.mjs";
1
+ import { i as defineTailorKitConfig, n as TailorKitConfig, r as defineConfig } from "./config-DeQBAkM1.mjs";
2
2
  export { type TailorKitConfig, defineConfig, defineTailorKitConfig };
package/dist/config.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as defineTailorKitConfig, t as defineConfig } from "./config-DRdCISw8.mjs";
1
+ import { n as defineTailorKitConfig, t as defineConfig } from "./config-Cw3z9NGB.mjs";
2
2
  export { defineConfig, defineTailorKitConfig };
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from "node:module";
2
- import { z } from "zod";
2
+ import * as v from "valibot";
3
3
  import { execFile } from "node:child_process";
4
4
  import { access, mkdir, mkdtemp, readFile, readdir, rm, writeFile } from "node:fs/promises";
5
5
  import path from "node:path";
@@ -58,13 +58,13 @@ const snapshot = async (directory) => {
58
58
  })).filter((entry) => entry.isDirectory()).map((entry) => entry.name).toSorted().at(-1);
59
59
  if (!(latest !== void 0 && latest !== null && latest !== "")) return;
60
60
  const filename = path.join(directory, latest, "snapshot.json");
61
- const parsed = z.object({
62
- ddl: z.array(z.unknown()),
63
- dialect: z.literal("sqlite"),
64
- version: z.literal("7")
65
- }).safeParse(JSON.parse(await readFile(filename, "utf-8")));
61
+ const parsed = v.safeParse(v.object({
62
+ ddl: v.array(v.unknown()),
63
+ dialect: v.literal("sqlite"),
64
+ version: v.literal("7")
65
+ }), JSON.parse(await readFile(filename, "utf-8")));
66
66
  if (!parsed.success) throw new Error(`Unsupported app schema snapshot: ${filename}. Use Drizzle Kit v1 SQLite migrations.`);
67
- return parsed.data;
67
+ return parsed.output;
68
68
  };
69
69
  const canonical = (value) => {
70
70
  if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { createTailorKitUploadManifest, tailorkitUploadManifestSchema } from "./upload-manifest.mjs";
2
2
  import { loadTailorKitConfig } from "./config-loader.mjs";
3
- import { a as createDefineViewMatcher, c as isMissingFile, d as appDatabasePaths, i as inferFileView, l as getBuildEnvironment, n as fileRoutesPlugin, o as forEachSequential, s as checkAppSchema, t as createFileRouteEntry } from "./file-routes-BYuuJaSg.mjs";
3
+ import { a as createDefineViewMatcher, c as isMissingFile, d as appDatabasePaths, i as inferFileView, l as getBuildEnvironment, n as fileRoutesPlugin, o as forEachSequential, s as checkAppSchema, t as createFileRouteEntry } from "./file-routes-CFV4aVRG.mjs";
4
4
  import { createRequire } from "node:module";
5
- import { z } from "zod";
5
+ import * as v from "valibot";
6
6
  import { execFile } from "node:child_process";
7
7
  import { cp, mkdir, mkdtemp, readFile, readdir, realpath, rm, writeFile } from "node:fs/promises";
8
8
  import path from "node:path";
@@ -102,14 +102,14 @@ const readClientManifest = async (filename) => {
102
102
  timeout: 1e4
103
103
  });
104
104
  const result = stdout.slice(stdout.lastIndexOf("\nTAILORKIT_VIEWS=") + 17);
105
- return z.object({
106
- instanceResolvers: z.array(z.object({
107
- path: z.string(),
108
- resolver: z.string().regex(/^i[0-9a-f]{24}$/u),
109
- slot: z.string()
105
+ return v.parse(v.object({
106
+ instanceResolvers: v.array(v.object({
107
+ path: v.string(),
108
+ resolver: v.pipe(v.string(), v.regex(/^i[0-9a-f]{24}$/u)),
109
+ slot: v.string()
110
110
  })),
111
- views: tailorkitUploadManifestSchema.shape.views.unwrap()
112
- }).parse(JSON.parse(result));
111
+ views: v.unwrap(tailorkitUploadManifestSchema.entries.views)
112
+ }), JSON.parse(result));
113
113
  } catch (error) {
114
114
  throw new Error("Unable to read app views during the build. Keep browser-only side effects inside components or effects. Check the default exports of your roots, layouts and .view.tsx files.", { cause: error });
115
115
  }
@@ -632,7 +632,7 @@ const getInstalledPreactVersion = (root) => {
632
632
  const require = createRequire(path.join(root, "package.json"));
633
633
  try {
634
634
  const packageJsonPath = require.resolve("preact/package.json");
635
- const packageJson = z.object({ version: z.string().optional() }).parse(require(packageJsonPath));
635
+ const packageJson = v.parse(v.object({ version: v.optional(v.string()) }), require(packageJsonPath));
636
636
  if (packageJson.version !== void 0) return packageJson.version;
637
637
  } catch (error) {
638
638
  throw new Error(`TailorKit requires Preact to build an app. Install preact@^11 and try again.`, { cause: error });
@@ -1,22 +1,27 @@
1
- import { z } from "zod";
1
+ import * as v from "valibot";
2
2
  //#region src/builder/upload-manifest.d.ts
3
- export declare const tailorkitUploadManifestSchema: z.ZodObject<{
4
- assets: z.ZodObject<{
5
- client: z.ZodLiteral<"client/client.js">;
6
- logos: z.ZodOptional<z.ZodObject<{
7
- dark: z.ZodOptional<z.ZodString>;
8
- light: z.ZodOptional<z.ZodString>;
9
- }, z.core.$strip>>;
10
- server: z.ZodOptional<z.ZodLiteral<"server/server.js">>;
11
- }, z.core.$strip>;
12
- version: z.ZodLiteral<1>;
13
- views: z.ZodOptional<z.ZodArray<z.ZodObject<{
14
- disabled: z.ZodOptional<z.ZodLiteral<true>>;
15
- instances: z.ZodOptional<z.ZodLiteral<true>>;
16
- path: z.ZodString;
17
- slot: z.ZodString;
18
- }, z.core.$strip>>>;
19
- }, z.core.$strip>;
20
- export type TailorKitUploadManifest = z.output<typeof tailorkitUploadManifestSchema>;
3
+ export declare const tailorkitUploadManifestSchema: v.ObjectSchema<{
4
+ readonly assets: v.ObjectSchema<{
5
+ readonly client: v.LiteralSchema<"client/client.js", undefined>;
6
+ readonly logos: v.OptionalSchema<v.ObjectSchema<{
7
+ readonly dark: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
8
+ readonly light: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
9
+ }, undefined>, undefined>;
10
+ readonly server: v.OptionalSchema<v.LiteralSchema<"server/server.js", undefined>, undefined>;
11
+ }, undefined>;
12
+ readonly version: v.LiteralSchema<1, undefined>;
13
+ readonly views: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
14
+ readonly disabled: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
15
+ readonly instances: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
16
+ readonly path: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.StartsWithAction<string, "/", undefined>, v.MaxLengthAction<string, 1024, undefined>]>;
17
+ readonly slot: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 255, undefined>]>;
18
+ }, undefined>, undefined>, v.MaxLengthAction<{
19
+ disabled?: true | undefined;
20
+ instances?: true | undefined;
21
+ path: string;
22
+ slot: string;
23
+ }[], 1000, undefined>]>, undefined>;
24
+ }, undefined>;
25
+ export type TailorKitUploadManifest = v.InferOutput<typeof tailorkitUploadManifestSchema>;
21
26
  export declare const createTailorKitUploadManifest: (logos?: TailorKitUploadManifest["assets"]["logos"], server?: boolean, views?: TailorKitUploadManifest["views"]) => TailorKitUploadManifest;
22
27
  //#endregion
@@ -1,27 +1,27 @@
1
- import { z } from "zod";
1
+ import * as v from "valibot";
2
2
  //#region src/builder/upload-manifest.ts
3
- const tailorkitUploadManifestSchema = z.object({
4
- assets: z.object({
5
- client: z.literal("client/client.js"),
6
- logos: z.object({
7
- dark: z.string().regex(/^client\/logo-dark\.(?:png|svg|webp)$/u).optional(),
8
- light: z.string().regex(/^client\/logo-light\.(?:png|svg|webp)$/u).optional()
9
- }).optional(),
10
- server: z.literal("server/server.js").optional()
3
+ const tailorkitUploadManifestSchema = v.object({
4
+ assets: v.object({
5
+ client: v.literal("client/client.js"),
6
+ logos: v.optional(v.object({
7
+ dark: v.optional(v.pipe(v.string(), v.regex(/^client\/logo-dark\.(?:png|svg|webp)$/u))),
8
+ light: v.optional(v.pipe(v.string(), v.regex(/^client\/logo-light\.(?:png|svg|webp)$/u)))
9
+ })),
10
+ server: v.optional(v.literal("server/server.js"))
11
11
  }),
12
- version: z.literal(1),
13
- views: z.array(z.object({
14
- disabled: z.literal(true).optional(),
15
- instances: z.literal(true).optional(),
16
- path: z.string().startsWith("/").max(1024),
17
- slot: z.string().min(1).max(255)
18
- })).max(1e3).optional()
12
+ version: v.literal(1),
13
+ views: v.optional(v.pipe(v.array(v.object({
14
+ disabled: v.optional(v.literal(true)),
15
+ instances: v.optional(v.literal(true)),
16
+ path: v.pipe(v.string(), v.startsWith("/"), v.maxLength(1024)),
17
+ slot: v.pipe(v.string(), v.minLength(1), v.maxLength(255))
18
+ })), v.maxLength(1e3)))
19
19
  });
20
20
  const createTailorKitUploadManifest = (logos, server = false, views) => {
21
21
  const assets = { client: "client/client.js" };
22
22
  if (server) assets.server = "server/server.js";
23
23
  if (logos && Object.keys(logos).length > 0) assets.logos = logos;
24
- return tailorkitUploadManifestSchema.parse({
24
+ return v.parse(tailorkitUploadManifestSchema, {
25
25
  assets,
26
26
  version: 1,
27
27
  views
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailorkit/vite",
3
- "version": "0.1.0-beta.43",
3
+ "version": "0.1.0-beta.45",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -47,9 +47,9 @@
47
47
  "access": "public"
48
48
  },
49
49
  "dependencies": {
50
- "@tailorkit/app": "0.1.0-beta.43",
50
+ "@tailorkit/app": "0.1.0-beta.45",
51
51
  "cosmiconfig": "^10.0.1",
52
- "zod": "^4.6.5"
52
+ "valibot": "^1.5.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@tailorkit/asset-delivery": "0.0.0",
@@ -61,7 +61,8 @@
61
61
  "preact": "^11.0.1",
62
62
  "typescript": "^7.0.2",
63
63
  "vite": "npm:@voidzero-dev/vite-plus-core@1.1.0",
64
- "vite-plus": "1.1.0"
64
+ "vite-plus": "1.1.0",
65
+ "zod": "^4.6.5"
65
66
  },
66
67
  "peerDependencies": {
67
68
  "vite": "^8.0.0 || ^1.0.0"
@@ -1,21 +0,0 @@
1
- import { z } from "zod";
2
- //#region src/config/config.ts
3
- const logosConfigSchema = z.object({
4
- dark: z.string().min(1).optional(),
5
- light: z.string().min(1).optional()
6
- });
7
- const tailorkitConfigSchema = z.strictObject({
8
- appId: z.string().min(1).optional(),
9
- description: z.string().trim().max(255).nullable().optional(),
10
- host: z.url(),
11
- logos: logosConfigSchema.optional(),
12
- name: z.string().trim().min(1).optional(),
13
- server: z.strictObject({
14
- entry: z.string().min(1).default("src/server.ts"),
15
- migrations: z.string().min(1).optional()
16
- }).optional()
17
- });
18
- const defineConfig = (config) => config;
19
- const defineTailorKitConfig = defineConfig;
20
- //#endregion
21
- export { defineTailorKitConfig as n, tailorkitConfigSchema as r, defineConfig as t };