From 4f00218d6d2bd6169b08e6c83cff52852e621985 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 30 May 2018 18:05:23 +0200 Subject: [PATCH] Remove extension hack in ResolveModule. --- os.go | 5 ----- os_test.go | 7 +++---- testing/testing.ts | 2 +- testing/util_test.ts | 6 +++--- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/os.go b/os.go index 877fa24ca7..23d09fc88e 100644 --- a/os.go +++ b/os.go @@ -76,11 +76,6 @@ func ResolveModule(moduleSpecifier string, containingFile string) ( containingFile = SrcFileToUrl(containingFile) moduleSpecifier = SrcFileToUrl(moduleSpecifier) - // Hack: If there is no extension, just add .ts - if path.Ext(moduleSpecifier) == "" { - moduleSpecifier = moduleSpecifier + ".ts" - } - logDebug("os.go ResolveModule after moduleSpecifier %s containingFile %s", moduleSpecifier, containingFile) diff --git a/os_test.go b/os_test.go index e04f8c820c..d1ffd3e297 100644 --- a/os_test.go +++ b/os_test.go @@ -72,9 +72,8 @@ func TestResolveModule4(t *testing.T) { path.Join(SrcDir, "unpkg.com/liltest@0.0.5/index.ts")) } -func TestResolveModule5(t *testing.T) { +func TestResolveModuleExtensionsAintSpecial(t *testing.T) { createDirs() - // Files in SrcDir should resolve to URLs. moduleName, filename, err := ResolveModule( "./util", path.Join(SrcDir, "unpkg.com/liltest@0.0.5/index.ts")) @@ -82,7 +81,7 @@ func TestResolveModule5(t *testing.T) { t.Fatalf(err.Error()) } AssertEqual(t, moduleName, - "http://unpkg.com/liltest@0.0.5/util.ts") + "http://unpkg.com/liltest@0.0.5/util") AssertEqual(t, filename, - path.Join(SrcDir, "unpkg.com/liltest@0.0.5/util.ts")) + path.Join(SrcDir, "unpkg.com/liltest@0.0.5/util")) } diff --git a/testing/testing.ts b/testing/testing.ts index 969c157048..4d7cd9c6cc 100644 --- a/testing/testing.ts +++ b/testing/testing.ts @@ -13,7 +13,7 @@ limitations under the License. */ -export { assert, assertEqual, equal } from "./util"; +export { assert, assertEqual, equal } from "./util.ts"; export type TestFunction = () => void | Promise; diff --git a/testing/util_test.ts b/testing/util_test.ts index 44f61f9c4b..34bd97e0ff 100644 --- a/testing/util_test.ts +++ b/testing/util_test.ts @@ -13,9 +13,9 @@ limitations under the License. */ -import { test } from "./index"; -import { assert } from "./util"; -import * as util from "./util"; +import { test } from "./index.ts"; +import { assert } from "./util.ts"; +import * as util from "./util.ts"; test(async function util_equal() { assert(util.equal("world", "world"));