@twin.org/nameof-transformer 0.0.1-next.9 → 0.0.2-next.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.
@@ -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.3"; // 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.3"; // 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.3";
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,155 @@
1
1
  # @twin.org/nameof-transformer - Changelog
2
2
 
3
- ## v0.0.1-next.9
3
+ ## [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)
4
+
5
+
6
+ ### Features
7
+
8
+ * add RSA support for public key components ([7126259](https://github.com/twinfoundation/framework/commit/7126259103b758c291e52a8a03818eb822d1aad1))
9
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
10
+ * update dependencies ([f3bd015](https://github.com/twinfoundation/framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * repo urls in package.json for moved packages ([31ae463](https://github.com/twinfoundation/framework/commit/31ae463095dfa8c0e48bb5bb12316f1e8abb9a4c))
16
+
17
+ ## [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)
18
+
19
+
20
+ ### Features
21
+
22
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
23
+ * update dependencies ([f3bd015](https://github.com/twinfoundation/framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * repo urls in package.json for moved packages ([31ae463](https://github.com/twinfoundation/framework/commit/31ae463095dfa8c0e48bb5bb12316f1e8abb9a4c))
29
+
30
+ ## [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)
31
+
32
+
33
+ ### Features
34
+
35
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
36
+ * update dependencies ([f3bd015](https://github.com/twinfoundation/framework/commit/f3bd015efd169196b7e0335f5cab876ba6ca1d75))
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * repo urls in package.json for moved packages ([31ae463](https://github.com/twinfoundation/framework/commit/31ae463095dfa8c0e48bb5bb12316f1e8abb9a4c))
42
+
43
+ ## 0.0.1 (2025-07-03)
44
+
45
+
46
+ ### Features
47
+
48
+ * release to production ([829d53d](https://github.com/twinfoundation/framework/commit/829d53d3953b1e1b40b0243c04cfdfd3842aac7b))
49
+ * release to production ([5cf3a76](https://github.com/twinfoundation/framework/commit/5cf3a76a09eff2e6414d0cba846c7c37400a11d6))
50
+
51
+ ## [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)
52
+
53
+
54
+ ### Features
55
+
56
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
57
+
58
+
59
+ ### Bug Fixes
60
+
61
+ * repo urls in package.json for moved packages ([31ae463](https://github.com/twinfoundation/framework/commit/31ae463095dfa8c0e48bb5bb12316f1e8abb9a4c))
62
+
63
+ ## [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)
64
+
65
+
66
+ ### Features
67
+
68
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
69
+
70
+
71
+ ### Bug Fixes
72
+
73
+ * repo urls in package.json for moved packages ([31ae463](https://github.com/twinfoundation/framework/commit/31ae463095dfa8c0e48bb5bb12316f1e8abb9a4c))
74
+
75
+ ## [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)
76
+
77
+
78
+ ### Features
79
+
80
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
81
+
82
+ ## [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)
83
+
84
+
85
+ ### Miscellaneous Chores
86
+
87
+ * **nameof-transformer:** Synchronize repo versions
88
+
89
+ ## [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)
90
+
91
+
92
+ ### Features
93
+
94
+ * add latest json schema features ([494293f](https://github.com/twinfoundation/tools/commit/494293f4252b9c7d4a20790ec157fc9d8c96c3d2))
95
+
96
+ ## [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)
97
+
98
+
99
+ ### Features
100
+
101
+ * use most recent JSON schema specs ([4598cbf](https://github.com/twinfoundation/tools/commit/4598cbf29f7b82dba4a9f3b19f81dfe66f5a6060))
102
+
103
+ ## [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)
104
+
105
+
106
+ ### Features
107
+
108
+ * add ts-to-schema overrides ([3c54504](https://github.com/twinfoundation/tools/commit/3c5450468eb998204a75576b7791a7ca4027da62))
109
+
110
+ ## [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)
111
+
112
+
113
+ ### Miscellaneous Chores
114
+
115
+ * **nameof-transformer:** Synchronize repo versions
116
+
117
+ ## [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)
118
+
119
+
120
+ ### Miscellaneous Chores
121
+
122
+ * **nameof-transformer:** Synchronize repo versions
123
+
124
+ ## [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)
125
+
126
+
127
+ ### Miscellaneous Chores
128
+
129
+ * **nameof-transformer:** Synchronize repo versions
130
+
131
+ ## [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)
132
+
133
+
134
+ ### Features
135
+
136
+ * use shared store mechanism ([#31](https://github.com/twinfoundation/tools/issues/31)) ([d9fe68b](https://github.com/twinfoundation/tools/commit/d9fe68b903d1268c7cb3c64772df5cb78fd63667))
137
+
138
+ ## [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)
139
+
140
+
141
+ ### Features
142
+
143
+ * add version type ([#27](https://github.com/twinfoundation/tools/issues/27)) ([058d4b0](https://github.com/twinfoundation/tools/commit/058d4b0ba9201ea2803e59f25e741788ceb1063f))
144
+ * automation workflows ([#29](https://github.com/twinfoundation/tools/issues/29)) ([02fa98f](https://github.com/twinfoundation/tools/commit/02fa98f534d6e5fcfe59eefc2ff0e20bffd9c0f7))
145
+
146
+ ## [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)
147
+
148
+
149
+ ### Features
150
+
151
+ * add version type ([#27](https://github.com/twinfoundation/tools/issues/27)) ([058d4b0](https://github.com/twinfoundation/tools/commit/058d4b0ba9201ea2803e59f25e741788ceb1063f))
152
+
153
+ ## v0.0.1-next.18
4
154
 
5
155
  - 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.3"` = `"0.0.2-next.3"`
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.3",
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.8.3"
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
  }