Skip to content

Commit

Permalink
refactor: switch back to commonjs
Browse files Browse the repository at this point in the history
  • Loading branch information
wozjac committed Jun 20, 2024
1 parent 141e9f3 commit 3dd1dd2
Show file tree
Hide file tree
Showing 32 changed files with 105 additions and 104 deletions.
2 changes: 1 addition & 1 deletion config/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default { extends: ["@commitlint/config-conventional"] };
module.exports = { extends: ["@commitlint/config-conventional"] };
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "VSCode extension: SAPUI5/OpenUI5 Reference documentation in a side bar view",
"license": "MIT",
"version": "1.5.0",
"type": "module",
"engines": {
"vscode": "^1.53.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/core/ui5ApiBuffer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LibraryApiSymbol } from "./types";
import { LibraryApiSymbol } from "./types.js";

const ui5ObjectsDesignApiBufferLength = 30;
let ui5ObjectsDesignApiBuffer: LibraryApiSymbol[] = [];
Expand Down
8 changes: 4 additions & 4 deletions src/core/ui5ApiService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as ui5Api from "./types";
import * as constants from "./constants";
import * as dataSource from "./dataSource";
import * as apiBuffer from "./ui5ApiBuffer";
import * as ui5Api from "./types.js";
import * as constants from "./constants.js";
import * as dataSource from "./dataSource.js";
import * as apiBuffer from "./ui5ApiBuffer.js";

interface Ui5LibrariesApi {
[index: string]: ui5Api.LibraryApi;
Expand Down
10 changes: 5 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as vscode from "vscode";
import { ApiReferenceProvider } from "./view/ApiReferenceProvider";
import * as ui5ApiService from "./core/ui5ApiService";
import * as dataSource from "./core/dataSource";
import { ApiReferenceProvider } from "./view/ApiReferenceProvider.js";
import * as ui5ApiService from "./core/ui5ApiService.js";
import * as dataSource from "./core/dataSource.js";
import * as constants from "./core/constants.js";
import * as contextMenu from "./panelFeatures/contextMenu";
import * as favorites from "./panelFeatures/favorites";
import * as contextMenu from "./panelFeatures/contextMenu.js";
import * as favorites from "./panelFeatures/favorites.js";

export function activate(context: vscode.ExtensionContext) {
const templatePaths = getTemplatePaths(context.extensionUri);
Expand Down
8 changes: 4 additions & 4 deletions src/objectApi/aggregationFormat.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as formatter from "./formatter";
import * as ui5ApiService from "../core/ui5ApiService";
import { AggregationApi, AggregationsApi } from "./types";
import { Ui5ObjectAggregations } from "../core/types";
import * as formatter from "./formatter.js";
import * as ui5ApiService from "../core/ui5ApiService.js";
import { AggregationApi, AggregationsApi } from "./types.js";
import { Ui5ObjectAggregations } from "../core/types.js";

export function prepareAggregations(
aggregations: Ui5ObjectAggregations,
Expand Down
6 changes: 3 additions & 3 deletions src/objectApi/constructorFormat.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Ui5ObjectConstructor, LibraryApiSymbol } from "../core/types";
import { Ui5ConstructorApi } from "./types";
import * as formatter from "./formatter";
import { Ui5ObjectConstructor, LibraryApiSymbol } from "../core/types.js";
import { Ui5ConstructorApi } from "./types.js";
import * as formatter from "./formatter.js";

export function prepareConstructor(
ui5Constructor: Ui5ObjectConstructor,
Expand Down
8 changes: 4 additions & 4 deletions src/objectApi/eventFormat.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { formatJsDoc } from "./formatter";
import { EventApi, EventsApi } from "./types";
import * as parameterFormat from "./parameterFormat";
import { Ui5ObjectEvents } from "../core/types";
import { formatJsDoc } from "./formatter.js";
import { EventApi, EventsApi } from "./types.js";
import * as parameterFormat from "./parameterFormat.js";
import { Ui5ObjectEvents } from "../core/types.js";

export function prepareEvents(events: Ui5ObjectEvents, ui5ObjectApi: any, cleanHtml: boolean) {
return events.map((event) => {
Expand Down
2 changes: 1 addition & 1 deletion src/objectApi/formatter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as constants from "../core/constants";
import * as constants from "../core/constants.js";

export function convertModuleNameToPath(moduleName: string): string {
return moduleName.replace("module:", "").replace(/\//g, ".");
Expand Down
10 changes: 5 additions & 5 deletions src/objectApi/methodFormat.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { formatJsDoc } from "./formatter";
import { prepareParameters } from "./parameterFormat";
import { getUi5Objects } from "../core/ui5ApiService";
import { MethodApi, MethodsApi } from "./types";
import { Ui5ObjectMethods, LibraryApiSymbol } from "../core/types";
import { formatJsDoc } from "./formatter.js";
import { prepareParameters } from "./parameterFormat.js";
import { getUi5Objects } from "../core/ui5ApiService.js";
import { MethodApi, MethodsApi } from "./types.js";
import { Ui5ObjectMethods, LibraryApiSymbol } from "../core/types.js";

export function prepareMethods(
methods: Ui5ObjectMethods,
Expand Down
20 changes: 10 additions & 10 deletions src/objectApi/objectApiFormat.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as ui5Api from "../core/types";
import * as ui5ApiService from "../core/ui5ApiService";
import * as favorites from "../panelFeatures/favorites";
import * as formatter from "./formatter";
import * as methodFormat from "./methodFormat";
import * as eventFormat from "./eventFormat";
import * as aggregationFormat from "./aggregationFormat";
import * as constructorFormat from "./constructorFormat";
import * as propertiesFormat from "./propertiesFormat";
import { Ui5SymbolApi } from "./types";
import * as ui5Api from "../core/types.js";
import * as ui5ApiService from "../core/ui5ApiService.js";
import * as favorites from "../panelFeatures/favorites.js";
import * as formatter from "./formatter.js";
import * as methodFormat from "./methodFormat.js";
import * as eventFormat from "./eventFormat.js";
import * as aggregationFormat from "./aggregationFormat.js";
import * as constructorFormat from "./constructorFormat.js";
import * as propertiesFormat from "./propertiesFormat.js";
import { Ui5SymbolApi } from "./types.js";

export function getFormattedObjectApi(
ui5ObjectApi: ui5Api.LibraryApiSymbol,
Expand Down
6 changes: 3 additions & 3 deletions src/objectApi/parameterFormat.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { formatJsDoc } from "./formatter";
import { ParameterApi, ParametersApi } from "./types";
import { Ui5ObjectParameters } from "../core/types";
import { formatJsDoc } from "./formatter.js";
import { ParameterApi, ParametersApi } from "./types.js";
import { Ui5ObjectParameters } from "../core/types.js";

export function prepareParameters(parameters: Ui5ObjectParameters, cleanHtml: boolean) {
return parameters.map((parameter) => {
Expand Down
8 changes: 4 additions & 4 deletions src/objectApi/propertiesFormat.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Ui5ObjectProperties, LibraryApiSymbol } from "../core/types";
import * as ui5ApiService from "../core/ui5ApiService";
import { PropertyApi } from "./types";
import * as formatter from "./formatter";
import { Ui5ObjectProperties, LibraryApiSymbol } from "../core/types.js";
import * as ui5ApiService from "../core/ui5ApiService.js";
import { PropertyApi } from "./types.js";
import * as formatter from "./formatter.js";

export function prepareProperties(
properties: Ui5ObjectProperties,
Expand Down
4 changes: 2 additions & 2 deletions src/panelFeatures/apiDocsFiltering.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as constants from "../core/constants";
import { LibraryApiSymbol } from "../core/types";
import * as constants from "../core/constants.js";
import { LibraryApiSymbol } from "../core/types.js";

interface DeleteMarkers {
events: boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/search/ui5ApiFinder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as ui5ApiService from "../core/ui5ApiService";
import { ApiIndexNodeEnhanced } from "../core/types";
import * as ui5ApiService from "../core/ui5ApiService.js";
import { ApiIndexNodeEnhanced } from "../core/types.js";

export interface SearchQuery {
name: string;
Expand Down
2 changes: 1 addition & 1 deletion src/test/suite/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as path from "path";
import * as Mocha from "mocha";
import Mocha from "mocha";
import * as glob from "glob";

const doCoverage = true;
Expand Down
4 changes: 2 additions & 2 deletions src/test/suite/int/core/dataSource.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import * as dataSource from "../../../../core/dataSource";
import * as stubber from "../../../support/stubber";
import * as dataSource from "../../../../core/dataSource.js";
import * as stubber from "../../../support/stubber.js";
import * as vscode from "vscode";
import * as path from "path";

Expand Down
6 changes: 3 additions & 3 deletions src/test/suite/int/core/ui5ApiBuffer.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from "chai";
import * as ui5ApiBuffer from "../../../../core/ui5ApiBuffer";
import * as stubber from "../../../support/stubber";
import * as ui5ApiBuffer from "../../../../core/ui5ApiBuffer.js";
import * as stubber from "../../../support/stubber.js";
import * as vscode from "vscode";
import { ColumnListItemApiSymbol, BaseObjectApiSymbol } from "../../unit/common";
import { ColumnListItemApiSymbol, BaseObjectApiSymbol } from "../../unit/common.js";

describe("ui5ApiBuffer tests", () => {
before(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/test/suite/int/panelFeatures/contextMenu.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from "chai";
import * as contextMenu from "../../../../panelFeatures/contextMenu";
import * as contextMenu from "../../../../panelFeatures/contextMenu.js";
import * as stubber from "../../../support/stubber.js";
import * as vscode from "vscode";
import * as path from "path";
Expand Down
2 changes: 1 addition & 1 deletion src/test/suite/unit/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LibraryApiSymbol } from "../../../core/types";
import { LibraryApiSymbol } from "../../../core/types.js";

export const ColumnListItemApiSymbol: LibraryApiSymbol = {
name: "sap.m.ColumnListItem",
Expand Down
6 changes: 3 additions & 3 deletions src/test/suite/unit/core/ui5ApiService.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from "chai";
import * as ui5ApiService from "../../../../core/ui5ApiService";
import * as stubber from "../../../support/stubber";
import * as ui5ApiService from "../../../../core/ui5ApiService.js";
import * as stubber from "../../../support/stubber.js";
import * as vscode from "vscode";
import { ColumnListItemApiSymbol, BaseObjectApiSymbol } from "../../unit/common";
import { ColumnListItemApiSymbol, BaseObjectApiSymbol } from "../../unit/common.js";

describe("ui5ApiBuffer tests", () => {
before(() => {
Expand Down
8 changes: 4 additions & 4 deletions src/test/suite/unit/objectApi/aggregationFormat.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from "chai";
import * as stubber from "../../../support/stubber";
import { prepareAggregations } from "../../../../objectApi/aggregationFormat";
import { Ui5ObjectAggregation, LibraryApiSymbol } from "../../../../core/types";
import { ColumnListItemApiSymbol } from "../common";
import * as stubber from "../../../support/stubber.js";
import { prepareAggregations } from "../../../../objectApi/aggregationFormat.js";
import { Ui5ObjectAggregation, LibraryApiSymbol } from "../../../../core/types.js";
import { ColumnListItemApiSymbol } from "../common.js";

const rawAggregation: Ui5ObjectAggregation = {
name: "myName",
Expand Down
8 changes: 4 additions & 4 deletions src/test/suite/unit/objectApi/constructorFormat.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from "chai";
import * as stubber from "../../../support/stubber";
import { prepareConstructor } from "../../../../objectApi/constructorFormat";
import { Ui5ObjectConstructor, LibraryApiSymbol } from "../../../../core/types";
import { ColumnListItemApiSymbol } from "../common";
import * as stubber from "../../../support/stubber.js";
import { prepareConstructor } from "../../../../objectApi/constructorFormat.js";
import { Ui5ObjectConstructor, LibraryApiSymbol } from "../../../../core/types.js";
import { ColumnListItemApiSymbol } from "../common.js";

const rawConstructor: Ui5ObjectConstructor = {
description: "This is <code>constructor</code>",
Expand Down
8 changes: 4 additions & 4 deletions src/test/suite/unit/objectApi/eventFormat.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from "chai";
import * as stubber from "../../../support/stubber";
import { prepareEvents } from "../../../../objectApi/eventFormat";
import { Ui5ObjectEvent, LibraryApiSymbol } from "../../../../core/types";
import { ColumnListItemApiSymbol } from "../common";
import * as stubber from "../../../support/stubber.js";
import { prepareEvents } from "../../../../objectApi/eventFormat.js";
import { Ui5ObjectEvent, LibraryApiSymbol } from "../../../../core/types.js";
import { ColumnListItemApiSymbol } from "../common.js";

const rawEvent: Ui5ObjectEvent = {
description: "This is <code>event</code>",
Expand Down
8 changes: 4 additions & 4 deletions src/test/suite/unit/objectApi/methodFormat.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from "chai";
import * as stubber from "../../../support/stubber";
import { prepareMethods } from "../../../../objectApi/methodFormat";
import { Ui5ObjectMethod, LibraryApiSymbol } from "../../../../core/types";
import { ColumnListItemApiSymbol } from "../common";
import * as stubber from "../../../support/stubber.js";
import { prepareMethods } from "../../../../objectApi/methodFormat.js";
import { Ui5ObjectMethod, LibraryApiSymbol } from "../../../../core/types.js";
import { ColumnListItemApiSymbol } from "../common.js";

const rawMethod: Ui5ObjectMethod = {
description: "This is <code>method</code>",
Expand Down
10 changes: 5 additions & 5 deletions src/test/suite/unit/objectApi/objectApiFormat.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect } from "chai";
import * as objectApiFormat from "../../../../objectApi/objectApiFormat";
import * as formatter from "../../../../objectApi/formatter";
import sapUiCoreApi from "../../../support/fixtures/sapUiCoreApi";
import * as stubber from "../../../support/stubber";
import { LibraryApiSymbol } from "../../../../core/types";
import * as objectApiFormat from "../../../../objectApi/objectApiFormat.js";
import * as formatter from "../../../../objectApi/formatter.js";
import sapUiCoreApi from "../../../support/fixtures/sapUiCoreApi.js";
import * as stubber from "../../../support/stubber.js";
import { LibraryApiSymbol } from "../../../../core/types.js";

describe("objectApiFormat tests", () => {
before(() => {
Expand Down
8 changes: 4 additions & 4 deletions src/test/suite/unit/objectApi/propertiesFormat.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from "chai";
import * as stubber from "../../../support/stubber";
import { prepareProperties } from "../../../../objectApi/propertiesFormat";
import { Ui5ObjectProperty, LibraryApiSymbol } from "../../../../core/types";
import { ColumnListItemApiSymbol } from "../common";
import * as stubber from "../../../support/stubber.js";
import { prepareProperties } from "../../../../objectApi/propertiesFormat.js";
import { Ui5ObjectProperty, LibraryApiSymbol } from "../../../../core/types.js";
import { ColumnListItemApiSymbol } from "../common.js";

const rawPropertyBasic: Ui5ObjectProperty = {
name: "myName",
Expand Down
4 changes: 2 additions & 2 deletions src/test/suite/unit/panelFeatures/favorites.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import * as favorites from "../../../../panelFeatures/favorites";
import * as stubber from "../../../support/stubber";
import * as favorites from "../../../../panelFeatures/favorites.js";
import * as stubber from "../../../support/stubber.js";
import * as vscode from "vscode";

describe("favorites tests", () => {
Expand Down
6 changes: 3 additions & 3 deletions src/test/suite/unit/search/ui5ApiFinder.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "chai";
import * as ui5ApiFinder from "../../../../search/ui5ApiFinder";
import ui5ApiObjects from "../../../support/fixtures/ui5ApiObjects";
import * as stubber from "../../../support/stubber";
import * as ui5ApiFinder from "../../../../search/ui5ApiFinder.js";
import ui5ApiObjects from "../../../support/fixtures/ui5ApiObjects.js";
import * as stubber from "../../../support/stubber.js";

describe("ui5ApiFinder tests", () => {
before(() => {
Expand Down
18 changes: 9 additions & 9 deletions src/view/ApiReferenceController.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as vscode from "vscode";
import * as ui5APIService from "../core/ui5ApiService";
import * as ui5APIFormatter from "../objectApi/objectApiFormat";
import * as ui5APIFinder from "../search/ui5ApiFinder";
import * as constants from "../core/constants";
import * as favorites from "../panelFeatures/favorites";
import * as filtering from "../panelFeatures/apiDocsFiltering";
import * as mustache from "mustache";
import { TemplatesContent } from "../core/dataSource";
import * as ui5APIService from "../core/ui5ApiService.js";
import * as ui5APIFormatter from "../objectApi/objectApiFormat.js";
import * as ui5APIFinder from "../search/ui5ApiFinder.js";
import * as constants from "../core/constants.js";
import * as favorites from "../panelFeatures/favorites.js";
import * as filtering from "../panelFeatures/apiDocsFiltering.js";
import Mustache from "mustache";
import { TemplatesContent } from "../core/dataSource.js";

interface GlobalState {
hitlistObjectsLimit: number;
Expand Down Expand Up @@ -278,7 +278,7 @@ export class ApiReferenceCtrl {
if (!designAPI) {
return null;
} else {
return mustache.render(this.templates.objectAPI, designAPI, {
return Mustache.render(this.templates.objectAPI, designAPI, {
membersTemplate: this.templates.members,
});
}
Expand Down
8 changes: 4 additions & 4 deletions src/view/ApiReferenceProvider.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as vscode from "vscode";
import { ApiReferenceCtrl } from "./ApiReferenceController";
import * as mustache from "mustache";
import { TemplatesContent } from "../core/dataSource";
import { ApiReferenceCtrl } from "./ApiReferenceController.js";
import Mustache from "mustache";
import { TemplatesContent } from "../core/dataSource.js";

export class ApiReferenceProvider {
private extensionUri: vscode.Uri;
Expand Down Expand Up @@ -41,7 +41,7 @@ export class ApiReferenceProvider {
cspSource: this.view.webview.cspSource,
};

webviewView.webview.html = mustache.render(this.templates.webview, variables);
webviewView.webview.html = Mustache.render(this.templates.webview, variables);

webviewView.webview.onDidReceiveMessage(
(message) => {
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"rootDir": "src",
"allowJs": true,
"moduleResolution": "nodenext",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"strict": true /* enable all strict type-checking options */
/* Additional Checks */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
Expand Down

0 comments on commit 3dd1dd2

Please sign in to comment.