-
-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update resolve compiler config
- Loading branch information
Showing
13 changed files
with
2,395 additions
and
2,200 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,20 @@ | ||
import { ResolvedUserConfig } from '../config/types.js'; | ||
import { getPluginHooks } from '../plugin/index.js'; | ||
import { Compiler } from './index.js'; | ||
|
||
export function createCompiler(resolvedUserConfig: ResolvedUserConfig) { | ||
const { | ||
jsPlugins, | ||
rustPlugins, | ||
compilation: compilationConfig, | ||
logger | ||
} = resolvedUserConfig; | ||
|
||
const compiler = new Compiler( | ||
{ | ||
config: compilationConfig, | ||
jsPlugins, | ||
rustPlugins | ||
}, | ||
logger | ||
); | ||
return compiler; | ||
} | ||
import type { | ||
ResolvedCompilation, | ||
ResolvedUserConfig | ||
} from '../config/types.js'; | ||
|
||
export async function resolveConfigureCompilerHook( | ||
compiler: Compiler, | ||
config: ResolvedUserConfig | ||
) { | ||
for (const hook of getPluginHooks(config.jsPlugins, 'configureCompiler')) { | ||
await hook?.(compiler); | ||
} | ||
export function createCompiler(resolvedUserConfig: ResolvedUserConfig) { | ||
return new Compiler(resolvedUserConfig); | ||
} | ||
|
||
export async function createInlineCompiler( | ||
export function createInlineCompiler( | ||
config: ResolvedUserConfig, | ||
options = {} | ||
options: ResolvedCompilation = {} | ||
) { | ||
const { Compiler } = await import('./index.js'); | ||
return new Compiler({ | ||
config: { ...config.compilation, ...options }, | ||
jsPlugins: config.jsPlugins, | ||
rustPlugins: config.rustPlugins | ||
...config, | ||
compilation: { ...config.compilation, ...options } | ||
}); | ||
} |
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
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
Oops, something went wrong.