-
Notifications
You must be signed in to change notification settings - Fork 1
Update index.ts #1
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -18,16 +18,17 @@ | |||||
| let buffer = ""; | ||||||
| let insideExpression = false; | ||||||
| let insideString = false; | ||||||
| let braceCount = 0; | ||||||
| let braceCount = 0 | ||||||
|
|
||||||
| for (let i = 0; i < input.length; i++) { | ||||||
|
|
||||||
|
|
||||||
| for (let i = 0; i < input.length; i++) { | ||||||
| if (!insideExpression) { | ||||||
| if (input[i] === "$" && input[i + 1] === "{") { | ||||||
| strings.push(buffer); | ||||||
| buffer = ""; | ||||||
| insideExpression = true; | ||||||
| braceCount = 1; | ||||||
| i++; // Skip "{" | ||||||
| } else if (input[i] === "\\" && input[i + 1] === "$" && input[i + 2] === "{") { | ||||||
| buffer += "${"; | ||||||
| i += 2; | ||||||
|
|
@@ -101,7 +102,7 @@ | |||||
| const ts = await import('typescript') | ||||||
| const { outputText } = ts.transpileModule(scriptValue, { | ||||||
| compilerOptions: { | ||||||
| experimentalDecorators: true, | ||||||
| experimentalDecorators: false, | ||||||
| module: ts.ModuleKind.ESNext, | ||||||
| target: ts.ScriptTarget.ESNext, | ||||||
| moduleResolution: ts.ModuleResolutionKind.NodeJs, | ||||||
|
|
@@ -133,23 +134,24 @@ | |||||
|
|
||||||
| const [strings, values] = parseTemplateString(other) | ||||||
| const second = templateStringParse(new TemplateParser(), strings as any, ...values).parse(); | ||||||
|
|
||||||
| console.count() | ||||||
| return `${extractedImports}${hasHtmlImport ? '' : "\nimport { pulsInstance } from 'pulsjs';"}\n\nexport default ($props = {}) => { | ||||||
| \n ${scriptTag}\n \n return (new pulsInstance.adapter(${exportOutput(second)})).render(); | ||||||
| }`; | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
| export async function pulsPlugin() { | ||||||
| console.log('Example') | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Remove debug statement. Debug statements like - console.log('Example')📝 Committable suggestion
Suggested change
|
||||||
| return { | ||||||
| name: 'vite-plugin-puls', | ||||||
| transform: async (code: any, id: any) => { | ||||||
| transform: async x(code: any, id: any) => { | ||||||
|
Check failure on line 148 in packages/puls-compiler/index.ts
|
||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix syntax error in transform function signature. The current function signature is invalid and causing build failures. The - transform: async x(code: any, id: any) => {
+ transform: async (code: any, id: any) => {📝 Committable suggestion
Suggested change
🧰 Tools🪛 Biome (1.9.4)[error] 148-148: expected Remove x (parse) [error] 148-148: Expected a function body but instead found '=>'. Expected a function body here. (parse) 🪛 GitHub Check: build (20)[failure] 148-148: [failure] 148-148: [failure] 148-148: [failure] 148-148: 🪛 GitHub Actions: Test the build process[error] 148-148: error TS1005: ',' expected. |
||||||
| if (!id.endsWith('.puls')) return null; | ||||||
| fs.writeFileSync('ex', code) | ||||||
|
|
||||||
| return { | ||||||
| code: await compile(code), | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Remove debug statement.
Debug statements like
console.count()should not be committed to production code.- console.count()📝 Committable suggestion