@difizen/libro-jupyter 0.0.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/es/add-between-cell/add-between-cell-command-contribution.d.ts +14 -0
- package/es/add-between-cell/add-between-cell-command-contribution.d.ts.map +1 -0
- package/es/add-between-cell/add-between-cell-command-contribution.js +97 -0
- package/es/add-between-cell/add-between-cell.d.ts +5 -0
- package/es/add-between-cell/add-between-cell.d.ts.map +1 -0
- package/es/add-between-cell/add-between-cell.js +243 -0
- package/es/add-between-cell/index.d.ts +3 -0
- package/es/add-between-cell/index.d.ts.map +1 -0
- package/es/add-between-cell/index.js +2 -0
- package/es/add-between-cell/index.less +103 -0
- package/es/add-between-cell/module.d.ts +3 -0
- package/es/add-between-cell/module.d.ts.map +1 -0
- package/es/add-between-cell/module.js +8 -0
- package/es/cell/index.d.ts +3 -0
- package/es/cell/index.d.ts.map +1 -0
- package/es/cell/index.js +2 -0
- package/es/cell/jupyter-code-cell-model.d.ts +12 -0
- package/es/cell/jupyter-code-cell-model.d.ts.map +1 -0
- package/es/cell/jupyter-code-cell-model.js +56 -0
- package/es/cell/jupyter-code-cell-view.d.ts +18 -0
- package/es/cell/jupyter-code-cell-view.d.ts.map +1 -0
- package/es/cell/jupyter-code-cell-view.js +280 -0
- package/es/command/command-contribution.d.ts +10 -0
- package/es/command/command-contribution.d.ts.map +1 -0
- package/es/command/command-contribution.js +161 -0
- package/es/command/index.d.ts +3 -0
- package/es/command/index.d.ts.map +1 -0
- package/es/command/index.js +2 -0
- package/es/command/keybinding-contribution.d.ts +8 -0
- package/es/command/keybinding-contribution.d.ts.map +1 -0
- package/es/command/keybinding-contribution.js +37 -0
- package/es/components/cell-execution-tip.d.ts +6 -0
- package/es/components/cell-execution-tip.d.ts.map +1 -0
- package/es/components/cell-execution-tip.js +69 -0
- package/es/components/cell-input-bottom-blank.d.ts +5 -0
- package/es/components/cell-input-bottom-blank.d.ts.map +1 -0
- package/es/components/cell-input-bottom-blank.js +21 -0
- package/es/components/icons.d.ts +5 -0
- package/es/components/icons.d.ts.map +1 -0
- package/es/components/icons.js +154 -0
- package/es/components/index.d.ts +4 -0
- package/es/components/index.d.ts.map +1 -0
- package/es/components/index.js +3 -0
- package/es/components/index.less +82 -0
- package/es/config/config-contribution.d.ts +10 -0
- package/es/config/config-contribution.d.ts.map +1 -0
- package/es/config/config-contribution.js +50 -0
- package/es/config/config.d.ts +3 -0
- package/es/config/config.d.ts.map +1 -0
- package/es/config/config.js +11 -0
- package/es/config/index.d.ts +2 -0
- package/es/config/index.d.ts.map +1 -0
- package/es/config/index.js +1 -0
- package/es/configuration/index.d.ts +3 -0
- package/es/configuration/index.d.ts.map +1 -0
- package/es/configuration/index.js +2 -0
- package/es/configuration/libro-configuration-contribution.d.ts +5 -0
- package/es/configuration/libro-configuration-contribution.d.ts.map +1 -0
- package/es/configuration/libro-configuration-contribution.js +24 -0
- package/es/configuration/libro-configuration.d.ts +3 -0
- package/es/configuration/libro-configuration.d.ts.map +1 -0
- package/es/configuration/libro-configuration.js +12 -0
- package/es/contents/content-contribution.d.ts +7 -0
- package/es/contents/content-contribution.d.ts.map +1 -0
- package/es/contents/content-contribution.js +63 -0
- package/es/contents/index.d.ts +2 -0
- package/es/contents/index.d.ts.map +1 -0
- package/es/contents/index.js +1 -0
- package/es/file/file-name-alias.d.ts +7 -0
- package/es/file/file-name-alias.d.ts.map +1 -0
- package/es/file/file-name-alias.js +26 -0
- package/es/file/file-protocol.d.ts +8 -0
- package/es/file/file-protocol.d.ts.map +1 -0
- package/es/file/file-protocol.js +7 -0
- package/es/file/file-service.d.ts +31 -0
- package/es/file/file-service.d.ts.map +1 -0
- package/es/file/file-service.js +329 -0
- package/es/file/file-tree-label-provider.d.ts +13 -0
- package/es/file/file-tree-label-provider.d.ts.map +1 -0
- package/es/file/file-tree-label-provider.js +62 -0
- package/es/file/file-view/index.d.ts +14 -0
- package/es/file/file-view/index.d.ts.map +1 -0
- package/es/file/file-view/index.js +101 -0
- package/es/file/file-view/index.less +5 -0
- package/es/file/index.d.ts +7 -0
- package/es/file/index.d.ts.map +1 -0
- package/es/file/index.js +6 -0
- package/es/file/module.d.ts +3 -0
- package/es/file/module.d.ts.map +1 -0
- package/es/file/module.js +8 -0
- package/es/file/navigatable-view.d.ts +24 -0
- package/es/file/navigatable-view.d.ts.map +1 -0
- package/es/file/navigatable-view.js +151 -0
- package/es/file/open-handler-contribution.d.ts +11 -0
- package/es/file/open-handler-contribution.d.ts.map +1 -0
- package/es/file/open-handler-contribution.js +102 -0
- package/es/index.d.ts +32 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +31 -0
- package/es/keybind-instructions/index.d.ts +6 -0
- package/es/keybind-instructions/index.d.ts.map +1 -0
- package/es/keybind-instructions/index.js +5 -0
- package/es/keybind-instructions/index.less +177 -0
- package/es/keybind-instructions/keybind-instructions-contribution.d.ts +11 -0
- package/es/keybind-instructions/keybind-instructions-contribution.d.ts.map +1 -0
- package/es/keybind-instructions/keybind-instructions-contribution.js +84 -0
- package/es/keybind-instructions/keybind-instructions-icon.d.ts +3 -0
- package/es/keybind-instructions/keybind-instructions-icon.d.ts.map +1 -0
- package/es/keybind-instructions/keybind-instructions-icon.js +23 -0
- package/es/keybind-instructions/keybind-instructions-items.d.ts +14 -0
- package/es/keybind-instructions/keybind-instructions-items.d.ts.map +1 -0
- package/es/keybind-instructions/keybind-instructions-items.js +589 -0
- package/es/keybind-instructions/keybind-instructions-view.d.ts +16 -0
- package/es/keybind-instructions/keybind-instructions-view.d.ts.map +1 -0
- package/es/keybind-instructions/keybind-instructions-view.js +224 -0
- package/es/keybind-instructions/module.d.ts +3 -0
- package/es/keybind-instructions/module.d.ts.map +1 -0
- package/es/keybind-instructions/module.js +5 -0
- package/es/libro-jupyter-file-service.d.ts +106 -0
- package/es/libro-jupyter-file-service.d.ts.map +1 -0
- package/es/libro-jupyter-file-service.js +127 -0
- package/es/libro-jupyter-model.d.ts +49 -0
- package/es/libro-jupyter-model.d.ts.map +1 -0
- package/es/libro-jupyter-model.js +505 -0
- package/es/libro-jupyter-protocol.d.ts +38 -0
- package/es/libro-jupyter-protocol.d.ts.map +1 -0
- package/es/libro-jupyter-protocol.js +9 -0
- package/es/libro-jupyter-server-launch-manager.d.ts +11 -0
- package/es/libro-jupyter-server-launch-manager.d.ts.map +1 -0
- package/es/libro-jupyter-server-launch-manager.js +59 -0
- package/es/libro-jupyter-view.d.ts +10 -0
- package/es/libro-jupyter-view.d.ts.map +1 -0
- package/es/libro-jupyter-view.js +42 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +48 -0
- package/es/output/index.d.ts +2 -0
- package/es/output/index.d.ts.map +1 -0
- package/es/output/index.js +1 -0
- package/es/output/libro-jupyter-outputarea.d.ts +8 -0
- package/es/output/libro-jupyter-outputarea.d.ts.map +1 -0
- package/es/output/libro-jupyter-outputarea.js +77 -0
- package/es/rendermime/assets/plotly.svg +31 -0
- package/es/rendermime/index.d.ts +5 -0
- package/es/rendermime/index.d.ts.map +1 -0
- package/es/rendermime/index.js +4 -0
- package/es/rendermime/index.less +22 -0
- package/es/rendermime/module.d.ts +3 -0
- package/es/rendermime/module.d.ts.map +1 -0
- package/es/rendermime/module.js +3 -0
- package/es/rendermime/plotly-render.d.ts +7 -0
- package/es/rendermime/plotly-render.d.ts.map +1 -0
- package/es/rendermime/plotly-render.js +30 -0
- package/es/rendermime/plotly-renderers.d.ts +58 -0
- package/es/rendermime/plotly-renderers.d.ts.map +1 -0
- package/es/rendermime/plotly-renderers.js +211 -0
- package/es/rendermime/plotly-rendermime-contribution.d.ts +12 -0
- package/es/rendermime/plotly-rendermime-contribution.d.ts.map +1 -0
- package/es/rendermime/plotly-rendermime-contribution.js +22 -0
- package/es/theme/color-registry.d.ts +6 -0
- package/es/theme/color-registry.d.ts.map +1 -0
- package/es/theme/color-registry.js +393 -0
- package/es/theme/index.d.ts +2 -0
- package/es/theme/index.d.ts.map +1 -0
- package/es/theme/index.js +1 -0
- package/es/toolbar/index.d.ts +6 -0
- package/es/toolbar/index.d.ts.map +1 -0
- package/es/toolbar/index.js +5 -0
- package/es/toolbar/index.less +194 -0
- package/es/toolbar/kernel-selector-dropdown.d.ts +13 -0
- package/es/toolbar/kernel-selector-dropdown.d.ts.map +1 -0
- package/es/toolbar/kernel-selector-dropdown.js +165 -0
- package/es/toolbar/kernel-status-and-selector.d.ts +18 -0
- package/es/toolbar/kernel-status-and-selector.d.ts.map +1 -0
- package/es/toolbar/kernel-status-and-selector.js +164 -0
- package/es/toolbar/run-selector.d.ts +3 -0
- package/es/toolbar/run-selector.d.ts.map +1 -0
- package/es/toolbar/run-selector.js +98 -0
- package/es/toolbar/save-file-error-contribution.d.ts +5 -0
- package/es/toolbar/save-file-error-contribution.d.ts.map +1 -0
- package/es/toolbar/save-file-error-contribution.js +23 -0
- package/es/toolbar/save-file-error.d.ts +5 -0
- package/es/toolbar/save-file-error.d.ts.map +1 -0
- package/es/toolbar/save-file-error.js +27 -0
- package/es/toolbar/side-toolbar-run-selector.d.ts +3 -0
- package/es/toolbar/side-toolbar-run-selector.d.ts.map +1 -0
- package/es/toolbar/side-toolbar-run-selector.js +67 -0
- package/es/toolbar/toolbar-contribution.d.ts +9 -0
- package/es/toolbar/toolbar-contribution.d.ts.map +1 -0
- package/es/toolbar/toolbar-contribution.js +67 -0
- package/es/typings/index.d.ts +31 -0
- package/es/utils/index.d.ts +11 -0
- package/es/utils/index.d.ts.map +1 -0
- package/es/utils/index.js +47 -0
- package/package.json +75 -0
- package/src/add-between-cell/add-between-cell-command-contribution.ts +63 -0
- package/src/add-between-cell/add-between-cell.tsx +201 -0
- package/src/add-between-cell/index.less +103 -0
- package/src/add-between-cell/index.ts +2 -0
- package/src/add-between-cell/module.ts +13 -0
- package/src/cell/index.ts +2 -0
- package/src/cell/jupyter-code-cell-model.ts +36 -0
- package/src/cell/jupyter-code-cell-view.tsx +221 -0
- package/src/command/command-contribution.ts +163 -0
- package/src/command/index.ts +2 -0
- package/src/command/keybinding-contribution.ts +25 -0
- package/src/components/cell-execution-tip.tsx +107 -0
- package/src/components/cell-input-bottom-blank.tsx +24 -0
- package/src/components/icons.tsx +117 -0
- package/src/components/index.less +82 -0
- package/src/components/index.ts +3 -0
- package/src/config/config-contribution.ts +21 -0
- package/src/config/config.ts +14 -0
- package/src/config/index.ts +1 -0
- package/src/configuration/index.ts +2 -0
- package/src/configuration/libro-configuration-contribution.ts +11 -0
- package/src/configuration/libro-configuration.ts +14 -0
- package/src/contents/content-contribution.ts +32 -0
- package/src/contents/index.ts +1 -0
- package/src/file/file-name-alias.ts +15 -0
- package/src/file/file-protocol.ts +7 -0
- package/src/file/file-service.ts +179 -0
- package/src/file/file-tree-label-provider.ts +42 -0
- package/src/file/file-view/index.less +5 -0
- package/src/file/file-view/index.tsx +90 -0
- package/src/file/index.ts +6 -0
- package/src/file/module.ts +19 -0
- package/src/file/navigatable-view.tsx +93 -0
- package/src/file/open-handler-contribution.ts +44 -0
- package/src/index.ts +32 -0
- package/src/keybind-instructions/index.less +177 -0
- package/src/keybind-instructions/index.ts +5 -0
- package/src/keybind-instructions/keybind-instructions-contribution.ts +47 -0
- package/src/keybind-instructions/keybind-instructions-icon.tsx +28 -0
- package/src/keybind-instructions/keybind-instructions-items.tsx +597 -0
- package/src/keybind-instructions/keybind-instructions-view.tsx +239 -0
- package/src/keybind-instructions/module.ts +11 -0
- package/src/libro-jupyter-file-service.ts +158 -0
- package/src/libro-jupyter-model.ts +289 -0
- package/src/libro-jupyter-protocol.ts +59 -0
- package/src/libro-jupyter-server-launch-manager.ts +36 -0
- package/src/libro-jupyter-view.tsx +24 -0
- package/src/module.ts +105 -0
- package/src/output/index.ts +1 -0
- package/src/output/libro-jupyter-outputarea.tsx +71 -0
- package/src/rendermime/assets/plotly.svg +31 -0
- package/src/rendermime/index.less +13 -0
- package/src/rendermime/index.ts +4 -0
- package/src/rendermime/module.ts +7 -0
- package/src/rendermime/plotly-render.tsx +35 -0
- package/src/rendermime/plotly-renderers.ts +191 -0
- package/src/rendermime/plotly-rendermime-contribution.ts +15 -0
- package/src/theme/color-registry.ts +301 -0
- package/src/theme/index.ts +1 -0
- package/src/toolbar/index.less +194 -0
- package/src/toolbar/index.ts +5 -0
- package/src/toolbar/kernel-selector-dropdown.tsx +204 -0
- package/src/toolbar/kernel-status-and-selector.tsx +195 -0
- package/src/toolbar/run-selector.tsx +110 -0
- package/src/toolbar/save-file-error-contribution.ts +10 -0
- package/src/toolbar/save-file-error.tsx +35 -0
- package/src/toolbar/side-toolbar-run-selector.tsx +77 -0
- package/src/toolbar/toolbar-contribution.tsx +62 -0
- package/src/typings/index.d.ts +31 -0
- package/src/utils/index.ts +65 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _dec, _class;
|
|
3
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
4
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
5
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
7
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
8
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
|
+
import { ContentContribution } from '@difizen/libro-core';
|
|
12
|
+
import { URI } from '@difizen/mana-app';
|
|
13
|
+
import { singleton } from '@difizen/mana-app';
|
|
14
|
+
export var LibroJupyterContentContribution = (_dec = singleton({
|
|
15
|
+
contrib: ContentContribution
|
|
16
|
+
}), _dec(_class = /*#__PURE__*/function () {
|
|
17
|
+
function LibroJupyterContentContribution() {
|
|
18
|
+
_classCallCheck(this, LibroJupyterContentContribution);
|
|
19
|
+
this.canHandle = function () {
|
|
20
|
+
return 2;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
_createClass(LibroJupyterContentContribution, [{
|
|
24
|
+
key: "loadContent",
|
|
25
|
+
value: function () {
|
|
26
|
+
var _loadContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options, model) {
|
|
27
|
+
var jupyterModel, fireUri, filePath, currentFileContents;
|
|
28
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
29
|
+
while (1) switch (_context.prev = _context.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
jupyterModel = model;
|
|
32
|
+
fireUri = new URI(options['resource']);
|
|
33
|
+
filePath = fireUri.path.toString();
|
|
34
|
+
_context.next = 5;
|
|
35
|
+
return jupyterModel.fileService.read(filePath);
|
|
36
|
+
case 5:
|
|
37
|
+
currentFileContents = _context.sent;
|
|
38
|
+
if (!currentFileContents) {
|
|
39
|
+
_context.next = 13;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
currentFileContents.content.nbformat_minor = 5;
|
|
43
|
+
jupyterModel.currentFileContents = currentFileContents;
|
|
44
|
+
jupyterModel.filePath = currentFileContents.path;
|
|
45
|
+
jupyterModel.lastModified = jupyterModel.currentFileContents.last_modified;
|
|
46
|
+
if (!jupyterModel.quickEditMode && !jupyterModel.readOnly) {
|
|
47
|
+
jupyterModel.startKernelConnection();
|
|
48
|
+
}
|
|
49
|
+
return _context.abrupt("return", jupyterModel.currentFileContents.content);
|
|
50
|
+
case 13:
|
|
51
|
+
case "end":
|
|
52
|
+
return _context.stop();
|
|
53
|
+
}
|
|
54
|
+
}, _callee);
|
|
55
|
+
}));
|
|
56
|
+
function loadContent(_x, _x2) {
|
|
57
|
+
return _loadContent.apply(this, arguments);
|
|
58
|
+
}
|
|
59
|
+
return loadContent;
|
|
60
|
+
}()
|
|
61
|
+
}]);
|
|
62
|
+
return LibroJupyterContentContribution;
|
|
63
|
+
}()) || _class);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contents/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./content-contribution.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-name-alias.d.ts","sourceRoot":"","sources":["../../src/file/file-name-alias.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAG7C,qBACa,aAAa;IACxB,SAAS,CAAC,OAAO,sBAA6B;IAE9C,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM;IAI1B,GAAG,CAAC,GAAG,EAAE,GAAG;CAGb"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _dec, _class;
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
import { singleton } from '@difizen/mana-app';
|
|
9
|
+
export var FileNameAlias = (_dec = singleton(), _dec(_class = /*#__PURE__*/function () {
|
|
10
|
+
function FileNameAlias() {
|
|
11
|
+
_classCallCheck(this, FileNameAlias);
|
|
12
|
+
this.aliases = new Map();
|
|
13
|
+
}
|
|
14
|
+
_createClass(FileNameAlias, [{
|
|
15
|
+
key: "set",
|
|
16
|
+
value: function set(uri, name) {
|
|
17
|
+
this.aliases.set(uri.path.toString(), name);
|
|
18
|
+
}
|
|
19
|
+
}, {
|
|
20
|
+
key: "get",
|
|
21
|
+
value: function get(uri) {
|
|
22
|
+
return this.aliases.get(uri.path.toString());
|
|
23
|
+
}
|
|
24
|
+
}]);
|
|
25
|
+
return FileNameAlias;
|
|
26
|
+
}()) || _class);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-protocol.d.ts","sourceRoot":"","sources":["../../src/file/file-protocol.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,OAAO,IAAI;IACX,IAAI,IAAI;IACR,SAAS,IAAI;IACb,YAAY,KAAK;CAClB;AACD,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var FileType = /*#__PURE__*/function (FileType) {
|
|
2
|
+
FileType[FileType["Unknown"] = 0] = "Unknown";
|
|
3
|
+
FileType[FileType["File"] = 1] = "File";
|
|
4
|
+
FileType[FileType["Directory"] = 2] = "Directory";
|
|
5
|
+
FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink";
|
|
6
|
+
return FileType;
|
|
7
|
+
}({});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { IContentsModel } from '@difizen/libro-kernel';
|
|
2
|
+
import { ContentsManager } from '@difizen/libro-kernel';
|
|
3
|
+
import type { CopyFileOptions, FileStatWithMetadata, MoveFileOptions, ResolveFileOptions } from '@difizen/mana-app';
|
|
4
|
+
import { FileService, URI } from '@difizen/mana-app';
|
|
5
|
+
import { FileNameAlias } from './file-name-alias.js';
|
|
6
|
+
import type { DirItem } from './file-protocol.js';
|
|
7
|
+
interface FileMeta extends Omit<FileStatWithMetadata, 'children' | 'resource'> {
|
|
8
|
+
resource: string;
|
|
9
|
+
children?: FileMeta[];
|
|
10
|
+
}
|
|
11
|
+
interface DirectoryModel extends IContentsModel {
|
|
12
|
+
type: 'directory';
|
|
13
|
+
content: IContentsModel[];
|
|
14
|
+
}
|
|
15
|
+
export declare class JupyterFileService extends FileService {
|
|
16
|
+
protected readonly contentsManager: ContentsManager;
|
|
17
|
+
protected fileNameAlias: FileNameAlias;
|
|
18
|
+
constructor(fileNameAlias: FileNameAlias);
|
|
19
|
+
write(filePath: string, content: string): Promise<string | undefined>;
|
|
20
|
+
readDir(dirPath: string): Promise<DirItem[]>;
|
|
21
|
+
read(filePath: string): Promise<string | undefined>;
|
|
22
|
+
protected doResolve(filePath: string): Promise<FileMeta | undefined>;
|
|
23
|
+
protected isDirectory(model: IContentsModel): model is DirectoryModel;
|
|
24
|
+
protected toFileMeta(model: IContentsModel): FileMeta;
|
|
25
|
+
copy(source: URI, target: URI, options?: CopyFileOptions): Promise<FileStatWithMetadata>;
|
|
26
|
+
move(source: URI, target: URI, options?: MoveFileOptions): Promise<FileStatWithMetadata>;
|
|
27
|
+
toFileStatMeta(meta: FileMeta): FileStatWithMetadata;
|
|
28
|
+
resolve(resource: URI, options?: ResolveFileOptions | undefined): Promise<FileStatWithMetadata>;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=file-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-service.d.ts","sourceRoot":"","sources":["../../src/file/file-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,GAAG,EAAqB,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,UAAU,QAAS,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,UAAU,CAAC;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,UAAU,cAAe,SAAQ,cAAc;IAC7C,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED,qBACa,kBAAmB,SAAQ,WAAW;IACxB,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAe7E,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;gBAIrC,aAAa,EAAE,aAAa;IAOxB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAYrE,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAe5C,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;cAazC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;IAW1E,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,KAAK,IAAI,cAAc;IAOrE,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,QAAQ;IAuBtC,IAAI,CACjB,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,GAAG,EACX,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,oBAAoB,CAAC;IAGjB,IAAI,CACjB,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,GAAG,EACX,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,oBAAoB,CAAC;IAIhC,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,oBAAoB;IAWrC,OAAO,CACpB,QAAQ,EAAE,GAAG,EACb,OAAO,CAAC,EAAE,kBAAkB,GAAG,SAAS,GACvC,OAAO,CAAC,oBAAoB,CAAC;CAiBjC"}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _dec, _dec2, _class, _class2, _descriptor;
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
7
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
8
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
9
|
+
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
|
10
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
16
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
17
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
18
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
19
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
20
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
23
|
+
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
24
|
+
import { ContentsManager } from '@difizen/libro-kernel';
|
|
25
|
+
import { FileService, URI, inject, singleton } from '@difizen/mana-app';
|
|
26
|
+
import { FileNameAlias } from "./file-name-alias.js";
|
|
27
|
+
export var JupyterFileService = (_dec = singleton({
|
|
28
|
+
token: FileService
|
|
29
|
+
}), _dec2 = inject(ContentsManager), _dec(_class = (_class2 = /*#__PURE__*/function (_FileService) {
|
|
30
|
+
_inherits(JupyterFileService, _FileService);
|
|
31
|
+
var _super = _createSuper(JupyterFileService);
|
|
32
|
+
function JupyterFileService(fileNameAlias) {
|
|
33
|
+
var _this;
|
|
34
|
+
_classCallCheck(this, JupyterFileService);
|
|
35
|
+
_this = _super.call(this);
|
|
36
|
+
_initializerDefineProperty(_this, "contentsManager", _descriptor, _assertThisInitialized(_this));
|
|
37
|
+
// '/read'
|
|
38
|
+
// '/read-dir'
|
|
39
|
+
// '/mkdirp'
|
|
40
|
+
// '/write'
|
|
41
|
+
// '/rename'
|
|
42
|
+
// '/copy'
|
|
43
|
+
// '/delete'
|
|
44
|
+
// '/stat'
|
|
45
|
+
// '/access'
|
|
46
|
+
// '/emptd-dir'
|
|
47
|
+
// '/ensure-file'
|
|
48
|
+
// '/ensure-link'
|
|
49
|
+
// '/ensure-symlink'
|
|
50
|
+
_this.fileNameAlias = void 0;
|
|
51
|
+
_this.fileNameAlias = fileNameAlias;
|
|
52
|
+
return _this;
|
|
53
|
+
}
|
|
54
|
+
JupyterFileService = inject(FileNameAlias)(JupyterFileService, undefined, 0) || JupyterFileService;
|
|
55
|
+
_createClass(JupyterFileService, [{
|
|
56
|
+
key: "write",
|
|
57
|
+
value: function () {
|
|
58
|
+
var _write = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(filePath, content) {
|
|
59
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
60
|
+
while (1) switch (_context.prev = _context.next) {
|
|
61
|
+
case 0:
|
|
62
|
+
_context.prev = 0;
|
|
63
|
+
_context.next = 3;
|
|
64
|
+
return this.contentsManager.save(filePath, {
|
|
65
|
+
content: content
|
|
66
|
+
});
|
|
67
|
+
case 3:
|
|
68
|
+
return _context.abrupt("return", filePath);
|
|
69
|
+
case 6:
|
|
70
|
+
_context.prev = 6;
|
|
71
|
+
_context.t0 = _context["catch"](0);
|
|
72
|
+
case 8:
|
|
73
|
+
return _context.abrupt("return", undefined);
|
|
74
|
+
case 9:
|
|
75
|
+
case "end":
|
|
76
|
+
return _context.stop();
|
|
77
|
+
}
|
|
78
|
+
}, _callee, this, [[0, 6]]);
|
|
79
|
+
}));
|
|
80
|
+
function write(_x, _x2) {
|
|
81
|
+
return _write.apply(this, arguments);
|
|
82
|
+
}
|
|
83
|
+
return write;
|
|
84
|
+
}()
|
|
85
|
+
}, {
|
|
86
|
+
key: "readDir",
|
|
87
|
+
value: function () {
|
|
88
|
+
var _readDir = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(dirPath) {
|
|
89
|
+
var _this2 = this;
|
|
90
|
+
var children, res, content;
|
|
91
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
92
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
93
|
+
case 0:
|
|
94
|
+
children = [];
|
|
95
|
+
_context2.prev = 1;
|
|
96
|
+
_context2.next = 4;
|
|
97
|
+
return this.contentsManager.get(dirPath, {
|
|
98
|
+
type: 'directory'
|
|
99
|
+
});
|
|
100
|
+
case 4:
|
|
101
|
+
res = _context2.sent;
|
|
102
|
+
if (res && this.isDirectory(res)) {
|
|
103
|
+
content = res.content;
|
|
104
|
+
children = content.map(function (item) {
|
|
105
|
+
return [item.path, _this2.isDirectory(item) ? 2 : 1];
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
_context2.next = 10;
|
|
109
|
+
break;
|
|
110
|
+
case 8:
|
|
111
|
+
_context2.prev = 8;
|
|
112
|
+
_context2.t0 = _context2["catch"](1);
|
|
113
|
+
case 10:
|
|
114
|
+
return _context2.abrupt("return", children);
|
|
115
|
+
case 11:
|
|
116
|
+
case "end":
|
|
117
|
+
return _context2.stop();
|
|
118
|
+
}
|
|
119
|
+
}, _callee2, this, [[1, 8]]);
|
|
120
|
+
}));
|
|
121
|
+
function readDir(_x3) {
|
|
122
|
+
return _readDir.apply(this, arguments);
|
|
123
|
+
}
|
|
124
|
+
return readDir;
|
|
125
|
+
}()
|
|
126
|
+
}, {
|
|
127
|
+
key: "read",
|
|
128
|
+
value: function () {
|
|
129
|
+
var _read = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(filePath) {
|
|
130
|
+
var content, res;
|
|
131
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
132
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
133
|
+
case 0:
|
|
134
|
+
content = undefined;
|
|
135
|
+
_context3.prev = 1;
|
|
136
|
+
_context3.next = 4;
|
|
137
|
+
return this.contentsManager.get(filePath);
|
|
138
|
+
case 4:
|
|
139
|
+
res = _context3.sent;
|
|
140
|
+
if (res && !this.isDirectory(res)) {
|
|
141
|
+
content = res.content;
|
|
142
|
+
}
|
|
143
|
+
_context3.next = 10;
|
|
144
|
+
break;
|
|
145
|
+
case 8:
|
|
146
|
+
_context3.prev = 8;
|
|
147
|
+
_context3.t0 = _context3["catch"](1);
|
|
148
|
+
case 10:
|
|
149
|
+
return _context3.abrupt("return", content);
|
|
150
|
+
case 11:
|
|
151
|
+
case "end":
|
|
152
|
+
return _context3.stop();
|
|
153
|
+
}
|
|
154
|
+
}, _callee3, this, [[1, 8]]);
|
|
155
|
+
}));
|
|
156
|
+
function read(_x4) {
|
|
157
|
+
return _read.apply(this, arguments);
|
|
158
|
+
}
|
|
159
|
+
return read;
|
|
160
|
+
}()
|
|
161
|
+
}, {
|
|
162
|
+
key: "doResolve",
|
|
163
|
+
value: function () {
|
|
164
|
+
var _doResolve = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(filePath) {
|
|
165
|
+
var stat, res;
|
|
166
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
167
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
168
|
+
case 0:
|
|
169
|
+
stat = undefined;
|
|
170
|
+
_context4.prev = 1;
|
|
171
|
+
_context4.next = 4;
|
|
172
|
+
return this.contentsManager.get(filePath);
|
|
173
|
+
case 4:
|
|
174
|
+
res = _context4.sent;
|
|
175
|
+
stat = this.toFileMeta(res);
|
|
176
|
+
_context4.next = 10;
|
|
177
|
+
break;
|
|
178
|
+
case 8:
|
|
179
|
+
_context4.prev = 8;
|
|
180
|
+
_context4.t0 = _context4["catch"](1);
|
|
181
|
+
case 10:
|
|
182
|
+
return _context4.abrupt("return", stat);
|
|
183
|
+
case 11:
|
|
184
|
+
case "end":
|
|
185
|
+
return _context4.stop();
|
|
186
|
+
}
|
|
187
|
+
}, _callee4, this, [[1, 8]]);
|
|
188
|
+
}));
|
|
189
|
+
function doResolve(_x5) {
|
|
190
|
+
return _doResolve.apply(this, arguments);
|
|
191
|
+
}
|
|
192
|
+
return doResolve;
|
|
193
|
+
}()
|
|
194
|
+
}, {
|
|
195
|
+
key: "isDirectory",
|
|
196
|
+
value: function isDirectory(model) {
|
|
197
|
+
if (model.type === 'directory') {
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
}, {
|
|
203
|
+
key: "toFileMeta",
|
|
204
|
+
value: function toFileMeta(model) {
|
|
205
|
+
var _this3 = this;
|
|
206
|
+
var isDirectory = model.type === 'directory';
|
|
207
|
+
var isSymbolicLink = model.type === 'symlink';
|
|
208
|
+
var children = undefined;
|
|
209
|
+
if (isDirectory) {
|
|
210
|
+
var content = model.content;
|
|
211
|
+
children = content === null || content === void 0 ? void 0 : content.map(function (item) {
|
|
212
|
+
return _this3.toFileMeta(item);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
var uri = URI.withScheme(new URI(model.path), 'file');
|
|
216
|
+
return {
|
|
217
|
+
resource: uri.path.toString(),
|
|
218
|
+
etag: uri.path.toString(),
|
|
219
|
+
name: uri.displayName,
|
|
220
|
+
mtime: new Date(model.last_modified).getTime(),
|
|
221
|
+
ctime: new Date(model.created).getTime(),
|
|
222
|
+
size: model.size,
|
|
223
|
+
isDirectory: isDirectory,
|
|
224
|
+
isSymbolicLink: isSymbolicLink,
|
|
225
|
+
isFile: !isSymbolicLink && !isDirectory,
|
|
226
|
+
children: children
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}, {
|
|
230
|
+
key: "copy",
|
|
231
|
+
value: function () {
|
|
232
|
+
var _copy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(source, target, options) {
|
|
233
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
234
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
235
|
+
case 0:
|
|
236
|
+
return _context5.abrupt("return", this.resolve(source));
|
|
237
|
+
case 1:
|
|
238
|
+
case "end":
|
|
239
|
+
return _context5.stop();
|
|
240
|
+
}
|
|
241
|
+
}, _callee5, this);
|
|
242
|
+
}));
|
|
243
|
+
function copy(_x6, _x7, _x8) {
|
|
244
|
+
return _copy.apply(this, arguments);
|
|
245
|
+
}
|
|
246
|
+
return copy;
|
|
247
|
+
}()
|
|
248
|
+
}, {
|
|
249
|
+
key: "move",
|
|
250
|
+
value: function () {
|
|
251
|
+
var _move = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(source, target, options) {
|
|
252
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
253
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
254
|
+
case 0:
|
|
255
|
+
return _context6.abrupt("return", this.resolve(source));
|
|
256
|
+
case 1:
|
|
257
|
+
case "end":
|
|
258
|
+
return _context6.stop();
|
|
259
|
+
}
|
|
260
|
+
}, _callee6, this);
|
|
261
|
+
}));
|
|
262
|
+
function move(_x9, _x10, _x11) {
|
|
263
|
+
return _move.apply(this, arguments);
|
|
264
|
+
}
|
|
265
|
+
return move;
|
|
266
|
+
}()
|
|
267
|
+
}, {
|
|
268
|
+
key: "toFileStatMeta",
|
|
269
|
+
value: function toFileStatMeta(meta) {
|
|
270
|
+
var _this$fileNameAlias$g,
|
|
271
|
+
_meta$children,
|
|
272
|
+
_this4 = this;
|
|
273
|
+
var uri = URI.withScheme(new URI(meta.resource), 'file');
|
|
274
|
+
return _objectSpread(_objectSpread({}, meta), {}, {
|
|
275
|
+
resource: uri,
|
|
276
|
+
name: (_this$fileNameAlias$g = this.fileNameAlias.get(uri)) !== null && _this$fileNameAlias$g !== void 0 ? _this$fileNameAlias$g : meta.name,
|
|
277
|
+
children: (_meta$children = meta.children) === null || _meta$children === void 0 ? void 0 : _meta$children.map(function (child) {
|
|
278
|
+
return _this4.toFileStatMeta(child);
|
|
279
|
+
})
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}, {
|
|
283
|
+
key: "resolve",
|
|
284
|
+
value: function () {
|
|
285
|
+
var _resolve = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(resource, options) {
|
|
286
|
+
var resolved;
|
|
287
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
288
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
289
|
+
case 0:
|
|
290
|
+
_context7.next = 2;
|
|
291
|
+
return this.doResolve(resource.path.toString());
|
|
292
|
+
case 2:
|
|
293
|
+
resolved = _context7.sent;
|
|
294
|
+
if (!resolved) {
|
|
295
|
+
_context7.next = 5;
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
return _context7.abrupt("return", this.toFileStatMeta(resolved));
|
|
299
|
+
case 5:
|
|
300
|
+
return _context7.abrupt("return", {
|
|
301
|
+
resource: resource,
|
|
302
|
+
name: resource.path.base,
|
|
303
|
+
mtime: 0,
|
|
304
|
+
ctime: 0,
|
|
305
|
+
etag: '',
|
|
306
|
+
size: 0,
|
|
307
|
+
isFile: false,
|
|
308
|
+
isDirectory: false,
|
|
309
|
+
isSymbolicLink: false
|
|
310
|
+
});
|
|
311
|
+
case 6:
|
|
312
|
+
case "end":
|
|
313
|
+
return _context7.stop();
|
|
314
|
+
}
|
|
315
|
+
}, _callee7, this);
|
|
316
|
+
}));
|
|
317
|
+
function resolve(_x12, _x13) {
|
|
318
|
+
return _resolve.apply(this, arguments);
|
|
319
|
+
}
|
|
320
|
+
return resolve;
|
|
321
|
+
}()
|
|
322
|
+
}]);
|
|
323
|
+
return JupyterFileService;
|
|
324
|
+
}(FileService), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "contentsManager", [_dec2], {
|
|
325
|
+
configurable: true,
|
|
326
|
+
enumerable: true,
|
|
327
|
+
writable: true,
|
|
328
|
+
initializer: null
|
|
329
|
+
})), _class2)) || _class);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DidChangeLabelEvent, FileStat, URI } from '@difizen/mana-app';
|
|
2
|
+
import { FileStatNode, LabelProvider, LabelProviderContribution, TreeLabelProvider, URIIconReference } from '@difizen/mana-app';
|
|
3
|
+
export declare class FileTreeLabelProvider implements LabelProviderContribution {
|
|
4
|
+
protected readonly labelProvider: LabelProvider;
|
|
5
|
+
protected readonly treeLabelProvider: TreeLabelProvider;
|
|
6
|
+
protected asURIIconReference(element: FileStat): URI | URIIconReference;
|
|
7
|
+
canHandle(element: object): number;
|
|
8
|
+
getIcon(node: FileStatNode): string;
|
|
9
|
+
getName(node: FileStatNode): string;
|
|
10
|
+
getDescription(node: FileStatNode): string;
|
|
11
|
+
affects(node: FileStatNode, event: DidChangeLabelEvent): boolean;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=file-tree-label-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-tree-label-provider.d.ts","sourceRoot":"","sources":["../../src/file/file-tree-label-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EACL,YAAY,EACZ,aAAa,EACb,yBAAyB,EACzB,iBAAiB,EACjB,gBAAgB,EAGjB,MAAM,mBAAmB,CAAC;AAE3B,qBACa,qBAAsB,YAAW,yBAAyB;IAC9C,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IAC5C,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAEnF,SAAS,CAAC,kBAAkB,CAAC,OAAO,EAAE,QAAQ,GAAG,GAAG,GAAG,gBAAgB;IAMvE,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIlC,OAAO,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM;IAInC,OAAO,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM;IAInC,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM;IAI1C,OAAO,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,mBAAmB,GAAG,OAAO;CAGjE"}
|