Files
rspade_system/node_modules/@jqhtml/webpack-loader/dist/index.js
root 78553d4edf Fix code quality violations for publish
Remove unused blade settings pages not linked from UI
Convert remaining frontend pages to SPA actions
Convert settings user_settings and general to SPA actions
Convert settings profile pages to SPA actions
Convert contacts and projects add/edit pages to SPA actions
Convert clients add/edit page to SPA action with loading pattern
Refactor component scoped IDs from $id to $sid
Fix jqhtml comment syntax and implement universal error component system
Update all application code to use new unified error system
Remove all backwards compatibility - unified error system complete
Phase 5: Remove old response classes
Phase 3-4: Ajax response handler sends new format, old helpers deprecated
Phase 2: Add client-side unified error foundation
Phase 1: Add server-side unified error foundation
Add unified Ajax error response system with constants

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 04:35:01 +00:00

46 lines
1.7 KiB
JavaScript

/**
* 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