nextjs-cms 0.9.36 → 0.9.37
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.
- package/dist/api/actions/pages.d.ts +3 -3
- package/dist/api/trpc/root.d.ts +3 -3
- package/dist/api/trpc/routers/navigation.d.ts +3 -3
- package/dist/api/trpc/server.d.ts +9 -9
- package/dist/cli/lib/update-sections.d.ts.map +1 -1
- package/dist/cli/lib/update-sections.js +43 -10
- package/dist/core/config/config-loader.d.ts +2 -2
- package/dist/core/fields/date-range.d.ts +4 -4
- package/dist/core/fields/slug.d.ts +55 -3
- package/dist/core/fields/slug.d.ts.map +1 -1
- package/dist/core/fields/slug.js +56 -2
- package/dist/core/sections/category.d.ts +4 -4
- package/dist/core/sections/hasItems.d.ts +4 -4
- package/dist/core/sections/section.d.ts +3 -3
- package/dist/core/sections/simple.d.ts +4 -4
- package/dist/translations/base/en.d.ts +3 -0
- package/dist/translations/base/en.d.ts.map +1 -1
- package/dist/translations/base/en.js +3 -0
- package/dist/translations/client.d.ts +40 -4
- package/dist/translations/client.d.ts.map +1 -1
- package/dist/translations/server.d.ts +40 -4
- package/dist/translations/server.d.ts.map +1 -1
- package/package.json +6 -3
- package/dist/api/axios/axiosInstance.d.ts +0 -2
- package/dist/api/axios/axiosInstance.d.ts.map +0 -1
- package/dist/api/axios/axiosInstance.js +0 -8
- package/dist/api/client.d.ts +0 -30
- package/dist/api/client.d.ts.map +0 -1
- package/dist/api/client.js +0 -82
- package/dist/api/index.d.ts +0 -2
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js +0 -0
- package/dist/api/lib/serverActions.d.ts +0 -338
- package/dist/api/lib/serverActions.d.ts.map +0 -1
- package/dist/api/lib/serverActions.js +0 -1517
- package/dist/api/root.d.ts +0 -19
- package/dist/api/root.d.ts.map +0 -1
- package/dist/api/root.js +0 -50
- package/dist/api/routers/accountSettings.d.ts +0 -66
- package/dist/api/routers/accountSettings.d.ts.map +0 -1
- package/dist/api/routers/accountSettings.js +0 -202
- package/dist/api/routers/admins.d.ts +0 -112
- package/dist/api/routers/admins.d.ts.map +0 -1
- package/dist/api/routers/admins.js +0 -323
- package/dist/api/routers/auth.d.ts +0 -54
- package/dist/api/routers/auth.d.ts.map +0 -1
- package/dist/api/routers/auth.js +0 -50
- package/dist/api/routers/categorySection.d.ts +0 -105
- package/dist/api/routers/categorySection.d.ts.map +0 -1
- package/dist/api/routers/categorySection.js +0 -49
- package/dist/api/routers/config.d.ts +0 -48
- package/dist/api/routers/config.d.ts.map +0 -1
- package/dist/api/routers/config.js +0 -18
- package/dist/api/routers/cpanel.d.ts +0 -82
- package/dist/api/routers/cpanel.d.ts.map +0 -1
- package/dist/api/routers/cpanel.js +0 -216
- package/dist/api/routers/fields.d.ts +0 -35
- package/dist/api/routers/fields.d.ts.map +0 -1
- package/dist/api/routers/fields.js +0 -81
- package/dist/api/routers/files.d.ts +0 -34
- package/dist/api/routers/files.d.ts.map +0 -1
- package/dist/api/routers/files.js +0 -14
- package/dist/api/routers/gallery.d.ts +0 -35
- package/dist/api/routers/gallery.d.ts.map +0 -1
- package/dist/api/routers/gallery.js +0 -92
- package/dist/api/routers/hasItemsSection.d.ts +0 -194
- package/dist/api/routers/hasItemsSection.d.ts.map +0 -1
- package/dist/api/routers/hasItemsSection.js +0 -86
- package/dist/api/routers/logs.d.ts +0 -59
- package/dist/api/routers/logs.d.ts.map +0 -1
- package/dist/api/routers/logs.js +0 -76
- package/dist/api/routers/navigation.d.ts +0 -50
- package/dist/api/routers/navigation.d.ts.map +0 -1
- package/dist/api/routers/navigation.js +0 -11
- package/dist/api/routers/simpleSection.d.ts +0 -93
- package/dist/api/routers/simpleSection.d.ts.map +0 -1
- package/dist/api/routers/simpleSection.js +0 -54
- package/dist/api/server.d.ts +0 -2748
- package/dist/api/server.d.ts.map +0 -1
- package/dist/api/server.js +0 -100
- package/dist/api/trpc/error-logging.d.ts +0 -14
- package/dist/api/trpc/error-logging.d.ts.map +0 -1
- package/dist/api/trpc/error-logging.js +0 -75
- package/dist/api/trpc.d.ts +0 -111
- package/dist/api/trpc.d.ts.map +0 -1
- package/dist/api/trpc.js +0 -99
- package/dist/api/utils/async-caller-proxy.d.ts +0 -2
- package/dist/api/utils/async-caller-proxy.d.ts.map +0 -1
- package/dist/api/utils/async-caller-proxy.js +0 -36
- package/dist/api/utils/lazy-caller-proxy.d.ts +0 -2
- package/dist/api/utils/lazy-caller-proxy.d.ts.map +0 -1
- package/dist/api/utils/lazy-caller-proxy.js +0 -36
- package/dist/api/utils/router-types.d.ts +0 -7
- package/dist/api/utils/router-types.d.ts.map +0 -1
- package/dist/api/utils/router-types.js +0 -0
- package/dist/auth/axios/axiosInstance.d.ts +0 -2
- package/dist/auth/axios/axiosInstance.d.ts.map +0 -1
- package/dist/auth/axios/axiosInstance.js +0 -8
- package/dist/auth/hooks/useAxiosPrivate.d.ts +0 -5
- package/dist/auth/hooks/useAxiosPrivate.d.ts.map +0 -1
- package/dist/auth/hooks/useAxiosPrivate.js +0 -74
- package/dist/auth/trpc.d.ts +0 -6
- package/dist/auth/trpc.d.ts.map +0 -1
- package/dist/auth/trpc.js +0 -81
- package/dist/plugins/manifest.d.ts +0 -28
- package/dist/plugins/manifest.d.ts.map +0 -1
- package/dist/plugins/manifest.js +0 -83
- package/dist/plugins/registry.d.ts +0 -22
- package/dist/plugins/registry.d.ts.map +0 -1
- package/dist/plugins/registry.js +0 -25
- package/dist/utils/log.d.ts +0 -18
- package/dist/utils/log.d.ts.map +0 -1
- package/dist/utils/log.js +0 -28
package/dist/auth/trpc.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { observable } from '@trpc/server/observable';
|
|
2
|
-
import { logout, refreshSession } from './react.js';
|
|
3
|
-
/**
|
|
4
|
-
* tRPC link that refreshes the token if it's expired
|
|
5
|
-
*/
|
|
6
|
-
export const refreshTokenLink = () => {
|
|
7
|
-
/**
|
|
8
|
-
* Add a lock state to prevent multiple refreshes at the same time
|
|
9
|
-
*/
|
|
10
|
-
let isRefreshing = false;
|
|
11
|
-
let refreshPromise = null;
|
|
12
|
-
return () => {
|
|
13
|
-
return ({ next, op }) => {
|
|
14
|
-
return observable((observer) => {
|
|
15
|
-
let next$ = null;
|
|
16
|
-
let shouldRetry = true; // Flag to control the retry
|
|
17
|
-
function attempt() {
|
|
18
|
-
next$?.unsubscribe();
|
|
19
|
-
next$ = next(op).subscribe({
|
|
20
|
-
async error(err) {
|
|
21
|
-
if (err.data?.code === 'UNAUTHORIZED' && shouldRetry) {
|
|
22
|
-
if (!isRefreshing) {
|
|
23
|
-
isRefreshing = true;
|
|
24
|
-
refreshPromise = (async () => {
|
|
25
|
-
try {
|
|
26
|
-
const response = await fetch('/api/auth/refresh');
|
|
27
|
-
const data = await response.json();
|
|
28
|
-
if (response.status !== 200) {
|
|
29
|
-
await logout({
|
|
30
|
-
/**
|
|
31
|
-
* No need to delete the cookies, because they are both invalid.
|
|
32
|
-
*/
|
|
33
|
-
deleteCookies: false,
|
|
34
|
-
});
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
await refreshSession(data.session);
|
|
38
|
-
}
|
|
39
|
-
catch (e) {
|
|
40
|
-
await logout({
|
|
41
|
-
/**
|
|
42
|
-
* No need to delete the cookies, because they are both invalid.
|
|
43
|
-
*/
|
|
44
|
-
deleteCookies: false,
|
|
45
|
-
});
|
|
46
|
-
throw e;
|
|
47
|
-
}
|
|
48
|
-
finally {
|
|
49
|
-
isRefreshing = false;
|
|
50
|
-
refreshPromise = null;
|
|
51
|
-
}
|
|
52
|
-
})();
|
|
53
|
-
}
|
|
54
|
-
try {
|
|
55
|
-
await refreshPromise;
|
|
56
|
-
shouldRetry = false;
|
|
57
|
-
attempt();
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
// Don't throw under-the-hood refresh flow's errors
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
observer.error(err);
|
|
65
|
-
},
|
|
66
|
-
next(value) {
|
|
67
|
-
observer.next(value);
|
|
68
|
-
},
|
|
69
|
-
complete() {
|
|
70
|
-
observer.complete();
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
attempt();
|
|
75
|
-
return () => {
|
|
76
|
-
next$?.unsubscribe();
|
|
77
|
-
};
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
};
|
|
@@ -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"}
|
package/dist/plugins/manifest.js
DELETED
|
@@ -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"}
|
package/dist/plugins/registry.js
DELETED
|
@@ -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
|
-
};
|
package/dist/utils/log.d.ts
DELETED
|
@@ -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
|
package/dist/utils/log.d.ts.map
DELETED
|
@@ -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
|
-
};
|