Skip to content

Commit b9ad604

Browse files
authored
feat: add package.json exports (#218)
1 parent 4ef70ab commit b9ad604

File tree

3 files changed

+31
-17
lines changed

3 files changed

+31
-17
lines changed

package.json

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,25 @@
22
"name": "typescript-transform-paths",
33
"version": "3.4.11",
44
"description": "Transforms module resolution paths using TypeScript path mapping and/or custom paths",
5-
"main": "dist/index.js",
6-
"types": "dist/index.d.ts",
5+
"type": "commonjs",
6+
"main": "./dist/index.js",
7+
"types": "types/index.d.ts",
8+
"exports": {
9+
".": {
10+
"types": "./dist/index.d.ts",
11+
"default": "./dist/index.js"
12+
},
13+
"./register": "./register.js",
14+
"./nx-transformer": "./nx-transformer.js"
15+
},
16+
"files": [
17+
"dist",
18+
"types",
19+
"README.md",
20+
"CHANGELOG.md",
21+
"register.js",
22+
"nx-transformer.js"
23+
],
724
"scripts": {
825
"compile": "tsc",
926
"build": "yarn clean && yarn compile",
@@ -42,14 +59,6 @@
4259
"Daniel Perez",
4360
"Ron S. (https://twitter.com/Ron)"
4461
],
45-
"files": [
46-
"dist",
47-
"types",
48-
"README.md",
49-
"CHANGELOG.md",
50-
"register.js",
51-
"nx-transformer.js"
52-
],
5362
"devDependencies": {
5463
"@eslint/js": "^9.8.0",
5564
"@tsconfig/node18": "^18.2.4",

test/tests/nx.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
import { execSync } from "node:child_process";
2+
import { readFileSync, rmSync } from "node:fs";
3+
import path from "node:path";
4+
15
import ts from "typescript";
6+
27
import { nxTransformerPlugin } from "typescript-transform-paths";
3-
import path from "path";
8+
import * as transformerModule from "../../dist/transformer";
9+
410
import { projectsPaths } from "../config";
5-
import { execSync } from "child_process";
6-
import { readFileSync, rmSync } from "fs";
7-
import * as transformerModule from "typescript-transform-paths/dist/transformer";
811

912
/* ****************************************************************************************************************** *
1013
* Tests

test/tests/register.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import { register } from "typescript-transform-paths";
2-
import { PluginConfig } from "ts-patch";
31
import * as tsNode from "ts-node";
4-
import * as transformerModule from "typescript-transform-paths/dist/transformer";
52
import { REGISTER_INSTANCE } from "ts-node";
3+
import { PluginConfig } from "ts-patch";
64
import { CustomTransformers, PluginImport, Program } from "typescript";
5+
6+
import { register } from "typescript-transform-paths";
7+
import * as transformerModule from "../../dist/transformer";
8+
79
import { ModuleNotFoundError } from "../utils";
810

911
/* ****************************************************************************************************************** *

0 commit comments

Comments
 (0)