Repository navigation
feat(less5): dev browser bundle (dist/less-browser-dev.js) - #4516
Conversation
Add a single-file browser build of Less v5 (jess): a thin entry that drives @jesscss/compiler renderToResult with inline source and no filePath, so the Node config-discovery layer never runs. esbuild IIFE (global lessV5) bundles the pure-JS runtime parseman and aliases Node file/config built-ins (fs/module/url/cosmiconfig) to browser stubs; path -> path-browserify. Shipped as an OPT-IN dev artifact only, loaded by explicit path: - output is dist/less-browser-dev.js with a baked-in banner marking it an experimental browser build not intended for production; - package.json browser/unpkg/jsdelivr/module and the ./browser export condition are intentionally NOT set, so less@5's primary surface stays Node-only; - dist/less-browser-dev.js rides the existing "dist" files glob into the published tarball so a CDN can serve it by full path; - build:browser is wired into prepublishOnly so the publish flow builds it. Validated in-browser: compiles Less->CSS and surfaces parse errors.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
What
Ships a single-file browser build of Less v5 (jess) as
dist/less-browser-dev.js— an esbuild IIFE exposing globallessV5with.render/.renderString. A thin entry drives@jesscss/compilerrenderToResultwith inline source and nofilePath, so the Node config-discovery layer never runs; Node file/config built-ins (fs/module/url/cosmiconfig) are aliased to browser stubs,path→path-browserify.Not an advertised production feature
Per owner decision, this is an opt-in dev file loaded only by explicit path:
banner:js, survives minify) leads the file:package.jsonbrowser/unpkg/jsdelivr/moduleare intentionally not set, and there is no./browserexport condition.less@5's primary surface stays Node-only."dist"filesglob into the published tarball, so a CDN can serve it by full path.Publish flow builds it
build:browseris wired into thelesspackageprepublishOnly(typecheck && build && build:browser && test:lessc), so the publish path (bump-and-publish.js→npm publish→prepublishOnly) producesdist/less-browser-dev.jsbefore pack.Once an alpha publishes, the file is served at:
Verification
alpha@ jess@jesscss/core@2.0.0-alpha.15; rebuilt clean (2.70 MB).renderString(".a{ .b{color:red} }")compiles to nested CSS (v5collapseNesting:falsedefault); parse errors surface.dist/is gitignored; the artifact is produced atprepublishOnly, not committed.package.json/lockfile; the Node CLI path is unchanged.