nextpress-core 2.0.0 → 2.0.2

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.
Files changed (37) hide show
  1. package/README.md +4 -0
  2. package/lib/acf-functions/core/acf-field-group-autoloader.ts +1 -1
  3. package/lib/acf-functions/services/map-fields/helpers/map-choice-object.ts +1 -1
  4. package/lib/acf-functions/services/map-fields/map-fields.ts +5 -5
  5. package/lib/acf-functions/types/components/field-props.ts +3 -3
  6. package/lib/ambient.d.ts +1 -1
  7. package/lib/entities/option/option.interface.ts +1 -1
  8. package/lib/entities/option/option.ts +1 -1
  9. package/lib/entities/post/post.interface.ts +1 -1
  10. package/lib/entities/post/post.ts +2 -2
  11. package/lib/entities/term/term.interface.ts +1 -1
  12. package/lib/entities/term/term.ts +1 -1
  13. package/lib/entities/user/user.interface.ts +1 -1
  14. package/lib/entities/user/user.ts +1 -1
  15. package/lib/globals/entity-loader/option-loader.ts +1 -1
  16. package/lib/globals/entity-loader/post-loader.ts +2 -2
  17. package/lib/globals/entity-loader/term-loader.ts +2 -2
  18. package/lib/globals/entity-loader/user-loader.ts +2 -2
  19. package/lib/globals/get-field/get-field.ts +1 -1
  20. package/lib/repository/optionquery/option-query-args.ts +1 -1
  21. package/lib/repository/optionquery/option-query.ts +1 -1
  22. package/lib/repository/postquery/post-query.ts +2 -2
  23. package/lib/repository/termquery/term-query.ts +2 -2
  24. package/lib/repository/userquery/user-query.ts +1 -1
  25. package/lib/router/nextpress-layout.tsx +3 -3
  26. package/lib/router/nextpress-not-found-route.tsx +1 -1
  27. package/lib/router/routes/api/api-get-field-groups.ts +2 -2
  28. package/lib/router/routes/author-archive.tsx +2 -2
  29. package/lib/router/routes/post-index-page.tsx +2 -2
  30. package/lib/router/routes/singular-page.tsx +3 -3
  31. package/lib/router/routes/site-front-page.tsx +2 -2
  32. package/lib/router/routes/term-archive.tsx +4 -4
  33. package/lib/template-heirarchy/archive/posttypearchive.tsx +1 -1
  34. package/lib/template-heirarchy/page/posttype.tsx +1 -1
  35. package/lib/ui/render-the-admin-bar.tsx +1 -1
  36. package/lib/ui/render-the-logo.tsx +2 -2
  37. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # Nextpress Core
