Fix bin/publish: use correct .env path for rspade_system Fix bin/publish script: prevent grep exit code 1 from terminating script 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
46 lines
1.7 KiB
JavaScript
Executable File
46 lines
1.7 KiB
JavaScript
Executable File
/**
|
|
* JQHTML Webpack Loader
|
|
*
|
|
* Enables importing .jqhtml files in webpack projects:
|
|
*
|
|
* import UserCard from './UserCard.jqhtml';
|
|
*
|
|
* The loader:
|
|
* 1. Uses unified compiler from @jqhtml/parser
|
|
* 2. Generates ES module code that exports components
|
|
* 3. Supports source maps for debugging
|
|
*/
|
|
import { compileTemplate } from '@jqhtml/parser';
|
|
export default function jqhtmlLoader(source) {
|
|
console.log(`[JQHTML Loader] Started processing: ${this.resourcePath}`);
|
|
const callback = this.async();
|
|
if (!callback) {
|
|
throw new Error('JQHTML loader requires async mode');
|
|
}
|
|
try {
|
|
// Use unified compiler
|
|
console.log(`[JQHTML Loader] Compiling ${this.resourcePath}...`);
|
|
const compiled = compileTemplate(source, this.resourcePath, {
|
|
format: 'esm',
|
|
sourcemap: this.sourceMap,
|
|
version: undefined // Will use package.json version automatically
|
|
});
|
|
const { code, componentName } = compiled;
|
|
console.log(`[JQHTML Loader] Compiled component: ${componentName}`);
|
|
// For webpack loader, we use the ESM format directly from compiler
|
|
const moduleCode = code;
|
|
// Return the generated code (sourcemap is inline if enabled)
|
|
console.log(`[JQHTML Loader] Finished processing ${this.resourcePath}`);
|
|
callback(null, moduleCode);
|
|
}
|
|
catch (error) {
|
|
// Enhanced error reporting with file context
|
|
if (error instanceof Error) {
|
|
error.message = `JQHTML compilation failed in ${this.resourcePath}:\n${error.message}`;
|
|
}
|
|
callback(error);
|
|
}
|
|
}
|
|
// Webpack loader interface
|
|
export const raw = false; // Process source as UTF-8 string
|
|
//# sourceMappingURL=index.js.map
|