@base44-preview/vite-plugin 0.1.0-dev.90d799e

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.
@@ -0,0 +1,6 @@
1
+ const { createClient } = require('@base44/sdk');
2
+
3
+ module.exports.base44 = createClient({
4
+ appId: process.env.VITE_BASE44_APP_ID,
5
+ serverUrl: process.env.VITE_BASE44_BACKEND_URL
6
+ });
@@ -0,0 +1,11 @@
1
+ const { base44 } = require('./base44Client.cjs');
2
+
3
+ module.exports = new Proxy({}, {
4
+ get: (_, enttiyName) => {
5
+ return new Proxy({}, {
6
+ get: (_, prop) => {
7
+ return base44.entities[enttiyName][prop];
8
+ }
9
+ });
10
+ }
11
+ });
@@ -0,0 +1,9 @@
1
+ const { base44 } = require('./base44Client.cjs');
2
+
3
+ module.exports = new Proxy({}, {
4
+ get: (_, prop) => {
5
+ return (...args) => {
6
+ return base44.functions.invoke(prop, ...args);
7
+ }
8
+ }
9
+ });
@@ -0,0 +1,9 @@
1
+ const { base44 } = require('./base44Client.cjs');
2
+
3
+ module.exports = new Proxy({}, {
4
+ get: (_, prop) => {
5
+ return (...args) => {
6
+ return base44.integrations.Core[prop](...args);
7
+ }
8
+ }
9
+ });
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from "vite";
2
+ export default function vitePlugin(): Plugin;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,MAAM,CAAC,OAAO,UAAU,UAAU,IA6E3B,MAAM,CACZ"}
package/dist/index.js ADDED
@@ -0,0 +1,61 @@
1
+ import { loadEnv } from "vite";
2
+ export default function vitePlugin() {
3
+ return {
4
+ name: "base44",
5
+ config: ({ mode }) => {
6
+ const env = loadEnv(mode ?? "development", process.cwd(), "");
7
+ return {
8
+ resolve: {
9
+ alias: {
10
+ "@/": "/src/",
11
+ },
12
+ },
13
+ server: {
14
+ host: "0.0.0.0", // Bind to all interfaces for container access
15
+ port: 5173,
16
+ strictPort: true,
17
+ // Allow all hosts - essential for Modal tunnel URLs
18
+ allowedHosts: true,
19
+ watch: {
20
+ // Enable polling for better file change detection in containers
21
+ usePolling: true,
22
+ interval: 100, // Check every 100ms for responsive HMR
23
+ },
24
+ hmr: {
25
+ protocol: "wss",
26
+ clientPort: 443,
27
+ },
28
+ },
29
+ optimizeDeps: {
30
+ esbuildOptions: {
31
+ define: {
32
+ "process.env.VITE_BASE44_APP_ID": JSON.stringify(env.VITE_BASE44_APP_ID),
33
+ "process.env.VITE_BASE44_BACKEND_URL": JSON.stringify(env.VITE_BASE44_SERVER_URL),
34
+ },
35
+ },
36
+ },
37
+ };
38
+ },
39
+ configureServer(server) {
40
+ server.middlewares.use((req, res, next) => {
41
+ // Allow iframe embedding
42
+ res.setHeader("X-Frame-Options", "ALLOWALL");
43
+ res.setHeader("Content-Security-Policy", "frame-ancestors *;");
44
+ next();
45
+ });
46
+ },
47
+ resolveId(source, importer, options) {
48
+ if (source.includes("/entities")) {
49
+ return this.resolve("@base44/vite-plugin/compat/entities.cjs", importer, options);
50
+ }
51
+ if (source.includes("/functions")) {
52
+ return this.resolve("@base44/vite-plugin/compat/functions.cjs", importer, options);
53
+ }
54
+ if (source.includes("/integrations")) {
55
+ return this.resolve("@base44/vite-plugin/compat/integrations.cjs", importer, options);
56
+ }
57
+ return null;
58
+ },
59
+ };
60
+ }
61
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,UAAU;IAChC,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;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ACjB,yCAAyC,EACzC,QAAQ,EACR,OAAO,CACR,CAAC;YACJ,CAAC;YAED,IAAI,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;gBAClC,OAAO,IAAI,CAAC,OAAO,CACjB,0CAA0C,EAC1C,QAAQ,EACR,OAAO,CACR,CAAC;YACJ,CAAC;YAED,IAAI,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;gBACrC,OAAO,IAAI,CAAC,OAAO,CACjB,6CAA6C,EAC7C,QAAQ,EACR,OAAO,CACR,CAAC;YACJ,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KACQ,CAAC;AACd,CAAC"}
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@base44-preview/vite-plugin",
3
+ "version": "0.1.0-dev.90d799e",
4
+ "description": "The Vite plugin for base44 based applications",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "exports": {
8
+ ".": "./dist/index.js",
9
+ "./compat/*": "./compat/*"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "src",
14
+ "compat"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsc"
18
+ },
19
+ "devDependencies": {
20
+ "@types/node": "^24.6.2",
21
+ "typescript": "^5.9.3",
22
+ "vite": "^7.1.9"
23
+ }
24
+ }
package/src/index.ts ADDED
@@ -0,0 +1,82 @@
1
+ import type { Plugin } from "vite";
2
+ import { loadEnv } from "vite";
3
+
4
+ export default function vitePlugin() {
5
+ return {
6
+ name: "base44",
7
+ config: ({ mode }) => {
8
+ const env = loadEnv(mode ?? "development", process.cwd(), "");
9
+
10
+ return {
11
+ resolve: {
12
+ alias: {
13
+ "@/": "/src/",
14
+ },
15
+ },
16
+ server: {
17
+ host: "0.0.0.0", // Bind to all interfaces for container access
18
+ port: 5173,
19
+ strictPort: true,
20
+ // Allow all hosts - essential for Modal tunnel URLs
21
+ allowedHosts: true,
22
+ watch: {
23
+ // Enable polling for better file change detection in containers
24
+ usePolling: true,
25
+ interval: 100, // Check every 100ms for responsive HMR
26
+ },
27
+ hmr: {
28
+ protocol: "wss",
29
+ clientPort: 443,
30
+ },
31
+ },
32
+ optimizeDeps: {
33
+ esbuildOptions: {
34
+ define: {
35
+ "process.env.VITE_BASE44_APP_ID": JSON.stringify(
36
+ env.VITE_BASE44_APP_ID
37
+ ),
38
+ "process.env.VITE_BASE44_BACKEND_URL": JSON.stringify(
39
+ env.VITE_BASE44_SERVER_URL
40
+ ),
41
+ },
42
+ },
43
+ },
44
+ };
45
+ },
46
+ configureServer(server) {
47
+ server.middlewares.use((req, res, next) => {
48
+ // Allow iframe embedding
49
+ res.setHeader("X-Frame-Options", "ALLOWALL");
50
+ res.setHeader("Content-Security-Policy", "frame-ancestors *;");
51
+ next();
52
+ });
53
+ },
54
+ resolveId(source, importer, options) {
55
+ if (source.includes("/entities")) {
56
+ return this.resolve(
57
+ "@base44/vite-plugin/compat/entities.cjs",
58
+ importer,
59
+ options
60
+ );
61
+ }
62
+
63
+ if (source.includes("/functions")) {
64
+ return this.resolve(
65
+ "@base44/vite-plugin/compat/functions.cjs",
66
+ importer,
67
+ options
68
+ );
69
+ }
70
+
71
+ if (source.includes("/integrations")) {
72
+ return this.resolve(
73
+ "@base44/vite-plugin/compat/integrations.cjs",
74
+ importer,
75
+ options
76
+ );
77
+ }
78
+
79
+ return null;
80
+ },
81
+ } as Plugin;
82
+ }