UNPKG

cloudstudio

Version:

Run VS Code on a remote server.

2 lines 13.6 kB
(()=>{"use strict";var e={800:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.config=t.loadMessageBundle=t.localize=t.format=t.setPseudo=t.isPseudo=t.isString=t.isNumber=t.isDefined=t.BundleFormat=t.MessageFormat=void 0;var o,n,s,a=r(926);function i(e){return void 0!==e}(s=t.MessageFormat||(t.MessageFormat={})).file="file",s.bundle="bundle",s.both="both",(n=t.BundleFormat||(t.BundleFormat={})).standalone="standalone",n.languagePack="languagePack",function(e){e.is=function(e){var t=e;return t&&i(t.key)&&i(t.comment)}}(o||(o={})),t.isDefined=i;var c=Object.prototype.toString;function u(e,r){return t.isPseudo&&(e="["+e.replace(/[aouei]/g,"$&$&")+"]"),0===r.length?e:e.replace(/\{(\d+)\}/g,(function(e,t){var o=t[0],n=r[o],s=e;return"string"==typeof n?s=n:"number"!=typeof n&&"boolean"!=typeof n&&null!=n||(s=String(n)),s}))}t.isNumber=function(e){return"[object Number]"===c.call(e)},t.isString=function(e){return"[object String]"===c.call(e)},t.isPseudo=!1,t.setPseudo=function(e){t.isPseudo=e},t.format=u,t.localize=function(e,t){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];return u(t,r)},t.loadMessageBundle=function(e){return(0,a.default)().loadMessageBundle(e)},t.config=function(e){return(0,a.default)().config(e)}},926:(e,t)=>{var r;function o(){if(void 0===r)throw new Error("No runtime abstraction layer installed");return r}Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.install=function(e){if(void 0===e)throw new Error("No runtime abstraction layer provided");r=e}}(o||(o={})),t.default=o},472:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.config=t.loadMessageBundle=t.BundleFormat=t.MessageFormat=void 0;var o,n,s=r(622),a=r(747),i=r(926),c=r(800),u=r(800);function l(e){return JSON.parse(a.readFileSync(e,"utf8"))}function d(e){return function(t,r){for(var o=[],n=2;n<arguments.length;n++)o[n-2]=arguments[n];return(0,c.isNumber)(t)?t>=e.length?void console.error("Broken localize call found. Index out of bounds. Stacktrace is\n: ".concat(new Error("").stack)):(0,c.format)(e[t],o):(0,c.isString)(r)?(console.warn("Message ".concat(r," didn't get externalized correctly.")),(0,c.format)(r,o)):void console.error("Broken localize call found. Stacktrace is\n: ".concat(new Error("").stack))}}function f(e,t){return o[e]=t,t}function g(e){try{return function(e){var t=l(s.join(e,"nls.metadata.json")),r=Object.create(null);for(var o in t){var n=t[o];r[o]=n.messages}return r}(e)}catch(e){return void console.log("Generating default bundle from meta data failed.",e)}}function h(e,t){var r;if(!0===n.languagePackSupport&&void 0!==n.cacheRoot&&void 0!==n.languagePackId&&void 0!==n.translationsConfigFile&&void 0!==n.translationsConfig)try{r=function(e,t){var r,o,i,u=s.join(n.cacheRoot,"".concat(e.id,"-").concat(e.hash,".json")),d=!1,f=!1;try{return r=JSON.parse(a.readFileSync(u,{encoding:"utf8",flag:"r"})),o=u,i=new Date,a.utimes(o,i,i,(function(){})),r}catch(e){if("ENOENT"===e.code)f=!0;else{if(!(e instanceof SyntaxError))throw e;console.log("Syntax error parsing message bundle: ".concat(e.message,".")),a.unlink(u,(function(e){e&&console.error("Deleting corrupted bundle ".concat(u," failed."))})),d=!0}}if(!(r=function(e,t){var r=n.translationsConfig[e.id];if(r){var o=l(r).contents,a=l(s.join(t,"nls.metadata.json")),i=Object.create(null);for(var u in a){var d=a[u],f=o["".concat(e.outDir,"/").concat(u)];if(f){for(var g=[],h=0;h<d.keys.length;h++){var p=d.keys[h],v=f[(0,c.isString)(p)?p:p.key];void 0===v&&(v=d.messages[h]),g.push(v)}i[u]=g}else i[u]=d.messages}return i}}(e,t))||d)return r;if(f)try{a.writeFileSync(u,JSON.stringify(r),{encoding:"utf8",flag:"wx"})}catch(e){if("EEXIST"===e.code)return r;throw e}return r}(e,t)}catch(e){console.log("Load or create bundle failed ",e)}if(!r){if(n.languagePackSupport)return g(t);var o=function(e){for(var t=n.language;t;){var r=s.join(e,"nls.bundle.".concat(t,".json"));if(a.existsSync(r))return r;var o=t.lastIndexOf("-");t=o>0?t.substring(0,o):void 0}if(void 0===t&&(r=s.join(e,"nls.bundle.json"),a.existsSync(r)))return r}(t);if(o)try{return l(o)}catch(e){console.log("Loading in the box message bundle failed.",e)}r=g(t)}return r}function p(e){if(!e)return c.localize;var t=s.extname(e);if(t&&(e=e.substr(0,e.length-t.length)),n.messageFormat===c.MessageFormat.both||n.messageFormat===c.MessageFormat.bundle){var r=function(e){for(var t,r=s.dirname(e);t=s.join(r,"nls.metadata.header.json"),!a.existsSync(t);){var o=s.dirname(r);if(o===r){t=void 0;break}r=o}return t}(e);if(r){var i=s.dirname(r),u=o[i];if(void 0===u)try{var g=JSON.parse(a.readFileSync(r,"utf8"));try{var p=h(g,i);u=f(i,p?{header:g,nlsBundle:p}:null)}catch(e){console.error("Failed to load nls bundle",e),u=f(i,null)}}catch(e){console.error("Failed to read header file",e),u=f(i,null)}if(u){var v=e.substr(i.length+1).replace(/\\/g,"/"),m=u.nlsBundle[v];return void 0===m?(console.error("Messages for file ".concat(e," not found. See console for details.")),function(){return"Messages not found."}):d(m)}}}if(n.messageFormat===c.MessageFormat.both||n.messageFormat===c.MessageFormat.file)try{var k=l(function(e){var t;if(n.cacheLanguageResolution&&t)t=t;else{if(c.isPseudo||!n.language)t=".nls.json";else for(var r=n.language;r;){var o=".nls."+r+".json";if(a.existsSync(e+o)){t=o;break}var s=r.lastIndexOf("-");s>0?r=r.substring(0,s):(t=".nls.json",r=null)}n.cacheLanguageResolution&&(t=t)}return e+t}(e));return Array.isArray(k)?d(k):(0,c.isDefined)(k.messages)&&(0,c.isDefined)(k.keys)?d(k.messages):(console.error("String bundle '".concat(e,"' uses an unsupported format.")),function(){return"File bundle has unsupported format. See console for details"})}catch(e){"ENOENT"!==e.code&&console.error("Failed to load single file bundle",e)}return console.error("Failed to load message bundle for file ".concat(e)),function(){return"Failed to load message bundle. See console for details."}}function v(e){return e&&((0,c.isString)(e.locale)&&(n.locale=e.locale.toLowerCase(),n.language=n.locale,o=Object.create(null)),void 0!==e.messageFormat&&(n.messageFormat=e.messageFormat),e.bundleFormat===c.BundleFormat.standalone&&!0===n.languagePackSupport&&(n.languagePackSupport=!1)),(0,c.setPseudo)("pseudo"===n.locale),p}Object.defineProperty(t,"MessageFormat",{enumerable:!0,get:function(){return u.MessageFormat}}),Object.defineProperty(t,"BundleFormat",{enumerable:!0,get:function(){return u.BundleFormat}}),function(){if(n={locale:void 0,language:void 0,languagePackSupport:!1,cacheLanguageResolution:!0,messageFormat:c.MessageFormat.bundle},(0,c.isString)(process.env.VSCODE_NLS_CONFIG))try{var e=JSON.parse(process.env.VSCODE_NLS_CONFIG),t=void 0;if(e.availableLanguages){var r=e.availableLanguages["*"];(0,c.isString)(r)&&(t=r)}if((0,c.isString)(e.locale)&&(n.locale=e.locale.toLowerCase()),void 0===t?n.language=n.locale:"en"!==t&&(n.language=t),function(e){return!0===e||!1===e}(e._languagePackSupport)&&(n.languagePackSupport=e._languagePackSupport),(0,c.isString)(e._cacheRoot)&&(n.cacheRoot=e._cacheRoot),(0,c.isString)(e._languagePackId)&&(n.languagePackId=e._languagePackId),(0,c.isString)(e._translationsConfigFile)){n.translationsConfigFile=e._translationsConfigFile;try{n.translationsConfig=l(n.translationsConfigFile)}catch(t){if(e._corruptedFile){var i=s.dirname(e._corruptedFile);a.exists(i,(function(t){t&&a.writeFile(e._corruptedFile,"corrupted","utf8",(function(e){console.error(e)}))}))}}}}catch(e){}(0,c.setPseudo)("pseudo"===n.locale),o=Object.create(null)}(),t.loadMessageBundle=p,t.config=v,i.default.install(Object.freeze({loadMessageBundle:p,config:v}))},129:e=>{e.exports=require("child_process")},747:e=>{e.exports=require("fs")},622:e=>{e.exports=require("path")},549:e=>{e.exports=require("vscode")}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o](s,s.exports,r),s.exports}var o={};(()=>{var e=o;Object.defineProperty(e,"__esModule",{value:!0}),e.deactivate=e.activate=void 0;const t=r(622),n=r(747),s=r(129),a=r(549),i=r(472).loadMessageBundle(r(622).join(__dirname,"main.ts"));function c(e){return new Promise(((t,r)=>{n.exists(e,(e=>{t(e)}))}))}const u=["build","compile","watch"];function l(e){for(const t of u)if(-1!==e.indexOf(t))return!0;return!1}const d=["test"];function f(e){for(const t of d)if(-1!==e.indexOf(t))return!0;return!1}let g,h;function p(){return g||(g=a.window.createOutputChannel("Grunt Auto Detection")),g}function v(){a.window.showWarningMessage(i(0,null),i(1,null)).then((()=>{p().show(!0)}))}async function m(e){let r;const o=process.platform;return r="win32"===o&&await c(t.join(e,"node_modules",".bin","grunt.cmd"))?t.join(".","node_modules",".bin","grunt.cmd"):"linux"!==o&&"darwin"!==o||!await c(t.join(e,"node_modules",".bin","grunt"))?"grunt":t.join(".","node_modules",".bin","grunt"),r}class k{constructor(e,t){this._workspaceFolder=e,this._gruntCommand=t}get workspaceFolder(){return this._workspaceFolder}isEnabled(){return"on"===a.workspace.getConfiguration("grunt",this._workspaceFolder.uri).get("autoDetect")}start(){const e=t.join(this._workspaceFolder.uri.fsPath,"{node_modules,[Gg]runtfile.js}");this.fileWatcher=a.workspace.createFileSystemWatcher(e),this.fileWatcher.onDidChange((()=>this.promise=void 0)),this.fileWatcher.onDidCreate((()=>this.promise=void 0)),this.fileWatcher.onDidDelete((()=>this.promise=void 0))}async getTasks(){return this.isEnabled()?(this.promise||(this.promise=this.computeTasks()),this.promise):[]}async getTask(e){const t=e.definition,r=t.task;if(r){const e={cwd:this.workspaceFolder.uri.fsPath},o="grunt";return-1===r.indexOf(" ")?new a.Task(t,this.workspaceFolder,r,o,new a.ShellExecution(`${await this._gruntCommand}`,[r,...t.args],e)):new a.Task(t,this.workspaceFolder,r,o,new a.ShellExecution(`${await this._gruntCommand}`,[`"${r}"`,...t.args],e))}}async computeTasks(){const e="file"===this._workspaceFolder.uri.scheme?this._workspaceFolder.uri.fsPath:void 0,r=[];if(!e)return r;if(!await c(t.join(e,"gruntfile.js"))&&!await c(t.join(e,"Gruntfile.js")))return r;const o=`${await this._gruntCommand} --help --no-color`;try{const{stdout:t,stderr:r}=await(n=o,u={cwd:e},new Promise(((e,t)=>{s.exec(n,u,((r,o,n)=>{r&&t({error:r,stdout:o,stderr:n}),e({stdout:o,stderr:n})}))})));r&&(p().appendLine(r),v());const i=[];if(t){const e=t.split(/\r{0,1}\n/);let r=!1,o=!1;for(const t of e)if(0!==t.length)if(r||o){if(r&&!o)if(0===t.indexOf("Tasks run in the order specified"))o=!0;else{const e=/^\s*(\S.*\S) \S/g.exec(t);if(e&&2===e.length){const t=e[1],r={type:"grunt",task:t},o="grunt",n={cwd:this.workspaceFolder.uri.fsPath},s=-1===t.indexOf(" ")?new a.Task(r,this.workspaceFolder,t,o,new a.ShellExecution(`${await this._gruntCommand} ${t}`,n)):new a.Task(r,this.workspaceFolder,t,o,new a.ShellExecution(`${await this._gruntCommand} "${t}"`,n));i.push(s);const c=t.toLowerCase();l(c)?s.group=a.TaskGroup.Build:f(c)&&(s.group=a.TaskGroup.Test)}}}else 0===t.indexOf("Available tasks")&&(r=!0)}return i}catch(e){const t=p();return e.stderr&&t.appendLine(e.stderr),e.stdout&&t.appendLine(e.stdout),t.appendLine(i(2,null,this.workspaceFolder.name,e.error?e.error.toString():"unknown")),v(),r}var n,u}dispose(){this.promise=void 0,this.fileWatcher&&this.fileWatcher.dispose()}}class w{constructor(){this.detectors=new Map}start(){const e=a.workspace.workspaceFolders;e&&this.updateWorkspaceFolders(e,[]),a.workspace.onDidChangeWorkspaceFolders((e=>this.updateWorkspaceFolders(e.added,e.removed))),a.workspace.onDidChangeConfiguration(this.updateConfiguration,this)}dispose(){this.taskProvider&&(this.taskProvider.dispose(),this.taskProvider=void 0),this.detectors.clear()}updateWorkspaceFolders(e,t){for(const e of t){const t=this.detectors.get(e.uri.toString());t&&(t.dispose(),this.detectors.delete(e.uri.toString()))}for(const t of e){const e=new k(t,m(t.uri.fsPath));this.detectors.set(t.uri.toString(),e),e.isEnabled()&&e.start()}this.updateProvider()}updateConfiguration(){for(const e of this.detectors.values())e.dispose(),this.detectors.delete(e.workspaceFolder.uri.toString());const e=a.workspace.workspaceFolders;if(e)for(const t of e)if(!this.detectors.has(t.uri.toString())){const e=new k(t,m(t.uri.fsPath));this.detectors.set(t.uri.toString(),e),e.isEnabled()&&e.start()}this.updateProvider()}updateProvider(){if(!this.taskProvider&&this.detectors.size>0){const e=this;this.taskProvider=a.tasks.registerTaskProvider("grunt",{provideTasks:()=>e.getTasks(),resolveTask:t=>e.getTask(t)})}else this.taskProvider&&0===this.detectors.size&&(this.taskProvider.dispose(),this.taskProvider=void 0)}getTasks(){return this.computeTasks()}computeTasks(){if(0===this.detectors.size)return Promise.resolve([]);if(1===this.detectors.size)return this.detectors.values().next().value.getTasks();{const e=[];for(const t of this.detectors.values())e.push(t.getTasks().then((e=>e),(()=>[])));return Promise.all(e).then((e=>{const t=[];for(const r of e)r&&r.length>0&&t.push(...r);return t}))}}async getTask(e){if(0!==this.detectors.size){if(1===this.detectors.size)return this.detectors.values().next().value.getTask(e);if(e.scope!==a.TaskScope.Workspace&&e.scope!==a.TaskScope.Global&&e.scope){const t=this.detectors.get(e.scope.uri.toString());if(t)return t.getTask(e)}}}}e.activate=function(e){h=new w,h.start()},e.deactivate=function(){h.dispose()}})();var n=exports;for(var s in o)n[s]=o[s];o.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})(); //# sourceMappingURL=https://ticino.blob.core.windows.net/sourcemaps/a711c3b7ecbf5dae1e178a62074ae55c6a2930fe/extensions/grunt/dist/main.js.map