@tailorkit/vite 0.1.0-beta.44 → 0.1.0-beta.46

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-CFV4aVRG.mjs";
3
+ import { d as appDatabasePaths, r as getClientSourceFiles, s as checkAppSchema, u as drizzleGenerateArguments } from "./file-routes-Cq20iqWz.mjs";
4
4
  import { spawn } from "node:child_process";
5
5
  import { access } from "node:fs/promises";
6
6
  import path from "node:path";
@@ -9,11 +9,12 @@ const tailorkitConfigSchema = v.strictObject({
9
9
  description: v.optional(v.nullable(v.pipe(v.string(), v.trim(), v.maxLength(255)))),
10
10
  host: v.pipe(v.string(), v.url()),
11
11
  logos: v.optional(logosConfigSchema),
12
- name: v.optional(v.pipe(v.string(), v.trim(), v.minLength(1))),
12
+ name: v.pipe(v.string(), v.trim(), v.minLength(1)),
13
13
  server: v.optional(v.strictObject({
14
14
  entry: v.optional(v.pipe(v.string(), v.minLength(1)), "src/server.ts"),
15
15
  migrations: v.optional(v.pipe(v.string(), v.minLength(1)))
16
- }))
16
+ })),
17
+ slug: v.pipe(v.string(), v.minLength(3), v.maxLength(32), v.regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/u))
17
18
  });
18
19
  const defineConfig = (config) => config;
19
20
  const defineTailorKitConfig = defineConfig;
@@ -8,11 +8,12 @@ declare const tailorkitConfigSchema: v.StrictObjectSchema<{
8
8
  readonly dark: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
9
9
  readonly light: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
10
10
  }, undefined>, undefined>;
11
- readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>, undefined>;
11
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
12
12
  readonly server: v.OptionalSchema<v.StrictObjectSchema<{
13
13
  readonly entry: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, "src/server.ts">;
14
14
  readonly migrations: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
15
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>]>;
16
17
  }, undefined>;
