@majkapp/plugin-kit 1.0.0 → 1.0.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-kit.d.ts","sourceRoot":"","sources":["../src/plugin-kit.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAGb,eAAe,EACf,QAAQ,EACR,WAAW,EACX,WAAW,EACX,QAAQ,EACR,WAAW,EACX,UAAU,EACV,eAAe,EACf,WAAW,EACX,KAAK,EACL,UAAU,EACV,SAAS,EACT,aAAa,EAId,MAAM,SAAS,CAAC;AAyiBjB;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,EAAE,SAAS,MAAM;IAC9C,mDAAmD;IACnD,MAAM,CAAC,KAAK,EAAE,mBAAmB,EAAE,IAAI,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAE7G,0CAA0C;IAC1C,EAAE,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAE5B,yBAAyB;IACzB,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IAE3C,yBAAyB;IACzB,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IAEzC,uBAAuB;IACvB,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAEnC,iBAAiB;IACjB,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAE/D,iDAAiD;IACjD,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI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 Base URL: ${context.http.baseUrl}`);
250
250
  context.logger.info('═══════════════════════════════════════════════════════');
251
+ // Validate file paths now that we have pluginRoot context
252
+ if (this.reactScreens.length > 0 && this.uiConfig) {
253
+ const indexPath = path_1.default.join(context.pluginRoot, this.uiConfig.appDir || '', 'index.html');
254
+ if (!fs_1.default.existsSync(indexPath)) {
255
+ throw new PluginRuntimeError(`React app not built: ${indexPath} does not exist. Run "npm run build" in your UI directory to build the React app.`, 'onLoad', { appDir: this.uiConfig.appDir, indexPath, pluginRoot: context.pluginRoot });
256
+ }
257
+ context.logger.info(`✅ React UI found at: ${indexPath}`);
258
+ }
259
+ // Validate HTML screen files
260
+ for (const screen of this.htmlScreens) {
261
+ if ('htmlFile' in screen) {
262
+ const filePath = path_1.default.join(context.pluginRoot, screen.htmlFile);
263
+ if (!fs_1.default.existsSync(filePath)) {
264
+ throw new PluginRuntimeError(`HTML screen file not found: ${screen.htmlFile}. Create the HTML file at ${filePath} or fix the path.`, 'onLoad', { screen: screen.id, file: screen.htmlFile, resolvedPath: filePath, pluginRoot: context.pluginRoot });
265
+ }
266
+ context.logger.info(`✅ HTML screen file found: ${screen.htmlFile}`);
267
+ }
268
+ }
251
269
  try {
252
270
  await this.startServer();
253
271
  // Register API routes
@@ -590,22 +608,7 @@ function definePlugin(id, name, version) {
590
608
  if (_reactScreens.length > 0 && !_uiConfigured) {
591
609
  throw new PluginBuildError('UI not configured but React screens were added', 'Call .ui() before adding React screens', { reactScreens: _reactScreens.map(s => s.id) });
592
610
  }
593
- // Validate React dist exists
594
- if (_reactScreens.length > 0) {
595
- const indexPath = path_1.default.join(process.cwd(), _ui.appDir, 'index.html');
596
- if (!fs_1.default.existsSync(indexPath)) {
597
- throw new PluginBuildError(`React app not built: ${indexPath} does not exist`, `Run "npm run build" in your UI directory to build the React app`, { appDir: _ui.appDir, indexPath });
598
- }
599
- }
600
- // Validate HTML screen files
601
- for (const screen of _htmlScreens) {
602
- if ('htmlFile' in screen) {
603
- const filePath = path_1.default.join(process.cwd(), screen.htmlFile);
604
- if (!fs_1.default.existsSync(filePath)) {
605
- throw new PluginBuildError(`HTML screen file not found: ${screen.htmlFile}`, `Create the HTML file at ${filePath} or fix the path`, { screen: screen.id, file: screen.htmlFile });
606
- }
607
- }
608
- }
611
+ // Note: File existence validation deferred to onLoad when we have pluginRoot context
609
612
  // Validate screen routes
610
613
  const screenRoutes = new Set();
611
614
  for (const screen of [..._reactScreens, ..._htmlScreens]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@majkapp/plugin-kit",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Fluent builder framework for creating robust MAJK plugins",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",