@live-codes/browser-compilers 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ var typescriptATA=(()=>{var N=Object.defineProperty;var R=e=>N(e,"__esModule",{value:!0});var q=(e,r)=>{R(e);for(var t in r)N(e,t,{get:r[t],enumerable:!0})};var X={};q(X,{getFileTreeForModuleWithTag:()=>g,getNewDependencies:()=>x,getReferencesForModule:()=>V,setupTypeAcquisition:()=>U});var K=Object.defineProperty,z=Object.defineProperties,A=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,B=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable,D=(e,r,t)=>r in e?K(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,j=(e,r)=>{for(var t in r||(r={}))B.call(r,t)&&D(e,t,r[t]);if(T)for(var t of T(r))G.call(r,t)&&D(e,t,r[t]);return e},E=(e,r)=>z(e,A(r)),m=(e,r,t)=>new Promise((o,l)=>{var n=a=>{try{d(t.next(a))}catch(c){l(c)}},i=a=>{try{d(t.throw(a))}catch(c){l(c)}},d=a=>a.done?o(a.value):Promise.resolve(a.value).then(n,i);d((t=t.apply(e,r)).next())}),H=(e,r)=>{let t=`https://data.jsdelivr.com/v1/package/npm/${r}`;return y(e,t,{cache:"no-store"})},J=(e,r,t)=>{let o=`https://data.jsdelivr.com/v1/package/resolve/npm/${r}@${t}`;return y(e,o)},L=(e,r,t)=>m(void 0,null,function*(){let o=`https://data.jsdelivr.com/v1/package/npm/${r}@${t}/flat`,l=yield y(e,o);return l instanceof Error?l:E(j({},l),{moduleName:r,version:t})}),k=(e,r,t,o)=>m(void 0,null,function*(){let l=`https://cdn.jsdelivr.net/npm/${r}@${t}${o}`,i=yield(e.fetcher||fetch)(l);return i.ok?i.text():new Error("OK")});function y(e,r,t){return(e.fetcher||fetch)(r,t).then(l=>l.ok?l.json().then(n=>n):new Error("OK"))}var Q=e=>{if(["assert","assert/strict","async_hooks","buffer","child_process","cluster","console","constants","crypto","dgram","diagnostics_channel","dns","dns/promises","domain","events","fs","fs/promises","http","http2","https","inspector","module","net","os","path","path/posix","path/win32","perf_hooks","process","punycode","querystring","readline","repl","stream","stream/promises","stream/consumers","stream/web","string_decoder","sys","timers","timers/promises","tls","trace_events","tty","url","util","util/types","v8","vm","wasi","worker_threads","zlib"].includes(e.replace("node:","")))return"node";let[t="",o=""]=e.split("/");return t.startsWith("@")?`${t}/${o}`:t},U=e=>{let r=new Map,t=new Map,o=0,l=0;return i=>(o=0,l=0,n(i,0).then(d=>{var a,c;l>0&&((c=(a=e.delegate).finished)==null||c.call(a,t))}));function n(i,d){return m(this,null,function*(){var a,c,w,F,M;let P=x(e,r,i);P.forEach(s=>r.set(s.module,{state:"loading"}));let h=(yield Promise.all(P.map(s=>g(e,s.module,s.version)))).filter(s=>!("error"in s)),b=h.filter(s=>s.files.find(u=>u.name.endsWith(".d.ts"))),C=b.map(s=>W(s,`/node_modules/${s.moduleName}`)),S=h.filter(s=>!b.includes(s)),O=(yield Promise.all(S.map(s=>g(e,`@types/${$(s.moduleName)}`,"latest")))).filter(s=>!("error"in s)),I=O.map(s=>W(s,`/node_modules/@types/${$(s.moduleName).replace("types__","")}`)),_=C.concat(I).reduce((s,u)=>s.concat(u),[]);o+=_.length,_.length&&d===0&&((c=(a=e.delegate).started)==null||c.call(a));for(let s of h){let u=`/node_modules/${s.moduleName}`;O.includes(s)&&(u=`/node_modules/@types/${$(s.moduleName).replace("types__","")}`);let f=u+"/package.json",p=yield k(e,s.moduleName,s.version,"/package.json");typeof p=="string"?(t.set(f,p),(F=(w=e.delegate).receivedFile)==null||F.call(w,p,f)):(M=e.logger)==null||M.error(`Could not download package.json for ${s.moduleName}`)}yield Promise.all(_.map(s=>m(this,null,function*(){var u,f,p;let v=yield k(e,s.moduleName,s.moduleVersion,s.path);l++,v instanceof Error?(u=e.logger)==null||u.error(`Had an issue getting ${s.path} for ${s.moduleName}`):(t.set(s.vfsPath,v),(p=(f=e.delegate).receivedFile)==null||p.call(f,v,s.vfsPath),e.delegate.progress&&l%5==0&&e.delegate.progress(l,o),yield n(v,d+1))})))})}};function W(e,r){let t=[];for(let o of e.files)o.name.endsWith(".d.ts")&&t.push({moduleName:e.moduleName,moduleVersion:e.version,vfsPath:`${r}${o.name}`,path:o.name});return t}var V=(e,r)=>{let t=e.preProcessFile(r),o=e.libMap||new Map;return t.referencedFiles.concat(t.importedFiles).concat(t.libReferenceDirectives).filter(n=>!n.fileName.endsWith(".d.ts")).filter(n=>!o.has(n.fileName)).map(n=>{let i;if(!n.fileName.startsWith(".")){i="latest";let d=r.slice(n.end).split(`
2
+ `)[0];d.includes("// types:")&&(i=d.split("// types: ")[1].trim())}return{module:n.fileName,version:i}})};function x(e,r,t){return V(e.typescript,t).map(n=>E(j({},n),{module:Q(n.module)})).filter(n=>!n.module.startsWith(".")).filter(n=>!r.has(n.module))}var g=(e,r,t)=>m(void 0,null,function*(){let o=t||"latest";if(o.split(".").length<2){let n=yield J(e,r,o);if(n instanceof Error)return{error:n,userFacingMessage:`Could not go from a tag to version on npm for ${r} - possible typo?`};let i=n.version;if(!i){let d=yield H(e,r);if(d instanceof Error)return{error:n,userFacingMessage:`Could not get versions on npm for ${r} - possible typo?`};let a=Object.entries(d.tags).join(", ");return{error:new Error("Could not find tag for module"),userFacingMessage:`Could not find a tag for ${r} called ${t}. Did find ${a}`}}o=i}let l=yield L(e,r,o);return l instanceof Error?{error:l,userFacingMessage:`Could not get the files for ${r}@${o}. Is it possibly a typo?`}:l});function $(e){return e.indexOf("@")===0&&e.indexOf("/")!==-1&&(e=e.substr(1).replace("/","__")),e}return X;})();
@@ -0,0 +1,3 @@
1
+ var typescriptVFS=(()=>{var k=Object.defineProperty;var W=e=>k(e,"__esModule",{value:!0});var C=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var O=(e,t)=>{W(e);for(var r in t)k(e,r,{get:t[r],enumerable:!0})};var J={};O(J,{addAllFilesFromFolder:()=>T,addFilesForTypesIntoFolder:()=>K,createDefaultMapFromCDN:()=>R,createDefaultMapFromNodeModules:()=>B,createFSBackedSystem:()=>G,createSystem:()=>z,createVirtualCompilerHost:()=>P,createVirtualLanguageServiceHost:()=>V,createVirtualTypeScriptEnvironment:()=>U,knownLibFilesForCompilerOptions:()=>N});function D(){return D=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},D.apply(this,arguments)}var M=!1;try{M=typeof localStorage!="undefined"}catch(e){}var A=typeof process!="undefined",_=M&&localStorage.getItem("DEBUG")||A&&process.env.DEBUG,j=_?console.log:function(e){return""};function U(e,t,r,s,c){s===void 0&&(s={});var l=D({},H(r),s),a=V(e,t,l,r,c),o=a.languageServiceHost,i=a.updateFile,n=r.createLanguageService(o),u=n.getCompilerOptionsDiagnostics();if(u.length){var g=P(e,s,r);throw new Error(r.formatDiagnostics(u,g.compilerHost))}return{name:"vfs",sys:e,languageService:n,getSourceFile:function(f){var d;return(d=n.getProgram())==null?void 0:d.getSourceFile(f)},createFile:function(f,d){i(r.createSourceFile(f,d,l.target,!1))},updateFile:function(f,d,v){var h=n.getProgram().getSourceFile(f);if(!h)throw new Error("Did not find a source file for "+f);var b=h.text,F=v??r.createTextSpan(0,b.length),m=b.slice(0,F.start)+d+b.slice(F.start+F.length),S=r.updateSourceFile(h,m,{span:F,newLength:d.length});i(S)}}}var N=function(t,r){var s=t.target||r.ScriptTarget.ES5,c=t.lib||[],l=["lib.d.ts","lib.decorators.d.ts","lib.decorators.legacy.d.ts","lib.dom.d.ts","lib.dom.iterable.d.ts","lib.webworker.d.ts","lib.webworker.importscripts.d.ts","lib.webworker.iterable.d.ts","lib.scripthost.d.ts","lib.es5.d.ts","lib.es6.d.ts","lib.es2015.collection.d.ts","lib.es2015.core.d.ts","lib.es2015.d.ts","lib.es2015.generator.d.ts","lib.es2015.iterable.d.ts","lib.es2015.promise.d.ts","lib.es2015.proxy.d.ts","lib.es2015.reflect.d.ts","lib.es2015.symbol.d.ts","lib.es2015.symbol.wellknown.d.ts","lib.es2016.array.include.d.ts","lib.es2016.d.ts","lib.es2016.full.d.ts","lib.es2017.d.ts","lib.es2017.date.d.ts","lib.es2017.full.d.ts","lib.es2017.intl.d.ts","lib.es2017.object.d.ts","lib.es2017.sharedmemory.d.ts","lib.es2017.string.d.ts","lib.es2017.typedarrays.d.ts","lib.es2018.asyncgenerator.d.ts","lib.es2018.asynciterable.d.ts","lib.es2018.d.ts","lib.es2018.full.d.ts","lib.es2018.intl.d.ts","lib.es2018.promise.d.ts","lib.es2018.regexp.d.ts","lib.es2019.array.d.ts","lib.es2019.d.ts","lib.es2019.full.d.ts","lib.es2019.intl.d.ts","lib.es2019.object.d.ts","lib.es2019.string.d.ts","lib.es2019.symbol.d.ts","lib.es2020.bigint.d.ts","lib.es2020.d.ts","lib.es2020.date.d.ts","lib.es2020.full.d.ts","lib.es2020.intl.d.ts","lib.es2020.number.d.ts","lib.es2020.promise.d.ts","lib.es2020.sharedmemory.d.ts","lib.es2020.string.d.ts","lib.es2020.symbol.wellknown.d.ts","lib.es2021.d.ts","lib.es2021.full.d.ts","lib.es2021.intl.d.ts","lib.es2021.promise.d.ts","lib.es2021.string.d.ts","lib.es2021.weakref.d.ts","lib.es2022.array.d.ts","lib.es2022.d.ts","lib.es2022.error.d.ts","lib.es2022.full.d.ts","lib.es2022.intl.d.ts","lib.es2022.object.d.ts","lib.es2022.regexp.d.ts","lib.es2022.sharedmemory.d.ts","lib.es2022.string.d.ts","lib.es2023.array.d.ts","lib.es2023.collection.d.ts","lib.es2023.d.ts","lib.es2023.full.d.ts","lib.esnext.array.d.ts","lib.esnext.asynciterable.d.ts","lib.esnext.bigint.d.ts","lib.esnext.d.ts","lib.esnext.decorators.d.ts","lib.esnext.disposable.d.ts","lib.esnext.full.d.ts","lib.esnext.intl.d.ts","lib.esnext.promise.d.ts","lib.esnext.string.d.ts","lib.esnext.symbol.d.ts","lib.esnext.weakref.d.ts"],a=r.ScriptTarget[s],o=l.filter(function(f){return f.startsWith("lib."+a.toLowerCase())}),i=l.indexOf(o.pop()),n=function(d){return d&&d.length?d.reduce(function(v,h){return h>v?h:v}):void 0},u=c.map(function(f){var d=l.filter(function(h){return h.startsWith("lib."+f.toLowerCase())});if(d.length===0)return 0;var v=l.indexOf(d.pop());return v}),g=n(u)||0,p=Math.max(i,g);return l.slice(0,p+1)},B=function(t,r,s){var c=L(),l=q(),a=function(g){var p=s||c.dirname(C.resolve("typescript"));return l.readFileSync(c.join(p,g),"utf8")},o=l.readdirSync(s||c.dirname(C.resolve("typescript"))),i=o.filter(function(u){return u.startsWith("lib.")&&u.endsWith(".d.ts")}),n=new Map;return i.forEach(function(u){n.set("/"+u,a(u))}),n},T=function(t,r){var s=L(),c=q(),l=function o(i){var n=[],u=c.readdirSync(i);return u.forEach(function(g){g=s.join(i,g);var p=c.statSync(g);p&&p.isDirectory()?n=n.concat(o(g)):n.push(g)}),n},a=l(r);a.forEach(function(o){var i="/node_modules/@types"+o.replace(r,""),n=c.readFileSync(o,"utf8"),u=[".ts",".tsx"];u.includes(s.extname(i))&&t.set(i,n)})},K=function(t){return T(t,"node_modules/@types")},R=function(t,r,s,c,l,a,o){var i=a||fetch,n=new Map,u=N(t,c),g="https://typescript.azureedge.net/cdn/"+r+"/typescript/lib/";function p(b){return l?l.compressToUTF16(b):b}function f(b){return l?l.decompressFromUTF16(b):b}function d(){return Promise.all(u.map(function(b){return i(g+b).then(function(F){return F.text()})})).then(function(b){b.forEach(function(F,m){return n.set("/"+u[m],F)})}).catch(function(){})}function v(){var b=o||localStorage,F=Object.keys(b);return F.forEach(function(m){m.startsWith("ts-lib-")&&!m.startsWith("ts-lib-"+r)&&b.removeItem(m)}),Promise.all(u.map(function(m){var S="ts-lib-"+r+"-"+m,E=b.getItem(S);return E?Promise.resolve(f(E)):i(g+m).then(function(w){return w.text()}).then(function(w){return b.setItem(S,p(w)),w}).catch(function(){})})).then(function(m){m.forEach(function(S,E){if(S){var w="/"+u[E];n.set(w,S)}})})}var h=s?v:d;return h().then(function(){return n})};function x(e){throw new Error("Method '"+e+"' is not implemented.")}function y(e,t){return function(){for(var r=arguments.length,s=new Array(r),c=0;c<r;c++)s[c]=arguments[c];var l=t.apply(void 0,s),a=typeof l=="string"?l.slice(0,80)+"...":l;return j.apply(void 0,["> "+e].concat(s)),j("< "+a),l}}var H=function(t){return D({},t.getDefaultCompilerOptions(),{jsx:t.JsxEmit.React,strict:!0,esModuleInterop:!0,module:t.ModuleKind.ESNext,suppressOutputPathCheck:!0,skipLibCheck:!0,skipDefaultLibCheck:!0,moduleResolution:t.ModuleResolutionKind.NodeJs})},I=function(t){return t.replace("/","/lib.").toLowerCase()};function z(e){return{args:[],createDirectory:function(){return x("createDirectory")},directoryExists:y("directoryExists",function(t){return Array.from(e.keys()).some(function(r){return r.startsWith(t)})}),exit:function(){return x("exit")},fileExists:y("fileExists",function(t){return e.has(t)||e.has(I(t))}),getCurrentDirectory:function(){return"/"},getDirectories:function(){return[]},getExecutingFilePath:function(){return x("getExecutingFilePath")},readDirectory:y("readDirectory",function(t){return t==="/"?Array.from(e.keys()):[]}),readFile:y("readFile",function(t){return e.get(t)||e.get(I(t))}),resolvePath:function(r){return r},newLine:`
2
+ `,useCaseSensitiveFileNames:!0,write:function(){return x("write")},writeFile:function(r,s){e.set(r,s)}}}function G(e,t,r,s){var c=t+"/vfs",l=L(),a=r.sys,o=s??l.dirname(C.resolve("typescript"));return{name:"fs-vfs",root:c,args:[],createDirectory:function(){return x("createDirectory")},directoryExists:y("directoryExists",function(i){return Array.from(e.keys()).some(function(n){return n.startsWith(i)})||a.directoryExists(i)}),exit:a.exit,fileExists:y("fileExists",function(i){if(e.has(i))return!0;if(i.includes("tsconfig.json")||i.includes("tsconfig.json"))return!1;if(i.startsWith("/lib")){var n=o+"/"+i.replace("/","");return a.fileExists(n)}return a.fileExists(i)}),getCurrentDirectory:function(){return c},getDirectories:a.getDirectories,getExecutingFilePath:function(){return x("getExecutingFilePath")},readDirectory:y("readDirectory",function(){return(arguments.length<=0?void 0:arguments[0])==="/"?Array.from(e.keys()):a.readDirectory.apply(a,arguments)}),readFile:y("readFile",function(i){if(e.has(i))return e.get(i);if(i.startsWith("/lib")){var n=o+"/"+i.replace("/",""),u=a.readFile(n);if(!u){var g=a.readDirectory(o);throw new Error("TSVFS: A request was made for "+n+" but there wasn't a file found in the file map. You likely have a mismatch in the compiler options for the CDN download vs the compiler program. Existing Libs: "+g+".")}return u}return a.readFile(i)}),resolvePath:function(n){return e.has(n)?n:a.resolvePath(n)},newLine:`
3
+ `,useCaseSensitiveFileNames:!0,write:function(){return x("write")},writeFile:function(n,u){e.set(n,u)}}}function P(e,t,r){var s=new Map,c=function(o){return s.set(o.fileName,o),o},l={compilerHost:D({},e,{getCanonicalFileName:function(o){return o},getDefaultLibFileName:function(){return"/"+r.getDefaultLibFileName(t)},getDirectories:function(){return[]},getNewLine:function(){return e.newLine},getSourceFile:function(o){return s.get(o)||c(r.createSourceFile(o,e.readFile(o),t.target||H(r).target,!1))},useCaseSensitiveFileNames:function(){return e.useCaseSensitiveFileNames}}),updateFile:function(o){var i=s.has(o.fileName);return e.writeFile(o.fileName,o.text),s.set(o.fileName,o),i}};return l}function V(e,t,r,s,c){var l=[].concat(t),a=P(e,r,s),o=a.compilerHost,i=a.updateFile,n=new Map,u=0,g=D({},o,{getProjectVersion:function(){return u.toString()},getCompilationSettings:function(){return r},getCustomTransformers:function(){return c},getScriptFileNames:function(){return l.slice()},getScriptSnapshot:function(d){var v=e.readFile(d);if(v)return s.ScriptSnapshot.fromString(v)},getScriptVersion:function(d){return n.get(d)||"0"},writeFile:e.writeFile}),p={languageServiceHost:g,updateFile:function(d){u++,n.set(d.fileName,u.toString()),l.includes(d.fileName)||l.push(d.fileName),i(d)}};return p}var L=function(){return C(String.fromCharCode(112,97,116,104))},q=function(){return C(String.fromCharCode(102,115))};return J;})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-codes/browser-compilers",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Compilers that run in the browser, for use in livecodes.io",
5
5
  "author": "Hatem Hosny",
