Skip to content

Commit

Permalink
feat: include .ts extensions (throws warnings but works)
Browse files Browse the repository at this point in the history
  • Loading branch information
nebrelbug committed Jun 17, 2023
1 parent ecdfe8d commit e3ab990
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 30 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",
"tslib": "^2.5.0",
"typescript": "^4.9.5"
"typescript": "^5.1.3"
},
"husky": {
"hooks": {
Expand Down
2 changes: 1 addition & 1 deletion src/browser.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { Eta as EtaCore } from "./core.js";
import { Eta as EtaCore } from "./core.ts";

export class Eta extends EtaCore {}
6 changes: 3 additions & 3 deletions src/compile-string.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* TYPES */

import type { Options } from "./config.js";
import type { AstObject } from "./parse.js";
import type { Eta } from "./core.js";
import type { Options } from "./config.ts";
import type { AstObject } from "./parse.ts";
import type { Eta } from "./core.ts";

/* END TYPES */

Expand Down
6 changes: 3 additions & 3 deletions src/compile.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { EtaError } from "./err.js";
import { EtaError } from "./err.ts";

/* TYPES */
import type { Eta } from "./core.js";
import type { EtaConfig, Options } from "./config.js";
import type { Eta } from "./core.ts";
import type { EtaConfig, Options } from "./config.ts";

export type TemplateFunction = (this: Eta, data?: object, options?: Partial<Options>) => string;
/* END TYPES */
Expand Down
18 changes: 9 additions & 9 deletions src/core.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Cacher } from "./storage.js";
import { compile } from "./compile.js";
import { compileToString } from "./compile-string.js";
import { defaultConfig } from "./config.js";
import { parse } from "./parse.js";
import { render, renderAsync, renderString, renderStringAsync } from "./render.js";
import { RuntimeErr, EtaError } from "./err.js";
import { TemplateFunction } from "./compile.js";
import { Cacher } from "./storage.ts";
import { compile } from "./compile.ts";
import { compileToString } from "./compile-string.ts";
import { defaultConfig } from "./config.ts";
import { parse } from "./parse.ts";
import { render, renderAsync, renderString, renderStringAsync } from "./render.ts";
import { RuntimeErr, EtaError } from "./err.ts";
import { TemplateFunction } from "./compile.ts";

/* TYPES */
import type { EtaConfig, Options } from "./config.js";
import type { EtaConfig, Options } from "./config.ts";
/* END TYPES */

export class Eta {
Expand Down
6 changes: 3 additions & 3 deletions src/file-handling.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { EtaError } from "./err.js";
import { EtaError } from "./err.ts";

import * as path from "node:path";

import * as fs from "node:fs";

/* TYPES */
import type { Eta as EtaCore } from "./core.js";
import type { Options } from "./config.js";
import type { Eta as EtaCore } from "./core.ts";
import type { Options } from "./config.ts";
/* END TYPES */

export function readFile(this: EtaCore, path: string): string {
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Eta as EtaCore } from "./core.js";
import { readFile, resolvePath } from "./file-handling.js";
import { Eta as EtaCore } from "./core.ts";
import { readFile, resolvePath } from "./file-handling.ts";

export class Eta extends EtaCore {
readFile = readFile;
Expand Down
6 changes: 3 additions & 3 deletions src/parse.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ParseErr } from "./err.js";
import { trimWS } from "./utils.js";
import { ParseErr } from "./err.ts";
import { trimWS } from "./utils.ts";

/* TYPES */

import type { Eta } from "./core.js";
import type { Eta } from "./core.ts";

export type TagType = "r" | "e" | "i" | "";

Expand Down
8 changes: 4 additions & 4 deletions src/render.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { EtaError } from "./err.js";
import { EtaError } from "./err.ts";

/* TYPES */
import type { Options } from "./config.js";
import type { TemplateFunction } from "./compile.js";
import type { Eta } from "./core.js";
import type { Options } from "./config.ts";
import type { TemplateFunction } from "./compile.ts";
import type { Eta } from "./core.ts";
/* END TYPES */

function handleCache(this: Eta, template: string, options: Partial<Options>): TemplateFunction {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { EtaConfig } from "./config";
import type { EtaConfig } from "./config.ts";

/**
* Takes a string within a template and trims it, based on the preceding tag's whitespace control and `config.autoTrim`
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "NodeNext",
"allowImportingTsExtensions": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"declaration": true,
Expand Down

0 comments on commit e3ab990

Please sign in to comment.