From 1fcfb049222f7b91e2a8e30956a880a95076a96b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kru=CC=88ger?= Date: Mon, 13 May 2019 12:53:04 -0500 Subject: [PATCH] add explicit .ts extensions to imports typescript should not enforce this hopefully https://github.com/Microsoft/TypeScript/issues/27481 will get addressed --- src/ast-helpers.ts | 6 ++++-- src/parser.ts | 6 ++++-- src/url-pattern.ts | 15 ++++++++++----- test/ast-helpers.ts | 9 ++++++--- test/errors.ts | 3 ++- test/helpers.ts | 3 ++- test/match-fixtures.ts | 3 ++- test/misc.ts | 3 ++- test/parser-combinators.ts | 3 ++- test/parser.ts | 6 ++++-- test/readme.ts | 3 ++- test/stringify-fixtures.ts | 3 ++- 12 files changed, 42 insertions(+), 21 deletions(-) diff --git a/src/ast-helpers.ts b/src/ast-helpers.ts index 96314aa..f98d6b2 100644 --- a/src/ast-helpers.ts +++ b/src/ast-helpers.ts @@ -5,11 +5,13 @@ import { Ast, -} from "./parser-combinators"; +// @ts-ignore +} from "./parser-combinators.ts"; import { escapeStringForRegex, -} from "./helpers"; +// @ts-ignore +} from "./helpers.ts"; /** * converts an array of AST nodes `nodes` representing a parsed url-pattern into diff --git a/src/parser.ts b/src/parser.ts index 335e212..91cdfa5 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -13,11 +13,13 @@ import { newRegexParser, newStringParser, Parser, -} from "./parser-combinators"; +// @ts-ignore +} from "./parser-combinators.ts"; import { IOptions, -} from "./options"; +// @ts-ignore +} from "./options.ts"; export function newEscapedCharParser(options: IOptions): Parser> { return newPickNthParser(1, newStringParser(options.escapeChar), newRegexParser(/^./)); diff --git a/src/url-pattern.ts b/src/url-pattern.ts index a457b31..2a1512a 100644 --- a/src/url-pattern.ts +++ b/src/url-pattern.ts @@ -1,26 +1,31 @@ import { indexOfDuplicateElement, regexGroupCount, -} from "./helpers"; +// @ts-ignore +} from "./helpers.ts"; import { Ast, -} from "./parser-combinators"; +// @ts-ignore +} from "./parser-combinators.ts"; import { defaultOptions, IUserInputOptions, -} from "./options"; +// @ts-ignore +} from "./options.ts"; import { newUrlPatternParser, -} from "./parser"; +// @ts-ignore +} from "./parser.ts"; import { astRootToRegexString, astToNames, stringify, -} from "./ast-helpers"; +// @ts-ignore +} from "./ast-helpers.ts"; export default class UrlPattern { public readonly isRegex: boolean; diff --git a/test/ast-helpers.ts b/test/ast-helpers.ts index a6e39a4..d510f8e 100644 --- a/test/ast-helpers.ts +++ b/test/ast-helpers.ts @@ -3,16 +3,19 @@ import * as tape from "tape"; import { newUrlPatternParser, -} from "../src/parser"; +// @ts-ignore +} from "../src/parser.ts"; import { astRootToRegexString, astToNames, -} from "../src/ast-helpers"; +// @ts-ignore +} from "../src/ast-helpers.ts"; import { defaultOptions, -} from "../src/options"; +// @ts-ignore +} from "../src/options.ts"; const parse: any = newUrlPatternParser(defaultOptions); diff --git a/test/errors.ts b/test/errors.ts index c28e990..e7f198d 100644 --- a/test/errors.ts +++ b/test/errors.ts @@ -1,7 +1,8 @@ /* tslint:disable:no-unused-expression */ import * as tape from "tape"; -import UrlPattern from "../src/url-pattern"; +// @ts-ignore +import UrlPattern from "../src/url-pattern.ts"; const UntypedUrlPattern: any = UrlPattern; diff --git a/test/helpers.ts b/test/helpers.ts index 678e914..74609c2 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -4,7 +4,8 @@ import { escapeStringForRegex, indexOfDuplicateElement, regexGroupCount, -} from "../src/helpers"; +// @ts-ignore +} from "../src/helpers.ts"; tape("escapeStringForRegex", (t: tape.Test) => { const expected = "\\[\\-\\/\\\\\\^\\$\\*\\+\\?\\.\\(\\)\\|\\[\\]\\{\\}\\]"; diff --git a/test/match-fixtures.ts b/test/match-fixtures.ts index 58f6ad8..8478810 100644 --- a/test/match-fixtures.ts +++ b/test/match-fixtures.ts @@ -3,7 +3,8 @@ // tslint:disable:max-line-length import * as tape from "tape"; -import UrlPattern from "../src/url-pattern"; +// @ts-ignore +import UrlPattern from "../src/url-pattern.ts"; tape("match", (t: tape.Test) => { let pattern = new UrlPattern("/foo"); diff --git a/test/misc.ts b/test/misc.ts index 9c2a8aa..54b4105 100644 --- a/test/misc.ts +++ b/test/misc.ts @@ -1,6 +1,7 @@ import * as tape from "tape"; -import UrlPattern from "../src/url-pattern"; +// @ts-ignore +import UrlPattern from "../src/url-pattern.ts"; tape("instance of UrlPattern is handled correctly as constructor argument", (t: tape.Test) => { const pattern = new UrlPattern("/user/:userId/task/:taskId"); diff --git a/test/parser-combinators.ts b/test/parser-combinators.ts index 03e32b5..ad7082d 100644 --- a/test/parser-combinators.ts +++ b/test/parser-combinators.ts @@ -3,7 +3,8 @@ import * as tape from "tape"; import { newRegexParser, newStringParser, -} from "../src/parser-combinators"; +// @ts-ignore +} from "../src/parser-combinators.ts"; tape("newStringParser", (t: tape.Test) => { const parse = newStringParser("foo"); diff --git a/test/parser.ts b/test/parser.ts index 5dc7f15..23359ab 100644 --- a/test/parser.ts +++ b/test/parser.ts @@ -5,11 +5,13 @@ import { newNamedWildcardParser, newStaticContentParser, newUrlPatternParser, -} from "../src/parser"; +// @ts-ignore +} from "../src/parser.ts"; import { defaultOptions, -} from "../src/options"; +// @ts-ignore +} from "../src/options.ts"; const parse = newUrlPatternParser(defaultOptions); const parseNamedSegment = newNamedSegmentParser(defaultOptions); diff --git a/test/readme.ts b/test/readme.ts index f28891e..654bde2 100644 --- a/test/readme.ts +++ b/test/readme.ts @@ -2,7 +2,8 @@ import * as tape from "tape"; -import UrlPattern from "../src/url-pattern"; +// @ts-ignore +import UrlPattern from "../src/url-pattern.ts"; tape("match a pattern against a string and extract values", (t: tape.Test) => { const pattern = new UrlPattern("/api/users(/:id)"); diff --git a/test/stringify-fixtures.ts b/test/stringify-fixtures.ts index d01252a..e794a73 100644 --- a/test/stringify-fixtures.ts +++ b/test/stringify-fixtures.ts @@ -2,7 +2,8 @@ import * as tape from "tape"; -import UrlPattern from "../src/url-pattern"; +// @ts-ignore +import UrlPattern from "../src/url-pattern.ts"; tape("stringify", (t: tape.Test) => { let pattern = new UrlPattern("/foo");