diff --git a/example/index.ts b/example/index.ts index 110cc6c..0347728 100644 --- a/example/index.ts +++ b/example/index.ts @@ -1,8 +1,9 @@ -import edge from '../index' +import edge from '../index.js' import { join } from 'node:path' import { createServer } from 'node:http' +import { getDirname } from '@poppinss/utils' -edge.mount(join(__dirname, 'views')) +edge.mount(join(getDirname(import.meta.url), 'views')) class Base { isModel = true @@ -20,7 +21,7 @@ class User extends Base { lastLoginAt: null, } - parent: User + parent!: User get username() { return this.attributes.username } diff --git a/package.json b/package.json index c66b8b3..b0c9163 100644 --- a/package.json +++ b/package.json @@ -54,9 +54,9 @@ "@poppinss/inspect": "^1.0.1", "@poppinss/macroable": "1.0.0-7", "@poppinss/utils": "6.5.0-3", - "edge-error": "^3.0.0", - "edge-lexer": "^5.0.2", - "edge-parser": "^8.2.1", + "edge-error": "^4.0.0-0", + "edge-lexer": "^6.0.0-0", + "edge-parser": "^9.0.0-0", "he": "^1.2.0", "js-stringify": "^1.0.2", "stringify-attributes": "^2.0.0" diff --git a/src/Compiler/index.ts b/src/Compiler/index.ts index 48d7520..4bb1926 100644 --- a/src/Compiler/index.ts +++ b/src/Compiler/index.ts @@ -9,8 +9,8 @@ import { EdgeError } from 'edge-error' import { Parser, EdgeBuffer, Stack } from 'edge-parser' -import { Token, TagToken, utils as lexerUtils } from 'edge-lexer' - +import type { Token, TagToken } from 'edge-lexer/types' +import * as lexerUtils from 'edge-lexer/utils' import { Processor } from '../processor/index.js' import { CacheManager } from '../cache_manager/index.js' import type { diff --git a/src/Edge/globals/index.ts b/src/Edge/globals/index.ts index 72253c2..13c8b94 100644 --- a/src/Edge/globals/index.ts +++ b/src/Edge/globals/index.ts @@ -11,6 +11,9 @@ import { EdgeError } from 'edge-error' import stringify from 'js-stringify' import string from '@poppinss/utils/string' import { safeValue, escape } from '../../template/index.js' +// @ts-ignore untyped module +import inspect from '@poppinss/inspect' +const { string: prettyPrintHtml } = inspect export const GLOBALS = { /** @@ -28,8 +31,7 @@ export const GLOBALS = { * Inspect state */ inspect: (value: any) => { - console.log('inspect', value) - return safeValue(require('@poppinss/inspect').string.html(value)) + return safeValue(prettyPrintHtml.html(value)) }, /** diff --git a/src/Processor/index.ts b/src/Processor/index.ts index d46717f..a630dcc 100644 --- a/src/Processor/index.ts +++ b/src/Processor/index.ts @@ -7,7 +7,7 @@ * file that was distributed with this source code. */ -import { TagToken } from 'edge-lexer' +import type { TagToken } from 'edge-lexer/types' import { ProcessorContract, TemplateContract } from '../types.js' /** diff --git a/src/Tags/Component.ts b/src/Tags/Component.ts index 06b29e1..f0a309d 100644 --- a/src/Tags/Component.ts +++ b/src/Tags/Component.ts @@ -8,7 +8,8 @@ */ import { EdgeError } from 'edge-error' -import { TagToken, utils as lexerUtils } from 'edge-lexer' +import type { TagToken } from 'edge-lexer/types' +import * as lexerUtils from 'edge-lexer/utils' import { EdgeBuffer, expressions, Parser } from 'edge-parser' import { TagContract } from '../types.js' diff --git a/src/Tags/Each.ts b/src/Tags/Each.ts index f663195..ae22789 100644 --- a/src/Tags/Each.ts +++ b/src/Tags/Each.ts @@ -8,7 +8,7 @@ */ import lodash from '@poppinss/utils/lodash' -import { utils as lexerUtils } from 'edge-lexer' +import * as lexerUtils from 'edge-lexer/utils' import { Parser, expressions } from 'edge-parser' import { TagContract } from '../types.js' diff --git a/src/types.ts b/src/types.ts index 23c0152..9dcb54f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -7,7 +7,7 @@ * file that was distributed with this source code. */ -import type { Token, TagToken } from 'edge-lexer' +import type { Token, TagToken } from 'edge-lexer/types' import type Macroable from '@poppinss/macroable' import type { Parser, EdgeBuffer } from 'edge-parser' import type { ParserTagDefinitionContract, ClaimTagFn } from 'edge-parser/types' diff --git a/src/utils/index.ts b/src/utils/index.ts index 432a7cf..994be97 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -7,10 +7,9 @@ * file that was distributed with this source code. */ -import { TagToken } from 'edge-lexer' +import type { TagToken } from 'edge-lexer/types' import { EdgeError } from 'edge-error' import { expressions as expressionsList, Parser } from 'edge-parser' -import he, { EncodeOptions } from 'he' type ExpressionList = readonly (keyof typeof expressionsList)[] diff --git a/test/compiler.spec.ts b/test/compiler.spec.ts index 527269d..0c8c9e2 100644 --- a/test/compiler.spec.ts +++ b/test/compiler.spec.ts @@ -12,7 +12,7 @@ import { dirname, join } from 'node:path' import dedent from 'dedent-js' import stringify from 'js-stringify' import { Filesystem } from '@poppinss/dev-utils' -import { TagTypes, MustacheTypes } from 'edge-lexer' +import { TagTypes, MustacheTypes } from 'edge-lexer/types' import { Loader } from '../src/loader/index.js' import { setTag } from '../src/tags/set.js' diff --git a/test/edge.spec.ts b/test/edge.spec.ts index f40e174..e334020 100644 --- a/test/edge.spec.ts +++ b/test/edge.spec.ts @@ -1,3 +1,4 @@ +/* eslint-disable unicorn/no-await-expression-member */ /* * edge *