Skip to content

Commit 5059c3d

Browse files
committed
fix: produce posix path in windows
closes #5
1 parent de7d3d8 commit 5059c3d

File tree

3 files changed

+40
-39
lines changed

3 files changed

+40
-39
lines changed

package-lock.json

Lines changed: 34 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@
2929
"release": "standard-version",
3030
"test": "ttsc -p tests/tsconfig.json && node tests/core/index.js"
3131
},
32-
"dependencies": {},
32+
"dependencies": {
33+
"slash": "^2.0.0"
34+
},
3335
"devDependencies": {
3436
"@types/node": "^10.12.21",
37+
"@types/slash": "^2.0.0",
3538
"standard-version": "^4.4.0",
3639
"ttypescript": "^1.5.6",
3740
"typescript": "^3.2.4"

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as ts from "typescript";
22
import { dirname, resolve, relative } from "path";
3+
import slash = require("slash");
34

45
const transformer = <T extends ts.Node>(_: ts.Program) => {
56
return (context: ts.TransformationContext) => (rootNode: T) => {
@@ -25,7 +26,7 @@ const transformer = <T extends ts.Node>(_: ts.Program) => {
2526
const match = node.moduleSpecifier.text.match(path.regexp);
2627
if (match === null) continue;
2728
const out = path.resolve.replace(/\*/g, match[1]);
28-
const file = relative(fileDir, resolve(baseUrl, out));
29+
const file = slash(relative(fileDir, resolve(baseUrl, out)));
2930
return ts.updateImportDeclaration(
3031
node,
3132
node.decorators,

0 commit comments

Comments
 (0)