From 50b66cceca32540eb3c06656a1918e606cd09906 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Fri, 20 Sep 2019 22:18:09 +0100 Subject: [PATCH] Revert "Desktop: Add ENEX to HTML export (#1795)" This reverts commit 2f14832c348c4b8c8c5a5d83375d45444e6d52a0. Reverting PR #1795 due to broken MD import and other issues --- .gitignore | 3 +- CliClient/package-lock.json | 106 +- CliClient/package.json | 1 - CliClient/tests/EnexToHtml.js | 108 -- CliClient/tests/enex_to_html/attachment.enex | 8 - CliClient/tests/enex_to_html/attachment.html | 7 - .../tests/enex_to_html/checklist-list.enex | 11 - .../tests/enex_to_html/checklist-list.html | 16 - .../tests/enex_to_html/en-media--audio.enex | 3 - .../tests/enex_to_html/en-media--audio.html | 13 - .../tests/enex_to_html/en-media--image.enex | 1 - .../tests/enex_to_html/en-media--image.html | 14 - CliClient/tests/enex_to_html/svg.enex | 5 - CliClient/tests/enex_to_html/svg.html | 3 - ElectronClient/app/app.js | 15 +- ElectronClient/app/package-lock.json | 1281 ++++++++--------- ElectronClient/app/package.json | 1 - ReactNativeClient/lib/import-enex-html-gen.js | 170 --- ReactNativeClient/lib/import-enex-md-gen.js | 9 +- ReactNativeClient/lib/import-enex.js | 10 +- ReactNativeClient/lib/resourceUtils.js | 84 -- .../lib/services/InteropService.js | 48 +- ...oMd.js => InteropService_Importer_Enex.js} | 4 +- .../InteropService_Importer_EnexToHtml.js | 22 - 24 files changed, 678 insertions(+), 1265 deletions(-) delete mode 100644 CliClient/tests/EnexToHtml.js delete mode 100644 CliClient/tests/enex_to_html/attachment.enex delete mode 100644 CliClient/tests/enex_to_html/attachment.html delete mode 100644 CliClient/tests/enex_to_html/checklist-list.enex delete mode 100644 CliClient/tests/enex_to_html/checklist-list.html delete mode 100644 CliClient/tests/enex_to_html/en-media--audio.enex delete mode 100644 CliClient/tests/enex_to_html/en-media--audio.html delete mode 100644 CliClient/tests/enex_to_html/en-media--image.enex delete mode 100644 CliClient/tests/enex_to_html/en-media--image.html delete mode 100644 CliClient/tests/enex_to_html/svg.enex delete mode 100644 CliClient/tests/enex_to_html/svg.html delete mode 100644 ReactNativeClient/lib/import-enex-html-gen.js delete mode 100644 ReactNativeClient/lib/resourceUtils.js rename ReactNativeClient/lib/services/{InteropService_Importer_EnexToMd.js => InteropService_Importer_Enex.js} (81%) delete mode 100644 ReactNativeClient/lib/services/InteropService_Importer_EnexToHtml.js diff --git a/.gitignore b/.gitignore index 14940ee97..0f503c65a 100644 --- a/.gitignore +++ b/.gitignore @@ -42,5 +42,4 @@ ReactNativeClient/lib/csstojs/ ReactNativeClient/lib/rnInjectedJs/ ElectronClient/app/gui/note-viewer/fonts/ ElectronClient/app/gui/note-viewer/lib.js -Tools/commit_hook.txt -.vscode/* +Tools/commit_hook.txt \ No newline at end of file diff --git a/CliClient/package-lock.json b/CliClient/package-lock.json index 088d24f6a..745d2fabe 100644 --- a/CliClient/package-lock.json +++ b/CliClient/package-lock.json @@ -312,22 +312,6 @@ "source-map": "0.5.x" } }, - "clean-html": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/clean-html/-/clean-html-1.5.0.tgz", - "integrity": "sha512-eDu0vN44ZBvoEU0oRIKwWPIccGWXtdnUNmKJuTukZ1de00Uoqavb5pfIMKiC7/r+knQ5RbvAjGuVZiN3JwJL4Q==", - "requires": { - "htmlparser2": "^3.8.2", - "minimist": "^1.1.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" - } - } - }, "cliss": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/cliss/-/cliss-0.0.2.tgz", @@ -566,32 +550,6 @@ "resolved": "https://registry.npmjs.org/diff-match-patch/-/diff-match-patch-1.0.4.tgz", "integrity": "sha512-Uv3SW8bmH9nAtHKaKSanOQmj2DnlH65fUpcrMdfdaOxUG02QQ4YGZ8AE7kKOMisF7UqvOlGKVYWRvezdncW9lg==" }, - "dom-serializer": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.1.tgz", - "integrity": "sha512-sK3ujri04WyjwQXVoK4PU3y8ula1stq10GJZpqHIUgoGZdsGzAGu65BnU3d08aTVSvO7mGPZUc0wTEDL+qGE0Q==", - "requires": { - "domelementtype": "^2.0.1", - "entities": "^2.0.0" - }, - "dependencies": { - "domelementtype": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.1.tgz", - "integrity": "sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ==" - }, - "entities": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz", - "integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==" - } - } - }, - "domelementtype": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==" - }, "domexception": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", @@ -600,23 +558,6 @@ "webidl-conversions": "^4.0.2" } }, - "domhandler": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", - "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", - "requires": { - "domelementtype": "1" - } - }, - "domutils": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", - "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, "ecc-jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", @@ -1074,41 +1015,22 @@ "uglify-js": "3.3.x" } }, - "htmlparser2": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", - "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", + "http-errors": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz", + "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==", "requires": { - "domelementtype": "^1.3.1", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^3.1.1" + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.1.1", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.0" }, "dependencies": { - "readable-stream": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", - "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "safe-buffer": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", - "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "requires": { - "safe-buffer": "~5.2.0" - } + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" } } }, @@ -3208,7 +3130,7 @@ "requires": { "chalk": "^2.1.0", "emphasize": "^1.5.0", - "node-emoji": "git+https://github.com/laurent22/node-emoji.git#9fa01eac463e94dde1316ef8c53089eeef4973b5", + "node-emoji": "git+https://github.com/laurent22/node-emoji.git", "slice-ansi": "^1.0.0", "string-width": "^2.1.1", "terminal-kit": "^1.13.11", diff --git a/CliClient/package.json b/CliClient/package.json index cb7228a1c..bf9f01d31 100644 --- a/CliClient/package.json +++ b/CliClient/package.json @@ -31,7 +31,6 @@ "app-module-path": "^2.2.0", "async-mutex": "^0.1.3", "base-64": "^0.1.0", - "clean-html": "^1.5.0", "compare-version": "^0.1.2", "diacritics": "^1.3.0", "diff-match-patch": "^1.0.4", diff --git a/CliClient/tests/EnexToHtml.js b/CliClient/tests/EnexToHtml.js deleted file mode 100644 index 513676d83..000000000 --- a/CliClient/tests/EnexToHtml.js +++ /dev/null @@ -1,108 +0,0 @@ -require('app-module-path').addPath(__dirname); - -const { asyncTest, setupDatabaseAndSynchronizer, switchClient } = require('test-utils.js'); -const { shim } = require('lib/shim'); -const { enexXmlToHtml } = require('lib/import-enex-html-gen.js'); - -jasmine.DEFAULT_TIMEOUT_INTERVAL = 60 * 60 * 1000; // Can run for a while since everything is in the same test unit - -process.on('unhandledRejection', (reason, p) => { - console.warn('Unhandled Rejection at: Promise', p, 'reason:', reason); -}); - -const fileWithPath = (filename) => - `${__dirname}/enex_to_html/${filename}`; - -const audioResource = { - filename: 'audio test', - id: '9168ee833d03c5ea7c730ac6673978c1', - mime: 'audio/x-m4a', - size: 82011, - title: 'audio test', -}; - -/** - * Tests the importer for a single note, checking that the result of - * processing the given `.enex` input file matches the contents of the given - * `.html` file. - * - * Note that this does not test the importing of an entire exported `.enex` - * archive, but rather a single node of such a file. Thus, the test data files - * (e.g. `./enex_to_html/code1.enex`) correspond to the contents of a single - * `...` node in an `.enex` file already extracted from - * ``. - */ -const compareOutputToExpected = (options) => { - const inputFile = fileWithPath(`${options.testName}.enex`); - const outputFile = fileWithPath(`${options.testName}.html`); - const testTitle = `should convert from Enex to Html: ${options.testName}`; - - it(testTitle, asyncTest(async () => { - const enexInput = await shim.fsDriver().readFile(inputFile); - const expectedOutput = await shim.fsDriver().readFile(outputFile); - const actualOutput = await enexXmlToHtml(enexInput, options.resources); - - expect(actualOutput).toEqual(expectedOutput); - })); -}; - -describe('EnexToHtml', function() { - beforeEach(async (done) => { - await setupDatabaseAndSynchronizer(1); - await switchClient(1); - done(); - }); - - compareOutputToExpected({ - testName: 'checklist-list', - resources: [], - }); - - compareOutputToExpected({ - testName: 'svg', - resources: [], - }); - - compareOutputToExpected({ - testName: 'en-media--image', - resources: [{ - filename: '', - id: '89ce7da62c6b2832929a6964237e98e9', // Mock id - mime: 'image/jpeg', - size: 50347, - title: '', - }], - }); - - compareOutputToExpected({ - testName: 'en-media--audio', - resources: [audioResource], - }); - - compareOutputToExpected({ - testName: 'attachment', - resources: [{ - filename: 'attachment-1', - id: '21ca2b948f222a38802940ec7e2e5de3', - mime: 'application/pdf', // Any non-image/non-audio mime type will do - size: 1000, - }], - }); - - it('fails when not given a matching resource', asyncTest(async () => { - // To test the promise-unexpectedly-resolved case, add `audioResource` to the array. - const resources = []; - const inputFile = fileWithPath('en-media--image.enex'); - const enexInput = await shim.fsDriver().readFile(inputFile); - const promisedOutput = enexXmlToHtml(enexInput, resources); - - promisedOutput.then(() => { - // Promise should not be resolved - expect(false).toEqual(true); - }, (reason) => { - expect(reason) - .toBe('Hash with no associated resource: 89ce7da62c6b2832929a6964237e98e9'); - }); - })); - -}); diff --git a/CliClient/tests/enex_to_html/attachment.enex b/CliClient/tests/enex_to_html/attachment.enex deleted file mode 100644 index cf66a3f07..000000000 --- a/CliClient/tests/enex_to_html/attachment.enex +++ /dev/null @@ -1,8 +0,0 @@ - -
- -
-
-
-
-
\ No newline at end of file diff --git a/CliClient/tests/enex_to_html/attachment.html b/CliClient/tests/enex_to_html/attachment.html deleted file mode 100644 index c32fb1310..000000000 --- a/CliClient/tests/enex_to_html/attachment.html +++ /dev/null @@ -1,7 +0,0 @@ - -
attachment-1
-
-
-
-
-
\ No newline at end of file diff --git a/CliClient/tests/enex_to_html/checklist-list.enex b/CliClient/tests/enex_to_html/checklist-list.enex deleted file mode 100644 index 2552fe504..000000000 --- a/CliClient/tests/enex_to_html/checklist-list.enex +++ /dev/null @@ -1,11 +0,0 @@ - -
-

