-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: What is the entry point to parse a source string instead of files? #118
Comments
I had to do a some manual work locally in order to get it working with the current exported library bundle. I plan on changing this, and I'm currently in the process of a big refactoring so that will become possible. Here are the current shortcomings that I'm adressing:
I will keep you updated on my progress here. When it's ready, I will commit the code for my playground and I will document the API in the readme :-) |
Cool, your description was also understanding so I'm not too stupid :) I'm good with the typescript parser as I already have it loaded. I look forward to it 🤗 |
@georges-gomes It's now possible to run it in the browser using the beta npm publish of version 1.0.0 :-) The final release is not expected to change much from the beta version.
If you are interested in playing around with the API, here's a short example of how to use it: const format = "markdown"; // or "json"
const code = "...";
const { transformAnalyzerResult, analyzeText } = await import("web-component-analyzer");
const { results, program } = analyzeText(code);
// or
const { results, program } = analyzeText([
{ fileName: "file1.js", text: code },
{ fileName: "file2.js", text: "..." }, // these files can depend on each other
{ fileName: "file3.js", text: "...", analyze: false }
]);
// each result in "results" is the result of analyzing the corresponding text where "analyze" is not false
const output = transformAnalyzerResult(format, results, program); If you already have a TS source file you can analyze it using: analyzeSourceFile(sourceFile, { checker }) Please don't hesitate to reach out to me with any questions or requests 👍 |
Version |
Like what you did in the playground?
I would like to integrate in-browser parsing into webcomponents.dev
Thanks!
The text was updated successfully, but these errors were encountered: