nextjs-cms 0.9.30 → 0.9.32

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 (96) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +279 -279
  3. package/dist/api/actions/pages.d.ts +3 -3
  4. package/dist/api/client.d.ts +30 -0
  5. package/dist/api/client.d.ts.map +1 -0
  6. package/dist/api/client.js +82 -0
  7. package/dist/api/index.d.ts +1 -974
  8. package/dist/api/index.d.ts.map +1 -1
  9. package/dist/api/index.js +0 -13
  10. package/dist/api/lib/serverActions.d.ts +13 -49
  11. package/dist/api/lib/serverActions.d.ts.map +1 -1
  12. package/dist/api/lib/serverActions.js +103 -31
  13. package/dist/api/root.d.ts +18 -1916
  14. package/dist/api/root.d.ts.map +1 -1
  15. package/dist/api/root.js +18 -83
  16. package/dist/api/routers/config.d.ts.map +1 -1
  17. package/dist/api/routers/gallery.d.ts +1 -0
  18. package/dist/api/routers/gallery.d.ts.map +1 -1
  19. package/dist/api/routers/gallery.js +36 -8
  20. package/dist/api/routers/hasItemsSection.d.ts +5 -30
  21. package/dist/api/routers/hasItemsSection.d.ts.map +1 -1
  22. package/dist/api/routers/navigation.d.ts +3 -3
  23. package/dist/api/routers/simpleSection.d.ts +3 -15
  24. package/dist/api/routers/simpleSection.d.ts.map +1 -1
  25. package/dist/api/server.d.ts +2748 -0
  26. package/dist/api/server.d.ts.map +1 -0
  27. package/dist/api/server.js +100 -0
  28. package/dist/api/trpc/error-logging.d.ts +14 -0
  29. package/dist/api/trpc/error-logging.d.ts.map +1 -0
  30. package/dist/api/trpc/error-logging.js +75 -0
  31. package/dist/api/trpc/root.d.ts +3 -3
  32. package/dist/api/trpc/root.d.ts.map +1 -1
  33. package/dist/api/trpc/routers/config.d.ts.map +1 -1
  34. package/dist/api/trpc/routers/hasItemsSection.d.ts.map +1 -1
  35. package/dist/api/trpc/routers/navigation.d.ts +3 -3
  36. package/dist/api/trpc/routers/simpleSection.d.ts.map +1 -1
  37. package/dist/api/trpc/server.d.ts +9 -9
  38. package/dist/api/trpc/server.d.ts.map +1 -1
  39. package/dist/api/utils/async-caller-proxy.d.ts +2 -0
  40. package/dist/api/utils/async-caller-proxy.d.ts.map +1 -0
  41. package/dist/api/utils/async-caller-proxy.js +36 -0
  42. package/dist/api/utils/lazy-caller-proxy.d.ts +2 -0
  43. package/dist/api/utils/lazy-caller-proxy.d.ts.map +1 -0
  44. package/dist/api/utils/lazy-caller-proxy.js +36 -0
  45. package/dist/api/utils/router-types.d.ts +7 -0
  46. package/dist/api/utils/router-types.d.ts.map +1 -0
  47. package/dist/api/utils/router-types.js +0 -0
  48. package/dist/auth/trpc.d.ts +1 -1
  49. package/dist/auth/trpc.d.ts.map +1 -1
  50. package/dist/auth/trpc.js +0 -1
  51. package/dist/cli/lib/db-config.js +10 -10
  52. package/dist/cli/lib/update-sections.d.ts.map +1 -1
  53. package/dist/cli/lib/update-sections.js +29 -24
  54. package/dist/core/config/config-loader.d.ts +2 -2
  55. package/dist/core/db/table-checker/MysqlTable.js +10 -10
  56. package/dist/core/factories/section-factory-with-esbuild.js +9 -9
  57. package/dist/core/factories/section-factory-with-jiti.js +9 -9
  58. package/dist/core/sections/category.d.ts +2 -2
  59. package/dist/core/sections/hasItems.d.ts +2 -2
  60. package/dist/core/sections/section.d.ts +2 -2
  61. package/dist/core/sections/simple.d.ts +2 -2
  62. package/dist/plugins/loader.d.ts +3 -1
  63. package/dist/plugins/loader.d.ts.map +1 -1
  64. package/dist/plugins/loader.js +28 -6
  65. package/dist/plugins/manifest.d.ts +28 -0
  66. package/dist/plugins/manifest.d.ts.map +1 -0
  67. package/dist/plugins/manifest.js +83 -0
  68. package/dist/plugins/registry.d.ts +22 -0
  69. package/dist/plugins/registry.d.ts.map +1 -0
  70. package/dist/plugins/registry.js +25 -0
  71. package/dist/translations/base/en.d.ts +6 -0
  72. package/dist/translations/base/en.d.ts.map +1 -1
  73. package/dist/translations/base/en.js +6 -0
  74. package/dist/translations/client.d.ts +76 -4
  75. package/dist/translations/client.d.ts.map +1 -1
  76. package/dist/translations/server.d.ts +76 -4
  77. package/dist/translations/server.d.ts.map +1 -1
  78. package/dist/utils/log.d.ts +18 -0
  79. package/dist/utils/log.d.ts.map +1 -0
  80. package/dist/utils/log.js +28 -0
  81. package/package.json +1 -1
  82. package/dist/core/fields/dateRange.d.ts +0 -115
  83. package/dist/core/fields/dateRange.d.ts.map +0 -1
  84. package/dist/core/fields/dateRange.js +0 -149
  85. package/dist/translations/locale-cookie.d.ts +0 -24
  86. package/dist/translations/locale-cookie.d.ts.map +0 -1
  87. package/dist/translations/locale-cookie.js +0 -44
  88. package/dist/translations/locale-utils.d.ts +0 -8
  89. package/dist/translations/locale-utils.d.ts.map +0 -1
  90. package/dist/translations/locale-utils.js +0 -11
  91. package/dist/translations/localization.d.ts +0 -40
  92. package/dist/translations/localization.d.ts.map +0 -1
  93. package/dist/translations/localization.js +0 -48
  94. package/dist/validators/dateRange.d.ts +0 -11
  95. package/dist/validators/dateRange.d.ts.map +0 -1
  96. package/dist/validators/dateRange.js +0 -16
