Closed jantimon closed 4 weeks ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
next-yak-benchmark | ❌ Failed (Inspect) | Jul 16, 2024 6:32pm | ||
yacijs | ❌ Failed (Inspect) | Jul 16, 2024 6:32pm |
The project has transitioned from using a Babel plugin to a Rust-based SWC plugin, enhancing performance and control over variable scopes and template literals. This update includes the introduction of new dependencies and configurations, the addition of CSS-in-JS parsing capabilities, and a restructuring of the yak-swc
package to include Rust-based transformation logic and testing.
Files/Groups | Summaries |
---|---|
.gitignore | Updated to include target directory while excluding playground/dist . |
packages/yak-swc/.gitignore | Added to ignore target directory and its contents. |
packages/yak-swc/Cargo.toml | Updated with workspace configuration, release profile optimizations, and new dependencies like lazy_static , serde , swc_core , and more. |
packages/yak-swc/css_in_js_parser/CHANGELOG.md | Introduced, documenting the release history of the CSS-in-JS parser. |
packages/yak-swc/css_in_js_parser/Cargo.toml | Updated to include dependencies like serde , serde_json , and insta . |
packages/yak-swc/css_in_js_parser/LICENSE | New file containing MIT License text by Jan Nicklas. |
packages/yak-swc/css_in_js_parser/README.md | Introduced, explaining the CSS-in-JS parser's functionality, including parsing, state maintenance, and CSS regeneration. |
packages/yak-swc/css_in_js_parser/examples/basic_usage.rs | Demonstrates basic usage of the css_in_js_parser library to parse and regenerate CSS. |
packages/yak-swc/css_in_js_parser/examples/resume_state.rs | Demonstrates resuming CSS parsing from a previous state using css_in_js_parser . |
packages/yak-swc/css_in_js_parser/src/lib.rs | Introduced modules for parsing CSS and converting it back, with public re-exports. |
packages/yak-swc/css_in_js_parser/src/to_css.rs | Includes functions to convert CSS declarations to strings, handle scopes, and merge CSS chunks. |
packages/yak-swc/yak_swc/.cargo/config | Introduces command aliases for building plugin binaries for specific targets. |
packages/yak-swc/yak_swc/package.json | Updated to version 0.1.0 with a new SWC plugin for next-yak , including build scripts and dependencies. |
packages/yak-swc/rustfmt.toml | Introduces configurations for max_width set to 100 and tab_spaces set to 2. |
packages/yak-swc/yak_swc/src/lib.rs | Introduces logic for transforming CSS-in-JS expressions using SWC Rust, including a TransformVisitor struct and various methods for handling parsing and transformation. |
packages/yak-swc/yak_swc/src/utils/ast_helper.rs | Introduces functions and structs for manipulating AST nodes and handling template literals. |
packages/yak-swc/yak_swc/src/utils/wrap_return_value.rs | Introduces functions to manipulate expressions by adding suffixes. |
packages/yak-swc/yak_swc/src/yak_imports.rs | Introduces a YakImportVisitor struct to gather and manipulate imports from the "next-yak" library. |
packages/yak-swc/yak_swc/tests/fixture/.../output.tsx | Introduces styled components and demonstrates the use of CSS-in-JS with dynamic theming and cross-file imports. |
Objective (Issues) | Addressed | Explanation |
---|---|---|
Transition from Babel to SWC Rust WASM (#110) | ✅ | |
Testing injected comments and handling template literals better (#110) | ❓ | The new implementation introduces better control over template literals, but specific testing for injected comments isn't explicitly mentioned. |
Supporting .yak with SWC (#110) |
❓ | The current changes do not explicitly mention .yak file support, requiring further validation to confirm if this support is included. |
packages/next-yak/loaders/lib/resolveCrossFileSelectors.ts
[error] 10-10: Don't use '{}' as a type. Prefer explicitly define the object shape. '{}' means "any non-nullable value". (lint/complexity/noBannedTypes)
.github/workflows/example.yml (1)
`1-64`: **Comprehensive Review of GitHub Actions Workflow** 1. **Environment Variables Security**: The use of secrets for `VERCEL_PROJECT_ID`, `VERCEL_ORG_ID`, and `VERCEL_TOKEN` is appropriate as it keeps sensitive information secure. 2. **Rust and WASM Setup**: The steps to install Rust and add the `wasm32-wasi` target are correctly configured. This is crucial for compiling Rust to WebAssembly which is needed for the SWC plugin. 3. **Node.js and pnpm Setup**: Using `actions/setup-node` with caching enabled and `pnpm` for package management are best practices that help speed up the build process. 4. **Vercel CLI Installation**: Installing Vercel CLI globally might not be the best practice. Consider using a local installation or a Docker container to isolate the environment. 5. **Caching Strategy**: The use of `Swatinem/rust-cache` for caching Rust dependencies is a good practice. However, ensure that the `workspaces` path is correctly specified and relevant to the project structure. 6. **Error Handling**: There is no explicit error handling for failed steps. Consider adding `fail-fast: false` to the job and appropriate error handling steps. 7. **Deployment**: The deployment steps using Vercel are clear. However, ensure that the `--prebuilt` flag is correctly used as per Vercel's deployment strategies. Overall, the workflow is well-structured but could benefit from minor improvements in error handling and dependency management practices.packages/next-yak/loaders/lib/resolveCrossFileSelectors.ts (3)
`8-15`: **Updated Regex Pattern and Error Handling** The updated regex pattern for CSS imports (`moduleSelectorRegex`) is now more specific, which should improve the accuracy of matching relevant CSS files. However, ensure that the regex pattern is thoroughly tested to match all intended cases without false positives. The error handling in line 15 is robust, providing clear error messages for invalid module selectors. This is crucial for debugging and maintaining the code.--- `279-286`: **Handling of Template Literals: Simplified and Effective** The handling of template literals has been simplified to directly initialize constants when the template has only one quasi. This is a clean and efficient approach. --- `336-340`: **Enhanced Template Literal Support in Object Expressions: Approved** The support for template literals in object expressions has been enhanced, allowing for more dynamic handling of values. This is a beneficial change for flexibility.Tools
Biome
[error] 10-10: Don't use '{}' as a type. Prefer explicitly define the object shape. '{}' means "any non-nullable value". (lint/complexity/noBannedTypes)
Comparing feature/rust
(bfa4cf6) with main
(05d4782)
✅ 2
untouched benchmarks
fixes #110
Summary by CodeRabbit
New Features
next-yak
with enhanced transformation logic for CSS-in-JS expressions.Documentation
LICENSE
file with the MIT License.README.md
for the CSS-in-JS parser.CHANGELOG.md
documenting release history.Style
rustfmt.toml
for consistent code formatting.Tests
Chores
.gitignore
andCargo.toml
for workspace configuration and dependencies.