wp-typia 0.22.10 → 0.23.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.
@@ -14,10 +14,10 @@ import {
14
14
  isOmittableBuiltInTemplateLayerDir,
15
15
  resolveBuiltInTemplateSource,
16
16
  resolveBuiltInTemplateSourceFromLayerDirs
17
- } from "./cli-1k61xyn2.js";
17
+ } from "./cli-c2acv5dv.js";
18
18
  import {
19
19
  getPackageVersions
20
- } from "./cli-2mswafd6.js";
20
+ } from "./cli-agywa5n6.js";
21
21
  import {
22
22
  BUILTIN_BLOCK_METADATA_VERSION,
23
23
  COMPOUND_CHILD_BLOCK_METADATA_DEFAULTS,
@@ -35,7 +35,7 @@ import {
35
35
  } from "./cli-qse6myha.js";
36
36
  import {
37
37
  seedProjectMigrations
38
- } from "./cli-tjf0070f.js";
38
+ } from "./cli-9npd9was.js";
39
39
  import {
40
40
  ensureMigrationDirectories,
41
41
  isPlainObject,
@@ -58,7 +58,7 @@ import {
58
58
  toTitleCase,
59
59
  validateBlockSlug,
60
60
  validateNamespace
61
- } from "./cli-3fzqhpx9.js";
61
+ } from "./cli-ts9thts5.js";
62
62
  import {
63
63
  createManagedTempRoot
64
64
  } from "./cli-t73q5aqz.js";
@@ -7477,6 +7477,122 @@ import { createHash, randomUUID } from "crypto";
7477
7477
  import { promises as fsp10 } from "fs";
7478
7478
  import path15 from "path";
7479
7479
 
