@tailorkit/vite 0.1.0-beta.43 → 0.1.0-beta.44
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 +1 -1
- package/dist/{config-D-xd9bbd.d.mts → config-BQiPSa0K.d.mts} +17 -17
- package/dist/config-DZuCdN7v.mjs +21 -0
- package/dist/config-loader.d.mts +1 -1
- package/dist/config-loader.mjs +3 -2
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -1
- package/dist/{file-routes-BYuuJaSg.mjs → file-routes-CFV4aVRG.mjs} +7 -7
- package/dist/index.mjs +10 -10
- package/dist/upload-manifest.d.mts +24 -19
- package/dist/upload-manifest.mjs +17 -17
- package/package.json +5 -4
- package/dist/config-DRdCISw8.mjs +0 -21
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-
|
|
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";
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as v from "valibot";
|
|
2
2
|
//#region src/config/config.d.ts
|
|
3
|
-
declare const tailorkitConfigSchema:
|
|
4
|
-
appId:
|
|
5
|
-
description:
|
|
6
|
-
host:
|
|
7
|
-
logos:
|
|
8
|
-
dark:
|
|
9
|
-
light:
|
|
10
|
-
},
|
|
11
|
-
name:
|
|
12
|
-
server:
|
|
13
|
-
entry:
|
|
14
|
-
migrations:
|
|
15
|
-
},
|
|
16
|
-
},
|
|
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.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>, 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
|
+
}, undefined>;
|
|
17
17
|
/**
|
|
18
18
|
* App configuration exported from `tailorkit.config.ts`.
|
|
19
19
|
* Relative paths resolve from the app root: the Vite config directory when building.
|
|
20
20
|
*/
|
|
21
|
-
interface TailorKitConfig extends
|
|
21
|
+
interface TailorKitConfig extends v.InferInput<typeof tailorkitConfigSchema> {
|
|
22
22
|
/**
|
|
23
23
|
* ID of the app on the TailorKit host, used for deployment.
|
|
24
24
|
* When omitted, the first deployment creates an app and saves its ID here.
|
|
@@ -82,7 +82,7 @@ interface TailorKitConfig extends z.input<typeof tailorkitConfigSchema> {
|
|
|
82
82
|
migrations?: string;
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
type ResolvedTailorKitConfig =
|
|
85
|
+
type ResolvedTailorKitConfig = v.InferOutput<typeof tailorkitConfigSchema>;
|
|
86
86
|
declare const defineConfig: (config: TailorKitConfig) => TailorKitConfig;
|
|
87
87
|
declare const defineTailorKitConfig: typeof defineConfig;
|
|
88
88
|
//#endregion
|
|
@@ -0,0 +1,21 @@
|
|
|
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.optional(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
|
+
});
|
|
18
|
+
const defineConfig = (config) => config;
|
|
19
|
+
const defineTailorKitConfig = defineConfig;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { defineTailorKitConfig as n, tailorkitConfigSchema as r, defineConfig as t };
|
package/dist/config-loader.d.mts
CHANGED
package/dist/config-loader.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { r as tailorkitConfigSchema } from "./config-
|
|
1
|
+
import { r as tailorkitConfigSchema } from "./config-DZuCdN7v.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:
|
|
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-
|
|
1
|
+
import { i as defineTailorKitConfig, n as TailorKitConfig, r as defineConfig } from "./config-BQiPSa0K.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-
|
|
1
|
+
import { n as defineTailorKitConfig, t as defineConfig } from "./config-DZuCdN7v.mjs";
|
|
2
2
|
export { defineConfig, defineTailorKitConfig };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
import
|
|
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 =
|
|
62
|
-
ddl:
|
|
63
|
-
dialect:
|
|
64
|
-
version:
|
|
65
|
-
})
|
|
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.
|
|
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-
|
|
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
|
|
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
|
|
106
|
-
instanceResolvers:
|
|
107
|
-
path:
|
|
108
|
-
resolver:
|
|
109
|
-
slot:
|
|
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.
|
|
112
|
-
})
|
|
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 =
|
|
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
|
|
1
|
+
import * as v from "valibot";
|
|
2
2
|
//#region src/builder/upload-manifest.d.ts
|
|
3
|
-
export declare const tailorkitUploadManifestSchema:
|
|
4
|
-
assets:
|
|
5
|
-
client:
|
|
6
|
-
logos:
|
|
7
|
-
dark:
|
|
8
|
-
light:
|
|
9
|
-
},
|
|
10
|
-
server:
|
|
11
|
-
},
|
|
12
|
-
version:
|
|
13
|
-
views:
|
|
14
|
-
disabled:
|
|
15
|
-
instances:
|
|
16
|
-
path:
|
|
17
|
-
slot:
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
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
|
package/dist/upload-manifest.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as v from "valibot";
|
|
2
2
|
//#region src/builder/upload-manifest.ts
|
|
3
|
-
const tailorkitUploadManifestSchema =
|
|
4
|
-
assets:
|
|
5
|
-
client:
|
|
6
|
-
logos:
|
|
7
|
-
dark:
|
|
8
|
-
light:
|
|
9
|
-
})
|
|
10
|
-
server:
|
|
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:
|
|
13
|
-
views:
|
|
14
|
-
disabled:
|
|
15
|
-
instances:
|
|
16
|
-
path:
|
|
17
|
-
slot:
|
|
18
|
-
})).
|
|
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
|
|
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.
|
|
3
|
+
"version": "0.1.0-beta.44",
|
|
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.
|
|
50
|
+
"@tailorkit/app": "0.1.0-beta.44",
|
|
51
51
|
"cosmiconfig": "^10.0.1",
|
|
52
|
-
"
|
|
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"
|
package/dist/config-DRdCISw8.mjs
DELETED
|
@@ -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 };
|