@agntcms/next 0.3.0 → 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 CHANGED
@@ -82,17 +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
- output: "standalone",
93
- pageExtensions
99
+ pageExtensions,
100
+ outputFileTracingIncludes
94
101
  };
95
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
+ }
96
120
 
97
121
  // src/domain/form.ts
98
122
  var FORM_FORBIDDEN_KINDS = /* @__PURE__ */ new Set([
package/dist/config.d.cts CHANGED
@@ -96,24 +96,23 @@ 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
  *
102
- * Sets `output: 'standalone'` so the production Docker build
103
- * (which copies `.next/standalone/`) works out of the box.
104
- *
105
- * Also injects a `pageExtensions` default: in dev we accept `.dev.ts` /
103
+ * Injects a `pageExtensions` default: in dev we accept `.dev.ts` /
106
104
  * `.dev.tsx` so dev-only routes (preview, admin, MCP) can be named
107
105
  * `route.dev.ts` and excluded from the production build automatically.
108
106
  * If the user already provided `pageExtensions`, theirs wins — the
109
107
  * convention is opt-in.
110
108
  *
111
- * In future versions this may also configure webpack aliases,
112
- * image optimization domains, or framework-level middleware.
109
+ * Exists as the stable wrapping point for future framework-level
110
+ * Next.js config (webpack aliases, image domains, middleware), so the
111
+ * template's call site does not need to change as the framework grows.
113
112
  */
114
113
  declare function withagntcms<T extends Record<string, unknown>>(nextConfig: T): T & {
115
- output: 'standalone';
116
114
  pageExtensions: string[];
115
+ outputFileTracingIncludes: TracingIncludes;
117
116
  };
118
117
 
119
118
  export { type AgentCmsConfig, AnyFormDefinition, type PageTemplate, type ResolvedConfig, type SubmissionRateLimit, SubmissionStorageAdapter, defineConfig, withagntcms };
package/dist/config.d.ts CHANGED
@@ -96,24 +96,23 @@ 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
  *
102
- * Sets `output: 'standalone'` so the production Docker build
103
- * (which copies `.next/standalone/`) works out of the box.
104
- *
105
- * Also injects a `pageExtensions` default: in dev we accept `.dev.ts` /
103
+ * Injects a `pageExtensions` default: in dev we accept `.dev.ts` /
106
104
  * `.dev.tsx` so dev-only routes (preview, admin, MCP) can be named
107
105
  * `route.dev.ts` and excluded from the production build automatically.
108
106
  * If the user already provided `pageExtensions`, theirs wins — the
109
107
  * convention is opt-in.
110
108
  *
111
- * In future versions this may also configure webpack aliases,
112
- * image optimization domains, or framework-level middleware.
109
+ * Exists as the stable wrapping point for future framework-level
110
+ * Next.js config (webpack aliases, image domains, middleware), so the
111
+ * template's call site does not need to change as the framework grows.
113
112
  */
114
113
  declare function withagntcms<T extends Record<string, unknown>>(nextConfig: T): T & {
115
- output: 'standalone';
116
114
  pageExtensions: string[];
115
+ outputFileTracingIncludes: TracingIncludes;
117
116
  };
118
117
 
119
118
  export { type AgentCmsConfig, AnyFormDefinition, type PageTemplate, type ResolvedConfig, type SubmissionRateLimit, SubmissionStorageAdapter, defineConfig, withagntcms };
package/dist/config.mjs CHANGED
@@ -37,17 +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
- output: "standalone",
48
- pageExtensions
54
+ pageExtensions,
55
+ outputFileTracingIncludes
49
56
  };
50
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
+ }
51
75
 
52
76
  // src/domain/form.ts
53
77
  var FORM_FORBIDDEN_KINDS = /* @__PURE__ */ new Set([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agntcms/next",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "agntcms runtime for Next.js: domain model, storage adapters, React components",
5
5
  "type": "module",
6
6
  "private": false,