Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 1a5649e

Browse files
authored
Merge pull request #259 from TriliumNext/feature/server_esm
Server ESM port: Basic imports
2 parents b508b5b + 0606fe0 commit 1a5649e

File tree

225 files changed

+1563
-1508
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

225 files changed

+1563
-1508
lines changed

.vscode/tasks.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "npm",
6+
"script": "errors",
7+
"problemMatcher": "$tsc-watch",
8+
"isBackground": true,
9+
"presentation": {
10+
"revealProblems": "never"
11+
},
12+
"runOptions": {
13+
"runOn": "folderOpen"
14+
}
15+
}
16+
]
17+
}

electron.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
"use strict";
22

3-
import electron = require("electron");
4-
import sqlInit = require("./src/services/sql_init");
5-
import appIconService = require("./src/services/app_icon");
6-
import windowService = require("./src/services/window");
7-
import tray = require("./src/services/tray");
3+
import electron from "electron";
4+
import electronDebug from "electron-debug";
5+
import electronDl from "electron-dl";
6+
import sqlInit from "./src/services/sql_init.js";
7+
import appIconService from "./src/services/app_icon.js";
8+
import windowService from "./src/services/window.js";
9+
import tray from "./src/services/tray.js";
810

911
// Prevent Trilium starting twice on first install and on uninstall for the Windows installer.
1012
if (require('electron-squirrel-startup')) {
1113
process.exit(0);
1214
}
1315

1416
// Adds debug features like hotkeys for triggering dev tools and reload
15-
require("electron-debug")();
17+
electronDebug();
1618

1719
appIconService.installLocalAppIcon();
1820

19-
require("electron-dl")({ saveAs: true });
21+
electronDl({ saveAs: true });
2022

2123
// needed for excalidraw export https://github.com/zadam/trilium/issues/4271
2224
electron.app.commandLine.appendSwitch(
@@ -65,4 +67,4 @@ electron.app.on("will-quit", () => {
6567
// this is to disable electron warning spam in the dev console (local development only)
6668
process.env["ELECTRON_DISABLE_SECURITY_WARNINGS"] = "true";
6769

68-
require("./src/www.js");
70+
require('./src/www.js');

package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"make-electron": "npm run webpack && npm run prepare-dist && electron-forge make",
4242
"package-electron": "electron-forge package",
4343
"prepare-dist": "rimraf ./dist && tsc && ts-node ./bin/copy-dist.ts",
44-
"update-build-info": "ts-node bin/update-build-info.ts"
44+
"update-build-info": "ts-node bin/update-build-info.ts",
45+
"errors": "tsc --watch --noEmit"
4546
},
4647
"dependencies": {
4748
"@braintree/sanitize-url": "^7.1.0",
@@ -145,6 +146,7 @@
145146
"@types/sax": "^1.2.7",
146147
"@types/semver": "^7.5.8",
147148
"@types/serve-favicon": "^2.5.7",
149+
"@types/session-file-store": "^1.2.5",
148150
"@types/stream-throttle": "^0.1.4",
149151
"@types/tmp": "^0.2.6",
150152
"@types/turndown": "^5.0.4",

spec/etapi/app_info.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import etapi = require("../support/etapi");
1+
import etapi from "../support/etapi.js";
22

33
etapi.describeEtapi("app_info", () => {
44
it("get", async () => {

spec/etapi/backup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import etapi = require("../support/etapi");
1+
import etapi from "../support/etapi.js";
22

33
etapi.describeEtapi("backup", () => {
44
it("create", async () => {

spec/etapi/import.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import etapi = require("../support/etapi");
2-
import fs = require("fs");
3-
import path = require("path");
1+
import etapi from "../support/etapi.js";
2+
import fs from "fs";
3+
import path from "path";
44

55
etapi.describeEtapi("import", () => {
66
// temporarily skip this test since test-export.zip is missing

spec/etapi/notes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import crypto = require("crypto");
2-
import etapi = require("../support/etapi");
1+
import crypto from "crypto";
2+
import etapi from "../support/etapi";
33

44
etapi.describeEtapi("notes", () => {
55
it("create", async () => {

spec/search/becca_mocking.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import BNote = require("../../src/becca/entities/bnote");
2-
import BBranch = require("../../src/becca/entities/bbranch");
3-
import BAttribute = require("../../src/becca/entities/battribute");
4-
import becca = require("../../src/becca/becca");
5-
import randtoken = require("rand-token");
6-
import SearchResult = require("../../src/services/search/search_result");
1+
import BNote from "../../src/becca/entities/bnote.js";
2+
import BBranch from "../../src/becca/entities/bbranch.js";
3+
import BAttribute from "../../src/becca/entities/battribute.js";
4+
import becca from "../../src/becca/becca.js";
5+
import randtoken from "rand-token";
6+
import SearchResult from "../../src/services/search/search_result.js";
77
import { NoteType } from "../../src/becca/entities/rows";
88
randtoken.generator({ source: "crypto" });
99

@@ -80,7 +80,7 @@ function note(title: string, extraParams = {}) {
8080
return new NoteBuilder(note);
8181
}
8282

83-
export = {
83+
export default {
8484
NoteBuilder,
8585
findNoteByTitle,
8686
note,

spec/search/lexer.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import lex = require("../../src/services/search/services/lex");
1+
import lex from "../../src/services/search/services/lex.js";
22

33
describe("Lexer fulltext", () => {
44
it("simple lexing", () => {

0 commit comments

Comments
 (0)