@twin.org/nameof-transformer 0.0.1-next.9 → 0.0.2-next.10

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.
@@ -116,27 +116,16 @@ function visitNode(node) {
116
116
  * @returns The content with the transformers replace.
117
117
  */
118
118
  function manual(content) {
119
- if (content.includes("nameof")) {
119
+ if (typeof content === "string" && content.includes("nameof")) {
120
120
  // Remove the import
121
121
  content = content.replace(/import.*from "@twin\.org\/nameof";/g, "");
122
122
  // Replace the nameof<IMyObject>() with "IMyObject"
123
- const nameRegEx = /nameof<(.*?)>\(\)/g;
124
- let matchName;
125
- do {
126
- matchName = nameRegEx.exec(content);
127
- if (matchName && matchName.length === 2) {
128
- content = content.replace(matchName[0], `"${matchName[1].replace(/\?/g, "")}"`);
129
- }
130
- } while (matchName);
123
+ // or the nameof<IMyObject<IType2>>() with "IMyObject"
124
+ const nameRegEx = /nameof<(.*?)(?:<.*>)?>\(\)/g;
125
+ content = content.replace(nameRegEx, '"$1"');
131
126
  // Replace the nameof(object?.prop) with "object.prop"
132
127
  const propRegEx = /nameof\((.*?)\)/g;
133
- let matchProp;
134
- do {
135
- matchProp = propRegEx.exec(content);
136
- if (matchProp && matchProp.length === 2) {
137
- content = content.replace(matchProp[0], `"${matchProp[1].replace(/\?/g, "")}"`);
138
- }
139
- } while (matchProp);
128
+ content = content.replace(propRegEx, '"$1"');
140
129
  }
141
130
  return content;
142
131
  }
@@ -173,7 +162,7 @@ const factory = () => transformerFactory;
173
162
  * Exports the factory version.
174
163
  * @returns The factory.
175
164
  */
176
- const version = "0.0.1-next.9";
165
+ const version = "0.0.2-next.10"; // x-release-please-version
177
166
  /**
178
167
  * Exports the factory name.
179
168
  * @returns The factory.
@@ -93,27 +93,16 @@ function visitNode(node) {
93
93
  * @returns The content with the transformers replace.
94
94
  */
95
95
  function manual(content) {
96
- if (content.includes("nameof")) {
96
+ if (typeof content === "string" && content.includes("nameof")) {
97
97
  // Remove the import
98
98
  content = content.replace(/import.*from "@twin\.org\/nameof";/g, "");
99
99
  // Replace the nameof<IMyObject>() with "IMyObject"
100
- const nameRegEx = /nameof<(.*?)>\(\)/g;
101
- let matchName;
102
- do {
103
- matchName = nameRegEx.exec(content);
104
- if (matchName && matchName.length === 2) {
105
- content = content.replace(matchName[0], `"${matchName[1].replace(/\?/g, "")}"`);
106
- }
107
- } while (matchName);
100
+ // or the nameof<IMyObject<IType2>>() with "IMyObject"
101
+ const nameRegEx = /nameof<(.*?)(?:<.*>)?>\(\)/g;
102
+ content = content.replace(nameRegEx, '"$1"');
108
103
  // Replace the nameof(object?.prop) with "object.prop"
109
104
  const propRegEx = /nameof\((.*?)\)/g;
110
- let matchProp;
111
- do {
112
- matchProp = propRegEx.exec(content);
113
- if (matchProp && matchProp.length === 2) {
114
- content = content.replace(matchProp[0], `"${matchProp[1].replace(/\?/g, "")}"`);
115
- }
116
- } while (matchProp);
105
+ content = content.replace(propRegEx, '"$1"');
117
106
  }
118
107
  return content;
119
108
  }
@@ -150,7 +139,7 @@ const factory = () => transformerFactory;
150
139
  * Exports the factory version.
151
140
  * @returns The factory.
152
141
  */
153
- const version = "0.0.1-next.9";
142
+ const version = "0.0.2-next.10"; // x-release-please-version
154
143
  /**
155
144
  * Exports the factory name.
156
145
  * @returns The factory.
@@ -0,0 +1,19 @@
1
+ import type * as ts from "typescript";
2
+ /**
3
+ * Exports the factory.
4
+ * @returns The factory.
5
+ */
6
+ export declare const factory: () => ts.TransformerFactory<ts.Node>;
7
+ /**
8
+ * Exports the factory version.
9
+ * @returns The factory.
10
+ */
11
+ export declare const version = "0.0.2-next.10";
12
+ /**
13
+ * Exports the factory name.
14
+ * @returns The factory.
15
+ */
16
+ export declare const name = "@twin.org/nameof-transformer";
17
+ export * from "./manual";
18
+ export * from "./svelte";
19
+ export default factory;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Replace the transformers manually.
3
+ * @param content The content to replace the transformers in.
4
+ * @returns The content with the transformers replace.
5
+ */
6
+ export declare function manual(content: string): string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Return a function that can be used as a svelte preprocessor.
3
+ * @returns The preprocessor.
4
+ */
5
+ export declare function tsTransformersPreProcess(): {
6
+ markup: unknown;
7
+ };
@@ -0,0 +1,13 @@
1
+ import * as ts from "typescript";
2
+ /**
3
+ * The transformer factory entry point.
4
+ * @param context The context for the factory.
5
+ * @returns The transformed node.
6
+ */
7
+ export declare const transformerFactory: ts.TransformerFactory<ts.Node>;
8
+ /**
9
+ * Transform all the nodes in a context.
10
+ * @param context The context to traverse.
11
+ * @returns A transformer for the context.
12
+ */
13
+ export declare function transformer(context: ts.TransformationContext): ts.Transformer<ts.Node>;
package/docs/changelog.md CHANGED
@@ -1,5 +1,204 @@
1
1
  # @twin.org/nameof-transformer - Changelog
2
2
 
3
- ## v0.0.1-next.9
3
+ ## [0.0.2-next.10](https://github.com/twinfoundation/framework/compare/nameof-transformer-v0.0.2-next.9...nameof-transformer-v0.0.2-next.10) (2025-09-11)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **nameof-transformer:** Synchronize repo versions
9
+
10
+ ## [0.0.2-next.9](https://github.com/twinfoundation/framework/compare/nameof-transformer-v0.0.2-next.8...nameof-transformer-v0.0.2-next.9) (2025-09-08)
11
+
12
+
13
+ ### Features
14
+
15
+ * add mnemonic validation ([4b43491](https://github.com/twinfoundation/framework/commit/4b43491cf04bb626c27faea66e5c74b3971b111d))
16
+
17
+ ## [0.0.2-next.8](https://github.com/twinfoundation/framework/compare/nameof-transformer-v0.0.2-next.7...nameof-transformer-v0.0.2-next.8) (2025-09-05)
18
+
19
+
20
+ ### Features
21
+
22
+ * add Is.class method ([4988205](https://github.com/twinfoundation/framework/commit/498820543e256a130b4888c958fe1d87ca865d7f))
23
+
24
+ ## [0.0.2-next.7](https://github.com/twinfoundation/framework/compare/nameof-transformer-v0.0.2-next.6...nameof-transformer-v0.0.2-next.7) (2025-08-29)
25
+
26
+
27
+ ### Features
28
+
29
+ * eslint migration to flat config ([74427d7](https://github.com/twinfoundation/framework/commit/74427d78d342167f7850e49ab87269326355befe))
30
+
31
+ ## [0.0.2-next.6](https://github.com/twinfoundation/framework/compare/nameof-transformer-v0.0.2-next.5...nameof-transformer-v0.0.2-next.6) (2025-08-27)
32
+
33
+
34
+ ### Features
35
+
36
+ * provide module helper override ([e998a64](https://github.com/twinfoundation/framework/commit/e998a64842cfd18693a14444be33b084fef2bb90))
37
+
38
+ ## [0.0.2-next.5](https://github.com/twinfoundation/framework/compare/nameof-transformer-v0.0.2-next.4...nameof-transformer-v0.0.2-next.5) (2025-08-19)
39
+
40
+
41
+ ### Features
42
+
43
+ * use cause instead of inner for errors ([1f4acc4](https://github.com/twinfoundation/framework/commit/1f4acc4d7a6b71a134d9547da9bf40de1e1e49da))
44
+
45
+ ## [0.0.2-next.4](https://github.com/twinfoundation/framework/compare/nameof-transformer-v0.0.2-next.3...nameof-transformer-v0.0.2-next.4) (2025-08-15)
46
+
47
+
48
+ ### Features
49
+
50
+ * additional RSA methods and async ([1fceee2](https://github.com/twinfoundation/framework/commit/1fceee2d1248a24a7620846025fcf906495c07f4))
51
+
52
+ ## [0.0.2-next.3](https://github.com/twinfoundation/framework/compare/nameof-transformer-v0.0.2-next.2...nameof-transformer-v0.0.2-next.3) (2025-08-06)
53
+
54
+
55
+ ### Features
56
+
57
+ * add RSA support for public key components ([7126259](https://github.com/twinfoundation/framework/commit/7126259103b758c291e52a8a03818eb822d1aad1))
58
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
59
+ * update dependencies ([f3bd015](https://github.com/twinfoundation/framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
60
+
61
+
62
+ ### Bug Fixes
63
+
64
+ * repo urls in package.json for moved packages ([31ae463](https://github.com/twinfoundation/framework/commit/31ae463095dfa8c0e48bb5bb12316f1e8abb9a4c))
65
+
66
+ ## [0.0.2-next.2](https://github.com/twinfoundation/framework/compare/nameof-transformer-v0.0.2-next.1...nameof-transformer-v0.0.2-next.2) (2025-08-06)
67
+
68
+
69
+ ### Features
70
+
71
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
72
+ * update dependencies ([f3bd015](https://github.com/twinfoundation/framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
73
+
74
+
75
+ ### Bug Fixes
76
+
77
+ * repo urls in package.json for moved packages ([31ae463](https://github.com/twinfoundation/framework/commit/31ae463095dfa8c0e48bb5bb12316f1e8abb9a4c))
78
+
79
+ ## [0.0.2-next.1](https://github.com/twinfoundation/framework/compare/nameof-transformer-v0.0.2-next.0...nameof-transformer-v0.0.2-next.1) (2025-08-06)
80
+
81
+
82
+ ### Features
83
+
84
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
85
+ * update dependencies ([f3bd015](https://github.com/twinfoundation/framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
86
+
87
+
88
+ ### Bug Fixes
89
+
90
+ * repo urls in package.json for moved packages ([31ae463](https://github.com/twinfoundation/framework/commit/31ae463095dfa8c0e48bb5bb12316f1e8abb9a4c))
91
+
92
+ ## 0.0.1 (2025-07-03)
93
+
94
+
95
+ ### Features
96
+
97
+ * release to production ([829d53d](https://github.com/twinfoundation/framework/commit/829d53d3953b1e1b40b0243c04cfdfd3842aac7b))
98
+ * release to production ([5cf3a76](https://github.com/twinfoundation/framework/commit/5cf3a76a09eff2e6414d0cba846c7c37400a11d6))
99
+
100
+ ## [0.0.1-next.70](https://github.com/twinfoundation/framework/compare/nameof-transformer-v0.0.1-next.69...nameof-transformer-v0.0.1-next.70) (2025-07-02)
101
+
102
+
103
+ ### Features
104
+
105
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
106
+
107
+
108
+ ### Bug Fixes
109
+
110
+ * repo urls in package.json for moved packages ([31ae463](https://github.com/twinfoundation/framework/commit/31ae463095dfa8c0e48bb5bb12316f1e8abb9a4c))
111
+
112
+ ## [0.0.1-next.69](https://github.com/twinfoundation/framework/compare/nameof-transformer-v0.0.1-next.68...nameof-transformer-v0.0.1-next.69) (2025-07-02)
113
+
114
+
115
+ ### Features
116
+
117
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
118
+
119
+
120
+ ### Bug Fixes
121
+
122
+ * repo urls in package.json for moved packages ([31ae463](https://github.com/twinfoundation/framework/commit/31ae463095dfa8c0e48bb5bb12316f1e8abb9a4c))
123
+
124
+ ## [0.0.1-next.68](https://github.com/twinfoundation/framework/compare/nameof-transformer-v0.0.1-next.67...nameof-transformer-v0.0.1-next.68) (2025-07-02)
125
+
126
+
127
+ ### Features
128
+
129
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
130
+
131
+ ## [0.0.1-next.28](https://github.com/twinfoundation/tools/compare/nameof-transformer-v0.0.1-next.27...nameof-transformer-v0.0.1-next.28) (2025-06-18)
132
+
133
+
134
+ ### Miscellaneous Chores
135
+
136
+ * **nameof-transformer:** Synchronize repo versions
137
+
138
+ ## [0.0.1-next.27](https://github.com/twinfoundation/tools/compare/nameof-transformer-v0.0.1-next.26...nameof-transformer-v0.0.1-next.27) (2025-06-17)
139
+
140
+
141
+ ### Features
142
+
143
+ * add latest json schema features ([494293f](https://github.com/twinfoundation/tools/commit/494293f4252b9c7d4a20790ec157fc9d8c96c3d2))
144
+
145
+ ## [0.0.1-next.26](https://github.com/twinfoundation/tools/compare/nameof-transformer-v0.0.1-next.25...nameof-transformer-v0.0.1-next.26) (2025-06-11)
146
+
147
+
148
+ ### Features
149
+
150
+ * use most recent JSON schema specs ([4598cbf](https://github.com/twinfoundation/tools/commit/4598cbf29f7b82dba4a9f3b19f81dfe66f5a6060))
151
+
152
+ ## [0.0.1-next.25](https://github.com/twinfoundation/tools/compare/nameof-transformer-v0.0.1-next.24...nameof-transformer-v0.0.1-next.25) (2025-06-10)
153
+
154
+
155
+ ### Features
156
+
157
+ * add ts-to-schema overrides ([3c54504](https://github.com/twinfoundation/tools/commit/3c5450468eb998204a75576b7791a7ca4027da62))
158
+
159
+ ## [0.0.1-next.24](https://github.com/twinfoundation/tools/compare/nameof-transformer-v0.0.1-next.23...nameof-transformer-v0.0.1-next.24) (2025-06-05)
160
+
161
+
162
+ ### Miscellaneous Chores
163
+
164
+ * **nameof-transformer:** Synchronize repo versions
165
+
166
+ ## [0.0.1-next.23](https://github.com/twinfoundation/tools/compare/nameof-transformer-v0.0.1-next.22...nameof-transformer-v0.0.1-next.23) (2025-06-03)
167
+
168
+
169
+ ### Miscellaneous Chores
170
+
171
+ * **nameof-transformer:** Synchronize repo versions
172
+
173
+ ## [0.0.1-next.22](https://github.com/twinfoundation/tools/compare/nameof-transformer-v0.0.1-next.21...nameof-transformer-v0.0.1-next.22) (2025-06-03)
174
+
175
+
176
+ ### Miscellaneous Chores
177
+
178
+ * **nameof-transformer:** Synchronize repo versions
179
+
180
+ ## [0.0.1-next.21](https://github.com/twinfoundation/tools/compare/nameof-transformer-v0.0.1-next.20...nameof-transformer-v0.0.1-next.21) (2025-04-17)
181
+
182
+
183
+ ### Features
184
+
185
+ * use shared store mechanism ([#31](https://github.com/twinfoundation/tools/issues/31)) ([d9fe68b](https://github.com/twinfoundation/tools/commit/d9fe68b903d1268c7cb3c64772df5cb78fd63667))
186
+
187
+ ## [0.0.1-next.20](https://github.com/twinfoundation/tools/compare/nameof-transformer-v0.0.1-next.19...nameof-transformer-v0.0.1-next.20) (2025-03-28)
188
+
189
+
190
+ ### Features
191
+
192
+ * add version type ([#27](https://github.com/twinfoundation/tools/issues/27)) ([058d4b0](https://github.com/twinfoundation/tools/commit/058d4b0ba9201ea2803e59f25e741788ceb1063f))
193
+ * automation workflows ([#29](https://github.com/twinfoundation/tools/issues/29)) ([02fa98f](https://github.com/twinfoundation/tools/commit/02fa98f534d6e5fcfe59eefc2ff0e20bffd9c0f7))
194
+
195
+ ## [0.0.1-next.19](https://github.com/twinfoundation/tools/compare/nameof-transformer-v0.0.1-next.18...nameof-transformer-v0.0.1-next.19) (2025-03-26)
196
+
197
+
198
+ ### Features
199
+
200
+ * add version type ([#27](https://github.com/twinfoundation/tools/issues/27)) ([058d4b0](https://github.com/twinfoundation/tools/commit/058d4b0ba9201ea2803e59f25e741788ceb1063f))
201
+
202
+ ## v0.0.1-next.18
4
203
 
5
204
  - Initial Release
@@ -6,7 +6,9 @@ Replace the transformers manually.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **content**: `string`
9
+ ### content
10
+
11
+ `string`
10
12
 
11
13
  The content to replace the transformers in.
12
14
 
@@ -1,11 +1,5 @@
1
1
  # @twin.org/nameof-transformer
2
2
 
3
- ## References
4
-
5
- ### default
6
-
7
- Renames and re-exports [factory](functions/factory.md)
8
-
9
3
  ## Variables
10
4
 
11
5
  - [version](variables/version.md)
@@ -16,3 +10,9 @@ Renames and re-exports [factory](functions/factory.md)
16
10
  - [factory](functions/factory.md)
17
11
  - [manual](functions/manual.md)
18
12
  - [tsTransformersPreProcess](functions/tsTransformersPreProcess.md)
13
+
14
+ ## References
15
+
16
+ ### default
17
+
18
+ Renames and re-exports [factory](functions/factory.md)
@@ -3,3 +3,7 @@
3
3
  > `const` **name**: `"@twin.org/nameof-transformer"` = `"@twin.org/nameof-transformer"`
4
4
 
5
5
  Exports the factory name.
6
+
7
+ ## Returns
8
+
9
+ The factory.
@@ -1,5 +1,9 @@
1
1
  # Variable: version
2
2
 
3
- > `const` **version**: `"0.0.1-next.9"` = `"0.0.1-next.9"`
3
+ > `const` **version**: `"0.0.2-next.10"` = `"0.0.2-next.10"`
4
4
 
5
5
  Exports the factory version.
6
+
7
+ ## Returns
8
+
9
+ The factory.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@twin.org/nameof-transformer",
3
- "version": "0.0.1-next.9",
3
+ "version": "0.0.2-next.10",
4
4
  "description": "A TypeScript transformer which converts types and properties to their actual name for use at runtime",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/twinfoundation/tools.git",
7
+ "url": "git+https://github.com/twinfoundation/framework.git",
8
8
  "directory": "packages/nameof-transformer"
9
9
  },
10
10
  "author": "martyn.janes@iota.org",
@@ -14,12 +14,13 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "typescript": "5.6.2"
17
+ "typescript": "5.9.2"
18
18
  },
19
19
  "main": "./dist/cjs/index.cjs",
20
20
  "module": "./dist/esm/index.mjs",
21
21
  "exports": {
22
22
  ".": {
23
+ "types": "./dist/types/index.d.ts",
23
24
  "require": "./dist/cjs/index.cjs",
24
25
  "import": "./dist/esm/index.mjs"
25
26
  }