Skip to content

Commit 7a1aef3

Browse files
authored
feat: add electron/utility module for utility process (#246)
* chore: update @electron/docs-parser to 1.2.0 Includes changes from electron/docs-parser#95 to add utility process. * feat: add electron/utility module for utility process
1 parent 58fa2eb commit 7a1aef3

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

base/base_footer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,24 @@ declare module 'electron/renderer' {
1414
export = Electron.Renderer;
1515
}
1616

17+
declare module 'electron/utility' {
18+
export = Electron.Utility;
19+
}
20+
1721
interface NodeRequireFunction {
1822
(moduleName: 'electron'): typeof Electron.CrossProcessExports;
1923
(moduleName: 'electron/main'): typeof Electron.Main;
2024
(moduleName: 'electron/common'): typeof Electron.Common;
2125
(moduleName: 'electron/renderer'): typeof Electron.Renderer;
26+
(moduleName: 'electron/utility'): typeof Electron.Utility;
2227
}
2328

2429
interface NodeRequire {
2530
(moduleName: 'electron'): typeof Electron.CrossProcessExports;
2631
(moduleName: 'electron/main'): typeof Electron.Main;
2732
(moduleName: 'electron/common'): typeof Electron.Common;
2833
(moduleName: 'electron/renderer'): typeof Electron.Renderer;
34+
(moduleName: 'electron/utility'): typeof Electron.Utility;
2935
}
3036

3137
interface File {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"license": "MIT",
2222
"devDependencies": {
2323
"@continuous-auth/semantic-release-npm": "^3.0.0",
24-
"@electron/docs-parser": "^1.1.0",
24+
"@electron/docs-parser": "^1.2.0",
2525
"@types/debug": "^4.1.4",
2626
"@types/fs-extra": "^5.0.5",
2727
"@types/lodash": "^4.14.123",

src/primary-interfaces.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const generatePrimaryInterfaces = (
1313
const CommonNamespace = ['namespace Common {', eventExport];
1414
const MainNamespace = ['namespace Main {', eventExport];
1515
const RendererNamespace = ['namespace Renderer {', eventExport];
16+
const UtilityNamespace = ['namespace Utility {', eventExport];
1617
const MainInterfaceForRemote = ['interface RemoteMainInterface {'];
1718
const CrossProcessExportsNamespace = ['namespace CrossProcessExports {', eventExport];
1819
const constDeclarations: string[] = [];
@@ -102,16 +103,18 @@ export const generatePrimaryInterfaces = (
102103
}
103104
if (TargetNamespace) {
104105
debug(classify(module.name).toLowerCase(), EMRI[classify(module.name).toLowerCase()]);
105-
if (!EMRI[classify(module.name).toLowerCase()]) {
106-
if (moduleString) TargetNamespace.push(moduleString);
107-
if (moduleString) CrossProcessExportsNamespace.push(moduleString);
106+
if (!EMRI[classify(module.name).toLowerCase()] && moduleString) {
107+
TargetNamespace.push(moduleString);
108+
CrossProcessExportsNamespace.push(moduleString);
109+
if (module.process.utility) UtilityNamespace.push(moduleString);
108110
}
109111
EMRI[classify(module.name).toLowerCase()] = true;
110112
const declarations = [...newConstDeclarations, ...newTypeAliases].map(
111113
s => ` ${s.substr(0, s.length - 1)}`,
112114
);
113115
TargetNamespace.push(...declarations);
114116
CrossProcessExportsNamespace.push(...declarations);
117+
if (module.process.utility) UtilityNamespace.push(...declarations);
115118
}
116119
});
117120

@@ -122,12 +125,14 @@ export const generatePrimaryInterfaces = (
122125
CommonNamespace.push(alias);
123126
MainNamespace.push(alias);
124127
RendererNamespace.push(alias);
128+
UtilityNamespace.push(alias);
125129
CrossProcessExportsNamespace.push(alias);
126130
}
127131

128132
CommonNamespace.push('}');
129133
MainNamespace.push('}');
130134
RendererNamespace.push('}');
135+
UtilityNamespace.push('}');
131136
CrossProcessExportsNamespace.push('}');
132137

133138
const withSemicolons = (lines: string[]) => {
@@ -137,6 +142,7 @@ export const generatePrimaryInterfaces = (
137142
addToOutput(withSemicolons(CommonNamespace));
138143
addToOutput(withSemicolons(MainNamespace));
139144
addToOutput(withSemicolons(RendererNamespace));
145+
addToOutput(withSemicolons(UtilityNamespace));
140146
addToOutput(withSemicolons(CrossProcessExportsNamespace));
141147
addToOutput(constDeclarations);
142148
};

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
semver "^7.1.2"
3535
tempy "^1.0.0"
3636

37-
"@electron/docs-parser@^1.1.0":
38-
version "1.1.0"
39-
resolved "https://registry.yarnpkg.com/@electron/docs-parser/-/docs-parser-1.1.0.tgz#ba095def41746bde56bee731feaf22272bf0b765"
40-
integrity sha512-qrjIKJk8t4/xAYldDVNQgcF8zdAAuG260bzPxdh/xI3p/yddm61bftoct+Tx2crnWFnOfOkr6nGERsDknNiT8A==
37+
"@electron/docs-parser@^1.2.0":
38+
version "1.2.0"
39+
resolved "https://registry.yarnpkg.com/@electron/docs-parser/-/docs-parser-1.2.0.tgz#dc3032012dd270c667777e097e185d92e7ff86ef"
40+
integrity sha512-Rz/lMLRDSvEshYNmSC30v/3rk7Mj6EL/76wraKvfM5XvYPHsmApo9CedvcJNNMm7+Rc29NOohoqA4B2/XtFm1Q==
4141
dependencies:
4242
"@types/markdown-it" "^12.0.0"
4343
chai "^4.2.0"

0 commit comments

Comments
 (0)