Skip to content

Commit 622bc7f

Browse files
authored
Merge branch 'master' into jason-crow-fix-register-namespace-errors
2 parents 474994d + 0fc4cb3 commit 622bc7f

42 files changed

Lines changed: 355 additions & 48 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "Expose Certa backend callback helpers through a public callbacks entry point.",
5+
"type": "none",
6+
"packageName": "@itwin/certa"
7+
}
8+
],
9+
"packageName": "@itwin/certa"
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "Add conditional renderer and CommonJS main-process entry points.",
5+
"type": "none",
6+
"packageName": "@itwin/core-electron"
7+
}
8+
],
9+
"packageName": "@itwin/core-electron"
10+
}

core/electron/.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
!lib/**/*.d.ts.map
77
!lib/**/*.js
88
!lib/**/*.js.map
9+
!lib/**/package.json
910

1011
lib/**/test/**

core/electron/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Copyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md
66

77
The __@itwin/core-electron__ package contains the electron utilities to write an iTwin.js application based on Electron.
88

9+
## Process-specific entry points
10+
11+
Import the renderer API from `@itwin/core-electron/renderer` and the main-process API from `@itwin/core-electron/main`. The renderer entry resolves to the ESM build for `import` and to CommonJS for `require`; its relative imports are explicit so Node ESM and browser bundlers can resolve it. The main-process entry remains CommonJS in both cases.
12+
913
## Documentation
1014

1115
See the [iTwin.js](https://www.itwinjs.org) documentation for more information.

core/electron/package.json

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,40 @@
22
"name": "@itwin/core-electron",
33
"version": "5.14.0-dev.7",
44
"description": "iTwin.js ElectronHost and ElectronApp",
5+
"exports": {
6+
"./renderer": {
7+
"import": {
8+
"types": "./lib/esm/ElectronFrontend.d.ts",
9+
"default": "./lib/esm/ElectronFrontend.js"
10+
},
11+
"require": {
12+
"types": "./lib/cjs/ElectronFrontend.d.ts",
13+
"default": "./lib/cjs/ElectronFrontend.js"
14+
}
15+
},
16+
"./main": {
17+
"types": "./lib/cjs/ElectronBackend.d.ts",
18+
"import": "./lib/cjs/ElectronBackend.js",
19+
"require": "./lib/cjs/ElectronBackend.js"
20+
},
21+
"./lib/cjs/*.js": "./lib/cjs/*.js",
22+
"./lib/cjs/*": {
23+
"types": "./lib/cjs/*.d.ts",
24+
"default": "./lib/cjs/*.js"
25+
},
26+
"./package.json": "./package.json"
27+
},
28+
"typesVersions": {
29+
"*": {
30+
"renderer": ["lib/cjs/ElectronFrontend.d.ts"],
31+
"main": ["lib/cjs/ElectronBackend.d.ts"]
32+
}
33+
},
534
"license": "MIT",
635
"scripts": {
7-
"build": "npm run -s build:cjs && npm run -s webpack:test && npm run -s copy:test-assets",
36+
"build": "npm run -s build:cjs && npm run -s build:esm && npm run -s webpack:test && npm run -s copy:test-assets",
837
"build:cjs": "tsc 1>&2 --outDir lib/cjs",
38+
"build:esm": "rimraf -g lib/esm && tsc 1>&2 -p tsconfig.esm.json && node -e \"require('node:fs').writeFileSync('lib/esm/package.json', JSON.stringify({ type: 'module' }) + '\\n')\"",
939
"copy:test-assets": "cpx \"./src/test/assets/**/*\" ./lib/cjs/test/assets",
1040
"clean": "rimraf -g lib .rush/temp/package-deps*.json",
1141
"docs": "betools docs --json=../../generated-docs/core/core-electron/file.json --tsIndexFile=./core-electron.ts --onlyJson",

core/electron/src/ElectronBackend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
* See LICENSE.md in the project root for license terms and full copyright notice.
44
*--------------------------------------------------------------------------------------------*/
55

6-
export * from "./backend/ElectronHost";
6+
export * from "./backend/ElectronHost.js";

core/electron/src/ElectronFrontend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
* See LICENSE.md in the project root for license terms and full copyright notice.
44
*--------------------------------------------------------------------------------------------*/
55

6-
export * from "./frontend/ElectronApp";
6+
export * from "./frontend/ElectronApp.js";

core/electron/src/backend/ElectronHost.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import * as path from "path";
1616
import { AsyncMethodsOf, BeDuration, IModelStatus, ProcessDetector } from "@itwin/core-bentley";
1717
import { IpcHandler, IpcHost, NativeHost, NativeHostOpts } from "@itwin/core-backend";
1818
import { IModelError, IpcListener, IpcSocketBackend, RemoveFunction, RpcConfiguration, RpcInterfaceDefinition } from "@itwin/core-common";
19-
import { ElectronRpcConfiguration, ElectronRpcManager } from "../common/ElectronRpcManager";
20-
import { electronIpcStrings } from "../common/ElectronIpcInterface";
19+
import { ElectronRpcConfiguration, ElectronRpcManager } from "../common/ElectronRpcManager.js";
20+
import { electronIpcStrings } from "../common/ElectronIpcInterface.js";
2121

2222
// cSpell:ignore signin devserver webcontents copyfile unmaximize eopt
2323

core/electron/src/backend/ElectronPreload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { contextBridge, ipcRenderer } from "electron";
7-
import type { ElectronListener, ITwinElectronApi } from "../common/ITwinElectronApi";
7+
import type { ElectronListener, ITwinElectronApi } from "../common/ITwinElectronApi.js";
88

99
/**
1010
* This file is loaded as an Electron preload script

core/electron/src/common/ElectronIpcTransport.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import { BentleyError, BentleyStatus, ProcessDetector } from "@itwin/core-bentle
77
import {
88
IModelError, iTwinChannel, RpcPushChannel, RpcPushConnection, RpcRequestFulfillment, RpcSerializedValue, SerializedRpcRequest,
99
} from "@itwin/core-common";
10-
import { ElectronPushConnection, ElectronPushTransport } from "./ElectronPush";
11-
import { ElectronRpcConfiguration } from "./ElectronRpcManager";
12-
import { ElectronRpcProtocol } from "./ElectronRpcProtocol";
10+
import { ElectronPushConnection, ElectronPushTransport } from "./ElectronPush.js";
11+
import { ElectronRpcConfiguration } from "./ElectronRpcManager.js";
12+
import { ElectronRpcProtocol } from "./ElectronRpcProtocol.js";
1313

1414
const OBJECTS_CHANNEL = iTwinChannel("rpc.objects");
1515
const DATA_CHANNEL = iTwinChannel("rpc.data");

0 commit comments

Comments
 (0)