-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
InlineJavaScriptCode
and InlineTypeScriptCode
transform to …
…CommonJS and Node by default (#282) BREAKING CHANGE: The default format and platform InlineXCode classes has been changed to CommonJS and Node. If you are using these classes to create browser or ESM compatible code, please update `format` and `platform` on `props.transformOptions` to your desired values.
- Loading branch information
Showing
5 changed files
with
296 additions
and
232 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
import { BuildOptions, Platform, TransformOptions } from './esbuild-types'; | ||
|
||
export function isEsbuildError(error: unknown): boolean { | ||
return !!error | ||
&& typeof error == 'object' | ||
&& error != null | ||
&& 'errors' in error | ||
&& 'warnings' in error; | ||
} | ||
|
||
export function nodeMajorVersion(): number { | ||
return parseInt(process.versions.node.split('.')[0], 10); | ||
} | ||
|
||
export function defaultPlatformProps(options?: BuildOptions | TransformOptions): { | ||
platform?: Platform; | ||
target?: string | string[]; | ||
} { | ||
if (!options?.platform || options?.platform === 'node') { | ||
return { platform: 'node', target: 'node' + nodeMajorVersion() }; | ||
} | ||
|
||
return {}; | ||
} |
Oops, something went wrong.