@wordpress-flow/cli 1.1.1 → 1.1.3

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/dist/index.js +254 -90
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -85232,7 +85232,7 @@ class DatabaseClient {
85232
85232
  if (post.tags) {
85233
85233
  await this.updatePostTerms(id, post.tags, "post_tag");
85234
85234
  }
85235
- logger.success(`Post ${id} updated successfully in database`);
85235
+ logger.debug(`Post ${id} updated in database`);
85236
85236
  const updatedPost = await this.getPost(id);
85237
85237
  if (!updatedPost) {
85238
85238
  throw new Error(`Failed to retrieve updated post ${id}`);
@@ -112942,11 +112942,9 @@ class OfficialMDXRenderer {
112942
112942
  createComponents() {
112943
112943
  const components = {};
112944
112944
  for (const [name2, component] of this.componentMap.entries()) {
112945
- logger.info(`[DEBUG] Processing component: ${name2}, type: ${typeof component}`);
112946
112945
  const parts = name2.split(".");
112947
112946
  const componentName = parts.length === 2 ? parts[1] : name2;
112948
112947
  components[componentName] = component;
112949
- logger.info(`[DEBUG] Added component: ${componentName} (from ${name2})`);
112950
112948
  }
112951
112949
  return components;
112952
112950
  }
@@ -112966,26 +112964,66 @@ class OfficialMDXRenderer {
112966
112964
  }
112967
112965
  logger.debug("React tree created successfully, starting SSR rendering...");
112968
112966
  let html5;
112967
+ const originalConsoleError = console.error;
112968
+ const suppressedWarnings = [];
112969
+ console.error = (...args) => {
112970
+ const msg = args[0]?.toString() || "";
112971
+ if (msg.includes("React.jsx: type is invalid") || msg.includes("Warning:")) {
112972
+ suppressedWarnings.push(msg);
112973
+ return;
112974
+ }
112975
+ originalConsoleError.apply(console, args);
112976
+ };
112969
112977
  try {
112970
112978
  html5 = $renderToString(reactTree);
112971
112979
  logger.debug("React SSR rendering completed successfully");
112972
112980
  } catch (ssrError) {
112973
- logger.error("React SSR rendering failed:", ssrError);
112974
- logger.error("SSR Error details:");
112975
- logger.error(` Message: ${ssrError.message}`);
112976
- logger.error(` Stack: ${ssrError.stack}`);
112977
- logger.error(` Component type: ${typeof MDXComponent}`);
112978
- logger.error(` Has components: ${!!components}`);
112979
- logger.error(` Component keys: ${Object.keys(components).join(", ")}`);
112980
- throw new Error(`React SSR failed: ${ssrError.message}`);
112981
+ const errorMsg = ssrError.message;
112982
+ if (errorMsg.includes("Element type is invalid") && errorMsg.includes("undefined")) {
112983
+ const availableComponents = Object.keys(components);
112984
+ const helpMsg = this.createUndefinedComponentError(mdxContent, availableComponents, suppressedWarnings);
112985
+ throw new Error(helpMsg);
112986
+ }
112987
+ throw new Error(`SSR render failed: ${errorMsg}`);
112988
+ } finally {
112989
+ console.error = originalConsoleError;
112981
112990
  }
112982
112991
  logger.debug(`Official MDX rendering completed, HTML length: ${html5.length}`);
112983
112992
  return html5;
112984
112993
  } catch (error) {
112985
- logger.error("Failed to render MDX to HTML:", error);
112986
- throw new Error(`MDX to HTML conversion failed: ${error.message}`);
112994
+ const msg = error.message;
112995
+ if (msg.startsWith("Missing component") || msg.startsWith("A component returned") || msg.startsWith("SSR render failed")) {
112996
+ throw error;
112997
+ }
112998
+ throw new Error(`MDX render failed: ${msg}`);
112987
112999
  }
112988
113000
  }
113001
+ createUndefinedComponentError(mdxContent, availableComponents, suppressedWarnings = []) {
113002
+ for (const warning of suppressedWarnings) {
113003
+ if (warning.includes("Check the render method of")) {
113004
+ const match3 = warning.match(/Check the render method of `(\w+)`/);
113005
+ if (match3) {
113006
+ return `Component "${match3[1]}" uses an undefined component. Check its imports and child components.`;
113007
+ }
113008
+ }
113009
+ }
113010
+ const componentPattern = /<([A-Z][a-zA-Z0-9]*)/g;
113011
+ const usedComponents = new Set;
113012
+ let match2;
113013
+ while ((match2 = componentPattern.exec(mdxContent)) !== null) {
113014
+ usedComponents.add(match2[1]);
113015
+ }
113016
+ const missingComponents = [];
113017
+ for (const comp of usedComponents) {
113018
+ if (!availableComponents.includes(comp)) {
113019
+ missingComponents.push(comp);
113020
+ }
113021
+ }
113022
+ if (missingComponents.length > 0) {
113023
+ return `Missing component(s): ${missingComponents.join(", ")}. Not built or not exported.`;
113024
+ }
113025
+ return `A block component uses an undefined import. Check that all imports in your block files exist and are exported correctly.`;
113026
+ }
112989
113027
  postProcessHTML(html5) {
112990
113028
  return html5.replace(/<wp-block-comment[^>]*>([\s\S]*?)<\/wp-block-comment>/g, "$1");
112991
113029
  }
@@ -112997,8 +113035,7 @@ class OfficialMDXRenderer {
112997
113035
  logger.debug("Official MDX to Gutenberg conversion completed");
112998
113036
  return cleanHTML;
112999
113037
  } catch (error) {
113000
- logger.error("Failed to convert MDX to Gutenberg:", error);
113001
- throw new Error(`MDX to Gutenberg conversion failed: ${error.message}`);
113038
+ throw error;
113002
113039
  }
113003
113040
  }
