Update jupyterlab-ihaskell for 4.x (#1426)

* [WIP] Update jupyterlab-ihaskell for 4.x

* Address feedback

* jupyterlab-ihaskell: more updates

* jupyterlab-ihaskell: don't minify

* jupyterlab-ihaskell: update

* jupyterlab-ihaskell: change mimetype

* jupyterlab-ihaskell: update

* jupyterlab-ihaskell: works with JupyterLab 4

* jupyterlab-ihaskell: update id

* jupyterlab-ihaskell: simplify

* jupyterlab-ihaskell: update
This commit is contained in:
Vaibhav Sagar 2024-04-21 19:10:08 +10:00 committed by GitHub
parent 851c7708d8
commit 0d647a949f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 5362 additions and 6357 deletions

3
.gitignore vendored
View File

@ -27,4 +27,5 @@ result
default.nix
dist-*/
cabal.project.local
cabal.config
cabal.config
tsconfig.tsbuildinfo

View File

@ -47,7 +47,6 @@ data-files:
html/logo-64x64.svg
jupyterlab-ihaskell/labextension/package.json
jupyterlab-ihaskell/labextension/static/*.js
jupyterlab-ihaskell/labextension/static/*.json
flag use-hlint
description: Include HLint support

View File

@ -29,25 +29,23 @@
"watch": "tsc -w"
},
"dependencies": {
"@jupyterlab/application": ">=3.0.0",
"@jupyterlab/codemirror": ">=3.0.0",
"@jupyterlab/apputils": ">=3.0.0",
"@jupyterlab/docregistry": ">=3.0.0",
"@jupyterlab/notebook": ">=3.0.0",
"@jupyterlab/services": ">=6.0.0"
"@jupyterlab/application": ">=4.0.0",
"@jupyterlab/codemirror": ">=4.0.0",
"@jupyterlab/apputils": ">=4.0.0",
"@jupyterlab/notebook": ">=4.0.0"
},
"devDependencies": {
"rimraf": "^3.0.0",
"typescript": "~3.7.3",
"typescript": "~5.0.4",
"@types/codemirror": ">=0.0.0",
"@jupyterlab/builder": ">=3.0.0"
"@jupyterlab/builder": ">=4.0.0"
},
"jupyterlab": {
"extension": true,
"outputDir": "labextension",
"webpackConfig": "./webpack.config.js",
"_build": {
"load": "static/remoteEntry-ddc4c9d791a676e50bb9.js",
"load": "static/remoteEntry-33e79930ce2a88033aa3.js",
"extension": "./extension"
}
}

View File

@ -1 +0,0 @@
"use strict";(self.webpackChunkjupyterlab_ihaskell=self.webpackChunkjupyterlab_ihaskell||[]).push([[568],{291:function(e,t,l){var i=this&&this.__awaiter||function(e,t,l,i){return new(l||(l=Promise))((function(n,o){function r(e){try{s(i.next(e))}catch(e){o(e)}}function a(e){try{s(i.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof l?t:new l((function(e){e(t)}))).then(r,a)}s((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=l(36);t.defineIHaskellMode=function({CodeMirror:e}){return i(this,void 0,void 0,(function*(){yield n.Mode.ensure("haskell"),yield n.Mode.ensure("r"),e.defineMode("ihaskell",(t=>{let l=e.getMode(t,"haskell");return e.multiplexingMode(l,{open:/:(?=!)/,close:/^(?!!)/,mode:e.getMode(t,"text/plain"),delimStyle:"delimit"},{open:/\[r\||\[rprint\||\[rgraph\|/,close:/\|\]/,mode:e.getMode(t,"text/x-rsrc"),delimStyle:"delimit"})})),e.defineMIME("text/x-ihaskell","ihaskell"),e.modeInfo.push({ext:["hs"],mime:"text/x-ihaskell",mode:"ihaskell",name:"ihaskell"})}))}},568:(e,t,l)=>{Object.defineProperty(t,"__esModule",{value:!0});const i=l(36),n=l(291),o={id:"ihaskell",autoStart:!0,requires:[i.ICodeMirror],activate:(e,t)=>{n.defineIHaskellMode(t).catch(console.warn)}};t.default=o}}]);

View File

@ -0,0 +1 @@
"use strict";(self.webpackChunkjupyterlab_ihaskell=self.webpackChunkjupyterlab_ihaskell||[]).push([[568],{568:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(373),a=r(428),i=r(101),o={id:"ihaskell",autoStart:!0,description:"A CodeMirror extension for IHaskell",requires:[a.IEditorLanguageRegistry],activate:async(e,t)=>{const r=new n.LanguageSupport(n.StreamLanguage.define(i.haskell));t.addLanguage({name:"ihaskell",mime:"text/x-ihaskell",support:r,extensions:["hs"]})}};t.default=o},101:(e,t)=>{function r(e,t,r){return t(r),r(e,t)}Object.defineProperty(t,"__esModule",{value:!0});var n=/[a-z_]/,a=/[A-Z]/,i=/\d/,o=/[0-9A-Fa-f]/,l=/[0-7]/,u=/[a-z_A-Z0-9'\xa1-\uffff]/,s=/[-!#$%&*+.\/<=>?@\\^|~:]/,c=/[(),;[\]`{}]/,f=/[ \t\v\f]/;function d(e,t){if(e.eatWhile(f))return null;var d=e.next();if(c.test(d)){if("{"==d&&e.eat("-")){var p="comment";return e.eat("#")&&(p="meta"),r(e,t,h(p,1))}return null}if("'"==d)return e.eat("\\"),e.next(),e.eat("'")?"string":"error";if('"'==d)return r(e,t,m);if(a.test(d))return e.eatWhile(u),e.eat(".")?"qualifier":"type";if(n.test(d))return e.eatWhile(u),"variable";if(i.test(d)){if("0"==d){if(e.eat(/[xX]/))return e.eatWhile(o),"integer";if(e.eat(/[oO]/))return e.eatWhile(l),"number"}return e.eatWhile(i),p="number",e.match(/^\.\d+/)&&(p="number"),e.eat(/[eE]/)&&(p="number",e.eat(/[-+]/),e.eatWhile(i)),p}return"."==d&&e.eat(".")?"keyword":s.test(d)?"-"==d&&e.eat(/-/)&&(e.eatWhile(/-/),!e.eat(s))?(e.skipToEnd(),"comment"):(e.eatWhile(s),"variable"):"error"}function h(e,t){return 0==t?d:function(r,n){for(var a=t;!r.eol();){var i=r.next();if("{"==i&&r.eat("-"))++a;else if("-"==i&&r.eat("}")&&0==--a)return n(d),e}return n(h(e,a)),e}}function m(e,t){for(;!e.eol();){var r=e.next();if('"'==r)return t(d),"string";if("\\"==r){if(e.eol()||e.eat(f))return t(p),"string";e.eat("&")||e.next()}}return t(d),"error"}function p(e,t){return e.eat("\\")?r(e,t,m):(e.next(),t(d),"error")}var g=function(){var e={};function t(t){return function(){for(var r=0;r<arguments.length;r++)e[arguments[r]]=t}}return t("keyword")("case","class","data","default","deriving","do","else","foreign","if","import","in","infix","infixl","infixr","instance","let","module","newtype","of","then","type","where","_"),t("keyword")("..",":","::","=","\\","<-","->","@","~","=>"),t("builtin")("!!","$!","$","&&","+","++","-",".","/","/=","<","<*","<=","<$>","<*>","=<<","==",">",">=",">>",">>=","^","^^","||","*","*>","**"),t("builtin")("Applicative","Bool","Bounded","Char","Double","EQ","Either","Enum","Eq","False","FilePath","Float","Floating","Fractional","Functor","GT","IO","IOError","Int","Integer","Integral","Just","LT","Left","Maybe","Monad","Nothing","Num","Ord","Ordering","Rational","Read","ReadS","Real","RealFloat","RealFrac","Right","Show","ShowS","String","True"),t("builtin")("abs","acos","acosh","all","and","any","appendFile","asTypeOf","asin","asinh","atan","atan2","atanh","break","catch","ceiling","compare","concat","concatMap","const","cos","cosh","curry","cycle","decodeFloat","div","divMod","drop","dropWhile","either","elem","encodeFloat","enumFrom","enumFromThen","enumFromThenTo","enumFromTo","error","even","exp","exponent","fail","filter","flip","floatDigits","floatRadix","floatRange","floor","fmap","foldl","foldl1","foldr","foldr1","fromEnum","fromInteger","fromIntegral","fromRational","fst","gcd","getChar","getContents","getLine","head","id","init","interact","ioError","isDenormalized","isIEEE","isInfinite","isNaN","isNegativeZero","iterate","last","lcm","length","lex","lines","log","logBase","lookup","map","mapM","mapM_","max","maxBound","maximum","maybe","min","minBound","minimum","mod","negate","not","notElem","null","odd","or","otherwise","pi","pred","print","product","properFraction","pure","putChar","putStr","putStrLn","quot","quotRem","read","readFile","readIO","readList","readLn","readParen","reads","readsPrec","realToFrac","recip","rem","repeat","replicate","return","reverse","round","scaleFloat","scanl","scanl1","scanr","scanr1","seq","sequence","sequence_","show","showChar","showList","showParen","showString","shows","showsPrec","significand","signum","sin","sinh","snd","span","splitAt","sqrt","subtract","succ","sum","tail","take","takeWhile","tan","tanh","toEnum","toInteger","toRational","truncate","uncurry","undefined","unlines","until","unwords","unzip","unzip3","userError","words","writeFile","zip","zip3","zipWith","zipWith3"),e}();const k={name:"haskell",startState:function(){return{f:d}},copyState:function(e){return{f:e.f}},token:function(e,t){var r=t.f(e,(function(e){t.f=e})),n=e.current();return g.hasOwnProperty(n)?g[n]:r},languageData:{commentTokens:{line:"--",block:{open:"{-",close:"-}"}}}};t.haskell=k}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,10 @@
{
"packages": []
"packages": [
{
"name": "@codemirror/legacy-modes",
"versionInfo": "6.3.3",
"licenseId": "MIT",
"extractedText": "MIT License\n\nCopyright (C) 2018-2021 by Marijn Haverbeke <marijn@haverbeke.berlin> and others\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
}
]
}

File diff suppressed because it is too large Load Diff

View File

@ -29,18 +29,16 @@
"watch": "tsc -w"
},
"dependencies": {
"@jupyterlab/application": ">=3.0.0",
"@jupyterlab/codemirror": ">=3.0.0",
"@jupyterlab/apputils": ">=3.0.0",
"@jupyterlab/docregistry": ">=3.0.0",
"@jupyterlab/notebook": ">=3.0.0",
"@jupyterlab/services": ">=6.0.0"
"@jupyterlab/application": ">=4.0.0",
"@jupyterlab/codemirror": ">=4.0.0",
"@jupyterlab/apputils": ">=4.0.0",
"@jupyterlab/notebook": ">=4.0.0"
},
"devDependencies": {
"rimraf": "^3.0.0",
"typescript": "~3.7.3",
"typescript": "~5.0.4",
"@types/codemirror": ">=0.0.0",
"@jupyterlab/builder": ">=3.0.0"
"@jupyterlab/builder": ">=4.0.0"
},
"jupyterlab": {
"extension": true,

View File

@ -1,37 +0,0 @@
import { ICodeMirror, Mode } from '@jupyterlab/codemirror';
export async function defineIHaskellMode({ CodeMirror }: ICodeMirror) {
await Mode.ensure("haskell");
await Mode.ensure("r");
CodeMirror.defineMode("ihaskell", (config) => {
let hmode = CodeMirror.getMode(config, "haskell");
return CodeMirror.multiplexingMode(
hmode,
{
// @ts-ignore
open: /:(?=!)/, // Matches : followed by !, but doesn't consume !
// @ts-ignore
close: /^(?!!)/, // Matches start of line not followed by !, doesn't consume character
mode: CodeMirror.getMode(config, "text/plain"),
delimStyle: "delimit"
},
{
// @ts-ignore
open: /\[r\||\[rprint\||\[rgraph\|/,
// @ts-ignore
close: /\|\]/,
mode: CodeMirror.getMode(config, "text/x-rsrc"),
delimStyle: "delimit"
}
);
});
CodeMirror.defineMIME("text/x-ihaskell", "ihaskell");
CodeMirror.modeInfo.push({
ext: ['hs'],
mime: "text/x-ihaskell",
mode: 'ihaskell',
name: 'ihaskell'
});
}

View File

@ -1,22 +1,22 @@
import {
JupyterFrontEnd, JupyterFrontEndPlugin
} from '@jupyterlab/application';
import { JupyterFrontEnd, JupyterFrontEndPlugin } from '@jupyterlab/application';
import { StreamLanguage, LanguageSupport } from '@codemirror/language';
import { IEditorLanguageRegistry } from '@jupyterlab/codemirror';
import { haskell } from '@codemirror/legacy-modes/mode/haskell';
import { ICodeMirror } from '@jupyterlab/codemirror';
import { defineIHaskellMode } from './codemirror-ihaskell';
/**
* Initialization data for the extension1 extension.
*/
const extension: JupyterFrontEndPlugin<void> = {
const plugin: JupyterFrontEndPlugin<void> = {
id: 'ihaskell',
autoStart: true,
requires: [ICodeMirror],
activate: (app: JupyterFrontEnd, codeMirror: ICodeMirror) =>
{
defineIHaskellMode(codeMirror).catch(console.warn);
description: 'A CodeMirror extension for IHaskell',
requires: [IEditorLanguageRegistry],
activate: async (app: JupyterFrontEnd, languages: IEditorLanguageRegistry) => {
const languageSupport = new LanguageSupport(StreamLanguage.define(haskell));
languages.addLanguage({
name: "ihaskell",
mime: "text/x-ihaskell",
support: languageSupport,
extensions: ["hs"],
});
}
};
export default extension;
export default plugin;

View File

@ -1,15 +1,22 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"declaration": true,
"noImplicitAny": false,
"noEmitOnError": true,
"noUnusedLocals": true,
"allowJs": true,
"allowSyntheticDefaultImports": true,
"composite": true,
"declaration": true,
"esModuleInterop": true,
"incremental": true,
"lib": ["dom", "es2018"],
"module": "commonjs",
"moduleResolution": "node",
"target": "es2015",
"outDir": "./lib",
"lib": ["dom", "es2015"],
"noEmitOnError": true,
"noImplicitAny": false,
"noUnusedLocals": true,
"outDir": "lib",
"rootDir": "src",
"resolveJsonModule": true,
"target": "ES2020",
"types": []
},
"include": ["src/*"]

View File

@ -25,5 +25,5 @@ module.exports = {
},
plugins: [
new FixupEntryPoint()
]
],
}

File diff suppressed because it is too large Load Diff