Skip to content

Commit

Permalink
fix: TypeScript Module Configuration (especially for ESM) (#574)
Browse files Browse the repository at this point in the history
fixes #573
  • Loading branch information
LukasHeimann authored Jan 10, 2024
1 parent 89c20a8 commit 56552d5
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/lib/Logger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { wdi5LogLevel } from "../types/wdi5.types"
import { wdi5LogLevel } from "../types/wdi5.types.js"

const translate = (color) => {
switch (color) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/authentication/BTPAuthenticator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BTPAuthenticator as BTPAuthenticatorType } from "../../types/wdi5.types"
import { BTPAuthenticator as BTPAuthenticatorType } from "../../types/wdi5.types.js"
import Authenticator from "./Authenticator.js"

class BTPAuthenticator extends Authenticator {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/authentication/BasicAuthenticator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Authenticator from "./Authenticator.js"
import { BasicAuthAuthenticator as BasicAuthenticatorType } from "../../types/wdi5.types"
import { BasicAuthAuthenticator as BasicAuthenticatorType } from "../../types/wdi5.types.js"

class BasicAuthenticator extends Authenticator {
private options: BasicAuthenticatorType
Expand Down
2 changes: 1 addition & 1 deletion src/lib/authentication/CustomAuthenticator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CustomAuthenticator as CustomAuthenticatorType } from "../../types/wdi5.types"
import { CustomAuthenticator as CustomAuthenticatorType } from "../../types/wdi5.types.js"
import { Logger } from "../Logger.js"
import Authenticator from "./Authenticator.js"

Expand Down
2 changes: 1 addition & 1 deletion src/lib/authentication/Office365Authenticator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Office365Authenticator as Office365AuthenticatorType } from "../../types/wdi5.types"
import { Office365Authenticator as Office365AuthenticatorType } from "../../types/wdi5.types.js"
import Authenticator from "./Authenticator.js"

class Office365Authenticator extends Authenticator {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/wdi5-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { tmpdir } from "os"
import * as semver from "semver"
import { mark as marky_mark, stop as marky_stop } from "marky"

import { clientSide_ui5Object, clientSide_ui5Response, wdi5Config, wdi5Selector } from "../types/wdi5.types"
import { clientSide_ui5Object, clientSide_ui5Response, wdi5Config, wdi5Selector } from "../types/wdi5.types.js"
import { MultiRemoteBrowser } from "webdriverio"
import { WDI5Control } from "./wdi5-control.js"
import { WDI5FE } from "./wdi5-fe.js"
Expand All @@ -19,7 +19,7 @@ import { clientSide_allControls } from "../../client-side-js/allControls.cjs"
import { Logger as _Logger } from "./Logger.js"
import { WDI5Object } from "./wdi5-object.js"
import BTPAuthenticator from "./authentication/BTPAuthenticator.js"
import { BTPAuthenticator as BTPAuthenticatorType } from "../types/wdi5.types"
import { BTPAuthenticator as BTPAuthenticatorType } from "../types/wdi5.types.js"
import BasicAuthenticator from "./authentication/BasicAuthenticator.js"
import CustomAuthenticator from "./authentication/CustomAuthenticator.js"
import Office365Authenticator from "./authentication/Office365Authenticator.js"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/wdi5-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { clientSide_interactWithControl } from "../../client-side-js/interactWit
import { clientSide_executeControlMethod } from "../../client-side-js/executeControlMethod.cjs"
import { clientSide_getAggregation } from "../../client-side-js/_getAggregation.cjs"
import { clientSide_fireEvent } from "../../client-side-js/fireEvent.cjs"
import { clientSide_ui5Response, wdi5ControlMetadata, wdi5Selector } from "../types/wdi5.types"
import { clientSide_ui5Response, wdi5ControlMetadata, wdi5Selector } from "../types/wdi5.types.js"
import { Logger as _Logger } from "./Logger.js"
import { wdioApi } from "./wdioApi.js"
import { WDI5Object } from "./wdi5-object.js"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/wdi5-object.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { clientSide_executeObjectMethod } from "../../client-side-js/executeObjectMethod.cjs"
import { clientSide_ui5Response } from "../types/wdi5.types"
import { clientSide_ui5Response } from "../types/wdi5.types.js"
import { Logger as _Logger } from "./Logger.js"

const Logger = _Logger.getInstance()
Expand Down
2 changes: 1 addition & 1 deletion src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Capabilities, Services } from "@wdio/types"
import { MultiRemoteBrowser } from "webdriverio"

import { start, injectUI5, setup, checkForUI5Page, authenticate } from "./lib/wdi5-bridge.js"
import { wdi5Config } from "./types/wdi5.types"
import { wdi5Config } from "./types/wdi5.types.js"

import { Logger as _Logger } from "./lib/Logger.js"
const Logger = _Logger.getInstance()
Expand Down
4 changes: 2 additions & 2 deletions src/types/browser-commands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Control from "sap/ui/core/Control"
import { wdi5Config, wdi5Selector } from "./wdi5.types"
import { WDI5Control } from "../lib/wdi5-control"
import { wdi5Config, wdi5Selector } from "./wdi5.types.js"
import { WDI5Control } from "../lib/wdi5-control.js"

/**
* wdi5 control cache aka
Expand Down
4 changes: 2 additions & 2 deletions src/types/wdi5.types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Log from "sap/base/Log"
import RecordReplay from "sap/ui/test/RecordReplay"
import { ControlSelector } from "sap/ui/test/RecordReplay"
import { WDI5Object } from "../lib/wdi5-object"
import { WDI5Object } from "../lib/wdi5-object.js"

// // copypasta from
// // https://stackoverflow.com/questions/41285211/overriding-interface-property-type-defined-in-typescript-d-ts-file/65561287#65561287
Expand Down Expand Up @@ -262,4 +262,4 @@ export interface wdi5Bridge extends Window {
}
}

export type { WDI5Control as wdi5Control } from "../lib/wdi5-control"
export type { WDI5Control as wdi5Control } from "../lib/wdi5-control.js"
1 change: 1 addition & 0 deletions tsconfig-cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"noEmit": false,
"outDir": "cjs",
"moduleResolution": "Node",
"module": "CommonJS"
}
}
1 change: 0 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"declaration": true,
"declarationMap": true,
"downlevelIteration": true,
"moduleResolution": "node",
"types": ["node", "@wdio/globals/types", "@wdio/mocha-framework", "openui5"]
},
"include": ["src"]
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"noEmit": false,
"outDir": "esm",
"module": "ESNext",
"target": "ESNext"
"module": "Node16",
"moduleResolution": "Node16"
}
}

0 comments on commit 56552d5

Please sign in to comment.