-
Notifications
You must be signed in to change notification settings - Fork 35
fix: add name
and generator
support to ISC
#1732
Conversation
⏱ Benchmark resultsComparing with 01f1c33 largeDepsEsbuild: 1.2s⬇️ 1.69% decrease vs. 01f1c33
Legend
largeDepsNft: 5.1s⬇️ 2.88% decrease vs. 01f1c33
Legend
largeDepsZisi: 9.2s⬇️ 5.76% decrease vs. 01f1c33
Legend
|
src/runtimes/node/index.ts
Outdated
@@ -151,9 +151,9 @@ const zipFunction: ZipFunction = async function ({ | |||
bundler: bundlerName, | |||
bundlerWarnings, | |||
config, | |||
displayName: config?.name, | |||
displayName: config?.name ?? staticAnalysisName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the ISC value not take precedence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both is fine. I gave precedence to the existing value, because that way it's not a breaking change for functions that have both defined right now. Happy to flip though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should try to make this consistent with other configuration properties we have. I believe generally ISC takes precedence, but it's worth double-checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, looks like we're giving ISC precedence for edge functions: https://github.com/netlify/edge-bundler/blob/0af1086fb92fa4eaa3e63709baac40df3f9ce06c/packages/edge-bundler/node/declaration.test.ts#L32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flipped precedence in 14ac467
src/runtimes/node/index.ts
Outdated
entryFilename: zipPath.entryFilename, | ||
generator: config?.generator || getInternalValue(isInternal), | ||
generator: staticAnalysisGenerator ?? config?.generator ?? getInternalValue(isInternal), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By changing ||
to ??
, you're saying that an empty string might take precedence over a non-empty value. I don't think this should be the case.
generator: staticAnalysisGenerator ?? config?.generator ?? getInternalValue(isInternal), | |
generator: staticAnalysisGenerator || config?.generator || getInternalValue(isInternal), |
src/runtimes/node/index.ts
Outdated
@@ -151,9 +151,9 @@ const zipFunction: ZipFunction = async function ({ | |||
bundler: bundlerName, | |||
bundlerWarnings, | |||
config, | |||
displayName: config?.name, | |||
displayName: staticAnalysisName ?? config?.name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as below.
displayName: staticAnalysisName ?? config?.name, | |
displayName: staticAnalysisName || config?.name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
…ip-it#1732) * feat: add support to ISC parser * feat: use parsed values * chore: remove unneeded import * chore: prettier * fix: flip precedence and extract to own test * fix: fmt * fix: switch back to logical or
Resolves https://linear.app/netlify/issue/COM-428/support-generator-and-name-in-isc-for-functions