@tailorkit/app 0.1.0-beta.4 → 0.1.0-beta.40
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/LICENSE.md +74 -0
- package/README.md +123 -0
- package/dist/chunk-5B5RGL5W.js +410 -0
- package/dist/chunk-7ZQPXG7O.js +34 -0
- package/dist/chunk-Q6X2VQKX.js +620 -0
- package/dist/chunk-YX3JURMG.js +262 -0
- package/dist/client/connection.d.ts +31 -0
- package/dist/client/query-store.d.ts +23 -0
- package/dist/client/reference.d.ts +20 -0
- package/dist/client/session.d.ts +41 -0
- package/dist/client/tools.d.ts +16 -0
- package/dist/client-connection.js +16 -0
- package/dist/client.d.ts +11 -0
- package/dist/client.js +40 -0
- package/dist/database/definition.d.ts +8 -0
- package/dist/database/schema.d.ts +78 -0
- package/dist/database/types.d.ts +8 -0
- package/dist/errors.d.ts +6 -0
- package/dist/index.d.ts +2 -71
- package/dist/index.js +91 -76
- package/dist/preact.d.ts +52 -0
- package/dist/protocol.d.ts +74 -0
- package/dist/protocol.js +30 -0
- package/dist/routing.d.ts +35 -0
- package/dist/server/builder.d.ts +45 -0
- package/dist/server/bundle.d.ts +12 -0
- package/dist/server/functions.d.ts +106 -0
- package/dist/server/instances.d.ts +17 -0
- package/dist/server.d.ts +11 -0
- package/dist/server.js +60 -0
- package/dist/views.d.ts +126 -0
- package/package.json +57 -21
- package/LICENSE +0 -674
- package/dist/builder/index.d.ts +0 -10
- package/dist/builder/upload-manifest.d.ts +0 -9
- package/dist/builder.js +0 -135
- package/dist/chunk-7L6ZZHCK.js +0 -26
- package/dist/chunk-AGGRUUWG.js +0 -22
- package/dist/config/config.d.ts +0 -16
- package/dist/config/index.d.ts +0 -1
- package/dist/config/loader.d.ts +0 -7
- package/dist/config-loader.js +0 -7
- package/dist/config.js +0 -8
- package/dist/preact-version.d.ts +0 -7
package/dist/builder/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { createTailorKitUploadManifest, tailorkitUploadManifestSchema, type TailorKitUploadManifest, } from "./upload-manifest";
|
|
2
|
-
export interface BuildAppOptions {
|
|
3
|
-
configPath?: string;
|
|
4
|
-
cwd?: string;
|
|
5
|
-
entry?: string;
|
|
6
|
-
mode?: string;
|
|
7
|
-
outDir?: string;
|
|
8
|
-
watch?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare const buildApp: (options?: BuildAppOptions) => Promise<unknown>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const tailorkitUploadManifestSchema: z.ZodObject<{
|
|
3
|
-
assets: z.ZodObject<{
|
|
4
|
-
client: z.ZodLiteral<"client.js">;
|
|
5
|
-
}, z.core.$strip>;
|
|
6
|
-
version: z.ZodLiteral<1>;
|
|
7
|
-
}, z.core.$strip>;
|
|
8
|
-
export type TailorKitUploadManifest = z.output<typeof tailorkitUploadManifestSchema>;
|
|
9
|
-
export declare const createTailorKitUploadManifest: () => TailorKitUploadManifest;
|
package/dist/builder.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
loadTailorKitConfig
|
|
3
|
-
} from "./chunk-7L6ZZHCK.js";
|
|
4
|
-
import "./chunk-AGGRUUWG.js";
|
|
5
|
-
|
|
6
|
-
// src/builder/index.ts
|
|
7
|
-
import path from "path";
|
|
8
|
-
import { createRequire } from "module";
|
|
9
|
-
import { writeFile } from "fs/promises";
|
|
10
|
-
import { build as viteBuild } from "vite";
|
|
11
|
-
|
|
12
|
-
// src/preact-version.ts
|
|
13
|
-
var MINIMUM_PREACT_MAJOR_VERSION = 10;
|
|
14
|
-
var parsePreactVersion = (version) => {
|
|
15
|
-
const match = /^(\d+)\./u.exec(version);
|
|
16
|
-
if (!match?.[1]) {
|
|
17
|
-
throw new Error(`Unable to parse Preact version "${version}".`);
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
major: Number.parseInt(match[1], 10),
|
|
21
|
-
version
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
var assertSupportedPreactVersion = (version) => {
|
|
25
|
-
const check = parsePreactVersion(version);
|
|
26
|
-
if (check.major < MINIMUM_PREACT_MAJOR_VERSION) {
|
|
27
|
-
throw new Error(
|
|
28
|
-
`TailorKit requires Preact ${MINIMUM_PREACT_MAJOR_VERSION}.0.0 or newer, but found ${version}.`
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
return check;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
// src/builder/upload-manifest.ts
|
|
35
|
-
import { z } from "zod";
|
|
36
|
-
var tailorkitUploadManifestSchema = z.object({
|
|
37
|
-
assets: z.object({
|
|
38
|
-
client: z.literal("client.js")
|
|
39
|
-
}),
|
|
40
|
-
version: z.literal(1)
|
|
41
|
-
});
|
|
42
|
-
var createTailorKitUploadManifest = () => tailorkitUploadManifestSchema.parse({
|
|
43
|
-
assets: {
|
|
44
|
-
client: "client.js"
|
|
45
|
-
},
|
|
46
|
-
version: 1
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// src/builder/index.ts
|
|
50
|
-
var preactExternal = /^preact(?:\/.*)?$/u;
|
|
51
|
-
var preactPackageJson = "preact/package.json";
|
|
52
|
-
var preactPackageJsonModuleId = "\0tailorkit-preact-package-json";
|
|
53
|
-
var buildApp = async (options = {}) => {
|
|
54
|
-
const loaded = await loadTailorKitConfig(options.configPath, options.cwd);
|
|
55
|
-
const entry = options.entry ?? loaded.config.client?.entry ?? "./src/client.ts";
|
|
56
|
-
const outDir = options.outDir ?? loaded.config.build?.outDir ?? ".tailorkit";
|
|
57
|
-
const preactVersion = getInstalledPreactVersion(loaded.root);
|
|
58
|
-
assertSupportedPreactVersion(preactVersion);
|
|
59
|
-
const resolvedOutDir = path.resolve(loaded.root, outDir);
|
|
60
|
-
const result = await viteBuild({
|
|
61
|
-
build: {
|
|
62
|
-
emptyOutDir: true,
|
|
63
|
-
lib: {
|
|
64
|
-
entry: path.resolve(loaded.root, entry),
|
|
65
|
-
fileName: "client",
|
|
66
|
-
formats: ["es"]
|
|
67
|
-
},
|
|
68
|
-
outDir: resolvedOutDir,
|
|
69
|
-
watch: options.watch ? {} : null,
|
|
70
|
-
minify: "oxc",
|
|
71
|
-
rollupOptions: {
|
|
72
|
-
external: (id) => id !== preactPackageJson && id !== preactPackageJsonModuleId && preactExternal.test(id),
|
|
73
|
-
output: {
|
|
74
|
-
comments: {
|
|
75
|
-
annotation: false,
|
|
76
|
-
jsdoc: false,
|
|
77
|
-
legal: false
|
|
78
|
-
},
|
|
79
|
-
minify: true,
|
|
80
|
-
minifyInternalExports: true
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
configFile: false,
|
|
85
|
-
mode: options.mode,
|
|
86
|
-
plugins: [
|
|
87
|
-
{
|
|
88
|
-
name: "tailorkit-preact-package-json",
|
|
89
|
-
enforce: "pre",
|
|
90
|
-
resolveId(id) {
|
|
91
|
-
if (id === preactPackageJson) {
|
|
92
|
-
return preactPackageJsonModuleId;
|
|
93
|
-
}
|
|
94
|
-
return null;
|
|
95
|
-
},
|
|
96
|
-
load(id) {
|
|
97
|
-
if (id === preactPackageJsonModuleId) {
|
|
98
|
-
const version = JSON.stringify(preactVersion);
|
|
99
|
-
return `export const version = ${version}; export default { version: ${version} };`;
|
|
100
|
-
}
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
],
|
|
105
|
-
root: loaded.root
|
|
106
|
-
});
|
|
107
|
-
await writeFile(
|
|
108
|
-
path.join(resolvedOutDir, "tailorkit-upload.json"),
|
|
109
|
-
`${JSON.stringify(createTailorKitUploadManifest(), null, 2)}
|
|
110
|
-
`,
|
|
111
|
-
"utf-8"
|
|
112
|
-
);
|
|
113
|
-
return result;
|
|
114
|
-
};
|
|
115
|
-
function getInstalledPreactVersion(root) {
|
|
116
|
-
const require2 = createRequire(path.join(root, "package.json"));
|
|
117
|
-
try {
|
|
118
|
-
const packageJsonPath = require2.resolve("preact/package.json");
|
|
119
|
-
const packageJson = require2(packageJsonPath);
|
|
120
|
-
if (typeof packageJson.version === "string") {
|
|
121
|
-
return packageJson.version;
|
|
122
|
-
}
|
|
123
|
-
} catch (error) {
|
|
124
|
-
throw new Error(
|
|
125
|
-
`TailorKit requires Preact to build an app. Install preact@^10 and try again.`,
|
|
126
|
-
{ cause: error }
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
throw new Error("Unable to read the installed Preact version.");
|
|
130
|
-
}
|
|
131
|
-
export {
|
|
132
|
-
buildApp,
|
|
133
|
-
createTailorKitUploadManifest,
|
|
134
|
-
tailorkitUploadManifestSchema
|
|
135
|
-
};
|
package/dist/chunk-7L6ZZHCK.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
tailorkitConfigSchema
|
|
3
|
-
} from "./chunk-AGGRUUWG.js";
|
|
4
|
-
|
|
5
|
-
// src/config/loader.ts
|
|
6
|
-
import { cosmiconfig } from "cosmiconfig";
|
|
7
|
-
import path from "path";
|
|
8
|
-
var explorer = cosmiconfig("tailorkit", {
|
|
9
|
-
searchPlaces: ["tailorkit.config.ts", "tailorkit.config.mjs", "tailorkit.config.js"]
|
|
10
|
-
});
|
|
11
|
-
var loadTailorKitConfig = async (configPath, cwd = process.cwd()) => {
|
|
12
|
-
const searchFrom = path.resolve(cwd);
|
|
13
|
-
const result = configPath === void 0 ? await explorer.search(searchFrom) : await explorer.load(path.resolve(searchFrom, configPath));
|
|
14
|
-
if (result === null) {
|
|
15
|
-
throw new Error(`Could not find tailorkit config from ${searchFrom}.`);
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
config: tailorkitConfigSchema.parse(result.config),
|
|
19
|
-
filepath: result.filepath,
|
|
20
|
-
root: path.dirname(result.filepath)
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
loadTailorKitConfig
|
|
26
|
-
};
|
package/dist/chunk-AGGRUUWG.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// src/config/config.ts
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
var clientConfigSchema = z.object({
|
|
4
|
-
entry: z.string().default("./src/client.ts")
|
|
5
|
-
});
|
|
6
|
-
var buildConfigSchema = z.object({
|
|
7
|
-
outDir: z.string().default(".tailorkit")
|
|
8
|
-
});
|
|
9
|
-
var tailorkitConfigSchema = z.object({
|
|
10
|
-
appId: z.string().min(1).optional(),
|
|
11
|
-
build: buildConfigSchema.optional(),
|
|
12
|
-
client: clientConfigSchema.optional(),
|
|
13
|
-
host: z.string().url()
|
|
14
|
-
});
|
|
15
|
-
var defineConfig = (config) => config;
|
|
16
|
-
var defineTailorKitConfig = defineConfig;
|
|
17
|
-
|
|
18
|
-
export {
|
|
19
|
-
tailorkitConfigSchema,
|
|
20
|
-
defineConfig,
|
|
21
|
-
defineTailorKitConfig
|
|
22
|
-
};
|
package/dist/config/config.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
declare const tailorkitConfigSchema: z.ZodObject<{
|
|
3
|
-
appId: z.ZodOptional<z.ZodString>;
|
|
4
|
-
build: z.ZodOptional<z.ZodObject<{
|
|
5
|
-
outDir: z.ZodDefault<z.ZodString>;
|
|
6
|
-
}, z.core.$strip>>;
|
|
7
|
-
client: z.ZodOptional<z.ZodObject<{
|
|
8
|
-
entry: z.ZodDefault<z.ZodString>;
|
|
9
|
-
}, z.core.$strip>>;
|
|
10
|
-
host: z.ZodString;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
|
-
export type TailorKitConfig = z.input<typeof tailorkitConfigSchema>;
|
|
13
|
-
export type ResolvedTailorKitConfig = z.output<typeof tailorkitConfigSchema>;
|
|
14
|
-
export { tailorkitConfigSchema };
|
|
15
|
-
export declare const defineConfig: (config: TailorKitConfig) => TailorKitConfig;
|
|
16
|
-
export declare const defineTailorKitConfig: typeof defineConfig;
|
package/dist/config/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { defineConfig, defineTailorKitConfig, type TailorKitConfig } from "./config";
|
package/dist/config/loader.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ResolvedTailorKitConfig } from "./config";
|
|
2
|
-
export interface LoadedTailorKitConfig {
|
|
3
|
-
config: ResolvedTailorKitConfig;
|
|
4
|
-
filepath: string;
|
|
5
|
-
root: string;
|
|
6
|
-
}
|
|
7
|
-
export declare const loadTailorKitConfig: (configPath: string | undefined, cwd?: string) => Promise<LoadedTailorKitConfig>;
|
package/dist/config-loader.js
DELETED
package/dist/config.js
DELETED
package/dist/preact-version.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const MINIMUM_PREACT_MAJOR_VERSION = 10;
|
|
2
|
-
export interface PreactVersionCheck {
|
|
3
|
-
major: number;
|
|
4
|
-
version: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const parsePreactVersion: (version: string) => PreactVersionCheck;
|
|
7
|
-
export declare const assertSupportedPreactVersion: (version: string) => PreactVersionCheck;
|