wp-typia 0.19.0 → 0.20.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.
Files changed (42) hide show
  1. package/README.md +4 -2
  2. package/dist-bunli/.bunli/commands.gen.js +1843 -1216
  3. package/dist-bunli/.bunli/commands.gen.js.map +36 -33
  4. package/dist-bunli/cli-03j0axbt.js +163 -0
  5. package/dist-bunli/cli-03j0axbt.js.map +11 -0
  6. package/dist-bunli/{cli-7svz19s1.js → cli-2ybmc22r.js} +370 -86
  7. package/dist-bunli/{cli-7svz19s1.js.map → cli-2ybmc22r.js.map} +15 -14
  8. package/dist-bunli/cli-7yg38ht2.js +427 -0
  9. package/dist-bunli/cli-7yg38ht2.js.map +12 -0
  10. package/dist-bunli/{cli-yw0mq0wq.js → cli-93wd227r.js} +108 -3
  11. package/dist-bunli/cli-93wd227r.js.map +10 -0
  12. package/dist-bunli/{cli-kan7a6db.js → cli-a6dwqnhq.js} +24 -2
  13. package/dist-bunli/cli-a6dwqnhq.js.map +11 -0
  14. package/dist-bunli/{cli-add-j2c81sh1.js → cli-add-pq6wm87p.js} +16 -9
  15. package/dist-bunli/{cli-add-j2c81sh1.js.map → cli-add-pq6wm87p.js.map} +3 -3
  16. package/dist-bunli/{cli-diagnostics-c65hhyhx.js → cli-diagnostics-e5gxeprp.js} +8 -4
  17. package/dist-bunli/{cli-diagnostics-c65hhyhx.js.map → cli-diagnostics-e5gxeprp.js.map} +1 -1
  18. package/dist-bunli/{cli-doctor-hft0wr0e.js → cli-doctor-qk6fwpds.js} +14 -13
  19. package/dist-bunli/{cli-doctor-hft0wr0e.js.map → cli-doctor-qk6fwpds.js.map} +3 -3
  20. package/dist-bunli/{cli-572d6g4m.js → cli-hv2yedw2.js} +2 -157
  21. package/dist-bunli/{cli-572d6g4m.js.map → cli-hv2yedw2.js.map} +4 -6
  22. package/dist-bunli/{cli-scaffold-vcg6wem5.js → cli-scaffold-s3nhwe7x.js} +9 -7
  23. package/dist-bunli/cli-scaffold-s3nhwe7x.js.map +10 -0
  24. package/dist-bunli/cli-t73q5aqz.js +103 -0
  25. package/dist-bunli/cli-t73q5aqz.js.map +10 -0
  26. package/dist-bunli/{cli-templates-4qxszbmc.js → cli-templates-j65r4k9v.js} +1 -1
  27. package/dist-bunli/{cli-wtrvnce5.js → cli-w4r0rr8a.js} +8 -8
  28. package/dist-bunli/cli-w4r0rr8a.js.map +10 -0
  29. package/dist-bunli/cli.js +127 -2863
  30. package/dist-bunli/cli.js.map +5 -56
  31. package/dist-bunli/command-list-37n1za5q.js +2485 -0
  32. package/dist-bunli/command-list-37n1za5q.js.map +58 -0
  33. package/dist-bunli/node-cli.js +432 -323
  34. package/dist-bunli/node-cli.js.map +11 -10
  35. package/dist-bunli/{sync-x91y9jtv.js → sync-k2k8svyc.js} +3 -2
  36. package/dist-bunli/{sync-x91y9jtv.js.map → sync-k2k8svyc.js.map} +1 -1
  37. package/package.json +6 -3
  38. package/dist-bunli/cli-kan7a6db.js.map +0 -11
  39. package/dist-bunli/cli-scaffold-vcg6wem5.js.map +0 -10
  40. package/dist-bunli/cli-wtrvnce5.js.map +0 -10
  41. package/dist-bunli/cli-yw0mq0wq.js.map +0 -10
  42. /package/dist-bunli/{cli-templates-4qxszbmc.js.map → cli-templates-j65r4k9v.js.map} +0 -0
@@ -24,7 +24,7 @@ import {
24
24
  isOmittableBuiltInTemplateLayerDir,
25
25
  resolveBuiltInTemplateSource,
26
26
  resolveBuiltInTemplateSourceFromLayerDirs
27
- } from "./cli-wtrvnce5.js";
27
+ } from "./cli-w4r0rr8a.js";
28
28
  import {
29
29
  BUILTIN_BLOCK_METADATA_VERSION,
30
30
  BUILTIN_TEMPLATE_IDS,
@@ -40,7 +40,7 @@ import {
40
40
  getTemplateById,
41
41
  isBuiltInTemplateId,
42
42
  isRemovedBuiltInTemplateId
43
- } from "./cli-kan7a6db.js";
43
+ } from "./cli-a6dwqnhq.js";
44
44
  import {
45
45
  buildBlockCssClassName,
46
46
  buildFrontendCssClassName,
@@ -53,6 +53,9 @@ import {
53
53
  validateBlockSlug,
54
54
  validateNamespace
55
55
  } from "./cli-rg481yks.js";
56
+ import {
57
+ createManagedTempRoot
58
+ } from "./cli-t73q5aqz.js";
56
59
  import {
57
60
  __commonJS,
58
61
  __require,
@@ -5476,6 +5479,21 @@ function buildCompoundChildTypesSource(variables, attributes) {
5476
5479
  });
5477
5480
  }
5478
5481
 
5482
+ // ../wp-typia-project-tools/src/runtime/scaffold-template-variable-groups.ts
5483
+ var SCAFFOLD_TEMPLATE_VARIABLE_GROUPS = Symbol("wp-typia.scaffold-template-variable-groups");
5484
+ function attachScaffoldTemplateVariableGroups(variables, groups) {
5485
+ Object.defineProperty(variables, SCAFFOLD_TEMPLATE_VARIABLE_GROUPS, {
5486
+ configurable: false,
5487
+ enumerable: false,
5488
+ value: groups,
5489
+ writable: false
5490
+ });
5491
+ return variables;
5492
+ }
5493
+ function getScaffoldTemplateVariableGroups(variables) {
5494
+ return variables[SCAFFOLD_TEMPLATE_VARIABLE_GROUPS];
5495
+ }
5496
+
5479
5497
  // ../wp-typia-project-tools/src/runtime/built-in-block-artifacts.ts