2
+ `npm i -D nextpress-core`
3
+
4
+ https://github.com/ellsaw/nextpress
@@ -19,7 +19,7 @@ export async function acfFieldGroupAutoloader(): Promise<NextpressFieldGroup[]>
19
19
  for (const file of files) {
20
20
  if (!file.endsWith('.ts')) continue;
21
21
 
22
- const imported = await import(`../../../../app/_templates/components/field-groups/${file}`);
22
+ const imported = await import(`@/app/_templates/components/field-groups/${file}`);
23
23
  const fieldGroup = imported.default;
24
24
 
25
25
  fieldGroups.push(fieldGroup);
@@ -1,4 +1,4 @@
1
- import { ACFChoiceObject } from "nextpress/acf-functions/types/components/field-props";
1
+ import { ACFChoiceObject } from "@nextpress/acf-functions/types/components/field-props";
2
2
 
3
3
  export function mapChoiceObject(return_format: 'array' | 'label' | 'value', value?: string, choices?: any): ACFChoiceObject | string | undefined {
4
4
  if (return_format === 'value') {
@@ -1,11 +1,11 @@
1
1
  import { unserialize } from "php-serialize";
2
2
  import { acfComponentAutoloader } from "../../core/acf-component-autoloader";
3
- import { ACFGoogleMapsObject, ACFIconObject, ACFLinkObject } from "nextpress/acf-functions/types/components/field-props";
4
- import { NextpressField } from "nextpress/acf-functions/types/acf-field";
5
- import { NextpressLayout } from "nextpress/acf-functions/types/acf-layout";
6
- import { ACFRawValues } from "nextpress/acf-functions/types/acf-values";
3
+ import { ACFGoogleMapsObject, ACFIconObject, ACFLinkObject } from "@nextpress/acf-functions/types/components/field-props";
4
+ import { NextpressField } from "@nextpress/acf-functions/types/acf-field";
5
+ import { NextpressLayout } from "@nextpress/acf-functions/types/acf-layout";
6
+ import { ACFRawValues } from "@nextpress/acf-functions/types/acf-values";
7
7
  import { mapChoiceObject } from "./helpers/map-choice-object";
8
- import { processURL } from "nextpress/services/utilities/process-url";
8
+ import { processURL } from "@nextpress/services/utilities/process-url";
9
9
 
10
10
  const components = await acfComponentAutoloader();
11
11
 
@@ -1,6 +1,6 @@
1
- import { IPost } from "nextpress/entities/post/post.interface";
2
- import { ITerm } from "nextpress/entities/term/term.interface";
3
- import { IUser } from "nextpress/entities/user/user.interface";
1
+ import { IPost } from "@nextpress/entities/post/post.interface";
2
+ import { ITerm } from "@nextpress/entities/term/term.interface";
3
+ import { IUser } from "@nextpress/entities/user/user.interface";
4
4
  import { JSX } from "react";
5
5
 
6
6
  type GetFields<T> =
package/lib/ambient.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  declare module '@/nextpress.config' {
2
- type NextpressConfig = import('nextpress/globals/nextpress-config/nextpress-config.interface').NextpressConfig;
2
+ type NextpressConfig = import('@nextpress/globals/nextpress-config/nextpress-config.interface').NextpressConfig;
3
3
 
4
4
  export const nextpressConfig: NextpressConfig
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { Selectable } from "kysely";
2
- import { WpOption } from "nextpress/wpdb/wpdb.interface";
2
+ import { WpOption } from "@nextpress/wpdb/wpdb.interface";
3
3
 
4
4
  /**
5
5
  * Represents option entity.
@@ -1,4 +1,4 @@
1
- import { wpdb } from "nextpress/wpdb/wpdb";
1
+ import { wpdb } from "@nextpress/wpdb/wpdb";
2
2
  import { IOption } from "./option.interface";
3
3
 
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import { Selectable } from "kysely";
2
2
  import { IFieldLocation, IPath } from "../common";
3
- import { WpPost } from "nextpress/wpdb/wpdb.interface";
3
+ import { WpPost } from "@nextpress/wpdb/wpdb.interface";
4
4
 
5
5
  /**
6
6
  * Attributes for post attachment images.
@@ -1,8 +1,8 @@
1
1
  import { unserialize } from "php-serialize";
2
2
  import { Fields } from "../common";
3
3
  import { IPost, PostImageAttributes, MenuItemAttributes } from "./post.interface";
4
- import { processURL } from "nextpress/services/utilities/process-url";
5
- import { wpdb } from "nextpress/wpdb/wpdb";
4
+ import { processURL } from "@nextpress/services/utilities/process-url";
5
+ import { wpdb } from "@nextpress/wpdb/wpdb";
6
6
 
7
7
  const excerptLength = nextpressConfig.excerptLength ?? 55;
8
8
 
@@ -1,6 +1,6 @@
1
1
  import { Selectable } from "kysely";
2
2
  import { IPath } from "../common";
3
- import { WpTerm, WpTermTaxonomy } from "nextpress/wpdb/wpdb.interface";
3
+ import { WpTerm, WpTermTaxonomy } from "@nextpress/wpdb/wpdb.interface";
4
4
 
5
5
  /**
6
6
  * Represents term entity.
@@ -1,4 +1,4 @@
1
- import { wpdb } from "nextpress/wpdb/wpdb";
1
+ import { wpdb } from "@nextpress/wpdb/wpdb";
2
2
  import { ITerm } from "./term.interface";
3
3
 
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import { Selectable } from "kysely";
2
- import { WpUser } from "nextpress/wpdb/wpdb.interface";
2
+ import { WpUser } from "@nextpress/wpdb/wpdb.interface";
3
3
 
4
4
  /**
5
5
  * Represents user entity.
@@ -1,6 +1,6 @@
1
1
  import { unserialize } from "php-serialize";
2
2
  import { IUser } from "./user.interface";
3
- import { wpdb } from "nextpress/wpdb/wpdb";
3
+ import { wpdb } from "@nextpress/wpdb/wpdb";
4
4
 
5
5
  export class User implements IUser {
6
6
  constructor(
@@ -1,4 +1,4 @@
1
- import { OptionQuery } from "nextpress/repository/optionquery/option-query";
1
+ import { OptionQuery } from "@nextpress/repository/optionquery/option-query";
2
2
  import { Option } from "../../entities/option/option";
3
3
  import { IOption } from "../../entities/option/option.interface";
4
4
  import { OptionQueryArgs } from "../../repository/optionquery/option-query-args";
@@ -1,9 +1,9 @@
1
- import { PostQueryArgs } from "nextpress/repository/postquery/post-query-args";
1
+ import { PostQueryArgs } from "@nextpress/repository/postquery/post-query-args";
2
2
  import { Post } from "../../entities/post/post";
3
3
  import { IPost } from "../../entities/post/post.interface";
4
4
  import { EntityLoader } from "./entity-loader";
5
5
  import { EntityLoaderBase } from "./entity-loader-base";
6
- import { PostQuery } from "nextpress/repository/postquery/post-query";
6
+ import { PostQuery } from "@nextpress/repository/postquery/post-query";
7
7
 
8
8
  class PostLoader extends EntityLoaderBase<IPost, PostQueryArgs> {
9
9
  private static _instance: PostLoader;
@@ -2,8 +2,8 @@ import { ITerm } from "../../entities/term/term.interface";
2
2
  import { Term } from "../../entities/term/term";
3
3
  import { EntityLoader } from "./entity-loader";
4
4
  import { EntityLoaderBase } from "./entity-loader-base";
5
- import { TermQueryArgs } from "nextpress/repository/termquery/term-query-args";
6
- import { TermQuery } from "nextpress/repository/termquery/term-query";
5
+ import { TermQueryArgs } from "@nextpress/repository/termquery/term-query-args";
6
+ import { TermQuery } from "@nextpress/repository/termquery/term-query";
7
7
 
8
8
  class TermLoader extends EntityLoaderBase<ITerm, TermQueryArgs> {
9
9
  private static _instance: TermLoader;
@@ -2,8 +2,8 @@ import { IUser } from "../../entities/user/user.interface";
2
2
  import { User } from "../../entities/user/user";
3
3
  import { EntityLoader } from "./entity-loader";
4
4
  import { EntityLoaderBase } from "./entity-loader-base";
5
- import { UserQueryArgs } from "nextpress/repository/userquery/user-query-args";
6
- import { UserQuery } from "nextpress/repository/userquery/user-query";
5
+ import { UserQueryArgs } from "@nextpress/repository/userquery/user-query-args";
6
+ import { UserQuery } from "@nextpress/repository/userquery/user-query";
7
7
 
8
8
  class UserLoader extends EntityLoaderBase<IUser, UserQueryArgs> {
9
9
  private static _instance: UserLoader;
@@ -1,7 +1,7 @@
1
1
  import { mapField } from "../../acf-functions/services/map-fields/map-fields";
2
2
  import { IFieldLocation } from "../../entities/common";
3
3
  import { FieldProps } from "../../acf-functions/types/components/field-props";
4
- import { NextpressFieldGroup } from "nextpress/acf-functions/types/acf-field-group";
4
+ import { NextpressFieldGroup } from "@nextpress/acf-functions/types/acf-field-group";
5
5
 
6
6
  /** Specifies location to retrieve fields from. */
7
7
  type Location = IFieldLocation | 'options';
@@ -1,5 +1,5 @@
1
1
  import { ComparisonOperatorExpression, ReferenceExpression } from "kysely";
2
- import { DB } from "nextpress/wpdb/wpdb.interface";
2
+ import { DB } from "@nextpress/wpdb/wpdb.interface";
3
3
 
4
4
  /**
5
5
  * Defines the arguments for querying options.
@@ -2,7 +2,7 @@ import { ComparisonOperatorExpression } from "kysely";
2
2
  import { EntityQuery } from "../../globals/entity-loader/entity-loader";
3
3
  import { OptionQueryArgs } from "./option-query-args";
4
4
  import { IOption } from "../../entities/option/option.interface";
5
- import { wpdb } from "nextpress/wpdb/wpdb";
5
+ import { wpdb } from "@nextpress/wpdb/wpdb";
6
6
 
7
7
  /**
8
8
  * Executes database queries to retrieve option IDs (or keys) based on provided arguments.
@@ -3,8 +3,8 @@ import * as phpSerialize from "php-serialize";
3
3
  import { EntityQuery } from "../../globals/entity-loader/entity-loader";
4
4
  import { IPost } from "../../entities/post/post.interface";
5
5
  import { PostQueryArgs } from "./post-query-args";
6
- import { DB } from "nextpress/wpdb/wpdb.interface";
7
- import { wpdb } from "nextpress/wpdb/wpdb";
6
+ import { DB } from "@nextpress/wpdb/wpdb.interface";
7
+ import { wpdb } from "@nextpress/wpdb/wpdb";
8
8
 
9
9
  /**
10
10
  * Executes database queries to retrieve post IDs and counts based on provided arguments.
@@ -2,8 +2,8 @@ import { QueryCreator } from "kysely";
2
2
  import { EntityQuery } from "../../globals/entity-loader/entity-loader";
3
3
  import { ITerm } from "../../entities/term/term.interface";
4
4
  import { TermQueryArgs } from "./term-query-args";
5
- import { DB } from "nextpress/wpdb/wpdb.interface";
6
- import { wpdb } from "nextpress/wpdb/wpdb";
5
+ import { DB } from "@nextpress/wpdb/wpdb.interface";
6
+ import { wpdb } from "@nextpress/wpdb/wpdb";
7
7
 
8
8
  /**
9
9
  * Executes database queries to retrieve term IDs based on provided arguments.
@@ -2,7 +2,7 @@ import { IUser } from "../../entities/user/user.interface";
2
2
  import { EntityQuery } from "../../globals/entity-loader/entity-loader";
3
3
  import { sql } from "kysely";
4
4
  import { UserQueryArgs } from "./user-query-args";
5
- import { wpdb } from "nextpress/wpdb/wpdb";
5
+ import { wpdb } from "@nextpress/wpdb/wpdb";
6
6
 
7
7
  /**
8
8
  * Executes database queries to retrieve user IDs and counts based on provided arguments.
@@ -1,10 +1,10 @@
1
- import "nextpress/globals/globals";
1
+ import "@nextpress/globals/globals";
2
2
  import "@/app/_css/globals.css";
3
3
  import { LayoutTemplate } from "@/app/_templates/layout";
4
4
  import { cookies, draftMode } from "next/headers";
5
5
  import fonts from "@/fonts";
6
- import { getLanguageAttributes } from "nextpress/services/metadata/get-language-attribute";
7
- import { RenderTheAdminBar } from "nextpress/ui/render-the-admin-bar";
6
+ import { getLanguageAttributes } from "@nextpress/services/metadata/get-language-attribute";
7
+ import { RenderTheAdminBar } from "@nextpress/ui/render-the-admin-bar";
8
8
 
9
9
  const fontClasses = fonts.map(font => font.className).join(' ');
10
10
 
@@ -1,5 +1,5 @@
1
1
  import { Metadata } from "next";
2
- import { NotFoundMetadata, NotFoundTemplate } from "nextpress/template-heirarchy/not-found.tsx/not-found";
2
+ import { NotFoundMetadata, NotFoundTemplate } from "@nextpress/template-heirarchy/not-found.tsx/not-found";
3
3
 
4
4
  /**
5
5
  * Generates the metadata for the generic Not Found page.
@@ -1,8 +1,8 @@
1
1
  import { headers } from "next/headers";
2
2
  import { NextResponse } from "next/server";
3
3
  import { isAuthorized } from "./helpers";
4
- import { acfFieldGroupAutoloader } from "nextpress/acf-functions/core/acf-field-group-autoloader";
5
- import { ACFBuilder } from "nextpress/acf-functions/core/acf-builder";
4
+ import { acfFieldGroupAutoloader } from "@nextpress/acf-functions/core/acf-field-group-autoloader";
5
+ import { ACFBuilder } from "@nextpress/acf-functions/core/acf-builder";
6
6
 
7
7
  /**
8
8
  * Processes GET requests to retrieve built ACF field groups.
@@ -1,8 +1,8 @@
1
1
  import { MetadataResult, RouteProps, TemplateResult } from "../types";
2
2
  import { getPageNumber } from "../helpers";
3
3
  import { notFound } from "next/navigation";
4
- import { queriedObjectState } from "nextpress/globals/globals";
5
- import { AuthorMetadata, AuthorTemplate } from "nextpress/template-heirarchy/archive/author";
4
+ import { queriedObjectState } from "@nextpress/globals/globals";
5
+ import { AuthorMetadata, AuthorTemplate } from "@nextpress/template-heirarchy/archive/author";
6
6
 
7
7
  /**
8
8
  * Resolves the author archive route and maps it to the template hierarchy to return Metadata.
@@ -1,7 +1,7 @@
1
1
  import { MetadataResult, RouteProps, TemplateResult } from "../types";
2
2
  import { getPageNumber } from "../helpers";
3
- import { queriedObjectState } from "nextpress/globals/globals";
4
- import { HomeMetadata, HomeTemplate } from "nextpress/template-heirarchy/home/home";
3
+ import { queriedObjectState } from "@nextpress/globals/globals";
4
+ import { HomeMetadata, HomeTemplate } from "@nextpress/template-heirarchy/home/home";
5
5
 
6
6
  /**
7
7
  * Resolves the post index page (blog home) route and maps it to the template hierarchy to return Metadata.
@@ -2,9 +2,9 @@ import { MetadataResult, RouteProps, TemplateResult } from "../types";
2
2
  import { PostIndexPage } from "./post-index-page";
3
3
  import { getPageNumber } from "../helpers";
4
4
  import { notFound } from "next/navigation";
5
- import { queriedObjectState } from "nextpress/globals/globals";
6
- import { SingleMetadata, SingleTemplate } from "nextpress/template-heirarchy/page/single";
7
- import { PageMetadata, PageTemplate } from "nextpress/template-heirarchy/page/page";
5
+ import { queriedObjectState } from "@nextpress/globals/globals";
6
+ import { SingleMetadata, SingleTemplate } from "@nextpress/template-heirarchy/page/single";
7
+ import { PageMetadata, PageTemplate } from "@nextpress/template-heirarchy/page/page";
8
8
 
9
9
  /**
10
10
  * Resolves the singular page route and maps it to the template hierarchy to return Metadata.
@@ -1,7 +1,7 @@
1
- import { queriedObjectState } from "nextpress/globals/globals";
1
+ import { queriedObjectState } from "@nextpress/globals/globals";
2
2
  import { MetadataResult, RouteProps, TemplateResult } from "../types";
3
3
  import { PostIndexPage } from "./post-index-page";
4
- import { PageMetadata, PageTemplate } from "nextpress/template-heirarchy/page/page";
4
+ import { PageMetadata, PageTemplate } from "@nextpress/template-heirarchy/page/page";
5
5
 
6
6
  /**
7
7
  * Resolves the site front page route and maps it to the template hierarchy to return Metadata.
@@ -1,10 +1,10 @@
1
1
  import { MetadataResult, RouteProps, TemplateResult } from "../types";
2
2
  import { getPageNumber } from "../helpers";
3
3
  import { notFound } from "next/navigation";
4
- import { queriedObjectState } from "nextpress/globals/globals";
5
- import { CategoryMetadata, CategoryTemplate } from "nextpress/template-heirarchy/archive/category";
6
- import { TagMetadata, TagTemplate } from "nextpress/template-heirarchy/archive/tag";
7
- import { TaxonomyMetadata, TaxonomyTemplate } from "nextpress/template-heirarchy/archive/taxonomy";
4
+ import { queriedObjectState } from "@nextpress/globals/globals";
5
+ import { CategoryMetadata, CategoryTemplate } from "@nextpress/template-heirarchy/archive/category";
6
+ import { TagMetadata, TagTemplate } from "@nextpress/template-heirarchy/archive/tag";
7
+ import { TaxonomyMetadata, TaxonomyTemplate } from "@nextpress/template-heirarchy/archive/taxonomy";
8
8
 
9
9
  /**
10
10
  * Resolves the term archive route and maps it to the template hierarchy to return Metadata.
@@ -2,7 +2,7 @@ import { Metadata } from "next";
2
2
  import { JSX } from "react";
3
3
  import { loadMetadata, loadTemplate } from "../_autoloader/template-autoloader";
4
4
  import { ArchiveMetadata, ArchiveTemplate } from "./archive";
5
- import { capitalizeFirstLetter } from "nextpress/services/utilities/capitalise-first-letter";
5
+ import { capitalizeFirstLetter } from "@nextpress/services/utilities/capitalise-first-letter";
6
6
 
7
7
  /**
8
8
  * Loads the metadata for a Post Type Archive template based on the given post type.
@@ -2,7 +2,7 @@ import { Metadata } from "next";
2
2
  import { JSX } from "react";
3
3
  import { loadMetadata, loadTemplate } from "../_autoloader/template-autoloader";
4
4
  import { SingularMetadata, SingularTemplate } from "./singular";
5
- import { capitalizeFirstLetter } from "nextpress/services/utilities/capitalise-first-letter";
5
+ import { capitalizeFirstLetter } from "@nextpress/services/utilities/capitalise-first-letter";
6
6
 
7
7
  /**
8
8
  * Loads the metadata for a Post Type template based on the provided post type string.
@@ -2,7 +2,7 @@
2
2
  import { useEffect, useState } from "react";
3
3
  import { usePathname } from "next/navigation";
4
4
  import Script from "next/script";
5
- import { ksesPost } from "nextpress/services/utilities/kses-post";
5
+ import { ksesPost } from "@nextpress/services/utilities/kses-post";
6
6
 
7
7
  type Props = {
8
8
  loggedInUserId?: number
@@ -1,5 +1,5 @@
1
- import { getThemeMods } from "nextpress/services/get-theme-mods";
2
- import { getBlogname } from "nextpress/services/metadata/get-blogname";
1
+ import { getThemeMods } from "@nextpress/services/get-theme-mods";
2
+ import { getBlogname } from "@nextpress/services/metadata/get-blogname";
3
3
  import { RenderAttachmentImage } from "./render-attachment-image";
4
4
 
5
5
  type Props = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextpress-core",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Nextpress Core",
5
5
  "keywords": [],
6
6
  "bin": {