diff --git a/scripts/test/validate-build.ts b/scripts/test/validate-build.ts index dbb689ceece2..0605a0608886 100644 --- a/scripts/test/validate-build.ts +++ b/scripts/test/validate-build.ts @@ -268,7 +268,7 @@ async function validateCompiler(opts: BuildOptions): Promise { const cli = await import(cliPath); const sysNodeApi = await import(sysNodePath); - const nodeLogger = sysNodeApi.createNodeLogger({ process }); + const nodeLogger = sysNodeApi.createNodeLogger(); const nodeSys = sysNodeApi.createNodeSys({ process }); if (!nodeSys || nodeSys.name !== 'node' || nodeSys.version.length < 4) { diff --git a/src/sys/node/public.ts b/src/sys/node/public.ts index 069ef6621b04..fbb5b5b95a7d 100644 --- a/src/sys/node/public.ts +++ b/src/sys/node/public.ts @@ -3,9 +3,18 @@ import type { CompilerSystem, Logger } from '@stencil/core/internal'; /** * Creates a "logger", based off of NodeJS APIs, that will be used by the compiler and dev-server. * The NodeJS "process" object must be provided as a property in the first argument's object. - * @param c an object containing a `Process` for Stencil to use * @returns a {@link Logger} object */ +export declare function createNodeLogger(): Logger; + +// TODO(STENCIL-1196): Remove in Stencil v5, use `createNodeLogger` without parameters instead +/** + * Creates a "logger", based off of NodeJS APIs, that will be used by the compiler and dev-server. + * The NodeJS "process" object must be provided as a property in the first argument's object. + * @param c an object containing a `Process` for Stencil to use and a logger instanced created by {@link createNodeLogger} + * @returns a {@link Logger} object + * @deprecated Use {@link createNodeLogger} without parameters instead + */ export declare function createNodeLogger(c: { process: any }): Logger; /** @@ -13,9 +22,16 @@ export declare function createNodeLogger(c: { process: any }): Logger; * all file system reads and writes using NodeJS. The compiler itself is unaware of Node's * `fs` module. Other system APIs include any use of `crypto` to hash content. The NodeJS * "process" object must be provided as a property in the first argument's object. - * @param c an object containing a `Process` for Stencil to use + * @param c an object containing a `Process` for Stencil to use and a logger instanced created by {@link createNodeLogger} * @returns a {@link CompilerSystem} object */ -export declare function createNodeSys(c: { process: any }): CompilerSystem; +export declare function createNodeSys(c: { process?: any; logger?: any }): CompilerSystem; + +/** + * Sets up the NodeJS process to be used by Stencil. This includes setting up the process's + * `exit` and `uncaughtException` events to be handled by Stencil's logger. + * @param c an object containing a `Process` for Stencil to use and a logger instanced created by {@link createNodeLogger} + */ +export declare function setupNodeProcess(c: { process: any; logger: Logger }): void; export { CompilerSystem, Logger };