5480
5498
  function stringifyBlockJsonDocument(document) {
5481
5499
  return `${JSON.stringify(document, null, "\t")}
@@ -5581,7 +5599,8 @@ function buildPersistenceArtifact(variables) {
5581
5599
  }
5582
5600
  function buildCompoundParentArtifact(variables) {
5583
5601
  const attributes = buildCompoundParentAttributes(variables);
5584
- const persistenceEnabled = variables.compoundPersistenceEnabled === "true";
5602
+ const compoundGroup = getScaffoldTemplateVariableGroups(variables).compound;
5603
+ const persistenceEnabled = compoundGroup.enabled && compoundGroup.persistenceEnabled;
5585
5604
  return {
5586
5605
  blockJsonDocument: {
5587
5606
  $schema: "https://schemas.wp.org/trunk/block.json",
@@ -5723,7 +5742,8 @@ async function writeStarterManifestFiles(targetDir, templateId, variables) {
5723
5742
  }
5724
5743
  }
5725
5744
  async function seedBuiltInPersistenceArtifacts(targetDir, templateId, variables) {
5726
- const needsPersistenceArtifacts = templateId === "persistence" || templateId === "compound" && variables.compoundPersistenceEnabled === "true";
5745
+ const compoundGroup = getScaffoldTemplateVariableGroups(variables).compound;
5746
+ const needsPersistenceArtifacts = templateId === "persistence" || templateId === "compound" && compoundGroup.enabled && compoundGroup.persistenceEnabled;
5727
5747
  if (!needsPersistenceArtifacts) {
5728
5748
  return;
5729
5749
  }
@@ -6143,7 +6163,7 @@ async function collectScaffoldAnswers({
6143
6163
 
6144
6164
  // ../wp-typia-project-tools/src/runtime/scaffold.ts
6145
6165
  import fs14 from "fs";
6146
- import { promises as fsp11 } from "fs";
6166
+ import { promises as fsp10 } from "fs";
6147
6167
  import path17 from "path";
6148
6168
 
6149
6169
  // ../wp-typia-project-tools/src/runtime/scaffold-apply-utils.ts
@@ -6365,21 +6385,22 @@ function buildReadme(templateId, variables, packageManager, {
6365
6385
  withTestPreset = false,
6366
6386
  withWpEnv = false
6367
6387
  } = {}) {
6388
+ const variableGroups = getScaffoldTemplateVariableGroups(variables);
6389
+ const compoundPersistenceEnabled = variableGroups.compound.enabled && variableGroups.compound.persistenceEnabled;
6368
6390
  const optionalOnboardingSteps = getOptionalOnboardingSteps(packageManager, templateId, {
6369
- compoundPersistenceEnabled: variables.compoundPersistenceEnabled === "true"
6391
+ compoundPersistenceEnabled
6370
6392
  });
6371
6393
  const initialCommitCommands = getInitialCommitCommands();
6372
6394
  const sourceOfTruthNote = getTemplateSourceOfTruthNote(templateId, {
6373
- compoundPersistenceEnabled: variables.compoundPersistenceEnabled === "true"
6395
+ compoundPersistenceEnabled
6374
6396
  });
6375
- const compoundPersistenceEnabled = variables.compoundPersistenceEnabled === "true";
6376
- const publicPersistencePolicyNote = variables.isPublicPersistencePolicy === "true" ? "Public persistence writes use signed short-lived tokens, per-request ids, and coarse rate limiting by default. Add application-specific abuse controls before using the same pattern for high-value metrics or experiments." : null;
6377
- const alternateRenderTargetSection = variables.hasAlternateRenderTargets === "true" ? `## Alternate Render Targets
6397
+ const publicPersistencePolicyNote = variableGroups.persistence.enabled && variableGroups.persistence.auth.isPublic ? "Public persistence writes use signed short-lived tokens, per-request ids, and coarse rate limiting by default. Add application-specific abuse controls before using the same pattern for high-value metrics or experiments." : null;
6398
+ const alternateRenderTargetSection = variableGroups.alternateRenderTargets.enabled ? `## Alternate Render Targets
6378
6399
 
6379
6400
  This scaffold keeps \`${templateId === "compound" ? `src/blocks/${variables.slugKebabCase}/render.php` : "src/render.php"}\` as the default web render boundary and also generates ${[
6380
- variables.hasAlternateEmailRenderTarget === "true" ? `\`${templateId === "compound" ? `src/blocks/${variables.slugKebabCase}/render-email.php` : "src/render-email.php"}\`` : null,
6381
- variables.hasAlternateMjmlRenderTarget === "true" ? `\`${templateId === "compound" ? `src/blocks/${variables.slugKebabCase}/render-mjml.php` : "src/render-mjml.php"}\`` : null,
6382
- variables.hasAlternatePlainTextRenderTarget === "true" ? `\`${templateId === "compound" ? `src/blocks/${variables.slugKebabCase}/render-text.php` : "src/render-text.php"}\`` : null
6401
+ variableGroups.alternateRenderTargets.hasEmail ? `\`${templateId === "compound" ? `src/blocks/${variables.slugKebabCase}/render-email.php` : "src/render-email.php"}\`` : null,
6402
+ variableGroups.alternateRenderTargets.hasMjml ? `\`${templateId === "compound" ? `src/blocks/${variables.slugKebabCase}/render-mjml.php` : "src/render-mjml.php"}\`` : null,
6403
+ variableGroups.alternateRenderTargets.hasPlainText ? `\`${templateId === "compound" ? `src/blocks/${variables.slugKebabCase}/render-text.php` : "src/render-text.php"}\`` : null
6383
6404
  ].filter((value) => Boolean(value)).join(", ")}. All of those entries delegate through \`${templateId === "compound" ? `src/blocks/${variables.slugKebabCase}/render-targets.php` : "src/render-targets.php"}\`, so attribute normalization, validation, and render-target adapter hooks stay aligned across web, email, MJML, and plain-text integrations.` : "";
6384
6405
  const compoundExtensionWorkflowSection = getCompoundExtensionWorkflowSection(packageManager, templateId);
