@sveltejs/adapter-netlify 1.0.0-next.74 → 1.0.0-next.77
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.
|
File without changes
|
package/files/cjs/shims.js
CHANGED
|
@@ -17204,7 +17204,7 @@ class Body {
|
|
|
17204
17204
|
return formData;
|
|
17205
17205
|
}
|
|
17206
17206
|
|
|
17207
|
-
const {toFormData} = await Promise.resolve().then(function () { return require('./multipart-parser-
|
|
17207
|
+
const {toFormData} = await Promise.resolve().then(function () { return require('./multipart-parser-091dba8a.js'); });
|
|
17208
17208
|
return toFormData(this.body, ct);
|
|
17209
17209
|
}
|
|
17210
17210
|
|
|
@@ -17932,7 +17932,8 @@ const globals = {
|
|
|
17932
17932
|
Headers: Headers$1,
|
|
17933
17933
|
ReadableStream: require$$10.ReadableStream,
|
|
17934
17934
|
TransformStream: require$$10.TransformStream,
|
|
17935
|
-
WritableStream: require$$10.WritableStream
|
|
17935
|
+
WritableStream: require$$10.WritableStream,
|
|
17936
|
+
FormData
|
|
17936
17937
|
};
|
|
17937
17938
|
|
|
17938
17939
|
// exported for dev/preview and node environments
|
|
File without changes
|
package/files/esm/shims.js
CHANGED
|
@@ -17182,7 +17182,7 @@ class Body {
|
|
|
17182
17182
|
return formData;
|
|
17183
17183
|
}
|
|
17184
17184
|
|
|
17185
|
-
const {toFormData} = await import('./multipart-parser-
|
|
17185
|
+
const {toFormData} = await import('./multipart-parser-87a176ee.js');
|
|
17186
17186
|
return toFormData(this.body, ct);
|
|
17187
17187
|
}
|
|
17188
17188
|
|
|
@@ -17910,7 +17910,8 @@ const globals = {
|
|
|
17910
17910
|
Headers: Headers$1,
|
|
17911
17911
|
ReadableStream: ReadableStream$2,
|
|
17912
17912
|
TransformStream,
|
|
17913
|
-
WritableStream
|
|
17913
|
+
WritableStream,
|
|
17914
|
+
FormData
|
|
17914
17915
|
};
|
|
17915
17916
|
|
|
17916
17917
|
// exported for dev/preview and node environments
|
package/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { appendFileSync, existsSync, readFileSync, writeFileSync } from 'fs';
|
|
2
2
|
import { dirname, join, resolve, posix } from 'path';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
|
-
import glob from 'tiny-glob/sync.js';
|
|
5
4
|
import esbuild from 'esbuild';
|
|
6
5
|
import toml from '@iarna/toml';
|
|
7
6
|
|
|
@@ -66,10 +65,6 @@ export default function ({ split = false, edge = edge_set_in_env_var } = {}) {
|
|
|
66
65
|
`\n\n/${builder.config.kit.appDir}/immutable/*\n cache-control: public\n cache-control: immutable\n cache-control: max-age=31536000\n`
|
|
67
66
|
);
|
|
68
67
|
|
|
69
|
-
// for esbuild, use ESM
|
|
70
|
-
// for zip-it-and-ship-it, use CJS until https://github.com/netlify/zip-it-and-ship-it/issues/750
|
|
71
|
-
const esm = netlify_config?.functions?.node_bundler === 'esbuild';
|
|
72
|
-
|
|
73
68
|
if (edge) {
|
|
74
69
|
if (split) {
|
|
75
70
|
throw new Error('Cannot use `split: true` alongside `edge: true`');
|
|
@@ -77,7 +72,7 @@ export default function ({ split = false, edge = edge_set_in_env_var } = {}) {
|
|
|
77
72
|
|
|
78
73
|
await generate_edge_functions({ builder });
|
|
79
74
|
} else {
|
|
80
|
-
await generate_lambda_functions({ builder,
|
|
75
|
+
await generate_lambda_functions({ builder, split, publish });
|
|
81
76
|
}
|
|
82
77
|
}
|
|
83
78
|
};
|
|
@@ -148,9 +143,8 @@ async function generate_edge_functions({ builder }) {
|
|
|
148
143
|
* @param {import('@sveltejs/kit').Builder} params.builder
|
|
149
144
|
* @param { string } params.publish
|
|
150
145
|
* @param { boolean } params.split
|
|
151
|
-
* @param { boolean } params.esm
|
|
152
146
|
*/
|
|
153
|
-
async function generate_lambda_functions({ builder, publish, split
|
|
147
|
+
async function generate_lambda_functions({ builder, publish, split }) {
|
|
154
148
|
builder.mkdirp('.netlify/functions-internal');
|
|
155
149
|
|
|
156
150
|
/** @type {string[]} */
|
|
@@ -160,19 +154,11 @@ async function generate_lambda_functions({ builder, publish, split, esm }) {
|
|
|
160
154
|
const replace = {
|
|
161
155
|
'0SERVER': './server/index.js' // digit prefix prevents CJS build from using this as a variable name, which would also get replaced
|
|
162
156
|
};
|
|
163
|
-
if (esm) {
|
|
164
|
-
builder.copy(`${files}/esm`, '.netlify', { replace });
|
|
165
|
-
} else {
|
|
166
|
-
glob('**/*.js', { cwd: '.netlify/server' }).forEach((file) => {
|
|
167
|
-
const filepath = `.netlify/server/${file}`;
|
|
168
|
-
const input = readFileSync(filepath, 'utf8');
|
|
169
|
-
const output = esbuild.transformSync(input, { format: 'cjs', target: 'node12' }).code;
|
|
170
|
-
writeFileSync(filepath, output);
|
|
171
|
-
});
|
|
172
157
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
158
|
+
builder.copy(`${files}/esm`, '.netlify', { replace });
|
|
159
|
+
|
|
160
|
+
// Configuring the function to use ESM as the output format.
|
|
161
|
+
const fn_config = JSON.stringify({ config: { nodeModuleFormat: 'esm' }, version: 1 });
|
|
176
162
|
|
|
177
163
|
if (split) {
|
|
178
164
|
builder.log.minor('Generating serverless functions...');
|
|
@@ -201,17 +187,16 @@ async function generate_lambda_functions({ builder, publish, split, esm }) {
|
|
|
201
187
|
complete: (entry) => {
|
|
202
188
|
const manifest = entry.generateManifest({
|
|
203
189
|
relativePath: '../server',
|
|
204
|
-
format:
|
|
190
|
+
format: 'esm'
|
|
205
191
|
});
|
|
206
192
|
|
|
207
|
-
const fn =
|
|
208
|
-
? `import { init } from '../serverless.js';\n\nexport const handler = init(${manifest});\n`
|
|
209
|
-
: `const { init } = require('../serverless.js');\n\nexports.handler = init(${manifest});\n`;
|
|
193
|
+
const fn = `import { init } from '../serverless.js';\n\nexport const handler = init(${manifest});\n`;
|
|
210
194
|
|
|
211
|
-
writeFileSync(`.netlify/functions-internal/${name}.
|
|
195
|
+
writeFileSync(`.netlify/functions-internal/${name}.mjs`, fn);
|
|
196
|
+
writeFileSync(`.netlify/functions-internal/${name}.json`, fn_config);
|
|
212
197
|
|
|
213
198
|
redirects.push(`${pattern} /.netlify/functions/${name} 200`);
|
|
214
|
-
redirects.push(`${pattern}/__data.
|
|
199
|
+
redirects.push(`${pattern}/__data.js /.netlify/functions/${name} 200`);
|
|
215
200
|
}
|
|
216
201
|
};
|
|
217
202
|
});
|
|
@@ -220,14 +205,13 @@ async function generate_lambda_functions({ builder, publish, split, esm }) {
|
|
|
220
205
|
|
|
221
206
|
const manifest = builder.generateManifest({
|
|
222
207
|
relativePath: '../server',
|
|
223
|
-
format:
|
|
208
|
+
format: 'esm'
|
|
224
209
|
});
|
|
225
210
|
|
|
226
|
-
const fn =
|
|
227
|
-
? `import { init } from '../serverless.js';\n\nexport const handler = init(${manifest});\n`
|
|
228
|
-
: `const { init } = require('../serverless.js');\n\nexports.handler = init(${manifest});\n`;
|
|
211
|
+
const fn = `import { init } from '../serverless.js';\n\nexport const handler = init(${manifest});\n`;
|
|
229
212
|
|
|
230
|
-
writeFileSync(
|
|
213
|
+
writeFileSync(`.netlify/functions-internal/render.json`, fn_config);
|
|
214
|
+
writeFileSync('.netlify/functions-internal/render.mjs', fn);
|
|
231
215
|
redirects.push('* /.netlify/functions/render 200');
|
|
232
216
|
}
|
|
233
217
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/adapter-netlify",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.77",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -24,21 +24,20 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@iarna/toml": "^2.2.5",
|
|
27
|
-
"esbuild": "^0.
|
|
28
|
-
"set-cookie-parser": "^2.4.8"
|
|
29
|
-
"tiny-glob": "^0.2.9"
|
|
27
|
+
"esbuild": "^0.15.6",
|
|
28
|
+
"set-cookie-parser": "^2.4.8"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
31
|
"@netlify/functions": "^1.0.0",
|
|
33
32
|
"@rollup/plugin-commonjs": "^22.0.1",
|
|
34
33
|
"@rollup/plugin-json": "^4.1.0",
|
|
35
34
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
36
|
-
"@sveltejs/kit": "1.0.0-next.
|
|
35
|
+
"@sveltejs/kit": "1.0.0-next.481",
|
|
37
36
|
"@types/node": "^16.11.36",
|
|
38
37
|
"@types/set-cookie-parser": "^2.4.2",
|
|
39
38
|
"rimraf": "^3.0.2",
|
|
40
|
-
"rollup": "^2.
|
|
41
|
-
"typescript": "^4.
|
|
39
|
+
"rollup": "^2.78.1",
|
|
40
|
+
"typescript": "^4.8.2",
|
|
42
41
|
"uvu": "^0.5.3"
|
|
43
42
|
},
|
|
44
43
|
"scripts": {
|