Skip to content

Commit

Permalink
add website
Browse files Browse the repository at this point in the history
  • Loading branch information
marihachi committed Jul 23, 2023
1 parent 3f6eafd commit bc2361e
Show file tree
Hide file tree
Showing 30 changed files with 15,435 additions and 6 deletions.
295 changes: 295 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"build:esm": "tsc",
"build:cjs": "npx tsc --outdir built/cjs --module CommonJS && npm run build:cjs:rename",
"build:cjs:rename": "node -e \"require('fs').renameSync('./built/cjs/index.js', './built/cjs/index.cjs')\"",
"test": "jest --verbose"
"test": "jest --verbose",
"doc": "typedoc --plugin typedoc-plugin-markdown --out temp/docs src/index.ts"
},
"exports": {
"import": "./built/index.js",
Expand All @@ -40,6 +41,8 @@
"@types/node": "20.4.2",
"jest": "29.6.1",
"ts-jest": "29.1.1",
"typedoc": "^0.24.8",
"typedoc-plugin-markdown": "^3.15.3",
"typescript": "5.1.6"
},
"files": [
Expand Down
12 changes: 7 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ export class Parser<T> {
this.name = opts.name;
}

/** internal method */
/**
* @internal
*/
_evalContext(): ParserContext<T> {
if (typeof this.ctx == 'function') {
const parser = this.ctx();
Expand Down Expand Up @@ -141,14 +143,14 @@ export class Parser<T> {
}
}

type StrictParserOpts<T> = {
export type StrictParserOpts<T> = {
handler: ParserHandler<T>,
children?: Parser<any>[],
name?: string,
lazy?: undefined,
};

type LazyParserOpts<T> = {
export type LazyParserOpts<T> = {
lazy: LazyContext<T>,
name?: string,
handler?: undefined,
Expand All @@ -165,8 +167,8 @@ export type ParserContext<T> = {
export type LazyContext<T> =
() => Parser<T>;

type ResultType<T> = T extends Parser<infer R> ? R : never;
type ResultTypes<T> = T extends [infer Head, ...infer Tail] ? [ResultType<Head>, ...ResultTypes<Tail>] : [];
export type ResultType<T> = T extends Parser<infer R> ? R : never;
export type ResultTypes<T> = T extends [infer Head, ...infer Tail] ? [ResultType<Head>, ...ResultTypes<Tail>] : [];

function wrapByTraceHandler<T>(handler: ParserHandler<T>, name?: string): ParserHandler<T> {
return (input, index, children, state) => {
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"module": "ESNext",
"moduleResolution": "Node",
"declaration": true,
"rootDir": "./src/",
"outDir": "./built/",
"skipLibCheck": true,
"removeComments": false,
Expand Down
20 changes: 20 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions website/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions website/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
8 changes: 8 additions & 0 deletions website/docs/api/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "API",
"position": 1,
"link": {
"type": "generated-index",
"description": "Terrario API Docs"
}
}
Loading

0 comments on commit bc2361e

Please sign in to comment.