@terrazzo/plugin-sass 0.7.4 → 0.8.1

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/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@terrazzo/plugin-sass",
3
- "description": "Generate scss/sass from your design tokens schema (requires @terrazzo/cli)",
4
- "version": "0.7.4",
3
+ "version": "0.8.1",
4
+ "description": "Generate .scss from your DTCG design tokens JSON.",
5
+ "license": "MIT",
5
6
  "type": "module",
6
7
  "author": {
7
8
  "name": "Drew Powers",
@@ -15,31 +16,33 @@
15
16
  "sass"
16
17
  ],
17
18
  "main": "./dist/index.js",
19
+ "exports": {
20
+ ".": "./dist/index.js",
21
+ "./package.json": "./package.json"
22
+ },
18
23
  "homepage": "https://terrazzo.app/docs/cli/integrations/sass",
19
24
  "repository": {
20
25
  "type": "git",
21
26
  "url": "https://github.com/terrazzoapp/terrazzo.git",
22
27
  "directory": "packages/plugin-sass"
23
28
  },
24
- "license": "MIT",
25
29
  "peerDependencies": {
26
- "@terrazzo/cli": "^0.7.0",
27
- "@terrazzo/plugin-css": "^0.7.0"
30
+ "@terrazzo/cli": "^0.8.0",
31
+ "@terrazzo/plugin-css": "^0.8.0"
28
32
  },
29
33
  "dependencies": {
30
- "@terrazzo/token-tools": "^0.7.4"
34
+ "@terrazzo/token-tools": "^0.8.1"
31
35
  },
32
36
  "devDependencies": {
33
- "@terrazzo/cli": "^0.7.4",
34
- "@terrazzo/parser": "^0.7.3",
35
- "@terrazzo/plugin-css": "^0.7.4"
37
+ "@terrazzo/cli": "^0.8.1",
38
+ "@terrazzo/parser": "^0.8.1",
39
+ "@terrazzo/plugin-css": "^0.8.1"
36
40
  },
