@gesslar/sassy 0.21.3 → 0.23.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 CHANGED
@@ -452,7 +452,7 @@ Sassy supports importing different types of theme components:
452
452
  config:
453
453
  import:
454
454
  - "./shared/colours.yaml" # Variables and base config
455
- - "./shared/ui-colours.yaml" # VS Code color definitions
455
+ - "./shared/ui-colours.yaml" # VS Code color definitions
456
456
  - "./shared/syntax.yaml" # Syntax highlighting rules
457
457
  - "./shared/semantic.yaml" # Semantic token colours
458
458
  ```
package/package.json CHANGED
@@ -1,37 +1,16 @@
1
1
  {
2
2
  "name": "@gesslar/sassy",
3
- "version": "0.21.3",
4
- "displayName": "Sassy",
5
3
  "description": "Make gorgeous themes that speak as boldly as you do.",
6
- "publisher": "gesslar",
7
- "license": "Unlicense",
8
- "type": "module",
9
- "main": "src/index.js",
10
- "bin": "src/cli.js",
11
- "exports": {
12
- ".": "./src/index.js",
13
- "./cli": "./src/cli.js"
14
- },
15
- "files": [
16
- "src/",
17
- "UNLICENSE.txt"
18
- ],
19
- "scripts": {
20
- "clean": "rm -rfv ./dist",
21
- "build": "npm run clean && mkdir -pv ./dist && npm pack --pack-destination ./dist/",
22
- "exec": "node ./src/cli.js",
23
- "lint": "eslint src/",
24
- "submit": "npm publish --access public",
25
- "examples": "node ./examples/validator.js",
26
- "test": "node -p \"require('fs').readFileSync('TESTING.txt', 'utf8')\"",
27
- "update": "npx npm-check-updates -u && npm install"
28
- },
29
- "engines": {
30
- "node": ">=20.0.0"
4
+ "author": {
5
+ "name": "gesslar",
6
+ "url": "https://gesslar.dev"
31
7
  },
8
+ "version": "0.23.0",
9
+ "license": "Unlicense",
10
+ "homepage": "https://github.com/gesslar/sassy#readme",
32
11
  "repository": {
33
12
  "type": "git",
34
- "url": "https://github.com/gesslar/sassy"
13
+ "url": "git+https://github.com/gesslar/sassy.git"
35
14
  },
36
15
  "keywords": [
37
16
  "asmr",
@@ -45,25 +24,52 @@
45
24
  "vscode",
46
25
  "yaml"
47
26
  ],
27
+ "type": "module",
28
+ "main": "src/index.js",
29
+ "types": "types/index.d.ts",
30
+ "bin": "src/cli.js",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./types/index.d.ts",
34
+ "import": "./src/index.js"
35
+ }
36
+ },
37
+ "files": [
38
+ "src/",
39
+ "types/",
40
+ "UNLICENSE.txt"
41
+ ],
42
+ "engines": {
43
+ "node": ">=22"
44
+ },
48
45
  "dependencies": {
49
- "@gesslar/colours": "^0.0.1",
50
- "@gesslar/toolkit": "^0.0.3",
51
- "chokidar": "^4.0.3",
46
+ "@gesslar/colours": "^0.7.1",
47
+ "@gesslar/toolkit": "^3.6.3",
48
+ "chokidar": "^5.0.0",
52
49
  "color-support": "^1.1.3",
53
- "commander": "^14.0.1",
50
+ "commander": "^14.0.2",
54
51
  "culori": "^4.0.2",
55
- "globby": "^14.1.0",
52
+ "globby": "^16.1.0",
56
53
  "json5": "^2.2.3",
57
- "yaml": "^2.8.1"
54
+ "yaml": "^2.8.2"
58
55
  },
59
56
  "devDependencies": {
60
- "@stylistic/eslint-plugin": "^5.4.0",
61
- "@types/vscode": "^1.104.0",
62
- "@typescript-eslint/eslint-plugin": "^8.44.0",
63
- "@typescript-eslint/parser": "^8.44.0",
64
- "esbuild": "^0.25.10",
65
- "eslint": "^9.36.0",
66
- "eslint-plugin-jsdoc": "^60.1.0",
67
- "typescript": "^5.9.2"
57
+ "@gesslar/uglier": "^0.5.1",
58
+ "eslint": "^9.39.2",
59
+ "typescript": "^5.9.3"
60
+ },
61
+ "scripts": {
62
+ "clean": "rm -rfv ./dist",
63
+ "build": "mkdir -pv ./dist && pnpm pack --pack-destination ./dist/",
64
+ "exec": "node ./src/cli.js",
65
+ "lint": "eslint src/",
66
+ "submit": "pnpm publish --access public --//registry.npmjs.org/:_authToken=\"${NPM_ACCESS_TOKEN}\"",
67
+ "examples": "node ./examples/validator.js",
68
+ "test": "node -p \"require('fs').readFileSync('TESTING.txt', 'utf8')\"",
69
+ "update": "pnpm up --latest --recursive",
70
+ "pr": "gt submit -p --ai",
71
+ "patch": "pnpm version patch",
72
+ "minor": "pnpm version minor",
73
+ "major": "pnpm version major"
68
74
  }
69
- }
75
+ }
@@ -1,7 +1,7 @@
1
1
  import {EventEmitter} from "node:events"
2
2
  import process from "node:process"
3
3
 
4
- import {Sass, Term} from "@gesslar/toolkit"
4
+ import {Sass, Term, Util} from "@gesslar/toolkit"
5
5
  import Command from "./Command.js"
6
6
  import Session from "./Session.js"
7
7
  import Theme from "./Theme.js"
@@ -90,7 +90,7 @@ export default class BuildCommand extends Command {
90
90
  rejected.forEach(reject => Term.error(reject.reason))
91
91
 
92
92
  if(firstRun.length === rejected.length)
93
- await this.asyncEmit("quit")
93
+ await Util.asyncEmit(this.emitter, "quit")
94
94
  }
95
95
  }
96
96
 
package/src/Colour.js CHANGED
@@ -14,7 +14,6 @@ import {
14
14
  } from "culori"
15
15
 
16
16
  import {Util, Sass} from "@gesslar/toolkit"
17
- import ThemeToken from "./ThemeToken.js"
18
17
  // Cache for parsed colours to improve performance
19
18
  const _colourCache = new Map()
20
19
 
@@ -264,7 +263,7 @@ export default class Colour {
264
263
 
265
264
  const [_,hex] = matches
266
265
 
267
- return hex.split("").reduce((acc,curr) => acc + curr.repeat(2)).toLowerCase()
266
+ return hex.split("").reduce((acc,curr) => acc + curr.repeat(2), "").toLowerCase()
268
267
  }
269
268
 
270
269
  /**
package/src/Command.js CHANGED
@@ -1,4 +1,4 @@
1
- import {Sass, FileObject, DirectoryObject, Cache} from "@gesslar/toolkit"
1
+ import {Sass, FileObject} from "@gesslar/toolkit"
2
2
 
3
3
  /**
4
4
  * Base class for command-line interface commands.
@@ -234,37 +234,4 @@ export default class Command {
234
234
  return fileObject
235
235
  }
236
236
 
237
- /**
238
- * Emits an event asynchronously and waits for all listeners to complete.
239
- * Unlike the standard EventEmitter.emit() which is synchronous, this method
240
- * properly handles async event listeners by waiting for all of them to
241
- * resolve or reject using Promise.allSettled().
242
- *
243
- * @param {string} event - The event name to emit
244
- * @param {...unknown} [arg] - Arguments to pass to event listeners
245
- * @returns {Promise<void>} Resolves when all listeners have completed
246
- */
247
- async asyncEmit(event, arg) {
248
- try {
249
- arg = arg || new Array()
250
- const listeners = this.emitter.listeners(event)
251
-
252
- const settled =
253
- await Promise.allSettled(listeners.map(listener => listener(arg)))
254
-
255
- const rejected = settled.filter(reject => reject.status === "rejected")
256
-
257
- if(rejected.length > 0) {
258
- if(rejected[0].reason instanceof Error)
259
- throw rejected[0].reason
260
- else
261
- throw Sass.new(rejected[0].reason)
262
- }
263
- } catch(error) {
264
- throw Sass.new(
265
- `Processing '${event}' event with ${arg&&arg.length?`'${arg}'`:"no arguments"}.`,
266
- error
267
- )
268
- }
269
- }
270
237
  }
package/src/Compiler.js CHANGED
@@ -11,9 +11,8 @@
11
11
  * Supports extension points for custom phases and output formats.
12
12
  */
13
13
 
14
- import {Sass, Data, File, FileObject, Term, Util} from "@gesslar/toolkit"
14
+ import {Data, FS, FileObject, Sass, Term, Util} from "@gesslar/toolkit"
15
15
  import Evaluator from "./Evaluator.js"
16
- import Theme from "./Theme.js"
17
16
 
18
17
  /**
19
18
  * Main compiler class for processing theme source files.
@@ -169,7 +168,7 @@ export default class Compiler {
169
168
  Term.status([
170
169
  ["muted", Util.rightAlignText(`${cost.toLocaleString()}ms`, 10), ["[","]"]],
171
170
  "",
172
- ["muted", `${File.relativeOrAbsolutePath(theme.getCwd(),file)}`],
171
+ ["muted", `${FS.relativeOrAbsolutePath(theme.getCwd(),file)}`],
173
172
  ["muted", `${theme.getName()}`,["(",")"]],
174
173
  ], theme.getOptions())
175
174
  }
@@ -22,7 +22,6 @@ import Command from "./Command.js"
22
22
  import Evaluator from "./Evaluator.js"
23
23
  import Theme from "./Theme.js"
24
24
  import {Term} from "@gesslar/toolkit"
25
- import ThemePool from "./ThemePool.js"
26
25
 
27
26
  // oops, need to have @gesslar/colours support this, too!
28
27
  // ansiColors.enabled = colorSupport.hasBasic
package/src/Session.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import chokidar from "chokidar"
2
2
 
3
- import Command from "./Command.js"
4
- import {Sass, File, Term, Util} from "@gesslar/toolkit"
5
- import Theme from "./Theme.js"
3
+ import {Sass, FS, Term, Util} from "@gesslar/toolkit"
6
4
 
7
5
  /**
8
6
  * @typedef {object} SessionOptions
@@ -219,7 +217,7 @@ export default class Session {
219
217
  */
220
218
 
221
219
  loadCost = (await Util.time(() => this.#theme.load())).cost
222
- const bytes = await File.fileSize(this.#theme.getSourceFile())
220
+ const bytes = await FS.fileSize(this.#theme.getSourceFile())
223
221
 
224
222
  Term.status([
225
223
  ["success", Util.rightAlignText(`${loadCost.toLocaleString()}ms`, 10), ["[","]"]],
@@ -244,10 +242,10 @@ export default class Session {
244
242
  throw new Error("Invalid dependency file object")
245
243
  }
246
244
 
247
- const fileName = File.relativeOrAbsolutePath(
245
+ const fileName = FS.relativeOrAbsolutePath(
248
246
  this.#command.getCwd(), fileObject
249
247
  )
250
- const fileSize = await File.fileSize(fileObject)
248
+ const fileSize = await FS.fileSize(fileObject)
251
249
 
252
250
  return [fileName, fileSize]
253
251
  }))
@@ -307,7 +305,7 @@ export default class Session {
307
305
  file: outputFile,
308
306
  bytes: writeBytes
309
307
  } = writeResult.result
310
- const outputFilename = File.relativeOrAbsolutePath(
308
+ const outputFilename = FS.relativeOrAbsolutePath(
311
309
  this.#command.getCwd(), outputFile
312
310
  )
313
311
  const status = [
@@ -383,7 +381,7 @@ export default class Session {
383
381
  if(!changedFile)
384
382
  return
385
383
 
386
- const fileName = File.relativeOrAbsolutePath(
384
+ const fileName = FS.relativeOrAbsolutePath(
387
385
  this.#command.getCwd(), changedFile
388
386
  )
389
387
 
package/src/Theme.js CHANGED
@@ -13,7 +13,7 @@
13
13
  * - Write output files, supporting dry-run and hash-based skip
14
14
  * - Support watch mode for live theme development
15
15
  */
16
- import {Sass, DirectoryObject, File, FileObject, Term, Util, Cache} from "@gesslar/toolkit"
16
+ import {Sass, DirectoryObject, FS, FileObject, Term, Util} from "@gesslar/toolkit"
17
17
  import Compiler from "./Compiler.js"
18
18
  import ThemePool from "./ThemePool.js"
19
19
 
@@ -525,7 +525,7 @@ export default class Theme {
525
525
  if(!force) {
526
526
  const nextHash = this.#outputHash
527
527
  const lastHash = await file.exists
528
- ? Util.hashOf(await File.readFile(file))
528
+ ? Util.hashOf(await FS.readFile(file))
529
529
  : obviouslyASentinelYouCantMissSoShutUpAboutIt
530
530
 
531
531
  if(lastHash === nextHash)
@@ -534,9 +534,9 @@ export default class Theme {
534
534
 
535
535
  // Real write (timed)
536
536
  if(!await outputDir.exists)
537
- await File.assureDirectory(outputDir, {recursive: true})
537
+ await FS.assureDirectory(outputDir, {recursive: true})
538
538
 
539
- await File.writeFile(file, output)
539
+ await FS.writeFile(file, output)
540
540
 
541
541
  return {status: WriteStatus.WRITTEN, bytes: output.length, file}
542
542
  }