nextjs-cms 0.9.29 → 0.9.30

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 (89) 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/index.d.ts +974 -1
  5. package/dist/api/index.d.ts.map +1 -1
  6. package/dist/api/index.js +13 -0
  7. package/dist/api/lib/serverActions.d.ts +49 -13
  8. package/dist/api/lib/serverActions.d.ts.map +1 -1
  9. package/dist/api/lib/serverActions.js +31 -103
  10. package/dist/api/root.d.ts +1916 -18
  11. package/dist/api/root.d.ts.map +1 -1
  12. package/dist/api/root.js +83 -18
  13. package/dist/api/routers/config.d.ts.map +1 -1
  14. package/dist/api/routers/gallery.d.ts +0 -1
  15. package/dist/api/routers/gallery.d.ts.map +1 -1
  16. package/dist/api/routers/gallery.js +8 -36
  17. package/dist/api/routers/hasItemsSection.d.ts +30 -5
  18. package/dist/api/routers/hasItemsSection.d.ts.map +1 -1
  19. package/dist/api/routers/navigation.d.ts +3 -3
  20. package/dist/api/routers/simpleSection.d.ts +15 -3
  21. package/dist/api/routers/simpleSection.d.ts.map +1 -1
  22. package/dist/api/trpc/root.d.ts +3 -3
  23. package/dist/api/trpc/root.d.ts.map +1 -1
  24. package/dist/api/trpc/routers/config.d.ts.map +1 -1
  25. package/dist/api/trpc/routers/hasItemsSection.d.ts.map +1 -1
  26. package/dist/api/trpc/routers/navigation.d.ts +3 -3
  27. package/dist/api/trpc/routers/simpleSection.d.ts.map +1 -1
  28. package/dist/api/trpc/server.d.ts +9 -9
  29. package/dist/api/trpc/server.d.ts.map +1 -1
  30. package/dist/auth/trpc.d.ts +1 -1
  31. package/dist/auth/trpc.d.ts.map +1 -1
  32. package/dist/auth/trpc.js +1 -0
  33. package/dist/cli/lib/db-config.js +10 -10
  34. package/dist/cli/lib/update-sections.d.ts.map +1 -1
  35. package/dist/cli/lib/update-sections.js +24 -29
  36. package/dist/core/db/table-checker/MysqlTable.js +10 -10
  37. package/dist/core/factories/section-factory-with-esbuild.js +9 -9
  38. package/dist/core/factories/section-factory-with-jiti.js +9 -9
  39. package/dist/core/fields/dateRange.d.ts +115 -0
  40. package/dist/core/fields/dateRange.d.ts.map +1 -0
  41. package/dist/core/fields/dateRange.js +149 -0
  42. package/dist/core/sections/category.d.ts +42 -42
  43. package/dist/core/sections/hasItems.d.ts +42 -42
  44. package/dist/core/sections/section.d.ts +22 -22
  45. package/dist/core/sections/simple.d.ts +8 -8
  46. package/dist/plugins/derive.d.ts +0 -8
  47. package/dist/plugins/derive.d.ts.map +1 -1
  48. package/dist/plugins/derive.js +0 -32
  49. package/dist/plugins/server.d.ts +1 -1
  50. package/dist/plugins/server.d.ts.map +1 -1
  51. package/dist/plugins/server.js +1 -1
  52. package/dist/translations/client.d.ts +4 -4
  53. package/dist/translations/locale-cookie.d.ts +24 -0
  54. package/dist/translations/locale-cookie.d.ts.map +1 -0
  55. package/dist/translations/locale-cookie.js +44 -0
  56. package/dist/translations/locale-utils.d.ts +8 -0
  57. package/dist/translations/locale-utils.d.ts.map +1 -0
  58. package/dist/translations/locale-utils.js +11 -0
  59. package/dist/translations/localization.d.ts +40 -0
  60. package/dist/translations/localization.d.ts.map +1 -0
  61. package/dist/translations/localization.js +48 -0
  62. package/dist/validators/dateRange.d.ts +11 -0
  63. package/dist/validators/dateRange.d.ts.map +1 -0
  64. package/dist/validators/dateRange.js +16 -0
  65. package/package.json +1 -1
  66. package/dist/api/client.d.ts +0 -30
  67. package/dist/api/client.d.ts.map +0 -1
  68. package/dist/api/client.js +0 -82
  69. package/dist/api/server.d.ts +0 -2748
  70. package/dist/api/server.d.ts.map +0 -1
  71. package/dist/api/server.js +0 -100
  72. package/dist/api/utils/async-caller-proxy.d.ts +0 -2
  73. package/dist/api/utils/async-caller-proxy.d.ts.map +0 -1
  74. package/dist/api/utils/async-caller-proxy.js +0 -36
  75. package/dist/api/utils/lazy-caller-proxy.d.ts +0 -2
  76. package/dist/api/utils/lazy-caller-proxy.d.ts.map +0 -1
  77. package/dist/api/utils/lazy-caller-proxy.js +0 -36
  78. package/dist/api/utils/router-types.d.ts +0 -7
  79. package/dist/api/utils/router-types.d.ts.map +0 -1
  80. package/dist/api/utils/router-types.js +0 -0
  81. package/dist/plugins/manifest.d.ts +0 -28
  82. package/dist/plugins/manifest.d.ts.map +0 -1
  83. package/dist/plugins/manifest.js +0 -83
  84. package/dist/plugins/registry.d.ts +0 -22
  85. package/dist/plugins/registry.d.ts.map +0 -1
  86. package/dist/plugins/registry.js +0 -25
  87. package/dist/utils/log.d.ts +0 -18
  88. package/dist/utils/log.d.ts.map +0 -1
  89. package/dist/utils/log.js +0 -28
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/api/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAUjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAEvF,MAAM,WAAW,uBAAuB,CAAC,KAAK,SAAS,YAAY;IAC/D,OAAO,CAAC,EAAE,0BAA0B,CAAC,KAAK,CAAC,CAAA;IAC3C,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;CACjE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,KAAK,SAAS,YAAY,GAAG,EAAE,EAClE,IAAI,GAAE,uBAAuB,CAAC,KAAK,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,100 +0,0 @@
1
- import 'server-only';
2
- import { createHydrationHelpers } from '@trpc/react-query/rsc';
3
- import { fetchRequestHandler } from '@trpc/server/adapters/fetch';
4
- import { headers } from 'next/headers';
5
- import { cache } from 'react';
6
- import { getConfigImportVersion } from '../core/config/index.js';
7
- import { loadPlugins } from '../plugins/loader.js';
8
- import { coreRouters } from './root.js';
9
- import { createCallerFactory, createTRPCContext, router } from './trpc.js';
10
- import { createQueryClient } from './trpc/query-client.js';
11
- import { createAsyncCallerProxy } from './utils/async-caller-proxy.js';
12
- export function createTRPCRouter(opts = {}) {
13
- const userRouters = (opts.routers ?? {});
14
- for (const key of Object.keys(userRouters)) {
15
- if (key in coreRouters) {
16
- throw new Error(`[trpc] Router key "${key}" conflicts with a core router.`);
17
- }
18
- }
19
- const appRouter = router({
20
- ...coreRouters,
21
- ...userRouters,
22
- });
23
- let cachedRouter = null;
24
- let pendingRouter = null;
25
- let cachedVersion = -1;
26
- let pendingVersion = -1;
27
- async function getMergedRouter() {
28
- const currentVersion = getConfigImportVersion();
29
- if (cachedRouter && cachedVersion === currentVersion) {
30
- return cachedRouter;
31
- }
32
- if (pendingRouter && pendingVersion === currentVersion) {
33
- return pendingRouter;
34
- }
35
- cachedRouter = null;
36
- pendingVersion = currentVersion;
37
- pendingRouter = (async () => {
38
- const loadedPlugins = await loadPlugins();
39
- const pluginRouters = {};
40
- const seen = new Set([...Object.keys(coreRouters), ...Object.keys(userRouters)]);
41
- for (const plugin of loadedPlugins) {
42
- if (!plugin.plugin.router)
43
- continue;
44
- if (seen.has(plugin.routerKey)) {
45
- const message = `[plugins] Router key "${plugin.routerKey}" conflicts with core/user router. Skipping.`;
46
- throw new Error(message);
47
- }
48
- pluginRouters[plugin.routerKey] = plugin.plugin.router;
49
- seen.add(plugin.routerKey);
50
- }
51
- const mergedRouter = router({
52
- ...coreRouters,
53
- ...pluginRouters,
54
- ...userRouters,
55
- });
56
- cachedRouter = mergedRouter;
57
- cachedVersion = currentVersion;
58
- return mergedRouter;
59
- })();
60
- try {
61
- return await pendingRouter;
62
- }
63
- finally {
64
- if (pendingVersion === currentVersion) {
65
- pendingRouter = null;
66
- }
67
- }
68
- }
69
- const createContext = cache(async () => {
70
- const heads = new Headers(await headers());
71
- heads.set('x-trpc-source', 'rsc');
72
- return createTRPCContext({
73
- headers: heads,
74
- });
75
- });
76
- const getQueryClient = cache(createQueryClient);
77
- const getCaller = cache(async () => (await getMergedRouter()).createCaller(await createContext()));
78
- const callerProxy = createAsyncCallerProxy(getCaller);
79
- const helpers = createHydrationHelpers(callerProxy, getQueryClient);
80
- const handler = async (req) => fetchRequestHandler({
81
- endpoint: '/api/trpc',
82
- req,
83
- router: await getMergedRouter(),
84
- createContext: () => createTRPCContext({ headers: req.headers }),
85
- onError: opts.onError ??
86
- (process.env.NODE_ENV === 'development'
87
- ? ({ path, error }) => {
88
- console.error(`tRPC failed on ${path ?? '<no-path>'}: ${error.message}`);
89
- }
90
- : undefined),
91
- });
92
- return {
93
- appRouter,
94
- handler: { GET: handler, POST: handler },
95
- api: helpers.trpc,
96
- HydrateClient: helpers.HydrateClient,
97
- createCaller: createCallerFactory(appRouter),
98
- getRouter: getMergedRouter,
99
- };
100
- }
@@ -1,2 +0,0 @@
1
- export declare function createAsyncCallerProxy<TCaller>(getCaller: () => Promise<TCaller>): TCaller;
2
- //# sourceMappingURL=async-caller-proxy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"async-caller-proxy.d.ts","sourceRoot":"","sources":["../../../src/api/utils/async-caller-proxy.ts"],"names":[],"mappings":"AAWA,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAyB1F"}
@@ -1,36 +0,0 @@
1
- const resolveCallerPath = (root, path) => {
2
- let current = root;
3
- for (const key of path) {
4
- if (!current || (typeof current !== 'object' && typeof current !== 'function')) {
5
- return undefined;
6
- }
7
- current = current[key];
8
- }
9
- return current;
10
- };
11
- export function createAsyncCallerProxy(getCaller) {
12
- const callProcedure = async (path, args) => {
13
- const caller = await getCaller();
14
- const proc = resolveCallerPath(caller, path);
15
- if (typeof proc !== 'function') {
16
- throw new Error(`tRPC procedure not found: ${path.join('.')}`);
17
- }
18
- return proc(...args);
19
- };
20
- const createCallerProxy = (path = []) => {
21
- const proxyTarget = (...args) => callProcedure(path, args);
22
- return new Proxy(proxyTarget, {
23
- get(_target, prop) {
24
- if (prop === 'then')
25
- return undefined;
26
- if (typeof prop !== 'string')
27
- return undefined;
28
- return createCallerProxy([...path, prop]);
29
- },
30
- apply(_target, _thisArg, args) {
31
- return callProcedure(path, args);
32
- },
33
- });
34
- };
35
- return createCallerProxy();
36
- }
@@ -1,2 +0,0 @@
1
- export declare function createLazyCallerProxy<TCaller>(getCaller: () => Promise<TCaller>): TCaller;
2
- //# sourceMappingURL=lazy-caller-proxy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lazy-caller-proxy.d.ts","sourceRoot":"","sources":["../../../src/api/utils/lazy-caller-proxy.ts"],"names":[],"mappings":"AAWA,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAyBzF"}
@@ -1,36 +0,0 @@
1
- const resolveCallerPath = (root, path) => {
2
- let current = root;
3
- for (const key of path) {
4
- if (!current || (typeof current !== 'object' && typeof current !== 'function')) {
5
- return undefined;
6
- }
7
- current = current[key];
8
- }
9
- return current;
10
- };
11
- export function createLazyCallerProxy(getCaller) {
12
- const callProcedure = async (path, args) => {
13
- const caller = await getCaller();
14
- const proc = resolveCallerPath(caller, path);
15
- if (typeof proc !== 'function') {
16
- throw new Error(`tRPC procedure not found: ${path.join('.')}`);
17
- }
18
- return proc(...args);
19
- };
20
- const createCallerProxy = (path = []) => {
21
- const proxyTarget = (...args) => callProcedure(path, args);
22
- return new Proxy(proxyTarget, {
23
- get(_target, prop) {
24
- if (prop === 'then')
25
- return undefined;
26
- if (typeof prop !== 'string')
27
- return undefined;
28
- return createCallerProxy([...path, prop]);
29
- },
30
- apply(_target, _thisArg, args) {
31
- return callProcedure(path, args);
32
- },
33
- });
34
- };
35
- return createCallerProxy();
36
- }
@@ -1,7 +0,0 @@
1
- import type { AnyRouter } from '@trpc/server';
2
- import type { CoreRouters } from '../root.js';
3
- export type RouterRecord = Record<string, AnyRouter>;
4
- export type NonConflictingRouterRecord<TUser extends RouterRecord> = Extract<keyof TUser, keyof CoreRouters> extends never ? TUser : {
5
- [K in keyof TUser]: K extends keyof CoreRouters ? never : TUser[K];
6
- };
7
- //# sourceMappingURL=router-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"router-types.d.ts","sourceRoot":"","sources":["../../../src/api/utils/router-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAEpD,MAAM,MAAM,0BAA0B,CAAC,KAAK,SAAS,YAAY,IAC7D,OAAO,CAAC,MAAM,KAAK,EAAE,MAAM,WAAW,CAAC,SAAS,KAAK,GAC/C,KAAK,GACL;KACK,CAAC,IAAI,MAAM,KAAK,GAAG,CAAC,SAAS,MAAM,WAAW,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;CACrE,CAAA"}
File without changes
@@ -1,28 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,83 +0,0 @@
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
- }
@@ -1,22 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,25 +0,0 @@
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
- };
@@ -1,18 +0,0 @@
1
- /**
2
- * Unified console output for runtime warnings, errors, and info messages
3
- * outside of CLI commands.
4
- *
5
- * Format: `<glyph> [<scope>] <message>` — color-coded so misconfiguration and
6
- * runtime hiccups stand out in dev server output.
7
- *
8
- * - `logWarn` — yellow ⚠, non-fatal misconfiguration the dev should address.
9
- * - `logError` — red ✗, recoverable runtime error or skipped operation.
10
- * - `logInfo` — gray ℹ, hint or non-actionable note.
11
- *
12
- * For CLI commands use clack/`p.log.*` with chalk directly — they have their
13
- * own UX conventions.
14
- */
15
- export declare const logWarn: (scope: string, message: string) => void;
16
- export declare const logError: (scope: string, message: string, cause?: unknown) => void;
17
- export declare const logInfo: (scope: string, message: string) => void;
18
- //# sourceMappingURL=log.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/utils/log.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,MAAM,EAAE,SAAS,MAAM,KAAG,IAExD,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,OAAO,MAAM,EAAE,SAAS,MAAM,EAAE,QAAQ,OAAO,KAAG,IAM1E,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,OAAO,MAAM,EAAE,SAAS,MAAM,KAAG,IAExD,CAAA"}
package/dist/utils/log.js DELETED
@@ -1,28 +0,0 @@
1
- import chalk from 'chalk';
2
- /**
3
- * Unified console output for runtime warnings, errors, and info messages
4
- * outside of CLI commands.
5
- *
6
- * Format: `<glyph> [<scope>] <message>` — color-coded so misconfiguration and
7
- * runtime hiccups stand out in dev server output.
8
- *
9
- * - `logWarn` — yellow ⚠, non-fatal misconfiguration the dev should address.
10
- * - `logError` — red ✗, recoverable runtime error or skipped operation.
11
- * - `logInfo` — gray ℹ, hint or non-actionable note.
12
- *
13
- * For CLI commands use clack/`p.log.*` with chalk directly — they have their
14
- * own UX conventions.
15
- */
16
- export const logWarn = (scope, message) => {
17
- console.warn(chalk.yellow(`⚠ [${scope}] ${message}`));
18
- };
19
- export const logError = (scope, message, cause) => {
20
- if (cause === undefined) {
21
- console.error(chalk.red(`✗ [${scope}] ${message}`));
22
- return;
23
- }
24
- console.error(chalk.red(`✗ [${scope}] ${message}`), cause);
25
- };
26
- export const logInfo = (scope, message) => {
27
- console.info(chalk.gray(`ℹ [${scope}] ${message}`));
28
- };