37
41
  "scripts": {
38
- "build": "pnpm run build:ts && pnpm -w run inject-license @terrazzo/plugin-sass dist/index.js",
39
- "build:ts": "tsc -p tsconfig.build.json",
40
- "dev": "tsc -p tsconfig.build.json -w",
42
+ "build": "rolldown -c && attw --profile esm-only --pack .",
43
+ "dev": "rolldown -c -w",
41
44
  "format": "biome check --fix --unsafe .",
42
- "lint": "pnpm --filter @terrazzo/plugin-sass run \"/^lint:.*/\"",
45
+ "lint": "pnpm --filter @terrazzo/plugin-sass run \"/^lint:(js|ts)/\"",
43
46
  "lint:js": "biome check .",
44
47
  "lint:ts": "tsc --noEmit",
45
48
  "test": "vitest run"
package/dist/build.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import type { BuildHookOptions } from '@terrazzo/parser';
2
- import { type SassPluginOptions } from './lib.js';
3
- export interface BuildParams {
4
- getTransforms: BuildHookOptions['getTransforms'];
5
- options?: SassPluginOptions;
6
- }
7
- export default function build({ getTransforms, options }: BuildParams): string;
8
- //# sourceMappingURL=build.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,OAAO,EAA8C,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE9F,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;IACjD,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAED,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,EAAE,WAAW,GAAG,MAAM,CAwC7E"}
package/dist/build.js DELETED
@@ -1,41 +0,0 @@
1
- import { FORMAT_ID } from '@terrazzo/plugin-css';
2
- import { isTokenMatch } from '@terrazzo/token-tools';
3
- import { makeCSSVar } from '@terrazzo/token-tools/css';
4
- import { FILE_HEADER, MIXIN_TOKEN, MIXIN_TYPOGRAPHY } from './lib.js';
5
- export default function build({ getTransforms, options }) {
6
- const tokens = getTransforms({ format: FORMAT_ID, id: '*', mode: '.' });
7
- const output = [FILE_HEADER, ''];
8
- // main values
9
- output.push('$__token-values: (');
10
- for (const token of tokens) {
11
- if (isTokenMatch(token.token.id, options?.exclude ?? [])) {
12
- continue;
13
- }
14
- // typography tokens handled later
15
- if (token.token.$type === 'typography') {
16
- output.push(` "${token.token.id}": (
17
- "__tz-error": 'This is a typography mixin. Use \`@include typography("${token.token.id}")\` instead.',
18
- ),`);
19
- }
20
- else {
21
- const name = token.localID ?? token.token.id;
22
- output.push(` "${token.token.id}": (${makeCSSVar(name, { wrapVar: true })}),`);
23
- }
24
- }
25
- output.push(');', '');
26
- // typography mixins
27
- output.push('$__token-typography-mixins: (');
28
- const typographyTokens = getTransforms({ format: 'css', id: '*', mode: '.', $type: 'typography' });
29
- for (const token of typographyTokens) {
30
- output.push(` "${token.token.id}": (`);
31
- for (const property of Object.keys(token.value)) {
32
- const name = `${token.localID ?? token.token.id}-${property}`;
33
- output.push(` "${property}": (${makeCSSVar(name, { wrapVar: true })}),`);
34
- }
35
- output.push(' ),');
36
- }
37
- output.push(');', '');
38
- output.push(MIXIN_TOKEN, '', MIXIN_TYPOGRAPHY, '');
39
- return output.join('\n');
40
- }
41
- //# sourceMappingURL=build.js.map
package/dist/build.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAA0B,MAAM,UAAU,CAAC;AAO9F,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,aAAa,EAAE,OAAO,EAAe;IACnE,MAAM,MAAM,GAAG,aAAa,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IAExE,MAAM,MAAM,GAAa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AAK,CAAC,KAAK,CAAC,EAAE,CAAC;YAChD,MAAM,IAAI,GAAG,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,QAAQ,EAAE,CAAC;YAC9D,MAAM,CAAC,IAAI,CAAC,QAAQ,QAAQ,OAAO,UAAU,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC;QAC9E,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAEtB,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;IAEnD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC"}
package/dist/lib.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import type { CSSPluginOptions } from '@terrazzo/plugin-css';
2
- export interface SassPluginOptions {
3
- /** Where to output CSS */
4
- filename?: CSSPluginOptions['filename'];
5
- /** Glob patterns to exclude tokens from output */
6
- exclude?: CSSPluginOptions['exclude'];
7
- }
8
- export declare const FILE_HEADER = "////\n/// Autogenerated by \u26CB Terrazzo. DO NOT EDIT!\n////\n\n@use \"sass:list\";\n@use \"sass:map\";";
9
- export declare const MIXIN_TOKEN = "@function token($tokenName) {\n @if map.has-key($__token-values, $tokenName) == false {\n @error 'No token named \"#{$tokenName}\"';\n }\n $_token: map.get($__token-values, $tokenName);\n @if map.has-key($_token, \"__tz-error\") {\n @error map.get($_token, \"__tz-error\");\n }\n @return map.get($_token);\n}";
10
- export declare const MIXIN_TYPOGRAPHY = "@mixin typography($tokenName, $modeName: \".\") {\n @if map.has-key($__token-typography-mixins, $tokenName) == false {\n @error 'No typography mixin named \"#{$tokenName}\"';\n }\n $_mixin: map.get($__token-typography-mixins, $tokenName);\n $_properties: map.get($_mixin, \".\");\n @if map.has-key($_mixin) {\n $_properties: map.get($_mixin);\n }\n @each $_property, $_value in $_properties {\n #{$_property}: #{$_value};\n }\n}";
11
- //# sourceMappingURL=lib.d.ts.map
package/dist/lib.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAChC,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxC,kDAAkD;IAClD,OAAO,CAAC,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;CACvC;AAED,eAAO,MAAM,WAAW,8GAKP,CAAC;AAElB,eAAO,MAAM,WAAW,qUAStB,CAAC;AAEH,eAAO,MAAM,gBAAgB,kcAY3B,CAAC"}
package/dist/lib.js DELETED
@@ -1,30 +0,0 @@
1
- export const FILE_HEADER = `////
2
- /// Autogenerated by ⛋ Terrazzo. DO NOT EDIT!
3
- ////
4
-
5
- @use "sass:list";
6
- @use "sass:map";`;
7
- export const MIXIN_TOKEN = `@function token($tokenName) {
8
- @if map.has-key($__token-values, $tokenName) == false {
9
- @error 'No token named "#{$tokenName}"';
10
- }
11
- $_token: map.get($__token-values, $tokenName);
12
- @if map.has-key($_token, "__tz-error") {
13
- @error map.get($_token, "__tz-error");
14
- }
15
- @return map.get($_token);
16
- }`;
17
- export const MIXIN_TYPOGRAPHY = `@mixin typography($tokenName, $modeName: ".") {
18
- @if map.has-key($__token-typography-mixins, $tokenName) == false {
19
- @error 'No typography mixin named "#{$tokenName}"';
20
- }
21
- $_mixin: map.get($__token-typography-mixins, $tokenName);
22
- $_properties: map.get($_mixin, ".");
23
- @if map.has-key($_mixin) {
24
- $_properties: map.get($_mixin);
25
- }
26
- @each $_property, $_value in $_properties {
27
- #{$_property}: #{$_value};
28
- }
29
- }`;
30
- //# sourceMappingURL=lib.js.map
package/dist/lib.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;iBAKV,CAAC;AAElB,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;EASzB,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;EAY9B,CAAC"}