wp-typia 0.22.4 → 0.22.5

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.
@@ -21,7 +21,7 @@ import {
21
21
  scaffoldProject,
22
22
  syncPersistenceRestArtifacts,
23
23
  updatePluginHeaderCompatibility
24
- } from "./cli-6ymn63t4.js";
24
+ } from "./cli-ctddkm3n.js";
25
25
  import {
26
26
  DEFAULT_WORDPRESS_ABILITIES_VERSION,
27
27
  DEFAULT_WORDPRESS_CORE_ABILITIES_VERSION,
@@ -34,7 +34,7 @@ import {
34
34
  } from "./cli-1sm60g1z.js";
35
35
  import {
36
36
  snapshotProjectVersion
37
- } from "./cli-2mt6bvcj.js";
37
+ } from "./cli-xbzfx7qz.js";
38
38
  import {
39
39
  ensureMigrationDirectories,
40
40
  parseMigrationConfig,
@@ -100,7 +100,7 @@ import {
100
100
  toPascalCase,
101
101
  toSnakeCase,
102
102
  toTitleCase
103
- } from "./cli-qr2ek735.js";
103
+ } from "./cli-j30rk466.js";
104
104
  import {
105
105
  createManagedTempRoot
106
106
  } from "./cli-t73q5aqz.js";
@@ -2794,45 +2794,17 @@ function ${bindingEditorEnqueueFunctionName}() {
2794
2794
  );
2795
2795
  }
2796
2796
  `;
2797
- const insertionAnchors = [
2798
- /add_action\(\s*["']init["']\s*,\s*["'][^"']+_load_textdomain["']\s*\);\s*\n/u,
2799
- /\?>\s*$/u
2800
- ];
2801
- const insertPhpSnippet = (snippet) => {
2802
- for (const anchor of insertionAnchors) {
2803
- const candidate = nextSource.replace(anchor, (match) => `${snippet}
2804
- ${match}`);
2805
- if (candidate !== nextSource) {
2806
- nextSource = candidate;
2807
- return;
2808
- }
2809
- }
2810
- nextSource = `${nextSource.trimEnd()}
2811
- ${snippet}
2812
- `;
2813
- };
2814
- const appendPhpSnippet = (snippet) => {
2815
- const closingTagPattern = /\?>\s*$/u;
2816
- if (closingTagPattern.test(nextSource)) {
2817
- nextSource = nextSource.replace(closingTagPattern, `${snippet}
2818
- ?>`);
2819
- return;
2820
- }
2821
- nextSource = `${nextSource.trimEnd()}
2822
- ${snippet}
2823
- `;
2824
- };
2825
2797
  if (!hasPhpFunctionDefinition(nextSource, bindingRegistrationFunctionName)) {
2826
- insertPhpSnippet(bindingRegistrationFunction);
2798
+ nextSource = insertPhpSnippetBeforeWorkspaceAnchors(nextSource, bindingRegistrationFunction);
2827
2799
  }
2828
2800
  if (!hasPhpFunctionDefinition(nextSource, bindingEditorEnqueueFunctionName)) {
2829
- insertPhpSnippet(bindingEditorEnqueueFunction);
2801
+ nextSource = insertPhpSnippetBeforeWorkspaceAnchors(nextSource, bindingEditorEnqueueFunction);
2830
2802
  }
2831
2803
  if (!nextSource.includes(bindingRegistrationHook)) {
2832
- appendPhpSnippet(bindingRegistrationHook);
2804
+ nextSource = appendPhpSnippetBeforeClosingTag(nextSource, bindingRegistrationHook);
2833
2805
  }
2834
2806
  if (!nextSource.includes(bindingEditorEnqueueHook)) {
2835
- appendPhpSnippet(bindingEditorEnqueueHook);
2807
+ nextSource = appendPhpSnippetBeforeClosingTag(nextSource, bindingEditorEnqueueHook);
2836
2808
  }
2837
2809
  return nextSource;
2838
2810
  });
@@ -2882,36 +2854,8 @@ function ${enqueueFunctionName}() {
2882
2854
  }
2883
2855
  }
2884
2856
  `;
