-
-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use custom transformer when building solution references (#1550)
* Refactor getting custom transformer into a dedicated function This allows us to share the function between `initializeInstance` and `makeSolutionBuilderHost`. `makeSolutionBuilderHost` is called as a part of `buildSolutionReferences`. `buildSolutionReferences` is called before `initializeInstance` where the custom transformers are initialized. * Implement `getCustomTransformer` in `makeSolutionBuilderHost` This allows us to pass on the custom transformer while the project references are built. * Remove redundant `.toString` `options.configFilePath` is always a string, there's no reason we need `toString()` too. * Runtime check that project is a string In a previous commit, I removed `.toString()` without validating what the Typescript compiler would say. This change does a runtime check that the project variable is an actual string. * Update `CHANGELOG.md` and `package.json` Co-authored-by: John Reilly <johnny_reilly@hotmail.com>
- Loading branch information
1 parent
87a9fff
commit 5e7220b
Showing
26 changed files
with
335 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/comparison-tests/projectReferencesWithCustomTransformer/app.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { lib } from './lib'; | ||
|
||
console.log(lib.one, lib.two, lib.three); |
67 changes: 67 additions & 0 deletions
67
test/comparison-tests/projectReferencesWithCustomTransformer/expectedOutput-4.9/bundle.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). | ||
* This devtool is neither made for production nor for readable output files. | ||
* It uses "eval()" calls to create a separate source file in the browser devtools. | ||
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) | ||
* or disable the default devtool with "devtool: false". | ||
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). | ||
*/ | ||
/******/ (() => { // webpackBootstrap | ||
/******/ "use strict"; | ||
/******/ var __webpack_modules__ = ({ | ||
|
||
/***/ "./app.ts": | ||
/*!****************!*\ | ||
!*** ./app.ts ***! | ||
\****************/ | ||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => { | ||
|
||
eval("\nexports.__esModule = true;\nvar lib_1 = __webpack_require__(/*! ./lib */ \"./lib/index.ts\");\n/*transform was here*/ console.log(lib_1.lib.one, lib_1.lib.two, lib_1.lib.three);\n\n\n//# sourceURL=webpack:///./app.ts?"); | ||
|
||
/***/ }), | ||
|
||
/***/ "./lib/index.ts": | ||
/*!**********************!*\ | ||
!*** ./lib/index.ts ***! | ||
\**********************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
|
||
eval("\nexports.__esModule = true;\nexports.lib = void 0;\n/*transform was here*/ exports.lib = {\n one: 1,\n two: 2,\n three: 3\n};\n\n\n//# sourceURL=webpack:///./lib/index.ts?"); | ||
|
||
/***/ }) | ||
|
||
/******/ }); | ||
/************************************************************************/ | ||
/******/ // The module cache | ||
/******/ var __webpack_module_cache__ = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ // Check if module is in cache | ||
/******/ var cachedModule = __webpack_module_cache__[moduleId]; | ||
/******/ if (cachedModule !== undefined) { | ||
/******/ return cachedModule.exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = __webpack_module_cache__[moduleId] = { | ||
/******/ // no module.id needed | ||
/******/ // no module.loaded needed | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/************************************************************************/ | ||
/******/ | ||
/******/ // startup | ||
/******/ // Load entry module and return exports | ||
/******/ // This entry module can't be inlined because the eval devtool is used. | ||
/******/ var __webpack_exports__ = __webpack_require__("./app.ts"); | ||
/******/ | ||
/******/ })() | ||
; |
5 changes: 5 additions & 0 deletions
5
...comparison-tests/projectReferencesWithCustomTransformer/expectedOutput-4.9/lib/index.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export declare const lib: { | ||
one: number; | ||
two: number; | ||
three: number; | ||
}; |
9 changes: 9 additions & 0 deletions
9
test/comparison-tests/projectReferencesWithCustomTransformer/expectedOutput-4.9/lib/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...mparison-tests/projectReferencesWithCustomTransformer/expectedOutput-4.9/lib/index.js.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...-tests/projectReferencesWithCustomTransformer/expectedOutput-4.9/lib/tsconfig.tsbuildinfo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.d.ts","../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/typescript/lib/lib.scripthost.d.ts","./index.ts"],"fileInfos":["2dc8c927c9c162a773c6bb3cdc4f3286c23f10eedc67414028f9cb5951610f60",{"version":"8730f4bf322026ff5229336391a18bcaa1f94d4f82416c8b2f3954e2ccaae2ba","affectsGlobalScope":true},{"version":"3aafcb693fe5b5c3bd277bd4c3a617b53db474fe498fc5df067c5603b1eebde7","affectsGlobalScope":true},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true},"28ead8445f54a115ea5f778da4f4f80579fbae42ac6ccc3493626084ed335839"],"options":{"composite":true,"newLine":1,"skipLibCheck":true,"sourceMap":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[6,1,3,2,5,4],"emitSignatures":[[6,"82b9c263edd140802d0afbd57d557b2c41db16c5ad9a744bca8c71ad5b10f66f"]],"latestChangedDtsFile":"./index.d.ts"},"version":"4.9.3"} |
8 changes: 8 additions & 0 deletions
8
test/comparison-tests/projectReferencesWithCustomTransformer/expectedOutput-4.9/output.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
asset bundle.js 2.6 KiB [emitted] (name: main) | ||
asset lib/tsconfig.tsbuildinfo 1.17 KiB [compared for emit] | ||
asset lib/index.js.map 188 bytes [compared for emit] | ||
asset lib/index.js 152 bytes [compared for emit] | ||
asset lib/index.d.ts 84 bytes [compared for emit] | ||
./app.ts 131 bytes [built] [code generated] | ||
./lib/index.ts 119 bytes [built] [code generated] | ||
webpack compiled successfully |
67 changes: 67 additions & 0 deletions
67
...rison-tests/projectReferencesWithCustomTransformer/expectedOutput-transpile-4.9/bundle.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). | ||
* This devtool is neither made for production nor for readable output files. | ||
* It uses "eval()" calls to create a separate source file in the browser devtools. | ||
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) | ||
* or disable the default devtool with "devtool: false". | ||
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). | ||
*/ | ||
/******/ (() => { // webpackBootstrap | ||
/******/ "use strict"; | ||
/******/ var __webpack_modules__ = ({ | ||
|
||
/***/ "./app.ts": | ||
/*!****************!*\ | ||
!*** ./app.ts ***! | ||
\****************/ | ||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => { | ||
|
||
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar lib_1 = __webpack_require__(/*! ./lib */ \"./lib/index.ts\");\n/*transform was here*/ console.log(lib_1.lib.one, lib_1.lib.two, lib_1.lib.three);\n\n\n//# sourceURL=webpack:///./app.ts?"); | ||
|
||
/***/ }), | ||
|
||
/***/ "./lib/index.ts": | ||
/*!**********************!*\ | ||
!*** ./lib/index.ts ***! | ||
\**********************/ | ||
/***/ ((__unused_webpack_module, exports) => { | ||
|
||
eval("\nexports.__esModule = true;\nexports.lib = void 0;\n/*transform was here*/ exports.lib = {\n one: 1,\n two: 2,\n three: 3\n};\n\n\n//# sourceURL=webpack:///./lib/index.ts?"); | ||
|
||
/***/ }) | ||
|
||
/******/ }); | ||
/************************************************************************/ | ||
/******/ // The module cache | ||
/******/ var __webpack_module_cache__ = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ // Check if module is in cache | ||
/******/ var cachedModule = __webpack_module_cache__[moduleId]; | ||
/******/ if (cachedModule !== undefined) { | ||
/******/ return cachedModule.exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = __webpack_module_cache__[moduleId] = { | ||
/******/ // no module.id needed | ||
/******/ // no module.loaded needed | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/************************************************************************/ | ||
/******/ | ||
/******/ // startup | ||
/******/ // Load entry module and return exports | ||
/******/ // This entry module can't be inlined because the eval devtool is used. | ||
/******/ var __webpack_exports__ = __webpack_require__("./app.ts"); | ||
/******/ | ||
/******/ })() | ||
; |
5 changes: 5 additions & 0 deletions
5
...-tests/projectReferencesWithCustomTransformer/expectedOutput-transpile-4.9/lib/index.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export declare const lib: { | ||
one: number; | ||
two: number; | ||
three: number; | ||
}; |
9 changes: 9 additions & 0 deletions
9
...on-tests/projectReferencesWithCustomTransformer/expectedOutput-transpile-4.9/lib/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...ests/projectReferencesWithCustomTransformer/expectedOutput-transpile-4.9/lib/index.js.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...jectReferencesWithCustomTransformer/expectedOutput-transpile-4.9/lib/tsconfig.tsbuildinfo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.d.ts","../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/typescript/lib/lib.scripthost.d.ts","./index.ts"],"fileInfos":["2dc8c927c9c162a773c6bb3cdc4f3286c23f10eedc67414028f9cb5951610f60",{"version":"8730f4bf322026ff5229336391a18bcaa1f94d4f82416c8b2f3954e2ccaae2ba","affectsGlobalScope":true},{"version":"3aafcb693fe5b5c3bd277bd4c3a617b53db474fe498fc5df067c5603b1eebde7","affectsGlobalScope":true},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true},"28ead8445f54a115ea5f778da4f4f80579fbae42ac6ccc3493626084ed335839"],"options":{"composite":true,"newLine":1,"skipLibCheck":true,"sourceMap":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[6,1,3,2,5,4],"emitSignatures":[[6,"82b9c263edd140802d0afbd57d557b2c41db16c5ad9a744bca8c71ad5b10f66f"]],"latestChangedDtsFile":"./index.d.ts"},"version":"4.9.3"} |
8 changes: 8 additions & 0 deletions
8
...ison-tests/projectReferencesWithCustomTransformer/expectedOutput-transpile-4.9/output.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
asset bundle.js 2.64 KiB [emitted] (name: main) | ||
asset lib/tsconfig.tsbuildinfo 1.17 KiB [compared for emit] | ||
asset lib/index.js.map 188 bytes [compared for emit] | ||
asset lib/index.js 152 bytes [compared for emit] | ||
asset lib/index.d.ts 84 bytes [compared for emit] | ||
./app.ts 167 bytes [built] [code generated] | ||
./lib/index.ts 119 bytes [built] [code generated] | ||
webpack compiled successfully |
1 change: 1 addition & 0 deletions
1
test/comparison-tests/projectReferencesWithCustomTransformer/lib/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!*.js.map |
5 changes: 5 additions & 0 deletions
5
test/comparison-tests/projectReferencesWithCustomTransformer/lib/index.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export declare const lib: { | ||
one: number; | ||
two: number; | ||
three: number; | ||
}; |
9 changes: 9 additions & 0 deletions
9
test/comparison-tests/projectReferencesWithCustomTransformer/lib/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
test/comparison-tests/projectReferencesWithCustomTransformer/lib/index.js.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.