zitejs 0.9.71 → 0.9.74
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/cjs/backend/index.d.ts +7 -1
- package/dist/cjs/dev/index.js +13 -1
- package/dist/cjs/sync/lib.d.ts +1 -1
- package/dist/cjs/sync/lib.js +21 -2
- package/dist/cjs/vite/index.d.ts +2 -0
- package/dist/cjs/vite/index.js +88 -0
- package/dist/esm/backend/index.d.ts +7 -1
- package/dist/esm/cli.js +0 -0
- package/dist/esm/dev/index.js +13 -1
- package/dist/esm/sync/lib.d.ts +1 -1
- package/dist/esm/sync/lib.js +21 -2
- package/dist/esm/vite/index.d.ts +2 -0
- package/dist/esm/vite/index.js +82 -0
- package/package.json +17 -2
- package/dist/cjs/api/index.js +0 -5
- package/dist/cjs/db/index.js +0 -5
- package/dist/esm/api/index.d.ts +0 -2
- package/dist/esm/api/index.js +0 -1
- package/dist/esm/db/index.d.ts +0 -2
- package/dist/esm/db/index.js +0 -1
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import type { ZiteSchedule } from "../schedules/index.js";
|
|
2
|
+
export type { ZiteSchedule };
|
|
3
|
+
export type ZiteWebhook = {
|
|
4
|
+
paused?: boolean;
|
|
5
|
+
};
|
|
1
6
|
export interface ZiteRequestContext {
|
|
2
7
|
user: {
|
|
3
8
|
id: string;
|
|
@@ -31,6 +36,8 @@ export interface EndpointConfig<TInput = unknown, TOutput = unknown, TStream ext
|
|
|
31
36
|
outputSchema?: SchemaLike<TOutput>;
|
|
32
37
|
stream?: TStream;
|
|
33
38
|
authenticated?: boolean;
|
|
39
|
+
schedule?: ZiteSchedule;
|
|
40
|
+
webhook?: ZiteWebhook;
|
|
34
41
|
execute: (params: {
|
|
35
42
|
input: TInput;
|
|
36
43
|
context: ZiteRequestContext | ZiteScheduledContext;
|
|
@@ -39,4 +46,3 @@ export interface EndpointConfig<TInput = unknown, TOutput = unknown, TStream ext
|
|
|
39
46
|
} : {})) => Promise<TOutput> | TOutput;
|
|
40
47
|
}
|
|
41
48
|
export declare function createEndpoint<TInput = unknown, TOutput = unknown, TStream extends boolean = false>(config: EndpointConfig<TInput, TOutput, TStream>): EndpointConfig<TInput, TOutput, TStream>;
|
|
42
|
-
export {};
|
package/dist/cjs/dev/index.js
CHANGED
|
@@ -52,6 +52,18 @@ function getEmailIntegrationId(appDir) {
|
|
|
52
52
|
catch { }
|
|
53
53
|
return undefined;
|
|
54
54
|
}
|
|
55
|
+
function getDeclaredEnvVarNames(appDir) {
|
|
56
|
+
try {
|
|
57
|
+
const configPath = (0, path_1.join)("apps", appDir, "zite.config.json");
|
|
58
|
+
if (!(0, fs_2.existsSync)(configPath))
|
|
59
|
+
return [];
|
|
60
|
+
const config = JSON.parse((0, fs_2.readFileSync)(configPath, "utf-8"));
|
|
61
|
+
return Object.keys(config.envVars ?? {});
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
55
67
|
function regenerateAppTypedWrappers(appDir) {
|
|
56
68
|
const outDir = (0, path_1.join)("apps", appDir, ".zite");
|
|
57
69
|
(0, fs_2.mkdirSync)(outDir, { recursive: true });
|
|
@@ -66,7 +78,7 @@ function regenerateAppTypedWrappers(appDir) {
|
|
|
66
78
|
(0, fs_2.mkdirSync)(intDir, { recursive: true });
|
|
67
79
|
(0, fs_2.writeFileSync)((0, path_1.join)(intDir, "email.ts"), (0, lib_js_1.generateEmailSdk)(emailIntegrationId));
|
|
68
80
|
}
|
|
69
|
-
(0, fs_2.writeFileSync)((0, path_1.join)(outDir, "backend.ts"), (0, lib_js_1.generateBackendWrapperTs)());
|
|
81
|
+
(0, fs_2.writeFileSync)((0, path_1.join)(outDir, "backend.ts"), (0, lib_js_1.generateBackendWrapperTs)(getDeclaredEnvVarNames(appDir)));
|
|
70
82
|
}
|
|
71
83
|
function regenerateAppApiTs(appDir) {
|
|
72
84
|
const apiDir = (0, path_1.join)("apps", appDir, "src", "api");
|
package/dist/cjs/sync/lib.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export type AirtableLock = {
|
|
|
58
58
|
tables: AirtableLockTable[];
|
|
59
59
|
};
|
|
60
60
|
export declare function generateAirtableTs(lock: AirtableLock): string | null;
|
|
61
|
-
export declare function generateBackendWrapperTs(): string;
|
|
61
|
+
export declare function generateBackendWrapperTs(envVarNames?: string[]): string;
|
|
62
62
|
/**
|
|
63
63
|
* Generate `.zite/integrations/email.ts` — the `Email` client for an app with
|
|
64
64
|
* an email integration connected. Mirrors the airtable SDK generation: a thin
|
package/dist/cjs/sync/lib.js
CHANGED
|
@@ -700,14 +700,20 @@ function generateAirtableTs(lock) {
|
|
|
700
700
|
}
|
|
701
701
|
return lines.join("\n");
|
|
702
702
|
}
|
|
703
|
-
function generateBackendWrapperTs() {
|
|
703
|
+
function generateBackendWrapperTs(envVarNames = []) {
|
|
704
|
+
const names = [
|
|
705
|
+
"ZITE_APP_URL",
|
|
706
|
+
...envVarNames.filter((n) => n !== "ZITE_APP_URL"),
|
|
707
|
+
];
|
|
704
708
|
return [
|
|
705
709
|
"// Auto-generated type-narrowing wrapper. Do not edit manually.",
|
|
706
710
|
"// Re-exports createEndpoint with context.user typed to the app User.",
|
|
707
711
|
"",
|
|
708
|
-
"import type { ZiteRequestContext as _ZiteRequestContext, ZiteScheduledContext as _ZiteScheduledContext } from 'zitejs/backend/base';",
|
|
712
|
+
"import type { ZiteRequestContext as _ZiteRequestContext, ZiteScheduledContext as _ZiteScheduledContext, ZiteSchedule, ZiteWebhook } from 'zitejs/backend/base';",
|
|
709
713
|
"import type { User } from './user';",
|
|
710
714
|
"",
|
|
715
|
+
"export type { ZiteSchedule, ZiteWebhook };",
|
|
716
|
+
"",
|
|
711
717
|
"export class ZiteError extends Error {",
|
|
712
718
|
" statusCode: number;",
|
|
713
719
|
" constructor(message: string, options?: { statusCode?: number }) {",
|
|
@@ -734,6 +740,8 @@ function generateBackendWrapperTs() {
|
|
|
734
740
|
" outputSchema?: SchemaLike<TOutput>;",
|
|
735
741
|
" stream?: boolean;",
|
|
736
742
|
" authenticated?: boolean;",
|
|
743
|
+
" schedule?: ZiteSchedule;",
|
|
744
|
+
" webhook?: ZiteWebhook;",
|
|
737
745
|
" execute: (params: { input: TInput; context: ZiteRequestContext | ZiteScheduledContext }) => Promise<TOutput> | TOutput;",
|
|
738
746
|
"}",
|
|
739
747
|
"",
|
|
@@ -743,6 +751,17 @@ function generateBackendWrapperTs() {
|
|
|
743
751
|
" return config;",
|
|
744
752
|
"}",
|
|
745
753
|
"",
|
|
754
|
+
// Declared in the wrapper (not a standalone .d.ts) so the merge is
|
|
755
|
+
// guaranteed to be in the program — every endpoint imports this file,
|
|
756
|
+
// while tsconfig `include` does not reliably pick up dot-directories.
|
|
757
|
+
"declare global {",
|
|
758
|
+
" namespace NodeJS {",
|
|
759
|
+
" interface ProcessEnv {",
|
|
760
|
+
...names.map((name) => ` ${JSON.stringify(name)}: string;`),
|
|
761
|
+
" }",
|
|
762
|
+
" }",
|
|
763
|
+
"}",
|
|
764
|
+
"",
|
|
746
765
|
].join("\n");
|
|
747
766
|
}
|
|
748
767
|
/**
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ziteId = ziteId;
|
|
7
|
+
const parser_1 = require("@babel/parser");
|
|
8
|
+
const magic_string_1 = __importDefault(require("magic-string"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const estree_walker_1 = require("estree-walker");
|
|
11
|
+
const validExtensions = new Set([".jsx", ".tsx"]);
|
|
12
|
+
function getComponentName(elementName) {
|
|
13
|
+
if (elementName.type === "JSXIdentifier") {
|
|
14
|
+
return elementName.name;
|
|
15
|
+
}
|
|
16
|
+
if (elementName.type === "JSXMemberExpression") {
|
|
17
|
+
const object = getComponentName(elementName.object);
|
|
18
|
+
const property = elementName.property.name;
|
|
19
|
+
return object ? `${object}.${property}` : property;
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
function isNativeElement(name) {
|
|
24
|
+
return /^[a-z]/.test(name) && !name.includes(".");
|
|
25
|
+
}
|
|
26
|
+
function ziteId() {
|
|
27
|
+
const cwd = process.cwd();
|
|
28
|
+
return {
|
|
29
|
+
name: "vite-plugin-zite-id",
|
|
30
|
+
enforce: "pre",
|
|
31
|
+
async transform(code, id) {
|
|
32
|
+
if (!validExtensions.has(path_1.default.extname(id)) ||
|
|
33
|
+
id.includes("node_modules")) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const relativePath = path_1.default.relative(cwd, id);
|
|
37
|
+
try {
|
|
38
|
+
const ast = (0, parser_1.parse)(code, {
|
|
39
|
+
sourceType: "module",
|
|
40
|
+
plugins: ["jsx", "typescript"],
|
|
41
|
+
});
|
|
42
|
+
const magicString = new magic_string_1.default(code);
|
|
43
|
+
(0, estree_walker_1.walk)(ast, {
|
|
44
|
+
enter(_node) {
|
|
45
|
+
const node = _node;
|
|
46
|
+
if (node.type === "JSXElement") {
|
|
47
|
+
const openingElement = node.openingElement;
|
|
48
|
+
const children = node.children;
|
|
49
|
+
const elementName = openingElement.name;
|
|
50
|
+
const isFragment = (elementName.type === "JSXMemberExpression" &&
|
|
51
|
+
elementName.object.name === "React" &&
|
|
52
|
+
elementName.property.name === "Fragment") ||
|
|
53
|
+
(elementName.type === "JSXIdentifier" &&
|
|
54
|
+
elementName.name === "Fragment");
|
|
55
|
+
if (isFragment) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const line = openingElement.loc?.start?.line ?? 0;
|
|
59
|
+
const col = openingElement.loc?.start?.column ?? 0;
|
|
60
|
+
const dataComponentId = `${relativePath}|${line}|${col}`;
|
|
61
|
+
let attributes = ` data-zite-id="${dataComponentId}"`;
|
|
62
|
+
const componentName = getComponentName(openingElement.name);
|
|
63
|
+
if (componentName && !isNativeElement(componentName)) {
|
|
64
|
+
attributes += ` data-zite-component="${componentName}"`;
|
|
65
|
+
}
|
|
66
|
+
if (children.length === 1 &&
|
|
67
|
+
(children[0].type === "JSXText" ||
|
|
68
|
+
children[0].type === "StringLiteral" ||
|
|
69
|
+
(children[0].type === "JSXExpressionContainer" &&
|
|
70
|
+
children[0].expression.type === "StringLiteral"))) {
|
|
71
|
+
attributes += ` data-zite-editable="true"`;
|
|
72
|
+
}
|
|
73
|
+
magicString.appendLeft(openingElement.name.end ?? 0, attributes);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
code: magicString.toString(),
|
|
79
|
+
map: magicString.generateMap({ hires: true }),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
console.error(`Error processing file ${relativePath}:`, error);
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import type { ZiteSchedule } from "../schedules/index.js";
|
|
2
|
+
export type { ZiteSchedule };
|
|
3
|
+
export type ZiteWebhook = {
|
|
4
|
+
paused?: boolean;
|
|
5
|
+
};
|
|
1
6
|
export interface ZiteRequestContext {
|
|
2
7
|
user: {
|
|
3
8
|
id: string;
|
|
@@ -31,6 +36,8 @@ export interface EndpointConfig<TInput = unknown, TOutput = unknown, TStream ext
|
|
|
31
36
|
outputSchema?: SchemaLike<TOutput>;
|
|
32
37
|
stream?: TStream;
|
|
33
38
|
authenticated?: boolean;
|
|
39
|
+
schedule?: ZiteSchedule;
|
|
40
|
+
webhook?: ZiteWebhook;
|
|
34
41
|
execute: (params: {
|
|
35
42
|
input: TInput;
|
|
36
43
|
context: ZiteRequestContext | ZiteScheduledContext;
|
|
@@ -39,4 +46,3 @@ export interface EndpointConfig<TInput = unknown, TOutput = unknown, TStream ext
|
|
|
39
46
|
} : {})) => Promise<TOutput> | TOutput;
|
|
40
47
|
}
|
|
41
48
|
export declare function createEndpoint<TInput = unknown, TOutput = unknown, TStream extends boolean = false>(config: EndpointConfig<TInput, TOutput, TStream>): EndpointConfig<TInput, TOutput, TStream>;
|
|
42
|
-
export {};
|
package/dist/esm/cli.js
CHANGED
|
File without changes
|
package/dist/esm/dev/index.js
CHANGED
|
@@ -48,6 +48,18 @@ function getEmailIntegrationId(appDir) {
|
|
|
48
48
|
catch { }
|
|
49
49
|
return undefined;
|
|
50
50
|
}
|
|
51
|
+
function getDeclaredEnvVarNames(appDir) {
|
|
52
|
+
try {
|
|
53
|
+
const configPath = join("apps", appDir, "zite.config.json");
|
|
54
|
+
if (!existsSync(configPath))
|
|
55
|
+
return [];
|
|
56
|
+
const config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
57
|
+
return Object.keys(config.envVars ?? {});
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
51
63
|
function regenerateAppTypedWrappers(appDir) {
|
|
52
64
|
const outDir = join("apps", appDir, ".zite");
|
|
53
65
|
mkdirSync(outDir, { recursive: true });
|
|
@@ -62,7 +74,7 @@ function regenerateAppTypedWrappers(appDir) {
|
|
|
62
74
|
mkdirSync(intDir, { recursive: true });
|
|
63
75
|
writeFileSync(join(intDir, "email.ts"), generateEmailSdk(emailIntegrationId));
|
|
64
76
|
}
|
|
65
|
-
writeFileSync(join(outDir, "backend.ts"), generateBackendWrapperTs());
|
|
77
|
+
writeFileSync(join(outDir, "backend.ts"), generateBackendWrapperTs(getDeclaredEnvVarNames(appDir)));
|
|
66
78
|
}
|
|
67
79
|
function regenerateAppApiTs(appDir) {
|
|
68
80
|
const apiDir = join("apps", appDir, "src", "api");
|
package/dist/esm/sync/lib.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export type AirtableLock = {
|
|
|
58
58
|
tables: AirtableLockTable[];
|
|
59
59
|
};
|
|
60
60
|
export declare function generateAirtableTs(lock: AirtableLock): string | null;
|
|
61
|
-
export declare function generateBackendWrapperTs(): string;
|
|
61
|
+
export declare function generateBackendWrapperTs(envVarNames?: string[]): string;
|
|
62
62
|
/**
|
|
63
63
|
* Generate `.zite/integrations/email.ts` — the `Email` client for an app with
|
|
64
64
|
* an email integration connected. Mirrors the airtable SDK generation: a thin
|
package/dist/esm/sync/lib.js
CHANGED
|
@@ -688,14 +688,20 @@ export function generateAirtableTs(lock) {
|
|
|
688
688
|
}
|
|
689
689
|
return lines.join("\n");
|
|
690
690
|
}
|
|
691
|
-
export function generateBackendWrapperTs() {
|
|
691
|
+
export function generateBackendWrapperTs(envVarNames = []) {
|
|
692
|
+
const names = [
|
|
693
|
+
"ZITE_APP_URL",
|
|
694
|
+
...envVarNames.filter((n) => n !== "ZITE_APP_URL"),
|
|
695
|
+
];
|
|
692
696
|
return [
|
|
693
697
|
"// Auto-generated type-narrowing wrapper. Do not edit manually.",
|
|
694
698
|
"// Re-exports createEndpoint with context.user typed to the app User.",
|
|
695
699
|
"",
|
|
696
|
-
"import type { ZiteRequestContext as _ZiteRequestContext, ZiteScheduledContext as _ZiteScheduledContext } from 'zitejs/backend/base';",
|
|
700
|
+
"import type { ZiteRequestContext as _ZiteRequestContext, ZiteScheduledContext as _ZiteScheduledContext, ZiteSchedule, ZiteWebhook } from 'zitejs/backend/base';",
|
|
697
701
|
"import type { User } from './user';",
|
|
698
702
|
"",
|
|
703
|
+
"export type { ZiteSchedule, ZiteWebhook };",
|
|
704
|
+
"",
|
|
699
705
|
"export class ZiteError extends Error {",
|
|
700
706
|
" statusCode: number;",
|
|
701
707
|
" constructor(message: string, options?: { statusCode?: number }) {",
|
|
@@ -722,6 +728,8 @@ export function generateBackendWrapperTs() {
|
|
|
722
728
|
" outputSchema?: SchemaLike<TOutput>;",
|
|
723
729
|
" stream?: boolean;",
|
|
724
730
|
" authenticated?: boolean;",
|
|
731
|
+
" schedule?: ZiteSchedule;",
|
|
732
|
+
" webhook?: ZiteWebhook;",
|
|
725
733
|
" execute: (params: { input: TInput; context: ZiteRequestContext | ZiteScheduledContext }) => Promise<TOutput> | TOutput;",
|
|
726
734
|
"}",
|
|
727
735
|
"",
|
|
@@ -731,6 +739,17 @@ export function generateBackendWrapperTs() {
|
|
|
731
739
|
" return config;",
|
|
732
740
|
"}",
|
|
733
741
|
"",
|
|
742
|
+
// Declared in the wrapper (not a standalone .d.ts) so the merge is
|
|
743
|
+
// guaranteed to be in the program — every endpoint imports this file,
|
|
744
|
+
// while tsconfig `include` does not reliably pick up dot-directories.
|
|
745
|
+
"declare global {",
|
|
746
|
+
" namespace NodeJS {",
|
|
747
|
+
" interface ProcessEnv {",
|
|
748
|
+
...names.map((name) => ` ${JSON.stringify(name)}: string;`),
|
|
749
|
+
" }",
|
|
750
|
+
" }",
|
|
751
|
+
"}",
|
|
752
|
+
"",
|
|
734
753
|
].join("\n");
|
|
735
754
|
}
|
|
736
755
|
/**
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { parse } from "@babel/parser";
|
|
2
|
+
import MagicString from "magic-string";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { walk } from "estree-walker";
|
|
5
|
+
const validExtensions = new Set([".jsx", ".tsx"]);
|
|
6
|
+
function getComponentName(elementName) {
|
|
7
|
+
if (elementName.type === "JSXIdentifier") {
|
|
8
|
+
return elementName.name;
|
|
9
|
+
}
|
|
10
|
+
if (elementName.type === "JSXMemberExpression") {
|
|
11
|
+
const object = getComponentName(elementName.object);
|
|
12
|
+
const property = elementName.property.name;
|
|
13
|
+
return object ? `${object}.${property}` : property;
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
function isNativeElement(name) {
|
|
18
|
+
return /^[a-z]/.test(name) && !name.includes(".");
|
|
19
|
+
}
|
|
20
|
+
export function ziteId() {
|
|
21
|
+
const cwd = process.cwd();
|
|
22
|
+
return {
|
|
23
|
+
name: "vite-plugin-zite-id",
|
|
24
|
+
enforce: "pre",
|
|
25
|
+
async transform(code, id) {
|
|
26
|
+
if (!validExtensions.has(path.extname(id)) ||
|
|
27
|
+
id.includes("node_modules")) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const relativePath = path.relative(cwd, id);
|
|
31
|
+
try {
|
|
32
|
+
const ast = parse(code, {
|
|
33
|
+
sourceType: "module",
|
|
34
|
+
plugins: ["jsx", "typescript"],
|
|
35
|
+
});
|
|
36
|
+
const magicString = new MagicString(code);
|
|
37
|
+
walk(ast, {
|
|
38
|
+
enter(_node) {
|
|
39
|
+
const node = _node;
|
|
40
|
+
if (node.type === "JSXElement") {
|
|
41
|
+
const openingElement = node.openingElement;
|
|
42
|
+
const children = node.children;
|
|
43
|
+
const elementName = openingElement.name;
|
|
44
|
+
const isFragment = (elementName.type === "JSXMemberExpression" &&
|
|
45
|
+
elementName.object.name === "React" &&
|
|
46
|
+
elementName.property.name === "Fragment") ||
|
|
47
|
+
(elementName.type === "JSXIdentifier" &&
|
|
48
|
+
elementName.name === "Fragment");
|
|
49
|
+
if (isFragment) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const line = openingElement.loc?.start?.line ?? 0;
|
|
53
|
+
const col = openingElement.loc?.start?.column ?? 0;
|
|
54
|
+
const dataComponentId = `${relativePath}|${line}|${col}`;
|
|
55
|
+
let attributes = ` data-zite-id="${dataComponentId}"`;
|
|
56
|
+
const componentName = getComponentName(openingElement.name);
|
|
57
|
+
if (componentName && !isNativeElement(componentName)) {
|
|
58
|
+
attributes += ` data-zite-component="${componentName}"`;
|
|
59
|
+
}
|
|
60
|
+
if (children.length === 1 &&
|
|
61
|
+
(children[0].type === "JSXText" ||
|
|
62
|
+
children[0].type === "StringLiteral" ||
|
|
63
|
+
(children[0].type === "JSXExpressionContainer" &&
|
|
64
|
+
children[0].expression.type === "StringLiteral"))) {
|
|
65
|
+
attributes += ` data-zite-editable="true"`;
|
|
66
|
+
}
|
|
67
|
+
magicString.appendLeft(openingElement.name.end ?? 0, attributes);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
code: magicString.toString(),
|
|
73
|
+
map: magicString.generateMap({ hires: true }),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
console.error(`Error processing file ${relativePath}:`, error);
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zitejs",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.74",
|
|
4
4
|
"description": "The Zite framework — build apps on Zite Database",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -76,6 +76,12 @@
|
|
|
76
76
|
"types": "./dist/esm/sync/index.d.ts",
|
|
77
77
|
"import": "./dist/esm/sync/index.js",
|
|
78
78
|
"require": "./dist/cjs/sync/index.js"
|
|
79
|
+
},
|
|
80
|
+
"./vite-plugin": {
|
|
81
|
+
"types": "./dist/esm/vite/index.d.ts",
|
|
82
|
+
"import": "./dist/esm/vite/index.js",
|
|
83
|
+
"require": "./dist/cjs/vite/index.js",
|
|
84
|
+
"default": "./dist/esm/vite/index.js"
|
|
79
85
|
}
|
|
80
86
|
},
|
|
81
87
|
"scripts": {
|
|
@@ -125,12 +131,16 @@
|
|
|
125
131
|
],
|
|
126
132
|
"meta": [
|
|
127
133
|
"dist/esm/meta/index.d.ts"
|
|
134
|
+
],
|
|
135
|
+
"vite-plugin": [
|
|
136
|
+
"dist/esm/vite/index.d.ts"
|
|
128
137
|
]
|
|
129
138
|
}
|
|
130
139
|
},
|
|
131
140
|
"peerDependencies": {
|
|
132
141
|
"@tanstack/react-query": ">=5",
|
|
133
|
-
"react": ">=18"
|
|
142
|
+
"react": ">=18",
|
|
143
|
+
"vite": ">=5"
|
|
134
144
|
},
|
|
135
145
|
"peerDependenciesMeta": {
|
|
136
146
|
"react": {
|
|
@@ -138,6 +148,9 @@
|
|
|
138
148
|
},
|
|
139
149
|
"@tanstack/react-query": {
|
|
140
150
|
"optional": true
|
|
151
|
+
},
|
|
152
|
+
"vite": {
|
|
153
|
+
"optional": true
|
|
141
154
|
}
|
|
142
155
|
},
|
|
143
156
|
"devDependencies": {
|
|
@@ -164,6 +177,8 @@
|
|
|
164
177
|
"@babel/parser": "^7.29.7",
|
|
165
178
|
"dotenv": "^17.4.2",
|
|
166
179
|
"esbuild": "^0.28.0",
|
|
180
|
+
"estree-walker": "^3.0.3",
|
|
181
|
+
"magic-string": "^0.30.17",
|
|
167
182
|
"zod": "^4.1.12"
|
|
168
183
|
}
|
|
169
184
|
}
|
package/dist/cjs/api/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCaller = void 0;
|
|
4
|
-
var index_js_1 = require("../caller/index.js");
|
|
5
|
-
Object.defineProperty(exports, "createCaller", { enumerable: true, get: function () { return index_js_1.createCaller; } });
|
package/dist/cjs/db/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTableClient = void 0;
|
|
4
|
-
var index_js_1 = require("../runtime/index.js");
|
|
5
|
-
Object.defineProperty(exports, "createTableClient", { enumerable: true, get: function () { return index_js_1.createTableClient; } });
|
package/dist/esm/api/index.d.ts
DELETED
package/dist/esm/api/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createCaller } from '../caller/index.js';
|
package/dist/esm/db/index.d.ts
DELETED
package/dist/esm/db/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createTableClient } from '../runtime/index.js';
|