@powerlines/plugin-alloy 0.25.68 → 0.25.69

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
@@ -27,7 +27,7 @@ This package is part of the <b>🔌 Powerlines</b> monorepo. Powerlines is the "
27
27
 
28
28
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
29
29
 
30
- [![Version](https://img.shields.io/badge/version-0.25.65-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/powerlines)&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/powerlines/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
30
+ [![Version](https://img.shields.io/badge/version-0.25.67-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/powerlines)&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/powerlines/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
31
31
 
32
32
  <!-- prettier-ignore-start -->
33
33
  <!-- markdownlint-disable -->
@@ -85,7 +85,12 @@ function ObjectDeclaration(props) {
85
85
  },
86
86
  comma: true,
87
87
  doubleHardline: true,
88
- children: (prop) => (0, _alloy_js_core_jsx_runtime.createComponent)(ObjectDeclarationProperty, { property: prop })
88
+ children: (prop) => (0, _alloy_js_core_jsx_runtime.createComponent)(ObjectDeclarationProperty, {
89
+ property: prop,
90
+ get defaultValue() {
91
+ return props.defaultValue?.value?.[prop.getNameAsString()];
92
+ }
93
+ })
89
94
  });
90
95
  } });
91
96
  } })
@@ -103,7 +108,7 @@ function ObjectDeclaration(props) {
103
108
  * Generates a TypeScript object property for the given reflection class.
104
109
  */
105
110
  function ObjectDeclarationProperty(props) {
106
- const [{ property }] = (0, _alloy_js_core.splitProps)(props, ["property"]);
111
+ const [{ property, defaultValue }] = (0, _alloy_js_core.splitProps)(props, ["property", "defaultValue"]);
107
112
  return (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_contexts_reflection.ReflectionPropertyContext.Provider, {
108
113
  value: property,
109
114
  get children() {
@@ -114,7 +119,7 @@ function ObjectDeclarationProperty(props) {
114
119
  return property.getNameAsString();
115
120
  },
116
121
  get value() {
117
- return (0, _powerlines_deepkit_utilities.stringifyDefaultValue)(property);
122
+ return (0, _powerlines_deepkit_utilities.stringifyDefaultValue)(property, defaultValue);
118
123
  }
119
124
  }),
120
125
  (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
@@ -13,6 +13,7 @@ interface ObjectDeclarationProps<T extends Record<string, any> = Record<string,
13
13
  }
14
14
  interface ObjectDeclarationPropertyProps extends ComponentProps {
15
15
  property: ReflectionProperty;
16
+ defaultValue?: any;
16
17
  }
17
18
  /**
18
19
  * Generates a TypeScript object for the given reflection class.
@@ -1 +1 @@
1
- {"version":3,"file":"object-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;;UAuDiB,WAAA;EAAA,SACN,KAAA,EAAO,CAAA;AAAA;AAAA,UAGD,sBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,mBAAA;EACR,UAAA,GAAa,WAAA,CAAY,eAAA,CAAgB,CAAA;EACzC,YAAA,GAAe,WAAA,CAAY,OAAA,CAAQ,CAAA;AAAA;AAAA,UAGpB,8BAAA,SAAuC,cAAA;EACtD,QAAA,EAAU,kBAAA;AAAA;;;AARZ;iBAcgB,iBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,sBAAA,CAAuB,CAAA,IAAD,eAAA,CAAG,QAAA;;;;iBAiHlB,yBAAA,CACd,KAAA,EAAO,8BAAA,GAA8B,eAAA,CAAA,QAAA;AAAA"}
1
+ {"version":3,"file":"object-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;;UAuDiB,WAAA;EAAA,SACN,KAAA,EAAO,CAAA;AAAA;AAAA,UAGD,sBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,mBAAA;EACR,UAAA,GAAa,WAAA,CAAY,eAAA,CAAgB,CAAA;EACzC,YAAA,GAAe,WAAA,CAAY,OAAA,CAAQ,CAAA;AAAA;AAAA,UAGpB,8BAAA,SAAuC,cAAA;EACtD,QAAA,EAAU,kBAAA;EACV,YAAA;AAAA;;AATF;;iBAegB,iBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,sBAAA,CAAuB,CAAA,IAAD,eAAA,CAAG,QAAA;;;;iBAwHlB,yBAAA,CACd,KAAA,EAAO,8BAAA,GAA8B,eAAA,CAAA,QAAA;AAAA"}
@@ -13,6 +13,7 @@ interface ObjectDeclarationProps<T extends Record<string, any> = Record<string,
13
13
  }
14
14
  interface ObjectDeclarationPropertyProps extends ComponentProps {
15
15
  property: ReflectionProperty;
16
+ defaultValue?: any;
16
17
  }
17
18
  /**
18
19
  * Generates a TypeScript object for the given reflection class.
@@ -1 +1 @@
1
- {"version":3,"file":"object-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;;UAuDiB,WAAA;EAAA,SACN,KAAA,EAAO,CAAA;AAAA;AAAA,UAGD,sBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,mBAAA;EACR,UAAA,GAAa,WAAA,CAAY,eAAA,CAAgB,CAAA;EACzC,YAAA,GAAe,WAAA,CAAY,OAAA,CAAQ,CAAA;AAAA;AAAA,UAGpB,8BAAA,SAAuC,cAAA;EACtD,QAAA,EAAU,kBAAA;AAAA;;;AARZ;iBAcgB,iBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,sBAAA,CAAuB,CAAA,IAAD,eAAA,CAAG,QAAA;;;;iBAiHlB,yBAAA,CACd,KAAA,EAAO,8BAAA,GAA8B,eAAA,CAAA,QAAA;AAAA"}
1
+ {"version":3,"file":"object-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;;UAuDiB,WAAA;EAAA,SACN,KAAA,EAAO,CAAA;AAAA;AAAA,UAGD,sBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,mBAAA;EACR,UAAA,GAAa,WAAA,CAAY,eAAA,CAAgB,CAAA;EACzC,YAAA,GAAe,WAAA,CAAY,OAAA,CAAQ,CAAA;AAAA;AAAA,UAGpB,8BAAA,SAAuC,cAAA;EACtD,QAAA,EAAU,kBAAA;EACV,YAAA;AAAA;;AATF;;iBAegB,iBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,sBAAA,CAAuB,CAAA,IAAD,eAAA,CAAG,QAAA;;;;iBAwHlB,yBAAA,CACd,KAAA,EAAO,8BAAA,GAA8B,eAAA,CAAA,QAAA;AAAA"}
@@ -83,7 +83,12 @@ function ObjectDeclaration(props) {
83
83
  },
84
84
  comma: true,
85
85
  doubleHardline: true,
86
- children: (prop) => createComponent(ObjectDeclarationProperty, { property: prop })
86
+ children: (prop) => createComponent(ObjectDeclarationProperty, {
87
+ property: prop,
88
+ get defaultValue() {
89
+ return props.defaultValue?.value?.[prop.getNameAsString()];
90
+ }
91
+ })
87
92
  });
88
93
  } });
89
94
  } })
@@ -101,7 +106,7 @@ function ObjectDeclaration(props) {
101
106
  * Generates a TypeScript object property for the given reflection class.
102
107
  */
103
108
  function ObjectDeclarationProperty(props) {
104
- const [{ property }] = splitProps(props, ["property"]);
109
+ const [{ property, defaultValue }] = splitProps(props, ["property", "defaultValue"]);
105
110
  return createComponent(ReflectionPropertyContext.Provider, {
106
111
  value: property,
107
112
  get children() {
@@ -112,7 +117,7 @@ function ObjectDeclarationProperty(props) {
112
117
  return property.getNameAsString();
113
118
  },
114
119
  get value() {
115
- return stringifyDefaultValue(property);
120
+ return stringifyDefaultValue(property, defaultValue);
116
121
  }
117
122
  }),
118
123
  createIntrinsic("hbr", {})
@@ -1 +1 @@
1
- {"version":3,"file":"object-declaration.mjs","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"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 {\n computed,\n Declaration as CoreDeclaration,\n createSymbolSlot,\n For,\n Name,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n createValueSymbol,\n ObjectExpression,\n ObjectProperty,\n TSSymbolFlags,\n TypeRefContext,\n useTSNamePolicy,\n VarDeclarationProps\n} from \"@alloy-js/typescript\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport type {\n ReflectionClass,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport {\n ReflectionClassContext,\n ReflectionPropertyContext\n} from \"../../core/contexts/reflection\";\nimport { ComponentProps } from \"../../types/components\";\nimport {\n TSDocReflectionClass,\n TSDocReflectionProperty\n} from \"./tsdoc-reflection\";\n\nexport interface ComputedRef<T = any> {\n readonly value: T;\n}\n\nexport interface ObjectDeclarationProps<\n T extends Record<string, any> = Record<string, any>\n> extends VarDeclarationProps {\n reflection?: ComputedRef<ReflectionClass<T>>;\n defaultValue?: ComputedRef<Partial<T> | undefined>;\n}\n\nexport interface ObjectDeclarationPropertyProps extends ComponentProps {\n property: ReflectionProperty;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n */\nexport function ObjectDeclaration<\n T extends Record<string, any> = Record<string, any>\n>(props: ObjectDeclarationProps<T>) {\n if (!props.reflection?.value) {\n return null;\n }\n\n const objectName = computed(() =>\n camelCase(\n (isString(props.name) ? props.name : props.name.toString()) ||\n props.reflection!.value.getName()\n )\n );\n const objectType = computed(\n () => props.type || pascalCase(props.reflection!.value.getName())\n );\n const properties = computed(() =>\n props\n .reflection!.value.getProperties()\n .filter(\n item =>\n !item.isIgnored() &&\n !isUndefined(\n props.defaultValue?.value?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(\n (props.defaultValue as Record<string, any>)?.value?.[alias]\n )\n ) {\n return (props.defaultValue as Record<string, any>)?.value?.[\n alias\n ];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) ||\n (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n );\n\n const TypeSymbolSlot = createSymbolSlot();\n const ValueTypeSymbolSlot = createSymbolSlot();\n const sym = createValueSymbol(props.name, {\n refkeys: props.refkey,\n default: props.default,\n export: props.export,\n metadata: props.metadata,\n tsFlags: props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None,\n type: props.type ? TypeSymbolSlot.firstSymbol : undefined,\n namePolicy: useTSNamePolicy().for(\"variable\")\n });\n\n if (!props.type) {\n ValueTypeSymbolSlot.moveMembersTo(sym);\n }\n\n const keyword = props.var ? \"var\" : props.let ? \"let\" : \"const\";\n const type = props.type ? (\n <TypeRefContext>\n : <TypeSymbolSlot>{props.type}</TypeSymbolSlot>\n </TypeRefContext>\n ) : undefined;\n\n return (\n <Show when={!!props.reflection.value}>\n <ReflectionClassContext.Provider\n value={{\n reflection: props.reflection.value as ReflectionClass<any>,\n override: {\n name: objectName.value,\n type: objectType.value,\n defaultValue: props.defaultValue?.value\n }\n }}>\n <Show when={!!objectName.value && !!objectType.value}>\n <TSDocReflectionClass reflection={props.reflection.value} />\n <CoreDeclaration symbol={sym}>\n {props.export ? \"export \" : \"\"}\n {props.default ? \"default \" : \"\"}\n {keyword} <Name />\n {type} ={\" \"}\n <ValueTypeSymbolSlot>\n {props.initializer ?? props.children ?? (\n <ObjectExpression>\n <For\n each={properties.value ?? []}\n comma={true}\n doubleHardline={true}>\n {prop => <ObjectDeclarationProperty property={prop} />}\n </For>\n </ObjectExpression>\n )}\n </ValueTypeSymbolSlot>\n </CoreDeclaration>\n </Show>\n <hbr />\n </ReflectionClassContext.Provider>\n </Show>\n );\n}\n\n/**\n * Generates a TypeScript object property for the given reflection class.\n */\nexport function ObjectDeclarationProperty(\n props: ObjectDeclarationPropertyProps\n) {\n const [{ property }] = splitProps(props, [\"property\"]);\n\n return (\n <ReflectionPropertyContext.Provider value={property}>\n <TSDocReflectionProperty reflection={property} />\n <ObjectProperty\n name={property.getNameAsString()}\n value={stringifyDefaultValue(property)}\n />\n <hbr />\n </ReflectionPropertyContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4CA,SAAS,kBAAqD,OAAA;AAC9D,KAAM,CAAC,MAAA,YAAA,MACL,QAAA;CAEA,MAAM,a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AAuB;KACtB,IAAA,OAAO;AACL,aAAA,SAAY,iBAAiB;;KAE/B,IAAI,QAAM;AACR,aAAO,sBAAiB,SAAA;;KAE3B,CAAC;IAAE,gBAAA,OAAA,EAAA,CAAA;IAAA;;EAEP,CAAC"}
1
+ {"version":3,"file":"object-declaration.mjs","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"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 {\n computed,\n Declaration as CoreDeclaration,\n createSymbolSlot,\n For,\n Name,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n createValueSymbol,\n ObjectExpression,\n ObjectProperty,\n TSSymbolFlags,\n TypeRefContext,\n useTSNamePolicy,\n VarDeclarationProps\n} from \"@alloy-js/typescript\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport type {\n ReflectionClass,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport {\n ReflectionClassContext,\n ReflectionPropertyContext\n} from \"../../core/contexts/reflection\";\nimport { ComponentProps } from \"../../types/components\";\nimport {\n TSDocReflectionClass,\n TSDocReflectionProperty\n} from \"./tsdoc-reflection\";\n\nexport interface ComputedRef<T = any> {\n readonly value: T;\n}\n\nexport interface ObjectDeclarationProps<\n T extends Record<string, any> = Record<string, any>\n> extends VarDeclarationProps {\n reflection?: ComputedRef<ReflectionClass<T>>;\n defaultValue?: ComputedRef<Partial<T> | undefined>;\n}\n\nexport interface ObjectDeclarationPropertyProps extends ComponentProps {\n property: ReflectionProperty;\n defaultValue?: any;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n */\nexport function ObjectDeclaration<\n T extends Record<string, any> = Record<string, any>\n>(props: ObjectDeclarationProps<T>) {\n if (!props.reflection?.value) {\n return null;\n }\n\n const objectName = computed(() =>\n camelCase(\n (isString(props.name) ? props.name : props.name.toString()) ||\n props.reflection!.value.getName()\n )\n );\n const objectType = computed(\n () => props.type || pascalCase(props.reflection!.value.getName())\n );\n const properties = computed(() =>\n props\n .reflection!.value.getProperties()\n .filter(\n item =>\n !item.isIgnored() &&\n !isUndefined(\n props.defaultValue?.value?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(\n (props.defaultValue as Record<string, any>)?.value?.[alias]\n )\n ) {\n return (props.defaultValue as Record<string, any>)?.value?.[\n alias\n ];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) ||\n (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n );\n\n const TypeSymbolSlot = createSymbolSlot();\n const ValueTypeSymbolSlot = createSymbolSlot();\n const sym = createValueSymbol(props.name, {\n refkeys: props.refkey,\n default: props.default,\n export: props.export,\n metadata: props.metadata,\n tsFlags: props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None,\n type: props.type ? TypeSymbolSlot.firstSymbol : undefined,\n namePolicy: useTSNamePolicy().for(\"variable\")\n });\n\n if (!props.type) {\n ValueTypeSymbolSlot.moveMembersTo(sym);\n }\n\n const keyword = props.var ? \"var\" : props.let ? \"let\" : \"const\";\n const type = props.type ? (\n <TypeRefContext>\n : <TypeSymbolSlot>{props.type}</TypeSymbolSlot>\n </TypeRefContext>\n ) : undefined;\n\n return (\n <Show when={!!props.reflection.value}>\n <ReflectionClassContext.Provider\n value={{\n reflection: props.reflection.value as ReflectionClass<any>,\n override: {\n name: objectName.value,\n type: objectType.value,\n defaultValue: props.defaultValue?.value\n }\n }}>\n <Show when={!!objectName.value && !!objectType.value}>\n <TSDocReflectionClass reflection={props.reflection.value} />\n <CoreDeclaration symbol={sym}>\n {props.export ? \"export \" : \"\"}\n {props.default ? \"default \" : \"\"}\n {keyword} <Name />\n {type} ={\" \"}\n <ValueTypeSymbolSlot>\n {props.initializer ?? props.children ?? (\n <ObjectExpression>\n <For\n each={properties.value ?? []}\n comma={true}\n doubleHardline={true}>\n {prop => (\n <ObjectDeclarationProperty\n property={prop}\n defaultValue={\n props.defaultValue?.value?.[prop.getNameAsString()]\n }\n />\n )}\n </For>\n </ObjectExpression>\n )}\n </ValueTypeSymbolSlot>\n </CoreDeclaration>\n </Show>\n <hbr />\n </ReflectionClassContext.Provider>\n </Show>\n );\n}\n\n/**\n * Generates a TypeScript object property for the given reflection class.\n */\nexport function ObjectDeclarationProperty(\n props: ObjectDeclarationPropertyProps\n) {\n const [{ property, defaultValue }] = splitProps(props, [\n \"property\",\n \"defaultValue\"\n ]);\n\n return (\n <ReflectionPropertyContext.Provider value={property}>\n <TSDocReflectionProperty reflection={property} />\n <ObjectProperty\n name={property.getNameAsString()}\n value={stringifyDefaultValue(property, defaultValue)}\n />\n <hbr />\n </ReflectionPropertyContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA6CA,SAAO,kBAAA,OAAA;AACL,KAAA,CAAA,MAAA,YAAsB,MACtB,QAAA;CAEF,MAAQ,aAAC,eAA2B,WAAQ,SAAW,MAAA,KAAA,GAAA,MAAA,OAAA,MAAA,KAAA,UAAA,KAAA,MAAA,WAAA,MAAA,SAAA,CAAA,CAAA;CACvD,MAAO,aAAA,eAAA,MAAA,QAAA,WAAA,MAAA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;AACD,aAAK,sBAAyB,UAAK,aAAiB;;KAEtD,CAAC;IAAE,gBAAiB,OAAQ,EAAA,CAAG;IAAC;;EAEpC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-alloy",
3
- "version": "0.25.68",
3
+ "version": "0.25.69",
4
4
  "type": "module",
5
5
  "description": "A package containing various Alloy framework components and helper utilities.",
6
6
  "repository": {
@@ -809,9 +809,9 @@
809
809
  "@alloy-js/json": "0.23.0-dev.2",
810
810
  "@alloy-js/markdown": "0.23.0-dev.1",
811
811
  "@alloy-js/typescript": "0.23.0-dev.4",
812
- "@powerlines/deepkit": "^0.6.160",
813
- "@powerlines/plugin-babel": "^0.12.377",
814
- "@storm-software/config-tools": "^1.189.57",
812
+ "@powerlines/deepkit": "^0.6.161",
813
+ "@powerlines/plugin-babel": "^0.12.378",
814
+ "@storm-software/config-tools": "^1.189.60",
815
815
  "@stryke/capnp": "^0.12.90",
816
816
  "@stryke/convert": "^0.6.57",
817
817
  "@stryke/fs": "^0.33.64",
@@ -823,14 +823,14 @@
823
823
  "@stryke/types": "^0.11.2",
824
824
  "@stryke/unique-id": "^0.3.75",
825
825
  "defu": "^6.1.4",
826
- "powerlines": "^0.42.22",
826
+ "powerlines": "^0.42.23",
827
827
  "prettier": "^3.8.1",
828
828
  "unctx": "^2.5.0"
829
829
  },
830
830
  "devDependencies": {
831
- "@powerlines/plugin-plugin": "^0.12.332",
831
+ "@powerlines/plugin-plugin": "^0.12.333",
832
832
  "@types/node": "^25.5.0"
833
833
  },
834
834
  "publishConfig": { "access": "public" },
835
- "gitHead": "c3781ffadfbf52a06d7684294cbcdca702689ad6"
835
+ "gitHead": "4042ae8096ab1aae106c743a39ee41047307dce3"
836
836
  }