wp-typia 0.20.5 → 0.22.0

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.
@@ -170911,17 +170911,6 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
170911
170911
  } });
170912
170912
  });
170913
170913
 
170914
- // ../wp-typia-project-tools/src/runtime/cli-add-shared.ts
170915
- import fs from "fs";
170916
- import { promises as fsp } from "fs";
170917
- import path from "path";
170918
- import { parseScaffoldBlockMetadata } from "@wp-typia/block-runtime/blocks";
170919
-
170920
- // ../wp-typia-project-tools/src/runtime/hooked-blocks.ts
170921
- var HOOKED_BLOCK_POSITION_IDS = ["before", "after", "firstChild", "lastChild"];
170922
- var HOOKED_BLOCK_POSITION_SET = new Set(HOOKED_BLOCK_POSITION_IDS);
170923
- var HOOKED_BLOCK_ANCHOR_PATTERN = /^[a-z0-9-]+\/[a-z0-9-]+$/;
170924
-
170925
170914
  // ../wp-typia-project-tools/src/runtime/string-case.ts
170926
170915
  function capitalizeSegment(segment) {
170927
170916
  return segment.charAt(0).toUpperCase() + segment.slice(1);
@@ -170942,6 +170931,17 @@ function toTitleCase(input) {
170942
170931
  return toKebabCase(input).split("-").filter(Boolean).map(capitalizeSegment).join(" ");
170943
170932
  }
170944
170933
 
170934
+ // ../wp-typia-project-tools/src/runtime/cli-add-shared.ts
170935
+ import fs from "fs";
170936
+ import { promises as fsp } from "fs";
170937
+ import path from "path";
170938
+ import { parseScaffoldBlockMetadata } from "@wp-typia/block-runtime/blocks";
170939
+
170940
+ // ../wp-typia-project-tools/src/runtime/hooked-blocks.ts
170941
+ var HOOKED_BLOCK_POSITION_IDS = ["before", "after", "firstChild", "lastChild"];
170942
+ var HOOKED_BLOCK_POSITION_SET = new Set(HOOKED_BLOCK_POSITION_IDS);
170943
+ var HOOKED_BLOCK_ANCHOR_PATTERN = /^[a-z0-9-]+\/[a-z0-9-]+$/;
170944
+
170945
170945
  // ../wp-typia-project-tools/src/runtime/scaffold-identifiers.ts
170946
170946
  var BLOCK_SLUG_PATTERN = /^[a-z][a-z0-9-]*$/;
170947
170947
  var PHP_PREFIX_PATTERN = /^[a-z_][a-z0-9_]*$/;
@@ -171022,8 +171022,11 @@ function resolveScaffoldIdentifiers({
171022
171022
 
171023
171023
  // ../wp-typia-project-tools/src/runtime/cli-add-shared.ts
171024
171024
  var ADD_KIND_IDS = [
171025
+ "admin-view",
171025
171026
  "block",
171026
171027
  "variation",
171028
+ "style",
171029
+ "transform",
171027
171030
  "pattern",
171028
171031
  "binding-source",
171029
171032
  "rest-resource",
@@ -171039,7 +171042,20 @@ var REST_RESOURCE_METHOD_IDS = [
171039
171042
  "update",
171040
171043
  "delete"
171041
171044
  ];
171042
- var EDITOR_PLUGIN_SLOT_IDS = ["PluginSidebar"];
171045
+ var EDITOR_PLUGIN_SLOT_IDS = ["sidebar", "document-setting-panel"];
171046
+ var EDITOR_PLUGIN_SLOT_ALIASES = {
171047
+ PluginDocumentSettingPanel: "document-setting-panel",
171048
+ PluginSidebar: "sidebar",
171049
+ "document-setting-panel": "document-setting-panel",
171050
+ sidebar: "sidebar"
171051
+ };
171052
+ function resolveEditorPluginSlotAlias(slot) {
171053
+ const trimmed = slot.trim();
171054
+ if (!Object.prototype.hasOwnProperty.call(EDITOR_PLUGIN_SLOT_ALIASES, trimmed)) {
171055
+ return;
171056
+ }
171057
+ return EDITOR_PLUGIN_SLOT_ALIASES[trimmed];
171058
+ }
171043
171059
  var ADD_BLOCK_TEMPLATE_IDS = [
171044
171060
  "basic",
171045
171061
  "interactivity",
@@ -171157,11 +171173,12 @@ function assertValidHookAnchor(anchorBlockName) {
171157
171173
  }
171158
171174
  return trimmed;
171159
171175
  }
171160
- function assertValidEditorPluginSlot(slot = "PluginSidebar") {
171161
- if (EDITOR_PLUGIN_SLOT_IDS.includes(slot)) {
171162
- return slot;
171176
+ function assertValidEditorPluginSlot(slot = "sidebar") {
171177
+ const alias = resolveEditorPluginSlotAlias(slot);
171178
+ if (alias) {
171179
+ return alias;
171163
171180
  }
171164
- throw new Error(`Editor plugin slot must be one of: ${EDITOR_PLUGIN_SLOT_IDS.join(", ")}.`);
171181
+ throw new Error(`Editor plugin slot must be one of: ${EDITOR_PLUGIN_SLOT_IDS.join(", ")}. Legacy aliases: PluginSidebar, PluginDocumentSettingPanel.`);
171165
171182
  }
171166
171183
  function readWorkspaceBlockJson(projectDir, blockSlug) {
171167
171184
  const blockJsonPath = path.join(projectDir, "src", "blocks", blockSlug, "block.json");
@@ -171231,6 +171248,19 @@ function assertRestResourceDoesNotExist(projectDir, restResourceSlug, inventory)
171231
171248
  throw new Error(`A REST resource inventory entry already exists for ${restResourceSlug}. Choose a different name.`);
171232
171249
  }
171233
171250
  }
171251
+ function assertAdminViewDoesNotExist(projectDir, adminViewSlug, inventory) {
171252
+ const adminViewDir = path.join(projectDir, "src", "admin-views", adminViewSlug);
171253
+ const adminViewPhpPath = path.join(projectDir, "inc", "admin-views", `${adminViewSlug}.php`);
171254
+ if (fs.existsSync(adminViewDir)) {
171255
+ throw new Error(`An admin view already exists at ${path.relative(projectDir, adminViewDir)}. Choose a different name.`);
171256
+ }
171257
+ if (fs.existsSync(adminViewPhpPath)) {
171258
+ throw new Error(`An admin view bootstrap already exists at ${path.relative(projectDir, adminViewPhpPath)}. Choose a different name.`);
171259
+ }
171260
+ if (inventory.adminViews.some((entry) => entry.slug === adminViewSlug)) {
171261
+ throw new Error(`An admin view inventory entry already exists for ${adminViewSlug}. Choose a different name.`);
171262
+ }
171263
+ }
171234
171264
  function assertAbilityDoesNotExist(projectDir, abilitySlug, inventory) {
171235
171265
  const abilityDir = path.join(projectDir, "src", "abilities", abilitySlug);
171236
171266
  const abilityPhpPath = path.join(projectDir, "inc", "abilities", `${abilitySlug}.php`);
@@ -171268,10 +171298,13 @@ function assertEditorPluginDoesNotExist(projectDir, editorPluginSlug, inventory)
171268
171298
  }
171269
171299
  function formatAddHelpText() {
171270
171300
  return `Usage:
171271
- wp-typia add block <name> --template <${ADD_BLOCK_TEMPLATE_IDS.join("|")}> [--external-layer-source <./path|github:owner/repo/path[#ref]|npm-package>] [--external-layer-id <layer-id>] [--inner-blocks-preset <freeform|ordered|horizontal|locked-structure>] [--alternate-render-targets <email,mjml,plain-text>] [--data-storage <post-meta|custom-table>] [--persistence-policy <authenticated|public>] [--dry-run]
171301
+ wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>] [--dry-run]
171302
+ wp-typia add block <name> [--template <${ADD_BLOCK_TEMPLATE_IDS.join("|")}>] [--external-layer-source <./path|github:owner/repo/path[#ref]|npm-package>] [--external-layer-id <layer-id>] [--inner-blocks-preset <freeform|ordered|horizontal|locked-structure>] [--alternate-render-targets <email,mjml,plain-text>] [--data-storage <post-meta|custom-table>] [--persistence-policy <authenticated|public>] [--dry-run]
171272
171303
  wp-typia add variation <name> --block <block-slug> [--dry-run]
171304
+ wp-typia add style <name> --block <block-slug> [--dry-run]
171305
+ wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug> [--dry-run]
171273
171306
  wp-typia add pattern <name> [--dry-run]
171274
- wp-typia add binding-source <name> [--dry-run]
171307
+ wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>] [--dry-run]
171275
171308
  wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create,update,delete>] [--dry-run]
171276
171309
  wp-typia add ability <name> [--dry-run]
171277
171310
  wp-typia add ai-feature <name> [--namespace <vendor/v1>] [--dry-run]
@@ -171281,15 +171314,22 @@ function formatAddHelpText() {
171281
171314
  Notes:
171282
171315
  \`wp-typia add\` runs only inside official ${WORKSPACE_TEMPLATE_PACKAGE} workspaces scaffolded via \`wp-typia create <project-dir> --template workspace\`.
171283
171316
  Pass \`--dry-run\` to preview the workspace files that would change without writing them.
171317
+ Interactive add flows let you choose a template when \`--template\` is omitted; non-interactive runs default to \`basic\`.
171318
+ \`add admin-view\` scaffolds an opt-in DataViews-powered WordPress admin screen under \`src/admin-views/\`.
171319
+ Pass \`--source rest-resource:<slug>\` to reuse a list-capable REST resource.
171320
+ Pass \`--source core-data:postType/post\` or \`--source core-data:taxonomy/category\` to bind a WordPress-owned entity collection.
171321
+ Public installs currently gate this workflow until \`@wp-typia/dataviews\` is published to npm.
171284
171322
  \`query-loop\` is a create-time scaffold family. Use \`wp-typia create <project-dir> --template query-loop\` instead of \`wp-typia add block\`.
171285
171323
  \`add variation\` targets an existing block slug from \`scripts/block-config.ts\`.
171324
+ \`add style\` registers a Block Styles option for an existing generated block.
171325
+ \`add transform\` adds a block-to-block transform into an existing generated block.
171286
171326
  \`add pattern\` scaffolds a namespaced PHP pattern shell under \`src/patterns/\`.
171287
- \`add binding-source\` scaffolds shared PHP and editor registration under \`src/bindings/\`.
171327
+ \`add binding-source\` scaffolds shared PHP and editor registration under \`src/bindings/\`; pass \`--block\` and \`--attribute\` together to declare an end-to-end bindable attribute on an existing generated block.
171288
171328
  \`add rest-resource\` scaffolds plugin-level TypeScript REST contracts under \`src/rest/\` and PHP route glue under \`inc/rest/\`.
171289
171329
  \`add ability\` scaffolds typed workflow abilities under \`src/abilities/\` and server registration under \`inc/abilities/\`.
171290
171330
  \`add ai-feature\` scaffolds server-owned AI feature endpoints under \`src/ai-features/\` and PHP route glue under \`inc/ai-features/\`.
171291
171331
  \`add hooked-block\` patches an existing workspace block's \`block.json\` \`blockHooks\` metadata.
171292
- \`add editor-plugin\` scaffolds a document-level editor extension under \`src/editor-plugins/\`.`;
171332
+ \`add editor-plugin\` scaffolds a document-level editor extension under \`src/editor-plugins/\`; legacy aliases \`PluginSidebar\` and \`PluginDocumentSettingPanel\` resolve to \`sidebar\` and \`document-setting-panel\`.`;
171293
171333
  }
171294
171334
 
171295
171335
  // ../wp-typia-project-tools/src/runtime/workspace-inventory.ts
@@ -171297,13 +171337,79 @@ var import_typescript = __toESM(require_typescript(), 1);
171297
171337
  import fs2 from "fs";
171298
171338
  import path2 from "path";
171299
171339
  import { readFile, writeFile } from "fs/promises";
171340
+
171341
+ // ../wp-typia-project-tools/src/runtime/php-utils.ts
171342
+ function escapeRegex(value) {
171343
+ return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
171344
+ }
171345
+ function quotePhpString(value) {
171346
+ return `'${value.replace(/\\/gu, "\\\\").replace(/'/gu, "\\'")}'`;
171347
+ }
171348
+ function hasPhpFunctionDefinition(source, functionName) {
171349
+ return new RegExp(`function\\s+${escapeRegex(functionName)}\\s*\\(`, "u").test(source);
171350
+ }
171351
+ function findPhpFunctionRange(source, functionName, options = {}) {
171352
+ const signaturePattern = new RegExp(`function\\s+${escapeRegex(functionName)}\\s*\\([^)]*\\)\\s*(?::\\s*[^{};]+)?\\s*\\{`, "u");
171353
+ const signatureMatch = signaturePattern.exec(source);
171354
+ if (!signatureMatch) {
171355
+ return null;
171356
+ }
171357
+ const functionStart = signatureMatch.index;
171358
+ const openBraceOffset = signatureMatch[0].lastIndexOf("{");
171359
+ if (openBraceOffset === -1) {
171360
+ return null;
171361
+ }
171362
+ const openBraceIndex = functionStart + openBraceOffset;
171363
+ let depth = 0;
171364
+ for (let index = openBraceIndex;index < source.length; index += 1) {
171365
+ const character = source[index];
171366
+ if (character === "{") {
171367
+ depth += 1;
171368
+ continue;
171369
+ }
171370
+ if (character !== "}") {
171371
+ continue;
171372
+ }
171373
+ depth -= 1;
171374
+ if (depth === 0) {
171375
+ let end = index + 1;
171376
+ if (options.includeTrailingNewlines ?? true) {
171377
+ while (end < source.length && /[\r\n]/u.test(source[end] ?? "")) {
171378
+ end += 1;
171379
+ }
171380
+ }
171381
+ return {
171382
+ end,
171383
+ source: source.slice(functionStart, end),
171384
+ start: functionStart
171385
+ };
171386
+ }
171387
+ }
171388
+ return null;
171389
+ }
171390
+ function replacePhpFunctionDefinition(source, functionName, replacement, options = {}) {
171391
+ const functionRange = findPhpFunctionRange(source, functionName, options);
171392
+ if (!functionRange) {
171393
+ return null;
171394
+ }
171395
+ return [
171396
+ source.slice(0, functionRange.start),
171397
+ options.trimReplacementStart ? replacement.trimStart() : replacement,
171398
+ source.slice(functionRange.end)
171399
+ ].join("");
171400
+ }
171401
+
171402
+ // ../wp-typia-project-tools/src/runtime/workspace-inventory.ts
171300
171403
  var BLOCK_CONFIG_ENTRY_MARKER = "\t// wp-typia add block entries";
171301
171404
  var VARIATION_CONFIG_ENTRY_MARKER = "\t// wp-typia add variation entries";
171405
+ var BLOCK_STYLE_CONFIG_ENTRY_MARKER = "\t// wp-typia add style entries";
171406
+ var BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER = "\t// wp-typia add transform entries";
171302
171407
  var PATTERN_CONFIG_ENTRY_MARKER = "\t// wp-typia add pattern entries";
171303
171408
  var BINDING_SOURCE_CONFIG_ENTRY_MARKER = "\t// wp-typia add binding-source entries";
171304
171409
  var REST_RESOURCE_CONFIG_ENTRY_MARKER = "\t// wp-typia add rest-resource entries";
171305
171410
  var ABILITY_CONFIG_ENTRY_MARKER = "\t// wp-typia add ability entries";
171306
171411
  var AI_FEATURE_CONFIG_ENTRY_MARKER = "\t// wp-typia add ai-feature entries";
171412
+ var ADMIN_VIEW_CONFIG_ENTRY_MARKER = "\t// wp-typia add admin-view entries";
171307
171413
  var EDITOR_PLUGIN_CONFIG_ENTRY_MARKER = "\t// wp-typia add editor-plugin entries";
171308
171414
  var VARIATIONS_INTERFACE_SECTION = `
171309
171415
 
@@ -171319,6 +171425,36 @@ export const VARIATIONS: WorkspaceVariationConfig[] = [
171319
171425
  // wp-typia add variation entries
171320
171426
  ];
171321
171427
  `;
171428
+ var BLOCK_STYLES_INTERFACE_SECTION = `
171429
+
171430
+ export interface WorkspaceBlockStyleConfig {
171431
+ block: string;
171432
+ file: string;
171433
+ slug: string;
171434
+ }
171435
+ `;
171436
+ var BLOCK_STYLES_CONST_SECTION = `
171437
+
171438
+ export const BLOCK_STYLES: WorkspaceBlockStyleConfig[] = [
171439
+ // wp-typia add style entries
171440
+ ];
171441
+ `;
171442
+ var BLOCK_TRANSFORMS_INTERFACE_SECTION = `
171443
+
171444
+ export interface WorkspaceBlockTransformConfig {
171445
+ block: string;
171446
+ file: string;
171447
+ from: string;
171448
+ slug: string;
171449
+ to: string;
171450
+ }
171451
+ `;
171452
+ var BLOCK_TRANSFORMS_CONST_SECTION = `
171453
+
171454
+ export const BLOCK_TRANSFORMS: WorkspaceBlockTransformConfig[] = [
171455
+ // wp-typia add transform entries
171456
+ ];
171457
+ `;
171322
171458
  var PATTERNS_INTERFACE_SECTION = `
171323
171459
 
171324
171460
  export interface WorkspacePatternConfig {
@@ -171335,6 +171471,8 @@ export const PATTERNS: WorkspacePatternConfig[] = [
171335
171471
  var BINDING_SOURCES_INTERFACE_SECTION = `
171336
171472
 
171337
171473
  export interface WorkspaceBindingSourceConfig {
171474
+ attribute?: string;
171475
+ block?: string;
171338
171476
  editorFile: string;
171339
171477
  serverFile: string;
171340
171478
  slug: string;
@@ -171426,6 +171564,21 @@ export const AI_FEATURES: WorkspaceAiFeatureConfig[] = [
171426
171564
  // wp-typia add ai-feature entries
171427
171565
  ];
171428
171566
  `;
171567
+ var ADMIN_VIEWS_INTERFACE_SECTION = `
171568
+
171569
+ export interface WorkspaceAdminViewConfig {
171570
+ file: string;
171571
+ phpFile: string;
171572
+ slug: string;
171573
+ source?: string;
171574
+ }
171575
+ `;
171576
+ var ADMIN_VIEWS_CONST_SECTION = `
171577
+
171578
+ export const ADMIN_VIEWS: WorkspaceAdminViewConfig[] = [
171579
+ // wp-typia add admin-view entries
171580
+ ];
171581
+ `;
171429
171582
  var EDITOR_PLUGINS_INTERFACE_SECTION = `
171430
171583
 
171431
171584
  export interface WorkspaceEditorPluginConfig {
@@ -171545,6 +171698,32 @@ function parseVariationEntries(arrayLiteral) {
171545
171698
  };
171546
171699
  });
171547
171700
  }
171701
+ function parseBlockStyleEntries(arrayLiteral) {
171702
+ return arrayLiteral.elements.map((element, elementIndex) => {
171703
+ if (!import_typescript.default.isObjectLiteralExpression(element)) {
171704
+ throw new Error(`BLOCK_STYLES[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
171705
+ }
171706
+ return {
171707
+ block: getRequiredStringProperty("BLOCK_STYLES", elementIndex, element, "block"),
171708
+ file: getRequiredStringProperty("BLOCK_STYLES", elementIndex, element, "file"),
171709
+ slug: getRequiredStringProperty("BLOCK_STYLES", elementIndex, element, "slug")
171710
+ };
171711
+ });
171712
+ }
171713
+ function parseBlockTransformEntries(arrayLiteral) {
171714
+ return arrayLiteral.elements.map((element, elementIndex) => {
171715
+ if (!import_typescript.default.isObjectLiteralExpression(element)) {
171716
+ throw new Error(`BLOCK_TRANSFORMS[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
171717
+ }
171718
+ return {
171719
+ block: getRequiredStringProperty("BLOCK_TRANSFORMS", elementIndex, element, "block"),
171720
+ file: getRequiredStringProperty("BLOCK_TRANSFORMS", elementIndex, element, "file"),
171721
+ from: getRequiredStringProperty("BLOCK_TRANSFORMS", elementIndex, element, "from"),
171722
+ slug: getRequiredStringProperty("BLOCK_TRANSFORMS", elementIndex, element, "slug"),
171723
+ to: getRequiredStringProperty("BLOCK_TRANSFORMS", elementIndex, element, "to")
171724
+ };
171725
+ });
171726
+ }
171548
171727
  function parsePatternEntries(arrayLiteral) {
171549
171728
  return arrayLiteral.elements.map((element, elementIndex) => {
171550
171729
  if (!import_typescript.default.isObjectLiteralExpression(element)) {
@@ -171562,6 +171741,8 @@ function parseBindingSourceEntries(arrayLiteral) {
171562
171741
  throw new Error(`BINDING_SOURCES[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
171563
171742
  }
171564
171743
  return {
171744
+ attribute: getOptionalStringProperty("BINDING_SOURCES", elementIndex, element, "attribute"),
171745
+ block: getOptionalStringProperty("BINDING_SOURCES", elementIndex, element, "block"),
171565
171746
  editorFile: getRequiredStringProperty("BINDING_SOURCES", elementIndex, element, "editorFile"),
171566
171747
  serverFile: getRequiredStringProperty("BINDING_SOURCES", elementIndex, element, "serverFile"),
171567
171748
  slug: getRequiredStringProperty("BINDING_SOURCES", elementIndex, element, "slug")
@@ -171642,6 +171823,19 @@ function parseEditorPluginEntries(arrayLiteral) {
171642
171823
  };
171643
171824
  });
171644
171825
  }
171826
+ function parseAdminViewEntries(arrayLiteral) {
171827
+ return arrayLiteral.elements.map((element, elementIndex) => {
171828
+ if (!import_typescript.default.isObjectLiteralExpression(element)) {
171829
+ throw new Error(`ADMIN_VIEWS[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
171830
+ }
171831
+ return {
171832
+ file: getRequiredStringProperty("ADMIN_VIEWS", elementIndex, element, "file"),
171833
+ phpFile: getRequiredStringProperty("ADMIN_VIEWS", elementIndex, element, "phpFile"),
171834
+ slug: getRequiredStringProperty("ADMIN_VIEWS", elementIndex, element, "slug"),
171835
+ source: getOptionalStringProperty("ADMIN_VIEWS", elementIndex, element, "source")
171836
+ };
171837
+ });
171838
+ }
171645
171839
  function parseWorkspaceInventorySource(source) {
171646
171840
  const sourceFile = import_typescript.default.createSourceFile("block-config.ts", source, import_typescript.default.ScriptTarget.Latest, true, import_typescript.default.ScriptKind.TS);
171647
171841
  const blockArray = findExportedArrayLiteral(sourceFile, "BLOCKS");
@@ -171649,15 +171843,24 @@ function parseWorkspaceInventorySource(source) {
171649
171843
  throw new Error("scripts/block-config.ts must export a BLOCKS array.");
171650
171844
  }
171651
171845
  const variationArray = findExportedArrayLiteral(sourceFile, "VARIATIONS");
171846
+ const blockStyleArray = findExportedArrayLiteral(sourceFile, "BLOCK_STYLES");
171847
+ const blockTransformArray = findExportedArrayLiteral(sourceFile, "BLOCK_TRANSFORMS");
171652
171848
  const patternArray = findExportedArrayLiteral(sourceFile, "PATTERNS");
171653
171849
  const bindingSourceArray = findExportedArrayLiteral(sourceFile, "BINDING_SOURCES");
171654
171850
  const restResourceArray = findExportedArrayLiteral(sourceFile, "REST_RESOURCES");
171655
171851
  const abilityArray = findExportedArrayLiteral(sourceFile, "ABILITIES");
171656
171852
  const aiFeatureArray = findExportedArrayLiteral(sourceFile, "AI_FEATURES");
171853
+ const adminViewArray = findExportedArrayLiteral(sourceFile, "ADMIN_VIEWS");
171657
171854
  const editorPluginArray = findExportedArrayLiteral(sourceFile, "EDITOR_PLUGINS");
171658
171855
  if (variationArray.found && !variationArray.array) {
171659
171856
  throw new Error("scripts/block-config.ts must export VARIATIONS as an array literal.");
171660
171857
  }
171858
+ if (blockStyleArray.found && !blockStyleArray.array) {
171859
+ throw new Error("scripts/block-config.ts must export BLOCK_STYLES as an array literal.");
171860
+ }
171861
+ if (blockTransformArray.found && !blockTransformArray.array) {
171862
+ throw new Error("scripts/block-config.ts must export BLOCK_TRANSFORMS as an array literal.");
171863
+ }
171661
171864
  if (patternArray.found && !patternArray.array) {
171662
171865
  throw new Error("scripts/block-config.ts must export PATTERNS as an array literal.");
171663
171866
  }
@@ -171673,17 +171876,26 @@ function parseWorkspaceInventorySource(source) {
171673
171876
  if (aiFeatureArray.found && !aiFeatureArray.array) {
171674
171877
  throw new Error("scripts/block-config.ts must export AI_FEATURES as an array literal.");
171675
171878
  }
171879
+ if (adminViewArray.found && !adminViewArray.array) {
171880
+ throw new Error("scripts/block-config.ts must export ADMIN_VIEWS as an array literal.");
171881
+ }
171676
171882
  if (editorPluginArray.found && !editorPluginArray.array) {
171677
171883
  throw new Error("scripts/block-config.ts must export EDITOR_PLUGINS as an array literal.");
171678
171884
  }
171679
171885
  return {
171680
171886
  abilities: abilityArray.array ? parseAbilityEntries(abilityArray.array) : [],
171887
+ adminViews: adminViewArray.array ? parseAdminViewEntries(adminViewArray.array) : [],
171681
171888
  aiFeatures: aiFeatureArray.array ? parseAiFeatureEntries(aiFeatureArray.array) : [],
171682
171889
  bindingSources: bindingSourceArray.array ? parseBindingSourceEntries(bindingSourceArray.array) : [],
171890
+ blockStyles: blockStyleArray.array ? parseBlockStyleEntries(blockStyleArray.array) : [],
171891
+ blockTransforms: blockTransformArray.array ? parseBlockTransformEntries(blockTransformArray.array) : [],
171683
171892
  blocks: parseBlockEntries(blockArray.array),
171684
171893
  hasAbilitiesSection: abilityArray.found,
171894
+ hasAdminViewsSection: adminViewArray.found,
171685
171895
  hasAiFeaturesSection: aiFeatureArray.found,
171686
171896
  hasBindingSourcesSection: bindingSourceArray.found,
171897
+ hasBlockStylesSection: blockStyleArray.found,
171898
+ hasBlockTransformsSection: blockTransformArray.found,
171687
171899
  hasEditorPluginsSection: editorPluginArray.found,
171688
171900
  hasPatternsSection: patternArray.found,
171689
171901
  hasRestResourcesSection: restResourceArray.found,
@@ -171726,6 +171938,18 @@ function ensureWorkspaceInventorySections(source) {
171726
171938
  if (!/export\s+const\s+VARIATIONS\b/u.test(nextSource)) {
171727
171939
  nextSource += VARIATIONS_CONST_SECTION;
171728
171940
  }
171941
+ if (!/export\s+interface\s+WorkspaceBlockStyleConfig\b/u.test(nextSource)) {
171942
+ nextSource += BLOCK_STYLES_INTERFACE_SECTION;
171943
+ }
171944
+ if (!/export\s+const\s+BLOCK_STYLES\b/u.test(nextSource)) {
171945
+ nextSource += BLOCK_STYLES_CONST_SECTION;
171946
+ }
171947
+ if (!/export\s+interface\s+WorkspaceBlockTransformConfig\b/u.test(nextSource)) {
171948
+ nextSource += BLOCK_TRANSFORMS_INTERFACE_SECTION;
171949
+ }
171950
+ if (!/export\s+const\s+BLOCK_TRANSFORMS\b/u.test(nextSource)) {
171951
+ nextSource += BLOCK_TRANSFORMS_CONST_SECTION;
171952
+ }
171729
171953
  if (!/export\s+interface\s+WorkspacePatternConfig\b/u.test(nextSource)) {
171730
171954
  nextSource += PATTERNS_INTERFACE_SECTION;
171731
171955
  }
@@ -171756,6 +171980,12 @@ function ensureWorkspaceInventorySections(source) {
171756
171980
  if (!/export\s+const\s+AI_FEATURES\b/u.test(nextSource)) {
171757
171981
  nextSource += AI_FEATURES_CONST_SECTION;
171758
171982
  }
171983
+ if (!/export\s+interface\s+WorkspaceAdminViewConfig\b/u.test(nextSource)) {
171984
+ nextSource += ADMIN_VIEWS_INTERFACE_SECTION;
171985
+ }
171986
+ if (!/export\s+const\s+ADMIN_VIEWS\b/u.test(nextSource)) {
171987
+ nextSource += ADMIN_VIEWS_CONST_SECTION;
171988
+ }
171759
171989
  if (!/export\s+interface\s+WorkspaceEditorPluginConfig\b/u.test(nextSource)) {
171760
171990
  nextSource += EDITOR_PLUGINS_INTERFACE_SECTION;
171761
171991
  }
@@ -171776,9 +172006,6 @@ function appendEntriesAtMarker(source, marker, entries) {
171776
172006
  `)}
171777
172007
  ${marker}`);
171778
172008
  }
171779
- function escapeRegex(value) {
171780
- return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
171781
- }
171782
172009
  function ensureInterfaceField(source, interfaceName, fieldName, fieldSource) {
171783
172010
  const interfacePattern = new RegExp(`(export\\s+interface\\s+${escapeRegex(interfaceName)}\\s*\\{\\r?\\n)([\\s\\S]*?)(\\r?\\n\\})`, "u");
171784
172011
  return source.replace(interfacePattern, (match, start, body, end) => {
@@ -171807,8 +172034,11 @@ function ensureInterfaceField(source, interfaceName, fieldName, fieldSource) {
171807
172034
  }
171808
172035
  function updateWorkspaceInventorySource(source, {
171809
172036
  blockEntries = [],
172037
+ blockStyleEntries = [],
172038
+ blockTransformEntries = [],
171810
172039
  bindingSourceEntries = [],
171811
172040
  abilityEntries = [],
172041
+ adminViewEntries = [],
171812
172042
  aiFeatureEntries = [],
171813
172043
  editorPluginEntries = [],
171814
172044
  patternEntries = [],
@@ -171822,11 +172052,16 @@ function updateWorkspaceInventorySource(source, {
171822
172052
  }
171823
172053
  nextSource = appendEntriesAtMarker(nextSource, BLOCK_CONFIG_ENTRY_MARKER, blockEntries);
171824
172054
  nextSource = appendEntriesAtMarker(nextSource, VARIATION_CONFIG_ENTRY_MARKER, variationEntries);
172055
+ nextSource = appendEntriesAtMarker(nextSource, BLOCK_STYLE_CONFIG_ENTRY_MARKER, blockStyleEntries);
172056
+ nextSource = appendEntriesAtMarker(nextSource, BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER, blockTransformEntries);
171825
172057
  nextSource = appendEntriesAtMarker(nextSource, PATTERN_CONFIG_ENTRY_MARKER, patternEntries);
171826
172058
  nextSource = appendEntriesAtMarker(nextSource, BINDING_SOURCE_CONFIG_ENTRY_MARKER, bindingSourceEntries);
171827
172059
  nextSource = appendEntriesAtMarker(nextSource, REST_RESOURCE_CONFIG_ENTRY_MARKER, restResourceEntries);
171828
172060
  nextSource = appendEntriesAtMarker(nextSource, ABILITY_CONFIG_ENTRY_MARKER, abilityEntries);
171829
172061
  nextSource = appendEntriesAtMarker(nextSource, AI_FEATURE_CONFIG_ENTRY_MARKER, aiFeatureEntries);
172062
+ nextSource = appendEntriesAtMarker(nextSource, ADMIN_VIEW_CONFIG_ENTRY_MARKER, adminViewEntries);
172063
+ nextSource = ensureInterfaceField(nextSource, "WorkspaceBindingSourceConfig", "attribute", "\tattribute?: string;");
172064
+ nextSource = ensureInterfaceField(nextSource, "WorkspaceBindingSourceConfig", "block", "\tblock?: string;");
171830
172065
  nextSource = ensureInterfaceField(nextSource, "WorkspaceAbilityConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD);
171831
172066
  nextSource = ensureInterfaceField(nextSource, "WorkspaceAiFeatureConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD);
171832
172067
  nextSource = appendEntriesAtMarker(nextSource, EDITOR_PLUGIN_CONFIG_ENTRY_MARKER, editorPluginEntries);
@@ -171841,6 +172076,6 @@ async function appendWorkspaceInventoryEntries(projectDir, options) {
171841
172076
  }
171842
172077
  }
171843
172078
 
171844
- export { HOOKED_BLOCK_POSITION_SET, HOOKED_BLOCK_ANCHOR_PATTERN, toKebabCase, toSnakeCase, toPascalCase, toSegmentPascalCase, toTitleCase, validateBlockSlug, validateNamespace, normalizeBlockSlug, resolveNonEmptyNormalizedBlockSlug, buildBlockCssClassName, buildFrontendCssClassName, resolveScaffoldIdentifiers, ADD_KIND_IDS, REST_RESOURCE_METHOD_IDS, EDITOR_PLUGIN_SLOT_IDS, ADD_BLOCK_TEMPLATE_IDS, REST_RESOURCE_NAMESPACE_PATTERN, assertValidGeneratedSlug, resolveRestResourceNamespace, assertValidRestResourceMethods, assertValidHookedBlockPosition, getWorkspaceBootstrapPath, buildWorkspacePhpPrefix, isAddBlockTemplateId, quoteTsString, patchFile, readOptionalFile, snapshotWorkspaceFiles, rollbackWorkspaceMutation, resolveWorkspaceBlock, assertValidHookAnchor, assertValidEditorPluginSlot, readWorkspaceBlockJson, getMutableBlockHooks, assertVariationDoesNotExist, assertPatternDoesNotExist, assertBindingSourceDoesNotExist, assertRestResourceDoesNotExist, assertAbilityDoesNotExist, assertAiFeatureDoesNotExist, assertEditorPluginDoesNotExist, formatAddHelpText, readWorkspaceInventory, getWorkspaceBlockSelectOptions, appendWorkspaceInventoryEntries };
172079
+ export { HOOKED_BLOCK_POSITION_SET, HOOKED_BLOCK_ANCHOR_PATTERN, toKebabCase, toSnakeCase, toPascalCase, toSegmentPascalCase, toTitleCase, validateBlockSlug, validateNamespace, normalizeBlockSlug, resolveNonEmptyNormalizedBlockSlug, buildBlockCssClassName, buildFrontendCssClassName, resolveScaffoldIdentifiers, ADD_KIND_IDS, REST_RESOURCE_METHOD_IDS, EDITOR_PLUGIN_SLOT_IDS, resolveEditorPluginSlotAlias, ADD_BLOCK_TEMPLATE_IDS, REST_RESOURCE_NAMESPACE_PATTERN, assertValidGeneratedSlug, resolveRestResourceNamespace, assertValidRestResourceMethods, assertValidHookedBlockPosition, getWorkspaceBootstrapPath, buildWorkspacePhpPrefix, isAddBlockTemplateId, quoteTsString, patchFile, readOptionalFile, snapshotWorkspaceFiles, rollbackWorkspaceMutation, resolveWorkspaceBlock, assertValidHookAnchor, assertValidEditorPluginSlot, readWorkspaceBlockJson, getMutableBlockHooks, assertVariationDoesNotExist, assertPatternDoesNotExist, assertBindingSourceDoesNotExist, assertRestResourceDoesNotExist, assertAdminViewDoesNotExist, assertAbilityDoesNotExist, assertAiFeatureDoesNotExist, assertEditorPluginDoesNotExist, formatAddHelpText, require_typescript, escapeRegex, quotePhpString, hasPhpFunctionDefinition, findPhpFunctionRange, replacePhpFunctionDefinition, readWorkspaceInventory, getWorkspaceBlockSelectOptions, updateWorkspaceInventorySource, appendWorkspaceInventoryEntries };
171845
172080
 
171846
- //# debugId=42AF31D5CC3A7C2364756E2164756E21
172081
+ //# debugId=7A04762E8A3709A864756E2164756E21