@gesslar/sassy 0.22.0 → 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,10 +1,29 @@
1
1
  {
2
2
  "name": "@gesslar/sassy",
3
- "version": "0.22.0",
4
- "displayName": "Sassy",
5
3
  "description": "Make gorgeous themes that speak as boldly as you do.",
6
- "publisher": "gesslar",
4
+ "author": {
5
+ "name": "gesslar",
6
+ "url": "https://gesslar.dev"
7
+ },
8
+ "version": "0.23.0",
7
9
  "license": "Unlicense",
10
+ "homepage": "https://github.com/gesslar/sassy#readme",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/gesslar/sassy.git"
14
+ },
15
+ "keywords": [
16
+ "asmr",
17
+ "generator",
18
+ "huffing",
19
+ "json5",
20
+ "sniffsniffsniff",
21
+ "taylorswift",
22
+ "theme",
23
+ "vs code",
24
+ "vscode",
25
+ "yaml"
26
+ ],
8
27
  "type": "module",
9
28
  "main": "src/index.js",
10
29
  "types": "types/index.d.ts",
@@ -20,56 +39,37 @@
20
39
  "types/",
21
40
  "UNLICENSE.txt"
22
41
  ],
23
- "scripts": {
24
- "clean": "rm -rfv ./dist",
25
- "clean-types": "rm -rfv ./types",
26
- "types": "npx tsc src/*.js types-helper.d.ts --allowJs --declaration --emitDeclarationOnly --outDir types --target ES2022 --module ESNext --moduleResolution Node --esModuleInterop --skipLibCheck --resolveJsonModule && node fix-types.js",
27
- "build": "npm run clean && npm run types && mkdir -pv ./dist && npm pack --pack-destination ./dist/",
28
- "exec": "node ./src/cli.js",
29
- "lint": "eslint src/",
30
- "submit": "npm run build && npm publish --access public",
31
- "examples": "node ./examples/validator.js",
32
- "test": "node -p \"require('fs').readFileSync('TESTING.txt', 'utf8')\"",
33
- "update": "npx npm-check-updates -u && npm install"
34
- },
35
42
  "engines": {
36
- "node": ">=20.0.0"
43
+ "node": ">=22"
37
44
  },
38
- "repository": {
39
- "type": "git",
40
- "url": "https://github.com/gesslar/sassy"
41
- },
42
- "keywords": [
43
- "asmr",
44
- "generator",
45
- "huffing",
46
- "json5",
47
- "sniffsniffsniff",
48
- "taylorswift",
49
- "theme",
50
- "vs code",
51
- "vscode",
52
- "yaml"
53
- ],
54
45
  "dependencies": {
55
- "@gesslar/colours": "^0.0.1",
56
- "@gesslar/toolkit": "^0.0.3",
57
- "chokidar": "^4.0.3",
46
+ "@gesslar/colours": "^0.7.1",
47
+ "@gesslar/toolkit": "^3.6.3",
48
+ "chokidar": "^5.0.0",
58
49
  "color-support": "^1.1.3",
59
- "commander": "^14.0.1",
50
+ "commander": "^14.0.2",
60
51
  "culori": "^4.0.2",
61
- "globby": "^14.1.0",
52
+ "globby": "^16.1.0",
62
53
  "json5": "^2.2.3",
63
- "yaml": "^2.8.1"
54
+ "yaml": "^2.8.2"
64
55
  },
65
56
  "devDependencies": {
66
- "@stylistic/eslint-plugin": "^5.4.0",
67
- "@types/vscode": "^1.104.0",
68
- "@typescript-eslint/eslint-plugin": "^8.44.0",
69
- "@typescript-eslint/parser": "^8.44.0",
70
- "esbuild": "^0.25.10",
71
- "eslint": "^9.36.0",
72
- "eslint-plugin-jsdoc": "^60.1.0",
73
- "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"
74
74
  }
75
- }
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.
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
  }
