@navios/adapter-xml 0.1.0 → 0.7.1

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.
Files changed (101) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +2 -1
  3. package/bun-plugin.mts +5 -3
  4. package/bunPlugin.cache +1 -1
  5. package/dist/bun-plugin.d.mts.map +1 -1
  6. package/dist/src/adapters/xml-stream-adapter.service.d.mts +63 -8
  7. package/dist/src/adapters/xml-stream-adapter.service.d.mts.map +1 -1
  8. package/dist/src/decorators/component.decorator.d.mts +68 -2
  9. package/dist/src/decorators/component.decorator.d.mts.map +1 -1
  10. package/dist/src/decorators/xml-stream.decorator.d.mts +58 -3
  11. package/dist/src/decorators/xml-stream.decorator.d.mts.map +1 -1
  12. package/dist/src/define-environment.d.mts +2 -2
  13. package/dist/src/define-environment.d.mts.map +1 -1
  14. package/dist/src/handlers/xml-stream.d.mts +25 -3
  15. package/dist/src/handlers/xml-stream.d.mts.map +1 -1
  16. package/dist/src/runtime/render-to-xml.d.mts +70 -2
  17. package/dist/src/runtime/render-to-xml.d.mts.map +1 -1
  18. package/dist/src/tags/define-tag.d.mts +8 -0
  19. package/dist/src/tags/define-tag.d.mts.map +1 -1
  20. package/dist/src/types/component.d.mts +46 -2
  21. package/dist/src/types/component.d.mts.map +1 -1
  22. package/dist/src/types/config.d.mts +22 -0
  23. package/dist/src/types/config.d.mts.map +1 -1
  24. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  25. package/dist/tsconfig.spec.tsbuildinfo +1 -1
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/dist/tsdown.config.d.mts +3 -0
  28. package/dist/tsdown.config.d.mts.map +1 -0
  29. package/dist/vitest.e2e.fastify.config.d.mts.map +1 -1
  30. package/lib/create-element--Gd2L8UR.d.cts +26 -0
  31. package/lib/create-element--Gd2L8UR.d.cts.map +1 -0
  32. package/lib/create-element-61MP7_99.d.mts +26 -0
  33. package/lib/create-element-61MP7_99.d.mts.map +1 -0
  34. package/lib/create-element-DiOt_-Vs.cjs +183 -0
  35. package/lib/create-element-DiOt_-Vs.cjs.map +1 -0
  36. package/lib/create-element-NZEYaRw5.mjs +124 -0
  37. package/lib/create-element-NZEYaRw5.mjs.map +1 -0
  38. package/lib/index.cjs +746 -0
  39. package/lib/index.cjs.map +1 -0
  40. package/lib/index.d.cts +520 -0
  41. package/lib/index.d.cts.map +1 -0
  42. package/lib/index.d.mts +520 -29
  43. package/lib/index.d.mts.map +1 -0
  44. package/lib/index.mjs +692 -223
  45. package/lib/index.mjs.map +1 -1
  46. package/lib/jsx-dev-runtime.cjs +11 -0
  47. package/lib/jsx-dev-runtime.cjs.map +1 -0
  48. package/lib/jsx-dev-runtime.d.cts +8 -0
  49. package/lib/jsx-dev-runtime.d.cts.map +1 -0
  50. package/lib/jsx-dev-runtime.d.mts +8 -4
  51. package/lib/jsx-dev-runtime.d.mts.map +1 -0
  52. package/lib/jsx-dev-runtime.mjs +5 -6
  53. package/lib/jsx-dev-runtime.mjs.map +1 -1
  54. package/lib/jsx-runtime.cjs +5 -0
  55. package/lib/jsx-runtime.d.cts +3 -0
  56. package/lib/jsx-runtime.d.mts +3 -3
  57. package/lib/jsx-runtime.mjs +3 -3
  58. package/lib/jsx.cjs +0 -0
  59. package/lib/jsx.d.cts +19 -0
  60. package/lib/jsx.d.cts.map +1 -0
  61. package/lib/jsx.d.mts +19 -1
  62. package/lib/jsx.d.mts.map +1 -0
  63. package/lib/jsx.mjs +1 -3
  64. package/lib/xml-node-BQA44ydQ.d.mts +96 -0
  65. package/lib/xml-node-BQA44ydQ.d.mts.map +1 -0
  66. package/lib/xml-node-CddziLym.d.cts +96 -0
  67. package/lib/xml-node-CddziLym.d.cts.map +1 -0
  68. package/package.json +20 -20
  69. package/project.json +2 -2
  70. package/src/adapters/xml-stream-adapter.service.mts +77 -16
  71. package/src/decorators/component.decorator.mts +72 -10
  72. package/src/decorators/component.decorator.spec.mts +40 -22
  73. package/src/decorators/xml-stream.decorator.mts +58 -3
  74. package/src/define-environment.mts +5 -6
  75. package/src/handlers/xml-stream.mts +25 -3
  76. package/src/runtime/render-to-xml.mts +72 -4
  77. package/src/tags/define-tag.mts +8 -0
  78. package/src/types/component.mts +46 -2
  79. package/src/types/config.mts +22 -0
  80. package/tsdown.config.mts +39 -0
  81. package/dist/tsup.config.d.mts +0 -3
  82. package/dist/tsup.config.d.mts.map +0 -1
  83. package/lib/_tsup-dts-rollup.d.mts +0 -414
  84. package/lib/_tsup-dts-rollup.d.ts +0 -414
  85. package/lib/chunk-6OR6LGJA.mjs +0 -153
  86. package/lib/chunk-6OR6LGJA.mjs.map +0 -1
  87. package/lib/index.d.ts +0 -29
  88. package/lib/index.js +0 -376
  89. package/lib/index.js.map +0 -1
  90. package/lib/jsx-dev-runtime.d.ts +0 -4
  91. package/lib/jsx-dev-runtime.js +0 -61
  92. package/lib/jsx-dev-runtime.js.map +0 -1
  93. package/lib/jsx-runtime.d.ts +0 -3
  94. package/lib/jsx-runtime.js +0 -57
  95. package/lib/jsx-runtime.js.map +0 -1
  96. package/lib/jsx-runtime.mjs.map +0 -1
  97. package/lib/jsx.d.ts +0 -1
  98. package/lib/jsx.js +0 -4
  99. package/lib/jsx.js.map +0 -1
  100. package/lib/jsx.mjs.map +0 -1
  101. package/tsup.config.mts +0 -18