17
18
  /**
18
19
  * App configuration exported from `tailorkit.config.ts`.
@@ -57,11 +58,10 @@ interface TailorKitConfig extends v.InferInput<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,6 +81,12 @@ interface TailorKitConfig extends v.InferInput<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
91
  type ResolvedTailorKitConfig = v.InferOutput<typeof tailorkitConfigSchema>;
86
92
  declare const defineConfig: (config: TailorKitConfig) => TailorKitConfig;
@@ -1,4 +1,4 @@
1
- import { t as ResolvedTailorKitConfig } from "./config-BQiPSa0K.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,4 @@
1
- import { r as tailorkitConfigSchema } from "./config-DZuCdN7v.mjs";
1
+ import { r as tailorkitConfigSchema } from "./config-Cw3z9NGB.mjs";
2
2
  import * as v from "valibot";
3
3
  import path from "node:path";
4
4
  import { cosmiconfig } from "cosmiconfig";
package/dist/config.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { i as defineTailorKitConfig, n as TailorKitConfig, r as defineConfig } from "./config-BQiPSa0K.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-DZuCdN7v.mjs";
1
+ import { n as defineTailorKitConfig, t as defineConfig } from "./config-Cw3z9NGB.mjs";
2
2
  export { defineConfig, defineTailorKitConfig };
@@ -128,15 +128,13 @@ const createScope = (parent, functionScope = false) => ({
128
128
  });
129
129
  const bindingNames = (node) => {
130
130
  if (!node) return [];
131
- switch (node.type) {
132
- case "Identifier": return [node.name];
133
- case "RestElement": return bindingNames(node.argument);
134
- case "AssignmentPattern": return bindingNames(node.left);
135
- case "ArrayPattern": return node.elements.flatMap(bindingNames);
136
- case "ObjectPattern": return node.properties.flatMap((property) => bindingNames(property.type === "Property" ? property.value : property.argument));
137
- case "TSParameterProperty": return bindingNames(node.parameter);
138
- default: return [];
139
- }
131
+ if (node.type === "Identifier") return [node.name];
132
+ else if (node.type === "RestElement") return bindingNames(node.argument);
133
+ else if (node.type === "AssignmentPattern") return bindingNames(node.left);
134
+ else if (node.type === "ArrayPattern") return node.elements.flatMap(bindingNames);
135
+ else if (node.type === "ObjectPattern") return node.properties.flatMap((property) => bindingNames(property.type === "Property" ? property.value : property.argument));
136
+ else if (node.type === "TSParameterProperty") return bindingNames(node.parameter);
137
+ return [];
140
138
  };
141
139
  const bind = (node, scope) => {
142
140
  for (const name of bindingNames(node)) scope.bindings.set(name, "local");
@@ -181,44 +179,25 @@ const callScopes = (program) => {
181
179
  const visit = (node, initialScope) => {
182
180
  let scope = initialScope;
183
181
  scopes.set(node, scope);
184
- switch (node.type) {
185
- case "ImportDeclaration":
186
- bindImports(node, scope);
187
- return;
188
- case "VariableDeclaration":
189
- bindVariables(node, scope);
190
- break;
191
- case "FunctionDeclaration":
192
- case "FunctionExpression":
193
- case "ArrowFunctionExpression":
194
- visitFunction(node, scope, visit);
195
- return;
196
- case "ClassDeclaration":
197
- case "ClassExpression":
198
- scope = classScope(node, scope);
199
- break;
200
- case "CatchClause":
201
- scope = createScope(scope);
202
- bind(node.param, scope);
203
- break;
204
- case "SwitchStatement":
205
- visit(node.discriminant, scope);
206
- scope = createScope(scope);
207
- for (const branch of node.cases) visit(branch, scope);
208
- return;
209
- case "BlockStatement":
210
- case "ForStatement":
211
- case "ForInStatement":
212
- case "ForOfStatement":
213
- scope = createScope(scope);
214
- break;
215
- case "StaticBlock":
216
- case "TSModuleBlock":
217
- scope = createScope(scope, true);
218
- break;
219
- case "TSEnumDeclaration":
220
- case "TSModuleDeclaration": bind(node.id, scope);
221
- }
182
+ if (node.type === "ImportDeclaration") {
183
+ bindImports(node, scope);
184
+ return;
185
+ } else if (node.type === "VariableDeclaration") bindVariables(node, scope);
186
+ else if (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") {
187
+ visitFunction(node, scope, visit);
188
+ return;
189
+ } else if (node.type === "ClassDeclaration" || node.type === "ClassExpression") scope = classScope(node, scope);
190
+ else if (node.type === "CatchClause") {
191
+ scope = createScope(scope);
192
+ bind(node.param, scope);
193
+ } else if (node.type === "SwitchStatement") {
194
+ visit(node.discriminant, scope);
195
+ scope = createScope(scope);
196
+ for (const branch of node.cases) visit(branch, scope);
197
+ return;
198
+ } else if (node.type === "BlockStatement" || node.type === "ForStatement" || node.type === "ForInStatement" || node.type === "ForOfStatement") scope = createScope(scope);
199
+ else if (node.type === "StaticBlock" || node.type === "TSModuleBlock") scope = createScope(scope, true);
200
+ else if (node.type === "TSEnumDeclaration" || node.type === "TSModuleDeclaration") bind(node.id, scope);
222
201
  for (const child of childNodes(node)) visit(child, scope);
223
202
  };
224
203
  visit(program, createScope(void 0, true));
package/dist/index.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 { 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";
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-Cq20iqWz.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import * as v from "valibot";
6
6
  import { execFile } from "node:child_process";
@@ -141,14 +141,12 @@ const walk = (node, visit, ancestors = []) => {
141
141
  };
142
142
  const boundNames = (node) => {
143
143
  if (!node) return [];
144
- switch (node.type) {
145
- case "Identifier": return [node.name];
146
- case "RestElement": return boundNames(node.argument);
147
- case "AssignmentPattern": return boundNames(node.left);
148
- case "ArrayPattern": return node.elements.flatMap(boundNames);
149
- case "ObjectPattern": return node.properties.flatMap((p) => boundNames(p.type === "Property" ? p.value : p.argument));
150
- default: return [];
151
- }
144
+ if (node.type === "Identifier") return [node.name];
145
+ else if (node.type === "RestElement") return boundNames(node.argument);
146
+ else if (node.type === "AssignmentPattern") return boundNames(node.left);
147
+ else if (node.type === "ArrayPattern") return node.elements.flatMap(boundNames);
148
+ else if (node.type === "ObjectPattern") return node.properties.flatMap((p) => boundNames(p.type === "Property" ? p.value : p.argument));
149
+ return [];
152
150
  };
153
151
  const declarations = (node) => {
154
152
  if (node.type === "VariableDeclaration") return node.declarations.flatMap((d) => boundNames(d.id));
@@ -762,7 +760,7 @@ const tailorkit = (options = {}) => {
762
760
  enforce: "pre",
763
761
  name: "tailorkit-browser-server-boundary",
764
762
  async resolveId(id, importer) {
765
- if (/^(?:@tailorkit\/app\/server$|tailorkit\/(?:server|app\/server)$|effect(?:\/|$))/u.test(id) || importer !== void 0 && importer !== null && importer !== "" && path.resolve(path.dirname(importer), id) === serverEntry) throw new Error("App server implementations cannot be imported into a browser bundle. Import api from #tailorkit and server types with import type.");
763
+ if (/^(?:@tailorkit\/(?:app\/server|app-db)$|tailorkit\/(?:server|db|app\/server)$|effect(?:\/|$))/u.test(id) || importer !== void 0 && importer !== null && importer !== "" && path.resolve(path.dirname(importer), id) === serverEntry) throw new Error("App server implementations cannot be imported into a browser bundle. Import api from #tailorkit and server types with import type.");
766
764
  if (importer !== void 0 && importer !== null && importer !== "") {
767
765
  if ((await this.resolve(id, importer, { skipSelf: true }))?.id.split("?")[0] === serverEntry) throw new Error("App server implementations cannot be imported into a browser bundle. Import api from #tailorkit and server types with import type.");
768
766
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailorkit/vite",
3
- "version": "0.1.0-beta.44",
3
+ "version": "0.1.0-beta.46",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -47,7 +47,7 @@
47
47
  "access": "public"
48
48
  },
49
49
  "dependencies": {
50
- "@tailorkit/app": "0.1.0-beta.44",
50
+ "@tailorkit/app": "0.1.0-beta.46",
51
51
  "cosmiconfig": "^10.0.1",
52
52
  "valibot": "^1.5.0"
53
53
  },