Skip to content

Commit

Permalink
Merge pull request #21 from mistlog/develop
Browse files Browse the repository at this point in the history
release 0.2.3
  • Loading branch information
mistlog committed Jul 22, 2020
2 parents bda94c4 + 0f61495 commit d2a624b
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 15 deletions.
22 changes: 11 additions & 11 deletions README.md
@@ -1,11 +1,11 @@
# TypeDraft · ![Build Status](https://github.com/mistlog/typedraft/workflows/build/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/mistlog/typedraft/badge.svg)](https://coveralls.io/github/mistlog/typedraft)

TypeDraft is a superset of typescript with built-in support for DSL extension and literate programming.

## Documentation

The document is maintained in [typedraft-docs](https://github.com/mistlog/typedraft-docs).

## License

TypeDraft is [MIT licensed](https://github.com/mistlog/typedraft/blob/master/LICENSE).
# TypeDraft · ![Build Status](https://github.com/mistlog/typedraft/workflows/build/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/mistlog/typedraft/badge.svg)](https://coveralls.io/github/mistlog/typedraft)

TypeDraft is a superset of typescript with built-in support for DSL extension and literate programming.

## Documentation

see [https://mistlog.github.io/typedraft-docs/](https://mistlog.github.io/typedraft-docs/).

## License

TypeDraft is [MIT licensed](https://github.com/mistlog/typedraft/blob/master/LICENSE).
2 changes: 1 addition & 1 deletion cli/literator.ts
Expand Up @@ -8,7 +8,7 @@ import { MakeDefaultTranscriber, IDSL, IPlugin, Transcriber } from "../src";
*/
export interface ITypeDraftConfig {
DSLs: Array<{ name: string; dsl: () => IDSL }>;
DraftPlugins: Array<IPlugin & Function>;
DraftPlugins?: Array<IPlugin & Function>;
}

export function MakeTranscriberWithConfig(code: string, config: ITypeDraftConfig) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "typedraft",
"version": "0.2.2",
"version": "0.2.3",
"description": "TypeDraft is a superset of typescript with built-in support for DSL extension and literate programming.",
"keywords": [
"literate programming",
Expand All @@ -23,7 +23,7 @@
"type": "git",
"url": "https://github.com/mistlog/typedraft"
},
"homepage": "https://github.com/mistlog/typedraft",
"homepage": "https://mistlog.github.io/typedraft-docs/",
"scripts": {
"pretest": "npm run transcribe",
"test": "jest --coverage",
Expand Down
2 changes: 1 addition & 1 deletion src/common/utility.ts
Expand Up @@ -35,7 +35,7 @@ export function ToFile(raw: string) {
const code = raw.replace(new RegExp("^<", "gm"), ";<");
return parse(code, {
sourceType: "module",
plugins: ["typescript", "jsx", "optionalChaining"],
plugins: ["typescript", "jsx", ["decorators", { decoratorsBeforeExport: true }]],
});
}

Expand Down
20 changes: 20 additions & 0 deletions test/transcriber/transcriber.test.ts
Expand Up @@ -38,3 +38,23 @@ interface IFoo {

expect(() => MakeDefaultTranscriber(code)).not.toThrow();
});

test("parse decorator", () => {
const code = `
@Injectable()
export class CoreService {}
function Injectable() {}
`;

expect(() => MakeDefaultTranscriber(code)).not.toThrow();
});

test("parse Optional Chaining & Nullish Coalescing", () => {
const code = `
let x = foo?.bar.baz();
let y = foo ?? bar();
`;

expect(() => MakeDefaultTranscriber(code)).not.toThrow();
});

0 comments on commit d2a624b

Please sign in to comment.