nextjs-cms 0.5.64 → 0.5.66
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/routers/cmsSettings.js +7 -7
- package/dist/core/db/table-checker/MysqlTable.d.ts +1 -0
- package/dist/core/db/table-checker/MysqlTable.d.ts.map +1 -1
- package/dist/core/db/table-checker/MysqlTable.js +15 -0
- package/dist/core/factories/section-factory-with-esbuild.d.ts +14 -0
- package/dist/core/factories/section-factory-with-esbuild.d.ts.map +1 -1
- package/dist/core/factories/section-factory-with-esbuild.js +32 -19
- package/dist/core/factories/section-factory-with-jiti.d.ts +19 -0
- package/dist/core/factories/section-factory-with-jiti.d.ts.map +1 -1
- package/dist/core/factories/section-factory-with-jiti.js +91 -78
- package/dist/db/schema.d.ts +6 -6
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +2 -2
- package/package.json +3 -3
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { privateProcedure, router } from '../trpc.js';
|
|
2
2
|
import { db } from '../../db/client.js';
|
|
3
|
-
import {
|
|
3
|
+
import { CmsSettingsTable } from '../../db/schema.js';
|
|
4
4
|
import { eq } from 'drizzle-orm';
|
|
5
5
|
import * as z from 'zod';
|
|
6
6
|
export const cmsSettings = router({
|
|
7
7
|
get: privateProcedure.query(async ({ ctx }) => {
|
|
8
8
|
const settings = await db
|
|
9
9
|
.select({
|
|
10
|
-
googleTagId:
|
|
11
|
-
googlePropertyId:
|
|
12
|
-
googleServiceAccountCredentials:
|
|
10
|
+
googleTagId: CmsSettingsTable.googleTagId,
|
|
11
|
+
googlePropertyId: CmsSettingsTable.googlePropertyId,
|
|
12
|
+
googleServiceAccountCredentials: CmsSettingsTable.googleServiceAccountCredentials,
|
|
13
13
|
})
|
|
14
|
-
.from(
|
|
15
|
-
.where(eq(
|
|
14
|
+
.from(CmsSettingsTable)
|
|
15
|
+
.where(eq(CmsSettingsTable.id, 1))
|
|
16
16
|
.limit(1);
|
|
17
17
|
return {
|
|
18
18
|
googleTagId: settings[0]?.googleTagId ?? '',
|
|
@@ -32,7 +32,7 @@ export const cmsSettings = router({
|
|
|
32
32
|
}))
|
|
33
33
|
.mutation(async ({ ctx, input }) => {
|
|
34
34
|
await db
|
|
35
|
-
.insert(
|
|
35
|
+
.insert(CmsSettingsTable)
|
|
36
36
|
.values({
|
|
37
37
|
id: 1,
|
|
38
38
|
googleTagId: input.googleTagId,
|
|
@@ -3,6 +3,7 @@ import { DbTableChecker } from './DbTable.js';
|
|
|
3
3
|
* MySQL Table class
|
|
4
4
|
*/
|
|
5
5
|
export declare class MysqlTableChecker extends DbTableChecker {
|
|
6
|
+
static getExistingTables(): Promise<string[]>;
|
|
6
7
|
static getColumns(tableName: string): Promise<string[]>;
|
|
7
8
|
static getExistingKeys(table: string): Promise<{
|
|
8
9
|
primaryKeys: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MysqlTable.d.ts","sourceRoot":"","sources":["../../../../src/core/db/table-checker/MysqlTable.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAG7C;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;WACpC,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;WAkBhD,eAAe,CAAC,KAAK,EAAE,MAAM;;;kBAIR,MAAM;qBAAW,MAAM,EAAE;;;kBAC1B,MAAM;qBAAW,MAAM,EAAE;;;;kBACtB,MAAM;qBAAW,MAAM,EAAE;;;WA2DhD,yBAAyB,CAAC,KAAK,EAAE,MAAM;;mBAU7B,MAAM;kBACP,MAAM;kBACN,MAAM;iBACP,MAAM;qBACF,MAAM;mBACR,MAAM;;;CAahC"}
|
|
1
|
+
{"version":3,"file":"MysqlTable.d.ts","sourceRoot":"","sources":["../../../../src/core/db/table-checker/MysqlTable.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAG7C;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;WACpC,iBAAiB;WAgBjB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;WAkBhD,eAAe,CAAC,KAAK,EAAE,MAAM;;;kBAIR,MAAM;qBAAW,MAAM,EAAE;;;kBAC1B,MAAM;qBAAW,MAAM,EAAE;;;;kBACtB,MAAM;qBAAW,MAAM,EAAE;;;WA2DhD,yBAAyB,CAAC,KAAK,EAAE,MAAM;;mBAU7B,MAAM;kBACP,MAAM;kBACN,MAAM;iBACP,MAAM;qBACF,MAAM;mBACR,MAAM;;;CAahC"}
|
|
@@ -6,6 +6,21 @@ import chalk from 'chalk';
|
|
|
6
6
|
* MySQL Table class
|
|
7
7
|
*/
|
|
8
8
|
export class MysqlTableChecker extends DbTableChecker {
|
|
9
|
+
static async getExistingTables() {
|
|
10
|
+
const _res = await db.execute(sql `SHOW TABLES`);
|
|
11
|
+
const _tables = [];
|
|
12
|
+
// @ts-expect-error - drizzle-orm result structure
|
|
13
|
+
const _rows = _res[0];
|
|
14
|
+
_rows.map((row) => {
|
|
15
|
+
// SHOW TABLES returns a column named "Tables_in_<database_name>"
|
|
16
|
+
// Access the first (and only) property dynamically
|
|
17
|
+
const tableName = Object.values(row)[0];
|
|
18
|
+
if (tableName) {
|
|
19
|
+
_tables.push(tableName);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return _tables;
|
|
23
|
+
}
|
|
9
24
|
static async getColumns(tableName) {
|
|
10
25
|
const statement = sql `
|
|
11
26
|
SELECT COLUMN_NAME
|
|
@@ -10,6 +10,8 @@ export declare class SectionFactory {
|
|
|
10
10
|
static readonly fixedSections: string[];
|
|
11
11
|
private static readonly isDev;
|
|
12
12
|
private static readonly isProd;
|
|
13
|
+
private static isCLI;
|
|
14
|
+
private static setIsCLI;
|
|
13
15
|
private static sectionProcessingErrors;
|
|
14
16
|
private static sectionFetchingErrors;
|
|
15
17
|
private static errorCount;
|
|
@@ -23,7 +25,19 @@ export declare class SectionFactory {
|
|
|
23
25
|
private static allSectionsLoaded;
|
|
24
26
|
private static configVersion;
|
|
25
27
|
private static ensureConfigFresh;
|
|
28
|
+
/**
|
|
29
|
+
* Log a message to the console if debug mode is enabled
|
|
30
|
+
* @param args - The arguments to log
|
|
31
|
+
* @returns void
|
|
32
|
+
*/
|
|
33
|
+
static log(...args: any[]): void;
|
|
26
34
|
static bumpHotMarker(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Get all sections without logging or file watching.
|
|
37
|
+
* This is used to get all sections for the setup process using nextjs-cms-kit.
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
static getSectionsSilently(type?: SectionTypes | SectionTypes[]): Promise<AnySectionConfig[]>;
|
|
27
41
|
/**
|
|
28
42
|
* Get all sections
|
|
29
43
|
* @param type - The type of sections to get
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-factory-with-esbuild.d.ts","sourceRoot":"","sources":["../../../src/core/factories/section-factory-with-esbuild.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtF,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC7G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AA2CrD,eAAO,MAAM,uBAAuB,cAAoC,CAAA;AAsHxE,KAAK,gBAAgB,GAAG,qBAAqB,GAAG,mBAAmB,GAAG,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"section-factory-with-esbuild.d.ts","sourceRoot":"","sources":["../../../src/core/factories/section-factory-with-esbuild.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtF,OAAO,KAA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AAC,YAAY;IAqD3B,OAAO,CAAC,MAAM,CAAC,IAAI;CAatB"}
|
|
@@ -130,16 +130,6 @@ const loadSectionModuleRuntime = async (absPath) => {
|
|
|
130
130
|
const mod = await import(/* turbopackIgnore: true */ /* webpackIgnore: true */ url);
|
|
131
131
|
return mod?.default;
|
|
132
132
|
};
|
|
133
|
-
/**
|
|
134
|
-
* Log a message to the console if debug mode is enabled
|
|
135
|
-
* @param args - The arguments to log
|
|
136
|
-
* @returns void
|
|
137
|
-
*/
|
|
138
|
-
const log = (...args) => {
|
|
139
|
-
if (!cachedCmsConfig?.debug)
|
|
140
|
-
return;
|
|
141
|
-
console.log(chalk.black.bgGreen(`[${new Date().toISOString()}][next-cms-debug]`, ...args));
|
|
142
|
-
};
|
|
143
133
|
export class SectionFactory {
|
|
144
134
|
/**
|
|
145
135
|
* These are the fixed sections that can not be present in the sections folder.
|
|
@@ -147,6 +137,10 @@ export class SectionFactory {
|
|
|
147
137
|
static fixedSections = ['admins', 'analytics', 'emails', 'dashboard'];
|
|
148
138
|
static isDev = process.env.NODE_ENV !== 'production';
|
|
149
139
|
static isProd = !this.isDev;
|
|
140
|
+
static isCLI = false;
|
|
141
|
+
static setIsCLI() {
|
|
142
|
+
this.isCLI = true;
|
|
143
|
+
}
|
|
150
144
|
static sectionProcessingErrors = {};
|
|
151
145
|
static sectionFetchingErrors = {};
|
|
152
146
|
static errorCount = 0;
|
|
@@ -177,6 +171,16 @@ export class SectionFactory {
|
|
|
177
171
|
}
|
|
178
172
|
return cmsConfig;
|
|
179
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Log a message to the console if debug mode is enabled
|
|
176
|
+
* @param args - The arguments to log
|
|
177
|
+
* @returns void
|
|
178
|
+
*/
|
|
179
|
+
static log(...args) {
|
|
180
|
+
if (this.isCLI || !cachedCmsConfig?.debug)
|
|
181
|
+
return;
|
|
182
|
+
console.log(chalk.green(`[next-cms-debug]`, ...args));
|
|
183
|
+
}
|
|
180
184
|
static bumpHotMarker() {
|
|
181
185
|
if (!SectionFactory.isDev)
|
|
182
186
|
return;
|
|
@@ -193,13 +197,22 @@ export class SectionFactory {
|
|
|
193
197
|
`export const configLastUpdated = ${Date.now()}\n`;
|
|
194
198
|
try {
|
|
195
199
|
fs.writeFileSync(hotMarkerFile, content, 'utf8');
|
|
196
|
-
log('Bumped _section-hot-reload.js to trigger Next Fast Refresh');
|
|
200
|
+
this.log('Bumped _section-hot-reload.js to trigger Next Fast Refresh');
|
|
197
201
|
}
|
|
198
202
|
catch (err) {
|
|
199
203
|
console.error('Failed to bump _section-hot-reload.js:', err);
|
|
200
204
|
}
|
|
201
205
|
}
|
|
202
206
|
// ---------- PUBLIC API ----------
|
|
207
|
+
/**
|
|
208
|
+
* Get all sections without logging or file watching.
|
|
209
|
+
* This is used to get all sections for the setup process using nextjs-cms-kit.
|
|
210
|
+
* @returns
|
|
211
|
+
*/
|
|
212
|
+
static async getSectionsSilently(type) {
|
|
213
|
+
this.setIsCLI();
|
|
214
|
+
return await this.getSections(type);
|
|
215
|
+
}
|
|
203
216
|
/**
|
|
204
217
|
* Get all sections
|
|
205
218
|
* @param type - The type of sections to get
|
|
@@ -375,7 +388,7 @@ export class SectionFactory {
|
|
|
375
388
|
}
|
|
376
389
|
this.allSectionsPromise = (async () => {
|
|
377
390
|
if (!this.allSectionsLoaded) {
|
|
378
|
-
log('Loading all sections from disk...', this.isDev ? '(dev mode)' : '(production mode)');
|
|
391
|
+
this.log('Loading all sections from disk...', this.isDev ? '(dev mode)' : '(production mode)');
|
|
379
392
|
}
|
|
380
393
|
const sections = [];
|
|
381
394
|
try {
|
|
@@ -486,14 +499,14 @@ If you added an extension manually, remove it.`);
|
|
|
486
499
|
if (cmsConfig.sections.strict && this.errorCount > 0) {
|
|
487
500
|
return [];
|
|
488
501
|
}
|
|
489
|
-
log(`Loaded ${sections.length} section(s)`);
|
|
502
|
+
this.log(`Loaded ${sections.length} section(s)`);
|
|
490
503
|
return sections;
|
|
491
504
|
})();
|
|
492
505
|
return this.allSectionsPromise;
|
|
493
506
|
}
|
|
494
507
|
// ---------- DEV WATCHER & CACHE INVALIDATION ----------
|
|
495
508
|
static startWatcher(cmsConfig) {
|
|
496
|
-
if (!this.isDev || sectionWatcherState.watcher)
|
|
509
|
+
if (this.isCLI || !this.isDev || sectionWatcherState.watcher)
|
|
497
510
|
return;
|
|
498
511
|
const invalidateForRelPath = (relPath) => {
|
|
499
512
|
const normalized = relPath.replace(/\\/g, '/');
|
|
@@ -510,7 +523,7 @@ If you added an extension manually, remove it.`);
|
|
|
510
523
|
this.errorCount = 0;
|
|
511
524
|
this.allSectionsPromise = null;
|
|
512
525
|
this.allSectionsLoaded = false;
|
|
513
|
-
log('Invalidated section cache due to change in', relPath);
|
|
526
|
+
this.log('Invalidated section cache due to change in', relPath);
|
|
514
527
|
this.bumpHotMarker();
|
|
515
528
|
};
|
|
516
529
|
sectionWatcherState.watcher = chokidar
|
|
@@ -525,18 +538,18 @@ If you added an extension manually, remove it.`);
|
|
|
525
538
|
})
|
|
526
539
|
.setMaxListeners(3)
|
|
527
540
|
.on('add', (path) => {
|
|
528
|
-
log('Section file added:', path);
|
|
541
|
+
this.log('Section file added:', path);
|
|
529
542
|
invalidateForRelPath(path);
|
|
530
543
|
})
|
|
531
544
|
.on('change', (path) => {
|
|
532
|
-
log('Section file changed:', path);
|
|
545
|
+
this.log('Section file changed:', path);
|
|
533
546
|
invalidateForRelPath(path);
|
|
534
547
|
})
|
|
535
548
|
.on('unlink', (path) => {
|
|
536
|
-
log('Section file removed:', path);
|
|
549
|
+
this.log('Section file removed:', path);
|
|
537
550
|
invalidateForRelPath(path);
|
|
538
551
|
});
|
|
539
|
-
log('Starting section watcher in dev mode...');
|
|
552
|
+
this.log('Starting section watcher in dev mode...');
|
|
540
553
|
}
|
|
541
554
|
static init() {
|
|
542
555
|
if (this.isProd) {
|
|
@@ -10,6 +10,8 @@ export declare class SectionFactory {
|
|
|
10
10
|
static readonly fixedSections: string[];
|
|
11
11
|
private static readonly isDev;
|
|
12
12
|
private static readonly isProd;
|
|
13
|
+
private static isCLI;
|
|
14
|
+
private static setIsCLI;
|
|
13
15
|
private static sectionProcessingErrors;
|
|
14
16
|
private static sectionFetchingErrors;
|
|
15
17
|
private static errorCount;
|
|
@@ -23,7 +25,19 @@ export declare class SectionFactory {
|
|
|
23
25
|
private static allSectionsLoaded;
|
|
24
26
|
private static configVersion;
|
|
25
27
|
private static ensureConfigFresh;
|
|
28
|
+
/**
|
|
29
|
+
* Log a message to the console if debug mode is enabled
|
|
30
|
+
* @param args - The arguments to log
|
|
31
|
+
* @returns void
|
|
32
|
+
*/
|
|
33
|
+
static log(...args: any[]): void;
|
|
26
34
|
static bumpHotMarker(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Get all sections without logging or file watching.
|
|
37
|
+
* This is used to get all sections for the setup process using nextjs-cms-kit.
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
static getSectionsSilently(type?: SectionTypes | SectionTypes[]): Promise<AnySectionConfig[]>;
|
|
27
41
|
/**
|
|
28
42
|
* Get all sections
|
|
29
43
|
* @param type - The type of sections to get
|
|
@@ -106,6 +120,11 @@ export declare class SectionFactory {
|
|
|
106
120
|
*/
|
|
107
121
|
private static loadAllSections;
|
|
108
122
|
private static startWatcher;
|
|
123
|
+
/**
|
|
124
|
+
* Clear jiti's cache for a specific file path.
|
|
125
|
+
* This ensures that when a file changes, jiti will reload it on the next require.
|
|
126
|
+
*/
|
|
127
|
+
static clearJitiCache(absPath: string): void;
|
|
109
128
|
private static init;
|
|
110
129
|
}
|
|
111
130
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-factory-with-jiti.d.ts","sourceRoot":"","sources":["../../../src/core/factories/section-factory-with-jiti.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtF,OAAO,KAAK,EAAE,qBAAqB,EAA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,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAKpC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;QAClB,KAAK,EAAE,MAAM,eAAe,GAAG,aAAa,GAAG,eAAe,CAAA;QAC9D,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACrB,GAAG,eAAe,GAAG,aAAa,GAAG,eAAe;IAYrD;;;;;;;;;OASG;mBACkB,GAAG;IA6FxB;;;;OAIG;mBACkB,eAAe;IAmKpC,OAAO,CAAC,MAAM,CAAC,YAAY;IAwE3B;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IA0D5C,OAAO,CAAC,MAAM,CAAC,IAAI;CAatB"}
|
|
@@ -47,16 +47,6 @@ const getCmsConfigCached = async (currentVersion = getConfigImportVersion()) =>
|
|
|
47
47
|
}
|
|
48
48
|
return cachedCmsConfig;
|
|
49
49
|
};
|
|
50
|
-
/**
|
|
51
|
-
* Log a message to the console if debug mode is enabled
|
|
52
|
-
* @param args - The arguments to log
|
|
53
|
-
* @returns void
|
|
54
|
-
*/
|
|
55
|
-
const log = (...args) => {
|
|
56
|
-
if (!cachedCmsConfig?.debug)
|
|
57
|
-
return;
|
|
58
|
-
console.log(chalk.black.bgGreen(`[${new Date().toISOString()}][next-cms-debug]`, ...args));
|
|
59
|
-
};
|
|
60
50
|
const getJitiInstance = () => {
|
|
61
51
|
if (!jitiInstance) {
|
|
62
52
|
const createJiti = loadJiti();
|
|
@@ -75,63 +65,6 @@ const getJitiInstance = () => {
|
|
|
75
65
|
}
|
|
76
66
|
return jitiInstance;
|
|
77
67
|
};
|
|
78
|
-
/**
|
|
79
|
-
* Clear jiti's cache for a specific file path.
|
|
80
|
-
* This ensures that when a file changes, jiti will reload it on the next require.
|
|
81
|
-
*/
|
|
82
|
-
const clearJitiCache = (absPath) => {
|
|
83
|
-
const jiti = getJitiInstance();
|
|
84
|
-
try {
|
|
85
|
-
// Try to resolve the path using jiti's resolve (which handles TS files)
|
|
86
|
-
let resolvedPath;
|
|
87
|
-
try {
|
|
88
|
-
// jiti extends NodeRequire, so it has resolve
|
|
89
|
-
resolvedPath = jiti.resolve(absPath);
|
|
90
|
-
}
|
|
91
|
-
catch {
|
|
92
|
-
// Last resort: use the absPath as-is
|
|
93
|
-
resolvedPath = absPath;
|
|
94
|
-
}
|
|
95
|
-
// Clear from jiti's cache (jiti extends NodeRequire, so it has cache)
|
|
96
|
-
if (resolvedPath && jiti.cache[resolvedPath]) {
|
|
97
|
-
delete jiti.cache[resolvedPath];
|
|
98
|
-
log('Cleared jiti cache for', resolvedPath);
|
|
99
|
-
}
|
|
100
|
-
// Also clear from Node's global require cache (for safety)
|
|
101
|
-
if (resolvedPath && safeRequire.cache[resolvedPath]) {
|
|
102
|
-
delete safeRequire.cache[resolvedPath];
|
|
103
|
-
log('Cleared Node require cache for', resolvedPath);
|
|
104
|
-
}
|
|
105
|
-
// Try clearing with .ts extension if different
|
|
106
|
-
const tsPath = absPath.endsWith('.ts') ? absPath : `${absPath}.ts`;
|
|
107
|
-
if (tsPath !== resolvedPath && jiti.cache[tsPath]) {
|
|
108
|
-
delete jiti.cache[tsPath];
|
|
109
|
-
log('Cleared jiti cache for', tsPath);
|
|
110
|
-
}
|
|
111
|
-
if (tsPath !== resolvedPath && safeRequire.cache[tsPath]) {
|
|
112
|
-
delete safeRequire.cache[tsPath];
|
|
113
|
-
log('Cleared Node require cache for', tsPath);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
catch (err) {
|
|
117
|
-
// If resolution fails, try clearing by matching keys in cache
|
|
118
|
-
log('Could not resolve path for cache clearing, trying pattern match:', absPath);
|
|
119
|
-
const absPathNormalized = absPath.replace(/\\/g, '/');
|
|
120
|
-
// Clear any cache entries that match this path
|
|
121
|
-
for (const key in jiti.cache) {
|
|
122
|
-
if (key.replace(/\\/g, '/').includes(absPathNormalized)) {
|
|
123
|
-
delete jiti.cache[key];
|
|
124
|
-
log('Cleared jiti cache entry:', key);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
for (const key in safeRequire.cache) {
|
|
128
|
-
if (key.replace(/\\/g, '/').includes(absPathNormalized)) {
|
|
129
|
-
delete safeRequire.cache[key];
|
|
130
|
-
log('Cleared Node require cache entry:', key);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
68
|
const loadSectionModuleRuntime = async (absPath) => {
|
|
136
69
|
const jiti = getJitiInstance();
|
|
137
70
|
/**
|
|
@@ -148,6 +81,10 @@ export class SectionFactory {
|
|
|
148
81
|
static fixedSections = ['admins', 'analytics', 'emails', 'dashboard'];
|
|
149
82
|
static isDev = process.env.NODE_ENV !== 'production';
|
|
150
83
|
static isProd = !this.isDev;
|
|
84
|
+
static isCLI = false;
|
|
85
|
+
static setIsCLI() {
|
|
86
|
+
this.isCLI = true;
|
|
87
|
+
}
|
|
151
88
|
static sectionProcessingErrors = {};
|
|
152
89
|
static sectionFetchingErrors = {};
|
|
153
90
|
static errorCount = 0;
|
|
@@ -177,6 +114,16 @@ export class SectionFactory {
|
|
|
177
114
|
}
|
|
178
115
|
return cmsConfig;
|
|
179
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Log a message to the console if debug mode is enabled
|
|
119
|
+
* @param args - The arguments to log
|
|
120
|
+
* @returns void
|
|
121
|
+
*/
|
|
122
|
+
static log(...args) {
|
|
123
|
+
if (this.isCLI || !cachedCmsConfig?.debug)
|
|
124
|
+
return;
|
|
125
|
+
console.log(chalk.green(`[next-cms-debug]`, ...args));
|
|
126
|
+
}
|
|
180
127
|
static bumpHotMarker() {
|
|
181
128
|
if (!SectionFactory.isDev)
|
|
182
129
|
return;
|
|
@@ -193,13 +140,22 @@ export class SectionFactory {
|
|
|
193
140
|
`export const configLastUpdated = ${Date.now()}\n`;
|
|
194
141
|
try {
|
|
195
142
|
fs.writeFileSync(hotMarkerFile, content, 'utf8');
|
|
196
|
-
log('Bumped _section-hot-reload.js to trigger Next Fast Refresh');
|
|
143
|
+
this.log('Bumped _section-hot-reload.js to trigger Next Fast Refresh');
|
|
197
144
|
}
|
|
198
145
|
catch (err) {
|
|
199
146
|
console.error('Failed to bump _section-hot-reload.js:', err);
|
|
200
147
|
}
|
|
201
148
|
}
|
|
202
149
|
// ---------- PUBLIC API ----------
|
|
150
|
+
/**
|
|
151
|
+
* Get all sections without logging or file watching.
|
|
152
|
+
* This is used to get all sections for the setup process using nextjs-cms-kit.
|
|
153
|
+
* @returns
|
|
154
|
+
*/
|
|
155
|
+
static async getSectionsSilently(type) {
|
|
156
|
+
this.setIsCLI();
|
|
157
|
+
return await this.getSections(type);
|
|
158
|
+
}
|
|
203
159
|
/**
|
|
204
160
|
* Get all sections
|
|
205
161
|
* @param type - The type of sections to get
|
|
@@ -375,7 +331,7 @@ export class SectionFactory {
|
|
|
375
331
|
}
|
|
376
332
|
this.allSectionsPromise = (async () => {
|
|
377
333
|
if (!this.allSectionsLoaded) {
|
|
378
|
-
log('Loading all sections from disk...', this.isDev ? '(dev mode)' : '(production mode)');
|
|
334
|
+
this.log('Loading all sections from disk...', this.isDev ? '(dev mode)' : '(production mode)');
|
|
379
335
|
}
|
|
380
336
|
const sections = [];
|
|
381
337
|
try {
|
|
@@ -432,7 +388,7 @@ Sections MUST use extensionless relative imports:
|
|
|
432
388
|
❌ import exampleSection from './example.section.ts'
|
|
433
389
|
❌ import exampleSection from './example.section.js'
|
|
434
390
|
|
|
435
|
-
This file is bundled with
|
|
391
|
+
This file is bundled with jiti, so Node never resolves the import directly.
|
|
436
392
|
If you added an extension manually, remove it.`);
|
|
437
393
|
this.errorCount++;
|
|
438
394
|
continue;
|
|
@@ -486,14 +442,14 @@ If you added an extension manually, remove it.`);
|
|
|
486
442
|
if (cmsConfig.sections.strict && this.errorCount > 0) {
|
|
487
443
|
return [];
|
|
488
444
|
}
|
|
489
|
-
log(`Loaded ${sections.length} section(s)`);
|
|
445
|
+
this.log(`Loaded ${sections.length} section(s)`);
|
|
490
446
|
return sections;
|
|
491
447
|
})();
|
|
492
448
|
return this.allSectionsPromise;
|
|
493
449
|
}
|
|
494
450
|
// ---------- DEV WATCHER & CACHE INVALIDATION ----------
|
|
495
451
|
static startWatcher(cmsConfig) {
|
|
496
|
-
if (!this.isDev || sectionWatcherState.watcher)
|
|
452
|
+
if (this.isCLI || !this.isDev || sectionWatcherState.watcher)
|
|
497
453
|
return;
|
|
498
454
|
const invalidateForRelPath = (relPath) => {
|
|
499
455
|
const normalized = relPath.replace(/\\/g, '/');
|
|
@@ -504,7 +460,7 @@ If you added an extension manually, remove it.`);
|
|
|
504
460
|
sectionWatcherState.lastEventAt.set(normalized, now);
|
|
505
461
|
const absPath = resolve(cmsConfig.sections.path, relPath);
|
|
506
462
|
// Clear jiti's cache for the changed file
|
|
507
|
-
clearJitiCache(absPath);
|
|
463
|
+
this.clearJitiCache(absPath);
|
|
508
464
|
// Also clear the require cache for the hot marker file (if it exists)
|
|
509
465
|
try {
|
|
510
466
|
const jiti = getJitiInstance();
|
|
@@ -526,7 +482,7 @@ If you added an extension manually, remove it.`);
|
|
|
526
482
|
this.allSectionsLoaded = false;
|
|
527
483
|
// Increment version to force re-bundling
|
|
528
484
|
sectionWatcherState.version++;
|
|
529
|
-
log('Invalidated section cache due to change in', relPath);
|
|
485
|
+
this.log('Invalidated section cache due to change in', relPath);
|
|
530
486
|
// Bump the hot marker to trigger Next.js Fast Refresh
|
|
531
487
|
this.bumpHotMarker();
|
|
532
488
|
};
|
|
@@ -542,18 +498,75 @@ If you added an extension manually, remove it.`);
|
|
|
542
498
|
})
|
|
543
499
|
.setMaxListeners(3)
|
|
544
500
|
.on('add', (path) => {
|
|
545
|
-
log('Section file added:', path);
|
|
501
|
+
this.log('Section file added:', path);
|
|
546
502
|
invalidateForRelPath(path);
|
|
547
503
|
})
|
|
548
504
|
.on('change', (path) => {
|
|
549
|
-
log('Section file changed:', path);
|
|
505
|
+
this.log('Section file changed:', path);
|
|
550
506
|
invalidateForRelPath(path);
|
|
551
507
|
})
|
|
552
508
|
.on('unlink', (path) => {
|
|
553
|
-
log('Section file removed:', path);
|
|
509
|
+
this.log('Section file removed:', path);
|
|
554
510
|
invalidateForRelPath(path);
|
|
555
511
|
});
|
|
556
|
-
log('Starting section watcher in dev mode...');
|
|
512
|
+
this.log('Starting section watcher in dev mode...');
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Clear jiti's cache for a specific file path.
|
|
516
|
+
* This ensures that when a file changes, jiti will reload it on the next require.
|
|
517
|
+
*/
|
|
518
|
+
static clearJitiCache(absPath) {
|
|
519
|
+
const jiti = getJitiInstance();
|
|
520
|
+
try {
|
|
521
|
+
// Try to resolve the path using jiti's resolve (which handles TS files)
|
|
522
|
+
let resolvedPath;
|
|
523
|
+
try {
|
|
524
|
+
// jiti extends NodeRequire, so it has resolve
|
|
525
|
+
resolvedPath = jiti.resolve(absPath);
|
|
526
|
+
}
|
|
527
|
+
catch {
|
|
528
|
+
// Last resort: use the absPath as-is
|
|
529
|
+
resolvedPath = absPath;
|
|
530
|
+
}
|
|
531
|
+
// Clear from jiti's cache (jiti extends NodeRequire, so it has cache)
|
|
532
|
+
if (resolvedPath && jiti.cache[resolvedPath]) {
|
|
533
|
+
delete jiti.cache[resolvedPath];
|
|
534
|
+
this.log('Cleared jiti cache for', resolvedPath);
|
|
535
|
+
}
|
|
536
|
+
// Also clear from Node's global require cache (for safety)
|
|
537
|
+
if (resolvedPath && safeRequire.cache[resolvedPath]) {
|
|
538
|
+
delete safeRequire.cache[resolvedPath];
|
|
539
|
+
this.log('Cleared Node require cache for', resolvedPath);
|
|
540
|
+
}
|
|
541
|
+
// Try clearing with .ts extension if different
|
|
542
|
+
const tsPath = absPath.endsWith('.ts') ? absPath : `${absPath}.ts`;
|
|
543
|
+
if (tsPath !== resolvedPath && jiti.cache[tsPath]) {
|
|
544
|
+
delete jiti.cache[tsPath];
|
|
545
|
+
this.log('Cleared jiti cache for', tsPath);
|
|
546
|
+
}
|
|
547
|
+
if (tsPath !== resolvedPath && safeRequire.cache[tsPath]) {
|
|
548
|
+
delete safeRequire.cache[tsPath];
|
|
549
|
+
this.log('Cleared Node require cache for', tsPath);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
catch (err) {
|
|
553
|
+
// If resolution fails, try clearing by matching keys in cache
|
|
554
|
+
this.log('Could not resolve path for cache clearing, trying pattern match:', absPath);
|
|
555
|
+
const absPathNormalized = absPath.replace(/\\/g, '/');
|
|
556
|
+
// Clear any cache entries that match this path
|
|
557
|
+
for (const key in jiti.cache) {
|
|
558
|
+
if (key.replace(/\\/g, '/').includes(absPathNormalized)) {
|
|
559
|
+
delete jiti.cache[key];
|
|
560
|
+
this.log('Cleared jiti cache entry:', key);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
for (const key in safeRequire.cache) {
|
|
564
|
+
if (key.replace(/\\/g, '/').includes(absPathNormalized)) {
|
|
565
|
+
delete safeRequire.cache[key];
|
|
566
|
+
this.log('Cleared Node require cache entry:', key);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
557
570
|
}
|
|
558
571
|
static init() {
|
|
559
572
|
if (this.isProd) {
|
package/dist/db/schema.d.ts
CHANGED
|
@@ -371,7 +371,7 @@ export declare const AccessTokensTable: import("drizzle-orm/mysql-core").MySqlTa
|
|
|
371
371
|
/**
|
|
372
372
|
* This table is used to store the settings of the CMS
|
|
373
373
|
*/
|
|
374
|
-
export declare const
|
|
374
|
+
export declare const CmsSettingsTable: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
375
375
|
name: "cms_settings";
|
|
376
376
|
schema: undefined;
|
|
377
377
|
columns: {
|
|
@@ -449,13 +449,13 @@ export declare const cmsSettingsTable: import("drizzle-orm/mysql-core").MySqlTab
|
|
|
449
449
|
/**
|
|
450
450
|
* This table is used to store information about the created tables
|
|
451
451
|
*/
|
|
452
|
-
export declare const
|
|
453
|
-
name: "
|
|
452
|
+
export declare const NextJsCmsTablesTable: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
453
|
+
name: "__nextjs_cms_tables";
|
|
454
454
|
schema: undefined;
|
|
455
455
|
columns: {
|
|
456
456
|
tableName: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
457
457
|
name: "name";
|
|
458
|
-
tableName: "
|
|
458
|
+
tableName: "__nextjs_cms_tables";
|
|
459
459
|
dataType: "string";
|
|
460
460
|
columnType: "MySqlVarChar";
|
|
461
461
|
data: string;
|
|
@@ -472,7 +472,7 @@ export declare const LZTablesTable: import("drizzle-orm/mysql-core").MySqlTableW
|
|
|
472
472
|
}, {}, {}>;
|
|
473
473
|
sectionName: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
474
474
|
name: "section";
|
|
475
|
-
tableName: "
|
|
475
|
+
tableName: "__nextjs_cms_tables";
|
|
476
476
|
dataType: "string";
|
|
477
477
|
columnType: "MySqlVarChar";
|
|
478
478
|
data: string;
|
|
@@ -489,7 +489,7 @@ export declare const LZTablesTable: import("drizzle-orm/mysql-core").MySqlTableW
|
|
|
489
489
|
}, {}, {}>;
|
|
490
490
|
createdAt: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
491
491
|
name: "created_at";
|
|
492
|
-
tableName: "
|
|
492
|
+
tableName: "__nextjs_cms_tables";
|
|
493
493
|
dataType: "date";
|
|
494
494
|
columnType: "MySqlTimestamp";
|
|
495
495
|
data: Date;
|
package/dist/db/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK3B,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI/B,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ5B,CAAA"}
|
package/dist/db/schema.js
CHANGED
|
@@ -45,7 +45,7 @@ export const AccessTokensTable = mysqlTable('access_tokens', {
|
|
|
45
45
|
/**
|
|
46
46
|
* This table is used to store the settings of the CMS
|
|
47
47
|
*/
|
|
48
|
-
export const
|
|
48
|
+
export const CmsSettingsTable = mysqlTable('cms_settings', {
|
|
49
49
|
id: int('id').primaryKey().default(1),
|
|
50
50
|
googleTagId: varchar('google_tag_id', { length: 100 }),
|
|
51
51
|
googlePropertyId: longtext('google_property_id'),
|
|
@@ -54,7 +54,7 @@ export const cmsSettingsTable = mysqlTable('cms_settings', {
|
|
|
54
54
|
/**
|
|
55
55
|
* This table is used to store information about the created tables
|
|
56
56
|
*/
|
|
57
|
-
export const
|
|
57
|
+
export const NextJsCmsTablesTable = mysqlTable('__nextjs_cms_tables', {
|
|
58
58
|
tableName: varchar('name', { length: 100 }).primaryKey().notNull(),
|
|
59
59
|
sectionName: varchar('section', { length: 200 }),
|
|
60
60
|
createdAt: timestamp('created_at').defaultNow().notNull(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextjs-cms",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.66",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -151,8 +151,8 @@
|
|
|
151
151
|
"tsx": "^4.20.6",
|
|
152
152
|
"typescript": "^5.9.2",
|
|
153
153
|
"@lzcms/eslint-config": "0.3.0",
|
|
154
|
-
"@lzcms/
|
|
155
|
-
"@lzcms/
|
|
154
|
+
"@lzcms/prettier-config": "0.1.0",
|
|
155
|
+
"@lzcms/tsconfig": "0.1.0"
|
|
156
156
|
},
|
|
157
157
|
"license": "MIT",
|
|
158
158
|
"keywords": [
|