@broxium/compiler 1.5.3 → 1.5.5

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/index.js CHANGED
@@ -236,6 +236,17 @@ export function Server({ children }) {
236
236
 
237
237
  /** @deprecated Use <Client> instead. */
238
238
  export var ClientRender = Client;
239
+
240
+ export function brodoxFetch(path, ctx, init) {
241
+ var isAbsolute = /^https?:\\/\\//.test(path);
242
+ var base = isAbsolute ? '' : (process.env.BRODOX_CORE_URL || 'http://localhost:3000');
243
+ var url = isAbsolute ? path : base + (path.charAt(0) === '/' ? path : '/' + path);
244
+ var headers = new Headers(init && init.headers);
245
+ if (ctx && ctx.tenantId != null && !headers.has('x-tid')) {
246
+ headers.set('x-tid', String(ctx.tenantId));
247
+ }
248
+ return fetch(url, Object.assign({}, init, { headers: headers }));
249
+ }
239
250
  `
240
251
  }));
241
252
  }
@@ -368,6 +379,17 @@ export function useParams() { return {}; }
368
379
  export function Client({ children }) { return h(F, null, children); }
369
380
  export function Server({ children }) { return h(F, null, children); }
370
381
  export var ClientRender = Client;
382
+
383
+ export function brodoxFetch(path, ctx, init) {
384
+ var isAbsolute = /^https?:\\/\\//.test(path);
385
+ var base = isAbsolute ? '' : (globalThis.__BRODOX_API_URL__ || 'http://localhost:3000');
386
+ var url = isAbsolute ? path : base + (path.charAt(0) === '/' ? path : '/' + path);
387
+ var headers = new Headers(init && init.headers);
388
+ if (ctx && ctx.tenantId != null && !headers.has('x-tid')) {
389
+ headers.set('x-tid', String(ctx.tenantId));
390
+ }
391
+ return fetch(url, Object.assign({}, init, { headers: headers }));
392
+ }
371
393
  `.trim()
372
394
  }));
373
395
  }
@@ -670,6 +692,10 @@ var BrodoxCompiler = class {
670
692
  const registryEntries = clientComponents.map((c, i) => ` '${c.name}': __reg${i}__`).join(",\n");
671
693
  const registryWrapper = [
672
694
  `export { default } from './${entryRelative}';`,
695
+ // Re-export named exports (e.g. getServerData) so the client/canvas
696
+ // bundles can still access them — `export *` never includes `default`,
697
+ // so this can't collide with the explicit default re-export above.
698
+ `export * from './${entryRelative}';`,
673
699
  importLines,
674
700
  `export const __registry__ = {
675
701
  ${registryEntries}
package/dist/index.mjs CHANGED
@@ -201,6 +201,17 @@ export function Server({ children }) {
201
201
 
202
202
  /** @deprecated Use <Client> instead. */
203
203
  export var ClientRender = Client;
204
+
205
+ export function brodoxFetch(path, ctx, init) {
206
+ var isAbsolute = /^https?:\\/\\//.test(path);
207
+ var base = isAbsolute ? '' : (process.env.BRODOX_CORE_URL || 'http://localhost:3000');
208
+ var url = isAbsolute ? path : base + (path.charAt(0) === '/' ? path : '/' + path);
209
+ var headers = new Headers(init && init.headers);
210
+ if (ctx && ctx.tenantId != null && !headers.has('x-tid')) {
211
+ headers.set('x-tid', String(ctx.tenantId));
212
+ }
213
+ return fetch(url, Object.assign({}, init, { headers: headers }));
214
+ }
204
215
  `
205
216
  }));
206
217
  }
@@ -333,6 +344,17 @@ export function useParams() { return {}; }
333
344
  export function Client({ children }) { return h(F, null, children); }
334
345
  export function Server({ children }) { return h(F, null, children); }
335
346
  export var ClientRender = Client;
347
+
348
+ export function brodoxFetch(path, ctx, init) {
349
+ var isAbsolute = /^https?:\\/\\//.test(path);
350
+ var base = isAbsolute ? '' : (globalThis.__BRODOX_API_URL__ || 'http://localhost:3000');
351
+ var url = isAbsolute ? path : base + (path.charAt(0) === '/' ? path : '/' + path);
352
+ var headers = new Headers(init && init.headers);
353
+ if (ctx && ctx.tenantId != null && !headers.has('x-tid')) {
354
+ headers.set('x-tid', String(ctx.tenantId));
355
+ }
356
+ return fetch(url, Object.assign({}, init, { headers: headers }));
357
+ }
336
358
  `.trim()
337
359
  }));
338
360
  }
@@ -635,6 +657,10 @@ var BrodoxCompiler = class {
635
657
  const registryEntries = clientComponents.map((c, i) => ` '${c.name}': __reg${i}__`).join(",\n");
636
658
  const registryWrapper = [
637
659
  `export { default } from './${entryRelative}';`,
660
+ // Re-export named exports (e.g. getServerData) so the client/canvas
661
+ // bundles can still access them — `export *` never includes `default`,
662
+ // so this can't collide with the explicit default re-export above.
663
+ `export * from './${entryRelative}';`,
638
664
  importLines,
639
665
  `export const __registry__ = {
640
666
  ${registryEntries}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@broxium/compiler",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "description": "Brodox component compiler — TSX to ESM server + client bundles",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",