@base44-preview/vite-plugin 1.0.44-pr.132.10ceed3 → 1.0.44-pr.132.56d48fe
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base44-runtime-plugin.d.ts","sourceRoot":"","sources":["../src/base44-runtime-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"base44-runtime-plugin.d.ts","sourceRoot":"","sources":["../src/base44-runtime-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAsFnC,wBAAgB,mBAAmB,IAAI,MAAM,CAiC5C"}
|
|
@@ -23,6 +23,9 @@
|
|
|
23
23
|
* public import. Without that wrapper (including local dev), TCP fails closed.
|
|
24
24
|
*/
|
|
25
25
|
const SPECIFIER = "base44:runtime";
|
|
26
|
+
// Rollup convention: a resolved virtual id starts with NUL so no other plugin
|
|
27
|
+
// (and no filesystem lookup) tries to claim it.
|
|
28
|
+
const RESOLVED = "\0base44:runtime";
|
|
26
29
|
// Reserved so a route importing it fails with an explanation instead of a bare
|
|
27
30
|
// "failed to resolve import". Actors are never imported — they live in the app's
|
|
28
31
|
// actors directory, in server routes exactly as in backend functions.
|
|
@@ -75,7 +78,6 @@ export const staticEgress = Object.freeze({
|
|
|
75
78
|
});
|
|
76
79
|
`;
|
|
77
80
|
export function base44RuntimePlugin() {
|
|
78
|
-
const importers = new Map();
|
|
79
81
|
return {
|
|
80
82
|
name: "base44-runtime",
|
|
81
83
|
// Ahead of Vite's own resolution so the bare `base44:` specifier is never
|
|
@@ -83,35 +85,27 @@ export function base44RuntimePlugin() {
|
|
|
83
85
|
enforce: "pre",
|
|
84
86
|
// Errors are raised in `load`, never `resolveId`: Vite's dep scanner resolves
|
|
85
87
|
// the raw source of server routes and server-fn handlers in the client
|
|
86
|
-
// environment, before TanStack strips them, and a
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (importer)
|
|
94
|
-
importers.set(`${this.environment?.name}:${id}`, importer);
|
|
95
|
-
// Rollup convention: a NUL-prefixed id is virtual, so no other plugin
|
|
96
|
-
// (and no filesystem lookup) tries to claim it.
|
|
97
|
-
return `\0${id}`;
|
|
88
|
+
// environment, before TanStack strips them, and treats a virtual id as
|
|
89
|
+
// external without loading it. A throw at resolution fails the scan and
|
|
90
|
+
// Vite skips pre-bundling.
|
|
91
|
+
resolveId(id) {
|
|
92
|
+
if (id === SPECIFIER || unsupportedReason(id))
|
|
93
|
+
return `\0${id}`;
|
|
94
|
+
return null;
|
|
98
95
|
},
|
|
99
96
|
load(id) {
|
|
100
|
-
if (!id.startsWith(
|
|
97
|
+
if (!id.startsWith(RESOLVED))
|
|
101
98
|
return null;
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
99
|
+
const reason = unsupportedReason(id.slice(1));
|
|
100
|
+
if (reason) {
|
|
101
|
+
this.error(`"${id.slice(1)}" is not available in server routes. ${reason}`);
|
|
102
|
+
}
|
|
103
|
+
if (id !== RESOLVED)
|
|
104
104
|
return null;
|
|
105
|
-
// The failing module is virtual, so name the file that imported it.
|
|
106
|
-
const importer = importers.get(`${this.environment?.name}:${specifier}`);
|
|
107
|
-
const from = importer ? ` Imported from ${importer}.` : "";
|
|
108
|
-
const reason = unsupportedReason(specifier);
|
|
109
|
-
if (reason)
|
|
110
|
-
this.error(`"${specifier}" is not available in server routes. ${reason}${from}`);
|
|
111
105
|
// `cloudflare:workers` has no browser equivalent, so a client-side import
|
|
112
106
|
// would bundle a module that cannot run. Fail with the reason instead.
|
|
113
107
|
if (this.environment?.name === "client") {
|
|
114
|
-
this.error(`"${SPECIFIER}" is server-only. Move this import into a server route
|
|
108
|
+
this.error(`"${SPECIFIER}" is server-only. Move this import into a server route.`);
|
|
115
109
|
}
|
|
116
110
|
return RUNTIME_MODULE;
|
|
117
111
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base44-runtime-plugin.js","sourceRoot":"","sources":["../src/base44-runtime-plugin.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,SAAS,GAAG,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"base44-runtime-plugin.js","sourceRoot":"","sources":["../src/base44-runtime-plugin.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,SAAS,GAAG,gBAAgB,CAAC;AACnC,8EAA8E;AAC9E,gDAAgD;AAChD,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AAEpC,+EAA+E;AAC/E,iFAAiF;AACjF,sEAAsE;AACtE,MAAM,aAAa,GACjB,8EAA8E,CAAC;AAEjF,SAAS,iBAAiB,CAAC,EAAU;IACnC,IAAI,EAAE,KAAK,uBAAuB;QAAE,OAAO,aAAa,CAAC;IACzD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;CAsBtB,CAAC;AAEF,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,0EAA0E;QAC1E,+BAA+B;QAC/B,OAAO,EAAE,KAAK;QAEd,8EAA8E;QAC9E,uEAAuE;QACvE,uEAAuE;QACvE,wEAAwE;QACxE,2BAA2B;QAC3B,SAAS,CAAC,EAAE;YACV,IAAI,EAAE,KAAK,SAAS,IAAI,iBAAiB,CAAC,EAAE,CAAC;gBAAE,OAAO,KAAK,EAAE,EAAE,CAAC;YAChE,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,CAAC,EAAE;YACL,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;gBAAE,OAAO,IAAI,CAAC;YAC1C,MAAM,MAAM,GAAG,iBAAiB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAI,MAAM,EAAE,CAAC;gBACX,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,wCAAwC,MAAM,EAAE,CAAC,CAAC;YAC9E,CAAC;YACD,IAAI,EAAE,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC;YAEjC,0EAA0E;YAC1E,uEAAuE;YACvE,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACxC,IAAI,CAAC,KAAK,CAAC,IAAI,SAAS,yDAAyD,CAAC,CAAC;YACrF,CAAC;YACD,OAAO,cAAc,CAAC;QACxB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -26,6 +26,9 @@ import type { Plugin } from "vite";
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
const SPECIFIER = "base44:runtime";
|
|
29
|
+
// Rollup convention: a resolved virtual id starts with NUL so no other plugin
|
|
30
|
+
// (and no filesystem lookup) tries to claim it.
|
|
31
|
+
const RESOLVED = "\0base44:runtime";
|
|
29
32
|
|
|
30
33
|
// Reserved so a route importing it fails with an explanation instead of a bare
|
|
31
34
|
// "failed to resolve import". Actors are never imported — they live in the app's
|
|
@@ -82,7 +85,6 @@ export const staticEgress = Object.freeze({
|
|
|
82
85
|
`;
|
|
83
86
|
|
|
84
87
|
export function base44RuntimePlugin(): Plugin {
|
|
85
|
-
const importers = new Map<string, string>();
|
|
86
88
|
return {
|
|
87
89
|
name: "base44-runtime",
|
|
88
90
|
// Ahead of Vite's own resolution so the bare `base44:` specifier is never
|
|
@@ -91,33 +93,26 @@ export function base44RuntimePlugin(): Plugin {
|
|
|
91
93
|
|
|
92
94
|
// Errors are raised in `load`, never `resolveId`: Vite's dep scanner resolves
|
|
93
95
|
// the raw source of server routes and server-fn handlers in the client
|
|
94
|
-
// environment, before TanStack strips them, and a
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (importer) importers.set(`${this.environment?.name}:${id}`, importer);
|
|
101
|
-
// Rollup convention: a NUL-prefixed id is virtual, so no other plugin
|
|
102
|
-
// (and no filesystem lookup) tries to claim it.
|
|
103
|
-
return `\0${id}`;
|
|
96
|
+
// environment, before TanStack strips them, and treats a virtual id as
|
|
97
|
+
// external without loading it. A throw at resolution fails the scan and
|
|
98
|
+
// Vite skips pre-bundling.
|
|
99
|
+
resolveId(id) {
|
|
100
|
+
if (id === SPECIFIER || unsupportedReason(id)) return `\0${id}`;
|
|
101
|
+
return null;
|
|
104
102
|
},
|
|
105
103
|
|
|
106
104
|
load(id) {
|
|
107
|
-
if (!id.startsWith(
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const reason = unsupportedReason(specifier);
|
|
115
|
-
if (reason) this.error(`"${specifier}" is not available in server routes. ${reason}${from}`);
|
|
105
|
+
if (!id.startsWith(RESOLVED)) return null;
|
|
106
|
+
const reason = unsupportedReason(id.slice(1));
|
|
107
|
+
if (reason) {
|
|
108
|
+
this.error(`"${id.slice(1)}" is not available in server routes. ${reason}`);
|
|
109
|
+
}
|
|
110
|
+
if (id !== RESOLVED) return null;
|
|
116
111
|
|
|
117
112
|
// `cloudflare:workers` has no browser equivalent, so a client-side import
|
|
118
113
|
// would bundle a module that cannot run. Fail with the reason instead.
|
|
119
114
|
if (this.environment?.name === "client") {
|
|
120
|
-
this.error(`"${SPECIFIER}" is server-only. Move this import into a server route
|
|
115
|
+
this.error(`"${SPECIFIER}" is server-only. Move this import into a server route.`);
|
|
121
116
|
}
|
|
122
117
|
return RUNTIME_MODULE;
|
|
123
118
|
},
|