@@ -1,40 +0,0 @@
1
- /**
2
- * Command handler for building VS Code themes from source files.
3
- * Handles compilation, watching for changes, and output generation.
4
- */
5
- export default class BuildCommand extends Command {
6
- /**
7
- * Creates a new BuildCommand instance.
8
- *
9
- * @param {object} base - Base configuration object
10
- * @param {string} base.cwd - Current working directory path
11
- * @param {object} base.packageJson - Package.json configuration data
12
- */
13
- constructor(base: {
14
- cwd: string;
15
- packageJson: object;
16
- });
17
- /** @type {EventEmitter} Internal event emitter for watch mode coordination */
18
- emitter: EventEmitter;
19
- /**
20
- * Executes the build command for the provided theme files.
21
- * Processes each file in parallel, optionally watching for changes.
22
- *
23
- * @param {string[]} fileNames - Array of theme file paths to process
24
- * @param {object} options - Build options
25
- * @param {boolean} [options.watch] - Enable watch mode for file changes
26
- * @param {string} [options.output-dir] - Custom output directory path
27
- * @param {boolean} [options.dry-run] - Print JSON to stdout without writing files
28
- * @param {boolean} [options.silent] - Silent mode, only show errors or dry-run output
29
- * @returns {Promise<void>} Resolves when all files are processed
30
- * @throws {Error} When theme compilation fails
31
- */
32
- execute(fileNames: string[], options: {
33
- watch?: boolean;
34
- output?: string;
35
- dry?: boolean;
36
- silent?: boolean;
37
- }): Promise<void>;
38
- #private;
39
- }
40
- import Command from "./Command.js";
package/types/Colour.d.ts DELETED
@@ -1,126 +0,0 @@
1
- /**
2
- * Colour manipulation utility class providing static methods for colour operations.
3
- * Handles hex colour parsing, alpha manipulation, mixing, and format conversions.
4
- */
5
- export default class Colour {
6
- /**
7
- * Regular expression for matching long hex colour codes with optional alpha.
8
- * Matches patterns like #ff0000 or #ff0000ff
9
- *
10
- * @type {RegExp}
11
- */
12
- static longHex: RegExp;
13
- /**
14
- * Regular expression for matching short hex colour codes with optional alpha.
15
- * Matches patterns like #f00 or #f00f
16
- *
17
- * @type {RegExp}
18
- */
19
- static shortHex: RegExp;
20
- /**
21
- * Lightens or darkens a hex colour by a specified amount.
22
- * Always uses OKLCH as the working color space for consistent perceptual results.
23
- *
24
- * @param {string} hex - The hex colour code (e.g., "#ff0000" or "#f00")
25
- * @param {number} amount - The amount to lighten (+) or darken (-) as a percentage
26
- * @returns {string} The modified hex colour with preserved alpha
27
- */
28
- static lightenOrDarken(hex: string, amount?: number): string;
29
- /**
30
- * Lightens or darkens a color using OKLCH as working space for consistent results.
31
- * Preserves original color information from tokens when available.
32
- *
33
- * @param {ThemeToken|object|string} tokenOrColor - ThemeToken, Culori color object, or hex string
34
- * @param {number} amount - The amount to lighten (+) or darken (-) as a percentage
35
- * @returns {string} The modified hex colour
36
- */
37
- static lightenOrDarkenWithToken(tokenOrColor: ThemeToken | object | string, amount?: number): string;
38
- /**
39
- * Inverts a hex colour by flipping its lightness value.
40
- * Preserves hue and saturation while inverting the lightness component.
41
- *
42
- * @param {string} hex - The hex colour code to invert
43
- * @returns {string} The inverted hex colour with preserved alpha
44
- */
45
- static invert(hex: string): string;
46
- /**
47
- * Converts a hex alpha value to a decimal percentage.
48
- * Takes a 2-digit hex alpha value and converts it to a percentage (0-100).
49
- *
50
- * @param {string} hex - The hex alpha value (e.g., "ff", "80")
51
- * @returns {number} The alpha as a percentage rounded to 2 decimal places
52
- */
53
- static hexAlphaToDecimal(hex: string): number;
54
- /**
55
- * Converts a decimal percentage to a hex alpha value.
56
- * Takes a percentage (0-100) and converts it to a 2-digit hex alpha value.
57
- *
58
- * @param {number} dec - The alpha percentage (0-100)
59
- * @returns {string} The hex alpha value (e.g., "ff", "80")
60
- */
61
- static decimalAlphaToHex(dec: number): string;
62
- static isHex(value: any): boolean;
63
- /**
64
- * Normalises a short hex colour code to a full 6-character format.
65
- * Converts 3-character hex codes like "#f00" to "#ff0000".
66
- *
67
- * @param {string} code - The short hex colour code
68
- * @returns {string} The normalized 6-character hex colour code
69
- */
70
- static normaliseHex(code: string): string;
71
- /**
72
- * Parses a hex colour string and extracts colour and alpha components.
73
- * Supports both short (#f00) and long (#ff0000) formats with optional alpha.
74
- *
75
- * @param {string} hex - The hex colour string to parse
76
- * @returns {object} Object containing colour and optional alpha information
77
- * @throws {Sass} If the hex value is invalid or missing
78
- */
79
- static parseHexColour(hex: string): object;
80
- /**
81
- * Sets the alpha transparency of a hex colour to a specific value.
82
- * Replaces any existing alpha with the new value.
83
- *
84
- * @param {string} hex - The hex colour code
85
- * @param {number} amount - The alpha value (0-1, where 0 is transparent and 1 is opaque)
86
- * @returns {string} The hex colour with the new alpha value
87
- */
88
- static setAlpha(hex: string, amount: number): string;
89
- /**
90
- * Adjusts the alpha transparency of a hex colour by a relative amount.
91
- * Multiplies the current alpha by (1 + amount) and clamps the result.
92
- *
93
- * @param {string} hex - The hex colour code
94
- * @param {number} amount - The relative amount to adjust alpha (-1 to make transparent, positive to increase)
95
- * @returns {string} The hex colour with adjusted alpha
96
- */
97
- static addAlpha(hex: string, amount: number): string;
98
- /**
99
- * Removes alpha channel from a hex colour, returning only the solid colour.
100
- *
101
- * @param {string} hex - The hex colour code with or without alpha
102
- * @returns {string} The solid hex colour without alpha
103
- */
104
- static solid(hex: string): string;
105
- /**
106
- * Mixes two hex colours together in a specified ratio.
107
- * Blends both the colours and their alpha channels if present.
108
- *
109
- * @param {string} colourA - The first hex colour
110
- * @param {string} colourB - The second hex colour
111
- * @param {number} ratio - The mixing ratio as percentage (0-100, where 50 is equal mix)
112
- * @returns {string} The mixed hex colour with blended alpha
113
- */
114
- static mix(colourA: string, colourB: string, ratio?: number): string;
115
- static getColourParser(name: any): Promise<any>;
116
- /**
117
- * Converts colour values from various formats to hex.
118
- * Supports RGB, RGBA, HSL, HSLA, OKLCH, and OKLCHA colour modes, and MORE!
119
- *
120
- * @param {string} input - The colour expression
121
- * @returns {string} The resulting hex colour
122
- * @throws {Sass} If the wrong function or value is provided
123
- */
124
- static toHex(input: string): string;
125
- }
126
- import ThemeToken from "./ThemeToken.js";
@@ -1,135 +0,0 @@
1
- import type { FileObject, DirectoryObject, Cache } from '@gesslar/toolkit';
2
- /**
3
- * Base class for command-line interface commands.
4
- * Provides common functionality for CLI option handling and file resolution.
5
- */
6
- export default class Command {
7
- /**
8
- * Creates a new Command instance.
9
- *
10
- * @param {object} config - Configuration object
11
- * @param {DirectoryObject} config.cwd - Current working directory object
12
- * @param {object} config.packageJson - Package.json data
13
- */
14
- constructor({ cwd, packageJson }: {
15
- cwd: DirectoryObject;
16
- packageJson: object;
17
- });
18
- /**
19
- * Gets the current working directory object.
20
- *
21
- * @returns {DirectoryObject} The current working directory
22
- */
23
- getCwd(): DirectoryObject;
24
- /**
25
- * Gets the package.json data.
26
- *
27
- * @returns {object} The package.json object
28
- */
29
- getPackageJson(): object;
30
- /**
31
- * Sets the cache instance for the command.
32
- *
33
- * @param {Cache} cache - The cache instance to set
34
- * @returns {this} Returns this instance for method chaining
35
- */
36
- setCache(cache: Cache): this;
37
- /**
38
- * Gets the cache instance.
39
- *
40
- * @returns {Cache|null} The cache instance or null if not set
41
- */
42
- getCache(): Cache | null;
43
- /**
44
- * Sets the CLI command string.
45
- *
46
- * @param {string} data - The CLI command string
47
- * @returns {this} Returns this instance for method chaining
48
- */
49
- setCliCommand(data: string): this;
50
- /**
51
- * Gets the CLI command string.
52
- *
53
- * @returns {string|null} The CLI command string
54
- */
55
- getCliCommand(): string | null;
56
- /**
57
- * Sets the CLI options object.
58
- *
59
- * @param {object} data - The CLI options configuration
60
- * @returns {this} Returns this instance for method chaining
61
- */
62
- setCliOptions(data: object): this;
63
- /**
64
- * Gets the CLI options object.
65
- *
66
- * @returns {object|null} The CLI options configuration
67
- */
68
- getCliOptions(): object | null;
69
- /**
70
- * Gets the array of CLI option names.
71
- *
72
- * @returns {string[]} Array of option names
73
- */
74
- getCliOptionNames(): string[];
75
- /**
76
- * Checks if the command has a cache instance.
77
- *
78
- * @returns {boolean} True if cache is available
79
- */
80
- hasCache(): boolean;
81
- /**
82
- * Checks if the command has a CLI command string configured.
83
- *
84
- * @returns {boolean} True if CLI command is set
85
- */
86
- hasCliCommand(): boolean;
87
- /**
88
- * Checks if the command has CLI options configured.
89
- *
90
- * @returns {boolean} True if CLI options are set
91
- */
92
- hasCliOptions(): boolean;
93
- /**
94
- * Checks if the command is ready to be built.
95
- * Requires both CLI command and options to be set.
96
- *
97
- * @returns {boolean} True if command can be built
98
- */
99
- canBuild(): boolean;
100
- /**
101
- * Builds the CLI command interface using the commander.js program instance.
102
- * Initializes the command with its options and action handler.
103
- *
104
- * @param {object} program - The commander.js program instance
105
- * @returns {Promise<this>} Returns this instance for method chaining
106
- */
107
- buildCli(program: object): Promise<this>;
108
- /**
109
- * Adds a single CLI option to the command.
110
- *
111
- * @param {string} name - The option name
112
- * @param {string[]} options - Array containing option flag and description
113
- * @param {boolean} preserve - Whether to preserve this option name in the list
114
- * @returns {Promise<this>} Returns this instance for method chaining
115
- */
116
- addCliOption(name: string, options: string[], preserve: boolean): Promise<this>;
117
- /**
118
- * Adds multiple CLI options to the command.
119
- *
120
- * @param {object} options - Object mapping option names to [flag, description] arrays
121
- * @param {boolean} preserve - Whether to preserve option names in the list
122
- * @returns {this} Returns this instance for method chaining
123
- */
124
- addCliOptions(options: object, preserve: boolean): this;
125
- /**
126
- * Resolves a theme file name to a FileObject and validates its existence.
127
- *
128
- * @param {string} fileName - The theme file name or path
129
- * @param {object} cwd - The current working directory object
130
- * @returns {Promise<FileObject>} The resolved and validated FileObject
131
- * @throws {Sass} If the file does not exist
132
- */
133
- resolveThemeFileName(fileName: string, cwd: object): Promise<FileObject>;
134
- #private;
135
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * Main compiler class for processing theme source files.
3
- * Handles the complete compilation pipeline from source to VS Code theme output.
4
- */
5
- export default class Compiler {
6
- /**
7
- * Compiles a theme source file into a VS Code colour theme.
8
- * Processes configuration, variables, imports, and theme definitions.
9
- *
10
- * @param {Theme} theme - The file object containing source data and metadata
11
- * @returns {Promise<void>} Resolves when compilation is complete
12
- */
13
- compile(theme: Theme): Promise<void>;
14
- #private;
15
- }
16
- import Theme from "./Theme.js";