@stacksjs/defaults 0.75.44 → 0.75.45

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.
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.75.44",
5
+ "version": "0.75.45",
6
6
  "description": "Stacks, built into VS Code: stx templates, pickier linting and formatting, encrypted env files, the dev server preview and every buddy command. No other extensions required.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
@@ -140,8 +140,9 @@
140
140
  "category": "stx"
141
141
  },
142
142
  {
143
- "command": "css.reload",
144
- "title": "Css: Reload Configuration"
143
+ "command": "stx.reloadUtilityClasses",
144
+ "title": "Reload Utility Class Configuration",
145
+ "category": "stx"
145
146
  }
146
147
  ],
147
148
  "menus": {
@@ -364,10 +365,11 @@
364
365
  "default": true,
365
366
  "description": "Enable autocomplete for utility classes"
366
367
  },
367
- "css.remToPxRatio": {
368
+ "stx.utilityClasses.remToPxRatio": {
368
369
  "type": "number",
369
370
  "default": 16,
370
- "description": "Rem to px conversion ratio for hover previews"
371
+ "minimum": 0,
372
+ "markdownDescription": "Pixels per `rem` for the px values utility-class hovers show next to `rem` values. `0` hides them. Replaces `css.remToPxRatio`, which is still read when this is not set."
371
373
  }
372
374
  }
373
375
  }
@@ -411,7 +413,7 @@
411
413
  ]
412
414
  },
413
415
  "devDependencies": {
414
- "@stacksjs/stx-vscode": "^0.2.352",
416
+ "@stacksjs/stx-vscode": "^0.2.355",
415
417
  "@types/vscode": "~1.109.0",
416
418
  "@vscode/vsce": "^4.0.0"
417
419
  }
@@ -31,9 +31,18 @@ function fromStx(path: string): string {
31
31
  return STX_DIR + path.replace(/^\.\//, '')
32
32
  }
33
33
 
34
- /** `manifest` with its stx contributions replaced by the library's. */
34
+ /** The namespace of the extension's own commands; every other one is stx's. */
35
+ export const OWN_COMMAND_PREFIX = 'stacks.'
36
+
37
+ /**
38
+ * `manifest` with its stx contributions replaced by the library's.
39
+ *
40
+ * Commands are told apart by namespace, not by the library's current list: a
41
+ * command stx renamed or dropped is no longer in that list, and filtering by
42
+ * it kept the old entry as if it were this extension's own (`css.reload`
43
+ * outlived its rename to `stx.reloadUtilityClasses` that way).
44
+ */
35
45
  export function withStxContributes(manifest: any, stx: StxContributes): any {
36
- const stxCommands = new Set(stx.commands.map(command => command.command))
37
46
  const contributes = manifest.contributes
38
47
  const sections: Array<{ title: string }> = Array.isArray(contributes.configuration) ? contributes.configuration : [contributes.configuration]
39
48
 
@@ -43,7 +52,7 @@ export function withStxContributes(manifest: any, stx: StxContributes): any {
43
52
  ...contributes,
44
53
  languages: stx.languages.map(language => ({ ...language, configuration: fromStx(language.configuration) })),
45
54
  grammars: stx.grammars.map(grammar => ({ ...grammar, path: fromStx(grammar.path) })),
46
- commands: [...contributes.commands.filter((command: { command: string }) => !stxCommands.has(command.command)), ...stx.commands],
55
+ commands: [...contributes.commands.filter((command: { command: string }) => command.command.startsWith(OWN_COMMAND_PREFIX)), ...stx.commands],
47
56
  configuration: [...sections.filter(section => section.title !== stx.configuration.title), stx.configuration],
48
57
  },
49
58
  }
@@ -10,7 +10,7 @@
10
10
  import { describe, expect, it } from 'bun:test'
11
11
  import { readFileSync } from 'node:fs'
12
12
  import { join } from 'node:path'
13
- import { libraryContributes, withStxContributes } from '../scripts/stx-contributes'
13
+ import { libraryContributes, OWN_COMMAND_PREFIX, withStxContributes } from '../scripts/stx-contributes'
14
14
 
15
15
  const root = join(import.meta.dir, '..')
16
16
  const manifest = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'))
@@ -61,6 +61,19 @@ describe('stx language support', () => {
61
61
  expect(withStxContributes(manifest, libraryContributes(root))).toEqual(manifest)
62
62
  })
63
63
 
64
+ it('declares no stx command the library no longer ships', () => {
65
+ const shipped = new Set(libraryContributes(root).commands.map(command => command.command))
66
+ const stale = manifest.contributes.commands
67
+ .map((command: { command: string }) => command.command)
68
+ .filter((id: string) => !id.startsWith(OWN_COMMAND_PREFIX) && !shipped.has(id))
69
+ expect(stale).toEqual([])
70
+ })
71
+
72
+ it('drops a command stx renamed when syncing', () => {
73
+ const stale = { ...manifest, contributes: { ...manifest.contributes, commands: [...manifest.contributes.commands, { command: 'css.reload', title: 'Css: Reload Configuration' }] } }
74
+ expect(withStxContributes(stale, libraryContributes(root))).toEqual(manifest)
75
+ })
76
+
64
77
  it('declares the stx language and its grammar from the bundled assets', () => {
65
78
  expect(manifest.contributes.languages.map((language: { id: string }) => language.id)).toContain('stx')
66
79
  expect(manifest.contributes.grammars[0].path).toStartWith('./dist/stx/')
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.44",
5
+ "version": "0.75.45",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -55,7 +55,7 @@
55
55
  "dependencies": {
56
56
  "@iconify-json/f7": "^1.2.2",
57
57
  "@iconify-json/hugeicons": "^1.2.35",
58
- "@stacksjs/mobile": "^0.75.44",
58
+ "@stacksjs/mobile": "^0.75.45",
59
59
  "@stacksjs/sanitizer": "^0.2.348",
60
60
  "ts-qr-codes": "^0.1.8"
61
61
  }