2885
- const insertionAnchors = [
2886
- /add_action\(\s*["']init["']\s*,\s*["'][^"']+_load_textdomain["']\s*\);\s*\n/u,
2887
- /\?>\s*$/u
2888
- ];
2889
- const insertPhpSnippet = (snippet) => {
2890
- for (const anchor of insertionAnchors) {
2891
- const candidate = nextSource.replace(anchor, (match) => `${snippet}
2892
- ${match}`);
2893
- if (candidate !== nextSource) {
2894
- nextSource = candidate;
2895
- return;
2896
- }
2897
- }
2898
- nextSource = `${nextSource.trimEnd()}
2899
- ${snippet}
2900
- `;
2901
- };
2902
- const appendPhpSnippet = (snippet) => {
2903
- const closingTagPattern = /\?>\s*$/u;
2904
- if (closingTagPattern.test(nextSource)) {
2905
- nextSource = nextSource.replace(closingTagPattern, `${snippet}
2906
- ?>`);
2907
- return;
2908
- }
2909
- nextSource = `${nextSource.trimEnd()}
2910
- ${snippet}
2911
- `;
2912
- };
2913
2857
  if (!hasPhpFunctionDefinition(nextSource, enqueueFunctionName)) {
2914
- insertPhpSnippet(enqueueFunction);
2858
+ nextSource = insertPhpSnippetBeforeWorkspaceAnchors(nextSource, enqueueFunction);
2915
2859
  } else {
2916
2860
  const requiredReferences = [
2917
2861
  EDITOR_PLUGIN_EDITOR_SCRIPT,
@@ -2932,7 +2876,7 @@ ${snippet}
2932
2876
  }
2933
2877
  }
2934
2878
  if (!nextSource.includes(enqueueHook)) {
2935
- appendPhpSnippet(enqueueHook);
2879
+ nextSource = appendPhpSnippetBeforeClosingTag(nextSource, enqueueHook);
2936
2880
  }
2937
2881
  return nextSource;
2938
2882
  });
@@ -3198,36 +3142,8 @@ function ${registerFunctionName}() {
3198
3142
  }
3199
3143
  }
3200
3144
  `;
3201
- const insertionAnchors = [
3202
- /add_action\(\s*["']init["']\s*,\s*["'][^"']+_load_textdomain["']\s*\);\s*\n/u,
3203
- /\?>\s*$/u
3204
- ];
3205
- const insertPhpSnippet = (snippet) => {
3206
- for (const anchor of insertionAnchors) {
3207
- const candidate = nextSource.replace(anchor, (match) => `${snippet}
3208
- ${match}`);
3209
- if (candidate !== nextSource) {
3210
- nextSource = candidate;
3211
- return;
3212
- }
3213
- }
3214
- nextSource = `${nextSource.trimEnd()}
3215
- ${snippet}
3216
- `;
3217
- };
3218
- const appendPhpSnippet = (snippet) => {
3219
- const closingTagPattern = /\?>\s*$/u;
3220
- if (closingTagPattern.test(nextSource)) {
3221
- nextSource = nextSource.replace(closingTagPattern, `${snippet}
3222
- ?>`);
3223
- return;
3224
- }
3225
- nextSource = `${nextSource.trimEnd()}
3226
- ${snippet}
3227
- `;
3228
- };
3229
3145
  if (!hasPhpFunctionDefinition(nextSource, registerFunctionName)) {
3230
- insertPhpSnippet(registerFunction);
3146
+ nextSource = insertPhpSnippetBeforeWorkspaceAnchors(nextSource, registerFunction);
3231
3147
  } else if (!nextSource.includes(REST_RESOURCE_SERVER_GLOB)) {
3232
3148
  throw new Error([
3233
3149
  `Unable to patch ${path7.basename(bootstrapPath)} in ensureRestResourceBootstrapAnchors.`,
@@ -3236,7 +3152,7 @@ ${snippet}
3236
3152
  ].join(" "));
3237
3153
  }
3238
3154
  if (!nextSource.includes(registerHook)) {
3239
- appendPhpSnippet(registerHook);
3155
+ nextSource = appendPhpSnippetBeforeClosingTag(nextSource, registerHook);
3240
3156
  }
3241
3157
  return nextSource;
3242
3158
  });
@@ -5857,36 +5773,8 @@ function ${registerFunctionName}() {
5857
5773
  }
5858
5774
  }
5859
5775
  `;
