Skip to content

Commit

Permalink
add typescript to fileindex and allow typescript to load relative in …
Browse files Browse the repository at this point in the history
…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,
  • Loading branch information
JensLincke committed Jun 7, 2024
1 parent 5fb07e2 commit a286631
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/client/fileindex.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion src/components/widgets/lively-code-mirror-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ CodeMirror.registerHelper("lint", "markdown", function(text, options) {
function processJS(text, options, found) {

var blocks = text.split(/(?<=\<script[^>]*?>)|(?=\<\/script>)/gi);
debugger
let fullCode = ""
let offsets = [{line: -1, offset: 0}]

Expand Down
6 changes: 3 additions & 3 deletions src/systemjs-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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
Expand All @@ -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....
Expand Down

0 comments on commit a286631

Please sign in to comment.