@twin.org/nameof-vitest-plugin 0.0.1-next.11 → 0.0.1-next.13

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.
@@ -1,18 +1,14 @@
1
1
  'use strict';
2
2
 
3
+ var nameofTransformer = require('@twin.org/nameof-transformer');
4
+
5
+ // Copyright 2024 IOTA Stiftung.
6
+ // SPDX-License-Identifier: Apache-2.0.
3
7
  // eslint-disable-next-line @typescript-eslint/naming-convention
4
8
  const NameOfPlugin = {
5
9
  name: "name-of",
6
10
  enforce: "pre",
7
- transform: (code, id) => {
8
- if (typeof code === "string") {
9
- const typeRegExp = /nameof<(.*?)>\(\)/g;
10
- code = code.replace(typeRegExp, '"$1"');
11
- const paramRegExp = /nameof\((.*?)\)/g;
12
- code = code.replace(paramRegExp, '"$1"');
13
- }
14
- return code;
15
- }
11
+ transform: (code, id) => nameofTransformer.manual(code)
16
12
  };
17
13
 
18
14
  exports.NameOfPlugin = NameOfPlugin;
@@ -1,16 +1,12 @@
1
+ import { manual } from '@twin.org/nameof-transformer';
2
+
3
+ // Copyright 2024 IOTA Stiftung.
4
+ // SPDX-License-Identifier: Apache-2.0.
1
5
  // eslint-disable-next-line @typescript-eslint/naming-convention
2
6
  const NameOfPlugin = {
3
7
  name: "name-of",
4
8
  enforce: "pre",
5
- transform: (code, id) => {
6
- if (typeof code === "string") {
7
- const typeRegExp = /nameof<(.*?)>\(\)/g;
8
- code = code.replace(typeRegExp, '"$1"');
9
- const paramRegExp = /nameof\((.*?)\)/g;
10
- code = code.replace(paramRegExp, '"$1"');
11
- }
12
- return code;
13
- }
9
+ transform: (code, id) => manual(code)
14
10
  };
15
11
 
16
12
  export { NameOfPlugin };
@@ -0,0 +1 @@
1
+ export * from "./nameOfPlugin";
@@ -0,0 +1,2 @@
1
+ import type { Plugin } from "vitest/config";
2
+ export declare const NameOfPlugin: Plugin;
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/nameof-vitest-plugin - Changelog
2
2
 
3
- ## v0.0.1-next.11
3
+ ## v0.0.1-next.13
4
4
 
5
5
  - Initial Release
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/nameof-vitest-plugin",
3
- "version": "0.0.1-next.11",
3
+ "version": "0.0.1-next.13",
4
4
  "description": "A Vitest plugin which perform the nameof transformation",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,14 +14,15 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "typescript": "5.6.3"
17
+ "@twin.org/nameof-transformer": "0.0.1-next.13"
18
18
  },
19
19
  "main": "./dist/cjs/index.cjs",
20
20
  "module": "./dist/esm/index.mjs",
21
21
  "exports": {
22
22
  ".": {
23
23
  "require": "./dist/cjs/index.cjs",
24
- "import": "./dist/esm/index.mjs"
24
+ "import": "./dist/esm/index.mjs",
25
+ "types": "./dist/types/index.d.ts"
25
26
  }
26
27
  },
27
28
  "files": [