wp-typia 0.22.5 → 0.22.6

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,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  WORKSPACE_TEMPLATE_PACKAGE
4
- } from "./cli-btbpt84c.js";
4
+ } from "./cli-hhp1d348.js";
5
5
  import {
6
6
  __commonJS,
7
7
  __require,
@@ -170911,45 +170911,7 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
170911
170911
  } });
170912
170912
  });
170913
170913
 
170914
- // ../wp-typia-project-tools/src/runtime/string-case.ts
170915
- function capitalizeSegment(segment) {
170916
- return segment.charAt(0).toUpperCase() + segment.slice(1);
170917
- }
170918
- function toKebabCase(input) {
170919
- return input.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[^A-Za-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-").toLowerCase();
170920
- }
170921
- function toSnakeCase(input) {
170922
- return toKebabCase(input).replace(/-/g, "_");
170923
- }
170924
- function toPascalCase(input) {
170925
- return toKebabCase(input).split("-").filter(Boolean).map(capitalizeSegment).join("");
170926
- }
170927
- function toCamelCase(input) {
170928
- const pascalCase = toPascalCase(input);
170929
- return `${pascalCase.charAt(0).toLowerCase()}${pascalCase.slice(1)}`;
170930
- }
170931
- function toSegmentPascalCase(input) {
170932
- return input.replace(/[^A-Za-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean).map(capitalizeSegment).join("");
170933
- }
170934
- function toTitleCase(input) {
170935
- return toKebabCase(input).split("-").filter(Boolean).map(capitalizeSegment).join(" ");
170936
- }
170937
-
170938
170914
  // ../wp-typia-project-tools/src/runtime/cli-add-types.ts
170939
- var ADD_KIND_IDS = [
170940
- "admin-view",
170941
- "block",
170942
- "variation",
170943
- "style",
170944
- "transform",
170945
- "pattern",
170946
- "binding-source",
170947
- "rest-resource",
170948
- "ability",
170949
- "ai-feature",
170950
- "hooked-block",
170951
- "editor-plugin"
170952
- ];
170953
170915
  var REST_RESOURCE_METHOD_IDS = [
170954
170916
  "list",
170955
170917
  "read",
@@ -170983,6 +170945,76 @@ var HOOKED_BLOCK_POSITION_IDS = ["before", "after", "firstChild", "lastChild"];
170983
170945
  var HOOKED_BLOCK_POSITION_SET = new Set(HOOKED_BLOCK_POSITION_IDS);
170984
170946
  var HOOKED_BLOCK_ANCHOR_PATTERN = /^[a-z0-9-]+\/[a-z0-9-]+$/;
170985
170947
 
170948
+ // ../wp-typia-project-tools/src/runtime/string-case.ts
170949
+ var COMMON_ACRONYM_PREFIXES = [
170950
+ "HTML",
170951
+ "HTTP",
170952
+ "JSON",
170953
+ "REST",
170954
+ "UUID",
170955
+ "API",
170956
+ "CSS",
170957
+ "CTA",
170958
+ "DOM",
170959
+ "PHP",
170960
+ "SQL",
170961
+ "SVG",
170962
+ "URL",
170963
+ "XML",
170964
+ "ID",
170965
+ "JS",
170966
+ "UI",
170967
+ "WP"
170968
+ ];
170969
+ function capitalizeSegment(segment) {
170970
+ return segment.charAt(0).toUpperCase() + segment.slice(1);
170971
+ }
170972
+ function findCommonAcronymPrefix(segment) {
170973
+ return COMMON_ACRONYM_PREFIXES.find((prefix) => segment.startsWith(prefix));
170974
+ }
170975
+ function splitKnownAcronymSegment(segment) {
170976
+ const prefixes = [];
170977
+ let remaining = segment;
170978
+ while (remaining.length > 0) {
170979
+ const prefix = findCommonAcronymPrefix(remaining);
170980
+ if (!prefix) {
170981
+ break;
170982
+ }
170983
+ const suffix = remaining.slice(prefix.length);
170984
+ if (/^[A-Z][a-z]/.test(suffix)) {
170985
+ return [...prefixes, prefix, suffix].join("-");
170986
+ }
170987
+ if (!findCommonAcronymPrefix(suffix)) {
170988
+ break;
170989
+ }
170990
+ prefixes.push(prefix);
170991
+ remaining = suffix;
170992
+ }
170993
+ return segment;
170994
+ }
170995
+ function splitAcronymBoundary(value) {
170996
+ return value.replace(/[A-Z]{2,}[a-z]+/g, splitKnownAcronymSegment);
170997
+ }
170998
+ function toKebabCase(input) {
170999
+ return splitAcronymBoundary(input.trim()).replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[^A-Za-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-").toLowerCase();
171000
+ }
171001
+ function toSnakeCase(input) {
171002
+ return toKebabCase(input).replace(/-/g, "_");
171003
+ }
171004
+ function toPascalCase(input) {
171005
+ return toKebabCase(input).split("-").filter(Boolean).map(capitalizeSegment).join("");
171006
+ }
171007
+ function toCamelCase(input) {
171008
+ const pascalCase = toPascalCase(input);
171009
+ return `${pascalCase.charAt(0).toLowerCase()}${pascalCase.slice(1)}`;
171010
+ }
171011
+ function toSegmentPascalCase(input) {
171012
+ return input.replace(/[^A-Za-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean).map(capitalizeSegment).join("");
171013
+ }
171014
+ function toTitleCase(input) {
171015
+ return toKebabCase(input).split("-").filter(Boolean).map(capitalizeSegment).join(" ");
171016
+ }
171017
+
170986
171018
  // ../wp-typia-project-tools/src/runtime/cli-add-validation.ts
170987
171019
  var WORKSPACE_GENERATED_SLUG_PATTERN = /^[a-z][a-z0-9-]*$/;
170988
171020
  var REST_RESOURCE_NAMESPACE_PATTERN = /^[a-z][a-z0-9-]*(?:\/[a-z0-9-]+)+$/u;
@@ -171053,60 +171085,6 @@ function assertValidEditorPluginSlot(slot = "sidebar") {
171053
171085
  throw new Error(`Editor plugin slot must be one of: ${EDITOR_PLUGIN_SLOT_IDS.join(", ")}. Legacy aliases: PluginSidebar, PluginDocumentSettingPanel.`);
171054
171086
  }
171055
171087
 
171056
- // ../wp-typia-project-tools/src/runtime/cli-add-filesystem.ts
171057
- import { promises as fsp } from "fs";
171058
- import path from "path";
171059
- function getWorkspaceBootstrapPath(workspace) {
171060
- const workspaceBaseName = workspace.packageName.split("/").pop() ?? workspace.packageName;
171061
- return path.join(workspace.projectDir, `${workspaceBaseName}.php`);
171062
- }
171063
- async function patchFile(filePath, transform) {
171064
- const currentSource = await fsp.readFile(filePath, "utf8");
171065
- const nextSource = transform(currentSource);
171066
- if (nextSource !== currentSource) {
171067
- await fsp.writeFile(filePath, nextSource, "utf8");
171068
- }
171069
- }
171070
- async function readOptionalFile(filePath) {
171071
- try {
171072
- return await fsp.readFile(filePath, "utf8");
171073
- } catch (error) {
171074
- if (isFileNotFoundError(error)) {
171075
- return null;
171076
- }
171077
- throw error;
171078
- }
171079
- }
171080
- async function restoreOptionalFile(filePath, source) {
171081
- if (source === null) {
171082
- await fsp.rm(filePath, { force: true });
171083
- return;
171084
- }
171085
- await fsp.mkdir(path.dirname(filePath), { recursive: true });
171086
- await fsp.writeFile(filePath, source, "utf8");
171087
- }
171088
- async function snapshotWorkspaceFiles(filePaths) {
171089
- const uniquePaths = Array.from(new Set(filePaths));
171090
- return Promise.all(uniquePaths.map(async (filePath) => ({
171091
- filePath,
171092
- source: await readOptionalFile(filePath)
171093
- })));
171094
- }
171095
- async function rollbackWorkspaceMutation(snapshot) {
171096
- for (const targetPath of snapshot.targetPaths) {
171097
- await fsp.rm(targetPath, { force: true, recursive: true });
171098
- }
171099
- for (const snapshotDir of snapshot.snapshotDirs) {
171100
- await fsp.rm(snapshotDir, { force: true, recursive: true });
171101
- }
171102
- for (const { filePath, source } of snapshot.fileSources) {
171103
- await restoreOptionalFile(filePath, source);
171104
- }
171105
- }
171106
- function isFileNotFoundError(error) {
171107
- return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
171108
- }
171109
-
171110
171088
  // ../wp-typia-project-tools/src/runtime/cli-add-help.ts
171111
171089
  function formatAddHelpText() {
171112
171090
  return `Usage:
@@ -171130,7 +171108,7 @@ Notes:
171130
171108
  \`add admin-view\` scaffolds an opt-in DataViews-powered WordPress admin screen under \`src/admin-views/\`.
171131
171109
  Pass \`--source rest-resource:<slug>\` to reuse a list-capable REST resource.
171132
171110
  Pass \`--source core-data:postType/post\` or \`--source core-data:taxonomy/category\` to bind a WordPress-owned entity collection.
171133
- Public installs currently gate this workflow until \`@wp-typia/dataviews\` is published to npm.
171111
+ Generated admin-view workspaces add \`@wp-typia/dataviews\` and the needed WordPress DataViews packages as opt-in dependencies.
171134
171112
  \`query-loop\` is a create-time scaffold family. Use \`wp-typia create <project-dir> --template query-loop\` instead of \`wp-typia add block\`.
171135
171113
  \`add variation\` targets an existing block slug from \`scripts/block-config.ts\`.
171136
171114
  \`add style\` registers a Block Styles option for an existing generated block.
@@ -171221,6 +171199,59 @@ function resolveScaffoldIdentifiers({
171221
171199
  textDomain: resolveValidatedTextDomain(textDomain ?? normalizedSlug)
171222
171200
  };
171223
171201
  }
171202
+ // ../wp-typia-project-tools/src/runtime/cli-add-filesystem.ts
171203
+ import { promises as fsp } from "fs";
171204
+ import path from "path";
171205
+ function getWorkspaceBootstrapPath(workspace) {
171206
+ const workspaceBaseName = workspace.packageName.split("/").pop() ?? workspace.packageName;
171207
+ return path.join(workspace.projectDir, `${workspaceBaseName}.php`);
171208
+ }
171209
+ async function patchFile(filePath, transform) {
171210
+ const currentSource = await fsp.readFile(filePath, "utf8");
171211
+ const nextSource = transform(currentSource);
171212
+ if (nextSource !== currentSource) {
171213
+ await fsp.writeFile(filePath, nextSource, "utf8");
171214
+ }
171215
+ }
171216
+ async function readOptionalFile(filePath) {
171217
+ try {
171218
+ return await fsp.readFile(filePath, "utf8");
171219
+ } catch (error) {
171220
+ if (isFileNotFoundError(error)) {
171221
+ return null;
171222
+ }
171223
+ throw error;
171224
+ }
171225
+ }
171226
+ async function restoreOptionalFile(filePath, source) {
171227
+ if (source === null) {
171228
+ await fsp.rm(filePath, { force: true });
171229
+ return;
171230
+ }
171231
+ await fsp.mkdir(path.dirname(filePath), { recursive: true });
171232
+ await fsp.writeFile(filePath, source, "utf8");
171233
+ }
171234
+ async function snapshotWorkspaceFiles(filePaths) {
171235
+ const uniquePaths = Array.from(new Set(filePaths));
171236
+ return Promise.all(uniquePaths.map(async (filePath) => ({
171237
+ filePath,
171238
+ source: await readOptionalFile(filePath)
171239
+ })));
171240
+ }
171241
+ async function rollbackWorkspaceMutation(snapshot) {
171242
+ for (const targetPath of snapshot.targetPaths) {
171243
+ await fsp.rm(targetPath, { force: true, recursive: true });
171244
+ }
171245
+ for (const snapshotDir of snapshot.snapshotDirs) {
171246
+ await fsp.rm(snapshotDir, { force: true, recursive: true });
171247
+ }
171248
+ for (const { filePath, source } of snapshot.fileSources) {
171249
+ await restoreOptionalFile(filePath, source);
171250
+ }
171251
+ }
171252
+ function isFileNotFoundError(error) {
171253
+ return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
171254
+ }
171224
171255
  // ../wp-typia-project-tools/src/runtime/cli-add-block-json.ts
171225
171256
  import fs from "fs";
171226
171257
  import path2 from "path";
@@ -171274,179 +171305,244 @@ function assertScaffoldDoesNotExist(options) {
171274
171305
  throw new Error(options.inventoryCollision.message);
171275
171306
  }
171276
171307
  }
171277
- function assertVariationDoesNotExist(projectDir, blockSlug, variationSlug, inventory) {
171308
+ function assertAddKindScaffoldDoesNotExist(options) {
171309
+ const inventoryCollision = options.descriptor.inventoryCollision;
171278
171310
  assertScaffoldDoesNotExist({
171279
- filesystemCollisions: [
171280
- {
171281
- label: "A variation",
171282
- relativePath: path3.join("src", "blocks", blockSlug, "variations", `${variationSlug}.ts`)
171283
- }
171284
- ],
171285
- inventoryCollision: {
171286
- entries: inventory.variations,
171287
- exists: (entry) => entry.block === blockSlug && entry.slug === variationSlug,
171288
- message: `A variation inventory entry already exists for ${blockSlug}/${variationSlug}. Choose a different name.`
171311
+ filesystemCollisions: options.descriptor.filesystemCollisions.map((collision) => ({
171312
+ label: collision.label,
171313
+ relativePath: collision.relativePath(options.context)
171314
+ })),
171315
+ inventoryCollision: inventoryCollision ? {
171316
+ entries: inventoryCollision.entries(options.inventory),
171317
+ exists: (entry) => inventoryCollision.exists(entry, options.context),
171318
+ message: inventoryCollision.message(options.context)
171319
+ } : undefined,
171320
+ projectDir: options.projectDir
171321
+ });
171322
+ }
171323
+ var VARIATION_COLLISION_DESCRIPTOR = {
171324
+ filesystemCollisions: [
171325
+ {
171326
+ label: "A variation",
171327
+ relativePath: ({ blockSlug, slug }) => path3.join("src", "blocks", blockSlug, "variations", `${slug}.ts`)
171328
+ }
171329
+ ],
171330
+ inventoryCollision: {
171331
+ entries: (inventory) => inventory.variations,
171332
+ exists: (entry, { blockSlug, slug }) => entry.block === blockSlug && entry.slug === slug,
171333
+ message: ({ blockSlug, slug }) => `A variation inventory entry already exists for ${blockSlug}/${slug}. Choose a different name.`
171334
+ }
171335
+ };
171336
+ var BLOCK_STYLE_COLLISION_DESCRIPTOR = {
171337
+ filesystemCollisions: [
171338
+ {
171339
+ label: "A block style",
171340
+ relativePath: ({ blockSlug, slug }) => path3.join("src", "blocks", blockSlug, "styles", `${slug}.ts`)
171341
+ }
171342
+ ],
171343
+ inventoryCollision: {
171344
+ entries: (inventory) => inventory.blockStyles,
171345
+ exists: (entry, { blockSlug, slug }) => entry.block === blockSlug && entry.slug === slug,
171346
+ message: ({ blockSlug, slug }) => `A block style inventory entry already exists for ${blockSlug}/${slug}. Choose a different name.`
171347
+ }
171348
+ };
171349
+ var BLOCK_TRANSFORM_COLLISION_DESCRIPTOR = {
171350
+ filesystemCollisions: [
171351
+ {
171352
+ label: "A block transform",
171353
+ relativePath: ({ blockSlug, slug }) => path3.join("src", "blocks", blockSlug, "transforms", `${slug}.ts`)
171354
+ }
171355
+ ],
171356
+ inventoryCollision: {
171357
+ entries: (inventory) => inventory.blockTransforms,
171358
+ exists: (entry, { blockSlug, slug }) => entry.block === blockSlug && entry.slug === slug,
171359
+ message: ({ blockSlug, slug }) => `A block transform inventory entry already exists for ${blockSlug}/${slug}. Choose a different name.`
171360
+ }
171361
+ };
171362
+ var PATTERN_COLLISION_DESCRIPTOR = {
171363
+ filesystemCollisions: [
171364
+ {
171365
+ label: "A pattern",
171366
+ relativePath: ({ slug }) => path3.join("src", "patterns", `${slug}.php`)
171367
+ }
171368
+ ],
171369
+ inventoryCollision: {
171370
+ entries: (inventory) => inventory.patterns,
171371
+ exists: (entry, { slug }) => entry.slug === slug,
171372
+ message: ({ slug }) => `A pattern inventory entry already exists for ${slug}. Choose a different name.`
171373
+ }
171374
+ };
171375
+ var BINDING_SOURCE_COLLISION_DESCRIPTOR = {
171376
+ filesystemCollisions: [
171377
+ {
171378
+ label: "A binding source",
171379
+ relativePath: ({ slug }) => path3.join("src", "bindings", slug)
171380
+ }
171381
+ ],
171382
+ inventoryCollision: {
171383
+ entries: (inventory) => inventory.bindingSources,
171384
+ exists: (entry, { slug }) => entry.slug === slug,
171385
+ message: ({ slug }) => `A binding source inventory entry already exists for ${slug}. Choose a different name.`
171386
+ }
171387
+ };
171388
+ var REST_RESOURCE_COLLISION_DESCRIPTOR = {
171389
+ filesystemCollisions: [
171390
+ {
171391
+ label: "A REST resource",
171392
+ relativePath: ({ slug }) => path3.join("src", "rest", slug)
171393
+ },
171394
+ {
171395
+ label: "A REST resource bootstrap",
171396
+ relativePath: ({ slug }) => path3.join("inc", "rest", `${slug}.php`)
171397
+ }
171398
+ ],
171399
+ inventoryCollision: {
171400
+ entries: (inventory) => inventory.restResources,
171401
+ exists: (entry, { slug }) => entry.slug === slug,
171402
+ message: ({ slug }) => `A REST resource inventory entry already exists for ${slug}. Choose a different name.`
171403
+ }
171404
+ };
171405
+ var ADMIN_VIEW_COLLISION_DESCRIPTOR = {
171406
+ filesystemCollisions: [
171407
+ {
171408
+ label: "An admin view",
171409
+ relativePath: ({ slug }) => path3.join("src", "admin-views", slug)
171410
+ },
171411
+ {
171412
+ label: "An admin view bootstrap",
171413
+ relativePath: ({ slug }) => path3.join("inc", "admin-views", `${slug}.php`)
171414
+ }
171415
+ ],
171416
+ inventoryCollision: {
171417
+ entries: (inventory) => inventory.adminViews,
171418
+ exists: (entry, { slug }) => entry.slug === slug,
171419
+ message: ({ slug }) => `An admin view inventory entry already exists for ${slug}. Choose a different name.`
171420
+ }
171421
+ };
171422
+ var ABILITY_COLLISION_DESCRIPTOR = {
171423
+ filesystemCollisions: [
171424
+ {
171425
+ label: "An ability scaffold",
171426
+ relativePath: ({ slug }) => path3.join("src", "abilities", slug)
171289
171427
  },
171428
+ {
171429
+ label: "An ability bootstrap",
171430
+ relativePath: ({ slug }) => path3.join("inc", "abilities", `${slug}.php`)
171431
+ }
171432
+ ],
171433
+ inventoryCollision: {
171434
+ entries: (inventory) => inventory.abilities,
171435
+ exists: (entry, { slug }) => entry.slug === slug,
171436
+ message: ({ slug }) => `An ability inventory entry already exists for ${slug}. Choose a different name.`
171437
+ }
171438
+ };
171439
+ var AI_FEATURE_COLLISION_DESCRIPTOR = {
171440
+ filesystemCollisions: [
171441
+ {
171442
+ label: "An AI feature",
171443
+ relativePath: ({ slug }) => path3.join("src", "ai-features", slug)
171444
+ },
171445
+ {
171446
+ label: "An AI feature bootstrap",
171447
+ relativePath: ({ slug }) => path3.join("inc", "ai-features", `${slug}.php`)
171448
+ }
171449
+ ],
171450
+ inventoryCollision: {
171451
+ entries: (inventory) => inventory.aiFeatures,
171452
+ exists: (entry, { slug }) => entry.slug === slug,
171453
+ message: ({ slug }) => `An AI feature inventory entry already exists for ${slug}. Choose a different name.`
171454
+ }
171455
+ };
171456
+ var EDITOR_PLUGIN_COLLISION_DESCRIPTOR = {
171457
+ filesystemCollisions: [
171458
+ {
171459
+ label: "An editor plugin",
171460
+ relativePath: ({ slug }) => path3.join("src", "editor-plugins", slug)
171461
+ }
171462
+ ],
171463
+ inventoryCollision: {
171464
+ entries: (inventory) => inventory.editorPlugins,
171465
+ exists: (entry, { slug }) => entry.slug === slug,
171466
+ message: ({ slug }) => `An editor plugin inventory entry already exists for ${slug}. Choose a different name.`
171467
+ }
171468
+ };
171469
+ function assertVariationDoesNotExist(projectDir, blockSlug, variationSlug, inventory) {
171470
+ assertAddKindScaffoldDoesNotExist({
171471
+ context: { blockSlug, slug: variationSlug },
171472
+ descriptor: VARIATION_COLLISION_DESCRIPTOR,
171473
+ inventory,
171290
171474
  projectDir
171291
171475
  });
171292
171476
  }
171293
171477
  function assertBlockStyleDoesNotExist(projectDir, blockSlug, styleSlug, inventory) {
171294
- assertScaffoldDoesNotExist({
171295
- filesystemCollisions: [
171296
- {
171297
- label: "A block style",
171298
- relativePath: path3.join("src", "blocks", blockSlug, "styles", `${styleSlug}.ts`)
171299
- }
171300
- ],
171301
- inventoryCollision: {
171302
- entries: inventory.blockStyles,
171303
- exists: (entry) => entry.block === blockSlug && entry.slug === styleSlug,
171304
- message: `A block style inventory entry already exists for ${blockSlug}/${styleSlug}. Choose a different name.`
171305
- },
171478
+ assertAddKindScaffoldDoesNotExist({
171479
+ context: { blockSlug, slug: styleSlug },
171480
+ descriptor: BLOCK_STYLE_COLLISION_DESCRIPTOR,
171481
+ inventory,
171306
171482
  projectDir
171307
171483
  });
171308
171484
  }
171309
171485
  function assertBlockTransformDoesNotExist(projectDir, blockSlug, transformSlug, inventory) {
171310
- assertScaffoldDoesNotExist({
171311
- filesystemCollisions: [
171312
- {
171313
- label: "A block transform",
171314
- relativePath: path3.join("src", "blocks", blockSlug, "transforms", `${transformSlug}.ts`)
171315
- }
171316
- ],
171317
- inventoryCollision: {
171318
- entries: inventory.blockTransforms,
171319
- exists: (entry) => entry.block === blockSlug && entry.slug === transformSlug,
171320
- message: `A block transform inventory entry already exists for ${blockSlug}/${transformSlug}. Choose a different name.`
171321
- },
171486
+ assertAddKindScaffoldDoesNotExist({
171487
+ context: { blockSlug, slug: transformSlug },
171488
+ descriptor: BLOCK_TRANSFORM_COLLISION_DESCRIPTOR,
171489
+ inventory,
171322
171490
  projectDir
171323
171491
  });
171324
171492
  }
171325
171493
  function assertPatternDoesNotExist(projectDir, patternSlug, inventory) {
171326
- assertScaffoldDoesNotExist({
171327
- filesystemCollisions: [
171328
- {
171329
- label: "A pattern",
171330
- relativePath: path3.join("src", "patterns", `${patternSlug}.php`)
171331
- }
171332
- ],
171333
- inventoryCollision: {
171334
- entries: inventory.patterns,
171335
- exists: (entry) => entry.slug === patternSlug,
171336
- message: `A pattern inventory entry already exists for ${patternSlug}. Choose a different name.`
171337
- },
171494
+ assertAddKindScaffoldDoesNotExist({
171495
+ context: { slug: patternSlug },
171496
+ descriptor: PATTERN_COLLISION_DESCRIPTOR,
171497
+ inventory,
171338
171498
  projectDir
171339
171499
  });
171340
171500
  }
171341
171501
  function assertBindingSourceDoesNotExist(projectDir, bindingSourceSlug, inventory) {
171342
- assertScaffoldDoesNotExist({
171343
- filesystemCollisions: [
171344
- {
171345
- label: "A binding source",
171346
- relativePath: path3.join("src", "bindings", bindingSourceSlug)
171347
- }
171348
- ],
171349
- inventoryCollision: {
171350
- entries: inventory.bindingSources,
171351
- exists: (entry) => entry.slug === bindingSourceSlug,
171352
- message: `A binding source inventory entry already exists for ${bindingSourceSlug}. Choose a different name.`
171353
- },
171502
+ assertAddKindScaffoldDoesNotExist({
171503
+ context: { slug: bindingSourceSlug },
171504
+ descriptor: BINDING_SOURCE_COLLISION_DESCRIPTOR,
171505
+ inventory,
171354
171506
  projectDir
171355
171507
  });
171356
171508
  }
171357
171509
  function assertRestResourceDoesNotExist(projectDir, restResourceSlug, inventory) {
171358
- assertScaffoldDoesNotExist({
171359
- filesystemCollisions: [
171360
- {
171361
- label: "A REST resource",
171362
- relativePath: path3.join("src", "rest", restResourceSlug)
171363
- },
171364
- {
171365
- label: "A REST resource bootstrap",
171366
- relativePath: path3.join("inc", "rest", `${restResourceSlug}.php`)
171367
- }
171368
- ],
171369
- inventoryCollision: {
171370
- entries: inventory.restResources,
171371
- exists: (entry) => entry.slug === restResourceSlug,
171372
- message: `A REST resource inventory entry already exists for ${restResourceSlug}. Choose a different name.`
171373
- },
171510
+ assertAddKindScaffoldDoesNotExist({
171511
+ context: { slug: restResourceSlug },
171512
+ descriptor: REST_RESOURCE_COLLISION_DESCRIPTOR,
171513
+ inventory,
171374
171514
  projectDir
171375
171515
  });
171376
171516
  }
171377
171517
  function assertAdminViewDoesNotExist(projectDir, adminViewSlug, inventory) {
171378
- assertScaffoldDoesNotExist({
171379
- filesystemCollisions: [
171380
- {
171381
- label: "An admin view",
171382
- relativePath: path3.join("src", "admin-views", adminViewSlug)
171383
- },
171384
- {
171385
- label: "An admin view bootstrap",
171386
- relativePath: path3.join("inc", "admin-views", `${adminViewSlug}.php`)
171387
- }
171388
- ],
171389
- inventoryCollision: {
171390
- entries: inventory.adminViews,
171391
- exists: (entry) => entry.slug === adminViewSlug,
171392
- message: `An admin view inventory entry already exists for ${adminViewSlug}. Choose a different name.`
171393
- },
171518
+ assertAddKindScaffoldDoesNotExist({
171519
+ context: { slug: adminViewSlug },
171520
+ descriptor: ADMIN_VIEW_COLLISION_DESCRIPTOR,
171521
+ inventory,
171394
171522
  projectDir
171395
171523
  });
171396
171524
  }
171397
171525
  function assertAbilityDoesNotExist(projectDir, abilitySlug, inventory) {
171398
- assertScaffoldDoesNotExist({
171399
- filesystemCollisions: [
171400
- {
171401
- label: "An ability scaffold",
171402
- relativePath: path3.join("src", "abilities", abilitySlug)
171403
- },
171404
- {
171405
- label: "An ability bootstrap",
171406
- relativePath: path3.join("inc", "abilities", `${abilitySlug}.php`)
171407
- }
171408
- ],
171409
- inventoryCollision: {
171410
- entries: inventory.abilities,
171411
- exists: (entry) => entry.slug === abilitySlug,
171412
- message: `An ability inventory entry already exists for ${abilitySlug}. Choose a different name.`
171413
- },
171526
+ assertAddKindScaffoldDoesNotExist({
171527
+ context: { slug: abilitySlug },
171528
+ descriptor: ABILITY_COLLISION_DESCRIPTOR,
171529
+ inventory,
171414
171530
  projectDir
171415
171531
  });
171416
171532
  }
171417
171533
  function assertAiFeatureDoesNotExist(projectDir, aiFeatureSlug, inventory) {
171418
- assertScaffoldDoesNotExist({
171419
- filesystemCollisions: [
171420
- {
171421
- label: "An AI feature",
171422
- relativePath: path3.join("src", "ai-features", aiFeatureSlug)
171423
- },
171424
- {
171425
- label: "An AI feature bootstrap",
171426
- relativePath: path3.join("inc", "ai-features", `${aiFeatureSlug}.php`)
171427
- }
171428
- ],
171429
- inventoryCollision: {
171430
- entries: inventory.aiFeatures,
171431
- exists: (entry) => entry.slug === aiFeatureSlug,
171432
- message: `An AI feature inventory entry already exists for ${aiFeatureSlug}. Choose a different name.`
171433
- },
171534
+ assertAddKindScaffoldDoesNotExist({
171535
+ context: { slug: aiFeatureSlug },
171536
+ descriptor: AI_FEATURE_COLLISION_DESCRIPTOR,
171537
+ inventory,
171434
171538
  projectDir
171435
171539
  });
171436
171540
  }
171437
171541
  function assertEditorPluginDoesNotExist(projectDir, editorPluginSlug, inventory) {
171438
- assertScaffoldDoesNotExist({
171439
- filesystemCollisions: [
171440
- {
171441
- label: "An editor plugin",
171442
- relativePath: path3.join("src", "editor-plugins", editorPluginSlug)
171443
- }
171444
- ],
171445
- inventoryCollision: {
171446
- entries: inventory.editorPlugins,
171447
- exists: (entry) => entry.slug === editorPluginSlug,
171448
- message: `An editor plugin inventory entry already exists for ${editorPluginSlug}. Choose a different name.`
171449
- },
171542
+ assertAddKindScaffoldDoesNotExist({
171543
+ context: { slug: editorPluginSlug },
171544
+ descriptor: EDITOR_PLUGIN_COLLISION_DESCRIPTOR,
171545
+ inventory,
171450
171546
  projectDir
171451
171547
  });
171452
171548
  }
@@ -171466,6 +171562,229 @@ function quotePhpString(value) {
171466
171562
  function hasPhpFunctionDefinition(source, functionName) {
171467
171563
  return new RegExp(`function\\s+${escapeRegex(functionName)}\\s*\\(`, "u").test(source);
171468
171564
  }
171565
+ function isPhpIdentifierStart(character) {
171566
+ return /^[A-Za-z_]$/u.test(character ?? "");
171567
+ }
171568
+ function isPhpIdentifierPart(character) {
171569
+ return /^[A-Za-z0-9_]$/u.test(character ?? "");
171570
+ }
171571
+ function isPhpLineStart(source, index) {
171572
+ return index === 0 || source[index - 1] === `
171573
+ `;
171574
+ }
171575
+ function isPhpHorizontalWhitespace(character) {
171576
+ return character === " " || character === "\t";
171577
+ }
171578
+ function isPhpWhitespace(character) {
171579
+ return typeof character === "string" && /\s/u.test(character);
171580
+ }
171581
+ function findPhpLineBoundary(source, index) {
171582
+ const newlineIndex = source.indexOf(`
171583
+ `, index);
171584
+ if (newlineIndex === -1) {
171585
+ return {
171586
+ contentEnd: source.endsWith("\r") ? source.length - 1 : source.length,
171587
+ nextStart: source.length
171588
+ };
171589
+ }
171590
+ return {
171591
+ contentEnd: source[newlineIndex - 1] === "\r" ? newlineIndex - 1 : newlineIndex,
171592
+ nextStart: newlineIndex + 1
171593
+ };
171594
+ }
171595
+ function parsePhpHeredocStart(source, index) {
171596
+ if (!source.startsWith("<<<", index)) {
171597
+ return null;
171598
+ }
171599
+ let cursor = index + 3;
171600
+ while (isPhpHorizontalWhitespace(source[cursor])) {
171601
+ cursor += 1;
171602
+ }
171603
+ const quote = source[cursor] === "'" || source[cursor] === '"' ? source[cursor] : "";
171604
+ if (quote) {
171605
+ cursor += 1;
171606
+ }
171607
+ if (!isPhpIdentifierStart(source[cursor])) {
171608
+ return null;
171609
+ }
171610
+ const delimiterStart = cursor;
171611
+ cursor += 1;
171612
+ while (isPhpIdentifierPart(source[cursor])) {
171613
+ cursor += 1;
171614
+ }
171615
+ const delimiter = source.slice(delimiterStart, cursor);
171616
+ if (quote) {
171617
+ if (source[cursor] !== quote) {
171618
+ return null;
171619
+ }
171620
+ cursor += 1;
171621
+ }
171622
+ const lineBoundary = findPhpLineBoundary(source, cursor);
171623
+ if (source.slice(cursor, lineBoundary.contentEnd).trim() !== "") {
171624
+ return null;
171625
+ }
171626
+ return {
171627
+ contentStart: lineBoundary.nextStart,
171628
+ delimiter
171629
+ };
171630
+ }
171631
+ function findPhpHeredocClosingEnd(source, index, delimiter) {
171632
+ if (!isPhpLineStart(source, index)) {
171633
+ return null;
171634
+ }
171635
+ let cursor = index;
171636
+ while (isPhpHorizontalWhitespace(source[cursor])) {
171637
+ cursor += 1;
171638
+ }
171639
+ if (!source.startsWith(delimiter, cursor)) {
171640
+ return null;
171641
+ }
171642
+ cursor += delimiter.length;
171643
+ if (isPhpIdentifierPart(source[cursor])) {
171644
+ return null;
171645
+ }
171646
+ let continuationCursor = cursor;
171647
+ while (isPhpHorizontalWhitespace(source[continuationCursor])) {
171648
+ continuationCursor += 1;
171649
+ }
171650
+ const continuation = source[continuationCursor];
171651
+ if (continuationCursor >= source.length || continuation === "\r" || continuation === `
171652
+ ` || !isPhpIdentifierPart(continuation)) {
171653
+ return cursor;
171654
+ }
171655
+ return null;
171656
+ }
171657
+ function skipPhpCallTrivia(source, index) {
171658
+ let cursor = index;
171659
+ while (cursor < source.length) {
171660
+ while (isPhpWhitespace(source[cursor])) {
171661
+ cursor += 1;
171662
+ }
171663
+ if (source[cursor] === "/" && source[cursor + 1] === "*") {
171664
+ const commentEnd = source.indexOf("*/", cursor + 2);
171665
+ if (commentEnd === -1) {
171666
+ return null;
171667
+ }
171668
+ cursor = commentEnd + 2;
171669
+ continue;
171670
+ }
171671
+ if (source[cursor] === "/" && source[cursor + 1] === "/") {
171672
+ cursor = findPhpLineBoundary(source, cursor + 2).nextStart;
171673
+ continue;
171674
+ }
171675
+ if (source[cursor] === "#" && source[cursor + 1] !== "[") {
171676
+ cursor = findPhpLineBoundary(source, cursor + 1).nextStart;
171677
+ continue;
171678
+ }
171679
+ return cursor;
171680
+ }
171681
+ return cursor;
171682
+ }
171683
+ function matchesPhpFunctionCallAt(source, index, functionName) {
171684
+ if (!source.startsWith(functionName, index)) {
171685
+ return false;
171686
+ }
171687
+ if (isPhpIdentifierPart(source[index - 1])) {
171688
+ return false;
171689
+ }
171690
+ const cursor = index + functionName.length;
171691
+ if (isPhpIdentifierPart(source[cursor])) {
171692
+ return false;
171693
+ }
171694
+ const callStart = skipPhpCallTrivia(source, cursor);
171695
+ return callStart !== null && source[callStart] === "(";
171696
+ }
171697
+ function hasPhpFunctionCall(source, functionName) {
171698
+ let mode = "code";
171699
+ let heredocDelimiter = "";
171700
+ let index = 0;
171701
+ while (index < source.length) {
171702
+ const character = source[index];
171703
+ if (mode === "heredoc") {
171704
+ const closingEnd = findPhpHeredocClosingEnd(source, index, heredocDelimiter);
171705
+ if (closingEnd !== null) {
171706
+ mode = "code";
171707
+ heredocDelimiter = "";
171708
+ index = closingEnd;
171709
+ continue;
171710
+ }
171711
+ const nextLineStart = findPhpLineBoundary(source, index).nextStart;
171712
+ if (nextLineStart <= index) {
171713
+ return false;
171714
+ }
171715
+ index = nextLineStart;
171716
+ continue;
171717
+ }
171718
+ if (mode === "single-quoted" || mode === "double-quoted") {
171719
+ const quote = mode === "single-quoted" ? "'" : '"';
171720
+ if (character === "\\") {
171721
+ index += 2;
171722
+ continue;
171723
+ }
171724
+ if (character === quote) {
171725
+ mode = "code";
171726
+ }
171727
+ index += 1;
171728
+ continue;
171729
+ }
171730
+ if (mode === "line-comment") {
171731
+ if (character === "\r" || character === `
171732
+ `) {
171733
+ mode = "code";
171734
+ }
171735
+ index += 1;
171736
+ continue;
171737
+ }
171738
+ if (mode === "block-comment") {
171739
+ if (character === "*" && source[index + 1] === "/") {
171740
+ mode = "code";
171741
+ index += 2;
171742
+ continue;
171743
+ }
171744
+ index += 1;
171745
+ continue;
171746
+ }
171747
+ if (character === "'") {
171748
+ mode = "single-quoted";
171749
+ index += 1;
171750
+ continue;
171751
+ }
171752
+ if (character === '"') {
171753
+ mode = "double-quoted";
171754
+ index += 1;
171755
+ continue;
171756
+ }
171757
+ if (character === "/" && source[index + 1] === "/") {
171758
+ mode = "line-comment";
171759
+ index += 2;
171760
+ continue;
171761
+ }
171762
+ if (character === "#" && source[index + 1] !== "[") {
171763
+ mode = "line-comment";
171764
+ index += 1;
171765
+ continue;
171766
+ }
171767
+ if (character === "/" && source[index + 1] === "*") {
171768
+ mode = "block-comment";
171769
+ index += 2;
171770
+ continue;
171771
+ }
171772
+ if (character === "<") {
171773
+ const heredocStart = parsePhpHeredocStart(source, index);
171774
+ if (heredocStart) {
171775
+ mode = "heredoc";
171776
+ heredocDelimiter = heredocStart.delimiter;
171777
+ index = heredocStart.contentStart;
171778
+ continue;
171779
+ }
171780
+ }
171781
+ if (matchesPhpFunctionCallAt(source, index, functionName)) {
171782
+ return true;
171783
+ }
171784
+ index += 1;
171785
+ }
171786
+ return false;
171787
+ }
171469
171788
  function findPhpFunctionRange(source, functionName, options = {}) {
171470
171789
  const signaturePattern = new RegExp(`function\\s+${escapeRegex(functionName)}\\s*\\([^)]*\\)\\s*(?::\\s*[^{};]+)?\\s*\\{`, "u");
171471
171790
  const signatureMatch = signaturePattern.exec(source);
@@ -171479,13 +171798,96 @@ function findPhpFunctionRange(source, functionName, options = {}) {
171479
171798
  }
171480
171799
  const openBraceIndex = functionStart + openBraceOffset;
171481
171800
  let depth = 0;
171482
- for (let index = openBraceIndex;index < source.length; index += 1) {
171801
+ let mode = "code";
171802
+ let heredocDelimiter = "";
171803
+ let index = openBraceIndex;
171804
+ while (index < source.length) {
171483
171805
  const character = source[index];
171806
+ if (mode === "heredoc") {
171807
+ const closingEnd = findPhpHeredocClosingEnd(source, index, heredocDelimiter);
171808
+ if (closingEnd !== null) {
171809
+ mode = "code";
171810
+ heredocDelimiter = "";
171811
+ index = closingEnd;
171812
+ continue;
171813
+ }
171814
+ const nextLineStart = findPhpLineBoundary(source, index).nextStart;
171815
+ if (nextLineStart <= index) {
171816
+ return null;
171817
+ }
171818
+ index = nextLineStart;
171819
+ continue;
171820
+ }
171821
+ if (mode === "single-quoted" || mode === "double-quoted") {
171822
+ const quote = mode === "single-quoted" ? "'" : '"';
171823
+ if (character === "\\") {
171824
+ index += 2;
171825
+ continue;
171826
+ }
171827
+ if (character === quote) {
171828
+ mode = "code";
171829
+ }
171830
+ index += 1;
171831
+ continue;
171832
+ }
171833
+ if (mode === "line-comment") {
171834
+ if (character === "\r" || character === `
171835
+ `) {
171836
+ mode = "code";
171837
+ }
171838
+ index += 1;
171839
+ continue;
171840
+ }
171841
+ if (mode === "block-comment") {
171842
+ if (character === "*" && source[index + 1] === "/") {
171843
+ mode = "code";
171844
+ index += 2;
171845
+ continue;
171846
+ }
171847
+ index += 1;
171848
+ continue;
171849
+ }
171850
+ if (character === "'") {
171851
+ mode = "single-quoted";
171852
+ index += 1;
171853
+ continue;
171854
+ }
171855
+ if (character === '"') {
171856
+ mode = "double-quoted";
171857
+ index += 1;
171858
+ continue;
171859
+ }
171860
+ if (character === "/" && source[index + 1] === "/") {
171861
+ mode = "line-comment";
171862
+ index += 2;
171863
+ continue;
171864
+ }
171865
+ if (character === "#" && source[index + 1] !== "[") {
171866
+ mode = "line-comment";
171867
+ index += 1;
171868
+ continue;
171869
+ }
171870
+ if (character === "/" && source[index + 1] === "*") {
171871
+ mode = "block-comment";
171872
+ index += 2;
171873
+ continue;
171874
+ }
171875
+ if (character === "<") {
171876
+ const heredocStart = parsePhpHeredocStart(source, index);
171877
+ if (heredocStart) {
171878
+ mode = "heredoc";
171879
+ heredocDelimiter = heredocStart.delimiter;
171880
+ index = heredocStart.contentStart;
171881
+ continue;
171882
+ }
171883
+ }
171484
171884
  if (character === "{") {
171485
171885
  depth += 1;
171886
+ index += 1;
171486
171887
  continue;
171487
171888
  }
171488
171889
  if (character !== "}") {
171890
+ index += 1;
171489
171891
  continue;
171490
171892
  }
171491
171893
  depth -= 1;
@@ -171502,6 +171904,7 @@ function findPhpFunctionRange(source, functionName, options = {}) {
171502
171904
  start: functionStart
171503
171905
  };
171504
171906
  }
171907
+ index += 1;
171505
171908
  }
171506
171909
  return null;
171507
171910
  }
@@ -171717,6 +172120,10 @@ export const EDITOR_PLUGINS: WorkspaceEditorPluginConfig[] = [
171717
172120
  ];
171718
172121
  `;
171719
172122
  var BLOCK_INVENTORY_SECTION = {
172123
+ append: {
172124
+ marker: BLOCK_CONFIG_ENTRY_MARKER,
172125
+ optionKey: "blockEntries"
172126
+ },
171720
172127
  parse: {
171721
172128
  entriesKey: "blocks",
171722
172129
  entry: defineInventoryEntryParser({
@@ -171735,6 +172142,10 @@ var BLOCK_INVENTORY_SECTION = {
171735
172142
  };
171736
172143
  var INVENTORY_SECTIONS = [
171737
172144
  {
172145
+ append: {
172146
+ marker: VARIATION_CONFIG_ENTRY_MARKER,
172147
+ optionKey: "variationEntries"
172148
+ },
171738
172149
  interface: {
171739
172150
  name: "WorkspaceVariationConfig",
171740
172151
  section: VARIATIONS_INTERFACE_SECTION
@@ -171757,6 +172168,10 @@ var INVENTORY_SECTIONS = [
171757
172168
  }
171758
172169
  },
171759
172170
  {
172171
+ append: {
172172
+ marker: BLOCK_STYLE_CONFIG_ENTRY_MARKER,
172173
+ optionKey: "blockStyleEntries"
172174
+ },
171760
172175
  interface: {
171761
172176
  name: "WorkspaceBlockStyleConfig",
171762
172177
  section: BLOCK_STYLES_INTERFACE_SECTION
@@ -171779,6 +172194,10 @@ var INVENTORY_SECTIONS = [
171779
172194
  }
171780
172195
  },
171781
172196
  {
172197
+ append: {
172198
+ marker: BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER,
172199
+ optionKey: "blockTransformEntries"
172200
+ },
171782
172201
  interface: {
171783
172202
  name: "WorkspaceBlockTransformConfig",
171784
172203
  section: BLOCK_TRANSFORMS_INTERFACE_SECTION
@@ -171803,6 +172222,10 @@ var INVENTORY_SECTIONS = [
171803
172222
  }
171804
172223
  },
171805
172224
  {
172225
+ append: {
172226
+ marker: PATTERN_CONFIG_ENTRY_MARKER,
172227
+ optionKey: "patternEntries"
172228
+ },
171806
172229
  interface: {
171807
172230
  name: "WorkspacePatternConfig",
171808
172231
  section: PATTERNS_INTERFACE_SECTION
@@ -171824,6 +172247,10 @@ var INVENTORY_SECTIONS = [
171824
172247
  }
171825
172248
  },
171826
172249
  {
172250
+ append: {
172251
+ marker: BINDING_SOURCE_CONFIG_ENTRY_MARKER,
172252
+ optionKey: "bindingSourceEntries"
172253
+ },
171827
172254
  interface: {
171828
172255
  name: "WorkspaceBindingSourceConfig",
171829
172256
  section: BINDING_SOURCES_INTERFACE_SECTION
@@ -171848,6 +172275,10 @@ var INVENTORY_SECTIONS = [
171848
172275
  }
171849
172276
  },
171850
172277
  {
172278
+ append: {
172279
+ marker: REST_RESOURCE_CONFIG_ENTRY_MARKER,
172280
+ optionKey: "restResourceEntries"
172281
+ },
171851
172282
  interface: {
171852
172283
  name: "WorkspaceRestResourceConfig",
171853
172284
  section: REST_RESOURCES_INTERFACE_SECTION
@@ -171888,6 +172319,10 @@ var INVENTORY_SECTIONS = [
171888
172319
  }
171889
172320
  },
171890
172321
  {
172322
+ append: {
172323
+ marker: ABILITY_CONFIG_ENTRY_MARKER,
172324
+ optionKey: "abilityEntries"
172325
+ },
171891
172326
  interface: {
171892
172327
  name: "WorkspaceAbilityConfig",
171893
172328
  section: ABILITIES_INTERFACE_SECTION
@@ -171917,6 +172352,10 @@ var INVENTORY_SECTIONS = [
171917
172352
  }
171918
172353
  },
171919
172354
  {
172355
+ append: {
172356
+ marker: AI_FEATURE_CONFIG_ENTRY_MARKER,
172357
+ optionKey: "aiFeatureEntries"
172358
+ },
171920
172359
  interface: {
171921
172360
  name: "WorkspaceAiFeatureConfig",
171922
172361
  section: AI_FEATURES_INTERFACE_SECTION
@@ -171946,6 +172385,10 @@ var INVENTORY_SECTIONS = [
171946
172385
  }
171947
172386
  },
171948
172387
  {
172388
+ append: {
172389
+ marker: ADMIN_VIEW_CONFIG_ENTRY_MARKER,
172390
+ optionKey: "adminViewEntries"
172391
+ },
171949
172392
  interface: {
171950
172393
  name: "WorkspaceAdminViewConfig",
171951
172394
  section: ADMIN_VIEWS_INTERFACE_SECTION
@@ -171969,6 +172412,10 @@ var INVENTORY_SECTIONS = [
171969
172412
  }
171970
172413
  },
171971
172414
  {
172415
+ append: {
172416
+ marker: EDITOR_PLUGIN_CONFIG_ENTRY_MARKER,
172417
+ optionKey: "editorPluginEntries"
172418
+ },
171972
172419
  interface: {
171973
172420
  name: "WorkspaceEditorPluginConfig",
171974
172421
  section: EDITOR_PLUGINS_INTERFACE_SECTION
@@ -172213,6 +172660,16 @@ function appendEntriesAtMarker(source, marker, entries) {
172213
172660
  `)}
172214
172661
  ${marker}`);
172215
172662
  }
172663
+ function appendInventorySectionEntries(source, options) {
172664
+ let nextSource = source;
172665
+ for (const section of [BLOCK_INVENTORY_SECTION, ...INVENTORY_SECTIONS]) {
172666
+ if (!section.append) {
172667
+ continue;
172668
+ }
172669
+ nextSource = appendEntriesAtMarker(nextSource, section.append.marker, options[section.append.optionKey] ?? []);
172670
+ }
172671
+ return nextSource;
172672
+ }
172216
172673
  function ensureInterfaceField(source, interfaceName, fieldName, fieldSource) {
172217
172674
  const interfacePattern = new RegExp(`(export\\s+interface\\s+${escapeRegex(interfaceName)}\\s*\\{\\r?\\n)([\\s\\S]*?)(\\r?\\n\\})`, "u");
172218
172675
  return source.replace(interfacePattern, (match, start, body, end) => {
@@ -172260,41 +172717,18 @@ function normalizeInterfaceFieldBlock(source, interfaceName, fieldName, fieldSou
172260
172717
  return `${start}${body.slice(0, fieldMatch.index)}${formattedFieldSource}${body.slice(fieldMatch.index + existingFieldSource.length)}${end}`;
172261
172718
  });
172262
172719
  }
172263
- function updateWorkspaceInventorySource(source, {
172264
- blockEntries = [],
172265
- blockStyleEntries = [],
172266
- blockTransformEntries = [],
172267
- bindingSourceEntries = [],
172268
- abilityEntries = [],
172269
- adminViewEntries = [],
172270
- aiFeatureEntries = [],
172271
- editorPluginEntries = [],
172272
- patternEntries = [],
172273
- restResourceEntries = [],
172274
- variationEntries = [],
172275
- transformSource
172276
- } = {}) {
172720
+ function updateWorkspaceInventorySource(source, options = {}) {
172277
172721
  let nextSource = ensureWorkspaceInventorySections(source);
172278
- if (transformSource) {
172279
- nextSource = transformSource(nextSource);
172722
+ if (options.transformSource) {
172723
+ nextSource = options.transformSource(nextSource);
172280
172724
  }
172281
- nextSource = appendEntriesAtMarker(nextSource, BLOCK_CONFIG_ENTRY_MARKER, blockEntries);
172282
- nextSource = appendEntriesAtMarker(nextSource, VARIATION_CONFIG_ENTRY_MARKER, variationEntries);
172283
- nextSource = appendEntriesAtMarker(nextSource, BLOCK_STYLE_CONFIG_ENTRY_MARKER, blockStyleEntries);
172284
- nextSource = appendEntriesAtMarker(nextSource, BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER, blockTransformEntries);
172285
- nextSource = appendEntriesAtMarker(nextSource, PATTERN_CONFIG_ENTRY_MARKER, patternEntries);
172286
- nextSource = appendEntriesAtMarker(nextSource, BINDING_SOURCE_CONFIG_ENTRY_MARKER, bindingSourceEntries);
172287
- nextSource = appendEntriesAtMarker(nextSource, REST_RESOURCE_CONFIG_ENTRY_MARKER, restResourceEntries);
172288
- nextSource = appendEntriesAtMarker(nextSource, ABILITY_CONFIG_ENTRY_MARKER, abilityEntries);
172289
- nextSource = appendEntriesAtMarker(nextSource, AI_FEATURE_CONFIG_ENTRY_MARKER, aiFeatureEntries);
172290
- nextSource = appendEntriesAtMarker(nextSource, ADMIN_VIEW_CONFIG_ENTRY_MARKER, adminViewEntries);
172725
+ nextSource = appendInventorySectionEntries(nextSource, options);
172291
172726
  nextSource = ensureInterfaceField(nextSource, "WorkspaceBindingSourceConfig", "attribute", "\tattribute?: string;");
172292
172727
  nextSource = ensureInterfaceField(nextSource, "WorkspaceBindingSourceConfig", "block", "\tblock?: string;");
172293
172728
  nextSource = ensureInterfaceField(nextSource, "WorkspaceAbilityConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD);
172294
172729
  nextSource = normalizeInterfaceFieldBlock(nextSource, "WorkspaceAbilityConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD, ["optionalFeatureIds: string[];", "requiredFeatureIds: string[];"]);
172295
172730
  nextSource = ensureInterfaceField(nextSource, "WorkspaceAiFeatureConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD);
172296
172731
  nextSource = normalizeInterfaceFieldBlock(nextSource, "WorkspaceAiFeatureConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD, ["optionalFeatureIds: string[];", "requiredFeatureIds: string[];"]);
172297
- nextSource = appendEntriesAtMarker(nextSource, EDITOR_PLUGIN_CONFIG_ENTRY_MARKER, editorPluginEntries);
172298
172732
  return nextSource;
172299
172733
  }
172300
172734
  async function appendWorkspaceInventoryEntries(projectDir, options) {
@@ -172306,6 +172740,6 @@ async function appendWorkspaceInventoryEntries(projectDir, options) {
172306
172740
  }
172307
172741
  }
172308
172742
 
172309
- export { toKebabCase, toSnakeCase, toPascalCase, toCamelCase, 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, HOOKED_BLOCK_POSITION_SET, HOOKED_BLOCK_ANCHOR_PATTERN, REST_RESOURCE_NAMESPACE_PATTERN, assertValidGeneratedSlug, resolveRestResourceNamespace, assertValidRestResourceMethods, assertValidHookedBlockPosition, buildWorkspacePhpPrefix, isAddBlockTemplateId, quoteTsString, assertValidHookAnchor, assertValidEditorPluginSlot, getWorkspaceBootstrapPath, patchFile, readOptionalFile, snapshotWorkspaceFiles, rollbackWorkspaceMutation, resolveWorkspaceBlock, readWorkspaceBlockJson, getMutableBlockHooks, assertVariationDoesNotExist, assertBlockStyleDoesNotExist, assertBlockTransformDoesNotExist, assertPatternDoesNotExist, assertBindingSourceDoesNotExist, assertRestResourceDoesNotExist, assertAdminViewDoesNotExist, assertAbilityDoesNotExist, assertAiFeatureDoesNotExist, assertEditorPluginDoesNotExist, formatAddHelpText, require_typescript, escapeRegex, quotePhpString, hasPhpFunctionDefinition, findPhpFunctionRange, replacePhpFunctionDefinition, readWorkspaceInventory, getWorkspaceBlockSelectOptions, updateWorkspaceInventorySource, appendWorkspaceInventoryEntries };
172743
+ export { toKebabCase, toSnakeCase, toPascalCase, toCamelCase, toSegmentPascalCase, toTitleCase, validateBlockSlug, validateNamespace, normalizeBlockSlug, resolveNonEmptyNormalizedBlockSlug, buildBlockCssClassName, buildFrontendCssClassName, resolveScaffoldIdentifiers, REST_RESOURCE_METHOD_IDS, EDITOR_PLUGIN_SLOT_IDS, resolveEditorPluginSlotAlias, ADD_BLOCK_TEMPLATE_IDS, HOOKED_BLOCK_POSITION_SET, HOOKED_BLOCK_ANCHOR_PATTERN, REST_RESOURCE_NAMESPACE_PATTERN, assertValidGeneratedSlug, resolveRestResourceNamespace, assertValidRestResourceMethods, assertValidHookedBlockPosition, buildWorkspacePhpPrefix, isAddBlockTemplateId, quoteTsString, assertValidHookAnchor, assertValidEditorPluginSlot, getWorkspaceBootstrapPath, patchFile, readOptionalFile, snapshotWorkspaceFiles, rollbackWorkspaceMutation, resolveWorkspaceBlock, readWorkspaceBlockJson, getMutableBlockHooks, assertVariationDoesNotExist, assertBlockStyleDoesNotExist, assertBlockTransformDoesNotExist, assertPatternDoesNotExist, assertBindingSourceDoesNotExist, assertRestResourceDoesNotExist, assertAdminViewDoesNotExist, assertAbilityDoesNotExist, assertAiFeatureDoesNotExist, assertEditorPluginDoesNotExist, formatAddHelpText, require_typescript, escapeRegex, quotePhpString, hasPhpFunctionDefinition, hasPhpFunctionCall, findPhpFunctionRange, replacePhpFunctionDefinition, readWorkspaceInventory, getWorkspaceBlockSelectOptions, updateWorkspaceInventorySource, appendWorkspaceInventoryEntries };
172310
172744
 
172311
- //# debugId=4D54C6227C5D15E364756E2164756E21
172745
+ //# debugId=17AFFAD165D90DE964756E2164756E21