6385
6406
  const compoundInnerBlocksSection = templateId === "compound" ? `## Compound InnerBlocks Presets
@@ -7241,8 +7262,6 @@ async function assertExternalTemplateLayersDoNotWriteProtectedOutputs({
7241
7262
 
7242
7263
  // ../wp-typia-project-tools/src/runtime/template-source-external.ts
7243
7264
  import fs9 from "fs";
7244
- import { promises as fsp8 } from "fs";
7245
- import os from "os";
7246
7265
  import path13 from "path";
7247
7266
  import { pathToFileURL } from "url";
7248
7267
  var EXTERNAL_TEMPLATE_ENTRY_CANDIDATES = [
@@ -7250,6 +7269,7 @@ var EXTERNAL_TEMPLATE_ENTRY_CANDIDATES = [
7250
7269
  "index.cjs",
7251
7270
  "index.mjs"
7252
7271
  ];
7272
+ var EXTERNAL_TEMPLATE_TRUST_WARNING = "External template configs execute trusted JavaScript during scaffolding. Review the template source before using local paths, GitHub repos, or npm packages you do not already trust.";
7253
7273
  var TEMPLATE_WARNING_MESSAGE = "wp-typia owns package/tooling/sync setup for generated projects, so this external template setting is ignored.";
7254
7274
  function getTemplateWarning(key) {
7255
7275
  return `Ignoring external template config key "${key}": ${TEMPLATE_WARNING_MESSAGE}`;
@@ -7282,7 +7302,7 @@ async function loadExternalTemplateConfig(sourceDir) {
7282
7302
  if (!isPlainObject(loadedConfig)) {
7283
7303
  throw new Error(`External template config must export an object: ${entryPath}`);
7284
7304
  }
7285
- const warnings = [];
7305
+ const warnings = [EXTERNAL_TEMPLATE_TRUST_WARNING];
7286
7306
  for (const ignoredKey of [
7287
7307
  "wpScripts",
7288
7308
  "wpEnv",
@@ -7379,10 +7399,7 @@ async function renderCreateBlockExternalTemplate(sourceDir, context, requestedVa
7379
7399
  const { config, warnings } = await loadExternalTemplateConfig(sourceDir);
7380
7400
  const { selectedVariant, variantConfig } = getVariantConfig(config, requestedVariant);
7381
7401
  const { folderName, formatHint, templatePath } = resolveConfiguredTemplatePath(config, variantConfig);
7382
- const tempRoot = await fsp8.mkdtemp(path13.join(os.tmpdir(), "wp-typia-create-block-external-"));
7383
- const cleanup = async () => {
7384
- await fsp8.rm(tempRoot, { force: true, recursive: true });
7385
- };
7402
+ const { path: tempRoot, cleanup } = await createManagedTempRoot("wp-typia-create-block-external-");
7386
7403
  try {
7387
7404
  const renderedRoot = path13.join(tempRoot, "rendered");
7388
7405
  const blockDir = resolveSourceSubpath(renderedRoot, folderName);
@@ -7415,9 +7432,24 @@ async function renderCreateBlockExternalTemplate(sourceDir, context, requestedVa
7415
7432
 
7416
7433
  // ../wp-typia-project-tools/src/runtime/template-source-remote.ts
7417
7434
  import fs10 from "fs";
7418
- import { promises as fsp9 } from "fs";
7419
- import os2 from "os";
7435
+ import { promises as fsp8 } from "fs";
7420
7436
  import path14 from "path";
7437
+ async function cleanupSeedRootPair(cleanup, seedCleanup) {
7438
+ let cleanupError;
7439
+ try {
7440
+ await cleanup();
7441
+ } catch (error) {
7442
+ cleanupError = error;
7443
+ }
7444
+ try {
7445
+ await seedCleanup?.();
7446
+ } catch (error) {
7447
+ cleanupError ??= error;
7448
+ }
7449
+ if (cleanupError !== undefined) {
7450
+ throw cleanupError;
7451
+ }
7452
+ }
7421
7453
  function getDefaultCategoryFromBlockJson(blockJson) {
7422
7454
  return typeof blockJson.category === "string" && blockJson.category.trim().length > 0 ? blockJson.category.trim() : "widgets";
7423
7455
  }
@@ -7450,19 +7482,33 @@ function readTemplatePackageJson(sourceDir) {
7450
7482
  continue;
7451
7483
  }
7452
7484
  try {
7453
- return JSON.parse(fs10.readFileSync(candidate, "utf8"));
7454
- } catch {
7455
- continue;
7485
+ return {
7486
+ packageJson: JSON.parse(fs10.readFileSync(candidate, "utf8")),
7487
+ sourcePath: candidate
7488
+ };
7489
+ } catch (error) {
7490
+ const message = error instanceof Error ? error.message : "Unknown parse failure";
7491
+ throw new Error(`Failed to parse template metadata file "${candidate}": ${message}`);
7456
7492
  }
7457
7493
  }
7458
7494
  return null;
7459
7495
  }
7460
7496
  function getTemplateProjectType(sourceDir) {
7461
- const packageJson = readTemplatePackageJson(sourceDir);
7462
- return typeof packageJson?.wpTypia?.projectType === "string" ? packageJson.wpTypia.projectType : null;
7497
+ const packageJsonEntry = readTemplatePackageJson(sourceDir);
7498
+ if (!packageJsonEntry) {
7499
+ return null;
7500
+ }
7501
+ const projectType = packageJsonEntry.packageJson.wpTypia?.projectType;
7502
+ if (projectType === undefined) {
7503
+ return null;
7504
+ }
7505
+ if (typeof projectType !== "string" || projectType.trim().length === 0) {
7506
+ throw new Error(`Template metadata file "${packageJsonEntry.sourcePath}" defines wpTypia.projectType, but it must be a non-empty string.`);
7507
+ }
7508
+ return projectType;
7463
7509
  }
7464
7510
  async function normalizeWpTypiaTemplateSeed(seed) {
7465
- const tempRoot = await fsp9.mkdtemp(path14.join(os2.tmpdir(), "wp-typia-template-source-"));
7511
+ const { path: tempRoot, cleanup } = await createManagedTempRoot("wp-typia-template-source-");
7466
7512
  const normalizedDir = path14.join(tempRoot, "template");
7467
7513
  try {
7468
7514
  await copyRawDirectory(seed.blockDir, normalizedDir, {
@@ -7472,21 +7518,18 @@ async function normalizeWpTypiaTemplateSeed(seed) {
7472
7518
  }
7473
7519
  });
7474
7520
  if (seed.assetsDir && fs10.existsSync(seed.assetsDir)) {
7475
- await fsp9.cp(seed.assetsDir, path14.join(normalizedDir, "assets"), {
7521
+ await fsp8.cp(seed.assetsDir, path14.join(normalizedDir, "assets"), {
7476
7522
  recursive: true,
7477
7523
  force: true
7478
7524
  });
7479
7525
  }
7480
7526
  } catch (error) {
7481
- await fsp9.rm(tempRoot, { force: true, recursive: true });
7527
+ await Promise.allSettled([cleanup(), seed.cleanup?.()]);
7482
7528
  throw error;
7483
7529
  }
7484
7530
  return {
7485
7531
  blockDir: normalizedDir,
7486
- cleanup: async () => {
7487
- await fsp9.rm(tempRoot, { force: true, recursive: true });
7488
- await seed.cleanup?.();
7489
- },
7532
+ cleanup: async () => cleanupSeedRootPair(cleanup, seed.cleanup),
7490
7533
  rootDir: normalizedDir,
7491
7534
  selectedVariant: seed.selectedVariant,
7492
7535
  warnings: seed.warnings
@@ -7566,9 +7609,9 @@ async function rewriteBlockJsonImports(directory) {
7566
7609
  const textExtensions = new Set([".js", ".jsx", ".ts", ".tsx"]);
7567
7610
  const targetBlockJsonPath = path14.join(directory, "block.json");
7568
7611
  async function visit(currentPath) {
7569
- const stats = await fsp9.stat(currentPath);
7612
+ const stats = await fsp8.stat(currentPath);
7570
7613
  if (stats.isDirectory()) {
7571
- const entries = await fsp9.readdir(currentPath);
7614
+ const entries = await fsp8.readdir(currentPath);
7572
7615
  for (const entry of entries) {
7573
7616
  await visit(path14.join(currentPath, entry));
7574
7617
  }
@@ -7577,19 +7620,19 @@ async function rewriteBlockJsonImports(directory) {
7577
7620
  if (!textExtensions.has(path14.extname(currentPath))) {
7578
7621
  return;
7579
7622
  }
7580
- const content = await fsp9.readFile(currentPath, "utf8");
7623
+ const content = await fsp8.readFile(currentPath, "utf8");
7581
7624
  const relativeSpecifier = path14.relative(path14.dirname(currentPath), targetBlockJsonPath).replace(/\\/g, "/");
7582
7625
  const normalizedSpecifier = relativeSpecifier.startsWith(".") ? relativeSpecifier : `./${relativeSpecifier}`;
7583
7626
  const next = content.replace(/(['"])\.{1,2}\/[^'"]*block\.json\1/g, `$1${normalizedSpecifier}$1`);
7584
7627
  if (next !== content) {
7585
- await fsp9.writeFile(currentPath, next, "utf8");
7628
+ await fsp8.writeFile(currentPath, next, "utf8");
7586
7629
  }
7587
7630
  }
7588
7631
  await visit(directory);
7589
7632
  }
7590
7633
  async function patchRemotePackageJson(templateDir, needsInteractivity) {
7591
7634
  const packageJsonPath = path14.join(templateDir, "package.json.mustache");
7592
- const packageJson = JSON.parse(await fsp9.readFile(packageJsonPath, "utf8"));
7635
+ const packageJson = JSON.parse(await fsp8.readFile(packageJsonPath, "utf8"));
7593
7636
  const existingDependencies = { ...packageJson.dependencies ?? {} };
7594
7637
  const existingDevDependencies = { ...packageJson.devDependencies ?? {} };
7595
7638
  delete existingDependencies["@wp-typia/project-tools"];
@@ -7609,7 +7652,7 @@ async function patchRemotePackageJson(templateDir, needsInteractivity) {
7609
7652
  } else {
7610
7653
  delete packageJson.dependencies;
7611
7654
  }
7612
- await fsp9.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
7655
+ await fsp8.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
7613
7656
  `, "utf8");
