@wp-typia/project-tools 0.22.0 → 0.22.2

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.
@@ -121,7 +121,9 @@ const WORKSPACE_COMPATIBILITY_CONFIG_FIELD = `\tcompatibility?: {
121
121
  \t\t\twordpress?: string;
122
122
  \t\t};
123
123
  \t\tmode: 'baseline' | 'optional' | 'required';
124
+ \t\toptionalFeatureIds: string[];
124
125
  \t\toptionalFeatures: string[];
126
+ \t\trequiredFeatureIds: string[];
125
127
  \t\trequiredFeatures: string[];
126
128
  \t\truntimeGates: string[];
127
129
  \t};
@@ -670,6 +672,26 @@ function ensureInterfaceField(source, interfaceName, fieldName, fieldSource) {
670
672
  return `${start}${body}${body.length > 0 && !body.endsWith(lineEnding) ? lineEnding : ""}${formattedFieldSource}${end}`;
671
673
  });
672
674
  }
675
+ function normalizeInterfaceFieldBlock(source, interfaceName, fieldName, fieldSource, requiredFragments) {
676
+ const interfacePattern = new RegExp(`(export\\s+interface\\s+${escapeRegex(interfaceName)}\\s*\\{\\r?\\n)([\\s\\S]*?)(\\r?\\n\\})`, "u");
677
+ return source.replace(interfacePattern, (match, start, body, end) => {
678
+ const fieldPattern = new RegExp(`(^([ \\t]*)${escapeRegex(fieldName)}\\??:\\s*\\{[ \\t]*\\r?\\n)([\\s\\S]*?)(^\\2\\};\\r?\\n?)`, "mu");
679
+ const fieldMatch = fieldPattern.exec(body);
680
+ if (!fieldMatch) {
681
+ return match;
682
+ }
683
+ const existingFieldSource = fieldMatch[0];
684
+ if (requiredFragments.every((fragment) => existingFieldSource.includes(fragment))) {
685
+ return match;
686
+ }
687
+ const lineEnding = start.endsWith("\r\n") ? "\r\n" : "\n";
688
+ const formattedFieldSource = `${fieldSource
689
+ .replace(/\r?\n$/u, "")
690
+ .split("\n")
691
+ .join(lineEnding)}${lineEnding}`;
692
+ return `${start}${body.slice(0, fieldMatch.index)}${formattedFieldSource}${body.slice(fieldMatch.index + existingFieldSource.length)}${end}`;
693
+ });
694
+ }
673
695
  /**
674
696
  * Update `scripts/block-config.ts` source text with additional inventory entries.
675
697
  *
@@ -701,7 +723,9 @@ export function updateWorkspaceInventorySource(source, { blockEntries = [], bloc
701
723
  nextSource = ensureInterfaceField(nextSource, "WorkspaceBindingSourceConfig", "attribute", "\tattribute?: string;");
702
724
  nextSource = ensureInterfaceField(nextSource, "WorkspaceBindingSourceConfig", "block", "\tblock?: string;");
703
725
  nextSource = ensureInterfaceField(nextSource, "WorkspaceAbilityConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD);
726
+ nextSource = normalizeInterfaceFieldBlock(nextSource, "WorkspaceAbilityConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD, ["optionalFeatureIds: string[];", "requiredFeatureIds: string[];"]);
704
727
  nextSource = ensureInterfaceField(nextSource, "WorkspaceAiFeatureConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD);
728
+ nextSource = normalizeInterfaceFieldBlock(nextSource, "WorkspaceAiFeatureConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD, ["optionalFeatureIds: string[];", "requiredFeatureIds: string[];"]);
705
729
  nextSource = appendEntriesAtMarker(nextSource, EDITOR_PLUGIN_CONFIG_ENTRY_MARKER, editorPluginEntries);
706
730
  return nextSource;
707
731
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-typia/project-tools",
3
- "version": "0.22.0",
3
+ "version": "0.22.2",
4
4
  "description": "Project orchestration and programmatic tooling for wp-typia",
5
5
  "packageManager": "bun@1.3.11",
6
6
  "type": "module",