113004
113041
  }
@@ -113032,14 +113069,7 @@ class BlockRenderer {
113032
113069
  logger.debug("MDX content to HTML rendering completed");
113033
113070
  return html5;
113034
113071
  } catch (error) {
113035
- logger.error("Failed to render MDX content to HTML:", error);
113036
- logger.error("Error message:", error.message);
113037
- logger.error("Error name:", error.name);
113038
- if (error.stack) {
113039
- logger.error("Error stack trace:");
113040
- console.error(error.stack);
113041
- }
113042
- throw new Error(`Official MDX rendering failed: ${error.message}`);
113072
+ throw error;
113043
113073
  }
113044
113074
  }
113045
113075
  }
@@ -113377,6 +113407,67 @@ class PushCommand {
113377
113407
  }
113378
113408
  return result2;
113379
113409
  }
113410
+ async executeQuiet(options) {
113411
+ try {
113412
+ await this.blockRegistry.loadBuiltBlocks();
113413
+ } catch {}
113414
+ const config2 = this.configManager.getConfig();
113415
+ const connection = await this.connectionManager.createConnection(config2.wordpress);
113416
+ const result2 = {
113417
+ success: false,
113418
+ operation: {
113419
+ type: "push",
113420
+ source: {
113421
+ type: "local",
113422
+ identifier: "multiple",
113423
+ lastModified: new Date
113424
+ },
113425
+ target: {
113426
+ type: "wordpress",
113427
+ identifier: config2.wordpress.wordpressUrl,
113428
+ lastModified: new Date
113429
+ },
113430
+ timestamp: new Date,
113431
+ status: "in-progress"
113432
+ },
113433
+ filesProcessed: 0,
113434
+ errors: [],
113435
+ conflicts: []
113436
+ };
113437
+ try {
113438
+ const mdxFiles = await this.findMDXFiles(options.files, config2.paths.mdxOutputDir);
113439
+ if (mdxFiles.length === 0) {
113440
+ result2.operation.status = "completed";
113441
+ result2.success = true;
113442
+ return result2;
113443
+ }
113444
+ for (const filePath2 of mdxFiles) {
113445
+ try {
113446
+ await this.processFileQuiet(filePath2, options, connection, result2);
113447
+ result2.filesProcessed++;
113448
+ } catch (error) {
113449
+ result2.errors.push({
113450
+ source: filePath2,
113451
+ error: error.message,
113452
+ recoverable: true
113453
+ });
113454
+ }
113455
+ }
113456
+ result2.operation.status = "completed";
113457
+ result2.success = result2.errors.length === 0 || result2.errors.every((e) => e.recoverable);
113458
+ } catch (error) {
113459
+ result2.operation.status = "failed";
113460
+ result2.errors.push({
113461
+ source: "Push operation",
113462
+ error: error.message,
113463
+ recoverable: false
113464
+ });
113465
+ throw error;
113466
+ } finally {
113467
+ await this.connectionManager.closeConnection();
113468
+ }
113469
+ return result2;
113470
+ }
113380
113471
  async findMDXFiles(specifiedFiles, baseDir) {
113381
113472
  if (specifiedFiles && specifiedFiles.length > 0) {
113382
113473
  return specifiedFiles.map((file) => path6.resolve(file));
@@ -113436,12 +113527,48 @@ ${"=".repeat(80)}`);
113436
113527
  if (isUpdate) {
113437
113528
  updatedPost = await connection.updatePost(mdxFile.frontmatter.postId, postData);
113438
113529
  logger.debug(`Updated post: ${updatedPost.title.rendered} (ID: ${updatedPost.id})`);
113530
+ await this.updateMDXAfterPush(filePath2, updatedPost);
113439
113531
  } else {
113440
113532
  updatedPost = await connection.createPost(postData);
113441
113533
  logger.info(`Created new post: ${updatedPost.title.rendered} (ID: ${updatedPost.id})`);
113442
- await this.updateMDXWithPostId(filePath2, updatedPost.id);
113534
+ await this.updateMDXAfterPush(filePath2, updatedPost);
113443
113535
  }
113444
113536
  }
113537
+ async processFileQuiet(filePath2, options, connection, result2) {
113538
+ const mdxFile = await this.parseFile(filePath2);
113539
+ const isUpdate = !!mdxFile.frontmatter.postId;
113540
+ if (isUpdate && !options.force) {
113541
+ const conflict = await this.checkForConflicts(mdxFile, connection);
113542
+ if (conflict) {
113543
+ result2.conflicts.push(conflict);
113544
+ return;
113545
+ }
113546
+ }
113547
+ if (options.dryRun) {
113548
+ return;
113549
+ }
113550
+ const htmlContent = await this.getBlockRenderer().renderMDXContentToHTML(mdxFile.content);
113551
+ const pathParts = filePath2.split(path6.sep);
113552
+ const postType = pathParts[pathParts.length - 2];
113553
+ const postData = {
113554
+ title: { raw: mdxFile.frontmatter.title },
113555
+ content: { raw: htmlContent },
113556
+ excerpt: mdxFile.frontmatter.excerpt ? { raw: mdxFile.frontmatter.excerpt } : undefined,
113557
+ status: mdxFile.frontmatter.status,
113558
+ type: postType,
113559
+ slug: mdxFile.frontmatter.slug,
113560
+ categories: mdxFile.frontmatter.categories,
113561
+ tags: mdxFile.frontmatter.tags,
113562
+ meta: mdxFile.frontmatter.meta
113563
+ };
113564
+ let updatedPost;
113565
+ if (isUpdate) {
113566
+ updatedPost = await connection.updatePost(mdxFile.frontmatter.postId, postData);
113567
+ } else {
113568
+ updatedPost = await connection.createPost(postData);
113569
+ }
113570
+ await this.updateMDXAfterPush(filePath2, updatedPost);
113571
+ }
113445
113572
  async checkForConflicts(mdxFile, connection) {
113446
113573
  if (!mdxFile.frontmatter.postId) {
113447
113574
  return null;
@@ -113458,15 +113585,18 @@ ${"=".repeat(80)}`);
113458
113585
  };
