zitejs 0.9.17 → 0.9.20
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 -3
- package/dist/cjs/sync/lib.js +8 -2
- package/dist/esm/bundle/index.js +11 -3
- package/dist/esm/sync/lib.js +8 -2
- package/package.json +1 -1
package/dist/cjs/bundle/index.js
CHANGED
|
@@ -220,7 +220,13 @@ function createAliasPlugin(opts) {
|
|
|
220
220
|
/^zitejs\/backend\/base$/,
|
|
221
221
|
];
|
|
222
222
|
for (const filter of sdkSources) {
|
|
223
|
-
build.onResolve({ filter }, () => {
|
|
223
|
+
build.onResolve({ filter }, (args) => {
|
|
224
|
+
// When .zite/backend.ts imports from zitejs/backend/base, mark it
|
|
225
|
+
// external to break the cycle — the wrapper re-declares everything
|
|
226
|
+
// it needs so the import is only used at typecheck time.
|
|
227
|
+
if (args.importer && args.importer.endsWith('.zite/backend.ts')) {
|
|
228
|
+
return { path: 'zitejs/backend', external: true };
|
|
229
|
+
}
|
|
224
230
|
if (opts.sdkPath)
|
|
225
231
|
return { path: path.resolve(opts.sdkPath) };
|
|
226
232
|
if (opts.baseDir) {
|
|
@@ -358,10 +364,12 @@ async function bundleEndpointsImpl(baseDir, endpointNames) {
|
|
|
358
364
|
}
|
|
359
365
|
}
|
|
360
366
|
}
|
|
361
|
-
|
|
367
|
+
const output = JSON.stringify({
|
|
362
368
|
bundledEndpoints,
|
|
363
369
|
endpointErrors: Object.keys(endpointErrors).length > 0 ? endpointErrors : undefined,
|
|
364
|
-
})
|
|
370
|
+
});
|
|
371
|
+
fs.writeFileSync('/tmp/zitejs-bundle-result.json', output);
|
|
372
|
+
console.log(output);
|
|
365
373
|
}
|
|
366
374
|
async function bundleOneOffScriptImpl(scriptPath, sdkPath) {
|
|
367
375
|
const rawScript = fs.readFileSync(scriptPath, 'utf-8');
|
package/dist/cjs/sync/lib.js
CHANGED
|
@@ -220,11 +220,17 @@ function generateBackendWrapperTs() {
|
|
|
220
220
|
'// Auto-generated type-narrowing wrapper. Do not edit manually.',
|
|
221
221
|
'// Re-exports createEndpoint with context.user typed to the app User.',
|
|
222
222
|
'',
|
|
223
|
-
"import { ZiteError } from 'zitejs/backend/base';",
|
|
224
223
|
"import type { ZiteRequestContext as _ZiteRequestContext, ZiteScheduledContext as _ZiteScheduledContext } from 'zitejs/backend/base';",
|
|
225
224
|
"import type { User } from './user';",
|
|
226
225
|
'',
|
|
227
|
-
'export
|
|
226
|
+
'export class ZiteError extends Error {',
|
|
227
|
+
' statusCode: number;',
|
|
228
|
+
' constructor(message: string, options?: { statusCode?: number }) {',
|
|
229
|
+
' super(message);',
|
|
230
|
+
" this.name = 'ZiteError';",
|
|
231
|
+
' this.statusCode = options?.statusCode ?? 500;',
|
|
232
|
+
' }',
|
|
233
|
+
'}',
|
|
228
234
|
'',
|
|
229
235
|
'export interface ZiteRequestContext extends Omit<_ZiteRequestContext, "user"> {',
|
|
230
236
|
' user: User;',
|
package/dist/esm/bundle/index.js
CHANGED
|
@@ -184,7 +184,13 @@ function createAliasPlugin(opts) {
|
|
|
184
184
|
/^zitejs\/backend\/base$/,
|
|
185
185
|
];
|
|
186
186
|
for (const filter of sdkSources) {
|
|
187
|
-
build.onResolve({ filter }, () => {
|
|
187
|
+
build.onResolve({ filter }, (args) => {
|
|
188
|
+
// When .zite/backend.ts imports from zitejs/backend/base, mark it
|
|
189
|
+
// external to break the cycle — the wrapper re-declares everything
|
|
190
|
+
// it needs so the import is only used at typecheck time.
|
|
191
|
+
if (args.importer && args.importer.endsWith('.zite/backend.ts')) {
|
|
192
|
+
return { path: 'zitejs/backend', external: true };
|
|
193
|
+
}
|
|
188
194
|
if (opts.sdkPath)
|
|
189
195
|
return { path: path.resolve(opts.sdkPath) };
|
|
190
196
|
if (opts.baseDir) {
|
|
@@ -322,10 +328,12 @@ async function bundleEndpointsImpl(baseDir, endpointNames) {
|
|
|
322
328
|
}
|
|
323
329
|
}
|
|
324
330
|
}
|
|
325
|
-
|
|
331
|
+
const output = JSON.stringify({
|
|
326
332
|
bundledEndpoints,
|
|
327
333
|
endpointErrors: Object.keys(endpointErrors).length > 0 ? endpointErrors : undefined,
|
|
328
|
-
})
|
|
334
|
+
});
|
|
335
|
+
fs.writeFileSync('/tmp/zitejs-bundle-result.json', output);
|
|
336
|
+
console.log(output);
|
|
329
337
|
}
|
|
330
338
|
async function bundleOneOffScriptImpl(scriptPath, sdkPath) {
|
|
331
339
|
const rawScript = fs.readFileSync(scriptPath, 'utf-8');
|
package/dist/esm/sync/lib.js
CHANGED
|
@@ -209,11 +209,17 @@ export function generateBackendWrapperTs() {
|
|
|
209
209
|
'// Auto-generated type-narrowing wrapper. Do not edit manually.',
|
|
210
210
|
'// Re-exports createEndpoint with context.user typed to the app User.',
|
|
211
211
|
'',
|
|
212
|
-
"import { ZiteError } from 'zitejs/backend/base';",
|
|
213
212
|
"import type { ZiteRequestContext as _ZiteRequestContext, ZiteScheduledContext as _ZiteScheduledContext } from 'zitejs/backend/base';",
|
|
214
213
|
"import type { User } from './user';",
|
|
215
214
|
'',
|
|
216
|
-
'export
|
|
215
|
+
'export class ZiteError extends Error {',
|
|
216
|
+
' statusCode: number;',
|
|
217
|
+
' constructor(message: string, options?: { statusCode?: number }) {',
|
|
218
|
+
' super(message);',
|
|
219
|
+
" this.name = 'ZiteError';",
|
|
220
|
+
' this.statusCode = options?.statusCode ?? 500;',
|
|
221
|
+
' }',
|
|
222
|
+
'}',
|
|
217
223
|
'',
|
|
218
224
|
'export interface ZiteRequestContext extends Omit<_ZiteRequestContext, "user"> {',
|
|
219
225
|
' user: User;',
|