7480
+ // ../wp-typia-project-tools/src/runtime/template-source-cache-markers.ts
7481
+ var CACHE_MARKER_FILE = "wp-typia-template-cache.json";
7482
+ var CACHE_PRUNE_MARKER_FILE = "wp-typia-template-cache-prune.json";
7483
+ var REDACTED_CACHE_METADATA_VALUE = "[redacted]";
7484
+ var URL_LIKE_METADATA_KEY = /(url|uri|registry|tarball)/iu;
7485
+ function sanitizeExternalTemplateCacheMetadataValue(key, value) {
7486
+ if (!URL_LIKE_METADATA_KEY.test(key)) {
7487
+ return value;
7488
+ }
7489
+ try {
7490
+ const url = new URL(value);
7491
+ url.username = "";
7492
+ url.password = "";
7493
+ url.search = "";
7494
+ url.hash = "";
7495
+ return url.toString();
7496
+ } catch {
7497
+ return REDACTED_CACHE_METADATA_VALUE;
7498
+ }
7499
+ }
7500
+ function sanitizeExternalTemplateCacheMetadata(metadata) {
7501
+ return Object.fromEntries(Object.entries(metadata).map(([key, value]) => [
7502
+ key,
7503
+ value === null ? null : sanitizeExternalTemplateCacheMetadataValue(key, value)
7504
+ ]));
7505
+ }
7506
+ function parseExternalTemplateCacheEntryMarker(markerText) {
7507
+ let marker;
7508
+ try {
7509
+ marker = JSON.parse(markerText);
7510
+ } catch {
7511
+ return null;
7512
+ }
7513
+ if (typeof marker !== "object" || marker === null || Array.isArray(marker)) {
7514
+ return null;
7515
+ }
7516
+ const rawMetadata = marker.metadata;
7517
+ if (typeof rawMetadata !== "object" || rawMetadata === null || Array.isArray(rawMetadata)) {
7518
+ return null;
7519
+ }
7520
+ const metadata = {};
7521
+ for (const [key, value] of Object.entries(rawMetadata)) {
7522
+ if (typeof value !== "string" && value !== null) {
7523
+ return null;
7524
+ }
7525
+ metadata[key] = value;
7526
+ }
7527
+ const rawCreatedAt = marker.createdAt;
7528
+ const createdAtMs = typeof rawCreatedAt === "string" ? Date.parse(rawCreatedAt) : 0;
7529
+ return {
7530
+ createdAtMs: Number.isFinite(createdAtMs) ? createdAtMs : 0,
7531
+ metadata
7532
+ };
7533
+ }
7534
+ function externalTemplateCacheMetadataMatches(actual, expected) {
7535
+ return Object.entries(expected).every(([key, value]) => actual[key] === value);
7536
+ }
7537
+ function isExternalTemplateCacheEntryFreshForTtl(createdAtMs, nowMs, ttlMs) {
7538
+ return ttlMs === null || createdAtMs >= nowMs - ttlMs;
7539
+ }
7540
+ function parseExternalTemplateCachePruneMarker(markerText) {
7541
+ let marker;
7542
+ try {
7543
+ marker = JSON.parse(markerText);
7544
+ } catch {
7545
+ return null;
7546
+ }
7547
+ if (typeof marker !== "object" || marker === null || Array.isArray(marker)) {
7548
+ return null;
7549
+ }
7550
+ const rawPrunedAt = marker.prunedAt;
7551
+ const prunedAtMs = typeof rawPrunedAt === "string" ? Date.parse(rawPrunedAt) : Number.NaN;
7552
+ const rawPruneIntervalMs = marker.pruneIntervalMs;
7553
+ const rawTtlMs = marker.ttlMs;
7554
+ if (typeof rawTtlMs !== "number" || !Number.isFinite(rawTtlMs)) {
7555
+ return null;
7556
+ }
7557
+ if (!Number.isFinite(prunedAtMs)) {
7558
+ return null;
7559
+ }
7560
+ if (rawPruneIntervalMs !== null && (typeof rawPruneIntervalMs !== "number" || !Number.isFinite(rawPruneIntervalMs))) {
7561
+ return null;
7562
+ }
7563
+ return {
7564
+ prunedAtMs,
7565
+ pruneIntervalMs: rawPruneIntervalMs ?? null,
7566
+ ttlMs: rawTtlMs
7567
+ };
7568
+ }
7569
+ function formatExternalTemplateCacheEntryMarker({
7570
+ cacheKey,
7571
+ createdAt,
7572
+ metadata,
7573
+ namespace
7574
+ }) {
7575
+ return `${JSON.stringify({
7576
+ createdAt: createdAt.toISOString(),
7577
+ key: cacheKey,
7578
+ metadata: sanitizeExternalTemplateCacheMetadata(metadata),
7579
+ namespace
7580
+ }, null, 2)}
7581
+ `;
7582
+ }
7583
+ function formatExternalTemplateCachePruneMarker({
7584
+ nowMs,
7585
+ pruneIntervalMs,
7586
+ ttlMs
7587
+ }) {
7588
+ return `${JSON.stringify({
7589
+ prunedAt: new Date(nowMs).toISOString(),
7590
+ pruneIntervalMs,
7591
+ ttlMs
7592
+ }, null, 2)}
7593
+ `;
7594
+ }
7595
+
7480
7596
  // ../wp-typia-project-tools/src/runtime/template-source-cache-policy.ts
7481
7597
  import os2 from "os";
7482
7598
  import path14 from "path";
@@ -7558,10 +7674,7 @@ function getCurrentUserCacheSegment() {
7558
7674
  }
7559
7675
 
7560
7676
  // ../wp-typia-project-tools/src/runtime/template-source-cache.ts
7561
- var CACHE_MARKER_FILE = "wp-typia-template-cache.json";
7562
- var CACHE_PRUNE_MARKER_FILE = "wp-typia-template-cache-prune.json";
7563
7677
  var PRIVATE_CACHE_DIRECTORY_MODE = 448;
7564
- var REDACTED_CACHE_METADATA_VALUE = "[redacted]";
7565
7678
  var CACHE_PUBLISH_RACE_ERROR_CODES = new Set(["EEXIST", "ENOTEMPTY"]);
