wp-typia 0.22.5 → 0.22.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist-bunli/.bunli/commands.gen.js +1820 -1020
- package/dist-bunli/{cli-xbzfx7qz.js → cli-0q0tz4dq.js} +4 -4
- package/dist-bunli/{cli-hb9vpsev.js → cli-2rqf6t0b.js} +1 -1
- package/dist-bunli/{cli-6bhfzq5e.js → cli-52ke0ptp.js} +2 -2
- package/dist-bunli/{cli-j30rk466.js → cli-5kn2p7ee.js} +693 -259
- package/dist-bunli/{cli-ctddkm3n.js → cli-6a65qfb1.js} +475 -249
- package/dist-bunli/{cli-add-1gqgshf0.js → cli-add-5vmxpgmn.js} +84 -62
- package/dist-bunli/{cli-doctor-w35s8y9w.js → cli-doctor-ngzs8kkc.js} +15 -18
- package/dist-bunli/{cli-nzwpmw4y.js → cli-f44sphgv.js} +98 -32
- package/dist-bunli/cli-fys8vm2t.js +20 -0
- package/dist-bunli/{cli-btbpt84c.js → cli-hhp1d348.js} +1 -1
- package/dist-bunli/{cli-init-z8sjmkvc.js → cli-init-df1wg71p.js} +421 -401
- package/dist-bunli/{cli-scaffold-ad3bd555.js → cli-scaffold-btx3wfsn.js} +8 -7
- package/dist-bunli/cli.js +8 -6
- package/dist-bunli/{command-list-scd6zqp8.js → command-list-bqr2tp8w.js} +16 -12
- package/dist-bunli/{migrations-skkzdvhm.js → migrations-bnrjw4k1.js} +7 -6
- package/dist-bunli/node-cli.js +253 -97
- package/dist-bunli/{workspace-project-7826tewa.js → workspace-project-csnnggz6.js} +2 -2
- package/package.json +2 -2
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
parseAlternateRenderTargets,
|
|
12
12
|
parseCompoundInnerBlocksPreset,
|
|
13
13
|
parseTemplateLocator,
|
|
14
|
+
pathExists,
|
|
14
15
|
renderScaffoldCompatibilityConfig,
|
|
15
16
|
require_semver,
|
|
16
17
|
resolveExternalTemplateLayers,
|
|
@@ -21,7 +22,7 @@ import {
|
|
|
21
22
|
scaffoldProject,
|
|
22
23
|
syncPersistenceRestArtifacts,
|
|
23
24
|
updatePluginHeaderCompatibility
|
|
24
|
-
} from "./cli-
|
|
25
|
+
} from "./cli-6a65qfb1.js";
|
|
25
26
|
import {
|
|
26
27
|
DEFAULT_WORDPRESS_ABILITIES_VERSION,
|
|
27
28
|
DEFAULT_WORDPRESS_CORE_ABILITIES_VERSION,
|
|
@@ -34,13 +35,13 @@ import {
|
|
|
34
35
|
} from "./cli-1sm60g1z.js";
|
|
35
36
|
import {
|
|
36
37
|
snapshotProjectVersion
|
|
37
|
-
} from "./cli-
|
|
38
|
+
} from "./cli-0q0tz4dq.js";
|
|
38
39
|
import {
|
|
39
40
|
ensureMigrationDirectories,
|
|
40
41
|
parseMigrationConfig,
|
|
41
42
|
writeInitialMigrationScaffold,
|
|
42
43
|
writeMigrationConfig
|
|
43
|
-
} from "./cli-
|
|
44
|
+
} from "./cli-2rqf6t0b.js";
|
|
44
45
|
import"./cli-bq2v559b.js";
|
|
45
46
|
import {
|
|
46
47
|
findExecutablePatternMatch,
|
|
@@ -54,7 +55,6 @@ import {
|
|
|
54
55
|
} from "./cli-tke8twkn.js";
|
|
55
56
|
import {
|
|
56
57
|
ADD_BLOCK_TEMPLATE_IDS,
|
|
57
|
-
ADD_KIND_IDS,
|
|
58
58
|
EDITOR_PLUGIN_SLOT_IDS,
|
|
59
59
|
appendWorkspaceInventoryEntries,
|
|
60
60
|
assertAbilityDoesNotExist,
|
|
@@ -79,6 +79,7 @@ import {
|
|
|
79
79
|
getMutableBlockHooks,
|
|
80
80
|
getWorkspaceBlockSelectOptions,
|
|
81
81
|
getWorkspaceBootstrapPath,
|
|
82
|
+
hasPhpFunctionCall,
|
|
82
83
|
hasPhpFunctionDefinition,
|
|
83
84
|
isAddBlockTemplateId,
|
|
84
85
|
normalizeBlockSlug,
|
|
@@ -100,26 +101,25 @@ import {
|
|
|
100
101
|
toPascalCase,
|
|
101
102
|
toSnakeCase,
|
|
102
103
|
toTitleCase
|
|
103
|
-
} from "./cli-
|
|
104
|
+
} from "./cli-5kn2p7ee.js";
|
|
104
105
|
import {
|
|
105
106
|
createManagedTempRoot
|
|
106
107
|
} from "./cli-t73q5aqz.js";
|
|
107
108
|
import {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
ADD_KIND_IDS
|
|
110
|
+
} from "./cli-fys8vm2t.js";
|
|
111
|
+
import"./cli-p95wr1q8.js";
|
|
111
112
|
import {
|
|
112
113
|
resolveWorkspaceProject
|
|
113
|
-
} from "./cli-
|
|
114
|
+
} from "./cli-hhp1d348.js";
|
|
114
115
|
import {
|
|
115
116
|
formatInstallCommand
|
|
116
|
-
} from "./cli-
|
|
117
|
+
} from "./cli-52ke0ptp.js";
|
|
117
118
|
import {
|
|
118
119
|
__reExport,
|
|
119
120
|
__toESM
|
|
120
121
|
} from "./cli-xnn9xjcy.js";
|
|
121
122
|
// ../wp-typia-project-tools/src/runtime/cli-add-block.ts
|
|
122
|
-
import fs2 from "fs";
|
|
123
123
|
import { promises as fsp2 } from "fs";
|
|
124
124
|
import path3 from "path";
|
|
125
125
|
import {
|
|
@@ -485,11 +485,16 @@ async function renderWorkspacePersistenceServerModule(projectDir, variables) {
|
|
|
485
485
|
const templateDir = buildServerTemplateRoot(variables.persistencePolicy);
|
|
486
486
|
await copyInterpolatedDirectory(templateDir, targetDir, variables);
|
|
487
487
|
}
|
|
488
|
-
function hasInstalledWorkspaceDependencies(projectDir) {
|
|
489
|
-
|
|
488
|
+
async function hasInstalledWorkspaceDependencies(projectDir) {
|
|
489
|
+
for (const marker of WORKSPACE_INSTALL_MARKERS) {
|
|
490
|
+
if (await pathExists(path3.join(projectDir, marker))) {
|
|
491
|
+
return true;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
return false;
|
|
490
495
|
}
|
|
491
|
-
function assertWorkspaceDependenciesInstalled(workspace) {
|
|
492
|
-
if (hasInstalledWorkspaceDependencies(workspace.projectDir)) {
|
|
496
|
+
async function assertWorkspaceDependenciesInstalled(workspace) {
|
|
497
|
+
if (await hasInstalledWorkspaceDependencies(workspace.projectDir)) {
|
|
493
498
|
return;
|
|
494
499
|
}
|
|
495
500
|
throw new Error(`Workspace dependencies have not been installed yet. Run \`${formatInstallCommand(workspace.packageManager)}\` from the workspace root before using \`wp-typia add block ...\`.`);
|
|
@@ -561,19 +566,19 @@ function collectWorkspaceBlockPaths(projectDir, templateId, variables) {
|
|
|
561
566
|
}
|
|
562
567
|
return [path3.join(projectDir, "src", "blocks", variables.slugKebabCase)];
|
|
563
568
|
}
|
|
564
|
-
function assertBlockTargetsDoNotExist(projectDir, templateId, variables) {
|
|
569
|
+
async function assertBlockTargetsDoNotExist(projectDir, templateId, variables) {
|
|
565
570
|
for (const targetPath of collectWorkspaceBlockPaths(projectDir, templateId, variables)) {
|
|
566
|
-
if (
|
|
571
|
+
if (await pathExists(targetPath)) {
|
|
567
572
|
throw new Error(`A block already exists at ${path3.relative(projectDir, targetPath)}. Choose a different name.`);
|
|
568
573
|
}
|
|
569
574
|
}
|
|
570
575
|
}
|
|
571
576
|
async function updateWorkspaceMigrationConfigIfPresent(projectDir, newBlocks) {
|
|
572
577
|
const configPath = path3.join(projectDir, "src", "migrations", "config.ts");
|
|
573
|
-
|
|
578
|
+
const configSource = await readOptionalFile(configPath);
|
|
579
|
+
if (configSource === null) {
|
|
574
580
|
return;
|
|
575
581
|
}
|
|
576
|
-
const configSource = await fsp2.readFile(configPath, "utf8");
|
|
577
582
|
const config = parseMigrationConfig(configSource);
|
|
578
583
|
const existingBlocks = Array.isArray(config.blocks) ? config.blocks : [];
|
|
579
584
|
const nextBlocks = [
|
|
@@ -682,7 +687,7 @@ async function runAddBlockCommand({
|
|
|
682
687
|
assertCompoundInnerBlocksPresetAllowed(resolvedTemplateId, innerBlocksPreset);
|
|
683
688
|
const resolvedInnerBlocksPreset = parseCompoundInnerBlocksPreset(innerBlocksPreset);
|
|
684
689
|
const workspace = resolveWorkspaceProject(cwd);
|
|
685
|
-
assertWorkspaceDependenciesInstalled(workspace);
|
|
690
|
+
await assertWorkspaceDependenciesInstalled(workspace);
|
|
686
691
|
const normalizedExternalLayerId = normalizeOptionalCliString(externalLayerId);
|
|
687
692
|
const normalizedExternalLayerSource = resolveLocalCliPathOption({
|
|
688
693
|
cwd,
|
|
@@ -753,7 +758,7 @@ async function runAddBlockCommand({
|
|
|
753
758
|
});
|
|
754
759
|
return scaffoldResult;
|
|
755
760
|
})();
|
|
756
|
-
assertBlockTargetsDoNotExist(workspace.projectDir, resolvedTemplateId, result.variables);
|
|
761
|
+
await assertBlockTargetsDoNotExist(workspace.projectDir, resolvedTemplateId, result.variables);
|
|
757
762
|
const mutationSnapshot = {
|
|
758
763
|
fileSources: await snapshotWorkspaceFiles([
|
|
759
764
|
blockConfigPath,
|
|
@@ -789,7 +794,7 @@ async function runAddBlockCommand({
|
|
|
789
794
|
}
|
|
790
795
|
}
|
|
791
796
|
// ../wp-typia-project-tools/src/runtime/cli-add-workspace.ts
|
|
792
|
-
import
|
|
797
|
+
import fs5 from "fs";
|
|
793
798
|
import { promises as fsp9 } from "fs";
|
|
794
799
|
import path14 from "path";
|
|
795
800
|
|
|
@@ -808,8 +813,6 @@ var ADMIN_VIEWS_ASSET = "build/admin-views/index.asset.php";
|
|
|
808
813
|
var ADMIN_VIEWS_STYLE = "build/admin-views/style-index.css";
|
|
809
814
|
var ADMIN_VIEWS_STYLE_RTL = "build/admin-views/style-index-rtl.css";
|
|
810
815
|
var ADMIN_VIEWS_PHP_GLOB = "/inc/admin-views/*.php";
|
|
811
|
-
var ADMIN_VIEW_ALLOW_UNPUBLISHED_DATAVIEWS_ENV = "WP_TYPIA_ALLOW_UNPUBLISHED_DATAVIEWS";
|
|
812
|
-
var ADMIN_VIEW_PUBLIC_INSTALLS_ENABLED = false;
|
|
813
816
|
function isAdminViewCoreDataSource(source) {
|
|
814
817
|
return source?.kind === ADMIN_VIEW_CORE_DATA_SOURCE_KIND;
|
|
815
818
|
}
|
|
@@ -824,14 +827,8 @@ function formatAdminViewSourceLocator(source) {
|
|
|
824
827
|
}
|
|
825
828
|
|
|
826
829
|
// ../wp-typia-project-tools/src/runtime/cli-add-workspace-admin-view-source.ts
|
|
827
|
-
function isAdminViewUnpublishedDataViewsOverrideEnabled() {
|
|
828
|
-
return process.env[ADMIN_VIEW_ALLOW_UNPUBLISHED_DATAVIEWS_ENV]?.trim() === "1";
|
|
829
|
-
}
|
|
830
830
|
function assertAdminViewPackageAvailability() {
|
|
831
|
-
|
|
832
|
-
return;
|
|
833
|
-
}
|
|
834
|
-
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, "`wp-typia add admin-view` is temporarily unavailable because `@wp-typia/dataviews` is not published to npm for public installs yet.");
|
|
831
|
+
return;
|
|
835
832
|
}
|
|
836
833
|
function assertValidCoreDataEntitySegment(label, value) {
|
|
837
834
|
const trimmed = value.trim();
|
|
@@ -908,7 +905,7 @@ function resolveAdminViewCoreDataSource(source) {
|
|
|
908
905
|
}
|
|
909
906
|
|
|
910
907
|
// ../wp-typia-project-tools/src/runtime/cli-add-workspace-admin-view-scaffold.ts
|
|
911
|
-
import
|
|
908
|
+
import fs2 from "fs";
|
|
912
909
|
import { promises as fsp3 } from "fs";
|
|
913
910
|
import path5 from "path";
|
|
914
911
|
|
|
@@ -2094,13 +2091,13 @@ function resolveAdminViewRegistryPath(projectDir) {
|
|
|
2094
2091
|
return [
|
|
2095
2092
|
path5.join(adminViewsDir, "index.ts"),
|
|
2096
2093
|
path5.join(adminViewsDir, "index.js")
|
|
2097
|
-
].find((candidatePath) =>
|
|
2094
|
+
].find((candidatePath) => fs2.existsSync(candidatePath)) ?? path5.join(adminViewsDir, "index.ts");
|
|
2098
2095
|
}
|
|
2099
2096
|
function readAdminViewRegistrySlugs(registryPath) {
|
|
2100
|
-
if (!
|
|
2097
|
+
if (!fs2.existsSync(registryPath)) {
|
|
2101
2098
|
return [];
|
|
2102
2099
|
}
|
|
2103
|
-
const source =
|
|
2100
|
+
const source = fs2.readFileSync(registryPath, "utf8");
|
|
2104
2101
|
return Array.from(source.matchAll(/^\s*import\s+['"]\.\/([^/'"]+)(?:\/index(?:\.[cm]?[jt]sx?)?)?['"];?\s*$/gmu)).map((match) => match[1]);
|
|
2105
2102
|
}
|
|
2106
2103
|
async function writeAdminViewRegistry(projectDir, adminViewSlug) {
|
|
@@ -2196,7 +2193,7 @@ async function runAddAdminViewCommand({
|
|
|
2196
2193
|
}
|
|
2197
2194
|
// ../wp-typia-project-tools/src/runtime/cli-add-workspace-assets.ts
|
|
2198
2195
|
var import_typescript = __toESM(require_typescript(), 1);
|
|
2199
|
-
import
|
|
2196
|
+
import fs3 from "fs";
|
|
2200
2197
|
import { promises as fsp4 } from "fs";
|
|
2201
2198
|
import path6 from "path";
|
|
2202
2199
|
import {
|
|
@@ -2936,13 +2933,13 @@ async function ensureEditorPluginWebpackAnchors(workspace) {
|
|
|
2936
2933
|
}
|
|
2937
2934
|
function resolveBindingSourceRegistryPath(projectDir) {
|
|
2938
2935
|
const bindingsDir = path6.join(projectDir, "src", "bindings");
|
|
2939
|
-
return [path6.join(bindingsDir, "index.ts"), path6.join(bindingsDir, "index.js")].find((candidatePath) =>
|
|
2936
|
+
return [path6.join(bindingsDir, "index.ts"), path6.join(bindingsDir, "index.js")].find((candidatePath) => fs3.existsSync(candidatePath)) ?? path6.join(bindingsDir, "index.ts");
|
|
2940
2937
|
}
|
|
2941
2938
|
async function writeBindingSourceRegistry(projectDir, bindingSourceSlug) {
|
|
2942
2939
|
const bindingsDir = path6.join(projectDir, "src", "bindings");
|
|
2943
2940
|
const bindingsIndexPath = resolveBindingSourceRegistryPath(projectDir);
|
|
2944
2941
|
await fsp4.mkdir(bindingsDir, { recursive: true });
|
|
2945
|
-
const existingBindingSourceSlugs =
|
|
2942
|
+
const existingBindingSourceSlugs = fs3.readdirSync(bindingsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
2946
2943
|
const nextBindingSourceSlugs = Array.from(new Set([...existingBindingSourceSlugs, bindingSourceSlug])).sort();
|
|
2947
2944
|
await fsp4.writeFile(bindingsIndexPath, buildBindingSourceIndexSource(nextBindingSourceSlugs), "utf8");
|
|
2948
2945
|
}
|
|
@@ -2951,13 +2948,13 @@ function resolveEditorPluginRegistryPath(projectDir) {
|
|
|
2951
2948
|
return [
|
|
2952
2949
|
path6.join(editorPluginsDir, "index.ts"),
|
|
2953
2950
|
path6.join(editorPluginsDir, "index.js")
|
|
2954
|
-
].find((candidatePath) =>
|
|
2951
|
+
].find((candidatePath) => fs3.existsSync(candidatePath)) ?? path6.join(editorPluginsDir, "index.ts");
|
|
2955
2952
|
}
|
|
2956
2953
|
function readEditorPluginRegistrySlugs(registryPath) {
|
|
2957
|
-
if (!
|
|
2954
|
+
if (!fs3.existsSync(registryPath)) {
|
|
2958
2955
|
return [];
|
|
2959
2956
|
}
|
|
2960
|
-
const source =
|
|
2957
|
+
const source = fs3.readFileSync(registryPath, "utf8");
|
|
2961
2958
|
return Array.from(source.matchAll(/^\s*import\s+['"]\.\/([^/'"]+)(?:\/index(?:\.[cm]?[jt]sx?)?)?['"];?\s*$/gmu)).map((match) => match[1]);
|
|
2962
2959
|
}
|
|
2963
2960
|
async function writeEditorPluginRegistry(projectDir, editorPluginSlug) {
|
|
@@ -4324,7 +4321,7 @@ async function runAddRestResourceCommand({
|
|
|
4324
4321
|
}
|
|
4325
4322
|
// ../wp-typia-project-tools/src/runtime/cli-add-workspace-ability-scaffold.ts
|
|
4326
4323
|
var import_semver = __toESM(require_semver(), 1);
|
|
4327
|
-
import
|
|
4324
|
+
import fs4 from "fs";
|
|
4328
4325
|
import { promises as fsp6 } from "fs";
|
|
4329
4326
|
import path10 from "path";
|
|
4330
4327
|
import { syncTypeSchemas as syncTypeSchemas2 } from "@wp-typia/block-runtime/metadata-core";
|
|
@@ -4818,13 +4815,13 @@ function resolveManagedDependencyVersion(existingVersion, requiredVersion) {
|
|
|
4818
4815
|
}
|
|
4819
4816
|
function resolveAbilityRegistryPath(projectDir) {
|
|
4820
4817
|
const abilitiesDir = path10.join(projectDir, "src", "abilities");
|
|
4821
|
-
return [path10.join(abilitiesDir, "index.ts"), path10.join(abilitiesDir, "index.js")].find((candidatePath) =>
|
|
4818
|
+
return [path10.join(abilitiesDir, "index.ts"), path10.join(abilitiesDir, "index.js")].find((candidatePath) => fs4.existsSync(candidatePath)) ?? path10.join(abilitiesDir, "index.ts");
|
|
4822
4819
|
}
|
|
4823
4820
|
function readAbilityRegistrySlugs(registryPath) {
|
|
4824
|
-
if (!
|
|
4821
|
+
if (!fs4.existsSync(registryPath)) {
|
|
4825
4822
|
return [];
|
|
4826
4823
|
}
|
|
4827
|
-
const source =
|
|
4824
|
+
const source = fs4.readFileSync(registryPath, "utf8");
|
|
4828
4825
|
return Array.from(source.matchAll(/^\s*export\s+\*\s+from\s+['"]\.\/([^/'"]+)\/client['"];?\s*$/gmu)).map((match) => match[1]);
|
|
4829
4826
|
}
|
|
4830
4827
|
async function writeAbilityRegistry(projectDir, abilitySlug) {
|
|
@@ -4835,7 +4832,7 @@ async function writeAbilityRegistry(projectDir, abilitySlug) {
|
|
|
4835
4832
|
const existingRegistrySlugs = readAbilityRegistrySlugs(registryPath);
|
|
4836
4833
|
const nextAbilitySlugs = Array.from(new Set([...existingAbilitySlugs, ...existingRegistrySlugs, abilitySlug])).sort();
|
|
4837
4834
|
const generatedSection = buildAbilityRegistrySource(nextAbilitySlugs);
|
|
4838
|
-
const existingSource =
|
|
4835
|
+
const existingSource = fs4.existsSync(registryPath) ? fs4.readFileSync(registryPath, "utf8") : "";
|
|
4839
4836
|
const generatedSectionPattern = new RegExp(`${escapeRegex(ABILITY_REGISTRY_START_MARKER)}[\\s\\S]*?${escapeRegex(ABILITY_REGISTRY_END_MARKER)}\\n?`, "u");
|
|
4840
4837
|
const nextSource = existingSource ? generatedSectionPattern.test(existingSource) ? existingSource.replace(generatedSectionPattern, generatedSection) : `${existingSource.trimEnd()}
|
|
4841
4838
|
|
|
@@ -4916,8 +4913,16 @@ function ${enqueueFunctionName}() {
|
|
|
4916
4913
|
}
|
|
4917
4914
|
if (!hasPhpFunctionDefinition(nextSource, enqueueFunctionName)) {
|
|
4918
4915
|
nextSource = insertPhpSnippetBeforeWorkspaceAnchors(nextSource, enqueueFunction);
|
|
4919
|
-
} else
|
|
4920
|
-
|
|
4916
|
+
} else {
|
|
4917
|
+
const functionRange = findPhpFunctionRange(nextSource, enqueueFunctionName);
|
|
4918
|
+
const functionSource = functionRange ? nextSource.slice(functionRange.start, functionRange.end) : "";
|
|
4919
|
+
if (!hasPhpFunctionCall(functionSource, "wp_enqueue_script_module")) {
|
|
4920
|
+
const replacedSource = replacePhpFunctionDefinition(nextSource, enqueueFunctionName, enqueueFunction, { trimReplacementStart: true });
|
|
4921
|
+
if (!replacedSource) {
|
|
4922
|
+
throw new Error(`Unable to repair ${path10.basename(bootstrapPath)} for ${enqueueFunctionName}.`);
|
|
4923
|
+
}
|
|
4924
|
+
nextSource = replacedSource;
|
|
4925
|
+
}
|
|
4921
4926
|
}
|
|
4922
4927
|
if (!nextSource.includes(loadHook)) {
|
|
4923
4928
|
nextSource = appendPhpSnippetBeforeClosingTag(nextSource, loadHook);
|
|
@@ -5088,6 +5093,7 @@ async function scaffoldAbilityWorkspace({
|
|
|
5088
5093
|
compatibilityPolicy,
|
|
5089
5094
|
workspace
|
|
5090
5095
|
}) {
|
|
5096
|
+
const compatibilityWarnings = [];
|
|
5091
5097
|
const blockConfigPath = path10.join(workspace.projectDir, "scripts", "block-config.ts");
|
|
5092
5098
|
const bootstrapPath = getWorkspaceBootstrapPath(workspace);
|
|
5093
5099
|
const buildScriptPath = path10.join(workspace.projectDir, "scripts", "build-workspace.mjs");
|
|
@@ -5118,7 +5124,11 @@ async function scaffoldAbilityWorkspace({
|
|
|
5118
5124
|
await fsp6.mkdir(abilityDir, { recursive: true });
|
|
5119
5125
|
await fsp6.mkdir(path10.dirname(phpFilePath), { recursive: true });
|
|
5120
5126
|
await ensureAbilityBootstrapAnchors(workspace);
|
|
5121
|
-
await patchFile(bootstrapPath, (source) => updatePluginHeaderCompatibility(source, compatibilityPolicy
|
|
5127
|
+
await patchFile(bootstrapPath, (source) => updatePluginHeaderCompatibility(source, compatibilityPolicy, {
|
|
5128
|
+
onWarning: (warning) => {
|
|
5129
|
+
compatibilityWarnings.push(warning);
|
|
5130
|
+
}
|
|
5131
|
+
}));
|
|
5122
5132
|
await ensureAbilityPackageScripts(workspace);
|
|
5123
5133
|
await ensureAbilitySyncProjectAnchors(workspace);
|
|
5124
5134
|
await ensureAbilityBuildScriptAnchors(workspace);
|
|
@@ -5150,6 +5160,9 @@ async function scaffoldAbilityWorkspace({
|
|
|
5150
5160
|
});
|
|
5151
5161
|
}
|
|
5152
5162
|
});
|
|
5163
|
+
return {
|
|
5164
|
+
warnings: compatibilityWarnings
|
|
5165
|
+
};
|
|
5153
5166
|
}
|
|
5154
5167
|
|
|
5155
5168
|
// ../wp-typia-project-tools/src/runtime/cli-add-workspace-ability.ts
|
|
@@ -5162,14 +5175,15 @@ async function runAddAbilityCommand({
|
|
|
5162
5175
|
const inventory = readWorkspaceInventory(workspace.projectDir);
|
|
5163
5176
|
assertAbilityDoesNotExist(workspace.projectDir, abilitySlug, inventory);
|
|
5164
5177
|
const compatibilityPolicy = resolveScaffoldCompatibilityPolicy(REQUIRED_WORKSPACE_ABILITY_COMPATIBILITY);
|
|
5165
|
-
await scaffoldAbilityWorkspace({
|
|
5178
|
+
const scaffoldResult = await scaffoldAbilityWorkspace({
|
|
5166
5179
|
abilitySlug,
|
|
5167
5180
|
compatibilityPolicy,
|
|
5168
5181
|
workspace
|
|
5169
5182
|
});
|
|
5170
5183
|
return {
|
|
5171
5184
|
abilitySlug,
|
|
5172
|
-
projectDir: workspace.projectDir
|
|
5185
|
+
projectDir: workspace.projectDir,
|
|
5186
|
+
warnings: scaffoldResult.warnings
|
|
5173
5187
|
};
|
|
5174
5188
|
}
|
|
5175
5189
|
// ../wp-typia-project-tools/src/runtime/cli-add-workspace-ai-scaffold.ts
|
|
@@ -6612,6 +6626,7 @@ async function scaffoldAiFeatureWorkspace({
|
|
|
6612
6626
|
namespace,
|
|
6613
6627
|
workspace
|
|
6614
6628
|
}) {
|
|
6629
|
+
const compatibilityWarnings = [];
|
|
6615
6630
|
const blockConfigPath = path13.join(workspace.projectDir, "scripts", "block-config.ts");
|
|
6616
6631
|
const bootstrapPath = getWorkspaceBootstrapPath(workspace);
|
|
6617
6632
|
const packageJsonPath = path13.join(workspace.projectDir, "package.json");
|
|
@@ -6638,7 +6653,11 @@ async function scaffoldAiFeatureWorkspace({
|
|
|
6638
6653
|
await fsp8.mkdir(aiFeatureDir, { recursive: true });
|
|
6639
6654
|
await fsp8.mkdir(path13.dirname(phpFilePath), { recursive: true });
|
|
6640
6655
|
await ensureAiFeatureBootstrapAnchors(workspace);
|
|
6641
|
-
await patchFile(bootstrapPath, (source) => updatePluginHeaderCompatibility(source, compatibilityPolicy
|
|
6656
|
+
await patchFile(bootstrapPath, (source) => updatePluginHeaderCompatibility(source, compatibilityPolicy, {
|
|
6657
|
+
onWarning: (warning) => {
|
|
6658
|
+
compatibilityWarnings.push(warning);
|
|
6659
|
+
}
|
|
6660
|
+
}));
|
|
6642
6661
|
const packageScriptChanges = await ensureAiFeaturePackageScripts(workspace);
|
|
6643
6662
|
await ensureAiFeatureSyncProjectAnchors(workspace);
|
|
6644
6663
|
await ensureAiFeatureSyncRestAnchors(workspace);
|
|
@@ -6674,9 +6693,12 @@ async function scaffoldAiFeatureWorkspace({
|
|
|
6674
6693
|
transformSource: ensureBlockConfigCanAddRestManifests
|
|
6675
6694
|
});
|
|
6676
6695
|
return {
|
|
6677
|
-
warnings:
|
|
6678
|
-
|
|
6679
|
-
|
|
6696
|
+
warnings: [
|
|
6697
|
+
...compatibilityWarnings,
|
|
6698
|
+
...packageScriptChanges.addedProjectToolsDependency ? [
|
|
6699
|
+
"Added `@wp-typia/project-tools` to devDependencies for `sync-ai`. If this workspace was already installed, rerun your package manager install command before the first `wp-typia sync ai`."
|
|
6700
|
+
] : []
|
|
6701
|
+
]
|
|
6680
6702
|
};
|
|
6681
6703
|
}
|
|
6682
6704
|
});
|
|
@@ -7095,7 +7117,7 @@ async function writeVariationRegistry(projectDir, blockSlug, variationSlug) {
|
|
|
7095
7117
|
const variationsDir = path14.join(projectDir, "src", "blocks", blockSlug, "variations");
|
|
7096
7118
|
const variationsIndexPath = path14.join(variationsDir, "index.ts");
|
|
7097
7119
|
await fsp9.mkdir(variationsDir, { recursive: true });
|
|
7098
|
-
const existingVariationSlugs =
|
|
7120
|
+
const existingVariationSlugs = fs5.readdirSync(variationsDir).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
|
|
7099
7121
|
const nextVariationSlugs = Array.from(new Set([...existingVariationSlugs, variationSlug])).sort();
|
|
7100
7122
|
await fsp9.writeFile(variationsIndexPath, buildVariationIndexSource(nextVariationSlugs), "utf8");
|
|
7101
7123
|
}
|
|
@@ -7103,7 +7125,7 @@ async function writeBlockStyleRegistry(projectDir, blockSlug, styleSlug) {
|
|
|
7103
7125
|
const stylesDir = path14.join(projectDir, "src", "blocks", blockSlug, "styles");
|
|
7104
7126
|
const stylesIndexPath = path14.join(stylesDir, "index.ts");
|
|
7105
7127
|
await fsp9.mkdir(stylesDir, { recursive: true });
|
|
7106
|
-
const existingStyleSlugs =
|
|
7128
|
+
const existingStyleSlugs = fs5.readdirSync(stylesDir).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
|
|
7107
7129
|
const nextStyleSlugs = Array.from(new Set([...existingStyleSlugs, styleSlug])).sort();
|
|
7108
7130
|
await fsp9.writeFile(stylesIndexPath, buildBlockStyleIndexSource(nextStyleSlugs), "utf8");
|
|
7109
7131
|
}
|
|
@@ -7111,7 +7133,7 @@ async function writeBlockTransformRegistry(projectDir, blockSlug, transformSlug)
|
|
|
7111
7133
|
const transformsDir = path14.join(projectDir, "src", "blocks", blockSlug, "transforms");
|
|
7112
7134
|
const transformsIndexPath = path14.join(transformsDir, "index.ts");
|
|
7113
7135
|
await fsp9.mkdir(transformsDir, { recursive: true });
|
|
7114
|
-
const existingTransformSlugs =
|
|
7136
|
+
const existingTransformSlugs = fs5.readdirSync(transformsDir).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
|
|
7115
7137
|
const nextTransformSlugs = Array.from(new Set([...existingTransformSlugs, transformSlug])).sort();
|
|
7116
7138
|
await fsp9.writeFile(transformsIndexPath, buildBlockTransformIndexSource(nextTransformSlugs), "utf8");
|
|
7117
7139
|
}
|
|
@@ -7160,7 +7182,7 @@ async function runAddVariationCommand({
|
|
|
7160
7182
|
const variationsDir = path14.join(workspace.projectDir, "src", "blocks", blockSlug, "variations");
|
|
7161
7183
|
const variationFilePath = path14.join(variationsDir, `${variationSlug}.ts`);
|
|
7162
7184
|
const variationsIndexPath = path14.join(variationsDir, "index.ts");
|
|
7163
|
-
const shouldRemoveVariationsDirOnRollback = !
|
|
7185
|
+
const shouldRemoveVariationsDirOnRollback = !fs5.existsSync(variationsDir);
|
|
7164
7186
|
const mutationSnapshot = {
|
|
7165
7187
|
fileSources: await snapshotWorkspaceFiles([
|
|
7166
7188
|
blockConfigPath,
|
|
@@ -7207,7 +7229,7 @@ async function runAddBlockStyleCommand({
|
|
|
7207
7229
|
const stylesDir = path14.join(workspace.projectDir, "src", "blocks", blockSlug, "styles");
|
|
7208
7230
|
const styleFilePath = path14.join(stylesDir, `${styleSlug}.ts`);
|
|
7209
7231
|
const stylesIndexPath = path14.join(stylesDir, "index.ts");
|
|
7210
|
-
const shouldRemoveStylesDirOnRollback = !
|
|
7232
|
+
const shouldRemoveStylesDirOnRollback = !fs5.existsSync(stylesDir);
|
|
7211
7233
|
const mutationSnapshot = {
|
|
7212
7234
|
fileSources: await snapshotWorkspaceFiles([
|
|
7213
7235
|
blockConfigPath,
|
|
@@ -7256,7 +7278,7 @@ async function runAddBlockTransformCommand({
|
|
|
7256
7278
|
const transformsDir = path14.join(workspace.projectDir, "src", "blocks", target.blockSlug, "transforms");
|
|
7257
7279
|
const transformFilePath = path14.join(transformsDir, `${transformSlug}.ts`);
|
|
7258
7280
|
const transformsIndexPath = path14.join(transformsDir, "index.ts");
|
|
7259
|
-
const shouldRemoveTransformsDirOnRollback = !
|
|
7281
|
+
const shouldRemoveTransformsDirOnRollback = !fs5.existsSync(transformsDir);
|
|
7260
7282
|
const mutationSnapshot = {
|
|
7261
7283
|
fileSources: await snapshotWorkspaceFiles([
|
|
7262
7284
|
blockConfigPath,
|
|
@@ -7363,4 +7385,4 @@ export {
|
|
|
7363
7385
|
ADD_BLOCK_TEMPLATE_IDS
|
|
7364
7386
|
};
|
|
7365
7387
|
|
|
7366
|
-
//# debugId=
|
|
7388
|
+
//# debugId=24FCFA027181E91A64756E2164756E21
|
|
@@ -21,8 +21,9 @@ import {
|
|
|
21
21
|
escapeRegex,
|
|
22
22
|
readWorkspaceInventory,
|
|
23
23
|
resolveEditorPluginSlotAlias
|
|
24
|
-
} from "./cli-
|
|
24
|
+
} from "./cli-5kn2p7ee.js";
|
|
25
25
|
import"./cli-t73q5aqz.js";
|
|
26
|
+
import"./cli-fys8vm2t.js";
|
|
26
27
|
import {
|
|
27
28
|
CLI_DIAGNOSTIC_CODES,
|
|
28
29
|
createCliCommandError,
|
|
@@ -35,8 +36,8 @@ import {
|
|
|
35
36
|
getInvalidWorkspaceProjectReason,
|
|
36
37
|
parseWorkspacePackageJson,
|
|
37
38
|
tryResolveWorkspaceProject
|
|
38
|
-
} from "./cli-
|
|
39
|
-
import"./cli-
|
|
39
|
+
} from "./cli-hhp1d348.js";
|
|
40
|
+
import"./cli-52ke0ptp.js";
|
|
40
41
|
import"./cli-xnn9xjcy.js";
|
|
41
42
|
|
|
42
43
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-environment.ts
|
|
@@ -175,6 +176,9 @@ function createDoctorScopeCheck(status, detail) {
|
|
|
175
176
|
function getWorkspaceBootstrapRelativePath(packageName) {
|
|
176
177
|
return `${packageName.split("/").pop() ?? packageName}.php`;
|
|
177
178
|
}
|
|
179
|
+
function resolveWorkspaceBootstrapPath(projectDir, packageName) {
|
|
180
|
+
return path2.join(projectDir, getWorkspaceBootstrapRelativePath(packageName));
|
|
181
|
+
}
|
|
178
182
|
function checkExistingFiles(projectDir, label, filePaths) {
|
|
179
183
|
const missing = filePaths.filter((filePath) => typeof filePath === "string").filter((filePath) => !fs2.existsSync(path2.join(projectDir, filePath)));
|
|
180
184
|
return createDoctorCheck2(label, missing.length === 0 ? "pass" : "fail", missing.length === 0 ? "All referenced files exist" : `Missing: ${missing.join(", ")}`);
|
|
@@ -182,8 +186,7 @@ function checkExistingFiles(projectDir, label, filePaths) {
|
|
|
182
186
|
|
|
183
187
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-bindings.ts
|
|
184
188
|
function checkWorkspaceBindingBootstrap(projectDir, packageName) {
|
|
185
|
-
const
|
|
186
|
-
const bootstrapPath = path3.join(projectDir, `${packageBaseName}.php`);
|
|
189
|
+
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
187
190
|
if (!fs3.existsSync(bootstrapPath)) {
|
|
188
191
|
return createDoctorCheck2("Binding bootstrap", "fail", `Missing ${path3.basename(bootstrapPath)}`);
|
|
189
192
|
}
|
|
@@ -558,8 +561,7 @@ function checkWorkspaceBlockIframeCompatibility(projectDir, blockSlug) {
|
|
|
558
561
|
];
|
|
559
562
|
}
|
|
560
563
|
function checkWorkspacePatternBootstrap(projectDir, packageName) {
|
|
561
|
-
const
|
|
562
|
-
const bootstrapPath = path4.join(projectDir, `${packageBaseName}.php`);
|
|
564
|
+
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
563
565
|
if (!fs4.existsSync(bootstrapPath)) {
|
|
564
566
|
return createDoctorCheck2("Pattern bootstrap", "fail", `Missing ${path4.basename(bootstrapPath)}`);
|
|
565
567
|
}
|
|
@@ -715,8 +717,7 @@ function checkWorkspaceRestResourceConfig(restResource) {
|
|
|
715
717
|
return createDoctorCheck2(`REST resource config ${restResource.slug}`, hasNamespace && hasMethods ? "pass" : "fail", hasNamespace && hasMethods ? `REST resource namespace ${restResource.namespace} with methods ${restResource.methods.join(", ")}` : "REST resource namespace or methods are invalid");
|
|
716
718
|
}
|
|
717
719
|
function checkWorkspaceRestResourceBootstrap(projectDir, packageName, phpPrefix) {
|
|
718
|
-
const
|
|
719
|
-
const bootstrapPath = path5.join(projectDir, `${packageBaseName}.php`);
|
|
720
|
+
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
720
721
|
if (!fs5.existsSync(bootstrapPath)) {
|
|
721
722
|
return createDoctorCheck2("REST resource bootstrap", "fail", `Missing ${path5.basename(bootstrapPath)}`);
|
|
722
723
|
}
|
|
@@ -755,8 +756,7 @@ function checkWorkspaceAbilityConfig(projectDir, ability) {
|
|
|
755
756
|
}
|
|
756
757
|
}
|
|
757
758
|
function checkWorkspaceAbilityBootstrap(projectDir, packageName, phpPrefix) {
|
|
758
|
-
const
|
|
759
|
-
const bootstrapPath = path5.join(projectDir, `${packageBaseName}.php`);
|
|
759
|
+
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
760
760
|
if (!fs5.existsSync(bootstrapPath)) {
|
|
761
761
|
return createDoctorCheck2("Ability bootstrap", "fail", `Missing ${path5.basename(bootstrapPath)}`);
|
|
762
762
|
}
|
|
@@ -811,8 +811,7 @@ function checkWorkspaceAiFeatureConfig(aiFeature) {
|
|
|
811
811
|
return createDoctorCheck2(`AI feature config ${aiFeature.slug}`, hasNamespace ? "pass" : "fail", hasNamespace ? `AI feature namespace ${aiFeature.namespace} is valid` : "AI feature namespace is invalid");
|
|
812
812
|
}
|
|
813
813
|
function checkWorkspaceAiFeatureBootstrap(projectDir, packageName, phpPrefix) {
|
|
814
|
-
const
|
|
815
|
-
const bootstrapPath = path5.join(projectDir, `${packageBaseName}.php`);
|
|
814
|
+
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
816
815
|
if (!fs5.existsSync(bootstrapPath)) {
|
|
817
816
|
return createDoctorCheck2("AI feature bootstrap", "fail", `Missing ${path5.basename(bootstrapPath)}`);
|
|
818
817
|
}
|
|
@@ -840,8 +839,7 @@ function checkWorkspaceEditorPluginConfig(editorPlugin) {
|
|
|
840
839
|
return createDoctorCheck2(`Editor plugin config ${editorPlugin.slug}`, isValidSlot ? "pass" : "fail", isValidSlot ? `Editor plugin slot ${editorPlugin.slot} is supported as ${normalizedSlot}` : `Unsupported editor plugin slot "${editorPlugin.slot}". Expected one of: ${EDITOR_PLUGIN_SLOT_IDS.join(", ")} or legacy aliases PluginSidebar, PluginDocumentSettingPanel.`);
|
|
841
840
|
}
|
|
842
841
|
function checkWorkspaceEditorPluginBootstrap(projectDir, packageName, phpPrefix) {
|
|
843
|
-
const
|
|
844
|
-
const bootstrapPath = path5.join(projectDir, `${packageBaseName}.php`);
|
|
842
|
+
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
845
843
|
if (!fs5.existsSync(bootstrapPath)) {
|
|
846
844
|
return createDoctorCheck2("Editor plugin bootstrap", "fail", `Missing ${path5.basename(bootstrapPath)}`);
|
|
847
845
|
}
|
|
@@ -895,8 +893,7 @@ function checkWorkspaceAdminViewConfig(adminView, inventory) {
|
|
|
895
893
|
return createDoctorCheck2(`Admin view config ${adminView.slug}`, isValid ? "pass" : "fail", isValid ? `Admin view source ${source} is list-capable` : "Admin view source must use rest-resource:<slug> with a list-capable REST resource or core-data:<postType|taxonomy>/<name>");
|
|
896
894
|
}
|
|
897
895
|
function checkWorkspaceAdminViewBootstrap(projectDir, packageName, phpPrefix) {
|
|
898
|
-
const
|
|
899
|
-
const bootstrapPath = path5.join(projectDir, `${packageBaseName}.php`);
|
|
896
|
+
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
900
897
|
if (!fs5.existsSync(bootstrapPath)) {
|
|
901
898
|
return createDoctorCheck2("Admin view bootstrap", "fail", `Missing ${path5.basename(bootstrapPath)}`);
|
|
902
899
|
}
|
|
@@ -1117,4 +1114,4 @@ export {
|
|
|
1117
1114
|
getDoctorChecks
|
|
1118
1115
|
};
|
|
1119
1116
|
|
|
1120
|
-
//# debugId=
|
|
1117
|
+
//# debugId=3C7A7D362A24E1A964756E2164756E21
|