For example, consider an exported Evernote list with todo checkboxes like this:

- -
    -
  • Foo
  • -
  • Bar
  • -
  • Baz
  • -
-
-
diff --git a/CliClient/tests/enex_to_html/checklist-list.html b/CliClient/tests/enex_to_html/checklist-list.html deleted file mode 100644 index 5a6172e9d..000000000 --- a/CliClient/tests/enex_to_html/checklist-list.html +++ /dev/null @@ -1,16 +0,0 @@ - -
-

For example, consider an exported Evernote list with todo checkboxes like this:

-
    -
  • -
    Foo
    -
  • -
  • -
    Bar
    -
  • -
  • -
    Baz
    -
  • -
-
-
\ No newline at end of file diff --git a/CliClient/tests/enex_to_html/en-media--audio.enex b/CliClient/tests/enex_to_html/en-media--audio.enex deleted file mode 100644 index bcd20bcb6..000000000 --- a/CliClient/tests/enex_to_html/en-media--audio.enex +++ /dev/null @@ -1,3 +0,0 @@ - - -

diff --git a/CliClient/tests/enex_to_html/en-media--audio.html b/CliClient/tests/enex_to_html/en-media--audio.html deleted file mode 100644 index c71c6cf7a..000000000 --- a/CliClient/tests/enex_to_html/en-media--audio.html +++ /dev/null @@ -1,13 +0,0 @@ - -
- -

