@navios/adapter-xml 0.7.1 → 0.9.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,30 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.9.0] - 2025-12-23
9
+
10
+ ### Dependencies
11
+
12
+ - Updated to support `@navios/core` ^0.9.0
13
+ - Updated to support `@navios/di` ^0.9.0
14
+
15
+ ## [0.8.0] - 2025-12-21
16
+
17
+ ### Added
18
+
19
+ - **Static/Dynamic Handler Branching**: New handler result types for optimized request handling
20
+ - Always returns dynamic handler due to `renderToXml` requiring ScopedContainer
21
+ - Aligns with `@navios/core` 0.8.0 `HandlerResult` interface
22
+
23
+ ### Changed
24
+
25
+ - **Handler Result Types**: `provideHandler()` now returns `Promise<HandlerResult>` instead of direct handler function
26
+ - **Build Tooling**: Switched from `esbuild` to `@swc/core` for transpilation (bun-plugin)
27
+
28
+ ### Dependencies
29
+
30
+ - Requires `@navios/core` ^0.8.0
31
+
8
32
  ## [0.7.1] - 2025-12-20
9
33
 
10
34
  ### Fixed
package/README.md CHANGED
@@ -49,15 +49,8 @@ import { NaviosFactory } from '@navios/core'
49
49
  import { AppModule } from './app.module.mjs'
50
50
 
51
51
  async function bootstrap() {
52
- const fastifyEnv = defineFastifyEnvironment()
53
- const xmlEnv = defineXmlEnvironment()
54
-
55
- const mergedEnv = {
56
- httpTokens: new Map([...fastifyEnv.httpTokens, ...xmlEnv.httpTokens]),
57
- }
58
-
59
52
  const app = await NaviosFactory.create(AppModule, {
60
- adapter: mergedEnv,
53
+ adapter: [defineFastifyEnvironment(), defineXmlEnvironment()],
61
54
  })
62
55
 
63
56
  await app.init()
@@ -271,7 +264,7 @@ class LatestPostsComponent implements XmlComponent {
271
264
  }
272
265
 
273
266
  // Usage in JSX
274
- <channel>
267
+ ;<channel>
275
268
  <LatestPostsComponent />
276
269
  </channel>
277
270
  ```
@@ -305,10 +298,7 @@ class DescriptionComponent implements XmlComponent {
305
298
  }
306
299
 
307
300
  // Usage with typed props
308
- <DescriptionComponent
309
- content="<p>HTML content here</p>"
310
- wrapInCData={true}
311
- />
301
+ ;<DescriptionComponent content="<p>HTML content here</p>" wrapInCData={true} />
312
302
  ```
313
303
 
314
304
  #### Rendering with Container
package/bun-plugin.mts CHANGED
@@ -114,18 +114,29 @@ async function transpileFileForReal(
114
114
  codeTS: string,
115
115
  ): Promise<string> {
116
116
  // Use esbuild with JSX support
117
- const esbuild = (await import('esbuild')).default
117
+ const esbuild = (await import('@swc/core')).default
118
118
 
119
119
  // Determine loader based on file extension and content
120
- const hasJsx =
121
- codeTS.includes('<') && (codeTS.includes('/>') || codeTS.includes('</'))
122
- const loader = hasJsx ? 'tsx' : 'ts'
123
120
 
124
121
  const result = await esbuild.transform(codeTS, {
125
- loader,
126
- target: 'chrome110',
127
- jsx: 'automatic',
128
- jsxImportSource: '@navios/adapter-xml',
122
+ filename: name,
123
+ jsc: {
124
+ target: 'es2022',
125
+ parser: {
126
+ syntax: 'typescript',
127
+ decorators: true,
128
+ tsx: name.endsWith('.tsx'),
129
+ },
130
+ transform: {
131
+ decoratorVersion: '2022-03',
132
+ react: name.endsWith('.tsx')
133
+ ? {
134
+ importSource: '@navios/adapter-xml',
135
+ runtime: 'automatic',
136
+ }
137
+ : undefined,
138
+ },
139
+ },
129
140
  })
130
141
  return result.code
131
142
  }