From a286631397d6a9585584e706681fc575cd683673 Mon Sep 17 00:00:00 2001 From: JensLincke Date: Fri, 7 Jun 2024 09:37:20 +0200 Subject: [PATCH] add typescript to fileindex and allow typescript to load relative in markdown scripts SQUASHED: AUTO-COMMIT-src-client-fileindex.js,AUTO-COMMIT-src-components-widgets-lively-code-mirror-lint.js,AUTO-COMMIT-src-systemjs-config.js, --- src/client/fileindex.js | 2 +- src/components/widgets/lively-code-mirror-lint.js | 1 - src/systemjs-config.js | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/client/fileindex.js b/src/client/fileindex.js index 80ac20b5f..8e73a0dcf 100644 --- a/src/client/fileindex.js +++ b/src/client/fileindex.js @@ -750,7 +750,7 @@ MD*/ modified: modified } - if (name.match(/\.((css)|(js)|(md)|(txt)|(tex)|(bib)|(x?html)|(note))$/)) { + if (name.match(/\.((css)|(js)|(mjs)|(ts)|(md)|(txt)|(tex)|(bib)|(x?html)|(note))$/)) { if ((size < MAX_FILESIZE) || name.match(/\.((bib))$/) ) { let response = await fetch(url, { method: "GET", diff --git a/src/components/widgets/lively-code-mirror-lint.js b/src/components/widgets/lively-code-mirror-lint.js index 10345808d..772a141e3 100644 --- a/src/components/widgets/lively-code-mirror-lint.js +++ b/src/components/widgets/lively-code-mirror-lint.js @@ -10,7 +10,6 @@ CodeMirror.registerHelper("lint", "markdown", function(text, options) { function processJS(text, options, found) { var blocks = text.split(/(?<=\]*?>)|(?=\<\/script>)/gi); - debugger let fullCode = "" let offsets = [{line: -1, offset: 0}] diff --git a/src/systemjs-config.js b/src/systemjs-config.js index c25628d3a..2efde66f0 100644 --- a/src/systemjs-config.js +++ b/src/systemjs-config.js @@ -64,7 +64,7 @@ function isWorkspace(load) { } -const WORKSPACE_REGEX = /^\/?workspace(async)?(js)?:/ +const WORKSPACE_REGEX = /^\/?workspace(async)?((js)|(ts))?:/ // export async function locate(load) { // // does the resolving relative workspace urls belong here? @@ -623,7 +623,7 @@ orginalResolve = orginalResolve.originalFunction || orginalResolve function systemResolve(id, parentUrl) { let result try { - if (parentUrl && parentUrl.match(/workspace\:/) && id && id.match(/.*\.js$/)) { + if (parentUrl && parentUrl.match(/workspace\:/) && id && id.match(/.*\.((js)|(ts))$/)) { if (id.match(/^[a-zA-Z]/)) { // Non relative files @@ -634,7 +634,7 @@ function systemResolve(id, parentUrl) { var baseId = m[1] var targetModule = m[2] - if (targetModule.match(/\.js$/)) { + if (targetModule.match(/\.((js)|(ts))$/)) { var protocoll = new URL(lively4url).protocol if (targetModule.match(/^lively-kernel\.org/)) { protocoll = "https:" // accessing lively-kernel from localhost....