6
6
  "license": "MIT",
@@ -39,6 +39,8 @@
39
39
  "@testing-library/react": "14.0.0",
40
40
  "@tokencss/core": "0.1.0",
41
41
  "@tokencss/postcss": "0.0.5",
42
+ "@typescript/ata": "0.9.4",
43
+ "@typescript/vfs": "1.5.0",
42
44
  "@unocss/core": "0.53.1",
43
45
  "@unocss/preset-attributify": "0.53.1",
44
46
  "@unocss/preset-icons": "0.53.1",
@@ -103,7 +105,7 @@
103
105
  "postcss-cli": "8.3.1",
104
106
  "recursive-fs": "2.1.0",
105
107
  "standard-version": "9.3.0",
106
- "typescript": "4.4.3"
108
+ "typescript": "4.4.4"
107
109
  },
108
110
  "config": {
109
111
  "commitizen": {
@@ -500,3 +500,19 @@ esbuild.build({
500
500
  outfile: 'dist/bbob/bbob.js',
501
501
  globalName: 'BBob',
502
502
  });
503
+
504
+ // @typescript/ata
505
+ esbuild.build({
506
+ ...baseOptions,
507
+ entryPoints: ['vendor_modules/imports/typescript-ata.js'],
508
+ outfile: 'dist/typescript-ata/typescript-ata.js',
509
+ globalName: 'typescriptATA',
510
+ });
511
+
512
+ // @typescript/ata
513
+ esbuild.build({
514
+ ...baseOptions,
515
+ entryPoints: ['vendor_modules/imports/typescript-vfs.js'],
516
+ outfile: 'dist/typescript-vfs/typescript-vfs.js',
517
+ globalName: 'typescriptVFS',
518
+ });
@@ -0,0 +1 @@
1
+ export * from '@typescript/ata';
@@ -0,0 +1 @@
1
+ export * from '@typescript/vfs';