Skip to content

Commit 7a70281

Browse files
fix(sys): fix expected types for createNodeLogger and createNodeSys (#5375)
* fix(sys): fix expected types for createNodeLogger and createNodeSys * add missing function setupNodeProcess * prettier * PR feedback * prettier * Update scripts/test/validate-build.ts Co-authored-by: Ryan Waskiewicz <ryanwaskiewicz@gmail.com> * deprecated createNodeLogger function with parameter * add todo * revert changes in validate-build.ts * revert all changes in validate-build.ts * Update src/sys/node/public.ts Co-authored-by: Ryan Waskiewicz <ryanwaskiewicz@gmail.com> --------- Co-authored-by: Ryan Waskiewicz <ryanwaskiewicz@gmail.com>
1 parent b36f295 commit 7a70281

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

scripts/test/validate-build.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ async function validateCompiler(opts: BuildOptions): Promise<void> {
268268
const cli = await import(cliPath);
269269
const sysNodeApi = await import(sysNodePath);
270270

271-
const nodeLogger = sysNodeApi.createNodeLogger({ process });
271+
const nodeLogger = sysNodeApi.createNodeLogger();
272272
const nodeSys = sysNodeApi.createNodeSys({ process });
273273

274274
if (!nodeSys || nodeSys.name !== 'node' || nodeSys.version.length < 4) {

src/sys/node/public.ts

+19-3
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,35 @@ import type { CompilerSystem, Logger } from '@stencil/core/internal';
33
/**
44
* Creates a "logger", based off of NodeJS APIs, that will be used by the compiler and dev-server.
55
* The NodeJS "process" object must be provided as a property in the first argument's object.
6-
* @param c an object containing a `Process` for Stencil to use
76
* @returns a {@link Logger} object
87
*/
8+
export declare function createNodeLogger(): Logger;
9+
10+
// TODO(STENCIL-1196): Remove in Stencil v5, use `createNodeLogger` without parameters instead
11+
/**
12+
* Creates a "logger", based off of NodeJS APIs, that will be used by the compiler and dev-server.
13+
* The NodeJS "process" object must be provided as a property in the first argument's object.
14+
* @param c an object containing a `Process` for Stencil to use and a logger instanced created by {@link createNodeLogger}
15+
* @returns a {@link Logger} object
16+
* @deprecated Use {@link createNodeLogger} without parameters instead
17+
*/
918
export declare function createNodeLogger(c: { process: any }): Logger;
1019

1120
/**
1221
* Creates the "system", based off of NodeJS APIs, used by the compiler. This includes any and
1322
* all file system reads and writes using NodeJS. The compiler itself is unaware of Node's
1423
* `fs` module. Other system APIs include any use of `crypto` to hash content. The NodeJS
1524
* "process" object must be provided as a property in the first argument's object.
16-
* @param c an object containing a `Process` for Stencil to use
25+
* @param c an object containing a `Process` for Stencil to use and a logger instanced created by {@link createNodeLogger}
1726
* @returns a {@link CompilerSystem} object
1827
*/
19-
export declare function createNodeSys(c: { process: any }): CompilerSystem;
28+
export declare function createNodeSys(c: { process?: any; logger?: any }): CompilerSystem;
29+
30+
/**
31+
* Sets up the NodeJS process to be used by Stencil. This includes setting up the process's
32+
* `exit` and `uncaughtException` events to be handled by Stencil's logger.
33+
* @param c an object containing a `Process` for Stencil to use and a logger instanced created by {@link createNodeLogger}
34+
*/
35+
export declare function setupNodeProcess(c: { process: any; logger: Logger }): void;
2036

2137
export { CompilerSystem, Logger };

0 commit comments

Comments
 (0)