-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sebastian Schürmann
committed
Jan 2, 2025
1 parent
090e82c
commit 7caf8f6
Showing
1 changed file
with
8 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,14 @@ | ||
# banira | ||
|
||
The core library of the banira.js toolchain, providing essential utilities and runtime support for developing web components using vanilla JavaScript. | ||
The core library of the banira toolchain, providing essential utilities and runtime support for developing web components using vanilla JavaScript. | ||
|
||
## Classes | ||
|
||
### Compiler | ||
The core TypeScript compilation engine that supports both standard and virtual filesystem operations. It provides: | ||
- Flexible compilation with customizable compiler options | ||
- Support for virtual filesystem compilation | ||
- Built-in transformers for ES module compatibility | ||
- Default configuration targeting modern browsers | ||
|
||
### TestHelper | ||
A powerful testing utility for web components that provides: | ||
- JSDOM-based testing environment | ||
- Component mounting and initialization | ||
- Support for both pre-compiled and TypeScript components | ||
- Customizable JSDOM options for specific testing needs | ||
|
||
### ResultAnalyzer | ||
Analyzes compilation results and provides detailed diagnostics: | ||
- Error and warning categorization | ||
- Formatted diagnostic messages | ||
- Access to compiler output files | ||
- Source file analysis capabilities | ||
|
||
### VirtualCompilerHost | ||
A TypeScript compiler host implementation using a virtual filesystem: | ||
- In-memory file operations | ||
- Isolation for testing and development | ||
- Compatible with standard TypeScript compiler API | ||
- Configurable working directory and file structure | ||
|
||
## Usage | ||
|
||
### Testing Components | ||
|
||
```typescript | ||
import { TestHelper } from 'banira'; | ||
|
||
const helper = new TestHelper(); | ||
const context = await helper.mountAsScript('my-component', componentCode); | ||
|
||
// Access the mounted component | ||
const component = context.querySelector('my-component'); | ||
``` | ||
 | ||
|
||
### Virtual Filesystem | ||
|
||
```typescript | ||
import { createVirtualFs } from 'banira'; | ||
|
||
const fs = createVirtualFs({ | ||
'/src/component.ts': ` | ||
class MyComponent extends HTMLElement { | ||
// component code | ||
} | ||
` | ||
}); | ||
``` | ||
|
||
## API Reference | ||
|
||
For detailed API documentation, please refer to the generated API documentation in the project root. | ||
|
||
## Dependencies | ||
|
||
- jsdom: ^25.0.1 | ||
- memfs: ^4.15.1 | ||
- typescript: ^5.7.2 | ||
|
||
## Contributing | ||
|
||
This package is part of the banira.js monorepo. Please refer to the main project's README for contribution guidelines. | ||
## Classes | ||
|
||
## License | ||
| Class | Description | | ||
|----|----| | ||
| Compiler | Uses tsc to compile TypeScript files to Javascript | | ||
| TestHelper | Helper class for testing web components in a JSDOM environment | | ||
| DocGen | Generates html documentation for Webcomponents based on @example tags | | ||
|
||
MIT © Sebastian Schürmann |