package/lib/index.js DELETED
@@ -1,376 +0,0 @@
1
- 'use strict';
2
-
3
- var di = require('@navios/di');
4
- var core = require('@navios/core');
5
-
6
- var __create = Object.create;
7
- var __defProp = Object.defineProperty;
8
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
- var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
10
- var __typeError = (msg) => {
11
- throw TypeError(msg);
12
- };
13
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
15
- var __decoratorStart = (base) => [, , , __create(null)];
16
- var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
17
- var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
18
- var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
19
- var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
20
- var __runInitializers = (array, flags, self, value) => {
21
- for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) fns[i].call(self) ;
22
- return value;
23
- };
24
- var __decorateElement = (array, flags, name, decorators, target, extra) => {
25
- var it, done, ctx, k = flags & 7, p = false;
26
- var j = 0;
27
- var extraInitializers = array[j] || (array[j] = []);
28
- var desc = k && ((target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(target , name));
29
- __name(target, name);
30
- for (var i = decorators.length - 1; i >= 0; i--) {
31
- ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
32
- it = (0, decorators[i])(target, ctx), done._ = 1;
33
- __expectFn(it) && (target = it);
34
- }
35
- return __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
36
- };
37
-
38
- // src/types/xml-node.mts
39
- var Fragment = /* @__PURE__ */ Symbol.for("xml.fragment");
40
- var AsyncComponent = /* @__PURE__ */ Symbol.for("xml.async");
41
- var CDataSymbol = /* @__PURE__ */ Symbol.for("xml.cdata");
42
- var RawXmlSymbol = /* @__PURE__ */ Symbol.for("xml.raw");
43
- var ClassComponent = /* @__PURE__ */ Symbol.for("xml.class-component");
44
- var ComponentMeta = /* @__PURE__ */ Symbol.for("xml.component.meta");
45
- function Component(options = {}) {
46
- const { schema, registry = di.globalRegistry } = options;
47
- return (target, context) => {
48
- if (context && context.kind !== "class" || target instanceof Function && !context) {
49
- throw new Error(
50
- "[@navios/adapter-xml] @Component decorator can only be used on classes."
51
- );
52
- }
53
- if (typeof target.prototype.render !== "function") {
54
- throw new Error(
55
- `[@navios/adapter-xml] @Component class "${target.name}" must implement render() method.`
56
- );
57
- }
58
- const injectableToken = schema ? di.InjectionToken.create(target, schema) : di.InjectionToken.create(target);
59
- registry.set(
60
- injectableToken,
61
- di.InjectableScope.Request,
62
- target,
63
- di.InjectableType.Class
64
- );
65
- target[di.InjectableTokenMeta] = injectableToken;
66
- target[ComponentMeta] = true;
67
- return target;
68
- };
69
- }
70
- function isComponentClass(value) {
71
- return typeof value === "function" && // @ts-expect-error - Checking metadata
72
- value[ComponentMeta] === true;
73
- }
74
-
75
- // src/runtime/create-element.mts
76
- function flattenChildren(children) {
77
- if (children == null || children === false) {
78
- return [];
79
- }
80
- if (Array.isArray(children)) {
81
- return children.flat(Infinity).filter((c) => c != null && c !== false);
82
- }
83
- return [children];
84
- }
85
- function createElement(type, props, ...children) {
86
- const flatChildren = flattenChildren(children);
87
- if (isComponentClass(type)) {
88
- return {
89
- type: ClassComponent,
90
- componentClass: type,
91
- props: { ...props, children: flatChildren }
92
- };
93
- }
94
- if (typeof type === "function") {
95
- const result = type({ ...props, children: flatChildren });
96
- if (result instanceof Promise) {
97
- return {
98
- type: AsyncComponent,
99
- promise: result
100
- };
101
- }
102
- return result;
103
- }
104
- return {
105
- type,
106
- props: props ?? {},
107
- children: flatChildren
108
- };
109
- }
110
-
111
- // src/runtime/special-nodes.mts
112
- function CData({ children }) {
113
- return {
114
- type: CDataSymbol,
115
- content: String(children)
116
- };
117
- }
118
- function DangerouslyInsertRawXml({ children }) {
119
- return {
120
- type: RawXmlSymbol,
121
- content: String(children)
122
- };
123
- }
124
-
125
- // src/runtime/render-to-xml.mts
126
- var MissingContainerError = class extends Error {
127
- constructor(componentName) {
128
- super(
129
- `[@navios/adapter-xml] Cannot render class component "${componentName}" without a container. Pass a container to renderToXml options: renderToXml(node, { container })`
130
- );
131
- this.name = "MissingContainerError";
132
- }
133
- };
134
- async function renderToXml(node, options = {}) {
135
- const {
136
- declaration = true,
137
- encoding = "UTF-8",
138
- pretty = false,
139
- container
140
- } = options;
141
- let xml = "";
142
- if (declaration) {
143
- xml += `<?xml version="1.0" encoding="${encoding}"?>`;
144
- if (pretty) xml += "\n";
145
- }
146
- xml += await renderNode(node, pretty ? 0 : -1, container);
147
- return xml;
148
- }
149
- async function renderNode(node, indent, container) {
150
- if (node == null) return "";
151
- if (typeof node === "string") return escapeXml(node);
152
- if (typeof node === "number") return String(node);
153
- if (isClassComponentNode(node)) {
154
- if (!container) {
155
- throw new MissingContainerError(node.componentClass.name);
156
- }
157
- const instance = await container.get(
158
- node.componentClass,
159
- node.props
160
- );
161
- const result = instance.render();
162
- const resolved = result instanceof Promise ? await result : result;
163
- return renderNode(resolved, indent, container);
164
- }
165
- if (isAsyncNode(node)) {
166
- const resolved = await node.promise;
167
- return renderNode(resolved, indent, container);
168
- }
169
- if (isCDataNode(node)) {
170
- return renderCData(node.content);
171
- }
172
- if (isRawXmlNode(node)) {
173
- return node.content;
174
- }
175
- const { type, props, children } = node;
176
- if (type === Fragment) {
177
- const renderedChildren = await Promise.all(
178
- children.filter((c) => c != null).map((c) => renderNode(c, indent, container))
179
- );
180
- return renderedChildren.join("");
181
- }
182
- const prefix = indent >= 0 ? " ".repeat(indent) : "";
183
- const newline = indent >= 0 ? "\n" : "";
184
- const attrs = Object.entries(props).filter(([_, v]) => v != null).map(([k, v]) => ` ${k}="${escapeAttr(String(v))}"`).join("");
185
- if (children.length === 0) {
186
- return `${prefix}<${type}${attrs}/>${newline}`;
187
- }
188
- const childIndent = indent >= 0 ? indent + 1 : -1;
189
- const resolvedChildren = await Promise.all(
190
- children.filter((c) => c != null).map((c) => renderNode(c, childIndent, container))
191
- );
192
- const childContent = resolvedChildren.join("");
193
- const hasOnlySimpleContent = children.every(
194
- (c) => typeof c === "string" || typeof c === "number" || isCDataNode(c) || isRawXmlNode(c)
195
- );
196
- if (hasOnlySimpleContent) {
197
- return `${prefix}<${type}${attrs}>${childContent}</${type}>${newline}`;
198
- }
199
- return `${prefix}<${type}${attrs}>${newline}${childContent}${prefix}</${type}>${newline}`;
200
- }
201
- function isClassComponentNode(node) {
202
- return node !== null && typeof node === "object" && "type" in node && node.type === ClassComponent;
203
- }
204
- function isAsyncNode(node) {
205
- return node !== null && typeof node === "object" && "type" in node && node.type === AsyncComponent;
206
- }
207
- function isCDataNode(node) {
208
- return node && typeof node === "object" && node.type === CDataSymbol;
209
- }
210
- function isRawXmlNode(node) {
211
- return node && typeof node === "object" && node.type === RawXmlSymbol;
212
- }
213
- function renderCData(content) {
214
- if (content.includes("]]>")) {
215
- const escaped = content.replace(/]]>/g, "]]]]><![CDATA[>");
216
- return `<![CDATA[${escaped}]]>`;
217
- }
218
- return `<![CDATA[${content}]]>`;
219
- }
220
- function escapeXml(str) {
221
- return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
222
- }
223
- function escapeAttr(str) {
224
- return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
225
- }
226
-
227
- // src/tags/define-tag.mts
228
- function defineTag(name, propsSchema) {
229
- const component = (props) => {
230
- const { children, ...rest } = props ?? {};
231
- if (propsSchema) {
232
- propsSchema.parse(rest);
233
- }
234
- return {
235
- type: name,
236
- props: rest,
237
- children: Array.isArray(children) ? children : children ? [children] : []
238
- };
239
- };
240
- component.tagName = name;
241
- return component;
242
- }
243
- function XmlStream(endpoint) {
244
- return (target, context) => {
245
- if (typeof target !== "function") {
246
- throw new Error("[Navios] XmlStream decorator can only be used on functions.");
247
- }
248
- if (context.kind !== "method") {
249
- throw new Error("[Navios] XmlStream decorator can only be used on methods.");
250
- }
251
- const config = endpoint.config;
252
- if (context.metadata) {
253
- const endpointMetadata = core.getEndpointMetadata(target, context);
254
- if (endpointMetadata.config && endpointMetadata.config.url) {
255
- throw new Error(`[Navios] Endpoint ${config.method} ${config.url} already exists.`);
256
- }
257
- endpointMetadata.config = config;
258
- endpointMetadata.adapterToken = core.XmlStreamAdapterToken;
259
- endpointMetadata.classMethod = target.name;
260
- endpointMetadata.httpMethod = config.method;
261
- endpointMetadata.url = config.url;
262
- }
263
- return target;
264
- };
265
- }
266
-
267
- // src/handlers/xml-stream.mts
268
- function declareXmlStream(config) {
269
- return { config };
270
- }
271
- var _XmlStreamAdapterService_decorators, _init;
272
- _XmlStreamAdapterService_decorators = [di.Injectable({
273
- token: core.XmlStreamAdapterToken
274
- })];
275
- exports.XmlStreamAdapterService = class XmlStreamAdapterService {
276
- container = di.inject(di.Container);
277
- /** Base stream adapter - we proxy hasSchema, prepareArguments, provideSchema to it */
278
- streamAdapter = di.inject(core.StreamAdapterToken);
279
- /**
280
- * Proxy to base StreamAdapter - reuses existing argument preparation logic
281
- * (handles querySchema, requestSchema, URL params for both Fastify and Bun)
282
- */
283
- prepareArguments(handlerMetadata) {
284
- return this.streamAdapter.prepareArguments?.(handlerMetadata) ?? [];
285
- }
286
- provideSchema(handlerMetadata) {
287
- if ("provideSchema" in this.streamAdapter && typeof this.streamAdapter.provideSchema === "function") {
288
- return this.streamAdapter.provideSchema(handlerMetadata);
289
- }
290
- return {};
291
- }
292
- hasSchema(handlerMetadata) {
293
- if ("hasSchema" in this.streamAdapter && typeof this.streamAdapter.hasSchema === "function") {
294
- return this.streamAdapter.hasSchema(handlerMetadata);
295
- }
296
- return false;
297
- }
298
- /**
299
- * Custom handler - renders JSX to XML and handles response for both Fastify and Bun
300
- */
301
- provideHandler(controller, handlerMetadata) {
302
- const getters = this.prepareArguments(handlerMetadata);
303
- const config = handlerMetadata.config;
304
- const formatArguments = async (request) => {
305
- const argument = {};
306
- const promises = [];
307
- for (const getter of getters) {
308
- const res = getter(argument, request);
309
- if (res instanceof Promise) {
310
- promises.push(res);
311
- }
312
- }
313
- await Promise.all(promises);
314
- return argument;
315
- };
316
- const contentType = config.contentType ?? "application/xml";
317
- const renderOptions = {
318
- declaration: config.xmlDeclaration ?? true,
319
- encoding: config.encoding ?? "UTF-8",
320
- container: this.container
321
- };
322
- return async (context, request, reply) => {
323
- const controllerInstance = await this.container.get(controller);
324
- const argument = await formatArguments(request);
325
- const xmlNode = await controllerInstance[handlerMetadata.classMethod](argument);
326
- const xml = await renderToXml(xmlNode, renderOptions);
327
- const isHttpStandardEnvironment = reply === void 0;
328
- if (isHttpStandardEnvironment) {
329
- const headers = {
330
- "Content-Type": contentType
331
- };
332
- for (const [key, value] of Object.entries(handlerMetadata.headers)) {
333
- if (value != null) {
334
- headers[key] = String(value);
335
- }
336
- }
337
- return new Response(xml, {
338
- status: handlerMetadata.successStatusCode,
339
- headers
340
- });
341
- } else {
342
- reply.status(handlerMetadata.successStatusCode).header("Content-Type", contentType).headers(handlerMetadata.headers).send(xml);
343
- }
344
- };
345
- }
346
- };
347
- _init = __decoratorStart();
348
- exports.XmlStreamAdapterService = __decorateElement(_init, 0, "XmlStreamAdapterService", _XmlStreamAdapterService_decorators, exports.XmlStreamAdapterService);
349
- __runInitializers(_init, 1, exports.XmlStreamAdapterService);
350
- function defineXmlEnvironment() {
351
- const httpTokens = /* @__PURE__ */ new Map([
352
- [core.XmlStreamAdapterToken, exports.XmlStreamAdapterService]
353
- ]);
354
- return {
355
- httpTokens
356
- };
357
- }
358
-
359
- exports.AsyncComponent = AsyncComponent;
360
- exports.CData = CData;
361
- exports.CDataSymbol = CDataSymbol;
362
- exports.ClassComponent = ClassComponent;
363
- exports.Component = Component;
364
- exports.DangerouslyInsertRawXml = DangerouslyInsertRawXml;
365
- exports.Fragment = Fragment;
366
- exports.MissingContainerError = MissingContainerError;
367
- exports.RawXmlSymbol = RawXmlSymbol;
368
- exports.XmlStream = XmlStream;
369
- exports.createElement = createElement;
370
- exports.declareXmlStream = declareXmlStream;
371
- exports.defineTag = defineTag;
372
- exports.defineXmlEnvironment = defineXmlEnvironment;
373
- exports.isComponentClass = isComponentClass;
374
- exports.renderToXml = renderToXml;
375
- //# sourceMappingURL=index.js.map
376
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/types/xml-node.mts","../src/decorators/component.decorator.mts","../src/runtime/create-element.mts","../src/runtime/special-nodes.mts","../src/runtime/render-to-xml.mts","../src/tags/define-tag.mts","../src/decorators/xml-stream.decorator.mts","../src/handlers/xml-stream.mts","../src/adapters/xml-stream-adapter.service.mts","../src/define-environment.mts"],"names":["globalRegistry","InjectionToken","InjectableScope","InjectableType","InjectableTokenMeta","getEndpointMetadata","XmlStreamAdapterToken","Injectable","XmlStreamAdapterService","inject","Container","StreamAdapterToken"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,IAAM,QAAA,mBAAW,MAAA,CAAO,GAAA,CAAI,cAAc;AAC1C,IAAM,cAAA,mBAAiB,MAAA,CAAO,GAAA,CAAI,WAAW;AAC7C,IAAM,WAAA,mBAAc,MAAA,CAAO,GAAA,CAAI,WAAW;AAC1C,IAAM,YAAA,mBAAe,MAAA,CAAO,GAAA,CAAI,SAAS;AACzC,IAAM,cAAA,mBAAiB,MAAA,CAAO,GAAA,CAAI,qBAAqB;ACQvD,IAAM,aAAA,mBAAgB,MAAA,CAAO,GAAA,CAAI,oBAAoB,CAAA;AAyBrD,SAAS,SAAA,CACd,OAAA,GAGI,EAAC,EACL;AACA,EAAA,MAAM,EAAE,MAAA,EAAQ,QAAA,GAAWA,iBAAA,EAAe,GAAI,OAAA;AAE9C,EAAA,OAAO,CACL,QACA,OAAA,KACM;AACN,IAAA,IACG,WAAW,OAAA,CAAQ,IAAA,KAAS,WAC5B,MAAA,YAAkB,QAAA,IAAY,CAAC,OAAA,EAChC;AACA,MAAA,MAAM,IAAI,KAAA;AAAA,QACR;AAAA,OACF;AAAA,IACF;AAGA,IAAA,IAAI,OAAO,MAAA,CAAO,SAAA,CAAU,MAAA,KAAW,UAAA,EAAY;AACjD,MAA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AAA,IAAI,SAAS,IAAA,EAAM;AACjB,YAAA,OAAA,CAAQ,GAAG,CAAA,GAAI,MAAA,CAAO,KAAK,CAAA;AAAA,UAC7B;AAAA,QACF;AACA,QAAA,OAAO,IAAI,SAAS,GAAA,EAAK;AAAA,UACvB,QAAQ,eAAA,CAAgB,iBAAA;AAAA,UACxB;AAAA,SACD,CAAA;AAAA,MACH,CAAA,MAAO;AAEL,QAAA,KAAA,CACG,MAAA,CAAO,eAAA,CAAgB,iBAAiB,CAAA,CACxC,MAAA,CAAO,cAAA,EAAgB,WAAW,CAAA,CAClC,OAAA,CAAQ,eAAA,CAAgB,OAAO,CAAA,CAC/B,KAAK,GAAG,CAAA;AAAA,MACb;AAAA,IACF,CAAA;AAAA,EACF;AACF;AAvGO,KAAA,GAAA,gBAAA,CAAA,CAAA;AAAMH,+BAAA,GAAN,uDAHP,mCAAA,EAGaA,+BAAA,CAAA;AAAN,iBAAA,CAAA,KAAA,EAAA,CAAA,EAAMA,+BAAA,CAAA;ACeN,SAAS,oBAAA,GAAuB;AACrC,EAAA,MAAM,UAAA,uBAAiB,GAAA,CAAuD;AAAA,IAC5E,CAACF,4BAAuBE,+BAAuB;AAAA,GAChD,CAAA;AACD,EAAA,OAAO;AAAA,IACL;AAAA,GACF;AACF","file":"index.js","sourcesContent":["import type { ComponentClass } from './component.mjs'\n\nexport const Fragment = Symbol.for('xml.fragment')\nexport const AsyncComponent = Symbol.for('xml.async')\nexport const CDataSymbol = Symbol.for('xml.cdata')\nexport const RawXmlSymbol = Symbol.for('xml.raw')\nexport const ClassComponent = Symbol.for('xml.class-component')\n\n/** Represents a CDATA section - content is wrapped in <![CDATA[...]]> */\nexport interface CDataNode {\n type: typeof CDataSymbol\n content: string\n}\n\n/** Represents raw XML content - inserted without any escaping or wrapping */\nexport interface RawXmlNode {\n type: typeof RawXmlSymbol\n content: string\n}\n\n/** Represents a class component that needs to be resolved via DI */\nexport interface ClassComponentNode {\n type: typeof ClassComponent\n componentClass: ComponentClass\n props: Record<string, unknown>\n}\n\nexport interface XmlNode {\n type: string | typeof Fragment\n props: Record<string, unknown>\n children: AnyXmlNode[]\n}\n\n/** Represents an async component that needs to be resolved before rendering */\nexport interface AsyncXmlNode {\n type: typeof AsyncComponent\n promise: Promise<AnyXmlNode>\n}\n\n/** Union type for all possible node types */\nexport type AnyXmlNode =\n | XmlNode\n | AsyncXmlNode\n | CDataNode\n | RawXmlNode\n | ClassComponentNode\n | string\n | number\n | null\n | undefined\n","import type { z, ZodObject, ZodRawShape } from 'zod/v4'\n\nimport type { Registry } from '@navios/di'\n\nimport {\n InjectableScope,\n InjectableType,\n InjectableTokenMeta,\n InjectionToken,\n globalRegistry,\n} from '@navios/di'\n\nimport type { ComponentClass, XmlComponent } from '../types/component.mjs'\n\nexport const ComponentMeta = Symbol.for('xml.component.meta')\n\n// #1 Component without props (no schema)\nexport function Component(): <T extends ComponentClass>(\n target: T,\n context?: ClassDecoratorContext,\n) => T\n\n// #2 Component with props schema\nexport function Component<Schema extends ZodObject<ZodRawShape>>(options: {\n schema: Schema\n registry?: Registry\n}): <T extends new (props: z.output<Schema>, ...args: any[]) => XmlComponent>(\n target: T,\n context?: ClassDecoratorContext,\n) => T\n\n// #3 Component with custom registry only\nexport function Component(options: {\n registry: Registry\n}): <T extends ComponentClass>(\n target: T,\n context?: ClassDecoratorContext,\n) => T\n\nexport function Component(\n options: {\n schema?: ZodObject<ZodRawShape>\n registry?: Registry\n } = {},\n) {\n const { schema, registry = globalRegistry } = options\n\n return <T extends ComponentClass>(\n target: T,\n context?: ClassDecoratorContext,\n ): T => {\n if (\n (context && context.kind !== 'class') ||\n (target instanceof Function && !context)\n ) {\n throw new Error(\n '[@navios/adapter-xml] @Component decorator can only be used on classes.',\n )\n }\n\n // Verify the class has a render method\n if (typeof target.prototype.render !== 'function') {\n throw new Error(\n `[@navios/adapter-xml] @Component class \"${target.name}\" must implement render() method.`,\n )\n }\n\n // Create token with schema if provided\n const injectableToken = schema\n ? InjectionToken.create(target, schema)\n : InjectionToken.create(target)\n\n // Register with Request scope - each render gets fresh instances\n registry.set(\n injectableToken,\n InjectableScope.Request,\n target,\n InjectableType.Class,\n )\n\n // Store token metadata on the class (same pattern as @Injectable)\n // @ts-expect-error - Adding metadata to class\n target[InjectableTokenMeta] = injectableToken\n\n // Mark as component for JSX runtime detection\n // @ts-expect-error - Adding metadata to class\n target[ComponentMeta] = true\n\n return target\n }\n}\n\n/**\n * Type guard to check if a class is a component\n */\nexport function isComponentClass(value: unknown): value is ComponentClass {\n return (\n typeof value === 'function' &&\n // @ts-expect-error - Checking metadata\n value[ComponentMeta] === true\n )\n}\n","import type { AnyXmlNode, AsyncXmlNode, ClassComponentNode, XmlNode } from '../types/xml-node.mjs'\nimport type { ComponentClass } from '../types/component.mjs'\n\nimport { isComponentClass } from '../decorators/component.decorator.mjs'\nimport { AsyncComponent, ClassComponent, Fragment } from '../types/xml-node.mjs'\n\ntype SyncComponent = (props: any) => XmlNode | AsyncXmlNode | ClassComponentNode\ntype AsyncComponentFn = (props: any) => Promise<XmlNode | AsyncXmlNode | ClassComponentNode>\ntype FunctionalComponent = SyncComponent | AsyncComponentFn\ntype ComponentType = FunctionalComponent | ComponentClass\n\nfunction flattenChildren(children: any): AnyXmlNode[] {\n if (children == null || children === false) {\n return []\n }\n if (Array.isArray(children)) {\n return children.flat(Infinity).filter((c) => c != null && c !== false)\n }\n return [children]\n}\n\n/**\n * JSX automatic runtime function.\n * Used by the JSX transformer when jsxImportSource is set.\n * Children are passed as part of props.children.\n */\nexport function jsx(\n type: string | typeof Fragment | ComponentType,\n props: Record<string, unknown> | null,\n): XmlNode | AsyncXmlNode | ClassComponentNode {\n const { children, ...restProps } = props ?? {}\n const flatChildren = flattenChildren(children)\n\n // Handle class components - create ClassComponentNode for later resolution\n if (isComponentClass(type)) {\n return {\n type: ClassComponent,\n componentClass: type,\n props: { ...restProps, children: flatChildren },\n }\n }\n\n // Handle function components (sync or async)\n if (typeof type === 'function') {\n const result = type({ ...restProps, children: flatChildren })\n\n // If component returns a Promise, wrap it in AsyncXmlNode\n if (result instanceof Promise) {\n return {\n type: AsyncComponent,\n promise: result,\n }\n }\n\n return result\n }\n\n return {\n type,\n props: restProps,\n children: flatChildren,\n }\n}\n\n/**\n * JSX automatic runtime function for static children.\n * Identical to jsx() for XML - React uses this for optimization hints.\n */\nexport const jsxs = jsx\n\n/**\n * Classic createElement for manual usage.\n * Children are passed as rest arguments.\n */\nexport function createElement(\n type: string | typeof Fragment | ComponentType,\n props: Record<string, unknown> | null,\n ...children: any[]\n): XmlNode | AsyncXmlNode | ClassComponentNode {\n const flatChildren = flattenChildren(children)\n\n // Handle class components - create ClassComponentNode for later resolution\n if (isComponentClass(type)) {\n return {\n type: ClassComponent,\n componentClass: type,\n props: { ...props, children: flatChildren },\n }\n }\n\n // Handle function components (sync or async)\n if (typeof type === 'function') {\n const result = type({ ...props, children: flatChildren })\n\n // If component returns a Promise, wrap it in AsyncXmlNode\n if (result instanceof Promise) {\n return {\n type: AsyncComponent,\n promise: result,\n }\n }\n\n return result\n }\n\n return {\n type,\n props: props ?? {},\n children: flatChildren,\n }\n}\n\nexport { Fragment }\n","import type { CDataNode, RawXmlNode } from '../types/xml-node.mjs'\nimport { CDataSymbol, RawXmlSymbol } from '../types/xml-node.mjs'\n\n/**\n * CDATA component - wraps content in <![CDATA[...]]>\n * Use for text content that may contain characters like < > &\n * that would otherwise need escaping.\n *\n * Note: If content contains \"]]>\", it will be split into multiple CDATA sections.\n */\nexport function CData({ children }: { children: string }): CDataNode {\n return {\n type: CDataSymbol,\n content: String(children),\n }\n}\n\n/**\n * DangerouslyInsertRawXml - inserts raw XML/HTML without any escaping or wrapping\n *\n * WARNING: This bypasses all XML escaping. Only use with trusted content!\n * Use cases:\n * - Pre-rendered XML fragments\n * - HTML content in RSS/Atom feeds (in description/content:encoded)\n * - Including XML from external sources that's already valid\n */\nexport function DangerouslyInsertRawXml({ children }: { children: string }): RawXmlNode {\n return {\n type: RawXmlSymbol,\n content: String(children),\n }\n}\n","import type { Container } from '@navios/di'\n\nimport type {\n AnyXmlNode,\n AsyncXmlNode,\n CDataNode,\n ClassComponentNode,\n RawXmlNode,\n} from '../types/xml-node.mjs'\nimport type { XmlComponent } from '../types/component.mjs'\n\nimport {\n AsyncComponent,\n CDataSymbol,\n ClassComponent,\n Fragment,\n RawXmlSymbol,\n} from '../types/xml-node.mjs'\n\nexport interface RenderOptions {\n /** Include XML declaration (<?xml version=\"1.0\"?>) - defaults to true */\n declaration?: boolean\n /** XML encoding, defaults to 'UTF-8' */\n encoding?: string\n /** Pretty print with indentation */\n pretty?: boolean\n /**\n * DI container for resolving class components.\n * Required if the tree contains any class components.\n */\n container?: Container\n}\n\nexport class MissingContainerError extends Error {\n constructor(componentName: string) {\n super(\n `[@navios/adapter-xml] Cannot render class component \"${componentName}\" without a container. ` +\n `Pass a container to renderToXml options: renderToXml(node, { container })`,\n )\n this.name = 'MissingContainerError'\n }\n}\n\nexport async function renderToXml(\n node: AnyXmlNode,\n options: RenderOptions = {},\n): Promise<string> {\n const {\n declaration = true,\n encoding = 'UTF-8',\n pretty = false,\n container,\n } = options\n\n let xml = ''\n if (declaration) {\n xml += `<?xml version=\"1.0\" encoding=\"${encoding}\"?>`\n if (pretty) xml += '\\n'\n }\n\n xml += await renderNode(node, pretty ? 0 : -1, container)\n return xml\n}\n\nasync function renderNode(\n node: AnyXmlNode,\n indent: number,\n container: Container | undefined,\n): Promise<string> {\n if (node == null) return ''\n if (typeof node === 'string') return escapeXml(node)\n if (typeof node === 'number') return String(node)\n\n // Handle class components - resolve via DI container\n if (isClassComponentNode(node)) {\n if (!container) {\n throw new MissingContainerError(node.componentClass.name)\n }\n\n // Resolve the component instance from the container, passing props as schema args\n // This validates props via Zod schema if defined on the component\n const instance = (await container.get(\n node.componentClass as any,\n node.props,\n )) as XmlComponent\n\n // Call render() - no arguments, props are already in the instance\n const result = instance.render()\n\n // Handle async render methods\n const resolved = result instanceof Promise ? await result : result\n\n // Recursively render the result\n return renderNode(resolved, indent, container)\n }\n\n // Handle async components - resolve the promise first\n if (isAsyncNode(node)) {\n const resolved = await node.promise\n return renderNode(resolved, indent, container)\n }\n\n // Handle CDATA nodes\n if (isCDataNode(node)) {\n return renderCData(node.content)\n }\n\n // Handle Raw XML nodes - no escaping\n if (isRawXmlNode(node)) {\n return node.content\n }\n\n const { type, props, children } = node\n\n if (type === Fragment) {\n const renderedChildren = await Promise.all(\n children\n .filter((c) => c != null)\n .map((c) => renderNode(c, indent, container)),\n )\n return renderedChildren.join('')\n }\n\n const prefix = indent >= 0 ? ' '.repeat(indent) : ''\n const newline = indent >= 0 ? '\\n' : ''\n\n const attrs = Object.entries(props)\n .filter(([_, v]) => v != null)\n .map(([k, v]) => ` ${k}=\"${escapeAttr(String(v))}\"`)\n .join('')\n\n if (children.length === 0) {\n return `${prefix}<${type}${attrs}/>${newline}`\n }\n\n const childIndent = indent >= 0 ? indent + 1 : -1\n\n // Resolve all children (including async and class components) in parallel\n const resolvedChildren = await Promise.all(\n children\n .filter((c) => c != null)\n .map((c) => renderNode(c, childIndent, container)),\n )\n const childContent = resolvedChildren.join('')\n\n // Check if children are simple (text, numbers, CDATA, or raw XML)\n const hasOnlySimpleContent = children.every(\n (c) =>\n typeof c === 'string' ||\n typeof c === 'number' ||\n isCDataNode(c) ||\n isRawXmlNode(c),\n )\n if (hasOnlySimpleContent) {\n return `${prefix}<${type}${attrs}>${childContent}</${type}>${newline}`\n }\n\n return `${prefix}<${type}${attrs}>${newline}${childContent}${prefix}</${type}>${newline}`\n}\n\nfunction isClassComponentNode(node: unknown): node is ClassComponentNode {\n return (\n node !== null &&\n typeof node === 'object' &&\n 'type' in node &&\n node.type === ClassComponent\n )\n}\n\nfunction isAsyncNode(node: unknown): node is AsyncXmlNode {\n return (\n node !== null &&\n typeof node === 'object' &&\n 'type' in node &&\n node.type === AsyncComponent\n )\n}\n\nfunction isCDataNode(node: any): node is CDataNode {\n return node && typeof node === 'object' && node.type === CDataSymbol\n}\n\nfunction isRawXmlNode(node: any): node is RawXmlNode {\n return node && typeof node === 'object' && node.type === RawXmlSymbol\n}\n\n/**\n * Renders content as CDATA section.\n * If content contains \"]]>\", splits into multiple CDATA sections.\n * The technique is to end the CDATA section before ]]>, then start a new one.\n */\nfunction renderCData(content: string): string {\n // Handle the edge case where content contains \"]]>\"\n // We split on \"]]>\" and join with \"]]]]><![CDATA[>\" which effectively\n // ends the CDATA section after \"]]\" and starts a new one for \">\"\n if (content.includes(']]>')) {\n // Replace ]]> with ]]]]><![CDATA[> which closes CDATA before > and reopens it\n const escaped = content.replace(/]]>/g, ']]]]><![CDATA[>')\n return `<![CDATA[${escaped}]]>`\n }\n return `<![CDATA[${content}]]>`\n}\n\nfunction escapeXml(str: string): string {\n return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')\n}\n\nfunction escapeAttr(str: string): string {\n return str\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n}\n","import type { ZodObject, ZodRawShape } from 'zod/v4'\nimport type { z } from 'zod/v4'\n\nimport type { AnyXmlNode, XmlNode } from '../types/xml-node.mjs'\n\nexport interface TagComponent<Props extends Record<string, unknown>> {\n (props: Props & { children?: AnyXmlNode | AnyXmlNode[] }): XmlNode\n tagName: string\n}\n\n/**\n * Creates a type-safe XML tag component with optional Zod schema validation.\n *\n * @param name - The tag name (supports namespace prefixes like 'atom:link')\n * @param propsSchema - Optional Zod schema for validating props\n * @returns A component function that can be used in JSX\n *\n * @example\n * ```tsx\n * // Simple tag\n * const item = defineTag('item')\n * <item>Content</item>\n *\n * // Namespaced tag with Zod validation\n * const atomLink = defineTag('atom:link', z.object({\n * href: z.string().url(),\n * rel: z.enum(['self', 'alternate']),\n * type: z.string().optional(),\n * }))\n * <atomLink href=\"https://example.com/feed\" rel=\"self\" />\n * ```\n */\nexport function defineTag<T extends ZodRawShape>(\n name: string,\n propsSchema?: ZodObject<T>,\n): TagComponent<T extends ZodRawShape ? z.infer<ZodObject<T>> : Record<string, never>> {\n const component = (props: any): XmlNode => {\n const { children, ...rest } = props ?? {}\n\n // Validate props if schema provided\n if (propsSchema) {\n propsSchema.parse(rest)\n }\n\n return {\n type: name,\n props: rest,\n children: Array.isArray(children) ? children : children ? [children] : [],\n }\n }\n\n component.tagName = name\n return component as any\n}\n","import type { EndpointFunctionArgs, HttpMethod, Util_FlatObject } from '@navios/builder'\nimport type { ZodObject, ZodType } from 'zod/v4'\n\nimport { getEndpointMetadata, XmlStreamAdapterToken } from '@navios/core'\n\nimport type { BaseXmlStreamConfig } from '../types/config.mjs'\n\nexport type XmlStreamParams<\n EndpointDeclaration extends {\n config: BaseXmlStreamConfig<any, any, any, any>\n },\n Url extends string = EndpointDeclaration['config']['url'],\n QuerySchema = EndpointDeclaration['config']['querySchema'],\n> = QuerySchema extends ZodObject\n ? EndpointDeclaration['config']['requestSchema'] extends ZodType\n ? Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, EndpointDeclaration['config']['requestSchema'], true>>\n : Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, undefined, true>>\n : EndpointDeclaration['config']['requestSchema'] extends ZodType\n ? Util_FlatObject<EndpointFunctionArgs<Url, undefined, EndpointDeclaration['config']['requestSchema'], true>>\n : Util_FlatObject<EndpointFunctionArgs<Url, undefined, undefined, true>>\n\n/**\n * Decorator for XML Stream endpoints that return JSX-based XML responses.\n *\n * @example\n * ```typescript\n * import { XmlStream } from '@navios/adapter-xml'\n * import { Controller } from '@navios/core'\n *\n * const getRssFeed = declareXmlStream({\n * method: 'GET',\n * url: '/feed.xml',\n * querySchema: undefined,\n * requestSchema: undefined,\n * contentType: 'application/rss+xml',\n * })\n *\n * @Controller('/api')\n * class FeedController {\n * @XmlStream(getRssFeed)\n * async getFeed() {\n * return (\n * <rss version=\"2.0\">\n * <channel>\n * <title>My Feed</title>\n * </channel>\n * </rss>\n * )\n * }\n * }\n * ```\n */\nexport function XmlStream<\n Method extends HttpMethod = HttpMethod,\n Url extends string = string,\n QuerySchema = undefined,\n RequestSchema = ZodType,\n>(endpoint: { config: BaseXmlStreamConfig<Method, Url, QuerySchema, RequestSchema> }) {\n return (\n target: (\n params: QuerySchema extends ZodObject\n ? RequestSchema extends ZodType\n ? Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true>>\n : Util_FlatObject<EndpointFunctionArgs<Url, QuerySchema, undefined, true>>\n : RequestSchema extends ZodType\n ? Util_FlatObject<EndpointFunctionArgs<Url, undefined, RequestSchema, true>>\n : Util_FlatObject<EndpointFunctionArgs<Url, undefined, undefined, true>>,\n ) => Promise<any>, // Returns XmlNode\n context: ClassMethodDecoratorContext,\n ) => {\n if (typeof target !== 'function') {\n throw new Error('[Navios] XmlStream decorator can only be used on functions.')\n }\n if (context.kind !== 'method') {\n throw new Error('[Navios] XmlStream decorator can only be used on methods.')\n }\n\n const config = endpoint.config\n if (context.metadata) {\n const endpointMetadata = getEndpointMetadata<BaseXmlStreamConfig>(target, context)\n if (endpointMetadata.config && endpointMetadata.config.url) {\n throw new Error(`[Navios] Endpoint ${config.method} ${config.url} already exists.`)\n }\n // @ts-expect-error We don't need to set correctly in the metadata\n endpointMetadata.config = config\n endpointMetadata.adapterToken = XmlStreamAdapterToken\n endpointMetadata.classMethod = target.name\n endpointMetadata.httpMethod = config.method\n endpointMetadata.url = config.url\n }\n return target\n }\n}\n","import type { HttpMethod } from '@navios/builder'\n\nimport type { BaseXmlStreamConfig } from '../types/config.mjs'\n\n/**\n * Declares an XML Stream endpoint configuration for use with @XmlStream decorator.\n *\n * @example\n * ```typescript\n * import { declareXmlStream } from '@navios/adapter-xml'\n *\n * export const getRssFeed = declareXmlStream({\n * method: 'GET',\n * url: '/feed.xml',\n * querySchema: undefined,\n * requestSchema: undefined,\n * contentType: 'application/rss+xml',\n * xmlDeclaration: true,\n * })\n * ```\n */\nexport function declareXmlStream<\n Method extends HttpMethod,\n Url extends string,\n QuerySchema = undefined,\n RequestSchema = undefined,\n>(\n config: BaseXmlStreamConfig<Method, Url, QuerySchema, RequestSchema>,\n): { config: BaseXmlStreamConfig<Method, Url, QuerySchema, RequestSchema> } {\n return { config }\n}\n","import type {\n AbstractHttpHandlerAdapterInterface,\n HandlerMetadata,\n} from '@navios/core'\nimport type { ClassType, RequestContextHolder } from '@navios/di'\n\nimport { StreamAdapterToken, XmlStreamAdapterToken } from '@navios/core'\nimport { Container, inject, Injectable } from '@navios/di'\n\nimport type { BaseXmlStreamConfig } from '../types/config.mjs'\nimport type { AnyXmlNode } from '../types/xml-node.mjs'\n\nimport { renderToXml } from '../runtime/render-to-xml.mjs'\n\n@Injectable({\n token: XmlStreamAdapterToken,\n})\nexport class XmlStreamAdapterService implements AbstractHttpHandlerAdapterInterface {\n protected container = inject(Container)\n /** Base stream adapter - we proxy hasSchema, prepareArguments, provideSchema to it */\n protected streamAdapter = inject(StreamAdapterToken)\n\n /**\n * Proxy to base StreamAdapter - reuses existing argument preparation logic\n * (handles querySchema, requestSchema, URL params for both Fastify and Bun)\n */\n prepareArguments(handlerMetadata: HandlerMetadata<BaseXmlStreamConfig>) {\n return this.streamAdapter.prepareArguments?.(handlerMetadata) ?? []\n }\n\n provideSchema(\n handlerMetadata: HandlerMetadata<BaseXmlStreamConfig>,\n ): Record<string, any> {\n if (\n 'provideSchema' in this.streamAdapter &&\n typeof this.streamAdapter.provideSchema === 'function'\n ) {\n return this.streamAdapter.provideSchema(handlerMetadata)\n }\n return {}\n }\n\n hasSchema(handlerMetadata: HandlerMetadata<any>): boolean {\n if (\n 'hasSchema' in this.streamAdapter &&\n typeof this.streamAdapter.hasSchema === 'function'\n ) {\n return this.streamAdapter.hasSchema(handlerMetadata)\n }\n return false\n }\n\n /**\n * Custom handler - renders JSX to XML and handles response for both Fastify and Bun\n */\n provideHandler(\n controller: ClassType,\n handlerMetadata: HandlerMetadata<BaseXmlStreamConfig>,\n ): (context: RequestContextHolder, request: any, reply: any) => Promise<any> {\n const getters = this.prepareArguments(handlerMetadata)\n const config = handlerMetadata.config\n\n const formatArguments = async (request: any) => {\n const argument: Record<string, any> = {}\n const promises: Promise<void>[] = []\n for (const getter of getters) {\n const res = getter(argument, request)\n if (res instanceof Promise) {\n promises.push(res)\n }\n }\n await Promise.all(promises)\n return argument\n }\n\n const contentType = config.contentType ?? 'application/xml'\n const renderOptions = {\n declaration: config.xmlDeclaration ?? true,\n encoding: config.encoding ?? 'UTF-8',\n container: this.container,\n }\n\n return async (context: RequestContextHolder, request: any, reply: any) => {\n const controllerInstance = await this.container.get(controller)\n const argument = await formatArguments(request)\n\n // Call controller method - returns XmlNode (JSX), may contain async/class components\n const xmlNode: AnyXmlNode =\n await controllerInstance[handlerMetadata.classMethod](argument)\n\n // Render JSX to XML string (async - resolves all async and class components)\n const xml = await renderToXml(xmlNode, renderOptions)\n\n // Environment detection: Bun doesn't have reply\n const isHttpStandardEnvironment = reply === undefined\n\n if (isHttpStandardEnvironment) {\n // Bun: return Response object\n const headers: Record<string, string> = {\n 'Content-Type': contentType,\n }\n for (const [key, value] of Object.entries(handlerMetadata.headers)) {\n if (value != null) {\n headers[key] = String(value)\n }\n }\n return new Response(xml, {\n status: handlerMetadata.successStatusCode,\n headers,\n })\n } else {\n // Fastify: use reply object\n reply\n .status(handlerMetadata.successStatusCode)\n .header('Content-Type', contentType)\n .headers(handlerMetadata.headers)\n .send(xml)\n }\n }\n }\n}\n","import type { AnyInjectableType } from '@navios/di'\n\nimport { XmlStreamAdapterToken } from '@navios/core'\nimport { InjectionToken } from '@navios/di'\n\nimport { XmlStreamAdapterService } from './adapters/index.mjs'\n\n/**\n * Creates the XML environment configuration to be merged with base adapter (Fastify/Bun).\n *\n * @example\n * ```typescript\n * import { defineFastifyEnvironment } from '@navios/adapter-fastify'\n * import { defineXmlEnvironment } from '@navios/adapter-xml'\n * import { NaviosFactory } from '@navios/core'\n *\n * const fastifyEnv = defineFastifyEnvironment()\n * const xmlEnv = defineXmlEnvironment()\n *\n * // Merge environments\n * const mergedEnv = {\n * httpTokens: new Map([\n * ...fastifyEnv.httpTokens,\n * ...xmlEnv.httpTokens,\n * ]),\n * }\n *\n * const app = await NaviosFactory.create(AppModule, {\n * adapter: mergedEnv,\n * })\n * ```\n */\nexport function defineXmlEnvironment() {\n const httpTokens = new Map<InjectionToken<any, undefined>, AnyInjectableType>([\n [XmlStreamAdapterToken, XmlStreamAdapterService],\n ])\n return {\n httpTokens,\n }\n}\n"]}
@@ -1,4 +0,0 @@
1
- export { jsx } from './_tsup-dts-rollup.js';
2
- export { jsxs } from './_tsup-dts-rollup.js';
3
- export { Fragment_alias_1 as Fragment } from './_tsup-dts-rollup.js';
4
- export { jsxDEV } from './_tsup-dts-rollup.js';
@@ -1,61 +0,0 @@
1
- 'use strict';
2
-
3
- // src/decorators/component.decorator.mts
4
- var ComponentMeta = /* @__PURE__ */ Symbol.for("xml.component.meta");
5
- function isComponentClass(value) {
6
- return typeof value === "function" && // @ts-expect-error - Checking metadata
7
- value[ComponentMeta] === true;
8
- }
9
-
10
- // src/types/xml-node.mts
11
- var Fragment = /* @__PURE__ */ Symbol.for("xml.fragment");
12
- var AsyncComponent = /* @__PURE__ */ Symbol.for("xml.async");
13
- var ClassComponent = /* @__PURE__ */ Symbol.for("xml.class-component");
14
-
15
- // src/runtime/create-element.mts
16
- function flattenChildren(children) {
17
- if (children == null || children === false) {
18
- return [];
19
- }
20
- if (Array.isArray(children)) {
21
- return children.flat(Infinity).filter((c) => c != null && c !== false);
22
- }
23
- return [children];
24
- }
25
- function jsx(type, props) {
26
- const { children, ...restProps } = props ?? {};
27
- const flatChildren = flattenChildren(children);
28
- if (isComponentClass(type)) {
29
- return {
30
- type: ClassComponent,
31
- componentClass: type,
32
- props: { ...restProps, children: flatChildren }
33
- };
34
- }
35
- if (typeof type === "function") {
36
- const result = type({ ...restProps, children: flatChildren });
37
- if (result instanceof Promise) {
38
- return {
39
- type: AsyncComponent,
40
- promise: result
41
- };
42
- }
43
- return result;
44
- }
45
- return {
46
- type,
47
- props: restProps,
48
- children: flatChildren
49
- };
50
- }
51
- var jsxs = jsx;
52
-
53
- // src/jsx-dev-runtime.mts
54
- var jsxDEV = jsx;
55
-
56
- exports.Fragment = Fragment;
57
- exports.jsx = jsx;
58
- exports.jsxDEV = jsxDEV;
59
- exports.jsxs = jsxs;
60
- //# sourceMappingURL=jsx-dev-runtime.js.map
61
- //# sourceMappingURL=jsx-dev-runtime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/decorators/component.decorator.mts","../src/types/xml-node.mts","../src/runtime/create-element.mts","../src/jsx-dev-runtime.mts"],"names":[],"mappings":";;;AAcO,IAAM,aAAA,mBAAgB,MAAA,CAAO,GAAA,CAAI,oBAAoB,CAAA;AAiFrD,SAAS,iBAAiB,KAAA,EAAyC;AACxE,EAAA,OACE,OAAO,KAAA,KAAU,UAAA;AAAA,EAEjB,KAAA,CAAM,aAAa,CAAA,KAAM,IAAA;AAE7B;;;ACnGO,IAAM,QAAA,mBAAW,MAAA,CAAO,GAAA,CAAI,cAAc;AAC1C,IAAM,cAAA,mBAAiB,MAAA,CAAO,GAAA,CAAI,WAAW,CAAA;AAG7C,IAAM,cAAA,mBAAiB,MAAA,CAAO,GAAA,CAAI,qBAAqB,CAAA;;;ACK9D,SAAS,gBAAgB,QAAA,EAA6B;AACpD,EAAA,IAAI,QAAA,IAAY,IAAA,IAAQ,QAAA,KAAa,KAAA,EAAO;AAC1C,IAAA,OAAO,EAAC;AAAA,EACV;AACA,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,EAAG;AAC3B,IAAA,OAAO,QAAA,CAAS,IAAA,CAAK,QAAQ,CAAA,CAAE,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,IAAK,IAAA,IAAQ,CAAA,KAAM,KAAK,CAAA;AAAA,EACvE;AACA,EAAA,OAAO,CAAC,QAAQ,CAAA;AAClB;AAOO,SAAS,GAAA,CACd,MACA,KAAA,EAC6C;AAC7C,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,SAAA,EAAU,GAAI,SAAS,EAAC;AAC7C,EAAA,MAAM,YAAA,GAAe,gBAAgB,QAAQ,CAAA;AAG7C,EAAA,IAAI,gBAAA,CAAiB,IAAI,CAAA,EAAG;AAC1B,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,cAAA;AAAA,MACN,cAAA,EAAgB,IAAA;AAAA,MAChB,KAAA,EAAO,EAAE,GAAG,SAAA,EAAW,UAAU,YAAA;AAAa,KAChD;AAAA,EACF;AAGA,EAAA,IAAI,OAAO,SAAS,UAAA,EAAY;AAC9B,IAAA,MAAM,SAAS,IAAA,CAAK,EAAE,GAAG,SAAA,EAAW,QAAA,EAAU,cAAc,CAAA;AAG5D,IAAA,IAAI,kBAAkB,OAAA,EAAS;AAC7B,MAAA,OAAO;AAAA,QACL,IAAA,EAAM,cAAA;AAAA,QACN,OAAA,EAAS;AAAA,OACX;AAAA,IACF;AAEA,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,KAAA,EAAO,SAAA;AAAA,IACP,QAAA,EAAU;AAAA,GACZ;AACF;AAMO,IAAM,IAAA,GAAO;;;AC7Db,IAAM,MAAA,GAAS","file":"jsx-dev-runtime.js","sourcesContent":["import type { z, ZodObject, ZodRawShape } from 'zod/v4'\n\nimport type { Registry } from '@navios/di'\n\nimport {\n InjectableScope,\n InjectableType,\n InjectableTokenMeta,\n InjectionToken,\n globalRegistry,\n} from '@navios/di'\n\nimport type { ComponentClass, XmlComponent } from '../types/component.mjs'\n\nexport const ComponentMeta = Symbol.for('xml.component.meta')\n\n// #1 Component without props (no schema)\nexport function Component(): <T extends ComponentClass>(\n target: T,\n context?: ClassDecoratorContext,\n) => T\n\n// #2 Component with props schema\nexport function Component<Schema extends ZodObject<ZodRawShape>>(options: {\n schema: Schema\n registry?: Registry\n}): <T extends new (props: z.output<Schema>, ...args: any[]) => XmlComponent>(\n target: T,\n context?: ClassDecoratorContext,\n) => T\n\n// #3 Component with custom registry only\nexport function Component(options: {\n registry: Registry\n}): <T extends ComponentClass>(\n target: T,\n context?: ClassDecoratorContext,\n) => T\n\nexport function Component(\n options: {\n schema?: ZodObject<ZodRawShape>\n registry?: Registry\n } = {},\n) {\n const { schema, registry = globalRegistry } = options\n\n return <T extends ComponentClass>(\n target: T,\n context?: ClassDecoratorContext,\n ): T => {\n if (\n (context && context.kind !== 'class') ||\n (target instanceof Function && !context)\n ) {\n throw new Error(\n '[@navios/adapter-xml] @Component decorator can only be used on classes.',\n )\n }\n\n // Verify the class has a render method\n if (typeof target.prototype.render !== 'function') {\n throw new Error(\n `[@navios/adapter-xml] @Component class \"${target.name}\" must implement render() method.`,\n )\n }\n\n // Create token with schema if provided\n const injectableToken = schema\n ? InjectionToken.create(target, schema)\n : InjectionToken.create(target)\n\n // Register with Request scope - each render gets fresh instances\n registry.set(\n injectableToken,\n InjectableScope.Request,\n target,\n InjectableType.Class,\n )\n\n // Store token metadata on the class (same pattern as @Injectable)\n // @ts-expect-error - Adding metadata to class\n target[InjectableTokenMeta] = injectableToken\n\n // Mark as component for JSX runtime detection\n // @ts-expect-error - Adding metadata to class\n target[ComponentMeta] = true\n\n return target\n }\n}\n\n/**\n * Type guard to check if a class is a component\n */\nexport function isComponentClass(value: unknown): value is ComponentClass {\n return (\n typeof value === 'function' &&\n // @ts-expect-error - Checking metadata\n value[ComponentMeta] === true\n )\n}\n","import type { ComponentClass } from './component.mjs'\n\nexport const Fragment = Symbol.for('xml.fragment')\nexport const AsyncComponent = Symbol.for('xml.async')\nexport const CDataSymbol = Symbol.for('xml.cdata')\nexport const RawXmlSymbol = Symbol.for('xml.raw')\nexport const ClassComponent = Symbol.for('xml.class-component')\n\n/** Represents a CDATA section - content is wrapped in <![CDATA[...]]> */\nexport interface CDataNode {\n type: typeof CDataSymbol\n content: string\n}\n\n/** Represents raw XML content - inserted without any escaping or wrapping */\nexport interface RawXmlNode {\n type: typeof RawXmlSymbol\n content: string\n}\n\n/** Represents a class component that needs to be resolved via DI */\nexport interface ClassComponentNode {\n type: typeof ClassComponent\n componentClass: ComponentClass\n props: Record<string, unknown>\n}\n\nexport interface XmlNode {\n type: string | typeof Fragment\n props: Record<string, unknown>\n children: AnyXmlNode[]\n}\n\n/** Represents an async component that needs to be resolved before rendering */\nexport interface AsyncXmlNode {\n type: typeof AsyncComponent\n promise: Promise<AnyXmlNode>\n}\n\n/** Union type for all possible node types */\nexport type AnyXmlNode =\n | XmlNode\n | AsyncXmlNode\n | CDataNode\n | RawXmlNode\n | ClassComponentNode\n | string\n | number\n | null\n | undefined\n","import type { AnyXmlNode, AsyncXmlNode, ClassComponentNode, XmlNode } from '../types/xml-node.mjs'\nimport type { ComponentClass } from '../types/component.mjs'\n\nimport { isComponentClass } from '../decorators/component.decorator.mjs'\nimport { AsyncComponent, ClassComponent, Fragment } from '../types/xml-node.mjs'\n\ntype SyncComponent = (props: any) => XmlNode | AsyncXmlNode | ClassComponentNode\ntype AsyncComponentFn = (props: any) => Promise<XmlNode | AsyncXmlNode | ClassComponentNode>\ntype FunctionalComponent = SyncComponent | AsyncComponentFn\ntype ComponentType = FunctionalComponent | ComponentClass\n\nfunction flattenChildren(children: any): AnyXmlNode[] {\n if (children == null || children === false) {\n return []\n }\n if (Array.isArray(children)) {\n return children.flat(Infinity).filter((c) => c != null && c !== false)\n }\n return [children]\n}\n\n/**\n * JSX automatic runtime function.\n * Used by the JSX transformer when jsxImportSource is set.\n * Children are passed as part of props.children.\n */\nexport function jsx(\n type: string | typeof Fragment | ComponentType,\n props: Record<string, unknown> | null,\n): XmlNode | AsyncXmlNode | ClassComponentNode {\n const { children, ...restProps } = props ?? {}\n const flatChildren = flattenChildren(children)\n\n // Handle class components - create ClassComponentNode for later resolution\n if (isComponentClass(type)) {\n return {\n type: ClassComponent,\n componentClass: type,\n props: { ...restProps, children: flatChildren },\n }\n }\n\n // Handle function components (sync or async)\n if (typeof type === 'function') {\n const result = type({ ...restProps, children: flatChildren })\n\n // If component returns a Promise, wrap it in AsyncXmlNode\n if (result instanceof Promise) {\n return {\n type: AsyncComponent,\n promise: result,\n }\n }\n\n return result\n }\n\n return {\n type,\n props: restProps,\n children: flatChildren,\n }\n}\n\n/**\n * JSX automatic runtime function for static children.\n * Identical to jsx() for XML - React uses this for optimization hints.\n */\nexport const jsxs = jsx\n\n/**\n * Classic createElement for manual usage.\n * Children are passed as rest arguments.\n */\nexport function createElement(\n type: string | typeof Fragment | ComponentType,\n props: Record<string, unknown> | null,\n ...children: any[]\n): XmlNode | AsyncXmlNode | ClassComponentNode {\n const flatChildren = flattenChildren(children)\n\n // Handle class components - create ClassComponentNode for later resolution\n if (isComponentClass(type)) {\n return {\n type: ClassComponent,\n componentClass: type,\n props: { ...props, children: flatChildren },\n }\n }\n\n // Handle function components (sync or async)\n if (typeof type === 'function') {\n const result = type({ ...props, children: flatChildren })\n\n // If component returns a Promise, wrap it in AsyncXmlNode\n if (result instanceof Promise) {\n return {\n type: AsyncComponent,\n promise: result,\n }\n }\n\n return result\n }\n\n return {\n type,\n props: props ?? {},\n children: flatChildren,\n }\n}\n\nexport { Fragment }\n","// Dev runtime is the same as the production runtime for XML\nexport { jsx, jsxs } from './runtime/create-element.mjs'\nexport { Fragment } from './types/xml-node.mjs'\n\n// jsxDEV is called by development builds of React/JSX transformers\n// It has additional debugging parameters that we ignore for XML\nimport { jsx } from './runtime/create-element.mjs'\nexport const jsxDEV = jsx\n"]}
@@ -1,3 +0,0 @@
1
- export { jsx_alias_1 as jsx } from './_tsup-dts-rollup.js';
2
- export { jsxs_alias_1 as jsxs } from './_tsup-dts-rollup.js';
3
- export { Fragment_alias_2 as Fragment } from './_tsup-dts-rollup.js';
@@ -1,57 +0,0 @@
1
- 'use strict';
2
-
3
- // src/decorators/component.decorator.mts
4
- var ComponentMeta = /* @__PURE__ */ Symbol.for("xml.component.meta");
5
- function isComponentClass(value) {
6
- return typeof value === "function" && // @ts-expect-error - Checking metadata
7
- value[ComponentMeta] === true;
8
- }
9
-
10
- // src/types/xml-node.mts
11
- var Fragment = /* @__PURE__ */ Symbol.for("xml.fragment");
12
- var AsyncComponent = /* @__PURE__ */ Symbol.for("xml.async");
13
- var ClassComponent = /* @__PURE__ */ Symbol.for("xml.class-component");
14
-
15
- // src/runtime/create-element.mts
16
- function flattenChildren(children) {
17
- if (children == null || children === false) {
18
- return [];
19
- }
20
- if (Array.isArray(children)) {
21
- return children.flat(Infinity).filter((c) => c != null && c !== false);
22
- }
23
- return [children];
24
- }
25
- function jsx(type, props) {
26
- const { children, ...restProps } = props ?? {};
27
- const flatChildren = flattenChildren(children);
28
- if (isComponentClass(type)) {
29
- return {
30
- type: ClassComponent,
31
- componentClass: type,
32
- props: { ...restProps, children: flatChildren }
33
- };
34
- }
35
- if (typeof type === "function") {
36
- const result = type({ ...restProps, children: flatChildren });
37
- if (result instanceof Promise) {
38
- return {
39
- type: AsyncComponent,
40
- promise: result
41
- };
42
- }
43
- return result;
44
- }
45
- return {
46
- type,
47
- props: restProps,
48
- children: flatChildren
49
- };
50
- }
51
- var jsxs = jsx;
52
-
53
- exports.Fragment = Fragment;
54
- exports.jsx = jsx;
55
- exports.jsxs = jsxs;
56
- //# sourceMappingURL=jsx-runtime.js.map
57
- //# sourceMappingURL=jsx-runtime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/decorators/component.decorator.mts","../src/types/xml-node.mts","../src/runtime/create-element.mts"],"names":[],"mappings":";;;AAcO,IAAM,aAAA,mBAAgB,MAAA,CAAO,GAAA,CAAI,oBAAoB,CAAA;AAiFrD,SAAS,iBAAiB,KAAA,EAAyC;AACxE,EAAA,OACE,OAAO,KAAA,KAAU,UAAA;AAAA,EAEjB,KAAA,CAAM,aAAa,CAAA,KAAM,IAAA;AAE7B;;;ACnGO,IAAM,QAAA,mBAAW,MAAA,CAAO,GAAA,CAAI,cAAc;AAC1C,IAAM,cAAA,mBAAiB,MAAA,CAAO,GAAA,CAAI,W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AAU;AAAA,GACZ;AACF;AAMO,IAAM,IAAA,GAAO","file":"jsx-runtime.js","sourcesContent":["import type { z, ZodObject, ZodRawShape } from 'zod/v4'\n\nimport type { Registry } from '@navios/di'\n\nimport {\n InjectableScope,\n InjectableType,\n InjectableTokenMeta,\n InjectionToken,\n globalRegistry,\n} from '@navios/di'\n\nimport type { ComponentClass, XmlComponent } from '../types/component.mjs'\n\nexport const ComponentMeta = Symbol.for('xml.component.meta')\n\n// #1 Component without props (no schema)\nexport function Component(): <T extends ComponentClass>(\n target: T,\n context?: ClassDecoratorContext,\n) => T\n\n// #2 Component with props schema\nexport function Component<Schema extends ZodObject<ZodRawShape>>(options: {\n schema: Schema\n registry?: Registry\n}): <T extends new (props: z.output<Schema>, ...args: any[]) => XmlComponent>(\n target: T,\n context?: ClassDecoratorContext,\n) => T\n\n// #3 Component with custom registry only\nexport function Component(options: {\n registry: Registry\n}): <T extends ComponentClass>(\n target: T,\n context?: ClassDecoratorContext,\n) => T\n\nexport function Component(\n options: {\n schema?: ZodObject<ZodRawShape>\n registry?: Registry\n } = {},\n) {\n const { schema, registry = globalRegistry } = options\n\n return <T extends ComponentClass>(\n target: T,\n context?: ClassDecoratorContext,\n ): T => {\n if (\n (context && context.kind !== 'class') ||\n (target instanceof Function && !context)\n ) {\n throw new Error(\n '[@navios/adapter-xml] @Component decorator can only be used on classes.',\n )\n }\n\n // Verify the class has a render method\n if (typeof target.prototype.render !== 'function') {\n throw new Error(\n `[@navios/adapter-xml] @Component class \"${target.name}\" must implement render() method.`,\n )\n }\n\n // Create token with schema if provided\n const injectableToken = schema\n ? InjectionToken.create(target, schema)\n : InjectionToken.create(target)\n\n // Register with Request scope - each render gets fresh instances\n registry.set(\n injectableToken,\n InjectableScope.Request,\n target,\n InjectableType.Class,\n )\n\n // Store token metadata on the class (same pattern as @Injectable)\n // @ts-expect-error - Adding metadata to class\n target[InjectableTokenMeta] = injectableToken\n\n // Mark as component for JSX runtime detection\n // @ts-expect-error - Adding metadata to class\n target[ComponentMeta] = true\n\n return target\n }\n}\n\n/**\n * Type guard to check if a class is a component\n */\nexport function isComponentClass(value: unknown): value is ComponentClass {\n return (\n typeof value === 'function' &&\n // @ts-expect-error - Checking metadata\n value[ComponentMeta] === true\n )\n}\n","import type { ComponentClass } from './component.mjs'\n\nexport const Fragment = Symbol.for('xml.fragment')\nexport const AsyncComponent = Symbol.for('xml.async')\nexport const CDataSymbol = Symbol.for('xml.cdata')\nexport const RawXmlSymbol = Symbol.for('xml.raw')\nexport const ClassComponent = Symbol.for('xml.class-component')\n\n/** Represents a CDATA section - content is wrapped in <![CDATA[...]]> */\nexport interface CDataNode {\n type: typeof CDataSymbol\n content: string\n}\n\n/** Represents raw XML content - inserted without any escaping or wrapping */\nexport interface RawXmlNode {\n type: typeof RawXmlSymbol\n content: string\n}\n\n/** Represents a class component that needs to be resolved via DI */\nexport interface ClassComponentNode {\n type: typeof ClassComponent\n componentClass: ComponentClass\n props: Record<string, unknown>\n}\n\nexport interface XmlNode {\n type: string | typeof Fragment\n props: Record<string, unknown>\n children: AnyXmlNode[]\n}\n\n/** Represents an async component that needs to be resolved before rendering */\nexport interface AsyncXmlNode {\n type: typeof AsyncComponent\n promise: Promise<AnyXmlNode>\n}\n\n/** Union type for all possible node types */\nexport type AnyXmlNode =\n | XmlNode\n | AsyncXmlNode\n | CDataNode\n | RawXmlNode\n | ClassComponentNode\n | string\n | number\n | null\n | undefined\n","import type { AnyXmlNode, AsyncXmlNode, ClassComponentNode, XmlNode } from '../types/xml-node.mjs'\nimport type { ComponentClass } from '../types/component.mjs'\n\nimport { isComponentClass } from '../decorators/component.decorator.mjs'\nimport { AsyncComponent, ClassComponent, Fragment } from '../types/xml-node.mjs'\n\ntype SyncComponent = (props: any) => XmlNode | AsyncXmlNode | ClassComponentNode\ntype AsyncComponentFn = (props: any) => Promise<XmlNode | AsyncXmlNode | ClassComponentNode>\ntype FunctionalComponent = SyncComponent | AsyncComponentFn\ntype ComponentType = FunctionalComponent | ComponentClass\n\nfunction flattenChildren(children: any): AnyXmlNode[] {\n if (children == null || children === false) {\n return []\n }\n if (Array.isArray(children)) {\n return children.flat(Infinity).filter((c) => c != null && c !== false)\n }\n return [children]\n}\n\n/**\n * JSX automatic runtime function.\n * Used by the JSX transformer when jsxImportSource is set.\n * Children are passed as part of props.children.\n */\nexport function jsx(\n type: string | typeof Fragment | ComponentType,\n props: Record<string, unknown> | null,\n): XmlNode | AsyncXmlNode | ClassComponentNode {\n const { children, ...restProps } = props ?? {}\n const flatChildren = flattenChildren(children)\n\n // Handle class components - create ClassComponentNode for later resolution\n if (isComponentClass(type)) {\n return {\n type: ClassComponent,\n componentClass: type,\n props: { ...restProps, children: flatChildren },\n }\n }\n\n // Handle function components (sync or async)\n if (typeof type === 'function') {\n const result = type({ ...restProps, children: flatChildren })\n\n // If component returns a Promise, wrap it in AsyncXmlNode\n if (result instanceof Promise) {\n return {\n type: AsyncComponent,\n promise: result,\n }\n }\n\n return result\n }\n\n return {\n type,\n props: restProps,\n children: flatChildren,\n }\n}\n\n/**\n * JSX automatic runtime function for static children.\n * Identical to jsx() for XML - React uses this for optimization hints.\n */\nexport const jsxs = jsx\n\n/**\n * Classic createElement for manual usage.\n * Children are passed as rest arguments.\n */\nexport function createElement(\n type: string | typeof Fragment | ComponentType,\n props: Record<string, unknown> | null,\n ...children: any[]\n): XmlNode | AsyncXmlNode | ClassComponentNode {\n const flatChildren = flattenChildren(children)\n\n // Handle class components - create ClassComponentNode for later resolution\n if (isComponentClass(type)) {\n return {\n type: ClassComponent,\n componentClass: type,\n props: { ...props, children: flatChildren },\n }\n }\n\n // Handle function components (sync or async)\n if (typeof type === 'function') {\n const result = type({ ...props, children: flatChildren })\n\n // If component returns a Promise, wrap it in AsyncXmlNode\n if (result instanceof Promise) {\n return {\n type: AsyncComponent,\n promise: result,\n }\n }\n\n return result\n }\n\n return {\n type,\n props: props ?? {},\n children: flatChildren,\n }\n}\n\nexport { Fragment }\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"jsx-runtime.mjs"}
package/lib/jsx.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/lib/jsx.js DELETED
@@ -1,4 +0,0 @@
1
- 'use strict';
2
-
3
- //# sourceMappingURL=jsx.js.map
4
- //# sourceMappingURL=jsx.js.map