Skip to content

Commit

Permalink
refactor: update edge dependencies and fix breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Jul 25, 2023
1 parent 5ac30ab commit 2d798cf
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 17 deletions.
7 changes: 4 additions & 3 deletions example/index.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -20,7 +21,7 @@ class User extends Base {
lastLoginAt: null,
}

parent: User
parent!: User
get username() {
return this.attributes.username
}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions src/Edge/globals/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
/**
Expand All @@ -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))
},

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Tags/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/Tags/Each.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 1 addition & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)[]

Expand Down
2 changes: 1 addition & 1 deletion test/compiler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions test/edge.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable unicorn/no-await-expression-member */
/*
* edge
*
Expand Down

0 comments on commit 2d798cf

Please sign in to comment.