Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project reference support enhancements #1076

Merged
merged 20 commits into from
Apr 15, 2020
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d662385
Add test for package json existance
sheetalkamat Oct 3, 2019
00d40db
Show how output is different when module resolution resolves to .js/.…
sheetalkamat Apr 8, 2020
a3a39e3
Add input file of reference as dependency instead of .d.ts file
sheetalkamat Oct 3, 2019
d5474b2
Store tsbuildinfos written on solution builder host and hand it off a…
sheetalkamat Oct 7, 2019
f57b8fc
.d.ts as assets only if written
sheetalkamat Oct 7, 2019
453ce34
Make every project include just app and not other lib files
sheetalkamat Oct 7, 2019
35d283c
Fix watching for solution watched files
sheetalkamat Oct 7, 2019
cecfc8a
Dont depend on .d.ts output of the referenced project since we are de…
sheetalkamat Oct 9, 2019
cdfce32
Make sure to build all solution builder files before and track input …
sheetalkamat Apr 2, 2020
bf49856
Add all the files from composite project as dependencies as any chang…
sheetalkamat Apr 6, 2020
0561a9f
Get output from solutionBuilder for referenced files in transpileOnly…
sheetalkamat Apr 8, 2020
eb4b4fc
Read and write output files from referenced projects to disk
sheetalkamat Apr 9, 2020
61e7b3a
Test on already built
sheetalkamat Apr 9, 2020
e3bd56e
Handle written files by solution builder a bit better
sheetalkamat Apr 9, 2020
9d62b44
Fix comparison tests where the multiple compilation callbacks were no…
sheetalkamat Apr 10, 2020
6cd9347
Because comparison tests are run only on newer typescript build, buil…
sheetalkamat Apr 10, 2020
1977b89
Remove node 8 build from travis
sheetalkamat Apr 10, 2020
399b60a
Fix test baselines
sheetalkamat Apr 10, 2020
7b0ec7d
Revert multiple compilation stats per patch, has incorrect baseline t…
sheetalkamat Apr 13, 2020
43695e4
update package.json and CHANGELOG.md
johnnyreilly Apr 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert multiple compilation stats per patch, has incorrect baseline t…
…hat doesnt match actual behavior

This reverts commit 9d62b44.
sheetalkamat committed Apr 13, 2020
commit 7b0ec7d246081270ef3aaafc66714f8201cf95cc
Original file line number Diff line number Diff line change
@@ -5,18 +5,6 @@ Entrypoint main = bundle.js
[./src/error2.js] 278 bytes {main} [built] [1 error]
[./src/index.js] 207 bytes {main} [built]

ERROR in src\error2.js
./src/error2.js
[tsl] ERROR in src\error2.js(4,10)
 TS2339: Property 'bar' does not exist on type 'Class2'.

Asset Size Chunks Chunk Names
bundle.js 5.15 KiB main main
Entrypoint main = bundle.js
[./src/error1.js] 265 bytes {main}
[./src/error2.js] 278 bytes {main} [1 error]
[./src/index.js] 207 bytes {main} [built]

ERROR in src\error2.js
./src/error2.js
[tsl] ERROR in src\error2.js(4,10)
59 changes: 17 additions & 42 deletions test/comparison-tests/create-and-execute-test.js
Original file line number Diff line number Diff line change
@@ -169,38 +169,21 @@ function createWebpackConfig(paths, optionsOriginal, useWatchApi) {
}

function createWebpackWatchHandler(done, paths, testState, options, test) {
let timoutId;
let statsString;
let errString;
return function (err, stats) {
if (timoutId) {
clearTimeout(timoutId);
timoutId = undefined;
}
const patch = setPathsAndGetPatch(paths, testState, options);
const currentErrString = errToString(err, paths);
if (currentErrString) {
errString = errString ? errString + "\n\n" + currentErrString : currentErrString;
}
const currentStatsString = statsToString(stats, testState, paths);
if (currentStatsString) {
statsString = statsString ? statsString + "\n\n" + currentStatsString : currentStatsString;
}
timoutId = setTimeout(function () {
cleanHashFromOutput(stats, paths.webpackOutput);

copySync(paths.webpackOutput, paths.actualOutput);
rimraf.sync(paths.webpackOutput);
cleanHashFromOutput(stats, paths.webpackOutput);

copySync(paths.webpackOutput, paths.actualOutput);
rimraf.sync(paths.webpackOutput);

handleErrors(err, paths);

handleErrors(errString, paths);
errString = undefined;
storeStats(stats, testState, paths);

storeStats(statsString, paths);
statsString = undefined;
compareFiles(paths, test, patch);

compareFiles(paths, test, patch);
copyPatchOrEndTest(paths.testStagingPath, testState.watcher, testState, done);
}, 2000);
copyPatchOrEndTest(paths.testStagingPath, testState.watcher, testState, done);
}
}

