@intrig/core 0.0.15-24 → 0.0.15-25

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.
Files changed (2) hide show
  1. package/main.js +68 -20
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -81,6 +81,8 @@ var src = __webpack_require__(1);
81
81
  var common = __webpack_require__(3);
82
82
  // EXTERNAL MODULE: ../../node_modules/cross-spawn/index.js
83
83
  var cross_spawn = __webpack_require__(1309);
84
+ // EXTERNAL MODULE: external "child_process"
85
+ var external_child_process_ = __webpack_require__(1020);
84
86
  // EXTERNAL MODULE: ../../node_modules/@nestjs/config/index.js
85
87
  var config = __webpack_require__(1322);
86
88
  // EXTERNAL MODULE: external "fs"
@@ -251,6 +253,7 @@ function process_manager_service_ts_metadata(k, v) {
251
253
 
252
254
 
253
255
 
256
+
254
257
  class ProcessManagerService {
255
258
  constructor(discovery, config){
256
259
  this.discovery = discovery;
@@ -272,6 +275,28 @@ class ProcessManagerService {
272
275
  child.unref();
273
276
  this.logger.log(`Spawned daemon (pid=${child.pid})`);
274
277
  }
278
+ /**
279
+ * Start the daemon in foreground mode with verbose logging.
280
+ * This blocks until the process exits or is interrupted.
281
+ */ async startForeground() {
282
+ if (await this.discovery.isRunning()) {
283
+ this.logger.log('Daemon already running (via discovery)');
284
+ return;
285
+ }
286
+ const result = (0,external_child_process_.spawnSync)('intrig', [
287
+ "run"
288
+ ], {
289
+ stdio: 'inherit',
290
+ cwd: this.config.get('rootDir') ?? process.cwd()
291
+ });
292
+ if (result.error) {
293
+ this.logger.error('Failed to start daemon:', result.error);
294
+ throw result.error;
295
+ }
296
+ if (result.status !== 0) {
297
+ this.logger.error(`Daemon exited with code ${result.status}`);
298
+ }
299
+ }
275
300
  async stop() {
276
301
  const meta = this.discovery.getMetadata();
277
302
  if (!meta) {
@@ -334,17 +359,35 @@ class UpSubCommand extends src.CommandRunner {
334
359
  constructor(pm){
335
360
  super(), this.pm = pm;
336
361
  }
337
- async run() {
362
+ parseVerbose() {
363
+ return true;
364
+ }
365
+ async run(passedParams, options) {
338
366
  const isRunning = await this.pm.isRunning();
339
367
  if (isRunning) {
340
368
  console.log('✓ Daemon is already running');
341
369
  return;
342
370
  }
343
- console.log('Starting daemon...');
344
- await this.pm.start();
345
- console.log(' Daemon started successfully');
371
+ if (options?.verbose) {
372
+ console.log('Starting daemon in verbose mode (foreground)...');
373
+ console.log('Press Ctrl+C to stop the daemon.\n');
374
+ await this.pm.startForeground();
375
+ } else {
376
+ console.log('Starting daemon...');
377
+ await this.pm.start();
378
+ console.log('✓ Daemon started successfully');
379
+ }
346
380
  }
347
381
  }
382
+ daemon_command_ts_decorate([
383
+ (0,src.Option)({
384
+ flags: '-v, --verbose',
385
+ description: 'Run daemon in foreground with verbose logging'
386
+ }),
387
+ daemon_command_ts_metadata("design:type", Function),
388
+ daemon_command_ts_metadata("design:paramtypes", []),
389
+ daemon_command_ts_metadata("design:returntype", Boolean)
390
+ ], UpSubCommand.prototype, "parseVerbose", null);
348
391
  UpSubCommand = daemon_command_ts_decorate([
349
392
  (0,src.SubCommand)({
350
393
  name: 'up',
@@ -2221,8 +2264,6 @@ SourceManagementService = source_management_service_ts_decorate([
2221
2264
 
2222
2265
  // EXTERNAL MODULE: external "util"
2223
2266
  var external_util_ = __webpack_require__(73);
2224
- // EXTERNAL MODULE: external "child_process"
2225
- var external_child_process_ = __webpack_require__(1020);
2226
2267
  ;// ../../lib/common/src/lib/package-manager.service.ts
2227
2268
  function package_manager_service_ts_decorate(decorators, target, key, desc) {
2228
2269
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -11205,6 +11246,10 @@ function lazy_plugin_service_ts_metadata(k, v) {
11205
11246
 
11206
11247
 
11207
11248
 
11249
+ // Dynamic import that bypasses webpack transformation
11250
+ // This is necessary because webpack transforms import() into __webpack_require__()
11251
+ // which can't handle truly external modules from user's node_modules
11252
+ const dynamicImport = new Function('modulePath', 'return import(modulePath)');
11208
11253
  class LazyPluginService {
11209
11254
  constructor(configService){
11210
11255
  this.configService = configService;
@@ -11275,22 +11320,23 @@ class LazyPluginService {
11275
11320
  const isFileDependency = this.isFileBasedDependency(pluginVersion);
11276
11321
  this.logger.debug(`Plugin is file-based: ${isFileDependency}`);
11277
11322
  try {
11278
- // Create a require function from the current module
11279
- const { createRequire: nodeCreateRequire } = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 1645, 23));
11280
- const projectRequire = nodeCreateRequire(external_node_path_.resolve(rootDir, 'package.json'));
11281
- this.logger.debug(`Attempting to load plugin using createRequire: ${this.pluginName}`);
11323
+ this.logger.debug(`Attempting to load plugin: ${this.pluginName}`);
11282
11324
  let mod;
11283
11325
  if (isFileDependency) {
11284
- // For file-based dependencies, require from the resolved path
11326
+ // For file-based dependencies, import from the resolved path
11285
11327
  const pluginPath = this.resolvePluginPath(rootDir, pluginVersion);
11286
- this.logger.debug(`Requiring from file path: ${pluginPath}`);
11287
- mod = projectRequire(pluginPath);
11328
+ this.logger.debug(`Importing from file path: ${pluginPath}`);
11329
+ mod = await dynamicImport(pluginPath);
11288
11330
  } else {
11289
- // For npm-based dependencies, require by name (assumes already installed)
11290
- this.logger.debug(`Requiring npm package: ${this.pluginName}`);
11291
- mod = projectRequire(this.pluginName);
11292
- }
11293
- this.logger.debug(`Module require succeeded`);
11331
+ // For npm-based dependencies, resolve the path first then import
11332
+ // This ensures we load from the project's node_modules, not the daemon's
11333
+ const { createRequire: nodeCreateRequire } = await dynamicImport('node:module');
11334
+ const projectRequire = nodeCreateRequire(external_node_path_.resolve(rootDir, 'package.json'));
11335
+ const resolvedPath = projectRequire.resolve(this.pluginName);
11336
+ this.logger.debug(`Importing npm package from resolved path: ${resolvedPath}`);
11337
+ mod = await dynamicImport(resolvedPath);
11338
+ }
11339
+ this.logger.debug(`Module import succeeded`);
11294
11340
  const factory = this.extractFactory(mod, this.pluginName);
11295
11341
  this.pluginInstance = await Promise.resolve(factory());
11296
11342
  // Validate plugin instance
@@ -11522,8 +11568,10 @@ class OperationsService {
11522
11568
  ...targetPackage.devDependencies,
11523
11569
  ...sourcePackage.devDependencies
11524
11570
  },
11525
- exports: sourcePackage.exports ?? targetPackage.exports,
11526
- typesVersions: sourcePackage.typesVersions ?? targetPackage.typesVersions
11571
+ // Keep original plugin exports (pointing to dist/) - don't override with generated exports
11572
+ // The generated SDK code goes to src/ but the plugin entry point must remain dist/
11573
+ exports: targetPackage.exports,
11574
+ typesVersions: targetPackage.typesVersions
11527
11575
  };
11528
11576
  await lib.writeJson(targetFile, merged, {
11529
11577
  spaces: 2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intrig/core",
3
- "version": "0.0.15-24",
3
+ "version": "0.0.15-25",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {