@sveltejs/adapter-netlify 1.0.0-next.56 → 1.0.0-next.57

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.
Files changed (2) hide show
  1. package/index.js +16 -13
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -54,6 +54,19 @@ export default function ({ split = false, edge = edge_set_in_env_var } = {}) {
54
54
 
55
55
  builder.log.minor(`Publishing to "${publish}"`);
56
56
 
57
+ builder.log.minor('Copying assets...');
58
+ builder.writeStatic(publish);
59
+ builder.writeClient(publish);
60
+ builder.writePrerendered(publish);
61
+
62
+ builder.log.minor('Writing custom headers...');
63
+ const headers_file = join(publish, '_headers');
64
+ builder.copy('_headers', headers_file);
65
+ appendFileSync(
66
+ headers_file,
67
+ `\n\n/${builder.config.kit.appDir}/*\n cache-control: public\n cache-control: immutable\n cache-control: max-age=31536000\n`
68
+ );
69
+
57
70
  // for esbuild, use ESM
58
71
  // for zip-it-and-ship-it, use CJS until https://github.com/netlify/zip-it-and-ship-it/issues/750
59
72
  const esm = netlify_config?.functions?.node_bundler === 'esbuild';
@@ -67,19 +80,6 @@ export default function ({ split = false, edge = edge_set_in_env_var } = {}) {
67
80
  } else {
68
81
  await generate_lambda_functions({ builder, esm, split, publish });
69
82
  }
70
-
71
- builder.log.minor('Copying assets...');
72
- builder.writeStatic(publish);
73
- builder.writeClient(publish);
74
- builder.writePrerendered(publish);
75
-
76
- builder.log.minor('Writing custom headers...');
77
- const headers_file = join(publish, '_headers');
78
- builder.copy('_headers', headers_file);
79
- appendFileSync(
80
- headers_file,
81
- `\n\n/${builder.config.kit.appDir}/*\n cache-control: public\n cache-control: immutable\n cache-control: max-age=31536000\n`
82
- );
83
83
  }
84
84
  };
85
85
  }
@@ -230,6 +230,9 @@ function generate_lambda_functions({ builder, publish, split, esm }) {
230
230
  redirects.push('* /.netlify/functions/render 200');
231
231
  }
232
232
 
233
+ // this should happen at the end, after builder.writeStatic(...),
234
+ // so that generated redirects are appended to custom redirects
235
+ // rather than replaced by them
233
236
  builder.log.minor('Writing redirects...');
234
237
  const redirect_file = join(publish, '_redirects');
235
238
  if (existsSync('_redirects')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/adapter-netlify",
3
- "version": "1.0.0-next.56",
3
+ "version": "1.0.0-next.57",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -31,7 +31,7 @@
31
31
  "@rollup/plugin-commonjs": "^21.0.0",
32
32
  "@rollup/plugin-json": "^4.1.0",
33
33
  "@rollup/plugin-node-resolve": "^13.0.5",
34
- "@sveltejs/kit": "1.0.0-next.323",
34
+ "@sveltejs/kit": "1.0.0-next.329",
35
35
  "rimraf": "^3.0.2",
36
36
  "rollup": "^2.58.0",
37
37
  "typescript": "^4.6.2",