@exodus/stasis 1.0.0-beta.9 → 1.0.0-rc.1
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/README.md +6 -2
- package/bin/stasis.js +222 -334
- package/package.json +38 -14
- package/src/audit-corrections.js +11 -42
- package/src/audit.js +256 -212
- package/src/babel.js +119 -82
- package/src/bundle-from-lockfile.js +9 -21
- package/src/bundle-reader.js +24 -8
- package/src/bundle.js +0 -3
- package/src/cmd/build.js +211 -117
- package/src/cmd/bundle-options.js +347 -0
- package/src/cmd/bundle.js +1664 -1001
- package/src/cmd/diff.js +1 -4
- package/src/cmd/github-bundle.js +48 -21
- package/src/cmd/output.js +25 -12
- package/src/cmd/sbom.js +6 -9
- package/src/cmd/tokens.js +60 -0
- package/src/define.js +218 -0
- package/src/diff.js +73 -129
- package/src/esbuild.js +0 -4
- package/src/flow.js +27 -0
- package/src/installed.js +265 -0
- package/src/json-stream.js +4 -9
- package/src/loader-mock.js +3 -8
- package/src/loader.js +1 -5
- package/src/loaders/bash.js +43 -120
- package/src/loaders/cargo.js +301 -808
- package/src/loaders/foundry.js +112 -290
- package/src/loaders/paths.js +15 -26
- package/src/loaders/php.js +211 -492
- package/src/loaders/rust.js +518 -1461
- package/src/loaders/solidity-ownership.js +51 -142
- package/src/loaders/solidity.js +42 -188
- package/src/loaders/toml.js +7 -17
- package/src/lockfile.js +0 -3
- package/src/metro-assets.js +41 -0
- package/src/metro-resolver.js +58 -133
- package/src/metro-transformer.js +0 -6
- package/src/metro.js +0 -4
- package/src/mock.js +32 -80
- package/src/parse.js +8 -7
- package/src/prune.js +0 -3
- package/src/resolve-fields.js +152 -249
- package/src/resolve-node.js +29 -45
- package/src/resolve-typescript.js +166 -298
- package/src/rollup.js +0 -4
- package/src/run-installed.js +10 -0
- package/src/sbom.js +70 -97
- package/src/scan.js +240 -282
- package/src/sixel.js +310 -0
- package/src/table.js +95 -0
- package/src/validate-notes.d.ts +19 -0
- package/src/validate-notes.js +72 -0
- package/src/validate.d.ts +159 -0
- package/src/validate.js +1315 -0
- package/src/vfs-bundle/entries.js +50 -46
- package/src/vfs-bundle/github.js +114 -94
- package/src/vfs-bundle/glob.js +379 -0
- package/src/vfs-bundle/lazy.js +99 -0
- package/src/vfs-bundle/prisma.js +235 -105
- package/src/vfs-bundle/soldeer.js +28 -49
- package/src/vfs-bundle/tree.js +418 -277
- package/src/vfs-bundle/yarnclean.js +79 -0
- package/src/vfs-bundle.js +24 -55
- package/src/webpack.js +0 -4
- package/src/why.js +79 -231
- package/src/installed-commits.js +0 -182
package/src/loaders/paths.js
CHANGED
|
@@ -1,33 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import { dirname } from 'node:path'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { relativeEscapes, toPosix } from '@exodus/stasis-core/util'
|
|
6
|
-
|
|
7
|
-
// Reject absolute and `..`-escaping paths in a `.<lang>.txt` listing so a malicious or sloppy
|
|
8
|
-
// listing can't read files outside the listing's own directory.
|
|
9
|
-
export function assertWithinBase(baseDir, candidate, label) {
|
|
10
|
-
if (isAbsolute(candidate)) throw new Error(`${label} must not be absolute: ${candidate}`)
|
|
11
|
-
const rel = toPosix(relative(baseDir, resolve(baseDir, candidate)))
|
|
12
|
-
if (relativeEscapes(rel)) {
|
|
13
|
-
throw new Error(`${label} escapes baseDir: ${candidate}`)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Apply `segments` on `fromFile`'s directory, resolving '.'/'..'. Returns a baseDir-relative POSIX
|
|
18
|
-
// path ('' for baseDir itself), or null when traversal escapes the root.
|
|
3
|
+
// `segments` applied on `fromFile`'s directory, as a baseDir-relative POSIX path ('' for baseDir
|
|
4
|
+
// itself); null when a `..` escapes the root.
|
|
19
5
|
export function applyToDir(fromFile, segments) {
|
|
20
|
-
const fromDir = fromFile.includes('/') ? fromFile.slice(0, fromFile.lastIndexOf('/')) : ''
|
|
21
|
-
const parts = [...(fromDir ? fromDir.split('/') : []), ...segments]
|
|
22
6
|
const resolved = []
|
|
23
|
-
for (const part of
|
|
7
|
+
for (const part of [...fromFile.split('/').slice(0, -1), ...segments]) {
|
|
24
8
|
if (part === '.' || part === '') continue
|
|
25
|
-
if (part
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} else {
|
|
29
|
-
resolved.push(part)
|
|
30
|
-
}
|
|
9
|
+
if (part !== '..') resolved.push(part)
|
|
10
|
+
else if (resolved.length === 0) return null
|
|
11
|
+
else resolved.pop()
|
|
31
12
|
}
|
|
32
13
|
return resolved.join('/')
|
|
33
14
|
}
|
|
15
|
+
|
|
16
|
+
// A `.`-led name such as `..cache/a.php` is a bare specifier, not a relative one.
|
|
17
|
+
export const isDotRelative = (spec) => spec === '.' || spec === '..' || spec.startsWith('./') || spec.startsWith('../')
|
|
18
|
+
|
|
19
|
+
export function* ancestors(dir) {
|
|
20
|
+
for (; dir !== dirname(dir); dir = dirname(dir)) yield dir
|
|
21
|
+
yield dir
|
|
22
|
+
}
|