@sveltejs/adapter-netlify 4.4.1 → 5.0.0
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/index.js +18 -5
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -55,6 +55,18 @@ export default function ({ split = false, edge = edge_set_in_env_var } = {}) {
|
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
if (existsSync(`${builder.config.kit.files.assets}/_headers`)) {
|
|
59
|
+
throw new Error(
|
|
60
|
+
`The _headers file should be placed in the project root rather than the ${builder.config.kit.files.assets} directory`
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (existsSync(`${builder.config.kit.files.assets}/_redirects`)) {
|
|
65
|
+
throw new Error(
|
|
66
|
+
`The _redirects file should be placed in the project root rather than the ${builder.config.kit.files.assets} directory`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
58
70
|
const netlify_config = get_netlify_config();
|
|
59
71
|
|
|
60
72
|
// "build" is the default publish directory when Netlify detects SvelteKit
|
|
@@ -143,7 +155,8 @@ async function generate_edge_functions({ builder }) {
|
|
|
143
155
|
writeFileSync(`${tmp}/manifest.js`, `export const manifest = ${manifest};\n`);
|
|
144
156
|
|
|
145
157
|
/** @type {{ assets: Set<string> }} */
|
|
146
|
-
|
|
158
|
+
// we have to prepend the file:// protocol because Windows doesn't support absolute path imports
|
|
159
|
+
const { assets } = (await import(`file://${tmp}/manifest.js`)).manifest;
|
|
147
160
|
|
|
148
161
|
const path = '/*';
|
|
149
162
|
// We only need to specify paths without the trailing slash because
|
|
@@ -297,12 +310,12 @@ function generate_lambda_functions({ builder, publish, split }) {
|
|
|
297
310
|
// so that generated redirects are appended to custom redirects
|
|
298
311
|
// rather than replaced by them
|
|
299
312
|
builder.log.minor('Writing redirects...');
|
|
300
|
-
const
|
|
313
|
+
const redirects_file = join(publish, '_redirects');
|
|
301
314
|
if (existsSync('_redirects')) {
|
|
302
|
-
builder.copy('_redirects',
|
|
315
|
+
builder.copy('_redirects', redirects_file);
|
|
303
316
|
}
|
|
304
|
-
builder.mkdirp(dirname(
|
|
305
|
-
appendFileSync(
|
|
317
|
+
builder.mkdirp(dirname(redirects_file));
|
|
318
|
+
appendFileSync(redirects_file, `\n\n${redirects.join('\n')}`);
|
|
306
319
|
}
|
|
307
320
|
|
|
308
321
|
function get_netlify_config() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/adapter-netlify",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "A SvelteKit adapter that creates a Netlify app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adapter",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"rollup": "^4.14.2",
|
|
48
48
|
"typescript": "^5.3.3",
|
|
49
49
|
"vitest": "^3.0.1",
|
|
50
|
-
"@sveltejs/kit": "^2.
|
|
50
|
+
"@sveltejs/kit": "^2.20.1"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@sveltejs/kit": "^2.4.0"
|