From f3ae477a01d7b730e150b1238d9d11a8e31842ba Mon Sep 17 00:00:00 2001 From: Chris Chinchilla Date: Wed, 21 Jun 2023 14:20:30 +0200 Subject: [PATCH] Package updates, remove noisy console and update readme --- README.md | 27 +++--- dist/extension.js | 240 +++++++++++++++++++++++++++++++++++++++++++++- package-lock.json | 102 ++++++++++---------- package.json | 14 +-- src/extension.ts | 19 ---- 5 files changed, 312 insertions(+), 90 deletions(-) diff --git a/README.md b/README.md index a393ba5..da95833 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # vscode-pandoc -The vscode-pandoc [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=chrischinchilla.vscode-pandoc) extension lets you render markdown files as a pdf, word document, or html file. +The vscode-pandoc [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=chrischinchilla.vscode-pandoc) extension lets you render markdown files as a PDF, word document, or html file. _Thanks to the previous work of [@dfinke](https://github.com/dfinke) on this extension._ @@ -8,19 +8,24 @@ _Thanks to the previous work of [@dfinke](https://github.com/dfinke) on this ext You need to [**install Pandoc**](http://pandoc.org/installing.html) - a universal document converter. -Alternatively you may set the `useDocker` option to true and it will run Pandoc in a container using the latest official [pandoc/latex](https://hub.docker.com/r/pandoc/latex) image. This could result in a delay the first time it runs, or after an update to the container while it pulls down the new image. +Alternatively you may set the `useDocker` option to true and the extension runs Pandoc in a container using the latest official [pandoc/latex](https://hub.docker.com/r/pandoc/latex) image. This could result in a delay the first time it runs, or after an update to the container while it pulls down the new image. ## Usage Two ways to run the extension. You need to have a markdown file open. 1. press `F1` on Windows (`shift+cmd+P` on Mac), type `pandoc`, press `Enter` -1. Or - press the key chord `ctrl+K` then `P` (`cmd+K` then `P` on Mac) +1. Or - press the key commination `ctrl+K` then `P` (`cmd+K` then `P` on Mac) -Then choose from the list what document type you want to render and press `enter` (you can also type in the box rather than cursor around). +Choose from the list what document type you want to render and press `enter` (you can also type in the box rather than cursor around). ## Releases +* June 21st, 2023 + * Package updates + * Read me updates + * Remove noisy console messages + * Add Docker support * May 10th, 2023 * Package updates * Added build workflows @@ -41,12 +46,9 @@ Then choose from the list what document type you want to render and press `enter * Handling of the path that contains spaces * Add the open command (xdg-open) in linux -## **Setting additional pandoc options** +## Setting additional pandoc options -1. choose 'Preference -> UserSettings' -1. Find: pandoc in Default Settings -1. Copy and paste -1. to settings.json +Find `pandoc` in _settings.json_ and add the options you want to use. For example: example: @@ -69,10 +71,11 @@ example: "pandoc.useDocker": "true" ``` -* if necessary to set options for each output format. - * default: `$ pandoc inFile.md -o outFile.{pdf|word|html}` +You can set options for each output format. + +> default: `$ pandoc inFile.md -o outFile.{pdf|word|html}` -## Example: Setting for Japanese document +For example, for Japanese documents. * PDF diff --git a/dist/extension.js b/dist/extension.js index 607245a..d192f98 100644 --- a/dist/extension.js +++ b/dist/extension.js @@ -1 +1,239 @@ -(()=>{"use strict";var e={112:function(e,o,t){var n=this&&this.__createBinding||(Object.create?function(e,o,t,n){void 0===n&&(n=t),Object.defineProperty(e,n,{enumerable:!0,get:function(){return o[t]}})}:function(e,o,t,n){void 0===n&&(n=t),e[n]=o[t]}),r=this&&this.__setModuleDefault||(Object.create?function(e,o){Object.defineProperty(e,"default",{enumerable:!0,value:o})}:function(e,o){e.default=o}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var o={};if(null!=e)for(var t in e)"default"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&n(o,e,t);return r(o,e),o};Object.defineProperty(o,"__esModule",{value:!0}),o.activate=void 0;const c=a(t(496)),i=t(81),s=a(t(17));var p=c.window.createOutputChannel("Pandoc");function d(e,o){var t=e+" ["+o+"] "+(new Date).toLocaleTimeString();c.window.setStatusBarMessage(t,1500)}o.activate=function(e){var o=c.commands.registerCommand("pandoc.render",(()=>{const e=c.window.activeTextEditor;if(!e)return;let o=s.normalize(e.document.fileName);var t=s.dirname(o),n=s.basename(o),r=s.parse(n).name;let a=[];a.push({label:"pdf",description:"Render as pdf document"}),a.push({label:"docx",description:"Render as word document"}),a.push({label:"html",description:"Render as html document"}),a.push({label:"asciidoc",description:"Render as asciidoc document"}),a.push({label:"docbook",description:"Render as docbook document"}),a.push({label:"epub",description:"Render as epub document"}),a.push({label:"rst",description:"Render as rst document"}),c.window.showQuickPick(a).then((e=>{if(e){var o=s.join(t,n).replace(/(^.*$)/gm,'"$1"'),a=(s.join(t,r)+"."+e.label).replace(/(^.*$)/gm,'"$1"');d("Generating",e.label);var l=function(e){var o;switch(e){case"pdf":o=c.workspace.getConfiguration("pandoc").get("pdfOptString"),console.log("pdocOptstring = "+o);break;case"docx":o=c.workspace.getConfiguration("pandoc").get("docxOptString"),console.log("pdocOptstring = "+o);break;case"html":o=c.workspace.getConfiguration("pandoc").get("htmlOptString"),console.log("pdocOptstring = "+o);break;case"asciidoc":o=c.workspace.getConfiguration("pandoc").get("asciidocOptString"),console.log("pdocOptstring = "+o);break;case"docbook":o=c.workspace.getConfiguration("pandoc").get("docbookOptString"),console.log("pdocOptstring = "+o);break;case"epub":o=c.workspace.getConfiguration("pandoc").get("epubOptString"),console.log("pdocOptstring = "+o);break;case"rst":o=c.workspace.getConfiguration("pandoc").get("rstOptString"),console.log("pdocOptstring = "+o)}return o}(e.label);console.log("debug: outFile = "+o),console.log("debug: inFile = "+a),console.log("debug: pandoc "+o+" -o "+a+l);var u=function(){var e;return console.log(c.workspace.getConfiguration("pandoc").get("executable")),c.workspace.getConfiguration("pandoc").has("executable")&&""!==c.workspace.getConfiguration("pandoc").get("executable")&&(e=c.workspace.getConfiguration("pandoc").get("executable")),e}();console.log("debug: pandoc executable path = "+u);var g='"'+u+'" '+o+" -o "+a+" "+l;console.log("debug: exec "+g),(0,i.exec)(g,{cwd:t},(function(o,t,n){null!==t&&(console.log(t.toString()),p.append(t.toString()+"\n")),null!==n&&(console.log(n.toString()),""!==n&&(c.window.showErrorMessage("stderr: "+n.toString()),p.append("stderr: "+n.toString()+"\n"))),null!==o?(console.log("exec error: "+o),c.window.showErrorMessage("exec error: "+o),p.append("exec error: "+o+"\n")):c.workspace.getConfiguration("pandoc").get("render.openViewer")&&(d("Launching",e.label),function(e){switch(process.platform){case"darwin":(0,i.exec)("open "+e);break;case"linux":(0,i.exec)("xdg-open "+e);break;default:(0,i.exec)(e)}}(a))}))}}))}));e.subscriptions.push(o)}},496:e=>{e.exports=require("vscode")},81:e=>{e.exports=require("child_process")},17:e=>{e.exports=require("path")}},o={},t=function t(n){var r=o[n];if(void 0!==r)return r.exports;var a=o[n]={exports:{}};return e[n].call(a.exports,a,a.exports,t),a.exports}(112);module.exports=t})(); \ No newline at end of file +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "vscode": +/*!*************************!*\ + !*** external "vscode" ***! + \*************************/ +/***/ ((module) => { + +module.exports = require("vscode"); + +/***/ }), + +/***/ "child_process": +/*!********************************!*\ + !*** external "child_process" ***! + \********************************/ +/***/ ((module) => { + +module.exports = require("child_process"); + +/***/ }), + +/***/ "path": +/*!***********************!*\ + !*** external "path" ***! + \***********************/ +/***/ ((module) => { + +module.exports = require("path"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +/*!**************************!*\ + !*** ./src/extension.ts ***! + \**************************/ +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ activate: () => (/* binding */ activate) +/* harmony export */ }); +/* harmony import */ var vscode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vscode */ "vscode"); +/* harmony import */ var vscode__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vscode__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! child_process */ "child_process"); +/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! path */ "path"); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__); + + + +var pandocOutputChannel = vscode__WEBPACK_IMPORTED_MODULE_0__.window.createOutputChannel('Pandoc'); +function setStatusBarText(what, docType) { + var date = new Date(); + var text = what + ' [' + docType + '] ' + date.toLocaleTimeString(); + vscode__WEBPACK_IMPORTED_MODULE_0__.window.setStatusBarMessage(text, 1500); +} +function getPandocOptions(quickPickLabel) { + var pandocOptions; + switch (quickPickLabel) { + case 'pdf': + pandocOptions = vscode__WEBPACK_IMPORTED_MODULE_0__.workspace.getConfiguration('pandoc').get('pdfOptString'); + break; + case 'docx': + pandocOptions = vscode__WEBPACK_IMPORTED_MODULE_0__.workspace.getConfiguration('pandoc').get('docxOptString'); + break; + case 'html': + pandocOptions = vscode__WEBPACK_IMPORTED_MODULE_0__.workspace.getConfiguration('pandoc').get('htmlOptString'); + break; + case 'asciidoc': + pandocOptions = vscode__WEBPACK_IMPORTED_MODULE_0__.workspace.getConfiguration('pandoc').get('asciidocOptString'); + break; + case 'docbook': + pandocOptions = vscode__WEBPACK_IMPORTED_MODULE_0__.workspace.getConfiguration('pandoc').get('docbookOptString'); + break; + case 'epub': + pandocOptions = vscode__WEBPACK_IMPORTED_MODULE_0__.workspace.getConfiguration('pandoc').get('epubOptString'); + break; + case 'rst': + pandocOptions = vscode__WEBPACK_IMPORTED_MODULE_0__.workspace.getConfiguration('pandoc').get('rstOptString'); + break; + } + return pandocOptions; +} +function openDocument(outFile) { + switch (process.platform) { + case 'darwin': + (0,child_process__WEBPACK_IMPORTED_MODULE_1__.exec)('open ' + outFile); + break; + case 'linux': + (0,child_process__WEBPACK_IMPORTED_MODULE_1__.exec)('xdg-open ' + outFile); + break; + default: + (0,child_process__WEBPACK_IMPORTED_MODULE_1__.exec)(outFile); + } +} +function getPandocExecutablePath() { + // By default pandoc executable should be in the PATH environment variable. + var pandocExecutablePath; + console.log(vscode__WEBPACK_IMPORTED_MODULE_0__.workspace.getConfiguration('pandoc').get('executable')); + if (vscode__WEBPACK_IMPORTED_MODULE_0__.workspace.getConfiguration('pandoc').has('executable') && + vscode__WEBPACK_IMPORTED_MODULE_0__.workspace.getConfiguration('pandoc').get('executable') !== '') { + pandocExecutablePath = vscode__WEBPACK_IMPORTED_MODULE_0__.workspace.getConfiguration('pandoc').get('executable'); + } + return pandocExecutablePath; +} +function activate(context) { + var disposable = vscode__WEBPACK_IMPORTED_MODULE_0__.commands.registerCommand('pandoc.render', () => { + const editor = vscode__WEBPACK_IMPORTED_MODULE_0__.window.activeTextEditor; + if (!editor) { + return; + } + let fullName = path__WEBPACK_IMPORTED_MODULE_2__.normalize(editor.document.fileName); + var filePath = path__WEBPACK_IMPORTED_MODULE_2__.dirname(fullName); + var fileName = path__WEBPACK_IMPORTED_MODULE_2__.basename(fullName); + var fileNameOnly = path__WEBPACK_IMPORTED_MODULE_2__.parse(fileName).name; + let items = []; + items.push({ label: 'pdf', description: 'Render as pdf document' }); + items.push({ label: 'docx', description: 'Render as word document' }); + items.push({ label: 'html', description: 'Render as html document' }); + items.push({ label: 'asciidoc', description: 'Render as asciidoc document' }); + items.push({ label: 'docbook', description: 'Render as docbook document' }); + items.push({ label: 'epub', description: 'Render as epub document' }); + items.push({ label: 'rst', description: 'Render as rst document' }); + vscode__WEBPACK_IMPORTED_MODULE_0__.window.showQuickPick(items).then((qpSelection) => { + if (!qpSelection) { + return; + } + var inFile = path__WEBPACK_IMPORTED_MODULE_2__.join(filePath, fileName).replace(/(^.*$)/gm, "\"" + "$1" + "\""); + var outFile = (path__WEBPACK_IMPORTED_MODULE_2__.join(filePath, fileNameOnly) + '.' + qpSelection.label).replace(/(^.*$)/gm, "\"" + "$1" + "\""); + setStatusBarText('Generating', qpSelection.label); + var pandocOptions = getPandocOptions(qpSelection.label); + var pandocExecutablePath = getPandocExecutablePath(); + var useDocker = vscode__WEBPACK_IMPORTED_MODULE_0__.workspace.getConfiguration('pandoc').get('useDocker'); + var targetExec = useDocker + ? `docker run --rm -v "${filePath}:/data" pandoc/latex:latest "${fileName}" -o "${fileNameOnly}.${qpSelection.label}" ${pandocOptions}` + : `"${pandocExecutablePath}" ${inFile} -o ${outFile} ${pandocOptions}`; + var child = (0,child_process__WEBPACK_IMPORTED_MODULE_1__.exec)(targetExec, { cwd: filePath }, function (error, stdout, stderr) { + if (stdout !== null) { + pandocOutputChannel.append(stdout.toString() + '\n'); + } + if (stderr !== null) { + if (stderr !== "") { + vscode__WEBPACK_IMPORTED_MODULE_0__.window.showErrorMessage('stderr: ' + stderr.toString()); + pandocOutputChannel.append('stderr: ' + stderr.toString() + '\n'); + } + } + if (error !== null) { + vscode__WEBPACK_IMPORTED_MODULE_0__.window.showErrorMessage('exec error: ' + error); + pandocOutputChannel.append('exec error: ' + error + '\n'); + } + else { + var openViewer = vscode__WEBPACK_IMPORTED_MODULE_0__.workspace.getConfiguration('pandoc').get('render.openViewer'); + if (openViewer) { + setStatusBarText('Launching', qpSelection.label); + openDocument(outFile); + } + } + }); + }); + }); + context.subscriptions.push(disposable); +} + +})(); + +module.exports = __webpack_exports__; +/******/ })() +; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 6774753..7ee40d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,20 +6,20 @@ "packages": { "": { "name": "vscode-pandoc", - "version": "0.4.2", + "version": "0.4.3", "license": "SEE LICENSE", "devDependencies": { - "@types/node": "^20.1.1", - "@types/vscode": "^1.78.0", - "ts-loader": "^9.4.2", + "@types/node": "^20.3.1", + "@types/vscode": "^1.79.1", + "ts-loader": "^9.4.3", "tslint": "^6.1.3", - "typescript": "^5.0.4", + "typescript": "^5.1.3", "vscode-test": "^1.6.1", - "webpack": "^5.82.0", - "webpack-cli": "^5.1.1" + "webpack": "^5.87.0", + "webpack-cli": "^5.1.4" }, "engines": { - "vscode": "^1.77.0" + "vscode": "^1.79.0" } }, "node_modules/@babel/code-frame": { @@ -228,15 +228,15 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.1.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.1.tgz", - "integrity": "sha512-uKBEevTNb+l6/aCQaKVnUModfEMjAl98lw2Si9P5y4hLu9tm6AlX2ZIoXZX6Wh9lJueYPrGPKk5WMCNHg/u6/A==", + "version": "20.3.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.1.tgz", + "integrity": "sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg==", "dev": true }, "node_modules/@types/vscode": { - "version": "1.78.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.78.0.tgz", - "integrity": "sha512-LJZIJpPvKJ0HVQDqfOy6W4sNKUBBwyDu1Bs8chHBZOe9MNuKTJtidgZ2bqjhmmWpUb0TIIqv47BFUcVmAsgaVA==", + "version": "1.79.1", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.79.1.tgz", + "integrity": "sha512-Ikwc4YbHABzqthrWfeAvItaAIfX9mdjMWxqNgTpGjhgOu0TMRq9LzyZ2yBK0JhYqoSjEubEPawf6zJgnl6Egtw==", "dev": true }, "node_modules/@webassemblyjs/ast": { @@ -386,9 +386,9 @@ } }, "node_modules/@webpack-cli/configtest": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.1.0.tgz", - "integrity": "sha512-K/vuv72vpfSEZoo5KIU0a2FsEoYdW0DUMtMpB5X3LlUwshetMZRZRxB7sCsVji/lFaSxtQQ3aM9O4eMolXkU9w==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.1.1.tgz", + "integrity": "sha512-wy0mglZpDSiSS0XHrVR+BAdId2+yxPSoJW8fsna3ZpYSlufjvxnP4YbKTCBZnNIcGN4r6ZPXV55X4mYExOfLmw==", "dev": true, "engines": { "node": ">=14.15.0" @@ -399,9 +399,9 @@ } }, "node_modules/@webpack-cli/info": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.1.tgz", - "integrity": "sha512-fE1UEWTwsAxRhrJNikE7v4EotYflkEhBL7EbajfkPlf6E37/2QshOy/D48Mw8G5XMFlQtS6YV42vtbG9zBpIQA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.2.tgz", + "integrity": "sha512-zLHQdI/Qs1UyT5UBdWNqsARasIA+AaF8t+4u2aS2nEpBQh2mWIVb8qAklq0eUENnC5mOItrIB4LiS9xMtph18A==", "dev": true, "engines": { "node": ">=14.15.0" @@ -412,9 +412,9 @@ } }, "node_modules/@webpack-cli/serve": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.4.tgz", - "integrity": "sha512-0xRgjgDLdz6G7+vvDLlaRpFatJaJ69uTalZLRSMX5B3VUrDmXcrVA3+6fXXQgmYz7bY9AAgs348XQdmtLsK41A==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.5.tgz", + "integrity": "sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ==", "dev": true, "engines": { "node": ">=14.15.0" @@ -454,9 +454,9 @@ } }, "node_modules/acorn-import-assertions": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", - "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz", + "integrity": "sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==", "dev": true, "peerDependencies": { "acorn": "^8" @@ -809,9 +809,9 @@ "dev": true }, "node_modules/enhanced-resolve": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.14.0.tgz", - "integrity": "sha512-+DCows0XNwLDcUhbFJPdlQEVnT2zXlCv7hPxemTz86/O+B/hCQ+mb7ydkPKiflpVraqLPCAfu7lDy+hBXueojw==", + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", + "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", "dev": true, "dependencies": { "graceful-fs": "^4.2.4", @@ -1603,9 +1603,9 @@ "dev": true }, "node_modules/schema-utils": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.2.tgz", - "integrity": "sha512-pvjEHOgWc9OWA/f/DE3ohBWTD6EleVLf7iFUkoSwAxttdBhB9QUebQgxER2kWueOvRJXPHNnyrvvh9eZINB8Eg==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.8", @@ -1824,9 +1824,9 @@ } }, "node_modules/ts-loader": { - "version": "9.4.2", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.2.tgz", - "integrity": "sha512-OmlC4WVmFv5I0PpaxYb+qGeGOdm5giHU7HwDDUjw59emP2UYMHy9fFSDcYgSNoH8sXcj4hGCSEhlDZ9ULeDraA==", + "version": "9.4.3", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.3.tgz", + "integrity": "sha512-n3hBnm6ozJYzwiwt5YRiJZkzktftRpMiBApHaJPoWLA+qetQBAXkHqCLM6nwSdRDimqVtA5ocIkcTRLMTt7yzA==", "dev": true, "dependencies": { "chalk": "^4.1.0", @@ -1963,16 +1963,16 @@ } }, "node_modules/typescript": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", - "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.3.tgz", + "integrity": "sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=12.20" + "node": ">=14.17" } }, "node_modules/unzipper": { @@ -2068,9 +2068,9 @@ } }, "node_modules/webpack": { - "version": "5.82.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.82.0.tgz", - "integrity": "sha512-iGNA2fHhnDcV1bONdUu554eZx+XeldsaeQ8T67H6KKHl2nUSwX8Zm7cmzOA46ox/X1ARxf7Bjv8wQ/HsB5fxBg==", + "version": "5.87.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.87.0.tgz", + "integrity": "sha512-GOu1tNbQ7p1bDEoFRs2YPcfyGs8xq52yyPBZ3m2VGnXGtV9MxjrkABHm4V9Ia280OefsSLzvbVoXcfLxjKY/Iw==", "dev": true, "dependencies": { "@types/eslint-scope": "^3.7.3", @@ -2079,10 +2079,10 @@ "@webassemblyjs/wasm-edit": "^1.11.5", "@webassemblyjs/wasm-parser": "^1.11.5", "acorn": "^8.7.1", - "acorn-import-assertions": "^1.7.6", + "acorn-import-assertions": "^1.9.0", "browserslist": "^4.14.5", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.13.0", + "enhanced-resolve": "^5.15.0", "es-module-lexer": "^1.2.1", "eslint-scope": "5.1.1", "events": "^3.2.0", @@ -2092,7 +2092,7 @@ "loader-runner": "^4.2.0", "mime-types": "^2.1.27", "neo-async": "^2.6.2", - "schema-utils": "^3.1.2", + "schema-utils": "^3.2.0", "tapable": "^2.1.1", "terser-webpack-plugin": "^5.3.7", "watchpack": "^2.4.0", @@ -2115,15 +2115,15 @@ } }, "node_modules/webpack-cli": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.1.1.tgz", - "integrity": "sha512-OLJwVMoXnXYH2ncNGU8gxVpUtm3ybvdioiTvHgUyBuyMLKiVvWy+QObzBsMtp5pH7qQoEuWgeEUQ/sU3ZJFzAw==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.1.4.tgz", + "integrity": "sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==", "dev": true, "dependencies": { "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^2.1.0", - "@webpack-cli/info": "^2.0.1", - "@webpack-cli/serve": "^2.0.4", + "@webpack-cli/configtest": "^2.1.1", + "@webpack-cli/info": "^2.0.2", + "@webpack-cli/serve": "^2.0.5", "colorette": "^2.0.14", "commander": "^10.0.1", "cross-spawn": "^7.0.3", diff --git a/package.json b/package.json index 6300ee7..f5cb15c 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/sponsors/ChrisChinchilla" }, "engines": { - "vscode": "^1.78.0" + "vscode": "^1.79.0" }, "categories": [ "Other" @@ -115,13 +115,13 @@ "test-compile": "tsc -p ./" }, "devDependencies": { - "typescript": "^5.0.4", + "typescript": "^5.1.3", "vscode-test": "^1.6.1", - "@types/vscode": "^1.78.0", - "@types/node": "^20.1.1", - "webpack": "^5.82.0", - "webpack-cli": "^5.1.1", - "ts-loader": "^9.4.2", + "@types/vscode": "^1.79.1", + "@types/node": "^20.3.1", + "webpack": "^5.87.0", + "webpack-cli": "^5.1.4", + "ts-loader": "^9.4.3", "tslint": "^6.1.3" } } diff --git a/src/extension.ts b/src/extension.ts index 08f5e75..8533a87 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -16,31 +16,24 @@ function getPandocOptions(quickPickLabel: string) { switch (quickPickLabel) { case 'pdf': pandocOptions = vscode.workspace.getConfiguration('pandoc').get('pdfOptString'); - console.log('pdocOptstring = ' + pandocOptions); break; case 'docx': pandocOptions = vscode.workspace.getConfiguration('pandoc').get('docxOptString'); - console.log('pdocOptstring = ' + pandocOptions); break; case 'html': pandocOptions = vscode.workspace.getConfiguration('pandoc').get('htmlOptString'); - console.log('pdocOptstring = ' + pandocOptions); break; case 'asciidoc': pandocOptions = vscode.workspace.getConfiguration('pandoc').get('asciidocOptString'); - console.log('pdocOptstring = ' + pandocOptions); break; case 'docbook': pandocOptions = vscode.workspace.getConfiguration('pandoc').get('docbookOptString'); - console.log('pdocOptstring = ' + pandocOptions); break; case 'epub': pandocOptions = vscode.workspace.getConfiguration('pandoc').get('epubOptString'); - console.log('pdocOptstring = ' + pandocOptions); break; case 'rst': pandocOptions = vscode.workspace.getConfiguration('pandoc').get('rstOptString'); - console.log('pdocOptstring = ' + pandocOptions); break; } @@ -73,8 +66,6 @@ function getPandocExecutablePath() { export function activate(context: vscode.ExtensionContext) { - // console.log('Congratulations, your extension "vscode-pandoc" is now active!'); - var disposable = vscode.commands.registerCommand('pandoc.render', () => { const editor = vscode.window.activeTextEditor; @@ -106,29 +97,20 @@ export function activate(context: vscode.ExtensionContext) { setStatusBarText('Generating', qpSelection.label); var pandocOptions = getPandocOptions(qpSelection.label); - - // debug - console.log('debug: outFile = ' + inFile); - console.log('debug: inFile = ' + outFile); - console.log('debug: pandoc ' + inFile + ' -o ' + outFile + pandocOptions); var pandocExecutablePath = getPandocExecutablePath(); - console.log('debug: pandoc executable path = ' + pandocExecutablePath); var useDocker = vscode.workspace.getConfiguration('pandoc').get('useDocker'); var targetExec = useDocker ? `docker run --rm -v "${filePath}:/data" pandoc/latex:latest "${fileName}" -o "${fileNameOnly}.${qpSelection.label}" ${pandocOptions}` : `"${pandocExecutablePath}" ${inFile} -o ${outFile} ${pandocOptions}`; - console.log('debug: exec ' + targetExec); var child = exec(targetExec, { cwd: filePath }, function (error, stdout, stderr) { if (stdout !== null) { - console.log(stdout.toString()); pandocOutputChannel.append(stdout.toString() + '\n'); } if (stderr !== null) { - console.log(stderr.toString()); if (stderr !== "") { vscode.window.showErrorMessage('stderr: ' + stderr.toString()); pandocOutputChannel.append('stderr: ' + stderr.toString() + '\n'); @@ -136,7 +118,6 @@ export function activate(context: vscode.ExtensionContext) { } if (error !== null) { - console.log('exec error: ' + error); vscode.window.showErrorMessage('exec error: ' + error); pandocOutputChannel.append('exec error: ' + error + '\n'); } else {