Fix package by testing real world examples

This commit is contained in:
Chris Daßler
2025-08-29 07:41:29 +02:00
parent 7d1935dde5
commit 6ad6538b68
8 changed files with 6393 additions and 26 deletions

View File

@@ -23,13 +23,16 @@ npm install @metatrom/ior-resolver
```
@metatrom/ior-resolver/
├── bin/ # Executable scripts
├── bin/ # Compiled executable scripts
│ ├── prebuild-ior-types.js # Pre-build script for type generation
│ └── NodeImportLoader.ts # Node.js loader implementation
│ └── NodeImportLoader.js # Compiled Node.js loader
├── lib/ # Core library files
│ ├── ior-core.js # Shared core functions
│ ├── metro-ior-resolver.js # Metro resolver implementation
│ └── fetch-remote-component.js # Remote fetching utility
├── src/ # Source files
│ └── loaders/
│ └── NodeImportLoader.ts # Node.js loader TypeScript source
├── index.js # Main entry point
├── index.d.ts # TypeScript definitions
└── package.json
@@ -224,9 +227,9 @@ The package is designed with a shared core architecture:
1. **ior-core.js** - Contains all shared functionality for parsing, fetching, and caching
2. **metro-ior-resolver.js** - Metro-specific implementation using the shared core
3. **NodeImportLoader.ts** - Node.js-specific implementation using the shared core
3. **NodeImportLoader.ts** - Node.js-specific implementation using the shared core (TypeScript source compiled to JavaScript)
This design eliminates code duplication and ensures consistency across different environments.
This design eliminates code duplication and ensures consistency across different environments. The Node.js loader is written in TypeScript and compiled to JavaScript during the build process.
## Migration from Direct Implementation
@@ -331,7 +334,10 @@ Contributions are welcome! Please feel free to submit a Pull Request.
1. Clone the repository
2. Install dependencies: `npm install`
3. Build TypeScript: `npm run build`
4. Run tests: `npm test`
4. Build Node.js loader: `npm run build:loader`
5. Run tests: `npm test`
Note: The `prepublishOnly` script automatically runs both build commands before publishing.
### Code Structure