From 7781fbad769e04665baebb2a2ab5ee2cff2f584b Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Fri, 3 Nov 2017 00:09:34 +0000 Subject: [PATCH] Changed import statements to require to reduce dependency to Babel --- CliClient/app/ResourceServer.js | 8 +- CliClient/app/app-gui.js | 20 ++--- CliClient/app/app.js | 40 +++++----- CliClient/app/base-command.js | 4 +- CliClient/app/build-doc.js | 8 +- CliClient/app/build-translation.js | 6 +- CliClient/app/build-website.js | 8 +- CliClient/app/cli-integration-tests.js | 20 ++--- CliClient/app/cli-utils.js | 6 +- CliClient/app/command-attach.js | 18 ++--- CliClient/app/command-cat.js | 12 +-- CliClient/app/command-config.js | 8 +- CliClient/app/command-cp.js | 12 +-- CliClient/app/command-done.js | 14 ++-- CliClient/app/command-dump.js | 12 +-- CliClient/app/command-edit.js | 22 +++--- CliClient/app/command-exit.js | 6 +- CliClient/app/command-export.js | 16 ++-- CliClient/app/command-geoloc.js | 12 +-- CliClient/app/command-help.js | 16 ++-- CliClient/app/command-import-enex.js | 14 ++-- CliClient/app/command-ls.js | 20 ++--- CliClient/app/command-mkbook.js | 10 +-- CliClient/app/command-mknote.js | 8 +- CliClient/app/command-mktodo.js | 8 +- CliClient/app/command-mv.js | 12 +-- CliClient/app/command-ren.js | 12 +-- CliClient/app/command-rmbook.js | 16 ++-- CliClient/app/command-rmnote.js | 16 ++-- CliClient/app/command-search.js | 18 ++--- CliClient/app/command-set.js | 14 ++-- CliClient/app/command-status.js | 12 +-- CliClient/app/command-sync.js | 20 ++--- CliClient/app/command-tag.js | 10 +-- CliClient/app/command-todo.js | 14 ++-- CliClient/app/command-undone.js | 14 ++-- CliClient/app/command-use.js | 10 +-- CliClient/app/command-version.js | 6 +- CliClient/app/fuzzing.js | 12 +-- CliClient/app/help-utils.js | 10 +-- CliClient/app/import-enex-md-gen.js | 2 +- CliClient/app/import-enex.js | 26 +++---- CliClient/app/main.js | 26 +++---- CliClient/app/onedrive-api-node-utils.js | 4 +- CliClient/tests/base-model.js | 14 ++-- CliClient/tests/synchronizer.js | 18 ++--- CliClient/tests/test-utils.js | 36 ++++----- ReactNativeClient/index.android.js | 2 +- ReactNativeClient/index.ios.js | 2 +- ReactNativeClient/lib/base-model.js | 8 +- .../lib/components/action-button.js | 16 ++-- ReactNativeClient/lib/components/app-nav.js | 14 ++-- .../lib/components/base-screen.js | 6 +- ReactNativeClient/lib/components/checkbox.js | 6 +- .../lib/components/global-style.js | 2 +- .../lib/components/note-body-viewer.js | 14 ++-- ReactNativeClient/lib/components/note-item.js | 20 ++--- ReactNativeClient/lib/components/note-list.js | 24 +++--- .../lib/components/screen-header.js | 26 +++---- .../lib/components/screens/config.js | 16 ++-- .../lib/components/screens/folder.js | 26 +++---- .../lib/components/screens/log.js | 22 +++--- .../lib/components/screens/note.js | 52 ++++++------- .../lib/components/screens/notes.js | 36 ++++----- .../lib/components/screens/onedrive-login.js | 20 ++--- .../lib/components/screens/search.js | 20 ++--- .../lib/components/screens/status.js | 32 ++++---- .../lib/components/screens/tag.js | 20 ++--- .../lib/components/screens/welcome.js | 18 ++--- .../lib/components/side-menu-content.js | 26 +++---- ReactNativeClient/lib/components/side-menu.js | 12 +-- .../lib/database-driver-react-native.js | 2 +- ReactNativeClient/lib/database.js | 10 +-- ReactNativeClient/lib/dialogs.js | 4 +- .../lib/file-api-driver-local.js | 10 +-- .../lib/file-api-driver-memory.js | 2 +- .../lib/file-api-driver-onedrive.js | 8 +- ReactNativeClient/lib/file-api.js | 4 +- ReactNativeClient/lib/folders-screen-utils.js | 2 +- ReactNativeClient/lib/geolocation-node.js | 4 +- ReactNativeClient/lib/geolocation-react.js | 2 +- ReactNativeClient/lib/joplin-database.js | 8 +- ReactNativeClient/lib/locale.js | 2 +- ReactNativeClient/lib/logger.js | 8 +- ReactNativeClient/lib/models/base-item.js | 12 +-- ReactNativeClient/lib/models/folder.js | 22 +++--- ReactNativeClient/lib/models/note-tag.js | 6 +- ReactNativeClient/lib/models/note.js | 27 ++++--- ReactNativeClient/lib/models/resource.js | 16 ++-- ReactNativeClient/lib/models/setting.js | 10 +-- ReactNativeClient/lib/models/tag.js | 12 +-- ReactNativeClient/lib/net-utils.js | 2 +- ReactNativeClient/lib/onedrive-api.js | 8 +- ReactNativeClient/lib/parameters.js | 2 +- ReactNativeClient/lib/poor-man-intervals.js | 2 +- ReactNativeClient/lib/react-logger.js | 2 +- ReactNativeClient/lib/reducer.js | 2 +- ReactNativeClient/lib/registry.js | 24 +++--- ReactNativeClient/lib/services/back-button.js | 2 +- ReactNativeClient/lib/services/exporter.js | 18 ++--- ReactNativeClient/lib/services/report.js | 10 +-- ReactNativeClient/lib/shim-init-node.js | 10 +-- ReactNativeClient/lib/shim-init-react.js | 8 +- ReactNativeClient/lib/synchronizer.js | 22 +++--- ReactNativeClient/lib/time-utils.js | 2 +- ReactNativeClient/lib/uuid.js | 2 +- ReactNativeClient/main.js | 6 +- ReactNativeClient/root.js | 76 +++++++++---------- 108 files changed, 729 insertions(+), 730 deletions(-) diff --git a/CliClient/app/ResourceServer.js b/CliClient/app/ResourceServer.js index 5cbb1e110..cdeecc617 100644 --- a/CliClient/app/ResourceServer.js +++ b/CliClient/app/ResourceServer.js @@ -1,7 +1,7 @@ -import { _ } from 'lib/locale.js' -import { Logger } from 'lib/logger.js'; -import { Resource } from 'lib/models/resource.js'; -import { netUtils } from 'lib/net-utils.js' +const { _ } = require('lib/locale.js'); +const { Logger } = require('lib/logger.js'); +const { Resource } = require('lib/models/resource.js'); +const { netUtils } = require('lib/net-utils.js'); const http = require("http"); const urlParser = require("url"); diff --git a/CliClient/app/app-gui.js b/CliClient/app/app-gui.js index 3e08e4149..e840ace70 100644 --- a/CliClient/app/app-gui.js +++ b/CliClient/app/app-gui.js @@ -1,13 +1,13 @@ -import { Logger } from 'lib/logger.js'; -import { Folder } from 'lib/models/folder.js'; -import { Tag } from 'lib/models/tag.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Note } from 'lib/models/note.js'; -import { Resource } from 'lib/models/resource.js'; -import { cliUtils } from './cli-utils.js'; -import { reducer, defaultState } from 'lib/reducer.js'; -import { reg } from 'lib/registry.js'; -import { _ } from 'lib/locale.js'; +const { Logger } = require('lib/logger.js'); +const { Folder } = require('lib/models/folder.js'); +const { Tag } = require('lib/models/tag.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Note } = require('lib/models/note.js'); +const { Resource } = require('lib/models/resource.js'); +const { cliUtils } = require('./cli-utils.js'); +const { reducer, defaultState } = require('lib/reducer.js'); +const { reg } = require('lib/registry.js'); +const { _ } = require('lib/locale.js'); const chalk = require('chalk'); const tk = require('terminal-kit'); diff --git a/CliClient/app/app.js b/CliClient/app/app.js index c44d877d7..09a490067 100644 --- a/CliClient/app/app.js +++ b/CliClient/app/app.js @@ -1,23 +1,23 @@ -import { createStore, applyMiddleware } from 'redux'; -import { reducer, defaultState } from 'lib/reducer.js'; -import { JoplinDatabase } from 'lib/joplin-database.js'; -import { Database } from 'lib/database.js'; -import { FoldersScreenUtils } from 'lib/folders-screen-utils.js'; -import { DatabaseDriverNode } from 'lib/database-driver-node.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { BaseItem } from 'lib/models/base-item.js'; -import { Note } from 'lib/models/note.js'; -import { Tag } from 'lib/models/tag.js'; -import { Setting } from 'lib/models/setting.js'; -import { Logger } from 'lib/logger.js'; -import { sprintf } from 'sprintf-js'; -import { reg } from 'lib/registry.js'; -import { fileExtension } from 'lib/path-utils.js'; -import { _, setLocale, defaultLocale, closestSupportedLocale } from 'lib/locale.js'; -import os from 'os'; -import fs from 'fs-extra'; -import { cliUtils } from './cli-utils.js'; +const { createStore, applyMiddleware } = require('redux'); +const { reducer, defaultState } = require('lib/reducer.js'); +const { JoplinDatabase } = require('lib/joplin-database.js'); +const { Database } = require('lib/database.js'); +const { FoldersScreenUtils } = require('lib/folders-screen-utils.js'); +const { DatabaseDriverNode } = require('lib/database-driver-node.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { BaseItem } = require('lib/models/base-item.js'); +const { Note } = require('lib/models/note.js'); +const { Tag } = require('lib/models/tag.js'); +const { Setting } = require('lib/models/setting.js'); +const { Logger } = require('lib/logger.js'); +const { sprintf } = require('sprintf-js'); +const { reg } = require('lib/registry.js'); +const { fileExtension } = require('lib/path-utils.js'); +const { _, setLocale, defaultLocale, closestSupportedLocale } = require('lib/locale.js'); +const os = require('os'); +const fs = require('fs-extra'); +const { cliUtils } = require('./cli-utils.js'); const EventEmitter = require('events'); class Application { diff --git a/CliClient/app/base-command.js b/CliClient/app/base-command.js index c40c366dc..edc3b0738 100644 --- a/CliClient/app/base-command.js +++ b/CliClient/app/base-command.js @@ -1,5 +1,5 @@ -import { _ } from 'lib/locale.js'; -import { reg } from 'lib/registry.js'; +const { _ } = require('lib/locale.js'); +const { reg } = require('lib/registry.js'); class BaseCommand { diff --git a/CliClient/app/build-doc.js b/CliClient/app/build-doc.js index aafb20bbe..3790c0ada 100644 --- a/CliClient/app/build-doc.js +++ b/CliClient/app/build-doc.js @@ -1,10 +1,10 @@ require('source-map-support').install(); require('babel-plugin-transform-runtime'); -import fs from 'fs-extra'; -import { fileExtension, basename, dirname } from 'lib/path-utils.js'; -import wrap_ from 'word-wrap'; -import { _, setLocale, languageCode } from 'lib/locale.js'; +const fs = require('fs-extra'); +const { fileExtension, basename, dirname } = require('lib/path-utils.js'); +const wrap_ = require('word-wrap'); +const { _, setLocale, languageCode } = require('lib/locale.js'); const rootDir = dirname(dirname(__dirname)); const MAX_WIDTH = 78; diff --git a/CliClient/app/build-translation.js b/CliClient/app/build-translation.js index a2bccb8f7..8b145e22d 100644 --- a/CliClient/app/build-translation.js +++ b/CliClient/app/build-translation.js @@ -7,9 +7,9 @@ const processArgs = process.argv.splice(2, process.argv.length); const silentLog = processArgs.indexOf('--silent') >= 0; -import { basename, dirname } from 'lib/path-utils.js'; -import fs from 'fs-extra'; -import gettextParser from 'gettext-parser'; +const { basename, dirname } = require('lib/path-utils.js'); +const fs = require('fs-extra'); +const gettextParser = require('gettext-parser'); const rootDir = dirname(dirname(__dirname)); const cliDir = rootDir + '/CliClient'; diff --git a/CliClient/app/build-website.js b/CliClient/app/build-website.js index a52acc0b0..250c0054b 100644 --- a/CliClient/app/build-website.js +++ b/CliClient/app/build-website.js @@ -1,10 +1,10 @@ require('source-map-support').install(); require('babel-plugin-transform-runtime'); -import fs from 'fs-extra'; -import { fileExtension, basename, dirname } from 'lib/path-utils.js'; -import { _, setLocale, languageCode } from 'lib/locale.js'; -import marked from 'lib/marked.js'; +const fs = require('fs-extra'); +const { fileExtension, basename, dirname } = require('lib/path-utils.js'); +const { _, setLocale, languageCode } = require('lib/locale.js'); +const marked = require('lib/marked.js'); const headerHtml = ` diff --git a/CliClient/app/cli-integration-tests.js b/CliClient/app/cli-integration-tests.js index 3f9954a00..587965e70 100644 --- a/CliClient/app/cli-integration-tests.js +++ b/CliClient/app/cli-integration-tests.js @@ -3,16 +3,16 @@ require('source-map-support').install(); require('babel-plugin-transform-runtime'); -import fs from 'fs-extra'; -import { Logger } from 'lib/logger.js'; -import { dirname } from 'lib/path-utils.js'; -import { DatabaseDriverNode } from 'lib/database-driver-node.js'; -import { JoplinDatabase } from 'lib/joplin-database.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { Setting } from 'lib/models/setting.js'; -import { sprintf } from 'sprintf-js'; +const fs = require('fs-extra'); +const { Logger } = require('lib/logger.js'); +const { dirname } = require('lib/path-utils.js'); +const { DatabaseDriverNode } = require('lib/database-driver-node.js'); +const { JoplinDatabase } = require('lib/joplin-database.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { Setting } = require('lib/models/setting.js'); +const { sprintf } = require('sprintf-js'); const exec = require('child_process').exec process.on('unhandledRejection', (reason, p) => { diff --git a/CliClient/app/cli-utils.js b/CliClient/app/cli-utils.js index 501264bac..0b32dfee9 100644 --- a/CliClient/app/cli-utils.js +++ b/CliClient/app/cli-utils.js @@ -1,6 +1,6 @@ -import yargParser from 'yargs-parser'; -import { _ } from 'lib/locale.js'; -import { time } from 'lib/time-utils.js'; +const yargParser = require('yargs-parser'); +const { _ } = require('lib/locale.js'); +const { time } = require('lib/time-utils.js'); const stringPadding = require('string-padding'); const cliUtils = {}; diff --git a/CliClient/app/command-attach.js b/CliClient/app/command-attach.js index b1637ef25..5675040c6 100644 --- a/CliClient/app/command-attach.js +++ b/CliClient/app/command-attach.js @@ -1,12 +1,12 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { Resource } from 'lib/models/resource.js'; -import { uuid } from 'lib/uuid.js'; -import { filename } from 'lib/path-utils.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { Resource } = require('lib/models/resource.js'); +const { uuid } = require('lib/uuid.js'); +const { filename } = require('lib/path-utils.js'); const fs = require('fs-extra'); const mime = require('mime/lite'); diff --git a/CliClient/app/command-cat.js b/CliClient/app/command-cat.js index 32cfc7882..15db03fe0 100644 --- a/CliClient/app/command-cat.js +++ b/CliClient/app/command-cat.js @@ -1,9 +1,9 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-config.js b/CliClient/app/command-config.js index 04a673f3f..69cd50c38 100644 --- a/CliClient/app/command-config.js +++ b/CliClient/app/command-config.js @@ -1,7 +1,7 @@ -import { BaseCommand } from './base-command.js'; -import { _, setLocale } from 'lib/locale.js'; -import { app } from './app.js'; -import { Setting } from 'lib/models/setting.js'; +const { BaseCommand } = require('./base-command.js'); +const { _, setLocale } = require('lib/locale.js'); +const { app } = require('./app.js'); +const { Setting } = require('lib/models/setting.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-cp.js b/CliClient/app/command-cp.js index 2611e4439..9bef2918b 100644 --- a/CliClient/app/command-cp.js +++ b/CliClient/app/command-cp.js @@ -1,9 +1,9 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-done.js b/CliClient/app/command-done.js index 85ca23bfd..616cf77f9 100644 --- a/CliClient/app/command-done.js +++ b/CliClient/app/command-done.js @@ -1,10 +1,10 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { time } from 'lib/time-utils.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { time } = require('lib/time-utils.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-dump.js b/CliClient/app/command-dump.js index bb3085af3..61ec789b2 100644 --- a/CliClient/app/command-dump.js +++ b/CliClient/app/command-dump.js @@ -1,9 +1,9 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { Tag } from 'lib/models/tag.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { Tag } = require('lib/models/tag.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-edit.js b/CliClient/app/command-edit.js index 0428f00a8..483a86b46 100644 --- a/CliClient/app/command-edit.js +++ b/CliClient/app/command-edit.js @@ -1,14 +1,14 @@ -import fs from 'fs-extra'; -import { BaseCommand } from './base-command.js'; -import { uuid } from 'lib/uuid.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { Setting } from 'lib/models/setting.js'; -import { BaseModel } from 'lib/base-model.js'; -import { cliUtils } from './cli-utils.js'; -import { time } from 'lib/time-utils.js'; +const fs = require('fs-extra'); +const { BaseCommand } = require('./base-command.js'); +const { uuid } = require('lib/uuid.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { Setting } = require('lib/models/setting.js'); +const { BaseModel } = require('lib/base-model.js'); +const { cliUtils } = require('./cli-utils.js'); +const { time } = require('lib/time-utils.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-exit.js b/CliClient/app/command-exit.js index dcb4c249a..5d73513f1 100644 --- a/CliClient/app/command-exit.js +++ b/CliClient/app/command-exit.js @@ -1,6 +1,6 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-export.js b/CliClient/app/command-export.js index 7d930076b..798e3dc0c 100644 --- a/CliClient/app/command-export.js +++ b/CliClient/app/command-export.js @@ -1,11 +1,11 @@ -import { BaseCommand } from './base-command.js'; -import { Exporter } from 'lib/services/exporter.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Note } from 'lib/models/note.js'; -import { reg } from 'lib/registry.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import fs from 'fs-extra'; +const { BaseCommand } = require('./base-command.js'); +const { Exporter } = require('lib/services/exporter.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Note } = require('lib/models/note.js'); +const { reg } = require('lib/registry.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const fs = require('fs-extra'); class Command extends BaseCommand { diff --git a/CliClient/app/command-geoloc.js b/CliClient/app/command-geoloc.js index 2d54f7e5e..32aa9078f 100644 --- a/CliClient/app/command-geoloc.js +++ b/CliClient/app/command-geoloc.js @@ -1,9 +1,9 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-help.js b/CliClient/app/command-help.js index a500935be..a34e118bd 100644 --- a/CliClient/app/command-help.js +++ b/CliClient/app/command-help.js @@ -1,11 +1,11 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { renderCommandHelp } from './help-utils.js'; -import { Database } from 'lib/database.js'; -import { Setting } from 'lib/models/setting.js'; -import { wrap } from 'lib/string-utils.js'; -import { _ } from 'lib/locale.js'; -import { cliUtils } from './cli-utils.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { renderCommandHelp } = require('./help-utils.js'); +const { Database } = require('lib/database.js'); +const { Setting } = require('lib/models/setting.js'); +const { wrap } = require('lib/string-utils.js'); +const { _ } = require('lib/locale.js'); +const { cliUtils } = require('./cli-utils.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-import-enex.js b/CliClient/app/command-import-enex.js index 41d1cbae9..7e401c41c 100644 --- a/CliClient/app/command-import-enex.js +++ b/CliClient/app/command-import-enex.js @@ -1,10 +1,10 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { Folder } from 'lib/models/folder.js'; -import { importEnex } from 'import-enex'; -import { filename, basename } from 'lib/path-utils.js'; -import { cliUtils } from './cli-utils.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { Folder } = require('lib/models/folder.js'); +const { importEnex } = require('import-enex'); +const { filename, basename } = require('lib/path-utils.js'); +const { cliUtils } = require('./cli-utils.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-ls.js b/CliClient/app/command-ls.js index 62a7cd245..5429ba689 100644 --- a/CliClient/app/command-ls.js +++ b/CliClient/app/command-ls.js @@ -1,13 +1,13 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { Setting } from 'lib/models/setting.js'; -import { Note } from 'lib/models/note.js'; -import { sprintf } from 'sprintf-js'; -import { time } from 'lib/time-utils.js'; -import { cliUtils } from './cli-utils.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { Setting } = require('lib/models/setting.js'); +const { Note } = require('lib/models/note.js'); +const { sprintf } = require('sprintf-js'); +const { time } = require('lib/time-utils.js'); +const { cliUtils } = require('./cli-utils.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-mkbook.js b/CliClient/app/command-mkbook.js index 7dd6143c5..68e5df875 100644 --- a/CliClient/app/command-mkbook.js +++ b/CliClient/app/command-mkbook.js @@ -1,8 +1,8 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { Folder } from 'lib/models/folder.js'; -import { reg } from 'lib/registry.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { Folder } = require('lib/models/folder.js'); +const { reg } = require('lib/registry.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-mknote.js b/CliClient/app/command-mknote.js index e7df9d09b..a4d93b3ef 100644 --- a/CliClient/app/command-mknote.js +++ b/CliClient/app/command-mknote.js @@ -1,7 +1,7 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { Note } from 'lib/models/note.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { Note } = require('lib/models/note.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-mktodo.js b/CliClient/app/command-mktodo.js index 7d9c46d0e..6163928ee 100644 --- a/CliClient/app/command-mktodo.js +++ b/CliClient/app/command-mktodo.js @@ -1,7 +1,7 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { Note } from 'lib/models/note.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { Note } = require('lib/models/note.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-mv.js b/CliClient/app/command-mv.js index a91dc3674..9bf37a5c8 100644 --- a/CliClient/app/command-mv.js +++ b/CliClient/app/command-mv.js @@ -1,9 +1,9 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-ren.js b/CliClient/app/command-ren.js index d1053285a..2e09a5438 100644 --- a/CliClient/app/command-ren.js +++ b/CliClient/app/command-ren.js @@ -1,9 +1,9 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-rmbook.js b/CliClient/app/command-rmbook.js index 148435488..c5dc34597 100644 --- a/CliClient/app/command-rmbook.js +++ b/CliClient/app/command-rmbook.js @@ -1,11 +1,11 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { BaseItem } from 'lib/models/base-item.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { BaseModel } from 'lib/base-model.js'; -import { cliUtils } from './cli-utils.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { BaseItem } = require('lib/models/base-item.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { BaseModel } = require('lib/base-model.js'); +const { cliUtils } = require('./cli-utils.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-rmnote.js b/CliClient/app/command-rmnote.js index b89ae42f0..8ad657763 100644 --- a/CliClient/app/command-rmnote.js +++ b/CliClient/app/command-rmnote.js @@ -1,11 +1,11 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { BaseItem } from 'lib/models/base-item.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { BaseModel } from 'lib/base-model.js'; -import { cliUtils } from './cli-utils.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { BaseItem } = require('lib/models/base-item.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { BaseModel } = require('lib/base-model.js'); +const { cliUtils } = require('./cli-utils.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-search.js b/CliClient/app/command-search.js index 070911a0e..24031aee4 100644 --- a/CliClient/app/command-search.js +++ b/CliClient/app/command-search.js @@ -1,12 +1,12 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { sprintf } from 'sprintf-js'; -import { time } from 'lib/time-utils.js'; -import { uuid } from 'lib/uuid.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { sprintf } = require('sprintf-js'); +const { time } = require('lib/time-utils.js'); +const { uuid } = require('lib/uuid.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-set.js b/CliClient/app/command-set.js index ef8156900..37274be92 100644 --- a/CliClient/app/command-set.js +++ b/CliClient/app/command-set.js @@ -1,10 +1,10 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { BaseItem } from 'lib/models/base-item.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { BaseItem } = require('lib/models/base-item.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-status.js b/CliClient/app/command-status.js index b9f5310af..1b252e66f 100644 --- a/CliClient/app/command-status.js +++ b/CliClient/app/command-status.js @@ -1,9 +1,9 @@ -import { BaseCommand } from './base-command.js'; -import { Database } from 'lib/database.js'; -import { app } from './app.js'; -import { Setting } from 'lib/models/setting.js'; -import { _ } from 'lib/locale.js'; -import { ReportService } from 'lib/services/report.js'; +const { BaseCommand } = require('./base-command.js'); +const { Database } = require('lib/database.js'); +const { app } = require('./app.js'); +const { Setting } = require('lib/models/setting.js'); +const { _ } = require('lib/locale.js'); +const { ReportService } = require('lib/services/report.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-sync.js b/CliClient/app/command-sync.js index 05187cea3..ba21a9448 100644 --- a/CliClient/app/command-sync.js +++ b/CliClient/app/command-sync.js @@ -1,13 +1,13 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { OneDriveApiNodeUtils } from './onedrive-api-node-utils.js'; -import { Setting } from 'lib/models/setting.js'; -import { BaseItem } from 'lib/models/base-item.js'; -import { Synchronizer } from 'lib/synchronizer.js'; -import { reg } from 'lib/registry.js'; -import { cliUtils } from './cli-utils.js'; -import md5 from 'md5'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { OneDriveApiNodeUtils } = require('./onedrive-api-node-utils.js'); +const { Setting } = require('lib/models/setting.js'); +const { BaseItem } = require('lib/models/base-item.js'); +const { Synchronizer } = require('lib/synchronizer.js'); +const { reg } = require('lib/registry.js'); +const { cliUtils } = require('./cli-utils.js'); +const md5 = require('md5'); const locker = require('proper-lockfile'); const fs = require('fs-extra'); const osTmpdir = require('os-tmpdir'); diff --git a/CliClient/app/command-tag.js b/CliClient/app/command-tag.js index d04d34f23..110afdef4 100644 --- a/CliClient/app/command-tag.js +++ b/CliClient/app/command-tag.js @@ -1,8 +1,8 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { Tag } from 'lib/models/tag.js'; -import { BaseModel } from 'lib/base-model.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { Tag } = require('lib/models/tag.js'); +const { BaseModel } = require('lib/base-model.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-todo.js b/CliClient/app/command-todo.js index c9ef9484b..d31b7faeb 100644 --- a/CliClient/app/command-todo.js +++ b/CliClient/app/command-todo.js @@ -1,10 +1,10 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { time } from 'lib/time-utils.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { time } = require('lib/time-utils.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-undone.js b/CliClient/app/command-undone.js index 4e9faee6c..282a25dd5 100644 --- a/CliClient/app/command-undone.js +++ b/CliClient/app/command-undone.js @@ -1,10 +1,10 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { time } from 'lib/time-utils.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { time } = require('lib/time-utils.js'); const CommandDone = require('./command-done.js'); diff --git a/CliClient/app/command-use.js b/CliClient/app/command-use.js index dfbf5ed4d..91157c10a 100644 --- a/CliClient/app/command-use.js +++ b/CliClient/app/command-use.js @@ -1,8 +1,8 @@ -import { BaseCommand } from './base-command.js'; -import { app } from './app.js'; -import { _ } from 'lib/locale.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; +const { BaseCommand } = require('./base-command.js'); +const { app } = require('./app.js'); +const { _ } = require('lib/locale.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); class Command extends BaseCommand { diff --git a/CliClient/app/command-version.js b/CliClient/app/command-version.js index a54e9680c..cfb9bc11a 100644 --- a/CliClient/app/command-version.js +++ b/CliClient/app/command-version.js @@ -1,6 +1,6 @@ -import { BaseCommand } from './base-command.js'; -import { Setting } from 'lib/models/setting.js' -import { _ } from 'lib/locale.js'; +const { BaseCommand } = require('./base-command.js'); +const { Setting } = require('lib/models/setting.js'); +const { _ } = require('lib/locale.js'); class Command extends BaseCommand { diff --git a/CliClient/app/fuzzing.js b/CliClient/app/fuzzing.js index 1d247959e..e9b72e0d9 100644 --- a/CliClient/app/fuzzing.js +++ b/CliClient/app/fuzzing.js @@ -3,12 +3,12 @@ require('source-map-support').install(); require('babel-plugin-transform-runtime'); -import { time } from 'lib/time-utils.js'; -import { Logger } from 'lib/logger.js'; -import { Resource } from 'lib/models/resource.js'; -import { dirname } from 'lib/path-utils.js'; -import { FsDriverNode } from './fs-driver-node.js'; -import lodash from 'lodash'; +const { time } = require('lib/time-utils.js'); +const { Logger } = require('lib/logger.js'); +const { Resource } = require('lib/models/resource.js'); +const { dirname } = require('lib/path-utils.js'); +const { FsDriverNode } = require('./fs-driver-node.js'); +const lodash = require('lodash'); const exec = require('child_process').exec const fs = require('fs-extra'); diff --git a/CliClient/app/help-utils.js b/CliClient/app/help-utils.js index 3a76afb97..bd061ba74 100644 --- a/CliClient/app/help-utils.js +++ b/CliClient/app/help-utils.js @@ -1,11 +1,11 @@ require('source-map-support').install(); require('babel-plugin-transform-runtime'); -import fs from 'fs-extra'; -import { wrap } from 'lib/string-utils.js'; -import { Setting } from 'lib/models/setting.js'; -import { fileExtension, basename, dirname } from 'lib/path-utils.js'; -import { _, setLocale, languageCode } from 'lib/locale.js'; +const fs = require('fs-extra'); +const { wrap } = require('lib/string-utils.js'); +const { Setting } = require('lib/models/setting.js'); +const { fileExtension, basename, dirname } = require('lib/path-utils.js'); +const { _, setLocale, languageCode } = require('lib/locale.js'); const rootDir = dirname(dirname(__dirname)); const MAX_WIDTH = 78; diff --git a/CliClient/app/import-enex-md-gen.js b/CliClient/app/import-enex-md-gen.js index 0f22fe33b..b27e4a034 100644 --- a/CliClient/app/import-enex-md-gen.js +++ b/CliClient/app/import-enex-md-gen.js @@ -1,4 +1,4 @@ -import stringPadding from 'string-padding'; +const stringPadding = require('string-padding'); const BLOCK_OPEN = "[[BLOCK_OPEN]]"; const BLOCK_CLOSE = "[[BLOCK_CLOSE]]"; diff --git a/CliClient/app/import-enex.js b/CliClient/app/import-enex.js index 6a9ab7a8c..c657b620b 100644 --- a/CliClient/app/import-enex.js +++ b/CliClient/app/import-enex.js @@ -1,16 +1,16 @@ -import { uuid } from 'lib/uuid.js'; -import moment from 'moment'; -import { promiseChain } from 'lib/promise-utils.js'; -import { folderItemFilename } from 'lib/string-utils.js' -import { BaseModel } from 'lib/base-model.js'; -import { Note } from 'lib/models/note.js'; -import { Tag } from 'lib/models/tag.js'; -import { Resource } from 'lib/models/resource.js'; -import { Folder } from 'lib/models/folder.js'; -import { enexXmlToMd } from './import-enex-md-gen.js'; -import { time } from 'lib/time-utils.js'; -import Levenshtein from 'levenshtein'; -import jsSHA from "jssha"; +const { uuid } = require('lib/uuid.js'); +const moment = require('moment'); +const { promiseChain } = require('lib/promise-utils.js'); +const { folderItemFilename } = require('lib/string-utils.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Note } = require('lib/models/note.js'); +const { Tag } = require('lib/models/tag.js'); +const { Resource } = require('lib/models/resource.js'); +const { Folder } = require('lib/models/folder.js'); +const { enexXmlToMd } = require('./import-enex-md-gen.js'); +const { time } = require('lib/time-utils.js'); +const Levenshtein = require('levenshtein'); +const jsSHA = require("jssha"); const Promise = require('promise'); const fs = require('fs-extra'); diff --git a/CliClient/app/main.js b/CliClient/app/main.js index 4e495d5bf..8fb5033dc 100644 --- a/CliClient/app/main.js +++ b/CliClient/app/main.js @@ -5,19 +5,19 @@ require('source-map-support').install(); require('babel-plugin-transform-runtime'); -import { app } from './app.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { Resource } from 'lib/models/resource.js'; -import { BaseItem } from 'lib/models/base-item.js'; -import { Note } from 'lib/models/note.js'; -import { Tag } from 'lib/models/tag.js'; -import { NoteTag } from 'lib/models/note-tag.js'; -import { Setting } from 'lib/models/setting.js'; -import { Logger } from 'lib/logger.js'; -import { FsDriverNode } from './fs-driver-node.js'; -import { shimInit } from 'lib/shim-init-node.js'; -import { _ } from 'lib/locale.js'; +const { app } = require('./app.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { Resource } = require('lib/models/resource.js'); +const { BaseItem } = require('lib/models/base-item.js'); +const { Note } = require('lib/models/note.js'); +const { Tag } = require('lib/models/tag.js'); +const { NoteTag } = require('lib/models/note-tag.js'); +const { Setting } = require('lib/models/setting.js'); +const { Logger } = require('lib/logger.js'); +const { FsDriverNode } = require('./fs-driver-node.js'); +const { shimInit } = require('lib/shim-init-node.js'); +const { _ } = require('lib/locale.js'); const fsDriver = new FsDriverNode(); Logger.fsDriver_ = fsDriver; diff --git a/CliClient/app/onedrive-api-node-utils.js b/CliClient/app/onedrive-api-node-utils.js index 29f0bb85c..b139d507a 100644 --- a/CliClient/app/onedrive-api-node-utils.js +++ b/CliClient/app/onedrive-api-node-utils.js @@ -1,5 +1,5 @@ -import { _ } from 'lib/locale.js' -import { netUtils } from 'lib/net-utils.js' +const { _ } = require('lib/locale.js'); +const { netUtils } = require('lib/net-utils.js'); const http = require("http"); const urlParser = require("url"); diff --git a/CliClient/tests/base-model.js b/CliClient/tests/base-model.js index 5fa29dbcb..a4b690add 100644 --- a/CliClient/tests/base-model.js +++ b/CliClient/tests/base-model.js @@ -1,10 +1,10 @@ -import { time } from 'lib/time-utils.js'; -import { setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient } from 'test-utils.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { Setting } from 'lib/models/setting.js'; -import { BaseItem } from 'lib/models/base-item.js'; -import { BaseModel } from 'lib/base-model.js'; +const { time } = require('lib/time-utils.js'); +const { setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient } = require('test-utils.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { Setting } = require('lib/models/setting.js'); +const { BaseItem } = require('lib/models/base-item.js'); +const { BaseModel } = require('lib/base-model.js'); process.on('unhandledRejection', (reason, p) => { console.error('Unhandled promise rejection at: Promise', p, 'reason:', reason); diff --git a/CliClient/tests/synchronizer.js b/CliClient/tests/synchronizer.js index 5cc82fdad..491d54b0e 100644 --- a/CliClient/tests/synchronizer.js +++ b/CliClient/tests/synchronizer.js @@ -1,15 +1,15 @@ require('source-map-support').install(); require('babel-plugin-transform-runtime'); -import { time } from 'lib/time-utils.js'; -import { setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId } from 'test-utils.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { Tag } from 'lib/models/tag.js'; -import { Database } from 'lib/database.js'; -import { Setting } from 'lib/models/setting.js'; -import { BaseItem } from 'lib/models/base-item.js'; -import { BaseModel } from 'lib/base-model.js'; +const { time } = require('lib/time-utils.js'); +const { setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId } = require('test-utils.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { Tag } = require('lib/models/tag.js'); +const { Database } = require('lib/database.js'); +const { Setting } = require('lib/models/setting.js'); +const { BaseItem } = require('lib/models/base-item.js'); +const { BaseModel } = require('lib/base-model.js'); process.on('unhandledRejection', (reason, p) => { console.log('Unhandled Rejection at: Promise', p, 'reason:', reason); diff --git a/CliClient/tests/test-utils.js b/CliClient/tests/test-utils.js index c8090f240..96b84db9f 100644 --- a/CliClient/tests/test-utils.js +++ b/CliClient/tests/test-utils.js @@ -1,21 +1,21 @@ -import fs from 'fs-extra'; -import { JoplinDatabase } from 'lib/joplin-database.js'; -import { DatabaseDriverNode } from 'lib/database-driver-node.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { Resource } from 'lib/models/resource.js'; -import { Tag } from 'lib/models/tag.js'; -import { NoteTag } from 'lib/models/note-tag.js'; -import { Logger } from 'lib/logger.js'; -import { Setting } from 'lib/models/setting.js'; -import { BaseItem } from 'lib/models/base-item.js'; -import { Synchronizer } from 'lib/synchronizer.js'; -import { FileApi } from 'lib/file-api.js'; -import { FileApiDriverMemory } from 'lib/file-api-driver-memory.js'; -import { FileApiDriverLocal } from 'lib/file-api-driver-local.js'; -import { FsDriverNode } from '../app/fs-driver-node.js'; -import { time } from 'lib/time-utils.js'; +const fs = require('fs-extra'); +const { JoplinDatabase } = require('lib/joplin-database.js'); +const { DatabaseDriverNode } = require('lib/database-driver-node.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { Resource } = require('lib/models/resource.js'); +const { Tag } = require('lib/models/tag.js'); +const { NoteTag } = require('lib/models/note-tag.js'); +const { Logger } = require('lib/logger.js'); +const { Setting } = require('lib/models/setting.js'); +const { BaseItem } = require('lib/models/base-item.js'); +const { Synchronizer } = require('lib/synchronizer.js'); +const { FileApi } = require('lib/file-api.js'); +const { FileApiDriverMemory } = require('lib/file-api-driver-memory.js'); +const { FileApiDriverLocal } = require('lib/file-api-driver-local.js'); +const { FsDriverNode } = require('../app/fs-driver-node.js'); +const { time } = require('lib/time-utils.js'); let databases_ = []; let synchronizers_ = []; diff --git a/ReactNativeClient/index.android.js b/ReactNativeClient/index.android.js index 755795182..d0e4f551b 100644 --- a/ReactNativeClient/index.android.js +++ b/ReactNativeClient/index.android.js @@ -1,3 +1,3 @@ -import { main } from './main.js'; +const { main } = require('./main.js'); main(); \ No newline at end of file diff --git a/ReactNativeClient/index.ios.js b/ReactNativeClient/index.ios.js index addb4dcfa..cefa0f527 100644 --- a/ReactNativeClient/index.ios.js +++ b/ReactNativeClient/index.ios.js @@ -4,7 +4,7 @@ * @flow */ -import React, { Component } from 'react'; +const React = require('react'); const Component = React.Component; import { AppRegistry, StyleSheet, diff --git a/ReactNativeClient/lib/base-model.js b/ReactNativeClient/lib/base-model.js index e92eac07e..fa369b461 100644 --- a/ReactNativeClient/lib/base-model.js +++ b/ReactNativeClient/lib/base-model.js @@ -1,7 +1,7 @@ -import { Log } from 'lib/log.js'; -import { Database } from 'lib/database.js'; -import { uuid } from 'lib/uuid.js'; -import { time } from 'lib/time-utils.js'; +const { Log } = require('lib/log.js'); +const { Database } = require('lib/database.js'); +const { uuid } = require('lib/uuid.js'); +const { time } = require('lib/time-utils.js'); class BaseModel { diff --git a/ReactNativeClient/lib/components/action-button.js b/ReactNativeClient/lib/components/action-button.js index 82af43980..7ac38a2fd 100644 --- a/ReactNativeClient/lib/components/action-button.js +++ b/ReactNativeClient/lib/components/action-button.js @@ -1,11 +1,11 @@ -import React, { Component } from 'react'; -import { StyleSheet, Text } from 'react-native'; -import Icon from 'react-native-vector-icons/Ionicons'; -import ReactNativeActionButton from 'react-native-action-button'; -import { connect } from 'react-redux' -import { globalStyle } from 'lib/components/global-style.js' -import { Log } from 'lib/log.js' -import { _ } from 'lib/locale.js' +const React = require('react'); const Component = React.Component; +const { StyleSheet, Text } = require('react-native'); +const Icon = require('react-native-vector-icons/Ionicons').default; +const ReactNativeActionButton = require('react-native-action-button').default; +const { connect } = require('react-redux'); +const { globalStyle } = require('lib/components/global-style.js'); +const { Log } = require('lib/log.js'); +const { _ } = require('lib/locale.js'); const styles = StyleSheet.create({ actionButtonIcon: { diff --git a/ReactNativeClient/lib/components/app-nav.js b/ReactNativeClient/lib/components/app-nav.js index da4f0389c..95da8be5b 100644 --- a/ReactNativeClient/lib/components/app-nav.js +++ b/ReactNativeClient/lib/components/app-nav.js @@ -1,10 +1,10 @@ -import React, { Component } from 'react'; -import { connect } from 'react-redux' -import { NotesScreen } from 'lib/components/screens/notes.js'; -import { SearchScreen } from 'lib/components/screens/search.js'; -import { View } from 'react-native'; -import { _ } from 'lib/locale.js'; -import { themeStyle } from 'lib/components/global-style.js'; +const React = require('react'); const Component = React.Component; +const { connect } = require('react-redux'); +const { NotesScreen } = require('lib/components/screens/notes.js'); +const { SearchScreen } = require('lib/components/screens/search.js'); +const { View } = require('react-native'); +const { _ } = require('lib/locale.js'); +const { themeStyle } = require('lib/components/global-style.js'); class AppNavComponent extends Component { diff --git a/ReactNativeClient/lib/components/base-screen.js b/ReactNativeClient/lib/components/base-screen.js index 35778071f..f0fad156b 100644 --- a/ReactNativeClient/lib/components/base-screen.js +++ b/ReactNativeClient/lib/components/base-screen.js @@ -1,6 +1,6 @@ -import React, { Component } from 'react'; -import { StyleSheet } from 'react-native'; -import { globalStyle, themeStyle } from 'lib/components/global-style.js'; +const React = require('react'); const Component = React.Component; +const { StyleSheet } = require('react-native'); +const { globalStyle, themeStyle } = require('lib/components/global-style.js'); const styleObject_ = { screen: { diff --git a/ReactNativeClient/lib/components/checkbox.js b/ReactNativeClient/lib/components/checkbox.js index 9f8b18c93..8e62381bf 100644 --- a/ReactNativeClient/lib/components/checkbox.js +++ b/ReactNativeClient/lib/components/checkbox.js @@ -1,6 +1,6 @@ -import React, { Component } from 'react'; -import { StyleSheet, TouchableHighlight } from 'react-native'; -import Icon from 'react-native-vector-icons/Ionicons'; +const React = require('react'); const Component = React.Component; +const { StyleSheet, TouchableHighlight } = require('react-native'); +const Icon = require('react-native-vector-icons/Ionicons').default; const styles = { checkboxIcon: { diff --git a/ReactNativeClient/lib/components/global-style.js b/ReactNativeClient/lib/components/global-style.js index 3d1b243b3..09755950a 100644 --- a/ReactNativeClient/lib/components/global-style.js +++ b/ReactNativeClient/lib/components/global-style.js @@ -1,4 +1,4 @@ -import { Setting } from 'lib/models/setting.js'; +const { Setting } = require('lib/models/setting.js'); const globalStyle = { fontSize: 16, diff --git a/ReactNativeClient/lib/components/note-body-viewer.js b/ReactNativeClient/lib/components/note-body-viewer.js index 304e139ac..2fb8a1948 100644 --- a/ReactNativeClient/lib/components/note-body-viewer.js +++ b/ReactNativeClient/lib/components/note-body-viewer.js @@ -1,10 +1,10 @@ -import React, { Component } from 'react'; -import { WebView, View, Linking } from 'react-native'; -import { globalStyle } from 'lib/components/global-style.js'; -import { Resource } from 'lib/models/resource.js'; -import { shim } from 'lib/shim.js'; -import { reg } from 'lib/registry.js'; -import marked from 'lib/marked.js'; +const React = require('react'); const Component = React.Component; +const { WebView, View, Linking } = require('react-native'); +const { globalStyle } = require('lib/components/global-style.js'); +const { Resource } = require('lib/models/resource.js'); +const { shim } = require('lib/shim.js'); +const { reg } = require('lib/registry.js'); +const marked = require('lib/marked.js'); const Entities = require('html-entities').AllHtmlEntities; const htmlentities = (new Entities()).encode; diff --git a/ReactNativeClient/lib/components/note-item.js b/ReactNativeClient/lib/components/note-item.js index 948b9700f..b8fae63d4 100644 --- a/ReactNativeClient/lib/components/note-item.js +++ b/ReactNativeClient/lib/components/note-item.js @@ -1,13 +1,13 @@ -import React, { Component } from 'react'; -import { connect } from 'react-redux' -import { ListView, Text, TouchableHighlight, View, StyleSheet } from 'react-native'; -import { Log } from 'lib/log.js'; -import { _ } from 'lib/locale.js'; -import { Checkbox } from 'lib/components/checkbox.js'; -import { reg } from 'lib/registry.js'; -import { Note } from 'lib/models/note.js'; -import { time } from 'lib/time-utils.js'; -import { globalStyle, themeStyle } from 'lib/components/global-style.js'; +const React = require('react'); const Component = React.Component; +const { connect } = require('react-redux'); +const { ListView, Text, TouchableHighlight, View, StyleSheet } = require('react-native'); +const { Log } = require('lib/log.js'); +const { _ } = require('lib/locale.js'); +const { Checkbox } = require('lib/components/checkbox.js'); +const { reg } = require('lib/registry.js'); +const { Note } = require('lib/models/note.js'); +const { time } = require('lib/time-utils.js'); +const { globalStyle, themeStyle } = require('lib/components/global-style.js'); class NoteItemComponent extends Component { diff --git a/ReactNativeClient/lib/components/note-list.js b/ReactNativeClient/lib/components/note-list.js index 9911f2cbd..018d120c4 100644 --- a/ReactNativeClient/lib/components/note-list.js +++ b/ReactNativeClient/lib/components/note-list.js @@ -1,15 +1,15 @@ -import React, { Component } from 'react'; -import { connect } from 'react-redux' -import { ListView, Text, TouchableHighlight, Switch, View, StyleSheet } from 'react-native'; -import { Log } from 'lib/log.js'; -import { _ } from 'lib/locale.js'; -import { Checkbox } from 'lib/components/checkbox.js'; -import { NoteItem } from 'lib/components/note-item.js'; -import { reg } from 'lib/registry.js'; -import { Note } from 'lib/models/note.js'; -import { Setting } from 'lib/models/setting.js'; -import { time } from 'lib/time-utils.js'; -import { themeStyle } from 'lib/components/global-style.js'; +const React = require('react'); const Component = React.Component; +const { connect } = require('react-redux'); +const { ListView, Text, TouchableHighlight, Switch, View, StyleSheet } = require('react-native'); +const { Log } = require('lib/log.js'); +const { _ } = require('lib/locale.js'); +const { Checkbox } = require('lib/components/checkbox.js'); +const { NoteItem } = require('lib/components/note-item.js'); +const { reg } = require('lib/registry.js'); +const { Note } = require('lib/models/note.js'); +const { Setting } = require('lib/models/setting.js'); +const { time } = require('lib/time-utils.js'); +const { themeStyle } = require('lib/components/global-style.js'); class NoteListComponent extends Component { diff --git a/ReactNativeClient/lib/components/screen-header.js b/ReactNativeClient/lib/components/screen-header.js index 643878a02..eca2f3ac4 100644 --- a/ReactNativeClient/lib/components/screen-header.js +++ b/ReactNativeClient/lib/components/screen-header.js @@ -1,16 +1,16 @@ -import React, { Component } from 'react'; -import { connect } from 'react-redux' -import { View, Text, Button, StyleSheet, TouchableOpacity, Picker, Image } from 'react-native'; -import Icon from 'react-native-vector-icons/Ionicons'; -import { Log } from 'lib/log.js'; -import { BackButtonService } from 'lib/services/back-button.js'; -import { Menu, MenuOptions, MenuOption, MenuTrigger } from 'react-native-popup-menu'; -import { _ } from 'lib/locale.js'; -import { Setting } from 'lib/models/setting.js'; -import { FileApi } from 'lib/file-api.js'; -import { FileApiDriverOneDrive } from 'lib/file-api-driver-onedrive.js'; -import { reg } from 'lib/registry.js' -import { themeStyle } from 'lib/components/global-style.js'; +const React = require('react'); const Component = React.Component; +const { connect } = require('react-redux'); +const { View, Text, Button, StyleSheet, TouchableOpacity, Picker, Image } = require('react-native'); +const Icon = require('react-native-vector-icons/Ionicons').default; +const { Log } = require('lib/log.js'); +const { BackButtonService } = require('lib/services/back-button.js'); +const { Menu, MenuOptions, MenuOption, MenuTrigger } = require('react-native-popup-menu'); +const { _ } = require('lib/locale.js'); +const { Setting } = require('lib/models/setting.js'); +const { FileApi } = require('lib/file-api.js'); +const { FileApiDriverOneDrive } = require('lib/file-api-driver-onedrive.js'); +const { reg } = require('lib/registry.js'); +const { themeStyle } = require('lib/components/global-style.js'); // Rather than applying a padding to the whole bar, it is applied to each // individual component (button, picker, etc.) so that the touchable areas diff --git a/ReactNativeClient/lib/components/screens/config.js b/ReactNativeClient/lib/components/screens/config.js index bfbaeab40..23c60c295 100644 --- a/ReactNativeClient/lib/components/screens/config.js +++ b/ReactNativeClient/lib/components/screens/config.js @@ -1,11 +1,11 @@ -import React, { Component } from 'react'; -import { View, Switch, Slider, StyleSheet, Picker, Text, Button } from 'react-native'; -import { connect } from 'react-redux' -import { ScreenHeader } from 'lib/components/screen-header.js'; -import { _, setLocale } from 'lib/locale.js'; -import { BaseScreenComponent } from 'lib/components/base-screen.js'; -import { themeStyle } from 'lib/components/global-style.js'; -import { Setting } from 'lib/models/setting.js'; +const React = require('react'); const Component = React.Component; +const { View, Switch, Slider, StyleSheet, Picker, Text, Button } = require('react-native'); +const { connect } = require('react-redux'); +const { ScreenHeader } = require('lib/components/screen-header.js'); +const { _, setLocale } = require('lib/locale.js'); +const { BaseScreenComponent } = require('lib/components/base-screen.js'); +const { themeStyle } = require('lib/components/global-style.js'); +const { Setting } = require('lib/models/setting.js'); class ConfigScreenComponent extends BaseScreenComponent { diff --git a/ReactNativeClient/lib/components/screens/folder.js b/ReactNativeClient/lib/components/screens/folder.js index 67d0bc27f..4ab4714f8 100644 --- a/ReactNativeClient/lib/components/screens/folder.js +++ b/ReactNativeClient/lib/components/screens/folder.js @@ -1,16 +1,16 @@ -import React, { Component } from 'react'; -import { View, Button, TextInput, StyleSheet } from 'react-native'; -import { connect } from 'react-redux' -import { Log } from 'lib/log.js' -import { ActionButton } from 'lib/components/action-button.js'; -import { Folder } from 'lib/models/folder.js' -import { BaseModel } from 'lib/base-model.js' -import { ScreenHeader } from 'lib/components/screen-header.js'; -import { reg } from 'lib/registry.js'; -import { BaseScreenComponent } from 'lib/components/base-screen.js'; -import { dialogs } from 'lib/dialogs.js'; -import { themeStyle } from 'lib/components/global-style.js'; -import { _ } from 'lib/locale.js'; +const React = require('react'); const Component = React.Component; +const { View, Button, TextInput, StyleSheet } = require('react-native'); +const { connect } = require('react-redux'); +const { Log } = require('lib/log.js'); +const { ActionButton } = require('lib/components/action-button.js'); +const { Folder } = require('lib/models/folder.js'); +const { BaseModel } = require('lib/base-model.js'); +const { ScreenHeader } = require('lib/components/screen-header.js'); +const { reg } = require('lib/registry.js'); +const { BaseScreenComponent } = require('lib/components/base-screen.js'); +const { dialogs } = require('lib/dialogs.js'); +const { themeStyle } = require('lib/components/global-style.js'); +const { _ } = require('lib/locale.js'); class FolderScreenComponent extends BaseScreenComponent { diff --git a/ReactNativeClient/lib/components/screens/log.js b/ReactNativeClient/lib/components/screens/log.js index 238b54050..aedc5694c 100644 --- a/ReactNativeClient/lib/components/screens/log.js +++ b/ReactNativeClient/lib/components/screens/log.js @@ -1,14 +1,14 @@ -import React, { Component } from 'react'; -import { ListView, View, Text, Button, StyleSheet } from 'react-native'; -import { connect } from 'react-redux' -import { Log } from 'lib/log.js' -import { reg } from 'lib/registry.js' -import { ScreenHeader } from 'lib/components/screen-header.js'; -import { time } from 'lib/time-utils' -import { themeStyle } from 'lib/components/global-style.js'; -import { Logger } from 'lib/logger.js'; -import { BaseScreenComponent } from 'lib/components/base-screen.js'; -import { _ } from 'lib/locale.js'; +const React = require('react'); const Component = React.Component; +const { ListView, View, Text, Button, StyleSheet } = require('react-native'); +const { connect } = require('react-redux'); +const { Log } = require('lib/log.js'); +const { reg } = require('lib/registry.js'); +const { ScreenHeader } = require('lib/components/screen-header.js'); +const { time } = require('lib/time-utils'); +const { themeStyle } = require('lib/components/global-style.js'); +const { Logger } = require('lib/logger.js'); +const { BaseScreenComponent } = require('lib/components/base-screen.js'); +const { _ } = require('lib/locale.js'); class LogScreenComponent extends BaseScreenComponent { diff --git a/ReactNativeClient/lib/components/screens/note.js b/ReactNativeClient/lib/components/screens/note.js index ada2927dd..ebe179e71 100644 --- a/ReactNativeClient/lib/components/screens/note.js +++ b/ReactNativeClient/lib/components/screens/note.js @@ -1,29 +1,29 @@ -import React, { Component } from 'react'; -import { Keyboard, BackHandler, View, Button, TextInput, WebView, Text, StyleSheet, Linking, Image } from 'react-native'; -import { connect } from 'react-redux' -import { uuid } from 'lib/uuid.js'; -import { Log } from 'lib/log.js' -import { Note } from 'lib/models/note.js' -import { Resource } from 'lib/models/resource.js' -import { Folder } from 'lib/models/folder.js' -import { BackButtonService } from 'lib/services/back-button.js'; -import { BaseModel } from 'lib/base-model.js' -import { ActionButton } from 'lib/components/action-button.js'; -import Icon from 'react-native-vector-icons/Ionicons'; -import { ScreenHeader } from 'lib/components/screen-header.js'; -import { time } from 'lib/time-utils.js'; -import { Checkbox } from 'lib/components/checkbox.js' -import { _ } from 'lib/locale.js'; -import { reg } from 'lib/registry.js'; -import { shim } from 'lib/shim.js'; -import { BaseScreenComponent } from 'lib/components/base-screen.js'; -import { dialogs } from 'lib/dialogs.js'; -import { globalStyle, themeStyle } from 'lib/components/global-style.js'; -import DialogBox from 'react-native-dialogbox'; -import { NoteBodyViewer } from 'lib/components/note-body-viewer.js'; -import RNFetchBlob from 'react-native-fetch-blob'; -import { DocumentPicker, DocumentPickerUtil } from 'react-native-document-picker'; -import ImageResizer from 'react-native-image-resizer'; +const React = require('react'); const Component = React.Component; +const { Keyboard, BackHandler, View, Button, TextInput, WebView, Text, StyleSheet, Linking, Image } = require('react-native'); +const { connect } = require('react-redux'); +const { uuid } = require('lib/uuid.js'); +const { Log } = require('lib/log.js'); +const { Note } = require('lib/models/note.js'); +const { Resource } = require('lib/models/resource.js'); +const { Folder } = require('lib/models/folder.js'); +const { BackButtonService } = require('lib/services/back-button.js'); +const { BaseModel } = require('lib/base-model.js'); +const { ActionButton } = require('lib/components/action-button.js'); +const Icon = require('react-native-vector-icons/Ionicons').default; +const { ScreenHeader } = require('lib/components/screen-header.js'); +const { time } = require('lib/time-utils.js'); +const { Checkbox } = require('lib/components/checkbox.js'); +const { _ } = require('lib/locale.js'); +const { reg } = require('lib/registry.js'); +const { shim } = require('lib/shim.js'); +const { BaseScreenComponent } = require('lib/components/base-screen.js'); +const { dialogs } = require('lib/dialogs.js'); +const { globalStyle, themeStyle } = require('lib/components/global-style.js'); +const DialogBox = require('react-native-dialogbox').default; +const { NoteBodyViewer } = require('lib/components/note-body-viewer.js'); +const RNFetchBlob = require('react-native-fetch-blob').default; +const { DocumentPicker, DocumentPickerUtil } = require('react-native-document-picker'); +const ImageResizer = require('react-native-image-resizer').default; class NoteScreenComponent extends BaseScreenComponent { diff --git a/ReactNativeClient/lib/components/screens/notes.js b/ReactNativeClient/lib/components/screens/notes.js index b34530516..a293063d0 100644 --- a/ReactNativeClient/lib/components/screens/notes.js +++ b/ReactNativeClient/lib/components/screens/notes.js @@ -1,21 +1,21 @@ -import React, { Component } from 'react'; -import { View, Button, Picker } from 'react-native'; -import { connect } from 'react-redux' -import { reg } from 'lib/registry.js'; -import { Log } from 'lib/log.js' -import { NoteList } from 'lib/components/note-list.js' -import { Folder } from 'lib/models/folder.js' -import { Tag } from 'lib/models/tag.js' -import { Note } from 'lib/models/note.js' -import { Setting } from 'lib/models/setting.js' -import { themeStyle } from 'lib/components/global-style.js'; -import { ScreenHeader } from 'lib/components/screen-header.js'; -import { MenuOption, Text } from 'react-native-popup-menu'; -import { _ } from 'lib/locale.js'; -import { ActionButton } from 'lib/components/action-button.js'; -import { dialogs } from 'lib/dialogs.js'; -import DialogBox from 'react-native-dialogbox'; -import { BaseScreenComponent } from 'lib/components/base-screen.js'; +const React = require('react'); const Component = React.Component; +const { View, Button, Picker } = require('react-native'); +const { connect } = require('react-redux'); +const { reg } = require('lib/registry.js'); +const { Log } = require('lib/log.js'); +const { NoteList } = require('lib/components/note-list.js'); +const { Folder } = require('lib/models/folder.js'); +const { Tag } = require('lib/models/tag.js'); +const { Note } = require('lib/models/note.js'); +const { Setting } = require('lib/models/setting.js'); +const { themeStyle } = require('lib/components/global-style.js'); +const { ScreenHeader } = require('lib/components/screen-header.js'); +const { MenuOption, Text } = require('react-native-popup-menu'); +const { _ } = require('lib/locale.js'); +const { ActionButton } = require('lib/components/action-button.js'); +const { dialogs } = require('lib/dialogs.js'); +const DialogBox = require('react-native-dialogbox').default; +const { BaseScreenComponent } = require('lib/components/base-screen.js'); class NotesScreenComponent extends BaseScreenComponent { diff --git a/ReactNativeClient/lib/components/screens/onedrive-login.js b/ReactNativeClient/lib/components/screens/onedrive-login.js index 5ae02fddc..041fe6157 100644 --- a/ReactNativeClient/lib/components/screens/onedrive-login.js +++ b/ReactNativeClient/lib/components/screens/onedrive-login.js @@ -1,13 +1,13 @@ -import React, { Component } from 'react'; -import { View } from 'react-native'; -import { WebView, Button, Text } from 'react-native'; -import { connect } from 'react-redux' -import { Log } from 'lib/log.js' -import { Setting } from 'lib/models/setting.js' -import { ScreenHeader } from 'lib/components/screen-header.js'; -import { reg } from 'lib/registry.js'; -import { _ } from 'lib/locale.js'; -import { BaseScreenComponent } from 'lib/components/base-screen.js'; +const React = require('react'); const Component = React.Component; +const { View } = require('react-native'); +const { WebView, Button, Text } = require('react-native'); +const { connect } = require('react-redux'); +const { Log } = require('lib/log.js'); +const { Setting } = require('lib/models/setting.js'); +const { ScreenHeader } = require('lib/components/screen-header.js'); +const { reg } = require('lib/registry.js'); +const { _ } = require('lib/locale.js'); +const { BaseScreenComponent } = require('lib/components/base-screen.js'); class OneDriveLoginScreenComponent extends BaseScreenComponent { diff --git a/ReactNativeClient/lib/components/screens/search.js b/ReactNativeClient/lib/components/screens/search.js index 90e708639..1b98568d8 100644 --- a/ReactNativeClient/lib/components/screens/search.js +++ b/ReactNativeClient/lib/components/screens/search.js @@ -1,13 +1,13 @@ -import React, { Component } from 'react'; -import { ListView, StyleSheet, View, TextInput, FlatList, TouchableHighlight } from 'react-native'; -import { connect } from 'react-redux' -import { ScreenHeader } from 'lib/components/screen-header.js'; -import Icon from 'react-native-vector-icons/Ionicons'; -import { _ } from 'lib/locale.js'; -import { Note } from 'lib/models/note.js'; -import { NoteItem } from 'lib/components/note-item.js'; -import { BaseScreenComponent } from 'lib/components/base-screen.js'; -import { themeStyle } from 'lib/components/global-style.js'; +const React = require('react'); const Component = React.Component; +const { ListView, StyleSheet, View, TextInput, FlatList, TouchableHighlight } = require('react-native'); +const { connect } = require('react-redux'); +const { ScreenHeader } = require('lib/components/screen-header.js'); +const Icon = require('react-native-vector-icons/Ionicons').default; +const { _ } = require('lib/locale.js'); +const { Note } = require('lib/models/note.js'); +const { NoteItem } = require('lib/components/note-item.js'); +const { BaseScreenComponent } = require('lib/components/base-screen.js'); +const { themeStyle } = require('lib/components/global-style.js'); class SearchScreenComponent extends BaseScreenComponent { diff --git a/ReactNativeClient/lib/components/screens/status.js b/ReactNativeClient/lib/components/screens/status.js index 738412bd6..7fc23d0b3 100644 --- a/ReactNativeClient/lib/components/screens/status.js +++ b/ReactNativeClient/lib/components/screens/status.js @@ -1,19 +1,19 @@ -import React, { Component } from 'react'; -import { ListView, StyleSheet, View, Text, Button, FlatList } from 'react-native'; -import { Setting } from 'lib/models/setting.js'; -import { connect } from 'react-redux' -import { Log } from 'lib/log.js' -import { reg } from 'lib/registry.js' -import { ScreenHeader } from 'lib/components/screen-header.js'; -import { time } from 'lib/time-utils' -import { Logger } from 'lib/logger.js'; -import { BaseItem } from 'lib/models/base-item.js'; -import { Database } from 'lib/database.js'; -import { Folder } from 'lib/models/folder.js'; -import { ReportService } from 'lib/services/report.js'; -import { _ } from 'lib/locale.js'; -import { BaseScreenComponent } from 'lib/components/base-screen.js'; -import { globalStyle, themeStyle } from 'lib/components/global-style.js'; +const React = require('react'); const Component = React.Component; +const { ListView, StyleSheet, View, Text, Button, FlatList } = require('react-native'); +const { Setting } = require('lib/models/setting.js'); +const { connect } = require('react-redux'); +const { Log } = require('lib/log.js'); +const { reg } = require('lib/registry.js'); +const { ScreenHeader } = require('lib/components/screen-header.js'); +const { time } = require('lib/time-utils'); +const { Logger } = require('lib/logger.js'); +const { BaseItem } = require('lib/models/base-item.js'); +const { Database } = require('lib/database.js'); +const { Folder } = require('lib/models/folder.js'); +const { ReportService } = require('lib/services/report.js'); +const { _ } = require('lib/locale.js'); +const { BaseScreenComponent } = require('lib/components/base-screen.js'); +const { globalStyle, themeStyle } = require('lib/components/global-style.js'); const styles = StyleSheet.create({ body: { diff --git a/ReactNativeClient/lib/components/screens/tag.js b/ReactNativeClient/lib/components/screens/tag.js index cba3517e3..bd7c3df65 100644 --- a/ReactNativeClient/lib/components/screens/tag.js +++ b/ReactNativeClient/lib/components/screens/tag.js @@ -1,13 +1,13 @@ -import React, { Component } from 'react'; -import { ListView, StyleSheet, View, TextInput, FlatList, TouchableHighlight } from 'react-native'; -import { connect } from 'react-redux' -import { ScreenHeader } from 'lib/components/screen-header.js'; -import Icon from 'react-native-vector-icons/Ionicons'; -import { _ } from 'lib/locale.js'; -import { Note } from 'lib/models/note.js'; -import { NoteItem } from 'lib/components/note-item.js'; -import { BaseScreenComponent } from 'lib/components/base-screen.js'; -import { globalStyle } from 'lib/components/global-style.js'; +const React = require('react'); const Component = React.Component; +const { ListView, StyleSheet, View, TextInput, FlatList, TouchableHighlight } = require('react-native'); +const { connect } = require('react-redux'); +const { ScreenHeader } = require('lib/components/screen-header.js'); +const Icon = require('react-native-vector-icons/Ionicons').default; +const { _ } = require('lib/locale.js'); +const { Note } = require('lib/models/note.js'); +const { NoteItem } = require('lib/components/note-item.js'); +const { BaseScreenComponent } = require('lib/components/base-screen.js'); +const { globalStyle } = require('lib/components/global-style.js'); let styles = { body: { diff --git a/ReactNativeClient/lib/components/screens/welcome.js b/ReactNativeClient/lib/components/screens/welcome.js index 21472c200..fcecaf25a 100644 --- a/ReactNativeClient/lib/components/screens/welcome.js +++ b/ReactNativeClient/lib/components/screens/welcome.js @@ -1,12 +1,12 @@ -import React, { Component } from 'react'; -import { View, Text, StyleSheet } from 'react-native'; -import { connect } from 'react-redux' -import { Log } from 'lib/log.js' -import { ScreenHeader } from 'lib/components/screen-header.js'; -import { ActionButton } from 'lib/components/action-button.js'; -import { BaseScreenComponent } from 'lib/components/base-screen.js'; -import { _ } from 'lib/locale.js'; -import { themeStyle } from 'lib/components/global-style.js'; +const React = require('react'); const Component = React.Component; +const { View, Text, StyleSheet } = require('react-native'); +const { connect } = require('react-redux'); +const { Log } = require('lib/log.js'); +const { ScreenHeader } = require('lib/components/screen-header.js'); +const { ActionButton } = require('lib/components/action-button.js'); +const { BaseScreenComponent } = require('lib/components/base-screen.js'); +const { _ } = require('lib/locale.js'); +const { themeStyle } = require('lib/components/global-style.js'); class WelcomeScreenComponent extends BaseScreenComponent { diff --git a/ReactNativeClient/lib/components/side-menu-content.js b/ReactNativeClient/lib/components/side-menu-content.js index 49c5a036b..a309e30bd 100644 --- a/ReactNativeClient/lib/components/side-menu-content.js +++ b/ReactNativeClient/lib/components/side-menu-content.js @@ -1,16 +1,16 @@ -import React, { Component } from 'react'; -import { TouchableOpacity , Button, Text, Image, StyleSheet, ScrollView, View } from 'react-native'; -import { connect } from 'react-redux' -import Icon from 'react-native-vector-icons/Ionicons'; -import { Log } from 'lib/log.js'; -import { Tag } from 'lib/models/tag.js'; -import { Note } from 'lib/models/note.js'; -import { Setting } from 'lib/models/setting.js'; -import { FoldersScreenUtils } from 'lib/folders-screen-utils.js' -import { Synchronizer } from 'lib/synchronizer.js'; -import { reg } from 'lib/registry.js'; -import { _ } from 'lib/locale.js'; -import { globalStyle, themeStyle } from 'lib/components/global-style.js'; +const React = require('react'); const Component = React.Component; +const { TouchableOpacity , Button, Text, Image, StyleSheet, ScrollView, View } = require('react-native'); +const { connect } = require('react-redux'); +const Icon = require('react-native-vector-icons/Ionicons').default; +const { Log } = require('lib/log.js'); +const { Tag } = require('lib/models/tag.js'); +const { Note } = require('lib/models/note.js'); +const { Setting } = require('lib/models/setting.js'); +const { FoldersScreenUtils } = require('lib/folders-screen-utils.js'); +const { Synchronizer } = require('lib/synchronizer.js'); +const { reg } = require('lib/registry.js'); +const { _ } = require('lib/locale.js'); +const { globalStyle, themeStyle } = require('lib/components/global-style.js'); class SideMenuContentComponent extends Component { diff --git a/ReactNativeClient/lib/components/side-menu.js b/ReactNativeClient/lib/components/side-menu.js index a655db5e2..15dabee25 100644 --- a/ReactNativeClient/lib/components/side-menu.js +++ b/ReactNativeClient/lib/components/side-menu.js @@ -1,11 +1,11 @@ -import React, { Component } from 'react'; -import { connect } from 'react-redux' -import { Log } from 'lib/log.js'; -import SideMenu_ from 'react-native-side-menu'; +const React = require('react'); const Component = React.Component; +const { connect } = require('react-redux'); +const { Log } = require('lib/log.js'); +const SideMenu_ = require('react-native-side-menu').default; class SideMenuComponent extends SideMenu_ {}; -const SideMenu = connect( +const MySideMenu = connect( (state) => { return { isOpen: state.showSideMenu, @@ -13,4 +13,4 @@ const SideMenu = connect( } )(SideMenuComponent) -export { SideMenu }; \ No newline at end of file +module.exports = { SideMenu: MySideMenu }; \ No newline at end of file diff --git a/ReactNativeClient/lib/database-driver-react-native.js b/ReactNativeClient/lib/database-driver-react-native.js index 0fddc06aa..f0b7e3cc2 100644 --- a/ReactNativeClient/lib/database-driver-react-native.js +++ b/ReactNativeClient/lib/database-driver-react-native.js @@ -1,4 +1,4 @@ -import SQLite from 'react-native-sqlite-storage'; +const SQLite = require('react-native-sqlite-storage'); class DatabaseDriverReactNative { diff --git a/ReactNativeClient/lib/database.js b/ReactNativeClient/lib/database.js index 9a53d8320..9969e9d9f 100644 --- a/ReactNativeClient/lib/database.js +++ b/ReactNativeClient/lib/database.js @@ -1,8 +1,8 @@ -import { uuid } from 'lib/uuid.js'; -import { promiseChain } from 'lib/promise-utils.js'; -import { Logger } from 'lib/logger.js' -import { time } from 'lib/time-utils.js' -import { sprintf } from 'sprintf-js'; +const { uuid } = require('lib/uuid.js'); +const { promiseChain } = require('lib/promise-utils.js'); +const { Logger } = require('lib/logger.js'); +const { time } = require('lib/time-utils.js'); +const { sprintf } = require('sprintf-js'); class Database { diff --git a/ReactNativeClient/lib/dialogs.js b/ReactNativeClient/lib/dialogs.js index 34865c952..6a1304bb9 100644 --- a/ReactNativeClient/lib/dialogs.js +++ b/ReactNativeClient/lib/dialogs.js @@ -1,5 +1,5 @@ -import DialogBox from 'react-native-dialogbox'; -import { Keyboard } from 'react-native'; +const DialogBox = require('react-native-dialogbox').default; +const { Keyboard } = require('react-native'); // Add this at the bottom of the component: // diff --git a/ReactNativeClient/lib/file-api-driver-local.js b/ReactNativeClient/lib/file-api-driver-local.js index 9f8cb28fb..403961621 100644 --- a/ReactNativeClient/lib/file-api-driver-local.js +++ b/ReactNativeClient/lib/file-api-driver-local.js @@ -1,8 +1,8 @@ -import fs from 'fs-extra'; -import { promiseChain } from 'lib/promise-utils.js'; -import moment from 'moment'; -import { BaseItem } from 'lib/models/base-item.js'; -import { time } from 'lib/time-utils.js'; +const fs = require('fs-extra'); +const { promiseChain } = require('lib/promise-utils.js'); +const moment = require('moment'); +const { BaseItem } = require('lib/models/base-item.js'); +const { time } = require('lib/time-utils.js'); // NOTE: when synchronising with the file system the time resolution is the second (unlike milliseconds for OneDrive for instance). // What it means is that if, for example, client 1 changes a note at time t, and client 2 changes the same note within the same second, diff --git a/ReactNativeClient/lib/file-api-driver-memory.js b/ReactNativeClient/lib/file-api-driver-memory.js index a26d81b71..89e033dbc 100644 --- a/ReactNativeClient/lib/file-api-driver-memory.js +++ b/ReactNativeClient/lib/file-api-driver-memory.js @@ -1,4 +1,4 @@ -import { time } from 'lib/time-utils.js'; +const { time } = require('lib/time-utils.js'); class FileApiDriverMemory { diff --git a/ReactNativeClient/lib/file-api-driver-onedrive.js b/ReactNativeClient/lib/file-api-driver-onedrive.js index a3e0c443b..4b7451b7b 100644 --- a/ReactNativeClient/lib/file-api-driver-onedrive.js +++ b/ReactNativeClient/lib/file-api-driver-onedrive.js @@ -1,7 +1,7 @@ -import moment from 'moment'; -import { time } from 'lib/time-utils.js'; -import { dirname, basename } from 'lib/path-utils.js'; -import { OneDriveApi } from 'lib/onedrive-api.js'; +const moment = require('moment'); +const { time } = require('lib/time-utils.js'); +const { dirname, basename } = require('lib/path-utils.js'); +const { OneDriveApi } = require('lib/onedrive-api.js'); class FileApiDriverOneDrive { diff --git a/ReactNativeClient/lib/file-api.js b/ReactNativeClient/lib/file-api.js index e9170505a..90ee3ddf8 100644 --- a/ReactNativeClient/lib/file-api.js +++ b/ReactNativeClient/lib/file-api.js @@ -1,5 +1,5 @@ -import { isHidden } from 'lib/path-utils.js'; -import { Logger } from 'lib/logger.js'; +const { isHidden } = require('lib/path-utils.js'); +const { Logger } = require('lib/logger.js'); class FileApi { diff --git a/ReactNativeClient/lib/folders-screen-utils.js b/ReactNativeClient/lib/folders-screen-utils.js index ebdca557d..f5a2058a1 100644 --- a/ReactNativeClient/lib/folders-screen-utils.js +++ b/ReactNativeClient/lib/folders-screen-utils.js @@ -1,4 +1,4 @@ -import { Folder } from 'lib/models/folder.js' +const { Folder } = require('lib/models/folder.js'); class FoldersScreenUtils { diff --git a/ReactNativeClient/lib/geolocation-node.js b/ReactNativeClient/lib/geolocation-node.js index 18497e1c7..a28ce9e1c 100644 --- a/ReactNativeClient/lib/geolocation-node.js +++ b/ReactNativeClient/lib/geolocation-node.js @@ -1,5 +1,5 @@ -import { shim } from 'lib/shim.js' -import { netUtils } from 'lib/net-utils.js'; +const { shim } = require('lib/shim.js'); +const { netUtils } = require('lib/net-utils.js'); class GeolocationNode { diff --git a/ReactNativeClient/lib/geolocation-react.js b/ReactNativeClient/lib/geolocation-react.js index a3861f832..25b91ae26 100644 --- a/ReactNativeClient/lib/geolocation-react.js +++ b/ReactNativeClient/lib/geolocation-react.js @@ -1,4 +1,4 @@ -import { Setting } from 'lib/models/setting.js'; +const { Setting } = require('lib/models/setting.js'); class GeolocationReact { diff --git a/ReactNativeClient/lib/joplin-database.js b/ReactNativeClient/lib/joplin-database.js index 588c93687..9fc411eb5 100644 --- a/ReactNativeClient/lib/joplin-database.js +++ b/ReactNativeClient/lib/joplin-database.js @@ -1,7 +1,7 @@ -import { uuid } from 'lib/uuid.js'; -import { promiseChain } from 'lib/promise-utils.js'; -import { time } from 'lib/time-utils.js' -import { Database } from 'lib/database.js' +const { uuid } = require('lib/uuid.js'); +const { promiseChain } = require('lib/promise-utils.js'); +const { time } = require('lib/time-utils.js'); +const { Database } = require('lib/database.js'); const structureSql = ` CREATE TABLE folders ( diff --git a/ReactNativeClient/lib/locale.js b/ReactNativeClient/lib/locale.js index 4cf2091f9..0f529f469 100644 --- a/ReactNativeClient/lib/locale.js +++ b/ReactNativeClient/lib/locale.js @@ -1,4 +1,4 @@ -import { sprintf } from 'sprintf-js'; +const { sprintf } = require('sprintf-js'); let codeToLanguageE_ = {}; codeToLanguageE_["aa"] = "Afar"; diff --git a/ReactNativeClient/lib/logger.js b/ReactNativeClient/lib/logger.js index 81198edc3..92b8a7cf9 100644 --- a/ReactNativeClient/lib/logger.js +++ b/ReactNativeClient/lib/logger.js @@ -1,7 +1,7 @@ -import moment from 'moment'; -import { _ } from 'lib/locale.js'; -import { time } from 'lib/time-utils.js'; -import { FsDriverDummy } from 'lib/fs-driver-dummy.js'; +const moment = require('moment'); +const { _ } = require('lib/locale.js'); +const { time } = require('lib/time-utils.js'); +const { FSdRiverdUmmy } = require('lib/fs-driver-dummy.js'); class Logger { diff --git a/ReactNativeClient/lib/models/base-item.js b/ReactNativeClient/lib/models/base-item.js index a992421a0..22cbcbf16 100644 --- a/ReactNativeClient/lib/models/base-item.js +++ b/ReactNativeClient/lib/models/base-item.js @@ -1,9 +1,9 @@ -import { BaseModel } from 'lib/base-model.js'; -import { Database } from 'lib/database.js'; -import { Setting } from 'lib/models/setting.js'; -import { time } from 'lib/time-utils.js'; -import { sprintf } from 'sprintf-js'; -import moment from 'moment'; +const { BaseModel } = require('lib/base-model.js'); +const { Database } = require('lib/database.js'); +const { Setting } = require('lib/models/setting.js'); +const { time } = require('lib/time-utils.js'); +const { sprintf } = require('sprintf-js'); +const moment = require('moment'); class BaseItem extends BaseModel { diff --git a/ReactNativeClient/lib/models/folder.js b/ReactNativeClient/lib/models/folder.js index 8d895a326..ab580b288 100644 --- a/ReactNativeClient/lib/models/folder.js +++ b/ReactNativeClient/lib/models/folder.js @@ -1,14 +1,14 @@ -import { BaseModel } from 'lib/base-model.js'; -import { Log } from 'lib/log.js'; -import { promiseChain } from 'lib/promise-utils.js'; -import { time } from 'lib/time-utils.js'; -import { Note } from 'lib/models/note.js'; -import { Setting } from 'lib/models/setting.js'; -import { Database } from 'lib/database.js'; -import { _ } from 'lib/locale.js'; -import moment from 'moment'; -import { BaseItem } from 'lib/models/base-item.js'; -import lodash from 'lodash'; +const { BaseModel } = require('lib/base-model.js'); +const { Log } = require('lib/log.js'); +const { promiseChain } = require('lib/promise-utils.js'); +const { time } = require('lib/time-utils.js'); +const { Note } = require('lib/models/note.js'); +const { Setting } = require('lib/models/setting.js'); +const { Database } = require('lib/database.js'); +const { _ } = require('lib/locale.js'); +const moment = require('moment'); +const { BaseItem } = require('lib/models/base-item.js'); +const lodash = require('lodash'); class Folder extends BaseItem { diff --git a/ReactNativeClient/lib/models/note-tag.js b/ReactNativeClient/lib/models/note-tag.js index 2f0dea374..34af3c80b 100644 --- a/ReactNativeClient/lib/models/note-tag.js +++ b/ReactNativeClient/lib/models/note-tag.js @@ -1,6 +1,6 @@ -import { BaseItem } from 'lib/models/base-item.js'; -import { BaseModel } from 'lib/base-model.js'; -import lodash from 'lodash'; +const { BaseItem } = require('lib/models/base-item.js'); +const { BaseModel } = require('lib/base-model.js'); +const lodash = require('lodash'); class NoteTag extends BaseItem { diff --git a/ReactNativeClient/lib/models/note.js b/ReactNativeClient/lib/models/note.js index 20d891c5f..3c09f8f53 100644 --- a/ReactNativeClient/lib/models/note.js +++ b/ReactNativeClient/lib/models/note.js @@ -1,14 +1,13 @@ -import { BaseModel } from 'lib/base-model.js'; -import { Log } from 'lib/log.js'; -import { sprintf } from 'sprintf-js'; -import { Folder } from 'lib/models/folder.js'; -import { BaseItem } from 'lib/models/base-item.js'; -import { Setting } from 'lib/models/setting.js'; -import { shim } from 'lib/shim.js'; -import { time } from 'lib/time-utils.js'; -import { _ } from 'lib/locale.js'; -import moment from 'moment'; -import lodash from 'lodash'; +const { BaseModel } = require('lib/base-model.js'); +const { Log } = require('lib/log.js'); +const { sprintf } = require('sprintf-js'); +const { BaseItem } = require('lib/models/base-item.js'); +const { Setting } = require('lib/models/setting.js'); +const { shim } = require('lib/shim.js'); +const { time } = require('lib/time-utils.js'); +const { _ } = require('lib/locale.js'); +const moment = require('moment'); +const lodash = require('lodash'); class Note extends BaseItem { @@ -188,7 +187,7 @@ class Note extends BaseItem { if (!options.fields) options.fields = this.previewFields(); if (!options.uncompletedTodosOnTop) options.uncompletedTodosOnTop = false; - if (parentId == Folder.conflictFolderId()) { + if (parentId == BaseItem.getClass('Folder').conflictFolderId()) { options.conditions.push('is_conflict = 1'); } else { options.conditions.push('is_conflict = 0'); @@ -326,7 +325,7 @@ class Note extends BaseItem { } static async copyToFolder(noteId, folderId) { - if (folderId == Folder.conflictFolderId()) throw new Error(_('Cannot copy note to "%s" notebook', Folder.conflictFolderIdTitle())); + if (folderId == this.getClass('Folder').conflictFolderId()) throw new Error(_('Cannot copy note to "%s" notebook', this.getClass('Folder').conflictFolderIdTitle())); return Note.duplicate(noteId, { changes: { @@ -337,7 +336,7 @@ class Note extends BaseItem { } static async moveToFolder(noteId, folderId) { - if (folderId == Folder.conflictFolderId()) throw new Error(_('Cannot move note to "%s" notebook', Folder.conflictFolderIdTitle())); + if (folderId == this.getClass('Folder').conflictFolderId()) throw new Error(_('Cannot move note to "%s" notebook', this.getClass('Folder').conflictFolderIdTitle())); // When moving a note to a different folder, the user timestamp is not updated. // However updated_time is updated so that the note can be synced later on. diff --git a/ReactNativeClient/lib/models/resource.js b/ReactNativeClient/lib/models/resource.js index 6e8be5e8a..c0820b9ca 100644 --- a/ReactNativeClient/lib/models/resource.js +++ b/ReactNativeClient/lib/models/resource.js @@ -1,11 +1,11 @@ -import { BaseModel } from 'lib/base-model.js'; -import { BaseItem } from 'lib/models/base-item.js'; -import { Setting } from 'lib/models/setting.js'; -import { mime } from 'lib/mime-utils.js'; -import { filename } from 'lib/path-utils.js'; -import { FsDriverDummy } from 'lib/fs-driver-dummy.js'; -import { markdownUtils } from 'lib/markdown-utils.js'; -import lodash from 'lodash'; +const { BaseModel } = require('lib/base-model.js'); +const { BaseItem } = require('lib/models/base-item.js'); +const { Setting } = require('lib/models/setting.js'); +const { mime } = require('lib/mime-utils.js'); +const { filename } = require('lib/path-utils.js'); +const { FsDriverDummy } = require('lib/fs-driver-dummy.js'); +const { markdownUtils } = require('lib/markdown-utils.js'); +const lodash = require('lodash'); class Resource extends BaseItem { diff --git a/ReactNativeClient/lib/models/setting.js b/ReactNativeClient/lib/models/setting.js index e99d744a3..449619ffb 100644 --- a/ReactNativeClient/lib/models/setting.js +++ b/ReactNativeClient/lib/models/setting.js @@ -1,8 +1,8 @@ -import { BaseModel } from 'lib/base-model.js'; -import { Database } from 'lib/database.js'; -import { Logger } from 'lib/logger.js'; -import { sprintf } from 'sprintf-js'; -import { _, supportedLocalesToLanguages, defaultLocale } from 'lib/locale.js'; +const { BaseModel } = require('lib/base-model.js'); +const { Database } = require('lib/database.js'); +const { Logger } = require('lib/logger.js'); +const { sprintf } = require('sprintf-js'); +const { _, supportedLocalesToLanguages, defaultLocale } = require('lib/locale.js'); class Setting extends BaseModel { diff --git a/ReactNativeClient/lib/models/tag.js b/ReactNativeClient/lib/models/tag.js index 79f356307..a5c8774d9 100644 --- a/ReactNativeClient/lib/models/tag.js +++ b/ReactNativeClient/lib/models/tag.js @@ -1,9 +1,9 @@ -import { BaseModel } from 'lib/base-model.js'; -import { BaseItem } from 'lib/models/base-item.js'; -import { NoteTag } from 'lib/models/note-tag.js'; -import { Note } from 'lib/models/note.js'; -import { time } from 'lib/time-utils.js'; -import lodash from 'lodash'; +const { BaseModel } = require('lib/base-model.js'); +const { BaseItem } = require('lib/models/base-item.js'); +const { NoteTag } = require('lib/models/note-tag.js'); +const { Note } = require('lib/models/note.js'); +const { time } = require('lib/time-utils.js'); +const lodash = require('lodash'); class Tag extends BaseItem { diff --git a/ReactNativeClient/lib/net-utils.js b/ReactNativeClient/lib/net-utils.js index 88469ba1f..706e8bfd2 100644 --- a/ReactNativeClient/lib/net-utils.js +++ b/ReactNativeClient/lib/net-utils.js @@ -1,4 +1,4 @@ -import { shim } from 'lib/shim.js' +const { shim } = require('lib/shim.js'); const tcpPortUsed = require('tcp-port-used'); diff --git a/ReactNativeClient/lib/onedrive-api.js b/ReactNativeClient/lib/onedrive-api.js index 3cc9a667d..939ed85ce 100644 --- a/ReactNativeClient/lib/onedrive-api.js +++ b/ReactNativeClient/lib/onedrive-api.js @@ -1,7 +1,7 @@ -import { shim } from 'lib/shim.js'; -import { stringify } from 'query-string'; -import { time } from 'lib/time-utils.js'; -import { Logger } from 'lib/logger.js' +const { shim } = require('lib/shim.js'); +const { stringify } = require('query-string'); +const { time } = require('lib/time-utils.js'); +const { Logger } = require('lib/logger.js'); class OneDriveApi { diff --git a/ReactNativeClient/lib/parameters.js b/ReactNativeClient/lib/parameters.js index 0ceaabfcf..98b7fafb5 100644 --- a/ReactNativeClient/lib/parameters.js +++ b/ReactNativeClient/lib/parameters.js @@ -1,4 +1,4 @@ -import { Setting } from 'lib/models/setting.js'; +const { Setting } = require('lib/models/setting.js'); const parameters_ = {}; diff --git a/ReactNativeClient/lib/poor-man-intervals.js b/ReactNativeClient/lib/poor-man-intervals.js index bf313681a..6cbe20937 100644 --- a/ReactNativeClient/lib/poor-man-intervals.js +++ b/ReactNativeClient/lib/poor-man-intervals.js @@ -1,4 +1,4 @@ -import { time } from 'lib/time-utils.js'; +const { time } = require('lib/time-utils.js'); class PoorManIntervals { diff --git a/ReactNativeClient/lib/react-logger.js b/ReactNativeClient/lib/react-logger.js index d868bb2bc..9fba2c429 100644 --- a/ReactNativeClient/lib/react-logger.js +++ b/ReactNativeClient/lib/react-logger.js @@ -1,4 +1,4 @@ -import { Logger } from 'lib/logger.js'; +const { Logger } = require('lib/logger.js'); class ReactLogger extends Logger { diff --git a/ReactNativeClient/lib/reducer.js b/ReactNativeClient/lib/reducer.js index dced7006e..b9ee56237 100644 --- a/ReactNativeClient/lib/reducer.js +++ b/ReactNativeClient/lib/reducer.js @@ -1,4 +1,4 @@ -import { Note } from 'lib/models/note.js'; +const { Note } = require('lib/models/note.js'); const defaultState = { notes: [], diff --git a/ReactNativeClient/lib/registry.js b/ReactNativeClient/lib/registry.js index 94f747b96..39c036a78 100644 --- a/ReactNativeClient/lib/registry.js +++ b/ReactNativeClient/lib/registry.js @@ -1,15 +1,15 @@ -import { Logger } from 'lib/logger.js'; -import { Setting } from 'lib/models/setting.js'; -import { OneDriveApi } from 'lib/onedrive-api.js'; -import { parameters } from 'lib/parameters.js'; -import { FileApi } from 'lib/file-api.js'; -import { Database } from 'lib/database.js'; -import { Synchronizer } from 'lib/synchronizer.js'; -import { FileApiDriverOneDrive } from 'lib/file-api-driver-onedrive.js'; -import { shim } from 'lib/shim.js'; -import { time } from 'lib/time-utils.js'; -import { FileApiDriverMemory } from 'lib/file-api-driver-memory.js'; -import { _ } from 'lib/locale.js'; +const { Logger } = require('lib/logger.js'); +const { Setting } = require('lib/models/setting.js'); +const { OneDriveApi } = require('lib/onedrive-api.js'); +const { parameters } = require('lib/parameters.js'); +const { FileApi } = require('lib/file-api.js'); +const { Database } = require('lib/database.js'); +const { Synchronizer } = require('lib/synchronizer.js'); +const { FileApiDriverOneDrive } = require('lib/file-api-driver-onedrive.js'); +const { shim } = require('lib/shim.js'); +const { time } = require('lib/time-utils.js'); +const { FileApiDriverMemory } = require('lib/file-api-driver-memory.js'); +const { _ } = require('lib/locale.js'); const reg = {}; diff --git a/ReactNativeClient/lib/services/back-button.js b/ReactNativeClient/lib/services/back-button.js index 81302cb89..e0225ee29 100644 --- a/ReactNativeClient/lib/services/back-button.js +++ b/ReactNativeClient/lib/services/back-button.js @@ -1,4 +1,4 @@ -import { BackHandler } from 'react-native'; +const { BackHandler } = require('react-native'); class BackButtonService { diff --git a/ReactNativeClient/lib/services/exporter.js b/ReactNativeClient/lib/services/exporter.js index 5dfd35094..48cfcad2c 100644 --- a/ReactNativeClient/lib/services/exporter.js +++ b/ReactNativeClient/lib/services/exporter.js @@ -1,12 +1,12 @@ -import { BaseItem } from 'lib/models/base-item.js'; -import { BaseModel } from 'lib/base-model.js'; -import { Resource } from 'lib/models/resource.js'; -import { Folder } from 'lib/models/folder.js'; -import { NoteTag } from 'lib/models/note-tag.js'; -import { Note } from 'lib/models/note.js'; -import { Tag } from 'lib/models/tag.js'; -import { basename } from 'lib/path-utils.js'; -import fs from 'fs-extra'; +const { BaseItem } = require('lib/models/base-item.js'); +const { BaseModel } = require('lib/base-model.js'); +const { Resource } = require('lib/models/resource.js'); +const { Folder } = require('lib/models/folder.js'); +const { NoteTag } = require('lib/models/note-tag.js'); +const { Note } = require('lib/models/note.js'); +const { Tag } = require('lib/models/tag.js'); +const { basename } = require('lib/path-utils.js'); +const fs = require('fs-extra'); class Exporter { diff --git a/ReactNativeClient/lib/services/report.js b/ReactNativeClient/lib/services/report.js index 1d1fd787b..e503aa678 100644 --- a/ReactNativeClient/lib/services/report.js +++ b/ReactNativeClient/lib/services/report.js @@ -1,8 +1,8 @@ -import { time } from 'lib/time-utils' -import { BaseItem } from 'lib/models/base-item.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { _ } from 'lib/locale.js'; +const { time } = require('lib/time-utils'); +const { BaseItem } = require('lib/models/base-item.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { _ } = require('lib/locale.js'); class ReportService { diff --git a/ReactNativeClient/lib/shim-init-node.js b/ReactNativeClient/lib/shim-init-node.js index 63d7a2c63..13edb5b11 100644 --- a/ReactNativeClient/lib/shim-init-node.js +++ b/ReactNativeClient/lib/shim-init-node.js @@ -1,8 +1,8 @@ -import fs from 'fs-extra'; -import { shim } from 'lib/shim.js'; -import { GeolocationNode } from 'lib/geolocation-node.js'; -import { FileApiDriverLocal } from 'lib/file-api-driver-local.js'; -import { time } from 'lib/time-utils.js'; +const fs = require('fs-extra'); +const { shim } = require('lib/shim.js'); +const { GeolocationNode } = require('lib/geolocation-node.js'); +const { FileApiDriverLocal } = require('lib/file-api-driver-local.js'); +const { time } = require('lib/time-utils.js'); function fetchRequestCanBeRetried(error) { if (!error) return false; diff --git a/ReactNativeClient/lib/shim-init-react.js b/ReactNativeClient/lib/shim-init-react.js index cf6c4667f..b5cc527b2 100644 --- a/ReactNativeClient/lib/shim-init-react.js +++ b/ReactNativeClient/lib/shim-init-react.js @@ -1,7 +1,7 @@ -import { shim } from 'lib/shim.js'; -import { GeolocationReact } from 'lib/geolocation-react.js'; -import { PoorManIntervals } from 'lib/poor-man-intervals.js'; -import RNFetchBlob from 'react-native-fetch-blob'; +const { shim } = require('lib/shim.js'); +const { GeolocationReact } = require('lib/geolocation-react.js'); +const { PoorManIntervals } = require('lib/poor-man-intervals.js'); +const RNFetchBlob = require('react-native-fetch-blob').default; function shimInit() { shim.Geolocation = GeolocationReact; diff --git a/ReactNativeClient/lib/synchronizer.js b/ReactNativeClient/lib/synchronizer.js index 327c9cb9d..62f9ac40e 100644 --- a/ReactNativeClient/lib/synchronizer.js +++ b/ReactNativeClient/lib/synchronizer.js @@ -1,14 +1,14 @@ -import { BaseItem } from 'lib/models/base-item.js'; -import { Folder } from 'lib/models/folder.js'; -import { Note } from 'lib/models/note.js'; -import { Resource } from 'lib/models/resource.js'; -import { BaseModel } from 'lib/base-model.js'; -import { sprintf } from 'sprintf-js'; -import { time } from 'lib/time-utils.js'; -import { Logger } from 'lib/logger.js' -import { _ } from 'lib/locale.js'; -import { shim } from 'lib/shim.js'; -import moment from 'moment'; +const { BaseItem } = require('lib/models/base-item.js'); +const { Folder } = require('lib/models/folder.js'); +const { Note } = require('lib/models/note.js'); +const { Resource } = require('lib/models/resource.js'); +const { BaseModel } = require('lib/base-model.js'); +const { sprintf } = require('sprintf-js'); +const { time } = require('lib/time-utils.js'); +const { Logger } = require('lib/logger.js'); +const { _ } = require('lib/locale.js'); +const { shim } = require('lib/shim.js'); +const moment = require('moment'); class Synchronizer { diff --git a/ReactNativeClient/lib/time-utils.js b/ReactNativeClient/lib/time-utils.js index 7e9a5422f..ad0a96732 100644 --- a/ReactNativeClient/lib/time-utils.js +++ b/ReactNativeClient/lib/time-utils.js @@ -1,4 +1,4 @@ -import moment from 'moment'; +const moment = require('moment'); let time = { diff --git a/ReactNativeClient/lib/uuid.js b/ReactNativeClient/lib/uuid.js index 5132b06bd..c3db1afaf 100644 --- a/ReactNativeClient/lib/uuid.js +++ b/ReactNativeClient/lib/uuid.js @@ -1,4 +1,4 @@ -import createUuidV4 from 'uuid/v4'; +const createUuidV4 = require('uuid/v4'); const uuid = { diff --git a/ReactNativeClient/main.js b/ReactNativeClient/main.js index fce599750..d56116961 100644 --- a/ReactNativeClient/main.js +++ b/ReactNativeClient/main.js @@ -6,9 +6,9 @@ // So there's basically still a one way flux: React => SQLite => Redux => React -import { AppRegistry } from 'react-native'; -import { Log } from 'lib/log.js' -import { Root } from './root.js'; +const { AppRegistry } = require('react-native'); +const { Log } = require('lib/log.js'); +const { Root } = require('./root.js'); function main() { AppRegistry.registerComponent('Joplin', () => Root); diff --git a/ReactNativeClient/root.js b/ReactNativeClient/root.js index a3681586d..f518610cf 100644 --- a/ReactNativeClient/root.js +++ b/ReactNativeClient/root.js @@ -1,41 +1,41 @@ -import React, { Component } from 'react'; -import { Keyboard, NativeModules } from 'react-native'; -import { connect, Provider } from 'react-redux' -import { BackButtonService } from 'lib/services/back-button.js'; -import { createStore, applyMiddleware } from 'redux'; -import { shimInit } from 'lib/shim-init-react.js'; -import { Log } from 'lib/log.js' -import { AppNav } from 'lib/components/app-nav.js' -import { Logger } from 'lib/logger.js' -import { Note } from 'lib/models/note.js' -import { Folder } from 'lib/models/folder.js' -import { FoldersScreenUtils } from 'lib/folders-screen-utils.js'; -import { Resource } from 'lib/models/resource.js' -import { Tag } from 'lib/models/tag.js' -import { NoteTag } from 'lib/models/note-tag.js' -import { BaseItem } from 'lib/models/base-item.js' -import { BaseModel } from 'lib/base-model.js' -import { JoplinDatabase } from 'lib/joplin-database.js' -import { Database } from 'lib/database.js' -import { NotesScreen } from 'lib/components/screens/notes.js' -import { NoteScreen } from 'lib/components/screens/note.js' -import { ConfigScreen } from 'lib/components/screens/config.js' -import { FolderScreen } from 'lib/components/screens/folder.js' -import { LogScreen } from 'lib/components/screens/log.js' -import { StatusScreen } from 'lib/components/screens/status.js' -import { WelcomeScreen } from 'lib/components/screens/welcome.js' -import { SearchScreen } from 'lib/components/screens/search.js' -import { OneDriveLoginScreen } from 'lib/components/screens/onedrive-login.js' -import { Setting } from 'lib/models/setting.js' -import { MenuContext } from 'react-native-popup-menu'; -import { SideMenu } from 'lib/components/side-menu.js'; -import { SideMenuContent } from 'lib/components/side-menu-content.js'; -import { DatabaseDriverReactNative } from 'lib/database-driver-react-native'; -import { reg } from 'lib/registry.js'; -import { _, setLocale, closestSupportedLocale, defaultLocale } from 'lib/locale.js'; -import RNFetchBlob from 'react-native-fetch-blob'; -import { PoorManIntervals } from 'lib/poor-man-intervals.js'; -import { reducer, defaultState } from 'lib/reducer.js'; +const React = require('react'); const Component = React.Component; +const { Keyboard, NativeModules } = require('react-native'); +const { connect, Provider } = require('react-redux'); +const { BackButtonService } = require('lib/services/back-button.js'); +const { createStore, applyMiddleware } = require('redux'); +const { shimInit } = require('lib/shim-init-react.js'); +const { Log } = require('lib/log.js'); +const { AppNav } = require('lib/components/app-nav.js'); +const { Logger } = require('lib/logger.js'); +const { Note } = require('lib/models/note.js'); +const { Folder } = require('lib/models/folder.js'); +const { FoldersScreenUtils } = require('lib/folders-screen-utils.js'); +const { Resource } = require('lib/models/resource.js'); +const { Tag } = require('lib/models/tag.js'); +const { NoteTag } = require('lib/models/note-tag.js'); +const { BaseItem } = require('lib/models/base-item.js'); +const { BaseModel } = require('lib/base-model.js'); +const { JoplinDatabase } = require('lib/joplin-database.js'); +const { Database } = require('lib/database.js'); +const { NotesScreen } = require('lib/components/screens/notes.js'); +const { NoteScreen } = require('lib/components/screens/note.js'); +const { ConfigScreen } = require('lib/components/screens/config.js'); +const { FolderScreen } = require('lib/components/screens/folder.js'); +const { LogScreen } = require('lib/components/screens/log.js'); +const { StatusScreen } = require('lib/components/screens/status.js'); +const { WelcomeScreen } = require('lib/components/screens/welcome.js'); +const { SearchScreen } = require('lib/components/screens/search.js'); +const { OneDriveLoginScreen } = require('lib/components/screens/onedrive-login.js'); +const { Setting } = require('lib/models/setting.js'); +const { MenuContext } = require('react-native-popup-menu'); +const { SideMenu } = require('lib/components/side-menu.js'); +const { SideMenuContent } = require('lib/components/side-menu-content.js'); +const { DatabaseDriverReactNative } = require('lib/database-driver-react-native'); +const { reg } = require('lib/registry.js'); +const { _, setLocale, closestSupportedLocale, defaultLocale } = require('lib/locale.js'); +const RNFetchBlob = require('react-native-fetch-blob').default; +const { PoorManIntervals } = require('lib/poor-man-intervals.js'); +const { reducer, defaultState } = require('lib/reducer.js'); const generalMiddleware = store => next => async (action) => { if (action.type !== 'SIDE_MENU_OPEN_PERCENT') reg.logger().info('Reducer action', action.type);