@power-plant/terrazzo-input 0.0.2 → 0.0.3

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
@@ -33,7 +33,7 @@ The Power Plant monorepo is a collection of packages that are designed to work t
33
33
 
34
34
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
35
35
 
36
- [![Version](https://img.shields.io/badge/version-0.0.1-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://docs.stormsoftware.com/projects/power-plant)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/power-plant/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
36
+ [![Version](https://img.shields.io/badge/version-0.0.2-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://docs.stormsoftware.com/projects/power-plant)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/power-plant/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
37
37
 
38
38
  <!-- prettier-ignore-start -->
39
39
  <!-- markdownlint-disable -->
package/dist/index.d.cts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { Options } from "./types.cjs";
2
2
  import { toTokenFilename } from "./utilities.cjs";
3
+ import { Tokens } from "@power-plant/dtcg-schema";
3
4
  //#region src/index.d.ts
4
- declare const _default: import("@power-plant/core").InputConfigObject<import("@power-plant/dtcg-schema").Tokens, Options>;
5
+ declare const _default: import("@power-plant/core").InputConfigObject<Tokens, Options>;
5
6
  //#endregion
6
7
  export { type Options, _default as default, toTokenFilename };
7
8
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.mts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { Options } from "./types.mjs";
2
2
  import { toTokenFilename } from "./utilities.mjs";
3
+ import { Tokens } from "@power-plant/dtcg-schema";
3
4
  //#region src/index.d.ts
4
- declare const _default: import("@power-plant/core").InputConfigObject<import("@power-plant/dtcg-schema").Tokens, Options>;
5
+ declare const _default: import("@power-plant/core").InputConfigObject<Tokens, Options>;
5
6
  //#endregion
6
7
  export { type Options, _default as default, toTokenFilename };
7
8
  //# sourceMappingURL=index.d.mts.map
package/dist/input.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Options } from "./types.cjs";
2
- import { DTCGSchema } from "@power-plant/dtcg-schema";
2
+ import { Tokens } from "@power-plant/dtcg-schema";
3
3
  //#region src/input.d.ts
4
4
  /**
5
5
  * Loads DTCG design tokens and validates them with `@terrazzo/parser`.
@@ -8,9 +8,9 @@ import { DTCGSchema } from "@power-plant/dtcg-schema";
8
8
  * @see https://github.com/terrazzoapp/terrazzo/tree/main/packages/parser
9
9
  *
10
10
  * @param options - The options for the input.
11
- * @returns The loaded {@link DTCGSchema} document.
11
+ * @returns The loaded {@link Tokens} document.
12
12
  */
13
- declare function input(options: Options): Promise<DTCGSchema>;
13
+ declare function input(options: Options): Promise<Tokens>;
14
14
  //#endregion
15
15
  export { input };
16
16
  //# sourceMappingURL=input.d.cts.map
package/dist/input.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Options } from "./types.mjs";
2
- import { DTCGSchema } from "@power-plant/dtcg-schema";
2
+ import { Tokens } from "@power-plant/dtcg-schema";
3
3
  //#region src/input.d.ts
4
4
  /**
5
5
  * Loads DTCG design tokens and validates them with `@terrazzo/parser`.
@@ -8,9 +8,9 @@ import { DTCGSchema } from "@power-plant/dtcg-schema";
8
8
  * @see https://github.com/terrazzoapp/terrazzo/tree/main/packages/parser
9
9
  *
10
10
  * @param options - The options for the input.
11
- * @returns The loaded {@link DTCGSchema} document.
11
+ * @returns The loaded {@link Tokens} document.
12
12
  */
13
- declare function input(options: Options): Promise<DTCGSchema>;
13
+ declare function input(options: Options): Promise<Tokens>;
14
14
  //#endregion
15
15
  export { input };
16
16
  //# sourceMappingURL=input.d.mts.map
@@ -1,2 +1,2 @@
1
1
  Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@stryke/resolve/type-checks"),t=require("@stryke/type-checks/is-string"),n=require("@stryke/type-checks/is-url"),r=require("node:path"),i=require("node:url");function a(a,o){return(0,e.isFileReference)(a)?(0,i.pathToFileURL)((0,r.isAbsolute)(a.file)?a.file:(0,r.join)(o,a.file)):(0,n.isURL)(a)?a instanceof URL?a:new URL(String(a)):(0,t.isString)(a)?a.startsWith(`file:`)||a.startsWith(`http:`)||a.startsWith(`https:`)?new URL(a):(0,i.pathToFileURL)((0,r.isAbsolute)(a)?a:(0,r.join)(o,a)):(0,i.pathToFileURL)((0,r.join)(o,String(a)))}function o(e){if((0,t.isString)(e))return JSON.parse(e);if(e&&typeof e==`object`)return e;throw Error(`Expected DTCG tokens JSON object or string, received ${typeof e}`)}const s=e=>typeof e==`object`&&!!e&&!Array.isArray(e),c=e=>s(e)&&(`$value`in e||`$ref`in e);function l(e){if(c(e.originalValue))return{...e.originalValue};let t={$type:e.$type,$value:e.aliasOf?`{${e.aliasOf}}`:e.$value};return e.$description!==void 0&&(t.$description=e.$description),e.$extensions!==void 0&&(t.$extensions=e.$extensions),e.$deprecated!==void 0&&(t.$deprecated=e.$deprecated),t}function u(e,t){t.$type!==void 0&&(e.$type=t.$type),t.$description!==void 0&&(e.$description=t.$description),t.$extensions!==void 0&&(e.$extensions=t.$extensions),t.$deprecated!==void 0&&(e.$deprecated=t.$deprecated)}function d(e){let t={};for(let n of Object.values(e)){let e=n.id.split(`.`),r=t;for(let t=0;t<e.length-1;t++){let i=e[t],a=r[i];(!s(a)||c(a))&&(r[i]={}),r=r[i];let o=e.slice(0,t+1).join(`.`);n.group?.id===o&&u(r,n.group)}let i=e.at(-1);r[i]=l(n)}return t}function f(e){return e instanceof Error?[e.message,e.stack].filter(Boolean).join(`
2
- `):String(e)}exports.formatParseError=f,exports.fromTokenNormalizedSet=d,exports.toDTCGSchema=o,exports.toTokenFilename=a;
2
+ `):String(e)}exports.formatParseError=f,exports.fromTokenNormalizedSet=d,exports.toTokenFilename=a,exports.toTokens=o;
@@ -1,6 +1,6 @@
1
+ import { Tokens } from "@power-plant/dtcg-schema";
1
2
  import { LoadReference } from "@stryke/resolve/types";
