@wp-typia/project-tools 0.22.0 → 0.22.1

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.
@@ -0,0 +1,29 @@
1
+ import type { WorkspaceRestResourceInventoryEntry } from './workspace-inventory.js';
2
+ export declare const ADMIN_VIEW_REST_SOURCE_KIND = "rest-resource";
3
+ export declare const ADMIN_VIEW_CORE_DATA_SOURCE_KIND = "core-data";
4
+ export declare const ADMIN_VIEW_CORE_DATA_ENTITY_KIND_IDS: readonly ["postType", "taxonomy"];
5
+ export declare const ADMIN_VIEW_CORE_DATA_ENTITY_SEGMENT_PATTERN: RegExp;
6
+ export declare const ADMIN_VIEW_CORE_DATA_ENTITY_NAME_PATTERN: RegExp;
7
+ export declare const ADMIN_VIEW_SOURCE_USAGE = "wp-typia add admin-view <name> --source <rest-resource:slug|core-data:kind/name>";
8
+ export declare const ADMIN_VIEWS_SCRIPT = "build/admin-views/index.js";
9
+ export declare const ADMIN_VIEWS_ASSET = "build/admin-views/index.asset.php";
10
+ export declare const ADMIN_VIEWS_STYLE = "build/admin-views/style-index.css";
11
+ export declare const ADMIN_VIEWS_STYLE_RTL = "build/admin-views/style-index-rtl.css";
12
+ export declare const ADMIN_VIEWS_PHP_GLOB = "/inc/admin-views/*.php";
13
+ export declare const ADMIN_VIEW_ALLOW_UNPUBLISHED_DATAVIEWS_ENV = "WP_TYPIA_ALLOW_UNPUBLISHED_DATAVIEWS";
14
+ export declare const ADMIN_VIEW_PUBLIC_INSTALLS_ENABLED = false;
15
+ export interface AdminViewRestResourceSource {
16
+ kind: typeof ADMIN_VIEW_REST_SOURCE_KIND;
17
+ slug: string;
18
+ }
19
+ export type AdminViewCoreDataEntityKind = (typeof ADMIN_VIEW_CORE_DATA_ENTITY_KIND_IDS)[number];
20
+ export interface AdminViewCoreDataSource {
21
+ entityKind: AdminViewCoreDataEntityKind;
22
+ entityName: string;
23
+ kind: typeof ADMIN_VIEW_CORE_DATA_SOURCE_KIND;
24
+ }
25
+ export type AdminViewSource = AdminViewCoreDataSource | AdminViewRestResourceSource;
26
+ export type AdminViewRestResource = WorkspaceRestResourceInventoryEntry;
27
+ export declare function isAdminViewCoreDataSource(source: AdminViewSource | undefined): source is AdminViewCoreDataSource;
28
+ export declare function isAdminViewRestResourceSource(source: AdminViewSource | undefined): source is AdminViewRestResourceSource;
29
+ export declare function formatAdminViewSourceLocator(source: AdminViewSource): string;
@@ -0,0 +1,29 @@
1
+ export const ADMIN_VIEW_REST_SOURCE_KIND = 'rest-resource';
2
+ export const ADMIN_VIEW_CORE_DATA_SOURCE_KIND = 'core-data';
3
+ export const ADMIN_VIEW_CORE_DATA_ENTITY_KIND_IDS = [
4
+ 'postType',
5
+ 'taxonomy',
6
+ ];
7
+ export const ADMIN_VIEW_CORE_DATA_ENTITY_SEGMENT_PATTERN = /^[A-Za-z][A-Za-z0-9_-]*$/u;
8
+ export const ADMIN_VIEW_CORE_DATA_ENTITY_NAME_PATTERN = /^[a-z0-9][a-z0-9_-]*$/u;
9
+ export const ADMIN_VIEW_SOURCE_USAGE = 'wp-typia add admin-view <name> --source <rest-resource:slug|core-data:kind/name>';
10
+ export const ADMIN_VIEWS_SCRIPT = 'build/admin-views/index.js';
11
+ export const ADMIN_VIEWS_ASSET = 'build/admin-views/index.asset.php';
12
+ export const ADMIN_VIEWS_STYLE = 'build/admin-views/style-index.css';
13
+ export const ADMIN_VIEWS_STYLE_RTL = 'build/admin-views/style-index-rtl.css';
14
+ export const ADMIN_VIEWS_PHP_GLOB = '/inc/admin-views/*.php';
15
+ export const ADMIN_VIEW_ALLOW_UNPUBLISHED_DATAVIEWS_ENV = 'WP_TYPIA_ALLOW_UNPUBLISHED_DATAVIEWS';
16
+ // Lift this gate in the same release that publishes @wp-typia/dataviews.
17
+ export const ADMIN_VIEW_PUBLIC_INSTALLS_ENABLED = false;
18
+ export function isAdminViewCoreDataSource(source) {
19
+ return source?.kind === ADMIN_VIEW_CORE_DATA_SOURCE_KIND;
20
+ }
21
+ export function isAdminViewRestResourceSource(source) {
22
+ return source?.kind === ADMIN_VIEW_REST_SOURCE_KIND;
23
+ }
24
+ export function formatAdminViewSourceLocator(source) {
25
+ if (isAdminViewCoreDataSource(source)) {
26
+ return `${source.kind}:${source.entityKind}/${source.entityName}`;
27
+ }
28
+ return `${source.kind}:${source.slug}`;
29
+ }
@@ -1,22 +1,7 @@
1
- import { type RunAddAdminViewCommandOptions } from "./cli-add-shared.js";
1
+ import { type RunAddAdminViewCommandOptions } from './cli-add-shared.js';
2
2
  /**
3
3
  * Add one DataViews-powered WordPress admin screen scaffold to an official
4
4
  * workspace project.
5
- *
6
- * @param options Command options for the admin-view scaffold workflow.
7
- * @param options.adminViewName Human-entered admin screen name that will be
8
- * normalized and validated before files are written.
9
- * @param options.cwd Working directory used to resolve the nearest official workspace.
10
- * Defaults to `process.cwd()`.
11
- * @param options.source Optional data source locator. `rest-resource:<slug>`
12
- * wires the screen to an existing list-capable REST resource.
13
- * `core-data:<kind>/<name>` binds the screen to a supported WordPress-owned
14
- * core-data entity collection.
15
- * @returns A promise that resolves with the normalized `adminViewSlug`, optional
16
- * `source`, and owning `projectDir` after scaffold files and inventory entries
17
- * are written successfully.
18
- * @throws {Error} When the command is run outside an official workspace, when
19
- * the slug/source is invalid, or when a conflicting file or inventory entry exists.
20
5
  */
21
6
  export declare function runAddAdminViewCommand({ adminViewName, cwd, source, }: RunAddAdminViewCommandOptions): Promise<{
22
7
  adminViewSlug: string;