@exodus/stasis 1.0.0-beta.8 → 1.0.0-rc.0
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 +7 -2
- package/bin/stasis.js +263 -446
- package/package.json +38 -13
- 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 +1718 -908
- package/src/cmd/diff.js +1 -4
- package/src/cmd/github-bundle.js +48 -21
- package/src/cmd/output.js +24 -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 +221 -475
- 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 +170 -235
- package/src/resolve-node.js +33 -46
- 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 +241 -278
- 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 +54 -46
- package/src/vfs-bundle/github.js +115 -92
- 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 +434 -259
- package/src/vfs-bundle/yarnclean.js +79 -0
- package/src/vfs-bundle.js +25 -51
- package/src/webpack.js +0 -4
- package/src/why.js +79 -231
|
@@ -2,18 +2,14 @@ import { join } from 'node:path'
|
|
|
2
2
|
|
|
3
3
|
import { isTomlTable, readToml } from '../loaders/toml.js'
|
|
4
4
|
|
|
5
|
-
// What `soldeer install`
|
|
6
|
-
// (soldeer-core's update_config_libs and edit_remappings with RemappingsAction::Update): the
|
|
7
|
-
// remappings.txt it would write is written into the tree, which then serves it in place of the
|
|
8
|
-
// project's; a foundry.toml it would edit is refused, as is what this can't tell it would leave as
|
|
9
|
-
// it is. `view` is the project's root by paths from `/`, `root` its real path, for messages.
|
|
5
|
+
// What `soldeer install` 0.12.0 writes beside dependencies/: its remappings.txt goes into the tree; a foundry.toml edit is refused.
|
|
10
6
|
|
|
11
7
|
const SEMVER = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*)?(?:\+[\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*)?$/u
|
|
12
8
|
// A requirement Soldeer takes as exact: a bare version (its `^` made `=`), or one written `=`.
|
|
13
9
|
const EXACT = /^=?\s*(\S+)$/u
|
|
14
10
|
const withoutBuild = (version) => version.replace(/\+.*$/u, '')
|
|
15
11
|
|
|
16
|
-
// A
|
|
12
|
+
// A byte order mark kept, as Soldeer reads it.
|
|
17
13
|
function textOf(view, path) {
|
|
18
14
|
try {
|
|
19
15
|
return view.stat(path).type === 'file' ? view.readFile(path).toString('utf8') : undefined
|
|
@@ -22,17 +18,13 @@ function textOf(view, path) {
|
|
|
22
18
|
}
|
|
23
19
|
}
|
|
24
20
|
|
|
25
|
-
// Rust's `Path::components
|
|
21
|
+
// Rust's `Path::components`, `.` kept only at the start.
|
|
26
22
|
function components(path) {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
if (part !== '' && (part !== '.' || i === 0)) out.push(part)
|
|
30
|
-
}
|
|
31
|
-
return out
|
|
23
|
+
const parts = path.split('/').filter((part, i) => part !== '' && (part !== '.' || i === 0))
|
|
24
|
+
return path.startsWith('/') ? ['/', ...parts] : parts
|
|
32
25
|
}
|
|
33
26
|
|
|
34
|
-
//
|
|
35
|
-
// `dep`'s, as soldeer's path_matches tells, or null where only Rust's semver could tell.
|
|
27
|
+
// As soldeer's path_matches tells, or null where only Rust's semver could tell.
|
|
36
28
|
function folderMatches(dep, name) {
|
|
37
29
|
if (!name.startsWith(`${dep.name}-`)) return false
|
|
38
30
|
const version = name.slice(dep.name.length + 1)
|
|
@@ -43,37 +35,27 @@ function folderMatches(dep, name) {
|
|
|
43
35
|
return null
|
|
44
36
|
}
|
|
45
37
|
|
|
46
|
-
// The remappings Soldeer's update leaves, of `existing` (`[name, target]` pairs) and the config's
|
|
47
|
-
// dependencies, sorted as it sorts them (by their UTF-8 bytes).
|
|
48
38
|
function updatedRemappings(existing, deps, { regenerate, where }) {
|
|
49
|
-
const
|
|
50
|
-
let
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
lines.push(`${name}=${target.replaceAll(path.join('/').replace(/^\/\//u, '/'), `dependencies/${dep.folder}`)}`)
|
|
65
|
-
found = true
|
|
66
|
-
return false
|
|
67
|
-
})
|
|
68
|
-
if (!found) lines.push(line)
|
|
69
|
-
}
|
|
70
|
-
lines.push(...rest.map(([name, target]) => `${name}=${target}`))
|
|
39
|
+
const lines = []
|
|
40
|
+
let rest = regenerate ? [] : existing
|
|
41
|
+
for (const dep of deps) {
|
|
42
|
+
let found = false
|
|
43
|
+
rest = rest.filter(([name, target]) => {
|
|
44
|
+
const path = components(target).slice(0, 2)
|
|
45
|
+
const folder = path.at(-1)
|
|
46
|
+
const matches = folder === undefined || ['/', '.', '..'].includes(folder) ? false : folderMatches(dep, folder)
|
|
47
|
+
if (matches === null) throw new Error(`${where}: "${name}=${target}" names ${folder}, which \`soldeer install\` may rewrite to dependencies/${dep.folder}`)
|
|
48
|
+
if (!matches) return true
|
|
49
|
+
lines.push(`${name}=${target.replaceAll(path.join('/').replace(/^\/\//u, '/'), `dependencies/${dep.folder}`)}`)
|
|
50
|
+
found = true
|
|
51
|
+
return false
|
|
52
|
+
})
|
|
53
|
+
if (!found) lines.push(`${dep.remapped}=dependencies/${dep.folder}/`)
|
|
71
54
|
}
|
|
55
|
+
lines.push(...rest.map(([name, target]) => `${name}=${target}`))
|
|
72
56
|
return lines.toSorted((a, b) => Buffer.compare(Buffer.from(a), Buffer.from(b)))
|
|
73
57
|
}
|
|
74
58
|
|
|
75
|
-
// `[name, target]` of each remapping in `lines`, as Soldeer reads them: split at the first `=`, any
|
|
76
|
-
// line without one passed over.
|
|
77
59
|
const pairs = (lines) => lines.flatMap((line) => {
|
|
78
60
|
const at = line.indexOf('=')
|
|
79
61
|
return at === -1 ? [] : [[line.slice(0, at), line.slice(at + 1)]]
|
|
@@ -82,15 +64,12 @@ const pairs = (lines) => lines.flatMap((line) => {
|
|
|
82
64
|
export function settleSoldeer(view, vfs, root) {
|
|
83
65
|
const foundryText = textOf(view, '/foundry.toml')
|
|
84
66
|
const foundry = foundryText === undefined ? undefined : readToml(foundryText)
|
|
85
|
-
const
|
|
86
|
-
const config =
|
|
67
|
+
const inFoundry = isTomlTable(foundry?.dependencies)
|
|
68
|
+
const config = inFoundry ? foundry : readToml(textOf(view, '/soldeer.toml') ?? '')
|
|
87
69
|
const where = (file) => join(root, file)
|
|
88
|
-
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
if (!Array.isArray(libs) || !libs.includes('dependencies')) {
|
|
92
|
-
throw new Error(`${where('foundry.toml')}: [profile.default] libs holds no "dependencies", which \`soldeer install\` adds`)
|
|
93
|
-
}
|
|
70
|
+
const libs = foundry?.profile?.default?.libs
|
|
71
|
+
if (inFoundry && !(Array.isArray(libs) && libs.includes('dependencies'))) {
|
|
72
|
+
throw new Error(`${where('foundry.toml')}: [profile.default] libs holds no "dependencies", which \`soldeer install\` adds`)
|
|
94
73
|
}
|
|
95
74
|
|
|
96
75
|
const settings = { remappings_generate: true, remappings_regenerate: false, remappings_version: true, remappings_prefix: '', remappings_location: 'txt', ...config.soldeer }
|
|
@@ -104,7 +83,7 @@ export function settleSoldeer(view, vfs, root) {
|
|
|
104
83
|
})
|
|
105
84
|
|
|
106
85
|
const remappingsTxt = textOf(view, '/remappings.txt')
|
|
107
|
-
if (
|
|
86
|
+
if (inFoundry && settings.remappings_location === 'config') {
|
|
108
87
|
if (remappingsTxt !== undefined) throw new Error(`${where('remappings.txt')}: \`soldeer install\` removes it, as remappings_location is "config"`)
|
|
109
88
|
for (const [name, profile] of Object.entries(isTomlTable(foundry.profile) ? foundry.profile : {})) {
|
|
110
89
|
const current = Array.isArray(profile?.remappings) ? profile.remappings : undefined
|