@vercel/sandbox 0.0.15 → 0.0.17
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-typecheck.log +1 -1
- package/CHANGELOG.md +16 -0
- package/dist/api-client/api-client.d.ts +13 -8
- package/dist/api-client/api-client.js +25 -4
- package/dist/api-client/api-error.d.ts +0 -1
- package/dist/api-client/base-client.d.ts +1 -2
- package/dist/api-client/base-client.js +1 -5
- package/dist/api-client/validators.d.ts +42 -29
- package/dist/api-client/validators.js +1 -0
- package/dist/api-client/with-retry.d.ts +0 -1
- package/dist/command.d.ts +27 -8
- package/dist/command.js +26 -5
- package/dist/sandbox.d.ts +12 -5
- package/dist/sandbox.js +10 -0
- package/dist/utils/normalizePath.d.ts +17 -0
- package/dist/utils/normalizePath.js +31 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -4
- package/src/api-client/api-client.ts +32 -5
- package/src/api-client/api-error.ts +0 -2
- package/src/api-client/base-client.ts +1 -2
- package/src/api-client/validators.ts +2 -1
- package/src/api-client/with-retry.ts +0 -1
- package/src/command.ts +29 -7
- package/src/sandbox.test.ts +42 -1
- package/src/sandbox.ts +17 -5
- package/src/utils/normalizePath.test.ts +114 -0
- package/src/utils/normalizePath.ts +33 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Normalize a path and make it relative to `params.extractDir` for inclusion
|
|
5
|
+
* in our tar archives.
|
|
6
|
+
*
|
|
7
|
+
* Relative paths are first resolved to `params.cwd`.
|
|
8
|
+
* Absolute paths are normalized and resolved relative to `params.extractDir`.
|
|
9
|
+
*
|
|
10
|
+
* In addition, paths are normalized so consecutive slashes are removed and
|
|
11
|
+
* stuff like `../..` is resolved appropriately.
|
|
12
|
+
*
|
|
13
|
+
* This function always returns a path relative to `params.extractDir`.
|
|
14
|
+
*/
|
|
15
|
+
export function normalizePath(params: {
|
|
16
|
+
filePath: string;
|
|
17
|
+
cwd: string;
|
|
18
|
+
extractDir: string;
|
|
19
|
+
}) {
|
|
20
|
+
if (!path.posix.isAbsolute(params.cwd)) {
|
|
21
|
+
throw new Error("cwd dir must be absolute");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!path.posix.isAbsolute(params.extractDir)) {
|
|
25
|
+
throw new Error("extractDir must be absolute");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const basePath = path.posix.isAbsolute(params.filePath)
|
|
29
|
+
? path.posix.normalize(params.filePath)
|
|
30
|
+
: path.posix.join(params.cwd, params.filePath);
|
|
31
|
+
|
|
32
|
+
return path.posix.relative(params.extractDir, basePath);
|
|
33
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Autogenerated by inject-version.ts
|
|
2
|
-
export const VERSION = "0.0.
|
|
2
|
+
export const VERSION = "0.0.17";
|