@sveltejs/adapter-vercel 1.0.0-next.62 → 1.0.0-next.65
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 +35 -4
- package/package.json +3 -4
package/index.js
CHANGED
|
@@ -93,7 +93,6 @@ export default function ({ external = [], edge, split } = {}) {
|
|
|
93
93
|
|
|
94
94
|
const tmp = builder.getBuildDirectory('vercel-tmp');
|
|
95
95
|
|
|
96
|
-
builder.rimraf(dir);
|
|
97
96
|
builder.rimraf(tmp);
|
|
98
97
|
|
|
99
98
|
const files = fileURLToPath(new URL('./files', import.meta.url).href);
|
|
@@ -152,6 +151,7 @@ export default function ({ external = [], edge, split } = {}) {
|
|
|
152
151
|
);
|
|
153
152
|
|
|
154
153
|
await create_function_bundle(
|
|
154
|
+
builder,
|
|
155
155
|
`${tmp}/index.js`,
|
|
156
156
|
`${dirs.functions}/${name}.func`,
|
|
157
157
|
`nodejs${node_version.major}.x`
|
|
@@ -236,7 +236,6 @@ export default function ({ external = [], edge, split } = {}) {
|
|
|
236
236
|
|
|
237
237
|
builder.log.minor('Copying assets...');
|
|
238
238
|
|
|
239
|
-
builder.writeStatic(dirs.static);
|
|
240
239
|
builder.writeClient(dirs.static);
|
|
241
240
|
builder.writePrerendered(dirs.static);
|
|
242
241
|
|
|
@@ -288,22 +287,54 @@ function get_node_version() {
|
|
|
288
287
|
}
|
|
289
288
|
|
|
290
289
|
/**
|
|
290
|
+
* @param {import('@sveltejs/kit').Builder} builder
|
|
291
291
|
* @param {string} entry
|
|
292
292
|
* @param {string} dir
|
|
293
293
|
* @param {string} runtime
|
|
294
294
|
*/
|
|
295
|
-
async function create_function_bundle(entry, dir, runtime) {
|
|
295
|
+
async function create_function_bundle(builder, entry, dir, runtime) {
|
|
296
|
+
fs.rmSync(dir, { force: true, recursive: true });
|
|
297
|
+
|
|
296
298
|
let base = entry;
|
|
297
299
|
while (base !== (base = path.dirname(base)));
|
|
298
300
|
|
|
299
301
|
const traced = await nodeFileTrace([entry], { base });
|
|
300
302
|
|
|
303
|
+
/** @type {Map<string, string[]>} */
|
|
304
|
+
const resolution_failures = new Map();
|
|
305
|
+
|
|
301
306
|
traced.warnings.forEach((error) => {
|
|
302
307
|
// pending https://github.com/vercel/nft/issues/284
|
|
303
308
|
if (error.message.startsWith('Failed to resolve dependency node:')) return;
|
|
304
|
-
|
|
309
|
+
|
|
310
|
+
if (error.message.startsWith('Failed to resolve dependency')) {
|
|
311
|
+
const match = /Cannot find module '(.+?)' loaded from (.+)/;
|
|
312
|
+
const [, module, importer] = match.exec(error.message);
|
|
313
|
+
|
|
314
|
+
if (!resolution_failures.has(importer)) {
|
|
315
|
+
resolution_failures.set(importer, []);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
resolution_failures.get(importer).push(module);
|
|
319
|
+
} else {
|
|
320
|
+
throw error;
|
|
321
|
+
}
|
|
305
322
|
});
|
|
306
323
|
|
|
324
|
+
if (resolution_failures.size > 0) {
|
|
325
|
+
const cwd = process.cwd();
|
|
326
|
+
builder.log.warn(
|
|
327
|
+
'The following modules failed to locate dependencies that may (or may not) be required for your app to work:'
|
|
328
|
+
);
|
|
329
|
+
|
|
330
|
+
for (const [importer, modules] of resolution_failures) {
|
|
331
|
+
console.error(` ${path.relative(cwd, importer)}`);
|
|
332
|
+
for (const module of modules) {
|
|
333
|
+
console.error(` - \u001B[1m\u001B[36m${module}\u001B[39m\u001B[22m`);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
307
338
|
// find common ancestor directory
|
|
308
339
|
let common_parts;
|
|
309
340
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/adapter-vercel",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.65",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -27,14 +27,13 @@
|
|
|
27
27
|
"esbuild": "^0.14.48"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@sveltejs/kit": "1.0.0-next.
|
|
30
|
+
"@sveltejs/kit": "1.0.0-next.380",
|
|
31
31
|
"@types/node": "^16.11.36",
|
|
32
32
|
"typescript": "^4.7.4"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"lint": "
|
|
35
|
+
"lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
|
|
36
36
|
"format": "npm run check-format -- --write",
|
|
37
|
-
"check-format": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
|
|
38
37
|
"check": "tsc"
|
|
39
38
|
}
|
|
40
39
|
}
|