wp-typia 0.22.6 → 0.22.7
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.
- package/bin/wp-typia.js +83 -0
- package/dist-bunli/.bunli/commands.gen.js +509 -565
- package/dist-bunli/{cli-0q0tz4dq.js → cli-27v2qpjg.js} +1 -1
- package/dist-bunli/{cli-1sm60g1z.js → cli-2hsp17nd.js} +2 -2
- package/dist-bunli/{cli-6a65qfb1.js → cli-8snabymq.js} +105 -130
- package/dist-bunli/{cli-add-5vmxpgmn.js → cli-add-8jpdnz1r.js} +13 -14
- package/dist-bunli/{cli-f44sphgv.js → cli-cjygr56g.js} +3 -3
- package/dist-bunli/{cli-doctor-ngzs8kkc.js → cli-doctor-h5tq4ztr.js} +1 -1
- package/dist-bunli/{cli-init-df1wg71p.js → cli-init-w9p558th.js} +73 -72
- package/dist-bunli/{cli-scaffold-btx3wfsn.js → cli-scaffold-qve8rqja.js} +4 -4
- package/dist-bunli/{cli-5kn2p7ee.js → cli-ta3y0hp2.js} +159 -194
- package/dist-bunli/cli.js +2 -2
- package/dist-bunli/{command-list-bqr2tp8w.js → command-list-6zr1tj96.js} +7 -7
- package/dist-bunli/{migrations-bnrjw4k1.js → migrations-v0avgyg6.js} +2 -2
- package/dist-bunli/node-cli.js +3 -3
- package/package.json +2 -2
|
@@ -36417,8 +36417,35 @@ function isFileNotFoundError(error48) {
|
|
|
36417
36417
|
}
|
|
36418
36418
|
var init_cli_add_filesystem = () => {};
|
|
36419
36419
|
|
|
36420
|
+
// ../wp-typia-project-tools/src/runtime/fs-async.ts
|
|
36421
|
+
import { promises as fsp4 } from "fs";
|
|
36422
|
+
async function pathExists(filePath) {
|
|
36423
|
+
try {
|
|
36424
|
+
await fsp4.access(filePath);
|
|
36425
|
+
return true;
|
|
36426
|
+
} catch {
|
|
36427
|
+
return false;
|
|
36428
|
+
}
|
|
36429
|
+
}
|
|
36430
|
+
async function readOptionalUtf8File(filePath) {
|
|
36431
|
+
try {
|
|
36432
|
+
return await fsp4.readFile(filePath, "utf8");
|
|
36433
|
+
} catch (error48) {
|
|
36434
|
+
if (isFileNotFoundError2(error48)) {
|
|
36435
|
+
return null;
|
|
36436
|
+
}
|
|
36437
|
+
throw error48;
|
|
36438
|
+
}
|
|
36439
|
+
}
|
|
36440
|
+
function getNodeErrorCode(error48) {
|
|
36441
|
+
return typeof error48 === "object" && error48 !== null && "code" in error48 ? String(error48.code) : "";
|
|
36442
|
+
}
|
|
36443
|
+
function isFileNotFoundError2(error48) {
|
|
36444
|
+
return getNodeErrorCode(error48) === "ENOENT";
|
|
36445
|
+
}
|
|
36446
|
+
var init_fs_async = () => {};
|
|
36447
|
+
|
|
36420
36448
|
// ../wp-typia-project-tools/src/runtime/cli-add-block-json.ts
|
|
36421
|
-
import fs8 from "fs";
|
|
36422
36449
|
import path13 from "path";
|
|
36423
36450
|
import { parseScaffoldBlockMetadata } from "@wp-typia/block-runtime/blocks";
|
|
36424
36451
|
function resolveWorkspaceBlock(inventory, blockSlug) {
|
|
@@ -36428,14 +36455,15 @@ function resolveWorkspaceBlock(inventory, blockSlug) {
|
|
|
36428
36455
|
}
|
|
36429
36456
|
return block;
|
|
36430
36457
|
}
|
|
36431
|
-
function readWorkspaceBlockJson(projectDir, blockSlug) {
|
|
36458
|
+
async function readWorkspaceBlockJson(projectDir, blockSlug) {
|
|
36432
36459
|
const blockJsonPath = path13.join(projectDir, "src", "blocks", blockSlug, "block.json");
|
|
36433
|
-
|
|
36460
|
+
const source = await readOptionalUtf8File(blockJsonPath);
|
|
36461
|
+
if (source === null) {
|
|
36434
36462
|
throw new Error(`Missing ${path13.relative(projectDir, blockJsonPath)} for workspace block "${blockSlug}".`);
|
|
36435
36463
|
}
|
|
36436
36464
|
let blockJson;
|
|
36437
36465
|
try {
|
|
36438
|
-
blockJson = parseScaffoldBlockMetadata(JSON.parse(
|
|
36466
|
+
blockJson = parseScaffoldBlockMetadata(JSON.parse(source));
|
|
36439
36467
|
} catch (error48) {
|
|
36440
36468
|
throw new Error(error48 instanceof Error ? `Failed to parse ${path13.relative(projectDir, blockJsonPath)}: ${error48.message}` : `Failed to parse ${path13.relative(projectDir, blockJsonPath)}.`);
|
|
36441
36469
|
}
|
|
@@ -36456,15 +36484,17 @@ function getMutableBlockHooks(blockJson, blockJsonRelativePath) {
|
|
|
36456
36484
|
}
|
|
36457
36485
|
return blockHooks;
|
|
36458
36486
|
}
|
|
36459
|
-
var init_cli_add_block_json = () => {
|
|
36487
|
+
var init_cli_add_block_json = __esm(() => {
|
|
36488
|
+
init_fs_async();
|
|
36489
|
+
});
|
|
36460
36490
|
|
|
36461
36491
|
// ../wp-typia-project-tools/src/runtime/cli-add-collision.ts
|
|
36462
|
-
import
|
|
36492
|
+
import fs8 from "fs";
|
|
36463
36493
|
import path14 from "path";
|
|
36464
36494
|
function assertScaffoldDoesNotExist(options) {
|
|
36465
36495
|
for (const collision of options.filesystemCollisions) {
|
|
36466
36496
|
const targetPath = path14.join(options.projectDir, collision.relativePath);
|
|
36467
|
-
if (
|
|
36497
|
+
if (fs8.existsSync(targetPath)) {
|
|
36468
36498
|
throw new Error(`${collision.label} already exists at ${path14.relative(options.projectDir, targetPath)}. Choose a different name.`);
|
|
36469
36499
|
}
|
|
36470
36500
|
}
|
|
@@ -36797,7 +36827,7 @@ var init_json_utils = __esm(() => {
|
|
|
36797
36827
|
});
|
|
36798
36828
|
|
|
36799
36829
|
// ../wp-typia-project-tools/src/runtime/migration-utils.ts
|
|
36800
|
-
import
|
|
36830
|
+
import fs9 from "fs";
|
|
36801
36831
|
import path15 from "path";
|
|
36802
36832
|
import { execSync } from "child_process";
|
|
36803
36833
|
function getValueAtPath(input, pathLabel) {
|
|
@@ -36858,7 +36888,7 @@ function createTransformFixtureValue(attribute, pathLabel) {
|
|
|
36858
36888
|
}
|
|
36859
36889
|
}
|
|
36860
36890
|
function readJson(filePath) {
|
|
36861
|
-
return JSON.parse(
|
|
36891
|
+
return JSON.parse(fs9.readFileSync(filePath, "utf8"));
|
|
36862
36892
|
}
|
|
36863
36893
|
function renderPhpValue(value2, indentLevel) {
|
|
36864
36894
|
const indent = "\t".repeat(indentLevel);
|
|
@@ -36896,8 +36926,8 @@ ${indent}]`;
|
|
|
36896
36926
|
throw new Error(`Unable to encode PHP migration registry value for ${String(value2)}`);
|
|
36897
36927
|
}
|
|
36898
36928
|
function copyFile(sourcePath, targetPath) {
|
|
36899
|
-
|
|
36900
|
-
|
|
36929
|
+
fs9.mkdirSync(path15.dirname(targetPath), { recursive: true });
|
|
36930
|
+
fs9.copyFileSync(sourcePath, targetPath);
|
|
36901
36931
|
}
|
|
36902
36932
|
function sanitizeSaveSnapshotSource(source) {
|
|
36903
36933
|
return source.replace(/^import\s+\{[^}]+\}\s+from\s+['"]\.\/types['"];?\n?/gm, "").replace(/^interface\s+SaveProps\s*\{[\s\S]*?\}\n?/m, "").replace(/: SaveProps/g, ": { attributes: any }").replace(/attributes:\s*[A-Za-z0-9_<>{}\[\]|&,\s]+;/g, "attributes: any;").replace(/\(\{\s*attributes\s*\}:\s*\{\s*attributes:\s*any\s*\}\)/g, "({ attributes }: { attributes: any })").replace(/\n{3,}/g, `
|
|
@@ -36939,7 +36969,7 @@ function detectPackageManagerId(projectDir) {
|
|
|
36939
36969
|
function getLocalTsxBinary(projectDir) {
|
|
36940
36970
|
const filename = process.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
36941
36971
|
const binaryPath = path15.join(projectDir, "node_modules", ".bin", filename);
|
|
36942
|
-
if (!
|
|
36972
|
+
if (!fs9.existsSync(binaryPath)) {
|
|
36943
36973
|
throw new Error("Local tsx binary was not found. Install project dependencies before running migration verification.");
|
|
36944
36974
|
}
|
|
36945
36975
|
return binaryPath;
|
|
@@ -37430,14 +37460,14 @@ var init_migration_constants = __esm(() => {
|
|
|
37430
37460
|
});
|
|
37431
37461
|
|
|
37432
37462
|
// ../wp-typia-project-tools/src/runtime/migration-project-layout-discovery.ts
|
|
37433
|
-
import
|
|
37463
|
+
import fs10 from "fs";
|
|
37434
37464
|
import path17 from "path";
|
|
37435
37465
|
function readSingleBlockTarget(projectDir, {
|
|
37436
37466
|
blockJsonFile,
|
|
37437
37467
|
manifestFile
|
|
37438
37468
|
}) {
|
|
37439
37469
|
const requiredFiles = [blockJsonFile, ROOT_SAVE_FILE, ROOT_TYPES_FILE];
|
|
37440
|
-
if (requiredFiles.some((relativePath) => !
|
|
37470
|
+
if (requiredFiles.some((relativePath) => !fs10.existsSync(path17.join(projectDir, relativePath)))) {
|
|
37441
37471
|
return null;
|
|
37442
37472
|
}
|
|
37443
37473
|
const blockName = readJson(path17.join(projectDir, blockJsonFile))?.name;
|
|
@@ -37457,10 +37487,10 @@ function collectSingleBlockCandidates(projectDir) {
|
|
|
37457
37487
|
return SINGLE_BLOCK_LAYOUT_CANDIDATES.filter(({ blockJsonFile }) => hasSingleBlockLayoutFiles(projectDir, blockJsonFile));
|
|
37458
37488
|
}
|
|
37459
37489
|
function hasSingleBlockLayoutFiles(projectDir, blockJsonFile) {
|
|
37460
|
-
return [blockJsonFile, ROOT_SAVE_FILE, ROOT_TYPES_FILE].every((relativePath) =>
|
|
37490
|
+
return [blockJsonFile, ROOT_SAVE_FILE, ROOT_TYPES_FILE].every((relativePath) => fs10.existsSync(path17.join(projectDir, relativePath)));
|
|
37461
37491
|
}
|
|
37462
37492
|
function orderSingleBlockCandidates(projectDir, candidates) {
|
|
37463
|
-
const candidatesWithManifest = candidates.filter(({ manifestFile }) =>
|
|
37493
|
+
const candidatesWithManifest = candidates.filter(({ manifestFile }) => fs10.existsSync(path17.join(projectDir, manifestFile)));
|
|
37464
37494
|
return [
|
|
37465
37495
|
...candidatesWithManifest,
|
|
37466
37496
|
...candidates.filter((candidate) => !candidatesWithManifest.includes(candidate))
|
|
@@ -37471,7 +37501,7 @@ function createImplicitLegacyBlock(projectDir, blockName) {
|
|
|
37471
37501
|
try {
|
|
37472
37502
|
const rootTarget = readSingleBlockTarget(projectDir, LEGACY_ROOT_SINGLE_BLOCK_LAYOUT);
|
|
37473
37503
|
const srcTarget = readSingleBlockTarget(projectDir, SINGLE_BLOCK_LAYOUT_CANDIDATES[0]);
|
|
37474
|
-
const hasSrcManifest =
|
|
37504
|
+
const hasSrcManifest = fs10.existsSync(path17.join(projectDir, SRC_MANIFEST));
|
|
37475
37505
|
if (rootTarget?.blockName === blockName && (!srcTarget || srcTarget.blockName !== blockName || !hasSrcManifest)) {
|
|
37476
37506
|
return {
|
|
37477
37507
|
...rootTarget,
|
|
@@ -37497,8 +37527,8 @@ function getRequiredProjectFiles(projectDir, blocks) {
|
|
|
37497
37527
|
];
|
|
37498
37528
|
}
|
|
37499
37529
|
const configPath = path17.join(projectDir, CONFIG_FILE);
|
|
37500
|
-
if (
|
|
37501
|
-
const config2 = parseMigrationConfig(
|
|
37530
|
+
if (fs10.existsSync(configPath)) {
|
|
37531
|
+
const config2 = parseMigrationConfig(fs10.readFileSync(configPath, "utf8"));
|
|
37502
37532
|
const configuredBlocks = config2.blocks ?? [createImplicitLegacyBlock(projectDir, config2.blockName)];
|
|
37503
37533
|
return [
|
|
37504
37534
|
"package.json",
|
|
@@ -37523,7 +37553,7 @@ function getRequiredProjectFiles(projectDir, blocks) {
|
|
|
37523
37553
|
return SUPPORTED_PROJECT_FILES;
|
|
37524
37554
|
}
|
|
37525
37555
|
function ensureAdvancedMigrationProject(projectDir, blocks) {
|
|
37526
|
-
const missing = getRequiredProjectFiles(projectDir, blocks).filter((relativePath) => !
|
|
37556
|
+
const missing = getRequiredProjectFiles(projectDir, blocks).filter((relativePath) => !fs10.existsSync(path17.join(projectDir, relativePath)));
|
|
37527
37557
|
if (missing.length > 0) {
|
|
37528
37558
|
throw new Error(`This directory is not a supported migration-capable project. Missing: ${missing.join(", ")}`);
|
|
37529
37559
|
}
|
|
@@ -37536,7 +37566,7 @@ function createBlockTarget(projectDir, {
|
|
|
37536
37566
|
typesFile
|
|
37537
37567
|
}) {
|
|
37538
37568
|
const requiredFiles = [blockJsonFile, saveFile, typesFile];
|
|
37539
|
-
if (requiredFiles.some((relativePath) => !
|
|
37569
|
+
if (requiredFiles.some((relativePath) => !fs10.existsSync(path17.join(projectDir, relativePath)))) {
|
|
37540
37570
|
return null;
|
|
37541
37571
|
}
|
|
37542
37572
|
const blockName = readJson(path17.join(projectDir, blockJsonFile))?.name;
|
|
@@ -37608,14 +37638,14 @@ function discoverSingleBlockTarget(projectDir, preferredBlockName) {
|
|
|
37608
37638
|
function discoverMigrationLayout(projectDir) {
|
|
37609
37639
|
const blocksRoot = path17.join(projectDir, "src", "blocks");
|
|
37610
37640
|
let firstMultiBlockError = null;
|
|
37611
|
-
if (
|
|
37612
|
-
const blockDirectories =
|
|
37613
|
-
const candidateDirectories = blockDirectories.filter((directory) =>
|
|
37641
|
+
if (fs10.existsSync(blocksRoot) && fs10.statSync(blocksRoot).isDirectory()) {
|
|
37642
|
+
const blockDirectories = fs10.readdirSync(blocksRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
37643
|
+
const candidateDirectories = blockDirectories.filter((directory) => fs10.existsSync(path17.join(blocksRoot, directory, "block.json")));
|
|
37614
37644
|
if (candidateDirectories.length > 0) {
|
|
37615
37645
|
const blocks = candidateDirectories.flatMap((directory) => {
|
|
37616
37646
|
const saveFile = path17.join("src", "blocks", directory, "save.tsx");
|
|
37617
37647
|
const typesFile = path17.join("src", "blocks", directory, "types.ts");
|
|
37618
|
-
const missingFiles = [saveFile, typesFile].filter((relativePath) => !
|
|
37648
|
+
const missingFiles = [saveFile, typesFile].filter((relativePath) => !fs10.existsSync(path17.join(projectDir, relativePath)));
|
|
37619
37649
|
if (missingFiles.length > 0) {
|
|
37620
37650
|
firstMultiBlockError ??= createMalformedMultiBlockTargetError(directory, `the block target is missing ${missingFiles.join(", ")}`);
|
|
37621
37651
|
return [];
|
|
@@ -37718,7 +37748,7 @@ var init_migration_project_layout_discovery = __esm(() => {
|
|
|
37718
37748
|
});
|
|
37719
37749
|
|
|
37720
37750
|
// ../wp-typia-project-tools/src/runtime/migration-project-layout-paths.ts
|
|
37721
|
-
import
|
|
37751
|
+
import fs11 from "fs";
|
|
37722
37752
|
import path18 from "path";
|
|
37723
37753
|
function toImportPath(fromDir, targetPath, stripExtension = false) {
|
|
37724
37754
|
let relativePath = normalizeRelativePath(path18.relative(fromDir, targetPath));
|
|
@@ -37752,7 +37782,7 @@ function getSnapshotManifestPath(projectDir, block, version2) {
|
|
|
37752
37782
|
return path18.join(getSnapshotRoot(projectDir, block, version2), ROOT_MANIFEST);
|
|
37753
37783
|
}
|
|
37754
37784
|
function getAvailableSnapshotVersionsForBlock(projectDir, supportedMigrationVersions, block) {
|
|
37755
|
-
return supportedMigrationVersions.filter((version2) =>
|
|
37785
|
+
return supportedMigrationVersions.filter((version2) => fs11.existsSync(getSnapshotManifestPath(projectDir, block, version2))).sort(compareMigrationVersionLabels);
|
|
37756
37786
|
}
|
|
37757
37787
|
function createMissingBlockSnapshotMessage(blockName, fromVersion, availableSnapshotVersions) {
|
|
37758
37788
|
return availableSnapshotVersions.length === 0 ? `Snapshot manifest for ${blockName} @ ${fromVersion} does not exist. ` + `No snapshots exist yet for ${blockName}. Run \`wp-typia migrate snapshot --migration-version ${fromVersion}\` first.` : `Snapshot manifest for ${blockName} @ ${fromVersion} does not exist. ` + `Available snapshot versions for ${blockName}: ${availableSnapshotVersions.join(", ")}. ` + `Run \`wp-typia migrate snapshot --migration-version ${fromVersion}\` first if you want to preserve that release.`;
|
|
@@ -37784,17 +37814,17 @@ function getValidatorsImportPath(projectDir, block, fromDir) {
|
|
|
37784
37814
|
}
|
|
37785
37815
|
function ensureMigrationDirectories(projectDir, blocks) {
|
|
37786
37816
|
const paths = getProjectPaths(projectDir);
|
|
37787
|
-
|
|
37788
|
-
|
|
37789
|
-
|
|
37790
|
-
|
|
37817
|
+
fs11.mkdirSync(paths.fixturesDir, { recursive: true });
|
|
37818
|
+
fs11.mkdirSync(paths.generatedDir, { recursive: true });
|
|
37819
|
+
fs11.mkdirSync(paths.rulesDir, { recursive: true });
|
|
37820
|
+
fs11.mkdirSync(paths.snapshotDir, { recursive: true });
|
|
37791
37821
|
if (!Array.isArray(blocks) || blocks.length === 0) {
|
|
37792
37822
|
return;
|
|
37793
37823
|
}
|
|
37794
37824
|
for (const block of blocks) {
|
|
37795
|
-
|
|
37796
|
-
|
|
37797
|
-
|
|
37825
|
+
fs11.mkdirSync(path18.join(paths.fixturesDir, block.key), { recursive: true });
|
|
37826
|
+
fs11.mkdirSync(path18.join(paths.generatedDir, block.key), { recursive: true });
|
|
37827
|
+
fs11.mkdirSync(path18.join(paths.rulesDir, block.key), { recursive: true });
|
|
37798
37828
|
}
|
|
37799
37829
|
}
|
|
37800
37830
|
function discoverMigrationEntries(state) {
|
|
@@ -37810,7 +37840,7 @@ function discoverMigrationEntries(state) {
|
|
|
37810
37840
|
const blockJsonPath = getSnapshotBlockJsonPath(state.projectDir, block, version2);
|
|
37811
37841
|
const savePath = getSnapshotSavePath(state.projectDir, block, version2);
|
|
37812
37842
|
const rulePath = getRuleFilePath(state.paths, block, version2, currentVersion);
|
|
37813
|
-
if (!
|
|
37843
|
+
if (!fs11.existsSync(manifestPath) || !fs11.existsSync(blockJsonPath) || !fs11.existsSync(savePath) || !fs11.existsSync(rulePath)) {
|
|
37814
37844
|
continue;
|
|
37815
37845
|
}
|
|
37816
37846
|
entries.push({
|
|
@@ -37838,16 +37868,16 @@ function discoverMigrationEntries(state) {
|
|
|
37838
37868
|
}
|
|
37839
37869
|
function assertRuleHasNoTodos(projectDir, block, fromMigrationVersion, toMigrationVersion) {
|
|
37840
37870
|
const rulePath = getRuleFilePath(getProjectPaths(projectDir), block, fromMigrationVersion, toMigrationVersion);
|
|
37841
|
-
if (!
|
|
37871
|
+
if (!fs11.existsSync(rulePath)) {
|
|
37842
37872
|
throw new Error(`Missing migration rule: ${path18.relative(projectDir, rulePath)}`);
|
|
37843
37873
|
}
|
|
37844
|
-
const source =
|
|
37874
|
+
const source = fs11.readFileSync(rulePath, "utf8");
|
|
37845
37875
|
if (source.includes(MIGRATION_TODO_PREFIX)) {
|
|
37846
37876
|
throw new Error(`Migration rule still contains ${MIGRATION_TODO_PREFIX} markers: ${path18.relative(projectDir, rulePath)}`);
|
|
37847
37877
|
}
|
|
37848
37878
|
}
|
|
37849
37879
|
function readRuleMetadata(rulePath) {
|
|
37850
|
-
const source =
|
|
37880
|
+
const source = fs11.readFileSync(rulePath, "utf8");
|
|
37851
37881
|
const unresolvedBlock = source.match(/export const unresolved = \[([\s\S]*?)\] as const;/);
|
|
37852
37882
|
const renameMapBlock = source.match(/export const renameMap: RenameMap = \{([\s\S]*?)\};/);
|
|
37853
37883
|
const transformsBlock = source.match(/export const transforms: TransformMap = \{([\s\S]*?)\};/);
|
|
@@ -37872,7 +37902,7 @@ var init_migration_project_layout = __esm(() => {
|
|
|
37872
37902
|
});
|
|
37873
37903
|
|
|
37874
37904
|
// ../wp-typia-project-tools/src/runtime/migration-project-workspace.ts
|
|
37875
|
-
import
|
|
37905
|
+
import fs12 from "fs";
|
|
37876
37906
|
import path19 from "path";
|
|
37877
37907
|
function createEmptyMigrationProjectBlockJson() {
|
|
37878
37908
|
return {};
|
|
@@ -37901,8 +37931,8 @@ Generated fixtures are used by verify to assert migrations.
|
|
|
37901
37931
|
`]
|
|
37902
37932
|
];
|
|
37903
37933
|
for (const [targetPath, content] of readmeFiles) {
|
|
37904
|
-
if (!
|
|
37905
|
-
|
|
37934
|
+
if (!fs12.existsSync(targetPath)) {
|
|
37935
|
+
fs12.writeFileSync(targetPath, content, "utf8");
|
|
37906
37936
|
}
|
|
37907
37937
|
}
|
|
37908
37938
|
if (!Array.isArray(blocks) || blocks.length === 0) {
|
|
@@ -37920,9 +37950,9 @@ Generated fixtures for ${block.blockName} are stored in this directory.
|
|
|
37920
37950
|
`]
|
|
37921
37951
|
];
|
|
37922
37952
|
for (const [targetPath, content] of scopedReadmes) {
|
|
37923
|
-
if (!
|
|
37924
|
-
|
|
37925
|
-
|
|
37953
|
+
if (!fs12.existsSync(targetPath)) {
|
|
37954
|
+
fs12.mkdirSync(path19.dirname(targetPath), { recursive: true });
|
|
37955
|
+
fs12.writeFileSync(targetPath, content, "utf8");
|
|
37926
37956
|
}
|
|
37927
37957
|
}
|
|
37928
37958
|
}
|
|
@@ -37930,19 +37960,19 @@ Generated fixtures for ${block.blockName} are stored in this directory.
|
|
|
37930
37960
|
function findLegacySemverMigrationArtifacts(projectDir) {
|
|
37931
37961
|
const paths = getProjectPaths(projectDir);
|
|
37932
37962
|
const matches = [];
|
|
37933
|
-
if (
|
|
37934
|
-
for (const entry of
|
|
37963
|
+
if (fs12.existsSync(paths.snapshotDir)) {
|
|
37964
|
+
for (const entry of fs12.readdirSync(paths.snapshotDir, { withFileTypes: true })) {
|
|
37935
37965
|
if (entry.isDirectory() && isLegacySemverMigrationVersion(entry.name)) {
|
|
37936
37966
|
matches.push(normalizeRelativePath(path19.join(SNAPSHOT_DIR, entry.name)));
|
|
37937
37967
|
}
|
|
37938
37968
|
}
|
|
37939
37969
|
}
|
|
37940
37970
|
const scanEdgeDir = (directory, relativeRoot) => {
|
|
37941
|
-
if (!
|
|
37971
|
+
if (!fs12.existsSync(directory)) {
|
|
37942
37972
|
return;
|
|
37943
37973
|
}
|
|
37944
37974
|
const walk = (currentDir, currentRelativeDir) => {
|
|
37945
|
-
for (const entry of
|
|
37975
|
+
for (const entry of fs12.readdirSync(currentDir, { withFileTypes: true })) {
|
|
37946
37976
|
if (entry.isDirectory()) {
|
|
37947
37977
|
walk(path19.join(currentDir, entry.name), path19.join(currentRelativeDir, entry.name));
|
|
37948
37978
|
continue;
|
|
@@ -37960,8 +37990,8 @@ function findLegacySemverMigrationArtifacts(projectDir) {
|
|
|
37960
37990
|
}
|
|
37961
37991
|
function assertNoLegacySemverMigrationWorkspace(projectDir) {
|
|
37962
37992
|
const paths = getProjectPaths(projectDir);
|
|
37963
|
-
if (
|
|
37964
|
-
const source =
|
|
37993
|
+
if (fs12.existsSync(paths.configFile)) {
|
|
37994
|
+
const source = fs12.readFileSync(paths.configFile, "utf8");
|
|
37965
37995
|
if (hasLegacyConfigKeys(source)) {
|
|
37966
37996
|
throw createLegacyMigrationWorkspaceResetError("Detected legacy config keys `currentVersion` / `supportedVersions` in `src/migrations/config.ts`.");
|
|
37967
37997
|
}
|
|
@@ -37978,20 +38008,20 @@ function loadMigrationProject(projectDir, {
|
|
|
37978
38008
|
assertNoLegacySemverMigrationWorkspace(projectDir);
|
|
37979
38009
|
ensureAdvancedMigrationProject(projectDir);
|
|
37980
38010
|
const paths = getProjectPaths(projectDir);
|
|
37981
|
-
const config2 = allowMissingConfig && !
|
|
38011
|
+
const config2 = allowMissingConfig && !fs12.existsSync(paths.configFile) ? {
|
|
37982
38012
|
blocks: [createImplicitLegacyBlock(projectDir)],
|
|
37983
38013
|
currentMigrationVersion: "v1",
|
|
37984
38014
|
snapshotDir: SNAPSHOT_DIR.replace(/\\/g, "/"),
|
|
37985
38015
|
supportedMigrationVersions: []
|
|
37986
|
-
} : parseMigrationConfig(
|
|
38016
|
+
} : parseMigrationConfig(fs12.readFileSync(paths.configFile, "utf8"));
|
|
37987
38017
|
const configuredBlocks = config2.blocks === undefined ? [createImplicitLegacyBlock(projectDir, config2.blockName)] : config2.blocks;
|
|
37988
|
-
const missingManifestFiles = configuredBlocks.filter((block) => !
|
|
38018
|
+
const missingManifestFiles = configuredBlocks.filter((block) => !fs12.existsSync(path19.join(projectDir, block.manifestFile))).map((block) => block.manifestFile);
|
|
37989
38019
|
if (missingManifestFiles.length > 0) {
|
|
37990
38020
|
if (!allowSyncTypes) {
|
|
37991
38021
|
throw new Error("Migration planning is read-only and cannot run `sync-types` automatically. " + `Missing current manifest file(s): ${missingManifestFiles.join(", ")}. ` + "Run your project's `sync-types` script in the project root first, then rerun the planning command.");
|
|
37992
38022
|
}
|
|
37993
38023
|
runProjectScriptIfPresent(projectDir, "sync-types");
|
|
37994
|
-
const remainingManifestFiles = configuredBlocks.filter((block) => !
|
|
38024
|
+
const remainingManifestFiles = configuredBlocks.filter((block) => !fs12.existsSync(path19.join(projectDir, block.manifestFile))).map((block) => block.manifestFile);
|
|
37995
38025
|
if (remainingManifestFiles.length > 0) {
|
|
37996
38026
|
throw new Error(`Missing current manifest file(s): ${remainingManifestFiles.join(", ")}. ` + "Run your project's `sync-types` script in the project root first, then retry.");
|
|
37997
38027
|
}
|
|
@@ -38008,9 +38038,9 @@ function loadMigrationProject(projectDir, {
|
|
|
38008
38038
|
}
|
|
38009
38039
|
function writeMigrationConfig(projectDir, config2) {
|
|
38010
38040
|
const paths = getProjectPaths(projectDir);
|
|
38011
|
-
|
|
38041
|
+
fs12.mkdirSync(path19.dirname(paths.configFile), { recursive: true });
|
|
38012
38042
|
if (!Array.isArray(config2.blocks)) {
|
|
38013
|
-
|
|
38043
|
+
fs12.writeFileSync(paths.configFile, `export const migrationConfig = {
|
|
38014
38044
|
blockName: '${config2.blockName ?? readProjectBlockName(projectDir)}',
|
|
38015
38045
|
currentMigrationVersion: '${config2.currentMigrationVersion}',
|
|
38016
38046
|
supportedMigrationVersions: [ ${config2.supportedMigrationVersions.map((version2) => `'${version2}'`).join(", ")} ],
|
|
@@ -38030,7 +38060,7 @@ export default migrationConfig;
|
|
|
38030
38060
|
typesFile: '${normalizeRelativePath(block.typesFile)}',
|
|
38031
38061
|
},`).join(`
|
|
38032
38062
|
`);
|
|
38033
|
-
|
|
38063
|
+
fs12.writeFileSync(paths.configFile, `export const migrationConfig = {
|
|
38034
38064
|
currentMigrationVersion: '${config2.currentMigrationVersion}',
|
|
38035
38065
|
supportedMigrationVersions: [ ${config2.supportedMigrationVersions.map((version2) => `'${version2}'`).join(", ")} ],
|
|
38036
38066
|
snapshotDir: '${config2.snapshotDir}',
|
|
@@ -38844,7 +38874,7 @@ function buildTransformBodyLines(attribute, legacyPath) {
|
|
|
38844
38874
|
var init_migration_diff_transform = () => {};
|
|
38845
38875
|
|
|
38846
38876
|
// ../wp-typia-project-tools/src/runtime/migration-diff.ts
|
|
38847
|
-
import
|
|
38877
|
+
import fs13 from "fs";
|
|
38848
38878
|
function createMigrationDiff(state, blockOrFromVersion, fromVersionOrToVersion, maybeToVersion) {
|
|
38849
38879
|
if (typeof blockOrFromVersion === "string" && state.blocks.length > 1) {
|
|
38850
38880
|
throw new Error("A block key is required when diffing a multi-block migration project.");
|
|
@@ -38856,7 +38886,7 @@ function createMigrationDiff(state, blockOrFromVersion, fromVersionOrToVersion,
|
|
|
38856
38886
|
throw new Error(typeof blockOrFromVersion === "string" ? "No migration block targets are configured for this project." : `Unknown migration block key: ${blockOrFromVersion.key}`);
|
|
38857
38887
|
}
|
|
38858
38888
|
const snapshotManifestPath = getSnapshotManifestPath(state.projectDir, block, fromVersion);
|
|
38859
|
-
if (!
|
|
38889
|
+
if (!fs13.existsSync(snapshotManifestPath)) {
|
|
38860
38890
|
throw new Error(createMissingBlockSnapshotMessage(block.blockName, fromVersion, getAvailableSnapshotVersionsForBlock(state.projectDir, state.config.supportedMigrationVersions, block)));
|
|
38861
38891
|
}
|
|
38862
38892
|
const targetManifest = toVersion === state.config.currentMigrationVersion ? block.currentManifest : readJson(getSnapshotManifestPath(state.projectDir, block, toVersion));
|
|
@@ -39078,16 +39108,16 @@ var init_migration_diff = __esm(() => {
|
|
|
39078
39108
|
});
|
|
39079
39109
|
|
|
39080
39110
|
// ../wp-typia-project-tools/src/runtime/migration-fixtures.ts
|
|
39081
|
-
import
|
|
39111
|
+
import fs14 from "fs";
|
|
39082
39112
|
import path21 from "path";
|
|
39083
39113
|
function ensureEdgeFixtureFile(projectDir, block, fromVersion, toVersion, diff, { force = false } = {}) {
|
|
39084
39114
|
const fixturePath = getFixtureFilePath(getProjectPaths(projectDir), block, fromVersion, toVersion);
|
|
39085
|
-
|
|
39086
|
-
if (!force &&
|
|
39115
|
+
fs14.mkdirSync(path21.dirname(fixturePath), { recursive: true });
|
|
39116
|
+
if (!force && fs14.existsSync(fixturePath)) {
|
|
39087
39117
|
return { fixturePath, written: false };
|
|
39088
39118
|
}
|
|
39089
39119
|
const fixtureDocument = createEdgeFixtureDocument(projectDir, block, fromVersion, toVersion, diff);
|
|
39090
|
-
|
|
39120
|
+
fs14.writeFileSync(fixturePath, `${JSON.stringify(fixtureDocument, null, "\t")}
|
|
39091
39121
|
`, "utf8");
|
|
39092
39122
|
return { fixturePath, written: true };
|
|
39093
39123
|
}
|
|
@@ -39415,7 +39445,7 @@ var init_migration_render_diff_rule = __esm(() => {
|
|
|
39415
39445
|
});
|
|
39416
39446
|
|
|
39417
39447
|
// ../wp-typia-project-tools/src/runtime/migration-render-generated.ts
|
|
39418
|
-
import
|
|
39448
|
+
import fs15 from "fs";
|
|
39419
39449
|
import path24 from "path";
|
|
39420
39450
|
function renderMigrationRegistryFile(state, blockKey, entries) {
|
|
39421
39451
|
const block = state.blocks.find((entry) => entry.key === blockKey);
|
|
@@ -39427,7 +39457,7 @@ function renderMigrationRegistryFile(state, blockKey, entries) {
|
|
|
39427
39457
|
block.manifestFile.replace(/typia\.manifest\.json$/u, "manifest-document.ts"),
|
|
39428
39458
|
path24.join(path24.dirname(block.typesFile), "manifest-document.ts")
|
|
39429
39459
|
].filter((candidate, index, allCandidates) => candidate !== block.manifestFile && allCandidates.indexOf(candidate) === index);
|
|
39430
|
-
const currentManifestWrapperFile = currentManifestWrapperCandidates.find((candidate) =>
|
|
39460
|
+
const currentManifestWrapperFile = currentManifestWrapperCandidates.find((candidate) => fs15.existsSync(path24.join(state.projectDir, candidate))) ?? null;
|
|
39431
39461
|
const currentManifestSourceFile = currentManifestWrapperFile ?? block.manifestFile;
|
|
39432
39462
|
const currentManifestImport = normalizeImportPath(path24.relative(generatedDir, path24.join(state.projectDir, currentManifestSourceFile)), currentManifestWrapperFile !== null);
|
|
39433
39463
|
const imports = [
|
|
@@ -39572,12 +39602,12 @@ function renderPhpMigrationRegistryFile(state, entries) {
|
|
|
39572
39602
|
return [
|
|
39573
39603
|
version2,
|
|
39574
39604
|
{
|
|
39575
|
-
blockJson:
|
|
39605
|
+
blockJson: fs15.existsSync(blockJsonPath) ? {
|
|
39576
39606
|
attributeNames: Object.keys(readJson(blockJsonPath).attributes ?? {}),
|
|
39577
39607
|
name: readJson(blockJsonPath).name ?? null
|
|
39578
39608
|
} : null,
|
|
39579
|
-
hasSaveSnapshot:
|
|
39580
|
-
manifest:
|
|
39609
|
+
hasSaveSnapshot: fs15.existsSync(savePath),
|
|
39610
|
+
manifest: fs15.existsSync(manifestPath) ? summarizeManifest(readJson(manifestPath)) : null
|
|
39581
39611
|
}
|
|
39582
39612
|
];
|
|
39583
39613
|
}));
|
|
@@ -40067,7 +40097,7 @@ var init_migration_render = __esm(() => {
|
|
|
40067
40097
|
});
|
|
40068
40098
|
|
|
40069
40099
|
// ../wp-typia-project-tools/src/runtime/migration-generated-artifacts.ts
|
|
40070
|
-
import
|
|
40100
|
+
import fs16 from "fs";
|
|
40071
40101
|
import path25 from "path";
|
|
40072
40102
|
function collectGeneratedMigrationEntries(state) {
|
|
40073
40103
|
return discoverMigrationEntries(state).map((entry) => {
|
|
@@ -40092,14 +40122,14 @@ function regenerateGeneratedArtifacts(projectDir) {
|
|
|
40092
40122
|
const blockGeneratedEntries = generatedEntries.filter(({ entry }) => entry.block.key === block.key);
|
|
40093
40123
|
const entries = blockGeneratedEntries.map(({ entry }) => entry);
|
|
40094
40124
|
const generatedDir = getGeneratedDirForBlock(state.paths, block);
|
|
40095
|
-
|
|
40096
|
-
|
|
40097
|
-
|
|
40098
|
-
|
|
40099
|
-
|
|
40125
|
+
fs16.mkdirSync(generatedDir, { recursive: true });
|
|
40126
|
+
fs16.writeFileSync(path25.join(generatedDir, "registry.ts"), renderMigrationRegistryFile(state, block.key, blockGeneratedEntries), "utf8");
|
|
40127
|
+
fs16.writeFileSync(path25.join(generatedDir, "deprecated.ts"), renderGeneratedDeprecatedFile(state, block.key, entries), "utf8");
|
|
40128
|
+
fs16.writeFileSync(path25.join(generatedDir, "verify.ts"), renderVerifyFile(state, block.key, entries), "utf8");
|
|
40129
|
+
fs16.writeFileSync(path25.join(generatedDir, "fuzz.ts"), renderFuzzFile(state, block.key, blockGeneratedEntries), "utf8");
|
|
40100
40130
|
}
|
|
40101
|
-
|
|
40102
|
-
|
|
40131
|
+
fs16.writeFileSync(path25.join(state.paths.generatedDir, "index.ts"), renderGeneratedMigrationIndexFile(state, generatedEntries.map(({ entry }) => entry)), "utf8");
|
|
40132
|
+
fs16.writeFileSync(path25.join(projectDir, ROOT_PHP_MIGRATION_REGISTRY), renderPhpMigrationRegistryFile(state, generatedEntries.map(({ entry }) => entry)), "utf8");
|
|
40103
40133
|
}
|
|
40104
40134
|
var init_migration_generated_artifacts = __esm(() => {
|
|
40105
40135
|
init_migration_constants();
|
|
@@ -40111,9 +40141,9 @@ var init_migration_generated_artifacts = __esm(() => {
|
|
|
40111
40141
|
});
|
|
40112
40142
|
|
|
40113
40143
|
// ../wp-typia-project-tools/src/runtime/migration-planning.ts
|
|
40114
|
-
import
|
|
40144
|
+
import fs17 from "fs";
|
|
40115
40145
|
function hasSnapshotForVersion(state, block, version2) {
|
|
40116
|
-
return
|
|
40146
|
+
return fs17.existsSync(getSnapshotManifestPath(state.projectDir, block, version2));
|
|
40117
40147
|
}
|
|
40118
40148
|
function listConfiguredLegacyVersions(state) {
|
|
40119
40149
|
return state.config.supportedMigrationVersions.filter((version2) => version2 !== state.config.currentMigrationVersion).sort(compareMigrationVersionLabels);
|
|
@@ -41945,11 +41975,11 @@ var require_buffer_from = __commonJS((exports, module2) => {
|
|
|
41945
41975
|
var require_source_map_support = __commonJS((exports, module2) => {
|
|
41946
41976
|
var SourceMapConsumer = require_source_map().SourceMapConsumer;
|
|
41947
41977
|
var path7 = __require("path");
|
|
41948
|
-
var
|
|
41978
|
+
var fs18;
|
|
41949
41979
|
try {
|
|
41950
|
-
|
|
41951
|
-
if (!
|
|
41952
|
-
|
|
41980
|
+
fs18 = __require("fs");
|
|
41981
|
+
if (!fs18.existsSync || !fs18.readFileSync) {
|
|
41982
|
+
fs18 = null;
|
|
41953
41983
|
}
|
|
41954
41984
|
} catch (err2) {}
|
|
41955
41985
|
var bufferFrom = require_buffer_from();
|
|
@@ -42016,15 +42046,15 @@ var require_source_map_support = __commonJS((exports, module2) => {
|
|
|
42016
42046
|
}
|
|
42017
42047
|
var contents = "";
|
|
42018
42048
|
try {
|
|
42019
|
-
if (!
|
|
42049
|
+
if (!fs18) {
|
|
42020
42050
|
var xhr = new XMLHttpRequest;
|
|
42021
42051
|
xhr.open("GET", path26, false);
|
|
42022
42052
|
xhr.send(null);
|
|
42023
42053
|
if (xhr.readyState === 4 && xhr.status === 200) {
|
|
42024
42054
|
contents = xhr.responseText;
|
|
42025
42055
|
}
|
|
42026
|
-
} else if (
|
|
42027
|
-
contents =
|
|
42056
|
+
} else if (fs18.existsSync(path26)) {
|
|
42057
|
+
contents = fs18.readFileSync(path26, "utf8");
|
|
42028
42058
|
}
|
|
42029
42059
|
} catch (er) {}
|
|
42030
42060
|
return fileContentsCache[path26] = contents;
|
|
@@ -42288,9 +42318,9 @@ var require_source_map_support = __commonJS((exports, module2) => {
|
|
|
42288
42318
|
var line = +match3[2];
|
|
42289
42319
|
var column = +match3[3];
|
|
42290
42320
|
var contents = fileContentsCache[source];
|
|
42291
|
-
if (!contents &&
|
|
42321
|
+
if (!contents && fs18 && fs18.existsSync(source)) {
|
|
42292
42322
|
try {
|
|
42293
|
-
contents =
|
|
42323
|
+
contents = fs18.readFileSync(source, "utf8");
|
|
42294
42324
|
} catch (er) {
|
|
42295
42325
|
contents = "";
|
|
42296
42326
|
}
|
|
@@ -46086,10 +46116,10 @@ var require_typescript = __commonJS((exports, module2) => {
|
|
|
46086
46116
|
function and(f, g2) {
|
|
46087
46117
|
return (arg) => f(arg) && g2(arg);
|
|
46088
46118
|
}
|
|
46089
|
-
function or(...
|
|
46119
|
+
function or(...fs18) {
|
|
46090
46120
|
return (...args) => {
|
|
46091
46121
|
let lastResult;
|
|
46092
|
-
for (const f of
|
|
46122
|
+
for (const f of fs18) {
|
|
46093
46123
|
lastResult = f(...args);
|
|
46094
46124
|
if (lastResult) {
|
|
46095
46125
|
return lastResult;
|
|
@@ -47543,7 +47573,7 @@ ${lanes.join(`
|
|
|
47543
47573
|
var tracing;
|
|
47544
47574
|
var tracingEnabled;
|
|
47545
47575
|
((tracingEnabled2) => {
|
|
47546
|
-
let
|
|
47576
|
+
let fs18;
|
|
47547
47577
|
let traceCount = 0;
|
|
47548
47578
|
let traceFd = 0;
|
|
47549
47579
|
let mode;
|
|
@@ -47552,9 +47582,9 @@ ${lanes.join(`
|
|
|
47552
47582
|
const legend = [];
|
|
47553
47583
|
function startTracing2(tracingMode, traceDir, configFilePath) {
|
|
47554
47584
|
Debug.assert(!tracing, "Tracing already started");
|
|
47555
|
-
if (
|
|
47585
|
+
if (fs18 === undefined) {
|
|
47556
47586
|
try {
|
|
47557
|
-
|
|
47587
|
+
fs18 = __require("fs");
|
|
47558
47588
|
} catch (e) {
|
|
47559
47589
|
throw new Error(`tracing requires having fs
|
|
47560
47590
|
(original error: ${e.message || e})`);
|
|
@@ -47565,8 +47595,8 @@ ${lanes.join(`
|
|
|
47565
47595
|
if (legendPath === undefined) {
|
|
47566
47596
|
legendPath = combinePaths(traceDir, "legend.json");
|
|
47567
47597
|
}
|
|
47568
|
-
if (!
|
|
47569
|
-
|
|
47598
|
+
if (!fs18.existsSync(traceDir)) {
|
|
47599
|
+
fs18.mkdirSync(traceDir, { recursive: true });
|
|
47570
47600
|
}
|
|
47571
47601
|
const countPart = mode === "build" ? `.${process.pid}-${++traceCount}` : mode === "server" ? `.${process.pid}` : ``;
|
|
47572
47602
|
const tracePath = combinePaths(traceDir, `trace${countPart}.json`);
|
|
@@ -47576,10 +47606,10 @@ ${lanes.join(`
|
|
|
47576
47606
|
tracePath,
|
|
47577
47607
|
typesPath
|
|
47578
47608
|
});
|
|
47579
|
-
traceFd =
|
|
47609
|
+
traceFd = fs18.openSync(tracePath, "w");
|
|
47580
47610
|
tracing = tracingEnabled2;
|
|
47581
47611
|
const meta4 = { cat: "__metadata", ph: "M", ts: 1000 * timestamp(), pid: 1, tid: 1 };
|
|
47582
|
-
|
|
47612
|
+
fs18.writeSync(traceFd, `[
|
|
47583
47613
|
` + [{ name: "process_name", args: { name: "tsc" }, ...meta4 }, { name: "thread_name", args: { name: "Main" }, ...meta4 }, { name: "TracingStartedInBrowser", ...meta4, cat: "disabled-by-default-devtools.timeline" }].map((v2) => JSON.stringify(v2)).join(`,
|
|
47584
47614
|
`));
|
|
47585
47615
|
}
|
|
@@ -47587,10 +47617,10 @@ ${lanes.join(`
|
|
|
47587
47617
|
function stopTracing() {
|
|
47588
47618
|
Debug.assert(tracing, "Tracing is not in progress");
|
|
47589
47619
|
Debug.assert(!!typeCatalog.length === (mode !== "server"));
|
|
47590
|
-
|
|
47620
|
+
fs18.writeSync(traceFd, `
|
|
47591
47621
|
]
|
|
47592
47622
|
`);
|
|
47593
|
-
|
|
47623
|
+
fs18.closeSync(traceFd);
|
|
47594
47624
|
tracing = undefined;
|
|
47595
47625
|
if (typeCatalog.length) {
|
|
47596
47626
|
dumpTypes(typeCatalog);
|
|
@@ -47655,13 +47685,13 @@ ${lanes.join(`
|
|
|
47655
47685
|
if (mode === "server" && phase === "checkTypes")
|
|
47656
47686
|
return;
|
|
47657
47687
|
mark("beginTracing");
|
|
47658
|
-
|
|
47688
|
+
fs18.writeSync(traceFd, `,
|
|
47659
47689
|
{"pid":1,"tid":1,"ph":"${eventType}","cat":"${phase}","ts":${time3},"name":"${name2}"`);
|
|
47660
47690
|
if (extras)
|
|
47661
|
-
|
|
47691
|
+
fs18.writeSync(traceFd, `,${extras}`);
|
|
47662
47692
|
if (args)
|
|
47663
|
-
|
|
47664
|
-
|
|
47693
|
+
fs18.writeSync(traceFd, `,"args":${JSON.stringify(args)}`);
|
|
47694
|
+
fs18.writeSync(traceFd, `}`);
|
|
47665
47695
|
mark("endTracing");
|
|
47666
47696
|
measure("Tracing", "beginTracing", "endTracing");
|
|
47667
47697
|
}
|
|
@@ -47683,9 +47713,9 @@ ${lanes.join(`
|
|
|
47683
47713
|
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r2, _s;
|
|
47684
47714
|
mark("beginDumpTypes");
|
|
47685
47715
|
const typesPath = legend[legend.length - 1].typesPath;
|
|
47686
|
-
const typesFd =
|
|
47716
|
+
const typesFd = fs18.openSync(typesPath, "w");
|
|
47687
47717
|
const recursionIdentityMap = /* @__PURE__ */ new Map;
|
|
47688
|
-
|
|
47718
|
+
fs18.writeSync(typesFd, "[");
|
|
47689
47719
|
const numTypes = types.length;
|
|
47690
47720
|
for (let i = 0;i < numTypes; i++) {
|
|
47691
47721
|
const type = types[i];
|
|
@@ -47781,15 +47811,15 @@ ${lanes.join(`
|
|
|
47781
47811
|
flags: Debug.formatTypeFlags(type.flags).split("|"),
|
|
47782
47812
|
display
|
|
47783
47813
|
};
|
|
47784
|
-
|
|
47814
|
+
fs18.writeSync(typesFd, JSON.stringify(descriptor));
|
|
47785
47815
|
if (i < numTypes - 1) {
|
|
47786
|
-
|
|
47816
|
+
fs18.writeSync(typesFd, `,
|
|
47787
47817
|
`);
|
|
47788
47818
|
}
|
|
47789
47819
|
}
|
|
47790
|
-
|
|
47820
|
+
fs18.writeSync(typesFd, `]
|
|
47791
47821
|
`);
|
|
47792
|
-
|
|
47822
|
+
fs18.closeSync(typesFd);
|
|
47793
47823
|
mark("endDumpTypes");
|
|
47794
47824
|
measure("Dump types", "beginDumpTypes", "endDumpTypes");
|
|
47795
47825
|
}
|
|
@@ -47797,7 +47827,7 @@ ${lanes.join(`
|
|
|
47797
47827
|
if (!legendPath) {
|
|
47798
47828
|
return;
|
|
47799
47829
|
}
|
|
47800
|
-
|
|
47830
|
+
fs18.writeFileSync(legendPath, JSON.stringify(legend));
|
|
47801
47831
|
}
|
|
47802
47832
|
tracingEnabled2.dumpLegend = dumpLegend;
|
|
47803
47833
|
})(tracingEnabled || (tracingEnabled = {}));
|
|
@@ -211264,90 +211294,97 @@ function matchesPhpFunctionCallAt(source, index, functionName) {
|
|
|
211264
211294
|
const callStart = skipPhpCallTrivia(source, cursor);
|
|
211265
211295
|
return callStart !== null && source[callStart] === "(";
|
|
211266
211296
|
}
|
|
211267
|
-
function
|
|
211268
|
-
|
|
211269
|
-
|
|
211270
|
-
|
|
211271
|
-
|
|
211272
|
-
|
|
211273
|
-
|
|
211274
|
-
|
|
211275
|
-
|
|
211276
|
-
|
|
211277
|
-
|
|
211278
|
-
|
|
211279
|
-
|
|
211280
|
-
}
|
|
211281
|
-
const nextLineStart = findPhpLineBoundary(source, index).nextStart;
|
|
211282
|
-
if (nextLineStart <= index) {
|
|
211283
|
-
return false;
|
|
211284
|
-
}
|
|
211285
|
-
index = nextLineStart;
|
|
211286
|
-
continue;
|
|
211297
|
+
function createPhpScannerState() {
|
|
211298
|
+
return {
|
|
211299
|
+
heredocDelimiter: "",
|
|
211300
|
+
mode: "code"
|
|
211301
|
+
};
|
|
211302
|
+
}
|
|
211303
|
+
function advancePhpScanner(source, index, state) {
|
|
211304
|
+
const character = source[index];
|
|
211305
|
+
if (state.mode === "heredoc") {
|
|
211306
|
+
const closingEnd = findPhpHeredocClosingEnd(source, index, state.heredocDelimiter);
|
|
211307
|
+
if (closingEnd !== null) {
|
|
211308
|
+
state.mode = "code";
|
|
211309
|
+
state.heredocDelimiter = "";
|
|
211310
|
+
return { ambiguous: false, inCode: false, index: closingEnd };
|
|
211287
211311
|
}
|
|
211288
|
-
|
|
211289
|
-
|
|
211290
|
-
|
|
211291
|
-
index += 2;
|
|
211292
|
-
continue;
|
|
211293
|
-
}
|
|
211294
|
-
if (character === quote) {
|
|
211295
|
-
mode = "code";
|
|
211296
|
-
}
|
|
211297
|
-
index += 1;
|
|
211298
|
-
continue;
|
|
211312
|
+
const nextLineStart = findPhpLineBoundary(source, index).nextStart;
|
|
211313
|
+
if (nextLineStart <= index) {
|
|
211314
|
+
return { ambiguous: true, inCode: false, index };
|
|
211299
211315
|
}
|
|
211300
|
-
|
|
211301
|
-
|
|
211302
|
-
|
|
211303
|
-
|
|
211304
|
-
|
|
211305
|
-
index
|
|
211306
|
-
continue;
|
|
211316
|
+
return { ambiguous: false, inCode: false, index: nextLineStart };
|
|
211317
|
+
}
|
|
211318
|
+
if (state.mode === "single-quoted" || state.mode === "double-quoted") {
|
|
211319
|
+
const quote = state.mode === "single-quoted" ? "'" : '"';
|
|
211320
|
+
if (character === "\\") {
|
|
211321
|
+
return { ambiguous: false, inCode: false, index: index + 2 };
|
|
211307
211322
|
}
|
|
211308
|
-
if (
|
|
211309
|
-
|
|
211310
|
-
mode = "code";
|
|
211311
|
-
index += 2;
|
|
211312
|
-
continue;
|
|
211313
|
-
}
|
|
211314
|
-
index += 1;
|
|
211315
|
-
continue;
|
|
211323
|
+
if (character === quote) {
|
|
211324
|
+
state.mode = "code";
|
|
211316
211325
|
}
|
|
211317
|
-
|
|
211318
|
-
|
|
211319
|
-
|
|
211320
|
-
|
|
211326
|
+
return { ambiguous: false, inCode: false, index: index + 1 };
|
|
211327
|
+
}
|
|
211328
|
+
if (state.mode === "line-comment") {
|
|
211329
|
+
if (character === "\r" || character === `
|
|
211330
|
+
`) {
|
|
211331
|
+
state.mode = "code";
|
|
211321
211332
|
}
|
|
211322
|
-
|
|
211323
|
-
|
|
211324
|
-
|
|
211325
|
-
|
|
211333
|
+
return { ambiguous: false, inCode: false, index: index + 1 };
|
|
211334
|
+
}
|
|
211335
|
+
if (state.mode === "block-comment") {
|
|
211336
|
+
if (character === "*" && source[index + 1] === "/") {
|
|
211337
|
+
state.mode = "code";
|
|
211338
|
+
return { ambiguous: false, inCode: false, index: index + 2 };
|
|
211326
211339
|
}
|
|
211327
|
-
|
|
211328
|
-
|
|
211329
|
-
|
|
211330
|
-
|
|
211340
|
+
return { ambiguous: false, inCode: false, index: index + 1 };
|
|
211341
|
+
}
|
|
211342
|
+
if (character === "'") {
|
|
211343
|
+
state.mode = "single-quoted";
|
|
211344
|
+
return { ambiguous: false, inCode: false, index: index + 1 };
|
|
211345
|
+
}
|
|
211346
|
+
if (character === '"') {
|
|
211347
|
+
state.mode = "double-quoted";
|
|
211348
|
+
return { ambiguous: false, inCode: false, index: index + 1 };
|
|
211349
|
+
}
|
|
211350
|
+
if (character === "/" && source[index + 1] === "/") {
|
|
211351
|
+
state.mode = "line-comment";
|
|
211352
|
+
return { ambiguous: false, inCode: false, index: index + 2 };
|
|
211353
|
+
}
|
|
211354
|
+
if (character === "#" && source[index + 1] !== "[") {
|
|
211355
|
+
state.mode = "line-comment";
|
|
211356
|
+
return { ambiguous: false, inCode: false, index: index + 1 };
|
|
211357
|
+
}
|
|
211358
|
+
if (character === "/" && source[index + 1] === "*") {
|
|
211359
|
+
state.mode = "block-comment";
|
|
211360
|
+
return { ambiguous: false, inCode: false, index: index + 2 };
|
|
211361
|
+
}
|
|
211362
|
+
if (character === "<") {
|
|
211363
|
+
const heredocStart = parsePhpHeredocStart(source, index);
|
|
211364
|
+
if (heredocStart) {
|
|
211365
|
+
state.mode = "heredoc";
|
|
211366
|
+
state.heredocDelimiter = heredocStart.delimiter;
|
|
211367
|
+
return {
|
|
211368
|
+
ambiguous: false,
|
|
211369
|
+
inCode: false,
|
|
211370
|
+
index: heredocStart.contentStart
|
|
211371
|
+
};
|
|
211331
211372
|
}
|
|
211332
|
-
|
|
211333
|
-
|
|
211334
|
-
|
|
211335
|
-
|
|
211373
|
+
}
|
|
211374
|
+
return { ambiguous: false, inCode: true, index };
|
|
211375
|
+
}
|
|
211376
|
+
function hasPhpFunctionCall(source, functionName) {
|
|
211377
|
+
const scanner = createPhpScannerState();
|
|
211378
|
+
let index = 0;
|
|
211379
|
+
while (index < source.length) {
|
|
211380
|
+
const scan = advancePhpScanner(source, index, scanner);
|
|
211381
|
+
if (scan.ambiguous) {
|
|
211382
|
+
return false;
|
|
211336
211383
|
}
|
|
211337
|
-
if (
|
|
211338
|
-
|
|
211339
|
-
index += 2;
|
|
211384
|
+
if (!scan.inCode) {
|
|
211385
|
+
index = scan.index;
|
|
211340
211386
|
continue;
|
|
211341
211387
|
}
|
|
211342
|
-
if (character === "<") {
|
|
211343
|
-
const heredocStart = parsePhpHeredocStart(source, index);
|
|
211344
|
-
if (heredocStart) {
|
|
211345
|
-
mode = "heredoc";
|
|
211346
|
-
heredocDelimiter = heredocStart.delimiter;
|
|
211347
|
-
index = heredocStart.contentStart;
|
|
211348
|
-
continue;
|
|
211349
|
-
}
|
|
211350
|
-
}
|
|
211351
211388
|
if (matchesPhpFunctionCallAt(source, index, functionName)) {
|
|
211352
211389
|
return true;
|
|
211353
211390
|
}
|
|
@@ -211368,89 +211405,18 @@ function findPhpFunctionRange(source, functionName, options = {}) {
|
|
|
211368
211405
|
}
|
|
211369
211406
|
const openBraceIndex = functionStart + openBraceOffset;
|
|
211370
211407
|
let depth = 0;
|
|
211371
|
-
|
|
211372
|
-
let heredocDelimiter = "";
|
|
211408
|
+
const scanner = createPhpScannerState();
|
|
211373
211409
|
let index = openBraceIndex;
|
|
211374
211410
|
while (index < source.length) {
|
|
211375
|
-
const
|
|
211376
|
-
if (
|
|
211377
|
-
|
|
211378
|
-
if (closingEnd !== null) {
|
|
211379
|
-
mode = "code";
|
|
211380
|
-
heredocDelimiter = "";
|
|
211381
|
-
index = closingEnd;
|
|
211382
|
-
continue;
|
|
211383
|
-
}
|
|
211384
|
-
const nextLineStart = findPhpLineBoundary(source, index).nextStart;
|
|
211385
|
-
if (nextLineStart <= index) {
|
|
211386
|
-
return null;
|
|
211387
|
-
}
|
|
211388
|
-
index = nextLineStart;
|
|
211389
|
-
continue;
|
|
211390
|
-
}
|
|
211391
|
-
if (mode === "single-quoted" || mode === "double-quoted") {
|
|
211392
|
-
const quote = mode === "single-quoted" ? "'" : '"';
|
|
211393
|
-
if (character === "\\") {
|
|
211394
|
-
index += 2;
|
|
211395
|
-
continue;
|
|
211396
|
-
}
|
|
211397
|
-
if (character === quote) {
|
|
211398
|
-
mode = "code";
|
|
211399
|
-
}
|
|
211400
|
-
index += 1;
|
|
211401
|
-
continue;
|
|
211402
|
-
}
|
|
211403
|
-
if (mode === "line-comment") {
|
|
211404
|
-
if (character === "\r" || character === `
|
|
211405
|
-
`) {
|
|
211406
|
-
mode = "code";
|
|
211407
|
-
}
|
|
211408
|
-
index += 1;
|
|
211409
|
-
continue;
|
|
211410
|
-
}
|
|
211411
|
-
if (mode === "block-comment") {
|
|
211412
|
-
if (character === "*" && source[index + 1] === "/") {
|
|
211413
|
-
mode = "code";
|
|
211414
|
-
index += 2;
|
|
211415
|
-
continue;
|
|
211416
|
-
}
|
|
211417
|
-
index += 1;
|
|
211418
|
-
continue;
|
|
211419
|
-
}
|
|
211420
|
-
if (character === "'") {
|
|
211421
|
-
mode = "single-quoted";
|
|
211422
|
-
index += 1;
|
|
211423
|
-
continue;
|
|
211424
|
-
}
|
|
211425
|
-
if (character === '"') {
|
|
211426
|
-
mode = "double-quoted";
|
|
211427
|
-
index += 1;
|
|
211428
|
-
continue;
|
|
211429
|
-
}
|
|
211430
|
-
if (character === "/" && source[index + 1] === "/") {
|
|
211431
|
-
mode = "line-comment";
|
|
211432
|
-
index += 2;
|
|
211433
|
-
continue;
|
|
211411
|
+
const scan = advancePhpScanner(source, index, scanner);
|
|
211412
|
+
if (scan.ambiguous) {
|
|
211413
|
+
return null;
|
|
211434
211414
|
}
|
|
211435
|
-
if (
|
|
211436
|
-
|
|
211437
|
-
index += 1;
|
|
211415
|
+
if (!scan.inCode) {
|
|
211416
|
+
index = scan.index;
|
|
211438
211417
|
continue;
|
|
211439
211418
|
}
|
|
211440
|
-
|
|
211441
|
-
mode = "block-comment";
|
|
211442
|
-
index += 2;
|
|
211443
|
-
continue;
|
|
211444
|
-
}
|
|
211445
|
-
if (character === "<") {
|
|
211446
|
-
const heredocStart = parsePhpHeredocStart(source, index);
|
|
211447
|
-
if (heredocStart) {
|
|
211448
|
-
mode = "heredoc";
|
|
211449
|
-
heredocDelimiter = heredocStart.delimiter;
|
|
211450
|
-
index = heredocStart.contentStart;
|
|
211451
|
-
continue;
|
|
211452
|
-
}
|
|
211453
|
-
}
|
|
211419
|
+
const character = source[index];
|
|
211454
211420
|
if (character === "{") {
|
|
211455
211421
|
depth += 1;
|
|
211456
211422
|
index += 1;
|
|
@@ -211491,7 +211457,7 @@ function replacePhpFunctionDefinition(source, functionName, replacement, options
|
|
|
211491
211457
|
}
|
|
211492
211458
|
|
|
211493
211459
|
// ../wp-typia-project-tools/src/runtime/workspace-inventory.ts
|
|
211494
|
-
import
|
|
211460
|
+
import fs18 from "fs";
|
|
211495
211461
|
import path26 from "path";
|
|
211496
211462
|
import { readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
|
|
211497
211463
|
function defineInventoryEntryParser(descriptor) {
|
|
@@ -211670,7 +211636,7 @@ function readWorkspaceInventory(projectDir) {
|
|
|
211670
211636
|
const blockConfigPath = path26.join(projectDir, "scripts", "block-config.ts");
|
|
211671
211637
|
let source;
|
|
211672
211638
|
try {
|
|
211673
|
-
source =
|
|
211639
|
+
source = fs18.readFileSync(blockConfigPath, "utf8");
|
|
211674
211640
|
} catch (error48) {
|
|
211675
211641
|
if (typeof error48 === "object" && error48 !== null && "code" in error48 && error48.code === "ENOENT") {
|
|
211676
211642
|
throw new Error(`Workspace inventory file is missing at ${blockConfigPath}. Expected scripts/block-config.ts to exist.`);
|
|
@@ -212289,7 +212255,7 @@ ${WORKSPACE_COMPATIBILITY_CONFIG_FIELD} dataFile: string;
|
|
|
212289
212255
|
});
|
|
212290
212256
|
|
|
212291
212257
|
// ../wp-typia-project-tools/src/runtime/migration-maintenance-verify.ts
|
|
212292
|
-
import
|
|
212258
|
+
import fs19 from "fs";
|
|
212293
212259
|
import path27 from "path";
|
|
212294
212260
|
import { execFileSync } from "child_process";
|
|
212295
212261
|
function verifyProjectMigrations(projectDir, {
|
|
@@ -212315,7 +212281,7 @@ function verifyProjectMigrations(projectDir, {
|
|
|
212315
212281
|
assertRuleHasNoTodos(projectDir, block, entry.fromVersion, state.config.currentMigrationVersion);
|
|
212316
212282
|
}
|
|
212317
212283
|
const verifyScriptPath = path27.join(getGeneratedDirForBlock(state.paths, block), "verify.ts");
|
|
212318
|
-
if (!
|
|
212284
|
+
if (!fs19.existsSync(verifyScriptPath)) {
|
|
212319
212285
|
const selectedVersionsForBlock2 = entries.map((entry) => entry.fromVersion);
|
|
212320
212286
|
throw new Error(`Generated verify script is missing for ${block.blockName} (${selectedVersionsForBlock2.join(", ")}). ` + `Run \`${formatScaffoldCommand(selectedVersionsForBlock2)}\` first, then \`wp-typia migrate doctor --all\` if the workspace should already be scaffolded.`);
|
|
212321
212287
|
}
|
|
@@ -212391,14 +212357,14 @@ function doctorProjectMigrations(projectDir, {
|
|
|
212391
212357
|
const blockJsonPath = getSnapshotBlockJsonPath(projectDir, block, version2);
|
|
212392
212358
|
const manifestPath = getSnapshotManifestPath(projectDir, block, version2);
|
|
212393
212359
|
const savePath = getSnapshotSavePath(projectDir, block, version2);
|
|
212394
|
-
const hasSnapshot =
|
|
212360
|
+
const hasSnapshot = fs19.existsSync(snapshotRoot);
|
|
212395
212361
|
const snapshotIsOptional = !hasSnapshot && isSnapshotOptionalForBlockVersion(state, block, version2);
|
|
212396
212362
|
recordCheck(hasSnapshot || snapshotIsOptional ? "pass" : "fail", legacySingleBlock ? `Snapshot ${version2}` : `Snapshot ${block.blockName} @ ${version2}`, hasSnapshot ? path27.relative(projectDir, snapshotRoot) : "Not present for this version");
|
|
212397
212363
|
if (!hasSnapshot) {
|
|
212398
212364
|
continue;
|
|
212399
212365
|
}
|
|
212400
212366
|
for (const targetPath of [blockJsonPath, manifestPath, savePath]) {
|
|
212401
|
-
recordCheck(
|
|
212367
|
+
recordCheck(fs19.existsSync(targetPath) ? "pass" : "fail", legacySingleBlock ? `Snapshot file ${version2}` : `Snapshot file ${block.blockName} @ ${version2}`, fs19.existsSync(targetPath) ? path27.relative(projectDir, targetPath) : `Missing ${path27.relative(projectDir, targetPath)}`);
|
|
212402
212368
|
}
|
|
212403
212369
|
}
|
|
212404
212370
|
}
|
|
@@ -212417,7 +212383,7 @@ function doctorProjectMigrations(projectDir, {
|
|
|
212417
212383
|
expectedGeneratedFiles.set(path27.join(state.paths.generatedDir, "index.ts"), renderGeneratedMigrationIndexFile(state, generatedEntries.map(({ entry }) => entry)));
|
|
212418
212384
|
expectedGeneratedFiles.set(path27.join(projectDir, ROOT_PHP_MIGRATION_REGISTRY), renderPhpMigrationRegistryFile(state, generatedEntries.map(({ entry }) => entry)));
|
|
212419
212385
|
for (const [filePath, expectedSource] of expectedGeneratedFiles) {
|
|
212420
|
-
const inSync =
|
|
212386
|
+
const inSync = fs19.existsSync(filePath) && fs19.readFileSync(filePath, "utf8") === expectedSource;
|
|
212421
212387
|
recordCheck(inSync ? "pass" : "fail", `Generated ${path27.relative(projectDir, filePath)}`, inSync ? "In sync" : "Run `wp-typia migrate scaffold --from-migration-version <label>` or regenerate artifacts");
|
|
212422
212388
|
}
|
|
212423
212389
|
} catch (error48) {
|
|
@@ -212431,9 +212397,9 @@ function doctorProjectMigrations(projectDir, {
|
|
|
212431
212397
|
}
|
|
212432
212398
|
const rulePath = getRuleFilePath(state.paths, block, version2, state.config.currentMigrationVersion);
|
|
212433
212399
|
const fixturePath = getFixtureFilePath(state.paths, block, version2, state.config.currentMigrationVersion);
|
|
212434
|
-
recordCheck(
|
|
212435
|
-
recordCheck(
|
|
212436
|
-
if (!
|
|
212400
|
+
recordCheck(fs19.existsSync(rulePath) ? "pass" : "fail", legacySingleBlock ? `Rule ${version2}` : `Rule ${block.blockName} @ ${version2}`, fs19.existsSync(rulePath) ? path27.relative(projectDir, rulePath) : `Missing ${path27.relative(projectDir, rulePath)}`);
|
|
212401
|
+
recordCheck(fs19.existsSync(fixturePath) ? "pass" : "fail", legacySingleBlock ? `Fixture ${version2}` : `Fixture ${block.blockName} @ ${version2}`, fs19.existsSync(fixturePath) ? path27.relative(projectDir, fixturePath) : `Missing ${path27.relative(projectDir, fixturePath)}`);
|
|
212402
|
+
if (!fs19.existsSync(rulePath) || !fs19.existsSync(fixturePath)) {
|
|
212437
212403
|
continue;
|
|
212438
212404
|
}
|
|
212439
212405
|
try {
|
|
@@ -212486,7 +212452,7 @@ var init_migration_maintenance_verify = __esm(() => {
|
|
|
212486
212452
|
});
|
|
212487
212453
|
|
|
212488
212454
|
// ../wp-typia-project-tools/src/runtime/migration-maintenance-fixtures.ts
|
|
212489
|
-
import
|
|
212455
|
+
import fs20 from "fs";
|
|
212490
212456
|
import path28 from "path";
|
|
212491
212457
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
212492
212458
|
function fixturesProjectMigrations(projectDir, {
|
|
@@ -212509,7 +212475,7 @@ function fixturesProjectMigrations(projectDir, {
|
|
|
212509
212475
|
const skippedVersions = [];
|
|
212510
212476
|
const fixtureTargets = collectFixtureTargets(state, targetVersions, targetMigrationVersion);
|
|
212511
212477
|
if (force) {
|
|
212512
|
-
const overwriteTargets = fixtureTargets.filter(({ fixturePath }) =>
|
|
212478
|
+
const overwriteTargets = fixtureTargets.filter(({ fixturePath }) => fs20.existsSync(fixturePath));
|
|
212513
212479
|
if (isInteractive && overwriteTargets.length > 0) {
|
|
212514
212480
|
const confirmed = confirmOverwrite?.(`About to overwrite ${overwriteTargets.length} existing migration fixture file(s). Continue?`) ?? promptForConfirmation(`About to overwrite ${overwriteTargets.length} existing migration fixture file(s). Continue?`);
|
|
212515
212481
|
if (!confirmed) {
|
|
@@ -212522,7 +212488,7 @@ function fixturesProjectMigrations(projectDir, {
|
|
|
212522
212488
|
}
|
|
212523
212489
|
}
|
|
212524
212490
|
for (const { block, fixturePath, scopedLabel, version: version2 } of fixtureTargets) {
|
|
212525
|
-
const existed =
|
|
212491
|
+
const existed = fs20.existsSync(fixturePath);
|
|
212526
212492
|
const diff = createMigrationDiff(state, block, version2, targetMigrationVersion);
|
|
212527
212493
|
const result = ensureEdgeFixtureFile(projectDir, block, version2, targetMigrationVersion, diff, { force });
|
|
212528
212494
|
if (result.written) {
|
|
@@ -212563,7 +212529,7 @@ function fuzzProjectMigrations(projectDir, {
|
|
|
212563
212529
|
assertRuleHasNoTodos(projectDir, block, entry.fromVersion, state.config.currentMigrationVersion);
|
|
212564
212530
|
}
|
|
212565
212531
|
const fuzzScriptPath = path28.join(getGeneratedDirForBlock(state.paths, block), "fuzz.ts");
|
|
212566
|
-
if (!
|
|
212532
|
+
if (!fs20.existsSync(fuzzScriptPath)) {
|
|
212567
212533
|
const selectedVersionsForBlock2 = entries.map((entry) => entry.fromVersion);
|
|
212568
212534
|
throw new Error(`Generated fuzz script is missing for ${block.blockName} (${selectedVersionsForBlock2.join(", ")}). ` + `Run \`${formatScaffoldCommand(selectedVersionsForBlock2)}\` first, then \`wp-typia migrate doctor --all\` if the workspace should already be scaffolded.`);
|
|
212569
212535
|
}
|
|
@@ -212589,7 +212555,7 @@ function promptForConfirmation(message) {
|
|
|
212589
212555
|
const buffer = Buffer.alloc(1);
|
|
212590
212556
|
let answer = "";
|
|
212591
212557
|
while (true) {
|
|
212592
|
-
const bytesRead =
|
|
212558
|
+
const bytesRead = fs20.readSync(process.stdin.fd, buffer, 0, 1, null);
|
|
212593
212559
|
if (bytesRead === 0) {
|
|
212594
212560
|
break;
|
|
212595
212561
|
}
|
|
@@ -212636,7 +212602,7 @@ __export(exports_migrations, {
|
|
|
212636
212602
|
doctorProjectMigrations: () => doctorProjectMigrations,
|
|
212637
212603
|
diffProjectMigrations: () => diffProjectMigrations
|
|
212638
212604
|
});
|
|
212639
|
-
import
|
|
212605
|
+
import fs21 from "fs";
|
|
212640
212606
|
import path29 from "path";
|
|
212641
212607
|
function runMigrationCommand(command, cwd, { prompt, renderLine = console.log } = {}) {
|
|
212642
212608
|
switch (command.command) {
|
|
@@ -212854,11 +212820,11 @@ function snapshotProjectVersion(projectDir, migrationVersion, {
|
|
|
212854
212820
|
const state = loadMigrationProject(projectDir, { allowMissingConfig: skipConfigUpdate });
|
|
212855
212821
|
for (const block of state.blocks) {
|
|
212856
212822
|
const snapshotRoot = getSnapshotRoot(projectDir, block, migrationVersion);
|
|
212857
|
-
|
|
212858
|
-
|
|
212823
|
+
fs21.mkdirSync(snapshotRoot, { recursive: true });
|
|
212824
|
+
fs21.writeFileSync(getSnapshotBlockJsonPath(projectDir, block, migrationVersion), `${JSON.stringify(sanitizeSnapshotBlockJson(readJson(path29.join(projectDir, block.blockJsonFile))), null, "\t")}
|
|
212859
212825
|
`, "utf8");
|
|
212860
212826
|
copyFile(path29.join(projectDir, block.manifestFile), getSnapshotManifestPath(projectDir, block, migrationVersion));
|
|
212861
|
-
|
|
212827
|
+
fs21.writeFileSync(getSnapshotSavePath(projectDir, block, migrationVersion), sanitizeSaveSnapshotSource(fs21.readFileSync(path29.join(projectDir, block.saveFile), "utf8")), "utf8");
|
|
212862
212828
|
}
|
|
212863
212829
|
if (!skipConfigUpdate) {
|
|
212864
212830
|
const nextSupported = [
|
|
@@ -212921,9 +212887,9 @@ function scaffoldProjectMigrations(projectDir, {
|
|
|
212921
212887
|
eligibleBlocks += 1;
|
|
212922
212888
|
const diff = createMigrationDiff(state, block, fromMigrationVersion, targetMigrationVersion);
|
|
212923
212889
|
const rulePath = getRuleFilePath(paths, block, fromMigrationVersion, targetMigrationVersion);
|
|
212924
|
-
if (!
|
|
212925
|
-
|
|
212926
|
-
|
|
212890
|
+
if (!fs21.existsSync(rulePath)) {
|
|
212891
|
+
fs21.mkdirSync(path29.dirname(rulePath), { recursive: true });
|
|
212892
|
+
fs21.writeFileSync(rulePath, renderMigrationRuleFile({
|
|
212927
212893
|
block,
|
|
212928
212894
|
currentAttributes: block.currentManifest.attributes ?? {},
|
|
212929
212895
|
currentTypeName: block.currentManifest.sourceType,
|
|
@@ -213025,16 +212991,16 @@ var init_template_defaults = __esm(() => {
|
|
|
213025
212991
|
});
|
|
213026
212992
|
|
|
213027
212993
|
// ../wp-typia-project-tools/src/runtime/template-registry.ts
|
|
213028
|
-
import
|
|
212994
|
+
import fs22 from "fs";
|
|
213029
212995
|
import path30 from "path";
|
|
213030
212996
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
213031
212997
|
function resolveValidProjectToolsPackageRoot(candidateRoot) {
|
|
213032
212998
|
const packageJsonPath = path30.join(candidateRoot, "package.json");
|
|
213033
|
-
if (!
|
|
212999
|
+
if (!fs22.existsSync(packageJsonPath)) {
|
|
213034
213000
|
return;
|
|
213035
213001
|
}
|
|
213036
213002
|
try {
|
|
213037
|
-
const packageJson = JSON.parse(
|
|
213003
|
+
const packageJson = JSON.parse(fs22.readFileSync(packageJsonPath, "utf8"));
|
|
213038
213004
|
return packageJson.name === PROJECT_TOOLS_PACKAGE_NAME ? candidateRoot : undefined;
|
|
213039
213005
|
} catch {
|
|
213040
213006
|
return;
|
|
@@ -213052,9 +213018,9 @@ function resolvePackageRoot(startDir) {
|
|
|
213052
213018
|
let currentDir = startDir;
|
|
213053
213019
|
while (true) {
|
|
213054
213020
|
const packageJsonPath = path30.join(currentDir, "package.json");
|
|
213055
|
-
if (
|
|
213021
|
+
if (fs22.existsSync(packageJsonPath)) {
|
|
213056
213022
|
try {
|
|
213057
|
-
const packageJson = JSON.parse(
|
|
213023
|
+
const packageJson = JSON.parse(fs22.readFileSync(packageJsonPath, "utf8"));
|
|
213058
213024
|
if (packageJson.name === PROJECT_TOOLS_PACKAGE_NAME) {
|
|
213059
213025
|
return currentDir;
|
|
213060
213026
|
}
|
|
@@ -213636,7 +213602,7 @@ var init_mustache = __esm(() => {
|
|
|
213636
213602
|
});
|
|
213637
213603
|
|
|
213638
213604
|
// ../wp-typia-project-tools/src/runtime/template-render.ts
|
|
213639
|
-
import { promises as
|
|
213605
|
+
import { promises as fsp5 } from "fs";
|
|
213640
213606
|
import path31 from "path";
|
|
213641
213607
|
function renderMustacheTemplateString(template, view) {
|
|
213642
213608
|
const mustacheModule = mustache_default;
|
|
@@ -213683,7 +213649,7 @@ async function traverseTemplateDirectory({
|
|
|
213683
213649
|
view,
|
|
213684
213650
|
visitFile
|
|
213685
213651
|
}) {
|
|
213686
|
-
const entries = await
|
|
213652
|
+
const entries = await fsp5.readdir(sourceDir, { withFileTypes: true });
|
|
213687
213653
|
for (const entry of entries) {
|
|
213688
213654
|
const sourcePath = path31.join(sourceDir, entry.name);
|
|
213689
213655
|
const destinationName = renderTemplateDestinationName(entry.name, view, renderString);
|
|
@@ -213717,30 +213683,30 @@ async function copyTemplateDirectory({
|
|
|
213717
213683
|
targetDir,
|
|
213718
213684
|
view
|
|
213719
213685
|
}) {
|
|
213720
|
-
await
|
|
213686
|
+
await fsp5.mkdir(targetDir, { recursive: true });
|
|
213721
213687
|
await traverseTemplateDirectory({
|
|
213722
213688
|
filter,
|
|
213723
213689
|
prepareDirectory: async (directoryPath) => {
|
|
213724
|
-
await
|
|
213690
|
+
await fsp5.mkdir(directoryPath, { recursive: true });
|
|
213725
213691
|
},
|
|
213726
213692
|
renderString,
|
|
213727
213693
|
sourceDir,
|
|
213728
213694
|
targetDir,
|
|
213729
213695
|
view,
|
|
213730
213696
|
visitFile: async ({ destinationPath, sourcePath }) => {
|
|
213731
|
-
await
|
|
213697
|
+
await fsp5.mkdir(path31.dirname(destinationPath), { recursive: true });
|
|
213732
213698
|
if (isBinaryTemplateFile(sourcePath)) {
|
|
213733
|
-
await
|
|
213699
|
+
await fsp5.copyFile(sourcePath, destinationPath);
|
|
213734
213700
|
return;
|
|
213735
213701
|
}
|
|
213736
|
-
const content = await
|
|
213737
|
-
await
|
|
213702
|
+
const content = await fsp5.readFile(sourcePath, "utf8");
|
|
213703
|
+
await fsp5.writeFile(destinationPath, renderString(content, view), "utf8");
|
|
213738
213704
|
}
|
|
213739
213705
|
});
|
|
213740
213706
|
}
|
|
213741
213707
|
async function copyRawDirectory(sourceDir, targetDir, options = {}) {
|
|
213742
|
-
await
|
|
213743
|
-
for (const entry of await
|
|
213708
|
+
await fsp5.mkdir(targetDir, { recursive: true });
|
|
213709
|
+
for (const entry of await fsp5.readdir(sourceDir, { withFileTypes: true })) {
|
|
213744
213710
|
const sourcePath = path31.join(sourceDir, entry.name);
|
|
213745
213711
|
const targetPath = path31.join(targetDir, entry.name);
|
|
213746
213712
|
if (options.filter && !await options.filter(sourcePath, targetPath, entry)) {
|
|
@@ -213750,8 +213716,8 @@ async function copyRawDirectory(sourceDir, targetDir, options = {}) {
|
|
|
213750
213716
|
await copyRawDirectory(sourcePath, targetPath, options);
|
|
213751
213717
|
continue;
|
|
213752
213718
|
}
|
|
213753
|
-
await
|
|
213754
|
-
await
|
|
213719
|
+
await fsp5.mkdir(path31.dirname(targetPath), { recursive: true });
|
|
213720
|
+
await fsp5.copyFile(sourcePath, targetPath);
|
|
213755
213721
|
}
|
|
213756
213722
|
}
|
|
213757
213723
|
async function copyRenderedDirectory(sourceDir, targetDir, view, options = {}) {
|
|
@@ -213807,8 +213773,8 @@ var init_template_render = __esm(() => {
|
|
|
213807
213773
|
});
|
|
213808
213774
|
|
|
213809
213775
|
// ../wp-typia-project-tools/src/runtime/local-dev-presets.ts
|
|
213810
|
-
import
|
|
213811
|
-
import { promises as
|
|
213776
|
+
import fs23 from "fs";
|
|
213777
|
+
import { promises as fsp6 } from "fs";
|
|
213812
213778
|
import path32 from "path";
|
|
213813
213779
|
function templateHasPersistenceSync(templateId, compoundPersistenceEnabled) {
|
|
213814
213780
|
return templateId === "persistence" || templateId === "compound" && compoundPersistenceEnabled;
|
|
@@ -213849,9 +213815,9 @@ function getDevScript(packageManager, compoundPersistenceEnabled, templateId) {
|
|
|
213849
213815
|
}
|
|
213850
213816
|
async function mutatePackageJson(projectDir, mutate) {
|
|
213851
213817
|
const packageJsonPath = path32.join(projectDir, "package.json");
|
|
213852
|
-
const packageJson = JSON.parse(await
|
|
213818
|
+
const packageJson = JSON.parse(await fsp6.readFile(packageJsonPath, "utf8"));
|
|
213853
213819
|
mutate(packageJson);
|
|
213854
|
-
await
|
|
213820
|
+
await fsp6.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, "\t")}
|
|
213855
213821
|
`, "utf8");
|
|
213856
213822
|
}
|
|
213857
213823
|
async function appendGitignoreLines(projectDir, lines) {
|
|
@@ -213859,7 +213825,7 @@ async function appendGitignoreLines(projectDir, lines) {
|
|
|
213859
213825
|
return;
|
|
213860
213826
|
}
|
|
213861
213827
|
const gitignorePath = path32.join(projectDir, ".gitignore");
|
|
213862
|
-
const current =
|
|
213828
|
+
const current = fs23.existsSync(gitignorePath) ? await fsp6.readFile(gitignorePath, "utf8") : "";
|
|
213863
213829
|
const missingLines = lines.filter((line) => !current.includes(`${line}
|
|
213864
213830
|
`) && !current.endsWith(line));
|
|
213865
213831
|
if (missingLines.length === 0) {
|
|
@@ -213868,7 +213834,7 @@ async function appendGitignoreLines(projectDir, lines) {
|
|
|
213868
213834
|
const suffix = current.endsWith(`
|
|
213869
213835
|
`) ? "" : `
|
|
213870
213836
|
`;
|
|
213871
|
-
await
|
|
213837
|
+
await fsp6.writeFile(gitignorePath, `${current}${suffix}${missingLines.join(`
|
|
213872
213838
|
`)}
|
|
213873
213839
|
`, "utf8");
|
|
213874
213840
|
}
|
|
@@ -213948,7 +213914,7 @@ var init_local_dev_presets = __esm(() => {
|
|
|
213948
213914
|
});
|
|
213949
213915
|
|
|
213950
213916
|
// ../wp-typia-project-tools/src/runtime/package-versions.ts
|
|
213951
|
-
import
|
|
213917
|
+
import fs24 from "fs";
|
|
213952
213918
|
import { createRequire } from "module";
|
|
213953
213919
|
import path33 from "path";
|
|
213954
213920
|
function getErrorCode(error48) {
|
|
@@ -213988,8 +213954,8 @@ function createContentFingerprint(source) {
|
|
|
213988
213954
|
}
|
|
213989
213955
|
function resolvePackageManifestLocation(packageJsonPath) {
|
|
213990
213956
|
try {
|
|
213991
|
-
const stats =
|
|
213992
|
-
const source =
|
|
213957
|
+
const stats = fs24.statSync(packageJsonPath);
|
|
213958
|
+
const source = fs24.readFileSync(packageJsonPath, "utf8");
|
|
213993
213959
|
return {
|
|
213994
213960
|
cacheKey: `file:${packageJsonPath}:${stats.ino}:${stats.mtimeMs}:${stats.ctimeMs}:${stats.size}:${createContentFingerprint(source)}`,
|
|
213995
213961
|
packageJsonPath,
|
|
@@ -214104,29 +214070,29 @@ function getPackageVersions() {
|
|
|
214104
214070
|
};
|
|
214105
214071
|
return versions2;
|
|
214106
214072
|
}
|
|
214107
|
-
var require2, DEFAULT_VERSION_RANGE = "^0.0.0", DEFAULT_EXACT_VERSION = "0.0.0", DEFAULT_TSX_PACKAGE_VERSION = "^4.20.5", DEFAULT_TYPIA_UNPLUGIN_PACKAGE_VERSION = "^12.0.1", DEFAULT_WORDPRESS_ABILITIES_VERSION = "^0.10.0", DEFAULT_WORDPRESS_CORE_ABILITIES_VERSION = "^0.9.0", DEFAULT_WORDPRESS_CORE_DATA_VERSION = "^7.44.0", DEFAULT_WORDPRESS_DATA_VERSION = "^9.28.0", DEFAULT_WORDPRESS_DATAVIEWS_VERSION = "^14.1.0", DEFAULT_WP_TYPIA_DATAVIEWS_VERSION = "^0.1.
|
|
214073
|
+
var require2, DEFAULT_VERSION_RANGE = "^0.0.0", DEFAULT_EXACT_VERSION = "0.0.0", DEFAULT_TSX_PACKAGE_VERSION = "^4.20.5", DEFAULT_TYPIA_UNPLUGIN_PACKAGE_VERSION = "^12.0.1", DEFAULT_WORDPRESS_ABILITIES_VERSION = "^0.10.0", DEFAULT_WORDPRESS_CORE_ABILITIES_VERSION = "^0.9.0", DEFAULT_WORDPRESS_CORE_DATA_VERSION = "^7.44.0", DEFAULT_WORDPRESS_DATA_VERSION = "^9.28.0", DEFAULT_WORDPRESS_DATAVIEWS_VERSION = "^14.1.0", DEFAULT_WP_TYPIA_DATAVIEWS_VERSION = "^0.1.1", cachedPackageVersions = null;
|
|
214108
214074
|
var init_package_versions = __esm(() => {
|
|
214109
214075
|
init_template_registry();
|
|
214110
214076
|
require2 = createRequire(import.meta.url);
|
|
214111
214077
|
});
|
|
214112
214078
|
|
|
214113
214079
|
// ../wp-typia-project-tools/src/runtime/migration-ui-capability.ts
|
|
214114
|
-
import { promises as
|
|
214080
|
+
import { promises as fsp7 } from "fs";
|
|
214115
214081
|
import path34 from "path";
|
|
214116
214082
|
async function mutatePackageJson2(projectDir, mutate) {
|
|
214117
214083
|
const packageJsonPath = path34.join(projectDir, "package.json");
|
|
214118
|
-
const packageJson = JSON.parse(await
|
|
214084
|
+
const packageJson = JSON.parse(await fsp7.readFile(packageJsonPath, "utf8"));
|
|
214119
214085
|
mutate(packageJson);
|
|
214120
|
-
await
|
|
214086
|
+
await fsp7.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, "\t")}
|
|
214121
214087
|
`, "utf8");
|
|
214122
214088
|
}
|
|
214123
214089
|
async function patchFile2(filePath, transform2) {
|
|
214124
|
-
const source = await
|
|
214090
|
+
const source = await fsp7.readFile(filePath, "utf8");
|
|
214125
214091
|
const nextSource = transform2(source);
|
|
214126
214092
|
if (nextSource === source) {
|
|
214127
214093
|
throw new Error(`Unable to apply migration UI patch for ${filePath}`);
|
|
214128
214094
|
}
|
|
214129
|
-
await
|
|
214095
|
+
await fsp7.writeFile(filePath, nextSource, "utf8");
|
|
214130
214096
|
}
|
|
214131
214097
|
function injectAfter(source, needle, insertion) {
|
|
214132
214098
|
if (source.includes(insertion)) {
|
|
@@ -215798,36 +215764,8 @@ var init_starter_manifests = __esm(() => {
|
|
|
215798
215764
|
init_built_in_block_artifacts();
|
|
215799
215765
|
});
|
|
215800
215766
|
|
|
215801
|
-
// ../wp-typia-project-tools/src/runtime/fs-async.ts
|
|
215802
|
-
import { promises as fsp7 } from "fs";
|
|
215803
|
-
async function pathExists(filePath) {
|
|
215804
|
-
try {
|
|
215805
|
-
await fsp7.access(filePath);
|
|
215806
|
-
return true;
|
|
215807
|
-
} catch {
|
|
215808
|
-
return false;
|
|
215809
|
-
}
|
|
215810
|
-
}
|
|
215811
|
-
async function readOptionalUtf8File(filePath) {
|
|
215812
|
-
try {
|
|
215813
|
-
return await fsp7.readFile(filePath, "utf8");
|
|
215814
|
-
} catch (error48) {
|
|
215815
|
-
if (isFileNotFoundError2(error48)) {
|
|
215816
|
-
return null;
|
|
215817
|
-
}
|
|
215818
|
-
throw error48;
|
|
215819
|
-
}
|
|
215820
|
-
}
|
|
215821
|
-
function getNodeErrorCode(error48) {
|
|
215822
|
-
return typeof error48 === "object" && error48 !== null && "code" in error48 ? String(error48.code) : "";
|
|
215823
|
-
}
|
|
215824
|
-
function isFileNotFoundError2(error48) {
|
|
215825
|
-
return getNodeErrorCode(error48) === "ENOENT";
|
|
215826
|
-
}
|
|
215827
|
-
var init_fs_async = () => {};
|
|
215828
|
-
|
|
215829
215767
|
// ../wp-typia-project-tools/src/runtime/scaffold-bootstrap.ts
|
|
215830
|
-
import
|
|
215768
|
+
import fs25 from "fs";
|
|
215831
215769
|
import { promises as fsp8 } from "fs";
|
|
215832
215770
|
import path35 from "path";
|
|
215833
215771
|
async function ensureScaffoldDirectory(targetDir, allowExisting = false) {
|
|
@@ -215842,10 +215780,10 @@ async function ensureScaffoldDirectory(targetDir, allowExisting = false) {
|
|
|
215842
215780
|
}
|
|
215843
215781
|
function readGeneratedPackageJson(projectDir) {
|
|
215844
215782
|
const packageJsonPath = path35.join(projectDir, "package.json");
|
|
215845
|
-
if (!
|
|
215783
|
+
if (!fs25.existsSync(packageJsonPath)) {
|
|
215846
215784
|
return null;
|
|
215847
215785
|
}
|
|
215848
|
-
return JSON.parse(
|
|
215786
|
+
return JSON.parse(fs25.readFileSync(packageJsonPath, "utf8"));
|
|
215849
215787
|
}
|
|
215850
215788
|
function formatNonEmptyTargetDirectoryError(targetDir) {
|
|
215851
215789
|
return `Target directory is not empty: ${targetDir}. Choose a new project directory, or empty this directory before rerunning the scaffold.`;
|
|
@@ -216024,7 +215962,7 @@ var init_scaffold_package_manager_files = __esm(() => {
|
|
|
216024
215962
|
});
|
|
216025
215963
|
|
|
216026
215964
|
// ../wp-typia-project-tools/src/runtime/scaffold-repository-reference.ts
|
|
216027
|
-
import
|
|
215965
|
+
import fs26 from "fs";
|
|
216028
215966
|
import { createRequire as createRequire2 } from "module";
|
|
216029
215967
|
import path37 from "path";
|
|
216030
215968
|
function getErrorCode2(error48) {
|
|
@@ -216032,7 +215970,7 @@ function getErrorCode2(error48) {
|
|
|
216032
215970
|
}
|
|
216033
215971
|
function readRepositoryPackageManifest(packageJsonPath) {
|
|
216034
215972
|
try {
|
|
216035
|
-
return JSON.parse(
|
|
215973
|
+
return JSON.parse(fs26.readFileSync(packageJsonPath, "utf8"));
|
|
216036
215974
|
} catch (error48) {
|
|
216037
215975
|
if (getErrorCode2(error48) === "ENOENT") {
|
|
216038
215976
|
return null;
|
|
@@ -216416,7 +216354,7 @@ var init_scaffold_apply_utils = __esm(() => {
|
|
|
216416
216354
|
});
|
|
216417
216355
|
|
|
216418
216356
|
// ../wp-typia-project-tools/src/runtime/template-builtins.ts
|
|
216419
|
-
import
|
|
216357
|
+
import fs27 from "fs";
|
|
216420
216358
|
import path39 from "path";
|
|
216421
216359
|
import { promises as fsp11 } from "fs";
|
|
216422
216360
|
function isBuiltInSharedTemplateLayerId(layerId) {
|
|
@@ -216468,7 +216406,7 @@ function isOmittableBuiltInTemplateLayerDir(templateId, layerDir) {
|
|
|
216468
216406
|
}
|
|
216469
216407
|
function resolveMaterializedTemplateLayerDirs(templateId, layerDirs) {
|
|
216470
216408
|
return layerDirs.flatMap((layerDir) => {
|
|
216471
|
-
if (
|
|
216409
|
+
if (fs27.existsSync(layerDir)) {
|
|
216472
216410
|
return [layerDir];
|
|
216473
216411
|
}
|
|
216474
216412
|
if (isOmittableBuiltInTemplateLayerDir(templateId, layerDir)) {
|
|
@@ -220176,7 +220114,7 @@ var init_template_source_locators = __esm(() => {
|
|
|
220176
220114
|
});
|
|
220177
220115
|
|
|
220178
220116
|
// ../wp-typia-project-tools/src/runtime/template-layers.ts
|
|
220179
|
-
import
|
|
220117
|
+
import fs28 from "fs";
|
|
220180
220118
|
import path41 from "path";
|
|
220181
220119
|
import { promises as fsp12 } from "fs";
|
|
220182
220120
|
function resolveLayerPath(sourceRoot, relativePath) {
|
|
@@ -220226,7 +220164,7 @@ function parseLayerDefinition(layerId, value2) {
|
|
|
220226
220164
|
}
|
|
220227
220165
|
async function loadExternalTemplateLayerManifest(sourceRoot) {
|
|
220228
220166
|
const manifestPath = path41.join(sourceRoot, TEMPLATE_LAYER_MANIFEST_FILENAME);
|
|
220229
|
-
if (!
|
|
220167
|
+
if (!fs28.existsSync(manifestPath)) {
|
|
220230
220168
|
return null;
|
|
220231
220169
|
}
|
|
220232
220170
|
const raw = JSON.parse(await fsp12.readFile(manifestPath, "utf8"));
|
|
@@ -220367,7 +220305,7 @@ var init_template_layers = __esm(() => {
|
|
|
220367
220305
|
});
|
|
220368
220306
|
|
|
220369
220307
|
// ../wp-typia-project-tools/src/runtime/external-template-guards.ts
|
|
220370
|
-
import
|
|
220308
|
+
import fs29 from "fs";
|
|
220371
220309
|
function parsePositiveIntegerEnv(value2, fallback) {
|
|
220372
220310
|
if (typeof value2 !== "string" || value2.trim().length === 0) {
|
|
220373
220311
|
return fallback;
|
|
@@ -220402,7 +220340,7 @@ function createExternalTemplateTooLargeError(label, maxBytes) {
|
|
|
220402
220340
|
return createTemplateGuardError(TEMPLATE_SOURCE_TOO_LARGE_CODE, `${label} exceeded the external template size limit (${maxBytes} bytes).`);
|
|
220403
220341
|
}
|
|
220404
220342
|
function assertExternalTemplateFileSize(filePath, options) {
|
|
220405
|
-
const stats =
|
|
220343
|
+
const stats = fs29.statSync(filePath);
|
|
220406
220344
|
if (stats.size > options.maxBytes) {
|
|
220407
220345
|
throw createExternalTemplateTooLargeError(options.label, options.maxBytes);
|
|
220408
220346
|
}
|
|
@@ -220496,7 +220434,7 @@ var init_external_template_guards = __esm(() => {
|
|
|
220496
220434
|
});
|
|
220497
220435
|
|
|
220498
220436
|
// ../wp-typia-project-tools/src/runtime/template-source-external.ts
|
|
220499
|
-
import
|
|
220437
|
+
import fs30 from "fs";
|
|
220500
220438
|
import { promises as fsp13 } from "fs";
|
|
220501
220439
|
import path42 from "path";
|
|
220502
220440
|
import { pathToFileURL } from "url";
|
|
@@ -220643,7 +220581,7 @@ async function renderCreateBlockExternalTemplate(sourceDir, context, requestedVa
|
|
|
220643
220581
|
await copyRenderedDirectory(blockTemplateDir, blockDir, view, {
|
|
220644
220582
|
filter: (sourcePath, _destinationPath, entry) => {
|
|
220645
220583
|
const mustacheVariantPath = path42.join(path42.dirname(sourcePath), `${entry.name}.mustache`);
|
|
220646
|
-
return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") &&
|
|
220584
|
+
return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && fs30.existsSync(mustacheVariantPath));
|
|
220647
220585
|
}
|
|
220648
220586
|
});
|
|
220649
220587
|
const assetsPath = typeof variantConfig.assetsPath === "string" ? variantConfig.assetsPath : config2.assetsPath;
|
|
@@ -220681,7 +220619,7 @@ var init_template_source_external = __esm(() => {
|
|
|
220681
220619
|
});
|
|
220682
220620
|
|
|
220683
220621
|
// ../wp-typia-project-tools/src/runtime/template-source-remote.ts
|
|
220684
|
-
import
|
|
220622
|
+
import fs31 from "fs";
|
|
220685
220623
|
import { promises as fsp14 } from "fs";
|
|
220686
220624
|
import path43 from "path";
|
|
220687
220625
|
async function cleanupSeedRootPair(cleanup, seedCleanup) {
|
|
@@ -220768,7 +220706,7 @@ async function normalizeWpTypiaTemplateSeed(seed) {
|
|
|
220768
220706
|
await copyRawDirectory(seed.blockDir, normalizedDir, {
|
|
220769
220707
|
filter: (sourcePath, _targetPath, entry) => {
|
|
220770
220708
|
const mustacheVariantPath = path43.join(path43.dirname(sourcePath), `${entry.name}.mustache`);
|
|
220771
|
-
return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") &&
|
|
220709
|
+
return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && fs31.existsSync(mustacheVariantPath));
|
|
220772
220710
|
}
|
|
220773
220711
|
});
|
|
220774
220712
|
if (seed.assetsDir && await pathExists(seed.assetsDir)) {
|
|
@@ -221486,7 +221424,7 @@ var kr, vr = (s, t2) => {
|
|
|
221486
221424
|
}, Gn = (s3, t2) => {
|
|
221487
221425
|
let e = new Et(s3);
|
|
221488
221426
|
return hr(e, t2).catch((i) => e.emit("error", i)), e;
|
|
221489
|
-
}, Zn, Yn, fr, dr, ar, ur, mr, pr, Kn, Vn, $n, lr, cs,
|
|
221427
|
+
}, Zn, Yn, fr, dr, ar, ur, mr, pr, Kn, Vn, $n, lr, cs, fs32 = (s3, t2, e) => {
|
|
221490
221428
|
try {
|
|
221491
221429
|
return mi.lchownSync(s3, t2, e);
|
|
221492
221430
|
} catch (i) {
|
|
@@ -221531,7 +221469,7 @@ var kr, vr = (s, t2) => {
|
|
|
221531
221469
|
Xn(s3, l, t2, e, a);
|
|
221532
221470
|
});
|
|
221533
221471
|
}, qn = (s3, t2, e, i) => {
|
|
221534
|
-
t2.isDirectory() && us(Ee2.resolve(s3, t2.name), e, i),
|
|
221472
|
+
t2.isDirectory() && us(Ee2.resolve(s3, t2.name), e, i), fs32(Ee2.resolve(s3, t2.name), e, i);
|
|
221535
221473
|
}, us = (s3, t2, e) => {
|
|
221536
221474
|
let i;
|
|
221537
221475
|
try {
|
|
@@ -221541,12 +221479,12 @@ var kr, vr = (s, t2) => {
|
|
|
221541
221479
|
if (n?.code === "ENOENT")
|
|
221542
221480
|
return;
|
|
221543
221481
|
if (n?.code === "ENOTDIR" || n?.code === "ENOTSUP")
|
|
221544
|
-
return
|
|
221482
|
+
return fs32(s3, t2, e);
|
|
221545
221483
|
throw n;
|
|
221546
221484
|
}
|
|
221547
221485
|
for (let r of i)
|
|
221548
221486
|
qn(s3, r, t2, e);
|
|
221549
|
-
return
|
|
221487
|
+
return fs32(s3, t2, e);
|
|
221550
221488
|
}, we2, wt, Qn = (s3, t2) => {
|
|
221551
221489
|
k2.stat(s3, (e, i) => {
|
|
221552
221490
|
(e || !i.isDirectory()) && (e = new we2(s3, e?.code || "ENOTDIR")), t2(e);
|
|
@@ -224149,7 +224087,7 @@ var init_index_min = __esm(() => {
|
|
|
224149
224087
|
|
|
224150
224088
|
// ../wp-typia-project-tools/src/runtime/template-source-cache.ts
|
|
224151
224089
|
import { createHash } from "crypto";
|
|
224152
|
-
import
|
|
224090
|
+
import fs33 from "fs";
|
|
224153
224091
|
import { promises as fsp15 } from "fs";
|
|
224154
224092
|
import os4 from "os";
|
|
224155
224093
|
import path45 from "path";
|
|
@@ -224212,7 +224150,7 @@ function createExternalTemplateCacheKey(keyParts) {
|
|
|
224212
224150
|
}
|
|
224213
224151
|
async function pathExists2(filePath) {
|
|
224214
224152
|
try {
|
|
224215
|
-
await fsp15.access(filePath,
|
|
224153
|
+
await fsp15.access(filePath, fs33.constants.F_OK);
|
|
224216
224154
|
return true;
|
|
224217
224155
|
} catch {
|
|
224218
224156
|
return false;
|
|
@@ -224715,7 +224653,7 @@ var init_template_source_cache = __esm(() => {
|
|
|
224715
224653
|
});
|
|
224716
224654
|
|
|
224717
224655
|
// ../wp-typia-project-tools/src/runtime/template-source-seeds.ts
|
|
224718
|
-
import
|
|
224656
|
+
import fs34 from "fs";
|
|
224719
224657
|
import { promises as fsp16 } from "fs";
|
|
224720
224658
|
import { createRequire as createRequire3 } from "module";
|
|
224721
224659
|
import path46 from "path";
|
|
@@ -224881,8 +224819,8 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
|
|
|
224881
224819
|
return null;
|
|
224882
224820
|
}
|
|
224883
224821
|
const workspacePackagesRoot = path46.resolve(PROJECT_TOOLS_PACKAGE_ROOT, "..");
|
|
224884
|
-
if (
|
|
224885
|
-
for (const entry of
|
|
224822
|
+
if (fs34.existsSync(workspacePackagesRoot)) {
|
|
224823
|
+
for (const entry of fs34.readdirSync(workspacePackagesRoot, {
|
|
224886
224824
|
withFileTypes: true
|
|
224887
224825
|
})) {
|
|
224888
224826
|
if (!entry.isDirectory()) {
|
|
@@ -224890,10 +224828,10 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
|
|
|
224890
224828
|
}
|
|
224891
224829
|
const packageDir = path46.join(workspacePackagesRoot, entry.name);
|
|
224892
224830
|
const packageJsonPath = path46.join(packageDir, "package.json");
|
|
224893
|
-
if (!
|
|
224831
|
+
if (!fs34.existsSync(packageJsonPath)) {
|
|
224894
224832
|
continue;
|
|
224895
224833
|
}
|
|
224896
|
-
const manifest = JSON.parse(
|
|
224834
|
+
const manifest = JSON.parse(fs34.readFileSync(packageJsonPath, "utf8"));
|
|
224897
224835
|
if (manifest.name === locator.name) {
|
|
224898
224836
|
return {
|
|
224899
224837
|
blockDir: packageDir,
|
|
@@ -224904,7 +224842,7 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
|
|
|
224904
224842
|
}
|
|
224905
224843
|
const workspaceRequire = createRequire3(path46.join(path46.resolve(cwd), "__wp_typia_template_resolver__.cjs"));
|
|
224906
224844
|
try {
|
|
224907
|
-
const packageJsonPath =
|
|
224845
|
+
const packageJsonPath = fs34.realpathSync(workspaceRequire.resolve(`${locator.name}/package.json`));
|
|
224908
224846
|
const sourceDir = path46.dirname(packageJsonPath);
|
|
224909
224847
|
return {
|
|
224910
224848
|
blockDir: sourceDir,
|
|
@@ -224915,10 +224853,10 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
|
|
|
224915
224853
|
if (errorCode === "MODULE_NOT_FOUND" || errorCode === "ERR_PACKAGE_PATH_NOT_EXPORTED") {
|
|
224916
224854
|
for (const basePath of workspaceRequire.resolve.paths(locator.name) ?? []) {
|
|
224917
224855
|
const packageJsonPath = path46.join(basePath, locator.name, "package.json");
|
|
224918
|
-
if (!
|
|
224856
|
+
if (!fs34.existsSync(packageJsonPath)) {
|
|
224919
224857
|
continue;
|
|
224920
224858
|
}
|
|
224921
|
-
const sourceDir = path46.dirname(
|
|
224859
|
+
const sourceDir = path46.dirname(fs34.realpathSync(packageJsonPath));
|
|
224922
224860
|
return {
|
|
224923
224861
|
blockDir: sourceDir,
|
|
224924
224862
|
rootDir: sourceDir
|
|
@@ -224931,11 +224869,11 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
|
|
|
224931
224869
|
}
|
|
224932
224870
|
function isOfficialWorkspaceTemplateSeed(seed) {
|
|
224933
224871
|
const packageJsonPath = path46.join(seed.rootDir, "package.json");
|
|
224934
|
-
if (!
|
|
224872
|
+
if (!fs34.existsSync(packageJsonPath)) {
|
|
224935
224873
|
return false;
|
|
224936
224874
|
}
|
|
224937
224875
|
try {
|
|
224938
|
-
const packageJson = JSON.parse(
|
|
224876
|
+
const packageJson = JSON.parse(fs34.readFileSync(packageJsonPath, "utf8"));
|
|
224939
224877
|
return packageJson.name === OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE;
|
|
224940
224878
|
} catch {
|
|
224941
224879
|
return false;
|
|
@@ -224984,7 +224922,7 @@ function resolveGitHubTemplateDirectory(checkoutDir, locator) {
|
|
|
224984
224922
|
if (relativeSourceDir.startsWith("..") || path46.isAbsolute(relativeSourceDir)) {
|
|
224985
224923
|
throw new Error("GitHub template path must stay within the cloned repository.");
|
|
224986
224924
|
}
|
|
224987
|
-
if (!
|
|
224925
|
+
if (!fs34.existsSync(sourceDir)) {
|
|
224988
224926
|
throw new Error(`GitHub template path does not exist: ${locator.sourcePath}`);
|
|
224989
224927
|
}
|
|
224990
224928
|
return sourceDir;
|
|
@@ -225188,7 +225126,7 @@ async function resolveGitHubTemplateSource(locator) {
|
|
|
225188
225126
|
async function resolveTemplateSeed(locator, cwd) {
|
|
225189
225127
|
if (locator.kind === "path") {
|
|
225190
225128
|
const sourceDir = path46.resolve(cwd, locator.templatePath);
|
|
225191
|
-
if (!
|
|
225129
|
+
if (!fs34.existsSync(sourceDir)) {
|
|
225192
225130
|
throw new Error(`Template path does not exist: ${sourceDir}`);
|
|
225193
225131
|
}
|
|
225194
225132
|
await assertNoSymlinks2(sourceDir);
|
|
@@ -225224,7 +225162,7 @@ var init_template_source_seeds = __esm(() => {
|
|
|
225224
225162
|
});
|
|
225225
225163
|
|
|
225226
225164
|
// ../wp-typia-project-tools/src/runtime/cli-validation.ts
|
|
225227
|
-
import
|
|
225165
|
+
import fs35 from "fs";
|
|
225228
225166
|
import path47 from "path";
|
|
225229
225167
|
function normalizeOptionalCliString(value2) {
|
|
225230
225168
|
if (typeof value2 !== "string") {
|
|
@@ -225242,7 +225180,7 @@ function resolveLocalCliPathOption(options) {
|
|
|
225242
225180
|
return normalizedValue;
|
|
225243
225181
|
}
|
|
225244
225182
|
const resolvedPath = path47.resolve(options.cwd, normalizedValue);
|
|
225245
|
-
if (!
|
|
225183
|
+
if (!fs35.existsSync(resolvedPath)) {
|
|
225246
225184
|
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, `\`${options.label}\` path does not exist: ${resolvedPath}. Check the path relative to ${options.cwd}.`);
|
|
225247
225185
|
}
|
|
225248
225186
|
return resolvedPath;
|
|
@@ -230857,7 +230795,7 @@ var init_scaffold_answer_resolution = __esm(() => {
|
|
|
230857
230795
|
});
|
|
230858
230796
|
|
|
230859
230797
|
// ../wp-typia-project-tools/src/runtime/scaffold.ts
|
|
230860
|
-
import
|
|
230798
|
+
import fs36 from "fs";
|
|
230861
230799
|
import { promises as fsp17 } from "fs";
|
|
230862
230800
|
import path49 from "path";
|
|
230863
230801
|
function isDataStorageMode(value2) {
|
|
@@ -231006,7 +230944,7 @@ async function scaffoldProject({
|
|
|
231006
230944
|
title: "Finalizing scaffold output"
|
|
231007
230945
|
});
|
|
231008
230946
|
const readmePath = path49.join(projectDir, "README.md");
|
|
231009
|
-
if (!
|
|
230947
|
+
if (!fs36.existsSync(readmePath)) {
|
|
231010
230948
|
await fsp17.writeFile(readmePath, buildReadme(resolvedTemplateId, variables, resolvedPackageManager, {
|
|
231011
230949
|
withMigrationUi: isBuiltInTemplate || isWorkspace ? withMigrationUi : false,
|
|
231012
230950
|
withTestPreset: isBuiltInTemplate ? withTestPreset : false,
|
|
@@ -231014,7 +230952,7 @@ async function scaffoldProject({
|
|
|
231014
230952
|
}), "utf8");
|
|
231015
230953
|
}
|
|
231016
230954
|
const gitignorePath = path49.join(projectDir, ".gitignore");
|
|
231017
|
-
const existingGitignore =
|
|
230955
|
+
const existingGitignore = fs36.existsSync(gitignorePath) ? await fsp17.readFile(gitignorePath, "utf8") : "";
|
|
231018
230956
|
await fsp17.writeFile(gitignorePath, mergeTextLines(buildGitignore(), existingGitignore), "utf8");
|
|
231019
230957
|
await normalizePackageJson(projectDir, resolvedPackageManager);
|
|
231020
230958
|
if (isBuiltInTemplate) {
|
|
@@ -231228,7 +231166,7 @@ var init_cli_add_block_config = __esm(() => {
|
|
|
231228
231166
|
});
|
|
231229
231167
|
|
|
231230
231168
|
// ../wp-typia-project-tools/src/runtime/cli-add-block-legacy-validator.ts
|
|
231231
|
-
import
|
|
231169
|
+
import fs37 from "fs";
|
|
231232
231170
|
import { promises as fsp18 } from "fs";
|
|
231233
231171
|
import path51 from "path";
|
|
231234
231172
|
function ensureBlockConfigCanAddRestManifests(source) {
|
|
@@ -231335,14 +231273,14 @@ async function ensureLegacyCompoundValidatorManifestDefaultsWrapper(validatorPat
|
|
|
231335
231273
|
const validatorDir = path51.dirname(validatorPath);
|
|
231336
231274
|
const wrapperPath = path51.join(validatorDir, "manifest-defaults-document.ts");
|
|
231337
231275
|
const manifestPath = path51.join(validatorDir, "typia.manifest.json");
|
|
231338
|
-
if (
|
|
231276
|
+
if (fs37.existsSync(wrapperPath) || !fs37.existsSync(manifestPath)) {
|
|
231339
231277
|
return;
|
|
231340
231278
|
}
|
|
231341
231279
|
await fsp18.writeFile(wrapperPath, renderLegacyManifestDefaultsWrapperSource(), "utf8");
|
|
231342
231280
|
}
|
|
231343
231281
|
async function collectLegacyCompoundValidatorPaths(projectDir) {
|
|
231344
231282
|
const blocksDir = path51.join(projectDir, "src", "blocks");
|
|
231345
|
-
if (!
|
|
231283
|
+
if (!fs37.existsSync(blocksDir)) {
|
|
231346
231284
|
return [];
|
|
231347
231285
|
}
|
|
231348
231286
|
const blockEntries = await fsp18.readdir(blocksDir, { withFileTypes: true });
|
|
@@ -231356,7 +231294,7 @@ async function collectLegacyCompoundValidatorPaths(projectDir) {
|
|
|
231356
231294
|
async function ensureCompoundWorkspaceSupportFiles(projectDir, tempProjectDir, legacyValidatorPaths) {
|
|
231357
231295
|
for (const fileName of COMPOUND_SHARED_SUPPORT_FILES) {
|
|
231358
231296
|
const sourcePath = path51.join(tempProjectDir, "src", fileName);
|
|
231359
|
-
if (!
|
|
231297
|
+
if (!fs37.existsSync(sourcePath)) {
|
|
231360
231298
|
continue;
|
|
231361
231299
|
}
|
|
231362
231300
|
const targetPath = path51.join(projectDir, "src", fileName);
|
|
@@ -233042,7 +232980,7 @@ var init_cli_add_workspace_mutation = __esm(() => {
|
|
|
233042
232980
|
});
|
|
233043
232981
|
|
|
233044
232982
|
// ../wp-typia-project-tools/src/runtime/cli-add-workspace-admin-view-scaffold.ts
|
|
233045
|
-
import
|
|
232983
|
+
import fs38 from "fs";
|
|
233046
232984
|
import { promises as fsp20 } from "fs";
|
|
233047
232985
|
import path54 from "path";
|
|
233048
232986
|
function detectJsonIndent(source) {
|
|
@@ -233206,13 +233144,13 @@ function resolveAdminViewRegistryPath(projectDir) {
|
|
|
233206
233144
|
return [
|
|
233207
233145
|
path54.join(adminViewsDir, "index.ts"),
|
|
233208
233146
|
path54.join(adminViewsDir, "index.js")
|
|
233209
|
-
].find((candidatePath) =>
|
|
233147
|
+
].find((candidatePath) => fs38.existsSync(candidatePath)) ?? path54.join(adminViewsDir, "index.ts");
|
|
233210
233148
|
}
|
|
233211
233149
|
function readAdminViewRegistrySlugs(registryPath) {
|
|
233212
|
-
if (!
|
|
233150
|
+
if (!fs38.existsSync(registryPath)) {
|
|
233213
233151
|
return [];
|
|
233214
233152
|
}
|
|
233215
|
-
const source =
|
|
233153
|
+
const source = fs38.readFileSync(registryPath, "utf8");
|
|
233216
233154
|
return Array.from(source.matchAll(/^\s*import\s+['"]\.\/([^/'"]+)(?:\/index(?:\.[cm]?[jt]sx?)?)?['"];?\s*$/gmu)).map((match3) => match3[1]);
|
|
233217
233155
|
}
|
|
233218
233156
|
async function writeAdminViewRegistry(projectDir, adminViewSlug) {
|
|
@@ -233324,7 +233262,7 @@ var init_cli_add_workspace_admin_view = __esm(() => {
|
|
|
233324
233262
|
});
|
|
233325
233263
|
|
|
233326
233264
|
// ../wp-typia-project-tools/src/runtime/cli-add-workspace-assets.ts
|
|
233327
|
-
import
|
|
233265
|
+
import fs39 from "fs";
|
|
233328
233266
|
import { promises as fsp21 } from "fs";
|
|
233329
233267
|
import path55 from "path";
|
|
233330
233268
|
import {
|
|
@@ -234055,13 +233993,13 @@ async function ensureEditorPluginWebpackAnchors(workspace) {
|
|
|
234055
233993
|
}
|
|
234056
233994
|
function resolveBindingSourceRegistryPath(projectDir) {
|
|
234057
233995
|
const bindingsDir = path55.join(projectDir, "src", "bindings");
|
|
234058
|
-
return [path55.join(bindingsDir, "index.ts"), path55.join(bindingsDir, "index.js")].find((candidatePath) =>
|
|
233996
|
+
return [path55.join(bindingsDir, "index.ts"), path55.join(bindingsDir, "index.js")].find((candidatePath) => fs39.existsSync(candidatePath)) ?? path55.join(bindingsDir, "index.ts");
|
|
234059
233997
|
}
|
|
234060
233998
|
async function writeBindingSourceRegistry(projectDir, bindingSourceSlug) {
|
|
234061
233999
|
const bindingsDir = path55.join(projectDir, "src", "bindings");
|
|
234062
234000
|
const bindingsIndexPath = resolveBindingSourceRegistryPath(projectDir);
|
|
234063
234001
|
await fsp21.mkdir(bindingsDir, { recursive: true });
|
|
234064
|
-
const existingBindingSourceSlugs =
|
|
234002
|
+
const existingBindingSourceSlugs = fs39.readdirSync(bindingsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
234065
234003
|
const nextBindingSourceSlugs = Array.from(new Set([...existingBindingSourceSlugs, bindingSourceSlug])).sort();
|
|
234066
234004
|
await fsp21.writeFile(bindingsIndexPath, buildBindingSourceIndexSource(nextBindingSourceSlugs), "utf8");
|
|
234067
234005
|
}
|
|
@@ -234070,13 +234008,13 @@ function resolveEditorPluginRegistryPath(projectDir) {
|
|
|
234070
234008
|
return [
|
|
234071
234009
|
path55.join(editorPluginsDir, "index.ts"),
|
|
234072
234010
|
path55.join(editorPluginsDir, "index.js")
|
|
234073
|
-
].find((candidatePath) =>
|
|
234011
|
+
].find((candidatePath) => fs39.existsSync(candidatePath)) ?? path55.join(editorPluginsDir, "index.ts");
|
|
234074
234012
|
}
|
|
234075
234013
|
function readEditorPluginRegistrySlugs(registryPath) {
|
|
234076
|
-
if (!
|
|
234014
|
+
if (!fs39.existsSync(registryPath)) {
|
|
234077
234015
|
return [];
|
|
234078
234016
|
}
|
|
234079
|
-
const source =
|
|
234017
|
+
const source = fs39.readFileSync(registryPath, "utf8");
|
|
234080
234018
|
return Array.from(source.matchAll(/^\s*import\s+['"]\.\/([^/'"]+)(?:\/index(?:\.[cm]?[jt]sx?)?)?['"];?\s*$/gmu)).map((match3) => match3[1]);
|
|
234081
234019
|
}
|
|
234082
234020
|
async function writeEditorPluginRegistry(projectDir, editorPluginSlug) {
|
|
@@ -235947,7 +235885,7 @@ var init_cli_add_workspace_ability_templates = __esm(() => {
|
|
|
235947
235885
|
});
|
|
235948
235886
|
|
|
235949
235887
|
// ../wp-typia-project-tools/src/runtime/cli-add-workspace-ability-scaffold.ts
|
|
235950
|
-
import
|
|
235888
|
+
import fs40 from "fs";
|
|
235951
235889
|
import { promises as fsp23 } from "fs";
|
|
235952
235890
|
import path59 from "path";
|
|
235953
235891
|
import { syncTypeSchemas as syncTypeSchemas3 } from "@wp-typia/block-runtime/metadata-core";
|
|
@@ -235964,13 +235902,13 @@ function resolveManagedDependencyVersion(existingVersion, requiredVersion) {
|
|
|
235964
235902
|
}
|
|
235965
235903
|
function resolveAbilityRegistryPath(projectDir) {
|
|
235966
235904
|
const abilitiesDir = path59.join(projectDir, "src", "abilities");
|
|
235967
|
-
return [path59.join(abilitiesDir, "index.ts"), path59.join(abilitiesDir, "index.js")].find((candidatePath) =>
|
|
235905
|
+
return [path59.join(abilitiesDir, "index.ts"), path59.join(abilitiesDir, "index.js")].find((candidatePath) => fs40.existsSync(candidatePath)) ?? path59.join(abilitiesDir, "index.ts");
|
|
235968
235906
|
}
|
|
235969
235907
|
function readAbilityRegistrySlugs(registryPath) {
|
|
235970
|
-
if (!
|
|
235908
|
+
if (!fs40.existsSync(registryPath)) {
|
|
235971
235909
|
return [];
|
|
235972
235910
|
}
|
|
235973
|
-
const source =
|
|
235911
|
+
const source = fs40.readFileSync(registryPath, "utf8");
|
|
235974
235912
|
return Array.from(source.matchAll(/^\s*export\s+\*\s+from\s+['"]\.\/([^/'"]+)\/client['"];?\s*$/gmu)).map((match3) => match3[1]);
|
|
235975
235913
|
}
|
|
235976
235914
|
async function writeAbilityRegistry(projectDir, abilitySlug) {
|
|
@@ -235981,7 +235919,7 @@ async function writeAbilityRegistry(projectDir, abilitySlug) {
|
|
|
235981
235919
|
const existingRegistrySlugs = readAbilityRegistrySlugs(registryPath);
|
|
235982
235920
|
const nextAbilitySlugs = Array.from(new Set([...existingAbilitySlugs, ...existingRegistrySlugs, abilitySlug])).sort();
|
|
235983
235921
|
const generatedSection = buildAbilityRegistrySource(nextAbilitySlugs);
|
|
235984
|
-
const existingSource =
|
|
235922
|
+
const existingSource = fs40.existsSync(registryPath) ? fs40.readFileSync(registryPath, "utf8") : "";
|
|
235985
235923
|
const generatedSectionPattern = new RegExp(`${escapeRegex2(ABILITY_REGISTRY_START_MARKER)}[\\s\\S]*?${escapeRegex2(ABILITY_REGISTRY_END_MARKER)}\\n?`, "u");
|
|
235986
235924
|
const nextSource = existingSource ? generatedSectionPattern.test(existingSource) ? existingSource.replace(generatedSectionPattern, generatedSection) : `${existingSource.trimEnd()}
|
|
235987
235925
|
|
|
@@ -237947,7 +237885,6 @@ var init_cli_add_workspace_ai = __esm(() => {
|
|
|
237947
237885
|
});
|
|
237948
237886
|
|
|
237949
237887
|
// ../wp-typia-project-tools/src/runtime/cli-add-workspace.ts
|
|
237950
|
-
import fs42 from "fs";
|
|
237951
237888
|
import { promises as fsp26 } from "fs";
|
|
237952
237889
|
import path63 from "path";
|
|
237953
237890
|
function isIdentifierBoundary(source, index) {
|
|
@@ -238322,7 +238259,7 @@ async function writeVariationRegistry(projectDir, blockSlug, variationSlug) {
|
|
|
238322
238259
|
const variationsDir = path63.join(projectDir, "src", "blocks", blockSlug, "variations");
|
|
238323
238260
|
const variationsIndexPath = path63.join(variationsDir, "index.ts");
|
|
238324
238261
|
await fsp26.mkdir(variationsDir, { recursive: true });
|
|
238325
|
-
const existingVariationSlugs =
|
|
238262
|
+
const existingVariationSlugs = (await fsp26.readdir(variationsDir)).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
|
|
238326
238263
|
const nextVariationSlugs = Array.from(new Set([...existingVariationSlugs, variationSlug])).sort();
|
|
238327
238264
|
await fsp26.writeFile(variationsIndexPath, buildVariationIndexSource(nextVariationSlugs), "utf8");
|
|
238328
238265
|
}
|
|
@@ -238330,7 +238267,7 @@ async function writeBlockStyleRegistry(projectDir, blockSlug, styleSlug) {
|
|
|
238330
238267
|
const stylesDir = path63.join(projectDir, "src", "blocks", blockSlug, "styles");
|
|
238331
238268
|
const stylesIndexPath = path63.join(stylesDir, "index.ts");
|
|
238332
238269
|
await fsp26.mkdir(stylesDir, { recursive: true });
|
|
238333
|
-
const existingStyleSlugs =
|
|
238270
|
+
const existingStyleSlugs = (await fsp26.readdir(stylesDir)).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
|
|
238334
238271
|
const nextStyleSlugs = Array.from(new Set([...existingStyleSlugs, styleSlug])).sort();
|
|
238335
238272
|
await fsp26.writeFile(stylesIndexPath, buildBlockStyleIndexSource(nextStyleSlugs), "utf8");
|
|
238336
238273
|
}
|
|
@@ -238338,7 +238275,7 @@ async function writeBlockTransformRegistry(projectDir, blockSlug, transformSlug)
|
|
|
238338
238275
|
const transformsDir = path63.join(projectDir, "src", "blocks", blockSlug, "transforms");
|
|
238339
238276
|
const transformsIndexPath = path63.join(transformsDir, "index.ts");
|
|
238340
238277
|
await fsp26.mkdir(transformsDir, { recursive: true });
|
|
238341
|
-
const existingTransformSlugs =
|
|
238278
|
+
const existingTransformSlugs = (await fsp26.readdir(transformsDir)).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
|
|
238342
238279
|
const nextTransformSlugs = Array.from(new Set([...existingTransformSlugs, transformSlug])).sort();
|
|
238343
238280
|
await fsp26.writeFile(transformsIndexPath, buildBlockTransformIndexSource(nextTransformSlugs), "utf8");
|
|
238344
238281
|
}
|
|
@@ -238387,7 +238324,7 @@ async function runAddVariationCommand({
|
|
|
238387
238324
|
const variationsDir = path63.join(workspace.projectDir, "src", "blocks", blockSlug, "variations");
|
|
238388
238325
|
const variationFilePath = path63.join(variationsDir, `${variationSlug}.ts`);
|
|
238389
238326
|
const variationsIndexPath = path63.join(variationsDir, "index.ts");
|
|
238390
|
-
const shouldRemoveVariationsDirOnRollback = !
|
|
238327
|
+
const shouldRemoveVariationsDirOnRollback = !await pathExists(variationsDir);
|
|
238391
238328
|
const mutationSnapshot = {
|
|
238392
238329
|
fileSources: await snapshotWorkspaceFiles([
|
|
238393
238330
|
blockConfigPath,
|
|
@@ -238434,7 +238371,7 @@ async function runAddBlockStyleCommand({
|
|
|
238434
238371
|
const stylesDir = path63.join(workspace.projectDir, "src", "blocks", blockSlug, "styles");
|
|
238435
238372
|
const styleFilePath = path63.join(stylesDir, `${styleSlug}.ts`);
|
|
238436
238373
|
const stylesIndexPath = path63.join(stylesDir, "index.ts");
|
|
238437
|
-
const shouldRemoveStylesDirOnRollback = !
|
|
238374
|
+
const shouldRemoveStylesDirOnRollback = !await pathExists(stylesDir);
|
|
238438
238375
|
const mutationSnapshot = {
|
|
238439
238376
|
fileSources: await snapshotWorkspaceFiles([
|
|
238440
238377
|
blockConfigPath,
|
|
@@ -238483,7 +238420,7 @@ async function runAddBlockTransformCommand({
|
|
|
238483
238420
|
const transformsDir = path63.join(workspace.projectDir, "src", "blocks", target.blockSlug, "transforms");
|
|
238484
238421
|
const transformFilePath = path63.join(transformsDir, `${transformSlug}.ts`);
|
|
238485
238422
|
const transformsIndexPath = path63.join(transformsDir, "index.ts");
|
|
238486
|
-
const shouldRemoveTransformsDirOnRollback = !
|
|
238423
|
+
const shouldRemoveTransformsDirOnRollback = !await pathExists(transformsDir);
|
|
238487
238424
|
const mutationSnapshot = {
|
|
238488
238425
|
fileSources: await snapshotWorkspaceFiles([
|
|
238489
238426
|
blockConfigPath,
|
|
@@ -238543,7 +238480,7 @@ async function runAddHookedBlockCommand({
|
|
|
238543
238480
|
if (resolvedAnchorBlockName === selfHookAnchor) {
|
|
238544
238481
|
throw new Error("`wp-typia add hooked-block` cannot hook a block relative to its own block name.");
|
|
238545
238482
|
}
|
|
238546
|
-
const { blockJson, blockJsonPath } = readWorkspaceBlockJson(workspace.projectDir, blockSlug);
|
|
238483
|
+
const { blockJson, blockJsonPath } = await readWorkspaceBlockJson(workspace.projectDir, blockSlug);
|
|
238547
238484
|
const blockJsonRelativePath = path63.relative(workspace.projectDir, blockJsonPath);
|
|
238548
238485
|
const blockHooks = getMutableBlockHooks(blockJson, blockJsonRelativePath);
|
|
238549
238486
|
if (Object.prototype.hasOwnProperty.call(blockHooks, resolvedAnchorBlockName)) {
|
|
@@ -238570,6 +238507,7 @@ async function runAddHookedBlockCommand({
|
|
|
238570
238507
|
}
|
|
238571
238508
|
var VARIATIONS_IMPORT_LINE = "import { registerWorkspaceVariations } from './variations';", VARIATIONS_IMPORT_PATTERN, VARIATIONS_CALL_LINE = "registerWorkspaceVariations();", VARIATIONS_CALL_PATTERN, BLOCK_STYLES_IMPORT_LINE = "import { registerWorkspaceBlockStyles } from './styles';", BLOCK_STYLES_IMPORT_PATTERN, BLOCK_STYLES_CALL_LINE = "registerWorkspaceBlockStyles();", BLOCK_STYLES_CALL_PATTERN, BLOCK_TRANSFORMS_IMPORT_LINE = "import { applyWorkspaceBlockTransforms } from './transforms';", BLOCK_TRANSFORMS_IMPORT_PATTERN, BLOCK_TRANSFORMS_CALL_LINE = "applyWorkspaceBlockTransforms(registration.settings);", BLOCK_TRANSFORMS_CALL_PATTERN, SCAFFOLD_REGISTRATION_SETTINGS_CALL_PATTERN, FULL_BLOCK_NAME_PATTERN;
|
|
238572
238509
|
var init_cli_add_workspace = __esm(() => {
|
|
238510
|
+
init_fs_async();
|
|
238573
238511
|
init_workspace_project();
|
|
238574
238512
|
init_workspace_inventory();
|
|
238575
238513
|
init_string_case();
|
|
@@ -238622,7 +238560,7 @@ var init_cli_add = __esm(() => {
|
|
|
238622
238560
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-environment.ts
|
|
238623
238561
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
238624
238562
|
import { access, constants as fsConstants, rm as rm2, writeFile as writeFile6 } from "fs/promises";
|
|
238625
|
-
import
|
|
238563
|
+
import fs41 from "fs";
|
|
238626
238564
|
import os5 from "os";
|
|
238627
238565
|
import path64 from "path";
|
|
238628
238566
|
function readCommandVersion(command, args = ["--version"]) {
|
|
@@ -238664,8 +238602,8 @@ function getTemplateDoctorChecks() {
|
|
|
238664
238602
|
const checks3 = [];
|
|
238665
238603
|
for (const template of listTemplates()) {
|
|
238666
238604
|
if (!isBuiltInTemplateId(template.id)) {
|
|
238667
|
-
const templateDirExists =
|
|
238668
|
-
const hasAssets2 = templateDirExists &&
|
|
238605
|
+
const templateDirExists = fs41.existsSync(template.templateDir);
|
|
238606
|
+
const hasAssets2 = templateDirExists && fs41.existsSync(path64.join(template.templateDir, "package.json.mustache"));
|
|
238669
238607
|
checks3.push({
|
|
238670
238608
|
status: !templateDirExists || hasAssets2 ? "pass" : "fail",
|
|
238671
238609
|
label: `Template ${template.id}`,
|
|
@@ -238688,9 +238626,9 @@ function getTemplateDoctorChecks() {
|
|
|
238688
238626
|
persistencePolicy: "public"
|
|
238689
238627
|
})
|
|
238690
238628
|
])) : getBuiltInTemplateLayerDirs(builtInTemplateId);
|
|
238691
|
-
const missingRequiredLayer = layerDirs.some((layerDir) => !
|
|
238692
|
-
const existingLayerDirs = layerDirs.filter((layerDir) =>
|
|
238693
|
-
const hasAssets = !missingRequiredLayer && existingLayerDirs.some((layerDir) =>
|
|
238629
|
+
const missingRequiredLayer = layerDirs.some((layerDir) => !fs41.existsSync(layerDir) && !isOmittableBuiltInTemplateLayerDir(builtInTemplateId, layerDir));
|
|
238630
|
+
const existingLayerDirs = layerDirs.filter((layerDir) => fs41.existsSync(layerDir));
|
|
238631
|
+
const hasAssets = !missingRequiredLayer && existingLayerDirs.some((layerDir) => fs41.existsSync(path64.join(layerDir, "package.json.mustache"))) && existingLayerDirs.some((layerDir) => fs41.existsSync(path64.join(layerDir, "src")));
|
|
238694
238632
|
checks3.push({
|
|
238695
238633
|
status: hasAssets ? "pass" : "fail",
|
|
238696
238634
|
label: `Template ${template.id}`,
|
|
@@ -238720,7 +238658,7 @@ var init_cli_doctor_environment = __esm(() => {
|
|
|
238720
238658
|
});
|
|
238721
238659
|
|
|
238722
238660
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-shared.ts
|
|
238723
|
-
import
|
|
238661
|
+
import fs42 from "fs";
|
|
238724
238662
|
import path65 from "path";
|
|
238725
238663
|
function createDoctorCheck2(label, status, detail, code) {
|
|
238726
238664
|
return code ? { code, detail, label, status } : { detail, label, status };
|
|
@@ -238735,7 +238673,7 @@ function resolveWorkspaceBootstrapPath(projectDir, packageName) {
|
|
|
238735
238673
|
return path65.join(projectDir, getWorkspaceBootstrapRelativePath(packageName));
|
|
238736
238674
|
}
|
|
238737
238675
|
function checkExistingFiles(projectDir, label, filePaths) {
|
|
238738
|
-
const missing = filePaths.filter((filePath) => typeof filePath === "string").filter((filePath) => !
|
|
238676
|
+
const missing = filePaths.filter((filePath) => typeof filePath === "string").filter((filePath) => !fs42.existsSync(path65.join(projectDir, filePath)));
|
|
238739
238677
|
return createDoctorCheck2(label, missing.length === 0 ? "pass" : "fail", missing.length === 0 ? "All referenced files exist" : `Missing: ${missing.join(", ")}`);
|
|
238740
238678
|
}
|
|
238741
238679
|
var WORKSPACE_BINDING_SERVER_GLOB = "/src/bindings/*/server.php", WORKSPACE_BINDING_EDITOR_SCRIPT = "build/bindings/index.js", WORKSPACE_BINDING_EDITOR_ASSET = "build/bindings/index.asset.php", WORKSPACE_REST_RESOURCE_GLOB = "/inc/rest/*.php", WORKSPACE_ABILITY_GLOB = "/inc/abilities/*.php", WORKSPACE_ABILITY_EDITOR_SCRIPT = "build/abilities/index.js", WORKSPACE_ABILITY_EDITOR_ASSET = "build/abilities/index.asset.php", WORKSPACE_AI_FEATURE_GLOB = "/inc/ai-features/*.php", WORKSPACE_ADMIN_VIEW_GLOB = "/inc/admin-views/*.php", WORKSPACE_ADMIN_VIEW_SCRIPT = "build/admin-views/index.js", WORKSPACE_ADMIN_VIEW_ASSET = "build/admin-views/index.asset.php", WORKSPACE_ADMIN_VIEW_STYLE = "build/admin-views/style-index.css", WORKSPACE_EDITOR_PLUGIN_EDITOR_SCRIPT = "build/editor-plugins/index.js", WORKSPACE_EDITOR_PLUGIN_EDITOR_ASSET = "build/editor-plugins/index.asset.php", WORKSPACE_EDITOR_PLUGIN_EDITOR_STYLE = "build/editor-plugins/style-index.css", WORKSPACE_GENERATED_BLOCK_ARTIFACTS, WORKSPACE_FULL_BLOCK_NAME_PATTERN;
|
|
@@ -238751,15 +238689,15 @@ var init_cli_doctor_workspace_shared = __esm(() => {
|
|
|
238751
238689
|
});
|
|
238752
238690
|
|
|
238753
238691
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-bindings.ts
|
|
238754
|
-
import
|
|
238692
|
+
import fs43 from "fs";
|
|
238755
238693
|
import path66 from "path";
|
|
238756
238694
|
import { parseScaffoldBlockMetadata as parseScaffoldBlockMetadata2 } from "@wp-typia/block-runtime/blocks";
|
|
238757
238695
|
function checkWorkspaceBindingBootstrap(projectDir, packageName) {
|
|
238758
238696
|
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
238759
|
-
if (!
|
|
238697
|
+
if (!fs43.existsSync(bootstrapPath)) {
|
|
238760
238698
|
return createDoctorCheck2("Binding bootstrap", "fail", `Missing ${path66.basename(bootstrapPath)}`);
|
|
238761
238699
|
}
|
|
238762
|
-
const source =
|
|
238700
|
+
const source = fs43.readFileSync(bootstrapPath, "utf8");
|
|
238763
238701
|
const hasServerGlob = source.includes(WORKSPACE_BINDING_SERVER_GLOB);
|
|
238764
238702
|
const hasEditorEnqueueHook = source.includes("enqueue_block_editor_assets");
|
|
238765
238703
|
const hasEditorScript = source.includes(WORKSPACE_BINDING_EDITOR_SCRIPT);
|
|
@@ -238767,12 +238705,12 @@ function checkWorkspaceBindingBootstrap(projectDir, packageName) {
|
|
|
238767
238705
|
return createDoctorCheck2("Binding bootstrap", hasServerGlob && hasEditorEnqueueHook && hasEditorScript && hasEditorAsset ? "pass" : "fail", hasServerGlob && hasEditorEnqueueHook && hasEditorScript && hasEditorAsset ? "Binding source PHP and editor bootstrap hooks are present" : "Missing binding source PHP require glob or editor enqueue hook");
|
|
238768
238706
|
}
|
|
238769
238707
|
function checkWorkspaceBindingSourcesIndex(projectDir, bindingSources) {
|
|
238770
|
-
const indexRelativePath = [path66.join("src", "bindings", "index.ts"), path66.join("src", "bindings", "index.js")].find((relativePath) =>
|
|
238708
|
+
const indexRelativePath = [path66.join("src", "bindings", "index.ts"), path66.join("src", "bindings", "index.js")].find((relativePath) => fs43.existsSync(path66.join(projectDir, relativePath)));
|
|
238771
238709
|
if (!indexRelativePath) {
|
|
238772
238710
|
return createDoctorCheck2("Binding sources index", "fail", "Missing src/bindings/index.ts or src/bindings/index.js");
|
|
238773
238711
|
}
|
|
238774
238712
|
const indexPath = path66.join(projectDir, indexRelativePath);
|
|
238775
|
-
const source =
|
|
238713
|
+
const source = fs43.readFileSync(indexPath, "utf8");
|
|
238776
238714
|
const missingImports = bindingSources.filter((bindingSource) => !source.includes(`./${bindingSource.slug}/editor`));
|
|
238777
238715
|
return createDoctorCheck2("Binding sources index", missingImports.length === 0 ? "pass" : "fail", missingImports.length === 0 ? "Binding source editor registrations are aggregated" : `Missing editor imports for: ${missingImports.map((entry) => entry.slug).join(", ")}`);
|
|
238778
238716
|
}
|
|
@@ -238792,7 +238730,7 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
|
|
|
238792
238730
|
const blockJsonPath = path66.join(projectDir, blockJsonRelativePath);
|
|
238793
238731
|
const issues = [];
|
|
238794
238732
|
try {
|
|
238795
|
-
const blockJson = parseScaffoldBlockMetadata2(JSON.parse(
|
|
238733
|
+
const blockJson = parseScaffoldBlockMetadata2(JSON.parse(fs43.readFileSync(blockJsonPath, "utf8")));
|
|
238796
238734
|
const attributes = blockJson.attributes;
|
|
238797
238735
|
if (!attributes || typeof attributes !== "object" || Array.isArray(attributes)) {
|
|
238798
238736
|
issues.push(`${blockJsonRelativePath} must define an attributes object`);
|
|
@@ -238806,8 +238744,8 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
|
|
|
238806
238744
|
issues.push(error48 instanceof Error ? `Unable to read ${blockJsonRelativePath}: ${error48.message}` : `Unable to read ${blockJsonRelativePath}.`);
|
|
238807
238745
|
}
|
|
238808
238746
|
const serverPath = path66.join(projectDir, bindingSource.serverFile);
|
|
238809
|
-
if (
|
|
238810
|
-
const serverSource =
|
|
238747
|
+
if (fs43.existsSync(serverPath)) {
|
|
238748
|
+
const serverSource = fs43.readFileSync(serverPath, "utf8");
|
|
238811
238749
|
const supportedAttributesFilter = `block_bindings_supported_attributes_${workspace.workspace.namespace}/${bindingSource.block}`;
|
|
238812
238750
|
if (!serverSource.includes(supportedAttributesFilter)) {
|
|
238813
238751
|
issues.push(`${bindingSource.serverFile} must register ${supportedAttributesFilter}`);
|
|
@@ -238819,8 +238757,8 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
|
|
|
238819
238757
|
issues.push(`Missing ${bindingSource.serverFile}`);
|
|
238820
238758
|
}
|
|
238821
238759
|
const editorPath = path66.join(projectDir, bindingSource.editorFile);
|
|
238822
|
-
if (
|
|
238823
|
-
const editorSource =
|
|
238760
|
+
if (fs43.existsSync(editorPath)) {
|
|
238761
|
+
const editorSource = fs43.readFileSync(editorPath, "utf8");
|
|
238824
238762
|
const blockName = `${workspace.workspace.namespace}/${bindingSource.block}`;
|
|
238825
238763
|
const bindingSourceTargetMatch = editorSource.match(/export\s+const\s+BINDING_SOURCE_TARGET\s*=\s*\{([\s\S]*?)\}\s+as\s+const\s*;/u);
|
|
238826
238764
|
if (!bindingSourceTargetMatch) {
|
|
@@ -238865,7 +238803,7 @@ var init_cli_doctor_workspace_bindings = __esm(() => {
|
|
|
238865
238803
|
});
|
|
238866
238804
|
|
|
238867
238805
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-blocks.ts
|
|
238868
|
-
import
|
|
238806
|
+
import fs44 from "fs";
|
|
238869
238807
|
import path67 from "path";
|
|
238870
238808
|
import { parseScaffoldBlockMetadata as parseScaffoldBlockMetadata3 } from "@wp-typia/block-runtime/blocks";
|
|
238871
238809
|
function normalizePathSeparators(relativePath) {
|
|
@@ -238883,14 +238821,14 @@ function hasRegisteredBlockAsset(value2) {
|
|
|
238883
238821
|
function readWorkspaceBlockIframeMetadata(projectDir, blockSlug) {
|
|
238884
238822
|
const blockJsonRelativePath = path67.join("src", "blocks", blockSlug, "block.json");
|
|
238885
238823
|
const blockJsonPath = path67.join(projectDir, blockJsonRelativePath);
|
|
238886
|
-
if (!
|
|
238824
|
+
if (!fs44.existsSync(blockJsonPath)) {
|
|
238887
238825
|
return {
|
|
238888
238826
|
blockJsonRelativePath,
|
|
238889
238827
|
error: `Missing ${blockJsonRelativePath}`
|
|
238890
238828
|
};
|
|
238891
238829
|
}
|
|
238892
238830
|
try {
|
|
238893
|
-
const document2 = parseScaffoldBlockMetadata3(JSON.parse(
|
|
238831
|
+
const document2 = parseScaffoldBlockMetadata3(JSON.parse(fs44.readFileSync(blockJsonPath, "utf8")));
|
|
238894
238832
|
return {
|
|
238895
238833
|
blockJsonRelativePath,
|
|
238896
238834
|
document: document2
|
|
@@ -238921,7 +238859,7 @@ function isWorkspaceBlockSaveSource(relativePath) {
|
|
|
238921
238859
|
}
|
|
238922
238860
|
function collectWorkspaceBlockEditorSources(projectDir, blockSlug) {
|
|
238923
238861
|
const blockDir = path67.join(projectDir, "src", "blocks", blockSlug);
|
|
238924
|
-
if (!
|
|
238862
|
+
if (!fs44.existsSync(blockDir)) {
|
|
238925
238863
|
return [];
|
|
238926
238864
|
}
|
|
238927
238865
|
const collected = [];
|
|
@@ -238931,7 +238869,7 @@ function collectWorkspaceBlockEditorSources(projectDir, blockSlug) {
|
|
|
238931
238869
|
if (!currentDir) {
|
|
238932
238870
|
continue;
|
|
238933
238871
|
}
|
|
238934
|
-
for (const entry of
|
|
238872
|
+
for (const entry of fs44.readdirSync(currentDir, { withFileTypes: true })) {
|
|
238935
238873
|
const absolutePath = path67.join(currentDir, entry.name);
|
|
238936
238874
|
if (entry.isDirectory()) {
|
|
238937
238875
|
queue.push(absolutePath);
|
|
@@ -238946,7 +238884,7 @@ function collectWorkspaceBlockEditorSources(projectDir, blockSlug) {
|
|
|
238946
238884
|
}
|
|
238947
238885
|
collected.push({
|
|
238948
238886
|
relativePath: normalizePathSeparators(relativePath),
|
|
238949
|
-
source:
|
|
238887
|
+
source: fs44.readFileSync(absolutePath, "utf8")
|
|
238950
238888
|
});
|
|
238951
238889
|
}
|
|
238952
238890
|
}
|
|
@@ -239017,12 +238955,12 @@ function getWorkspaceBlockRequiredFiles(block) {
|
|
|
239017
238955
|
function checkWorkspaceBlockMetadata(projectDir, workspace, block) {
|
|
239018
238956
|
const blockJsonRelativePath = path67.join("src", "blocks", block.slug, "block.json");
|
|
239019
238957
|
const blockJsonPath = path67.join(projectDir, blockJsonRelativePath);
|
|
239020
|
-
if (!
|
|
238958
|
+
if (!fs44.existsSync(blockJsonPath)) {
|
|
239021
238959
|
return createDoctorCheck2(`Block metadata ${block.slug}`, "fail", `Missing ${blockJsonRelativePath}`);
|
|
239022
238960
|
}
|
|
239023
238961
|
let blockJson;
|
|
239024
238962
|
try {
|
|
239025
|
-
blockJson = parseScaffoldBlockMetadata3(JSON.parse(
|
|
238963
|
+
blockJson = parseScaffoldBlockMetadata3(JSON.parse(fs44.readFileSync(blockJsonPath, "utf8")));
|
|
239026
238964
|
} catch (error48) {
|
|
239027
238965
|
return createDoctorCheck2(`Block metadata ${block.slug}`, "fail", error48 instanceof Error ? error48.message : String(error48));
|
|
239028
238966
|
}
|
|
@@ -239039,12 +238977,12 @@ function checkWorkspaceBlockMetadata(projectDir, workspace, block) {
|
|
|
239039
238977
|
function checkWorkspaceBlockHooks(projectDir, blockSlug) {
|
|
239040
238978
|
const blockJsonRelativePath = path67.join("src", "blocks", blockSlug, "block.json");
|
|
239041
238979
|
const blockJsonPath = path67.join(projectDir, blockJsonRelativePath);
|
|
239042
|
-
if (!
|
|
238980
|
+
if (!fs44.existsSync(blockJsonPath)) {
|
|
239043
238981
|
return createDoctorCheck2(`Block hooks ${blockSlug}`, "fail", `Missing ${blockJsonRelativePath}`);
|
|
239044
238982
|
}
|
|
239045
238983
|
let blockJson;
|
|
239046
238984
|
try {
|
|
239047
|
-
blockJson = parseScaffoldBlockMetadata3(JSON.parse(
|
|
238985
|
+
blockJson = parseScaffoldBlockMetadata3(JSON.parse(fs44.readFileSync(blockJsonPath, "utf8")));
|
|
239048
238986
|
} catch (error48) {
|
|
239049
238987
|
return createDoctorCheck2(`Block hooks ${blockSlug}`, "fail", error48 instanceof Error ? error48.message : String(error48));
|
|
239050
238988
|
}
|
|
@@ -239062,10 +239000,10 @@ function checkWorkspaceBlockHooks(projectDir, blockSlug) {
|
|
|
239062
239000
|
function checkWorkspaceBlockCollectionImport(projectDir, blockSlug) {
|
|
239063
239001
|
const entryRelativePath = path67.join("src", "blocks", blockSlug, "index.tsx");
|
|
239064
239002
|
const entryPath = path67.join(projectDir, entryRelativePath);
|
|
239065
|
-
if (!
|
|
239003
|
+
if (!fs44.existsSync(entryPath)) {
|
|
239066
239004
|
return createDoctorCheck2(`Block collection ${blockSlug}`, "fail", `Missing ${entryRelativePath}`);
|
|
239067
239005
|
}
|
|
239068
|
-
const source =
|
|
239006
|
+
const source = fs44.readFileSync(entryPath, "utf8");
|
|
239069
239007
|
const hasCollectionImport = WORKSPACE_COLLECTION_IMPORT_PATTERN.test(source);
|
|
239070
239008
|
return createDoctorCheck2(`Block collection ${blockSlug}`, hasCollectionImport ? "pass" : "fail", hasCollectionImport ? "Shared block collection import is present" : `Missing a shared collection import like ${WORKSPACE_COLLECTION_IMPORT_LINE}`);
|
|
239071
239009
|
}
|
|
@@ -239079,7 +239017,7 @@ function checkWorkspaceBlockIframeCompatibility(projectDir, blockSlug) {
|
|
|
239079
239017
|
const blockJson = metadataResult.document;
|
|
239080
239018
|
const apiVersion = typeof blockJson.apiVersion === "number" && Number.isFinite(blockJson.apiVersion) ? blockJson.apiVersion : null;
|
|
239081
239019
|
const blockDir = path67.join(projectDir, "src", "blocks", blockSlug);
|
|
239082
|
-
const localStyleFiles = WORKSPACE_BLOCK_LOCAL_STYLE_FILES.filter((fileName) =>
|
|
239020
|
+
const localStyleFiles = WORKSPACE_BLOCK_LOCAL_STYLE_FILES.filter((fileName) => fs44.existsSync(path67.join(blockDir, fileName))).map((fileName) => normalizePathSeparators(path67.join("src", "blocks", blockSlug, fileName)));
|
|
239083
239021
|
const hasRegisteredEditorStyles = hasRegisteredBlockAsset(blockJson.style) || hasRegisteredBlockAsset(blockJson.editorStyle);
|
|
239084
239022
|
const editorSources = collectWorkspaceBlockEditorSources(projectDir, blockSlug);
|
|
239085
239023
|
const editorWrapperSources = editorSources.filter((source) => !isWorkspaceBlockSaveSource(source.relativePath));
|
|
@@ -239097,40 +239035,40 @@ function checkWorkspaceBlockIframeCompatibility(projectDir, blockSlug) {
|
|
|
239097
239035
|
}
|
|
239098
239036
|
function checkWorkspacePatternBootstrap(projectDir, packageName) {
|
|
239099
239037
|
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
239100
|
-
if (!
|
|
239038
|
+
if (!fs44.existsSync(bootstrapPath)) {
|
|
239101
239039
|
return createDoctorCheck2("Pattern bootstrap", "fail", `Missing ${path67.basename(bootstrapPath)}`);
|
|
239102
239040
|
}
|
|
239103
|
-
const source =
|
|
239041
|
+
const source = fs44.readFileSync(bootstrapPath, "utf8");
|
|
239104
239042
|
const hasCategoryAnchor = source.includes("register_block_pattern_category");
|
|
239105
239043
|
const hasPatternGlob = source.includes("/src/patterns/*.php");
|
|
239106
239044
|
return createDoctorCheck2("Pattern bootstrap", hasCategoryAnchor && hasPatternGlob ? "pass" : "fail", hasCategoryAnchor && hasPatternGlob ? "Pattern category and loader hooks are present" : "Missing pattern category registration or src/patterns loader hook");
|
|
239107
239045
|
}
|
|
239108
239046
|
function checkVariationEntrypoint(projectDir, blockSlug) {
|
|
239109
239047
|
const entryPath = path67.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
|
|
239110
|
-
if (!
|
|
239048
|
+
if (!fs44.existsSync(entryPath)) {
|
|
239111
239049
|
return createDoctorCheck2(`Variation entrypoint ${blockSlug}`, "fail", `Missing ${path67.relative(projectDir, entryPath)}`);
|
|
239112
239050
|
}
|
|
239113
|
-
const source =
|
|
239051
|
+
const source = fs44.readFileSync(entryPath, "utf8");
|
|
239114
239052
|
const hasImport = hasUncommentedPattern(source, WORKSPACE_VARIATIONS_IMPORT_PATTERN);
|
|
239115
239053
|
const hasCall = hasExecutablePattern(source, WORKSPACE_VARIATIONS_CALL_PATTERN);
|
|
239116
239054
|
return createDoctorCheck2(`Variation entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall ? "Variations registration hook is present" : "Missing ./variations import or registerWorkspaceVariations() call");
|
|
239117
239055
|
}
|
|
239118
239056
|
function checkBlockStyleEntrypoint(projectDir, blockSlug) {
|
|
239119
239057
|
const entryPath = path67.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
|
|
239120
|
-
if (!
|
|
239058
|
+
if (!fs44.existsSync(entryPath)) {
|
|
239121
239059
|
return createDoctorCheck2(`Block style entrypoint ${blockSlug}`, "fail", `Missing ${path67.relative(projectDir, entryPath)}`);
|
|
239122
239060
|
}
|
|
239123
|
-
const source =
|
|
239061
|
+
const source = fs44.readFileSync(entryPath, "utf8");
|
|
239124
239062
|
const hasImport = hasUncommentedPattern(source, WORKSPACE_BLOCK_STYLES_IMPORT_PATTERN);
|
|
239125
239063
|
const hasCall = hasExecutablePattern(source, WORKSPACE_BLOCK_STYLES_CALL_PATTERN);
|
|
239126
239064
|
return createDoctorCheck2(`Block style entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall ? "Block style registration hook is present" : "Missing ./styles import or registerWorkspaceBlockStyles() call");
|
|
239127
239065
|
}
|
|
239128
239066
|
function checkBlockTransformEntrypoint(projectDir, blockSlug) {
|
|
239129
239067
|
const entryPath = path67.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
|
|
239130
|
-
if (!
|
|
239068
|
+
if (!fs44.existsSync(entryPath)) {
|
|
239131
239069
|
return createDoctorCheck2(`Block transform entrypoint ${blockSlug}`, "fail", `Missing ${path67.relative(projectDir, entryPath)}`);
|
|
239132
239070
|
}
|
|
239133
|
-
const source =
|
|
239071
|
+
const source = fs44.readFileSync(entryPath, "utf8");
|
|
239134
239072
|
const hasImport = hasUncommentedPattern(source, WORKSPACE_BLOCK_TRANSFORMS_IMPORT_PATTERN);
|
|
239135
239073
|
const hasCall = hasExecutablePattern(source, WORKSPACE_BLOCK_TRANSFORMS_CALL_PATTERN);
|
|
239136
239074
|
return createDoctorCheck2(`Block transform entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall ? "Block transform registration hook is present" : "Missing ./transforms import or applyWorkspaceBlockTransforms(registration.settings) call");
|
|
@@ -239199,7 +239137,7 @@ function getWorkspaceBlockDoctorChecks(workspace, inventory) {
|
|
|
239199
239137
|
]));
|
|
239200
239138
|
checks3.push(checkBlockTransformEntrypoint(workspace.projectDir, blockSlug));
|
|
239201
239139
|
}
|
|
239202
|
-
const shouldCheckPatternBootstrap = inventory.patterns.length > 0 ||
|
|
239140
|
+
const shouldCheckPatternBootstrap = inventory.patterns.length > 0 || fs44.existsSync(path67.join(workspace.projectDir, "src", "patterns"));
|
|
239203
239141
|
if (shouldCheckPatternBootstrap) {
|
|
239204
239142
|
checks3.push(checkWorkspacePatternBootstrap(workspace.projectDir, workspace.packageName));
|
|
239205
239143
|
}
|
|
@@ -239250,7 +239188,7 @@ var init_cli_doctor_workspace_blocks = __esm(() => {
|
|
|
239250
239188
|
});
|
|
239251
239189
|
|
|
239252
239190
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-features.ts
|
|
239253
|
-
import
|
|
239191
|
+
import fs45 from "fs";
|
|
239254
239192
|
import path68 from "path";
|
|
239255
239193
|
function getWorkspaceRestResourceRequiredFiles(restResource) {
|
|
239256
239194
|
const schemaNames = new Set;
|
|
@@ -239293,10 +239231,10 @@ function checkWorkspaceRestResourceConfig(restResource) {
|
|
|
239293
239231
|
}
|
|
239294
239232
|
function checkWorkspaceRestResourceBootstrap(projectDir, packageName, phpPrefix) {
|
|
239295
239233
|
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
239296
|
-
if (!
|
|
239234
|
+
if (!fs45.existsSync(bootstrapPath)) {
|
|
239297
239235
|
return createDoctorCheck2("REST resource bootstrap", "fail", `Missing ${path68.basename(bootstrapPath)}`);
|
|
239298
239236
|
}
|
|
239299
|
-
const source =
|
|
239237
|
+
const source = fs45.readFileSync(bootstrapPath, "utf8");
|
|
239300
239238
|
const registerFunctionName = `${phpPrefix}_register_rest_resources`;
|
|
239301
239239
|
const registerHook = `add_action( 'init', '${registerFunctionName}', 20 );`;
|
|
239302
239240
|
const hasServerGlob = source.includes(WORKSPACE_REST_RESOURCE_GLOB);
|
|
@@ -239316,11 +239254,11 @@ function getWorkspaceAbilityRequiredFiles(ability) {
|
|
|
239316
239254
|
}
|
|
239317
239255
|
function checkWorkspaceAbilityConfig(projectDir, ability) {
|
|
239318
239256
|
const configPath = path68.join(projectDir, ability.configFile);
|
|
239319
|
-
if (!
|
|
239257
|
+
if (!fs45.existsSync(configPath)) {
|
|
239320
239258
|
return createDoctorCheck2(`Ability config ${ability.slug}`, "fail", `Missing ${ability.configFile}`);
|
|
239321
239259
|
}
|
|
239322
239260
|
try {
|
|
239323
|
-
const config2 = JSON.parse(
|
|
239261
|
+
const config2 = JSON.parse(fs45.readFileSync(configPath, "utf8"));
|
|
239324
239262
|
const abilityId = typeof config2.abilityId === "string" ? config2.abilityId.trim() : "";
|
|
239325
239263
|
const categorySlug = typeof config2.category?.slug === "string" ? config2.category.slug.trim() : "";
|
|
239326
239264
|
const hasValidAbilityId = /^[a-z0-9-]+\/[a-z0-9-]+$/u.test(abilityId);
|
|
@@ -239332,10 +239270,10 @@ function checkWorkspaceAbilityConfig(projectDir, ability) {
|
|
|
239332
239270
|
}
|
|
239333
239271
|
function checkWorkspaceAbilityBootstrap(projectDir, packageName, phpPrefix) {
|
|
239334
239272
|
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
239335
|
-
if (!
|
|
239273
|
+
if (!fs45.existsSync(bootstrapPath)) {
|
|
239336
239274
|
return createDoctorCheck2("Ability bootstrap", "fail", `Missing ${path68.basename(bootstrapPath)}`);
|
|
239337
239275
|
}
|
|
239338
|
-
const source =
|
|
239276
|
+
const source = fs45.readFileSync(bootstrapPath, "utf8");
|
|
239339
239277
|
const loadFunctionName = `${phpPrefix}_load_workflow_abilities`;
|
|
239340
239278
|
const enqueueFunctionName = `${phpPrefix}_enqueue_workflow_abilities`;
|
|
239341
239279
|
const loadHook = `add_action( 'plugins_loaded', '${loadFunctionName}' );`;
|
|
@@ -239354,12 +239292,12 @@ function checkWorkspaceAbilityIndex(projectDir, abilities) {
|
|
|
239354
239292
|
const indexRelativePath = [
|
|
239355
239293
|
path68.join("src", "abilities", "index.ts"),
|
|
239356
239294
|
path68.join("src", "abilities", "index.js")
|
|
239357
|
-
].find((relativePath) =>
|
|
239295
|
+
].find((relativePath) => fs45.existsSync(path68.join(projectDir, relativePath)));
|
|
239358
239296
|
if (!indexRelativePath) {
|
|
239359
239297
|
return createDoctorCheck2("Abilities index", "fail", "Missing src/abilities/index.ts or src/abilities/index.js");
|
|
239360
239298
|
}
|
|
239361
239299
|
const indexPath = path68.join(projectDir, indexRelativePath);
|
|
239362
|
-
const source =
|
|
239300
|
+
const source = fs45.readFileSync(indexPath, "utf8");
|
|
239363
239301
|
const missingExports = abilities.filter((ability) => {
|
|
239364
239302
|
const exportPattern = new RegExp(`^\\s*export\\s+(?:\\*\\s+from|\\{[^}]+\\}\\s+from)\\s+['"\`]\\./${escapeRegex2(ability.slug)}\\/client['"\`]`, "mu");
|
|
239365
239303
|
return !exportPattern.test(source);
|
|
@@ -239387,10 +239325,10 @@ function checkWorkspaceAiFeatureConfig(aiFeature) {
|
|
|
239387
239325
|
}
|
|
239388
239326
|
function checkWorkspaceAiFeatureBootstrap(projectDir, packageName, phpPrefix) {
|
|
239389
239327
|
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
239390
|
-
if (!
|
|
239328
|
+
if (!fs45.existsSync(bootstrapPath)) {
|
|
239391
239329
|
return createDoctorCheck2("AI feature bootstrap", "fail", `Missing ${path68.basename(bootstrapPath)}`);
|
|
239392
239330
|
}
|
|
239393
|
-
const source =
|
|
239331
|
+
const source = fs45.readFileSync(bootstrapPath, "utf8");
|
|
239394
239332
|
const registerFunctionName = `${phpPrefix}_register_ai_features`;
|
|
239395
239333
|
const registerHook = `add_action( 'init', '${registerFunctionName}', 20 );`;
|
|
239396
239334
|
const hasServerGlob = source.includes(WORKSPACE_AI_FEATURE_GLOB);
|
|
@@ -239415,10 +239353,10 @@ function checkWorkspaceEditorPluginConfig(editorPlugin) {
|
|
|
239415
239353
|
}
|
|
239416
239354
|
function checkWorkspaceEditorPluginBootstrap(projectDir, packageName, phpPrefix) {
|
|
239417
239355
|
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
239418
|
-
if (!
|
|
239356
|
+
if (!fs45.existsSync(bootstrapPath)) {
|
|
239419
239357
|
return createDoctorCheck2("Editor plugin bootstrap", "fail", `Missing ${path68.basename(bootstrapPath)}`);
|
|
239420
239358
|
}
|
|
239421
|
-
const source =
|
|
239359
|
+
const source = fs45.readFileSync(bootstrapPath, "utf8");
|
|
239422
239360
|
const enqueueFunctionName = `${phpPrefix}_enqueue_editor_plugins_editor`;
|
|
239423
239361
|
const enqueueHook = `add_action( 'enqueue_block_editor_assets', '${enqueueFunctionName}' );`;
|
|
239424
239362
|
const hasEditorEnqueueHook = source.includes(enqueueHook);
|
|
@@ -239431,12 +239369,12 @@ function checkWorkspaceEditorPluginIndex(projectDir, editorPlugins) {
|
|
|
239431
239369
|
const indexRelativePath = [
|
|
239432
239370
|
path68.join("src", "editor-plugins", "index.ts"),
|
|
239433
239371
|
path68.join("src", "editor-plugins", "index.js")
|
|
239434
|
-
].find((relativePath) =>
|
|
239372
|
+
].find((relativePath) => fs45.existsSync(path68.join(projectDir, relativePath)));
|
|
239435
239373
|
if (!indexRelativePath) {
|
|
239436
239374
|
return createDoctorCheck2("Editor plugins index", "fail", "Missing src/editor-plugins/index.ts or src/editor-plugins/index.js");
|
|
239437
239375
|
}
|
|
239438
239376
|
const indexPath = path68.join(projectDir, indexRelativePath);
|
|
239439
|
-
const source =
|
|
239377
|
+
const source = fs45.readFileSync(indexPath, "utf8");
|
|
239440
239378
|
const missingImports = editorPlugins.filter((editorPlugin) => {
|
|
239441
239379
|
const importPattern = new RegExp(`['"\`]\\./${escapeRegex2(editorPlugin.slug)}(?:/[^'"\`]*)?['"\`]`, "u");
|
|
239442
239380
|
return !importPattern.test(source);
|
|
@@ -239469,10 +239407,10 @@ function checkWorkspaceAdminViewConfig(adminView, inventory) {
|
|
|
239469
239407
|
}
|
|
239470
239408
|
function checkWorkspaceAdminViewBootstrap(projectDir, packageName, phpPrefix) {
|
|
239471
239409
|
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
239472
|
-
if (!
|
|
239410
|
+
if (!fs45.existsSync(bootstrapPath)) {
|
|
239473
239411
|
return createDoctorCheck2("Admin view bootstrap", "fail", `Missing ${path68.basename(bootstrapPath)}`);
|
|
239474
239412
|
}
|
|
239475
|
-
const source =
|
|
239413
|
+
const source = fs45.readFileSync(bootstrapPath, "utf8");
|
|
239476
239414
|
const loadFunctionName = `${phpPrefix}_load_admin_views`;
|
|
239477
239415
|
const loadHook = `add_action( 'plugins_loaded', '${loadFunctionName}' );`;
|
|
239478
239416
|
const hasLoaderHook = source.includes(loadHook);
|
|
@@ -239483,12 +239421,12 @@ function checkWorkspaceAdminViewIndex(projectDir, adminViews) {
|
|
|
239483
239421
|
const indexRelativePath = [
|
|
239484
239422
|
path68.join("src", "admin-views", "index.ts"),
|
|
239485
239423
|
path68.join("src", "admin-views", "index.js")
|
|
239486
|
-
].find((relativePath) =>
|
|
239424
|
+
].find((relativePath) => fs45.existsSync(path68.join(projectDir, relativePath)));
|
|
239487
239425
|
if (!indexRelativePath) {
|
|
239488
239426
|
return createDoctorCheck2("Admin views index", "fail", "Missing src/admin-views/index.ts or src/admin-views/index.js");
|
|
239489
239427
|
}
|
|
239490
239428
|
const indexPath = path68.join(projectDir, indexRelativePath);
|
|
239491
|
-
const source =
|
|
239429
|
+
const source = fs45.readFileSync(indexPath, "utf8");
|
|
239492
239430
|
const missingImports = adminViews.filter((adminView) => {
|
|
239493
239431
|
const importPattern = new RegExp(`['"\`]\\./${escapeRegex2(adminView.slug)}(?:/[^'"\`]*)?['"\`]`, "u");
|
|
239494
239432
|
return !importPattern.test(source);
|
|
@@ -239497,10 +239435,10 @@ function checkWorkspaceAdminViewIndex(projectDir, adminViews) {
|
|
|
239497
239435
|
}
|
|
239498
239436
|
function checkWorkspaceAdminViewPhp(projectDir, adminView) {
|
|
239499
239437
|
const phpPath = path68.join(projectDir, adminView.phpFile);
|
|
239500
|
-
if (!
|
|
239438
|
+
if (!fs45.existsSync(phpPath)) {
|
|
239501
239439
|
return createDoctorCheck2(`Admin view PHP ${adminView.slug}`, "fail", `Missing ${adminView.phpFile}`);
|
|
239502
239440
|
}
|
|
239503
|
-
const source =
|
|
239441
|
+
const source = fs45.readFileSync(phpPath, "utf8");
|
|
239504
239442
|
const hasAdminMenu = source.includes("add_submenu_page");
|
|
239505
239443
|
const hasAdminEnqueue = source.includes("admin_enqueue_scripts");
|
|
239506
239444
|
const hasScript = source.includes(WORKSPACE_ADMIN_VIEW_SCRIPT);
|
|
@@ -239558,7 +239496,7 @@ var init_cli_doctor_workspace_features = __esm(() => {
|
|
|
239558
239496
|
});
|
|
239559
239497
|
|
|
239560
239498
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-package.ts
|
|
239561
|
-
import
|
|
239499
|
+
import fs46 from "fs";
|
|
239562
239500
|
import path69 from "path";
|
|
239563
239501
|
function getWorkspacePackageMetadataCheck(workspace, packageJson) {
|
|
239564
239502
|
const issues = [];
|
|
@@ -239583,7 +239521,7 @@ function getWorkspacePackageMetadataCheck(workspace, packageJson) {
|
|
|
239583
239521
|
if (wpTypia?.phpPrefix !== workspace.workspace.phpPrefix) {
|
|
239584
239522
|
issues.push(`wpTypia.phpPrefix must equal "${workspace.workspace.phpPrefix}"`);
|
|
239585
239523
|
}
|
|
239586
|
-
if (!
|
|
239524
|
+
if (!fs46.existsSync(path69.join(workspace.projectDir, bootstrapRelativePath))) {
|
|
239587
239525
|
issues.push(`Missing bootstrap file ${bootstrapRelativePath}`);
|
|
239588
239526
|
}
|
|
239589
239527
|
return createDoctorCheck2("Workspace package metadata", issues.length === 0 ? "pass" : "fail", issues.length === 0 ? `package.json metadata aligns with ${workspace.packageName} and ${bootstrapRelativePath}` : issues.join("; "));
|
|
@@ -239591,7 +239529,7 @@ function getWorkspacePackageMetadataCheck(workspace, packageJson) {
|
|
|
239591
239529
|
function getMigrationWorkspaceHintCheck(workspace, packageJson) {
|
|
239592
239530
|
const hasMigrationScript = typeof packageJson.scripts?.["migration:doctor"] === "string";
|
|
239593
239531
|
const migrationConfigRelativePath = path69.join("src", "migrations", "config.ts");
|
|
239594
|
-
const hasMigrationConfig =
|
|
239532
|
+
const hasMigrationConfig = fs46.existsSync(path69.join(workspace.projectDir, migrationConfigRelativePath));
|
|
239595
239533
|
if (!hasMigrationScript && !hasMigrationConfig) {
|
|
239596
239534
|
return null;
|
|
239597
239535
|
}
|
|
@@ -239713,14 +239651,14 @@ var init_cli_doctor = __esm(() => {
|
|
|
239713
239651
|
});
|
|
239714
239652
|
|
|
239715
239653
|
// ../wp-typia-project-tools/src/runtime/cli-init-package-json.ts
|
|
239716
|
-
import
|
|
239654
|
+
import fs47 from "fs";
|
|
239717
239655
|
import path70 from "path";
|
|
239718
239656
|
function readProjectPackageJson(projectDir) {
|
|
239719
239657
|
const packageJsonPath = path70.join(projectDir, "package.json");
|
|
239720
|
-
if (!
|
|
239658
|
+
if (!fs47.existsSync(packageJsonPath)) {
|
|
239721
239659
|
return null;
|
|
239722
239660
|
}
|
|
239723
|
-
const source =
|
|
239661
|
+
const source = fs47.readFileSync(packageJsonPath, "utf8");
|
|
239724
239662
|
try {
|
|
239725
239663
|
return JSON.parse(source);
|
|
239726
239664
|
} catch (error48) {
|
|
@@ -239732,13 +239670,13 @@ function inferInitPackageManager(projectDir, packageJson) {
|
|
|
239732
239670
|
if (packageJson?.packageManager) {
|
|
239733
239671
|
return parseWorkspacePackageManagerId(packageJson.packageManager);
|
|
239734
239672
|
}
|
|
239735
|
-
if (
|
|
239673
|
+
if (fs47.existsSync(path70.join(projectDir, "bun.lock")) || fs47.existsSync(path70.join(projectDir, "bun.lockb"))) {
|
|
239736
239674
|
return "bun";
|
|
239737
239675
|
}
|
|
239738
|
-
if (
|
|
239676
|
+
if (fs47.existsSync(path70.join(projectDir, "pnpm-lock.yaml"))) {
|
|
239739
239677
|
return "pnpm";
|
|
239740
239678
|
}
|
|
239741
|
-
if (
|
|
239679
|
+
if (fs47.existsSync(path70.join(projectDir, "yarn.lock")) || fs47.existsSync(path70.join(projectDir, ".yarnrc.yml"))) {
|
|
239742
239680
|
return "yarn";
|
|
239743
239681
|
}
|
|
239744
239682
|
return "npm";
|
|
@@ -239828,7 +239766,7 @@ function hasExistingWpTypiaProjectSurface(projectDir, packageJson) {
|
|
|
239828
239766
|
path70.join("scripts", "block-config.ts"),
|
|
239829
239767
|
path70.join("scripts", "sync-project.ts"),
|
|
239830
239768
|
path70.join("scripts", "sync-types-to-block-json.ts")
|
|
239831
|
-
].every((relativePath) =>
|
|
239769
|
+
].every((relativePath) => fs47.existsSync(path70.join(projectDir, relativePath)));
|
|
239832
239770
|
const hasRuntimeDeps = typeof getExistingDependencyVersion(packageJson, "@wp-typia/block-runtime") === "string" && typeof getExistingDependencyVersion(packageJson, "@wp-typia/block-types") === "string";
|
|
239833
239771
|
return hasSyncSurface && hasHelperFiles && hasRuntimeDeps;
|
|
239834
239772
|
}
|
|
@@ -239892,11 +239830,83 @@ var init_cli_init_package_json = __esm(() => {
|
|
|
239892
239830
|
];
|
|
239893
239831
|
});
|
|
239894
239832
|
|
|
239833
|
+
// ../wp-typia-project-tools/src/runtime/cli-init-plan-presentation.ts
|
|
239834
|
+
function buildInitPlanChangeSummary(changes, options) {
|
|
239835
|
+
const lines = [];
|
|
239836
|
+
for (const dependencyChange of changes.packageChanges.addDevDependencies) {
|
|
239837
|
+
lines.push(`devDependency ${dependencyChange.action} ${dependencyChange.name} -> ${dependencyChange.requiredValue}`);
|
|
239838
|
+
}
|
|
239839
|
+
if (changes.packageChanges.packageManagerField) {
|
|
239840
|
+
lines.push(`packageManager ${changes.packageChanges.packageManagerField.action} -> ${changes.packageChanges.packageManagerField.requiredValue}`);
|
|
239841
|
+
}
|
|
239842
|
+
for (const scriptChange of changes.packageChanges.scripts) {
|
|
239843
|
+
lines.push(`script ${scriptChange.action} ${scriptChange.name} -> ${scriptChange.requiredValue}`);
|
|
239844
|
+
}
|
|
239845
|
+
for (const filePlan of changes.plannedFiles) {
|
|
239846
|
+
lines.push(`file ${filePlan.action} ${filePlan.path} (${filePlan.purpose})`);
|
|
239847
|
+
}
|
|
239848
|
+
if (options.includeGeneratedArtifacts) {
|
|
239849
|
+
for (const artifactPath of changes.generatedArtifacts) {
|
|
239850
|
+
lines.push(`generated artifact ${artifactPath}`);
|
|
239851
|
+
}
|
|
239852
|
+
}
|
|
239853
|
+
return lines;
|
|
239854
|
+
}
|
|
239855
|
+
function buildInitPlanNextSteps(options) {
|
|
239856
|
+
const cliSpecifier = getWpTypiaCliSpecifier();
|
|
239857
|
+
const syncTypesRun = formatRunScript(options.packageManager, "sync-types");
|
|
239858
|
+
const syncRun = formatRunScript(options.packageManager, "sync");
|
|
239859
|
+
const doctorRun = formatPackageExecCommand(options.packageManager, cliSpecifier, "doctor");
|
|
239860
|
+
const migrationInitRun = formatPackageExecCommand(options.packageManager, cliSpecifier, "migrate init --current-migration-version v1");
|
|
239861
|
+
const dependencyInstallCommand = formatAddDevDependenciesCommand(options.packageManager, buildRequiredDevDependencyMapEntries());
|
|
239862
|
+
if (options.layoutKind === "unsupported") {
|
|
239863
|
+
return [
|
|
239864
|
+
"Align the project to one of the supported retrofit layouts listed below, then rerun `wp-typia init`.",
|
|
239865
|
+
dependencyInstallCommand,
|
|
239866
|
+
syncTypesRun,
|
|
239867
|
+
doctorRun
|
|
239868
|
+
];
|
|
239869
|
+
}
|
|
239870
|
+
if (options.commandMode === "apply") {
|
|
239871
|
+
return [
|
|
239872
|
+
...options.dependencyChangeCount > 0 ? [
|
|
239873
|
+
"Install or reinstall project dependencies so the retrofit sync scripts and metadata generators are available locally.",
|
|
239874
|
+
dependencyInstallCommand
|
|
239875
|
+
] : [],
|
|
239876
|
+
syncRun,
|
|
239877
|
+
doctorRun,
|
|
239878
|
+
`Optional migration bootstrap: ${migrationInitRun}`
|
|
239879
|
+
];
|
|
239880
|
+
}
|
|
239881
|
+
return [
|
|
239882
|
+
...options.hasPlannedChanges ? [
|
|
239883
|
+
"Re-run `wp-typia init --apply` to write the planned package.json changes and helper files automatically.",
|
|
239884
|
+
...options.dependencyChangeCount > 0 ? [dependencyInstallCommand] : []
|
|
239885
|
+
] : [],
|
|
239886
|
+
syncRun,
|
|
239887
|
+
doctorRun,
|
|
239888
|
+
`Optional migration bootstrap: ${migrationInitRun}`
|
|
239889
|
+
];
|
|
239890
|
+
}
|
|
239891
|
+
function buildRetrofitPlanSummary(options) {
|
|
239892
|
+
if (options.status === "already-initialized") {
|
|
239893
|
+
return options.commandMode === "apply" ? "This project already exposes the minimum wp-typia retrofit surface. No files were changed." : "This project already exposes the minimum wp-typia retrofit surface.";
|
|
239894
|
+
}
|
|
239895
|
+
if (options.commandMode === "apply") {
|
|
239896
|
+
return "Applied the minimum wp-typia retrofit surface so package.json and helper scripts are ready for the next install and sync run.";
|
|
239897
|
+
}
|
|
239898
|
+
return "This command previews the minimum wp-typia adoption layer for the current project without rewriting it into a full scaffold.";
|
|
239899
|
+
}
|
|
239900
|
+
var init_cli_init_plan_presentation = __esm(() => {
|
|
239901
|
+
init_package_managers();
|
|
239902
|
+
init_cli_init_package_json();
|
|
239903
|
+
});
|
|
239904
|
+
|
|
239895
239905
|
// ../wp-typia-project-tools/src/runtime/cli-init-types.ts
|
|
239896
239906
|
var SUPPORTED_RETROFIT_LAYOUT_NOTE = "Supported retrofit layouts currently mirror the migration bootstrap detector: `src/block.json` + `src/types.ts` + `src/save.tsx`, legacy root `block.json` + `src/types.ts` + `src/save.tsx`, or multi-block `src/blocks/*/block.json` workspaces.", RETROFIT_APPLY_PREVIEW_NOTE = "If you rerun with `wp-typia init --apply`, package.json and generated helper files are snapshotted and rolled back automatically if a write fails.", RETROFIT_ROLLBACK_NOTE = "Apply mode writes package.json and generated helper files with rollback-on-failure protection.";
|
|
239897
239907
|
|
|
239898
239908
|
// ../wp-typia-project-tools/src/runtime/cli-init-plan.ts
|
|
239899
|
-
import
|
|
239909
|
+
import fs48 from "fs";
|
|
239900
239910
|
import path71 from "path";
|
|
239901
239911
|
import { analyzeSourceTypes } from "@wp-typia/block-runtime/metadata-parser";
|
|
239902
239912
|
function normalizeRelativePath2(value2) {
|
|
@@ -239931,7 +239941,7 @@ function isObjectLikeSourceType(projectDir, typesFile, sourceTypeName) {
|
|
|
239931
239941
|
}
|
|
239932
239942
|
function inferRetrofitAttributeTypeName(projectDir, block) {
|
|
239933
239943
|
const typesPath = path71.join(projectDir, block.typesFile);
|
|
239934
|
-
const typesSource =
|
|
239944
|
+
const typesSource = fs48.readFileSync(typesPath, "utf8");
|
|
239935
239945
|
const blockNameSegments = block.blockName.split("/");
|
|
239936
239946
|
const slug = blockNameSegments[blockNameSegments.length - 1] ?? block.key;
|
|
239937
239947
|
const candidateNames = collectNamedSourceTypeCandidates(typesSource);
|
|
@@ -240023,92 +240033,25 @@ function buildPlannedFiles(projectDir, layoutKind) {
|
|
|
240023
240033
|
}
|
|
240024
240034
|
return [
|
|
240025
240035
|
{
|
|
240026
|
-
action:
|
|
240036
|
+
action: fs48.existsSync(path71.join(projectDir, "scripts", "block-config.ts")) ? "update" : "add",
|
|
240027
240037
|
path: "scripts/block-config.ts",
|
|
240028
240038
|
purpose: "Declare the current retrofit block targets so sync-types can regenerate metadata from the existing TypeScript source of truth."
|
|
240029
240039
|
},
|
|
240030
240040
|
{
|
|
240031
|
-
action:
|
|
240041
|
+
action: fs48.existsSync(path71.join(projectDir, "scripts", "sync-types-to-block-json.ts")) ? "update" : "add",
|
|
240032
240042
|
path: "scripts/sync-types-to-block-json.ts",
|
|
240033
240043
|
purpose: "Generate block.json and Typia metadata artifacts from the current TypeScript source of truth."
|
|
240034
240044
|
},
|
|
240035
240045
|
{
|
|
240036
|
-
action:
|
|
240046
|
+
action: fs48.existsSync(path71.join(projectDir, "scripts", "sync-project.ts")) ? "update" : "add",
|
|
240037
240047
|
path: "scripts/sync-project.ts",
|
|
240038
240048
|
purpose: "Provide one shared sync entrypoint that can grow into sync-rest or workspace-aware refresh steps later."
|
|
240039
240049
|
}
|
|
240040
240050
|
];
|
|
240041
240051
|
}
|
|
240042
|
-
function buildChangeSummary(changes, options) {
|
|
240043
|
-
const lines = [];
|
|
240044
|
-
for (const dependencyChange of changes.packageChanges.addDevDependencies) {
|
|
240045
|
-
lines.push(`devDependency ${dependencyChange.action} ${dependencyChange.name} -> ${dependencyChange.requiredValue}`);
|
|
240046
|
-
}
|
|
240047
|
-
if (changes.packageChanges.packageManagerField) {
|
|
240048
|
-
lines.push(`packageManager ${changes.packageChanges.packageManagerField.action} -> ${changes.packageChanges.packageManagerField.requiredValue}`);
|
|
240049
|
-
}
|
|
240050
|
-
for (const scriptChange of changes.packageChanges.scripts) {
|
|
240051
|
-
lines.push(`script ${scriptChange.action} ${scriptChange.name} -> ${scriptChange.requiredValue}`);
|
|
240052
|
-
}
|
|
240053
|
-
for (const filePlan of changes.plannedFiles) {
|
|
240054
|
-
lines.push(`file ${filePlan.action} ${filePlan.path} (${filePlan.purpose})`);
|
|
240055
|
-
}
|
|
240056
|
-
if (options.includeGeneratedArtifacts) {
|
|
240057
|
-
for (const artifactPath of changes.generatedArtifacts) {
|
|
240058
|
-
lines.push(`generated artifact ${artifactPath}`);
|
|
240059
|
-
}
|
|
240060
|
-
}
|
|
240061
|
-
return lines;
|
|
240062
|
-
}
|
|
240063
|
-
function buildNextSteps(options) {
|
|
240064
|
-
const cliSpecifier = getWpTypiaCliSpecifier();
|
|
240065
|
-
const syncTypesRun = formatRunScript(options.packageManager, "sync-types");
|
|
240066
|
-
const syncRun = formatRunScript(options.packageManager, "sync");
|
|
240067
|
-
const doctorRun = formatPackageExecCommand(options.packageManager, cliSpecifier, "doctor");
|
|
240068
|
-
const migrationInitRun = formatPackageExecCommand(options.packageManager, cliSpecifier, "migrate init --current-migration-version v1");
|
|
240069
|
-
const dependencyInstallCommand = formatAddDevDependenciesCommand(options.packageManager, buildRequiredDevDependencyMapEntries());
|
|
240070
|
-
if (options.layoutKind === "unsupported") {
|
|
240071
|
-
return [
|
|
240072
|
-
"Align the project to one of the supported retrofit layouts listed below, then rerun `wp-typia init`.",
|
|
240073
|
-
dependencyInstallCommand,
|
|
240074
|
-
syncTypesRun,
|
|
240075
|
-
doctorRun
|
|
240076
|
-
];
|
|
240077
|
-
}
|
|
240078
|
-
if (options.commandMode === "apply") {
|
|
240079
|
-
return [
|
|
240080
|
-
...options.dependencyChangeCount > 0 ? [
|
|
240081
|
-
"Install or reinstall project dependencies so the retrofit sync scripts and metadata generators are available locally.",
|
|
240082
|
-
dependencyInstallCommand
|
|
240083
|
-
] : [],
|
|
240084
|
-
syncRun,
|
|
240085
|
-
doctorRun,
|
|
240086
|
-
`Optional migration bootstrap: ${migrationInitRun}`
|
|
240087
|
-
];
|
|
240088
|
-
}
|
|
240089
|
-
const steps = [
|
|
240090
|
-
...options.hasPlannedChanges ? [
|
|
240091
|
-
"Re-run `wp-typia init --apply` to write the planned package.json changes and helper files automatically.",
|
|
240092
|
-
...options.dependencyChangeCount > 0 ? [dependencyInstallCommand] : []
|
|
240093
|
-
] : [],
|
|
240094
|
-
syncRun,
|
|
240095
|
-
doctorRun,
|
|
240096
|
-
`Optional migration bootstrap: ${migrationInitRun}`
|
|
240097
|
-
];
|
|
240098
|
-
return steps;
|
|
240099
|
-
}
|
|
240100
|
-
function buildRetrofitPlanSummary(options) {
|
|
240101
|
-
if (options.status === "already-initialized") {
|
|
240102
|
-
return options.commandMode === "apply" ? "This project already exposes the minimum wp-typia retrofit surface. No files were changed." : "This project already exposes the minimum wp-typia retrofit surface.";
|
|
240103
|
-
}
|
|
240104
|
-
if (options.commandMode === "apply") {
|
|
240105
|
-
return "Applied the minimum wp-typia retrofit surface so package.json and helper scripts are ready for the next install and sync run.";
|
|
240106
|
-
}
|
|
240107
|
-
return "This command previews the minimum wp-typia adoption layer for the current project without rewriting it into a full scaffold.";
|
|
240108
|
-
}
|
|
240109
240052
|
function createRetrofitPlan(options) {
|
|
240110
240053
|
const includeGeneratedArtifacts = options.commandMode === "preview-only";
|
|
240111
|
-
const plannedChanges =
|
|
240054
|
+
const plannedChanges = buildInitPlanChangeSummary({
|
|
240112
240055
|
generatedArtifacts: options.generatedArtifacts,
|
|
240113
240056
|
packageChanges: options.packageChanges,
|
|
240114
240057
|
plannedFiles: options.plannedFiles
|
|
@@ -240120,7 +240063,7 @@ function createRetrofitPlan(options) {
|
|
|
240120
240063
|
commandMode: options.commandMode,
|
|
240121
240064
|
detectedLayout: options.detectedLayout,
|
|
240122
240065
|
generatedArtifacts: options.generatedArtifacts,
|
|
240123
|
-
nextSteps: options.nextSteps ??
|
|
240066
|
+
nextSteps: options.nextSteps ?? buildInitPlanNextSteps({
|
|
240124
240067
|
commandMode: options.commandMode,
|
|
240125
240068
|
dependencyChangeCount: options.packageChanges.addDevDependencies.length,
|
|
240126
240069
|
hasPlannedChanges: plannedChanges.length > 0,
|
|
@@ -240225,6 +240168,7 @@ var init_cli_init_plan = __esm(() => {
|
|
|
240225
240168
|
init_package_managers();
|
|
240226
240169
|
init_string_case();
|
|
240227
240170
|
init_cli_init_package_json();
|
|
240171
|
+
init_cli_init_plan_presentation();
|
|
240228
240172
|
init_workspace_project();
|
|
240229
240173
|
import_typescript3 = __toESM(require_typescript(), 1);
|
|
240230
240174
|
});
|
|
@@ -240459,12 +240403,12 @@ var init_cli_init_templates = __esm(() => {
|
|
|
240459
240403
|
});
|
|
240460
240404
|
|
|
240461
240405
|
// ../wp-typia-project-tools/src/runtime/cli-init-apply.ts
|
|
240462
|
-
import
|
|
240406
|
+
import fs49 from "fs";
|
|
240463
240407
|
import { promises as fsp27 } from "fs";
|
|
240464
240408
|
import path73 from "path";
|
|
240465
240409
|
async function createRetrofitMutationSnapshot(projectDir, filePaths) {
|
|
240466
240410
|
const scriptsDir = path73.join(projectDir, "scripts");
|
|
240467
|
-
const scriptsDirExisted =
|
|
240411
|
+
const scriptsDirExisted = fs49.existsSync(scriptsDir);
|
|
240468
240412
|
const fileSources = await snapshotWorkspaceFiles(filePaths);
|
|
240469
240413
|
const targetPaths = fileSources.filter((entry) => entry.source === null).map((entry) => entry.filePath);
|
|
240470
240414
|
if (!scriptsDirExisted) {
|
|
@@ -240573,7 +240517,7 @@ __export(exports_cli_scaffold, {
|
|
|
240573
240517
|
getOptionalOnboarding: () => getOptionalOnboarding,
|
|
240574
240518
|
getNextSteps: () => getNextSteps
|
|
240575
240519
|
});
|
|
240576
|
-
import
|
|
240520
|
+
import fs50 from "fs";
|
|
240577
240521
|
import { promises as fsp28 } from "fs";
|
|
240578
240522
|
import path74 from "path";
|
|
240579
240523
|
async function listRelativeProjectFiles(rootDir) {
|
|
@@ -240593,7 +240537,7 @@ async function listRelativeProjectFiles(rootDir) {
|
|
|
240593
240537
|
return relativeFiles.sort((left, right) => left.localeCompare(right));
|
|
240594
240538
|
}
|
|
240595
240539
|
async function assertDryRunTargetDirectoryReady(projectDir, allowExistingDir) {
|
|
240596
|
-
if (!
|
|
240540
|
+
if (!fs50.existsSync(projectDir) || allowExistingDir) {
|
|
240597
240541
|
return;
|
|
240598
240542
|
}
|
|
240599
240543
|
const entries = await fsp28.readdir(projectDir);
|
|
@@ -241038,7 +240982,7 @@ async function runScaffoldFlow({
|
|
|
241038
240982
|
let availableScripts;
|
|
241039
240983
|
if (!dryRun) {
|
|
241040
240984
|
try {
|
|
241041
|
-
const parsedPackageJson = JSON.parse(
|
|
240985
|
+
const parsedPackageJson = JSON.parse(fs50.readFileSync(path74.join(projectDir, "package.json"), "utf8"));
|
|
241042
240986
|
const scripts = parsedPackageJson.scripts && typeof parsedPackageJson.scripts === "object" && !Array.isArray(parsedPackageJson.scripts) ? parsedPackageJson.scripts : {};
|
|
241043
240987
|
availableScripts = Object.entries(scripts).filter(([, value2]) => typeof value2 === "string").map(([scriptName]) => scriptName);
|
|
241044
240988
|
} catch {
|
|
@@ -295008,7 +294952,7 @@ async function simulateWorkspaceAddDryRun({
|
|
|
295008
294952
|
// package.json
|
|
295009
294953
|
var package_default2 = {
|
|
295010
294954
|
name: "wp-typia",
|
|
295011
|
-
version: "0.22.
|
|
294955
|
+
version: "0.22.7",
|
|
295012
294956
|
description: "Canonical CLI package for wp-typia scaffolding and project workflows",
|
|
295013
294957
|
packageManager: "bun@1.3.11",
|
|
295014
294958
|
type: "module",
|
|
@@ -295078,7 +295022,7 @@ var package_default2 = {
|
|
|
295078
295022
|
"@bunli/tui": "0.6.0",
|
|
295079
295023
|
"@bunli/utils": "0.6.0",
|
|
295080
295024
|
"@wp-typia/api-client": "^0.4.5",
|
|
295081
|
-
"@wp-typia/project-tools": "0.22.
|
|
295025
|
+
"@wp-typia/project-tools": "0.22.7",
|
|
295082
295026
|
"better-result": "^2.7.0",
|
|
295083
295027
|
react: "^19.2.5",
|
|
295084
295028
|
"react-dom": "^19.2.5",
|
|
@@ -296643,7 +296587,7 @@ var init_default = initCommand;
|
|
|
296643
296587
|
init_cli_diagnostics();
|
|
296644
296588
|
|
|
296645
296589
|
// src/mcp.ts
|
|
296646
|
-
import
|
|
296590
|
+
import fs51 from "fs/promises";
|
|
296647
296591
|
import path75 from "path";
|
|
296648
296592
|
|
|
296649
296593
|
// ../../node_modules/.bun/@bunli+plugin-mcp@0.2.5+ef72ce197b058209/node_modules/@bunli/plugin-mcp/src/errors.ts
|
|
@@ -297173,7 +297117,7 @@ function isToolGroup(value2) {
|
|
|
297173
297117
|
}
|
|
297174
297118
|
async function readSchemaSource(cwd, source) {
|
|
297175
297119
|
const schemaPath = path75.resolve(cwd, source.path);
|
|
297176
|
-
const raw = await
|
|
297120
|
+
const raw = await fs51.readFile(schemaPath, "utf8");
|
|
297177
297121
|
const parsed = JSON.parse(raw);
|
|
297178
297122
|
if (isToolGroup(parsed)) {
|
|
297179
297123
|
return parsed;
|
|
@@ -297211,8 +297155,8 @@ async function syncMcpSchemas(cwd, schemaSources, outputDir = path75.join(cwd, "
|
|
|
297211
297155
|
throw convert.error;
|
|
297212
297156
|
}
|
|
297213
297157
|
}
|
|
297214
|
-
await
|
|
297215
|
-
await
|
|
297158
|
+
await fs51.mkdir(outputDir, { recursive: true });
|
|
297159
|
+
await fs51.writeFile(path75.join(outputDir, "registry.json"), `${JSON.stringify(registry2, null, 2)}
|
|
297216
297160
|
`, "utf8");
|
|
297217
297161
|
return {
|
|
297218
297162
|
commandCount: registry2.reduce((count, group) => count + group.tools.length, 0),
|
|
@@ -297531,4 +297475,4 @@ export {
|
|
|
297531
297475
|
cli
|
|
297532
297476
|
};
|
|
297533
297477
|
|
|
297534
|
-
//# debugId=
|
|
297478
|
+
//# debugId=2EE58DC8E78CAD3164756E2164756E21
|