@craft-native/svelte 0.0.496 → 0.0.499
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/package.json +3 -3
- package/src/peer-range.test.ts +20 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@craft-native/svelte",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.499",
|
|
4
4
|
"homepage": "https://github.com/craft-native/craft/tree/main/packages/svelte#readme",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"svelte": "^3.0.0 || ^4.0.0 || ^5.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"svelte": "^5.
|
|
47
|
+
"svelte": "^5.55.7",
|
|
48
48
|
"tsup": "^8.0.0",
|
|
49
49
|
"typescript": "7.1.0-dev.20261011.1"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"craft-native": "0.0.
|
|
52
|
+
"craft-native": "0.0.499"
|
|
53
53
|
}
|
|
54
54
|
}
|
package/src/peer-range.test.ts
CHANGED
|
@@ -104,8 +104,26 @@ test('the adapter builds against the major its range points consumers at', async
|
|
|
104
104
|
expect(highest, 'the peer range must name a major').toBeGreaterThan(0)
|
|
105
105
|
expect(Number(installed.version.split('.')[0]),
|
|
106
106
|
`the range offers ^${highest}.x but the adapter is built against Svelte ${installed.version}`).toBe(highest)
|
|
107
|
-
// And the devDependency, not just whatever happens to be hoisted
|
|
108
|
-
|
|
107
|
+
// And the devDependency, not just whatever happens to be hoisted: a caret
|
|
108
|
+
// range on that major, so the floor is what the range says.
|
|
109
|
+
const declared = manifest.devDependencies?.svelte ?? ''
|
|
110
|
+
const floor = /^\^(\d+)\.(\d+)\.(\d+)$/.exec(declared)?.slice(1).map(Number)
|
|
111
|
+
expect(floor, `the devDependency ${declared} must be a caret range`).toBeDefined()
|
|
112
|
+
expect(floor![0]).toBe(highest)
|
|
113
|
+
// This used to require `^5.0.0`, a floor OSV reports six advisories for:
|
|
114
|
+
// it named the right major and admitted the vulnerable start of it, so a
|
|
115
|
+
// fresh install without the lockfile could build against one of them.
|
|
116
|
+
// 5.55.7 is the first version OSV answers with none. The floor may rise
|
|
117
|
+
// from there and may not fall below it.
|
|
118
|
+
const clean = [5, 55, 7]
|
|
119
|
+
const atLeast = (left: number[], right: number[]): boolean => {
|
|
120
|
+
for (let at = 0; at < 3; at += 1) if (left[at] !== right[at]) return left[at]! > right[at]!
|
|
121
|
+
return true
|
|
122
|
+
}
|
|
123
|
+
expect(atLeast(floor!, clean), `the devDependency ${declared} admits a Svelte below ${clean.join('.')}`).toBe(true)
|
|
124
|
+
// And what is installed is inside the range that is declared.
|
|
125
|
+
expect(atLeast(installed.version.split('.').map(Number), floor!),
|
|
126
|
+
`Svelte ${installed.version} is installed, below the declared ${declared}`).toBe(true)
|
|
109
127
|
})
|
|
110
128
|
|
|
111
129
|
test("the adapter's imports exist in the installed Svelte", async () => {
|