5860
- const insertionAnchors = [
5861
- /add_action\(\s*["']init["']\s*,\s*["'][^"']+_load_textdomain["']\s*\);\s*\n/u,
5862
- /\?>\s*$/u
5863
- ];
5864
- const insertPhpSnippet = (snippet) => {
5865
- for (const anchor of insertionAnchors) {
5866
- const candidate = nextSource.replace(anchor, (match) => `${snippet}
5867
- ${match}`);
5868
- if (candidate !== nextSource) {
5869
- nextSource = candidate;
5870
- return;
5871
- }
5872
- }
5873
- nextSource = `${nextSource.trimEnd()}
5874
- ${snippet}
5875
- `;
5876
- };
5877
- const appendPhpSnippet = (snippet) => {
5878
- const closingTagPattern = /\?>\s*$/u;
5879
- if (closingTagPattern.test(nextSource)) {
5880
- nextSource = nextSource.replace(closingTagPattern, `${snippet}
5881
- ?>`);
5882
- return;
5883
- }
5884
- nextSource = `${nextSource.trimEnd()}
5885
- ${snippet}
5886
- `;
5887
- };
5888
5776
  if (!hasPhpFunctionDefinition(nextSource, registerFunctionName)) {
5889
- insertPhpSnippet(registerFunction);
5777
+ nextSource = insertPhpSnippetBeforeWorkspaceAnchors(nextSource, registerFunction);
5890
5778
  } else if (!nextSource.includes(AI_FEATURE_SERVER_GLOB)) {
5891
5779
  throw new Error([
5892
5780
  `Unable to patch ${path12.basename(bootstrapPath)} in ensureAiFeatureBootstrapAnchors.`,
@@ -5895,7 +5783,7 @@ ${snippet}
5895
5783
  ].join(" "));
5896
5784
  }
5897
5785
  if (!nextSource.includes(registerHook)) {
5898
- appendPhpSnippet(registerHook);
5786
+ nextSource = appendPhpSnippetBeforeClosingTag(nextSource, registerHook);
5899
5787
  }
5900
5788
  return nextSource;
5901
5789
  });
@@ -7475,4 +7363,4 @@ export {
7475
7363
  ADD_BLOCK_TEMPLATE_IDS
7476
7364
  };
7477
7365
 
7478
- //# debugId=851894DA0B69BA4964756E2164756E21
7366
+ //# debugId=BE460360B35E3C8864756E2164756E21
@@ -4,7 +4,7 @@ import {
4
4
  } from "./cli-1sm60g1z.js";
5
5
  import {
6
6
  seedProjectMigrations
7
- } from "./cli-2mt6bvcj.js";
7
+ } from "./cli-xbzfx7qz.js";
8
8
  import {
9
9
  ensureMigrationDirectories,
10
10
  isPlainObject,
@@ -51,7 +51,7 @@ import {
51
51
  toTitleCase,
52
52
  validateBlockSlug,
53
53
  validateNamespace
54
- } from "./cli-qr2ek735.js";
54
+ } from "./cli-j30rk466.js";
55
55
  import {
56
56
  createManagedTempRoot
57
57
  } from "./cli-t73q5aqz.js";
@@ -21,7 +21,7 @@ import {
21
21
  escapeRegex,
22
22
  readWorkspaceInventory,
23
23
  resolveEditorPluginSlotAlias
24
- } from "./cli-qr2ek735.js";
24
+ } from "./cli-j30rk466.js";
25
25
  import"./cli-t73q5aqz.js";
26
26
  import {
27
27
  CLI_DIAGNOSTIC_CODES,
@@ -13,7 +13,7 @@ import {
13
13
  snapshotWorkspaceFiles,
14
14
  toPascalCase,
15
15
  updateWorkspaceInventorySource
16
- } from "./cli-qr2ek735.js";
16
+ } from "./cli-j30rk466.js";
17
17
  import {
18
18
  CLI_DIAGNOSTIC_CODES,
19
19
  createCliDiagnosticCodeError