Dependency bump

rollup
Zef Hemel 2022-09-13 08:41:01 +02:00
parent 6342eee303
commit d9338543eb
15 changed files with 114 additions and 7599 deletions

7634
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,6 @@
"typescript": "^4.8.3" "typescript": "^4.8.3"
}, },
"workspaces": [ "workspaces": [
"packages/*", "packages/*"
"mattermost-plugin/webapp"
] ]
} }

View File

@ -16,9 +16,9 @@
"@codemirror/search": "^6.2.0", "@codemirror/search": "^6.2.0",
"@codemirror/state": "^6.1.1", "@codemirror/state": "^6.1.1",
"@codemirror/view": "^6.2.3", "@codemirror/view": "^6.2.3",
"@lezer/common": "1.0.1", "@lezer/common": "^1.0.1",
"@lezer/highlight": "1.0.0", "@lezer/highlight": "^1.0.0",
"@lezer/markdown": "1.0.1", "@lezer/markdown": "^1.0.1",
"mime-types": "^2.1.35", "mime-types": "^2.1.35",
"yaml": "^1.10.2" "yaml": "^1.10.2"
}, },

View File

@ -8,7 +8,7 @@ import {
Table, Table,
TaskList, TaskList,
} from "@lezer/markdown"; } from "@lezer/markdown";
import { commonmark, getCodeParser, mkLang } from "./markdown/markdown"; import { markdown } from "@codemirror/lang-markdown";
import * as ct from "./customtags"; import * as ct from "./customtags";
import { import {
Language, Language,
@ -108,8 +108,8 @@ export const Comment: MarkdownConfig = {
}; };
export default function buildMarkdown(mdExtensions: MDExt[]): Language { export default function buildMarkdown(mdExtensions: MDExt[]): Language {
return mkLang( return markdown({
commonmark.configure([ extensions: [
WikiLink, WikiLink,
TaskList, TaskList,
Comment, Comment,
@ -155,6 +155,6 @@ export default function buildMarkdown(mdExtensions: MDExt[]): Language {
), ),
], ],
}, },
]) ],
); }).language;
} }

View File

