@gesslar/sassy 0.23.0 → 1.0.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 +4 -13
- package/package.json +7 -6
- package/src/Compiler.js +3 -3
- package/src/ResolveCommand.js +2 -2
- package/src/Session.js +6 -12
- package/src/Theme.js +4 -4
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ npx @gesslar/sassy lint my-theme.yaml
|
|
|
98
98
|
### Build Command Options
|
|
99
99
|
|
|
100
100
|
| Option | Description |
|
|
101
|
-
|
|
101
|
+
| -------- | ------------- |
|
|
102
102
|
| `-w, --watch` | Watch files and rebuild on changes |
|
|
103
103
|
| `-o, --output-dir <dir>` | Specify output directory |
|
|
104
104
|
| `-n, --dry-run` | Print JSON to stdout instead of writing files |
|
|
@@ -132,7 +132,7 @@ output.
|
|
|
132
132
|
### Resolve Command Options
|
|
133
133
|
|
|
134
134
|
| Option | Description |
|
|
135
|
-
|
|
135
|
+
| -------- | ------------- |
|
|
136
136
|
| `-c, --color <key>` | Resolve a specific color property to its final value |
|
|
137
137
|
| `-t, --tokenColor <scope>` | Resolve tokenColors for a specific scope |
|
|
138
138
|
| `-s, --semanticTokenColor <token>` | Resolve semantic token colors for a specific token type |
|
|
@@ -222,7 +222,7 @@ to least specific.
|
|
|
222
222
|
### Lint Command Options
|
|
223
223
|
|
|
224
224
|
| Option | Description |
|
|
225
|
-
|
|
225
|
+
| -------- | ------------- |
|
|
226
226
|
| `--nerd` | Show detailed error traces if linting fails |
|
|
227
227
|
|
|
228
228
|
## Basic Theme Structure
|
|
@@ -297,33 +297,24 @@ functions in the [Culori documentation](https://culorijs.org/).
|
|
|
297
297
|
Make colours that work together:
|
|
298
298
|
|
|
299
299
|
| Function | Example | Result |
|
|
300
|
-
|
|
300
|
+
| ---------- | --------- | -------- |
|
|
301
301
|
| `lighten(colour, %=0-100)` | `lighten($(bg), 25)` | 25% lighter background |
|
|
302
302
|
| `darken(colour, %=0-100)` | `darken($(accent), 30)` | 30% darker accent |
|
|
303
|
-
| || |
|
|
304
303
|
| `alpha(colour, alpha=0-1)` | `alpha($(brand), 0.5)` | Set exact transparency |
|
|
305
304
|
| `fade(colour, alpha=0-1)` | `fade($(accent), 0.5)` | Reduce opacity by 50% |
|
|
306
305
|
| `solidify(colour, alpha=0-1)` | `solidify($(bg.accent), 0.3)` | Increase opacity by 30% |
|
|
307
|
-
| || |
|
|
308
306
|
| `mix(colour1, colour2, %=0-100)` | `mix($(fg), $(accent), 20)` | Blend 20% accent |
|
|
309
307
|
| `mix(colour1, colour2)` | `mix($(fg), $(accent))` | Blend 50% accent |
|
|
310
|
-
| || |
|
|
311
308
|
| `invert(colour)` | `invert($(fg))` | Perfect opposite |
|
|
312
|
-
| || |
|
|
313
309
|
| `hsv(h=0-255, s=0-255, v=0-255)` | `hsv(50, 200, 180)` | HSV colour (hue 50, saturation 200, value 180) |
|
|
314
310
|
| `hsva(h=0-255, s=0-255, v=0-255, a=0-1)` | `hsva(50, 200, 180, 0.5)` | HSV with 50% opacity |
|
|
315
|
-
| || |
|
|
316
311
|
| `hsl(h=0-360, s=0-100, l=0-100)` | `hsl(200, 50, 40)` | HSL colour (200° hue, 50% saturation, 40% lightness) |
|
|
317
312
|
| `hsla(h=0-360, s=0-100, l=0-100, a=0-1)` | `hsla(200, 50, 40, 0.5)` | HSL with 50% opacity |
|
|
318
|
-
| || |
|
|
319
313
|
| `rgb(r=0-255, g=0-255, b=0-255)` | `rgb(139, 152, 255)` | RGB colour (139 red, 152 green, 255 blue) |
|
|
320
314
|
| `rgba(r=0-255, g=0-255, b=0-255, a=0-1)` | `rgba(139, 152, 255, 0.5)` | RGB with 50% opacity |
|
|
321
|
-
| || |
|
|
322
315
|
| `oklch(l=0-1, c=0-100, h=0-360)` | `oklch(0.7, 25, 180)` | OKLCH colour (70% lightness, 25 chroma, 180° hue) |
|
|
323
316
|
| `oklcha(l=0-1, c=0-100, h=0-360, a=0-1)` | `oklcha(0.5, 30, 45, 0.8)` | OKLCH with 80% opacity |
|
|
324
|
-
| || |
|
|
325
317
|
| `css(name)` | `css(tomato)` | CSS named colour (tomato, skyblue, etc.) |
|
|
326
|
-
| || |
|
|
327
318
|
|
|
328
319
|
> **Note:** In all of these functions, `colour` can be a raw hex (`#ff66cc`),
|
|
329
320
|
a variable (`$(accent)`), a CSS named colour (`css(tomato)`), or another colour
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "gesslar",
|
|
6
6
|
"url": "https://gesslar.dev"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.
|
|
8
|
+
"version": "1.0.0",
|
|
9
9
|
"license": "Unlicense",
|
|
10
10
|
"homepage": "https://github.com/gesslar/sassy#readme",
|
|
11
11
|
"repository": {
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"node": ">=22"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@gesslar/colours": "^0.
|
|
47
|
-
"@gesslar/toolkit": "^3.
|
|
46
|
+
"@gesslar/colours": "^0.8.0",
|
|
47
|
+
"@gesslar/toolkit": "^3.21.0",
|
|
48
48
|
"chokidar": "^5.0.0",
|
|
49
49
|
"color-support": "^1.1.3",
|
|
50
50
|
"commander": "^14.0.2",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"yaml": "^2.8.2"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@gesslar/uglier": "^0.
|
|
57
|
+
"@gesslar/uglier": "^1.0.0",
|
|
58
58
|
"eslint": "^9.39.2",
|
|
59
59
|
"typescript": "^5.9.3"
|
|
60
60
|
},
|
|
@@ -63,10 +63,11 @@
|
|
|
63
63
|
"build": "mkdir -pv ./dist && pnpm pack --pack-destination ./dist/",
|
|
64
64
|
"exec": "node ./src/cli.js",
|
|
65
65
|
"lint": "eslint src/",
|
|
66
|
+
"test": "node --test tests/**/*.test.js",
|
|
67
|
+
"test:coverage": "node --experimental-test-coverage --test tests/**/*.test.js",
|
|
66
68
|
"submit": "pnpm publish --access public --//registry.npmjs.org/:_authToken=\"${NPM_ACCESS_TOKEN}\"",
|
|
67
69
|
"examples": "node ./examples/validator.js",
|
|
68
|
-
"
|
|
69
|
-
"update": "pnpm up --latest --recursive",
|
|
70
|
+
"update": "pnpm self-update && pnpx npm-check-updates -u && pnpm install",
|
|
70
71
|
"pr": "gt submit -p --ai",
|
|
71
72
|
"patch": "pnpm version patch",
|
|
72
73
|
"minor": "pnpm version minor",
|
package/src/Compiler.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* Supports extension points for custom phases and output formats.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import {Collection, Data, FileObject, Sass, Term, Util} from "@gesslar/toolkit"
|
|
15
15
|
import Evaluator from "./Evaluator.js"
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -148,7 +148,7 @@ export default class Compiler {
|
|
|
148
148
|
? [imports]
|
|
149
149
|
: imports
|
|
150
150
|
|
|
151
|
-
if(!
|
|
151
|
+
if(!Collection.isArrayUniform(imports, "string"))
|
|
152
152
|
throw new Sass(
|
|
153
153
|
`All import entries must be strings. Got ${JSON.stringify(imports)}`
|
|
154
154
|
)
|
|
@@ -168,7 +168,7 @@ export default class Compiler {
|
|
|
168
168
|
Term.status([
|
|
169
169
|
["muted", Util.rightAlignText(`${cost.toLocaleString()}ms`, 10), ["[","]"]],
|
|
170
170
|
"",
|
|
171
|
-
["muted", `${
|
|
171
|
+
["muted", `${file.toString()}`],
|
|
172
172
|
["muted", `${theme.getName()}`,["(",")"]],
|
|
173
173
|
], theme.getOptions())
|
|
174
174
|
}
|
package/src/ResolveCommand.js
CHANGED
|
@@ -2,7 +2,7 @@ import c from "@gesslar/colours"
|
|
|
2
2
|
// import colorSupport from "color-support"
|
|
3
3
|
|
|
4
4
|
import Command from "./Command.js"
|
|
5
|
-
import {Sass, Term, Util
|
|
5
|
+
import {Collection, Sass, Term, Util} from "@gesslar/toolkit"
|
|
6
6
|
import Colour from "./Colour.js"
|
|
7
7
|
import Evaluator from "./Evaluator.js"
|
|
8
8
|
import Theme from "./Theme.js"
|
|
@@ -41,7 +41,7 @@ export default class ResolveCommand extends Command {
|
|
|
41
41
|
async execute(inputArg, options={}) {
|
|
42
42
|
const cliOptionNames = this.getCliOptionNames()
|
|
43
43
|
const intersection =
|
|
44
|
-
|
|
44
|
+
Collection.intersection(cliOptionNames, Object.keys(options))
|
|
45
45
|
|
|
46
46
|
if(intersection.length > 1)
|
|
47
47
|
throw Sass.new(
|
package/src/Session.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chokidar from "chokidar"
|
|
2
2
|
|
|
3
|
-
import {Sass,
|
|
3
|
+
import {Sass, Term, Util} from "@gesslar/toolkit"
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {object} SessionOptions
|
|
@@ -217,7 +217,7 @@ export default class Session {
|
|
|
217
217
|
*/
|
|
218
218
|
|
|
219
219
|
loadCost = (await Util.time(() => this.#theme.load())).cost
|
|
220
|
-
const bytes = await
|
|
220
|
+
const bytes = await this.#theme.getSourceFile().size()
|
|
221
221
|
|
|
222
222
|
Term.status([
|
|
223
223
|
["success", Util.rightAlignText(`${loadCost.toLocaleString()}ms`, 10), ["[","]"]],
|
|
@@ -242,10 +242,8 @@ export default class Session {
|
|
|
242
242
|
throw new Error("Invalid dependency file object")
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
const fileName =
|
|
246
|
-
|
|
247
|
-
)
|
|
248
|
-
const fileSize = await FS.fileSize(fileObject)
|
|
245
|
+
const fileName = fileObject.toString()
|
|
246
|
+
const fileSize = await fileObject.size()
|
|
249
247
|
|
|
250
248
|
return [fileName, fileSize]
|
|
251
249
|
}))
|
|
@@ -305,9 +303,7 @@ export default class Session {
|
|
|
305
303
|
file: outputFile,
|
|
306
304
|
bytes: writeBytes
|
|
307
305
|
} = writeResult.result
|
|
308
|
-
const outputFilename =
|
|
309
|
-
this.#command.getCwd(), outputFile
|
|
310
|
-
)
|
|
306
|
+
const outputFilename = outputFile.toString()
|
|
311
307
|
const status = [
|
|
312
308
|
[
|
|
313
309
|
"success",
|
|
@@ -381,9 +377,7 @@ export default class Session {
|
|
|
381
377
|
if(!changedFile)
|
|
382
378
|
return
|
|
383
379
|
|
|
384
|
-
const fileName =
|
|
385
|
-
this.#command.getCwd(), changedFile
|
|
386
|
-
)
|
|
380
|
+
const fileName = changedFile.toString()
|
|
387
381
|
|
|
388
382
|
const message = [
|
|
389
383
|
["info", "REBUILDING", ["[","]"]],
|
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,
|
|
16
|
+
import {Sass, DirectoryObject, 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
|
|
528
|
+
? Util.hashOf(await file.read())
|
|
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
|
|
537
|
+
await outputDir.assureExists()
|
|
538
538
|
|
|
539
|
-
await
|
|
539
|
+
await file.write(output)
|
|
540
540
|
|
|
541
541
|
return {status: WriteStatus.WRITTEN, bytes: output.length, file}
|
|
542
542
|
}
|