audio test

-
-
-
-
-
-
\ No newline at end of file diff --git a/CliClient/tests/enex_to_html/en-media--image.enex b/CliClient/tests/enex_to_html/en-media--image.enex deleted file mode 100644 index 92a477426..000000000 --- a/CliClient/tests/enex_to_html/en-media--image.enex +++ /dev/null @@ -1 +0,0 @@ -
This is a test
A test for bold
A test for italic

diff --git a/CliClient/tests/enex_to_html/en-media--image.html b/CliClient/tests/enex_to_html/en-media--image.html deleted file mode 100644 index f3c09555e..000000000 --- a/CliClient/tests/enex_to_html/en-media--image.html +++ /dev/null @@ -1,14 +0,0 @@ - -
This is a test
-
A test for bold
-
- A test for italic -
-
-
-
-
-
-
-
-
\ No newline at end of file diff --git a/CliClient/tests/enex_to_html/svg.enex b/CliClient/tests/enex_to_html/svg.enex deleted file mode 100644 index 33cfb89ec..000000000 --- a/CliClient/tests/enex_to_html/svg.enex +++ /dev/null @@ -1,5 +0,0 @@ - -
- -
-
\ No newline at end of file diff --git a/CliClient/tests/enex_to_html/svg.html b/CliClient/tests/enex_to_html/svg.html deleted file mode 100644 index c4f57e7cd..000000000 --- a/CliClient/tests/enex_to_html/svg.html +++ /dev/null @@ -1,3 +0,0 @@ - -
-
\ No newline at end of file diff --git a/ElectronClient/app/app.js b/ElectronClient/app/app.js index 87a5e0544..06180af6d 100644 --- a/ElectronClient/app/app.js +++ b/ElectronClient/app/app.js @@ -378,15 +378,12 @@ class Application extends BaseApplication { message: _('Importing from "%s" as "%s" format. Please wait...', path, module.format), }); - const importOptions = { - path, - format: module.format, - modulePath: module.path, - onError: console.warn, - destinationFolderId: - !module.isNoteArchive && moduleSource === 'file' - ? selectedFolderId - : null, + const importOptions = {}; + importOptions.path = path; + importOptions.format = module.format; + importOptions.destinationFolderId = !module.isNoteArchive && moduleSource === 'file' ? selectedFolderId : null; + importOptions.onError = (error) => { + console.warn(error); }; const service = new InteropService(); diff --git a/ElectronClient/app/package-lock.json b/ElectronClient/app/package-lock.json index a6092da69..ab4c25d5a 100644 --- a/ElectronClient/app/package-lock.json +++ b/ElectronClient/app/package-lock.json @@ -543,535 +543,6 @@ "is-extglob": "^1.0.0" } }, - "fsevents": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.9.tgz", - "integrity": "sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw==", - "dev": true, - "optional": true, - "requires": { - "nan": "^2.12.1", - "node-pre-gyp": "^0.12.0" - }, - "dependencies": { - "abbrev": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "aproba": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true - }, - "are-we-there-yet": { - "version": "1.1.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "balanced-match": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "bundled": true, - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "chownr": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "debug": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ms": "^2.1.1" - } - }, - "deep-extend": { - "version": "0.6.0", - "bundled": true, - "dev": true, - "optional": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "detect-libc": { - "version": "1.0.3", - "bundled": true, - "dev": true, - "optional": true - }, - "fs-minipass": { - "version": "1.2.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "gauge": { - "version": "2.7.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "glob": { - "version": "7.1.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-unicode": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "iconv-lite": { - "version": "0.4.24", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ignore-walk": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minimatch": "^3.0.4" - } - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "bundled": true, - "dev": true - }, - "ini": { - "version": "1.3.5", - "bundled": true, - "dev": true, - "optional": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "bundled": true, - "dev": true - }, - "minipass": { - "version": "2.3.5", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.2.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "mkdirp": { - "version": "0.5.1", - "bundled": true, - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "needle": { - "version": "2.3.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "debug": "^4.1.0", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - } - }, - "node-pre-gyp": { - "version": "0.12.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.1", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.2.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4" - } - }, - "nopt": { - "version": "4.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "npm-bundled": { - "version": "1.0.6", - "bundled": true, - "dev": true, - "optional": true - }, - "npm-packlist": { - "version": "1.4.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1" - } - }, - "npmlog": { - "version": "4.1.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "once": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "osenv": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "process-nextick-args": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "rc": { - "version": "1.2.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "readable-stream": { - "version": "2.3.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "rimraf": { - "version": "2.6.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "glob": "^7.1.3" - } - }, - "safe-buffer": { - "version": "5.1.2", - "bundled": true, - "dev": true - }, - "safer-buffer": { - "version": "2.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "sax": { - "version": "1.2.4", - "bundled": true, - "dev": true, - "optional": true - }, - "semver": { - "version": "5.7.0", - "bundled": true, - "dev": true, - "optional": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "tar": { - "version": "4.4.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.3.4", - "minizlib": "^1.1.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.2" - } - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "wide-align": { - "version": "1.1.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "string-width": "^1.0.2 || 2" - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "yallist": { - "version": "3.0.3", - "bundled": true, - "dev": true - } - } - }, "glob-parent": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", @@ -1086,13 +557,15 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true + "dev": true, + "optional": true }, "is-glob": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, + "optional": true, "requires": { "is-extglob": "^1.0.0" } @@ -1128,13 +601,6 @@ "parse-glob": "^3.0.4", "regex-cache": "^0.4.2" } - }, - "nan": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", - "dev": true, - "optional": true } } }, @@ -1858,6 +1324,12 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==" }, + "fsevents": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.0.6.tgz", + "integrity": "sha512-vfmKZp3XPM36DNF0qhW+Cdxk7xm7gTEHY1clv1Xq1arwRQuKZgAhw+NZNWbJBtuaNxzNXwhfdPYRrvIbjfS33A==", + "optional": true + }, "is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -1918,22 +1390,6 @@ } } }, - "clean-html": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/clean-html/-/clean-html-1.5.0.tgz", - "integrity": "sha512-eDu0vN44ZBvoEU0oRIKwWPIccGWXtdnUNmKJuTukZ1de00Uoqavb5pfIMKiC7/r+knQ5RbvAjGuVZiN3JwJL4Q==", - "requires": { - "htmlparser2": "^3.8.2", - "minimist": "^1.1.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" - } - } - }, "cli-boxes": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz", @@ -2383,32 +1839,6 @@ "@babel/runtime": "^7.1.2" } }, - "dom-serializer": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.1.tgz", - "integrity": "sha512-sK3ujri04WyjwQXVoK4PU3y8ula1stq10GJZpqHIUgoGZdsGzAGu65BnU3d08aTVSvO7mGPZUc0wTEDL+qGE0Q==", - "requires": { - "domelementtype": "^2.0.1", - "entities": "^2.0.0" - }, - "dependencies": { - "domelementtype": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.1.tgz", - "integrity": "sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ==" - }, - "entities": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz", - "integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==" - } - } - }, - "domelementtype": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==" - }, "domexception": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", @@ -2417,23 +1847,6 @@ "webidl-conversions": "^4.0.2" } }, - "domhandler": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", - "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", - "requires": { - "domelementtype": "1" - } - }, - "domutils": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", - "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, "dot-prop": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", @@ -3312,10 +2725,626 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.0.7.tgz", - "integrity": "sha512-a7YT0SV3RB+DjYcppwVDLtn13UQnmg0SWZS7ezZD0UjnLwXmy8Zm21GMVGLaFGimIqcvyMQaOJBrop8MyOp1kQ==", - "optional": true + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", + "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", + "dev": true, + "optional": true, + "requires": { + "nan": "^2.9.2", + "node-pre-gyp": "^0.10.0" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "resolved": false, + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": false, + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true, + "optional": true + }, + "aproba": { + "version": "1.2.0", + "resolved": false, + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "resolved": false, + "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", + "dev": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": false, + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true, + "optional": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": false, + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "optional": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.2.tgz", + "integrity": "sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A==", + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "resolved": false, + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true, + "optional": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": false, + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true, + "optional": true + }, + "console-control-strings": { + "version": "1.1.0", + "resolved": false, + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", + "dev": true, + "optional": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": false, + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true, + "optional": true + }, + "debug": { + "version": "2.6.9", + "resolved": false, + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.5.1", + "resolved": false, + "integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==", + "dev": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "resolved": false, + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "dev": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "resolved": false, + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", + "dev": true, + "optional": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": false, + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "resolved": false, + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "dev": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.2", + "resolved": false, + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "optional": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "resolved": false, + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "dev": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.21", + "resolved": false, + "integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==", + "dev": true, + "optional": true, + "requires": { + "safer-buffer": "^2.1.0" + } + }, + "ignore-walk": { + "version": "3.0.1", + "resolved": false, + "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", + "dev": true, + "optional": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": false, + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "optional": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": false, + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true, + "optional": true + }, + "ini": { + "version": "1.3.5", + "resolved": false, + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": false, + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "optional": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": false, + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": false, + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "optional": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": false, + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true, + "optional": true + }, + "minipass": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", + "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", + "dev": true, + "optional": true + } + } + }, + "minizlib": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", + "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": false, + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "optional": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "resolved": false, + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true, + "optional": true + }, + "needle": { + "version": "2.2.0", + "resolved": false, + "integrity": "sha512-eFagy6c+TYayorXw/qtAdSvaUpEbBsDwDyxYFgLZ0lTojfH7K+OdBqAF7TAFwDokJaGpubpSGG0wO3iC0XPi8w==", + "dev": true, + "optional": true, + "requires": { + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.10.0", + "resolved": false, + "integrity": "sha512-G7kEonQLRbcA/mOoFoxvlMrw6Q6dPf92+t/l0DFSMuSlDoWaI9JWIyPwK0jyE1bph//CUEL65/Fz1m2vJbmjQQ==", + "dev": true, + "optional": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.0", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.1.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + } + }, + "nopt": { + "version": "4.0.1", + "resolved": false, + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", + "dev": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.0.3", + "resolved": false, + "integrity": "sha512-ByQ3oJ/5ETLyglU2+8dBObvhfWXX8dtPZDMePCahptliFX2iIuhyEszyFk401PZUNQH20vvdW5MLjJxkwU80Ow==", + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.1.10", + "resolved": false, + "integrity": "sha512-AQC0Dyhzn4EiYEfIUjCdMl0JJ61I2ER9ukf/sLxJUcZHfo+VyEfz2rMJgLZSS1v30OxPQe1cN0LZA1xbcaVfWA==", + "dev": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": false, + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": false, + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true, + "optional": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": false, + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "resolved": false, + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "optional": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "resolved": false, + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": false, + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.5", + "resolved": false, + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dev": true, + "optional": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": false, + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": false, + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.7", + "resolved": false, + "integrity": "sha512-LdLD8xD4zzLsAT5xyushXDNscEjB7+2ulnl8+r1pnESlYtlJtVSoCMBGr30eDRJ3+2Gq89jK9P9e4tCEH1+ywA==", + "dev": true, + "optional": true, + "requires": { + "deep-extend": "^0.5.1", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": false, + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": false, + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "optional": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.6.2", + "resolved": false, + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "optional": true, + "requires": { + "glob": "^7.0.5" + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": false, + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "dev": true, + "optional": true + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": false, + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "resolved": false, + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true, + "optional": true + }, + "semver": { + "version": "5.5.0", + "resolved": false, + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": false, + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": false, + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true, + "optional": true + }, + "string-width": { + "version": "1.0.2", + "resolved": false, + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "optional": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": false, + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": false, + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "optional": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": false, + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true, + "optional": true + }, + "tar": { + "version": "4.4.10", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz", + "integrity": "sha512-g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA==", + "dev": true, + "optional": true, + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.3.5", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", + "dev": true, + "optional": true + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": false, + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true, + "optional": true + }, + "wide-align": { + "version": "1.1.2", + "resolved": false, + "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", + "dev": true, + "optional": true, + "requires": { + "string-width": "^1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": false, + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true, + "optional": true + }, + "yallist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", + "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", + "dev": true, + "optional": true + } + } }, "fullstore": { "version": "1.1.0", @@ -3402,13 +3431,15 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true + "dev": true, + "optional": true }, "is-glob": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, + "optional": true, "requires": { "is-extglob": "^1.0.0" } @@ -3584,44 +3615,6 @@ } } }, - "htmlparser2": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", - "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", - "requires": { - "domelementtype": "^1.3.1", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^3.1.1" - }, - "dependencies": { - "readable-stream": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", - "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "safe-buffer": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", - "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "requires": { - "safe-buffer": "~5.2.0" - } - } - } - }, "http-errors": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.1.tgz", @@ -4831,6 +4824,7 @@ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true, + "optional": true, "requires": { "remove-trailing-separator": "^1.0.1" } @@ -5202,7 +5196,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true + "dev": true, + "optional": true }, "is-glob": { "version": "2.0.1", @@ -5842,13 +5837,15 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true + "dev": true, + "optional": true }, "repeat-element": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", - "dev": true + "dev": true, + "optional": true }, "repeat-string": { "version": "1.6.1", diff --git a/ElectronClient/app/package.json b/ElectronClient/app/package.json index 67409a63f..a398d1c5b 100644 --- a/ElectronClient/app/package.json +++ b/ElectronClient/app/package.json @@ -87,7 +87,6 @@ "async-mutex": "^0.1.3", "base-64": "^0.1.0", "chokidar": "^3.0.0", - "clean-html": "^1.5.0", "compare-versions": "^3.2.1", "diacritics": "^1.3.0", "diff-match-patch": "^1.0.4", diff --git a/ReactNativeClient/lib/import-enex-html-gen.js b/ReactNativeClient/lib/import-enex-html-gen.js deleted file mode 100644 index 6fbcd0c24..000000000 --- a/ReactNativeClient/lib/import-enex-html-gen.js +++ /dev/null @@ -1,170 +0,0 @@ -const stringToStream = require('string-to-stream'); -const cleanHtml = require('clean-html'); -const resourceUtils = require('lib/resourceUtils.js'); - -function addResourceTag(lines, resource, attributes) { - // Note: refactor to use Resource.markdownTag - if (!attributes.alt) attributes.alt = resource.title; - if (!attributes.alt) attributes.alt = resource.filename; - if (!attributes.alt) attributes.alt = ''; - - const src = `:/${resource.id}`; - - if (resourceUtils.isImageMimeType(resource.mime)) { - lines.push(resourceUtils.imgElement({src, attributes})); - } else if (resource.mime === 'audio/x-m4a') { - /** - * TODO: once https://github.com/laurent22/joplin/issues/1794 is resolved, - * come back to this and make sure it works. - */ - lines.push(resourceUtils.audioElement({ - src, - alt: attributes.alt, - id: resource.id, - })); - } else { - // TODO: figure out what other mime types can be handled more gracefully - lines.push(resourceUtils.attachmentElement({ - src, - attributes, - id: resource.id, - })); - } - - return lines; -} - -function attributeToLowerCase(node) { - if (!node.attributes) return {}; - let output = {}; - for (let n in node.attributes) { - if (!node.attributes.hasOwnProperty(n)) continue; - output[n.toLowerCase()] = node.attributes[n]; - } - return output; -} - -function enexXmlToHtml_(stream, resources) { - let remainingResources = resources.slice(); - - const removeRemainingResource = id => { - for (let i = 0; i < remainingResources.length; i++) { - const r = remainingResources[i]; - if (r.id === id) { - remainingResources.splice(i, 1); - } - } - }; - - return new Promise((resolve, reject) => { - const options = {}; - const strict = false; - var saxStream = require('sax').createStream(strict, options); - - let section = { - type: 'text', - lines: [], - parent: null, - }; - - saxStream.on('error', function(e) { - console.warn(e); - // reject(e); - }); - - - saxStream.on('text', function(text) { - section.lines.push(text); - }); - - saxStream.on('opentag', function(node) { - const tagName = node.name.toLowerCase(); - const attributesStr = resourceUtils.attributesToStr(node.attributes); - - if (tagName === 'en-media') { - const nodeAttributes = attributeToLowerCase(node); - const hash = nodeAttributes.hash; - - let resource = null; - for (let i = 0; i < resources.length; i++) { - let r = resources[i]; - if (r.id == hash) { - resource = r; - removeRemainingResource(r.id); - break; - } - } - - if (!resource) { - // TODO: Extract this duplicate of code in ./import-enex-md-gen.js - let found = false; - for (let i = 0; i < remainingResources.length; i++) { - let r = remainingResources[i]; - if (!r.id) { - resource = Object.assign({}, r); - resource.id = hash; - remainingResources.splice(i, 1); - found = true; - break; - } - } - - if (!found) { - reject(`Hash with no associated resource: ${hash}`); - } - } - - // If the resource does not appear among the note's resources, it - // means it's an attachement. It will be appended along with the - // other remaining resources at the bottom of the markdown text. - if (resource && !!resource.id) { - section.lines = addResourceTag(section.lines, resource, nodeAttributes); - } - } else if (tagName == 'en-todo') { - section.lines.push(''); - } else if (node.isSelfClosing) { - section.lines.push(`<${tagName}${attributesStr}>`); - } else { - section.lines.push(`<${tagName}${attributesStr} />`); - } - }); - - saxStream.on('closetag', function(n) { - const tagName = n ? n.toLowerCase() : n; - section.lines.push(``); - }); - - saxStream.on('attribute', function() {}); - - saxStream.on('end', function() { - resolve({ - content: section, - resources: remainingResources, - }); - }); - - stream.pipe(saxStream); - }); -} - -async function enexXmlToHtml(xmlString, resources, options = {}) { - const stream = stringToStream(xmlString); - let result = await enexXmlToHtml_(stream, resources, options); - - try { - const preCleaning = result.content.lines.join(''); // xmlString - const final = await beautifyHtml(preCleaning); - return final.join(''); - } catch (error) { - console.warn(error); - } -} - -const beautifyHtml = (html) => { - return new Promise((resolve) => { - const options = {wrap: 0}; - cleanHtml.clean(html, options, (...cleanedHtml) => resolve(cleanedHtml)); - }); -}; - -module.exports = {enexXmlToHtml}; diff --git a/ReactNativeClient/lib/import-enex-md-gen.js b/ReactNativeClient/lib/import-enex-md-gen.js index 401558a86..8ffa95c16 100644 --- a/ReactNativeClient/lib/import-enex-md-gen.js +++ b/ReactNativeClient/lib/import-enex-md-gen.js @@ -1,6 +1,5 @@ const stringPadding = require('string-padding'); const stringToStream = require('string-to-stream'); -const resourceUtils = require('lib/resourceUtils.js'); const BLOCK_OPEN = '[[BLOCK_OPEN]]'; const BLOCK_CLOSE = '[[BLOCK_CLOSE]]'; @@ -296,6 +295,12 @@ function collapseWhiteSpaceAndAppend(lines, state, text) { return lines; } +const imageMimeTypes = ['image/cgm', 'image/fits', 'image/g3fax', 'image/gif', 'image/ief', 'image/jp2', 'image/jpeg', 'image/jpm', 'image/jpx', 'image/naplps', 'image/png', 'image/prs.btif', 'image/prs.pti', 'image/t38', 'image/tiff', 'image/tiff-fx', 'image/vnd.adobe.photoshop', 'image/vnd.cns.inf2', 'image/vnd.djvu', 'image/vnd.dwg', 'image/vnd.dxf', 'image/vnd.fastbidsheet', 'image/vnd.fpx', 'image/vnd.fst', 'image/vnd.fujixerox.edmics-mmr', 'image/vnd.fujixerox.edmics-rlc', 'image/vnd.globalgraphics.pgb', 'image/vnd.microsoft.icon', 'image/vnd.mix', 'image/vnd.ms-modi', 'image/vnd.net-fpx', 'image/vnd.sealed.png', 'image/vnd.sealedmedia.softseal.gif', 'image/vnd.sealedmedia.softseal.jpg', 'image/vnd.svf', 'image/vnd.wap.wbmp', 'image/vnd.xiff']; + +function isImageMimeType(m) { + return imageMimeTypes.indexOf(m) >= 0; +} + function tagAttributeToMdText(attr) { // HTML attributes may contain newlines so remove them. // https://github.com/laurent22/joplin/issues/1583 @@ -313,7 +318,7 @@ function addResourceTag(lines, resource, alt = '') { if (!alt) alt = ''; alt = tagAttributeToMdText(alt); - if (resourceUtils.isImageMimeType(resource.mime)) { + if (isImageMimeType(resource.mime)) { lines.push('!['); lines.push(alt); lines.push(`](:/${resource.id})`); diff --git a/ReactNativeClient/lib/import-enex.js b/ReactNativeClient/lib/import-enex.js index 8cf66939a..7b817e67d 100644 --- a/ReactNativeClient/lib/import-enex.js +++ b/ReactNativeClient/lib/import-enex.js @@ -5,7 +5,6 @@ const Note = require('lib/models/Note.js'); const Tag = require('lib/models/Tag.js'); const Resource = require('lib/models/Resource.js'); const { enexXmlToMd } = require('./import-enex-md-gen.js'); -const { enexXmlToHtml } = require('./import-enex-html-gen.js'); const { time } = require('lib/time-utils.js'); const Levenshtein = require('levenshtein'); const md5 = require('md5'); @@ -165,7 +164,6 @@ async function saveNoteToStorage(note, fuzzyMatching = false) { function importEnex(parentFolderId, filePath, importOptions = null) { if (!importOptions) importOptions = {}; - // console.info(JSON.stringify({importOptions}, null, 2)); if (!('fuzzyMatching' in importOptions)) importOptions.fuzzyMatching = false; if (!('onProgress' in importOptions)) importOptions.onProgress = function() {}; if (!('onError' in importOptions)) importOptions.onError = function() {}; @@ -218,15 +216,9 @@ function importEnex(parentFolderId, filePath, importOptions = null) { while (notes.length) { let note = notes.shift(); - const body = importOptions.outputFormat === 'html' ? - await enexXmlToHtml(note.bodyXml, note.resources) : - await enexXmlToMd(note.bodyXml, note.resources); + const body = await enexXmlToMd(note.bodyXml, note.resources); delete note.bodyXml; - note.markup_language = importOptions.outputFormat === 'html' ? - Note.MARKUP_LANGUAGE_HTML : - Note.MARKUP_LANGUAGE_MARKDOWN; - // console.info('*************************************************************************'); // console.info(body); // console.info('*************************************************************************'); diff --git a/ReactNativeClient/lib/resourceUtils.js b/ReactNativeClient/lib/resourceUtils.js deleted file mode 100644 index a6c585354..000000000 --- a/ReactNativeClient/lib/resourceUtils.js +++ /dev/null @@ -1,84 +0,0 @@ -const imageMimeTypes = [ - 'image/cgm', - 'image/fits', - 'image/g3fax', - 'image/gif', - 'image/ief', - 'image/jp2', - 'image/jpeg', - 'image/jpm', - 'image/jpx', - 'image/naplps', - 'image/png', - 'image/prs.btif', - 'image/prs.pti', - 'image/t38', - 'image/tiff', - 'image/tiff-fx', - 'image/vnd.adobe.photoshop', - 'image/vnd.cns.inf2', - 'image/vnd.djvu', - 'image/vnd.dwg', - 'image/vnd.dxf', - 'image/vnd.fastbidsheet', - 'image/vnd.fpx', - 'image/vnd.fst', - 'image/vnd.fujixerox.edmics-mmr', - 'image/vnd.fujixerox.edmics-rlc', - 'image/vnd.globalgraphics.pgb', - 'image/vnd.microsoft.icon', - 'image/vnd.mix', - 'image/vnd.ms-modi', - 'image/vnd.net-fpx', - 'image/vnd.sealed.png', - 'image/vnd.sealedmedia.softseal.gif', - 'image/vnd.sealedmedia.softseal.jpg', - 'image/vnd.svf', - 'image/vnd.wap.wbmp', - 'image/vnd.xiff', -]; - -const escapeQuotes = (str) => str.replace(/"/g, '"'); - -const attributesToStr = (attributes) => - Object.entries(attributes) - .map(([key, value]) => ` ${key}="${escapeQuotes(value)}"`) - .join(''); - -const ipcProxySendToHost = (id) => - `onclick="ipcProxySendToHost('joplin://${id}'); return false;"`; - -const attachmentElement = ({src, attributes, id}) => - [ - ``, - ` ${attributes.alt || src}`, - '', - ].join(''); - -const imgElement = ({src, attributes}) => - ``; - -const audioElement = ({src, alt, id}) => - [ - '', - '

', - ` `, - ` ${alt || src || id || 'Download audio'}`, - ' ', - '

', - ].join(''); - -const resourceUtils = { - imgElement, - audioElement, - attachmentElement, - attributesToStr, - isImageMimeType: (m) => imageMimeTypes.indexOf(m) >= 0, -}; - -module.exports = resourceUtils; diff --git a/ReactNativeClient/lib/services/InteropService.js b/ReactNativeClient/lib/services/InteropService.js index 1d9d6076a..98b4b8163 100644 --- a/ReactNativeClient/lib/services/InteropService.js +++ b/ReactNativeClient/lib/services/InteropService.js @@ -13,7 +13,8 @@ const { toTitleCase } = require('lib/string-utils'); class InteropService { constructor() { - this.modules_ = null; } + this.modules_ = null; + } modules() { if (this.modules_) return this.modules_; @@ -41,16 +42,7 @@ class InteropService { format: 'enex', fileExtensions: ['enex'], sources: ['file'], - description: _('Evernote Export File (as Markdown)'), - importerClass: 'InteropService_Importer_EnexToMd', - }, - { - format: 'enex', - fileExtensions: ['enex'], - sources: ['file'], - description: _('Evernote Export File (as HTML)'), - // TODO: Consider doing this the same way as the multiple `md` importers are handled - importerClass: 'InteropService_Importer_EnexToHtml', + description: _('Evernote Export File'), }, ]; @@ -120,9 +112,8 @@ class InteropService { return this.modules_; } - findModuleByFormat_(type, format) { + moduleByFormat_(type, format) { const modules = this.modules(); - // console.log(JSON.stringify({modules}, null, 2)) for (let i = 0; i < modules.length; i++) { const m = modules[i]; if (m.format === format && m.type === type) return modules[i]; @@ -130,8 +121,8 @@ class InteropService { return null; } - newModuleByFormat_(type, format) { - const module = this.findModuleByFormat_(type, format); + newModule_(type, format) { + const module = this.moduleByFormat_(type, format); if (!module) throw new Error(_('Cannot load "%s" module for format "%s"', type, format)); const ModuleClass = require(module.path); const output = new ModuleClass(); @@ -139,26 +130,6 @@ class InteropService { return output; } - /** - * The existing `newModuleByFormat_` fn would load by the input format. This - * was fine when there was a 1-1 mapping of input formats to output formats, - * but now that we have 2 possible outputs for an `enex` input, we need to be - * explicit with which importer we want to use. - * - * In the long run, it might make sense to simply move all the existing - * formatters to the `newModuleFromPath_` approach, so that there's only one - * way to do this mapping. - * - * https://github.com/laurent22/joplin/pull/1795#pullrequestreview-281574417 - */ - newModuleFromPath_(options) { - if (!options || !options.modulePath) throw new Error('Cannot load module without a defined path to load from.'); - const ModuleClass = require(options.modulePath); - const output = new ModuleClass(); - output.setMetadata(options); // TODO: Check that this metadata is equivalent to module above - return output; - } - moduleByFileExtension_(type, ext) { ext = ext.toLowerCase(); @@ -202,10 +173,7 @@ class InteropService { let result = { warnings: [] }; - // console.log('options passed to InteropService:'); - // console.log(JSON.stringify({options}, null, 2)); - - const importer = this.newModuleFromPath_(options); + const importer = this.newModule_('importer', options.format); await importer.init(options.path, options); result = await importer.exec(result); @@ -280,7 +248,7 @@ class InteropService { await queueExportItem(BaseModel.TYPE_TAG, exportedTagIds[i]); } - const exporter = this.newModuleByFormat_('exporter', exportFormat); + const exporter = this.newModule_('exporter', exportFormat); await exporter.init(exportPath); const typeOrder = [BaseModel.TYPE_FOLDER, BaseModel.TYPE_RESOURCE, BaseModel.TYPE_NOTE, BaseModel.TYPE_TAG, BaseModel.TYPE_NOTE_TAG]; diff --git a/ReactNativeClient/lib/services/InteropService_Importer_EnexToMd.js b/ReactNativeClient/lib/services/InteropService_Importer_Enex.js similarity index 81% rename from ReactNativeClient/lib/services/InteropService_Importer_EnexToMd.js rename to ReactNativeClient/lib/services/InteropService_Importer_Enex.js index c3ebb8694..ad97fa67c 100644 --- a/ReactNativeClient/lib/services/InteropService_Importer_EnexToMd.js +++ b/ReactNativeClient/lib/services/InteropService_Importer_Enex.js @@ -2,7 +2,7 @@ const InteropService_Importer_Base = require('lib/services/InteropService_Import const Folder = require('lib/models/Folder.js'); const { filename } = require('lib/path-utils.js'); -class InteropService_Importer_EnexToMd extends InteropService_Importer_Base { +class InteropService_Importer_Enex extends InteropService_Importer_Base { async exec(result) { const { importEnex } = require('lib/import-enex'); @@ -19,4 +19,4 @@ class InteropService_Importer_EnexToMd extends InteropService_Importer_Base { } } -module.exports = InteropService_Importer_EnexToMd; +module.exports = InteropService_Importer_Enex; diff --git a/ReactNativeClient/lib/services/InteropService_Importer_EnexToHtml.js b/ReactNativeClient/lib/services/InteropService_Importer_EnexToHtml.js deleted file mode 100644 index a58dd002c..000000000 --- a/ReactNativeClient/lib/services/InteropService_Importer_EnexToHtml.js +++ /dev/null @@ -1,22 +0,0 @@ -const InteropService_Importer_Base = require('lib/services/InteropService_Importer_Base'); -const Folder = require('lib/models/Folder.js'); -const { filename } = require('lib/path-utils.js'); - -class InteropService_Importer_EnexToHtml extends InteropService_Importer_Base { - async exec(result) { - const { importEnex } = require('lib/import-enex'); - - let folder = this.options_.destinationFolder; - - if (!folder) { - const folderTitle = await Folder.findUniqueItemTitle(filename(this.sourcePath_)); - folder = await Folder.save({ title: folderTitle }); - } - - await importEnex(folder.id, this.sourcePath_, {...this.options_, outputFormat: 'html'}); - - return result; - } -} - -module.exports = InteropService_Importer_EnexToHtml;