@stacksjs/defaults 0.70.156 → 0.70.157

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.
@@ -5,7 +5,7 @@ export default new Action({
5
5
  description: 'Returns dependency data for the dashboard.',
6
6
  method: 'GET',
7
7
  async handle() {
8
- const { readFileSync, readdirSync } = await import('node:fs')
8
+ const { readFileSync } = await import('node:fs')
9
9
  const { join } = await import('node:path')
10
10
  const projectRoot = process.cwd()
11
11
 
@@ -18,8 +18,11 @@ export default new Action({
18
18
 
19
19
  try {
20
20
  const declaredSet: Record<string, boolean> = {}
21
- const lockPath = join(projectRoot, 'pantry.lock')
22
- const lockfile = JSON.parse(readFileSync(lockPath, 'utf-8'))
21
+ const lockPath = join(projectRoot, 'bun.lock')
22
+ const lockfile = Bun.JSONC.parse(readFileSync(lockPath, 'utf-8')) as {
23
+ workspaces?: Record<string, { dependencies?: Record<string, string>, devDependencies?: Record<string, string> }>
24
+ packages?: Record<string, [string, ...unknown[]]>
25
+ }
23
26
  const workspaces = lockfile.workspaces || {}
24
27
 
25
28
  for (const wsKey of Object.keys(workspaces)) {
@@ -35,36 +38,19 @@ export default new Action({
35
38
  }
36
39
  declared.sort((a, b) => String(a.name).localeCompare(String(b.name)))
37
40
 
38
- // Scan pantry directory for transitive deps
39
- const pantryDir = join(projectRoot, 'pantry')
40
- const entries = readdirSync(pantryDir, { withFileTypes: true })
41
- for (const entry of entries) {
42
- if (!entry.isDirectory()) continue
43
- if (entry.name.startsWith('@')) {
44
- const scopeDir = join(pantryDir, entry.name)
45
- try {
46
- const scopedEntries = readdirSync(scopeDir, { withFileTypes: true })
47
- for (const se of scopedEntries) {
48
- if (!se.isDirectory()) continue
49
- const pkgName = `${entry.name}/${se.name}`
50
- if (!declaredSet[pkgName]) {
51
- let ver = '0.0.0'
52
- try { ver = JSON.parse(readFileSync(join(scopeDir, se.name, 'package.json'), 'utf-8')).version || '0.0.0' }
53
- catch { /* ignore */ }
54
- transitive.push({ name: pkgName, version: ver, isScoped: true })
55
- }
56
- }
57
- }
58
- catch { /* ignore */ }
59
- }
60
- else if (entry.name !== '.bin' && entry.name !== 'node_modules') {
61
- if (!declaredSet[entry.name]) {
62
- let ver = '0.0.0'
63
- try { ver = JSON.parse(readFileSync(join(pantryDir, entry.name, 'package.json'), 'utf-8')).version || '0.0.0' }
64
- catch { /* ignore */ }
65
- transitive.push({ name: entry.name, version: ver, isScoped: false })
66
- }
67
- }
41
+ const transitiveSet = new Set<string>()
42
+ for (const value of Object.values(lockfile.packages || {})) {
43
+ const resolution = value[0]
44
+ if (resolution.includes('@workspace:')) continue
45
+ const versionSeparator = resolution.startsWith('@')
46
+ ? resolution.indexOf('@', 1)
47
+ : resolution.lastIndexOf('@')
48
+ if (versionSeparator <= 0) continue
49
+ const name = resolution.slice(0, versionSeparator)
50
+ const version = resolution.slice(versionSeparator + 1)
51
+ if (declaredSet[name] || transitiveSet.has(name)) continue
52
+ transitiveSet.add(name)
53
+ transitive.push({ name, version, isScoped: name.includes('/') })
68
54
  }
69
55
  transitive.sort((a, b) => String(a.name).localeCompare(String(b.name)))
70
56
 
@@ -74,7 +60,7 @@ export default new Action({
74
60
  totalCount = declared.length + transitiveCount
75
61
  }
76
62
  catch {
77
- // pantry.lock or pantry/ may not exist
63
+ // bun.lock may not exist yet
78
64
  }
79
65
 
80
66
  const thirdParty = declared.filter(p => !p.isWorkspace)
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.70.156",
5
+ "version": "0.70.157",
6
6
  "description": "Default Stacks scaffold resources (views, layouts, components, preloader) — shipped so apps consuming the framework from node_modules get the same fallback resources a vendored checkout provides. Source of truth: storage/framework/defaults.",
7
7
  "author": "Chris Breuer",
8
8
  "license": "MIT",