@ -60,7 +60,7 @@ export class EventedSpacePrimitives implements SpacePrimitives {
} }
this.eventHook this.eventHook
.dispatchEvent("page:saved") .dispatchEvent("page:saved", pageName)
.then(() => { .then(() => {
return this.eventHook.dispatchEvent("page:index_text", { return this.eventHook.dispatchEvent("page:index_text", {
name: pageName, name: pageName,

View File

@ -49,9 +49,11 @@ export async function writeSettings<T extends object>(settings: T) {
} catch (e: any) { } catch (e: any) {
await notifyUser("Creating a new SETTINGS page...", "info"); await notifyUser("Creating a new SETTINGS page...", "info");
} }
const writeSettings = {...readSettings, ...settings}; const writeSettings = { ...readSettings, ...settings };
const doc = new YAML.Document(); // const doc = new YAML.Document();
doc.contents = writeSettings; // doc.contents = writeSettings;
const contents = `This page contains settings for configuring SilverBullet and its Plugs.\nAny changes outside of the yaml block will be overwritten.\n\`\`\`yaml\n${doc.toString()}\n\`\`\``; // might need \r\n for windows? const contents = `This page contains settings for configuring SilverBullet and its Plugs.\nAny changes outside of the yaml block will be overwritten.\n\`\`\`yaml\n${YAML.stringify(
await writePage(SETTINGS_PAGE, contents) writeSettings
)}\n\`\`\``; // might need \r\n for windows?
await writePage(SETTINGS_PAGE, contents);
} }

View File

@ -39,7 +39,7 @@
"handlebars": "^4.7.7", "handlebars": "^4.7.7",
"markdown-it": "^12.3.2", "markdown-it": "^12.3.2",
"markdown-it-task-lists": "^2.1.1", "markdown-it-task-lists": "^2.1.1",
"yaml": "^2.0.0" "yaml": "^1.10.2"
}, },
"devDependencies": { "devDependencies": {
"@types/markdown-it": "^12.2.3" "@types/markdown-it": "^12.2.3"

View File

@ -419,7 +419,7 @@ function buildFsRouter(spacePrimitives: SpacePrimitives) {
.route(/\/(.+)/) .route(/\/(.+)/)
.get(async (req, res, next) => { .get(async (req, res, next) => {
let name = req.params[0]; let name = req.params[0];
console.log("Getting", name); console.log("Loading file", name);
try { try {
let attachmentData = await spacePrimitives.readFile( let attachmentData = await spacePrimitives.readFile(
name, name,

View File

@ -28,7 +28,7 @@ import { CommandPalette } from "./components/command_palette";
import { PageNavigator } from "./components/page_navigator"; import { PageNavigator } from "./components/page_navigator";
import { TopBar } from "./components/top_bar"; import { TopBar } from "./components/top_bar";
import { lineWrapper } from "./line_wrapper"; import { lineWrapper } from "./line_wrapper";
import { markdown } from "@silverbulletmd/common/markdown"; import { markdown } from "@codemirror/lang-markdown";
import { PathPageNavigator } from "./navigator"; import { PathPageNavigator } from "./navigator";
import buildMarkdown from "@silverbulletmd/common/parser"; import buildMarkdown from "@silverbulletmd/common/parser";
import reducer from "./reducer"; import reducer from "./reducer";
@ -61,6 +61,7 @@ import sandboxSyscalls from "@plugos/plugos/syscalls/sandbox";
import { eventSyscalls } from "@plugos/plugos/syscalls/event"; import { eventSyscalls } from "@plugos/plugos/syscalls/event";
import { storeSyscalls } from "./syscalls/store"; import { storeSyscalls } from "./syscalls/store";
import { inlineImagesPlugin } from "./inline_image"; import { inlineImagesPlugin } from "./inline_image";
import { ConsoleLogger } from "@plugos/plugos/environments/custom_logger";
class PageState { class PageState {
constructor( constructor(
@ -73,6 +74,9 @@ const saveInterval = 1000;
// Monkey patching the languageDataAt, somehow the languageData facet is not set // Monkey patching the languageDataAt, somehow the languageData facet is not set
// properly, no idea why // properly, no idea why
let _languageFacetsCache: any;
// TODO: Remove at some point // TODO: Remove at some point
EditorState.prototype.languageDataAt = function ( EditorState.prototype.languageDataAt = function (
name: string, name: string,
@ -86,7 +90,11 @@ EditorState.prototype.languageDataAt = function (
let providerResult = provider(this, pos, side); let providerResult = provider(this, pos, side);
if (!providerResult) { if (!providerResult) {
// console.log("Empty provider result"); // console.log("Empty provider result");
continue; providerResult = _languageFacetsCache;
// continue;
} else {
// console.log("Provider result", providerResult);
_languageFacetsCache = providerResult.slice();
} }
for (let result of providerResult) { for (let result of providerResult) {
if (Object.prototype.hasOwnProperty.call(result, name)) if (Object.prototype.hasOwnProperty.call(result, name))
@ -204,7 +212,7 @@ export class Editor {
this.focus(); this.focus();
this.pageNavigator.subscribe(async (pageName, pos: number | string) => { this.pageNavigator.subscribe(async (pageName, pos: number | string) => {
console.log("Now navigating to", pageName, pos); console.log("Now navigating to", pageName);
if (!this.editorView) { if (!this.editorView) {
return; return;
@ -213,7 +221,7 @@ export class Editor {
let stateRestored = await this.loadPage(pageName); let stateRestored = await this.loadPage(pageName);
if (pos) { if (pos) {
if (typeof pos === "string") { if (typeof pos === "string") {
console.log("Navigating to anchor", pos); // console.log("Navigating to anchor", pos);
// We're going to look up the anchor through a direct page store query... // We're going to look up the anchor through a direct page store query...
// TODO: This is a bit hacky, but it works for now // TODO: This is a bit hacky, but it works for now
@ -408,11 +416,6 @@ export class Editor {
base: buildMarkdown(this.mdExtensions), base: buildMarkdown(this.mdExtensions),
addKeymap: true, addKeymap: true,
}), }),
inlineImagesPlugin(),
highlightSpecialChars(),
history(),
drawSelection(),
dropCursor(),
syntaxHighlighting(customMarkdownStyle(this.mdExtensions)), syntaxHighlighting(customMarkdownStyle(this.mdExtensions)),
autocompletion({ autocompletion({
override: [ override: [
@ -422,6 +425,11 @@ export class Editor {
), ),
], ],
}), }),
inlineImagesPlugin(),
highlightSpecialChars(),
history(),
drawSelection(),
dropCursor(),
EditorView.lineWrapping, EditorView.lineWrapping,
lineWrapper([ lineWrapper([
{ selector: "ATXHeading1", class: "sb-line-h1" }, { selector: "ATXHeading1", class: "sb-line-h1" },

View File

@ -39,8 +39,8 @@
"@fortawesome/free-solid-svg-icons": "6.0.0", "@fortawesome/free-solid-svg-icons": "6.0.0",
"@fortawesome/react-fontawesome": "0.1.17", "@fortawesome/react-fontawesome": "0.1.17",
"@jest/globals": "^27.5.1", "@jest/globals": "^27.5.1",
"@lezer/highlight": "1.0.0", "@lezer/highlight": "^1.0.0",
"@lezer/markdown": "1.0.1", "@lezer/markdown": "^1.0.1",
"fake-indexeddb": "^3.1.7", "fake-indexeddb": "^3.1.7",
"fuzzysort": "^2.0.1", "fuzzysort": "^2.0.1",
"jest": "^27.5.1", "jest": "^27.5.1",

View File

@ -1,9 +1,10 @@
import { HighlightStyle } from "@codemirror/language"; import { HighlightStyle } from "@codemirror/language";
import { tags as t } from "@lezer/highlight"; import { tagHighlighter, tags as t } from "@lezer/highlight";
import * as ct from "@silverbulletmd/common/customtags"; import * as ct from "@silverbulletmd/common/customtags";
import { MDExt } from "@silverbulletmd/common/markdown_ext"; import { MDExt } from "@silverbulletmd/common/markdown_ext";
export default function highlightStyles(mdExtension: MDExt[]) { export default function highlightStyles(mdExtension: MDExt[]) {
tagHighlighter;
const hls = HighlightStyle.define([ const hls = HighlightStyle.define([
{ tag: t.heading1, class: "sb-h1" }, { tag: t.heading1, class: "sb-h1" },
{ tag: t.heading2, class: "sb-h2" }, { tag: t.heading2, class: "sb-h2" },
@ -51,6 +52,7 @@ export default function highlightStyles(mdExtension: MDExt[]) {
// Hack: https://discuss.codemirror.net/t/highlighting-that-seems-ignored-in-cm6/4320/16 // Hack: https://discuss.codemirror.net/t/highlighting-that-seems-ignored-in-cm6/4320/16
// @ts-ignore // @ts-ignore
hls.style = (tags) => { hls.style = (tags) => {
// console.log("Tags", tags);
return fn0(tags || []); return fn0(tags || []);
}; };

View File

@ -1,5 +1,9 @@
An attempt at documenting of the changes/new features introduced in each release. An attempt at documenting of the changes/new features introduced in each release.
---
## 0.0.35
* Big refactor of the internal Space API unifying attachment and page handling. This shouldn't affect (most) existing code and plugs (except some more exotic areas), but if stuff breaks, please report it.
--- ---
## 0.0.34 ## 0.0.34