@@ -1,6 +1,6 @@
1
+ import type { IconName } from 'lucide-react/dynamic';
1
2
  import type { PluginConfigEntry } from '../core/config/config-loader.js';
2
3
  import type { MultilingualString } from '../translations/language-utils.js';
3
- import type { IconName } from 'lucide-react/dynamic';
4
4
  import type { CMSPlugin, PluginRoute } from './types.js';
5
5
  export type { CMSPlugin, CMSPluginDescriptor, CMSPluginDescriptorMultiRoute, CMSPluginDescriptorSingleRoute, CMSPluginMultiRoute, CMSPluginSingleRoute, PluginInitContext, PluginRoute, PluginRouteOverride, PluginRouteWithoutComponent, PluginRouteWithComponent, PluginRuntimeConfigEntry, } from './types.js';
6
6
  /**
@@ -25,6 +25,8 @@ export interface LoadedPluginRoute extends PluginRoute {
25
25
  pluginId: string;
26
26
  pluginName: string;
27
27
  }
28
+ type PackageResolver = (id: string) => unknown;
29
+ export declare const resolveServerOnlyEmptyPath: (resolvers: PackageResolver[]) => string;
28
30
  export declare const loadPluginModule: (pluginPackage: string) => Promise<unknown>;
29
31
  export declare function loadPlugins(): Promise<LoadedPlugin[]>;
30
32
  export declare function getPluginRoutes(): Promise<LoadedPluginRoute[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/plugins/loader.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAExE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAC3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAGpD,OAAO,KAAK,EACR,SAAS,EAET,WAAW,EACd,MAAM,YAAY,CAAA;AAEnB,YAAY,EACR,SAAS,EACT,mBAAmB,EACnB,6BAA6B,EAC7B,8BAA8B,EAC9B,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EACxB,wBAAwB,GAC3B,MAAM,YAAY,CAAA;AAEnB;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC7C,IAAI,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,iBAAiB,CAAA;IACzB,MAAM,EAAE,cAAc,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,YAAY;IACzB,YAAY,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;IACpF,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,OAAO,CAAC,EAAE,SAAS,GAAG,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAA;CAC/D;AAED,MAAM,WAA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OAAO,CAAC,CAGpF"}
@@ -1,12 +1,12 @@
1
- // import 'server-only'
2
- if (typeof window !== 'undefined') {
3
- throw new Error('This module can only run on the server');
4
- }
5
1
  import { createRequire } from 'module';
6
2
  import path from 'path';
7
3
  import { getCMSConfig, getConfigImportVersion } from '../core/config/index.js';
4
+ import { logError, logInfo, logWarn } from '../utils/console-log.js';
8
5
  import { derivePluginName, derivePluginRouterKey } from './derive.js';
9
- import { logWarn, logError, logInfo } from '../utils/console-log.js';
6
+ // import 'server-only'
7
+ if (typeof window !== 'undefined') {
8
+ throw new Error('This module can only run on the server');
9
+ }
10
10
  let cachedPlugins = null;
11
11
  let cachedConfigVersion = -1;
12
12
  let loadPromise = null;
@@ -14,9 +14,31 @@ let jitiInstance = null;
14
14
  const appRequire = createRequire(path.join(process.cwd(), 'package.json'));
15
15
  const pkgRequire = createRequire(import.meta.url);
16
16
  let serverOnlyEmptyPath = null;
17
+ const SERVER_ONLY_PACKAGE = ['server', 'only'].join('-');
18
+ const SERVER_ONLY_EMPTY_FILE = 'empty.js';
19
+ export const resolveServerOnlyEmptyPath = (resolvers) => {
20
+ const errors = [];
21
+ for (const resolvePackage of resolvers) {
22
+ try {
23
+ const resolved = resolvePackage(SERVER_ONLY_PACKAGE);
24
+ if (typeof resolved === 'string') {
25
+ return path.join(path.dirname(resolved), SERVER_ONLY_EMPTY_FILE);
26
+ }
27
+ errors.push(`resolver returned ${typeof resolved}`);
28
+ }
29
+ catch (error) {
30
+ errors.push(error instanceof Error ? error.message : String(error));
31
+ }
32
+ }
33
+ throw new Error(`[plugins] Unable to resolve "${SERVER_ONLY_PACKAGE}/${SERVER_ONLY_EMPTY_FILE}" for plugin loading. ` +
34
+ errors.join('; '));
35
+ };
17
36
  const getServerOnlyEmptyPath = () => {
18
37
  if (!serverOnlyEmptyPath) {
19
- serverOnlyEmptyPath = path.join(path.dirname(pkgRequire.resolve('server-only')), 'empty.js');
38
+ serverOnlyEmptyPath = resolveServerOnlyEmptyPath([
39
+ (id) => appRequire.resolve(id),
40
+ (id) => pkgRequire.resolve(id, { paths: [process.cwd()] }),
41
+ ]);
20
42
  }
21
43
  return serverOnlyEmptyPath;
22
44
  };
@@ -0,0 +1,28 @@
1
+ import type { PluginConfigEntry } from '../core/config/config-loader.js';
2
+ import type { MultilingualString } from '../translations/language-utils.js';
3
+ import type { IconName } from 'lucide-react/dynamic';
4
+ export interface PluginManifestRoute {
5
+ path: string;
6
+ title: MultilingualString;
7
+ icon?: IconName;
8
+ component?: string;
9
+ }
10
+ export interface PluginManifest {
11
+ name: string;
12
+ registryName: string;
13
+ title: MultilingualString;
14
+ routes?: PluginManifestRoute[];
15
+ }
16
+ export interface LoadedPluginManifestRoute extends PluginManifestRoute {
17
+ pluginId: string;
18
+ pluginName: string;
19
+ pluginRegistryName: string;
20
+ }
21
+ export interface LoadedPluginManifest {
22
+ config: PluginConfigEntry;
23
+ manifest: PluginManifest;
24
+ moduleName: string;
25
+ }
26
+ export declare function getPluginManifests(): Promise<LoadedPluginManifest[]>;
27
+ export declare function getPluginRouteManifests(): Promise<LoadedPluginManifestRoute[]>;
28
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/plugins/manifest.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAC3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAEpD,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,kBAAkB,CAAA;IACzB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,kBAAkB,CAAA;IACzB,MAAM,CAAC,EAAE,mBAAmB,EAAE,CAAA;CACjC;AAED,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IAClE,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,EAAE,MAAM,CAAA;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,iBAAiB,CAAA;IACzB,QAAQ,EAAE,cAAc,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;CACrB;AAoDD,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC,CA+B1E;AAED,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAUpF"}
@@ -0,0 +1,83 @@
1
+ import { createRequire } from 'module';
2
+ import path from 'path';
3
+ import fs from 'fs';
4
+ import { getCMSConfig } from '../core/config/index.js';
5
+ const appRequire = createRequire(path.join(process.cwd(), 'package.json'));
6
+ const pkgRequire = createRequire(import.meta.url);
7
+ const resolvePluginPackageJson = (pluginPackage) => {
8
+ const target = `${pluginPackage}/package.json`;
9
+ try {
10
+ return appRequire.resolve(target);
11
+ }
12
+ catch {
13
+ try {
14
+ return pkgRequire.resolve(target, { paths: [process.cwd()] });
15
+ }
16
+ catch {
17
+ return null;
18
+ }
19
+ }
20
+ };
21
+ const readManifestFromPackage = (pluginPackage) => {
22
+ const pkgJsonPath = resolvePluginPackageJson(pluginPackage);
23
+ if (!pkgJsonPath) {
24
+ console.warn(`[plugins] Could not resolve "${pluginPackage}/package.json".`);
25
+ return null;
26
+ }
27
+ let pkg;
28
+ try {
29
+ pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
30
+ }
31
+ catch (error) {
32
+ console.warn(`[plugins] Failed to read "${pkgJsonPath}":`, error);
33
+ return null;
34
+ }
35
+ const manifest = pkg.pluginManifest;
36
+ if (!manifest) {
37
+ console.warn(`[plugins] Package "${pluginPackage}" is missing the "pluginManifest" field in package.json. ` +
38
+ `Plugins must declare metadata statically so the CLI can read it without evaluating plugin code.`);
39
+ return null;
40
+ }
41
+ if (!manifest.name || !manifest.registryName || !manifest.title) {
42
+ console.warn(`[plugins] Package "${pluginPackage}" has an invalid "pluginManifest" — required fields: name, registryName, title.`);
43
+ return null;
44
+ }
45
+ return manifest;
46
+ };
47
+ export async function getPluginManifests() {
48
+ const config = await getCMSConfig();
49
+ const registrations = config.plugins ?? [];
50
+ const seenPackages = new Set();
51
+ const seenNames = new Set();
52
+ const loaded = [];
53
+ for (const registration of registrations) {
54
+ if (!registration.package)
55
+ continue;
56
+ if (seenPackages.has(registration.package))
57
+ continue;
58
+ const manifest = readManifestFromPackage(registration.package);
59
+ if (!manifest)
60
+ continue;
61
+ if (seenNames.has(manifest.name)) {
62
+ console.warn(`[plugins] Duplicate plugin name "${manifest.name}" — skipping "${registration.package}".`);
63
+ continue;
64
+ }
65
+ seenPackages.add(registration.package);
66
+ seenNames.add(manifest.name);
67
+ loaded.push({
68
+ config: registration,
69
+ manifest,
70
+ moduleName: registration.package,
71
+ });
72
+ }
73
+ return loaded;
74
+ }
75
+ export async function getPluginRouteManifests() {
76
+ const loaded = await getPluginManifests();
77
+ return loaded.flatMap((entry) => (entry.manifest.routes ?? []).map((route) => ({
78
+ ...route,
79
+ pluginId: entry.config.package,
80
+ pluginName: entry.manifest.name,
81
+ pluginRegistryName: entry.manifest.registryName,
82
+ })));
83
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Static import map for all official @nextjscms plugins.
3
+ *
4
+ * Why this file exists: the plugin loader needs to import plugin packages by
5
+ * name at runtime. Bare `await import(variable)` calls are rejected by
6
+ * Turbopack/webpack as "too dynamic" because the bundler cannot statically
7
+ * see which packages may be loaded. Listing each package as a literal
8
+ * `() => import('@nextjscms/plugin-x')` thunk lets the bundler analyze the
9
+ * import sites, and the host's module loader applies the correct export
10
+ * conditions at runtime — most importantly "react-server" during RSC
11
+ * requests, so plugin transitive deps marked `import 'server-only'` resolve
12
+ * to a no-op instead of throwing.
13
+ *
14
+ * Each thunk is wrapped in its own arrow so the import is deferred until the
15
+ * plugin is actually configured in cms.config.ts. Plugins not installed in
16
+ * the host app will fail at thunk invocation, which the loader treats as a
17
+ * normal "plugin not available" outcome.
18
+ *
19
+ * When a new official plugin is published, add an entry here.
20
+ */
21
+ export declare const officialPluginRegistry: Record<string, () => Promise<unknown>>;
22
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/plugins/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAIzE,CAAA"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Static import map for all official @nextjscms plugins.
3
+ *
4
+ * Why this file exists: the plugin loader needs to import plugin packages by
5
+ * name at runtime. Bare `await import(variable)` calls are rejected by
6
+ * Turbopack/webpack as "too dynamic" because the bundler cannot statically
7
+ * see which packages may be loaded. Listing each package as a literal
8
+ * `() => import('@nextjscms/plugin-x')` thunk lets the bundler analyze the
9
+ * import sites, and the host's module loader applies the correct export
10
+ * conditions at runtime — most importantly "react-server" during RSC
11
+ * requests, so plugin transitive deps marked `import 'server-only'` resolve
12
+ * to a no-op instead of throwing.
13
+ *
14
+ * Each thunk is wrapped in its own arrow so the import is deferred until the
15
+ * plugin is actually configured in cms.config.ts. Plugins not installed in
16
+ * the host app will fail at thunk invocation, which the loader treats as a
17
+ * normal "plugin not available" outcome.
18
+ *
19
+ * When a new official plugin is published, add an entry here.
20
+ */
21
+ export const officialPluginRegistry = {
22
+ '@nextjscms/plugin-cpanel-dashboard': () => import('@nextjscms/plugin-cpanel-dashboard'),
23
+ '@nextjscms/plugin-cpanel-emails': () => import('@nextjscms/plugin-cpanel-emails'),
24
+ '@nextjscms/plugin-google-analytics': () => import('@nextjscms/plugin-google-analytics'),
25
+ };
@@ -373,6 +373,12 @@ declare const _default: {
373
373
  readonly categorySections: "Category Sections";
374
374
  readonly sectionsWithItems: "Sections with Items";
375
375
  readonly simpleSections: "Simple Sections";
376
+ readonly pluginError: "Plugin error";
377
+ readonly pluginFailedToLoad: "Plugin failed to load";
378
+ readonly pluginFailedToLoadDescription: "This plugin could not be rendered. Retry the request, or check the server logs if the problem continues.";
379
+ readonly unexpectedPluginError: "An unexpected error occurred while rendering this plugin.";
380
+ readonly errorDigest: "Error digest";
381
+ readonly retry: "Retry";
376
382
  readonly cpanelPluginMisconfigured: "cPanel dashboard plugin misconfigured: missing tRPC client.";
377
383
  readonly loadingCpanelData: "Loading cPanel usage…";
378
384
  readonly unableToLoadCpanelData: "Unable to load cPanel data";
@@ -1 +1 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../src/translations/base/en.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBAqgBU"}
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../src/translations/base/en.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBA4gBU"}
@@ -373,6 +373,12 @@ export default {
373
373
  categorySections: 'Category Sections',
374
374
  sectionsWithItems: 'Sections with Items',
375
375
  simpleSections: 'Simple Sections',
376
+ pluginError: 'Plugin error',
377
+ pluginFailedToLoad: 'Plugin failed to load',
378
+ pluginFailedToLoadDescription: 'This plugin could not be rendered. Retry the request, or check the server logs if the problem continues.',
379
+ unexpectedPluginError: 'An unexpected error occurred while rendering this plugin.',
380
+ errorDigest: 'Error digest',
381
+ retry: 'Retry',
376
382
  cpanelPluginMisconfigured: 'cPanel dashboard plugin misconfigured: missing tRPC client.',
377
383
  loadingCpanelData: 'Loading cPanel usage…',
378
384
  unableToLoadCpanelData: 'Unable to load cPanel data',