@@ -49,8 +49,16 @@ const getUsedEngine = function (serverModuleContents) {
49
49
}
50
50
51
51
/**
52
- * TODO: document what's happening here and update types
53
- * @param {string } angularJson
52
+ * For Angular@19+ we inspect user's server.ts and if it uses express, we swap it out with our own.
53
+ * We also check wether CommonEngine or AppEngine is used to provide correct replacement preserving
54
+ * engine of user's choice (CommonEngine is stable, but lacks support for some features, AppEngine is
55
+ * Developer Preview, but has more features and is easier to integrate with - ultimately choice is up to user
56
+ * as AppEngine might have breaking changes outside of major version bumps)
57
+ * @param {Object } obj
58
+ * @param {string } obj.angularVersion Angular version
59
+ * @param {string } obj.siteRoot Root directory of an app
60
+ * @param {(msg: string) => never } obj.failPlugin Function to fail the plugin
61
+ *
54
62
* @returns {'AppEngine' | 'CommonEngine' | undefined }
55
63
*/
56
64
const fixServerTs = async function ( { angularVersion, siteRoot, failPlugin } ) {
@@ -78,10 +86,6 @@ const fixServerTs = async function ({ angularVersion, siteRoot, failPlugin }) {
78
86
const usedEngine = getUsedEngine ( serverModuleContents ) ?? 'CommonEngine'
79
87
80
88
// if server module uses express - it means we can't use it and instead we need to provide our own
81
- // alternatively we could just compare content (or hash of it) to "known" content of server.ts file
82
- // that users get when they scaffold new project and only swap if it's known content and fail with
83
- // actionable message so users know how to adjust their server.ts file to work on Netlify
84
- // with engine they opted to use
85
89
needSwapping = serverModuleContents . includes ( 'express' )
86
90
87
91
if ( needSwapping ) {
0 commit comments