gatsby-remark-shiki-twoslash
Advanced tools
Comparing version 0.7.1 to 1.0.0
@@ -9,2 +9,5 @@ 'use strict'; | ||
var visit = _interopDefault(require('unist-util-visit')); | ||
var crypto = require('crypto'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
@@ -793,3 +796,3 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
if (node.meta && node.meta.includes("twoslash")) { | ||
var results = shikiTwoslash.runTwoSlash(node.value, node.lang, settings); | ||
var results = cachedTwoslashCall(node.value, node.lang, settings); | ||
node.value = results.code; | ||
@@ -801,2 +804,21 @@ node.lang = results.extension; | ||
}; | ||
/** Keeps a cache of the JSON responses in node_modules/.cache/twoslash */ | ||
var cachedTwoslashCall = function cachedTwoslashCall(code, lang, settings, twoslashDefaults) { | ||
var shasum = crypto.createHash("sha1"); | ||
var codeSha = shasum.update(code).digest("hex"); | ||
var cacheRoot = path.join(__dirname, "..", "..", ".cache", "twoslash"); | ||
var cachePath = path.join(cacheRoot, codeSha + ".json"); | ||
if (fs.existsSync(cachePath)) { | ||
return JSON.parse(fs.readFileSync(cachePath, "utf8")); | ||
} else { | ||
var results = shikiTwoslash.runTwoSlash(code, lang, settings, twoslashDefaults); | ||
if (!fs.existsSync(cacheRoot)) fs.mkdirSync(cacheRoot, { | ||
recursive: true | ||
}); | ||
fs.writeFileSync(cachePath, JSON.stringify(results), "utf8"); | ||
return results; | ||
} | ||
}; | ||
/** | ||
@@ -849,2 +871,3 @@ * The main interface for the remark shiki API, sets up the | ||
exports.cachedTwoslashCall = cachedTwoslashCall; | ||
exports.default = remarkShiki; | ||
@@ -851,0 +874,0 @@ exports.runTwoSlashAcrossDocument = runTwoSlashAcrossDocument; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,r=require("shiki-twoslash"),e=(t=require("unist-util-visit"))&&"object"==typeof t&&"default"in t?t.default:t;function n(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function o(t){return function(){var r=this,e=arguments;return new Promise((function(o,i){var a=t.apply(r,e);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))}}function i(t,r){return t(r={exports:{}},r.exports),r.exports}var a=i((function(t){var r=function(t){var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e,n){var o=Object.create((r&&r.prototype instanceof y?r:y).prototype),i=new O(n||[]);return o._invoke=function(t,r,e){var n=h;return function(o,i){if(n===l)throw new Error("Generator is already running");if(n===p){if("throw"===o)throw i;return T()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=_(a,e);if(c){if(c===v)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===h)throw n=p,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=l;var u=s(t,r,e);if("normal"===u.type){if(n=e.done?p:f,u.arg===v)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=p,e.method="throw",e.arg=u.arg)}}}(t,e,i),o}function s(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h="suspendedStart",f="suspendedYield",l="executing",p="completed",v={};function y(){}function d(){}function g(){}var m={};m[i]=function(){return this};var w=Object.getPrototypeOf,x=w&&w(w(k([])));x&&x!==e&&n.call(x,i)&&(m=x);var L=g.prototype=y.prototype=Object.create(m);function E(t){["next","throw","return"].forEach((function(r){t[r]=function(t){return this._invoke(r,t)}}))}function b(t){var r;this._invoke=function(e,o){function i(){return new Promise((function(r,i){!function r(e,o,i,a){var c=s(t[e],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==typeof h&&n.call(h,"__await")?Promise.resolve(h.__await).then((function(t){r("next",t,i,a)}),(function(t){r("throw",t,i,a)})):Promise.resolve(h).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,a)}))}a(c.arg)}(e,o,r,i)}))}return r=r?r.then(i,i):i()}}function _(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,_(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=s(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function S(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function j(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function k(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}return{next:T}}function T(){return{value:r,done:!0}}return d.prototype=L.constructor=g,g.constructor=d,g[c]=d.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===d||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(L),t},t.awrap=function(t){return{__await:t}},E(b.prototype),b.prototype[a]=function(){return this},t.AsyncIterator=b,t.async=function(r,e,n,o){var i=new b(u(r,e,n,o));return t.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},E(L),L[c]="Generator",L[i]=function(){return this},L.toString=function(){return"[object Generator]"},t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=k,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(j),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return c.type="throw",c.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),v},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),j(e),v}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;j(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),v}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}})),c=function(t,e){return function(n){var o=n.lang;process&&process.env&&process.env.TWOSLASH_DISABLE||u(e||{})(n);var i={json5:"json"};i[o]&&(o=i[o]);var a=r.renderCodeToHTML(n.value,o,n.meta||[],{},t,n.twoslash);n.type="html",n.value=a,n.children=[]}},u=function(t){return function(e){if(e.meta&&e.meta.includes("twoslash")){var n=r.runTwoSlash(e.value,e.lang,t);e.value=n.code,e.lang=n.extension,e.twoslash=n}}};exports.default=function(){var t=o(a.mark((function t(n,o,i){var u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=n.markdownAST,t.next=3,r.createShikiHighlighter(o);case 3:e(u,"code",c(t.sent,i));case 5:case"end":return t.stop()}}),t)})));return function(r,e,n){return t.apply(this,arguments)}}(),exports.runTwoSlashAcrossDocument=function(t,r){return e(t.markdownAST,"code",u(r||{}))},exports.runTwoSlashOnNode=u,exports.visitor=c; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,r=require("shiki-twoslash"),e=(t=require("unist-util-visit"))&&"object"==typeof t&&"default"in t?t.default:t,n=require("crypto"),o=require("fs"),i=require("path");function a(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function c(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function c(t){a(i,n,o,c,u,"next",t)}function u(t){a(i,n,o,c,u,"throw",t)}c(void 0)}))}}function u(t,r){return t(r={exports:{}},r.exports),r.exports}var s=u((function(t){var r=function(t){var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e,n){var o=Object.create((r&&r.prototype instanceof y?r:y).prototype),i=new O(n||[]);return o._invoke=function(t,r,e){var n=h;return function(o,i){if(n===l)throw new Error("Generator is already running");if(n===p){if("throw"===o)throw i;return T()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=_(a,e);if(c){if(c===v)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===h)throw n=p,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=l;var u=s(t,r,e);if("normal"===u.type){if(n=e.done?p:f,u.arg===v)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=p,e.method="throw",e.arg=u.arg)}}}(t,e,i),o}function s(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h="suspendedStart",f="suspendedYield",l="executing",p="completed",v={};function y(){}function d(){}function g(){}var m={};m[i]=function(){return this};var w=Object.getPrototypeOf,x=w&&w(w(k([])));x&&x!==e&&n.call(x,i)&&(m=x);var L=g.prototype=y.prototype=Object.create(m);function E(t){["next","throw","return"].forEach((function(r){t[r]=function(t){return this._invoke(r,t)}}))}function S(t){var r;this._invoke=function(e,o){function i(){return new Promise((function(r,i){!function r(e,o,i,a){var c=s(t[e],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==typeof h&&n.call(h,"__await")?Promise.resolve(h.__await).then((function(t){r("next",t,i,a)}),(function(t){r("throw",t,i,a)})):Promise.resolve(h).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,a)}))}a(c.arg)}(e,o,r,i)}))}return r=r?r.then(i,i):i()}}function _(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,_(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=s(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function b(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function j(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function k(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}return{next:T}}function T(){return{value:r,done:!0}}return d.prototype=L.constructor=g,g.constructor=d,g[c]=d.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===d||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(L),t},t.awrap=function(t){return{__await:t}},E(S.prototype),S.prototype[a]=function(){return this},t.AsyncIterator=S,t.async=function(r,e,n,o){var i=new S(u(r,e,n,o));return t.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},E(L),L[c]="Generator",L[i]=function(){return this},L.toString=function(){return"[object Generator]"},t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=k,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(j),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return c.type="throw",c.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),v},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),j(e),v}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;j(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),v}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}})),h=function(t,e){return function(n){var o=n.lang;process&&process.env&&process.env.TWOSLASH_DISABLE||f(e||{})(n);var i={json5:"json"};i[o]&&(o=i[o]);var a=r.renderCodeToHTML(n.value,o,n.meta||[],{},t,n.twoslash);n.type="html",n.value=a,n.children=[]}},f=function(t){return function(r){if(r.meta&&r.meta.includes("twoslash")){var e=l(r.value,r.lang,t);r.value=e.code,r.lang=e.extension,r.twoslash=e}}},l=function(t,e,a,c){var u=n.createHash("sha1").update(t).digest("hex"),s=i.join(__dirname,"..","..",".cache","twoslash"),h=i.join(s,u+".json");if(o.existsSync(h))return JSON.parse(o.readFileSync(h,"utf8"));var f=r.runTwoSlash(t,e,a,c);return o.existsSync(s)||o.mkdirSync(s,{recursive:!0}),o.writeFileSync(h,JSON.stringify(f),"utf8"),f},p=function(){var t=c(s.mark((function t(n,o,i){var a;return s.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=n.markdownAST,t.next=3,r.createShikiHighlighter(o);case 3:e(a,"code",h(t.sent,i));case 5:case"end":return t.stop()}}),t)})));return function(r,e,n){return t.apply(this,arguments)}}();exports.cachedTwoslashCall=l,exports.default=p,exports.runTwoSlashAcrossDocument=function(t,r){return e(t.markdownAST,"code",f(r||{}))},exports.runTwoSlashOnNode=f,exports.visitor=h; | ||
//# sourceMappingURL=gatsby-remark-shiki-twoslash.cjs.production.min.js.map |
@@ -1,3 +0,6 @@ | ||
import { runTwoSlash, renderCodeToHTML, createShikiHighlighter } from 'shiki-twoslash'; | ||
import { renderCodeToHTML, runTwoSlash, createShikiHighlighter } from 'shiki-twoslash'; | ||
import visit from 'unist-util-visit'; | ||
import { createHash } from 'crypto'; | ||
import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs'; | ||
import { join } from 'path'; | ||
@@ -786,3 +789,3 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
if (node.meta && node.meta.includes("twoslash")) { | ||
var results = runTwoSlash(node.value, node.lang, settings); | ||
var results = cachedTwoslashCall(node.value, node.lang, settings); | ||
node.value = results.code; | ||
@@ -794,2 +797,21 @@ node.lang = results.extension; | ||
}; | ||
/** Keeps a cache of the JSON responses in node_modules/.cache/twoslash */ | ||
var cachedTwoslashCall = function cachedTwoslashCall(code, lang, settings, twoslashDefaults) { | ||
var shasum = createHash("sha1"); | ||
var codeSha = shasum.update(code).digest("hex"); | ||
var cacheRoot = join(__dirname, "..", "..", ".cache", "twoslash"); | ||
var cachePath = join(cacheRoot, codeSha + ".json"); | ||
if (existsSync(cachePath)) { | ||
return JSON.parse(readFileSync(cachePath, "utf8")); | ||
} else { | ||
var results = runTwoSlash(code, lang, settings, twoslashDefaults); | ||
if (!existsSync(cacheRoot)) mkdirSync(cacheRoot, { | ||
recursive: true | ||
}); | ||
writeFileSync(cachePath, JSON.stringify(results), "utf8"); | ||
return results; | ||
} | ||
}; | ||
/** | ||
@@ -843,3 +865,3 @@ * The main interface for the remark shiki API, sets up the | ||
export default remarkShiki; | ||
export { runTwoSlashAcrossDocument, runTwoSlashOnNode, visitor }; | ||
export { cachedTwoslashCall, runTwoSlashAcrossDocument, runTwoSlashOnNode, visitor }; | ||
//# sourceMappingURL=gatsby-remark-shiki-twoslash.esm.js.map |
@@ -1,7 +0,7 @@ | ||
import type { Highlighter } from "shiki/dist/highlighter"; | ||
import type { TLang } from "shiki-languages"; | ||
import { ShikiTwoslashSettings } from "shiki-twoslash"; | ||
import type { Highlighter, Lang, HighlighterOptions } from "shiki"; | ||
import { Node } from "unist"; | ||
import { TwoSlashOptions } from "@typescript/twoslash"; | ||
declare type RichNode = Node & { | ||
lang: TLang; | ||
lang: Lang; | ||
type: string; | ||
@@ -23,2 +23,4 @@ children: Node[]; | ||
export declare const runTwoSlashOnNode: (settings: ShikiTwoslashSettings) => (node: RichNode) => void; | ||
/** Keeps a cache of the JSON responses in node_modules/.cache/twoslash */ | ||
export declare const cachedTwoslashCall: (code: string, lang: string, settings?: ShikiTwoslashSettings | undefined, twoslashDefaults?: TwoSlashOptions | undefined) => any; | ||
/** | ||
@@ -29,5 +31,5 @@ * The main interface for the remark shiki API, sets up the | ||
* */ | ||
declare const remarkShiki: ({ markdownAST }: any, shikiSettings: import("shiki/dist/highlighter").HighlighterOptions, settings: ShikiTwoslashSettings) => Promise<void>; | ||
declare const remarkShiki: ({ markdownAST }: any, shikiSettings: HighlighterOptions, settings: ShikiTwoslashSettings) => Promise<void>; | ||
/** Sends the twoslash visitor over the existing MD AST and replaces the code samples inline, does not do highlighting */ | ||
export declare const runTwoSlashAcrossDocument: ({ markdownAST }: any, settings?: ShikiTwoslashSettings | undefined) => any; | ||
export default remarkShiki; |
{ | ||
"name": "gatsby-remark-shiki-twoslash", | ||
"version": "0.7.1", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
@@ -33,5 +33,4 @@ "homepage": "https://github.com/microsoft/TypeScript-Website", | ||
"@typescript/vfs": "1.3.2", | ||
"shiki": "^0.1.6", | ||
"shiki-languages": "^0.1.6", | ||
"shiki-twoslash": "0.8.2", | ||
"shiki": "^0.9.1", | ||
"shiki-twoslash": "1.0.0", | ||
"typescript": "*", | ||
@@ -47,3 +46,6 @@ "unist-util-visit": "^2.0.0" | ||
"unified": "^8.4.2" | ||
}, | ||
"jest": { | ||
"testEnvironment": "node" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
219552
6
1509
1
3
10
+ Addedjsonc-parser@3.3.1(transitive)
+ Addedshiki@0.9.15(transitive)
+ Addedshiki-twoslash@1.0.0(transitive)
+ Addedvscode-oniguruma@1.7.0(transitive)
+ Addedvscode-textmate@5.2.0(transitive)
- Removedshiki-languages@^0.1.6
- Removedjson5@2.2.3(transitive)
- Removedlru-cache@5.1.1(transitive)
- Removedonigasm@2.2.5(transitive)
- Removedshiki@0.1.7(transitive)
- Removedshiki-languages@0.1.6(transitive)
- Removedshiki-themes@0.1.7(transitive)
- Removedshiki-twoslash@0.8.2(transitive)
- Removedyallist@3.1.1(transitive)
Updatedshiki@^0.9.1
Updatedshiki-twoslash@1.0.0