2
3
  import { TokenNormalizedSet } from "@terrazzo/parser";
3
- import { DTCGSchema } from "@power-plant/dtcg-schema";
4
4
  //#region src/utilities.d.ts
5
5
  /**
6
6
  * Converts a Power Plant {@link LoadReference} into a `file:` / remote URL for
@@ -12,20 +12,20 @@ import { DTCGSchema } from "@power-plant/dtcg-schema";
12
12
  */
13
13
  declare function toTokenFilename(reference: LoadReference, cwd: string): URL;
14
14
  /**
15
- * Normalizes loaded token source content into a {@link DTCGSchema} object.
15
+ * Normalizes loaded token source content into a {@link Tokens} object.
16
16
  *
17
17
  * @param src - Raw source content from a loader (`string` or object).
18
18
  * @returns The DTCG tokens document.
19
19
  */
20
- declare function toDTCGSchema(src: unknown): DTCGSchema;
20
+ declare function toTokens(src: unknown): Tokens;
21
21
  /**
22
22
  * Converts a Terrazzo {@link TokenNormalizedSet} (flat `id` → token map) into a
23
- * nested {@link DTCGSchema} document.
23
+ * nested {@link Tokens} document.
24
24
  *
25
25
  * @param tokens - Normalized tokens from `@terrazzo/parser` `parse()`.
26
26
  * @returns Nested DTCG tokens document.
27
27
  */
