@ruvyxa/adapter-netlify 1.1.0 → 1.1.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/index.d.ts.map +1 -1
- package/dist/index.js +22 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +24 -9
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAgD,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAgD,MAAM,cAAc,CAAA;AAczF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAuID;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAwJpE;eAEc,OAAO"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { CLIENT_BUNDLE_PREFIX, clientBuildOutput, IMMUTABLE_CACHE_CONTROL, projectRelativeOutDir, PUBLIC_ASSET_CACHE_CONTROL, publicAssetGlobs, runtimeBuildPolicy, validateBuildContext, } from '@ruvyxa/core';
|
|
2
|
+
import { CLIENT_BUNDLE_PREFIX, clientBuildOutput, DEFAULT_SECURITY_HEADERS, IMMUTABLE_CACHE_CONTROL, nonPublishableStrategies, projectRelativeOutDir, PUBLIC_ASSET_CACHE_CONTROL, publicAssetGlobs, runtimeBuildPolicy, validateBuildContext, } from '@ruvyxa/core';
|
|
3
3
|
/**
|
|
4
4
|
* Netlify Functions v2 handler source code.
|
|
5
5
|
*
|
|
@@ -69,6 +69,10 @@ const handler = createHandler({
|
|
|
69
69
|
mkdirSync(path.dirname(htmlPath), { recursive: true });
|
|
70
70
|
writeFileSync(htmlPath, html, 'utf8');
|
|
71
71
|
},
|
|
72
|
+
// The project's own not-found page, pre-rendered by the build and carried
|
|
73
|
+
// inline in the manifest: an unmatched URL is answered with the page the
|
|
74
|
+
// application actually wrote, on every host.
|
|
75
|
+
notFoundDocument: manifest.notFoundDocument,
|
|
72
76
|
supportedStrategies: ['ssr', 'ssg', 'csr', 'isr', 'ppr', 'api'],
|
|
73
77
|
});
|
|
74
78
|
|
|
@@ -138,16 +142,28 @@ export function netlify(options = {}) {
|
|
|
138
142
|
// `public/` assets are not hashed and otherwise inherit Netlify's
|
|
139
143
|
// revalidate-every-request default, so they get the same lifetime the
|
|
140
144
|
// Rust server sends for the same files.
|
|
145
|
+
//
|
|
146
|
+
// The `/*` rule carries the security defaults, and it is first because
|
|
147
|
+
// Netlify publishes pre-rendered documents and public files itself: the
|
|
148
|
+
// function — where `createHandler` sets these headers — is never invoked
|
|
149
|
+
// for them. Without it a deployed SSG page lost every header the same
|
|
150
|
+
// page carries under `ruvyxa start`, including `X-Frame-Options`.
|
|
141
151
|
const headerRules = [
|
|
142
|
-
{ for:
|
|
152
|
+
{ for: '/*', values: { ...DEFAULT_SECURITY_HEADERS } },
|
|
153
|
+
{
|
|
154
|
+
for: `${CLIENT_BUNDLE_PREFIX}*`,
|
|
155
|
+
values: { 'Cache-Control': IMMUTABLE_CACHE_CONTROL },
|
|
156
|
+
},
|
|
143
157
|
...publicAssetGlobs().map((glob) => ({
|
|
144
158
|
for: glob,
|
|
145
|
-
|
|
159
|
+
values: { 'Cache-Control': PUBLIC_ASSET_CACHE_CONTROL },
|
|
146
160
|
})),
|
|
147
161
|
];
|
|
148
162
|
const immutableHeaderToml = headerRules
|
|
149
163
|
.map((rule) => `[[headers]]\n for = "${rule.for}"\n [headers.values]\n` +
|
|
150
|
-
|
|
164
|
+
Object.entries(rule.values)
|
|
165
|
+
.map(([name, value]) => ` ${name} = "${value}"\n`)
|
|
166
|
+
.join(''))
|
|
151
167
|
.join('');
|
|
152
168
|
// Netlify.toml for the deploy directory
|
|
153
169
|
const netlifyToml = '[build]\n publish = "publish"\n functions = "functions"\n\n' + immutableHeaderToml;
|
|
@@ -159,10 +175,7 @@ export function netlify(options = {}) {
|
|
|
159
175
|
immutableHeaderToml;
|
|
160
176
|
// Frameworks API deploy configuration (.netlify/v1/config.json)
|
|
161
177
|
const frameworksApiConfig = JSON.stringify({
|
|
162
|
-
headers: headerRules.map((rule) => ({
|
|
163
|
-
for: rule.for,
|
|
164
|
-
values: { 'Cache-Control': rule.cacheControl },
|
|
165
|
-
})),
|
|
178
|
+
headers: headerRules.map((rule) => ({ for: rule.for, values: rule.values })),
|
|
166
179
|
}, null, 2);
|
|
167
180
|
return {
|
|
168
181
|
name: 'netlify',
|
|
@@ -185,7 +198,7 @@ export function netlify(options = {}) {
|
|
|
185
198
|
kind: 'static-site',
|
|
186
199
|
path: 'deploy/netlify/publish',
|
|
187
200
|
optional: true,
|
|
188
|
-
excludeStrategies:
|
|
201
|
+
excludeStrategies: nonPublishableStrategies(),
|
|
189
202
|
},
|
|
190
203
|
// Serverless function bundle
|
|
191
204
|
{
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGtC,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,cAAc,CAAA;AA8BrB;;;;;;GAMG;AACH,SA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BACX;yBAC5B,CAAC;oBACN,GAAG,CAAC,OAAO,CAAC,aAAa,KAAK,IAAI;wBAChC,CAAC,CAAC;4BACE;gCACE,IAAI,EAAE,MAAM;gCACZ,IAAI,EAAE,cAAc;gCACpB,KAAK,EAAE,SAAS;gCAChB,YAAY,EAAE,IAAI;gCAClB,QAAQ,EAAE,kBAAkB;6BACH;yBAC5B;wBACH,CAAC,CAAC,EAAE,CAAC;iBACR;aACF,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,eAAe,OAAO,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ruvyxa/adapter-netlify",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Shape Ruvyxa builds for Netlify functions and assets with a small typed adapter contract.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@ruvyxa/core": "^1.1.
|
|
59
|
+
"@ruvyxa/core": "^1.1.2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/node": "24.13.3"
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,9 @@ import type { Adapter, AdapterArtifact, AdapterOutput, BuildContext } from '@ruv
|
|
|
4
4
|
import {
|
|
5
5
|
CLIENT_BUNDLE_PREFIX,
|
|
6
6
|
clientBuildOutput,
|
|
7
|
+
DEFAULT_SECURITY_HEADERS,
|
|
7
8
|
IMMUTABLE_CACHE_CONTROL,
|
|
9
|
+
nonPublishableStrategies,
|
|
8
10
|
projectRelativeOutDir,
|
|
9
11
|
PUBLIC_ASSET_CACHE_CONTROL,
|
|
10
12
|
publicAssetGlobs,
|
|
@@ -112,6 +114,10 @@ const handler = createHandler({
|
|
|
112
114
|
mkdirSync(path.dirname(htmlPath), { recursive: true });
|
|
113
115
|
writeFileSync(htmlPath, html, 'utf8');
|
|
114
116
|
},
|
|
117
|
+
// The project's own not-found page, pre-rendered by the build and carried
|
|
118
|
+
// inline in the manifest: an unmatched URL is answered with the page the
|
|
119
|
+
// application actually wrote, on every host.
|
|
120
|
+
notFoundDocument: manifest.notFoundDocument,
|
|
115
121
|
supportedStrategies: ['ssr', 'ssg', 'csr', 'isr', 'ppr', 'api'],
|
|
116
122
|
});
|
|
117
123
|
|
|
@@ -214,11 +220,21 @@ export function netlify(options: NetlifyAdapterOptions = {}): Adapter {
|
|
|
214
220
|
// `public/` assets are not hashed and otherwise inherit Netlify's
|
|
215
221
|
// revalidate-every-request default, so they get the same lifetime the
|
|
216
222
|
// Rust server sends for the same files.
|
|
217
|
-
|
|
218
|
-
|
|
223
|
+
//
|
|
224
|
+
// The `/*` rule carries the security defaults, and it is first because
|
|
225
|
+
// Netlify publishes pre-rendered documents and public files itself: the
|
|
226
|
+
// function — where `createHandler` sets these headers — is never invoked
|
|
227
|
+
// for them. Without it a deployed SSG page lost every header the same
|
|
228
|
+
// page carries under `ruvyxa start`, including `X-Frame-Options`.
|
|
229
|
+
const headerRules: Array<{ for: string; values: Record<string, string> }> = [
|
|
230
|
+
{ for: '/*', values: { ...DEFAULT_SECURITY_HEADERS } },
|
|
231
|
+
{
|
|
232
|
+
for: `${CLIENT_BUNDLE_PREFIX}*`,
|
|
233
|
+
values: { 'Cache-Control': IMMUTABLE_CACHE_CONTROL },
|
|
234
|
+
},
|
|
219
235
|
...publicAssetGlobs().map((glob) => ({
|
|
220
236
|
for: glob,
|
|
221
|
-
|
|
237
|
+
values: { 'Cache-Control': PUBLIC_ASSET_CACHE_CONTROL },
|
|
222
238
|
})),
|
|
223
239
|
]
|
|
224
240
|
|
|
@@ -226,7 +242,9 @@ export function netlify(options: NetlifyAdapterOptions = {}): Adapter {
|
|
|
226
242
|
.map(
|
|
227
243
|
(rule) =>
|
|
228
244
|
`[[headers]]\n for = "${rule.for}"\n [headers.values]\n` +
|
|
229
|
-
|
|
245
|
+
Object.entries(rule.values)
|
|
246
|
+
.map(([name, value]) => ` ${name} = "${value}"\n`)
|
|
247
|
+
.join(''),
|
|
230
248
|
)
|
|
231
249
|
.join('')
|
|
232
250
|
|
|
@@ -245,10 +263,7 @@ export function netlify(options: NetlifyAdapterOptions = {}): Adapter {
|
|
|
245
263
|
// Frameworks API deploy configuration (.netlify/v1/config.json)
|
|
246
264
|
const frameworksApiConfig = JSON.stringify(
|
|
247
265
|
{
|
|
248
|
-
headers: headerRules.map((rule) => ({
|
|
249
|
-
for: rule.for,
|
|
250
|
-
values: { 'Cache-Control': rule.cacheControl },
|
|
251
|
-
})),
|
|
266
|
+
headers: headerRules.map((rule) => ({ for: rule.for, values: rule.values })),
|
|
252
267
|
},
|
|
253
268
|
null,
|
|
254
269
|
2,
|
|
@@ -275,7 +290,7 @@ export function netlify(options: NetlifyAdapterOptions = {}): Adapter {
|
|
|
275
290
|
kind: 'static-site',
|
|
276
291
|
path: 'deploy/netlify/publish',
|
|
277
292
|
optional: true,
|
|
278
|
-
excludeStrategies:
|
|
293
|
+
excludeStrategies: nonPublishableStrategies(),
|
|
279
294
|
},
|
|
280
295
|
// Serverless function bundle
|
|
281
296
|
{
|