Skip to content

Commit

Permalink
refactor: merge next to develop (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage authored Nov 6, 2023
1 parent 63e289a commit 2998713
Show file tree
Hide file tree
Showing 28 changed files with 471 additions and 17,415 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: checks
on:
- push
- pull_request

jobs:
test:
uses: edge-js/.github/.github/workflows/test.yml@main

lint:
uses: edge-js/.github/.github/workflows/lint.yml@main

typecheck:
uses: edge-js/.github/.github/workflows/typecheck.yml@main
39 changes: 0 additions & 39 deletions .github/workflows/test.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
message="chore(release): %s"
package-lock=false
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# edge-lexer
> Generate tokens by parsing a raw edge markup file
[![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url] [![synk-image]][synk-url]
[![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url]

Edge lexer produces a list of `tokens` by scanning for [Edge whitelisted syntax](https://github.com/edge-js/syntax).

Expand Down Expand Up @@ -42,12 +42,12 @@ Instead, this module starts by detecting for the [Edge whitelisted syntax](https

## Highlights

- Zero dependencies (Actually one dependency that is also to standardize edge errors).
- Just uses one regex statement. That also tested against [safe-regex](https://github.com/substack/safe-regex) for ReDOS
- Allows multiline expressions
- Collects line and columns for accurate stack traces.
- Detects for unclosed tags.
- Detects for unwrapped expressions and raises appropriate errors.
- Just one dependency to standardize edge errors.
- Uses only one regex statement. Tested against [safe-regex](https://github.com/substack/safe-regex) for ReDOS
- Support for multiline expressions
- Collects line and columns for accurate stack traces
- Detects for unclosed tags
- Detects for unwrapped expressions and raises appropriate errors

---

Expand Down Expand Up @@ -494,8 +494,8 @@ Following the links to documented error codes raised by the lexer.

[Harminder virk](https://github.com/sponsors/thetutlage)

[gh-workflow-image]: https://img.shields.io/github/workflow/status/edge-js/lexer/test?style=for-the-badge
[gh-workflow-url]: https://github.com/edge-js/lexer/actions/workflows/test.yml "Github action"
[gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/edge-js/lexer/checks.yml?style=for-the-badge
[gh-workflow-url]: https://github.com/edge-js/lexer/actions/workflows/checks.yml "Github action"

[npm-image]: https://img.shields.io/npm/v/edge-lexer.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/edge-lexer 'npm'
Expand All @@ -504,6 +504,3 @@ Following the links to documented error codes raised by the lexer.

[license-url]: LICENSE.md
[license-image]: https://img.shields.io/github/license/edge-js/lexer?style=for-the-badge

[synk-image]: https://img.shields.io/snyk/vulnerabilities/github/edge-js/lexer?label=Synk%20Vulnerabilities&style=for-the-badge
[synk-url]: https://snyk.io/test/github/edge-js/lexer?targetFile=package.json "synk"
11 changes: 0 additions & 11 deletions bin/japa_types.ts

This file was deleted.

14 changes: 4 additions & 10 deletions bin/test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { assert } from '@japa/assert'
import { specReporter } from '@japa/spec-reporter'
import { runFailedTests } from '@japa/run-failed-tests'
import { processCliArgs, configure, run } from '@japa/runner'
import { processCLIArgs, configure, run } from '@japa/runner'

/*
|--------------------------------------------------------------------------
Expand All @@ -16,14 +14,10 @@ import { processCliArgs, configure, run } from '@japa/runner'
|
| Please consult japa.dev/runner-config for the config docs.
*/
processCLIArgs(process.argv.slice(2))
configure({
...processCliArgs(process.argv.slice(2)),
...{
files: ['tests/**/*.spec.ts'],
plugins: [assert(), runFailedTests()],
reporters: [specReporter()],
importer: (filePath) => import(filePath),
},
files: ['tests/**/*.spec.ts'],
plugins: [assert()],
})

/*
Expand Down
6 changes: 2 additions & 4 deletions example/index.js → examples/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// @ts-check

const { Tokenizer } = require('..')
const dedent = require('dedent')
import dedent from 'dedent'
import { Tokenizer } from '../build/index.js'

const exampleCode = dedent`
{{-- Show username when exists --}}
Expand Down
5 changes: 2 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
* file that was distributed with this source code.
*/

export { Tokenizer } from './src/tokenizer'
export * as utils from './src/utils'
export * from './src/types.js'
export { Tokenizer } from './src/tokenizer.js'
export { MustacheTypes, TagTypes } from './src/enums.js'
Loading

0 comments on commit 2998713

Please sign in to comment.