From 8812f86eb5f216e9635feba3246f754b11dcc394 Mon Sep 17 00:00:00 2001 From: dcode Date: Fri, 23 Aug 2019 14:59:15 +0200 Subject: [PATCH 1/5] Fix missing shared types in assemblyscript.d.ts --- scripts/build-dts.js | 11 +++++++++++ std/assembly/shared/tsconfig.json | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 std/assembly/shared/tsconfig.json diff --git a/scripts/build-dts.js b/scripts/build-dts.js index d301245153..7f9de26678 100644 --- a/scripts/build-dts.js +++ b/scripts/build-dts.js @@ -448,3 +448,14 @@ module.exports.default({ sendMessage: console.log, stdout: stdout }); + +stdout.write("\n"); + +module.exports.default({ + project: path.resolve(__dirname, "..", "std/assembly/shared"), + prefix: "assemblyscript/std/assembly/shared", + exclude: [], + verbose: true, + sendMessage: console.log, + stdout: stdout +}); diff --git a/std/assembly/shared/tsconfig.json b/std/assembly/shared/tsconfig.json new file mode 100644 index 0000000000..6dafbedf83 --- /dev/null +++ b/std/assembly/shared/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../portable.json", + "compilerOptions": { + "outDir": "../../../out", + "allowJs": false, + "sourceMap": true + }, + "include": [ + "./**/*.ts" + ] +} From bb9570557909dc94ac7300fb31daacf1ae15e605 Mon Sep 17 00:00:00 2001 From: dcode Date: Fri, 23 Aug 2019 15:09:31 +0200 Subject: [PATCH 2/5] test --- package.json | 3 ++- src/index.ts | 2 +- tests/dts/index.ts | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 tests/dts/index.ts diff --git a/package.json b/package.json index 8360001eeb..bf073427d5 100644 --- a/package.json +++ b/package.json @@ -47,10 +47,11 @@ "check": "npm run check:config && npm run check:compiler", "check:config": "tsc --noEmit -p src --diagnostics --listFiles", "check:compiler": "tslint -c tslint.json --project src --formatters-dir lib/lint/formatters --format as", - "test": "npm run test:parser && npm run test:compiler && npm run test:packages", + "test": "npm run test:parser && npm run test:compiler && npm run test:packages && npm run test:dts", "test:parser": "node tests/parser", "test:compiler": "node tests/compiler", "test:packages": "cd tests/packages && npm run test", + "test:dts": "tsc --noEmit tests/dts/index", "make": "npm run clean && npm test && npm run build && npm test", "all": "npm run check && npm run make", "docs": "typedoc --tsconfig tsconfig-docs.json --mode modules --name \"AssemblyScript Compiler API\" --out ./docs/api --ignoreCompilerErrors --excludeNotExported --excludePrivate --excludeExternals --exclude **/std/** --includeDeclarations --readme src/README.md", diff --git a/src/index.ts b/src/index.ts index d35b2b2126..097418cbb1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -208,4 +208,4 @@ export * from "./program"; export * from "./resolver"; export * from "./tokenizer"; export * from "./types"; -export * from "./util"; +export * from "./util/index"; diff --git a/tests/dts/index.ts b/tests/dts/index.ts new file mode 100644 index 0000000000..6c4c704f2a --- /dev/null +++ b/tests/dts/index.ts @@ -0,0 +1,2 @@ +// belongs to the "test:dts" script +import "../../dist/assemblyscript"; From 85a3b2504b45a452019a6bd2065229db8dad0b57 Mon Sep 17 00:00:00 2001 From: dcode Date: Fri, 23 Aug 2019 15:12:31 +0200 Subject: [PATCH 3/5] test requires build --- package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index bf073427d5..9c583beb75 100644 --- a/package.json +++ b/package.json @@ -42,16 +42,15 @@ "scripts": { "build": "npm run build:bundle && npm run build:dts", "build:bundle": "webpack --mode production --display-modules", - "build:dts": "node scripts/build-dts", + "build:dts": "node scripts/build-dts && tsc --noEmit tests/dts/index", "clean": "node scripts/clean", "check": "npm run check:config && npm run check:compiler", "check:config": "tsc --noEmit -p src --diagnostics --listFiles", "check:compiler": "tslint -c tslint.json --project src --formatters-dir lib/lint/formatters --format as", - "test": "npm run test:parser && npm run test:compiler && npm run test:packages && npm run test:dts", + "test": "npm run test:parser && npm run test:compiler && npm run test:packages", "test:parser": "node tests/parser", "test:compiler": "node tests/compiler", "test:packages": "cd tests/packages && npm run test", - "test:dts": "tsc --noEmit tests/dts/index", "make": "npm run clean && npm test && npm run build && npm test", "all": "npm run check && npm run make", "docs": "typedoc --tsconfig tsconfig-docs.json --mode modules --name \"AssemblyScript Compiler API\" --out ./docs/api --ignoreCompilerErrors --excludeNotExported --excludePrivate --excludeExternals --exclude **/std/** --includeDeclarations --readme src/README.md", From 3edc37ada64c03ea4f87382523ac5443364128ef Mon Sep 17 00:00:00 2001 From: dcode Date: Fri, 23 Aug 2019 15:13:45 +0200 Subject: [PATCH 4/5] update comment --- tests/dts/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/dts/index.ts b/tests/dts/index.ts index 6c4c704f2a..2630056cc6 100644 --- a/tests/dts/index.ts +++ b/tests/dts/index.ts @@ -1,2 +1,2 @@ -// belongs to the "test:dts" script +// used to check dist/assemblyscript.d.ts import "../../dist/assemblyscript"; From 220199028dd3fa30ea53e5d5350a45220361173f Mon Sep 17 00:00:00 2001 From: dcode Date: Fri, 23 Aug 2019 18:47:20 +0200 Subject: [PATCH 5/5] minimal test --- tests/dts/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/dts/index.ts b/tests/dts/index.ts index 2630056cc6..1c698f6831 100644 --- a/tests/dts/index.ts +++ b/tests/dts/index.ts @@ -1,2 +1,5 @@ // used to check dist/assemblyscript.d.ts -import "../../dist/assemblyscript"; +import * as as from "../.."; + +var parser: as.Parser = as.parseFile("", "empty"); +parser.finish();