From 65372dc1a7c68eb40dbba1183e247c5184ee0b3b Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Wed, 29 Jul 2020 14:32:48 -0400 Subject: [PATCH 1/9] fix: asconfig.json on windows Currently adding an extra entry that depends on relative files breaks things on windows. --- tests/asconfig/entry-points/assembly/data.ts | 2 ++ tests/asconfig/entry-points/assembly/globalTwo.ts | 5 +++++ tests/asconfig/entry-points/assembly/globals.ts | 8 ++++++-- tests/asconfig/entry-points/nested/assembly/index.ts | 2 +- .../entry-points/node-resolution/assembly/index.ts | 2 +- .../node_modules/entry-points/asconfig.json | 2 +- .../node_modules/entry-points/assembly/globals.ts | 3 --- .../node_modules/entry-points/assembly/index.ts | 2 -- 8 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 tests/asconfig/entry-points/assembly/data.ts create mode 100644 tests/asconfig/entry-points/assembly/globalTwo.ts delete mode 100644 tests/asconfig/entry-points/node-resolution/node_modules/entry-points/assembly/globals.ts delete mode 100644 tests/asconfig/entry-points/node-resolution/node_modules/entry-points/assembly/index.ts diff --git a/tests/asconfig/entry-points/assembly/data.ts b/tests/asconfig/entry-points/assembly/data.ts new file mode 100644 index 0000000000..2a5cff7268 --- /dev/null +++ b/tests/asconfig/entry-points/assembly/data.ts @@ -0,0 +1,2 @@ + +export let forty_one = 41; \ No newline at end of file diff --git a/tests/asconfig/entry-points/assembly/globalTwo.ts b/tests/asconfig/entry-points/assembly/globalTwo.ts new file mode 100644 index 0000000000..1257bb5b36 --- /dev/null +++ b/tests/asconfig/entry-points/assembly/globalTwo.ts @@ -0,0 +1,5 @@ +// @ts-ignore +@global + const ONE = 1; + +assert(ONE); diff --git a/tests/asconfig/entry-points/assembly/globals.ts b/tests/asconfig/entry-points/assembly/globals.ts index ef2ca6b2f9..f11182fb35 100644 --- a/tests/asconfig/entry-points/assembly/globals.ts +++ b/tests/asconfig/entry-points/assembly/globals.ts @@ -1,3 +1,7 @@ +import { forty_one } from "./data"; +import "./globalTwo"; + // @ts-ignore: decorator -@global const answerToLife = 42; -assert(answerToLife); +@global function answerToLife(): i32 { return forty_one + ONE; } + +assert(answerToLife()); diff --git a/tests/asconfig/entry-points/nested/assembly/index.ts b/tests/asconfig/entry-points/nested/assembly/index.ts index 48b64eeb05..dce221e650 100644 --- a/tests/asconfig/entry-points/nested/assembly/index.ts +++ b/tests/asconfig/entry-points/nested/assembly/index.ts @@ -1 +1 @@ -assert(answerToLife == 42); +assert(answerToLife() == 42); diff --git a/tests/asconfig/entry-points/node-resolution/assembly/index.ts b/tests/asconfig/entry-points/node-resolution/assembly/index.ts index 48b64eeb05..dce221e650 100644 --- a/tests/asconfig/entry-points/node-resolution/assembly/index.ts +++ b/tests/asconfig/entry-points/node-resolution/assembly/index.ts @@ -1 +1 @@ -assert(answerToLife == 42); +assert(answerToLife() == 42); diff --git a/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/asconfig.json b/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/asconfig.json index f83851ac73..33954ea9fd 100644 --- a/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/asconfig.json +++ b/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/asconfig.json @@ -1,3 +1,3 @@ { - "entries": ["assembly/globals.ts"] + "extends": "../../../asconfig.json" } diff --git a/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/assembly/globals.ts b/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/assembly/globals.ts deleted file mode 100644 index ef2ca6b2f9..0000000000 --- a/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/assembly/globals.ts +++ /dev/null @@ -1,3 +0,0 @@ -// @ts-ignore: decorator -@global const answerToLife = 42; -assert(answerToLife); diff --git a/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/assembly/index.ts b/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/assembly/index.ts deleted file mode 100644 index 8d57706af7..0000000000 --- a/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/assembly/index.ts +++ /dev/null @@ -1,2 +0,0 @@ - -assert(answerToLife == 42); From 13c95b97eae439e11dd80f65f7573827d1f5d5b6 Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Wed, 29 Jul 2020 15:04:03 -0400 Subject: [PATCH 2/9] fix: answerToLife --- tests/asconfig/entry-points/assembly/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/asconfig/entry-points/assembly/index.ts b/tests/asconfig/entry-points/assembly/index.ts index 8d57706af7..e5249c303e 100644 --- a/tests/asconfig/entry-points/assembly/index.ts +++ b/tests/asconfig/entry-points/assembly/index.ts @@ -1,2 +1,2 @@ -assert(answerToLife == 42); +assert(answerToLife() == 42); From 0e454fcb58ccc9be476d702cae3da5cfb21f745e Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Wed, 29 Jul 2020 17:49:10 -0400 Subject: [PATCH 3/9] Print config before fail --- tests/asconfig/entry-points/node-resolution/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/asconfig/entry-points/node-resolution/package.json b/tests/asconfig/entry-points/node-resolution/package.json index 7603e9ad4d..28e770812a 100644 --- a/tests/asconfig/entry-points/node-resolution/package.json +++ b/tests/asconfig/entry-points/node-resolution/package.json @@ -1,6 +1,6 @@ { "private": true, "scripts": { - "test": "node ../../index.js" + "test": "../../../bin/asc --showConfig && node ../../index.js" } } From 28e39be84aed5a62e1ae4a0eb0f1d3649a23d1fa Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Wed, 29 Jul 2020 18:05:51 -0400 Subject: [PATCH 4/9] use node --- tests/asconfig/entry-points/node-resolution/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/asconfig/entry-points/node-resolution/package.json b/tests/asconfig/entry-points/node-resolution/package.json index 28e770812a..7d444aadcb 100644 --- a/tests/asconfig/entry-points/node-resolution/package.json +++ b/tests/asconfig/entry-points/node-resolution/package.json @@ -1,6 +1,6 @@ { "private": true, "scripts": { - "test": "../../../bin/asc --showConfig && node ../../index.js" + "test": "node ../../../../bin/asc assembly/index.ts --showConfig && node ../../index.js" } } From 5e4e3763689df928581611a6f6e3d1939a92db35 Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Wed, 29 Jul 2020 21:24:13 -0400 Subject: [PATCH 5/9] fix: try relative path for entries --- cli/asc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.js b/cli/asc.js index eba383f20c..3936ff7768 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -303,7 +303,7 @@ exports.main = function main(argv, options, callback) { // Append entries if (asconfig.entries) { for (let entry of asconfig.entries) { - argv.push(optionsUtil.resolvePath(entry, asconfigDir)); + argv.push(path.relative(baseDir, optionsUtil.resolvePath(entry, asconfigDir))); } } From 12a26daf7b9d36ba8388c855f08cebc886b046fd Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Wed, 29 Jul 2020 21:37:36 -0400 Subject: [PATCH 6/9] nit: removed print --- tests/asconfig/entry-points/node-resolution/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/asconfig/entry-points/node-resolution/package.json b/tests/asconfig/entry-points/node-resolution/package.json index 7d444aadcb..7603e9ad4d 100644 --- a/tests/asconfig/entry-points/node-resolution/package.json +++ b/tests/asconfig/entry-points/node-resolution/package.json @@ -1,6 +1,6 @@ { "private": true, "scripts": { - "test": "node ../../../../bin/asc assembly/index.ts --showConfig && node ../../index.js" + "test": "node ../../index.js" } } From 4dadadb38fd7e12540e26093694ce8fa09b975af Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Thu, 30 Jul 2020 10:50:48 -0400 Subject: [PATCH 7/9] Update cli/asc.js Co-authored-by: Daniel Wirtz --- cli/asc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.js b/cli/asc.js index 3936ff7768..eba383f20c 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -303,7 +303,7 @@ exports.main = function main(argv, options, callback) { // Append entries if (asconfig.entries) { for (let entry of asconfig.entries) { - argv.push(path.relative(baseDir, optionsUtil.resolvePath(entry, asconfigDir))); + argv.push(optionsUtil.resolvePath(entry, asconfigDir)); } } From c5a60df840af005588f38eff0f43685b34f17560 Mon Sep 17 00:00:00 2001 From: dcode Date: Thu, 30 Jul 2020 16:51:31 +0200 Subject: [PATCH 8/9] fix path sep in internal entry file path --- cli/asc.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index 3936ff7768..d8f61b3674 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -303,7 +303,7 @@ exports.main = function main(argv, options, callback) { // Append entries if (asconfig.entries) { for (let entry of asconfig.entries) { - argv.push(path.relative(baseDir, optionsUtil.resolvePath(entry, asconfigDir))); + argv.push(optionsUtil.resolvePath(entry, asconfigDir)); } } @@ -644,7 +644,7 @@ exports.main = function main(argv, options, callback) { let sourcePath = String(filename).replace(/\\/g, "/").replace(extension.re, "").replace(/[\\/]$/, ""); // Setting the path to relative path - sourcePath = path.isAbsolute(sourcePath) ? path.relative(baseDir, sourcePath) : sourcePath; + sourcePath = path.isAbsolute(sourcePath) ? path.relative(baseDir, sourcePath).replace(/\\/g, "/") : sourcePath; // Try entryPath.ext, then entryPath/index.ext let sourceText = readFile(sourcePath + extension.ext, baseDir); From de5b66cd837a5e009204f2d4bbe099933d61a1fb Mon Sep 17 00:00:00 2001 From: dcode Date: Thu, 30 Jul 2020 17:09:42 +0200 Subject: [PATCH 9/9] remove some line breaks --- tests/asconfig/entry-points/assembly/data.ts | 3 +-- tests/asconfig/entry-points/assembly/index.ts | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/asconfig/entry-points/assembly/data.ts b/tests/asconfig/entry-points/assembly/data.ts index 2a5cff7268..e036d95db7 100644 --- a/tests/asconfig/entry-points/assembly/data.ts +++ b/tests/asconfig/entry-points/assembly/data.ts @@ -1,2 +1 @@ - -export let forty_one = 41; \ No newline at end of file +export let forty_one = 41; diff --git a/tests/asconfig/entry-points/assembly/index.ts b/tests/asconfig/entry-points/assembly/index.ts index e5249c303e..dce221e650 100644 --- a/tests/asconfig/entry-points/assembly/index.ts +++ b/tests/asconfig/entry-points/assembly/index.ts @@ -1,2 +1 @@ - assert(answerToLife() == 42);