canopycms-next 0.0.59 → 0.0.60
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 +8 -2
- package/dist/config.mjs +8 -2
- package/dist/with-canopy.d.ts +9 -5
- package/dist/with-canopy.d.ts.map +1 -1
- package/dist/with-canopy.js +29 -10
- package/dist/with-canopy.js.map +1 -1
- package/package.json +3 -3
package/dist/config.cjs
CHANGED
|
@@ -45,6 +45,7 @@ var OPTIONAL_PACKAGES = [
|
|
|
45
45
|
"canopycms-cdk"
|
|
46
46
|
];
|
|
47
47
|
var CMS_PAGE_EXTENSIONS = ["server.ts", "server.tsx"];
|
|
48
|
+
var STATIC_PAGE_EXTENSIONS = ["static.ts", "static.tsx"];
|
|
48
49
|
var NEXTJS_DEFAULT_PAGE_EXTENSIONS = ["tsx", "ts", "jsx", "js"];
|
|
49
50
|
var ASSETS_REWRITE = {
|
|
50
51
|
source: "/assets/:path*",
|
|
@@ -112,11 +113,16 @@ function withCanopy(nextConfig = {}, options = {}) {
|
|
|
112
113
|
}
|
|
113
114
|
return config;
|
|
114
115
|
} : existingWebpack;
|
|
115
|
-
const pageExtensions =
|
|
116
|
+
const pageExtensions = [
|
|
117
|
+
.../* @__PURE__ */ new Set([
|
|
118
|
+
...nextConfig.pageExtensions ?? NEXTJS_DEFAULT_PAGE_EXTENSIONS,
|
|
119
|
+
...options.staticBuild ? STATIC_PAGE_EXTENSIONS : CMS_PAGE_EXTENSIONS
|
|
120
|
+
])
|
|
121
|
+
];
|
|
116
122
|
return {
|
|
117
123
|
...nextConfig,
|
|
118
124
|
transpilePackages: allPackages,
|
|
119
|
-
|
|
125
|
+
pageExtensions,
|
|
120
126
|
webpack,
|
|
121
127
|
rewrites: withAssetsRewrite(nextConfig.rewrites)
|
|
122
128
|
};
|
package/dist/config.mjs
CHANGED
|
@@ -9,6 +9,7 @@ var OPTIONAL_PACKAGES = [
|
|
|
9
9
|
"canopycms-cdk"
|
|
10
10
|
];
|
|
11
11
|
var CMS_PAGE_EXTENSIONS = ["server.ts", "server.tsx"];
|
|
12
|
+
var STATIC_PAGE_EXTENSIONS = ["static.ts", "static.tsx"];
|
|
12
13
|
var NEXTJS_DEFAULT_PAGE_EXTENSIONS = ["tsx", "ts", "jsx", "js"];
|
|
13
14
|
var ASSETS_REWRITE = {
|
|
14
15
|
source: "/assets/:path*",
|
|
@@ -76,11 +77,16 @@ function withCanopy(nextConfig = {}, options = {}) {
|
|
|
76
77
|
}
|
|
77
78
|
return config;
|
|
78
79
|
} : existingWebpack;
|
|
79
|
-
const pageExtensions =
|
|
80
|
+
const pageExtensions = [
|
|
81
|
+
.../* @__PURE__ */ new Set([
|
|
82
|
+
...nextConfig.pageExtensions ?? NEXTJS_DEFAULT_PAGE_EXTENSIONS,
|
|
83
|
+
...options.staticBuild ? STATIC_PAGE_EXTENSIONS : CMS_PAGE_EXTENSIONS
|
|
84
|
+
])
|
|
85
|
+
];
|
|
80
86
|
return {
|
|
81
87
|
...nextConfig,
|
|
82
88
|
transpilePackages: allPackages,
|
|
83
|
-
|
|
89
|
+
pageExtensions,
|
|
84
90
|
webpack,
|
|
85
91
|
rewrites: withAssetsRewrite(nextConfig.rewrites)
|
|
86
92
|
};
|
package/dist/with-canopy.d.ts
CHANGED
|
@@ -6,9 +6,12 @@ export interface WithCanopyOptions {
|
|
|
6
6
|
* Set to `true` for static export builds to exclude CMS-only pages.
|
|
7
7
|
*
|
|
8
8
|
* When `false` (default): adds `server.ts` and `server.tsx` to `pageExtensions`,
|
|
9
|
-
* so Next.js processes `.server.ts` and `.server.tsx` files (API routes, editor page
|
|
9
|
+
* so Next.js processes `.server.ts` and `.server.tsx` files (API routes, editor page,
|
|
10
|
+
* and the server-build variant of a dual-build content route).
|
|
10
11
|
*
|
|
11
|
-
* When `true`:
|
|
12
|
+
* When `true`: adds `static.ts` and `static.tsx` to `pageExtensions` instead, so
|
|
13
|
+
* Next.js processes the static-export-only variant of a dual-build content route
|
|
14
|
+
* (e.g. `page.static.tsx`) while ignoring `.server.*` CMS-only files.
|
|
12
15
|
*
|
|
13
16
|
* @example
|
|
14
17
|
* ```ts
|
|
@@ -26,9 +29,10 @@ export interface WithCanopyOptions {
|
|
|
26
29
|
* - Auto-detects installed Canopy packages and adds them to `transpilePackages`
|
|
27
30
|
* (they export raw TypeScript). Only packages found in your node_modules are
|
|
28
31
|
* added, so you don't need to worry about optional packages you haven't installed.
|
|
29
|
-
* - Adds `server.ts`/`server.tsx`
|
|
30
|
-
* CMS-only files (e.g., `route.server.ts`)
|
|
31
|
-
* but excluded when `staticBuild: true` is set
|
|
32
|
+
* - Adds `server.ts`/`server.tsx` (or, when `staticBuild: true`, `static.ts`/`static.tsx`)
|
|
33
|
+
* to `pageExtensions` for dual-build support. CMS-only files (e.g., `route.server.ts`)
|
|
34
|
+
* are included in dev/CMS builds but excluded when `staticBuild: true` is set, in favor
|
|
35
|
+
* of the static-export-only page variants (e.g. `page.static.tsx`).
|
|
32
36
|
* - Resolves React to a single copy from your project root, preventing
|
|
33
37
|
* dual-instance crashes when using `file:` symlinks for local development
|
|
34
38
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-canopy.d.ts","sourceRoot":"","sources":["../src/with-canopy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"with-canopy.d.ts","sourceRoot":"","sources":["../src/with-canopy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAoGtC,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB;;;;;;;;;;;;;;;;OAgBG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAyBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,UAAU,CACxB,UAAU,GAAE,UAAe,EAC3B,OAAO,GAAE,iBAAsB,GAC9B,UAAU,CA2EZ"}
|
package/dist/with-canopy.js
CHANGED
|
@@ -20,6 +20,19 @@ const OPTIONAL_PACKAGES = [
|
|
|
20
20
|
* are included in dev/CMS builds but excluded from static export builds.
|
|
21
21
|
*/
|
|
22
22
|
const CMS_PAGE_EXTENSIONS = ['server.ts', 'server.tsx'];
|
|
23
|
+
/**
|
|
24
|
+
* Static-export-only page extensions used by the dual-build convention.
|
|
25
|
+
* Files with these extensions (e.g., `page.static.tsx`) are included only in
|
|
26
|
+
* static export builds (`staticBuild: true`), letting a content route ship
|
|
27
|
+
* per-build variants: `page.static.tsx` prerenders (with `dynamicParams =
|
|
28
|
+
* false`, required by `output: 'export'`) while `page.server.tsx` renders
|
|
29
|
+
* every request at request time (`dynamic = 'force-dynamic'`, no
|
|
30
|
+
* generateStaticParams) so path ACLs apply and unknown slugs 404 instead of
|
|
31
|
+
* throwing Next's internal NoFallbackError. Next statically parses
|
|
32
|
+
* route-segment config, so a single shared page cannot switch these on an
|
|
33
|
+
* env var.
|
|
34
|
+
*/
|
|
35
|
+
const STATIC_PAGE_EXTENSIONS = ['static.ts', 'static.tsx'];
|
|
23
36
|
/**
|
|
24
37
|
* Next.js default pageExtensions. Not exported as a public API by Next.js
|
|
25
38
|
* (only available via internal `next/dist/server/config-shared`), so we
|
|
@@ -105,9 +118,10 @@ function resolveReactAliases(resolve) {
|
|
|
105
118
|
* - Auto-detects installed Canopy packages and adds them to `transpilePackages`
|
|
106
119
|
* (they export raw TypeScript). Only packages found in your node_modules are
|
|
107
120
|
* added, so you don't need to worry about optional packages you haven't installed.
|
|
108
|
-
* - Adds `server.ts`/`server.tsx`
|
|
109
|
-
* CMS-only files (e.g., `route.server.ts`)
|
|
110
|
-
* but excluded when `staticBuild: true` is set
|
|
121
|
+
* - Adds `server.ts`/`server.tsx` (or, when `staticBuild: true`, `static.ts`/`static.tsx`)
|
|
122
|
+
* to `pageExtensions` for dual-build support. CMS-only files (e.g., `route.server.ts`)
|
|
123
|
+
* are included in dev/CMS builds but excluded when `staticBuild: true` is set, in favor
|
|
124
|
+
* of the static-export-only page variants (e.g. `page.static.tsx`).
|
|
111
125
|
* - Resolves React to a single copy from your project root, preventing
|
|
112
126
|
* dual-instance crashes when using `file:` symlinks for local development
|
|
113
127
|
*
|
|
@@ -184,16 +198,21 @@ export function withCanopy(nextConfig = {}, options = {}) {
|
|
|
184
198
|
// Until Turbopack supports absolute path aliases, consumers using
|
|
185
199
|
// file: symlinks must use `next dev --webpack` for local development.
|
|
186
200
|
// Turbopack works fine when canopycms is installed from npm (no symlinks).
|
|
187
|
-
// Dual-build support:
|
|
188
|
-
//
|
|
189
|
-
//
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
201
|
+
// Dual-build support: a static build gets STATIC_PAGE_EXTENSIONS (e.g. `page.static.tsx`)
|
|
202
|
+
// instead of CMS_PAGE_EXTENSIONS, so CMS-only files (`route.server.ts`, `page.server.tsx`)
|
|
203
|
+
// are excluded from static export while the static-only page variants are included.
|
|
204
|
+
// Set-dedupe guards against a consumer config that already lists any of the
|
|
205
|
+
// canopy variant extensions (duplicates would be harmless to Next but noisy).
|
|
206
|
+
const pageExtensions = [
|
|
207
|
+
...new Set([
|
|
208
|
+
...(nextConfig.pageExtensions ?? NEXTJS_DEFAULT_PAGE_EXTENSIONS),
|
|
209
|
+
...(options.staticBuild ? STATIC_PAGE_EXTENSIONS : CMS_PAGE_EXTENSIONS),
|
|
210
|
+
]),
|
|
211
|
+
];
|
|
193
212
|
return {
|
|
194
213
|
...nextConfig,
|
|
195
214
|
transpilePackages: allPackages,
|
|
196
|
-
|
|
215
|
+
pageExtensions,
|
|
197
216
|
webpack,
|
|
198
217
|
rewrites: withAssetsRewrite(nextConfig.rewrites),
|
|
199
218
|
};
|
package/dist/with-canopy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-canopy.js","source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,QAAQ,EAAE,iBAAiB,CAAC,UAAU,CAAC,QAAQ,CAAC;KACjD,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "canopycms-next",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.60",
|
|
4
4
|
"description": "Next.js adapter for CanopyCMS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"next": "^13.5.7 || ^14.2.25 || ^15.2.3 || ^16",
|
|
38
38
|
"react": "^18.0.0 || ^19.0.0",
|
|
39
|
-
"canopycms": "0.0.
|
|
39
|
+
"canopycms": "0.0.60"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^22.9.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"react": "^18.3.1",
|
|
47
47
|
"typescript": "^5.6.3",
|
|
48
48
|
"vitest": "^4.1.0",
|
|
49
|
-
"canopycms": "0.0.
|
|
49
|
+
"canopycms": "0.0.60"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsc -p tsconfig.build.json && esbuild src/config.ts --bundle --platform=node --packages=external --external:next --format=cjs --outfile=dist/config.cjs && esbuild src/config.ts --bundle --platform=node --packages=external --external:next --format=esm --outfile=dist/config.mjs",
|