@twin.org/nameof-transformer 0.0.1-next.6 → 0.0.1-next.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.
@@ -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.6";
165
+ const version = "0.0.1-next.69"; // 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.6";
142
+ const version = "0.0.1-next.69"; // 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.1-next.69";
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,95 @@
1
1
  # @twin.org/nameof-transformer - Changelog
2
2
 
3
- ## v0.0.1-next.6
3
+ ## [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)
4
+
5
+
6
+ ### Features
7
+
8
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * repo urls in package.json for moved packages ([31ae463](https://github.com/twinfoundation/framework/commit/31ae463095dfa8c0e48bb5bb12316f1e8abb9a4c))
14
+
15
+ ## [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)
16
+
17
+
18
+ ### Features
19
+
20
+ * relocate core packages from tools ([bcab8f3](https://github.com/twinfoundation/framework/commit/bcab8f3160442ea4fcaf442947462504f3d6a17d))
21
+
22
+ ## [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)
23
+
24
+
25
+ ### Miscellaneous Chores
26
+
27
+ * **nameof-transformer:** Synchronize repo versions
28
+
29
+ ## [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)
30
+
31
+
32
+ ### Features
33
+
34
+ * add latest json schema features ([494293f](https://github.com/twinfoundation/tools/commit/494293f4252b9c7d4a20790ec157fc9d8c96c3d2))
35
+
36
+ ## [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)
37
+
38
+
39
+ ### Features
40
+
41
+ * use most recent JSON schema specs ([4598cbf](https://github.com/twinfoundation/tools/commit/4598cbf29f7b82dba4a9f3b19f81dfe66f5a6060))
42
+
43
+ ## [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)
44
+
45
+
46
+ ### Features
47
+
48
+ * add ts-to-schema overrides ([3c54504](https://github.com/twinfoundation/tools/commit/3c5450468eb998204a75576b7791a7ca4027da62))
49
+
50
+ ## [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)
51
+
52
+
53
+ ### Miscellaneous Chores
54
+
55
+ * **nameof-transformer:** Synchronize repo versions
56
+
57
+ ## [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)
58
+
59
+
60
+ ### Miscellaneous Chores
61
+
62
+ * **nameof-transformer:** Synchronize repo versions
63
+
64
+ ## [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)
65
+
66
+
67
+ ### Miscellaneous Chores
68
+
69
+ * **nameof-transformer:** Synchronize repo versions
70
+
71
+ ## [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)
72
+
73
+
74
+ ### Features
75
+
76
+ * use shared store mechanism ([#31](https://github.com/twinfoundation/tools/issues/31)) ([d9fe68b](https://github.com/twinfoundation/tools/commit/d9fe68b903d1268c7cb3c64772df5cb78fd63667))
77
+
78
+ ## [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)
79
+
80
+
81
+ ### Features
82
+
83
+ * add version type ([#27](https://github.com/twinfoundation/tools/issues/27)) ([058d4b0](https://github.com/twinfoundation/tools/commit/058d4b0ba9201ea2803e59f25e741788ceb1063f))
84
+ * automation workflows ([#29](https://github.com/twinfoundation/tools/issues/29)) ([02fa98f](https://github.com/twinfoundation/tools/commit/02fa98f534d6e5fcfe59eefc2ff0e20bffd9c0f7))
85
+
86
+ ## [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)
87
+
88
+
89
+ ### Features
90
+
91
+ * add version type ([#27](https://github.com/twinfoundation/tools/issues/27)) ([058d4b0](https://github.com/twinfoundation/tools/commit/058d4b0ba9201ea2803e59f25e741788ceb1063f))
92
+
93
+ ## v0.0.1-next.18
4
94
 
5
95
  - Initial Release
@@ -17,7 +17,7 @@ Modify your build script in `package.json`
17
17
  ```shell
18
18
  {
19
19
  "scripts": {
20
- "compile": "tspc"
20
+ "prepare": "ts-patch install -s"
21
21
  }
22
22
  }
23
23
  ```
@@ -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.6"` = `"0.0.1-next.6"`
3
+ > `const` **version**: `"0.0.1-next.69"` = `"0.0.1-next.69"`
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.6",
3
+ "version": "0.0.1-next.69",
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
  }