28
- declare function fromTokenNormalizedSet(tokens: TokenNormalizedSet): DTCGSchema;
28
+ declare function fromTokenNormalizedSet(tokens: TokenNormalizedSet): Tokens;
29
29
  /**
30
30
  * Formats a parse/load error into a string.
31
31
  *
@@ -34,5 +34,5 @@ declare function fromTokenNormalizedSet(tokens: TokenNormalizedSet): DTCGSchema;
34
34
  */
35
35
  declare function formatParseError(error: unknown): string;
36
36
  //#endregion
37
- export { formatParseError, fromTokenNormalizedSet, toDTCGSchema, toTokenFilename };
37
+ export { formatParseError, fromTokenNormalizedSet, toTokenFilename, toTokens };
38
38
  //# sourceMappingURL=utilities.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.d.cts","names":[],"sources":["../src/utilities.ts"],"mappings":";;;;;;;;;;;;iBAmCgB,gBAAgB,WAAW,eAAe,cAAc;;;;;;;iBAoCxD,aAAa,eAAe;;;;;;;;iBA8E5B,uBAAuB,QAAQ,qBAAqB;;;;;;;iBAoCpD,iBAAiB"}
1
+ {"version":3,"file":"utilities.d.cts","names":[],"sources":["../src/utilities.ts"],"mappings":";;;;;;;;;;;;iBAmCgB,gBAAgB,WAAW,eAAe,cAAc;;;;;;;iBAoCxD,SAAS,eAAe;;;;;;;;iBA8ExB,uBAAuB,QAAQ,qBAAqB;;;;;;;iBAoCpD,iBAAiB"}
@@ -1,5 +1,5 @@
1
1
  import { TokenNormalizedSet } from "@terrazzo/parser";
2
- import { DTCGSchema } from "@power-plant/dtcg-schema";
2
+ import { Tokens } from "@power-plant/dtcg-schema";
3
3
  import { LoadReference } from "@stryke/resolve/types";
4
4
  //#region src/utilities.d.ts
5
5
  /**
@@ -12,20 +12,20 @@ import { LoadReference } from "@stryke/resolve/types";
12
12
  */
13
13
  declare function toTokenFilename(reference: LoadReference, cwd: string): URL;
14
14
  /**
15
- * Normalizes loaded token source content into a {@link DTCGSchema} object.
15
+ * Normalizes loaded token source content into a {@link Tokens} object.
16
16
  *
17
17
  * @param src - Raw source content from a loader (`string` or object).
18
18
  * @returns The DTCG tokens document.
19
19
  */
20
- declare function toDTCGSchema(src: unknown): DTCGSchema;
20
+ declare function toTokens(src: unknown): Tokens;
21
21
  /**
22
22
  * Converts a Terrazzo {@link TokenNormalizedSet} (flat `id` → token map) into a
23
- * nested {@link DTCGSchema} document.
23
+ * nested {@link Tokens} document.
24
24
  *
25
25
  * @param tokens - Normalized tokens from `@terrazzo/parser` `parse()`.
26
26
  * @returns Nested DTCG tokens document.
27
27
  */
28
- declare function fromTokenNormalizedSet(tokens: TokenNormalizedSet): DTCGSchema;
28
+ declare function fromTokenNormalizedSet(tokens: TokenNormalizedSet): Tokens;
29
29
  /**
30
30
  * Formats a parse/load error into a string.
31
31
  *
@@ -34,5 +34,5 @@ declare function fromTokenNormalizedSet(tokens: TokenNormalizedSet): DTCGSchema;
34
34
  */
35
35
  declare function formatParseError(error: unknown): string;
36
36
  //#endregion