113459
113586
  }
113460
113587
  const wpModified = new Date(wpPost.modified);
113461
- const localModified = mdxFile.frontmatter.modified ? new Date(mdxFile.frontmatter.modified) : new Date;
113462
- if (wpModified > localModified) {
113463
- return {
113464
- postId: mdxFile.frontmatter.postId,
113465
- localPath: mdxFile.path,
113466
- wordpressPost: wpPost,
113467
- localFile: mdxFile,
113468
- conflictType: "wordpress-newer"
113469
- };
113588
+ const lastPushed = mdxFile.frontmatter.lastPushed ? new Date(mdxFile.frontmatter.lastPushed) : null;
113589
+ if (lastPushed && wpModified > lastPushed) {
113590
+ const tolerance = 5000;
113591
+ if (wpModified.getTime() - lastPushed.getTime() > tolerance) {
113592
+ return {
113593
+ postId: mdxFile.frontmatter.postId,
113594
+ localPath: mdxFile.path,
113595
+ wordpressPost: wpPost,
113596
+ localFile: mdxFile,
113597
+ conflictType: "wordpress-newer"
113598
+ };
113599
+ }
113470
113600
  }
113471
113601
  return null;
113472
113602
  } catch (error) {
@@ -113490,22 +113620,43 @@ ${"=".repeat(80)}`);
113490
113620
  }
113491
113621
  }
113492
113622
  }
113493
- async updateMDXWithPostId(filePath2, postId) {
113623
+ async updateMDXAfterPush(filePath2, wpPost) {
113494
113624
  try {
113495
113625
  const content4 = fs5.readFileSync(filePath2, "utf8");
113496
113626
  const frontmatterMatch = content4.match(/^---\n([\s\S]*?)\n---/);
113497
- if (frontmatterMatch) {
113498
- const frontmatter = frontmatterMatch[1];
113499
- const updatedFrontmatter = frontmatter.includes("postId:") ? frontmatter.replace(/postId:\s*\d*/, `postId: ${postId}`) : `${frontmatter}
113627
+ if (!frontmatterMatch) {
113628
+ logger.warn(`Could not find frontmatter in ${filePath2}`);
113629
+ return;
113630
+ }
113631
+ let frontmatter = frontmatterMatch[1];
113632
+ const postId = wpPost.id;
113633
+ const modified = wpPost.modified || new Date().toISOString();
113634
+ const lastPushed = new Date().toISOString();
113635
+ if (frontmatter.includes("postId:")) {
113636
+ frontmatter = frontmatter.replace(/postId:\s*\d*/, `postId: ${postId}`);
113637
+ } else {
113638
+ frontmatter = `${frontmatter}
113500
113639
  postId: ${postId}`;
113501
- const updatedContent = content4.replace(/^---\n([\s\S]*?)\n---/, `---
113502
- ${updatedFrontmatter}
113503
- ---`);
113504
- fs5.writeFileSync(filePath2, updatedContent, "utf8");
113505
- logger.debug(`Updated ${filePath2} with post ID: ${postId}`);
113506
113640
  }
113641
+ if (frontmatter.includes("modified:")) {
113642
+ frontmatter = frontmatter.replace(/modified:\s*"[^"]*"/, `modified: "${modified}"`);
113643
+ } else {
113644
+ frontmatter = `${frontmatter}
113645
+ modified: "${modified}"`;
113646
+ }
113647
+ if (frontmatter.includes("lastPushed:")) {
113648
+ frontmatter = frontmatter.replace(/lastPushed:\s*"[^"]*"/, `lastPushed: "${lastPushed}"`);
113649
+ } else {
113650
+ frontmatter = `${frontmatter}
113651
+ lastPushed: "${lastPushed}"`;
113652
+ }
113653
+ const updatedContent = content4.replace(/^---\n([\s\S]*?)\n---/, `---
113654
+ ${frontmatter}
113655
+ ---`);
113656
+ fs5.writeFileSync(filePath2, updatedContent, "utf8");
113657
+ logger.debug(`Updated ${filePath2} with sync timestamps`);
113507
113658
  } catch (error) {
113508
- logger.warn(`Failed to update MDX file with post ID: ${error.message}`);
113659
+ logger.warn(`Failed to update MDX file after push: ${error.message}`);
113509
113660
  }
