@powerlines/plugin-style-dictionary 0.3.373 → 0.3.375
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/dist/index.cjs +10 -10
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/node_modules/.pnpm/@storm-software_config-tools@1.190.2_magicast@0.5.2_zod@4.4.3/node_modules/@storm-software/config-tools/dist/chunk-RALMUN5C.cjs +17 -0
- package/dist/node_modules/.pnpm/@storm-software_config-tools@1.190.2_magicast@0.5.2_zod@4.4.3/node_modules/@storm-software/config-tools/dist/chunk-RALMUN5C.mjs +17 -0
- package/dist/node_modules/.pnpm/@storm-software_config-tools@1.190.2_magicast@0.5.2_zod@4.4.3/node_modules/@storm-software/config-tools/dist/chunk-RALMUN5C.mjs.map +1 -0
- package/dist/style-dictionary/file-header.cjs +3 -1
- package/dist/style-dictionary/file-header.mjs +3 -1
- package/dist/style-dictionary/file-header.mjs.map +1 -1
- package/package.json +8 -9
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_chunk_RALMUN5C = require('./node_modules/.pnpm/@storm-software_config-tools@1.190.2_magicast@0.5.2_zod@4.4.3/node_modules/@storm-software/config-tools/dist/chunk-RALMUN5C.cjs');
|
|
3
4
|
const require_file_header = require('./style-dictionary/file-header.cjs');
|
|
4
|
-
let
|
|
5
|
-
let _storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
5
|
+
let _powerlines_schema_resolve = require("@powerlines/schema/resolve");
|
|
6
6
|
let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
7
7
|
let defu = require("defu");
|
|
8
8
|
defu = require_runtime.__toESM(defu, 1);
|
|
@@ -21,7 +21,7 @@ const plugin = (options = {}) => {
|
|
|
21
21
|
name: "style-dictionary",
|
|
22
22
|
config() {
|
|
23
23
|
return { styleDictionary: (0, defu.default)(options, {
|
|
24
|
-
log: { verbosity: this.config.logLevel ===
|
|
24
|
+
log: { verbosity: this.config.logLevel.general === require_chunk_RALMUN5C.LogLevelLabel.TRACE ? "verbose" : this.config.logLevel.general === require_chunk_RALMUN5C.LogLevelLabel.DEBUG ? "default" : "silent" },
|
|
25
25
|
fileHeader: "powerlines/file-header"
|
|
26
26
|
}) };
|
|
27
27
|
},
|
|
@@ -31,7 +31,7 @@ const plugin = (options = {}) => {
|
|
|
31
31
|
if (this.config.styleDictionary.customActions) {
|
|
32
32
|
let builder;
|
|
33
33
|
if ((0, _stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customActions)) builder = this.config.styleDictionary.customActions;
|
|
34
|
-
else builder = await (0,
|
|
34
|
+
else builder = await (0, _powerlines_schema_resolve.resolve)(this, this.config.styleDictionary.customActions);
|
|
35
35
|
Object.entries((0, _stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, action]) => {
|
|
36
36
|
this.styleDictionary.registerAction({
|
|
37
37
|
...action,
|
|
@@ -42,7 +42,7 @@ const plugin = (options = {}) => {
|
|
|
42
42
|
if (this.config.styleDictionary.customFileHeaders) {
|
|
43
43
|
let builder;
|
|
44
44
|
if ((0, _stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customFileHeaders)) builder = this.config.styleDictionary.customFileHeaders;
|
|
45
|
-
else builder = await (0,
|
|
45
|
+
else builder = await (0, _powerlines_schema_resolve.resolve)(this, this.config.styleDictionary.customFileHeaders);
|
|
46
46
|
Object.entries((0, _stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, fileHeader]) => {
|
|
47
47
|
this.styleDictionary.registerFileHeader({
|
|
48
48
|
name,
|
|
@@ -53,7 +53,7 @@ const plugin = (options = {}) => {
|
|
|
53
53
|
if (this.config.styleDictionary.customFilters) {
|
|
54
54
|
let builder;
|
|
55
55
|
if ((0, _stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customFilters)) builder = this.config.styleDictionary.customFilters;
|
|
56
|
-
else builder = await (0,
|
|
56
|
+
else builder = await (0, _powerlines_schema_resolve.resolve)(this, this.config.styleDictionary.customFilters);
|
|
57
57
|
Object.entries((0, _stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, filter]) => {
|
|
58
58
|
this.styleDictionary.registerFilter({
|
|
59
59
|
...filter,
|
|
@@ -64,7 +64,7 @@ const plugin = (options = {}) => {
|
|
|
64
64
|
if (this.config.styleDictionary.customPreprocessors) {
|
|
65
65
|
let builder;
|
|
66
66
|
if ((0, _stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customPreprocessors)) builder = this.config.styleDictionary.customPreprocessors;
|
|
67
|
-
else builder = await (0,
|
|
67
|
+
else builder = await (0, _powerlines_schema_resolve.resolve)(this, this.config.styleDictionary.customPreprocessors);
|
|
68
68
|
Object.entries((0, _stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, preprocessor]) => {
|
|
69
69
|
this.styleDictionary.registerPreprocessor({
|
|
70
70
|
...preprocessor,
|
|
@@ -75,7 +75,7 @@ const plugin = (options = {}) => {
|
|
|
75
75
|
if (this.config.styleDictionary.customParsers) {
|
|
76
76
|
let builder;
|
|
77
77
|
if ((0, _stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customParsers)) builder = this.config.styleDictionary.customParsers;
|
|
78
|
-
else builder = await (0,
|
|
78
|
+
else builder = await (0, _powerlines_schema_resolve.resolve)(this, this.config.styleDictionary.customParsers);
|
|
79
79
|
Object.entries((0, _stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, parser]) => {
|
|
80
80
|
this.styleDictionary.registerParser({
|
|
81
81
|
...parser,
|
|
@@ -86,7 +86,7 @@ const plugin = (options = {}) => {
|
|
|
86
86
|
if (this.config.styleDictionary.customTransforms) {
|
|
87
87
|
let builder;
|
|
88
88
|
if ((0, _stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customTransforms)) builder = this.config.styleDictionary.customTransforms;
|
|
89
|
-
else builder = await (0,
|
|
89
|
+
else builder = await (0, _powerlines_schema_resolve.resolve)(this, this.config.styleDictionary.customTransforms);
|
|
90
90
|
Object.entries((0, _stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, transform]) => {
|
|
91
91
|
this.styleDictionary.registerTransform({
|
|
92
92
|
...transform,
|
|
@@ -97,7 +97,7 @@ const plugin = (options = {}) => {
|
|
|
97
97
|
if (this.config.styleDictionary.customTransformGroups) {
|
|
98
98
|
let builder;
|
|
99
99
|
if ((0, _stryke_type_checks_is_function.isFunction)(this.config.styleDictionary.customTransformGroups)) builder = this.config.styleDictionary.customTransformGroups;
|
|
100
|
-
else builder = await (0,
|
|
100
|
+
else builder = await (0, _powerlines_schema_resolve.resolve)(this, this.config.styleDictionary.customTransformGroups);
|
|
101
101
|
Object.entries((0, _stryke_type_checks_is_function.isFunction)(builder) ? builder(this) : builder).forEach(([name, transformGroup]) => {
|
|
102
102
|
this.styleDictionary.registerTransformGroup({
|
|
103
103
|
name,
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { LogLevelLabel } from "./node_modules/.pnpm/@storm-software_config-tools@1.190.2_magicast@0.5.2_zod@4.4.3/node_modules/@storm-software/config-tools/dist/chunk-RALMUN5C.mjs";
|
|
1
2
|
import { fileHeader } from "./style-dictionary/file-header.mjs";
|
|
2
|
-
import { resolve } from "@powerlines/
|
|
3
|
-
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
3
|
+
import { resolve } from "@powerlines/schema/resolve";
|
|
4
4
|
import { isFunction } from "@stryke/type-checks/is-function";
|
|
5
5
|
import defu from "defu";
|
|
6
6
|
import StyleDictionary from "style-dictionary";
|
|
@@ -17,7 +17,7 @@ const plugin = (options = {}) => {
|
|
|
17
17
|
name: "style-dictionary",
|
|
18
18
|
config() {
|
|
19
19
|
return { styleDictionary: defu(options, {
|
|
20
|
-
log: { verbosity: this.config.logLevel === LogLevelLabel.TRACE ? "verbose" : this.config.logLevel === LogLevelLabel.DEBUG ? "default" : "silent" },
|
|
20
|
+
log: { verbosity: this.config.logLevel.general === LogLevelLabel.TRACE ? "verbose" : this.config.logLevel.general === LogLevelLabel.DEBUG ? "default" : "silent" },
|
|
21
21
|
fileHeader: "powerlines/file-header"
|
|
22
22
|
}) };
|
|
23
23
|
},
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { resolve } from \"@powerlines/plugin-esbuild/helpers/resolve\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport StyleDictionary from \"style-dictionary\";\nimport { fileHeader } from \"./style-dictionary/file-header\";\nimport {\n CustomActionsBuilder,\n CustomFileHeadersBuilder,\n CustomFiltersBuilder,\n CustomParsersBuilder,\n CustomPreprocessorsBuilder,\n CustomTransformGroupsBuilder,\n CustomTransformsBuilder,\n StyleDictionaryPluginContext,\n StyleDictionaryPluginOptions\n} from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n styleDictionary?: StyleDictionaryPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to integrate style-dictionary for code generation.\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends StyleDictionaryPluginContext = StyleDictionaryPluginContext\n>(\n options: StyleDictionaryPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"style-dictionary\",\n config() {\n return {\n styleDictionary: defu(options, {\n log: {\n verbosity:\n this.config.logLevel === LogLevelLabel.TRACE\n ? \"verbose\"\n : this.config.logLevel === LogLevelLabel.DEBUG\n ? \"default\"\n : \"silent\"\n },\n fileHeader: \"powerlines/file-header\"\n })\n };\n },\n async configResolved() {\n this.styleDictionary =\n this.config.styleDictionary.instance ??\n new StyleDictionary(this.config.styleDictionary);\n\n this.styleDictionary.registerFileHeader(fileHeader(this));\n\n if (this.config.styleDictionary.customActions) {\n let builder!: CustomActionsBuilder;\n if (isFunction(this.config.styleDictionary.customActions)) {\n builder = this.config.styleDictionary.customActions;\n } else {\n builder = await resolve<CustomActionsBuilder>(\n this,\n this.config.styleDictionary.customActions\n );\n }\n\n Object.entries(isFunction(builder) ? builder(this) : builder).forEach(\n ([name, action]) => {\n this.styleDictionary.registerAction({\n ...action,\n name\n });\n }\n );\n }\n\n if (this.config.styleDictionary.customFileHeaders) {\n let builder!: CustomFileHeadersBuilder;\n if (isFunction(this.config.styleDictionary.customFileHeaders)) {\n builder = this.config.styleDictionary.customFileHeaders;\n } else {\n builder = await resolve<CustomFileHeadersBuilder>(\n this,\n this.config.styleDictionary.customFileHeaders\n );\n }\n\n Object.entries(isFunction(builder) ? builder(this) : builder).forEach(\n ([name, fileHeader]) => {\n this.styleDictionary.registerFileHeader({\n name,\n fileHeader\n });\n }\n );\n }\n\n if (this.config.styleDictionary.customFilters) {\n let builder!: CustomFiltersBuilder;\n if (isFunction(this.config.styleDictionary.customFilters)) {\n builder = this.config.styleDictionary.customFilters;\n } else {\n builder = await resolve<CustomFiltersBuilder>(\n this,\n this.config.styleDictionary.customFilters\n );\n }\n\n Object.entries(isFunction(builder) ? builder(this) : builder).forEach(\n ([name, filter]) => {\n this.styleDictionary.registerFilter({\n ...filter,\n name\n });\n }\n );\n }\n\n if (this.config.styleDictionary.customPreprocessors) {\n let builder!: CustomPreprocessorsBuilder;\n if (isFunction(this.config.styleDictionary.customPreprocessors)) {\n builder = this.config.styleDictionary.customPreprocessors;\n } else {\n builder = await resolve<CustomPreprocessorsBuilder>(\n this,\n this.config.styleDictionary.customPreprocessors\n );\n }\n\n Object.entries(isFunction(builder) ? builder(this) : builder).forEach(\n ([name, preprocessor]) => {\n this.styleDictionary.registerPreprocessor({\n ...preprocessor,\n name\n });\n }\n );\n }\n\n if (this.config.styleDictionary.customParsers) {\n let builder!: CustomParsersBuilder;\n if (isFunction(this.config.styleDictionary.customParsers)) {\n builder = this.config.styleDictionary.customParsers;\n } else {\n builder = await resolve<CustomParsersBuilder>(\n this,\n this.config.styleDictionary.customParsers\n );\n }\n\n Object.entries(isFunction(builder) ? builder(this) : builder).forEach(\n ([name, parser]) => {\n this.styleDictionary.registerParser({\n ...parser,\n name\n });\n }\n );\n }\n\n if (this.config.styleDictionary.customTransforms) {\n let builder!: CustomTransformsBuilder;\n if (isFunction(this.config.styleDictionary.customTransforms)) {\n builder = this.config.styleDictionary.customTransforms;\n } else {\n builder = await resolve<CustomTransformsBuilder>(\n this,\n this.config.styleDictionary.customTransforms\n );\n }\n\n Object.entries(isFunction(builder) ? builder(this) : builder).forEach(\n ([name, transform]) => {\n this.styleDictionary.registerTransform({\n ...transform,\n name\n });\n }\n );\n }\n\n if (this.config.styleDictionary.customTransformGroups) {\n let builder!: CustomTransformGroupsBuilder;\n if (isFunction(this.config.styleDictionary.customTransformGroups)) {\n builder = this.config.styleDictionary.customTransformGroups;\n } else {\n builder = await resolve<CustomTransformGroupsBuilder>(\n this,\n this.config.styleDictionary.customTransformGroups\n );\n }\n\n Object.entries(isFunction(builder) ? builder(this) : builder).forEach(\n ([name, transformGroup]) => {\n this.styleDictionary.registerTransformGroup({\n name,\n transforms: transformGroup\n });\n }\n );\n }\n },\n async clean() {\n await this.styleDictionary.cleanAllPlatforms({\n cache: !this.config.skipCache\n });\n },\n prepare: {\n order: \"pre\",\n async handler() {\n if (!this.config.styleDictionary.skipBuild) {\n await this.styleDictionary.buildAllPlatforms({\n cache: !this.config.skipCache\n });\n }\n }\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;AAmDA,MAAa,UAGX,UAAwC,EAAE,KACrB;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO,EACL,iBAAiB,KAAK,SAAS;IAC7B,KAAK,EACH,WACE,KAAK,OAAO,aAAa,cAAc,QACnC,YACA,KAAK,OAAO,aAAa,cAAc,QACrC,YACA,UACT;IACD,YAAY;IACb,CAAC,EACH;;EAEH,MAAM,iBAAiB;AACrB,QAAK,kBACH,KAAK,OAAO,gBAAgB,YAC5B,IAAI,gBAAgB,KAAK,OAAO,gBAAgB;AAElD,QAAK,gBAAgB,mBAAmB,WAAW,KAAK,CAAC;AAEzD,OAAI,KAAK,OAAO,gBAAgB,eAAe;IAC7C,IAAI;AACJ,QAAI,WAAW,KAAK,OAAO,gBAAgB,cAAc,CACvD,WAAU,KAAK,OAAO,gBAAgB;QAEtC,WAAU,MAAM,QACd,MACA,KAAK,OAAO,gBAAgB,cAC7B;AAGH,WAAO,QAAQ,WAAW,QAAQ,GAAG,QAAQ,KAAK,GAAG,QAAQ,CAAC,SAC3D,CAAC,MAAM,YAAY;AAClB,UAAK,gBAAgB,eAAe;MAClC,GAAG;MACH;MACD,CAAC;MAEL;;AAGH,OAAI,KAAK,OAAO,gBAAgB,mBAAmB;IACjD,IAAI;AACJ,QAAI,WAAW,KAAK,OAAO,gBAAgB,kBAAkB,CAC3D,WAAU,KAAK,OAAO,gBAAgB;QAEtC,WAAU,MAAM,QACd,MACA,KAAK,OAAO,gBAAgB,kBAC7B;AAGH,WAAO,QAAQ,WAAW,QAAQ,GAAG,QAAQ,KAAK,GAAG,QAAQ,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AC1D,WAAU,KAAK,OAAO,gBAAgB;QAEtC,WAAU,MAAM,QACd,MACA,KAAK,OAAO,gBAAgB,iBAC7B;AAGH,WAAO,QAAQ,WAAW,QAAQ,GAAG,QAAQ,KAAK,GAAG,QAAQ,CAAC,SAC3D,CAAC,MAAM,eAAe;AACrB,UAAK,gBAAgB,kBAAkB;MACrC,GAAG;MACH;MACD,CAAC;MAEL;;AAGH,OAAI,KAAK,OAAO,gBAAgB,uBAAuB;IACrD,IAAI;AACJ,QAAI,WAAW,KAAK,OAAO,gBAAgB,sBAAsB,CAC/D,WAAU,KAAK,OAAO,gBAAgB;QAEtC,WAAU,MAAM,QACd,MACA,KAAK,OAAO,gBAAgB,sBAC7B;AAGH,WAAO,QAAQ,WAAW,QAAQ,GAAG,QAAQ,KAAK,GAAG,QAAQ,CAAC,SAC3D,CAAC,MAAM,oBAAoB;AAC1B,UAAK,gBAAgB,uBAAuB;MAC1C;MACA,YAAY;MACb,CAAC;MAEL;;;EAGL,MAAM,QAAQ;AACZ,SAAM,KAAK,gBAAgB,kBAAkB,EAC3C,OAAO,CAAC,KAAK,OAAO,WACrB,CAAC;;EAEJ,SAAS;GACP,OAAO;GACP,MAAM,UAAU;AACd,QAAI,CAAC,KAAK,OAAO,gBAAgB,UAC/B,OAAM,KAAK,gBAAgB,kBAAkB,EAC3C,OAAO,CAAC,KAAK,OAAO,WACrB,CAAC;;GAGP;EACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { resolve } from \"@powerlines/schema/resolve\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport StyleDictionary from \"style-dictionary\";\nimport { fileHeader } from \"./style-dictionary/file-header\";\nimport {\n CustomActionsBuilder,\n CustomFileHeadersBuilder,\n CustomFiltersBuilder,\n CustomParsersBuilder,\n CustomPreprocessorsBuilder,\n CustomTransformGroupsBuilder,\n CustomTransformsBuilder,\n StyleDictionaryPluginContext,\n StyleDictionaryPluginOptions\n} from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n styleDictionary?: StyleDictionaryPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to integrate style-dictionary for code generation.\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends StyleDictionaryPluginContext = StyleDictionaryPluginContext\n>(\n options: StyleDictionaryPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"style-dictionary\",\n config() {\n return {\n styleDictionary: defu(options, {\n log: {\n verbosity:\n this.config.logLevel.general === LogLevelLabel.TRACE\n ? \"verbose\"\n : this.config.logLevel.general === LogLevelLabel.DEBUG\n ? \"default\"\n : \"silent\"\n },\n fileHeader: \"powerlines/file-header\"\n })\n };\n },\n async configResolved() {\n this.styleDictionary =\n this.config.styleDictionary.instance ??\n new StyleDictionary(this.config.styleDictionary);\n\n this.styleDictionary.registerFileHeader(fileHeader(this));\n\n if (this.config.styleDictionary.customActions) {\n let builder!: CustomActionsBuilder;\n if (isFunction(this.config.styleDictionary.customActions)) {\n builder = this.config.styleDictionary.customActions;\n } else {\n builder = await resolve<CustomActionsBuilder>(\n this,\n this.config.styleDictionary.customActions\n );\n }\n\n Object.entries(isFunction(builder) ? builder(this) : builder).forEach(\n ([name, action]) => {\n this.styleDictionary.registerAction({\n ...action,\n name\n });\n }\n );\n }\n\n if (this.config.styleDictionary.customFileHeaders) {\n let builder!: CustomFileHeadersBuilder;\n if (isFunction(this.config.styleDictionary.customFileHeaders)) {\n builder = this.config.styleDictionary.customFileHeaders;\n } else {\n builder = await resolve<CustomFileHeadersBuilder>(\n this,\n this.config.styleDictionary.customFileHeaders\n );\n }\n\n Object.entries(isFunction(builder) ? builder(this) : builder).forEach(\n ([name, fileHeader]) => {\n this.styleDictionary.registerFileHeader({\n name,\n fileHeader\n });\n }\n );\n }\n\n if (this.config.styleDictionary.customFilters) {\n let builder!: CustomFiltersBuilder;\n if (isFunction(this.config.styleDictionary.customFilters)) {\n builder = this.config.styleDictionary.customFilters;\n } else {\n builder = await resolve<CustomFiltersBuilder>(\n this,\n this.config.styleDictionary.customFilters\n );\n }\n\n Object.entries(isFunction(builder) ? builder(this) : builder).forEach(\n ([name, filter]) => {\n this.styleDictionary.registerFilter({\n ...filter,\n name\n });\n }\n );\n }\n\n if (this.config.styleDictionary.customPreprocessors) {\n let builder!: CustomPreprocessorsBuilder;\n if (isFunction(this.config.styleDictionary.customPreprocessors)) {\n builder = this.config.styleDictionary.customPreprocessors;\n } else {\n builder = await resolve<CustomPreprocessorsBuilder>(\n this,\n this.config.styleDictionary.customPreprocessors\n );\n }\n\n Object.entries(isFunction(builder) ? builder(this) : builder).forEach(\n ([name, preprocessor]) => {\n this.styleDictionary.registerPreprocessor({\n ...preprocessor,\n name\n });\n }\n );\n }\n\n if (this.config.styleDictionary.customParsers) {\n let builder!: CustomParsersBuilder;\n if (isFunction(this.config.styleDictionary.customParsers)) {\n builder = this.config.styleDictionary.customParsers;\n } else {\n builder = await resolve<CustomParsersBuilder>(\n this,\n this.config.styleDictionary.customParsers\n );\n }\n\n Object.entries(isFunction(builder) ? builder(this) : builder).forEach(\n ([name, parser]) => {\n this.styleDictionary.registerParser({\n ...parser,\n name\n });\n }\n );\n }\n\n if (this.config.styleDictionary.customTransforms) {\n let builder!: CustomTransformsBuilder;\n if (isFunction(this.config.styleDictionary.customTransforms)) {\n builder = this.config.styleDictionary.customTransforms;\n } else {\n builder = await resolve<CustomTransformsBuilder>(\n this,\n this.config.styleDictionary.customTransforms\n );\n }\n\n Object.entries(isFunction(builder) ? builder(this) : builder).forEach(\n ([name, transform]) => {\n this.styleDictionary.registerTransform({\n ...transform,\n name\n });\n }\n );\n }\n\n if (this.config.styleDictionary.customTransformGroups) {\n let builder!: CustomTransformGroupsBuilder;\n if (isFunction(this.config.styleDictionary.customTransformGroups)) {\n builder = this.config.styleDictionary.customTransformGroups;\n } else {\n builder = await resolve<CustomTransformGroupsBuilder>(\n this,\n this.config.styleDictionary.customTransformGroups\n );\n }\n\n Object.entries(isFunction(builder) ? builder(this) : builder).forEach(\n ([name, transformGroup]) => {\n this.styleDictionary.registerTransformGroup({\n name,\n transforms: transformGroup\n });\n }\n );\n }\n },\n async clean() {\n await this.styleDictionary.cleanAllPlatforms({\n cache: !this.config.skipCache\n });\n },\n prepare: {\n order: \"pre\",\n async handler() {\n if (!this.config.styleDictionary.skipBuild) {\n await this.styleDictionary.buildAllPlatforms({\n cache: !this.config.skipCache\n });\n }\n }\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;AAmDA,MAAa,UAGX,UAAwC,EAAE,KACrB;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO,EACL,iBAAiB,KAAK,SAAS;IAC7B,KAAK,EACH,WACE,KAAK,OAAO,SAAS,YAAY,cAAc,QAC3C,YACA,KAAK,OAAO,SAAS,YAAY,cAAc,QAC7C,YACA,UACT;IACD,YAAY;IACb,CAAC,EACH;;EAEH,MAAM,iBAAiB;AACrB,QAAK,kBACH,KAAK,OAAO,gBAAgB,YAC5B,IAAI,gBAAgB,KAAK,OAAO,gBAAgB;AAElD,QAAK,gBAAgB,mBAAmB,WAAW,KAAK,CAAC;AAEzD,OAAI,KAAK,OAAO,gBAAgB,eAAe;IAC7C,IAAI;AACJ,QAAI,WAAW,KA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;EAEJ,SAAS;GACP,OAAO;GACP,MAAM,UAAU;AACd,QAAI,CAAC,KAAK,OAAO,gBAAgB,UAC/B,OAAM,KAAK,gBAAgB,kBAAkB,EAC3C,OAAO,CAAC,KAAK,OAAO,WACrB,CAAC;;GAGP;EACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../../../node_modules/.pnpm/@storm-software+config-tools@1.190.2_magicast@0.5.2_zod@4.4.3/node_modules/@storm-software/config-tools/dist/chunk-RALMUN5C.js
|
|
3
|
+
var LogLevelLabel = {
|
|
4
|
+
SILENT: "silent",
|
|
5
|
+
FATAL: "fatal",
|
|
6
|
+
ERROR: "error",
|
|
7
|
+
WARN: "warn",
|
|
8
|
+
SUCCESS: "success",
|
|
9
|
+
INFO: "info",
|
|
10
|
+
PERFORMANCE: "performance",
|
|
11
|
+
DEBUG: "debug",
|
|
12
|
+
TRACE: "trace",
|
|
13
|
+
ALL: "all"
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.LogLevelLabel = LogLevelLabel;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region ../../../node_modules/.pnpm/@storm-software+config-tools@1.190.2_magicast@0.5.2_zod@4.4.3/node_modules/@storm-software/config-tools/dist/chunk-RALMUN5C.js
|
|
2
|
+
var LogLevelLabel = {
|
|
3
|
+
SILENT: "silent",
|
|
4
|
+
FATAL: "fatal",
|
|
5
|
+
ERROR: "error",
|
|
6
|
+
WARN: "warn",
|
|
7
|
+
SUCCESS: "success",
|
|
8
|
+
INFO: "info",
|
|
9
|
+
PERFORMANCE: "performance",
|
|
10
|
+
DEBUG: "debug",
|
|
11
|
+
TRACE: "trace",
|
|
12
|
+
ALL: "all"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { LogLevelLabel };
|
|
17
|
+
//# sourceMappingURL=chunk-RALMUN5C.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-RALMUN5C.mjs","names":[],"sources":["../../../../../../../../../../../node_modules/.pnpm/@storm-software+config-tools@1.190.2_magicast@0.5.2_zod@4.4.3/node_modules/@storm-software/config-tools/dist/chunk-RALMUN5C.js"],"sourcesContent":["// src/types.ts\nvar LogLevel = {\n SILENT: 0,\n FATAL: 10,\n ERROR: 20,\n WARN: 30,\n SUCCESS: 35,\n INFO: 40,\n PERFORMANCE: 50,\n DEBUG: 60,\n TRACE: 70,\n ALL: 100\n};\nvar LogLevelLabel = {\n SILENT: \"silent\",\n FATAL: \"fatal\",\n ERROR: \"error\",\n WARN: \"warn\",\n SUCCESS: \"success\",\n INFO: \"info\",\n PERFORMANCE: \"performance\",\n DEBUG: \"debug\",\n TRACE: \"trace\",\n ALL: \"all\"\n};\n\nexport {\n LogLevel,\n LogLevelLabel\n};\n"],"x_google_ignoreList":[0],"mappings":";AAaA,IAAI,gBAAgB;CAClB,QAAQ;CACR,OAAO;CACP,OAAO;CACP,MAAM;CACN,SAAS;CACT,MAAM;CACN,aAAa;CACb,OAAO;CACP,OAAO;CACP,KAAK;CACN"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
1
3
|
|
|
2
4
|
//#region src/style-dictionary/file-header.ts
|
|
3
5
|
const fileHeader = (context) => ({
|
|
4
6
|
name: "powerlines/file-header",
|
|
5
7
|
fileHeader: (defaultMessages = []) => {
|
|
6
8
|
return [
|
|
7
|
-
`Generated by ${context.config.framework || "Powerlines"}`,
|
|
9
|
+
`Generated by ${(0, _stryke_string_format_title_case.titleCase)(context.config.framework?.name) || "Powerlines"}`,
|
|
8
10
|
"NOTE: Do not edit this file manually - it will be overwritten automatically by the \"prepare\" command",
|
|
9
11
|
...defaultMessages
|
|
10
12
|
];
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
2
|
+
|
|
1
3
|
//#region src/style-dictionary/file-header.ts
|
|
2
4
|
const fileHeader = (context) => ({
|
|
3
5
|
name: "powerlines/file-header",
|
|
4
6
|
fileHeader: (defaultMessages = []) => {
|
|
5
7
|
return [
|
|
6
|
-
`Generated by ${context.config.framework || "Powerlines"}`,
|
|
8
|
+
`Generated by ${titleCase(context.config.framework?.name) || "Powerlines"}`,
|
|
7
9
|
"NOTE: Do not edit this file manually - it will be overwritten automatically by the \"prepare\" command",
|
|
8
10
|
...defaultMessages
|
|
9
11
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-header.mjs","names":[],"sources":["../../src/style-dictionary/file-header.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Context } from \"powerlines\";\nimport type { FileHeader } from \"style-dictionary/types\";\n\nexport const fileHeader = (\n context: Context\n): { name: string; fileHeader: FileHeader } => ({\n name: \"powerlines/file-header\",\n fileHeader: (defaultMessages = [] as string[]) => {\n return [\n `Generated by ${context.config.framework || \"Powerlines\"}`,\n 'NOTE: Do not edit this file manually - it will be overwritten automatically by the \"prepare\" command',\n ...defaultMessages\n ];\n }\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-header.mjs","names":[],"sources":["../../src/style-dictionary/file-header.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport type { Context } from \"powerlines\";\nimport type { FileHeader } from \"style-dictionary/types\";\n\nexport const fileHeader = (\n context: Context\n): { name: string; fileHeader: FileHeader } => ({\n name: \"powerlines/file-header\",\n fileHeader: (defaultMessages = [] as string[]) => {\n return [\n `Generated by ${titleCase(context.config.framework?.name) || \"Powerlines\"}`,\n 'NOTE: Do not edit this file manually - it will be overwritten automatically by the \"prepare\" command',\n ...defaultMessages\n ];\n }\n});\n"],"mappings":";;;AAsBA,MAAa,cACX,aAC8C;CAC9C,MAAM;CACN,aAAa,kBAAkB,EAAE,KAAiB;AAChD,SAAO;GACL,gBAAgB,UAAU,QAAQ,OAAO,WAAW,KAAK,IAAI;GAC7D;GACA,GAAG;GACJ;;CAEJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-style-dictionary",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.375",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Powerlines plugin to generate project code with Style Dictionary.",
|
|
6
6
|
"keywords": [
|
|
@@ -60,22 +60,21 @@
|
|
|
60
60
|
"module": "./dist/index.mjs",
|
|
61
61
|
"types": "./dist/index.d.cts",
|
|
62
62
|
"typings": "dist/index.d.mts",
|
|
63
|
-
"files": ["dist
|
|
63
|
+
"files": ["dist"],
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@powerlines/
|
|
66
|
-
"@
|
|
67
|
-
"@stryke/path": "^0.29.2",
|
|
65
|
+
"@powerlines/schema": "^0.10.1",
|
|
66
|
+
"@stryke/string-format": "^0.17.17",
|
|
68
67
|
"@stryke/type-checks": "^0.6.8",
|
|
69
68
|
"@stryke/types": "^0.12.3",
|
|
70
69
|
"defu": "^6.1.7",
|
|
71
|
-
"
|
|
72
|
-
"powerlines": "^0.47.11",
|
|
70
|
+
"powerlines": "^0.47.13",
|
|
73
71
|
"style-dictionary": "^5.4.0"
|
|
74
72
|
},
|
|
75
73
|
"devDependencies": {
|
|
76
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
74
|
+
"@powerlines/plugin-plugin": "^0.12.425",
|
|
77
75
|
"@types/node": "^25.7.0"
|
|
78
76
|
},
|
|
79
77
|
"publishConfig": { "access": "public" },
|
|
80
|
-
"
|
|
78
|
+
"inlinedDependencies": { "@storm-software/config-tools": "1.190.2" },
|
|
79
|
+
"gitHead": "736cd33f1a3d05ab931feed3ffe1df16043c216b"
|
|
81
80
|
}
|