37
- export { formatParseError, fromTokenNormalizedSet, toDTCGSchema, toTokenFilename };
37
+ export { formatParseError, fromTokenNormalizedSet, toTokenFilename, toTokens };
38
38
  //# sourceMappingURL=utilities.d.mts.map
@@ -1,3 +1,3 @@
1
1
  import{isFileReference as e}from"@stryke/resolve/type-checks";import{isString as t}from"@stryke/type-checks/is-string";import{isURL as n}from"@stryke/type-checks/is-url";import{isAbsolute as r,join as i}from"node:path";import{pathToFileURL as a}from"node:url";function o(o,s){return e(o)?a(r(o.file)?o.file:i(s,o.file)):n(o)?o instanceof URL?o:new URL(String(o)):t(o)?o.startsWith(`file:`)||o.startsWith(`http:`)||o.startsWith(`https:`)?new URL(o):a(r(o)?o:i(s,o)):a(i(s,String(o)))}function s(e){if(t(e))return JSON.parse(e);if(e&&typeof e==`object`)return e;throw Error(`Expected DTCG tokens JSON object or string, received ${typeof e}`)}const c=e=>typeof e==`object`&&!!e&&!Array.isArray(e),l=e=>c(e)&&(`$value`in e||`$ref`in e);function u(e){if(l(e.originalValue))return{...e.originalValue};let t={$type:e.$type,$value:e.aliasOf?`{${e.aliasOf}}`:e.$value};return e.$description!==void 0&&(t.$description=e.$description),e.$extensions!==void 0&&(t.$extensions=e.$extensions),e.$deprecated!==void 0&&(t.$deprecated=e.$deprecated),t}function d(e,t){t.$type!==void 0&&(e.$type=t.$type),t.$description!==void 0&&(e.$description=t.$description),t.$extensions!==void 0&&(e.$extensions=t.$extensions),t.$deprecated!==void 0&&(e.$deprecated=t.$deprecated)}function f(e){let t={};for(let n of Object.values(e)){let e=n.id.split(`.`),r=t;for(let t=0;t<e.length-1;t++){let i=e[t],a=r[i];(!c(a)||l(a))&&(r[i]={}),r=r[i];let o=e.slice(0,t+1).join(`.`);n.group?.id===o&&d(r,n.group)}let i=e.at(-1);r[i]=u(n)}return t}function p(e){return e instanceof Error?[e.message,e.stack].filter(Boolean).join(`
2
- `):String(e)}export{p as formatParseError,f as fromTokenNormalizedSet,s as toDTCGSchema,o as toTokenFilename};
2
+ `):String(e)}export{p as formatParseError,f as fromTokenNormalizedSet,o as toTokenFilename,s as toTokens};
3
3
  //# sourceMappingURL=utilities.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@power-plant/terrazzo-input",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "private": false,
5
5
  "description": "A Power Plant input for reading the source specification from a Design Tokens Community Group (DTCG) schema document and parsing it into a Design Tokens format using Terrazzo.",
6
6
  "keywords": [
@@ -125,9 +125,9 @@
125
125
  "typings": "dist/index.d.mts",
126
126
  "files": ["dist"],
127
127
  "dependencies": {
128
- "@power-plant/core": "^0.0.16",
128
+ "@power-plant/core": "^0.0.17",
129
129
  "@power-plant/dtcg-schema": "^0.0.1",
130
- "@power-plant/schema": "^0.0.16",
130
+ "@power-plant/schema": "^0.0.17",
131
131
  "@stryke/convert": "^0.7.26",
132
132
  "@stryke/resolve": "^0.0.11",
133
133
  "@stryke/type-checks": "^0.6.28",
@@ -140,5 +140,5 @@
140
140
  "powerlines": "^0.47.144"
141
141
  },
142
142
  "publishConfig": { "access": "public" },
143
- "gitHead": "8cb4ebd50961de43b9482885f5ba5779b8ded913"
143
+ "gitHead": "7346b39899095e30744680cd9994a6c229d4f16a"
144
144
  }