@@ -219,35 +202,26 @@ function setPathsAndGetPatch(paths, testState, options) {
return patch;
}

function handleErrors(errString, paths) {
if (errString) {
function handleErrors(err, paths) {
if (err) {
const errFileName = 'err.txt';
fs.writeFileSync(path.join(paths.actualOutput, errFileName), errString);
}
}

function errToString(err, paths) {
if (err) {
const errString = err.toString()
.replace(new RegExp(regexEscape(paths.testStagingPath + path.sep), 'g'), '')
.replace(new RegExp(regexEscape(rootPath + path.sep), 'g'), '')
.replace(new RegExp(regexEscape(rootPath), 'g'), '')
.replace(/\.transpile/g, '');
return errString;
}
}

function storeStats(statsString, paths) {
if (statsString) {
const statsFileName = 'output.txt';
fs.writeFileSync(path.join(paths.actualOutput, statsFileName), statsString);
fs.writeFileSync(path.join(paths.actualOutput, errFileName), errString);
}
}

function statsToString(stats, testState, paths) {
function storeStats(stats, testState, paths) {
if (stats && stats.hash !== testState.lastHash) {
testState.lastHash = stats.hash;

const statsFileName = 'output.txt';

// do a little magic to normalize `\` to `/` for asset output
const newAssets = {};
Object.keys(stats.compilation.assets).forEach(function (asset) {
@@ -262,7 +236,8 @@ function statsToString(stats, testState, paths) {
.replace(new RegExp(regexEscape(rootPath), 'g'), '')
.replace(new RegExp(regexEscape(rootPathWithIncorrectWindowsSeparator), 'g'), '')
.replace(/\.transpile/g, '');
return statsString;

fs.writeFileSync(path.join(paths.actualOutput, statsFileName), statsString);
}
}

Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ eval("\nexports.__esModule = true;\nvar lib_1 = __webpack_require__(/*! ./lib */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
eval("\nexports.__esModule = true;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3,\n four: 4 // Add new number\n};\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack:///./lib/out/index.js?");
eval("\nexports.__esModule = true;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3\n};\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack:///./lib/out/index.js?");

/***/ })

Original file line number Diff line number Diff line change
@@ -6,10 +6,4 @@
../lib/out/tsconfig.tsbuildinfo 70 KiB [emitted]
Entrypoint main = bundle.js
[./app.ts] 131 bytes {main} [built]
[./lib/out/index.js] 130 bytes {main}

Asset Size Chunks Chunk Names
bundle.js 4.37 KiB main [emitted] main
Entrypoint main = bundle.js
[./app.ts] 131 bytes {main}
[./lib/out/index.js] 161 bytes {main} [built]
[./lib/out/index.js] 130 bytes {main}
Original file line number Diff line number Diff line change
@@ -2,4 +2,4 @@
bundle.js 4.4 KiB main [emitted] main
Entrypoint main = bundle.js
[./app.ts] 169 bytes {main} [built]
[./lib/out/index.js] 161 bytes {main}
[./lib/out/index.js] 161 bytes {main} [built]
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ eval("\nexports.__esModule = true;\nvar lib_1 = __webpack_require__(/*! ./lib */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
eval("\nexports.__esModule = true;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3,\n four: 4,\n five: 5\n};\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack:///./lib/out/index.js?");
eval("\nexports.__esModule = true;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3,\n four: 4 // Add new number\n};\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack:///./lib/out/index.js?");

/***/ })

Original file line number Diff line number Diff line change
@@ -6,10 +6,4 @@
../lib/out/tsconfig.tsbuildinfo 70 KiB [emitted]
Entrypoint main = bundle.js
[./app.ts] 169 bytes {main} [built]
[./lib/out/index.js] 161 bytes {main}

Asset Size Chunks Chunk Names
bundle.js 4.4 KiB main [emitted] main
Entrypoint main = bundle.js
[./app.ts] 169 bytes {main}
[./lib/out/index.js] 156 bytes {main} [built]
[./lib/out/index.js] 161 bytes {main}
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
bundle.js 4.42 KiB main [emitted] main
Entrypoint main = bundle.js
[./app.ts] 186 bytes {main} [built] [1 error]
[./lib/out/index.js] 156 bytes {main}
[./lib/out/index.js] 156 bytes {main} [built]

ERROR in app.ts
./app.ts

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -2,4 +2,4 @@
bundle.js 4.44 KiB main [emitted] main
Entrypoint main = bundle.js
[./app.ts] 205 bytes {main} [built]
[./lib/out/index.js] 161 bytes {main}
[./lib/out/index.js] 161 bytes {main} [built]
Loading