diff --git a/deno_dist/README.md b/deno_dist/README.md index e73a23fc..a3f2ef78 100644 --- a/deno_dist/README.md +++ b/deno_dist/README.md @@ -245,6 +245,7 @@ To be added ## Projects using `eta` - [Docusaurus v2](https://v2.docusaurus.io): open-source documentation framework that uses Eta to generate a SSR build +- [swagger-typescript-api](https://github.com/acacode/swagger-typescript-api): Open source typescript api codegenerator from Swagger. Uses Eta as codegenerator by templates - [Add yours!](https://github.com/eta-dev/eta/edit/master/README.md) ## Contributors diff --git a/deno_dist/file-methods.ts b/deno_dist/file-methods.ts index 8e9ffa83..ecfecca0 100644 --- a/deno_dist/file-methods.ts +++ b/deno_dist/file-methods.ts @@ -1,4 +1,4 @@ -export * as fs from "https://deno.land/std@0.66.0/fs/mod.ts"; -export * as path from "https://deno.land/std@0.66.0/path/mod.ts"; +export { existsSync } from "https://deno.land/std@0.97.0/fs/exists.ts"; +export * as path from "https://deno.land/std@0.97.0/path/mod.ts"; export const readFileSync = Deno.readTextFileSync; diff --git a/deno_dist/file-utils.ts b/deno_dist/file-utils.ts index 0818cfea..f0015882 100644 --- a/deno_dist/file-utils.ts +++ b/deno_dist/file-utils.ts @@ -1,4 +1,4 @@ -import { fs, path, readFileSync } from "./file-methods.ts"; +import { existsSync, path, readFileSync } from "./file-methods.ts"; const _BOM = /^\uFEFF/; // express is set like: app.engine('html', require('eta').renderFile) @@ -106,7 +106,7 @@ function getPath(path: string, options: EtaConfig): string { addPathToSearched(filePath); - return fs.existsSync(filePath); + return existsSync(filePath); }) ) { // If the above returned true, we know that the filePath was just set to a path @@ -118,7 +118,7 @@ function getPath(path: string, options: EtaConfig): string { addPathToSearched(filePath); - if (fs.existsSync(filePath)) { + if (existsSync(filePath)) { return filePath; } } @@ -159,7 +159,7 @@ function getPath(path: string, options: EtaConfig): string { addPathToSearched(filePath); - if (fs.existsSync(filePath)) { + if (existsSync(filePath)) { includePath = filePath; } } diff --git a/package.json b/package.json index f919368e..dafafecd 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "size": "size-limit", "start": "rollup -c rollup.config.ts -w", "test": "jest --coverage && npm run test:deno && npm run size", - "test:deno": "deno test test/deno/*.spec.ts --allow-read", + "test:deno": "deno test test/deno/*.spec.ts --allow-read --unstable", "test:prod": "npm run lint && npm run test -- --no-cache", "test:watch": "jest --coverage --watch", "travis-deploy-once": "travis-deploy-once --pro" @@ -156,6 +156,7 @@ "travis-deploy-once": "^5.0.11", "ts-jest": "^26.3.0", "ts-node": "^9.0.0", + "tslib": "^2.2.0", "typedoc": "^0.19.1", "typescript": "^4.0.2" }, @@ -163,6 +164,5 @@ "hooks": { "pre-commit": "lint-staged" } - }, - "dependencies": {} + } } diff --git a/src/file-methods.deno.ts b/src/file-methods.deno.ts index a6e0b755..65481f43 100644 --- a/src/file-methods.deno.ts +++ b/src/file-methods.deno.ts @@ -1,4 +1,4 @@ -export { existsSync } from "https://deno.land/std@0.66.0/fs/exists.ts" -export * as path from "https://deno.land/std@0.66.0/path/mod.ts" +export { existsSync } from "https://deno.land/std@0.97.0/fs/exists.ts" +export * as path from "https://deno.land/std@0.97.0/path/mod.ts" export const readFileSync = Deno.readTextFileSync diff --git a/test/deno/basic.spec.ts b/test/deno/basic.spec.ts index ea571f1d..2427d7f6 100644 --- a/test/deno/basic.spec.ts +++ b/test/deno/basic.spec.ts @@ -1,4 +1,4 @@ -import { assertEquals } from 'https://deno.land/std@0.67.0/testing/asserts.ts' +import { assertEquals } from 'https://deno.land/std@0.97.0/testing/asserts.ts' import * as eta from '../../deno_dist/mod.ts' Deno.test('simple render', () => { diff --git a/test/deno/config.spec.ts b/test/deno/config.spec.ts index cd7100f5..a3eb16e3 100644 --- a/test/deno/config.spec.ts +++ b/test/deno/config.spec.ts @@ -1,4 +1,4 @@ -import { assertEquals } from 'https://deno.land/std@0.67.0/testing/asserts.ts' +import { assertEquals } from 'https://deno.land/std@0.97.0/testing/asserts.ts' import * as eta from '../../deno_dist/mod.ts' Deno.test('Renders a simple template with default env', () => { diff --git a/test/deno/file-helpers.spec.ts b/test/deno/file-helpers.spec.ts index 8a97f8bb..a4c93bb1 100644 --- a/test/deno/file-helpers.spec.ts +++ b/test/deno/file-helpers.spec.ts @@ -1,18 +1,18 @@ -import { assertEquals, assertThrows } from 'https://deno.land/std@0.67.0/testing/asserts.ts' -import * as path from 'https://deno.land/std@0.66.0/path/mod.ts' +import { assertEquals, assertThrows } from 'https://deno.land/std@0.97.0/testing/asserts.ts' +import * as path from 'https://deno.land/std@0.97.0/path/mod.ts' const __dirname = new URL('.', import.meta.url).pathname import { render, templates, compile } from '../../deno_dist/mod.ts' templates.define('test-template', compile('Saluton <%=it.name%>')) -Deno.test('include works', async () => { +Deno.test('include works', () => { const renderedTemplate = render('<%~ include("test-template", it) %>', { name: 'Ada' }) assertEquals(renderedTemplate, 'Saluton Ada') }) -Deno.test('includeFile works w/ filename prop', async () => { +Deno.test('includeFile works w/ filename prop', () => { const renderedTemplate = render( '<%~ includeFile("simple", it) %>', { name: 'Ada' }, @@ -22,7 +22,7 @@ Deno.test('includeFile works w/ filename prop', async () => { assertEquals(renderedTemplate, 'Hi Ada') }) -Deno.test('"E.includeFile" works with "views" array', async () => { +Deno.test('"E.includeFile" works with "views" array', () => { const renderedTemplate = render( '<%~ E.includeFile("randomtemplate", it) %>', { user: 'Ben' }, @@ -32,7 +32,7 @@ Deno.test('"E.includeFile" works with "views" array', async () => { assertEquals(renderedTemplate, 'This is a random template. Hey Ben') }) -Deno.test('"includeFile" works with "views" array', async () => { +Deno.test('"includeFile" works with "views" array', () => { const renderedTemplate = render( '<%~ includeFile("randomtemplate", it) %>', { user: 'Ben' }, @@ -42,7 +42,7 @@ Deno.test('"includeFile" works with "views" array', async () => { assertEquals(renderedTemplate, 'This is a random template. Hey Ben') }) -Deno.test('"includeFile" works with "views" string', async () => { +Deno.test('"includeFile" works with "views" string', () => { const renderedTemplate = render( '<%~ includeFile("randomtemplate", it) %>', { user: 'Ben' }, diff --git a/test/deno/helpers.spec.ts b/test/deno/helpers.spec.ts index d929822e..7801cdd6 100644 --- a/test/deno/helpers.spec.ts +++ b/test/deno/helpers.spec.ts @@ -1,4 +1,4 @@ -import { assertEquals, assertThrows } from 'https://deno.land/std@0.67.0/testing/asserts.ts' +import { assertEquals, assertThrows } from 'https://deno.land/std@0.97.0/testing/asserts.ts' import { render } from '../../deno_dist/mod.ts' // SHOULD TEST COMMON ETA USAGE PATTERNS HERE diff --git a/yarn.lock b/yarn.lock index a5bde989..25cda1a6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10373,6 +10373,11 @@ tslib@^1.8.1, tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q== +tslib@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c" + integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w== + tsutils@^3.17.1: version "3.17.1" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759"