zitejs 0.9.20 → 0.9.22
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/bundle/index.js +11 -8
- package/dist/esm/bundle/index.js +11 -8
- package/package.json +1 -1
package/dist/cjs/bundle/index.js
CHANGED
|
@@ -69,6 +69,7 @@ const _NODE_BUILTIN_NAMES = [
|
|
|
69
69
|
const NODE_BUILTINS = _NODE_BUILTIN_NAMES.flatMap(m => [m, `node:${m}`]);
|
|
70
70
|
const PREBUNDLED_LIBS = {
|
|
71
71
|
'@zite/endpoints-runtime-sdk': '__zite-runtime__.js',
|
|
72
|
+
'zitejs/runtime': '__zite-runtime__.js',
|
|
72
73
|
'zod': '__zod__.js',
|
|
73
74
|
'openai': '__openai__.js',
|
|
74
75
|
'@anthropic-ai/sdk': '__anthropic__.js',
|
|
@@ -237,19 +238,21 @@ function createAliasPlugin(opts) {
|
|
|
237
238
|
return { path: 'zitejs/backend', external: true };
|
|
238
239
|
});
|
|
239
240
|
}
|
|
240
|
-
// Resolve zitejs/db to .zite/db.ts
|
|
241
|
+
// Resolve zitejs/db to .zite/db.ts — check app dir first, then
|
|
242
|
+
// workspace root (monorepo keeps db.ts at the project root).
|
|
241
243
|
build.onResolve({ filter: /^zitejs\/db$/ }, () => {
|
|
242
244
|
if (opts.baseDir) {
|
|
243
|
-
const
|
|
244
|
-
if (fs.existsSync(
|
|
245
|
-
return { path:
|
|
245
|
+
const appDbPath = path.resolve(opts.baseDir, '.zite/db.ts');
|
|
246
|
+
if (fs.existsSync(appDbPath))
|
|
247
|
+
return { path: appDbPath };
|
|
248
|
+
const rootDbPath = path.resolve(opts.baseDir, '../../.zite/db.ts');
|
|
249
|
+
if (fs.existsSync(rootDbPath))
|
|
250
|
+
return { path: rootDbPath };
|
|
246
251
|
}
|
|
247
252
|
return { path: 'zitejs/db', external: true };
|
|
248
253
|
});
|
|
249
|
-
//
|
|
250
|
-
|
|
251
|
-
return { path: 'zitejs/runtime', external: true };
|
|
252
|
-
});
|
|
254
|
+
// zitejs/runtime is prebundled as __zite-runtime__.js in the worker —
|
|
255
|
+
// handled by the PREBUNDLED_LIBS loop below, no special case needed.
|
|
253
256
|
for (const [pkgName, modulePath] of Object.entries(PREBUNDLED_LIBS)) {
|
|
254
257
|
const escapedName = pkgName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
255
258
|
const filter = new RegExp(`^${escapedName}$`);
|
package/dist/esm/bundle/index.js
CHANGED
|
@@ -33,6 +33,7 @@ const _NODE_BUILTIN_NAMES = [
|
|
|
33
33
|
const NODE_BUILTINS = _NODE_BUILTIN_NAMES.flatMap(m => [m, `node:${m}`]);
|
|
34
34
|
const PREBUNDLED_LIBS = {
|
|
35
35
|
'@zite/endpoints-runtime-sdk': '__zite-runtime__.js',
|
|
36
|
+
'zitejs/runtime': '__zite-runtime__.js',
|
|
36
37
|
'zod': '__zod__.js',
|
|
37
38
|
'openai': '__openai__.js',
|
|
38
39
|
'@anthropic-ai/sdk': '__anthropic__.js',
|
|
@@ -201,19 +202,21 @@ function createAliasPlugin(opts) {
|
|
|
201
202
|
return { path: 'zitejs/backend', external: true };
|
|
202
203
|
});
|
|
203
204
|
}
|
|
204
|
-
// Resolve zitejs/db to .zite/db.ts
|
|
205
|
+
// Resolve zitejs/db to .zite/db.ts — check app dir first, then
|
|
206
|
+
// workspace root (monorepo keeps db.ts at the project root).
|
|
205
207
|
build.onResolve({ filter: /^zitejs\/db$/ }, () => {
|
|
206
208
|
if (opts.baseDir) {
|
|
207
|
-
const
|
|
208
|
-
if (fs.existsSync(
|
|
209
|
-
return { path:
|
|
209
|
+
const appDbPath = path.resolve(opts.baseDir, '.zite/db.ts');
|
|
210
|
+
if (fs.existsSync(appDbPath))
|
|
211
|
+
return { path: appDbPath };
|
|
212
|
+
const rootDbPath = path.resolve(opts.baseDir, '../../.zite/db.ts');
|
|
213
|
+
if (fs.existsSync(rootDbPath))
|
|
214
|
+
return { path: rootDbPath };
|
|
210
215
|
}
|
|
211
216
|
return { path: 'zitejs/db', external: true };
|
|
212
217
|
});
|
|
213
|
-
//
|
|
214
|
-
|
|
215
|
-
return { path: 'zitejs/runtime', external: true };
|
|
216
|
-
});
|
|
218
|
+
// zitejs/runtime is prebundled as __zite-runtime__.js in the worker —
|
|
219
|
+
// handled by the PREBUNDLED_LIBS loop below, no special case needed.
|
|
217
220
|
for (const [pkgName, modulePath] of Object.entries(PREBUNDLED_LIBS)) {
|
|
218
221
|
const escapedName = pkgName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
219
222
|
const filter = new RegExp(`^${escapedName}$`);
|