113510
113661
  }
113511
113662
  }
@@ -113896,30 +114047,10 @@ class DevModeUI {
113896
114047
  this.setupEventListeners();
113897
114048
  }
113898
114049
  setupEventListeners() {
113899
- this.scheduler.on("taskStart", (task) => {
113900
- this.onTaskStart(task);
113901
- });
113902
- this.scheduler.on("taskComplete", (task, success) => {
113903
- this.onTaskComplete(task, success);
113904
- });
113905
114050
  this.scheduler.on("queueChange", () => {
113906
114051
  this.scheduleRender();
113907
114052
  });
113908
114053
  }
113909
- onTaskStart(task) {
113910
- const icon = this.getTaskIcon(task.type);
113911
- const name2 = this.formatTaskName(task);
113912
- logger.info(`${icon} Building: ${name2}`);
113913
- }
113914
- onTaskComplete(task, success) {
113915
- const duration = task.completedAt && task.startedAt ? ((task.completedAt - task.startedAt) / 1000).toFixed(1) : "?";
113916
- const name2 = this.formatTaskName(task);
113917
- if (success) {
113918
- logger.success(`✓ ${name2} (${duration}s)`);
113919
- } else {
113920
- logger.error(`✗ ${name2} failed: ${task.error || "Unknown error"}`);
113921
- }
113922
- }
113923
114054
  getTaskIcon(type) {
113924
114055
  switch (type) {
113925
114056
  case "block-build":
@@ -114737,6 +114868,7 @@ var $watch = watch;
114737
114868
  // src/dev/dev-mode-orchestrator.ts
114738
114869
  import * as path16 from "path";
114739
114870
  import * as fs14 from "fs";
114871
+ import { fileURLToPath as fileURLToPath4 } from "url";
114740
114872
 
114741
114873
  // src/build/block-scanner.ts
114742
114874
  import * as fs7 from "fs";
@@ -115730,8 +115862,15 @@ export {};
115730
115862
  return result2;
115731
115863
  }
115732
115864
  convertSingleAttribute(attr) {
115733
- const type = attr.type || "any";
115734
115865
  const optional = attr.default !== undefined;
115866
+ if (attr.__tsType) {
115867
+ return {
115868
+ type: attr.__tsType,
115869
+ description: attr.__tsDescription,
115870
+ optional
115871
+ };
115872
+ }
115873
+ const type = attr.type || "any";
115735
115874
  switch (type) {
115736
115875
  case "string":
115737
115876
  return { type: "string", optional };
@@ -115742,21 +115881,11 @@ export {};
115742
115881
  case "array":
115743
115882
  return { type: "any[]", optional };
115744
115883
  case "object":
115745
- if (this.isMediaObject(attr)) {
115746
- return {
115747
- type: "{ id?: number; url: string; alt?: string; width?: number; height?: number }",
115748
- description: "Media object with image details",
115749
- optional
115750
- };
115751
- }
115752
115884
  return { type: "{ [key: string]: any }", optional };
115753
115885
  default:
115754
115886
  return { type: "any", optional };
115755
115887
  }
115756
115888
  }
115757
- isMediaObject(attr) {
115758
- return attr.default && (typeof attr.default === "object" && Object.keys(attr.default).length === 0);
115759
- }
115760
115889
  async extractBlocksFromDist(distDir) {
115761
115890
  const blocks = [];
115762
115891
  if (!fs12.existsSync(distDir)) {
@@ -115880,7 +116009,7 @@ add_action('enqueue_block_assets', 'wordpress_flow_enqueue_block_scripts');
115880
116009
  // package.json
115881
116010
  var package_default = {
115882
116011
  name: "@wordpress-flow/cli",
115883
- version: "1.1.1",
116012
+ version: "1.1.3",
115884
116013
  type: "module",
115885
116014
  description: "TypeScript-based WordPress block creation system",
115886
116015
  main: "dist/index.js",
@@ -115932,6 +116061,9 @@ var package_default = {
115932
116061
  };
115933
116062
 
115934
116063
  // src/dev/dev-mode-orchestrator.ts
116064
+ var __filename2 = fileURLToPath4(import.meta.url);
116065
+ var __dirname2 = path16.dirname(__filename2);
116066
+
115935
116067
  class DevModeOrchestrator {
115936
116068
  configManager;
115937
116069
  connectionManager;
@@ -115960,6 +116092,8 @@ class DevModeOrchestrator {
115960
116092
  scriptsPath;
115961
116093
  blockFilePaths = new Map;
115962
116094
  importToBlock = new Map;
116095
+ ignoredFiles = new Set;
116096
+ ignoreTimeout = 2000;
115963
116097
  constructor(options = {}) {
115964
116098
  this.options = {
115965
116099
  fresh: false,
@@ -116015,7 +116149,7 @@ class DevModeOrchestrator {
116015
116149
  if (config2.build?.webpackConfig) {
116016
116150
  this.webpackConfig = this.configManager.resolvePath(config2.build.webpackConfig);
116017
116151
  } else {
116018
- this.webpackConfig = path16.join(import.meta.dirname, "..", "..", "webpack.config.cjs");
116152
+ this.webpackConfig = path16.join(__dirname2, "..", "webpack.config.cjs");
116019
116153
  }
116020
116154
  this.scriptsPath = config2.build?.scriptsPath ? this.configManager.resolvePath(config2.build.scriptsPath) : undefined;
116021
116155
  this.contentDir = this.configManager.resolvePath(config2.paths.mdxOutputDir);
@@ -116096,15 +116230,16 @@ class DevModeOrchestrator {
116096
116230
  this.ui.showInitialBuildComplete(blocks.length, blocks.length, 0, Date.now() - startTime);
116097
116231
  return;
116098
116232
  }
116233
+ console.log(`\uD83D\uDCE6 Blocks to build: ${blocksToRebuild.map((b) => b.name).join(", ")}`);
116099
116234
  let successCount = 0;
116100
116235
  let failCount = 0;
116101
116236
  const blockScripts = new Map;
116102
116237
  const results = await this.workerPool.buildAll(blocksToRebuild, (completed, total, blockName, success) => {
116103
116238
  if (success) {
116104
- logger.success(`✅ Built: ${blockName} [${completed}/${total}]`);
116239
+ console.log(` ✅ ${blockName} [${completed}/${total}]`);
116105
116240
  successCount++;
116106
116241
  } else {
116107
- logger.error(`❌ Failed: ${blockName} [${completed}/${total}]`);
116242
+ console.log(` ❌ ${blockName} failed [${completed}/${total}]`);
116108
116243
  failCount++;
116109
116244
  }
116110
116245
  });
@@ -116212,6 +116347,10 @@ class DevModeOrchestrator {
116212
116347
  }
116213
116348
  handlePageFileEvent(eventType, filePath2) {
116214
116349
  const fullPath = path16.resolve(this.contentDir, filePath2);
116350
+ if (this.ignoredFiles.has(fullPath)) {
116351
+ logger.debug(`Ignoring self-triggered change: ${filePath2}`);
116352
+ return;
116353
+ }
116215
116354
  this.changeQueue.queuePageChange(fullPath, eventType);
116216
116355
  if (eventType === "unlink") {
116217
116356
  this.dependencyTracker.removeFile(fullPath);
@@ -116219,13 +116358,18 @@ class DevModeOrchestrator {
116219
116358
  this.dependencyTracker.updateFileDependencies(fullPath, "page");
116220
116359
  }
116221
116360
  }
116361
+ ignoreFileTemporarily(filePath2) {
116362
+ this.ignoredFiles.add(filePath2);
116363
+ setTimeout(() => {
116364
+ this.ignoredFiles.delete(filePath2);
116365
+ }, this.ignoreTimeout);
116366
+ }
116222
116367
  async rescanBlocks() {
116223
116368
  const blocks = await this.scanBlocks();
116224
116369
  logger.debug(`Re-scanned: ${blocks.length} blocks`);
116225
116370
  }
116226
116371
  async processBatch(batch) {
116227
116372
  const blockNames = Array.from(batch.blocks.keys());
116228
- this.ui.showBatchStart(blockNames.length, batch.templates.length, batch.pages.length);
116229
116373
  if (batch.deletedBlocks.length > 0) {
116230
116374
  await this.deletionHandler.handleMultipleDeletions(batch.deletedBlocks);
116231
116375
  }
@@ -116260,25 +116404,29 @@ class DevModeOrchestrator {
116260
116404
  const taskId = this.taskScheduler.scheduleBlockBuild(block.name);
116261
116405
  taskIds.push(taskId);
116262
116406
  }
116263
- const results = await this.workerPool.buildAll(blocksToRebuild);
116264
- for (const result2 of results) {
116265
- const taskId = taskIds.find((id) => id.includes(result2.blockName));
116407
+ for (const block of blocksToRebuild) {
116408
+ const taskId = taskIds.find((id) => id.includes(block.name));
116409
+ const startTime = Date.now();
116410
+ process.stdout.write(`\uD83D\uDD28 ${block.name} → `);
116411
+ const results = await this.workerPool.buildAll([block]);
116412
+ const result2 = results[0];
116413
+ const duration = `${((Date.now() - startTime) / 1000).toFixed(1)}s`;
116266
116414
  if (result2.aborted) {
116415
+ console.log(`⏹️ aborted`);
116267
116416
  if (taskId)
116268
116417
  this.taskScheduler.abortTask(taskId);
116269
116418
  continue;
116270
116419
  }
116271
116420
  if (result2.success) {
116272
- const block = blocksToRebuild.find((b) => b.name === result2.blockName);
116273
- if (block) {
116274
- const hash = this.hashManager.calculateSourceHash(block.filePath);
116275
- this.hashManager.storeHash(block.name, hash);
116276
- }
116421
+ const hash = this.hashManager.calculateSourceHash(block.filePath);
116422
+ this.hashManager.storeHash(block.name, hash);
116277
116423
  await this.componentRegistry.reloadBlock(result2.blockName);
116424
+ console.log(`✅ (${duration})`);
116278
116425
  if (taskId) {
116279
116426
  this.taskScheduler.completeTask(taskId, true, result2);
116280
116427
  }
116281
116428
  } else {
116429
+ console.log(`❌ ${result2.error || "failed"}`);
116282
116430
  if (taskId) {
116283
116431
  this.taskScheduler.completeTask(taskId, false, null, result2.error);
116284
116432
  }
@@ -116315,15 +116463,27 @@ class DevModeOrchestrator {
116315
116463
  return;
116316
116464
  for (const pagePath of pagePaths) {
116317
116465
  const taskId = this.taskScheduler.schedulePagePush(pagePath, []);
116466
+ const fileName = path16.basename(pagePath);
116467
+ const startTime = Date.now();
116468
+ this.ignoreFileTemporarily(pagePath);
116318
116469
  try {
116319
- await this.pushCommand.execute({
116470
+ await this.pushCommand.executeQuiet({
116320
116471
  files: [pagePath],
116321
116472
  force: false,
116322
116473
  dryRun: false
116323
116474
  });
116475
+ const duration = ((Date.now() - startTime) / 1000).toFixed(1);
116476
+ console.log(`\uD83D\uDE80 ${fileName} → ✅ (${duration}s)`);
116324
116477
  this.taskScheduler.completeTask(taskId, true);
116325
116478
  } catch (error) {
116326
- this.taskScheduler.completeTask(taskId, false, null, error.message);
116479
+ const errorMsg = error.message;
116480
+ if (errorMsg.length > 60) {
116481
+ console.log(`\uD83D\uDE80 ${fileName} → ❌`);
116482
+ console.log(` ${errorMsg}`);
116483
+ } else {
116484
+ console.log(`\uD83D\uDE80 ${fileName} → ❌ ${errorMsg}`);
116485
+ }
116486
+ this.taskScheduler.completeTask(taskId, false, null, errorMsg);
116327
116487
  }
116328
116488
  }
116329
116489
  }
@@ -116400,6 +116560,7 @@ class DevCommand {
116400
116560
 
116401
116561
  // src/commands/build-command.ts
116402
116562
  import * as path21 from "path";
116563
+ import { fileURLToPath as fileURLToPath5 } from "url";
116403
116564
 
116404
116565
  // src/build/block-builder.ts
116405
116566
  import * as fs17 from "fs";
@@ -116971,6 +117132,9 @@ class WorkerPool {
116971
117132
  }
116972
117133
 
116973
117134
  // src/commands/build-command.ts
117135
+ var __filename3 = fileURLToPath5(import.meta.url);
117136
+ var __dirname3 = path21.dirname(__filename3);
117137
+
116974
117138
  class BuildCommand {
116975
117139
  configManager;
116976
117140
  blockScanner;
@@ -116998,7 +117162,7 @@ class BuildCommand {
116998
117162
  } else if (config2.build?.webpackConfig) {
116999
117163
  webpackConfig = this.configManager.resolvePath(config2.build.webpackConfig);
117000
117164
  } else {
117001
- webpackConfig = path21.join(import.meta.dirname, "..", "webpack.config.cjs");
117165
+ webpackConfig = path21.join(__dirname3, "..", "webpack.config.cjs");
117002
117166
  }
117003
117167
  const scriptsPath = config2.build?.scriptsPath ? this.configManager.resolvePath(config2.build.scriptsPath) : undefined;
117004
117168
  logger.info(`Scanning blocks in: ${blocksDir}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress-flow/cli",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "type": "module",
5
5
  "description": "TypeScript-based WordPress block creation system",
6
6
  "main": "dist/index.js",