@agntcms/next 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.cjs +26 -1
- package/dist/config.d.cts +2 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.mjs +26 -1
- package/package.json +1 -1
package/dist/config.cjs
CHANGED
|
@@ -82,16 +82,41 @@ function defineConfig(config) {
|
|
|
82
82
|
// src/config/withagntcms.ts
|
|
83
83
|
var DEV_PAGE_EXTENSIONS = ["dev.ts", "dev.tsx", "ts", "tsx", "js", "jsx"];
|
|
84
84
|
var PROD_PAGE_EXTENSIONS = ["ts", "tsx", "js", "jsx"];
|
|
85
|
+
var CONTENT_TRACE_GLOB = "./content/**/*";
|
|
85
86
|
function withagntcms(nextConfig) {
|
|
86
87
|
const isProd = process.env.NODE_ENV === "production";
|
|
87
88
|
const defaultPageExtensions = isProd ? PROD_PAGE_EXTENSIONS : DEV_PAGE_EXTENSIONS;
|
|
88
89
|
const userPageExtensions = nextConfig.pageExtensions;
|
|
89
90
|
const pageExtensions = Array.isArray(userPageExtensions) ? userPageExtensions : [...defaultPageExtensions];
|
|
91
|
+
const userTracingIncludes = isPlainRecordOfStringArrays(
|
|
92
|
+
nextConfig.outputFileTracingIncludes
|
|
93
|
+
) ? nextConfig.outputFileTracingIncludes : {};
|
|
94
|
+
const outputFileTracingIncludes = mergeTracingIncludes(userTracingIncludes, {
|
|
95
|
+
"/**": [CONTENT_TRACE_GLOB]
|
|
96
|
+
});
|
|
90
97
|
return {
|
|
91
98
|
...nextConfig,
|
|
92
|
-
pageExtensions
|
|
99
|
+
pageExtensions,
|
|
100
|
+
outputFileTracingIncludes
|
|
93
101
|
};
|
|
94
102
|
}
|
|
103
|
+
function isPlainRecordOfStringArrays(value) {
|
|
104
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
105
|
+
for (const v of Object.values(value)) {
|
|
106
|
+
if (!Array.isArray(v)) return false;
|
|
107
|
+
if (!v.every((item) => typeof item === "string")) return false;
|
|
108
|
+
}
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
function mergeTracingIncludes(user, framework) {
|
|
112
|
+
const result = {};
|
|
113
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(user), ...Object.keys(framework)]);
|
|
114
|
+
for (const key of keys) {
|
|
115
|
+
const merged = [...user[key] ?? [], ...framework[key] ?? []];
|
|
116
|
+
result[key] = Array.from(new Set(merged));
|
|
117
|
+
}
|
|
118
|
+
return result;
|
|
119
|
+
}
|
|
95
120
|
|
|
96
121
|
// src/domain/form.ts
|
|
97
122
|
var FORM_FORBIDDEN_KINDS = /* @__PURE__ */ new Set([
|
package/dist/config.d.cts
CHANGED
|
@@ -96,6 +96,7 @@ interface ResolvedConfig {
|
|
|
96
96
|
*/
|
|
97
97
|
declare function defineConfig(config: AgentCmsConfig): ResolvedConfig;
|
|
98
98
|
|
|
99
|
+
type TracingIncludes = Record<string, string[]>;
|
|
99
100
|
/**
|
|
100
101
|
* Wrap a Next.js configuration object for agntcms.
|
|
101
102
|
*
|
|
@@ -111,6 +112,7 @@ declare function defineConfig(config: AgentCmsConfig): ResolvedConfig;
|
|
|
111
112
|
*/
|
|
112
113
|
declare function withagntcms<T extends Record<string, unknown>>(nextConfig: T): T & {
|
|
113
114
|
pageExtensions: string[];
|
|
115
|
+
outputFileTracingIncludes: TracingIncludes;
|
|
114
116
|
};
|
|
115
117
|
|
|
116
118
|
export { type AgentCmsConfig, AnyFormDefinition, type PageTemplate, type ResolvedConfig, type SubmissionRateLimit, SubmissionStorageAdapter, defineConfig, withagntcms };
|
package/dist/config.d.ts
CHANGED
|
@@ -96,6 +96,7 @@ interface ResolvedConfig {
|
|
|
96
96
|
*/
|
|
97
97
|
declare function defineConfig(config: AgentCmsConfig): ResolvedConfig;
|
|
98
98
|
|
|
99
|
+
type TracingIncludes = Record<string, string[]>;
|
|
99
100
|
/**
|
|
100
101
|
* Wrap a Next.js configuration object for agntcms.
|
|
101
102
|
*
|
|
@@ -111,6 +112,7 @@ declare function defineConfig(config: AgentCmsConfig): ResolvedConfig;
|
|
|
111
112
|
*/
|
|
112
113
|
declare function withagntcms<T extends Record<string, unknown>>(nextConfig: T): T & {
|
|
113
114
|
pageExtensions: string[];
|
|
115
|
+
outputFileTracingIncludes: TracingIncludes;
|
|
114
116
|
};
|
|
115
117
|
|
|
116
118
|
export { type AgentCmsConfig, AnyFormDefinition, type PageTemplate, type ResolvedConfig, type SubmissionRateLimit, SubmissionStorageAdapter, defineConfig, withagntcms };
|
package/dist/config.mjs
CHANGED
|
@@ -37,16 +37,41 @@ function defineConfig(config) {
|
|
|
37
37
|
// src/config/withagntcms.ts
|
|
38
38
|
var DEV_PAGE_EXTENSIONS = ["dev.ts", "dev.tsx", "ts", "tsx", "js", "jsx"];
|
|
39
39
|
var PROD_PAGE_EXTENSIONS = ["ts", "tsx", "js", "jsx"];
|
|
40
|
+
var CONTENT_TRACE_GLOB = "./content/**/*";
|
|
40
41
|
function withagntcms(nextConfig) {
|
|
41
42
|
const isProd = process.env.NODE_ENV === "production";
|
|
42
43
|
const defaultPageExtensions = isProd ? PROD_PAGE_EXTENSIONS : DEV_PAGE_EXTENSIONS;
|
|
43
44
|
const userPageExtensions = nextConfig.pageExtensions;
|
|
44
45
|
const pageExtensions = Array.isArray(userPageExtensions) ? userPageExtensions : [...defaultPageExtensions];
|
|
46
|
+
const userTracingIncludes = isPlainRecordOfStringArrays(
|
|
47
|
+
nextConfig.outputFileTracingIncludes
|
|
48
|
+
) ? nextConfig.outputFileTracingIncludes : {};
|
|
49
|
+
const outputFileTracingIncludes = mergeTracingIncludes(userTracingIncludes, {
|
|
50
|
+
"/**": [CONTENT_TRACE_GLOB]
|
|
51
|
+
});
|
|
45
52
|
return {
|
|
46
53
|
...nextConfig,
|
|
47
|
-
pageExtensions
|
|
54
|
+
pageExtensions,
|
|
55
|
+
outputFileTracingIncludes
|
|
48
56
|
};
|
|
49
57
|
}
|
|
58
|
+
function isPlainRecordOfStringArrays(value) {
|
|
59
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
60
|
+
for (const v of Object.values(value)) {
|
|
61
|
+
if (!Array.isArray(v)) return false;
|
|
62
|
+
if (!v.every((item) => typeof item === "string")) return false;
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
function mergeTracingIncludes(user, framework) {
|
|
67
|
+
const result = {};
|
|
68
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(user), ...Object.keys(framework)]);
|
|
69
|
+
for (const key of keys) {
|
|
70
|
+
const merged = [...user[key] ?? [], ...framework[key] ?? []];
|
|
71
|
+
result[key] = Array.from(new Set(merged));
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
50
75
|
|
|
51
76
|
// src/domain/form.ts
|
|
52
77
|
var FORM_FORBIDDEN_KINDS = /* @__PURE__ */ new Set([
|