7614
7657
  }
7615
7658
  function getSeedSourceRoot(blockDir) {
@@ -7659,16 +7702,16 @@ async function removeSeedEntryConflicts(templateDir) {
7659
7702
  "view.ts",
7660
7703
  "view.tsx"
7661
7704
  ]) {
7662
- await fsp9.rm(path14.join(templateDir, "src", filename), { force: true });
7705
+ await fsp8.rm(path14.join(templateDir, "src", filename), { force: true });
7663
7706
  }
7664
7707
  }
7665
7708
  async function normalizeCreateBlockSubset(seed, context) {
7666
- const tempRoot = await fsp9.mkdtemp(path14.join(os2.tmpdir(), "wp-typia-remote-template-"));
7709
+ const { path: tempRoot, cleanup } = await createManagedTempRoot("wp-typia-remote-template-");
7667
7710
  try {
7668
7711
  const templateDir = path14.join(tempRoot, "template");
7669
7712
  const blockJson = readRemoteBlockJson(seed.blockDir);
7670
7713
  const sourceRoot = getSeedSourceRoot(seed.blockDir);
7671
- await fsp9.mkdir(templateDir, { recursive: true });
7714
+ await fsp8.mkdir(templateDir, { recursive: true });
7672
7715
  for (const layerDir of getBuiltInTemplateLayerDirs("basic")) {
7673
7716
  if (!fs10.existsSync(layerDir)) {
7674
7717
  if (isOmittableBuiltInTemplateLayerDir("basic", layerDir)) {
@@ -7676,28 +7719,28 @@ async function normalizeCreateBlockSubset(seed, context) {
7676
7719
  }
7677
7720
  throw new Error(`Built-in template layer is missing: ${layerDir}`);
7678
7721
  }
7679
- await fsp9.cp(layerDir, templateDir, {
7722
+ await fsp8.cp(layerDir, templateDir, {
7680
7723
  recursive: true,
7681
7724
  force: true
7682
7725
  });
7683
7726
  }
7684
7727
  await removeSeedEntryConflicts(templateDir);
7685
- await fsp9.cp(sourceRoot, path14.join(templateDir, "src"), {
7728
+ await fsp8.cp(sourceRoot, path14.join(templateDir, "src"), {
7686
7729
  recursive: true,
7687
7730
  force: true
7688
7731
  });
7689
7732
  const remoteRenderPath = findSeedRenderPhp(seed);
7690
7733
  if (remoteRenderPath) {
7691
- await fsp9.copyFile(remoteRenderPath, path14.join(templateDir, "render.php"));
7734
+ await fsp8.copyFile(remoteRenderPath, path14.join(templateDir, "render.php"));
7692
7735
  }
7693
7736
  if (seed.assetsDir && fs10.existsSync(seed.assetsDir)) {
7694
- await fsp9.cp(seed.assetsDir, path14.join(templateDir, "assets"), {
7737
+ await fsp8.cp(seed.assetsDir, path14.join(templateDir, "assets"), {
7695
7738
  recursive: true,
7696
7739
  force: true
7697
7740
  });
7698
7741
  }
7699
- await fsp9.writeFile(path14.join(templateDir, "src", "types.ts"), buildRemoteTypesSource(blockJson, context), "utf8");
7700
- await fsp9.writeFile(path14.join(templateDir, "src", "block.json"), buildRemoteBlockJsonTemplate(blockJson), "utf8");
7742
+ await fsp8.writeFile(path14.join(templateDir, "src", "types.ts"), buildRemoteTypesSource(blockJson, context), "utf8");
7743
+ await fsp8.writeFile(path14.join(templateDir, "src", "block.json"), buildRemoteBlockJsonTemplate(blockJson), "utf8");
7701
7744
  await rewriteBlockJsonImports(path14.join(templateDir, "src"));
7702
7745
  const needsInteractivity = typeof blockJson.viewScriptModule === "string" || typeof blockJson.viewScript === "string" || fs10.existsSync(path14.join(templateDir, "src", "view.js")) || fs10.existsSync(path14.join(templateDir, "src", "view.ts")) || fs10.existsSync(path14.join(templateDir, "src", "view.tsx")) || fs10.existsSync(path14.join(templateDir, "src", "interactivity.js")) || fs10.existsSync(path14.join(templateDir, "src", "interactivity.ts"));
7703
7746
  await patchRemotePackageJson(templateDir, needsInteractivity);
@@ -7714,16 +7757,10 @@ async function normalizeCreateBlockSubset(seed, context) {
7714
7757
  selectedVariant: seed.selectedVariant ?? null,
7715
7758
  templateDir,
7716
7759
  warnings: seed.warnings ?? [],
7717
- cleanup: async () => {
7718
- await fsp9.rm(tempRoot, { force: true, recursive: true });
7719
- if (seed.cleanup) {
7720
- await seed.cleanup();
7721
- }
7722
- }
7760
+ cleanup: async () => cleanupSeedRootPair(cleanup, seed.cleanup)
7723
7761
  };
7724
7762
  } catch (error) {
7725
- await fsp9.rm(tempRoot, { force: true, recursive: true });
7726
- await seed.cleanup?.();
7763
+ await Promise.allSettled([cleanup(), seed.cleanup?.()]);
7727
7764
  throw error;
7728
7765
  }
7729
7766
  }
@@ -7785,9 +7822,8 @@ async function detectTemplateSourceFormat(sourceDir) {
7785
7822
  // ../wp-typia-project-tools/src/runtime/template-source-seeds.ts
7786
7823
  var import_semver = __toESM(require_semver2(), 1);
7787
7824
  import fs13 from "fs";
7788
- import { promises as fsp10 } from "fs";
7825
+ import { promises as fsp9 } from "fs";
7789
7826
  import { createRequire as createRequire3 } from "module";
7790
- import os4 from "os";
7791
7827
  import path16 from "path";
7792
7828
  import { execFileSync } from "child_process";
7793
7829
 
@@ -9821,7 +9857,7 @@ var ls = Symbol("readdir");
9821
9857
  var ai = Symbol("onreaddir");
9822
9858
  var li = Symbol("pipe");
9823
9859
  var ir = Symbol("entry");
9824
- var os3 = Symbol("entryOpt");
9860
+ var os = Symbol("entryOpt");
9825
9861
  var ci = Symbol("writeEntryClass");
9826
9862
  var rr = Symbol("write");
9827
9863
  var hs = Symbol("ondrain");
@@ -9884,7 +9920,7 @@ var Et = class extends D {
9884
9920
  t.resume();
9885
9921
  else {
9886
9922
  let i = new di(t.path, e);
9887
- i.entry = new ri(t, this[os3](i)), i.entry.on("end", () => this[ns](i)), this[G] += 1, this[W].push(i);
9923
+ i.entry = new ri(t, this[os](i)), i.entry.on("end", () => this[ns](i)), this[G] += 1, this[W].push(i);
9888
9924
  }
9889
9925
  this[Ft]();
9890
9926
  }
@@ -9953,13 +9989,13 @@ var Et = class extends D {
9953
9989
  }
9954
9990
  }
9955
9991
  }
9956
- [os3](t) {
9992
+ [os](t) {
9957
9993
  return { onwarn: (e, i, r) => this.warn(e, i, r), noPax: this.noPax, cwd: this.cwd, absolute: t.absolute, preservePaths: this.preservePaths, maxReadSize: this.maxReadSize, strict: this.strict, portable: this.portable, linkCache: this.linkCache, statCache: this.statCache, noMtime: this.noMtime, mtime: this.mtime, prefix: this.prefix, onWriteEntry: this.onWriteEntry };
9958
9994
  }
9959
9995
  [ir](t) {
9960
9996
  this[G] += 1;
9961
9997
  try {
9962
- return new this[ci](t.path, this[os3](t)).on("end", () => this[ns](t)).on("error", (i) => this.emit("error", i));
9998
+ return new this[ci](t.path, this[os](t)).on("end", () => this[ns](t)).on("error", (i) => this.emit("error", i));
9963
9999
  } catch (e) {
9964
10000
  this.emit("error", e);
9965
10001
  }
@@ -10987,10 +11023,7 @@ async function fetchNpmTemplateSource(locator) {
10987
11023
  if (typeof tarballUrl !== "string" || tarballUrl.length === 0) {
10988
11024
  throw new Error(`npm template metadata is missing tarball URL for ${locator.raw}@${resolvedVersion}.`);
10989
11025
  }
10990
- const tempRoot = await fsp10.mkdtemp(path16.join(os4.tmpdir(), "wp-typia-template-source-"));
10991
- const cleanup = async () => {
10992
- await fsp10.rm(tempRoot, { force: true, recursive: true });
10993
- };
11026
+ const { path: tempRoot, cleanup } = await createManagedTempRoot("wp-typia-template-source-");
10994
11027
  try {
10995
11028
  const tarballResponse = await fetch(tarballUrl);
10996
11029
  if (!tarballResponse.ok) {
@@ -10998,8 +11031,8 @@ async function fetchNpmTemplateSource(locator) {
10998
11031
  }
10999
11032
  const tarballPath = path16.join(tempRoot, "template.tgz");
11000
11033
  const unpackDir = path16.join(tempRoot, "source");
11001
- await fsp10.mkdir(unpackDir, { recursive: true });
11002
- await fsp10.writeFile(tarballPath, Buffer.from(await tarballResponse.arrayBuffer()));
11034
+ await fsp9.mkdir(unpackDir, { recursive: true });
11035
+ await fsp9.writeFile(tarballPath, Buffer.from(await tarballResponse.arrayBuffer()));
11003
11036
  await co({
11004
11037
  cwd: unpackDir,
11005
11038
  file: tarballPath,
@@ -11082,22 +11115,19 @@ function isOfficialWorkspaceTemplateSeed(seed) {
11082
11115
  }
11083
11116
  }
11084
11117
  async function assertNoSymlinks2(sourceDir) {
11085
- const stats = await fsp10.lstat(sourceDir);
11118
+ const stats = await fsp9.lstat(sourceDir);
11086
11119
  if (stats.isSymbolicLink()) {
11087
11120
  throw new Error(`Template sources may not include symbolic links: ${sourceDir}`);
11088
11121
  }
11089
11122
  if (!stats.isDirectory()) {
11090
11123
  return;
11091
11124
  }
11092
- for (const entry of await fsp10.readdir(sourceDir)) {
11125
+ for (const entry of await fsp9.readdir(sourceDir)) {
11093
11126
  await assertNoSymlinks2(path16.join(sourceDir, entry));
11094
11127
  }
11095
11128
  }
11096
11129
  async function resolveGitHubTemplateSource(locator) {
11097
- const remoteRoot = await fsp10.mkdtemp(path16.join(os4.tmpdir(), "wp-typia-template-source-"));
11098
- const cleanup = async () => {
11099
- await fsp10.rm(remoteRoot, { force: true, recursive: true });
11100
- };
11130
+ const { path: remoteRoot, cleanup } = await createManagedTempRoot("wp-typia-template-source-");
11101
11131
  const checkoutDir = path16.join(remoteRoot, "source");
11102
11132
  try {
11103
11133
  const args = ["clone", "--depth", "1"];
@@ -11151,13 +11181,14 @@ async function resolveTemplateSeed(locator, cwd) {
11151
11181
  // ../wp-typia-project-tools/src/runtime/template-source.ts
11152
11182
  async function resolveTemplateSource(templateId, cwd, variables, variant) {
11153
11183
  if (isBuiltInTemplateId(templateId)) {
11184
+ const variableGroups = getScaffoldTemplateVariableGroups(variables);
11154
11185
  assertBuiltInTemplateVariantAllowed({
11155
11186
  templateId,
11156
11187
  variant
11157
11188
  });
11158
11189
  return resolveBuiltInTemplateSource(templateId, {
11159
- persistenceEnabled: variables.compoundPersistenceEnabled === "true",
11160
- persistencePolicy: variables.persistencePolicy === "public" ? "public" : "authenticated"
11190
+ persistenceEnabled: variableGroups.compound.enabled && variableGroups.compound.persistenceEnabled,
11191
+ persistencePolicy: variableGroups.persistence.enabled && variableGroups.persistence.policy === "public" ? "public" : "authenticated"
11161
11192
  });
11162
11193
  }
11163
11194
  const locator = parseTemplateLocator(templateId);
@@ -11375,11 +11406,12 @@ function buildTemplateVariablesFromBlockSpec(spec) {
11375
11406
  const compoundChildCssClassName = buildBlockCssClassName(namespace, `${slug}-item`);
11376
11407
  const compoundInnerBlocksPreset = spec.compound.innerBlocksPreset;
11377
11408
  const compoundInnerBlocksPresetDefinition = getCompoundInnerBlocksPresetDefinition(compoundInnerBlocksPreset);
11409
+ const compoundInnerBlocksOrientation = compoundInnerBlocksPresetDefinition.orientation ?? "";
11378
11410
  const persistenceEnabled = spec.persistence.enabled;
11379
11411
  const dataStorageMode = persistenceEnabled ? spec.persistence.dataStorageMode : "custom-table";
11380
11412
  const persistencePolicy = persistenceEnabled ? spec.persistence.persistencePolicy : "authenticated";
11381
11413
  const queryVariationNamespace = `${namespace}/${slug}`;
11382
- return {
11414
+ const flatVariables = {
11383
11415
  alternateRenderTargetsCsv: formatAlternateRenderTargets(alternateRenderTargets),
11384
11416
  alternateRenderTargetsJson: JSON.stringify(alternateRenderTargets),
11385
11417
  apiClientPackageVersion,
@@ -11396,7 +11428,7 @@ function buildTemplateVariablesFromBlockSpec(spec) {
11396
11428
  compoundChildTitleJson: JSON.stringify(compoundChildTitle),
11397
11429
  compoundPersistenceEnabled: spec.template.family === "compound" && persistenceEnabled ? "true" : "false",
11398
11430
  compoundInnerBlocksDirectInsert: compoundInnerBlocksPresetDefinition.directInsert ? "true" : "false",
11399
- compoundInnerBlocksOrientation: compoundInnerBlocksPresetDefinition.orientation ?? "",
11431
+ compoundInnerBlocksOrientation,
11400
11432
  compoundInnerBlocksOrientationExpression: compoundInnerBlocksPresetDefinition.orientation ? `'${compoundInnerBlocksPresetDefinition.orientation}'` : "undefined",
11401
11433
  compoundInnerBlocksPreset,
11402
11434
  compoundInnerBlocksPresetDescription: compoundInnerBlocksPresetDefinition.description,
@@ -11445,6 +11477,200 @@ function buildTemplateVariablesFromBlockSpec(spec) {
11445
11477
  titleCase: pascalCase,
11446
11478
  persistencePolicy
11447
11479
  };
11480
+ const shared = {
11481
+ author: spec.project.author,
11482
+ blockMetadataVersion: BUILTIN_BLOCK_METADATA_VERSION,
11483
+ category: spec.metadata.category,
11484
+ cssClassName,
11485
+ description: spec.metadata.description,
11486
+ descriptionJson: flatVariables.descriptionJson,
11487
+ frontendCssClassName: flatVariables.frontendCssClassName,
11488
+ icon: spec.metadata.icon,
11489
+ keyword: spec.metadata.keyword,
11490
+ namespace,
11491
+ pascalCase,
11492
+ phpPrefix,
11493
+ phpPrefixUpper,
11494
+ slug,
11495
+ slugCamelCase: flatVariables.slugCamelCase,
11496
+ slugKebabCase: slug,
11497
+ slugSnakeCase,
11498
+ textDomain,
11499
+ title,
11500
+ titleCase: pascalCase,
11501
+ titleJson: flatVariables.titleJson,
11502
+ versions: {
11503
+ apiClient: apiClientPackageVersion,
11504
+ blockRuntime: blockRuntimePackageVersion,
11505
+ blockTypes: blockTypesPackageVersion,
11506
+ projectTools: projectToolsPackageVersion,
11507
+ rest: restPackageVersion
11508
+ }
11509
+ };
11510
+ const alternateRenderTargetsGroup = {
11511
+ csv: flatVariables.alternateRenderTargetsCsv,
11512
+ enabled: alternateRenderTargets.length > 0,
11513
+ hasEmail: hasAlternateEmailRenderTarget,
11514
+ hasMjml: hasAlternateMjmlRenderTarget,
11515
+ hasPlainText: hasAlternatePlainTextRenderTarget,
11516
+ json: flatVariables.alternateRenderTargetsJson,
11517
+ targets: alternateRenderTargets
11518
+ };
11519
+ const compoundGroup = {
11520
+ child: {
11521
+ category: COMPOUND_CHILD_BLOCK_METADATA_DEFAULTS.category,
11522
+ cssClassName: compoundChildCssClassName,
11523
+ icon: COMPOUND_CHILD_BLOCK_METADATA_DEFAULTS.icon,
11524
+ title: compoundChildTitle,
11525
+ titleJson: JSON.stringify(compoundChildTitle)
11526
+ },
11527
+ enabled: true,
11528
+ innerBlocks: {
11529
+ description: compoundInnerBlocksPresetDefinition.description,
11530
+ directInsert: compoundInnerBlocksPresetDefinition.directInsert,
11531
+ label: compoundInnerBlocksPresetDefinition.label,
11532
+ orientation: compoundInnerBlocksOrientation,
11533
+ orientationExpression: compoundInnerBlocksPresetDefinition.orientation ? `'${compoundInnerBlocksPresetDefinition.orientation}'` : "undefined",
11534
+ preset: compoundInnerBlocksPreset,
11535
+ templateLockExpression: compoundInnerBlocksPresetDefinition.templateLock === false ? "false" : `'${compoundInnerBlocksPresetDefinition.templateLock}'`
11536
+ },
11537
+ persistenceEnabled
11538
+ };
11539
+ const persistenceGroup = persistenceEnabled ? {
11540
+ auth: {
11541
+ bootstrapCredentialDeclarations: flatVariables.bootstrapCredentialDeclarations,
11542
+ descriptionJson: flatVariables.persistencePolicyDescriptionJson,
11543
+ intent: flatVariables.restWriteAuthIntent,
11544
+ isAuthenticated: persistencePolicy === "authenticated",
11545
+ isPublic: persistencePolicy === "public",
11546
+ mechanism: flatVariables.restWriteAuthMechanism,
11547
+ mode: flatVariables.restWriteAuthMode,
11548
+ publicWriteRequestIdDeclaration: flatVariables.publicWriteRequestIdDeclaration
11549
+ },
11550
+ dataStorageMode,
11551
+ enabled: true,
11552
+ policy: persistencePolicy,
11553
+ scope: spec.persistence.scope
11554
+ } : null;
11555
+ const queryLoopGroup = {
11556
+ allowedControls: spec.queryLoop.allowedControls,
11557
+ allowedControlsJson: flatVariables.queryAllowedControlsJson,
11558
+ enabled: true,
11559
+ postType: spec.queryLoop.postType,
11560
+ postTypeJson: flatVariables.queryPostTypeJson,
11561
+ variationNamespace: queryVariationNamespace,
11562
+ variationNamespaceJson: flatVariables.queryVariationNamespaceJson
11563
+ };
11564
+ switch (spec.template.family) {
11565
+ case "basic":
11566
+ return attachScaffoldTemplateVariableGroups(flatVariables, {
11567
+ alternateRenderTargets: alternateRenderTargetsGroup,
11568
+ compound: {
11569
+ enabled: false,
11570
+ persistenceEnabled: false
11571
+ },
11572
+ persistence: {
11573
+ enabled: false,
11574
+ scope: "none"
11575
+ },
11576
+ queryLoop: {
11577
+ enabled: false
11578
+ },
11579
+ shared,
11580
+ template: {
11581
+ description: spec.template.description
11582
+ },
11583
+ templateFamily: "basic"
11584
+ });
11585
+ case "interactivity":
11586
+ return attachScaffoldTemplateVariableGroups(flatVariables, {
11587
+ alternateRenderTargets: alternateRenderTargetsGroup,
11588
+ compound: {
11589
+ enabled: false,
11590
+ persistenceEnabled: false
11591
+ },
11592
+ persistence: {
11593
+ enabled: false,
11594
+ scope: "none"
11595
+ },
11596
+ queryLoop: {
11597
+ enabled: false
11598
+ },
11599
+ shared,
11600
+ template: {
11601
+ description: spec.template.description
11602
+ },
11603
+ templateFamily: "interactivity"
11604
+ });
11605
+ case "persistence": {
11606
+ if (persistenceGroup === null) {
11607
+ throw new Error("Persistence scaffolds must provide persistence template variables.");
11608
+ }
11609
+ return attachScaffoldTemplateVariableGroups(flatVariables, {
11610
+ alternateRenderTargets: alternateRenderTargetsGroup,
11611
+ compound: {
11612
+ enabled: false,
11613
+ persistenceEnabled: false
11614
+ },
11615
+ persistence: {
11616
+ ...persistenceGroup,
11617
+ scope: "single"
11618
+ },
11619
+ queryLoop: {
11620
+ enabled: false
11621
+ },
11622
+ shared,
11623
+ template: {
11624
+ description: spec.template.description
11625
+ },
11626
+ templateFamily: "persistence"
11627
+ });
11628
+ }
11629
+ case "compound": {
11630
+ const compoundPersistenceGroup = persistenceGroup === null ? {
11631
+ enabled: false,
11632
+ scope: "none"
11633
+ } : {
11634
+ ...persistenceGroup,
11635
+ scope: "compound-parent"
11636
+ };
11637
+ return attachScaffoldTemplateVariableGroups(flatVariables, {
11638
+ alternateRenderTargets: alternateRenderTargetsGroup,
11639
+ compound: compoundGroup,
11640
+ persistence: compoundPersistenceGroup,
11641
+ queryLoop: {
11642
+ enabled: false
11643
+ },
11644
+ shared,
11645
+ template: {
11646
+ description: spec.template.description
11647
+ },
11648
+ templateFamily: "compound"
11649
+ });
11650
+ }
11651
+ case "query-loop":
11652
+ return attachScaffoldTemplateVariableGroups(flatVariables, {
11653
+ alternateRenderTargets: alternateRenderTargetsGroup,
11654
+ compound: {
11655
+ enabled: false,
11656
+ persistenceEnabled: false
11657
+ },
11658
+ persistence: {
11659
+ enabled: false,
11660
+ scope: "none"
11661
+ },
11662
+ queryLoop: queryLoopGroup,
11663
+ shared,
11664
+ template: {
11665
+ description: spec.template.description
11666
+ },
11667
+ templateFamily: "query-loop"
11668
+ });
11669
+ default: {
11670
+ const unreachableTemplateFamily = spec.template.family;
11671
+ throw new Error(`Unhandled scaffold template family: ${unreachableTemplateFamily}`);
11672
+ }
11673
+ }
11448
11674
  }
11449
11675
  // ../wp-typia-project-tools/src/runtime/built-in-block-non-ts-artifacts.ts
11450
11676
  var BASIC_STYLE_TEMPLATE = `/**
@@ -15130,7 +15356,8 @@ function buildInteractivityCodeArtifacts(variables) {
15130
15356
  function buildCompoundCodeArtifacts(variables) {
15131
15357
  const parentBasePath = `src/blocks/${variables.slugKebabCase}`;
15132
15358
  const childBasePath = `src/blocks/${variables.slugKebabCase}-item`;
15133
- const compoundPersistenceEnabled = variables.compoundPersistenceEnabled === "true";
15359
+ const compoundGroup = getScaffoldTemplateVariableGroups(variables).compound;
15360
+ const compoundPersistenceEnabled = compoundGroup.enabled && compoundGroup.persistenceEnabled;
15134
15361
  return ensureUniqueArtifactPaths([
15135
15362
  createCodeArtifact("src/hooks.ts", SHARED_HOOKS_TEMPLATE, variables),
15136
15363
  ...createTypedJsonWrapperArtifacts(parentBasePath, variables),
@@ -15548,7 +15775,7 @@ function getTemplateVariables(templateId, answers) {
15548
15775
  const compoundPersistenceEnabled = templateId === "persistence" ? true : templateId === "compound" ? Boolean(answers.dataStorageMode || answers.persistencePolicy) : false;
15549
15776
  const dataStorageMode = templateId === "persistence" || compoundPersistenceEnabled ? answers.dataStorageMode ?? "custom-table" : "custom-table";
15550
15777
  const persistencePolicy = templateId === "persistence" || compoundPersistenceEnabled ? answers.persistencePolicy ?? "authenticated" : "authenticated";
15551
- return {
15778
+ const flatVariables = {
15552
15779
  alternateRenderTargetsCsv: "",
15553
15780
  alternateRenderTargetsJson: "[]",
15554
15781
  apiClientPackageVersion,
@@ -15614,6 +15841,62 @@ function getTemplateVariables(templateId, answers) {
15614
15841
  titleCase: pascalCase,
15615
15842
  persistencePolicy
15616
15843
  };
15844
+ return attachScaffoldTemplateVariableGroups(flatVariables, {
15845
+ alternateRenderTargets: {
15846
+ csv: "",
15847
+ enabled: false,
15848
+ hasEmail: false,
15849
+ hasMjml: false,
15850
+ hasPlainText: false,
15851
+ json: "[]",
15852
+ targets: []
15853
+ },
15854
+ compound: {
15855
+ enabled: false,
15856
+ persistenceEnabled: false
15857
+ },
15858
+ persistence: {
15859
+ enabled: false,
15860
+ scope: "none"
15861
+ },
15862
+ queryLoop: {
15863
+ enabled: false
15864
+ },
15865
+ shared: {
15866
+ author: answers.author.trim(),
15867
+ blockMetadataVersion: BUILTIN_BLOCK_METADATA_VERSION,
15868
+ category: metadataDefaults?.category ?? template?.defaultCategory ?? "widgets",
15869
+ cssClassName,
15870
+ description,
15871
+ descriptionJson: JSON.stringify(description),
15872
+ frontendCssClassName: buildFrontendCssClassName(cssClassName),
15873
+ icon: metadataDefaults?.icon ?? "smiley",
15874
+ keyword: slug.replace(/-/g, " "),
15875
+ namespace,
15876
+ pascalCase,
15877
+ phpPrefix,
15878
+ phpPrefixUpper,
15879
+ slug,
15880
+ slugCamelCase: pascalCase.charAt(0).toLowerCase() + pascalCase.slice(1),
15881
+ slugKebabCase: slug,
15882
+ slugSnakeCase,
15883
+ textDomain,
15884
+ title,
15885
+ titleCase: pascalCase,
15886
+ titleJson: JSON.stringify(title),
15887
+ versions: {
15888
+ apiClient: apiClientPackageVersion,
15889
+ blockRuntime: blockRuntimePackageVersion,
15890
+ blockTypes: blockTypesPackageVersion,
15891
+ projectTools: projectToolsPackageVersion,
15892
+ rest: restPackageVersion
15893
+ }
15894
+ },
15895
+ template: {
15896
+ description: template?.description ?? "External scaffold template variables"
15897
+ },
15898
+ templateFamily: "external"
15899
+ });
15617
15900
  }
15618
15901
 
15619
15902
  // ../wp-typia-project-tools/src/runtime/scaffold.ts
@@ -15767,19 +16050,20 @@ async function scaffoldProject({
15767
16050
  });
15768
16051
  const readmePath = path17.join(projectDir, "README.md");
15769
16052
  if (!fs14.existsSync(readmePath)) {
15770
- await fsp11.writeFile(readmePath, buildReadme(resolvedTemplateId, variables, resolvedPackageManager, {
16053
+ await fsp10.writeFile(readmePath, buildReadme(resolvedTemplateId, variables, resolvedPackageManager, {
15771
16054
  withMigrationUi: isBuiltInTemplate || isWorkspace ? withMigrationUi : false,
15772
16055
  withTestPreset: isBuiltInTemplate ? withTestPreset : false,
15773
16056
  withWpEnv: isBuiltInTemplate ? withWpEnv : false
15774
16057
  }), "utf8");
15775
16058
  }
15776
16059
  const gitignorePath = path17.join(projectDir, ".gitignore");
15777
- const existingGitignore = fs14.existsSync(gitignorePath) ? await fsp11.readFile(gitignorePath, "utf8") : "";
15778
- await fsp11.writeFile(gitignorePath, mergeTextLines(buildGitignore(), existingGitignore), "utf8");
16060
+ const existingGitignore = fs14.existsSync(gitignorePath) ? await fsp10.readFile(gitignorePath, "utf8") : "";
16061
+ await fsp10.writeFile(gitignorePath, mergeTextLines(buildGitignore(), existingGitignore), "utf8");
15779
16062
  await normalizePackageJson(projectDir, resolvedPackageManager);
15780
16063
  if (isBuiltInTemplate) {
16064
+ const variableGroups = getScaffoldTemplateVariableGroups(variables);
15781
16065
  await applyGeneratedProjectDxPackageJson({
15782
- compoundPersistenceEnabled: variables.compoundPersistenceEnabled === "true",
16066
+ compoundPersistenceEnabled: variableGroups.compound.enabled && variableGroups.compound.persistenceEnabled,
15783
16067
  packageManager: resolvedPackageManager,
15784
16068
  projectDir,
15785
16069
  templateId: resolvedTemplateId,
@@ -15855,4 +16139,4 @@ async function resolveOptionalInteractiveExternalLayerId({
15855
16139
 
15856
16140
  export { syncPersistenceRestArtifacts, copyInterpolatedDirectory, listInterpolatedDirectoryOutputs, getPrimaryDevelopmentScript, getOptionalOnboardingSteps, getOptionalOnboardingNote, formatNonEmptyTargetDirectoryError, parseTemplateLocator, resolveExternalTemplateLayers, resolveTemplateSeed, normalizeOptionalCliString, resolveLocalCliPathOption, assertExternalLayerCompositionOptions, assertBuiltInTemplateVariantAllowed, parseAlternateRenderTargets, parseCompoundInnerBlocksPreset, getDefaultAnswers, resolveTemplateId, resolvePackageManagerId, collectScaffoldAnswers, DATA_STORAGE_MODES, PERSISTENCE_POLICIES, isDataStorageMode, isPersistencePolicy, scaffoldProject, resolveOptionalInteractiveExternalLayerId };
15857
16141
 
15858
- //# debugId=23F201B1C2B788B264756E2164756E21
16142
+ //# debugId=95394D76AFA9A70D64756E2164756E21