@ruvyxa/adapter-netlify 1.0.25 → 1.0.26
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 +9 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +9 -3
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAgD,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAgD,MAAM,cAAc,CAAA;AAYzF;;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;AAuFD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAyI3E;eAEc,cAAc"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CLIENT_BUNDLE_PREFIX, clientBuildOutput, IMMUTABLE_CACHE_CONTROL, projectRelativeOutDir, PUBLIC_ASSET_CACHE_CONTROL, publicAssetGlobs, validateBuildContext, } from '@ruvyxa/core';
|
|
1
|
+
import { CLIENT_BUNDLE_PREFIX, clientBuildOutput, IMMUTABLE_CACHE_CONTROL, projectRelativeOutDir, PUBLIC_ASSET_CACHE_CONTROL, publicAssetGlobs, runtimeBuildPolicy, validateBuildContext, } from '@ruvyxa/core';
|
|
2
2
|
/**
|
|
3
3
|
* Netlify Functions v2 handler source code.
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@ import { CLIENT_BUNDLE_PREFIX, clientBuildOutput, IMMUTABLE_CACHE_CONTROL, proje
|
|
|
6
6
|
* handler using the Web-standard Request/Response API. Reads the route
|
|
7
7
|
* manifest and handles SSR/API/ISR/PPR requests.
|
|
8
8
|
*/
|
|
9
|
-
function netlifyHandlerSource() {
|
|
9
|
+
function netlifyHandlerSource(runtimePolicy) {
|
|
10
10
|
return `import { createHandler, prerenderRelativePath } from './serverless-handler.mjs';
|
|
11
11
|
import { loadRouteModule } from './route-modules.mjs';
|
|
12
12
|
// Netlify bundles the function with esbuild, so anything the deployed code
|
|
@@ -17,6 +17,8 @@ import { readFileSync, writeFileSync, mkdirSync, statSync } from 'node:fs';
|
|
|
17
17
|
import os from 'node:os';
|
|
18
18
|
import path from 'node:path';
|
|
19
19
|
|
|
20
|
+
const runtimePolicy = ${JSON.stringify(runtimePolicy ?? {})};
|
|
21
|
+
|
|
20
22
|
// Deploy-time prerender output is likewise dropped by the bundler unless the
|
|
21
23
|
// site declares included_files. Reads are best-effort: a miss falls through to
|
|
22
24
|
// an on-demand render, and Netlify serves SSG pages from the publish directory
|
|
@@ -35,6 +37,8 @@ const readEntry = (htmlPath, revalidate) => {
|
|
|
35
37
|
|
|
36
38
|
const handler = createHandler({
|
|
37
39
|
routes: manifest.routes,
|
|
40
|
+
middleware: runtimePolicy.middleware,
|
|
41
|
+
i18n: manifest.i18n,
|
|
38
42
|
importPage: loadRouteModule,
|
|
39
43
|
importApi: loadRouteModule,
|
|
40
44
|
readPrerendered: (pathname, revalidate = 60) => {
|
|
@@ -113,6 +117,7 @@ export function netlifyAdapter(options = {}) {
|
|
|
113
117
|
// Config files are committed or read on other machines; never embed the
|
|
114
118
|
// absolute build-machine outDir in them.
|
|
115
119
|
const relativeOutDir = projectRelativeOutDir(ctx);
|
|
120
|
+
const runtimePolicy = runtimeBuildPolicy(ctx);
|
|
116
121
|
// Hashed client bundles are served under /__ruvyxa/client/ (see the
|
|
117
122
|
// chunk manifest src fields); the immutable header must match that URL.
|
|
118
123
|
// `public/` assets are not hashed and otherwise inherit Netlify's
|
|
@@ -171,7 +176,7 @@ export function netlifyAdapter(options = {}) {
|
|
|
171
176
|
{
|
|
172
177
|
kind: 'function',
|
|
173
178
|
path: 'deploy/netlify/functions/ruvyxa-handler',
|
|
174
|
-
handlerSource: netlifyHandlerSource(),
|
|
179
|
+
handlerSource: netlifyHandlerSource(runtimePolicy),
|
|
175
180
|
},
|
|
176
181
|
// Netlify config for the deploy directory
|
|
177
182
|
{
|
|
@@ -189,7 +194,7 @@ export function netlifyAdapter(options = {}) {
|
|
|
189
194
|
kind: 'function',
|
|
190
195
|
path: '.netlify/v1/functions/ruvyxa-handler',
|
|
191
196
|
scope: 'project',
|
|
192
|
-
handlerSource: netlifyHandlerSource(),
|
|
197
|
+
handlerSource: netlifyHandlerSource(runtimePolicy),
|
|
193
198
|
},
|
|
194
199
|
{
|
|
195
200
|
kind: 'file',
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,cAAc,CAAA;AA8BrB;;;;;;GAMG;AACH,SAAS,oBAAoB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,cAAc,CAAA;AA8BrB;;;;;;GAMG;AACH,SAAS,oBAAoB,CAAC,aAAsB;IAClD,OAAO;;;;;;;;;;wBAUe,IAAI,CAAC,SAAS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/adapter-netlify",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26",
|
|
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",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@ruvyxa/core": "^1.0.
|
|
42
|
+
"@ruvyxa/core": "^1.0.26"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "tsc -p tsconfig.json",
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
projectRelativeOutDir,
|
|
7
7
|
PUBLIC_ASSET_CACHE_CONTROL,
|
|
8
8
|
publicAssetGlobs,
|
|
9
|
+
runtimeBuildPolicy,
|
|
9
10
|
validateBuildContext,
|
|
10
11
|
} from '@ruvyxa/core'
|
|
11
12
|
|
|
@@ -44,7 +45,7 @@ export interface NetlifyAdapterOptions {
|
|
|
44
45
|
* handler using the Web-standard Request/Response API. Reads the route
|
|
45
46
|
* manifest and handles SSR/API/ISR/PPR requests.
|
|
46
47
|
*/
|
|
47
|
-
function netlifyHandlerSource(): string {
|
|
48
|
+
function netlifyHandlerSource(runtimePolicy: unknown): string {
|
|
48
49
|
return `import { createHandler, prerenderRelativePath } from './serverless-handler.mjs';
|
|
49
50
|
import { loadRouteModule } from './route-modules.mjs';
|
|
50
51
|
// Netlify bundles the function with esbuild, so anything the deployed code
|
|
@@ -55,6 +56,8 @@ import { readFileSync, writeFileSync, mkdirSync, statSync } from 'node:fs';
|
|
|
55
56
|
import os from 'node:os';
|
|
56
57
|
import path from 'node:path';
|
|
57
58
|
|
|
59
|
+
const runtimePolicy = ${JSON.stringify(runtimePolicy ?? {})};
|
|
60
|
+
|
|
58
61
|
// Deploy-time prerender output is likewise dropped by the bundler unless the
|
|
59
62
|
// site declares included_files. Reads are best-effort: a miss falls through to
|
|
60
63
|
// an on-demand render, and Netlify serves SSG pages from the publish directory
|
|
@@ -73,6 +76,8 @@ const readEntry = (htmlPath, revalidate) => {
|
|
|
73
76
|
|
|
74
77
|
const handler = createHandler({
|
|
75
78
|
routes: manifest.routes,
|
|
79
|
+
middleware: runtimePolicy.middleware,
|
|
80
|
+
i18n: manifest.i18n,
|
|
76
81
|
importPage: loadRouteModule,
|
|
77
82
|
importApi: loadRouteModule,
|
|
78
83
|
readPrerendered: (pathname, revalidate = 60) => {
|
|
@@ -156,6 +161,7 @@ export function netlifyAdapter(options: NetlifyAdapterOptions = {}): Adapter {
|
|
|
156
161
|
// Config files are committed or read on other machines; never embed the
|
|
157
162
|
// absolute build-machine outDir in them.
|
|
158
163
|
const relativeOutDir = projectRelativeOutDir(ctx)
|
|
164
|
+
const runtimePolicy = runtimeBuildPolicy(ctx)
|
|
159
165
|
|
|
160
166
|
// Hashed client bundles are served under /__ruvyxa/client/ (see the
|
|
161
167
|
// chunk manifest src fields); the immutable header must match that URL.
|
|
@@ -229,7 +235,7 @@ export function netlifyAdapter(options: NetlifyAdapterOptions = {}): Adapter {
|
|
|
229
235
|
{
|
|
230
236
|
kind: 'function',
|
|
231
237
|
path: 'deploy/netlify/functions/ruvyxa-handler',
|
|
232
|
-
handlerSource: netlifyHandlerSource(),
|
|
238
|
+
handlerSource: netlifyHandlerSource(runtimePolicy),
|
|
233
239
|
},
|
|
234
240
|
// Netlify config for the deploy directory
|
|
235
241
|
{
|
|
@@ -247,7 +253,7 @@ export function netlifyAdapter(options: NetlifyAdapterOptions = {}): Adapter {
|
|
|
247
253
|
kind: 'function',
|
|
248
254
|
path: '.netlify/v1/functions/ruvyxa-handler',
|
|
249
255
|
scope: 'project',
|
|
250
|
-
handlerSource: netlifyHandlerSource(),
|
|
256
|
+
handlerSource: netlifyHandlerSource(runtimePolicy),
|
|
251
257
|
} satisfies AdapterArtifact,
|
|
252
258
|
{
|
|
253
259
|
kind: 'file',
|