7566
7679
  var CACHE_UNAVAILABLE_ERROR_CODES = new Set([
7567
7680
  "EACCES",
@@ -7570,7 +7683,6 @@ var CACHE_UNAVAILABLE_ERROR_CODES = new Set([
7570
7683
  "EPERM",
7571
7684
  "EROFS"
7572
7685
  ]);
7573
- var URL_LIKE_METADATA_KEY = /(url|uri|registry|tarball)/iu;
7574
7686
  var SAFE_CACHE_NAMESPACE_SEGMENT = /^[A-Za-z0-9_.-]+$/u;
7575
7687
  var SAFE_CACHE_ENTRY_SEGMENT = /^[a-f0-9]{64}$/u;
7576
7688
  function createTemporaryCacheEntryDirName(cacheKey) {
@@ -7637,27 +7749,6 @@ async function ensurePrivateCacheDirectory(directory) {
7637
7749
  return false;
7638
7750
  }
7639
7751
  }
7640
- function sanitizeCacheMetadataValue(key, value) {
7641
- if (!URL_LIKE_METADATA_KEY.test(key)) {
7642
- return value;
7643
- }
7644
- try {
7645
- const url = new URL(value);
7646
- url.username = "";
7647
- url.password = "";
7648
- url.search = "";
7649
- url.hash = "";
7650
- return url.toString();
7651
- } catch {
7652
- return REDACTED_CACHE_METADATA_VALUE;
7653
- }
7654
- }
7655
- function sanitizeCacheMetadata(metadata) {
7656
- return Object.fromEntries(Object.entries(metadata).map(([key, value]) => [
7657
- key,
7658
- value === null ? null : sanitizeCacheMetadataValue(key, value)
7659
- ]));
7660
- }
7661
7752
  function resolveCacheNamespaceDir(cacheRoot, namespace) {
7662
7753
  if (namespace === "." || namespace === ".." || !SAFE_CACHE_NAMESPACE_SEGMENT.test(namespace)) {
7663
7754
  return null;
@@ -7689,47 +7780,13 @@ function getCacheEntryPaths(descriptor) {
7689
7780
  async function isReusableCacheEntry(entryDir, markerPath, sourceDir) {
7690
7781
  return await isPrivateCacheDirectory(entryDir) && await pathExists(markerPath) && await isDirectoryPath(sourceDir);
7691
7782
  }
7692
- function parseCacheMarkerMetadata(markerText) {
7693
- let marker;
7694
- try {
7695
- marker = JSON.parse(markerText);
7696
- } catch {
7697
- return null;
7698
- }
7699
- if (typeof marker !== "object" || marker === null || Array.isArray(marker)) {
7700
- return null;
7701
- }
7702
- const rawMetadata = marker.metadata;
7703
- if (typeof rawMetadata !== "object" || rawMetadata === null || Array.isArray(rawMetadata)) {
7704
- return null;
7705
- }
7706
- const metadata = {};
7707
- for (const [key, value] of Object.entries(rawMetadata)) {
7708
- if (typeof value !== "string" && value !== null) {
7709
- return null;
7710
- }
7711
- metadata[key] = value;
7712
- }
7713
- const rawCreatedAt = marker.createdAt;
7714
- const createdAtMs = typeof rawCreatedAt === "string" ? Date.parse(rawCreatedAt) : 0;
7715
- return {
7716
- createdAtMs: Number.isFinite(createdAtMs) ? createdAtMs : 0,
7717
- metadata
7718
- };
7719
- }
7720
7783
  async function readCacheEntryMarker(markerPath) {
7721
7784
  try {
7722
- return parseCacheMarkerMetadata(await fsp10.readFile(markerPath, "utf8"));
7785
+ return parseExternalTemplateCacheEntryMarker(await fsp10.readFile(markerPath, "utf8"));
7723
7786
  } catch {
7724
7787
  return null;
7725
7788
  }
7726
7789
  }
7727
- function cacheMetadataMatches(actual, expected) {
7728
- return Object.entries(expected).every(([key, value]) => actual[key] === value);
7729
- }
7730
- function isCacheEntryFreshForTtl(createdAtMs, nowMs, ttlMs) {
7731
- return ttlMs === null || createdAtMs >= nowMs - ttlMs;
7732
- }
7733
7790
  async function getReusableCacheEntryMarker(entryDir, markerPath, sourceDir) {
7734
7791
  if (!await isReusableCacheEntry(entryDir, markerPath, sourceDir)) {
7735
7792
  return null;
@@ -7738,7 +7795,7 @@ async function getReusableCacheEntryMarker(entryDir, markerPath, sourceDir) {
7738
7795
  }
7739
7796
  async function isReusableFreshCacheEntry(entryDir, markerPath, sourceDir, nowMs, ttlMs) {
7740
7797
  const marker = await getReusableCacheEntryMarker(entryDir, markerPath, sourceDir);
7741
- return marker !== null && isCacheEntryFreshForTtl(marker.createdAtMs, nowMs, ttlMs);
7798
+ return marker !== null && isExternalTemplateCacheEntryFreshForTtl(marker.createdAtMs, nowMs, ttlMs);
7742
7799
  }
7743
7800
  function isPathInsideDirectory(directory, candidatePath) {
7744
7801
  const relativePath = path15.relative(directory, candidatePath);
@@ -7758,35 +7815,6 @@ async function removeCacheEntryWithinRoot(cacheRoot, entryDir) {
7758
7815
  function getCachePruneMarkerPath(cacheRoot) {
7759
7816
  return path15.join(cacheRoot, CACHE_PRUNE_MARKER_FILE);
7760
7817
  }
7761
- function parseCachePruneMarker(markerText) {
7762
- let marker;
7763
- try {
7764
- marker = JSON.parse(markerText);
7765
- } catch {
7766
- return null;
7767
- }
7768
- if (typeof marker !== "object" || marker === null || Array.isArray(marker)) {
7769
- return null;
7770
- }
7771
- const rawPrunedAt = marker.prunedAt;
7772
- const prunedAtMs = typeof rawPrunedAt === "string" ? Date.parse(rawPrunedAt) : Number.NaN;
7773
- const rawPruneIntervalMs = marker.pruneIntervalMs;
7774
- const rawTtlMs = marker.ttlMs;
7775
- if (typeof rawTtlMs !== "number" || !Number.isFinite(rawTtlMs)) {
7776
- return null;
7777
- }
7778
- if (!Number.isFinite(prunedAtMs)) {
7779
- return null;
7780
- }
7781
- if (rawPruneIntervalMs !== null && (typeof rawPruneIntervalMs !== "number" || !Number.isFinite(rawPruneIntervalMs))) {
7782
- return null;
7783
- }
7784
- return {
7785
- prunedAtMs,
7786
- pruneIntervalMs: rawPruneIntervalMs ?? null,
7787
- ttlMs: rawTtlMs
7788
- };
7789
- }
7790
7818
  async function shouldSkipExternalTemplateCachePrune({
7791
7819
  cacheRoot,
7792
7820
  force,
@@ -7803,7 +7831,7 @@ async function shouldSkipExternalTemplateCachePrune({
7803
7831
  } catch {
7804
7832
  return false;
7805
7833
  }
7806
- const marker = parseCachePruneMarker(markerText);
7834
+ const marker = parseExternalTemplateCachePruneMarker(markerText);
7807
7835
  if (!marker || marker.ttlMs !== ttlMs || marker.pruneIntervalMs !== pruneIntervalMs) {
7808
7836
  return false;
7809
7837
  }
@@ -7817,12 +7845,11 @@ async function writeExternalTemplateCachePruneMarker({
7817
7845
  ttlMs
7818
7846
  }) {
7819
7847
  try {
7820
- await fsp10.writeFile(getCachePruneMarkerPath(cacheRoot), `${JSON.stringify({
7821
- prunedAt: new Date(nowMs).toISOString(),
7848
+ await fsp10.writeFile(getCachePruneMarkerPath(cacheRoot), formatExternalTemplateCachePruneMarker({
7849
+ nowMs,
7822
7850
  pruneIntervalMs,
7823
7851
  ttlMs
7824
- }, null, 2)}
7825
- `, "utf8");
7852
+ }), "utf8");
7826
7853
  } catch {}
7827
7854
  }
7828
7855
  async function pruneExternalTemplateCache(options = {}) {
@@ -7949,7 +7976,7 @@ async function findReusableExternalTemplateSourceCache(descriptor) {
7949
7976
  const markerPath = path15.join(entryDir, CACHE_MARKER_FILE);
7950
7977
  const sourceDir = path15.join(entryDir, "source");
7951
7978
  const marker = await getReusableCacheEntryMarker(entryDir, markerPath, sourceDir);
7952
- if (!marker || !isCacheEntryFreshForTtl(marker.createdAtMs, nowMs, ttlMs) || !cacheMetadataMatches(marker.metadata, descriptor.metadata)) {
7979
+ if (!marker || !isExternalTemplateCacheEntryFreshForTtl(marker.createdAtMs, nowMs, ttlMs) || !externalTemplateCacheMetadataMatches(marker.metadata, descriptor.metadata)) {
7953
7980
  continue;
7954
7981
  }
7955
7982
  if (!bestEntry || marker.createdAtMs > bestEntry.createdAtMs) {
@@ -7980,7 +8007,7 @@ async function resolveExternalTemplateSourceCache(descriptor, populateSourceDir)
7980
8007
  const nowMs = getExternalTemplateCacheNowMs(undefined);
7981
8008
  await pruneExternalTemplateCache();
7982
8009
  const existingMarker = await getReusableCacheEntryMarker(entryDir, markerPath, sourceDir);
7983
- if (existingMarker && isCacheEntryFreshForTtl(existingMarker.createdAtMs, nowMs, ttlMs)) {
8010
+ if (existingMarker && isExternalTemplateCacheEntryFreshForTtl(existingMarker.createdAtMs, nowMs, ttlMs)) {
7984
8011
  return {
7985
8012
  cacheHit: true,
7986
8013
  sourceDir
@@ -8006,13 +8033,12 @@ async function resolveExternalTemplateSourceCache(descriptor, populateSourceDir)
8006
8033
  populateFailed = true;
8007
8034
  throw error;
8008
8035
  }
8009
- await fsp10.writeFile(path15.join(temporaryEntryDir, CACHE_MARKER_FILE), `${JSON.stringify({
8010
- createdAt: new Date().toISOString(),
8011
- key: cacheKey,
8012
- metadata: sanitizeCacheMetadata(descriptor.metadata),
8036
+ await fsp10.writeFile(path15.join(temporaryEntryDir, CACHE_MARKER_FILE), formatExternalTemplateCacheEntryMarker({
8037
+ cacheKey,
8038
+ createdAt: new Date,
8039
+ metadata: descriptor.metadata,
8013
8040
  namespace: descriptor.namespace
8014
- }, null, 2)}
8015
- `, "utf8");
8041
+ }), "utf8");
8016
8042
  await fsp10.rename(temporaryEntryDir, entryDir);
8017
8043
  return {
8018
8044
  cacheHit: false,
@@ -14012,4 +14038,4 @@ async function resolveOptionalInteractiveExternalLayerId({
14012
14038
 
14013
14039
  export { syncPersistenceRestArtifacts, copyInterpolatedDirectory, listInterpolatedDirectoryOutputs, getPrimaryDevelopmentScript, getOptionalOnboardingSteps, getOptionalOnboardingNote, getOptionalOnboardingShortNote, isCompoundPersistenceEnabled, formatNonEmptyTargetDirectoryError, resolveExternalTemplateLayers, resolveTemplateSeed, normalizeOptionalCliString, resolveLocalCliPathOption, assertExternalLayerCompositionOptions, assertBuiltInTemplateVariantAllowed, parseAlternateRenderTargets, parseCompoundInnerBlocksPreset, OPTIONAL_WORDPRESS_AI_CLIENT_COMPATIBILITY, REQUIRED_WORKSPACE_ABILITY_COMPATIBILITY, resolveScaffoldCompatibilityPolicy, createScaffoldCompatibilityConfig, renderScaffoldCompatibilityConfig, updatePluginHeaderCompatibility, getDefaultAnswers, resolveTemplateId, resolvePackageManagerId, collectScaffoldAnswers, DATA_STORAGE_MODES, PERSISTENCE_POLICIES, isDataStorageMode, isPersistencePolicy, scaffoldProject, resolveOptionalInteractiveExternalLayerId };
14014
14040
 
14015
- //# debugId=D080E1AA4CFC66CB64756E2164756E21
14041
+ //# debugId=9368065E49298D9E64756E2164756E21
@@ -3,12 +3,15 @@
3
3
  var ADD_KIND_IDS = [
4
4
  "admin-view",
5
5
  "block",
6
+ "integration-env",
6
7
  "variation",
7
8
  "style",
8
9
  "transform",
9
10
  "pattern",
10
11
  "binding-source",
12
+ "contract",
11
13
  "rest-resource",
14
+ "post-meta",
12
15
  "ability",
13
16
  "ai-feature",
14
17
  "hooked-block",
@@ -17,4 +20,4 @@ var ADD_KIND_IDS = [
17
20
 
18
21
  export { ADD_KIND_IDS };
19
22
 
20
- //# debugId=B2A14CEE6DB922C564756E2164756E21
23
+ //# debugId=C480D575E839E69A64756E2164756E21
@@ -48,7 +48,7 @@ import {
48
48
  } from "./cli-2rqf6t0b.js";
49
49
  import {
50
50
  readWorkspaceInventory
51
- } from "./cli-3fzqhpx9.js";
51
+ } from "./cli-ts9thts5.js";
52
52
  import {
53
53
  getInvalidWorkspaceProjectReason,
54
54
  tryResolveWorkspaceProject