@tscircuit/eval 0.0.499 → 0.0.500
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.
- package/dist/blob-url.js +1 -1
- package/dist/eval/index.js +21 -1
- package/dist/lib/index.js +21 -1
- package/dist/webworker/entrypoint.js +1 -1
- package/package.json +1 -1
|
@@ -456,7 +456,7 @@ ${u.join(" -> ")}`)}if(!e.fsMap[a])throw yy("fsPath not found in fsMap:",a),new
|
|
|
456
456
|
|
|
457
457
|
${e.logger.stringifyLogs()}`);return{content:await d.text(),error:null}}).catch(d=>({error:d,content:null}));if(a)throw console.error("Error fetching npm import",n,a),a;let c=dXt(s),l=$s(c),u=H1(o);for(let d of u)i[d]||await qp(d,e,t+1,{cwd:l});let p=N0(o,c||n);try{let d=Rd(p,i,l).exports;i[n]=d,i[c]=d,i[s]=d}catch(d){throw new Error(`Eval npm package error for "${n}": ${d.message}
|
|
458
458
|
|
|
459
|
-
${e.logger.stringifyLogs()}`)}}var Vlt=Gt(En(),1),Ult=(0,Vlt.default)("tsci:eval:import-eval-path");async function qp(n,e,t=0,i={}){Ult("importEvalPath called with:",{importName:n,depth:t,opts:i}),e.logger.info(`importEvalPath("${n}", {cwd: "${i.cwd}", depth: ${t}})`),Ult(`${" ".repeat(t)}\u27A1\uFE0F`,n);let{preSuppliedImports:r}=e,s=e.disableCdnLoading||globalThis.__DISABLE_CDN_LOADING__;if(r[n]){e.logger.info(`Import "${n}" in preSuppliedImports[1]`);return}if(n.startsWith("./")&&r[n.slice(2)]){e.logger.info(`Import "${n}" in preSuppliedImports[2]`);return}if(t>30)throw new Error(`Max depth for imports reached (30) Import Path: ${e.importStack.join(" -> ")}`);if(n.startsWith("/npm/")){let p=n.replace(/^\/npm\//,"").replace(/\/\+esm$/,"");if(s)throw new Error(`Cannot find module "${p}". The package is not available in the local environment.
|
|
459
|
+
${e.logger.stringifyLogs()}`)}}var Vlt=Gt(En(),1),Ult=(0,Vlt.default)("tsci:eval:import-eval-path");async function qp(n,e,t=0,i={}){Ult("importEvalPath called with:",{importName:n,depth:t,opts:i}),e.logger.info(`importEvalPath("${n}", {cwd: "${i.cwd}", depth: ${t}})`),Ult(`${" ".repeat(t)}\u27A1\uFE0F`,n);let{preSuppliedImports:r}=e,s=e.disableCdnLoading||globalThis.__DISABLE_CDN_LOADING__;if(r[n]){e.logger.info(`Import "${n}" in preSuppliedImports[1]`);return}if(n.startsWith("./")&&r[n.slice(2)]){e.logger.info(`Import "${n}" in preSuppliedImports[2]`);return}if(n.includes("/")&&!n.startsWith(".")&&!n.startsWith("/")){let p=n.split("/")[0],d=p.startsWith("@"),_=d?n.split("/").slice(0,2).join("/"):p,g=d?n.split("/").slice(2).join("/"):n.split("/").slice(1).join("/");if(r[_])try{let x=await import(`${_}/${g}`);r[n]=x,e.logger.info(`Import "${n}" resolved from preSuppliedImports base package "${_}"`);return}catch{e.logger.info(`Failed to resolve "${n}" from preSuppliedImports package "${_}", falling back to normal resolution`)}}if(t>30)throw new Error(`Max depth for imports reached (30) Import Path: ${e.importStack.join(" -> ")}`);if(n.startsWith("/npm/")){let p=n.replace(/^\/npm\//,"").replace(/\/\+esm$/,"");if(s)throw new Error(`Cannot find module "${p}". The package is not available in the local environment.
|
|
460
460
|
|
|
461
461
|
${e.logger.stringifyLogs()}`);e.logger.info(`importNpmPackage("${p}")`),await E7(p,e,t);let d=r[p];d&&(r[n]=d);return}let o=".",a=e.tsConfig;if(e.tsConfig&&i.cwd){let p=i.cwd.match(/^(node_modules\/[^\/]+)/);p&&(o=p[1],a=null)}let c=G1(n,e.fsMap,i.cwd,{tsConfig:a,tsconfigDir:o});if(c){e.logger.info(`importLocalFile("${c}")`),await D0(c,e,t),n!==c&&(r[n]=r[c]);return}let l=e.tsConfig??V1(e.fsMap);if(!e.tsConfig&&l&&(e.tsConfig=l),qit(n,l))throw new Error(`Import "${n}" matches a tsconfig path alias but could not be resolved to an existing file${i.cwd?` from directory "${i.cwd}"`:""}
|
|
462
462
|
|