18 Commits

Author SHA1 Message Date
Matthew Dean
6cafcc0466 fix: webpack browser build - use UMD dist/less.js, add CJS bundle (#4424)
* fix: webpack browser build - use UMD dist/less.js, add CJS bundle (#4423)

- Browser exports point to dist/less.js (UMD) instead of less-node
- Add CJS bundle (dist/less-node.cjs) for Node require() with module shim
- Remove dead index.js; index.cjs re-exports CJS bundle
- Add export tests: import-patterns, webpack-browser, test-cjs-suite
- CI and publish workflows run test:node (build + CJS + ESM tests)

* Beta publish script

* chore: clarify test:node runs ESM + CJS in workflow labels

* fix: normalize path separators in rollup plugin for Windows CI

The inlinePackageVersion plugin used forward-slash path check that
failed on Windows where rollup passes backslash-separated IDs,
leaving the require('../../package.json') unresolved at runtime.

* chore: bump version to 4.6.3 for release
2026-03-11 11:11:04 -07:00
Matthew Dean
290900a1f2 fix: CJS compatibility, enriched npm README, ESM tests (#4417)
* docs: enrich npm README with usage examples and feature highlights

version: 4.6.0

* fix: update README and tests to show ESM + promise/await usage

The package is ESM-only ("type": "module"), so the README now correctly
shows `import less from 'less'` with `await` instead of CJS `require()`.
The ES6 test now verifies both promise/await and callback APIs.

version: 4.6.0

* fix: add CJS compatibility wrapper so require('less') works

Adds index.cjs as a one-line wrapper that re-exports the ESM default.
The exports field now has both import and require conditions.
Adds test-cjs.cjs to verify CJS consumption alongside the existing
ESM test.

version: 4.6.0

* fix: lazy Proxy CJS wrapper for Node 18+ compatibility

Node 22+ uses native require(esm). Node 18-20 uses a lazy Proxy with
dynamic import() — transparent because render()/parse() already return
promises. Tested with render, callback, and version property access.

* fix: include Node 20.19+ in native require(esm) path

* fix: add alt text to README images for accessibility
2026-03-10 12:52:08 -07:00
Matthew Dean
c21e465d58 feat: migrate to native ESM with no build step (#4411)
* feat: migrate to native ESM with no build step

- Rename src/ to lib/ — source files are shipped directly, no compilation
- Add "type": "module" to package.json for native ESM support (Node 18+)
- Convert bin/lessc, test files, and build scripts from CJS to ESM
- Rename Gruntfile.js and .eslintrc.js to .cjs (must remain CommonJS)
- Add .js extensions to all relative import paths for ESM resolution
- Use createRequire() for optional dependency resolution (npm packages, JSON)
- Configure TypeScript for check-only mode (noEmit: true, allowJs: true)
- Update Rollup config to read from lib/ directly
- Update CI matrix to drop Node 16 (minimum Node 18+)
- Browser build is smaller: 500KB (was 509KB), minified 153KB (was 158KB)
- All 139 tests pass

* chore: fix trailing semicolons from linter

* chore: gitignore generated .css.map files in lib/

* fix(ci): restore lts/-3 to test matrix

* chore: stop tracking dist/ build artifacts

Generated browser bundles don't need to be in source control — they're
built during publish and included in the npm package via the files field.
Removes duplicate copies from both root dist/ and packages/less/dist/.

* fix(ci): use pnpm exec for playwright install

npx doesn't reliably find binaries with pnpm. Since playwright is
already a devDependency, use pnpm exec to run the installed version.

* fix(ci): use pnpm --filter for playwright, disable fail-fast

pnpm exec at workspace root can't find playwright binary since it's a
devDependency of the less package. Use --filter to run in that context.
Also disable fail-fast so all matrix jobs complete independently.

* fix(ci): move playwright to root devDependencies

Makes pnpm exec playwright work from workspace root in CI.

* fix: upgrade copy-anything to v3 for ESM compat, fix Windows test paths

copy-anything v2 lacks "type": "module", causing named import failures
on Node 18. v3 has proper ESM exports.

Revert testFolder to absolute path (matching original behavior) so debug
test path replacements match Less compiler output on Windows.

* chore: add CodeRabbit config to raise file review limit

* fix: add files field to package.json, remove postinstall from published package

Restricts npm package to only bin/, lib/, dist/, index.js, and README.md.
Previously shipped test files, Gruntfile, eslint config, etc.
Removes postinstall script (Playwright browser install) which only applies
in the monorepo dev environment and fails when installed from npm.

Verified: npm pack --dry-run shows 120 files (was 229), lessc CLI and
API both work from a clean tarball install.
2026-03-09 16:55:44 -07:00
Matthew Dean
432286970a [Needs reviews!] Mega test refactor (#4378)
* Migrate Less to use valid CSS

* Re-organize test structure

* Lots of test refactoring

* More test updates

* Add restructured tests

* WIP

Signed-off-by: Matthew Dean <matthew-dean@users.noreply.github.com>

* More fixes to tests

* More test fixes

* All tests passing

* WIP fix tests

* Finished fixing browser tests

* Improve test coverage

* Add debug tests

* Add back debug tests to show equal test coverage

* Fix browser tests

* More test coverage

* Fix sourcemap absolute path for CI

* More source map normalization for Windows

* Fix source map normalization

* Another attempted fix for Windows

---------

Signed-off-by: Matthew Dean <matthew-dean@users.noreply.github.com>
2025-12-06 11:28:46 -08:00
Matthew Dean
d1abdabcc2 feat: deprecation warnings for Less + monorepo chores (#4319)
* Added deprecation warnings

* Remove warning about combinator

* Switch to PNPM

* Update local dependencies

* Remove inner dist folder

* Create symbolic link to dist folder

* Flip dist folders

* Create symbolic link in root

* Add contributors

* 👥 Add @matthew-dean as a contributor

* 👥 Add @cloudhead as a contributor

* 👥 Add @lukeapage as a contributor

* 👥 Add @seven-phases-max as a contributor

* 👥 Add @iChenLei as a contributor

* 👥 Add @puckowski as a contributor

* Add more contributors

* Finish deprecation warnings

* Resolve deletions and such

* Fix symbolic link

* Update ci.yml to use PNPM

* Update ci.yml to use PNPM

* Refine CI versions

* Fix node printed version

* Better fix for #4258 and #4292

* Re-enable other tests
2025-03-01 11:23:48 -08:00
Lei Chen
c2053cbca2 ci: enhance our test environment setup (#4291)
* fix: pptr timeout issue

* fix: try again

* chore: fix pptr timeout issue

* fix: test scripts

* chore: drop node 10/12/14

* fix: node 23 deprecated api

* chore: tru again

* fix: windows

* fix: windows is

* chore: test node14

* fix: drop node v10/v12/v14 support

* chore: remove sandbox config

* fix: add sandbox config

* ci: try playwright

* chore: update ci yml

* chore: test node

* chore: add all test

* fix: yml grammer

* chore: try topo

* chore: node23 test

* chore: nodejs v23

* fix: yml grammer

* fix: steps's id

* chore: final test config

* chore: update folder name

* chore: refactor

* chore: update title

* chore: improve code quality
2025-01-07 22:14:43 +08:00
Lei Chen
13864a6b5c ci: windows (#4213)
* chore: try run scripts directly

* chore: only trigger windows ci

* chore: remove resolve-bin

* fix: windows ci

* fix: windows path

* chore: try path

* chore: print gen

* chore: remove linux test

* chore: debug windows path

* chore: compare unix system

* chore: try change path

* chore: noramlize path

* chore: switch windows

* fix: bug

* chore: windows ci

* chore: up timeout

* chore: up timeout

* chore: match more tests

* chore: clean code

* use path.posix.normalize

* ci: debug path

* chore: test utils

* chore: update logic

* chore: reduce diff content
2023-09-15 07:27:20 +08:00
Matthew Dean
6390ae3406 Release/v4.2.0 (#3814) 2023-08-19 14:31:21 -07:00
Matthew Dean
4d3189c051 Fixes #3787 -- ESLint updates and linting cleanup (#3790)
* ESLint updates and linting cleanup

* Exclude test files from some linting rules for now

* Fix some TypeScript and build issues
2023-04-08 09:27:41 -07:00
Peter Goldberg
2702322553 fix faulty source map generation with variables in selectors (#3761)
* fix faulty source map generation

* alternative solution

* add test
2023-04-02 14:08:28 -07:00
Robert Kieffer
7491578403 feat: add disablePluginRule flag for render() options (#3701)
Co-authored-by: Edward Hartwell Goose <edhgoose@users.noreply.github.com>
2022-05-04 07:09:07 -07:00
Lei Chen
a10c3399d3 chore: fix less project ci (#3652)
* chore: fix less ci

* fix: add missing semver require

* fix: fix the error format and file path

* chore: fix error format

* chore: fix test snapshot

* chore: fix error position
2021-10-06 15:58:01 -07:00
zaquest
ec74875864 Fix #3576 import redirects. Replace native-request with needle. (#3582)
* Fix #3576 import redirects. Replace native-request with needle.

* Downgrade nock to support node 8
2021-01-02 20:02:20 -08:00
Matthew Dean
dc3a310530 v4.0.0 (#3573)
* Remove math=strict-legacy, set default=parens-division
* Support for comma-less color functions
* Require parens after mixin call
* Output invalid JS functions in CSS
* Escape parens and revert pass-through function errors
* Remove ieCompat option
* Remove non-performant class pattern
* Add isdefined() function
2020-12-18 10:03:08 -08:00
Matthew Dean
b93a0857c5 Fixes #3533 (#3544)
* Fixes #3533
2020-07-16 07:31:48 -07:00
Matthew Dean
0925cf1957 Test-data module (#3525)
* Move test data to separate module - @todo--fix some browser tests
* Fix all browser tests
2020-06-25 15:54:59 -07:00
Matthew Dean
51fb02b844 Fixes #3504 / organizes tests (#3523)
* Fixes #3504 / organizes tests
2020-06-22 09:25:12 -07:00
Matthew Dean
2c5e4dd9b9 Lerna refactor / TS compiling w/o bundling (#3521)
* Lerna refactor / TS compiling w/o bundling
* Adds package-lock.json
2020-06-22 05:41:38 -07:00