diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 0000000000..f0a3255581 --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,2 @@ +reviews: + max_files: 500 diff --git a/.github/TESTING_PUBLISHING.md b/.github/TESTING_PUBLISHING.md index f82e6458c3..70944d656b 100644 --- a/.github/TESTING_PUBLISHING.md +++ b/.github/TESTING_PUBLISHING.md @@ -32,7 +32,7 @@ Dry-run mode will: # Check current version node -p "require('./packages/less/package.json').version" -# Run dry-run to see what version would be created +# Run dry-run to see what version would be published DRY_RUN=true pnpm run publish ``` @@ -55,9 +55,9 @@ git checkout alpha DRY_RUN=true GITHUB_REF_NAME=alpha pnpm run publish # This will show: -# - Version validation (must contain -alpha.) -# - Master sync check -# - Version comparison with master +# - The committed alpha version +# - Alpha branch validation +# - A dry-run publish plan without npm mutation ``` ### 4. Test Version Override @@ -127,12 +127,25 @@ git checkout alpha DRY_RUN=true GITHUB_REF_NAME=alpha pnpm run publish # Should show: -# - Alpha version increment (e.g., 5.0.0-alpha.1 → 5.0.0-alpha.2) +# - The committed alpha version (for example 5.0.0-alpha.1) # - Publishing with 'alpha' tag # - Pre-release creation -# - All alpha validations passing +# - A release plan only; it does not prove the prerequisite Jess alpha has +# been published or that the worktree is clean ``` +### Test Less 5 Alpha Readiness + +```bash +pnpm run test:alpha +``` + +This is the Less 5 alpha release gate. It checks the supported alpha contract +and prints the unsupported alpha.1 inventory. The broad legacy corpus remains +available through `pnpm --dir packages/less run test:legacy-node`, but it is +not expected to be green yet and is intentionally not the alpha.1 publish gate +until the unsupported buckets are drained. + ### Test Version Validation ```bash @@ -147,7 +160,9 @@ DRY_RUN=true GITHUB_REF_NAME=alpha pnpm run publish Before actually publishing: -- [ ] Run dry-run mode to verify version calculation +- [ ] Prepare, commit, and push the exact alpha version before publishing +- [ ] Run `pnpm run test:alpha` to verify the supported Less 5 alpha contract +- [ ] Run dry-run mode to verify the release plan (not release readiness) - [ ] Verify branch restrictions work (try from wrong branch) - [ ] Test alpha validations (if testing alpha branch) - [ ] Check that version override works (if needed) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 631e2ad48f..6922b7f133 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,12 +22,10 @@ jobs: node: 'lts/*' - os: ubuntu-latest node: 'lts/-1' - - os: ubuntu-latest - node: 'lts/-2' - - os: ubuntu-latest - node: 'lts/-3' - - runs-on: ${{ matrix.os }} + - os: ubuntu-latest + node: 'lts/-2' + + runs-on: ${{ matrix.os }} # This has copy/paste steps and should be refactored using DRY steps: - uses: actions/checkout@v4 @@ -35,20 +33,22 @@ jobs: uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node }} - cache: 'pnpm' - - name: Install dependencies - run: pnpm install --frozen-lockfile --ignore-scripts - - name: Print put node & npm version - run: node --version && pnpm --version - - name: Run node tests (ESM + CJS) + node-version: ${{ matrix.node }} + cache: 'pnpm' + - name: Install dependencies + run: pnpm install --frozen-lockfile --ignore-scripts + - name: Print put node & npm version + run: node --version && pnpm --version + - name: Run Less v5 alpha support contract + run: pnpm run test:alpha + - name: Run Less v5 Node module smoke tests run: pnpm run test:node - name: Run release automation tests if: matrix.os == 'ubuntu-latest' && matrix.node == 'lts/*' run: pnpm run test:release copilot-review: - name: Request Copilot review + name: Request Copilot review runs-on: ubuntu-latest continue-on-error: true if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened') @@ -61,7 +61,7 @@ jobs: run: | gh api \ --method POST \ - -H "Accept: application/vnd.github+json" \ - /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \ - -f "reviewers[]=copilot-pull-request-reviewer" \ - || echo "::warning::Could not request Copilot review (the token may lack pull-requests: write access, or Copilot PR reviews may not be enabled for this repository)" + -H "Accept: application/vnd.github+json" \ + /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \ + -f "reviewers[]=copilot-pull-request-reviewer" \ + || echo "::warning::Could not request Copilot review (the token may lack pull-requests: write access, or Copilot PR reviews may not be enabled for this repository)" diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml index 232a0e8527..5f288842d7 100644 --- a/.github/workflows/create-release-pr.yml +++ b/.github/workflows/create-release-pr.yml @@ -65,9 +65,9 @@ jobs: CURRENT=$(node -p "require('./packages/less/package.json').version") if [ "$BRANCH" = "alpha" ]; then - NPM_VERSION=$(npm view less dist-tags.alpha) + NPM_VERSION=$(npm view less dist-tags.alpha 2>/dev/null || echo "") else - NPM_VERSION=$(npm view less version) + NPM_VERSION=$(npm view less version 2>/dev/null || echo "") fi DEFAULT_NEXT=$(node scripts/release-metadata.js next-version "$BRANCH" "$CURRENT" "$NPM_VERSION") @@ -83,6 +83,11 @@ jobs: if [ -n "$EXISTING_TITLE" ]; then NEXT=$(node scripts/release-metadata.js parse-title "$BRANCH" "$EXISTING_TITLE") RELEASE_BRANCH="$EXISTING_BRANCH" + if ! node scripts/release-metadata.js validate "$BRANCH" "$NEXT" "$NPM_VERSION" 2>/dev/null; then + echo "Existing release PR title v${NEXT} is no longer publishable; falling back to v${DEFAULT_NEXT}" + NEXT="$DEFAULT_NEXT" + RELEASE_BRANCH=$(node scripts/release-metadata.js branch "$BRANCH" "$NEXT") + fi else NEXT="$DEFAULT_NEXT" RELEASE_BRANCH=$(node scripts/release-metadata.js branch "$BRANCH" "$NEXT") @@ -121,7 +126,7 @@ jobs: git checkout -b "${RELEASE_BRANCH}" fi - node scripts/release-metadata.js sync-package-versions "${NEXT_VERSION}" + node scripts/release-metadata.js sync-package-versions "${RELEASE_BASE}" "${NEXT_VERSION}" git add package.json packages/*/package.json @@ -136,7 +141,7 @@ jobs: --json number,title,author \ --jq '.[] | "- [#\(.number)](https://github.com/${{ github.repository }}/pull/\(.number)) \(.title) (@\(.author.login))"' \ 2>/dev/null || echo "") - if [ -n "$PR_LINES" ]; then + if [ -n "$PR_LINES" ] && ! grep -q "^### v${NEXT_VERSION}\\b" CHANGELOG.md; then TODAY=$(date +%Y-%m-%d) { head -1 CHANGELOG.md @@ -150,30 +155,16 @@ jobs: tail -n +2 CHANGELOG.md } > CHANGELOG.tmp && mv CHANGELOG.tmp CHANGELOG.md git add CHANGELOG.md + elif grep -q "^### v${NEXT_VERSION}\\b" CHANGELOG.md; then + echo "CHANGELOG.md already has a v${NEXT_VERSION} section; keeping the curated release notes." fi fi - COMMITTED=false if git diff --cached --quiet; then - echo "No version changes; branch is already at v${NEXT_VERSION}" + echo "No manifest changes; creating an explicit release commit for v${NEXT_VERSION}" + git commit --allow-empty -m "${TITLE}" else git commit -m "${TITLE}" - COMMITTED=true - fi - - # If no new commit was created the release branch has no commits - # ahead of master, so pushing it and trying to open a PR would fail - # with "no commits between head and base". Instead, just report - # whether an existing release PR is open and exit cleanly. - if [ "$COMMITTED" = "false" ]; then - EXISTING=$(gh pr list --head "${RELEASE_BRANCH}" --base "${RELEASE_BASE}" \ - --json number --jq '.[0].number' 2>/dev/null || echo "") - if [ -n "${EXISTING}" ]; then - echo "✅ No new changes; release PR #${EXISTING} already exists" - else - echo "✅ No version bump needed and no existing release PR; nothing to do" - fi - exit 0 fi # --force-with-lease refuses to overwrite if the remote has advanced @@ -264,9 +255,9 @@ jobs: PREVIOUS_VERSION=$(node -p "require('./packages/less/package.json').version") VERSION=$(node .release-scripts/release-metadata.js parse-title "$RELEASE_BASE" "$RELEASE_TITLE") if [ "$RELEASE_BASE" = "alpha" ]; then - NPM_VERSION=$(npm view less dist-tags.alpha) + NPM_VERSION=$(npm view less dist-tags.alpha 2>/dev/null || echo "") else - NPM_VERSION=$(npm view less version) + NPM_VERSION=$(npm view less version 2>/dev/null || echo "") fi node .release-scripts/release-metadata.js validate-title-sync "$RELEASE_BASE" "$VERSION" "$PREVIOUS_VERSION" "$NPM_VERSION" TITLE=$(node .release-scripts/release-metadata.js title "$RELEASE_BASE" "$VERSION") diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 13fabda24e..c2f944dedc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -81,8 +81,8 @@ jobs: node scripts/release-metadata.js validate "$RELEASE_BASE" "$TITLE_VERSION" "$NPM_VERSION" echo "✅ Release title, package.json, and npm version checks agree on v${TITLE_VERSION}" - - name: Run node tests (ESM + CJS) - run: pnpm run test:node + - name: Run Less v5 alpha support contract + run: pnpm run test:alpha - name: Build run: | @@ -202,7 +202,15 @@ jobs: PRERELEASE="--prerelease" BODY="## Alpha Release - This is an alpha release from the alpha branch. + This Less 5 alpha is a Jess-powered compiler rewrite for early testing, not a drop-in Less 4.x replacement yet. + + Highlights: + - CSS nesting is preserved by default. + - Less-style ampersand joining for BEM-style modifiers and similar selector patterns is still supported. + - Nested and extended selector output may use modern selectors such as :is(); selector compatibility remains part of the alpha feedback surface. + - Browser compilation is not included in this alpha; a new browser build mechanism will be introduced in a future alpha. + + See CHANGELOG.md for the current supported surface and work-in-progress areas. ## Installation @@ -229,14 +237,26 @@ jobs: \`\`\`" fi + ASSETS=() + if [ "$IS_ALPHA" != "true" ]; then + for asset in packages/less/dist/less.js packages/less/dist/less.min.js; do + if [ -f "$asset" ]; then + ASSETS+=("$asset") + fi + done + else + echo "Alpha release has no browser build assets; browser compilation will return through a future build mechanism." + fi + if gh release view "$TAG" &>/dev/null; then - echo "Release $TAG already exists, uploading assets to existing release" - gh release upload "$TAG" packages/less/dist/less.js packages/less/dist/less.min.js --clobber + echo "Release $TAG already exists" + if [ "${#ASSETS[@]}" -gt 0 ]; then + gh release upload "$TAG" "${ASSETS[@]}" --clobber + fi else gh release create "$TAG" \ --title "$TITLE" \ $PRERELEASE \ --notes "$BODY" \ - packages/less/dist/less.js \ - packages/less/dist/less.min.js + "${ASSETS[@]}" fi diff --git a/.gitignore b/.gitignore index bb333eee60..46aa21b592 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,9 @@ npm-debug.log .nyc_output coverage *.lcov + +# Build output +dist + +# Claude Code +.claude/ diff --git a/.husky/post-merge b/.husky/post-merge index 71f1b6be06..6eb5eb86f0 100755 --- a/.husky/post-merge +++ b/.husky/post-merge @@ -3,3 +3,7 @@ # Post-merge hook to preserve alpha versions when merging master into alpha node scripts/post-merge-version-fix.js + + + + diff --git a/.husky/pre-commit b/.husky/pre-commit index 98475b507b..318b1af83a 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1,9 @@ +branch="$(git branch --show-current)" + +if [ "$branch" = "alpha" ]; then + echo "Skipping pre-commit verification on alpha branch" + exit 0 +fi + +cd packages/less && npm run typecheck && cd ../.. pnpm test diff --git a/CHANGELOG.md b/CHANGELOG.md index 70ff2d9c02..f468745647 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,90 @@ ## Change Log +### v5.0.0-alpha.1 (unreleased) + +This is the first public alpha for Less 5, a major rewrite of the Less compiler +on top of [Jess](https://github.com/jesscss/jess). Jess is a new CSS-family +compiler engine that Less now uses for parsing, evaluation, rendering, imports, +and the `lessc` command. + +This alpha is meant for early testing of the new compiler path. It is not yet a +drop-in replacement for Less 4.x. + +#### Highlights + +- Introduces the Jess-powered Less compiler and CLI through the existing + `less` package. +- Keeps `lessc` owned by Less. The separate `jess` package has its own CLI and + no longer installs a competing `lessc` binary. +- Preserves authored CSS nesting by default. Use `collapseNesting: true` or + `lessc --collapse-nesting` to emit flattened selector output. +- Still supports Less-style ampersand joining for BEM-style modifiers and + similar selector patterns, such as `.block { &__item { ... } }`. +- Preserves cascade order when nested rules are collapsed, so declarations + after a nested child remain after that child in the generated CSS. +- May use modern selector output such as `:is()` in generated nested and + extended selectors. Selector compatibility remains part of the alpha feedback + surface. +- Adds an alpha readiness test path for the supported Less 5 surface, including + package loading, `lessc`, file imports, malformed-input diagnostics, and clean + npm consumer installation. + +#### Current alpha support + +Less 5 alpha.1 currently focuses on core compile behavior: `less.render()`, +`less.renderFile()`, `lessc`, variables, arithmetic, mixin calls, sibling file +imports, and nested-rule output. + +Less 5 alpha.1 requires Node.js `^20.19.0 || >=22.12.0`, matching its Jess +runtime dependencies. + +The broader Less 4.x compatibility surface is still in progress. Known +work-in-progress areas include legacy plugin execution, file-manager and +pre/post-processor hooks, source maps, URL rewriting options, compressed-output +parity, browser compilation, and the remaining long-tail Less 4 fixture corpus. +Less 5 alpha.1 does not include browser compilation support; a new browser +build mechanism will be introduced in a future alpha. +Unsupported syntax should fail with filename, line, column, and source context +rather than raw parser offsets. + +### v4.6.0 (2026-03-09) + +#### Bug Fixes + +- [#4414](https://github.com/less/less.js/pull/4414) Fix pre-existing bugs in tree nodes: selector `this` binding, atrule parenting, mixin-call error propagation, container/media functionRegistry guard (@matthew-dean) +- [#4408](https://github.com/less/less.js/pull/4408) Fix [#4358](https://github.com/less/less.js/issues/4358) Resolve parent selectors in comma-separated pseudo-selector lists (@matthew-dean) +- [#4407](https://github.com/less/less.js/pull/4407) Fix [#4331](https://github.com/less/less.js/issues/4331) Exclude CSS at-rule keywords from declarationCall parsing (@matthew-dean) +- [#4389](https://github.com/less/less.js/pull/4389) Fix [#4354](https://github.com/less/less.js/issues/4354) Unknown at-rule expression commas (@puckowski) +- [#4404](https://github.com/less/less.js/pull/4404) Fix no-prototype-builtins issues in Ruleset and ToCSSVisitor (@matthew-dean) +- [#4236](https://github.com/less/less.js/pull/4236) Fix import subpath module bug (@nicolo-ribaudo) +- [#4327](https://github.com/less/less.js/pull/4327) Remove duplicate length check from expression.genCSS() (@nicolo-ribaudo) +- [#3791](https://github.com/less/less.js/pull/3791) Handle the lack of optional dependencies (@nicolo-ribaudo) + +#### Features & Improvements + +- [#4413](https://github.com/less/less.js/pull/4413) Add JSDoc type annotations for all tree node files (@matthew-dean) +- [#4412](https://github.com/less/less.js/pull/4412) Convert prototype-based tree nodes to ES6 classes (@matthew-dean) +- [#4411](https://github.com/less/less.js/pull/4411) Migrate to native ESM with no build step (@matthew-dean) +- [#4410](https://github.com/less/less.js/pull/4410) Optimize hot paths and fix benchmark infrastructure (@matthew-dean) +- [#4409](https://github.com/less/less.js/pull/4409) Code quality cleanup for container queries and related code (@matthew-dean) + +#### Deprecation Warnings + +- [#4402](https://github.com/less/less.js/pull/4402) Add deprecation warnings for features removed in Less 5.x, container query variable name fix, deprecation notice fix (@matthew-dean, @puckowski) + +#### Chores + +- [#4406](https://github.com/less/less.js/pull/4406) Add test for number with underscore parsing (@matthew-dean) +- [#4386](https://github.com/less/less.js/pull/4386) Update README.md copyright (@matthew-dean) +- [#3782](https://github.com/less/less.js/pull/3782) Remove phantom stuff (@nicolo-ribaudo) +- [#3702](https://github.com/less/less.js/pull/3702) Replace deprecated String.prototype.substr() (@nicolo-ribaudo) +- [#4265](https://github.com/less/less.js/pull/4265) Remove redundant return from parsers.blockRuleset() (@nicolo-ribaudo) +- [#4271](https://github.com/less/less.js/pull/4271) Remove unused parsers.entities.propertyCurly() (@nicolo-ribaudo) + +### v4.5.1 (2025-12-28) + +_Automated patch release — no user-facing changes._ + ### v4.4.2 (2025-08-27) - [#4357](https://github.com/less/less.js/pull/4357) Migrate Less test data to use valid CSS (@matthew-dean) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d2029765b7..3e61de2827 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,8 +42,12 @@ Pull requests are welcome! Here's how to make them go smoothly: * **For new features, start with a feature request** to get feedback and see how your idea is received. * **If your PR solves an existing issue**, but approaches it differently, please create a new issue first and discuss it with core contributors. This helps avoid wasted effort. -* **Don't modify the `./dist/` folder**—we handle that during releases. -* **Please add tests** for your work. Run tests using `npm test`, which runs both Node.js and browser (Headless Chrome) tests. +* The `dist/` folder is gitignored—builds happen automatically during releases. +* **Please add tests** for your work. Run `pnpm test` for the current Less 5 + alpha gate. The historical Less 4 fixture sweep remains available through + `pnpm run test:node` while the Less 5 compatibility backlog is drained. + Browser compilation/testing is not part of the Less 5 alpha gate; a new + browser build mechanism will replace the old browser harness. ### Coding Standards @@ -86,25 +90,43 @@ When code is pushed to specific branches, GitHub Actions automatically: ### How to Publish -**For regular releases:** -1. Update version in `packages/less/package.json` (or let it auto-increment) -2. Commit and push to `master` -3. The workflow automatically publishes if the version changed +**For patch releases (automatic):** +1. Merge your PR into `master` +2. The workflow compares `package.json` against the latest npm version +3. If `package.json` is ahead, it uses that version; otherwise it bumps to the next patch +4. Publishes to npm and creates a GitHub release with `less.js` and `less.min.js` attached + +**For minor/major releases:** +1. Create a release branch (e.g., `release/v4.7.0`) +2. Update `version` in all `package.json` files and update `CHANGELOG.md` +3. Merge into `master` +4. The workflow detects the version is ahead of npm and publishes it directly **For alpha releases:** 1. Make your changes on the `alpha` branch 2. Commit and push -3. The workflow automatically increments the alpha version and publishes +3. The workflow creates or updates an alpha release PR +4. Merging that release PR publishes the committed alpha version to npm with + the `alpha` tag ### Version Override -You can override auto-increment by including a version in your commit message: +To force a specific version (useful for CI or manual runs), set the `EXPLICIT_VERSION` environment variable: +```bash +EXPLICIT_VERSION=4.7.0 pnpm run publish ``` -feat: new feature -version: 4.5.0 -``` +### Release Assets + +Stable GitHub releases include: +- `less.js` — the full browser build +- `less.min.js` — the minified browser build + +These are built during the workflow and attached to the release. They are not committed to git (the `dist/` directory is gitignored). + +Less 5 alpha.1 does not attach browser build assets; browser compilation will +return through a future alpha build mechanism. ### Security diff --git a/README.md b/README.md index 8e93bf0e4f..6a2a6bc7b0 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,8 @@ Here are other resources for using Less.js: ## Contributing -Please read [CONTRIBUTING.md](CONTRIBUTING.md). Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com). +Please read [CONTRIBUTING.md](CONTRIBUTING.md). Add tests for any new or +changed functionality and run the npm scripts described there. ### Reporting Issues @@ -33,7 +34,8 @@ Please report documentation issues in [the documentation project](https://github Read [Developing Less](http://lesscss.org/usage/#developing-less). ## Release History -See the [changelog](CHANGELOG.md) +See the [changelog](CHANGELOG.md), including the [Less v5 alpha.1 release +notes](CHANGELOG.md#v500-alpha1-unreleased). ## Contributors @@ -73,7 +75,7 @@ This project exists thanks to all the people who contribute. [[Contribute](CONTR ## [License](LICENSE) -Copyright (c) 2009-2017 [Alexis Sellier](http://cloudhead.io) & The Core Less Team +Copyright (c) 2009-2025 [Alexis Sellier](http://cloudhead.io) & The Core Less Team Licensed under the [Apache License](LICENSE). diff --git a/config/eslint/base.cjs b/config/eslint/base.cjs new file mode 100644 index 0000000000..a6b3ad2be3 --- /dev/null +++ b/config/eslint/base.cjs @@ -0,0 +1,31 @@ +module.exports = { + 'parser': '@typescript-eslint/parser', + 'parserOptions': { + 'ecmaVersion': 2022, + 'sourceType': 'module' + }, + 'plugins': ['@typescript-eslint'], + 'extends': [ + 'eslint:recommended' + ], + 'env': { + 'browser': true, + 'node': true, + 'mocha': true + }, + 'rules': { + 'indent': ['error', 4, { 'SwitchCase': 1 }], + 'no-empty': ['error', { 'allowEmptyCatch': true }], + 'quotes': ['error', 'single', { 'avoidEscape': true }], + /** + * The codebase uses some while(true) statements. + * Refactor to remove this rule. + */ + 'no-constant-condition': 0, + /** + * Less combines assignments with conditionals sometimes + */ + 'no-cond-assign': 0, + 'no-multiple-empty-lines': 'error' + } +}; \ No newline at end of file diff --git a/dist/less.js b/dist/less.js deleted file mode 100644 index 0883ae41c3..0000000000 --- a/dist/less.js +++ /dev/null @@ -1,11964 +0,0 @@ -/** - * Less - Leaner CSS v4.4.2 - * http://lesscss.org - * - * Copyright (c) 2009-2025, Alexis Sellier - * Licensed under the Apache-2.0 License. - * - * @license Apache-2.0 - */ - -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.less = factory()); -})(this, (function () { 'use strict'; - - // Export a new default each time - function defaultOptions () { - return { - /* Inline Javascript - @plugin still allowed */ - javascriptEnabled: false, - /* Outputs a makefile import dependency list to stdout. */ - depends: false, - /* (DEPRECATED) Compress using less built-in compression. - * This does an okay job but does not utilise all the tricks of - * dedicated css compression. */ - compress: false, - /* Runs the less parser and just reports errors without any output. */ - lint: false, - /* Sets available include paths. - * If the file in an @import rule does not exist at that exact location, - * less will look for it at the location(s) passed to this option. - * You might use this for instance to specify a path to a library which - * you want to be referenced simply and relatively in the less files. */ - paths: [], - /* color output in the terminal */ - color: true, - /* The strictImports controls whether the compiler will allow an @import inside of either - * @media blocks or (a later addition) other selector blocks. - * See: https://github.com/less/less.js/issues/656 */ - strictImports: false, - /* Allow Imports from Insecure HTTPS Hosts */ - insecure: false, - /* Allows you to add a path to every generated import and url in your css. - * This does not affect less import statements that are processed, just ones - * that are left in the output css. */ - rootpath: '', - /* By default URLs are kept as-is, so if you import a file in a sub-directory - * that references an image, exactly the same URL will be output in the css. - * This option allows you to re-write URL's in imported files so that the - * URL is always relative to the base imported file */ - rewriteUrls: false, - /* How to process math - * 0 always - eagerly try to solve all operations - * 1 parens-division - require parens for division "/" - * 2 parens | strict - require parens for all operations - * 3 strict-legacy - legacy strict behavior (super-strict) - */ - math: 1, - /* Without this option, less attempts to guess at the output unit when it does maths. */ - strictUnits: false, - /* Effectively the declaration is put at the top of your base Less file, - * meaning it can be used but it also can be overridden if this variable - * is defined in the file. */ - globalVars: null, - /* As opposed to the global variable option, this puts the declaration at the - * end of your base file, meaning it will override anything defined in your Less file. */ - modifyVars: null, - /* This option allows you to specify a argument to go on to every URL. */ - urlArgs: '' - }; - } - - function extractId(href) { - return href.replace(/^[a-z-]+:\/+?[^/]+/, '') // Remove protocol & domain - .replace(/[?&]livereload=\w+/, '') // Remove LiveReload cachebuster - .replace(/^\//, '') // Remove root / - .replace(/\.[a-zA-Z]+$/, '') // Remove simple extension - .replace(/[^.\w-]+/g, '-') // Replace illegal characters - .replace(/\./g, ':'); // Replace dots with colons(for valid id) - } - function addDataAttr(options, tag) { - if (!tag) { - return; - } // in case of tag is null or undefined - for (var opt in tag.dataset) { - if (Object.prototype.hasOwnProperty.call(tag.dataset, opt)) { - if (opt === 'env' || opt === 'dumpLineNumbers' || opt === 'rootpath' || opt === 'errorReporting') { - options[opt] = tag.dataset[opt]; - } - else { - try { - options[opt] = JSON.parse(tag.dataset[opt]); - } - catch (_) { } - } - } - } - } - - var browser = { - createCSS: function (document, styles, sheet) { - // Strip the query-string - var href = sheet.href || ''; - // If there is no title set, use the filename, minus the extension - var id = "less:".concat(sheet.title || extractId(href)); - // If this has already been inserted into the DOM, we may need to replace it - var oldStyleNode = document.getElementById(id); - var keepOldStyleNode = false; - // Create a new stylesheet node for insertion or (if necessary) replacement - var styleNode = document.createElement('style'); - styleNode.setAttribute('type', 'text/css'); - if (sheet.media) { - styleNode.setAttribute('media', sheet.media); - } - styleNode.id = id; - if (!styleNode.styleSheet) { - styleNode.appendChild(document.createTextNode(styles)); - // If new contents match contents of oldStyleNode, don't replace oldStyleNode - keepOldStyleNode = (oldStyleNode !== null && oldStyleNode.childNodes.length > 0 && styleNode.childNodes.length > 0 && - oldStyleNode.firstChild.nodeValue === styleNode.firstChild.nodeValue); - } - var head = document.getElementsByTagName('head')[0]; - // If there is no oldStyleNode, just append; otherwise, only append if we need - // to replace oldStyleNode with an updated stylesheet - if (oldStyleNode === null || keepOldStyleNode === false) { - var nextEl = sheet && sheet.nextSibling || null; - if (nextEl) { - nextEl.parentNode.insertBefore(styleNode, nextEl); - } - else { - head.appendChild(styleNode); - } - } - if (oldStyleNode && keepOldStyleNode === false) { - oldStyleNode.parentNode.removeChild(oldStyleNode); - } - // For IE. - // This needs to happen *after* the style element is added to the DOM, otherwise IE 7 and 8 may crash. - // See http://social.msdn.microsoft.com/Forums/en-US/7e081b65-878a-4c22-8e68-c10d39c2ed32/internet-explorer-crashes-appending-style-element-to-head - if (styleNode.styleSheet) { - try { - styleNode.styleSheet.cssText = styles; - } - catch (e) { - throw new Error('Couldn\'t reassign styleSheet.cssText.'); - } - } - }, - currentScript: function (window) { - var document = window.document; - return document.currentScript || (function () { - var scripts = document.getElementsByTagName('script'); - return scripts[scripts.length - 1]; - })(); - } - }; - - var addDefaultOptions = (function (window, options) { - // use options from the current script tag data attribues - addDataAttr(options, browser.currentScript(window)); - if (options.isFileProtocol === undefined) { - options.isFileProtocol = /^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(window.location.protocol); - } - // Load styles asynchronously (default: false) - // - // This is set to `false` by default, so that the body - // doesn't start loading before the stylesheets are parsed. - // Setting this to `true` can result in flickering. - // - options.async = options.async || false; - options.fileAsync = options.fileAsync || false; - // Interval between watch polls - options.poll = options.poll || (options.isFileProtocol ? 1000 : 1500); - options.env = options.env || (window.location.hostname == '127.0.0.1' || - window.location.hostname == '0.0.0.0' || - window.location.hostname == 'localhost' || - (window.location.port && - window.location.port.length > 0) || - options.isFileProtocol ? 'development' - : 'production'); - var dumpLineNumbers = /!dumpLineNumbers:(comments|mediaquery|all)/.exec(window.location.hash); - if (dumpLineNumbers) { - options.dumpLineNumbers = dumpLineNumbers[1]; - } - if (options.useFileCache === undefined) { - options.useFileCache = true; - } - if (options.onReady === undefined) { - options.onReady = true; - } - if (options.relativeUrls) { - options.rewriteUrls = 'all'; - } - }); - - var logger$1 = { - error: function (msg) { - this._fireEvent('error', msg); - }, - warn: function (msg) { - this._fireEvent('warn', msg); - }, - info: function (msg) { - this._fireEvent('info', msg); - }, - debug: function (msg) { - this._fireEvent('debug', msg); - }, - addListener: function (listener) { - this._listeners.push(listener); - }, - removeListener: function (listener) { - for (var i_1 = 0; i_1 < this._listeners.length; i_1++) { - if (this._listeners[i_1] === listener) { - this._listeners.splice(i_1, 1); - return; - } - } - }, - _fireEvent: function (type, msg) { - for (var i_2 = 0; i_2 < this._listeners.length; i_2++) { - var logFunction = this._listeners[i_2][type]; - if (logFunction) { - logFunction(msg); - } - } - }, - _listeners: [] - }; - - /** - * @todo Document why this abstraction exists, and the relationship between - * environment, file managers, and plugin manager - */ - var Environment = /** @class */ (function () { - function Environment(externalEnvironment, fileManagers) { - this.fileManagers = fileManagers || []; - externalEnvironment = externalEnvironment || {}; - var optionalFunctions = ['encodeBase64', 'mimeLookup', 'charsetLookup', 'getSourceMapGenerator']; - var requiredFunctions = []; - var functions = requiredFunctions.concat(optionalFunctions); - for (var i_1 = 0; i_1 < functions.length; i_1++) { - var propName = functions[i_1]; - var environmentFunc = externalEnvironment[propName]; - if (environmentFunc) { - this[propName] = environmentFunc.bind(externalEnvironment); - } - else if (i_1 < requiredFunctions.length) { - this.warn("missing required function in environment - ".concat(propName)); - } - } - } - Environment.prototype.getFileManager = function (filename, currentDirectory, options, environment, isSync) { - if (!filename) { - logger$1.warn('getFileManager called with no filename.. Please report this issue. continuing.'); - } - if (currentDirectory === undefined) { - logger$1.warn('getFileManager called with null directory.. Please report this issue. continuing.'); - } - var fileManagers = this.fileManagers; - if (options.pluginManager) { - fileManagers = [].concat(fileManagers).concat(options.pluginManager.getFileManagers()); - } - for (var i_2 = fileManagers.length - 1; i_2 >= 0; i_2--) { - var fileManager = fileManagers[i_2]; - if (fileManager[isSync ? 'supportsSync' : 'supports'](filename, currentDirectory, options, environment)) { - return fileManager; - } - } - return null; - }; - Environment.prototype.addFileManager = function (fileManager) { - this.fileManagers.push(fileManager); - }; - Environment.prototype.clearFileManagers = function () { - this.fileManagers = []; - }; - return Environment; - }()); - - var colors = { - 'aliceblue': '#f0f8ff', - 'antiquewhite': '#faebd7', - 'aqua': '#00ffff', - 'aquamarine': '#7fffd4', - 'azure': '#f0ffff', - 'beige': '#f5f5dc', - 'bisque': '#ffe4c4', - 'black': '#000000', - 'blanchedalmond': '#ffebcd', - 'blue': '#0000ff', - 'blueviolet': '#8a2be2', - 'brown': '#a52a2a', - 'burlywood': '#deb887', - 'cadetblue': '#5f9ea0', - 'chartreuse': '#7fff00', - 'chocolate': '#d2691e', - 'coral': '#ff7f50', - 'cornflowerblue': '#6495ed', - 'cornsilk': '#fff8dc', - 'crimson': '#dc143c', - 'cyan': '#00ffff', - 'darkblue': '#00008b', - 'darkcyan': '#008b8b', - 'darkgoldenrod': '#b8860b', - 'darkgray': '#a9a9a9', - 'darkgrey': '#a9a9a9', - 'darkgreen': '#006400', - 'darkkhaki': '#bdb76b', - 'darkmagenta': '#8b008b', - 'darkolivegreen': '#556b2f', - 'darkorange': '#ff8c00', - 'darkorchid': '#9932cc', - 'darkred': '#8b0000', - 'darksalmon': '#e9967a', - 'darkseagreen': '#8fbc8f', - 'darkslateblue': '#483d8b', - 'darkslategray': '#2f4f4f', - 'darkslategrey': '#2f4f4f', - 'darkturquoise': '#00ced1', - 'darkviolet': '#9400d3', - 'deeppink': '#ff1493', - 'deepskyblue': '#00bfff', - 'dimgray': '#696969', - 'dimgrey': '#696969', - 'dodgerblue': '#1e90ff', - 'firebrick': '#b22222', - 'floralwhite': '#fffaf0', - 'forestgreen': '#228b22', - 'fuchsia': '#ff00ff', - 'gainsboro': '#dcdcdc', - 'ghostwhite': '#f8f8ff', - 'gold': '#ffd700', - 'goldenrod': '#daa520', - 'gray': '#808080', - 'grey': '#808080', - 'green': '#008000', - 'greenyellow': '#adff2f', - 'honeydew': '#f0fff0', - 'hotpink': '#ff69b4', - 'indianred': '#cd5c5c', - 'indigo': '#4b0082', - 'ivory': '#fffff0', - 'khaki': '#f0e68c', - 'lavender': '#e6e6fa', - 'lavenderblush': '#fff0f5', - 'lawngreen': '#7cfc00', - 'lemonchiffon': '#fffacd', - 'lightblue': '#add8e6', - 'lightcoral': '#f08080', - 'lightcyan': '#e0ffff', - 'lightgoldenrodyellow': '#fafad2', - 'lightgray': '#d3d3d3', - 'lightgrey': '#d3d3d3', - 'lightgreen': '#90ee90', - 'lightpink': '#ffb6c1', - 'lightsalmon': '#ffa07a', - 'lightseagreen': '#20b2aa', - 'lightskyblue': '#87cefa', - 'lightslategray': '#778899', - 'lightslategrey': '#778899', - 'lightsteelblue': '#b0c4de', - 'lightyellow': '#ffffe0', - 'lime': '#00ff00', - 'limegreen': '#32cd32', - 'linen': '#faf0e6', - 'magenta': '#ff00ff', - 'maroon': '#800000', - 'mediumaquamarine': '#66cdaa', - 'mediumblue': '#0000cd', - 'mediumorchid': '#ba55d3', - 'mediumpurple': '#9370d8', - 'mediumseagreen': '#3cb371', - 'mediumslateblue': '#7b68ee', - 'mediumspringgreen': '#00fa9a', - 'mediumturquoise': '#48d1cc', - 'mediumvioletred': '#c71585', - 'midnightblue': '#191970', - 'mintcream': '#f5fffa', - 'mistyrose': '#ffe4e1', - 'moccasin': '#ffe4b5', - 'navajowhite': '#ffdead', - 'navy': '#000080', - 'oldlace': '#fdf5e6', - 'olive': '#808000', - 'olivedrab': '#6b8e23', - 'orange': '#ffa500', - 'orangered': '#ff4500', - 'orchid': '#da70d6', - 'palegoldenrod': '#eee8aa', - 'palegreen': '#98fb98', - 'paleturquoise': '#afeeee', - 'palevioletred': '#d87093', - 'papayawhip': '#ffefd5', - 'peachpuff': '#ffdab9', - 'peru': '#cd853f', - 'pink': '#ffc0cb', - 'plum': '#dda0dd', - 'powderblue': '#b0e0e6', - 'purple': '#800080', - 'rebeccapurple': '#663399', - 'red': '#ff0000', - 'rosybrown': '#bc8f8f', - 'royalblue': '#4169e1', - 'saddlebrown': '#8b4513', - 'salmon': '#fa8072', - 'sandybrown': '#f4a460', - 'seagreen': '#2e8b57', - 'seashell': '#fff5ee', - 'sienna': '#a0522d', - 'silver': '#c0c0c0', - 'skyblue': '#87ceeb', - 'slateblue': '#6a5acd', - 'slategray': '#708090', - 'slategrey': '#708090', - 'snow': '#fffafa', - 'springgreen': '#00ff7f', - 'steelblue': '#4682b4', - 'tan': '#d2b48c', - 'teal': '#008080', - 'thistle': '#d8bfd8', - 'tomato': '#ff6347', - 'turquoise': '#40e0d0', - 'violet': '#ee82ee', - 'wheat': '#f5deb3', - 'white': '#ffffff', - 'whitesmoke': '#f5f5f5', - 'yellow': '#ffff00', - 'yellowgreen': '#9acd32' - }; - - var unitConversions = { - length: { - 'm': 1, - 'cm': 0.01, - 'mm': 0.001, - 'in': 0.0254, - 'px': 0.0254 / 96, - 'pt': 0.0254 / 72, - 'pc': 0.0254 / 72 * 12 - }, - duration: { - 's': 1, - 'ms': 0.001 - }, - angle: { - 'rad': 1 / (2 * Math.PI), - 'deg': 1 / 360, - 'grad': 1 / 400, - 'turn': 1 - } - }; - - var data = { colors: colors, unitConversions: unitConversions }; - - /** - * The reason why Node is a class and other nodes simply do not extend - * from Node (since we're transpiling) is due to this issue: - * - * @see https://github.com/less/less.js/issues/3434 - */ - var Node = /** @class */ (function () { - function Node() { - this.parent = null; - this.visibilityBlocks = undefined; - this.nodeVisible = undefined; - this.rootNode = null; - this.parsed = null; - } - Object.defineProperty(Node.prototype, "currentFileInfo", { - get: function () { - return this.fileInfo(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Node.prototype, "index", { - get: function () { - return this.getIndex(); - }, - enumerable: false, - configurable: true - }); - Node.prototype.setParent = function (nodes, parent) { - function set(node) { - if (node && node instanceof Node) { - node.parent = parent; - } - } - if (Array.isArray(nodes)) { - nodes.forEach(set); - } - else { - set(nodes); - } - }; - Node.prototype.getIndex = function () { - return this._index || (this.parent && this.parent.getIndex()) || 0; - }; - Node.prototype.fileInfo = function () { - return this._fileInfo || (this.parent && this.parent.fileInfo()) || {}; - }; - Node.prototype.isRulesetLike = function () { return false; }; - Node.prototype.toCSS = function (context) { - var strs = []; - this.genCSS(context, { - // remove when genCSS has JSDoc types - // eslint-disable-next-line no-unused-vars - add: function (chunk, fileInfo, index) { - strs.push(chunk); - }, - isEmpty: function () { - return strs.length === 0; - } - }); - return strs.join(''); - }; - Node.prototype.genCSS = function (context, output) { - output.add(this.value); - }; - Node.prototype.accept = function (visitor) { - this.value = visitor.visit(this.value); - }; - Node.prototype.eval = function () { return this; }; - Node.prototype._operate = function (context, op, a, b) { - switch (op) { - case '+': return a + b; - case '-': return a - b; - case '*': return a * b; - case '/': return a / b; - } - }; - Node.prototype.fround = function (context, value) { - var precision = context && context.numPrecision; - // add "epsilon" to ensure numbers like 1.000000005 (represented as 1.000000004999...) are properly rounded: - return (precision) ? Number((value + 2e-16).toFixed(precision)) : value; - }; - Node.compare = function (a, b) { - /* returns: - -1: a < b - 0: a = b - 1: a > b - and *any* other value for a != b (e.g. undefined, NaN, -2 etc.) */ - if ((a.compare) && - // for "symmetric results" force toCSS-based comparison - // of Quoted or Anonymous if either value is one of those - !(b.type === 'Quoted' || b.type === 'Anonymous')) { - return a.compare(b); - } - else if (b.compare) { - return -b.compare(a); - } - else if (a.type !== b.type) { - return undefined; - } - a = a.value; - b = b.value; - if (!Array.isArray(a)) { - return a === b ? 0 : undefined; - } - if (a.length !== b.length) { - return undefined; - } - for (var i_1 = 0; i_1 < a.length; i_1++) { - if (Node.compare(a[i_1], b[i_1]) !== 0) { - return undefined; - } - } - return 0; - }; - Node.numericCompare = function (a, b) { - return a < b ? -1 - : a === b ? 0 - : a > b ? 1 : undefined; - }; - // Returns true if this node represents root of ast imported by reference - Node.prototype.blocksVisibility = function () { - if (this.visibilityBlocks === undefined) { - this.visibilityBlocks = 0; - } - return this.visibilityBlocks !== 0; - }; - Node.prototype.addVisibilityBlock = function () { - if (this.visibilityBlocks === undefined) { - this.visibilityBlocks = 0; - } - this.visibilityBlocks = this.visibilityBlocks + 1; - }; - Node.prototype.removeVisibilityBlock = function () { - if (this.visibilityBlocks === undefined) { - this.visibilityBlocks = 0; - } - this.visibilityBlocks = this.visibilityBlocks - 1; - }; - // Turns on node visibility - if called node will be shown in output regardless - // of whether it comes from import by reference or not - Node.prototype.ensureVisibility = function () { - this.nodeVisible = true; - }; - // Turns off node visibility - if called node will NOT be shown in output regardless - // of whether it comes from import by reference or not - Node.prototype.ensureInvisibility = function () { - this.nodeVisible = false; - }; - // return values: - // false - the node must not be visible - // true - the node must be visible - // undefined or null - the node has the same visibility as its parent - Node.prototype.isVisible = function () { - return this.nodeVisible; - }; - Node.prototype.visibilityInfo = function () { - return { - visibilityBlocks: this.visibilityBlocks, - nodeVisible: this.nodeVisible - }; - }; - Node.prototype.copyVisibilityInfo = function (info) { - if (!info) { - return; - } - this.visibilityBlocks = info.visibilityBlocks; - this.nodeVisible = info.nodeVisible; - }; - return Node; - }()); - - // - // RGB Colors - #ff0014, #eee - // - var Color = function (rgb, a, originalForm) { - var self = this; - // - // The end goal here, is to parse the arguments - // into an integer triplet, such as `128, 255, 0` - // - // This facilitates operations and conversions. - // - if (Array.isArray(rgb)) { - this.rgb = rgb; - } - else if (rgb.length >= 6) { - this.rgb = []; - rgb.match(/.{2}/g).map(function (c, i) { - if (i < 3) { - self.rgb.push(parseInt(c, 16)); - } - else { - self.alpha = (parseInt(c, 16)) / 255; - } - }); - } - else { - this.rgb = []; - rgb.split('').map(function (c, i) { - if (i < 3) { - self.rgb.push(parseInt(c + c, 16)); - } - else { - self.alpha = (parseInt(c + c, 16)) / 255; - } - }); - } - this.alpha = this.alpha || (typeof a === 'number' ? a : 1); - if (typeof originalForm !== 'undefined') { - this.value = originalForm; - } - }; - Color.prototype = Object.assign(new Node(), { - type: 'Color', - luma: function () { - var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255; - r = (r <= 0.03928) ? r / 12.92 : Math.pow(((r + 0.055) / 1.055), 2.4); - g = (g <= 0.03928) ? g / 12.92 : Math.pow(((g + 0.055) / 1.055), 2.4); - b = (b <= 0.03928) ? b / 12.92 : Math.pow(((b + 0.055) / 1.055), 2.4); - return 0.2126 * r + 0.7152 * g + 0.0722 * b; - }, - genCSS: function (context, output) { - output.add(this.toCSS(context)); - }, - toCSS: function (context, doNotCompress) { - var compress = context && context.compress && !doNotCompress; - var color; - var alpha; - var colorFunction; - var args = []; - // `value` is set if this color was originally - // converted from a named color string so we need - // to respect this and try to output named color too. - alpha = this.fround(context, this.alpha); - if (this.value) { - if (this.value.indexOf('rgb') === 0) { - if (alpha < 1) { - colorFunction = 'rgba'; - } - } - else if (this.value.indexOf('hsl') === 0) { - if (alpha < 1) { - colorFunction = 'hsla'; - } - else { - colorFunction = 'hsl'; - } - } - else { - return this.value; - } - } - else { - if (alpha < 1) { - colorFunction = 'rgba'; - } - } - switch (colorFunction) { - case 'rgba': - args = this.rgb.map(function (c) { - return clamp$1(Math.round(c), 255); - }).concat(clamp$1(alpha, 1)); - break; - case 'hsla': - args.push(clamp$1(alpha, 1)); - // eslint-disable-next-line no-fallthrough - case 'hsl': - color = this.toHSL(); - args = [ - this.fround(context, color.h), - "".concat(this.fround(context, color.s * 100), "%"), - "".concat(this.fround(context, color.l * 100), "%") - ].concat(args); - } - if (colorFunction) { - // Values are capped between `0` and `255`, rounded and zero-padded. - return "".concat(colorFunction, "(").concat(args.join(",".concat(compress ? '' : ' ')), ")"); - } - color = this.toRGB(); - if (compress) { - var splitcolor = color.split(''); - // Convert color to short format - if (splitcolor[1] === splitcolor[2] && splitcolor[3] === splitcolor[4] && splitcolor[5] === splitcolor[6]) { - color = "#".concat(splitcolor[1]).concat(splitcolor[3]).concat(splitcolor[5]); - } - } - return color; - }, - // - // Operations have to be done per-channel, if not, - // channels will spill onto each other. Once we have - // our result, in the form of an integer triplet, - // we create a new Color node to hold the result. - // - operate: function (context, op, other) { - var rgb = new Array(3); - var alpha = this.alpha * (1 - other.alpha) + other.alpha; - for (var c = 0; c < 3; c++) { - rgb[c] = this._operate(context, op, this.rgb[c], other.rgb[c]); - } - return new Color(rgb, alpha); - }, - toRGB: function () { - return toHex(this.rgb); - }, - toHSL: function () { - var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha; - var max = Math.max(r, g, b), min = Math.min(r, g, b); - var h; - var s; - var l = (max + min) / 2; - var d = max - min; - if (max === min) { - h = s = 0; - } - else { - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - switch (max) { - case r: - h = (g - b) / d + (g < b ? 6 : 0); - break; - case g: - h = (b - r) / d + 2; - break; - case b: - h = (r - g) / d + 4; - break; - } - h /= 6; - } - return { h: h * 360, s: s, l: l, a: a }; - }, - // Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript - toHSV: function () { - var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha; - var max = Math.max(r, g, b), min = Math.min(r, g, b); - var h; - var s; - var v = max; - var d = max - min; - if (max === 0) { - s = 0; - } - else { - s = d / max; - } - if (max === min) { - h = 0; - } - else { - switch (max) { - case r: - h = (g - b) / d + (g < b ? 6 : 0); - break; - case g: - h = (b - r) / d + 2; - break; - case b: - h = (r - g) / d + 4; - break; - } - h /= 6; - } - return { h: h * 360, s: s, v: v, a: a }; - }, - toARGB: function () { - return toHex([this.alpha * 255].concat(this.rgb)); - }, - compare: function (x) { - return (x.rgb && - x.rgb[0] === this.rgb[0] && - x.rgb[1] === this.rgb[1] && - x.rgb[2] === this.rgb[2] && - x.alpha === this.alpha) ? 0 : undefined; - } - }); - Color.fromKeyword = function (keyword) { - var c; - var key = keyword.toLowerCase(); - // eslint-disable-next-line no-prototype-builtins - if (colors.hasOwnProperty(key)) { - c = new Color(colors[key].slice(1)); - } - else if (key === 'transparent') { - c = new Color([0, 0, 0], 0); - } - if (c) { - c.value = keyword; - return c; - } - }; - function clamp$1(v, max) { - return Math.min(Math.max(v, 0), max); - } - function toHex(v) { - return "#".concat(v.map(function (c) { - c = clamp$1(Math.round(c), 255); - return (c < 16 ? '0' : '') + c.toString(16); - }).join('')); - } - - /****************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); - }; - - function __spreadArray(to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - } - - typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; - }; - - var Paren = function (node) { - this.value = node; - }; - Paren.prototype = Object.assign(new Node(), { - type: 'Paren', - genCSS: function (context, output) { - output.add('('); - this.value.genCSS(context, output); - output.add(')'); - }, - eval: function (context) { - var paren = new Paren(this.value.eval(context)); - if (this.noSpacing) { - paren.noSpacing = true; - } - return paren; - } - }); - - var _noSpaceCombinators = { - '': true, - ' ': true, - '|': true - }; - var Combinator = function (value) { - if (value === ' ') { - this.value = ' '; - this.emptyOrWhitespace = true; - } - else { - this.value = value ? value.trim() : ''; - this.emptyOrWhitespace = this.value === ''; - } - }; - Combinator.prototype = Object.assign(new Node(), { - type: 'Combinator', - genCSS: function (context, output) { - var spaceOrEmpty = (context.compress || _noSpaceCombinators[this.value]) ? '' : ' '; - output.add(spaceOrEmpty + this.value + spaceOrEmpty); - } - }); - - var Element = function (combinator, value, isVariable, index, currentFileInfo, visibilityInfo) { - this.combinator = combinator instanceof Combinator ? - combinator : new Combinator(combinator); - if (typeof value === 'string') { - this.value = value.trim(); - } - else if (value) { - this.value = value; - } - else { - this.value = ''; - } - this.isVariable = isVariable; - this._index = index; - this._fileInfo = currentFileInfo; - this.copyVisibilityInfo(visibilityInfo); - this.setParent(this.combinator, this); - }; - Element.prototype = Object.assign(new Node(), { - type: 'Element', - accept: function (visitor) { - var value = this.value; - this.combinator = visitor.visit(this.combinator); - if (typeof value === 'object') { - this.value = visitor.visit(value); - } - }, - eval: function (context) { - return new Element(this.combinator, this.value.eval ? this.value.eval(context) : this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - }, - clone: function () { - return new Element(this.combinator, this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - }, - genCSS: function (context, output) { - output.add(this.toCSS(context), this.fileInfo(), this.getIndex()); - }, - toCSS: function (context) { - context = context || {}; - var value = this.value; - var firstSelector = context.firstSelector; - if (value instanceof Paren) { - // selector in parens should not be affected by outer selector - // flags (breaks only interpolated selectors - see #1973) - context.firstSelector = true; - } - value = value.toCSS ? value.toCSS(context) : value; - context.firstSelector = firstSelector; - if (value === '' && this.combinator.value.charAt(0) === '&') { - return ''; - } - else { - return this.combinator.toCSS(context) + value; - } - } - }); - - var Math$1 = { - ALWAYS: 0, - PARENS_DIVISION: 1, - PARENS: 2 - // removed - STRICT_LEGACY: 3 - }; - var RewriteUrls = { - OFF: 0, - LOCAL: 1, - ALL: 2 - }; - - /** - * Returns the object type of the given payload - * - * @param {*} payload - * @returns {string} - */ - function getType(payload) { - return Object.prototype.toString.call(payload).slice(8, -1); - } - /** - * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes) - * - * @param {*} payload - * @returns {payload is PlainObject} - */ - function isPlainObject(payload) { - if (getType(payload) !== 'Object') - return false; - return payload.constructor === Object && Object.getPrototypeOf(payload) === Object.prototype; - } - /** - * Returns whether the payload is an array - * - * @param {any} payload - * @returns {payload is any[]} - */ - function isArray(payload) { - return getType(payload) === 'Array'; - } - - function assignProp(carry, key, newVal, originalObject, includeNonenumerable) { - const propType = {}.propertyIsEnumerable.call(originalObject, key) - ? 'enumerable' - : 'nonenumerable'; - if (propType === 'enumerable') - carry[key] = newVal; - if (includeNonenumerable && propType === 'nonenumerable') { - Object.defineProperty(carry, key, { - value: newVal, - enumerable: false, - writable: true, - configurable: true, - }); - } - } - /** - * Copy (clone) an object and all its props recursively to get rid of any prop referenced of the original object. Arrays are also cloned, however objects inside arrays are still linked. - * - * @export - * @template T - * @param {T} target Target can be anything - * @param {Options} [options = {}] Options can be `props` or `nonenumerable` - * @returns {T} the target with replaced values - * @export - */ - function copy(target, options = {}) { - if (isArray(target)) { - return target.map((item) => copy(item, options)); - } - if (!isPlainObject(target)) { - return target; - } - const props = Object.getOwnPropertyNames(target); - const symbols = Object.getOwnPropertySymbols(target); - return [...props, ...symbols].reduce((carry, key) => { - if (isArray(options.props) && !options.props.includes(key)) { - return carry; - } - const val = target[key]; - const newVal = copy(val, options); - assignProp(carry, key, newVal, target, options.nonenumerable); - return carry; - }, {}); - } - - /* jshint proto: true */ - function getLocation(index, inputStream) { - var n = index + 1; - var line = null; - var column = -1; - while (--n >= 0 && inputStream.charAt(n) !== '\n') { - column++; - } - if (typeof index === 'number') { - line = (inputStream.slice(0, index).match(/\n/g) || '').length; - } - return { - line: line, - column: column - }; - } - function copyArray(arr) { - var i; - var length = arr.length; - var copy = new Array(length); - for (i = 0; i < length; i++) { - copy[i] = arr[i]; - } - return copy; - } - function clone(obj) { - var cloned = {}; - for (var prop in obj) { - if (Object.prototype.hasOwnProperty.call(obj, prop)) { - cloned[prop] = obj[prop]; - } - } - return cloned; - } - function defaults(obj1, obj2) { - var newObj = obj2 || {}; - if (!obj2._defaults) { - newObj = {}; - var defaults_1 = copy(obj1); - newObj._defaults = defaults_1; - var cloned = obj2 ? copy(obj2) : {}; - Object.assign(newObj, defaults_1, cloned); - } - return newObj; - } - function copyOptions(obj1, obj2) { - if (obj2 && obj2._defaults) { - return obj2; - } - var opts = defaults(obj1, obj2); - if (opts.strictMath) { - opts.math = Math$1.PARENS; - } - // Back compat with changed relativeUrls option - if (opts.relativeUrls) { - opts.rewriteUrls = RewriteUrls.ALL; - } - if (typeof opts.math === 'string') { - switch (opts.math.toLowerCase()) { - case 'always': - opts.math = Math$1.ALWAYS; - break; - case 'parens-division': - opts.math = Math$1.PARENS_DIVISION; - break; - case 'strict': - case 'parens': - opts.math = Math$1.PARENS; - break; - default: - opts.math = Math$1.PARENS; - } - } - if (typeof opts.rewriteUrls === 'string') { - switch (opts.rewriteUrls.toLowerCase()) { - case 'off': - opts.rewriteUrls = RewriteUrls.OFF; - break; - case 'local': - opts.rewriteUrls = RewriteUrls.LOCAL; - break; - case 'all': - opts.rewriteUrls = RewriteUrls.ALL; - break; - } - } - return opts; - } - function merge(obj1, obj2) { - for (var prop in obj2) { - if (Object.prototype.hasOwnProperty.call(obj2, prop)) { - obj1[prop] = obj2[prop]; - } - } - return obj1; - } - function flattenArray(arr, result) { - if (result === void 0) { result = []; } - for (var i_1 = 0, length_1 = arr.length; i_1 < length_1; i_1++) { - var value = arr[i_1]; - if (Array.isArray(value)) { - flattenArray(value, result); - } - else { - if (value !== undefined) { - result.push(value); - } - } - } - return result; - } - function isNullOrUndefined(val) { - return val === null || val === undefined; - } - - var utils = /*#__PURE__*/Object.freeze({ - __proto__: null, - getLocation: getLocation, - copyArray: copyArray, - clone: clone, - defaults: defaults, - copyOptions: copyOptions, - merge: merge, - flattenArray: flattenArray, - isNullOrUndefined: isNullOrUndefined - }); - - var anonymousFunc = /(|Function):(\d+):(\d+)/; - /** - * This is a centralized class of any error that could be thrown internally (mostly by the parser). - * Besides standard .message it keeps some additional data like a path to the file where the error - * occurred along with line and column numbers. - * - * @class - * @extends Error - * @type {module.LessError} - * - * @prop {string} type - * @prop {string} filename - * @prop {number} index - * @prop {number} line - * @prop {number} column - * @prop {number} callLine - * @prop {number} callExtract - * @prop {string[]} extract - * - * @param {Object} e - An error object to wrap around or just a descriptive object - * @param {Object} fileContentMap - An object with file contents in 'contents' property (like importManager) @todo - move to fileManager? - * @param {string} [currentFilename] - */ - var LessError = function (e, fileContentMap, currentFilename) { - Error.call(this); - var filename = e.filename || currentFilename; - this.message = e.message; - this.stack = e.stack; - if (fileContentMap && filename) { - var input = fileContentMap.contents[filename]; - var loc = getLocation(e.index, input); - var line = loc.line; - var col = loc.column; - var callLine = e.call && getLocation(e.call, input).line; - var lines = input ? input.split('\n') : ''; - this.type = e.type || 'Syntax'; - this.filename = filename; - this.index = e.index; - this.line = typeof line === 'number' ? line + 1 : null; - this.column = col; - if (!this.line && this.stack) { - var found = this.stack.match(anonymousFunc); - /** - * We have to figure out how this environment stringifies anonymous functions - * so we can correctly map plugin errors. - * - * Note, in Node 8, the output of anonymous funcs varied based on parameters - * being present or not, so we inject dummy params. - */ - var func = new Function('a', 'throw new Error()'); - var lineAdjust = 0; - try { - func(); - } - catch (e) { - var match = e.stack.match(anonymousFunc); - lineAdjust = 1 - parseInt(match[2]); - } - if (found) { - if (found[2]) { - this.line = parseInt(found[2]) + lineAdjust; - } - if (found[3]) { - this.column = parseInt(found[3]); - } - } - } - this.callLine = callLine + 1; - this.callExtract = lines[callLine]; - this.extract = [ - lines[this.line - 2], - lines[this.line - 1], - lines[this.line] - ]; - } - }; - if (typeof Object.create === 'undefined') { - var F = function () { }; - F.prototype = Error.prototype; - LessError.prototype = new F(); - } - else { - LessError.prototype = Object.create(Error.prototype); - } - LessError.prototype.constructor = LessError; - /** - * An overridden version of the default Object.prototype.toString - * which uses additional information to create a helpful message. - * - * @param {Object} options - * @returns {string} - */ - LessError.prototype.toString = function (options) { - var _a; - options = options || {}; - var isWarning = ((_a = this.type) !== null && _a !== void 0 ? _a : '').toLowerCase().includes('warning'); - var type = isWarning ? this.type : "".concat(this.type, "Error"); - var color = isWarning ? 'yellow' : 'red'; - var message = ''; - var extract = this.extract || []; - var error = []; - var stylize = function (str) { return str; }; - if (options.stylize) { - var type_1 = typeof options.stylize; - if (type_1 !== 'function') { - throw Error("options.stylize should be a function, got a ".concat(type_1, "!")); - } - stylize = options.stylize; - } - if (this.line !== null) { - if (!isWarning && typeof extract[0] === 'string') { - error.push(stylize("".concat(this.line - 1, " ").concat(extract[0]), 'grey')); - } - if (typeof extract[1] === 'string') { - var errorTxt = "".concat(this.line, " "); - if (extract[1]) { - errorTxt += extract[1].slice(0, this.column) + - stylize(stylize(stylize(extract[1].substr(this.column, 1), 'bold') + - extract[1].slice(this.column + 1), 'red'), 'inverse'); - } - error.push(errorTxt); - } - if (!isWarning && typeof extract[2] === 'string') { - error.push(stylize("".concat(this.line + 1, " ").concat(extract[2]), 'grey')); - } - error = "".concat(error.join('\n') + stylize('', 'reset'), "\n"); - } - message += stylize("".concat(type, ": ").concat(this.message), color); - if (this.filename) { - message += stylize(' in ', color) + this.filename; - } - if (this.line) { - message += stylize(" on line ".concat(this.line, ", column ").concat(this.column + 1, ":"), 'grey'); - } - message += "\n".concat(error); - if (this.callLine) { - message += "".concat(stylize('from ', color) + (this.filename || ''), "/n"); - message += "".concat(stylize(this.callLine, 'grey'), " ").concat(this.callExtract, "/n"); - } - return message; - }; - - var _visitArgs = { visitDeeper: true }; - var _hasIndexed = false; - function _noop(node) { - return node; - } - function indexNodeTypes(parent, ticker) { - // add .typeIndex to tree node types for lookup table - var key, child; - for (key in parent) { - /* eslint guard-for-in: 0 */ - child = parent[key]; - switch (typeof child) { - case 'function': - // ignore bound functions directly on tree which do not have a prototype - // or aren't nodes - if (child.prototype && child.prototype.type) { - child.prototype.typeIndex = ticker++; - } - break; - case 'object': - ticker = indexNodeTypes(child, ticker); - break; - } - } - return ticker; - } - var Visitor = /** @class */ (function () { - function Visitor(implementation) { - this._implementation = implementation; - this._visitInCache = {}; - this._visitOutCache = {}; - if (!_hasIndexed) { - indexNodeTypes(tree, 1); - _hasIndexed = true; - } - } - Visitor.prototype.visit = function (node) { - if (!node) { - return node; - } - var nodeTypeIndex = node.typeIndex; - if (!nodeTypeIndex) { - // MixinCall args aren't a node type? - if (node.value && node.value.typeIndex) { - this.visit(node.value); - } - return node; - } - var impl = this._implementation; - var func = this._visitInCache[nodeTypeIndex]; - var funcOut = this._visitOutCache[nodeTypeIndex]; - var visitArgs = _visitArgs; - var fnName; - visitArgs.visitDeeper = true; - if (!func) { - fnName = "visit".concat(node.type); - func = impl[fnName] || _noop; - funcOut = impl["".concat(fnName, "Out")] || _noop; - this._visitInCache[nodeTypeIndex] = func; - this._visitOutCache[nodeTypeIndex] = funcOut; - } - if (func !== _noop) { - var newNode = func.call(impl, node, visitArgs); - if (node && impl.isReplacing) { - node = newNode; - } - } - if (visitArgs.visitDeeper && node) { - if (node.length) { - for (var i_1 = 0, cnt = node.length; i_1 < cnt; i_1++) { - if (node[i_1].accept) { - node[i_1].accept(this); - } - } - } - else if (node.accept) { - node.accept(this); - } - } - if (funcOut != _noop) { - funcOut.call(impl, node); - } - return node; - }; - Visitor.prototype.visitArray = function (nodes, nonReplacing) { - if (!nodes) { - return nodes; - } - var cnt = nodes.length; - var i; - // Non-replacing - if (nonReplacing || !this._implementation.isReplacing) { - for (i = 0; i < cnt; i++) { - this.visit(nodes[i]); - } - return nodes; - } - // Replacing - var out = []; - for (i = 0; i < cnt; i++) { - var evald = this.visit(nodes[i]); - if (evald === undefined) { - continue; - } - if (!evald.splice) { - out.push(evald); - } - else if (evald.length) { - this.flatten(evald, out); - } - } - return out; - }; - Visitor.prototype.flatten = function (arr, out) { - if (!out) { - out = []; - } - var cnt, i, item, nestedCnt, j, nestedItem; - for (i = 0, cnt = arr.length; i < cnt; i++) { - item = arr[i]; - if (item === undefined) { - continue; - } - if (!item.splice) { - out.push(item); - continue; - } - for (j = 0, nestedCnt = item.length; j < nestedCnt; j++) { - nestedItem = item[j]; - if (nestedItem === undefined) { - continue; - } - if (!nestedItem.splice) { - out.push(nestedItem); - } - else if (nestedItem.length) { - this.flatten(nestedItem, out); - } - } - } - return out; - }; - return Visitor; - }()); - - var contexts = {}; - var copyFromOriginal = function copyFromOriginal(original, destination, propertiesToCopy) { - if (!original) { - return; - } - for (var i_1 = 0; i_1 < propertiesToCopy.length; i_1++) { - if (Object.prototype.hasOwnProperty.call(original, propertiesToCopy[i_1])) { - destination[propertiesToCopy[i_1]] = original[propertiesToCopy[i_1]]; - } - } - }; - /* - parse is used whilst parsing - */ - var parseCopyProperties = [ - // options - 'paths', - 'rewriteUrls', - 'rootpath', - 'strictImports', - 'insecure', - 'dumpLineNumbers', - 'compress', - 'syncImport', - 'chunkInput', - 'mime', - 'useFileCache', - // context - 'processImports', - // Used by the import manager to stop multiple import visitors being created. - 'pluginManager', - 'quiet', // option - whether to log warnings - ]; - contexts.Parse = function (options) { - copyFromOriginal(options, this, parseCopyProperties); - if (typeof this.paths === 'string') { - this.paths = [this.paths]; - } - }; - var evalCopyProperties = [ - 'paths', - 'compress', - 'math', - 'strictUnits', - 'sourceMap', - 'importMultiple', - 'urlArgs', - 'javascriptEnabled', - 'pluginManager', - 'importantScope', - 'rewriteUrls' // option - whether to adjust URL's to be relative - ]; - contexts.Eval = function (options, frames) { - copyFromOriginal(options, this, evalCopyProperties); - if (typeof this.paths === 'string') { - this.paths = [this.paths]; - } - this.frames = frames || []; - this.importantScope = this.importantScope || []; - }; - contexts.Eval.prototype.enterCalc = function () { - if (!this.calcStack) { - this.calcStack = []; - } - this.calcStack.push(true); - this.inCalc = true; - }; - contexts.Eval.prototype.exitCalc = function () { - this.calcStack.pop(); - if (!this.calcStack.length) { - this.inCalc = false; - } - }; - contexts.Eval.prototype.inParenthesis = function () { - if (!this.parensStack) { - this.parensStack = []; - } - this.parensStack.push(true); - }; - contexts.Eval.prototype.outOfParenthesis = function () { - this.parensStack.pop(); - }; - contexts.Eval.prototype.inCalc = false; - contexts.Eval.prototype.mathOn = true; - contexts.Eval.prototype.isMathOn = function (op) { - if (!this.mathOn) { - return false; - } - if (op === '/' && this.math !== Math$1.ALWAYS && (!this.parensStack || !this.parensStack.length)) { - return false; - } - if (this.math > Math$1.PARENS_DIVISION) { - return this.parensStack && this.parensStack.length; - } - return true; - }; - contexts.Eval.prototype.pathRequiresRewrite = function (path) { - var isRelative = this.rewriteUrls === RewriteUrls.LOCAL ? isPathLocalRelative : isPathRelative; - return isRelative(path); - }; - contexts.Eval.prototype.rewritePath = function (path, rootpath) { - var newPath; - rootpath = rootpath || ''; - newPath = this.normalizePath(rootpath + path); - // If a path was explicit relative and the rootpath was not an absolute path - // we must ensure that the new path is also explicit relative. - if (isPathLocalRelative(path) && - isPathRelative(rootpath) && - isPathLocalRelative(newPath) === false) { - newPath = "./".concat(newPath); - } - return newPath; - }; - contexts.Eval.prototype.normalizePath = function (path) { - var segments = path.split('/').reverse(); - var segment; - path = []; - while (segments.length !== 0) { - segment = segments.pop(); - switch (segment) { - case '.': - break; - case '..': - if ((path.length === 0) || (path[path.length - 1] === '..')) { - path.push(segment); - } - else { - path.pop(); - } - break; - default: - path.push(segment); - break; - } - } - return path.join('/'); - }; - function isPathRelative(path) { - return !/^(?:[a-z-]+:|\/|#)/i.test(path); - } - function isPathLocalRelative(path) { - return path.charAt(0) === '.'; - } - // todo - do the same for the toCSS ? - - var ImportSequencer = /** @class */ (function () { - function ImportSequencer(onSequencerEmpty) { - this.imports = []; - this.variableImports = []; - this._onSequencerEmpty = onSequencerEmpty; - this._currentDepth = 0; - } - ImportSequencer.prototype.addImport = function (callback) { - var importSequencer = this, importItem = { - callback: callback, - args: null, - isReady: false - }; - this.imports.push(importItem); - return function () { - importItem.args = Array.prototype.slice.call(arguments, 0); - importItem.isReady = true; - importSequencer.tryRun(); - }; - }; - ImportSequencer.prototype.addVariableImport = function (callback) { - this.variableImports.push(callback); - }; - ImportSequencer.prototype.tryRun = function () { - this._currentDepth++; - try { - while (true) { - while (this.imports.length > 0) { - var importItem = this.imports[0]; - if (!importItem.isReady) { - return; - } - this.imports = this.imports.slice(1); - importItem.callback.apply(null, importItem.args); - } - if (this.variableImports.length === 0) { - break; - } - var variableImport = this.variableImports[0]; - this.variableImports = this.variableImports.slice(1); - variableImport(); - } - } - finally { - this._currentDepth--; - } - if (this._currentDepth === 0 && this._onSequencerEmpty) { - this._onSequencerEmpty(); - } - }; - return ImportSequencer; - }()); - - /* eslint-disable no-unused-vars */ - var ImportVisitor = function (importer, finish) { - this._visitor = new Visitor(this); - this._importer = importer; - this._finish = finish; - this.context = new contexts.Eval(); - this.importCount = 0; - this.onceFileDetectionMap = {}; - this.recursionDetector = {}; - this._sequencer = new ImportSequencer(this._onSequencerEmpty.bind(this)); - }; - ImportVisitor.prototype = { - isReplacing: false, - run: function (root) { - try { - // process the contents - this._visitor.visit(root); - } - catch (e) { - this.error = e; - } - this.isFinished = true; - this._sequencer.tryRun(); - }, - _onSequencerEmpty: function () { - if (!this.isFinished) { - return; - } - this._finish(this.error); - }, - visitImport: function (importNode, visitArgs) { - var inlineCSS = importNode.options.inline; - if (!importNode.css || inlineCSS) { - var context = new contexts.Eval(this.context, copyArray(this.context.frames)); - var importParent = context.frames[0]; - this.importCount++; - if (importNode.isVariableImport()) { - this._sequencer.addVariableImport(this.processImportNode.bind(this, importNode, context, importParent)); - } - else { - this.processImportNode(importNode, context, importParent); - } - } - visitArgs.visitDeeper = false; - }, - processImportNode: function (importNode, context, importParent) { - var evaldImportNode; - var inlineCSS = importNode.options.inline; - try { - evaldImportNode = importNode.evalForImport(context); - } - catch (e) { - if (!e.filename) { - e.index = importNode.getIndex(); - e.filename = importNode.fileInfo().filename; - } - // attempt to eval properly and treat as css - importNode.css = true; - // if that fails, this error will be thrown - importNode.error = e; - } - if (evaldImportNode && (!evaldImportNode.css || inlineCSS)) { - if (evaldImportNode.options.multiple) { - context.importMultiple = true; - } - // try appending if we haven't determined if it is css or not - var tryAppendLessExtension = evaldImportNode.css === undefined; - for (var i_1 = 0; i_1 < importParent.rules.length; i_1++) { - if (importParent.rules[i_1] === importNode) { - importParent.rules[i_1] = evaldImportNode; - break; - } - } - var onImported = this.onImported.bind(this, evaldImportNode, context), sequencedOnImported = this._sequencer.addImport(onImported); - this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.fileInfo(), evaldImportNode.options, sequencedOnImported); - } - else { - this.importCount--; - if (this.isFinished) { - this._sequencer.tryRun(); - } - } - }, - onImported: function (importNode, context, e, root, importedAtRoot, fullPath) { - if (e) { - if (!e.filename) { - e.index = importNode.getIndex(); - e.filename = importNode.fileInfo().filename; - } - this.error = e; - } - var importVisitor = this, inlineCSS = importNode.options.inline, isPlugin = importNode.options.isPlugin, isOptional = importNode.options.optional, duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector; - if (!context.importMultiple) { - if (duplicateImport) { - importNode.skip = true; - } - else { - importNode.skip = function () { - if (fullPath in importVisitor.onceFileDetectionMap) { - return true; - } - importVisitor.onceFileDetectionMap[fullPath] = true; - return false; - }; - } - } - if (!fullPath && isOptional) { - importNode.skip = true; - } - if (root) { - importNode.root = root; - importNode.importedFilename = fullPath; - if (!inlineCSS && !isPlugin && (context.importMultiple || !duplicateImport)) { - importVisitor.recursionDetector[fullPath] = true; - var oldContext = this.context; - this.context = context; - try { - this._visitor.visit(root); - } - catch (e) { - this.error = e; - } - this.context = oldContext; - } - } - importVisitor.importCount--; - if (importVisitor.isFinished) { - importVisitor._sequencer.tryRun(); - } - }, - visitDeclaration: function (declNode, visitArgs) { - if (declNode.value.type === 'DetachedRuleset') { - this.context.frames.unshift(declNode); - } - else { - visitArgs.visitDeeper = false; - } - }, - visitDeclarationOut: function (declNode) { - if (declNode.value.type === 'DetachedRuleset') { - this.context.frames.shift(); - } - }, - visitAtRule: function (atRuleNode, visitArgs) { - if (atRuleNode.value) { - this.context.frames.unshift(atRuleNode); - } - else if (atRuleNode.declarations && atRuleNode.declarations.length) { - if (atRuleNode.isRooted) { - this.context.frames.unshift(atRuleNode); - } - else { - this.context.frames.unshift(atRuleNode.declarations[0]); - } - } - else if (atRuleNode.rules && atRuleNode.rules.length) { - this.context.frames.unshift(atRuleNode); - } - }, - visitAtRuleOut: function (atRuleNode) { - this.context.frames.shift(); - }, - visitMixinDefinition: function (mixinDefinitionNode, visitArgs) { - this.context.frames.unshift(mixinDefinitionNode); - }, - visitMixinDefinitionOut: function (mixinDefinitionNode) { - this.context.frames.shift(); - }, - visitRuleset: function (rulesetNode, visitArgs) { - this.context.frames.unshift(rulesetNode); - }, - visitRulesetOut: function (rulesetNode) { - this.context.frames.shift(); - }, - visitMedia: function (mediaNode, visitArgs) { - this.context.frames.unshift(mediaNode.rules[0]); - }, - visitMediaOut: function (mediaNode) { - this.context.frames.shift(); - } - }; - - var SetTreeVisibilityVisitor = /** @class */ (function () { - function SetTreeVisibilityVisitor(visible) { - this.visible = visible; - } - SetTreeVisibilityVisitor.prototype.run = function (root) { - this.visit(root); - }; - SetTreeVisibilityVisitor.prototype.visitArray = function (nodes) { - if (!nodes) { - return nodes; - } - var cnt = nodes.length; - var i; - for (i = 0; i < cnt; i++) { - this.visit(nodes[i]); - } - return nodes; - }; - SetTreeVisibilityVisitor.prototype.visit = function (node) { - if (!node) { - return node; - } - if (node.constructor === Array) { - return this.visitArray(node); - } - if (!node.blocksVisibility || node.blocksVisibility()) { - return node; - } - if (this.visible) { - node.ensureVisibility(); - } - else { - node.ensureInvisibility(); - } - node.accept(this); - return node; - }; - return SetTreeVisibilityVisitor; - }()); - - /* eslint-disable no-unused-vars */ - /* jshint loopfunc:true */ - var ExtendFinderVisitor = /** @class */ (function () { - function ExtendFinderVisitor() { - this._visitor = new Visitor(this); - this.contexts = []; - this.allExtendsStack = [[]]; - } - ExtendFinderVisitor.prototype.run = function (root) { - root = this._visitor.visit(root); - root.allExtends = this.allExtendsStack[0]; - return root; - }; - ExtendFinderVisitor.prototype.visitDeclaration = function (declNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - ExtendFinderVisitor.prototype.visitMixinDefinition = function (mixinDefinitionNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - ExtendFinderVisitor.prototype.visitRuleset = function (rulesetNode, visitArgs) { - if (rulesetNode.root) { - return; - } - var i; - var j; - var extend; - var allSelectorsExtendList = []; - var extendList; - // get &:extend(.a); rules which apply to all selectors in this ruleset - var rules = rulesetNode.rules, ruleCnt = rules ? rules.length : 0; - for (i = 0; i < ruleCnt; i++) { - if (rulesetNode.rules[i] instanceof tree.Extend) { - allSelectorsExtendList.push(rules[i]); - rulesetNode.extendOnEveryPath = true; - } - } - // now find every selector and apply the extends that apply to all extends - // and the ones which apply to an individual extend - var paths = rulesetNode.paths; - for (i = 0; i < paths.length; i++) { - var selectorPath = paths[i], selector = selectorPath[selectorPath.length - 1], selExtendList = selector.extendList; - extendList = selExtendList ? copyArray(selExtendList).concat(allSelectorsExtendList) - : allSelectorsExtendList; - if (extendList) { - extendList = extendList.map(function (allSelectorsExtend) { - return allSelectorsExtend.clone(); - }); - } - for (j = 0; j < extendList.length; j++) { - this.foundExtends = true; - extend = extendList[j]; - extend.findSelfSelectors(selectorPath); - extend.ruleset = rulesetNode; - if (j === 0) { - extend.firstExtendOnThisSelectorPath = true; - } - this.allExtendsStack[this.allExtendsStack.length - 1].push(extend); - } - } - this.contexts.push(rulesetNode.selectors); - }; - ExtendFinderVisitor.prototype.visitRulesetOut = function (rulesetNode) { - if (!rulesetNode.root) { - this.contexts.length = this.contexts.length - 1; - } - }; - ExtendFinderVisitor.prototype.visitMedia = function (mediaNode, visitArgs) { - mediaNode.allExtends = []; - this.allExtendsStack.push(mediaNode.allExtends); - }; - ExtendFinderVisitor.prototype.visitMediaOut = function (mediaNode) { - this.allExtendsStack.length = this.allExtendsStack.length - 1; - }; - ExtendFinderVisitor.prototype.visitAtRule = function (atRuleNode, visitArgs) { - atRuleNode.allExtends = []; - this.allExtendsStack.push(atRuleNode.allExtends); - }; - ExtendFinderVisitor.prototype.visitAtRuleOut = function (atRuleNode) { - this.allExtendsStack.length = this.allExtendsStack.length - 1; - }; - return ExtendFinderVisitor; - }()); - var ProcessExtendsVisitor = /** @class */ (function () { - function ProcessExtendsVisitor() { - this._visitor = new Visitor(this); - } - ProcessExtendsVisitor.prototype.run = function (root) { - var extendFinder = new ExtendFinderVisitor(); - this.extendIndices = {}; - extendFinder.run(root); - if (!extendFinder.foundExtends) { - return root; - } - root.allExtends = root.allExtends.concat(this.doExtendChaining(root.allExtends, root.allExtends)); - this.allExtendsStack = [root.allExtends]; - var newRoot = this._visitor.visit(root); - this.checkExtendsForNonMatched(root.allExtends); - return newRoot; - }; - ProcessExtendsVisitor.prototype.checkExtendsForNonMatched = function (extendList) { - var indices = this.extendIndices; - extendList.filter(function (extend) { - return !extend.hasFoundMatches && extend.parent_ids.length == 1; - }).forEach(function (extend) { - var selector = '_unknown_'; - try { - selector = extend.selector.toCSS({}); - } - catch (_) { } - if (!indices["".concat(extend.index, " ").concat(selector)]) { - indices["".concat(extend.index, " ").concat(selector)] = true; - /** - * @todo Shouldn't this be an error? To alert the developer - * that they may have made an error in the selector they are - * targeting? - */ - logger$1.warn("WARNING: extend '".concat(selector, "' has no matches")); - } - }); - }; - ProcessExtendsVisitor.prototype.doExtendChaining = function (extendsList, extendsListTarget, iterationCount) { - // - // chaining is different from normal extension.. if we extend an extend then we are not just copying, altering - // and pasting the selector we would do normally, but we are also adding an extend with the same target selector - // this means this new extend can then go and alter other extends - // - // this method deals with all the chaining work - without it, extend is flat and doesn't work on other extend selectors - // this is also the most expensive.. and a match on one selector can cause an extension of a selector we had already - // processed if we look at each selector at a time, as is done in visitRuleset - var extendIndex; - var targetExtendIndex; - var matches; - var extendsToAdd = []; - var newSelector; - var extendVisitor = this; - var selectorPath; - var extend; - var targetExtend; - var newExtend; - iterationCount = iterationCount || 0; - // loop through comparing every extend with every target extend. - // a target extend is the one on the ruleset we are looking at copy/edit/pasting in place - // e.g. .a:extend(.b) {} and .b:extend(.c) {} then the first extend extends the second one - // and the second is the target. - // the separation into two lists allows us to process a subset of chains with a bigger set, as is the - // case when processing media queries - for (extendIndex = 0; extendIndex < extendsList.length; extendIndex++) { - for (targetExtendIndex = 0; targetExtendIndex < extendsListTarget.length; targetExtendIndex++) { - extend = extendsList[extendIndex]; - targetExtend = extendsListTarget[targetExtendIndex]; - // look for circular references - if (extend.parent_ids.indexOf(targetExtend.object_id) >= 0) { - continue; - } - // find a match in the target extends self selector (the bit before :extend) - selectorPath = [targetExtend.selfSelectors[0]]; - matches = extendVisitor.findMatch(extend, selectorPath); - if (matches.length) { - extend.hasFoundMatches = true; - // we found a match, so for each self selector.. - extend.selfSelectors.forEach(function (selfSelector) { - var info = targetExtend.visibilityInfo(); - // process the extend as usual - newSelector = extendVisitor.extendSelector(matches, selectorPath, selfSelector, extend.isVisible()); - // but now we create a new extend from it - newExtend = new (tree.Extend)(targetExtend.selector, targetExtend.option, 0, targetExtend.fileInfo(), info); - newExtend.selfSelectors = newSelector; - // add the extend onto the list of extends for that selector - newSelector[newSelector.length - 1].extendList = [newExtend]; - // record that we need to add it. - extendsToAdd.push(newExtend); - newExtend.ruleset = targetExtend.ruleset; - // remember its parents for circular references - newExtend.parent_ids = newExtend.parent_ids.concat(targetExtend.parent_ids, extend.parent_ids); - // only process the selector once.. if we have :extend(.a,.b) then multiple - // extends will look at the same selector path, so when extending - // we know that any others will be duplicates in terms of what is added to the css - if (targetExtend.firstExtendOnThisSelectorPath) { - newExtend.firstExtendOnThisSelectorPath = true; - targetExtend.ruleset.paths.push(newSelector); - } - }); - } - } - } - if (extendsToAdd.length) { - // try to detect circular references to stop a stack overflow. - // may no longer be needed. - this.extendChainCount++; - if (iterationCount > 100) { - var selectorOne = '{unable to calculate}'; - var selectorTwo = '{unable to calculate}'; - try { - selectorOne = extendsToAdd[0].selfSelectors[0].toCSS(); - selectorTwo = extendsToAdd[0].selector.toCSS(); - } - catch (e) { } - throw { message: "extend circular reference detected. One of the circular extends is currently:".concat(selectorOne, ":extend(").concat(selectorTwo, ")") }; - } - // now process the new extends on the existing rules so that we can handle a extending b extending c extending - // d extending e... - return extendsToAdd.concat(extendVisitor.doExtendChaining(extendsToAdd, extendsListTarget, iterationCount + 1)); - } - else { - return extendsToAdd; - } - }; - ProcessExtendsVisitor.prototype.visitDeclaration = function (ruleNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - ProcessExtendsVisitor.prototype.visitMixinDefinition = function (mixinDefinitionNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - ProcessExtendsVisitor.prototype.visitSelector = function (selectorNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - ProcessExtendsVisitor.prototype.visitRuleset = function (rulesetNode, visitArgs) { - if (rulesetNode.root) { - return; - } - var matches; - var pathIndex; - var extendIndex; - var allExtends = this.allExtendsStack[this.allExtendsStack.length - 1]; - var selectorsToAdd = []; - var extendVisitor = this; - var selectorPath; - // look at each selector path in the ruleset, find any extend matches and then copy, find and replace - for (extendIndex = 0; extendIndex < allExtends.length; extendIndex++) { - for (pathIndex = 0; pathIndex < rulesetNode.paths.length; pathIndex++) { - selectorPath = rulesetNode.paths[pathIndex]; - // extending extends happens initially, before the main pass - if (rulesetNode.extendOnEveryPath) { - continue; - } - var extendList = selectorPath[selectorPath.length - 1].extendList; - if (extendList && extendList.length) { - continue; - } - matches = this.findMatch(allExtends[extendIndex], selectorPath); - if (matches.length) { - allExtends[extendIndex].hasFoundMatches = true; - allExtends[extendIndex].selfSelectors.forEach(function (selfSelector) { - var extendedSelectors; - extendedSelectors = extendVisitor.extendSelector(matches, selectorPath, selfSelector, allExtends[extendIndex].isVisible()); - selectorsToAdd.push(extendedSelectors); - }); - } - } - } - rulesetNode.paths = rulesetNode.paths.concat(selectorsToAdd); - }; - ProcessExtendsVisitor.prototype.findMatch = function (extend, haystackSelectorPath) { - // - // look through the haystack selector path to try and find the needle - extend.selector - // returns an array of selector matches that can then be replaced - // - var haystackSelectorIndex; - var hackstackSelector; - var hackstackElementIndex; - var haystackElement; - var targetCombinator; - var i; - var extendVisitor = this; - var needleElements = extend.selector.elements; - var potentialMatches = []; - var potentialMatch; - var matches = []; - // loop through the haystack elements - for (haystackSelectorIndex = 0; haystackSelectorIndex < haystackSelectorPath.length; haystackSelectorIndex++) { - hackstackSelector = haystackSelectorPath[haystackSelectorIndex]; - for (hackstackElementIndex = 0; hackstackElementIndex < hackstackSelector.elements.length; hackstackElementIndex++) { - haystackElement = hackstackSelector.elements[hackstackElementIndex]; - // if we allow elements before our match we can add a potential match every time. otherwise only at the first element. - if (extend.allowBefore || (haystackSelectorIndex === 0 && hackstackElementIndex === 0)) { - potentialMatches.push({ pathIndex: haystackSelectorIndex, index: hackstackElementIndex, matched: 0, - initialCombinator: haystackElement.combinator }); - } - for (i = 0; i < potentialMatches.length; i++) { - potentialMatch = potentialMatches[i]; - // selectors add " " onto the first element. When we use & it joins the selectors together, but if we don't - // then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to - // work out what the resulting combinator will be - targetCombinator = haystackElement.combinator.value; - if (targetCombinator === '' && hackstackElementIndex === 0) { - targetCombinator = ' '; - } - // if we don't match, null our match to indicate failure - if (!extendVisitor.isElementValuesEqual(needleElements[potentialMatch.matched].value, haystackElement.value) || - (potentialMatch.matched > 0 && needleElements[potentialMatch.matched].combinator.value !== targetCombinator)) { - potentialMatch = null; - } - else { - potentialMatch.matched++; - } - // if we are still valid and have finished, test whether we have elements after and whether these are allowed - if (potentialMatch) { - potentialMatch.finished = potentialMatch.matched === needleElements.length; - if (potentialMatch.finished && - (!extend.allowAfter && - (hackstackElementIndex + 1 < hackstackSelector.elements.length || haystackSelectorIndex + 1 < haystackSelectorPath.length))) { - potentialMatch = null; - } - } - // if null we remove, if not, we are still valid, so either push as a valid match or continue - if (potentialMatch) { - if (potentialMatch.finished) { - potentialMatch.length = needleElements.length; - potentialMatch.endPathIndex = haystackSelectorIndex; - potentialMatch.endPathElementIndex = hackstackElementIndex + 1; // index after end of match - potentialMatches.length = 0; // we don't allow matches to overlap, so start matching again - matches.push(potentialMatch); - } - } - else { - potentialMatches.splice(i, 1); - i--; - } - } - } - } - return matches; - }; - ProcessExtendsVisitor.prototype.isElementValuesEqual = function (elementValue1, elementValue2) { - if (typeof elementValue1 === 'string' || typeof elementValue2 === 'string') { - return elementValue1 === elementValue2; - } - if (elementValue1 instanceof tree.Attribute) { - if (elementValue1.op !== elementValue2.op || elementValue1.key !== elementValue2.key) { - return false; - } - if (!elementValue1.value || !elementValue2.value) { - if (elementValue1.value || elementValue2.value) { - return false; - } - return true; - } - elementValue1 = elementValue1.value.value || elementValue1.value; - elementValue2 = elementValue2.value.value || elementValue2.value; - return elementValue1 === elementValue2; - } - elementValue1 = elementValue1.value; - elementValue2 = elementValue2.value; - if (elementValue1 instanceof tree.Selector) { - if (!(elementValue2 instanceof tree.Selector) || elementValue1.elements.length !== elementValue2.elements.length) { - return false; - } - for (var i_1 = 0; i_1 < elementValue1.elements.length; i_1++) { - if (elementValue1.elements[i_1].combinator.value !== elementValue2.elements[i_1].combinator.value) { - if (i_1 !== 0 || (elementValue1.elements[i_1].combinator.value || ' ') !== (elementValue2.elements[i_1].combinator.value || ' ')) { - return false; - } - } - if (!this.isElementValuesEqual(elementValue1.elements[i_1].value, elementValue2.elements[i_1].value)) { - return false; - } - } - return true; - } - return false; - }; - ProcessExtendsVisitor.prototype.extendSelector = function (matches, selectorPath, replacementSelector, isVisible) { - // for a set of matches, replace each match with the replacement selector - var currentSelectorPathIndex = 0, currentSelectorPathElementIndex = 0, path = [], matchIndex, selector, firstElement, match, newElements; - for (matchIndex = 0; matchIndex < matches.length; matchIndex++) { - match = matches[matchIndex]; - selector = selectorPath[match.pathIndex]; - firstElement = new tree.Element(match.initialCombinator, replacementSelector.elements[0].value, replacementSelector.elements[0].isVariable, replacementSelector.elements[0].getIndex(), replacementSelector.elements[0].fileInfo()); - if (match.pathIndex > currentSelectorPathIndex && currentSelectorPathElementIndex > 0) { - path[path.length - 1].elements = path[path.length - 1] - .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex)); - currentSelectorPathElementIndex = 0; - currentSelectorPathIndex++; - } - newElements = selector.elements - .slice(currentSelectorPathElementIndex, match.index) - .concat([firstElement]) - .concat(replacementSelector.elements.slice(1)); - if (currentSelectorPathIndex === match.pathIndex && matchIndex > 0) { - path[path.length - 1].elements = - path[path.length - 1].elements.concat(newElements); - } - else { - path = path.concat(selectorPath.slice(currentSelectorPathIndex, match.pathIndex)); - path.push(new tree.Selector(newElements)); - } - currentSelectorPathIndex = match.endPathIndex; - currentSelectorPathElementIndex = match.endPathElementIndex; - if (currentSelectorPathElementIndex >= selectorPath[currentSelectorPathIndex].elements.length) { - currentSelectorPathElementIndex = 0; - currentSelectorPathIndex++; - } - } - if (currentSelectorPathIndex < selectorPath.length && currentSelectorPathElementIndex > 0) { - path[path.length - 1].elements = path[path.length - 1] - .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex)); - currentSelectorPathIndex++; - } - path = path.concat(selectorPath.slice(currentSelectorPathIndex, selectorPath.length)); - path = path.map(function (currentValue) { - // we can re-use elements here, because the visibility property matters only for selectors - var derived = currentValue.createDerived(currentValue.elements); - if (isVisible) { - derived.ensureVisibility(); - } - else { - derived.ensureInvisibility(); - } - return derived; - }); - return path; - }; - ProcessExtendsVisitor.prototype.visitMedia = function (mediaNode, visitArgs) { - var newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]); - newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, mediaNode.allExtends)); - this.allExtendsStack.push(newAllExtends); - }; - ProcessExtendsVisitor.prototype.visitMediaOut = function (mediaNode) { - var lastIndex = this.allExtendsStack.length - 1; - this.allExtendsStack.length = lastIndex; - }; - ProcessExtendsVisitor.prototype.visitAtRule = function (atRuleNode, visitArgs) { - var newAllExtends = atRuleNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]); - newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, atRuleNode.allExtends)); - this.allExtendsStack.push(newAllExtends); - }; - ProcessExtendsVisitor.prototype.visitAtRuleOut = function (atRuleNode) { - var lastIndex = this.allExtendsStack.length - 1; - this.allExtendsStack.length = lastIndex; - }; - return ProcessExtendsVisitor; - }()); - - /* eslint-disable no-unused-vars */ - var JoinSelectorVisitor = /** @class */ (function () { - function JoinSelectorVisitor() { - this.contexts = [[]]; - this._visitor = new Visitor(this); - } - JoinSelectorVisitor.prototype.run = function (root) { - return this._visitor.visit(root); - }; - JoinSelectorVisitor.prototype.visitDeclaration = function (declNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - JoinSelectorVisitor.prototype.visitMixinDefinition = function (mixinDefinitionNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - JoinSelectorVisitor.prototype.visitRuleset = function (rulesetNode, visitArgs) { - var context = this.contexts[this.contexts.length - 1]; - var paths = []; - var selectors; - this.contexts.push(paths); - if (!rulesetNode.root) { - selectors = rulesetNode.selectors; - if (selectors) { - selectors = selectors.filter(function (selector) { return selector.getIsOutput(); }); - rulesetNode.selectors = selectors.length ? selectors : (selectors = null); - if (selectors) { - rulesetNode.joinSelectors(paths, context, selectors); - } - } - if (!selectors) { - rulesetNode.rules = null; - } - rulesetNode.paths = paths; - } - }; - JoinSelectorVisitor.prototype.visitRulesetOut = function (rulesetNode) { - this.contexts.length = this.contexts.length - 1; - }; - JoinSelectorVisitor.prototype.visitMedia = function (mediaNode, visitArgs) { - var context = this.contexts[this.contexts.length - 1]; - mediaNode.rules[0].root = (context.length === 0 || context[0].multiMedia); - }; - JoinSelectorVisitor.prototype.visitAtRule = function (atRuleNode, visitArgs) { - var context = this.contexts[this.contexts.length - 1]; - if (atRuleNode.declarations && atRuleNode.declarations.length) { - atRuleNode.declarations[0].root = (context.length === 0 || context[0].multiMedia); - } - else if (atRuleNode.rules && atRuleNode.rules.length) { - atRuleNode.rules[0].root = (atRuleNode.isRooted || context.length === 0 || null); - } - }; - return JoinSelectorVisitor; - }()); - - /* eslint-disable no-unused-vars */ - var CSSVisitorUtils = /** @class */ (function () { - function CSSVisitorUtils(context) { - this._visitor = new Visitor(this); - this._context = context; - } - CSSVisitorUtils.prototype.containsSilentNonBlockedChild = function (bodyRules) { - var rule; - if (!bodyRules) { - return false; - } - for (var r = 0; r < bodyRules.length; r++) { - rule = bodyRules[r]; - if (rule.isSilent && rule.isSilent(this._context) && !rule.blocksVisibility()) { - // the atrule contains something that was referenced (likely by extend) - // therefore it needs to be shown in output too - return true; - } - } - return false; - }; - CSSVisitorUtils.prototype.keepOnlyVisibleChilds = function (owner) { - if (owner && owner.rules) { - owner.rules = owner.rules.filter(function (thing) { return thing.isVisible(); }); - } - }; - CSSVisitorUtils.prototype.isEmpty = function (owner) { - return (owner && owner.rules) - ? (owner.rules.length === 0) : true; - }; - CSSVisitorUtils.prototype.hasVisibleSelector = function (rulesetNode) { - return (rulesetNode && rulesetNode.paths) - ? (rulesetNode.paths.length > 0) : false; - }; - CSSVisitorUtils.prototype.resolveVisibility = function (node) { - if (!node.blocksVisibility()) { - if (this.isEmpty(node)) { - return; - } - return node; - } - var compiledRulesBody = node.rules[0]; - this.keepOnlyVisibleChilds(compiledRulesBody); - if (this.isEmpty(compiledRulesBody)) { - return; - } - node.ensureVisibility(); - node.removeVisibilityBlock(); - return node; - }; - CSSVisitorUtils.prototype.isVisibleRuleset = function (rulesetNode) { - if (rulesetNode.firstRoot) { - return true; - } - if (this.isEmpty(rulesetNode)) { - return false; - } - if (!rulesetNode.root && !this.hasVisibleSelector(rulesetNode)) { - return false; - } - return true; - }; - return CSSVisitorUtils; - }()); - var ToCSSVisitor = function (context) { - this._visitor = new Visitor(this); - this._context = context; - this.utils = new CSSVisitorUtils(context); - }; - ToCSSVisitor.prototype = { - isReplacing: true, - run: function (root) { - return this._visitor.visit(root); - }, - visitDeclaration: function (declNode, visitArgs) { - if (declNode.blocksVisibility() || declNode.variable) { - return; - } - return declNode; - }, - visitMixinDefinition: function (mixinNode, visitArgs) { - // mixin definitions do not get eval'd - this means they keep state - // so we have to clear that state here so it isn't used if toCSS is called twice - mixinNode.frames = []; - }, - visitExtend: function (extendNode, visitArgs) { - }, - visitComment: function (commentNode, visitArgs) { - if (commentNode.blocksVisibility() || commentNode.isSilent(this._context)) { - return; - } - return commentNode; - }, - visitMedia: function (mediaNode, visitArgs) { - var originalRules = mediaNode.rules[0].rules; - mediaNode.accept(this._visitor); - visitArgs.visitDeeper = false; - return this.utils.resolveVisibility(mediaNode, originalRules); - }, - visitImport: function (importNode, visitArgs) { - if (importNode.blocksVisibility()) { - return; - } - return importNode; - }, - visitAtRule: function (atRuleNode, visitArgs) { - if (atRuleNode.rules && atRuleNode.rules.length) { - return this.visitAtRuleWithBody(atRuleNode, visitArgs); - } - else { - return this.visitAtRuleWithoutBody(atRuleNode, visitArgs); - } - }, - visitAnonymous: function (anonymousNode, visitArgs) { - if (!anonymousNode.blocksVisibility()) { - anonymousNode.accept(this._visitor); - return anonymousNode; - } - }, - visitAtRuleWithBody: function (atRuleNode, visitArgs) { - // if there is only one nested ruleset and that one has no path, then it is - // just fake ruleset - function hasFakeRuleset(atRuleNode) { - var bodyRules = atRuleNode.rules; - return bodyRules.length === 1 && (!bodyRules[0].paths || bodyRules[0].paths.length === 0); - } - function getBodyRules(atRuleNode) { - var nodeRules = atRuleNode.rules; - if (hasFakeRuleset(atRuleNode)) { - return nodeRules[0].rules; - } - return nodeRules; - } - // it is still true that it is only one ruleset in array - // this is last such moment - // process childs - var originalRules = getBodyRules(atRuleNode); - atRuleNode.accept(this._visitor); - visitArgs.visitDeeper = false; - if (!this.utils.isEmpty(atRuleNode)) { - this._mergeRules(atRuleNode.rules[0].rules); - } - return this.utils.resolveVisibility(atRuleNode, originalRules); - }, - visitAtRuleWithoutBody: function (atRuleNode, visitArgs) { - if (atRuleNode.blocksVisibility()) { - return; - } - if (atRuleNode.name === '@charset') { - // Only output the debug info together with subsequent @charset definitions - // a comment (or @media statement) before the actual @charset atrule would - // be considered illegal css as it has to be on the first line - if (this.charset) { - if (atRuleNode.debugInfo) { - var comment = new tree.Comment("/* ".concat(atRuleNode.toCSS(this._context).replace(/\n/g, ''), " */\n")); - comment.debugInfo = atRuleNode.debugInfo; - return this._visitor.visit(comment); - } - return; - } - this.charset = true; - } - return atRuleNode; - }, - checkValidNodes: function (rules, isRoot) { - if (!rules) { - return; - } - for (var i_1 = 0; i_1 < rules.length; i_1++) { - var ruleNode = rules[i_1]; - if (isRoot && ruleNode instanceof tree.Declaration && !ruleNode.variable) { - throw { message: 'Properties must be inside selector blocks. They cannot be in the root', - index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename }; - } - if (ruleNode instanceof tree.Call) { - throw { message: "Function '".concat(ruleNode.name, "' did not return a root node"), - index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename }; - } - if (ruleNode.type && !ruleNode.allowRoot) { - throw { message: "".concat(ruleNode.type, " node returned by a function is not valid here"), - index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename }; - } - } - }, - visitRuleset: function (rulesetNode, visitArgs) { - // at this point rulesets are nested into each other - var rule; - var rulesets = []; - this.checkValidNodes(rulesetNode.rules, rulesetNode.firstRoot); - if (!rulesetNode.root) { - // remove invisible paths - this._compileRulesetPaths(rulesetNode); - // remove rulesets from this ruleset body and compile them separately - var nodeRules = rulesetNode.rules; - var nodeRuleCnt = nodeRules ? nodeRules.length : 0; - for (var i_2 = 0; i_2 < nodeRuleCnt;) { - rule = nodeRules[i_2]; - if (rule && rule.rules) { - // visit because we are moving them out from being a child - rulesets.push(this._visitor.visit(rule)); - nodeRules.splice(i_2, 1); - nodeRuleCnt--; - continue; - } - i_2++; - } - // accept the visitor to remove rules and refactor itself - // then we can decide nogw whether we want it or not - // compile body - if (nodeRuleCnt > 0) { - rulesetNode.accept(this._visitor); - } - else { - rulesetNode.rules = null; - } - visitArgs.visitDeeper = false; - } - else { // if (! rulesetNode.root) { - rulesetNode.accept(this._visitor); - visitArgs.visitDeeper = false; - } - if (rulesetNode.rules) { - this._mergeRules(rulesetNode.rules); - this._removeDuplicateRules(rulesetNode.rules); - } - // now decide whether we keep the ruleset - if (this.utils.isVisibleRuleset(rulesetNode)) { - rulesetNode.ensureVisibility(); - rulesets.splice(0, 0, rulesetNode); - } - if (rulesets.length === 1) { - return rulesets[0]; - } - return rulesets; - }, - _compileRulesetPaths: function (rulesetNode) { - if (rulesetNode.paths) { - rulesetNode.paths = rulesetNode.paths - .filter(function (p) { - var i; - if (p[0].elements[0].combinator.value === ' ') { - p[0].elements[0].combinator = new (tree.Combinator)(''); - } - for (i = 0; i < p.length; i++) { - if (p[i].isVisible() && p[i].getIsOutput()) { - return true; - } - } - return false; - }); - } - }, - _removeDuplicateRules: function (rules) { - if (!rules) { - return; - } - // remove duplicates - var ruleCache = {}; - var ruleList; - var rule; - var i; - for (i = rules.length - 1; i >= 0; i--) { - rule = rules[i]; - if (rule instanceof tree.Declaration) { - if (!ruleCache[rule.name]) { - ruleCache[rule.name] = rule; - } - else { - ruleList = ruleCache[rule.name]; - if (ruleList instanceof tree.Declaration) { - ruleList = ruleCache[rule.name] = [ruleCache[rule.name].toCSS(this._context)]; - } - var ruleCSS = rule.toCSS(this._context); - if (ruleList.indexOf(ruleCSS) !== -1) { - rules.splice(i, 1); - } - else { - ruleList.push(ruleCSS); - } - } - } - } - }, - _mergeRules: function (rules) { - if (!rules) { - return; - } - var groups = {}; - var groupsArr = []; - for (var i_3 = 0; i_3 < rules.length; i_3++) { - var rule = rules[i_3]; - if (rule.merge) { - var key = rule.name; - groups[key] ? rules.splice(i_3--, 1) : - groupsArr.push(groups[key] = []); - groups[key].push(rule); - } - } - groupsArr.forEach(function (group) { - if (group.length > 0) { - var result_1 = group[0]; - var space_1 = []; - var comma_1 = [new tree.Expression(space_1)]; - group.forEach(function (rule) { - if ((rule.merge === '+') && (space_1.length > 0)) { - comma_1.push(new tree.Expression(space_1 = [])); - } - space_1.push(rule.value); - result_1.important = result_1.important || rule.important; - }); - result_1.value = new tree.Value(comma_1); - } - }); - } - }; - - var visitors = { - Visitor: Visitor, - ImportVisitor: ImportVisitor, - MarkVisibleSelectorsVisitor: SetTreeVisibilityVisitor, - ExtendVisitor: ProcessExtendsVisitor, - JoinSelectorVisitor: JoinSelectorVisitor, - ToCSSVisitor: ToCSSVisitor - }; - - // Split the input into chunks. - function chunker (input, fail) { - var len = input.length; - var level = 0; - var parenLevel = 0; - var lastOpening; - var lastOpeningParen; - var lastMultiComment; - var lastMultiCommentEndBrace; - var chunks = []; - var emitFrom = 0; - var chunkerCurrentIndex; - var currentChunkStartIndex; - var cc; - var cc2; - var matched; - function emitChunk(force) { - var len = chunkerCurrentIndex - emitFrom; - if (((len < 512) && !force) || !len) { - return; - } - chunks.push(input.slice(emitFrom, chunkerCurrentIndex + 1)); - emitFrom = chunkerCurrentIndex + 1; - } - for (chunkerCurrentIndex = 0; chunkerCurrentIndex < len; chunkerCurrentIndex++) { - cc = input.charCodeAt(chunkerCurrentIndex); - if (((cc >= 97) && (cc <= 122)) || (cc < 34)) { - // a-z or whitespace - continue; - } - switch (cc) { - case 40: // ( - parenLevel++; - lastOpeningParen = chunkerCurrentIndex; - continue; - case 41: // ) - if (--parenLevel < 0) { - return fail('missing opening `(`', chunkerCurrentIndex); - } - continue; - case 59: // ; - if (!parenLevel) { - emitChunk(); - } - continue; - case 123: // { - level++; - lastOpening = chunkerCurrentIndex; - continue; - case 125: // } - if (--level < 0) { - return fail('missing opening `{`', chunkerCurrentIndex); - } - if (!level && !parenLevel) { - emitChunk(); - } - continue; - case 92: // \ - if (chunkerCurrentIndex < len - 1) { - chunkerCurrentIndex++; - continue; - } - return fail('unescaped `\\`', chunkerCurrentIndex); - case 34: - case 39: - case 96: // ", ' and ` - matched = 0; - currentChunkStartIndex = chunkerCurrentIndex; - for (chunkerCurrentIndex = chunkerCurrentIndex + 1; chunkerCurrentIndex < len; chunkerCurrentIndex++) { - cc2 = input.charCodeAt(chunkerCurrentIndex); - if (cc2 > 96) { - continue; - } - if (cc2 == cc) { - matched = 1; - break; - } - if (cc2 == 92) { // \ - if (chunkerCurrentIndex == len - 1) { - return fail('unescaped `\\`', chunkerCurrentIndex); - } - chunkerCurrentIndex++; - } - } - if (matched) { - continue; - } - return fail("unmatched `".concat(String.fromCharCode(cc), "`"), currentChunkStartIndex); - case 47: // /, check for comment - if (parenLevel || (chunkerCurrentIndex == len - 1)) { - continue; - } - cc2 = input.charCodeAt(chunkerCurrentIndex + 1); - if (cc2 == 47) { - // //, find lnfeed - for (chunkerCurrentIndex = chunkerCurrentIndex + 2; chunkerCurrentIndex < len; chunkerCurrentIndex++) { - cc2 = input.charCodeAt(chunkerCurrentIndex); - if ((cc2 <= 13) && ((cc2 == 10) || (cc2 == 13))) { - break; - } - } - } - else if (cc2 == 42) { - // /*, find */ - lastMultiComment = currentChunkStartIndex = chunkerCurrentIndex; - for (chunkerCurrentIndex = chunkerCurrentIndex + 2; chunkerCurrentIndex < len - 1; chunkerCurrentIndex++) { - cc2 = input.charCodeAt(chunkerCurrentIndex); - if (cc2 == 125) { - lastMultiCommentEndBrace = chunkerCurrentIndex; - } - if (cc2 != 42) { - continue; - } - if (input.charCodeAt(chunkerCurrentIndex + 1) == 47) { - break; - } - } - if (chunkerCurrentIndex == len - 1) { - return fail('missing closing `*/`', currentChunkStartIndex); - } - chunkerCurrentIndex++; - } - continue; - case 42: // *, check for unmatched */ - if ((chunkerCurrentIndex < len - 1) && (input.charCodeAt(chunkerCurrentIndex + 1) == 47)) { - return fail('unmatched `/*`', chunkerCurrentIndex); - } - continue; - } - } - if (level !== 0) { - if ((lastMultiComment > lastOpening) && (lastMultiCommentEndBrace > lastMultiComment)) { - return fail('missing closing `}` or `*/`', lastOpening); - } - else { - return fail('missing closing `}`', lastOpening); - } - } - else if (parenLevel !== 0) { - return fail('missing closing `)`', lastOpeningParen); - } - emitChunk(true); - return chunks; - } - - var getParserInput = (function () { - var // Less input string - input; - var // current chunk - j; - var // holds state for backtracking - saveStack = []; - var // furthest index the parser has gone to - furthest; - var // if this is furthest we got to, this is the probably cause - furthestPossibleErrorMessage; - var // chunkified input - chunks; - var // current chunk - current; - var // index of current chunk, in `input` - currentPos; - var parserInput = {}; - var CHARCODE_SPACE = 32; - var CHARCODE_TAB = 9; - var CHARCODE_LF = 10; - var CHARCODE_CR = 13; - var CHARCODE_PLUS = 43; - var CHARCODE_COMMA = 44; - var CHARCODE_FORWARD_SLASH = 47; - var CHARCODE_9 = 57; - function skipWhitespace(length) { - var oldi = parserInput.i; - var oldj = j; - var curr = parserInput.i - currentPos; - var endIndex = parserInput.i + current.length - curr; - var mem = (parserInput.i += length); - var inp = input; - var c; - var nextChar; - var comment; - for (; parserInput.i < endIndex; parserInput.i++) { - c = inp.charCodeAt(parserInput.i); - if (parserInput.autoCommentAbsorb && c === CHARCODE_FORWARD_SLASH) { - nextChar = inp.charAt(parserInput.i + 1); - if (nextChar === '/') { - comment = { index: parserInput.i, isLineComment: true }; - var nextNewLine = inp.indexOf('\n', parserInput.i + 2); - if (nextNewLine < 0) { - nextNewLine = endIndex; - } - parserInput.i = nextNewLine; - comment.text = inp.substr(comment.index, parserInput.i - comment.index); - parserInput.commentStore.push(comment); - continue; - } - else if (nextChar === '*') { - var nextStarSlash = inp.indexOf('*/', parserInput.i + 2); - if (nextStarSlash >= 0) { - comment = { - index: parserInput.i, - text: inp.substr(parserInput.i, nextStarSlash + 2 - parserInput.i), - isLineComment: false - }; - parserInput.i += comment.text.length - 1; - parserInput.commentStore.push(comment); - continue; - } - } - break; - } - if ((c !== CHARCODE_SPACE) && (c !== CHARCODE_LF) && (c !== CHARCODE_TAB) && (c !== CHARCODE_CR)) { - break; - } - } - current = current.slice(length + parserInput.i - mem + curr); - currentPos = parserInput.i; - if (!current.length) { - if (j < chunks.length - 1) { - current = chunks[++j]; - skipWhitespace(0); // skip space at the beginning of a chunk - return true; // things changed - } - parserInput.finished = true; - } - return oldi !== parserInput.i || oldj !== j; - } - parserInput.save = function () { - currentPos = parserInput.i; - saveStack.push({ current: current, i: parserInput.i, j: j }); - }; - parserInput.restore = function (possibleErrorMessage) { - if (parserInput.i > furthest || (parserInput.i === furthest && possibleErrorMessage && !furthestPossibleErrorMessage)) { - furthest = parserInput.i; - furthestPossibleErrorMessage = possibleErrorMessage; - } - var state = saveStack.pop(); - current = state.current; - currentPos = parserInput.i = state.i; - j = state.j; - }; - parserInput.forget = function () { - saveStack.pop(); - }; - parserInput.isWhitespace = function (offset) { - var pos = parserInput.i + (offset || 0); - var code = input.charCodeAt(pos); - return (code === CHARCODE_SPACE || code === CHARCODE_CR || code === CHARCODE_TAB || code === CHARCODE_LF); - }; - // Specialization of $(tok) - parserInput.$re = function (tok) { - if (parserInput.i > currentPos) { - current = current.slice(parserInput.i - currentPos); - currentPos = parserInput.i; - } - var m = tok.exec(current); - if (!m) { - return null; - } - skipWhitespace(m[0].length); - if (typeof m === 'string') { - return m; - } - return m.length === 1 ? m[0] : m; - }; - parserInput.$char = function (tok) { - if (input.charAt(parserInput.i) !== tok) { - return null; - } - skipWhitespace(1); - return tok; - }; - parserInput.$peekChar = function (tok) { - if (input.charAt(parserInput.i) !== tok) { - return null; - } - return tok; - }; - parserInput.$str = function (tok) { - var tokLength = tok.length; - // https://jsperf.com/string-startswith/21 - for (var i_1 = 0; i_1 < tokLength; i_1++) { - if (input.charAt(parserInput.i + i_1) !== tok.charAt(i_1)) { - return null; - } - } - skipWhitespace(tokLength); - return tok; - }; - parserInput.$quoted = function (loc) { - var pos = loc || parserInput.i; - var startChar = input.charAt(pos); - if (startChar !== '\'' && startChar !== '"') { - return; - } - var length = input.length; - var currentPosition = pos; - for (var i_2 = 1; i_2 + currentPosition < length; i_2++) { - var nextChar = input.charAt(i_2 + currentPosition); - switch (nextChar) { - case '\\': - i_2++; - continue; - case '\r': - case '\n': - break; - case startChar: { - var str = input.substr(currentPosition, i_2 + 1); - if (!loc && loc !== 0) { - skipWhitespace(i_2 + 1); - return str; - } - return [startChar, str]; - } - } - } - return null; - }; - /** - * Permissive parsing. Ignores everything except matching {} [] () and quotes - * until matching token (outside of blocks) - */ - parserInput.$parseUntil = function (tok) { - var quote = ''; - var returnVal = null; - var inComment = false; - var blockDepth = 0; - var blockStack = []; - var parseGroups = []; - var length = input.length; - var startPos = parserInput.i; - var lastPos = parserInput.i; - var i = parserInput.i; - var loop = true; - var testChar; - if (typeof tok === 'string') { - testChar = function (char) { return char === tok; }; - } - else { - testChar = function (char) { return tok.test(char); }; - } - do { - var nextChar = input.charAt(i); - if (blockDepth === 0 && testChar(nextChar)) { - returnVal = input.substr(lastPos, i - lastPos); - if (returnVal) { - parseGroups.push(returnVal); - } - else { - parseGroups.push(' '); - } - returnVal = parseGroups; - skipWhitespace(i - startPos); - loop = false; - } - else { - if (inComment) { - if (nextChar === '*' && - input.charAt(i + 1) === '/') { - i++; - blockDepth--; - inComment = false; - } - i++; - continue; - } - switch (nextChar) { - case '\\': - i++; - nextChar = input.charAt(i); - parseGroups.push(input.substr(lastPos, i - lastPos + 1)); - lastPos = i + 1; - break; - case '/': - if (input.charAt(i + 1) === '*') { - i++; - inComment = true; - blockDepth++; - } - break; - case '\'': - case '"': - quote = parserInput.$quoted(i); - if (quote) { - parseGroups.push(input.substr(lastPos, i - lastPos), quote); - i += quote[1].length - 1; - lastPos = i + 1; - } - else { - skipWhitespace(i - startPos); - returnVal = nextChar; - loop = false; - } - break; - case '{': - blockStack.push('}'); - blockDepth++; - break; - case '(': - blockStack.push(')'); - blockDepth++; - break; - case '[': - blockStack.push(']'); - blockDepth++; - break; - case '}': - case ')': - case ']': { - var expected = blockStack.pop(); - if (nextChar === expected) { - blockDepth--; - } - else { - // move the parser to the error and return expected - skipWhitespace(i - startPos); - returnVal = expected; - loop = false; - } - } - } - i++; - if (i > length) { - loop = false; - } - } - } while (loop); - return returnVal ? returnVal : null; - }; - parserInput.autoCommentAbsorb = true; - parserInput.commentStore = []; - parserInput.finished = false; - // Same as $(), but don't change the state of the parser, - // just return the match. - parserInput.peek = function (tok) { - if (typeof tok === 'string') { - // https://jsperf.com/string-startswith/21 - for (var i_3 = 0; i_3 < tok.length; i_3++) { - if (input.charAt(parserInput.i + i_3) !== tok.charAt(i_3)) { - return false; - } - } - return true; - } - else { - return tok.test(current); - } - }; - // Specialization of peek() - // TODO remove or change some currentChar calls to peekChar - parserInput.peekChar = function (tok) { return input.charAt(parserInput.i) === tok; }; - parserInput.currentChar = function () { return input.charAt(parserInput.i); }; - parserInput.prevChar = function () { return input.charAt(parserInput.i - 1); }; - parserInput.getInput = function () { return input; }; - parserInput.peekNotNumeric = function () { - var c = input.charCodeAt(parserInput.i); - // Is the first char of the dimension 0-9, '.', '+' or '-' - return (c > CHARCODE_9 || c < CHARCODE_PLUS) || c === CHARCODE_FORWARD_SLASH || c === CHARCODE_COMMA; - }; - parserInput.start = function (str, chunkInput, failFunction) { - input = str; - parserInput.i = j = currentPos = furthest = 0; - // chunking apparently makes things quicker (but my tests indicate - // it might actually make things slower in node at least) - // and it is a non-perfect parse - it can't recognise - // unquoted urls, meaning it can't distinguish comments - // meaning comments with quotes or {}() in them get 'counted' - // and then lead to parse errors. - // In addition if the chunking chunks in the wrong place we might - // not be able to parse a parser statement in one go - // this is officially deprecated but can be switched on via an option - // in the case it causes too much performance issues. - if (chunkInput) { - chunks = chunker(str, failFunction); - } - else { - chunks = [str]; - } - current = chunks[0]; - skipWhitespace(0); - }; - parserInput.end = function () { - var message; - var isFinished = parserInput.i >= input.length; - if (parserInput.i < furthest) { - message = furthestPossibleErrorMessage; - parserInput.i = furthest; - } - return { - isFinished: isFinished, - furthest: parserInput.i, - furthestPossibleErrorMessage: message, - furthestReachedEnd: parserInput.i >= input.length - 1, - furthestChar: input[parserInput.i] - }; - }; - return parserInput; - }); - - function makeRegistry(base) { - return { - _data: {}, - add: function (name, func) { - // precautionary case conversion, as later querying of - // the registry by function-caller uses lower case as well. - name = name.toLowerCase(); - // eslint-disable-next-line no-prototype-builtins - if (this._data.hasOwnProperty(name)) ; - this._data[name] = func; - }, - addMultiple: function (functions) { - var _this = this; - Object.keys(functions).forEach(function (name) { - _this.add(name, functions[name]); - }); - }, - get: function (name) { - return this._data[name] || (base && base.get(name)); - }, - getLocalFunctions: function () { - return this._data; - }, - inherit: function () { - return makeRegistry(this); - }, - create: function (base) { - return makeRegistry(base); - } - }; - } - var functionRegistry = makeRegistry(null); - - var MediaSyntaxOptions = { - queryInParens: true - }; - var ContainerSyntaxOptions = { - queryInParens: true - }; - - var Anonymous = function (value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) { - this.value = value; - this._index = index; - this._fileInfo = currentFileInfo; - this.mapLines = mapLines; - this.rulesetLike = (typeof rulesetLike === 'undefined') ? false : rulesetLike; - this.allowRoot = true; - this.copyVisibilityInfo(visibilityInfo); - }; - Anonymous.prototype = Object.assign(new Node(), { - type: 'Anonymous', - eval: function () { - return new Anonymous(this.value, this._index, this._fileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo()); - }, - compare: function (other) { - return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined; - }, - isRulesetLike: function () { - return this.rulesetLike; - }, - genCSS: function (context, output) { - this.nodeVisible = Boolean(this.value); - if (this.nodeVisible) { - output.add(this.value, this._fileInfo, this._index, this.mapLines); - } - } - }); - - // - // less.js - parser - // - // A relatively straight-forward predictive parser. - // There is no tokenization/lexing stage, the input is parsed - // in one sweep. - // - // To make the parser fast enough to run in the browser, several - // optimization had to be made: - // - // - Matching and slicing on a huge input is often cause of slowdowns. - // The solution is to chunkify the input into smaller strings. - // The chunks are stored in the `chunks` var, - // `j` holds the current chunk index, and `currentPos` holds - // the index of the current chunk in relation to `input`. - // This gives us an almost 4x speed-up. - // - // - In many cases, we don't need to match individual tokens; - // for example, if a value doesn't hold any variables, operations - // or dynamic references, the parser can effectively 'skip' it, - // treating it as a literal. - // An example would be '1px solid #000' - which evaluates to itself, - // we don't need to know what the individual components are. - // The drawback, of course is that you don't get the benefits of - // syntax-checking on the CSS. This gives us a 50% speed-up in the parser, - // and a smaller speed-up in the code-gen. - // - // - // Token matching is done with the `$` function, which either takes - // a terminal string or regexp, or a non-terminal function to call. - // It also takes care of moving all the indices forwards. - // - var Parser = function Parser(context, imports, fileInfo, currentIndex) { - currentIndex = currentIndex || 0; - var parsers; - var parserInput = getParserInput(); - function error(msg, type) { - throw new LessError({ - index: parserInput.i, - filename: fileInfo.filename, - type: type || 'Syntax', - message: msg - }, imports); - } - /** - * - * @param {string} msg - * @param {number} index - * @param {string} type - */ - function warn(msg, index, type) { - if (!context.quiet) { - logger$1.warn((new LessError({ - index: index !== null && index !== void 0 ? index : parserInput.i, - filename: fileInfo.filename, - type: type ? "".concat(type.toUpperCase(), " WARNING") : 'WARNING', - message: msg - }, imports)).toString()); - } - } - function expect(arg, msg) { - // some older browsers return typeof 'function' for RegExp - var result = (arg instanceof Function) ? arg.call(parsers) : parserInput.$re(arg); - if (result) { - return result; - } - error(msg || (typeof arg === 'string' - ? "expected '".concat(arg, "' got '").concat(parserInput.currentChar(), "'") - : 'unexpected token')); - } - // Specialization of expect() - function expectChar(arg, msg) { - if (parserInput.$char(arg)) { - return arg; - } - error(msg || "expected '".concat(arg, "' got '").concat(parserInput.currentChar(), "'")); - } - function getDebugInfo(index) { - var filename = fileInfo.filename; - return { - lineNumber: getLocation(index, parserInput.getInput()).line + 1, - fileName: filename - }; - } - /** - * Used after initial parsing to create nodes on the fly - * - * @param {String} str - string to parse - * @param {Array} parseList - array of parsers to run input through e.g. ["value", "important"] - * @param {Number} currentIndex - start number to begin indexing - * @param {Object} fileInfo - fileInfo to attach to created nodes - */ - function parseNode(str, parseList, callback) { - var result; - var returnNodes = []; - var parser = parserInput; - try { - parser.start(str, false, function fail(msg, index) { - callback({ - message: msg, - index: index + currentIndex - }); - }); - for (var x = 0, p = void 0; (p = parseList[x]); x++) { - result = parsers[p](); - returnNodes.push(result || null); - } - var endInfo = parser.end(); - if (endInfo.isFinished) { - callback(null, returnNodes); - } - else { - callback(true, null); - } - } - catch (e) { - throw new LessError({ - index: e.index + currentIndex, - message: e.message - }, imports, fileInfo.filename); - } - } - // - // The Parser - // - return { - parserInput: parserInput, - imports: imports, - fileInfo: fileInfo, - parseNode: parseNode, - // - // Parse an input string into an abstract syntax tree, - // @param str A string containing 'less' markup - // @param callback call `callback` when done. - // @param [additionalData] An optional map which can contains vars - a map (key, value) of variables to apply - // - parse: function (str, callback, additionalData) { - var root; - var err = null; - var globalVars; - var modifyVars; - var ignored; - var preText = ''; - // Optionally disable @plugin parsing - if (additionalData && additionalData.disablePluginRule) { - parsers.plugin = function () { - var dir = parserInput.$re(/^@plugin?\s+/); - if (dir) { - error('@plugin statements are not allowed when disablePluginRule is set to true'); - } - }; - } - globalVars = (additionalData && additionalData.globalVars) ? "".concat(Parser.serializeVars(additionalData.globalVars), "\n") : ''; - modifyVars = (additionalData && additionalData.modifyVars) ? "\n".concat(Parser.serializeVars(additionalData.modifyVars)) : ''; - if (context.pluginManager) { - var preProcessors = context.pluginManager.getPreProcessors(); - for (var i_1 = 0; i_1 < preProcessors.length; i_1++) { - str = preProcessors[i_1].process(str, { context: context, imports: imports, fileInfo: fileInfo }); - } - } - if (globalVars || (additionalData && additionalData.banner)) { - preText = ((additionalData && additionalData.banner) ? additionalData.banner : '') + globalVars; - ignored = imports.contentsIgnoredChars; - ignored[fileInfo.filename] = ignored[fileInfo.filename] || 0; - ignored[fileInfo.filename] += preText.length; - } - str = str.replace(/\r\n?/g, '\n'); - // Remove potential UTF Byte Order Mark - str = preText + str.replace(/^\uFEFF/, '') + modifyVars; - imports.contents[fileInfo.filename] = str; - // Start with the primary rule. - // The whole syntax tree is held under a Ruleset node, - // with the `root` property set to true, so no `{}` are - // output. The callback is called when the input is parsed. - try { - parserInput.start(str, context.chunkInput, function fail(msg, index) { - throw new LessError({ - index: index, - type: 'Parse', - message: msg, - filename: fileInfo.filename - }, imports); - }); - tree.Node.prototype.parse = this; - root = new tree.Ruleset(null, this.parsers.primary()); - tree.Node.prototype.rootNode = root; - root.root = true; - root.firstRoot = true; - root.functionRegistry = functionRegistry.inherit(); - } - catch (e) { - return callback(new LessError(e, imports, fileInfo.filename)); - } - // If `i` is smaller than the `input.length - 1`, - // it means the parser wasn't able to parse the whole - // string, so we've got a parsing error. - // - // We try to extract a \n delimited string, - // showing the line where the parse error occurred. - // We split it up into two parts (the part which parsed, - // and the part which didn't), so we can color them differently. - var endInfo = parserInput.end(); - if (!endInfo.isFinished) { - var message = endInfo.furthestPossibleErrorMessage; - if (!message) { - message = 'Unrecognised input'; - if (endInfo.furthestChar === '}') { - message += '. Possibly missing opening \'{\''; - } - else if (endInfo.furthestChar === ')') { - message += '. Possibly missing opening \'(\''; - } - else if (endInfo.furthestReachedEnd) { - message += '. Possibly missing something'; - } - } - err = new LessError({ - type: 'Parse', - message: message, - index: endInfo.furthest, - filename: fileInfo.filename - }, imports); - } - var finish = function (e) { - e = err || e || imports.error; - if (e) { - if (!(e instanceof LessError)) { - e = new LessError(e, imports, fileInfo.filename); - } - return callback(e); - } - else { - return callback(null, root); - } - }; - if (context.processImports !== false) { - new visitors.ImportVisitor(imports, finish) - .run(root); - } - else { - return finish(); - } - }, - // - // Here in, the parsing rules/functions - // - // The basic structure of the syntax tree generated is as follows: - // - // Ruleset -> Declaration -> Value -> Expression -> Entity - // - // Here's some Less code: - // - // .class { - // color: #fff; - // border: 1px solid #000; - // width: @w + 4px; - // > .child {...} - // } - // - // And here's what the parse tree might look like: - // - // Ruleset (Selector '.class', [ - // Declaration ("color", Value ([Expression [Color #fff]])) - // Declaration ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]])) - // Declaration ("width", Value ([Expression [Operation " + " [Variable "@w"][Dimension 4px]]])) - // Ruleset (Selector [Element '>', '.child'], [...]) - // ]) - // - // In general, most rules will try to parse a token with the `$re()` function, and if the return - // value is truly, will return a new node, of the relevant type. Sometimes, we need to check - // first, before parsing, that's when we use `peek()`. - // - parsers: parsers = { - // - // The `primary` rule is the *entry* and *exit* point of the parser. - // The rules here can appear at any level of the parse tree. - // - // The recursive nature of the grammar is an interplay between the `block` - // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule, - // as represented by this simplified grammar: - // - // primary → (ruleset | declaration)+ - // ruleset → selector+ block - // block → '{' primary '}' - // - // Only at one point is the primary rule not called from the - // block rule: at the root level. - // - primary: function () { - var mixin = this.mixin; - var root = []; - var node; - while (true) { - while (true) { - node = this.comment(); - if (!node) { - break; - } - root.push(node); - } - // always process comments before deciding if finished - if (parserInput.finished) { - break; - } - if (parserInput.peek('}')) { - break; - } - node = this.extendRule(); - if (node) { - root = root.concat(node); - continue; - } - node = mixin.definition() || this.declaration() || mixin.call(false, false) || - this.ruleset() || this.variableCall() || this.entities.call() || this.atrule(); - if (node) { - root.push(node); - } - else { - var foundSemiColon = false; - while (parserInput.$char(';')) { - foundSemiColon = true; - } - if (!foundSemiColon) { - break; - } - } - } - return root; - }, - // comments are collected by the main parsing mechanism and then assigned to nodes - // where the current structure allows it - comment: function () { - if (parserInput.commentStore.length) { - var comment = parserInput.commentStore.shift(); - return new (tree.Comment)(comment.text, comment.isLineComment, comment.index + currentIndex, fileInfo); - } - }, - // - // Entities are tokens which can be found inside an Expression - // - entities: { - mixinLookup: function () { - return parsers.mixin.call(true, true); - }, - // - // A string, which supports escaping " and ' - // - // "milky way" 'he\'s the one!' - // - quoted: function (forceEscaped) { - var str; - var index = parserInput.i; - var isEscaped = false; - parserInput.save(); - if (parserInput.$char('~')) { - isEscaped = true; - } - else if (forceEscaped) { - parserInput.restore(); - return; - } - str = parserInput.$quoted(); - if (!str) { - parserInput.restore(); - return; - } - parserInput.forget(); - return new (tree.Quoted)(str.charAt(0), str.substr(1, str.length - 2), isEscaped, index + currentIndex, fileInfo); - }, - // - // A catch-all word, such as: - // - // black border-collapse - // - keyword: function () { - var k = parserInput.$char('%') || parserInput.$re(/^\[?(?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+\]?/); - if (k) { - return tree.Color.fromKeyword(k) || new (tree.Keyword)(k); - } - }, - // - // A function call - // - // rgb(255, 0, 255) - // - // The arguments are parsed with the `entities.arguments` parser. - // - call: function () { - var name; - var args; - var func; - var index = parserInput.i; - // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 - if (parserInput.peek(/^url\(/i)) { - return; - } - parserInput.save(); - name = parserInput.$re(/^([\w-]+|%|~|progid:[\w.]+)\(/); - if (!name) { - parserInput.forget(); - return; - } - name = name[1]; - func = this.customFuncCall(name); - if (func) { - args = func.parse(); - if (args && func.stop) { - parserInput.forget(); - return args; - } - } - args = this.arguments(args); - if (!parserInput.$char(')')) { - parserInput.restore('Could not parse call arguments or missing \')\''); - return; - } - parserInput.forget(); - return new (tree.Call)(name, args, index + currentIndex, fileInfo); - }, - declarationCall: function () { - var validCall; - var args; - var index = parserInput.i; - parserInput.save(); - validCall = parserInput.$re(/^[\w]+\(/); - if (!validCall) { - parserInput.forget(); - return; - } - validCall = validCall.substring(0, validCall.length - 1); - var rule = this.ruleProperty(); - var value; - if (rule) { - value = this.value(); - } - if (rule && value) { - args = [new (tree.Declaration)(rule, value, null, null, parserInput.i + currentIndex, fileInfo, true)]; - } - if (!parserInput.$char(')')) { - parserInput.restore('Could not parse call arguments or missing \')\''); - return; - } - parserInput.forget(); - return new (tree.Call)(validCall, args, index + currentIndex, fileInfo); - }, - // - // Parsing rules for functions with non-standard args, e.g.: - // - // boolean(not(2 > 1)) - // - // This is a quick prototype, to be modified/improved when - // more custom-parsed funcs come (e.g. `selector(...)`) - // - customFuncCall: function (name) { - /* Ideally the table is to be moved out of here for faster perf., - but it's quite tricky since it relies on all these `parsers` - and `expect` available only here */ - return { - alpha: f(parsers.ieAlpha, true), - boolean: f(condition), - 'if': f(condition) - }[name.toLowerCase()]; - function f(parse, stop) { - return { - parse: parse, - stop: stop // when true - stop after parse() and return its result, - // otherwise continue for plain args - }; - } - function condition() { - return [expect(parsers.condition, 'expected condition')]; - } - }, - arguments: function (prevArgs) { - var argsComma = prevArgs || []; - var argsSemiColon = []; - var isSemiColonSeparated; - var value; - parserInput.save(); - while (true) { - if (prevArgs) { - prevArgs = false; - } - else { - value = parsers.detachedRuleset() || this.assignment() || parsers.expression(); - if (!value) { - break; - } - if (value.value && value.value.length == 1) { - value = value.value[0]; - } - argsComma.push(value); - } - if (parserInput.$char(',')) { - continue; - } - if (parserInput.$char(';') || isSemiColonSeparated) { - isSemiColonSeparated = true; - value = (argsComma.length < 1) ? argsComma[0] - : new tree.Value(argsComma); - argsSemiColon.push(value); - argsComma = []; - } - } - parserInput.forget(); - return isSemiColonSeparated ? argsSemiColon : argsComma; - }, - literal: function () { - return this.dimension() || - this.color() || - this.quoted() || - this.unicodeDescriptor(); - }, - // Assignments are argument entities for calls. - // They are present in ie filter properties as shown below. - // - // filter: progid:DXImageTransform.Microsoft.Alpha( *opacity=50* ) - // - assignment: function () { - var key; - var value; - parserInput.save(); - key = parserInput.$re(/^\w+(?=\s?=)/i); - if (!key) { - parserInput.restore(); - return; - } - if (!parserInput.$char('=')) { - parserInput.restore(); - return; - } - value = parsers.entity(); - if (value) { - parserInput.forget(); - return new (tree.Assignment)(key, value); - } - else { - parserInput.restore(); - } - }, - // - // Parse url() tokens - // - // We use a specific rule for urls, because they don't really behave like - // standard function calls. The difference is that the argument doesn't have - // to be enclosed within a string, so it can't be parsed as an Expression. - // - url: function () { - var value; - var index = parserInput.i; - parserInput.autoCommentAbsorb = false; - if (!parserInput.$str('url(')) { - parserInput.autoCommentAbsorb = true; - return; - } - value = this.quoted() || this.variable() || this.property() || - parserInput.$re(/^(?:(?:\\[()'"])|[^()'"])+/) || ''; - parserInput.autoCommentAbsorb = true; - expectChar(')'); - return new (tree.URL)((value.value !== undefined || - value instanceof tree.Variable || - value instanceof tree.Property) ? - value : new (tree.Anonymous)(value, index), index + currentIndex, fileInfo); - }, - // - // A Variable entity, such as `@fink`, in - // - // width: @fink + 2px - // - // We use a different parser for variable definitions, - // see `parsers.variable`. - // - variable: function () { - var ch; - var name; - var index = parserInput.i; - parserInput.save(); - if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^@@?[\w-]+/))) { - ch = parserInput.currentChar(); - if (ch === '(' || ch === '[' && !parserInput.prevChar().match(/^\s/)) { - // this may be a VariableCall lookup - var result = parsers.variableCall(name); - if (result) { - parserInput.forget(); - return result; - } - } - parserInput.forget(); - return new (tree.Variable)(name, index + currentIndex, fileInfo); - } - parserInput.restore(); - }, - // A variable entity using the protective {} e.g. @{var} - variableCurly: function () { - var curly; - var index = parserInput.i; - if (parserInput.currentChar() === '@' && (curly = parserInput.$re(/^@\{([\w-]+)\}/))) { - return new (tree.Variable)("@".concat(curly[1]), index + currentIndex, fileInfo); - } - }, - // - // A Property accessor, such as `$color`, in - // - // background-color: $color - // - property: function () { - var name; - var index = parserInput.i; - if (parserInput.currentChar() === '$' && (name = parserInput.$re(/^\$[\w-]+/))) { - return new (tree.Property)(name, index + currentIndex, fileInfo); - } - }, - // A property entity useing the protective {} e.g. ${prop} - propertyCurly: function () { - var curly; - var index = parserInput.i; - if (parserInput.currentChar() === '$' && (curly = parserInput.$re(/^\$\{([\w-]+)\}/))) { - return new (tree.Property)("$".concat(curly[1]), index + currentIndex, fileInfo); - } - }, - // - // A Hexadecimal color - // - // #4F3C2F - // - // `rgb` and `hsl` colors are parsed through the `entities.call` parser. - // - color: function () { - var rgb; - parserInput.save(); - if (parserInput.currentChar() === '#' && (rgb = parserInput.$re(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})([\w.#[])?/))) { - if (!rgb[2]) { - parserInput.forget(); - return new (tree.Color)(rgb[1], undefined, rgb[0]); - } - } - parserInput.restore(); - }, - colorKeyword: function () { - parserInput.save(); - var autoCommentAbsorb = parserInput.autoCommentAbsorb; - parserInput.autoCommentAbsorb = false; - var k = parserInput.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/); - parserInput.autoCommentAbsorb = autoCommentAbsorb; - if (!k) { - parserInput.forget(); - return; - } - parserInput.restore(); - var color = tree.Color.fromKeyword(k); - if (color) { - parserInput.$str(k); - return color; - } - }, - // - // A Dimension, that is, a number and a unit - // - // 0.5em 95% - // - dimension: function () { - if (parserInput.peekNotNumeric()) { - return; - } - var value = parserInput.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i); - if (value) { - return new (tree.Dimension)(value[1], value[2]); - } - }, - // - // A unicode descriptor, as is used in unicode-range - // - // U+0?? or U+00A1-00A9 - // - unicodeDescriptor: function () { - var ud; - ud = parserInput.$re(/^U\+[0-9a-fA-F?]+(-[0-9a-fA-F?]+)?/); - if (ud) { - return new (tree.UnicodeDescriptor)(ud[0]); - } - }, - // - // JavaScript code to be evaluated - // - // `window.location.href` - // - javascript: function () { - var js; - var index = parserInput.i; - parserInput.save(); - var escape = parserInput.$char('~'); - var jsQuote = parserInput.$char('`'); - if (!jsQuote) { - parserInput.restore(); - return; - } - js = parserInput.$re(/^[^`]*`/); - if (js) { - parserInput.forget(); - return new (tree.JavaScript)(js.substr(0, js.length - 1), Boolean(escape), index + currentIndex, fileInfo); - } - parserInput.restore('invalid javascript definition'); - } - }, - // - // The variable part of a variable definition. Used in the `rule` parser - // - // @fink: - // - variable: function () { - var name; - if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^(@[\w-]+)\s*:/))) { - return name[1]; - } - }, - // - // Call a variable value to retrieve a detached ruleset - // or a value from a detached ruleset's rules. - // - // @fink(); - // @fink; - // color: @fink[@color]; - // - variableCall: function (parsedName) { - var lookups; - var i = parserInput.i; - var inValue = !!parsedName; - var name = parsedName; - parserInput.save(); - if (name || (parserInput.currentChar() === '@' - && (name = parserInput.$re(/^(@[\w-]+)(\(\s*\))?/)))) { - lookups = this.mixin.ruleLookups(); - if (!lookups && ((inValue && parserInput.$str('()') !== '()') || (name[2] !== '()'))) { - parserInput.restore('Missing \'[...]\' lookup in variable call'); - return; - } - if (!inValue) { - name = name[1]; - } - var call = new tree.VariableCall(name, i, fileInfo); - if (!inValue && parsers.end()) { - parserInput.forget(); - return call; - } - else { - parserInput.forget(); - return new tree.NamespaceValue(call, lookups, i, fileInfo); - } - } - parserInput.restore(); - }, - // - // extend syntax - used to extend selectors - // - extend: function (isRule) { - var elements; - var e; - var index = parserInput.i; - var option; - var extendList; - var extend; - if (!parserInput.$str(isRule ? '&:extend(' : ':extend(')) { - return; - } - do { - option = null; - elements = null; - var first = true; - while (!(option = parserInput.$re(/^(!?all)(?=\s*(\)|,))/))) { - e = this.element(); - if (!e) { - break; - } - /** - * @note - This will not catch selectors in pseudos like :is() and :where() because - * they don't currently parse their contents as selectors. - */ - if (!first && e.combinator.value) { - warn('Targeting complex selectors can have unexpected behavior, and this behavior may change in the future.', index); - } - first = false; - if (elements) { - elements.push(e); - } - else { - elements = [e]; - } - } - option = option && option[1]; - if (!elements) { - error('Missing target selector for :extend().'); - } - extend = new (tree.Extend)(new (tree.Selector)(elements), option, index + currentIndex, fileInfo); - if (extendList) { - extendList.push(extend); - } - else { - extendList = [extend]; - } - } while (parserInput.$char(',')); - expect(/^\)/); - if (isRule) { - expect(/^;/); - } - return extendList; - }, - // - // extendRule - used in a rule to extend all the parent selectors - // - extendRule: function () { - return this.extend(true); - }, - // - // Mixins - // - mixin: { - // - // A Mixin call, with an optional argument list - // - // #mixins > .square(#fff); - // #mixins.square(#fff); - // .rounded(4px, black); - // .button; - // - // We can lookup / return a value using the lookup syntax: - // - // color: #mixin.square(#fff)[@color]; - // - // The `while` loop is there because mixins can be - // namespaced, but we only support the child and descendant - // selector for now. - // - call: function (inValue, getLookup) { - var s = parserInput.currentChar(); - var important = false; - var lookups; - var index = parserInput.i; - var elements; - var args; - var hasParens; - var parensIndex; - var parensWS = false; - if (s !== '.' && s !== '#') { - return; - } - parserInput.save(); // stop us absorbing part of an invalid selector - elements = this.elements(); - if (elements) { - parensIndex = parserInput.i; - if (parserInput.$char('(')) { - parensWS = parserInput.isWhitespace(-2); - args = this.args(true).args; - expectChar(')'); - hasParens = true; - if (parensWS) { - warn('Whitespace between a mixin name and parentheses for a mixin call is deprecated', parensIndex, 'DEPRECATED'); - } - } - if (getLookup !== false) { - lookups = this.ruleLookups(); - } - if (getLookup === true && !lookups) { - parserInput.restore(); - return; - } - if (inValue && !lookups && !hasParens) { - // This isn't a valid in-value mixin call - parserInput.restore(); - return; - } - if (!inValue && parsers.important()) { - important = true; - } - if (inValue || parsers.end()) { - parserInput.forget(); - var mixin = new (tree.mixin.Call)(elements, args, index + currentIndex, fileInfo, !lookups && important); - if (lookups) { - return new tree.NamespaceValue(mixin, lookups); - } - else { - if (!hasParens) { - warn('Calling a mixin without parentheses is deprecated', parensIndex, 'DEPRECATED'); - } - return mixin; - } - } - } - parserInput.restore(); - }, - /** - * Matching elements for mixins - * (Start with . or # and can have > ) - */ - elements: function () { - var elements; - var e; - var c; - var elem; - var elemIndex; - var re = /^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/; - while (true) { - elemIndex = parserInput.i; - e = parserInput.$re(re); - if (!e) { - break; - } - elem = new (tree.Element)(c, e, false, elemIndex + currentIndex, fileInfo); - if (elements) { - elements.push(elem); - } - else { - elements = [elem]; - } - c = parserInput.$char('>'); - } - return elements; - }, - args: function (isCall) { - var entities = parsers.entities; - var returner = { args: null, variadic: false }; - var expressions = []; - var argsSemiColon = []; - var argsComma = []; - var isSemiColonSeparated; - var expressionContainsNamed; - var name; - var nameLoop; - var value; - var arg; - var expand; - var hasSep = true; - parserInput.save(); - while (true) { - if (isCall) { - arg = parsers.detachedRuleset() || parsers.expression(); - } - else { - parserInput.commentStore.length = 0; - if (parserInput.$str('...')) { - returner.variadic = true; - if (parserInput.$char(';') && !isSemiColonSeparated) { - isSemiColonSeparated = true; - } - (isSemiColonSeparated ? argsSemiColon : argsComma) - .push({ variadic: true }); - break; - } - arg = entities.variable() || entities.property() || entities.literal() || entities.keyword() || this.call(true); - } - if (!arg || !hasSep) { - break; - } - nameLoop = null; - if (arg.throwAwayComments) { - arg.throwAwayComments(); - } - value = arg; - var val = null; - if (isCall) { - // Variable - if (arg.value && arg.value.length == 1) { - val = arg.value[0]; - } - } - else { - val = arg; - } - if (val && (val instanceof tree.Variable || val instanceof tree.Property)) { - if (parserInput.$char(':')) { - if (expressions.length > 0) { - if (isSemiColonSeparated) { - error('Cannot mix ; and , as delimiter types'); - } - expressionContainsNamed = true; - } - value = parsers.detachedRuleset() || parsers.expression(); - if (!value) { - if (isCall) { - error('could not understand value for named argument'); - } - else { - parserInput.restore(); - returner.args = []; - return returner; - } - } - nameLoop = (name = val.name); - } - else if (parserInput.$str('...')) { - if (!isCall) { - returner.variadic = true; - if (parserInput.$char(';') && !isSemiColonSeparated) { - isSemiColonSeparated = true; - } - (isSemiColonSeparated ? argsSemiColon : argsComma) - .push({ name: arg.name, variadic: true }); - break; - } - else { - expand = true; - } - } - else if (!isCall) { - name = nameLoop = val.name; - value = null; - } - } - if (value) { - expressions.push(value); - } - argsComma.push({ name: nameLoop, value: value, expand: expand }); - if (parserInput.$char(',')) { - hasSep = true; - continue; - } - hasSep = parserInput.$char(';') === ';'; - if (hasSep || isSemiColonSeparated) { - if (expressionContainsNamed) { - error('Cannot mix ; and , as delimiter types'); - } - isSemiColonSeparated = true; - if (expressions.length > 1) { - value = new (tree.Value)(expressions); - } - argsSemiColon.push({ name: name, value: value, expand: expand }); - name = null; - expressions = []; - expressionContainsNamed = false; - } - } - parserInput.forget(); - returner.args = isSemiColonSeparated ? argsSemiColon : argsComma; - return returner; - }, - // - // A Mixin definition, with a list of parameters - // - // .rounded (@radius: 2px, @color) { - // ... - // } - // - // Until we have a finer grained state-machine, we have to - // do a look-ahead, to make sure we don't have a mixin call. - // See the `rule` function for more information. - // - // We start by matching `.rounded (`, and then proceed on to - // the argument list, which has optional default values. - // We store the parameters in `params`, with a `value` key, - // if there is a value, such as in the case of `@radius`. - // - // Once we've got our params list, and a closing `)`, we parse - // the `{...}` block. - // - definition: function () { - var name; - var params = []; - var match; - var ruleset; - var cond; - var variadic = false; - if ((parserInput.currentChar() !== '.' && parserInput.currentChar() !== '#') || - parserInput.peek(/^[^{]*\}/)) { - return; - } - parserInput.save(); - match = parserInput.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/); - if (match) { - name = match[1]; - var argInfo = this.args(false); - params = argInfo.args; - variadic = argInfo.variadic; - // .mixincall("@{a}"); - // looks a bit like a mixin definition.. - // also - // .mixincall(@a: {rule: set;}); - // so we have to be nice and restore - if (!parserInput.$char(')')) { - parserInput.restore('Missing closing \')\''); - return; - } - parserInput.commentStore.length = 0; - if (parserInput.$str('when')) { // Guard - cond = expect(parsers.conditions, 'expected condition'); - } - ruleset = parsers.block(); - if (ruleset) { - parserInput.forget(); - return new (tree.mixin.Definition)(name, params, ruleset, cond, variadic); - } - else { - parserInput.restore(); - } - } - else { - parserInput.restore(); - } - }, - ruleLookups: function () { - var rule; - var lookups = []; - if (parserInput.currentChar() !== '[') { - return; - } - while (true) { - parserInput.save(); - rule = this.lookupValue(); - if (!rule && rule !== '') { - parserInput.restore(); - break; - } - lookups.push(rule); - parserInput.forget(); - } - if (lookups.length > 0) { - return lookups; - } - }, - lookupValue: function () { - parserInput.save(); - if (!parserInput.$char('[')) { - parserInput.restore(); - return; - } - var name = parserInput.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/); - if (!parserInput.$char(']')) { - parserInput.restore(); - return; - } - if (name || name === '') { - parserInput.forget(); - return name; - } - parserInput.restore(); - } - }, - // - // Entities are the smallest recognized token, - // and can be found inside a rule's value. - // - entity: function () { - var entities = this.entities; - return this.comment() || entities.literal() || entities.variable() || entities.url() || - entities.property() || entities.call() || entities.keyword() || this.mixin.call(true) || - entities.javascript(); - }, - // - // A Declaration terminator. Note that we use `peek()` to check for '}', - // because the `block` rule will be expecting it, but we still need to make sure - // it's there, if ';' was omitted. - // - end: function () { - return parserInput.$char(';') || parserInput.peek('}'); - }, - // - // IE's alpha function - // - // alpha(opacity=88) - // - ieAlpha: function () { - var value; - // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 - if (!parserInput.$re(/^opacity=/i)) { - return; - } - value = parserInput.$re(/^\d+/); - if (!value) { - value = expect(parsers.entities.variable, 'Could not parse alpha'); - value = "@{".concat(value.name.slice(1), "}"); - } - expectChar(')'); - return new tree.Quoted('', "alpha(opacity=".concat(value, ")")); - }, - /** - * A Selector Element - * - * div - * + h1 - * #socks - * input[type="text"] - * - * Elements are the building blocks for Selectors, - * they are made out of a `Combinator` (see combinator rule), - * and an element name, such as a tag a class, or `*`. - */ - element: function () { - var e; - var c; - var v; - var index = parserInput.i; - c = this.combinator(); - /** This selector parser is quite simplistic and will pass a number of invalid selectors. */ - e = parserInput.$re(/^(?:\d+\.\d+|\d+)%/) || - // eslint-disable-next-line no-control-regex - parserInput.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/) || - parserInput.$char('*') || parserInput.$char('&') || this.attribute() || - parserInput.$re(/^\([^&()@]+\)/) || parserInput.$re(/^[.#:](?=@)/) || - this.entities.variableCurly(); - if (!e) { - parserInput.save(); - if (parserInput.$char('(')) { - if ((v = this.selector(false))) { - var selectors = []; - while (parserInput.$char(',')) { - selectors.push(v); - selectors.push(new Anonymous(',')); - v = this.selector(false); - } - selectors.push(v); - if (parserInput.$char(')')) { - if (selectors.length > 1) { - e = new (tree.Paren)(new Selector(selectors)); - } - else { - e = new (tree.Paren)(v); - } - parserInput.forget(); - } - else { - parserInput.restore('Missing closing \')\''); - } - } - else { - parserInput.restore('Missing closing \')\''); - } - } - else { - parserInput.forget(); - } - } - if (e) { - return new (tree.Element)(c, e, e instanceof tree.Variable, index + currentIndex, fileInfo); - } - }, - // - // Combinators combine elements together, in a Selector. - // - // Because our parser isn't white-space sensitive, special care - // has to be taken, when parsing the descendant combinator, ` `, - // as it's an empty space. We have to check the previous character - // in the input, to see if it's a ` ` character. More info on how - // we deal with this in *combinator.js*. - // - combinator: function () { - var c = parserInput.currentChar(); - if (c === '/') { - parserInput.save(); - var slashedCombinator = parserInput.$re(/^\/[a-z]+\//i); - if (slashedCombinator) { - parserInput.forget(); - return new (tree.Combinator)(slashedCombinator); - } - parserInput.restore(); - } - if (c === '>' || c === '+' || c === '~' || c === '|' || c === '^') { - parserInput.i++; - if (c === '^' && parserInput.currentChar() === '^') { - c = '^^'; - parserInput.i++; - } - while (parserInput.isWhitespace()) { - parserInput.i++; - } - return new (tree.Combinator)(c); - } - else if (parserInput.isWhitespace(-1)) { - return new (tree.Combinator)(' '); - } - else { - return new (tree.Combinator)(null); - } - }, - // - // A CSS Selector - // with less extensions e.g. the ability to extend and guard - // - // .class > div + h1 - // li a:hover - // - // Selectors are made out of one or more Elements, see above. - // - selector: function (isLess) { - var index = parserInput.i; - var elements; - var extendList; - var c; - var e; - var allExtends; - var when; - var condition; - isLess = isLess !== false; - while ((isLess && (extendList = this.extend())) || (isLess && (when = parserInput.$str('when'))) || (e = this.element())) { - if (when) { - condition = expect(this.conditions, 'expected condition'); - } - else if (condition) { - error('CSS guard can only be used at the end of selector'); - } - else if (extendList) { - if (allExtends) { - allExtends = allExtends.concat(extendList); - } - else { - allExtends = extendList; - } - } - else { - if (allExtends) { - error('Extend can only be used at the end of selector'); - } - c = parserInput.currentChar(); - if (Array.isArray(e)) { - e.forEach(function (ele) { return elements.push(ele); }); - } - if (elements) { - elements.push(e); - } - else { - elements = [e]; - } - e = null; - } - if (c === '{' || c === '}' || c === ';' || c === ',' || c === ')') { - break; - } - } - if (elements) { - return new (tree.Selector)(elements, allExtends, condition, index + currentIndex, fileInfo); - } - if (allExtends) { - error('Extend must be used to extend a selector, it cannot be used on its own'); - } - }, - selectors: function () { - var s; - var selectors; - while (true) { - s = this.selector(); - if (!s) { - break; - } - if (selectors) { - selectors.push(s); - } - else { - selectors = [s]; - } - parserInput.commentStore.length = 0; - if (s.condition && selectors.length > 1) { - error('Guards are only currently allowed on a single selector.'); - } - if (!parserInput.$char(',')) { - break; - } - if (s.condition) { - error('Guards are only currently allowed on a single selector.'); - } - parserInput.commentStore.length = 0; - } - return selectors; - }, - attribute: function () { - if (!parserInput.$char('[')) { - return; - } - var entities = this.entities; - var key; - var val; - var op; - // - // case-insensitive flag - // e.g. [attr operator value i] - // - var cif; - if (!(key = entities.variableCurly())) { - key = expect(/^(?:[_A-Za-z0-9-*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/); - } - op = parserInput.$re(/^[|~*$^]?=/); - if (op) { - val = entities.quoted() || parserInput.$re(/^[0-9]+%/) || parserInput.$re(/^[\w-]+/) || entities.variableCurly(); - if (val) { - cif = parserInput.$re(/^[iIsS]/); - } - } - expectChar(']'); - return new (tree.Attribute)(key, op, val, cif); - }, - // - // The `block` rule is used by `ruleset` and `mixin.definition`. - // It's a wrapper around the `primary` rule, with added `{}`. - // - block: function () { - var content; - if (parserInput.$char('{') && (content = this.primary()) && parserInput.$char('}')) { - return content; - } - }, - blockRuleset: function () { - var block = this.block(); - if (block) { - block = new tree.Ruleset(null, block); - } - return block; - }, - detachedRuleset: function () { - var argInfo; - var params; - var variadic; - parserInput.save(); - if (parserInput.$re(/^[.#]\(/)) { - /** - * DR args currently only implemented for each() function, and not - * yet settable as `@dr: #(@arg) {}` - * This should be done when DRs are merged with mixins. - * See: https://github.com/less/less-meta/issues/16 - */ - argInfo = this.mixin.args(false); - params = argInfo.args; - variadic = argInfo.variadic; - if (!parserInput.$char(')')) { - parserInput.restore(); - return; - } - } - var blockRuleset = this.blockRuleset(); - if (blockRuleset) { - parserInput.forget(); - if (params) { - return new tree.mixin.Definition(null, params, blockRuleset, null, variadic); - } - return new tree.DetachedRuleset(blockRuleset); - } - parserInput.restore(); - }, - // - // div, .class, body > p {...} - // - ruleset: function () { - var selectors; - var rules; - var debugInfo; - parserInput.save(); - if (context.dumpLineNumbers) { - debugInfo = getDebugInfo(parserInput.i); - } - selectors = this.selectors(); - if (selectors && (rules = this.block())) { - parserInput.forget(); - var ruleset = new (tree.Ruleset)(selectors, rules, context.strictImports); - if (context.dumpLineNumbers) { - ruleset.debugInfo = debugInfo; - } - return ruleset; - } - else { - parserInput.restore(); - } - }, - declaration: function () { - var name; - var value; - var index = parserInput.i; - var hasDR; - var c = parserInput.currentChar(); - var important; - var merge; - var isVariable; - if (c === '.' || c === '#' || c === '&' || c === ':') { - return; - } - parserInput.save(); - name = this.variable() || this.ruleProperty(); - if (name) { - isVariable = typeof name === 'string'; - if (isVariable) { - value = this.detachedRuleset(); - if (value) { - hasDR = true; - } - } - parserInput.commentStore.length = 0; - if (!value) { - // a name returned by this.ruleProperty() is always an array of the form: - // [string-1, ..., string-n, ""] or [string-1, ..., string-n, "+"] - // where each item is a tree.Keyword or tree.Variable - merge = !isVariable && name.length > 1 && name.pop().value; - // Custom property values get permissive parsing - if (name[0].value && name[0].value.slice(0, 2) === '--') { - if (parserInput.$char(';')) { - value = new Anonymous(''); - } - else { - value = this.permissiveValue(/[;}]/, true); - } - } - // Try to store values as anonymous - // If we need the value later we'll re-parse it in ruleset.parseValue - else { - value = this.anonymousValue(); - } - if (value) { - parserInput.forget(); - // anonymous values absorb the end ';' which is required for them to work - return new (tree.Declaration)(name, value, false, merge, index + currentIndex, fileInfo); - } - if (!value) { - value = this.value(); - } - if (value) { - important = this.important(); - } - else if (isVariable) { - /** - * As a last resort, try permissiveValue - * - * @todo - This has created some knock-on problems of not - * flagging incorrect syntax or detecting user intent. - */ - value = this.permissiveValue(); - } - } - if (value && (this.end() || hasDR)) { - parserInput.forget(); - return new (tree.Declaration)(name, value, important, merge, index + currentIndex, fileInfo); - } - else { - parserInput.restore(); - } - } - else { - parserInput.restore(); - } - }, - anonymousValue: function () { - var index = parserInput.i; - var match = parserInput.$re(/^([^.#@$+/'"*`(;{}-]*);/); - if (match) { - return new (tree.Anonymous)(match[1], index + currentIndex); - } - }, - /** - * Used for custom properties, at-rules, and variables (as fallback) - * Parses almost anything inside of {} [] () "" blocks - * until it reaches outer-most tokens. - * - * First, it will try to parse comments and entities to reach - * the end. This is mostly like the Expression parser except no - * math is allowed. - * - * @param {RexExp} untilTokens - Characters to stop parsing at - */ - permissiveValue: function (untilTokens) { - var i; - var e; - var done; - var value; - var tok = untilTokens || ';'; - var index = parserInput.i; - var result = []; - function testCurrentChar() { - var char = parserInput.currentChar(); - if (typeof tok === 'string') { - return char === tok; - } - else { - return tok.test(char); - } - } - if (testCurrentChar()) { - return; - } - value = []; - do { - e = this.comment(); - if (e) { - value.push(e); - continue; - } - e = this.entity(); - if (e) { - value.push(e); - } - if (parserInput.peek(',')) { - value.push(new (tree.Anonymous)(',', parserInput.i)); - parserInput.$char(','); - } - } while (e); - done = testCurrentChar(); - if (value.length > 0) { - value = new (tree.Expression)(value); - if (done) { - return value; - } - else { - result.push(value); - } - // Preserve space before $parseUntil as it will not - if (parserInput.prevChar() === ' ') { - result.push(new tree.Anonymous(' ', index)); - } - } - parserInput.save(); - value = parserInput.$parseUntil(tok); - if (value) { - if (typeof value === 'string') { - error("Expected '".concat(value, "'"), 'Parse'); - } - if (value.length === 1 && value[0] === ' ') { - parserInput.forget(); - return new tree.Anonymous('', index); - } - /** @type {string} */ - var item = void 0; - for (i = 0; i < value.length; i++) { - item = value[i]; - if (Array.isArray(item)) { - // Treat actual quotes as normal quoted values - result.push(new tree.Quoted(item[0], item[1], true, index, fileInfo)); - } - else { - if (i === value.length - 1) { - item = item.trim(); - } - // Treat like quoted values, but replace vars like unquoted expressions - var quote = new tree.Quoted('\'', item, true, index, fileInfo); - var variableRegex = /@([\w-]+)/g; - var propRegex = /\$([\w-]+)/g; - if (variableRegex.test(item)) { - warn('@[ident] in unknown values will not be evaluated as variables in the future. Use @{[ident]}', index, 'DEPRECATED'); - } - if (propRegex.test(item)) { - warn('$[ident] in unknown values will not be evaluated as property references in the future. Use ${[ident]}', index, 'DEPRECATED'); - } - quote.variableRegex = /@([\w-]+)|@{([\w-]+)}/g; - quote.propRegex = /\$([\w-]+)|\${([\w-]+)}/g; - result.push(quote); - } - } - parserInput.forget(); - return new tree.Expression(result, true); - } - parserInput.restore(); - }, - // - // An @import atrule - // - // @import "lib"; - // - // Depending on our environment, importing is done differently: - // In the browser, it's an XHR request, in Node, it would be a - // file-system operation. The function used for importing is - // stored in `import`, which we pass to the Import constructor. - // - 'import': function () { - var path; - var features; - var index = parserInput.i; - var dir = parserInput.$re(/^@import\s+/); - if (dir) { - var options = (dir ? this.importOptions() : null) || {}; - if ((path = this.entities.quoted() || this.entities.url())) { - features = this.mediaFeatures({}); - if (!parserInput.$char(';')) { - parserInput.i = index; - error('missing semi-colon or unrecognised media features on import'); - } - features = features && new (tree.Value)(features); - return new (tree.Import)(path, features, options, index + currentIndex, fileInfo); - } - else { - parserInput.i = index; - error('malformed import statement'); - } - } - }, - importOptions: function () { - var o; - var options = {}; - var optionName; - var value; - // list of options, surrounded by parens - if (!parserInput.$char('(')) { - return null; - } - do { - o = this.importOption(); - if (o) { - optionName = o; - value = true; - switch (optionName) { - case 'css': - optionName = 'less'; - value = false; - break; - case 'once': - optionName = 'multiple'; - value = false; - break; - } - options[optionName] = value; - if (!parserInput.$char(',')) { - break; - } - } - } while (o); - expectChar(')'); - return options; - }, - importOption: function () { - var opt = parserInput.$re(/^(less|css|multiple|once|inline|reference|optional)/); - if (opt) { - return opt[1]; - } - }, - mediaFeature: function (syntaxOptions) { - var entities = this.entities; - var nodes = []; - var e; - var p; - var rangeP; - var spacing = false; - parserInput.save(); - do { - parserInput.save(); - if (parserInput.$re(/^[0-9a-z-]*\s+\(/)) { - spacing = true; - } - parserInput.restore(); - e = entities.declarationCall.bind(this)() || entities.keyword() || entities.variable() || entities.mixinLookup(); - if (e) { - nodes.push(e); - } - else if (parserInput.$char('(')) { - p = this.property(); - parserInput.save(); - if (!p && syntaxOptions.queryInParens && parserInput.$re(/^[0-9a-z-]*\s*([<>]=|<=|>=|[<>]|=)/)) { - parserInput.restore(); - p = this.condition(); - parserInput.save(); - rangeP = this.atomicCondition(null, p.rvalue); - if (!rangeP) { - parserInput.restore(); - } - } - else { - parserInput.restore(); - e = this.value(); - } - if (parserInput.$char(')')) { - if (p && !e) { - nodes.push(new (tree.Paren)(new (tree.QueryInParens)(p.op, p.lvalue, p.rvalue, rangeP ? rangeP.op : null, rangeP ? rangeP.rvalue : null, p._index))); - e = p; - } - else if (p && e) { - nodes.push(new (tree.Paren)(new (tree.Declaration)(p, e, null, null, parserInput.i + currentIndex, fileInfo, true))); - if (!spacing) { - nodes[nodes.length - 1].noSpacing = true; - } - spacing = false; - } - else if (e) { - nodes.push(new (tree.Paren)(e)); - spacing = false; - } - else { - error('badly formed media feature definition'); - } - } - else { - error('Missing closing \')\'', 'Parse'); - } - } - } while (e); - parserInput.forget(); - if (nodes.length > 0) { - return new (tree.Expression)(nodes); - } - }, - mediaFeatures: function (syntaxOptions) { - var entities = this.entities; - var features = []; - var e; - do { - e = this.mediaFeature(syntaxOptions); - if (e) { - features.push(e); - if (!parserInput.$char(',')) { - break; - } - else if (!features[features.length - 1].noSpacing) { - features[features.length - 1].noSpacing = false; - } - } - else { - e = entities.variable() || entities.mixinLookup(); - if (e) { - features.push(e); - if (!parserInput.$char(',')) { - break; - } - else if (!features[features.length - 1].noSpacing) { - features[features.length - 1].noSpacing = false; - } - } - } - } while (e); - return features.length > 0 ? features : null; - }, - prepareAndGetNestableAtRule: function (treeType, index, debugInfo, syntaxOptions) { - var features = this.mediaFeatures(syntaxOptions); - var rules = this.block(); - if (!rules) { - error('media definitions require block statements after any features'); - } - parserInput.forget(); - var atRule = new (treeType)(rules, features, index + currentIndex, fileInfo); - if (context.dumpLineNumbers) { - atRule.debugInfo = debugInfo; - } - return atRule; - }, - nestableAtRule: function () { - var debugInfo; - var index = parserInput.i; - if (context.dumpLineNumbers) { - debugInfo = getDebugInfo(index); - } - parserInput.save(); - if (parserInput.$peekChar('@')) { - if (parserInput.$str('@media')) { - return this.prepareAndGetNestableAtRule(tree.Media, index, debugInfo, MediaSyntaxOptions); - } - if (parserInput.$str('@container')) { - return this.prepareAndGetNestableAtRule(tree.Container, index, debugInfo, ContainerSyntaxOptions); - } - } - parserInput.restore(); - }, - // - // A @plugin directive, used to import plugins dynamically. - // - // @plugin (args) "lib"; - // - plugin: function () { - var path; - var args; - var options; - var index = parserInput.i; - var dir = parserInput.$re(/^@plugin\s+/); - if (dir) { - args = this.pluginArgs(); - if (args) { - options = { - pluginArgs: args, - isPlugin: true - }; - } - else { - options = { isPlugin: true }; - } - if ((path = this.entities.quoted() || this.entities.url())) { - if (!parserInput.$char(';')) { - parserInput.i = index; - error('missing semi-colon on @plugin'); - } - return new (tree.Import)(path, null, options, index + currentIndex, fileInfo); - } - else { - parserInput.i = index; - error('malformed @plugin statement'); - } - } - }, - pluginArgs: function () { - // list of options, surrounded by parens - parserInput.save(); - if (!parserInput.$char('(')) { - parserInput.restore(); - return null; - } - var args = parserInput.$re(/^\s*([^);]+)\)\s*/); - if (args[1]) { - parserInput.forget(); - return args[1].trim(); - } - else { - parserInput.restore(); - return null; - } - }, - atruleUnknown: function (value, name, hasBlock) { - value = this.permissiveValue(/^[{;]/); - hasBlock = (parserInput.currentChar() === '{'); - if (!value) { - if (!hasBlock && parserInput.currentChar() !== ';') { - error(''.concat(name, ' rule is missing block or ending semi-colon')); - } - } - else if (!value.value) { - value = null; - } - return [value, hasBlock]; - }, - atruleBlock: function (rules, value, isRooted, isKeywordList) { - rules = this.blockRuleset(); - parserInput.save(); - if (!rules && !isRooted) { - value = this.entity(); - rules = this.blockRuleset(); - } - if (!rules && !isRooted) { - parserInput.restore(); - var e = []; - value = this.entity(); - while (parserInput.$char(',')) { - e.push(value); - value = this.entity(); - } - if (value && e.length > 0) { - e.push(value); - value = e; - isKeywordList = true; - } - else { - rules = this.blockRuleset(); - } - } - else { - parserInput.forget(); - } - return [rules, value, isKeywordList]; - }, - // - // A CSS AtRule - // - // @charset "utf-8"; - // - atrule: function () { - var index = parserInput.i; - var name; - var value; - var rules; - var nonVendorSpecificName; - var hasIdentifier; - var hasExpression; - var hasUnknown; - var hasBlock = true; - var isRooted = true; - var isKeywordList = false; - if (parserInput.currentChar() !== '@') { - return; - } - value = this['import']() || this.plugin() || this.nestableAtRule(); - if (value) { - return value; - } - parserInput.save(); - name = parserInput.$re(/^@[a-z-]+/); - if (!name) { - return; - } - nonVendorSpecificName = name; - if (name.charAt(1) == '-' && name.indexOf('-', 2) > 0) { - nonVendorSpecificName = "@".concat(name.slice(name.indexOf('-', 2) + 1)); - } - switch (nonVendorSpecificName) { - case '@charset': - hasIdentifier = true; - hasBlock = false; - break; - case '@namespace': - hasExpression = true; - hasBlock = false; - break; - case '@keyframes': - case '@counter-style': - hasIdentifier = true; - break; - case '@document': - case '@supports': - hasUnknown = true; - isRooted = false; - break; - case '@starting-style': - isRooted = false; - break; - case '@layer': - isRooted = false; - break; - default: - hasUnknown = true; - break; - } - parserInput.commentStore.length = 0; - if (hasIdentifier) { - value = this.entity(); - if (!value) { - error("expected ".concat(name, " identifier")); - } - } - else if (hasExpression) { - value = this.expression(); - if (!value) { - error("expected ".concat(name, " expression")); - } - } - else if (hasUnknown) { - var unknownPackage = this.atruleUnknown(value, name, hasBlock); - value = unknownPackage[0]; - hasBlock = unknownPackage[1]; - } - if (hasBlock) { - var blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList); - rules = blockPackage[0]; - value = blockPackage[1]; - isKeywordList = blockPackage[2]; - if (!rules && !hasUnknown) { - parserInput.restore(); - name = parserInput.$re(/^@[a-z-]+/); - var unknownPackage = this.atruleUnknown(value, name, hasBlock); - value = unknownPackage[0]; - hasBlock = unknownPackage[1]; - if (hasBlock) { - blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList); - rules = blockPackage[0]; - value = blockPackage[1]; - isKeywordList = blockPackage[2]; - } - } - } - if (rules || isKeywordList || (!hasBlock && value && parserInput.$char(';'))) { - parserInput.forget(); - return new (tree.AtRule)(name, value, rules, index + currentIndex, fileInfo, context.dumpLineNumbers ? getDebugInfo(index) : null, isRooted); - } - parserInput.restore('at-rule options not recognised'); - }, - // - // A Value is a comma-delimited list of Expressions - // - // font-family: Baskerville, Georgia, serif; - // - // In a Rule, a Value represents everything after the `:`, - // and before the `;`. - // - value: function () { - var e; - var expressions = []; - var index = parserInput.i; - do { - e = this.expression(); - if (e) { - expressions.push(e); - if (!parserInput.$char(',')) { - break; - } - } - } while (e); - if (expressions.length > 0) { - return new (tree.Value)(expressions, index + currentIndex); - } - }, - important: function () { - if (parserInput.currentChar() === '!') { - return parserInput.$re(/^! *important/); - } - }, - sub: function () { - var a; - var e; - parserInput.save(); - if (parserInput.$char('(')) { - a = this.addition(); - if (a && parserInput.$char(')')) { - parserInput.forget(); - e = new (tree.Expression)([a]); - e.parens = true; - return e; - } - parserInput.restore('Expected \')\''); - return; - } - parserInput.restore(); - }, - colorOperand: function () { - parserInput.save(); - // hsl or rgb or lch operand - var match = parserInput.$re(/^[lchrgbs]\s+/); - if (match) { - return new tree.Keyword(match[0]); - } - parserInput.restore(); - }, - multiplication: function () { - var m; - var a; - var op; - var operation; - var isSpaced; - m = this.operand(); - if (m) { - isSpaced = parserInput.isWhitespace(-1); - while (true) { - if (parserInput.peek(/^\/[*/]/)) { - break; - } - parserInput.save(); - op = parserInput.$char('/') || parserInput.$char('*'); - if (!op) { - var index = parserInput.i; - op = parserInput.$str('./'); - if (op) { - warn('./ operator is deprecated', index, 'DEPRECATED'); - } - } - if (!op) { - parserInput.forget(); - break; - } - a = this.operand(); - if (!a) { - parserInput.restore(); - break; - } - parserInput.forget(); - m.parensInOp = true; - a.parensInOp = true; - operation = new (tree.Operation)(op, [operation || m, a], isSpaced); - isSpaced = parserInput.isWhitespace(-1); - } - return operation || m; - } - }, - addition: function () { - var m; - var a; - var op; - var operation; - var isSpaced; - m = this.multiplication(); - if (m) { - isSpaced = parserInput.isWhitespace(-1); - while (true) { - op = parserInput.$re(/^[-+]\s+/) || (!isSpaced && (parserInput.$char('+') || parserInput.$char('-'))); - if (!op) { - break; - } - a = this.multiplication(); - if (!a) { - break; - } - m.parensInOp = true; - a.parensInOp = true; - operation = new (tree.Operation)(op, [operation || m, a], isSpaced); - isSpaced = parserInput.isWhitespace(-1); - } - return operation || m; - } - }, - conditions: function () { - var a; - var b; - var index = parserInput.i; - var condition; - a = this.condition(true); - if (a) { - while (true) { - if (!parserInput.peek(/^,\s*(not\s*)?\(/) || !parserInput.$char(',')) { - break; - } - b = this.condition(true); - if (!b) { - break; - } - condition = new (tree.Condition)('or', condition || a, b, index + currentIndex); - } - return condition || a; - } - }, - condition: function (needsParens) { - var result; - var logical; - var next; - function or() { - return parserInput.$str('or'); - } - result = this.conditionAnd(needsParens); - if (!result) { - return; - } - logical = or(); - if (logical) { - next = this.condition(needsParens); - if (next) { - result = new (tree.Condition)(logical, result, next); - } - else { - return; - } - } - return result; - }, - conditionAnd: function (needsParens) { - var result; - var logical; - var next; - var self = this; - function insideCondition() { - var cond = self.negatedCondition(needsParens) || self.parenthesisCondition(needsParens); - if (!cond && !needsParens) { - return self.atomicCondition(needsParens); - } - return cond; - } - function and() { - return parserInput.$str('and'); - } - result = insideCondition(); - if (!result) { - return; - } - logical = and(); - if (logical) { - next = this.conditionAnd(needsParens); - if (next) { - result = new (tree.Condition)(logical, result, next); - } - else { - return; - } - } - return result; - }, - negatedCondition: function (needsParens) { - if (parserInput.$str('not')) { - var result = this.parenthesisCondition(needsParens); - if (result) { - result.negate = !result.negate; - } - return result; - } - }, - parenthesisCondition: function (needsParens) { - function tryConditionFollowedByParenthesis(me) { - var body; - parserInput.save(); - body = me.condition(needsParens); - if (!body) { - parserInput.restore(); - return; - } - if (!parserInput.$char(')')) { - parserInput.restore(); - return; - } - parserInput.forget(); - return body; - } - var body; - parserInput.save(); - if (!parserInput.$str('(')) { - parserInput.restore(); - return; - } - body = tryConditionFollowedByParenthesis(this); - if (body) { - parserInput.forget(); - return body; - } - body = this.atomicCondition(needsParens); - if (!body) { - parserInput.restore(); - return; - } - if (!parserInput.$char(')')) { - parserInput.restore("expected ')' got '".concat(parserInput.currentChar(), "'")); - return; - } - parserInput.forget(); - return body; - }, - atomicCondition: function (needsParens, preparsedCond) { - var entities = this.entities; - var index = parserInput.i; - var a; - var b; - var c; - var op; - var cond = (function () { - return this.addition() || entities.keyword() || entities.quoted() || entities.mixinLookup(); - }).bind(this); - if (preparsedCond) { - a = preparsedCond; - } - else { - a = cond(); - } - if (a) { - if (parserInput.$char('>')) { - if (parserInput.$char('=')) { - op = '>='; - } - else { - op = '>'; - } - } - else if (parserInput.$char('<')) { - if (parserInput.$char('=')) { - op = '<='; - } - else { - op = '<'; - } - } - else if (parserInput.$char('=')) { - if (parserInput.$char('>')) { - op = '=>'; - } - else if (parserInput.$char('<')) { - op = '=<'; - } - else { - op = '='; - } - } - if (op) { - b = cond(); - if (b) { - c = new (tree.Condition)(op, a, b, index + currentIndex, false); - } - else { - error('expected expression'); - } - } - else if (!preparsedCond) { - c = new (tree.Condition)('=', a, new (tree.Keyword)('true'), index + currentIndex, false); - } - return c; - } - }, - // - // An operand is anything that can be part of an operation, - // such as a Color, or a Variable - // - operand: function () { - var entities = this.entities; - var negate; - if (parserInput.peek(/^-[@$(]/)) { - negate = parserInput.$char('-'); - } - var o = this.sub() || entities.dimension() || - entities.color() || entities.variable() || - entities.property() || entities.call() || - entities.quoted(true) || entities.colorKeyword() || - this.colorOperand() || entities.mixinLookup(); - if (negate) { - o.parensInOp = true; - o = new (tree.Negative)(o); - } - return o; - }, - // - // Expressions either represent mathematical operations, - // or white-space delimited Entities. - // - // 1px solid black - // @var * 2 - // - expression: function () { - var entities = []; - var e; - var delim; - var index = parserInput.i; - do { - e = this.comment(); - if (e && !e.isLineComment) { - entities.push(e); - continue; - } - e = this.addition() || this.entity(); - if (e instanceof tree.Comment) { - e = null; - } - if (e) { - entities.push(e); - // operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here - if (!parserInput.peek(/^\/[/*]/)) { - delim = parserInput.$char('/'); - if (delim) { - entities.push(new (tree.Anonymous)(delim, index + currentIndex)); - } - } - } - } while (e); - if (entities.length > 0) { - return new (tree.Expression)(entities); - } - }, - property: function () { - var name = parserInput.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/); - if (name) { - return name[1]; - } - }, - ruleProperty: function () { - var name = []; - var index = []; - var s; - var k; - parserInput.save(); - var simpleProperty = parserInput.$re(/^([_a-zA-Z0-9-]+)\s*:/); - if (simpleProperty) { - name = [new (tree.Keyword)(simpleProperty[1])]; - parserInput.forget(); - return name; - } - function match(re) { - var i = parserInput.i; - var chunk = parserInput.$re(re); - if (chunk) { - index.push(i); - return name.push(chunk[1]); - } - } - match(/^(\*?)/); - while (true) { - if (!match(/^((?:[\w-]+)|(?:[@$]\{[\w-]+\}))/)) { - break; - } - } - if ((name.length > 1) && match(/^((?:\+_|\+)?)\s*:/)) { - parserInput.forget(); - // at last, we have the complete match now. move forward, - // convert name particles to tree objects and return: - if (name[0] === '') { - name.shift(); - index.shift(); - } - for (k = 0; k < name.length; k++) { - s = name[k]; - name[k] = (s.charAt(0) !== '@' && s.charAt(0) !== '$') ? - new (tree.Keyword)(s) : - (s.charAt(0) === '@' ? - new (tree.Variable)("@".concat(s.slice(2, -1)), index[k] + currentIndex, fileInfo) : - new (tree.Property)("$".concat(s.slice(2, -1)), index[k] + currentIndex, fileInfo)); - } - return name; - } - parserInput.restore(); - } - } - }; - }; - Parser.serializeVars = function (vars) { - var s = ''; - for (var name_1 in vars) { - if (Object.hasOwnProperty.call(vars, name_1)) { - var value = vars[name_1]; - s += "".concat(((name_1[0] === '@') ? '' : '@') + name_1, ": ").concat(value).concat((String(value).slice(-1) === ';') ? '' : ';'); - } - } - return s; - }; - - var Selector = function (elements, extendList, condition, index, currentFileInfo, visibilityInfo) { - this.extendList = extendList; - this.condition = condition; - this.evaldCondition = !condition; - this._index = index; - this._fileInfo = currentFileInfo; - this.elements = this.getElements(elements); - this.mixinElements_ = undefined; - this.copyVisibilityInfo(visibilityInfo); - this.setParent(this.elements, this); - }; - Selector.prototype = Object.assign(new Node(), { - type: 'Selector', - accept: function (visitor) { - if (this.elements) { - this.elements = visitor.visitArray(this.elements); - } - if (this.extendList) { - this.extendList = visitor.visitArray(this.extendList); - } - if (this.condition) { - this.condition = visitor.visit(this.condition); - } - }, - createDerived: function (elements, extendList, evaldCondition) { - elements = this.getElements(elements); - var newSelector = new Selector(elements, extendList || this.extendList, null, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - newSelector.evaldCondition = (!isNullOrUndefined(evaldCondition)) ? evaldCondition : this.evaldCondition; - newSelector.mediaEmpty = this.mediaEmpty; - return newSelector; - }, - getElements: function (els) { - if (!els) { - return [new Element('', '&', false, this._index, this._fileInfo)]; - } - if (typeof els === 'string') { - new Parser(this.parse.context, this.parse.importManager, this._fileInfo, this._index).parseNode(els, ['selector'], function (err, result) { - if (err) { - throw new LessError({ - index: err.index, - message: err.message - }, this.parse.imports, this._fileInfo.filename); - } - els = result[0].elements; - }); - } - return els; - }, - createEmptySelectors: function () { - var el = new Element('', '&', false, this._index, this._fileInfo), sels = [new Selector([el], null, null, this._index, this._fileInfo)]; - sels[0].mediaEmpty = true; - return sels; - }, - match: function (other) { - var elements = this.elements; - var len = elements.length; - var olen; - var i; - other = other.mixinElements(); - olen = other.length; - if (olen === 0 || len < olen) { - return 0; - } - else { - for (i = 0; i < olen; i++) { - if (elements[i].value !== other[i]) { - return 0; - } - } - } - return olen; // return number of matched elements - }, - mixinElements: function () { - if (this.mixinElements_) { - return this.mixinElements_; - } - var elements = this.elements.map(function (v) { - return v.combinator.value + (v.value.value || v.value); - }).join('').match(/[,&#*.\w-]([\w-]|(\\.))*/g); - if (elements) { - if (elements[0] === '&') { - elements.shift(); - } - } - else { - elements = []; - } - return (this.mixinElements_ = elements); - }, - isJustParentSelector: function () { - return !this.mediaEmpty && - this.elements.length === 1 && - this.elements[0].value === '&' && - (this.elements[0].combinator.value === ' ' || this.elements[0].combinator.value === ''); - }, - eval: function (context) { - var evaldCondition = this.condition && this.condition.eval(context); - var elements = this.elements; - var extendList = this.extendList; - elements = elements && elements.map(function (e) { return e.eval(context); }); - extendList = extendList && extendList.map(function (extend) { return extend.eval(context); }); - return this.createDerived(elements, extendList, evaldCondition); - }, - genCSS: function (context, output) { - var i, element; - if ((!context || !context.firstSelector) && this.elements[0].combinator.value === '') { - output.add(' ', this.fileInfo(), this.getIndex()); - } - for (i = 0; i < this.elements.length; i++) { - element = this.elements[i]; - element.genCSS(context, output); - } - }, - getIsOutput: function () { - return this.evaldCondition; - } - }); - - var Value = function (value) { - if (!value) { - throw new Error('Value requires an array argument'); - } - if (!Array.isArray(value)) { - this.value = [value]; - } - else { - this.value = value; - } - }; - Value.prototype = Object.assign(new Node(), { - type: 'Value', - accept: function (visitor) { - if (this.value) { - this.value = visitor.visitArray(this.value); - } - }, - eval: function (context) { - if (this.value.length === 1) { - return this.value[0].eval(context); - } - else { - return new Value(this.value.map(function (v) { - return v.eval(context); - })); - } - }, - genCSS: function (context, output) { - var i; - for (i = 0; i < this.value.length; i++) { - this.value[i].genCSS(context, output); - if (i + 1 < this.value.length) { - output.add((context && context.compress) ? ',' : ', '); - } - } - } - }); - - var Keyword = function (value) { - this.value = value; - }; - Keyword.prototype = Object.assign(new Node(), { - type: 'Keyword', - genCSS: function (context, output) { - if (this.value === '%') { - throw { type: 'Syntax', message: 'Invalid % without number' }; - } - output.add(this.value); - } - }); - Keyword.True = new Keyword('true'); - Keyword.False = new Keyword('false'); - - var MATH$1 = Math$1; - function evalName(context, name) { - var value = ''; - var i; - var n = name.length; - var output = { add: function (s) { value += s; } }; - for (i = 0; i < n; i++) { - name[i].eval(context).genCSS(context, output); - } - return value; - } - var Declaration = function (name, value, important, merge, index, currentFileInfo, inline, variable) { - this.name = name; - this.value = (value instanceof Node) ? value : new Value([value ? new Anonymous(value) : null]); - this.important = important ? " ".concat(important.trim()) : ''; - this.merge = merge; - this._index = index; - this._fileInfo = currentFileInfo; - this.inline = inline || false; - this.variable = (variable !== undefined) ? variable - : (name.charAt && (name.charAt(0) === '@')); - this.allowRoot = true; - this.setParent(this.value, this); - }; - Declaration.prototype = Object.assign(new Node(), { - type: 'Declaration', - genCSS: function (context, output) { - output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex()); - try { - this.value.genCSS(context, output); - } - catch (e) { - e.index = this._index; - e.filename = this._fileInfo.filename; - throw e; - } - output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? '' : ';'), this._fileInfo, this._index); - }, - eval: function (context) { - var mathBypass = false, prevMath, name = this.name, evaldValue, variable = this.variable; - if (typeof name !== 'string') { - // expand 'primitive' name directly to get - // things faster (~10% for benchmark.less): - name = (name.length === 1) && (name[0] instanceof Keyword) ? - name[0].value : evalName(context, name); - variable = false; // never treat expanded interpolation as new variable name - } - // @todo remove when parens-division is default - if (name === 'font' && context.math === MATH$1.ALWAYS) { - mathBypass = true; - prevMath = context.math; - context.math = MATH$1.PARENS_DIVISION; - } - try { - context.importantScope.push({}); - evaldValue = this.value.eval(context); - if (!this.variable && evaldValue.type === 'DetachedRuleset') { - throw { message: 'Rulesets cannot be evaluated on a property.', - index: this.getIndex(), filename: this.fileInfo().filename }; - } - var important = this.important; - var importantResult = context.importantScope.pop(); - if (!important && importantResult.important) { - important = importantResult.important; - } - return new Declaration(name, evaldValue, important, this.merge, this.getIndex(), this.fileInfo(), this.inline, variable); - } - catch (e) { - if (typeof e.index !== 'number') { - e.index = this.getIndex(); - e.filename = this.fileInfo().filename; - } - throw e; - } - finally { - if (mathBypass) { - context.math = prevMath; - } - } - }, - makeImportant: function () { - return new Declaration(this.name, this.value, '!important', this.merge, this.getIndex(), this.fileInfo(), this.inline); - } - }); - - function asComment(ctx) { - return "/* line ".concat(ctx.debugInfo.lineNumber, ", ").concat(ctx.debugInfo.fileName, " */\n"); - } - function asMediaQuery(ctx) { - var filenameWithProtocol = ctx.debugInfo.fileName; - if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) { - filenameWithProtocol = "file://".concat(filenameWithProtocol); - } - return "@media -sass-debug-info{filename{font-family:".concat(filenameWithProtocol.replace(/([.:/\\])/g, function (a) { - if (a == '\\') { - a = '/'; - } - return "\\".concat(a); - }), "}line{font-family:\\00003").concat(ctx.debugInfo.lineNumber, "}}\n"); - } - function debugInfo(context, ctx, lineSeparator) { - var result = ''; - if (context.dumpLineNumbers && !context.compress) { - switch (context.dumpLineNumbers) { - case 'comments': - result = asComment(ctx); - break; - case 'mediaquery': - result = asMediaQuery(ctx); - break; - case 'all': - result = asComment(ctx) + (lineSeparator || '') + asMediaQuery(ctx); - break; - } - } - return result; - } - - var Comment = function (value, isLineComment, index, currentFileInfo) { - this.value = value; - this.isLineComment = isLineComment; - this._index = index; - this._fileInfo = currentFileInfo; - this.allowRoot = true; - }; - Comment.prototype = Object.assign(new Node(), { - type: 'Comment', - genCSS: function (context, output) { - if (this.debugInfo) { - output.add(debugInfo(context, this), this.fileInfo(), this.getIndex()); - } - output.add(this.value); - }, - isSilent: function (context) { - var isCompressed = context.compress && this.value[2] !== '!'; - return this.isLineComment || isCompressed; - } - }); - - var defaultFunc = { - eval: function () { - var v = this.value_; - var e = this.error_; - if (e) { - throw e; - } - if (!isNullOrUndefined(v)) { - return v ? Keyword.True : Keyword.False; - } - }, - value: function (v) { - this.value_ = v; - }, - error: function (e) { - this.error_ = e; - }, - reset: function () { - this.value_ = this.error_ = null; - } - }; - - var Ruleset = function (selectors, rules, strictImports, visibilityInfo) { - this.selectors = selectors; - this.rules = rules; - this._lookups = {}; - this._variables = null; - this._properties = null; - this.strictImports = strictImports; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - this.setParent(this.selectors, this); - this.setParent(this.rules, this); - }; - Ruleset.prototype = Object.assign(new Node(), { - type: 'Ruleset', - isRuleset: true, - isRulesetLike: function () { return true; }, - accept: function (visitor) { - if (this.paths) { - this.paths = visitor.visitArray(this.paths, true); - } - else if (this.selectors) { - this.selectors = visitor.visitArray(this.selectors); - } - if (this.rules && this.rules.length) { - this.rules = visitor.visitArray(this.rules); - } - }, - eval: function (context) { - var selectors; - var selCnt; - var selector; - var i; - var hasVariable; - var hasOnePassingSelector = false; - if (this.selectors && (selCnt = this.selectors.length)) { - selectors = new Array(selCnt); - defaultFunc.error({ - type: 'Syntax', - message: 'it is currently only allowed in parametric mixin guards,' - }); - for (i = 0; i < selCnt; i++) { - selector = this.selectors[i].eval(context); - for (var j = 0; j < selector.elements.length; j++) { - if (selector.elements[j].isVariable) { - hasVariable = true; - break; - } - } - selectors[i] = selector; - if (selector.evaldCondition) { - hasOnePassingSelector = true; - } - } - if (hasVariable) { - var toParseSelectors = new Array(selCnt); - for (i = 0; i < selCnt; i++) { - selector = selectors[i]; - toParseSelectors[i] = selector.toCSS(context); - } - var startingIndex = selectors[0].getIndex(); - var selectorFileInfo = selectors[0].fileInfo(); - new Parser(context, this.parse.importManager, selectorFileInfo, startingIndex).parseNode(toParseSelectors.join(','), ['selectors'], function (err, result) { - if (result) { - selectors = flattenArray(result); - } - }); - } - defaultFunc.reset(); - } - else { - hasOnePassingSelector = true; - } - var rules = this.rules ? copyArray(this.rules) : null; - var ruleset = new Ruleset(selectors, rules, this.strictImports, this.visibilityInfo()); - var rule; - var subRule; - ruleset.originalRuleset = this; - ruleset.root = this.root; - ruleset.firstRoot = this.firstRoot; - ruleset.allowImports = this.allowImports; - if (this.debugInfo) { - ruleset.debugInfo = this.debugInfo; - } - if (!hasOnePassingSelector) { - rules.length = 0; - } - // inherit a function registry from the frames stack when possible; - // otherwise from the global registry - ruleset.functionRegistry = (function (frames) { - var i = 0; - var n = frames.length; - var found; - for (; i !== n; ++i) { - found = frames[i].functionRegistry; - if (found) { - return found; - } - } - return functionRegistry; - }(context.frames)).inherit(); - // push the current ruleset to the frames stack - var ctxFrames = context.frames; - ctxFrames.unshift(ruleset); - // currrent selectors - var ctxSelectors = context.selectors; - if (!ctxSelectors) { - context.selectors = ctxSelectors = []; - } - ctxSelectors.unshift(this.selectors); - // Evaluate imports - if (ruleset.root || ruleset.allowImports || !ruleset.strictImports) { - ruleset.evalImports(context); - } - // Store the frames around mixin definitions, - // so they can be evaluated like closures when the time comes. - var rsRules = ruleset.rules; - for (i = 0; (rule = rsRules[i]); i++) { - if (rule.evalFirst) { - rsRules[i] = rule.eval(context); - } - } - var mediaBlockCount = (context.mediaBlocks && context.mediaBlocks.length) || 0; - // Evaluate mixin calls. - for (i = 0; (rule = rsRules[i]); i++) { - if (rule.type === 'MixinCall') { - /* jshint loopfunc:true */ - rules = rule.eval(context).filter(function (r) { - if ((r instanceof Declaration) && r.variable) { - // do not pollute the scope if the variable is - // already there. consider returning false here - // but we need a way to "return" variable from mixins - return !(ruleset.variable(r.name)); - } - return true; - }); - rsRules.splice.apply(rsRules, [i, 1].concat(rules)); - i += rules.length - 1; - ruleset.resetCache(); - } - else if (rule.type === 'VariableCall') { - /* jshint loopfunc:true */ - rules = rule.eval(context).rules.filter(function (r) { - if ((r instanceof Declaration) && r.variable) { - // do not pollute the scope at all - return false; - } - return true; - }); - rsRules.splice.apply(rsRules, [i, 1].concat(rules)); - i += rules.length - 1; - ruleset.resetCache(); - } - } - // Evaluate everything else - for (i = 0; (rule = rsRules[i]); i++) { - if (!rule.evalFirst) { - rsRules[i] = rule = rule.eval ? rule.eval(context) : rule; - } - } - // Evaluate everything else - for (i = 0; (rule = rsRules[i]); i++) { - // for rulesets, check if it is a css guard and can be removed - if (rule instanceof Ruleset && rule.selectors && rule.selectors.length === 1) { - // check if it can be folded in (e.g. & where) - if (rule.selectors[0] && rule.selectors[0].isJustParentSelector()) { - rsRules.splice(i--, 1); - for (var j = 0; (subRule = rule.rules[j]); j++) { - if (subRule instanceof Node) { - subRule.copyVisibilityInfo(rule.visibilityInfo()); - if (!(subRule instanceof Declaration) || !subRule.variable) { - rsRules.splice(++i, 0, subRule); - } - } - } - } - } - } - // Pop the stack - ctxFrames.shift(); - ctxSelectors.shift(); - if (context.mediaBlocks) { - for (i = mediaBlockCount; i < context.mediaBlocks.length; i++) { - context.mediaBlocks[i].bubbleSelectors(selectors); - } - } - return ruleset; - }, - evalImports: function (context) { - var rules = this.rules; - var i; - var importRules; - if (!rules) { - return; - } - for (i = 0; i < rules.length; i++) { - if (rules[i].type === 'Import') { - importRules = rules[i].eval(context); - if (importRules && (importRules.length || importRules.length === 0)) { - rules.splice.apply(rules, [i, 1].concat(importRules)); - i += importRules.length - 1; - } - else { - rules.splice(i, 1, importRules); - } - this.resetCache(); - } - } - }, - makeImportant: function () { - var result = new Ruleset(this.selectors, this.rules.map(function (r) { - if (r.makeImportant) { - return r.makeImportant(); - } - else { - return r; - } - }), this.strictImports, this.visibilityInfo()); - return result; - }, - matchArgs: function (args) { - return !args || args.length === 0; - }, - // lets you call a css selector with a guard - matchCondition: function (args, context) { - var lastSelector = this.selectors[this.selectors.length - 1]; - if (!lastSelector.evaldCondition) { - return false; - } - if (lastSelector.condition && - !lastSelector.condition.eval(new contexts.Eval(context, context.frames))) { - return false; - } - return true; - }, - resetCache: function () { - this._rulesets = null; - this._variables = null; - this._properties = null; - this._lookups = {}; - }, - variables: function () { - if (!this._variables) { - this._variables = !this.rules ? {} : this.rules.reduce(function (hash, r) { - if (r instanceof Declaration && r.variable === true) { - hash[r.name] = r; - } - // when evaluating variables in an import statement, imports have not been eval'd - // so we need to go inside import statements. - // guard against root being a string (in the case of inlined less) - if (r.type === 'Import' && r.root && r.root.variables) { - var vars = r.root.variables(); - for (var name_1 in vars) { - // eslint-disable-next-line no-prototype-builtins - if (vars.hasOwnProperty(name_1)) { - hash[name_1] = r.root.variable(name_1); - } - } - } - return hash; - }, {}); - } - return this._variables; - }, - properties: function () { - if (!this._properties) { - this._properties = !this.rules ? {} : this.rules.reduce(function (hash, r) { - if (r instanceof Declaration && r.variable !== true) { - var name_2 = (r.name.length === 1) && (r.name[0] instanceof Keyword) ? - r.name[0].value : r.name; - // Properties don't overwrite as they can merge - if (!hash["$".concat(name_2)]) { - hash["$".concat(name_2)] = [r]; - } - else { - hash["$".concat(name_2)].push(r); - } - } - return hash; - }, {}); - } - return this._properties; - }, - variable: function (name) { - var decl = this.variables()[name]; - if (decl) { - return this.parseValue(decl); - } - }, - property: function (name) { - var decl = this.properties()[name]; - if (decl) { - return this.parseValue(decl); - } - }, - lastDeclaration: function () { - for (var i_1 = this.rules.length; i_1 > 0; i_1--) { - var decl = this.rules[i_1 - 1]; - if (decl instanceof Declaration) { - return this.parseValue(decl); - } - } - }, - parseValue: function (toParse) { - var self = this; - function transformDeclaration(decl) { - if (decl.value instanceof Anonymous && !decl.parsed) { - if (typeof decl.value.value === 'string') { - new Parser(this.parse.context, this.parse.importManager, decl.fileInfo(), decl.value.getIndex()).parseNode(decl.value.value, ['value', 'important'], function (err, result) { - if (err) { - decl.parsed = true; - } - if (result) { - decl.value = result[0]; - decl.important = result[1] || ''; - decl.parsed = true; - } - }); - } - else { - decl.parsed = true; - } - return decl; - } - else { - return decl; - } - } - if (!Array.isArray(toParse)) { - return transformDeclaration.call(self, toParse); - } - else { - var nodes_1 = []; - toParse.forEach(function (n) { - nodes_1.push(transformDeclaration.call(self, n)); - }); - return nodes_1; - } - }, - rulesets: function () { - if (!this.rules) { - return []; - } - var filtRules = []; - var rules = this.rules; - var i; - var rule; - for (i = 0; (rule = rules[i]); i++) { - if (rule.isRuleset) { - filtRules.push(rule); - } - } - return filtRules; - }, - prependRule: function (rule) { - var rules = this.rules; - if (rules) { - rules.unshift(rule); - } - else { - this.rules = [rule]; - } - this.setParent(rule, this); - }, - find: function (selector, self, filter) { - self = self || this; - var rules = []; - var match; - var foundMixins; - var key = selector.toCSS(); - if (key in this._lookups) { - return this._lookups[key]; - } - this.rulesets().forEach(function (rule) { - if (rule !== self) { - for (var j = 0; j < rule.selectors.length; j++) { - match = selector.match(rule.selectors[j]); - if (match) { - if (selector.elements.length > match) { - if (!filter || filter(rule)) { - foundMixins = rule.find(new Selector(selector.elements.slice(match)), self, filter); - for (var i_2 = 0; i_2 < foundMixins.length; ++i_2) { - foundMixins[i_2].path.push(rule); - } - Array.prototype.push.apply(rules, foundMixins); - } - } - else { - rules.push({ rule: rule, path: [] }); - } - break; - } - } - } - }); - this._lookups[key] = rules; - return rules; - }, - genCSS: function (context, output) { - var i; - var j; - var charsetRuleNodes = []; - var ruleNodes = []; - var // Line number debugging - debugInfo$1; - var rule; - var path; - context.tabLevel = (context.tabLevel || 0); - if (!this.root) { - context.tabLevel++; - } - var tabRuleStr = context.compress ? '' : Array(context.tabLevel + 1).join(' '); - var tabSetStr = context.compress ? '' : Array(context.tabLevel).join(' '); - var sep; - var charsetNodeIndex = 0; - var importNodeIndex = 0; - for (i = 0; (rule = this.rules[i]); i++) { - if (rule instanceof Comment) { - if (importNodeIndex === i) { - importNodeIndex++; - } - ruleNodes.push(rule); - } - else if (rule.isCharset && rule.isCharset()) { - ruleNodes.splice(charsetNodeIndex, 0, rule); - charsetNodeIndex++; - importNodeIndex++; - } - else if (rule.type === 'Import') { - ruleNodes.splice(importNodeIndex, 0, rule); - importNodeIndex++; - } - else { - ruleNodes.push(rule); - } - } - ruleNodes = charsetRuleNodes.concat(ruleNodes); - // If this is the root node, we don't render - // a selector, or {}. - if (!this.root) { - debugInfo$1 = debugInfo(context, this, tabSetStr); - if (debugInfo$1) { - output.add(debugInfo$1); - output.add(tabSetStr); - } - var paths = this.paths; - var pathCnt = paths.length; - var pathSubCnt = void 0; - sep = context.compress ? ',' : (",\n".concat(tabSetStr)); - for (i = 0; i < pathCnt; i++) { - path = paths[i]; - if (!(pathSubCnt = path.length)) { - continue; - } - if (i > 0) { - output.add(sep); - } - context.firstSelector = true; - path[0].genCSS(context, output); - context.firstSelector = false; - for (j = 1; j < pathSubCnt; j++) { - path[j].genCSS(context, output); - } - } - output.add((context.compress ? '{' : ' {\n') + tabRuleStr); - } - // Compile rules and rulesets - for (i = 0; (rule = ruleNodes[i]); i++) { - if (i + 1 === ruleNodes.length) { - context.lastRule = true; - } - var currentLastRule = context.lastRule; - if (rule.isRulesetLike(rule)) { - context.lastRule = false; - } - if (rule.genCSS) { - rule.genCSS(context, output); - } - else if (rule.value) { - output.add(rule.value.toString()); - } - context.lastRule = currentLastRule; - if (!context.lastRule && rule.isVisible()) { - output.add(context.compress ? '' : ("\n".concat(tabRuleStr))); - } - else { - context.lastRule = false; - } - } - if (!this.root) { - output.add((context.compress ? '}' : "\n".concat(tabSetStr, "}"))); - context.tabLevel--; - } - if (!output.isEmpty() && !context.compress && this.firstRoot) { - output.add('\n'); - } - }, - joinSelectors: function (paths, context, selectors) { - for (var s = 0; s < selectors.length; s++) { - this.joinSelector(paths, context, selectors[s]); - } - }, - joinSelector: function (paths, context, selector) { - function createParenthesis(elementsToPak, originalElement) { - var replacementParen, j; - if (elementsToPak.length === 0) { - replacementParen = new Paren(elementsToPak[0]); - } - else { - var insideParent = new Array(elementsToPak.length); - for (j = 0; j < elementsToPak.length; j++) { - insideParent[j] = new Element(null, elementsToPak[j], originalElement.isVariable, originalElement._index, originalElement._fileInfo); - } - replacementParen = new Paren(new Selector(insideParent)); - } - return replacementParen; - } - function createSelector(containedElement, originalElement) { - var element, selector; - element = new Element(null, containedElement, originalElement.isVariable, originalElement._index, originalElement._fileInfo); - selector = new Selector([element]); - return selector; - } - // joins selector path from `beginningPath` with selector path in `addPath` - // `replacedElement` contains element that is being replaced by `addPath` - // returns concatenated path - function addReplacementIntoPath(beginningPath, addPath, replacedElement, originalSelector) { - var newSelectorPath, lastSelector, newJoinedSelector; - // our new selector path - newSelectorPath = []; - // construct the joined selector - if & is the first thing this will be empty, - // if not newJoinedSelector will be the last set of elements in the selector - if (beginningPath.length > 0) { - newSelectorPath = copyArray(beginningPath); - lastSelector = newSelectorPath.pop(); - newJoinedSelector = originalSelector.createDerived(copyArray(lastSelector.elements)); - } - else { - newJoinedSelector = originalSelector.createDerived([]); - } - if (addPath.length > 0) { - // /deep/ is a CSS4 selector - (removed, so should deprecate) - // that is valid without anything in front of it - // so if the & does not have a combinator that is "" or " " then - // and there is a combinator on the parent, then grab that. - // this also allows + a { & .b { .a & { ... though not sure why you would want to do that - var combinator = replacedElement.combinator; - var parentEl = addPath[0].elements[0]; - if (combinator.emptyOrWhitespace && !parentEl.combinator.emptyOrWhitespace) { - combinator = parentEl.combinator; - } - // join the elements so far with the first part of the parent - newJoinedSelector.elements.push(new Element(combinator, parentEl.value, replacedElement.isVariable, replacedElement._index, replacedElement._fileInfo)); - newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1)); - } - // now add the joined selector - but only if it is not empty - if (newJoinedSelector.elements.length !== 0) { - newSelectorPath.push(newJoinedSelector); - } - // put together the parent selectors after the join (e.g. the rest of the parent) - if (addPath.length > 1) { - var restOfPath = addPath.slice(1); - restOfPath = restOfPath.map(function (selector) { - return selector.createDerived(selector.elements, []); - }); - newSelectorPath = newSelectorPath.concat(restOfPath); - } - return newSelectorPath; - } - // joins selector path from `beginningPath` with every selector path in `addPaths` array - // `replacedElement` contains element that is being replaced by `addPath` - // returns array with all concatenated paths - function addAllReplacementsIntoPath(beginningPath, addPaths, replacedElement, originalSelector, result) { - var j; - for (j = 0; j < beginningPath.length; j++) { - var newSelectorPath = addReplacementIntoPath(beginningPath[j], addPaths, replacedElement, originalSelector); - result.push(newSelectorPath); - } - return result; - } - function mergeElementsOnToSelectors(elements, selectors) { - var i, sel; - if (elements.length === 0) { - return; - } - if (selectors.length === 0) { - selectors.push([new Selector(elements)]); - return; - } - for (i = 0; (sel = selectors[i]); i++) { - // if the previous thing in sel is a parent this needs to join on to it - if (sel.length > 0) { - sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements)); - } - else { - sel.push(new Selector(elements)); - } - } - } - // replace all parent selectors inside `inSelector` by content of `context` array - // resulting selectors are returned inside `paths` array - // returns true if `inSelector` contained at least one parent selector - function replaceParentSelector(paths, context, inSelector) { - // The paths are [[Selector]] - // The first list is a list of comma separated selectors - // The inner list is a list of inheritance separated selectors - // e.g. - // .a, .b { - // .c { - // } - // } - // == [[.a] [.c]] [[.b] [.c]] - // - var i, j, k, currentElements, newSelectors, selectorsMultiplied, sel, el, hadParentSelector = false, length, lastSelector; - function findNestedSelector(element) { - var maybeSelector; - if (!(element.value instanceof Paren)) { - return null; - } - maybeSelector = element.value.value; - if (!(maybeSelector instanceof Selector)) { - return null; - } - return maybeSelector; - } - // the elements from the current selector so far - currentElements = []; - // the current list of new selectors to add to the path. - // We will build it up. We initiate it with one empty selector as we "multiply" the new selectors - // by the parents - newSelectors = [ - [] - ]; - for (i = 0; (el = inSelector.elements[i]); i++) { - // non parent reference elements just get added - if (el.value !== '&') { - var nestedSelector = findNestedSelector(el); - if (nestedSelector !== null) { - // merge the current list of non parent selector elements - // on to the current list of selectors to add - mergeElementsOnToSelectors(currentElements, newSelectors); - var nestedPaths = []; - var replaced = void 0; - var replacedNewSelectors = []; - replaced = replaceParentSelector(nestedPaths, context, nestedSelector); - hadParentSelector = hadParentSelector || replaced; - // the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors - for (k = 0; k < nestedPaths.length; k++) { - var replacementSelector = createSelector(createParenthesis(nestedPaths[k], el), el); - addAllReplacementsIntoPath(newSelectors, [replacementSelector], el, inSelector, replacedNewSelectors); - } - newSelectors = replacedNewSelectors; - currentElements = []; - } - else { - currentElements.push(el); - } - } - else { - hadParentSelector = true; - // the new list of selectors to add - selectorsMultiplied = []; - // merge the current list of non parent selector elements - // on to the current list of selectors to add - mergeElementsOnToSelectors(currentElements, newSelectors); - // loop through our current selectors - for (j = 0; j < newSelectors.length; j++) { - sel = newSelectors[j]; - // if we don't have any parent paths, the & might be in a mixin so that it can be used - // whether there are parents or not - if (context.length === 0) { - // the combinator used on el should now be applied to the next element instead so that - // it is not lost - if (sel.length > 0) { - sel[0].elements.push(new Element(el.combinator, '', el.isVariable, el._index, el._fileInfo)); - } - selectorsMultiplied.push(sel); - } - else { - // and the parent selectors - for (k = 0; k < context.length; k++) { - // We need to put the current selectors - // then join the last selector's elements on to the parents selectors - var newSelectorPath = addReplacementIntoPath(sel, context[k], el, inSelector); - // add that to our new set of selectors - selectorsMultiplied.push(newSelectorPath); - } - } - } - // our new selectors has been multiplied, so reset the state - newSelectors = selectorsMultiplied; - currentElements = []; - } - } - // if we have any elements left over (e.g. .a& .b == .b) - // add them on to all the current selectors - mergeElementsOnToSelectors(currentElements, newSelectors); - for (i = 0; i < newSelectors.length; i++) { - length = newSelectors[i].length; - if (length > 0) { - paths.push(newSelectors[i]); - lastSelector = newSelectors[i][length - 1]; - newSelectors[i][length - 1] = lastSelector.createDerived(lastSelector.elements, inSelector.extendList); - } - } - return hadParentSelector; - } - function deriveSelector(visibilityInfo, deriveFrom) { - var newSelector = deriveFrom.createDerived(deriveFrom.elements, deriveFrom.extendList, deriveFrom.evaldCondition); - newSelector.copyVisibilityInfo(visibilityInfo); - return newSelector; - } - // joinSelector code follows - var i, newPaths, hadParentSelector; - newPaths = []; - hadParentSelector = replaceParentSelector(newPaths, context, selector); - if (!hadParentSelector) { - if (context.length > 0) { - newPaths = []; - for (i = 0; i < context.length; i++) { - var concatenated = context[i].map(deriveSelector.bind(this, selector.visibilityInfo())); - concatenated.push(selector); - newPaths.push(concatenated); - } - } - else { - newPaths = [[selector]]; - } - } - for (i = 0; i < newPaths.length; i++) { - paths.push(newPaths[i]); - } - } - }); - - var Unit = function (numerator, denominator, backupUnit) { - this.numerator = numerator ? copyArray(numerator).sort() : []; - this.denominator = denominator ? copyArray(denominator).sort() : []; - if (backupUnit) { - this.backupUnit = backupUnit; - } - else if (numerator && numerator.length) { - this.backupUnit = numerator[0]; - } - }; - Unit.prototype = Object.assign(new Node(), { - type: 'Unit', - clone: function () { - return new Unit(copyArray(this.numerator), copyArray(this.denominator), this.backupUnit); - }, - genCSS: function (context, output) { - // Dimension checks the unit is singular and throws an error if in strict math mode. - var strictUnits = context && context.strictUnits; - if (this.numerator.length === 1) { - output.add(this.numerator[0]); // the ideal situation - } - else if (!strictUnits && this.backupUnit) { - output.add(this.backupUnit); - } - else if (!strictUnits && this.denominator.length) { - output.add(this.denominator[0]); - } - }, - toString: function () { - var i, returnStr = this.numerator.join('*'); - for (i = 0; i < this.denominator.length; i++) { - returnStr += "/".concat(this.denominator[i]); - } - return returnStr; - }, - compare: function (other) { - return this.is(other.toString()) ? 0 : undefined; - }, - is: function (unitString) { - return this.toString().toUpperCase() === unitString.toUpperCase(); - }, - isLength: function () { - return RegExp('^(px|em|ex|ch|rem|in|cm|mm|pc|pt|ex|vw|vh|vmin|vmax)$', 'gi').test(this.toCSS()); - }, - isEmpty: function () { - return this.numerator.length === 0 && this.denominator.length === 0; - }, - isSingular: function () { - return this.numerator.length <= 1 && this.denominator.length === 0; - }, - map: function (callback) { - var i; - for (i = 0; i < this.numerator.length; i++) { - this.numerator[i] = callback(this.numerator[i], false); - } - for (i = 0; i < this.denominator.length; i++) { - this.denominator[i] = callback(this.denominator[i], true); - } - }, - usedUnits: function () { - var group; - var result = {}; - var mapUnit; - var groupName; - mapUnit = function (atomicUnit) { - // eslint-disable-next-line no-prototype-builtins - if (group.hasOwnProperty(atomicUnit) && !result[groupName]) { - result[groupName] = atomicUnit; - } - return atomicUnit; - }; - for (groupName in unitConversions) { - // eslint-disable-next-line no-prototype-builtins - if (unitConversions.hasOwnProperty(groupName)) { - group = unitConversions[groupName]; - this.map(mapUnit); - } - } - return result; - }, - cancel: function () { - var counter = {}; - var atomicUnit; - var i; - for (i = 0; i < this.numerator.length; i++) { - atomicUnit = this.numerator[i]; - counter[atomicUnit] = (counter[atomicUnit] || 0) + 1; - } - for (i = 0; i < this.denominator.length; i++) { - atomicUnit = this.denominator[i]; - counter[atomicUnit] = (counter[atomicUnit] || 0) - 1; - } - this.numerator = []; - this.denominator = []; - for (atomicUnit in counter) { - // eslint-disable-next-line no-prototype-builtins - if (counter.hasOwnProperty(atomicUnit)) { - var count = counter[atomicUnit]; - if (count > 0) { - for (i = 0; i < count; i++) { - this.numerator.push(atomicUnit); - } - } - else if (count < 0) { - for (i = 0; i < -count; i++) { - this.denominator.push(atomicUnit); - } - } - } - } - this.numerator.sort(); - this.denominator.sort(); - } - }); - - /* eslint-disable no-prototype-builtins */ - // - // A number with a unit - // - var Dimension = function (value, unit) { - this.value = parseFloat(value); - if (isNaN(this.value)) { - throw new Error('Dimension is not a number.'); - } - this.unit = (unit && unit instanceof Unit) ? unit : - new Unit(unit ? [unit] : undefined); - this.setParent(this.unit, this); - }; - Dimension.prototype = Object.assign(new Node(), { - type: 'Dimension', - accept: function (visitor) { - this.unit = visitor.visit(this.unit); - }, - // remove when Nodes have JSDoc types - // eslint-disable-next-line no-unused-vars - eval: function (context) { - return this; - }, - toColor: function () { - return new Color([this.value, this.value, this.value]); - }, - genCSS: function (context, output) { - if ((context && context.strictUnits) && !this.unit.isSingular()) { - throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: ".concat(this.unit.toString())); - } - var value = this.fround(context, this.value); - var strValue = String(value); - if (value !== 0 && value < 0.000001 && value > -0.000001) { - // would be output 1e-6 etc. - strValue = value.toFixed(20).replace(/0+$/, ''); - } - if (context && context.compress) { - // Zero values doesn't need a unit - if (value === 0 && this.unit.isLength()) { - output.add(strValue); - return; - } - // Float values doesn't need a leading zero - if (value > 0 && value < 1) { - strValue = (strValue).substr(1); - } - } - output.add(strValue); - this.unit.genCSS(context, output); - }, - // In an operation between two Dimensions, - // we default to the first Dimension's unit, - // so `1px + 2` will yield `3px`. - operate: function (context, op, other) { - /* jshint noempty:false */ - var value = this._operate(context, op, this.value, other.value); - var unit = this.unit.clone(); - if (op === '+' || op === '-') { - if (unit.numerator.length === 0 && unit.denominator.length === 0) { - unit = other.unit.clone(); - if (this.unit.backupUnit) { - unit.backupUnit = this.unit.backupUnit; - } - } - else if (other.unit.numerator.length === 0 && unit.denominator.length === 0) ; - else { - other = other.convertTo(this.unit.usedUnits()); - if (context.strictUnits && other.unit.toString() !== unit.toString()) { - throw new Error('Incompatible units. Change the units or use the unit function. ' - + "Bad units: '".concat(unit.toString(), "' and '").concat(other.unit.toString(), "'.")); - } - value = this._operate(context, op, this.value, other.value); - } - } - else if (op === '*') { - unit.numerator = unit.numerator.concat(other.unit.numerator).sort(); - unit.denominator = unit.denominator.concat(other.unit.denominator).sort(); - unit.cancel(); - } - else if (op === '/') { - unit.numerator = unit.numerator.concat(other.unit.denominator).sort(); - unit.denominator = unit.denominator.concat(other.unit.numerator).sort(); - unit.cancel(); - } - return new Dimension(value, unit); - }, - compare: function (other) { - var a, b; - if (!(other instanceof Dimension)) { - return undefined; - } - if (this.unit.isEmpty() || other.unit.isEmpty()) { - a = this; - b = other; - } - else { - a = this.unify(); - b = other.unify(); - if (a.unit.compare(b.unit) !== 0) { - return undefined; - } - } - return Node.numericCompare(a.value, b.value); - }, - unify: function () { - return this.convertTo({ length: 'px', duration: 's', angle: 'rad' }); - }, - convertTo: function (conversions) { - var value = this.value; - var unit = this.unit.clone(); - var i; - var groupName; - var group; - var targetUnit; - var derivedConversions = {}; - var applyUnit; - if (typeof conversions === 'string') { - for (i in unitConversions) { - if (unitConversions[i].hasOwnProperty(conversions)) { - derivedConversions = {}; - derivedConversions[i] = conversions; - } - } - conversions = derivedConversions; - } - applyUnit = function (atomicUnit, denominator) { - if (group.hasOwnProperty(atomicUnit)) { - if (denominator) { - value = value / (group[atomicUnit] / group[targetUnit]); - } - else { - value = value * (group[atomicUnit] / group[targetUnit]); - } - return targetUnit; - } - return atomicUnit; - }; - for (groupName in conversions) { - if (conversions.hasOwnProperty(groupName)) { - targetUnit = conversions[groupName]; - group = unitConversions[groupName]; - unit.map(applyUnit); - } - } - unit.cancel(); - return new Dimension(value, unit); - } - }); - - var Expression = function (value, noSpacing) { - this.value = value; - this.noSpacing = noSpacing; - if (!value) { - throw new Error('Expression requires an array parameter'); - } - }; - Expression.prototype = Object.assign(new Node(), { - type: 'Expression', - accept: function (visitor) { - this.value = visitor.visitArray(this.value); - }, - eval: function (context) { - var noSpacing = this.noSpacing; - var returnValue; - var mathOn = context.isMathOn(); - var inParenthesis = this.parens; - var doubleParen = false; - if (inParenthesis) { - context.inParenthesis(); - } - if (this.value.length > 1) { - returnValue = new Expression(this.value.map(function (e) { - if (!e.eval) { - return e; - } - return e.eval(context); - }), this.noSpacing); - } - else if (this.value.length === 1) { - if (this.value[0].parens && !this.value[0].parensInOp && !context.inCalc) { - doubleParen = true; - } - returnValue = this.value[0].eval(context); - } - else { - returnValue = this; - } - if (inParenthesis) { - context.outOfParenthesis(); - } - if (this.parens && this.parensInOp && !mathOn && !doubleParen - && (!(returnValue instanceof Dimension))) { - returnValue = new Paren(returnValue); - } - returnValue.noSpacing = returnValue.noSpacing || noSpacing; - return returnValue; - }, - genCSS: function (context, output) { - for (var i_1 = 0; i_1 < this.value.length; i_1++) { - this.value[i_1].genCSS(context, output); - if (!this.noSpacing && i_1 + 1 < this.value.length) { - if (i_1 + 1 < this.value.length && !(this.value[i_1 + 1] instanceof Anonymous) || - this.value[i_1 + 1] instanceof Anonymous && this.value[i_1 + 1].value !== ',') { - output.add(' '); - } - } - } - }, - throwAwayComments: function () { - this.value = this.value.filter(function (v) { - return !(v instanceof Comment); - }); - } - }); - - var NestableAtRulePrototype = { - isRulesetLike: function () { - return true; - }, - accept: function (visitor) { - if (this.features) { - this.features = visitor.visit(this.features); - } - if (this.rules) { - this.rules = visitor.visitArray(this.rules); - } - }, - evalFunction: function () { - if (!this.features || !Array.isArray(this.features.value) || this.features.value.length < 1) { - return; - } - var exprValues = this.features.value; - var expr, paren; - for (var index = 0; index < exprValues.length; ++index) { - expr = exprValues[index]; - if (expr.type === 'Keyword' && index + 1 < exprValues.length && (expr.noSpacing || expr.noSpacing == null)) { - paren = exprValues[index + 1]; - if (paren.type === 'Paren' && paren.noSpacing) { - exprValues[index] = new Expression([expr, paren]); - exprValues.splice(index + 1, 1); - exprValues[index].noSpacing = true; - } - } - } - }, - evalTop: function (context) { - this.evalFunction(); - var result = this; - // Render all dependent Media blocks. - if (context.mediaBlocks.length > 1) { - var selectors = (new Selector([], null, null, this.getIndex(), this.fileInfo())).createEmptySelectors(); - result = new Ruleset(selectors, context.mediaBlocks); - result.multiMedia = true; - result.copyVisibilityInfo(this.visibilityInfo()); - this.setParent(result, this); - } - delete context.mediaBlocks; - delete context.mediaPath; - return result; - }, - evalNested: function (context) { - this.evalFunction(); - var i; - var value; - var path = context.mediaPath.concat([this]); - // Extract the media-query conditions separated with `,` (OR). - for (i = 0; i < path.length; i++) { - if (path[i].type !== this.type) { - context.mediaBlocks.splice(i, 1); - return this; - } - value = path[i].features instanceof Value ? - path[i].features.value : path[i].features; - path[i] = Array.isArray(value) ? value : [value]; - } - // Trace all permutations to generate the resulting media-query. - // - // (a, b and c) with nested (d, e) -> - // a and d - // a and e - // b and c and d - // b and c and e - this.features = new Value(this.permute(path).map(function (path) { - path = path.map(function (fragment) { return fragment.toCSS ? fragment : new Anonymous(fragment); }); - for (i = path.length - 1; i > 0; i--) { - path.splice(i, 0, new Anonymous('and')); - } - return new Expression(path); - })); - this.setParent(this.features, this); - // Fake a tree-node that doesn't output anything. - return new Ruleset([], []); - }, - permute: function (arr) { - if (arr.length === 0) { - return []; - } - else if (arr.length === 1) { - return arr[0]; - } - else { - var result = []; - var rest = this.permute(arr.slice(1)); - for (var i_1 = 0; i_1 < rest.length; i_1++) { - for (var j = 0; j < arr[0].length; j++) { - result.push([arr[0][j]].concat(rest[i_1])); - } - } - return result; - } - }, - bubbleSelectors: function (selectors) { - if (!selectors) { - return; - } - this.rules = [new Ruleset(copyArray(selectors), [this.rules[0]])]; - this.setParent(this.rules, this); - } - }; - - var AtRule = function (name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) { - var _this = this; - var i; - var selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors(); - this.name = name; - this.value = (value instanceof Node) ? value : (value ? new Anonymous(value) : value); - if (rules) { - if (Array.isArray(rules)) { - var allDeclarations = this.declarationsBlock(rules); - var allRulesetDeclarations_1 = true; - rules.forEach(function (rule) { - if (rule.type === 'Ruleset' && rule.rules) - allRulesetDeclarations_1 = allRulesetDeclarations_1 && _this.declarationsBlock(rule.rules, true); - }); - if (allDeclarations && !isRooted) { - this.simpleBlock = true; - this.declarations = rules; - } - else if (allRulesetDeclarations_1 && rules.length === 1 && !isRooted && !value) { - this.simpleBlock = true; - this.declarations = rules[0].rules ? rules[0].rules : rules; - } - else { - this.rules = rules; - } - } - else { - var allDeclarations = this.declarationsBlock(rules.rules); - if (allDeclarations && !isRooted && !value) { - this.simpleBlock = true; - this.declarations = rules.rules; - } - else { - this.rules = [rules]; - this.rules[0].selectors = (new Selector([], null, null, index, currentFileInfo)).createEmptySelectors(); - } - } - if (!this.simpleBlock) { - for (i = 0; i < this.rules.length; i++) { - this.rules[i].allowImports = true; - } - } - this.setParent(selectors, this); - this.setParent(this.rules, this); - } - this._index = index; - this._fileInfo = currentFileInfo; - this.debugInfo = debugInfo; - this.isRooted = isRooted || false; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - }; - AtRule.prototype = Object.assign(new Node(), __assign(__assign({ type: 'AtRule' }, NestableAtRulePrototype), { declarationsBlock: function (rules, mergeable) { - if (mergeable === void 0) { mergeable = false; } - if (!mergeable) { - return rules.filter(function (node) { return (node.type === 'Declaration' || node.type === 'Comment') && !node.merge; }).length === rules.length; - } - else { - return rules.filter(function (node) { return (node.type === 'Declaration' || node.type === 'Comment'); }).length === rules.length; - } - }, keywordList: function (rules) { - if (!Array.isArray(rules)) { - return false; - } - else { - return rules.filter(function (node) { return (node.type === 'Keyword' || node.type === 'Comment'); }).length === rules.length; - } - }, accept: function (visitor) { - var value = this.value, rules = this.rules, declarations = this.declarations; - if (rules) { - this.rules = visitor.visitArray(rules); - } - else if (declarations) { - this.declarations = visitor.visitArray(declarations); - } - if (value) { - this.value = visitor.visit(value); - } - }, isRulesetLike: function () { - return this.rules || !this.isCharset(); - }, isCharset: function () { - return '@charset' === this.name; - }, genCSS: function (context, output) { - var value = this.value, rules = this.rules || this.declarations; - output.add(this.name, this.fileInfo(), this.getIndex()); - if (value) { - output.add(' '); - value.genCSS(context, output); - } - if (this.simpleBlock) { - this.outputRuleset(context, output, this.declarations); - } - else if (rules) { - this.outputRuleset(context, output, rules); - } - else { - output.add(';'); - } - }, eval: function (context) { - var mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules || this.declarations; - // media stored inside other atrule should not bubble over it - // backpup media bubbling information - mediaPathBackup = context.mediaPath; - mediaBlocksBackup = context.mediaBlocks; - // deleted media bubbling information - context.mediaPath = []; - context.mediaBlocks = []; - if (value) { - value = value.eval(context); - if (value.value && this.keywordList(value.value)) { - value = new Anonymous(value.value.map(function (keyword) { return keyword.value; }).join(', '), this.getIndex(), this.fileInfo()); - } - } - if (rules) { - rules = this.evalRoot(context, rules); - } - if (Array.isArray(rules) && rules[0].rules && Array.isArray(rules[0].rules) && rules[0].rules.length) { - var allMergeableDeclarations = this.declarationsBlock(rules[0].rules, true); - if (allMergeableDeclarations && !this.isRooted && !value) { - var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules; - mergeRules(rules[0].rules); - rules = rules[0].rules; - rules.forEach(function (rule) { return rule.merge = false; }); - } - } - if (this.simpleBlock && rules) { - rules[0].functionRegistry = context.frames[0].functionRegistry.inherit(); - rules = rules.map(function (rule) { return rule.eval(context); }); - } - // restore media bubbling information - context.mediaPath = mediaPathBackup; - context.mediaBlocks = mediaBlocksBackup; - return new AtRule(this.name, value, rules, this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo()); - }, evalRoot: function (context, rules) { - var ampersandCount = 0; - var noAmpersandCount = 0; - var noAmpersands = true; - var allAmpersands = false; - if (!this.simpleBlock) { - rules = [rules[0].eval(context)]; - } - var precedingSelectors = []; - if (context.frames.length > 0) { - var _loop_1 = function (index) { - var frame = context.frames[index]; - if (frame.type === 'Ruleset' && - frame.rules && - frame.rules.length > 0) { - if (frame && !frame.root && frame.selectors && frame.selectors.length > 0) { - precedingSelectors = precedingSelectors.concat(frame.selectors); - } - } - if (precedingSelectors.length > 0) { - var value_1 = ''; - var output = { add: function (s) { value_1 += s; } }; - for (var i_1 = 0; i_1 < precedingSelectors.length; i_1++) { - precedingSelectors[i_1].genCSS(context, output); - } - if (/^&+$/.test(value_1.replace(/\s+/g, ''))) { - noAmpersands = false; - noAmpersandCount++; - } - else { - allAmpersands = false; - ampersandCount++; - } - } - }; - for (var index = 0; index < context.frames.length; index++) { - _loop_1(index); - } - } - var mixedAmpersands = ampersandCount > 0 && noAmpersandCount > 0 && !allAmpersands && !noAmpersands; - if ((this.isRooted && ampersandCount > 0 && noAmpersandCount === 0 && !allAmpersands && noAmpersands) - || !mixedAmpersands) { - rules[0].root = true; - } - return rules; - }, variable: function (name) { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return Ruleset.prototype.variable.call(this.rules[0], name); - } - }, find: function () { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return Ruleset.prototype.find.apply(this.rules[0], arguments); - } - }, rulesets: function () { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return Ruleset.prototype.rulesets.apply(this.rules[0]); - } - }, outputRuleset: function (context, output, rules) { - var ruleCnt = rules.length; - var i; - context.tabLevel = (context.tabLevel | 0) + 1; - // Compressed - if (context.compress) { - output.add('{'); - for (i = 0; i < ruleCnt; i++) { - rules[i].genCSS(context, output); - } - output.add('}'); - context.tabLevel--; - return; - } - // Non-compressed - var tabSetStr = "\n".concat(Array(context.tabLevel).join(' ')), tabRuleStr = "".concat(tabSetStr, " "); - if (!ruleCnt) { - output.add(" {".concat(tabSetStr, "}")); - } - else { - output.add(" {".concat(tabRuleStr)); - rules[0].genCSS(context, output); - for (i = 1; i < ruleCnt; i++) { - output.add(tabRuleStr); - rules[i].genCSS(context, output); - } - output.add("".concat(tabSetStr, "}")); - } - context.tabLevel--; - } })); - - var DetachedRuleset = function (ruleset, frames) { - this.ruleset = ruleset; - this.frames = frames; - this.setParent(this.ruleset, this); - }; - DetachedRuleset.prototype = Object.assign(new Node(), { - type: 'DetachedRuleset', - evalFirst: true, - accept: function (visitor) { - this.ruleset = visitor.visit(this.ruleset); - }, - eval: function (context) { - var frames = this.frames || copyArray(context.frames); - return new DetachedRuleset(this.ruleset, frames); - }, - callEval: function (context) { - return this.ruleset.eval(this.frames ? new contexts.Eval(context, this.frames.concat(context.frames)) : context); - } - }); - - var MATH = Math$1; - var Operation = function (op, operands, isSpaced) { - this.op = op.trim(); - this.operands = operands; - this.isSpaced = isSpaced; - }; - Operation.prototype = Object.assign(new Node(), { - type: 'Operation', - accept: function (visitor) { - this.operands = visitor.visitArray(this.operands); - }, - eval: function (context) { - var a = this.operands[0].eval(context), b = this.operands[1].eval(context), op; - if (context.isMathOn(this.op)) { - op = this.op === './' ? '/' : this.op; - if (a instanceof Dimension && b instanceof Color) { - a = a.toColor(); - } - if (b instanceof Dimension && a instanceof Color) { - b = b.toColor(); - } - if (!a.operate || !b.operate) { - if ((a instanceof Operation || b instanceof Operation) - && a.op === '/' && context.math === MATH.PARENS_DIVISION) { - return new Operation(this.op, [a, b], this.isSpaced); - } - throw { type: 'Operation', - message: 'Operation on an invalid type' }; - } - return a.operate(context, op, b); - } - else { - return new Operation(this.op, [a, b], this.isSpaced); - } - }, - genCSS: function (context, output) { - this.operands[0].genCSS(context, output); - if (this.isSpaced) { - output.add(' '); - } - output.add(this.op); - if (this.isSpaced) { - output.add(' '); - } - this.operands[1].genCSS(context, output); - } - }); - - var functionCaller = /** @class */ (function () { - function functionCaller(name, context, index, currentFileInfo) { - this.name = name.toLowerCase(); - this.index = index; - this.context = context; - this.currentFileInfo = currentFileInfo; - this.func = context.frames[0].functionRegistry.get(this.name); - } - functionCaller.prototype.isValid = function () { - return Boolean(this.func); - }; - functionCaller.prototype.call = function (args) { - var _this = this; - if (!(Array.isArray(args))) { - args = [args]; - } - var evalArgs = this.func.evalArgs; - if (evalArgs !== false) { - args = args.map(function (a) { return a.eval(_this.context); }); - } - var commentFilter = function (item) { return !(item.type === 'Comment'); }; - // This code is terrible and should be replaced as per this issue... - // https://github.com/less/less.js/issues/2477 - args = args - .filter(commentFilter) - .map(function (item) { - if (item.type === 'Expression') { - var subNodes = item.value.filter(commentFilter); - if (subNodes.length === 1) { - // https://github.com/less/less.js/issues/3616 - if (item.parens && subNodes[0].op === '/') { - return item; - } - return subNodes[0]; - } - else { - return new Expression(subNodes); - } - } - return item; - }); - if (evalArgs === false) { - return this.func.apply(this, __spreadArray([this.context], args, false)); - } - return this.func.apply(this, args); - }; - return functionCaller; - }()); - - // - // A function call node. - // - var Call = function (name, args, index, currentFileInfo) { - this.name = name; - this.args = args; - this.calc = name === 'calc'; - this._index = index; - this._fileInfo = currentFileInfo; - }; - Call.prototype = Object.assign(new Node(), { - type: 'Call', - accept: function (visitor) { - if (this.args) { - this.args = visitor.visitArray(this.args); - } - }, - // - // When evaluating a function call, - // we either find the function in the functionRegistry, - // in which case we call it, passing the evaluated arguments, - // if this returns null or we cannot find the function, we - // simply print it out as it appeared originally [2]. - // - // The reason why we evaluate the arguments, is in the case where - // we try to pass a variable to a function, like: `saturate(@color)`. - // The function should receive the value, not the variable. - // - eval: function (context) { - var _this = this; - /** - * Turn off math for calc(), and switch back on for evaluating nested functions - */ - var currentMathContext = context.mathOn; - context.mathOn = !this.calc; - if (this.calc || context.inCalc) { - context.enterCalc(); - } - var exitCalc = function () { - if (_this.calc || context.inCalc) { - context.exitCalc(); - } - context.mathOn = currentMathContext; - }; - var result; - var funcCaller = new functionCaller(this.name, context, this.getIndex(), this.fileInfo()); - if (funcCaller.isValid()) { - try { - result = funcCaller.call(this.args); - exitCalc(); - } - catch (e) { - // eslint-disable-next-line no-prototype-builtins - if (e.hasOwnProperty('line') && e.hasOwnProperty('column')) { - throw e; - } - throw { - type: e.type || 'Runtime', - message: "Error evaluating function `".concat(this.name, "`").concat(e.message ? ": ".concat(e.message) : ''), - index: this.getIndex(), - filename: this.fileInfo().filename, - line: e.lineNumber, - column: e.columnNumber - }; - } - } - if (result !== null && result !== undefined) { - // Results that that are not nodes are cast as Anonymous nodes - // Falsy values or booleans are returned as empty nodes - if (!(result instanceof Node)) { - if (!result || result === true) { - result = new Anonymous(null); - } - else { - result = new Anonymous(result.toString()); - } - } - result._index = this._index; - result._fileInfo = this._fileInfo; - return result; - } - var args = this.args.map(function (a) { return a.eval(context); }); - exitCalc(); - return new Call(this.name, args, this.getIndex(), this.fileInfo()); - }, - genCSS: function (context, output) { - output.add("".concat(this.name, "("), this.fileInfo(), this.getIndex()); - for (var i_1 = 0; i_1 < this.args.length; i_1++) { - this.args[i_1].genCSS(context, output); - if (i_1 + 1 < this.args.length) { - output.add(', '); - } - } - output.add(')'); - } - }); - - var Variable = function (name, index, currentFileInfo) { - this.name = name; - this._index = index; - this._fileInfo = currentFileInfo; - }; - Variable.prototype = Object.assign(new Node(), { - type: 'Variable', - eval: function (context) { - var variable, name = this.name; - if (name.indexOf('@@') === 0) { - name = "@".concat(new Variable(name.slice(1), this.getIndex(), this.fileInfo()).eval(context).value); - } - if (this.evaluating) { - throw { type: 'Name', - message: "Recursive variable definition for ".concat(name), - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - this.evaluating = true; - variable = this.find(context.frames, function (frame) { - var v = frame.variable(name); - if (v) { - if (v.important) { - var importantScope = context.importantScope[context.importantScope.length - 1]; - importantScope.important = v.important; - } - // If in calc, wrap vars in a function call to cascade evaluate args first - if (context.inCalc) { - return (new Call('_SELF', [v.value])).eval(context); - } - else { - return v.value.eval(context); - } - } - }); - if (variable) { - this.evaluating = false; - return variable; - } - else { - throw { type: 'Name', - message: "variable ".concat(name, " is undefined"), - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - }, - find: function (obj, fun) { - for (var i_1 = 0, r = void 0; i_1 < obj.length; i_1++) { - r = fun.call(obj, obj[i_1]); - if (r) { - return r; - } - } - return null; - } - }); - - var Property = function (name, index, currentFileInfo) { - this.name = name; - this._index = index; - this._fileInfo = currentFileInfo; - }; - Property.prototype = Object.assign(new Node(), { - type: 'Property', - eval: function (context) { - var property; - var name = this.name; - // TODO: shorten this reference - var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules; - if (this.evaluating) { - throw { type: 'Name', - message: "Recursive property reference for ".concat(name), - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - this.evaluating = true; - property = this.find(context.frames, function (frame) { - var v; - var vArr = frame.property(name); - if (vArr) { - for (var i_1 = 0; i_1 < vArr.length; i_1++) { - v = vArr[i_1]; - vArr[i_1] = new Declaration(v.name, v.value, v.important, v.merge, v.index, v.currentFileInfo, v.inline, v.variable); - } - mergeRules(vArr); - v = vArr[vArr.length - 1]; - if (v.important) { - var importantScope = context.importantScope[context.importantScope.length - 1]; - importantScope.important = v.important; - } - v = v.value.eval(context); - return v; - } - }); - if (property) { - this.evaluating = false; - return property; - } - else { - throw { type: 'Name', - message: "Property '".concat(name, "' is undefined"), - filename: this.currentFileInfo.filename, - index: this.index }; - } - }, - find: function (obj, fun) { - for (var i_2 = 0, r = void 0; i_2 < obj.length; i_2++) { - r = fun.call(obj, obj[i_2]); - if (r) { - return r; - } - } - return null; - } - }); - - var Attribute = function (key, op, value, cif) { - this.key = key; - this.op = op; - this.value = value; - this.cif = cif; - }; - Attribute.prototype = Object.assign(new Node(), { - type: 'Attribute', - eval: function (context) { - return new Attribute(this.key.eval ? this.key.eval(context) : this.key, this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value, this.cif); - }, - genCSS: function (context, output) { - output.add(this.toCSS(context)); - }, - toCSS: function (context) { - var value = this.key.toCSS ? this.key.toCSS(context) : this.key; - if (this.op) { - value += this.op; - value += (this.value.toCSS ? this.value.toCSS(context) : this.value); - } - if (this.cif) { - value = value + ' ' + this.cif; - } - return "[".concat(value, "]"); - } - }); - - var Quoted = function (str, content, escaped, index, currentFileInfo) { - this.escaped = (escaped === undefined) ? true : escaped; - this.value = content || ''; - this.quote = str.charAt(0); - this._index = index; - this._fileInfo = currentFileInfo; - this.variableRegex = /@\{([\w-]+)\}/g; - this.propRegex = /\$\{([\w-]+)\}/g; - this.allowRoot = escaped; - }; - Quoted.prototype = Object.assign(new Node(), { - type: 'Quoted', - genCSS: function (context, output) { - if (!this.escaped) { - output.add(this.quote, this.fileInfo(), this.getIndex()); - } - output.add(this.value); - if (!this.escaped) { - output.add(this.quote); - } - }, - containsVariables: function () { - return this.value.match(this.variableRegex); - }, - eval: function (context) { - var that = this; - var value = this.value; - var variableReplacement = function (_, name1, name2) { - var v = new Variable("@".concat(name1 !== null && name1 !== void 0 ? name1 : name2), that.getIndex(), that.fileInfo()).eval(context, true); - return (v instanceof Quoted) ? v.value : v.toCSS(); - }; - var propertyReplacement = function (_, name1, name2) { - var v = new Property("$".concat(name1 !== null && name1 !== void 0 ? name1 : name2), that.getIndex(), that.fileInfo()).eval(context, true); - return (v instanceof Quoted) ? v.value : v.toCSS(); - }; - function iterativeReplace(value, regexp, replacementFnc) { - var evaluatedValue = value; - do { - value = evaluatedValue.toString(); - evaluatedValue = value.replace(regexp, replacementFnc); - } while (value !== evaluatedValue); - return evaluatedValue; - } - value = iterativeReplace(value, this.variableRegex, variableReplacement); - value = iterativeReplace(value, this.propRegex, propertyReplacement); - return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo()); - }, - compare: function (other) { - // when comparing quoted strings allow the quote to differ - if (other.type === 'Quoted' && !this.escaped && !other.escaped) { - return Node.numericCompare(this.value, other.value); - } - else { - return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined; - } - } - }); - - function escapePath(path) { - return path.replace(/[()'"\s]/g, function (match) { return "\\".concat(match); }); - } - var URL = function (val, index, currentFileInfo, isEvald) { - this.value = val; - this._index = index; - this._fileInfo = currentFileInfo; - this.isEvald = isEvald; - }; - URL.prototype = Object.assign(new Node(), { - type: 'Url', - accept: function (visitor) { - this.value = visitor.visit(this.value); - }, - genCSS: function (context, output) { - output.add('url('); - this.value.genCSS(context, output); - output.add(')'); - }, - eval: function (context) { - var val = this.value.eval(context); - var rootpath; - if (!this.isEvald) { - // Add the rootpath if the URL requires a rewrite - rootpath = this.fileInfo() && this.fileInfo().rootpath; - if (typeof rootpath === 'string' && - typeof val.value === 'string' && - context.pathRequiresRewrite(val.value)) { - if (!val.quote) { - rootpath = escapePath(rootpath); - } - val.value = context.rewritePath(val.value, rootpath); - } - else { - val.value = context.normalizePath(val.value); - } - // Add url args if enabled - if (context.urlArgs) { - if (!val.value.match(/^\s*data:/)) { - var delimiter = val.value.indexOf('?') === -1 ? '?' : '&'; - var urlArgs = delimiter + context.urlArgs; - if (val.value.indexOf('#') !== -1) { - val.value = val.value.replace('#', "".concat(urlArgs, "#")); - } - else { - val.value += urlArgs; - } - } - } - } - return new URL(val, this.getIndex(), this.fileInfo(), true); - } - }); - - var Media = function (value, features, index, currentFileInfo, visibilityInfo) { - this._index = index; - this._fileInfo = currentFileInfo; - var selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors(); - this.features = new Value(features); - this.rules = [new Ruleset(selectors, value)]; - this.rules[0].allowImports = true; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - this.setParent(selectors, this); - this.setParent(this.features, this); - this.setParent(this.rules, this); - }; - Media.prototype = Object.assign(new AtRule(), __assign(__assign({ type: 'Media' }, NestableAtRulePrototype), { genCSS: function (context, output) { - output.add('@media ', this._fileInfo, this._index); - this.features.genCSS(context, output); - this.outputRuleset(context, output, this.rules); - }, eval: function (context) { - if (!context.mediaBlocks) { - context.mediaBlocks = []; - context.mediaPath = []; - } - var media = new Media(null, [], this._index, this._fileInfo, this.visibilityInfo()); - if (this.debugInfo) { - this.rules[0].debugInfo = this.debugInfo; - media.debugInfo = this.debugInfo; - } - media.features = this.features.eval(context); - context.mediaPath.push(media); - context.mediaBlocks.push(media); - this.rules[0].functionRegistry = context.frames[0].functionRegistry.inherit(); - context.frames.unshift(this.rules[0]); - media.rules = [this.rules[0].eval(context)]; - context.frames.shift(); - context.mediaPath.pop(); - return context.mediaPath.length === 0 ? media.evalTop(context) : - media.evalNested(context); - } })); - - // - // CSS @import node - // - // The general strategy here is that we don't want to wait - // for the parsing to be completed, before we start importing - // the file. That's because in the context of a browser, - // most of the time will be spent waiting for the server to respond. - // - // On creation, we push the import path to our import queue, though - // `import,push`, we also pass it a callback, which it'll call once - // the file has been fetched, and parsed. - // - var Import = function (path, features, options, index, currentFileInfo, visibilityInfo) { - this.options = options; - this._index = index; - this._fileInfo = currentFileInfo; - this.path = path; - this.features = features; - this.allowRoot = true; - if (this.options.less !== undefined || this.options.inline) { - this.css = !this.options.less || this.options.inline; - } - else { - var pathValue = this.getPath(); - if (pathValue && /[#.&?]css([?;].*)?$/.test(pathValue)) { - this.css = true; - } - } - this.copyVisibilityInfo(visibilityInfo); - this.setParent(this.features, this); - this.setParent(this.path, this); - }; - Import.prototype = Object.assign(new Node(), { - type: 'Import', - accept: function (visitor) { - if (this.features) { - this.features = visitor.visit(this.features); - } - this.path = visitor.visit(this.path); - if (!this.options.isPlugin && !this.options.inline && this.root) { - this.root = visitor.visit(this.root); - } - }, - genCSS: function (context, output) { - if (this.css && this.path._fileInfo.reference === undefined) { - output.add('@import ', this._fileInfo, this._index); - this.path.genCSS(context, output); - if (this.features) { - output.add(' '); - this.features.genCSS(context, output); - } - output.add(';'); - } - }, - getPath: function () { - return (this.path instanceof URL) ? - this.path.value.value : this.path.value; - }, - isVariableImport: function () { - var path = this.path; - if (path instanceof URL) { - path = path.value; - } - if (path instanceof Quoted) { - return path.containsVariables(); - } - return true; - }, - evalForImport: function (context) { - var path = this.path; - if (path instanceof URL) { - path = path.value; - } - return new Import(path.eval(context), this.features, this.options, this._index, this._fileInfo, this.visibilityInfo()); - }, - evalPath: function (context) { - var path = this.path.eval(context); - var fileInfo = this._fileInfo; - if (!(path instanceof URL)) { - // Add the rootpath if the URL requires a rewrite - var pathValue = path.value; - if (fileInfo && - pathValue && - context.pathRequiresRewrite(pathValue)) { - path.value = context.rewritePath(pathValue, fileInfo.rootpath); - } - else { - path.value = context.normalizePath(path.value); - } - } - return path; - }, - eval: function (context) { - var result = this.doEval(context); - if (this.options.reference || this.blocksVisibility()) { - if (result.length || result.length === 0) { - result.forEach(function (node) { - node.addVisibilityBlock(); - }); - } - else { - result.addVisibilityBlock(); - } - } - return result; - }, - doEval: function (context) { - var ruleset; - var registry; - var features = this.features && this.features.eval(context); - if (this.options.isPlugin) { - if (this.root && this.root.eval) { - try { - this.root.eval(context); - } - catch (e) { - e.message = 'Plugin error during evaluation'; - throw new LessError(e, this.root.imports, this.root.filename); - } - } - registry = context.frames[0] && context.frames[0].functionRegistry; - if (registry && this.root && this.root.functions) { - registry.addMultiple(this.root.functions); - } - return []; - } - if (this.skip) { - if (typeof this.skip === 'function') { - this.skip = this.skip(); - } - if (this.skip) { - return []; - } - } - if (this.features) { - var featureValue = this.features.value; - if (Array.isArray(featureValue) && featureValue.length >= 1) { - var expr = featureValue[0]; - if (expr.type === 'Expression' && Array.isArray(expr.value) && expr.value.length >= 2) { - featureValue = expr.value; - var isLayer = featureValue[0].type === 'Keyword' && featureValue[0].value === 'layer' - && featureValue[1].type === 'Paren'; - if (isLayer) { - this.css = false; - } - } - } - } - if (this.options.inline) { - var contents = new Anonymous(this.root, 0, { - filename: this.importedFilename, - reference: this.path._fileInfo && this.path._fileInfo.reference - }, true, true); - return this.features ? new Media([contents], this.features.value) : [contents]; - } - else if (this.css || this.layerCss) { - var newImport = new Import(this.evalPath(context), features, this.options, this._index); - if (this.layerCss) { - newImport.css = this.layerCss; - newImport.path._fileInfo = this._fileInfo; - } - if (!newImport.css && this.error) { - throw this.error; - } - return newImport; - } - else if (this.root) { - if (this.features) { - var featureValue = this.features.value; - if (Array.isArray(featureValue) && featureValue.length === 1) { - var expr = featureValue[0]; - if (expr.type === 'Expression' && Array.isArray(expr.value) && expr.value.length >= 2) { - featureValue = expr.value; - var isLayer = featureValue[0].type === 'Keyword' && featureValue[0].value === 'layer' - && featureValue[1].type === 'Paren'; - if (isLayer) { - this.layerCss = true; - featureValue[0] = new Expression(featureValue.slice(0, 2)); - featureValue.splice(1, 1); - featureValue[0].noSpacing = true; - return this; - } - } - } - } - ruleset = new Ruleset(null, copyArray(this.root.rules)); - ruleset.evalImports(context); - return this.features ? new Media(ruleset.rules, this.features.value) : ruleset.rules; - } - else { - if (this.features) { - var featureValue = this.features.value; - if (Array.isArray(featureValue) && featureValue.length >= 1) { - featureValue = featureValue[0].value; - if (Array.isArray(featureValue) && featureValue.length >= 2) { - var isLayer = featureValue[0].type === 'Keyword' && featureValue[0].value === 'layer' - && featureValue[1].type === 'Paren'; - if (isLayer) { - this.css = true; - featureValue[0] = new Expression(featureValue.slice(0, 2)); - featureValue.splice(1, 1); - featureValue[0].noSpacing = true; - return this; - } - } - } - } - return []; - } - } - }); - - var JsEvalNode = function () { }; - JsEvalNode.prototype = Object.assign(new Node(), { - evaluateJavaScript: function (expression, context) { - var result; - var that = this; - var evalContext = {}; - if (!context.javascriptEnabled) { - throw { message: 'Inline JavaScript is not enabled. Is it set in your options?', - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - expression = expression.replace(/@\{([\w-]+)\}/g, function (_, name) { - return that.jsify(new Variable("@".concat(name), that.getIndex(), that.fileInfo()).eval(context)); - }); - try { - expression = new Function("return (".concat(expression, ")")); - } - catch (e) { - throw { message: "JavaScript evaluation error: ".concat(e.message, " from `").concat(expression, "`"), - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - var variables = context.frames[0].variables(); - for (var k in variables) { - // eslint-disable-next-line no-prototype-builtins - if (variables.hasOwnProperty(k)) { - evalContext[k.slice(1)] = { - value: variables[k].value, - toJS: function () { - return this.value.eval(context).toCSS(); - } - }; - } - } - try { - result = expression.call(evalContext); - } - catch (e) { - throw { message: "JavaScript evaluation error: '".concat(e.name, ": ").concat(e.message.replace(/["]/g, '\''), "'"), - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - return result; - }, - jsify: function (obj) { - if (Array.isArray(obj.value) && (obj.value.length > 1)) { - return "[".concat(obj.value.map(function (v) { return v.toCSS(); }).join(', '), "]"); - } - else { - return obj.toCSS(); - } - } - }); - - var JavaScript = function (string, escaped, index, currentFileInfo) { - this.escaped = escaped; - this.expression = string; - this._index = index; - this._fileInfo = currentFileInfo; - }; - JavaScript.prototype = Object.assign(new JsEvalNode(), { - type: 'JavaScript', - eval: function (context) { - var result = this.evaluateJavaScript(this.expression, context); - var type = typeof result; - if (type === 'number' && !isNaN(result)) { - return new Dimension(result); - } - else if (type === 'string') { - return new Quoted("\"".concat(result, "\""), result, this.escaped, this._index); - } - else if (Array.isArray(result)) { - return new Anonymous(result.join(', ')); - } - else { - return new Anonymous(result); - } - } - }); - - var Assignment = function (key, val) { - this.key = key; - this.value = val; - }; - Assignment.prototype = Object.assign(new Node(), { - type: 'Assignment', - accept: function (visitor) { - this.value = visitor.visit(this.value); - }, - eval: function (context) { - if (this.value.eval) { - return new Assignment(this.key, this.value.eval(context)); - } - return this; - }, - genCSS: function (context, output) { - output.add("".concat(this.key, "=")); - if (this.value.genCSS) { - this.value.genCSS(context, output); - } - else { - output.add(this.value); - } - } - }); - - var Condition = function (op, l, r, i, negate) { - this.op = op.trim(); - this.lvalue = l; - this.rvalue = r; - this._index = i; - this.negate = negate; - }; - Condition.prototype = Object.assign(new Node(), { - type: 'Condition', - accept: function (visitor) { - this.lvalue = visitor.visit(this.lvalue); - this.rvalue = visitor.visit(this.rvalue); - }, - eval: function (context) { - var result = (function (op, a, b) { - switch (op) { - case 'and': return a && b; - case 'or': return a || b; - default: - switch (Node.compare(a, b)) { - case -1: - return op === '<' || op === '=<' || op === '<='; - case 0: - return op === '=' || op === '>=' || op === '=<' || op === '<='; - case 1: - return op === '>' || op === '>='; - default: - return false; - } - } - })(this.op, this.lvalue.eval(context), this.rvalue.eval(context)); - return this.negate ? !result : result; - } - }); - - var QueryInParens = function (op, l, m, op2, r, i) { - this.op = op.trim(); - this.lvalue = l; - this.mvalue = m; - this.op2 = op2 ? op2.trim() : null; - this.rvalue = r; - this._index = i; - this.mvalues = []; - }; - QueryInParens.prototype = Object.assign(new Node(), { - type: 'QueryInParens', - accept: function (visitor) { - this.lvalue = visitor.visit(this.lvalue); - this.mvalue = visitor.visit(this.mvalue); - if (this.rvalue) { - this.rvalue = visitor.visit(this.rvalue); - } - }, - eval: function (context) { - this.lvalue = this.lvalue.eval(context); - var variableDeclaration; - var rule; - for (var i_1 = 0; (rule = context.frames[i_1]); i_1++) { - if (rule.type === 'Ruleset') { - variableDeclaration = rule.rules.find(function (r) { - if ((r instanceof Declaration) && r.variable) { - return true; - } - return false; - }); - if (variableDeclaration) { - break; - } - } - } - if (!this.mvalueCopy) { - this.mvalueCopy = copy(this.mvalue); - } - if (variableDeclaration) { - this.mvalue = this.mvalueCopy; - this.mvalue = this.mvalue.eval(context); - this.mvalues.push(this.mvalue); - } - else { - this.mvalue = this.mvalue.eval(context); - } - if (this.rvalue) { - this.rvalue = this.rvalue.eval(context); - } - return this; - }, - genCSS: function (context, output) { - this.lvalue.genCSS(context, output); - output.add(' ' + this.op + ' '); - if (this.mvalues.length > 0) { - this.mvalue = this.mvalues.shift(); - } - this.mvalue.genCSS(context, output); - if (this.rvalue) { - output.add(' ' + this.op2 + ' '); - this.rvalue.genCSS(context, output); - } - }, - }); - - var Container = function (value, features, index, currentFileInfo, visibilityInfo) { - this._index = index; - this._fileInfo = currentFileInfo; - var selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors(); - this.features = new Value(features); - this.rules = [new Ruleset(selectors, value)]; - this.rules[0].allowImports = true; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - this.setParent(selectors, this); - this.setParent(this.features, this); - this.setParent(this.rules, this); - }; - Container.prototype = Object.assign(new AtRule(), __assign(__assign({ type: 'Container' }, NestableAtRulePrototype), { genCSS: function (context, output) { - output.add('@container ', this._fileInfo, this._index); - this.features.genCSS(context, output); - this.outputRuleset(context, output, this.rules); - }, eval: function (context) { - if (!context.mediaBlocks) { - context.mediaBlocks = []; - context.mediaPath = []; - } - var media = new Container(null, [], this._index, this._fileInfo, this.visibilityInfo()); - if (this.debugInfo) { - this.rules[0].debugInfo = this.debugInfo; - media.debugInfo = this.debugInfo; - } - media.features = this.features.eval(context); - context.mediaPath.push(media); - context.mediaBlocks.push(media); - this.rules[0].functionRegistry = context.frames[0].functionRegistry.inherit(); - context.frames.unshift(this.rules[0]); - media.rules = [this.rules[0].eval(context)]; - context.frames.shift(); - context.mediaPath.pop(); - return context.mediaPath.length === 0 ? media.evalTop(context) : - media.evalNested(context); - } })); - - var UnicodeDescriptor = function (value) { - this.value = value; - }; - UnicodeDescriptor.prototype = Object.assign(new Node(), { - type: 'UnicodeDescriptor' - }); - - var Negative = function (node) { - this.value = node; - }; - Negative.prototype = Object.assign(new Node(), { - type: 'Negative', - genCSS: function (context, output) { - output.add('-'); - this.value.genCSS(context, output); - }, - eval: function (context) { - if (context.isMathOn()) { - return (new Operation('*', [new Dimension(-1), this.value])).eval(context); - } - return new Negative(this.value.eval(context)); - } - }); - - var Extend = function (selector, option, index, currentFileInfo, visibilityInfo) { - this.selector = selector; - this.option = option; - this.object_id = Extend.next_id++; - this.parent_ids = [this.object_id]; - this._index = index; - this._fileInfo = currentFileInfo; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - switch (option) { - case '!all': - case 'all': - this.allowBefore = true; - this.allowAfter = true; - break; - default: - this.allowBefore = false; - this.allowAfter = false; - break; - } - this.setParent(this.selector, this); - }; - Extend.prototype = Object.assign(new Node(), { - type: 'Extend', - accept: function (visitor) { - this.selector = visitor.visit(this.selector); - }, - eval: function (context) { - return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - }, - // remove when Nodes have JSDoc types - // eslint-disable-next-line no-unused-vars - clone: function (context) { - return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - }, - // it concatenates (joins) all selectors in selector array - findSelfSelectors: function (selectors) { - var selfElements = [], i, selectorElements; - for (i = 0; i < selectors.length; i++) { - selectorElements = selectors[i].elements; - // duplicate the logic in genCSS function inside the selector node. - // future TODO - move both logics into the selector joiner visitor - if (i > 0 && selectorElements.length && selectorElements[0].combinator.value === '') { - selectorElements[0].combinator.value = ' '; - } - selfElements = selfElements.concat(selectors[i].elements); - } - this.selfSelectors = [new Selector(selfElements)]; - this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo()); - } - }); - Extend.next_id = 0; - - var VariableCall = function (variable, index, currentFileInfo) { - this.variable = variable; - this._index = index; - this._fileInfo = currentFileInfo; - this.allowRoot = true; - }; - VariableCall.prototype = Object.assign(new Node(), { - type: 'VariableCall', - eval: function (context) { - var rules; - var detachedRuleset = new Variable(this.variable, this.getIndex(), this.fileInfo()).eval(context); - var error = new LessError({ message: "Could not evaluate variable call ".concat(this.variable) }); - if (!detachedRuleset.ruleset) { - if (detachedRuleset.rules) { - rules = detachedRuleset; - } - else if (Array.isArray(detachedRuleset)) { - rules = new Ruleset('', detachedRuleset); - } - else if (Array.isArray(detachedRuleset.value)) { - rules = new Ruleset('', detachedRuleset.value); - } - else { - throw error; - } - detachedRuleset = new DetachedRuleset(rules); - } - if (detachedRuleset.ruleset) { - return detachedRuleset.callEval(context); - } - throw error; - } - }); - - var NamespaceValue = function (ruleCall, lookups, index, fileInfo) { - this.value = ruleCall; - this.lookups = lookups; - this._index = index; - this._fileInfo = fileInfo; - }; - NamespaceValue.prototype = Object.assign(new Node(), { - type: 'NamespaceValue', - eval: function (context) { - var i, name, rules = this.value.eval(context); - for (i = 0; i < this.lookups.length; i++) { - name = this.lookups[i]; - /** - * Eval'd DRs return rulesets. - * Eval'd mixins return rules, so let's make a ruleset if we need it. - * We need to do this because of late parsing of values - */ - if (Array.isArray(rules)) { - rules = new Ruleset([new Selector()], rules); - } - if (name === '') { - rules = rules.lastDeclaration(); - } - else if (name.charAt(0) === '@') { - if (name.charAt(1) === '@') { - name = "@".concat(new Variable(name.substr(1)).eval(context).value); - } - if (rules.variables) { - rules = rules.variable(name); - } - if (!rules) { - throw { type: 'Name', - message: "variable ".concat(name, " not found"), - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - } - else { - if (name.substring(0, 2) === '$@') { - name = "$".concat(new Variable(name.substr(1)).eval(context).value); - } - else { - name = name.charAt(0) === '$' ? name : "$".concat(name); - } - if (rules.properties) { - rules = rules.property(name); - } - if (!rules) { - throw { type: 'Name', - message: "property \"".concat(name.substr(1), "\" not found"), - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - // Properties are an array of values, since a ruleset can have multiple props. - // We pick the last one (the "cascaded" value) - rules = rules[rules.length - 1]; - } - if (rules.value) { - rules = rules.eval(context).value; - } - if (rules.ruleset) { - rules = rules.ruleset.eval(context); - } - } - return rules; - } - }); - - var Definition = function (name, params, rules, condition, variadic, frames, visibilityInfo) { - this.name = name || 'anonymous mixin'; - this.selectors = [new Selector([new Element(null, name, false, this._index, this._fileInfo)])]; - this.params = params; - this.condition = condition; - this.variadic = variadic; - this.arity = params.length; - this.rules = rules; - this._lookups = {}; - var optionalParameters = []; - this.required = params.reduce(function (count, p) { - if (!p.name || (p.name && !p.value)) { - return count + 1; - } - else { - optionalParameters.push(p.name); - return count; - } - }, 0); - this.optionalParameters = optionalParameters; - this.frames = frames; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - }; - Definition.prototype = Object.assign(new Ruleset(), { - type: 'MixinDefinition', - evalFirst: true, - accept: function (visitor) { - if (this.params && this.params.length) { - this.params = visitor.visitArray(this.params); - } - this.rules = visitor.visitArray(this.rules); - if (this.condition) { - this.condition = visitor.visit(this.condition); - } - }, - evalParams: function (context, mixinEnv, args, evaldArguments) { - /* jshint boss:true */ - var frame = new Ruleset(null, null); - var varargs; - var arg; - var params = copyArray(this.params); - var i; - var j; - var val; - var name; - var isNamedFound; - var argIndex; - var argsLength = 0; - if (mixinEnv.frames && mixinEnv.frames[0] && mixinEnv.frames[0].functionRegistry) { - frame.functionRegistry = mixinEnv.frames[0].functionRegistry.inherit(); - } - mixinEnv = new contexts.Eval(mixinEnv, [frame].concat(mixinEnv.frames)); - if (args) { - args = copyArray(args); - argsLength = args.length; - for (i = 0; i < argsLength; i++) { - arg = args[i]; - if (name = (arg && arg.name)) { - isNamedFound = false; - for (j = 0; j < params.length; j++) { - if (!evaldArguments[j] && name === params[j].name) { - evaldArguments[j] = arg.value.eval(context); - frame.prependRule(new Declaration(name, arg.value.eval(context))); - isNamedFound = true; - break; - } - } - if (isNamedFound) { - args.splice(i, 1); - i--; - continue; - } - else { - throw { type: 'Runtime', message: "Named argument for ".concat(this.name, " ").concat(args[i].name, " not found") }; - } - } - } - } - argIndex = 0; - for (i = 0; i < params.length; i++) { - if (evaldArguments[i]) { - continue; - } - arg = args && args[argIndex]; - if (name = params[i].name) { - if (params[i].variadic) { - varargs = []; - for (j = argIndex; j < argsLength; j++) { - varargs.push(args[j].value.eval(context)); - } - frame.prependRule(new Declaration(name, new Expression(varargs).eval(context))); - } - else { - val = arg && arg.value; - if (val) { - // This was a mixin call, pass in a detached ruleset of it's eval'd rules - if (Array.isArray(val)) { - val = new DetachedRuleset(new Ruleset('', val)); - } - else { - val = val.eval(context); - } - } - else if (params[i].value) { - val = params[i].value.eval(mixinEnv); - frame.resetCache(); - } - else { - throw { type: 'Runtime', message: "wrong number of arguments for ".concat(this.name, " (").concat(argsLength, " for ").concat(this.arity, ")") }; - } - frame.prependRule(new Declaration(name, val)); - evaldArguments[i] = val; - } - } - if (params[i].variadic && args) { - for (j = argIndex; j < argsLength; j++) { - evaldArguments[j] = args[j].value.eval(context); - } - } - argIndex++; - } - return frame; - }, - makeImportant: function () { - var rules = !this.rules ? this.rules : this.rules.map(function (r) { - if (r.makeImportant) { - return r.makeImportant(true); - } - else { - return r; - } - }); - var result = new Definition(this.name, this.params, rules, this.condition, this.variadic, this.frames); - return result; - }, - eval: function (context) { - return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || copyArray(context.frames)); - }, - evalCall: function (context, args, important) { - var _arguments = []; - var mixinFrames = this.frames ? this.frames.concat(context.frames) : context.frames; - var frame = this.evalParams(context, new contexts.Eval(context, mixinFrames), args, _arguments); - var rules; - var ruleset; - frame.prependRule(new Declaration('@arguments', new Expression(_arguments).eval(context))); - rules = copyArray(this.rules); - ruleset = new Ruleset(null, rules); - ruleset.originalRuleset = this; - ruleset = ruleset.eval(new contexts.Eval(context, [this, frame].concat(mixinFrames))); - if (important) { - ruleset = ruleset.makeImportant(); - } - return ruleset; - }, - matchCondition: function (args, context) { - if (this.condition && !this.condition.eval(new contexts.Eval(context, [this.evalParams(context, /* the parameter variables */ new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])] - .concat(this.frames || []) // the parent namespace/mixin frames - .concat(context.frames)))) { // the current environment frames - return false; - } - return true; - }, - matchArgs: function (args, context) { - var allArgsCnt = (args && args.length) || 0; - var len; - var optionalParameters = this.optionalParameters; - var requiredArgsCnt = !args ? 0 : args.reduce(function (count, p) { - if (optionalParameters.indexOf(p.name) < 0) { - return count + 1; - } - else { - return count; - } - }, 0); - if (!this.variadic) { - if (requiredArgsCnt < this.required) { - return false; - } - if (allArgsCnt > this.params.length) { - return false; - } - } - else { - if (requiredArgsCnt < (this.required - 1)) { - return false; - } - } - // check patterns - len = Math.min(requiredArgsCnt, this.arity); - for (var i_1 = 0; i_1 < len; i_1++) { - if (!this.params[i_1].name && !this.params[i_1].variadic) { - if (args[i_1].value.eval(context).toCSS() != this.params[i_1].value.eval(context).toCSS()) { - return false; - } - } - } - return true; - } - }); - - var MixinCall = function (elements, args, index, currentFileInfo, important) { - this.selector = new Selector(elements); - this.arguments = args || []; - this._index = index; - this._fileInfo = currentFileInfo; - this.important = important; - this.allowRoot = true; - this.setParent(this.selector, this); - }; - MixinCall.prototype = Object.assign(new Node(), { - type: 'MixinCall', - accept: function (visitor) { - if (this.selector) { - this.selector = visitor.visit(this.selector); - } - if (this.arguments.length) { - this.arguments = visitor.visitArray(this.arguments); - } - }, - eval: function (context) { - var mixins; - var mixin; - var mixinPath; - var args = []; - var arg; - var argValue; - var rules = []; - var match = false; - var i; - var m; - var f; - var isRecursive; - var isOneFound; - var candidates = []; - var candidate; - var conditionResult = []; - var defaultResult; - var defFalseEitherCase = -1; - var defNone = 0; - var defTrue = 1; - var defFalse = 2; - var count; - var originalRuleset; - var noArgumentsFilter; - this.selector = this.selector.eval(context); - function calcDefGroup(mixin, mixinPath) { - var f, p, namespace; - for (f = 0; f < 2; f++) { - conditionResult[f] = true; - defaultFunc.value(f); - for (p = 0; p < mixinPath.length && conditionResult[f]; p++) { - namespace = mixinPath[p]; - if (namespace.matchCondition) { - conditionResult[f] = conditionResult[f] && namespace.matchCondition(null, context); - } - } - if (mixin.matchCondition) { - conditionResult[f] = conditionResult[f] && mixin.matchCondition(args, context); - } - } - if (conditionResult[0] || conditionResult[1]) { - if (conditionResult[0] != conditionResult[1]) { - return conditionResult[1] ? - defTrue : defFalse; - } - return defNone; - } - return defFalseEitherCase; - } - for (i = 0; i < this.arguments.length; i++) { - arg = this.arguments[i]; - argValue = arg.value.eval(context); - if (arg.expand && Array.isArray(argValue.value)) { - argValue = argValue.value; - for (m = 0; m < argValue.length; m++) { - args.push({ value: argValue[m] }); - } - } - else { - args.push({ name: arg.name, value: argValue }); - } - } - noArgumentsFilter = function (rule) { return rule.matchArgs(null, context); }; - for (i = 0; i < context.frames.length; i++) { - if ((mixins = context.frames[i].find(this.selector, null, noArgumentsFilter)).length > 0) { - isOneFound = true; - // To make `default()` function independent of definition order we have two "subpasses" here. - // At first we evaluate each guard *twice* (with `default() == true` and `default() == false`), - // and build candidate list with corresponding flags. Then, when we know all possible matches, - // we make a final decision. - for (m = 0; m < mixins.length; m++) { - mixin = mixins[m].rule; - mixinPath = mixins[m].path; - isRecursive = false; - for (f = 0; f < context.frames.length; f++) { - if ((!(mixin instanceof Definition)) && mixin === (context.frames[f].originalRuleset || context.frames[f])) { - isRecursive = true; - break; - } - } - if (isRecursive) { - continue; - } - if (mixin.matchArgs(args, context)) { - candidate = { mixin: mixin, group: calcDefGroup(mixin, mixinPath) }; - if (candidate.group !== defFalseEitherCase) { - candidates.push(candidate); - } - match = true; - } - } - defaultFunc.reset(); - count = [0, 0, 0]; - for (m = 0; m < candidates.length; m++) { - count[candidates[m].group]++; - } - if (count[defNone] > 0) { - defaultResult = defFalse; - } - else { - defaultResult = defTrue; - if ((count[defTrue] + count[defFalse]) > 1) { - throw { type: 'Runtime', - message: "Ambiguous use of `default()` found when matching for `".concat(this.format(args), "`"), - index: this.getIndex(), filename: this.fileInfo().filename }; - } - } - for (m = 0; m < candidates.length; m++) { - candidate = candidates[m].group; - if ((candidate === defNone) || (candidate === defaultResult)) { - try { - mixin = candidates[m].mixin; - if (!(mixin instanceof Definition)) { - originalRuleset = mixin.originalRuleset || mixin; - mixin = new Definition('', [], mixin.rules, null, false, null, originalRuleset.visibilityInfo()); - mixin.originalRuleset = originalRuleset; - } - var newRules = mixin.evalCall(context, args, this.important).rules; - this._setVisibilityToReplacement(newRules); - Array.prototype.push.apply(rules, newRules); - } - catch (e) { - throw { message: e.message, index: this.getIndex(), filename: this.fileInfo().filename, stack: e.stack }; - } - } - } - if (match) { - return rules; - } - } - } - if (isOneFound) { - throw { type: 'Runtime', - message: "No matching definition was found for `".concat(this.format(args), "`"), - index: this.getIndex(), filename: this.fileInfo().filename }; - } - else { - throw { type: 'Name', - message: "".concat(this.selector.toCSS().trim(), " is undefined"), - index: this.getIndex(), filename: this.fileInfo().filename }; - } - }, - _setVisibilityToReplacement: function (replacement) { - var i, rule; - if (this.blocksVisibility()) { - for (i = 0; i < replacement.length; i++) { - rule = replacement[i]; - rule.addVisibilityBlock(); - } - } - }, - format: function (args) { - return "".concat(this.selector.toCSS().trim(), "(").concat(args ? args.map(function (a) { - var argValue = ''; - if (a.name) { - argValue += "".concat(a.name, ":"); - } - if (a.value.toCSS) { - argValue += a.value.toCSS(); - } - else { - argValue += '???'; - } - return argValue; - }).join(', ') : '', ")"); - } - }); - - var tree = { - Node: Node, - Color: Color, - AtRule: AtRule, - DetachedRuleset: DetachedRuleset, - Operation: Operation, - Dimension: Dimension, - Unit: Unit, - Keyword: Keyword, - Variable: Variable, - Property: Property, - Ruleset: Ruleset, - Element: Element, - Attribute: Attribute, - Combinator: Combinator, - Selector: Selector, - Quoted: Quoted, - Expression: Expression, - Declaration: Declaration, - Call: Call, - URL: URL, - Import: Import, - Comment: Comment, - Anonymous: Anonymous, - Value: Value, - JavaScript: JavaScript, - Assignment: Assignment, - Condition: Condition, - Paren: Paren, - Media: Media, - Container: Container, - QueryInParens: QueryInParens, - UnicodeDescriptor: UnicodeDescriptor, - Negative: Negative, - Extend: Extend, - VariableCall: VariableCall, - NamespaceValue: NamespaceValue, - mixin: { - Call: MixinCall, - Definition: Definition - } - }; - - var AbstractFileManager = /** @class */ (function () { - function AbstractFileManager() { - } - AbstractFileManager.prototype.getPath = function (filename) { - var j = filename.lastIndexOf('?'); - if (j > 0) { - filename = filename.slice(0, j); - } - j = filename.lastIndexOf('/'); - if (j < 0) { - j = filename.lastIndexOf('\\'); - } - if (j < 0) { - return ''; - } - return filename.slice(0, j + 1); - }; - AbstractFileManager.prototype.tryAppendExtension = function (path, ext) { - return /(\.[a-z]*$)|([?;].*)$/.test(path) ? path : path + ext; - }; - AbstractFileManager.prototype.tryAppendLessExtension = function (path) { - return this.tryAppendExtension(path, '.less'); - }; - AbstractFileManager.prototype.supportsSync = function () { - return false; - }; - AbstractFileManager.prototype.alwaysMakePathsAbsolute = function () { - return false; - }; - AbstractFileManager.prototype.isPathAbsolute = function (filename) { - return (/^(?:[a-z-]+:|\/|\\|#)/i).test(filename); - }; - // TODO: pull out / replace? - AbstractFileManager.prototype.join = function (basePath, laterPath) { - if (!basePath) { - return laterPath; - } - return basePath + laterPath; - }; - AbstractFileManager.prototype.pathDiff = function (url, baseUrl) { - // diff between two paths to create a relative path - var urlParts = this.extractUrlParts(url); - var baseUrlParts = this.extractUrlParts(baseUrl); - var i; - var max; - var urlDirectories; - var baseUrlDirectories; - var diff = ''; - if (urlParts.hostPart !== baseUrlParts.hostPart) { - return ''; - } - max = Math.max(baseUrlParts.directories.length, urlParts.directories.length); - for (i = 0; i < max; i++) { - if (baseUrlParts.directories[i] !== urlParts.directories[i]) { - break; - } - } - baseUrlDirectories = baseUrlParts.directories.slice(i); - urlDirectories = urlParts.directories.slice(i); - for (i = 0; i < baseUrlDirectories.length - 1; i++) { - diff += '../'; - } - for (i = 0; i < urlDirectories.length - 1; i++) { - diff += "".concat(urlDirectories[i], "/"); - } - return diff; - }; - /** - * Helper function, not part of API. - * This should be replaceable by newer Node / Browser APIs - * - * @param {string} url - * @param {string} baseUrl - */ - AbstractFileManager.prototype.extractUrlParts = function (url, baseUrl) { - // urlParts[1] = protocol://hostname/ OR / - // urlParts[2] = / if path relative to host base - // urlParts[3] = directories - // urlParts[4] = filename - // urlParts[5] = parameters - var urlPartsRegex = /^((?:[a-z-]+:)?\/{2}(?:[^/?#]*\/)|([/\\]))?((?:[^/\\?#]*[/\\])*)([^/\\?#]*)([#?].*)?$/i; - var urlParts = url.match(urlPartsRegex); - var returner = {}; - var rawDirectories = []; - var directories = []; - var i; - var baseUrlParts; - if (!urlParts) { - throw new Error("Could not parse sheet href - '".concat(url, "'")); - } - // Stylesheets in IE don't always return the full path - if (baseUrl && (!urlParts[1] || urlParts[2])) { - baseUrlParts = baseUrl.match(urlPartsRegex); - if (!baseUrlParts) { - throw new Error("Could not parse page url - '".concat(baseUrl, "'")); - } - urlParts[1] = urlParts[1] || baseUrlParts[1] || ''; - if (!urlParts[2]) { - urlParts[3] = baseUrlParts[3] + urlParts[3]; - } - } - if (urlParts[3]) { - rawDirectories = urlParts[3].replace(/\\/g, '/').split('/'); - // collapse '..' and skip '.' - for (i = 0; i < rawDirectories.length; i++) { - if (rawDirectories[i] === '..') { - directories.pop(); - } - else if (rawDirectories[i] !== '.') { - directories.push(rawDirectories[i]); - } - } - } - returner.hostPart = urlParts[1]; - returner.directories = directories; - returner.rawPath = (urlParts[1] || '') + rawDirectories.join('/'); - returner.path = (urlParts[1] || '') + directories.join('/'); - returner.filename = urlParts[4]; - returner.fileUrl = returner.path + (urlParts[4] || ''); - returner.url = returner.fileUrl + (urlParts[5] || ''); - return returner; - }; - return AbstractFileManager; - }()); - - var AbstractPluginLoader = /** @class */ (function () { - function AbstractPluginLoader() { - // Implemented by Node.js plugin loader - this.require = function () { - return null; - }; - } - AbstractPluginLoader.prototype.evalPlugin = function (contents, context, imports, pluginOptions, fileInfo) { - var loader, registry, pluginObj, localModule, pluginManager, filename, result; - pluginManager = context.pluginManager; - if (fileInfo) { - if (typeof fileInfo === 'string') { - filename = fileInfo; - } - else { - filename = fileInfo.filename; - } - } - var shortname = (new this.less.FileManager()).extractUrlParts(filename).filename; - if (filename) { - pluginObj = pluginManager.get(filename); - if (pluginObj) { - result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - if (result) { - return result; - } - try { - if (pluginObj.use) { - pluginObj.use.call(this.context, pluginObj); - } - } - catch (e) { - e.message = e.message || 'Error during @plugin call'; - return new LessError(e, imports, filename); - } - return pluginObj; - } - } - localModule = { - exports: {}, - pluginManager: pluginManager, - fileInfo: fileInfo - }; - registry = functionRegistry.create(); - var registerPlugin = function (obj) { - pluginObj = obj; - }; - try { - loader = new Function('module', 'require', 'registerPlugin', 'functions', 'tree', 'less', 'fileInfo', contents); - loader(localModule, this.require(filename), registerPlugin, registry, this.less.tree, this.less, fileInfo); - } - catch (e) { - return new LessError(e, imports, filename); - } - if (!pluginObj) { - pluginObj = localModule.exports; - } - pluginObj = this.validatePlugin(pluginObj, filename, shortname); - if (pluginObj instanceof LessError) { - return pluginObj; - } - if (pluginObj) { - pluginObj.imports = imports; - pluginObj.filename = filename; - // For < 3.x (or unspecified minVersion) - setOptions() before install() - if (!pluginObj.minVersion || this.compareVersion('3.0.0', pluginObj.minVersion) < 0) { - result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - if (result) { - return result; - } - } - // Run on first load - pluginManager.addPlugin(pluginObj, fileInfo.filename, registry); - pluginObj.functions = registry.getLocalFunctions(); - // Need to call setOptions again because the pluginObj might have functions - result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - if (result) { - return result; - } - // Run every @plugin call - try { - if (pluginObj.use) { - pluginObj.use.call(this.context, pluginObj); - } - } - catch (e) { - e.message = e.message || 'Error during @plugin call'; - return new LessError(e, imports, filename); - } - } - else { - return new LessError({ message: 'Not a valid plugin' }, imports, filename); - } - return pluginObj; - }; - AbstractPluginLoader.prototype.trySetOptions = function (plugin, filename, name, options) { - if (options && !plugin.setOptions) { - return new LessError({ - message: "Options have been provided but the plugin ".concat(name, " does not support any options.") - }); - } - try { - plugin.setOptions && plugin.setOptions(options); - } - catch (e) { - return new LessError(e); - } - }; - AbstractPluginLoader.prototype.validatePlugin = function (plugin, filename, name) { - if (plugin) { - // support plugins being a function - // so that the plugin can be more usable programmatically - if (typeof plugin === 'function') { - plugin = new plugin(); - } - if (plugin.minVersion) { - if (this.compareVersion(plugin.minVersion, this.less.version) < 0) { - return new LessError({ - message: "Plugin ".concat(name, " requires version ").concat(this.versionToString(plugin.minVersion)) - }); - } - } - return plugin; - } - return null; - }; - AbstractPluginLoader.prototype.compareVersion = function (aVersion, bVersion) { - if (typeof aVersion === 'string') { - aVersion = aVersion.match(/^(\d+)\.?(\d+)?\.?(\d+)?/); - aVersion.shift(); - } - for (var i_1 = 0; i_1 < aVersion.length; i_1++) { - if (aVersion[i_1] !== bVersion[i_1]) { - return parseInt(aVersion[i_1]) > parseInt(bVersion[i_1]) ? -1 : 1; - } - } - return 0; - }; - AbstractPluginLoader.prototype.versionToString = function (version) { - var versionString = ''; - for (var i_2 = 0; i_2 < version.length; i_2++) { - versionString += (versionString ? '.' : '') + version[i_2]; - } - return versionString; - }; - AbstractPluginLoader.prototype.printUsage = function (plugins) { - for (var i_3 = 0; i_3 < plugins.length; i_3++) { - var plugin = plugins[i_3]; - if (plugin.printUsage) { - plugin.printUsage(); - } - } - }; - return AbstractPluginLoader; - }()); - - function boolean(condition) { - return condition ? Keyword.True : Keyword.False; - } - /** - * Functions with evalArgs set to false are sent context - * as the first argument. - */ - function If(context, condition, trueValue, falseValue) { - return condition.eval(context) ? trueValue.eval(context) - : (falseValue ? falseValue.eval(context) : new Anonymous); - } - If.evalArgs = false; - function isdefined(context, variable) { - try { - variable.eval(context); - return Keyword.True; - } - catch (e) { - return Keyword.False; - } - } - isdefined.evalArgs = false; - var boolean$1 = { isdefined: isdefined, boolean: boolean, 'if': If }; - - var colorFunctions; - function clamp(val) { - return Math.min(1, Math.max(0, val)); - } - function hsla(origColor, hsl) { - var color = colorFunctions.hsla(hsl.h, hsl.s, hsl.l, hsl.a); - if (color) { - if (origColor.value && - /^(rgb|hsl)/.test(origColor.value)) { - color.value = origColor.value; - } - else { - color.value = 'rgb'; - } - return color; - } - } - function toHSL(color) { - if (color.toHSL) { - return color.toHSL(); - } - else { - throw new Error('Argument cannot be evaluated to a color'); - } - } - function toHSV(color) { - if (color.toHSV) { - return color.toHSV(); - } - else { - throw new Error('Argument cannot be evaluated to a color'); - } - } - function number$1(n) { - if (n instanceof Dimension) { - return parseFloat(n.unit.is('%') ? n.value / 100 : n.value); - } - else if (typeof n === 'number') { - return n; - } - else { - throw { - type: 'Argument', - message: 'color functions take numbers as parameters' - }; - } - } - function scaled(n, size) { - if (n instanceof Dimension && n.unit.is('%')) { - return parseFloat(n.value * size / 100); - } - else { - return number$1(n); - } - } - colorFunctions = { - rgb: function (r, g, b) { - var a = 1; - /** - * Comma-less syntax - * e.g. rgb(0 128 255 / 50%) - */ - if (r instanceof Expression) { - var val = r.value; - r = val[0]; - g = val[1]; - b = val[2]; - /** - * @todo - should this be normalized in - * function caller? Or parsed differently? - */ - if (b instanceof Operation) { - var op = b; - b = op.operands[0]; - a = op.operands[1]; - } - } - var color = colorFunctions.rgba(r, g, b, a); - if (color) { - color.value = 'rgb'; - return color; - } - }, - rgba: function (r, g, b, a) { - try { - if (r instanceof Color) { - if (g) { - a = number$1(g); - } - else { - a = r.alpha; - } - return new Color(r.rgb, a, 'rgba'); - } - var rgb = [r, g, b].map(function (c) { return scaled(c, 255); }); - a = number$1(a); - return new Color(rgb, a, 'rgba'); - } - catch (e) { } - }, - hsl: function (h, s, l) { - var a = 1; - if (h instanceof Expression) { - var val = h.value; - h = val[0]; - s = val[1]; - l = val[2]; - if (l instanceof Operation) { - var op = l; - l = op.operands[0]; - a = op.operands[1]; - } - } - var color = colorFunctions.hsla(h, s, l, a); - if (color) { - color.value = 'hsl'; - return color; - } - }, - hsla: function (h, s, l, a) { - var m1; - var m2; - function hue(h) { - h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h); - if (h * 6 < 1) { - return m1 + (m2 - m1) * h * 6; - } - else if (h * 2 < 1) { - return m2; - } - else if (h * 3 < 2) { - return m1 + (m2 - m1) * (2 / 3 - h) * 6; - } - else { - return m1; - } - } - try { - if (h instanceof Color) { - if (s) { - a = number$1(s); - } - else { - a = h.alpha; - } - return new Color(h.rgb, a, 'hsla'); - } - h = (number$1(h) % 360) / 360; - s = clamp(number$1(s)); - l = clamp(number$1(l)); - a = clamp(number$1(a)); - m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s; - m1 = l * 2 - m2; - var rgb = [ - hue(h + 1 / 3) * 255, - hue(h) * 255, - hue(h - 1 / 3) * 255 - ]; - a = number$1(a); - return new Color(rgb, a, 'hsla'); - } - catch (e) { } - }, - hsv: function (h, s, v) { - return colorFunctions.hsva(h, s, v, 1.0); - }, - hsva: function (h, s, v, a) { - h = ((number$1(h) % 360) / 360) * 360; - s = number$1(s); - v = number$1(v); - a = number$1(a); - var i; - var f; - i = Math.floor((h / 60) % 6); - f = (h / 60) - i; - var vs = [v, - v * (1 - s), - v * (1 - f * s), - v * (1 - (1 - f) * s)]; - var perm = [[0, 3, 1], - [2, 0, 1], - [1, 0, 3], - [1, 2, 0], - [3, 1, 0], - [0, 1, 2]]; - return colorFunctions.rgba(vs[perm[i][0]] * 255, vs[perm[i][1]] * 255, vs[perm[i][2]] * 255, a); - }, - hue: function (color) { - return new Dimension(toHSL(color).h); - }, - saturation: function (color) { - return new Dimension(toHSL(color).s * 100, '%'); - }, - lightness: function (color) { - return new Dimension(toHSL(color).l * 100, '%'); - }, - hsvhue: function (color) { - return new Dimension(toHSV(color).h); - }, - hsvsaturation: function (color) { - return new Dimension(toHSV(color).s * 100, '%'); - }, - hsvvalue: function (color) { - return new Dimension(toHSV(color).v * 100, '%'); - }, - red: function (color) { - return new Dimension(color.rgb[0]); - }, - green: function (color) { - return new Dimension(color.rgb[1]); - }, - blue: function (color) { - return new Dimension(color.rgb[2]); - }, - alpha: function (color) { - return new Dimension(toHSL(color).a); - }, - luma: function (color) { - return new Dimension(color.luma() * color.alpha * 100, '%'); - }, - luminance: function (color) { - var luminance = (0.2126 * color.rgb[0] / 255) + - (0.7152 * color.rgb[1] / 255) + - (0.0722 * color.rgb[2] / 255); - return new Dimension(luminance * color.alpha * 100, '%'); - }, - saturate: function (color, amount, method) { - // filter: saturate(3.2); - // should be kept as is, so check for color - if (!color.rgb) { - return null; - } - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.s += hsl.s * amount.value / 100; - } - else { - hsl.s += amount.value / 100; - } - hsl.s = clamp(hsl.s); - return hsla(color, hsl); - }, - desaturate: function (color, amount, method) { - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.s -= hsl.s * amount.value / 100; - } - else { - hsl.s -= amount.value / 100; - } - hsl.s = clamp(hsl.s); - return hsla(color, hsl); - }, - lighten: function (color, amount, method) { - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.l += hsl.l * amount.value / 100; - } - else { - hsl.l += amount.value / 100; - } - hsl.l = clamp(hsl.l); - return hsla(color, hsl); - }, - darken: function (color, amount, method) { - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.l -= hsl.l * amount.value / 100; - } - else { - hsl.l -= amount.value / 100; - } - hsl.l = clamp(hsl.l); - return hsla(color, hsl); - }, - fadein: function (color, amount, method) { - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.a += hsl.a * amount.value / 100; - } - else { - hsl.a += amount.value / 100; - } - hsl.a = clamp(hsl.a); - return hsla(color, hsl); - }, - fadeout: function (color, amount, method) { - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.a -= hsl.a * amount.value / 100; - } - else { - hsl.a -= amount.value / 100; - } - hsl.a = clamp(hsl.a); - return hsla(color, hsl); - }, - fade: function (color, amount) { - var hsl = toHSL(color); - hsl.a = amount.value / 100; - hsl.a = clamp(hsl.a); - return hsla(color, hsl); - }, - spin: function (color, amount) { - var hsl = toHSL(color); - var hue = (hsl.h + amount.value) % 360; - hsl.h = hue < 0 ? 360 + hue : hue; - return hsla(color, hsl); - }, - // - // Copyright (c) 2006-2009 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein - // http://sass-lang.com - // - mix: function (color1, color2, weight) { - if (!weight) { - weight = new Dimension(50); - } - var p = weight.value / 100.0; - var w = p * 2 - 1; - var a = toHSL(color1).a - toHSL(color2).a; - var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0; - var w2 = 1 - w1; - var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2, - color1.rgb[1] * w1 + color2.rgb[1] * w2, - color1.rgb[2] * w1 + color2.rgb[2] * w2]; - var alpha = color1.alpha * p + color2.alpha * (1 - p); - return new Color(rgb, alpha); - }, - greyscale: function (color) { - return colorFunctions.desaturate(color, new Dimension(100)); - }, - contrast: function (color, dark, light, threshold) { - // filter: contrast(3.2); - // should be kept as is, so check for color - if (!color.rgb) { - return null; - } - if (typeof light === 'undefined') { - light = colorFunctions.rgba(255, 255, 255, 1.0); - } - if (typeof dark === 'undefined') { - dark = colorFunctions.rgba(0, 0, 0, 1.0); - } - // Figure out which is actually light and dark: - if (dark.luma() > light.luma()) { - var t = light; - light = dark; - dark = t; - } - if (typeof threshold === 'undefined') { - threshold = 0.43; - } - else { - threshold = number$1(threshold); - } - if (color.luma() < threshold) { - return light; - } - else { - return dark; - } - }, - // Changes made in 2.7.0 - Reverted in 3.0.0 - // contrast: function (color, color1, color2, threshold) { - // // Return which of `color1` and `color2` has the greatest contrast with `color` - // // according to the standard WCAG contrast ratio calculation. - // // http://www.w3.org/TR/WCAG20/#contrast-ratiodef - // // The threshold param is no longer used, in line with SASS. - // // filter: contrast(3.2); - // // should be kept as is, so check for color - // if (!color.rgb) { - // return null; - // } - // if (typeof color1 === 'undefined') { - // color1 = colorFunctions.rgba(0, 0, 0, 1.0); - // } - // if (typeof color2 === 'undefined') { - // color2 = colorFunctions.rgba(255, 255, 255, 1.0); - // } - // var contrast1, contrast2; - // var luma = color.luma(); - // var luma1 = color1.luma(); - // var luma2 = color2.luma(); - // // Calculate contrast ratios for each color - // if (luma > luma1) { - // contrast1 = (luma + 0.05) / (luma1 + 0.05); - // } else { - // contrast1 = (luma1 + 0.05) / (luma + 0.05); - // } - // if (luma > luma2) { - // contrast2 = (luma + 0.05) / (luma2 + 0.05); - // } else { - // contrast2 = (luma2 + 0.05) / (luma + 0.05); - // } - // if (contrast1 > contrast2) { - // return color1; - // } else { - // return color2; - // } - // }, - argb: function (color) { - return new Anonymous(color.toARGB()); - }, - color: function (c) { - if ((c instanceof Quoted) && - (/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})$/i.test(c.value))) { - var val = c.value.slice(1); - return new Color(val, undefined, "#".concat(val)); - } - if ((c instanceof Color) || (c = Color.fromKeyword(c.value))) { - c.value = undefined; - return c; - } - throw { - type: 'Argument', - message: 'argument must be a color keyword or 3|4|6|8 digit hex e.g. #FFF' - }; - }, - tint: function (color, amount) { - return colorFunctions.mix(colorFunctions.rgb(255, 255, 255), color, amount); - }, - shade: function (color, amount) { - return colorFunctions.mix(colorFunctions.rgb(0, 0, 0), color, amount); - } - }; - var color = colorFunctions; - - // Color Blending - // ref: http://www.w3.org/TR/compositing-1 - function colorBlend(mode, color1, color2) { - var ab = color1.alpha; // result - var // backdrop - cb; - var as = color2.alpha; - var // source - cs; - var ar; - var cr; - var r = []; - ar = as + ab * (1 - as); - for (var i_1 = 0; i_1 < 3; i_1++) { - cb = color1.rgb[i_1] / 255; - cs = color2.rgb[i_1] / 255; - cr = mode(cb, cs); - if (ar) { - cr = (as * cs + ab * (cb - - as * (cb + cs - cr))) / ar; - } - r[i_1] = cr * 255; - } - return new Color(r, ar); - } - var colorBlendModeFunctions = { - multiply: function (cb, cs) { - return cb * cs; - }, - screen: function (cb, cs) { - return cb + cs - cb * cs; - }, - overlay: function (cb, cs) { - cb *= 2; - return (cb <= 1) ? - colorBlendModeFunctions.multiply(cb, cs) : - colorBlendModeFunctions.screen(cb - 1, cs); - }, - softlight: function (cb, cs) { - var d = 1; - var e = cb; - if (cs > 0.5) { - e = 1; - d = (cb > 0.25) ? Math.sqrt(cb) - : ((16 * cb - 12) * cb + 4) * cb; - } - return cb - (1 - 2 * cs) * e * (d - cb); - }, - hardlight: function (cb, cs) { - return colorBlendModeFunctions.overlay(cs, cb); - }, - difference: function (cb, cs) { - return Math.abs(cb - cs); - }, - exclusion: function (cb, cs) { - return cb + cs - 2 * cb * cs; - }, - // non-w3c functions: - average: function (cb, cs) { - return (cb + cs) / 2; - }, - negation: function (cb, cs) { - return 1 - Math.abs(cb + cs - 1); - } - }; - for (var f$1 in colorBlendModeFunctions) { - // eslint-disable-next-line no-prototype-builtins - if (colorBlendModeFunctions.hasOwnProperty(f$1)) { - colorBlend[f$1] = colorBlend.bind(null, colorBlendModeFunctions[f$1]); - } - } - - var dataUri = (function (environment) { - var fallback = function (functionThis, node) { return new URL(node, functionThis.index, functionThis.currentFileInfo).eval(functionThis.context); }; - return { 'data-uri': function (mimetypeNode, filePathNode) { - if (!filePathNode) { - filePathNode = mimetypeNode; - mimetypeNode = null; - } - var mimetype = mimetypeNode && mimetypeNode.value; - var filePath = filePathNode.value; - var currentFileInfo = this.currentFileInfo; - var currentDirectory = currentFileInfo.rewriteUrls ? - currentFileInfo.currentDirectory : currentFileInfo.entryPath; - var fragmentStart = filePath.indexOf('#'); - var fragment = ''; - if (fragmentStart !== -1) { - fragment = filePath.slice(fragmentStart); - filePath = filePath.slice(0, fragmentStart); - } - var context = clone(this.context); - context.rawBuffer = true; - var fileManager = environment.getFileManager(filePath, currentDirectory, context, environment, true); - if (!fileManager) { - return fallback(this, filePathNode); - } - var useBase64 = false; - // detect the mimetype if not given - if (!mimetypeNode) { - mimetype = environment.mimeLookup(filePath); - if (mimetype === 'image/svg+xml') { - useBase64 = false; - } - else { - // use base 64 unless it's an ASCII or UTF-8 format - var charset = environment.charsetLookup(mimetype); - useBase64 = ['US-ASCII', 'UTF-8'].indexOf(charset) < 0; - } - if (useBase64) { - mimetype += ';base64'; - } - } - else { - useBase64 = /;base64$/.test(mimetype); - } - var fileSync = fileManager.loadFileSync(filePath, currentDirectory, context, environment); - if (!fileSync.contents) { - logger$1.warn("Skipped data-uri embedding of ".concat(filePath, " because file not found")); - return fallback(this, filePathNode || mimetypeNode); - } - var buf = fileSync.contents; - if (useBase64 && !environment.encodeBase64) { - return fallback(this, filePathNode); - } - buf = useBase64 ? environment.encodeBase64(buf) : encodeURIComponent(buf); - var uri = "data:".concat(mimetype, ",").concat(buf).concat(fragment); - return new URL(new Quoted("\"".concat(uri, "\""), uri, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo); - } }; - }); - - var getItemsFromNode = function (node) { - // handle non-array values as an array of length 1 - // return 'undefined' if index is invalid - var items = Array.isArray(node.value) ? - node.value : Array(node); - return items; - }; - var list = { - _SELF: function (n) { - return n; - }, - '~': function () { - var expr = []; - for (var _i = 0; _i < arguments.length; _i++) { - expr[_i] = arguments[_i]; - } - if (expr.length === 1) { - return expr[0]; - } - return new Value(expr); - }, - extract: function (values, index) { - // (1-based index) - index = index.value - 1; - return getItemsFromNode(values)[index]; - }, - length: function (values) { - return new Dimension(getItemsFromNode(values).length); - }, - /** - * Creates a Less list of incremental values. - * Modeled after Lodash's range function, also exists natively in PHP - * - * @param {Dimension} [start=1] - * @param {Dimension} end - e.g. 10 or 10px - unit is added to output - * @param {Dimension} [step=1] - */ - range: function (start, end, step) { - var from; - var to; - var stepValue = 1; - var list = []; - if (end) { - to = end; - from = start.value; - if (step) { - stepValue = step.value; - } - } - else { - from = 1; - to = start; - } - for (var i_1 = from; i_1 <= to.value; i_1 += stepValue) { - list.push(new Dimension(i_1, to.unit)); - } - return new Expression(list); - }, - each: function (list, rs) { - var _this = this; - var rules = []; - var newRules; - var iterator; - var tryEval = function (val) { - if (val instanceof Node) { - return val.eval(_this.context); - } - return val; - }; - if (list.value && !(list instanceof Quoted)) { - if (Array.isArray(list.value)) { - iterator = list.value.map(tryEval); - } - else { - iterator = [tryEval(list.value)]; - } - } - else if (list.ruleset) { - iterator = tryEval(list.ruleset).rules; - } - else if (list.rules) { - iterator = list.rules.map(tryEval); - } - else if (Array.isArray(list)) { - iterator = list.map(tryEval); - } - else { - iterator = [tryEval(list)]; - } - var valueName = '@value'; - var keyName = '@key'; - var indexName = '@index'; - if (rs.params) { - valueName = rs.params[0] && rs.params[0].name; - keyName = rs.params[1] && rs.params[1].name; - indexName = rs.params[2] && rs.params[2].name; - rs = rs.rules; - } - else { - rs = rs.ruleset; - } - for (var i_2 = 0; i_2 < iterator.length; i_2++) { - var key = void 0; - var value = void 0; - var item = iterator[i_2]; - if (item instanceof Declaration) { - key = typeof item.name === 'string' ? item.name : item.name[0].value; - value = item.value; - } - else { - key = new Dimension(i_2 + 1); - value = item; - } - if (item instanceof Comment) { - continue; - } - newRules = rs.rules.slice(0); - if (valueName) { - newRules.push(new Declaration(valueName, value, false, false, this.index, this.currentFileInfo)); - } - if (indexName) { - newRules.push(new Declaration(indexName, new Dimension(i_2 + 1), false, false, this.index, this.currentFileInfo)); - } - if (keyName) { - newRules.push(new Declaration(keyName, key, false, false, this.index, this.currentFileInfo)); - } - rules.push(new Ruleset([new (Selector)([new Element('', '&')])], newRules, rs.strictImports, rs.visibilityInfo())); - } - return new Ruleset([new (Selector)([new Element('', '&')])], rules, rs.strictImports, rs.visibilityInfo()).eval(this.context); - } - }; - - var MathHelper = function (fn, unit, n) { - if (!(n instanceof Dimension)) { - throw { type: 'Argument', message: 'argument must be a number' }; - } - if (unit === null) { - unit = n.unit; - } - else { - n = n.unify(); - } - return new Dimension(fn(parseFloat(n.value)), unit); - }; - - var mathFunctions = { - // name, unit - ceil: null, - floor: null, - sqrt: null, - abs: null, - tan: '', - sin: '', - cos: '', - atan: 'rad', - asin: 'rad', - acos: 'rad' - }; - for (var f in mathFunctions) { - // eslint-disable-next-line no-prototype-builtins - if (mathFunctions.hasOwnProperty(f)) { - mathFunctions[f] = MathHelper.bind(null, Math[f], mathFunctions[f]); - } - } - mathFunctions.round = function (n, f) { - var fraction = typeof f === 'undefined' ? 0 : f.value; - return MathHelper(function (num) { return num.toFixed(fraction); }, null, n); - }; - - var minMax = function (isMin, args) { - var _this = this; - args = Array.prototype.slice.call(args); - switch (args.length) { - case 0: throw { type: 'Argument', message: 'one or more arguments required' }; - } - var i; // key is the unit.toString() for unified Dimension values, - var j; - var current; - var currentUnified; - var referenceUnified; - var unit; - var unitStatic; - var unitClone; - var // elems only contains original argument values. - order = []; - var values = {}; - // value is the index into the order array. - for (i = 0; i < args.length; i++) { - current = args[i]; - if (!(current instanceof Dimension)) { - if (Array.isArray(args[i].value)) { - Array.prototype.push.apply(args, Array.prototype.slice.call(args[i].value)); - continue; - } - else { - throw { type: 'Argument', message: 'incompatible types' }; - } - } - currentUnified = current.unit.toString() === '' && unitClone !== undefined ? new Dimension(current.value, unitClone).unify() : current.unify(); - unit = currentUnified.unit.toString() === '' && unitStatic !== undefined ? unitStatic : currentUnified.unit.toString(); - unitStatic = unit !== '' && unitStatic === undefined || unit !== '' && order[0].unify().unit.toString() === '' ? unit : unitStatic; - unitClone = unit !== '' && unitClone === undefined ? current.unit.toString() : unitClone; - j = values[''] !== undefined && unit !== '' && unit === unitStatic ? values[''] : values[unit]; - if (j === undefined) { - if (unitStatic !== undefined && unit !== unitStatic) { - throw { type: 'Argument', message: 'incompatible types' }; - } - values[unit] = order.length; - order.push(current); - continue; - } - referenceUnified = order[j].unit.toString() === '' && unitClone !== undefined ? new Dimension(order[j].value, unitClone).unify() : order[j].unify(); - if (isMin && currentUnified.value < referenceUnified.value || - !isMin && currentUnified.value > referenceUnified.value) { - order[j] = current; - } - } - if (order.length == 1) { - return order[0]; - } - args = order.map(function (a) { return a.toCSS(_this.context); }).join(this.context.compress ? ',' : ', '); - return new Anonymous("".concat(isMin ? 'min' : 'max', "(").concat(args, ")")); - }; - var number = { - min: function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - try { - return minMax.call(this, true, args); - } - catch (e) { } - }, - max: function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - try { - return minMax.call(this, false, args); - } - catch (e) { } - }, - convert: function (val, unit) { - return val.convertTo(unit.value); - }, - pi: function () { - return new Dimension(Math.PI); - }, - mod: function (a, b) { - return new Dimension(a.value % b.value, a.unit); - }, - pow: function (x, y) { - if (typeof x === 'number' && typeof y === 'number') { - x = new Dimension(x); - y = new Dimension(y); - } - else if (!(x instanceof Dimension) || !(y instanceof Dimension)) { - throw { type: 'Argument', message: 'arguments must be numbers' }; - } - return new Dimension(Math.pow(x.value, y.value), x.unit); - }, - percentage: function (n) { - var result = MathHelper(function (num) { return num * 100; }, '%', n); - return result; - } - }; - - var string = { - e: function (str) { - return new Quoted('"', str instanceof JavaScript ? str.evaluated : str.value, true); - }, - escape: function (str) { - return new Anonymous(encodeURI(str.value).replace(/=/g, '%3D').replace(/:/g, '%3A').replace(/#/g, '%23').replace(/;/g, '%3B') - .replace(/\(/g, '%28').replace(/\)/g, '%29')); - }, - replace: function (string, pattern, replacement, flags) { - var result = string.value; - replacement = (replacement.type === 'Quoted') ? - replacement.value : replacement.toCSS(); - result = result.replace(new RegExp(pattern.value, flags ? flags.value : ''), replacement); - return new Quoted(string.quote || '', result, string.escaped); - }, - '%': function (string /* arg, arg, ... */) { - var args = Array.prototype.slice.call(arguments, 1); - var result = string.value; - var _loop_1 = function (i_1) { - /* jshint loopfunc:true */ - result = result.replace(/%[sda]/i, function (token) { - var value = ((args[i_1].type === 'Quoted') && - token.match(/s/i)) ? args[i_1].value : args[i_1].toCSS(); - return token.match(/[A-Z]$/) ? encodeURIComponent(value) : value; - }); - }; - for (var i_1 = 0; i_1 < args.length; i_1++) { - _loop_1(i_1); - } - result = result.replace(/%%/g, '%'); - return new Quoted(string.quote || '', result, string.escaped); - } - }; - - var svg = (function () { - return { 'svg-gradient': function (direction) { - var stops; - var gradientDirectionSvg; - var gradientType = 'linear'; - var rectangleDimension = 'x="0" y="0" width="1" height="1"'; - var renderEnv = { compress: false }; - var returner; - var directionValue = direction.toCSS(renderEnv); - var i; - var color; - var position; - var positionValue; - var alpha; - function throwArgumentDescriptor() { - throw { type: 'Argument', - message: 'svg-gradient expects direction, start_color [start_position], [color position,]...,' + - ' end_color [end_position] or direction, color list' }; - } - if (arguments.length == 2) { - if (arguments[1].value.length < 2) { - throwArgumentDescriptor(); - } - stops = arguments[1].value; - } - else if (arguments.length < 3) { - throwArgumentDescriptor(); - } - else { - stops = Array.prototype.slice.call(arguments, 1); - } - switch (directionValue) { - case 'to bottom': - gradientDirectionSvg = 'x1="0%" y1="0%" x2="0%" y2="100%"'; - break; - case 'to right': - gradientDirectionSvg = 'x1="0%" y1="0%" x2="100%" y2="0%"'; - break; - case 'to bottom right': - gradientDirectionSvg = 'x1="0%" y1="0%" x2="100%" y2="100%"'; - break; - case 'to top right': - gradientDirectionSvg = 'x1="0%" y1="100%" x2="100%" y2="0%"'; - break; - case 'ellipse': - case 'ellipse at center': - gradientType = 'radial'; - gradientDirectionSvg = 'cx="50%" cy="50%" r="75%"'; - rectangleDimension = 'x="-50" y="-50" width="101" height="101"'; - break; - default: - throw { type: 'Argument', message: 'svg-gradient direction must be \'to bottom\', \'to right\',' + - ' \'to bottom right\', \'to top right\' or \'ellipse at center\'' }; - } - returner = "<".concat(gradientType, "Gradient id=\"g\" ").concat(gradientDirectionSvg, ">"); - for (i = 0; i < stops.length; i += 1) { - if (stops[i] instanceof Expression) { - color = stops[i].value[0]; - position = stops[i].value[1]; - } - else { - color = stops[i]; - position = undefined; - } - if (!(color instanceof Color) || (!((i === 0 || i + 1 === stops.length) && position === undefined) && !(position instanceof Dimension))) { - throwArgumentDescriptor(); - } - positionValue = position ? position.toCSS(renderEnv) : i === 0 ? '0%' : '100%'; - alpha = color.alpha; - returner += ""); - } - returner += ""); - returner = encodeURIComponent(returner); - returner = "data:image/svg+xml,".concat(returner); - return new URL(new Quoted("'".concat(returner, "'"), returner, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo); - } }; - }); - - var isa = function (n, Type) { return (n instanceof Type) ? Keyword.True : Keyword.False; }; - var isunit = function (n, unit) { - if (unit === undefined) { - throw { type: 'Argument', message: 'missing the required second argument to isunit.' }; - } - unit = typeof unit.value === 'string' ? unit.value : unit; - if (typeof unit !== 'string') { - throw { type: 'Argument', message: 'Second argument to isunit should be a unit or a string.' }; - } - return (n instanceof Dimension) && n.unit.is(unit) ? Keyword.True : Keyword.False; - }; - var types = { - isruleset: function (n) { - return isa(n, DetachedRuleset); - }, - iscolor: function (n) { - return isa(n, Color); - }, - isnumber: function (n) { - return isa(n, Dimension); - }, - isstring: function (n) { - return isa(n, Quoted); - }, - iskeyword: function (n) { - return isa(n, Keyword); - }, - isurl: function (n) { - return isa(n, URL); - }, - ispixel: function (n) { - return isunit(n, 'px'); - }, - ispercentage: function (n) { - return isunit(n, '%'); - }, - isem: function (n) { - return isunit(n, 'em'); - }, - isunit: isunit, - unit: function (val, unit) { - if (!(val instanceof Dimension)) { - throw { type: 'Argument', - message: "the first argument to unit must be a number".concat(val instanceof Operation ? '. Have you forgotten parenthesis?' : '') }; - } - if (unit) { - if (unit instanceof Keyword) { - unit = unit.value; - } - else { - unit = unit.toCSS(); - } - } - else { - unit = ''; - } - return new Dimension(val.value, unit); - }, - 'get-unit': function (n) { - return new Anonymous(n.unit); - } - }; - - var styleExpression = function (args) { - var _this = this; - args = Array.prototype.slice.call(args); - switch (args.length) { - case 0: throw { type: 'Argument', message: 'one or more arguments required' }; - } - var entityList = [new Variable(args[0].value, this.index, this.currentFileInfo).eval(this.context)]; - args = entityList.map(function (a) { return a.toCSS(_this.context); }).join(this.context.compress ? ',' : ', '); - return new Variable("style(".concat(args, ")")); - }; - var style$1 = { - style: function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - try { - return styleExpression.call(this, args); - } - catch (e) { } - }, - }; - - var functions = (function (environment) { - var functions = { functionRegistry: functionRegistry, functionCaller: functionCaller }; - // register functions - functionRegistry.addMultiple(boolean$1); - functionRegistry.add('default', defaultFunc.eval.bind(defaultFunc)); - functionRegistry.addMultiple(color); - functionRegistry.addMultiple(colorBlend); - functionRegistry.addMultiple(dataUri(environment)); - functionRegistry.addMultiple(list); - functionRegistry.addMultiple(mathFunctions); - functionRegistry.addMultiple(number); - functionRegistry.addMultiple(string); - functionRegistry.addMultiple(svg()); - functionRegistry.addMultiple(types); - functionRegistry.addMultiple(style$1); - return functions; - }); - - function transformTree (root, options) { - options = options || {}; - var evaldRoot; - var variables = options.variables; - var evalEnv = new contexts.Eval(options); - // - // Allows setting variables with a hash, so: - // - // `{ color: new tree.Color('#f01') }` will become: - // - // new tree.Declaration('@color', - // new tree.Value([ - // new tree.Expression([ - // new tree.Color('#f01') - // ]) - // ]) - // ) - // - if (typeof variables === 'object' && !Array.isArray(variables)) { - variables = Object.keys(variables).map(function (k) { - var value = variables[k]; - if (!(value instanceof tree.Value)) { - if (!(value instanceof tree.Expression)) { - value = new tree.Expression([value]); - } - value = new tree.Value([value]); - } - return new tree.Declaration("@".concat(k), value, false, null, 0); - }); - evalEnv.frames = [new tree.Ruleset(null, variables)]; - } - var visitors$1 = [ - new visitors.JoinSelectorVisitor(), - new visitors.MarkVisibleSelectorsVisitor(true), - new visitors.ExtendVisitor(), - new visitors.ToCSSVisitor({ compress: Boolean(options.compress) }) - ]; - var preEvalVisitors = []; - var v; - var visitorIterator; - /** - * first() / get() allows visitors to be added while visiting - * - * @todo Add scoping for visitors just like functions for @plugin; right now they're global - */ - if (options.pluginManager) { - visitorIterator = options.pluginManager.visitor(); - for (var i_1 = 0; i_1 < 2; i_1++) { - visitorIterator.first(); - while ((v = visitorIterator.get())) { - if (v.isPreEvalVisitor) { - if (i_1 === 0 || preEvalVisitors.indexOf(v) === -1) { - preEvalVisitors.push(v); - v.run(root); - } - } - else { - if (i_1 === 0 || visitors$1.indexOf(v) === -1) { - if (v.isPreVisitor) { - visitors$1.unshift(v); - } - else { - visitors$1.push(v); - } - } - } - } - } - } - evaldRoot = root.eval(evalEnv); - for (var i_2 = 0; i_2 < visitors$1.length; i_2++) { - visitors$1[i_2].run(evaldRoot); - } - // Run any remaining visitors added after eval pass - if (options.pluginManager) { - visitorIterator.first(); - while ((v = visitorIterator.get())) { - if (visitors$1.indexOf(v) === -1 && preEvalVisitors.indexOf(v) === -1) { - v.run(evaldRoot); - } - } - } - return evaldRoot; - } - - /** - * Plugin Manager - */ - var PluginManager = /** @class */ (function () { - function PluginManager(less) { - this.less = less; - this.visitors = []; - this.preProcessors = []; - this.postProcessors = []; - this.installedPlugins = []; - this.fileManagers = []; - this.iterator = -1; - this.pluginCache = {}; - this.Loader = new less.PluginLoader(less); - } - /** - * Adds all the plugins in the array - * @param {Array} plugins - */ - PluginManager.prototype.addPlugins = function (plugins) { - if (plugins) { - for (var i_1 = 0; i_1 < plugins.length; i_1++) { - this.addPlugin(plugins[i_1]); - } - } - }; - /** - * - * @param plugin - * @param {String} filename - */ - PluginManager.prototype.addPlugin = function (plugin, filename, functionRegistry) { - this.installedPlugins.push(plugin); - if (filename) { - this.pluginCache[filename] = plugin; - } - if (plugin.install) { - plugin.install(this.less, this, functionRegistry || this.less.functions.functionRegistry); - } - }; - /** - * - * @param filename - */ - PluginManager.prototype.get = function (filename) { - return this.pluginCache[filename]; - }; - /** - * Adds a visitor. The visitor object has options on itself to determine - * when it should run. - * @param visitor - */ - PluginManager.prototype.addVisitor = function (visitor) { - this.visitors.push(visitor); - }; - /** - * Adds a pre processor object - * @param {object} preProcessor - * @param {number} priority - guidelines 1 = before import, 1000 = import, 2000 = after import - */ - PluginManager.prototype.addPreProcessor = function (preProcessor, priority) { - var indexToInsertAt; - for (indexToInsertAt = 0; indexToInsertAt < this.preProcessors.length; indexToInsertAt++) { - if (this.preProcessors[indexToInsertAt].priority >= priority) { - break; - } - } - this.preProcessors.splice(indexToInsertAt, 0, { preProcessor: preProcessor, priority: priority }); - }; - /** - * Adds a post processor object - * @param {object} postProcessor - * @param {number} priority - guidelines 1 = before compression, 1000 = compression, 2000 = after compression - */ - PluginManager.prototype.addPostProcessor = function (postProcessor, priority) { - var indexToInsertAt; - for (indexToInsertAt = 0; indexToInsertAt < this.postProcessors.length; indexToInsertAt++) { - if (this.postProcessors[indexToInsertAt].priority >= priority) { - break; - } - } - this.postProcessors.splice(indexToInsertAt, 0, { postProcessor: postProcessor, priority: priority }); - }; - /** - * - * @param manager - */ - PluginManager.prototype.addFileManager = function (manager) { - this.fileManagers.push(manager); - }; - /** - * - * @returns {Array} - * @private - */ - PluginManager.prototype.getPreProcessors = function () { - var preProcessors = []; - for (var i_2 = 0; i_2 < this.preProcessors.length; i_2++) { - preProcessors.push(this.preProcessors[i_2].preProcessor); - } - return preProcessors; - }; - /** - * - * @returns {Array} - * @private - */ - PluginManager.prototype.getPostProcessors = function () { - var postProcessors = []; - for (var i_3 = 0; i_3 < this.postProcessors.length; i_3++) { - postProcessors.push(this.postProcessors[i_3].postProcessor); - } - return postProcessors; - }; - /** - * - * @returns {Array} - * @private - */ - PluginManager.prototype.getVisitors = function () { - return this.visitors; - }; - PluginManager.prototype.visitor = function () { - var self = this; - return { - first: function () { - self.iterator = -1; - return self.visitors[self.iterator]; - }, - get: function () { - self.iterator += 1; - return self.visitors[self.iterator]; - } - }; - }; - /** - * - * @returns {Array} - * @private - */ - PluginManager.prototype.getFileManagers = function () { - return this.fileManagers; - }; - return PluginManager; - }()); - var pm; - var PluginManagerFactory = function (less, newFactory) { - if (newFactory || !pm) { - pm = new PluginManager(less); - } - return pm; - }; - - function SourceMapOutput (environment) { - var SourceMapOutput = /** @class */ (function () { - function SourceMapOutput(options) { - this._css = []; - this._rootNode = options.rootNode; - this._contentsMap = options.contentsMap; - this._contentsIgnoredCharsMap = options.contentsIgnoredCharsMap; - if (options.sourceMapFilename) { - this._sourceMapFilename = options.sourceMapFilename.replace(/\\/g, '/'); - } - this._outputFilename = options.outputFilename; - this.sourceMapURL = options.sourceMapURL; - if (options.sourceMapBasepath) { - this._sourceMapBasepath = options.sourceMapBasepath.replace(/\\/g, '/'); - } - if (options.sourceMapRootpath) { - this._sourceMapRootpath = options.sourceMapRootpath.replace(/\\/g, '/'); - if (this._sourceMapRootpath.charAt(this._sourceMapRootpath.length - 1) !== '/') { - this._sourceMapRootpath += '/'; - } - } - else { - this._sourceMapRootpath = ''; - } - this._outputSourceFiles = options.outputSourceFiles; - this._sourceMapGeneratorConstructor = environment.getSourceMapGenerator(); - this._lineNumber = 0; - this._column = 0; - } - SourceMapOutput.prototype.removeBasepath = function (path) { - if (this._sourceMapBasepath && path.indexOf(this._sourceMapBasepath) === 0) { - path = path.substring(this._sourceMapBasepath.length); - if (path.charAt(0) === '\\' || path.charAt(0) === '/') { - path = path.substring(1); - } - } - return path; - }; - SourceMapOutput.prototype.normalizeFilename = function (filename) { - filename = filename.replace(/\\/g, '/'); - filename = this.removeBasepath(filename); - return (this._sourceMapRootpath || '') + filename; - }; - SourceMapOutput.prototype.add = function (chunk, fileInfo, index, mapLines) { - // ignore adding empty strings - if (!chunk) { - return; - } - var lines, sourceLines, columns, sourceColumns, i; - if (fileInfo && fileInfo.filename) { - var inputSource = this._contentsMap[fileInfo.filename]; - // remove vars/banner added to the top of the file - if (this._contentsIgnoredCharsMap[fileInfo.filename]) { - // adjust the index - index -= this._contentsIgnoredCharsMap[fileInfo.filename]; - if (index < 0) { - index = 0; - } - // adjust the source - inputSource = inputSource.slice(this._contentsIgnoredCharsMap[fileInfo.filename]); - } - /** - * ignore empty content, or failsafe - * if contents map is incorrect - */ - if (inputSource === undefined) { - this._css.push(chunk); - return; - } - inputSource = inputSource.substring(0, index); - sourceLines = inputSource.split('\n'); - sourceColumns = sourceLines[sourceLines.length - 1]; - } - lines = chunk.split('\n'); - columns = lines[lines.length - 1]; - if (fileInfo && fileInfo.filename) { - if (!mapLines) { - this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + 1, column: this._column }, - original: { line: sourceLines.length, column: sourceColumns.length }, - source: this.normalizeFilename(fileInfo.filename) }); - } - else { - for (i = 0; i < lines.length; i++) { - this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + i + 1, column: i === 0 ? this._column : 0 }, - original: { line: sourceLines.length + i, column: i === 0 ? sourceColumns.length : 0 }, - source: this.normalizeFilename(fileInfo.filename) }); - } - } - } - if (lines.length === 1) { - this._column += columns.length; - } - else { - this._lineNumber += lines.length - 1; - this._column = columns.length; - } - this._css.push(chunk); - }; - SourceMapOutput.prototype.isEmpty = function () { - return this._css.length === 0; - }; - SourceMapOutput.prototype.toCSS = function (context) { - this._sourceMapGenerator = new this._sourceMapGeneratorConstructor({ file: this._outputFilename, sourceRoot: null }); - if (this._outputSourceFiles) { - for (var filename in this._contentsMap) { - // eslint-disable-next-line no-prototype-builtins - if (this._contentsMap.hasOwnProperty(filename)) { - var source = this._contentsMap[filename]; - if (this._contentsIgnoredCharsMap[filename]) { - source = source.slice(this._contentsIgnoredCharsMap[filename]); - } - this._sourceMapGenerator.setSourceContent(this.normalizeFilename(filename), source); - } - } - } - this._rootNode.genCSS(context, this); - if (this._css.length > 0) { - var sourceMapURL = void 0; - var sourceMapContent = JSON.stringify(this._sourceMapGenerator.toJSON()); - if (this.sourceMapURL) { - sourceMapURL = this.sourceMapURL; - } - else if (this._sourceMapFilename) { - sourceMapURL = this._sourceMapFilename; - } - this.sourceMapURL = sourceMapURL; - this.sourceMap = sourceMapContent; - } - return this._css.join(''); - }; - return SourceMapOutput; - }()); - return SourceMapOutput; - } - - function SourceMapBuilder (SourceMapOutput, environment) { - var SourceMapBuilder = /** @class */ (function () { - function SourceMapBuilder(options) { - this.options = options; - } - SourceMapBuilder.prototype.toCSS = function (rootNode, options, imports) { - var sourceMapOutput = new SourceMapOutput({ - contentsIgnoredCharsMap: imports.contentsIgnoredChars, - rootNode: rootNode, - contentsMap: imports.contents, - sourceMapFilename: this.options.sourceMapFilename, - sourceMapURL: this.options.sourceMapURL, - outputFilename: this.options.sourceMapOutputFilename, - sourceMapBasepath: this.options.sourceMapBasepath, - sourceMapRootpath: this.options.sourceMapRootpath, - outputSourceFiles: this.options.outputSourceFiles, - sourceMapGenerator: this.options.sourceMapGenerator, - sourceMapFileInline: this.options.sourceMapFileInline, - disableSourcemapAnnotation: this.options.disableSourcemapAnnotation - }); - var css = sourceMapOutput.toCSS(options); - this.sourceMap = sourceMapOutput.sourceMap; - this.sourceMapURL = sourceMapOutput.sourceMapURL; - if (this.options.sourceMapInputFilename) { - this.sourceMapInputFilename = sourceMapOutput.normalizeFilename(this.options.sourceMapInputFilename); - } - if (this.options.sourceMapBasepath !== undefined && this.sourceMapURL !== undefined) { - this.sourceMapURL = sourceMapOutput.removeBasepath(this.sourceMapURL); - } - return css + this.getCSSAppendage(); - }; - SourceMapBuilder.prototype.getCSSAppendage = function () { - var sourceMapURL = this.sourceMapURL; - if (this.options.sourceMapFileInline) { - if (this.sourceMap === undefined) { - return ''; - } - sourceMapURL = "data:application/json;base64,".concat(environment.encodeBase64(this.sourceMap)); - } - if (this.options.disableSourcemapAnnotation) { - return ''; - } - if (sourceMapURL) { - return "/*# sourceMappingURL=".concat(sourceMapURL, " */"); - } - return ''; - }; - SourceMapBuilder.prototype.getExternalSourceMap = function () { - return this.sourceMap; - }; - SourceMapBuilder.prototype.setExternalSourceMap = function (sourceMap) { - this.sourceMap = sourceMap; - }; - SourceMapBuilder.prototype.isInline = function () { - return this.options.sourceMapFileInline; - }; - SourceMapBuilder.prototype.getSourceMapURL = function () { - return this.sourceMapURL; - }; - SourceMapBuilder.prototype.getOutputFilename = function () { - return this.options.sourceMapOutputFilename; - }; - SourceMapBuilder.prototype.getInputFilename = function () { - return this.sourceMapInputFilename; - }; - return SourceMapBuilder; - }()); - return SourceMapBuilder; - } - - function ParseTree (SourceMapBuilder) { - var ParseTree = /** @class */ (function () { - function ParseTree(root, imports) { - this.root = root; - this.imports = imports; - } - ParseTree.prototype.toCSS = function (options) { - var evaldRoot; - var result = {}; - var sourceMapBuilder; - try { - evaldRoot = transformTree(this.root, options); - } - catch (e) { - throw new LessError(e, this.imports); - } - try { - var compress = Boolean(options.compress); - if (compress) { - logger$1.warn('The compress option has been deprecated. ' + - 'We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.'); - } - var toCSSOptions = { - compress: compress, - dumpLineNumbers: options.dumpLineNumbers, - strictUnits: Boolean(options.strictUnits), - numPrecision: 8 - }; - if (options.sourceMap) { - sourceMapBuilder = new SourceMapBuilder(options.sourceMap); - result.css = sourceMapBuilder.toCSS(evaldRoot, toCSSOptions, this.imports); - } - else { - result.css = evaldRoot.toCSS(toCSSOptions); - } - } - catch (e) { - throw new LessError(e, this.imports); - } - if (options.pluginManager) { - var postProcessors = options.pluginManager.getPostProcessors(); - for (var i_1 = 0; i_1 < postProcessors.length; i_1++) { - result.css = postProcessors[i_1].process(result.css, { sourceMap: sourceMapBuilder, options: options, imports: this.imports }); - } - } - if (options.sourceMap) { - result.map = sourceMapBuilder.getExternalSourceMap(); - } - result.imports = []; - for (var file_1 in this.imports.files) { - if (Object.prototype.hasOwnProperty.call(this.imports.files, file_1) && file_1 !== this.imports.rootFilename) { - result.imports.push(file_1); - } - } - return result; - }; - return ParseTree; - }()); - return ParseTree; - } - - function ImportManager (environment) { - // FileInfo = { - // 'rewriteUrls' - option - whether to adjust URL's to be relative - // 'filename' - full resolved filename of current file - // 'rootpath' - path to append to normal URLs for this node - // 'currentDirectory' - path to the current file, absolute - // 'rootFilename' - filename of the base file - // 'entryPath' - absolute path to the entry file - // 'reference' - whether the file should not be output and only output parts that are referenced - var ImportManager = /** @class */ (function () { - function ImportManager(less, context, rootFileInfo) { - this.less = less; - this.rootFilename = rootFileInfo.filename; - this.paths = context.paths || []; // Search paths, when importing - this.contents = {}; // map - filename to contents of all the files - this.contentsIgnoredChars = {}; // map - filename to lines at the beginning of each file to ignore - this.mime = context.mime; - this.error = null; - this.context = context; - // Deprecated? Unused outside of here, could be useful. - this.queue = []; // Files which haven't been imported yet - this.files = {}; // Holds the imported parse trees. - } - /** - * Add an import to be imported - * @param path - the raw path - * @param tryAppendExtension - whether to try appending a file extension (.less or .js if the path has no extension) - * @param currentFileInfo - the current file info (used for instance to work out relative paths) - * @param importOptions - import options - * @param callback - callback for when it is imported - */ - ImportManager.prototype.push = function (path, tryAppendExtension, currentFileInfo, importOptions, callback) { - var importManager = this, pluginLoader = this.context.pluginManager.Loader; - this.queue.push(path); - var fileParsedFunc = function (e, root, fullPath) { - importManager.queue.splice(importManager.queue.indexOf(path), 1); // Remove the path from the queue - var importedEqualsRoot = fullPath === importManager.rootFilename; - if (importOptions.optional && e) { - callback(null, { rules: [] }, false, null); - logger$1.info("The file ".concat(fullPath, " was skipped because it was not found and the import was marked optional.")); - } - else { - // Inline imports aren't cached here. - // If we start to cache them, please make sure they won't conflict with non-inline imports of the - // same name as they used to do before this comment and the condition below have been added. - if (!importManager.files[fullPath] && !importOptions.inline) { - importManager.files[fullPath] = { root: root, options: importOptions }; - } - if (e && !importManager.error) { - importManager.error = e; - } - callback(e, root, importedEqualsRoot, fullPath); - } - }; - var newFileInfo = { - rewriteUrls: this.context.rewriteUrls, - entryPath: currentFileInfo.entryPath, - rootpath: currentFileInfo.rootpath, - rootFilename: currentFileInfo.rootFilename - }; - var fileManager = environment.getFileManager(path, currentFileInfo.currentDirectory, this.context, environment); - if (!fileManager) { - fileParsedFunc({ message: "Could not find a file-manager for ".concat(path) }); - return; - } - var loadFileCallback = function (loadedFile) { - var plugin; - var resolvedFilename = loadedFile.filename; - var contents = loadedFile.contents.replace(/^\uFEFF/, ''); - // Pass on an updated rootpath if path of imported file is relative and file - // is in a (sub|sup) directory - // - // Examples: - // - If path of imported file is 'module/nav/nav.less' and rootpath is 'less/', - // then rootpath should become 'less/module/nav/' - // - If path of imported file is '../mixins.less' and rootpath is 'less/', - // then rootpath should become 'less/../' - newFileInfo.currentDirectory = fileManager.getPath(resolvedFilename); - if (newFileInfo.rewriteUrls) { - newFileInfo.rootpath = fileManager.join((importManager.context.rootpath || ''), fileManager.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath)); - if (!fileManager.isPathAbsolute(newFileInfo.rootpath) && fileManager.alwaysMakePathsAbsolute()) { - newFileInfo.rootpath = fileManager.join(newFileInfo.entryPath, newFileInfo.rootpath); - } - } - newFileInfo.filename = resolvedFilename; - var newEnv = new contexts.Parse(importManager.context); - newEnv.processImports = false; - importManager.contents[resolvedFilename] = contents; - if (currentFileInfo.reference || importOptions.reference) { - newFileInfo.reference = true; - } - if (importOptions.isPlugin) { - plugin = pluginLoader.evalPlugin(contents, newEnv, importManager, importOptions.pluginArgs, newFileInfo); - if (plugin instanceof LessError) { - fileParsedFunc(plugin, null, resolvedFilename); - } - else { - fileParsedFunc(null, plugin, resolvedFilename); - } - } - else if (importOptions.inline) { - fileParsedFunc(null, contents, resolvedFilename); - } - else { - // import (multiple) parse trees apparently get altered and can't be cached. - // TODO: investigate why this is - if (importManager.files[resolvedFilename] - && !importManager.files[resolvedFilename].options.multiple - && !importOptions.multiple) { - fileParsedFunc(null, importManager.files[resolvedFilename].root, resolvedFilename); - } - else { - new Parser(newEnv, importManager, newFileInfo).parse(contents, function (e, root) { - fileParsedFunc(e, root, resolvedFilename); - }); - } - } - }; - var loadedFile; - var promise; - var context = clone(this.context); - if (tryAppendExtension) { - context.ext = importOptions.isPlugin ? '.js' : '.less'; - } - if (importOptions.isPlugin) { - context.mime = 'application/javascript'; - if (context.syncImport) { - loadedFile = pluginLoader.loadPluginSync(path, currentFileInfo.currentDirectory, context, environment, fileManager); - } - else { - promise = pluginLoader.loadPlugin(path, currentFileInfo.currentDirectory, context, environment, fileManager); - } - } - else { - if (context.syncImport) { - loadedFile = fileManager.loadFileSync(path, currentFileInfo.currentDirectory, context, environment); - } - else { - promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, context, environment, function (err, loadedFile) { - if (err) { - fileParsedFunc(err); - } - else { - loadFileCallback(loadedFile); - } - }); - } - } - if (loadedFile) { - if (!loadedFile.filename) { - fileParsedFunc(loadedFile); - } - else { - loadFileCallback(loadedFile); - } - } - else if (promise) { - promise.then(loadFileCallback, fileParsedFunc); - } - }; - return ImportManager; - }()); - return ImportManager; - } - - function Parse (environment, ParseTree, ImportManager) { - var parse = function (input, options, callback) { - if (typeof options === 'function') { - callback = options; - options = copyOptions(this.options, {}); - } - else { - options = copyOptions(this.options, options || {}); - } - if (!callback) { - var self_1 = this; - return new Promise(function (resolve, reject) { - parse.call(self_1, input, options, function (err, output) { - if (err) { - reject(err); - } - else { - resolve(output); - } - }); - }); - } - else { - var context_1; - var rootFileInfo = void 0; - var pluginManager_1 = new PluginManagerFactory(this, !options.reUsePluginManager); - options.pluginManager = pluginManager_1; - context_1 = new contexts.Parse(options); - if (options.rootFileInfo) { - rootFileInfo = options.rootFileInfo; - } - else { - var filename = options.filename || 'input'; - var entryPath = filename.replace(/[^/\\]*$/, ''); - rootFileInfo = { - filename: filename, - rewriteUrls: context_1.rewriteUrls, - rootpath: context_1.rootpath || '', - currentDirectory: entryPath, - entryPath: entryPath, - rootFilename: filename - }; - // add in a missing trailing slash - if (rootFileInfo.rootpath && rootFileInfo.rootpath.slice(-1) !== '/') { - rootFileInfo.rootpath += '/'; - } - } - var imports_1 = new ImportManager(this, context_1, rootFileInfo); - this.importManager = imports_1; - // TODO: allow the plugins to be just a list of paths or names - // Do an async plugin queue like lessc - if (options.plugins) { - options.plugins.forEach(function (plugin) { - var evalResult, contents; - if (plugin.fileContent) { - contents = plugin.fileContent.replace(/^\uFEFF/, ''); - evalResult = pluginManager_1.Loader.evalPlugin(contents, context_1, imports_1, plugin.options, plugin.filename); - if (evalResult instanceof LessError) { - return callback(evalResult); - } - } - else { - pluginManager_1.addPlugin(plugin); - } - }); - } - new Parser(context_1, imports_1, rootFileInfo) - .parse(input, function (e, root) { - if (e) { - return callback(e); - } - callback(null, root, imports_1, options); - }, options); - } - }; - return parse; - } - - function Render (environment, ParseTree) { - var render = function (input, options, callback) { - if (typeof options === 'function') { - callback = options; - options = copyOptions(this.options, {}); - } - else { - options = copyOptions(this.options, options || {}); - } - if (!callback) { - var self_1 = this; - return new Promise(function (resolve, reject) { - render.call(self_1, input, options, function (err, output) { - if (err) { - reject(err); - } - else { - resolve(output); - } - }); - }); - } - else { - this.parse(input, options, function (err, root, imports, options) { - if (err) { - return callback(err); - } - var result; - try { - var parseTree = new ParseTree(root, imports); - result = parseTree.toCSS(options); - } - catch (err) { - return callback(err); - } - callback(null, result); - }); - } - }; - return render; - } - - var version = "4.4.2"; - - function parseNodeVersion(version) { - var match = version.match(/^v(\d{1,2})\.(\d{1,2})\.(\d{1,2})(?:-([0-9A-Za-z-.]+))?(?:\+([0-9A-Za-z-.]+))?$/); // eslint-disable-line max-len - if (!match) { - throw new Error('Unable to parse: ' + version); - } - - var res = { - major: parseInt(match[1], 10), - minor: parseInt(match[2], 10), - patch: parseInt(match[3], 10), - pre: match[4] || '', - build: match[5] || '', - }; - - return res; - } - - var parseNodeVersion_1 = parseNodeVersion; - - function lessRoot (environment, fileManagers) { - var sourceMapOutput, sourceMapBuilder, parseTree, importManager; - environment = new Environment(environment, fileManagers); - sourceMapOutput = SourceMapOutput(environment); - sourceMapBuilder = SourceMapBuilder(sourceMapOutput, environment); - parseTree = ParseTree(sourceMapBuilder); - importManager = ImportManager(environment); - var render = Render(environment, parseTree); - var parse = Parse(environment, parseTree, importManager); - var v = parseNodeVersion_1("v".concat(version)); - var initial = { - version: [v.major, v.minor, v.patch], - data: data, - tree: tree, - Environment: Environment, - AbstractFileManager: AbstractFileManager, - AbstractPluginLoader: AbstractPluginLoader, - environment: environment, - visitors: visitors, - Parser: Parser, - functions: functions(environment), - contexts: contexts, - SourceMapOutput: sourceMapOutput, - SourceMapBuilder: sourceMapBuilder, - ParseTree: parseTree, - ImportManager: importManager, - render: render, - parse: parse, - LessError: LessError, - transformTree: transformTree, - utils: utils, - PluginManager: PluginManagerFactory, - logger: logger$1 - }; - // Create a public API - var ctor = function (t) { - return function () { - var obj = Object.create(t.prototype); - t.apply(obj, Array.prototype.slice.call(arguments, 0)); - return obj; - }; - }; - var t; - var api = Object.create(initial); - for (var n in initial.tree) { - /* eslint guard-for-in: 0 */ - t = initial.tree[n]; - if (typeof t === 'function') { - api[n.toLowerCase()] = ctor(t); - } - else { - api[n] = Object.create(null); - for (var o in t) { - /* eslint guard-for-in: 0 */ - api[n][o.toLowerCase()] = ctor(t[o]); - } - } - } - /** - * Some of the functions assume a `this` context of the API object, - * which causes it to fail when wrapped for ES6 imports. - * - * An assumed `this` should be removed in the future. - */ - initial.parse = initial.parse.bind(api); - initial.render = initial.render.bind(api); - return api; - } - - var options$1; - var logger; - var fileCache = {}; - // TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load - var FileManager = function () { }; - FileManager.prototype = Object.assign(new AbstractFileManager(), { - alwaysMakePathsAbsolute: function () { - return true; - }, - join: function (basePath, laterPath) { - if (!basePath) { - return laterPath; - } - return this.extractUrlParts(laterPath, basePath).path; - }, - doXHR: function (url, type, callback, errback) { - var xhr = new XMLHttpRequest(); - var async = options$1.isFileProtocol ? options$1.fileAsync : true; - if (typeof xhr.overrideMimeType === 'function') { - xhr.overrideMimeType('text/css'); - } - logger.debug("XHR: Getting '".concat(url, "'")); - xhr.open('GET', url, async); - xhr.setRequestHeader('Accept', type || 'text/x-less, text/css; q=0.9, */*; q=0.5'); - xhr.send(null); - function handleResponse(xhr, callback, errback) { - if (xhr.status >= 200 && xhr.status < 300) { - callback(xhr.responseText, xhr.getResponseHeader('Last-Modified')); - } - else if (typeof errback === 'function') { - errback(xhr.status, url); - } - } - if (options$1.isFileProtocol && !options$1.fileAsync) { - if (xhr.status === 0 || (xhr.status >= 200 && xhr.status < 300)) { - callback(xhr.responseText); - } - else { - errback(xhr.status, url); - } - } - else if (async) { - xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - handleResponse(xhr, callback, errback); - } - }; - } - else { - handleResponse(xhr, callback, errback); - } - }, - supports: function () { - return true; - }, - clearFileCache: function () { - fileCache = {}; - }, - loadFile: function (filename, currentDirectory, options) { - // TODO: Add prefix support like less-node? - // What about multiple paths? - if (currentDirectory && !this.isPathAbsolute(filename)) { - filename = currentDirectory + filename; - } - filename = options.ext ? this.tryAppendExtension(filename, options.ext) : filename; - options = options || {}; - // sheet may be set to the stylesheet for the initial load or a collection of properties including - // some context variables for imports - var hrefParts = this.extractUrlParts(filename, window.location.href); - var href = hrefParts.url; - var self = this; - return new Promise(function (resolve, reject) { - if (options.useFileCache && fileCache[href]) { - try { - var lessText_1 = fileCache[href]; - return resolve({ contents: lessText_1, filename: href, webInfo: { lastModified: new Date() } }); - } - catch (e) { - return reject({ filename: href, message: "Error loading file ".concat(href, " error was ").concat(e.message) }); - } - } - self.doXHR(href, options.mime, function doXHRCallback(data, lastModified) { - // per file cache - fileCache[href] = data; - // Use remote copy (re-parse) - resolve({ contents: data, filename: href, webInfo: { lastModified: lastModified } }); - }, function doXHRError(status, url) { - reject({ type: 'File', message: "'".concat(url, "' wasn't found (").concat(status, ")"), href: href }); - }); - }); - } - }); - var FM = (function (opts, log) { - options$1 = opts; - logger = log; - return FileManager; - }); - - /** - * @todo Add tests for browser `@plugin` - */ - /** - * Browser Plugin Loader - */ - var PluginLoader = function (less) { - this.less = less; - // Should we shim this.require for browser? Probably not? - }; - PluginLoader.prototype = Object.assign(new AbstractPluginLoader(), { - loadPlugin: function (filename, basePath, context, environment, fileManager) { - return new Promise(function (fulfill, reject) { - fileManager.loadFile(filename, basePath, context, environment) - .then(fulfill).catch(reject); - }); - } - }); - - var LogListener = (function (less, options) { - var logLevel_debug = 4; - var logLevel_info = 3; - var logLevel_warn = 2; - var logLevel_error = 1; - // The amount of logging in the javascript console. - // 3 - Debug, information and errors - // 2 - Information and errors - // 1 - Errors - // 0 - None - // Defaults to 2 - options.logLevel = typeof options.logLevel !== 'undefined' ? options.logLevel : (options.env === 'development' ? logLevel_info : logLevel_error); - if (!options.loggers) { - options.loggers = [{ - debug: function (msg) { - if (options.logLevel >= logLevel_debug) { - console.log(msg); - } - }, - info: function (msg) { - if (options.logLevel >= logLevel_info) { - console.log(msg); - } - }, - warn: function (msg) { - if (options.logLevel >= logLevel_warn) { - console.warn(msg); - } - }, - error: function (msg) { - if (options.logLevel >= logLevel_error) { - console.error(msg); - } - } - }]; - } - for (var i_1 = 0; i_1 < options.loggers.length; i_1++) { - less.logger.addListener(options.loggers[i_1]); - } - }); - - var ErrorReporting = (function (window, less, options) { - function errorHTML(e, rootHref) { - var id = "less-error-message:".concat(extractId(rootHref || '')); - var template = '
  • {content}
  • '; - var elem = window.document.createElement('div'); - var timer; - var content; - var errors = []; - var filename = e.filename || rootHref; - var filenameNoPath = filename.match(/([^/]+(\?.*)?)$/)[1]; - elem.id = id; - elem.className = 'less-error-message'; - content = "

    ".concat(e.type || 'Syntax', "Error: ").concat(e.message || 'There is an error in your .less file') + - "

    in ").concat(filenameNoPath, " "); - var errorline = function (e, i, classname) { - if (e.extract[i] !== undefined) { - errors.push(template.replace(/\{line\}/, (parseInt(e.line, 10) || 0) + (i - 1)) - .replace(/\{class\}/, classname) - .replace(/\{content\}/, e.extract[i])); - } - }; - if (e.line) { - errorline(e, 0, ''); - errorline(e, 1, 'line'); - errorline(e, 2, ''); - content += "on line ".concat(e.line, ", column ").concat(e.column + 1, ":

    "); - } - if (e.stack && (e.extract || options.logLevel >= 4)) { - content += "
    Stack Trace
    ".concat(e.stack.split('\n').slice(1).join('
    ')); - } - elem.innerHTML = content; - // CSS for error messages - browser.createCSS(window.document, [ - '.less-error-message ul, .less-error-message li {', - 'list-style-type: none;', - 'margin-right: 15px;', - 'padding: 4px 0;', - 'margin: 0;', - '}', - '.less-error-message label {', - 'font-size: 12px;', - 'margin-right: 15px;', - 'padding: 4px 0;', - 'color: #cc7777;', - '}', - '.less-error-message pre {', - 'color: #dd6666;', - 'padding: 4px 0;', - 'margin: 0;', - 'display: inline-block;', - '}', - '.less-error-message pre.line {', - 'color: #ff0000;', - '}', - '.less-error-message h3 {', - 'font-size: 20px;', - 'font-weight: bold;', - 'padding: 15px 0 5px 0;', - 'margin: 0;', - '}', - '.less-error-message a {', - 'color: #10a', - '}', - '.less-error-message .error {', - 'color: red;', - 'font-weight: bold;', - 'padding-bottom: 2px;', - 'border-bottom: 1px dashed red;', - '}' - ].join('\n'), { title: 'error-message' }); - elem.style.cssText = [ - 'font-family: Arial, sans-serif', - 'border: 1px solid #e00', - 'background-color: #eee', - 'border-radius: 5px', - '-webkit-border-radius: 5px', - '-moz-border-radius: 5px', - 'color: #e00', - 'padding: 15px', - 'margin-bottom: 15px' - ].join(';'); - if (options.env === 'development') { - timer = setInterval(function () { - var document = window.document; - var body = document.body; - if (body) { - if (document.getElementById(id)) { - body.replaceChild(elem, document.getElementById(id)); - } - else { - body.insertBefore(elem, body.firstChild); - } - clearInterval(timer); - } - }, 10); - } - } - function removeErrorHTML(path) { - var node = window.document.getElementById("less-error-message:".concat(extractId(path))); - if (node) { - node.parentNode.removeChild(node); - } - } - function removeError(path) { - if (!options.errorReporting || options.errorReporting === 'html') { - removeErrorHTML(path); - } - else if (options.errorReporting === 'console') ; - else if (typeof options.errorReporting === 'function') { - options.errorReporting('remove', path); - } - } - function errorConsole(e, rootHref) { - var template = '{line} {content}'; - var filename = e.filename || rootHref; - var errors = []; - var content = "".concat(e.type || 'Syntax', "Error: ").concat(e.message || 'There is an error in your .less file', " in ").concat(filename); - var errorline = function (e, i, classname) { - if (e.extract[i] !== undefined) { - errors.push(template.replace(/\{line\}/, (parseInt(e.line, 10) || 0) + (i - 1)) - .replace(/\{class\}/, classname) - .replace(/\{content\}/, e.extract[i])); - } - }; - if (e.line) { - errorline(e, 0, ''); - errorline(e, 1, 'line'); - errorline(e, 2, ''); - content += " on line ".concat(e.line, ", column ").concat(e.column + 1, ":\n").concat(errors.join('\n')); - } - if (e.stack && (e.extract || options.logLevel >= 4)) { - content += "\nStack Trace\n".concat(e.stack); - } - less.logger.error(content); - } - function error(e, rootHref) { - if (!options.errorReporting || options.errorReporting === 'html') { - errorHTML(e, rootHref); - } - else if (options.errorReporting === 'console') { - errorConsole(e, rootHref); - } - else if (typeof options.errorReporting === 'function') { - options.errorReporting('add', e, rootHref); - } - } - return { - add: error, - remove: removeError - }; - }); - - // Cache system is a bit outdated and could do with work - var Cache = (function (window, options, logger) { - var cache = null; - if (options.env !== 'development') { - try { - cache = (typeof window.localStorage === 'undefined') ? null : window.localStorage; - } - catch (_) { } - } - return { - setCSS: function (path, lastModified, modifyVars, styles) { - if (cache) { - logger.info("saving ".concat(path, " to cache.")); - try { - cache.setItem(path, styles); - cache.setItem("".concat(path, ":timestamp"), lastModified); - if (modifyVars) { - cache.setItem("".concat(path, ":vars"), JSON.stringify(modifyVars)); - } - } - catch (e) { - // TODO - could do with adding more robust error handling - logger.error("failed to save \"".concat(path, "\" to local storage for caching.")); - } - } - }, - getCSS: function (path, webInfo, modifyVars) { - var css = cache && cache.getItem(path); - var timestamp = cache && cache.getItem("".concat(path, ":timestamp")); - var vars = cache && cache.getItem("".concat(path, ":vars")); - modifyVars = modifyVars || {}; - vars = vars || '{}'; // if not set, treat as the JSON representation of an empty object - if (timestamp && webInfo.lastModified && - (new Date(webInfo.lastModified).valueOf() === - new Date(timestamp).valueOf()) && - JSON.stringify(modifyVars) === vars) { - // Use local copy - return css; - } - } - }; - }); - - var ImageSize = (function () { - function imageSize() { - throw { - type: 'Runtime', - message: 'Image size functions are not supported in browser version of less' - }; - } - var imageFunctions = { - 'image-size': function (filePathNode) { - imageSize(); - return -1; - }, - 'image-width': function (filePathNode) { - imageSize(); - return -1; - }, - 'image-height': function (filePathNode) { - imageSize(); - return -1; - } - }; - functionRegistry.addMultiple(imageFunctions); - }); - - // - var root = (function (window, options) { - var document = window.document; - var less = lessRoot(); - less.options = options; - var environment = less.environment; - var FileManager = FM(options, less.logger); - var fileManager = new FileManager(); - environment.addFileManager(fileManager); - less.FileManager = FileManager; - less.PluginLoader = PluginLoader; - LogListener(less, options); - var errors = ErrorReporting(window, less, options); - var cache = less.cache = options.cache || Cache(window, options, less.logger); - ImageSize(less.environment); - // Setup user functions - Deprecate? - if (options.functions) { - less.functions.functionRegistry.addMultiple(options.functions); - } - var typePattern = /^text\/(x-)?less$/; - function clone(obj) { - var cloned = {}; - for (var prop in obj) { - if (Object.prototype.hasOwnProperty.call(obj, prop)) { - cloned[prop] = obj[prop]; - } - } - return cloned; - } - // only really needed for phantom - function bind(func, thisArg) { - var curryArgs = Array.prototype.slice.call(arguments, 2); - return function () { - var args = curryArgs.concat(Array.prototype.slice.call(arguments, 0)); - return func.apply(thisArg, args); - }; - } - function loadStyles(modifyVars) { - var styles = document.getElementsByTagName('style'); - var style; - for (var i_1 = 0; i_1 < styles.length; i_1++) { - style = styles[i_1]; - if (style.type.match(typePattern)) { - var instanceOptions = clone(options); - instanceOptions.modifyVars = modifyVars; - var lessText_1 = style.innerHTML || ''; - instanceOptions.filename = document.location.href.replace(/#.*$/, ''); - /* jshint loopfunc:true */ - // use closure to store current style - less.render(lessText_1, instanceOptions, bind(function (style, e, result) { - if (e) { - errors.add(e, 'inline'); - } - else { - style.type = 'text/css'; - if (style.styleSheet) { - style.styleSheet.cssText = result.css; - } - else { - style.innerHTML = result.css; - } - } - }, null, style)); - } - } - } - function loadStyleSheet(sheet, callback, reload, remaining, modifyVars) { - var instanceOptions = clone(options); - addDataAttr(instanceOptions, sheet); - instanceOptions.mime = sheet.type; - if (modifyVars) { - instanceOptions.modifyVars = modifyVars; - } - function loadInitialFileCallback(loadedFile) { - var data = loadedFile.contents; - var path = loadedFile.filename; - var webInfo = loadedFile.webInfo; - var newFileInfo = { - currentDirectory: fileManager.getPath(path), - filename: path, - rootFilename: path, - rewriteUrls: instanceOptions.rewriteUrls - }; - newFileInfo.entryPath = newFileInfo.currentDirectory; - newFileInfo.rootpath = instanceOptions.rootpath || newFileInfo.currentDirectory; - if (webInfo) { - webInfo.remaining = remaining; - var css = cache.getCSS(path, webInfo, instanceOptions.modifyVars); - if (!reload && css) { - webInfo.local = true; - callback(null, css, data, sheet, webInfo, path); - return; - } - } - // TODO add tests around how this behaves when reloading - errors.remove(path); - instanceOptions.rootFileInfo = newFileInfo; - less.render(data, instanceOptions, function (e, result) { - if (e) { - e.href = path; - callback(e); - } - else { - cache.setCSS(sheet.href, webInfo.lastModified, instanceOptions.modifyVars, result.css); - callback(null, result.css, data, sheet, webInfo, path); - } - }); - } - fileManager.loadFile(sheet.href, null, instanceOptions, environment) - .then(function (loadedFile) { - loadInitialFileCallback(loadedFile); - }).catch(function (err) { - console.log(err); - callback(err); - }); - } - function loadStyleSheets(callback, reload, modifyVars) { - for (var i_2 = 0; i_2 < less.sheets.length; i_2++) { - loadStyleSheet(less.sheets[i_2], callback, reload, less.sheets.length - (i_2 + 1), modifyVars); - } - } - function initRunningMode() { - if (less.env === 'development') { - less.watchTimer = setInterval(function () { - if (less.watchMode) { - fileManager.clearFileCache(); - /** - * @todo remove when this is typed with JSDoc - */ - // eslint-disable-next-line no-unused-vars - loadStyleSheets(function (e, css, _, sheet, webInfo) { - if (e) { - errors.add(e, e.href || sheet.href); - } - else if (css) { - browser.createCSS(window.document, css, sheet); - } - }); - } - }, options.poll); - } - } - // - // Watch mode - // - less.watch = function () { - if (!less.watchMode) { - less.env = 'development'; - initRunningMode(); - } - this.watchMode = true; - return true; - }; - less.unwatch = function () { clearInterval(less.watchTimer); this.watchMode = false; return false; }; - // - // Synchronously get all tags with the 'rel' attribute set to - // "stylesheet/less". - // - less.registerStylesheetsImmediately = function () { - var links = document.getElementsByTagName('link'); - less.sheets = []; - for (var i_3 = 0; i_3 < links.length; i_3++) { - if (links[i_3].rel === 'stylesheet/less' || (links[i_3].rel.match(/stylesheet/) && - (links[i_3].type.match(typePattern)))) { - less.sheets.push(links[i_3]); - } - } - }; - // - // Asynchronously get all tags with the 'rel' attribute set to - // "stylesheet/less", returning a Promise. - // - less.registerStylesheets = function () { return new Promise(function (resolve) { - less.registerStylesheetsImmediately(); - resolve(); - }); }; - // - // With this function, it's possible to alter variables and re-render - // CSS without reloading less-files - // - less.modifyVars = function (record) { return less.refresh(true, record, false); }; - less.refresh = function (reload, modifyVars, clearFileCache) { - if ((reload || clearFileCache) && clearFileCache !== false) { - fileManager.clearFileCache(); - } - return new Promise(function (resolve, reject) { - var startTime; - var endTime; - var totalMilliseconds; - var remainingSheets; - startTime = endTime = new Date(); - // Set counter for remaining unprocessed sheets - remainingSheets = less.sheets.length; - if (remainingSheets === 0) { - endTime = new Date(); - totalMilliseconds = endTime - startTime; - less.logger.info('Less has finished and no sheets were loaded.'); - resolve({ - startTime: startTime, - endTime: endTime, - totalMilliseconds: totalMilliseconds, - sheets: less.sheets.length - }); - } - else { - // Relies on less.sheets array, callback seems to be guaranteed to be called for every element of the array - loadStyleSheets(function (e, css, _, sheet, webInfo) { - if (e) { - errors.add(e, e.href || sheet.href); - reject(e); - return; - } - if (webInfo.local) { - less.logger.info("Loading ".concat(sheet.href, " from cache.")); - } - else { - less.logger.info("Rendered ".concat(sheet.href, " successfully.")); - } - browser.createCSS(window.document, css, sheet); - less.logger.info("CSS for ".concat(sheet.href, " generated in ").concat(new Date() - endTime, "ms")); - // Count completed sheet - remainingSheets--; - // Check if the last remaining sheet was processed and then call the promise - if (remainingSheets === 0) { - totalMilliseconds = new Date() - startTime; - less.logger.info("Less has finished. CSS generated in ".concat(totalMilliseconds, "ms")); - resolve({ - startTime: startTime, - endTime: endTime, - totalMilliseconds: totalMilliseconds, - sheets: less.sheets.length - }); - } - endTime = new Date(); - }, reload, modifyVars); - } - loadStyles(modifyVars); - }); - }; - less.refreshStyles = loadStyles; - return less; - }); - - /** - * Kicks off less and compiles any stylesheets - * used in the browser distributed version of less - * to kick-start less using the browser api - */ - var options = defaultOptions(); - if (window.less) { - for (var key in window.less) { - if (Object.prototype.hasOwnProperty.call(window.less, key)) { - options[key] = window.less[key]; - } - } - } - addDefaultOptions(window, options); - options.plugins = options.plugins || []; - if (window.LESS_PLUGINS) { - options.plugins = options.plugins.concat(window.LESS_PLUGINS); - } - var less = root(window, options); - window.less = less; - var css; - var head; - var style; - // Always restore page visibility - function resolveOrReject(data) { - if (data.filename) { - console.warn(data); - } - if (!options.async) { - head.removeChild(style); - } - } - if (options.onReady) { - if (/!watch/.test(window.location.hash)) { - less.watch(); - } - // Simulate synchronous stylesheet loading by hiding page rendering - if (!options.async) { - css = 'body { display: none !important }'; - head = document.head || document.getElementsByTagName('head')[0]; - style = document.createElement('style'); - style.type = 'text/css'; - if (style.styleSheet) { - style.styleSheet.cssText = css; - } - else { - style.appendChild(document.createTextNode(css)); - } - head.appendChild(style); - } - less.registerStylesheetsImmediately(); - less.pageLoadFinished = less.refresh(less.env === 'development').then(resolveOrReject, resolveOrReject); - } - - return less; - -})); diff --git a/dist/less.min.js b/dist/less.min.js deleted file mode 100644 index fb7147a09d..0000000000 --- a/dist/less.min.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Less - Leaner CSS v4.4.2 - * http://lesscss.org - * - * Copyright (c) 2009-2025, Alexis Sellier - * Licensed under the Apache-2.0 License. - * - * @license Apache-2.0 - */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).less=t()}(this,(function(){"use strict";function e(e){return e.replace(/^[a-z-]+:\/+?[^/]+/,"").replace(/[?&]livereload=\w+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^.\w-]+/g,"-").replace(/\./g,":")}function t(e,t){if(t)for(var n in t.dataset)if(Object.prototype.hasOwnProperty.call(t.dataset,n))if("env"===n||"dumpLineNumbers"===n||"rootpath"===n||"errorReporting"===n)e[n]=t.dataset[n];else try{e[n]=JSON.parse(t.dataset[n])}catch(e){}}var n=function(t,n,i){var r=i.href||"",s="less:".concat(i.title||e(r)),a=t.getElementById(s),o=!1,l=t.createElement("style");l.setAttribute("type","text/css"),i.media&&l.setAttribute("media",i.media),l.id=s,l.styleSheet||(l.appendChild(t.createTextNode(n)),o=null!==a&&a.childNodes.length>0&&l.childNodes.length>0&&a.firstChild.nodeValue===l.firstChild.nodeValue);var u=t.getElementsByTagName("head")[0];if(null===a||!1===o){var c=i&&i.nextSibling||null;c?c.parentNode.insertBefore(l,c):u.appendChild(l)}if(a&&!1===o&&a.parentNode.removeChild(a),l.styleSheet)try{l.styleSheet.cssText=n}catch(e){throw new Error("Couldn't reassign styleSheet.cssText.")}},i=function(e){var t,n=e.document;return n.currentScript||(t=n.getElementsByTagName("script"))[t.length-1]},r={error:function(e){this._fireEvent("error",e)},warn:function(e){this._fireEvent("warn",e)},info:function(e){this._fireEvent("info",e)},debug:function(e){this._fireEvent("debug",e)},addListener:function(e){this._listeners.push(e)},removeListener:function(e){for(var t=0;t=0;o--){var l=a[o];if(l[s?"supportsSync":"supports"](e,t,n,i))return l}return null},e.prototype.addFileManager=function(e){this.fileManagers.push(e)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},e}(),a={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},o={length:{m:1,cm:.01,mm:.001,in:.0254,px:.0254/96,pt:.0254/72,pc:.0254/72*12},duration:{s:1,ms:.001},angle:{rad:1/(2*Math.PI),deg:1/360,grad:1/400,turn:1}},l={colors:a,unitConversions:o},u=function(){function e(){this.parent=null,this.visibilityBlocks=void 0,this.nodeVisible=void 0,this.rootNode=null,this.parsed=null}return Object.defineProperty(e.prototype,"currentFileInfo",{get:function(){return this.fileInfo()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.getIndex()},enumerable:!1,configurable:!0}),e.prototype.setParent=function(t,n){function i(t){t&&t instanceof e&&(t.parent=n)}Array.isArray(t)?t.forEach(i):i(t)},e.prototype.getIndex=function(){return this._index||this.parent&&this.parent.getIndex()||0},e.prototype.fileInfo=function(){return this._fileInfo||this.parent&&this.parent.fileInfo()||{}},e.prototype.isRulesetLike=function(){return!1},e.prototype.toCSS=function(e){var t=[];return this.genCSS(e,{add:function(e,n,i){t.push(e)},isEmpty:function(){return 0===t.length}}),t.join("")},e.prototype.genCSS=function(e,t){t.add(this.value)},e.prototype.accept=function(e){this.value=e.visit(this.value)},e.prototype.eval=function(){return this},e.prototype._operate=function(e,t,n,i){switch(t){case"+":return n+i;case"-":return n-i;case"*":return n*i;case"/":return n/i}},e.prototype.fround=function(e,t){var n=e&&e.numPrecision;return n?Number((t+2e-16).toFixed(n)):t},e.compare=function(t,n){if(t.compare&&"Quoted"!==n.type&&"Anonymous"!==n.type)return t.compare(n);if(n.compare)return-n.compare(t);if(t.type===n.type){if(t=t.value,n=n.value,!Array.isArray(t))return t===n?0:void 0;if(t.length===n.length){for(var i=0;it?1:void 0},e.prototype.blocksVisibility=function(){return void 0===this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},e.prototype.addVisibilityBlock=function(){void 0===this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},e.prototype.removeVisibilityBlock=function(){void 0===this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},e.prototype.ensureVisibility=function(){this.nodeVisible=!0},e.prototype.ensureInvisibility=function(){this.nodeVisible=!1},e.prototype.isVisible=function(){return this.nodeVisible},e.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},e.prototype.copyVisibilityInfo=function(e){e&&(this.visibilityBlocks=e.visibilityBlocks,this.nodeVisible=e.nodeVisible)},e}(),c=function(e,t,n){var i=this;Array.isArray(e)?this.rgb=e:e.length>=6?(this.rgb=[],e.match(/.{2}/g).map((function(e,t){t<3?i.rgb.push(parseInt(e,16)):i.alpha=parseInt(e,16)/255}))):(this.rgb=[],e.split("").map((function(e,t){t<3?i.rgb.push(parseInt(e+e,16)):i.alpha=parseInt(e+e,16)/255}))),this.alpha=this.alpha||("number"==typeof t?t:1),void 0!==n&&(this.value=n)};function h(e,t){return Math.min(Math.max(e,0),t)}function f(e){return"#".concat(e.map((function(e){return((e=h(Math.round(e),255))<16?"0":"")+e.toString(16)})).join(""))}c.prototype=Object.assign(new u,{type:"Color",luma:function(){var e=this.rgb[0]/255,t=this.rgb[1]/255,n=this.rgb[2]/255;return.2126*(e=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*(t=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(n=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))},genCSS:function(e,t){t.add(this.toCSS(e))},toCSS:function(e,t){var n,i,r,s=e&&e.compress&&!t,a=[];if(i=this.fround(e,this.alpha),this.value)if(0===this.value.indexOf("rgb"))i<1&&(r="rgba");else{if(0!==this.value.indexOf("hsl"))return this.value;r=i<1?"hsla":"hsl"}else i<1&&(r="rgba");switch(r){case"rgba":a=this.rgb.map((function(e){return h(Math.round(e),255)})).concat(h(i,1));break;case"hsla":a.push(h(i,1));case"hsl":n=this.toHSL(),a=[this.fround(e,n.h),"".concat(this.fround(e,100*n.s),"%"),"".concat(this.fround(e,100*n.l),"%")].concat(a)}if(r)return"".concat(r,"(").concat(a.join(",".concat(s?"":" ")),")");if(n=this.toRGB(),s){var o=n.split("");o[1]===o[2]&&o[3]===o[4]&&o[5]===o[6]&&(n="#".concat(o[1]).concat(o[3]).concat(o[5]))}return n},operate:function(e,t,n){for(var i=new Array(3),r=this.alpha*(1-n.alpha)+n.alpha,s=0;s<3;s++)i[s]=this._operate(e,t,this.rgb[s],n.rgb[s]);return new c(i,r)},toRGB:function(){return f(this.rgb)},toHSL:function(){var e,t,n=this.rgb[0]/255,i=this.rgb[1]/255,r=this.rgb[2]/255,s=this.alpha,a=Math.max(n,i,r),o=Math.min(n,i,r),l=(a+o)/2,u=a-o;if(a===o)e=t=0;else{switch(t=l>.5?u/(2-a-o):u/(a+o),a){case n:e=(i-r)/u+(iC(e,t));if("Object"!==S(n=e)||n.constructor!==Object||Object.getPrototypeOf(n)!==Object.prototype)return e;var n;return[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)].reduce((n,i)=>{if(I(t.props)&&!t.props.includes(i))return n;return function(e,t,n,i,r){const s={}.propertyIsEnumerable.call(i,t)?"enumerable":"nonenumerable";"enumerable"===s&&(e[t]=n),r&&"nonenumerable"===s&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}(n,i,C(e[i],t),e,t.nonenumerable),n},{})}function k(e,t){for(var n=e+1,i=null,r=-1;--n>=0&&"\n"!==t.charAt(n);)r++;return"number"==typeof e&&(i=(t.slice(0,e).match(/\n/g)||"").length),{line:i,column:r}}function A(e){var t,n=e.length,i=new Array(n);for(t=0;t|Function):(\d+):(\d+)/,F=function(e,t,n){Error.call(this);var i=e.filename||n;if(this.message=e.message,this.stack=e.stack,t&&i){var r=t.contents[i],s=k(e.index,r),a=s.line,o=s.column,l=e.call&&k(e.call,r).line,u=r?r.split("\n"):"";if(this.type=e.type||"Syntax",this.filename=i,this.index=e.index,this.line="number"==typeof a?a+1:null,this.column=o,!this.line&&this.stack){var c=this.stack.match($),h=new Function("a","throw new Error()"),f=0;try{h()}catch(e){var p=e.stack.match($);f=1-parseInt(p[2])}c&&(c[2]&&(this.line=parseInt(c[2])+f),c[3]&&(this.column=parseInt(c[3])))}this.callLine=l+1,this.callExtract=u[l],this.extract=[u[this.line-2],u[this.line-1],u[this.line]]}};if(void 0===Object.create){var V=function(){};V.prototype=Error.prototype,F.prototype=new V}else F.prototype=Object.create(Error.prototype);F.prototype.constructor=F,F.prototype.toString=function(e){var t;e=e||{};var n=(null!==(t=this.type)&&void 0!==t?t:"").toLowerCase().includes("warning"),i=n?this.type:"".concat(this.type,"Error"),r=n?"yellow":"red",s="",a=this.extract||[],o=[],l=function(e){return e};if(e.stylize){var u=typeof e.stylize;if("function"!==u)throw Error("options.stylize should be a function, got a ".concat(u,"!"));l=e.stylize}if(null!==this.line){if(n||"string"!=typeof a[0]||o.push(l("".concat(this.line-1," ").concat(a[0]),"grey")),"string"==typeof a[1]){var c="".concat(this.line," ");a[1]&&(c+=a[1].slice(0,this.column)+l(l(l(a[1].substr(this.column,1),"bold")+a[1].slice(this.column+1),"red"),"inverse")),o.push(c)}n||"string"!=typeof a[2]||o.push(l("".concat(this.line+1," ").concat(a[2]),"grey")),o="".concat(o.join("\n")+l("","reset"),"\n")}return s+=l("".concat(i,": ").concat(this.message),r),this.filename&&(s+=l(" in ",r)+this.filename),this.line&&(s+=l(" on line ".concat(this.line,", column ").concat(this.column+1,":"),"grey")),s+="\n".concat(o),this.callLine&&(s+="".concat(l("from ",r)+(this.filename||""),"/n"),s+="".concat(l(this.callLine,"grey")," ").concat(this.callExtract,"/n")),s};var L={visitDeeper:!0},j=!1;function D(e){return e}var N=function(){function e(e){this._implementation=e,this._visitInCache={},this._visitOutCache={},j||(!function e(t,n){var i,r;for(i in t)switch(typeof(r=t[i])){case"function":r.prototype&&r.prototype.type&&(r.prototype.typeIndex=n++);break;case"object":n=e(r,n)}return n}(Ke,1),j=!0)}return e.prototype.visit=function(e){if(!e)return e;var t=e.typeIndex;if(!t)return e.value&&e.value.typeIndex&&this.visit(e.value),e;var n,i=this._implementation,r=this._visitInCache[t],s=this._visitOutCache[t],a=L;if(a.visitDeeper=!0,r||(r=i[n="visit".concat(e.type)]||D,s=i["".concat(n,"Out")]||D,this._visitInCache[t]=r,this._visitOutCache[t]=s),r!==D){var o=r.call(i,e,a);e&&i.isReplacing&&(e=o)}if(a.visitDeeper&&e)if(e.length)for(var l=0,u=e.length;ly.PARENS_DIVISION)||this.parensStack&&this.parensStack.length))},B.Eval.prototype.pathRequiresRewrite=function(e){return(this.rewriteUrls===w?G:z)(e)},B.Eval.prototype.rewritePath=function(e,t){var n;return t=t||"",n=this.normalizePath(t+e),G(e)&&z(t)&&!1===G(n)&&(n="./".concat(n)),n},B.Eval.prototype.normalizePath=function(e){var t,n=e.split("/").reverse();for(e=[];0!==n.length;)switch(t=n.pop()){case".":break;case"..":0===e.length||".."===e[e.length-1]?e.push(t):e.pop();break;default:e.push(t)}return e.join("/")};var W=function(){function e(e){this.imports=[],this.variableImports=[],this._onSequencerEmpty=e,this._currentDepth=0}return e.prototype.addImport=function(e){var t=this,n={callback:e,args:null,isReady:!1};return this.imports.push(n),function(){n.args=Array.prototype.slice.call(arguments,0),n.isReady=!0,t.tryRun()}},e.prototype.addVariableImport=function(e){this.variableImports.push(e)},e.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var e=this.imports[0];if(!e.isReady)return;this.imports=this.imports.slice(1),e.callback.apply(null,e.args)}if(0===this.variableImports.length)break;var t=this.variableImports[0];this.variableImports=this.variableImports.slice(1),t()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},e}(),J=function(e,t){this._visitor=new N(this),this._importer=e,this._finish=t,this.context=new B.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new W(this._onSequencerEmpty.bind(this))};J.prototype={isReplacing:!1,run:function(e){try{this._visitor.visit(e)}catch(e){this.error=e}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(e,t){var n=e.options.inline;if(!e.css||n){var i=new B.Eval(this.context,A(this.context.frames)),r=i.frames[0];this.importCount++,e.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,e,i,r)):this.processImportNode(e,i,r)}t.visitDeeper=!1},processImportNode:function(e,t,n){var i,r=e.options.inline;try{i=e.evalForImport(t)}catch(t){t.filename||(t.index=e.getIndex(),t.filename=e.fileInfo().filename),e.css=!0,e.error=t}if(!i||i.css&&!r)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{i.options.multiple&&(t.importMultiple=!0);for(var s=void 0===i.css,a=0;a=0||(o=[u.selfSelectors[0]],(s=f.findMatch(l,o)).length&&(l.hasFoundMatches=!0,l.selfSelectors.forEach((function(e){var t=u.visibilityInfo();a=f.extendSelector(s,o,e,l.isVisible()),(c=new Ke.Extend(u.selector,u.option,0,u.fileInfo(),t)).selfSelectors=a,a[a.length-1].extendList=[c],h.push(c),c.ruleset=u.ruleset,c.parent_ids=c.parent_ids.concat(u.parent_ids,l.parent_ids),u.firstExtendOnThisSelectorPath&&(c.firstExtendOnThisSelectorPath=!0,u.ruleset.paths.push(a))}))));if(h.length){if(this.extendChainCount++,n>100){var p="{unable to calculate}",v="{unable to calculate}";try{p=h[0].selfSelectors[0].toCSS(),v=h[0].selector.toCSS()}catch(e){}throw{message:"extend circular reference detected. One of the circular extends is currently:".concat(p,":extend(").concat(v,")")}}return h.concat(f.doExtendChaining(h,t,n+1))}return h},e.prototype.visitDeclaration=function(e,t){t.visitDeeper=!1},e.prototype.visitMixinDefinition=function(e,t){t.visitDeeper=!1},e.prototype.visitSelector=function(e,t){t.visitDeeper=!1},e.prototype.visitRuleset=function(e,t){if(!e.root){var n,i,r,s,a=this.allExtendsStack[this.allExtendsStack.length-1],o=[],l=this;for(r=0;r0&&u[l.matched].combinator.value!==a?l=null:l.matched++,l&&(l.finished=l.matched===u.length,l.finished&&!e.allowAfter&&(r+1u&&c>0&&(h[h.length-1].elements=h[h.length-1].elements.concat(t[u].elements.slice(c)),c=0,u++),l=s.elements.slice(c,o.index).concat([a]).concat(n.elements.slice(1)),u===o.pathIndex&&r>0?h[h.length-1].elements=h[h.length-1].elements.concat(l):(h=h.concat(t.slice(u,o.pathIndex))).push(new Ke.Selector(l)),u=o.endPathIndex,(c=o.endPathElementIndex)>=t[u].elements.length&&(c=0,u++);return u0&&(h[h.length-1].elements=h[h.length-1].elements.concat(t[u].elements.slice(c)),u++),h=(h=h.concat(t.slice(u,t.length))).map((function(e){var t=e.createDerived(e.elements);return i?t.ensureVisibility():t.ensureInvisibility(),t}))},e.prototype.visitMedia=function(e,t){var n=e.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);n=n.concat(this.doExtendChaining(n,e.allExtends)),this.allExtendsStack.push(n)},e.prototype.visitMediaOut=function(e){var t=this.allExtendsStack.length-1;this.allExtendsStack.length=t},e.prototype.visitAtRule=function(e,t){var n=e.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);n=n.concat(this.doExtendChaining(n,e.allExtends)),this.allExtendsStack.push(n)},e.prototype.visitAtRuleOut=function(e){var t=this.allExtendsStack.length-1;this.allExtendsStack.length=t},e}(),Z=function(){function e(){this.contexts=[[]],this._visitor=new N(this)}return e.prototype.run=function(e){return this._visitor.visit(e)},e.prototype.visitDeclaration=function(e,t){t.visitDeeper=!1},e.prototype.visitMixinDefinition=function(e,t){t.visitDeeper=!1},e.prototype.visitRuleset=function(e,t){var n,i=this.contexts[this.contexts.length-1],r=[];this.contexts.push(r),e.root||((n=e.selectors)&&(n=n.filter((function(e){return e.getIsOutput()})),e.selectors=n.length?n:n=null,n&&e.joinSelectors(r,i,n)),n||(e.rules=null),e.paths=r)},e.prototype.visitRulesetOut=function(e){this.contexts.length=this.contexts.length-1},e.prototype.visitMedia=function(e,t){var n=this.contexts[this.contexts.length-1];e.rules[0].root=0===n.length||n[0].multiMedia},e.prototype.visitAtRule=function(e,t){var n=this.contexts[this.contexts.length-1];e.declarations&&e.declarations.length?e.declarations[0].root=0===n.length||n[0].multiMedia:e.rules&&e.rules.length&&(e.rules[0].root=e.isRooted||0===n.length||null)},e}(),X=function(){function e(e){this._visitor=new N(this),this._context=e}return e.prototype.containsSilentNonBlockedChild=function(e){var t;if(!e)return!1;for(var n=0;n0},e.prototype.resolveVisibility=function(e){if(!e.blocksVisibility()){if(this.isEmpty(e))return;return e}var t=e.rules[0];if(this.keepOnlyVisibleChilds(t),!this.isEmpty(t))return e.ensureVisibility(),e.removeVisibilityBlock(),e},e.prototype.isVisibleRuleset=function(e){return!!e.firstRoot||!this.isEmpty(e)&&!(!e.root&&!this.hasVisibleSelector(e))},e}(),Y=function(e){this._visitor=new N(this),this._context=e,this.utils=new X(e)};Y.prototype={isReplacing:!0,run:function(e){return this._visitor.visit(e)},visitDeclaration:function(e,t){if(!e.blocksVisibility()&&!e.variable)return e},visitMixinDefinition:function(e,t){e.frames=[]},visitExtend:function(e,t){},visitComment:function(e,t){if(!e.blocksVisibility()&&!e.isSilent(this._context))return e},visitMedia:function(e,t){var n=e.rules[0].rules;return e.accept(this._visitor),t.visitDeeper=!1,this.utils.resolveVisibility(e,n)},visitImport:function(e,t){if(!e.blocksVisibility())return e},visitAtRule:function(e,t){return e.rules&&e.rules.length?this.visitAtRuleWithBody(e,t):this.visitAtRuleWithoutBody(e,t)},visitAnonymous:function(e,t){if(!e.blocksVisibility())return e.accept(this._visitor),e},visitAtRuleWithBody:function(e,t){var n=function(e){var t=e.rules;return function(e){var t=e.rules;return 1===t.length&&(!t[0].paths||0===t[0].paths.length)}(e)?t[0].rules:t}(e);return e.accept(this._visitor),t.visitDeeper=!1,this.utils.isEmpty(e)||this._mergeRules(e.rules[0].rules),this.utils.resolveVisibility(e,n)},visitAtRuleWithoutBody:function(e,t){if(!e.blocksVisibility()){if("@charset"===e.name){if(this.charset){if(e.debugInfo){var n=new Ke.Comment("/* ".concat(e.toCSS(this._context).replace(/\n/g,"")," */\n"));return n.debugInfo=e.debugInfo,this._visitor.visit(n)}return}this.charset=!0}return e}},checkValidNodes:function(e,t){if(e)for(var n=0;n0?e.accept(this._visitor):e.rules=null,t.visitDeeper=!1}return e.rules&&(this._mergeRules(e.rules),this._removeDuplicateRules(e.rules)),this.utils.isVisibleRuleset(e)&&(e.ensureVisibility(),i.splice(0,0,e)),1===i.length?i[0]:i},_compileRulesetPaths:function(e){e.paths&&(e.paths=e.paths.filter((function(e){var t;for(" "===e[0].elements[0].combinator.value&&(e[0].elements[0].combinator=new Ke.Combinator("")),t=0;t=0;i--)if((n=e[i])instanceof Ke.Declaration)if(r[n.name]){(t=r[n.name])instanceof Ke.Declaration&&(t=r[n.name]=[r[n.name].toCSS(this._context)]);var s=n.toCSS(this._context);-1!==t.indexOf(s)?e.splice(i,1):t.push(s)}else r[n.name]=n}},_mergeRules:function(e){if(e){for(var t={},n=[],i=0;i0){var t=e[0],n=[],i=[new Ke.Expression(n)];e.forEach((function(e){"+"===e.merge&&n.length>0&&i.push(new Ke.Expression(n=[])),n.push(e.value),t.important=t.important||e.important})),t.value=new Ke.Value(i)}}))}}};var ee={Visitor:N,ImportVisitor:J,MarkVisibleSelectorsVisitor:K,ExtendVisitor:Q,JoinSelectorVisitor:Z,ToCSSVisitor:Y};var te=function(){var e,t,n,i,r,s,a,o=[],l={};function u(n){for(var i,o,c,h=l.i,f=t,p=l.i-a,v=l.i+s.length-p,d=l.i+=n,m=e;l.i=0){c={index:l.i,text:m.substr(l.i,y+2-l.i),isLineComment:!1},l.i+=c.text.length-1,l.commentStore.push(c);continue}}break}if(32!==i&&10!==i&&9!==i&&13!==i)break}if(s=s.slice(n+l.i-d+p),a=l.i,!s.length){if(tn||l.i===n&&e&&!i)&&(n=l.i,i=e);var r=o.pop();s=r.current,a=l.i=r.i,t=r.j},l.forget=function(){o.pop()},l.isWhitespace=function(t){var n=l.i+(t||0),i=e.charCodeAt(n);return 32===i||13===i||9===i||10===i},l.$re=function(e){l.i>a&&(s=s.slice(l.i-a),a=l.i);var t=e.exec(s);return t?(u(t[0].length),"string"==typeof t?t:1===t.length?t[0]:t):null},l.$char=function(t){return e.charAt(l.i)!==t?null:(u(1),t)},l.$peekChar=function(t){return e.charAt(l.i)!==t?null:t},l.$str=function(t){for(var n=t.length,i=0;ih&&(d=!1)}}while(d);return r||null},l.autoCommentAbsorb=!0,l.commentStore=[],l.finished=!1,l.peek=function(t){if("string"==typeof t){for(var n=0;n57||t<43||47===t||44===t},l.start=function(i,o,c){e=i,l.i=t=a=n=0,r=o?function(e,t){var n,i,r,s,a,o,l,u,c,h=e.length,f=0,p=0,v=[],d=0;function m(t){var n=a-d;n<512&&!t||!n||(v.push(e.slice(d,a+1)),d=a+1)}for(a=0;a=97&&l<=122||l<34))switch(l){case 40:p++,i=a;continue;case 41:if(--p<0)return t("missing opening `(`",a);continue;case 59:p||m();continue;case 123:f++,n=a;continue;case 125:if(--f<0)return t("missing opening `{`",a);f||p||m();continue;case 92:if(a96)){if(u==l){c=1;break}if(92==u){if(a==h-1)return t("unescaped `\\`",a);a++}}if(c)continue;return t("unmatched `".concat(String.fromCharCode(l),"`"),o);case 47:if(p||a==h-1)continue;if(47==(u=e.charCodeAt(a+1)))for(a+=2;an&&s>r?"missing closing `}` or `*/`":"missing closing `}`",n):0!==p?t("missing closing `)`",i):(m(!0),v)}(i,c):[i],s=r[0],u(0)},l.end=function(){var t,r=l.i>=e.length;return l.i=e.length-1,furthestChar:e[l.i]}},l};var ne=function e(t){return{_data:{},add:function(e,t){e=e.toLowerCase(),this._data.hasOwnProperty(e),this._data[e]=t},addMultiple:function(e){var t=this;Object.keys(e).forEach((function(n){t.add(n,e[n])}))},get:function(e){return this._data[e]||t&&t.get(e)},getLocalFunctions:function(){return this._data},inherit:function(){return e(this)},create:function(t){return e(t)}}}(null),ie={queryInParens:!0},re={queryInParens:!0},se=function(e,t,n,i,r,s){this.value=e,this._index=t,this._fileInfo=n,this.mapLines=i,this.rulesetLike=void 0!==r&&r,this.allowRoot=!0,this.copyVisibilityInfo(s)};se.prototype=Object.assign(new u,{type:"Anonymous",eval:function(){return new se(this.value,this._index,this._fileInfo,this.mapLines,this.rulesetLike,this.visibilityInfo())},compare:function(e){return e.toCSS&&this.toCSS()===e.toCSS()?0:void 0},isRulesetLike:function(){return this.rulesetLike},genCSS:function(e,t){this.nodeVisible=Boolean(this.value),this.nodeVisible&&t.add(this.value,this._fileInfo,this._index,this.mapLines)}});var ae=function e(t,n,i,s){var a;s=s||0;var o=te();function l(e,t){throw new F({index:o.i,filename:i.filename,type:t||"Syntax",message:e},n)}function u(e,s,a){t.quiet||r.warn(new F({index:null!=s?s:o.i,filename:i.filename,type:a?"".concat(a.toUpperCase()," WARNING"):"WARNING",message:e},n).toString())}function c(e,t){var n=e instanceof Function?e.call(a):o.$re(e);if(n)return n;l(t||("string"==typeof e?"expected '".concat(e,"' got '").concat(o.currentChar(),"'"):"unexpected token"))}function h(e,t){if(o.$char(e))return e;l(t||"expected '".concat(e,"' got '").concat(o.currentChar(),"'"))}function f(e){var t=i.filename;return{lineNumber:k(e,o.getInput()).line+1,fileName:t}}return{parserInput:o,imports:n,fileInfo:i,parseNode:function(e,t,r){var l,u=[],c=o;try{c.start(e,!1,(function(e,t){r({message:e,index:t+s})}));for(var h=0,f=void 0;f=t[h];h++)l=a[f](),u.push(l||null);c.end().isFinished?r(null,u):r(!0,null)}catch(e){throw new F({index:e.index+s,message:e.message},n,i.filename)}},parse:function(r,s,u){var c,h,f,p,v=null,d="";if(u&&u.disablePluginRule&&(a.plugin=function(){o.$re(/^@plugin?\s+/)&&l("@plugin statements are not allowed when disablePluginRule is set to true")}),h=u&&u.globalVars?"".concat(e.serializeVars(u.globalVars),"\n"):"",f=u&&u.modifyVars?"\n".concat(e.serializeVars(u.modifyVars)):"",t.pluginManager)for(var m=t.pluginManager.getPreProcessors(),g=0;g");return e},args:function(e){var t,n,i,r,s,u,c,h=a.entities,f={args:null,variadic:!1},p=[],v=[],d=[],m=!0;for(o.save();;){if(e)u=a.detachedRuleset()||a.expression();else{if(o.commentStore.length=0,o.$str("...")){f.variadic=!0,o.$char(";")&&!t&&(t=!0),(t?v:d).push({variadic:!0});break}u=h.variable()||h.property()||h.literal()||h.keyword()||this.call(!0)}if(!u||!m)break;r=null,u.throwAwayComments&&u.throwAwayComments(),s=u;var g=null;if(e?u.value&&1==u.value.length&&(g=u.value[0]):g=u,g&&(g instanceof Ke.Variable||g instanceof Ke.Property))if(o.$char(":")){if(p.length>0&&(t&&l("Cannot mix ; and , as delimiter types"),n=!0),!(s=a.detachedRuleset()||a.expression())){if(!e)return o.restore(),f.args=[],f;l("could not understand value for named argument")}r=i=g.name}else if(o.$str("...")){if(!e){f.variadic=!0,o.$char(";")&&!t&&(t=!0),(t?v:d).push({name:u.name,variadic:!0});break}c=!0}else e||(i=r=g.name,s=null);s&&p.push(s),d.push({name:r,value:s,expand:c}),o.$char(",")?m=!0:((m=";"===o.$char(";"))||t)&&(n&&l("Cannot mix ; and , as delimiter types"),t=!0,p.length>1&&(s=new Ke.Value(p)),v.push({name:i,value:s,expand:c}),i=null,p=[],n=!1)}return o.forget(),f.args=t?v:d,f},definition:function(){var e,t,n,i,r=[],s=!1;if(!("."!==o.currentChar()&&"#"!==o.currentChar()||o.peek(/^[^{]*\}/)))if(o.save(),t=o.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){e=t[1];var l=this.args(!1);if(r=l.args,s=l.variadic,!o.$char(")"))return void o.restore("Missing closing ')'");if(o.commentStore.length=0,o.$str("when")&&(i=c(a.conditions,"expected condition")),n=a.block())return o.forget(),new Ke.mixin.Definition(e,r,n,i,s);o.restore()}else o.restore()},ruleLookups:function(){var e,t=[];if("["===o.currentChar()){for(;;){if(o.save(),!(e=this.lookupValue())&&""!==e){o.restore();break}t.push(e),o.forget()}return t.length>0?t:void 0}},lookupValue:function(){if(o.save(),o.$char("[")){var e=o.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/);if(o.$char("]"))return e||""===e?(o.forget(),e):void o.restore();o.restore()}else o.restore()}},entity:function(){var e=this.entities;return this.comment()||e.literal()||e.variable()||e.url()||e.property()||e.call()||e.keyword()||this.mixin.call(!0)||e.javascript()},end:function(){return o.$char(";")||o.peek("}")},ieAlpha:function(){var e;if(o.$re(/^opacity=/i))return(e=o.$re(/^\d+/))||(e=c(a.entities.variable,"Could not parse alpha"),e="@{".concat(e.name.slice(1),"}")),h(")"),new Ke.Quoted("","alpha(opacity=".concat(e,")"))},element:function(){var e,t,n,r=o.i;if(t=this.combinator(),!(e=o.$re(/^(?:\d+\.\d+|\d+)%/)||o.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||o.$char("*")||o.$char("&")||this.attribute()||o.$re(/^\([^&()@]+\)/)||o.$re(/^[.#:](?=@)/)||this.entities.variableCurly()))if(o.save(),o.$char("("))if(n=this.selector(!1)){for(var a=[];o.$char(",");)a.push(n),a.push(new se(",")),n=this.selector(!1);a.push(n),o.$char(")")?(e=a.length>1?new Ke.Paren(new oe(a)):new Ke.Paren(n),o.forget()):o.restore("Missing closing ')'")}else o.restore("Missing closing ')'");else o.forget();if(e)return new Ke.Element(t,e,e instanceof Ke.Variable,r+s,i)},combinator:function(){var e=o.currentChar();if("/"===e){o.save();var t=o.$re(/^\/[a-z]+\//i);if(t)return o.forget(),new Ke.Combinator(t);o.restore()}if(">"===e||"+"===e||"~"===e||"|"===e||"^"===e){for(o.i++,"^"===e&&"^"===o.currentChar()&&(e="^^",o.i++);o.isWhitespace();)o.i++;return new Ke.Combinator(e)}return o.isWhitespace(-1)?new Ke.Combinator(" "):new Ke.Combinator(null)},selector:function(e){var t,n,r,a,u,h,f,p=o.i;for(e=!1!==e;(e&&(n=this.extend())||e&&(h=o.$str("when"))||(a=this.element()))&&(h?f=c(this.conditions,"expected condition"):f?l("CSS guard can only be used at the end of selector"):n?u=u?u.concat(n):n:(u&&l("Extend can only be used at the end of selector"),r=o.currentChar(),Array.isArray(a)&&a.forEach((function(e){return t.push(e)})),t?t.push(a):t=[a],a=null),"{"!==r&&"}"!==r&&";"!==r&&","!==r&&")"!==r););if(t)return new Ke.Selector(t,u,f,p+s,i);u&&l("Extend must be used to extend a selector, it cannot be used on its own")},selectors:function(){for(var e,t;(e=this.selector())&&(t?t.push(e):t=[e],o.commentStore.length=0,e.condition&&t.length>1&&l("Guards are only currently allowed on a single selector."),o.$char(","));)e.condition&&l("Guards are only currently allowed on a single selector."),o.commentStore.length=0;return t},attribute:function(){if(o.$char("[")){var e,t,n,i,r=this.entities;return(e=r.variableCurly())||(e=c(/^(?:[_A-Za-z0-9-*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),(n=o.$re(/^[|~*$^]?=/))&&(t=r.quoted()||o.$re(/^[0-9]+%/)||o.$re(/^[\w-]+/)||r.variableCurly())&&(i=o.$re(/^[iIsS]/)),h("]"),new Ke.Attribute(e,n,t,i)}},block:function(){var e;if(o.$char("{")&&(e=this.primary())&&o.$char("}"))return e},blockRuleset:function(){var e=this.block();return e&&(e=new Ke.Ruleset(null,e)),e},detachedRuleset:function(){var e,t,n;if(o.save(),!o.$re(/^[.#]\(/)||(t=(e=this.mixin.args(!1)).args,n=e.variadic,o.$char(")"))){var i=this.blockRuleset();if(i)return o.forget(),t?new Ke.mixin.Definition(null,t,i,null,n):new Ke.DetachedRuleset(i);o.restore()}else o.restore()},ruleset:function(){var e,n,i;if(o.save(),t.dumpLineNumbers&&(i=f(o.i)),(e=this.selectors())&&(n=this.block())){o.forget();var r=new Ke.Ruleset(e,n,t.strictImports);return t.dumpLineNumbers&&(r.debugInfo=i),r}o.restore()},declaration:function(){var e,t,n,r,a,l,u=o.i,c=o.currentChar();if("."!==c&&"#"!==c&&"&"!==c&&":"!==c)if(o.save(),e=this.variable()||this.ruleProperty()){if((l="string"==typeof e)&&(t=this.detachedRuleset())&&(n=!0),o.commentStore.length=0,!t){if(a=!l&&e.length>1&&e.pop().value,t=e[0].value&&"--"===e[0].value.slice(0,2)?o.$char(";")?new se(""):this.permissiveValue(/[;}]/,!0):this.anonymousValue())return o.forget(),new Ke.Declaration(e,t,!1,a,u+s,i);t||(t=this.value()),t?r=this.important():l&&(t=this.permissiveValue())}if(t&&(this.end()||n))return o.forget(),new Ke.Declaration(e,t,r,a,u+s,i);o.restore()}else o.restore()},anonymousValue:function(){var e=o.i,t=o.$re(/^([^.#@$+/'"*`(;{}-]*);/);if(t)return new Ke.Anonymous(t[1],e+s)},permissiveValue:function(e){var t,n,r,s,a=e||";",c=o.i,h=[];function f(){var e=o.currentChar();return"string"==typeof a?e===a:a.test(e)}if(!f()){s=[];do{(n=this.comment())?s.push(n):((n=this.entity())&&s.push(n),o.peek(",")&&(s.push(new Ke.Anonymous(",",o.i)),o.$char(",")))}while(n);if(r=f(),s.length>0){if(s=new Ke.Expression(s),r)return s;h.push(s)," "===o.prevChar()&&h.push(new Ke.Anonymous(" ",c))}if(o.save(),s=o.$parseUntil(a)){if("string"==typeof s&&l("Expected '".concat(s,"'"),"Parse"),1===s.length&&" "===s[0])return o.forget(),new Ke.Anonymous("",c);var p=void 0;for(t=0;t]=|<=|>=|[<>]|=)/)?(o.restore(),n=this.condition(),o.save(),(r=this.atomicCondition(null,n.rvalue))||o.restore()):(o.restore(),t=this.value()),o.$char(")")?n&&!t?(u.push(new Ke.Paren(new Ke.QueryInParens(n.op,n.lvalue,n.rvalue,r?r.op:null,r?r.rvalue:null,n._index))),t=n):n&&t?(u.push(new Ke.Paren(new Ke.Declaration(n,t,null,null,o.i+s,i,!0))),c||(u[u.length-1].noSpacing=!0),c=!1):t?(u.push(new Ke.Paren(t)),c=!1):l("badly formed media feature definition"):l("Missing closing ')'","Parse"))}while(t);if(o.forget(),u.length>0)return new Ke.Expression(u)},mediaFeatures:function(e){var t,n=this.entities,i=[];do{if(t=this.mediaFeature(e)){if(i.push(t),!o.$char(","))break;i[i.length-1].noSpacing||(i[i.length-1].noSpacing=!1)}else if(t=n.variable()||n.mixinLookup()){if(i.push(t),!o.$char(","))break;i[i.length-1].noSpacing||(i[i.length-1].noSpacing=!1)}}while(t);return i.length>0?i:null},prepareAndGetNestableAtRule:function(e,n,r,a){var u=this.mediaFeatures(a),c=this.block();c||l("media definitions require block statements after any features"),o.forget();var h=new e(c,u,n+s,i);return t.dumpLineNumbers&&(h.debugInfo=r),h},nestableAtRule:function(){var e,n=o.i;if(t.dumpLineNumbers&&(e=f(n)),o.save(),o.$peekChar("@")){if(o.$str("@media"))return this.prepareAndGetNestableAtRule(Ke.Media,n,e,ie);if(o.$str("@container"))return this.prepareAndGetNestableAtRule(Ke.Container,n,e,re)}o.restore()},plugin:function(){var e,t,n,r=o.i;if(o.$re(/^@plugin\s+/)){if(n=(t=this.pluginArgs())?{pluginArgs:t,isPlugin:!0}:{isPlugin:!0},e=this.entities.quoted()||this.entities.url())return o.$char(";")||(o.i=r,l("missing semi-colon on @plugin")),new Ke.Import(e,null,n,r+s,i);o.i=r,l("malformed @plugin statement")}},pluginArgs:function(){if(o.save(),!o.$char("("))return o.restore(),null;var e=o.$re(/^\s*([^);]+)\)\s*/);return e[1]?(o.forget(),e[1].trim()):(o.restore(),null)},atruleUnknown:function(e,t,n){return e=this.permissiveValue(/^[{;]/),n="{"===o.currentChar(),e?e.value||(e=null):n||";"===o.currentChar()||l("".concat(t," rule is missing block or ending semi-colon")),[e,n]},atruleBlock:function(e,t,n,i){if(e=this.blockRuleset(),o.save(),e||n||(t=this.entity(),e=this.blockRuleset()),e||n)o.forget();else{o.restore();var r=[];for(t=this.entity();o.$char(",");)r.push(t),t=this.entity();t&&r.length>0?(r.push(t),t=r,i=!0):e=this.blockRuleset()}return[e,t,i]},atrule:function(){var e,n,r,a,u,c,h,p=o.i,v=!0,d=!0,m=!1;if("@"===o.currentChar()){if(n=this.import()||this.plugin()||this.nestableAtRule())return n;if(o.save(),e=o.$re(/^@[a-z-]+/)){switch(a=e,"-"==e.charAt(1)&&e.indexOf("-",2)>0&&(a="@".concat(e.slice(e.indexOf("-",2)+1))),a){case"@charset":u=!0,v=!1;break;case"@namespace":c=!0,v=!1;break;case"@keyframes":case"@counter-style":u=!0;break;case"@document":case"@supports":h=!0,d=!1;break;case"@starting-style":case"@layer":d=!1;break;default:h=!0}if(o.commentStore.length=0,u)(n=this.entity())||l("expected ".concat(e," identifier"));else if(c)(n=this.expression())||l("expected ".concat(e," expression"));else if(h){n=(g=this.atruleUnknown(n,e,v))[0],v=g[1]}if(v){var g,y=this.atruleBlock(r,n,d,m);if(r=y[0],n=y[1],m=y[2],!r&&!h)o.restore(),e=o.$re(/^@[a-z-]+/),n=(g=this.atruleUnknown(n,e,v))[0],(v=g[1])&&(r=(y=this.atruleBlock(r,n,d,m))[0],n=y[1],m=y[2])}if(r||m||!v&&n&&o.$char(";"))return o.forget(),new Ke.AtRule(e,n,r,p+s,i,t.dumpLineNumbers?f(p):null,d);o.restore("at-rule options not recognised")}}},value:function(){var e,t=[],n=o.i;do{if((e=this.expression())&&(t.push(e),!o.$char(",")))break}while(e);if(t.length>0)return new Ke.Value(t,n+s)},important:function(){if("!"===o.currentChar())return o.$re(/^! *important/)},sub:function(){var e,t;if(o.save(),o.$char("("))return(e=this.addition())&&o.$char(")")?(o.forget(),(t=new Ke.Expression([e])).parens=!0,t):void o.restore("Expected ')'");o.restore()},colorOperand:function(){o.save();var e=o.$re(/^[lchrgbs]\s+/);if(e)return new Ke.Keyword(e[0]);o.restore()},multiplication:function(){var e,t,n,i,r;if(e=this.operand()){for(r=o.isWhitespace(-1);!o.peek(/^\/[*/]/);){if(o.save(),!(n=o.$char("/")||o.$char("*"))){var s=o.i;(n=o.$str("./"))&&u("./ operator is deprecated",s,"DEPRECATED")}if(!n){o.forget();break}if(!(t=this.operand())){o.restore();break}o.forget(),e.parensInOp=!0,t.parensInOp=!0,i=new Ke.Operation(n,[i||e,t],r),r=o.isWhitespace(-1)}return i||e}},addition:function(){var e,t,n,i,r;if(e=this.multiplication()){for(r=o.isWhitespace(-1);(n=o.$re(/^[-+]\s+/)||!r&&(o.$char("+")||o.$char("-")))&&(t=this.multiplication());)e.parensInOp=!0,t.parensInOp=!0,i=new Ke.Operation(n,[i||e,t],r),r=o.isWhitespace(-1);return i||e}},conditions:function(){var e,t,n,i=o.i;if(e=this.condition(!0)){for(;o.peek(/^,\s*(not\s*)?\(/)&&o.$char(",")&&(t=this.condition(!0));)n=new Ke.Condition("or",n||e,t,i+s);return n||e}},condition:function(e){var t,n,i;if(t=this.conditionAnd(e)){if(n=o.$str("or")){if(!(i=this.condition(e)))return;t=new Ke.Condition(n,t,i)}return t}},conditionAnd:function(e){var t,n,i,r,s=this;if(t=(r=s.negatedCondition(e)||s.parenthesisCondition(e))||e?r:s.atomicCondition(e)){if(n=o.$str("and")){if(!(i=this.conditionAnd(e)))return;t=new Ke.Condition(n,t,i)}return t}},negatedCondition:function(e){if(o.$str("not")){var t=this.parenthesisCondition(e);return t&&(t.negate=!t.negate),t}},parenthesisCondition:function(e){var t;if(o.save(),o.$str("(")){if(t=function(t){var n;if(o.save(),n=t.condition(e)){if(o.$char(")"))return o.forget(),n;o.restore()}else o.restore()}(this))return o.forget(),t;if(t=this.atomicCondition(e)){if(o.$char(")"))return o.forget(),t;o.restore("expected ')' got '".concat(o.currentChar(),"'"))}else o.restore()}else o.restore()},atomicCondition:function(e,t){var n,i,r,a,u=this.entities,c=o.i,h=function(){return this.addition()||u.keyword()||u.quoted()||u.mixinLookup()}.bind(this);if(n=t||h())return o.$char(">")?a=o.$char("=")?">=":">":o.$char("<")?a=o.$char("=")?"<=":"<":o.$char("=")&&(a=o.$char(">")?"=>":o.$char("<")?"=<":"="),a?(i=h())?r=new Ke.Condition(a,n,i,c+s,!1):l("expected expression"):t||(r=new Ke.Condition("=",n,new Ke.Keyword("true"),c+s,!1)),r},operand:function(){var e,t=this.entities;o.peek(/^-[@$(]/)&&(e=o.$char("-"));var n=this.sub()||t.dimension()||t.color()||t.variable()||t.property()||t.call()||t.quoted(!0)||t.colorKeyword()||this.colorOperand()||t.mixinLookup();return e&&(n.parensInOp=!0,n=new Ke.Negative(n)),n},expression:function(){var e,t,n=[],i=o.i;do{!(e=this.comment())||e.isLineComment?((e=this.addition()||this.entity())instanceof Ke.Comment&&(e=null),e&&(n.push(e),o.peek(/^\/[/*]/)||(t=o.$char("/"))&&n.push(new Ke.Anonymous(t,i+s)))):n.push(e)}while(e);if(n.length>0)return new Ke.Expression(n)},property:function(){var e=o.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(e)return e[1]},ruleProperty:function(){var e,t,n=[],r=[];o.save();var a=o.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(a)return n=[new Ke.Keyword(a[1])],o.forget(),n;function l(e){var t=o.i,i=o.$re(e);if(i)return r.push(t),n.push(i[1])}for(l(/^(\*?)/);l(/^((?:[\w-]+)|(?:[@$]\{[\w-]+\}))/););if(n.length>1&&l(/^((?:\+_|\+)?)\s*:/)){for(o.forget(),""===n[0]&&(n.shift(),r.shift()),t=0;t0;e--){var t=this.rules[e-1];if(t instanceof he)return this.parseValue(t)}},parseValue:function(e){var t=this;function n(e){return e.value instanceof se&&!e.parsed?("string"==typeof e.value.value?new ae(this.parse.context,this.parse.importManager,e.fileInfo(),e.value.getIndex()).parseNode(e.value.value,["value","important"],(function(t,n){t&&(e.parsed=!0),n&&(e.value=n[0],e.important=n[1]||"",e.parsed=!0)})):e.parsed=!0,e):e}if(Array.isArray(e)){var i=[];return e.forEach((function(e){i.push(n.call(t,e))})),i}return n.call(t,e)},rulesets:function(){if(!this.rules)return[];var e,t,n=[],i=this.rules;for(e=0;t=i[e];e++)t.isRuleset&&n.push(t);return n},prependRule:function(e){var t=this.rules;t?t.unshift(e):this.rules=[e],this.setParent(e,this)},find:function(e,t,n){t=t||this;var i,r,s=[],a=e.toCSS();return a in this._lookups?this._lookups[a]:(this.rulesets().forEach((function(a){if(a!==t)for(var o=0;oi){if(!n||n(a)){r=a.find(new oe(e.elements.slice(i)),t,n);for(var l=0;l0&&t.add(l),e.firstSelector=!0,a[0].genCSS(e,t),e.firstSelector=!1,i=1;i0?(s=(r=A(e)).pop(),a=i.createDerived(A(s.elements))):a=i.createDerived([]),t.length>0){var o=n.combinator,l=t[0].elements[0];o.emptyOrWhitespace&&!l.combinator.emptyOrWhitespace&&(o=l.combinator),a.elements.push(new g(o,l.value,n.isVariable,n._index,n._fileInfo)),a.elements=a.elements.concat(t[0].elements.slice(1))}if(0!==a.elements.length&&r.push(a),t.length>1){var u=t.slice(1);u=u.map((function(e){return e.createDerived(e.elements,[])})),r=r.concat(u)}return r}function a(e,t,n,i,r){var a;for(a=0;a0?i[i.length-1]=i[i.length-1].createDerived(i[i.length-1].elements.concat(e)):i.push(new oe(e));else t.push([new oe(e)])}function l(e,t){var n=t.createDerived(t.elements,t.extendList,t.evaldCondition);return n.copyVisibilityInfo(e),n}var u,c;if(!function e(t,n,l){var u,c,h,f,p,d,m,y,b,w,x,S,I=!1;for(f=[],p=[[]],u=0;y=l.elements[u];u++)if("&"!==y.value){var C=(S=void 0,(x=y).value instanceof v&&(S=x.value.value)instanceof oe?S:null);if(null!==C){o(f,p);var k,A=[],_=[];for(k=e(A,n,C),I=I||k,h=0;h0&&m[0].elements.push(new g(y.combinator,"",y.isVariable,y._index,y._fileInfo)),d.push(m);else for(h=0;h0&&(t.push(p[u]),w=p[u][b-1],p[u][b-1]=w.createDerived(w.elements,l.extendList));return I}(c=[],t,n))if(t.length>0)for(c=[],u=0;u0)for(t=0;t-1e-6&&(i=n.toFixed(20).replace(/0+$/,"")),e&&e.compress){if(0===n&&this.unit.isLength())return void t.add(i);n>0&&n<1&&(i=i.substr(1))}t.add(i),this.unit.genCSS(e,t)},operate:function(e,t,n){var i=this._operate(e,t,this.value,n.value),r=this.unit.clone();if("+"===t||"-"===t)if(0===r.numerator.length&&0===r.denominator.length)r=n.unit.clone(),this.unit.backupUnit&&(r.backupUnit=this.unit.backupUnit);else if(0===n.unit.numerator.length&&0===r.denominator.length);else{if(n=n.convertTo(this.unit.usedUnits()),e.strictUnits&&n.unit.toString()!==r.toString())throw new Error("Incompatible units. Change the units or use the unit function. "+"Bad units: '".concat(r.toString(),"' and '").concat(n.unit.toString(),"'."));i=this._operate(e,t,this.value,n.value)}else"*"===t?(r.numerator=r.numerator.concat(n.unit.numerator).sort(),r.denominator=r.denominator.concat(n.unit.denominator).sort(),r.cancel()):"/"===t&&(r.numerator=r.numerator.concat(n.unit.denominator).sort(),r.denominator=r.denominator.concat(n.unit.numerator).sort(),r.cancel());return new be(i,r)},compare:function(e){var t,n;if(e instanceof be){if(this.unit.isEmpty()||e.unit.isEmpty())t=this,n=e;else if(t=this.unify(),n=e.unify(),0!==t.unit.compare(n.unit))return;return u.numericCompare(t.value,n.value)}},unify:function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},convertTo:function(e){var t,n,i,r,s,a=this.value,l=this.unit.clone(),u={};if("string"==typeof e){for(t in o)o[t].hasOwnProperty(e)&&((u={})[t]=e);e=u}for(n in s=function(e,t){return i.hasOwnProperty(e)?(t?a/=i[e]/i[r]:a*=i[e]/i[r],r):e},e)e.hasOwnProperty(n)&&(r=e[n],i=o[n],l.map(s));return l.cancel(),new be(a,l)}});var we=function(e,t){if(this.value=e,this.noSpacing=t,!e)throw new Error("Expression requires an array parameter")};we.prototype=Object.assign(new u,{type:"Expression",accept:function(e){this.value=e.visitArray(this.value)},eval:function(e){var t,n=this.noSpacing,i=e.isMathOn(),r=this.parens,s=!1;return r&&e.inParenthesis(),this.value.length>1?t=new we(this.value.map((function(t){return t.eval?t.eval(e):t})),this.noSpacing):1===this.value.length?(!this.value[0].parens||this.value[0].parensInOp||e.inCalc||(s=!0),t=this.value[0].eval(e)):t=this,r&&e.outOfParenthesis(),!this.parens||!this.parensInOp||i||s||t instanceof be||(t=new v(t)),t.noSpacing=t.noSpacing||n,t},genCSS:function(e,t){for(var n=0;n1){var n=new oe([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();(t=new ge(n,e.mediaBlocks)).multiMedia=!0,t.copyVisibilityInfo(this.visibilityInfo()),this.setParent(t,this)}return delete e.mediaBlocks,delete e.mediaPath,t},evalNested:function(e){var t,n;this.evalFunction();var i=e.mediaPath.concat([this]);for(t=0;t0;t--)e.splice(t,0,new se("and"));return new we(e)}))),this.setParent(this.features,this),new ge([],[])},permute:function(e){if(0===e.length)return[];if(1===e.length)return e[0];for(var t=[],n=this.permute(e.slice(1)),i=0;i0)for(var o=function(t){var o=e.frames[t];if("Ruleset"===o.type&&o.rules&&o.rules.length>0&&o&&!o.root&&o.selectors&&o.selectors.length>0&&(a=a.concat(o.selectors)),a.length>0){for(var l="",u={add:function(e){l+=e}},c=0;c0&&i>0&&!s&&!r;return(this.isRooted&&n>0&&0===i&&!s&&r||!u)&&(t[0].root=!0),t},variable:function(e){if(this.rules)return ge.prototype.variable.call(this.rules[0],e)},find:function(){if(this.rules)return ge.prototype.find.apply(this.rules[0],arguments)},rulesets:function(){if(this.rules)return ge.prototype.rulesets.apply(this.rules[0])},outputRuleset:function(e,t,n){var i,r=n.length;if(e.tabLevel=1+(0|e.tabLevel),e.compress){for(t.add("{"),i=0;i=1)if("Expression"===(o=r[0]).type&&Array.isArray(o.value)&&o.value.length>=2)"Keyword"===(r=o.value)[0].type&&"layer"===r[0].value&&"Paren"===r[1].type&&(this.css=!1)}if(this.options.inline){var s=new se(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},!0,!0);return this.features?new $e([s],this.features.value):[s]}if(this.css||this.layerCss){var a=new Fe(this.evalPath(e),i,this.options,this._index);if(this.layerCss&&(a.css=this.layerCss,a.path._fileInfo=this._fileInfo),!a.css&&this.error)throw this.error;return a}if(this.root){if(this.features){var o;r=this.features.value;if(Array.isArray(r)&&1===r.length)if("Expression"===(o=r[0]).type&&Array.isArray(o.value)&&o.value.length>=2)if("Keyword"===(r=o.value)[0].type&&"layer"===r[0].value&&"Paren"===r[1].type)return this.layerCss=!0,r[0]=new we(r.slice(0,2)),r.splice(1,1),r[0].noSpacing=!0,this}return(t=new ge(null,A(this.root.rules))).evalImports(e),this.features?new $e(t.rules,this.features.value):t.rules}if(this.features){r=this.features.value;if(Array.isArray(r)&&r.length>=1)if(r=r[0].value,Array.isArray(r)&&r.length>=2)if("Keyword"===r[0].type&&"layer"===r[0].value&&"Paren"===r[1].type)return this.css=!0,r[0]=new we(r.slice(0,2)),r.splice(1,1),r[0].noSpacing=!0,this}return[]}});var Ve=function(){};Ve.prototype=Object.assign(new u,{evaluateJavaScript:function(e,t){var n,i=this,r={};if(!t.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};e=e.replace(/@\{([\w-]+)\}/g,(function(e,n){return i.jsify(new Pe("@".concat(n),i.getIndex(),i.fileInfo()).eval(t))}));try{e=new Function("return (".concat(e,")"))}catch(t){throw{message:"JavaScript evaluation error: ".concat(t.message," from `").concat(e,"`"),filename:this.fileInfo().filename,index:this.getIndex()}}var s=t.frames[0].variables();for(var a in s)s.hasOwnProperty(a)&&(r[a.slice(1)]={value:s[a].value,toJS:function(){return this.value.eval(t).toCSS()}});try{n=e.call(r)}catch(e){throw{message:"JavaScript evaluation error: '".concat(e.name,": ").concat(e.message.replace(/["]/g,"'"),"'"),filename:this.fileInfo().filename,index:this.getIndex()}}return n},jsify:function(e){return Array.isArray(e.value)&&e.value.length>1?"[".concat(e.value.map((function(e){return e.toCSS()})).join(", "),"]"):e.toCSS()}});var Le=function(e,t,n,i){this.escaped=t,this.expression=e,this._index=n,this._fileInfo=i};Le.prototype=Object.assign(new Ve,{type:"JavaScript",eval:function(e){var t=this.evaluateJavaScript(this.expression,e),n=typeof t;return"number"!==n||isNaN(t)?"string"===n?new Me('"'.concat(t,'"'),t,this.escaped,this._index):Array.isArray(t)?new se(t.join(", ")):new se(t):new be(t)}});var je=function(e,t){this.key=e,this.value=t};je.prototype=Object.assign(new u,{type:"Assignment",accept:function(e){this.value=e.visit(this.value)},eval:function(e){return this.value.eval?new je(this.key,this.value.eval(e)):this},genCSS:function(e,t){t.add("".concat(this.key,"=")),this.value.genCSS?this.value.genCSS(e,t):t.add(this.value)}});var De=function(e,t,n,i,r){this.op=e.trim(),this.lvalue=t,this.rvalue=n,this._index=i,this.negate=r};De.prototype=Object.assign(new u,{type:"Condition",accept:function(e){this.lvalue=e.visit(this.lvalue),this.rvalue=e.visit(this.rvalue)},eval:function(e){var t=function(e,t,n){switch(e){case"and":return t&&n;case"or":return t||n;default:switch(u.compare(t,n)){case-1:return"<"===e||"=<"===e||"<="===e;case 0:return"="===e||">="===e||"=<"===e||"<="===e;case 1:return">"===e||">="===e;default:return!1}}}(this.op,this.lvalue.eval(e),this.rvalue.eval(e));return this.negate?!t:t}});var Ne=function(e,t,n,i,r,s){this.op=e.trim(),this.lvalue=t,this.mvalue=n,this.op2=i?i.trim():null,this.rvalue=r,this._index=s,this.mvalues=[]};Ne.prototype=Object.assign(new u,{type:"QueryInParens",accept:function(e){this.lvalue=e.visit(this.lvalue),this.mvalue=e.visit(this.mvalue),this.rvalue&&(this.rvalue=e.visit(this.rvalue))},eval:function(e){var t,n;this.lvalue=this.lvalue.eval(e);for(var i=0;(n=e.frames[i])&&("Ruleset"!==n.type||!(t=n.rules.find((function(e){return!!(e instanceof he&&e.variable)}))));i++);return this.mvalueCopy||(this.mvalueCopy=C(this.mvalue)),t?(this.mvalue=this.mvalueCopy,this.mvalue=this.mvalue.eval(e),this.mvalues.push(this.mvalue)):this.mvalue=this.mvalue.eval(e),this.rvalue&&(this.rvalue=this.rvalue.eval(e)),this},genCSS:function(e,t){this.lvalue.genCSS(e,t),t.add(" "+this.op+" "),this.mvalues.length>0&&(this.mvalue=this.mvalues.shift()),this.mvalue.genCSS(e,t),this.rvalue&&(t.add(" "+this.op2+" "),this.rvalue.genCSS(e,t))}});var Be=function(e,t,n,i,r){this._index=n,this._fileInfo=i;var s=new oe([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new le(t),this.rules=[new ge(s,e)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(r),this.allowRoot=!0,this.setParent(s,this),this.setParent(this.features,this),this.setParent(this.rules,this)};Be.prototype=Object.assign(new Se,p(p({type:"Container"},xe),{genCSS:function(e,t){t.add("@container ",this._fileInfo,this._index),this.features.genCSS(e,t),this.outputRuleset(e,t,this.rules)},eval:function(e){e.mediaBlocks||(e.mediaBlocks=[],e.mediaPath=[]);var t=new Be(null,[],this._index,this._fileInfo,this.visibilityInfo());return this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,t.debugInfo=this.debugInfo),t.features=this.features.eval(e),e.mediaPath.push(t),e.mediaBlocks.push(t),this.rules[0].functionRegistry=e.frames[0].functionRegistry.inherit(),e.frames.unshift(this.rules[0]),t.rules=[this.rules[0].eval(e)],e.frames.shift(),e.mediaPath.pop(),0===e.mediaPath.length?t.evalTop(e):t.evalNested(e)}}));var Ue=function(e){this.value=e};Ue.prototype=Object.assign(new u,{type:"UnicodeDescriptor"});var qe=function(e){this.value=e};qe.prototype=Object.assign(new u,{type:"Negative",genCSS:function(e,t){t.add("-"),this.value.genCSS(e,t)},eval:function(e){return e.isMathOn()?new ke("*",[new be(-1),this.value]).eval(e):new qe(this.value.eval(e))}});var Te=function(e,t,n,i,r){switch(this.selector=e,this.option=t,this.object_id=Te.next_id++,this.parent_ids=[this.object_id],this._index=n,this._fileInfo=i,this.copyVisibilityInfo(r),this.allowRoot=!0,t){case"!all":case"all":this.allowBefore=!0,this.allowAfter=!0;break;default:this.allowBefore=!1,this.allowAfter=!1}this.setParent(this.selector,this)};Te.prototype=Object.assign(new u,{type:"Extend",accept:function(e){this.selector=e.visit(this.selector)},eval:function(e){return new Te(this.selector.eval(e),this.option,this.getIndex(),this.fileInfo(),this.visibilityInfo())},clone:function(e){return new Te(this.selector,this.option,this.getIndex(),this.fileInfo(),this.visibilityInfo())},findSelfSelectors:function(e){var t,n,i=[];for(t=0;t0&&n.length&&""===n[0].combinator.value&&(n[0].combinator.value=" "),i=i.concat(e[t].elements);this.selfSelectors=[new oe(i)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())}}),Te.next_id=0;var ze=function(e,t,n){this.variable=e,this._index=t,this._fileInfo=n,this.allowRoot=!0};ze.prototype=Object.assign(new u,{type:"VariableCall",eval:function(e){var t,n=new Pe(this.variable,this.getIndex(),this.fileInfo()).eval(e),i=new F({message:"Could not evaluate variable call ".concat(this.variable)});if(!n.ruleset){if(n.rules)t=n;else if(Array.isArray(n))t=new ge("",n);else{if(!Array.isArray(n.value))throw i;t=new ge("",n.value)}n=new Ie(t)}if(n.ruleset)return n.callEval(e);throw i}});var Ge=function(e,t,n,i){this.value=e,this.lookups=t,this._index=n,this._fileInfo=i};Ge.prototype=Object.assign(new u,{type:"NamespaceValue",eval:function(e){var t,n,i=this.value.eval(e);for(t=0;tthis.params.length)return!1}n=Math.min(s,this.arity);for(var a=0;a0){for(c=!0,o=0;o0)f=2;else if(f=1,p[1]+p[2]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `".concat(this.format(m),"`"),index:this.getIndex(),filename:this.fileInfo().filename};for(o=0;o0&&(e=e.slice(0,t)),(t=e.lastIndexOf("/"))<0&&(t=e.lastIndexOf("\\")),t<0?"":e.slice(0,t+1)},e.prototype.tryAppendExtension=function(e,t){return/(\.[a-z]*$)|([?;].*)$/.test(e)?e:e+t},e.prototype.tryAppendLessExtension=function(e){return this.tryAppendExtension(e,".less")},e.prototype.supportsSync=function(){return!1},e.prototype.alwaysMakePathsAbsolute=function(){return!1},e.prototype.isPathAbsolute=function(e){return/^(?:[a-z-]+:|\/|\\|#)/i.test(e)},e.prototype.join=function(e,t){return e?e+t:t},e.prototype.pathDiff=function(e,t){var n,i,r,s,a=this.extractUrlParts(e),o=this.extractUrlParts(t),l="";if(a.hostPart!==o.hostPart)return"";for(i=Math.max(o.directories.length,a.directories.length),n=0;nparseInt(t[n])?-1:1;return 0},e.prototype.versionToString=function(e){for(var t="",n=0;n1?e-1:e)<1?r+(s-r)*e*6:2*e<1?s:3*e<2?r+(s-r)*(2/3-e)*6:r}try{if(e instanceof c)return i=t?st(t):e.alpha,new c(e.rgb,i,"hsla");e=st(e)%360/360,t=tt(st(t)),n=tt(st(n)),i=tt(st(i)),r=2*n-(s=n<=.5?n*(t+1):n+t-n*t);var o=[255*a(e+1/3),255*a(e),255*a(e-1/3)];return i=st(i),new c(o,i,"hsla")}catch(e){}},hsv:function(e,t,n){return Ye.hsva(e,t,n,1)},hsva:function(e,t,n,i){var r,s;e=st(e)%360/360*360,t=st(t),n=st(n),i=st(i);var a=[n,n*(1-t),n*(1-(s=e/60-(r=Math.floor(e/60%6)))*t),n*(1-(1-s)*t)],o=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return Ye.rgba(255*a[o[r][0]],255*a[o[r][1]],255*a[o[r][2]],i)},hue:function(e){return new be(it(e).h)},saturation:function(e){return new be(100*it(e).s,"%")},lightness:function(e){return new be(100*it(e).l,"%")},hsvhue:function(e){return new be(rt(e).h)},hsvsaturation:function(e){return new be(100*rt(e).s,"%")},hsvvalue:function(e){return new be(100*rt(e).v,"%")},red:function(e){return new be(e.rgb[0])},green:function(e){return new be(e.rgb[1])},blue:function(e){return new be(e.rgb[2])},alpha:function(e){return new be(it(e).a)},luma:function(e){return new be(e.luma()*e.alpha*100,"%")},luminance:function(e){var t=.2126*e.rgb[0]/255+.7152*e.rgb[1]/255+.0722*e.rgb[2]/255;return new be(t*e.alpha*100,"%")},saturate:function(e,t,n){if(!e.rgb)return null;var i=it(e);return void 0!==n&&"relative"===n.value?i.s+=i.s*t.value/100:i.s+=t.value/100,i.s=tt(i.s),nt(e,i)},desaturate:function(e,t,n){var i=it(e);return void 0!==n&&"relative"===n.value?i.s-=i.s*t.value/100:i.s-=t.value/100,i.s=tt(i.s),nt(e,i)},lighten:function(e,t,n){var i=it(e);return void 0!==n&&"relative"===n.value?i.l+=i.l*t.value/100:i.l+=t.value/100,i.l=tt(i.l),nt(e,i)},darken:function(e,t,n){var i=it(e);return void 0!==n&&"relative"===n.value?i.l-=i.l*t.value/100:i.l-=t.value/100,i.l=tt(i.l),nt(e,i)},fadein:function(e,t,n){var i=it(e);return void 0!==n&&"relative"===n.value?i.a+=i.a*t.value/100:i.a+=t.value/100,i.a=tt(i.a),nt(e,i)},fadeout:function(e,t,n){var i=it(e);return void 0!==n&&"relative"===n.value?i.a-=i.a*t.value/100:i.a-=t.value/100,i.a=tt(i.a),nt(e,i)},fade:function(e,t){var n=it(e);return n.a=t.value/100,n.a=tt(n.a),nt(e,n)},spin:function(e,t){var n=it(e),i=(n.h+t.value)%360;return n.h=i<0?360+i:i,nt(e,n)},mix:function(e,t,n){n||(n=new be(50));var i=n.value/100,r=2*i-1,s=it(e).a-it(t).a,a=((r*s==-1?r:(r+s)/(1+r*s))+1)/2,o=1-a,l=[e.rgb[0]*a+t.rgb[0]*o,e.rgb[1]*a+t.rgb[1]*o,e.rgb[2]*a+t.rgb[2]*o],u=e.alpha*i+t.alpha*(1-i);return new c(l,u)},greyscale:function(e){return Ye.desaturate(e,new be(100))},contrast:function(e,t,n,i){if(!e.rgb)return null;if(void 0===n&&(n=Ye.rgba(255,255,255,1)),void 0===t&&(t=Ye.rgba(0,0,0,1)),t.luma()>n.luma()){var r=n;n=t,t=r}return i=void 0===i?.43:st(i),e.luma().5&&(i=1,n=e>.25?Math.sqrt(e):((16*e-12)*e+4)*e),e-(1-2*t)*i*(n-e)},hardlight:function(e,t){return lt.overlay(t,e)},difference:function(e,t){return Math.abs(e-t)},exclusion:function(e,t){return e+t-2*e*t},average:function(e,t){return(e+t)/2},negation:function(e,t){return 1-Math.abs(e+t-1)}};for(var ut in lt)lt.hasOwnProperty(ut)&&(ot[ut]=ot.bind(null,lt[ut]));var ct=function(e){return Array.isArray(e.value)?e.value:Array(e)},ht={_SELF:function(e){return e},"~":function(){for(var e=[],t=0;ta.value)&&(h[i]=r);else{if(void 0!==l&&o!==l)throw{type:"Argument",message:"incompatible types"};f[o]=h.length,h.push(r)}}return 1==h.length?h[0]:(t=h.map((function(e){return e.toCSS(c.context)})).join(this.context.compress?",":", "),new se("".concat(e?"min":"max","(").concat(t,")")))},mt={min:function(){for(var e=[],t=0;t"),r=0;r");return i+="'),i=encodeURIComponent(i),i="data:image/svg+xml,".concat(i),new Oe(new Me("'".concat(i,"'"),i,!1,this.index,this.currentFileInfo),this.index,this.currentFileInfo)}}),ne.addMultiple(wt),ne.addMultiple(St),t};function Ct(e,t){var n,i=(t=t||{}).variables,r=new B.Eval(t);"object"!=typeof i||Array.isArray(i)||(i=Object.keys(i).map((function(e){var t=i[e];return t instanceof Ke.Value||(t instanceof Ke.Expression||(t=new Ke.Expression([t])),t=new Ke.Value([t])),new Ke.Declaration("@".concat(e),t,!1,null,0)})),r.frames=[new Ke.Ruleset(null,i)]);var s,a,o=[new ee.JoinSelectorVisitor,new ee.MarkVisibleSelectorsVisitor(!0),new ee.ExtendVisitor,new ee.ToCSSVisitor({compress:Boolean(t.compress)})],l=[];if(t.pluginManager){a=t.pluginManager.visitor();for(var u=0;u<2;u++)for(a.first();s=a.get();)s.isPreEvalVisitor?0!==u&&-1!==l.indexOf(s)||(l.push(s),s.run(e)):0!==u&&-1!==o.indexOf(s)||(s.isPreVisitor?o.unshift(s):o.push(s))}n=e.eval(r);for(var c=0;c=t);n++);this.preProcessors.splice(n,0,{preProcessor:e,priority:t})},e.prototype.addPostProcessor=function(e,t){var n;for(n=0;n=t);n++);this.postProcessors.splice(n,0,{postProcessor:e,priority:t})},e.prototype.addFileManager=function(e){this.fileManagers.push(e)},e.prototype.getPreProcessors=function(){for(var e=[],t=0;t0){var i=void 0,r=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?i=this.sourceMapURL:this._sourceMapFilename&&(i=this._sourceMapFilename),this.sourceMapURL=i,this.sourceMap=r}return this._css.join("")},t}()}(e=new s(e,t)),e)),o=function(e){return function(){function t(e,t,n){this.less=e,this.rootFilename=n.filename,this.paths=t.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=t.mime,this.error=null,this.context=t,this.queue=[],this.files={}}return t.prototype.push=function(t,n,i,s,a){var o=this,l=this.context.pluginManager.Loader;this.queue.push(t);var u=function(e,n,i){o.queue.splice(o.queue.indexOf(t),1);var l=i===o.rootFilename;s.optional&&e?(a(null,{rules:[]},!1,null),r.info("The file ".concat(i," was skipped because it was not found and the import was marked optional."))):(o.files[i]||s.inline||(o.files[i]={root:n,options:s}),e&&!o.error&&(o.error=e),a(e,n,l,i))},c={rewriteUrls:this.context.rewriteUrls,entryPath:i.entryPath,rootpath:i.rootpath,rootFilename:i.rootFilename},h=e.getFileManager(t,i.currentDirectory,this.context,e);if(h){var f,p,v=function(e){var t,n=e.filename,r=e.contents.replace(/^\uFEFF/,"");c.currentDirectory=h.getPath(n),c.rewriteUrls&&(c.rootpath=h.join(o.context.rootpath||"",h.pathDiff(c.currentDirectory,c.entryPath)),!h.isPathAbsolute(c.rootpath)&&h.alwaysMakePathsAbsolute()&&(c.rootpath=h.join(c.entryPath,c.rootpath))),c.filename=n;var a=new B.Parse(o.context);a.processImports=!1,o.contents[n]=r,(i.reference||s.reference)&&(c.reference=!0),s.isPlugin?(t=l.evalPlugin(r,a,o,s.pluginArgs,c))instanceof F?u(t,null,n):u(null,t,n):s.inline?u(null,r,n):!o.files[n]||o.files[n].options.multiple||s.multiple?new ae(a,o,c).parse(r,(function(e,t){u(e,t,n)})):u(null,o.files[n].root,n)},d=_(this.context);n&&(d.ext=s.isPlugin?".js":".less"),s.isPlugin?(d.mime="application/javascript",d.syncImport?f=l.loadPluginSync(t,i.currentDirectory,d,e,h):p=l.loadPlugin(t,i.currentDirectory,d,e,h)):d.syncImport?f=h.loadFileSync(t,i.currentDirectory,d,e):p=h.loadFile(t,i.currentDirectory,d,e,(function(e,t){e?u(e):v(t)})),f?f.filename?v(f):u(f):p&&p.then(v,u)}else u({message:"Could not find a file-manager for ".concat(t)})},t}()}(e);var u,c=function(e,t){var n=function(e,i,r){if("function"==typeof i?(r=i,i=E(this.options,{})):i=E(this.options,i||{}),!r){var s=this;return new Promise((function(t,r){n.call(s,e,i,(function(e,n){e?r(e):t(n)}))}))}this.parse(e,i,(function(e,n,i,s){if(e)return r(e);var a;try{a=new t(n,i).toCSS(s)}catch(e){return r(e)}r(null,a)}))};return n}(0,a),h=function(e,t,n){var i=function(e,t,r){if("function"==typeof t?(r=t,t=E(this.options,{})):t=E(this.options,t||{}),!r){var s=this;return new Promise((function(n,r){i.call(s,e,t,(function(e,t){e?r(e):n(t)}))}))}var a,o=void 0,l=new _t(this,!t.reUsePluginManager);if(t.pluginManager=l,a=new B.Parse(t),t.rootFileInfo)o=t.rootFileInfo;else{var u=t.filename||"input",c=u.replace(/[^/\\]*$/,"");(o={filename:u,rewriteUrls:a.rewriteUrls,rootpath:a.rootpath||"",currentDirectory:c,entryPath:c,rootFilename:u}).rootpath&&"/"!==o.rootpath.slice(-1)&&(o.rootpath+="/")}var h=new n(this,a,o);this.importManager=h,t.plugins&&t.plugins.forEach((function(e){var t,n;if(e.fileContent){if(n=e.fileContent.replace(/^\uFEFF/,""),(t=l.Loader.evalPlugin(n,a,h,e.options,e.filename))instanceof F)return r(t)}else l.addPlugin(e)})),new ae(a,h,o).parse(e,(function(e,n){if(e)return r(e);r(null,n,h,t)}),t)};return i}(0,0,o),f=Rt("v".concat("4.4.2")),p={version:[f.major,f.minor,f.patch],data:l,tree:Ke,Environment:s,AbstractFileManager:He,AbstractPluginLoader:Qe,environment:e,visitors:ee,Parser:ae,functions:It(e),contexts:B,SourceMapOutput:n,SourceMapBuilder:i,ParseTree:a,ImportManager:o,render:c,parse:h,LessError:F,transformTree:Ct,utils:O,PluginManager:_t,logger:r},v=function(e){return function(){var t=Object.create(e.prototype);return e.apply(t,Array.prototype.slice.call(arguments,0)),t}},d=Object.create(p);for(var m in p.tree)if("function"==typeof(u=p.tree[m]))d[m.toLowerCase()]=v(u);else for(var g in d[m]=Object.create(null),u)d[m][g.toLowerCase()]=v(u[g]);return p.parse=p.parse.bind(d),p.render=p.render.bind(d),d}var Ot={},$t=function(){};$t.prototype=Object.assign(new He,{alwaysMakePathsAbsolute:function(){return!0},join:function(e,t){return e?this.extractUrlParts(t,e).path:t},doXHR:function(e,t,n,i){var r=new XMLHttpRequest,s=!Pt.isFileProtocol||Pt.fileAsync;function a(t,n,i){t.status>=200&&t.status<300?n(t.responseText,t.getResponseHeader("Last-Modified")):"function"==typeof i&&i(t.status,e)}"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/css"),Et.debug("XHR: Getting '".concat(e,"'")),r.open("GET",e,s),r.setRequestHeader("Accept",t||"text/x-less, text/css; q=0.9, */*; q=0.5"),r.send(null),Pt.isFileProtocol&&!Pt.fileAsync?0===r.status||r.status>=200&&r.status<300?n(r.responseText):i(r.status,e):s?r.onreadystatechange=function(){4==r.readyState&&a(r,n,i)}:a(r,n,i)},supports:function(){return!0},clearFileCache:function(){Ot={}},loadFile:function(e,t,n){t&&!this.isPathAbsolute(e)&&(e=t+e),e=n.ext?this.tryAppendExtension(e,n.ext):e,n=n||{};var i=this.extractUrlParts(e,window.location.href).url,r=this;return new Promise((function(e,t){if(n.useFileCache&&Ot[i])try{var s=Ot[i];return e({contents:s,filename:i,webInfo:{lastModified:new Date}})}catch(e){return t({filename:i,message:"Error loading file ".concat(i," error was ").concat(e.message)})}r.doXHR(i,n.mime,(function(t,n){Ot[i]=t,e({contents:t,filename:i,webInfo:{lastModified:n}})}),(function(e,n){t({type:"File",message:"'".concat(n,"' wasn't found (").concat(e,")"),href:i})}))}))}});var Ft=function(e,t){return Pt=e,Et=t,$t},Vt=function(e){this.less=e};Vt.prototype=Object.assign(new Qe,{loadPlugin:function(e,t,n,i,r){return new Promise((function(s,a){r.loadFile(e,t,n,i).then(s).catch(a)}))}});var Lt=function(t,i,r){return{add:function(s,a){r.errorReporting&&"html"!==r.errorReporting?"console"===r.errorReporting?function(e,t){var n=e.filename||t,s=[],a="".concat(e.type||"Syntax","Error: ").concat(e.message||"There is an error in your .less file"," in ").concat(n),o=function(e,t,n){void 0!==e.extract[t]&&s.push("{line} {content}".replace(/\{line\}/,(parseInt(e.line,10)||0)+(t-1)).replace(/\{class\}/,n).replace(/\{content\}/,e.extract[t]))};e.line&&(o(e,0,""),o(e,1,"line"),o(e,2,""),a+=" on line ".concat(e.line,", column ").concat(e.column+1,":\n").concat(s.join("\n"))),e.stack&&(e.extract||r.logLevel>=4)&&(a+="\nStack Trace\n".concat(e.stack)),i.logger.error(a)}(s,a):"function"==typeof r.errorReporting&&r.errorReporting("add",s,a):function(i,s){var a,o,l="less-error-message:".concat(e(s||"")),u=t.document.createElement("div"),c=[],h=i.filename||s,f=h.match(/([^/]+(\?.*)?)$/)[1];u.id=l,u.className="less-error-message",o="

    ".concat(i.type||"Syntax","Error: ").concat(i.message||"There is an error in your .less file")+'

    in ').concat(f," ");var p=function(e,t,n){void 0!==e.extract[t]&&c.push('

  • {content}
  • '.replace(/\{line\}/,(parseInt(e.line,10)||0)+(t-1)).replace(/\{class\}/,n).replace(/\{content\}/,e.extract[t]))};i.line&&(p(i,0,""),p(i,1,"line"),p(i,2,""),o+="on line ".concat(i.line,", column ").concat(i.column+1,":

      ").concat(c.join(""),"
    ")),i.stack&&(i.extract||r.logLevel>=4)&&(o+="
    Stack Trace
    ".concat(i.stack.split("\n").slice(1).join("
    "))),u.innerHTML=o,n(t.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),u.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===r.env&&(a=setInterval((function(){var e=t.document,n=e.body;n&&(e.getElementById(l)?n.replaceChild(u,e.getElementById(l)):n.insertBefore(u,n.firstChild),clearInterval(a))}),10))}(s,a)},remove:function(n){r.errorReporting&&"html"!==r.errorReporting?"console"===r.errorReporting||"function"==typeof r.errorReporting&&r.errorReporting("remove",n):function(n){var i=t.document.getElementById("less-error-message:".concat(e(n)));i&&i.parentNode.removeChild(i)}(n)}}},jt={javascriptEnabled:!1,depends:!1,compress:!1,lint:!1,paths:[],color:!0,strictImports:!1,insecure:!1,rootpath:"",rewriteUrls:!1,math:1,strictUnits:!1,globalVars:null,modifyVars:null,urlArgs:""};if(window.less)for(var Dt in window.less)Object.prototype.hasOwnProperty.call(window.less,Dt)&&(jt[Dt]=window.less[Dt]);!function(e,n){t(n,i(e)),void 0===n.isFileProtocol&&(n.isFileProtocol=/^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(e.location.protocol)),n.async=n.async||!1,n.fileAsync=n.fileAsync||!1,n.poll=n.poll||(n.isFileProtocol?1e3:1500),n.env=n.env||("127.0.0.1"==e.location.hostname||"0.0.0.0"==e.location.hostname||"localhost"==e.location.hostname||e.location.port&&e.location.port.length>0||n.isFileProtocol?"development":"production");var r=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(e.location.hash);r&&(n.dumpLineNumbers=r[1]),void 0===n.useFileCache&&(n.useFileCache=!0),void 0===n.onReady&&(n.onReady=!0),n.relativeUrls&&(n.rewriteUrls="all")}(window,jt),jt.plugins=jt.plugins||[],window.LESS_PLUGINS&&(jt.plugins=jt.plugins.concat(window.LESS_PLUGINS));var Nt,Bt,Ut,qt=function(e,i){var r=e.document,s=Mt();s.options=i;var a=s.environment,o=Ft(i,s.logger),l=new o;a.addFileManager(l),s.FileManager=o,s.PluginLoader=Vt,function(e,t){t.logLevel=void 0!==t.logLevel?t.logLevel:"development"===t.env?3:1,t.loggers||(t.loggers=[{debug:function(e){t.logLevel>=4&&console.log(e)},info:function(e){t.logLevel>=3&&console.log(e)},warn:function(e){t.logLevel>=2&&console.warn(e)},error:function(e){t.logLevel>=1&&console.error(e)}}]);for(var n=0;n 0 && styleNode.childNodes.length > 0 &&\n oldStyleNode.firstChild.nodeValue === styleNode.firstChild.nodeValue);\n }\n\n const head = document.getElementsByTagName('head')[0];\n\n // If there is no oldStyleNode, just append; otherwise, only append if we need\n // to replace oldStyleNode with an updated stylesheet\n if (oldStyleNode === null || keepOldStyleNode === false) {\n const nextEl = sheet && sheet.nextSibling || null;\n if (nextEl) {\n nextEl.parentNode.insertBefore(styleNode, nextEl);\n } else {\n head.appendChild(styleNode);\n }\n }\n if (oldStyleNode && keepOldStyleNode === false) {\n oldStyleNode.parentNode.removeChild(oldStyleNode);\n }\n\n // For IE.\n // This needs to happen *after* the style element is added to the DOM, otherwise IE 7 and 8 may crash.\n // See http://social.msdn.microsoft.com/Forums/en-US/7e081b65-878a-4c22-8e68-c10d39c2ed32/internet-explorer-crashes-appending-style-element-to-head\n if (styleNode.styleSheet) {\n try {\n styleNode.styleSheet.cssText = styles;\n } catch (e) {\n throw new Error('Couldn\\'t reassign styleSheet.cssText.');\n }\n }\n },\n currentScript: function(window) {\n const document = window.document;\n return document.currentScript || (() => {\n const scripts = document.getElementsByTagName('script');\n return scripts[scripts.length - 1];\n })();\n }\n};\n","export default {\n error: function(msg) {\n this._fireEvent('error', msg);\n },\n warn: function(msg) {\n this._fireEvent('warn', msg);\n },\n info: function(msg) {\n this._fireEvent('info', msg);\n },\n debug: function(msg) {\n this._fireEvent('debug', msg);\n },\n addListener: function(listener) {\n this._listeners.push(listener);\n },\n removeListener: function(listener) {\n for (let i = 0; i < this._listeners.length; i++) {\n if (this._listeners[i] === listener) {\n this._listeners.splice(i, 1);\n return;\n }\n }\n },\n _fireEvent: function(type, msg) {\n for (let i = 0; i < this._listeners.length; i++) {\n const logFunction = this._listeners[i][type];\n if (logFunction) {\n logFunction(msg);\n }\n }\n },\n _listeners: []\n};\n","/**\n * @todo Document why this abstraction exists, and the relationship between\n * environment, file managers, and plugin manager\n */\n\nimport logger from '../logger';\n\nclass Environment {\n constructor(externalEnvironment, fileManagers) {\n this.fileManagers = fileManagers || [];\n externalEnvironment = externalEnvironment || {};\n\n const optionalFunctions = ['encodeBase64', 'mimeLookup', 'charsetLookup', 'getSourceMapGenerator'];\n const requiredFunctions = [];\n const functions = requiredFunctions.concat(optionalFunctions);\n\n for (let i = 0; i < functions.length; i++) {\n const propName = functions[i];\n const environmentFunc = externalEnvironment[propName];\n if (environmentFunc) {\n this[propName] = environmentFunc.bind(externalEnvironment);\n } else if (i < requiredFunctions.length) {\n this.warn(`missing required function in environment - ${propName}`);\n }\n }\n }\n\n getFileManager(filename, currentDirectory, options, environment, isSync) {\n\n if (!filename) {\n logger.warn('getFileManager called with no filename.. Please report this issue. continuing.');\n }\n if (currentDirectory === undefined) {\n logger.warn('getFileManager called with null directory.. Please report this issue. continuing.');\n }\n\n let fileManagers = this.fileManagers;\n if (options.pluginManager) {\n fileManagers = [].concat(fileManagers).concat(options.pluginManager.getFileManagers());\n }\n for (let i = fileManagers.length - 1; i >= 0 ; i--) {\n const fileManager = fileManagers[i];\n if (fileManager[isSync ? 'supportsSync' : 'supports'](filename, currentDirectory, options, environment)) {\n return fileManager;\n }\n }\n return null;\n }\n\n addFileManager(fileManager) {\n this.fileManagers.push(fileManager);\n }\n\n clearFileManagers() {\n this.fileManagers = [];\n }\n}\n\nexport default Environment;\n","export default {\n 'aliceblue':'#f0f8ff',\n 'antiquewhite':'#faebd7',\n 'aqua':'#00ffff',\n 'aquamarine':'#7fffd4',\n 'azure':'#f0ffff',\n 'beige':'#f5f5dc',\n 'bisque':'#ffe4c4',\n 'black':'#000000',\n 'blanchedalmond':'#ffebcd',\n 'blue':'#0000ff',\n 'blueviolet':'#8a2be2',\n 'brown':'#a52a2a',\n 'burlywood':'#deb887',\n 'cadetblue':'#5f9ea0',\n 'chartreuse':'#7fff00',\n 'chocolate':'#d2691e',\n 'coral':'#ff7f50',\n 'cornflowerblue':'#6495ed',\n 'cornsilk':'#fff8dc',\n 'crimson':'#dc143c',\n 'cyan':'#00ffff',\n 'darkblue':'#00008b',\n 'darkcyan':'#008b8b',\n 'darkgoldenrod':'#b8860b',\n 'darkgray':'#a9a9a9',\n 'darkgrey':'#a9a9a9',\n 'darkgreen':'#006400',\n 'darkkhaki':'#bdb76b',\n 'darkmagenta':'#8b008b',\n 'darkolivegreen':'#556b2f',\n 'darkorange':'#ff8c00',\n 'darkorchid':'#9932cc',\n 'darkred':'#8b0000',\n 'darksalmon':'#e9967a',\n 'darkseagreen':'#8fbc8f',\n 'darkslateblue':'#483d8b',\n 'darkslategray':'#2f4f4f',\n 'darkslategrey':'#2f4f4f',\n 'darkturquoise':'#00ced1',\n 'darkviolet':'#9400d3',\n 'deeppink':'#ff1493',\n 'deepskyblue':'#00bfff',\n 'dimgray':'#696969',\n 'dimgrey':'#696969',\n 'dodgerblue':'#1e90ff',\n 'firebrick':'#b22222',\n 'floralwhite':'#fffaf0',\n 'forestgreen':'#228b22',\n 'fuchsia':'#ff00ff',\n 'gainsboro':'#dcdcdc',\n 'ghostwhite':'#f8f8ff',\n 'gold':'#ffd700',\n 'goldenrod':'#daa520',\n 'gray':'#808080',\n 'grey':'#808080',\n 'green':'#008000',\n 'greenyellow':'#adff2f',\n 'honeydew':'#f0fff0',\n 'hotpink':'#ff69b4',\n 'indianred':'#cd5c5c',\n 'indigo':'#4b0082',\n 'ivory':'#fffff0',\n 'khaki':'#f0e68c',\n 'lavender':'#e6e6fa',\n 'lavenderblush':'#fff0f5',\n 'lawngreen':'#7cfc00',\n 'lemonchiffon':'#fffacd',\n 'lightblue':'#add8e6',\n 'lightcoral':'#f08080',\n 'lightcyan':'#e0ffff',\n 'lightgoldenrodyellow':'#fafad2',\n 'lightgray':'#d3d3d3',\n 'lightgrey':'#d3d3d3',\n 'lightgreen':'#90ee90',\n 'lightpink':'#ffb6c1',\n 'lightsalmon':'#ffa07a',\n 'lightseagreen':'#20b2aa',\n 'lightskyblue':'#87cefa',\n 'lightslategray':'#778899',\n 'lightslategrey':'#778899',\n 'lightsteelblue':'#b0c4de',\n 'lightyellow':'#ffffe0',\n 'lime':'#00ff00',\n 'limegreen':'#32cd32',\n 'linen':'#faf0e6',\n 'magenta':'#ff00ff',\n 'maroon':'#800000',\n 'mediumaquamarine':'#66cdaa',\n 'mediumblue':'#0000cd',\n 'mediumorchid':'#ba55d3',\n 'mediumpurple':'#9370d8',\n 'mediumseagreen':'#3cb371',\n 'mediumslateblue':'#7b68ee',\n 'mediumspringgreen':'#00fa9a',\n 'mediumturquoise':'#48d1cc',\n 'mediumvioletred':'#c71585',\n 'midnightblue':'#191970',\n 'mintcream':'#f5fffa',\n 'mistyrose':'#ffe4e1',\n 'moccasin':'#ffe4b5',\n 'navajowhite':'#ffdead',\n 'navy':'#000080',\n 'oldlace':'#fdf5e6',\n 'olive':'#808000',\n 'olivedrab':'#6b8e23',\n 'orange':'#ffa500',\n 'orangered':'#ff4500',\n 'orchid':'#da70d6',\n 'palegoldenrod':'#eee8aa',\n 'palegreen':'#98fb98',\n 'paleturquoise':'#afeeee',\n 'palevioletred':'#d87093',\n 'papayawhip':'#ffefd5',\n 'peachpuff':'#ffdab9',\n 'peru':'#cd853f',\n 'pink':'#ffc0cb',\n 'plum':'#dda0dd',\n 'powderblue':'#b0e0e6',\n 'purple':'#800080',\n 'rebeccapurple':'#663399',\n 'red':'#ff0000',\n 'rosybrown':'#bc8f8f',\n 'royalblue':'#4169e1',\n 'saddlebrown':'#8b4513',\n 'salmon':'#fa8072',\n 'sandybrown':'#f4a460',\n 'seagreen':'#2e8b57',\n 'seashell':'#fff5ee',\n 'sienna':'#a0522d',\n 'silver':'#c0c0c0',\n 'skyblue':'#87ceeb',\n 'slateblue':'#6a5acd',\n 'slategray':'#708090',\n 'slategrey':'#708090',\n 'snow':'#fffafa',\n 'springgreen':'#00ff7f',\n 'steelblue':'#4682b4',\n 'tan':'#d2b48c',\n 'teal':'#008080',\n 'thistle':'#d8bfd8',\n 'tomato':'#ff6347',\n 'turquoise':'#40e0d0',\n 'violet':'#ee82ee',\n 'wheat':'#f5deb3',\n 'white':'#ffffff',\n 'whitesmoke':'#f5f5f5',\n 'yellow':'#ffff00',\n 'yellowgreen':'#9acd32'\n};","export default {\n length: {\n 'm': 1,\n 'cm': 0.01,\n 'mm': 0.001,\n 'in': 0.0254,\n 'px': 0.0254 / 96,\n 'pt': 0.0254 / 72,\n 'pc': 0.0254 / 72 * 12\n },\n duration: {\n 's': 1,\n 'ms': 0.001\n },\n angle: {\n 'rad': 1 / (2 * Math.PI),\n 'deg': 1 / 360,\n 'grad': 1 / 400,\n 'turn': 1\n }\n};","import colors from './colors';\nimport unitConversions from './unit-conversions';\n\nexport default { colors, unitConversions };\n","/**\n * The reason why Node is a class and other nodes simply do not extend\n * from Node (since we're transpiling) is due to this issue:\n * \n * @see https://github.com/less/less.js/issues/3434\n */\nclass Node {\n constructor() {\n this.parent = null;\n this.visibilityBlocks = undefined;\n this.nodeVisible = undefined;\n this.rootNode = null;\n this.parsed = null;\n }\n\n get currentFileInfo() {\n return this.fileInfo();\n }\n\n get index() {\n return this.getIndex();\n }\n\n setParent(nodes, parent) {\n function set(node) {\n if (node && node instanceof Node) {\n node.parent = parent;\n }\n }\n if (Array.isArray(nodes)) {\n nodes.forEach(set);\n }\n else {\n set(nodes);\n }\n }\n\n getIndex() {\n return this._index || (this.parent && this.parent.getIndex()) || 0;\n }\n\n fileInfo() {\n return this._fileInfo || (this.parent && this.parent.fileInfo()) || {};\n }\n\n isRulesetLike() { return false; }\n\n toCSS(context) {\n const strs = [];\n this.genCSS(context, {\n // remove when genCSS has JSDoc types\n // eslint-disable-next-line no-unused-vars\n add: function(chunk, fileInfo, index) {\n strs.push(chunk);\n },\n isEmpty: function () {\n return strs.length === 0;\n }\n });\n return strs.join('');\n }\n\n genCSS(context, output) {\n output.add(this.value);\n }\n\n accept(visitor) {\n this.value = visitor.visit(this.value);\n }\n\n eval() { return this; }\n\n _operate(context, op, a, b) {\n switch (op) {\n case '+': return a + b;\n case '-': return a - b;\n case '*': return a * b;\n case '/': return a / b;\n }\n }\n\n fround(context, value) {\n const precision = context && context.numPrecision;\n // add \"epsilon\" to ensure numbers like 1.000000005 (represented as 1.000000004999...) are properly rounded:\n return (precision) ? Number((value + 2e-16).toFixed(precision)) : value;\n }\n\n static compare(a, b) {\n /* returns:\n -1: a < b\n 0: a = b\n 1: a > b\n and *any* other value for a != b (e.g. undefined, NaN, -2 etc.) */\n\n if ((a.compare) &&\n // for \"symmetric results\" force toCSS-based comparison\n // of Quoted or Anonymous if either value is one of those\n !(b.type === 'Quoted' || b.type === 'Anonymous')) {\n return a.compare(b);\n } else if (b.compare) {\n return -b.compare(a);\n } else if (a.type !== b.type) {\n return undefined;\n }\n\n a = a.value;\n b = b.value;\n if (!Array.isArray(a)) {\n return a === b ? 0 : undefined;\n }\n if (a.length !== b.length) {\n return undefined;\n }\n for (let i = 0; i < a.length; i++) {\n if (Node.compare(a[i], b[i]) !== 0) {\n return undefined;\n }\n }\n return 0;\n }\n\n static numericCompare(a, b) {\n return a < b ? -1\n : a === b ? 0\n : a > b ? 1 : undefined;\n }\n\n // Returns true if this node represents root of ast imported by reference\n blocksVisibility() {\n if (this.visibilityBlocks === undefined) {\n this.visibilityBlocks = 0;\n }\n return this.visibilityBlocks !== 0;\n }\n\n addVisibilityBlock() {\n if (this.visibilityBlocks === undefined) {\n this.visibilityBlocks = 0;\n }\n this.visibilityBlocks = this.visibilityBlocks + 1;\n }\n\n removeVisibilityBlock() {\n if (this.visibilityBlocks === undefined) {\n this.visibilityBlocks = 0;\n }\n this.visibilityBlocks = this.visibilityBlocks - 1;\n }\n\n // Turns on node visibility - if called node will be shown in output regardless\n // of whether it comes from import by reference or not\n ensureVisibility() {\n this.nodeVisible = true;\n }\n\n // Turns off node visibility - if called node will NOT be shown in output regardless\n // of whether it comes from import by reference or not\n ensureInvisibility() {\n this.nodeVisible = false;\n }\n\n // return values:\n // false - the node must not be visible\n // true - the node must be visible\n // undefined or null - the node has the same visibility as its parent\n isVisible() {\n return this.nodeVisible;\n }\n\n visibilityInfo() {\n return {\n visibilityBlocks: this.visibilityBlocks,\n nodeVisible: this.nodeVisible\n };\n }\n\n copyVisibilityInfo(info) {\n if (!info) {\n return;\n }\n this.visibilityBlocks = info.visibilityBlocks;\n this.nodeVisible = info.nodeVisible;\n }\n}\n\nexport default Node;\n","import Node from './node';\nimport colors from '../data/colors';\n\n//\n// RGB Colors - #ff0014, #eee\n//\nconst Color = function(rgb, a, originalForm) {\n const self = this;\n //\n // The end goal here, is to parse the arguments\n // into an integer triplet, such as `128, 255, 0`\n //\n // This facilitates operations and conversions.\n //\n if (Array.isArray(rgb)) {\n this.rgb = rgb;\n } else if (rgb.length >= 6) {\n this.rgb = [];\n rgb.match(/.{2}/g).map(function (c, i) {\n if (i < 3) {\n self.rgb.push(parseInt(c, 16));\n } else {\n self.alpha = (parseInt(c, 16)) / 255;\n }\n });\n } else {\n this.rgb = [];\n rgb.split('').map(function (c, i) {\n if (i < 3) {\n self.rgb.push(parseInt(c + c, 16));\n } else {\n self.alpha = (parseInt(c + c, 16)) / 255;\n }\n });\n }\n this.alpha = this.alpha || (typeof a === 'number' ? a : 1);\n if (typeof originalForm !== 'undefined') {\n this.value = originalForm;\n }\n}\n\nColor.prototype = Object.assign(new Node(), {\n type: 'Color',\n\n luma() {\n let r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255;\n\n r = (r <= 0.03928) ? r / 12.92 : Math.pow(((r + 0.055) / 1.055), 2.4);\n g = (g <= 0.03928) ? g / 12.92 : Math.pow(((g + 0.055) / 1.055), 2.4);\n b = (b <= 0.03928) ? b / 12.92 : Math.pow(((b + 0.055) / 1.055), 2.4);\n\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n },\n\n genCSS(context, output) {\n output.add(this.toCSS(context));\n },\n\n toCSS(context, doNotCompress) {\n const compress = context && context.compress && !doNotCompress;\n let color;\n let alpha;\n let colorFunction;\n let args = [];\n\n // `value` is set if this color was originally\n // converted from a named color string so we need\n // to respect this and try to output named color too.\n alpha = this.fround(context, this.alpha);\n\n if (this.value) {\n if (this.value.indexOf('rgb') === 0) {\n if (alpha < 1) {\n colorFunction = 'rgba';\n }\n } else if (this.value.indexOf('hsl') === 0) {\n if (alpha < 1) {\n colorFunction = 'hsla';\n } else {\n colorFunction = 'hsl';\n }\n } else {\n return this.value;\n }\n } else {\n if (alpha < 1) {\n colorFunction = 'rgba';\n }\n }\n\n switch (colorFunction) {\n case 'rgba':\n args = this.rgb.map(function (c) {\n return clamp(Math.round(c), 255);\n }).concat(clamp(alpha, 1));\n break;\n case 'hsla':\n args.push(clamp(alpha, 1));\n // eslint-disable-next-line no-fallthrough\n case 'hsl':\n color = this.toHSL();\n args = [\n this.fround(context, color.h),\n `${this.fround(context, color.s * 100)}%`,\n `${this.fround(context, color.l * 100)}%`\n ].concat(args);\n }\n\n if (colorFunction) {\n // Values are capped between `0` and `255`, rounded and zero-padded.\n return `${colorFunction}(${args.join(`,${compress ? '' : ' '}`)})`;\n }\n\n color = this.toRGB();\n\n if (compress) {\n const splitcolor = color.split('');\n\n // Convert color to short format\n if (splitcolor[1] === splitcolor[2] && splitcolor[3] === splitcolor[4] && splitcolor[5] === splitcolor[6]) {\n color = `#${splitcolor[1]}${splitcolor[3]}${splitcolor[5]}`;\n }\n }\n\n return color;\n },\n\n //\n // Operations have to be done per-channel, if not,\n // channels will spill onto each other. Once we have\n // our result, in the form of an integer triplet,\n // we create a new Color node to hold the result.\n //\n operate(context, op, other) {\n const rgb = new Array(3);\n const alpha = this.alpha * (1 - other.alpha) + other.alpha;\n for (let c = 0; c < 3; c++) {\n rgb[c] = this._operate(context, op, this.rgb[c], other.rgb[c]);\n }\n return new Color(rgb, alpha);\n },\n\n toRGB() {\n return toHex(this.rgb);\n },\n\n toHSL() {\n const r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha;\n\n const max = Math.max(r, g, b), min = Math.min(r, g, b);\n let h;\n let s;\n const l = (max + min) / 2;\n const d = max - min;\n\n if (max === min) {\n h = s = 0;\n } else {\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n return { h: h * 360, s, l, a };\n },\n\n // Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript\n toHSV() {\n const r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha;\n\n const max = Math.max(r, g, b), min = Math.min(r, g, b);\n let h;\n let s;\n const v = max;\n\n const d = max - min;\n if (max === 0) {\n s = 0;\n } else {\n s = d / max;\n }\n\n if (max === min) {\n h = 0;\n } else {\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n return { h: h * 360, s, v, a };\n },\n\n toARGB() {\n return toHex([this.alpha * 255].concat(this.rgb));\n },\n\n compare(x) {\n return (x.rgb &&\n x.rgb[0] === this.rgb[0] &&\n x.rgb[1] === this.rgb[1] &&\n x.rgb[2] === this.rgb[2] &&\n x.alpha === this.alpha) ? 0 : undefined;\n }\n});\n\nColor.fromKeyword = function(keyword) {\n let c;\n const key = keyword.toLowerCase();\n // eslint-disable-next-line no-prototype-builtins\n if (colors.hasOwnProperty(key)) {\n c = new Color(colors[key].slice(1));\n }\n else if (key === 'transparent') {\n c = new Color([0, 0, 0], 0);\n }\n\n if (c) {\n c.value = keyword;\n return c;\n }\n};\n\nfunction clamp(v, max) {\n return Math.min(Math.max(v, 0), max);\n}\n\nfunction toHex(v) {\n return `#${v.map(function (c) {\n c = clamp(Math.round(c), 255);\n return (c < 16 ? '0' : '') + c.toString(16);\n }).join('')}`;\n}\n\nexport default Color;\n","/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nvar ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n else s |= 1;\n }\n catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\n });\n }\n return path;\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __esDecorate,\n __runInitializers,\n __propKey,\n __setFunctionName,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n __rewriteRelativeImportExtension,\n};\n","import Node from './node';\n\nconst Paren = function(node) {\n this.value = node;\n};\n\nParen.prototype = Object.assign(new Node(), {\n type: 'Paren',\n\n genCSS(context, output) {\n output.add('(');\n this.value.genCSS(context, output);\n output.add(')');\n },\n\n eval(context) {\n const paren = new Paren(this.value.eval(context));\n \n if (this.noSpacing) {\n paren.noSpacing = true;\n }\n\n return paren;\n }\n});\n\nexport default Paren;\n","import Node from './node';\nconst _noSpaceCombinators = {\n '': true,\n ' ': true,\n '|': true\n};\n\nconst Combinator = function(value) {\n if (value === ' ') {\n this.value = ' ';\n this.emptyOrWhitespace = true;\n } else {\n this.value = value ? value.trim() : '';\n this.emptyOrWhitespace = this.value === '';\n }\n}\n\nCombinator.prototype = Object.assign(new Node(), {\n type: 'Combinator',\n\n genCSS(context, output) {\n const spaceOrEmpty = (context.compress || _noSpaceCombinators[this.value]) ? '' : ' ';\n output.add(spaceOrEmpty + this.value + spaceOrEmpty);\n }\n});\n\nexport default Combinator;\n","import Node from './node';\nimport Paren from './paren';\nimport Combinator from './combinator';\n\nconst Element = function(combinator, value, isVariable, index, currentFileInfo, visibilityInfo) {\n this.combinator = combinator instanceof Combinator ?\n combinator : new Combinator(combinator);\n\n if (typeof value === 'string') {\n this.value = value.trim();\n } else if (value) {\n this.value = value;\n } else {\n this.value = '';\n }\n this.isVariable = isVariable;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.copyVisibilityInfo(visibilityInfo);\n this.setParent(this.combinator, this);\n}\n\nElement.prototype = Object.assign(new Node(), {\n type: 'Element',\n\n accept(visitor) {\n const value = this.value;\n this.combinator = visitor.visit(this.combinator);\n if (typeof value === 'object') {\n this.value = visitor.visit(value);\n }\n },\n\n eval(context) {\n return new Element(this.combinator,\n this.value.eval ? this.value.eval(context) : this.value,\n this.isVariable,\n this.getIndex(),\n this.fileInfo(), this.visibilityInfo());\n },\n\n clone() {\n return new Element(this.combinator,\n this.value,\n this.isVariable,\n this.getIndex(),\n this.fileInfo(), this.visibilityInfo());\n },\n\n genCSS(context, output) {\n output.add(this.toCSS(context), this.fileInfo(), this.getIndex());\n },\n\n toCSS(context) {\n context = context || {};\n let value = this.value;\n const firstSelector = context.firstSelector;\n if (value instanceof Paren) {\n // selector in parens should not be affected by outer selector\n // flags (breaks only interpolated selectors - see #1973)\n context.firstSelector = true;\n }\n value = value.toCSS ? value.toCSS(context) : value;\n context.firstSelector = firstSelector;\n if (value === '' && this.combinator.value.charAt(0) === '&') {\n return '';\n } else {\n return this.combinator.toCSS(context) + value;\n }\n }\n});\n\nexport default Element;\n","\nexport const Math = {\n ALWAYS: 0,\n PARENS_DIVISION: 1,\n PARENS: 2\n // removed - STRICT_LEGACY: 3\n};\n\nexport const RewriteUrls = {\n OFF: 0,\n LOCAL: 1,\n ALL: 2\n};","/**\r\n * Returns the object type of the given payload\r\n *\r\n * @param {*} payload\r\n * @returns {string}\r\n */\r\nfunction getType(payload) {\r\n return Object.prototype.toString.call(payload).slice(8, -1);\r\n}\r\n/**\r\n * Returns whether the payload is undefined\r\n *\r\n * @param {*} payload\r\n * @returns {payload is undefined}\r\n */\r\nfunction isUndefined(payload) {\r\n return getType(payload) === 'Undefined';\r\n}\r\n/**\r\n * Returns whether the payload is null\r\n *\r\n * @param {*} payload\r\n * @returns {payload is null}\r\n */\r\nfunction isNull(payload) {\r\n return getType(payload) === 'Null';\r\n}\r\n/**\r\n * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is PlainObject}\r\n */\r\nfunction isPlainObject(payload) {\r\n if (getType(payload) !== 'Object')\r\n return false;\r\n return payload.constructor === Object && Object.getPrototypeOf(payload) === Object.prototype;\r\n}\r\n/**\r\n * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is PlainObject}\r\n */\r\nfunction isObject(payload) {\r\n return isPlainObject(payload);\r\n}\r\n/**\r\n * Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is { [K in any]: never }}\r\n */\r\nfunction isEmptyObject(payload) {\r\n return isPlainObject(payload) && Object.keys(payload).length === 0;\r\n}\r\n/**\r\n * Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is PlainObject}\r\n */\r\nfunction isFullObject(payload) {\r\n return isPlainObject(payload) && Object.keys(payload).length > 0;\r\n}\r\n/**\r\n * Returns whether the payload is an any kind of object (including special classes or objects with different prototypes)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is PlainObject}\r\n */\r\nfunction isAnyObject(payload) {\r\n return getType(payload) === 'Object';\r\n}\r\n/**\r\n * Returns whether the payload is an object like a type passed in < >\r\n *\r\n * Usage: isObjectLike<{id: any}>(payload) // will make sure it's an object and has an `id` prop.\r\n *\r\n * @template T this must be passed in < >\r\n * @param {*} payload\r\n * @returns {payload is T}\r\n */\r\nfunction isObjectLike(payload) {\r\n return isAnyObject(payload);\r\n}\r\n/**\r\n * Returns whether the payload is a function (regular or async)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is AnyFunction}\r\n */\r\nfunction isFunction(payload) {\r\n return typeof payload === 'function';\r\n}\r\n/**\r\n * Returns whether the payload is an array\r\n *\r\n * @param {any} payload\r\n * @returns {payload is any[]}\r\n */\r\nfunction isArray(payload) {\r\n return getType(payload) === 'Array';\r\n}\r\n/**\r\n * Returns whether the payload is a an array with at least 1 item\r\n *\r\n * @param {*} payload\r\n * @returns {payload is any[]}\r\n */\r\nfunction isFullArray(payload) {\r\n return isArray(payload) && payload.length > 0;\r\n}\r\n/**\r\n * Returns whether the payload is a an empty array\r\n *\r\n * @param {*} payload\r\n * @returns {payload is []}\r\n */\r\nfunction isEmptyArray(payload) {\r\n return isArray(payload) && payload.length === 0;\r\n}\r\n/**\r\n * Returns whether the payload is a string\r\n *\r\n * @param {*} payload\r\n * @returns {payload is string}\r\n */\r\nfunction isString(payload) {\r\n return getType(payload) === 'String';\r\n}\r\n/**\r\n * Returns whether the payload is a string, BUT returns false for ''\r\n *\r\n * @param {*} payload\r\n * @returns {payload is string}\r\n */\r\nfunction isFullString(payload) {\r\n return isString(payload) && payload !== '';\r\n}\r\n/**\r\n * Returns whether the payload is ''\r\n *\r\n * @param {*} payload\r\n * @returns {payload is string}\r\n */\r\nfunction isEmptyString(payload) {\r\n return payload === '';\r\n}\r\n/**\r\n * Returns whether the payload is a number (but not NaN)\r\n *\r\n * This will return `false` for `NaN`!!\r\n *\r\n * @param {*} payload\r\n * @returns {payload is number}\r\n */\r\nfunction isNumber(payload) {\r\n return getType(payload) === 'Number' && !isNaN(payload);\r\n}\r\n/**\r\n * Returns whether the payload is a boolean\r\n *\r\n * @param {*} payload\r\n * @returns {payload is boolean}\r\n */\r\nfunction isBoolean(payload) {\r\n return getType(payload) === 'Boolean';\r\n}\r\n/**\r\n * Returns whether the payload is a regular expression (RegExp)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is RegExp}\r\n */\r\nfunction isRegExp(payload) {\r\n return getType(payload) === 'RegExp';\r\n}\r\n/**\r\n * Returns whether the payload is a Map\r\n *\r\n * @param {*} payload\r\n * @returns {payload is Map}\r\n */\r\nfunction isMap(payload) {\r\n return getType(payload) === 'Map';\r\n}\r\n/**\r\n * Returns whether the payload is a WeakMap\r\n *\r\n * @param {*} payload\r\n * @returns {payload is WeakMap}\r\n */\r\nfunction isWeakMap(payload) {\r\n return getType(payload) === 'WeakMap';\r\n}\r\n/**\r\n * Returns whether the payload is a Set\r\n *\r\n * @param {*} payload\r\n * @returns {payload is Set}\r\n */\r\nfunction isSet(payload) {\r\n return getType(payload) === 'Set';\r\n}\r\n/**\r\n * Returns whether the payload is a WeakSet\r\n *\r\n * @param {*} payload\r\n * @returns {payload is WeakSet}\r\n */\r\nfunction isWeakSet(payload) {\r\n return getType(payload) === 'WeakSet';\r\n}\r\n/**\r\n * Returns whether the payload is a Symbol\r\n *\r\n * @param {*} payload\r\n * @returns {payload is symbol}\r\n */\r\nfunction isSymbol(payload) {\r\n return getType(payload) === 'Symbol';\r\n}\r\n/**\r\n * Returns whether the payload is a Date, and that the date is valid\r\n *\r\n * @param {*} payload\r\n * @returns {payload is Date}\r\n */\r\nfunction isDate(payload) {\r\n return getType(payload) === 'Date' && !isNaN(payload);\r\n}\r\n/**\r\n * Returns whether the payload is a Blob\r\n *\r\n * @param {*} payload\r\n * @returns {payload is Blob}\r\n */\r\nfunction isBlob(payload) {\r\n return getType(payload) === 'Blob';\r\n}\r\n/**\r\n * Returns whether the payload is a File\r\n *\r\n * @param {*} payload\r\n * @returns {payload is File}\r\n */\r\nfunction isFile(payload) {\r\n return getType(payload) === 'File';\r\n}\r\n/**\r\n * Returns whether the payload is a Promise\r\n *\r\n * @param {*} payload\r\n * @returns {payload is Promise}\r\n */\r\nfunction isPromise(payload) {\r\n return getType(payload) === 'Promise';\r\n}\r\n/**\r\n * Returns whether the payload is an Error\r\n *\r\n * @param {*} payload\r\n * @returns {payload is Error}\r\n */\r\nfunction isError(payload) {\r\n return getType(payload) === 'Error';\r\n}\r\n/**\r\n * Returns whether the payload is literally the value `NaN` (it's `NaN` and also a `number`)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is typeof NaN}\r\n */\r\nfunction isNaNValue(payload) {\r\n return getType(payload) === 'Number' && isNaN(payload);\r\n}\r\n/**\r\n * Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol)\r\n *\r\n * @param {*} payload\r\n * @returns {(payload is boolean | null | undefined | number | string | symbol)}\r\n */\r\nfunction isPrimitive(payload) {\r\n return (isBoolean(payload) ||\r\n isNull(payload) ||\r\n isUndefined(payload) ||\r\n isNumber(payload) ||\r\n isString(payload) ||\r\n isSymbol(payload));\r\n}\r\n/**\r\n * Returns true whether the payload is null or undefined\r\n *\r\n * @param {*} payload\r\n * @returns {(payload is null | undefined)}\r\n */\r\nvar isNullOrUndefined = isOneOf(isNull, isUndefined);\r\nfunction isOneOf(a, b, c, d, e) {\r\n return function (value) {\r\n return a(value) || b(value) || (!!c && c(value)) || (!!d && d(value)) || (!!e && e(value));\r\n };\r\n}\r\n/**\r\n * Does a generic check to check that the given payload is of a given type.\r\n * In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!);\r\n * It will, however, differentiate between object and null\r\n *\r\n * @template T\r\n * @param {*} payload\r\n * @param {T} type\r\n * @throws {TypeError} Will throw type error if type is an invalid type\r\n * @returns {payload is T}\r\n */\r\nfunction isType(payload, type) {\r\n if (!(type instanceof Function)) {\r\n throw new TypeError('Type must be a function');\r\n }\r\n if (!Object.prototype.hasOwnProperty.call(type, 'prototype')) {\r\n throw new TypeError('Type is not a class');\r\n }\r\n // Classes usually have names (as functions usually have names)\r\n var name = type.name;\r\n return getType(payload) === name || Boolean(payload && payload.constructor === type);\r\n}\n\nexport { getType, isAnyObject, isArray, isBlob, isBoolean, isDate, isEmptyArray, isEmptyObject, isEmptyString, isError, isFile, isFullArray, isFullObject, isFullString, isFunction, isMap, isNaNValue, isNull, isNullOrUndefined, isNumber, isObject, isObjectLike, isOneOf, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isType, isUndefined, isWeakMap, isWeakSet };\n","import { isArray, isPlainObject } from 'is-what';\n\nfunction assignProp(carry, key, newVal, originalObject, includeNonenumerable) {\r\n const propType = {}.propertyIsEnumerable.call(originalObject, key)\r\n ? 'enumerable'\r\n : 'nonenumerable';\r\n if (propType === 'enumerable')\r\n carry[key] = newVal;\r\n if (includeNonenumerable && propType === 'nonenumerable') {\r\n Object.defineProperty(carry, key, {\r\n value: newVal,\r\n enumerable: false,\r\n writable: true,\r\n configurable: true,\r\n });\r\n }\r\n}\r\n/**\r\n * Copy (clone) an object and all its props recursively to get rid of any prop referenced of the original object. Arrays are also cloned, however objects inside arrays are still linked.\r\n *\r\n * @export\r\n * @template T\r\n * @param {T} target Target can be anything\r\n * @param {Options} [options = {}] Options can be `props` or `nonenumerable`\r\n * @returns {T} the target with replaced values\r\n * @export\r\n */\r\nfunction copy(target, options = {}) {\r\n if (isArray(target)) {\r\n return target.map((item) => copy(item, options));\r\n }\r\n if (!isPlainObject(target)) {\r\n return target;\r\n }\r\n const props = Object.getOwnPropertyNames(target);\r\n const symbols = Object.getOwnPropertySymbols(target);\r\n return [...props, ...symbols].reduce((carry, key) => {\r\n if (isArray(options.props) && !options.props.includes(key)) {\r\n return carry;\r\n }\r\n const val = target[key];\r\n const newVal = copy(val, options);\r\n assignProp(carry, key, newVal, target, options.nonenumerable);\r\n return carry;\r\n }, {});\r\n}\n\nexport { copy };\n","/* jshint proto: true */\nimport * as Constants from './constants';\nimport { copy } from 'copy-anything';\n\nexport function getLocation(index, inputStream) {\n let n = index + 1;\n let line = null;\n let column = -1;\n\n while (--n >= 0 && inputStream.charAt(n) !== '\\n') {\n column++;\n }\n\n if (typeof index === 'number') {\n line = (inputStream.slice(0, index).match(/\\n/g) || '').length;\n }\n\n return {\n line,\n column\n };\n}\n\nexport function copyArray(arr) {\n let i;\n const length = arr.length;\n const copy = new Array(length);\n\n for (i = 0; i < length; i++) {\n copy[i] = arr[i];\n }\n return copy;\n}\n\nexport function clone(obj) {\n const cloned = {};\n for (const prop in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, prop)) {\n cloned[prop] = obj[prop];\n }\n }\n return cloned;\n}\n\nexport function defaults(obj1, obj2) {\n let newObj = obj2 || {};\n if (!obj2._defaults) {\n newObj = {};\n const defaults = copy(obj1);\n newObj._defaults = defaults;\n const cloned = obj2 ? copy(obj2) : {};\n Object.assign(newObj, defaults, cloned);\n }\n return newObj;\n}\n\nexport function copyOptions(obj1, obj2) {\n if (obj2 && obj2._defaults) {\n return obj2;\n }\n const opts = defaults(obj1, obj2);\n if (opts.strictMath) {\n opts.math = Constants.Math.PARENS;\n }\n // Back compat with changed relativeUrls option\n if (opts.relativeUrls) {\n opts.rewriteUrls = Constants.RewriteUrls.ALL;\n }\n if (typeof opts.math === 'string') {\n switch (opts.math.toLowerCase()) {\n case 'always':\n opts.math = Constants.Math.ALWAYS;\n break;\n case 'parens-division':\n opts.math = Constants.Math.PARENS_DIVISION;\n break;\n case 'strict':\n case 'parens':\n opts.math = Constants.Math.PARENS;\n break;\n default:\n opts.math = Constants.Math.PARENS;\n }\n }\n if (typeof opts.rewriteUrls === 'string') {\n switch (opts.rewriteUrls.toLowerCase()) {\n case 'off':\n opts.rewriteUrls = Constants.RewriteUrls.OFF;\n break;\n case 'local':\n opts.rewriteUrls = Constants.RewriteUrls.LOCAL;\n break;\n case 'all':\n opts.rewriteUrls = Constants.RewriteUrls.ALL;\n break;\n }\n }\n return opts;\n}\n\nexport function merge(obj1, obj2) {\n for (const prop in obj2) {\n if (Object.prototype.hasOwnProperty.call(obj2, prop)) {\n obj1[prop] = obj2[prop];\n }\n }\n return obj1;\n}\n\nexport function flattenArray(arr, result = []) {\n for (let i = 0, length = arr.length; i < length; i++) {\n const value = arr[i];\n if (Array.isArray(value)) {\n flattenArray(value, result);\n } else {\n if (value !== undefined) {\n result.push(value);\n }\n }\n }\n return result;\n}\n\nexport function isNullOrUndefined(val) {\n return val === null || val === undefined\n}","import * as utils from './utils';\n\nconst anonymousFunc = /(|Function):(\\d+):(\\d+)/;\n\n/**\n * This is a centralized class of any error that could be thrown internally (mostly by the parser).\n * Besides standard .message it keeps some additional data like a path to the file where the error\n * occurred along with line and column numbers.\n *\n * @class\n * @extends Error\n * @type {module.LessError}\n *\n * @prop {string} type\n * @prop {string} filename\n * @prop {number} index\n * @prop {number} line\n * @prop {number} column\n * @prop {number} callLine\n * @prop {number} callExtract\n * @prop {string[]} extract\n *\n * @param {Object} e - An error object to wrap around or just a descriptive object\n * @param {Object} fileContentMap - An object with file contents in 'contents' property (like importManager) @todo - move to fileManager?\n * @param {string} [currentFilename]\n */\nconst LessError = function(e, fileContentMap, currentFilename) {\n Error.call(this);\n\n const filename = e.filename || currentFilename;\n\n this.message = e.message;\n this.stack = e.stack;\n\n if (fileContentMap && filename) {\n const input = fileContentMap.contents[filename];\n const loc = utils.getLocation(e.index, input);\n var line = loc.line;\n const col = loc.column;\n const callLine = e.call && utils.getLocation(e.call, input).line;\n const lines = input ? input.split('\\n') : '';\n\n this.type = e.type || 'Syntax';\n this.filename = filename;\n this.index = e.index;\n this.line = typeof line === 'number' ? line + 1 : null;\n this.column = col;\n\n if (!this.line && this.stack) {\n const found = this.stack.match(anonymousFunc);\n\n /**\n * We have to figure out how this environment stringifies anonymous functions\n * so we can correctly map plugin errors.\n * \n * Note, in Node 8, the output of anonymous funcs varied based on parameters\n * being present or not, so we inject dummy params.\n */\n const func = new Function('a', 'throw new Error()');\n let lineAdjust = 0;\n try {\n func();\n } catch (e) {\n const match = e.stack.match(anonymousFunc);\n lineAdjust = 1 - parseInt(match[2]);\n }\n\n if (found) {\n if (found[2]) {\n this.line = parseInt(found[2]) + lineAdjust;\n }\n if (found[3]) {\n this.column = parseInt(found[3]);\n }\n }\n }\n\n this.callLine = callLine + 1;\n this.callExtract = lines[callLine];\n\n this.extract = [\n lines[this.line - 2],\n lines[this.line - 1],\n lines[this.line]\n ];\n }\n\n};\n\nif (typeof Object.create === 'undefined') {\n const F = function () {};\n F.prototype = Error.prototype;\n LessError.prototype = new F();\n} else {\n LessError.prototype = Object.create(Error.prototype);\n}\n\nLessError.prototype.constructor = LessError;\n\n/**\n * An overridden version of the default Object.prototype.toString\n * which uses additional information to create a helpful message.\n *\n * @param {Object} options\n * @returns {string}\n */\nLessError.prototype.toString = function(options) {\n options = options || {};\n const isWarning = (this.type ?? '').toLowerCase().includes('warning');\n const type = isWarning ? this.type : `${this.type}Error`;\n const color = isWarning ? 'yellow' : 'red';\n\n let message = '';\n const extract = this.extract || [];\n let error = [];\n let stylize = function (str) { return str; };\n if (options.stylize) {\n const type = typeof options.stylize;\n if (type !== 'function') {\n throw Error(`options.stylize should be a function, got a ${type}!`);\n }\n stylize = options.stylize;\n }\n\n if (this.line !== null) {\n if (!isWarning && typeof extract[0] === 'string') {\n error.push(stylize(`${this.line - 1} ${extract[0]}`, 'grey'));\n }\n\n if (typeof extract[1] === 'string') {\n let errorTxt = `${this.line} `;\n if (extract[1]) {\n errorTxt += extract[1].slice(0, this.column) +\n stylize(stylize(stylize(extract[1].substr(this.column, 1), 'bold') +\n extract[1].slice(this.column + 1), 'red'), 'inverse');\n }\n error.push(errorTxt);\n }\n\n if (!isWarning && typeof extract[2] === 'string') {\n error.push(stylize(`${this.line + 1} ${extract[2]}`, 'grey'));\n }\n error = `${error.join('\\n') + stylize('', 'reset')}\\n`;\n }\n\n message += stylize(`${type}: ${this.message}`, color);\n if (this.filename) {\n message += stylize(' in ', color) + this.filename;\n }\n if (this.line) {\n message += stylize(` on line ${this.line}, column ${this.column + 1}:`, 'grey');\n }\n\n message += `\\n${error}`;\n\n if (this.callLine) {\n message += `${stylize('from ', color) + (this.filename || '')}/n`;\n message += `${stylize(this.callLine, 'grey')} ${this.callExtract}/n`;\n }\n\n return message;\n};\n\nexport default LessError;","import tree from '../tree';\n\nconst _visitArgs = { visitDeeper: true };\nlet _hasIndexed = false;\n\nfunction _noop(node) {\n return node;\n}\n\nfunction indexNodeTypes(parent, ticker) {\n // add .typeIndex to tree node types for lookup table\n let key, child;\n for (key in parent) { \n /* eslint guard-for-in: 0 */\n child = parent[key];\n switch (typeof child) {\n case 'function':\n // ignore bound functions directly on tree which do not have a prototype\n // or aren't nodes\n if (child.prototype && child.prototype.type) {\n child.prototype.typeIndex = ticker++;\n }\n break;\n case 'object':\n ticker = indexNodeTypes(child, ticker);\n break;\n \n }\n }\n return ticker;\n}\n\nclass Visitor {\n constructor(implementation) {\n this._implementation = implementation;\n this._visitInCache = {};\n this._visitOutCache = {};\n\n if (!_hasIndexed) {\n indexNodeTypes(tree, 1);\n _hasIndexed = true;\n }\n }\n\n visit(node) {\n if (!node) {\n return node;\n }\n\n const nodeTypeIndex = node.typeIndex;\n if (!nodeTypeIndex) {\n // MixinCall args aren't a node type?\n if (node.value && node.value.typeIndex) {\n this.visit(node.value);\n }\n return node;\n }\n\n const impl = this._implementation;\n let func = this._visitInCache[nodeTypeIndex];\n let funcOut = this._visitOutCache[nodeTypeIndex];\n const visitArgs = _visitArgs;\n let fnName;\n\n visitArgs.visitDeeper = true;\n\n if (!func) {\n fnName = `visit${node.type}`;\n func = impl[fnName] || _noop;\n funcOut = impl[`${fnName}Out`] || _noop;\n this._visitInCache[nodeTypeIndex] = func;\n this._visitOutCache[nodeTypeIndex] = funcOut;\n }\n\n if (func !== _noop) {\n const newNode = func.call(impl, node, visitArgs);\n if (node && impl.isReplacing) {\n node = newNode;\n }\n }\n\n if (visitArgs.visitDeeper && node) {\n if (node.length) {\n for (let i = 0, cnt = node.length; i < cnt; i++) {\n if (node[i].accept) {\n node[i].accept(this);\n }\n }\n } else if (node.accept) {\n node.accept(this);\n }\n }\n\n if (funcOut != _noop) {\n funcOut.call(impl, node);\n }\n\n return node;\n }\n\n visitArray(nodes, nonReplacing) {\n if (!nodes) {\n return nodes;\n }\n\n const cnt = nodes.length;\n let i;\n\n // Non-replacing\n if (nonReplacing || !this._implementation.isReplacing) {\n for (i = 0; i < cnt; i++) {\n this.visit(nodes[i]);\n }\n return nodes;\n }\n\n // Replacing\n const out = [];\n for (i = 0; i < cnt; i++) {\n const evald = this.visit(nodes[i]);\n if (evald === undefined) { continue; }\n if (!evald.splice) {\n out.push(evald);\n } else if (evald.length) {\n this.flatten(evald, out);\n }\n }\n return out;\n }\n\n flatten(arr, out) {\n if (!out) {\n out = [];\n }\n\n let cnt, i, item, nestedCnt, j, nestedItem;\n\n for (i = 0, cnt = arr.length; i < cnt; i++) {\n item = arr[i];\n if (item === undefined) {\n continue;\n }\n if (!item.splice) {\n out.push(item);\n continue;\n }\n\n for (j = 0, nestedCnt = item.length; j < nestedCnt; j++) {\n nestedItem = item[j];\n if (nestedItem === undefined) {\n continue;\n }\n if (!nestedItem.splice) {\n out.push(nestedItem);\n } else if (nestedItem.length) {\n this.flatten(nestedItem, out);\n }\n }\n }\n\n return out;\n }\n}\n\nexport default Visitor;\n","const contexts = {};\nexport default contexts;\nimport * as Constants from './constants';\n\nconst copyFromOriginal = function copyFromOriginal(original, destination, propertiesToCopy) {\n if (!original) { return; }\n\n for (let i = 0; i < propertiesToCopy.length; i++) {\n if (Object.prototype.hasOwnProperty.call(original, propertiesToCopy[i])) {\n destination[propertiesToCopy[i]] = original[propertiesToCopy[i]];\n }\n }\n};\n\n/*\n parse is used whilst parsing\n */\nconst parseCopyProperties = [\n // options\n 'paths', // option - unmodified - paths to search for imports on\n 'rewriteUrls', // option - whether to adjust URL's to be relative\n 'rootpath', // option - rootpath to append to URL's\n 'strictImports', // option -\n 'insecure', // option - whether to allow imports from insecure ssl hosts\n 'dumpLineNumbers', // option - whether to dump line numbers\n 'compress', // option - whether to compress\n 'syncImport', // option - whether to import synchronously\n 'chunkInput', // option - whether to chunk input. more performant but causes parse issues.\n 'mime', // browser only - mime type for sheet import\n 'useFileCache', // browser only - whether to use the per file session cache\n // context\n 'processImports', // option & context - whether to process imports. if false then imports will not be imported.\n // Used by the import manager to stop multiple import visitors being created.\n 'pluginManager', // Used as the plugin manager for the session\n 'quiet', // option - whether to log warnings\n];\n\ncontexts.Parse = function(options) {\n copyFromOriginal(options, this, parseCopyProperties);\n\n if (typeof this.paths === 'string') { this.paths = [this.paths]; }\n};\n\nconst evalCopyProperties = [\n 'paths', // additional include paths\n 'compress', // whether to compress\n 'math', // whether math has to be within parenthesis\n 'strictUnits', // whether units need to evaluate correctly\n 'sourceMap', // whether to output a source map\n 'importMultiple', // whether we are currently importing multiple copies\n 'urlArgs', // whether to add args into url tokens\n 'javascriptEnabled', // option - whether Inline JavaScript is enabled. if undefined, defaults to false\n 'pluginManager', // Used as the plugin manager for the session\n 'importantScope', // used to bubble up !important statements\n 'rewriteUrls' // option - whether to adjust URL's to be relative\n];\n\ncontexts.Eval = function(options, frames) {\n copyFromOriginal(options, this, evalCopyProperties);\n\n if (typeof this.paths === 'string') { this.paths = [this.paths]; }\n\n this.frames = frames || [];\n this.importantScope = this.importantScope || [];\n};\n\ncontexts.Eval.prototype.enterCalc = function () {\n if (!this.calcStack) {\n this.calcStack = [];\n }\n this.calcStack.push(true);\n this.inCalc = true;\n};\n\ncontexts.Eval.prototype.exitCalc = function () {\n this.calcStack.pop();\n if (!this.calcStack.length) {\n this.inCalc = false;\n }\n};\n\ncontexts.Eval.prototype.inParenthesis = function () {\n if (!this.parensStack) {\n this.parensStack = [];\n }\n this.parensStack.push(true);\n};\n\ncontexts.Eval.prototype.outOfParenthesis = function () {\n this.parensStack.pop();\n};\n\ncontexts.Eval.prototype.inCalc = false;\ncontexts.Eval.prototype.mathOn = true;\ncontexts.Eval.prototype.isMathOn = function (op) {\n if (!this.mathOn) {\n return false;\n }\n if (op === '/' && this.math !== Constants.Math.ALWAYS && (!this.parensStack || !this.parensStack.length)) {\n return false;\n }\n if (this.math > Constants.Math.PARENS_DIVISION) {\n return this.parensStack && this.parensStack.length;\n }\n return true;\n};\n\ncontexts.Eval.prototype.pathRequiresRewrite = function (path) {\n const isRelative = this.rewriteUrls === Constants.RewriteUrls.LOCAL ? isPathLocalRelative : isPathRelative;\n\n return isRelative(path);\n};\n\ncontexts.Eval.prototype.rewritePath = function (path, rootpath) {\n let newPath;\n\n rootpath = rootpath || '';\n newPath = this.normalizePath(rootpath + path);\n\n // If a path was explicit relative and the rootpath was not an absolute path\n // we must ensure that the new path is also explicit relative.\n if (isPathLocalRelative(path) &&\n isPathRelative(rootpath) &&\n isPathLocalRelative(newPath) === false) {\n newPath = `./${newPath}`;\n }\n\n return newPath;\n};\n\ncontexts.Eval.prototype.normalizePath = function (path) {\n const segments = path.split('/').reverse();\n let segment;\n\n path = [];\n while (segments.length !== 0) {\n segment = segments.pop();\n switch ( segment ) {\n case '.':\n break;\n case '..':\n if ((path.length === 0) || (path[path.length - 1] === '..')) {\n path.push( segment );\n } else {\n path.pop();\n }\n break;\n default:\n path.push(segment);\n break;\n }\n }\n\n return path.join('/');\n};\n\nfunction isPathRelative(path) {\n return !/^(?:[a-z-]+:|\\/|#)/i.test(path);\n}\n\nfunction isPathLocalRelative(path) {\n return path.charAt(0) === '.';\n}\n\n// todo - do the same for the toCSS ?\n","class ImportSequencer {\n constructor(onSequencerEmpty) {\n this.imports = [];\n this.variableImports = [];\n this._onSequencerEmpty = onSequencerEmpty;\n this._currentDepth = 0;\n }\n\n addImport(callback) {\n const importSequencer = this,\n importItem = {\n callback,\n args: null,\n isReady: false\n };\n this.imports.push(importItem);\n return function() {\n importItem.args = Array.prototype.slice.call(arguments, 0);\n importItem.isReady = true;\n importSequencer.tryRun();\n };\n }\n\n addVariableImport(callback) {\n this.variableImports.push(callback);\n }\n\n tryRun() {\n this._currentDepth++;\n try {\n while (true) {\n while (this.imports.length > 0) {\n const importItem = this.imports[0];\n if (!importItem.isReady) {\n return;\n }\n this.imports = this.imports.slice(1);\n importItem.callback.apply(null, importItem.args);\n }\n if (this.variableImports.length === 0) {\n break;\n }\n const variableImport = this.variableImports[0];\n this.variableImports = this.variableImports.slice(1);\n variableImport();\n }\n } finally {\n this._currentDepth--;\n }\n if (this._currentDepth === 0 && this._onSequencerEmpty) {\n this._onSequencerEmpty();\n }\n }\n}\n\nexport default ImportSequencer;\n","/* eslint-disable no-unused-vars */\n/**\n * @todo - Remove unused when JSDoc types are added for visitor methods\n */\nimport contexts from '../contexts';\nimport Visitor from './visitor';\nimport ImportSequencer from './import-sequencer';\nimport * as utils from '../utils';\n\nconst ImportVisitor = function(importer, finish) {\n\n this._visitor = new Visitor(this);\n this._importer = importer;\n this._finish = finish;\n this.context = new contexts.Eval();\n this.importCount = 0;\n this.onceFileDetectionMap = {};\n this.recursionDetector = {};\n this._sequencer = new ImportSequencer(this._onSequencerEmpty.bind(this));\n};\n\nImportVisitor.prototype = {\n isReplacing: false,\n run: function (root) {\n try {\n // process the contents\n this._visitor.visit(root);\n }\n catch (e) {\n this.error = e;\n }\n\n this.isFinished = true;\n this._sequencer.tryRun();\n },\n _onSequencerEmpty: function() {\n if (!this.isFinished) {\n return;\n }\n this._finish(this.error);\n },\n visitImport: function (importNode, visitArgs) {\n const inlineCSS = importNode.options.inline;\n\n if (!importNode.css || inlineCSS) {\n\n const context = new contexts.Eval(this.context, utils.copyArray(this.context.frames));\n const importParent = context.frames[0];\n\n this.importCount++;\n if (importNode.isVariableImport()) {\n this._sequencer.addVariableImport(this.processImportNode.bind(this, importNode, context, importParent));\n } else {\n this.processImportNode(importNode, context, importParent);\n }\n }\n visitArgs.visitDeeper = false;\n },\n processImportNode: function(importNode, context, importParent) {\n let evaldImportNode;\n const inlineCSS = importNode.options.inline;\n\n try {\n evaldImportNode = importNode.evalForImport(context);\n } catch (e) {\n if (!e.filename) { e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename; }\n // attempt to eval properly and treat as css\n importNode.css = true;\n // if that fails, this error will be thrown\n importNode.error = e;\n }\n\n if (evaldImportNode && (!evaldImportNode.css || inlineCSS)) {\n\n if (evaldImportNode.options.multiple) {\n context.importMultiple = true;\n }\n\n // try appending if we haven't determined if it is css or not\n const tryAppendLessExtension = evaldImportNode.css === undefined;\n\n for (let i = 0; i < importParent.rules.length; i++) {\n if (importParent.rules[i] === importNode) {\n importParent.rules[i] = evaldImportNode;\n break;\n }\n }\n\n const onImported = this.onImported.bind(this, evaldImportNode, context), sequencedOnImported = this._sequencer.addImport(onImported);\n\n this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.fileInfo(),\n evaldImportNode.options, sequencedOnImported);\n } else {\n this.importCount--;\n if (this.isFinished) {\n this._sequencer.tryRun();\n }\n }\n },\n onImported: function (importNode, context, e, root, importedAtRoot, fullPath) {\n if (e) {\n if (!e.filename) {\n e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename;\n }\n this.error = e;\n }\n\n const importVisitor = this,\n inlineCSS = importNode.options.inline,\n isPlugin = importNode.options.isPlugin,\n isOptional = importNode.options.optional,\n duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector;\n\n if (!context.importMultiple) {\n if (duplicateImport) {\n importNode.skip = true;\n } else {\n importNode.skip = function() {\n if (fullPath in importVisitor.onceFileDetectionMap) {\n return true;\n }\n importVisitor.onceFileDetectionMap[fullPath] = true;\n return false;\n };\n }\n }\n\n if (!fullPath && isOptional) {\n importNode.skip = true;\n }\n\n if (root) {\n importNode.root = root;\n importNode.importedFilename = fullPath;\n\n if (!inlineCSS && !isPlugin && (context.importMultiple || !duplicateImport)) {\n importVisitor.recursionDetector[fullPath] = true;\n\n const oldContext = this.context;\n this.context = context;\n try {\n this._visitor.visit(root);\n } catch (e) {\n this.error = e;\n }\n this.context = oldContext;\n }\n }\n\n importVisitor.importCount--;\n\n if (importVisitor.isFinished) {\n importVisitor._sequencer.tryRun();\n }\n },\n visitDeclaration: function (declNode, visitArgs) {\n if (declNode.value.type === 'DetachedRuleset') {\n this.context.frames.unshift(declNode);\n } else {\n visitArgs.visitDeeper = false;\n }\n },\n visitDeclarationOut: function(declNode) {\n if (declNode.value.type === 'DetachedRuleset') {\n this.context.frames.shift();\n }\n },\n visitAtRule: function (atRuleNode, visitArgs) {\n if (atRuleNode.value) {\n this.context.frames.unshift(atRuleNode);\n } else if (atRuleNode.declarations && atRuleNode.declarations.length) {\n if (atRuleNode.isRooted) {\n this.context.frames.unshift(atRuleNode);\n } else {\n this.context.frames.unshift(atRuleNode.declarations[0]);\n }\n } else if (atRuleNode.rules && atRuleNode.rules.length) {\n this.context.frames.unshift(atRuleNode);\n }\n },\n visitAtRuleOut: function (atRuleNode) {\n this.context.frames.shift();\n },\n visitMixinDefinition: function (mixinDefinitionNode, visitArgs) {\n this.context.frames.unshift(mixinDefinitionNode);\n },\n visitMixinDefinitionOut: function (mixinDefinitionNode) {\n this.context.frames.shift();\n },\n visitRuleset: function (rulesetNode, visitArgs) {\n this.context.frames.unshift(rulesetNode);\n },\n visitRulesetOut: function (rulesetNode) {\n this.context.frames.shift();\n },\n visitMedia: function (mediaNode, visitArgs) {\n this.context.frames.unshift(mediaNode.rules[0]);\n },\n visitMediaOut: function (mediaNode) {\n this.context.frames.shift();\n }\n};\nexport default ImportVisitor;\n","class SetTreeVisibilityVisitor {\n constructor(visible) {\n this.visible = visible;\n }\n\n run(root) {\n this.visit(root);\n }\n\n visitArray(nodes) {\n if (!nodes) {\n return nodes;\n }\n\n const cnt = nodes.length;\n let i;\n for (i = 0; i < cnt; i++) {\n this.visit(nodes[i]);\n }\n return nodes;\n }\n\n visit(node) {\n if (!node) {\n return node;\n }\n if (node.constructor === Array) {\n return this.visitArray(node);\n }\n\n if (!node.blocksVisibility || node.blocksVisibility()) {\n return node;\n }\n if (this.visible) {\n node.ensureVisibility();\n } else {\n node.ensureInvisibility();\n }\n\n node.accept(this);\n return node;\n }\n}\n\nexport default SetTreeVisibilityVisitor;","/* eslint-disable no-unused-vars */\n/**\n * @todo - Remove unused when JSDoc types are added for visitor methods\n */\nimport tree from '../tree';\nimport Visitor from './visitor';\nimport logger from '../logger';\nimport * as utils from '../utils';\n\n/* jshint loopfunc:true */\n\nclass ExtendFinderVisitor {\n constructor() {\n this._visitor = new Visitor(this);\n this.contexts = [];\n this.allExtendsStack = [[]];\n }\n\n run(root) {\n root = this._visitor.visit(root);\n root.allExtends = this.allExtendsStack[0];\n return root;\n }\n\n visitDeclaration(declNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitMixinDefinition(mixinDefinitionNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitRuleset(rulesetNode, visitArgs) {\n if (rulesetNode.root) {\n return;\n }\n\n let i;\n let j;\n let extend;\n const allSelectorsExtendList = [];\n let extendList;\n\n // get &:extend(.a); rules which apply to all selectors in this ruleset\n const rules = rulesetNode.rules, ruleCnt = rules ? rules.length : 0;\n for (i = 0; i < ruleCnt; i++) {\n if (rulesetNode.rules[i] instanceof tree.Extend) {\n allSelectorsExtendList.push(rules[i]);\n rulesetNode.extendOnEveryPath = true;\n }\n }\n\n // now find every selector and apply the extends that apply to all extends\n // and the ones which apply to an individual extend\n const paths = rulesetNode.paths;\n for (i = 0; i < paths.length; i++) {\n const selectorPath = paths[i], selector = selectorPath[selectorPath.length - 1], selExtendList = selector.extendList;\n\n extendList = selExtendList ? utils.copyArray(selExtendList).concat(allSelectorsExtendList)\n : allSelectorsExtendList;\n\n if (extendList) {\n extendList = extendList.map(function(allSelectorsExtend) {\n return allSelectorsExtend.clone();\n });\n }\n\n for (j = 0; j < extendList.length; j++) {\n this.foundExtends = true;\n extend = extendList[j];\n extend.findSelfSelectors(selectorPath);\n extend.ruleset = rulesetNode;\n if (j === 0) { extend.firstExtendOnThisSelectorPath = true; }\n this.allExtendsStack[this.allExtendsStack.length - 1].push(extend);\n }\n }\n\n this.contexts.push(rulesetNode.selectors);\n }\n\n visitRulesetOut(rulesetNode) {\n if (!rulesetNode.root) {\n this.contexts.length = this.contexts.length - 1;\n }\n }\n\n visitMedia(mediaNode, visitArgs) {\n mediaNode.allExtends = [];\n this.allExtendsStack.push(mediaNode.allExtends);\n }\n\n visitMediaOut(mediaNode) {\n this.allExtendsStack.length = this.allExtendsStack.length - 1;\n }\n\n visitAtRule(atRuleNode, visitArgs) {\n atRuleNode.allExtends = [];\n this.allExtendsStack.push(atRuleNode.allExtends);\n }\n\n visitAtRuleOut(atRuleNode) {\n this.allExtendsStack.length = this.allExtendsStack.length - 1;\n }\n}\n\nclass ProcessExtendsVisitor {\n constructor() {\n this._visitor = new Visitor(this);\n }\n\n run(root) {\n const extendFinder = new ExtendFinderVisitor();\n this.extendIndices = {};\n extendFinder.run(root);\n if (!extendFinder.foundExtends) { return root; }\n root.allExtends = root.allExtends.concat(this.doExtendChaining(root.allExtends, root.allExtends));\n this.allExtendsStack = [root.allExtends];\n const newRoot = this._visitor.visit(root);\n this.checkExtendsForNonMatched(root.allExtends);\n return newRoot;\n }\n\n checkExtendsForNonMatched(extendList) {\n const indices = this.extendIndices;\n extendList.filter(function(extend) {\n return !extend.hasFoundMatches && extend.parent_ids.length == 1;\n }).forEach(function(extend) {\n let selector = '_unknown_';\n try {\n selector = extend.selector.toCSS({});\n }\n catch (_) {}\n\n if (!indices[`${extend.index} ${selector}`]) {\n indices[`${extend.index} ${selector}`] = true;\n /**\n * @todo Shouldn't this be an error? To alert the developer\n * that they may have made an error in the selector they are\n * targeting?\n */\n logger.warn(`WARNING: extend '${selector}' has no matches`);\n }\n });\n }\n\n doExtendChaining(extendsList, extendsListTarget, iterationCount) {\n //\n // chaining is different from normal extension.. if we extend an extend then we are not just copying, altering\n // and pasting the selector we would do normally, but we are also adding an extend with the same target selector\n // this means this new extend can then go and alter other extends\n //\n // this method deals with all the chaining work - without it, extend is flat and doesn't work on other extend selectors\n // this is also the most expensive.. and a match on one selector can cause an extension of a selector we had already\n // processed if we look at each selector at a time, as is done in visitRuleset\n\n let extendIndex;\n\n let targetExtendIndex;\n let matches;\n const extendsToAdd = [];\n let newSelector;\n const extendVisitor = this;\n let selectorPath;\n let extend;\n let targetExtend;\n let newExtend;\n\n iterationCount = iterationCount || 0;\n\n // loop through comparing every extend with every target extend.\n // a target extend is the one on the ruleset we are looking at copy/edit/pasting in place\n // e.g. .a:extend(.b) {} and .b:extend(.c) {} then the first extend extends the second one\n // and the second is the target.\n // the separation into two lists allows us to process a subset of chains with a bigger set, as is the\n // case when processing media queries\n for (extendIndex = 0; extendIndex < extendsList.length; extendIndex++) {\n for (targetExtendIndex = 0; targetExtendIndex < extendsListTarget.length; targetExtendIndex++) {\n\n extend = extendsList[extendIndex];\n targetExtend = extendsListTarget[targetExtendIndex];\n\n // look for circular references\n if ( extend.parent_ids.indexOf( targetExtend.object_id ) >= 0 ) { continue; }\n\n // find a match in the target extends self selector (the bit before :extend)\n selectorPath = [targetExtend.selfSelectors[0]];\n matches = extendVisitor.findMatch(extend, selectorPath);\n\n if (matches.length) {\n extend.hasFoundMatches = true;\n\n // we found a match, so for each self selector..\n extend.selfSelectors.forEach(function(selfSelector) {\n const info = targetExtend.visibilityInfo();\n\n // process the extend as usual\n newSelector = extendVisitor.extendSelector(matches, selectorPath, selfSelector, extend.isVisible());\n\n // but now we create a new extend from it\n newExtend = new(tree.Extend)(targetExtend.selector, targetExtend.option, 0, targetExtend.fileInfo(), info);\n newExtend.selfSelectors = newSelector;\n\n // add the extend onto the list of extends for that selector\n newSelector[newSelector.length - 1].extendList = [newExtend];\n\n // record that we need to add it.\n extendsToAdd.push(newExtend);\n newExtend.ruleset = targetExtend.ruleset;\n\n // remember its parents for circular references\n newExtend.parent_ids = newExtend.parent_ids.concat(targetExtend.parent_ids, extend.parent_ids);\n\n // only process the selector once.. if we have :extend(.a,.b) then multiple\n // extends will look at the same selector path, so when extending\n // we know that any others will be duplicates in terms of what is added to the css\n if (targetExtend.firstExtendOnThisSelectorPath) {\n newExtend.firstExtendOnThisSelectorPath = true;\n targetExtend.ruleset.paths.push(newSelector);\n }\n });\n }\n }\n }\n\n if (extendsToAdd.length) {\n // try to detect circular references to stop a stack overflow.\n // may no longer be needed.\n this.extendChainCount++;\n if (iterationCount > 100) {\n let selectorOne = '{unable to calculate}';\n let selectorTwo = '{unable to calculate}';\n try {\n selectorOne = extendsToAdd[0].selfSelectors[0].toCSS();\n selectorTwo = extendsToAdd[0].selector.toCSS();\n }\n catch (e) {}\n throw { message: `extend circular reference detected. One of the circular extends is currently:${selectorOne}:extend(${selectorTwo})`};\n }\n\n // now process the new extends on the existing rules so that we can handle a extending b extending c extending\n // d extending e...\n return extendsToAdd.concat(extendVisitor.doExtendChaining(extendsToAdd, extendsListTarget, iterationCount + 1));\n } else {\n return extendsToAdd;\n }\n }\n\n visitDeclaration(ruleNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitMixinDefinition(mixinDefinitionNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitSelector(selectorNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitRuleset(rulesetNode, visitArgs) {\n if (rulesetNode.root) {\n return;\n }\n let matches;\n let pathIndex;\n let extendIndex;\n const allExtends = this.allExtendsStack[this.allExtendsStack.length - 1];\n const selectorsToAdd = [];\n const extendVisitor = this;\n let selectorPath;\n\n // look at each selector path in the ruleset, find any extend matches and then copy, find and replace\n\n for (extendIndex = 0; extendIndex < allExtends.length; extendIndex++) {\n for (pathIndex = 0; pathIndex < rulesetNode.paths.length; pathIndex++) {\n selectorPath = rulesetNode.paths[pathIndex];\n\n // extending extends happens initially, before the main pass\n if (rulesetNode.extendOnEveryPath) { continue; }\n const extendList = selectorPath[selectorPath.length - 1].extendList;\n if (extendList && extendList.length) { continue; }\n\n matches = this.findMatch(allExtends[extendIndex], selectorPath);\n\n if (matches.length) {\n allExtends[extendIndex].hasFoundMatches = true;\n\n allExtends[extendIndex].selfSelectors.forEach(function(selfSelector) {\n let extendedSelectors;\n extendedSelectors = extendVisitor.extendSelector(matches, selectorPath, selfSelector, allExtends[extendIndex].isVisible());\n selectorsToAdd.push(extendedSelectors);\n });\n }\n }\n }\n rulesetNode.paths = rulesetNode.paths.concat(selectorsToAdd);\n }\n\n findMatch(extend, haystackSelectorPath) {\n //\n // look through the haystack selector path to try and find the needle - extend.selector\n // returns an array of selector matches that can then be replaced\n //\n let haystackSelectorIndex;\n\n let hackstackSelector;\n let hackstackElementIndex;\n let haystackElement;\n let targetCombinator;\n let i;\n const extendVisitor = this;\n const needleElements = extend.selector.elements;\n const potentialMatches = [];\n let potentialMatch;\n const matches = [];\n\n // loop through the haystack elements\n for (haystackSelectorIndex = 0; haystackSelectorIndex < haystackSelectorPath.length; haystackSelectorIndex++) {\n hackstackSelector = haystackSelectorPath[haystackSelectorIndex];\n\n for (hackstackElementIndex = 0; hackstackElementIndex < hackstackSelector.elements.length; hackstackElementIndex++) {\n\n haystackElement = hackstackSelector.elements[hackstackElementIndex];\n\n // if we allow elements before our match we can add a potential match every time. otherwise only at the first element.\n if (extend.allowBefore || (haystackSelectorIndex === 0 && hackstackElementIndex === 0)) {\n potentialMatches.push({pathIndex: haystackSelectorIndex, index: hackstackElementIndex, matched: 0,\n initialCombinator: haystackElement.combinator});\n }\n\n for (i = 0; i < potentialMatches.length; i++) {\n potentialMatch = potentialMatches[i];\n\n // selectors add \" \" onto the first element. When we use & it joins the selectors together, but if we don't\n // then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to\n // work out what the resulting combinator will be\n targetCombinator = haystackElement.combinator.value;\n if (targetCombinator === '' && hackstackElementIndex === 0) {\n targetCombinator = ' ';\n }\n\n // if we don't match, null our match to indicate failure\n if (!extendVisitor.isElementValuesEqual(needleElements[potentialMatch.matched].value, haystackElement.value) ||\n (potentialMatch.matched > 0 && needleElements[potentialMatch.matched].combinator.value !== targetCombinator)) {\n potentialMatch = null;\n } else {\n potentialMatch.matched++;\n }\n\n // if we are still valid and have finished, test whether we have elements after and whether these are allowed\n if (potentialMatch) {\n potentialMatch.finished = potentialMatch.matched === needleElements.length;\n if (potentialMatch.finished &&\n (!extend.allowAfter &&\n (hackstackElementIndex + 1 < hackstackSelector.elements.length || haystackSelectorIndex + 1 < haystackSelectorPath.length))) {\n potentialMatch = null;\n }\n }\n // if null we remove, if not, we are still valid, so either push as a valid match or continue\n if (potentialMatch) {\n if (potentialMatch.finished) {\n potentialMatch.length = needleElements.length;\n potentialMatch.endPathIndex = haystackSelectorIndex;\n potentialMatch.endPathElementIndex = hackstackElementIndex + 1; // index after end of match\n potentialMatches.length = 0; // we don't allow matches to overlap, so start matching again\n matches.push(potentialMatch);\n }\n } else {\n potentialMatches.splice(i, 1);\n i--;\n }\n }\n }\n }\n return matches;\n }\n\n isElementValuesEqual(elementValue1, elementValue2) {\n if (typeof elementValue1 === 'string' || typeof elementValue2 === 'string') {\n return elementValue1 === elementValue2;\n }\n if (elementValue1 instanceof tree.Attribute) {\n if (elementValue1.op !== elementValue2.op || elementValue1.key !== elementValue2.key) {\n return false;\n }\n if (!elementValue1.value || !elementValue2.value) {\n if (elementValue1.value || elementValue2.value) {\n return false;\n }\n return true;\n }\n elementValue1 = elementValue1.value.value || elementValue1.value;\n elementValue2 = elementValue2.value.value || elementValue2.value;\n return elementValue1 === elementValue2;\n }\n elementValue1 = elementValue1.value;\n elementValue2 = elementValue2.value;\n if (elementValue1 instanceof tree.Selector) {\n if (!(elementValue2 instanceof tree.Selector) || elementValue1.elements.length !== elementValue2.elements.length) {\n return false;\n }\n for (let i = 0; i < elementValue1.elements.length; i++) {\n if (elementValue1.elements[i].combinator.value !== elementValue2.elements[i].combinator.value) {\n if (i !== 0 || (elementValue1.elements[i].combinator.value || ' ') !== (elementValue2.elements[i].combinator.value || ' ')) {\n return false;\n }\n }\n if (!this.isElementValuesEqual(elementValue1.elements[i].value, elementValue2.elements[i].value)) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n\n extendSelector(matches, selectorPath, replacementSelector, isVisible) {\n\n // for a set of matches, replace each match with the replacement selector\n\n let currentSelectorPathIndex = 0, currentSelectorPathElementIndex = 0, path = [], matchIndex, selector, firstElement, match, newElements;\n\n for (matchIndex = 0; matchIndex < matches.length; matchIndex++) {\n match = matches[matchIndex];\n selector = selectorPath[match.pathIndex];\n firstElement = new tree.Element(\n match.initialCombinator,\n replacementSelector.elements[0].value,\n replacementSelector.elements[0].isVariable,\n replacementSelector.elements[0].getIndex(),\n replacementSelector.elements[0].fileInfo()\n );\n\n if (match.pathIndex > currentSelectorPathIndex && currentSelectorPathElementIndex > 0) {\n path[path.length - 1].elements = path[path.length - 1]\n .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));\n currentSelectorPathElementIndex = 0;\n currentSelectorPathIndex++;\n }\n\n newElements = selector.elements\n .slice(currentSelectorPathElementIndex, match.index)\n .concat([firstElement])\n .concat(replacementSelector.elements.slice(1));\n\n if (currentSelectorPathIndex === match.pathIndex && matchIndex > 0) {\n path[path.length - 1].elements =\n path[path.length - 1].elements.concat(newElements);\n } else {\n path = path.concat(selectorPath.slice(currentSelectorPathIndex, match.pathIndex));\n\n path.push(new tree.Selector(\n newElements\n ));\n }\n currentSelectorPathIndex = match.endPathIndex;\n currentSelectorPathElementIndex = match.endPathElementIndex;\n if (currentSelectorPathElementIndex >= selectorPath[currentSelectorPathIndex].elements.length) {\n currentSelectorPathElementIndex = 0;\n currentSelectorPathIndex++;\n }\n }\n\n if (currentSelectorPathIndex < selectorPath.length && currentSelectorPathElementIndex > 0) {\n path[path.length - 1].elements = path[path.length - 1]\n .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));\n currentSelectorPathIndex++;\n }\n\n path = path.concat(selectorPath.slice(currentSelectorPathIndex, selectorPath.length));\n path = path.map(function (currentValue) {\n // we can re-use elements here, because the visibility property matters only for selectors\n const derived = currentValue.createDerived(currentValue.elements);\n if (isVisible) {\n derived.ensureVisibility();\n } else {\n derived.ensureInvisibility();\n }\n return derived;\n });\n return path;\n }\n\n visitMedia(mediaNode, visitArgs) {\n let newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]);\n newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, mediaNode.allExtends));\n this.allExtendsStack.push(newAllExtends);\n }\n\n visitMediaOut(mediaNode) {\n const lastIndex = this.allExtendsStack.length - 1;\n this.allExtendsStack.length = lastIndex;\n }\n\n visitAtRule(atRuleNode, visitArgs) {\n let newAllExtends = atRuleNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]);\n newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, atRuleNode.allExtends));\n this.allExtendsStack.push(newAllExtends);\n }\n\n visitAtRuleOut(atRuleNode) {\n const lastIndex = this.allExtendsStack.length - 1;\n this.allExtendsStack.length = lastIndex;\n }\n}\n\nexport default ProcessExtendsVisitor;\n","/* eslint-disable no-unused-vars */\n/**\n * @todo - Remove unused when JSDoc types are added for visitor methods\n */\nimport Visitor from './visitor';\n\nclass JoinSelectorVisitor {\n constructor() {\n this.contexts = [[]];\n this._visitor = new Visitor(this);\n }\n\n run(root) {\n return this._visitor.visit(root);\n }\n\n visitDeclaration(declNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitMixinDefinition(mixinDefinitionNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitRuleset(rulesetNode, visitArgs) {\n const context = this.contexts[this.contexts.length - 1];\n const paths = [];\n let selectors;\n\n this.contexts.push(paths);\n\n if (!rulesetNode.root) {\n selectors = rulesetNode.selectors;\n if (selectors) {\n selectors = selectors.filter(function(selector) { return selector.getIsOutput(); });\n rulesetNode.selectors = selectors.length ? selectors : (selectors = null);\n if (selectors) { rulesetNode.joinSelectors(paths, context, selectors); }\n }\n if (!selectors) { rulesetNode.rules = null; }\n rulesetNode.paths = paths;\n }\n }\n\n visitRulesetOut(rulesetNode) {\n this.contexts.length = this.contexts.length - 1;\n }\n\n visitMedia(mediaNode, visitArgs) {\n const context = this.contexts[this.contexts.length - 1];\n mediaNode.rules[0].root = (context.length === 0 || context[0].multiMedia);\n }\n\n visitAtRule(atRuleNode, visitArgs) {\n const context = this.contexts[this.contexts.length - 1];\n\n if (atRuleNode.declarations && atRuleNode.declarations.length) {\n atRuleNode.declarations[0].root = (context.length === 0 || context[0].multiMedia);\n }\n else if (atRuleNode.rules && atRuleNode.rules.length) {\n atRuleNode.rules[0].root = (atRuleNode.isRooted || context.length === 0 || null);\n }\n }\n}\n\nexport default JoinSelectorVisitor;\n","/* eslint-disable no-unused-vars */\n/**\n * @todo - Remove unused when JSDoc types are added for visitor methods\n */\nimport tree from '../tree';\nimport Visitor from './visitor';\n\nclass CSSVisitorUtils {\n constructor(context) {\n this._visitor = new Visitor(this);\n this._context = context;\n }\n\n containsSilentNonBlockedChild(bodyRules) {\n let rule;\n if (!bodyRules) {\n return false;\n }\n for (let r = 0; r < bodyRules.length; r++) {\n rule = bodyRules[r];\n if (rule.isSilent && rule.isSilent(this._context) && !rule.blocksVisibility()) {\n // the atrule contains something that was referenced (likely by extend)\n // therefore it needs to be shown in output too\n return true;\n }\n }\n return false;\n }\n\n keepOnlyVisibleChilds(owner) {\n if (owner && owner.rules) {\n owner.rules = owner.rules.filter(thing => thing.isVisible());\n }\n }\n\n isEmpty(owner) {\n return (owner && owner.rules) \n ? (owner.rules.length === 0) : true;\n }\n\n hasVisibleSelector(rulesetNode) {\n return (rulesetNode && rulesetNode.paths)\n ? (rulesetNode.paths.length > 0) : false;\n }\n\n resolveVisibility(node) {\n if (!node.blocksVisibility()) {\n if (this.isEmpty(node)) {\n return ;\n }\n\n return node;\n }\n\n const compiledRulesBody = node.rules[0];\n this.keepOnlyVisibleChilds(compiledRulesBody);\n\n if (this.isEmpty(compiledRulesBody)) {\n return ;\n }\n\n node.ensureVisibility();\n node.removeVisibilityBlock();\n\n return node;\n }\n\n isVisibleRuleset(rulesetNode) {\n if (rulesetNode.firstRoot) {\n return true;\n }\n\n if (this.isEmpty(rulesetNode)) {\n return false;\n }\n\n if (!rulesetNode.root && !this.hasVisibleSelector(rulesetNode)) {\n return false;\n }\n\n return true;\n }\n}\n\nconst ToCSSVisitor = function(context) {\n this._visitor = new Visitor(this);\n this._context = context;\n this.utils = new CSSVisitorUtils(context);\n};\n\nToCSSVisitor.prototype = {\n isReplacing: true,\n run: function (root) {\n return this._visitor.visit(root);\n },\n\n visitDeclaration: function (declNode, visitArgs) {\n if (declNode.blocksVisibility() || declNode.variable) {\n return;\n }\n return declNode;\n },\n\n visitMixinDefinition: function (mixinNode, visitArgs) {\n // mixin definitions do not get eval'd - this means they keep state\n // so we have to clear that state here so it isn't used if toCSS is called twice\n mixinNode.frames = [];\n },\n\n visitExtend: function (extendNode, visitArgs) {\n },\n\n visitComment: function (commentNode, visitArgs) {\n if (commentNode.blocksVisibility() || commentNode.isSilent(this._context)) {\n return;\n }\n return commentNode;\n },\n\n visitMedia: function(mediaNode, visitArgs) {\n const originalRules = mediaNode.rules[0].rules;\n mediaNode.accept(this._visitor);\n visitArgs.visitDeeper = false;\n\n return this.utils.resolveVisibility(mediaNode, originalRules);\n },\n\n visitImport: function (importNode, visitArgs) {\n if (importNode.blocksVisibility()) {\n return ;\n }\n return importNode;\n },\n\n visitAtRule: function(atRuleNode, visitArgs) {\n if (atRuleNode.rules && atRuleNode.rules.length) {\n return this.visitAtRuleWithBody(atRuleNode, visitArgs);\n } else {\n return this.visitAtRuleWithoutBody(atRuleNode, visitArgs);\n }\n },\n\n visitAnonymous: function(anonymousNode, visitArgs) {\n if (!anonymousNode.blocksVisibility()) {\n anonymousNode.accept(this._visitor);\n return anonymousNode;\n }\n },\n\n visitAtRuleWithBody: function(atRuleNode, visitArgs) {\n // if there is only one nested ruleset and that one has no path, then it is\n // just fake ruleset\n function hasFakeRuleset(atRuleNode) {\n const bodyRules = atRuleNode.rules;\n return bodyRules.length === 1 && (!bodyRules[0].paths || bodyRules[0].paths.length === 0);\n }\n function getBodyRules(atRuleNode) {\n const nodeRules = atRuleNode.rules;\n if (hasFakeRuleset(atRuleNode)) {\n return nodeRules[0].rules;\n }\n\n return nodeRules;\n }\n // it is still true that it is only one ruleset in array\n // this is last such moment\n // process childs\n const originalRules = getBodyRules(atRuleNode);\n atRuleNode.accept(this._visitor);\n visitArgs.visitDeeper = false;\n\n if (!this.utils.isEmpty(atRuleNode)) {\n this._mergeRules(atRuleNode.rules[0].rules);\n }\n\n return this.utils.resolveVisibility(atRuleNode, originalRules);\n },\n\n visitAtRuleWithoutBody: function(atRuleNode, visitArgs) {\n if (atRuleNode.blocksVisibility()) {\n return;\n }\n\n if (atRuleNode.name === '@charset') {\n // Only output the debug info together with subsequent @charset definitions\n // a comment (or @media statement) before the actual @charset atrule would\n // be considered illegal css as it has to be on the first line\n if (this.charset) {\n if (atRuleNode.debugInfo) {\n const comment = new tree.Comment(`/* ${atRuleNode.toCSS(this._context).replace(/\\n/g, '')} */\\n`);\n comment.debugInfo = atRuleNode.debugInfo;\n return this._visitor.visit(comment);\n }\n return;\n }\n this.charset = true;\n }\n\n return atRuleNode;\n },\n\n checkValidNodes: function(rules, isRoot) {\n if (!rules) {\n return;\n }\n\n for (let i = 0; i < rules.length; i++) {\n const ruleNode = rules[i];\n if (isRoot && ruleNode instanceof tree.Declaration && !ruleNode.variable) {\n throw { message: 'Properties must be inside selector blocks. They cannot be in the root',\n index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename};\n }\n if (ruleNode instanceof tree.Call) {\n throw { message: `Function '${ruleNode.name}' did not return a root node`,\n index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename};\n }\n if (ruleNode.type && !ruleNode.allowRoot) {\n throw { message: `${ruleNode.type} node returned by a function is not valid here`,\n index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename};\n }\n }\n },\n\n visitRuleset: function (rulesetNode, visitArgs) {\n // at this point rulesets are nested into each other\n let rule;\n\n const rulesets = [];\n\n this.checkValidNodes(rulesetNode.rules, rulesetNode.firstRoot);\n\n if (!rulesetNode.root) {\n // remove invisible paths\n this._compileRulesetPaths(rulesetNode);\n\n // remove rulesets from this ruleset body and compile them separately\n const nodeRules = rulesetNode.rules;\n\n let nodeRuleCnt = nodeRules ? nodeRules.length : 0;\n for (let i = 0; i < nodeRuleCnt; ) {\n rule = nodeRules[i];\n if (rule && rule.rules) {\n // visit because we are moving them out from being a child\n rulesets.push(this._visitor.visit(rule));\n nodeRules.splice(i, 1);\n nodeRuleCnt--;\n continue;\n }\n i++;\n }\n // accept the visitor to remove rules and refactor itself\n // then we can decide nogw whether we want it or not\n // compile body\n if (nodeRuleCnt > 0) {\n rulesetNode.accept(this._visitor);\n } else {\n rulesetNode.rules = null;\n }\n visitArgs.visitDeeper = false;\n } else { // if (! rulesetNode.root) {\n rulesetNode.accept(this._visitor);\n visitArgs.visitDeeper = false;\n }\n\n if (rulesetNode.rules) {\n this._mergeRules(rulesetNode.rules);\n this._removeDuplicateRules(rulesetNode.rules);\n }\n\n // now decide whether we keep the ruleset\n if (this.utils.isVisibleRuleset(rulesetNode)) {\n rulesetNode.ensureVisibility();\n rulesets.splice(0, 0, rulesetNode);\n }\n\n if (rulesets.length === 1) {\n return rulesets[0];\n }\n return rulesets;\n },\n\n _compileRulesetPaths: function(rulesetNode) {\n if (rulesetNode.paths) {\n rulesetNode.paths = rulesetNode.paths\n .filter(p => {\n let i;\n if (p[0].elements[0].combinator.value === ' ') {\n p[0].elements[0].combinator = new(tree.Combinator)('');\n }\n for (i = 0; i < p.length; i++) {\n if (p[i].isVisible() && p[i].getIsOutput()) {\n return true;\n }\n }\n return false;\n });\n }\n },\n\n _removeDuplicateRules: function(rules) {\n if (!rules) { return; }\n\n // remove duplicates\n const ruleCache = {};\n\n let ruleList;\n let rule;\n let i;\n\n for (i = rules.length - 1; i >= 0 ; i--) {\n rule = rules[i];\n if (rule instanceof tree.Declaration) {\n if (!ruleCache[rule.name]) {\n ruleCache[rule.name] = rule;\n } else {\n ruleList = ruleCache[rule.name];\n if (ruleList instanceof tree.Declaration) {\n ruleList = ruleCache[rule.name] = [ruleCache[rule.name].toCSS(this._context)];\n }\n const ruleCSS = rule.toCSS(this._context);\n if (ruleList.indexOf(ruleCSS) !== -1) {\n rules.splice(i, 1);\n } else {\n ruleList.push(ruleCSS);\n }\n }\n }\n }\n },\n\n _mergeRules: function(rules) {\n if (!rules) {\n return; \n }\n\n const groups = {};\n const groupsArr = [];\n\n for (let i = 0; i < rules.length; i++) {\n const rule = rules[i];\n if (rule.merge) {\n const key = rule.name;\n groups[key] ? rules.splice(i--, 1) : \n groupsArr.push(groups[key] = []);\n groups[key].push(rule);\n }\n }\n\n groupsArr.forEach(group => {\n if (group.length > 0) {\n const result = group[0];\n let space = [];\n const comma = [new tree.Expression(space)];\n group.forEach(rule => {\n if ((rule.merge === '+') && (space.length > 0)) {\n comma.push(new tree.Expression(space = []));\n }\n space.push(rule.value);\n result.important = result.important || rule.important;\n });\n result.value = new tree.Value(comma);\n }\n });\n }\n};\n\nexport default ToCSSVisitor;\n","import Visitor from './visitor';\nimport ImportVisitor from './import-visitor';\nimport MarkVisibleSelectorsVisitor from './set-tree-visibility-visitor';\nimport ExtendVisitor from './extend-visitor';\nimport JoinSelectorVisitor from './join-selector-visitor';\nimport ToCSSVisitor from './to-css-visitor';\n\nexport default {\n Visitor,\n ImportVisitor,\n MarkVisibleSelectorsVisitor,\n ExtendVisitor,\n JoinSelectorVisitor,\n ToCSSVisitor\n};\n","import chunker from './chunker';\n\nexport default () => {\n let // Less input string\n input;\n\n let // current chunk\n j;\n\n const // holds state for backtracking\n saveStack = [];\n\n let // furthest index the parser has gone to\n furthest;\n\n let // if this is furthest we got to, this is the probably cause\n furthestPossibleErrorMessage;\n\n let // chunkified input\n chunks;\n\n let // current chunk\n current;\n\n let // index of current chunk, in `input`\n currentPos;\n\n const parserInput = {};\n const CHARCODE_SPACE = 32;\n const CHARCODE_TAB = 9;\n const CHARCODE_LF = 10;\n const CHARCODE_CR = 13;\n const CHARCODE_PLUS = 43;\n const CHARCODE_COMMA = 44;\n const CHARCODE_FORWARD_SLASH = 47;\n const CHARCODE_9 = 57;\n\n function skipWhitespace(length) {\n const oldi = parserInput.i;\n const oldj = j;\n const curr = parserInput.i - currentPos;\n const endIndex = parserInput.i + current.length - curr;\n const mem = (parserInput.i += length);\n const inp = input;\n let c;\n let nextChar;\n let comment;\n\n for (; parserInput.i < endIndex; parserInput.i++) {\n c = inp.charCodeAt(parserInput.i);\n\n if (parserInput.autoCommentAbsorb && c === CHARCODE_FORWARD_SLASH) {\n nextChar = inp.charAt(parserInput.i + 1);\n if (nextChar === '/') {\n comment = {index: parserInput.i, isLineComment: true};\n let nextNewLine = inp.indexOf('\\n', parserInput.i + 2);\n if (nextNewLine < 0) {\n nextNewLine = endIndex;\n }\n parserInput.i = nextNewLine;\n comment.text = inp.substr(comment.index, parserInput.i - comment.index);\n parserInput.commentStore.push(comment);\n continue;\n } else if (nextChar === '*') {\n const nextStarSlash = inp.indexOf('*/', parserInput.i + 2);\n if (nextStarSlash >= 0) {\n comment = {\n index: parserInput.i,\n text: inp.substr(parserInput.i, nextStarSlash + 2 - parserInput.i),\n isLineComment: false\n };\n parserInput.i += comment.text.length - 1;\n parserInput.commentStore.push(comment);\n continue;\n }\n }\n break;\n }\n\n if ((c !== CHARCODE_SPACE) && (c !== CHARCODE_LF) && (c !== CHARCODE_TAB) && (c !== CHARCODE_CR)) {\n break;\n }\n }\n\n current = current.slice(length + parserInput.i - mem + curr);\n currentPos = parserInput.i;\n\n if (!current.length) {\n if (j < chunks.length - 1) {\n current = chunks[++j];\n skipWhitespace(0); // skip space at the beginning of a chunk\n return true; // things changed\n }\n parserInput.finished = true;\n }\n\n return oldi !== parserInput.i || oldj !== j;\n }\n\n parserInput.save = () => {\n currentPos = parserInput.i;\n saveStack.push( { current, i: parserInput.i, j });\n };\n parserInput.restore = possibleErrorMessage => {\n\n if (parserInput.i > furthest || (parserInput.i === furthest && possibleErrorMessage && !furthestPossibleErrorMessage)) {\n furthest = parserInput.i;\n furthestPossibleErrorMessage = possibleErrorMessage;\n }\n const state = saveStack.pop();\n current = state.current;\n currentPos = parserInput.i = state.i;\n j = state.j;\n };\n parserInput.forget = () => {\n saveStack.pop();\n };\n parserInput.isWhitespace = offset => {\n const pos = parserInput.i + (offset || 0);\n const code = input.charCodeAt(pos);\n return (code === CHARCODE_SPACE || code === CHARCODE_CR || code === CHARCODE_TAB || code === CHARCODE_LF);\n };\n\n // Specialization of $(tok)\n parserInput.$re = tok => {\n if (parserInput.i > currentPos) {\n current = current.slice(parserInput.i - currentPos);\n currentPos = parserInput.i;\n }\n\n const m = tok.exec(current);\n if (!m) {\n return null;\n }\n\n skipWhitespace(m[0].length);\n if (typeof m === 'string') {\n return m;\n }\n\n return m.length === 1 ? m[0] : m;\n };\n\n parserInput.$char = tok => {\n if (input.charAt(parserInput.i) !== tok) {\n return null;\n }\n skipWhitespace(1);\n return tok;\n };\n\n parserInput.$peekChar = tok => {\n if (input.charAt(parserInput.i) !== tok) {\n return null;\n }\n return tok;\n };\n\n parserInput.$str = tok => {\n const tokLength = tok.length;\n\n // https://jsperf.com/string-startswith/21\n for (let i = 0; i < tokLength; i++) {\n if (input.charAt(parserInput.i + i) !== tok.charAt(i)) {\n return null;\n }\n }\n\n skipWhitespace(tokLength);\n return tok;\n };\n\n parserInput.$quoted = loc => {\n const pos = loc || parserInput.i;\n const startChar = input.charAt(pos);\n\n if (startChar !== '\\'' && startChar !== '\"') {\n return;\n }\n const length = input.length;\n const currentPosition = pos;\n\n for (let i = 1; i + currentPosition < length; i++) {\n const nextChar = input.charAt(i + currentPosition);\n switch (nextChar) {\n case '\\\\':\n i++;\n continue;\n case '\\r':\n case '\\n':\n break;\n case startChar: {\n const str = input.substr(currentPosition, i + 1);\n if (!loc && loc !== 0) {\n skipWhitespace(i + 1);\n return str\n }\n return [startChar, str];\n }\n default:\n }\n }\n return null;\n };\n\n /**\n * Permissive parsing. Ignores everything except matching {} [] () and quotes\n * until matching token (outside of blocks)\n */\n parserInput.$parseUntil = tok => {\n let quote = '';\n let returnVal = null;\n let inComment = false;\n let blockDepth = 0;\n const blockStack = [];\n const parseGroups = [];\n const length = input.length;\n const startPos = parserInput.i;\n let lastPos = parserInput.i;\n let i = parserInput.i;\n let loop = true;\n let testChar;\n\n if (typeof tok === 'string') {\n testChar = char => char === tok\n } else {\n testChar = char => tok.test(char)\n }\n\n do {\n let nextChar = input.charAt(i);\n if (blockDepth === 0 && testChar(nextChar)) {\n returnVal = input.substr(lastPos, i - lastPos);\n if (returnVal) {\n parseGroups.push(returnVal);\n }\n else {\n parseGroups.push(' ');\n }\n returnVal = parseGroups;\n skipWhitespace(i - startPos);\n loop = false\n } else {\n if (inComment) {\n if (nextChar === '*' && \n input.charAt(i + 1) === '/') {\n i++;\n blockDepth--;\n inComment = false;\n }\n i++;\n continue;\n }\n switch (nextChar) {\n case '\\\\':\n i++;\n nextChar = input.charAt(i);\n parseGroups.push(input.substr(lastPos, i - lastPos + 1));\n lastPos = i + 1;\n break;\n case '/':\n if (input.charAt(i + 1) === '*') {\n i++;\n inComment = true;\n blockDepth++;\n }\n break;\n case '\\'':\n case '\"':\n quote = parserInput.$quoted(i);\n if (quote) {\n parseGroups.push(input.substr(lastPos, i - lastPos), quote);\n i += quote[1].length - 1;\n lastPos = i + 1;\n }\n else {\n skipWhitespace(i - startPos);\n returnVal = nextChar;\n loop = false;\n }\n break;\n case '{':\n blockStack.push('}');\n blockDepth++;\n break;\n case '(':\n blockStack.push(')');\n blockDepth++;\n break;\n case '[':\n blockStack.push(']');\n blockDepth++;\n break;\n case '}':\n case ')':\n case ']': {\n const expected = blockStack.pop();\n if (nextChar === expected) {\n blockDepth--;\n } else {\n // move the parser to the error and return expected\n skipWhitespace(i - startPos);\n returnVal = expected;\n loop = false;\n }\n }\n }\n i++;\n if (i > length) {\n loop = false;\n }\n }\n } while (loop);\n\n return returnVal ? returnVal : null;\n }\n\n parserInput.autoCommentAbsorb = true;\n parserInput.commentStore = [];\n parserInput.finished = false;\n\n // Same as $(), but don't change the state of the parser,\n // just return the match.\n parserInput.peek = tok => {\n if (typeof tok === 'string') {\n // https://jsperf.com/string-startswith/21\n for (let i = 0; i < tok.length; i++) {\n if (input.charAt(parserInput.i + i) !== tok.charAt(i)) {\n return false;\n }\n }\n return true;\n } else {\n return tok.test(current);\n }\n };\n\n // Specialization of peek()\n // TODO remove or change some currentChar calls to peekChar\n parserInput.peekChar = tok => input.charAt(parserInput.i) === tok;\n\n parserInput.currentChar = () => input.charAt(parserInput.i);\n\n parserInput.prevChar = () => input.charAt(parserInput.i - 1);\n\n parserInput.getInput = () => input;\n\n parserInput.peekNotNumeric = () => {\n const c = input.charCodeAt(parserInput.i);\n // Is the first char of the dimension 0-9, '.', '+' or '-'\n return (c > CHARCODE_9 || c < CHARCODE_PLUS) || c === CHARCODE_FORWARD_SLASH || c === CHARCODE_COMMA;\n };\n\n parserInput.start = (str, chunkInput, failFunction) => {\n input = str;\n parserInput.i = j = currentPos = furthest = 0;\n\n // chunking apparently makes things quicker (but my tests indicate\n // it might actually make things slower in node at least)\n // and it is a non-perfect parse - it can't recognise\n // unquoted urls, meaning it can't distinguish comments\n // meaning comments with quotes or {}() in them get 'counted'\n // and then lead to parse errors.\n // In addition if the chunking chunks in the wrong place we might\n // not be able to parse a parser statement in one go\n // this is officially deprecated but can be switched on via an option\n // in the case it causes too much performance issues.\n if (chunkInput) {\n chunks = chunker(str, failFunction);\n } else {\n chunks = [str];\n }\n\n current = chunks[0];\n\n skipWhitespace(0);\n };\n\n parserInput.end = () => {\n let message;\n const isFinished = parserInput.i >= input.length;\n\n if (parserInput.i < furthest) {\n message = furthestPossibleErrorMessage;\n parserInput.i = furthest;\n }\n return {\n isFinished,\n furthest: parserInput.i,\n furthestPossibleErrorMessage: message,\n furthestReachedEnd: parserInput.i >= input.length - 1,\n furthestChar: input[parserInput.i]\n };\n };\n\n return parserInput;\n};\n","// Split the input into chunks.\nexport default function (input, fail) {\n const len = input.length;\n let level = 0;\n let parenLevel = 0;\n let lastOpening;\n let lastOpeningParen;\n let lastMultiComment;\n let lastMultiCommentEndBrace;\n const chunks = [];\n let emitFrom = 0;\n let chunkerCurrentIndex;\n let currentChunkStartIndex;\n let cc;\n let cc2;\n let matched;\n\n function emitChunk(force) {\n const len = chunkerCurrentIndex - emitFrom;\n if (((len < 512) && !force) || !len) {\n return;\n }\n chunks.push(input.slice(emitFrom, chunkerCurrentIndex + 1));\n emitFrom = chunkerCurrentIndex + 1;\n }\n\n for (chunkerCurrentIndex = 0; chunkerCurrentIndex < len; chunkerCurrentIndex++) {\n cc = input.charCodeAt(chunkerCurrentIndex);\n if (((cc >= 97) && (cc <= 122)) || (cc < 34)) {\n // a-z or whitespace\n continue;\n }\n\n switch (cc) {\n case 40: // (\n parenLevel++;\n lastOpeningParen = chunkerCurrentIndex;\n continue;\n case 41: // )\n if (--parenLevel < 0) {\n return fail('missing opening `(`', chunkerCurrentIndex);\n }\n continue;\n case 59: // ;\n if (!parenLevel) { emitChunk(); }\n continue;\n case 123: // {\n level++;\n lastOpening = chunkerCurrentIndex;\n continue;\n case 125: // }\n if (--level < 0) {\n return fail('missing opening `{`', chunkerCurrentIndex);\n }\n if (!level && !parenLevel) { emitChunk(); }\n continue;\n case 92: // \\\n if (chunkerCurrentIndex < len - 1) { chunkerCurrentIndex++; continue; }\n return fail('unescaped `\\\\`', chunkerCurrentIndex);\n case 34:\n case 39:\n case 96: // \", ' and `\n matched = 0;\n currentChunkStartIndex = chunkerCurrentIndex;\n for (chunkerCurrentIndex = chunkerCurrentIndex + 1; chunkerCurrentIndex < len; chunkerCurrentIndex++) {\n cc2 = input.charCodeAt(chunkerCurrentIndex);\n if (cc2 > 96) { continue; }\n if (cc2 == cc) { matched = 1; break; }\n if (cc2 == 92) { // \\\n if (chunkerCurrentIndex == len - 1) {\n return fail('unescaped `\\\\`', chunkerCurrentIndex);\n }\n chunkerCurrentIndex++;\n }\n }\n if (matched) { continue; }\n return fail(`unmatched \\`${String.fromCharCode(cc)}\\``, currentChunkStartIndex);\n case 47: // /, check for comment\n if (parenLevel || (chunkerCurrentIndex == len - 1)) { continue; }\n cc2 = input.charCodeAt(chunkerCurrentIndex + 1);\n if (cc2 == 47) {\n // //, find lnfeed\n for (chunkerCurrentIndex = chunkerCurrentIndex + 2; chunkerCurrentIndex < len; chunkerCurrentIndex++) {\n cc2 = input.charCodeAt(chunkerCurrentIndex);\n if ((cc2 <= 13) && ((cc2 == 10) || (cc2 == 13))) { break; }\n }\n } else if (cc2 == 42) {\n // /*, find */\n lastMultiComment = currentChunkStartIndex = chunkerCurrentIndex;\n for (chunkerCurrentIndex = chunkerCurrentIndex + 2; chunkerCurrentIndex < len - 1; chunkerCurrentIndex++) {\n cc2 = input.charCodeAt(chunkerCurrentIndex);\n if (cc2 == 125) { lastMultiCommentEndBrace = chunkerCurrentIndex; }\n if (cc2 != 42) { continue; }\n if (input.charCodeAt(chunkerCurrentIndex + 1) == 47) { break; }\n }\n if (chunkerCurrentIndex == len - 1) {\n return fail('missing closing `*/`', currentChunkStartIndex);\n }\n chunkerCurrentIndex++;\n }\n continue;\n case 42: // *, check for unmatched */\n if ((chunkerCurrentIndex < len - 1) && (input.charCodeAt(chunkerCurrentIndex + 1) == 47)) {\n return fail('unmatched `/*`', chunkerCurrentIndex);\n }\n continue;\n }\n }\n\n if (level !== 0) {\n if ((lastMultiComment > lastOpening) && (lastMultiCommentEndBrace > lastMultiComment)) {\n return fail('missing closing `}` or `*/`', lastOpening);\n } else {\n return fail('missing closing `}`', lastOpening);\n }\n } else if (parenLevel !== 0) {\n return fail('missing closing `)`', lastOpeningParen);\n }\n\n emitChunk(true);\n return chunks;\n}\n","function makeRegistry( base ) {\n return {\n _data: {},\n add: function(name, func) {\n // precautionary case conversion, as later querying of\n // the registry by function-caller uses lower case as well.\n name = name.toLowerCase();\n\n // eslint-disable-next-line no-prototype-builtins\n if (this._data.hasOwnProperty(name)) {\n // TODO warn\n }\n this._data[name] = func;\n },\n addMultiple: function(functions) {\n Object.keys(functions).forEach(\n name => {\n this.add(name, functions[name]);\n });\n },\n get: function(name) {\n return this._data[name] || ( base && base.get( name ));\n },\n getLocalFunctions: function() {\n return this._data;\n },\n inherit: function() {\n return makeRegistry( this );\n },\n create: function(base) {\n return makeRegistry(base);\n }\n };\n}\n\nexport default makeRegistry( null );","export const MediaSyntaxOptions = {\n queryInParens: true\n};\n\nexport const ContainerSyntaxOptions = {\n queryInParens: true\n};\n","import Node from './node';\n\nconst Anonymous = function(value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) {\n this.value = value;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.mapLines = mapLines;\n this.rulesetLike = (typeof rulesetLike === 'undefined') ? false : rulesetLike;\n this.allowRoot = true;\n this.copyVisibilityInfo(visibilityInfo);\n}\n\nAnonymous.prototype = Object.assign(new Node(), {\n type: 'Anonymous',\n eval() {\n return new Anonymous(this.value, this._index, this._fileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo());\n },\n compare(other) {\n return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;\n },\n isRulesetLike() {\n return this.rulesetLike;\n },\n genCSS(context, output) {\n this.nodeVisible = Boolean(this.value);\n if (this.nodeVisible) {\n output.add(this.value, this._fileInfo, this._index, this.mapLines);\n }\n }\n})\n\nexport default Anonymous;\n","import LessError from '../less-error';\nimport tree from '../tree';\nimport visitors from '../visitors';\nimport getParserInput from './parser-input';\nimport * as utils from '../utils';\nimport functionRegistry from '../functions/function-registry';\nimport { ContainerSyntaxOptions, MediaSyntaxOptions } from '../tree/atrule-syntax';\nimport logger from '../logger';\nimport Selector from '../tree/selector';\nimport Anonymous from '../tree/anonymous';\n\n//\n// less.js - parser\n//\n// A relatively straight-forward predictive parser.\n// There is no tokenization/lexing stage, the input is parsed\n// in one sweep.\n//\n// To make the parser fast enough to run in the browser, several\n// optimization had to be made:\n//\n// - Matching and slicing on a huge input is often cause of slowdowns.\n// The solution is to chunkify the input into smaller strings.\n// The chunks are stored in the `chunks` var,\n// `j` holds the current chunk index, and `currentPos` holds\n// the index of the current chunk in relation to `input`.\n// This gives us an almost 4x speed-up.\n//\n// - In many cases, we don't need to match individual tokens;\n// for example, if a value doesn't hold any variables, operations\n// or dynamic references, the parser can effectively 'skip' it,\n// treating it as a literal.\n// An example would be '1px solid #000' - which evaluates to itself,\n// we don't need to know what the individual components are.\n// The drawback, of course is that you don't get the benefits of\n// syntax-checking on the CSS. This gives us a 50% speed-up in the parser,\n// and a smaller speed-up in the code-gen.\n//\n//\n// Token matching is done with the `$` function, which either takes\n// a terminal string or regexp, or a non-terminal function to call.\n// It also takes care of moving all the indices forwards.\n//\n\nconst Parser = function Parser(context, imports, fileInfo, currentIndex) {\n currentIndex = currentIndex || 0;\n let parsers;\n const parserInput = getParserInput();\n\n function error(msg, type) {\n throw new LessError(\n {\n index: parserInput.i,\n filename: fileInfo.filename,\n type: type || 'Syntax',\n message: msg\n },\n imports\n );\n }\n\n /**\n * \n * @param {string} msg \n * @param {number} index \n * @param {string} type \n */\n function warn(msg, index, type) {\n if (!context.quiet) {\n logger.warn(\n (new LessError(\n {\n index: index ?? parserInput.i,\n filename: fileInfo.filename,\n type: type ? `${type.toUpperCase()} WARNING` : 'WARNING',\n message: msg\n },\n imports\n )).toString()\n );\n }\n }\n\n function expect(arg, msg) {\n // some older browsers return typeof 'function' for RegExp\n const result = (arg instanceof Function) ? arg.call(parsers) : parserInput.$re(arg);\n if (result) {\n return result;\n }\n\n error(msg || (typeof arg === 'string'\n ? `expected '${arg}' got '${parserInput.currentChar()}'`\n : 'unexpected token'));\n }\n\n // Specialization of expect()\n function expectChar(arg, msg) {\n if (parserInput.$char(arg)) {\n return arg;\n }\n error(msg || `expected '${arg}' got '${parserInput.currentChar()}'`);\n }\n\n function getDebugInfo(index) {\n const filename = fileInfo.filename;\n\n return {\n lineNumber: utils.getLocation(index, parserInput.getInput()).line + 1,\n fileName: filename\n };\n }\n\n /**\n * Used after initial parsing to create nodes on the fly\n *\n * @param {String} str - string to parse\n * @param {Array} parseList - array of parsers to run input through e.g. [\"value\", \"important\"]\n * @param {Number} currentIndex - start number to begin indexing\n * @param {Object} fileInfo - fileInfo to attach to created nodes\n */\n function parseNode(str, parseList, callback) {\n let result;\n const returnNodes = [];\n const parser = parserInput;\n\n try {\n parser.start(str, false, function fail(msg, index) {\n callback({\n message: msg,\n index: index + currentIndex\n });\n });\n for (let x = 0, p; (p = parseList[x]); x++) {\n result = parsers[p]();\n returnNodes.push(result || null);\n }\n\n const endInfo = parser.end();\n if (endInfo.isFinished) {\n callback(null, returnNodes);\n }\n else {\n callback(true, null);\n }\n } catch (e) {\n throw new LessError({\n index: e.index + currentIndex,\n message: e.message\n }, imports, fileInfo.filename);\n }\n }\n\n //\n // The Parser\n //\n return {\n parserInput,\n imports,\n fileInfo,\n parseNode,\n //\n // Parse an input string into an abstract syntax tree,\n // @param str A string containing 'less' markup\n // @param callback call `callback` when done.\n // @param [additionalData] An optional map which can contains vars - a map (key, value) of variables to apply\n //\n parse: function (str, callback, additionalData) {\n let root;\n let err = null;\n let globalVars;\n let modifyVars;\n let ignored;\n let preText = '';\n\n // Optionally disable @plugin parsing\n if (additionalData && additionalData.disablePluginRule) {\n parsers.plugin = function() {\n var dir = parserInput.$re(/^@plugin?\\s+/);\n if (dir) {\n error('@plugin statements are not allowed when disablePluginRule is set to true');\n }\n }\n }\n\n globalVars = (additionalData && additionalData.globalVars) ? `${Parser.serializeVars(additionalData.globalVars)}\\n` : '';\n modifyVars = (additionalData && additionalData.modifyVars) ? `\\n${Parser.serializeVars(additionalData.modifyVars)}` : '';\n\n if (context.pluginManager) {\n const preProcessors = context.pluginManager.getPreProcessors();\n for (let i = 0; i < preProcessors.length; i++) {\n str = preProcessors[i].process(str, { context, imports, fileInfo });\n }\n }\n\n if (globalVars || (additionalData && additionalData.banner)) {\n preText = ((additionalData && additionalData.banner) ? additionalData.banner : '') + globalVars;\n ignored = imports.contentsIgnoredChars;\n ignored[fileInfo.filename] = ignored[fileInfo.filename] || 0;\n ignored[fileInfo.filename] += preText.length;\n }\n\n str = str.replace(/\\r\\n?/g, '\\n');\n // Remove potential UTF Byte Order Mark\n str = preText + str.replace(/^\\uFEFF/, '') + modifyVars;\n imports.contents[fileInfo.filename] = str;\n\n // Start with the primary rule.\n // The whole syntax tree is held under a Ruleset node,\n // with the `root` property set to true, so no `{}` are\n // output. The callback is called when the input is parsed.\n try {\n parserInput.start(str, context.chunkInput, function fail(msg, index) {\n throw new LessError({\n index,\n type: 'Parse',\n message: msg,\n filename: fileInfo.filename\n }, imports);\n });\n\n tree.Node.prototype.parse = this;\n root = new tree.Ruleset(null, this.parsers.primary());\n tree.Node.prototype.rootNode = root;\n root.root = true;\n root.firstRoot = true;\n root.functionRegistry = functionRegistry.inherit();\n\n } catch (e) {\n return callback(new LessError(e, imports, fileInfo.filename));\n }\n\n // If `i` is smaller than the `input.length - 1`,\n // it means the parser wasn't able to parse the whole\n // string, so we've got a parsing error.\n //\n // We try to extract a \\n delimited string,\n // showing the line where the parse error occurred.\n // We split it up into two parts (the part which parsed,\n // and the part which didn't), so we can color them differently.\n const endInfo = parserInput.end();\n if (!endInfo.isFinished) {\n\n let message = endInfo.furthestPossibleErrorMessage;\n\n if (!message) {\n message = 'Unrecognised input';\n if (endInfo.furthestChar === '}') {\n message += '. Possibly missing opening \\'{\\'';\n } else if (endInfo.furthestChar === ')') {\n message += '. Possibly missing opening \\'(\\'';\n } else if (endInfo.furthestReachedEnd) {\n message += '. Possibly missing something';\n }\n }\n\n err = new LessError({\n type: 'Parse',\n message,\n index: endInfo.furthest,\n filename: fileInfo.filename\n }, imports);\n }\n\n const finish = e => {\n e = err || e || imports.error;\n\n if (e) {\n if (!(e instanceof LessError)) {\n e = new LessError(e, imports, fileInfo.filename);\n }\n\n return callback(e);\n }\n else {\n return callback(null, root);\n }\n };\n\n if (context.processImports !== false) {\n new visitors.ImportVisitor(imports, finish)\n .run(root);\n } else {\n return finish();\n }\n },\n\n //\n // Here in, the parsing rules/functions\n //\n // The basic structure of the syntax tree generated is as follows:\n //\n // Ruleset -> Declaration -> Value -> Expression -> Entity\n //\n // Here's some Less code:\n //\n // .class {\n // color: #fff;\n // border: 1px solid #000;\n // width: @w + 4px;\n // > .child {...}\n // }\n //\n // And here's what the parse tree might look like:\n //\n // Ruleset (Selector '.class', [\n // Declaration (\"color\", Value ([Expression [Color #fff]]))\n // Declaration (\"border\", Value ([Expression [Dimension 1px][Keyword \"solid\"][Color #000]]))\n // Declaration (\"width\", Value ([Expression [Operation \" + \" [Variable \"@w\"][Dimension 4px]]]))\n // Ruleset (Selector [Element '>', '.child'], [...])\n // ])\n //\n // In general, most rules will try to parse a token with the `$re()` function, and if the return\n // value is truly, will return a new node, of the relevant type. Sometimes, we need to check\n // first, before parsing, that's when we use `peek()`.\n //\n parsers: parsers = {\n //\n // The `primary` rule is the *entry* and *exit* point of the parser.\n // The rules here can appear at any level of the parse tree.\n //\n // The recursive nature of the grammar is an interplay between the `block`\n // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule,\n // as represented by this simplified grammar:\n //\n // primary → (ruleset | declaration)+\n // ruleset → selector+ block\n // block → '{' primary '}'\n //\n // Only at one point is the primary rule not called from the\n // block rule: at the root level.\n //\n primary: function () {\n const mixin = this.mixin;\n let root = [];\n let node;\n\n while (true) {\n while (true) {\n node = this.comment();\n if (!node) { break; }\n root.push(node);\n }\n // always process comments before deciding if finished\n if (parserInput.finished) {\n break;\n }\n if (parserInput.peek('}')) {\n break;\n }\n\n node = this.extendRule();\n if (node) {\n root = root.concat(node);\n continue;\n }\n\n node = mixin.definition() || this.declaration() || mixin.call(false, false) ||\n this.ruleset() || this.variableCall() || this.entities.call() || this.atrule();\n if (node) {\n root.push(node);\n } else {\n let foundSemiColon = false;\n while (parserInput.$char(';')) {\n foundSemiColon = true;\n }\n if (!foundSemiColon) {\n break;\n }\n }\n }\n\n return root;\n },\n\n // comments are collected by the main parsing mechanism and then assigned to nodes\n // where the current structure allows it\n comment: function () {\n if (parserInput.commentStore.length) {\n const comment = parserInput.commentStore.shift();\n return new(tree.Comment)(comment.text, comment.isLineComment, comment.index + currentIndex, fileInfo);\n }\n },\n\n //\n // Entities are tokens which can be found inside an Expression\n //\n entities: {\n mixinLookup: function() {\n return parsers.mixin.call(true, true);\n },\n //\n // A string, which supports escaping \" and '\n //\n // \"milky way\" 'he\\'s the one!'\n //\n quoted: function (forceEscaped) {\n let str;\n const index = parserInput.i;\n let isEscaped = false;\n\n parserInput.save();\n if (parserInput.$char('~')) {\n isEscaped = true;\n } else if (forceEscaped) {\n parserInput.restore();\n return;\n }\n\n str = parserInput.$quoted();\n if (!str) {\n parserInput.restore();\n return;\n }\n parserInput.forget();\n\n return new(tree.Quoted)(str.charAt(0), str.substr(1, str.length - 2), isEscaped, index + currentIndex, fileInfo);\n },\n\n //\n // A catch-all word, such as:\n //\n // black border-collapse\n //\n keyword: function () {\n const k = parserInput.$char('%') || parserInput.$re(/^\\[?(?:[\\w-]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+\\]?/);\n if (k) {\n return tree.Color.fromKeyword(k) || new(tree.Keyword)(k);\n }\n },\n\n //\n // A function call\n //\n // rgb(255, 0, 255)\n //\n // The arguments are parsed with the `entities.arguments` parser.\n //\n call: function () {\n let name;\n let args;\n let func;\n const index = parserInput.i;\n\n // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18\n if (parserInput.peek(/^url\\(/i)) {\n return;\n }\n\n parserInput.save();\n\n name = parserInput.$re(/^([\\w-]+|%|~|progid:[\\w.]+)\\(/);\n if (!name) {\n parserInput.forget();\n return;\n }\n\n name = name[1];\n func = this.customFuncCall(name);\n if (func) {\n args = func.parse();\n if (args && func.stop) {\n parserInput.forget();\n return args;\n }\n }\n\n args = this.arguments(args);\n\n if (!parserInput.$char(')')) {\n parserInput.restore('Could not parse call arguments or missing \\')\\'');\n return;\n }\n\n parserInput.forget();\n\n return new(tree.Call)(name, args, index + currentIndex, fileInfo);\n },\n\n declarationCall: function () {\n let validCall;\n let args;\n const index = parserInput.i;\n\n parserInput.save();\n\n validCall = parserInput.$re(/^[\\w]+\\(/);\n if (!validCall) {\n parserInput.forget();\n return;\n }\n\n validCall = validCall.substring(0, validCall.length - 1);\n\n let rule = this.ruleProperty();\n let value;\n \n if (rule) {\n value = this.value();\n }\n \n if (rule && value) {\n args = [new (tree.Declaration)(rule, value, null, null, parserInput.i + currentIndex, fileInfo, true)];\n }\n\n if (!parserInput.$char(')')) {\n parserInput.restore('Could not parse call arguments or missing \\')\\'');\n return;\n }\n\n parserInput.forget();\n\n return new(tree.Call)(validCall, args, index + currentIndex, fileInfo);\n },\n\n //\n // Parsing rules for functions with non-standard args, e.g.:\n //\n // boolean(not(2 > 1))\n //\n // This is a quick prototype, to be modified/improved when\n // more custom-parsed funcs come (e.g. `selector(...)`)\n //\n\n customFuncCall: function (name) {\n /* Ideally the table is to be moved out of here for faster perf.,\n but it's quite tricky since it relies on all these `parsers`\n and `expect` available only here */\n return {\n alpha: f(parsers.ieAlpha, true),\n boolean: f(condition),\n 'if': f(condition)\n }[name.toLowerCase()];\n\n function f(parse, stop) {\n return {\n parse, // parsing function\n stop // when true - stop after parse() and return its result,\n // otherwise continue for plain args\n };\n }\n\n function condition() {\n return [expect(parsers.condition, 'expected condition')];\n }\n },\n\n arguments: function (prevArgs) {\n let argsComma = prevArgs || [];\n const argsSemiColon = [];\n let isSemiColonSeparated;\n let value;\n\n parserInput.save();\n\n while (true) {\n if (prevArgs) {\n prevArgs = false;\n } else {\n value = parsers.detachedRuleset() || this.assignment() || parsers.expression();\n if (!value) {\n break;\n }\n\n if (value.value && value.value.length == 1) {\n value = value.value[0];\n }\n\n argsComma.push(value);\n }\n\n if (parserInput.$char(',')) {\n continue;\n }\n\n if (parserInput.$char(';') || isSemiColonSeparated) {\n isSemiColonSeparated = true;\n value = (argsComma.length < 1) ? argsComma[0]\n : new tree.Value(argsComma);\n argsSemiColon.push(value);\n argsComma = [];\n }\n }\n\n parserInput.forget();\n return isSemiColonSeparated ? argsSemiColon : argsComma;\n },\n literal: function () {\n return this.dimension() ||\n this.color() ||\n this.quoted() ||\n this.unicodeDescriptor();\n },\n\n // Assignments are argument entities for calls.\n // They are present in ie filter properties as shown below.\n //\n // filter: progid:DXImageTransform.Microsoft.Alpha( *opacity=50* )\n //\n\n assignment: function () {\n let key;\n let value;\n parserInput.save();\n key = parserInput.$re(/^\\w+(?=\\s?=)/i);\n if (!key) {\n parserInput.restore();\n return;\n }\n if (!parserInput.$char('=')) {\n parserInput.restore();\n return;\n }\n value = parsers.entity();\n if (value) {\n parserInput.forget();\n return new(tree.Assignment)(key, value);\n } else {\n parserInput.restore();\n }\n },\n\n //\n // Parse url() tokens\n //\n // We use a specific rule for urls, because they don't really behave like\n // standard function calls. The difference is that the argument doesn't have\n // to be enclosed within a string, so it can't be parsed as an Expression.\n //\n url: function () {\n let value;\n const index = parserInput.i;\n\n parserInput.autoCommentAbsorb = false;\n\n if (!parserInput.$str('url(')) {\n parserInput.autoCommentAbsorb = true;\n return;\n }\n\n value = this.quoted() || this.variable() || this.property() ||\n parserInput.$re(/^(?:(?:\\\\[()'\"])|[^()'\"])+/) || '';\n\n parserInput.autoCommentAbsorb = true;\n\n expectChar(')');\n\n return new(tree.URL)((value.value !== undefined ||\n value instanceof tree.Variable ||\n value instanceof tree.Property) ?\n value : new(tree.Anonymous)(value, index), index + currentIndex, fileInfo);\n },\n\n //\n // A Variable entity, such as `@fink`, in\n //\n // width: @fink + 2px\n //\n // We use a different parser for variable definitions,\n // see `parsers.variable`.\n //\n variable: function () {\n let ch;\n let name;\n const index = parserInput.i;\n\n parserInput.save();\n if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^@@?[\\w-]+/))) {\n ch = parserInput.currentChar();\n if (ch === '(' || ch === '[' && !parserInput.prevChar().match(/^\\s/)) {\n // this may be a VariableCall lookup\n const result = parsers.variableCall(name);\n if (result) {\n parserInput.forget();\n return result;\n }\n }\n parserInput.forget();\n return new(tree.Variable)(name, index + currentIndex, fileInfo);\n }\n parserInput.restore();\n },\n\n // A variable entity using the protective {} e.g. @{var}\n variableCurly: function () {\n let curly;\n const index = parserInput.i;\n\n if (parserInput.currentChar() === '@' && (curly = parserInput.$re(/^@\\{([\\w-]+)\\}/))) {\n return new(tree.Variable)(`@${curly[1]}`, index + currentIndex, fileInfo);\n }\n },\n //\n // A Property accessor, such as `$color`, in\n //\n // background-color: $color\n //\n property: function () {\n let name;\n const index = parserInput.i;\n\n if (parserInput.currentChar() === '$' && (name = parserInput.$re(/^\\$[\\w-]+/))) {\n return new(tree.Property)(name, index + currentIndex, fileInfo);\n }\n },\n\n // A property entity useing the protective {} e.g. ${prop}\n propertyCurly: function () {\n let curly;\n const index = parserInput.i;\n\n if (parserInput.currentChar() === '$' && (curly = parserInput.$re(/^\\$\\{([\\w-]+)\\}/))) {\n return new(tree.Property)(`$${curly[1]}`, index + currentIndex, fileInfo);\n }\n },\n //\n // A Hexadecimal color\n //\n // #4F3C2F\n //\n // `rgb` and `hsl` colors are parsed through the `entities.call` parser.\n //\n color: function () {\n let rgb;\n parserInput.save();\n\n if (parserInput.currentChar() === '#' && (rgb = parserInput.$re(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})([\\w.#[])?/))) {\n if (!rgb[2]) {\n parserInput.forget();\n return new(tree.Color)(rgb[1], undefined, rgb[0]);\n }\n }\n parserInput.restore();\n },\n\n colorKeyword: function () {\n parserInput.save();\n const autoCommentAbsorb = parserInput.autoCommentAbsorb;\n parserInput.autoCommentAbsorb = false;\n const k = parserInput.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);\n parserInput.autoCommentAbsorb = autoCommentAbsorb;\n if (!k) {\n parserInput.forget();\n return;\n }\n parserInput.restore();\n const color = tree.Color.fromKeyword(k);\n if (color) {\n parserInput.$str(k);\n return color;\n }\n },\n\n //\n // A Dimension, that is, a number and a unit\n //\n // 0.5em 95%\n //\n dimension: function () {\n if (parserInput.peekNotNumeric()) {\n return;\n }\n\n const value = parserInput.$re(/^([+-]?\\d*\\.?\\d+)(%|[a-z_]+)?/i);\n if (value) {\n return new(tree.Dimension)(value[1], value[2]);\n }\n },\n\n //\n // A unicode descriptor, as is used in unicode-range\n //\n // U+0?? or U+00A1-00A9\n //\n unicodeDescriptor: function () {\n let ud;\n\n ud = parserInput.$re(/^U\\+[0-9a-fA-F?]+(-[0-9a-fA-F?]+)?/);\n if (ud) {\n return new(tree.UnicodeDescriptor)(ud[0]);\n }\n },\n\n //\n // JavaScript code to be evaluated\n //\n // `window.location.href`\n //\n javascript: function () {\n let js;\n const index = parserInput.i;\n\n parserInput.save();\n\n const escape = parserInput.$char('~');\n const jsQuote = parserInput.$char('`');\n\n if (!jsQuote) {\n parserInput.restore();\n return;\n }\n\n js = parserInput.$re(/^[^`]*`/);\n if (js) {\n parserInput.forget();\n return new(tree.JavaScript)(js.substr(0, js.length - 1), Boolean(escape), index + currentIndex, fileInfo);\n }\n parserInput.restore('invalid javascript definition');\n }\n },\n\n //\n // The variable part of a variable definition. Used in the `rule` parser\n //\n // @fink:\n //\n variable: function () {\n let name;\n\n if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^(@[\\w-]+)\\s*:/))) { return name[1]; }\n },\n\n //\n // Call a variable value to retrieve a detached ruleset\n // or a value from a detached ruleset's rules.\n //\n // @fink();\n // @fink;\n // color: @fink[@color];\n //\n variableCall: function (parsedName) {\n let lookups;\n const i = parserInput.i;\n const inValue = !!parsedName;\n let name = parsedName;\n\n parserInput.save();\n\n if (name || (parserInput.currentChar() === '@'\n && (name = parserInput.$re(/^(@[\\w-]+)(\\(\\s*\\))?/)))) {\n\n lookups = this.mixin.ruleLookups();\n\n if (!lookups && ((inValue && parserInput.$str('()') !== '()') || (name[2] !== '()'))) {\n parserInput.restore('Missing \\'[...]\\' lookup in variable call');\n return;\n }\n\n if (!inValue) {\n name = name[1];\n }\n\n const call = new tree.VariableCall(name, i, fileInfo);\n if (!inValue && parsers.end()) {\n parserInput.forget();\n return call;\n }\n else {\n parserInput.forget();\n return new tree.NamespaceValue(call, lookups, i, fileInfo);\n }\n }\n\n parserInput.restore();\n },\n\n //\n // extend syntax - used to extend selectors\n //\n extend: function(isRule) {\n let elements;\n let e;\n const index = parserInput.i;\n let option;\n let extendList;\n let extend;\n\n if (!parserInput.$str(isRule ? '&:extend(' : ':extend(')) {\n return;\n }\n\n do {\n option = null;\n elements = null;\n let first = true;\n while (!(option = parserInput.$re(/^(!?all)(?=\\s*(\\)|,))/))) {\n e = this.element();\n\n if (!e) {\n break;\n }\n /**\n * @note - This will not catch selectors in pseudos like :is() and :where() because\n * they don't currently parse their contents as selectors.\n */\n if (!first && e.combinator.value) {\n warn('Targeting complex selectors can have unexpected behavior, and this behavior may change in the future.', index)\n }\n\n first = false;\n if (elements) {\n elements.push(e);\n } else {\n elements = [ e ];\n }\n }\n\n option = option && option[1];\n if (!elements) {\n error('Missing target selector for :extend().');\n }\n extend = new(tree.Extend)(new(tree.Selector)(elements), option, index + currentIndex, fileInfo);\n if (extendList) {\n extendList.push(extend);\n } else {\n extendList = [ extend ];\n }\n } while (parserInput.$char(','));\n\n expect(/^\\)/);\n\n if (isRule) {\n expect(/^;/);\n }\n\n return extendList;\n },\n\n //\n // extendRule - used in a rule to extend all the parent selectors\n //\n extendRule: function() {\n return this.extend(true);\n },\n\n //\n // Mixins\n //\n mixin: {\n //\n // A Mixin call, with an optional argument list\n //\n // #mixins > .square(#fff);\n // #mixins.square(#fff);\n // .rounded(4px, black);\n // .button;\n //\n // We can lookup / return a value using the lookup syntax:\n //\n // color: #mixin.square(#fff)[@color];\n //\n // The `while` loop is there because mixins can be\n // namespaced, but we only support the child and descendant\n // selector for now.\n //\n call: function (inValue, getLookup) {\n const s = parserInput.currentChar();\n let important = false;\n let lookups;\n const index = parserInput.i;\n let elements;\n let args;\n let hasParens;\n let parensIndex;\n let parensWS = false;\n\n if (s !== '.' && s !== '#') { return; }\n\n parserInput.save(); // stop us absorbing part of an invalid selector\n\n elements = this.elements();\n\n if (elements) {\n parensIndex = parserInput.i;\n if (parserInput.$char('(')) {\n parensWS = parserInput.isWhitespace(-2);\n args = this.args(true).args;\n expectChar(')');\n hasParens = true;\n if (parensWS) {\n warn('Whitespace between a mixin name and parentheses for a mixin call is deprecated', parensIndex, 'DEPRECATED');\n }\n }\n\n if (getLookup !== false) {\n lookups = this.ruleLookups();\n }\n if (getLookup === true && !lookups) {\n parserInput.restore();\n return;\n }\n\n if (inValue && !lookups && !hasParens) {\n // This isn't a valid in-value mixin call\n parserInput.restore();\n return;\n }\n\n if (!inValue && parsers.important()) {\n important = true;\n }\n\n if (inValue || parsers.end()) {\n parserInput.forget();\n const mixin = new(tree.mixin.Call)(elements, args, index + currentIndex, fileInfo, !lookups && important);\n if (lookups) {\n return new tree.NamespaceValue(mixin, lookups);\n }\n else {\n if (!hasParens) {\n warn('Calling a mixin without parentheses is deprecated', parensIndex, 'DEPRECATED');\n }\n return mixin;\n }\n }\n }\n\n parserInput.restore();\n },\n /**\n * Matching elements for mixins\n * (Start with . or # and can have > )\n */\n elements: function() {\n let elements;\n let e;\n let c;\n let elem;\n let elemIndex;\n const re = /^[#.](?:[\\w-]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/;\n while (true) {\n elemIndex = parserInput.i;\n e = parserInput.$re(re);\n\n if (!e) {\n break;\n }\n elem = new(tree.Element)(c, e, false, elemIndex + currentIndex, fileInfo);\n if (elements) {\n elements.push(elem);\n } else {\n elements = [ elem ];\n }\n c = parserInput.$char('>');\n }\n return elements;\n },\n args: function (isCall) {\n const entities = parsers.entities;\n const returner = { args:null, variadic: false };\n let expressions = [];\n const argsSemiColon = [];\n const argsComma = [];\n let isSemiColonSeparated;\n let expressionContainsNamed;\n let name;\n let nameLoop;\n let value;\n let arg;\n let expand;\n let hasSep = true;\n\n parserInput.save();\n\n while (true) {\n if (isCall) {\n arg = parsers.detachedRuleset() || parsers.expression();\n } else {\n parserInput.commentStore.length = 0;\n if (parserInput.$str('...')) {\n returner.variadic = true;\n if (parserInput.$char(';') && !isSemiColonSeparated) {\n isSemiColonSeparated = true;\n }\n (isSemiColonSeparated ? argsSemiColon : argsComma)\n .push({ variadic: true });\n break;\n }\n arg = entities.variable() || entities.property() || entities.literal() || entities.keyword() || this.call(true);\n }\n\n if (!arg || !hasSep) {\n break;\n }\n\n nameLoop = null;\n if (arg.throwAwayComments) {\n arg.throwAwayComments();\n }\n value = arg;\n let val = null;\n\n if (isCall) {\n // Variable\n if (arg.value && arg.value.length == 1) {\n val = arg.value[0];\n }\n } else {\n val = arg;\n }\n\n if (val && (val instanceof tree.Variable || val instanceof tree.Property)) {\n if (parserInput.$char(':')) {\n if (expressions.length > 0) {\n if (isSemiColonSeparated) {\n error('Cannot mix ; and , as delimiter types');\n }\n expressionContainsNamed = true;\n }\n\n value = parsers.detachedRuleset() || parsers.expression();\n\n if (!value) {\n if (isCall) {\n error('could not understand value for named argument');\n } else {\n parserInput.restore();\n returner.args = [];\n return returner;\n }\n }\n nameLoop = (name = val.name);\n } else if (parserInput.$str('...')) {\n if (!isCall) {\n returner.variadic = true;\n if (parserInput.$char(';') && !isSemiColonSeparated) {\n isSemiColonSeparated = true;\n }\n (isSemiColonSeparated ? argsSemiColon : argsComma)\n .push({ name: arg.name, variadic: true });\n break;\n } else {\n expand = true;\n }\n } else if (!isCall) {\n name = nameLoop = val.name;\n value = null;\n }\n }\n\n if (value) {\n expressions.push(value);\n }\n\n argsComma.push({ name:nameLoop, value, expand });\n\n if (parserInput.$char(',')) {\n hasSep = true;\n continue;\n }\n hasSep = parserInput.$char(';') === ';';\n\n if (hasSep || isSemiColonSeparated) {\n\n if (expressionContainsNamed) {\n error('Cannot mix ; and , as delimiter types');\n }\n\n isSemiColonSeparated = true;\n\n if (expressions.length > 1) {\n value = new(tree.Value)(expressions);\n }\n argsSemiColon.push({ name, value, expand });\n\n name = null;\n expressions = [];\n expressionContainsNamed = false;\n }\n }\n\n parserInput.forget();\n returner.args = isSemiColonSeparated ? argsSemiColon : argsComma;\n return returner;\n },\n //\n // A Mixin definition, with a list of parameters\n //\n // .rounded (@radius: 2px, @color) {\n // ...\n // }\n //\n // Until we have a finer grained state-machine, we have to\n // do a look-ahead, to make sure we don't have a mixin call.\n // See the `rule` function for more information.\n //\n // We start by matching `.rounded (`, and then proceed on to\n // the argument list, which has optional default values.\n // We store the parameters in `params`, with a `value` key,\n // if there is a value, such as in the case of `@radius`.\n //\n // Once we've got our params list, and a closing `)`, we parse\n // the `{...}` block.\n //\n definition: function () {\n let name;\n let params = [];\n let match;\n let ruleset;\n let cond;\n let variadic = false;\n if ((parserInput.currentChar() !== '.' && parserInput.currentChar() !== '#') ||\n parserInput.peek(/^[^{]*\\}/)) {\n return;\n }\n\n parserInput.save();\n\n match = parserInput.$re(/^([#.](?:[\\w-]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\\s*\\(/);\n if (match) {\n name = match[1];\n\n const argInfo = this.args(false);\n params = argInfo.args;\n variadic = argInfo.variadic;\n\n // .mixincall(\"@{a}\");\n // looks a bit like a mixin definition..\n // also\n // .mixincall(@a: {rule: set;});\n // so we have to be nice and restore\n if (!parserInput.$char(')')) {\n parserInput.restore('Missing closing \\')\\'');\n return;\n }\n\n parserInput.commentStore.length = 0;\n\n if (parserInput.$str('when')) { // Guard\n cond = expect(parsers.conditions, 'expected condition');\n }\n\n ruleset = parsers.block();\n\n if (ruleset) {\n parserInput.forget();\n return new(tree.mixin.Definition)(name, params, ruleset, cond, variadic);\n } else {\n parserInput.restore();\n }\n } else {\n parserInput.restore();\n }\n },\n\n ruleLookups: function() {\n let rule;\n const lookups = [];\n\n if (parserInput.currentChar() !== '[') {\n return;\n }\n\n while (true) {\n parserInput.save();\n rule = this.lookupValue();\n if (!rule && rule !== '') {\n parserInput.restore();\n break;\n }\n lookups.push(rule);\n parserInput.forget();\n }\n if (lookups.length > 0) {\n return lookups;\n }\n },\n\n lookupValue: function() {\n parserInput.save();\n\n if (!parserInput.$char('[')) {\n parserInput.restore();\n return;\n }\n\n const name = parserInput.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/);\n\n if (!parserInput.$char(']')) {\n parserInput.restore();\n return;\n }\n\n if (name || name === '') {\n parserInput.forget();\n return name;\n }\n\n parserInput.restore();\n }\n },\n //\n // Entities are the smallest recognized token,\n // and can be found inside a rule's value.\n //\n entity: function () {\n const entities = this.entities;\n\n return this.comment() || entities.literal() || entities.variable() || entities.url() ||\n entities.property() || entities.call() || entities.keyword() || this.mixin.call(true) ||\n entities.javascript();\n },\n\n //\n // A Declaration terminator. Note that we use `peek()` to check for '}',\n // because the `block` rule will be expecting it, but we still need to make sure\n // it's there, if ';' was omitted.\n //\n end: function () {\n return parserInput.$char(';') || parserInput.peek('}');\n },\n\n //\n // IE's alpha function\n //\n // alpha(opacity=88)\n //\n ieAlpha: function () {\n let value;\n\n // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18\n if (!parserInput.$re(/^opacity=/i)) { return; }\n value = parserInput.$re(/^\\d+/);\n if (!value) {\n value = expect(parsers.entities.variable, 'Could not parse alpha');\n value = `@{${value.name.slice(1)}}`;\n }\n expectChar(')');\n return new tree.Quoted('', `alpha(opacity=${value})`);\n },\n\n /** \n * A Selector Element\n *\n * div\n * + h1\n * #socks\n * input[type=\"text\"]\n *\n * Elements are the building blocks for Selectors,\n * they are made out of a `Combinator` (see combinator rule),\n * and an element name, such as a tag a class, or `*`.\n */\n element: function () {\n let e;\n let c;\n let v;\n const index = parserInput.i;\n\n c = this.combinator();\n\n /** This selector parser is quite simplistic and will pass a number of invalid selectors. */\n e = parserInput.$re(/^(?:\\d+\\.\\d+|\\d+)%/) ||\n // eslint-disable-next-line no-control-regex\n parserInput.$re(/^(?:[.#]?|:*)(?:[\\w-]|[^\\x00-\\x9f]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/) ||\n parserInput.$char('*') || parserInput.$char('&') || this.attribute() ||\n parserInput.$re(/^\\([^&()@]+\\)/) || parserInput.$re(/^[.#:](?=@)/) ||\n this.entities.variableCurly();\n\n if (!e) {\n parserInput.save();\n if (parserInput.$char('(')) {\n if ((v = this.selector(false))) {\n let selectors = [];\n while (parserInput.$char(',')) {\n selectors.push(v);\n selectors.push(new Anonymous(','));\n v = this.selector(false);\n }\n selectors.push(v);\n \n if (parserInput.$char(')')) {\n if (selectors.length > 1) {\n e = new (tree.Paren)(new Selector(selectors));\n } else {\n e = new(tree.Paren)(v);\n }\n parserInput.forget();\n } else {\n parserInput.restore('Missing closing \\')\\'');\n }\n } else {\n parserInput.restore('Missing closing \\')\\'');\n }\n } else {\n parserInput.forget();\n }\n }\n\n if (e) { return new(tree.Element)(c, e, e instanceof tree.Variable, index + currentIndex, fileInfo); }\n },\n\n //\n // Combinators combine elements together, in a Selector.\n //\n // Because our parser isn't white-space sensitive, special care\n // has to be taken, when parsing the descendant combinator, ` `,\n // as it's an empty space. We have to check the previous character\n // in the input, to see if it's a ` ` character. More info on how\n // we deal with this in *combinator.js*.\n //\n combinator: function () {\n let c = parserInput.currentChar();\n\n if (c === '/') {\n parserInput.save();\n const slashedCombinator = parserInput.$re(/^\\/[a-z]+\\//i);\n if (slashedCombinator) {\n parserInput.forget();\n return new(tree.Combinator)(slashedCombinator);\n }\n parserInput.restore();\n }\n\n if (c === '>' || c === '+' || c === '~' || c === '|' || c === '^') {\n parserInput.i++;\n if (c === '^' && parserInput.currentChar() === '^') {\n c = '^^';\n parserInput.i++;\n }\n while (parserInput.isWhitespace()) { parserInput.i++; }\n return new(tree.Combinator)(c);\n } else if (parserInput.isWhitespace(-1)) {\n return new(tree.Combinator)(' ');\n } else {\n return new(tree.Combinator)(null);\n }\n },\n //\n // A CSS Selector\n // with less extensions e.g. the ability to extend and guard\n //\n // .class > div + h1\n // li a:hover\n //\n // Selectors are made out of one or more Elements, see above.\n //\n selector: function (isLess) {\n const index = parserInput.i;\n let elements;\n let extendList;\n let c;\n let e;\n let allExtends;\n let when;\n let condition;\n isLess = isLess !== false;\n while ((isLess && (extendList = this.extend())) || (isLess && (when = parserInput.$str('when'))) || (e = this.element())) {\n if (when) {\n condition = expect(this.conditions, 'expected condition');\n } else if (condition) {\n error('CSS guard can only be used at the end of selector');\n } else if (extendList) {\n if (allExtends) {\n allExtends = allExtends.concat(extendList);\n } else {\n allExtends = extendList;\n }\n } else {\n if (allExtends) { error('Extend can only be used at the end of selector'); }\n c = parserInput.currentChar();\n if (Array.isArray(e)){\n e.forEach(ele => elements.push(ele));\n } if (elements) {\n elements.push(e);\n } else {\n elements = [ e ];\n }\n e = null;\n }\n if (c === '{' || c === '}' || c === ';' || c === ',' || c === ')') {\n break;\n }\n }\n\n if (elements) { return new(tree.Selector)(elements, allExtends, condition, index + currentIndex, fileInfo); }\n if (allExtends) { error('Extend must be used to extend a selector, it cannot be used on its own'); }\n },\n selectors: function () {\n let s;\n let selectors;\n while (true) {\n s = this.selector();\n if (!s) {\n break;\n }\n if (selectors) {\n selectors.push(s);\n } else {\n selectors = [ s ];\n }\n parserInput.commentStore.length = 0;\n if (s.condition && selectors.length > 1) {\n error('Guards are only currently allowed on a single selector.');\n }\n if (!parserInput.$char(',')) { break; }\n if (s.condition) {\n error('Guards are only currently allowed on a single selector.');\n }\n parserInput.commentStore.length = 0;\n }\n return selectors;\n },\n attribute: function () {\n if (!parserInput.$char('[')) { return; }\n\n const entities = this.entities;\n let key;\n let val;\n let op;\n //\n // case-insensitive flag\n // e.g. [attr operator value i]\n //\n let cif;\n\n if (!(key = entities.variableCurly())) {\n key = expect(/^(?:[_A-Za-z0-9-*]*\\|)?(?:[_A-Za-z0-9-]|\\\\.)+/);\n }\n\n op = parserInput.$re(/^[|~*$^]?=/);\n if (op) {\n val = entities.quoted() || parserInput.$re(/^[0-9]+%/) || parserInput.$re(/^[\\w-]+/) || entities.variableCurly();\n if (val) {\n cif = parserInput.$re(/^[iIsS]/);\n }\n }\n\n expectChar(']');\n\n return new(tree.Attribute)(key, op, val, cif);\n },\n\n //\n // The `block` rule is used by `ruleset` and `mixin.definition`.\n // It's a wrapper around the `primary` rule, with added `{}`.\n //\n block: function () {\n let content;\n if (parserInput.$char('{') && (content = this.primary()) && parserInput.$char('}')) {\n return content;\n }\n },\n\n blockRuleset: function() {\n let block = this.block();\n\n if (block) {\n block = new tree.Ruleset(null, block);\n }\n return block;\n },\n\n detachedRuleset: function() {\n let argInfo;\n let params;\n let variadic;\n\n parserInput.save();\n if (parserInput.$re(/^[.#]\\(/)) {\n /**\n * DR args currently only implemented for each() function, and not\n * yet settable as `@dr: #(@arg) {}`\n * This should be done when DRs are merged with mixins.\n * See: https://github.com/less/less-meta/issues/16\n */\n argInfo = this.mixin.args(false);\n params = argInfo.args;\n variadic = argInfo.variadic;\n if (!parserInput.$char(')')) {\n parserInput.restore();\n return;\n }\n }\n const blockRuleset = this.blockRuleset();\n if (blockRuleset) {\n parserInput.forget();\n if (params) {\n return new tree.mixin.Definition(null, params, blockRuleset, null, variadic);\n }\n return new tree.DetachedRuleset(blockRuleset);\n }\n parserInput.restore();\n },\n\n //\n // div, .class, body > p {...}\n //\n ruleset: function () {\n let selectors;\n let rules;\n let debugInfo;\n\n parserInput.save();\n\n if (context.dumpLineNumbers) {\n debugInfo = getDebugInfo(parserInput.i);\n }\n\n selectors = this.selectors();\n\n if (selectors && (rules = this.block())) {\n parserInput.forget();\n const ruleset = new(tree.Ruleset)(selectors, rules, context.strictImports);\n if (context.dumpLineNumbers) {\n ruleset.debugInfo = debugInfo;\n }\n return ruleset;\n } else {\n parserInput.restore();\n }\n },\n declaration: function () {\n let name;\n let value;\n const index = parserInput.i;\n let hasDR;\n const c = parserInput.currentChar();\n let important;\n let merge;\n let isVariable;\n\n if (c === '.' || c === '#' || c === '&' || c === ':') { return; }\n\n parserInput.save();\n\n name = this.variable() || this.ruleProperty();\n if (name) {\n isVariable = typeof name === 'string';\n\n if (isVariable) {\n value = this.detachedRuleset();\n if (value) {\n hasDR = true;\n }\n }\n\n parserInput.commentStore.length = 0;\n if (!value) {\n // a name returned by this.ruleProperty() is always an array of the form:\n // [string-1, ..., string-n, \"\"] or [string-1, ..., string-n, \"+\"]\n // where each item is a tree.Keyword or tree.Variable\n merge = !isVariable && name.length > 1 && name.pop().value;\n\n // Custom property values get permissive parsing\n if (name[0].value && name[0].value.slice(0, 2) === '--') {\n if (parserInput.$char(';')) {\n value = new Anonymous('');\n } else {\n value = this.permissiveValue(/[;}]/, true);\n }\n }\n // Try to store values as anonymous\n // If we need the value later we'll re-parse it in ruleset.parseValue\n else {\n value = this.anonymousValue();\n }\n if (value) {\n parserInput.forget();\n // anonymous values absorb the end ';' which is required for them to work\n return new(tree.Declaration)(name, value, false, merge, index + currentIndex, fileInfo);\n }\n\n if (!value) {\n value = this.value();\n }\n\n if (value) {\n important = this.important();\n } else if (isVariable) {\n /**\n * As a last resort, try permissiveValue\n *\n * @todo - This has created some knock-on problems of not\n * flagging incorrect syntax or detecting user intent.\n */\n value = this.permissiveValue();\n }\n }\n\n if (value && (this.end() || hasDR)) {\n parserInput.forget();\n return new(tree.Declaration)(name, value, important, merge, index + currentIndex, fileInfo);\n }\n else {\n parserInput.restore();\n }\n } else {\n parserInput.restore();\n }\n },\n anonymousValue: function () {\n const index = parserInput.i;\n const match = parserInput.$re(/^([^.#@$+/'\"*`(;{}-]*);/);\n if (match) {\n return new(tree.Anonymous)(match[1], index + currentIndex);\n }\n },\n /**\n * Used for custom properties, at-rules, and variables (as fallback)\n * Parses almost anything inside of {} [] () \"\" blocks\n * until it reaches outer-most tokens.\n *\n * First, it will try to parse comments and entities to reach\n * the end. This is mostly like the Expression parser except no\n * math is allowed.\n * \n * @param {RexExp} untilTokens - Characters to stop parsing at\n */\n permissiveValue: function (untilTokens) {\n let i;\n let e;\n let done;\n let value;\n const tok = untilTokens || ';';\n const index = parserInput.i;\n const result = [];\n\n function testCurrentChar() {\n const char = parserInput.currentChar();\n if (typeof tok === 'string') {\n return char === tok;\n } else {\n return tok.test(char);\n }\n }\n if (testCurrentChar()) {\n return;\n }\n value = [];\n do {\n e = this.comment();\n if (e) {\n value.push(e);\n continue;\n }\n e = this.entity();\n if (e) {\n value.push(e);\n }\n if (parserInput.peek(',')) {\n value.push(new (tree.Anonymous)(',', parserInput.i));\n parserInput.$char(',');\n }\n } while (e);\n\n done = testCurrentChar();\n\n if (value.length > 0) {\n value = new(tree.Expression)(value);\n if (done) {\n return value;\n }\n else {\n result.push(value);\n }\n // Preserve space before $parseUntil as it will not\n if (parserInput.prevChar() === ' ') {\n result.push(new tree.Anonymous(' ', index));\n }\n }\n parserInput.save();\n\n value = parserInput.$parseUntil(tok);\n\n if (value) {\n if (typeof value === 'string') {\n error(`Expected '${value}'`, 'Parse');\n }\n if (value.length === 1 && value[0] === ' ') {\n parserInput.forget();\n return new tree.Anonymous('', index);\n }\n /** @type {string} */\n let item;\n for (i = 0; i < value.length; i++) {\n item = value[i];\n if (Array.isArray(item)) {\n // Treat actual quotes as normal quoted values\n result.push(new tree.Quoted(item[0], item[1], true, index, fileInfo));\n }\n else {\n if (i === value.length - 1) {\n item = item.trim();\n }\n // Treat like quoted values, but replace vars like unquoted expressions\n const quote = new tree.Quoted('\\'', item, true, index, fileInfo);\n const variableRegex = /@([\\w-]+)/g;\n const propRegex = /\\$([\\w-]+)/g;\n if (variableRegex.test(item)) {\n warn('@[ident] in unknown values will not be evaluated as variables in the future. Use @{[ident]}', index, 'DEPRECATED');\n }\n if (propRegex.test(item)) {\n warn('$[ident] in unknown values will not be evaluated as property references in the future. Use ${[ident]}', index, 'DEPRECATED');\n }\n quote.variableRegex = /@([\\w-]+)|@{([\\w-]+)}/g;\n quote.propRegex = /\\$([\\w-]+)|\\${([\\w-]+)}/g;\n result.push(quote);\n }\n }\n parserInput.forget();\n return new tree.Expression(result, true);\n }\n parserInput.restore();\n },\n\n //\n // An @import atrule\n //\n // @import \"lib\";\n //\n // Depending on our environment, importing is done differently:\n // In the browser, it's an XHR request, in Node, it would be a\n // file-system operation. The function used for importing is\n // stored in `import`, which we pass to the Import constructor.\n //\n 'import': function () {\n let path;\n let features;\n const index = parserInput.i;\n\n const dir = parserInput.$re(/^@import\\s+/);\n\n if (dir) {\n const options = (dir ? this.importOptions() : null) || {};\n\n if ((path = this.entities.quoted() || this.entities.url())) {\n features = this.mediaFeatures({});\n\n if (!parserInput.$char(';')) {\n parserInput.i = index;\n error('missing semi-colon or unrecognised media features on import');\n }\n features = features && new(tree.Value)(features);\n return new(tree.Import)(path, features, options, index + currentIndex, fileInfo);\n }\n else {\n parserInput.i = index;\n error('malformed import statement');\n }\n }\n },\n\n importOptions: function() {\n let o;\n const options = {};\n let optionName;\n let value;\n\n // list of options, surrounded by parens\n if (!parserInput.$char('(')) { return null; }\n do {\n o = this.importOption();\n if (o) {\n optionName = o;\n value = true;\n switch (optionName) {\n case 'css':\n optionName = 'less';\n value = false;\n break;\n case 'once':\n optionName = 'multiple';\n value = false;\n break;\n }\n options[optionName] = value;\n if (!parserInput.$char(',')) { break; }\n }\n } while (o);\n expectChar(')');\n return options;\n },\n\n importOption: function() {\n const opt = parserInput.$re(/^(less|css|multiple|once|inline|reference|optional)/);\n if (opt) {\n return opt[1];\n }\n },\n\n mediaFeature: function (syntaxOptions) {\n const entities = this.entities;\n const nodes = [];\n let e;\n let p;\n let rangeP;\n let spacing = false;\n parserInput.save();\n do {\n parserInput.save();\n if (parserInput.$re(/^[0-9a-z-]*\\s+\\(/)) {\n spacing = true;\n }\n parserInput.restore();\n\n e = entities.declarationCall.bind(this)() || entities.keyword() || entities.variable() || entities.mixinLookup()\n if (e) {\n nodes.push(e);\n } else if (parserInput.$char('(')) {\n p = this.property();\n parserInput.save();\n if (!p && syntaxOptions.queryInParens && parserInput.$re(/^[0-9a-z-]*\\s*([<>]=|<=|>=|[<>]|=)/)) {\n parserInput.restore();\n p = this.condition();\n\n parserInput.save();\n rangeP = this.atomicCondition(null, p.rvalue);\n if (!rangeP) {\n parserInput.restore();\n }\n } else {\n parserInput.restore();\n e = this.value();\n }\n if (parserInput.$char(')')) {\n if (p && !e) {\n nodes.push(new (tree.Paren)(new (tree.QueryInParens)(p.op, p.lvalue, p.rvalue, rangeP ? rangeP.op : null, rangeP ? rangeP.rvalue : null, p._index)));\t\t\t\t \n e = p;\n } else if (p && e) {\n nodes.push(new (tree.Paren)(new (tree.Declaration)(p, e, null, null, parserInput.i + currentIndex, fileInfo, true)));\n if (!spacing) {\n nodes[nodes.length - 1].noSpacing = true;\n }\n spacing = false;\n } else if (e) {\n nodes.push(new(tree.Paren)(e));\n spacing = false;\n } else {\n error('badly formed media feature definition');\n }\n } else {\n error('Missing closing \\')\\'', 'Parse');\n }\n }\n } while (e);\n\n parserInput.forget();\n if (nodes.length > 0) {\n return new(tree.Expression)(nodes);\n }\n },\n\n mediaFeatures: function (syntaxOptions) {\n const entities = this.entities;\n const features = [];\n let e;\n do {\n e = this.mediaFeature(syntaxOptions);\n if (e) {\n features.push(e);\n if (!parserInput.$char(',')) { break; }\n else if (!features[features.length - 1].noSpacing) {\n features[features.length - 1].noSpacing = false;\n }\n } else {\n e = entities.variable() || entities.mixinLookup();\n if (e) {\n features.push(e);\n if (!parserInput.$char(',')) { break; }\n else if (!features[features.length - 1].noSpacing) {\n features[features.length - 1].noSpacing = false;\n }\n }\n }\n } while (e);\n\n return features.length > 0 ? features : null;\n },\n\n prepareAndGetNestableAtRule: function (treeType, index, debugInfo, syntaxOptions) {\n const features = this.mediaFeatures(syntaxOptions);\n\n const rules = this.block();\n\n if (!rules) {\n error('media definitions require block statements after any features');\n }\n\n parserInput.forget();\n\n const atRule = new (treeType)(rules, features, index + currentIndex, fileInfo);\n if (context.dumpLineNumbers) {\n atRule.debugInfo = debugInfo;\n }\n\n return atRule;\n },\n\n nestableAtRule: function () {\n let debugInfo;\n const index = parserInput.i;\n\n if (context.dumpLineNumbers) {\n debugInfo = getDebugInfo(index);\n }\n parserInput.save();\n\n if (parserInput.$peekChar('@')) {\n if (parserInput.$str('@media')) {\n return this.prepareAndGetNestableAtRule(tree.Media, index, debugInfo, MediaSyntaxOptions);\n }\n \n if (parserInput.$str('@container')) {\n return this.prepareAndGetNestableAtRule(tree.Container, index, debugInfo, ContainerSyntaxOptions);\n }\n }\n \n parserInput.restore();\n },\n\n //\n\n // A @plugin directive, used to import plugins dynamically.\n //\n // @plugin (args) \"lib\";\n //\n plugin: function () {\n let path;\n let args;\n let options;\n const index = parserInput.i;\n const dir = parserInput.$re(/^@plugin\\s+/);\n\n if (dir) {\n args = this.pluginArgs();\n\n if (args) {\n options = {\n pluginArgs: args,\n isPlugin: true\n };\n }\n else {\n options = { isPlugin: true };\n }\n\n if ((path = this.entities.quoted() || this.entities.url())) {\n\n if (!parserInput.$char(';')) {\n parserInput.i = index;\n error('missing semi-colon on @plugin');\n }\n return new(tree.Import)(path, null, options, index + currentIndex, fileInfo);\n }\n else {\n parserInput.i = index;\n error('malformed @plugin statement');\n }\n }\n },\n\n pluginArgs: function() {\n // list of options, surrounded by parens\n parserInput.save();\n if (!parserInput.$char('(')) {\n parserInput.restore();\n return null;\n }\n const args = parserInput.$re(/^\\s*([^);]+)\\)\\s*/);\n if (args[1]) {\n parserInput.forget();\n return args[1].trim();\n }\n else {\n parserInput.restore();\n return null;\n }\n },\n atruleUnknown: function (value, name, hasBlock) {\n value = this.permissiveValue(/^[{;]/);\n hasBlock = (parserInput.currentChar() === '{');\n if (!value) {\n if (!hasBlock && parserInput.currentChar() !== ';') {\n error(''.concat(name, ' rule is missing block or ending semi-colon'));\n }\n }\n else if (!value.value) {\n value = null;\n }\n return [value, hasBlock];\n },\n atruleBlock: function (rules, value, isRooted, isKeywordList) {\n rules = this.blockRuleset();\n parserInput.save();\n if (!rules && !isRooted) {\n value = this.entity();\n rules = this.blockRuleset();\n }\n if (!rules && !isRooted) {\n parserInput.restore();\n var e = [];\n value = this.entity();\n while (parserInput.$char(',')) {\n e.push(value);\n value = this.entity();\n }\n if (value && e.length > 0) {\n e.push(value);\n value = e;\n isKeywordList = true;\n }\n else {\n rules = this.blockRuleset();\n }\n }\n else {\n parserInput.forget();\n }\n \n return [rules, value, isKeywordList];\n },\n //\n // A CSS AtRule\n //\n // @charset \"utf-8\";\n //\n atrule: function () {\n const index = parserInput.i;\n let name;\n let value;\n let rules;\n let nonVendorSpecificName;\n let hasIdentifier;\n let hasExpression;\n let hasUnknown;\n let hasBlock = true;\n let isRooted = true;\n let isKeywordList = false;\n\n if (parserInput.currentChar() !== '@') { return; }\n\n value = this['import']() || this.plugin() || this.nestableAtRule();\n if (value) {\n return value;\n }\n\n parserInput.save();\n\n name = parserInput.$re(/^@[a-z-]+/);\n\n if (!name) { return; }\n\n nonVendorSpecificName = name;\n if (name.charAt(1) == '-' && name.indexOf('-', 2) > 0) {\n nonVendorSpecificName = `@${name.slice(name.indexOf('-', 2) + 1)}`;\n }\n\n switch (nonVendorSpecificName) {\n case '@charset':\n hasIdentifier = true;\n hasBlock = false;\n break;\n case '@namespace':\n hasExpression = true;\n hasBlock = false;\n break;\n case '@keyframes':\n case '@counter-style':\n hasIdentifier = true;\n break;\n case '@document':\n case '@supports':\n hasUnknown = true;\n isRooted = false;\n break;\n case '@starting-style':\n isRooted = false;\n break;\n case '@layer':\n isRooted = false;\n break;\n default:\n hasUnknown = true;\n break;\n }\n\n parserInput.commentStore.length = 0;\n\n if (hasIdentifier) {\n value = this.entity();\n if (!value) {\n error(`expected ${name} identifier`);\n }\n } else if (hasExpression) {\n value = this.expression();\n if (!value) {\n error(`expected ${name} expression`);\n }\n } else if (hasUnknown) {\n const unknownPackage = this.atruleUnknown(value, name, hasBlock);\n value = unknownPackage[0];\n hasBlock = unknownPackage[1];\n }\n \n if (hasBlock) {\n let blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList);\n rules = blockPackage[0];\n value = blockPackage[1];\n isKeywordList = blockPackage[2];\n\n if (!rules && !hasUnknown) {\n parserInput.restore();\n name = parserInput.$re(/^@[a-z-]+/);\n const unknownPackage = this.atruleUnknown(value, name, hasBlock);\n value = unknownPackage[0];\n hasBlock = unknownPackage[1];\n if (hasBlock) {\n blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList);\n rules = blockPackage[0];\n value = blockPackage[1];\n isKeywordList = blockPackage[2];\n }\n }\n }\n\n if (rules || isKeywordList || (!hasBlock && value && parserInput.$char(';'))) {\n parserInput.forget();\n return new(tree.AtRule)(name, value, rules, index + currentIndex, fileInfo,\n context.dumpLineNumbers ? getDebugInfo(index) : null,\n isRooted\n );\n }\n\n parserInput.restore('at-rule options not recognised');\n },\n\n //\n // A Value is a comma-delimited list of Expressions\n //\n // font-family: Baskerville, Georgia, serif;\n //\n // In a Rule, a Value represents everything after the `:`,\n // and before the `;`.\n //\n value: function () {\n let e;\n const expressions = [];\n const index = parserInput.i;\n\n do {\n e = this.expression();\n if (e) {\n expressions.push(e);\n if (!parserInput.$char(',')) { break; }\n }\n } while (e);\n\n if (expressions.length > 0) {\n return new(tree.Value)(expressions, index + currentIndex);\n }\n },\n important: function () {\n if (parserInput.currentChar() === '!') {\n return parserInput.$re(/^! *important/);\n }\n },\n sub: function () {\n let a;\n let e;\n\n parserInput.save();\n if (parserInput.$char('(')) {\n a = this.addition();\n if (a && parserInput.$char(')')) {\n parserInput.forget();\n e = new(tree.Expression)([a]);\n e.parens = true;\n return e;\n }\n parserInput.restore('Expected \\')\\'');\n return;\n }\n parserInput.restore();\n },\n colorOperand: function () {\n parserInput.save();\n \n // hsl or rgb or lch operand\n const match = parserInput.$re(/^[lchrgbs]\\s+/);\n if (match) {\n return new tree.Keyword(match[0]);\n }\n\n parserInput.restore();\n },\n multiplication: function () {\n let m;\n let a;\n let op;\n let operation;\n let isSpaced;\n m = this.operand();\n if (m) {\n isSpaced = parserInput.isWhitespace(-1);\n while (true) {\n if (parserInput.peek(/^\\/[*/]/)) {\n break;\n }\n\n parserInput.save();\n\n op = parserInput.$char('/') || parserInput.$char('*');\n if (!op) {\n let index = parserInput.i;\n op = parserInput.$str('./');\n if (op) {\n warn('./ operator is deprecated', index, 'DEPRECATED');\n }\n }\n\n if (!op) { parserInput.forget(); break; }\n\n a = this.operand();\n\n if (!a) { parserInput.restore(); break; }\n parserInput.forget();\n\n m.parensInOp = true;\n a.parensInOp = true;\n operation = new(tree.Operation)(op, [operation || m, a], isSpaced);\n isSpaced = parserInput.isWhitespace(-1);\n }\n return operation || m;\n }\n },\n addition: function () {\n let m;\n let a;\n let op;\n let operation;\n let isSpaced;\n m = this.multiplication();\n if (m) {\n isSpaced = parserInput.isWhitespace(-1);\n while (true) {\n op = parserInput.$re(/^[-+]\\s+/) || (!isSpaced && (parserInput.$char('+') || parserInput.$char('-')));\n if (!op) {\n break;\n }\n a = this.multiplication();\n if (!a) {\n break;\n }\n\n m.parensInOp = true;\n a.parensInOp = true;\n operation = new(tree.Operation)(op, [operation || m, a], isSpaced);\n isSpaced = parserInput.isWhitespace(-1);\n }\n return operation || m;\n }\n },\n conditions: function () {\n let a;\n let b;\n const index = parserInput.i;\n let condition;\n\n a = this.condition(true);\n if (a) {\n while (true) {\n if (!parserInput.peek(/^,\\s*(not\\s*)?\\(/) || !parserInput.$char(',')) {\n break;\n }\n b = this.condition(true);\n if (!b) {\n break;\n }\n condition = new(tree.Condition)('or', condition || a, b, index + currentIndex);\n }\n return condition || a;\n }\n },\n condition: function (needsParens) {\n let result;\n let logical;\n let next;\n function or() {\n return parserInput.$str('or');\n }\n\n result = this.conditionAnd(needsParens);\n if (!result) {\n return ;\n }\n logical = or();\n if (logical) {\n next = this.condition(needsParens);\n if (next) {\n result = new(tree.Condition)(logical, result, next);\n } else {\n return ;\n }\n }\n return result;\n },\n conditionAnd: function (needsParens) {\n let result;\n let logical;\n let next;\n const self = this;\n function insideCondition() {\n const cond = self.negatedCondition(needsParens) || self.parenthesisCondition(needsParens);\n if (!cond && !needsParens) {\n return self.atomicCondition(needsParens);\n }\n return cond;\n }\n function and() {\n return parserInput.$str('and');\n }\n\n result = insideCondition();\n if (!result) {\n return ;\n }\n logical = and();\n if (logical) {\n next = this.conditionAnd(needsParens);\n if (next) {\n result = new(tree.Condition)(logical, result, next);\n } else {\n return ;\n }\n }\n return result;\n },\n negatedCondition: function (needsParens) {\n if (parserInput.$str('not')) {\n const result = this.parenthesisCondition(needsParens);\n if (result) {\n result.negate = !result.negate;\n }\n return result;\n }\n },\n parenthesisCondition: function (needsParens) {\n function tryConditionFollowedByParenthesis(me) {\n let body;\n parserInput.save();\n body = me.condition(needsParens);\n if (!body) {\n parserInput.restore();\n return ;\n }\n if (!parserInput.$char(')')) {\n parserInput.restore();\n return ;\n }\n parserInput.forget();\n return body;\n }\n\n let body;\n parserInput.save();\n if (!parserInput.$str('(')) {\n parserInput.restore();\n return ;\n }\n body = tryConditionFollowedByParenthesis(this);\n if (body) {\n parserInput.forget();\n return body;\n }\n\n body = this.atomicCondition(needsParens);\n if (!body) {\n parserInput.restore();\n return ;\n }\n if (!parserInput.$char(')')) {\n parserInput.restore(`expected ')' got '${parserInput.currentChar()}'`);\n return ;\n }\n parserInput.forget();\n return body;\n },\n atomicCondition: function (needsParens, preparsedCond) {\n const entities = this.entities;\n const index = parserInput.i;\n let a;\n let b;\n let c;\n let op;\n\n const cond = (function() {\n return this.addition() || entities.keyword() || entities.quoted() || entities.mixinLookup();\n }).bind(this)\n\n if (preparsedCond) {\n a = preparsedCond;\n } else {\n a = cond();\n }\n\n if (a) {\n if (parserInput.$char('>')) {\n if (parserInput.$char('=')) {\n op = '>=';\n } else {\n op = '>';\n }\n } else\n if (parserInput.$char('<')) {\n if (parserInput.$char('=')) {\n op = '<=';\n } else {\n op = '<';\n }\n } else\n if (parserInput.$char('=')) {\n if (parserInput.$char('>')) {\n op = '=>';\n } else if (parserInput.$char('<')) {\n op = '=<';\n } else {\n op = '=';\n }\n }\n if (op) {\n b = cond();\n if (b) {\n c = new(tree.Condition)(op, a, b, index + currentIndex, false);\n } else {\n error('expected expression');\n }\n } else if (!preparsedCond) {\n c = new(tree.Condition)('=', a, new(tree.Keyword)('true'), index + currentIndex, false);\n }\n return c;\n }\n },\n\n //\n // An operand is anything that can be part of an operation,\n // such as a Color, or a Variable\n //\n operand: function () {\n const entities = this.entities;\n let negate;\n\n if (parserInput.peek(/^-[@$(]/)) {\n negate = parserInput.$char('-');\n }\n\n let o = this.sub() || entities.dimension() ||\n entities.color() || entities.variable() ||\n entities.property() || entities.call() ||\n entities.quoted(true) || entities.colorKeyword() ||\n this.colorOperand() || entities.mixinLookup();\n\n if (negate) {\n o.parensInOp = true;\n o = new(tree.Negative)(o);\n }\n\n return o;\n },\n\n //\n // Expressions either represent mathematical operations,\n // or white-space delimited Entities.\n //\n // 1px solid black\n // @var * 2\n //\n expression: function () {\n const entities = [];\n let e;\n let delim;\n const index = parserInput.i;\n\n do {\n e = this.comment();\n if (e && !e.isLineComment) {\n entities.push(e);\n continue;\n }\n e = this.addition() || this.entity();\n\n if (e instanceof tree.Comment) {\n e = null;\n }\n\n if (e) {\n entities.push(e);\n // operations do not allow keyword \"/\" dimension (e.g. small/20px) so we support that here\n if (!parserInput.peek(/^\\/[/*]/)) {\n delim = parserInput.$char('/');\n if (delim) {\n entities.push(new(tree.Anonymous)(delim, index + currentIndex));\n }\n }\n }\n } while (e);\n if (entities.length > 0) {\n return new(tree.Expression)(entities);\n }\n },\n property: function () {\n const name = parserInput.$re(/^(\\*?-?[_a-zA-Z0-9-]+)\\s*:/);\n if (name) {\n return name[1];\n }\n },\n ruleProperty: function () {\n let name = [];\n const index = [];\n let s;\n let k;\n\n parserInput.save();\n\n const simpleProperty = parserInput.$re(/^([_a-zA-Z0-9-]+)\\s*:/);\n if (simpleProperty) {\n name = [new(tree.Keyword)(simpleProperty[1])];\n parserInput.forget();\n return name;\n }\n\n function match(re) {\n const i = parserInput.i;\n const chunk = parserInput.$re(re);\n if (chunk) {\n index.push(i);\n return name.push(chunk[1]);\n }\n }\n\n match(/^(\\*?)/);\n while (true) {\n if (!match(/^((?:[\\w-]+)|(?:[@$]\\{[\\w-]+\\}))/)) {\n break;\n }\n }\n\n if ((name.length > 1) && match(/^((?:\\+_|\\+)?)\\s*:/)) {\n parserInput.forget();\n\n // at last, we have the complete match now. move forward,\n // convert name particles to tree objects and return:\n if (name[0] === '') {\n name.shift();\n index.shift();\n }\n for (k = 0; k < name.length; k++) {\n s = name[k];\n name[k] = (s.charAt(0) !== '@' && s.charAt(0) !== '$') ?\n new(tree.Keyword)(s) :\n (s.charAt(0) === '@' ?\n new(tree.Variable)(`@${s.slice(2, -1)}`, index[k] + currentIndex, fileInfo) :\n new(tree.Property)(`$${s.slice(2, -1)}`, index[k] + currentIndex, fileInfo));\n }\n return name;\n }\n parserInput.restore();\n }\n }\n };\n};\nParser.serializeVars = vars => {\n let s = '';\n\n for (const name in vars) {\n if (Object.hasOwnProperty.call(vars, name)) {\n const value = vars[name];\n s += `${((name[0] === '@') ? '' : '@') + name}: ${value}${(String(value).slice(-1) === ';') ? '' : ';'}`;\n }\n }\n\n return s;\n};\n\nexport default Parser;","import Node from './node';\nimport Element from './element';\nimport LessError from '../less-error';\nimport * as utils from '../utils';\nimport Parser from '../parser/parser';\n\nconst Selector = function(elements, extendList, condition, index, currentFileInfo, visibilityInfo) {\n this.extendList = extendList;\n this.condition = condition;\n this.evaldCondition = !condition;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.elements = this.getElements(elements);\n this.mixinElements_ = undefined;\n this.copyVisibilityInfo(visibilityInfo);\n this.setParent(this.elements, this);\n};\n\nSelector.prototype = Object.assign(new Node(), {\n type: 'Selector',\n\n accept(visitor) {\n if (this.elements) {\n this.elements = visitor.visitArray(this.elements);\n }\n if (this.extendList) {\n this.extendList = visitor.visitArray(this.extendList);\n }\n if (this.condition) {\n this.condition = visitor.visit(this.condition);\n }\n },\n\n createDerived(elements, extendList, evaldCondition) {\n elements = this.getElements(elements);\n const newSelector = new Selector(elements, extendList || this.extendList,\n null, this.getIndex(), this.fileInfo(), this.visibilityInfo());\n newSelector.evaldCondition = (!utils.isNullOrUndefined(evaldCondition)) ? evaldCondition : this.evaldCondition;\n newSelector.mediaEmpty = this.mediaEmpty;\n return newSelector;\n },\n\n getElements(els) {\n if (!els) {\n return [new Element('', '&', false, this._index, this._fileInfo)];\n }\n if (typeof els === 'string') {\n new Parser(this.parse.context, this.parse.importManager, this._fileInfo, this._index).parseNode(\n els,\n ['selector'],\n function(err, result) {\n if (err) {\n throw new LessError({\n index: err.index,\n message: err.message\n }, this.parse.imports, this._fileInfo.filename);\n }\n els = result[0].elements;\n });\n }\n return els;\n },\n\n createEmptySelectors() {\n const el = new Element('', '&', false, this._index, this._fileInfo), sels = [new Selector([el], null, null, this._index, this._fileInfo)];\n sels[0].mediaEmpty = true;\n return sels;\n },\n\n match(other) {\n const elements = this.elements;\n const len = elements.length;\n let olen;\n let i;\n\n other = other.mixinElements();\n olen = other.length;\n if (olen === 0 || len < olen) {\n return 0;\n } else {\n for (i = 0; i < olen; i++) {\n if (elements[i].value !== other[i]) {\n return 0;\n }\n }\n }\n\n return olen; // return number of matched elements\n },\n\n mixinElements() {\n if (this.mixinElements_) {\n return this.mixinElements_;\n }\n\n let elements = this.elements.map( function(v) {\n return v.combinator.value + (v.value.value || v.value);\n }).join('').match(/[,&#*.\\w-]([\\w-]|(\\\\.))*/g);\n\n if (elements) {\n if (elements[0] === '&') {\n elements.shift();\n }\n } else {\n elements = [];\n }\n\n return (this.mixinElements_ = elements);\n },\n\n isJustParentSelector() {\n return !this.mediaEmpty &&\n this.elements.length === 1 &&\n this.elements[0].value === '&' &&\n (this.elements[0].combinator.value === ' ' || this.elements[0].combinator.value === '');\n },\n\n eval(context) {\n const evaldCondition = this.condition && this.condition.eval(context);\n let elements = this.elements;\n let extendList = this.extendList;\n\n elements = elements && elements.map(function (e) { return e.eval(context); });\n extendList = extendList && extendList.map(function(extend) { return extend.eval(context); });\n\n return this.createDerived(elements, extendList, evaldCondition);\n },\n\n genCSS(context, output) {\n let i, element;\n if ((!context || !context.firstSelector) && this.elements[0].combinator.value === '') {\n output.add(' ', this.fileInfo(), this.getIndex());\n }\n for (i = 0; i < this.elements.length; i++) {\n element = this.elements[i];\n element.genCSS(context, output);\n }\n },\n\n getIsOutput() {\n return this.evaldCondition;\n }\n});\n\nexport default Selector;\n","import Node from './node';\n\nconst Value = function(value) {\n if (!value) {\n throw new Error('Value requires an array argument');\n }\n if (!Array.isArray(value)) {\n this.value = [ value ];\n }\n else {\n this.value = value;\n }\n};\n\nValue.prototype = Object.assign(new Node(), {\n type: 'Value',\n\n accept(visitor) {\n if (this.value) {\n this.value = visitor.visitArray(this.value);\n }\n },\n\n eval(context) {\n if (this.value.length === 1) {\n return this.value[0].eval(context);\n } else {\n return new Value(this.value.map(function (v) {\n return v.eval(context);\n }));\n }\n },\n\n genCSS(context, output) {\n let i;\n for (i = 0; i < this.value.length; i++) {\n this.value[i].genCSS(context, output);\n if (i + 1 < this.value.length) {\n output.add((context && context.compress) ? ',' : ', ');\n }\n }\n }\n});\n\nexport default Value;\n","import Node from './node';\n\nconst Keyword = function(value) {\n this.value = value;\n};\n\nKeyword.prototype = Object.assign(new Node(), {\n type: 'Keyword',\n\n genCSS(context, output) {\n if (this.value === '%') { throw { type: 'Syntax', message: 'Invalid % without number' }; }\n output.add(this.value);\n }\n});\n\nKeyword.True = new Keyword('true');\nKeyword.False = new Keyword('false');\n\nexport default Keyword;\n","import Node from './node';\nimport Value from './value';\nimport Keyword from './keyword';\nimport Anonymous from './anonymous';\nimport * as Constants from '../constants';\nconst MATH = Constants.Math;\n\nfunction evalName(context, name) {\n let value = '';\n let i;\n const n = name.length;\n const output = {add: function (s) {value += s;}};\n for (i = 0; i < n; i++) {\n name[i].eval(context).genCSS(context, output);\n }\n return value;\n}\n\nconst Declaration = function(name, value, important, merge, index, currentFileInfo, inline, variable) {\n this.name = name;\n this.value = (value instanceof Node) ? value : new Value([value ? new Anonymous(value) : null]);\n this.important = important ? ` ${important.trim()}` : '';\n this.merge = merge;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.inline = inline || false;\n this.variable = (variable !== undefined) ? variable\n : (name.charAt && (name.charAt(0) === '@'));\n this.allowRoot = true;\n this.setParent(this.value, this);\n};\n\nDeclaration.prototype = Object.assign(new Node(), {\n type: 'Declaration',\n\n genCSS(context, output) {\n output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex());\n try {\n this.value.genCSS(context, output);\n }\n catch (e) {\n e.index = this._index;\n e.filename = this._fileInfo.filename;\n throw e;\n }\n output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? '' : ';'), this._fileInfo, this._index);\n },\n\n eval(context) {\n let mathBypass = false, prevMath, name = this.name, evaldValue, variable = this.variable;\n if (typeof name !== 'string') {\n // expand 'primitive' name directly to get\n // things faster (~10% for benchmark.less):\n name = (name.length === 1) && (name[0] instanceof Keyword) ?\n name[0].value : evalName(context, name);\n variable = false; // never treat expanded interpolation as new variable name\n }\n\n // @todo remove when parens-division is default\n if (name === 'font' && context.math === MATH.ALWAYS) {\n mathBypass = true;\n prevMath = context.math;\n context.math = MATH.PARENS_DIVISION;\n }\n try {\n context.importantScope.push({});\n evaldValue = this.value.eval(context);\n\n if (!this.variable && evaldValue.type === 'DetachedRuleset') {\n throw { message: 'Rulesets cannot be evaluated on a property.',\n index: this.getIndex(), filename: this.fileInfo().filename };\n }\n let important = this.important;\n const importantResult = context.importantScope.pop();\n if (!important && importantResult.important) {\n important = importantResult.important;\n }\n\n return new Declaration(name,\n evaldValue,\n important,\n this.merge,\n this.getIndex(), this.fileInfo(), this.inline,\n variable);\n }\n catch (e) {\n if (typeof e.index !== 'number') {\n e.index = this.getIndex();\n e.filename = this.fileInfo().filename;\n }\n throw e;\n }\n finally {\n if (mathBypass) {\n context.math = prevMath;\n }\n }\n },\n\n makeImportant() {\n return new Declaration(this.name,\n this.value,\n '!important',\n this.merge,\n this.getIndex(), this.fileInfo(), this.inline);\n }\n});\n\nexport default Declaration;","function asComment(ctx) {\n return `/* line ${ctx.debugInfo.lineNumber}, ${ctx.debugInfo.fileName} */\\n`;\n}\n\nfunction asMediaQuery(ctx) {\n let filenameWithProtocol = ctx.debugInfo.fileName;\n if (!/^[a-z]+:\\/\\//i.test(filenameWithProtocol)) {\n filenameWithProtocol = `file://${filenameWithProtocol}`;\n }\n return `@media -sass-debug-info{filename{font-family:${filenameWithProtocol.replace(/([.:/\\\\])/g, function (a) {\n if (a == '\\\\') {\n a = '/';\n }\n return `\\\\${a}`;\n })}}line{font-family:\\\\00003${ctx.debugInfo.lineNumber}}}\\n`;\n}\n\nfunction debugInfo(context, ctx, lineSeparator) {\n let result = '';\n if (context.dumpLineNumbers && !context.compress) {\n switch (context.dumpLineNumbers) {\n case 'comments':\n result = asComment(ctx);\n break;\n case 'mediaquery':\n result = asMediaQuery(ctx);\n break;\n case 'all':\n result = asComment(ctx) + (lineSeparator || '') + asMediaQuery(ctx);\n break;\n }\n }\n return result;\n}\n\nexport default debugInfo;\n\n","import Node from './node';\nimport getDebugInfo from './debug-info';\n\nconst Comment = function(value, isLineComment, index, currentFileInfo) {\n this.value = value;\n this.isLineComment = isLineComment;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.allowRoot = true;\n}\n\nComment.prototype = Object.assign(new Node(), {\n type: 'Comment',\n\n genCSS(context, output) {\n if (this.debugInfo) {\n output.add(getDebugInfo(context, this), this.fileInfo(), this.getIndex());\n }\n output.add(this.value);\n },\n\n isSilent(context) {\n const isCompressed = context.compress && this.value[2] !== '!';\n return this.isLineComment || isCompressed;\n }\n});\n\nexport default Comment;\n","import Keyword from '../tree/keyword';\nimport * as utils from '../utils';\n\nconst defaultFunc = {\n eval: function () {\n const v = this.value_;\n const e = this.error_;\n if (e) {\n throw e;\n }\n if (!utils.isNullOrUndefined(v)) {\n return v ? Keyword.True : Keyword.False;\n }\n },\n value: function (v) {\n this.value_ = v;\n },\n error: function (e) {\n this.error_ = e;\n },\n reset: function () {\n this.value_ = this.error_ = null;\n }\n};\n\nexport default defaultFunc;\n","import Node from './node';\nimport Declaration from './declaration';\nimport Keyword from './keyword';\nimport Comment from './comment';\nimport Paren from './paren';\nimport Selector from './selector';\nimport Element from './element';\nimport Anonymous from './anonymous';\nimport contexts from '../contexts';\nimport globalFunctionRegistry from '../functions/function-registry';\nimport defaultFunc from '../functions/default';\nimport getDebugInfo from './debug-info';\nimport * as utils from '../utils';\nimport Parser from '../parser/parser';\n\nconst Ruleset = function(selectors, rules, strictImports, visibilityInfo) {\n this.selectors = selectors;\n this.rules = rules;\n this._lookups = {};\n this._variables = null;\n this._properties = null;\n this.strictImports = strictImports;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n\n this.setParent(this.selectors, this);\n this.setParent(this.rules, this);\n}\n\nRuleset.prototype = Object.assign(new Node(), {\n type: 'Ruleset',\n isRuleset: true,\n\n isRulesetLike() { return true; },\n\n accept(visitor) {\n if (this.paths) {\n this.paths = visitor.visitArray(this.paths, true);\n } else if (this.selectors) {\n this.selectors = visitor.visitArray(this.selectors);\n }\n if (this.rules && this.rules.length) {\n this.rules = visitor.visitArray(this.rules);\n }\n },\n\n eval(context) {\n let selectors;\n let selCnt;\n let selector;\n let i;\n let hasVariable;\n let hasOnePassingSelector = false;\n\n if (this.selectors && (selCnt = this.selectors.length)) {\n selectors = new Array(selCnt);\n defaultFunc.error({\n type: 'Syntax',\n message: 'it is currently only allowed in parametric mixin guards,'\n });\n\n for (i = 0; i < selCnt; i++) {\n selector = this.selectors[i].eval(context);\n for (let j = 0; j < selector.elements.length; j++) {\n if (selector.elements[j].isVariable) {\n hasVariable = true;\n break;\n }\n }\n selectors[i] = selector;\n if (selector.evaldCondition) {\n hasOnePassingSelector = true;\n }\n }\n\n if (hasVariable) {\n const toParseSelectors = new Array(selCnt);\n for (i = 0; i < selCnt; i++) {\n selector = selectors[i];\n toParseSelectors[i] = selector.toCSS(context);\n }\n const startingIndex = selectors[0].getIndex();\n const selectorFileInfo = selectors[0].fileInfo();\n new Parser(context, this.parse.importManager, selectorFileInfo, startingIndex).parseNode(\n toParseSelectors.join(','),\n ['selectors'],\n function(err, result) {\n if (result) {\n selectors = utils.flattenArray(result);\n }\n });\n }\n\n defaultFunc.reset();\n } else {\n hasOnePassingSelector = true;\n }\n\n let rules = this.rules ? utils.copyArray(this.rules) : null;\n const ruleset = new Ruleset(selectors, rules, this.strictImports, this.visibilityInfo());\n let rule;\n let subRule;\n\n ruleset.originalRuleset = this;\n ruleset.root = this.root;\n ruleset.firstRoot = this.firstRoot;\n ruleset.allowImports = this.allowImports;\n\n if (this.debugInfo) {\n ruleset.debugInfo = this.debugInfo;\n }\n\n if (!hasOnePassingSelector) {\n rules.length = 0;\n }\n\n // inherit a function registry from the frames stack when possible;\n // otherwise from the global registry\n ruleset.functionRegistry = (function (frames) {\n let i = 0;\n const n = frames.length;\n let found;\n for ( ; i !== n ; ++i ) {\n found = frames[ i ].functionRegistry;\n if ( found ) { return found; }\n }\n return globalFunctionRegistry;\n }(context.frames)).inherit();\n\n // push the current ruleset to the frames stack\n const ctxFrames = context.frames;\n ctxFrames.unshift(ruleset);\n\n // currrent selectors\n let ctxSelectors = context.selectors;\n if (!ctxSelectors) {\n context.selectors = ctxSelectors = [];\n }\n ctxSelectors.unshift(this.selectors);\n\n // Evaluate imports\n if (ruleset.root || ruleset.allowImports || !ruleset.strictImports) {\n ruleset.evalImports(context);\n }\n\n // Store the frames around mixin definitions,\n // so they can be evaluated like closures when the time comes.\n const rsRules = ruleset.rules;\n for (i = 0; (rule = rsRules[i]); i++) {\n if (rule.evalFirst) {\n rsRules[i] = rule.eval(context);\n }\n }\n\n const mediaBlockCount = (context.mediaBlocks && context.mediaBlocks.length) || 0;\n\n // Evaluate mixin calls.\n for (i = 0; (rule = rsRules[i]); i++) {\n if (rule.type === 'MixinCall') {\n /* jshint loopfunc:true */\n rules = rule.eval(context).filter(function(r) {\n if ((r instanceof Declaration) && r.variable) {\n // do not pollute the scope if the variable is\n // already there. consider returning false here\n // but we need a way to \"return\" variable from mixins\n return !(ruleset.variable(r.name));\n }\n return true;\n });\n rsRules.splice.apply(rsRules, [i, 1].concat(rules));\n i += rules.length - 1;\n ruleset.resetCache();\n } else if (rule.type === 'VariableCall') {\n /* jshint loopfunc:true */\n rules = rule.eval(context).rules.filter(function(r) {\n if ((r instanceof Declaration) && r.variable) {\n // do not pollute the scope at all\n return false;\n }\n return true;\n });\n rsRules.splice.apply(rsRules, [i, 1].concat(rules));\n i += rules.length - 1;\n ruleset.resetCache();\n }\n }\n\n // Evaluate everything else\n for (i = 0; (rule = rsRules[i]); i++) {\n if (!rule.evalFirst) {\n rsRules[i] = rule = rule.eval ? rule.eval(context) : rule;\n }\n }\n\n // Evaluate everything else\n for (i = 0; (rule = rsRules[i]); i++) {\n // for rulesets, check if it is a css guard and can be removed\n if (rule instanceof Ruleset && rule.selectors && rule.selectors.length === 1) {\n // check if it can be folded in (e.g. & where)\n if (rule.selectors[0] && rule.selectors[0].isJustParentSelector()) {\n rsRules.splice(i--, 1);\n\n for (let j = 0; (subRule = rule.rules[j]); j++) {\n if (subRule instanceof Node) {\n subRule.copyVisibilityInfo(rule.visibilityInfo());\n if (!(subRule instanceof Declaration) || !subRule.variable) {\n rsRules.splice(++i, 0, subRule);\n }\n }\n }\n }\n }\n }\n\n // Pop the stack\n ctxFrames.shift();\n ctxSelectors.shift();\n\n if (context.mediaBlocks) {\n for (i = mediaBlockCount; i < context.mediaBlocks.length; i++) {\n context.mediaBlocks[i].bubbleSelectors(selectors);\n }\n }\n\n return ruleset;\n },\n\n evalImports(context) {\n const rules = this.rules;\n let i;\n let importRules;\n if (!rules) { return; }\n\n for (i = 0; i < rules.length; i++) {\n if (rules[i].type === 'Import') {\n importRules = rules[i].eval(context);\n if (importRules && (importRules.length || importRules.length === 0)) {\n rules.splice.apply(rules, [i, 1].concat(importRules));\n i += importRules.length - 1;\n } else {\n rules.splice(i, 1, importRules);\n }\n this.resetCache();\n }\n }\n },\n\n makeImportant() {\n const result = new Ruleset(this.selectors, this.rules.map(function (r) {\n if (r.makeImportant) {\n return r.makeImportant();\n } else {\n return r;\n }\n }), this.strictImports, this.visibilityInfo());\n\n return result;\n },\n\n matchArgs(args) {\n return !args || args.length === 0;\n },\n\n // lets you call a css selector with a guard\n matchCondition(args, context) {\n const lastSelector = this.selectors[this.selectors.length - 1];\n if (!lastSelector.evaldCondition) {\n return false;\n }\n if (lastSelector.condition &&\n !lastSelector.condition.eval(\n new contexts.Eval(context,\n context.frames))) {\n return false;\n }\n return true;\n },\n\n resetCache() {\n this._rulesets = null;\n this._variables = null;\n this._properties = null;\n this._lookups = {};\n },\n\n variables() {\n if (!this._variables) {\n this._variables = !this.rules ? {} : this.rules.reduce(function (hash, r) {\n if (r instanceof Declaration && r.variable === true) {\n hash[r.name] = r;\n }\n // when evaluating variables in an import statement, imports have not been eval'd\n // so we need to go inside import statements.\n // guard against root being a string (in the case of inlined less)\n if (r.type === 'Import' && r.root && r.root.variables) {\n const vars = r.root.variables();\n for (const name in vars) {\n // eslint-disable-next-line no-prototype-builtins\n if (vars.hasOwnProperty(name)) {\n hash[name] = r.root.variable(name);\n }\n }\n }\n return hash;\n }, {});\n }\n return this._variables;\n },\n\n properties() {\n if (!this._properties) {\n this._properties = !this.rules ? {} : this.rules.reduce(function (hash, r) {\n if (r instanceof Declaration && r.variable !== true) {\n const name = (r.name.length === 1) && (r.name[0] instanceof Keyword) ?\n r.name[0].value : r.name;\n // Properties don't overwrite as they can merge\n if (!hash[`$${name}`]) {\n hash[`$${name}`] = [ r ];\n }\n else {\n hash[`$${name}`].push(r);\n }\n }\n return hash;\n }, {});\n }\n return this._properties;\n },\n\n variable(name) {\n const decl = this.variables()[name];\n if (decl) {\n return this.parseValue(decl);\n }\n },\n\n property(name) {\n const decl = this.properties()[name];\n if (decl) {\n return this.parseValue(decl);\n }\n },\n\n lastDeclaration() {\n for (let i = this.rules.length; i > 0; i--) {\n const decl = this.rules[i - 1];\n if (decl instanceof Declaration) {\n return this.parseValue(decl);\n }\n }\n },\n\n parseValue(toParse) {\n const self = this;\n function transformDeclaration(decl) {\n if (decl.value instanceof Anonymous && !decl.parsed) {\n if (typeof decl.value.value === 'string') {\n new Parser(this.parse.context, this.parse.importManager, decl.fileInfo(), decl.value.getIndex()).parseNode(\n decl.value.value,\n ['value', 'important'],\n function(err, result) {\n if (err) {\n decl.parsed = true;\n }\n if (result) {\n decl.value = result[0];\n decl.important = result[1] || '';\n decl.parsed = true;\n }\n });\n } else {\n decl.parsed = true;\n }\n\n return decl;\n }\n else {\n return decl;\n }\n }\n if (!Array.isArray(toParse)) {\n return transformDeclaration.call(self, toParse);\n }\n else {\n const nodes = [];\n toParse.forEach(function(n) {\n nodes.push(transformDeclaration.call(self, n));\n });\n return nodes;\n }\n },\n\n rulesets() {\n if (!this.rules) { return []; }\n\n const filtRules = [];\n const rules = this.rules;\n let i;\n let rule;\n\n for (i = 0; (rule = rules[i]); i++) {\n if (rule.isRuleset) {\n filtRules.push(rule);\n }\n }\n\n return filtRules;\n },\n\n prependRule(rule) {\n const rules = this.rules;\n if (rules) {\n rules.unshift(rule);\n } else {\n this.rules = [ rule ];\n }\n this.setParent(rule, this);\n },\n\n find(selector, self, filter) {\n self = self || this;\n const rules = [];\n let match;\n let foundMixins;\n const key = selector.toCSS();\n\n if (key in this._lookups) { return this._lookups[key]; }\n\n this.rulesets().forEach(function (rule) {\n if (rule !== self) {\n for (let j = 0; j < rule.selectors.length; j++) {\n match = selector.match(rule.selectors[j]);\n if (match) {\n if (selector.elements.length > match) {\n if (!filter || filter(rule)) {\n foundMixins = rule.find(new Selector(selector.elements.slice(match)), self, filter);\n for (let i = 0; i < foundMixins.length; ++i) {\n foundMixins[i].path.push(rule);\n }\n Array.prototype.push.apply(rules, foundMixins);\n }\n } else {\n rules.push({ rule, path: []});\n }\n break;\n }\n }\n }\n });\n this._lookups[key] = rules;\n return rules;\n },\n\n genCSS(context, output) {\n let i;\n let j;\n const charsetRuleNodes = [];\n let ruleNodes = [];\n\n let // Line number debugging\n debugInfo;\n\n let rule;\n let path;\n\n context.tabLevel = (context.tabLevel || 0);\n\n if (!this.root) {\n context.tabLevel++;\n }\n\n const tabRuleStr = context.compress ? '' : Array(context.tabLevel + 1).join(' ');\n const tabSetStr = context.compress ? '' : Array(context.tabLevel).join(' ');\n let sep;\n\n let charsetNodeIndex = 0;\n let importNodeIndex = 0;\n for (i = 0; (rule = this.rules[i]); i++) {\n if (rule instanceof Comment) {\n if (importNodeIndex === i) {\n importNodeIndex++;\n }\n ruleNodes.push(rule);\n } else if (rule.isCharset && rule.isCharset()) {\n ruleNodes.splice(charsetNodeIndex, 0, rule);\n charsetNodeIndex++;\n importNodeIndex++;\n } else if (rule.type === 'Import') {\n ruleNodes.splice(importNodeIndex, 0, rule);\n importNodeIndex++;\n } else {\n ruleNodes.push(rule);\n }\n }\n ruleNodes = charsetRuleNodes.concat(ruleNodes);\n\n // If this is the root node, we don't render\n // a selector, or {}.\n if (!this.root) {\n debugInfo = getDebugInfo(context, this, tabSetStr);\n\n if (debugInfo) {\n output.add(debugInfo);\n output.add(tabSetStr);\n }\n\n const paths = this.paths;\n const pathCnt = paths.length;\n let pathSubCnt;\n\n sep = context.compress ? ',' : (`,\\n${tabSetStr}`);\n\n for (i = 0; i < pathCnt; i++) {\n path = paths[i];\n if (!(pathSubCnt = path.length)) { continue; }\n if (i > 0) { output.add(sep); }\n\n context.firstSelector = true;\n path[0].genCSS(context, output);\n\n context.firstSelector = false;\n for (j = 1; j < pathSubCnt; j++) {\n path[j].genCSS(context, output);\n }\n }\n\n output.add((context.compress ? '{' : ' {\\n') + tabRuleStr);\n }\n\n // Compile rules and rulesets\n for (i = 0; (rule = ruleNodes[i]); i++) {\n\n if (i + 1 === ruleNodes.length) {\n context.lastRule = true;\n }\n\n const currentLastRule = context.lastRule;\n if (rule.isRulesetLike(rule)) {\n context.lastRule = false;\n }\n\n if (rule.genCSS) {\n rule.genCSS(context, output);\n } else if (rule.value) {\n output.add(rule.value.toString());\n }\n\n context.lastRule = currentLastRule;\n\n if (!context.lastRule && rule.isVisible()) {\n output.add(context.compress ? '' : (`\\n${tabRuleStr}`));\n } else {\n context.lastRule = false;\n }\n }\n\n if (!this.root) {\n output.add((context.compress ? '}' : `\\n${tabSetStr}}`));\n context.tabLevel--;\n }\n\n if (!output.isEmpty() && !context.compress && this.firstRoot) {\n output.add('\\n');\n }\n },\n\n joinSelectors(paths, context, selectors) {\n for (let s = 0; s < selectors.length; s++) {\n this.joinSelector(paths, context, selectors[s]);\n }\n },\n\n joinSelector(paths, context, selector) {\n\n function createParenthesis(elementsToPak, originalElement) {\n let replacementParen, j;\n if (elementsToPak.length === 0) {\n replacementParen = new Paren(elementsToPak[0]);\n } else {\n const insideParent = new Array(elementsToPak.length);\n for (j = 0; j < elementsToPak.length; j++) {\n insideParent[j] = new Element(\n null,\n elementsToPak[j],\n originalElement.isVariable,\n originalElement._index,\n originalElement._fileInfo\n );\n }\n replacementParen = new Paren(new Selector(insideParent));\n }\n return replacementParen;\n }\n\n function createSelector(containedElement, originalElement) {\n let element, selector;\n element = new Element(null, containedElement, originalElement.isVariable, originalElement._index, originalElement._fileInfo);\n selector = new Selector([element]);\n return selector;\n }\n\n // joins selector path from `beginningPath` with selector path in `addPath`\n // `replacedElement` contains element that is being replaced by `addPath`\n // returns concatenated path\n function addReplacementIntoPath(beginningPath, addPath, replacedElement, originalSelector) {\n let newSelectorPath, lastSelector, newJoinedSelector;\n // our new selector path\n newSelectorPath = [];\n\n // construct the joined selector - if & is the first thing this will be empty,\n // if not newJoinedSelector will be the last set of elements in the selector\n if (beginningPath.length > 0) {\n newSelectorPath = utils.copyArray(beginningPath);\n lastSelector = newSelectorPath.pop();\n newJoinedSelector = originalSelector.createDerived(utils.copyArray(lastSelector.elements));\n }\n else {\n newJoinedSelector = originalSelector.createDerived([]);\n }\n\n if (addPath.length > 0) {\n // /deep/ is a CSS4 selector - (removed, so should deprecate)\n // that is valid without anything in front of it\n // so if the & does not have a combinator that is \"\" or \" \" then\n // and there is a combinator on the parent, then grab that.\n // this also allows + a { & .b { .a & { ... though not sure why you would want to do that\n let combinator = replacedElement.combinator;\n\n const parentEl = addPath[0].elements[0];\n if (combinator.emptyOrWhitespace && !parentEl.combinator.emptyOrWhitespace) {\n combinator = parentEl.combinator;\n }\n // join the elements so far with the first part of the parent\n newJoinedSelector.elements.push(new Element(\n combinator,\n parentEl.value,\n replacedElement.isVariable,\n replacedElement._index,\n replacedElement._fileInfo\n ));\n newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1));\n }\n\n // now add the joined selector - but only if it is not empty\n if (newJoinedSelector.elements.length !== 0) {\n newSelectorPath.push(newJoinedSelector);\n }\n\n // put together the parent selectors after the join (e.g. the rest of the parent)\n if (addPath.length > 1) {\n let restOfPath = addPath.slice(1);\n restOfPath = restOfPath.map(function (selector) {\n return selector.createDerived(selector.elements, []);\n });\n newSelectorPath = newSelectorPath.concat(restOfPath);\n }\n return newSelectorPath;\n }\n\n // joins selector path from `beginningPath` with every selector path in `addPaths` array\n // `replacedElement` contains element that is being replaced by `addPath`\n // returns array with all concatenated paths\n function addAllReplacementsIntoPath( beginningPath, addPaths, replacedElement, originalSelector, result) {\n let j;\n for (j = 0; j < beginningPath.length; j++) {\n const newSelectorPath = addReplacementIntoPath(beginningPath[j], addPaths, replacedElement, originalSelector);\n result.push(newSelectorPath);\n }\n return result;\n }\n\n function mergeElementsOnToSelectors(elements, selectors) {\n let i, sel;\n\n if (elements.length === 0) {\n return ;\n }\n if (selectors.length === 0) {\n selectors.push([ new Selector(elements) ]);\n return;\n }\n\n for (i = 0; (sel = selectors[i]); i++) {\n // if the previous thing in sel is a parent this needs to join on to it\n if (sel.length > 0) {\n sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements));\n }\n else {\n sel.push(new Selector(elements));\n }\n }\n }\n\n // replace all parent selectors inside `inSelector` by content of `context` array\n // resulting selectors are returned inside `paths` array\n // returns true if `inSelector` contained at least one parent selector\n function replaceParentSelector(paths, context, inSelector) {\n // The paths are [[Selector]]\n // The first list is a list of comma separated selectors\n // The inner list is a list of inheritance separated selectors\n // e.g.\n // .a, .b {\n // .c {\n // }\n // }\n // == [[.a] [.c]] [[.b] [.c]]\n //\n let i, j, k, currentElements, newSelectors, selectorsMultiplied, sel, el, hadParentSelector = false, length, lastSelector;\n function findNestedSelector(element) {\n let maybeSelector;\n if (!(element.value instanceof Paren)) {\n return null;\n }\n\n maybeSelector = element.value.value;\n if (!(maybeSelector instanceof Selector)) {\n return null;\n }\n\n return maybeSelector;\n }\n\n // the elements from the current selector so far\n currentElements = [];\n // the current list of new selectors to add to the path.\n // We will build it up. We initiate it with one empty selector as we \"multiply\" the new selectors\n // by the parents\n newSelectors = [\n []\n ];\n\n for (i = 0; (el = inSelector.elements[i]); i++) {\n // non parent reference elements just get added\n if (el.value !== '&') {\n const nestedSelector = findNestedSelector(el);\n if (nestedSelector !== null) {\n // merge the current list of non parent selector elements\n // on to the current list of selectors to add\n mergeElementsOnToSelectors(currentElements, newSelectors);\n\n const nestedPaths = [];\n let replaced;\n const replacedNewSelectors = [];\n replaced = replaceParentSelector(nestedPaths, context, nestedSelector);\n hadParentSelector = hadParentSelector || replaced;\n // the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors\n for (k = 0; k < nestedPaths.length; k++) {\n const replacementSelector = createSelector(createParenthesis(nestedPaths[k], el), el);\n addAllReplacementsIntoPath(newSelectors, [replacementSelector], el, inSelector, replacedNewSelectors);\n }\n newSelectors = replacedNewSelectors;\n currentElements = [];\n } else {\n currentElements.push(el);\n }\n\n } else {\n hadParentSelector = true;\n // the new list of selectors to add\n selectorsMultiplied = [];\n\n // merge the current list of non parent selector elements\n // on to the current list of selectors to add\n mergeElementsOnToSelectors(currentElements, newSelectors);\n\n // loop through our current selectors\n for (j = 0; j < newSelectors.length; j++) {\n sel = newSelectors[j];\n // if we don't have any parent paths, the & might be in a mixin so that it can be used\n // whether there are parents or not\n if (context.length === 0) {\n // the combinator used on el should now be applied to the next element instead so that\n // it is not lost\n if (sel.length > 0) {\n sel[0].elements.push(new Element(el.combinator, '', el.isVariable, el._index, el._fileInfo));\n }\n selectorsMultiplied.push(sel);\n }\n else {\n // and the parent selectors\n for (k = 0; k < context.length; k++) {\n // We need to put the current selectors\n // then join the last selector's elements on to the parents selectors\n const newSelectorPath = addReplacementIntoPath(sel, context[k], el, inSelector);\n // add that to our new set of selectors\n selectorsMultiplied.push(newSelectorPath);\n }\n }\n }\n\n // our new selectors has been multiplied, so reset the state\n newSelectors = selectorsMultiplied;\n currentElements = [];\n }\n }\n\n // if we have any elements left over (e.g. .a& .b == .b)\n // add them on to all the current selectors\n mergeElementsOnToSelectors(currentElements, newSelectors);\n\n for (i = 0; i < newSelectors.length; i++) {\n length = newSelectors[i].length;\n if (length > 0) {\n paths.push(newSelectors[i]);\n lastSelector = newSelectors[i][length - 1];\n newSelectors[i][length - 1] = lastSelector.createDerived(lastSelector.elements, inSelector.extendList);\n }\n }\n\n return hadParentSelector;\n }\n\n function deriveSelector(visibilityInfo, deriveFrom) {\n const newSelector = deriveFrom.createDerived(deriveFrom.elements, deriveFrom.extendList, deriveFrom.evaldCondition);\n newSelector.copyVisibilityInfo(visibilityInfo);\n return newSelector;\n }\n\n // joinSelector code follows\n let i, newPaths, hadParentSelector;\n\n newPaths = [];\n hadParentSelector = replaceParentSelector(newPaths, context, selector);\n\n if (!hadParentSelector) {\n if (context.length > 0) {\n newPaths = [];\n for (i = 0; i < context.length; i++) {\n\n const concatenated = context[i].map(deriveSelector.bind(this, selector.visibilityInfo()));\n\n concatenated.push(selector);\n newPaths.push(concatenated);\n }\n }\n else {\n newPaths = [[selector]];\n }\n }\n\n for (i = 0; i < newPaths.length; i++) {\n paths.push(newPaths[i]);\n }\n\n }\n});\n\nexport default Ruleset;\n","import Node from './node';\nimport unitConversions from '../data/unit-conversions';\nimport * as utils from '../utils';\n\nconst Unit = function(numerator, denominator, backupUnit) {\n this.numerator = numerator ? utils.copyArray(numerator).sort() : [];\n this.denominator = denominator ? utils.copyArray(denominator).sort() : [];\n if (backupUnit) {\n this.backupUnit = backupUnit;\n } else if (numerator && numerator.length) {\n this.backupUnit = numerator[0];\n }\n};\n\nUnit.prototype = Object.assign(new Node(), {\n type: 'Unit',\n\n clone() {\n return new Unit(utils.copyArray(this.numerator), utils.copyArray(this.denominator), this.backupUnit);\n },\n\n genCSS(context, output) {\n // Dimension checks the unit is singular and throws an error if in strict math mode.\n const strictUnits = context && context.strictUnits;\n if (this.numerator.length === 1) {\n output.add(this.numerator[0]); // the ideal situation\n } else if (!strictUnits && this.backupUnit) {\n output.add(this.backupUnit);\n } else if (!strictUnits && this.denominator.length) {\n output.add(this.denominator[0]);\n }\n },\n\n toString() {\n let i, returnStr = this.numerator.join('*');\n for (i = 0; i < this.denominator.length; i++) {\n returnStr += `/${this.denominator[i]}`;\n }\n return returnStr;\n },\n\n compare(other) {\n return this.is(other.toString()) ? 0 : undefined;\n },\n\n is(unitString) {\n return this.toString().toUpperCase() === unitString.toUpperCase();\n },\n\n isLength() {\n return RegExp('^(px|em|ex|ch|rem|in|cm|mm|pc|pt|ex|vw|vh|vmin|vmax)$', 'gi').test(this.toCSS());\n },\n\n isEmpty() {\n return this.numerator.length === 0 && this.denominator.length === 0;\n },\n\n isSingular() {\n return this.numerator.length <= 1 && this.denominator.length === 0;\n },\n\n map(callback) {\n let i;\n\n for (i = 0; i < this.numerator.length; i++) {\n this.numerator[i] = callback(this.numerator[i], false);\n }\n\n for (i = 0; i < this.denominator.length; i++) {\n this.denominator[i] = callback(this.denominator[i], true);\n }\n },\n\n usedUnits() {\n let group;\n const result = {};\n let mapUnit;\n let groupName;\n\n mapUnit = function (atomicUnit) {\n // eslint-disable-next-line no-prototype-builtins\n if (group.hasOwnProperty(atomicUnit) && !result[groupName]) {\n result[groupName] = atomicUnit;\n }\n\n return atomicUnit;\n };\n\n for (groupName in unitConversions) {\n // eslint-disable-next-line no-prototype-builtins\n if (unitConversions.hasOwnProperty(groupName)) {\n group = unitConversions[groupName];\n\n this.map(mapUnit);\n }\n }\n\n return result;\n },\n\n cancel() {\n const counter = {};\n let atomicUnit;\n let i;\n\n for (i = 0; i < this.numerator.length; i++) {\n atomicUnit = this.numerator[i];\n counter[atomicUnit] = (counter[atomicUnit] || 0) + 1;\n }\n\n for (i = 0; i < this.denominator.length; i++) {\n atomicUnit = this.denominator[i];\n counter[atomicUnit] = (counter[atomicUnit] || 0) - 1;\n }\n\n this.numerator = [];\n this.denominator = [];\n\n for (atomicUnit in counter) {\n // eslint-disable-next-line no-prototype-builtins\n if (counter.hasOwnProperty(atomicUnit)) {\n const count = counter[atomicUnit];\n\n if (count > 0) {\n for (i = 0; i < count; i++) {\n this.numerator.push(atomicUnit);\n }\n } else if (count < 0) {\n for (i = 0; i < -count; i++) {\n this.denominator.push(atomicUnit);\n }\n }\n }\n }\n\n this.numerator.sort();\n this.denominator.sort();\n }\n});\n\nexport default Unit;\n","/* eslint-disable no-prototype-builtins */\nimport Node from './node';\nimport unitConversions from '../data/unit-conversions';\nimport Unit from './unit';\nimport Color from './color';\n\n//\n// A number with a unit\n//\nconst Dimension = function(value, unit) {\n this.value = parseFloat(value);\n if (isNaN(this.value)) {\n throw new Error('Dimension is not a number.');\n }\n this.unit = (unit && unit instanceof Unit) ? unit :\n new Unit(unit ? [unit] : undefined);\n this.setParent(this.unit, this);\n};\n\nDimension.prototype = Object.assign(new Node(), {\n type: 'Dimension',\n\n accept(visitor) {\n this.unit = visitor.visit(this.unit);\n },\n\n // remove when Nodes have JSDoc types\n // eslint-disable-next-line no-unused-vars\n eval(context) {\n return this;\n },\n\n toColor() {\n return new Color([this.value, this.value, this.value]);\n },\n\n genCSS(context, output) {\n if ((context && context.strictUnits) && !this.unit.isSingular()) {\n throw new Error(`Multiple units in dimension. Correct the units or use the unit function. Bad unit: ${this.unit.toString()}`);\n }\n\n const value = this.fround(context, this.value);\n let strValue = String(value);\n\n if (value !== 0 && value < 0.000001 && value > -0.000001) {\n // would be output 1e-6 etc.\n strValue = value.toFixed(20).replace(/0+$/, '');\n }\n\n if (context && context.compress) {\n // Zero values doesn't need a unit\n if (value === 0 && this.unit.isLength()) {\n output.add(strValue);\n return;\n }\n\n // Float values doesn't need a leading zero\n if (value > 0 && value < 1) {\n strValue = (strValue).substr(1);\n }\n }\n\n output.add(strValue);\n this.unit.genCSS(context, output);\n },\n\n // In an operation between two Dimensions,\n // we default to the first Dimension's unit,\n // so `1px + 2` will yield `3px`.\n operate(context, op, other) {\n /* jshint noempty:false */\n let value = this._operate(context, op, this.value, other.value);\n let unit = this.unit.clone();\n\n if (op === '+' || op === '-') {\n if (unit.numerator.length === 0 && unit.denominator.length === 0) {\n unit = other.unit.clone();\n if (this.unit.backupUnit) {\n unit.backupUnit = this.unit.backupUnit;\n }\n } else if (other.unit.numerator.length === 0 && unit.denominator.length === 0) {\n // do nothing\n } else {\n other = other.convertTo(this.unit.usedUnits());\n\n if (context.strictUnits && other.unit.toString() !== unit.toString()) {\n throw new Error('Incompatible units. Change the units or use the unit function. '\n + `Bad units: '${unit.toString()}' and '${other.unit.toString()}'.`);\n }\n\n value = this._operate(context, op, this.value, other.value);\n }\n } else if (op === '*') {\n unit.numerator = unit.numerator.concat(other.unit.numerator).sort();\n unit.denominator = unit.denominator.concat(other.unit.denominator).sort();\n unit.cancel();\n } else if (op === '/') {\n unit.numerator = unit.numerator.concat(other.unit.denominator).sort();\n unit.denominator = unit.denominator.concat(other.unit.numerator).sort();\n unit.cancel();\n }\n return new Dimension(value, unit);\n },\n\n compare(other) {\n let a, b;\n\n if (!(other instanceof Dimension)) {\n return undefined;\n }\n\n if (this.unit.isEmpty() || other.unit.isEmpty()) {\n a = this;\n b = other;\n } else {\n a = this.unify();\n b = other.unify();\n if (a.unit.compare(b.unit) !== 0) {\n return undefined;\n }\n }\n\n return Node.numericCompare(a.value, b.value);\n },\n\n unify() {\n return this.convertTo({ length: 'px', duration: 's', angle: 'rad' });\n },\n\n convertTo(conversions) {\n let value = this.value;\n const unit = this.unit.clone();\n let i;\n let groupName;\n let group;\n let targetUnit;\n let derivedConversions = {};\n let applyUnit;\n\n if (typeof conversions === 'string') {\n for (i in unitConversions) {\n if (unitConversions[i].hasOwnProperty(conversions)) {\n derivedConversions = {};\n derivedConversions[i] = conversions;\n }\n }\n conversions = derivedConversions;\n }\n applyUnit = function (atomicUnit, denominator) {\n if (group.hasOwnProperty(atomicUnit)) {\n if (denominator) {\n value = value / (group[atomicUnit] / group[targetUnit]);\n } else {\n value = value * (group[atomicUnit] / group[targetUnit]);\n }\n\n return targetUnit;\n }\n\n return atomicUnit;\n };\n\n for (groupName in conversions) {\n if (conversions.hasOwnProperty(groupName)) {\n targetUnit = conversions[groupName];\n group = unitConversions[groupName];\n\n unit.map(applyUnit);\n }\n }\n\n unit.cancel();\n\n return new Dimension(value, unit);\n }\n});\n\nexport default Dimension;\n","import Node from './node';\nimport Paren from './paren';\nimport Comment from './comment';\nimport Dimension from './dimension';\nimport Anonymous from './anonymous';\n\nconst Expression = function(value, noSpacing) {\n this.value = value;\n this.noSpacing = noSpacing;\n if (!value) {\n throw new Error('Expression requires an array parameter');\n }\n};\n\nExpression.prototype = Object.assign(new Node(), {\n type: 'Expression',\n\n accept(visitor) {\n this.value = visitor.visitArray(this.value);\n },\n\n eval(context) {\n const noSpacing = this.noSpacing;\n let returnValue;\n const mathOn = context.isMathOn();\n const inParenthesis = this.parens;\n\n let doubleParen = false;\n if (inParenthesis) {\n context.inParenthesis();\n }\n if (this.value.length > 1) {\n returnValue = new Expression(this.value.map(function (e) {\n if (!e.eval) {\n return e;\n }\n return e.eval(context);\n }), this.noSpacing);\n } else if (this.value.length === 1) {\n if (this.value[0].parens && !this.value[0].parensInOp && !context.inCalc) {\n doubleParen = true;\n }\n returnValue = this.value[0].eval(context);\n } else {\n returnValue = this;\n }\n if (inParenthesis) {\n context.outOfParenthesis();\n }\n if (this.parens && this.parensInOp && !mathOn && !doubleParen\n && (!(returnValue instanceof Dimension))) {\n returnValue = new Paren(returnValue);\n }\n returnValue.noSpacing = returnValue.noSpacing || noSpacing;\n return returnValue;\n },\n\n genCSS(context, output) {\n for (let i = 0; i < this.value.length; i++) {\n this.value[i].genCSS(context, output);\n if (!this.noSpacing && i + 1 < this.value.length) {\n if (i + 1 < this.value.length && !(this.value[i + 1] instanceof Anonymous) ||\n this.value[i + 1] instanceof Anonymous && this.value[i + 1].value !== ',') {\n output.add(' ');\n }\n }\n }\n },\n\n throwAwayComments() {\n this.value = this.value.filter(function(v) {\n return !(v instanceof Comment);\n });\n }\n});\n\nexport default Expression;\n","import Ruleset from './ruleset';\nimport Value from './value';\nimport Selector from './selector';\nimport Anonymous from './anonymous';\nimport Expression from './expression';\nimport * as utils from '../utils';\n\nconst NestableAtRulePrototype = {\n\n isRulesetLike() {\n return true;\n },\n\n accept(visitor) {\n if (this.features) {\n this.features = visitor.visit(this.features);\n }\n if (this.rules) {\n this.rules = visitor.visitArray(this.rules);\n }\n },\n\n evalFunction: function () {\n if (!this.features || !Array.isArray(this.features.value) || this.features.value.length < 1) {\n return;\n }\n\n const exprValues = this.features.value;\n let expr, paren;\n\n for (let index = 0; index < exprValues.length; ++index) {\n expr = exprValues[index];\n\n if (expr.type === 'Keyword' && index + 1 < exprValues.length && (expr.noSpacing || expr.noSpacing == null)) {\n paren = exprValues[index + 1];\n \n if (paren.type === 'Paren' && paren.noSpacing) {\n exprValues[index]= new Expression([expr, paren]);\n exprValues.splice(index + 1, 1);\n exprValues[index].noSpacing = true;\n }\n }\n }\n },\n\n evalTop(context) {\n this.evalFunction();\n\n let result = this;\n\n // Render all dependent Media blocks.\n if (context.mediaBlocks.length > 1) {\n const selectors = (new Selector([], null, null, this.getIndex(), this.fileInfo())).createEmptySelectors();\n result = new Ruleset(selectors, context.mediaBlocks);\n result.multiMedia = true;\n result.copyVisibilityInfo(this.visibilityInfo());\n this.setParent(result, this);\n }\n\n delete context.mediaBlocks;\n delete context.mediaPath;\n\n return result;\n },\n\n evalNested(context) {\n this.evalFunction();\n\n let i;\n let value;\n const path = context.mediaPath.concat([this]);\n\n // Extract the media-query conditions separated with `,` (OR).\n for (i = 0; i < path.length; i++) {\n if (path[i].type !== this.type) { \n context.mediaBlocks.splice(i, 1); \n \n return this; \n }\n \n value = path[i].features instanceof Value ?\n path[i].features.value : path[i].features;\n path[i] = Array.isArray(value) ? value : [value];\n }\n\n // Trace all permutations to generate the resulting media-query.\n //\n // (a, b and c) with nested (d, e) ->\n // a and d\n // a and e\n // b and c and d\n // b and c and e\n this.features = new Value(this.permute(path).map(path => {\n path = path.map(fragment => fragment.toCSS ? fragment : new Anonymous(fragment));\n\n for (i = path.length - 1; i > 0; i--) {\n path.splice(i, 0, new Anonymous('and'));\n }\n\n return new Expression(path);\n }));\n this.setParent(this.features, this);\n\n // Fake a tree-node that doesn't output anything.\n return new Ruleset([], []);\n },\n\n permute(arr) {\n if (arr.length === 0) {\n return [];\n } else if (arr.length === 1) {\n return arr[0];\n } else {\n const result = [];\n const rest = this.permute(arr.slice(1));\n for (let i = 0; i < rest.length; i++) {\n for (let j = 0; j < arr[0].length; j++) {\n result.push([arr[0][j]].concat(rest[i]));\n }\n }\n return result;\n }\n },\n\n bubbleSelectors(selectors) {\n if (!selectors) {\n return;\n }\n this.rules = [new Ruleset(utils.copyArray(selectors), [this.rules[0]])];\n this.setParent(this.rules, this);\n }\n};\n\nexport default NestableAtRulePrototype;\n","import Node from './node';\nimport Selector from './selector';\nimport Ruleset from './ruleset';\nimport Anonymous from './anonymous';\nimport NestableAtRulePrototype from './nested-at-rule';\n\nconst AtRule = function(\n name,\n value,\n rules,\n index,\n currentFileInfo,\n debugInfo,\n isRooted,\n visibilityInfo\n) {\n let i;\n var selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors();\n\n this.name = name;\n this.value = (value instanceof Node) ? value : (value ? new Anonymous(value) : value);\n if (rules) {\n if (Array.isArray(rules)) {\n const allDeclarations = this.declarationsBlock(rules);\n \n let allRulesetDeclarations = true;\n rules.forEach(rule => {\n if (rule.type === 'Ruleset' && rule.rules) allRulesetDeclarations = allRulesetDeclarations && this.declarationsBlock(rule.rules, true);\n });\n\n if (allDeclarations && !isRooted) {\n this.simpleBlock = true;\n this.declarations = rules;\n } else if (allRulesetDeclarations && rules.length === 1 && !isRooted && !value) {\n this.simpleBlock = true;\n this.declarations = rules[0].rules ? rules[0].rules : rules;\n } else {\n this.rules = rules;\n }\n } else {\n const allDeclarations = this.declarationsBlock(rules.rules);\n \n if (allDeclarations && !isRooted && !value) {\n this.simpleBlock = true;\n this.declarations = rules.rules;\n } else {\n this.rules = [rules];\n this.rules[0].selectors = (new Selector([], null, null, index, currentFileInfo)).createEmptySelectors();\n }\n }\n if (!this.simpleBlock) {\n for (i = 0; i < this.rules.length; i++) {\n this.rules[i].allowImports = true;\n }\n }\n this.setParent(selectors, this);\n this.setParent(this.rules, this);\n }\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.debugInfo = debugInfo;\n this.isRooted = isRooted || false;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n}\n\nAtRule.prototype = Object.assign(new Node(), {\n type: 'AtRule',\n\n ...NestableAtRulePrototype,\n\n declarationsBlock(rules, mergeable = false) {\n if (!mergeable) {\n return rules.filter(function (node) { return (node.type === 'Declaration' || node.type === 'Comment') && !node.merge}).length === rules.length;\n } else {\n return rules.filter(function (node) { return (node.type === 'Declaration' || node.type === 'Comment'); }).length === rules.length;\n }\n },\n\n keywordList(rules) {\n if (!Array.isArray(rules)) {\n return false;\n } else { \n return rules.filter(function (node) { return (node.type === 'Keyword' || node.type === 'Comment'); }).length === rules.length;\n }\n },\n\n accept(visitor) {\n const value = this.value, rules = this.rules, declarations = this.declarations;\n\n if (rules) {\n this.rules = visitor.visitArray(rules);\n } else if (declarations) {\n this.declarations = visitor.visitArray(declarations); \n }\n if (value) {\n this.value = visitor.visit(value);\n }\n },\n\n isRulesetLike() {\n return this.rules || !this.isCharset();\n },\n\n isCharset() {\n return '@charset' === this.name;\n },\n\n genCSS(context, output) {\n const value = this.value, rules = this.rules || this.declarations;\n output.add(this.name, this.fileInfo(), this.getIndex());\n if (value) {\n output.add(' ');\n value.genCSS(context, output);\n }\n if (this.simpleBlock) {\n this.outputRuleset(context, output, this.declarations);\n } else if (rules) {\n this.outputRuleset(context, output, rules);\n } else {\n output.add(';');\n }\n },\n\n eval(context) {\n let mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules || this.declarations;\n \n // media stored inside other atrule should not bubble over it\n // backpup media bubbling information\n mediaPathBackup = context.mediaPath;\n mediaBlocksBackup = context.mediaBlocks;\n // deleted media bubbling information\n context.mediaPath = [];\n context.mediaBlocks = [];\n\n if (value) {\n value = value.eval(context);\n if (value.value && this.keywordList(value.value)) {\n value = new Anonymous(value.value.map(keyword => keyword.value).join(', '), this.getIndex(), this.fileInfo());\n }\n }\n\n if (rules) {\n rules = this.evalRoot(context, rules);\n }\n if (Array.isArray(rules) && rules[0].rules && Array.isArray(rules[0].rules) && rules[0].rules.length) {\n const allMergeableDeclarations = this.declarationsBlock(rules[0].rules, true);\n if (allMergeableDeclarations && !this.isRooted && !value) {\n var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;\n mergeRules(rules[0].rules);\n rules = rules[0].rules;\n rules.forEach(rule => rule.merge = false);\n }\n }\n if (this.simpleBlock && rules) {\n rules[0].functionRegistry = context.frames[0].functionRegistry.inherit();\n rules = rules.map(function (rule) { return rule.eval(context); });\n }\n\n // restore media bubbling information\n context.mediaPath = mediaPathBackup;\n context.mediaBlocks = mediaBlocksBackup;\n return new AtRule(this.name, value, rules, this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo());\n },\n\n evalRoot(context, rules) {\n let ampersandCount = 0;\n let noAmpersandCount = 0;\n let noAmpersands = true;\n let allAmpersands = false;\n\n if (!this.simpleBlock) {\n rules = [rules[0].eval(context)];\n }\n\n let precedingSelectors = [];\n if (context.frames.length > 0) {\n for (let index = 0; index < context.frames.length; index++) {\n const frame = context.frames[index];\n if (\n frame.type === 'Ruleset' &&\n frame.rules &&\n frame.rules.length > 0\n ) {\n if (frame && !frame.root && frame.selectors && frame.selectors.length > 0) {\n precedingSelectors = precedingSelectors.concat(frame.selectors);\n }\n }\n if (precedingSelectors.length > 0) {\n let value = '';\n const output = { add: function (s) { value += s; } };\n for (let i = 0; i < precedingSelectors.length; i++) {\n precedingSelectors[i].genCSS(context, output);\n }\n if (/^&+$/.test(value.replace(/\\s+/g, ''))) {\n noAmpersands = false;\n noAmpersandCount++;\n } else {\n allAmpersands = false;\n ampersandCount++;\n }\n }\n }\n }\n\n const mixedAmpersands = ampersandCount > 0 && noAmpersandCount > 0 && !allAmpersands && !noAmpersands;\n if (\n (this.isRooted && ampersandCount > 0 && noAmpersandCount === 0 && !allAmpersands && noAmpersands)\n || !mixedAmpersands\n ) {\n rules[0].root = true;\n }\n return rules;\n },\n\n variable(name) {\n if (this.rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n return Ruleset.prototype.variable.call(this.rules[0], name);\n }\n },\n\n find() {\n if (this.rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n return Ruleset.prototype.find.apply(this.rules[0], arguments);\n }\n },\n\n rulesets() {\n if (this.rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n return Ruleset.prototype.rulesets.apply(this.rules[0]);\n }\n },\n\n outputRuleset(context, output, rules) {\n const ruleCnt = rules.length;\n let i;\n context.tabLevel = (context.tabLevel | 0) + 1;\n\n // Compressed\n if (context.compress) {\n output.add('{');\n for (i = 0; i < ruleCnt; i++) {\n rules[i].genCSS(context, output);\n }\n output.add('}');\n context.tabLevel--;\n return;\n }\n\n // Non-compressed\n const tabSetStr = `\\n${Array(context.tabLevel).join(' ')}`, tabRuleStr = `${tabSetStr} `;\n if (!ruleCnt) {\n output.add(` {${tabSetStr}}`);\n } else {\n output.add(` {${tabRuleStr}`);\n rules[0].genCSS(context, output);\n for (i = 1; i < ruleCnt; i++) {\n output.add(tabRuleStr);\n rules[i].genCSS(context, output);\n }\n output.add(`${tabSetStr}}`);\n }\n\n context.tabLevel--;\n }\n});\n\nexport default AtRule;\n","import Node from './node';\nimport contexts from '../contexts';\nimport * as utils from '../utils';\n\nconst DetachedRuleset = function(ruleset, frames) {\n this.ruleset = ruleset;\n this.frames = frames;\n this.setParent(this.ruleset, this);\n};\n\nDetachedRuleset.prototype = Object.assign(new Node(), {\n type: 'DetachedRuleset',\n evalFirst: true,\n\n accept(visitor) {\n this.ruleset = visitor.visit(this.ruleset);\n },\n\n eval(context) {\n const frames = this.frames || utils.copyArray(context.frames);\n return new DetachedRuleset(this.ruleset, frames);\n },\n\n callEval(context) {\n return this.ruleset.eval(this.frames ? new contexts.Eval(context, this.frames.concat(context.frames)) : context);\n }\n});\n\nexport default DetachedRuleset;\n","import Node from './node';\nimport Color from './color';\nimport Dimension from './dimension';\nimport * as Constants from '../constants';\nconst MATH = Constants.Math;\n\n\nconst Operation = function(op, operands, isSpaced) {\n this.op = op.trim();\n this.operands = operands;\n this.isSpaced = isSpaced;\n};\n\nOperation.prototype = Object.assign(new Node(), {\n type: 'Operation',\n\n accept(visitor) {\n this.operands = visitor.visitArray(this.operands);\n },\n\n eval(context) {\n let a = this.operands[0].eval(context), b = this.operands[1].eval(context), op;\n\n if (context.isMathOn(this.op)) {\n op = this.op === './' ? '/' : this.op;\n if (a instanceof Dimension && b instanceof Color) {\n a = a.toColor();\n }\n if (b instanceof Dimension && a instanceof Color) {\n b = b.toColor();\n }\n if (!a.operate || !b.operate) {\n if (\n (a instanceof Operation || b instanceof Operation)\n && a.op === '/' && context.math === MATH.PARENS_DIVISION\n ) {\n return new Operation(this.op, [a, b], this.isSpaced);\n }\n throw { type: 'Operation',\n message: 'Operation on an invalid type' };\n }\n\n return a.operate(context, op, b);\n } else {\n return new Operation(this.op, [a, b], this.isSpaced);\n }\n },\n\n genCSS(context, output) {\n this.operands[0].genCSS(context, output);\n if (this.isSpaced) {\n output.add(' ');\n }\n output.add(this.op);\n if (this.isSpaced) {\n output.add(' ');\n }\n this.operands[1].genCSS(context, output);\n }\n});\n\nexport default Operation;\n","import Expression from '../tree/expression';\n\nclass functionCaller {\n constructor(name, context, index, currentFileInfo) {\n this.name = name.toLowerCase();\n this.index = index;\n this.context = context;\n this.currentFileInfo = currentFileInfo;\n\n this.func = context.frames[0].functionRegistry.get(this.name);\n }\n\n isValid() {\n return Boolean(this.func);\n }\n\n call(args) {\n if (!(Array.isArray(args))) {\n args = [args];\n }\n const evalArgs = this.func.evalArgs;\n if (evalArgs !== false) {\n args = args.map(a => a.eval(this.context));\n }\n const commentFilter = item => !(item.type === 'Comment');\n\n // This code is terrible and should be replaced as per this issue...\n // https://github.com/less/less.js/issues/2477\n args = args\n .filter(commentFilter)\n .map(item => {\n if (item.type === 'Expression') {\n const subNodes = item.value.filter(commentFilter);\n if (subNodes.length === 1) {\n // https://github.com/less/less.js/issues/3616\n if (item.parens && subNodes[0].op === '/') {\n return item;\n }\n return subNodes[0];\n } else {\n return new Expression(subNodes);\n }\n }\n return item;\n });\n\n if (evalArgs === false) {\n return this.func(this.context, ...args);\n }\n\n return this.func(...args);\n }\n}\n\nexport default functionCaller;\n","import Node from './node';\nimport Anonymous from './anonymous';\nimport FunctionCaller from '../functions/function-caller';\n\n//\n// A function call node.\n//\nconst Call = function(name, args, index, currentFileInfo) {\n this.name = name;\n this.args = args;\n this.calc = name === 'calc';\n this._index = index;\n this._fileInfo = currentFileInfo;\n}\n\nCall.prototype = Object.assign(new Node(), {\n type: 'Call',\n\n accept(visitor) {\n if (this.args) {\n this.args = visitor.visitArray(this.args);\n }\n },\n\n //\n // When evaluating a function call,\n // we either find the function in the functionRegistry,\n // in which case we call it, passing the evaluated arguments,\n // if this returns null or we cannot find the function, we\n // simply print it out as it appeared originally [2].\n //\n // The reason why we evaluate the arguments, is in the case where\n // we try to pass a variable to a function, like: `saturate(@color)`.\n // The function should receive the value, not the variable.\n //\n eval(context) {\n /**\n * Turn off math for calc(), and switch back on for evaluating nested functions\n */\n const currentMathContext = context.mathOn;\n context.mathOn = !this.calc;\n if (this.calc || context.inCalc) {\n context.enterCalc();\n }\n\n const exitCalc = () => {\n if (this.calc || context.inCalc) {\n context.exitCalc();\n }\n context.mathOn = currentMathContext;\n };\n\n let result;\n const funcCaller = new FunctionCaller(this.name, context, this.getIndex(), this.fileInfo());\n\n if (funcCaller.isValid()) {\n try {\n result = funcCaller.call(this.args);\n exitCalc();\n } catch (e) {\n // eslint-disable-next-line no-prototype-builtins\n if (e.hasOwnProperty('line') && e.hasOwnProperty('column')) {\n throw e;\n }\n throw { \n type: e.type || 'Runtime',\n message: `Error evaluating function \\`${this.name}\\`${e.message ? `: ${e.message}` : ''}`,\n index: this.getIndex(), \n filename: this.fileInfo().filename,\n line: e.lineNumber,\n column: e.columnNumber\n };\n }\n }\n\n if (result !== null && result !== undefined) {\n // Results that that are not nodes are cast as Anonymous nodes\n // Falsy values or booleans are returned as empty nodes\n if (!(result instanceof Node)) {\n if (!result || result === true) {\n result = new Anonymous(null); \n }\n else {\n result = new Anonymous(result.toString()); \n }\n \n }\n result._index = this._index;\n result._fileInfo = this._fileInfo;\n return result;\n }\n\n const args = this.args.map(a => a.eval(context));\n exitCalc();\n\n return new Call(this.name, args, this.getIndex(), this.fileInfo());\n },\n\n genCSS(context, output) {\n output.add(`${this.name}(`, this.fileInfo(), this.getIndex());\n\n for (let i = 0; i < this.args.length; i++) {\n this.args[i].genCSS(context, output);\n if (i + 1 < this.args.length) {\n output.add(', ');\n }\n }\n\n output.add(')');\n }\n});\n\nexport default Call;\n","import Node from './node';\nimport Call from './call';\n\nconst Variable = function(name, index, currentFileInfo) {\n this.name = name;\n this._index = index;\n this._fileInfo = currentFileInfo;\n};\n\nVariable.prototype = Object.assign(new Node(), {\n type: 'Variable',\n\n eval(context) {\n let variable, name = this.name;\n\n if (name.indexOf('@@') === 0) {\n name = `@${new Variable(name.slice(1), this.getIndex(), this.fileInfo()).eval(context).value}`;\n }\n\n if (this.evaluating) {\n throw { type: 'Name',\n message: `Recursive variable definition for ${name}`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n\n this.evaluating = true;\n\n variable = this.find(context.frames, function (frame) {\n const v = frame.variable(name);\n if (v) {\n if (v.important) {\n const importantScope = context.importantScope[context.importantScope.length - 1];\n importantScope.important = v.important;\n }\n // If in calc, wrap vars in a function call to cascade evaluate args first\n if (context.inCalc) {\n return (new Call('_SELF', [v.value])).eval(context);\n }\n else {\n return v.value.eval(context);\n }\n }\n });\n if (variable) {\n this.evaluating = false;\n return variable;\n } else {\n throw { type: 'Name',\n message: `variable ${name} is undefined`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n },\n\n find(obj, fun) {\n for (let i = 0, r; i < obj.length; i++) {\n r = fun.call(obj, obj[i]);\n if (r) { return r; }\n }\n return null;\n }\n});\n\nexport default Variable;\n","import Node from './node';\nimport Declaration from './declaration';\n\nconst Property = function(name, index, currentFileInfo) {\n this.name = name;\n this._index = index;\n this._fileInfo = currentFileInfo;\n};\n\nProperty.prototype = Object.assign(new Node(), {\n type: 'Property',\n\n eval(context) {\n let property;\n const name = this.name;\n // TODO: shorten this reference\n const mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;\n\n if (this.evaluating) {\n throw { type: 'Name',\n message: `Recursive property reference for ${name}`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n\n this.evaluating = true;\n\n property = this.find(context.frames, function (frame) {\n let v;\n const vArr = frame.property(name);\n if (vArr) {\n for (let i = 0; i < vArr.length; i++) {\n v = vArr[i];\n\n vArr[i] = new Declaration(v.name,\n v.value,\n v.important,\n v.merge,\n v.index,\n v.currentFileInfo,\n v.inline,\n v.variable\n );\n }\n mergeRules(vArr);\n\n v = vArr[vArr.length - 1];\n if (v.important) {\n const importantScope = context.importantScope[context.importantScope.length - 1];\n importantScope.important = v.important;\n }\n v = v.value.eval(context);\n return v;\n }\n });\n if (property) {\n this.evaluating = false;\n return property;\n } else {\n throw { type: 'Name',\n message: `Property '${name}' is undefined`,\n filename: this.currentFileInfo.filename,\n index: this.index };\n }\n },\n\n find(obj, fun) {\n for (let i = 0, r; i < obj.length; i++) {\n r = fun.call(obj, obj[i]);\n if (r) { return r; }\n }\n return null;\n }\n});\n\nexport default Property;\n","import Node from './node';\n\nconst Attribute = function(key, op, value, cif) {\n this.key = key;\n this.op = op;\n this.value = value;\n this.cif = cif;\n}\n\nAttribute.prototype = Object.assign(new Node(), {\n type: 'Attribute',\n\n eval(context) {\n return new Attribute(\n this.key.eval ? this.key.eval(context) : this.key,\n this.op,\n (this.value && this.value.eval) ? this.value.eval(context) : this.value,\n this.cif\n );\n },\n\n genCSS(context, output) {\n output.add(this.toCSS(context));\n },\n\n toCSS(context) {\n let value = this.key.toCSS ? this.key.toCSS(context) : this.key;\n\n if (this.op) {\n value += this.op;\n value += (this.value.toCSS ? this.value.toCSS(context) : this.value);\n }\n\n if (this.cif) {\n value = value + ' ' + this.cif;\n }\n\n return `[${value}]`;\n }\n});\n\nexport default Attribute;\n","import Node from './node';\nimport Variable from './variable';\nimport Property from './property';\n\nconst Quoted = function(str, content, escaped, index, currentFileInfo) {\n this.escaped = (escaped === undefined) ? true : escaped;\n this.value = content || '';\n this.quote = str.charAt(0);\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.variableRegex = /@\\{([\\w-]+)\\}/g;\n this.propRegex = /\\$\\{([\\w-]+)\\}/g;\n this.allowRoot = escaped;\n};\n\nQuoted.prototype = Object.assign(new Node(), {\n type: 'Quoted',\n\n genCSS(context, output) {\n if (!this.escaped) {\n output.add(this.quote, this.fileInfo(), this.getIndex());\n }\n output.add(this.value);\n if (!this.escaped) {\n output.add(this.quote);\n }\n },\n\n containsVariables() {\n return this.value.match(this.variableRegex);\n },\n\n eval(context) {\n const that = this;\n let value = this.value;\n const variableReplacement = function (_, name1, name2) {\n const v = new Variable(`@${name1 ?? name2}`, that.getIndex(), that.fileInfo()).eval(context, true);\n return (v instanceof Quoted) ? v.value : v.toCSS();\n };\n const propertyReplacement = function (_, name1, name2) {\n const v = new Property(`$${name1 ?? name2}`, that.getIndex(), that.fileInfo()).eval(context, true);\n return (v instanceof Quoted) ? v.value : v.toCSS();\n };\n function iterativeReplace(value, regexp, replacementFnc) {\n let evaluatedValue = value;\n do {\n value = evaluatedValue.toString();\n evaluatedValue = value.replace(regexp, replacementFnc);\n } while (value !== evaluatedValue);\n return evaluatedValue;\n }\n value = iterativeReplace(value, this.variableRegex, variableReplacement);\n value = iterativeReplace(value, this.propRegex, propertyReplacement);\n return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo());\n },\n\n compare(other) {\n // when comparing quoted strings allow the quote to differ\n if (other.type === 'Quoted' && !this.escaped && !other.escaped) {\n return Node.numericCompare(this.value, other.value);\n } else {\n return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;\n }\n }\n});\n\nexport default Quoted;\n","import Node from './node';\n\nfunction escapePath(path) {\n return path.replace(/[()'\"\\s]/g, function(match) { return `\\\\${match}`; });\n}\n\nconst URL = function(val, index, currentFileInfo, isEvald) {\n this.value = val;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.isEvald = isEvald;\n};\n\nURL.prototype = Object.assign(new Node(), {\n type: 'Url',\n\n accept(visitor) {\n this.value = visitor.visit(this.value);\n },\n\n genCSS(context, output) {\n output.add('url(');\n this.value.genCSS(context, output);\n output.add(')');\n },\n\n eval(context) {\n const val = this.value.eval(context);\n let rootpath;\n\n if (!this.isEvald) {\n // Add the rootpath if the URL requires a rewrite\n rootpath = this.fileInfo() && this.fileInfo().rootpath;\n if (typeof rootpath === 'string' &&\n typeof val.value === 'string' &&\n context.pathRequiresRewrite(val.value)) {\n if (!val.quote) {\n rootpath = escapePath(rootpath);\n }\n val.value = context.rewritePath(val.value, rootpath);\n } else {\n val.value = context.normalizePath(val.value);\n }\n\n // Add url args if enabled\n if (context.urlArgs) {\n if (!val.value.match(/^\\s*data:/)) {\n const delimiter = val.value.indexOf('?') === -1 ? '?' : '&';\n const urlArgs = delimiter + context.urlArgs;\n if (val.value.indexOf('#') !== -1) {\n val.value = val.value.replace('#', `${urlArgs}#`);\n } else {\n val.value += urlArgs;\n }\n }\n }\n }\n\n return new URL(val, this.getIndex(), this.fileInfo(), true);\n }\n});\n\nexport default URL;\n","import Ruleset from './ruleset';\nimport Value from './value';\nimport Selector from './selector';\nimport AtRule from './atrule';\nimport NestableAtRulePrototype from './nested-at-rule';\n\nconst Media = function(value, features, index, currentFileInfo, visibilityInfo) {\n this._index = index;\n this._fileInfo = currentFileInfo;\n\n const selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors();\n\n this.features = new Value(features);\n this.rules = [new Ruleset(selectors, value)];\n this.rules[0].allowImports = true;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n this.setParent(selectors, this);\n this.setParent(this.features, this);\n this.setParent(this.rules, this);\n};\n\nMedia.prototype = Object.assign(new AtRule(), {\n type: 'Media',\n\n ...NestableAtRulePrototype,\n\n genCSS(context, output) {\n output.add('@media ', this._fileInfo, this._index);\n this.features.genCSS(context, output);\n this.outputRuleset(context, output, this.rules);\n },\n\n eval(context) {\n if (!context.mediaBlocks) {\n context.mediaBlocks = [];\n context.mediaPath = [];\n }\n\n const media = new Media(null, [], this._index, this._fileInfo, this.visibilityInfo());\n if (this.debugInfo) {\n this.rules[0].debugInfo = this.debugInfo;\n media.debugInfo = this.debugInfo;\n }\n \n media.features = this.features.eval(context);\n\n context.mediaPath.push(media);\n context.mediaBlocks.push(media);\n\n this.rules[0].functionRegistry = context.frames[0].functionRegistry.inherit();\n context.frames.unshift(this.rules[0]);\n media.rules = [this.rules[0].eval(context)];\n context.frames.shift();\n\n context.mediaPath.pop();\n\n return context.mediaPath.length === 0 ? media.evalTop(context) :\n media.evalNested(context);\n }\n});\n\nexport default Media;\n","import Node from './node';\nimport Media from './media';\nimport URL from './url';\nimport Quoted from './quoted';\nimport Ruleset from './ruleset';\nimport Anonymous from './anonymous';\nimport * as utils from '../utils';\nimport LessError from '../less-error';\nimport Expression from './expression';\n\n//\n// CSS @import node\n//\n// The general strategy here is that we don't want to wait\n// for the parsing to be completed, before we start importing\n// the file. That's because in the context of a browser,\n// most of the time will be spent waiting for the server to respond.\n//\n// On creation, we push the import path to our import queue, though\n// `import,push`, we also pass it a callback, which it'll call once\n// the file has been fetched, and parsed.\n//\nconst Import = function(path, features, options, index, currentFileInfo, visibilityInfo) {\n this.options = options;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.path = path;\n this.features = features;\n this.allowRoot = true;\n\n if (this.options.less !== undefined || this.options.inline) {\n this.css = !this.options.less || this.options.inline;\n } else {\n const pathValue = this.getPath();\n if (pathValue && /[#.&?]css([?;].*)?$/.test(pathValue)) {\n this.css = true;\n }\n }\n this.copyVisibilityInfo(visibilityInfo);\n this.setParent(this.features, this);\n this.setParent(this.path, this);\n};\n\nImport.prototype = Object.assign(new Node(), {\n type: 'Import',\n\n accept(visitor) {\n if (this.features) {\n this.features = visitor.visit(this.features);\n }\n this.path = visitor.visit(this.path);\n if (!this.options.isPlugin && !this.options.inline && this.root) {\n this.root = visitor.visit(this.root);\n }\n },\n\n genCSS(context, output) {\n if (this.css && this.path._fileInfo.reference === undefined) {\n output.add('@import ', this._fileInfo, this._index);\n this.path.genCSS(context, output);\n if (this.features) {\n output.add(' ');\n this.features.genCSS(context, output);\n }\n output.add(';');\n }\n },\n\n getPath() {\n return (this.path instanceof URL) ?\n this.path.value.value : this.path.value;\n },\n\n isVariableImport() {\n let path = this.path;\n if (path instanceof URL) {\n path = path.value;\n }\n if (path instanceof Quoted) {\n return path.containsVariables();\n }\n\n return true;\n },\n\n evalForImport(context) {\n let path = this.path;\n\n if (path instanceof URL) {\n path = path.value;\n }\n\n return new Import(path.eval(context), this.features, this.options, this._index, this._fileInfo, this.visibilityInfo());\n },\n\n evalPath(context) {\n const path = this.path.eval(context);\n const fileInfo = this._fileInfo;\n\n if (!(path instanceof URL)) {\n // Add the rootpath if the URL requires a rewrite\n const pathValue = path.value;\n if (fileInfo &&\n pathValue &&\n context.pathRequiresRewrite(pathValue)) {\n path.value = context.rewritePath(pathValue, fileInfo.rootpath);\n } else {\n path.value = context.normalizePath(path.value);\n }\n }\n\n return path;\n },\n\n eval(context) {\n const result = this.doEval(context);\n if (this.options.reference || this.blocksVisibility()) {\n if (result.length || result.length === 0) {\n result.forEach(function (node) {\n node.addVisibilityBlock();\n }\n );\n } else {\n result.addVisibilityBlock();\n }\n }\n return result;\n },\n\n doEval(context) {\n let ruleset;\n let registry;\n const features = this.features && this.features.eval(context);\n\n if (this.options.isPlugin) {\n if (this.root && this.root.eval) {\n try {\n this.root.eval(context);\n }\n catch (e) {\n e.message = 'Plugin error during evaluation';\n throw new LessError(e, this.root.imports, this.root.filename);\n }\n }\n registry = context.frames[0] && context.frames[0].functionRegistry;\n if ( registry && this.root && this.root.functions ) {\n registry.addMultiple( this.root.functions );\n }\n\n return [];\n }\n\n if (this.skip) {\n if (typeof this.skip === 'function') {\n this.skip = this.skip();\n }\n if (this.skip) {\n return [];\n }\n }\n if (this.features) {\n let featureValue = this.features.value;\n if (Array.isArray(featureValue) && featureValue.length >= 1) {\n const expr = featureValue[0];\n if (expr.type === 'Expression' && Array.isArray(expr.value) && expr.value.length >= 2) {\n featureValue = expr.value;\n const isLayer = featureValue[0].type === 'Keyword' && featureValue[0].value === 'layer'\n && featureValue[1].type === 'Paren';\n if (isLayer) {\n this.css = false;\n }\n }\n }\n }\n if (this.options.inline) {\n const contents = new Anonymous(this.root, 0,\n {\n filename: this.importedFilename,\n reference: this.path._fileInfo && this.path._fileInfo.reference\n }, true, true);\n\n return this.features ? new Media([contents], this.features.value) : [contents];\n } else if (this.css || this.layerCss) {\n const newImport = new Import(this.evalPath(context), features, this.options, this._index);\n if (this.layerCss) {\n newImport.css = this.layerCss;\n newImport.path._fileInfo = this._fileInfo;\n }\n if (!newImport.css && this.error) {\n throw this.error;\n }\n return newImport;\n } else if (this.root) {\n if (this.features) {\n let featureValue = this.features.value;\n if (Array.isArray(featureValue) && featureValue.length === 1) {\n const expr = featureValue[0];\n if (expr.type === 'Expression' && Array.isArray(expr.value) && expr.value.length >= 2) {\n featureValue = expr.value;\n const isLayer = featureValue[0].type === 'Keyword' && featureValue[0].value === 'layer'\n && featureValue[1].type === 'Paren';\n if (isLayer) {\n this.layerCss = true;\n featureValue[0] = new Expression(featureValue.slice(0, 2));\n featureValue.splice(1, 1);\n featureValue[0].noSpacing = true;\n return this;\n }\n }\n }\n }\n ruleset = new Ruleset(null, utils.copyArray(this.root.rules));\n ruleset.evalImports(context);\n\n return this.features ? new Media(ruleset.rules, this.features.value) : ruleset.rules;\n } else {\n if (this.features) {\n let featureValue = this.features.value;\n if (Array.isArray(featureValue) && featureValue.length >= 1) {\n featureValue = featureValue[0].value;\n if (Array.isArray(featureValue) && featureValue.length >= 2) {\n const isLayer = featureValue[0].type === 'Keyword' && featureValue[0].value === 'layer'\n && featureValue[1].type === 'Paren';\n if (isLayer) {\n this.css = true;\n featureValue[0] = new Expression(featureValue.slice(0, 2));\n featureValue.splice(1, 1);\n featureValue[0].noSpacing = true;\n return this;\n }\n }\n }\n }\n return [];\n }\n }\n});\n\nexport default Import;\n","import Node from './node';\nimport Variable from './variable';\n\nconst JsEvalNode = function() {};\n\nJsEvalNode.prototype = Object.assign(new Node(), {\n evaluateJavaScript(expression, context) {\n let result;\n const that = this;\n const evalContext = {};\n\n if (!context.javascriptEnabled) {\n throw { message: 'Inline JavaScript is not enabled. Is it set in your options?',\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n\n expression = expression.replace(/@\\{([\\w-]+)\\}/g, function (_, name) {\n return that.jsify(new Variable(`@${name}`, that.getIndex(), that.fileInfo()).eval(context));\n });\n\n try {\n expression = new Function(`return (${expression})`);\n } catch (e) {\n throw { message: `JavaScript evaluation error: ${e.message} from \\`${expression}\\`` ,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n\n const variables = context.frames[0].variables();\n for (const k in variables) {\n // eslint-disable-next-line no-prototype-builtins\n if (variables.hasOwnProperty(k)) {\n evalContext[k.slice(1)] = {\n value: variables[k].value,\n toJS: function () {\n return this.value.eval(context).toCSS();\n }\n };\n }\n }\n\n try {\n result = expression.call(evalContext);\n } catch (e) {\n throw { message: `JavaScript evaluation error: '${e.name}: ${e.message.replace(/[\"]/g, '\\'')}'` ,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n return result;\n },\n\n jsify(obj) {\n if (Array.isArray(obj.value) && (obj.value.length > 1)) {\n return `[${obj.value.map(function (v) { return v.toCSS(); }).join(', ')}]`;\n } else {\n return obj.toCSS();\n }\n }\n});\n\nexport default JsEvalNode;\n","import JsEvalNode from './js-eval-node';\nimport Dimension from './dimension';\nimport Quoted from './quoted';\nimport Anonymous from './anonymous';\n\nconst JavaScript = function(string, escaped, index, currentFileInfo) {\n this.escaped = escaped;\n this.expression = string;\n this._index = index;\n this._fileInfo = currentFileInfo;\n}\n\nJavaScript.prototype = Object.assign(new JsEvalNode(), {\n type: 'JavaScript',\n\n eval(context) {\n const result = this.evaluateJavaScript(this.expression, context);\n const type = typeof result;\n\n if (type === 'number' && !isNaN(result)) {\n return new Dimension(result);\n } else if (type === 'string') {\n return new Quoted(`\"${result}\"`, result, this.escaped, this._index);\n } else if (Array.isArray(result)) {\n return new Anonymous(result.join(', '));\n } else {\n return new Anonymous(result);\n }\n }\n});\n\nexport default JavaScript;\n","import Node from './node';\n\nconst Assignment = function(key, val) {\n this.key = key;\n this.value = val;\n}\n\nAssignment.prototype = Object.assign(new Node(), {\n type: 'Assignment',\n\n accept(visitor) {\n this.value = visitor.visit(this.value);\n },\n\n eval(context) {\n if (this.value.eval) {\n return new Assignment(this.key, this.value.eval(context));\n }\n return this;\n },\n\n genCSS(context, output) {\n output.add(`${this.key}=`);\n if (this.value.genCSS) {\n this.value.genCSS(context, output);\n } else {\n output.add(this.value);\n }\n }\n});\n\nexport default Assignment;\n","import Node from './node';\n\nconst Condition = function(op, l, r, i, negate) {\n this.op = op.trim();\n this.lvalue = l;\n this.rvalue = r;\n this._index = i;\n this.negate = negate;\n};\n\nCondition.prototype = Object.assign(new Node(), {\n type: 'Condition',\n\n accept(visitor) {\n this.lvalue = visitor.visit(this.lvalue);\n this.rvalue = visitor.visit(this.rvalue);\n },\n\n eval(context) {\n const result = (function (op, a, b) {\n switch (op) {\n case 'and': return a && b;\n case 'or': return a || b;\n default:\n switch (Node.compare(a, b)) {\n case -1:\n return op === '<' || op === '=<' || op === '<=';\n case 0:\n return op === '=' || op === '>=' || op === '=<' || op === '<=';\n case 1:\n return op === '>' || op === '>=';\n default:\n return false;\n }\n }\n })(this.op, this.lvalue.eval(context), this.rvalue.eval(context));\n\n return this.negate ? !result : result;\n }\n});\n\nexport default Condition;\n","import { copy } from 'copy-anything';\nimport Declaration from './declaration';\nimport Node from './node';\n\nconst QueryInParens = function (op, l, m, op2, r, i) {\n this.op = op.trim();\n this.lvalue = l;\n this.mvalue = m;\n this.op2 = op2 ? op2.trim() : null;\n this.rvalue = r;\n this._index = i;\n this.mvalues = [];\n};\n\nQueryInParens.prototype = Object.assign(new Node(), {\n type: 'QueryInParens',\n\n accept(visitor) {\n this.lvalue = visitor.visit(this.lvalue);\n this.mvalue = visitor.visit(this.mvalue);\n if (this.rvalue) {\n this.rvalue = visitor.visit(this.rvalue);\n }\n },\n\n eval(context) {\n this.lvalue = this.lvalue.eval(context);\n \n let variableDeclaration;\n let rule;\n\n for (let i = 0; (rule = context.frames[i]); i++) {\n if (rule.type === 'Ruleset') {\n variableDeclaration = rule.rules.find(function (r) {\n if ((r instanceof Declaration) && r.variable) {\n return true;\n }\n\n return false;\n });\n \n if (variableDeclaration) {\n break;\n }\n }\n }\n\n if (!this.mvalueCopy) {\n this.mvalueCopy = copy(this.mvalue);\n }\n \n if (variableDeclaration) {\n this.mvalue = this.mvalueCopy;\n this.mvalue = this.mvalue.eval(context);\n this.mvalues.push(this.mvalue);\n } else {\n this.mvalue = this.mvalue.eval(context);\n }\n\n if (this.rvalue) {\n this.rvalue = this.rvalue.eval(context);\n }\n return this;\n },\n\n genCSS(context, output) {\n this.lvalue.genCSS(context, output);\n output.add(' ' + this.op + ' ');\n if (this.mvalues.length > 0) {\n this.mvalue = this.mvalues.shift();\n }\n this.mvalue.genCSS(context, output);\n if (this.rvalue) {\n output.add(' ' + this.op2 + ' ');\n this.rvalue.genCSS(context, output);\n }\n },\n});\n\nexport default QueryInParens;\n","import Ruleset from './ruleset';\nimport Value from './value';\nimport Selector from './selector';\nimport AtRule from './atrule';\nimport NestableAtRulePrototype from './nested-at-rule';\n\nconst Container = function(value, features, index, currentFileInfo, visibilityInfo) {\n this._index = index;\n this._fileInfo = currentFileInfo;\n\n const selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors();\n\n this.features = new Value(features);\n this.rules = [new Ruleset(selectors, value)];\n this.rules[0].allowImports = true;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n this.setParent(selectors, this);\n this.setParent(this.features, this);\n this.setParent(this.rules, this);\n};\n\nContainer.prototype = Object.assign(new AtRule(), {\n type: 'Container',\n\n ...NestableAtRulePrototype,\n\n genCSS(context, output) {\n output.add('@container ', this._fileInfo, this._index);\n this.features.genCSS(context, output);\n this.outputRuleset(context, output, this.rules);\n },\n\n eval(context) {\n if (!context.mediaBlocks) {\n context.mediaBlocks = [];\n context.mediaPath = [];\n }\n\n const media = new Container(null, [], this._index, this._fileInfo, this.visibilityInfo());\n if (this.debugInfo) {\n this.rules[0].debugInfo = this.debugInfo;\n media.debugInfo = this.debugInfo;\n }\n \n media.features = this.features.eval(context);\n\n context.mediaPath.push(media);\n context.mediaBlocks.push(media);\n\n this.rules[0].functionRegistry = context.frames[0].functionRegistry.inherit();\n context.frames.unshift(this.rules[0]);\n media.rules = [this.rules[0].eval(context)];\n context.frames.shift();\n\n context.mediaPath.pop();\n\n return context.mediaPath.length === 0 ? media.evalTop(context) :\n media.evalNested(context);\n }\n});\n\nexport default Container;\n","import Node from './node';\n\nconst UnicodeDescriptor = function(value) {\n this.value = value;\n}\n\nUnicodeDescriptor.prototype = Object.assign(new Node(), {\n type: 'UnicodeDescriptor'\n})\n\nexport default UnicodeDescriptor;\n","import Node from './node';\nimport Operation from './operation';\nimport Dimension from './dimension';\n\nconst Negative = function(node) {\n this.value = node;\n};\n\nNegative.prototype = Object.assign(new Node(), {\n type: 'Negative',\n\n genCSS(context, output) {\n output.add('-');\n this.value.genCSS(context, output);\n },\n\n eval(context) {\n if (context.isMathOn()) {\n return (new Operation('*', [new Dimension(-1), this.value])).eval(context);\n }\n return new Negative(this.value.eval(context));\n }\n});\n\nexport default Negative;\n","import Node from './node';\nimport Selector from './selector';\n\nconst Extend = function(selector, option, index, currentFileInfo, visibilityInfo) {\n this.selector = selector;\n this.option = option;\n this.object_id = Extend.next_id++;\n this.parent_ids = [this.object_id];\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n\n switch (option) {\n case '!all':\n case 'all':\n this.allowBefore = true;\n this.allowAfter = true;\n break;\n default:\n this.allowBefore = false;\n this.allowAfter = false;\n break;\n }\n this.setParent(this.selector, this);\n};\n\nExtend.prototype = Object.assign(new Node(), {\n type: 'Extend',\n\n accept(visitor) {\n this.selector = visitor.visit(this.selector);\n },\n\n eval(context) {\n return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());\n },\n\n // remove when Nodes have JSDoc types\n // eslint-disable-next-line no-unused-vars\n clone(context) {\n return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());\n },\n\n // it concatenates (joins) all selectors in selector array\n findSelfSelectors(selectors) {\n let selfElements = [], i, selectorElements;\n\n for (i = 0; i < selectors.length; i++) {\n selectorElements = selectors[i].elements;\n // duplicate the logic in genCSS function inside the selector node.\n // future TODO - move both logics into the selector joiner visitor\n if (i > 0 && selectorElements.length && selectorElements[0].combinator.value === '') {\n selectorElements[0].combinator.value = ' ';\n }\n selfElements = selfElements.concat(selectors[i].elements);\n }\n\n this.selfSelectors = [new Selector(selfElements)];\n this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo());\n }\n});\n\nExtend.next_id = 0;\nexport default Extend;\n","import Node from './node';\nimport Variable from './variable';\nimport Ruleset from './ruleset';\nimport DetachedRuleset from './detached-ruleset';\nimport LessError from '../less-error';\n\nconst VariableCall = function(variable, index, currentFileInfo) {\n this.variable = variable;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.allowRoot = true;\n};\n\nVariableCall.prototype = Object.assign(new Node(), {\n type: 'VariableCall',\n\n eval(context) {\n let rules;\n let detachedRuleset = new Variable(this.variable, this.getIndex(), this.fileInfo()).eval(context);\n const error = new LessError({message: `Could not evaluate variable call ${this.variable}`});\n\n if (!detachedRuleset.ruleset) {\n if (detachedRuleset.rules) {\n rules = detachedRuleset;\n }\n else if (Array.isArray(detachedRuleset)) {\n rules = new Ruleset('', detachedRuleset);\n }\n else if (Array.isArray(detachedRuleset.value)) {\n rules = new Ruleset('', detachedRuleset.value);\n }\n else {\n throw error;\n }\n detachedRuleset = new DetachedRuleset(rules);\n }\n\n if (detachedRuleset.ruleset) {\n return detachedRuleset.callEval(context);\n }\n throw error;\n }\n});\n\nexport default VariableCall;\n","import Node from './node';\nimport Variable from './variable';\nimport Ruleset from './ruleset';\nimport Selector from './selector';\n\nconst NamespaceValue = function(ruleCall, lookups, index, fileInfo) {\n this.value = ruleCall;\n this.lookups = lookups;\n this._index = index;\n this._fileInfo = fileInfo;\n};\n\nNamespaceValue.prototype = Object.assign(new Node(), {\n type: 'NamespaceValue',\n\n eval(context) {\n let i, name, rules = this.value.eval(context);\n \n for (i = 0; i < this.lookups.length; i++) {\n name = this.lookups[i];\n\n /**\n * Eval'd DRs return rulesets.\n * Eval'd mixins return rules, so let's make a ruleset if we need it.\n * We need to do this because of late parsing of values\n */\n if (Array.isArray(rules)) {\n rules = new Ruleset([new Selector()], rules);\n }\n\n if (name === '') {\n rules = rules.lastDeclaration();\n }\n else if (name.charAt(0) === '@') {\n if (name.charAt(1) === '@') {\n name = `@${new Variable(name.substr(1)).eval(context).value}`;\n }\n if (rules.variables) {\n rules = rules.variable(name);\n }\n \n if (!rules) {\n throw { type: 'Name',\n message: `variable ${name} not found`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n }\n else {\n if (name.substring(0, 2) === '$@') {\n name = `$${new Variable(name.substr(1)).eval(context).value}`;\n }\n else {\n name = name.charAt(0) === '$' ? name : `$${name}`;\n }\n if (rules.properties) {\n rules = rules.property(name);\n }\n \n if (!rules) {\n throw { type: 'Name',\n message: `property \"${name.substr(1)}\" not found`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n // Properties are an array of values, since a ruleset can have multiple props.\n // We pick the last one (the \"cascaded\" value)\n rules = rules[rules.length - 1];\n }\n\n if (rules.value) {\n rules = rules.eval(context).value;\n }\n if (rules.ruleset) {\n rules = rules.ruleset.eval(context);\n }\n }\n return rules;\n }\n});\n\nexport default NamespaceValue;\n","import Selector from './selector';\nimport Element from './element';\nimport Ruleset from './ruleset';\nimport Declaration from './declaration';\nimport DetachedRuleset from './detached-ruleset';\nimport Expression from './expression';\nimport contexts from '../contexts';\nimport * as utils from '../utils';\n\nconst Definition = function(name, params, rules, condition, variadic, frames, visibilityInfo) {\n this.name = name || 'anonymous mixin';\n this.selectors = [new Selector([new Element(null, name, false, this._index, this._fileInfo)])];\n this.params = params;\n this.condition = condition;\n this.variadic = variadic;\n this.arity = params.length;\n this.rules = rules;\n this._lookups = {};\n const optionalParameters = [];\n this.required = params.reduce(function (count, p) {\n if (!p.name || (p.name && !p.value)) {\n return count + 1;\n }\n else {\n optionalParameters.push(p.name);\n return count;\n }\n }, 0);\n this.optionalParameters = optionalParameters;\n this.frames = frames;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n}\n\nDefinition.prototype = Object.assign(new Ruleset(), {\n type: 'MixinDefinition',\n evalFirst: true,\n\n accept(visitor) {\n if (this.params && this.params.length) {\n this.params = visitor.visitArray(this.params);\n }\n this.rules = visitor.visitArray(this.rules);\n if (this.condition) {\n this.condition = visitor.visit(this.condition);\n }\n },\n\n evalParams(context, mixinEnv, args, evaldArguments) {\n /* jshint boss:true */\n const frame = new Ruleset(null, null);\n\n let varargs;\n let arg;\n const params = utils.copyArray(this.params);\n let i;\n let j;\n let val;\n let name;\n let isNamedFound;\n let argIndex;\n let argsLength = 0;\n\n if (mixinEnv.frames && mixinEnv.frames[0] && mixinEnv.frames[0].functionRegistry) {\n frame.functionRegistry = mixinEnv.frames[0].functionRegistry.inherit();\n }\n mixinEnv = new contexts.Eval(mixinEnv, [frame].concat(mixinEnv.frames));\n\n if (args) {\n args = utils.copyArray(args);\n argsLength = args.length;\n\n for (i = 0; i < argsLength; i++) {\n arg = args[i];\n if (name = (arg && arg.name)) {\n isNamedFound = false;\n for (j = 0; j < params.length; j++) {\n if (!evaldArguments[j] && name === params[j].name) {\n evaldArguments[j] = arg.value.eval(context);\n frame.prependRule(new Declaration(name, arg.value.eval(context)));\n isNamedFound = true;\n break;\n }\n }\n if (isNamedFound) {\n args.splice(i, 1);\n i--;\n continue;\n } else {\n throw { type: 'Runtime', message: `Named argument for ${this.name} ${args[i].name} not found` };\n }\n }\n }\n }\n argIndex = 0;\n for (i = 0; i < params.length; i++) {\n if (evaldArguments[i]) { continue; }\n\n arg = args && args[argIndex];\n\n if (name = params[i].name) {\n if (params[i].variadic) {\n varargs = [];\n for (j = argIndex; j < argsLength; j++) {\n varargs.push(args[j].value.eval(context));\n }\n frame.prependRule(new Declaration(name, new Expression(varargs).eval(context)));\n } else {\n val = arg && arg.value;\n if (val) {\n // This was a mixin call, pass in a detached ruleset of it's eval'd rules\n if (Array.isArray(val)) {\n val = new DetachedRuleset(new Ruleset('', val));\n }\n else {\n val = val.eval(context);\n }\n } else if (params[i].value) {\n val = params[i].value.eval(mixinEnv);\n frame.resetCache();\n } else {\n throw { type: 'Runtime', message: `wrong number of arguments for ${this.name} (${argsLength} for ${this.arity})` };\n }\n\n frame.prependRule(new Declaration(name, val));\n evaldArguments[i] = val;\n }\n }\n\n if (params[i].variadic && args) {\n for (j = argIndex; j < argsLength; j++) {\n evaldArguments[j] = args[j].value.eval(context);\n }\n }\n argIndex++;\n }\n\n return frame;\n },\n\n makeImportant() {\n const rules = !this.rules ? this.rules : this.rules.map(function (r) {\n if (r.makeImportant) {\n return r.makeImportant(true);\n } else {\n return r;\n }\n });\n const result = new Definition(this.name, this.params, rules, this.condition, this.variadic, this.frames);\n return result;\n },\n\n eval(context) {\n return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || utils.copyArray(context.frames));\n },\n\n evalCall(context, args, important) {\n const _arguments = [];\n const mixinFrames = this.frames ? this.frames.concat(context.frames) : context.frames;\n const frame = this.evalParams(context, new contexts.Eval(context, mixinFrames), args, _arguments);\n let rules;\n let ruleset;\n\n frame.prependRule(new Declaration('@arguments', new Expression(_arguments).eval(context)));\n\n rules = utils.copyArray(this.rules);\n\n ruleset = new Ruleset(null, rules);\n ruleset.originalRuleset = this;\n ruleset = ruleset.eval(new contexts.Eval(context, [this, frame].concat(mixinFrames)));\n if (important) {\n ruleset = ruleset.makeImportant();\n }\n return ruleset;\n },\n\n matchCondition(args, context) {\n if (this.condition && !this.condition.eval(\n new contexts.Eval(context,\n [this.evalParams(context, /* the parameter variables */\n new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])]\n .concat(this.frames || []) // the parent namespace/mixin frames\n .concat(context.frames)))) { // the current environment frames\n return false;\n }\n return true;\n },\n\n matchArgs(args, context) {\n const allArgsCnt = (args && args.length) || 0;\n let len;\n const optionalParameters = this.optionalParameters;\n const requiredArgsCnt = !args ? 0 : args.reduce(function (count, p) {\n if (optionalParameters.indexOf(p.name) < 0) {\n return count + 1;\n } else {\n return count;\n }\n }, 0);\n\n if (!this.variadic) {\n if (requiredArgsCnt < this.required) {\n return false;\n }\n if (allArgsCnt > this.params.length) {\n return false;\n }\n } else {\n if (requiredArgsCnt < (this.required - 1)) {\n return false;\n }\n }\n\n // check patterns\n len = Math.min(requiredArgsCnt, this.arity);\n\n for (let i = 0; i < len; i++) {\n if (!this.params[i].name && !this.params[i].variadic) {\n if (args[i].value.eval(context).toCSS() != this.params[i].value.eval(context).toCSS()) {\n return false;\n }\n }\n }\n return true;\n }\n});\n\nexport default Definition;\n","import Node from './node';\nimport Selector from './selector';\nimport MixinDefinition from './mixin-definition';\nimport defaultFunc from '../functions/default';\n\nconst MixinCall = function(elements, args, index, currentFileInfo, important) {\n this.selector = new Selector(elements);\n this.arguments = args || [];\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.important = important;\n this.allowRoot = true;\n this.setParent(this.selector, this);\n};\n\nMixinCall.prototype = Object.assign(new Node(), {\n type: 'MixinCall',\n\n accept(visitor) {\n if (this.selector) {\n this.selector = visitor.visit(this.selector);\n }\n if (this.arguments.length) {\n this.arguments = visitor.visitArray(this.arguments);\n }\n },\n\n eval(context) {\n let mixins;\n let mixin;\n let mixinPath;\n const args = [];\n let arg;\n let argValue;\n const rules = [];\n let match = false;\n let i;\n let m;\n let f;\n let isRecursive;\n let isOneFound;\n const candidates = [];\n let candidate;\n const conditionResult = [];\n let defaultResult;\n const defFalseEitherCase = -1;\n const defNone = 0;\n const defTrue = 1;\n const defFalse = 2;\n let count;\n let originalRuleset;\n let noArgumentsFilter;\n\n this.selector = this.selector.eval(context);\n\n function calcDefGroup(mixin, mixinPath) {\n let f, p, namespace;\n\n for (f = 0; f < 2; f++) {\n conditionResult[f] = true;\n defaultFunc.value(f);\n for (p = 0; p < mixinPath.length && conditionResult[f]; p++) {\n namespace = mixinPath[p];\n if (namespace.matchCondition) {\n conditionResult[f] = conditionResult[f] && namespace.matchCondition(null, context);\n }\n }\n if (mixin.matchCondition) {\n conditionResult[f] = conditionResult[f] && mixin.matchCondition(args, context);\n }\n }\n if (conditionResult[0] || conditionResult[1]) {\n if (conditionResult[0] != conditionResult[1]) {\n return conditionResult[1] ?\n defTrue : defFalse;\n }\n\n return defNone;\n }\n return defFalseEitherCase;\n }\n\n for (i = 0; i < this.arguments.length; i++) {\n arg = this.arguments[i];\n argValue = arg.value.eval(context);\n if (arg.expand && Array.isArray(argValue.value)) {\n argValue = argValue.value;\n for (m = 0; m < argValue.length; m++) {\n args.push({value: argValue[m]});\n }\n } else {\n args.push({name: arg.name, value: argValue});\n }\n }\n\n noArgumentsFilter = function(rule) {return rule.matchArgs(null, context);};\n\n for (i = 0; i < context.frames.length; i++) {\n if ((mixins = context.frames[i].find(this.selector, null, noArgumentsFilter)).length > 0) {\n isOneFound = true;\n\n // To make `default()` function independent of definition order we have two \"subpasses\" here.\n // At first we evaluate each guard *twice* (with `default() == true` and `default() == false`),\n // and build candidate list with corresponding flags. Then, when we know all possible matches,\n // we make a final decision.\n\n for (m = 0; m < mixins.length; m++) {\n mixin = mixins[m].rule;\n mixinPath = mixins[m].path;\n isRecursive = false;\n for (f = 0; f < context.frames.length; f++) {\n if ((!(mixin instanceof MixinDefinition)) && mixin === (context.frames[f].originalRuleset || context.frames[f])) {\n isRecursive = true;\n break;\n }\n }\n if (isRecursive) {\n continue;\n }\n\n if (mixin.matchArgs(args, context)) {\n candidate = {mixin, group: calcDefGroup(mixin, mixinPath)};\n\n if (candidate.group !== defFalseEitherCase) {\n candidates.push(candidate);\n }\n\n match = true;\n }\n }\n\n defaultFunc.reset();\n\n count = [0, 0, 0];\n for (m = 0; m < candidates.length; m++) {\n count[candidates[m].group]++;\n }\n\n if (count[defNone] > 0) {\n defaultResult = defFalse;\n } else {\n defaultResult = defTrue;\n if ((count[defTrue] + count[defFalse]) > 1) {\n throw { type: 'Runtime',\n message: `Ambiguous use of \\`default()\\` found when matching for \\`${this.format(args)}\\``,\n index: this.getIndex(), filename: this.fileInfo().filename };\n }\n }\n\n for (m = 0; m < candidates.length; m++) {\n candidate = candidates[m].group;\n if ((candidate === defNone) || (candidate === defaultResult)) {\n try {\n mixin = candidates[m].mixin;\n if (!(mixin instanceof MixinDefinition)) {\n originalRuleset = mixin.originalRuleset || mixin;\n mixin = new MixinDefinition('', [], mixin.rules, null, false, null, originalRuleset.visibilityInfo());\n mixin.originalRuleset = originalRuleset;\n }\n const newRules = mixin.evalCall(context, args, this.important).rules;\n this._setVisibilityToReplacement(newRules);\n Array.prototype.push.apply(rules, newRules);\n } catch (e) {\n throw { message: e.message, index: this.getIndex(), filename: this.fileInfo().filename, stack: e.stack };\n }\n }\n }\n\n if (match) {\n return rules;\n }\n }\n }\n if (isOneFound) {\n throw { type: 'Runtime',\n message: `No matching definition was found for \\`${this.format(args)}\\``,\n index: this.getIndex(), filename: this.fileInfo().filename };\n } else {\n throw { type: 'Name',\n message: `${this.selector.toCSS().trim()} is undefined`,\n index: this.getIndex(), filename: this.fileInfo().filename };\n }\n },\n\n _setVisibilityToReplacement(replacement) {\n let i, rule;\n if (this.blocksVisibility()) {\n for (i = 0; i < replacement.length; i++) {\n rule = replacement[i];\n rule.addVisibilityBlock();\n }\n }\n },\n\n format(args) {\n return `${this.selector.toCSS().trim()}(${args ? args.map(function (a) {\n let argValue = '';\n if (a.name) {\n argValue += `${a.name}:`;\n }\n if (a.value.toCSS) {\n argValue += a.value.toCSS();\n } else {\n argValue += '???';\n }\n return argValue;\n }).join(', ') : ''})`;\n }\n});\n\nexport default MixinCall;\n","import Node from './node';\nimport Color from './color';\nimport AtRule from './atrule';\nimport DetachedRuleset from './detached-ruleset';\nimport Operation from './operation';\nimport Dimension from './dimension';\nimport Unit from './unit';\nimport Keyword from './keyword';\nimport Variable from './variable';\nimport Property from './property';\nimport Ruleset from './ruleset';\nimport Element from './element';\nimport Attribute from './attribute';\nimport Combinator from './combinator';\nimport Selector from './selector';\nimport Quoted from './quoted';\nimport Expression from './expression';\nimport Declaration from './declaration';\nimport Call from './call';\nimport URL from './url';\nimport Import from './import';\nimport Comment from './comment';\nimport Anonymous from './anonymous';\nimport Value from './value';\nimport JavaScript from './javascript';\nimport Assignment from './assignment';\nimport Condition from './condition';\nimport QueryInParens from './query-in-parens';\nimport Paren from './paren';\nimport Media from './media';\nimport Container from './container';\nimport UnicodeDescriptor from './unicode-descriptor';\nimport Negative from './negative';\nimport Extend from './extend';\nimport VariableCall from './variable-call';\nimport NamespaceValue from './namespace-value';\n\n// mixins\nimport MixinCall from './mixin-call';\nimport MixinDefinition from './mixin-definition';\n\nexport default {\n Node, Color, AtRule, DetachedRuleset, Operation,\n Dimension, Unit, Keyword, Variable, Property,\n Ruleset, Element, Attribute, Combinator, Selector,\n Quoted, Expression, Declaration, Call, URL, Import,\n Comment, Anonymous, Value, JavaScript, Assignment,\n Condition, Paren, Media, Container, QueryInParens, \n UnicodeDescriptor, Negative, Extend, VariableCall, \n NamespaceValue,\n mixin: {\n Call: MixinCall,\n Definition: MixinDefinition\n }\n};","class AbstractFileManager {\n getPath(filename) {\n let j = filename.lastIndexOf('?');\n if (j > 0) {\n filename = filename.slice(0, j);\n }\n j = filename.lastIndexOf('/');\n if (j < 0) {\n j = filename.lastIndexOf('\\\\');\n }\n if (j < 0) {\n return '';\n }\n return filename.slice(0, j + 1);\n }\n\n tryAppendExtension(path, ext) {\n return /(\\.[a-z]*$)|([?;].*)$/.test(path) ? path : path + ext;\n }\n\n tryAppendLessExtension(path) {\n return this.tryAppendExtension(path, '.less');\n }\n\n supportsSync() {\n return false;\n }\n\n alwaysMakePathsAbsolute() {\n return false;\n }\n\n isPathAbsolute(filename) {\n return (/^(?:[a-z-]+:|\\/|\\\\|#)/i).test(filename);\n }\n\n // TODO: pull out / replace?\n join(basePath, laterPath) {\n if (!basePath) {\n return laterPath;\n }\n return basePath + laterPath;\n }\n\n pathDiff(url, baseUrl) {\n // diff between two paths to create a relative path\n\n const urlParts = this.extractUrlParts(url);\n\n const baseUrlParts = this.extractUrlParts(baseUrl);\n let i;\n let max;\n let urlDirectories;\n let baseUrlDirectories;\n let diff = '';\n if (urlParts.hostPart !== baseUrlParts.hostPart) {\n return '';\n }\n max = Math.max(baseUrlParts.directories.length, urlParts.directories.length);\n for (i = 0; i < max; i++) {\n if (baseUrlParts.directories[i] !== urlParts.directories[i]) { break; }\n }\n baseUrlDirectories = baseUrlParts.directories.slice(i);\n urlDirectories = urlParts.directories.slice(i);\n for (i = 0; i < baseUrlDirectories.length - 1; i++) {\n diff += '../';\n }\n for (i = 0; i < urlDirectories.length - 1; i++) {\n diff += `${urlDirectories[i]}/`;\n }\n return diff;\n }\n\n /**\n * Helper function, not part of API.\n * This should be replaceable by newer Node / Browser APIs\n * \n * @param {string} url \n * @param {string} baseUrl\n */\n extractUrlParts(url, baseUrl) {\n // urlParts[1] = protocol://hostname/ OR /\n // urlParts[2] = / if path relative to host base\n // urlParts[3] = directories\n // urlParts[4] = filename\n // urlParts[5] = parameters\n\n const urlPartsRegex = /^((?:[a-z-]+:)?\\/{2}(?:[^/?#]*\\/)|([/\\\\]))?((?:[^/\\\\?#]*[/\\\\])*)([^/\\\\?#]*)([#?].*)?$/i;\n\n const urlParts = url.match(urlPartsRegex);\n const returner = {};\n let rawDirectories = [];\n const directories = [];\n let i;\n let baseUrlParts;\n\n if (!urlParts) {\n throw new Error(`Could not parse sheet href - '${url}'`);\n }\n\n // Stylesheets in IE don't always return the full path\n if (baseUrl && (!urlParts[1] || urlParts[2])) {\n baseUrlParts = baseUrl.match(urlPartsRegex);\n if (!baseUrlParts) {\n throw new Error(`Could not parse page url - '${baseUrl}'`);\n }\n urlParts[1] = urlParts[1] || baseUrlParts[1] || '';\n if (!urlParts[2]) {\n urlParts[3] = baseUrlParts[3] + urlParts[3];\n }\n }\n\n if (urlParts[3]) {\n rawDirectories = urlParts[3].replace(/\\\\/g, '/').split('/');\n\n // collapse '..' and skip '.'\n for (i = 0; i < rawDirectories.length; i++) {\n\n if (rawDirectories[i] === '..') {\n directories.pop();\n }\n else if (rawDirectories[i] !== '.') {\n directories.push(rawDirectories[i]);\n }\n \n }\n }\n\n returner.hostPart = urlParts[1];\n returner.directories = directories;\n returner.rawPath = (urlParts[1] || '') + rawDirectories.join('/');\n returner.path = (urlParts[1] || '') + directories.join('/');\n returner.filename = urlParts[4];\n returner.fileUrl = returner.path + (urlParts[4] || '');\n returner.url = returner.fileUrl + (urlParts[5] || '');\n return returner;\n }\n}\n\nexport default AbstractFileManager;\n","import functionRegistry from '../functions/function-registry';\nimport LessError from '../less-error';\n\nclass AbstractPluginLoader {\n constructor() {\n // Implemented by Node.js plugin loader\n this.require = function() {\n return null;\n }\n }\n\n evalPlugin(contents, context, imports, pluginOptions, fileInfo) {\n\n let loader, registry, pluginObj, localModule, pluginManager, filename, result;\n\n pluginManager = context.pluginManager;\n\n if (fileInfo) {\n if (typeof fileInfo === 'string') {\n filename = fileInfo;\n }\n else {\n filename = fileInfo.filename;\n }\n }\n const shortname = (new this.less.FileManager()).extractUrlParts(filename).filename;\n\n if (filename) {\n pluginObj = pluginManager.get(filename);\n\n if (pluginObj) {\n result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions);\n if (result) {\n return result;\n }\n try {\n if (pluginObj.use) {\n pluginObj.use.call(this.context, pluginObj);\n }\n }\n catch (e) {\n e.message = e.message || 'Error during @plugin call';\n return new LessError(e, imports, filename);\n }\n return pluginObj;\n }\n }\n localModule = {\n exports: {},\n pluginManager,\n fileInfo\n };\n registry = functionRegistry.create();\n\n const registerPlugin = function(obj) {\n pluginObj = obj;\n };\n\n try {\n loader = new Function('module', 'require', 'registerPlugin', 'functions', 'tree', 'less', 'fileInfo', contents);\n loader(localModule, this.require(filename), registerPlugin, registry, this.less.tree, this.less, fileInfo);\n }\n catch (e) {\n return new LessError(e, imports, filename);\n }\n\n if (!pluginObj) {\n pluginObj = localModule.exports;\n }\n pluginObj = this.validatePlugin(pluginObj, filename, shortname);\n\n if (pluginObj instanceof LessError) {\n return pluginObj;\n }\n\n if (pluginObj) {\n pluginObj.imports = imports;\n pluginObj.filename = filename;\n\n // For < 3.x (or unspecified minVersion) - setOptions() before install()\n if (!pluginObj.minVersion || this.compareVersion('3.0.0', pluginObj.minVersion) < 0) {\n result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions);\n\n if (result) {\n return result;\n }\n }\n\n // Run on first load\n pluginManager.addPlugin(pluginObj, fileInfo.filename, registry);\n pluginObj.functions = registry.getLocalFunctions();\n\n // Need to call setOptions again because the pluginObj might have functions\n result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions);\n if (result) {\n return result;\n }\n\n // Run every @plugin call\n try {\n if (pluginObj.use) {\n pluginObj.use.call(this.context, pluginObj);\n }\n }\n catch (e) {\n e.message = e.message || 'Error during @plugin call';\n return new LessError(e, imports, filename);\n }\n\n }\n else {\n return new LessError({ message: 'Not a valid plugin' }, imports, filename);\n }\n\n return pluginObj;\n\n }\n\n trySetOptions(plugin, filename, name, options) {\n if (options && !plugin.setOptions) {\n return new LessError({\n message: `Options have been provided but the plugin ${name} does not support any options.`\n });\n }\n try {\n plugin.setOptions && plugin.setOptions(options);\n }\n catch (e) {\n return new LessError(e);\n }\n }\n\n validatePlugin(plugin, filename, name) {\n if (plugin) {\n // support plugins being a function\n // so that the plugin can be more usable programmatically\n if (typeof plugin === 'function') {\n plugin = new plugin();\n }\n\n if (plugin.minVersion) {\n if (this.compareVersion(plugin.minVersion, this.less.version) < 0) {\n return new LessError({\n message: `Plugin ${name} requires version ${this.versionToString(plugin.minVersion)}`\n });\n }\n }\n return plugin;\n }\n return null;\n }\n\n compareVersion(aVersion, bVersion) {\n if (typeof aVersion === 'string') {\n aVersion = aVersion.match(/^(\\d+)\\.?(\\d+)?\\.?(\\d+)?/);\n aVersion.shift();\n }\n for (let i = 0; i < aVersion.length; i++) {\n if (aVersion[i] !== bVersion[i]) {\n return parseInt(aVersion[i]) > parseInt(bVersion[i]) ? -1 : 1;\n }\n }\n return 0;\n }\n\n versionToString(version) {\n let versionString = '';\n for (let i = 0; i < version.length; i++) {\n versionString += (versionString ? '.' : '') + version[i];\n }\n return versionString;\n }\n\n printUsage(plugins) {\n for (let i = 0; i < plugins.length; i++) {\n const plugin = plugins[i];\n if (plugin.printUsage) {\n plugin.printUsage();\n }\n }\n }\n}\n\nexport default AbstractPluginLoader;\n\n","import Anonymous from '../tree/anonymous';\nimport Keyword from '../tree/keyword';\n\nfunction boolean(condition) {\n return condition ? Keyword.True : Keyword.False;\n}\n\n/**\n * Functions with evalArgs set to false are sent context\n * as the first argument.\n */\nfunction If(context, condition, trueValue, falseValue) {\n return condition.eval(context) ? trueValue.eval(context)\n : (falseValue ? falseValue.eval(context) : new Anonymous);\n}\nIf.evalArgs = false;\n\nfunction isdefined(context, variable) {\n try {\n variable.eval(context);\n return Keyword.True;\n } catch (e) {\n return Keyword.False;\n }\n}\n\nisdefined.evalArgs = false;\n\nexport default { isdefined, boolean, 'if': If };\n","import Dimension from '../tree/dimension';\nimport Color from '../tree/color';\nimport Quoted from '../tree/quoted';\nimport Anonymous from '../tree/anonymous';\nimport Expression from '../tree/expression';\nimport Operation from '../tree/operation';\nlet colorFunctions;\n\nfunction clamp(val) {\n return Math.min(1, Math.max(0, val));\n}\nfunction hsla(origColor, hsl) {\n const color = colorFunctions.hsla(hsl.h, hsl.s, hsl.l, hsl.a);\n if (color) {\n if (origColor.value && \n /^(rgb|hsl)/.test(origColor.value)) {\n color.value = origColor.value;\n } else {\n color.value = 'rgb';\n }\n return color;\n }\n}\nfunction toHSL(color) {\n if (color.toHSL) {\n return color.toHSL();\n } else {\n throw new Error('Argument cannot be evaluated to a color');\n }\n}\n\nfunction toHSV(color) {\n if (color.toHSV) {\n return color.toHSV();\n } else {\n throw new Error('Argument cannot be evaluated to a color');\n }\n}\n\nfunction number(n) {\n if (n instanceof Dimension) {\n return parseFloat(n.unit.is('%') ? n.value / 100 : n.value);\n } else if (typeof n === 'number') {\n return n;\n } else {\n throw {\n type: 'Argument',\n message: 'color functions take numbers as parameters'\n };\n }\n}\nfunction scaled(n, size) {\n if (n instanceof Dimension && n.unit.is('%')) {\n return parseFloat(n.value * size / 100);\n } else {\n return number(n);\n }\n}\ncolorFunctions = {\n rgb: function (r, g, b) {\n let a = 1\n /**\n * Comma-less syntax\n * e.g. rgb(0 128 255 / 50%)\n */\n if (r instanceof Expression) {\n const val = r.value\n r = val[0]\n g = val[1]\n b = val[2]\n /** \n * @todo - should this be normalized in\n * function caller? Or parsed differently?\n */\n if (b instanceof Operation) {\n const op = b\n b = op.operands[0]\n a = op.operands[1]\n }\n }\n const color = colorFunctions.rgba(r, g, b, a);\n if (color) {\n color.value = 'rgb';\n return color;\n }\n },\n rgba: function (r, g, b, a) {\n try {\n if (r instanceof Color) {\n if (g) {\n a = number(g);\n } else {\n a = r.alpha;\n }\n return new Color(r.rgb, a, 'rgba');\n }\n const rgb = [r, g, b].map(c => scaled(c, 255));\n a = number(a);\n return new Color(rgb, a, 'rgba');\n }\n catch (e) {}\n },\n hsl: function (h, s, l) {\n let a = 1\n if (h instanceof Expression) {\n const val = h.value\n h = val[0]\n s = val[1]\n l = val[2]\n\n if (l instanceof Operation) {\n const op = l\n l = op.operands[0]\n a = op.operands[1]\n }\n }\n const color = colorFunctions.hsla(h, s, l, a);\n if (color) {\n color.value = 'hsl';\n return color;\n }\n },\n hsla: function (h, s, l, a) {\n let m1;\n let m2;\n\n function hue(h) {\n h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);\n if (h * 6 < 1) {\n return m1 + (m2 - m1) * h * 6;\n }\n else if (h * 2 < 1) {\n return m2;\n }\n else if (h * 3 < 2) {\n return m1 + (m2 - m1) * (2 / 3 - h) * 6;\n }\n else {\n return m1;\n }\n }\n\n try {\n if (h instanceof Color) {\n if (s) {\n a = number(s);\n } else {\n a = h.alpha;\n }\n return new Color(h.rgb, a, 'hsla');\n }\n\n h = (number(h) % 360) / 360;\n s = clamp(number(s));l = clamp(number(l));a = clamp(number(a));\n\n m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;\n m1 = l * 2 - m2;\n\n const rgb = [\n hue(h + 1 / 3) * 255,\n hue(h) * 255,\n hue(h - 1 / 3) * 255\n ];\n a = number(a);\n return new Color(rgb, a, 'hsla');\n }\n catch (e) {}\n },\n\n hsv: function(h, s, v) {\n return colorFunctions.hsva(h, s, v, 1.0);\n },\n\n hsva: function(h, s, v, a) {\n h = ((number(h) % 360) / 360) * 360;\n s = number(s);v = number(v);a = number(a);\n\n let i;\n let f;\n i = Math.floor((h / 60) % 6);\n f = (h / 60) - i;\n\n const vs = [v,\n v * (1 - s),\n v * (1 - f * s),\n v * (1 - (1 - f) * s)];\n const perm = [[0, 3, 1],\n [2, 0, 1],\n [1, 0, 3],\n [1, 2, 0],\n [3, 1, 0],\n [0, 1, 2]];\n\n return colorFunctions.rgba(vs[perm[i][0]] * 255,\n vs[perm[i][1]] * 255,\n vs[perm[i][2]] * 255,\n a);\n },\n\n hue: function (color) {\n return new Dimension(toHSL(color).h);\n },\n saturation: function (color) {\n return new Dimension(toHSL(color).s * 100, '%');\n },\n lightness: function (color) {\n return new Dimension(toHSL(color).l * 100, '%');\n },\n hsvhue: function(color) {\n return new Dimension(toHSV(color).h);\n },\n hsvsaturation: function (color) {\n return new Dimension(toHSV(color).s * 100, '%');\n },\n hsvvalue: function (color) {\n return new Dimension(toHSV(color).v * 100, '%');\n },\n red: function (color) {\n return new Dimension(color.rgb[0]);\n },\n green: function (color) {\n return new Dimension(color.rgb[1]);\n },\n blue: function (color) {\n return new Dimension(color.rgb[2]);\n },\n alpha: function (color) {\n return new Dimension(toHSL(color).a);\n },\n luma: function (color) {\n return new Dimension(color.luma() * color.alpha * 100, '%');\n },\n luminance: function (color) {\n const luminance =\n (0.2126 * color.rgb[0] / 255) +\n (0.7152 * color.rgb[1] / 255) +\n (0.0722 * color.rgb[2] / 255);\n\n return new Dimension(luminance * color.alpha * 100, '%');\n },\n saturate: function (color, amount, method) {\n // filter: saturate(3.2);\n // should be kept as is, so check for color\n if (!color.rgb) {\n return null;\n }\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.s += hsl.s * amount.value / 100;\n }\n else {\n hsl.s += amount.value / 100;\n }\n hsl.s = clamp(hsl.s);\n return hsla(color, hsl);\n },\n desaturate: function (color, amount, method) {\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.s -= hsl.s * amount.value / 100;\n }\n else {\n hsl.s -= amount.value / 100;\n }\n hsl.s = clamp(hsl.s);\n return hsla(color, hsl);\n },\n lighten: function (color, amount, method) {\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.l += hsl.l * amount.value / 100;\n }\n else {\n hsl.l += amount.value / 100;\n }\n hsl.l = clamp(hsl.l);\n return hsla(color, hsl);\n },\n darken: function (color, amount, method) {\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.l -= hsl.l * amount.value / 100;\n }\n else {\n hsl.l -= amount.value / 100;\n }\n hsl.l = clamp(hsl.l);\n return hsla(color, hsl);\n },\n fadein: function (color, amount, method) {\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.a += hsl.a * amount.value / 100;\n }\n else {\n hsl.a += amount.value / 100;\n }\n hsl.a = clamp(hsl.a);\n return hsla(color, hsl);\n },\n fadeout: function (color, amount, method) {\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.a -= hsl.a * amount.value / 100;\n }\n else {\n hsl.a -= amount.value / 100;\n }\n hsl.a = clamp(hsl.a);\n return hsla(color, hsl);\n },\n fade: function (color, amount) {\n const hsl = toHSL(color);\n\n hsl.a = amount.value / 100;\n hsl.a = clamp(hsl.a);\n return hsla(color, hsl);\n },\n spin: function (color, amount) {\n const hsl = toHSL(color);\n const hue = (hsl.h + amount.value) % 360;\n\n hsl.h = hue < 0 ? 360 + hue : hue;\n\n return hsla(color, hsl);\n },\n //\n // Copyright (c) 2006-2009 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein\n // http://sass-lang.com\n //\n mix: function (color1, color2, weight) {\n if (!weight) {\n weight = new Dimension(50);\n }\n const p = weight.value / 100.0;\n const w = p * 2 - 1;\n const a = toHSL(color1).a - toHSL(color2).a;\n\n const w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;\n const w2 = 1 - w1;\n\n const rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2,\n color1.rgb[1] * w1 + color2.rgb[1] * w2,\n color1.rgb[2] * w1 + color2.rgb[2] * w2];\n\n const alpha = color1.alpha * p + color2.alpha * (1 - p);\n\n return new Color(rgb, alpha);\n },\n greyscale: function (color) {\n return colorFunctions.desaturate(color, new Dimension(100));\n },\n contrast: function (color, dark, light, threshold) {\n // filter: contrast(3.2);\n // should be kept as is, so check for color\n if (!color.rgb) {\n return null;\n }\n if (typeof light === 'undefined') {\n light = colorFunctions.rgba(255, 255, 255, 1.0);\n }\n if (typeof dark === 'undefined') {\n dark = colorFunctions.rgba(0, 0, 0, 1.0);\n }\n // Figure out which is actually light and dark:\n if (dark.luma() > light.luma()) {\n const t = light;\n light = dark;\n dark = t;\n }\n if (typeof threshold === 'undefined') {\n threshold = 0.43;\n } else {\n threshold = number(threshold);\n }\n if (color.luma() < threshold) {\n return light;\n } else {\n return dark;\n }\n },\n // Changes made in 2.7.0 - Reverted in 3.0.0\n // contrast: function (color, color1, color2, threshold) {\n // // Return which of `color1` and `color2` has the greatest contrast with `color`\n // // according to the standard WCAG contrast ratio calculation.\n // // http://www.w3.org/TR/WCAG20/#contrast-ratiodef\n // // The threshold param is no longer used, in line with SASS.\n // // filter: contrast(3.2);\n // // should be kept as is, so check for color\n // if (!color.rgb) {\n // return null;\n // }\n // if (typeof color1 === 'undefined') {\n // color1 = colorFunctions.rgba(0, 0, 0, 1.0);\n // }\n // if (typeof color2 === 'undefined') {\n // color2 = colorFunctions.rgba(255, 255, 255, 1.0);\n // }\n // var contrast1, contrast2;\n // var luma = color.luma();\n // var luma1 = color1.luma();\n // var luma2 = color2.luma();\n // // Calculate contrast ratios for each color\n // if (luma > luma1) {\n // contrast1 = (luma + 0.05) / (luma1 + 0.05);\n // } else {\n // contrast1 = (luma1 + 0.05) / (luma + 0.05);\n // }\n // if (luma > luma2) {\n // contrast2 = (luma + 0.05) / (luma2 + 0.05);\n // } else {\n // contrast2 = (luma2 + 0.05) / (luma + 0.05);\n // }\n // if (contrast1 > contrast2) {\n // return color1;\n // } else {\n // return color2;\n // }\n // },\n argb: function (color) {\n return new Anonymous(color.toARGB());\n },\n color: function(c) {\n if ((c instanceof Quoted) &&\n (/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})$/i.test(c.value))) {\n const val = c.value.slice(1);\n return new Color(val, undefined, `#${val}`);\n }\n if ((c instanceof Color) || (c = Color.fromKeyword(c.value))) {\n c.value = undefined;\n return c;\n }\n throw {\n type: 'Argument',\n message: 'argument must be a color keyword or 3|4|6|8 digit hex e.g. #FFF'\n };\n },\n tint: function(color, amount) {\n return colorFunctions.mix(colorFunctions.rgb(255, 255, 255), color, amount);\n },\n shade: function(color, amount) {\n return colorFunctions.mix(colorFunctions.rgb(0, 0, 0), color, amount);\n }\n};\n\nexport default colorFunctions;\n","import Color from '../tree/color';\n\n// Color Blending\n// ref: http://www.w3.org/TR/compositing-1\n\nfunction colorBlend(mode, color1, color2) {\n const ab = color1.alpha; // result\n\n let // backdrop\n cb;\n\n const as = color2.alpha;\n\n let // source\n cs;\n\n let ar;\n let cr;\n const r = [];\n\n ar = as + ab * (1 - as);\n for (let i = 0; i < 3; i++) {\n cb = color1.rgb[i] / 255;\n cs = color2.rgb[i] / 255;\n cr = mode(cb, cs);\n if (ar) {\n cr = (as * cs + ab * (cb -\n as * (cb + cs - cr))) / ar;\n }\n r[i] = cr * 255;\n }\n\n return new Color(r, ar);\n}\n\nconst colorBlendModeFunctions = {\n multiply: function(cb, cs) {\n return cb * cs;\n },\n screen: function(cb, cs) {\n return cb + cs - cb * cs;\n },\n overlay: function(cb, cs) {\n cb *= 2;\n return (cb <= 1) ?\n colorBlendModeFunctions.multiply(cb, cs) :\n colorBlendModeFunctions.screen(cb - 1, cs);\n },\n softlight: function(cb, cs) {\n let d = 1;\n let e = cb;\n if (cs > 0.5) {\n e = 1;\n d = (cb > 0.25) ? Math.sqrt(cb)\n : ((16 * cb - 12) * cb + 4) * cb;\n }\n return cb - (1 - 2 * cs) * e * (d - cb);\n },\n hardlight: function(cb, cs) {\n return colorBlendModeFunctions.overlay(cs, cb);\n },\n difference: function(cb, cs) {\n return Math.abs(cb - cs);\n },\n exclusion: function(cb, cs) {\n return cb + cs - 2 * cb * cs;\n },\n\n // non-w3c functions:\n average: function(cb, cs) {\n return (cb + cs) / 2;\n },\n negation: function(cb, cs) {\n return 1 - Math.abs(cb + cs - 1);\n }\n};\n\nfor (const f in colorBlendModeFunctions) {\n // eslint-disable-next-line no-prototype-builtins\n if (colorBlendModeFunctions.hasOwnProperty(f)) {\n colorBlend[f] = colorBlend.bind(null, colorBlendModeFunctions[f]);\n }\n}\n\nexport default colorBlend;\n","import Quoted from '../tree/quoted';\nimport URL from '../tree/url';\nimport * as utils from '../utils';\nimport logger from '../logger';\n\nexport default environment => {\n \n const fallback = (functionThis, node) => new URL(node, functionThis.index, functionThis.currentFileInfo).eval(functionThis.context); \n\n return { 'data-uri': function(mimetypeNode, filePathNode) {\n\n if (!filePathNode) {\n filePathNode = mimetypeNode;\n mimetypeNode = null;\n }\n\n let mimetype = mimetypeNode && mimetypeNode.value;\n let filePath = filePathNode.value;\n const currentFileInfo = this.currentFileInfo;\n const currentDirectory = currentFileInfo.rewriteUrls ?\n currentFileInfo.currentDirectory : currentFileInfo.entryPath;\n\n const fragmentStart = filePath.indexOf('#');\n let fragment = '';\n if (fragmentStart !== -1) {\n fragment = filePath.slice(fragmentStart);\n filePath = filePath.slice(0, fragmentStart);\n }\n const context = utils.clone(this.context);\n context.rawBuffer = true;\n\n const fileManager = environment.getFileManager(filePath, currentDirectory, context, environment, true);\n\n if (!fileManager) {\n return fallback(this, filePathNode);\n }\n\n let useBase64 = false;\n\n // detect the mimetype if not given\n if (!mimetypeNode) {\n\n mimetype = environment.mimeLookup(filePath);\n\n if (mimetype === 'image/svg+xml') {\n useBase64 = false;\n } else {\n // use base 64 unless it's an ASCII or UTF-8 format\n const charset = environment.charsetLookup(mimetype);\n useBase64 = ['US-ASCII', 'UTF-8'].indexOf(charset) < 0;\n }\n if (useBase64) { mimetype += ';base64'; }\n }\n else {\n useBase64 = /;base64$/.test(mimetype);\n }\n\n const fileSync = fileManager.loadFileSync(filePath, currentDirectory, context, environment);\n if (!fileSync.contents) {\n logger.warn(`Skipped data-uri embedding of ${filePath} because file not found`);\n return fallback(this, filePathNode || mimetypeNode);\n }\n let buf = fileSync.contents;\n if (useBase64 && !environment.encodeBase64) {\n return fallback(this, filePathNode);\n }\n\n buf = useBase64 ? environment.encodeBase64(buf) : encodeURIComponent(buf);\n\n const uri = `data:${mimetype},${buf}${fragment}`;\n\n return new URL(new Quoted(`\"${uri}\"`, uri, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo);\n }};\n};\n","import Comment from '../tree/comment';\nimport Node from '../tree/node';\nimport Dimension from '../tree/dimension';\nimport Declaration from '../tree/declaration';\nimport Expression from '../tree/expression';\nimport Ruleset from '../tree/ruleset';\nimport Selector from '../tree/selector';\nimport Element from '../tree/element';\nimport Quote from '../tree/quoted';\nimport Value from '../tree/value';\n\nconst getItemsFromNode = node => {\n // handle non-array values as an array of length 1\n // return 'undefined' if index is invalid\n const items = Array.isArray(node.value) ?\n node.value : Array(node);\n\n return items;\n};\n\nexport default {\n _SELF: function(n) {\n return n;\n },\n '~': function(...expr) {\n if (expr.length === 1) {\n return expr[0];\n }\n return new Value(expr);\n },\n extract: function(values, index) {\n // (1-based index)\n index = index.value - 1;\n\n return getItemsFromNode(values)[index];\n },\n length: function(values) {\n return new Dimension(getItemsFromNode(values).length);\n },\n /**\n * Creates a Less list of incremental values.\n * Modeled after Lodash's range function, also exists natively in PHP\n * \n * @param {Dimension} [start=1]\n * @param {Dimension} end - e.g. 10 or 10px - unit is added to output\n * @param {Dimension} [step=1] \n */\n range: function(start, end, step) {\n let from;\n let to;\n let stepValue = 1;\n const list = [];\n if (end) {\n to = end;\n from = start.value;\n if (step) {\n stepValue = step.value;\n }\n }\n else {\n from = 1;\n to = start;\n }\n\n for (let i = from; i <= to.value; i += stepValue) {\n list.push(new Dimension(i, to.unit));\n }\n\n return new Expression(list);\n },\n each: function(list, rs) {\n const rules = [];\n let newRules;\n let iterator;\n\n const tryEval = val => {\n if (val instanceof Node) {\n return val.eval(this.context);\n }\n return val;\n };\n\n if (list.value && !(list instanceof Quote)) {\n if (Array.isArray(list.value)) {\n iterator = list.value.map(tryEval);\n } else {\n iterator = [tryEval(list.value)];\n }\n } else if (list.ruleset) {\n iterator = tryEval(list.ruleset).rules;\n } else if (list.rules) {\n iterator = list.rules.map(tryEval);\n } else if (Array.isArray(list)) {\n iterator = list.map(tryEval);\n } else {\n iterator = [tryEval(list)];\n }\n\n let valueName = '@value';\n let keyName = '@key';\n let indexName = '@index';\n\n if (rs.params) {\n valueName = rs.params[0] && rs.params[0].name;\n keyName = rs.params[1] && rs.params[1].name;\n indexName = rs.params[2] && rs.params[2].name;\n rs = rs.rules;\n } else {\n rs = rs.ruleset;\n }\n\n for (let i = 0; i < iterator.length; i++) {\n let key;\n let value;\n const item = iterator[i];\n if (item instanceof Declaration) {\n key = typeof item.name === 'string' ? item.name : item.name[0].value;\n value = item.value;\n } else {\n key = new Dimension(i + 1);\n value = item;\n }\n\n if (item instanceof Comment) {\n continue;\n }\n\n newRules = rs.rules.slice(0);\n if (valueName) {\n newRules.push(new Declaration(valueName,\n value,\n false, false, this.index, this.currentFileInfo));\n }\n if (indexName) {\n newRules.push(new Declaration(indexName,\n new Dimension(i + 1),\n false, false, this.index, this.currentFileInfo));\n }\n if (keyName) {\n newRules.push(new Declaration(keyName,\n key,\n false, false, this.index, this.currentFileInfo));\n }\n\n rules.push(new Ruleset([ new(Selector)([ new Element('', '&') ]) ],\n newRules,\n rs.strictImports,\n rs.visibilityInfo()\n ));\n }\n\n return new Ruleset([ new(Selector)([ new Element('', '&') ]) ],\n rules,\n rs.strictImports,\n rs.visibilityInfo()\n ).eval(this.context);\n }\n};\n","import Dimension from '../tree/dimension';\n\nconst MathHelper = (fn, unit, n) => {\n if (!(n instanceof Dimension)) {\n throw { type: 'Argument', message: 'argument must be a number' };\n }\n if (unit === null) {\n unit = n.unit;\n } else {\n n = n.unify();\n }\n return new Dimension(fn(parseFloat(n.value)), unit);\n};\n\nexport default MathHelper;","import mathHelper from './math-helper.js';\n\nconst mathFunctions = {\n // name, unit\n ceil: null,\n floor: null,\n sqrt: null,\n abs: null,\n tan: '',\n sin: '',\n cos: '',\n atan: 'rad',\n asin: 'rad',\n acos: 'rad'\n};\n\nfor (const f in mathFunctions) {\n // eslint-disable-next-line no-prototype-builtins\n if (mathFunctions.hasOwnProperty(f)) {\n mathFunctions[f] = mathHelper.bind(null, Math[f], mathFunctions[f]);\n }\n}\n\nmathFunctions.round = (n, f) => {\n const fraction = typeof f === 'undefined' ? 0 : f.value;\n return mathHelper(num => num.toFixed(fraction), null, n);\n};\n\nexport default mathFunctions;\n","import Dimension from '../tree/dimension';\nimport Anonymous from '../tree/anonymous';\nimport mathHelper from './math-helper.js';\n\nconst minMax = function (isMin, args) {\n args = Array.prototype.slice.call(args);\n switch (args.length) {\n case 0: throw { type: 'Argument', message: 'one or more arguments required' };\n }\n let i; // key is the unit.toString() for unified Dimension values,\n let j;\n let current;\n let currentUnified;\n let referenceUnified;\n let unit;\n let unitStatic;\n let unitClone;\n\n const // elems only contains original argument values.\n order = [];\n\n const values = {};\n // value is the index into the order array.\n for (i = 0; i < args.length; i++) {\n current = args[i];\n if (!(current instanceof Dimension)) {\n if (Array.isArray(args[i].value)) {\n Array.prototype.push.apply(args, Array.prototype.slice.call(args[i].value));\n continue;\n } else {\n throw { type: 'Argument', message: 'incompatible types' };\n }\n }\n currentUnified = current.unit.toString() === '' && unitClone !== undefined ? new Dimension(current.value, unitClone).unify() : current.unify();\n unit = currentUnified.unit.toString() === '' && unitStatic !== undefined ? unitStatic : currentUnified.unit.toString();\n unitStatic = unit !== '' && unitStatic === undefined || unit !== '' && order[0].unify().unit.toString() === '' ? unit : unitStatic;\n unitClone = unit !== '' && unitClone === undefined ? current.unit.toString() : unitClone;\n j = values[''] !== undefined && unit !== '' && unit === unitStatic ? values[''] : values[unit];\n if (j === undefined) {\n if (unitStatic !== undefined && unit !== unitStatic) {\n throw { type: 'Argument', message: 'incompatible types' };\n }\n values[unit] = order.length;\n order.push(current);\n continue;\n }\n referenceUnified = order[j].unit.toString() === '' && unitClone !== undefined ? new Dimension(order[j].value, unitClone).unify() : order[j].unify();\n if ( isMin && currentUnified.value < referenceUnified.value ||\n !isMin && currentUnified.value > referenceUnified.value) {\n order[j] = current;\n }\n }\n if (order.length == 1) {\n return order[0];\n }\n args = order.map(a => { return a.toCSS(this.context); }).join(this.context.compress ? ',' : ', ');\n return new Anonymous(`${isMin ? 'min' : 'max'}(${args})`);\n};\n\nexport default {\n min: function(...args) {\n try {\n return minMax.call(this, true, args);\n } catch (e) {}\n },\n max: function(...args) {\n try {\n return minMax.call(this, false, args);\n } catch (e) {}\n },\n convert: function (val, unit) {\n return val.convertTo(unit.value);\n },\n pi: function () {\n return new Dimension(Math.PI);\n },\n mod: function(a, b) {\n return new Dimension(a.value % b.value, a.unit);\n },\n pow: function(x, y) {\n if (typeof x === 'number' && typeof y === 'number') {\n x = new Dimension(x);\n y = new Dimension(y);\n } else if (!(x instanceof Dimension) || !(y instanceof Dimension)) {\n throw { type: 'Argument', message: 'arguments must be numbers' };\n }\n\n return new Dimension(Math.pow(x.value, y.value), x.unit);\n },\n percentage: function (n) {\n const result = mathHelper(num => num * 100, '%', n);\n\n return result;\n }\n};\n","import Quoted from '../tree/quoted';\nimport Anonymous from '../tree/anonymous';\nimport JavaScript from '../tree/javascript';\n\nexport default {\n e: function (str) {\n return new Quoted('\"', str instanceof JavaScript ? str.evaluated : str.value, true);\n },\n escape: function (str) {\n return new Anonymous(\n encodeURI(str.value).replace(/=/g, '%3D').replace(/:/g, '%3A').replace(/#/g, '%23').replace(/;/g, '%3B')\n .replace(/\\(/g, '%28').replace(/\\)/g, '%29'));\n },\n replace: function (string, pattern, replacement, flags) {\n let result = string.value;\n replacement = (replacement.type === 'Quoted') ?\n replacement.value : replacement.toCSS();\n result = result.replace(new RegExp(pattern.value, flags ? flags.value : ''), replacement);\n return new Quoted(string.quote || '', result, string.escaped);\n },\n '%': function (string /* arg, arg, ... */) {\n const args = Array.prototype.slice.call(arguments, 1);\n let result = string.value;\n\n for (let i = 0; i < args.length; i++) {\n /* jshint loopfunc:true */\n result = result.replace(/%[sda]/i, token => {\n const value = ((args[i].type === 'Quoted') &&\n token.match(/s/i)) ? args[i].value : args[i].toCSS();\n return token.match(/[A-Z]$/) ? encodeURIComponent(value) : value;\n });\n }\n result = result.replace(/%%/g, '%');\n return new Quoted(string.quote || '', result, string.escaped);\n }\n};\n","import Keyword from '../tree/keyword';\nimport DetachedRuleset from '../tree/detached-ruleset';\nimport Dimension from '../tree/dimension';\nimport Color from '../tree/color';\nimport Quoted from '../tree/quoted';\nimport Anonymous from '../tree/anonymous';\nimport URL from '../tree/url';\nimport Operation from '../tree/operation';\n\nconst isa = (n, Type) => (n instanceof Type) ? Keyword.True : Keyword.False;\nconst isunit = (n, unit) => {\n if (unit === undefined) {\n throw { type: 'Argument', message: 'missing the required second argument to isunit.' };\n }\n unit = typeof unit.value === 'string' ? unit.value : unit;\n if (typeof unit !== 'string') {\n throw { type: 'Argument', message: 'Second argument to isunit should be a unit or a string.' };\n }\n return (n instanceof Dimension) && n.unit.is(unit) ? Keyword.True : Keyword.False;\n};\n\nexport default {\n isruleset: function (n) {\n return isa(n, DetachedRuleset);\n },\n iscolor: function (n) {\n return isa(n, Color);\n },\n isnumber: function (n) {\n return isa(n, Dimension);\n },\n isstring: function (n) {\n return isa(n, Quoted);\n },\n iskeyword: function (n) {\n return isa(n, Keyword);\n },\n isurl: function (n) {\n return isa(n, URL);\n },\n ispixel: function (n) {\n return isunit(n, 'px');\n },\n ispercentage: function (n) {\n return isunit(n, '%');\n },\n isem: function (n) {\n return isunit(n, 'em');\n },\n isunit,\n unit: function (val, unit) {\n if (!(val instanceof Dimension)) {\n throw { type: 'Argument',\n message: `the first argument to unit must be a number${val instanceof Operation ? '. Have you forgotten parenthesis?' : ''}` };\n }\n if (unit) {\n if (unit instanceof Keyword) {\n unit = unit.value;\n } else {\n unit = unit.toCSS();\n }\n } else {\n unit = '';\n }\n return new Dimension(val.value, unit);\n },\n 'get-unit': function (n) {\n return new Anonymous(n.unit);\n }\n};\n","import Variable from '../tree/variable';\nimport Anonymous from '../tree/variable';\n\nconst styleExpression = function (args) {\n args = Array.prototype.slice.call(args);\n switch (args.length) {\n case 0: throw { type: 'Argument', message: 'one or more arguments required' };\n }\n \n const entityList = [new Variable(args[0].value, this.index, this.currentFileInfo).eval(this.context)];\n \n args = entityList.map(a => { return a.toCSS(this.context); }).join(this.context.compress ? ',' : ', ');\n \n return new Anonymous(`style(${args})`);\n};\n\nexport default {\n style: function(...args) {\n try {\n return styleExpression.call(this, args);\n } catch (e) {}\n },\n};\n","import functionRegistry from './function-registry';\nimport functionCaller from './function-caller';\n\nimport boolean from './boolean';\nimport defaultFunc from './default';\nimport color from './color';\nimport colorBlending from './color-blending';\nimport dataUri from './data-uri';\nimport list from './list';\nimport math from './math';\nimport number from './number';\nimport string from './string';\nimport svg from './svg';\nimport types from './types';\nimport style from './style';\n\nexport default environment => {\n const functions = { functionRegistry, functionCaller };\n\n // register functions\n functionRegistry.addMultiple(boolean);\n functionRegistry.add('default', defaultFunc.eval.bind(defaultFunc));\n functionRegistry.addMultiple(color);\n functionRegistry.addMultiple(colorBlending);\n functionRegistry.addMultiple(dataUri(environment));\n functionRegistry.addMultiple(list);\n functionRegistry.addMultiple(math);\n functionRegistry.addMultiple(number);\n functionRegistry.addMultiple(string);\n functionRegistry.addMultiple(svg(environment));\n functionRegistry.addMultiple(types);\n functionRegistry.addMultiple(style);\n\n return functions;\n};\n","import Dimension from '../tree/dimension';\nimport Color from '../tree/color';\nimport Expression from '../tree/expression';\nimport Quoted from '../tree/quoted';\nimport URL from '../tree/url';\n\nexport default () => {\n return { 'svg-gradient': function(direction) {\n let stops;\n let gradientDirectionSvg;\n let gradientType = 'linear';\n let rectangleDimension = 'x=\"0\" y=\"0\" width=\"1\" height=\"1\"';\n const renderEnv = {compress: false};\n let returner;\n const directionValue = direction.toCSS(renderEnv);\n let i;\n let color;\n let position;\n let positionValue;\n let alpha;\n\n function throwArgumentDescriptor() {\n throw { type: 'Argument',\n message: 'svg-gradient expects direction, start_color [start_position], [color position,]...,' +\n ' end_color [end_position] or direction, color list' };\n }\n\n if (arguments.length == 2) {\n if (arguments[1].value.length < 2) {\n throwArgumentDescriptor();\n }\n stops = arguments[1].value;\n } else if (arguments.length < 3) {\n throwArgumentDescriptor();\n } else {\n stops = Array.prototype.slice.call(arguments, 1);\n }\n\n switch (directionValue) {\n case 'to bottom':\n gradientDirectionSvg = 'x1=\"0%\" y1=\"0%\" x2=\"0%\" y2=\"100%\"';\n break;\n case 'to right':\n gradientDirectionSvg = 'x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"0%\"';\n break;\n case 'to bottom right':\n gradientDirectionSvg = 'x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\"';\n break;\n case 'to top right':\n gradientDirectionSvg = 'x1=\"0%\" y1=\"100%\" x2=\"100%\" y2=\"0%\"';\n break;\n case 'ellipse':\n case 'ellipse at center':\n gradientType = 'radial';\n gradientDirectionSvg = 'cx=\"50%\" cy=\"50%\" r=\"75%\"';\n rectangleDimension = 'x=\"-50\" y=\"-50\" width=\"101\" height=\"101\"';\n break;\n default:\n throw { type: 'Argument', message: 'svg-gradient direction must be \\'to bottom\\', \\'to right\\',' +\n ' \\'to bottom right\\', \\'to top right\\' or \\'ellipse at center\\'' };\n }\n returner = `<${gradientType}Gradient id=\"g\" ${gradientDirectionSvg}>`;\n\n for (i = 0; i < stops.length; i += 1) {\n if (stops[i] instanceof Expression) {\n color = stops[i].value[0];\n position = stops[i].value[1];\n } else {\n color = stops[i];\n position = undefined;\n }\n\n if (!(color instanceof Color) || (!((i === 0 || i + 1 === stops.length) && position === undefined) && !(position instanceof Dimension))) {\n throwArgumentDescriptor();\n }\n positionValue = position ? position.toCSS(renderEnv) : i === 0 ? '0%' : '100%';\n alpha = color.alpha;\n returner += ``;\n }\n returner += ``;\n\n returner = encodeURIComponent(returner);\n\n returner = `data:image/svg+xml,${returner}`;\n return new URL(new Quoted(`'${returner}'`, returner, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo);\n }};\n};\n","import contexts from './contexts';\nimport visitor from './visitors';\nimport tree from './tree';\n\nexport default function(root, options) {\n options = options || {};\n let evaldRoot;\n let variables = options.variables;\n const evalEnv = new contexts.Eval(options);\n\n //\n // Allows setting variables with a hash, so:\n //\n // `{ color: new tree.Color('#f01') }` will become:\n //\n // new tree.Declaration('@color',\n // new tree.Value([\n // new tree.Expression([\n // new tree.Color('#f01')\n // ])\n // ])\n // )\n //\n if (typeof variables === 'object' && !Array.isArray(variables)) {\n variables = Object.keys(variables).map(function (k) {\n let value = variables[k];\n\n if (!(value instanceof tree.Value)) {\n if (!(value instanceof tree.Expression)) {\n value = new tree.Expression([value]);\n }\n value = new tree.Value([value]);\n }\n return new tree.Declaration(`@${k}`, value, false, null, 0);\n });\n evalEnv.frames = [new tree.Ruleset(null, variables)];\n }\n\n const visitors = [\n new visitor.JoinSelectorVisitor(),\n new visitor.MarkVisibleSelectorsVisitor(true),\n new visitor.ExtendVisitor(),\n new visitor.ToCSSVisitor({compress: Boolean(options.compress)})\n ];\n\n const preEvalVisitors = [];\n let v;\n let visitorIterator;\n\n /**\n * first() / get() allows visitors to be added while visiting\n * \n * @todo Add scoping for visitors just like functions for @plugin; right now they're global\n */\n if (options.pluginManager) {\n visitorIterator = options.pluginManager.visitor();\n for (let i = 0; i < 2; i++) {\n visitorIterator.first();\n while ((v = visitorIterator.get())) {\n if (v.isPreEvalVisitor) {\n if (i === 0 || preEvalVisitors.indexOf(v) === -1) {\n preEvalVisitors.push(v);\n v.run(root);\n }\n }\n else {\n if (i === 0 || visitors.indexOf(v) === -1) {\n if (v.isPreVisitor) {\n visitors.unshift(v);\n }\n else {\n visitors.push(v);\n }\n }\n }\n }\n }\n }\n\n evaldRoot = root.eval(evalEnv);\n\n for (let i = 0; i < visitors.length; i++) {\n visitors[i].run(evaldRoot);\n }\n\n // Run any remaining visitors added after eval pass\n if (options.pluginManager) {\n visitorIterator.first();\n while ((v = visitorIterator.get())) {\n if (visitors.indexOf(v) === -1 && preEvalVisitors.indexOf(v) === -1) {\n v.run(evaldRoot);\n }\n }\n }\n\n return evaldRoot;\n}\n","/**\n * Plugin Manager\n */\nclass PluginManager {\n constructor(less) {\n this.less = less;\n this.visitors = [];\n this.preProcessors = [];\n this.postProcessors = [];\n this.installedPlugins = [];\n this.fileManagers = [];\n this.iterator = -1;\n this.pluginCache = {};\n this.Loader = new less.PluginLoader(less);\n }\n\n /**\n * Adds all the plugins in the array\n * @param {Array} plugins\n */\n addPlugins(plugins) {\n if (plugins) {\n for (let i = 0; i < plugins.length; i++) {\n this.addPlugin(plugins[i]);\n }\n }\n }\n\n /**\n *\n * @param plugin\n * @param {String} filename\n */\n addPlugin(plugin, filename, functionRegistry) {\n this.installedPlugins.push(plugin);\n if (filename) {\n this.pluginCache[filename] = plugin;\n }\n if (plugin.install) {\n plugin.install(this.less, this, functionRegistry || this.less.functions.functionRegistry);\n }\n }\n\n /**\n *\n * @param filename\n */\n get(filename) {\n return this.pluginCache[filename];\n }\n\n /**\n * Adds a visitor. The visitor object has options on itself to determine\n * when it should run.\n * @param visitor\n */\n addVisitor(visitor) {\n this.visitors.push(visitor);\n }\n\n /**\n * Adds a pre processor object\n * @param {object} preProcessor\n * @param {number} priority - guidelines 1 = before import, 1000 = import, 2000 = after import\n */\n addPreProcessor(preProcessor, priority) {\n let indexToInsertAt;\n for (indexToInsertAt = 0; indexToInsertAt < this.preProcessors.length; indexToInsertAt++) {\n if (this.preProcessors[indexToInsertAt].priority >= priority) {\n break;\n }\n }\n this.preProcessors.splice(indexToInsertAt, 0, {preProcessor, priority});\n }\n\n /**\n * Adds a post processor object\n * @param {object} postProcessor\n * @param {number} priority - guidelines 1 = before compression, 1000 = compression, 2000 = after compression\n */\n addPostProcessor(postProcessor, priority) {\n let indexToInsertAt;\n for (indexToInsertAt = 0; indexToInsertAt < this.postProcessors.length; indexToInsertAt++) {\n if (this.postProcessors[indexToInsertAt].priority >= priority) {\n break;\n }\n }\n this.postProcessors.splice(indexToInsertAt, 0, {postProcessor, priority});\n }\n\n /**\n *\n * @param manager\n */\n addFileManager(manager) {\n this.fileManagers.push(manager);\n }\n\n /**\n *\n * @returns {Array}\n * @private\n */\n getPreProcessors() {\n const preProcessors = [];\n for (let i = 0; i < this.preProcessors.length; i++) {\n preProcessors.push(this.preProcessors[i].preProcessor);\n }\n return preProcessors;\n }\n\n /**\n *\n * @returns {Array}\n * @private\n */\n getPostProcessors() {\n const postProcessors = [];\n for (let i = 0; i < this.postProcessors.length; i++) {\n postProcessors.push(this.postProcessors[i].postProcessor);\n }\n return postProcessors;\n }\n\n /**\n *\n * @returns {Array}\n * @private\n */\n getVisitors() {\n return this.visitors;\n }\n\n visitor() {\n const self = this;\n return {\n first: function() {\n self.iterator = -1;\n return self.visitors[self.iterator];\n },\n get: function() {\n self.iterator += 1;\n return self.visitors[self.iterator];\n }\n };\n }\n\n /**\n *\n * @returns {Array}\n * @private\n */\n getFileManagers() {\n return this.fileManagers;\n }\n}\n\nlet pm;\n\nconst PluginManagerFactory = function(less, newFactory) {\n if (newFactory || !pm) {\n pm = new PluginManager(less);\n }\n return pm;\n};\n\n//\nexport default PluginManagerFactory;\n","'use strict';\n\nfunction parseNodeVersion(version) {\n var match = version.match(/^v(\\d{1,2})\\.(\\d{1,2})\\.(\\d{1,2})(?:-([0-9A-Za-z-.]+))?(?:\\+([0-9A-Za-z-.]+))?$/); // eslint-disable-line max-len\n if (!match) {\n throw new Error('Unable to parse: ' + version);\n }\n\n var res = {\n major: parseInt(match[1], 10),\n minor: parseInt(match[2], 10),\n patch: parseInt(match[3], 10),\n pre: match[4] || '',\n build: match[5] || '',\n };\n\n return res;\n}\n\nmodule.exports = parseNodeVersion;\n","import AbstractFileManager from '../less/environment/abstract-file-manager.js';\n\nlet options;\nlet logger;\nlet fileCache = {};\n\n// TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load\nconst FileManager = function() {}\nFileManager.prototype = Object.assign(new AbstractFileManager(), {\n alwaysMakePathsAbsolute() {\n return true;\n },\n\n join(basePath, laterPath) {\n if (!basePath) {\n return laterPath;\n }\n return this.extractUrlParts(laterPath, basePath).path;\n },\n\n doXHR(url, type, callback, errback) {\n const xhr = new XMLHttpRequest();\n const async = options.isFileProtocol ? options.fileAsync : true;\n\n if (typeof xhr.overrideMimeType === 'function') {\n xhr.overrideMimeType('text/css');\n }\n logger.debug(`XHR: Getting '${url}'`);\n xhr.open('GET', url, async);\n xhr.setRequestHeader('Accept', type || 'text/x-less, text/css; q=0.9, */*; q=0.5');\n xhr.send(null);\n\n function handleResponse(xhr, callback, errback) {\n if (xhr.status >= 200 && xhr.status < 300) {\n callback(xhr.responseText,\n xhr.getResponseHeader('Last-Modified'));\n } else if (typeof errback === 'function') {\n errback(xhr.status, url);\n }\n }\n\n if (options.isFileProtocol && !options.fileAsync) {\n if (xhr.status === 0 || (xhr.status >= 200 && xhr.status < 300)) {\n callback(xhr.responseText);\n } else {\n errback(xhr.status, url);\n }\n } else if (async) {\n xhr.onreadystatechange = () => {\n if (xhr.readyState == 4) {\n handleResponse(xhr, callback, errback);\n }\n };\n } else {\n handleResponse(xhr, callback, errback);\n }\n },\n\n supports() {\n return true;\n },\n\n clearFileCache() {\n fileCache = {};\n },\n\n loadFile(filename, currentDirectory, options) {\n // TODO: Add prefix support like less-node?\n // What about multiple paths?\n\n if (currentDirectory && !this.isPathAbsolute(filename)) {\n filename = currentDirectory + filename;\n }\n\n filename = options.ext ? this.tryAppendExtension(filename, options.ext) : filename;\n\n options = options || {};\n\n // sheet may be set to the stylesheet for the initial load or a collection of properties including\n // some context variables for imports\n const hrefParts = this.extractUrlParts(filename, window.location.href);\n const href = hrefParts.url;\n const self = this;\n \n return new Promise((resolve, reject) => {\n if (options.useFileCache && fileCache[href]) {\n try {\n const lessText = fileCache[href];\n return resolve({ contents: lessText, filename: href, webInfo: { lastModified: new Date() }});\n } catch (e) {\n return reject({ filename: href, message: `Error loading file ${href} error was ${e.message}` });\n }\n }\n\n self.doXHR(href, options.mime, function doXHRCallback(data, lastModified) {\n // per file cache\n fileCache[href] = data;\n\n // Use remote copy (re-parse)\n resolve({ contents: data, filename: href, webInfo: { lastModified }});\n }, function doXHRError(status, url) {\n reject({ type: 'File', message: `'${url}' wasn't found (${status})`, href });\n });\n });\n }\n});\n\nexport default (opts, log) => {\n options = opts;\n logger = log;\n return FileManager;\n}\n","import Environment from './environment/environment';\nimport data from './data';\nimport tree from './tree';\nimport AbstractFileManager from './environment/abstract-file-manager';\nimport AbstractPluginLoader from './environment/abstract-plugin-loader';\nimport visitors from './visitors';\nimport Parser from './parser/parser';\nimport functions from './functions';\nimport contexts from './contexts';\nimport LessError from './less-error';\nimport transformTree from './transform-tree';\nimport * as utils from './utils';\nimport PluginManager from './plugin-manager';\nimport logger from './logger';\nimport SourceMapOutput from './source-map-output';\nimport SourceMapBuilder from './source-map-builder';\nimport ParseTree from './parse-tree';\nimport ImportManager from './import-manager';\nimport Parse from './parse';\nimport Render from './render';\nimport { version } from '../../package.json';\nimport parseVersion from 'parse-node-version';\n\nexport default function(environment, fileManagers) {\n let sourceMapOutput, sourceMapBuilder, parseTree, importManager;\n\n environment = new Environment(environment, fileManagers);\n sourceMapOutput = SourceMapOutput(environment);\n sourceMapBuilder = SourceMapBuilder(sourceMapOutput, environment);\n parseTree = ParseTree(sourceMapBuilder);\n importManager = ImportManager(environment);\n\n const render = Render(environment, parseTree, importManager);\n const parse = Parse(environment, parseTree, importManager);\n\n const v = parseVersion(`v${version}`);\n const initial = {\n version: [v.major, v.minor, v.patch],\n data,\n tree,\n Environment,\n AbstractFileManager,\n AbstractPluginLoader,\n environment,\n visitors,\n Parser,\n functions: functions(environment),\n contexts,\n SourceMapOutput: sourceMapOutput,\n SourceMapBuilder: sourceMapBuilder,\n ParseTree: parseTree,\n ImportManager: importManager,\n render,\n parse,\n LessError,\n transformTree,\n utils,\n PluginManager,\n logger\n };\n\n // Create a public API\n\n const ctor = function(t) {\n return function() {\n const obj = Object.create(t.prototype);\n t.apply(obj, Array.prototype.slice.call(arguments, 0));\n return obj;\n };\n };\n let t;\n const api = Object.create(initial);\n for (const n in initial.tree) {\n /* eslint guard-for-in: 0 */\n t = initial.tree[n];\n if (typeof t === 'function') {\n api[n.toLowerCase()] = ctor(t);\n }\n else {\n api[n] = Object.create(null);\n for (const o in t) {\n /* eslint guard-for-in: 0 */\n api[n][o.toLowerCase()] = ctor(t[o]);\n }\n }\n }\n\n /**\n * Some of the functions assume a `this` context of the API object,\n * which causes it to fail when wrapped for ES6 imports.\n * \n * An assumed `this` should be removed in the future.\n */\n initial.parse = initial.parse.bind(api);\n initial.render = initial.render.bind(api);\n\n return api;\n}\n","import LessError from './less-error';\nimport transformTree from './transform-tree';\nimport logger from './logger';\n\nexport default function(SourceMapBuilder) {\n class ParseTree {\n constructor(root, imports) {\n this.root = root;\n this.imports = imports;\n }\n\n toCSS(options) {\n let evaldRoot;\n const result = {};\n let sourceMapBuilder;\n try {\n evaldRoot = transformTree(this.root, options);\n } catch (e) {\n throw new LessError(e, this.imports);\n }\n\n try {\n const compress = Boolean(options.compress);\n if (compress) {\n logger.warn('The compress option has been deprecated. ' + \n 'We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.');\n }\n\n const toCSSOptions = {\n compress,\n dumpLineNumbers: options.dumpLineNumbers,\n strictUnits: Boolean(options.strictUnits),\n numPrecision: 8};\n\n if (options.sourceMap) {\n sourceMapBuilder = new SourceMapBuilder(options.sourceMap);\n result.css = sourceMapBuilder.toCSS(evaldRoot, toCSSOptions, this.imports);\n } else {\n result.css = evaldRoot.toCSS(toCSSOptions);\n }\n } catch (e) {\n throw new LessError(e, this.imports);\n }\n\n if (options.pluginManager) {\n const postProcessors = options.pluginManager.getPostProcessors();\n for (let i = 0; i < postProcessors.length; i++) {\n result.css = postProcessors[i].process(result.css, { sourceMap: sourceMapBuilder, options, imports: this.imports });\n }\n }\n if (options.sourceMap) {\n result.map = sourceMapBuilder.getExternalSourceMap();\n }\n\n result.imports = [];\n for (const file in this.imports.files) {\n if (Object.prototype.hasOwnProperty.call(this.imports.files, file) && file !== this.imports.rootFilename) {\n result.imports.push(file);\n }\n }\n return result;\n }\n }\n\n return ParseTree;\n}\n","export default function (SourceMapOutput, environment) {\n class SourceMapBuilder {\n constructor(options) {\n this.options = options;\n }\n\n toCSS(rootNode, options, imports) {\n const sourceMapOutput = new SourceMapOutput(\n {\n contentsIgnoredCharsMap: imports.contentsIgnoredChars,\n rootNode,\n contentsMap: imports.contents,\n sourceMapFilename: this.options.sourceMapFilename,\n sourceMapURL: this.options.sourceMapURL,\n outputFilename: this.options.sourceMapOutputFilename,\n sourceMapBasepath: this.options.sourceMapBasepath,\n sourceMapRootpath: this.options.sourceMapRootpath,\n outputSourceFiles: this.options.outputSourceFiles,\n sourceMapGenerator: this.options.sourceMapGenerator,\n sourceMapFileInline: this.options.sourceMapFileInline, \n disableSourcemapAnnotation: this.options.disableSourcemapAnnotation\n });\n\n const css = sourceMapOutput.toCSS(options);\n this.sourceMap = sourceMapOutput.sourceMap;\n this.sourceMapURL = sourceMapOutput.sourceMapURL;\n if (this.options.sourceMapInputFilename) {\n this.sourceMapInputFilename = sourceMapOutput.normalizeFilename(this.options.sourceMapInputFilename);\n }\n if (this.options.sourceMapBasepath !== undefined && this.sourceMapURL !== undefined) {\n this.sourceMapURL = sourceMapOutput.removeBasepath(this.sourceMapURL);\n }\n return css + this.getCSSAppendage();\n }\n\n getCSSAppendage() {\n\n let sourceMapURL = this.sourceMapURL;\n if (this.options.sourceMapFileInline) {\n if (this.sourceMap === undefined) {\n return '';\n }\n sourceMapURL = `data:application/json;base64,${environment.encodeBase64(this.sourceMap)}`;\n }\n\n if (this.options.disableSourcemapAnnotation) {\n return '';\n }\n\n if (sourceMapURL) {\n return `/*# sourceMappingURL=${sourceMapURL} */`;\n }\n return '';\n }\n\n getExternalSourceMap() {\n return this.sourceMap;\n }\n\n setExternalSourceMap(sourceMap) {\n this.sourceMap = sourceMap;\n }\n\n isInline() {\n return this.options.sourceMapFileInline;\n }\n\n getSourceMapURL() {\n return this.sourceMapURL;\n }\n\n getOutputFilename() {\n return this.options.sourceMapOutputFilename;\n }\n\n getInputFilename() {\n return this.sourceMapInputFilename;\n }\n }\n\n return SourceMapBuilder;\n}\n","export default function (environment) {\n class SourceMapOutput {\n constructor(options) {\n this._css = [];\n this._rootNode = options.rootNode;\n this._contentsMap = options.contentsMap;\n this._contentsIgnoredCharsMap = options.contentsIgnoredCharsMap;\n if (options.sourceMapFilename) {\n this._sourceMapFilename = options.sourceMapFilename.replace(/\\\\/g, '/');\n }\n this._outputFilename = options.outputFilename;\n this.sourceMapURL = options.sourceMapURL;\n if (options.sourceMapBasepath) {\n this._sourceMapBasepath = options.sourceMapBasepath.replace(/\\\\/g, '/');\n }\n if (options.sourceMapRootpath) {\n this._sourceMapRootpath = options.sourceMapRootpath.replace(/\\\\/g, '/');\n if (this._sourceMapRootpath.charAt(this._sourceMapRootpath.length - 1) !== '/') {\n this._sourceMapRootpath += '/';\n }\n } else {\n this._sourceMapRootpath = '';\n }\n this._outputSourceFiles = options.outputSourceFiles;\n this._sourceMapGeneratorConstructor = environment.getSourceMapGenerator();\n\n this._lineNumber = 0;\n this._column = 0;\n }\n\n removeBasepath(path) {\n if (this._sourceMapBasepath && path.indexOf(this._sourceMapBasepath) === 0) {\n path = path.substring(this._sourceMapBasepath.length);\n if (path.charAt(0) === '\\\\' || path.charAt(0) === '/') {\n path = path.substring(1);\n }\n }\n\n return path;\n }\n\n normalizeFilename(filename) {\n filename = filename.replace(/\\\\/g, '/');\n filename = this.removeBasepath(filename);\n return (this._sourceMapRootpath || '') + filename;\n }\n\n add(chunk, fileInfo, index, mapLines) {\n\n // ignore adding empty strings\n if (!chunk) {\n return;\n }\n\n let lines, sourceLines, columns, sourceColumns, i;\n\n if (fileInfo && fileInfo.filename) {\n let inputSource = this._contentsMap[fileInfo.filename];\n\n // remove vars/banner added to the top of the file\n if (this._contentsIgnoredCharsMap[fileInfo.filename]) {\n // adjust the index\n index -= this._contentsIgnoredCharsMap[fileInfo.filename];\n if (index < 0) { index = 0; }\n // adjust the source\n inputSource = inputSource.slice(this._contentsIgnoredCharsMap[fileInfo.filename]);\n }\n\n /** \n * ignore empty content, or failsafe\n * if contents map is incorrect\n */\n if (inputSource === undefined) {\n this._css.push(chunk);\n return;\n }\n\n inputSource = inputSource.substring(0, index);\n sourceLines = inputSource.split('\\n');\n sourceColumns = sourceLines[sourceLines.length - 1];\n }\n\n lines = chunk.split('\\n');\n columns = lines[lines.length - 1];\n\n if (fileInfo && fileInfo.filename) {\n if (!mapLines) {\n this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + 1, column: this._column},\n original: { line: sourceLines.length, column: sourceColumns.length},\n source: this.normalizeFilename(fileInfo.filename)});\n } else {\n for (i = 0; i < lines.length; i++) {\n this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + i + 1, column: i === 0 ? this._column : 0},\n original: { line: sourceLines.length + i, column: i === 0 ? sourceColumns.length : 0},\n source: this.normalizeFilename(fileInfo.filename)});\n }\n }\n }\n\n if (lines.length === 1) {\n this._column += columns.length;\n } else {\n this._lineNumber += lines.length - 1;\n this._column = columns.length;\n }\n\n this._css.push(chunk);\n }\n\n isEmpty() {\n return this._css.length === 0;\n }\n\n toCSS(context) {\n this._sourceMapGenerator = new this._sourceMapGeneratorConstructor({ file: this._outputFilename, sourceRoot: null });\n\n if (this._outputSourceFiles) {\n for (const filename in this._contentsMap) {\n // eslint-disable-next-line no-prototype-builtins\n if (this._contentsMap.hasOwnProperty(filename)) {\n let source = this._contentsMap[filename];\n if (this._contentsIgnoredCharsMap[filename]) {\n source = source.slice(this._contentsIgnoredCharsMap[filename]);\n }\n this._sourceMapGenerator.setSourceContent(this.normalizeFilename(filename), source);\n }\n }\n }\n\n this._rootNode.genCSS(context, this);\n\n if (this._css.length > 0) {\n let sourceMapURL;\n const sourceMapContent = JSON.stringify(this._sourceMapGenerator.toJSON());\n\n if (this.sourceMapURL) {\n sourceMapURL = this.sourceMapURL;\n } else if (this._sourceMapFilename) {\n sourceMapURL = this._sourceMapFilename;\n }\n this.sourceMapURL = sourceMapURL;\n\n this.sourceMap = sourceMapContent;\n }\n\n return this._css.join('');\n }\n }\n\n return SourceMapOutput;\n}\n","import contexts from './contexts';\nimport Parser from './parser/parser';\nimport LessError from './less-error';\nimport * as utils from './utils';\nimport logger from './logger';\n\nexport default function(environment) {\n // FileInfo = {\n // 'rewriteUrls' - option - whether to adjust URL's to be relative\n // 'filename' - full resolved filename of current file\n // 'rootpath' - path to append to normal URLs for this node\n // 'currentDirectory' - path to the current file, absolute\n // 'rootFilename' - filename of the base file\n // 'entryPath' - absolute path to the entry file\n // 'reference' - whether the file should not be output and only output parts that are referenced\n\n class ImportManager {\n constructor(less, context, rootFileInfo) {\n this.less = less;\n this.rootFilename = rootFileInfo.filename;\n this.paths = context.paths || []; // Search paths, when importing\n this.contents = {}; // map - filename to contents of all the files\n this.contentsIgnoredChars = {}; // map - filename to lines at the beginning of each file to ignore\n this.mime = context.mime;\n this.error = null;\n this.context = context;\n // Deprecated? Unused outside of here, could be useful.\n this.queue = []; // Files which haven't been imported yet\n this.files = {}; // Holds the imported parse trees.\n }\n\n /**\n * Add an import to be imported\n * @param path - the raw path\n * @param tryAppendExtension - whether to try appending a file extension (.less or .js if the path has no extension)\n * @param currentFileInfo - the current file info (used for instance to work out relative paths)\n * @param importOptions - import options\n * @param callback - callback for when it is imported\n */\n push(path, tryAppendExtension, currentFileInfo, importOptions, callback) {\n const importManager = this, pluginLoader = this.context.pluginManager.Loader;\n\n this.queue.push(path);\n\n const fileParsedFunc = function (e, root, fullPath) {\n importManager.queue.splice(importManager.queue.indexOf(path), 1); // Remove the path from the queue\n\n const importedEqualsRoot = fullPath === importManager.rootFilename;\n if (importOptions.optional && e) {\n callback(null, {rules:[]}, false, null);\n logger.info(`The file ${fullPath} was skipped because it was not found and the import was marked optional.`);\n }\n else {\n // Inline imports aren't cached here.\n // If we start to cache them, please make sure they won't conflict with non-inline imports of the\n // same name as they used to do before this comment and the condition below have been added.\n if (!importManager.files[fullPath] && !importOptions.inline) {\n importManager.files[fullPath] = { root, options: importOptions };\n }\n if (e && !importManager.error) { importManager.error = e; }\n callback(e, root, importedEqualsRoot, fullPath);\n }\n };\n\n const newFileInfo = {\n rewriteUrls: this.context.rewriteUrls,\n entryPath: currentFileInfo.entryPath,\n rootpath: currentFileInfo.rootpath,\n rootFilename: currentFileInfo.rootFilename\n };\n\n const fileManager = environment.getFileManager(path, currentFileInfo.currentDirectory, this.context, environment);\n\n if (!fileManager) {\n fileParsedFunc({ message: `Could not find a file-manager for ${path}` });\n return;\n }\n\n const loadFileCallback = function(loadedFile) {\n let plugin;\n const resolvedFilename = loadedFile.filename;\n const contents = loadedFile.contents.replace(/^\\uFEFF/, '');\n\n // Pass on an updated rootpath if path of imported file is relative and file\n // is in a (sub|sup) directory\n //\n // Examples:\n // - If path of imported file is 'module/nav/nav.less' and rootpath is 'less/',\n // then rootpath should become 'less/module/nav/'\n // - If path of imported file is '../mixins.less' and rootpath is 'less/',\n // then rootpath should become 'less/../'\n newFileInfo.currentDirectory = fileManager.getPath(resolvedFilename);\n if (newFileInfo.rewriteUrls) {\n newFileInfo.rootpath = fileManager.join(\n (importManager.context.rootpath || ''),\n fileManager.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath));\n\n if (!fileManager.isPathAbsolute(newFileInfo.rootpath) && fileManager.alwaysMakePathsAbsolute()) {\n newFileInfo.rootpath = fileManager.join(newFileInfo.entryPath, newFileInfo.rootpath);\n }\n }\n newFileInfo.filename = resolvedFilename;\n\n const newEnv = new contexts.Parse(importManager.context);\n\n newEnv.processImports = false;\n importManager.contents[resolvedFilename] = contents;\n\n if (currentFileInfo.reference || importOptions.reference) {\n newFileInfo.reference = true;\n }\n\n if (importOptions.isPlugin) {\n plugin = pluginLoader.evalPlugin(contents, newEnv, importManager, importOptions.pluginArgs, newFileInfo);\n if (plugin instanceof LessError) {\n fileParsedFunc(plugin, null, resolvedFilename);\n }\n else {\n fileParsedFunc(null, plugin, resolvedFilename);\n }\n } else if (importOptions.inline) {\n fileParsedFunc(null, contents, resolvedFilename);\n } else {\n // import (multiple) parse trees apparently get altered and can't be cached.\n // TODO: investigate why this is\n if (importManager.files[resolvedFilename]\n && !importManager.files[resolvedFilename].options.multiple\n && !importOptions.multiple) {\n\n fileParsedFunc(null, importManager.files[resolvedFilename].root, resolvedFilename);\n }\n else {\n new Parser(newEnv, importManager, newFileInfo).parse(contents, function (e, root) {\n fileParsedFunc(e, root, resolvedFilename);\n });\n }\n }\n };\n let loadedFile;\n let promise;\n const context = utils.clone(this.context);\n\n if (tryAppendExtension) {\n context.ext = importOptions.isPlugin ? '.js' : '.less';\n }\n\n if (importOptions.isPlugin) {\n context.mime = 'application/javascript';\n\n if (context.syncImport) {\n loadedFile = pluginLoader.loadPluginSync(path, currentFileInfo.currentDirectory, context, environment, fileManager);\n } else {\n promise = pluginLoader.loadPlugin(path, currentFileInfo.currentDirectory, context, environment, fileManager);\n }\n }\n else {\n if (context.syncImport) {\n loadedFile = fileManager.loadFileSync(path, currentFileInfo.currentDirectory, context, environment);\n } else {\n promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, context, environment,\n (err, loadedFile) => {\n if (err) {\n fileParsedFunc(err);\n } else {\n loadFileCallback(loadedFile);\n }\n });\n }\n }\n if (loadedFile) {\n if (!loadedFile.filename) {\n fileParsedFunc(loadedFile);\n } else {\n loadFileCallback(loadedFile);\n }\n } else if (promise) {\n promise.then(loadFileCallback, fileParsedFunc);\n }\n }\n }\n\n return ImportManager;\n}\n","import * as utils from './utils';\n\nexport default function(environment, ParseTree) {\n const render = function (input, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = utils.copyOptions(this.options, {});\n }\n else {\n options = utils.copyOptions(this.options, options || {});\n }\n\n if (!callback) {\n const self = this;\n return new Promise(function (resolve, reject) {\n render.call(self, input, options, function(err, output) {\n if (err) {\n reject(err);\n } else {\n resolve(output);\n }\n });\n });\n } else {\n this.parse(input, options, function(err, root, imports, options) {\n if (err) { return callback(err); }\n\n let result;\n try {\n const parseTree = new ParseTree(root, imports);\n result = parseTree.toCSS(options);\n }\n catch (err) { return callback(err); }\n\n callback(null, result);\n });\n }\n };\n\n return render;\n}\n","import contexts from './contexts';\nimport Parser from './parser/parser';\nimport PluginManager from './plugin-manager';\nimport LessError from './less-error';\nimport * as utils from './utils';\n\nexport default function(environment, ParseTree, ImportManager) {\n const parse = function (input, options, callback) {\n\n if (typeof options === 'function') {\n callback = options;\n options = utils.copyOptions(this.options, {});\n }\n else {\n options = utils.copyOptions(this.options, options || {});\n }\n\n if (!callback) {\n const self = this;\n return new Promise(function (resolve, reject) {\n parse.call(self, input, options, function(err, output) {\n if (err) {\n reject(err);\n } else {\n resolve(output);\n }\n });\n });\n } else {\n let context;\n let rootFileInfo;\n const pluginManager = new PluginManager(this, !options.reUsePluginManager);\n\n options.pluginManager = pluginManager;\n\n context = new contexts.Parse(options);\n\n if (options.rootFileInfo) {\n rootFileInfo = options.rootFileInfo;\n } else {\n const filename = options.filename || 'input';\n const entryPath = filename.replace(/[^/\\\\]*$/, '');\n rootFileInfo = {\n filename,\n rewriteUrls: context.rewriteUrls,\n rootpath: context.rootpath || '',\n currentDirectory: entryPath,\n entryPath,\n rootFilename: filename\n };\n // add in a missing trailing slash\n if (rootFileInfo.rootpath && rootFileInfo.rootpath.slice(-1) !== '/') {\n rootFileInfo.rootpath += '/';\n }\n }\n\n const imports = new ImportManager(this, context, rootFileInfo);\n this.importManager = imports;\n\n // TODO: allow the plugins to be just a list of paths or names\n // Do an async plugin queue like lessc\n\n if (options.plugins) {\n options.plugins.forEach(function(plugin) {\n let evalResult, contents;\n if (plugin.fileContent) {\n contents = plugin.fileContent.replace(/^\\uFEFF/, '');\n evalResult = pluginManager.Loader.evalPlugin(contents, context, imports, plugin.options, plugin.filename);\n if (evalResult instanceof LessError) {\n return callback(evalResult);\n }\n }\n else {\n pluginManager.addPlugin(plugin);\n }\n });\n }\n\n new Parser(context, imports, rootFileInfo)\n .parse(input, function (e, root) {\n if (e) { return callback(e); }\n callback(null, root, imports, options);\n }, options);\n }\n };\n return parse;\n}\n","/**\n * @todo Add tests for browser `@plugin`\n */\nimport AbstractPluginLoader from '../less/environment/abstract-plugin-loader.js';\n\n/**\n * Browser Plugin Loader\n */\nconst PluginLoader = function(less) {\n this.less = less;\n // Should we shim this.require for browser? Probably not?\n};\n\nPluginLoader.prototype = Object.assign(new AbstractPluginLoader(), {\n loadPlugin(filename, basePath, context, environment, fileManager) {\n return new Promise((fulfill, reject) => {\n fileManager.loadFile(filename, basePath, context, environment)\n .then(fulfill).catch(reject);\n });\n }\n});\n\nexport default PluginLoader;\n\n","export default (less, options) => {\n const logLevel_debug = 4;\n const logLevel_info = 3;\n const logLevel_warn = 2;\n const logLevel_error = 1;\n\n // The amount of logging in the javascript console.\n // 3 - Debug, information and errors\n // 2 - Information and errors\n // 1 - Errors\n // 0 - None\n // Defaults to 2\n options.logLevel = typeof options.logLevel !== 'undefined' ? options.logLevel : (options.env === 'development' ? logLevel_info : logLevel_error);\n\n if (!options.loggers) {\n options.loggers = [{\n debug: function(msg) {\n if (options.logLevel >= logLevel_debug) {\n console.log(msg);\n }\n },\n info: function(msg) {\n if (options.logLevel >= logLevel_info) {\n console.log(msg);\n }\n },\n warn: function(msg) {\n if (options.logLevel >= logLevel_warn) {\n console.warn(msg);\n }\n },\n error: function(msg) {\n if (options.logLevel >= logLevel_error) {\n console.error(msg);\n }\n }\n }];\n }\n for (let i = 0; i < options.loggers.length; i++) {\n less.logger.addListener(options.loggers[i]);\n }\n};\n","import * as utils from './utils';\nimport browser from './browser';\n\nexport default (window, less, options) => {\n\n function errorHTML(e, rootHref) {\n const id = `less-error-message:${utils.extractId(rootHref || '')}`;\n const template = '
  • {content}
  • ';\n const elem = window.document.createElement('div');\n let timer;\n let content;\n const errors = [];\n const filename = e.filename || rootHref;\n const filenameNoPath = filename.match(/([^/]+(\\?.*)?)$/)[1];\n\n elem.id = id;\n elem.className = 'less-error-message';\n\n content = `

    ${e.type || 'Syntax'}Error: ${e.message || 'There is an error in your .less file'}` + \n `

    in ${filenameNoPath} `;\n\n const errorline = (e, i, classname) => {\n if (e.extract[i] !== undefined) {\n errors.push(template.replace(/\\{line\\}/, (parseInt(e.line, 10) || 0) + (i - 1))\n .replace(/\\{class\\}/, classname)\n .replace(/\\{content\\}/, e.extract[i]));\n }\n };\n\n if (e.line) {\n errorline(e, 0, '');\n errorline(e, 1, 'line');\n errorline(e, 2, '');\n content += `on line ${e.line}, column ${e.column + 1}:

      ${errors.join('')}
    `;\n }\n if (e.stack && (e.extract || options.logLevel >= 4)) {\n content += `
    Stack Trace
    ${e.stack.split('\\n').slice(1).join('
    ')}`;\n }\n elem.innerHTML = content;\n\n // CSS for error messages\n browser.createCSS(window.document, [\n '.less-error-message ul, .less-error-message li {',\n 'list-style-type: none;',\n 'margin-right: 15px;',\n 'padding: 4px 0;',\n 'margin: 0;',\n '}',\n '.less-error-message label {',\n 'font-size: 12px;',\n 'margin-right: 15px;',\n 'padding: 4px 0;',\n 'color: #cc7777;',\n '}',\n '.less-error-message pre {',\n 'color: #dd6666;',\n 'padding: 4px 0;',\n 'margin: 0;',\n 'display: inline-block;',\n '}',\n '.less-error-message pre.line {',\n 'color: #ff0000;',\n '}',\n '.less-error-message h3 {',\n 'font-size: 20px;',\n 'font-weight: bold;',\n 'padding: 15px 0 5px 0;',\n 'margin: 0;',\n '}',\n '.less-error-message a {',\n 'color: #10a',\n '}',\n '.less-error-message .error {',\n 'color: red;',\n 'font-weight: bold;',\n 'padding-bottom: 2px;',\n 'border-bottom: 1px dashed red;',\n '}'\n ].join('\\n'), { title: 'error-message' });\n\n elem.style.cssText = [\n 'font-family: Arial, sans-serif',\n 'border: 1px solid #e00',\n 'background-color: #eee',\n 'border-radius: 5px',\n '-webkit-border-radius: 5px',\n '-moz-border-radius: 5px',\n 'color: #e00',\n 'padding: 15px',\n 'margin-bottom: 15px'\n ].join(';');\n\n if (options.env === 'development') {\n timer = setInterval(() => {\n const document = window.document;\n const body = document.body;\n if (body) {\n if (document.getElementById(id)) {\n body.replaceChild(elem, document.getElementById(id));\n } else {\n body.insertBefore(elem, body.firstChild);\n }\n clearInterval(timer);\n }\n }, 10);\n }\n }\n\n function removeErrorHTML(path) {\n const node = window.document.getElementById(`less-error-message:${utils.extractId(path)}`);\n if (node) {\n node.parentNode.removeChild(node);\n }\n }\n\n function removeErrorConsole() {\n // no action\n }\n\n function removeError(path) {\n if (!options.errorReporting || options.errorReporting === 'html') {\n removeErrorHTML(path);\n } else if (options.errorReporting === 'console') {\n removeErrorConsole(path);\n } else if (typeof options.errorReporting === 'function') {\n options.errorReporting('remove', path);\n }\n }\n\n function errorConsole(e, rootHref) {\n const template = '{line} {content}';\n const filename = e.filename || rootHref;\n const errors = [];\n let content = `${e.type || 'Syntax'}Error: ${e.message || 'There is an error in your .less file'} in ${filename}`;\n\n const errorline = (e, i, classname) => {\n if (e.extract[i] !== undefined) {\n errors.push(template.replace(/\\{line\\}/, (parseInt(e.line, 10) || 0) + (i - 1))\n .replace(/\\{class\\}/, classname)\n .replace(/\\{content\\}/, e.extract[i]));\n }\n };\n\n if (e.line) {\n errorline(e, 0, '');\n errorline(e, 1, 'line');\n errorline(e, 2, '');\n content += ` on line ${e.line}, column ${e.column + 1}:\\n${errors.join('\\n')}`;\n }\n if (e.stack && (e.extract || options.logLevel >= 4)) {\n content += `\\nStack Trace\\n${e.stack}`;\n }\n less.logger.error(content);\n }\n\n function error(e, rootHref) {\n if (!options.errorReporting || options.errorReporting === 'html') {\n errorHTML(e, rootHref);\n } else if (options.errorReporting === 'console') {\n errorConsole(e, rootHref);\n } else if (typeof options.errorReporting === 'function') {\n options.errorReporting('add', e, rootHref);\n }\n }\n\n return {\n add: error,\n remove: removeError\n };\n};\n","/**\n * Kicks off less and compiles any stylesheets\n * used in the browser distributed version of less\n * to kick-start less using the browser api\n */\nimport defaultOptions from '../less/default-options';\nimport addDefaultOptions from './add-default-options';\nimport root from './index';\n\nconst options = defaultOptions();\n\nif (window.less) {\n for (const key in window.less) {\n if (Object.prototype.hasOwnProperty.call(window.less, key)) {\n options[key] = window.less[key];\n }\n }\n}\naddDefaultOptions(window, options);\n\noptions.plugins = options.plugins || [];\n\nif (window.LESS_PLUGINS) {\n options.plugins = options.plugins.concat(window.LESS_PLUGINS);\n}\n\nconst less = root(window, options);\nexport default less;\n\nwindow.less = less;\n\nlet css;\nlet head;\nlet style;\n\n// Always restore page visibility\nfunction resolveOrReject(data) {\n if (data.filename) {\n console.warn(data);\n }\n if (!options.async) {\n head.removeChild(style);\n }\n}\n\nif (options.onReady) {\n if (/!watch/.test(window.location.hash)) {\n less.watch();\n }\n // Simulate synchronous stylesheet loading by hiding page rendering\n if (!options.async) {\n css = 'body { display: none !important }';\n head = document.head || document.getElementsByTagName('head')[0];\n style = document.createElement('style');\n\n style.type = 'text/css';\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n\n head.appendChild(style);\n }\n less.registerStylesheetsImmediately();\n less.pageLoadFinished = less.refresh(less.env === 'development').then(resolveOrReject, resolveOrReject);\n}\n","// Export a new default each time\nexport default function() {\n return {\n /* Inline Javascript - @plugin still allowed */\n javascriptEnabled: false,\n\n /* Outputs a makefile import dependency list to stdout. */\n depends: false,\n\n /* (DEPRECATED) Compress using less built-in compression. \n * This does an okay job but does not utilise all the tricks of \n * dedicated css compression. */\n compress: false,\n\n /* Runs the less parser and just reports errors without any output. */\n lint: false,\n\n /* Sets available include paths.\n * If the file in an @import rule does not exist at that exact location, \n * less will look for it at the location(s) passed to this option. \n * You might use this for instance to specify a path to a library which \n * you want to be referenced simply and relatively in the less files. */\n paths: [],\n\n /* color output in the terminal */\n color: true,\n\n /* The strictImports controls whether the compiler will allow an @import inside of either \n * @media blocks or (a later addition) other selector blocks.\n * See: https://github.com/less/less.js/issues/656 */\n strictImports: false,\n\n /* Allow Imports from Insecure HTTPS Hosts */\n insecure: false,\n\n /* Allows you to add a path to every generated import and url in your css. \n * This does not affect less import statements that are processed, just ones \n * that are left in the output css. */\n rootpath: '',\n\n /* By default URLs are kept as-is, so if you import a file in a sub-directory \n * that references an image, exactly the same URL will be output in the css. \n * This option allows you to re-write URL's in imported files so that the \n * URL is always relative to the base imported file */\n rewriteUrls: false,\n\n /* How to process math \n * 0 always - eagerly try to solve all operations\n * 1 parens-division - require parens for division \"/\"\n * 2 parens | strict - require parens for all operations\n * 3 strict-legacy - legacy strict behavior (super-strict)\n */\n math: 1,\n\n /* Without this option, less attempts to guess at the output unit when it does maths. */\n strictUnits: false,\n\n /* Effectively the declaration is put at the top of your base Less file, \n * meaning it can be used but it also can be overridden if this variable \n * is defined in the file. */\n globalVars: null,\n\n /* As opposed to the global variable option, this puts the declaration at the\n * end of your base file, meaning it will override anything defined in your Less file. */\n modifyVars: null,\n\n /* This option allows you to specify a argument to go on to every URL. */\n urlArgs: ''\n }\n}","import {addDataAttr} from './utils';\nimport browser from './browser';\n\nexport default (window, options) => {\n\n // use options from the current script tag data attribues\n addDataAttr(options, browser.currentScript(window));\n\n if (options.isFileProtocol === undefined) {\n options.isFileProtocol = /^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(window.location.protocol);\n }\n\n // Load styles asynchronously (default: false)\n //\n // This is set to `false` by default, so that the body\n // doesn't start loading before the stylesheets are parsed.\n // Setting this to `true` can result in flickering.\n //\n options.async = options.async || false;\n options.fileAsync = options.fileAsync || false;\n\n // Interval between watch polls\n options.poll = options.poll || (options.isFileProtocol ? 1000 : 1500);\n\n options.env = options.env || (window.location.hostname == '127.0.0.1' ||\n window.location.hostname == '0.0.0.0' ||\n window.location.hostname == 'localhost' ||\n (window.location.port &&\n window.location.port.length > 0) ||\n options.isFileProtocol ? 'development'\n : 'production');\n\n const dumpLineNumbers = /!dumpLineNumbers:(comments|mediaquery|all)/.exec(window.location.hash);\n if (dumpLineNumbers) {\n options.dumpLineNumbers = dumpLineNumbers[1];\n }\n\n if (options.useFileCache === undefined) {\n options.useFileCache = true;\n }\n\n if (options.onReady === undefined) {\n options.onReady = true;\n }\n\n if (options.relativeUrls) {\n options.rewriteUrls = 'all';\n }\n};\n","//\n// index.js\n// Should expose the additional browser functions on to the less object\n//\nimport {addDataAttr} from './utils';\nimport lessRoot from '../less';\nimport browser from './browser';\nimport FM from './file-manager';\nimport PluginLoader from './plugin-loader';\nimport LogListener from './log-listener';\nimport ErrorReporting from './error-reporting';\nimport Cache from './cache';\nimport ImageSize from './image-size';\n\nexport default (window, options) => {\n const document = window.document;\n const less = lessRoot();\n\n less.options = options;\n const environment = less.environment;\n const FileManager = FM(options, less.logger);\n const fileManager = new FileManager();\n environment.addFileManager(fileManager);\n less.FileManager = FileManager;\n less.PluginLoader = PluginLoader;\n\n LogListener(less, options);\n const errors = ErrorReporting(window, less, options);\n const cache = less.cache = options.cache || Cache(window, options, less.logger);\n ImageSize(less.environment);\n\n // Setup user functions - Deprecate?\n if (options.functions) {\n less.functions.functionRegistry.addMultiple(options.functions);\n }\n\n const typePattern = /^text\\/(x-)?less$/;\n\n function clone(obj) {\n const cloned = {};\n for (const prop in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, prop)) {\n cloned[prop] = obj[prop];\n }\n }\n return cloned;\n }\n\n // only really needed for phantom\n function bind(func, thisArg) {\n const curryArgs = Array.prototype.slice.call(arguments, 2);\n return function() {\n const args = curryArgs.concat(Array.prototype.slice.call(arguments, 0));\n return func.apply(thisArg, args);\n };\n }\n\n function loadStyles(modifyVars) {\n const styles = document.getElementsByTagName('style');\n let style;\n\n for (let i = 0; i < styles.length; i++) {\n style = styles[i];\n if (style.type.match(typePattern)) {\n const instanceOptions = clone(options);\n instanceOptions.modifyVars = modifyVars;\n const lessText = style.innerHTML || '';\n instanceOptions.filename = document.location.href.replace(/#.*$/, '');\n\n /* jshint loopfunc:true */\n // use closure to store current style\n less.render(lessText, instanceOptions,\n bind((style, e, result) => {\n if (e) {\n errors.add(e, 'inline');\n } else {\n style.type = 'text/css';\n if (style.styleSheet) {\n style.styleSheet.cssText = result.css;\n } else {\n style.innerHTML = result.css;\n }\n }\n }, null, style));\n }\n }\n }\n\n function loadStyleSheet(sheet, callback, reload, remaining, modifyVars) {\n\n const instanceOptions = clone(options);\n addDataAttr(instanceOptions, sheet);\n instanceOptions.mime = sheet.type;\n\n if (modifyVars) {\n instanceOptions.modifyVars = modifyVars;\n }\n\n function loadInitialFileCallback(loadedFile) {\n const data = loadedFile.contents;\n const path = loadedFile.filename;\n const webInfo = loadedFile.webInfo;\n\n const newFileInfo = {\n currentDirectory: fileManager.getPath(path),\n filename: path,\n rootFilename: path,\n rewriteUrls: instanceOptions.rewriteUrls\n };\n\n newFileInfo.entryPath = newFileInfo.currentDirectory;\n newFileInfo.rootpath = instanceOptions.rootpath || newFileInfo.currentDirectory;\n\n if (webInfo) {\n webInfo.remaining = remaining;\n\n const css = cache.getCSS(path, webInfo, instanceOptions.modifyVars);\n if (!reload && css) {\n webInfo.local = true;\n callback(null, css, data, sheet, webInfo, path);\n return;\n }\n\n }\n\n // TODO add tests around how this behaves when reloading\n errors.remove(path);\n\n instanceOptions.rootFileInfo = newFileInfo;\n less.render(data, instanceOptions, (e, result) => {\n if (e) {\n e.href = path;\n callback(e);\n } else {\n cache.setCSS(sheet.href, webInfo.lastModified, instanceOptions.modifyVars, result.css);\n callback(null, result.css, data, sheet, webInfo, path);\n }\n });\n }\n\n fileManager.loadFile(sheet.href, null, instanceOptions, environment)\n .then(loadedFile => {\n loadInitialFileCallback(loadedFile);\n }).catch(err => {\n console.log(err);\n callback(err);\n });\n\n }\n\n function loadStyleSheets(callback, reload, modifyVars) {\n for (let i = 0; i < less.sheets.length; i++) {\n loadStyleSheet(less.sheets[i], callback, reload, less.sheets.length - (i + 1), modifyVars);\n }\n }\n\n function initRunningMode() {\n if (less.env === 'development') {\n less.watchTimer = setInterval(() => {\n if (less.watchMode) {\n fileManager.clearFileCache();\n /**\n * @todo remove when this is typed with JSDoc\n */\n // eslint-disable-next-line no-unused-vars\n loadStyleSheets((e, css, _, sheet, webInfo) => {\n if (e) {\n errors.add(e, e.href || sheet.href);\n } else if (css) {\n browser.createCSS(window.document, css, sheet);\n }\n });\n }\n }, options.poll);\n }\n }\n\n //\n // Watch mode\n //\n less.watch = function () {\n if (!less.watchMode ) {\n less.env = 'development';\n initRunningMode();\n }\n this.watchMode = true;\n return true;\n };\n\n less.unwatch = function () {clearInterval(less.watchTimer); this.watchMode = false; return false; };\n\n //\n // Synchronously get all tags with the 'rel' attribute set to\n // \"stylesheet/less\".\n //\n less.registerStylesheetsImmediately = () => {\n const links = document.getElementsByTagName('link');\n less.sheets = [];\n\n for (let i = 0; i < links.length; i++) {\n if (links[i].rel === 'stylesheet/less' || (links[i].rel.match(/stylesheet/) &&\n (links[i].type.match(typePattern)))) {\n less.sheets.push(links[i]);\n }\n }\n };\n\n //\n // Asynchronously get all tags with the 'rel' attribute set to\n // \"stylesheet/less\", returning a Promise.\n //\n less.registerStylesheets = () => new Promise((resolve) => {\n less.registerStylesheetsImmediately();\n resolve();\n });\n\n //\n // With this function, it's possible to alter variables and re-render\n // CSS without reloading less-files\n //\n less.modifyVars = record => less.refresh(true, record, false);\n\n less.refresh = (reload, modifyVars, clearFileCache) => {\n if ((reload || clearFileCache) && clearFileCache !== false) {\n fileManager.clearFileCache();\n }\n return new Promise((resolve, reject) => {\n let startTime;\n let endTime;\n let totalMilliseconds;\n let remainingSheets;\n startTime = endTime = new Date();\n\n // Set counter for remaining unprocessed sheets\n remainingSheets = less.sheets.length;\n\n if (remainingSheets === 0) {\n\n endTime = new Date();\n totalMilliseconds = endTime - startTime;\n less.logger.info('Less has finished and no sheets were loaded.');\n resolve({\n startTime,\n endTime,\n totalMilliseconds,\n sheets: less.sheets.length\n });\n\n } else {\n // Relies on less.sheets array, callback seems to be guaranteed to be called for every element of the array\n loadStyleSheets((e, css, _, sheet, webInfo) => {\n if (e) {\n errors.add(e, e.href || sheet.href);\n reject(e);\n return;\n }\n if (webInfo.local) {\n less.logger.info(`Loading ${sheet.href} from cache.`);\n } else {\n less.logger.info(`Rendered ${sheet.href} successfully.`);\n }\n browser.createCSS(window.document, css, sheet);\n less.logger.info(`CSS for ${sheet.href} generated in ${new Date() - endTime}ms`);\n\n // Count completed sheet\n remainingSheets--;\n\n // Check if the last remaining sheet was processed and then call the promise\n if (remainingSheets === 0) {\n totalMilliseconds = new Date() - startTime;\n less.logger.info(`Less has finished. CSS generated in ${totalMilliseconds}ms`);\n resolve({\n startTime,\n endTime,\n totalMilliseconds,\n sheets: less.sheets.length\n });\n }\n endTime = new Date();\n }, reload, modifyVars);\n }\n\n loadStyles(modifyVars);\n });\n };\n\n less.refreshStyles = loadStyles;\n return less;\n};\n","// Cache system is a bit outdated and could do with work\n\nexport default (window, options, logger) => {\n let cache = null;\n if (options.env !== 'development') {\n try {\n cache = (typeof window.localStorage === 'undefined') ? null : window.localStorage;\n } catch (_) {}\n }\n return {\n setCSS: function(path, lastModified, modifyVars, styles) {\n if (cache) {\n logger.info(`saving ${path} to cache.`);\n try {\n cache.setItem(path, styles);\n cache.setItem(`${path}:timestamp`, lastModified);\n if (modifyVars) {\n cache.setItem(`${path}:vars`, JSON.stringify(modifyVars));\n }\n } catch (e) {\n // TODO - could do with adding more robust error handling\n logger.error(`failed to save \"${path}\" to local storage for caching.`);\n }\n }\n },\n getCSS: function(path, webInfo, modifyVars) {\n const css = cache && cache.getItem(path);\n const timestamp = cache && cache.getItem(`${path}:timestamp`);\n let vars = cache && cache.getItem(`${path}:vars`);\n\n modifyVars = modifyVars || {};\n vars = vars || '{}'; // if not set, treat as the JSON representation of an empty object\n\n if (timestamp && webInfo.lastModified &&\n (new Date(webInfo.lastModified).valueOf() ===\n new Date(timestamp).valueOf()) &&\n JSON.stringify(modifyVars) === vars) {\n // Use local copy\n return css;\n }\n }\n };\n};\n","\nimport functionRegistry from './../less/functions/function-registry';\n\nexport default () => {\n function imageSize() {\n throw {\n type: 'Runtime',\n message: 'Image size functions are not supported in browser version of less'\n };\n }\n\n const imageFunctions = {\n 'image-size': function(filePathNode) {\n imageSize(this, filePathNode);\n return -1;\n },\n 'image-width': function(filePathNode) {\n imageSize(this, filePathNode);\n return -1;\n },\n 'image-height': function(filePathNode) {\n imageSize(this, filePathNode);\n return -1;\n }\n };\n\n functionRegistry.addMultiple(imageFunctions);\n};\n"],"names":["extractId","href","replace","addDataAttr","options","tag","opt","dataset","Object","prototype","hasOwnProperty","call","JSON","parse","_","browser","document","styles","sheet","id","concat","title","utils.extractId","oldStyleNode","getElementById","keepOldStyleNode","styleNode","createElement","setAttribute","media","styleSheet","appendChild","createTextNode","childNodes","length","firstChild","nodeValue","head","getElementsByTagName","nextEl","nextSibling","parentNode","insertBefore","removeChild","cssText","e","Error","window","scripts","currentScript","logger$1","error","msg","this","_fireEvent","warn","info","debug","addListener","listener","_listeners","push","removeListener","i_1","splice","type","i_2","logFunction","Environment","externalEnvironment","fileManagers","requiredFunctions","functions","propName","environmentFunc","bind","getFileManager","filename","currentDirectory","environment","isSync","logger","undefined","pluginManager","getFileManagers","fileManager","addFileManager","clearFileManagers","colors","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgrey","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","unitConversions","m","cm","mm","in","px","pt","pc","duration","s","ms","angle","rad","Math","PI","deg","grad","turn","data","Node","parent","visibilityBlocks","nodeVisible","rootNode","parsed","defineProperty","get","fileInfo","getIndex","setParent","nodes","set","node","Array","isArray","forEach","_index","_fileInfo","isRulesetLike","toCSS","context","strs","genCSS","add","chunk","index","isEmpty","join","output","value","accept","visitor","visit","eval","_operate","op","a","b","fround","precision","numPrecision","Number","toFixed","compare","numericCompare","blocksVisibility","addVisibilityBlock","removeVisibilityBlock","ensureVisibility","ensureInvisibility","isVisible","visibilityInfo","copyVisibilityInfo","Color","rgb","originalForm","self","match","map","c","i","parseInt","alpha","split","clamp","v","max","min","toHex","round","toString","assign","luma","r","g","pow","doNotCompress","color","colorFunction","compress","args","indexOf","toHSL","h","l","toRGB","splitcolor","operate","other","d","toHSV","toARGB","x","fromKeyword","keyword","key","toLowerCase","slice","__assign","t","n","arguments","p","apply","SuppressedError","Paren","paren","noSpacing","_noSpaceCombinators"," ","|","Combinator","emptyOrWhitespace","trim","spaceOrEmpty","Element","combinator","isVariable","currentFileInfo","clone","firstSelector","charAt","ALWAYS","PARENS_DIVISION","PARENS","RewriteUrls","getType","payload","copy","target","item","constructor","getPrototypeOf","getOwnPropertyNames","getOwnPropertySymbols","reduce","carry","props","includes","newVal","originalObject","includeNonenumerable","propType","propertyIsEnumerable","enumerable","writable","configurable","assignProp","nonenumerable","getLocation","inputStream","line","column","copyArray","arr","obj","cloned","prop","defaults","obj1","obj2","newObj","_defaults","defaults_1","copyOptions","opts","strictMath","math","Constants.Math","relativeUrls","rewriteUrls","Constants.RewriteUrls","flattenArray","result","length_1","isNullOrUndefined","val","anonymousFunc","LessError","fileContentMap","currentFilename","message","stack","input","contents","loc","utils.getLocation","col","callLine","lines","found","func","Function","lineAdjust","callExtract","extract","create","F","isWarning","_a","stylize","str","type_1","errorTxt","substr","_visitArgs","visitDeeper","_hasIndexed","_noop","Visitor","implementation","_implementation","_visitInCache","_visitOutCache","indexNodeTypes","ticker","child","typeIndex","tree","nodeTypeIndex","fnName","impl","funcOut","visitArgs","newNode","isReplacing","cnt","visitArray","nonReplacing","out","evald","flatten","nestedCnt","j","nestedItem","contexts","copyFromOriginal","original","destination","propertiesToCopy","parseCopyProperties","Parse","paths","evalCopyProperties","isPathRelative","path","test","isPathLocalRelative","Eval","frames","importantScope","enterCalc","calcStack","inCalc","exitCalc","pop","inParenthesis","parensStack","outOfParenthesis","mathOn","isMathOn","pathRequiresRewrite","rewritePath","rootpath","newPath","normalizePath","segment","segments","reverse","ImportSequencer","onSequencerEmpty","imports","variableImports","_onSequencerEmpty","_currentDepth","addImport","callback","importSequencer","importItem","isReady","tryRun","addVariableImport","variableImport","ImportVisitor","importer","finish","_visitor","_importer","_finish","importCount","onceFileDetectionMap","recursionDetector","_sequencer","run","root","isFinished","visitImport","importNode","inlineCSS","inline","css","utils.copyArray","importParent","isVariableImport","processImportNode","evaldImportNode","evalForImport","multiple","importMultiple","tryAppendLessExtension","rules","onImported","sequencedOnImported","getPath","importedAtRoot","fullPath","importVisitor","isPlugin","isOptional","optional","duplicateImport","skip","importedFilename","oldContext","visitDeclaration","declNode","unshift","visitDeclarationOut","shift","visitAtRule","atRuleNode","declarations","isRooted","visitAtRuleOut","visitMixinDefinition","mixinDefinitionNode","visitMixinDefinitionOut","visitRuleset","rulesetNode","visitRulesetOut","visitMedia","mediaNode","visitMediaOut","SetTreeVisibilityVisitor","visible","ExtendFinderVisitor","allExtendsStack","allExtends","extend","extendList","allSelectorsExtendList","ruleCnt","Extend","extendOnEveryPath","selectorPath","selExtendList","allSelectorsExtend","foundExtends","findSelfSelectors","ruleset","firstExtendOnThisSelectorPath","selectors","ProcessExtendsVisitor","extendFinder","extendIndices","doExtendChaining","newRoot","checkExtendsForNonMatched","indices","filter","hasFoundMatches","parent_ids","selector","extendsList","extendsListTarget","iterationCount","extendIndex","targetExtendIndex","matches","newSelector","targetExtend","newExtend","extendsToAdd","extendVisitor","object_id","selfSelectors","findMatch","selfSelector","extendSelector","option","extendChainCount","selectorOne","selectorTwo","ruleNode","visitSelector","selectorNode","pathIndex","selectorsToAdd","extendedSelectors","haystackSelectorPath","haystackSelectorIndex","hackstackSelector","hackstackElementIndex","haystackElement","targetCombinator","potentialMatch","needleElements","elements","potentialMatches","allowBefore","matched","initialCombinator","isElementValuesEqual","finished","allowAfter","endPathIndex","endPathElementIndex","elementValue1","elementValue2","Attribute","Selector","replacementSelector","matchIndex","firstElement","newElements","currentSelectorPathIndex","currentSelectorPathElementIndex","currentValue","derived","createDerived","newAllExtends","lastIndex","JoinSelectorVisitor","getIsOutput","joinSelectors","multiMedia","CSSVisitorUtils","_context","containsSilentNonBlockedChild","bodyRules","rule","isSilent","keepOnlyVisibleChilds","owner","thing","hasVisibleSelector","resolveVisibility","compiledRulesBody","isVisibleRuleset","firstRoot","ToCSSVisitor","utils","variable","mixinNode","visitExtend","extendNode","visitComment","commentNode","originalRules","visitAtRuleWithBody","visitAtRuleWithoutBody","visitAnonymous","anonymousNode","nodeRules","hasFakeRuleset","getBodyRules","_mergeRules","name","charset","debugInfo","comment","Comment","checkValidNodes","isRoot","Declaration","Call","allowRoot","rulesets","_compileRulesetPaths","nodeRuleCnt","_removeDuplicateRules","ruleList","ruleCache","ruleCSS","groups","groupsArr","i_3","merge","group","result_1","space_1","comma_1","Expression","important","Value","visitors","MarkVisibleSelectorsVisitor","ExtendVisitor","getParserInput","furthest","furthestPossibleErrorMessage","chunks","current","currentPos","saveStack","parserInput","skipWhitespace","nextChar","oldi","oldj","curr","endIndex","mem","inp","charCodeAt","autoCommentAbsorb","isLineComment","nextNewLine","text","commentStore","nextStarSlash","save","restore","possibleErrorMessage","state","forget","isWhitespace","offset","pos","code","$re","tok","exec","$char","$peekChar","$str","tokLength","$quoted","startChar","currentPosition","$parseUntil","testChar","quote","returnVal","inComment","blockDepth","blockStack","parseGroups","startPos","lastPos","loop","char","expected","peek","peekChar","currentChar","prevChar","getInput","peekNotNumeric","start","chunkInput","failFunction","fail","lastOpening","lastOpeningParen","lastMultiComment","lastMultiCommentEndBrace","chunkerCurrentIndex","currentChunkStartIndex","cc","cc2","len","level","parenLevel","emitFrom","emitChunk","force","String","fromCharCode","chunker","end","furthestReachedEnd","furthestChar","functionRegistry","makeRegistry","base","_data","addMultiple","_this","keys","getLocalFunctions","inherit","MediaSyntaxOptions","queryInParens","ContainerSyntaxOptions","Anonymous","mapLines","rulesetLike","Boolean","Parser","currentIndex","parsers","quiet","toUpperCase","expect","arg","expectChar","getDebugInfo","lineNumber","fileName","parseNode","parseList","returnNodes","parser","additionalData","globalVars","modifyVars","ignored","err","preText","disablePluginRule","plugin","serializeVars","preProcessors","getPreProcessors","process","banner","contentsIgnoredChars","Ruleset","primary","endInfo","processImports","mixin","extendRule","definition","declaration","variableCall","entities","atrule","foundSemiColon","mixinLookup","quoted","forceEscaped","isEscaped","k","customFuncCall","stop","declarationCall","validCall","substring","ruleProperty","f","ieAlpha","boolean","condition","if","prevArgs","isSemiColonSeparated","argsComma","argsSemiColon","detachedRuleset","assignment","expression","literal","dimension","unicodeDescriptor","entity","url","property","Variable","Property","ch","variableCurly","curly","propertyCurly","colorKeyword","ud","javascript","js","escape","parsedName","lookups","inValue","ruleLookups","VariableCall","NamespaceValue","isRule","first","element","getLookup","hasParens","parensIndex","parensWS","elem","elemIndex","re","isCall","expressionContainsNamed","nameLoop","expand","returner","variadic","expressions","hasSep","throwAwayComments","cond","params","argInfo","conditions","block","lookupValue","Quoted","attribute","slashedCombinator","isLess","when","ele","cif","content","blockRuleset","Definition","DetachedRuleset","dumpLineNumbers","strictImports","hasDR","permissiveValue","anonymousValue","untilTokens","done","testCurrentChar","variableRegex","propRegex","import","features","dir","importOptions","mediaFeatures","o","optionName","importOption","mediaFeature","syntaxOptions","rangeP","spacing","atomicCondition","rvalue","lvalue","prepareAndGetNestableAtRule","treeType","atRule","nestableAtRule","Media","Container","pluginArgs","atruleUnknown","hasBlock","atruleBlock","isKeywordList","nonVendorSpecificName","hasIdentifier","hasExpression","hasUnknown","unknownPackage","blockPackage","sub","addition","parens","colorOperand","Keyword","multiplication","operation","isSpaced","operand","parensInOp","needsParens","logical","next","conditionAnd","negatedCondition","parenthesisCondition","negate","body","me","tryConditionFollowedByParenthesis","preparsedCond","delim","simpleProperty","vars","name_1","evaldCondition","getElements","mixinElements_","utils.isNullOrUndefined","mediaEmpty","els","importManager","createEmptySelectors","el","sels","olen","mixinElements","isJustParentSelector","True","False","MATH","asComment","ctx","asMediaQuery","filenameWithProtocol","lineSeparator","lastRule","prevMath","evaldValue","mathBypass","evalName","importantResult","makeImportant","isCompressed","defaultFunc","value_","error_","reset","_lookups","_variables","_properties","isRuleset","selCnt","hasVariable","hasOnePassingSelector","toParseSelectors","startingIndex","selectorFileInfo","utils.flattenArray","subRule","originalRuleset","allowImports","globalFunctionRegistry","ctxFrames","ctxSelectors","evalImports","rsRules","evalFirst","mediaBlockCount","mediaBlocks","resetCache","bubbleSelectors","importRules","matchArgs","matchCondition","lastSelector","_rulesets","variables","hash","properties","name_2","decl","parseValue","lastDeclaration","toParse","transformDeclaration","nodes_1","filtRules","prependRule","find","foundMixins","ruleNodes","tabLevel","sep","tabRuleStr","tabSetStr","charsetNodeIndex","importNodeIndex","isCharset","pathCnt","pathSubCnt","currentLastRule","joinSelector","createParenthesis","elementsToPak","originalElement","replacementParen","insideParent","createSelector","containedElement","addReplacementIntoPath","beginningPath","addPath","replacedElement","originalSelector","newSelectorPath","newJoinedSelector","parentEl","restOfPath","addAllReplacementsIntoPath","addPaths","mergeElementsOnToSelectors","sel","deriveSelector","deriveFrom","newPaths","replaceParentSelector","inSelector","currentElements","newSelectors","selectorsMultiplied","maybeSelector","hadParentSelector","nestedSelector","replaced","nestedPaths","replacedNewSelectors","concatenated","Unit","numerator","denominator","backupUnit","sort","strictUnits","returnStr","is","unitString","isLength","RegExp","isSingular","usedUnits","mapUnit","groupName","atomicUnit","cancel","counter","count","Dimension","unit","parseFloat","isNaN","toColor","strValue","convertTo","unify","conversions","targetUnit","applyUnit","derivedConversions","returnValue","doubleParen","NestableAtRulePrototype","evalFunction","expr","exprValues","evalTop","mediaPath","evalNested","permute","fragment","rest","AtRule","allDeclarations","declarationsBlock","allRulesetDeclarations_1","simpleBlock","mergeable","keywordList","outputRuleset","mediaPathBackup","mediaBlocksBackup","evalRoot","mergeRules","less","ampersandCount","noAmpersandCount","noAmpersands","allAmpersands","precedingSelectors","frame","value_1","mixedAmpersands","callEval","Operation","operands","functionCaller","isValid","evalArgs","commentFilter","subNodes","to","from","pack","ar","__spreadArray","calc","currentMathContext","funcCaller","FunctionCaller","columnNumber","evaluating","fun","vArr","escaped","containsVariables","that","iterativeReplace","regexp","replacementFnc","evaluatedValue","name1","name2","URL","isEvald","urlArgs","Import","pathValue","reference","evalPath","doEval","registry","featureValue","layerCss","newImport","JsEvalNode","evaluateJavaScript","evalContext","javascriptEnabled","jsify","toJS","JavaScript","string","Assignment","Condition","QueryInParens","op2","mvalue","mvalues","variableDeclaration","mvalueCopy","UnicodeDescriptor","Negative","next_id","selectorElements","selfElements","ruleCall","arity","optionalParameters","required","evalParams","mixinEnv","evaldArguments","varargs","isNamedFound","argIndex","argsLength","evalCall","_arguments","mixinFrames","allArgsCnt","requiredArgsCnt","MixinCall","mixins","mixinPath","argValue","isRecursive","isOneFound","candidate","defaultResult","noArgumentsFilter","candidates","conditionResult","calcDefGroup","namespace","MixinDefinition","format","newRules","_setVisibilityToReplacement","replacement","AbstractFileManager","lastIndexOf","tryAppendExtension","ext","supportsSync","alwaysMakePathsAbsolute","isPathAbsolute","basePath","laterPath","pathDiff","baseUrl","urlDirectories","baseUrlDirectories","urlParts","extractUrlParts","baseUrlParts","diff","hostPart","directories","urlPartsRegex","rawDirectories","rawPath","fileUrl","AbstractPluginLoader","require","evalPlugin","pluginOptions","pluginObj","localModule","shortname","FileManager","trySetOptions","use","exports","loader","validatePlugin","minVersion","compareVersion","addPlugin","setOptions","version","versionToString","aVersion","bVersion","versionString","printUsage","plugins","If","trueValue","falseValue","isdefined","colorFunctions","boolean$1","hsla","origColor","hsl","number","rgba","size","m1","m2","hue","hsv","hsva","vs","floor","perm","saturation","lightness","hsvhue","hsvsaturation","hsvvalue","luminance","saturate","amount","method","desaturate","lighten","darken","fadein","fadeout","fade","spin","mix","color1","color2","weight","w","w1","w2","greyscale","contrast","dark","light","threshold","argb","tint","shade","colorBlend","mode","cb","cs","cr","ab","as","colorBlendModeFunctions","multiply","screen","overlay","softlight","sqrt","hardlight","difference","abs","exclusion","average","negation","getItemsFromNode","list","_SELF","~","_i","values","range","step","stepValue","each","rs","iterator","tryEval","Quote","valueName","keyName","indexName","MathHelper","fn","mathFunctions","ceil","sin","cos","atan","asin","acos","mathHelper","fraction","num","minMax","isMin","currentUnified","referenceUnified","unitStatic","unitClone","order","convert","pi","mod","y","percentage","evaluated","encodeURI","pattern","flags","%","token","encodeURIComponent","isa","Type","isunit","types","isruleset","iscolor","isnumber","isstring","iskeyword","isurl","ispixel","ispercentage","isem","get-unit","styleExpression","style$1","style","colorBlending","fallback","functionThis","data-uri","mimetypeNode","filePathNode","mimetype","filePath","entryPath","fragmentStart","utils.clone","rawBuffer","useBase64","mimeLookup","charsetLookup","fileSync","loadFileSync","buf","encodeBase64","uri","dataUri","svg-gradient","direction","stops","gradientDirectionSvg","position","positionValue","gradientType","rectangleDimension","renderEnv","directionValue","throwArgumentDescriptor","transformTree","evaldRoot","evalEnv","visitorIterator","preEvalVisitors","isPreEvalVisitor","isPreVisitor","pm","PluginManager","postProcessors","installedPlugins","pluginCache","Loader","PluginLoader","addPlugins","install","addVisitor","addPreProcessor","preProcessor","priority","indexToInsertAt","addPostProcessor","postProcessor","manager","getPostProcessors","getVisitors","PluginManagerFactory","newFactory","parseNodeVersion_1","major","minor","patch","pre","build","lessRoot","sourceMapOutput","sourceMapBuilder","parseTree","SourceMapBuilder","ParseTree","toCSSOptions","sourceMap","file_1","getExternalSourceMap","files","rootFilename","SourceMapOutput","contentsIgnoredCharsMap","contentsMap","sourceMapFilename","sourceMapURL","outputFilename","sourceMapOutputFilename","sourceMapBasepath","sourceMapRootpath","outputSourceFiles","sourceMapGenerator","sourceMapFileInline","disableSourcemapAnnotation","sourceMapInputFilename","normalizeFilename","removeBasepath","getCSSAppendage","setExternalSourceMap","isInline","getSourceMapURL","getOutputFilename","getInputFilename","_css","_rootNode","_contentsMap","_contentsIgnoredCharsMap","_sourceMapFilename","_outputFilename","_sourceMapBasepath","_sourceMapRootpath","_outputSourceFiles","_sourceMapGeneratorConstructor","getSourceMapGenerator","_lineNumber","_column","sourceLines","columns","sourceColumns","inputSource","_sourceMapGenerator","addMapping","generated","source","file","sourceRoot","setSourceContent","sourceMapContent","stringify","toJSON","ImportManager","rootFileInfo","mime","queue","pluginLoader","fileParsedFunc","importedEqualsRoot","newFileInfo","loadedFile","promise","loadFileCallback","resolvedFilename","newEnv","syncImport","loadPluginSync","loadPlugin","loadFile","then","render","utils.copyOptions","self_1","Promise","resolve","reject","Render","context_1","pluginManager_1","reUsePluginManager","imports_1","evalResult","fileContent","parseVersion","initial","ctor","api","fileCache","doXHR","errback","xhr","XMLHttpRequest","async","isFileProtocol","fileAsync","handleResponse","status","responseText","getResponseHeader","overrideMimeType","open","setRequestHeader","send","onreadystatechange","readyState","supports","clearFileCache","location","useFileCache","lessText_1","webInfo","lastModified","Date","FM","log","fulfill","catch","ErrorReporting","rootHref","errorReporting","errors","errorline","classname","logLevel","errorConsole","timer","filenameNoPath","className","innerHTML","env","setInterval","replaceChild","clearInterval","errorHTML","remove","removeErrorHTML","depends","lint","insecure","protocol","poll","hostname","port","onReady","addDefaultOptions","LESS_PLUGINS","loggers","console","LogListener","cache","localStorage","setCSS","setItem","getCSS","getItem","timestamp","valueOf","Cache","imageSize","imageFunctions","image-size","image-width","image-height","ImageSize","typePattern","thisArg","curryArgs","loadStyles","instanceOptions","loadStyleSheet","reload","remaining","local","loadInitialFileCallback","loadStyleSheets","sheets","watch","watchMode","watchTimer","unwatch","registerStylesheetsImmediately","links","rel","registerStylesheets","record","refresh","startTime","endTime","totalMilliseconds","remainingSheets","refreshStyles","resolveOrReject","pageLoadFinished"],"mappings":";;;;;;;;;qOACM,SAAUA,EAAUC,GACtB,OAAOA,EAAKC,QAAQ,qBAAsB,IACrCA,QAAQ,qBAAsB,IAC9BA,QAAQ,MAAO,IACfA,QAAQ,eAAgB,IACxBA,QAAQ,YAAa,KACrBA,QAAQ,MAAO,KAGR,S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YpC,OAAAF,EAAMjB,KAAoB,mBAE3Dc,EAAkBgC,EAAO/B,SAAU6hB,EAAK3hB,GACxCsrC,EAAKvnC,OAAOzB,KAAK,kBAAWtC,EAAMjB,KAAI,kBAAAmB,OAAiB,IAAI+oD,KAAS2E,EAAO,OAMnD,MAHxBE,IAIID,EAAoB,IAAI5E,KAAS0E,EACjCriB,EAAKvnC,OAAOzB,KAAK,uCAAuCpC,OAAA2tD,EAAqB,OAC7ElH,EAAQ,CACJgH,UAASA,EACTC,QAAOA,EACPC,kBAAiBA,EACjBb,OAAQ1hB,EAAK0hB,OAAOhsD,UAG5B4sD,EAAU,IAAI3E,OACf0D,EAAQp3B,GAGfi3B,EAAWj3B,OAInB+V,EAAKyiB,cAAgBvB,EACdlhB,EHrQEjqB,CAAKxf,OAAQ3C,IAU1B,SAAS8uD,GAAgBn/C,GACjBA,EAAKlL,UACLynD,QAAQ/oD,KAAKwM,GAEZ3P,GAAQ2oD,OACT1mD,GAAKM,YAAY47C,WAZzBx7C,OAAOypC,KAAOA,GAgBVpsC,GAAQ8rD,UACJ,SAAS3sC,KAAKxc,OAAO+mD,SAASzkB,OAC9BmH,GAAK2hB,QAGJ/tD,GAAQ2oD,QACTlmC,GAAM,oCACNxgB,GAAOrB,SAASqB,MAAQrB,SAASsB,qBAAqB,QAAQ,IAC9Di8C,GAAQv9C,SAASW,cAAc,UAEzBsC,KAAO,WACTs6C,GAAMz8C,WACNy8C,GAAMz8C,WAAWc,QAAUigB,GAE3B07B,GAAMx8C,YAAYf,SAASgB,eAAe6gB,KAG9CxgB,GAAKN,YAAYw8C,KAErB/R,GAAK+hB,iCACL/hB,GAAK2iB,iBAAmB3iB,GAAKoiB,QAAqB,gBAAbpiB,GAAK4e,KAAuB5D,KAAK0H,GAAiBA"} \ No newline at end of file diff --git a/package.json b/package.json index b6b0c2a194..7798315960 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,12 @@ "scripts": { "publish": "node scripts/bump-and-publish.js", "publish:dry-run": "DRY_RUN=true node scripts/bump-and-publish.js", + "verify:alpha:packed-consumer": "node scripts/verify-alpha-packed-consumer.mjs", + "test:publish-dry-run": "node --test scripts/bump-and-publish.test.mjs", + "test:alpha": "pnpm --dir packages/less run test:alpha && pnpm run test:publish-dry-run && pnpm run verify:alpha:packed-consumer", "prepare": "husky", "changelog": "github-changes -o less -r less.js -a --only-pulls --use-commit-body -m \"(YYYY-MM-DD)\"", - "test": "cd packages/less && npm test", + "test": "pnpm run test:alpha", "test:node": "cd packages/less && npm run test:node", "test:release": "node scripts/test-release-automation.js", "postinstall": "npx only-allow pnpm" @@ -31,6 +34,7 @@ "github-changes": "^1.1.2", "husky": "~9.1.7", "npm-run-all": "^4.1.5", + "playwright": "1.50.1", "semver": "^6.3.1" }, "packageManager": "pnpm@10.34.5" diff --git a/packages/less/.eslintrc.js b/packages/less/.eslintrc.cjs similarity index 100% rename from packages/less/.eslintrc.js rename to packages/less/.eslintrc.cjs diff --git a/packages/less/.gitignore b/packages/less/.gitignore index 831c902ed3..6ae03361ca 100644 --- a/packages/less/.gitignore +++ b/packages/less/.gitignore @@ -1,9 +1,10 @@ # project-specific tmp -lib +dist test/browser/less.min.js test/browser/less.min.js.map test/sourcemaps/**/*.map test/sourcemaps/*.map test/sourcemaps/*.css -test/less-bom \ No newline at end of file +test/less-bom +lib/**/*.css.map \ No newline at end of file diff --git a/packages/less/COMPILER_BOUNDARY.md b/packages/less/COMPILER_BOUNDARY.md new file mode 100644 index 0000000000..0a765914d6 --- /dev/null +++ b/packages/less/COMPILER_BOUNDARY.md @@ -0,0 +1,23 @@ +# Compiler Boundary + +`packages/less` does not depend on the batteries-included `jess` package. + +The shared render engine lives in `@jesscss/compiler`. The Less package imports +that generic `Compiler`, supplies the Less parser plugin and Less compatibility +plugin through `compile.plugins`, and supplies resolver support with +`@jesscss/plugin-node-modules`. + +The boundary is: + +- `@jesscss/compiler`: generic config, parse, render, diagnostics, plugin + lifecycle, and result APIs for any stylesheet language plugin. +- `@jesscss/plugin-less`: Less parser/evaluator defaults and Less-specific + behavior. +- `@jesscss/plugin-less-compat`: Less compatibility functions and legacy plugin + bridge behavior. +- `less`: Less public API, `lessc`, option mapping, result/error mapping, and + the Less-only plugin stack. +- `jess`: batteries-included Jess product package and CLI. + +Release checks should prove `less` resolves `@jesscss/compiler` from the +registry package and does not install `jess` as a dependency. diff --git a/packages/less/Gruntfile.js b/packages/less/Gruntfile.js deleted file mode 100644 index d09c9abed0..0000000000 --- a/packages/less/Gruntfile.js +++ /dev/null @@ -1,413 +0,0 @@ -"use strict"; - -var resolve = require('resolve'); -var path = require('path'); - -var testFolder = path.relative(process.cwd(), path.dirname(resolve.sync('@less/test-data'))); -var lessFolder = testFolder; - -module.exports = function(grunt) { - grunt.option("stack", true); - - // Report the elapsed execution time of tasks. - require("time-grunt")(grunt); - - var git = require("git-rev"); - - // Sauce Labs browser - var browsers = [ - // Desktop browsers - { - browserName: "chrome", - version: "latest", - platform: "Windows 7" - }, - { - browserName: "firefox", - version: "latest", - platform: "Linux" - }, - { - browserName: "safari", - version: "9", - platform: "OS X 10.11" - }, - { - browserName: "internet explorer", - version: "8", - platform: "Windows XP" - }, - { - browserName: "internet explorer", - version: "11", - platform: "Windows 8.1" - }, - { - browserName: "edge", - version: "13", - platform: "Windows 10" - }, - // Mobile browsers - { - browserName: "ipad", - deviceName: "iPad Air Simulator", - deviceOrientation: "portrait", - version: "8.4", - platform: "OS X 10.9" - }, - { - browserName: "iphone", - deviceName: "iPhone 5 Simulator", - deviceOrientation: "portrait", - version: "9.3", - platform: "OS X 10.11" - }, - { - browserName: "android", - deviceName: "Google Nexus 7 HD Emulator", - deviceOrientation: "portrait", - version: "4.4", - platform: "Linux" - } - ]; - - var sauceJobs = {}; - - var browserTests = [ - "filemanager-plugin", - "visitor-plugin", - "global-vars", - "modify-vars", - "production", - "rootpath-relative", - "rootpath-rewrite-urls", - "rootpath", - "relative-urls", - "rewrite-urls", - "browser", - "no-js-errors" - ]; - - function makeJob(testName) { - sauceJobs[testName] = { - options: { - urls: - testName === "all" - ? browserTests.map(function(name) { - return ( - "http://localhost:8081/tmp/browser/test-runner-" + - name + - ".html" - ); - }) - : [ - "http://localhost:8081/tmp/browser/test-runner-" + - testName + - ".html" - ], - testname: - testName === "all" ? "Unit Tests for Less.js" : testName, - browsers: browsers, - public: "public", - recordVideo: false, - videoUploadOnPass: false, - recordScreenshots: process.env.TRAVIS_BRANCH !== "master", - build: - process.env.TRAVIS_BRANCH === "master" - ? process.env.TRAVIS_JOB_ID - : undefined, - tags: [ - process.env.TRAVIS_BUILD_NUMBER, - process.env.TRAVIS_PULL_REQUEST, - process.env.TRAVIS_BRANCH - ], - statusCheckAttempts: -1, - sauceConfig: { - "idle-timeout": 100 - }, - throttled: 5, - onTestComplete: function(result, callback) { - // Called after a unit test is done, per page, per browser - // 'result' param is the object returned by the test framework's reporter - // 'callback' is a Node.js style callback function. You must invoke it after you - // finish your work. - // Pass a non-null value as the callback's first parameter if you want to throw an - // exception. If your function is synchronous you can also throw exceptions - // directly. - // Passing true or false as the callback's second parameter passes or fails the - // test. Passing undefined does not alter the test result. Please note that this - // only affects the grunt task's result. You have to explicitly update the Sauce - // Labs job's status via its REST API, if you want so. - - // This should be the encrypted value in Travis - var user = process.env.SAUCE_USERNAME; - var pass = process.env.SAUCE_ACCESS_KEY; - - git.short(function(hash) { - require("phin")( - { - method: "PUT", - url: [ - "https://saucelabs.com/rest/v1", - user, - "jobs", - result.job_id - ].join("/"), - auth: { user: user, pass: pass }, - data: { - passed: result.passed, - build: "build-" + hash - } - }, - function(error, response) { - if (error) { - console.log(error); - callback(error); - } else if (response.statusCode !== 200) { - console.log(response); - callback( - new Error("Unexpected response status") - ); - } else { - callback(null, result.passed); - } - } - ); - }); - } - } - }; - } - - // Make the SauceLabs jobs - ["all"].concat(browserTests).map(makeJob); - - // Project configuration. - grunt.initConfig({ - shell: { - options: { - stdout: true, - failOnError: true, - execOptions: { - maxBuffer: Infinity - } - }, - build: { - command: [ - /** Browser runtime */ - "node build/rollup.js --dist", - /** Node.js runtime */ - "npm run build" - ].join(" && ") - }, - testbuild: { - command: [ - "npm run build", - "node build/rollup.js --browser --out=./tmp/browser/less.min.js" - ].join(" && ") - }, - testcjs: { - command: "npm run build" - }, - testbrowser: { - command: "node build/rollup.js --browser --out=./tmp/browser/less.min.js" - }, - test: { - command: 'npx ts-node test/test-es6.ts && node test/index.js' - }, - generatebrowser: { - command: 'node test/browser/generator/generate.js' - }, - runbrowser: { - command: 'node test/browser/generator/runner.js' - }, - benchmark: { - command: "node benchmark/index.js" - }, - opts: { - // test running with all current options (using `opts` since `options` means something already) - command: [ - // @TODO: make this more thorough - // CURRENT OPTIONS - `node bin/lessc --ie-compat ${lessFolder}/tests-unit/lazy-eval/lazy-eval.less tmp/lazy-eval.css`, - // --math - `node bin/lessc --math=always ${lessFolder}/tests-unit/lazy-eval/lazy-eval.less tmp/lazy-eval.css`, - `node bin/lessc --math=parens-division ${lessFolder}/tests-unit/lazy-eval/lazy-eval.less tmp/lazy-eval.css`, - `node bin/lessc --math=parens ${lessFolder}/tests-unit/lazy-eval/lazy-eval.less tmp/lazy-eval.css`, - `node bin/lessc --math=strict ${lessFolder}/tests-unit/lazy-eval/lazy-eval.less tmp/lazy-eval.css`, - `node bin/lessc --math=strict-legacy ${lessFolder}/tests-unit/lazy-eval/lazy-eval.less tmp/lazy-eval.css`, - - // DEPRECATED OPTIONS - // --strict-math - `node bin/lessc --strict-math=on ${lessFolder}/tests-unit/lazy-eval/lazy-eval.less tmp/lazy-eval.css` - ].join(" && ") - }, - plugin: { - command: [ - `node bin/lessc --clean-css="--s1 --advanced" ${lessFolder}/tests-unit/lazy-eval/lazy-eval.less tmp/lazy-eval.css`, - "cd lib", - `node ../bin/lessc --clean-css="--s1 --advanced" ../${lessFolder}/tests-unit/lazy-eval/lazy-eval.less ../tmp/lazy-eval.css`, - `node ../bin/lessc --source-map=lazy-eval.css.map --autoprefix ../${lessFolder}/tests-unit/lazy-eval/lazy-eval.less ../tmp/lazy-eval.css`, - "cd ..", - // Test multiple plugins - `node bin/lessc --plugin=clean-css="--s1 --advanced" --plugin=autoprefix="ie 11,Edge >= 13,Chrome >= 47,Firefox >= 45,iOS >= 9.2,Safari >= 9" ${lessFolder}/tests-unit/lazy-eval/lazy-eval.less tmp/lazy-eval.css` - ].join(" && ") - }, - "sourcemap-test": { - // quoted value doesn't seem to get picked up by time-grunt, or isn't output, at least; maybe just "sourcemap" is fine? - command: [ - `node bin/lessc --source-map=test/sourcemaps/maps/import-map.map ${lessFolder}/tests-unit/import/import.less test/sourcemaps/import.css`, - `node bin/lessc --source-map ${lessFolder}/tests-config/sourcemaps/basic.less test/sourcemaps/basic.css` - ].join(" && ") - } - }, - - eslint: { - target: [ - "test/**/*.js", - "src/less*/**/*.js", - "!test/less/errors/plugin/plugin-error.js" - ], - options: { - configFile: ".eslintrc.js", - fix: true - } - }, - - connect: { - server: { - options: { - port: 8081, - base: '../..' - } - } - }, - - "saucelabs-mocha": sauceJobs, - - // Clean the version of less built for the tests - clean: { - test: ["test/browser/less.js", "tmp", "test/less-bom"], - "sourcemap-test": [ - "test/sourcemaps/*.css", - "test/sourcemaps/*.map" - ], - sauce_log: ["sc_*.log"] - } - }); - - // Load these plugins to provide the necessary tasks - grunt.loadNpmTasks("grunt-saucelabs"); - - require("jit-grunt")(grunt); - - // by default, run tests - grunt.registerTask("default", ["test"]); - - // Release - grunt.registerTask("dist", [ - "shell:build" - ]); - - // Create the browser version of less.js - grunt.registerTask("browsertest-lessjs", [ - "shell:testbrowser" - ]); - - // Run all browser tests - grunt.registerTask("browsertest", [ - "browsertest-lessjs", - "connect", - "shell:runbrowser" - ]); - - // setup a web server to run the browser tests in a browser rather than phantom - grunt.registerTask("browsertest-server", [ - "browsertest-lessjs", - "shell:generatebrowser", - "connect::keepalive" - ]); - - var previous_force_state = grunt.option("force"); - - grunt.registerTask("force", function(set) { - if (set === "on") { - grunt.option("force", true); - } else if (set === "off") { - grunt.option("force", false); - } else if (set === "restore") { - grunt.option("force", previous_force_state); - } - }); - - grunt.registerTask("sauce", [ - "browsertest-lessjs", - "shell:generatebrowser", - "connect", - "sauce-after-setup" - ]); - - grunt.registerTask("sauce-after-setup", [ - "saucelabs-mocha:all", - "clean:sauce_log" - ]); - - var testTasks = [ - "clean", - "eslint", - "shell:testbuild", - "shell:test", - "shell:opts", - "shell:plugin", - "connect", - "shell:runbrowser" - ]; - - if ( - isNaN(Number(process.env.TRAVIS_PULL_REQUEST, 10)) && - (process.env.TRAVIS_BRANCH === "master") - ) { - testTasks.push("force:on"); - testTasks.push("sauce-after-setup"); - testTasks.push("force:off"); - } - - // Run all tests - grunt.registerTask("test", testTasks); - - // Node tests only (ESM + CJS) — used by prepublish/CI/publish workflows. - // Skips eslint, browser (connect/runbrowser) and SauceLabs steps. - grunt.registerTask("test:node", [ - "shell:build", - "shell:test", - "shell:testcjs", - "shell:opts", - "shell:plugin" - ]); - - // Run shell option tests (includes deprecated options) - grunt.registerTask("shell-options", ["shell:opts"]); - - // Run shell plugin test - grunt.registerTask("shell-plugin", ["shell:plugin"]); - - // Quickly build and run Node tests - grunt.registerTask("quicktest", [ - "shell:testcjs", - "shell:test" - ]); - - // generate a good test environment for testing sourcemaps - grunt.registerTask("sourcemap-test", [ - "clean:sourcemap-test", - "shell:build:lessc", - "shell:sourcemap-test", - "connect::keepalive" - ]); - - // Run benchmark - grunt.registerTask("benchmark", [ - "shell:testcjs", - "shell:benchmark" - ]); -}; diff --git a/packages/less/README.md b/packages/less/README.md index ca6684f462..c83eae3bcf 100644 --- a/packages/less/README.md +++ b/packages/less/README.md @@ -1,13 +1,92 @@ -# [Less.js](http://lesscss.org) +

    Less.js logo

    -> The **dynamic** stylesheet language. [http://lesscss.org](http://lesscss.org). +

    + Github Actions CI + Downloads + npm version +

    -This is the JavaScript, official, stable version of Less. +# Less.js +> The dynamic stylesheet language. [lesscss.org](http://lesscss.org) -## Getting Started +> [!IMPORTANT] +> This package README is for Less 5 alpha.1. Less 5 is a Jess-powered compiler +> preview for early testing and is not yet a drop-in replacement for Less 4.x. +> Alpha.1 focuses on Node.js `less.render()`, `less.renderFile()`, `lessc`, +> variables, arithmetic, mixins, sibling file imports, and nested-rule output. +> Source maps, browser compilation, legacy plugin host APIs, URL rewriting, and +> compressed-output parity are still work in progress. + +Less extends CSS with variables, mixins, functions, nesting, and more — then compiles to standard CSS. Write cleaner stylesheets with less code. + +```less +@primary: #4a90d9; + +.button { + color: @primary; + &:hover { + color: darken(@primary, 10%); + } +} +``` + +## Install + +```sh +npm install less@alpha +``` + +For a pinned first alpha: + +```sh +npm install less@5.0.0-alpha.1 +``` + +## Usage + +### Node.js + +Less 5 alpha.1 requires Node.js `^20.19.0 || >=22.12.0`. + +```js +import less from 'less'; + +const output = await less.render('.class { width: (1 + 1) }'); +console.log(output.css); +``` + +### Command Line -Add Less.js to your project: ```sh -npm install less +npx lessc styles.less styles.css ``` + +### Browser + +Less 5 alpha.1 does not include browser compilation support. A new browser +build mechanism will be introduced in a future alpha. + +## Why Less? + +- **Variables** — define reusable values once +- **Mixins** — reuse groups of declarations across rulesets +- **Nesting** — mirror HTML structure in your stylesheets +- **Functions** — transform colors, manipulate strings, do math +- **Imports** — split stylesheets into manageable pieces +- **Extend** — reduce output size by combining selectors + +## Documentation + +Full documentation, usage guides, and configuration options at **[lesscss.org](http://lesscss.org)**. + +## Contributing + +Less.js is open source. [Report bugs](https://github.com/less/less.js/issues), submit pull requests, or help improve the [documentation](https://github.com/less/less-docs). + +See [CONTRIBUTING.md](https://github.com/less/less.js/blob/master/CONTRIBUTING.md) for development setup. + +## License + +Copyright (c) 2009-2025 [Alexis Sellier](http://cloudhead.io) & The Core Less Team +Licensed under the [Apache License](https://github.com/less/less.js/blob/master/LICENSE). diff --git a/packages/less/benchmark/benchmark-color-stress.less b/packages/less/benchmark/benchmark-color-stress.less new file mode 100644 index 0000000000..62eb23ceb0 --- /dev/null +++ b/packages/less/benchmark/benchmark-color-stress.less @@ -0,0 +1,16 @@ +@base-hue: 210; + +.color-gen(@i) when (@i > 0) { + .color-@{i} { + color: hsl(@base-hue, percentage((@i / 20)), 50%); + background: lighten(hsl(@base-hue, 80%, 50%), @i * 2%); + border-color: darken(hsl(@base-hue, 80%, 50%), @i * 2%); + outline-color: spin(hsl(@base-hue, 80%, 50%), @i * 15); + text-shadow: 0 1px 0 fade(#000, @i * 5%); + box-shadow: 0 0 (@i * 1px) saturate(hsl(@base-hue, 50%, 50%), @i * 3%); + } + + .color-gen((@i - 1)); +} + +.color-gen(20); diff --git a/packages/less/benchmark/benchmark-import-reference-target.less b/packages/less/benchmark/benchmark-import-reference-target.less new file mode 100644 index 0000000000..d523f7f00a --- /dev/null +++ b/packages/less/benchmark/benchmark-import-reference-target.less @@ -0,0 +1,82 @@ +// Target for @import (reference) benchmarking +// These should NOT appear in output unless extended + +.ref-button { + display: inline-block; + padding: 8px 16px; + border: 1px solid #ccc; + border-radius: 4px; + cursor: pointer; + background: #f0f0f0; + color: #333; + text-decoration: none; + font-size: 14px; + line-height: 1.5; + text-align: center; + vertical-align: middle; + &:hover { + background: #e0e0e0; + border-color: #999; + } + &:active { + background: #d0d0d0; + } + &.primary { + background: #3498db; + color: #fff; + border-color: #2980b9; + &:hover { + background: #2980b9; + } + } + &.danger { + background: #e74c3c; + color: #fff; + border-color: #c0392b; + &:hover { + background: #c0392b; + } + } +} + +.ref-alert { + padding: 12px 20px; + border: 1px solid transparent; + border-radius: 4px; + margin-bottom: 16px; + &.success { + color: #155724; + background: #d4edda; + border-color: #c3e6cb; + } + &.warning { + color: #856404; + background: #fff3cd; + border-color: #ffeeba; + } + &.error { + color: #721c24; + background: #f8d7da; + border-color: #f5c6cb; + } +} + +.ref-grid-system { + .row { + display: flex; + flex-wrap: wrap; + margin: 0 -15px; + } + .col { + flex: 1; + padding: 0 15px; + } + .generate-cols(@n, @i: 1) when (@i =< @n) { + .col-@{i} { + flex: 0 0 percentage((@i / @n)); + max-width: percentage((@i / @n)); + } + .generate-cols(@n, (@i + 1)); + } + .generate-cols(12); +} diff --git a/packages/less/benchmark/benchmark-import-target.less b/packages/less/benchmark/benchmark-import-target.less new file mode 100644 index 0000000000..ab1556bd38 --- /dev/null +++ b/packages/less/benchmark/benchmark-import-target.less @@ -0,0 +1,43 @@ +// Shared mixins and variables for import benchmarking +@import-base-color: #3498db; +@import-accent: #e74c3c; +@import-spacing: 8px; + +.imported-mixin(@size: 14px, @weight: normal) { + font-size: @size; + font-weight: @weight; + line-height: @size * 1.5; +} + +.imported-box(@w: 100px, @h: 100px) { + width: @w; + height: @h; + background: @import-base-color; + border: 1px solid darken(@import-base-color, 15%); + margin: @import-spacing; +} + +.imported-flex(@dir: row, @justify: flex-start, @align: stretch) { + display: flex; + flex-direction: @dir; + justify-content: @justify; + align-items: @align; +} + +.imported-grid(@cols: 12, @gap: @import-spacing) { + display: grid; + grid-template-columns: repeat(@cols, 1fr); + gap: @gap; +} + +.imported-base { + color: @import-base-color; + padding: @import-spacing; + .imported-mixin(); +} + +.imported-card { + .imported-box(300px, auto); + padding: @import-spacing * 2; + border-radius: 4px; +} diff --git a/packages/less/benchmark/benchmark-runner.cjs b/packages/less/benchmark/benchmark-runner.cjs new file mode 100644 index 0000000000..f93dac8ea6 --- /dev/null +++ b/packages/less/benchmark/benchmark-runner.cjs @@ -0,0 +1,333 @@ +#!/usr/bin/env node +// Portable benchmark runner - dropped into each version's worktree +// Finds the Less compiler, compiles the given file N times, reports JSON results. +// +// Usage: +// node benchmark-runner.js [benchmark-file] [runs=30] [warmup=5] +// node benchmark-runner.js [benchmark-file] --runs=30 --warmup=5 --math=parens-division + +var fs = require('fs'); +var path = require('path'); +var url = require('url'); + +var args = process.argv.slice(2); +var extraOpts = {}; +var positionals = []; +var namedRuns; +var namedWarmup; + +function readValue(currentIndex) { + if (currentIndex + 1 >= args.length) { + return undefined; + } + return args[currentIndex + 1]; +} + +for (var ai = 0; ai < args.length; ai++) { + var arg = args[ai]; + if (arg === '--runs') { + var runsValue = readValue(ai); + if (runsValue !== undefined) { + namedRuns = parseInt(runsValue); + ai++; + } + continue; + } + if (arg.indexOf('--runs=') === 0) { + namedRuns = parseInt(arg.slice('--runs='.length)); + continue; + } + if (arg === '--warmup') { + var warmupValue = readValue(ai); + if (warmupValue !== undefined) { + namedWarmup = parseInt(warmupValue); + ai++; + } + continue; + } + if (arg.indexOf('--warmup=') === 0) { + namedWarmup = parseInt(arg.slice('--warmup='.length)); + continue; + } + var optMatch = arg.match(/^--([a-z-]+)=(.*)$/); + if (optMatch) { + extraOpts[optMatch[1]] = optMatch[2]; + continue; + } + if (arg.indexOf('--') === 0) { + var optionName = arg.slice(2); + var optionValue = readValue(ai); + if (optionValue !== undefined && optionValue.indexOf('--') !== 0) { + extraOpts[optionName] = optionValue; + ai++; + } else { + extraOpts[optionName] = true; + } + continue; + } + positionals.push(arg); +} + +var file = positionals[0] || 'benchmark/benchmark.less'; +var totalRuns = Number.isFinite(namedRuns) ? namedRuns : (parseInt(positionals[1]) || 30); +var warmupRuns = Number.isFinite(namedWarmup) ? namedWarmup : (parseInt(positionals[2]) || 5); + +// Find Less compiler - prefer local source entries, then fall back to package roots +var less; +var lessPath = ''; +var tryPaths = [ + { path: './lib/index.js', mode: 'import' }, + { path: './packages/less/lib/index.js', mode: 'import' }, + { path: './packages/less', mode: 'require' }, + { path: '.', mode: 'require' }, + { path: './lib/less-node', mode: 'require' }, + { path: 'less', mode: 'require' } +]; + +async function loadLessCompiler() { + for (var i = 0; i < tryPaths.length; i++) { + var entry = tryPaths[i]; + try { + var mod; + if (entry.mode === 'import') { + var resolvedPath = path.resolve(entry.path); + if (!fs.existsSync(resolvedPath)) { + continue; + } + mod = await import(url.pathToFileURL(resolvedPath).href); + } else { + mod = require(entry.path.startsWith('.') ? path.resolve(entry.path) : entry.path); + } + var candidate = mod && mod.default ? mod.default : mod; + if (candidate && (candidate.render || candidate.parse)) { + less = candidate; + lessPath = entry.path; + return true; + } + } catch (e) { + // try next + } + } + return false; +} + +// Determine version after the compiler is loaded +var version = 'unknown'; + +var filePath = path.resolve(file); +if (!fs.existsSync(filePath)) { + console.error('Usage: node benchmark-runner.js [file.less] [runs] [warmup]'); + console.error('Could not find benchmark file: ' + file); + process.exit(1); +} +var data = fs.readFileSync(filePath, 'utf8'); +var fileDir = path.dirname(filePath); + +function resolveImportCandidate(importPath, fromDir) { + var base = path.isAbsolute(importPath) ? importPath : path.resolve(fromDir, importPath); + var candidates = [ + base, + base + '.less' + ]; + var parsed = path.parse(base); + if (parsed.base.charAt(0) !== '_') { + candidates.push(path.join(parsed.dir, '_' + parsed.base)); + candidates.push(path.join(parsed.dir, '_' + parsed.base + '.less')); + } + for (var i = 0; i < candidates.length; i++) { + if (fs.existsSync(candidates[i])) { + return candidates[i]; + } + } + return null; +} + +function literalImports(source, fromDir) { + var imports = []; + var importStatementRe = /@import\b[^;]*;/g; + var literalImportRe = /^@import\s+(?:\([^)]*\)\s*)?(?:"([^"]+)"|'([^']+)')\s*;$/; + var match; + while ((match = importStatementRe.exec(source))) { + var literalMatch = literalImportRe.exec(match[0]); + if (!literalMatch) { + return null; + } + var importPath = literalMatch[1] || literalMatch[2]; + if (!importPath || /^[a-z]+:/i.test(importPath) || importPath.endsWith('.css')) { + return null; + } + var resolved = resolveImportCandidate(importPath, fromDir); + if (!resolved) { + return null; + } + imports.push(resolved); + } + return imports; +} + +function sourceGraphIsPluginFree(entryFile) { + var pending = [entryFile]; + var seen = Object.create(null); + while (pending.length) { + var current = pending.pop(); + if (seen[current]) { + continue; + } + seen[current] = true; + var source; + try { + source = fs.readFileSync(current, 'utf8'); + } catch (e) { + return false; + } + if (source.indexOf('@plugin') !== -1) { + return false; + } + var imports = literalImports(source, path.dirname(current)); + if (!imports) { + return false; + } + for (var i = 0; i < imports.length; i++) { + pending.push(imports[i]); + } + } + return true; +} + +var benchmarkSourceGraphIsPluginFree = sourceGraphIsPluginFree(filePath); + +// Use less.render() - stable across all versions +var renderTimes = []; +var parseTimes = []; +var completed = 0; +var errors = []; + +function hrNow() { + var hr = process.hrtime(); + return hr[0] * 1000 + hr[1] / 1e6; +} + +function runOnce(callback) { + var start = hrNow(); + var opts = { + filename: filePath, + paths: [fileDir] + }; + if (benchmarkSourceGraphIsPluginFree) { + opts.__jessSkipLessCompatWhenPluginFree = true; + } + // Forward extra options (e.g. --math=always) + for (var key in extraOpts) { opts[key] = extraOpts[key]; } + less.render(data, opts, function (err, output) { + var end = hrNow(); + if (err) { + errors.push({ run: completed, error: err.message || String(err) }); + callback(err); + return; + } + if (!output || typeof output.css !== 'string') { + var invalidOutputError = new Error('Render completed without a CSS result'); + errors.push({ run: completed, error: invalidOutputError.message }); + callback(invalidOutputError); + return; + } + renderTimes.push(end - start); + completed++; + callback(null); + }); +} + +function runAll(i) { + if (i >= totalRuns) { + reportResults(); + return; + } + runOnce(function (err) { + if (err && errors.length > 3) { + // Too many errors, bail + reportResults(); + return; + } + runAll(i + 1); + }); +} + +function analyze(times, skipWarmup) { + var start = skipWarmup ? warmupRuns : 0; + if (times.length <= start) return null; + var effective = times.slice(start); + var total = 0, min = Infinity, max = 0; + for (var i = 0; i < effective.length; i++) { + total += effective[i]; + min = Math.min(min, effective[i]); + max = Math.max(max, effective[i]); + } + var avg = total / effective.length; + + // Median + var sorted = effective.slice().sort(function (a, b) { return a - b; }); + var mid = Math.floor(sorted.length / 2); + var median = sorted.length % 2 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2; + + // Standard deviation and coefficient of variation + var sumSqDiff = 0; + for (var i = 0; i < effective.length; i++) { + sumSqDiff += (effective[i] - avg) * (effective[i] - avg); + } + var stddev = Math.sqrt(sumSqDiff / effective.length); + var variancePct = avg === 0 ? 0 : (stddev / avg) * 100; + + return { + min: Math.round(min * 100) / 100, + max: Math.round(max * 100) / 100, + avg: Math.round(avg * 100) / 100, + median: Math.round(median * 100) / 100, + stddev: Math.round(stddev * 100) / 100, + variance_pct: Math.round(variancePct * 100) / 100, + samples: effective.length, + throughput_kbs: Math.round(1000 / avg * data.length / 1024) + }; +} + +function reportResults() { + var result = { + version: version, + lessPath: lessPath, + file: path.basename(file), + fileSize: data.length, + fileSizeKB: Math.round(data.length / 1024 * 10) / 10, + totalRuns: totalRuns, + warmupRuns: warmupRuns, + completedRuns: completed, + errors: errors.length > 0 ? errors : undefined, + render: analyze(renderTimes, true) + }; + console.log(JSON.stringify(result)); +} + +async function main() { + var loaded = await loadLessCompiler(); + if (!loaded) { + console.error(JSON.stringify({ + error: 'Could not find Less compiler', + tried: tryPaths.map(function (entry) { return entry.path; }) + })); + process.exit(2); + } + + // Determine version + if (less.version) { + if (Array.isArray(less.version)) { + version = less.version.join('.'); + } else { + version = String(less.version); + } + } + + runAll(0); +} + +main().catch(function (error) { + console.error(error && error.stack ? error.stack : error); + process.exit(1); +}); diff --git a/packages/less/benchmark/benchmark-runner.js b/packages/less/benchmark/benchmark-runner.js new file mode 100644 index 0000000000..920a1b96a5 --- /dev/null +++ b/packages/less/benchmark/benchmark-runner.js @@ -0,0 +1,233 @@ +#!/usr/bin/env node +// Portable benchmark runner - dropped into each version's worktree +// Finds the Less compiler, compiles the given file N times, reports JSON results. +// +// Usage: +// node benchmark-runner.js [benchmark-file] [runs=30] [warmup=5] +// node benchmark-runner.js [benchmark-file] --runs=30 --warmup=5 --math=parens-division + +var fs = require('fs'); +var path = require('path'); + +var args = process.argv.slice(2); +var extraOpts = {}; +var positionals = []; +var namedRuns; +var namedWarmup; + +function readValue(currentIndex) { + if (currentIndex + 1 >= args.length) { + return undefined; + } + return args[currentIndex + 1]; +} + +for (var ai = 0; ai < args.length; ai++) { + var arg = args[ai]; + if (arg === '--runs') { + var runsValue = readValue(ai); + if (runsValue !== undefined) { + namedRuns = parseInt(runsValue); + ai++; + } + continue; + } + if (arg.indexOf('--runs=') === 0) { + namedRuns = parseInt(arg.slice('--runs='.length)); + continue; + } + if (arg === '--warmup') { + var warmupValue = readValue(ai); + if (warmupValue !== undefined) { + namedWarmup = parseInt(warmupValue); + ai++; + } + continue; + } + if (arg.indexOf('--warmup=') === 0) { + namedWarmup = parseInt(arg.slice('--warmup='.length)); + continue; + } + var optMatch = arg.match(/^--([a-z-]+)=(.*)$/); + if (optMatch) { + extraOpts[optMatch[1]] = optMatch[2]; + continue; + } + if (arg.indexOf('--') === 0) { + var optionName = arg.slice(2); + var optionValue = readValue(ai); + if (optionValue !== undefined && optionValue.indexOf('--') !== 0) { + extraOpts[optionName] = optionValue; + ai++; + } else { + extraOpts[optionName] = true; + } + continue; + } + positionals.push(arg); +} + +var file = positionals[0] || 'benchmark/benchmark.less'; +var totalRuns = Number.isFinite(namedRuns) ? namedRuns : (parseInt(positionals[1]) || 30); +var warmupRuns = Number.isFinite(namedWarmup) ? namedWarmup : (parseInt(positionals[2]) || 5); + +// Find Less compiler - try multiple paths for different version eras +var less; +var lessPath = ''; +var tryPaths = [ + // v4.x monorepo (after build) + './packages/less', + // v3.x / v2.x (lib in repo) + '.', + './lib/less-node', + // Fallback + 'less' +]; + +for (var i = 0; i < tryPaths.length; i++) { + try { + var p = tryPaths[i]; + // Use path.resolve for relative paths, but keep bare package names for Node resolution + var mod = require(p.startsWith('.') ? path.resolve(p) : p); + // Handle both direct export and .default (ESM interop) + less = mod && mod.default ? mod.default : mod; + if (less && (less.render || less.parse)) { + lessPath = p; + break; + } + less = null; + } catch (e) { + // try next + } +} + +if (!less) { + console.error(JSON.stringify({ error: 'Could not find Less compiler', tried: tryPaths })); + process.exit(2); +} + +// Determine version +var version = 'unknown'; +if (less.version) { + if (Array.isArray(less.version)) { + version = less.version.join('.'); + } else { + version = String(less.version); + } +} + +var filePath = path.resolve(file); +if (!fs.existsSync(filePath)) { + console.error('Usage: node benchmark-runner.js [file.less] [runs] [warmup]'); + console.error('Could not find benchmark file: ' + file); + process.exit(1); +} +var data = fs.readFileSync(filePath, 'utf8'); +var fileDir = path.dirname(filePath); + +// Use less.render() - stable across all versions +var renderTimes = []; +var completed = 0; +var errors = []; + +function hrNow() { + var hr = process.hrtime(); + return hr[0] * 1000 + hr[1] / 1e6; +} + +function runOnce(callback) { + var start = hrNow(); + var opts = { + filename: filePath, + paths: [fileDir] + }; + // Forward extra options (e.g. --math=always) + for (var key in extraOpts) { opts[key] = extraOpts[key]; } + less.render(data, opts, function (err, output) { + var end = hrNow(); + if (err) { + errors.push({ run: completed, error: err.message || String(err) }); + callback(err); + return; + } + if (!output || typeof output.css !== 'string') { + var invalidOutputError = new Error('Render completed without a CSS result'); + errors.push({ run: completed, error: invalidOutputError.message }); + callback(invalidOutputError); + return; + } + renderTimes.push(end - start); + completed++; + callback(null); + }); +} + +function runAll(i) { + if (i >= totalRuns) { + reportResults(); + return; + } + runOnce(function (err) { + if (err && errors.length > 3) { + // Too many errors, bail + reportResults(); + return; + } + runAll(i + 1); + }); +} + +function analyze(times, skipWarmup) { + var start = skipWarmup ? warmupRuns : 0; + if (times.length <= start) return null; + var effective = times.slice(start); + var total = 0, min = Infinity, max = 0; + for (var i = 0; i < effective.length; i++) { + total += effective[i]; + min = Math.min(min, effective[i]); + max = Math.max(max, effective[i]); + } + var avg = total / effective.length; + + // Median + var sorted = effective.slice().sort(function (a, b) { return a - b; }); + var mid = Math.floor(sorted.length / 2); + var median = sorted.length % 2 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2; + + // Standard deviation and coefficient of variation + var sumSqDiff = 0; + for (var j = 0; j < effective.length; j++) { + sumSqDiff += (effective[j] - avg) * (effective[j] - avg); + } + var stddev = Math.sqrt(sumSqDiff / effective.length); + var variancePct = avg === 0 ? 0 : (stddev / avg) * 100; + + return { + min: Math.round(min * 100) / 100, + max: Math.round(max * 100) / 100, + avg: Math.round(avg * 100) / 100, + median: Math.round(median * 100) / 100, + stddev: Math.round(stddev * 100) / 100, + variance_pct: Math.round(variancePct * 100) / 100, + samples: effective.length, + throughput_kbs: Math.round(1000 / avg * data.length / 1024) + }; +} + +function reportResults() { + var result = { + version: version, + lessPath: lessPath, + file: path.basename(file), + fileSize: data.length, + fileSizeKB: Math.round(data.length / 1024 * 10) / 10, + totalRuns: totalRuns, + warmupRuns: warmupRuns, + completedRuns: completed, + errors: errors.length > 0 ? errors : undefined, + render: analyze(renderTimes, true) + }; + console.log(JSON.stringify(result)); +} + +runAll(0); diff --git a/packages/less/benchmark/benchmark-v3.less b/packages/less/benchmark/benchmark-v3.less new file mode 100644 index 0000000000..c9ee33a63b --- /dev/null +++ b/packages/less/benchmark/benchmark-v3.less @@ -0,0 +1,134 @@ +// Benchmark for Less v3.0+ features: if(), boolean(), $prop accessor, @plugin +// This file is standalone and does NOT import the base benchmark. + +// --- if() function --- +@mode: dark; +@size: large; + +.if-card { + background: if((@mode = dark), #1a1a2e, #ffffff); + color: if((@mode = dark), #eaeaea, #333333); + font-size: if((@size = large), 18px, 14px); + padding: if((@size = large), 24px, 12px); + border: 1px solid if((@mode = dark), #444, #ddd); +} + +// if() in loops +.gen-if-variants(@n, @i: 1) when (@i =< @n) { + .variant-@{i} { + color: if((@i > 5), #ff0000, #0000ff); + font-weight: if((mod(@i, 2) = 0), bold, normal); + opacity: if((@i > 8), 0.5, 1); + display: if((@i = @n), none, block); + } + .gen-if-variants(@n, (@i + 1)); +} +.gen-if-variants(12); + +// --- boolean() function (added v3.6.0) --- +@is-dark: boolean(@mode = dark); +@is-large: boolean(@size = large); +@is-rtl: boolean(1 = 0); + +.boolean-test { + .responsive(@flag) when (@flag) { + max-width: 1200px; + margin: 0 auto; + } + .responsive(@flag) when not (@flag) { + width: 100%; + } + .responsive(@is-large); +} + +// --- Property accessor $prop --- +.color-definitions { + primary: #3498db; + secondary: #2ecc71; + accent: #e74c3c; + neutral: #95a5a6; + warning: #f39c12; +} + +.prop-button { + color: .color-definitions[primary]; + border-color: .color-definitions[secondary]; +} + +.prop-alert-success { + background: .color-definitions[secondary]; + border-color: darken(.color-definitions[secondary], 10%); +} + +.prop-alert-danger { + background: .color-definitions[accent]; + border-color: darken(.color-definitions[accent], 10%); +} + +.prop-alert-warning { + background: .color-definitions[warning]; + border-color: darken(.color-definitions[warning], 10%); +} + +// Spacing scale via property accessor +.spacing-scale { + xs: 4px; + sm: 8px; + md: 16px; + lg: 24px; + xl: 32px; + xxl: 48px; +} + +.card-compact { + padding: .spacing-scale[sm]; + margin: .spacing-scale[xs]; +} +.card-normal { + padding: .spacing-scale[md]; + margin: .spacing-scale[sm]; +} +.card-spacious { + padding: .spacing-scale[xl]; + margin: .spacing-scale[lg]; +} + +// --- Complex guard + if combos --- +.button-variant(@bg, @border: darken(@bg, 10%), @color: #fff) { + background: @bg; + border-color: @border; + color: if((lightness(@bg) > 60%), #333, @color); + &:hover { + background: darken(@bg, 8%); + border-color: darken(@border, 12%); + } + &:active { + background: darken(@bg, 12%); + } +} + +.btn-primary { .button-variant(#3498db); } +.btn-success { .button-variant(#2ecc71); } +.btn-warning { .button-variant(#f1c40f); } +.btn-danger { .button-variant(#e74c3c); } +.btn-light { .button-variant(#f8f9fa); } +.btn-dark { .button-variant(#343a40); } + +// --- Stress: many property lookups in a loop --- +.z-index-scale { + dropdown: 1000; + sticky: 1020; + fixed: 1030; + modal-backdrop: 1040; + modal: 1050; + popover: 1060; + tooltip: 1070; +} + +.dropdown { z-index: .z-index-scale[dropdown]; } +.sticky-top { z-index: .z-index-scale[sticky]; } +.fixed-top { z-index: .z-index-scale[fixed]; } +.modal-backdrop { z-index: .z-index-scale[modal-backdrop]; } +.modal { z-index: .z-index-scale[modal]; } +.popover { z-index: .z-index-scale[popover]; } +.tooltip { z-index: .z-index-scale[tooltip]; } diff --git a/packages/less/benchmark/benchmark-v37.less b/packages/less/benchmark/benchmark-v37.less new file mode 100644 index 0000000000..09f3eb6e5a --- /dev/null +++ b/packages/less/benchmark/benchmark-v37.less @@ -0,0 +1,108 @@ +// Benchmark for Less v3.7+ features: each() +// Standalone file. + +// --- each() with lists --- +@breakpoints: xs, sm, md, lg, xl; + +each(@breakpoints, { + .container-@{value} { + max-width: if((@value = xs), 100%, if((@value = sm), 540px, if((@value = md), 720px, if((@value = lg), 960px, 1140px)))); + margin: 0 auto; + padding: 0 15px; + } +}); + +// --- each() with maps --- +@colors: { + primary: #3498db; + secondary: #2ecc71; + success: #27ae60; + danger: #e74c3c; + warning: #f39c12; + info: #17a2b8; + light: #f8f9fa; + dark: #343a40; +}; + +each(@colors, { + .text-@{key} { color: @value; } + .bg-@{key} { background-color: @value; } + .border-@{key} { border-color: @value; } + .btn-@{key} { + background: @value; + border: 1px solid darken(@value, 10%); + color: if((lightness(@value) > 60%), #333, #fff); + &:hover { + background: darken(@value, 8%); + } + } +}); + +// --- each() generating utility classes --- +@spacings: { + s0: 0; + s1: 4px; + s2: 8px; + s3: 16px; + s4: 24px; + s5: 32px; +}; + +@directions: top, right, bottom, left; + +each(@spacings, .(@size, @key) { + each(@directions, .(@dir) { + .m@{dir}-@{key} { + margin-@{dir}: @size; + } + .p@{dir}-@{key} { + padding-@{dir}: @size; + } + }); +}); + +// --- each() with display properties --- +@displays: block, inline, inline-block, flex, inline-flex, grid, none; + +each(@displays, { + .d-@{value} { display: @value; } +}); + +// --- each() generating component sizes --- +@sm-font: 12px; @sm-pad: 4px 8px; @sm-radius: 2px; +@md-font: 14px; @md-pad: 8px 16px; @md-radius: 4px; +@lg-font: 18px; @lg-pad: 12px 24px; @lg-radius: 6px; +@component-size-names: sm, md, lg; + +each(@component-size-names, { + .input-@{value} { + border: 1px solid #ccc; + line-height: 1.5; + } + .badge-@{value} { + display: inline-block; + } +}); + +// --- each() with float utilities --- +@positions: static, relative, absolute, fixed, sticky; +each(@positions, { + .position-@{value} { position: @value; } +}); + +// --- Nested each() stress --- +@font-weights: 100, 200, 300, 400, 500, 600, 700, 800, 900; +each(@font-weights, { + .fw-@{value} { font-weight: @value; } +}); + +@opacities: { + o0: 0; + o25: 0.25; + o50: 0.5; + o75: 0.75; + o100: 1; +}; +each(@opacities, .(@val, @key) { + .opacity-@{key} { opacity: @val; } +}); diff --git a/packages/less/benchmark/benchmark-v39.less b/packages/less/benchmark/benchmark-v39.less new file mode 100644 index 0000000000..82796a3499 --- /dev/null +++ b/packages/less/benchmark/benchmark-v39.less @@ -0,0 +1,84 @@ +// Benchmark for Less v3.9+ features: range() +// Standalone file. + +// --- range() basic --- +@columns: range(1, 12); + +each(@columns, { + .col-@{value} { + flex: 0 0 percentage((@value / 12)); + max-width: percentage((@value / 12)); + } +}); + +// --- range() for spacing scale --- +@spacing-steps: range(0, 20); + +each(@spacing-steps, { + .gap-@{value} { + gap: (@value * 4px); + } + .space-x-@{value} > * + * { + margin-left: (@value * 4px); + } + .space-y-@{value} > * + * { + margin-top: (@value * 4px); + } +}); + +// --- range() with step for font sizes --- +@font-sizes: range(10px, 48px, 2); + +each(@font-sizes, .(@size, @idx) { + .text-size-@{idx} { + font-size: @size; + line-height: @size * 1.5; + } +}); + +// --- range() for generating a color palette --- +@hue-steps: range(0, 350, 30); + +each(@hue-steps, .(@hue, @idx) { + .hue-@{idx} { + color: hsl(@hue, 70%, 50%); + background: hsl(@hue, 70%, 95%); + border-color: hsl(@hue, 70%, 80%); + } +}); + +// --- range() for grid system --- +@grid-cols: range(1, 24); + +each(@grid-cols, { + .grid-span-@{value} { + grid-column: span @value; + } +}); + +// --- range() for z-index layers --- +@layers: range(1, 10); + +each(@layers, { + .z-@{value} { + z-index: @value * 100; + } +}); + +// --- range() for opacity scale --- +@opacity-steps: range(0, 100, 5); + +each(@opacity-steps, .(@val) { + .o-@{val} { + opacity: (@val / 100); + } +}); + +// --- range() for border-radius scale --- +@radius-steps: range(0, 24, 2); + +each(@radius-steps, .(@val) { + .rounded-@{val} { + border-radius: (@val * 1px); + } +}); diff --git a/packages/less/benchmark/benchmark.less b/packages/less/benchmark/benchmark.less index 9977205789..3473fb5c80 100644 --- a/packages/less/benchmark/benchmark.less +++ b/packages/less/benchmark/benchmark.less @@ -2061,11 +2061,11 @@ div.panel { color: rgb(200, 200, 200); } -#808080 { +#c808080 { color: hsl(50, 0%, 50%); } -#00ff00 { +#c00ff00 { color: hsl(120, 100%, 50%); } /******************\ @@ -2145,11 +2145,11 @@ p:not([class*="lead"]) { color: black; } -input[type="text"].class#id[attr=32]:not(1) { +input[type="text"].class#id[attr="32"]:not(.x) { color: white; } -div#id.class[a=1][b=2].class:not(1) { +div#id.class[a="1"][b="2"].class:not(.x) { color: white; } @@ -2211,11 +2211,11 @@ div#id { } @media print { - font-size: 3em; + body { font-size: 3em; } } @media screen { - font-size: 10px; + body { font-size: 10px; } } @font-face { @@ -2260,7 +2260,7 @@ p + h1 { background-color: #009998; background-image: url(images/image.jpg); background: -webkit-gradient(linear, left top, left bottom, from(red), to(blue)); - margin: ; + margin: 0; } #important { @@ -2552,8 +2552,8 @@ body { } #operations { color: #110000 + #000011 + #001100; // #111111 - height: (10px / 2px) + 6px - 1px * 2; // 9px - width: 2 * 4 - 5em; // 3em + height: (10px / 2px)+6px-1px*2; // 9px + width: 2 * 4-5em; // 3em .spacing { height: (10px / 2px)+6px-1px*2; width: 2 * 4-5em; @@ -2825,11 +2825,11 @@ td, input { color: rgb(200, 200, 200); } -#808080 { +#c808080 { color: hsl(50, 0%, 50%); } -#00ff00 { +#c00ff00 { color: hsl(120, 100%, 50%); } /******************\ @@ -2909,11 +2909,11 @@ p:not([class*="lead"]) { color: black; } -input[type="text"].class#id[attr=32]:not(1) { +input[type="text"].class#id[attr="32"]:not(.x) { color: white; } -div#id.class[a=1][b=2].class:not(1) { +div#id.class[a="1"][b="2"].class:not(.x) { color: white; } @@ -2975,11 +2975,11 @@ div#id { } @media print { - font-size: 3em; + body { font-size: 3em; } } @media screen { - font-size: 10px; + body { font-size: 10px; } } @font-face { @@ -3024,7 +3024,7 @@ p + h1 { background-color: #009998; background-image: url(images/image.jpg); background: -webkit-gradient(linear, left top, left bottom, from(red), to(blue)); - margin: ; + margin: 0; } #important { @@ -3316,8 +3316,8 @@ body { } #operations { color: #110000 + #000011 + #001100; // #111111 - height: (10px / 2px) + 6px - 1px * 2; // 9px - width: 2 * 4 - 5em; // 3em + height: (10px / 2px)+6px-1px*2; // 9px + width: 2 * 4-5em; // 3em .spacing { height: (10px / 2px)+6px-1px*2; width: 2 * 4-5em; @@ -3589,11 +3589,11 @@ td, input { color: rgb(200, 200, 200); } -#808080 { +#c808080 { color: hsl(50, 0%, 50%); } -#00ff00 { +#c00ff00 { color: hsl(120, 100%, 50%); } /******************\ @@ -3673,11 +3673,11 @@ p:not([class*="lead"]) { color: black; } -input[type="text"].class#id[attr=32]:not(1) { +input[type="text"].class#id[attr="32"]:not(.x) { color: white; } -div#id.class[a=1][b=2].class:not(1) { +div#id.class[a="1"][b="2"].class:not(.x) { color: white; } @@ -3739,11 +3739,11 @@ div#id { } @media print { - font-size: 3em; + body { font-size: 3em; } } @media screen { - font-size: 10px; + body { font-size: 10px; } } @font-face { @@ -3788,7 +3788,7 @@ p + h1 { background-color: #009998; background-image: url(images/image.jpg); background: -webkit-gradient(linear, left top, left bottom, from(red), to(blue)); - margin: ; + margin: 0; } #important { @@ -3978,5 +3978,470 @@ body { left: 1; } -// add extend -.btn:extend(.button all) {} \ No newline at end of file +// ============================================================================ +// v2.0+ Features: Extend, Guards, Imports, Property Merging, Detached Rulesets +// ============================================================================ + +// --- Imports --- +@import "benchmark-import-target.less"; +@import (reference) "benchmark-import-reference-target.less"; + +// --- Extend --- +// Basic extend +.base-button { + display: inline-block; + padding: 8px 16px; + border: 1px solid #ccc; + border-radius: 4px; + cursor: pointer; + font-size: 14px; + text-align: center; +} + +.action-button:extend(.base-button) { + background: #3498db; + color: #fff; +} + +.cancel-button:extend(.base-button) { + background: #e74c3c; + color: #fff; +} + +// Extend all +.nav-base { + list-style: none; + padding: 0; + margin: 0; + li { + display: inline-block; + a { + text-decoration: none; + padding: 8px 12px; + color: #333; + } + } +} + +.main-nav:extend(.nav-base all) { + background: #f8f9fa; + border-bottom: 1px solid #dee2e6; +} + +.side-nav:extend(.nav-base all) { + background: #343a40; + li a { + color: #fff; + } +} + +// Extend from imported reference +.my-button:extend(.ref-button) {} +.my-primary-button:extend(.ref-button all) {} +.my-alert:extend(.ref-alert all) {} +.my-grid:extend(.ref-grid-system all) {} + +// Nested extend +.panel { + border: 1px solid #ddd; + border-radius: 4px; + .panel-heading { + padding: 10px 15px; + background: #f5f5f5; + border-bottom: 1px solid #ddd; + } + .panel-body { + padding: 15px; + } + .panel-footer { + padding: 10px 15px; + background: #f5f5f5; + border-top: 1px solid #ddd; + } +} + +.card { + &:extend(.panel all); + box-shadow: 0 2px 4px rgba(0,0,0,0.1); +} + +.widget { + &:extend(.panel all); + margin-bottom: 20px; +} + +// Extend with pseudo-classes +.link-base { + color: #3498db; + text-decoration: none; + &:hover { + color: #2980b9; + text-decoration: underline; + } + &:visited { + color: #8e44ad; + } + &:active { + color: #e74c3c; + } +} + +.nav-link:extend(.link-base all) { + font-weight: bold; +} + +// --- Guards --- +.generate-spacing(@n, @i: 1) when (@i =< @n) { + .m-@{i} { margin: (@i * 4px); } + .p-@{i} { padding: (@i * 4px); } + .mt-@{i} { margin-top: (@i * 4px); } + .mb-@{i} { margin-bottom: (@i * 4px); } + .ml-@{i} { margin-left: (@i * 4px); } + .mr-@{i} { margin-right: (@i * 4px); } + .pt-@{i} { padding-top: (@i * 4px); } + .pb-@{i} { padding-bottom: (@i * 4px); } + .pl-@{i} { padding-left: (@i * 4px); } + .pr-@{i} { padding-right: (@i * 4px); } + .generate-spacing(@n, (@i + 1)); +} +.generate-spacing(10); + +.generate-font-sizes(@n, @i: 1) when (@i =< @n) { + .fs-@{i} { font-size: (10px + @i * 2); } + .generate-font-sizes(@n, (@i + 1)); +} +.generate-font-sizes(12); + +.generate-widths(@n, @i: 1) when (@i =< @n) { + .w-@{i} { width: percentage((@i / @n)); } + .generate-widths(@n, (@i + 1)); +} +.generate-widths(12); + +// Guards with multiple conditions +.responsive-mixin(@size) when (@size < 576px) { + font-size: 12px; + padding: 4px; +} +.responsive-mixin(@size) when (@size >= 576px) and (@size < 768px) { + font-size: 14px; + padding: 8px; +} +.responsive-mixin(@size) when (@size >= 768px) and (@size < 992px) { + font-size: 16px; + padding: 12px; +} +.responsive-mixin(@size) when (@size >= 992px) { + font-size: 18px; + padding: 16px; +} + +.sm { .responsive-mixin(400px); } +.md { .responsive-mixin(700px); } +.lg { .responsive-mixin(800px); } +.xl { .responsive-mixin(1200px); } + +// Type-checking guards +.type-guard(@val) when (isnumber(@val)) { + width: @val; +} +.type-guard(@val) when (iscolor(@val)) { + color: @val; +} +.type-guard(@val) when (isstring(@val)) { + content: @val; +} + +.guard-number { .type-guard(100px); } +.guard-color { .type-guard(#ff0000); } +.guard-string { .type-guard("hello"); } + +// --- Property Merging --- +.shadow-base { + box-shadow+: 0 1px 3px rgba(0,0,0,0.12); +} +.shadow-elevated { + .shadow-base(); + box-shadow+: 0 4px 6px rgba(0,0,0,0.1); +} +.shadow-floating { + .shadow-elevated(); + box-shadow+: 0 10px 20px rgba(0,0,0,0.15); +} + +.transform-base { + transform+_: translateX(10px); +} +.transform-combo { + .transform-base(); + transform+_: rotate(45deg); + transform+_: scale(1.2); +} + +.transition-multi { + transition+: color 0.3s ease; + transition+: background 0.3s ease; + transition+: border-color 0.3s ease; + transition+: box-shadow 0.3s ease; +} + +.font-stack { + font-family+: "Helvetica Neue"; + font-family+: Arial; + font-family+: sans-serif; +} + +// --- Detached Rulesets --- +@media-mobile: { + font-size: 14px; + padding: 8px; + margin: 4px; +}; + +@media-desktop: { + font-size: 16px; + padding: 16px; + margin: 8px; +}; + +@theme-light: { + background: #ffffff; + color: #333333; + border-color: #dddddd; +}; + +@theme-dark: { + background: #1a1a2e; + color: #eaeaea; + border-color: #444444; +}; + +.mobile-component { + @media-mobile(); + border: 1px solid #ccc; +} + +.desktop-component { + @media-desktop(); + border: 1px solid #999; +} + +.light-section { + @theme-light(); + .heading { font-weight: bold; } +} + +.dark-section { + @theme-dark(); + .heading { font-weight: bold; } +} + +// Detached rulesets passed as arguments +.apply-theme(@theme) { + @theme(); + padding: 20px; + border-radius: 8px; +} + +.themed-card-light { + .apply-theme(@theme-light); +} +.themed-card-dark { + .apply-theme(@theme-dark); +} + +// --- Complex Nesting & Selectors --- +.component { + display: block; + & + & { margin-top: 16px; } + & > &-inner { padding: 8px; } + &&-active { background: #e8f4fd; } + &-header, &-footer { padding: 12px; } + &-body { + padding: 16px; + &--large { padding: 24px; } + &--compact { padding: 8px; } + } +} + +// --- Color Functions Stress --- +@base-hue: 210; +.color-gen(@i) when (@i > 0) { + .color-@{i} { + color: hsl(@base-hue, percentage((@i / 20)), 50%); + background: lighten(hsl(@base-hue, 80%, 50%), @i * 2%); + border-color: darken(hsl(@base-hue, 80%, 50%), @i * 2%); + outline-color: spin(hsl(@base-hue, 80%, 50%), @i * 15); + text-shadow: 0 1px 0 fade(#000, @i * 5%); + box-shadow: 0 0 (@i * 1px) saturate(hsl(@base-hue, 50%, 50%), @i * 3%); + } + .color-gen((@i - 1)); +} +.color-gen(20); + +// --- String Interpolation & Escaping --- +@base-url: "/assets/images"; +@icon-prefix: "icon"; +.generate-icons(@n, @i: 1) when (@i =< @n) { + .@{icon-prefix}-@{i} { + background-image: url("@{base-url}/@{icon-prefix}-@{i}.svg"); + width: (16px + @i * 2); + height: (16px + @i * 2); + } + .generate-icons(@n, (@i + 1)); +} +.generate-icons(20); + +// --- Namespaces --- +#util { + .clearfix() { + &::after { + content: ""; + display: table; + clear: both; + } + } + .ellipsis() { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .visually-hidden() { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + border: 0; + } + .center-block() { + display: block; + margin-left: auto; + margin-right: auto; + } +} + +.container { #util > .clearfix(); } +.title { #util > .ellipsis(); } +.sr-only { #util > .visually-hidden(); } +.image { #util > .center-block(); } + +// --- Math & Unit Functions --- +.math-stress { + a: ceil(4.3px); + b: floor(4.7px); + c: round(4.567px, 2); + d: percentage(0.5); + e: sqrt(25px); + f: abs(-18px); + g: min(3px, 42px, 1px, 16px); + h: max(3px, 42px, 1px, 16px); + i: mod(11px, 3); + j: convert(1s, ms); + k: unit(5em, px); + l: unit(100px); +} + +// --- Large Loop Stress (recursive mixin) --- +.gen-grid(@cols, @i: 1) when (@i =< @cols) { + .grid-col-@{i}-of-@{cols} { + width: percentage((@i / @cols)); + float: left; + padding: 0 15px; + box-sizing: border-box; + } + .grid-push-@{i}-of-@{cols} { + margin-left: percentage((@i / @cols)); + } + .grid-pull-@{i}-of-@{cols} { + margin-right: percentage((@i / @cols)); + } + .grid-offset-@{i}-of-@{cols} { + margin-left: percentage((@i / @cols)); + } + .gen-grid(@cols, (@i + 1)); +} +.gen-grid(24); + +// --- Deeply Nested Extend Chains --- +.typography-base { + font-family: sans-serif; + line-height: 1.6; +} +.heading-base:extend(.typography-base) { + font-weight: bold; + margin-bottom: 0.5em; +} +h1:extend(.heading-base) { font-size: 2.5em; } +h2:extend(.heading-base) { font-size: 2em; } +h3:extend(.heading-base) { font-size: 1.75em; } +h4:extend(.heading-base) { font-size: 1.5em; } +h5:extend(.heading-base) { font-size: 1.25em; } +h6:extend(.heading-base) { font-size: 1em; } + +.prose { + h1:extend(h1) {} + h2:extend(h2) {} + h3:extend(h3) {} + p:extend(.typography-base) { + margin-bottom: 1em; + } +} + +// --- Mixin with Variable Argument Lists --- +.multi-bg(@bgs...) { + background: @bgs; +} +.hero-section { + .multi-bg( + linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.3)), + url("/images/hero.jpg") center/cover no-repeat + ); + min-height: 400px; +} + +// --- Scope & Variable Hoisting Stress --- +.scope-outer { + @var: outer; + .scope-inner { + @var: inner; + .scope-deepest { + content: @var; + @var: deepest; + } + content: @var; + } + content: @var; +} + +// --- Guard + Extend Combo --- +.status-mixin(@type) when (@type = success) { + color: #155724; + background-color: #d4edda; + border-color: #c3e6cb; +} +.status-mixin(@type) when (@type = warning) { + color: #856404; + background-color: #fff3cd; + border-color: #ffeeba; +} +.status-mixin(@type) when (@type = danger) { + color: #721c24; + background-color: #f8d7da; + border-color: #f5c6cb; +} +.status-mixin(@type) when (@type = info) { + color: #0c5460; + background-color: #d1ecf1; + border-color: #bee5eb; +} +.alert-success { .status-mixin(success); } +.alert-warning { .status-mixin(warning); } +.alert-danger { .status-mixin(danger); } +.alert-info { .status-mixin(info); } +.toast-success:extend(.alert-success all) {} +.toast-warning:extend(.alert-warning all) {} +.toast-danger:extend(.alert-danger all) {} +.toast-info:extend(.alert-info all) {} \ No newline at end of file diff --git a/packages/less/benchmark/index.js b/packages/less/benchmark/index.js index dac48c9ce5..b356f66046 100644 --- a/packages/less/benchmark/index.js +++ b/packages/less/benchmark/index.js @@ -1,54 +1,49 @@ -var path = require('path'), - fs = require('fs'), - now = require('performance-now'); +import path from 'path'; +import fs from 'fs'; +import { fileURLToPath } from 'url'; +import less from '../lib/less-node/index.js'; -var less = require('../.'); -var file = path.join(__dirname, 'benchmark.less'); +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +let file = path.join(__dirname, 'benchmark.less'); -if (process.argv[2]) { file = path.join(process.cwd(), process.argv[2]) } +if (process.argv[2]) { file = path.resolve(process.argv[2]); } fs.readFile(file, 'utf8', function (e, data) { - var start, total; - console.log('Benchmarking...\n', path.basename(file) + ' (' + parseInt(data.length / 1024) + ' KB)', ''); - var renderBenchmark = [] - , parserBenchmark = [] - , evalBenchmark = []; + const renderBenchmark = []; + const parserBenchmark = []; + const evalBenchmark = []; - var totalruns = 30; - var ignoreruns = 5; + const totalruns = 30; + const ignoreruns = 5; - var i = 0; + let i = 0; nextRun(); function nextRun() { - var start, renderEnd, parserEnd; - - start = now(); + const start = performance.now(); - less.parse(data, {}, function(err, root, imports, options) { + less.parse(data, { filename: file, paths: [path.dirname(file)] }, function(err, root, imports, options) { if (err) { console.log(err); process.exit(3); } - parserEnd = now(); + const parserEnd = performance.now(); - var tree, result; - tree = new less.ParseTree(root, imports); - result = tree.toCSS(options); + const tree = new less.ParseTree(root, imports); + tree.toCSS(options); - renderEnd = now(); + const renderEnd = performance.now(); renderBenchmark.push(renderEnd - start); parserBenchmark.push(parserEnd - start); evalBenchmark.push(renderEnd - parserEnd); i += 1; - //console.log('Less Run #: ' + i); - if(i < totalruns) { + if (i < totalruns) { nextRun(); } else { @@ -62,17 +57,17 @@ fs.readFile(file, 'utf8', function (e, data) { console.log('----------------------'); console.log(benchmark); console.log('----------------------'); - var totalTime = 0; - var mintime = Infinity; - var maxtime = 0; - for(var i = ignoreruns; i < totalruns; i++) { + let totalTime = 0; + let mintime = Infinity; + let maxtime = 0; + for (let i = ignoreruns; i < totalruns; i++) { totalTime += benchMarkData[i]; mintime = Math.min(mintime, benchMarkData[i]); maxtime = Math.max(maxtime, benchMarkData[i]); } - var avgtime = totalTime / (totalruns - ignoreruns); - var variation = maxtime - mintime; - var variationperc = (variation / avgtime) * 100; + const avgtime = totalTime / (totalruns - ignoreruns); + const variation = maxtime - mintime; + const variationperc = (variation / avgtime) * 100; console.log('Min. Time: ' + Math.round(mintime) + ' ms'); console.log('Max. Time: ' + Math.round(maxtime) + ' ms'); @@ -82,12 +77,9 @@ fs.readFile(file, 'utf8', function (e, data) { console.log('+/- ' + Math.round(variationperc) + '%'); console.log(''); } - + analyze('Parsing', parserBenchmark); analyze('Evaluation', evalBenchmark); analyze('Render Time', renderBenchmark); - } - }); - diff --git a/packages/less/benchmark/results/.gitignore b/packages/less/benchmark/results/.gitignore new file mode 100644 index 0000000000..0d8edfb2ec --- /dev/null +++ b/packages/less/benchmark/results/.gitignore @@ -0,0 +1,4 @@ +# Legacy flat files (migrated to runs/ + latest/) +system-info.json +benchmark-results.json +v*.json diff --git a/packages/less/benchmark/results/latest/macbook-pro_arm64.json b/packages/less/benchmark/results/latest/macbook-pro_arm64.json new file mode 100644 index 0000000000..cc4cfa0402 --- /dev/null +++ b/packages/less/benchmark/results/latest/macbook-pro_arm64.json @@ -0,0 +1,1361 @@ +{ + "system": { + "system_id": "macbook-pro_arm64", + "hostname": "MacBook-Pro.local", + "platform": "Darwin", + "arch": "arm64", + "os_version": "25.3.0", + "cpus": "14", + "cpu_model": "Apple M4 Pro", + "total_memory_gb": 48.0, + "node_version": "v24.11.1", + "date": "2026-03-09T21:34:11Z" + }, + "versions": [ + { + "tag": "v2.0.0", + "version": "2.0.0", + "node_version": "v18.20.8", + "date": "2026-03-09T21:34:21Z", + "benchmarks": { + "benchmark.less": { + "version": "2.0.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 29.27, + "max": 87.45, + "avg": 46.87, + "median": 46.89, + "stddev": 16.56, + "variance_pct": 35.33, + "samples": 12, + "throughput_kbs": 2224 + } + } + } + }, + { + "tag": "v2.1.2", + "version": "2.1.2", + "node_version": "v18.20.8", + "date": "2026-03-09T21:34:26Z", + "benchmarks": { + "benchmark.less": { + "error": "Extra data: line 2 column 1 (char 283)" + } + } + }, + { + "tag": "v2.2.0", + "version": "2.2.0", + "node_version": "v18.20.8", + "date": "2026-03-09T21:34:42Z", + "benchmarks": { + "benchmark.less": { + "version": "2.2.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 28.99, + "max": 62.52, + "avg": 38.51, + "median": 31.32, + "stddev": 12.38, + "variance_pct": 32.15, + "samples": 12, + "throughput_kbs": 2706 + } + } + } + }, + { + "tag": "v2.3.1", + "version": "2.3.1", + "node_version": "v18.20.8", + "date": "2026-03-09T21:34:47Z", + "benchmarks": { + "benchmark.less": { + "version": "2.3.1", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 30.8, + "max": 63.72, + "avg": 38.42, + "median": 33.57, + "stddev": 11.47, + "variance_pct": 29.85, + "samples": 12, + "throughput_kbs": 2713 + } + } + } + }, + { + "tag": "v2.4.0", + "version": "2.4.0", + "node_version": "v18.20.8", + "date": "2026-03-09T21:34:52Z", + "benchmarks": { + "benchmark.less": { + "version": "2.4.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 27.39, + "max": 57.2, + "avg": 35.24, + "median": 31.11, + "stddev": 9.93, + "variance_pct": 28.18, + "samples": 12, + "throughput_kbs": 2957 + } + } + } + }, + { + "tag": "v2.5.3", + "version": "2.5.3", + "node_version": "v18.20.8", + "date": "2026-03-09T21:34:56Z", + "benchmarks": { + "benchmark.less": { + "version": "2.5.3", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 29.83, + "max": 63.6, + "avg": 37.57, + "median": 30.87, + "stddev": 11.91, + "variance_pct": 31.69, + "samples": 12, + "throughput_kbs": 2774 + } + } + } + }, + { + "tag": "v2.6.1", + "version": "2.6.1", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:02Z", + "benchmarks": { + "benchmark.less": { + "version": "2.6.1", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 33.64, + "max": 69, + "avg": 42.08, + "median": 37.52, + "stddev": 11.96, + "variance_pct": 28.41, + "samples": 12, + "throughput_kbs": 2477 + } + } + } + }, + { + "tag": "v2.7.3", + "version": "2.7.3", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:08Z", + "benchmarks": { + "benchmark.less": { + "version": "2.7.3", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 33.99, + "max": 72.46, + "avg": 44.36, + "median": 36.95, + "stddev": 13, + "variance_pct": 29.29, + "samples": 12, + "throughput_kbs": 2349 + } + } + } + }, + { + "tag": "v3.0.4", + "version": "3.0.4", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:14Z", + "benchmarks": { + "benchmark.less": { + "version": "3.0.4", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 37.07, + "max": 75.95, + "avg": 43.98, + "median": 39.29, + "stddev": 10.66, + "variance_pct": 24.25, + "samples": 12, + "throughput_kbs": 2370 + } + } + } + }, + { + "tag": "v3.5.3", + "version": "3.5.3", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:18Z", + "benchmarks": { + "benchmark.less": { + "version": "3.5.3", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 35.09, + "max": 52.73, + "avg": 43.96, + "median": 42.4, + "stddev": 5.5, + "variance_pct": 12.5, + "samples": 12, + "throughput_kbs": 2371 + } + } + } + }, + { + "tag": "v3.6.0", + "version": "3.6.0", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:23Z", + "benchmarks": { + "benchmark.less": { + "version": "3.6.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 37.97, + "max": 49.87, + "avg": 42.39, + "median": 40.92, + "stddev": 3.8, + "variance_pct": 8.97, + "samples": 12, + "throughput_kbs": 2459 + } + }, + "benchmark-v3.less": { + "version": "3.6.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.16, + "max": 4.09, + "avg": 2.94, + "median": 2.87, + "stddev": 0.63, + "variance_pct": 21.61, + "samples": 12, + "throughput_kbs": 1076 + } + } + } + }, + { + "tag": "v3.7.1", + "version": "3.7.1", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:28Z", + "benchmarks": { + "benchmark.less": { + "version": "3.7.1", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 37.82, + "max": 52.26, + "avg": 43.33, + "median": 40.85, + "stddev": 4.7, + "variance_pct": 10.84, + "samples": 12, + "throughput_kbs": 2405 + } + }, + "benchmark-v3.less": { + "version": "3.7.1", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.02, + "max": 3.55, + "avg": 2.74, + "median": 2.89, + "stddev": 0.52, + "variance_pct": 19.1, + "samples": 12, + "throughput_kbs": 1154 + } + }, + "benchmark-v37.less": { + "version": "3.7.1", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.63, + "max": 3.59, + "avg": 2.81, + "median": 2.9, + "stddev": 0.67, + "variance_pct": 23.77, + "samples": 12, + "throughput_kbs": 788 + } + } + } + }, + { + "tag": "v3.8.1", + "version": "3.8.1", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:35Z", + "benchmarks": { + "benchmark.less": { + "version": "3.8.1", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 38.31, + "max": 49.98, + "avg": 43.22, + "median": 41.04, + "stddev": 4.17, + "variance_pct": 9.64, + "samples": 12, + "throughput_kbs": 2412 + } + }, + "benchmark-v3.less": { + "version": "3.8.1", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.06, + "max": 3.99, + "avg": 2.98, + "median": 2.91, + "stddev": 0.66, + "variance_pct": 22.1, + "samples": 12, + "throughput_kbs": 1062 + } + }, + "benchmark-v37.less": { + "version": "3.8.1", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.8, + "max": 4.64, + "avg": 3.22, + "median": 3.06, + "stddev": 0.91, + "variance_pct": 28.34, + "samples": 12, + "throughput_kbs": 688 + } + } + } + }, + { + "tag": "v3.9.0", + "version": "3.9.0", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:41Z", + "benchmarks": { + "benchmark.less": { + "version": "3.9.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 38.78, + "max": 54.91, + "avg": 44.19, + "median": 40.7, + "stddev": 5.9, + "variance_pct": 13.35, + "samples": 12, + "throughput_kbs": 2358 + } + }, + "benchmark-v3.less": { + "version": "3.9.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.16, + "max": 4.04, + "avg": 3.01, + "median": 3.04, + "stddev": 0.62, + "variance_pct": 20.71, + "samples": 12, + "throughput_kbs": 1051 + } + }, + "benchmark-v37.less": { + "version": "3.9.0", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.68, + "max": 4.06, + "avg": 2.87, + "median": 2.87, + "stddev": 0.76, + "variance_pct": 26.57, + "samples": 12, + "throughput_kbs": 774 + } + }, + "benchmark-v39.less": { + "version": "3.9.0", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.06, + "max": 8.97, + "avg": 4.06, + "median": 3.91, + "stddev": 1.85, + "variance_pct": 45.62, + "samples": 12, + "throughput_kbs": 375 + } + } + } + }, + { + "tag": "v3.10.3", + "version": "3.10.3", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:52Z", + "benchmarks": { + "benchmark.less": { + "version": "3.10.3", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 118.01, + "max": 152.74, + "avg": 130.23, + "median": 126.14, + "stddev": 10.09, + "variance_pct": 7.75, + "samples": 12, + "throughput_kbs": 800 + } + }, + "benchmark-v3.less": { + "version": "3.10.3", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 3.64, + "max": 9.65, + "avg": 5.79, + "median": 5.61, + "stddev": 1.75, + "variance_pct": 30.26, + "samples": 12, + "throughput_kbs": 546 + } + }, + "benchmark-v37.less": { + "version": "3.10.3", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 3.84, + "max": 10.64, + "avg": 6.08, + "median": 5.57, + "stddev": 1.81, + "variance_pct": 29.73, + "samples": 12, + "throughput_kbs": 365 + } + }, + "benchmark-v39.less": { + "version": "3.10.3", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 9.19, + "max": 16.24, + "avg": 11.6, + "median": 10.95, + "stddev": 2.13, + "variance_pct": 18.39, + "samples": 12, + "throughput_kbs": 131 + } + } + } + }, + { + "tag": "v3.11.3", + "version": "3.11.3", + "node_version": "v18.20.8", + "date": "2026-03-09T21:36:02Z", + "benchmarks": { + "benchmark.less": { + "version": "3.11.3", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 123.6, + "max": 184.63, + "avg": 141.98, + "median": 135.73, + "stddev": 17, + "variance_pct": 11.97, + "samples": 12, + "throughput_kbs": 734 + } + }, + "benchmark-v3.less": { + "version": "3.11.3", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 4.07, + "max": 10.74, + "avg": 6.67, + "median": 6.18, + "stddev": 1.94, + "variance_pct": 29.07, + "samples": 12, + "throughput_kbs": 474 + } + }, + "benchmark-v37.less": { + "version": "3.11.3", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 5.7, + "max": 10.64, + "avg": 7.81, + "median": 7.46, + "stddev": 1.39, + "variance_pct": 17.78, + "samples": 12, + "throughput_kbs": 284 + } + }, + "benchmark-v39.less": { + "version": "3.11.3", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 6.23, + "max": 14.21, + "avg": 7.67, + "median": 6.97, + "stddev": 2.09, + "variance_pct": 27.21, + "samples": 12, + "throughput_kbs": 198 + } + } + } + }, + { + "tag": "v3.12.2", + "version": "3.12.2", + "node_version": "v18.20.8", + "date": "2026-03-09T21:36:16Z", + "benchmarks": { + "benchmark.less": { + "version": "3.12.2", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 165.65, + "max": 209.38, + "avg": 187.15, + "median": 185.42, + "stddev": 12.88, + "variance_pct": 6.88, + "samples": 12, + "throughput_kbs": 557 + } + }, + "benchmark-v3.less": { + "version": "3.12.2", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 3.76, + "max": 9.79, + "avg": 5.58, + "median": 5.53, + "stddev": 1.63, + "variance_pct": 29.32, + "samples": 12, + "throughput_kbs": 567 + } + }, + "benchmark-v37.less": { + "version": "3.12.2", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 4.22, + "max": 8.17, + "avg": 5.92, + "median": 5.82, + "stddev": 1.04, + "variance_pct": 17.62, + "samples": 12, + "throughput_kbs": 375 + } + }, + "benchmark-v39.less": { + "version": "3.12.2", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 7.43, + "max": 21.7, + "avg": 10.87, + "median": 9.85, + "stddev": 3.5, + "variance_pct": 32.22, + "samples": 12, + "throughput_kbs": 140 + } + } + } + }, + { + "tag": "v4.0.0", + "version": "4.0.0", + "node_version": "v20.19.6", + "date": "2026-03-09T21:36:27Z", + "benchmarks": { + "benchmark.less": { + "version": "4.0.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 35.71, + "max": 68.55, + "avg": 44.82, + "median": 39.85, + "stddev": 10.75, + "variance_pct": 24, + "samples": 12, + "throughput_kbs": 2326 + } + }, + "benchmark-v3.less": { + "version": "4.0.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 0, + "errors": [ + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + }, + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + }, + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + }, + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + } + ], + "render": null + }, + "benchmark-v37.less": { + "version": "4.0.0", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 0, + "errors": [ + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + }, + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + }, + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + }, + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + } + ], + "render": null + }, + "benchmark-v39.less": { + "version": "4.0.0", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.9, + "max": 11.57, + "avg": 4, + "median": 3.28, + "stddev": 2.63, + "variance_pct": 65.62, + "samples": 12, + "throughput_kbs": 380 + } + } + } + }, + { + "tag": "v4.1.3", + "version": "4.1.3", + "node_version": "v20.19.6", + "date": "2026-03-09T21:36:35Z", + "benchmarks": { + "benchmark.less": { + "version": "4.1.3", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 35.55, + "max": 68.29, + "avg": 43.74, + "median": 39.45, + "stddev": 10.63, + "variance_pct": 24.31, + "samples": 12, + "throughput_kbs": 2383 + } + }, + "benchmark-v3.less": { + "version": "4.1.3", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.51, + "max": 4.32, + "avg": 2.59, + "median": 2.52, + "stddev": 0.88, + "variance_pct": 34, + "samples": 12, + "throughput_kbs": 1220 + } + }, + "benchmark-v37.less": { + "version": "4.1.3", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.69, + "max": 4.27, + "avg": 3, + "median": 3.18, + "stddev": 0.8, + "variance_pct": 26.75, + "samples": 12, + "throughput_kbs": 738 + } + }, + "benchmark-v39.less": { + "version": "4.1.3", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.86, + "max": 11.57, + "avg": 4, + "median": 3.49, + "stddev": 2.58, + "variance_pct": 64.45, + "samples": 12, + "throughput_kbs": 380 + } + } + } + }, + { + "tag": "v4.2.2", + "version": "4.2.2", + "node_version": "v20.19.6", + "date": "2026-03-09T21:36:43Z", + "benchmarks": { + "benchmark.less": { + "version": "4.2.2", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 33.06, + "max": 71.26, + "avg": 41.5, + "median": 35.42, + "stddev": 12.93, + "variance_pct": 31.15, + "samples": 12, + "throughput_kbs": 2511 + } + }, + "benchmark-v3.less": { + "version": "4.2.2", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.68, + "max": 4.18, + "avg": 2.67, + "median": 2.69, + "stddev": 0.79, + "variance_pct": 29.71, + "samples": 12, + "throughput_kbs": 1184 + } + }, + "benchmark-v37.less": { + "version": "4.2.2", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.97, + "max": 10.6, + "avg": 3.77, + "median": 3.76, + "stddev": 2.2, + "variance_pct": 58.39, + "samples": 12, + "throughput_kbs": 587 + } + }, + "benchmark-v39.less": { + "version": "4.2.2", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.35, + "max": 9.8, + "avg": 4.85, + "median": 4.98, + "stddev": 2.16, + "variance_pct": 44.58, + "samples": 12, + "throughput_kbs": 314 + } + } + } + }, + { + "tag": "v4.3.0", + "version": "4.3.0", + "node_version": "v20.19.6", + "date": "2026-03-09T21:36:54Z", + "benchmarks": { + "benchmark.less": { + "version": "4.3.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 34.18, + "max": 73.61, + "avg": 43.07, + "median": 37.23, + "stddev": 12.22, + "variance_pct": 28.38, + "samples": 12, + "throughput_kbs": 2420 + } + }, + "benchmark-v3.less": { + "version": "4.3.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.63, + "max": 3.81, + "avg": 2.52, + "median": 2.45, + "stddev": 0.75, + "variance_pct": 29.7, + "samples": 12, + "throughput_kbs": 1254 + } + }, + "benchmark-v37.less": { + "version": "4.3.0", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.01, + "max": 9.44, + "avg": 3.51, + "median": 3.37, + "stddev": 1.9, + "variance_pct": 54.29, + "samples": 12, + "throughput_kbs": 632 + } + }, + "benchmark-v39.less": { + "version": "4.3.0", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.22, + "max": 9.85, + "avg": 4.7, + "median": 4.26, + "stddev": 2.16, + "variance_pct": 46.07, + "samples": 12, + "throughput_kbs": 324 + } + } + } + }, + { + "tag": "v4.4.2", + "version": "4.4.2", + "node_version": "v20.19.6", + "date": "2026-03-09T21:37:06Z", + "benchmarks": { + "benchmark.less": { + "version": "4.4.2", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 34.87, + "max": 73.71, + "avg": 45.83, + "median": 40.47, + "stddev": 11.86, + "variance_pct": 25.87, + "samples": 12, + "throughput_kbs": 2274 + } + }, + "benchmark-v3.less": { + "version": "4.4.2", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.55, + "max": 3.67, + "avg": 2.53, + "median": 2.53, + "stddev": 0.66, + "variance_pct": 26.12, + "samples": 12, + "throughput_kbs": 1249 + } + }, + "benchmark-v37.less": { + "version": "4.4.2", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.51, + "max": 10.07, + "avg": 3.59, + "median": 3.48, + "stddev": 2.11, + "variance_pct": 58.91, + "samples": 12, + "throughput_kbs": 618 + } + }, + "benchmark-v39.less": { + "version": "4.4.2", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.47, + "max": 10.4, + "avg": 4.92, + "median": 4.59, + "stddev": 2.24, + "variance_pct": 45.65, + "samples": 12, + "throughput_kbs": 310 + } + } + } + }, + { + "tag": "v4.5.1", + "version": "4.5.1", + "node_version": "v20.19.6", + "date": "2026-03-09T21:37:14Z", + "benchmarks": { + "benchmark.less": { + "version": "4.5.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 39.63, + "max": 72.55, + "avg": 47.4, + "median": 42.16, + "stddev": 11.09, + "variance_pct": 23.39, + "samples": 12, + "throughput_kbs": 2199 + } + }, + "benchmark-v3.less": { + "version": "4.5.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.61, + "max": 3.47, + "avg": 2.57, + "median": 2.62, + "stddev": 0.67, + "variance_pct": 26.21, + "samples": 12, + "throughput_kbs": 1231 + } + }, + "benchmark-v37.less": { + "version": "4.5.0", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.65, + "max": 9.51, + "avg": 3.79, + "median": 3.62, + "stddev": 1.96, + "variance_pct": 51.77, + "samples": 12, + "throughput_kbs": 585 + } + }, + "benchmark-v39.less": { + "version": "4.5.0", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.18, + "max": 10.1, + "avg": 4.62, + "median": 4.73, + "stddev": 2.14, + "variance_pct": 46.29, + "samples": 12, + "throughput_kbs": 330 + } + } + } + } + ] +} diff --git a/packages/less/benchmark/results/runs/2026-03-09T21-34-11Z_macbook-pro_arm64.json b/packages/less/benchmark/results/runs/2026-03-09T21-34-11Z_macbook-pro_arm64.json new file mode 100644 index 0000000000..cc4cfa0402 --- /dev/null +++ b/packages/less/benchmark/results/runs/2026-03-09T21-34-11Z_macbook-pro_arm64.json @@ -0,0 +1,1361 @@ +{ + "system": { + "system_id": "macbook-pro_arm64", + "hostname": "MacBook-Pro.local", + "platform": "Darwin", + "arch": "arm64", + "os_version": "25.3.0", + "cpus": "14", + "cpu_model": "Apple M4 Pro", + "total_memory_gb": 48.0, + "node_version": "v24.11.1", + "date": "2026-03-09T21:34:11Z" + }, + "versions": [ + { + "tag": "v2.0.0", + "version": "2.0.0", + "node_version": "v18.20.8", + "date": "2026-03-09T21:34:21Z", + "benchmarks": { + "benchmark.less": { + "version": "2.0.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 29.27, + "max": 87.45, + "avg": 46.87, + "median": 46.89, + "stddev": 16.56, + "variance_pct": 35.33, + "samples": 12, + "throughput_kbs": 2224 + } + } + } + }, + { + "tag": "v2.1.2", + "version": "2.1.2", + "node_version": "v18.20.8", + "date": "2026-03-09T21:34:26Z", + "benchmarks": { + "benchmark.less": { + "error": "Extra data: line 2 column 1 (char 283)" + } + } + }, + { + "tag": "v2.2.0", + "version": "2.2.0", + "node_version": "v18.20.8", + "date": "2026-03-09T21:34:42Z", + "benchmarks": { + "benchmark.less": { + "version": "2.2.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 28.99, + "max": 62.52, + "avg": 38.51, + "median": 31.32, + "stddev": 12.38, + "variance_pct": 32.15, + "samples": 12, + "throughput_kbs": 2706 + } + } + } + }, + { + "tag": "v2.3.1", + "version": "2.3.1", + "node_version": "v18.20.8", + "date": "2026-03-09T21:34:47Z", + "benchmarks": { + "benchmark.less": { + "version": "2.3.1", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 30.8, + "max": 63.72, + "avg": 38.42, + "median": 33.57, + "stddev": 11.47, + "variance_pct": 29.85, + "samples": 12, + "throughput_kbs": 2713 + } + } + } + }, + { + "tag": "v2.4.0", + "version": "2.4.0", + "node_version": "v18.20.8", + "date": "2026-03-09T21:34:52Z", + "benchmarks": { + "benchmark.less": { + "version": "2.4.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 27.39, + "max": 57.2, + "avg": 35.24, + "median": 31.11, + "stddev": 9.93, + "variance_pct": 28.18, + "samples": 12, + "throughput_kbs": 2957 + } + } + } + }, + { + "tag": "v2.5.3", + "version": "2.5.3", + "node_version": "v18.20.8", + "date": "2026-03-09T21:34:56Z", + "benchmarks": { + "benchmark.less": { + "version": "2.5.3", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 29.83, + "max": 63.6, + "avg": 37.57, + "median": 30.87, + "stddev": 11.91, + "variance_pct": 31.69, + "samples": 12, + "throughput_kbs": 2774 + } + } + } + }, + { + "tag": "v2.6.1", + "version": "2.6.1", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:02Z", + "benchmarks": { + "benchmark.less": { + "version": "2.6.1", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 33.64, + "max": 69, + "avg": 42.08, + "median": 37.52, + "stddev": 11.96, + "variance_pct": 28.41, + "samples": 12, + "throughput_kbs": 2477 + } + } + } + }, + { + "tag": "v2.7.3", + "version": "2.7.3", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:08Z", + "benchmarks": { + "benchmark.less": { + "version": "2.7.3", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 33.99, + "max": 72.46, + "avg": 44.36, + "median": 36.95, + "stddev": 13, + "variance_pct": 29.29, + "samples": 12, + "throughput_kbs": 2349 + } + } + } + }, + { + "tag": "v3.0.4", + "version": "3.0.4", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:14Z", + "benchmarks": { + "benchmark.less": { + "version": "3.0.4", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 37.07, + "max": 75.95, + "avg": 43.98, + "median": 39.29, + "stddev": 10.66, + "variance_pct": 24.25, + "samples": 12, + "throughput_kbs": 2370 + } + } + } + }, + { + "tag": "v3.5.3", + "version": "3.5.3", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:18Z", + "benchmarks": { + "benchmark.less": { + "version": "3.5.3", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 35.09, + "max": 52.73, + "avg": 43.96, + "median": 42.4, + "stddev": 5.5, + "variance_pct": 12.5, + "samples": 12, + "throughput_kbs": 2371 + } + } + } + }, + { + "tag": "v3.6.0", + "version": "3.6.0", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:23Z", + "benchmarks": { + "benchmark.less": { + "version": "3.6.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 37.97, + "max": 49.87, + "avg": 42.39, + "median": 40.92, + "stddev": 3.8, + "variance_pct": 8.97, + "samples": 12, + "throughput_kbs": 2459 + } + }, + "benchmark-v3.less": { + "version": "3.6.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.16, + "max": 4.09, + "avg": 2.94, + "median": 2.87, + "stddev": 0.63, + "variance_pct": 21.61, + "samples": 12, + "throughput_kbs": 1076 + } + } + } + }, + { + "tag": "v3.7.1", + "version": "3.7.1", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:28Z", + "benchmarks": { + "benchmark.less": { + "version": "3.7.1", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 37.82, + "max": 52.26, + "avg": 43.33, + "median": 40.85, + "stddev": 4.7, + "variance_pct": 10.84, + "samples": 12, + "throughput_kbs": 2405 + } + }, + "benchmark-v3.less": { + "version": "3.7.1", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.02, + "max": 3.55, + "avg": 2.74, + "median": 2.89, + "stddev": 0.52, + "variance_pct": 19.1, + "samples": 12, + "throughput_kbs": 1154 + } + }, + "benchmark-v37.less": { + "version": "3.7.1", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.63, + "max": 3.59, + "avg": 2.81, + "median": 2.9, + "stddev": 0.67, + "variance_pct": 23.77, + "samples": 12, + "throughput_kbs": 788 + } + } + } + }, + { + "tag": "v3.8.1", + "version": "3.8.1", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:35Z", + "benchmarks": { + "benchmark.less": { + "version": "3.8.1", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 38.31, + "max": 49.98, + "avg": 43.22, + "median": 41.04, + "stddev": 4.17, + "variance_pct": 9.64, + "samples": 12, + "throughput_kbs": 2412 + } + }, + "benchmark-v3.less": { + "version": "3.8.1", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.06, + "max": 3.99, + "avg": 2.98, + "median": 2.91, + "stddev": 0.66, + "variance_pct": 22.1, + "samples": 12, + "throughput_kbs": 1062 + } + }, + "benchmark-v37.less": { + "version": "3.8.1", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.8, + "max": 4.64, + "avg": 3.22, + "median": 3.06, + "stddev": 0.91, + "variance_pct": 28.34, + "samples": 12, + "throughput_kbs": 688 + } + } + } + }, + { + "tag": "v3.9.0", + "version": "3.9.0", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:41Z", + "benchmarks": { + "benchmark.less": { + "version": "3.9.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 38.78, + "max": 54.91, + "avg": 44.19, + "median": 40.7, + "stddev": 5.9, + "variance_pct": 13.35, + "samples": 12, + "throughput_kbs": 2358 + } + }, + "benchmark-v3.less": { + "version": "3.9.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.16, + "max": 4.04, + "avg": 3.01, + "median": 3.04, + "stddev": 0.62, + "variance_pct": 20.71, + "samples": 12, + "throughput_kbs": 1051 + } + }, + "benchmark-v37.less": { + "version": "3.9.0", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.68, + "max": 4.06, + "avg": 2.87, + "median": 2.87, + "stddev": 0.76, + "variance_pct": 26.57, + "samples": 12, + "throughput_kbs": 774 + } + }, + "benchmark-v39.less": { + "version": "3.9.0", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.06, + "max": 8.97, + "avg": 4.06, + "median": 3.91, + "stddev": 1.85, + "variance_pct": 45.62, + "samples": 12, + "throughput_kbs": 375 + } + } + } + }, + { + "tag": "v3.10.3", + "version": "3.10.3", + "node_version": "v18.20.8", + "date": "2026-03-09T21:35:52Z", + "benchmarks": { + "benchmark.less": { + "version": "3.10.3", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 118.01, + "max": 152.74, + "avg": 130.23, + "median": 126.14, + "stddev": 10.09, + "variance_pct": 7.75, + "samples": 12, + "throughput_kbs": 800 + } + }, + "benchmark-v3.less": { + "version": "3.10.3", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 3.64, + "max": 9.65, + "avg": 5.79, + "median": 5.61, + "stddev": 1.75, + "variance_pct": 30.26, + "samples": 12, + "throughput_kbs": 546 + } + }, + "benchmark-v37.less": { + "version": "3.10.3", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 3.84, + "max": 10.64, + "avg": 6.08, + "median": 5.57, + "stddev": 1.81, + "variance_pct": 29.73, + "samples": 12, + "throughput_kbs": 365 + } + }, + "benchmark-v39.less": { + "version": "3.10.3", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 9.19, + "max": 16.24, + "avg": 11.6, + "median": 10.95, + "stddev": 2.13, + "variance_pct": 18.39, + "samples": 12, + "throughput_kbs": 131 + } + } + } + }, + { + "tag": "v3.11.3", + "version": "3.11.3", + "node_version": "v18.20.8", + "date": "2026-03-09T21:36:02Z", + "benchmarks": { + "benchmark.less": { + "version": "3.11.3", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 123.6, + "max": 184.63, + "avg": 141.98, + "median": 135.73, + "stddev": 17, + "variance_pct": 11.97, + "samples": 12, + "throughput_kbs": 734 + } + }, + "benchmark-v3.less": { + "version": "3.11.3", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 4.07, + "max": 10.74, + "avg": 6.67, + "median": 6.18, + "stddev": 1.94, + "variance_pct": 29.07, + "samples": 12, + "throughput_kbs": 474 + } + }, + "benchmark-v37.less": { + "version": "3.11.3", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 5.7, + "max": 10.64, + "avg": 7.81, + "median": 7.46, + "stddev": 1.39, + "variance_pct": 17.78, + "samples": 12, + "throughput_kbs": 284 + } + }, + "benchmark-v39.less": { + "version": "3.11.3", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 6.23, + "max": 14.21, + "avg": 7.67, + "median": 6.97, + "stddev": 2.09, + "variance_pct": 27.21, + "samples": 12, + "throughput_kbs": 198 + } + } + } + }, + { + "tag": "v3.12.2", + "version": "3.12.2", + "node_version": "v18.20.8", + "date": "2026-03-09T21:36:16Z", + "benchmarks": { + "benchmark.less": { + "version": "3.12.2", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 165.65, + "max": 209.38, + "avg": 187.15, + "median": 185.42, + "stddev": 12.88, + "variance_pct": 6.88, + "samples": 12, + "throughput_kbs": 557 + } + }, + "benchmark-v3.less": { + "version": "3.12.2", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 3.76, + "max": 9.79, + "avg": 5.58, + "median": 5.53, + "stddev": 1.63, + "variance_pct": 29.32, + "samples": 12, + "throughput_kbs": 567 + } + }, + "benchmark-v37.less": { + "version": "3.12.2", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 4.22, + "max": 8.17, + "avg": 5.92, + "median": 5.82, + "stddev": 1.04, + "variance_pct": 17.62, + "samples": 12, + "throughput_kbs": 375 + } + }, + "benchmark-v39.less": { + "version": "3.12.2", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 7.43, + "max": 21.7, + "avg": 10.87, + "median": 9.85, + "stddev": 3.5, + "variance_pct": 32.22, + "samples": 12, + "throughput_kbs": 140 + } + } + } + }, + { + "tag": "v4.0.0", + "version": "4.0.0", + "node_version": "v20.19.6", + "date": "2026-03-09T21:36:27Z", + "benchmarks": { + "benchmark.less": { + "version": "4.0.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 35.71, + "max": 68.55, + "avg": 44.82, + "median": 39.85, + "stddev": 10.75, + "variance_pct": 24, + "samples": 12, + "throughput_kbs": 2326 + } + }, + "benchmark-v3.less": { + "version": "4.0.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 0, + "errors": [ + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + }, + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + }, + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + }, + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + } + ], + "render": null + }, + "benchmark-v37.less": { + "version": "4.0.0", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 0, + "errors": [ + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + }, + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + }, + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + }, + { + "run": 0, + "error": "Error evaluating function `if`: tslib_1.__spreadArray is not a function" + } + ], + "render": null + }, + "benchmark-v39.less": { + "version": "4.0.0", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.9, + "max": 11.57, + "avg": 4, + "median": 3.28, + "stddev": 2.63, + "variance_pct": 65.62, + "samples": 12, + "throughput_kbs": 380 + } + } + } + }, + { + "tag": "v4.1.3", + "version": "4.1.3", + "node_version": "v20.19.6", + "date": "2026-03-09T21:36:35Z", + "benchmarks": { + "benchmark.less": { + "version": "4.1.3", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 35.55, + "max": 68.29, + "avg": 43.74, + "median": 39.45, + "stddev": 10.63, + "variance_pct": 24.31, + "samples": 12, + "throughput_kbs": 2383 + } + }, + "benchmark-v3.less": { + "version": "4.1.3", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.51, + "max": 4.32, + "avg": 2.59, + "median": 2.52, + "stddev": 0.88, + "variance_pct": 34, + "samples": 12, + "throughput_kbs": 1220 + } + }, + "benchmark-v37.less": { + "version": "4.1.3", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.69, + "max": 4.27, + "avg": 3, + "median": 3.18, + "stddev": 0.8, + "variance_pct": 26.75, + "samples": 12, + "throughput_kbs": 738 + } + }, + "benchmark-v39.less": { + "version": "4.1.3", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.86, + "max": 11.57, + "avg": 4, + "median": 3.49, + "stddev": 2.58, + "variance_pct": 64.45, + "samples": 12, + "throughput_kbs": 380 + } + } + } + }, + { + "tag": "v4.2.2", + "version": "4.2.2", + "node_version": "v20.19.6", + "date": "2026-03-09T21:36:43Z", + "benchmarks": { + "benchmark.less": { + "version": "4.2.2", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 33.06, + "max": 71.26, + "avg": 41.5, + "median": 35.42, + "stddev": 12.93, + "variance_pct": 31.15, + "samples": 12, + "throughput_kbs": 2511 + } + }, + "benchmark-v3.less": { + "version": "4.2.2", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.68, + "max": 4.18, + "avg": 2.67, + "median": 2.69, + "stddev": 0.79, + "variance_pct": 29.71, + "samples": 12, + "throughput_kbs": 1184 + } + }, + "benchmark-v37.less": { + "version": "4.2.2", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.97, + "max": 10.6, + "avg": 3.77, + "median": 3.76, + "stddev": 2.2, + "variance_pct": 58.39, + "samples": 12, + "throughput_kbs": 587 + } + }, + "benchmark-v39.less": { + "version": "4.2.2", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.35, + "max": 9.8, + "avg": 4.85, + "median": 4.98, + "stddev": 2.16, + "variance_pct": 44.58, + "samples": 12, + "throughput_kbs": 314 + } + } + } + }, + { + "tag": "v4.3.0", + "version": "4.3.0", + "node_version": "v20.19.6", + "date": "2026-03-09T21:36:54Z", + "benchmarks": { + "benchmark.less": { + "version": "4.3.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 34.18, + "max": 73.61, + "avg": 43.07, + "median": 37.23, + "stddev": 12.22, + "variance_pct": 28.38, + "samples": 12, + "throughput_kbs": 2420 + } + }, + "benchmark-v3.less": { + "version": "4.3.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.63, + "max": 3.81, + "avg": 2.52, + "median": 2.45, + "stddev": 0.75, + "variance_pct": 29.7, + "samples": 12, + "throughput_kbs": 1254 + } + }, + "benchmark-v37.less": { + "version": "4.3.0", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.01, + "max": 9.44, + "avg": 3.51, + "median": 3.37, + "stddev": 1.9, + "variance_pct": 54.29, + "samples": 12, + "throughput_kbs": 632 + } + }, + "benchmark-v39.less": { + "version": "4.3.0", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.22, + "max": 9.85, + "avg": 4.7, + "median": 4.26, + "stddev": 2.16, + "variance_pct": 46.07, + "samples": 12, + "throughput_kbs": 324 + } + } + } + }, + { + "tag": "v4.4.2", + "version": "4.4.2", + "node_version": "v20.19.6", + "date": "2026-03-09T21:37:06Z", + "benchmarks": { + "benchmark.less": { + "version": "4.4.2", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 34.87, + "max": 73.71, + "avg": 45.83, + "median": 40.47, + "stddev": 11.86, + "variance_pct": 25.87, + "samples": 12, + "throughput_kbs": 2274 + } + }, + "benchmark-v3.less": { + "version": "4.4.2", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.55, + "max": 3.67, + "avg": 2.53, + "median": 2.53, + "stddev": 0.66, + "variance_pct": 26.12, + "samples": 12, + "throughput_kbs": 1249 + } + }, + "benchmark-v37.less": { + "version": "4.4.2", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.51, + "max": 10.07, + "avg": 3.59, + "median": 3.48, + "stddev": 2.11, + "variance_pct": 58.91, + "samples": 12, + "throughput_kbs": 618 + } + }, + "benchmark-v39.less": { + "version": "4.4.2", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.47, + "max": 10.4, + "avg": 4.92, + "median": 4.59, + "stddev": 2.24, + "variance_pct": 45.65, + "samples": 12, + "throughput_kbs": 310 + } + } + } + }, + { + "tag": "v4.5.1", + "version": "4.5.1", + "node_version": "v20.19.6", + "date": "2026-03-09T21:37:14Z", + "benchmarks": { + "benchmark.less": { + "version": "4.5.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106724, + "fileSizeKB": 104.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 39.63, + "max": 72.55, + "avg": 47.4, + "median": 42.16, + "stddev": 11.09, + "variance_pct": 23.39, + "samples": 12, + "throughput_kbs": 2199 + } + }, + "benchmark-v3.less": { + "version": "4.5.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.61, + "max": 3.47, + "avg": 2.57, + "median": 2.62, + "stddev": 0.67, + "variance_pct": 26.21, + "samples": 12, + "throughput_kbs": 1231 + } + }, + "benchmark-v37.less": { + "version": "4.5.0", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 1.65, + "max": 9.51, + "avg": 3.79, + "median": 3.62, + "stddev": 1.96, + "variance_pct": 51.77, + "samples": 12, + "throughput_kbs": 585 + } + }, + "benchmark-v39.less": { + "version": "4.5.0", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1558, + "fileSizeKB": 1.5, + "totalRuns": 15, + "warmupRuns": 3, + "completedRuns": 15, + "render": { + "min": 2.18, + "max": 10.1, + "avg": 4.62, + "median": 4.73, + "stddev": 2.14, + "variance_pct": 46.29, + "samples": 12, + "throughput_kbs": 330 + } + } + } + } + ] +} diff --git a/packages/less/benchmark/results/runs/2026-03-09_macbook-pro_arm64.json b/packages/less/benchmark/results/runs/2026-03-09_macbook-pro_arm64.json new file mode 100644 index 0000000000..bc8a051318 --- /dev/null +++ b/packages/less/benchmark/results/runs/2026-03-09_macbook-pro_arm64.json @@ -0,0 +1,536 @@ +{ + "system": { + "hostname": "MacBook-Pro.local", + "platform": "Darwin", + "arch": "arm64", + "os_version": "25.3.0", + "cpus": "14", + "cpu_model": "Apple M4 Pro", + "total_memory_gb": 48.0, + "node_version": "v24.11.1", + "date": "2026-03-09T18:54:01Z", + "system_id": "macbook-pro_arm64" + }, + "versions": [ + { + "tag": "v3.5.0", + "version": "3.5.0", + "node_version": "v18.20.8", + "date": "2026-03-09T18:54:04Z", + "benchmarks": { + "benchmark.less": { + "version": "3.5.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106712, + "fileSizeKB": 104.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 32.57, + "max": 50.01, + "avg": 38.55, + "median": 37.68, + "stddev": 3.96, + "variance_pct": 45.24, + "samples": 25, + "throughput_kbs": 2703 + } + } + } + }, + { + "tag": "v3.6.0", + "version": "3.6.0", + "node_version": "v18.20.8", + "date": "2026-03-09T18:54:10Z", + "benchmarks": { + "benchmark.less": { + "version": "3.6.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106712, + "fileSizeKB": 104.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 32.58, + "max": 44.99, + "avg": 36.81, + "median": 36.45, + "stddev": 3.29, + "variance_pct": 33.71, + "samples": 25, + "throughput_kbs": 2831 + } + }, + "benchmark-v3.less": { + "version": "3.6.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 1.41, + "max": 10.1, + "avg": 2.61, + "median": 1.97, + "stddev": 1.74, + "variance_pct": 333.37, + "samples": 25, + "throughput_kbs": 1213 + } + } + } + }, + { + "tag": "v3.7.0", + "version": "3.7.0", + "node_version": "v18.20.8", + "date": "2026-03-09T18:54:15Z", + "benchmarks": { + "benchmark.less": { + "version": "3.7.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106712, + "fileSizeKB": 104.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 35.95, + "max": 46.06, + "avg": 39.24, + "median": 38.01, + "stddev": 2.69, + "variance_pct": 25.77, + "samples": 25, + "throughput_kbs": 2656 + } + }, + "benchmark-v3.less": { + "version": "3.7.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 1.31, + "max": 9.52, + "avg": 2.63, + "median": 2.15, + "stddev": 1.69, + "variance_pct": 311.76, + "samples": 25, + "throughput_kbs": 1201 + } + }, + "benchmark-v37.less": { + "version": "3.7.0", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 1.18, + "max": 8.96, + "avg": 2.67, + "median": 1.95, + "stddev": 1.72, + "variance_pct": 291.4, + "samples": 25, + "throughput_kbs": 831 + } + } + } + }, + { + "tag": "v3.8.0", + "version": "3.8.0", + "node_version": "v18.20.8", + "date": "2026-03-09T18:54:21Z", + "benchmarks": { + "benchmark.less": { + "version": "3.8.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106712, + "fileSizeKB": 104.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 36.69, + "max": 45.5, + "avg": 39.95, + "median": 39.1, + "stddev": 2.52, + "variance_pct": 22.05, + "samples": 25, + "throughput_kbs": 2609 + } + }, + "benchmark-v3.less": { + "version": "3.8.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 1.49, + "max": 8.69, + "avg": 2.64, + "median": 2.09, + "stddev": 1.53, + "variance_pct": 273.14, + "samples": 25, + "throughput_kbs": 1200 + } + }, + "benchmark-v37.less": { + "version": "3.8.0", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 1.18, + "max": 7.68, + "avg": 2.58, + "median": 1.91, + "stddev": 1.45, + "variance_pct": 252.07, + "samples": 25, + "throughput_kbs": 860 + } + } + } + }, + { + "tag": "v3.9.0", + "version": "3.9.0", + "node_version": "v18.20.8", + "date": "2026-03-09T18:54:33Z", + "benchmarks": { + "benchmark.less": { + "version": "3.9.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106712, + "fileSizeKB": 104.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 32.62, + "max": 47.69, + "avg": 40.2, + "median": 39.67, + "stddev": 3.89, + "variance_pct": 37.47, + "samples": 25, + "throughput_kbs": 2592 + } + }, + "benchmark-v3.less": { + "version": "3.9.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 1.49, + "max": 8.91, + "avg": 2.56, + "median": 1.95, + "stddev": 1.55, + "variance_pct": 289.49, + "samples": 25, + "throughput_kbs": 1233 + } + }, + "benchmark-v37.less": { + "version": "3.9.0", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 1.2, + "max": 9.29, + "avg": 2.63, + "median": 2.03, + "stddev": 1.68, + "variance_pct": 307.32, + "samples": 25, + "throughput_kbs": 842 + } + }, + "benchmark-v39.less": { + "version": "3.9.0", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1554, + "fileSizeKB": 1.5, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 1.33, + "max": 11.52, + "avg": 3.12, + "median": 2.18, + "stddev": 2.18, + "variance_pct": 326.59, + "samples": 25, + "throughput_kbs": 486 + } + } + } + }, + { + "tag": "v3.10.0", + "version": "3.10.0", + "node_version": "v18.20.8", + "date": "2026-03-09T18:54:44Z", + "benchmarks": { + "benchmark.less": { + "version": "3.10.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106712, + "fileSizeKB": 104.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 103.26, + "max": 176.43, + "avg": 125.98, + "median": 125.46, + "stddev": 15.69, + "variance_pct": 58.08, + "samples": 25, + "throughput_kbs": 827 + } + }, + "benchmark-v3.less": { + "version": "3.10.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 2.67, + "max": 8.79, + "avg": 4.63, + "median": 4.18, + "stddev": 1.6, + "variance_pct": 132.21, + "samples": 25, + "throughput_kbs": 683 + } + }, + "benchmark-v37.less": { + "version": "3.10.0", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 3.31, + "max": 19.77, + "avg": 5.42, + "median": 4.64, + "stddev": 3.33, + "variance_pct": 303.98, + "samples": 25, + "throughput_kbs": 409 + } + }, + "benchmark-v39.less": { + "version": "3.10.0", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1554, + "fileSizeKB": 1.5, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 4.5, + "max": 21.31, + "avg": 7.16, + "median": 6.55, + "stddev": 3.01, + "variance_pct": 234.62, + "samples": 25, + "throughput_kbs": 212 + } + } + } + }, + { + "tag": "v3.11.0", + "version": "3.11.0", + "node_version": "v18.20.8", + "date": "2026-03-09T18:54:56Z", + "benchmarks": { + "benchmark.less": { + "version": "3.11.0", + "lessPath": ".", + "file": "benchmark.less", + "fileSize": 106712, + "fileSizeKB": 104.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 104.12, + "max": 154.95, + "avg": 122.9, + "median": 119.99, + "stddev": 12.94, + "variance_pct": 41.36, + "samples": 25, + "throughput_kbs": 848 + } + }, + "benchmark-v3.less": { + "version": "3.11.0", + "lessPath": ".", + "file": "benchmark-v3.less", + "fileSize": 3237, + "fileSizeKB": 3.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 2.84, + "max": 9.74, + "avg": 4.69, + "median": 4.33, + "stddev": 1.66, + "variance_pct": 146.96, + "samples": 25, + "throughput_kbs": 673 + } + }, + "benchmark-v37.less": { + "version": "3.11.0", + "lessPath": ".", + "file": "benchmark-v37.less", + "fileSize": 2270, + "fileSizeKB": 2.2, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 3.29, + "max": 14.99, + "avg": 5.88, + "median": 5.08, + "stddev": 2.63, + "variance_pct": 198.81, + "samples": 25, + "throughput_kbs": 377 + } + }, + "benchmark-v39.less": { + "version": "3.11.0", + "lessPath": ".", + "file": "benchmark-v39.less", + "fileSize": 1554, + "fileSizeKB": 1.5, + "totalRuns": 30, + "warmupRuns": 5, + "completedRuns": 30, + "render": { + "min": 9.79, + "max": 22.26, + "avg": 11.71, + "median": 11.12, + "stddev": 2.4, + "variance_pct": 106.47, + "samples": 25, + "throughput_kbs": 130 + } + } + } + }, + { + "tag": "v4.2.0", + "version": "4.2.0", + "node_version": "v20.19.6", + "date": "2026-03-09T18:55:29Z", + "benchmarks": { + "benchmark.less": { + "error": "Could not find Less compiler", + "tried": [ + "./packages/less", + ".", + "./lib/less-node", + "less" + ] + }, + "benchmark-v3.less": { + "error": "Could not find Less compiler", + "tried": [ + "./packages/less", + ".", + "./lib/less-node", + "less" + ] + }, + "benchmark-v37.less": { + "error": "Could not find Less compiler", + "tried": [ + "./packages/less", + ".", + "./lib/less-node", + "less" + ] + }, + "benchmark-v39.less": { + "error": "Could not find Less compiler", + "tried": [ + "./packages/less", + ".", + "./lib/less-node", + "less" + ] + } + } + } + ] +} diff --git a/packages/less/benchmark/run-and-compare.mjs b/packages/less/benchmark/run-and-compare.mjs new file mode 100644 index 0000000000..bbb2ef9f86 --- /dev/null +++ b/packages/less/benchmark/run-and-compare.mjs @@ -0,0 +1,208 @@ +#!/usr/bin/env node +/** + * Run benchmarks and compare against historical data. + */ + +import { execSync, spawn } from 'child_process'; +import { mkdirSync, readFileSync, writeFileSync, existsSync } from 'fs'; +import os from 'os'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const BENCH_DIR = __dirname; +const RESULTS_DIR = path.join(BENCH_DIR, 'results'); +const ALPHA_RUNS_DIR = path.join(RESULTS_DIR, 'alpha-runs'); +const ALPHA_LATEST_DIR = path.join(RESULTS_DIR, 'alpha-latest'); +const ALPHA_LATEST_FILE = path.join(ALPHA_LATEST_DIR, 'jess-alpha.json'); + +const DEFAULT_FILES = ['benchmark.less', 'benchmark-v3.less', 'benchmark-v37.less', 'benchmark-v39.less']; +const FILES = (process.env.BENCH_FILES || '') + .split(',') + .map(file => file.trim()) + .filter(Boolean); +if (FILES.length === 0) { + FILES.push(...DEFAULT_FILES); +} +const RUNS = parseInt(process.env.BENCH_RUNS || '30'); +const WARMUP = parseInt(process.env.BENCH_WARMUP || '5'); +const TIMEOUT_MS = parseInt(process.env.BENCH_TIMEOUT_MS || '0'); + +function currentSystemId() { + const hostname = os.hostname().split('.')[0].toLowerCase().replace(/[^a-zA-Z0-9_-]/g, '-'); + return `${hostname}_${os.arch()}`; +} + +const HISTORICAL_FILE = process.env.BENCH_HISTORICAL_FILE + ? path.resolve(process.env.BENCH_HISTORICAL_FILE) + : path.join(RESULTS_DIR, 'latest', `${currentSystemId()}.json`); + +function gitValue(cwd, args) { + try { + return execSync(`git ${args}`, { + cwd, + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'ignore'] + }).trim(); + } catch { + return null; + } +} + +function createAlphaSnapshot(results, historical) { + const timestamp = new Date().toISOString(); + return { + type: 'jess-alpha-benchmark-snapshot', + timestamp, + system: { + platform: process.platform, + arch: process.arch, + node: process.version + }, + benchmark: { + files: FILES, + runs: RUNS, + warmup: WARMUP, + timeoutMs: TIMEOUT_MS || null, + math: 'parens-division' + }, + repos: { + less: { + cwd: path.resolve(BENCH_DIR, '..', '..', '..'), + branch: gitValue(path.resolve(BENCH_DIR, '..', '..', '..'), 'branch --show-current'), + commit: gitValue(path.resolve(BENCH_DIR, '..', '..', '..'), 'rev-parse HEAD'), + dirty: gitValue(path.resolve(BENCH_DIR, '..', '..', '..'), 'status --short') ? true : false + }, + jess: { + cwd: path.resolve(BENCH_DIR, '..', '..', '..', '..', 'jess'), + branch: gitValue(path.resolve(BENCH_DIR, '..', '..', '..', '..', 'jess'), 'branch --show-current'), + commit: gitValue(path.resolve(BENCH_DIR, '..', '..', '..', '..', 'jess'), 'rev-parse HEAD'), + dirty: gitValue(path.resolve(BENCH_DIR, '..', '..', '..', '..', 'jess'), 'status --short') ? true : false + } + }, + results, + historicalLess45: historical + }; +} + +function saveAlphaSnapshot(snapshot) { + mkdirSync(ALPHA_RUNS_DIR, { recursive: true }); + mkdirSync(ALPHA_LATEST_DIR, { recursive: true }); + const stamp = snapshot.timestamp.replace(/[:.]/g, '-'); + const runFile = path.join(ALPHA_RUNS_DIR, `${stamp}_jess-alpha.json`); + const json = `${JSON.stringify(snapshot, null, 2)}\n`; + writeFileSync(runFile, json); + writeFileSync(ALPHA_LATEST_FILE, json); + return { runFile, latestFile: ALPHA_LATEST_FILE }; +} + +function runBenchmark(file) { + return new Promise((resolve, reject) => { + const proc = spawn('node', [ + path.join(BENCH_DIR, 'benchmark-runner.cjs'), + path.join(BENCH_DIR, file), + String(RUNS), + String(WARMUP), + '--math=parens-division' + ], { + cwd: path.join(BENCH_DIR, '..'), + stdio: ['ignore', 'pipe', 'pipe'] + }); + let timer; + if (TIMEOUT_MS > 0) { + timer = setTimeout(() => { + proc.kill('SIGTERM'); + reject(new Error(`benchmark timed out after ${TIMEOUT_MS}ms`)); + }, TIMEOUT_MS); + } + let out = ''; + let err = ''; + proc.stdout.on('data', d => { out += d; }); + proc.stderr.on('data', d => { err += d; }); + proc.on('close', code => { + if (timer) clearTimeout(timer); + if (code !== 0) { + reject(new Error(`benchmark-runner exited ${code}: ${err || out}`)); + return; + } + try { + resolve(JSON.parse(out.trim())); + } catch { + reject(new Error(`Failed to parse output: ${out}`)); + } + }); + }); +} + +function loadHistorical() { + if (!existsSync(HISTORICAL_FILE)) return null; + const data = JSON.parse(readFileSync(HISTORICAL_FILE, 'utf8')); + const v4 = data.versions?.find(v => v.version?.startsWith('4.5')) + || data.versions?.filter(v => v.version?.startsWith('4.')).pop(); + return v4?.benchmarks || null; +} + +async function main() { + console.log('Running benchmarks (Jess wrapper)...\n'); + const results = {}; + for (const file of FILES) { + process.stderr.write(` ${file}... `); + try { + const result = await runBenchmark(file); + results[file] = result; + if (result.render?.avg != null) { + process.stderr.write(`avg ${result.render.avg.toFixed(1)}ms\n`); + } else { + process.stderr.write('ERROR\n'); + } + } catch (error) { + results[file] = { error: error.message }; + process.stderr.write('ERROR\n'); + } + } + + const historical = loadHistorical(); + const snapshot = createAlphaSnapshot(results, historical); + const snapshotFiles = saveAlphaSnapshot(snapshot); + console.log('\n--- Comparison vs Less v4.5.x (historical) ---\n'); + const rows = FILES.map(file => { + const jess = results[file]; + const hist = historical?.[file]; + const jessAvg = jess?.render?.avg; + const histAvg = hist?.render?.avg; + const ratio = jessAvg && histAvg ? (jessAvg / histAvg).toFixed(1) : '-'; + const jessLabel = jessAvg != null + ? `${jessAvg.toFixed(1)}ms` + : (jess?.error || (Array.isArray(jess?.errors) && jess.errors.length > 0 + ? jess.errors[0]?.error || 'ERROR' + : '-')); + return { + file, + jess: jessLabel, + less: histAvg != null ? `${histAvg.toFixed(1)}ms` : '-', + ratio: histAvg ? `${ratio}x` : '-' + }; + }); + + const col = (s, w) => String(s).padEnd(w); + console.log(`${col('File', 22)} ${col('Jess (avg)', 12)} ${col('Less 4.5', 12)} ${col('Ratio', 8)}`); + console.log('-'.repeat(58)); + for (const row of rows) { + console.log(`${col(row.file, 22)} ${col(row.jess, 12)} ${col(row.less, 12)} ${col(row.ratio, 8)}`); + } + + if (historical) { + console.log(`\nHistorical data: ${HISTORICAL_FILE}`); + } else { + console.log(`\nNo current-host historical baseline found at ${HISTORICAL_FILE}.`); + console.log('Run benchmark/run-historical.sh on this machine, or set BENCH_HISTORICAL_FILE to compare explicitly.'); + } + console.log(`Alpha snapshot: ${snapshotFiles.runFile}`); + console.log(`Alpha latest: ${snapshotFiles.latestFile}`); + console.log('Compare ratios only when the historical baseline was recorded on comparable hardware.'); +} + +main().catch(error => { + console.error(error); + process.exit(1); +}); diff --git a/packages/less/benchmark/run-historical.sh b/packages/less/benchmark/run-historical.sh new file mode 100755 index 0000000000..68c9642821 --- /dev/null +++ b/packages/less/benchmark/run-historical.sh @@ -0,0 +1,469 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Historical Less Benchmark Runner +# Benchmarks every major/minor Less release from v2.0.0 through v4.4.x +# Uses git worktrees for isolation, fnm for Node version management. +# +# Usage: ./run-historical.sh [--versions "v2.0.0 v3.0.0 ..."] [--runs 30] [--warmup 5] +# +# Results are saved to benchmark/results/ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" +RESULTS_DIR="$SCRIPT_DIR/results" +RUNS_DIR="$RESULTS_DIR/runs" +LATEST_DIR="$RESULTS_DIR/latest" +WORKTREE_BASE="/tmp/less-bench-worktrees" +BENCHMARK_DIR="$SCRIPT_DIR" + +RUNS=30 +WARMUP=5 +NODE_FOR_OLD="v18.20.8" # v2.x/v3.x +NODE_FOR_NEW="v20.19.6" # v4.x +NODE_DEFAULT="" # will be set to current + +# Versions chosen to capture significant performance changes. +# Pruned from full v2.0–v4.5 benchmark data (2026-03-09, M4 Pro): +# Dropped v2.1 (broken), v2.5 (<1% from v2.4), v2.7 (<2% from v2.6), +# v3.6–v3.9 (all within 1ms of each other), v4.1 (<1% from v4.0). +# Use --versions to override with the full set if needed. +ALL_VERSIONS=( + v2.0.0 v2.2.0 v2.3.1 v2.4.0 v2.6.1 + v3.0.4 v3.5.3 v3.10.3 v3.11.3 v3.12.2 + v4.0.0 v4.2.2 v4.3.0 v4.4.2 v4.5.1 +) + +VERSIONS=("${ALL_VERSIONS[@]}") + +# Parse arguments +while [[ $# -gt 0 ]]; do + case $1 in + --versions) IFS=' ' read -ra VERSIONS <<< "$2"; shift 2 ;; + --runs) RUNS="$2"; shift 2 ;; + --warmup) WARMUP="$2"; shift 2 ;; + *) echo "Unknown option: $1"; exit 1 ;; + esac +done + +# Benchmark files and their minimum required versions (parallel arrays) +BENCH_FILE_NAMES=(benchmark.less benchmark-v3.less benchmark-v37.less benchmark-v39.less) +BENCH_FILE_MINVS=(2.0.0 3.6.0 3.7.0 3.9.0) + +# ----- Helpers ----- + +log() { echo "$(date '+%H:%M:%S') | $*"; } +err() { echo "$(date '+%H:%M:%S') | ERROR: $*" >&2; } + +version_ge() { + # Returns 0 if $1 >= $2 (semantic version comparison) + printf '%s\n%s' "$2" "$1" | sort -V -C +} + +strip_v() { echo "${1#v}"; } + +pick_node_version() { + local ver="$1" + local major="${ver%%.*}" + if [[ "$major" -ge 4 ]]; then + echo "$NODE_FOR_NEW" + else + echo "$NODE_FOR_OLD" + fi +} + +use_node() { + local nv="$1" + if command -v fnm &>/dev/null; then + fnm install "$nv" &>/dev/null || true + eval "$(fnm env --shell bash)" + fnm use "$nv" &>/dev/null + fi +} + +restore_node() { + if [[ -n "$NODE_DEFAULT" ]] && command -v fnm &>/dev/null; then + eval "$(fnm env --shell bash)" + fnm use "$NODE_DEFAULT" &>/dev/null + fi +} + +is_monorepo() { + local tag="$1" + git -C "$REPO_ROOT" show "$tag:packages/less/package.json" &>/dev/null 2>&1 +} + +get_system_info() { + python3 -c " +import json, platform, subprocess, datetime, re + +def run(cmd): + try: + return subprocess.check_output(cmd, shell=True, stderr=subprocess.DEVNULL).decode().strip() + except: + return 'unknown' + +hostname = platform.node() +arch = platform.machine() + +# Generate a stable, filesystem-safe system ID +system_id = re.sub(r'[^a-zA-Z0-9_-]', '-', hostname.split('.')[0].lower()) + '_' + arch + +info = { + 'system_id': system_id, + 'hostname': hostname, + 'platform': platform.system(), + 'arch': arch, + 'os_version': platform.release(), + 'cpus': run('sysctl -n hw.ncpu') if platform.system() == 'Darwin' else run('nproc'), + 'cpu_model': run('sysctl -n machdep.cpu.brand_string') if platform.system() == 'Darwin' else run(\"grep 'model name' /proc/cpuinfo | head -1 | cut -d: -f2\").strip(), + 'total_memory_gb': round(int(run('sysctl -n hw.memsize') or '0') / 1073741824, 1) if platform.system() == 'Darwin' else 'unknown', + 'node_version': run('node -v'), + 'date': datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ') +} +print(json.dumps(info, indent=2)) +" +} + +# ----- Setup ----- + +mkdir -p "$RUNS_DIR" "$LATEST_DIR" "$WORKTREE_BASE" +NODE_DEFAULT="$(node -v)" + +# Shared TypeScript compiler fallback (for versions where npm install can't get tsc) +TSC_FALLBACK_DIR="$WORKTREE_BASE/.tsc-fallback" +TSC_FALLBACK="" +ensure_tsc_fallback() { + if [[ -n "$TSC_FALLBACK" ]] && [[ -x "$TSC_FALLBACK" ]]; then + return 0 + fi + log "Installing shared TypeScript compiler fallback..." + mkdir -p "$TSC_FALLBACK_DIR" + (cd "$TSC_FALLBACK_DIR" && npm install typescript@4.9.5 2>/dev/null) || true + TSC_FALLBACK="$TSC_FALLBACK_DIR/node_modules/.bin/tsc" + if [[ -x "$TSC_FALLBACK" ]]; then + log "Fallback tsc ready: $TSC_FALLBACK" + return 0 + fi + err "Could not install fallback tsc" + return 1 +} + +# Record system info and derive system ID + run filename +log "Recording system info..." +SYSTEM_INFO_JSON="$(get_system_info)" +echo "$SYSTEM_INFO_JSON" + +SYSTEM_ID="$(echo "$SYSTEM_INFO_JSON" | python3 -c "import json,sys; print(json.load(sys.stdin)['system_id'])")" +RUN_STAMP="$(date -u +%Y-%m-%dT%H-%M-%SZ)" +RUN_FILE="$RUNS_DIR/${RUN_STAMP}_${SYSTEM_ID}.json" +LATEST_FILE="$LATEST_DIR/${SYSTEM_ID}.json" + +log "System ID: $SYSTEM_ID" +log "Run file: $RUN_FILE" + +# Initialize the run file (system info + empty results array) +python3 -c " +import json, sys +system_info = json.loads(sys.argv[1]) +run_data = {'system': system_info, 'versions': []} +print(json.dumps(run_data, indent=2)) +" "$SYSTEM_INFO_JSON" > "$RUN_FILE" + +# ----- Main Loop ----- + +total=${#VERSIONS[@]} +idx=0 + +for tag in "${VERSIONS[@]}"; do + idx=$((idx + 1)) + ver="$(strip_v "$tag")" + log "===== [$idx/$total] Benchmarking $tag =====" + + WORKTREE="$WORKTREE_BASE/$tag" + + # Verify tag exists + if ! git -C "$REPO_ROOT" rev-parse "$tag" &>/dev/null; then + err "Tag $tag not found, skipping" + continue + fi + + # Select Node version + node_ver="$(pick_node_version "$ver")" + log "Using Node $node_ver for $tag" + use_node "$node_ver" + log "Active Node: $(node -v)" + + # Create worktree + if [[ -d "$WORKTREE" ]]; then + log "Cleaning existing worktree $WORKTREE" + git -C "$REPO_ROOT" worktree remove --force "$WORKTREE" 2>/dev/null || rm -rf "$WORKTREE" + fi + + log "Creating worktree for $tag..." + git -C "$REPO_ROOT" worktree add --detach "$WORKTREE" "$tag" 2>/dev/null + + # Install dependencies + log "Installing dependencies..." + pushd "$WORKTREE" > /dev/null + + LESS_DIR="" + BENCH_TARGET="" + + if is_monorepo "$tag"; then + # Monorepo era (v4.x) + LESS_DIR="$WORKTREE/packages/less" + BENCH_TARGET="$LESS_DIR/benchmark" + + # v4.3+ uses workspace: protocol requiring pnpm; earlier v4.x uses npm + if grep -q '"workspace:' "$LESS_DIR/package.json" 2>/dev/null || \ + grep -q '"workspace:' "$WORKTREE/package.json" 2>/dev/null; then + log "Detected workspace: protocol, using pnpm..." + if command -v pnpm &>/dev/null; then + (cd "$WORKTREE" && pnpm install --ignore-scripts 2>/dev/null) || true + else + err "pnpm not available but needed for $tag workspace: deps" + # Fallback: install just typescript in packages/less + (cd "$LESS_DIR" && npm install typescript --no-save 2>/dev/null) || true + fi + else + # npm-based install for older v4.x / v3.12+ + npm install --ignore-scripts --legacy-peer-deps 2>/dev/null || true + pushd "$LESS_DIR" > /dev/null + npm install --ignore-scripts --legacy-peer-deps 2>/dev/null || { + # npm install often fails on monorepo versions due to unpublished workspace + # packages (e.g. @less/test-import-module). Install runtime deps separately. + log "npm install failed, installing runtime deps separately..." + runtime_deps=$(python3 -c " +import json +with open('package.json') as f: + d = json.load(f) +deps = d.get('dependencies', {}) +# Print package@range pairs +for name, ver in deps.items(): + if not name.startswith('@less/'): + print(name + '@' + ver.lstrip('^~')) +" 2>/dev/null) + if [[ -n "$runtime_deps" ]]; then + deps_temp="$WORKTREE_BASE/.deps-temp" + mkdir -p "$deps_temp" + (cd "$deps_temp" && npm install $runtime_deps 2>/dev/null) || true + mkdir -p node_modules + # Copy all installed packages (including transitive deps) into node_modules + if [[ -d "$deps_temp/node_modules" ]]; then + cp -r "$deps_temp"/node_modules/* node_modules/ 2>/dev/null || true + # Also copy @scoped packages + for scope_dir in "$deps_temp"/node_modules/@*/; do + if [[ -d "$scope_dir" ]]; then + scope_name="$(basename "$scope_dir")" + mkdir -p "node_modules/$scope_name" + cp -r "$scope_dir"*/ "node_modules/$scope_name/" 2>/dev/null || true + fi + done + fi + fi + } + popd > /dev/null + fi + + # Build TypeScript + pushd "$LESS_DIR" > /dev/null + log "Building TypeScript..." + if [[ -f "tsconfig.build.json" ]] || [[ -f "tsconfig.json" ]]; then + # Find tsc: check local, root, system, then shared fallback + TSC="" + for tsc_path in \ + "./node_modules/.bin/tsc" \ + "$WORKTREE/node_modules/.bin/tsc"; do + if [[ -x "$tsc_path" ]]; then + TSC="$tsc_path" + break + fi + done + + if [[ -z "$TSC" ]]; then + # Try installing locally first + npm install typescript --no-save 2>/dev/null || true + if [[ -x "./node_modules/.bin/tsc" ]]; then + TSC="./node_modules/.bin/tsc" + else + # Use shared fallback tsc + ensure_tsc_fallback && TSC="$TSC_FALLBACK" + fi + fi + + if [[ -n "$TSC" ]] && [[ -x "$TSC" ]]; then + TSCONFIG="tsconfig.build.json" + [[ -f "$TSCONFIG" ]] || TSCONFIG="tsconfig.json" + + $TSC -p "$TSCONFIG" 2>/dev/null || { + log "Retrying tsc with --skipLibCheck..." + $TSC --skipLibCheck -p "$TSCONFIG" 2>/dev/null || { + err "Build failed completely for $tag, skipping" + popd > /dev/null + popd > /dev/null + git -C "$REPO_ROOT" worktree remove --force "$WORKTREE" 2>/dev/null || true + continue + } + } + else + err "No tsc available for $tag, skipping" + popd > /dev/null + popd > /dev/null + git -C "$REPO_ROOT" worktree remove --force "$WORKTREE" 2>/dev/null || true + continue + fi + fi + popd > /dev/null + else + # Pre-monorepo (v2.x, v3.x) - lib/ is already in git + LESS_DIR="$WORKTREE" + BENCH_TARGET="$WORKTREE/benchmark" + npm install --ignore-scripts --legacy-peer-deps 2>/dev/null || true + fi + popd > /dev/null + + # Copy benchmark files and runner into the worktree + mkdir -p "$BENCH_TARGET" + cp "$BENCHMARK_DIR/benchmark-runner.js" "$BENCH_TARGET/" + cp "$BENCHMARK_DIR/benchmark.less" "$BENCH_TARGET/" + cp "$BENCHMARK_DIR/benchmark-import-target.less" "$BENCH_TARGET/" + cp "$BENCHMARK_DIR/benchmark-import-reference-target.less" "$BENCH_TARGET/" + cp "$BENCHMARK_DIR/benchmark-v3.less" "$BENCH_TARGET/" 2>/dev/null || true + cp "$BENCHMARK_DIR/benchmark-v37.less" "$BENCH_TARGET/" 2>/dev/null || true + cp "$BENCHMARK_DIR/benchmark-v39.less" "$BENCH_TARGET/" 2>/dev/null || true + + # Run benchmarks for applicable files + CURRENT_NODE="$(node -v)" + CURRENT_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" + + # Initialize tag JSON via python for safety + tag_json=$(python3 -c " +import json +print(json.dumps({ + 'tag': '$tag', + 'version': '$ver', + 'node_version': '$CURRENT_NODE', + 'date': '$CURRENT_DATE', + 'benchmarks': {} +})) +") + + bench_count=${#BENCH_FILE_NAMES[@]} + for (( bi=0; bi= $min_ver)" + continue + fi + + bench_path="$BENCH_TARGET/$bench_file" + if [[ ! -f "$bench_path" ]]; then + log " Skipping $bench_file (file not found)" + continue + fi + + log " Running $bench_file ($RUNS runs, $WARMUP warmup)..." + + # Run from the Less package directory so require() finds the compiler + # Save result to temp file to avoid shell quoting issues + result_file=$(mktemp) + # Force parens-division explicitly for cross-version consistency without + # treating CSS slash syntax as arithmetic. + (cd "$LESS_DIR" && node "$BENCH_TARGET/benchmark-runner.js" "$bench_path" "$RUNS" "$WARMUP" --math=parens-division > "$result_file" 2>&1) || true + + # Use python to safely merge results + tag_json=$(python3 -c " +import sys, json + +tag_data = json.loads(sys.stdin.read()) +bench_file = sys.argv[1] +result_file = sys.argv[2] + +try: + with open(result_file) as f: + result_str = f.read().strip() + result_data = json.loads(result_str) + tag_data['benchmarks'][bench_file] = result_data + print(json.dumps(tag_data)) +except (json.JSONDecodeError, Exception) as e: + tag_data['benchmarks'][bench_file] = {'error': str(e)[:500]} + print(json.dumps(tag_data)) +" "$bench_file" "$result_file" <<< "$tag_json") + + if python3 -c "import json; json.load(open('$result_file'))" 2>/dev/null; then + log " Done $bench_file" + else + err " $bench_file failed: $(head -5 "$result_file")" + fi + rm -f "$result_file" + done + + # Append version results to run file + python3 -c " +import json, sys + +tag_data = json.loads(sys.stdin.read()) +run_file = sys.argv[1] +with open(run_file) as f: + run_data = json.load(f) +run_data['versions'].append(tag_data) +with open(run_file, 'w') as f: + json.dump(run_data, f, indent=2) +" "$RUN_FILE" <<< "$tag_json" + log "Results appended to $RUN_FILE" + + # Clean up worktree + log "Cleaning up worktree..." + git -C "$REPO_ROOT" worktree remove --force "$WORKTREE" 2>/dev/null || rm -rf "$WORKTREE" + + log "===== Done $tag =====" + echo "" +done + +# Restore original Node version +restore_node + +# Copy to latest +cp "$RUN_FILE" "$LATEST_FILE" +log "Latest results: $LATEST_FILE" + +# Generate summary +log "Generating summary..." +python3 - "$RUN_FILE" << 'PYEOF' +import json, sys + +with open(sys.argv[1]) as f: + run_data = json.load(f) + +system = run_data.get('system', {}) +print("\n" + "=" * 80) +print("LESS HISTORICAL BENCHMARK SUMMARY") +print(f"System: {system.get('cpu_model', '?')} | {system.get('arch', '?')} | {system.get('total_memory_gb', '?')} GB") +print(f"Date: {system.get('date', '?')}") +print("=" * 80) +print(f"\n{'Version':<12} {'Node':<12} {'File':<25} {'Avg (ms)':<12} {'Median':<12} {'Min':<10} {'Max':<10} {'+-pct':<8} {'KB/s':<8}") +print("-" * 110) + +for entry in run_data.get('versions', []): + tag = entry.get('tag', '?') + node = entry.get('node_version', '?') + for bench_name, bench_data in entry.get('benchmarks', {}).items(): + if 'error' in bench_data: + print(f"{tag:<12} {node:<12} {bench_name:<25} {'ERROR':>10}") + continue + render = bench_data.get('render') + if not render: + print(f"{tag:<12} {node:<12} {bench_name:<25} {'NO DATA':>10}") + continue + print(f"{tag:<12} {node:<12} {bench_name:<25} {render['avg']:>10.1f} {render['median']:>10.1f} {render['min']:>8.1f} {render['max']:>8.1f} {render['variance_pct']:>6.1f}% {render.get('throughput_kbs', 0):>6}") + +print("\n" + "=" * 80) +PYEOF + +log "All benchmarks complete! Results in $RESULTS_DIR/" +log " - This run: $RUN_FILE" +log " - Latest: $LATEST_FILE" +log " - All runs: $RUNS_DIR/" diff --git a/packages/less/bin/lessc b/packages/less/bin/lessc index 3106652501..8ac8484e1c 100755 --- a/packages/less/bin/lessc +++ b/packages/less/bin/lessc @@ -1,664 +1,238 @@ #!/usr/bin/env node -/* eslint indent: [2, 2, {"SwitchCase": 1}] */ - -'use strict'; - -var path = require('path'); -var fs = require('../lib/less-node/fs').default; -var os = require('os'); -var utils = require('../lib/less/utils'); -var Constants = require('../lib/less/constants'); - -var less = require('../lib/less-node').default; - -var errno; -var mkdirp; +/** + * Less compiler (Jess-powered) — compiles .less files to CSS. + */ + +import path from 'path'; +import fs from 'fs'; +import less from '../lib/index.js'; +import { version as versionInfo } from '../lib/version.js'; +import { outputDiagnostics } from '@jesscss/compiler/diagnostics'; + +const args = process.argv.slice(1); +let options = { paths: [], filename: '' }; +let input = null; +let output = null; +let silent = false; +let quiet = false; +let verbose = false; + +const unsupportedOptions = new Map([ + ['--source-map', 'source maps are not supported'], + ['--source-map-map-inline', 'source maps are not supported'], + ['--source-map-include-source', 'source maps are not supported'], + ['--source-map-rootpath', 'source maps are not supported'], + ['--source-map-basepath', 'source maps are not supported'], + ['--source-map-url', 'source maps are not supported'], + ['--plugin', 'legacy lessc plugin flags are not supported'], + ['--depends', 'dependency-only output is not supported'], + ['--lint', 'lint-only mode is not supported'], + ['--compress', 'compressed output is not supported'], + ['-x', 'compressed output is not supported'], + ['--clean-css', 'clean-css compression is not supported'], + ['--rewrite-urls', 'URL rewriting is not supported'], + ['--rootpath', 'URL rootpath rewriting is not supported'], + ['--url-args', 'URL argument rewriting is not supported'], + ['--global-var', 'global variable injection is not supported'], + ['--modify-var', 'modify-var injection is not supported'], + ['--js', 'JavaScript evaluation is not supported'], + ['--no-js', 'JavaScript evaluation flags are not supported'], + ['--strict-units', 'strict unit mode is not supported'], +]); + +function stripTerminalFormatting(value) { + return String(value) + .replace(/\x1B\]8;;[^\x1B]*(?:\x1B\\|\x07)/gu, '') + .replace(/\x1B\[[0-?]*[ -/]*[@-~]/gu, ''); +} -try { - errno = require('errno'); -} catch (err) { - errno = null; +function renderLogMessage(value) { + const message = String(value); + return options.color === false ? stripTerminalFormatting(message) : message; } -var pluginManager = new less.PluginManager(less); -var fileManager = new less.FileManager(); -var plugins = []; -var queuePlugins = []; -var args = process.argv.slice(1); -var silent = false; -var quiet = false; -var verbose = false; -var options = less.options; -options.plugins = plugins; -options.reUsePluginManager = true; -var sourceMapOptions = {}; -var continueProcessing = true; +function captureJessDiagnostics(errors, warnings) { + const originalStdoutWrite = process.stdout.write; + const originalWrite = process.stderr.write; + let captured = ''; + const captureDiagnosticWrite = function captureDiagnosticWrite(chunk, ...args) { + captured += String(chunk); + if (typeof args.at(-1) === 'function') { + args.at(-1)(); + } + return true; + }; + process.stdout.write = captureDiagnosticWrite; + process.stderr.write = captureDiagnosticWrite; + try { + outputDiagnostics(errors, warnings, { + suppressWarnings: quiet, + breakOnError: false, + verbose + }); + } finally { + process.stdout.write = originalStdoutWrite; + process.stderr.write = originalWrite; + } + return options.color === false ? stripTerminalFormatting(captured) : captured; +} -var checkArgFunc = function checkArgFunc(arg, option) { - if (!option) { - console.error(''.concat(arg, ' option requires a parameter')); - continueProcessing = false; - process.exitCode = 1; +function outputJessDiagnostics(errors, warnings = []) { + const relevantWarnings = quiet ? [] : warnings; + if ((!Array.isArray(errors) || errors.length === 0) && relevantWarnings.length === 0) { return false; } - + process.stderr.write(captureJessDiagnostics(errors || [], relevantWarnings)); return true; -}; - -var checkBooleanArg = function checkBooleanArg(arg) { - var onOff = /^((on|t|true|y|yes)|(off|f|false|n|no))$/i.exec(arg); +} - if (!onOff) { - console.error(' unable to parse '.concat(arg, ' as a boolean. use one of on/t/true/y/yes/off/f/false/n/no')); - continueProcessing = false; - process.exitCode = 1; +function outputJessError(err) { + if (!Array.isArray(err?.jessErrors) || err.jessErrors.length === 0) { return false; } + outputJessDiagnostics(err.jessErrors, err.jessWarnings || []); + return true; +} - return Boolean(onOff[2]); -}; - -var parseVariableOption = function parseVariableOption(option, variables) { - var parts = option.split('=', 2); - variables[parts[0]] = parts[1]; -}; +function splitSearchPaths(value) { + return String(value || '') + .split(path.delimiter) + .filter(Boolean); +} -var sourceMapFileInline = false; +function failUnsupportedOption(arg, reason) { + console.error(`lessc: ${arg} is not supported`); + if (reason) { + console.error(`lessc: ${reason}`); + } + console.error('lessc: run `lessc --help` for supported options.'); + process.exit(1); +} function printUsage() { less.lesscHelper.printUsage(); - - pluginManager.Loader.printUsage(plugins); - continueProcessing = false; + process.exit(0); } -function render() { - if (!continueProcessing) { - return; - } - - var input = args[1]; - - if (input && input != '-') { - input = path.resolve(process.cwd(), input); - } - - var output = args[2]; - var outputbase = args[2]; - - if (output) { - output = path.resolve(process.cwd(), output); - } - - if (options.disablePluginRule && queuePlugins.length > 0) { - console.error('--plugin and --disable-plugin-rule may not be used at the same time'); - process.exitCode = 1; - return; - } - - if (options.sourceMap) { - // Validate conflicting options - if (sourceMapOptions.sourceMapURL && sourceMapOptions.disableSourcemapAnnotation) { - console.error('You cannot provide flag --source-map-url with --source-map-no-annotation.'); - console.error('Please remove one of those flags.'); - process.exitcode = 1; - return; +function parseArgs() { + for (let i = 0; i < args.length; i++) { + const arg = args[i]; + if (arg === '-h' || arg === '--help') { + printUsage(); } - - // Handle explicit sourceMapFullFilename (from --source-map=filename) - // Normalization of other options (sourceMapBasepath, sourceMapRootpath, etc.) - // is handled automatically in parse-tree.js - if (sourceMapOptions.sourceMapFullFilename && !sourceMapFileInline) { - var mapFilename = path.resolve(process.cwd(), sourceMapOptions.sourceMapFullFilename); - var mapDir = path.dirname(mapFilename); - - if (output) { - var outputDir = path.dirname(output); - // Set sourceMapOutputFilename relative to map directory - sourceMapOptions.sourceMapOutputFilename = path.join( - path.relative(mapDir, outputDir), - path.basename(output) - ); - // Set sourceMapFilename relative to output directory (for sourceMappingURL comment) - sourceMapOptions.sourceMapFilename = path.join( - path.relative(outputDir, mapDir), - path.basename(sourceMapOptions.sourceMapFullFilename) - ); - } else { - // No output filename, just use basename - sourceMapOptions.sourceMapOutputFilename = path.basename(output || 'output.css'); - sourceMapOptions.sourceMapFilename = path.basename(sourceMapOptions.sourceMapFullFilename); - } - } else if (!sourceMapOptions.sourceMapFullFilename && output && !sourceMapFileInline) { - // No explicit sourcemap filename, derive from output - sourceMapOptions.sourceMapOutputFilename = path.basename(output); - sourceMapOptions.sourceMapFullFilename = ''.concat(output, '.map'); - } else if (!output && !sourceMapFileInline) { - console.error('the sourcemap option only has an optional filename if the css filename is given'); - console.error('consider adding --source-map-map-inline which embeds the sourcemap into the css'); - process.exitCode = 1; - return; + if (arg === '-v' || arg === '--version') { + console.log(`lessc ${versionInfo.semver} (Less Compiler) [Jess]`); + process.exit(0); } - } - - if (!input) { - console.error('lessc: no input files'); - console.error(''); - printUsage(); - process.exitCode = 1; - return; - } - - var ensureDirectory = function ensureDirectory(filepath) { - var dir = path.dirname(filepath); - var cmd; - var existsSync = fs.existsSync || path.existsSync; - - if (!existsSync(dir)) { - if (mkdirp === undefined) { - try { - mkdirp = require('make-dir'); - } catch (e) { - mkdirp = null; - } - } - - cmd = mkdirp && mkdirp.sync || fs.mkdirSync; - cmd(dir); + if (arg === '-s' || arg === '--silent') { + silent = true; + continue; } - }; - - if (options.depends) { - if (!outputbase) { - console.error('option --depends requires an output path to be specified'); - process.exitCode = 1; - return; + if (arg === '--quiet') { + quiet = true; + continue; } - - process.stdout.write(''.concat(outputbase, ': ')); - } - - if (!sourceMapFileInline) { - var writeSourceMap = function writeSourceMap() { - var output = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - var onDone = arguments.length > 1 ? arguments[1] : undefined; - var filename = sourceMapOptions.sourceMapFullFilename; - ensureDirectory(filename); - - // To fix https://github.com/less/less.js/issues/3646 - output = output.toString(); - - fs.writeFile(filename, output, 'utf8', function (err) { - if (err) { - var description = 'Error: '; - - if (errno && errno.errno[err.errno]) { - description += errno.errno[err.errno].description; - } else { - description += ''.concat(err.code, ' ').concat(err.message); - } - - console.error('lessc: failed to create file '.concat(filename)); - console.error(description); - process.exitCode = 1; - } else { - less.logger.info('lessc: wrote '.concat(filename)); - } - - onDone(); - }); - }; - } - - var writeSourceMapIfNeeded = function writeSourceMapIfNeeded(output, onDone) { - if (options.sourceMap && !sourceMapFileInline) { - writeSourceMap(output, onDone); - } else { - onDone(); + if (arg === '--verbose') { + verbose = true; + continue; } - }; - - var writeOutput = function writeOutput(output, result, onSuccess) { - if (options.depends) { - onSuccess(); - } else if (output) { - ensureDirectory(output); - - fs.writeFile(output, result.css, { - encoding: 'utf8' - }, function (err) { - if (err) { - var description = 'Error: '; - - if (errno && errno.errno[err.errno]) { - description += errno.errno[err.errno].description; - } else { - description += ''.concat(err.code, ' ').concat(err.message); - } - - console.error('lessc: failed to create file '.concat(output)); - console.error(description); - process.exitCode = 1; - } else { - less.logger.info('lessc: wrote '.concat(output)); - - onSuccess(); - } - }); - } else if (!options.depends) { - process.stdout.write(result.css); - onSuccess(); + if (arg === '--collapse-nesting') { + options.collapseNesting = true; + continue; } - }; - - var logDependencies = function logDependencies(options, result) { - if (options.depends) { - var depends = ''; - - for (var i = 0; i < result.imports.length; i++) { - depends += ''.concat(result.imports[i], ' '); - } - - console.log(depends); + const optionName = arg.includes('=') ? arg.slice(0, arg.indexOf('=')) : arg; + if (unsupportedOptions.has(optionName)) { + failUnsupportedOption(optionName, unsupportedOptions.get(optionName)); } - }; - - var parseLessFile = function parseLessFile(e, data) { - if (e) { - console.error('lessc: '.concat(e.message)); - process.exitCode = 1; - return; + if (arg === '-I' || arg === '--include-path') { + const match = arg.match(/^-I(.+)$/); + const paths = splitSearchPaths(match ? match[1] : args[++i]); + options.paths.push(...paths); + continue; } - - data = data.replace(/^\uFEFF/, ''); - options.paths = [path.dirname(input)].concat(options.paths); - options.filename = input; - - if (options.lint) { - options.sourceMap = false; + if (arg.startsWith('-I')) { + options.paths.push(...splitSearchPaths(arg.slice(2))); + continue; } - - sourceMapOptions.sourceMapFileInline = sourceMapFileInline; - - if (options.sourceMap) { - options.sourceMap = sourceMapOptions; + const includeMatch = arg.match(/^--include-path=(.+)$/); + if (includeMatch) { + options.paths.push(...splitSearchPaths(includeMatch[1])); + continue; } - - less.logger.addListener({ - info: function info(msg) { - if (verbose) { - console.log(msg); - } - }, - warn: function warn(msg) { - // do not show warning if the silent option is used - if (!silent && !quiet) { - console.warn(msg); - } - }, - error: function error(msg) { - if (!silent) { - console.error(msg); - } - } - }); - - less.render(data, options).then(function (result) { - if (!options.lint) { - writeOutput(output, result, function () { - writeSourceMapIfNeeded(result.map, function () { - logDependencies(options, result); - }); - }); - } - }, function (err) { - if (!options.silent) { - console.error(err.toString({ - stylize: options.color && less.lesscHelper.stylize - })); + if (arg === '--no-color') { + options.color = false; + continue; + } + if (arg === '-' || arg.endsWith('.less') || arg.endsWith('.css')) { + if (input === null) { + input = arg === '-' ? '-' : path.resolve(process.cwd(), arg); + } else if (output === null) { + output = path.resolve(process.cwd(), arg); } - - process.exitCode = 1; - }); - }; - - if (input != '-') { - fs.readFile(input, 'utf8', parseLessFile); - } else { - process.stdin.resume(); - process.stdin.setEncoding('utf8'); - var buffer = ''; - process.stdin.on('data', function (data) { - buffer += data; - }); - process.stdin.on('end', function () { - parseLessFile(false, buffer); - }); + continue; + } + if (arg.startsWith('-')) { + failUnsupportedOption(arg, 'unknown flags are not supported'); + } } } -function processPluginQueue() { - var x = 0; +async function run() { + parseArgs(); - function pluginError(name) { - console.error('Unable to load plugin '.concat(name, ' please make sure that it is installed under or at the same level as less')); - process.exitCode = 1; - } - - function pluginFinished(plugin) { - x++; - plugins.push(plugin); - - if (x === queuePlugins.length) { - render(); - } + if (!input) { + console.error('lessc: no input files'); + console.error(''); + printUsage(); } - queuePlugins.forEach(function (queue) { - var context = utils.clone(options); - pluginManager.Loader.loadPlugin(queue.name, process.cwd(), context, less.environment, fileManager).then(function (data) { - pluginFinished({ - fileContent: data.contents, - filename: data.filename, - options: queue.options - }); - }).catch(function () { - pluginError(queue.name); - }); + less.logger.addListener({ + info(msg) { + if (verbose) console.log(msg); + }, + warn(msg) { + if (!silent && !quiet) console.warn(renderLogMessage(msg)); + }, + error(msg) { + if (!silent) console.error(renderLogMessage(msg)); + }, }); -} // self executing function so we can return - -(function () { - args = args.filter(function (arg) { - var match; - match = arg.match(/^-I(.+)$/); - - if (match) { - options.paths.push(match[1]); - return false; + try { + let result; + if (input === '-') { + const data = await new Promise((resolve, reject) => { + let buf = ''; + process.stdin.setEncoding('utf8'); + process.stdin.on('data', chunk => { buf += chunk; }); + process.stdin.on('end', () => resolve(buf)); + process.stdin.on('error', reject); + }); + result = await less.render(data, { ...options, filename: 'input.less' }); + } else { + options.filename = input; + options.paths = [path.dirname(input), ...options.paths]; + result = await less.renderFile(input, options); } - match = arg.match(/^--?([a-z][0-9a-z-]*)(?:=(.*))?$/i); - - if (match) { - arg = match[1]; + if (output) { + fs.mkdirSync(path.dirname(output), { recursive: true }); + fs.writeFileSync(output, result.css, 'utf8'); + if (!silent) outputJessDiagnostics([], result.warnings || []); + if (!silent) console.log(`lessc: wrote ${output}`); } else { - return arg; + if (!silent) outputJessDiagnostics([], result.warnings || []); + process.stdout.write(result.css); } - - switch (arg) { - case 'v': - case 'version': - console.log('lessc '.concat(less.version.join('.'), ' (Less Compiler) [JavaScript]')); - continueProcessing = false; - break; - - case 'verbose': - options.verbose = verbose = true; - break; - - case 's': - case 'silent': - options.silent = silent = true; - break; - - case 'quiet': - options.quiet = quiet = true; - break; - - case 'l': - case 'lint': - options.lint = true; - break; - - case 'strict-imports': - options.strictImports = true; - break; - - case 'h': - case 'help': - printUsage(); - break; - - case 'x': - case 'compress': - options.compress = true; - break; - - case 'insecure': - options.insecure = true; - break; - - case 'M': - case 'depends': - options.depends = true; - break; - - case 'max-line-len': - if (checkArgFunc(arg, match[2])) { - options.maxLineLen = parseInt(match[2], 10); - - if (options.maxLineLen <= 0) { - options.maxLineLen = -1; - } - } - - break; - - case 'no-color': - options.color = false; - break; - - case 'js': - options.javascriptEnabled = true; - break; - - case 'no-js': - // eslint-disable-next-line max-len - console.error('The "--no-js" argument is deprecated, as inline JavaScript is disabled by default. Use "--js" to enable inline JavaScript (not recommended).'); - break; - - case 'include-path': - if (checkArgFunc(arg, match[2])) { - // ; supported on windows. - // : supported on windows and linux, excluding a drive letter like C:\ so C:\file:D:\file parses to 2 - options.paths = match[2].split(os.type().match(/Windows/) ? /:(?!\\)|;/ : ':').map(function (p) { - if (p) { - return path.resolve(process.cwd(), p); - } - }); - } - - break; - - case 'line-numbers': - if (checkArgFunc(arg, match[2])) { - options.dumpLineNumbers = match[2]; - } - - break; - - case 'source-map': - options.sourceMap = true; - - if (match[2]) { - sourceMapOptions.sourceMapFullFilename = match[2]; - } - - break; - - case 'source-map-rootpath': - if (checkArgFunc(arg, match[2])) { - sourceMapOptions.sourceMapRootpath = match[2]; - } - - break; - - case 'source-map-basepath': - if (checkArgFunc(arg, match[2])) { - sourceMapOptions.sourceMapBasepath = match[2]; - } - - break; - - case 'source-map-inline': - case 'source-map-map-inline': - sourceMapFileInline = true; - options.sourceMap = true; - break; - - case 'source-map-include-source': - case 'source-map-less-inline': - sourceMapOptions.outputSourceFiles = true; - break; - - case 'source-map-url': - if (checkArgFunc(arg, match[2])) { - sourceMapOptions.sourceMapURL = match[2]; - } - - break; - - case 'source-map-no-annotation': - sourceMapOptions.disableSourcemapAnnotation = true; - break; - - case 'rp': - case 'rootpath': - if (checkArgFunc(arg, match[2])) { - options.rootpath = match[2].replace(/\\/g, '/'); - } - - break; - - case 'ie-compat': - console.warn('The --ie-compat option is deprecated, as it has no effect on compilation.'); - break; - - case 'relative-urls': - console.warn('The --relative-urls option has been deprecated. Use --rewrite-urls=all.'); - options.rewriteUrls = Constants.RewriteUrls.ALL; - break; - - case 'ru': - case 'rewrite-urls': - var m = match[2]; - - if (m) { - if (m === 'local') { - options.rewriteUrls = Constants.RewriteUrls.LOCAL; - } else if (m === 'off') { - options.rewriteUrls = Constants.RewriteUrls.OFF; - } else if (m === 'all') { - options.rewriteUrls = Constants.RewriteUrls.ALL; - } else { - console.error('Unknown rewrite-urls argument '.concat(m)); - continueProcessing = false; - process.exitCode = 1; - } - } else { - options.rewriteUrls = Constants.RewriteUrls.ALL; - } - - break; - - case 'sm': - case 'strict-math': - console.warn('The --strict-math option has been deprecated. Use --math=strict.'); - - if (checkArgFunc(arg, match[2])) { - if (checkBooleanArg(match[2])) { - options.math = Constants.Math.PARENS; - } - } - - break; - - case 'm': - case 'math': { - let m = match[2]; - if (checkArgFunc(arg, m)) { - if (m === 'always') { - console.warn('--math=always is deprecated and will be removed in the future.'); - options.math = Constants.Math.ALWAYS; - } else if (m === 'parens-division') { - options.math = Constants.Math.PARENS_DIVISION; - } else if (m === 'parens' || m === 'strict') { - options.math = Constants.Math.PARENS; - } else if (m === 'strict-legacy') { - console.warn('--math=strict-legacy has been removed. Defaulting to --math=strict'); - options.math = Constants.Math.PARENS; - } - } - - break; + } catch (err) { + if (!silent) { + if (!outputJessError(err)) { + console.error(renderLogMessage(err.toString?.() || err.message)); } - case 'su': - case 'strict-units': - if (checkArgFunc(arg, match[2])) { - options.strictUnits = checkBooleanArg(match[2]); - } - - break; - - case 'global-var': - if (checkArgFunc(arg, match[2])) { - if (!options.globalVars) { - options.globalVars = {}; - } - - parseVariableOption(match[2], options.globalVars); - } - - break; - - case 'modify-var': - if (checkArgFunc(arg, match[2])) { - if (!options.modifyVars) { - options.modifyVars = {}; - } - - parseVariableOption(match[2], options.modifyVars); - } - - break; - - case 'url-args': - if (checkArgFunc(arg, match[2])) { - options.urlArgs = match[2]; - } - - break; - - case 'plugin': - var splitupArg = match[2].match(/^([^=]+)(=(.*))?/); - var name = splitupArg[1]; - var pluginOptions = splitupArg[3]; - queuePlugins.push({ - name: name, - options: pluginOptions - }); - break; - - case 'disable-plugin-rule': - options.disablePluginRule = true; - break; - - default: - queuePlugins.push({ - name: arg, - options: match[2], - default: true - }); - break; } - }); - - if (queuePlugins.length > 0) { - processPluginQueue(); - } else { - render(); + process.exitCode = 1; } -})(); \ No newline at end of file +} + +run(); diff --git a/packages/less/bower.json b/packages/less/bower.json index 8fa190fc03..3e94e44fd9 100644 --- a/packages/less/bower.json +++ b/packages/less/bower.json @@ -11,7 +11,6 @@ "test", "*.md", "LICENSE", - "Gruntfile.js", "*.json", "*.yml", ".gitattributes", diff --git a/packages/less/build/banner.js b/packages/less/build/banner.js index 44074aac67..4557b6a23f 100644 --- a/packages/less/build/banner.js +++ b/packages/less/build/banner.js @@ -1,10 +1,13 @@ +import { createRequire } from 'module'; + +const require = createRequire(import.meta.url); const pkg = require('./../package.json'); -module.exports = +export default `/** * Less - ${ pkg.description } v${ pkg.version } * http://lesscss.org - * + * * Copyright (c) 2009-${new Date().getFullYear()}, ${ pkg.author.name } <${ pkg.author.email }> * Licensed under the ${ pkg.license } License. * diff --git a/packages/less/build/rollup.js b/packages/less/build/rollup.js index f079f14006..97381aa792 100644 --- a/packages/less/build/rollup.js +++ b/packages/less/build/rollup.js @@ -1,88 +1,115 @@ -const rollup = require('rollup'); -const typescript = require('rollup-plugin-typescript2'); -const commonjs = require('@rollup/plugin-commonjs'); -const json = require('@rollup/plugin-json'); -const resolve = require('@rollup/plugin-node-resolve').nodeResolve; -const terser = require('rollup-plugin-terser').terser; -const banner = require('./banner'); -const path = require('path'); +import { rollup } from 'rollup'; +import commonjs from '@rollup/plugin-commonjs'; +import json from '@rollup/plugin-json'; +import { nodeResolve as resolve } from '@rollup/plugin-node-resolve'; +import banner from './banner.js'; +import path from 'path'; +import { fileURLToPath } from 'url'; +import { builtinModules, createRequire } from 'module'; +import minimist from 'minimist'; +const require = createRequire(import.meta.url); +const __dirname = path.dirname(fileURLToPath(import.meta.url)); const rootPath = path.join(__dirname, '..'); +const pkg = require(path.join(rootPath, 'package.json')); +const builtinExternals = new Set([ + ...builtinModules, + ...builtinModules.map((name) => `node:${name}`) +]); +const packageExternals = new Set([ + ...Object.keys(pkg.dependencies || {}), + ...Object.keys(pkg.optionalDependencies || {}) +]); -const args = require('minimist')(process.argv.slice(2)); +const args = minimist(process.argv.slice(2)); let outDir = args.dist ? './dist' : './tmp'; -async function buildBrowser() { - let bundle = await rollup.rollup({ - input: './src/less-browser/bootstrap.js', - output: [ - { - file: 'less.js', - format: 'umd' - }, - { - file: 'less.min.js', - format: 'umd' +function isExternalDependency(id) { + if (!id || id.startsWith('\0')) { + return false; + } + + if (builtinExternals.has(id)) { + return true; + } + + if (id.startsWith('.') || path.isAbsolute(id)) { + return false; + } + + if (id.startsWith('@')) { + const [scope, name] = id.split('/'); + return packageExternals.has(`${scope}/${name}`); + } + + return packageExternals.has(id.split('/')[0]); +} + +/** Virtual 'module' for CJS bundle - provides createRequire that returns CJS require */ +function moduleShim() { + return { + name: 'module-shim', + resolveId(id) { + if (id === 'module') return '\0module'; + return null; + }, + load(id) { + if (id === '\0module') { + return 'export function createRequire() { return require; }'; } - ], + return null; + } + }; +} + +/** Inline package.json version - avoid runtime require of package.json from wrong path */ +function inlinePackageVersion() { + const version = JSON.stringify(pkg.version || '5.0.0-alpha.0'); + return { + name: 'inline-package-version', + transform(code, id) { + const normalized = id.replace(/\\/g, '/'); + if (normalized.includes('lib/version.js')) { + return { + code: code + .replace(/import\s+\{\s*createRequire\s*\}\s+from\s+['"]module['"];\s*/, '') + .replace(/const require = createRequire\([^)]+\);\s*const pkg = require\([^)]+\);\s*/, '') + .replace(/const semver = pkg\.version \|\| '[^']*';/, `const semver = ${version};`) + .replace(/semver: pkg\.version \|\| '[^']*'/, `semver: ${version}`), + map: null + }; + } + return null; + } + }; +} + +async function buildLessNodeCjs() { + const outFile = path.join(rootPath, outDir, 'less-node.cjs'); + console.log(`Writing ${outDir}/less-node.cjs...`); + const bundle = await rollup({ + input: './lib/index.js', + external: isExternalDependency, plugins: [ - resolve(), + moduleShim(), + inlinePackageVersion(), + resolve({ preferBuiltins: true }), commonjs(), - json(), - typescript({ - verbosity: 2, - tsconfigDefaults: { - compilerOptions: { - allowJs: true, - sourceMap: true, - target: 'ES5' - } - }, - include: [ '*.ts', '**/*.ts', '*.js', '**/*.js' ], - exclude: ['node_modules'] // only transpile our source code - }), - terser({ - compress: true, - include: [/^.+\.min\.js$/], - output: { - comments: function(node, comment) { - if (comment.type == 'comment2') { - // preserve banner - return /@license/i.test(comment.value); - } - } - } - }) + json() ] }); - - if (!args.out || args.out.indexOf('less.js') > -1) { - const file = args.out || `${outDir}/less.js`; - console.log(`Writing ${file}...`); - await bundle.write({ - file: path.join(rootPath, file), - format: 'umd', - name: 'less', - banner - }); - } - - if (!args.out || args.out.indexOf('less.min.js') > -1) { - const file = args.out || `${outDir}/less.min.js`; - console.log(`Writing ${file}...`); - await bundle.write({ - file: path.join(rootPath, file), - format: 'umd', - name: 'less', - sourcemap: true, - banner - }); - } + await bundle.write({ + file: outFile, + format: 'cjs', + exports: 'named', + inlineDynamicImports: true, + banner + }); } async function build() { - await buildBrowser(); + await buildLessNodeCjs(); } build(); diff --git a/packages/less/dist/less.js b/packages/less/dist/less.js deleted file mode 100644 index 0883ae41c3..0000000000 --- a/packages/less/dist/less.js +++ /dev/null @@ -1,11964 +0,0 @@ -/** - * Less - Leaner CSS v4.4.2 - * http://lesscss.org - * - * Copyright (c) 2009-2025, Alexis Sellier - * Licensed under the Apache-2.0 License. - * - * @license Apache-2.0 - */ - -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.less = factory()); -})(this, (function () { 'use strict'; - - // Export a new default each time - function defaultOptions () { - return { - /* Inline Javascript - @plugin still allowed */ - javascriptEnabled: false, - /* Outputs a makefile import dependency list to stdout. */ - depends: false, - /* (DEPRECATED) Compress using less built-in compression. - * This does an okay job but does not utilise all the tricks of - * dedicated css compression. */ - compress: false, - /* Runs the less parser and just reports errors without any output. */ - lint: false, - /* Sets available include paths. - * If the file in an @import rule does not exist at that exact location, - * less will look for it at the location(s) passed to this option. - * You might use this for instance to specify a path to a library which - * you want to be referenced simply and relatively in the less files. */ - paths: [], - /* color output in the terminal */ - color: true, - /* The strictImports controls whether the compiler will allow an @import inside of either - * @media blocks or (a later addition) other selector blocks. - * See: https://github.com/less/less.js/issues/656 */ - strictImports: false, - /* Allow Imports from Insecure HTTPS Hosts */ - insecure: false, - /* Allows you to add a path to every generated import and url in your css. - * This does not affect less import statements that are processed, just ones - * that are left in the output css. */ - rootpath: '', - /* By default URLs are kept as-is, so if you import a file in a sub-directory - * that references an image, exactly the same URL will be output in the css. - * This option allows you to re-write URL's in imported files so that the - * URL is always relative to the base imported file */ - rewriteUrls: false, - /* How to process math - * 0 always - eagerly try to solve all operations - * 1 parens-division - require parens for division "/" - * 2 parens | strict - require parens for all operations - * 3 strict-legacy - legacy strict behavior (super-strict) - */ - math: 1, - /* Without this option, less attempts to guess at the output unit when it does maths. */ - strictUnits: false, - /* Effectively the declaration is put at the top of your base Less file, - * meaning it can be used but it also can be overridden if this variable - * is defined in the file. */ - globalVars: null, - /* As opposed to the global variable option, this puts the declaration at the - * end of your base file, meaning it will override anything defined in your Less file. */ - modifyVars: null, - /* This option allows you to specify a argument to go on to every URL. */ - urlArgs: '' - }; - } - - function extractId(href) { - return href.replace(/^[a-z-]+:\/+?[^/]+/, '') // Remove protocol & domain - .replace(/[?&]livereload=\w+/, '') // Remove LiveReload cachebuster - .replace(/^\//, '') // Remove root / - .replace(/\.[a-zA-Z]+$/, '') // Remove simple extension - .replace(/[^.\w-]+/g, '-') // Replace illegal characters - .replace(/\./g, ':'); // Replace dots with colons(for valid id) - } - function addDataAttr(options, tag) { - if (!tag) { - return; - } // in case of tag is null or undefined - for (var opt in tag.dataset) { - if (Object.prototype.hasOwnProperty.call(tag.dataset, opt)) { - if (opt === 'env' || opt === 'dumpLineNumbers' || opt === 'rootpath' || opt === 'errorReporting') { - options[opt] = tag.dataset[opt]; - } - else { - try { - options[opt] = JSON.parse(tag.dataset[opt]); - } - catch (_) { } - } - } - } - } - - var browser = { - createCSS: function (document, styles, sheet) { - // Strip the query-string - var href = sheet.href || ''; - // If there is no title set, use the filename, minus the extension - var id = "less:".concat(sheet.title || extractId(href)); - // If this has already been inserted into the DOM, we may need to replace it - var oldStyleNode = document.getElementById(id); - var keepOldStyleNode = false; - // Create a new stylesheet node for insertion or (if necessary) replacement - var styleNode = document.createElement('style'); - styleNode.setAttribute('type', 'text/css'); - if (sheet.media) { - styleNode.setAttribute('media', sheet.media); - } - styleNode.id = id; - if (!styleNode.styleSheet) { - styleNode.appendChild(document.createTextNode(styles)); - // If new contents match contents of oldStyleNode, don't replace oldStyleNode - keepOldStyleNode = (oldStyleNode !== null && oldStyleNode.childNodes.length > 0 && styleNode.childNodes.length > 0 && - oldStyleNode.firstChild.nodeValue === styleNode.firstChild.nodeValue); - } - var head = document.getElementsByTagName('head')[0]; - // If there is no oldStyleNode, just append; otherwise, only append if we need - // to replace oldStyleNode with an updated stylesheet - if (oldStyleNode === null || keepOldStyleNode === false) { - var nextEl = sheet && sheet.nextSibling || null; - if (nextEl) { - nextEl.parentNode.insertBefore(styleNode, nextEl); - } - else { - head.appendChild(styleNode); - } - } - if (oldStyleNode && keepOldStyleNode === false) { - oldStyleNode.parentNode.removeChild(oldStyleNode); - } - // For IE. - // This needs to happen *after* the style element is added to the DOM, otherwise IE 7 and 8 may crash. - // See http://social.msdn.microsoft.com/Forums/en-US/7e081b65-878a-4c22-8e68-c10d39c2ed32/internet-explorer-crashes-appending-style-element-to-head - if (styleNode.styleSheet) { - try { - styleNode.styleSheet.cssText = styles; - } - catch (e) { - throw new Error('Couldn\'t reassign styleSheet.cssText.'); - } - } - }, - currentScript: function (window) { - var document = window.document; - return document.currentScript || (function () { - var scripts = document.getElementsByTagName('script'); - return scripts[scripts.length - 1]; - })(); - } - }; - - var addDefaultOptions = (function (window, options) { - // use options from the current script tag data attribues - addDataAttr(options, browser.currentScript(window)); - if (options.isFileProtocol === undefined) { - options.isFileProtocol = /^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(window.location.protocol); - } - // Load styles asynchronously (default: false) - // - // This is set to `false` by default, so that the body - // doesn't start loading before the stylesheets are parsed. - // Setting this to `true` can result in flickering. - // - options.async = options.async || false; - options.fileAsync = options.fileAsync || false; - // Interval between watch polls - options.poll = options.poll || (options.isFileProtocol ? 1000 : 1500); - options.env = options.env || (window.location.hostname == '127.0.0.1' || - window.location.hostname == '0.0.0.0' || - window.location.hostname == 'localhost' || - (window.location.port && - window.location.port.length > 0) || - options.isFileProtocol ? 'development' - : 'production'); - var dumpLineNumbers = /!dumpLineNumbers:(comments|mediaquery|all)/.exec(window.location.hash); - if (dumpLineNumbers) { - options.dumpLineNumbers = dumpLineNumbers[1]; - } - if (options.useFileCache === undefined) { - options.useFileCache = true; - } - if (options.onReady === undefined) { - options.onReady = true; - } - if (options.relativeUrls) { - options.rewriteUrls = 'all'; - } - }); - - var logger$1 = { - error: function (msg) { - this._fireEvent('error', msg); - }, - warn: function (msg) { - this._fireEvent('warn', msg); - }, - info: function (msg) { - this._fireEvent('info', msg); - }, - debug: function (msg) { - this._fireEvent('debug', msg); - }, - addListener: function (listener) { - this._listeners.push(listener); - }, - removeListener: function (listener) { - for (var i_1 = 0; i_1 < this._listeners.length; i_1++) { - if (this._listeners[i_1] === listener) { - this._listeners.splice(i_1, 1); - return; - } - } - }, - _fireEvent: function (type, msg) { - for (var i_2 = 0; i_2 < this._listeners.length; i_2++) { - var logFunction = this._listeners[i_2][type]; - if (logFunction) { - logFunction(msg); - } - } - }, - _listeners: [] - }; - - /** - * @todo Document why this abstraction exists, and the relationship between - * environment, file managers, and plugin manager - */ - var Environment = /** @class */ (function () { - function Environment(externalEnvironment, fileManagers) { - this.fileManagers = fileManagers || []; - externalEnvironment = externalEnvironment || {}; - var optionalFunctions = ['encodeBase64', 'mimeLookup', 'charsetLookup', 'getSourceMapGenerator']; - var requiredFunctions = []; - var functions = requiredFunctions.concat(optionalFunctions); - for (var i_1 = 0; i_1 < functions.length; i_1++) { - var propName = functions[i_1]; - var environmentFunc = externalEnvironment[propName]; - if (environmentFunc) { - this[propName] = environmentFunc.bind(externalEnvironment); - } - else if (i_1 < requiredFunctions.length) { - this.warn("missing required function in environment - ".concat(propName)); - } - } - } - Environment.prototype.getFileManager = function (filename, currentDirectory, options, environment, isSync) { - if (!filename) { - logger$1.warn('getFileManager called with no filename.. Please report this issue. continuing.'); - } - if (currentDirectory === undefined) { - logger$1.warn('getFileManager called with null directory.. Please report this issue. continuing.'); - } - var fileManagers = this.fileManagers; - if (options.pluginManager) { - fileManagers = [].concat(fileManagers).concat(options.pluginManager.getFileManagers()); - } - for (var i_2 = fileManagers.length - 1; i_2 >= 0; i_2--) { - var fileManager = fileManagers[i_2]; - if (fileManager[isSync ? 'supportsSync' : 'supports'](filename, currentDirectory, options, environment)) { - return fileManager; - } - } - return null; - }; - Environment.prototype.addFileManager = function (fileManager) { - this.fileManagers.push(fileManager); - }; - Environment.prototype.clearFileManagers = function () { - this.fileManagers = []; - }; - return Environment; - }()); - - var colors = { - 'aliceblue': '#f0f8ff', - 'antiquewhite': '#faebd7', - 'aqua': '#00ffff', - 'aquamarine': '#7fffd4', - 'azure': '#f0ffff', - 'beige': '#f5f5dc', - 'bisque': '#ffe4c4', - 'black': '#000000', - 'blanchedalmond': '#ffebcd', - 'blue': '#0000ff', - 'blueviolet': '#8a2be2', - 'brown': '#a52a2a', - 'burlywood': '#deb887', - 'cadetblue': '#5f9ea0', - 'chartreuse': '#7fff00', - 'chocolate': '#d2691e', - 'coral': '#ff7f50', - 'cornflowerblue': '#6495ed', - 'cornsilk': '#fff8dc', - 'crimson': '#dc143c', - 'cyan': '#00ffff', - 'darkblue': '#00008b', - 'darkcyan': '#008b8b', - 'darkgoldenrod': '#b8860b', - 'darkgray': '#a9a9a9', - 'darkgrey': '#a9a9a9', - 'darkgreen': '#006400', - 'darkkhaki': '#bdb76b', - 'darkmagenta': '#8b008b', - 'darkolivegreen': '#556b2f', - 'darkorange': '#ff8c00', - 'darkorchid': '#9932cc', - 'darkred': '#8b0000', - 'darksalmon': '#e9967a', - 'darkseagreen': '#8fbc8f', - 'darkslateblue': '#483d8b', - 'darkslategray': '#2f4f4f', - 'darkslategrey': '#2f4f4f', - 'darkturquoise': '#00ced1', - 'darkviolet': '#9400d3', - 'deeppink': '#ff1493', - 'deepskyblue': '#00bfff', - 'dimgray': '#696969', - 'dimgrey': '#696969', - 'dodgerblue': '#1e90ff', - 'firebrick': '#b22222', - 'floralwhite': '#fffaf0', - 'forestgreen': '#228b22', - 'fuchsia': '#ff00ff', - 'gainsboro': '#dcdcdc', - 'ghostwhite': '#f8f8ff', - 'gold': '#ffd700', - 'goldenrod': '#daa520', - 'gray': '#808080', - 'grey': '#808080', - 'green': '#008000', - 'greenyellow': '#adff2f', - 'honeydew': '#f0fff0', - 'hotpink': '#ff69b4', - 'indianred': '#cd5c5c', - 'indigo': '#4b0082', - 'ivory': '#fffff0', - 'khaki': '#f0e68c', - 'lavender': '#e6e6fa', - 'lavenderblush': '#fff0f5', - 'lawngreen': '#7cfc00', - 'lemonchiffon': '#fffacd', - 'lightblue': '#add8e6', - 'lightcoral': '#f08080', - 'lightcyan': '#e0ffff', - 'lightgoldenrodyellow': '#fafad2', - 'lightgray': '#d3d3d3', - 'lightgrey': '#d3d3d3', - 'lightgreen': '#90ee90', - 'lightpink': '#ffb6c1', - 'lightsalmon': '#ffa07a', - 'lightseagreen': '#20b2aa', - 'lightskyblue': '#87cefa', - 'lightslategray': '#778899', - 'lightslategrey': '#778899', - 'lightsteelblue': '#b0c4de', - 'lightyellow': '#ffffe0', - 'lime': '#00ff00', - 'limegreen': '#32cd32', - 'linen': '#faf0e6', - 'magenta': '#ff00ff', - 'maroon': '#800000', - 'mediumaquamarine': '#66cdaa', - 'mediumblue': '#0000cd', - 'mediumorchid': '#ba55d3', - 'mediumpurple': '#9370d8', - 'mediumseagreen': '#3cb371', - 'mediumslateblue': '#7b68ee', - 'mediumspringgreen': '#00fa9a', - 'mediumturquoise': '#48d1cc', - 'mediumvioletred': '#c71585', - 'midnightblue': '#191970', - 'mintcream': '#f5fffa', - 'mistyrose': '#ffe4e1', - 'moccasin': '#ffe4b5', - 'navajowhite': '#ffdead', - 'navy': '#000080', - 'oldlace': '#fdf5e6', - 'olive': '#808000', - 'olivedrab': '#6b8e23', - 'orange': '#ffa500', - 'orangered': '#ff4500', - 'orchid': '#da70d6', - 'palegoldenrod': '#eee8aa', - 'palegreen': '#98fb98', - 'paleturquoise': '#afeeee', - 'palevioletred': '#d87093', - 'papayawhip': '#ffefd5', - 'peachpuff': '#ffdab9', - 'peru': '#cd853f', - 'pink': '#ffc0cb', - 'plum': '#dda0dd', - 'powderblue': '#b0e0e6', - 'purple': '#800080', - 'rebeccapurple': '#663399', - 'red': '#ff0000', - 'rosybrown': '#bc8f8f', - 'royalblue': '#4169e1', - 'saddlebrown': '#8b4513', - 'salmon': '#fa8072', - 'sandybrown': '#f4a460', - 'seagreen': '#2e8b57', - 'seashell': '#fff5ee', - 'sienna': '#a0522d', - 'silver': '#c0c0c0', - 'skyblue': '#87ceeb', - 'slateblue': '#6a5acd', - 'slategray': '#708090', - 'slategrey': '#708090', - 'snow': '#fffafa', - 'springgreen': '#00ff7f', - 'steelblue': '#4682b4', - 'tan': '#d2b48c', - 'teal': '#008080', - 'thistle': '#d8bfd8', - 'tomato': '#ff6347', - 'turquoise': '#40e0d0', - 'violet': '#ee82ee', - 'wheat': '#f5deb3', - 'white': '#ffffff', - 'whitesmoke': '#f5f5f5', - 'yellow': '#ffff00', - 'yellowgreen': '#9acd32' - }; - - var unitConversions = { - length: { - 'm': 1, - 'cm': 0.01, - 'mm': 0.001, - 'in': 0.0254, - 'px': 0.0254 / 96, - 'pt': 0.0254 / 72, - 'pc': 0.0254 / 72 * 12 - }, - duration: { - 's': 1, - 'ms': 0.001 - }, - angle: { - 'rad': 1 / (2 * Math.PI), - 'deg': 1 / 360, - 'grad': 1 / 400, - 'turn': 1 - } - }; - - var data = { colors: colors, unitConversions: unitConversions }; - - /** - * The reason why Node is a class and other nodes simply do not extend - * from Node (since we're transpiling) is due to this issue: - * - * @see https://github.com/less/less.js/issues/3434 - */ - var Node = /** @class */ (function () { - function Node() { - this.parent = null; - this.visibilityBlocks = undefined; - this.nodeVisible = undefined; - this.rootNode = null; - this.parsed = null; - } - Object.defineProperty(Node.prototype, "currentFileInfo", { - get: function () { - return this.fileInfo(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Node.prototype, "index", { - get: function () { - return this.getIndex(); - }, - enumerable: false, - configurable: true - }); - Node.prototype.setParent = function (nodes, parent) { - function set(node) { - if (node && node instanceof Node) { - node.parent = parent; - } - } - if (Array.isArray(nodes)) { - nodes.forEach(set); - } - else { - set(nodes); - } - }; - Node.prototype.getIndex = function () { - return this._index || (this.parent && this.parent.getIndex()) || 0; - }; - Node.prototype.fileInfo = function () { - return this._fileInfo || (this.parent && this.parent.fileInfo()) || {}; - }; - Node.prototype.isRulesetLike = function () { return false; }; - Node.prototype.toCSS = function (context) { - var strs = []; - this.genCSS(context, { - // remove when genCSS has JSDoc types - // eslint-disable-next-line no-unused-vars - add: function (chunk, fileInfo, index) { - strs.push(chunk); - }, - isEmpty: function () { - return strs.length === 0; - } - }); - return strs.join(''); - }; - Node.prototype.genCSS = function (context, output) { - output.add(this.value); - }; - Node.prototype.accept = function (visitor) { - this.value = visitor.visit(this.value); - }; - Node.prototype.eval = function () { return this; }; - Node.prototype._operate = function (context, op, a, b) { - switch (op) { - case '+': return a + b; - case '-': return a - b; - case '*': return a * b; - case '/': return a / b; - } - }; - Node.prototype.fround = function (context, value) { - var precision = context && context.numPrecision; - // add "epsilon" to ensure numbers like 1.000000005 (represented as 1.000000004999...) are properly rounded: - return (precision) ? Number((value + 2e-16).toFixed(precision)) : value; - }; - Node.compare = function (a, b) { - /* returns: - -1: a < b - 0: a = b - 1: a > b - and *any* other value for a != b (e.g. undefined, NaN, -2 etc.) */ - if ((a.compare) && - // for "symmetric results" force toCSS-based comparison - // of Quoted or Anonymous if either value is one of those - !(b.type === 'Quoted' || b.type === 'Anonymous')) { - return a.compare(b); - } - else if (b.compare) { - return -b.compare(a); - } - else if (a.type !== b.type) { - return undefined; - } - a = a.value; - b = b.value; - if (!Array.isArray(a)) { - return a === b ? 0 : undefined; - } - if (a.length !== b.length) { - return undefined; - } - for (var i_1 = 0; i_1 < a.length; i_1++) { - if (Node.compare(a[i_1], b[i_1]) !== 0) { - return undefined; - } - } - return 0; - }; - Node.numericCompare = function (a, b) { - return a < b ? -1 - : a === b ? 0 - : a > b ? 1 : undefined; - }; - // Returns true if this node represents root of ast imported by reference - Node.prototype.blocksVisibility = function () { - if (this.visibilityBlocks === undefined) { - this.visibilityBlocks = 0; - } - return this.visibilityBlocks !== 0; - }; - Node.prototype.addVisibilityBlock = function () { - if (this.visibilityBlocks === undefined) { - this.visibilityBlocks = 0; - } - this.visibilityBlocks = this.visibilityBlocks + 1; - }; - Node.prototype.removeVisibilityBlock = function () { - if (this.visibilityBlocks === undefined) { - this.visibilityBlocks = 0; - } - this.visibilityBlocks = this.visibilityBlocks - 1; - }; - // Turns on node visibility - if called node will be shown in output regardless - // of whether it comes from import by reference or not - Node.prototype.ensureVisibility = function () { - this.nodeVisible = true; - }; - // Turns off node visibility - if called node will NOT be shown in output regardless - // of whether it comes from import by reference or not - Node.prototype.ensureInvisibility = function () { - this.nodeVisible = false; - }; - // return values: - // false - the node must not be visible - // true - the node must be visible - // undefined or null - the node has the same visibility as its parent - Node.prototype.isVisible = function () { - return this.nodeVisible; - }; - Node.prototype.visibilityInfo = function () { - return { - visibilityBlocks: this.visibilityBlocks, - nodeVisible: this.nodeVisible - }; - }; - Node.prototype.copyVisibilityInfo = function (info) { - if (!info) { - return; - } - this.visibilityBlocks = info.visibilityBlocks; - this.nodeVisible = info.nodeVisible; - }; - return Node; - }()); - - // - // RGB Colors - #ff0014, #eee - // - var Color = function (rgb, a, originalForm) { - var self = this; - // - // The end goal here, is to parse the arguments - // into an integer triplet, such as `128, 255, 0` - // - // This facilitates operations and conversions. - // - if (Array.isArray(rgb)) { - this.rgb = rgb; - } - else if (rgb.length >= 6) { - this.rgb = []; - rgb.match(/.{2}/g).map(function (c, i) { - if (i < 3) { - self.rgb.push(parseInt(c, 16)); - } - else { - self.alpha = (parseInt(c, 16)) / 255; - } - }); - } - else { - this.rgb = []; - rgb.split('').map(function (c, i) { - if (i < 3) { - self.rgb.push(parseInt(c + c, 16)); - } - else { - self.alpha = (parseInt(c + c, 16)) / 255; - } - }); - } - this.alpha = this.alpha || (typeof a === 'number' ? a : 1); - if (typeof originalForm !== 'undefined') { - this.value = originalForm; - } - }; - Color.prototype = Object.assign(new Node(), { - type: 'Color', - luma: function () { - var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255; - r = (r <= 0.03928) ? r / 12.92 : Math.pow(((r + 0.055) / 1.055), 2.4); - g = (g <= 0.03928) ? g / 12.92 : Math.pow(((g + 0.055) / 1.055), 2.4); - b = (b <= 0.03928) ? b / 12.92 : Math.pow(((b + 0.055) / 1.055), 2.4); - return 0.2126 * r + 0.7152 * g + 0.0722 * b; - }, - genCSS: function (context, output) { - output.add(this.toCSS(context)); - }, - toCSS: function (context, doNotCompress) { - var compress = context && context.compress && !doNotCompress; - var color; - var alpha; - var colorFunction; - var args = []; - // `value` is set if this color was originally - // converted from a named color string so we need - // to respect this and try to output named color too. - alpha = this.fround(context, this.alpha); - if (this.value) { - if (this.value.indexOf('rgb') === 0) { - if (alpha < 1) { - colorFunction = 'rgba'; - } - } - else if (this.value.indexOf('hsl') === 0) { - if (alpha < 1) { - colorFunction = 'hsla'; - } - else { - colorFunction = 'hsl'; - } - } - else { - return this.value; - } - } - else { - if (alpha < 1) { - colorFunction = 'rgba'; - } - } - switch (colorFunction) { - case 'rgba': - args = this.rgb.map(function (c) { - return clamp$1(Math.round(c), 255); - }).concat(clamp$1(alpha, 1)); - break; - case 'hsla': - args.push(clamp$1(alpha, 1)); - // eslint-disable-next-line no-fallthrough - case 'hsl': - color = this.toHSL(); - args = [ - this.fround(context, color.h), - "".concat(this.fround(context, color.s * 100), "%"), - "".concat(this.fround(context, color.l * 100), "%") - ].concat(args); - } - if (colorFunction) { - // Values are capped between `0` and `255`, rounded and zero-padded. - return "".concat(colorFunction, "(").concat(args.join(",".concat(compress ? '' : ' ')), ")"); - } - color = this.toRGB(); - if (compress) { - var splitcolor = color.split(''); - // Convert color to short format - if (splitcolor[1] === splitcolor[2] && splitcolor[3] === splitcolor[4] && splitcolor[5] === splitcolor[6]) { - color = "#".concat(splitcolor[1]).concat(splitcolor[3]).concat(splitcolor[5]); - } - } - return color; - }, - // - // Operations have to be done per-channel, if not, - // channels will spill onto each other. Once we have - // our result, in the form of an integer triplet, - // we create a new Color node to hold the result. - // - operate: function (context, op, other) { - var rgb = new Array(3); - var alpha = this.alpha * (1 - other.alpha) + other.alpha; - for (var c = 0; c < 3; c++) { - rgb[c] = this._operate(context, op, this.rgb[c], other.rgb[c]); - } - return new Color(rgb, alpha); - }, - toRGB: function () { - return toHex(this.rgb); - }, - toHSL: function () { - var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha; - var max = Math.max(r, g, b), min = Math.min(r, g, b); - var h; - var s; - var l = (max + min) / 2; - var d = max - min; - if (max === min) { - h = s = 0; - } - else { - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - switch (max) { - case r: - h = (g - b) / d + (g < b ? 6 : 0); - break; - case g: - h = (b - r) / d + 2; - break; - case b: - h = (r - g) / d + 4; - break; - } - h /= 6; - } - return { h: h * 360, s: s, l: l, a: a }; - }, - // Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript - toHSV: function () { - var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha; - var max = Math.max(r, g, b), min = Math.min(r, g, b); - var h; - var s; - var v = max; - var d = max - min; - if (max === 0) { - s = 0; - } - else { - s = d / max; - } - if (max === min) { - h = 0; - } - else { - switch (max) { - case r: - h = (g - b) / d + (g < b ? 6 : 0); - break; - case g: - h = (b - r) / d + 2; - break; - case b: - h = (r - g) / d + 4; - break; - } - h /= 6; - } - return { h: h * 360, s: s, v: v, a: a }; - }, - toARGB: function () { - return toHex([this.alpha * 255].concat(this.rgb)); - }, - compare: function (x) { - return (x.rgb && - x.rgb[0] === this.rgb[0] && - x.rgb[1] === this.rgb[1] && - x.rgb[2] === this.rgb[2] && - x.alpha === this.alpha) ? 0 : undefined; - } - }); - Color.fromKeyword = function (keyword) { - var c; - var key = keyword.toLowerCase(); - // eslint-disable-next-line no-prototype-builtins - if (colors.hasOwnProperty(key)) { - c = new Color(colors[key].slice(1)); - } - else if (key === 'transparent') { - c = new Color([0, 0, 0], 0); - } - if (c) { - c.value = keyword; - return c; - } - }; - function clamp$1(v, max) { - return Math.min(Math.max(v, 0), max); - } - function toHex(v) { - return "#".concat(v.map(function (c) { - c = clamp$1(Math.round(c), 255); - return (c < 16 ? '0' : '') + c.toString(16); - }).join('')); - } - - /****************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); - }; - - function __spreadArray(to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - } - - typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; - }; - - var Paren = function (node) { - this.value = node; - }; - Paren.prototype = Object.assign(new Node(), { - type: 'Paren', - genCSS: function (context, output) { - output.add('('); - this.value.genCSS(context, output); - output.add(')'); - }, - eval: function (context) { - var paren = new Paren(this.value.eval(context)); - if (this.noSpacing) { - paren.noSpacing = true; - } - return paren; - } - }); - - var _noSpaceCombinators = { - '': true, - ' ': true, - '|': true - }; - var Combinator = function (value) { - if (value === ' ') { - this.value = ' '; - this.emptyOrWhitespace = true; - } - else { - this.value = value ? value.trim() : ''; - this.emptyOrWhitespace = this.value === ''; - } - }; - Combinator.prototype = Object.assign(new Node(), { - type: 'Combinator', - genCSS: function (context, output) { - var spaceOrEmpty = (context.compress || _noSpaceCombinators[this.value]) ? '' : ' '; - output.add(spaceOrEmpty + this.value + spaceOrEmpty); - } - }); - - var Element = function (combinator, value, isVariable, index, currentFileInfo, visibilityInfo) { - this.combinator = combinator instanceof Combinator ? - combinator : new Combinator(combinator); - if (typeof value === 'string') { - this.value = value.trim(); - } - else if (value) { - this.value = value; - } - else { - this.value = ''; - } - this.isVariable = isVariable; - this._index = index; - this._fileInfo = currentFileInfo; - this.copyVisibilityInfo(visibilityInfo); - this.setParent(this.combinator, this); - }; - Element.prototype = Object.assign(new Node(), { - type: 'Element', - accept: function (visitor) { - var value = this.value; - this.combinator = visitor.visit(this.combinator); - if (typeof value === 'object') { - this.value = visitor.visit(value); - } - }, - eval: function (context) { - return new Element(this.combinator, this.value.eval ? this.value.eval(context) : this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - }, - clone: function () { - return new Element(this.combinator, this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - }, - genCSS: function (context, output) { - output.add(this.toCSS(context), this.fileInfo(), this.getIndex()); - }, - toCSS: function (context) { - context = context || {}; - var value = this.value; - var firstSelector = context.firstSelector; - if (value instanceof Paren) { - // selector in parens should not be affected by outer selector - // flags (breaks only interpolated selectors - see #1973) - context.firstSelector = true; - } - value = value.toCSS ? value.toCSS(context) : value; - context.firstSelector = firstSelector; - if (value === '' && this.combinator.value.charAt(0) === '&') { - return ''; - } - else { - return this.combinator.toCSS(context) + value; - } - } - }); - - var Math$1 = { - ALWAYS: 0, - PARENS_DIVISION: 1, - PARENS: 2 - // removed - STRICT_LEGACY: 3 - }; - var RewriteUrls = { - OFF: 0, - LOCAL: 1, - ALL: 2 - }; - - /** - * Returns the object type of the given payload - * - * @param {*} payload - * @returns {string} - */ - function getType(payload) { - return Object.prototype.toString.call(payload).slice(8, -1); - } - /** - * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes) - * - * @param {*} payload - * @returns {payload is PlainObject} - */ - function isPlainObject(payload) { - if (getType(payload) !== 'Object') - return false; - return payload.constructor === Object && Object.getPrototypeOf(payload) === Object.prototype; - } - /** - * Returns whether the payload is an array - * - * @param {any} payload - * @returns {payload is any[]} - */ - function isArray(payload) { - return getType(payload) === 'Array'; - } - - function assignProp(carry, key, newVal, originalObject, includeNonenumerable) { - const propType = {}.propertyIsEnumerable.call(originalObject, key) - ? 'enumerable' - : 'nonenumerable'; - if (propType === 'enumerable') - carry[key] = newVal; - if (includeNonenumerable && propType === 'nonenumerable') { - Object.defineProperty(carry, key, { - value: newVal, - enumerable: false, - writable: true, - configurable: true, - }); - } - } - /** - * Copy (clone) an object and all its props recursively to get rid of any prop referenced of the original object. Arrays are also cloned, however objects inside arrays are still linked. - * - * @export - * @template T - * @param {T} target Target can be anything - * @param {Options} [options = {}] Options can be `props` or `nonenumerable` - * @returns {T} the target with replaced values - * @export - */ - function copy(target, options = {}) { - if (isArray(target)) { - return target.map((item) => copy(item, options)); - } - if (!isPlainObject(target)) { - return target; - } - const props = Object.getOwnPropertyNames(target); - const symbols = Object.getOwnPropertySymbols(target); - return [...props, ...symbols].reduce((carry, key) => { - if (isArray(options.props) && !options.props.includes(key)) { - return carry; - } - const val = target[key]; - const newVal = copy(val, options); - assignProp(carry, key, newVal, target, options.nonenumerable); - return carry; - }, {}); - } - - /* jshint proto: true */ - function getLocation(index, inputStream) { - var n = index + 1; - var line = null; - var column = -1; - while (--n >= 0 && inputStream.charAt(n) !== '\n') { - column++; - } - if (typeof index === 'number') { - line = (inputStream.slice(0, index).match(/\n/g) || '').length; - } - return { - line: line, - column: column - }; - } - function copyArray(arr) { - var i; - var length = arr.length; - var copy = new Array(length); - for (i = 0; i < length; i++) { - copy[i] = arr[i]; - } - return copy; - } - function clone(obj) { - var cloned = {}; - for (var prop in obj) { - if (Object.prototype.hasOwnProperty.call(obj, prop)) { - cloned[prop] = obj[prop]; - } - } - return cloned; - } - function defaults(obj1, obj2) { - var newObj = obj2 || {}; - if (!obj2._defaults) { - newObj = {}; - var defaults_1 = copy(obj1); - newObj._defaults = defaults_1; - var cloned = obj2 ? copy(obj2) : {}; - Object.assign(newObj, defaults_1, cloned); - } - return newObj; - } - function copyOptions(obj1, obj2) { - if (obj2 && obj2._defaults) { - return obj2; - } - var opts = defaults(obj1, obj2); - if (opts.strictMath) { - opts.math = Math$1.PARENS; - } - // Back compat with changed relativeUrls option - if (opts.relativeUrls) { - opts.rewriteUrls = RewriteUrls.ALL; - } - if (typeof opts.math === 'string') { - switch (opts.math.toLowerCase()) { - case 'always': - opts.math = Math$1.ALWAYS; - break; - case 'parens-division': - opts.math = Math$1.PARENS_DIVISION; - break; - case 'strict': - case 'parens': - opts.math = Math$1.PARENS; - break; - default: - opts.math = Math$1.PARENS; - } - } - if (typeof opts.rewriteUrls === 'string') { - switch (opts.rewriteUrls.toLowerCase()) { - case 'off': - opts.rewriteUrls = RewriteUrls.OFF; - break; - case 'local': - opts.rewriteUrls = RewriteUrls.LOCAL; - break; - case 'all': - opts.rewriteUrls = RewriteUrls.ALL; - break; - } - } - return opts; - } - function merge(obj1, obj2) { - for (var prop in obj2) { - if (Object.prototype.hasOwnProperty.call(obj2, prop)) { - obj1[prop] = obj2[prop]; - } - } - return obj1; - } - function flattenArray(arr, result) { - if (result === void 0) { result = []; } - for (var i_1 = 0, length_1 = arr.length; i_1 < length_1; i_1++) { - var value = arr[i_1]; - if (Array.isArray(value)) { - flattenArray(value, result); - } - else { - if (value !== undefined) { - result.push(value); - } - } - } - return result; - } - function isNullOrUndefined(val) { - return val === null || val === undefined; - } - - var utils = /*#__PURE__*/Object.freeze({ - __proto__: null, - getLocation: getLocation, - copyArray: copyArray, - clone: clone, - defaults: defaults, - copyOptions: copyOptions, - merge: merge, - flattenArray: flattenArray, - isNullOrUndefined: isNullOrUndefined - }); - - var anonymousFunc = /(|Function):(\d+):(\d+)/; - /** - * This is a centralized class of any error that could be thrown internally (mostly by the parser). - * Besides standard .message it keeps some additional data like a path to the file where the error - * occurred along with line and column numbers. - * - * @class - * @extends Error - * @type {module.LessError} - * - * @prop {string} type - * @prop {string} filename - * @prop {number} index - * @prop {number} line - * @prop {number} column - * @prop {number} callLine - * @prop {number} callExtract - * @prop {string[]} extract - * - * @param {Object} e - An error object to wrap around or just a descriptive object - * @param {Object} fileContentMap - An object with file contents in 'contents' property (like importManager) @todo - move to fileManager? - * @param {string} [currentFilename] - */ - var LessError = function (e, fileContentMap, currentFilename) { - Error.call(this); - var filename = e.filename || currentFilename; - this.message = e.message; - this.stack = e.stack; - if (fileContentMap && filename) { - var input = fileContentMap.contents[filename]; - var loc = getLocation(e.index, input); - var line = loc.line; - var col = loc.column; - var callLine = e.call && getLocation(e.call, input).line; - var lines = input ? input.split('\n') : ''; - this.type = e.type || 'Syntax'; - this.filename = filename; - this.index = e.index; - this.line = typeof line === 'number' ? line + 1 : null; - this.column = col; - if (!this.line && this.stack) { - var found = this.stack.match(anonymousFunc); - /** - * We have to figure out how this environment stringifies anonymous functions - * so we can correctly map plugin errors. - * - * Note, in Node 8, the output of anonymous funcs varied based on parameters - * being present or not, so we inject dummy params. - */ - var func = new Function('a', 'throw new Error()'); - var lineAdjust = 0; - try { - func(); - } - catch (e) { - var match = e.stack.match(anonymousFunc); - lineAdjust = 1 - parseInt(match[2]); - } - if (found) { - if (found[2]) { - this.line = parseInt(found[2]) + lineAdjust; - } - if (found[3]) { - this.column = parseInt(found[3]); - } - } - } - this.callLine = callLine + 1; - this.callExtract = lines[callLine]; - this.extract = [ - lines[this.line - 2], - lines[this.line - 1], - lines[this.line] - ]; - } - }; - if (typeof Object.create === 'undefined') { - var F = function () { }; - F.prototype = Error.prototype; - LessError.prototype = new F(); - } - else { - LessError.prototype = Object.create(Error.prototype); - } - LessError.prototype.constructor = LessError; - /** - * An overridden version of the default Object.prototype.toString - * which uses additional information to create a helpful message. - * - * @param {Object} options - * @returns {string} - */ - LessError.prototype.toString = function (options) { - var _a; - options = options || {}; - var isWarning = ((_a = this.type) !== null && _a !== void 0 ? _a : '').toLowerCase().includes('warning'); - var type = isWarning ? this.type : "".concat(this.type, "Error"); - var color = isWarning ? 'yellow' : 'red'; - var message = ''; - var extract = this.extract || []; - var error = []; - var stylize = function (str) { return str; }; - if (options.stylize) { - var type_1 = typeof options.stylize; - if (type_1 !== 'function') { - throw Error("options.stylize should be a function, got a ".concat(type_1, "!")); - } - stylize = options.stylize; - } - if (this.line !== null) { - if (!isWarning && typeof extract[0] === 'string') { - error.push(stylize("".concat(this.line - 1, " ").concat(extract[0]), 'grey')); - } - if (typeof extract[1] === 'string') { - var errorTxt = "".concat(this.line, " "); - if (extract[1]) { - errorTxt += extract[1].slice(0, this.column) + - stylize(stylize(stylize(extract[1].substr(this.column, 1), 'bold') + - extract[1].slice(this.column + 1), 'red'), 'inverse'); - } - error.push(errorTxt); - } - if (!isWarning && typeof extract[2] === 'string') { - error.push(stylize("".concat(this.line + 1, " ").concat(extract[2]), 'grey')); - } - error = "".concat(error.join('\n') + stylize('', 'reset'), "\n"); - } - message += stylize("".concat(type, ": ").concat(this.message), color); - if (this.filename) { - message += stylize(' in ', color) + this.filename; - } - if (this.line) { - message += stylize(" on line ".concat(this.line, ", column ").concat(this.column + 1, ":"), 'grey'); - } - message += "\n".concat(error); - if (this.callLine) { - message += "".concat(stylize('from ', color) + (this.filename || ''), "/n"); - message += "".concat(stylize(this.callLine, 'grey'), " ").concat(this.callExtract, "/n"); - } - return message; - }; - - var _visitArgs = { visitDeeper: true }; - var _hasIndexed = false; - function _noop(node) { - return node; - } - function indexNodeTypes(parent, ticker) { - // add .typeIndex to tree node types for lookup table - var key, child; - for (key in parent) { - /* eslint guard-for-in: 0 */ - child = parent[key]; - switch (typeof child) { - case 'function': - // ignore bound functions directly on tree which do not have a prototype - // or aren't nodes - if (child.prototype && child.prototype.type) { - child.prototype.typeIndex = ticker++; - } - break; - case 'object': - ticker = indexNodeTypes(child, ticker); - break; - } - } - return ticker; - } - var Visitor = /** @class */ (function () { - function Visitor(implementation) { - this._implementation = implementation; - this._visitInCache = {}; - this._visitOutCache = {}; - if (!_hasIndexed) { - indexNodeTypes(tree, 1); - _hasIndexed = true; - } - } - Visitor.prototype.visit = function (node) { - if (!node) { - return node; - } - var nodeTypeIndex = node.typeIndex; - if (!nodeTypeIndex) { - // MixinCall args aren't a node type? - if (node.value && node.value.typeIndex) { - this.visit(node.value); - } - return node; - } - var impl = this._implementation; - var func = this._visitInCache[nodeTypeIndex]; - var funcOut = this._visitOutCache[nodeTypeIndex]; - var visitArgs = _visitArgs; - var fnName; - visitArgs.visitDeeper = true; - if (!func) { - fnName = "visit".concat(node.type); - func = impl[fnName] || _noop; - funcOut = impl["".concat(fnName, "Out")] || _noop; - this._visitInCache[nodeTypeIndex] = func; - this._visitOutCache[nodeTypeIndex] = funcOut; - } - if (func !== _noop) { - var newNode = func.call(impl, node, visitArgs); - if (node && impl.isReplacing) { - node = newNode; - } - } - if (visitArgs.visitDeeper && node) { - if (node.length) { - for (var i_1 = 0, cnt = node.length; i_1 < cnt; i_1++) { - if (node[i_1].accept) { - node[i_1].accept(this); - } - } - } - else if (node.accept) { - node.accept(this); - } - } - if (funcOut != _noop) { - funcOut.call(impl, node); - } - return node; - }; - Visitor.prototype.visitArray = function (nodes, nonReplacing) { - if (!nodes) { - return nodes; - } - var cnt = nodes.length; - var i; - // Non-replacing - if (nonReplacing || !this._implementation.isReplacing) { - for (i = 0; i < cnt; i++) { - this.visit(nodes[i]); - } - return nodes; - } - // Replacing - var out = []; - for (i = 0; i < cnt; i++) { - var evald = this.visit(nodes[i]); - if (evald === undefined) { - continue; - } - if (!evald.splice) { - out.push(evald); - } - else if (evald.length) { - this.flatten(evald, out); - } - } - return out; - }; - Visitor.prototype.flatten = function (arr, out) { - if (!out) { - out = []; - } - var cnt, i, item, nestedCnt, j, nestedItem; - for (i = 0, cnt = arr.length; i < cnt; i++) { - item = arr[i]; - if (item === undefined) { - continue; - } - if (!item.splice) { - out.push(item); - continue; - } - for (j = 0, nestedCnt = item.length; j < nestedCnt; j++) { - nestedItem = item[j]; - if (nestedItem === undefined) { - continue; - } - if (!nestedItem.splice) { - out.push(nestedItem); - } - else if (nestedItem.length) { - this.flatten(nestedItem, out); - } - } - } - return out; - }; - return Visitor; - }()); - - var contexts = {}; - var copyFromOriginal = function copyFromOriginal(original, destination, propertiesToCopy) { - if (!original) { - return; - } - for (var i_1 = 0; i_1 < propertiesToCopy.length; i_1++) { - if (Object.prototype.hasOwnProperty.call(original, propertiesToCopy[i_1])) { - destination[propertiesToCopy[i_1]] = original[propertiesToCopy[i_1]]; - } - } - }; - /* - parse is used whilst parsing - */ - var parseCopyProperties = [ - // options - 'paths', - 'rewriteUrls', - 'rootpath', - 'strictImports', - 'insecure', - 'dumpLineNumbers', - 'compress', - 'syncImport', - 'chunkInput', - 'mime', - 'useFileCache', - // context - 'processImports', - // Used by the import manager to stop multiple import visitors being created. - 'pluginManager', - 'quiet', // option - whether to log warnings - ]; - contexts.Parse = function (options) { - copyFromOriginal(options, this, parseCopyProperties); - if (typeof this.paths === 'string') { - this.paths = [this.paths]; - } - }; - var evalCopyProperties = [ - 'paths', - 'compress', - 'math', - 'strictUnits', - 'sourceMap', - 'importMultiple', - 'urlArgs', - 'javascriptEnabled', - 'pluginManager', - 'importantScope', - 'rewriteUrls' // option - whether to adjust URL's to be relative - ]; - contexts.Eval = function (options, frames) { - copyFromOriginal(options, this, evalCopyProperties); - if (typeof this.paths === 'string') { - this.paths = [this.paths]; - } - this.frames = frames || []; - this.importantScope = this.importantScope || []; - }; - contexts.Eval.prototype.enterCalc = function () { - if (!this.calcStack) { - this.calcStack = []; - } - this.calcStack.push(true); - this.inCalc = true; - }; - contexts.Eval.prototype.exitCalc = function () { - this.calcStack.pop(); - if (!this.calcStack.length) { - this.inCalc = false; - } - }; - contexts.Eval.prototype.inParenthesis = function () { - if (!this.parensStack) { - this.parensStack = []; - } - this.parensStack.push(true); - }; - contexts.Eval.prototype.outOfParenthesis = function () { - this.parensStack.pop(); - }; - contexts.Eval.prototype.inCalc = false; - contexts.Eval.prototype.mathOn = true; - contexts.Eval.prototype.isMathOn = function (op) { - if (!this.mathOn) { - return false; - } - if (op === '/' && this.math !== Math$1.ALWAYS && (!this.parensStack || !this.parensStack.length)) { - return false; - } - if (this.math > Math$1.PARENS_DIVISION) { - return this.parensStack && this.parensStack.length; - } - return true; - }; - contexts.Eval.prototype.pathRequiresRewrite = function (path) { - var isRelative = this.rewriteUrls === RewriteUrls.LOCAL ? isPathLocalRelative : isPathRelative; - return isRelative(path); - }; - contexts.Eval.prototype.rewritePath = function (path, rootpath) { - var newPath; - rootpath = rootpath || ''; - newPath = this.normalizePath(rootpath + path); - // If a path was explicit relative and the rootpath was not an absolute path - // we must ensure that the new path is also explicit relative. - if (isPathLocalRelative(path) && - isPathRelative(rootpath) && - isPathLocalRelative(newPath) === false) { - newPath = "./".concat(newPath); - } - return newPath; - }; - contexts.Eval.prototype.normalizePath = function (path) { - var segments = path.split('/').reverse(); - var segment; - path = []; - while (segments.length !== 0) { - segment = segments.pop(); - switch (segment) { - case '.': - break; - case '..': - if ((path.length === 0) || (path[path.length - 1] === '..')) { - path.push(segment); - } - else { - path.pop(); - } - break; - default: - path.push(segment); - break; - } - } - return path.join('/'); - }; - function isPathRelative(path) { - return !/^(?:[a-z-]+:|\/|#)/i.test(path); - } - function isPathLocalRelative(path) { - return path.charAt(0) === '.'; - } - // todo - do the same for the toCSS ? - - var ImportSequencer = /** @class */ (function () { - function ImportSequencer(onSequencerEmpty) { - this.imports = []; - this.variableImports = []; - this._onSequencerEmpty = onSequencerEmpty; - this._currentDepth = 0; - } - ImportSequencer.prototype.addImport = function (callback) { - var importSequencer = this, importItem = { - callback: callback, - args: null, - isReady: false - }; - this.imports.push(importItem); - return function () { - importItem.args = Array.prototype.slice.call(arguments, 0); - importItem.isReady = true; - importSequencer.tryRun(); - }; - }; - ImportSequencer.prototype.addVariableImport = function (callback) { - this.variableImports.push(callback); - }; - ImportSequencer.prototype.tryRun = function () { - this._currentDepth++; - try { - while (true) { - while (this.imports.length > 0) { - var importItem = this.imports[0]; - if (!importItem.isReady) { - return; - } - this.imports = this.imports.slice(1); - importItem.callback.apply(null, importItem.args); - } - if (this.variableImports.length === 0) { - break; - } - var variableImport = this.variableImports[0]; - this.variableImports = this.variableImports.slice(1); - variableImport(); - } - } - finally { - this._currentDepth--; - } - if (this._currentDepth === 0 && this._onSequencerEmpty) { - this._onSequencerEmpty(); - } - }; - return ImportSequencer; - }()); - - /* eslint-disable no-unused-vars */ - var ImportVisitor = function (importer, finish) { - this._visitor = new Visitor(this); - this._importer = importer; - this._finish = finish; - this.context = new contexts.Eval(); - this.importCount = 0; - this.onceFileDetectionMap = {}; - this.recursionDetector = {}; - this._sequencer = new ImportSequencer(this._onSequencerEmpty.bind(this)); - }; - ImportVisitor.prototype = { - isReplacing: false, - run: function (root) { - try { - // process the contents - this._visitor.visit(root); - } - catch (e) { - this.error = e; - } - this.isFinished = true; - this._sequencer.tryRun(); - }, - _onSequencerEmpty: function () { - if (!this.isFinished) { - return; - } - this._finish(this.error); - }, - visitImport: function (importNode, visitArgs) { - var inlineCSS = importNode.options.inline; - if (!importNode.css || inlineCSS) { - var context = new contexts.Eval(this.context, copyArray(this.context.frames)); - var importParent = context.frames[0]; - this.importCount++; - if (importNode.isVariableImport()) { - this._sequencer.addVariableImport(this.processImportNode.bind(this, importNode, context, importParent)); - } - else { - this.processImportNode(importNode, context, importParent); - } - } - visitArgs.visitDeeper = false; - }, - processImportNode: function (importNode, context, importParent) { - var evaldImportNode; - var inlineCSS = importNode.options.inline; - try { - evaldImportNode = importNode.evalForImport(context); - } - catch (e) { - if (!e.filename) { - e.index = importNode.getIndex(); - e.filename = importNode.fileInfo().filename; - } - // attempt to eval properly and treat as css - importNode.css = true; - // if that fails, this error will be thrown - importNode.error = e; - } - if (evaldImportNode && (!evaldImportNode.css || inlineCSS)) { - if (evaldImportNode.options.multiple) { - context.importMultiple = true; - } - // try appending if we haven't determined if it is css or not - var tryAppendLessExtension = evaldImportNode.css === undefined; - for (var i_1 = 0; i_1 < importParent.rules.length; i_1++) { - if (importParent.rules[i_1] === importNode) { - importParent.rules[i_1] = evaldImportNode; - break; - } - } - var onImported = this.onImported.bind(this, evaldImportNode, context), sequencedOnImported = this._sequencer.addImport(onImported); - this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.fileInfo(), evaldImportNode.options, sequencedOnImported); - } - else { - this.importCount--; - if (this.isFinished) { - this._sequencer.tryRun(); - } - } - }, - onImported: function (importNode, context, e, root, importedAtRoot, fullPath) { - if (e) { - if (!e.filename) { - e.index = importNode.getIndex(); - e.filename = importNode.fileInfo().filename; - } - this.error = e; - } - var importVisitor = this, inlineCSS = importNode.options.inline, isPlugin = importNode.options.isPlugin, isOptional = importNode.options.optional, duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector; - if (!context.importMultiple) { - if (duplicateImport) { - importNode.skip = true; - } - else { - importNode.skip = function () { - if (fullPath in importVisitor.onceFileDetectionMap) { - return true; - } - importVisitor.onceFileDetectionMap[fullPath] = true; - return false; - }; - } - } - if (!fullPath && isOptional) { - importNode.skip = true; - } - if (root) { - importNode.root = root; - importNode.importedFilename = fullPath; - if (!inlineCSS && !isPlugin && (context.importMultiple || !duplicateImport)) { - importVisitor.recursionDetector[fullPath] = true; - var oldContext = this.context; - this.context = context; - try { - this._visitor.visit(root); - } - catch (e) { - this.error = e; - } - this.context = oldContext; - } - } - importVisitor.importCount--; - if (importVisitor.isFinished) { - importVisitor._sequencer.tryRun(); - } - }, - visitDeclaration: function (declNode, visitArgs) { - if (declNode.value.type === 'DetachedRuleset') { - this.context.frames.unshift(declNode); - } - else { - visitArgs.visitDeeper = false; - } - }, - visitDeclarationOut: function (declNode) { - if (declNode.value.type === 'DetachedRuleset') { - this.context.frames.shift(); - } - }, - visitAtRule: function (atRuleNode, visitArgs) { - if (atRuleNode.value) { - this.context.frames.unshift(atRuleNode); - } - else if (atRuleNode.declarations && atRuleNode.declarations.length) { - if (atRuleNode.isRooted) { - this.context.frames.unshift(atRuleNode); - } - else { - this.context.frames.unshift(atRuleNode.declarations[0]); - } - } - else if (atRuleNode.rules && atRuleNode.rules.length) { - this.context.frames.unshift(atRuleNode); - } - }, - visitAtRuleOut: function (atRuleNode) { - this.context.frames.shift(); - }, - visitMixinDefinition: function (mixinDefinitionNode, visitArgs) { - this.context.frames.unshift(mixinDefinitionNode); - }, - visitMixinDefinitionOut: function (mixinDefinitionNode) { - this.context.frames.shift(); - }, - visitRuleset: function (rulesetNode, visitArgs) { - this.context.frames.unshift(rulesetNode); - }, - visitRulesetOut: function (rulesetNode) { - this.context.frames.shift(); - }, - visitMedia: function (mediaNode, visitArgs) { - this.context.frames.unshift(mediaNode.rules[0]); - }, - visitMediaOut: function (mediaNode) { - this.context.frames.shift(); - } - }; - - var SetTreeVisibilityVisitor = /** @class */ (function () { - function SetTreeVisibilityVisitor(visible) { - this.visible = visible; - } - SetTreeVisibilityVisitor.prototype.run = function (root) { - this.visit(root); - }; - SetTreeVisibilityVisitor.prototype.visitArray = function (nodes) { - if (!nodes) { - return nodes; - } - var cnt = nodes.length; - var i; - for (i = 0; i < cnt; i++) { - this.visit(nodes[i]); - } - return nodes; - }; - SetTreeVisibilityVisitor.prototype.visit = function (node) { - if (!node) { - return node; - } - if (node.constructor === Array) { - return this.visitArray(node); - } - if (!node.blocksVisibility || node.blocksVisibility()) { - return node; - } - if (this.visible) { - node.ensureVisibility(); - } - else { - node.ensureInvisibility(); - } - node.accept(this); - return node; - }; - return SetTreeVisibilityVisitor; - }()); - - /* eslint-disable no-unused-vars */ - /* jshint loopfunc:true */ - var ExtendFinderVisitor = /** @class */ (function () { - function ExtendFinderVisitor() { - this._visitor = new Visitor(this); - this.contexts = []; - this.allExtendsStack = [[]]; - } - ExtendFinderVisitor.prototype.run = function (root) { - root = this._visitor.visit(root); - root.allExtends = this.allExtendsStack[0]; - return root; - }; - ExtendFinderVisitor.prototype.visitDeclaration = function (declNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - ExtendFinderVisitor.prototype.visitMixinDefinition = function (mixinDefinitionNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - ExtendFinderVisitor.prototype.visitRuleset = function (rulesetNode, visitArgs) { - if (rulesetNode.root) { - return; - } - var i; - var j; - var extend; - var allSelectorsExtendList = []; - var extendList; - // get &:extend(.a); rules which apply to all selectors in this ruleset - var rules = rulesetNode.rules, ruleCnt = rules ? rules.length : 0; - for (i = 0; i < ruleCnt; i++) { - if (rulesetNode.rules[i] instanceof tree.Extend) { - allSelectorsExtendList.push(rules[i]); - rulesetNode.extendOnEveryPath = true; - } - } - // now find every selector and apply the extends that apply to all extends - // and the ones which apply to an individual extend - var paths = rulesetNode.paths; - for (i = 0; i < paths.length; i++) { - var selectorPath = paths[i], selector = selectorPath[selectorPath.length - 1], selExtendList = selector.extendList; - extendList = selExtendList ? copyArray(selExtendList).concat(allSelectorsExtendList) - : allSelectorsExtendList; - if (extendList) { - extendList = extendList.map(function (allSelectorsExtend) { - return allSelectorsExtend.clone(); - }); - } - for (j = 0; j < extendList.length; j++) { - this.foundExtends = true; - extend = extendList[j]; - extend.findSelfSelectors(selectorPath); - extend.ruleset = rulesetNode; - if (j === 0) { - extend.firstExtendOnThisSelectorPath = true; - } - this.allExtendsStack[this.allExtendsStack.length - 1].push(extend); - } - } - this.contexts.push(rulesetNode.selectors); - }; - ExtendFinderVisitor.prototype.visitRulesetOut = function (rulesetNode) { - if (!rulesetNode.root) { - this.contexts.length = this.contexts.length - 1; - } - }; - ExtendFinderVisitor.prototype.visitMedia = function (mediaNode, visitArgs) { - mediaNode.allExtends = []; - this.allExtendsStack.push(mediaNode.allExtends); - }; - ExtendFinderVisitor.prototype.visitMediaOut = function (mediaNode) { - this.allExtendsStack.length = this.allExtendsStack.length - 1; - }; - ExtendFinderVisitor.prototype.visitAtRule = function (atRuleNode, visitArgs) { - atRuleNode.allExtends = []; - this.allExtendsStack.push(atRuleNode.allExtends); - }; - ExtendFinderVisitor.prototype.visitAtRuleOut = function (atRuleNode) { - this.allExtendsStack.length = this.allExtendsStack.length - 1; - }; - return ExtendFinderVisitor; - }()); - var ProcessExtendsVisitor = /** @class */ (function () { - function ProcessExtendsVisitor() { - this._visitor = new Visitor(this); - } - ProcessExtendsVisitor.prototype.run = function (root) { - var extendFinder = new ExtendFinderVisitor(); - this.extendIndices = {}; - extendFinder.run(root); - if (!extendFinder.foundExtends) { - return root; - } - root.allExtends = root.allExtends.concat(this.doExtendChaining(root.allExtends, root.allExtends)); - this.allExtendsStack = [root.allExtends]; - var newRoot = this._visitor.visit(root); - this.checkExtendsForNonMatched(root.allExtends); - return newRoot; - }; - ProcessExtendsVisitor.prototype.checkExtendsForNonMatched = function (extendList) { - var indices = this.extendIndices; - extendList.filter(function (extend) { - return !extend.hasFoundMatches && extend.parent_ids.length == 1; - }).forEach(function (extend) { - var selector = '_unknown_'; - try { - selector = extend.selector.toCSS({}); - } - catch (_) { } - if (!indices["".concat(extend.index, " ").concat(selector)]) { - indices["".concat(extend.index, " ").concat(selector)] = true; - /** - * @todo Shouldn't this be an error? To alert the developer - * that they may have made an error in the selector they are - * targeting? - */ - logger$1.warn("WARNING: extend '".concat(selector, "' has no matches")); - } - }); - }; - ProcessExtendsVisitor.prototype.doExtendChaining = function (extendsList, extendsListTarget, iterationCount) { - // - // chaining is different from normal extension.. if we extend an extend then we are not just copying, altering - // and pasting the selector we would do normally, but we are also adding an extend with the same target selector - // this means this new extend can then go and alter other extends - // - // this method deals with all the chaining work - without it, extend is flat and doesn't work on other extend selectors - // this is also the most expensive.. and a match on one selector can cause an extension of a selector we had already - // processed if we look at each selector at a time, as is done in visitRuleset - var extendIndex; - var targetExtendIndex; - var matches; - var extendsToAdd = []; - var newSelector; - var extendVisitor = this; - var selectorPath; - var extend; - var targetExtend; - var newExtend; - iterationCount = iterationCount || 0; - // loop through comparing every extend with every target extend. - // a target extend is the one on the ruleset we are looking at copy/edit/pasting in place - // e.g. .a:extend(.b) {} and .b:extend(.c) {} then the first extend extends the second one - // and the second is the target. - // the separation into two lists allows us to process a subset of chains with a bigger set, as is the - // case when processing media queries - for (extendIndex = 0; extendIndex < extendsList.length; extendIndex++) { - for (targetExtendIndex = 0; targetExtendIndex < extendsListTarget.length; targetExtendIndex++) { - extend = extendsList[extendIndex]; - targetExtend = extendsListTarget[targetExtendIndex]; - // look for circular references - if (extend.parent_ids.indexOf(targetExtend.object_id) >= 0) { - continue; - } - // find a match in the target extends self selector (the bit before :extend) - selectorPath = [targetExtend.selfSelectors[0]]; - matches = extendVisitor.findMatch(extend, selectorPath); - if (matches.length) { - extend.hasFoundMatches = true; - // we found a match, so for each self selector.. - extend.selfSelectors.forEach(function (selfSelector) { - var info = targetExtend.visibilityInfo(); - // process the extend as usual - newSelector = extendVisitor.extendSelector(matches, selectorPath, selfSelector, extend.isVisible()); - // but now we create a new extend from it - newExtend = new (tree.Extend)(targetExtend.selector, targetExtend.option, 0, targetExtend.fileInfo(), info); - newExtend.selfSelectors = newSelector; - // add the extend onto the list of extends for that selector - newSelector[newSelector.length - 1].extendList = [newExtend]; - // record that we need to add it. - extendsToAdd.push(newExtend); - newExtend.ruleset = targetExtend.ruleset; - // remember its parents for circular references - newExtend.parent_ids = newExtend.parent_ids.concat(targetExtend.parent_ids, extend.parent_ids); - // only process the selector once.. if we have :extend(.a,.b) then multiple - // extends will look at the same selector path, so when extending - // we know that any others will be duplicates in terms of what is added to the css - if (targetExtend.firstExtendOnThisSelectorPath) { - newExtend.firstExtendOnThisSelectorPath = true; - targetExtend.ruleset.paths.push(newSelector); - } - }); - } - } - } - if (extendsToAdd.length) { - // try to detect circular references to stop a stack overflow. - // may no longer be needed. - this.extendChainCount++; - if (iterationCount > 100) { - var selectorOne = '{unable to calculate}'; - var selectorTwo = '{unable to calculate}'; - try { - selectorOne = extendsToAdd[0].selfSelectors[0].toCSS(); - selectorTwo = extendsToAdd[0].selector.toCSS(); - } - catch (e) { } - throw { message: "extend circular reference detected. One of the circular extends is currently:".concat(selectorOne, ":extend(").concat(selectorTwo, ")") }; - } - // now process the new extends on the existing rules so that we can handle a extending b extending c extending - // d extending e... - return extendsToAdd.concat(extendVisitor.doExtendChaining(extendsToAdd, extendsListTarget, iterationCount + 1)); - } - else { - return extendsToAdd; - } - }; - ProcessExtendsVisitor.prototype.visitDeclaration = function (ruleNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - ProcessExtendsVisitor.prototype.visitMixinDefinition = function (mixinDefinitionNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - ProcessExtendsVisitor.prototype.visitSelector = function (selectorNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - ProcessExtendsVisitor.prototype.visitRuleset = function (rulesetNode, visitArgs) { - if (rulesetNode.root) { - return; - } - var matches; - var pathIndex; - var extendIndex; - var allExtends = this.allExtendsStack[this.allExtendsStack.length - 1]; - var selectorsToAdd = []; - var extendVisitor = this; - var selectorPath; - // look at each selector path in the ruleset, find any extend matches and then copy, find and replace - for (extendIndex = 0; extendIndex < allExtends.length; extendIndex++) { - for (pathIndex = 0; pathIndex < rulesetNode.paths.length; pathIndex++) { - selectorPath = rulesetNode.paths[pathIndex]; - // extending extends happens initially, before the main pass - if (rulesetNode.extendOnEveryPath) { - continue; - } - var extendList = selectorPath[selectorPath.length - 1].extendList; - if (extendList && extendList.length) { - continue; - } - matches = this.findMatch(allExtends[extendIndex], selectorPath); - if (matches.length) { - allExtends[extendIndex].hasFoundMatches = true; - allExtends[extendIndex].selfSelectors.forEach(function (selfSelector) { - var extendedSelectors; - extendedSelectors = extendVisitor.extendSelector(matches, selectorPath, selfSelector, allExtends[extendIndex].isVisible()); - selectorsToAdd.push(extendedSelectors); - }); - } - } - } - rulesetNode.paths = rulesetNode.paths.concat(selectorsToAdd); - }; - ProcessExtendsVisitor.prototype.findMatch = function (extend, haystackSelectorPath) { - // - // look through the haystack selector path to try and find the needle - extend.selector - // returns an array of selector matches that can then be replaced - // - var haystackSelectorIndex; - var hackstackSelector; - var hackstackElementIndex; - var haystackElement; - var targetCombinator; - var i; - var extendVisitor = this; - var needleElements = extend.selector.elements; - var potentialMatches = []; - var potentialMatch; - var matches = []; - // loop through the haystack elements - for (haystackSelectorIndex = 0; haystackSelectorIndex < haystackSelectorPath.length; haystackSelectorIndex++) { - hackstackSelector = haystackSelectorPath[haystackSelectorIndex]; - for (hackstackElementIndex = 0; hackstackElementIndex < hackstackSelector.elements.length; hackstackElementIndex++) { - haystackElement = hackstackSelector.elements[hackstackElementIndex]; - // if we allow elements before our match we can add a potential match every time. otherwise only at the first element. - if (extend.allowBefore || (haystackSelectorIndex === 0 && hackstackElementIndex === 0)) { - potentialMatches.push({ pathIndex: haystackSelectorIndex, index: hackstackElementIndex, matched: 0, - initialCombinator: haystackElement.combinator }); - } - for (i = 0; i < potentialMatches.length; i++) { - potentialMatch = potentialMatches[i]; - // selectors add " " onto the first element. When we use & it joins the selectors together, but if we don't - // then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to - // work out what the resulting combinator will be - targetCombinator = haystackElement.combinator.value; - if (targetCombinator === '' && hackstackElementIndex === 0) { - targetCombinator = ' '; - } - // if we don't match, null our match to indicate failure - if (!extendVisitor.isElementValuesEqual(needleElements[potentialMatch.matched].value, haystackElement.value) || - (potentialMatch.matched > 0 && needleElements[potentialMatch.matched].combinator.value !== targetCombinator)) { - potentialMatch = null; - } - else { - potentialMatch.matched++; - } - // if we are still valid and have finished, test whether we have elements after and whether these are allowed - if (potentialMatch) { - potentialMatch.finished = potentialMatch.matched === needleElements.length; - if (potentialMatch.finished && - (!extend.allowAfter && - (hackstackElementIndex + 1 < hackstackSelector.elements.length || haystackSelectorIndex + 1 < haystackSelectorPath.length))) { - potentialMatch = null; - } - } - // if null we remove, if not, we are still valid, so either push as a valid match or continue - if (potentialMatch) { - if (potentialMatch.finished) { - potentialMatch.length = needleElements.length; - potentialMatch.endPathIndex = haystackSelectorIndex; - potentialMatch.endPathElementIndex = hackstackElementIndex + 1; // index after end of match - potentialMatches.length = 0; // we don't allow matches to overlap, so start matching again - matches.push(potentialMatch); - } - } - else { - potentialMatches.splice(i, 1); - i--; - } - } - } - } - return matches; - }; - ProcessExtendsVisitor.prototype.isElementValuesEqual = function (elementValue1, elementValue2) { - if (typeof elementValue1 === 'string' || typeof elementValue2 === 'string') { - return elementValue1 === elementValue2; - } - if (elementValue1 instanceof tree.Attribute) { - if (elementValue1.op !== elementValue2.op || elementValue1.key !== elementValue2.key) { - return false; - } - if (!elementValue1.value || !elementValue2.value) { - if (elementValue1.value || elementValue2.value) { - return false; - } - return true; - } - elementValue1 = elementValue1.value.value || elementValue1.value; - elementValue2 = elementValue2.value.value || elementValue2.value; - return elementValue1 === elementValue2; - } - elementValue1 = elementValue1.value; - elementValue2 = elementValue2.value; - if (elementValue1 instanceof tree.Selector) { - if (!(elementValue2 instanceof tree.Selector) || elementValue1.elements.length !== elementValue2.elements.length) { - return false; - } - for (var i_1 = 0; i_1 < elementValue1.elements.length; i_1++) { - if (elementValue1.elements[i_1].combinator.value !== elementValue2.elements[i_1].combinator.value) { - if (i_1 !== 0 || (elementValue1.elements[i_1].combinator.value || ' ') !== (elementValue2.elements[i_1].combinator.value || ' ')) { - return false; - } - } - if (!this.isElementValuesEqual(elementValue1.elements[i_1].value, elementValue2.elements[i_1].value)) { - return false; - } - } - return true; - } - return false; - }; - ProcessExtendsVisitor.prototype.extendSelector = function (matches, selectorPath, replacementSelector, isVisible) { - // for a set of matches, replace each match with the replacement selector - var currentSelectorPathIndex = 0, currentSelectorPathElementIndex = 0, path = [], matchIndex, selector, firstElement, match, newElements; - for (matchIndex = 0; matchIndex < matches.length; matchIndex++) { - match = matches[matchIndex]; - selector = selectorPath[match.pathIndex]; - firstElement = new tree.Element(match.initialCombinator, replacementSelector.elements[0].value, replacementSelector.elements[0].isVariable, replacementSelector.elements[0].getIndex(), replacementSelector.elements[0].fileInfo()); - if (match.pathIndex > currentSelectorPathIndex && currentSelectorPathElementIndex > 0) { - path[path.length - 1].elements = path[path.length - 1] - .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex)); - currentSelectorPathElementIndex = 0; - currentSelectorPathIndex++; - } - newElements = selector.elements - .slice(currentSelectorPathElementIndex, match.index) - .concat([firstElement]) - .concat(replacementSelector.elements.slice(1)); - if (currentSelectorPathIndex === match.pathIndex && matchIndex > 0) { - path[path.length - 1].elements = - path[path.length - 1].elements.concat(newElements); - } - else { - path = path.concat(selectorPath.slice(currentSelectorPathIndex, match.pathIndex)); - path.push(new tree.Selector(newElements)); - } - currentSelectorPathIndex = match.endPathIndex; - currentSelectorPathElementIndex = match.endPathElementIndex; - if (currentSelectorPathElementIndex >= selectorPath[currentSelectorPathIndex].elements.length) { - currentSelectorPathElementIndex = 0; - currentSelectorPathIndex++; - } - } - if (currentSelectorPathIndex < selectorPath.length && currentSelectorPathElementIndex > 0) { - path[path.length - 1].elements = path[path.length - 1] - .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex)); - currentSelectorPathIndex++; - } - path = path.concat(selectorPath.slice(currentSelectorPathIndex, selectorPath.length)); - path = path.map(function (currentValue) { - // we can re-use elements here, because the visibility property matters only for selectors - var derived = currentValue.createDerived(currentValue.elements); - if (isVisible) { - derived.ensureVisibility(); - } - else { - derived.ensureInvisibility(); - } - return derived; - }); - return path; - }; - ProcessExtendsVisitor.prototype.visitMedia = function (mediaNode, visitArgs) { - var newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]); - newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, mediaNode.allExtends)); - this.allExtendsStack.push(newAllExtends); - }; - ProcessExtendsVisitor.prototype.visitMediaOut = function (mediaNode) { - var lastIndex = this.allExtendsStack.length - 1; - this.allExtendsStack.length = lastIndex; - }; - ProcessExtendsVisitor.prototype.visitAtRule = function (atRuleNode, visitArgs) { - var newAllExtends = atRuleNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]); - newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, atRuleNode.allExtends)); - this.allExtendsStack.push(newAllExtends); - }; - ProcessExtendsVisitor.prototype.visitAtRuleOut = function (atRuleNode) { - var lastIndex = this.allExtendsStack.length - 1; - this.allExtendsStack.length = lastIndex; - }; - return ProcessExtendsVisitor; - }()); - - /* eslint-disable no-unused-vars */ - var JoinSelectorVisitor = /** @class */ (function () { - function JoinSelectorVisitor() { - this.contexts = [[]]; - this._visitor = new Visitor(this); - } - JoinSelectorVisitor.prototype.run = function (root) { - return this._visitor.visit(root); - }; - JoinSelectorVisitor.prototype.visitDeclaration = function (declNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - JoinSelectorVisitor.prototype.visitMixinDefinition = function (mixinDefinitionNode, visitArgs) { - visitArgs.visitDeeper = false; - }; - JoinSelectorVisitor.prototype.visitRuleset = function (rulesetNode, visitArgs) { - var context = this.contexts[this.contexts.length - 1]; - var paths = []; - var selectors; - this.contexts.push(paths); - if (!rulesetNode.root) { - selectors = rulesetNode.selectors; - if (selectors) { - selectors = selectors.filter(function (selector) { return selector.getIsOutput(); }); - rulesetNode.selectors = selectors.length ? selectors : (selectors = null); - if (selectors) { - rulesetNode.joinSelectors(paths, context, selectors); - } - } - if (!selectors) { - rulesetNode.rules = null; - } - rulesetNode.paths = paths; - } - }; - JoinSelectorVisitor.prototype.visitRulesetOut = function (rulesetNode) { - this.contexts.length = this.contexts.length - 1; - }; - JoinSelectorVisitor.prototype.visitMedia = function (mediaNode, visitArgs) { - var context = this.contexts[this.contexts.length - 1]; - mediaNode.rules[0].root = (context.length === 0 || context[0].multiMedia); - }; - JoinSelectorVisitor.prototype.visitAtRule = function (atRuleNode, visitArgs) { - var context = this.contexts[this.contexts.length - 1]; - if (atRuleNode.declarations && atRuleNode.declarations.length) { - atRuleNode.declarations[0].root = (context.length === 0 || context[0].multiMedia); - } - else if (atRuleNode.rules && atRuleNode.rules.length) { - atRuleNode.rules[0].root = (atRuleNode.isRooted || context.length === 0 || null); - } - }; - return JoinSelectorVisitor; - }()); - - /* eslint-disable no-unused-vars */ - var CSSVisitorUtils = /** @class */ (function () { - function CSSVisitorUtils(context) { - this._visitor = new Visitor(this); - this._context = context; - } - CSSVisitorUtils.prototype.containsSilentNonBlockedChild = function (bodyRules) { - var rule; - if (!bodyRules) { - return false; - } - for (var r = 0; r < bodyRules.length; r++) { - rule = bodyRules[r]; - if (rule.isSilent && rule.isSilent(this._context) && !rule.blocksVisibility()) { - // the atrule contains something that was referenced (likely by extend) - // therefore it needs to be shown in output too - return true; - } - } - return false; - }; - CSSVisitorUtils.prototype.keepOnlyVisibleChilds = function (owner) { - if (owner && owner.rules) { - owner.rules = owner.rules.filter(function (thing) { return thing.isVisible(); }); - } - }; - CSSVisitorUtils.prototype.isEmpty = function (owner) { - return (owner && owner.rules) - ? (owner.rules.length === 0) : true; - }; - CSSVisitorUtils.prototype.hasVisibleSelector = function (rulesetNode) { - return (rulesetNode && rulesetNode.paths) - ? (rulesetNode.paths.length > 0) : false; - }; - CSSVisitorUtils.prototype.resolveVisibility = function (node) { - if (!node.blocksVisibility()) { - if (this.isEmpty(node)) { - return; - } - return node; - } - var compiledRulesBody = node.rules[0]; - this.keepOnlyVisibleChilds(compiledRulesBody); - if (this.isEmpty(compiledRulesBody)) { - return; - } - node.ensureVisibility(); - node.removeVisibilityBlock(); - return node; - }; - CSSVisitorUtils.prototype.isVisibleRuleset = function (rulesetNode) { - if (rulesetNode.firstRoot) { - return true; - } - if (this.isEmpty(rulesetNode)) { - return false; - } - if (!rulesetNode.root && !this.hasVisibleSelector(rulesetNode)) { - return false; - } - return true; - }; - return CSSVisitorUtils; - }()); - var ToCSSVisitor = function (context) { - this._visitor = new Visitor(this); - this._context = context; - this.utils = new CSSVisitorUtils(context); - }; - ToCSSVisitor.prototype = { - isReplacing: true, - run: function (root) { - return this._visitor.visit(root); - }, - visitDeclaration: function (declNode, visitArgs) { - if (declNode.blocksVisibility() || declNode.variable) { - return; - } - return declNode; - }, - visitMixinDefinition: function (mixinNode, visitArgs) { - // mixin definitions do not get eval'd - this means they keep state - // so we have to clear that state here so it isn't used if toCSS is called twice - mixinNode.frames = []; - }, - visitExtend: function (extendNode, visitArgs) { - }, - visitComment: function (commentNode, visitArgs) { - if (commentNode.blocksVisibility() || commentNode.isSilent(this._context)) { - return; - } - return commentNode; - }, - visitMedia: function (mediaNode, visitArgs) { - var originalRules = mediaNode.rules[0].rules; - mediaNode.accept(this._visitor); - visitArgs.visitDeeper = false; - return this.utils.resolveVisibility(mediaNode, originalRules); - }, - visitImport: function (importNode, visitArgs) { - if (importNode.blocksVisibility()) { - return; - } - return importNode; - }, - visitAtRule: function (atRuleNode, visitArgs) { - if (atRuleNode.rules && atRuleNode.rules.length) { - return this.visitAtRuleWithBody(atRuleNode, visitArgs); - } - else { - return this.visitAtRuleWithoutBody(atRuleNode, visitArgs); - } - }, - visitAnonymous: function (anonymousNode, visitArgs) { - if (!anonymousNode.blocksVisibility()) { - anonymousNode.accept(this._visitor); - return anonymousNode; - } - }, - visitAtRuleWithBody: function (atRuleNode, visitArgs) { - // if there is only one nested ruleset and that one has no path, then it is - // just fake ruleset - function hasFakeRuleset(atRuleNode) { - var bodyRules = atRuleNode.rules; - return bodyRules.length === 1 && (!bodyRules[0].paths || bodyRules[0].paths.length === 0); - } - function getBodyRules(atRuleNode) { - var nodeRules = atRuleNode.rules; - if (hasFakeRuleset(atRuleNode)) { - return nodeRules[0].rules; - } - return nodeRules; - } - // it is still true that it is only one ruleset in array - // this is last such moment - // process childs - var originalRules = getBodyRules(atRuleNode); - atRuleNode.accept(this._visitor); - visitArgs.visitDeeper = false; - if (!this.utils.isEmpty(atRuleNode)) { - this._mergeRules(atRuleNode.rules[0].rules); - } - return this.utils.resolveVisibility(atRuleNode, originalRules); - }, - visitAtRuleWithoutBody: function (atRuleNode, visitArgs) { - if (atRuleNode.blocksVisibility()) { - return; - } - if (atRuleNode.name === '@charset') { - // Only output the debug info together with subsequent @charset definitions - // a comment (or @media statement) before the actual @charset atrule would - // be considered illegal css as it has to be on the first line - if (this.charset) { - if (atRuleNode.debugInfo) { - var comment = new tree.Comment("/* ".concat(atRuleNode.toCSS(this._context).replace(/\n/g, ''), " */\n")); - comment.debugInfo = atRuleNode.debugInfo; - return this._visitor.visit(comment); - } - return; - } - this.charset = true; - } - return atRuleNode; - }, - checkValidNodes: function (rules, isRoot) { - if (!rules) { - return; - } - for (var i_1 = 0; i_1 < rules.length; i_1++) { - var ruleNode = rules[i_1]; - if (isRoot && ruleNode instanceof tree.Declaration && !ruleNode.variable) { - throw { message: 'Properties must be inside selector blocks. They cannot be in the root', - index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename }; - } - if (ruleNode instanceof tree.Call) { - throw { message: "Function '".concat(ruleNode.name, "' did not return a root node"), - index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename }; - } - if (ruleNode.type && !ruleNode.allowRoot) { - throw { message: "".concat(ruleNode.type, " node returned by a function is not valid here"), - index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename }; - } - } - }, - visitRuleset: function (rulesetNode, visitArgs) { - // at this point rulesets are nested into each other - var rule; - var rulesets = []; - this.checkValidNodes(rulesetNode.rules, rulesetNode.firstRoot); - if (!rulesetNode.root) { - // remove invisible paths - this._compileRulesetPaths(rulesetNode); - // remove rulesets from this ruleset body and compile them separately - var nodeRules = rulesetNode.rules; - var nodeRuleCnt = nodeRules ? nodeRules.length : 0; - for (var i_2 = 0; i_2 < nodeRuleCnt;) { - rule = nodeRules[i_2]; - if (rule && rule.rules) { - // visit because we are moving them out from being a child - rulesets.push(this._visitor.visit(rule)); - nodeRules.splice(i_2, 1); - nodeRuleCnt--; - continue; - } - i_2++; - } - // accept the visitor to remove rules and refactor itself - // then we can decide nogw whether we want it or not - // compile body - if (nodeRuleCnt > 0) { - rulesetNode.accept(this._visitor); - } - else { - rulesetNode.rules = null; - } - visitArgs.visitDeeper = false; - } - else { // if (! rulesetNode.root) { - rulesetNode.accept(this._visitor); - visitArgs.visitDeeper = false; - } - if (rulesetNode.rules) { - this._mergeRules(rulesetNode.rules); - this._removeDuplicateRules(rulesetNode.rules); - } - // now decide whether we keep the ruleset - if (this.utils.isVisibleRuleset(rulesetNode)) { - rulesetNode.ensureVisibility(); - rulesets.splice(0, 0, rulesetNode); - } - if (rulesets.length === 1) { - return rulesets[0]; - } - return rulesets; - }, - _compileRulesetPaths: function (rulesetNode) { - if (rulesetNode.paths) { - rulesetNode.paths = rulesetNode.paths - .filter(function (p) { - var i; - if (p[0].elements[0].combinator.value === ' ') { - p[0].elements[0].combinator = new (tree.Combinator)(''); - } - for (i = 0; i < p.length; i++) { - if (p[i].isVisible() && p[i].getIsOutput()) { - return true; - } - } - return false; - }); - } - }, - _removeDuplicateRules: function (rules) { - if (!rules) { - return; - } - // remove duplicates - var ruleCache = {}; - var ruleList; - var rule; - var i; - for (i = rules.length - 1; i >= 0; i--) { - rule = rules[i]; - if (rule instanceof tree.Declaration) { - if (!ruleCache[rule.name]) { - ruleCache[rule.name] = rule; - } - else { - ruleList = ruleCache[rule.name]; - if (ruleList instanceof tree.Declaration) { - ruleList = ruleCache[rule.name] = [ruleCache[rule.name].toCSS(this._context)]; - } - var ruleCSS = rule.toCSS(this._context); - if (ruleList.indexOf(ruleCSS) !== -1) { - rules.splice(i, 1); - } - else { - ruleList.push(ruleCSS); - } - } - } - } - }, - _mergeRules: function (rules) { - if (!rules) { - return; - } - var groups = {}; - var groupsArr = []; - for (var i_3 = 0; i_3 < rules.length; i_3++) { - var rule = rules[i_3]; - if (rule.merge) { - var key = rule.name; - groups[key] ? rules.splice(i_3--, 1) : - groupsArr.push(groups[key] = []); - groups[key].push(rule); - } - } - groupsArr.forEach(function (group) { - if (group.length > 0) { - var result_1 = group[0]; - var space_1 = []; - var comma_1 = [new tree.Expression(space_1)]; - group.forEach(function (rule) { - if ((rule.merge === '+') && (space_1.length > 0)) { - comma_1.push(new tree.Expression(space_1 = [])); - } - space_1.push(rule.value); - result_1.important = result_1.important || rule.important; - }); - result_1.value = new tree.Value(comma_1); - } - }); - } - }; - - var visitors = { - Visitor: Visitor, - ImportVisitor: ImportVisitor, - MarkVisibleSelectorsVisitor: SetTreeVisibilityVisitor, - ExtendVisitor: ProcessExtendsVisitor, - JoinSelectorVisitor: JoinSelectorVisitor, - ToCSSVisitor: ToCSSVisitor - }; - - // Split the input into chunks. - function chunker (input, fail) { - var len = input.length; - var level = 0; - var parenLevel = 0; - var lastOpening; - var lastOpeningParen; - var lastMultiComment; - var lastMultiCommentEndBrace; - var chunks = []; - var emitFrom = 0; - var chunkerCurrentIndex; - var currentChunkStartIndex; - var cc; - var cc2; - var matched; - function emitChunk(force) { - var len = chunkerCurrentIndex - emitFrom; - if (((len < 512) && !force) || !len) { - return; - } - chunks.push(input.slice(emitFrom, chunkerCurrentIndex + 1)); - emitFrom = chunkerCurrentIndex + 1; - } - for (chunkerCurrentIndex = 0; chunkerCurrentIndex < len; chunkerCurrentIndex++) { - cc = input.charCodeAt(chunkerCurrentIndex); - if (((cc >= 97) && (cc <= 122)) || (cc < 34)) { - // a-z or whitespace - continue; - } - switch (cc) { - case 40: // ( - parenLevel++; - lastOpeningParen = chunkerCurrentIndex; - continue; - case 41: // ) - if (--parenLevel < 0) { - return fail('missing opening `(`', chunkerCurrentIndex); - } - continue; - case 59: // ; - if (!parenLevel) { - emitChunk(); - } - continue; - case 123: // { - level++; - lastOpening = chunkerCurrentIndex; - continue; - case 125: // } - if (--level < 0) { - return fail('missing opening `{`', chunkerCurrentIndex); - } - if (!level && !parenLevel) { - emitChunk(); - } - continue; - case 92: // \ - if (chunkerCurrentIndex < len - 1) { - chunkerCurrentIndex++; - continue; - } - return fail('unescaped `\\`', chunkerCurrentIndex); - case 34: - case 39: - case 96: // ", ' and ` - matched = 0; - currentChunkStartIndex = chunkerCurrentIndex; - for (chunkerCurrentIndex = chunkerCurrentIndex + 1; chunkerCurrentIndex < len; chunkerCurrentIndex++) { - cc2 = input.charCodeAt(chunkerCurrentIndex); - if (cc2 > 96) { - continue; - } - if (cc2 == cc) { - matched = 1; - break; - } - if (cc2 == 92) { // \ - if (chunkerCurrentIndex == len - 1) { - return fail('unescaped `\\`', chunkerCurrentIndex); - } - chunkerCurrentIndex++; - } - } - if (matched) { - continue; - } - return fail("unmatched `".concat(String.fromCharCode(cc), "`"), currentChunkStartIndex); - case 47: // /, check for comment - if (parenLevel || (chunkerCurrentIndex == len - 1)) { - continue; - } - cc2 = input.charCodeAt(chunkerCurrentIndex + 1); - if (cc2 == 47) { - // //, find lnfeed - for (chunkerCurrentIndex = chunkerCurrentIndex + 2; chunkerCurrentIndex < len; chunkerCurrentIndex++) { - cc2 = input.charCodeAt(chunkerCurrentIndex); - if ((cc2 <= 13) && ((cc2 == 10) || (cc2 == 13))) { - break; - } - } - } - else if (cc2 == 42) { - // /*, find */ - lastMultiComment = currentChunkStartIndex = chunkerCurrentIndex; - for (chunkerCurrentIndex = chunkerCurrentIndex + 2; chunkerCurrentIndex < len - 1; chunkerCurrentIndex++) { - cc2 = input.charCodeAt(chunkerCurrentIndex); - if (cc2 == 125) { - lastMultiCommentEndBrace = chunkerCurrentIndex; - } - if (cc2 != 42) { - continue; - } - if (input.charCodeAt(chunkerCurrentIndex + 1) == 47) { - break; - } - } - if (chunkerCurrentIndex == len - 1) { - return fail('missing closing `*/`', currentChunkStartIndex); - } - chunkerCurrentIndex++; - } - continue; - case 42: // *, check for unmatched */ - if ((chunkerCurrentIndex < len - 1) && (input.charCodeAt(chunkerCurrentIndex + 1) == 47)) { - return fail('unmatched `/*`', chunkerCurrentIndex); - } - continue; - } - } - if (level !== 0) { - if ((lastMultiComment > lastOpening) && (lastMultiCommentEndBrace > lastMultiComment)) { - return fail('missing closing `}` or `*/`', lastOpening); - } - else { - return fail('missing closing `}`', lastOpening); - } - } - else if (parenLevel !== 0) { - return fail('missing closing `)`', lastOpeningParen); - } - emitChunk(true); - return chunks; - } - - var getParserInput = (function () { - var // Less input string - input; - var // current chunk - j; - var // holds state for backtracking - saveStack = []; - var // furthest index the parser has gone to - furthest; - var // if this is furthest we got to, this is the probably cause - furthestPossibleErrorMessage; - var // chunkified input - chunks; - var // current chunk - current; - var // index of current chunk, in `input` - currentPos; - var parserInput = {}; - var CHARCODE_SPACE = 32; - var CHARCODE_TAB = 9; - var CHARCODE_LF = 10; - var CHARCODE_CR = 13; - var CHARCODE_PLUS = 43; - var CHARCODE_COMMA = 44; - var CHARCODE_FORWARD_SLASH = 47; - var CHARCODE_9 = 57; - function skipWhitespace(length) { - var oldi = parserInput.i; - var oldj = j; - var curr = parserInput.i - currentPos; - var endIndex = parserInput.i + current.length - curr; - var mem = (parserInput.i += length); - var inp = input; - var c; - var nextChar; - var comment; - for (; parserInput.i < endIndex; parserInput.i++) { - c = inp.charCodeAt(parserInput.i); - if (parserInput.autoCommentAbsorb && c === CHARCODE_FORWARD_SLASH) { - nextChar = inp.charAt(parserInput.i + 1); - if (nextChar === '/') { - comment = { index: parserInput.i, isLineComment: true }; - var nextNewLine = inp.indexOf('\n', parserInput.i + 2); - if (nextNewLine < 0) { - nextNewLine = endIndex; - } - parserInput.i = nextNewLine; - comment.text = inp.substr(comment.index, parserInput.i - comment.index); - parserInput.commentStore.push(comment); - continue; - } - else if (nextChar === '*') { - var nextStarSlash = inp.indexOf('*/', parserInput.i + 2); - if (nextStarSlash >= 0) { - comment = { - index: parserInput.i, - text: inp.substr(parserInput.i, nextStarSlash + 2 - parserInput.i), - isLineComment: false - }; - parserInput.i += comment.text.length - 1; - parserInput.commentStore.push(comment); - continue; - } - } - break; - } - if ((c !== CHARCODE_SPACE) && (c !== CHARCODE_LF) && (c !== CHARCODE_TAB) && (c !== CHARCODE_CR)) { - break; - } - } - current = current.slice(length + parserInput.i - mem + curr); - currentPos = parserInput.i; - if (!current.length) { - if (j < chunks.length - 1) { - current = chunks[++j]; - skipWhitespace(0); // skip space at the beginning of a chunk - return true; // things changed - } - parserInput.finished = true; - } - return oldi !== parserInput.i || oldj !== j; - } - parserInput.save = function () { - currentPos = parserInput.i; - saveStack.push({ current: current, i: parserInput.i, j: j }); - }; - parserInput.restore = function (possibleErrorMessage) { - if (parserInput.i > furthest || (parserInput.i === furthest && possibleErrorMessage && !furthestPossibleErrorMessage)) { - furthest = parserInput.i; - furthestPossibleErrorMessage = possibleErrorMessage; - } - var state = saveStack.pop(); - current = state.current; - currentPos = parserInput.i = state.i; - j = state.j; - }; - parserInput.forget = function () { - saveStack.pop(); - }; - parserInput.isWhitespace = function (offset) { - var pos = parserInput.i + (offset || 0); - var code = input.charCodeAt(pos); - return (code === CHARCODE_SPACE || code === CHARCODE_CR || code === CHARCODE_TAB || code === CHARCODE_LF); - }; - // Specialization of $(tok) - parserInput.$re = function (tok) { - if (parserInput.i > currentPos) { - current = current.slice(parserInput.i - currentPos); - currentPos = parserInput.i; - } - var m = tok.exec(current); - if (!m) { - return null; - } - skipWhitespace(m[0].length); - if (typeof m === 'string') { - return m; - } - return m.length === 1 ? m[0] : m; - }; - parserInput.$char = function (tok) { - if (input.charAt(parserInput.i) !== tok) { - return null; - } - skipWhitespace(1); - return tok; - }; - parserInput.$peekChar = function (tok) { - if (input.charAt(parserInput.i) !== tok) { - return null; - } - return tok; - }; - parserInput.$str = function (tok) { - var tokLength = tok.length; - // https://jsperf.com/string-startswith/21 - for (var i_1 = 0; i_1 < tokLength; i_1++) { - if (input.charAt(parserInput.i + i_1) !== tok.charAt(i_1)) { - return null; - } - } - skipWhitespace(tokLength); - return tok; - }; - parserInput.$quoted = function (loc) { - var pos = loc || parserInput.i; - var startChar = input.charAt(pos); - if (startChar !== '\'' && startChar !== '"') { - return; - } - var length = input.length; - var currentPosition = pos; - for (var i_2 = 1; i_2 + currentPosition < length; i_2++) { - var nextChar = input.charAt(i_2 + currentPosition); - switch (nextChar) { - case '\\': - i_2++; - continue; - case '\r': - case '\n': - break; - case startChar: { - var str = input.substr(currentPosition, i_2 + 1); - if (!loc && loc !== 0) { - skipWhitespace(i_2 + 1); - return str; - } - return [startChar, str]; - } - } - } - return null; - }; - /** - * Permissive parsing. Ignores everything except matching {} [] () and quotes - * until matching token (outside of blocks) - */ - parserInput.$parseUntil = function (tok) { - var quote = ''; - var returnVal = null; - var inComment = false; - var blockDepth = 0; - var blockStack = []; - var parseGroups = []; - var length = input.length; - var startPos = parserInput.i; - var lastPos = parserInput.i; - var i = parserInput.i; - var loop = true; - var testChar; - if (typeof tok === 'string') { - testChar = function (char) { return char === tok; }; - } - else { - testChar = function (char) { return tok.test(char); }; - } - do { - var nextChar = input.charAt(i); - if (blockDepth === 0 && testChar(nextChar)) { - returnVal = input.substr(lastPos, i - lastPos); - if (returnVal) { - parseGroups.push(returnVal); - } - else { - parseGroups.push(' '); - } - returnVal = parseGroups; - skipWhitespace(i - startPos); - loop = false; - } - else { - if (inComment) { - if (nextChar === '*' && - input.charAt(i + 1) === '/') { - i++; - blockDepth--; - inComment = false; - } - i++; - continue; - } - switch (nextChar) { - case '\\': - i++; - nextChar = input.charAt(i); - parseGroups.push(input.substr(lastPos, i - lastPos + 1)); - lastPos = i + 1; - break; - case '/': - if (input.charAt(i + 1) === '*') { - i++; - inComment = true; - blockDepth++; - } - break; - case '\'': - case '"': - quote = parserInput.$quoted(i); - if (quote) { - parseGroups.push(input.substr(lastPos, i - lastPos), quote); - i += quote[1].length - 1; - lastPos = i + 1; - } - else { - skipWhitespace(i - startPos); - returnVal = nextChar; - loop = false; - } - break; - case '{': - blockStack.push('}'); - blockDepth++; - break; - case '(': - blockStack.push(')'); - blockDepth++; - break; - case '[': - blockStack.push(']'); - blockDepth++; - break; - case '}': - case ')': - case ']': { - var expected = blockStack.pop(); - if (nextChar === expected) { - blockDepth--; - } - else { - // move the parser to the error and return expected - skipWhitespace(i - startPos); - returnVal = expected; - loop = false; - } - } - } - i++; - if (i > length) { - loop = false; - } - } - } while (loop); - return returnVal ? returnVal : null; - }; - parserInput.autoCommentAbsorb = true; - parserInput.commentStore = []; - parserInput.finished = false; - // Same as $(), but don't change the state of the parser, - // just return the match. - parserInput.peek = function (tok) { - if (typeof tok === 'string') { - // https://jsperf.com/string-startswith/21 - for (var i_3 = 0; i_3 < tok.length; i_3++) { - if (input.charAt(parserInput.i + i_3) !== tok.charAt(i_3)) { - return false; - } - } - return true; - } - else { - return tok.test(current); - } - }; - // Specialization of peek() - // TODO remove or change some currentChar calls to peekChar - parserInput.peekChar = function (tok) { return input.charAt(parserInput.i) === tok; }; - parserInput.currentChar = function () { return input.charAt(parserInput.i); }; - parserInput.prevChar = function () { return input.charAt(parserInput.i - 1); }; - parserInput.getInput = function () { return input; }; - parserInput.peekNotNumeric = function () { - var c = input.charCodeAt(parserInput.i); - // Is the first char of the dimension 0-9, '.', '+' or '-' - return (c > CHARCODE_9 || c < CHARCODE_PLUS) || c === CHARCODE_FORWARD_SLASH || c === CHARCODE_COMMA; - }; - parserInput.start = function (str, chunkInput, failFunction) { - input = str; - parserInput.i = j = currentPos = furthest = 0; - // chunking apparently makes things quicker (but my tests indicate - // it might actually make things slower in node at least) - // and it is a non-perfect parse - it can't recognise - // unquoted urls, meaning it can't distinguish comments - // meaning comments with quotes or {}() in them get 'counted' - // and then lead to parse errors. - // In addition if the chunking chunks in the wrong place we might - // not be able to parse a parser statement in one go - // this is officially deprecated but can be switched on via an option - // in the case it causes too much performance issues. - if (chunkInput) { - chunks = chunker(str, failFunction); - } - else { - chunks = [str]; - } - current = chunks[0]; - skipWhitespace(0); - }; - parserInput.end = function () { - var message; - var isFinished = parserInput.i >= input.length; - if (parserInput.i < furthest) { - message = furthestPossibleErrorMessage; - parserInput.i = furthest; - } - return { - isFinished: isFinished, - furthest: parserInput.i, - furthestPossibleErrorMessage: message, - furthestReachedEnd: parserInput.i >= input.length - 1, - furthestChar: input[parserInput.i] - }; - }; - return parserInput; - }); - - function makeRegistry(base) { - return { - _data: {}, - add: function (name, func) { - // precautionary case conversion, as later querying of - // the registry by function-caller uses lower case as well. - name = name.toLowerCase(); - // eslint-disable-next-line no-prototype-builtins - if (this._data.hasOwnProperty(name)) ; - this._data[name] = func; - }, - addMultiple: function (functions) { - var _this = this; - Object.keys(functions).forEach(function (name) { - _this.add(name, functions[name]); - }); - }, - get: function (name) { - return this._data[name] || (base && base.get(name)); - }, - getLocalFunctions: function () { - return this._data; - }, - inherit: function () { - return makeRegistry(this); - }, - create: function (base) { - return makeRegistry(base); - } - }; - } - var functionRegistry = makeRegistry(null); - - var MediaSyntaxOptions = { - queryInParens: true - }; - var ContainerSyntaxOptions = { - queryInParens: true - }; - - var Anonymous = function (value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) { - this.value = value; - this._index = index; - this._fileInfo = currentFileInfo; - this.mapLines = mapLines; - this.rulesetLike = (typeof rulesetLike === 'undefined') ? false : rulesetLike; - this.allowRoot = true; - this.copyVisibilityInfo(visibilityInfo); - }; - Anonymous.prototype = Object.assign(new Node(), { - type: 'Anonymous', - eval: function () { - return new Anonymous(this.value, this._index, this._fileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo()); - }, - compare: function (other) { - return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined; - }, - isRulesetLike: function () { - return this.rulesetLike; - }, - genCSS: function (context, output) { - this.nodeVisible = Boolean(this.value); - if (this.nodeVisible) { - output.add(this.value, this._fileInfo, this._index, this.mapLines); - } - } - }); - - // - // less.js - parser - // - // A relatively straight-forward predictive parser. - // There is no tokenization/lexing stage, the input is parsed - // in one sweep. - // - // To make the parser fast enough to run in the browser, several - // optimization had to be made: - // - // - Matching and slicing on a huge input is often cause of slowdowns. - // The solution is to chunkify the input into smaller strings. - // The chunks are stored in the `chunks` var, - // `j` holds the current chunk index, and `currentPos` holds - // the index of the current chunk in relation to `input`. - // This gives us an almost 4x speed-up. - // - // - In many cases, we don't need to match individual tokens; - // for example, if a value doesn't hold any variables, operations - // or dynamic references, the parser can effectively 'skip' it, - // treating it as a literal. - // An example would be '1px solid #000' - which evaluates to itself, - // we don't need to know what the individual components are. - // The drawback, of course is that you don't get the benefits of - // syntax-checking on the CSS. This gives us a 50% speed-up in the parser, - // and a smaller speed-up in the code-gen. - // - // - // Token matching is done with the `$` function, which either takes - // a terminal string or regexp, or a non-terminal function to call. - // It also takes care of moving all the indices forwards. - // - var Parser = function Parser(context, imports, fileInfo, currentIndex) { - currentIndex = currentIndex || 0; - var parsers; - var parserInput = getParserInput(); - function error(msg, type) { - throw new LessError({ - index: parserInput.i, - filename: fileInfo.filename, - type: type || 'Syntax', - message: msg - }, imports); - } - /** - * - * @param {string} msg - * @param {number} index - * @param {string} type - */ - function warn(msg, index, type) { - if (!context.quiet) { - logger$1.warn((new LessError({ - index: index !== null && index !== void 0 ? index : parserInput.i, - filename: fileInfo.filename, - type: type ? "".concat(type.toUpperCase(), " WARNING") : 'WARNING', - message: msg - }, imports)).toString()); - } - } - function expect(arg, msg) { - // some older browsers return typeof 'function' for RegExp - var result = (arg instanceof Function) ? arg.call(parsers) : parserInput.$re(arg); - if (result) { - return result; - } - error(msg || (typeof arg === 'string' - ? "expected '".concat(arg, "' got '").concat(parserInput.currentChar(), "'") - : 'unexpected token')); - } - // Specialization of expect() - function expectChar(arg, msg) { - if (parserInput.$char(arg)) { - return arg; - } - error(msg || "expected '".concat(arg, "' got '").concat(parserInput.currentChar(), "'")); - } - function getDebugInfo(index) { - var filename = fileInfo.filename; - return { - lineNumber: getLocation(index, parserInput.getInput()).line + 1, - fileName: filename - }; - } - /** - * Used after initial parsing to create nodes on the fly - * - * @param {String} str - string to parse - * @param {Array} parseList - array of parsers to run input through e.g. ["value", "important"] - * @param {Number} currentIndex - start number to begin indexing - * @param {Object} fileInfo - fileInfo to attach to created nodes - */ - function parseNode(str, parseList, callback) { - var result; - var returnNodes = []; - var parser = parserInput; - try { - parser.start(str, false, function fail(msg, index) { - callback({ - message: msg, - index: index + currentIndex - }); - }); - for (var x = 0, p = void 0; (p = parseList[x]); x++) { - result = parsers[p](); - returnNodes.push(result || null); - } - var endInfo = parser.end(); - if (endInfo.isFinished) { - callback(null, returnNodes); - } - else { - callback(true, null); - } - } - catch (e) { - throw new LessError({ - index: e.index + currentIndex, - message: e.message - }, imports, fileInfo.filename); - } - } - // - // The Parser - // - return { - parserInput: parserInput, - imports: imports, - fileInfo: fileInfo, - parseNode: parseNode, - // - // Parse an input string into an abstract syntax tree, - // @param str A string containing 'less' markup - // @param callback call `callback` when done. - // @param [additionalData] An optional map which can contains vars - a map (key, value) of variables to apply - // - parse: function (str, callback, additionalData) { - var root; - var err = null; - var globalVars; - var modifyVars; - var ignored; - var preText = ''; - // Optionally disable @plugin parsing - if (additionalData && additionalData.disablePluginRule) { - parsers.plugin = function () { - var dir = parserInput.$re(/^@plugin?\s+/); - if (dir) { - error('@plugin statements are not allowed when disablePluginRule is set to true'); - } - }; - } - globalVars = (additionalData && additionalData.globalVars) ? "".concat(Parser.serializeVars(additionalData.globalVars), "\n") : ''; - modifyVars = (additionalData && additionalData.modifyVars) ? "\n".concat(Parser.serializeVars(additionalData.modifyVars)) : ''; - if (context.pluginManager) { - var preProcessors = context.pluginManager.getPreProcessors(); - for (var i_1 = 0; i_1 < preProcessors.length; i_1++) { - str = preProcessors[i_1].process(str, { context: context, imports: imports, fileInfo: fileInfo }); - } - } - if (globalVars || (additionalData && additionalData.banner)) { - preText = ((additionalData && additionalData.banner) ? additionalData.banner : '') + globalVars; - ignored = imports.contentsIgnoredChars; - ignored[fileInfo.filename] = ignored[fileInfo.filename] || 0; - ignored[fileInfo.filename] += preText.length; - } - str = str.replace(/\r\n?/g, '\n'); - // Remove potential UTF Byte Order Mark - str = preText + str.replace(/^\uFEFF/, '') + modifyVars; - imports.contents[fileInfo.filename] = str; - // Start with the primary rule. - // The whole syntax tree is held under a Ruleset node, - // with the `root` property set to true, so no `{}` are - // output. The callback is called when the input is parsed. - try { - parserInput.start(str, context.chunkInput, function fail(msg, index) { - throw new LessError({ - index: index, - type: 'Parse', - message: msg, - filename: fileInfo.filename - }, imports); - }); - tree.Node.prototype.parse = this; - root = new tree.Ruleset(null, this.parsers.primary()); - tree.Node.prototype.rootNode = root; - root.root = true; - root.firstRoot = true; - root.functionRegistry = functionRegistry.inherit(); - } - catch (e) { - return callback(new LessError(e, imports, fileInfo.filename)); - } - // If `i` is smaller than the `input.length - 1`, - // it means the parser wasn't able to parse the whole - // string, so we've got a parsing error. - // - // We try to extract a \n delimited string, - // showing the line where the parse error occurred. - // We split it up into two parts (the part which parsed, - // and the part which didn't), so we can color them differently. - var endInfo = parserInput.end(); - if (!endInfo.isFinished) { - var message = endInfo.furthestPossibleErrorMessage; - if (!message) { - message = 'Unrecognised input'; - if (endInfo.furthestChar === '}') { - message += '. Possibly missing opening \'{\''; - } - else if (endInfo.furthestChar === ')') { - message += '. Possibly missing opening \'(\''; - } - else if (endInfo.furthestReachedEnd) { - message += '. Possibly missing something'; - } - } - err = new LessError({ - type: 'Parse', - message: message, - index: endInfo.furthest, - filename: fileInfo.filename - }, imports); - } - var finish = function (e) { - e = err || e || imports.error; - if (e) { - if (!(e instanceof LessError)) { - e = new LessError(e, imports, fileInfo.filename); - } - return callback(e); - } - else { - return callback(null, root); - } - }; - if (context.processImports !== false) { - new visitors.ImportVisitor(imports, finish) - .run(root); - } - else { - return finish(); - } - }, - // - // Here in, the parsing rules/functions - // - // The basic structure of the syntax tree generated is as follows: - // - // Ruleset -> Declaration -> Value -> Expression -> Entity - // - // Here's some Less code: - // - // .class { - // color: #fff; - // border: 1px solid #000; - // width: @w + 4px; - // > .child {...} - // } - // - // And here's what the parse tree might look like: - // - // Ruleset (Selector '.class', [ - // Declaration ("color", Value ([Expression [Color #fff]])) - // Declaration ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]])) - // Declaration ("width", Value ([Expression [Operation " + " [Variable "@w"][Dimension 4px]]])) - // Ruleset (Selector [Element '>', '.child'], [...]) - // ]) - // - // In general, most rules will try to parse a token with the `$re()` function, and if the return - // value is truly, will return a new node, of the relevant type. Sometimes, we need to check - // first, before parsing, that's when we use `peek()`. - // - parsers: parsers = { - // - // The `primary` rule is the *entry* and *exit* point of the parser. - // The rules here can appear at any level of the parse tree. - // - // The recursive nature of the grammar is an interplay between the `block` - // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule, - // as represented by this simplified grammar: - // - // primary → (ruleset | declaration)+ - // ruleset → selector+ block - // block → '{' primary '}' - // - // Only at one point is the primary rule not called from the - // block rule: at the root level. - // - primary: function () { - var mixin = this.mixin; - var root = []; - var node; - while (true) { - while (true) { - node = this.comment(); - if (!node) { - break; - } - root.push(node); - } - // always process comments before deciding if finished - if (parserInput.finished) { - break; - } - if (parserInput.peek('}')) { - break; - } - node = this.extendRule(); - if (node) { - root = root.concat(node); - continue; - } - node = mixin.definition() || this.declaration() || mixin.call(false, false) || - this.ruleset() || this.variableCall() || this.entities.call() || this.atrule(); - if (node) { - root.push(node); - } - else { - var foundSemiColon = false; - while (parserInput.$char(';')) { - foundSemiColon = true; - } - if (!foundSemiColon) { - break; - } - } - } - return root; - }, - // comments are collected by the main parsing mechanism and then assigned to nodes - // where the current structure allows it - comment: function () { - if (parserInput.commentStore.length) { - var comment = parserInput.commentStore.shift(); - return new (tree.Comment)(comment.text, comment.isLineComment, comment.index + currentIndex, fileInfo); - } - }, - // - // Entities are tokens which can be found inside an Expression - // - entities: { - mixinLookup: function () { - return parsers.mixin.call(true, true); - }, - // - // A string, which supports escaping " and ' - // - // "milky way" 'he\'s the one!' - // - quoted: function (forceEscaped) { - var str; - var index = parserInput.i; - var isEscaped = false; - parserInput.save(); - if (parserInput.$char('~')) { - isEscaped = true; - } - else if (forceEscaped) { - parserInput.restore(); - return; - } - str = parserInput.$quoted(); - if (!str) { - parserInput.restore(); - return; - } - parserInput.forget(); - return new (tree.Quoted)(str.charAt(0), str.substr(1, str.length - 2), isEscaped, index + currentIndex, fileInfo); - }, - // - // A catch-all word, such as: - // - // black border-collapse - // - keyword: function () { - var k = parserInput.$char('%') || parserInput.$re(/^\[?(?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+\]?/); - if (k) { - return tree.Color.fromKeyword(k) || new (tree.Keyword)(k); - } - }, - // - // A function call - // - // rgb(255, 0, 255) - // - // The arguments are parsed with the `entities.arguments` parser. - // - call: function () { - var name; - var args; - var func; - var index = parserInput.i; - // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 - if (parserInput.peek(/^url\(/i)) { - return; - } - parserInput.save(); - name = parserInput.$re(/^([\w-]+|%|~|progid:[\w.]+)\(/); - if (!name) { - parserInput.forget(); - return; - } - name = name[1]; - func = this.customFuncCall(name); - if (func) { - args = func.parse(); - if (args && func.stop) { - parserInput.forget(); - return args; - } - } - args = this.arguments(args); - if (!parserInput.$char(')')) { - parserInput.restore('Could not parse call arguments or missing \')\''); - return; - } - parserInput.forget(); - return new (tree.Call)(name, args, index + currentIndex, fileInfo); - }, - declarationCall: function () { - var validCall; - var args; - var index = parserInput.i; - parserInput.save(); - validCall = parserInput.$re(/^[\w]+\(/); - if (!validCall) { - parserInput.forget(); - return; - } - validCall = validCall.substring(0, validCall.length - 1); - var rule = this.ruleProperty(); - var value; - if (rule) { - value = this.value(); - } - if (rule && value) { - args = [new (tree.Declaration)(rule, value, null, null, parserInput.i + currentIndex, fileInfo, true)]; - } - if (!parserInput.$char(')')) { - parserInput.restore('Could not parse call arguments or missing \')\''); - return; - } - parserInput.forget(); - return new (tree.Call)(validCall, args, index + currentIndex, fileInfo); - }, - // - // Parsing rules for functions with non-standard args, e.g.: - // - // boolean(not(2 > 1)) - // - // This is a quick prototype, to be modified/improved when - // more custom-parsed funcs come (e.g. `selector(...)`) - // - customFuncCall: function (name) { - /* Ideally the table is to be moved out of here for faster perf., - but it's quite tricky since it relies on all these `parsers` - and `expect` available only here */ - return { - alpha: f(parsers.ieAlpha, true), - boolean: f(condition), - 'if': f(condition) - }[name.toLowerCase()]; - function f(parse, stop) { - return { - parse: parse, - stop: stop // when true - stop after parse() and return its result, - // otherwise continue for plain args - }; - } - function condition() { - return [expect(parsers.condition, 'expected condition')]; - } - }, - arguments: function (prevArgs) { - var argsComma = prevArgs || []; - var argsSemiColon = []; - var isSemiColonSeparated; - var value; - parserInput.save(); - while (true) { - if (prevArgs) { - prevArgs = false; - } - else { - value = parsers.detachedRuleset() || this.assignment() || parsers.expression(); - if (!value) { - break; - } - if (value.value && value.value.length == 1) { - value = value.value[0]; - } - argsComma.push(value); - } - if (parserInput.$char(',')) { - continue; - } - if (parserInput.$char(';') || isSemiColonSeparated) { - isSemiColonSeparated = true; - value = (argsComma.length < 1) ? argsComma[0] - : new tree.Value(argsComma); - argsSemiColon.push(value); - argsComma = []; - } - } - parserInput.forget(); - return isSemiColonSeparated ? argsSemiColon : argsComma; - }, - literal: function () { - return this.dimension() || - this.color() || - this.quoted() || - this.unicodeDescriptor(); - }, - // Assignments are argument entities for calls. - // They are present in ie filter properties as shown below. - // - // filter: progid:DXImageTransform.Microsoft.Alpha( *opacity=50* ) - // - assignment: function () { - var key; - var value; - parserInput.save(); - key = parserInput.$re(/^\w+(?=\s?=)/i); - if (!key) { - parserInput.restore(); - return; - } - if (!parserInput.$char('=')) { - parserInput.restore(); - return; - } - value = parsers.entity(); - if (value) { - parserInput.forget(); - return new (tree.Assignment)(key, value); - } - else { - parserInput.restore(); - } - }, - // - // Parse url() tokens - // - // We use a specific rule for urls, because they don't really behave like - // standard function calls. The difference is that the argument doesn't have - // to be enclosed within a string, so it can't be parsed as an Expression. - // - url: function () { - var value; - var index = parserInput.i; - parserInput.autoCommentAbsorb = false; - if (!parserInput.$str('url(')) { - parserInput.autoCommentAbsorb = true; - return; - } - value = this.quoted() || this.variable() || this.property() || - parserInput.$re(/^(?:(?:\\[()'"])|[^()'"])+/) || ''; - parserInput.autoCommentAbsorb = true; - expectChar(')'); - return new (tree.URL)((value.value !== undefined || - value instanceof tree.Variable || - value instanceof tree.Property) ? - value : new (tree.Anonymous)(value, index), index + currentIndex, fileInfo); - }, - // - // A Variable entity, such as `@fink`, in - // - // width: @fink + 2px - // - // We use a different parser for variable definitions, - // see `parsers.variable`. - // - variable: function () { - var ch; - var name; - var index = parserInput.i; - parserInput.save(); - if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^@@?[\w-]+/))) { - ch = parserInput.currentChar(); - if (ch === '(' || ch === '[' && !parserInput.prevChar().match(/^\s/)) { - // this may be a VariableCall lookup - var result = parsers.variableCall(name); - if (result) { - parserInput.forget(); - return result; - } - } - parserInput.forget(); - return new (tree.Variable)(name, index + currentIndex, fileInfo); - } - parserInput.restore(); - }, - // A variable entity using the protective {} e.g. @{var} - variableCurly: function () { - var curly; - var index = parserInput.i; - if (parserInput.currentChar() === '@' && (curly = parserInput.$re(/^@\{([\w-]+)\}/))) { - return new (tree.Variable)("@".concat(curly[1]), index + currentIndex, fileInfo); - } - }, - // - // A Property accessor, such as `$color`, in - // - // background-color: $color - // - property: function () { - var name; - var index = parserInput.i; - if (parserInput.currentChar() === '$' && (name = parserInput.$re(/^\$[\w-]+/))) { - return new (tree.Property)(name, index + currentIndex, fileInfo); - } - }, - // A property entity useing the protective {} e.g. ${prop} - propertyCurly: function () { - var curly; - var index = parserInput.i; - if (parserInput.currentChar() === '$' && (curly = parserInput.$re(/^\$\{([\w-]+)\}/))) { - return new (tree.Property)("$".concat(curly[1]), index + currentIndex, fileInfo); - } - }, - // - // A Hexadecimal color - // - // #4F3C2F - // - // `rgb` and `hsl` colors are parsed through the `entities.call` parser. - // - color: function () { - var rgb; - parserInput.save(); - if (parserInput.currentChar() === '#' && (rgb = parserInput.$re(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})([\w.#[])?/))) { - if (!rgb[2]) { - parserInput.forget(); - return new (tree.Color)(rgb[1], undefined, rgb[0]); - } - } - parserInput.restore(); - }, - colorKeyword: function () { - parserInput.save(); - var autoCommentAbsorb = parserInput.autoCommentAbsorb; - parserInput.autoCommentAbsorb = false; - var k = parserInput.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/); - parserInput.autoCommentAbsorb = autoCommentAbsorb; - if (!k) { - parserInput.forget(); - return; - } - parserInput.restore(); - var color = tree.Color.fromKeyword(k); - if (color) { - parserInput.$str(k); - return color; - } - }, - // - // A Dimension, that is, a number and a unit - // - // 0.5em 95% - // - dimension: function () { - if (parserInput.peekNotNumeric()) { - return; - } - var value = parserInput.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i); - if (value) { - return new (tree.Dimension)(value[1], value[2]); - } - }, - // - // A unicode descriptor, as is used in unicode-range - // - // U+0?? or U+00A1-00A9 - // - unicodeDescriptor: function () { - var ud; - ud = parserInput.$re(/^U\+[0-9a-fA-F?]+(-[0-9a-fA-F?]+)?/); - if (ud) { - return new (tree.UnicodeDescriptor)(ud[0]); - } - }, - // - // JavaScript code to be evaluated - // - // `window.location.href` - // - javascript: function () { - var js; - var index = parserInput.i; - parserInput.save(); - var escape = parserInput.$char('~'); - var jsQuote = parserInput.$char('`'); - if (!jsQuote) { - parserInput.restore(); - return; - } - js = parserInput.$re(/^[^`]*`/); - if (js) { - parserInput.forget(); - return new (tree.JavaScript)(js.substr(0, js.length - 1), Boolean(escape), index + currentIndex, fileInfo); - } - parserInput.restore('invalid javascript definition'); - } - }, - // - // The variable part of a variable definition. Used in the `rule` parser - // - // @fink: - // - variable: function () { - var name; - if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^(@[\w-]+)\s*:/))) { - return name[1]; - } - }, - // - // Call a variable value to retrieve a detached ruleset - // or a value from a detached ruleset's rules. - // - // @fink(); - // @fink; - // color: @fink[@color]; - // - variableCall: function (parsedName) { - var lookups; - var i = parserInput.i; - var inValue = !!parsedName; - var name = parsedName; - parserInput.save(); - if (name || (parserInput.currentChar() === '@' - && (name = parserInput.$re(/^(@[\w-]+)(\(\s*\))?/)))) { - lookups = this.mixin.ruleLookups(); - if (!lookups && ((inValue && parserInput.$str('()') !== '()') || (name[2] !== '()'))) { - parserInput.restore('Missing \'[...]\' lookup in variable call'); - return; - } - if (!inValue) { - name = name[1]; - } - var call = new tree.VariableCall(name, i, fileInfo); - if (!inValue && parsers.end()) { - parserInput.forget(); - return call; - } - else { - parserInput.forget(); - return new tree.NamespaceValue(call, lookups, i, fileInfo); - } - } - parserInput.restore(); - }, - // - // extend syntax - used to extend selectors - // - extend: function (isRule) { - var elements; - var e; - var index = parserInput.i; - var option; - var extendList; - var extend; - if (!parserInput.$str(isRule ? '&:extend(' : ':extend(')) { - return; - } - do { - option = null; - elements = null; - var first = true; - while (!(option = parserInput.$re(/^(!?all)(?=\s*(\)|,))/))) { - e = this.element(); - if (!e) { - break; - } - /** - * @note - This will not catch selectors in pseudos like :is() and :where() because - * they don't currently parse their contents as selectors. - */ - if (!first && e.combinator.value) { - warn('Targeting complex selectors can have unexpected behavior, and this behavior may change in the future.', index); - } - first = false; - if (elements) { - elements.push(e); - } - else { - elements = [e]; - } - } - option = option && option[1]; - if (!elements) { - error('Missing target selector for :extend().'); - } - extend = new (tree.Extend)(new (tree.Selector)(elements), option, index + currentIndex, fileInfo); - if (extendList) { - extendList.push(extend); - } - else { - extendList = [extend]; - } - } while (parserInput.$char(',')); - expect(/^\)/); - if (isRule) { - expect(/^;/); - } - return extendList; - }, - // - // extendRule - used in a rule to extend all the parent selectors - // - extendRule: function () { - return this.extend(true); - }, - // - // Mixins - // - mixin: { - // - // A Mixin call, with an optional argument list - // - // #mixins > .square(#fff); - // #mixins.square(#fff); - // .rounded(4px, black); - // .button; - // - // We can lookup / return a value using the lookup syntax: - // - // color: #mixin.square(#fff)[@color]; - // - // The `while` loop is there because mixins can be - // namespaced, but we only support the child and descendant - // selector for now. - // - call: function (inValue, getLookup) { - var s = parserInput.currentChar(); - var important = false; - var lookups; - var index = parserInput.i; - var elements; - var args; - var hasParens; - var parensIndex; - var parensWS = false; - if (s !== '.' && s !== '#') { - return; - } - parserInput.save(); // stop us absorbing part of an invalid selector - elements = this.elements(); - if (elements) { - parensIndex = parserInput.i; - if (parserInput.$char('(')) { - parensWS = parserInput.isWhitespace(-2); - args = this.args(true).args; - expectChar(')'); - hasParens = true; - if (parensWS) { - warn('Whitespace between a mixin name and parentheses for a mixin call is deprecated', parensIndex, 'DEPRECATED'); - } - } - if (getLookup !== false) { - lookups = this.ruleLookups(); - } - if (getLookup === true && !lookups) { - parserInput.restore(); - return; - } - if (inValue && !lookups && !hasParens) { - // This isn't a valid in-value mixin call - parserInput.restore(); - return; - } - if (!inValue && parsers.important()) { - important = true; - } - if (inValue || parsers.end()) { - parserInput.forget(); - var mixin = new (tree.mixin.Call)(elements, args, index + currentIndex, fileInfo, !lookups && important); - if (lookups) { - return new tree.NamespaceValue(mixin, lookups); - } - else { - if (!hasParens) { - warn('Calling a mixin without parentheses is deprecated', parensIndex, 'DEPRECATED'); - } - return mixin; - } - } - } - parserInput.restore(); - }, - /** - * Matching elements for mixins - * (Start with . or # and can have > ) - */ - elements: function () { - var elements; - var e; - var c; - var elem; - var elemIndex; - var re = /^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/; - while (true) { - elemIndex = parserInput.i; - e = parserInput.$re(re); - if (!e) { - break; - } - elem = new (tree.Element)(c, e, false, elemIndex + currentIndex, fileInfo); - if (elements) { - elements.push(elem); - } - else { - elements = [elem]; - } - c = parserInput.$char('>'); - } - return elements; - }, - args: function (isCall) { - var entities = parsers.entities; - var returner = { args: null, variadic: false }; - var expressions = []; - var argsSemiColon = []; - var argsComma = []; - var isSemiColonSeparated; - var expressionContainsNamed; - var name; - var nameLoop; - var value; - var arg; - var expand; - var hasSep = true; - parserInput.save(); - while (true) { - if (isCall) { - arg = parsers.detachedRuleset() || parsers.expression(); - } - else { - parserInput.commentStore.length = 0; - if (parserInput.$str('...')) { - returner.variadic = true; - if (parserInput.$char(';') && !isSemiColonSeparated) { - isSemiColonSeparated = true; - } - (isSemiColonSeparated ? argsSemiColon : argsComma) - .push({ variadic: true }); - break; - } - arg = entities.variable() || entities.property() || entities.literal() || entities.keyword() || this.call(true); - } - if (!arg || !hasSep) { - break; - } - nameLoop = null; - if (arg.throwAwayComments) { - arg.throwAwayComments(); - } - value = arg; - var val = null; - if (isCall) { - // Variable - if (arg.value && arg.value.length == 1) { - val = arg.value[0]; - } - } - else { - val = arg; - } - if (val && (val instanceof tree.Variable || val instanceof tree.Property)) { - if (parserInput.$char(':')) { - if (expressions.length > 0) { - if (isSemiColonSeparated) { - error('Cannot mix ; and , as delimiter types'); - } - expressionContainsNamed = true; - } - value = parsers.detachedRuleset() || parsers.expression(); - if (!value) { - if (isCall) { - error('could not understand value for named argument'); - } - else { - parserInput.restore(); - returner.args = []; - return returner; - } - } - nameLoop = (name = val.name); - } - else if (parserInput.$str('...')) { - if (!isCall) { - returner.variadic = true; - if (parserInput.$char(';') && !isSemiColonSeparated) { - isSemiColonSeparated = true; - } - (isSemiColonSeparated ? argsSemiColon : argsComma) - .push({ name: arg.name, variadic: true }); - break; - } - else { - expand = true; - } - } - else if (!isCall) { - name = nameLoop = val.name; - value = null; - } - } - if (value) { - expressions.push(value); - } - argsComma.push({ name: nameLoop, value: value, expand: expand }); - if (parserInput.$char(',')) { - hasSep = true; - continue; - } - hasSep = parserInput.$char(';') === ';'; - if (hasSep || isSemiColonSeparated) { - if (expressionContainsNamed) { - error('Cannot mix ; and , as delimiter types'); - } - isSemiColonSeparated = true; - if (expressions.length > 1) { - value = new (tree.Value)(expressions); - } - argsSemiColon.push({ name: name, value: value, expand: expand }); - name = null; - expressions = []; - expressionContainsNamed = false; - } - } - parserInput.forget(); - returner.args = isSemiColonSeparated ? argsSemiColon : argsComma; - return returner; - }, - // - // A Mixin definition, with a list of parameters - // - // .rounded (@radius: 2px, @color) { - // ... - // } - // - // Until we have a finer grained state-machine, we have to - // do a look-ahead, to make sure we don't have a mixin call. - // See the `rule` function for more information. - // - // We start by matching `.rounded (`, and then proceed on to - // the argument list, which has optional default values. - // We store the parameters in `params`, with a `value` key, - // if there is a value, such as in the case of `@radius`. - // - // Once we've got our params list, and a closing `)`, we parse - // the `{...}` block. - // - definition: function () { - var name; - var params = []; - var match; - var ruleset; - var cond; - var variadic = false; - if ((parserInput.currentChar() !== '.' && parserInput.currentChar() !== '#') || - parserInput.peek(/^[^{]*\}/)) { - return; - } - parserInput.save(); - match = parserInput.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/); - if (match) { - name = match[1]; - var argInfo = this.args(false); - params = argInfo.args; - variadic = argInfo.variadic; - // .mixincall("@{a}"); - // looks a bit like a mixin definition.. - // also - // .mixincall(@a: {rule: set;}); - // so we have to be nice and restore - if (!parserInput.$char(')')) { - parserInput.restore('Missing closing \')\''); - return; - } - parserInput.commentStore.length = 0; - if (parserInput.$str('when')) { // Guard - cond = expect(parsers.conditions, 'expected condition'); - } - ruleset = parsers.block(); - if (ruleset) { - parserInput.forget(); - return new (tree.mixin.Definition)(name, params, ruleset, cond, variadic); - } - else { - parserInput.restore(); - } - } - else { - parserInput.restore(); - } - }, - ruleLookups: function () { - var rule; - var lookups = []; - if (parserInput.currentChar() !== '[') { - return; - } - while (true) { - parserInput.save(); - rule = this.lookupValue(); - if (!rule && rule !== '') { - parserInput.restore(); - break; - } - lookups.push(rule); - parserInput.forget(); - } - if (lookups.length > 0) { - return lookups; - } - }, - lookupValue: function () { - parserInput.save(); - if (!parserInput.$char('[')) { - parserInput.restore(); - return; - } - var name = parserInput.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/); - if (!parserInput.$char(']')) { - parserInput.restore(); - return; - } - if (name || name === '') { - parserInput.forget(); - return name; - } - parserInput.restore(); - } - }, - // - // Entities are the smallest recognized token, - // and can be found inside a rule's value. - // - entity: function () { - var entities = this.entities; - return this.comment() || entities.literal() || entities.variable() || entities.url() || - entities.property() || entities.call() || entities.keyword() || this.mixin.call(true) || - entities.javascript(); - }, - // - // A Declaration terminator. Note that we use `peek()` to check for '}', - // because the `block` rule will be expecting it, but we still need to make sure - // it's there, if ';' was omitted. - // - end: function () { - return parserInput.$char(';') || parserInput.peek('}'); - }, - // - // IE's alpha function - // - // alpha(opacity=88) - // - ieAlpha: function () { - var value; - // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 - if (!parserInput.$re(/^opacity=/i)) { - return; - } - value = parserInput.$re(/^\d+/); - if (!value) { - value = expect(parsers.entities.variable, 'Could not parse alpha'); - value = "@{".concat(value.name.slice(1), "}"); - } - expectChar(')'); - return new tree.Quoted('', "alpha(opacity=".concat(value, ")")); - }, - /** - * A Selector Element - * - * div - * + h1 - * #socks - * input[type="text"] - * - * Elements are the building blocks for Selectors, - * they are made out of a `Combinator` (see combinator rule), - * and an element name, such as a tag a class, or `*`. - */ - element: function () { - var e; - var c; - var v; - var index = parserInput.i; - c = this.combinator(); - /** This selector parser is quite simplistic and will pass a number of invalid selectors. */ - e = parserInput.$re(/^(?:\d+\.\d+|\d+)%/) || - // eslint-disable-next-line no-control-regex - parserInput.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/) || - parserInput.$char('*') || parserInput.$char('&') || this.attribute() || - parserInput.$re(/^\([^&()@]+\)/) || parserInput.$re(/^[.#:](?=@)/) || - this.entities.variableCurly(); - if (!e) { - parserInput.save(); - if (parserInput.$char('(')) { - if ((v = this.selector(false))) { - var selectors = []; - while (parserInput.$char(',')) { - selectors.push(v); - selectors.push(new Anonymous(',')); - v = this.selector(false); - } - selectors.push(v); - if (parserInput.$char(')')) { - if (selectors.length > 1) { - e = new (tree.Paren)(new Selector(selectors)); - } - else { - e = new (tree.Paren)(v); - } - parserInput.forget(); - } - else { - parserInput.restore('Missing closing \')\''); - } - } - else { - parserInput.restore('Missing closing \')\''); - } - } - else { - parserInput.forget(); - } - } - if (e) { - return new (tree.Element)(c, e, e instanceof tree.Variable, index + currentIndex, fileInfo); - } - }, - // - // Combinators combine elements together, in a Selector. - // - // Because our parser isn't white-space sensitive, special care - // has to be taken, when parsing the descendant combinator, ` `, - // as it's an empty space. We have to check the previous character - // in the input, to see if it's a ` ` character. More info on how - // we deal with this in *combinator.js*. - // - combinator: function () { - var c = parserInput.currentChar(); - if (c === '/') { - parserInput.save(); - var slashedCombinator = parserInput.$re(/^\/[a-z]+\//i); - if (slashedCombinator) { - parserInput.forget(); - return new (tree.Combinator)(slashedCombinator); - } - parserInput.restore(); - } - if (c === '>' || c === '+' || c === '~' || c === '|' || c === '^') { - parserInput.i++; - if (c === '^' && parserInput.currentChar() === '^') { - c = '^^'; - parserInput.i++; - } - while (parserInput.isWhitespace()) { - parserInput.i++; - } - return new (tree.Combinator)(c); - } - else if (parserInput.isWhitespace(-1)) { - return new (tree.Combinator)(' '); - } - else { - return new (tree.Combinator)(null); - } - }, - // - // A CSS Selector - // with less extensions e.g. the ability to extend and guard - // - // .class > div + h1 - // li a:hover - // - // Selectors are made out of one or more Elements, see above. - // - selector: function (isLess) { - var index = parserInput.i; - var elements; - var extendList; - var c; - var e; - var allExtends; - var when; - var condition; - isLess = isLess !== false; - while ((isLess && (extendList = this.extend())) || (isLess && (when = parserInput.$str('when'))) || (e = this.element())) { - if (when) { - condition = expect(this.conditions, 'expected condition'); - } - else if (condition) { - error('CSS guard can only be used at the end of selector'); - } - else if (extendList) { - if (allExtends) { - allExtends = allExtends.concat(extendList); - } - else { - allExtends = extendList; - } - } - else { - if (allExtends) { - error('Extend can only be used at the end of selector'); - } - c = parserInput.currentChar(); - if (Array.isArray(e)) { - e.forEach(function (ele) { return elements.push(ele); }); - } - if (elements) { - elements.push(e); - } - else { - elements = [e]; - } - e = null; - } - if (c === '{' || c === '}' || c === ';' || c === ',' || c === ')') { - break; - } - } - if (elements) { - return new (tree.Selector)(elements, allExtends, condition, index + currentIndex, fileInfo); - } - if (allExtends) { - error('Extend must be used to extend a selector, it cannot be used on its own'); - } - }, - selectors: function () { - var s; - var selectors; - while (true) { - s = this.selector(); - if (!s) { - break; - } - if (selectors) { - selectors.push(s); - } - else { - selectors = [s]; - } - parserInput.commentStore.length = 0; - if (s.condition && selectors.length > 1) { - error('Guards are only currently allowed on a single selector.'); - } - if (!parserInput.$char(',')) { - break; - } - if (s.condition) { - error('Guards are only currently allowed on a single selector.'); - } - parserInput.commentStore.length = 0; - } - return selectors; - }, - attribute: function () { - if (!parserInput.$char('[')) { - return; - } - var entities = this.entities; - var key; - var val; - var op; - // - // case-insensitive flag - // e.g. [attr operator value i] - // - var cif; - if (!(key = entities.variableCurly())) { - key = expect(/^(?:[_A-Za-z0-9-*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/); - } - op = parserInput.$re(/^[|~*$^]?=/); - if (op) { - val = entities.quoted() || parserInput.$re(/^[0-9]+%/) || parserInput.$re(/^[\w-]+/) || entities.variableCurly(); - if (val) { - cif = parserInput.$re(/^[iIsS]/); - } - } - expectChar(']'); - return new (tree.Attribute)(key, op, val, cif); - }, - // - // The `block` rule is used by `ruleset` and `mixin.definition`. - // It's a wrapper around the `primary` rule, with added `{}`. - // - block: function () { - var content; - if (parserInput.$char('{') && (content = this.primary()) && parserInput.$char('}')) { - return content; - } - }, - blockRuleset: function () { - var block = this.block(); - if (block) { - block = new tree.Ruleset(null, block); - } - return block; - }, - detachedRuleset: function () { - var argInfo; - var params; - var variadic; - parserInput.save(); - if (parserInput.$re(/^[.#]\(/)) { - /** - * DR args currently only implemented for each() function, and not - * yet settable as `@dr: #(@arg) {}` - * This should be done when DRs are merged with mixins. - * See: https://github.com/less/less-meta/issues/16 - */ - argInfo = this.mixin.args(false); - params = argInfo.args; - variadic = argInfo.variadic; - if (!parserInput.$char(')')) { - parserInput.restore(); - return; - } - } - var blockRuleset = this.blockRuleset(); - if (blockRuleset) { - parserInput.forget(); - if (params) { - return new tree.mixin.Definition(null, params, blockRuleset, null, variadic); - } - return new tree.DetachedRuleset(blockRuleset); - } - parserInput.restore(); - }, - // - // div, .class, body > p {...} - // - ruleset: function () { - var selectors; - var rules; - var debugInfo; - parserInput.save(); - if (context.dumpLineNumbers) { - debugInfo = getDebugInfo(parserInput.i); - } - selectors = this.selectors(); - if (selectors && (rules = this.block())) { - parserInput.forget(); - var ruleset = new (tree.Ruleset)(selectors, rules, context.strictImports); - if (context.dumpLineNumbers) { - ruleset.debugInfo = debugInfo; - } - return ruleset; - } - else { - parserInput.restore(); - } - }, - declaration: function () { - var name; - var value; - var index = parserInput.i; - var hasDR; - var c = parserInput.currentChar(); - var important; - var merge; - var isVariable; - if (c === '.' || c === '#' || c === '&' || c === ':') { - return; - } - parserInput.save(); - name = this.variable() || this.ruleProperty(); - if (name) { - isVariable = typeof name === 'string'; - if (isVariable) { - value = this.detachedRuleset(); - if (value) { - hasDR = true; - } - } - parserInput.commentStore.length = 0; - if (!value) { - // a name returned by this.ruleProperty() is always an array of the form: - // [string-1, ..., string-n, ""] or [string-1, ..., string-n, "+"] - // where each item is a tree.Keyword or tree.Variable - merge = !isVariable && name.length > 1 && name.pop().value; - // Custom property values get permissive parsing - if (name[0].value && name[0].value.slice(0, 2) === '--') { - if (parserInput.$char(';')) { - value = new Anonymous(''); - } - else { - value = this.permissiveValue(/[;}]/, true); - } - } - // Try to store values as anonymous - // If we need the value later we'll re-parse it in ruleset.parseValue - else { - value = this.anonymousValue(); - } - if (value) { - parserInput.forget(); - // anonymous values absorb the end ';' which is required for them to work - return new (tree.Declaration)(name, value, false, merge, index + currentIndex, fileInfo); - } - if (!value) { - value = this.value(); - } - if (value) { - important = this.important(); - } - else if (isVariable) { - /** - * As a last resort, try permissiveValue - * - * @todo - This has created some knock-on problems of not - * flagging incorrect syntax or detecting user intent. - */ - value = this.permissiveValue(); - } - } - if (value && (this.end() || hasDR)) { - parserInput.forget(); - return new (tree.Declaration)(name, value, important, merge, index + currentIndex, fileInfo); - } - else { - parserInput.restore(); - } - } - else { - parserInput.restore(); - } - }, - anonymousValue: function () { - var index = parserInput.i; - var match = parserInput.$re(/^([^.#@$+/'"*`(;{}-]*);/); - if (match) { - return new (tree.Anonymous)(match[1], index + currentIndex); - } - }, - /** - * Used for custom properties, at-rules, and variables (as fallback) - * Parses almost anything inside of {} [] () "" blocks - * until it reaches outer-most tokens. - * - * First, it will try to parse comments and entities to reach - * the end. This is mostly like the Expression parser except no - * math is allowed. - * - * @param {RexExp} untilTokens - Characters to stop parsing at - */ - permissiveValue: function (untilTokens) { - var i; - var e; - var done; - var value; - var tok = untilTokens || ';'; - var index = parserInput.i; - var result = []; - function testCurrentChar() { - var char = parserInput.currentChar(); - if (typeof tok === 'string') { - return char === tok; - } - else { - return tok.test(char); - } - } - if (testCurrentChar()) { - return; - } - value = []; - do { - e = this.comment(); - if (e) { - value.push(e); - continue; - } - e = this.entity(); - if (e) { - value.push(e); - } - if (parserInput.peek(',')) { - value.push(new (tree.Anonymous)(',', parserInput.i)); - parserInput.$char(','); - } - } while (e); - done = testCurrentChar(); - if (value.length > 0) { - value = new (tree.Expression)(value); - if (done) { - return value; - } - else { - result.push(value); - } - // Preserve space before $parseUntil as it will not - if (parserInput.prevChar() === ' ') { - result.push(new tree.Anonymous(' ', index)); - } - } - parserInput.save(); - value = parserInput.$parseUntil(tok); - if (value) { - if (typeof value === 'string') { - error("Expected '".concat(value, "'"), 'Parse'); - } - if (value.length === 1 && value[0] === ' ') { - parserInput.forget(); - return new tree.Anonymous('', index); - } - /** @type {string} */ - var item = void 0; - for (i = 0; i < value.length; i++) { - item = value[i]; - if (Array.isArray(item)) { - // Treat actual quotes as normal quoted values - result.push(new tree.Quoted(item[0], item[1], true, index, fileInfo)); - } - else { - if (i === value.length - 1) { - item = item.trim(); - } - // Treat like quoted values, but replace vars like unquoted expressions - var quote = new tree.Quoted('\'', item, true, index, fileInfo); - var variableRegex = /@([\w-]+)/g; - var propRegex = /\$([\w-]+)/g; - if (variableRegex.test(item)) { - warn('@[ident] in unknown values will not be evaluated as variables in the future. Use @{[ident]}', index, 'DEPRECATED'); - } - if (propRegex.test(item)) { - warn('$[ident] in unknown values will not be evaluated as property references in the future. Use ${[ident]}', index, 'DEPRECATED'); - } - quote.variableRegex = /@([\w-]+)|@{([\w-]+)}/g; - quote.propRegex = /\$([\w-]+)|\${([\w-]+)}/g; - result.push(quote); - } - } - parserInput.forget(); - return new tree.Expression(result, true); - } - parserInput.restore(); - }, - // - // An @import atrule - // - // @import "lib"; - // - // Depending on our environment, importing is done differently: - // In the browser, it's an XHR request, in Node, it would be a - // file-system operation. The function used for importing is - // stored in `import`, which we pass to the Import constructor. - // - 'import': function () { - var path; - var features; - var index = parserInput.i; - var dir = parserInput.$re(/^@import\s+/); - if (dir) { - var options = (dir ? this.importOptions() : null) || {}; - if ((path = this.entities.quoted() || this.entities.url())) { - features = this.mediaFeatures({}); - if (!parserInput.$char(';')) { - parserInput.i = index; - error('missing semi-colon or unrecognised media features on import'); - } - features = features && new (tree.Value)(features); - return new (tree.Import)(path, features, options, index + currentIndex, fileInfo); - } - else { - parserInput.i = index; - error('malformed import statement'); - } - } - }, - importOptions: function () { - var o; - var options = {}; - var optionName; - var value; - // list of options, surrounded by parens - if (!parserInput.$char('(')) { - return null; - } - do { - o = this.importOption(); - if (o) { - optionName = o; - value = true; - switch (optionName) { - case 'css': - optionName = 'less'; - value = false; - break; - case 'once': - optionName = 'multiple'; - value = false; - break; - } - options[optionName] = value; - if (!parserInput.$char(',')) { - break; - } - } - } while (o); - expectChar(')'); - return options; - }, - importOption: function () { - var opt = parserInput.$re(/^(less|css|multiple|once|inline|reference|optional)/); - if (opt) { - return opt[1]; - } - }, - mediaFeature: function (syntaxOptions) { - var entities = this.entities; - var nodes = []; - var e; - var p; - var rangeP; - var spacing = false; - parserInput.save(); - do { - parserInput.save(); - if (parserInput.$re(/^[0-9a-z-]*\s+\(/)) { - spacing = true; - } - parserInput.restore(); - e = entities.declarationCall.bind(this)() || entities.keyword() || entities.variable() || entities.mixinLookup(); - if (e) { - nodes.push(e); - } - else if (parserInput.$char('(')) { - p = this.property(); - parserInput.save(); - if (!p && syntaxOptions.queryInParens && parserInput.$re(/^[0-9a-z-]*\s*([<>]=|<=|>=|[<>]|=)/)) { - parserInput.restore(); - p = this.condition(); - parserInput.save(); - rangeP = this.atomicCondition(null, p.rvalue); - if (!rangeP) { - parserInput.restore(); - } - } - else { - parserInput.restore(); - e = this.value(); - } - if (parserInput.$char(')')) { - if (p && !e) { - nodes.push(new (tree.Paren)(new (tree.QueryInParens)(p.op, p.lvalue, p.rvalue, rangeP ? rangeP.op : null, rangeP ? rangeP.rvalue : null, p._index))); - e = p; - } - else if (p && e) { - nodes.push(new (tree.Paren)(new (tree.Declaration)(p, e, null, null, parserInput.i + currentIndex, fileInfo, true))); - if (!spacing) { - nodes[nodes.length - 1].noSpacing = true; - } - spacing = false; - } - else if (e) { - nodes.push(new (tree.Paren)(e)); - spacing = false; - } - else { - error('badly formed media feature definition'); - } - } - else { - error('Missing closing \')\'', 'Parse'); - } - } - } while (e); - parserInput.forget(); - if (nodes.length > 0) { - return new (tree.Expression)(nodes); - } - }, - mediaFeatures: function (syntaxOptions) { - var entities = this.entities; - var features = []; - var e; - do { - e = this.mediaFeature(syntaxOptions); - if (e) { - features.push(e); - if (!parserInput.$char(',')) { - break; - } - else if (!features[features.length - 1].noSpacing) { - features[features.length - 1].noSpacing = false; - } - } - else { - e = entities.variable() || entities.mixinLookup(); - if (e) { - features.push(e); - if (!parserInput.$char(',')) { - break; - } - else if (!features[features.length - 1].noSpacing) { - features[features.length - 1].noSpacing = false; - } - } - } - } while (e); - return features.length > 0 ? features : null; - }, - prepareAndGetNestableAtRule: function (treeType, index, debugInfo, syntaxOptions) { - var features = this.mediaFeatures(syntaxOptions); - var rules = this.block(); - if (!rules) { - error('media definitions require block statements after any features'); - } - parserInput.forget(); - var atRule = new (treeType)(rules, features, index + currentIndex, fileInfo); - if (context.dumpLineNumbers) { - atRule.debugInfo = debugInfo; - } - return atRule; - }, - nestableAtRule: function () { - var debugInfo; - var index = parserInput.i; - if (context.dumpLineNumbers) { - debugInfo = getDebugInfo(index); - } - parserInput.save(); - if (parserInput.$peekChar('@')) { - if (parserInput.$str('@media')) { - return this.prepareAndGetNestableAtRule(tree.Media, index, debugInfo, MediaSyntaxOptions); - } - if (parserInput.$str('@container')) { - return this.prepareAndGetNestableAtRule(tree.Container, index, debugInfo, ContainerSyntaxOptions); - } - } - parserInput.restore(); - }, - // - // A @plugin directive, used to import plugins dynamically. - // - // @plugin (args) "lib"; - // - plugin: function () { - var path; - var args; - var options; - var index = parserInput.i; - var dir = parserInput.$re(/^@plugin\s+/); - if (dir) { - args = this.pluginArgs(); - if (args) { - options = { - pluginArgs: args, - isPlugin: true - }; - } - else { - options = { isPlugin: true }; - } - if ((path = this.entities.quoted() || this.entities.url())) { - if (!parserInput.$char(';')) { - parserInput.i = index; - error('missing semi-colon on @plugin'); - } - return new (tree.Import)(path, null, options, index + currentIndex, fileInfo); - } - else { - parserInput.i = index; - error('malformed @plugin statement'); - } - } - }, - pluginArgs: function () { - // list of options, surrounded by parens - parserInput.save(); - if (!parserInput.$char('(')) { - parserInput.restore(); - return null; - } - var args = parserInput.$re(/^\s*([^);]+)\)\s*/); - if (args[1]) { - parserInput.forget(); - return args[1].trim(); - } - else { - parserInput.restore(); - return null; - } - }, - atruleUnknown: function (value, name, hasBlock) { - value = this.permissiveValue(/^[{;]/); - hasBlock = (parserInput.currentChar() === '{'); - if (!value) { - if (!hasBlock && parserInput.currentChar() !== ';') { - error(''.concat(name, ' rule is missing block or ending semi-colon')); - } - } - else if (!value.value) { - value = null; - } - return [value, hasBlock]; - }, - atruleBlock: function (rules, value, isRooted, isKeywordList) { - rules = this.blockRuleset(); - parserInput.save(); - if (!rules && !isRooted) { - value = this.entity(); - rules = this.blockRuleset(); - } - if (!rules && !isRooted) { - parserInput.restore(); - var e = []; - value = this.entity(); - while (parserInput.$char(',')) { - e.push(value); - value = this.entity(); - } - if (value && e.length > 0) { - e.push(value); - value = e; - isKeywordList = true; - } - else { - rules = this.blockRuleset(); - } - } - else { - parserInput.forget(); - } - return [rules, value, isKeywordList]; - }, - // - // A CSS AtRule - // - // @charset "utf-8"; - // - atrule: function () { - var index = parserInput.i; - var name; - var value; - var rules; - var nonVendorSpecificName; - var hasIdentifier; - var hasExpression; - var hasUnknown; - var hasBlock = true; - var isRooted = true; - var isKeywordList = false; - if (parserInput.currentChar() !== '@') { - return; - } - value = this['import']() || this.plugin() || this.nestableAtRule(); - if (value) { - return value; - } - parserInput.save(); - name = parserInput.$re(/^@[a-z-]+/); - if (!name) { - return; - } - nonVendorSpecificName = name; - if (name.charAt(1) == '-' && name.indexOf('-', 2) > 0) { - nonVendorSpecificName = "@".concat(name.slice(name.indexOf('-', 2) + 1)); - } - switch (nonVendorSpecificName) { - case '@charset': - hasIdentifier = true; - hasBlock = false; - break; - case '@namespace': - hasExpression = true; - hasBlock = false; - break; - case '@keyframes': - case '@counter-style': - hasIdentifier = true; - break; - case '@document': - case '@supports': - hasUnknown = true; - isRooted = false; - break; - case '@starting-style': - isRooted = false; - break; - case '@layer': - isRooted = false; - break; - default: - hasUnknown = true; - break; - } - parserInput.commentStore.length = 0; - if (hasIdentifier) { - value = this.entity(); - if (!value) { - error("expected ".concat(name, " identifier")); - } - } - else if (hasExpression) { - value = this.expression(); - if (!value) { - error("expected ".concat(name, " expression")); - } - } - else if (hasUnknown) { - var unknownPackage = this.atruleUnknown(value, name, hasBlock); - value = unknownPackage[0]; - hasBlock = unknownPackage[1]; - } - if (hasBlock) { - var blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList); - rules = blockPackage[0]; - value = blockPackage[1]; - isKeywordList = blockPackage[2]; - if (!rules && !hasUnknown) { - parserInput.restore(); - name = parserInput.$re(/^@[a-z-]+/); - var unknownPackage = this.atruleUnknown(value, name, hasBlock); - value = unknownPackage[0]; - hasBlock = unknownPackage[1]; - if (hasBlock) { - blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList); - rules = blockPackage[0]; - value = blockPackage[1]; - isKeywordList = blockPackage[2]; - } - } - } - if (rules || isKeywordList || (!hasBlock && value && parserInput.$char(';'))) { - parserInput.forget(); - return new (tree.AtRule)(name, value, rules, index + currentIndex, fileInfo, context.dumpLineNumbers ? getDebugInfo(index) : null, isRooted); - } - parserInput.restore('at-rule options not recognised'); - }, - // - // A Value is a comma-delimited list of Expressions - // - // font-family: Baskerville, Georgia, serif; - // - // In a Rule, a Value represents everything after the `:`, - // and before the `;`. - // - value: function () { - var e; - var expressions = []; - var index = parserInput.i; - do { - e = this.expression(); - if (e) { - expressions.push(e); - if (!parserInput.$char(',')) { - break; - } - } - } while (e); - if (expressions.length > 0) { - return new (tree.Value)(expressions, index + currentIndex); - } - }, - important: function () { - if (parserInput.currentChar() === '!') { - return parserInput.$re(/^! *important/); - } - }, - sub: function () { - var a; - var e; - parserInput.save(); - if (parserInput.$char('(')) { - a = this.addition(); - if (a && parserInput.$char(')')) { - parserInput.forget(); - e = new (tree.Expression)([a]); - e.parens = true; - return e; - } - parserInput.restore('Expected \')\''); - return; - } - parserInput.restore(); - }, - colorOperand: function () { - parserInput.save(); - // hsl or rgb or lch operand - var match = parserInput.$re(/^[lchrgbs]\s+/); - if (match) { - return new tree.Keyword(match[0]); - } - parserInput.restore(); - }, - multiplication: function () { - var m; - var a; - var op; - var operation; - var isSpaced; - m = this.operand(); - if (m) { - isSpaced = parserInput.isWhitespace(-1); - while (true) { - if (parserInput.peek(/^\/[*/]/)) { - break; - } - parserInput.save(); - op = parserInput.$char('/') || parserInput.$char('*'); - if (!op) { - var index = parserInput.i; - op = parserInput.$str('./'); - if (op) { - warn('./ operator is deprecated', index, 'DEPRECATED'); - } - } - if (!op) { - parserInput.forget(); - break; - } - a = this.operand(); - if (!a) { - parserInput.restore(); - break; - } - parserInput.forget(); - m.parensInOp = true; - a.parensInOp = true; - operation = new (tree.Operation)(op, [operation || m, a], isSpaced); - isSpaced = parserInput.isWhitespace(-1); - } - return operation || m; - } - }, - addition: function () { - var m; - var a; - var op; - var operation; - var isSpaced; - m = this.multiplication(); - if (m) { - isSpaced = parserInput.isWhitespace(-1); - while (true) { - op = parserInput.$re(/^[-+]\s+/) || (!isSpaced && (parserInput.$char('+') || parserInput.$char('-'))); - if (!op) { - break; - } - a = this.multiplication(); - if (!a) { - break; - } - m.parensInOp = true; - a.parensInOp = true; - operation = new (tree.Operation)(op, [operation || m, a], isSpaced); - isSpaced = parserInput.isWhitespace(-1); - } - return operation || m; - } - }, - conditions: function () { - var a; - var b; - var index = parserInput.i; - var condition; - a = this.condition(true); - if (a) { - while (true) { - if (!parserInput.peek(/^,\s*(not\s*)?\(/) || !parserInput.$char(',')) { - break; - } - b = this.condition(true); - if (!b) { - break; - } - condition = new (tree.Condition)('or', condition || a, b, index + currentIndex); - } - return condition || a; - } - }, - condition: function (needsParens) { - var result; - var logical; - var next; - function or() { - return parserInput.$str('or'); - } - result = this.conditionAnd(needsParens); - if (!result) { - return; - } - logical = or(); - if (logical) { - next = this.condition(needsParens); - if (next) { - result = new (tree.Condition)(logical, result, next); - } - else { - return; - } - } - return result; - }, - conditionAnd: function (needsParens) { - var result; - var logical; - var next; - var self = this; - function insideCondition() { - var cond = self.negatedCondition(needsParens) || self.parenthesisCondition(needsParens); - if (!cond && !needsParens) { - return self.atomicCondition(needsParens); - } - return cond; - } - function and() { - return parserInput.$str('and'); - } - result = insideCondition(); - if (!result) { - return; - } - logical = and(); - if (logical) { - next = this.conditionAnd(needsParens); - if (next) { - result = new (tree.Condition)(logical, result, next); - } - else { - return; - } - } - return result; - }, - negatedCondition: function (needsParens) { - if (parserInput.$str('not')) { - var result = this.parenthesisCondition(needsParens); - if (result) { - result.negate = !result.negate; - } - return result; - } - }, - parenthesisCondition: function (needsParens) { - function tryConditionFollowedByParenthesis(me) { - var body; - parserInput.save(); - body = me.condition(needsParens); - if (!body) { - parserInput.restore(); - return; - } - if (!parserInput.$char(')')) { - parserInput.restore(); - return; - } - parserInput.forget(); - return body; - } - var body; - parserInput.save(); - if (!parserInput.$str('(')) { - parserInput.restore(); - return; - } - body = tryConditionFollowedByParenthesis(this); - if (body) { - parserInput.forget(); - return body; - } - body = this.atomicCondition(needsParens); - if (!body) { - parserInput.restore(); - return; - } - if (!parserInput.$char(')')) { - parserInput.restore("expected ')' got '".concat(parserInput.currentChar(), "'")); - return; - } - parserInput.forget(); - return body; - }, - atomicCondition: function (needsParens, preparsedCond) { - var entities = this.entities; - var index = parserInput.i; - var a; - var b; - var c; - var op; - var cond = (function () { - return this.addition() || entities.keyword() || entities.quoted() || entities.mixinLookup(); - }).bind(this); - if (preparsedCond) { - a = preparsedCond; - } - else { - a = cond(); - } - if (a) { - if (parserInput.$char('>')) { - if (parserInput.$char('=')) { - op = '>='; - } - else { - op = '>'; - } - } - else if (parserInput.$char('<')) { - if (parserInput.$char('=')) { - op = '<='; - } - else { - op = '<'; - } - } - else if (parserInput.$char('=')) { - if (parserInput.$char('>')) { - op = '=>'; - } - else if (parserInput.$char('<')) { - op = '=<'; - } - else { - op = '='; - } - } - if (op) { - b = cond(); - if (b) { - c = new (tree.Condition)(op, a, b, index + currentIndex, false); - } - else { - error('expected expression'); - } - } - else if (!preparsedCond) { - c = new (tree.Condition)('=', a, new (tree.Keyword)('true'), index + currentIndex, false); - } - return c; - } - }, - // - // An operand is anything that can be part of an operation, - // such as a Color, or a Variable - // - operand: function () { - var entities = this.entities; - var negate; - if (parserInput.peek(/^-[@$(]/)) { - negate = parserInput.$char('-'); - } - var o = this.sub() || entities.dimension() || - entities.color() || entities.variable() || - entities.property() || entities.call() || - entities.quoted(true) || entities.colorKeyword() || - this.colorOperand() || entities.mixinLookup(); - if (negate) { - o.parensInOp = true; - o = new (tree.Negative)(o); - } - return o; - }, - // - // Expressions either represent mathematical operations, - // or white-space delimited Entities. - // - // 1px solid black - // @var * 2 - // - expression: function () { - var entities = []; - var e; - var delim; - var index = parserInput.i; - do { - e = this.comment(); - if (e && !e.isLineComment) { - entities.push(e); - continue; - } - e = this.addition() || this.entity(); - if (e instanceof tree.Comment) { - e = null; - } - if (e) { - entities.push(e); - // operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here - if (!parserInput.peek(/^\/[/*]/)) { - delim = parserInput.$char('/'); - if (delim) { - entities.push(new (tree.Anonymous)(delim, index + currentIndex)); - } - } - } - } while (e); - if (entities.length > 0) { - return new (tree.Expression)(entities); - } - }, - property: function () { - var name = parserInput.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/); - if (name) { - return name[1]; - } - }, - ruleProperty: function () { - var name = []; - var index = []; - var s; - var k; - parserInput.save(); - var simpleProperty = parserInput.$re(/^([_a-zA-Z0-9-]+)\s*:/); - if (simpleProperty) { - name = [new (tree.Keyword)(simpleProperty[1])]; - parserInput.forget(); - return name; - } - function match(re) { - var i = parserInput.i; - var chunk = parserInput.$re(re); - if (chunk) { - index.push(i); - return name.push(chunk[1]); - } - } - match(/^(\*?)/); - while (true) { - if (!match(/^((?:[\w-]+)|(?:[@$]\{[\w-]+\}))/)) { - break; - } - } - if ((name.length > 1) && match(/^((?:\+_|\+)?)\s*:/)) { - parserInput.forget(); - // at last, we have the complete match now. move forward, - // convert name particles to tree objects and return: - if (name[0] === '') { - name.shift(); - index.shift(); - } - for (k = 0; k < name.length; k++) { - s = name[k]; - name[k] = (s.charAt(0) !== '@' && s.charAt(0) !== '$') ? - new (tree.Keyword)(s) : - (s.charAt(0) === '@' ? - new (tree.Variable)("@".concat(s.slice(2, -1)), index[k] + currentIndex, fileInfo) : - new (tree.Property)("$".concat(s.slice(2, -1)), index[k] + currentIndex, fileInfo)); - } - return name; - } - parserInput.restore(); - } - } - }; - }; - Parser.serializeVars = function (vars) { - var s = ''; - for (var name_1 in vars) { - if (Object.hasOwnProperty.call(vars, name_1)) { - var value = vars[name_1]; - s += "".concat(((name_1[0] === '@') ? '' : '@') + name_1, ": ").concat(value).concat((String(value).slice(-1) === ';') ? '' : ';'); - } - } - return s; - }; - - var Selector = function (elements, extendList, condition, index, currentFileInfo, visibilityInfo) { - this.extendList = extendList; - this.condition = condition; - this.evaldCondition = !condition; - this._index = index; - this._fileInfo = currentFileInfo; - this.elements = this.getElements(elements); - this.mixinElements_ = undefined; - this.copyVisibilityInfo(visibilityInfo); - this.setParent(this.elements, this); - }; - Selector.prototype = Object.assign(new Node(), { - type: 'Selector', - accept: function (visitor) { - if (this.elements) { - this.elements = visitor.visitArray(this.elements); - } - if (this.extendList) { - this.extendList = visitor.visitArray(this.extendList); - } - if (this.condition) { - this.condition = visitor.visit(this.condition); - } - }, - createDerived: function (elements, extendList, evaldCondition) { - elements = this.getElements(elements); - var newSelector = new Selector(elements, extendList || this.extendList, null, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - newSelector.evaldCondition = (!isNullOrUndefined(evaldCondition)) ? evaldCondition : this.evaldCondition; - newSelector.mediaEmpty = this.mediaEmpty; - return newSelector; - }, - getElements: function (els) { - if (!els) { - return [new Element('', '&', false, this._index, this._fileInfo)]; - } - if (typeof els === 'string') { - new Parser(this.parse.context, this.parse.importManager, this._fileInfo, this._index).parseNode(els, ['selector'], function (err, result) { - if (err) { - throw new LessError({ - index: err.index, - message: err.message - }, this.parse.imports, this._fileInfo.filename); - } - els = result[0].elements; - }); - } - return els; - }, - createEmptySelectors: function () { - var el = new Element('', '&', false, this._index, this._fileInfo), sels = [new Selector([el], null, null, this._index, this._fileInfo)]; - sels[0].mediaEmpty = true; - return sels; - }, - match: function (other) { - var elements = this.elements; - var len = elements.length; - var olen; - var i; - other = other.mixinElements(); - olen = other.length; - if (olen === 0 || len < olen) { - return 0; - } - else { - for (i = 0; i < olen; i++) { - if (elements[i].value !== other[i]) { - return 0; - } - } - } - return olen; // return number of matched elements - }, - mixinElements: function () { - if (this.mixinElements_) { - return this.mixinElements_; - } - var elements = this.elements.map(function (v) { - return v.combinator.value + (v.value.value || v.value); - }).join('').match(/[,&#*.\w-]([\w-]|(\\.))*/g); - if (elements) { - if (elements[0] === '&') { - elements.shift(); - } - } - else { - elements = []; - } - return (this.mixinElements_ = elements); - }, - isJustParentSelector: function () { - return !this.mediaEmpty && - this.elements.length === 1 && - this.elements[0].value === '&' && - (this.elements[0].combinator.value === ' ' || this.elements[0].combinator.value === ''); - }, - eval: function (context) { - var evaldCondition = this.condition && this.condition.eval(context); - var elements = this.elements; - var extendList = this.extendList; - elements = elements && elements.map(function (e) { return e.eval(context); }); - extendList = extendList && extendList.map(function (extend) { return extend.eval(context); }); - return this.createDerived(elements, extendList, evaldCondition); - }, - genCSS: function (context, output) { - var i, element; - if ((!context || !context.firstSelector) && this.elements[0].combinator.value === '') { - output.add(' ', this.fileInfo(), this.getIndex()); - } - for (i = 0; i < this.elements.length; i++) { - element = this.elements[i]; - element.genCSS(context, output); - } - }, - getIsOutput: function () { - return this.evaldCondition; - } - }); - - var Value = function (value) { - if (!value) { - throw new Error('Value requires an array argument'); - } - if (!Array.isArray(value)) { - this.value = [value]; - } - else { - this.value = value; - } - }; - Value.prototype = Object.assign(new Node(), { - type: 'Value', - accept: function (visitor) { - if (this.value) { - this.value = visitor.visitArray(this.value); - } - }, - eval: function (context) { - if (this.value.length === 1) { - return this.value[0].eval(context); - } - else { - return new Value(this.value.map(function (v) { - return v.eval(context); - })); - } - }, - genCSS: function (context, output) { - var i; - for (i = 0; i < this.value.length; i++) { - this.value[i].genCSS(context, output); - if (i + 1 < this.value.length) { - output.add((context && context.compress) ? ',' : ', '); - } - } - } - }); - - var Keyword = function (value) { - this.value = value; - }; - Keyword.prototype = Object.assign(new Node(), { - type: 'Keyword', - genCSS: function (context, output) { - if (this.value === '%') { - throw { type: 'Syntax', message: 'Invalid % without number' }; - } - output.add(this.value); - } - }); - Keyword.True = new Keyword('true'); - Keyword.False = new Keyword('false'); - - var MATH$1 = Math$1; - function evalName(context, name) { - var value = ''; - var i; - var n = name.length; - var output = { add: function (s) { value += s; } }; - for (i = 0; i < n; i++) { - name[i].eval(context).genCSS(context, output); - } - return value; - } - var Declaration = function (name, value, important, merge, index, currentFileInfo, inline, variable) { - this.name = name; - this.value = (value instanceof Node) ? value : new Value([value ? new Anonymous(value) : null]); - this.important = important ? " ".concat(important.trim()) : ''; - this.merge = merge; - this._index = index; - this._fileInfo = currentFileInfo; - this.inline = inline || false; - this.variable = (variable !== undefined) ? variable - : (name.charAt && (name.charAt(0) === '@')); - this.allowRoot = true; - this.setParent(this.value, this); - }; - Declaration.prototype = Object.assign(new Node(), { - type: 'Declaration', - genCSS: function (context, output) { - output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex()); - try { - this.value.genCSS(context, output); - } - catch (e) { - e.index = this._index; - e.filename = this._fileInfo.filename; - throw e; - } - output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? '' : ';'), this._fileInfo, this._index); - }, - eval: function (context) { - var mathBypass = false, prevMath, name = this.name, evaldValue, variable = this.variable; - if (typeof name !== 'string') { - // expand 'primitive' name directly to get - // things faster (~10% for benchmark.less): - name = (name.length === 1) && (name[0] instanceof Keyword) ? - name[0].value : evalName(context, name); - variable = false; // never treat expanded interpolation as new variable name - } - // @todo remove when parens-division is default - if (name === 'font' && context.math === MATH$1.ALWAYS) { - mathBypass = true; - prevMath = context.math; - context.math = MATH$1.PARENS_DIVISION; - } - try { - context.importantScope.push({}); - evaldValue = this.value.eval(context); - if (!this.variable && evaldValue.type === 'DetachedRuleset') { - throw { message: 'Rulesets cannot be evaluated on a property.', - index: this.getIndex(), filename: this.fileInfo().filename }; - } - var important = this.important; - var importantResult = context.importantScope.pop(); - if (!important && importantResult.important) { - important = importantResult.important; - } - return new Declaration(name, evaldValue, important, this.merge, this.getIndex(), this.fileInfo(), this.inline, variable); - } - catch (e) { - if (typeof e.index !== 'number') { - e.index = this.getIndex(); - e.filename = this.fileInfo().filename; - } - throw e; - } - finally { - if (mathBypass) { - context.math = prevMath; - } - } - }, - makeImportant: function () { - return new Declaration(this.name, this.value, '!important', this.merge, this.getIndex(), this.fileInfo(), this.inline); - } - }); - - function asComment(ctx) { - return "/* line ".concat(ctx.debugInfo.lineNumber, ", ").concat(ctx.debugInfo.fileName, " */\n"); - } - function asMediaQuery(ctx) { - var filenameWithProtocol = ctx.debugInfo.fileName; - if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) { - filenameWithProtocol = "file://".concat(filenameWithProtocol); - } - return "@media -sass-debug-info{filename{font-family:".concat(filenameWithProtocol.replace(/([.:/\\])/g, function (a) { - if (a == '\\') { - a = '/'; - } - return "\\".concat(a); - }), "}line{font-family:\\00003").concat(ctx.debugInfo.lineNumber, "}}\n"); - } - function debugInfo(context, ctx, lineSeparator) { - var result = ''; - if (context.dumpLineNumbers && !context.compress) { - switch (context.dumpLineNumbers) { - case 'comments': - result = asComment(ctx); - break; - case 'mediaquery': - result = asMediaQuery(ctx); - break; - case 'all': - result = asComment(ctx) + (lineSeparator || '') + asMediaQuery(ctx); - break; - } - } - return result; - } - - var Comment = function (value, isLineComment, index, currentFileInfo) { - this.value = value; - this.isLineComment = isLineComment; - this._index = index; - this._fileInfo = currentFileInfo; - this.allowRoot = true; - }; - Comment.prototype = Object.assign(new Node(), { - type: 'Comment', - genCSS: function (context, output) { - if (this.debugInfo) { - output.add(debugInfo(context, this), this.fileInfo(), this.getIndex()); - } - output.add(this.value); - }, - isSilent: function (context) { - var isCompressed = context.compress && this.value[2] !== '!'; - return this.isLineComment || isCompressed; - } - }); - - var defaultFunc = { - eval: function () { - var v = this.value_; - var e = this.error_; - if (e) { - throw e; - } - if (!isNullOrUndefined(v)) { - return v ? Keyword.True : Keyword.False; - } - }, - value: function (v) { - this.value_ = v; - }, - error: function (e) { - this.error_ = e; - }, - reset: function () { - this.value_ = this.error_ = null; - } - }; - - var Ruleset = function (selectors, rules, strictImports, visibilityInfo) { - this.selectors = selectors; - this.rules = rules; - this._lookups = {}; - this._variables = null; - this._properties = null; - this.strictImports = strictImports; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - this.setParent(this.selectors, this); - this.setParent(this.rules, this); - }; - Ruleset.prototype = Object.assign(new Node(), { - type: 'Ruleset', - isRuleset: true, - isRulesetLike: function () { return true; }, - accept: function (visitor) { - if (this.paths) { - this.paths = visitor.visitArray(this.paths, true); - } - else if (this.selectors) { - this.selectors = visitor.visitArray(this.selectors); - } - if (this.rules && this.rules.length) { - this.rules = visitor.visitArray(this.rules); - } - }, - eval: function (context) { - var selectors; - var selCnt; - var selector; - var i; - var hasVariable; - var hasOnePassingSelector = false; - if (this.selectors && (selCnt = this.selectors.length)) { - selectors = new Array(selCnt); - defaultFunc.error({ - type: 'Syntax', - message: 'it is currently only allowed in parametric mixin guards,' - }); - for (i = 0; i < selCnt; i++) { - selector = this.selectors[i].eval(context); - for (var j = 0; j < selector.elements.length; j++) { - if (selector.elements[j].isVariable) { - hasVariable = true; - break; - } - } - selectors[i] = selector; - if (selector.evaldCondition) { - hasOnePassingSelector = true; - } - } - if (hasVariable) { - var toParseSelectors = new Array(selCnt); - for (i = 0; i < selCnt; i++) { - selector = selectors[i]; - toParseSelectors[i] = selector.toCSS(context); - } - var startingIndex = selectors[0].getIndex(); - var selectorFileInfo = selectors[0].fileInfo(); - new Parser(context, this.parse.importManager, selectorFileInfo, startingIndex).parseNode(toParseSelectors.join(','), ['selectors'], function (err, result) { - if (result) { - selectors = flattenArray(result); - } - }); - } - defaultFunc.reset(); - } - else { - hasOnePassingSelector = true; - } - var rules = this.rules ? copyArray(this.rules) : null; - var ruleset = new Ruleset(selectors, rules, this.strictImports, this.visibilityInfo()); - var rule; - var subRule; - ruleset.originalRuleset = this; - ruleset.root = this.root; - ruleset.firstRoot = this.firstRoot; - ruleset.allowImports = this.allowImports; - if (this.debugInfo) { - ruleset.debugInfo = this.debugInfo; - } - if (!hasOnePassingSelector) { - rules.length = 0; - } - // inherit a function registry from the frames stack when possible; - // otherwise from the global registry - ruleset.functionRegistry = (function (frames) { - var i = 0; - var n = frames.length; - var found; - for (; i !== n; ++i) { - found = frames[i].functionRegistry; - if (found) { - return found; - } - } - return functionRegistry; - }(context.frames)).inherit(); - // push the current ruleset to the frames stack - var ctxFrames = context.frames; - ctxFrames.unshift(ruleset); - // currrent selectors - var ctxSelectors = context.selectors; - if (!ctxSelectors) { - context.selectors = ctxSelectors = []; - } - ctxSelectors.unshift(this.selectors); - // Evaluate imports - if (ruleset.root || ruleset.allowImports || !ruleset.strictImports) { - ruleset.evalImports(context); - } - // Store the frames around mixin definitions, - // so they can be evaluated like closures when the time comes. - var rsRules = ruleset.rules; - for (i = 0; (rule = rsRules[i]); i++) { - if (rule.evalFirst) { - rsRules[i] = rule.eval(context); - } - } - var mediaBlockCount = (context.mediaBlocks && context.mediaBlocks.length) || 0; - // Evaluate mixin calls. - for (i = 0; (rule = rsRules[i]); i++) { - if (rule.type === 'MixinCall') { - /* jshint loopfunc:true */ - rules = rule.eval(context).filter(function (r) { - if ((r instanceof Declaration) && r.variable) { - // do not pollute the scope if the variable is - // already there. consider returning false here - // but we need a way to "return" variable from mixins - return !(ruleset.variable(r.name)); - } - return true; - }); - rsRules.splice.apply(rsRules, [i, 1].concat(rules)); - i += rules.length - 1; - ruleset.resetCache(); - } - else if (rule.type === 'VariableCall') { - /* jshint loopfunc:true */ - rules = rule.eval(context).rules.filter(function (r) { - if ((r instanceof Declaration) && r.variable) { - // do not pollute the scope at all - return false; - } - return true; - }); - rsRules.splice.apply(rsRules, [i, 1].concat(rules)); - i += rules.length - 1; - ruleset.resetCache(); - } - } - // Evaluate everything else - for (i = 0; (rule = rsRules[i]); i++) { - if (!rule.evalFirst) { - rsRules[i] = rule = rule.eval ? rule.eval(context) : rule; - } - } - // Evaluate everything else - for (i = 0; (rule = rsRules[i]); i++) { - // for rulesets, check if it is a css guard and can be removed - if (rule instanceof Ruleset && rule.selectors && rule.selectors.length === 1) { - // check if it can be folded in (e.g. & where) - if (rule.selectors[0] && rule.selectors[0].isJustParentSelector()) { - rsRules.splice(i--, 1); - for (var j = 0; (subRule = rule.rules[j]); j++) { - if (subRule instanceof Node) { - subRule.copyVisibilityInfo(rule.visibilityInfo()); - if (!(subRule instanceof Declaration) || !subRule.variable) { - rsRules.splice(++i, 0, subRule); - } - } - } - } - } - } - // Pop the stack - ctxFrames.shift(); - ctxSelectors.shift(); - if (context.mediaBlocks) { - for (i = mediaBlockCount; i < context.mediaBlocks.length; i++) { - context.mediaBlocks[i].bubbleSelectors(selectors); - } - } - return ruleset; - }, - evalImports: function (context) { - var rules = this.rules; - var i; - var importRules; - if (!rules) { - return; - } - for (i = 0; i < rules.length; i++) { - if (rules[i].type === 'Import') { - importRules = rules[i].eval(context); - if (importRules && (importRules.length || importRules.length === 0)) { - rules.splice.apply(rules, [i, 1].concat(importRules)); - i += importRules.length - 1; - } - else { - rules.splice(i, 1, importRules); - } - this.resetCache(); - } - } - }, - makeImportant: function () { - var result = new Ruleset(this.selectors, this.rules.map(function (r) { - if (r.makeImportant) { - return r.makeImportant(); - } - else { - return r; - } - }), this.strictImports, this.visibilityInfo()); - return result; - }, - matchArgs: function (args) { - return !args || args.length === 0; - }, - // lets you call a css selector with a guard - matchCondition: function (args, context) { - var lastSelector = this.selectors[this.selectors.length - 1]; - if (!lastSelector.evaldCondition) { - return false; - } - if (lastSelector.condition && - !lastSelector.condition.eval(new contexts.Eval(context, context.frames))) { - return false; - } - return true; - }, - resetCache: function () { - this._rulesets = null; - this._variables = null; - this._properties = null; - this._lookups = {}; - }, - variables: function () { - if (!this._variables) { - this._variables = !this.rules ? {} : this.rules.reduce(function (hash, r) { - if (r instanceof Declaration && r.variable === true) { - hash[r.name] = r; - } - // when evaluating variables in an import statement, imports have not been eval'd - // so we need to go inside import statements. - // guard against root being a string (in the case of inlined less) - if (r.type === 'Import' && r.root && r.root.variables) { - var vars = r.root.variables(); - for (var name_1 in vars) { - // eslint-disable-next-line no-prototype-builtins - if (vars.hasOwnProperty(name_1)) { - hash[name_1] = r.root.variable(name_1); - } - } - } - return hash; - }, {}); - } - return this._variables; - }, - properties: function () { - if (!this._properties) { - this._properties = !this.rules ? {} : this.rules.reduce(function (hash, r) { - if (r instanceof Declaration && r.variable !== true) { - var name_2 = (r.name.length === 1) && (r.name[0] instanceof Keyword) ? - r.name[0].value : r.name; - // Properties don't overwrite as they can merge - if (!hash["$".concat(name_2)]) { - hash["$".concat(name_2)] = [r]; - } - else { - hash["$".concat(name_2)].push(r); - } - } - return hash; - }, {}); - } - return this._properties; - }, - variable: function (name) { - var decl = this.variables()[name]; - if (decl) { - return this.parseValue(decl); - } - }, - property: function (name) { - var decl = this.properties()[name]; - if (decl) { - return this.parseValue(decl); - } - }, - lastDeclaration: function () { - for (var i_1 = this.rules.length; i_1 > 0; i_1--) { - var decl = this.rules[i_1 - 1]; - if (decl instanceof Declaration) { - return this.parseValue(decl); - } - } - }, - parseValue: function (toParse) { - var self = this; - function transformDeclaration(decl) { - if (decl.value instanceof Anonymous && !decl.parsed) { - if (typeof decl.value.value === 'string') { - new Parser(this.parse.context, this.parse.importManager, decl.fileInfo(), decl.value.getIndex()).parseNode(decl.value.value, ['value', 'important'], function (err, result) { - if (err) { - decl.parsed = true; - } - if (result) { - decl.value = result[0]; - decl.important = result[1] || ''; - decl.parsed = true; - } - }); - } - else { - decl.parsed = true; - } - return decl; - } - else { - return decl; - } - } - if (!Array.isArray(toParse)) { - return transformDeclaration.call(self, toParse); - } - else { - var nodes_1 = []; - toParse.forEach(function (n) { - nodes_1.push(transformDeclaration.call(self, n)); - }); - return nodes_1; - } - }, - rulesets: function () { - if (!this.rules) { - return []; - } - var filtRules = []; - var rules = this.rules; - var i; - var rule; - for (i = 0; (rule = rules[i]); i++) { - if (rule.isRuleset) { - filtRules.push(rule); - } - } - return filtRules; - }, - prependRule: function (rule) { - var rules = this.rules; - if (rules) { - rules.unshift(rule); - } - else { - this.rules = [rule]; - } - this.setParent(rule, this); - }, - find: function (selector, self, filter) { - self = self || this; - var rules = []; - var match; - var foundMixins; - var key = selector.toCSS(); - if (key in this._lookups) { - return this._lookups[key]; - } - this.rulesets().forEach(function (rule) { - if (rule !== self) { - for (var j = 0; j < rule.selectors.length; j++) { - match = selector.match(rule.selectors[j]); - if (match) { - if (selector.elements.length > match) { - if (!filter || filter(rule)) { - foundMixins = rule.find(new Selector(selector.elements.slice(match)), self, filter); - for (var i_2 = 0; i_2 < foundMixins.length; ++i_2) { - foundMixins[i_2].path.push(rule); - } - Array.prototype.push.apply(rules, foundMixins); - } - } - else { - rules.push({ rule: rule, path: [] }); - } - break; - } - } - } - }); - this._lookups[key] = rules; - return rules; - }, - genCSS: function (context, output) { - var i; - var j; - var charsetRuleNodes = []; - var ruleNodes = []; - var // Line number debugging - debugInfo$1; - var rule; - var path; - context.tabLevel = (context.tabLevel || 0); - if (!this.root) { - context.tabLevel++; - } - var tabRuleStr = context.compress ? '' : Array(context.tabLevel + 1).join(' '); - var tabSetStr = context.compress ? '' : Array(context.tabLevel).join(' '); - var sep; - var charsetNodeIndex = 0; - var importNodeIndex = 0; - for (i = 0; (rule = this.rules[i]); i++) { - if (rule instanceof Comment) { - if (importNodeIndex === i) { - importNodeIndex++; - } - ruleNodes.push(rule); - } - else if (rule.isCharset && rule.isCharset()) { - ruleNodes.splice(charsetNodeIndex, 0, rule); - charsetNodeIndex++; - importNodeIndex++; - } - else if (rule.type === 'Import') { - ruleNodes.splice(importNodeIndex, 0, rule); - importNodeIndex++; - } - else { - ruleNodes.push(rule); - } - } - ruleNodes = charsetRuleNodes.concat(ruleNodes); - // If this is the root node, we don't render - // a selector, or {}. - if (!this.root) { - debugInfo$1 = debugInfo(context, this, tabSetStr); - if (debugInfo$1) { - output.add(debugInfo$1); - output.add(tabSetStr); - } - var paths = this.paths; - var pathCnt = paths.length; - var pathSubCnt = void 0; - sep = context.compress ? ',' : (",\n".concat(tabSetStr)); - for (i = 0; i < pathCnt; i++) { - path = paths[i]; - if (!(pathSubCnt = path.length)) { - continue; - } - if (i > 0) { - output.add(sep); - } - context.firstSelector = true; - path[0].genCSS(context, output); - context.firstSelector = false; - for (j = 1; j < pathSubCnt; j++) { - path[j].genCSS(context, output); - } - } - output.add((context.compress ? '{' : ' {\n') + tabRuleStr); - } - // Compile rules and rulesets - for (i = 0; (rule = ruleNodes[i]); i++) { - if (i + 1 === ruleNodes.length) { - context.lastRule = true; - } - var currentLastRule = context.lastRule; - if (rule.isRulesetLike(rule)) { - context.lastRule = false; - } - if (rule.genCSS) { - rule.genCSS(context, output); - } - else if (rule.value) { - output.add(rule.value.toString()); - } - context.lastRule = currentLastRule; - if (!context.lastRule && rule.isVisible()) { - output.add(context.compress ? '' : ("\n".concat(tabRuleStr))); - } - else { - context.lastRule = false; - } - } - if (!this.root) { - output.add((context.compress ? '}' : "\n".concat(tabSetStr, "}"))); - context.tabLevel--; - } - if (!output.isEmpty() && !context.compress && this.firstRoot) { - output.add('\n'); - } - }, - joinSelectors: function (paths, context, selectors) { - for (var s = 0; s < selectors.length; s++) { - this.joinSelector(paths, context, selectors[s]); - } - }, - joinSelector: function (paths, context, selector) { - function createParenthesis(elementsToPak, originalElement) { - var replacementParen, j; - if (elementsToPak.length === 0) { - replacementParen = new Paren(elementsToPak[0]); - } - else { - var insideParent = new Array(elementsToPak.length); - for (j = 0; j < elementsToPak.length; j++) { - insideParent[j] = new Element(null, elementsToPak[j], originalElement.isVariable, originalElement._index, originalElement._fileInfo); - } - replacementParen = new Paren(new Selector(insideParent)); - } - return replacementParen; - } - function createSelector(containedElement, originalElement) { - var element, selector; - element = new Element(null, containedElement, originalElement.isVariable, originalElement._index, originalElement._fileInfo); - selector = new Selector([element]); - return selector; - } - // joins selector path from `beginningPath` with selector path in `addPath` - // `replacedElement` contains element that is being replaced by `addPath` - // returns concatenated path - function addReplacementIntoPath(beginningPath, addPath, replacedElement, originalSelector) { - var newSelectorPath, lastSelector, newJoinedSelector; - // our new selector path - newSelectorPath = []; - // construct the joined selector - if & is the first thing this will be empty, - // if not newJoinedSelector will be the last set of elements in the selector - if (beginningPath.length > 0) { - newSelectorPath = copyArray(beginningPath); - lastSelector = newSelectorPath.pop(); - newJoinedSelector = originalSelector.createDerived(copyArray(lastSelector.elements)); - } - else { - newJoinedSelector = originalSelector.createDerived([]); - } - if (addPath.length > 0) { - // /deep/ is a CSS4 selector - (removed, so should deprecate) - // that is valid without anything in front of it - // so if the & does not have a combinator that is "" or " " then - // and there is a combinator on the parent, then grab that. - // this also allows + a { & .b { .a & { ... though not sure why you would want to do that - var combinator = replacedElement.combinator; - var parentEl = addPath[0].elements[0]; - if (combinator.emptyOrWhitespace && !parentEl.combinator.emptyOrWhitespace) { - combinator = parentEl.combinator; - } - // join the elements so far with the first part of the parent - newJoinedSelector.elements.push(new Element(combinator, parentEl.value, replacedElement.isVariable, replacedElement._index, replacedElement._fileInfo)); - newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1)); - } - // now add the joined selector - but only if it is not empty - if (newJoinedSelector.elements.length !== 0) { - newSelectorPath.push(newJoinedSelector); - } - // put together the parent selectors after the join (e.g. the rest of the parent) - if (addPath.length > 1) { - var restOfPath = addPath.slice(1); - restOfPath = restOfPath.map(function (selector) { - return selector.createDerived(selector.elements, []); - }); - newSelectorPath = newSelectorPath.concat(restOfPath); - } - return newSelectorPath; - } - // joins selector path from `beginningPath` with every selector path in `addPaths` array - // `replacedElement` contains element that is being replaced by `addPath` - // returns array with all concatenated paths - function addAllReplacementsIntoPath(beginningPath, addPaths, replacedElement, originalSelector, result) { - var j; - for (j = 0; j < beginningPath.length; j++) { - var newSelectorPath = addReplacementIntoPath(beginningPath[j], addPaths, replacedElement, originalSelector); - result.push(newSelectorPath); - } - return result; - } - function mergeElementsOnToSelectors(elements, selectors) { - var i, sel; - if (elements.length === 0) { - return; - } - if (selectors.length === 0) { - selectors.push([new Selector(elements)]); - return; - } - for (i = 0; (sel = selectors[i]); i++) { - // if the previous thing in sel is a parent this needs to join on to it - if (sel.length > 0) { - sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements)); - } - else { - sel.push(new Selector(elements)); - } - } - } - // replace all parent selectors inside `inSelector` by content of `context` array - // resulting selectors are returned inside `paths` array - // returns true if `inSelector` contained at least one parent selector - function replaceParentSelector(paths, context, inSelector) { - // The paths are [[Selector]] - // The first list is a list of comma separated selectors - // The inner list is a list of inheritance separated selectors - // e.g. - // .a, .b { - // .c { - // } - // } - // == [[.a] [.c]] [[.b] [.c]] - // - var i, j, k, currentElements, newSelectors, selectorsMultiplied, sel, el, hadParentSelector = false, length, lastSelector; - function findNestedSelector(element) { - var maybeSelector; - if (!(element.value instanceof Paren)) { - return null; - } - maybeSelector = element.value.value; - if (!(maybeSelector instanceof Selector)) { - return null; - } - return maybeSelector; - } - // the elements from the current selector so far - currentElements = []; - // the current list of new selectors to add to the path. - // We will build it up. We initiate it with one empty selector as we "multiply" the new selectors - // by the parents - newSelectors = [ - [] - ]; - for (i = 0; (el = inSelector.elements[i]); i++) { - // non parent reference elements just get added - if (el.value !== '&') { - var nestedSelector = findNestedSelector(el); - if (nestedSelector !== null) { - // merge the current list of non parent selector elements - // on to the current list of selectors to add - mergeElementsOnToSelectors(currentElements, newSelectors); - var nestedPaths = []; - var replaced = void 0; - var replacedNewSelectors = []; - replaced = replaceParentSelector(nestedPaths, context, nestedSelector); - hadParentSelector = hadParentSelector || replaced; - // the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors - for (k = 0; k < nestedPaths.length; k++) { - var replacementSelector = createSelector(createParenthesis(nestedPaths[k], el), el); - addAllReplacementsIntoPath(newSelectors, [replacementSelector], el, inSelector, replacedNewSelectors); - } - newSelectors = replacedNewSelectors; - currentElements = []; - } - else { - currentElements.push(el); - } - } - else { - hadParentSelector = true; - // the new list of selectors to add - selectorsMultiplied = []; - // merge the current list of non parent selector elements - // on to the current list of selectors to add - mergeElementsOnToSelectors(currentElements, newSelectors); - // loop through our current selectors - for (j = 0; j < newSelectors.length; j++) { - sel = newSelectors[j]; - // if we don't have any parent paths, the & might be in a mixin so that it can be used - // whether there are parents or not - if (context.length === 0) { - // the combinator used on el should now be applied to the next element instead so that - // it is not lost - if (sel.length > 0) { - sel[0].elements.push(new Element(el.combinator, '', el.isVariable, el._index, el._fileInfo)); - } - selectorsMultiplied.push(sel); - } - else { - // and the parent selectors - for (k = 0; k < context.length; k++) { - // We need to put the current selectors - // then join the last selector's elements on to the parents selectors - var newSelectorPath = addReplacementIntoPath(sel, context[k], el, inSelector); - // add that to our new set of selectors - selectorsMultiplied.push(newSelectorPath); - } - } - } - // our new selectors has been multiplied, so reset the state - newSelectors = selectorsMultiplied; - currentElements = []; - } - } - // if we have any elements left over (e.g. .a& .b == .b) - // add them on to all the current selectors - mergeElementsOnToSelectors(currentElements, newSelectors); - for (i = 0; i < newSelectors.length; i++) { - length = newSelectors[i].length; - if (length > 0) { - paths.push(newSelectors[i]); - lastSelector = newSelectors[i][length - 1]; - newSelectors[i][length - 1] = lastSelector.createDerived(lastSelector.elements, inSelector.extendList); - } - } - return hadParentSelector; - } - function deriveSelector(visibilityInfo, deriveFrom) { - var newSelector = deriveFrom.createDerived(deriveFrom.elements, deriveFrom.extendList, deriveFrom.evaldCondition); - newSelector.copyVisibilityInfo(visibilityInfo); - return newSelector; - } - // joinSelector code follows - var i, newPaths, hadParentSelector; - newPaths = []; - hadParentSelector = replaceParentSelector(newPaths, context, selector); - if (!hadParentSelector) { - if (context.length > 0) { - newPaths = []; - for (i = 0; i < context.length; i++) { - var concatenated = context[i].map(deriveSelector.bind(this, selector.visibilityInfo())); - concatenated.push(selector); - newPaths.push(concatenated); - } - } - else { - newPaths = [[selector]]; - } - } - for (i = 0; i < newPaths.length; i++) { - paths.push(newPaths[i]); - } - } - }); - - var Unit = function (numerator, denominator, backupUnit) { - this.numerator = numerator ? copyArray(numerator).sort() : []; - this.denominator = denominator ? copyArray(denominator).sort() : []; - if (backupUnit) { - this.backupUnit = backupUnit; - } - else if (numerator && numerator.length) { - this.backupUnit = numerator[0]; - } - }; - Unit.prototype = Object.assign(new Node(), { - type: 'Unit', - clone: function () { - return new Unit(copyArray(this.numerator), copyArray(this.denominator), this.backupUnit); - }, - genCSS: function (context, output) { - // Dimension checks the unit is singular and throws an error if in strict math mode. - var strictUnits = context && context.strictUnits; - if (this.numerator.length === 1) { - output.add(this.numerator[0]); // the ideal situation - } - else if (!strictUnits && this.backupUnit) { - output.add(this.backupUnit); - } - else if (!strictUnits && this.denominator.length) { - output.add(this.denominator[0]); - } - }, - toString: function () { - var i, returnStr = this.numerator.join('*'); - for (i = 0; i < this.denominator.length; i++) { - returnStr += "/".concat(this.denominator[i]); - } - return returnStr; - }, - compare: function (other) { - return this.is(other.toString()) ? 0 : undefined; - }, - is: function (unitString) { - return this.toString().toUpperCase() === unitString.toUpperCase(); - }, - isLength: function () { - return RegExp('^(px|em|ex|ch|rem|in|cm|mm|pc|pt|ex|vw|vh|vmin|vmax)$', 'gi').test(this.toCSS()); - }, - isEmpty: function () { - return this.numerator.length === 0 && this.denominator.length === 0; - }, - isSingular: function () { - return this.numerator.length <= 1 && this.denominator.length === 0; - }, - map: function (callback) { - var i; - for (i = 0; i < this.numerator.length; i++) { - this.numerator[i] = callback(this.numerator[i], false); - } - for (i = 0; i < this.denominator.length; i++) { - this.denominator[i] = callback(this.denominator[i], true); - } - }, - usedUnits: function () { - var group; - var result = {}; - var mapUnit; - var groupName; - mapUnit = function (atomicUnit) { - // eslint-disable-next-line no-prototype-builtins - if (group.hasOwnProperty(atomicUnit) && !result[groupName]) { - result[groupName] = atomicUnit; - } - return atomicUnit; - }; - for (groupName in unitConversions) { - // eslint-disable-next-line no-prototype-builtins - if (unitConversions.hasOwnProperty(groupName)) { - group = unitConversions[groupName]; - this.map(mapUnit); - } - } - return result; - }, - cancel: function () { - var counter = {}; - var atomicUnit; - var i; - for (i = 0; i < this.numerator.length; i++) { - atomicUnit = this.numerator[i]; - counter[atomicUnit] = (counter[atomicUnit] || 0) + 1; - } - for (i = 0; i < this.denominator.length; i++) { - atomicUnit = this.denominator[i]; - counter[atomicUnit] = (counter[atomicUnit] || 0) - 1; - } - this.numerator = []; - this.denominator = []; - for (atomicUnit in counter) { - // eslint-disable-next-line no-prototype-builtins - if (counter.hasOwnProperty(atomicUnit)) { - var count = counter[atomicUnit]; - if (count > 0) { - for (i = 0; i < count; i++) { - this.numerator.push(atomicUnit); - } - } - else if (count < 0) { - for (i = 0; i < -count; i++) { - this.denominator.push(atomicUnit); - } - } - } - } - this.numerator.sort(); - this.denominator.sort(); - } - }); - - /* eslint-disable no-prototype-builtins */ - // - // A number with a unit - // - var Dimension = function (value, unit) { - this.value = parseFloat(value); - if (isNaN(this.value)) { - throw new Error('Dimension is not a number.'); - } - this.unit = (unit && unit instanceof Unit) ? unit : - new Unit(unit ? [unit] : undefined); - this.setParent(this.unit, this); - }; - Dimension.prototype = Object.assign(new Node(), { - type: 'Dimension', - accept: function (visitor) { - this.unit = visitor.visit(this.unit); - }, - // remove when Nodes have JSDoc types - // eslint-disable-next-line no-unused-vars - eval: function (context) { - return this; - }, - toColor: function () { - return new Color([this.value, this.value, this.value]); - }, - genCSS: function (context, output) { - if ((context && context.strictUnits) && !this.unit.isSingular()) { - throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: ".concat(this.unit.toString())); - } - var value = this.fround(context, this.value); - var strValue = String(value); - if (value !== 0 && value < 0.000001 && value > -0.000001) { - // would be output 1e-6 etc. - strValue = value.toFixed(20).replace(/0+$/, ''); - } - if (context && context.compress) { - // Zero values doesn't need a unit - if (value === 0 && this.unit.isLength()) { - output.add(strValue); - return; - } - // Float values doesn't need a leading zero - if (value > 0 && value < 1) { - strValue = (strValue).substr(1); - } - } - output.add(strValue); - this.unit.genCSS(context, output); - }, - // In an operation between two Dimensions, - // we default to the first Dimension's unit, - // so `1px + 2` will yield `3px`. - operate: function (context, op, other) { - /* jshint noempty:false */ - var value = this._operate(context, op, this.value, other.value); - var unit = this.unit.clone(); - if (op === '+' || op === '-') { - if (unit.numerator.length === 0 && unit.denominator.length === 0) { - unit = other.unit.clone(); - if (this.unit.backupUnit) { - unit.backupUnit = this.unit.backupUnit; - } - } - else if (other.unit.numerator.length === 0 && unit.denominator.length === 0) ; - else { - other = other.convertTo(this.unit.usedUnits()); - if (context.strictUnits && other.unit.toString() !== unit.toString()) { - throw new Error('Incompatible units. Change the units or use the unit function. ' - + "Bad units: '".concat(unit.toString(), "' and '").concat(other.unit.toString(), "'.")); - } - value = this._operate(context, op, this.value, other.value); - } - } - else if (op === '*') { - unit.numerator = unit.numerator.concat(other.unit.numerator).sort(); - unit.denominator = unit.denominator.concat(other.unit.denominator).sort(); - unit.cancel(); - } - else if (op === '/') { - unit.numerator = unit.numerator.concat(other.unit.denominator).sort(); - unit.denominator = unit.denominator.concat(other.unit.numerator).sort(); - unit.cancel(); - } - return new Dimension(value, unit); - }, - compare: function (other) { - var a, b; - if (!(other instanceof Dimension)) { - return undefined; - } - if (this.unit.isEmpty() || other.unit.isEmpty()) { - a = this; - b = other; - } - else { - a = this.unify(); - b = other.unify(); - if (a.unit.compare(b.unit) !== 0) { - return undefined; - } - } - return Node.numericCompare(a.value, b.value); - }, - unify: function () { - return this.convertTo({ length: 'px', duration: 's', angle: 'rad' }); - }, - convertTo: function (conversions) { - var value = this.value; - var unit = this.unit.clone(); - var i; - var groupName; - var group; - var targetUnit; - var derivedConversions = {}; - var applyUnit; - if (typeof conversions === 'string') { - for (i in unitConversions) { - if (unitConversions[i].hasOwnProperty(conversions)) { - derivedConversions = {}; - derivedConversions[i] = conversions; - } - } - conversions = derivedConversions; - } - applyUnit = function (atomicUnit, denominator) { - if (group.hasOwnProperty(atomicUnit)) { - if (denominator) { - value = value / (group[atomicUnit] / group[targetUnit]); - } - else { - value = value * (group[atomicUnit] / group[targetUnit]); - } - return targetUnit; - } - return atomicUnit; - }; - for (groupName in conversions) { - if (conversions.hasOwnProperty(groupName)) { - targetUnit = conversions[groupName]; - group = unitConversions[groupName]; - unit.map(applyUnit); - } - } - unit.cancel(); - return new Dimension(value, unit); - } - }); - - var Expression = function (value, noSpacing) { - this.value = value; - this.noSpacing = noSpacing; - if (!value) { - throw new Error('Expression requires an array parameter'); - } - }; - Expression.prototype = Object.assign(new Node(), { - type: 'Expression', - accept: function (visitor) { - this.value = visitor.visitArray(this.value); - }, - eval: function (context) { - var noSpacing = this.noSpacing; - var returnValue; - var mathOn = context.isMathOn(); - var inParenthesis = this.parens; - var doubleParen = false; - if (inParenthesis) { - context.inParenthesis(); - } - if (this.value.length > 1) { - returnValue = new Expression(this.value.map(function (e) { - if (!e.eval) { - return e; - } - return e.eval(context); - }), this.noSpacing); - } - else if (this.value.length === 1) { - if (this.value[0].parens && !this.value[0].parensInOp && !context.inCalc) { - doubleParen = true; - } - returnValue = this.value[0].eval(context); - } - else { - returnValue = this; - } - if (inParenthesis) { - context.outOfParenthesis(); - } - if (this.parens && this.parensInOp && !mathOn && !doubleParen - && (!(returnValue instanceof Dimension))) { - returnValue = new Paren(returnValue); - } - returnValue.noSpacing = returnValue.noSpacing || noSpacing; - return returnValue; - }, - genCSS: function (context, output) { - for (var i_1 = 0; i_1 < this.value.length; i_1++) { - this.value[i_1].genCSS(context, output); - if (!this.noSpacing && i_1 + 1 < this.value.length) { - if (i_1 + 1 < this.value.length && !(this.value[i_1 + 1] instanceof Anonymous) || - this.value[i_1 + 1] instanceof Anonymous && this.value[i_1 + 1].value !== ',') { - output.add(' '); - } - } - } - }, - throwAwayComments: function () { - this.value = this.value.filter(function (v) { - return !(v instanceof Comment); - }); - } - }); - - var NestableAtRulePrototype = { - isRulesetLike: function () { - return true; - }, - accept: function (visitor) { - if (this.features) { - this.features = visitor.visit(this.features); - } - if (this.rules) { - this.rules = visitor.visitArray(this.rules); - } - }, - evalFunction: function () { - if (!this.features || !Array.isArray(this.features.value) || this.features.value.length < 1) { - return; - } - var exprValues = this.features.value; - var expr, paren; - for (var index = 0; index < exprValues.length; ++index) { - expr = exprValues[index]; - if (expr.type === 'Keyword' && index + 1 < exprValues.length && (expr.noSpacing || expr.noSpacing == null)) { - paren = exprValues[index + 1]; - if (paren.type === 'Paren' && paren.noSpacing) { - exprValues[index] = new Expression([expr, paren]); - exprValues.splice(index + 1, 1); - exprValues[index].noSpacing = true; - } - } - } - }, - evalTop: function (context) { - this.evalFunction(); - var result = this; - // Render all dependent Media blocks. - if (context.mediaBlocks.length > 1) { - var selectors = (new Selector([], null, null, this.getIndex(), this.fileInfo())).createEmptySelectors(); - result = new Ruleset(selectors, context.mediaBlocks); - result.multiMedia = true; - result.copyVisibilityInfo(this.visibilityInfo()); - this.setParent(result, this); - } - delete context.mediaBlocks; - delete context.mediaPath; - return result; - }, - evalNested: function (context) { - this.evalFunction(); - var i; - var value; - var path = context.mediaPath.concat([this]); - // Extract the media-query conditions separated with `,` (OR). - for (i = 0; i < path.length; i++) { - if (path[i].type !== this.type) { - context.mediaBlocks.splice(i, 1); - return this; - } - value = path[i].features instanceof Value ? - path[i].features.value : path[i].features; - path[i] = Array.isArray(value) ? value : [value]; - } - // Trace all permutations to generate the resulting media-query. - // - // (a, b and c) with nested (d, e) -> - // a and d - // a and e - // b and c and d - // b and c and e - this.features = new Value(this.permute(path).map(function (path) { - path = path.map(function (fragment) { return fragment.toCSS ? fragment : new Anonymous(fragment); }); - for (i = path.length - 1; i > 0; i--) { - path.splice(i, 0, new Anonymous('and')); - } - return new Expression(path); - })); - this.setParent(this.features, this); - // Fake a tree-node that doesn't output anything. - return new Ruleset([], []); - }, - permute: function (arr) { - if (arr.length === 0) { - return []; - } - else if (arr.length === 1) { - return arr[0]; - } - else { - var result = []; - var rest = this.permute(arr.slice(1)); - for (var i_1 = 0; i_1 < rest.length; i_1++) { - for (var j = 0; j < arr[0].length; j++) { - result.push([arr[0][j]].concat(rest[i_1])); - } - } - return result; - } - }, - bubbleSelectors: function (selectors) { - if (!selectors) { - return; - } - this.rules = [new Ruleset(copyArray(selectors), [this.rules[0]])]; - this.setParent(this.rules, this); - } - }; - - var AtRule = function (name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) { - var _this = this; - var i; - var selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors(); - this.name = name; - this.value = (value instanceof Node) ? value : (value ? new Anonymous(value) : value); - if (rules) { - if (Array.isArray(rules)) { - var allDeclarations = this.declarationsBlock(rules); - var allRulesetDeclarations_1 = true; - rules.forEach(function (rule) { - if (rule.type === 'Ruleset' && rule.rules) - allRulesetDeclarations_1 = allRulesetDeclarations_1 && _this.declarationsBlock(rule.rules, true); - }); - if (allDeclarations && !isRooted) { - this.simpleBlock = true; - this.declarations = rules; - } - else if (allRulesetDeclarations_1 && rules.length === 1 && !isRooted && !value) { - this.simpleBlock = true; - this.declarations = rules[0].rules ? rules[0].rules : rules; - } - else { - this.rules = rules; - } - } - else { - var allDeclarations = this.declarationsBlock(rules.rules); - if (allDeclarations && !isRooted && !value) { - this.simpleBlock = true; - this.declarations = rules.rules; - } - else { - this.rules = [rules]; - this.rules[0].selectors = (new Selector([], null, null, index, currentFileInfo)).createEmptySelectors(); - } - } - if (!this.simpleBlock) { - for (i = 0; i < this.rules.length; i++) { - this.rules[i].allowImports = true; - } - } - this.setParent(selectors, this); - this.setParent(this.rules, this); - } - this._index = index; - this._fileInfo = currentFileInfo; - this.debugInfo = debugInfo; - this.isRooted = isRooted || false; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - }; - AtRule.prototype = Object.assign(new Node(), __assign(__assign({ type: 'AtRule' }, NestableAtRulePrototype), { declarationsBlock: function (rules, mergeable) { - if (mergeable === void 0) { mergeable = false; } - if (!mergeable) { - return rules.filter(function (node) { return (node.type === 'Declaration' || node.type === 'Comment') && !node.merge; }).length === rules.length; - } - else { - return rules.filter(function (node) { return (node.type === 'Declaration' || node.type === 'Comment'); }).length === rules.length; - } - }, keywordList: function (rules) { - if (!Array.isArray(rules)) { - return false; - } - else { - return rules.filter(function (node) { return (node.type === 'Keyword' || node.type === 'Comment'); }).length === rules.length; - } - }, accept: function (visitor) { - var value = this.value, rules = this.rules, declarations = this.declarations; - if (rules) { - this.rules = visitor.visitArray(rules); - } - else if (declarations) { - this.declarations = visitor.visitArray(declarations); - } - if (value) { - this.value = visitor.visit(value); - } - }, isRulesetLike: function () { - return this.rules || !this.isCharset(); - }, isCharset: function () { - return '@charset' === this.name; - }, genCSS: function (context, output) { - var value = this.value, rules = this.rules || this.declarations; - output.add(this.name, this.fileInfo(), this.getIndex()); - if (value) { - output.add(' '); - value.genCSS(context, output); - } - if (this.simpleBlock) { - this.outputRuleset(context, output, this.declarations); - } - else if (rules) { - this.outputRuleset(context, output, rules); - } - else { - output.add(';'); - } - }, eval: function (context) { - var mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules || this.declarations; - // media stored inside other atrule should not bubble over it - // backpup media bubbling information - mediaPathBackup = context.mediaPath; - mediaBlocksBackup = context.mediaBlocks; - // deleted media bubbling information - context.mediaPath = []; - context.mediaBlocks = []; - if (value) { - value = value.eval(context); - if (value.value && this.keywordList(value.value)) { - value = new Anonymous(value.value.map(function (keyword) { return keyword.value; }).join(', '), this.getIndex(), this.fileInfo()); - } - } - if (rules) { - rules = this.evalRoot(context, rules); - } - if (Array.isArray(rules) && rules[0].rules && Array.isArray(rules[0].rules) && rules[0].rules.length) { - var allMergeableDeclarations = this.declarationsBlock(rules[0].rules, true); - if (allMergeableDeclarations && !this.isRooted && !value) { - var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules; - mergeRules(rules[0].rules); - rules = rules[0].rules; - rules.forEach(function (rule) { return rule.merge = false; }); - } - } - if (this.simpleBlock && rules) { - rules[0].functionRegistry = context.frames[0].functionRegistry.inherit(); - rules = rules.map(function (rule) { return rule.eval(context); }); - } - // restore media bubbling information - context.mediaPath = mediaPathBackup; - context.mediaBlocks = mediaBlocksBackup; - return new AtRule(this.name, value, rules, this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo()); - }, evalRoot: function (context, rules) { - var ampersandCount = 0; - var noAmpersandCount = 0; - var noAmpersands = true; - var allAmpersands = false; - if (!this.simpleBlock) { - rules = [rules[0].eval(context)]; - } - var precedingSelectors = []; - if (context.frames.length > 0) { - var _loop_1 = function (index) { - var frame = context.frames[index]; - if (frame.type === 'Ruleset' && - frame.rules && - frame.rules.length > 0) { - if (frame && !frame.root && frame.selectors && frame.selectors.length > 0) { - precedingSelectors = precedingSelectors.concat(frame.selectors); - } - } - if (precedingSelectors.length > 0) { - var value_1 = ''; - var output = { add: function (s) { value_1 += s; } }; - for (var i_1 = 0; i_1 < precedingSelectors.length; i_1++) { - precedingSelectors[i_1].genCSS(context, output); - } - if (/^&+$/.test(value_1.replace(/\s+/g, ''))) { - noAmpersands = false; - noAmpersandCount++; - } - else { - allAmpersands = false; - ampersandCount++; - } - } - }; - for (var index = 0; index < context.frames.length; index++) { - _loop_1(index); - } - } - var mixedAmpersands = ampersandCount > 0 && noAmpersandCount > 0 && !allAmpersands && !noAmpersands; - if ((this.isRooted && ampersandCount > 0 && noAmpersandCount === 0 && !allAmpersands && noAmpersands) - || !mixedAmpersands) { - rules[0].root = true; - } - return rules; - }, variable: function (name) { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return Ruleset.prototype.variable.call(this.rules[0], name); - } - }, find: function () { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return Ruleset.prototype.find.apply(this.rules[0], arguments); - } - }, rulesets: function () { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return Ruleset.prototype.rulesets.apply(this.rules[0]); - } - }, outputRuleset: function (context, output, rules) { - var ruleCnt = rules.length; - var i; - context.tabLevel = (context.tabLevel | 0) + 1; - // Compressed - if (context.compress) { - output.add('{'); - for (i = 0; i < ruleCnt; i++) { - rules[i].genCSS(context, output); - } - output.add('}'); - context.tabLevel--; - return; - } - // Non-compressed - var tabSetStr = "\n".concat(Array(context.tabLevel).join(' ')), tabRuleStr = "".concat(tabSetStr, " "); - if (!ruleCnt) { - output.add(" {".concat(tabSetStr, "}")); - } - else { - output.add(" {".concat(tabRuleStr)); - rules[0].genCSS(context, output); - for (i = 1; i < ruleCnt; i++) { - output.add(tabRuleStr); - rules[i].genCSS(context, output); - } - output.add("".concat(tabSetStr, "}")); - } - context.tabLevel--; - } })); - - var DetachedRuleset = function (ruleset, frames) { - this.ruleset = ruleset; - this.frames = frames; - this.setParent(this.ruleset, this); - }; - DetachedRuleset.prototype = Object.assign(new Node(), { - type: 'DetachedRuleset', - evalFirst: true, - accept: function (visitor) { - this.ruleset = visitor.visit(this.ruleset); - }, - eval: function (context) { - var frames = this.frames || copyArray(context.frames); - return new DetachedRuleset(this.ruleset, frames); - }, - callEval: function (context) { - return this.ruleset.eval(this.frames ? new contexts.Eval(context, this.frames.concat(context.frames)) : context); - } - }); - - var MATH = Math$1; - var Operation = function (op, operands, isSpaced) { - this.op = op.trim(); - this.operands = operands; - this.isSpaced = isSpaced; - }; - Operation.prototype = Object.assign(new Node(), { - type: 'Operation', - accept: function (visitor) { - this.operands = visitor.visitArray(this.operands); - }, - eval: function (context) { - var a = this.operands[0].eval(context), b = this.operands[1].eval(context), op; - if (context.isMathOn(this.op)) { - op = this.op === './' ? '/' : this.op; - if (a instanceof Dimension && b instanceof Color) { - a = a.toColor(); - } - if (b instanceof Dimension && a instanceof Color) { - b = b.toColor(); - } - if (!a.operate || !b.operate) { - if ((a instanceof Operation || b instanceof Operation) - && a.op === '/' && context.math === MATH.PARENS_DIVISION) { - return new Operation(this.op, [a, b], this.isSpaced); - } - throw { type: 'Operation', - message: 'Operation on an invalid type' }; - } - return a.operate(context, op, b); - } - else { - return new Operation(this.op, [a, b], this.isSpaced); - } - }, - genCSS: function (context, output) { - this.operands[0].genCSS(context, output); - if (this.isSpaced) { - output.add(' '); - } - output.add(this.op); - if (this.isSpaced) { - output.add(' '); - } - this.operands[1].genCSS(context, output); - } - }); - - var functionCaller = /** @class */ (function () { - function functionCaller(name, context, index, currentFileInfo) { - this.name = name.toLowerCase(); - this.index = index; - this.context = context; - this.currentFileInfo = currentFileInfo; - this.func = context.frames[0].functionRegistry.get(this.name); - } - functionCaller.prototype.isValid = function () { - return Boolean(this.func); - }; - functionCaller.prototype.call = function (args) { - var _this = this; - if (!(Array.isArray(args))) { - args = [args]; - } - var evalArgs = this.func.evalArgs; - if (evalArgs !== false) { - args = args.map(function (a) { return a.eval(_this.context); }); - } - var commentFilter = function (item) { return !(item.type === 'Comment'); }; - // This code is terrible and should be replaced as per this issue... - // https://github.com/less/less.js/issues/2477 - args = args - .filter(commentFilter) - .map(function (item) { - if (item.type === 'Expression') { - var subNodes = item.value.filter(commentFilter); - if (subNodes.length === 1) { - // https://github.com/less/less.js/issues/3616 - if (item.parens && subNodes[0].op === '/') { - return item; - } - return subNodes[0]; - } - else { - return new Expression(subNodes); - } - } - return item; - }); - if (evalArgs === false) { - return this.func.apply(this, __spreadArray([this.context], args, false)); - } - return this.func.apply(this, args); - }; - return functionCaller; - }()); - - // - // A function call node. - // - var Call = function (name, args, index, currentFileInfo) { - this.name = name; - this.args = args; - this.calc = name === 'calc'; - this._index = index; - this._fileInfo = currentFileInfo; - }; - Call.prototype = Object.assign(new Node(), { - type: 'Call', - accept: function (visitor) { - if (this.args) { - this.args = visitor.visitArray(this.args); - } - }, - // - // When evaluating a function call, - // we either find the function in the functionRegistry, - // in which case we call it, passing the evaluated arguments, - // if this returns null or we cannot find the function, we - // simply print it out as it appeared originally [2]. - // - // The reason why we evaluate the arguments, is in the case where - // we try to pass a variable to a function, like: `saturate(@color)`. - // The function should receive the value, not the variable. - // - eval: function (context) { - var _this = this; - /** - * Turn off math for calc(), and switch back on for evaluating nested functions - */ - var currentMathContext = context.mathOn; - context.mathOn = !this.calc; - if (this.calc || context.inCalc) { - context.enterCalc(); - } - var exitCalc = function () { - if (_this.calc || context.inCalc) { - context.exitCalc(); - } - context.mathOn = currentMathContext; - }; - var result; - var funcCaller = new functionCaller(this.name, context, this.getIndex(), this.fileInfo()); - if (funcCaller.isValid()) { - try { - result = funcCaller.call(this.args); - exitCalc(); - } - catch (e) { - // eslint-disable-next-line no-prototype-builtins - if (e.hasOwnProperty('line') && e.hasOwnProperty('column')) { - throw e; - } - throw { - type: e.type || 'Runtime', - message: "Error evaluating function `".concat(this.name, "`").concat(e.message ? ": ".concat(e.message) : ''), - index: this.getIndex(), - filename: this.fileInfo().filename, - line: e.lineNumber, - column: e.columnNumber - }; - } - } - if (result !== null && result !== undefined) { - // Results that that are not nodes are cast as Anonymous nodes - // Falsy values or booleans are returned as empty nodes - if (!(result instanceof Node)) { - if (!result || result === true) { - result = new Anonymous(null); - } - else { - result = new Anonymous(result.toString()); - } - } - result._index = this._index; - result._fileInfo = this._fileInfo; - return result; - } - var args = this.args.map(function (a) { return a.eval(context); }); - exitCalc(); - return new Call(this.name, args, this.getIndex(), this.fileInfo()); - }, - genCSS: function (context, output) { - output.add("".concat(this.name, "("), this.fileInfo(), this.getIndex()); - for (var i_1 = 0; i_1 < this.args.length; i_1++) { - this.args[i_1].genCSS(context, output); - if (i_1 + 1 < this.args.length) { - output.add(', '); - } - } - output.add(')'); - } - }); - - var Variable = function (name, index, currentFileInfo) { - this.name = name; - this._index = index; - this._fileInfo = currentFileInfo; - }; - Variable.prototype = Object.assign(new Node(), { - type: 'Variable', - eval: function (context) { - var variable, name = this.name; - if (name.indexOf('@@') === 0) { - name = "@".concat(new Variable(name.slice(1), this.getIndex(), this.fileInfo()).eval(context).value); - } - if (this.evaluating) { - throw { type: 'Name', - message: "Recursive variable definition for ".concat(name), - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - this.evaluating = true; - variable = this.find(context.frames, function (frame) { - var v = frame.variable(name); - if (v) { - if (v.important) { - var importantScope = context.importantScope[context.importantScope.length - 1]; - importantScope.important = v.important; - } - // If in calc, wrap vars in a function call to cascade evaluate args first - if (context.inCalc) { - return (new Call('_SELF', [v.value])).eval(context); - } - else { - return v.value.eval(context); - } - } - }); - if (variable) { - this.evaluating = false; - return variable; - } - else { - throw { type: 'Name', - message: "variable ".concat(name, " is undefined"), - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - }, - find: function (obj, fun) { - for (var i_1 = 0, r = void 0; i_1 < obj.length; i_1++) { - r = fun.call(obj, obj[i_1]); - if (r) { - return r; - } - } - return null; - } - }); - - var Property = function (name, index, currentFileInfo) { - this.name = name; - this._index = index; - this._fileInfo = currentFileInfo; - }; - Property.prototype = Object.assign(new Node(), { - type: 'Property', - eval: function (context) { - var property; - var name = this.name; - // TODO: shorten this reference - var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules; - if (this.evaluating) { - throw { type: 'Name', - message: "Recursive property reference for ".concat(name), - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - this.evaluating = true; - property = this.find(context.frames, function (frame) { - var v; - var vArr = frame.property(name); - if (vArr) { - for (var i_1 = 0; i_1 < vArr.length; i_1++) { - v = vArr[i_1]; - vArr[i_1] = new Declaration(v.name, v.value, v.important, v.merge, v.index, v.currentFileInfo, v.inline, v.variable); - } - mergeRules(vArr); - v = vArr[vArr.length - 1]; - if (v.important) { - var importantScope = context.importantScope[context.importantScope.length - 1]; - importantScope.important = v.important; - } - v = v.value.eval(context); - return v; - } - }); - if (property) { - this.evaluating = false; - return property; - } - else { - throw { type: 'Name', - message: "Property '".concat(name, "' is undefined"), - filename: this.currentFileInfo.filename, - index: this.index }; - } - }, - find: function (obj, fun) { - for (var i_2 = 0, r = void 0; i_2 < obj.length; i_2++) { - r = fun.call(obj, obj[i_2]); - if (r) { - return r; - } - } - return null; - } - }); - - var Attribute = function (key, op, value, cif) { - this.key = key; - this.op = op; - this.value = value; - this.cif = cif; - }; - Attribute.prototype = Object.assign(new Node(), { - type: 'Attribute', - eval: function (context) { - return new Attribute(this.key.eval ? this.key.eval(context) : this.key, this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value, this.cif); - }, - genCSS: function (context, output) { - output.add(this.toCSS(context)); - }, - toCSS: function (context) { - var value = this.key.toCSS ? this.key.toCSS(context) : this.key; - if (this.op) { - value += this.op; - value += (this.value.toCSS ? this.value.toCSS(context) : this.value); - } - if (this.cif) { - value = value + ' ' + this.cif; - } - return "[".concat(value, "]"); - } - }); - - var Quoted = function (str, content, escaped, index, currentFileInfo) { - this.escaped = (escaped === undefined) ? true : escaped; - this.value = content || ''; - this.quote = str.charAt(0); - this._index = index; - this._fileInfo = currentFileInfo; - this.variableRegex = /@\{([\w-]+)\}/g; - this.propRegex = /\$\{([\w-]+)\}/g; - this.allowRoot = escaped; - }; - Quoted.prototype = Object.assign(new Node(), { - type: 'Quoted', - genCSS: function (context, output) { - if (!this.escaped) { - output.add(this.quote, this.fileInfo(), this.getIndex()); - } - output.add(this.value); - if (!this.escaped) { - output.add(this.quote); - } - }, - containsVariables: function () { - return this.value.match(this.variableRegex); - }, - eval: function (context) { - var that = this; - var value = this.value; - var variableReplacement = function (_, name1, name2) { - var v = new Variable("@".concat(name1 !== null && name1 !== void 0 ? name1 : name2), that.getIndex(), that.fileInfo()).eval(context, true); - return (v instanceof Quoted) ? v.value : v.toCSS(); - }; - var propertyReplacement = function (_, name1, name2) { - var v = new Property("$".concat(name1 !== null && name1 !== void 0 ? name1 : name2), that.getIndex(), that.fileInfo()).eval(context, true); - return (v instanceof Quoted) ? v.value : v.toCSS(); - }; - function iterativeReplace(value, regexp, replacementFnc) { - var evaluatedValue = value; - do { - value = evaluatedValue.toString(); - evaluatedValue = value.replace(regexp, replacementFnc); - } while (value !== evaluatedValue); - return evaluatedValue; - } - value = iterativeReplace(value, this.variableRegex, variableReplacement); - value = iterativeReplace(value, this.propRegex, propertyReplacement); - return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo()); - }, - compare: function (other) { - // when comparing quoted strings allow the quote to differ - if (other.type === 'Quoted' && !this.escaped && !other.escaped) { - return Node.numericCompare(this.value, other.value); - } - else { - return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined; - } - } - }); - - function escapePath(path) { - return path.replace(/[()'"\s]/g, function (match) { return "\\".concat(match); }); - } - var URL = function (val, index, currentFileInfo, isEvald) { - this.value = val; - this._index = index; - this._fileInfo = currentFileInfo; - this.isEvald = isEvald; - }; - URL.prototype = Object.assign(new Node(), { - type: 'Url', - accept: function (visitor) { - this.value = visitor.visit(this.value); - }, - genCSS: function (context, output) { - output.add('url('); - this.value.genCSS(context, output); - output.add(')'); - }, - eval: function (context) { - var val = this.value.eval(context); - var rootpath; - if (!this.isEvald) { - // Add the rootpath if the URL requires a rewrite - rootpath = this.fileInfo() && this.fileInfo().rootpath; - if (typeof rootpath === 'string' && - typeof val.value === 'string' && - context.pathRequiresRewrite(val.value)) { - if (!val.quote) { - rootpath = escapePath(rootpath); - } - val.value = context.rewritePath(val.value, rootpath); - } - else { - val.value = context.normalizePath(val.value); - } - // Add url args if enabled - if (context.urlArgs) { - if (!val.value.match(/^\s*data:/)) { - var delimiter = val.value.indexOf('?') === -1 ? '?' : '&'; - var urlArgs = delimiter + context.urlArgs; - if (val.value.indexOf('#') !== -1) { - val.value = val.value.replace('#', "".concat(urlArgs, "#")); - } - else { - val.value += urlArgs; - } - } - } - } - return new URL(val, this.getIndex(), this.fileInfo(), true); - } - }); - - var Media = function (value, features, index, currentFileInfo, visibilityInfo) { - this._index = index; - this._fileInfo = currentFileInfo; - var selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors(); - this.features = new Value(features); - this.rules = [new Ruleset(selectors, value)]; - this.rules[0].allowImports = true; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - this.setParent(selectors, this); - this.setParent(this.features, this); - this.setParent(this.rules, this); - }; - Media.prototype = Object.assign(new AtRule(), __assign(__assign({ type: 'Media' }, NestableAtRulePrototype), { genCSS: function (context, output) { - output.add('@media ', this._fileInfo, this._index); - this.features.genCSS(context, output); - this.outputRuleset(context, output, this.rules); - }, eval: function (context) { - if (!context.mediaBlocks) { - context.mediaBlocks = []; - context.mediaPath = []; - } - var media = new Media(null, [], this._index, this._fileInfo, this.visibilityInfo()); - if (this.debugInfo) { - this.rules[0].debugInfo = this.debugInfo; - media.debugInfo = this.debugInfo; - } - media.features = this.features.eval(context); - context.mediaPath.push(media); - context.mediaBlocks.push(media); - this.rules[0].functionRegistry = context.frames[0].functionRegistry.inherit(); - context.frames.unshift(this.rules[0]); - media.rules = [this.rules[0].eval(context)]; - context.frames.shift(); - context.mediaPath.pop(); - return context.mediaPath.length === 0 ? media.evalTop(context) : - media.evalNested(context); - } })); - - // - // CSS @import node - // - // The general strategy here is that we don't want to wait - // for the parsing to be completed, before we start importing - // the file. That's because in the context of a browser, - // most of the time will be spent waiting for the server to respond. - // - // On creation, we push the import path to our import queue, though - // `import,push`, we also pass it a callback, which it'll call once - // the file has been fetched, and parsed. - // - var Import = function (path, features, options, index, currentFileInfo, visibilityInfo) { - this.options = options; - this._index = index; - this._fileInfo = currentFileInfo; - this.path = path; - this.features = features; - this.allowRoot = true; - if (this.options.less !== undefined || this.options.inline) { - this.css = !this.options.less || this.options.inline; - } - else { - var pathValue = this.getPath(); - if (pathValue && /[#.&?]css([?;].*)?$/.test(pathValue)) { - this.css = true; - } - } - this.copyVisibilityInfo(visibilityInfo); - this.setParent(this.features, this); - this.setParent(this.path, this); - }; - Import.prototype = Object.assign(new Node(), { - type: 'Import', - accept: function (visitor) { - if (this.features) { - this.features = visitor.visit(this.features); - } - this.path = visitor.visit(this.path); - if (!this.options.isPlugin && !this.options.inline && this.root) { - this.root = visitor.visit(this.root); - } - }, - genCSS: function (context, output) { - if (this.css && this.path._fileInfo.reference === undefined) { - output.add('@import ', this._fileInfo, this._index); - this.path.genCSS(context, output); - if (this.features) { - output.add(' '); - this.features.genCSS(context, output); - } - output.add(';'); - } - }, - getPath: function () { - return (this.path instanceof URL) ? - this.path.value.value : this.path.value; - }, - isVariableImport: function () { - var path = this.path; - if (path instanceof URL) { - path = path.value; - } - if (path instanceof Quoted) { - return path.containsVariables(); - } - return true; - }, - evalForImport: function (context) { - var path = this.path; - if (path instanceof URL) { - path = path.value; - } - return new Import(path.eval(context), this.features, this.options, this._index, this._fileInfo, this.visibilityInfo()); - }, - evalPath: function (context) { - var path = this.path.eval(context); - var fileInfo = this._fileInfo; - if (!(path instanceof URL)) { - // Add the rootpath if the URL requires a rewrite - var pathValue = path.value; - if (fileInfo && - pathValue && - context.pathRequiresRewrite(pathValue)) { - path.value = context.rewritePath(pathValue, fileInfo.rootpath); - } - else { - path.value = context.normalizePath(path.value); - } - } - return path; - }, - eval: function (context) { - var result = this.doEval(context); - if (this.options.reference || this.blocksVisibility()) { - if (result.length || result.length === 0) { - result.forEach(function (node) { - node.addVisibilityBlock(); - }); - } - else { - result.addVisibilityBlock(); - } - } - return result; - }, - doEval: function (context) { - var ruleset; - var registry; - var features = this.features && this.features.eval(context); - if (this.options.isPlugin) { - if (this.root && this.root.eval) { - try { - this.root.eval(context); - } - catch (e) { - e.message = 'Plugin error during evaluation'; - throw new LessError(e, this.root.imports, this.root.filename); - } - } - registry = context.frames[0] && context.frames[0].functionRegistry; - if (registry && this.root && this.root.functions) { - registry.addMultiple(this.root.functions); - } - return []; - } - if (this.skip) { - if (typeof this.skip === 'function') { - this.skip = this.skip(); - } - if (this.skip) { - return []; - } - } - if (this.features) { - var featureValue = this.features.value; - if (Array.isArray(featureValue) && featureValue.length >= 1) { - var expr = featureValue[0]; - if (expr.type === 'Expression' && Array.isArray(expr.value) && expr.value.length >= 2) { - featureValue = expr.value; - var isLayer = featureValue[0].type === 'Keyword' && featureValue[0].value === 'layer' - && featureValue[1].type === 'Paren'; - if (isLayer) { - this.css = false; - } - } - } - } - if (this.options.inline) { - var contents = new Anonymous(this.root, 0, { - filename: this.importedFilename, - reference: this.path._fileInfo && this.path._fileInfo.reference - }, true, true); - return this.features ? new Media([contents], this.features.value) : [contents]; - } - else if (this.css || this.layerCss) { - var newImport = new Import(this.evalPath(context), features, this.options, this._index); - if (this.layerCss) { - newImport.css = this.layerCss; - newImport.path._fileInfo = this._fileInfo; - } - if (!newImport.css && this.error) { - throw this.error; - } - return newImport; - } - else if (this.root) { - if (this.features) { - var featureValue = this.features.value; - if (Array.isArray(featureValue) && featureValue.length === 1) { - var expr = featureValue[0]; - if (expr.type === 'Expression' && Array.isArray(expr.value) && expr.value.length >= 2) { - featureValue = expr.value; - var isLayer = featureValue[0].type === 'Keyword' && featureValue[0].value === 'layer' - && featureValue[1].type === 'Paren'; - if (isLayer) { - this.layerCss = true; - featureValue[0] = new Expression(featureValue.slice(0, 2)); - featureValue.splice(1, 1); - featureValue[0].noSpacing = true; - return this; - } - } - } - } - ruleset = new Ruleset(null, copyArray(this.root.rules)); - ruleset.evalImports(context); - return this.features ? new Media(ruleset.rules, this.features.value) : ruleset.rules; - } - else { - if (this.features) { - var featureValue = this.features.value; - if (Array.isArray(featureValue) && featureValue.length >= 1) { - featureValue = featureValue[0].value; - if (Array.isArray(featureValue) && featureValue.length >= 2) { - var isLayer = featureValue[0].type === 'Keyword' && featureValue[0].value === 'layer' - && featureValue[1].type === 'Paren'; - if (isLayer) { - this.css = true; - featureValue[0] = new Expression(featureValue.slice(0, 2)); - featureValue.splice(1, 1); - featureValue[0].noSpacing = true; - return this; - } - } - } - } - return []; - } - } - }); - - var JsEvalNode = function () { }; - JsEvalNode.prototype = Object.assign(new Node(), { - evaluateJavaScript: function (expression, context) { - var result; - var that = this; - var evalContext = {}; - if (!context.javascriptEnabled) { - throw { message: 'Inline JavaScript is not enabled. Is it set in your options?', - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - expression = expression.replace(/@\{([\w-]+)\}/g, function (_, name) { - return that.jsify(new Variable("@".concat(name), that.getIndex(), that.fileInfo()).eval(context)); - }); - try { - expression = new Function("return (".concat(expression, ")")); - } - catch (e) { - throw { message: "JavaScript evaluation error: ".concat(e.message, " from `").concat(expression, "`"), - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - var variables = context.frames[0].variables(); - for (var k in variables) { - // eslint-disable-next-line no-prototype-builtins - if (variables.hasOwnProperty(k)) { - evalContext[k.slice(1)] = { - value: variables[k].value, - toJS: function () { - return this.value.eval(context).toCSS(); - } - }; - } - } - try { - result = expression.call(evalContext); - } - catch (e) { - throw { message: "JavaScript evaluation error: '".concat(e.name, ": ").concat(e.message.replace(/["]/g, '\''), "'"), - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - return result; - }, - jsify: function (obj) { - if (Array.isArray(obj.value) && (obj.value.length > 1)) { - return "[".concat(obj.value.map(function (v) { return v.toCSS(); }).join(', '), "]"); - } - else { - return obj.toCSS(); - } - } - }); - - var JavaScript = function (string, escaped, index, currentFileInfo) { - this.escaped = escaped; - this.expression = string; - this._index = index; - this._fileInfo = currentFileInfo; - }; - JavaScript.prototype = Object.assign(new JsEvalNode(), { - type: 'JavaScript', - eval: function (context) { - var result = this.evaluateJavaScript(this.expression, context); - var type = typeof result; - if (type === 'number' && !isNaN(result)) { - return new Dimension(result); - } - else if (type === 'string') { - return new Quoted("\"".concat(result, "\""), result, this.escaped, this._index); - } - else if (Array.isArray(result)) { - return new Anonymous(result.join(', ')); - } - else { - return new Anonymous(result); - } - } - }); - - var Assignment = function (key, val) { - this.key = key; - this.value = val; - }; - Assignment.prototype = Object.assign(new Node(), { - type: 'Assignment', - accept: function (visitor) { - this.value = visitor.visit(this.value); - }, - eval: function (context) { - if (this.value.eval) { - return new Assignment(this.key, this.value.eval(context)); - } - return this; - }, - genCSS: function (context, output) { - output.add("".concat(this.key, "=")); - if (this.value.genCSS) { - this.value.genCSS(context, output); - } - else { - output.add(this.value); - } - } - }); - - var Condition = function (op, l, r, i, negate) { - this.op = op.trim(); - this.lvalue = l; - this.rvalue = r; - this._index = i; - this.negate = negate; - }; - Condition.prototype = Object.assign(new Node(), { - type: 'Condition', - accept: function (visitor) { - this.lvalue = visitor.visit(this.lvalue); - this.rvalue = visitor.visit(this.rvalue); - }, - eval: function (context) { - var result = (function (op, a, b) { - switch (op) { - case 'and': return a && b; - case 'or': return a || b; - default: - switch (Node.compare(a, b)) { - case -1: - return op === '<' || op === '=<' || op === '<='; - case 0: - return op === '=' || op === '>=' || op === '=<' || op === '<='; - case 1: - return op === '>' || op === '>='; - default: - return false; - } - } - })(this.op, this.lvalue.eval(context), this.rvalue.eval(context)); - return this.negate ? !result : result; - } - }); - - var QueryInParens = function (op, l, m, op2, r, i) { - this.op = op.trim(); - this.lvalue = l; - this.mvalue = m; - this.op2 = op2 ? op2.trim() : null; - this.rvalue = r; - this._index = i; - this.mvalues = []; - }; - QueryInParens.prototype = Object.assign(new Node(), { - type: 'QueryInParens', - accept: function (visitor) { - this.lvalue = visitor.visit(this.lvalue); - this.mvalue = visitor.visit(this.mvalue); - if (this.rvalue) { - this.rvalue = visitor.visit(this.rvalue); - } - }, - eval: function (context) { - this.lvalue = this.lvalue.eval(context); - var variableDeclaration; - var rule; - for (var i_1 = 0; (rule = context.frames[i_1]); i_1++) { - if (rule.type === 'Ruleset') { - variableDeclaration = rule.rules.find(function (r) { - if ((r instanceof Declaration) && r.variable) { - return true; - } - return false; - }); - if (variableDeclaration) { - break; - } - } - } - if (!this.mvalueCopy) { - this.mvalueCopy = copy(this.mvalue); - } - if (variableDeclaration) { - this.mvalue = this.mvalueCopy; - this.mvalue = this.mvalue.eval(context); - this.mvalues.push(this.mvalue); - } - else { - this.mvalue = this.mvalue.eval(context); - } - if (this.rvalue) { - this.rvalue = this.rvalue.eval(context); - } - return this; - }, - genCSS: function (context, output) { - this.lvalue.genCSS(context, output); - output.add(' ' + this.op + ' '); - if (this.mvalues.length > 0) { - this.mvalue = this.mvalues.shift(); - } - this.mvalue.genCSS(context, output); - if (this.rvalue) { - output.add(' ' + this.op2 + ' '); - this.rvalue.genCSS(context, output); - } - }, - }); - - var Container = function (value, features, index, currentFileInfo, visibilityInfo) { - this._index = index; - this._fileInfo = currentFileInfo; - var selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors(); - this.features = new Value(features); - this.rules = [new Ruleset(selectors, value)]; - this.rules[0].allowImports = true; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - this.setParent(selectors, this); - this.setParent(this.features, this); - this.setParent(this.rules, this); - }; - Container.prototype = Object.assign(new AtRule(), __assign(__assign({ type: 'Container' }, NestableAtRulePrototype), { genCSS: function (context, output) { - output.add('@container ', this._fileInfo, this._index); - this.features.genCSS(context, output); - this.outputRuleset(context, output, this.rules); - }, eval: function (context) { - if (!context.mediaBlocks) { - context.mediaBlocks = []; - context.mediaPath = []; - } - var media = new Container(null, [], this._index, this._fileInfo, this.visibilityInfo()); - if (this.debugInfo) { - this.rules[0].debugInfo = this.debugInfo; - media.debugInfo = this.debugInfo; - } - media.features = this.features.eval(context); - context.mediaPath.push(media); - context.mediaBlocks.push(media); - this.rules[0].functionRegistry = context.frames[0].functionRegistry.inherit(); - context.frames.unshift(this.rules[0]); - media.rules = [this.rules[0].eval(context)]; - context.frames.shift(); - context.mediaPath.pop(); - return context.mediaPath.length === 0 ? media.evalTop(context) : - media.evalNested(context); - } })); - - var UnicodeDescriptor = function (value) { - this.value = value; - }; - UnicodeDescriptor.prototype = Object.assign(new Node(), { - type: 'UnicodeDescriptor' - }); - - var Negative = function (node) { - this.value = node; - }; - Negative.prototype = Object.assign(new Node(), { - type: 'Negative', - genCSS: function (context, output) { - output.add('-'); - this.value.genCSS(context, output); - }, - eval: function (context) { - if (context.isMathOn()) { - return (new Operation('*', [new Dimension(-1), this.value])).eval(context); - } - return new Negative(this.value.eval(context)); - } - }); - - var Extend = function (selector, option, index, currentFileInfo, visibilityInfo) { - this.selector = selector; - this.option = option; - this.object_id = Extend.next_id++; - this.parent_ids = [this.object_id]; - this._index = index; - this._fileInfo = currentFileInfo; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - switch (option) { - case '!all': - case 'all': - this.allowBefore = true; - this.allowAfter = true; - break; - default: - this.allowBefore = false; - this.allowAfter = false; - break; - } - this.setParent(this.selector, this); - }; - Extend.prototype = Object.assign(new Node(), { - type: 'Extend', - accept: function (visitor) { - this.selector = visitor.visit(this.selector); - }, - eval: function (context) { - return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - }, - // remove when Nodes have JSDoc types - // eslint-disable-next-line no-unused-vars - clone: function (context) { - return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - }, - // it concatenates (joins) all selectors in selector array - findSelfSelectors: function (selectors) { - var selfElements = [], i, selectorElements; - for (i = 0; i < selectors.length; i++) { - selectorElements = selectors[i].elements; - // duplicate the logic in genCSS function inside the selector node. - // future TODO - move both logics into the selector joiner visitor - if (i > 0 && selectorElements.length && selectorElements[0].combinator.value === '') { - selectorElements[0].combinator.value = ' '; - } - selfElements = selfElements.concat(selectors[i].elements); - } - this.selfSelectors = [new Selector(selfElements)]; - this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo()); - } - }); - Extend.next_id = 0; - - var VariableCall = function (variable, index, currentFileInfo) { - this.variable = variable; - this._index = index; - this._fileInfo = currentFileInfo; - this.allowRoot = true; - }; - VariableCall.prototype = Object.assign(new Node(), { - type: 'VariableCall', - eval: function (context) { - var rules; - var detachedRuleset = new Variable(this.variable, this.getIndex(), this.fileInfo()).eval(context); - var error = new LessError({ message: "Could not evaluate variable call ".concat(this.variable) }); - if (!detachedRuleset.ruleset) { - if (detachedRuleset.rules) { - rules = detachedRuleset; - } - else if (Array.isArray(detachedRuleset)) { - rules = new Ruleset('', detachedRuleset); - } - else if (Array.isArray(detachedRuleset.value)) { - rules = new Ruleset('', detachedRuleset.value); - } - else { - throw error; - } - detachedRuleset = new DetachedRuleset(rules); - } - if (detachedRuleset.ruleset) { - return detachedRuleset.callEval(context); - } - throw error; - } - }); - - var NamespaceValue = function (ruleCall, lookups, index, fileInfo) { - this.value = ruleCall; - this.lookups = lookups; - this._index = index; - this._fileInfo = fileInfo; - }; - NamespaceValue.prototype = Object.assign(new Node(), { - type: 'NamespaceValue', - eval: function (context) { - var i, name, rules = this.value.eval(context); - for (i = 0; i < this.lookups.length; i++) { - name = this.lookups[i]; - /** - * Eval'd DRs return rulesets. - * Eval'd mixins return rules, so let's make a ruleset if we need it. - * We need to do this because of late parsing of values - */ - if (Array.isArray(rules)) { - rules = new Ruleset([new Selector()], rules); - } - if (name === '') { - rules = rules.lastDeclaration(); - } - else if (name.charAt(0) === '@') { - if (name.charAt(1) === '@') { - name = "@".concat(new Variable(name.substr(1)).eval(context).value); - } - if (rules.variables) { - rules = rules.variable(name); - } - if (!rules) { - throw { type: 'Name', - message: "variable ".concat(name, " not found"), - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - } - else { - if (name.substring(0, 2) === '$@') { - name = "$".concat(new Variable(name.substr(1)).eval(context).value); - } - else { - name = name.charAt(0) === '$' ? name : "$".concat(name); - } - if (rules.properties) { - rules = rules.property(name); - } - if (!rules) { - throw { type: 'Name', - message: "property \"".concat(name.substr(1), "\" not found"), - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - // Properties are an array of values, since a ruleset can have multiple props. - // We pick the last one (the "cascaded" value) - rules = rules[rules.length - 1]; - } - if (rules.value) { - rules = rules.eval(context).value; - } - if (rules.ruleset) { - rules = rules.ruleset.eval(context); - } - } - return rules; - } - }); - - var Definition = function (name, params, rules, condition, variadic, frames, visibilityInfo) { - this.name = name || 'anonymous mixin'; - this.selectors = [new Selector([new Element(null, name, false, this._index, this._fileInfo)])]; - this.params = params; - this.condition = condition; - this.variadic = variadic; - this.arity = params.length; - this.rules = rules; - this._lookups = {}; - var optionalParameters = []; - this.required = params.reduce(function (count, p) { - if (!p.name || (p.name && !p.value)) { - return count + 1; - } - else { - optionalParameters.push(p.name); - return count; - } - }, 0); - this.optionalParameters = optionalParameters; - this.frames = frames; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - }; - Definition.prototype = Object.assign(new Ruleset(), { - type: 'MixinDefinition', - evalFirst: true, - accept: function (visitor) { - if (this.params && this.params.length) { - this.params = visitor.visitArray(this.params); - } - this.rules = visitor.visitArray(this.rules); - if (this.condition) { - this.condition = visitor.visit(this.condition); - } - }, - evalParams: function (context, mixinEnv, args, evaldArguments) { - /* jshint boss:true */ - var frame = new Ruleset(null, null); - var varargs; - var arg; - var params = copyArray(this.params); - var i; - var j; - var val; - var name; - var isNamedFound; - var argIndex; - var argsLength = 0; - if (mixinEnv.frames && mixinEnv.frames[0] && mixinEnv.frames[0].functionRegistry) { - frame.functionRegistry = mixinEnv.frames[0].functionRegistry.inherit(); - } - mixinEnv = new contexts.Eval(mixinEnv, [frame].concat(mixinEnv.frames)); - if (args) { - args = copyArray(args); - argsLength = args.length; - for (i = 0; i < argsLength; i++) { - arg = args[i]; - if (name = (arg && arg.name)) { - isNamedFound = false; - for (j = 0; j < params.length; j++) { - if (!evaldArguments[j] && name === params[j].name) { - evaldArguments[j] = arg.value.eval(context); - frame.prependRule(new Declaration(name, arg.value.eval(context))); - isNamedFound = true; - break; - } - } - if (isNamedFound) { - args.splice(i, 1); - i--; - continue; - } - else { - throw { type: 'Runtime', message: "Named argument for ".concat(this.name, " ").concat(args[i].name, " not found") }; - } - } - } - } - argIndex = 0; - for (i = 0; i < params.length; i++) { - if (evaldArguments[i]) { - continue; - } - arg = args && args[argIndex]; - if (name = params[i].name) { - if (params[i].variadic) { - varargs = []; - for (j = argIndex; j < argsLength; j++) { - varargs.push(args[j].value.eval(context)); - } - frame.prependRule(new Declaration(name, new Expression(varargs).eval(context))); - } - else { - val = arg && arg.value; - if (val) { - // This was a mixin call, pass in a detached ruleset of it's eval'd rules - if (Array.isArray(val)) { - val = new DetachedRuleset(new Ruleset('', val)); - } - else { - val = val.eval(context); - } - } - else if (params[i].value) { - val = params[i].value.eval(mixinEnv); - frame.resetCache(); - } - else { - throw { type: 'Runtime', message: "wrong number of arguments for ".concat(this.name, " (").concat(argsLength, " for ").concat(this.arity, ")") }; - } - frame.prependRule(new Declaration(name, val)); - evaldArguments[i] = val; - } - } - if (params[i].variadic && args) { - for (j = argIndex; j < argsLength; j++) { - evaldArguments[j] = args[j].value.eval(context); - } - } - argIndex++; - } - return frame; - }, - makeImportant: function () { - var rules = !this.rules ? this.rules : this.rules.map(function (r) { - if (r.makeImportant) { - return r.makeImportant(true); - } - else { - return r; - } - }); - var result = new Definition(this.name, this.params, rules, this.condition, this.variadic, this.frames); - return result; - }, - eval: function (context) { - return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || copyArray(context.frames)); - }, - evalCall: function (context, args, important) { - var _arguments = []; - var mixinFrames = this.frames ? this.frames.concat(context.frames) : context.frames; - var frame = this.evalParams(context, new contexts.Eval(context, mixinFrames), args, _arguments); - var rules; - var ruleset; - frame.prependRule(new Declaration('@arguments', new Expression(_arguments).eval(context))); - rules = copyArray(this.rules); - ruleset = new Ruleset(null, rules); - ruleset.originalRuleset = this; - ruleset = ruleset.eval(new contexts.Eval(context, [this, frame].concat(mixinFrames))); - if (important) { - ruleset = ruleset.makeImportant(); - } - return ruleset; - }, - matchCondition: function (args, context) { - if (this.condition && !this.condition.eval(new contexts.Eval(context, [this.evalParams(context, /* the parameter variables */ new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])] - .concat(this.frames || []) // the parent namespace/mixin frames - .concat(context.frames)))) { // the current environment frames - return false; - } - return true; - }, - matchArgs: function (args, context) { - var allArgsCnt = (args && args.length) || 0; - var len; - var optionalParameters = this.optionalParameters; - var requiredArgsCnt = !args ? 0 : args.reduce(function (count, p) { - if (optionalParameters.indexOf(p.name) < 0) { - return count + 1; - } - else { - return count; - } - }, 0); - if (!this.variadic) { - if (requiredArgsCnt < this.required) { - return false; - } - if (allArgsCnt > this.params.length) { - return false; - } - } - else { - if (requiredArgsCnt < (this.required - 1)) { - return false; - } - } - // check patterns - len = Math.min(requiredArgsCnt, this.arity); - for (var i_1 = 0; i_1 < len; i_1++) { - if (!this.params[i_1].name && !this.params[i_1].variadic) { - if (args[i_1].value.eval(context).toCSS() != this.params[i_1].value.eval(context).toCSS()) { - return false; - } - } - } - return true; - } - }); - - var MixinCall = function (elements, args, index, currentFileInfo, important) { - this.selector = new Selector(elements); - this.arguments = args || []; - this._index = index; - this._fileInfo = currentFileInfo; - this.important = important; - this.allowRoot = true; - this.setParent(this.selector, this); - }; - MixinCall.prototype = Object.assign(new Node(), { - type: 'MixinCall', - accept: function (visitor) { - if (this.selector) { - this.selector = visitor.visit(this.selector); - } - if (this.arguments.length) { - this.arguments = visitor.visitArray(this.arguments); - } - }, - eval: function (context) { - var mixins; - var mixin; - var mixinPath; - var args = []; - var arg; - var argValue; - var rules = []; - var match = false; - var i; - var m; - var f; - var isRecursive; - var isOneFound; - var candidates = []; - var candidate; - var conditionResult = []; - var defaultResult; - var defFalseEitherCase = -1; - var defNone = 0; - var defTrue = 1; - var defFalse = 2; - var count; - var originalRuleset; - var noArgumentsFilter; - this.selector = this.selector.eval(context); - function calcDefGroup(mixin, mixinPath) { - var f, p, namespace; - for (f = 0; f < 2; f++) { - conditionResult[f] = true; - defaultFunc.value(f); - for (p = 0; p < mixinPath.length && conditionResult[f]; p++) { - namespace = mixinPath[p]; - if (namespace.matchCondition) { - conditionResult[f] = conditionResult[f] && namespace.matchCondition(null, context); - } - } - if (mixin.matchCondition) { - conditionResult[f] = conditionResult[f] && mixin.matchCondition(args, context); - } - } - if (conditionResult[0] || conditionResult[1]) { - if (conditionResult[0] != conditionResult[1]) { - return conditionResult[1] ? - defTrue : defFalse; - } - return defNone; - } - return defFalseEitherCase; - } - for (i = 0; i < this.arguments.length; i++) { - arg = this.arguments[i]; - argValue = arg.value.eval(context); - if (arg.expand && Array.isArray(argValue.value)) { - argValue = argValue.value; - for (m = 0; m < argValue.length; m++) { - args.push({ value: argValue[m] }); - } - } - else { - args.push({ name: arg.name, value: argValue }); - } - } - noArgumentsFilter = function (rule) { return rule.matchArgs(null, context); }; - for (i = 0; i < context.frames.length; i++) { - if ((mixins = context.frames[i].find(this.selector, null, noArgumentsFilter)).length > 0) { - isOneFound = true; - // To make `default()` function independent of definition order we have two "subpasses" here. - // At first we evaluate each guard *twice* (with `default() == true` and `default() == false`), - // and build candidate list with corresponding flags. Then, when we know all possible matches, - // we make a final decision. - for (m = 0; m < mixins.length; m++) { - mixin = mixins[m].rule; - mixinPath = mixins[m].path; - isRecursive = false; - for (f = 0; f < context.frames.length; f++) { - if ((!(mixin instanceof Definition)) && mixin === (context.frames[f].originalRuleset || context.frames[f])) { - isRecursive = true; - break; - } - } - if (isRecursive) { - continue; - } - if (mixin.matchArgs(args, context)) { - candidate = { mixin: mixin, group: calcDefGroup(mixin, mixinPath) }; - if (candidate.group !== defFalseEitherCase) { - candidates.push(candidate); - } - match = true; - } - } - defaultFunc.reset(); - count = [0, 0, 0]; - for (m = 0; m < candidates.length; m++) { - count[candidates[m].group]++; - } - if (count[defNone] > 0) { - defaultResult = defFalse; - } - else { - defaultResult = defTrue; - if ((count[defTrue] + count[defFalse]) > 1) { - throw { type: 'Runtime', - message: "Ambiguous use of `default()` found when matching for `".concat(this.format(args), "`"), - index: this.getIndex(), filename: this.fileInfo().filename }; - } - } - for (m = 0; m < candidates.length; m++) { - candidate = candidates[m].group; - if ((candidate === defNone) || (candidate === defaultResult)) { - try { - mixin = candidates[m].mixin; - if (!(mixin instanceof Definition)) { - originalRuleset = mixin.originalRuleset || mixin; - mixin = new Definition('', [], mixin.rules, null, false, null, originalRuleset.visibilityInfo()); - mixin.originalRuleset = originalRuleset; - } - var newRules = mixin.evalCall(context, args, this.important).rules; - this._setVisibilityToReplacement(newRules); - Array.prototype.push.apply(rules, newRules); - } - catch (e) { - throw { message: e.message, index: this.getIndex(), filename: this.fileInfo().filename, stack: e.stack }; - } - } - } - if (match) { - return rules; - } - } - } - if (isOneFound) { - throw { type: 'Runtime', - message: "No matching definition was found for `".concat(this.format(args), "`"), - index: this.getIndex(), filename: this.fileInfo().filename }; - } - else { - throw { type: 'Name', - message: "".concat(this.selector.toCSS().trim(), " is undefined"), - index: this.getIndex(), filename: this.fileInfo().filename }; - } - }, - _setVisibilityToReplacement: function (replacement) { - var i, rule; - if (this.blocksVisibility()) { - for (i = 0; i < replacement.length; i++) { - rule = replacement[i]; - rule.addVisibilityBlock(); - } - } - }, - format: function (args) { - return "".concat(this.selector.toCSS().trim(), "(").concat(args ? args.map(function (a) { - var argValue = ''; - if (a.name) { - argValue += "".concat(a.name, ":"); - } - if (a.value.toCSS) { - argValue += a.value.toCSS(); - } - else { - argValue += '???'; - } - return argValue; - }).join(', ') : '', ")"); - } - }); - - var tree = { - Node: Node, - Color: Color, - AtRule: AtRule, - DetachedRuleset: DetachedRuleset, - Operation: Operation, - Dimension: Dimension, - Unit: Unit, - Keyword: Keyword, - Variable: Variable, - Property: Property, - Ruleset: Ruleset, - Element: Element, - Attribute: Attribute, - Combinator: Combinator, - Selector: Selector, - Quoted: Quoted, - Expression: Expression, - Declaration: Declaration, - Call: Call, - URL: URL, - Import: Import, - Comment: Comment, - Anonymous: Anonymous, - Value: Value, - JavaScript: JavaScript, - Assignment: Assignment, - Condition: Condition, - Paren: Paren, - Media: Media, - Container: Container, - QueryInParens: QueryInParens, - UnicodeDescriptor: UnicodeDescriptor, - Negative: Negative, - Extend: Extend, - VariableCall: VariableCall, - NamespaceValue: NamespaceValue, - mixin: { - Call: MixinCall, - Definition: Definition - } - }; - - var AbstractFileManager = /** @class */ (function () { - function AbstractFileManager() { - } - AbstractFileManager.prototype.getPath = function (filename) { - var j = filename.lastIndexOf('?'); - if (j > 0) { - filename = filename.slice(0, j); - } - j = filename.lastIndexOf('/'); - if (j < 0) { - j = filename.lastIndexOf('\\'); - } - if (j < 0) { - return ''; - } - return filename.slice(0, j + 1); - }; - AbstractFileManager.prototype.tryAppendExtension = function (path, ext) { - return /(\.[a-z]*$)|([?;].*)$/.test(path) ? path : path + ext; - }; - AbstractFileManager.prototype.tryAppendLessExtension = function (path) { - return this.tryAppendExtension(path, '.less'); - }; - AbstractFileManager.prototype.supportsSync = function () { - return false; - }; - AbstractFileManager.prototype.alwaysMakePathsAbsolute = function () { - return false; - }; - AbstractFileManager.prototype.isPathAbsolute = function (filename) { - return (/^(?:[a-z-]+:|\/|\\|#)/i).test(filename); - }; - // TODO: pull out / replace? - AbstractFileManager.prototype.join = function (basePath, laterPath) { - if (!basePath) { - return laterPath; - } - return basePath + laterPath; - }; - AbstractFileManager.prototype.pathDiff = function (url, baseUrl) { - // diff between two paths to create a relative path - var urlParts = this.extractUrlParts(url); - var baseUrlParts = this.extractUrlParts(baseUrl); - var i; - var max; - var urlDirectories; - var baseUrlDirectories; - var diff = ''; - if (urlParts.hostPart !== baseUrlParts.hostPart) { - return ''; - } - max = Math.max(baseUrlParts.directories.length, urlParts.directories.length); - for (i = 0; i < max; i++) { - if (baseUrlParts.directories[i] !== urlParts.directories[i]) { - break; - } - } - baseUrlDirectories = baseUrlParts.directories.slice(i); - urlDirectories = urlParts.directories.slice(i); - for (i = 0; i < baseUrlDirectories.length - 1; i++) { - diff += '../'; - } - for (i = 0; i < urlDirectories.length - 1; i++) { - diff += "".concat(urlDirectories[i], "/"); - } - return diff; - }; - /** - * Helper function, not part of API. - * This should be replaceable by newer Node / Browser APIs - * - * @param {string} url - * @param {string} baseUrl - */ - AbstractFileManager.prototype.extractUrlParts = function (url, baseUrl) { - // urlParts[1] = protocol://hostname/ OR / - // urlParts[2] = / if path relative to host base - // urlParts[3] = directories - // urlParts[4] = filename - // urlParts[5] = parameters - var urlPartsRegex = /^((?:[a-z-]+:)?\/{2}(?:[^/?#]*\/)|([/\\]))?((?:[^/\\?#]*[/\\])*)([^/\\?#]*)([#?].*)?$/i; - var urlParts = url.match(urlPartsRegex); - var returner = {}; - var rawDirectories = []; - var directories = []; - var i; - var baseUrlParts; - if (!urlParts) { - throw new Error("Could not parse sheet href - '".concat(url, "'")); - } - // Stylesheets in IE don't always return the full path - if (baseUrl && (!urlParts[1] || urlParts[2])) { - baseUrlParts = baseUrl.match(urlPartsRegex); - if (!baseUrlParts) { - throw new Error("Could not parse page url - '".concat(baseUrl, "'")); - } - urlParts[1] = urlParts[1] || baseUrlParts[1] || ''; - if (!urlParts[2]) { - urlParts[3] = baseUrlParts[3] + urlParts[3]; - } - } - if (urlParts[3]) { - rawDirectories = urlParts[3].replace(/\\/g, '/').split('/'); - // collapse '..' and skip '.' - for (i = 0; i < rawDirectories.length; i++) { - if (rawDirectories[i] === '..') { - directories.pop(); - } - else if (rawDirectories[i] !== '.') { - directories.push(rawDirectories[i]); - } - } - } - returner.hostPart = urlParts[1]; - returner.directories = directories; - returner.rawPath = (urlParts[1] || '') + rawDirectories.join('/'); - returner.path = (urlParts[1] || '') + directories.join('/'); - returner.filename = urlParts[4]; - returner.fileUrl = returner.path + (urlParts[4] || ''); - returner.url = returner.fileUrl + (urlParts[5] || ''); - return returner; - }; - return AbstractFileManager; - }()); - - var AbstractPluginLoader = /** @class */ (function () { - function AbstractPluginLoader() { - // Implemented by Node.js plugin loader - this.require = function () { - return null; - }; - } - AbstractPluginLoader.prototype.evalPlugin = function (contents, context, imports, pluginOptions, fileInfo) { - var loader, registry, pluginObj, localModule, pluginManager, filename, result; - pluginManager = context.pluginManager; - if (fileInfo) { - if (typeof fileInfo === 'string') { - filename = fileInfo; - } - else { - filename = fileInfo.filename; - } - } - var shortname = (new this.less.FileManager()).extractUrlParts(filename).filename; - if (filename) { - pluginObj = pluginManager.get(filename); - if (pluginObj) { - result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - if (result) { - return result; - } - try { - if (pluginObj.use) { - pluginObj.use.call(this.context, pluginObj); - } - } - catch (e) { - e.message = e.message || 'Error during @plugin call'; - return new LessError(e, imports, filename); - } - return pluginObj; - } - } - localModule = { - exports: {}, - pluginManager: pluginManager, - fileInfo: fileInfo - }; - registry = functionRegistry.create(); - var registerPlugin = function (obj) { - pluginObj = obj; - }; - try { - loader = new Function('module', 'require', 'registerPlugin', 'functions', 'tree', 'less', 'fileInfo', contents); - loader(localModule, this.require(filename), registerPlugin, registry, this.less.tree, this.less, fileInfo); - } - catch (e) { - return new LessError(e, imports, filename); - } - if (!pluginObj) { - pluginObj = localModule.exports; - } - pluginObj = this.validatePlugin(pluginObj, filename, shortname); - if (pluginObj instanceof LessError) { - return pluginObj; - } - if (pluginObj) { - pluginObj.imports = imports; - pluginObj.filename = filename; - // For < 3.x (or unspecified minVersion) - setOptions() before install() - if (!pluginObj.minVersion || this.compareVersion('3.0.0', pluginObj.minVersion) < 0) { - result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - if (result) { - return result; - } - } - // Run on first load - pluginManager.addPlugin(pluginObj, fileInfo.filename, registry); - pluginObj.functions = registry.getLocalFunctions(); - // Need to call setOptions again because the pluginObj might have functions - result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - if (result) { - return result; - } - // Run every @plugin call - try { - if (pluginObj.use) { - pluginObj.use.call(this.context, pluginObj); - } - } - catch (e) { - e.message = e.message || 'Error during @plugin call'; - return new LessError(e, imports, filename); - } - } - else { - return new LessError({ message: 'Not a valid plugin' }, imports, filename); - } - return pluginObj; - }; - AbstractPluginLoader.prototype.trySetOptions = function (plugin, filename, name, options) { - if (options && !plugin.setOptions) { - return new LessError({ - message: "Options have been provided but the plugin ".concat(name, " does not support any options.") - }); - } - try { - plugin.setOptions && plugin.setOptions(options); - } - catch (e) { - return new LessError(e); - } - }; - AbstractPluginLoader.prototype.validatePlugin = function (plugin, filename, name) { - if (plugin) { - // support plugins being a function - // so that the plugin can be more usable programmatically - if (typeof plugin === 'function') { - plugin = new plugin(); - } - if (plugin.minVersion) { - if (this.compareVersion(plugin.minVersion, this.less.version) < 0) { - return new LessError({ - message: "Plugin ".concat(name, " requires version ").concat(this.versionToString(plugin.minVersion)) - }); - } - } - return plugin; - } - return null; - }; - AbstractPluginLoader.prototype.compareVersion = function (aVersion, bVersion) { - if (typeof aVersion === 'string') { - aVersion = aVersion.match(/^(\d+)\.?(\d+)?\.?(\d+)?/); - aVersion.shift(); - } - for (var i_1 = 0; i_1 < aVersion.length; i_1++) { - if (aVersion[i_1] !== bVersion[i_1]) { - return parseInt(aVersion[i_1]) > parseInt(bVersion[i_1]) ? -1 : 1; - } - } - return 0; - }; - AbstractPluginLoader.prototype.versionToString = function (version) { - var versionString = ''; - for (var i_2 = 0; i_2 < version.length; i_2++) { - versionString += (versionString ? '.' : '') + version[i_2]; - } - return versionString; - }; - AbstractPluginLoader.prototype.printUsage = function (plugins) { - for (var i_3 = 0; i_3 < plugins.length; i_3++) { - var plugin = plugins[i_3]; - if (plugin.printUsage) { - plugin.printUsage(); - } - } - }; - return AbstractPluginLoader; - }()); - - function boolean(condition) { - return condition ? Keyword.True : Keyword.False; - } - /** - * Functions with evalArgs set to false are sent context - * as the first argument. - */ - function If(context, condition, trueValue, falseValue) { - return condition.eval(context) ? trueValue.eval(context) - : (falseValue ? falseValue.eval(context) : new Anonymous); - } - If.evalArgs = false; - function isdefined(context, variable) { - try { - variable.eval(context); - return Keyword.True; - } - catch (e) { - return Keyword.False; - } - } - isdefined.evalArgs = false; - var boolean$1 = { isdefined: isdefined, boolean: boolean, 'if': If }; - - var colorFunctions; - function clamp(val) { - return Math.min(1, Math.max(0, val)); - } - function hsla(origColor, hsl) { - var color = colorFunctions.hsla(hsl.h, hsl.s, hsl.l, hsl.a); - if (color) { - if (origColor.value && - /^(rgb|hsl)/.test(origColor.value)) { - color.value = origColor.value; - } - else { - color.value = 'rgb'; - } - return color; - } - } - function toHSL(color) { - if (color.toHSL) { - return color.toHSL(); - } - else { - throw new Error('Argument cannot be evaluated to a color'); - } - } - function toHSV(color) { - if (color.toHSV) { - return color.toHSV(); - } - else { - throw new Error('Argument cannot be evaluated to a color'); - } - } - function number$1(n) { - if (n instanceof Dimension) { - return parseFloat(n.unit.is('%') ? n.value / 100 : n.value); - } - else if (typeof n === 'number') { - return n; - } - else { - throw { - type: 'Argument', - message: 'color functions take numbers as parameters' - }; - } - } - function scaled(n, size) { - if (n instanceof Dimension && n.unit.is('%')) { - return parseFloat(n.value * size / 100); - } - else { - return number$1(n); - } - } - colorFunctions = { - rgb: function (r, g, b) { - var a = 1; - /** - * Comma-less syntax - * e.g. rgb(0 128 255 / 50%) - */ - if (r instanceof Expression) { - var val = r.value; - r = val[0]; - g = val[1]; - b = val[2]; - /** - * @todo - should this be normalized in - * function caller? Or parsed differently? - */ - if (b instanceof Operation) { - var op = b; - b = op.operands[0]; - a = op.operands[1]; - } - } - var color = colorFunctions.rgba(r, g, b, a); - if (color) { - color.value = 'rgb'; - return color; - } - }, - rgba: function (r, g, b, a) { - try { - if (r instanceof Color) { - if (g) { - a = number$1(g); - } - else { - a = r.alpha; - } - return new Color(r.rgb, a, 'rgba'); - } - var rgb = [r, g, b].map(function (c) { return scaled(c, 255); }); - a = number$1(a); - return new Color(rgb, a, 'rgba'); - } - catch (e) { } - }, - hsl: function (h, s, l) { - var a = 1; - if (h instanceof Expression) { - var val = h.value; - h = val[0]; - s = val[1]; - l = val[2]; - if (l instanceof Operation) { - var op = l; - l = op.operands[0]; - a = op.operands[1]; - } - } - var color = colorFunctions.hsla(h, s, l, a); - if (color) { - color.value = 'hsl'; - return color; - } - }, - hsla: function (h, s, l, a) { - var m1; - var m2; - function hue(h) { - h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h); - if (h * 6 < 1) { - return m1 + (m2 - m1) * h * 6; - } - else if (h * 2 < 1) { - return m2; - } - else if (h * 3 < 2) { - return m1 + (m2 - m1) * (2 / 3 - h) * 6; - } - else { - return m1; - } - } - try { - if (h instanceof Color) { - if (s) { - a = number$1(s); - } - else { - a = h.alpha; - } - return new Color(h.rgb, a, 'hsla'); - } - h = (number$1(h) % 360) / 360; - s = clamp(number$1(s)); - l = clamp(number$1(l)); - a = clamp(number$1(a)); - m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s; - m1 = l * 2 - m2; - var rgb = [ - hue(h + 1 / 3) * 255, - hue(h) * 255, - hue(h - 1 / 3) * 255 - ]; - a = number$1(a); - return new Color(rgb, a, 'hsla'); - } - catch (e) { } - }, - hsv: function (h, s, v) { - return colorFunctions.hsva(h, s, v, 1.0); - }, - hsva: function (h, s, v, a) { - h = ((number$1(h) % 360) / 360) * 360; - s = number$1(s); - v = number$1(v); - a = number$1(a); - var i; - var f; - i = Math.floor((h / 60) % 6); - f = (h / 60) - i; - var vs = [v, - v * (1 - s), - v * (1 - f * s), - v * (1 - (1 - f) * s)]; - var perm = [[0, 3, 1], - [2, 0, 1], - [1, 0, 3], - [1, 2, 0], - [3, 1, 0], - [0, 1, 2]]; - return colorFunctions.rgba(vs[perm[i][0]] * 255, vs[perm[i][1]] * 255, vs[perm[i][2]] * 255, a); - }, - hue: function (color) { - return new Dimension(toHSL(color).h); - }, - saturation: function (color) { - return new Dimension(toHSL(color).s * 100, '%'); - }, - lightness: function (color) { - return new Dimension(toHSL(color).l * 100, '%'); - }, - hsvhue: function (color) { - return new Dimension(toHSV(color).h); - }, - hsvsaturation: function (color) { - return new Dimension(toHSV(color).s * 100, '%'); - }, - hsvvalue: function (color) { - return new Dimension(toHSV(color).v * 100, '%'); - }, - red: function (color) { - return new Dimension(color.rgb[0]); - }, - green: function (color) { - return new Dimension(color.rgb[1]); - }, - blue: function (color) { - return new Dimension(color.rgb[2]); - }, - alpha: function (color) { - return new Dimension(toHSL(color).a); - }, - luma: function (color) { - return new Dimension(color.luma() * color.alpha * 100, '%'); - }, - luminance: function (color) { - var luminance = (0.2126 * color.rgb[0] / 255) + - (0.7152 * color.rgb[1] / 255) + - (0.0722 * color.rgb[2] / 255); - return new Dimension(luminance * color.alpha * 100, '%'); - }, - saturate: function (color, amount, method) { - // filter: saturate(3.2); - // should be kept as is, so check for color - if (!color.rgb) { - return null; - } - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.s += hsl.s * amount.value / 100; - } - else { - hsl.s += amount.value / 100; - } - hsl.s = clamp(hsl.s); - return hsla(color, hsl); - }, - desaturate: function (color, amount, method) { - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.s -= hsl.s * amount.value / 100; - } - else { - hsl.s -= amount.value / 100; - } - hsl.s = clamp(hsl.s); - return hsla(color, hsl); - }, - lighten: function (color, amount, method) { - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.l += hsl.l * amount.value / 100; - } - else { - hsl.l += amount.value / 100; - } - hsl.l = clamp(hsl.l); - return hsla(color, hsl); - }, - darken: function (color, amount, method) { - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.l -= hsl.l * amount.value / 100; - } - else { - hsl.l -= amount.value / 100; - } - hsl.l = clamp(hsl.l); - return hsla(color, hsl); - }, - fadein: function (color, amount, method) { - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.a += hsl.a * amount.value / 100; - } - else { - hsl.a += amount.value / 100; - } - hsl.a = clamp(hsl.a); - return hsla(color, hsl); - }, - fadeout: function (color, amount, method) { - var hsl = toHSL(color); - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.a -= hsl.a * amount.value / 100; - } - else { - hsl.a -= amount.value / 100; - } - hsl.a = clamp(hsl.a); - return hsla(color, hsl); - }, - fade: function (color, amount) { - var hsl = toHSL(color); - hsl.a = amount.value / 100; - hsl.a = clamp(hsl.a); - return hsla(color, hsl); - }, - spin: function (color, amount) { - var hsl = toHSL(color); - var hue = (hsl.h + amount.value) % 360; - hsl.h = hue < 0 ? 360 + hue : hue; - return hsla(color, hsl); - }, - // - // Copyright (c) 2006-2009 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein - // http://sass-lang.com - // - mix: function (color1, color2, weight) { - if (!weight) { - weight = new Dimension(50); - } - var p = weight.value / 100.0; - var w = p * 2 - 1; - var a = toHSL(color1).a - toHSL(color2).a; - var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0; - var w2 = 1 - w1; - var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2, - color1.rgb[1] * w1 + color2.rgb[1] * w2, - color1.rgb[2] * w1 + color2.rgb[2] * w2]; - var alpha = color1.alpha * p + color2.alpha * (1 - p); - return new Color(rgb, alpha); - }, - greyscale: function (color) { - return colorFunctions.desaturate(color, new Dimension(100)); - }, - contrast: function (color, dark, light, threshold) { - // filter: contrast(3.2); - // should be kept as is, so check for color - if (!color.rgb) { - return null; - } - if (typeof light === 'undefined') { - light = colorFunctions.rgba(255, 255, 255, 1.0); - } - if (typeof dark === 'undefined') { - dark = colorFunctions.rgba(0, 0, 0, 1.0); - } - // Figure out which is actually light and dark: - if (dark.luma() > light.luma()) { - var t = light; - light = dark; - dark = t; - } - if (typeof threshold === 'undefined') { - threshold = 0.43; - } - else { - threshold = number$1(threshold); - } - if (color.luma() < threshold) { - return light; - } - else { - return dark; - } - }, - // Changes made in 2.7.0 - Reverted in 3.0.0 - // contrast: function (color, color1, color2, threshold) { - // // Return which of `color1` and `color2` has the greatest contrast with `color` - // // according to the standard WCAG contrast ratio calculation. - // // http://www.w3.org/TR/WCAG20/#contrast-ratiodef - // // The threshold param is no longer used, in line with SASS. - // // filter: contrast(3.2); - // // should be kept as is, so check for color - // if (!color.rgb) { - // return null; - // } - // if (typeof color1 === 'undefined') { - // color1 = colorFunctions.rgba(0, 0, 0, 1.0); - // } - // if (typeof color2 === 'undefined') { - // color2 = colorFunctions.rgba(255, 255, 255, 1.0); - // } - // var contrast1, contrast2; - // var luma = color.luma(); - // var luma1 = color1.luma(); - // var luma2 = color2.luma(); - // // Calculate contrast ratios for each color - // if (luma > luma1) { - // contrast1 = (luma + 0.05) / (luma1 + 0.05); - // } else { - // contrast1 = (luma1 + 0.05) / (luma + 0.05); - // } - // if (luma > luma2) { - // contrast2 = (luma + 0.05) / (luma2 + 0.05); - // } else { - // contrast2 = (luma2 + 0.05) / (luma + 0.05); - // } - // if (contrast1 > contrast2) { - // return color1; - // } else { - // return color2; - // } - // }, - argb: function (color) { - return new Anonymous(color.toARGB()); - }, - color: function (c) { - if ((c instanceof Quoted) && - (/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})$/i.test(c.value))) { - var val = c.value.slice(1); - return new Color(val, undefined, "#".concat(val)); - } - if ((c instanceof Color) || (c = Color.fromKeyword(c.value))) { - c.value = undefined; - return c; - } - throw { - type: 'Argument', - message: 'argument must be a color keyword or 3|4|6|8 digit hex e.g. #FFF' - }; - }, - tint: function (color, amount) { - return colorFunctions.mix(colorFunctions.rgb(255, 255, 255), color, amount); - }, - shade: function (color, amount) { - return colorFunctions.mix(colorFunctions.rgb(0, 0, 0), color, amount); - } - }; - var color = colorFunctions; - - // Color Blending - // ref: http://www.w3.org/TR/compositing-1 - function colorBlend(mode, color1, color2) { - var ab = color1.alpha; // result - var // backdrop - cb; - var as = color2.alpha; - var // source - cs; - var ar; - var cr; - var r = []; - ar = as + ab * (1 - as); - for (var i_1 = 0; i_1 < 3; i_1++) { - cb = color1.rgb[i_1] / 255; - cs = color2.rgb[i_1] / 255; - cr = mode(cb, cs); - if (ar) { - cr = (as * cs + ab * (cb - - as * (cb + cs - cr))) / ar; - } - r[i_1] = cr * 255; - } - return new Color(r, ar); - } - var colorBlendModeFunctions = { - multiply: function (cb, cs) { - return cb * cs; - }, - screen: function (cb, cs) { - return cb + cs - cb * cs; - }, - overlay: function (cb, cs) { - cb *= 2; - return (cb <= 1) ? - colorBlendModeFunctions.multiply(cb, cs) : - colorBlendModeFunctions.screen(cb - 1, cs); - }, - softlight: function (cb, cs) { - var d = 1; - var e = cb; - if (cs > 0.5) { - e = 1; - d = (cb > 0.25) ? Math.sqrt(cb) - : ((16 * cb - 12) * cb + 4) * cb; - } - return cb - (1 - 2 * cs) * e * (d - cb); - }, - hardlight: function (cb, cs) { - return colorBlendModeFunctions.overlay(cs, cb); - }, - difference: function (cb, cs) { - return Math.abs(cb - cs); - }, - exclusion: function (cb, cs) { - return cb + cs - 2 * cb * cs; - }, - // non-w3c functions: - average: function (cb, cs) { - return (cb + cs) / 2; - }, - negation: function (cb, cs) { - return 1 - Math.abs(cb + cs - 1); - } - }; - for (var f$1 in colorBlendModeFunctions) { - // eslint-disable-next-line no-prototype-builtins - if (colorBlendModeFunctions.hasOwnProperty(f$1)) { - colorBlend[f$1] = colorBlend.bind(null, colorBlendModeFunctions[f$1]); - } - } - - var dataUri = (function (environment) { - var fallback = function (functionThis, node) { return new URL(node, functionThis.index, functionThis.currentFileInfo).eval(functionThis.context); }; - return { 'data-uri': function (mimetypeNode, filePathNode) { - if (!filePathNode) { - filePathNode = mimetypeNode; - mimetypeNode = null; - } - var mimetype = mimetypeNode && mimetypeNode.value; - var filePath = filePathNode.value; - var currentFileInfo = this.currentFileInfo; - var currentDirectory = currentFileInfo.rewriteUrls ? - currentFileInfo.currentDirectory : currentFileInfo.entryPath; - var fragmentStart = filePath.indexOf('#'); - var fragment = ''; - if (fragmentStart !== -1) { - fragment = filePath.slice(fragmentStart); - filePath = filePath.slice(0, fragmentStart); - } - var context = clone(this.context); - context.rawBuffer = true; - var fileManager = environment.getFileManager(filePath, currentDirectory, context, environment, true); - if (!fileManager) { - return fallback(this, filePathNode); - } - var useBase64 = false; - // detect the mimetype if not given - if (!mimetypeNode) { - mimetype = environment.mimeLookup(filePath); - if (mimetype === 'image/svg+xml') { - useBase64 = false; - } - else { - // use base 64 unless it's an ASCII or UTF-8 format - var charset = environment.charsetLookup(mimetype); - useBase64 = ['US-ASCII', 'UTF-8'].indexOf(charset) < 0; - } - if (useBase64) { - mimetype += ';base64'; - } - } - else { - useBase64 = /;base64$/.test(mimetype); - } - var fileSync = fileManager.loadFileSync(filePath, currentDirectory, context, environment); - if (!fileSync.contents) { - logger$1.warn("Skipped data-uri embedding of ".concat(filePath, " because file not found")); - return fallback(this, filePathNode || mimetypeNode); - } - var buf = fileSync.contents; - if (useBase64 && !environment.encodeBase64) { - return fallback(this, filePathNode); - } - buf = useBase64 ? environment.encodeBase64(buf) : encodeURIComponent(buf); - var uri = "data:".concat(mimetype, ",").concat(buf).concat(fragment); - return new URL(new Quoted("\"".concat(uri, "\""), uri, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo); - } }; - }); - - var getItemsFromNode = function (node) { - // handle non-array values as an array of length 1 - // return 'undefined' if index is invalid - var items = Array.isArray(node.value) ? - node.value : Array(node); - return items; - }; - var list = { - _SELF: function (n) { - return n; - }, - '~': function () { - var expr = []; - for (var _i = 0; _i < arguments.length; _i++) { - expr[_i] = arguments[_i]; - } - if (expr.length === 1) { - return expr[0]; - } - return new Value(expr); - }, - extract: function (values, index) { - // (1-based index) - index = index.value - 1; - return getItemsFromNode(values)[index]; - }, - length: function (values) { - return new Dimension(getItemsFromNode(values).length); - }, - /** - * Creates a Less list of incremental values. - * Modeled after Lodash's range function, also exists natively in PHP - * - * @param {Dimension} [start=1] - * @param {Dimension} end - e.g. 10 or 10px - unit is added to output - * @param {Dimension} [step=1] - */ - range: function (start, end, step) { - var from; - var to; - var stepValue = 1; - var list = []; - if (end) { - to = end; - from = start.value; - if (step) { - stepValue = step.value; - } - } - else { - from = 1; - to = start; - } - for (var i_1 = from; i_1 <= to.value; i_1 += stepValue) { - list.push(new Dimension(i_1, to.unit)); - } - return new Expression(list); - }, - each: function (list, rs) { - var _this = this; - var rules = []; - var newRules; - var iterator; - var tryEval = function (val) { - if (val instanceof Node) { - return val.eval(_this.context); - } - return val; - }; - if (list.value && !(list instanceof Quoted)) { - if (Array.isArray(list.value)) { - iterator = list.value.map(tryEval); - } - else { - iterator = [tryEval(list.value)]; - } - } - else if (list.ruleset) { - iterator = tryEval(list.ruleset).rules; - } - else if (list.rules) { - iterator = list.rules.map(tryEval); - } - else if (Array.isArray(list)) { - iterator = list.map(tryEval); - } - else { - iterator = [tryEval(list)]; - } - var valueName = '@value'; - var keyName = '@key'; - var indexName = '@index'; - if (rs.params) { - valueName = rs.params[0] && rs.params[0].name; - keyName = rs.params[1] && rs.params[1].name; - indexName = rs.params[2] && rs.params[2].name; - rs = rs.rules; - } - else { - rs = rs.ruleset; - } - for (var i_2 = 0; i_2 < iterator.length; i_2++) { - var key = void 0; - var value = void 0; - var item = iterator[i_2]; - if (item instanceof Declaration) { - key = typeof item.name === 'string' ? item.name : item.name[0].value; - value = item.value; - } - else { - key = new Dimension(i_2 + 1); - value = item; - } - if (item instanceof Comment) { - continue; - } - newRules = rs.rules.slice(0); - if (valueName) { - newRules.push(new Declaration(valueName, value, false, false, this.index, this.currentFileInfo)); - } - if (indexName) { - newRules.push(new Declaration(indexName, new Dimension(i_2 + 1), false, false, this.index, this.currentFileInfo)); - } - if (keyName) { - newRules.push(new Declaration(keyName, key, false, false, this.index, this.currentFileInfo)); - } - rules.push(new Ruleset([new (Selector)([new Element('', '&')])], newRules, rs.strictImports, rs.visibilityInfo())); - } - return new Ruleset([new (Selector)([new Element('', '&')])], rules, rs.strictImports, rs.visibilityInfo()).eval(this.context); - } - }; - - var MathHelper = function (fn, unit, n) { - if (!(n instanceof Dimension)) { - throw { type: 'Argument', message: 'argument must be a number' }; - } - if (unit === null) { - unit = n.unit; - } - else { - n = n.unify(); - } - return new Dimension(fn(parseFloat(n.value)), unit); - }; - - var mathFunctions = { - // name, unit - ceil: null, - floor: null, - sqrt: null, - abs: null, - tan: '', - sin: '', - cos: '', - atan: 'rad', - asin: 'rad', - acos: 'rad' - }; - for (var f in mathFunctions) { - // eslint-disable-next-line no-prototype-builtins - if (mathFunctions.hasOwnProperty(f)) { - mathFunctions[f] = MathHelper.bind(null, Math[f], mathFunctions[f]); - } - } - mathFunctions.round = function (n, f) { - var fraction = typeof f === 'undefined' ? 0 : f.value; - return MathHelper(function (num) { return num.toFixed(fraction); }, null, n); - }; - - var minMax = function (isMin, args) { - var _this = this; - args = Array.prototype.slice.call(args); - switch (args.length) { - case 0: throw { type: 'Argument', message: 'one or more arguments required' }; - } - var i; // key is the unit.toString() for unified Dimension values, - var j; - var current; - var currentUnified; - var referenceUnified; - var unit; - var unitStatic; - var unitClone; - var // elems only contains original argument values. - order = []; - var values = {}; - // value is the index into the order array. - for (i = 0; i < args.length; i++) { - current = args[i]; - if (!(current instanceof Dimension)) { - if (Array.isArray(args[i].value)) { - Array.prototype.push.apply(args, Array.prototype.slice.call(args[i].value)); - continue; - } - else { - throw { type: 'Argument', message: 'incompatible types' }; - } - } - currentUnified = current.unit.toString() === '' && unitClone !== undefined ? new Dimension(current.value, unitClone).unify() : current.unify(); - unit = currentUnified.unit.toString() === '' && unitStatic !== undefined ? unitStatic : currentUnified.unit.toString(); - unitStatic = unit !== '' && unitStatic === undefined || unit !== '' && order[0].unify().unit.toString() === '' ? unit : unitStatic; - unitClone = unit !== '' && unitClone === undefined ? current.unit.toString() : unitClone; - j = values[''] !== undefined && unit !== '' && unit === unitStatic ? values[''] : values[unit]; - if (j === undefined) { - if (unitStatic !== undefined && unit !== unitStatic) { - throw { type: 'Argument', message: 'incompatible types' }; - } - values[unit] = order.length; - order.push(current); - continue; - } - referenceUnified = order[j].unit.toString() === '' && unitClone !== undefined ? new Dimension(order[j].value, unitClone).unify() : order[j].unify(); - if (isMin && currentUnified.value < referenceUnified.value || - !isMin && currentUnified.value > referenceUnified.value) { - order[j] = current; - } - } - if (order.length == 1) { - return order[0]; - } - args = order.map(function (a) { return a.toCSS(_this.context); }).join(this.context.compress ? ',' : ', '); - return new Anonymous("".concat(isMin ? 'min' : 'max', "(").concat(args, ")")); - }; - var number = { - min: function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - try { - return minMax.call(this, true, args); - } - catch (e) { } - }, - max: function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - try { - return minMax.call(this, false, args); - } - catch (e) { } - }, - convert: function (val, unit) { - return val.convertTo(unit.value); - }, - pi: function () { - return new Dimension(Math.PI); - }, - mod: function (a, b) { - return new Dimension(a.value % b.value, a.unit); - }, - pow: function (x, y) { - if (typeof x === 'number' && typeof y === 'number') { - x = new Dimension(x); - y = new Dimension(y); - } - else if (!(x instanceof Dimension) || !(y instanceof Dimension)) { - throw { type: 'Argument', message: 'arguments must be numbers' }; - } - return new Dimension(Math.pow(x.value, y.value), x.unit); - }, - percentage: function (n) { - var result = MathHelper(function (num) { return num * 100; }, '%', n); - return result; - } - }; - - var string = { - e: function (str) { - return new Quoted('"', str instanceof JavaScript ? str.evaluated : str.value, true); - }, - escape: function (str) { - return new Anonymous(encodeURI(str.value).replace(/=/g, '%3D').replace(/:/g, '%3A').replace(/#/g, '%23').replace(/;/g, '%3B') - .replace(/\(/g, '%28').replace(/\)/g, '%29')); - }, - replace: function (string, pattern, replacement, flags) { - var result = string.value; - replacement = (replacement.type === 'Quoted') ? - replacement.value : replacement.toCSS(); - result = result.replace(new RegExp(pattern.value, flags ? flags.value : ''), replacement); - return new Quoted(string.quote || '', result, string.escaped); - }, - '%': function (string /* arg, arg, ... */) { - var args = Array.prototype.slice.call(arguments, 1); - var result = string.value; - var _loop_1 = function (i_1) { - /* jshint loopfunc:true */ - result = result.replace(/%[sda]/i, function (token) { - var value = ((args[i_1].type === 'Quoted') && - token.match(/s/i)) ? args[i_1].value : args[i_1].toCSS(); - return token.match(/[A-Z]$/) ? encodeURIComponent(value) : value; - }); - }; - for (var i_1 = 0; i_1 < args.length; i_1++) { - _loop_1(i_1); - } - result = result.replace(/%%/g, '%'); - return new Quoted(string.quote || '', result, string.escaped); - } - }; - - var svg = (function () { - return { 'svg-gradient': function (direction) { - var stops; - var gradientDirectionSvg; - var gradientType = 'linear'; - var rectangleDimension = 'x="0" y="0" width="1" height="1"'; - var renderEnv = { compress: false }; - var returner; - var directionValue = direction.toCSS(renderEnv); - var i; - var color; - var position; - var positionValue; - var alpha; - function throwArgumentDescriptor() { - throw { type: 'Argument', - message: 'svg-gradient expects direction, start_color [start_position], [color position,]...,' + - ' end_color [end_position] or direction, color list' }; - } - if (arguments.length == 2) { - if (arguments[1].value.length < 2) { - throwArgumentDescriptor(); - } - stops = arguments[1].value; - } - else if (arguments.length < 3) { - throwArgumentDescriptor(); - } - else { - stops = Array.prototype.slice.call(arguments, 1); - } - switch (directionValue) { - case 'to bottom': - gradientDirectionSvg = 'x1="0%" y1="0%" x2="0%" y2="100%"'; - break; - case 'to right': - gradientDirectionSvg = 'x1="0%" y1="0%" x2="100%" y2="0%"'; - break; - case 'to bottom right': - gradientDirectionSvg = 'x1="0%" y1="0%" x2="100%" y2="100%"'; - break; - case 'to top right': - gradientDirectionSvg = 'x1="0%" y1="100%" x2="100%" y2="0%"'; - break; - case 'ellipse': - case 'ellipse at center': - gradientType = 'radial'; - gradientDirectionSvg = 'cx="50%" cy="50%" r="75%"'; - rectangleDimension = 'x="-50" y="-50" width="101" height="101"'; - break; - default: - throw { type: 'Argument', message: 'svg-gradient direction must be \'to bottom\', \'to right\',' + - ' \'to bottom right\', \'to top right\' or \'ellipse at center\'' }; - } - returner = "<".concat(gradientType, "Gradient id=\"g\" ").concat(gradientDirectionSvg, ">"); - for (i = 0; i < stops.length; i += 1) { - if (stops[i] instanceof Expression) { - color = stops[i].value[0]; - position = stops[i].value[1]; - } - else { - color = stops[i]; - position = undefined; - } - if (!(color instanceof Color) || (!((i === 0 || i + 1 === stops.length) && position === undefined) && !(position instanceof Dimension))) { - throwArgumentDescriptor(); - } - positionValue = position ? position.toCSS(renderEnv) : i === 0 ? '0%' : '100%'; - alpha = color.alpha; - returner += ""); - } - returner += ""); - returner = encodeURIComponent(returner); - returner = "data:image/svg+xml,".concat(returner); - return new URL(new Quoted("'".concat(returner, "'"), returner, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo); - } }; - }); - - var isa = function (n, Type) { return (n instanceof Type) ? Keyword.True : Keyword.False; }; - var isunit = function (n, unit) { - if (unit === undefined) { - throw { type: 'Argument', message: 'missing the required second argument to isunit.' }; - } - unit = typeof unit.value === 'string' ? unit.value : unit; - if (typeof unit !== 'string') { - throw { type: 'Argument', message: 'Second argument to isunit should be a unit or a string.' }; - } - return (n instanceof Dimension) && n.unit.is(unit) ? Keyword.True : Keyword.False; - }; - var types = { - isruleset: function (n) { - return isa(n, DetachedRuleset); - }, - iscolor: function (n) { - return isa(n, Color); - }, - isnumber: function (n) { - return isa(n, Dimension); - }, - isstring: function (n) { - return isa(n, Quoted); - }, - iskeyword: function (n) { - return isa(n, Keyword); - }, - isurl: function (n) { - return isa(n, URL); - }, - ispixel: function (n) { - return isunit(n, 'px'); - }, - ispercentage: function (n) { - return isunit(n, '%'); - }, - isem: function (n) { - return isunit(n, 'em'); - }, - isunit: isunit, - unit: function (val, unit) { - if (!(val instanceof Dimension)) { - throw { type: 'Argument', - message: "the first argument to unit must be a number".concat(val instanceof Operation ? '. Have you forgotten parenthesis?' : '') }; - } - if (unit) { - if (unit instanceof Keyword) { - unit = unit.value; - } - else { - unit = unit.toCSS(); - } - } - else { - unit = ''; - } - return new Dimension(val.value, unit); - }, - 'get-unit': function (n) { - return new Anonymous(n.unit); - } - }; - - var styleExpression = function (args) { - var _this = this; - args = Array.prototype.slice.call(args); - switch (args.length) { - case 0: throw { type: 'Argument', message: 'one or more arguments required' }; - } - var entityList = [new Variable(args[0].value, this.index, this.currentFileInfo).eval(this.context)]; - args = entityList.map(function (a) { return a.toCSS(_this.context); }).join(this.context.compress ? ',' : ', '); - return new Variable("style(".concat(args, ")")); - }; - var style$1 = { - style: function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - try { - return styleExpression.call(this, args); - } - catch (e) { } - }, - }; - - var functions = (function (environment) { - var functions = { functionRegistry: functionRegistry, functionCaller: functionCaller }; - // register functions - functionRegistry.addMultiple(boolean$1); - functionRegistry.add('default', defaultFunc.eval.bind(defaultFunc)); - functionRegistry.addMultiple(color); - functionRegistry.addMultiple(colorBlend); - functionRegistry.addMultiple(dataUri(environment)); - functionRegistry.addMultiple(list); - functionRegistry.addMultiple(mathFunctions); - functionRegistry.addMultiple(number); - functionRegistry.addMultiple(string); - functionRegistry.addMultiple(svg()); - functionRegistry.addMultiple(types); - functionRegistry.addMultiple(style$1); - return functions; - }); - - function transformTree (root, options) { - options = options || {}; - var evaldRoot; - var variables = options.variables; - var evalEnv = new contexts.Eval(options); - // - // Allows setting variables with a hash, so: - // - // `{ color: new tree.Color('#f01') }` will become: - // - // new tree.Declaration('@color', - // new tree.Value([ - // new tree.Expression([ - // new tree.Color('#f01') - // ]) - // ]) - // ) - // - if (typeof variables === 'object' && !Array.isArray(variables)) { - variables = Object.keys(variables).map(function (k) { - var value = variables[k]; - if (!(value instanceof tree.Value)) { - if (!(value instanceof tree.Expression)) { - value = new tree.Expression([value]); - } - value = new tree.Value([value]); - } - return new tree.Declaration("@".concat(k), value, false, null, 0); - }); - evalEnv.frames = [new tree.Ruleset(null, variables)]; - } - var visitors$1 = [ - new visitors.JoinSelectorVisitor(), - new visitors.MarkVisibleSelectorsVisitor(true), - new visitors.ExtendVisitor(), - new visitors.ToCSSVisitor({ compress: Boolean(options.compress) }) - ]; - var preEvalVisitors = []; - var v; - var visitorIterator; - /** - * first() / get() allows visitors to be added while visiting - * - * @todo Add scoping for visitors just like functions for @plugin; right now they're global - */ - if (options.pluginManager) { - visitorIterator = options.pluginManager.visitor(); - for (var i_1 = 0; i_1 < 2; i_1++) { - visitorIterator.first(); - while ((v = visitorIterator.get())) { - if (v.isPreEvalVisitor) { - if (i_1 === 0 || preEvalVisitors.indexOf(v) === -1) { - preEvalVisitors.push(v); - v.run(root); - } - } - else { - if (i_1 === 0 || visitors$1.indexOf(v) === -1) { - if (v.isPreVisitor) { - visitors$1.unshift(v); - } - else { - visitors$1.push(v); - } - } - } - } - } - } - evaldRoot = root.eval(evalEnv); - for (var i_2 = 0; i_2 < visitors$1.length; i_2++) { - visitors$1[i_2].run(evaldRoot); - } - // Run any remaining visitors added after eval pass - if (options.pluginManager) { - visitorIterator.first(); - while ((v = visitorIterator.get())) { - if (visitors$1.indexOf(v) === -1 && preEvalVisitors.indexOf(v) === -1) { - v.run(evaldRoot); - } - } - } - return evaldRoot; - } - - /** - * Plugin Manager - */ - var PluginManager = /** @class */ (function () { - function PluginManager(less) { - this.less = less; - this.visitors = []; - this.preProcessors = []; - this.postProcessors = []; - this.installedPlugins = []; - this.fileManagers = []; - this.iterator = -1; - this.pluginCache = {}; - this.Loader = new less.PluginLoader(less); - } - /** - * Adds all the plugins in the array - * @param {Array} plugins - */ - PluginManager.prototype.addPlugins = function (plugins) { - if (plugins) { - for (var i_1 = 0; i_1 < plugins.length; i_1++) { - this.addPlugin(plugins[i_1]); - } - } - }; - /** - * - * @param plugin - * @param {String} filename - */ - PluginManager.prototype.addPlugin = function (plugin, filename, functionRegistry) { - this.installedPlugins.push(plugin); - if (filename) { - this.pluginCache[filename] = plugin; - } - if (plugin.install) { - plugin.install(this.less, this, functionRegistry || this.less.functions.functionRegistry); - } - }; - /** - * - * @param filename - */ - PluginManager.prototype.get = function (filename) { - return this.pluginCache[filename]; - }; - /** - * Adds a visitor. The visitor object has options on itself to determine - * when it should run. - * @param visitor - */ - PluginManager.prototype.addVisitor = function (visitor) { - this.visitors.push(visitor); - }; - /** - * Adds a pre processor object - * @param {object} preProcessor - * @param {number} priority - guidelines 1 = before import, 1000 = import, 2000 = after import - */ - PluginManager.prototype.addPreProcessor = function (preProcessor, priority) { - var indexToInsertAt; - for (indexToInsertAt = 0; indexToInsertAt < this.preProcessors.length; indexToInsertAt++) { - if (this.preProcessors[indexToInsertAt].priority >= priority) { - break; - } - } - this.preProcessors.splice(indexToInsertAt, 0, { preProcessor: preProcessor, priority: priority }); - }; - /** - * Adds a post processor object - * @param {object} postProcessor - * @param {number} priority - guidelines 1 = before compression, 1000 = compression, 2000 = after compression - */ - PluginManager.prototype.addPostProcessor = function (postProcessor, priority) { - var indexToInsertAt; - for (indexToInsertAt = 0; indexToInsertAt < this.postProcessors.length; indexToInsertAt++) { - if (this.postProcessors[indexToInsertAt].priority >= priority) { - break; - } - } - this.postProcessors.splice(indexToInsertAt, 0, { postProcessor: postProcessor, priority: priority }); - }; - /** - * - * @param manager - */ - PluginManager.prototype.addFileManager = function (manager) { - this.fileManagers.push(manager); - }; - /** - * - * @returns {Array} - * @private - */ - PluginManager.prototype.getPreProcessors = function () { - var preProcessors = []; - for (var i_2 = 0; i_2 < this.preProcessors.length; i_2++) { - preProcessors.push(this.preProcessors[i_2].preProcessor); - } - return preProcessors; - }; - /** - * - * @returns {Array} - * @private - */ - PluginManager.prototype.getPostProcessors = function () { - var postProcessors = []; - for (var i_3 = 0; i_3 < this.postProcessors.length; i_3++) { - postProcessors.push(this.postProcessors[i_3].postProcessor); - } - return postProcessors; - }; - /** - * - * @returns {Array} - * @private - */ - PluginManager.prototype.getVisitors = function () { - return this.visitors; - }; - PluginManager.prototype.visitor = function () { - var self = this; - return { - first: function () { - self.iterator = -1; - return self.visitors[self.iterator]; - }, - get: function () { - self.iterator += 1; - return self.visitors[self.iterator]; - } - }; - }; - /** - * - * @returns {Array} - * @private - */ - PluginManager.prototype.getFileManagers = function () { - return this.fileManagers; - }; - return PluginManager; - }()); - var pm; - var PluginManagerFactory = function (less, newFactory) { - if (newFactory || !pm) { - pm = new PluginManager(less); - } - return pm; - }; - - function SourceMapOutput (environment) { - var SourceMapOutput = /** @class */ (function () { - function SourceMapOutput(options) { - this._css = []; - this._rootNode = options.rootNode; - this._contentsMap = options.contentsMap; - this._contentsIgnoredCharsMap = options.contentsIgnoredCharsMap; - if (options.sourceMapFilename) { - this._sourceMapFilename = options.sourceMapFilename.replace(/\\/g, '/'); - } - this._outputFilename = options.outputFilename; - this.sourceMapURL = options.sourceMapURL; - if (options.sourceMapBasepath) { - this._sourceMapBasepath = options.sourceMapBasepath.replace(/\\/g, '/'); - } - if (options.sourceMapRootpath) { - this._sourceMapRootpath = options.sourceMapRootpath.replace(/\\/g, '/'); - if (this._sourceMapRootpath.charAt(this._sourceMapRootpath.length - 1) !== '/') { - this._sourceMapRootpath += '/'; - } - } - else { - this._sourceMapRootpath = ''; - } - this._outputSourceFiles = options.outputSourceFiles; - this._sourceMapGeneratorConstructor = environment.getSourceMapGenerator(); - this._lineNumber = 0; - this._column = 0; - } - SourceMapOutput.prototype.removeBasepath = function (path) { - if (this._sourceMapBasepath && path.indexOf(this._sourceMapBasepath) === 0) { - path = path.substring(this._sourceMapBasepath.length); - if (path.charAt(0) === '\\' || path.charAt(0) === '/') { - path = path.substring(1); - } - } - return path; - }; - SourceMapOutput.prototype.normalizeFilename = function (filename) { - filename = filename.replace(/\\/g, '/'); - filename = this.removeBasepath(filename); - return (this._sourceMapRootpath || '') + filename; - }; - SourceMapOutput.prototype.add = function (chunk, fileInfo, index, mapLines) { - // ignore adding empty strings - if (!chunk) { - return; - } - var lines, sourceLines, columns, sourceColumns, i; - if (fileInfo && fileInfo.filename) { - var inputSource = this._contentsMap[fileInfo.filename]; - // remove vars/banner added to the top of the file - if (this._contentsIgnoredCharsMap[fileInfo.filename]) { - // adjust the index - index -= this._contentsIgnoredCharsMap[fileInfo.filename]; - if (index < 0) { - index = 0; - } - // adjust the source - inputSource = inputSource.slice(this._contentsIgnoredCharsMap[fileInfo.filename]); - } - /** - * ignore empty content, or failsafe - * if contents map is incorrect - */ - if (inputSource === undefined) { - this._css.push(chunk); - return; - } - inputSource = inputSource.substring(0, index); - sourceLines = inputSource.split('\n'); - sourceColumns = sourceLines[sourceLines.length - 1]; - } - lines = chunk.split('\n'); - columns = lines[lines.length - 1]; - if (fileInfo && fileInfo.filename) { - if (!mapLines) { - this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + 1, column: this._column }, - original: { line: sourceLines.length, column: sourceColumns.length }, - source: this.normalizeFilename(fileInfo.filename) }); - } - else { - for (i = 0; i < lines.length; i++) { - this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + i + 1, column: i === 0 ? this._column : 0 }, - original: { line: sourceLines.length + i, column: i === 0 ? sourceColumns.length : 0 }, - source: this.normalizeFilename(fileInfo.filename) }); - } - } - } - if (lines.length === 1) { - this._column += columns.length; - } - else { - this._lineNumber += lines.length - 1; - this._column = columns.length; - } - this._css.push(chunk); - }; - SourceMapOutput.prototype.isEmpty = function () { - return this._css.length === 0; - }; - SourceMapOutput.prototype.toCSS = function (context) { - this._sourceMapGenerator = new this._sourceMapGeneratorConstructor({ file: this._outputFilename, sourceRoot: null }); - if (this._outputSourceFiles) { - for (var filename in this._contentsMap) { - // eslint-disable-next-line no-prototype-builtins - if (this._contentsMap.hasOwnProperty(filename)) { - var source = this._contentsMap[filename]; - if (this._contentsIgnoredCharsMap[filename]) { - source = source.slice(this._contentsIgnoredCharsMap[filename]); - } - this._sourceMapGenerator.setSourceContent(this.normalizeFilename(filename), source); - } - } - } - this._rootNode.genCSS(context, this); - if (this._css.length > 0) { - var sourceMapURL = void 0; - var sourceMapContent = JSON.stringify(this._sourceMapGenerator.toJSON()); - if (this.sourceMapURL) { - sourceMapURL = this.sourceMapURL; - } - else if (this._sourceMapFilename) { - sourceMapURL = this._sourceMapFilename; - } - this.sourceMapURL = sourceMapURL; - this.sourceMap = sourceMapContent; - } - return this._css.join(''); - }; - return SourceMapOutput; - }()); - return SourceMapOutput; - } - - function SourceMapBuilder (SourceMapOutput, environment) { - var SourceMapBuilder = /** @class */ (function () { - function SourceMapBuilder(options) { - this.options = options; - } - SourceMapBuilder.prototype.toCSS = function (rootNode, options, imports) { - var sourceMapOutput = new SourceMapOutput({ - contentsIgnoredCharsMap: imports.contentsIgnoredChars, - rootNode: rootNode, - contentsMap: imports.contents, - sourceMapFilename: this.options.sourceMapFilename, - sourceMapURL: this.options.sourceMapURL, - outputFilename: this.options.sourceMapOutputFilename, - sourceMapBasepath: this.options.sourceMapBasepath, - sourceMapRootpath: this.options.sourceMapRootpath, - outputSourceFiles: this.options.outputSourceFiles, - sourceMapGenerator: this.options.sourceMapGenerator, - sourceMapFileInline: this.options.sourceMapFileInline, - disableSourcemapAnnotation: this.options.disableSourcemapAnnotation - }); - var css = sourceMapOutput.toCSS(options); - this.sourceMap = sourceMapOutput.sourceMap; - this.sourceMapURL = sourceMapOutput.sourceMapURL; - if (this.options.sourceMapInputFilename) { - this.sourceMapInputFilename = sourceMapOutput.normalizeFilename(this.options.sourceMapInputFilename); - } - if (this.options.sourceMapBasepath !== undefined && this.sourceMapURL !== undefined) { - this.sourceMapURL = sourceMapOutput.removeBasepath(this.sourceMapURL); - } - return css + this.getCSSAppendage(); - }; - SourceMapBuilder.prototype.getCSSAppendage = function () { - var sourceMapURL = this.sourceMapURL; - if (this.options.sourceMapFileInline) { - if (this.sourceMap === undefined) { - return ''; - } - sourceMapURL = "data:application/json;base64,".concat(environment.encodeBase64(this.sourceMap)); - } - if (this.options.disableSourcemapAnnotation) { - return ''; - } - if (sourceMapURL) { - return "/*# sourceMappingURL=".concat(sourceMapURL, " */"); - } - return ''; - }; - SourceMapBuilder.prototype.getExternalSourceMap = function () { - return this.sourceMap; - }; - SourceMapBuilder.prototype.setExternalSourceMap = function (sourceMap) { - this.sourceMap = sourceMap; - }; - SourceMapBuilder.prototype.isInline = function () { - return this.options.sourceMapFileInline; - }; - SourceMapBuilder.prototype.getSourceMapURL = function () { - return this.sourceMapURL; - }; - SourceMapBuilder.prototype.getOutputFilename = function () { - return this.options.sourceMapOutputFilename; - }; - SourceMapBuilder.prototype.getInputFilename = function () { - return this.sourceMapInputFilename; - }; - return SourceMapBuilder; - }()); - return SourceMapBuilder; - } - - function ParseTree (SourceMapBuilder) { - var ParseTree = /** @class */ (function () { - function ParseTree(root, imports) { - this.root = root; - this.imports = imports; - } - ParseTree.prototype.toCSS = function (options) { - var evaldRoot; - var result = {}; - var sourceMapBuilder; - try { - evaldRoot = transformTree(this.root, options); - } - catch (e) { - throw new LessError(e, this.imports); - } - try { - var compress = Boolean(options.compress); - if (compress) { - logger$1.warn('The compress option has been deprecated. ' + - 'We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.'); - } - var toCSSOptions = { - compress: compress, - dumpLineNumbers: options.dumpLineNumbers, - strictUnits: Boolean(options.strictUnits), - numPrecision: 8 - }; - if (options.sourceMap) { - sourceMapBuilder = new SourceMapBuilder(options.sourceMap); - result.css = sourceMapBuilder.toCSS(evaldRoot, toCSSOptions, this.imports); - } - else { - result.css = evaldRoot.toCSS(toCSSOptions); - } - } - catch (e) { - throw new LessError(e, this.imports); - } - if (options.pluginManager) { - var postProcessors = options.pluginManager.getPostProcessors(); - for (var i_1 = 0; i_1 < postProcessors.length; i_1++) { - result.css = postProcessors[i_1].process(result.css, { sourceMap: sourceMapBuilder, options: options, imports: this.imports }); - } - } - if (options.sourceMap) { - result.map = sourceMapBuilder.getExternalSourceMap(); - } - result.imports = []; - for (var file_1 in this.imports.files) { - if (Object.prototype.hasOwnProperty.call(this.imports.files, file_1) && file_1 !== this.imports.rootFilename) { - result.imports.push(file_1); - } - } - return result; - }; - return ParseTree; - }()); - return ParseTree; - } - - function ImportManager (environment) { - // FileInfo = { - // 'rewriteUrls' - option - whether to adjust URL's to be relative - // 'filename' - full resolved filename of current file - // 'rootpath' - path to append to normal URLs for this node - // 'currentDirectory' - path to the current file, absolute - // 'rootFilename' - filename of the base file - // 'entryPath' - absolute path to the entry file - // 'reference' - whether the file should not be output and only output parts that are referenced - var ImportManager = /** @class */ (function () { - function ImportManager(less, context, rootFileInfo) { - this.less = less; - this.rootFilename = rootFileInfo.filename; - this.paths = context.paths || []; // Search paths, when importing - this.contents = {}; // map - filename to contents of all the files - this.contentsIgnoredChars = {}; // map - filename to lines at the beginning of each file to ignore - this.mime = context.mime; - this.error = null; - this.context = context; - // Deprecated? Unused outside of here, could be useful. - this.queue = []; // Files which haven't been imported yet - this.files = {}; // Holds the imported parse trees. - } - /** - * Add an import to be imported - * @param path - the raw path - * @param tryAppendExtension - whether to try appending a file extension (.less or .js if the path has no extension) - * @param currentFileInfo - the current file info (used for instance to work out relative paths) - * @param importOptions - import options - * @param callback - callback for when it is imported - */ - ImportManager.prototype.push = function (path, tryAppendExtension, currentFileInfo, importOptions, callback) { - var importManager = this, pluginLoader = this.context.pluginManager.Loader; - this.queue.push(path); - var fileParsedFunc = function (e, root, fullPath) { - importManager.queue.splice(importManager.queue.indexOf(path), 1); // Remove the path from the queue - var importedEqualsRoot = fullPath === importManager.rootFilename; - if (importOptions.optional && e) { - callback(null, { rules: [] }, false, null); - logger$1.info("The file ".concat(fullPath, " was skipped because it was not found and the import was marked optional.")); - } - else { - // Inline imports aren't cached here. - // If we start to cache them, please make sure they won't conflict with non-inline imports of the - // same name as they used to do before this comment and the condition below have been added. - if (!importManager.files[fullPath] && !importOptions.inline) { - importManager.files[fullPath] = { root: root, options: importOptions }; - } - if (e && !importManager.error) { - importManager.error = e; - } - callback(e, root, importedEqualsRoot, fullPath); - } - }; - var newFileInfo = { - rewriteUrls: this.context.rewriteUrls, - entryPath: currentFileInfo.entryPath, - rootpath: currentFileInfo.rootpath, - rootFilename: currentFileInfo.rootFilename - }; - var fileManager = environment.getFileManager(path, currentFileInfo.currentDirectory, this.context, environment); - if (!fileManager) { - fileParsedFunc({ message: "Could not find a file-manager for ".concat(path) }); - return; - } - var loadFileCallback = function (loadedFile) { - var plugin; - var resolvedFilename = loadedFile.filename; - var contents = loadedFile.contents.replace(/^\uFEFF/, ''); - // Pass on an updated rootpath if path of imported file is relative and file - // is in a (sub|sup) directory - // - // Examples: - // - If path of imported file is 'module/nav/nav.less' and rootpath is 'less/', - // then rootpath should become 'less/module/nav/' - // - If path of imported file is '../mixins.less' and rootpath is 'less/', - // then rootpath should become 'less/../' - newFileInfo.currentDirectory = fileManager.getPath(resolvedFilename); - if (newFileInfo.rewriteUrls) { - newFileInfo.rootpath = fileManager.join((importManager.context.rootpath || ''), fileManager.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath)); - if (!fileManager.isPathAbsolute(newFileInfo.rootpath) && fileManager.alwaysMakePathsAbsolute()) { - newFileInfo.rootpath = fileManager.join(newFileInfo.entryPath, newFileInfo.rootpath); - } - } - newFileInfo.filename = resolvedFilename; - var newEnv = new contexts.Parse(importManager.context); - newEnv.processImports = false; - importManager.contents[resolvedFilename] = contents; - if (currentFileInfo.reference || importOptions.reference) { - newFileInfo.reference = true; - } - if (importOptions.isPlugin) { - plugin = pluginLoader.evalPlugin(contents, newEnv, importManager, importOptions.pluginArgs, newFileInfo); - if (plugin instanceof LessError) { - fileParsedFunc(plugin, null, resolvedFilename); - } - else { - fileParsedFunc(null, plugin, resolvedFilename); - } - } - else if (importOptions.inline) { - fileParsedFunc(null, contents, resolvedFilename); - } - else { - // import (multiple) parse trees apparently get altered and can't be cached. - // TODO: investigate why this is - if (importManager.files[resolvedFilename] - && !importManager.files[resolvedFilename].options.multiple - && !importOptions.multiple) { - fileParsedFunc(null, importManager.files[resolvedFilename].root, resolvedFilename); - } - else { - new Parser(newEnv, importManager, newFileInfo).parse(contents, function (e, root) { - fileParsedFunc(e, root, resolvedFilename); - }); - } - } - }; - var loadedFile; - var promise; - var context = clone(this.context); - if (tryAppendExtension) { - context.ext = importOptions.isPlugin ? '.js' : '.less'; - } - if (importOptions.isPlugin) { - context.mime = 'application/javascript'; - if (context.syncImport) { - loadedFile = pluginLoader.loadPluginSync(path, currentFileInfo.currentDirectory, context, environment, fileManager); - } - else { - promise = pluginLoader.loadPlugin(path, currentFileInfo.currentDirectory, context, environment, fileManager); - } - } - else { - if (context.syncImport) { - loadedFile = fileManager.loadFileSync(path, currentFileInfo.currentDirectory, context, environment); - } - else { - promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, context, environment, function (err, loadedFile) { - if (err) { - fileParsedFunc(err); - } - else { - loadFileCallback(loadedFile); - } - }); - } - } - if (loadedFile) { - if (!loadedFile.filename) { - fileParsedFunc(loadedFile); - } - else { - loadFileCallback(loadedFile); - } - } - else if (promise) { - promise.then(loadFileCallback, fileParsedFunc); - } - }; - return ImportManager; - }()); - return ImportManager; - } - - function Parse (environment, ParseTree, ImportManager) { - var parse = function (input, options, callback) { - if (typeof options === 'function') { - callback = options; - options = copyOptions(this.options, {}); - } - else { - options = copyOptions(this.options, options || {}); - } - if (!callback) { - var self_1 = this; - return new Promise(function (resolve, reject) { - parse.call(self_1, input, options, function (err, output) { - if (err) { - reject(err); - } - else { - resolve(output); - } - }); - }); - } - else { - var context_1; - var rootFileInfo = void 0; - var pluginManager_1 = new PluginManagerFactory(this, !options.reUsePluginManager); - options.pluginManager = pluginManager_1; - context_1 = new contexts.Parse(options); - if (options.rootFileInfo) { - rootFileInfo = options.rootFileInfo; - } - else { - var filename = options.filename || 'input'; - var entryPath = filename.replace(/[^/\\]*$/, ''); - rootFileInfo = { - filename: filename, - rewriteUrls: context_1.rewriteUrls, - rootpath: context_1.rootpath || '', - currentDirectory: entryPath, - entryPath: entryPath, - rootFilename: filename - }; - // add in a missing trailing slash - if (rootFileInfo.rootpath && rootFileInfo.rootpath.slice(-1) !== '/') { - rootFileInfo.rootpath += '/'; - } - } - var imports_1 = new ImportManager(this, context_1, rootFileInfo); - this.importManager = imports_1; - // TODO: allow the plugins to be just a list of paths or names - // Do an async plugin queue like lessc - if (options.plugins) { - options.plugins.forEach(function (plugin) { - var evalResult, contents; - if (plugin.fileContent) { - contents = plugin.fileContent.replace(/^\uFEFF/, ''); - evalResult = pluginManager_1.Loader.evalPlugin(contents, context_1, imports_1, plugin.options, plugin.filename); - if (evalResult instanceof LessError) { - return callback(evalResult); - } - } - else { - pluginManager_1.addPlugin(plugin); - } - }); - } - new Parser(context_1, imports_1, rootFileInfo) - .parse(input, function (e, root) { - if (e) { - return callback(e); - } - callback(null, root, imports_1, options); - }, options); - } - }; - return parse; - } - - function Render (environment, ParseTree) { - var render = function (input, options, callback) { - if (typeof options === 'function') { - callback = options; - options = copyOptions(this.options, {}); - } - else { - options = copyOptions(this.options, options || {}); - } - if (!callback) { - var self_1 = this; - return new Promise(function (resolve, reject) { - render.call(self_1, input, options, function (err, output) { - if (err) { - reject(err); - } - else { - resolve(output); - } - }); - }); - } - else { - this.parse(input, options, function (err, root, imports, options) { - if (err) { - return callback(err); - } - var result; - try { - var parseTree = new ParseTree(root, imports); - result = parseTree.toCSS(options); - } - catch (err) { - return callback(err); - } - callback(null, result); - }); - } - }; - return render; - } - - var version = "4.4.2"; - - function parseNodeVersion(version) { - var match = version.match(/^v(\d{1,2})\.(\d{1,2})\.(\d{1,2})(?:-([0-9A-Za-z-.]+))?(?:\+([0-9A-Za-z-.]+))?$/); // eslint-disable-line max-len - if (!match) { - throw new Error('Unable to parse: ' + version); - } - - var res = { - major: parseInt(match[1], 10), - minor: parseInt(match[2], 10), - patch: parseInt(match[3], 10), - pre: match[4] || '', - build: match[5] || '', - }; - - return res; - } - - var parseNodeVersion_1 = parseNodeVersion; - - function lessRoot (environment, fileManagers) { - var sourceMapOutput, sourceMapBuilder, parseTree, importManager; - environment = new Environment(environment, fileManagers); - sourceMapOutput = SourceMapOutput(environment); - sourceMapBuilder = SourceMapBuilder(sourceMapOutput, environment); - parseTree = ParseTree(sourceMapBuilder); - importManager = ImportManager(environment); - var render = Render(environment, parseTree); - var parse = Parse(environment, parseTree, importManager); - var v = parseNodeVersion_1("v".concat(version)); - var initial = { - version: [v.major, v.minor, v.patch], - data: data, - tree: tree, - Environment: Environment, - AbstractFileManager: AbstractFileManager, - AbstractPluginLoader: AbstractPluginLoader, - environment: environment, - visitors: visitors, - Parser: Parser, - functions: functions(environment), - contexts: contexts, - SourceMapOutput: sourceMapOutput, - SourceMapBuilder: sourceMapBuilder, - ParseTree: parseTree, - ImportManager: importManager, - render: render, - parse: parse, - LessError: LessError, - transformTree: transformTree, - utils: utils, - PluginManager: PluginManagerFactory, - logger: logger$1 - }; - // Create a public API - var ctor = function (t) { - return function () { - var obj = Object.create(t.prototype); - t.apply(obj, Array.prototype.slice.call(arguments, 0)); - return obj; - }; - }; - var t; - var api = Object.create(initial); - for (var n in initial.tree) { - /* eslint guard-for-in: 0 */ - t = initial.tree[n]; - if (typeof t === 'function') { - api[n.toLowerCase()] = ctor(t); - } - else { - api[n] = Object.create(null); - for (var o in t) { - /* eslint guard-for-in: 0 */ - api[n][o.toLowerCase()] = ctor(t[o]); - } - } - } - /** - * Some of the functions assume a `this` context of the API object, - * which causes it to fail when wrapped for ES6 imports. - * - * An assumed `this` should be removed in the future. - */ - initial.parse = initial.parse.bind(api); - initial.render = initial.render.bind(api); - return api; - } - - var options$1; - var logger; - var fileCache = {}; - // TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load - var FileManager = function () { }; - FileManager.prototype = Object.assign(new AbstractFileManager(), { - alwaysMakePathsAbsolute: function () { - return true; - }, - join: function (basePath, laterPath) { - if (!basePath) { - return laterPath; - } - return this.extractUrlParts(laterPath, basePath).path; - }, - doXHR: function (url, type, callback, errback) { - var xhr = new XMLHttpRequest(); - var async = options$1.isFileProtocol ? options$1.fileAsync : true; - if (typeof xhr.overrideMimeType === 'function') { - xhr.overrideMimeType('text/css'); - } - logger.debug("XHR: Getting '".concat(url, "'")); - xhr.open('GET', url, async); - xhr.setRequestHeader('Accept', type || 'text/x-less, text/css; q=0.9, */*; q=0.5'); - xhr.send(null); - function handleResponse(xhr, callback, errback) { - if (xhr.status >= 200 && xhr.status < 300) { - callback(xhr.responseText, xhr.getResponseHeader('Last-Modified')); - } - else if (typeof errback === 'function') { - errback(xhr.status, url); - } - } - if (options$1.isFileProtocol && !options$1.fileAsync) { - if (xhr.status === 0 || (xhr.status >= 200 && xhr.status < 300)) { - callback(xhr.responseText); - } - else { - errback(xhr.status, url); - } - } - else if (async) { - xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - handleResponse(xhr, callback, errback); - } - }; - } - else { - handleResponse(xhr, callback, errback); - } - }, - supports: function () { - return true; - }, - clearFileCache: function () { - fileCache = {}; - }, - loadFile: function (filename, currentDirectory, options) { - // TODO: Add prefix support like less-node? - // What about multiple paths? - if (currentDirectory && !this.isPathAbsolute(filename)) { - filename = currentDirectory + filename; - } - filename = options.ext ? this.tryAppendExtension(filename, options.ext) : filename; - options = options || {}; - // sheet may be set to the stylesheet for the initial load or a collection of properties including - // some context variables for imports - var hrefParts = this.extractUrlParts(filename, window.location.href); - var href = hrefParts.url; - var self = this; - return new Promise(function (resolve, reject) { - if (options.useFileCache && fileCache[href]) { - try { - var lessText_1 = fileCache[href]; - return resolve({ contents: lessText_1, filename: href, webInfo: { lastModified: new Date() } }); - } - catch (e) { - return reject({ filename: href, message: "Error loading file ".concat(href, " error was ").concat(e.message) }); - } - } - self.doXHR(href, options.mime, function doXHRCallback(data, lastModified) { - // per file cache - fileCache[href] = data; - // Use remote copy (re-parse) - resolve({ contents: data, filename: href, webInfo: { lastModified: lastModified } }); - }, function doXHRError(status, url) { - reject({ type: 'File', message: "'".concat(url, "' wasn't found (").concat(status, ")"), href: href }); - }); - }); - } - }); - var FM = (function (opts, log) { - options$1 = opts; - logger = log; - return FileManager; - }); - - /** - * @todo Add tests for browser `@plugin` - */ - /** - * Browser Plugin Loader - */ - var PluginLoader = function (less) { - this.less = less; - // Should we shim this.require for browser? Probably not? - }; - PluginLoader.prototype = Object.assign(new AbstractPluginLoader(), { - loadPlugin: function (filename, basePath, context, environment, fileManager) { - return new Promise(function (fulfill, reject) { - fileManager.loadFile(filename, basePath, context, environment) - .then(fulfill).catch(reject); - }); - } - }); - - var LogListener = (function (less, options) { - var logLevel_debug = 4; - var logLevel_info = 3; - var logLevel_warn = 2; - var logLevel_error = 1; - // The amount of logging in the javascript console. - // 3 - Debug, information and errors - // 2 - Information and errors - // 1 - Errors - // 0 - None - // Defaults to 2 - options.logLevel = typeof options.logLevel !== 'undefined' ? options.logLevel : (options.env === 'development' ? logLevel_info : logLevel_error); - if (!options.loggers) { - options.loggers = [{ - debug: function (msg) { - if (options.logLevel >= logLevel_debug) { - console.log(msg); - } - }, - info: function (msg) { - if (options.logLevel >= logLevel_info) { - console.log(msg); - } - }, - warn: function (msg) { - if (options.logLevel >= logLevel_warn) { - console.warn(msg); - } - }, - error: function (msg) { - if (options.logLevel >= logLevel_error) { - console.error(msg); - } - } - }]; - } - for (var i_1 = 0; i_1 < options.loggers.length; i_1++) { - less.logger.addListener(options.loggers[i_1]); - } - }); - - var ErrorReporting = (function (window, less, options) { - function errorHTML(e, rootHref) { - var id = "less-error-message:".concat(extractId(rootHref || '')); - var template = '
  • {content}
  • '; - var elem = window.document.createElement('div'); - var timer; - var content; - var errors = []; - var filename = e.filename || rootHref; - var filenameNoPath = filename.match(/([^/]+(\?.*)?)$/)[1]; - elem.id = id; - elem.className = 'less-error-message'; - content = "

    ".concat(e.type || 'Syntax', "Error: ").concat(e.message || 'There is an error in your .less file') + - "

    in ").concat(filenameNoPath, " "); - var errorline = function (e, i, classname) { - if (e.extract[i] !== undefined) { - errors.push(template.replace(/\{line\}/, (parseInt(e.line, 10) || 0) + (i - 1)) - .replace(/\{class\}/, classname) - .replace(/\{content\}/, e.extract[i])); - } - }; - if (e.line) { - errorline(e, 0, ''); - errorline(e, 1, 'line'); - errorline(e, 2, ''); - content += "on line ".concat(e.line, ", column ").concat(e.column + 1, ":

      ").concat(errors.join(''), "
    "); - } - if (e.stack && (e.extract || options.logLevel >= 4)) { - content += "
    Stack Trace
    ".concat(e.stack.split('\n').slice(1).join('
    ')); - } - elem.innerHTML = content; - // CSS for error messages - browser.createCSS(window.document, [ - '.less-error-message ul, .less-error-message li {', - 'list-style-type: none;', - 'margin-right: 15px;', - 'padding: 4px 0;', - 'margin: 0;', - '}', - '.less-error-message label {', - 'font-size: 12px;', - 'margin-right: 15px;', - 'padding: 4px 0;', - 'color: #cc7777;', - '}', - '.less-error-message pre {', - 'color: #dd6666;', - 'padding: 4px 0;', - 'margin: 0;', - 'display: inline-block;', - '}', - '.less-error-message pre.line {', - 'color: #ff0000;', - '}', - '.less-error-message h3 {', - 'font-size: 20px;', - 'font-weight: bold;', - 'padding: 15px 0 5px 0;', - 'margin: 0;', - '}', - '.less-error-message a {', - 'color: #10a', - '}', - '.less-error-message .error {', - 'color: red;', - 'font-weight: bold;', - 'padding-bottom: 2px;', - 'border-bottom: 1px dashed red;', - '}' - ].join('\n'), { title: 'error-message' }); - elem.style.cssText = [ - 'font-family: Arial, sans-serif', - 'border: 1px solid #e00', - 'background-color: #eee', - 'border-radius: 5px', - '-webkit-border-radius: 5px', - '-moz-border-radius: 5px', - 'color: #e00', - 'padding: 15px', - 'margin-bottom: 15px' - ].join(';'); - if (options.env === 'development') { - timer = setInterval(function () { - var document = window.document; - var body = document.body; - if (body) { - if (document.getElementById(id)) { - body.replaceChild(elem, document.getElementById(id)); - } - else { - body.insertBefore(elem, body.firstChild); - } - clearInterval(timer); - } - }, 10); - } - } - function removeErrorHTML(path) { - var node = window.document.getElementById("less-error-message:".concat(extractId(path))); - if (node) { - node.parentNode.removeChild(node); - } - } - function removeError(path) { - if (!options.errorReporting || options.errorReporting === 'html') { - removeErrorHTML(path); - } - else if (options.errorReporting === 'console') ; - else if (typeof options.errorReporting === 'function') { - options.errorReporting('remove', path); - } - } - function errorConsole(e, rootHref) { - var template = '{line} {content}'; - var filename = e.filename || rootHref; - var errors = []; - var content = "".concat(e.type || 'Syntax', "Error: ").concat(e.message || 'There is an error in your .less file', " in ").concat(filename); - var errorline = function (e, i, classname) { - if (e.extract[i] !== undefined) { - errors.push(template.replace(/\{line\}/, (parseInt(e.line, 10) || 0) + (i - 1)) - .replace(/\{class\}/, classname) - .replace(/\{content\}/, e.extract[i])); - } - }; - if (e.line) { - errorline(e, 0, ''); - errorline(e, 1, 'line'); - errorline(e, 2, ''); - content += " on line ".concat(e.line, ", column ").concat(e.column + 1, ":\n").concat(errors.join('\n')); - } - if (e.stack && (e.extract || options.logLevel >= 4)) { - content += "\nStack Trace\n".concat(e.stack); - } - less.logger.error(content); - } - function error(e, rootHref) { - if (!options.errorReporting || options.errorReporting === 'html') { - errorHTML(e, rootHref); - } - else if (options.errorReporting === 'console') { - errorConsole(e, rootHref); - } - else if (typeof options.errorReporting === 'function') { - options.errorReporting('add', e, rootHref); - } - } - return { - add: error, - remove: removeError - }; - }); - - // Cache system is a bit outdated and could do with work - var Cache = (function (window, options, logger) { - var cache = null; - if (options.env !== 'development') { - try { - cache = (typeof window.localStorage === 'undefined') ? null : window.localStorage; - } - catch (_) { } - } - return { - setCSS: function (path, lastModified, modifyVars, styles) { - if (cache) { - logger.info("saving ".concat(path, " to cache.")); - try { - cache.setItem(path, styles); - cache.setItem("".concat(path, ":timestamp"), lastModified); - if (modifyVars) { - cache.setItem("".concat(path, ":vars"), JSON.stringify(modifyVars)); - } - } - catch (e) { - // TODO - could do with adding more robust error handling - logger.error("failed to save \"".concat(path, "\" to local storage for caching.")); - } - } - }, - getCSS: function (path, webInfo, modifyVars) { - var css = cache && cache.getItem(path); - var timestamp = cache && cache.getItem("".concat(path, ":timestamp")); - var vars = cache && cache.getItem("".concat(path, ":vars")); - modifyVars = modifyVars || {}; - vars = vars || '{}'; // if not set, treat as the JSON representation of an empty object - if (timestamp && webInfo.lastModified && - (new Date(webInfo.lastModified).valueOf() === - new Date(timestamp).valueOf()) && - JSON.stringify(modifyVars) === vars) { - // Use local copy - return css; - } - } - }; - }); - - var ImageSize = (function () { - function imageSize() { - throw { - type: 'Runtime', - message: 'Image size functions are not supported in browser version of less' - }; - } - var imageFunctions = { - 'image-size': function (filePathNode) { - imageSize(); - return -1; - }, - 'image-width': function (filePathNode) { - imageSize(); - return -1; - }, - 'image-height': function (filePathNode) { - imageSize(); - return -1; - } - }; - functionRegistry.addMultiple(imageFunctions); - }); - - // - var root = (function (window, options) { - var document = window.document; - var less = lessRoot(); - less.options = options; - var environment = less.environment; - var FileManager = FM(options, less.logger); - var fileManager = new FileManager(); - environment.addFileManager(fileManager); - less.FileManager = FileManager; - less.PluginLoader = PluginLoader; - LogListener(less, options); - var errors = ErrorReporting(window, less, options); - var cache = less.cache = options.cache || Cache(window, options, less.logger); - ImageSize(less.environment); - // Setup user functions - Deprecate? - if (options.functions) { - less.functions.functionRegistry.addMultiple(options.functions); - } - var typePattern = /^text\/(x-)?less$/; - function clone(obj) { - var cloned = {}; - for (var prop in obj) { - if (Object.prototype.hasOwnProperty.call(obj, prop)) { - cloned[prop] = obj[prop]; - } - } - return cloned; - } - // only really needed for phantom - function bind(func, thisArg) { - var curryArgs = Array.prototype.slice.call(arguments, 2); - return function () { - var args = curryArgs.concat(Array.prototype.slice.call(arguments, 0)); - return func.apply(thisArg, args); - }; - } - function loadStyles(modifyVars) { - var styles = document.getElementsByTagName('style'); - var style; - for (var i_1 = 0; i_1 < styles.length; i_1++) { - style = styles[i_1]; - if (style.type.match(typePattern)) { - var instanceOptions = clone(options); - instanceOptions.modifyVars = modifyVars; - var lessText_1 = style.innerHTML || ''; - instanceOptions.filename = document.location.href.replace(/#.*$/, ''); - /* jshint loopfunc:true */ - // use closure to store current style - less.render(lessText_1, instanceOptions, bind(function (style, e, result) { - if (e) { - errors.add(e, 'inline'); - } - else { - style.type = 'text/css'; - if (style.styleSheet) { - style.styleSheet.cssText = result.css; - } - else { - style.innerHTML = result.css; - } - } - }, null, style)); - } - } - } - function loadStyleSheet(sheet, callback, reload, remaining, modifyVars) { - var instanceOptions = clone(options); - addDataAttr(instanceOptions, sheet); - instanceOptions.mime = sheet.type; - if (modifyVars) { - instanceOptions.modifyVars = modifyVars; - } - function loadInitialFileCallback(loadedFile) { - var data = loadedFile.contents; - var path = loadedFile.filename; - var webInfo = loadedFile.webInfo; - var newFileInfo = { - currentDirectory: fileManager.getPath(path), - filename: path, - rootFilename: path, - rewriteUrls: instanceOptions.rewriteUrls - }; - newFileInfo.entryPath = newFileInfo.currentDirectory; - newFileInfo.rootpath = instanceOptions.rootpath || newFileInfo.currentDirectory; - if (webInfo) { - webInfo.remaining = remaining; - var css = cache.getCSS(path, webInfo, instanceOptions.modifyVars); - if (!reload && css) { - webInfo.local = true; - callback(null, css, data, sheet, webInfo, path); - return; - } - } - // TODO add tests around how this behaves when reloading - errors.remove(path); - instanceOptions.rootFileInfo = newFileInfo; - less.render(data, instanceOptions, function (e, result) { - if (e) { - e.href = path; - callback(e); - } - else { - cache.setCSS(sheet.href, webInfo.lastModified, instanceOptions.modifyVars, result.css); - callback(null, result.css, data, sheet, webInfo, path); - } - }); - } - fileManager.loadFile(sheet.href, null, instanceOptions, environment) - .then(function (loadedFile) { - loadInitialFileCallback(loadedFile); - }).catch(function (err) { - console.log(err); - callback(err); - }); - } - function loadStyleSheets(callback, reload, modifyVars) { - for (var i_2 = 0; i_2 < less.sheets.length; i_2++) { - loadStyleSheet(less.sheets[i_2], callback, reload, less.sheets.length - (i_2 + 1), modifyVars); - } - } - function initRunningMode() { - if (less.env === 'development') { - less.watchTimer = setInterval(function () { - if (less.watchMode) { - fileManager.clearFileCache(); - /** - * @todo remove when this is typed with JSDoc - */ - // eslint-disable-next-line no-unused-vars - loadStyleSheets(function (e, css, _, sheet, webInfo) { - if (e) { - errors.add(e, e.href || sheet.href); - } - else if (css) { - browser.createCSS(window.document, css, sheet); - } - }); - } - }, options.poll); - } - } - // - // Watch mode - // - less.watch = function () { - if (!less.watchMode) { - less.env = 'development'; - initRunningMode(); - } - this.watchMode = true; - return true; - }; - less.unwatch = function () { clearInterval(less.watchTimer); this.watchMode = false; return false; }; - // - // Synchronously get all tags with the 'rel' attribute set to - // "stylesheet/less". - // - less.registerStylesheetsImmediately = function () { - var links = document.getElementsByTagName('link'); - less.sheets = []; - for (var i_3 = 0; i_3 < links.length; i_3++) { - if (links[i_3].rel === 'stylesheet/less' || (links[i_3].rel.match(/stylesheet/) && - (links[i_3].type.match(typePattern)))) { - less.sheets.push(links[i_3]); - } - } - }; - // - // Asynchronously get all tags with the 'rel' attribute set to - // "stylesheet/less", returning a Promise. - // - less.registerStylesheets = function () { return new Promise(function (resolve) { - less.registerStylesheetsImmediately(); - resolve(); - }); }; - // - // With this function, it's possible to alter variables and re-render - // CSS without reloading less-files - // - less.modifyVars = function (record) { return less.refresh(true, record, false); }; - less.refresh = function (reload, modifyVars, clearFileCache) { - if ((reload || clearFileCache) && clearFileCache !== false) { - fileManager.clearFileCache(); - } - return new Promise(function (resolve, reject) { - var startTime; - var endTime; - var totalMilliseconds; - var remainingSheets; - startTime = endTime = new Date(); - // Set counter for remaining unprocessed sheets - remainingSheets = less.sheets.length; - if (remainingSheets === 0) { - endTime = new Date(); - totalMilliseconds = endTime - startTime; - less.logger.info('Less has finished and no sheets were loaded.'); - resolve({ - startTime: startTime, - endTime: endTime, - totalMilliseconds: totalMilliseconds, - sheets: less.sheets.length - }); - } - else { - // Relies on less.sheets array, callback seems to be guaranteed to be called for every element of the array - loadStyleSheets(function (e, css, _, sheet, webInfo) { - if (e) { - errors.add(e, e.href || sheet.href); - reject(e); - return; - } - if (webInfo.local) { - less.logger.info("Loading ".concat(sheet.href, " from cache.")); - } - else { - less.logger.info("Rendered ".concat(sheet.href, " successfully.")); - } - browser.createCSS(window.document, css, sheet); - less.logger.info("CSS for ".concat(sheet.href, " generated in ").concat(new Date() - endTime, "ms")); - // Count completed sheet - remainingSheets--; - // Check if the last remaining sheet was processed and then call the promise - if (remainingSheets === 0) { - totalMilliseconds = new Date() - startTime; - less.logger.info("Less has finished. CSS generated in ".concat(totalMilliseconds, "ms")); - resolve({ - startTime: startTime, - endTime: endTime, - totalMilliseconds: totalMilliseconds, - sheets: less.sheets.length - }); - } - endTime = new Date(); - }, reload, modifyVars); - } - loadStyles(modifyVars); - }); - }; - less.refreshStyles = loadStyles; - return less; - }); - - /** - * Kicks off less and compiles any stylesheets - * used in the browser distributed version of less - * to kick-start less using the browser api - */ - var options = defaultOptions(); - if (window.less) { - for (var key in window.less) { - if (Object.prototype.hasOwnProperty.call(window.less, key)) { - options[key] = window.less[key]; - } - } - } - addDefaultOptions(window, options); - options.plugins = options.plugins || []; - if (window.LESS_PLUGINS) { - options.plugins = options.plugins.concat(window.LESS_PLUGINS); - } - var less = root(window, options); - window.less = less; - var css; - var head; - var style; - // Always restore page visibility - function resolveOrReject(data) { - if (data.filename) { - console.warn(data); - } - if (!options.async) { - head.removeChild(style); - } - } - if (options.onReady) { - if (/!watch/.test(window.location.hash)) { - less.watch(); - } - // Simulate synchronous stylesheet loading by hiding page rendering - if (!options.async) { - css = 'body { display: none !important }'; - head = document.head || document.getElementsByTagName('head')[0]; - style = document.createElement('style'); - style.type = 'text/css'; - if (style.styleSheet) { - style.styleSheet.cssText = css; - } - else { - style.appendChild(document.createTextNode(css)); - } - head.appendChild(style); - } - less.registerStylesheetsImmediately(); - less.pageLoadFinished = less.refresh(less.env === 'development').then(resolveOrReject, resolveOrReject); - } - - return less; - -})); diff --git a/packages/less/dist/less.min.js b/packages/less/dist/less.min.js deleted file mode 100644 index fb7147a09d..0000000000 --- a/packages/less/dist/less.min.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Less - Leaner CSS v4.4.2 - * http://lesscss.org - * - * Copyright (c) 2009-2025, Alexis Sellier - * Licensed under the Apache-2.0 License. - * - * @license Apache-2.0 - */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).less=t()}(this,(function(){"use strict";function e(e){return e.replace(/^[a-z-]+:\/+?[^/]+/,"").replace(/[?&]livereload=\w+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^.\w-]+/g,"-").replace(/\./g,":")}function t(e,t){if(t)for(var n in t.dataset)if(Object.prototype.hasOwnProperty.call(t.dataset,n))if("env"===n||"dumpLineNumbers"===n||"rootpath"===n||"errorReporting"===n)e[n]=t.dataset[n];else try{e[n]=JSON.parse(t.dataset[n])}catch(e){}}var n=function(t,n,i){var r=i.href||"",s="less:".concat(i.title||e(r)),a=t.getElementById(s),o=!1,l=t.createElement("style");l.setAttribute("type","text/css"),i.media&&l.setAttribute("media",i.media),l.id=s,l.styleSheet||(l.appendChild(t.createTextNode(n)),o=null!==a&&a.childNodes.length>0&&l.childNodes.length>0&&a.firstChild.nodeValue===l.firstChild.nodeValue);var u=t.getElementsByTagName("head")[0];if(null===a||!1===o){var c=i&&i.nextSibling||null;c?c.parentNode.insertBefore(l,c):u.appendChild(l)}if(a&&!1===o&&a.parentNode.removeChild(a),l.styleSheet)try{l.styleSheet.cssText=n}catch(e){throw new Error("Couldn't reassign styleSheet.cssText.")}},i=function(e){var t,n=e.document;return n.currentScript||(t=n.getElementsByTagName("script"))[t.length-1]},r={error:function(e){this._fireEvent("error",e)},warn:function(e){this._fireEvent("warn",e)},info:function(e){this._fireEvent("info",e)},debug:function(e){this._fireEvent("debug",e)},addListener:function(e){this._listeners.push(e)},removeListener:function(e){for(var t=0;t=0;o--){var l=a[o];if(l[s?"supportsSync":"supports"](e,t,n,i))return l}return null},e.prototype.addFileManager=function(e){this.fileManagers.push(e)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},e}(),a={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},o={length:{m:1,cm:.01,mm:.001,in:.0254,px:.0254/96,pt:.0254/72,pc:.0254/72*12},duration:{s:1,ms:.001},angle:{rad:1/(2*Math.PI),deg:1/360,grad:1/400,turn:1}},l={colors:a,unitConversions:o},u=function(){function e(){this.parent=null,this.visibilityBlocks=void 0,this.nodeVisible=void 0,this.rootNode=null,this.parsed=null}return Object.defineProperty(e.prototype,"currentFileInfo",{get:function(){return this.fileInfo()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.getIndex()},enumerable:!1,configurable:!0}),e.prototype.setParent=function(t,n){function i(t){t&&t instanceof e&&(t.parent=n)}Array.isArray(t)?t.forEach(i):i(t)},e.prototype.getIndex=function(){return this._index||this.parent&&this.parent.getIndex()||0},e.prototype.fileInfo=function(){return this._fileInfo||this.parent&&this.parent.fileInfo()||{}},e.prototype.isRulesetLike=function(){return!1},e.prototype.toCSS=function(e){var t=[];return this.genCSS(e,{add:function(e,n,i){t.push(e)},isEmpty:function(){return 0===t.length}}),t.join("")},e.prototype.genCSS=function(e,t){t.add(this.value)},e.prototype.accept=function(e){this.value=e.visit(this.value)},e.prototype.eval=function(){return this},e.prototype._operate=function(e,t,n,i){switch(t){case"+":return n+i;case"-":return n-i;case"*":return n*i;case"/":return n/i}},e.prototype.fround=function(e,t){var n=e&&e.numPrecision;return n?Number((t+2e-16).toFixed(n)):t},e.compare=function(t,n){if(t.compare&&"Quoted"!==n.type&&"Anonymous"!==n.type)return t.compare(n);if(n.compare)return-n.compare(t);if(t.type===n.type){if(t=t.value,n=n.value,!Array.isArray(t))return t===n?0:void 0;if(t.length===n.length){for(var i=0;it?1:void 0},e.prototype.blocksVisibility=function(){return void 0===this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},e.prototype.addVisibilityBlock=function(){void 0===this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},e.prototype.removeVisibilityBlock=function(){void 0===this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},e.prototype.ensureVisibility=function(){this.nodeVisible=!0},e.prototype.ensureInvisibility=function(){this.nodeVisible=!1},e.prototype.isVisible=function(){return this.nodeVisible},e.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},e.prototype.copyVisibilityInfo=function(e){e&&(this.visibilityBlocks=e.visibilityBlocks,this.nodeVisible=e.nodeVisible)},e}(),c=function(e,t,n){var i=this;Array.isArray(e)?this.rgb=e:e.length>=6?(this.rgb=[],e.match(/.{2}/g).map((function(e,t){t<3?i.rgb.push(parseInt(e,16)):i.alpha=parseInt(e,16)/255}))):(this.rgb=[],e.split("").map((function(e,t){t<3?i.rgb.push(parseInt(e+e,16)):i.alpha=parseInt(e+e,16)/255}))),this.alpha=this.alpha||("number"==typeof t?t:1),void 0!==n&&(this.value=n)};function h(e,t){return Math.min(Math.max(e,0),t)}function f(e){return"#".concat(e.map((function(e){return((e=h(Math.round(e),255))<16?"0":"")+e.toString(16)})).join(""))}c.prototype=Object.assign(new u,{type:"Color",luma:function(){var e=this.rgb[0]/255,t=this.rgb[1]/255,n=this.rgb[2]/255;return.2126*(e=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*(t=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(n=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))},genCSS:function(e,t){t.add(this.toCSS(e))},toCSS:function(e,t){var n,i,r,s=e&&e.compress&&!t,a=[];if(i=this.fround(e,this.alpha),this.value)if(0===this.value.indexOf("rgb"))i<1&&(r="rgba");else{if(0!==this.value.indexOf("hsl"))return this.value;r=i<1?"hsla":"hsl"}else i<1&&(r="rgba");switch(r){case"rgba":a=this.rgb.map((function(e){return h(Math.round(e),255)})).concat(h(i,1));break;case"hsla":a.push(h(i,1));case"hsl":n=this.toHSL(),a=[this.fround(e,n.h),"".concat(this.fround(e,100*n.s),"%"),"".concat(this.fround(e,100*n.l),"%")].concat(a)}if(r)return"".concat(r,"(").concat(a.join(",".concat(s?"":" ")),")");if(n=this.toRGB(),s){var o=n.split("");o[1]===o[2]&&o[3]===o[4]&&o[5]===o[6]&&(n="#".concat(o[1]).concat(o[3]).concat(o[5]))}return n},operate:function(e,t,n){for(var i=new Array(3),r=this.alpha*(1-n.alpha)+n.alpha,s=0;s<3;s++)i[s]=this._operate(e,t,this.rgb[s],n.rgb[s]);return new c(i,r)},toRGB:function(){return f(this.rgb)},toHSL:function(){var e,t,n=this.rgb[0]/255,i=this.rgb[1]/255,r=this.rgb[2]/255,s=this.alpha,a=Math.max(n,i,r),o=Math.min(n,i,r),l=(a+o)/2,u=a-o;if(a===o)e=t=0;else{switch(t=l>.5?u/(2-a-o):u/(a+o),a){case n:e=(i-r)/u+(iC(e,t));if("Object"!==S(n=e)||n.constructor!==Object||Object.getPrototypeOf(n)!==Object.prototype)return e;var n;return[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)].reduce((n,i)=>{if(I(t.props)&&!t.props.includes(i))return n;return function(e,t,n,i,r){const s={}.propertyIsEnumerable.call(i,t)?"enumerable":"nonenumerable";"enumerable"===s&&(e[t]=n),r&&"nonenumerable"===s&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}(n,i,C(e[i],t),e,t.nonenumerable),n},{})}function k(e,t){for(var n=e+1,i=null,r=-1;--n>=0&&"\n"!==t.charAt(n);)r++;return"number"==typeof e&&(i=(t.slice(0,e).match(/\n/g)||"").length),{line:i,column:r}}function A(e){var t,n=e.length,i=new Array(n);for(t=0;t|Function):(\d+):(\d+)/,F=function(e,t,n){Error.call(this);var i=e.filename||n;if(this.message=e.message,this.stack=e.stack,t&&i){var r=t.contents[i],s=k(e.index,r),a=s.line,o=s.column,l=e.call&&k(e.call,r).line,u=r?r.split("\n"):"";if(this.type=e.type||"Syntax",this.filename=i,this.index=e.index,this.line="number"==typeof a?a+1:null,this.column=o,!this.line&&this.stack){var c=this.stack.match($),h=new Function("a","throw new Error()"),f=0;try{h()}catch(e){var p=e.stack.match($);f=1-parseInt(p[2])}c&&(c[2]&&(this.line=parseInt(c[2])+f),c[3]&&(this.column=parseInt(c[3])))}this.callLine=l+1,this.callExtract=u[l],this.extract=[u[this.line-2],u[this.line-1],u[this.line]]}};if(void 0===Object.create){var V=function(){};V.prototype=Error.prototype,F.prototype=new V}else F.prototype=Object.create(Error.prototype);F.prototype.constructor=F,F.prototype.toString=function(e){var t;e=e||{};var n=(null!==(t=this.type)&&void 0!==t?t:"").toLowerCase().includes("warning"),i=n?this.type:"".concat(this.type,"Error"),r=n?"yellow":"red",s="",a=this.extract||[],o=[],l=function(e){return e};if(e.stylize){var u=typeof e.stylize;if("function"!==u)throw Error("options.stylize should be a function, got a ".concat(u,"!"));l=e.stylize}if(null!==this.line){if(n||"string"!=typeof a[0]||o.push(l("".concat(this.line-1," ").concat(a[0]),"grey")),"string"==typeof a[1]){var c="".concat(this.line," ");a[1]&&(c+=a[1].slice(0,this.column)+l(l(l(a[1].substr(this.column,1),"bold")+a[1].slice(this.column+1),"red"),"inverse")),o.push(c)}n||"string"!=typeof a[2]||o.push(l("".concat(this.line+1," ").concat(a[2]),"grey")),o="".concat(o.join("\n")+l("","reset"),"\n")}return s+=l("".concat(i,": ").concat(this.message),r),this.filename&&(s+=l(" in ",r)+this.filename),this.line&&(s+=l(" on line ".concat(this.line,", column ").concat(this.column+1,":"),"grey")),s+="\n".concat(o),this.callLine&&(s+="".concat(l("from ",r)+(this.filename||""),"/n"),s+="".concat(l(this.callLine,"grey")," ").concat(this.callExtract,"/n")),s};var L={visitDeeper:!0},j=!1;function D(e){return e}var N=function(){function e(e){this._implementation=e,this._visitInCache={},this._visitOutCache={},j||(!function e(t,n){var i,r;for(i in t)switch(typeof(r=t[i])){case"function":r.prototype&&r.prototype.type&&(r.prototype.typeIndex=n++);break;case"object":n=e(r,n)}return n}(Ke,1),j=!0)}return e.prototype.visit=function(e){if(!e)return e;var t=e.typeIndex;if(!t)return e.value&&e.value.typeIndex&&this.visit(e.value),e;var n,i=this._implementation,r=this._visitInCache[t],s=this._visitOutCache[t],a=L;if(a.visitDeeper=!0,r||(r=i[n="visit".concat(e.type)]||D,s=i["".concat(n,"Out")]||D,this._visitInCache[t]=r,this._visitOutCache[t]=s),r!==D){var o=r.call(i,e,a);e&&i.isReplacing&&(e=o)}if(a.visitDeeper&&e)if(e.length)for(var l=0,u=e.length;ly.PARENS_DIVISION)||this.parensStack&&this.parensStack.length))},B.Eval.prototype.pathRequiresRewrite=function(e){return(this.rewriteUrls===w?G:z)(e)},B.Eval.prototype.rewritePath=function(e,t){var n;return t=t||"",n=this.normalizePath(t+e),G(e)&&z(t)&&!1===G(n)&&(n="./".concat(n)),n},B.Eval.prototype.normalizePath=function(e){var t,n=e.split("/").reverse();for(e=[];0!==n.length;)switch(t=n.pop()){case".":break;case"..":0===e.length||".."===e[e.length-1]?e.push(t):e.pop();break;default:e.push(t)}return e.join("/")};var W=function(){function e(e){this.imports=[],this.variableImports=[],this._onSequencerEmpty=e,this._currentDepth=0}return e.prototype.addImport=function(e){var t=this,n={callback:e,args:null,isReady:!1};return this.imports.push(n),function(){n.args=Array.prototype.slice.call(arguments,0),n.isReady=!0,t.tryRun()}},e.prototype.addVariableImport=function(e){this.variableImports.push(e)},e.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var e=this.imports[0];if(!e.isReady)return;this.imports=this.imports.slice(1),e.callback.apply(null,e.args)}if(0===this.variableImports.length)break;var t=this.variableImports[0];this.variableImports=this.variableImports.slice(1),t()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},e}(),J=function(e,t){this._visitor=new N(this),this._importer=e,this._finish=t,this.context=new B.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new W(this._onSequencerEmpty.bind(this))};J.prototype={isReplacing:!1,run:function(e){try{this._visitor.visit(e)}catch(e){this.error=e}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(e,t){var n=e.options.inline;if(!e.css||n){var i=new B.Eval(this.context,A(this.context.frames)),r=i.frames[0];this.importCount++,e.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,e,i,r)):this.processImportNode(e,i,r)}t.visitDeeper=!1},processImportNode:function(e,t,n){var i,r=e.options.inline;try{i=e.evalForImport(t)}catch(t){t.filename||(t.index=e.getIndex(),t.filename=e.fileInfo().filename),e.css=!0,e.error=t}if(!i||i.css&&!r)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{i.options.multiple&&(t.importMultiple=!0);for(var s=void 0===i.css,a=0;a=0||(o=[u.selfSelectors[0]],(s=f.findMatch(l,o)).length&&(l.hasFoundMatches=!0,l.selfSelectors.forEach((function(e){var t=u.visibilityInfo();a=f.extendSelector(s,o,e,l.isVisible()),(c=new Ke.Extend(u.selector,u.option,0,u.fileInfo(),t)).selfSelectors=a,a[a.length-1].extendList=[c],h.push(c),c.ruleset=u.ruleset,c.parent_ids=c.parent_ids.concat(u.parent_ids,l.parent_ids),u.firstExtendOnThisSelectorPath&&(c.firstExtendOnThisSelectorPath=!0,u.ruleset.paths.push(a))}))));if(h.length){if(this.extendChainCount++,n>100){var p="{unable to calculate}",v="{unable to calculate}";try{p=h[0].selfSelectors[0].toCSS(),v=h[0].selector.toCSS()}catch(e){}throw{message:"extend circular reference detected. One of the circular extends is currently:".concat(p,":extend(").concat(v,")")}}return h.concat(f.doExtendChaining(h,t,n+1))}return h},e.prototype.visitDeclaration=function(e,t){t.visitDeeper=!1},e.prototype.visitMixinDefinition=function(e,t){t.visitDeeper=!1},e.prototype.visitSelector=function(e,t){t.visitDeeper=!1},e.prototype.visitRuleset=function(e,t){if(!e.root){var n,i,r,s,a=this.allExtendsStack[this.allExtendsStack.length-1],o=[],l=this;for(r=0;r0&&u[l.matched].combinator.value!==a?l=null:l.matched++,l&&(l.finished=l.matched===u.length,l.finished&&!e.allowAfter&&(r+1u&&c>0&&(h[h.length-1].elements=h[h.length-1].elements.concat(t[u].elements.slice(c)),c=0,u++),l=s.elements.slice(c,o.index).concat([a]).concat(n.elements.slice(1)),u===o.pathIndex&&r>0?h[h.length-1].elements=h[h.length-1].elements.concat(l):(h=h.concat(t.slice(u,o.pathIndex))).push(new Ke.Selector(l)),u=o.endPathIndex,(c=o.endPathElementIndex)>=t[u].elements.length&&(c=0,u++);return u0&&(h[h.length-1].elements=h[h.length-1].elements.concat(t[u].elements.slice(c)),u++),h=(h=h.concat(t.slice(u,t.length))).map((function(e){var t=e.createDerived(e.elements);return i?t.ensureVisibility():t.ensureInvisibility(),t}))},e.prototype.visitMedia=function(e,t){var n=e.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);n=n.concat(this.doExtendChaining(n,e.allExtends)),this.allExtendsStack.push(n)},e.prototype.visitMediaOut=function(e){var t=this.allExtendsStack.length-1;this.allExtendsStack.length=t},e.prototype.visitAtRule=function(e,t){var n=e.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);n=n.concat(this.doExtendChaining(n,e.allExtends)),this.allExtendsStack.push(n)},e.prototype.visitAtRuleOut=function(e){var t=this.allExtendsStack.length-1;this.allExtendsStack.length=t},e}(),Z=function(){function e(){this.contexts=[[]],this._visitor=new N(this)}return e.prototype.run=function(e){return this._visitor.visit(e)},e.prototype.visitDeclaration=function(e,t){t.visitDeeper=!1},e.prototype.visitMixinDefinition=function(e,t){t.visitDeeper=!1},e.prototype.visitRuleset=function(e,t){var n,i=this.contexts[this.contexts.length-1],r=[];this.contexts.push(r),e.root||((n=e.selectors)&&(n=n.filter((function(e){return e.getIsOutput()})),e.selectors=n.length?n:n=null,n&&e.joinSelectors(r,i,n)),n||(e.rules=null),e.paths=r)},e.prototype.visitRulesetOut=function(e){this.contexts.length=this.contexts.length-1},e.prototype.visitMedia=function(e,t){var n=this.contexts[this.contexts.length-1];e.rules[0].root=0===n.length||n[0].multiMedia},e.prototype.visitAtRule=function(e,t){var n=this.contexts[this.contexts.length-1];e.declarations&&e.declarations.length?e.declarations[0].root=0===n.length||n[0].multiMedia:e.rules&&e.rules.length&&(e.rules[0].root=e.isRooted||0===n.length||null)},e}(),X=function(){function e(e){this._visitor=new N(this),this._context=e}return e.prototype.containsSilentNonBlockedChild=function(e){var t;if(!e)return!1;for(var n=0;n0},e.prototype.resolveVisibility=function(e){if(!e.blocksVisibility()){if(this.isEmpty(e))return;return e}var t=e.rules[0];if(this.keepOnlyVisibleChilds(t),!this.isEmpty(t))return e.ensureVisibility(),e.removeVisibilityBlock(),e},e.prototype.isVisibleRuleset=function(e){return!!e.firstRoot||!this.isEmpty(e)&&!(!e.root&&!this.hasVisibleSelector(e))},e}(),Y=function(e){this._visitor=new N(this),this._context=e,this.utils=new X(e)};Y.prototype={isReplacing:!0,run:function(e){return this._visitor.visit(e)},visitDeclaration:function(e,t){if(!e.blocksVisibility()&&!e.variable)return e},visitMixinDefinition:function(e,t){e.frames=[]},visitExtend:function(e,t){},visitComment:function(e,t){if(!e.blocksVisibility()&&!e.isSilent(this._context))return e},visitMedia:function(e,t){var n=e.rules[0].rules;return e.accept(this._visitor),t.visitDeeper=!1,this.utils.resolveVisibility(e,n)},visitImport:function(e,t){if(!e.blocksVisibility())return e},visitAtRule:function(e,t){return e.rules&&e.rules.length?this.visitAtRuleWithBody(e,t):this.visitAtRuleWithoutBody(e,t)},visitAnonymous:function(e,t){if(!e.blocksVisibility())return e.accept(this._visitor),e},visitAtRuleWithBody:function(e,t){var n=function(e){var t=e.rules;return function(e){var t=e.rules;return 1===t.length&&(!t[0].paths||0===t[0].paths.length)}(e)?t[0].rules:t}(e);return e.accept(this._visitor),t.visitDeeper=!1,this.utils.isEmpty(e)||this._mergeRules(e.rules[0].rules),this.utils.resolveVisibility(e,n)},visitAtRuleWithoutBody:function(e,t){if(!e.blocksVisibility()){if("@charset"===e.name){if(this.charset){if(e.debugInfo){var n=new Ke.Comment("/* ".concat(e.toCSS(this._context).replace(/\n/g,"")," */\n"));return n.debugInfo=e.debugInfo,this._visitor.visit(n)}return}this.charset=!0}return e}},checkValidNodes:function(e,t){if(e)for(var n=0;n0?e.accept(this._visitor):e.rules=null,t.visitDeeper=!1}return e.rules&&(this._mergeRules(e.rules),this._removeDuplicateRules(e.rules)),this.utils.isVisibleRuleset(e)&&(e.ensureVisibility(),i.splice(0,0,e)),1===i.length?i[0]:i},_compileRulesetPaths:function(e){e.paths&&(e.paths=e.paths.filter((function(e){var t;for(" "===e[0].elements[0].combinator.value&&(e[0].elements[0].combinator=new Ke.Combinator("")),t=0;t=0;i--)if((n=e[i])instanceof Ke.Declaration)if(r[n.name]){(t=r[n.name])instanceof Ke.Declaration&&(t=r[n.name]=[r[n.name].toCSS(this._context)]);var s=n.toCSS(this._context);-1!==t.indexOf(s)?e.splice(i,1):t.push(s)}else r[n.name]=n}},_mergeRules:function(e){if(e){for(var t={},n=[],i=0;i0){var t=e[0],n=[],i=[new Ke.Expression(n)];e.forEach((function(e){"+"===e.merge&&n.length>0&&i.push(new Ke.Expression(n=[])),n.push(e.value),t.important=t.important||e.important})),t.value=new Ke.Value(i)}}))}}};var ee={Visitor:N,ImportVisitor:J,MarkVisibleSelectorsVisitor:K,ExtendVisitor:Q,JoinSelectorVisitor:Z,ToCSSVisitor:Y};var te=function(){var e,t,n,i,r,s,a,o=[],l={};function u(n){for(var i,o,c,h=l.i,f=t,p=l.i-a,v=l.i+s.length-p,d=l.i+=n,m=e;l.i=0){c={index:l.i,text:m.substr(l.i,y+2-l.i),isLineComment:!1},l.i+=c.text.length-1,l.commentStore.push(c);continue}}break}if(32!==i&&10!==i&&9!==i&&13!==i)break}if(s=s.slice(n+l.i-d+p),a=l.i,!s.length){if(tn||l.i===n&&e&&!i)&&(n=l.i,i=e);var r=o.pop();s=r.current,a=l.i=r.i,t=r.j},l.forget=function(){o.pop()},l.isWhitespace=function(t){var n=l.i+(t||0),i=e.charCodeAt(n);return 32===i||13===i||9===i||10===i},l.$re=function(e){l.i>a&&(s=s.slice(l.i-a),a=l.i);var t=e.exec(s);return t?(u(t[0].length),"string"==typeof t?t:1===t.length?t[0]:t):null},l.$char=function(t){return e.charAt(l.i)!==t?null:(u(1),t)},l.$peekChar=function(t){return e.charAt(l.i)!==t?null:t},l.$str=function(t){for(var n=t.length,i=0;ih&&(d=!1)}}while(d);return r||null},l.autoCommentAbsorb=!0,l.commentStore=[],l.finished=!1,l.peek=function(t){if("string"==typeof t){for(var n=0;n57||t<43||47===t||44===t},l.start=function(i,o,c){e=i,l.i=t=a=n=0,r=o?function(e,t){var n,i,r,s,a,o,l,u,c,h=e.length,f=0,p=0,v=[],d=0;function m(t){var n=a-d;n<512&&!t||!n||(v.push(e.slice(d,a+1)),d=a+1)}for(a=0;a=97&&l<=122||l<34))switch(l){case 40:p++,i=a;continue;case 41:if(--p<0)return t("missing opening `(`",a);continue;case 59:p||m();continue;case 123:f++,n=a;continue;case 125:if(--f<0)return t("missing opening `{`",a);f||p||m();continue;case 92:if(a96)){if(u==l){c=1;break}if(92==u){if(a==h-1)return t("unescaped `\\`",a);a++}}if(c)continue;return t("unmatched `".concat(String.fromCharCode(l),"`"),o);case 47:if(p||a==h-1)continue;if(47==(u=e.charCodeAt(a+1)))for(a+=2;an&&s>r?"missing closing `}` or `*/`":"missing closing `}`",n):0!==p?t("missing closing `)`",i):(m(!0),v)}(i,c):[i],s=r[0],u(0)},l.end=function(){var t,r=l.i>=e.length;return l.i=e.length-1,furthestChar:e[l.i]}},l};var ne=function e(t){return{_data:{},add:function(e,t){e=e.toLowerCase(),this._data.hasOwnProperty(e),this._data[e]=t},addMultiple:function(e){var t=this;Object.keys(e).forEach((function(n){t.add(n,e[n])}))},get:function(e){return this._data[e]||t&&t.get(e)},getLocalFunctions:function(){return this._data},inherit:function(){return e(this)},create:function(t){return e(t)}}}(null),ie={queryInParens:!0},re={queryInParens:!0},se=function(e,t,n,i,r,s){this.value=e,this._index=t,this._fileInfo=n,this.mapLines=i,this.rulesetLike=void 0!==r&&r,this.allowRoot=!0,this.copyVisibilityInfo(s)};se.prototype=Object.assign(new u,{type:"Anonymous",eval:function(){return new se(this.value,this._index,this._fileInfo,this.mapLines,this.rulesetLike,this.visibilityInfo())},compare:function(e){return e.toCSS&&this.toCSS()===e.toCSS()?0:void 0},isRulesetLike:function(){return this.rulesetLike},genCSS:function(e,t){this.nodeVisible=Boolean(this.value),this.nodeVisible&&t.add(this.value,this._fileInfo,this._index,this.mapLines)}});var ae=function e(t,n,i,s){var a;s=s||0;var o=te();function l(e,t){throw new F({index:o.i,filename:i.filename,type:t||"Syntax",message:e},n)}function u(e,s,a){t.quiet||r.warn(new F({index:null!=s?s:o.i,filename:i.filename,type:a?"".concat(a.toUpperCase()," WARNING"):"WARNING",message:e},n).toString())}function c(e,t){var n=e instanceof Function?e.call(a):o.$re(e);if(n)return n;l(t||("string"==typeof e?"expected '".concat(e,"' got '").concat(o.currentChar(),"'"):"unexpected token"))}function h(e,t){if(o.$char(e))return e;l(t||"expected '".concat(e,"' got '").concat(o.currentChar(),"'"))}function f(e){var t=i.filename;return{lineNumber:k(e,o.getInput()).line+1,fileName:t}}return{parserInput:o,imports:n,fileInfo:i,parseNode:function(e,t,r){var l,u=[],c=o;try{c.start(e,!1,(function(e,t){r({message:e,index:t+s})}));for(var h=0,f=void 0;f=t[h];h++)l=a[f](),u.push(l||null);c.end().isFinished?r(null,u):r(!0,null)}catch(e){throw new F({index:e.index+s,message:e.message},n,i.filename)}},parse:function(r,s,u){var c,h,f,p,v=null,d="";if(u&&u.disablePluginRule&&(a.plugin=function(){o.$re(/^@plugin?\s+/)&&l("@plugin statements are not allowed when disablePluginRule is set to true")}),h=u&&u.globalVars?"".concat(e.serializeVars(u.globalVars),"\n"):"",f=u&&u.modifyVars?"\n".concat(e.serializeVars(u.modifyVars)):"",t.pluginManager)for(var m=t.pluginManager.getPreProcessors(),g=0;g");return e},args:function(e){var t,n,i,r,s,u,c,h=a.entities,f={args:null,variadic:!1},p=[],v=[],d=[],m=!0;for(o.save();;){if(e)u=a.detachedRuleset()||a.expression();else{if(o.commentStore.length=0,o.$str("...")){f.variadic=!0,o.$char(";")&&!t&&(t=!0),(t?v:d).push({variadic:!0});break}u=h.variable()||h.property()||h.literal()||h.keyword()||this.call(!0)}if(!u||!m)break;r=null,u.throwAwayComments&&u.throwAwayComments(),s=u;var g=null;if(e?u.value&&1==u.value.length&&(g=u.value[0]):g=u,g&&(g instanceof Ke.Variable||g instanceof Ke.Property))if(o.$char(":")){if(p.length>0&&(t&&l("Cannot mix ; and , as delimiter types"),n=!0),!(s=a.detachedRuleset()||a.expression())){if(!e)return o.restore(),f.args=[],f;l("could not understand value for named argument")}r=i=g.name}else if(o.$str("...")){if(!e){f.variadic=!0,o.$char(";")&&!t&&(t=!0),(t?v:d).push({name:u.name,variadic:!0});break}c=!0}else e||(i=r=g.name,s=null);s&&p.push(s),d.push({name:r,value:s,expand:c}),o.$char(",")?m=!0:((m=";"===o.$char(";"))||t)&&(n&&l("Cannot mix ; and , as delimiter types"),t=!0,p.length>1&&(s=new Ke.Value(p)),v.push({name:i,value:s,expand:c}),i=null,p=[],n=!1)}return o.forget(),f.args=t?v:d,f},definition:function(){var e,t,n,i,r=[],s=!1;if(!("."!==o.currentChar()&&"#"!==o.currentChar()||o.peek(/^[^{]*\}/)))if(o.save(),t=o.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){e=t[1];var l=this.args(!1);if(r=l.args,s=l.variadic,!o.$char(")"))return void o.restore("Missing closing ')'");if(o.commentStore.length=0,o.$str("when")&&(i=c(a.conditions,"expected condition")),n=a.block())return o.forget(),new Ke.mixin.Definition(e,r,n,i,s);o.restore()}else o.restore()},ruleLookups:function(){var e,t=[];if("["===o.currentChar()){for(;;){if(o.save(),!(e=this.lookupValue())&&""!==e){o.restore();break}t.push(e),o.forget()}return t.length>0?t:void 0}},lookupValue:function(){if(o.save(),o.$char("[")){var e=o.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/);if(o.$char("]"))return e||""===e?(o.forget(),e):void o.restore();o.restore()}else o.restore()}},entity:function(){var e=this.entities;return this.comment()||e.literal()||e.variable()||e.url()||e.property()||e.call()||e.keyword()||this.mixin.call(!0)||e.javascript()},end:function(){return o.$char(";")||o.peek("}")},ieAlpha:function(){var e;if(o.$re(/^opacity=/i))return(e=o.$re(/^\d+/))||(e=c(a.entities.variable,"Could not parse alpha"),e="@{".concat(e.name.slice(1),"}")),h(")"),new Ke.Quoted("","alpha(opacity=".concat(e,")"))},element:function(){var e,t,n,r=o.i;if(t=this.combinator(),!(e=o.$re(/^(?:\d+\.\d+|\d+)%/)||o.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||o.$char("*")||o.$char("&")||this.attribute()||o.$re(/^\([^&()@]+\)/)||o.$re(/^[.#:](?=@)/)||this.entities.variableCurly()))if(o.save(),o.$char("("))if(n=this.selector(!1)){for(var a=[];o.$char(",");)a.push(n),a.push(new se(",")),n=this.selector(!1);a.push(n),o.$char(")")?(e=a.length>1?new Ke.Paren(new oe(a)):new Ke.Paren(n),o.forget()):o.restore("Missing closing ')'")}else o.restore("Missing closing ')'");else o.forget();if(e)return new Ke.Element(t,e,e instanceof Ke.Variable,r+s,i)},combinator:function(){var e=o.currentChar();if("/"===e){o.save();var t=o.$re(/^\/[a-z]+\//i);if(t)return o.forget(),new Ke.Combinator(t);o.restore()}if(">"===e||"+"===e||"~"===e||"|"===e||"^"===e){for(o.i++,"^"===e&&"^"===o.currentChar()&&(e="^^",o.i++);o.isWhitespace();)o.i++;return new Ke.Combinator(e)}return o.isWhitespace(-1)?new Ke.Combinator(" "):new Ke.Combinator(null)},selector:function(e){var t,n,r,a,u,h,f,p=o.i;for(e=!1!==e;(e&&(n=this.extend())||e&&(h=o.$str("when"))||(a=this.element()))&&(h?f=c(this.conditions,"expected condition"):f?l("CSS guard can only be used at the end of selector"):n?u=u?u.concat(n):n:(u&&l("Extend can only be used at the end of selector"),r=o.currentChar(),Array.isArray(a)&&a.forEach((function(e){return t.push(e)})),t?t.push(a):t=[a],a=null),"{"!==r&&"}"!==r&&";"!==r&&","!==r&&")"!==r););if(t)return new Ke.Selector(t,u,f,p+s,i);u&&l("Extend must be used to extend a selector, it cannot be used on its own")},selectors:function(){for(var e,t;(e=this.selector())&&(t?t.push(e):t=[e],o.commentStore.length=0,e.condition&&t.length>1&&l("Guards are only currently allowed on a single selector."),o.$char(","));)e.condition&&l("Guards are only currently allowed on a single selector."),o.commentStore.length=0;return t},attribute:function(){if(o.$char("[")){var e,t,n,i,r=this.entities;return(e=r.variableCurly())||(e=c(/^(?:[_A-Za-z0-9-*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),(n=o.$re(/^[|~*$^]?=/))&&(t=r.quoted()||o.$re(/^[0-9]+%/)||o.$re(/^[\w-]+/)||r.variableCurly())&&(i=o.$re(/^[iIsS]/)),h("]"),new Ke.Attribute(e,n,t,i)}},block:function(){var e;if(o.$char("{")&&(e=this.primary())&&o.$char("}"))return e},blockRuleset:function(){var e=this.block();return e&&(e=new Ke.Ruleset(null,e)),e},detachedRuleset:function(){var e,t,n;if(o.save(),!o.$re(/^[.#]\(/)||(t=(e=this.mixin.args(!1)).args,n=e.variadic,o.$char(")"))){var i=this.blockRuleset();if(i)return o.forget(),t?new Ke.mixin.Definition(null,t,i,null,n):new Ke.DetachedRuleset(i);o.restore()}else o.restore()},ruleset:function(){var e,n,i;if(o.save(),t.dumpLineNumbers&&(i=f(o.i)),(e=this.selectors())&&(n=this.block())){o.forget();var r=new Ke.Ruleset(e,n,t.strictImports);return t.dumpLineNumbers&&(r.debugInfo=i),r}o.restore()},declaration:function(){var e,t,n,r,a,l,u=o.i,c=o.currentChar();if("."!==c&&"#"!==c&&"&"!==c&&":"!==c)if(o.save(),e=this.variable()||this.ruleProperty()){if((l="string"==typeof e)&&(t=this.detachedRuleset())&&(n=!0),o.commentStore.length=0,!t){if(a=!l&&e.length>1&&e.pop().value,t=e[0].value&&"--"===e[0].value.slice(0,2)?o.$char(";")?new se(""):this.permissiveValue(/[;}]/,!0):this.anonymousValue())return o.forget(),new Ke.Declaration(e,t,!1,a,u+s,i);t||(t=this.value()),t?r=this.important():l&&(t=this.permissiveValue())}if(t&&(this.end()||n))return o.forget(),new Ke.Declaration(e,t,r,a,u+s,i);o.restore()}else o.restore()},anonymousValue:function(){var e=o.i,t=o.$re(/^([^.#@$+/'"*`(;{}-]*);/);if(t)return new Ke.Anonymous(t[1],e+s)},permissiveValue:function(e){var t,n,r,s,a=e||";",c=o.i,h=[];function f(){var e=o.currentChar();return"string"==typeof a?e===a:a.test(e)}if(!f()){s=[];do{(n=this.comment())?s.push(n):((n=this.entity())&&s.push(n),o.peek(",")&&(s.push(new Ke.Anonymous(",",o.i)),o.$char(",")))}while(n);if(r=f(),s.length>0){if(s=new Ke.Expression(s),r)return s;h.push(s)," "===o.prevChar()&&h.push(new Ke.Anonymous(" ",c))}if(o.save(),s=o.$parseUntil(a)){if("string"==typeof s&&l("Expected '".concat(s,"'"),"Parse"),1===s.length&&" "===s[0])return o.forget(),new Ke.Anonymous("",c);var p=void 0;for(t=0;t]=|<=|>=|[<>]|=)/)?(o.restore(),n=this.condition(),o.save(),(r=this.atomicCondition(null,n.rvalue))||o.restore()):(o.restore(),t=this.value()),o.$char(")")?n&&!t?(u.push(new Ke.Paren(new Ke.QueryInParens(n.op,n.lvalue,n.rvalue,r?r.op:null,r?r.rvalue:null,n._index))),t=n):n&&t?(u.push(new Ke.Paren(new Ke.Declaration(n,t,null,null,o.i+s,i,!0))),c||(u[u.length-1].noSpacing=!0),c=!1):t?(u.push(new Ke.Paren(t)),c=!1):l("badly formed media feature definition"):l("Missing closing ')'","Parse"))}while(t);if(o.forget(),u.length>0)return new Ke.Expression(u)},mediaFeatures:function(e){var t,n=this.entities,i=[];do{if(t=this.mediaFeature(e)){if(i.push(t),!o.$char(","))break;i[i.length-1].noSpacing||(i[i.length-1].noSpacing=!1)}else if(t=n.variable()||n.mixinLookup()){if(i.push(t),!o.$char(","))break;i[i.length-1].noSpacing||(i[i.length-1].noSpacing=!1)}}while(t);return i.length>0?i:null},prepareAndGetNestableAtRule:function(e,n,r,a){var u=this.mediaFeatures(a),c=this.block();c||l("media definitions require block statements after any features"),o.forget();var h=new e(c,u,n+s,i);return t.dumpLineNumbers&&(h.debugInfo=r),h},nestableAtRule:function(){var e,n=o.i;if(t.dumpLineNumbers&&(e=f(n)),o.save(),o.$peekChar("@")){if(o.$str("@media"))return this.prepareAndGetNestableAtRule(Ke.Media,n,e,ie);if(o.$str("@container"))return this.prepareAndGetNestableAtRule(Ke.Container,n,e,re)}o.restore()},plugin:function(){var e,t,n,r=o.i;if(o.$re(/^@plugin\s+/)){if(n=(t=this.pluginArgs())?{pluginArgs:t,isPlugin:!0}:{isPlugin:!0},e=this.entities.quoted()||this.entities.url())return o.$char(";")||(o.i=r,l("missing semi-colon on @plugin")),new Ke.Import(e,null,n,r+s,i);o.i=r,l("malformed @plugin statement")}},pluginArgs:function(){if(o.save(),!o.$char("("))return o.restore(),null;var e=o.$re(/^\s*([^);]+)\)\s*/);return e[1]?(o.forget(),e[1].trim()):(o.restore(),null)},atruleUnknown:function(e,t,n){return e=this.permissiveValue(/^[{;]/),n="{"===o.currentChar(),e?e.value||(e=null):n||";"===o.currentChar()||l("".concat(t," rule is missing block or ending semi-colon")),[e,n]},atruleBlock:function(e,t,n,i){if(e=this.blockRuleset(),o.save(),e||n||(t=this.entity(),e=this.blockRuleset()),e||n)o.forget();else{o.restore();var r=[];for(t=this.entity();o.$char(",");)r.push(t),t=this.entity();t&&r.length>0?(r.push(t),t=r,i=!0):e=this.blockRuleset()}return[e,t,i]},atrule:function(){var e,n,r,a,u,c,h,p=o.i,v=!0,d=!0,m=!1;if("@"===o.currentChar()){if(n=this.import()||this.plugin()||this.nestableAtRule())return n;if(o.save(),e=o.$re(/^@[a-z-]+/)){switch(a=e,"-"==e.charAt(1)&&e.indexOf("-",2)>0&&(a="@".concat(e.slice(e.indexOf("-",2)+1))),a){case"@charset":u=!0,v=!1;break;case"@namespace":c=!0,v=!1;break;case"@keyframes":case"@counter-style":u=!0;break;case"@document":case"@supports":h=!0,d=!1;break;case"@starting-style":case"@layer":d=!1;break;default:h=!0}if(o.commentStore.length=0,u)(n=this.entity())||l("expected ".concat(e," identifier"));else if(c)(n=this.expression())||l("expected ".concat(e," expression"));else if(h){n=(g=this.atruleUnknown(n,e,v))[0],v=g[1]}if(v){var g,y=this.atruleBlock(r,n,d,m);if(r=y[0],n=y[1],m=y[2],!r&&!h)o.restore(),e=o.$re(/^@[a-z-]+/),n=(g=this.atruleUnknown(n,e,v))[0],(v=g[1])&&(r=(y=this.atruleBlock(r,n,d,m))[0],n=y[1],m=y[2])}if(r||m||!v&&n&&o.$char(";"))return o.forget(),new Ke.AtRule(e,n,r,p+s,i,t.dumpLineNumbers?f(p):null,d);o.restore("at-rule options not recognised")}}},value:function(){var e,t=[],n=o.i;do{if((e=this.expression())&&(t.push(e),!o.$char(",")))break}while(e);if(t.length>0)return new Ke.Value(t,n+s)},important:function(){if("!"===o.currentChar())return o.$re(/^! *important/)},sub:function(){var e,t;if(o.save(),o.$char("("))return(e=this.addition())&&o.$char(")")?(o.forget(),(t=new Ke.Expression([e])).parens=!0,t):void o.restore("Expected ')'");o.restore()},colorOperand:function(){o.save();var e=o.$re(/^[lchrgbs]\s+/);if(e)return new Ke.Keyword(e[0]);o.restore()},multiplication:function(){var e,t,n,i,r;if(e=this.operand()){for(r=o.isWhitespace(-1);!o.peek(/^\/[*/]/);){if(o.save(),!(n=o.$char("/")||o.$char("*"))){var s=o.i;(n=o.$str("./"))&&u("./ operator is deprecated",s,"DEPRECATED")}if(!n){o.forget();break}if(!(t=this.operand())){o.restore();break}o.forget(),e.parensInOp=!0,t.parensInOp=!0,i=new Ke.Operation(n,[i||e,t],r),r=o.isWhitespace(-1)}return i||e}},addition:function(){var e,t,n,i,r;if(e=this.multiplication()){for(r=o.isWhitespace(-1);(n=o.$re(/^[-+]\s+/)||!r&&(o.$char("+")||o.$char("-")))&&(t=this.multiplication());)e.parensInOp=!0,t.parensInOp=!0,i=new Ke.Operation(n,[i||e,t],r),r=o.isWhitespace(-1);return i||e}},conditions:function(){var e,t,n,i=o.i;if(e=this.condition(!0)){for(;o.peek(/^,\s*(not\s*)?\(/)&&o.$char(",")&&(t=this.condition(!0));)n=new Ke.Condition("or",n||e,t,i+s);return n||e}},condition:function(e){var t,n,i;if(t=this.conditionAnd(e)){if(n=o.$str("or")){if(!(i=this.condition(e)))return;t=new Ke.Condition(n,t,i)}return t}},conditionAnd:function(e){var t,n,i,r,s=this;if(t=(r=s.negatedCondition(e)||s.parenthesisCondition(e))||e?r:s.atomicCondition(e)){if(n=o.$str("and")){if(!(i=this.conditionAnd(e)))return;t=new Ke.Condition(n,t,i)}return t}},negatedCondition:function(e){if(o.$str("not")){var t=this.parenthesisCondition(e);return t&&(t.negate=!t.negate),t}},parenthesisCondition:function(e){var t;if(o.save(),o.$str("(")){if(t=function(t){var n;if(o.save(),n=t.condition(e)){if(o.$char(")"))return o.forget(),n;o.restore()}else o.restore()}(this))return o.forget(),t;if(t=this.atomicCondition(e)){if(o.$char(")"))return o.forget(),t;o.restore("expected ')' got '".concat(o.currentChar(),"'"))}else o.restore()}else o.restore()},atomicCondition:function(e,t){var n,i,r,a,u=this.entities,c=o.i,h=function(){return this.addition()||u.keyword()||u.quoted()||u.mixinLookup()}.bind(this);if(n=t||h())return o.$char(">")?a=o.$char("=")?">=":">":o.$char("<")?a=o.$char("=")?"<=":"<":o.$char("=")&&(a=o.$char(">")?"=>":o.$char("<")?"=<":"="),a?(i=h())?r=new Ke.Condition(a,n,i,c+s,!1):l("expected expression"):t||(r=new Ke.Condition("=",n,new Ke.Keyword("true"),c+s,!1)),r},operand:function(){var e,t=this.entities;o.peek(/^-[@$(]/)&&(e=o.$char("-"));var n=this.sub()||t.dimension()||t.color()||t.variable()||t.property()||t.call()||t.quoted(!0)||t.colorKeyword()||this.colorOperand()||t.mixinLookup();return e&&(n.parensInOp=!0,n=new Ke.Negative(n)),n},expression:function(){var e,t,n=[],i=o.i;do{!(e=this.comment())||e.isLineComment?((e=this.addition()||this.entity())instanceof Ke.Comment&&(e=null),e&&(n.push(e),o.peek(/^\/[/*]/)||(t=o.$char("/"))&&n.push(new Ke.Anonymous(t,i+s)))):n.push(e)}while(e);if(n.length>0)return new Ke.Expression(n)},property:function(){var e=o.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(e)return e[1]},ruleProperty:function(){var e,t,n=[],r=[];o.save();var a=o.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(a)return n=[new Ke.Keyword(a[1])],o.forget(),n;function l(e){var t=o.i,i=o.$re(e);if(i)return r.push(t),n.push(i[1])}for(l(/^(\*?)/);l(/^((?:[\w-]+)|(?:[@$]\{[\w-]+\}))/););if(n.length>1&&l(/^((?:\+_|\+)?)\s*:/)){for(o.forget(),""===n[0]&&(n.shift(),r.shift()),t=0;t0;e--){var t=this.rules[e-1];if(t instanceof he)return this.parseValue(t)}},parseValue:function(e){var t=this;function n(e){return e.value instanceof se&&!e.parsed?("string"==typeof e.value.value?new ae(this.parse.context,this.parse.importManager,e.fileInfo(),e.value.getIndex()).parseNode(e.value.value,["value","important"],(function(t,n){t&&(e.parsed=!0),n&&(e.value=n[0],e.important=n[1]||"",e.parsed=!0)})):e.parsed=!0,e):e}if(Array.isArray(e)){var i=[];return e.forEach((function(e){i.push(n.call(t,e))})),i}return n.call(t,e)},rulesets:function(){if(!this.rules)return[];var e,t,n=[],i=this.rules;for(e=0;t=i[e];e++)t.isRuleset&&n.push(t);return n},prependRule:function(e){var t=this.rules;t?t.unshift(e):this.rules=[e],this.setParent(e,this)},find:function(e,t,n){t=t||this;var i,r,s=[],a=e.toCSS();return a in this._lookups?this._lookups[a]:(this.rulesets().forEach((function(a){if(a!==t)for(var o=0;oi){if(!n||n(a)){r=a.find(new oe(e.elements.slice(i)),t,n);for(var l=0;l0&&t.add(l),e.firstSelector=!0,a[0].genCSS(e,t),e.firstSelector=!1,i=1;i0?(s=(r=A(e)).pop(),a=i.createDerived(A(s.elements))):a=i.createDerived([]),t.length>0){var o=n.combinator,l=t[0].elements[0];o.emptyOrWhitespace&&!l.combinator.emptyOrWhitespace&&(o=l.combinator),a.elements.push(new g(o,l.value,n.isVariable,n._index,n._fileInfo)),a.elements=a.elements.concat(t[0].elements.slice(1))}if(0!==a.elements.length&&r.push(a),t.length>1){var u=t.slice(1);u=u.map((function(e){return e.createDerived(e.elements,[])})),r=r.concat(u)}return r}function a(e,t,n,i,r){var a;for(a=0;a0?i[i.length-1]=i[i.length-1].createDerived(i[i.length-1].elements.concat(e)):i.push(new oe(e));else t.push([new oe(e)])}function l(e,t){var n=t.createDerived(t.elements,t.extendList,t.evaldCondition);return n.copyVisibilityInfo(e),n}var u,c;if(!function e(t,n,l){var u,c,h,f,p,d,m,y,b,w,x,S,I=!1;for(f=[],p=[[]],u=0;y=l.elements[u];u++)if("&"!==y.value){var C=(S=void 0,(x=y).value instanceof v&&(S=x.value.value)instanceof oe?S:null);if(null!==C){o(f,p);var k,A=[],_=[];for(k=e(A,n,C),I=I||k,h=0;h0&&m[0].elements.push(new g(y.combinator,"",y.isVariable,y._index,y._fileInfo)),d.push(m);else for(h=0;h0&&(t.push(p[u]),w=p[u][b-1],p[u][b-1]=w.createDerived(w.elements,l.extendList));return I}(c=[],t,n))if(t.length>0)for(c=[],u=0;u0)for(t=0;t-1e-6&&(i=n.toFixed(20).replace(/0+$/,"")),e&&e.compress){if(0===n&&this.unit.isLength())return void t.add(i);n>0&&n<1&&(i=i.substr(1))}t.add(i),this.unit.genCSS(e,t)},operate:function(e,t,n){var i=this._operate(e,t,this.value,n.value),r=this.unit.clone();if("+"===t||"-"===t)if(0===r.numerator.length&&0===r.denominator.length)r=n.unit.clone(),this.unit.backupUnit&&(r.backupUnit=this.unit.backupUnit);else if(0===n.unit.numerator.length&&0===r.denominator.length);else{if(n=n.convertTo(this.unit.usedUnits()),e.strictUnits&&n.unit.toString()!==r.toString())throw new Error("Incompatible units. Change the units or use the unit function. "+"Bad units: '".concat(r.toString(),"' and '").concat(n.unit.toString(),"'."));i=this._operate(e,t,this.value,n.value)}else"*"===t?(r.numerator=r.numerator.concat(n.unit.numerator).sort(),r.denominator=r.denominator.concat(n.unit.denominator).sort(),r.cancel()):"/"===t&&(r.numerator=r.numerator.concat(n.unit.denominator).sort(),r.denominator=r.denominator.concat(n.unit.numerator).sort(),r.cancel());return new be(i,r)},compare:function(e){var t,n;if(e instanceof be){if(this.unit.isEmpty()||e.unit.isEmpty())t=this,n=e;else if(t=this.unify(),n=e.unify(),0!==t.unit.compare(n.unit))return;return u.numericCompare(t.value,n.value)}},unify:function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},convertTo:function(e){var t,n,i,r,s,a=this.value,l=this.unit.clone(),u={};if("string"==typeof e){for(t in o)o[t].hasOwnProperty(e)&&((u={})[t]=e);e=u}for(n in s=function(e,t){return i.hasOwnProperty(e)?(t?a/=i[e]/i[r]:a*=i[e]/i[r],r):e},e)e.hasOwnProperty(n)&&(r=e[n],i=o[n],l.map(s));return l.cancel(),new be(a,l)}});var we=function(e,t){if(this.value=e,this.noSpacing=t,!e)throw new Error("Expression requires an array parameter")};we.prototype=Object.assign(new u,{type:"Expression",accept:function(e){this.value=e.visitArray(this.value)},eval:function(e){var t,n=this.noSpacing,i=e.isMathOn(),r=this.parens,s=!1;return r&&e.inParenthesis(),this.value.length>1?t=new we(this.value.map((function(t){return t.eval?t.eval(e):t})),this.noSpacing):1===this.value.length?(!this.value[0].parens||this.value[0].parensInOp||e.inCalc||(s=!0),t=this.value[0].eval(e)):t=this,r&&e.outOfParenthesis(),!this.parens||!this.parensInOp||i||s||t instanceof be||(t=new v(t)),t.noSpacing=t.noSpacing||n,t},genCSS:function(e,t){for(var n=0;n1){var n=new oe([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();(t=new ge(n,e.mediaBlocks)).multiMedia=!0,t.copyVisibilityInfo(this.visibilityInfo()),this.setParent(t,this)}return delete e.mediaBlocks,delete e.mediaPath,t},evalNested:function(e){var t,n;this.evalFunction();var i=e.mediaPath.concat([this]);for(t=0;t0;t--)e.splice(t,0,new se("and"));return new we(e)}))),this.setParent(this.features,this),new ge([],[])},permute:function(e){if(0===e.length)return[];if(1===e.length)return e[0];for(var t=[],n=this.permute(e.slice(1)),i=0;i0)for(var o=function(t){var o=e.frames[t];if("Ruleset"===o.type&&o.rules&&o.rules.length>0&&o&&!o.root&&o.selectors&&o.selectors.length>0&&(a=a.concat(o.selectors)),a.length>0){for(var l="",u={add:function(e){l+=e}},c=0;c0&&i>0&&!s&&!r;return(this.isRooted&&n>0&&0===i&&!s&&r||!u)&&(t[0].root=!0),t},variable:function(e){if(this.rules)return ge.prototype.variable.call(this.rules[0],e)},find:function(){if(this.rules)return ge.prototype.find.apply(this.rules[0],arguments)},rulesets:function(){if(this.rules)return ge.prototype.rulesets.apply(this.rules[0])},outputRuleset:function(e,t,n){var i,r=n.length;if(e.tabLevel=1+(0|e.tabLevel),e.compress){for(t.add("{"),i=0;i=1)if("Expression"===(o=r[0]).type&&Array.isArray(o.value)&&o.value.length>=2)"Keyword"===(r=o.value)[0].type&&"layer"===r[0].value&&"Paren"===r[1].type&&(this.css=!1)}if(this.options.inline){var s=new se(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},!0,!0);return this.features?new $e([s],this.features.value):[s]}if(this.css||this.layerCss){var a=new Fe(this.evalPath(e),i,this.options,this._index);if(this.layerCss&&(a.css=this.layerCss,a.path._fileInfo=this._fileInfo),!a.css&&this.error)throw this.error;return a}if(this.root){if(this.features){var o;r=this.features.value;if(Array.isArray(r)&&1===r.length)if("Expression"===(o=r[0]).type&&Array.isArray(o.value)&&o.value.length>=2)if("Keyword"===(r=o.value)[0].type&&"layer"===r[0].value&&"Paren"===r[1].type)return this.layerCss=!0,r[0]=new we(r.slice(0,2)),r.splice(1,1),r[0].noSpacing=!0,this}return(t=new ge(null,A(this.root.rules))).evalImports(e),this.features?new $e(t.rules,this.features.value):t.rules}if(this.features){r=this.features.value;if(Array.isArray(r)&&r.length>=1)if(r=r[0].value,Array.isArray(r)&&r.length>=2)if("Keyword"===r[0].type&&"layer"===r[0].value&&"Paren"===r[1].type)return this.css=!0,r[0]=new we(r.slice(0,2)),r.splice(1,1),r[0].noSpacing=!0,this}return[]}});var Ve=function(){};Ve.prototype=Object.assign(new u,{evaluateJavaScript:function(e,t){var n,i=this,r={};if(!t.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};e=e.replace(/@\{([\w-]+)\}/g,(function(e,n){return i.jsify(new Pe("@".concat(n),i.getIndex(),i.fileInfo()).eval(t))}));try{e=new Function("return (".concat(e,")"))}catch(t){throw{message:"JavaScript evaluation error: ".concat(t.message," from `").concat(e,"`"),filename:this.fileInfo().filename,index:this.getIndex()}}var s=t.frames[0].variables();for(var a in s)s.hasOwnProperty(a)&&(r[a.slice(1)]={value:s[a].value,toJS:function(){return this.value.eval(t).toCSS()}});try{n=e.call(r)}catch(e){throw{message:"JavaScript evaluation error: '".concat(e.name,": ").concat(e.message.replace(/["]/g,"'"),"'"),filename:this.fileInfo().filename,index:this.getIndex()}}return n},jsify:function(e){return Array.isArray(e.value)&&e.value.length>1?"[".concat(e.value.map((function(e){return e.toCSS()})).join(", "),"]"):e.toCSS()}});var Le=function(e,t,n,i){this.escaped=t,this.expression=e,this._index=n,this._fileInfo=i};Le.prototype=Object.assign(new Ve,{type:"JavaScript",eval:function(e){var t=this.evaluateJavaScript(this.expression,e),n=typeof t;return"number"!==n||isNaN(t)?"string"===n?new Me('"'.concat(t,'"'),t,this.escaped,this._index):Array.isArray(t)?new se(t.join(", ")):new se(t):new be(t)}});var je=function(e,t){this.key=e,this.value=t};je.prototype=Object.assign(new u,{type:"Assignment",accept:function(e){this.value=e.visit(this.value)},eval:function(e){return this.value.eval?new je(this.key,this.value.eval(e)):this},genCSS:function(e,t){t.add("".concat(this.key,"=")),this.value.genCSS?this.value.genCSS(e,t):t.add(this.value)}});var De=function(e,t,n,i,r){this.op=e.trim(),this.lvalue=t,this.rvalue=n,this._index=i,this.negate=r};De.prototype=Object.assign(new u,{type:"Condition",accept:function(e){this.lvalue=e.visit(this.lvalue),this.rvalue=e.visit(this.rvalue)},eval:function(e){var t=function(e,t,n){switch(e){case"and":return t&&n;case"or":return t||n;default:switch(u.compare(t,n)){case-1:return"<"===e||"=<"===e||"<="===e;case 0:return"="===e||">="===e||"=<"===e||"<="===e;case 1:return">"===e||">="===e;default:return!1}}}(this.op,this.lvalue.eval(e),this.rvalue.eval(e));return this.negate?!t:t}});var Ne=function(e,t,n,i,r,s){this.op=e.trim(),this.lvalue=t,this.mvalue=n,this.op2=i?i.trim():null,this.rvalue=r,this._index=s,this.mvalues=[]};Ne.prototype=Object.assign(new u,{type:"QueryInParens",accept:function(e){this.lvalue=e.visit(this.lvalue),this.mvalue=e.visit(this.mvalue),this.rvalue&&(this.rvalue=e.visit(this.rvalue))},eval:function(e){var t,n;this.lvalue=this.lvalue.eval(e);for(var i=0;(n=e.frames[i])&&("Ruleset"!==n.type||!(t=n.rules.find((function(e){return!!(e instanceof he&&e.variable)}))));i++);return this.mvalueCopy||(this.mvalueCopy=C(this.mvalue)),t?(this.mvalue=this.mvalueCopy,this.mvalue=this.mvalue.eval(e),this.mvalues.push(this.mvalue)):this.mvalue=this.mvalue.eval(e),this.rvalue&&(this.rvalue=this.rvalue.eval(e)),this},genCSS:function(e,t){this.lvalue.genCSS(e,t),t.add(" "+this.op+" "),this.mvalues.length>0&&(this.mvalue=this.mvalues.shift()),this.mvalue.genCSS(e,t),this.rvalue&&(t.add(" "+this.op2+" "),this.rvalue.genCSS(e,t))}});var Be=function(e,t,n,i,r){this._index=n,this._fileInfo=i;var s=new oe([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new le(t),this.rules=[new ge(s,e)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(r),this.allowRoot=!0,this.setParent(s,this),this.setParent(this.features,this),this.setParent(this.rules,this)};Be.prototype=Object.assign(new Se,p(p({type:"Container"},xe),{genCSS:function(e,t){t.add("@container ",this._fileInfo,this._index),this.features.genCSS(e,t),this.outputRuleset(e,t,this.rules)},eval:function(e){e.mediaBlocks||(e.mediaBlocks=[],e.mediaPath=[]);var t=new Be(null,[],this._index,this._fileInfo,this.visibilityInfo());return this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,t.debugInfo=this.debugInfo),t.features=this.features.eval(e),e.mediaPath.push(t),e.mediaBlocks.push(t),this.rules[0].functionRegistry=e.frames[0].functionRegistry.inherit(),e.frames.unshift(this.rules[0]),t.rules=[this.rules[0].eval(e)],e.frames.shift(),e.mediaPath.pop(),0===e.mediaPath.length?t.evalTop(e):t.evalNested(e)}}));var Ue=function(e){this.value=e};Ue.prototype=Object.assign(new u,{type:"UnicodeDescriptor"});var qe=function(e){this.value=e};qe.prototype=Object.assign(new u,{type:"Negative",genCSS:function(e,t){t.add("-"),this.value.genCSS(e,t)},eval:function(e){return e.isMathOn()?new ke("*",[new be(-1),this.value]).eval(e):new qe(this.value.eval(e))}});var Te=function(e,t,n,i,r){switch(this.selector=e,this.option=t,this.object_id=Te.next_id++,this.parent_ids=[this.object_id],this._index=n,this._fileInfo=i,this.copyVisibilityInfo(r),this.allowRoot=!0,t){case"!all":case"all":this.allowBefore=!0,this.allowAfter=!0;break;default:this.allowBefore=!1,this.allowAfter=!1}this.setParent(this.selector,this)};Te.prototype=Object.assign(new u,{type:"Extend",accept:function(e){this.selector=e.visit(this.selector)},eval:function(e){return new Te(this.selector.eval(e),this.option,this.getIndex(),this.fileInfo(),this.visibilityInfo())},clone:function(e){return new Te(this.selector,this.option,this.getIndex(),this.fileInfo(),this.visibilityInfo())},findSelfSelectors:function(e){var t,n,i=[];for(t=0;t0&&n.length&&""===n[0].combinator.value&&(n[0].combinator.value=" "),i=i.concat(e[t].elements);this.selfSelectors=[new oe(i)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())}}),Te.next_id=0;var ze=function(e,t,n){this.variable=e,this._index=t,this._fileInfo=n,this.allowRoot=!0};ze.prototype=Object.assign(new u,{type:"VariableCall",eval:function(e){var t,n=new Pe(this.variable,this.getIndex(),this.fileInfo()).eval(e),i=new F({message:"Could not evaluate variable call ".concat(this.variable)});if(!n.ruleset){if(n.rules)t=n;else if(Array.isArray(n))t=new ge("",n);else{if(!Array.isArray(n.value))throw i;t=new ge("",n.value)}n=new Ie(t)}if(n.ruleset)return n.callEval(e);throw i}});var Ge=function(e,t,n,i){this.value=e,this.lookups=t,this._index=n,this._fileInfo=i};Ge.prototype=Object.assign(new u,{type:"NamespaceValue",eval:function(e){var t,n,i=this.value.eval(e);for(t=0;tthis.params.length)return!1}n=Math.min(s,this.arity);for(var a=0;a0){for(c=!0,o=0;o0)f=2;else if(f=1,p[1]+p[2]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `".concat(this.format(m),"`"),index:this.getIndex(),filename:this.fileInfo().filename};for(o=0;o0&&(e=e.slice(0,t)),(t=e.lastIndexOf("/"))<0&&(t=e.lastIndexOf("\\")),t<0?"":e.slice(0,t+1)},e.prototype.tryAppendExtension=function(e,t){return/(\.[a-z]*$)|([?;].*)$/.test(e)?e:e+t},e.prototype.tryAppendLessExtension=function(e){return this.tryAppendExtension(e,".less")},e.prototype.supportsSync=function(){return!1},e.prototype.alwaysMakePathsAbsolute=function(){return!1},e.prototype.isPathAbsolute=function(e){return/^(?:[a-z-]+:|\/|\\|#)/i.test(e)},e.prototype.join=function(e,t){return e?e+t:t},e.prototype.pathDiff=function(e,t){var n,i,r,s,a=this.extractUrlParts(e),o=this.extractUrlParts(t),l="";if(a.hostPart!==o.hostPart)return"";for(i=Math.max(o.directories.length,a.directories.length),n=0;nparseInt(t[n])?-1:1;return 0},e.prototype.versionToString=function(e){for(var t="",n=0;n1?e-1:e)<1?r+(s-r)*e*6:2*e<1?s:3*e<2?r+(s-r)*(2/3-e)*6:r}try{if(e instanceof c)return i=t?st(t):e.alpha,new c(e.rgb,i,"hsla");e=st(e)%360/360,t=tt(st(t)),n=tt(st(n)),i=tt(st(i)),r=2*n-(s=n<=.5?n*(t+1):n+t-n*t);var o=[255*a(e+1/3),255*a(e),255*a(e-1/3)];return i=st(i),new c(o,i,"hsla")}catch(e){}},hsv:function(e,t,n){return Ye.hsva(e,t,n,1)},hsva:function(e,t,n,i){var r,s;e=st(e)%360/360*360,t=st(t),n=st(n),i=st(i);var a=[n,n*(1-t),n*(1-(s=e/60-(r=Math.floor(e/60%6)))*t),n*(1-(1-s)*t)],o=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return Ye.rgba(255*a[o[r][0]],255*a[o[r][1]],255*a[o[r][2]],i)},hue:function(e){return new be(it(e).h)},saturation:function(e){return new be(100*it(e).s,"%")},lightness:function(e){return new be(100*it(e).l,"%")},hsvhue:function(e){return new be(rt(e).h)},hsvsaturation:function(e){return new be(100*rt(e).s,"%")},hsvvalue:function(e){return new be(100*rt(e).v,"%")},red:function(e){return new be(e.rgb[0])},green:function(e){return new be(e.rgb[1])},blue:function(e){return new be(e.rgb[2])},alpha:function(e){return new be(it(e).a)},luma:function(e){return new be(e.luma()*e.alpha*100,"%")},luminance:function(e){var t=.2126*e.rgb[0]/255+.7152*e.rgb[1]/255+.0722*e.rgb[2]/255;return new be(t*e.alpha*100,"%")},saturate:function(e,t,n){if(!e.rgb)return null;var i=it(e);return void 0!==n&&"relative"===n.value?i.s+=i.s*t.value/100:i.s+=t.value/100,i.s=tt(i.s),nt(e,i)},desaturate:function(e,t,n){var i=it(e);return void 0!==n&&"relative"===n.value?i.s-=i.s*t.value/100:i.s-=t.value/100,i.s=tt(i.s),nt(e,i)},lighten:function(e,t,n){var i=it(e);return void 0!==n&&"relative"===n.value?i.l+=i.l*t.value/100:i.l+=t.value/100,i.l=tt(i.l),nt(e,i)},darken:function(e,t,n){var i=it(e);return void 0!==n&&"relative"===n.value?i.l-=i.l*t.value/100:i.l-=t.value/100,i.l=tt(i.l),nt(e,i)},fadein:function(e,t,n){var i=it(e);return void 0!==n&&"relative"===n.value?i.a+=i.a*t.value/100:i.a+=t.value/100,i.a=tt(i.a),nt(e,i)},fadeout:function(e,t,n){var i=it(e);return void 0!==n&&"relative"===n.value?i.a-=i.a*t.value/100:i.a-=t.value/100,i.a=tt(i.a),nt(e,i)},fade:function(e,t){var n=it(e);return n.a=t.value/100,n.a=tt(n.a),nt(e,n)},spin:function(e,t){var n=it(e),i=(n.h+t.value)%360;return n.h=i<0?360+i:i,nt(e,n)},mix:function(e,t,n){n||(n=new be(50));var i=n.value/100,r=2*i-1,s=it(e).a-it(t).a,a=((r*s==-1?r:(r+s)/(1+r*s))+1)/2,o=1-a,l=[e.rgb[0]*a+t.rgb[0]*o,e.rgb[1]*a+t.rgb[1]*o,e.rgb[2]*a+t.rgb[2]*o],u=e.alpha*i+t.alpha*(1-i);return new c(l,u)},greyscale:function(e){return Ye.desaturate(e,new be(100))},contrast:function(e,t,n,i){if(!e.rgb)return null;if(void 0===n&&(n=Ye.rgba(255,255,255,1)),void 0===t&&(t=Ye.rgba(0,0,0,1)),t.luma()>n.luma()){var r=n;n=t,t=r}return i=void 0===i?.43:st(i),e.luma().5&&(i=1,n=e>.25?Math.sqrt(e):((16*e-12)*e+4)*e),e-(1-2*t)*i*(n-e)},hardlight:function(e,t){return lt.overlay(t,e)},difference:function(e,t){return Math.abs(e-t)},exclusion:function(e,t){return e+t-2*e*t},average:function(e,t){return(e+t)/2},negation:function(e,t){return 1-Math.abs(e+t-1)}};for(var ut in lt)lt.hasOwnProperty(ut)&&(ot[ut]=ot.bind(null,lt[ut]));var ct=function(e){return Array.isArray(e.value)?e.value:Array(e)},ht={_SELF:function(e){return e},"~":function(){for(var e=[],t=0;ta.value)&&(h[i]=r);else{if(void 0!==l&&o!==l)throw{type:"Argument",message:"incompatible types"};f[o]=h.length,h.push(r)}}return 1==h.length?h[0]:(t=h.map((function(e){return e.toCSS(c.context)})).join(this.context.compress?",":", "),new se("".concat(e?"min":"max","(").concat(t,")")))},mt={min:function(){for(var e=[],t=0;t"),r=0;r");return i+="'),i=encodeURIComponent(i),i="data:image/svg+xml,".concat(i),new Oe(new Me("'".concat(i,"'"),i,!1,this.index,this.currentFileInfo),this.index,this.currentFileInfo)}}),ne.addMultiple(wt),ne.addMultiple(St),t};function Ct(e,t){var n,i=(t=t||{}).variables,r=new B.Eval(t);"object"!=typeof i||Array.isArray(i)||(i=Object.keys(i).map((function(e){var t=i[e];return t instanceof Ke.Value||(t instanceof Ke.Expression||(t=new Ke.Expression([t])),t=new Ke.Value([t])),new Ke.Declaration("@".concat(e),t,!1,null,0)})),r.frames=[new Ke.Ruleset(null,i)]);var s,a,o=[new ee.JoinSelectorVisitor,new ee.MarkVisibleSelectorsVisitor(!0),new ee.ExtendVisitor,new ee.ToCSSVisitor({compress:Boolean(t.compress)})],l=[];if(t.pluginManager){a=t.pluginManager.visitor();for(var u=0;u<2;u++)for(a.first();s=a.get();)s.isPreEvalVisitor?0!==u&&-1!==l.indexOf(s)||(l.push(s),s.run(e)):0!==u&&-1!==o.indexOf(s)||(s.isPreVisitor?o.unshift(s):o.push(s))}n=e.eval(r);for(var c=0;c=t);n++);this.preProcessors.splice(n,0,{preProcessor:e,priority:t})},e.prototype.addPostProcessor=function(e,t){var n;for(n=0;n=t);n++);this.postProcessors.splice(n,0,{postProcessor:e,priority:t})},e.prototype.addFileManager=function(e){this.fileManagers.push(e)},e.prototype.getPreProcessors=function(){for(var e=[],t=0;t0){var i=void 0,r=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?i=this.sourceMapURL:this._sourceMapFilename&&(i=this._sourceMapFilename),this.sourceMapURL=i,this.sourceMap=r}return this._css.join("")},t}()}(e=new s(e,t)),e)),o=function(e){return function(){function t(e,t,n){this.less=e,this.rootFilename=n.filename,this.paths=t.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=t.mime,this.error=null,this.context=t,this.queue=[],this.files={}}return t.prototype.push=function(t,n,i,s,a){var o=this,l=this.context.pluginManager.Loader;this.queue.push(t);var u=function(e,n,i){o.queue.splice(o.queue.indexOf(t),1);var l=i===o.rootFilename;s.optional&&e?(a(null,{rules:[]},!1,null),r.info("The file ".concat(i," was skipped because it was not found and the import was marked optional."))):(o.files[i]||s.inline||(o.files[i]={root:n,options:s}),e&&!o.error&&(o.error=e),a(e,n,l,i))},c={rewriteUrls:this.context.rewriteUrls,entryPath:i.entryPath,rootpath:i.rootpath,rootFilename:i.rootFilename},h=e.getFileManager(t,i.currentDirectory,this.context,e);if(h){var f,p,v=function(e){var t,n=e.filename,r=e.contents.replace(/^\uFEFF/,"");c.currentDirectory=h.getPath(n),c.rewriteUrls&&(c.rootpath=h.join(o.context.rootpath||"",h.pathDiff(c.currentDirectory,c.entryPath)),!h.isPathAbsolute(c.rootpath)&&h.alwaysMakePathsAbsolute()&&(c.rootpath=h.join(c.entryPath,c.rootpath))),c.filename=n;var a=new B.Parse(o.context);a.processImports=!1,o.contents[n]=r,(i.reference||s.reference)&&(c.reference=!0),s.isPlugin?(t=l.evalPlugin(r,a,o,s.pluginArgs,c))instanceof F?u(t,null,n):u(null,t,n):s.inline?u(null,r,n):!o.files[n]||o.files[n].options.multiple||s.multiple?new ae(a,o,c).parse(r,(function(e,t){u(e,t,n)})):u(null,o.files[n].root,n)},d=_(this.context);n&&(d.ext=s.isPlugin?".js":".less"),s.isPlugin?(d.mime="application/javascript",d.syncImport?f=l.loadPluginSync(t,i.currentDirectory,d,e,h):p=l.loadPlugin(t,i.currentDirectory,d,e,h)):d.syncImport?f=h.loadFileSync(t,i.currentDirectory,d,e):p=h.loadFile(t,i.currentDirectory,d,e,(function(e,t){e?u(e):v(t)})),f?f.filename?v(f):u(f):p&&p.then(v,u)}else u({message:"Could not find a file-manager for ".concat(t)})},t}()}(e);var u,c=function(e,t){var n=function(e,i,r){if("function"==typeof i?(r=i,i=E(this.options,{})):i=E(this.options,i||{}),!r){var s=this;return new Promise((function(t,r){n.call(s,e,i,(function(e,n){e?r(e):t(n)}))}))}this.parse(e,i,(function(e,n,i,s){if(e)return r(e);var a;try{a=new t(n,i).toCSS(s)}catch(e){return r(e)}r(null,a)}))};return n}(0,a),h=function(e,t,n){var i=function(e,t,r){if("function"==typeof t?(r=t,t=E(this.options,{})):t=E(this.options,t||{}),!r){var s=this;return new Promise((function(n,r){i.call(s,e,t,(function(e,t){e?r(e):n(t)}))}))}var a,o=void 0,l=new _t(this,!t.reUsePluginManager);if(t.pluginManager=l,a=new B.Parse(t),t.rootFileInfo)o=t.rootFileInfo;else{var u=t.filename||"input",c=u.replace(/[^/\\]*$/,"");(o={filename:u,rewriteUrls:a.rewriteUrls,rootpath:a.rootpath||"",currentDirectory:c,entryPath:c,rootFilename:u}).rootpath&&"/"!==o.rootpath.slice(-1)&&(o.rootpath+="/")}var h=new n(this,a,o);this.importManager=h,t.plugins&&t.plugins.forEach((function(e){var t,n;if(e.fileContent){if(n=e.fileContent.replace(/^\uFEFF/,""),(t=l.Loader.evalPlugin(n,a,h,e.options,e.filename))instanceof F)return r(t)}else l.addPlugin(e)})),new ae(a,h,o).parse(e,(function(e,n){if(e)return r(e);r(null,n,h,t)}),t)};return i}(0,0,o),f=Rt("v".concat("4.4.2")),p={version:[f.major,f.minor,f.patch],data:l,tree:Ke,Environment:s,AbstractFileManager:He,AbstractPluginLoader:Qe,environment:e,visitors:ee,Parser:ae,functions:It(e),contexts:B,SourceMapOutput:n,SourceMapBuilder:i,ParseTree:a,ImportManager:o,render:c,parse:h,LessError:F,transformTree:Ct,utils:O,PluginManager:_t,logger:r},v=function(e){return function(){var t=Object.create(e.prototype);return e.apply(t,Array.prototype.slice.call(arguments,0)),t}},d=Object.create(p);for(var m in p.tree)if("function"==typeof(u=p.tree[m]))d[m.toLowerCase()]=v(u);else for(var g in d[m]=Object.create(null),u)d[m][g.toLowerCase()]=v(u[g]);return p.parse=p.parse.bind(d),p.render=p.render.bind(d),d}var Ot={},$t=function(){};$t.prototype=Object.assign(new He,{alwaysMakePathsAbsolute:function(){return!0},join:function(e,t){return e?this.extractUrlParts(t,e).path:t},doXHR:function(e,t,n,i){var r=new XMLHttpRequest,s=!Pt.isFileProtocol||Pt.fileAsync;function a(t,n,i){t.status>=200&&t.status<300?n(t.responseText,t.getResponseHeader("Last-Modified")):"function"==typeof i&&i(t.status,e)}"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/css"),Et.debug("XHR: Getting '".concat(e,"'")),r.open("GET",e,s),r.setRequestHeader("Accept",t||"text/x-less, text/css; q=0.9, */*; q=0.5"),r.send(null),Pt.isFileProtocol&&!Pt.fileAsync?0===r.status||r.status>=200&&r.status<300?n(r.responseText):i(r.status,e):s?r.onreadystatechange=function(){4==r.readyState&&a(r,n,i)}:a(r,n,i)},supports:function(){return!0},clearFileCache:function(){Ot={}},loadFile:function(e,t,n){t&&!this.isPathAbsolute(e)&&(e=t+e),e=n.ext?this.tryAppendExtension(e,n.ext):e,n=n||{};var i=this.extractUrlParts(e,window.location.href).url,r=this;return new Promise((function(e,t){if(n.useFileCache&&Ot[i])try{var s=Ot[i];return e({contents:s,filename:i,webInfo:{lastModified:new Date}})}catch(e){return t({filename:i,message:"Error loading file ".concat(i," error was ").concat(e.message)})}r.doXHR(i,n.mime,(function(t,n){Ot[i]=t,e({contents:t,filename:i,webInfo:{lastModified:n}})}),(function(e,n){t({type:"File",message:"'".concat(n,"' wasn't found (").concat(e,")"),href:i})}))}))}});var Ft=function(e,t){return Pt=e,Et=t,$t},Vt=function(e){this.less=e};Vt.prototype=Object.assign(new Qe,{loadPlugin:function(e,t,n,i,r){return new Promise((function(s,a){r.loadFile(e,t,n,i).then(s).catch(a)}))}});var Lt=function(t,i,r){return{add:function(s,a){r.errorReporting&&"html"!==r.errorReporting?"console"===r.errorReporting?function(e,t){var n=e.filename||t,s=[],a="".concat(e.type||"Syntax","Error: ").concat(e.message||"There is an error in your .less file"," in ").concat(n),o=function(e,t,n){void 0!==e.extract[t]&&s.push("{line} {content}".replace(/\{line\}/,(parseInt(e.line,10)||0)+(t-1)).replace(/\{class\}/,n).replace(/\{content\}/,e.extract[t]))};e.line&&(o(e,0,""),o(e,1,"line"),o(e,2,""),a+=" on line ".concat(e.line,", column ").concat(e.column+1,":\n").concat(s.join("\n"))),e.stack&&(e.extract||r.logLevel>=4)&&(a+="\nStack Trace\n".concat(e.stack)),i.logger.error(a)}(s,a):"function"==typeof r.errorReporting&&r.errorReporting("add",s,a):function(i,s){var a,o,l="less-error-message:".concat(e(s||"")),u=t.document.createElement("div"),c=[],h=i.filename||s,f=h.match(/([^/]+(\?.*)?)$/)[1];u.id=l,u.className="less-error-message",o="

    ".concat(i.type||"Syntax","Error: ").concat(i.message||"There is an error in your .less file")+'

    in ').concat(f," ");var p=function(e,t,n){void 0!==e.extract[t]&&c.push('

  • {content}
  • '.replace(/\{line\}/,(parseInt(e.line,10)||0)+(t-1)).replace(/\{class\}/,n).replace(/\{content\}/,e.extract[t]))};i.line&&(p(i,0,""),p(i,1,"line"),p(i,2,""),o+="on line ".concat(i.line,", column ").concat(i.column+1,":

      ").concat(c.join(""),"
    ")),i.stack&&(i.extract||r.logLevel>=4)&&(o+="
    Stack Trace
    ".concat(i.stack.split("\n").slice(1).join("
    "))),u.innerHTML=o,n(t.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),u.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===r.env&&(a=setInterval((function(){var e=t.document,n=e.body;n&&(e.getElementById(l)?n.replaceChild(u,e.getElementById(l)):n.insertBefore(u,n.firstChild),clearInterval(a))}),10))}(s,a)},remove:function(n){r.errorReporting&&"html"!==r.errorReporting?"console"===r.errorReporting||"function"==typeof r.errorReporting&&r.errorReporting("remove",n):function(n){var i=t.document.getElementById("less-error-message:".concat(e(n)));i&&i.parentNode.removeChild(i)}(n)}}},jt={javascriptEnabled:!1,depends:!1,compress:!1,lint:!1,paths:[],color:!0,strictImports:!1,insecure:!1,rootpath:"",rewriteUrls:!1,math:1,strictUnits:!1,globalVars:null,modifyVars:null,urlArgs:""};if(window.less)for(var Dt in window.less)Object.prototype.hasOwnProperty.call(window.less,Dt)&&(jt[Dt]=window.less[Dt]);!function(e,n){t(n,i(e)),void 0===n.isFileProtocol&&(n.isFileProtocol=/^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(e.location.protocol)),n.async=n.async||!1,n.fileAsync=n.fileAsync||!1,n.poll=n.poll||(n.isFileProtocol?1e3:1500),n.env=n.env||("127.0.0.1"==e.location.hostname||"0.0.0.0"==e.location.hostname||"localhost"==e.location.hostname||e.location.port&&e.location.port.length>0||n.isFileProtocol?"development":"production");var r=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(e.location.hash);r&&(n.dumpLineNumbers=r[1]),void 0===n.useFileCache&&(n.useFileCache=!0),void 0===n.onReady&&(n.onReady=!0),n.relativeUrls&&(n.rewriteUrls="all")}(window,jt),jt.plugins=jt.plugins||[],window.LESS_PLUGINS&&(jt.plugins=jt.plugins.concat(window.LESS_PLUGINS));var Nt,Bt,Ut,qt=function(e,i){var r=e.document,s=Mt();s.options=i;var a=s.environment,o=Ft(i,s.logger),l=new o;a.addFileManager(l),s.FileManager=o,s.PluginLoader=Vt,function(e,t){t.logLevel=void 0!==t.logLevel?t.logLevel:"development"===t.env?3:1,t.loggers||(t.loggers=[{debug:function(e){t.logLevel>=4&&console.log(e)},info:function(e){t.logLevel>=3&&console.log(e)},warn:function(e){t.logLevel>=2&&console.warn(e)},error:function(e){t.logLevel>=1&&console.error(e)}}]);for(var n=0;n 0 && styleNode.childNodes.length > 0 &&\n oldStyleNode.firstChild.nodeValue === styleNode.firstChild.nodeValue);\n }\n\n const head = document.getElementsByTagName('head')[0];\n\n // If there is no oldStyleNode, just append; otherwise, only append if we need\n // to replace oldStyleNode with an updated stylesheet\n if (oldStyleNode === null || keepOldStyleNode === false) {\n const nextEl = sheet && sheet.nextSibling || null;\n if (nextEl) {\n nextEl.parentNode.insertBefore(styleNode, nextEl);\n } else {\n head.appendChild(styleNode);\n }\n }\n if (oldStyleNode && keepOldStyleNode === false) {\n oldStyleNode.parentNode.removeChild(oldStyleNode);\n }\n\n // For IE.\n // This needs to happen *after* the style element is added to the DOM, otherwise IE 7 and 8 may crash.\n // See http://social.msdn.microsoft.com/Forums/en-US/7e081b65-878a-4c22-8e68-c10d39c2ed32/internet-explorer-crashes-appending-style-element-to-head\n if (styleNode.styleSheet) {\n try {\n styleNode.styleSheet.cssText = styles;\n } catch (e) {\n throw new Error('Couldn\\'t reassign styleSheet.cssText.');\n }\n }\n },\n currentScript: function(window) {\n const document = window.document;\n return document.currentScript || (() => {\n const scripts = document.getElementsByTagName('script');\n return scripts[scripts.length - 1];\n })();\n }\n};\n","export default {\n error: function(msg) {\n this._fireEvent('error', msg);\n },\n warn: function(msg) {\n this._fireEvent('warn', msg);\n },\n info: function(msg) {\n this._fireEvent('info', msg);\n },\n debug: function(msg) {\n this._fireEvent('debug', msg);\n },\n addListener: function(listener) {\n this._listeners.push(listener);\n },\n removeListener: function(listener) {\n for (let i = 0; i < this._listeners.length; i++) {\n if (this._listeners[i] === listener) {\n this._listeners.splice(i, 1);\n return;\n }\n }\n },\n _fireEvent: function(type, msg) {\n for (let i = 0; i < this._listeners.length; i++) {\n const logFunction = this._listeners[i][type];\n if (logFunction) {\n logFunction(msg);\n }\n }\n },\n _listeners: []\n};\n","/**\n * @todo Document why this abstraction exists, and the relationship between\n * environment, file managers, and plugin manager\n */\n\nimport logger from '../logger';\n\nclass Environment {\n constructor(externalEnvironment, fileManagers) {\n this.fileManagers = fileManagers || [];\n externalEnvironment = externalEnvironment || {};\n\n const optionalFunctions = ['encodeBase64', 'mimeLookup', 'charsetLookup', 'getSourceMapGenerator'];\n const requiredFunctions = [];\n const functions = requiredFunctions.concat(optionalFunctions);\n\n for (let i = 0; i < functions.length; i++) {\n const propName = functions[i];\n const environmentFunc = externalEnvironment[propName];\n if (environmentFunc) {\n this[propName] = environmentFunc.bind(externalEnvironment);\n } else if (i < requiredFunctions.length) {\n this.warn(`missing required function in environment - ${propName}`);\n }\n }\n }\n\n getFileManager(filename, currentDirectory, options, environment, isSync) {\n\n if (!filename) {\n logger.warn('getFileManager called with no filename.. Please report this issue. continuing.');\n }\n if (currentDirectory === undefined) {\n logger.warn('getFileManager called with null directory.. Please report this issue. continuing.');\n }\n\n let fileManagers = this.fileManagers;\n if (options.pluginManager) {\n fileManagers = [].concat(fileManagers).concat(options.pluginManager.getFileManagers());\n }\n for (let i = fileManagers.length - 1; i >= 0 ; i--) {\n const fileManager = fileManagers[i];\n if (fileManager[isSync ? 'supportsSync' : 'supports'](filename, currentDirectory, options, environment)) {\n return fileManager;\n }\n }\n return null;\n }\n\n addFileManager(fileManager) {\n this.fileManagers.push(fileManager);\n }\n\n clearFileManagers() {\n this.fileManagers = [];\n }\n}\n\nexport default Environment;\n","export default {\n 'aliceblue':'#f0f8ff',\n 'antiquewhite':'#faebd7',\n 'aqua':'#00ffff',\n 'aquamarine':'#7fffd4',\n 'azure':'#f0ffff',\n 'beige':'#f5f5dc',\n 'bisque':'#ffe4c4',\n 'black':'#000000',\n 'blanchedalmond':'#ffebcd',\n 'blue':'#0000ff',\n 'blueviolet':'#8a2be2',\n 'brown':'#a52a2a',\n 'burlywood':'#deb887',\n 'cadetblue':'#5f9ea0',\n 'chartreuse':'#7fff00',\n 'chocolate':'#d2691e',\n 'coral':'#ff7f50',\n 'cornflowerblue':'#6495ed',\n 'cornsilk':'#fff8dc',\n 'crimson':'#dc143c',\n 'cyan':'#00ffff',\n 'darkblue':'#00008b',\n 'darkcyan':'#008b8b',\n 'darkgoldenrod':'#b8860b',\n 'darkgray':'#a9a9a9',\n 'darkgrey':'#a9a9a9',\n 'darkgreen':'#006400',\n 'darkkhaki':'#bdb76b',\n 'darkmagenta':'#8b008b',\n 'darkolivegreen':'#556b2f',\n 'darkorange':'#ff8c00',\n 'darkorchid':'#9932cc',\n 'darkred':'#8b0000',\n 'darksalmon':'#e9967a',\n 'darkseagreen':'#8fbc8f',\n 'darkslateblue':'#483d8b',\n 'darkslategray':'#2f4f4f',\n 'darkslategrey':'#2f4f4f',\n 'darkturquoise':'#00ced1',\n 'darkviolet':'#9400d3',\n 'deeppink':'#ff1493',\n 'deepskyblue':'#00bfff',\n 'dimgray':'#696969',\n 'dimgrey':'#696969',\n 'dodgerblue':'#1e90ff',\n 'firebrick':'#b22222',\n 'floralwhite':'#fffaf0',\n 'forestgreen':'#228b22',\n 'fuchsia':'#ff00ff',\n 'gainsboro':'#dcdcdc',\n 'ghostwhite':'#f8f8ff',\n 'gold':'#ffd700',\n 'goldenrod':'#daa520',\n 'gray':'#808080',\n 'grey':'#808080',\n 'green':'#008000',\n 'greenyellow':'#adff2f',\n 'honeydew':'#f0fff0',\n 'hotpink':'#ff69b4',\n 'indianred':'#cd5c5c',\n 'indigo':'#4b0082',\n 'ivory':'#fffff0',\n 'khaki':'#f0e68c',\n 'lavender':'#e6e6fa',\n 'lavenderblush':'#fff0f5',\n 'lawngreen':'#7cfc00',\n 'lemonchiffon':'#fffacd',\n 'lightblue':'#add8e6',\n 'lightcoral':'#f08080',\n 'lightcyan':'#e0ffff',\n 'lightgoldenrodyellow':'#fafad2',\n 'lightgray':'#d3d3d3',\n 'lightgrey':'#d3d3d3',\n 'lightgreen':'#90ee90',\n 'lightpink':'#ffb6c1',\n 'lightsalmon':'#ffa07a',\n 'lightseagreen':'#20b2aa',\n 'lightskyblue':'#87cefa',\n 'lightslategray':'#778899',\n 'lightslategrey':'#778899',\n 'lightsteelblue':'#b0c4de',\n 'lightyellow':'#ffffe0',\n 'lime':'#00ff00',\n 'limegreen':'#32cd32',\n 'linen':'#faf0e6',\n 'magenta':'#ff00ff',\n 'maroon':'#800000',\n 'mediumaquamarine':'#66cdaa',\n 'mediumblue':'#0000cd',\n 'mediumorchid':'#ba55d3',\n 'mediumpurple':'#9370d8',\n 'mediumseagreen':'#3cb371',\n 'mediumslateblue':'#7b68ee',\n 'mediumspringgreen':'#00fa9a',\n 'mediumturquoise':'#48d1cc',\n 'mediumvioletred':'#c71585',\n 'midnightblue':'#191970',\n 'mintcream':'#f5fffa',\n 'mistyrose':'#ffe4e1',\n 'moccasin':'#ffe4b5',\n 'navajowhite':'#ffdead',\n 'navy':'#000080',\n 'oldlace':'#fdf5e6',\n 'olive':'#808000',\n 'olivedrab':'#6b8e23',\n 'orange':'#ffa500',\n 'orangered':'#ff4500',\n 'orchid':'#da70d6',\n 'palegoldenrod':'#eee8aa',\n 'palegreen':'#98fb98',\n 'paleturquoise':'#afeeee',\n 'palevioletred':'#d87093',\n 'papayawhip':'#ffefd5',\n 'peachpuff':'#ffdab9',\n 'peru':'#cd853f',\n 'pink':'#ffc0cb',\n 'plum':'#dda0dd',\n 'powderblue':'#b0e0e6',\n 'purple':'#800080',\n 'rebeccapurple':'#663399',\n 'red':'#ff0000',\n 'rosybrown':'#bc8f8f',\n 'royalblue':'#4169e1',\n 'saddlebrown':'#8b4513',\n 'salmon':'#fa8072',\n 'sandybrown':'#f4a460',\n 'seagreen':'#2e8b57',\n 'seashell':'#fff5ee',\n 'sienna':'#a0522d',\n 'silver':'#c0c0c0',\n 'skyblue':'#87ceeb',\n 'slateblue':'#6a5acd',\n 'slategray':'#708090',\n 'slategrey':'#708090',\n 'snow':'#fffafa',\n 'springgreen':'#00ff7f',\n 'steelblue':'#4682b4',\n 'tan':'#d2b48c',\n 'teal':'#008080',\n 'thistle':'#d8bfd8',\n 'tomato':'#ff6347',\n 'turquoise':'#40e0d0',\n 'violet':'#ee82ee',\n 'wheat':'#f5deb3',\n 'white':'#ffffff',\n 'whitesmoke':'#f5f5f5',\n 'yellow':'#ffff00',\n 'yellowgreen':'#9acd32'\n};","export default {\n length: {\n 'm': 1,\n 'cm': 0.01,\n 'mm': 0.001,\n 'in': 0.0254,\n 'px': 0.0254 / 96,\n 'pt': 0.0254 / 72,\n 'pc': 0.0254 / 72 * 12\n },\n duration: {\n 's': 1,\n 'ms': 0.001\n },\n angle: {\n 'rad': 1 / (2 * Math.PI),\n 'deg': 1 / 360,\n 'grad': 1 / 400,\n 'turn': 1\n }\n};","import colors from './colors';\nimport unitConversions from './unit-conversions';\n\nexport default { colors, unitConversions };\n","/**\n * The reason why Node is a class and other nodes simply do not extend\n * from Node (since we're transpiling) is due to this issue:\n * \n * @see https://github.com/less/less.js/issues/3434\n */\nclass Node {\n constructor() {\n this.parent = null;\n this.visibilityBlocks = undefined;\n this.nodeVisible = undefined;\n this.rootNode = null;\n this.parsed = null;\n }\n\n get currentFileInfo() {\n return this.fileInfo();\n }\n\n get index() {\n return this.getIndex();\n }\n\n setParent(nodes, parent) {\n function set(node) {\n if (node && node instanceof Node) {\n node.parent = parent;\n }\n }\n if (Array.isArray(nodes)) {\n nodes.forEach(set);\n }\n else {\n set(nodes);\n }\n }\n\n getIndex() {\n return this._index || (this.parent && this.parent.getIndex()) || 0;\n }\n\n fileInfo() {\n return this._fileInfo || (this.parent && this.parent.fileInfo()) || {};\n }\n\n isRulesetLike() { return false; }\n\n toCSS(context) {\n const strs = [];\n this.genCSS(context, {\n // remove when genCSS has JSDoc types\n // eslint-disable-next-line no-unused-vars\n add: function(chunk, fileInfo, index) {\n strs.push(chunk);\n },\n isEmpty: function () {\n return strs.length === 0;\n }\n });\n return strs.join('');\n }\n\n genCSS(context, output) {\n output.add(this.value);\n }\n\n accept(visitor) {\n this.value = visitor.visit(this.value);\n }\n\n eval() { return this; }\n\n _operate(context, op, a, b) {\n switch (op) {\n case '+': return a + b;\n case '-': return a - b;\n case '*': return a * b;\n case '/': return a / b;\n }\n }\n\n fround(context, value) {\n const precision = context && context.numPrecision;\n // add \"epsilon\" to ensure numbers like 1.000000005 (represented as 1.000000004999...) are properly rounded:\n return (precision) ? Number((value + 2e-16).toFixed(precision)) : value;\n }\n\n static compare(a, b) {\n /* returns:\n -1: a < b\n 0: a = b\n 1: a > b\n and *any* other value for a != b (e.g. undefined, NaN, -2 etc.) */\n\n if ((a.compare) &&\n // for \"symmetric results\" force toCSS-based comparison\n // of Quoted or Anonymous if either value is one of those\n !(b.type === 'Quoted' || b.type === 'Anonymous')) {\n return a.compare(b);\n } else if (b.compare) {\n return -b.compare(a);\n } else if (a.type !== b.type) {\n return undefined;\n }\n\n a = a.value;\n b = b.value;\n if (!Array.isArray(a)) {\n return a === b ? 0 : undefined;\n }\n if (a.length !== b.length) {\n return undefined;\n }\n for (let i = 0; i < a.length; i++) {\n if (Node.compare(a[i], b[i]) !== 0) {\n return undefined;\n }\n }\n return 0;\n }\n\n static numericCompare(a, b) {\n return a < b ? -1\n : a === b ? 0\n : a > b ? 1 : undefined;\n }\n\n // Returns true if this node represents root of ast imported by reference\n blocksVisibility() {\n if (this.visibilityBlocks === undefined) {\n this.visibilityBlocks = 0;\n }\n return this.visibilityBlocks !== 0;\n }\n\n addVisibilityBlock() {\n if (this.visibilityBlocks === undefined) {\n this.visibilityBlocks = 0;\n }\n this.visibilityBlocks = this.visibilityBlocks + 1;\n }\n\n removeVisibilityBlock() {\n if (this.visibilityBlocks === undefined) {\n this.visibilityBlocks = 0;\n }\n this.visibilityBlocks = this.visibilityBlocks - 1;\n }\n\n // Turns on node visibility - if called node will be shown in output regardless\n // of whether it comes from import by reference or not\n ensureVisibility() {\n this.nodeVisible = true;\n }\n\n // Turns off node visibility - if called node will NOT be shown in output regardless\n // of whether it comes from import by reference or not\n ensureInvisibility() {\n this.nodeVisible = false;\n }\n\n // return values:\n // false - the node must not be visible\n // true - the node must be visible\n // undefined or null - the node has the same visibility as its parent\n isVisible() {\n return this.nodeVisible;\n }\n\n visibilityInfo() {\n return {\n visibilityBlocks: this.visibilityBlocks,\n nodeVisible: this.nodeVisible\n };\n }\n\n copyVisibilityInfo(info) {\n if (!info) {\n return;\n }\n this.visibilityBlocks = info.visibilityBlocks;\n this.nodeVisible = info.nodeVisible;\n }\n}\n\nexport default Node;\n","import Node from './node';\nimport colors from '../data/colors';\n\n//\n// RGB Colors - #ff0014, #eee\n//\nconst Color = function(rgb, a, originalForm) {\n const self = this;\n //\n // The end goal here, is to parse the arguments\n // into an integer triplet, such as `128, 255, 0`\n //\n // This facilitates operations and conversions.\n //\n if (Array.isArray(rgb)) {\n this.rgb = rgb;\n } else if (rgb.length >= 6) {\n this.rgb = [];\n rgb.match(/.{2}/g).map(function (c, i) {\n if (i < 3) {\n self.rgb.push(parseInt(c, 16));\n } else {\n self.alpha = (parseInt(c, 16)) / 255;\n }\n });\n } else {\n this.rgb = [];\n rgb.split('').map(function (c, i) {\n if (i < 3) {\n self.rgb.push(parseInt(c + c, 16));\n } else {\n self.alpha = (parseInt(c + c, 16)) / 255;\n }\n });\n }\n this.alpha = this.alpha || (typeof a === 'number' ? a : 1);\n if (typeof originalForm !== 'undefined') {\n this.value = originalForm;\n }\n}\n\nColor.prototype = Object.assign(new Node(), {\n type: 'Color',\n\n luma() {\n let r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255;\n\n r = (r <= 0.03928) ? r / 12.92 : Math.pow(((r + 0.055) / 1.055), 2.4);\n g = (g <= 0.03928) ? g / 12.92 : Math.pow(((g + 0.055) / 1.055), 2.4);\n b = (b <= 0.03928) ? b / 12.92 : Math.pow(((b + 0.055) / 1.055), 2.4);\n\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n },\n\n genCSS(context, output) {\n output.add(this.toCSS(context));\n },\n\n toCSS(context, doNotCompress) {\n const compress = context && context.compress && !doNotCompress;\n let color;\n let alpha;\n let colorFunction;\n let args = [];\n\n // `value` is set if this color was originally\n // converted from a named color string so we need\n // to respect this and try to output named color too.\n alpha = this.fround(context, this.alpha);\n\n if (this.value) {\n if (this.value.indexOf('rgb') === 0) {\n if (alpha < 1) {\n colorFunction = 'rgba';\n }\n } else if (this.value.indexOf('hsl') === 0) {\n if (alpha < 1) {\n colorFunction = 'hsla';\n } else {\n colorFunction = 'hsl';\n }\n } else {\n return this.value;\n }\n } else {\n if (alpha < 1) {\n colorFunction = 'rgba';\n }\n }\n\n switch (colorFunction) {\n case 'rgba':\n args = this.rgb.map(function (c) {\n return clamp(Math.round(c), 255);\n }).concat(clamp(alpha, 1));\n break;\n case 'hsla':\n args.push(clamp(alpha, 1));\n // eslint-disable-next-line no-fallthrough\n case 'hsl':\n color = this.toHSL();\n args = [\n this.fround(context, color.h),\n `${this.fround(context, color.s * 100)}%`,\n `${this.fround(context, color.l * 100)}%`\n ].concat(args);\n }\n\n if (colorFunction) {\n // Values are capped between `0` and `255`, rounded and zero-padded.\n return `${colorFunction}(${args.join(`,${compress ? '' : ' '}`)})`;\n }\n\n color = this.toRGB();\n\n if (compress) {\n const splitcolor = color.split('');\n\n // Convert color to short format\n if (splitcolor[1] === splitcolor[2] && splitcolor[3] === splitcolor[4] && splitcolor[5] === splitcolor[6]) {\n color = `#${splitcolor[1]}${splitcolor[3]}${splitcolor[5]}`;\n }\n }\n\n return color;\n },\n\n //\n // Operations have to be done per-channel, if not,\n // channels will spill onto each other. Once we have\n // our result, in the form of an integer triplet,\n // we create a new Color node to hold the result.\n //\n operate(context, op, other) {\n const rgb = new Array(3);\n const alpha = this.alpha * (1 - other.alpha) + other.alpha;\n for (let c = 0; c < 3; c++) {\n rgb[c] = this._operate(context, op, this.rgb[c], other.rgb[c]);\n }\n return new Color(rgb, alpha);\n },\n\n toRGB() {\n return toHex(this.rgb);\n },\n\n toHSL() {\n const r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha;\n\n const max = Math.max(r, g, b), min = Math.min(r, g, b);\n let h;\n let s;\n const l = (max + min) / 2;\n const d = max - min;\n\n if (max === min) {\n h = s = 0;\n } else {\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n return { h: h * 360, s, l, a };\n },\n\n // Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript\n toHSV() {\n const r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha;\n\n const max = Math.max(r, g, b), min = Math.min(r, g, b);\n let h;\n let s;\n const v = max;\n\n const d = max - min;\n if (max === 0) {\n s = 0;\n } else {\n s = d / max;\n }\n\n if (max === min) {\n h = 0;\n } else {\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n return { h: h * 360, s, v, a };\n },\n\n toARGB() {\n return toHex([this.alpha * 255].concat(this.rgb));\n },\n\n compare(x) {\n return (x.rgb &&\n x.rgb[0] === this.rgb[0] &&\n x.rgb[1] === this.rgb[1] &&\n x.rgb[2] === this.rgb[2] &&\n x.alpha === this.alpha) ? 0 : undefined;\n }\n});\n\nColor.fromKeyword = function(keyword) {\n let c;\n const key = keyword.toLowerCase();\n // eslint-disable-next-line no-prototype-builtins\n if (colors.hasOwnProperty(key)) {\n c = new Color(colors[key].slice(1));\n }\n else if (key === 'transparent') {\n c = new Color([0, 0, 0], 0);\n }\n\n if (c) {\n c.value = keyword;\n return c;\n }\n};\n\nfunction clamp(v, max) {\n return Math.min(Math.max(v, 0), max);\n}\n\nfunction toHex(v) {\n return `#${v.map(function (c) {\n c = clamp(Math.round(c), 255);\n return (c < 16 ? '0' : '') + c.toString(16);\n }).join('')}`;\n}\n\nexport default Color;\n","/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nvar ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n else s |= 1;\n }\n catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\n });\n }\n return path;\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __esDecorate,\n __runInitializers,\n __propKey,\n __setFunctionName,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n __rewriteRelativeImportExtension,\n};\n","import Node from './node';\n\nconst Paren = function(node) {\n this.value = node;\n};\n\nParen.prototype = Object.assign(new Node(), {\n type: 'Paren',\n\n genCSS(context, output) {\n output.add('(');\n this.value.genCSS(context, output);\n output.add(')');\n },\n\n eval(context) {\n const paren = new Paren(this.value.eval(context));\n \n if (this.noSpacing) {\n paren.noSpacing = true;\n }\n\n return paren;\n }\n});\n\nexport default Paren;\n","import Node from './node';\nconst _noSpaceCombinators = {\n '': true,\n ' ': true,\n '|': true\n};\n\nconst Combinator = function(value) {\n if (value === ' ') {\n this.value = ' ';\n this.emptyOrWhitespace = true;\n } else {\n this.value = value ? value.trim() : '';\n this.emptyOrWhitespace = this.value === '';\n }\n}\n\nCombinator.prototype = Object.assign(new Node(), {\n type: 'Combinator',\n\n genCSS(context, output) {\n const spaceOrEmpty = (context.compress || _noSpaceCombinators[this.value]) ? '' : ' ';\n output.add(spaceOrEmpty + this.value + spaceOrEmpty);\n }\n});\n\nexport default Combinator;\n","import Node from './node';\nimport Paren from './paren';\nimport Combinator from './combinator';\n\nconst Element = function(combinator, value, isVariable, index, currentFileInfo, visibilityInfo) {\n this.combinator = combinator instanceof Combinator ?\n combinator : new Combinator(combinator);\n\n if (typeof value === 'string') {\n this.value = value.trim();\n } else if (value) {\n this.value = value;\n } else {\n this.value = '';\n }\n this.isVariable = isVariable;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.copyVisibilityInfo(visibilityInfo);\n this.setParent(this.combinator, this);\n}\n\nElement.prototype = Object.assign(new Node(), {\n type: 'Element',\n\n accept(visitor) {\n const value = this.value;\n this.combinator = visitor.visit(this.combinator);\n if (typeof value === 'object') {\n this.value = visitor.visit(value);\n }\n },\n\n eval(context) {\n return new Element(this.combinator,\n this.value.eval ? this.value.eval(context) : this.value,\n this.isVariable,\n this.getIndex(),\n this.fileInfo(), this.visibilityInfo());\n },\n\n clone() {\n return new Element(this.combinator,\n this.value,\n this.isVariable,\n this.getIndex(),\n this.fileInfo(), this.visibilityInfo());\n },\n\n genCSS(context, output) {\n output.add(this.toCSS(context), this.fileInfo(), this.getIndex());\n },\n\n toCSS(context) {\n context = context || {};\n let value = this.value;\n const firstSelector = context.firstSelector;\n if (value instanceof Paren) {\n // selector in parens should not be affected by outer selector\n // flags (breaks only interpolated selectors - see #1973)\n context.firstSelector = true;\n }\n value = value.toCSS ? value.toCSS(context) : value;\n context.firstSelector = firstSelector;\n if (value === '' && this.combinator.value.charAt(0) === '&') {\n return '';\n } else {\n return this.combinator.toCSS(context) + value;\n }\n }\n});\n\nexport default Element;\n","\nexport const Math = {\n ALWAYS: 0,\n PARENS_DIVISION: 1,\n PARENS: 2\n // removed - STRICT_LEGACY: 3\n};\n\nexport const RewriteUrls = {\n OFF: 0,\n LOCAL: 1,\n ALL: 2\n};","/**\r\n * Returns the object type of the given payload\r\n *\r\n * @param {*} payload\r\n * @returns {string}\r\n */\r\nfunction getType(payload) {\r\n return Object.prototype.toString.call(payload).slice(8, -1);\r\n}\r\n/**\r\n * Returns whether the payload is undefined\r\n *\r\n * @param {*} payload\r\n * @returns {payload is undefined}\r\n */\r\nfunction isUndefined(payload) {\r\n return getType(payload) === 'Undefined';\r\n}\r\n/**\r\n * Returns whether the payload is null\r\n *\r\n * @param {*} payload\r\n * @returns {payload is null}\r\n */\r\nfunction isNull(payload) {\r\n return getType(payload) === 'Null';\r\n}\r\n/**\r\n * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is PlainObject}\r\n */\r\nfunction isPlainObject(payload) {\r\n if (getType(payload) !== 'Object')\r\n return false;\r\n return payload.constructor === Object && Object.getPrototypeOf(payload) === Object.prototype;\r\n}\r\n/**\r\n * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is PlainObject}\r\n */\r\nfunction isObject(payload) {\r\n return isPlainObject(payload);\r\n}\r\n/**\r\n * Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is { [K in any]: never }}\r\n */\r\nfunction isEmptyObject(payload) {\r\n return isPlainObject(payload) && Object.keys(payload).length === 0;\r\n}\r\n/**\r\n * Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is PlainObject}\r\n */\r\nfunction isFullObject(payload) {\r\n return isPlainObject(payload) && Object.keys(payload).length > 0;\r\n}\r\n/**\r\n * Returns whether the payload is an any kind of object (including special classes or objects with different prototypes)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is PlainObject}\r\n */\r\nfunction isAnyObject(payload) {\r\n return getType(payload) === 'Object';\r\n}\r\n/**\r\n * Returns whether the payload is an object like a type passed in < >\r\n *\r\n * Usage: isObjectLike<{id: any}>(payload) // will make sure it's an object and has an `id` prop.\r\n *\r\n * @template T this must be passed in < >\r\n * @param {*} payload\r\n * @returns {payload is T}\r\n */\r\nfunction isObjectLike(payload) {\r\n return isAnyObject(payload);\r\n}\r\n/**\r\n * Returns whether the payload is a function (regular or async)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is AnyFunction}\r\n */\r\nfunction isFunction(payload) {\r\n return typeof payload === 'function';\r\n}\r\n/**\r\n * Returns whether the payload is an array\r\n *\r\n * @param {any} payload\r\n * @returns {payload is any[]}\r\n */\r\nfunction isArray(payload) {\r\n return getType(payload) === 'Array';\r\n}\r\n/**\r\n * Returns whether the payload is a an array with at least 1 item\r\n *\r\n * @param {*} payload\r\n * @returns {payload is any[]}\r\n */\r\nfunction isFullArray(payload) {\r\n return isArray(payload) && payload.length > 0;\r\n}\r\n/**\r\n * Returns whether the payload is a an empty array\r\n *\r\n * @param {*} payload\r\n * @returns {payload is []}\r\n */\r\nfunction isEmptyArray(payload) {\r\n return isArray(payload) && payload.length === 0;\r\n}\r\n/**\r\n * Returns whether the payload is a string\r\n *\r\n * @param {*} payload\r\n * @returns {payload is string}\r\n */\r\nfunction isString(payload) {\r\n return getType(payload) === 'String';\r\n}\r\n/**\r\n * Returns whether the payload is a string, BUT returns false for ''\r\n *\r\n * @param {*} payload\r\n * @returns {payload is string}\r\n */\r\nfunction isFullString(payload) {\r\n return isString(payload) && payload !== '';\r\n}\r\n/**\r\n * Returns whether the payload is ''\r\n *\r\n * @param {*} payload\r\n * @returns {payload is string}\r\n */\r\nfunction isEmptyString(payload) {\r\n return payload === '';\r\n}\r\n/**\r\n * Returns whether the payload is a number (but not NaN)\r\n *\r\n * This will return `false` for `NaN`!!\r\n *\r\n * @param {*} payload\r\n * @returns {payload is number}\r\n */\r\nfunction isNumber(payload) {\r\n return getType(payload) === 'Number' && !isNaN(payload);\r\n}\r\n/**\r\n * Returns whether the payload is a boolean\r\n *\r\n * @param {*} payload\r\n * @returns {payload is boolean}\r\n */\r\nfunction isBoolean(payload) {\r\n return getType(payload) === 'Boolean';\r\n}\r\n/**\r\n * Returns whether the payload is a regular expression (RegExp)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is RegExp}\r\n */\r\nfunction isRegExp(payload) {\r\n return getType(payload) === 'RegExp';\r\n}\r\n/**\r\n * Returns whether the payload is a Map\r\n *\r\n * @param {*} payload\r\n * @returns {payload is Map}\r\n */\r\nfunction isMap(payload) {\r\n return getType(payload) === 'Map';\r\n}\r\n/**\r\n * Returns whether the payload is a WeakMap\r\n *\r\n * @param {*} payload\r\n * @returns {payload is WeakMap}\r\n */\r\nfunction isWeakMap(payload) {\r\n return getType(payload) === 'WeakMap';\r\n}\r\n/**\r\n * Returns whether the payload is a Set\r\n *\r\n * @param {*} payload\r\n * @returns {payload is Set}\r\n */\r\nfunction isSet(payload) {\r\n return getType(payload) === 'Set';\r\n}\r\n/**\r\n * Returns whether the payload is a WeakSet\r\n *\r\n * @param {*} payload\r\n * @returns {payload is WeakSet}\r\n */\r\nfunction isWeakSet(payload) {\r\n return getType(payload) === 'WeakSet';\r\n}\r\n/**\r\n * Returns whether the payload is a Symbol\r\n *\r\n * @param {*} payload\r\n * @returns {payload is symbol}\r\n */\r\nfunction isSymbol(payload) {\r\n return getType(payload) === 'Symbol';\r\n}\r\n/**\r\n * Returns whether the payload is a Date, and that the date is valid\r\n *\r\n * @param {*} payload\r\n * @returns {payload is Date}\r\n */\r\nfunction isDate(payload) {\r\n return getType(payload) === 'Date' && !isNaN(payload);\r\n}\r\n/**\r\n * Returns whether the payload is a Blob\r\n *\r\n * @param {*} payload\r\n * @returns {payload is Blob}\r\n */\r\nfunction isBlob(payload) {\r\n return getType(payload) === 'Blob';\r\n}\r\n/**\r\n * Returns whether the payload is a File\r\n *\r\n * @param {*} payload\r\n * @returns {payload is File}\r\n */\r\nfunction isFile(payload) {\r\n return getType(payload) === 'File';\r\n}\r\n/**\r\n * Returns whether the payload is a Promise\r\n *\r\n * @param {*} payload\r\n * @returns {payload is Promise}\r\n */\r\nfunction isPromise(payload) {\r\n return getType(payload) === 'Promise';\r\n}\r\n/**\r\n * Returns whether the payload is an Error\r\n *\r\n * @param {*} payload\r\n * @returns {payload is Error}\r\n */\r\nfunction isError(payload) {\r\n return getType(payload) === 'Error';\r\n}\r\n/**\r\n * Returns whether the payload is literally the value `NaN` (it's `NaN` and also a `number`)\r\n *\r\n * @param {*} payload\r\n * @returns {payload is typeof NaN}\r\n */\r\nfunction isNaNValue(payload) {\r\n return getType(payload) === 'Number' && isNaN(payload);\r\n}\r\n/**\r\n * Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol)\r\n *\r\n * @param {*} payload\r\n * @returns {(payload is boolean | null | undefined | number | string | symbol)}\r\n */\r\nfunction isPrimitive(payload) {\r\n return (isBoolean(payload) ||\r\n isNull(payload) ||\r\n isUndefined(payload) ||\r\n isNumber(payload) ||\r\n isString(payload) ||\r\n isSymbol(payload));\r\n}\r\n/**\r\n * Returns true whether the payload is null or undefined\r\n *\r\n * @param {*} payload\r\n * @returns {(payload is null | undefined)}\r\n */\r\nvar isNullOrUndefined = isOneOf(isNull, isUndefined);\r\nfunction isOneOf(a, b, c, d, e) {\r\n return function (value) {\r\n return a(value) || b(value) || (!!c && c(value)) || (!!d && d(value)) || (!!e && e(value));\r\n };\r\n}\r\n/**\r\n * Does a generic check to check that the given payload is of a given type.\r\n * In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!);\r\n * It will, however, differentiate between object and null\r\n *\r\n * @template T\r\n * @param {*} payload\r\n * @param {T} type\r\n * @throws {TypeError} Will throw type error if type is an invalid type\r\n * @returns {payload is T}\r\n */\r\nfunction isType(payload, type) {\r\n if (!(type instanceof Function)) {\r\n throw new TypeError('Type must be a function');\r\n }\r\n if (!Object.prototype.hasOwnProperty.call(type, 'prototype')) {\r\n throw new TypeError('Type is not a class');\r\n }\r\n // Classes usually have names (as functions usually have names)\r\n var name = type.name;\r\n return getType(payload) === name || Boolean(payload && payload.constructor === type);\r\n}\n\nexport { getType, isAnyObject, isArray, isBlob, isBoolean, isDate, isEmptyArray, isEmptyObject, isEmptyString, isError, isFile, isFullArray, isFullObject, isFullString, isFunction, isMap, isNaNValue, isNull, isNullOrUndefined, isNumber, isObject, isObjectLike, isOneOf, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isType, isUndefined, isWeakMap, isWeakSet };\n","import { isArray, isPlainObject } from 'is-what';\n\nfunction assignProp(carry, key, newVal, originalObject, includeNonenumerable) {\r\n const propType = {}.propertyIsEnumerable.call(originalObject, key)\r\n ? 'enumerable'\r\n : 'nonenumerable';\r\n if (propType === 'enumerable')\r\n carry[key] = newVal;\r\n if (includeNonenumerable && propType === 'nonenumerable') {\r\n Object.defineProperty(carry, key, {\r\n value: newVal,\r\n enumerable: false,\r\n writable: true,\r\n configurable: true,\r\n });\r\n }\r\n}\r\n/**\r\n * Copy (clone) an object and all its props recursively to get rid of any prop referenced of the original object. Arrays are also cloned, however objects inside arrays are still linked.\r\n *\r\n * @export\r\n * @template T\r\n * @param {T} target Target can be anything\r\n * @param {Options} [options = {}] Options can be `props` or `nonenumerable`\r\n * @returns {T} the target with replaced values\r\n * @export\r\n */\r\nfunction copy(target, options = {}) {\r\n if (isArray(target)) {\r\n return target.map((item) => copy(item, options));\r\n }\r\n if (!isPlainObject(target)) {\r\n return target;\r\n }\r\n const props = Object.getOwnPropertyNames(target);\r\n const symbols = Object.getOwnPropertySymbols(target);\r\n return [...props, ...symbols].reduce((carry, key) => {\r\n if (isArray(options.props) && !options.props.includes(key)) {\r\n return carry;\r\n }\r\n const val = target[key];\r\n const newVal = copy(val, options);\r\n assignProp(carry, key, newVal, target, options.nonenumerable);\r\n return carry;\r\n }, {});\r\n}\n\nexport { copy };\n","/* jshint proto: true */\nimport * as Constants from './constants';\nimport { copy } from 'copy-anything';\n\nexport function getLocation(index, inputStream) {\n let n = index + 1;\n let line = null;\n let column = -1;\n\n while (--n >= 0 && inputStream.charAt(n) !== '\\n') {\n column++;\n }\n\n if (typeof index === 'number') {\n line = (inputStream.slice(0, index).match(/\\n/g) || '').length;\n }\n\n return {\n line,\n column\n };\n}\n\nexport function copyArray(arr) {\n let i;\n const length = arr.length;\n const copy = new Array(length);\n\n for (i = 0; i < length; i++) {\n copy[i] = arr[i];\n }\n return copy;\n}\n\nexport function clone(obj) {\n const cloned = {};\n for (const prop in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, prop)) {\n cloned[prop] = obj[prop];\n }\n }\n return cloned;\n}\n\nexport function defaults(obj1, obj2) {\n let newObj = obj2 || {};\n if (!obj2._defaults) {\n newObj = {};\n const defaults = copy(obj1);\n newObj._defaults = defaults;\n const cloned = obj2 ? copy(obj2) : {};\n Object.assign(newObj, defaults, cloned);\n }\n return newObj;\n}\n\nexport function copyOptions(obj1, obj2) {\n if (obj2 && obj2._defaults) {\n return obj2;\n }\n const opts = defaults(obj1, obj2);\n if (opts.strictMath) {\n opts.math = Constants.Math.PARENS;\n }\n // Back compat with changed relativeUrls option\n if (opts.relativeUrls) {\n opts.rewriteUrls = Constants.RewriteUrls.ALL;\n }\n if (typeof opts.math === 'string') {\n switch (opts.math.toLowerCase()) {\n case 'always':\n opts.math = Constants.Math.ALWAYS;\n break;\n case 'parens-division':\n opts.math = Constants.Math.PARENS_DIVISION;\n break;\n case 'strict':\n case 'parens':\n opts.math = Constants.Math.PARENS;\n break;\n default:\n opts.math = Constants.Math.PARENS;\n }\n }\n if (typeof opts.rewriteUrls === 'string') {\n switch (opts.rewriteUrls.toLowerCase()) {\n case 'off':\n opts.rewriteUrls = Constants.RewriteUrls.OFF;\n break;\n case 'local':\n opts.rewriteUrls = Constants.RewriteUrls.LOCAL;\n break;\n case 'all':\n opts.rewriteUrls = Constants.RewriteUrls.ALL;\n break;\n }\n }\n return opts;\n}\n\nexport function merge(obj1, obj2) {\n for (const prop in obj2) {\n if (Object.prototype.hasOwnProperty.call(obj2, prop)) {\n obj1[prop] = obj2[prop];\n }\n }\n return obj1;\n}\n\nexport function flattenArray(arr, result = []) {\n for (let i = 0, length = arr.length; i < length; i++) {\n const value = arr[i];\n if (Array.isArray(value)) {\n flattenArray(value, result);\n } else {\n if (value !== undefined) {\n result.push(value);\n }\n }\n }\n return result;\n}\n\nexport function isNullOrUndefined(val) {\n return val === null || val === undefined\n}","import * as utils from './utils';\n\nconst anonymousFunc = /(|Function):(\\d+):(\\d+)/;\n\n/**\n * This is a centralized class of any error that could be thrown internally (mostly by the parser).\n * Besides standard .message it keeps some additional data like a path to the file where the error\n * occurred along with line and column numbers.\n *\n * @class\n * @extends Error\n * @type {module.LessError}\n *\n * @prop {string} type\n * @prop {string} filename\n * @prop {number} index\n * @prop {number} line\n * @prop {number} column\n * @prop {number} callLine\n * @prop {number} callExtract\n * @prop {string[]} extract\n *\n * @param {Object} e - An error object to wrap around or just a descriptive object\n * @param {Object} fileContentMap - An object with file contents in 'contents' property (like importManager) @todo - move to fileManager?\n * @param {string} [currentFilename]\n */\nconst LessError = function(e, fileContentMap, currentFilename) {\n Error.call(this);\n\n const filename = e.filename || currentFilename;\n\n this.message = e.message;\n this.stack = e.stack;\n\n if (fileContentMap && filename) {\n const input = fileContentMap.contents[filename];\n const loc = utils.getLocation(e.index, input);\n var line = loc.line;\n const col = loc.column;\n const callLine = e.call && utils.getLocation(e.call, input).line;\n const lines = input ? input.split('\\n') : '';\n\n this.type = e.type || 'Syntax';\n this.filename = filename;\n this.index = e.index;\n this.line = typeof line === 'number' ? line + 1 : null;\n this.column = col;\n\n if (!this.line && this.stack) {\n const found = this.stack.match(anonymousFunc);\n\n /**\n * We have to figure out how this environment stringifies anonymous functions\n * so we can correctly map plugin errors.\n * \n * Note, in Node 8, the output of anonymous funcs varied based on parameters\n * being present or not, so we inject dummy params.\n */\n const func = new Function('a', 'throw new Error()');\n let lineAdjust = 0;\n try {\n func();\n } catch (e) {\n const match = e.stack.match(anonymousFunc);\n lineAdjust = 1 - parseInt(match[2]);\n }\n\n if (found) {\n if (found[2]) {\n this.line = parseInt(found[2]) + lineAdjust;\n }\n if (found[3]) {\n this.column = parseInt(found[3]);\n }\n }\n }\n\n this.callLine = callLine + 1;\n this.callExtract = lines[callLine];\n\n this.extract = [\n lines[this.line - 2],\n lines[this.line - 1],\n lines[this.line]\n ];\n }\n\n};\n\nif (typeof Object.create === 'undefined') {\n const F = function () {};\n F.prototype = Error.prototype;\n LessError.prototype = new F();\n} else {\n LessError.prototype = Object.create(Error.prototype);\n}\n\nLessError.prototype.constructor = LessError;\n\n/**\n * An overridden version of the default Object.prototype.toString\n * which uses additional information to create a helpful message.\n *\n * @param {Object} options\n * @returns {string}\n */\nLessError.prototype.toString = function(options) {\n options = options || {};\n const isWarning = (this.type ?? '').toLowerCase().includes('warning');\n const type = isWarning ? this.type : `${this.type}Error`;\n const color = isWarning ? 'yellow' : 'red';\n\n let message = '';\n const extract = this.extract || [];\n let error = [];\n let stylize = function (str) { return str; };\n if (options.stylize) {\n const type = typeof options.stylize;\n if (type !== 'function') {\n throw Error(`options.stylize should be a function, got a ${type}!`);\n }\n stylize = options.stylize;\n }\n\n if (this.line !== null) {\n if (!isWarning && typeof extract[0] === 'string') {\n error.push(stylize(`${this.line - 1} ${extract[0]}`, 'grey'));\n }\n\n if (typeof extract[1] === 'string') {\n let errorTxt = `${this.line} `;\n if (extract[1]) {\n errorTxt += extract[1].slice(0, this.column) +\n stylize(stylize(stylize(extract[1].substr(this.column, 1), 'bold') +\n extract[1].slice(this.column + 1), 'red'), 'inverse');\n }\n error.push(errorTxt);\n }\n\n if (!isWarning && typeof extract[2] === 'string') {\n error.push(stylize(`${this.line + 1} ${extract[2]}`, 'grey'));\n }\n error = `${error.join('\\n') + stylize('', 'reset')}\\n`;\n }\n\n message += stylize(`${type}: ${this.message}`, color);\n if (this.filename) {\n message += stylize(' in ', color) + this.filename;\n }\n if (this.line) {\n message += stylize(` on line ${this.line}, column ${this.column + 1}:`, 'grey');\n }\n\n message += `\\n${error}`;\n\n if (this.callLine) {\n message += `${stylize('from ', color) + (this.filename || '')}/n`;\n message += `${stylize(this.callLine, 'grey')} ${this.callExtract}/n`;\n }\n\n return message;\n};\n\nexport default LessError;","import tree from '../tree';\n\nconst _visitArgs = { visitDeeper: true };\nlet _hasIndexed = false;\n\nfunction _noop(node) {\n return node;\n}\n\nfunction indexNodeTypes(parent, ticker) {\n // add .typeIndex to tree node types for lookup table\n let key, child;\n for (key in parent) { \n /* eslint guard-for-in: 0 */\n child = parent[key];\n switch (typeof child) {\n case 'function':\n // ignore bound functions directly on tree which do not have a prototype\n // or aren't nodes\n if (child.prototype && child.prototype.type) {\n child.prototype.typeIndex = ticker++;\n }\n break;\n case 'object':\n ticker = indexNodeTypes(child, ticker);\n break;\n \n }\n }\n return ticker;\n}\n\nclass Visitor {\n constructor(implementation) {\n this._implementation = implementation;\n this._visitInCache = {};\n this._visitOutCache = {};\n\n if (!_hasIndexed) {\n indexNodeTypes(tree, 1);\n _hasIndexed = true;\n }\n }\n\n visit(node) {\n if (!node) {\n return node;\n }\n\n const nodeTypeIndex = node.typeIndex;\n if (!nodeTypeIndex) {\n // MixinCall args aren't a node type?\n if (node.value && node.value.typeIndex) {\n this.visit(node.value);\n }\n return node;\n }\n\n const impl = this._implementation;\n let func = this._visitInCache[nodeTypeIndex];\n let funcOut = this._visitOutCache[nodeTypeIndex];\n const visitArgs = _visitArgs;\n let fnName;\n\n visitArgs.visitDeeper = true;\n\n if (!func) {\n fnName = `visit${node.type}`;\n func = impl[fnName] || _noop;\n funcOut = impl[`${fnName}Out`] || _noop;\n this._visitInCache[nodeTypeIndex] = func;\n this._visitOutCache[nodeTypeIndex] = funcOut;\n }\n\n if (func !== _noop) {\n const newNode = func.call(impl, node, visitArgs);\n if (node && impl.isReplacing) {\n node = newNode;\n }\n }\n\n if (visitArgs.visitDeeper && node) {\n if (node.length) {\n for (let i = 0, cnt = node.length; i < cnt; i++) {\n if (node[i].accept) {\n node[i].accept(this);\n }\n }\n } else if (node.accept) {\n node.accept(this);\n }\n }\n\n if (funcOut != _noop) {\n funcOut.call(impl, node);\n }\n\n return node;\n }\n\n visitArray(nodes, nonReplacing) {\n if (!nodes) {\n return nodes;\n }\n\n const cnt = nodes.length;\n let i;\n\n // Non-replacing\n if (nonReplacing || !this._implementation.isReplacing) {\n for (i = 0; i < cnt; i++) {\n this.visit(nodes[i]);\n }\n return nodes;\n }\n\n // Replacing\n const out = [];\n for (i = 0; i < cnt; i++) {\n const evald = this.visit(nodes[i]);\n if (evald === undefined) { continue; }\n if (!evald.splice) {\n out.push(evald);\n } else if (evald.length) {\n this.flatten(evald, out);\n }\n }\n return out;\n }\n\n flatten(arr, out) {\n if (!out) {\n out = [];\n }\n\n let cnt, i, item, nestedCnt, j, nestedItem;\n\n for (i = 0, cnt = arr.length; i < cnt; i++) {\n item = arr[i];\n if (item === undefined) {\n continue;\n }\n if (!item.splice) {\n out.push(item);\n continue;\n }\n\n for (j = 0, nestedCnt = item.length; j < nestedCnt; j++) {\n nestedItem = item[j];\n if (nestedItem === undefined) {\n continue;\n }\n if (!nestedItem.splice) {\n out.push(nestedItem);\n } else if (nestedItem.length) {\n this.flatten(nestedItem, out);\n }\n }\n }\n\n return out;\n }\n}\n\nexport default Visitor;\n","const contexts = {};\nexport default contexts;\nimport * as Constants from './constants';\n\nconst copyFromOriginal = function copyFromOriginal(original, destination, propertiesToCopy) {\n if (!original) { return; }\n\n for (let i = 0; i < propertiesToCopy.length; i++) {\n if (Object.prototype.hasOwnProperty.call(original, propertiesToCopy[i])) {\n destination[propertiesToCopy[i]] = original[propertiesToCopy[i]];\n }\n }\n};\n\n/*\n parse is used whilst parsing\n */\nconst parseCopyProperties = [\n // options\n 'paths', // option - unmodified - paths to search for imports on\n 'rewriteUrls', // option - whether to adjust URL's to be relative\n 'rootpath', // option - rootpath to append to URL's\n 'strictImports', // option -\n 'insecure', // option - whether to allow imports from insecure ssl hosts\n 'dumpLineNumbers', // option - whether to dump line numbers\n 'compress', // option - whether to compress\n 'syncImport', // option - whether to import synchronously\n 'chunkInput', // option - whether to chunk input. more performant but causes parse issues.\n 'mime', // browser only - mime type for sheet import\n 'useFileCache', // browser only - whether to use the per file session cache\n // context\n 'processImports', // option & context - whether to process imports. if false then imports will not be imported.\n // Used by the import manager to stop multiple import visitors being created.\n 'pluginManager', // Used as the plugin manager for the session\n 'quiet', // option - whether to log warnings\n];\n\ncontexts.Parse = function(options) {\n copyFromOriginal(options, this, parseCopyProperties);\n\n if (typeof this.paths === 'string') { this.paths = [this.paths]; }\n};\n\nconst evalCopyProperties = [\n 'paths', // additional include paths\n 'compress', // whether to compress\n 'math', // whether math has to be within parenthesis\n 'strictUnits', // whether units need to evaluate correctly\n 'sourceMap', // whether to output a source map\n 'importMultiple', // whether we are currently importing multiple copies\n 'urlArgs', // whether to add args into url tokens\n 'javascriptEnabled', // option - whether Inline JavaScript is enabled. if undefined, defaults to false\n 'pluginManager', // Used as the plugin manager for the session\n 'importantScope', // used to bubble up !important statements\n 'rewriteUrls' // option - whether to adjust URL's to be relative\n];\n\ncontexts.Eval = function(options, frames) {\n copyFromOriginal(options, this, evalCopyProperties);\n\n if (typeof this.paths === 'string') { this.paths = [this.paths]; }\n\n this.frames = frames || [];\n this.importantScope = this.importantScope || [];\n};\n\ncontexts.Eval.prototype.enterCalc = function () {\n if (!this.calcStack) {\n this.calcStack = [];\n }\n this.calcStack.push(true);\n this.inCalc = true;\n};\n\ncontexts.Eval.prototype.exitCalc = function () {\n this.calcStack.pop();\n if (!this.calcStack.length) {\n this.inCalc = false;\n }\n};\n\ncontexts.Eval.prototype.inParenthesis = function () {\n if (!this.parensStack) {\n this.parensStack = [];\n }\n this.parensStack.push(true);\n};\n\ncontexts.Eval.prototype.outOfParenthesis = function () {\n this.parensStack.pop();\n};\n\ncontexts.Eval.prototype.inCalc = false;\ncontexts.Eval.prototype.mathOn = true;\ncontexts.Eval.prototype.isMathOn = function (op) {\n if (!this.mathOn) {\n return false;\n }\n if (op === '/' && this.math !== Constants.Math.ALWAYS && (!this.parensStack || !this.parensStack.length)) {\n return false;\n }\n if (this.math > Constants.Math.PARENS_DIVISION) {\n return this.parensStack && this.parensStack.length;\n }\n return true;\n};\n\ncontexts.Eval.prototype.pathRequiresRewrite = function (path) {\n const isRelative = this.rewriteUrls === Constants.RewriteUrls.LOCAL ? isPathLocalRelative : isPathRelative;\n\n return isRelative(path);\n};\n\ncontexts.Eval.prototype.rewritePath = function (path, rootpath) {\n let newPath;\n\n rootpath = rootpath || '';\n newPath = this.normalizePath(rootpath + path);\n\n // If a path was explicit relative and the rootpath was not an absolute path\n // we must ensure that the new path is also explicit relative.\n if (isPathLocalRelative(path) &&\n isPathRelative(rootpath) &&\n isPathLocalRelative(newPath) === false) {\n newPath = `./${newPath}`;\n }\n\n return newPath;\n};\n\ncontexts.Eval.prototype.normalizePath = function (path) {\n const segments = path.split('/').reverse();\n let segment;\n\n path = [];\n while (segments.length !== 0) {\n segment = segments.pop();\n switch ( segment ) {\n case '.':\n break;\n case '..':\n if ((path.length === 0) || (path[path.length - 1] === '..')) {\n path.push( segment );\n } else {\n path.pop();\n }\n break;\n default:\n path.push(segment);\n break;\n }\n }\n\n return path.join('/');\n};\n\nfunction isPathRelative(path) {\n return !/^(?:[a-z-]+:|\\/|#)/i.test(path);\n}\n\nfunction isPathLocalRelative(path) {\n return path.charAt(0) === '.';\n}\n\n// todo - do the same for the toCSS ?\n","class ImportSequencer {\n constructor(onSequencerEmpty) {\n this.imports = [];\n this.variableImports = [];\n this._onSequencerEmpty = onSequencerEmpty;\n this._currentDepth = 0;\n }\n\n addImport(callback) {\n const importSequencer = this,\n importItem = {\n callback,\n args: null,\n isReady: false\n };\n this.imports.push(importItem);\n return function() {\n importItem.args = Array.prototype.slice.call(arguments, 0);\n importItem.isReady = true;\n importSequencer.tryRun();\n };\n }\n\n addVariableImport(callback) {\n this.variableImports.push(callback);\n }\n\n tryRun() {\n this._currentDepth++;\n try {\n while (true) {\n while (this.imports.length > 0) {\n const importItem = this.imports[0];\n if (!importItem.isReady) {\n return;\n }\n this.imports = this.imports.slice(1);\n importItem.callback.apply(null, importItem.args);\n }\n if (this.variableImports.length === 0) {\n break;\n }\n const variableImport = this.variableImports[0];\n this.variableImports = this.variableImports.slice(1);\n variableImport();\n }\n } finally {\n this._currentDepth--;\n }\n if (this._currentDepth === 0 && this._onSequencerEmpty) {\n this._onSequencerEmpty();\n }\n }\n}\n\nexport default ImportSequencer;\n","/* eslint-disable no-unused-vars */\n/**\n * @todo - Remove unused when JSDoc types are added for visitor methods\n */\nimport contexts from '../contexts';\nimport Visitor from './visitor';\nimport ImportSequencer from './import-sequencer';\nimport * as utils from '../utils';\n\nconst ImportVisitor = function(importer, finish) {\n\n this._visitor = new Visitor(this);\n this._importer = importer;\n this._finish = finish;\n this.context = new contexts.Eval();\n this.importCount = 0;\n this.onceFileDetectionMap = {};\n this.recursionDetector = {};\n this._sequencer = new ImportSequencer(this._onSequencerEmpty.bind(this));\n};\n\nImportVisitor.prototype = {\n isReplacing: false,\n run: function (root) {\n try {\n // process the contents\n this._visitor.visit(root);\n }\n catch (e) {\n this.error = e;\n }\n\n this.isFinished = true;\n this._sequencer.tryRun();\n },\n _onSequencerEmpty: function() {\n if (!this.isFinished) {\n return;\n }\n this._finish(this.error);\n },\n visitImport: function (importNode, visitArgs) {\n const inlineCSS = importNode.options.inline;\n\n if (!importNode.css || inlineCSS) {\n\n const context = new contexts.Eval(this.context, utils.copyArray(this.context.frames));\n const importParent = context.frames[0];\n\n this.importCount++;\n if (importNode.isVariableImport()) {\n this._sequencer.addVariableImport(this.processImportNode.bind(this, importNode, context, importParent));\n } else {\n this.processImportNode(importNode, context, importParent);\n }\n }\n visitArgs.visitDeeper = false;\n },\n processImportNode: function(importNode, context, importParent) {\n let evaldImportNode;\n const inlineCSS = importNode.options.inline;\n\n try {\n evaldImportNode = importNode.evalForImport(context);\n } catch (e) {\n if (!e.filename) { e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename; }\n // attempt to eval properly and treat as css\n importNode.css = true;\n // if that fails, this error will be thrown\n importNode.error = e;\n }\n\n if (evaldImportNode && (!evaldImportNode.css || inlineCSS)) {\n\n if (evaldImportNode.options.multiple) {\n context.importMultiple = true;\n }\n\n // try appending if we haven't determined if it is css or not\n const tryAppendLessExtension = evaldImportNode.css === undefined;\n\n for (let i = 0; i < importParent.rules.length; i++) {\n if (importParent.rules[i] === importNode) {\n importParent.rules[i] = evaldImportNode;\n break;\n }\n }\n\n const onImported = this.onImported.bind(this, evaldImportNode, context), sequencedOnImported = this._sequencer.addImport(onImported);\n\n this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.fileInfo(),\n evaldImportNode.options, sequencedOnImported);\n } else {\n this.importCount--;\n if (this.isFinished) {\n this._sequencer.tryRun();\n }\n }\n },\n onImported: function (importNode, context, e, root, importedAtRoot, fullPath) {\n if (e) {\n if (!e.filename) {\n e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename;\n }\n this.error = e;\n }\n\n const importVisitor = this,\n inlineCSS = importNode.options.inline,\n isPlugin = importNode.options.isPlugin,\n isOptional = importNode.options.optional,\n duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector;\n\n if (!context.importMultiple) {\n if (duplicateImport) {\n importNode.skip = true;\n } else {\n importNode.skip = function() {\n if (fullPath in importVisitor.onceFileDetectionMap) {\n return true;\n }\n importVisitor.onceFileDetectionMap[fullPath] = true;\n return false;\n };\n }\n }\n\n if (!fullPath && isOptional) {\n importNode.skip = true;\n }\n\n if (root) {\n importNode.root = root;\n importNode.importedFilename = fullPath;\n\n if (!inlineCSS && !isPlugin && (context.importMultiple || !duplicateImport)) {\n importVisitor.recursionDetector[fullPath] = true;\n\n const oldContext = this.context;\n this.context = context;\n try {\n this._visitor.visit(root);\n } catch (e) {\n this.error = e;\n }\n this.context = oldContext;\n }\n }\n\n importVisitor.importCount--;\n\n if (importVisitor.isFinished) {\n importVisitor._sequencer.tryRun();\n }\n },\n visitDeclaration: function (declNode, visitArgs) {\n if (declNode.value.type === 'DetachedRuleset') {\n this.context.frames.unshift(declNode);\n } else {\n visitArgs.visitDeeper = false;\n }\n },\n visitDeclarationOut: function(declNode) {\n if (declNode.value.type === 'DetachedRuleset') {\n this.context.frames.shift();\n }\n },\n visitAtRule: function (atRuleNode, visitArgs) {\n if (atRuleNode.value) {\n this.context.frames.unshift(atRuleNode);\n } else if (atRuleNode.declarations && atRuleNode.declarations.length) {\n if (atRuleNode.isRooted) {\n this.context.frames.unshift(atRuleNode);\n } else {\n this.context.frames.unshift(atRuleNode.declarations[0]);\n }\n } else if (atRuleNode.rules && atRuleNode.rules.length) {\n this.context.frames.unshift(atRuleNode);\n }\n },\n visitAtRuleOut: function (atRuleNode) {\n this.context.frames.shift();\n },\n visitMixinDefinition: function (mixinDefinitionNode, visitArgs) {\n this.context.frames.unshift(mixinDefinitionNode);\n },\n visitMixinDefinitionOut: function (mixinDefinitionNode) {\n this.context.frames.shift();\n },\n visitRuleset: function (rulesetNode, visitArgs) {\n this.context.frames.unshift(rulesetNode);\n },\n visitRulesetOut: function (rulesetNode) {\n this.context.frames.shift();\n },\n visitMedia: function (mediaNode, visitArgs) {\n this.context.frames.unshift(mediaNode.rules[0]);\n },\n visitMediaOut: function (mediaNode) {\n this.context.frames.shift();\n }\n};\nexport default ImportVisitor;\n","class SetTreeVisibilityVisitor {\n constructor(visible) {\n this.visible = visible;\n }\n\n run(root) {\n this.visit(root);\n }\n\n visitArray(nodes) {\n if (!nodes) {\n return nodes;\n }\n\n const cnt = nodes.length;\n let i;\n for (i = 0; i < cnt; i++) {\n this.visit(nodes[i]);\n }\n return nodes;\n }\n\n visit(node) {\n if (!node) {\n return node;\n }\n if (node.constructor === Array) {\n return this.visitArray(node);\n }\n\n if (!node.blocksVisibility || node.blocksVisibility()) {\n return node;\n }\n if (this.visible) {\n node.ensureVisibility();\n } else {\n node.ensureInvisibility();\n }\n\n node.accept(this);\n return node;\n }\n}\n\nexport default SetTreeVisibilityVisitor;","/* eslint-disable no-unused-vars */\n/**\n * @todo - Remove unused when JSDoc types are added for visitor methods\n */\nimport tree from '../tree';\nimport Visitor from './visitor';\nimport logger from '../logger';\nimport * as utils from '../utils';\n\n/* jshint loopfunc:true */\n\nclass ExtendFinderVisitor {\n constructor() {\n this._visitor = new Visitor(this);\n this.contexts = [];\n this.allExtendsStack = [[]];\n }\n\n run(root) {\n root = this._visitor.visit(root);\n root.allExtends = this.allExtendsStack[0];\n return root;\n }\n\n visitDeclaration(declNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitMixinDefinition(mixinDefinitionNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitRuleset(rulesetNode, visitArgs) {\n if (rulesetNode.root) {\n return;\n }\n\n let i;\n let j;\n let extend;\n const allSelectorsExtendList = [];\n let extendList;\n\n // get &:extend(.a); rules which apply to all selectors in this ruleset\n const rules = rulesetNode.rules, ruleCnt = rules ? rules.length : 0;\n for (i = 0; i < ruleCnt; i++) {\n if (rulesetNode.rules[i] instanceof tree.Extend) {\n allSelectorsExtendList.push(rules[i]);\n rulesetNode.extendOnEveryPath = true;\n }\n }\n\n // now find every selector and apply the extends that apply to all extends\n // and the ones which apply to an individual extend\n const paths = rulesetNode.paths;\n for (i = 0; i < paths.length; i++) {\n const selectorPath = paths[i], selector = selectorPath[selectorPath.length - 1], selExtendList = selector.extendList;\n\n extendList = selExtendList ? utils.copyArray(selExtendList).concat(allSelectorsExtendList)\n : allSelectorsExtendList;\n\n if (extendList) {\n extendList = extendList.map(function(allSelectorsExtend) {\n return allSelectorsExtend.clone();\n });\n }\n\n for (j = 0; j < extendList.length; j++) {\n this.foundExtends = true;\n extend = extendList[j];\n extend.findSelfSelectors(selectorPath);\n extend.ruleset = rulesetNode;\n if (j === 0) { extend.firstExtendOnThisSelectorPath = true; }\n this.allExtendsStack[this.allExtendsStack.length - 1].push(extend);\n }\n }\n\n this.contexts.push(rulesetNode.selectors);\n }\n\n visitRulesetOut(rulesetNode) {\n if (!rulesetNode.root) {\n this.contexts.length = this.contexts.length - 1;\n }\n }\n\n visitMedia(mediaNode, visitArgs) {\n mediaNode.allExtends = [];\n this.allExtendsStack.push(mediaNode.allExtends);\n }\n\n visitMediaOut(mediaNode) {\n this.allExtendsStack.length = this.allExtendsStack.length - 1;\n }\n\n visitAtRule(atRuleNode, visitArgs) {\n atRuleNode.allExtends = [];\n this.allExtendsStack.push(atRuleNode.allExtends);\n }\n\n visitAtRuleOut(atRuleNode) {\n this.allExtendsStack.length = this.allExtendsStack.length - 1;\n }\n}\n\nclass ProcessExtendsVisitor {\n constructor() {\n this._visitor = new Visitor(this);\n }\n\n run(root) {\n const extendFinder = new ExtendFinderVisitor();\n this.extendIndices = {};\n extendFinder.run(root);\n if (!extendFinder.foundExtends) { return root; }\n root.allExtends = root.allExtends.concat(this.doExtendChaining(root.allExtends, root.allExtends));\n this.allExtendsStack = [root.allExtends];\n const newRoot = this._visitor.visit(root);\n this.checkExtendsForNonMatched(root.allExtends);\n return newRoot;\n }\n\n checkExtendsForNonMatched(extendList) {\n const indices = this.extendIndices;\n extendList.filter(function(extend) {\n return !extend.hasFoundMatches && extend.parent_ids.length == 1;\n }).forEach(function(extend) {\n let selector = '_unknown_';\n try {\n selector = extend.selector.toCSS({});\n }\n catch (_) {}\n\n if (!indices[`${extend.index} ${selector}`]) {\n indices[`${extend.index} ${selector}`] = true;\n /**\n * @todo Shouldn't this be an error? To alert the developer\n * that they may have made an error in the selector they are\n * targeting?\n */\n logger.warn(`WARNING: extend '${selector}' has no matches`);\n }\n });\n }\n\n doExtendChaining(extendsList, extendsListTarget, iterationCount) {\n //\n // chaining is different from normal extension.. if we extend an extend then we are not just copying, altering\n // and pasting the selector we would do normally, but we are also adding an extend with the same target selector\n // this means this new extend can then go and alter other extends\n //\n // this method deals with all the chaining work - without it, extend is flat and doesn't work on other extend selectors\n // this is also the most expensive.. and a match on one selector can cause an extension of a selector we had already\n // processed if we look at each selector at a time, as is done in visitRuleset\n\n let extendIndex;\n\n let targetExtendIndex;\n let matches;\n const extendsToAdd = [];\n let newSelector;\n const extendVisitor = this;\n let selectorPath;\n let extend;\n let targetExtend;\n let newExtend;\n\n iterationCount = iterationCount || 0;\n\n // loop through comparing every extend with every target extend.\n // a target extend is the one on the ruleset we are looking at copy/edit/pasting in place\n // e.g. .a:extend(.b) {} and .b:extend(.c) {} then the first extend extends the second one\n // and the second is the target.\n // the separation into two lists allows us to process a subset of chains with a bigger set, as is the\n // case when processing media queries\n for (extendIndex = 0; extendIndex < extendsList.length; extendIndex++) {\n for (targetExtendIndex = 0; targetExtendIndex < extendsListTarget.length; targetExtendIndex++) {\n\n extend = extendsList[extendIndex];\n targetExtend = extendsListTarget[targetExtendIndex];\n\n // look for circular references\n if ( extend.parent_ids.indexOf( targetExtend.object_id ) >= 0 ) { continue; }\n\n // find a match in the target extends self selector (the bit before :extend)\n selectorPath = [targetExtend.selfSelectors[0]];\n matches = extendVisitor.findMatch(extend, selectorPath);\n\n if (matches.length) {\n extend.hasFoundMatches = true;\n\n // we found a match, so for each self selector..\n extend.selfSelectors.forEach(function(selfSelector) {\n const info = targetExtend.visibilityInfo();\n\n // process the extend as usual\n newSelector = extendVisitor.extendSelector(matches, selectorPath, selfSelector, extend.isVisible());\n\n // but now we create a new extend from it\n newExtend = new(tree.Extend)(targetExtend.selector, targetExtend.option, 0, targetExtend.fileInfo(), info);\n newExtend.selfSelectors = newSelector;\n\n // add the extend onto the list of extends for that selector\n newSelector[newSelector.length - 1].extendList = [newExtend];\n\n // record that we need to add it.\n extendsToAdd.push(newExtend);\n newExtend.ruleset = targetExtend.ruleset;\n\n // remember its parents for circular references\n newExtend.parent_ids = newExtend.parent_ids.concat(targetExtend.parent_ids, extend.parent_ids);\n\n // only process the selector once.. if we have :extend(.a,.b) then multiple\n // extends will look at the same selector path, so when extending\n // we know that any others will be duplicates in terms of what is added to the css\n if (targetExtend.firstExtendOnThisSelectorPath) {\n newExtend.firstExtendOnThisSelectorPath = true;\n targetExtend.ruleset.paths.push(newSelector);\n }\n });\n }\n }\n }\n\n if (extendsToAdd.length) {\n // try to detect circular references to stop a stack overflow.\n // may no longer be needed.\n this.extendChainCount++;\n if (iterationCount > 100) {\n let selectorOne = '{unable to calculate}';\n let selectorTwo = '{unable to calculate}';\n try {\n selectorOne = extendsToAdd[0].selfSelectors[0].toCSS();\n selectorTwo = extendsToAdd[0].selector.toCSS();\n }\n catch (e) {}\n throw { message: `extend circular reference detected. One of the circular extends is currently:${selectorOne}:extend(${selectorTwo})`};\n }\n\n // now process the new extends on the existing rules so that we can handle a extending b extending c extending\n // d extending e...\n return extendsToAdd.concat(extendVisitor.doExtendChaining(extendsToAdd, extendsListTarget, iterationCount + 1));\n } else {\n return extendsToAdd;\n }\n }\n\n visitDeclaration(ruleNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitMixinDefinition(mixinDefinitionNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitSelector(selectorNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitRuleset(rulesetNode, visitArgs) {\n if (rulesetNode.root) {\n return;\n }\n let matches;\n let pathIndex;\n let extendIndex;\n const allExtends = this.allExtendsStack[this.allExtendsStack.length - 1];\n const selectorsToAdd = [];\n const extendVisitor = this;\n let selectorPath;\n\n // look at each selector path in the ruleset, find any extend matches and then copy, find and replace\n\n for (extendIndex = 0; extendIndex < allExtends.length; extendIndex++) {\n for (pathIndex = 0; pathIndex < rulesetNode.paths.length; pathIndex++) {\n selectorPath = rulesetNode.paths[pathIndex];\n\n // extending extends happens initially, before the main pass\n if (rulesetNode.extendOnEveryPath) { continue; }\n const extendList = selectorPath[selectorPath.length - 1].extendList;\n if (extendList && extendList.length) { continue; }\n\n matches = this.findMatch(allExtends[extendIndex], selectorPath);\n\n if (matches.length) {\n allExtends[extendIndex].hasFoundMatches = true;\n\n allExtends[extendIndex].selfSelectors.forEach(function(selfSelector) {\n let extendedSelectors;\n extendedSelectors = extendVisitor.extendSelector(matches, selectorPath, selfSelector, allExtends[extendIndex].isVisible());\n selectorsToAdd.push(extendedSelectors);\n });\n }\n }\n }\n rulesetNode.paths = rulesetNode.paths.concat(selectorsToAdd);\n }\n\n findMatch(extend, haystackSelectorPath) {\n //\n // look through the haystack selector path to try and find the needle - extend.selector\n // returns an array of selector matches that can then be replaced\n //\n let haystackSelectorIndex;\n\n let hackstackSelector;\n let hackstackElementIndex;\n let haystackElement;\n let targetCombinator;\n let i;\n const extendVisitor = this;\n const needleElements = extend.selector.elements;\n const potentialMatches = [];\n let potentialMatch;\n const matches = [];\n\n // loop through the haystack elements\n for (haystackSelectorIndex = 0; haystackSelectorIndex < haystackSelectorPath.length; haystackSelectorIndex++) {\n hackstackSelector = haystackSelectorPath[haystackSelectorIndex];\n\n for (hackstackElementIndex = 0; hackstackElementIndex < hackstackSelector.elements.length; hackstackElementIndex++) {\n\n haystackElement = hackstackSelector.elements[hackstackElementIndex];\n\n // if we allow elements before our match we can add a potential match every time. otherwise only at the first element.\n if (extend.allowBefore || (haystackSelectorIndex === 0 && hackstackElementIndex === 0)) {\n potentialMatches.push({pathIndex: haystackSelectorIndex, index: hackstackElementIndex, matched: 0,\n initialCombinator: haystackElement.combinator});\n }\n\n for (i = 0; i < potentialMatches.length; i++) {\n potentialMatch = potentialMatches[i];\n\n // selectors add \" \" onto the first element. When we use & it joins the selectors together, but if we don't\n // then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to\n // work out what the resulting combinator will be\n targetCombinator = haystackElement.combinator.value;\n if (targetCombinator === '' && hackstackElementIndex === 0) {\n targetCombinator = ' ';\n }\n\n // if we don't match, null our match to indicate failure\n if (!extendVisitor.isElementValuesEqual(needleElements[potentialMatch.matched].value, haystackElement.value) ||\n (potentialMatch.matched > 0 && needleElements[potentialMatch.matched].combinator.value !== targetCombinator)) {\n potentialMatch = null;\n } else {\n potentialMatch.matched++;\n }\n\n // if we are still valid and have finished, test whether we have elements after and whether these are allowed\n if (potentialMatch) {\n potentialMatch.finished = potentialMatch.matched === needleElements.length;\n if (potentialMatch.finished &&\n (!extend.allowAfter &&\n (hackstackElementIndex + 1 < hackstackSelector.elements.length || haystackSelectorIndex + 1 < haystackSelectorPath.length))) {\n potentialMatch = null;\n }\n }\n // if null we remove, if not, we are still valid, so either push as a valid match or continue\n if (potentialMatch) {\n if (potentialMatch.finished) {\n potentialMatch.length = needleElements.length;\n potentialMatch.endPathIndex = haystackSelectorIndex;\n potentialMatch.endPathElementIndex = hackstackElementIndex + 1; // index after end of match\n potentialMatches.length = 0; // we don't allow matches to overlap, so start matching again\n matches.push(potentialMatch);\n }\n } else {\n potentialMatches.splice(i, 1);\n i--;\n }\n }\n }\n }\n return matches;\n }\n\n isElementValuesEqual(elementValue1, elementValue2) {\n if (typeof elementValue1 === 'string' || typeof elementValue2 === 'string') {\n return elementValue1 === elementValue2;\n }\n if (elementValue1 instanceof tree.Attribute) {\n if (elementValue1.op !== elementValue2.op || elementValue1.key !== elementValue2.key) {\n return false;\n }\n if (!elementValue1.value || !elementValue2.value) {\n if (elementValue1.value || elementValue2.value) {\n return false;\n }\n return true;\n }\n elementValue1 = elementValue1.value.value || elementValue1.value;\n elementValue2 = elementValue2.value.value || elementValue2.value;\n return elementValue1 === elementValue2;\n }\n elementValue1 = elementValue1.value;\n elementValue2 = elementValue2.value;\n if (elementValue1 instanceof tree.Selector) {\n if (!(elementValue2 instanceof tree.Selector) || elementValue1.elements.length !== elementValue2.elements.length) {\n return false;\n }\n for (let i = 0; i < elementValue1.elements.length; i++) {\n if (elementValue1.elements[i].combinator.value !== elementValue2.elements[i].combinator.value) {\n if (i !== 0 || (elementValue1.elements[i].combinator.value || ' ') !== (elementValue2.elements[i].combinator.value || ' ')) {\n return false;\n }\n }\n if (!this.isElementValuesEqual(elementValue1.elements[i].value, elementValue2.elements[i].value)) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n\n extendSelector(matches, selectorPath, replacementSelector, isVisible) {\n\n // for a set of matches, replace each match with the replacement selector\n\n let currentSelectorPathIndex = 0, currentSelectorPathElementIndex = 0, path = [], matchIndex, selector, firstElement, match, newElements;\n\n for (matchIndex = 0; matchIndex < matches.length; matchIndex++) {\n match = matches[matchIndex];\n selector = selectorPath[match.pathIndex];\n firstElement = new tree.Element(\n match.initialCombinator,\n replacementSelector.elements[0].value,\n replacementSelector.elements[0].isVariable,\n replacementSelector.elements[0].getIndex(),\n replacementSelector.elements[0].fileInfo()\n );\n\n if (match.pathIndex > currentSelectorPathIndex && currentSelectorPathElementIndex > 0) {\n path[path.length - 1].elements = path[path.length - 1]\n .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));\n currentSelectorPathElementIndex = 0;\n currentSelectorPathIndex++;\n }\n\n newElements = selector.elements\n .slice(currentSelectorPathElementIndex, match.index)\n .concat([firstElement])\n .concat(replacementSelector.elements.slice(1));\n\n if (currentSelectorPathIndex === match.pathIndex && matchIndex > 0) {\n path[path.length - 1].elements =\n path[path.length - 1].elements.concat(newElements);\n } else {\n path = path.concat(selectorPath.slice(currentSelectorPathIndex, match.pathIndex));\n\n path.push(new tree.Selector(\n newElements\n ));\n }\n currentSelectorPathIndex = match.endPathIndex;\n currentSelectorPathElementIndex = match.endPathElementIndex;\n if (currentSelectorPathElementIndex >= selectorPath[currentSelectorPathIndex].elements.length) {\n currentSelectorPathElementIndex = 0;\n currentSelectorPathIndex++;\n }\n }\n\n if (currentSelectorPathIndex < selectorPath.length && currentSelectorPathElementIndex > 0) {\n path[path.length - 1].elements = path[path.length - 1]\n .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex));\n currentSelectorPathIndex++;\n }\n\n path = path.concat(selectorPath.slice(currentSelectorPathIndex, selectorPath.length));\n path = path.map(function (currentValue) {\n // we can re-use elements here, because the visibility property matters only for selectors\n const derived = currentValue.createDerived(currentValue.elements);\n if (isVisible) {\n derived.ensureVisibility();\n } else {\n derived.ensureInvisibility();\n }\n return derived;\n });\n return path;\n }\n\n visitMedia(mediaNode, visitArgs) {\n let newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]);\n newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, mediaNode.allExtends));\n this.allExtendsStack.push(newAllExtends);\n }\n\n visitMediaOut(mediaNode) {\n const lastIndex = this.allExtendsStack.length - 1;\n this.allExtendsStack.length = lastIndex;\n }\n\n visitAtRule(atRuleNode, visitArgs) {\n let newAllExtends = atRuleNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]);\n newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, atRuleNode.allExtends));\n this.allExtendsStack.push(newAllExtends);\n }\n\n visitAtRuleOut(atRuleNode) {\n const lastIndex = this.allExtendsStack.length - 1;\n this.allExtendsStack.length = lastIndex;\n }\n}\n\nexport default ProcessExtendsVisitor;\n","/* eslint-disable no-unused-vars */\n/**\n * @todo - Remove unused when JSDoc types are added for visitor methods\n */\nimport Visitor from './visitor';\n\nclass JoinSelectorVisitor {\n constructor() {\n this.contexts = [[]];\n this._visitor = new Visitor(this);\n }\n\n run(root) {\n return this._visitor.visit(root);\n }\n\n visitDeclaration(declNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitMixinDefinition(mixinDefinitionNode, visitArgs) {\n visitArgs.visitDeeper = false;\n }\n\n visitRuleset(rulesetNode, visitArgs) {\n const context = this.contexts[this.contexts.length - 1];\n const paths = [];\n let selectors;\n\n this.contexts.push(paths);\n\n if (!rulesetNode.root) {\n selectors = rulesetNode.selectors;\n if (selectors) {\n selectors = selectors.filter(function(selector) { return selector.getIsOutput(); });\n rulesetNode.selectors = selectors.length ? selectors : (selectors = null);\n if (selectors) { rulesetNode.joinSelectors(paths, context, selectors); }\n }\n if (!selectors) { rulesetNode.rules = null; }\n rulesetNode.paths = paths;\n }\n }\n\n visitRulesetOut(rulesetNode) {\n this.contexts.length = this.contexts.length - 1;\n }\n\n visitMedia(mediaNode, visitArgs) {\n const context = this.contexts[this.contexts.length - 1];\n mediaNode.rules[0].root = (context.length === 0 || context[0].multiMedia);\n }\n\n visitAtRule(atRuleNode, visitArgs) {\n const context = this.contexts[this.contexts.length - 1];\n\n if (atRuleNode.declarations && atRuleNode.declarations.length) {\n atRuleNode.declarations[0].root = (context.length === 0 || context[0].multiMedia);\n }\n else if (atRuleNode.rules && atRuleNode.rules.length) {\n atRuleNode.rules[0].root = (atRuleNode.isRooted || context.length === 0 || null);\n }\n }\n}\n\nexport default JoinSelectorVisitor;\n","/* eslint-disable no-unused-vars */\n/**\n * @todo - Remove unused when JSDoc types are added for visitor methods\n */\nimport tree from '../tree';\nimport Visitor from './visitor';\n\nclass CSSVisitorUtils {\n constructor(context) {\n this._visitor = new Visitor(this);\n this._context = context;\n }\n\n containsSilentNonBlockedChild(bodyRules) {\n let rule;\n if (!bodyRules) {\n return false;\n }\n for (let r = 0; r < bodyRules.length; r++) {\n rule = bodyRules[r];\n if (rule.isSilent && rule.isSilent(this._context) && !rule.blocksVisibility()) {\n // the atrule contains something that was referenced (likely by extend)\n // therefore it needs to be shown in output too\n return true;\n }\n }\n return false;\n }\n\n keepOnlyVisibleChilds(owner) {\n if (owner && owner.rules) {\n owner.rules = owner.rules.filter(thing => thing.isVisible());\n }\n }\n\n isEmpty(owner) {\n return (owner && owner.rules) \n ? (owner.rules.length === 0) : true;\n }\n\n hasVisibleSelector(rulesetNode) {\n return (rulesetNode && rulesetNode.paths)\n ? (rulesetNode.paths.length > 0) : false;\n }\n\n resolveVisibility(node) {\n if (!node.blocksVisibility()) {\n if (this.isEmpty(node)) {\n return ;\n }\n\n return node;\n }\n\n const compiledRulesBody = node.rules[0];\n this.keepOnlyVisibleChilds(compiledRulesBody);\n\n if (this.isEmpty(compiledRulesBody)) {\n return ;\n }\n\n node.ensureVisibility();\n node.removeVisibilityBlock();\n\n return node;\n }\n\n isVisibleRuleset(rulesetNode) {\n if (rulesetNode.firstRoot) {\n return true;\n }\n\n if (this.isEmpty(rulesetNode)) {\n return false;\n }\n\n if (!rulesetNode.root && !this.hasVisibleSelector(rulesetNode)) {\n return false;\n }\n\n return true;\n }\n}\n\nconst ToCSSVisitor = function(context) {\n this._visitor = new Visitor(this);\n this._context = context;\n this.utils = new CSSVisitorUtils(context);\n};\n\nToCSSVisitor.prototype = {\n isReplacing: true,\n run: function (root) {\n return this._visitor.visit(root);\n },\n\n visitDeclaration: function (declNode, visitArgs) {\n if (declNode.blocksVisibility() || declNode.variable) {\n return;\n }\n return declNode;\n },\n\n visitMixinDefinition: function (mixinNode, visitArgs) {\n // mixin definitions do not get eval'd - this means they keep state\n // so we have to clear that state here so it isn't used if toCSS is called twice\n mixinNode.frames = [];\n },\n\n visitExtend: function (extendNode, visitArgs) {\n },\n\n visitComment: function (commentNode, visitArgs) {\n if (commentNode.blocksVisibility() || commentNode.isSilent(this._context)) {\n return;\n }\n return commentNode;\n },\n\n visitMedia: function(mediaNode, visitArgs) {\n const originalRules = mediaNode.rules[0].rules;\n mediaNode.accept(this._visitor);\n visitArgs.visitDeeper = false;\n\n return this.utils.resolveVisibility(mediaNode, originalRules);\n },\n\n visitImport: function (importNode, visitArgs) {\n if (importNode.blocksVisibility()) {\n return ;\n }\n return importNode;\n },\n\n visitAtRule: function(atRuleNode, visitArgs) {\n if (atRuleNode.rules && atRuleNode.rules.length) {\n return this.visitAtRuleWithBody(atRuleNode, visitArgs);\n } else {\n return this.visitAtRuleWithoutBody(atRuleNode, visitArgs);\n }\n },\n\n visitAnonymous: function(anonymousNode, visitArgs) {\n if (!anonymousNode.blocksVisibility()) {\n anonymousNode.accept(this._visitor);\n return anonymousNode;\n }\n },\n\n visitAtRuleWithBody: function(atRuleNode, visitArgs) {\n // if there is only one nested ruleset and that one has no path, then it is\n // just fake ruleset\n function hasFakeRuleset(atRuleNode) {\n const bodyRules = atRuleNode.rules;\n return bodyRules.length === 1 && (!bodyRules[0].paths || bodyRules[0].paths.length === 0);\n }\n function getBodyRules(atRuleNode) {\n const nodeRules = atRuleNode.rules;\n if (hasFakeRuleset(atRuleNode)) {\n return nodeRules[0].rules;\n }\n\n return nodeRules;\n }\n // it is still true that it is only one ruleset in array\n // this is last such moment\n // process childs\n const originalRules = getBodyRules(atRuleNode);\n atRuleNode.accept(this._visitor);\n visitArgs.visitDeeper = false;\n\n if (!this.utils.isEmpty(atRuleNode)) {\n this._mergeRules(atRuleNode.rules[0].rules);\n }\n\n return this.utils.resolveVisibility(atRuleNode, originalRules);\n },\n\n visitAtRuleWithoutBody: function(atRuleNode, visitArgs) {\n if (atRuleNode.blocksVisibility()) {\n return;\n }\n\n if (atRuleNode.name === '@charset') {\n // Only output the debug info together with subsequent @charset definitions\n // a comment (or @media statement) before the actual @charset atrule would\n // be considered illegal css as it has to be on the first line\n if (this.charset) {\n if (atRuleNode.debugInfo) {\n const comment = new tree.Comment(`/* ${atRuleNode.toCSS(this._context).replace(/\\n/g, '')} */\\n`);\n comment.debugInfo = atRuleNode.debugInfo;\n return this._visitor.visit(comment);\n }\n return;\n }\n this.charset = true;\n }\n\n return atRuleNode;\n },\n\n checkValidNodes: function(rules, isRoot) {\n if (!rules) {\n return;\n }\n\n for (let i = 0; i < rules.length; i++) {\n const ruleNode = rules[i];\n if (isRoot && ruleNode instanceof tree.Declaration && !ruleNode.variable) {\n throw { message: 'Properties must be inside selector blocks. They cannot be in the root',\n index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename};\n }\n if (ruleNode instanceof tree.Call) {\n throw { message: `Function '${ruleNode.name}' did not return a root node`,\n index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename};\n }\n if (ruleNode.type && !ruleNode.allowRoot) {\n throw { message: `${ruleNode.type} node returned by a function is not valid here`,\n index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename};\n }\n }\n },\n\n visitRuleset: function (rulesetNode, visitArgs) {\n // at this point rulesets are nested into each other\n let rule;\n\n const rulesets = [];\n\n this.checkValidNodes(rulesetNode.rules, rulesetNode.firstRoot);\n\n if (!rulesetNode.root) {\n // remove invisible paths\n this._compileRulesetPaths(rulesetNode);\n\n // remove rulesets from this ruleset body and compile them separately\n const nodeRules = rulesetNode.rules;\n\n let nodeRuleCnt = nodeRules ? nodeRules.length : 0;\n for (let i = 0; i < nodeRuleCnt; ) {\n rule = nodeRules[i];\n if (rule && rule.rules) {\n // visit because we are moving them out from being a child\n rulesets.push(this._visitor.visit(rule));\n nodeRules.splice(i, 1);\n nodeRuleCnt--;\n continue;\n }\n i++;\n }\n // accept the visitor to remove rules and refactor itself\n // then we can decide nogw whether we want it or not\n // compile body\n if (nodeRuleCnt > 0) {\n rulesetNode.accept(this._visitor);\n } else {\n rulesetNode.rules = null;\n }\n visitArgs.visitDeeper = false;\n } else { // if (! rulesetNode.root) {\n rulesetNode.accept(this._visitor);\n visitArgs.visitDeeper = false;\n }\n\n if (rulesetNode.rules) {\n this._mergeRules(rulesetNode.rules);\n this._removeDuplicateRules(rulesetNode.rules);\n }\n\n // now decide whether we keep the ruleset\n if (this.utils.isVisibleRuleset(rulesetNode)) {\n rulesetNode.ensureVisibility();\n rulesets.splice(0, 0, rulesetNode);\n }\n\n if (rulesets.length === 1) {\n return rulesets[0];\n }\n return rulesets;\n },\n\n _compileRulesetPaths: function(rulesetNode) {\n if (rulesetNode.paths) {\n rulesetNode.paths = rulesetNode.paths\n .filter(p => {\n let i;\n if (p[0].elements[0].combinator.value === ' ') {\n p[0].elements[0].combinator = new(tree.Combinator)('');\n }\n for (i = 0; i < p.length; i++) {\n if (p[i].isVisible() && p[i].getIsOutput()) {\n return true;\n }\n }\n return false;\n });\n }\n },\n\n _removeDuplicateRules: function(rules) {\n if (!rules) { return; }\n\n // remove duplicates\n const ruleCache = {};\n\n let ruleList;\n let rule;\n let i;\n\n for (i = rules.length - 1; i >= 0 ; i--) {\n rule = rules[i];\n if (rule instanceof tree.Declaration) {\n if (!ruleCache[rule.name]) {\n ruleCache[rule.name] = rule;\n } else {\n ruleList = ruleCache[rule.name];\n if (ruleList instanceof tree.Declaration) {\n ruleList = ruleCache[rule.name] = [ruleCache[rule.name].toCSS(this._context)];\n }\n const ruleCSS = rule.toCSS(this._context);\n if (ruleList.indexOf(ruleCSS) !== -1) {\n rules.splice(i, 1);\n } else {\n ruleList.push(ruleCSS);\n }\n }\n }\n }\n },\n\n _mergeRules: function(rules) {\n if (!rules) {\n return; \n }\n\n const groups = {};\n const groupsArr = [];\n\n for (let i = 0; i < rules.length; i++) {\n const rule = rules[i];\n if (rule.merge) {\n const key = rule.name;\n groups[key] ? rules.splice(i--, 1) : \n groupsArr.push(groups[key] = []);\n groups[key].push(rule);\n }\n }\n\n groupsArr.forEach(group => {\n if (group.length > 0) {\n const result = group[0];\n let space = [];\n const comma = [new tree.Expression(space)];\n group.forEach(rule => {\n if ((rule.merge === '+') && (space.length > 0)) {\n comma.push(new tree.Expression(space = []));\n }\n space.push(rule.value);\n result.important = result.important || rule.important;\n });\n result.value = new tree.Value(comma);\n }\n });\n }\n};\n\nexport default ToCSSVisitor;\n","import Visitor from './visitor';\nimport ImportVisitor from './import-visitor';\nimport MarkVisibleSelectorsVisitor from './set-tree-visibility-visitor';\nimport ExtendVisitor from './extend-visitor';\nimport JoinSelectorVisitor from './join-selector-visitor';\nimport ToCSSVisitor from './to-css-visitor';\n\nexport default {\n Visitor,\n ImportVisitor,\n MarkVisibleSelectorsVisitor,\n ExtendVisitor,\n JoinSelectorVisitor,\n ToCSSVisitor\n};\n","import chunker from './chunker';\n\nexport default () => {\n let // Less input string\n input;\n\n let // current chunk\n j;\n\n const // holds state for backtracking\n saveStack = [];\n\n let // furthest index the parser has gone to\n furthest;\n\n let // if this is furthest we got to, this is the probably cause\n furthestPossibleErrorMessage;\n\n let // chunkified input\n chunks;\n\n let // current chunk\n current;\n\n let // index of current chunk, in `input`\n currentPos;\n\n const parserInput = {};\n const CHARCODE_SPACE = 32;\n const CHARCODE_TAB = 9;\n const CHARCODE_LF = 10;\n const CHARCODE_CR = 13;\n const CHARCODE_PLUS = 43;\n const CHARCODE_COMMA = 44;\n const CHARCODE_FORWARD_SLASH = 47;\n const CHARCODE_9 = 57;\n\n function skipWhitespace(length) {\n const oldi = parserInput.i;\n const oldj = j;\n const curr = parserInput.i - currentPos;\n const endIndex = parserInput.i + current.length - curr;\n const mem = (parserInput.i += length);\n const inp = input;\n let c;\n let nextChar;\n let comment;\n\n for (; parserInput.i < endIndex; parserInput.i++) {\n c = inp.charCodeAt(parserInput.i);\n\n if (parserInput.autoCommentAbsorb && c === CHARCODE_FORWARD_SLASH) {\n nextChar = inp.charAt(parserInput.i + 1);\n if (nextChar === '/') {\n comment = {index: parserInput.i, isLineComment: true};\n let nextNewLine = inp.indexOf('\\n', parserInput.i + 2);\n if (nextNewLine < 0) {\n nextNewLine = endIndex;\n }\n parserInput.i = nextNewLine;\n comment.text = inp.substr(comment.index, parserInput.i - comment.index);\n parserInput.commentStore.push(comment);\n continue;\n } else if (nextChar === '*') {\n const nextStarSlash = inp.indexOf('*/', parserInput.i + 2);\n if (nextStarSlash >= 0) {\n comment = {\n index: parserInput.i,\n text: inp.substr(parserInput.i, nextStarSlash + 2 - parserInput.i),\n isLineComment: false\n };\n parserInput.i += comment.text.length - 1;\n parserInput.commentStore.push(comment);\n continue;\n }\n }\n break;\n }\n\n if ((c !== CHARCODE_SPACE) && (c !== CHARCODE_LF) && (c !== CHARCODE_TAB) && (c !== CHARCODE_CR)) {\n break;\n }\n }\n\n current = current.slice(length + parserInput.i - mem + curr);\n currentPos = parserInput.i;\n\n if (!current.length) {\n if (j < chunks.length - 1) {\n current = chunks[++j];\n skipWhitespace(0); // skip space at the beginning of a chunk\n return true; // things changed\n }\n parserInput.finished = true;\n }\n\n return oldi !== parserInput.i || oldj !== j;\n }\n\n parserInput.save = () => {\n currentPos = parserInput.i;\n saveStack.push( { current, i: parserInput.i, j });\n };\n parserInput.restore = possibleErrorMessage => {\n\n if (parserInput.i > furthest || (parserInput.i === furthest && possibleErrorMessage && !furthestPossibleErrorMessage)) {\n furthest = parserInput.i;\n furthestPossibleErrorMessage = possibleErrorMessage;\n }\n const state = saveStack.pop();\n current = state.current;\n currentPos = parserInput.i = state.i;\n j = state.j;\n };\n parserInput.forget = () => {\n saveStack.pop();\n };\n parserInput.isWhitespace = offset => {\n const pos = parserInput.i + (offset || 0);\n const code = input.charCodeAt(pos);\n return (code === CHARCODE_SPACE || code === CHARCODE_CR || code === CHARCODE_TAB || code === CHARCODE_LF);\n };\n\n // Specialization of $(tok)\n parserInput.$re = tok => {\n if (parserInput.i > currentPos) {\n current = current.slice(parserInput.i - currentPos);\n currentPos = parserInput.i;\n }\n\n const m = tok.exec(current);\n if (!m) {\n return null;\n }\n\n skipWhitespace(m[0].length);\n if (typeof m === 'string') {\n return m;\n }\n\n return m.length === 1 ? m[0] : m;\n };\n\n parserInput.$char = tok => {\n if (input.charAt(parserInput.i) !== tok) {\n return null;\n }\n skipWhitespace(1);\n return tok;\n };\n\n parserInput.$peekChar = tok => {\n if (input.charAt(parserInput.i) !== tok) {\n return null;\n }\n return tok;\n };\n\n parserInput.$str = tok => {\n const tokLength = tok.length;\n\n // https://jsperf.com/string-startswith/21\n for (let i = 0; i < tokLength; i++) {\n if (input.charAt(parserInput.i + i) !== tok.charAt(i)) {\n return null;\n }\n }\n\n skipWhitespace(tokLength);\n return tok;\n };\n\n parserInput.$quoted = loc => {\n const pos = loc || parserInput.i;\n const startChar = input.charAt(pos);\n\n if (startChar !== '\\'' && startChar !== '\"') {\n return;\n }\n const length = input.length;\n const currentPosition = pos;\n\n for (let i = 1; i + currentPosition < length; i++) {\n const nextChar = input.charAt(i + currentPosition);\n switch (nextChar) {\n case '\\\\':\n i++;\n continue;\n case '\\r':\n case '\\n':\n break;\n case startChar: {\n const str = input.substr(currentPosition, i + 1);\n if (!loc && loc !== 0) {\n skipWhitespace(i + 1);\n return str\n }\n return [startChar, str];\n }\n default:\n }\n }\n return null;\n };\n\n /**\n * Permissive parsing. Ignores everything except matching {} [] () and quotes\n * until matching token (outside of blocks)\n */\n parserInput.$parseUntil = tok => {\n let quote = '';\n let returnVal = null;\n let inComment = false;\n let blockDepth = 0;\n const blockStack = [];\n const parseGroups = [];\n const length = input.length;\n const startPos = parserInput.i;\n let lastPos = parserInput.i;\n let i = parserInput.i;\n let loop = true;\n let testChar;\n\n if (typeof tok === 'string') {\n testChar = char => char === tok\n } else {\n testChar = char => tok.test(char)\n }\n\n do {\n let nextChar = input.charAt(i);\n if (blockDepth === 0 && testChar(nextChar)) {\n returnVal = input.substr(lastPos, i - lastPos);\n if (returnVal) {\n parseGroups.push(returnVal);\n }\n else {\n parseGroups.push(' ');\n }\n returnVal = parseGroups;\n skipWhitespace(i - startPos);\n loop = false\n } else {\n if (inComment) {\n if (nextChar === '*' && \n input.charAt(i + 1) === '/') {\n i++;\n blockDepth--;\n inComment = false;\n }\n i++;\n continue;\n }\n switch (nextChar) {\n case '\\\\':\n i++;\n nextChar = input.charAt(i);\n parseGroups.push(input.substr(lastPos, i - lastPos + 1));\n lastPos = i + 1;\n break;\n case '/':\n if (input.charAt(i + 1) === '*') {\n i++;\n inComment = true;\n blockDepth++;\n }\n break;\n case '\\'':\n case '\"':\n quote = parserInput.$quoted(i);\n if (quote) {\n parseGroups.push(input.substr(lastPos, i - lastPos), quote);\n i += quote[1].length - 1;\n lastPos = i + 1;\n }\n else {\n skipWhitespace(i - startPos);\n returnVal = nextChar;\n loop = false;\n }\n break;\n case '{':\n blockStack.push('}');\n blockDepth++;\n break;\n case '(':\n blockStack.push(')');\n blockDepth++;\n break;\n case '[':\n blockStack.push(']');\n blockDepth++;\n break;\n case '}':\n case ')':\n case ']': {\n const expected = blockStack.pop();\n if (nextChar === expected) {\n blockDepth--;\n } else {\n // move the parser to the error and return expected\n skipWhitespace(i - startPos);\n returnVal = expected;\n loop = false;\n }\n }\n }\n i++;\n if (i > length) {\n loop = false;\n }\n }\n } while (loop);\n\n return returnVal ? returnVal : null;\n }\n\n parserInput.autoCommentAbsorb = true;\n parserInput.commentStore = [];\n parserInput.finished = false;\n\n // Same as $(), but don't change the state of the parser,\n // just return the match.\n parserInput.peek = tok => {\n if (typeof tok === 'string') {\n // https://jsperf.com/string-startswith/21\n for (let i = 0; i < tok.length; i++) {\n if (input.charAt(parserInput.i + i) !== tok.charAt(i)) {\n return false;\n }\n }\n return true;\n } else {\n return tok.test(current);\n }\n };\n\n // Specialization of peek()\n // TODO remove or change some currentChar calls to peekChar\n parserInput.peekChar = tok => input.charAt(parserInput.i) === tok;\n\n parserInput.currentChar = () => input.charAt(parserInput.i);\n\n parserInput.prevChar = () => input.charAt(parserInput.i - 1);\n\n parserInput.getInput = () => input;\n\n parserInput.peekNotNumeric = () => {\n const c = input.charCodeAt(parserInput.i);\n // Is the first char of the dimension 0-9, '.', '+' or '-'\n return (c > CHARCODE_9 || c < CHARCODE_PLUS) || c === CHARCODE_FORWARD_SLASH || c === CHARCODE_COMMA;\n };\n\n parserInput.start = (str, chunkInput, failFunction) => {\n input = str;\n parserInput.i = j = currentPos = furthest = 0;\n\n // chunking apparently makes things quicker (but my tests indicate\n // it might actually make things slower in node at least)\n // and it is a non-perfect parse - it can't recognise\n // unquoted urls, meaning it can't distinguish comments\n // meaning comments with quotes or {}() in them get 'counted'\n // and then lead to parse errors.\n // In addition if the chunking chunks in the wrong place we might\n // not be able to parse a parser statement in one go\n // this is officially deprecated but can be switched on via an option\n // in the case it causes too much performance issues.\n if (chunkInput) {\n chunks = chunker(str, failFunction);\n } else {\n chunks = [str];\n }\n\n current = chunks[0];\n\n skipWhitespace(0);\n };\n\n parserInput.end = () => {\n let message;\n const isFinished = parserInput.i >= input.length;\n\n if (parserInput.i < furthest) {\n message = furthestPossibleErrorMessage;\n parserInput.i = furthest;\n }\n return {\n isFinished,\n furthest: parserInput.i,\n furthestPossibleErrorMessage: message,\n furthestReachedEnd: parserInput.i >= input.length - 1,\n furthestChar: input[parserInput.i]\n };\n };\n\n return parserInput;\n};\n","// Split the input into chunks.\nexport default function (input, fail) {\n const len = input.length;\n let level = 0;\n let parenLevel = 0;\n let lastOpening;\n let lastOpeningParen;\n let lastMultiComment;\n let lastMultiCommentEndBrace;\n const chunks = [];\n let emitFrom = 0;\n let chunkerCurrentIndex;\n let currentChunkStartIndex;\n let cc;\n let cc2;\n let matched;\n\n function emitChunk(force) {\n const len = chunkerCurrentIndex - emitFrom;\n if (((len < 512) && !force) || !len) {\n return;\n }\n chunks.push(input.slice(emitFrom, chunkerCurrentIndex + 1));\n emitFrom = chunkerCurrentIndex + 1;\n }\n\n for (chunkerCurrentIndex = 0; chunkerCurrentIndex < len; chunkerCurrentIndex++) {\n cc = input.charCodeAt(chunkerCurrentIndex);\n if (((cc >= 97) && (cc <= 122)) || (cc < 34)) {\n // a-z or whitespace\n continue;\n }\n\n switch (cc) {\n case 40: // (\n parenLevel++;\n lastOpeningParen = chunkerCurrentIndex;\n continue;\n case 41: // )\n if (--parenLevel < 0) {\n return fail('missing opening `(`', chunkerCurrentIndex);\n }\n continue;\n case 59: // ;\n if (!parenLevel) { emitChunk(); }\n continue;\n case 123: // {\n level++;\n lastOpening = chunkerCurrentIndex;\n continue;\n case 125: // }\n if (--level < 0) {\n return fail('missing opening `{`', chunkerCurrentIndex);\n }\n if (!level && !parenLevel) { emitChunk(); }\n continue;\n case 92: // \\\n if (chunkerCurrentIndex < len - 1) { chunkerCurrentIndex++; continue; }\n return fail('unescaped `\\\\`', chunkerCurrentIndex);\n case 34:\n case 39:\n case 96: // \", ' and `\n matched = 0;\n currentChunkStartIndex = chunkerCurrentIndex;\n for (chunkerCurrentIndex = chunkerCurrentIndex + 1; chunkerCurrentIndex < len; chunkerCurrentIndex++) {\n cc2 = input.charCodeAt(chunkerCurrentIndex);\n if (cc2 > 96) { continue; }\n if (cc2 == cc) { matched = 1; break; }\n if (cc2 == 92) { // \\\n if (chunkerCurrentIndex == len - 1) {\n return fail('unescaped `\\\\`', chunkerCurrentIndex);\n }\n chunkerCurrentIndex++;\n }\n }\n if (matched) { continue; }\n return fail(`unmatched \\`${String.fromCharCode(cc)}\\``, currentChunkStartIndex);\n case 47: // /, check for comment\n if (parenLevel || (chunkerCurrentIndex == len - 1)) { continue; }\n cc2 = input.charCodeAt(chunkerCurrentIndex + 1);\n if (cc2 == 47) {\n // //, find lnfeed\n for (chunkerCurrentIndex = chunkerCurrentIndex + 2; chunkerCurrentIndex < len; chunkerCurrentIndex++) {\n cc2 = input.charCodeAt(chunkerCurrentIndex);\n if ((cc2 <= 13) && ((cc2 == 10) || (cc2 == 13))) { break; }\n }\n } else if (cc2 == 42) {\n // /*, find */\n lastMultiComment = currentChunkStartIndex = chunkerCurrentIndex;\n for (chunkerCurrentIndex = chunkerCurrentIndex + 2; chunkerCurrentIndex < len - 1; chunkerCurrentIndex++) {\n cc2 = input.charCodeAt(chunkerCurrentIndex);\n if (cc2 == 125) { lastMultiCommentEndBrace = chunkerCurrentIndex; }\n if (cc2 != 42) { continue; }\n if (input.charCodeAt(chunkerCurrentIndex + 1) == 47) { break; }\n }\n if (chunkerCurrentIndex == len - 1) {\n return fail('missing closing `*/`', currentChunkStartIndex);\n }\n chunkerCurrentIndex++;\n }\n continue;\n case 42: // *, check for unmatched */\n if ((chunkerCurrentIndex < len - 1) && (input.charCodeAt(chunkerCurrentIndex + 1) == 47)) {\n return fail('unmatched `/*`', chunkerCurrentIndex);\n }\n continue;\n }\n }\n\n if (level !== 0) {\n if ((lastMultiComment > lastOpening) && (lastMultiCommentEndBrace > lastMultiComment)) {\n return fail('missing closing `}` or `*/`', lastOpening);\n } else {\n return fail('missing closing `}`', lastOpening);\n }\n } else if (parenLevel !== 0) {\n return fail('missing closing `)`', lastOpeningParen);\n }\n\n emitChunk(true);\n return chunks;\n}\n","function makeRegistry( base ) {\n return {\n _data: {},\n add: function(name, func) {\n // precautionary case conversion, as later querying of\n // the registry by function-caller uses lower case as well.\n name = name.toLowerCase();\n\n // eslint-disable-next-line no-prototype-builtins\n if (this._data.hasOwnProperty(name)) {\n // TODO warn\n }\n this._data[name] = func;\n },\n addMultiple: function(functions) {\n Object.keys(functions).forEach(\n name => {\n this.add(name, functions[name]);\n });\n },\n get: function(name) {\n return this._data[name] || ( base && base.get( name ));\n },\n getLocalFunctions: function() {\n return this._data;\n },\n inherit: function() {\n return makeRegistry( this );\n },\n create: function(base) {\n return makeRegistry(base);\n }\n };\n}\n\nexport default makeRegistry( null );","export const MediaSyntaxOptions = {\n queryInParens: true\n};\n\nexport const ContainerSyntaxOptions = {\n queryInParens: true\n};\n","import Node from './node';\n\nconst Anonymous = function(value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) {\n this.value = value;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.mapLines = mapLines;\n this.rulesetLike = (typeof rulesetLike === 'undefined') ? false : rulesetLike;\n this.allowRoot = true;\n this.copyVisibilityInfo(visibilityInfo);\n}\n\nAnonymous.prototype = Object.assign(new Node(), {\n type: 'Anonymous',\n eval() {\n return new Anonymous(this.value, this._index, this._fileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo());\n },\n compare(other) {\n return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;\n },\n isRulesetLike() {\n return this.rulesetLike;\n },\n genCSS(context, output) {\n this.nodeVisible = Boolean(this.value);\n if (this.nodeVisible) {\n output.add(this.value, this._fileInfo, this._index, this.mapLines);\n }\n }\n})\n\nexport default Anonymous;\n","import LessError from '../less-error';\nimport tree from '../tree';\nimport visitors from '../visitors';\nimport getParserInput from './parser-input';\nimport * as utils from '../utils';\nimport functionRegistry from '../functions/function-registry';\nimport { ContainerSyntaxOptions, MediaSyntaxOptions } from '../tree/atrule-syntax';\nimport logger from '../logger';\nimport Selector from '../tree/selector';\nimport Anonymous from '../tree/anonymous';\n\n//\n// less.js - parser\n//\n// A relatively straight-forward predictive parser.\n// There is no tokenization/lexing stage, the input is parsed\n// in one sweep.\n//\n// To make the parser fast enough to run in the browser, several\n// optimization had to be made:\n//\n// - Matching and slicing on a huge input is often cause of slowdowns.\n// The solution is to chunkify the input into smaller strings.\n// The chunks are stored in the `chunks` var,\n// `j` holds the current chunk index, and `currentPos` holds\n// the index of the current chunk in relation to `input`.\n// This gives us an almost 4x speed-up.\n//\n// - In many cases, we don't need to match individual tokens;\n// for example, if a value doesn't hold any variables, operations\n// or dynamic references, the parser can effectively 'skip' it,\n// treating it as a literal.\n// An example would be '1px solid #000' - which evaluates to itself,\n// we don't need to know what the individual components are.\n// The drawback, of course is that you don't get the benefits of\n// syntax-checking on the CSS. This gives us a 50% speed-up in the parser,\n// and a smaller speed-up in the code-gen.\n//\n//\n// Token matching is done with the `$` function, which either takes\n// a terminal string or regexp, or a non-terminal function to call.\n// It also takes care of moving all the indices forwards.\n//\n\nconst Parser = function Parser(context, imports, fileInfo, currentIndex) {\n currentIndex = currentIndex || 0;\n let parsers;\n const parserInput = getParserInput();\n\n function error(msg, type) {\n throw new LessError(\n {\n index: parserInput.i,\n filename: fileInfo.filename,\n type: type || 'Syntax',\n message: msg\n },\n imports\n );\n }\n\n /**\n * \n * @param {string} msg \n * @param {number} index \n * @param {string} type \n */\n function warn(msg, index, type) {\n if (!context.quiet) {\n logger.warn(\n (new LessError(\n {\n index: index ?? parserInput.i,\n filename: fileInfo.filename,\n type: type ? `${type.toUpperCase()} WARNING` : 'WARNING',\n message: msg\n },\n imports\n )).toString()\n );\n }\n }\n\n function expect(arg, msg) {\n // some older browsers return typeof 'function' for RegExp\n const result = (arg instanceof Function) ? arg.call(parsers) : parserInput.$re(arg);\n if (result) {\n return result;\n }\n\n error(msg || (typeof arg === 'string'\n ? `expected '${arg}' got '${parserInput.currentChar()}'`\n : 'unexpected token'));\n }\n\n // Specialization of expect()\n function expectChar(arg, msg) {\n if (parserInput.$char(arg)) {\n return arg;\n }\n error(msg || `expected '${arg}' got '${parserInput.currentChar()}'`);\n }\n\n function getDebugInfo(index) {\n const filename = fileInfo.filename;\n\n return {\n lineNumber: utils.getLocation(index, parserInput.getInput()).line + 1,\n fileName: filename\n };\n }\n\n /**\n * Used after initial parsing to create nodes on the fly\n *\n * @param {String} str - string to parse\n * @param {Array} parseList - array of parsers to run input through e.g. [\"value\", \"important\"]\n * @param {Number} currentIndex - start number to begin indexing\n * @param {Object} fileInfo - fileInfo to attach to created nodes\n */\n function parseNode(str, parseList, callback) {\n let result;\n const returnNodes = [];\n const parser = parserInput;\n\n try {\n parser.start(str, false, function fail(msg, index) {\n callback({\n message: msg,\n index: index + currentIndex\n });\n });\n for (let x = 0, p; (p = parseList[x]); x++) {\n result = parsers[p]();\n returnNodes.push(result || null);\n }\n\n const endInfo = parser.end();\n if (endInfo.isFinished) {\n callback(null, returnNodes);\n }\n else {\n callback(true, null);\n }\n } catch (e) {\n throw new LessError({\n index: e.index + currentIndex,\n message: e.message\n }, imports, fileInfo.filename);\n }\n }\n\n //\n // The Parser\n //\n return {\n parserInput,\n imports,\n fileInfo,\n parseNode,\n //\n // Parse an input string into an abstract syntax tree,\n // @param str A string containing 'less' markup\n // @param callback call `callback` when done.\n // @param [additionalData] An optional map which can contains vars - a map (key, value) of variables to apply\n //\n parse: function (str, callback, additionalData) {\n let root;\n let err = null;\n let globalVars;\n let modifyVars;\n let ignored;\n let preText = '';\n\n // Optionally disable @plugin parsing\n if (additionalData && additionalData.disablePluginRule) {\n parsers.plugin = function() {\n var dir = parserInput.$re(/^@plugin?\\s+/);\n if (dir) {\n error('@plugin statements are not allowed when disablePluginRule is set to true');\n }\n }\n }\n\n globalVars = (additionalData && additionalData.globalVars) ? `${Parser.serializeVars(additionalData.globalVars)}\\n` : '';\n modifyVars = (additionalData && additionalData.modifyVars) ? `\\n${Parser.serializeVars(additionalData.modifyVars)}` : '';\n\n if (context.pluginManager) {\n const preProcessors = context.pluginManager.getPreProcessors();\n for (let i = 0; i < preProcessors.length; i++) {\n str = preProcessors[i].process(str, { context, imports, fileInfo });\n }\n }\n\n if (globalVars || (additionalData && additionalData.banner)) {\n preText = ((additionalData && additionalData.banner) ? additionalData.banner : '') + globalVars;\n ignored = imports.contentsIgnoredChars;\n ignored[fileInfo.filename] = ignored[fileInfo.filename] || 0;\n ignored[fileInfo.filename] += preText.length;\n }\n\n str = str.replace(/\\r\\n?/g, '\\n');\n // Remove potential UTF Byte Order Mark\n str = preText + str.replace(/^\\uFEFF/, '') + modifyVars;\n imports.contents[fileInfo.filename] = str;\n\n // Start with the primary rule.\n // The whole syntax tree is held under a Ruleset node,\n // with the `root` property set to true, so no `{}` are\n // output. The callback is called when the input is parsed.\n try {\n parserInput.start(str, context.chunkInput, function fail(msg, index) {\n throw new LessError({\n index,\n type: 'Parse',\n message: msg,\n filename: fileInfo.filename\n }, imports);\n });\n\n tree.Node.prototype.parse = this;\n root = new tree.Ruleset(null, this.parsers.primary());\n tree.Node.prototype.rootNode = root;\n root.root = true;\n root.firstRoot = true;\n root.functionRegistry = functionRegistry.inherit();\n\n } catch (e) {\n return callback(new LessError(e, imports, fileInfo.filename));\n }\n\n // If `i` is smaller than the `input.length - 1`,\n // it means the parser wasn't able to parse the whole\n // string, so we've got a parsing error.\n //\n // We try to extract a \\n delimited string,\n // showing the line where the parse error occurred.\n // We split it up into two parts (the part which parsed,\n // and the part which didn't), so we can color them differently.\n const endInfo = parserInput.end();\n if (!endInfo.isFinished) {\n\n let message = endInfo.furthestPossibleErrorMessage;\n\n if (!message) {\n message = 'Unrecognised input';\n if (endInfo.furthestChar === '}') {\n message += '. Possibly missing opening \\'{\\'';\n } else if (endInfo.furthestChar === ')') {\n message += '. Possibly missing opening \\'(\\'';\n } else if (endInfo.furthestReachedEnd) {\n message += '. Possibly missing something';\n }\n }\n\n err = new LessError({\n type: 'Parse',\n message,\n index: endInfo.furthest,\n filename: fileInfo.filename\n }, imports);\n }\n\n const finish = e => {\n e = err || e || imports.error;\n\n if (e) {\n if (!(e instanceof LessError)) {\n e = new LessError(e, imports, fileInfo.filename);\n }\n\n return callback(e);\n }\n else {\n return callback(null, root);\n }\n };\n\n if (context.processImports !== false) {\n new visitors.ImportVisitor(imports, finish)\n .run(root);\n } else {\n return finish();\n }\n },\n\n //\n // Here in, the parsing rules/functions\n //\n // The basic structure of the syntax tree generated is as follows:\n //\n // Ruleset -> Declaration -> Value -> Expression -> Entity\n //\n // Here's some Less code:\n //\n // .class {\n // color: #fff;\n // border: 1px solid #000;\n // width: @w + 4px;\n // > .child {...}\n // }\n //\n // And here's what the parse tree might look like:\n //\n // Ruleset (Selector '.class', [\n // Declaration (\"color\", Value ([Expression [Color #fff]]))\n // Declaration (\"border\", Value ([Expression [Dimension 1px][Keyword \"solid\"][Color #000]]))\n // Declaration (\"width\", Value ([Expression [Operation \" + \" [Variable \"@w\"][Dimension 4px]]]))\n // Ruleset (Selector [Element '>', '.child'], [...])\n // ])\n //\n // In general, most rules will try to parse a token with the `$re()` function, and if the return\n // value is truly, will return a new node, of the relevant type. Sometimes, we need to check\n // first, before parsing, that's when we use `peek()`.\n //\n parsers: parsers = {\n //\n // The `primary` rule is the *entry* and *exit* point of the parser.\n // The rules here can appear at any level of the parse tree.\n //\n // The recursive nature of the grammar is an interplay between the `block`\n // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule,\n // as represented by this simplified grammar:\n //\n // primary → (ruleset | declaration)+\n // ruleset → selector+ block\n // block → '{' primary '}'\n //\n // Only at one point is the primary rule not called from the\n // block rule: at the root level.\n //\n primary: function () {\n const mixin = this.mixin;\n let root = [];\n let node;\n\n while (true) {\n while (true) {\n node = this.comment();\n if (!node) { break; }\n root.push(node);\n }\n // always process comments before deciding if finished\n if (parserInput.finished) {\n break;\n }\n if (parserInput.peek('}')) {\n break;\n }\n\n node = this.extendRule();\n if (node) {\n root = root.concat(node);\n continue;\n }\n\n node = mixin.definition() || this.declaration() || mixin.call(false, false) ||\n this.ruleset() || this.variableCall() || this.entities.call() || this.atrule();\n if (node) {\n root.push(node);\n } else {\n let foundSemiColon = false;\n while (parserInput.$char(';')) {\n foundSemiColon = true;\n }\n if (!foundSemiColon) {\n break;\n }\n }\n }\n\n return root;\n },\n\n // comments are collected by the main parsing mechanism and then assigned to nodes\n // where the current structure allows it\n comment: function () {\n if (parserInput.commentStore.length) {\n const comment = parserInput.commentStore.shift();\n return new(tree.Comment)(comment.text, comment.isLineComment, comment.index + currentIndex, fileInfo);\n }\n },\n\n //\n // Entities are tokens which can be found inside an Expression\n //\n entities: {\n mixinLookup: function() {\n return parsers.mixin.call(true, true);\n },\n //\n // A string, which supports escaping \" and '\n //\n // \"milky way\" 'he\\'s the one!'\n //\n quoted: function (forceEscaped) {\n let str;\n const index = parserInput.i;\n let isEscaped = false;\n\n parserInput.save();\n if (parserInput.$char('~')) {\n isEscaped = true;\n } else if (forceEscaped) {\n parserInput.restore();\n return;\n }\n\n str = parserInput.$quoted();\n if (!str) {\n parserInput.restore();\n return;\n }\n parserInput.forget();\n\n return new(tree.Quoted)(str.charAt(0), str.substr(1, str.length - 2), isEscaped, index + currentIndex, fileInfo);\n },\n\n //\n // A catch-all word, such as:\n //\n // black border-collapse\n //\n keyword: function () {\n const k = parserInput.$char('%') || parserInput.$re(/^\\[?(?:[\\w-]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+\\]?/);\n if (k) {\n return tree.Color.fromKeyword(k) || new(tree.Keyword)(k);\n }\n },\n\n //\n // A function call\n //\n // rgb(255, 0, 255)\n //\n // The arguments are parsed with the `entities.arguments` parser.\n //\n call: function () {\n let name;\n let args;\n let func;\n const index = parserInput.i;\n\n // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18\n if (parserInput.peek(/^url\\(/i)) {\n return;\n }\n\n parserInput.save();\n\n name = parserInput.$re(/^([\\w-]+|%|~|progid:[\\w.]+)\\(/);\n if (!name) {\n parserInput.forget();\n return;\n }\n\n name = name[1];\n func = this.customFuncCall(name);\n if (func) {\n args = func.parse();\n if (args && func.stop) {\n parserInput.forget();\n return args;\n }\n }\n\n args = this.arguments(args);\n\n if (!parserInput.$char(')')) {\n parserInput.restore('Could not parse call arguments or missing \\')\\'');\n return;\n }\n\n parserInput.forget();\n\n return new(tree.Call)(name, args, index + currentIndex, fileInfo);\n },\n\n declarationCall: function () {\n let validCall;\n let args;\n const index = parserInput.i;\n\n parserInput.save();\n\n validCall = parserInput.$re(/^[\\w]+\\(/);\n if (!validCall) {\n parserInput.forget();\n return;\n }\n\n validCall = validCall.substring(0, validCall.length - 1);\n\n let rule = this.ruleProperty();\n let value;\n \n if (rule) {\n value = this.value();\n }\n \n if (rule && value) {\n args = [new (tree.Declaration)(rule, value, null, null, parserInput.i + currentIndex, fileInfo, true)];\n }\n\n if (!parserInput.$char(')')) {\n parserInput.restore('Could not parse call arguments or missing \\')\\'');\n return;\n }\n\n parserInput.forget();\n\n return new(tree.Call)(validCall, args, index + currentIndex, fileInfo);\n },\n\n //\n // Parsing rules for functions with non-standard args, e.g.:\n //\n // boolean(not(2 > 1))\n //\n // This is a quick prototype, to be modified/improved when\n // more custom-parsed funcs come (e.g. `selector(...)`)\n //\n\n customFuncCall: function (name) {\n /* Ideally the table is to be moved out of here for faster perf.,\n but it's quite tricky since it relies on all these `parsers`\n and `expect` available only here */\n return {\n alpha: f(parsers.ieAlpha, true),\n boolean: f(condition),\n 'if': f(condition)\n }[name.toLowerCase()];\n\n function f(parse, stop) {\n return {\n parse, // parsing function\n stop // when true - stop after parse() and return its result,\n // otherwise continue for plain args\n };\n }\n\n function condition() {\n return [expect(parsers.condition, 'expected condition')];\n }\n },\n\n arguments: function (prevArgs) {\n let argsComma = prevArgs || [];\n const argsSemiColon = [];\n let isSemiColonSeparated;\n let value;\n\n parserInput.save();\n\n while (true) {\n if (prevArgs) {\n prevArgs = false;\n } else {\n value = parsers.detachedRuleset() || this.assignment() || parsers.expression();\n if (!value) {\n break;\n }\n\n if (value.value && value.value.length == 1) {\n value = value.value[0];\n }\n\n argsComma.push(value);\n }\n\n if (parserInput.$char(',')) {\n continue;\n }\n\n if (parserInput.$char(';') || isSemiColonSeparated) {\n isSemiColonSeparated = true;\n value = (argsComma.length < 1) ? argsComma[0]\n : new tree.Value(argsComma);\n argsSemiColon.push(value);\n argsComma = [];\n }\n }\n\n parserInput.forget();\n return isSemiColonSeparated ? argsSemiColon : argsComma;\n },\n literal: function () {\n return this.dimension() ||\n this.color() ||\n this.quoted() ||\n this.unicodeDescriptor();\n },\n\n // Assignments are argument entities for calls.\n // They are present in ie filter properties as shown below.\n //\n // filter: progid:DXImageTransform.Microsoft.Alpha( *opacity=50* )\n //\n\n assignment: function () {\n let key;\n let value;\n parserInput.save();\n key = parserInput.$re(/^\\w+(?=\\s?=)/i);\n if (!key) {\n parserInput.restore();\n return;\n }\n if (!parserInput.$char('=')) {\n parserInput.restore();\n return;\n }\n value = parsers.entity();\n if (value) {\n parserInput.forget();\n return new(tree.Assignment)(key, value);\n } else {\n parserInput.restore();\n }\n },\n\n //\n // Parse url() tokens\n //\n // We use a specific rule for urls, because they don't really behave like\n // standard function calls. The difference is that the argument doesn't have\n // to be enclosed within a string, so it can't be parsed as an Expression.\n //\n url: function () {\n let value;\n const index = parserInput.i;\n\n parserInput.autoCommentAbsorb = false;\n\n if (!parserInput.$str('url(')) {\n parserInput.autoCommentAbsorb = true;\n return;\n }\n\n value = this.quoted() || this.variable() || this.property() ||\n parserInput.$re(/^(?:(?:\\\\[()'\"])|[^()'\"])+/) || '';\n\n parserInput.autoCommentAbsorb = true;\n\n expectChar(')');\n\n return new(tree.URL)((value.value !== undefined ||\n value instanceof tree.Variable ||\n value instanceof tree.Property) ?\n value : new(tree.Anonymous)(value, index), index + currentIndex, fileInfo);\n },\n\n //\n // A Variable entity, such as `@fink`, in\n //\n // width: @fink + 2px\n //\n // We use a different parser for variable definitions,\n // see `parsers.variable`.\n //\n variable: function () {\n let ch;\n let name;\n const index = parserInput.i;\n\n parserInput.save();\n if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^@@?[\\w-]+/))) {\n ch = parserInput.currentChar();\n if (ch === '(' || ch === '[' && !parserInput.prevChar().match(/^\\s/)) {\n // this may be a VariableCall lookup\n const result = parsers.variableCall(name);\n if (result) {\n parserInput.forget();\n return result;\n }\n }\n parserInput.forget();\n return new(tree.Variable)(name, index + currentIndex, fileInfo);\n }\n parserInput.restore();\n },\n\n // A variable entity using the protective {} e.g. @{var}\n variableCurly: function () {\n let curly;\n const index = parserInput.i;\n\n if (parserInput.currentChar() === '@' && (curly = parserInput.$re(/^@\\{([\\w-]+)\\}/))) {\n return new(tree.Variable)(`@${curly[1]}`, index + currentIndex, fileInfo);\n }\n },\n //\n // A Property accessor, such as `$color`, in\n //\n // background-color: $color\n //\n property: function () {\n let name;\n const index = parserInput.i;\n\n if (parserInput.currentChar() === '$' && (name = parserInput.$re(/^\\$[\\w-]+/))) {\n return new(tree.Property)(name, index + currentIndex, fileInfo);\n }\n },\n\n // A property entity useing the protective {} e.g. ${prop}\n propertyCurly: function () {\n let curly;\n const index = parserInput.i;\n\n if (parserInput.currentChar() === '$' && (curly = parserInput.$re(/^\\$\\{([\\w-]+)\\}/))) {\n return new(tree.Property)(`$${curly[1]}`, index + currentIndex, fileInfo);\n }\n },\n //\n // A Hexadecimal color\n //\n // #4F3C2F\n //\n // `rgb` and `hsl` colors are parsed through the `entities.call` parser.\n //\n color: function () {\n let rgb;\n parserInput.save();\n\n if (parserInput.currentChar() === '#' && (rgb = parserInput.$re(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})([\\w.#[])?/))) {\n if (!rgb[2]) {\n parserInput.forget();\n return new(tree.Color)(rgb[1], undefined, rgb[0]);\n }\n }\n parserInput.restore();\n },\n\n colorKeyword: function () {\n parserInput.save();\n const autoCommentAbsorb = parserInput.autoCommentAbsorb;\n parserInput.autoCommentAbsorb = false;\n const k = parserInput.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);\n parserInput.autoCommentAbsorb = autoCommentAbsorb;\n if (!k) {\n parserInput.forget();\n return;\n }\n parserInput.restore();\n const color = tree.Color.fromKeyword(k);\n if (color) {\n parserInput.$str(k);\n return color;\n }\n },\n\n //\n // A Dimension, that is, a number and a unit\n //\n // 0.5em 95%\n //\n dimension: function () {\n if (parserInput.peekNotNumeric()) {\n return;\n }\n\n const value = parserInput.$re(/^([+-]?\\d*\\.?\\d+)(%|[a-z_]+)?/i);\n if (value) {\n return new(tree.Dimension)(value[1], value[2]);\n }\n },\n\n //\n // A unicode descriptor, as is used in unicode-range\n //\n // U+0?? or U+00A1-00A9\n //\n unicodeDescriptor: function () {\n let ud;\n\n ud = parserInput.$re(/^U\\+[0-9a-fA-F?]+(-[0-9a-fA-F?]+)?/);\n if (ud) {\n return new(tree.UnicodeDescriptor)(ud[0]);\n }\n },\n\n //\n // JavaScript code to be evaluated\n //\n // `window.location.href`\n //\n javascript: function () {\n let js;\n const index = parserInput.i;\n\n parserInput.save();\n\n const escape = parserInput.$char('~');\n const jsQuote = parserInput.$char('`');\n\n if (!jsQuote) {\n parserInput.restore();\n return;\n }\n\n js = parserInput.$re(/^[^`]*`/);\n if (js) {\n parserInput.forget();\n return new(tree.JavaScript)(js.substr(0, js.length - 1), Boolean(escape), index + currentIndex, fileInfo);\n }\n parserInput.restore('invalid javascript definition');\n }\n },\n\n //\n // The variable part of a variable definition. Used in the `rule` parser\n //\n // @fink:\n //\n variable: function () {\n let name;\n\n if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^(@[\\w-]+)\\s*:/))) { return name[1]; }\n },\n\n //\n // Call a variable value to retrieve a detached ruleset\n // or a value from a detached ruleset's rules.\n //\n // @fink();\n // @fink;\n // color: @fink[@color];\n //\n variableCall: function (parsedName) {\n let lookups;\n const i = parserInput.i;\n const inValue = !!parsedName;\n let name = parsedName;\n\n parserInput.save();\n\n if (name || (parserInput.currentChar() === '@'\n && (name = parserInput.$re(/^(@[\\w-]+)(\\(\\s*\\))?/)))) {\n\n lookups = this.mixin.ruleLookups();\n\n if (!lookups && ((inValue && parserInput.$str('()') !== '()') || (name[2] !== '()'))) {\n parserInput.restore('Missing \\'[...]\\' lookup in variable call');\n return;\n }\n\n if (!inValue) {\n name = name[1];\n }\n\n const call = new tree.VariableCall(name, i, fileInfo);\n if (!inValue && parsers.end()) {\n parserInput.forget();\n return call;\n }\n else {\n parserInput.forget();\n return new tree.NamespaceValue(call, lookups, i, fileInfo);\n }\n }\n\n parserInput.restore();\n },\n\n //\n // extend syntax - used to extend selectors\n //\n extend: function(isRule) {\n let elements;\n let e;\n const index = parserInput.i;\n let option;\n let extendList;\n let extend;\n\n if (!parserInput.$str(isRule ? '&:extend(' : ':extend(')) {\n return;\n }\n\n do {\n option = null;\n elements = null;\n let first = true;\n while (!(option = parserInput.$re(/^(!?all)(?=\\s*(\\)|,))/))) {\n e = this.element();\n\n if (!e) {\n break;\n }\n /**\n * @note - This will not catch selectors in pseudos like :is() and :where() because\n * they don't currently parse their contents as selectors.\n */\n if (!first && e.combinator.value) {\n warn('Targeting complex selectors can have unexpected behavior, and this behavior may change in the future.', index)\n }\n\n first = false;\n if (elements) {\n elements.push(e);\n } else {\n elements = [ e ];\n }\n }\n\n option = option && option[1];\n if (!elements) {\n error('Missing target selector for :extend().');\n }\n extend = new(tree.Extend)(new(tree.Selector)(elements), option, index + currentIndex, fileInfo);\n if (extendList) {\n extendList.push(extend);\n } else {\n extendList = [ extend ];\n }\n } while (parserInput.$char(','));\n\n expect(/^\\)/);\n\n if (isRule) {\n expect(/^;/);\n }\n\n return extendList;\n },\n\n //\n // extendRule - used in a rule to extend all the parent selectors\n //\n extendRule: function() {\n return this.extend(true);\n },\n\n //\n // Mixins\n //\n mixin: {\n //\n // A Mixin call, with an optional argument list\n //\n // #mixins > .square(#fff);\n // #mixins.square(#fff);\n // .rounded(4px, black);\n // .button;\n //\n // We can lookup / return a value using the lookup syntax:\n //\n // color: #mixin.square(#fff)[@color];\n //\n // The `while` loop is there because mixins can be\n // namespaced, but we only support the child and descendant\n // selector for now.\n //\n call: function (inValue, getLookup) {\n const s = parserInput.currentChar();\n let important = false;\n let lookups;\n const index = parserInput.i;\n let elements;\n let args;\n let hasParens;\n let parensIndex;\n let parensWS = false;\n\n if (s !== '.' && s !== '#') { return; }\n\n parserInput.save(); // stop us absorbing part of an invalid selector\n\n elements = this.elements();\n\n if (elements) {\n parensIndex = parserInput.i;\n if (parserInput.$char('(')) {\n parensWS = parserInput.isWhitespace(-2);\n args = this.args(true).args;\n expectChar(')');\n hasParens = true;\n if (parensWS) {\n warn('Whitespace between a mixin name and parentheses for a mixin call is deprecated', parensIndex, 'DEPRECATED');\n }\n }\n\n if (getLookup !== false) {\n lookups = this.ruleLookups();\n }\n if (getLookup === true && !lookups) {\n parserInput.restore();\n return;\n }\n\n if (inValue && !lookups && !hasParens) {\n // This isn't a valid in-value mixin call\n parserInput.restore();\n return;\n }\n\n if (!inValue && parsers.important()) {\n important = true;\n }\n\n if (inValue || parsers.end()) {\n parserInput.forget();\n const mixin = new(tree.mixin.Call)(elements, args, index + currentIndex, fileInfo, !lookups && important);\n if (lookups) {\n return new tree.NamespaceValue(mixin, lookups);\n }\n else {\n if (!hasParens) {\n warn('Calling a mixin without parentheses is deprecated', parensIndex, 'DEPRECATED');\n }\n return mixin;\n }\n }\n }\n\n parserInput.restore();\n },\n /**\n * Matching elements for mixins\n * (Start with . or # and can have > )\n */\n elements: function() {\n let elements;\n let e;\n let c;\n let elem;\n let elemIndex;\n const re = /^[#.](?:[\\w-]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/;\n while (true) {\n elemIndex = parserInput.i;\n e = parserInput.$re(re);\n\n if (!e) {\n break;\n }\n elem = new(tree.Element)(c, e, false, elemIndex + currentIndex, fileInfo);\n if (elements) {\n elements.push(elem);\n } else {\n elements = [ elem ];\n }\n c = parserInput.$char('>');\n }\n return elements;\n },\n args: function (isCall) {\n const entities = parsers.entities;\n const returner = { args:null, variadic: false };\n let expressions = [];\n const argsSemiColon = [];\n const argsComma = [];\n let isSemiColonSeparated;\n let expressionContainsNamed;\n let name;\n let nameLoop;\n let value;\n let arg;\n let expand;\n let hasSep = true;\n\n parserInput.save();\n\n while (true) {\n if (isCall) {\n arg = parsers.detachedRuleset() || parsers.expression();\n } else {\n parserInput.commentStore.length = 0;\n if (parserInput.$str('...')) {\n returner.variadic = true;\n if (parserInput.$char(';') && !isSemiColonSeparated) {\n isSemiColonSeparated = true;\n }\n (isSemiColonSeparated ? argsSemiColon : argsComma)\n .push({ variadic: true });\n break;\n }\n arg = entities.variable() || entities.property() || entities.literal() || entities.keyword() || this.call(true);\n }\n\n if (!arg || !hasSep) {\n break;\n }\n\n nameLoop = null;\n if (arg.throwAwayComments) {\n arg.throwAwayComments();\n }\n value = arg;\n let val = null;\n\n if (isCall) {\n // Variable\n if (arg.value && arg.value.length == 1) {\n val = arg.value[0];\n }\n } else {\n val = arg;\n }\n\n if (val && (val instanceof tree.Variable || val instanceof tree.Property)) {\n if (parserInput.$char(':')) {\n if (expressions.length > 0) {\n if (isSemiColonSeparated) {\n error('Cannot mix ; and , as delimiter types');\n }\n expressionContainsNamed = true;\n }\n\n value = parsers.detachedRuleset() || parsers.expression();\n\n if (!value) {\n if (isCall) {\n error('could not understand value for named argument');\n } else {\n parserInput.restore();\n returner.args = [];\n return returner;\n }\n }\n nameLoop = (name = val.name);\n } else if (parserInput.$str('...')) {\n if (!isCall) {\n returner.variadic = true;\n if (parserInput.$char(';') && !isSemiColonSeparated) {\n isSemiColonSeparated = true;\n }\n (isSemiColonSeparated ? argsSemiColon : argsComma)\n .push({ name: arg.name, variadic: true });\n break;\n } else {\n expand = true;\n }\n } else if (!isCall) {\n name = nameLoop = val.name;\n value = null;\n }\n }\n\n if (value) {\n expressions.push(value);\n }\n\n argsComma.push({ name:nameLoop, value, expand });\n\n if (parserInput.$char(',')) {\n hasSep = true;\n continue;\n }\n hasSep = parserInput.$char(';') === ';';\n\n if (hasSep || isSemiColonSeparated) {\n\n if (expressionContainsNamed) {\n error('Cannot mix ; and , as delimiter types');\n }\n\n isSemiColonSeparated = true;\n\n if (expressions.length > 1) {\n value = new(tree.Value)(expressions);\n }\n argsSemiColon.push({ name, value, expand });\n\n name = null;\n expressions = [];\n expressionContainsNamed = false;\n }\n }\n\n parserInput.forget();\n returner.args = isSemiColonSeparated ? argsSemiColon : argsComma;\n return returner;\n },\n //\n // A Mixin definition, with a list of parameters\n //\n // .rounded (@radius: 2px, @color) {\n // ...\n // }\n //\n // Until we have a finer grained state-machine, we have to\n // do a look-ahead, to make sure we don't have a mixin call.\n // See the `rule` function for more information.\n //\n // We start by matching `.rounded (`, and then proceed on to\n // the argument list, which has optional default values.\n // We store the parameters in `params`, with a `value` key,\n // if there is a value, such as in the case of `@radius`.\n //\n // Once we've got our params list, and a closing `)`, we parse\n // the `{...}` block.\n //\n definition: function () {\n let name;\n let params = [];\n let match;\n let ruleset;\n let cond;\n let variadic = false;\n if ((parserInput.currentChar() !== '.' && parserInput.currentChar() !== '#') ||\n parserInput.peek(/^[^{]*\\}/)) {\n return;\n }\n\n parserInput.save();\n\n match = parserInput.$re(/^([#.](?:[\\w-]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\\s*\\(/);\n if (match) {\n name = match[1];\n\n const argInfo = this.args(false);\n params = argInfo.args;\n variadic = argInfo.variadic;\n\n // .mixincall(\"@{a}\");\n // looks a bit like a mixin definition..\n // also\n // .mixincall(@a: {rule: set;});\n // so we have to be nice and restore\n if (!parserInput.$char(')')) {\n parserInput.restore('Missing closing \\')\\'');\n return;\n }\n\n parserInput.commentStore.length = 0;\n\n if (parserInput.$str('when')) { // Guard\n cond = expect(parsers.conditions, 'expected condition');\n }\n\n ruleset = parsers.block();\n\n if (ruleset) {\n parserInput.forget();\n return new(tree.mixin.Definition)(name, params, ruleset, cond, variadic);\n } else {\n parserInput.restore();\n }\n } else {\n parserInput.restore();\n }\n },\n\n ruleLookups: function() {\n let rule;\n const lookups = [];\n\n if (parserInput.currentChar() !== '[') {\n return;\n }\n\n while (true) {\n parserInput.save();\n rule = this.lookupValue();\n if (!rule && rule !== '') {\n parserInput.restore();\n break;\n }\n lookups.push(rule);\n parserInput.forget();\n }\n if (lookups.length > 0) {\n return lookups;\n }\n },\n\n lookupValue: function() {\n parserInput.save();\n\n if (!parserInput.$char('[')) {\n parserInput.restore();\n return;\n }\n\n const name = parserInput.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/);\n\n if (!parserInput.$char(']')) {\n parserInput.restore();\n return;\n }\n\n if (name || name === '') {\n parserInput.forget();\n return name;\n }\n\n parserInput.restore();\n }\n },\n //\n // Entities are the smallest recognized token,\n // and can be found inside a rule's value.\n //\n entity: function () {\n const entities = this.entities;\n\n return this.comment() || entities.literal() || entities.variable() || entities.url() ||\n entities.property() || entities.call() || entities.keyword() || this.mixin.call(true) ||\n entities.javascript();\n },\n\n //\n // A Declaration terminator. Note that we use `peek()` to check for '}',\n // because the `block` rule will be expecting it, but we still need to make sure\n // it's there, if ';' was omitted.\n //\n end: function () {\n return parserInput.$char(';') || parserInput.peek('}');\n },\n\n //\n // IE's alpha function\n //\n // alpha(opacity=88)\n //\n ieAlpha: function () {\n let value;\n\n // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18\n if (!parserInput.$re(/^opacity=/i)) { return; }\n value = parserInput.$re(/^\\d+/);\n if (!value) {\n value = expect(parsers.entities.variable, 'Could not parse alpha');\n value = `@{${value.name.slice(1)}}`;\n }\n expectChar(')');\n return new tree.Quoted('', `alpha(opacity=${value})`);\n },\n\n /** \n * A Selector Element\n *\n * div\n * + h1\n * #socks\n * input[type=\"text\"]\n *\n * Elements are the building blocks for Selectors,\n * they are made out of a `Combinator` (see combinator rule),\n * and an element name, such as a tag a class, or `*`.\n */\n element: function () {\n let e;\n let c;\n let v;\n const index = parserInput.i;\n\n c = this.combinator();\n\n /** This selector parser is quite simplistic and will pass a number of invalid selectors. */\n e = parserInput.$re(/^(?:\\d+\\.\\d+|\\d+)%/) ||\n // eslint-disable-next-line no-control-regex\n parserInput.$re(/^(?:[.#]?|:*)(?:[\\w-]|[^\\x00-\\x9f]|\\\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/) ||\n parserInput.$char('*') || parserInput.$char('&') || this.attribute() ||\n parserInput.$re(/^\\([^&()@]+\\)/) || parserInput.$re(/^[.#:](?=@)/) ||\n this.entities.variableCurly();\n\n if (!e) {\n parserInput.save();\n if (parserInput.$char('(')) {\n if ((v = this.selector(false))) {\n let selectors = [];\n while (parserInput.$char(',')) {\n selectors.push(v);\n selectors.push(new Anonymous(','));\n v = this.selector(false);\n }\n selectors.push(v);\n \n if (parserInput.$char(')')) {\n if (selectors.length > 1) {\n e = new (tree.Paren)(new Selector(selectors));\n } else {\n e = new(tree.Paren)(v);\n }\n parserInput.forget();\n } else {\n parserInput.restore('Missing closing \\')\\'');\n }\n } else {\n parserInput.restore('Missing closing \\')\\'');\n }\n } else {\n parserInput.forget();\n }\n }\n\n if (e) { return new(tree.Element)(c, e, e instanceof tree.Variable, index + currentIndex, fileInfo); }\n },\n\n //\n // Combinators combine elements together, in a Selector.\n //\n // Because our parser isn't white-space sensitive, special care\n // has to be taken, when parsing the descendant combinator, ` `,\n // as it's an empty space. We have to check the previous character\n // in the input, to see if it's a ` ` character. More info on how\n // we deal with this in *combinator.js*.\n //\n combinator: function () {\n let c = parserInput.currentChar();\n\n if (c === '/') {\n parserInput.save();\n const slashedCombinator = parserInput.$re(/^\\/[a-z]+\\//i);\n if (slashedCombinator) {\n parserInput.forget();\n return new(tree.Combinator)(slashedCombinator);\n }\n parserInput.restore();\n }\n\n if (c === '>' || c === '+' || c === '~' || c === '|' || c === '^') {\n parserInput.i++;\n if (c === '^' && parserInput.currentChar() === '^') {\n c = '^^';\n parserInput.i++;\n }\n while (parserInput.isWhitespace()) { parserInput.i++; }\n return new(tree.Combinator)(c);\n } else if (parserInput.isWhitespace(-1)) {\n return new(tree.Combinator)(' ');\n } else {\n return new(tree.Combinator)(null);\n }\n },\n //\n // A CSS Selector\n // with less extensions e.g. the ability to extend and guard\n //\n // .class > div + h1\n // li a:hover\n //\n // Selectors are made out of one or more Elements, see above.\n //\n selector: function (isLess) {\n const index = parserInput.i;\n let elements;\n let extendList;\n let c;\n let e;\n let allExtends;\n let when;\n let condition;\n isLess = isLess !== false;\n while ((isLess && (extendList = this.extend())) || (isLess && (when = parserInput.$str('when'))) || (e = this.element())) {\n if (when) {\n condition = expect(this.conditions, 'expected condition');\n } else if (condition) {\n error('CSS guard can only be used at the end of selector');\n } else if (extendList) {\n if (allExtends) {\n allExtends = allExtends.concat(extendList);\n } else {\n allExtends = extendList;\n }\n } else {\n if (allExtends) { error('Extend can only be used at the end of selector'); }\n c = parserInput.currentChar();\n if (Array.isArray(e)){\n e.forEach(ele => elements.push(ele));\n } if (elements) {\n elements.push(e);\n } else {\n elements = [ e ];\n }\n e = null;\n }\n if (c === '{' || c === '}' || c === ';' || c === ',' || c === ')') {\n break;\n }\n }\n\n if (elements) { return new(tree.Selector)(elements, allExtends, condition, index + currentIndex, fileInfo); }\n if (allExtends) { error('Extend must be used to extend a selector, it cannot be used on its own'); }\n },\n selectors: function () {\n let s;\n let selectors;\n while (true) {\n s = this.selector();\n if (!s) {\n break;\n }\n if (selectors) {\n selectors.push(s);\n } else {\n selectors = [ s ];\n }\n parserInput.commentStore.length = 0;\n if (s.condition && selectors.length > 1) {\n error('Guards are only currently allowed on a single selector.');\n }\n if (!parserInput.$char(',')) { break; }\n if (s.condition) {\n error('Guards are only currently allowed on a single selector.');\n }\n parserInput.commentStore.length = 0;\n }\n return selectors;\n },\n attribute: function () {\n if (!parserInput.$char('[')) { return; }\n\n const entities = this.entities;\n let key;\n let val;\n let op;\n //\n // case-insensitive flag\n // e.g. [attr operator value i]\n //\n let cif;\n\n if (!(key = entities.variableCurly())) {\n key = expect(/^(?:[_A-Za-z0-9-*]*\\|)?(?:[_A-Za-z0-9-]|\\\\.)+/);\n }\n\n op = parserInput.$re(/^[|~*$^]?=/);\n if (op) {\n val = entities.quoted() || parserInput.$re(/^[0-9]+%/) || parserInput.$re(/^[\\w-]+/) || entities.variableCurly();\n if (val) {\n cif = parserInput.$re(/^[iIsS]/);\n }\n }\n\n expectChar(']');\n\n return new(tree.Attribute)(key, op, val, cif);\n },\n\n //\n // The `block` rule is used by `ruleset` and `mixin.definition`.\n // It's a wrapper around the `primary` rule, with added `{}`.\n //\n block: function () {\n let content;\n if (parserInput.$char('{') && (content = this.primary()) && parserInput.$char('}')) {\n return content;\n }\n },\n\n blockRuleset: function() {\n let block = this.block();\n\n if (block) {\n block = new tree.Ruleset(null, block);\n }\n return block;\n },\n\n detachedRuleset: function() {\n let argInfo;\n let params;\n let variadic;\n\n parserInput.save();\n if (parserInput.$re(/^[.#]\\(/)) {\n /**\n * DR args currently only implemented for each() function, and not\n * yet settable as `@dr: #(@arg) {}`\n * This should be done when DRs are merged with mixins.\n * See: https://github.com/less/less-meta/issues/16\n */\n argInfo = this.mixin.args(false);\n params = argInfo.args;\n variadic = argInfo.variadic;\n if (!parserInput.$char(')')) {\n parserInput.restore();\n return;\n }\n }\n const blockRuleset = this.blockRuleset();\n if (blockRuleset) {\n parserInput.forget();\n if (params) {\n return new tree.mixin.Definition(null, params, blockRuleset, null, variadic);\n }\n return new tree.DetachedRuleset(blockRuleset);\n }\n parserInput.restore();\n },\n\n //\n // div, .class, body > p {...}\n //\n ruleset: function () {\n let selectors;\n let rules;\n let debugInfo;\n\n parserInput.save();\n\n if (context.dumpLineNumbers) {\n debugInfo = getDebugInfo(parserInput.i);\n }\n\n selectors = this.selectors();\n\n if (selectors && (rules = this.block())) {\n parserInput.forget();\n const ruleset = new(tree.Ruleset)(selectors, rules, context.strictImports);\n if (context.dumpLineNumbers) {\n ruleset.debugInfo = debugInfo;\n }\n return ruleset;\n } else {\n parserInput.restore();\n }\n },\n declaration: function () {\n let name;\n let value;\n const index = parserInput.i;\n let hasDR;\n const c = parserInput.currentChar();\n let important;\n let merge;\n let isVariable;\n\n if (c === '.' || c === '#' || c === '&' || c === ':') { return; }\n\n parserInput.save();\n\n name = this.variable() || this.ruleProperty();\n if (name) {\n isVariable = typeof name === 'string';\n\n if (isVariable) {\n value = this.detachedRuleset();\n if (value) {\n hasDR = true;\n }\n }\n\n parserInput.commentStore.length = 0;\n if (!value) {\n // a name returned by this.ruleProperty() is always an array of the form:\n // [string-1, ..., string-n, \"\"] or [string-1, ..., string-n, \"+\"]\n // where each item is a tree.Keyword or tree.Variable\n merge = !isVariable && name.length > 1 && name.pop().value;\n\n // Custom property values get permissive parsing\n if (name[0].value && name[0].value.slice(0, 2) === '--') {\n if (parserInput.$char(';')) {\n value = new Anonymous('');\n } else {\n value = this.permissiveValue(/[;}]/, true);\n }\n }\n // Try to store values as anonymous\n // If we need the value later we'll re-parse it in ruleset.parseValue\n else {\n value = this.anonymousValue();\n }\n if (value) {\n parserInput.forget();\n // anonymous values absorb the end ';' which is required for them to work\n return new(tree.Declaration)(name, value, false, merge, index + currentIndex, fileInfo);\n }\n\n if (!value) {\n value = this.value();\n }\n\n if (value) {\n important = this.important();\n } else if (isVariable) {\n /**\n * As a last resort, try permissiveValue\n *\n * @todo - This has created some knock-on problems of not\n * flagging incorrect syntax or detecting user intent.\n */\n value = this.permissiveValue();\n }\n }\n\n if (value && (this.end() || hasDR)) {\n parserInput.forget();\n return new(tree.Declaration)(name, value, important, merge, index + currentIndex, fileInfo);\n }\n else {\n parserInput.restore();\n }\n } else {\n parserInput.restore();\n }\n },\n anonymousValue: function () {\n const index = parserInput.i;\n const match = parserInput.$re(/^([^.#@$+/'\"*`(;{}-]*);/);\n if (match) {\n return new(tree.Anonymous)(match[1], index + currentIndex);\n }\n },\n /**\n * Used for custom properties, at-rules, and variables (as fallback)\n * Parses almost anything inside of {} [] () \"\" blocks\n * until it reaches outer-most tokens.\n *\n * First, it will try to parse comments and entities to reach\n * the end. This is mostly like the Expression parser except no\n * math is allowed.\n * \n * @param {RexExp} untilTokens - Characters to stop parsing at\n */\n permissiveValue: function (untilTokens) {\n let i;\n let e;\n let done;\n let value;\n const tok = untilTokens || ';';\n const index = parserInput.i;\n const result = [];\n\n function testCurrentChar() {\n const char = parserInput.currentChar();\n if (typeof tok === 'string') {\n return char === tok;\n } else {\n return tok.test(char);\n }\n }\n if (testCurrentChar()) {\n return;\n }\n value = [];\n do {\n e = this.comment();\n if (e) {\n value.push(e);\n continue;\n }\n e = this.entity();\n if (e) {\n value.push(e);\n }\n if (parserInput.peek(',')) {\n value.push(new (tree.Anonymous)(',', parserInput.i));\n parserInput.$char(',');\n }\n } while (e);\n\n done = testCurrentChar();\n\n if (value.length > 0) {\n value = new(tree.Expression)(value);\n if (done) {\n return value;\n }\n else {\n result.push(value);\n }\n // Preserve space before $parseUntil as it will not\n if (parserInput.prevChar() === ' ') {\n result.push(new tree.Anonymous(' ', index));\n }\n }\n parserInput.save();\n\n value = parserInput.$parseUntil(tok);\n\n if (value) {\n if (typeof value === 'string') {\n error(`Expected '${value}'`, 'Parse');\n }\n if (value.length === 1 && value[0] === ' ') {\n parserInput.forget();\n return new tree.Anonymous('', index);\n }\n /** @type {string} */\n let item;\n for (i = 0; i < value.length; i++) {\n item = value[i];\n if (Array.isArray(item)) {\n // Treat actual quotes as normal quoted values\n result.push(new tree.Quoted(item[0], item[1], true, index, fileInfo));\n }\n else {\n if (i === value.length - 1) {\n item = item.trim();\n }\n // Treat like quoted values, but replace vars like unquoted expressions\n const quote = new tree.Quoted('\\'', item, true, index, fileInfo);\n const variableRegex = /@([\\w-]+)/g;\n const propRegex = /\\$([\\w-]+)/g;\n if (variableRegex.test(item)) {\n warn('@[ident] in unknown values will not be evaluated as variables in the future. Use @{[ident]}', index, 'DEPRECATED');\n }\n if (propRegex.test(item)) {\n warn('$[ident] in unknown values will not be evaluated as property references in the future. Use ${[ident]}', index, 'DEPRECATED');\n }\n quote.variableRegex = /@([\\w-]+)|@{([\\w-]+)}/g;\n quote.propRegex = /\\$([\\w-]+)|\\${([\\w-]+)}/g;\n result.push(quote);\n }\n }\n parserInput.forget();\n return new tree.Expression(result, true);\n }\n parserInput.restore();\n },\n\n //\n // An @import atrule\n //\n // @import \"lib\";\n //\n // Depending on our environment, importing is done differently:\n // In the browser, it's an XHR request, in Node, it would be a\n // file-system operation. The function used for importing is\n // stored in `import`, which we pass to the Import constructor.\n //\n 'import': function () {\n let path;\n let features;\n const index = parserInput.i;\n\n const dir = parserInput.$re(/^@import\\s+/);\n\n if (dir) {\n const options = (dir ? this.importOptions() : null) || {};\n\n if ((path = this.entities.quoted() || this.entities.url())) {\n features = this.mediaFeatures({});\n\n if (!parserInput.$char(';')) {\n parserInput.i = index;\n error('missing semi-colon or unrecognised media features on import');\n }\n features = features && new(tree.Value)(features);\n return new(tree.Import)(path, features, options, index + currentIndex, fileInfo);\n }\n else {\n parserInput.i = index;\n error('malformed import statement');\n }\n }\n },\n\n importOptions: function() {\n let o;\n const options = {};\n let optionName;\n let value;\n\n // list of options, surrounded by parens\n if (!parserInput.$char('(')) { return null; }\n do {\n o = this.importOption();\n if (o) {\n optionName = o;\n value = true;\n switch (optionName) {\n case 'css':\n optionName = 'less';\n value = false;\n break;\n case 'once':\n optionName = 'multiple';\n value = false;\n break;\n }\n options[optionName] = value;\n if (!parserInput.$char(',')) { break; }\n }\n } while (o);\n expectChar(')');\n return options;\n },\n\n importOption: function() {\n const opt = parserInput.$re(/^(less|css|multiple|once|inline|reference|optional)/);\n if (opt) {\n return opt[1];\n }\n },\n\n mediaFeature: function (syntaxOptions) {\n const entities = this.entities;\n const nodes = [];\n let e;\n let p;\n let rangeP;\n let spacing = false;\n parserInput.save();\n do {\n parserInput.save();\n if (parserInput.$re(/^[0-9a-z-]*\\s+\\(/)) {\n spacing = true;\n }\n parserInput.restore();\n\n e = entities.declarationCall.bind(this)() || entities.keyword() || entities.variable() || entities.mixinLookup()\n if (e) {\n nodes.push(e);\n } else if (parserInput.$char('(')) {\n p = this.property();\n parserInput.save();\n if (!p && syntaxOptions.queryInParens && parserInput.$re(/^[0-9a-z-]*\\s*([<>]=|<=|>=|[<>]|=)/)) {\n parserInput.restore();\n p = this.condition();\n\n parserInput.save();\n rangeP = this.atomicCondition(null, p.rvalue);\n if (!rangeP) {\n parserInput.restore();\n }\n } else {\n parserInput.restore();\n e = this.value();\n }\n if (parserInput.$char(')')) {\n if (p && !e) {\n nodes.push(new (tree.Paren)(new (tree.QueryInParens)(p.op, p.lvalue, p.rvalue, rangeP ? rangeP.op : null, rangeP ? rangeP.rvalue : null, p._index)));\t\t\t\t \n e = p;\n } else if (p && e) {\n nodes.push(new (tree.Paren)(new (tree.Declaration)(p, e, null, null, parserInput.i + currentIndex, fileInfo, true)));\n if (!spacing) {\n nodes[nodes.length - 1].noSpacing = true;\n }\n spacing = false;\n } else if (e) {\n nodes.push(new(tree.Paren)(e));\n spacing = false;\n } else {\n error('badly formed media feature definition');\n }\n } else {\n error('Missing closing \\')\\'', 'Parse');\n }\n }\n } while (e);\n\n parserInput.forget();\n if (nodes.length > 0) {\n return new(tree.Expression)(nodes);\n }\n },\n\n mediaFeatures: function (syntaxOptions) {\n const entities = this.entities;\n const features = [];\n let e;\n do {\n e = this.mediaFeature(syntaxOptions);\n if (e) {\n features.push(e);\n if (!parserInput.$char(',')) { break; }\n else if (!features[features.length - 1].noSpacing) {\n features[features.length - 1].noSpacing = false;\n }\n } else {\n e = entities.variable() || entities.mixinLookup();\n if (e) {\n features.push(e);\n if (!parserInput.$char(',')) { break; }\n else if (!features[features.length - 1].noSpacing) {\n features[features.length - 1].noSpacing = false;\n }\n }\n }\n } while (e);\n\n return features.length > 0 ? features : null;\n },\n\n prepareAndGetNestableAtRule: function (treeType, index, debugInfo, syntaxOptions) {\n const features = this.mediaFeatures(syntaxOptions);\n\n const rules = this.block();\n\n if (!rules) {\n error('media definitions require block statements after any features');\n }\n\n parserInput.forget();\n\n const atRule = new (treeType)(rules, features, index + currentIndex, fileInfo);\n if (context.dumpLineNumbers) {\n atRule.debugInfo = debugInfo;\n }\n\n return atRule;\n },\n\n nestableAtRule: function () {\n let debugInfo;\n const index = parserInput.i;\n\n if (context.dumpLineNumbers) {\n debugInfo = getDebugInfo(index);\n }\n parserInput.save();\n\n if (parserInput.$peekChar('@')) {\n if (parserInput.$str('@media')) {\n return this.prepareAndGetNestableAtRule(tree.Media, index, debugInfo, MediaSyntaxOptions);\n }\n \n if (parserInput.$str('@container')) {\n return this.prepareAndGetNestableAtRule(tree.Container, index, debugInfo, ContainerSyntaxOptions);\n }\n }\n \n parserInput.restore();\n },\n\n //\n\n // A @plugin directive, used to import plugins dynamically.\n //\n // @plugin (args) \"lib\";\n //\n plugin: function () {\n let path;\n let args;\n let options;\n const index = parserInput.i;\n const dir = parserInput.$re(/^@plugin\\s+/);\n\n if (dir) {\n args = this.pluginArgs();\n\n if (args) {\n options = {\n pluginArgs: args,\n isPlugin: true\n };\n }\n else {\n options = { isPlugin: true };\n }\n\n if ((path = this.entities.quoted() || this.entities.url())) {\n\n if (!parserInput.$char(';')) {\n parserInput.i = index;\n error('missing semi-colon on @plugin');\n }\n return new(tree.Import)(path, null, options, index + currentIndex, fileInfo);\n }\n else {\n parserInput.i = index;\n error('malformed @plugin statement');\n }\n }\n },\n\n pluginArgs: function() {\n // list of options, surrounded by parens\n parserInput.save();\n if (!parserInput.$char('(')) {\n parserInput.restore();\n return null;\n }\n const args = parserInput.$re(/^\\s*([^);]+)\\)\\s*/);\n if (args[1]) {\n parserInput.forget();\n return args[1].trim();\n }\n else {\n parserInput.restore();\n return null;\n }\n },\n atruleUnknown: function (value, name, hasBlock) {\n value = this.permissiveValue(/^[{;]/);\n hasBlock = (parserInput.currentChar() === '{');\n if (!value) {\n if (!hasBlock && parserInput.currentChar() !== ';') {\n error(''.concat(name, ' rule is missing block or ending semi-colon'));\n }\n }\n else if (!value.value) {\n value = null;\n }\n return [value, hasBlock];\n },\n atruleBlock: function (rules, value, isRooted, isKeywordList) {\n rules = this.blockRuleset();\n parserInput.save();\n if (!rules && !isRooted) {\n value = this.entity();\n rules = this.blockRuleset();\n }\n if (!rules && !isRooted) {\n parserInput.restore();\n var e = [];\n value = this.entity();\n while (parserInput.$char(',')) {\n e.push(value);\n value = this.entity();\n }\n if (value && e.length > 0) {\n e.push(value);\n value = e;\n isKeywordList = true;\n }\n else {\n rules = this.blockRuleset();\n }\n }\n else {\n parserInput.forget();\n }\n \n return [rules, value, isKeywordList];\n },\n //\n // A CSS AtRule\n //\n // @charset \"utf-8\";\n //\n atrule: function () {\n const index = parserInput.i;\n let name;\n let value;\n let rules;\n let nonVendorSpecificName;\n let hasIdentifier;\n let hasExpression;\n let hasUnknown;\n let hasBlock = true;\n let isRooted = true;\n let isKeywordList = false;\n\n if (parserInput.currentChar() !== '@') { return; }\n\n value = this['import']() || this.plugin() || this.nestableAtRule();\n if (value) {\n return value;\n }\n\n parserInput.save();\n\n name = parserInput.$re(/^@[a-z-]+/);\n\n if (!name) { return; }\n\n nonVendorSpecificName = name;\n if (name.charAt(1) == '-' && name.indexOf('-', 2) > 0) {\n nonVendorSpecificName = `@${name.slice(name.indexOf('-', 2) + 1)}`;\n }\n\n switch (nonVendorSpecificName) {\n case '@charset':\n hasIdentifier = true;\n hasBlock = false;\n break;\n case '@namespace':\n hasExpression = true;\n hasBlock = false;\n break;\n case '@keyframes':\n case '@counter-style':\n hasIdentifier = true;\n break;\n case '@document':\n case '@supports':\n hasUnknown = true;\n isRooted = false;\n break;\n case '@starting-style':\n isRooted = false;\n break;\n case '@layer':\n isRooted = false;\n break;\n default:\n hasUnknown = true;\n break;\n }\n\n parserInput.commentStore.length = 0;\n\n if (hasIdentifier) {\n value = this.entity();\n if (!value) {\n error(`expected ${name} identifier`);\n }\n } else if (hasExpression) {\n value = this.expression();\n if (!value) {\n error(`expected ${name} expression`);\n }\n } else if (hasUnknown) {\n const unknownPackage = this.atruleUnknown(value, name, hasBlock);\n value = unknownPackage[0];\n hasBlock = unknownPackage[1];\n }\n \n if (hasBlock) {\n let blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList);\n rules = blockPackage[0];\n value = blockPackage[1];\n isKeywordList = blockPackage[2];\n\n if (!rules && !hasUnknown) {\n parserInput.restore();\n name = parserInput.$re(/^@[a-z-]+/);\n const unknownPackage = this.atruleUnknown(value, name, hasBlock);\n value = unknownPackage[0];\n hasBlock = unknownPackage[1];\n if (hasBlock) {\n blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList);\n rules = blockPackage[0];\n value = blockPackage[1];\n isKeywordList = blockPackage[2];\n }\n }\n }\n\n if (rules || isKeywordList || (!hasBlock && value && parserInput.$char(';'))) {\n parserInput.forget();\n return new(tree.AtRule)(name, value, rules, index + currentIndex, fileInfo,\n context.dumpLineNumbers ? getDebugInfo(index) : null,\n isRooted\n );\n }\n\n parserInput.restore('at-rule options not recognised');\n },\n\n //\n // A Value is a comma-delimited list of Expressions\n //\n // font-family: Baskerville, Georgia, serif;\n //\n // In a Rule, a Value represents everything after the `:`,\n // and before the `;`.\n //\n value: function () {\n let e;\n const expressions = [];\n const index = parserInput.i;\n\n do {\n e = this.expression();\n if (e) {\n expressions.push(e);\n if (!parserInput.$char(',')) { break; }\n }\n } while (e);\n\n if (expressions.length > 0) {\n return new(tree.Value)(expressions, index + currentIndex);\n }\n },\n important: function () {\n if (parserInput.currentChar() === '!') {\n return parserInput.$re(/^! *important/);\n }\n },\n sub: function () {\n let a;\n let e;\n\n parserInput.save();\n if (parserInput.$char('(')) {\n a = this.addition();\n if (a && parserInput.$char(')')) {\n parserInput.forget();\n e = new(tree.Expression)([a]);\n e.parens = true;\n return e;\n }\n parserInput.restore('Expected \\')\\'');\n return;\n }\n parserInput.restore();\n },\n colorOperand: function () {\n parserInput.save();\n \n // hsl or rgb or lch operand\n const match = parserInput.$re(/^[lchrgbs]\\s+/);\n if (match) {\n return new tree.Keyword(match[0]);\n }\n\n parserInput.restore();\n },\n multiplication: function () {\n let m;\n let a;\n let op;\n let operation;\n let isSpaced;\n m = this.operand();\n if (m) {\n isSpaced = parserInput.isWhitespace(-1);\n while (true) {\n if (parserInput.peek(/^\\/[*/]/)) {\n break;\n }\n\n parserInput.save();\n\n op = parserInput.$char('/') || parserInput.$char('*');\n if (!op) {\n let index = parserInput.i;\n op = parserInput.$str('./');\n if (op) {\n warn('./ operator is deprecated', index, 'DEPRECATED');\n }\n }\n\n if (!op) { parserInput.forget(); break; }\n\n a = this.operand();\n\n if (!a) { parserInput.restore(); break; }\n parserInput.forget();\n\n m.parensInOp = true;\n a.parensInOp = true;\n operation = new(tree.Operation)(op, [operation || m, a], isSpaced);\n isSpaced = parserInput.isWhitespace(-1);\n }\n return operation || m;\n }\n },\n addition: function () {\n let m;\n let a;\n let op;\n let operation;\n let isSpaced;\n m = this.multiplication();\n if (m) {\n isSpaced = parserInput.isWhitespace(-1);\n while (true) {\n op = parserInput.$re(/^[-+]\\s+/) || (!isSpaced && (parserInput.$char('+') || parserInput.$char('-')));\n if (!op) {\n break;\n }\n a = this.multiplication();\n if (!a) {\n break;\n }\n\n m.parensInOp = true;\n a.parensInOp = true;\n operation = new(tree.Operation)(op, [operation || m, a], isSpaced);\n isSpaced = parserInput.isWhitespace(-1);\n }\n return operation || m;\n }\n },\n conditions: function () {\n let a;\n let b;\n const index = parserInput.i;\n let condition;\n\n a = this.condition(true);\n if (a) {\n while (true) {\n if (!parserInput.peek(/^,\\s*(not\\s*)?\\(/) || !parserInput.$char(',')) {\n break;\n }\n b = this.condition(true);\n if (!b) {\n break;\n }\n condition = new(tree.Condition)('or', condition || a, b, index + currentIndex);\n }\n return condition || a;\n }\n },\n condition: function (needsParens) {\n let result;\n let logical;\n let next;\n function or() {\n return parserInput.$str('or');\n }\n\n result = this.conditionAnd(needsParens);\n if (!result) {\n return ;\n }\n logical = or();\n if (logical) {\n next = this.condition(needsParens);\n if (next) {\n result = new(tree.Condition)(logical, result, next);\n } else {\n return ;\n }\n }\n return result;\n },\n conditionAnd: function (needsParens) {\n let result;\n let logical;\n let next;\n const self = this;\n function insideCondition() {\n const cond = self.negatedCondition(needsParens) || self.parenthesisCondition(needsParens);\n if (!cond && !needsParens) {\n return self.atomicCondition(needsParens);\n }\n return cond;\n }\n function and() {\n return parserInput.$str('and');\n }\n\n result = insideCondition();\n if (!result) {\n return ;\n }\n logical = and();\n if (logical) {\n next = this.conditionAnd(needsParens);\n if (next) {\n result = new(tree.Condition)(logical, result, next);\n } else {\n return ;\n }\n }\n return result;\n },\n negatedCondition: function (needsParens) {\n if (parserInput.$str('not')) {\n const result = this.parenthesisCondition(needsParens);\n if (result) {\n result.negate = !result.negate;\n }\n return result;\n }\n },\n parenthesisCondition: function (needsParens) {\n function tryConditionFollowedByParenthesis(me) {\n let body;\n parserInput.save();\n body = me.condition(needsParens);\n if (!body) {\n parserInput.restore();\n return ;\n }\n if (!parserInput.$char(')')) {\n parserInput.restore();\n return ;\n }\n parserInput.forget();\n return body;\n }\n\n let body;\n parserInput.save();\n if (!parserInput.$str('(')) {\n parserInput.restore();\n return ;\n }\n body = tryConditionFollowedByParenthesis(this);\n if (body) {\n parserInput.forget();\n return body;\n }\n\n body = this.atomicCondition(needsParens);\n if (!body) {\n parserInput.restore();\n return ;\n }\n if (!parserInput.$char(')')) {\n parserInput.restore(`expected ')' got '${parserInput.currentChar()}'`);\n return ;\n }\n parserInput.forget();\n return body;\n },\n atomicCondition: function (needsParens, preparsedCond) {\n const entities = this.entities;\n const index = parserInput.i;\n let a;\n let b;\n let c;\n let op;\n\n const cond = (function() {\n return this.addition() || entities.keyword() || entities.quoted() || entities.mixinLookup();\n }).bind(this)\n\n if (preparsedCond) {\n a = preparsedCond;\n } else {\n a = cond();\n }\n\n if (a) {\n if (parserInput.$char('>')) {\n if (parserInput.$char('=')) {\n op = '>=';\n } else {\n op = '>';\n }\n } else\n if (parserInput.$char('<')) {\n if (parserInput.$char('=')) {\n op = '<=';\n } else {\n op = '<';\n }\n } else\n if (parserInput.$char('=')) {\n if (parserInput.$char('>')) {\n op = '=>';\n } else if (parserInput.$char('<')) {\n op = '=<';\n } else {\n op = '=';\n }\n }\n if (op) {\n b = cond();\n if (b) {\n c = new(tree.Condition)(op, a, b, index + currentIndex, false);\n } else {\n error('expected expression');\n }\n } else if (!preparsedCond) {\n c = new(tree.Condition)('=', a, new(tree.Keyword)('true'), index + currentIndex, false);\n }\n return c;\n }\n },\n\n //\n // An operand is anything that can be part of an operation,\n // such as a Color, or a Variable\n //\n operand: function () {\n const entities = this.entities;\n let negate;\n\n if (parserInput.peek(/^-[@$(]/)) {\n negate = parserInput.$char('-');\n }\n\n let o = this.sub() || entities.dimension() ||\n entities.color() || entities.variable() ||\n entities.property() || entities.call() ||\n entities.quoted(true) || entities.colorKeyword() ||\n this.colorOperand() || entities.mixinLookup();\n\n if (negate) {\n o.parensInOp = true;\n o = new(tree.Negative)(o);\n }\n\n return o;\n },\n\n //\n // Expressions either represent mathematical operations,\n // or white-space delimited Entities.\n //\n // 1px solid black\n // @var * 2\n //\n expression: function () {\n const entities = [];\n let e;\n let delim;\n const index = parserInput.i;\n\n do {\n e = this.comment();\n if (e && !e.isLineComment) {\n entities.push(e);\n continue;\n }\n e = this.addition() || this.entity();\n\n if (e instanceof tree.Comment) {\n e = null;\n }\n\n if (e) {\n entities.push(e);\n // operations do not allow keyword \"/\" dimension (e.g. small/20px) so we support that here\n if (!parserInput.peek(/^\\/[/*]/)) {\n delim = parserInput.$char('/');\n if (delim) {\n entities.push(new(tree.Anonymous)(delim, index + currentIndex));\n }\n }\n }\n } while (e);\n if (entities.length > 0) {\n return new(tree.Expression)(entities);\n }\n },\n property: function () {\n const name = parserInput.$re(/^(\\*?-?[_a-zA-Z0-9-]+)\\s*:/);\n if (name) {\n return name[1];\n }\n },\n ruleProperty: function () {\n let name = [];\n const index = [];\n let s;\n let k;\n\n parserInput.save();\n\n const simpleProperty = parserInput.$re(/^([_a-zA-Z0-9-]+)\\s*:/);\n if (simpleProperty) {\n name = [new(tree.Keyword)(simpleProperty[1])];\n parserInput.forget();\n return name;\n }\n\n function match(re) {\n const i = parserInput.i;\n const chunk = parserInput.$re(re);\n if (chunk) {\n index.push(i);\n return name.push(chunk[1]);\n }\n }\n\n match(/^(\\*?)/);\n while (true) {\n if (!match(/^((?:[\\w-]+)|(?:[@$]\\{[\\w-]+\\}))/)) {\n break;\n }\n }\n\n if ((name.length > 1) && match(/^((?:\\+_|\\+)?)\\s*:/)) {\n parserInput.forget();\n\n // at last, we have the complete match now. move forward,\n // convert name particles to tree objects and return:\n if (name[0] === '') {\n name.shift();\n index.shift();\n }\n for (k = 0; k < name.length; k++) {\n s = name[k];\n name[k] = (s.charAt(0) !== '@' && s.charAt(0) !== '$') ?\n new(tree.Keyword)(s) :\n (s.charAt(0) === '@' ?\n new(tree.Variable)(`@${s.slice(2, -1)}`, index[k] + currentIndex, fileInfo) :\n new(tree.Property)(`$${s.slice(2, -1)}`, index[k] + currentIndex, fileInfo));\n }\n return name;\n }\n parserInput.restore();\n }\n }\n };\n};\nParser.serializeVars = vars => {\n let s = '';\n\n for (const name in vars) {\n if (Object.hasOwnProperty.call(vars, name)) {\n const value = vars[name];\n s += `${((name[0] === '@') ? '' : '@') + name}: ${value}${(String(value).slice(-1) === ';') ? '' : ';'}`;\n }\n }\n\n return s;\n};\n\nexport default Parser;","import Node from './node';\nimport Element from './element';\nimport LessError from '../less-error';\nimport * as utils from '../utils';\nimport Parser from '../parser/parser';\n\nconst Selector = function(elements, extendList, condition, index, currentFileInfo, visibilityInfo) {\n this.extendList = extendList;\n this.condition = condition;\n this.evaldCondition = !condition;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.elements = this.getElements(elements);\n this.mixinElements_ = undefined;\n this.copyVisibilityInfo(visibilityInfo);\n this.setParent(this.elements, this);\n};\n\nSelector.prototype = Object.assign(new Node(), {\n type: 'Selector',\n\n accept(visitor) {\n if (this.elements) {\n this.elements = visitor.visitArray(this.elements);\n }\n if (this.extendList) {\n this.extendList = visitor.visitArray(this.extendList);\n }\n if (this.condition) {\n this.condition = visitor.visit(this.condition);\n }\n },\n\n createDerived(elements, extendList, evaldCondition) {\n elements = this.getElements(elements);\n const newSelector = new Selector(elements, extendList || this.extendList,\n null, this.getIndex(), this.fileInfo(), this.visibilityInfo());\n newSelector.evaldCondition = (!utils.isNullOrUndefined(evaldCondition)) ? evaldCondition : this.evaldCondition;\n newSelector.mediaEmpty = this.mediaEmpty;\n return newSelector;\n },\n\n getElements(els) {\n if (!els) {\n return [new Element('', '&', false, this._index, this._fileInfo)];\n }\n if (typeof els === 'string') {\n new Parser(this.parse.context, this.parse.importManager, this._fileInfo, this._index).parseNode(\n els,\n ['selector'],\n function(err, result) {\n if (err) {\n throw new LessError({\n index: err.index,\n message: err.message\n }, this.parse.imports, this._fileInfo.filename);\n }\n els = result[0].elements;\n });\n }\n return els;\n },\n\n createEmptySelectors() {\n const el = new Element('', '&', false, this._index, this._fileInfo), sels = [new Selector([el], null, null, this._index, this._fileInfo)];\n sels[0].mediaEmpty = true;\n return sels;\n },\n\n match(other) {\n const elements = this.elements;\n const len = elements.length;\n let olen;\n let i;\n\n other = other.mixinElements();\n olen = other.length;\n if (olen === 0 || len < olen) {\n return 0;\n } else {\n for (i = 0; i < olen; i++) {\n if (elements[i].value !== other[i]) {\n return 0;\n }\n }\n }\n\n return olen; // return number of matched elements\n },\n\n mixinElements() {\n if (this.mixinElements_) {\n return this.mixinElements_;\n }\n\n let elements = this.elements.map( function(v) {\n return v.combinator.value + (v.value.value || v.value);\n }).join('').match(/[,&#*.\\w-]([\\w-]|(\\\\.))*/g);\n\n if (elements) {\n if (elements[0] === '&') {\n elements.shift();\n }\n } else {\n elements = [];\n }\n\n return (this.mixinElements_ = elements);\n },\n\n isJustParentSelector() {\n return !this.mediaEmpty &&\n this.elements.length === 1 &&\n this.elements[0].value === '&' &&\n (this.elements[0].combinator.value === ' ' || this.elements[0].combinator.value === '');\n },\n\n eval(context) {\n const evaldCondition = this.condition && this.condition.eval(context);\n let elements = this.elements;\n let extendList = this.extendList;\n\n elements = elements && elements.map(function (e) { return e.eval(context); });\n extendList = extendList && extendList.map(function(extend) { return extend.eval(context); });\n\n return this.createDerived(elements, extendList, evaldCondition);\n },\n\n genCSS(context, output) {\n let i, element;\n if ((!context || !context.firstSelector) && this.elements[0].combinator.value === '') {\n output.add(' ', this.fileInfo(), this.getIndex());\n }\n for (i = 0; i < this.elements.length; i++) {\n element = this.elements[i];\n element.genCSS(context, output);\n }\n },\n\n getIsOutput() {\n return this.evaldCondition;\n }\n});\n\nexport default Selector;\n","import Node from './node';\n\nconst Value = function(value) {\n if (!value) {\n throw new Error('Value requires an array argument');\n }\n if (!Array.isArray(value)) {\n this.value = [ value ];\n }\n else {\n this.value = value;\n }\n};\n\nValue.prototype = Object.assign(new Node(), {\n type: 'Value',\n\n accept(visitor) {\n if (this.value) {\n this.value = visitor.visitArray(this.value);\n }\n },\n\n eval(context) {\n if (this.value.length === 1) {\n return this.value[0].eval(context);\n } else {\n return new Value(this.value.map(function (v) {\n return v.eval(context);\n }));\n }\n },\n\n genCSS(context, output) {\n let i;\n for (i = 0; i < this.value.length; i++) {\n this.value[i].genCSS(context, output);\n if (i + 1 < this.value.length) {\n output.add((context && context.compress) ? ',' : ', ');\n }\n }\n }\n});\n\nexport default Value;\n","import Node from './node';\n\nconst Keyword = function(value) {\n this.value = value;\n};\n\nKeyword.prototype = Object.assign(new Node(), {\n type: 'Keyword',\n\n genCSS(context, output) {\n if (this.value === '%') { throw { type: 'Syntax', message: 'Invalid % without number' }; }\n output.add(this.value);\n }\n});\n\nKeyword.True = new Keyword('true');\nKeyword.False = new Keyword('false');\n\nexport default Keyword;\n","import Node from './node';\nimport Value from './value';\nimport Keyword from './keyword';\nimport Anonymous from './anonymous';\nimport * as Constants from '../constants';\nconst MATH = Constants.Math;\n\nfunction evalName(context, name) {\n let value = '';\n let i;\n const n = name.length;\n const output = {add: function (s) {value += s;}};\n for (i = 0; i < n; i++) {\n name[i].eval(context).genCSS(context, output);\n }\n return value;\n}\n\nconst Declaration = function(name, value, important, merge, index, currentFileInfo, inline, variable) {\n this.name = name;\n this.value = (value instanceof Node) ? value : new Value([value ? new Anonymous(value) : null]);\n this.important = important ? ` ${important.trim()}` : '';\n this.merge = merge;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.inline = inline || false;\n this.variable = (variable !== undefined) ? variable\n : (name.charAt && (name.charAt(0) === '@'));\n this.allowRoot = true;\n this.setParent(this.value, this);\n};\n\nDeclaration.prototype = Object.assign(new Node(), {\n type: 'Declaration',\n\n genCSS(context, output) {\n output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex());\n try {\n this.value.genCSS(context, output);\n }\n catch (e) {\n e.index = this._index;\n e.filename = this._fileInfo.filename;\n throw e;\n }\n output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? '' : ';'), this._fileInfo, this._index);\n },\n\n eval(context) {\n let mathBypass = false, prevMath, name = this.name, evaldValue, variable = this.variable;\n if (typeof name !== 'string') {\n // expand 'primitive' name directly to get\n // things faster (~10% for benchmark.less):\n name = (name.length === 1) && (name[0] instanceof Keyword) ?\n name[0].value : evalName(context, name);\n variable = false; // never treat expanded interpolation as new variable name\n }\n\n // @todo remove when parens-division is default\n if (name === 'font' && context.math === MATH.ALWAYS) {\n mathBypass = true;\n prevMath = context.math;\n context.math = MATH.PARENS_DIVISION;\n }\n try {\n context.importantScope.push({});\n evaldValue = this.value.eval(context);\n\n if (!this.variable && evaldValue.type === 'DetachedRuleset') {\n throw { message: 'Rulesets cannot be evaluated on a property.',\n index: this.getIndex(), filename: this.fileInfo().filename };\n }\n let important = this.important;\n const importantResult = context.importantScope.pop();\n if (!important && importantResult.important) {\n important = importantResult.important;\n }\n\n return new Declaration(name,\n evaldValue,\n important,\n this.merge,\n this.getIndex(), this.fileInfo(), this.inline,\n variable);\n }\n catch (e) {\n if (typeof e.index !== 'number') {\n e.index = this.getIndex();\n e.filename = this.fileInfo().filename;\n }\n throw e;\n }\n finally {\n if (mathBypass) {\n context.math = prevMath;\n }\n }\n },\n\n makeImportant() {\n return new Declaration(this.name,\n this.value,\n '!important',\n this.merge,\n this.getIndex(), this.fileInfo(), this.inline);\n }\n});\n\nexport default Declaration;","function asComment(ctx) {\n return `/* line ${ctx.debugInfo.lineNumber}, ${ctx.debugInfo.fileName} */\\n`;\n}\n\nfunction asMediaQuery(ctx) {\n let filenameWithProtocol = ctx.debugInfo.fileName;\n if (!/^[a-z]+:\\/\\//i.test(filenameWithProtocol)) {\n filenameWithProtocol = `file://${filenameWithProtocol}`;\n }\n return `@media -sass-debug-info{filename{font-family:${filenameWithProtocol.replace(/([.:/\\\\])/g, function (a) {\n if (a == '\\\\') {\n a = '/';\n }\n return `\\\\${a}`;\n })}}line{font-family:\\\\00003${ctx.debugInfo.lineNumber}}}\\n`;\n}\n\nfunction debugInfo(context, ctx, lineSeparator) {\n let result = '';\n if (context.dumpLineNumbers && !context.compress) {\n switch (context.dumpLineNumbers) {\n case 'comments':\n result = asComment(ctx);\n break;\n case 'mediaquery':\n result = asMediaQuery(ctx);\n break;\n case 'all':\n result = asComment(ctx) + (lineSeparator || '') + asMediaQuery(ctx);\n break;\n }\n }\n return result;\n}\n\nexport default debugInfo;\n\n","import Node from './node';\nimport getDebugInfo from './debug-info';\n\nconst Comment = function(value, isLineComment, index, currentFileInfo) {\n this.value = value;\n this.isLineComment = isLineComment;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.allowRoot = true;\n}\n\nComment.prototype = Object.assign(new Node(), {\n type: 'Comment',\n\n genCSS(context, output) {\n if (this.debugInfo) {\n output.add(getDebugInfo(context, this), this.fileInfo(), this.getIndex());\n }\n output.add(this.value);\n },\n\n isSilent(context) {\n const isCompressed = context.compress && this.value[2] !== '!';\n return this.isLineComment || isCompressed;\n }\n});\n\nexport default Comment;\n","import Keyword from '../tree/keyword';\nimport * as utils from '../utils';\n\nconst defaultFunc = {\n eval: function () {\n const v = this.value_;\n const e = this.error_;\n if (e) {\n throw e;\n }\n if (!utils.isNullOrUndefined(v)) {\n return v ? Keyword.True : Keyword.False;\n }\n },\n value: function (v) {\n this.value_ = v;\n },\n error: function (e) {\n this.error_ = e;\n },\n reset: function () {\n this.value_ = this.error_ = null;\n }\n};\n\nexport default defaultFunc;\n","import Node from './node';\nimport Declaration from './declaration';\nimport Keyword from './keyword';\nimport Comment from './comment';\nimport Paren from './paren';\nimport Selector from './selector';\nimport Element from './element';\nimport Anonymous from './anonymous';\nimport contexts from '../contexts';\nimport globalFunctionRegistry from '../functions/function-registry';\nimport defaultFunc from '../functions/default';\nimport getDebugInfo from './debug-info';\nimport * as utils from '../utils';\nimport Parser from '../parser/parser';\n\nconst Ruleset = function(selectors, rules, strictImports, visibilityInfo) {\n this.selectors = selectors;\n this.rules = rules;\n this._lookups = {};\n this._variables = null;\n this._properties = null;\n this.strictImports = strictImports;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n\n this.setParent(this.selectors, this);\n this.setParent(this.rules, this);\n}\n\nRuleset.prototype = Object.assign(new Node(), {\n type: 'Ruleset',\n isRuleset: true,\n\n isRulesetLike() { return true; },\n\n accept(visitor) {\n if (this.paths) {\n this.paths = visitor.visitArray(this.paths, true);\n } else if (this.selectors) {\n this.selectors = visitor.visitArray(this.selectors);\n }\n if (this.rules && this.rules.length) {\n this.rules = visitor.visitArray(this.rules);\n }\n },\n\n eval(context) {\n let selectors;\n let selCnt;\n let selector;\n let i;\n let hasVariable;\n let hasOnePassingSelector = false;\n\n if (this.selectors && (selCnt = this.selectors.length)) {\n selectors = new Array(selCnt);\n defaultFunc.error({\n type: 'Syntax',\n message: 'it is currently only allowed in parametric mixin guards,'\n });\n\n for (i = 0; i < selCnt; i++) {\n selector = this.selectors[i].eval(context);\n for (let j = 0; j < selector.elements.length; j++) {\n if (selector.elements[j].isVariable) {\n hasVariable = true;\n break;\n }\n }\n selectors[i] = selector;\n if (selector.evaldCondition) {\n hasOnePassingSelector = true;\n }\n }\n\n if (hasVariable) {\n const toParseSelectors = new Array(selCnt);\n for (i = 0; i < selCnt; i++) {\n selector = selectors[i];\n toParseSelectors[i] = selector.toCSS(context);\n }\n const startingIndex = selectors[0].getIndex();\n const selectorFileInfo = selectors[0].fileInfo();\n new Parser(context, this.parse.importManager, selectorFileInfo, startingIndex).parseNode(\n toParseSelectors.join(','),\n ['selectors'],\n function(err, result) {\n if (result) {\n selectors = utils.flattenArray(result);\n }\n });\n }\n\n defaultFunc.reset();\n } else {\n hasOnePassingSelector = true;\n }\n\n let rules = this.rules ? utils.copyArray(this.rules) : null;\n const ruleset = new Ruleset(selectors, rules, this.strictImports, this.visibilityInfo());\n let rule;\n let subRule;\n\n ruleset.originalRuleset = this;\n ruleset.root = this.root;\n ruleset.firstRoot = this.firstRoot;\n ruleset.allowImports = this.allowImports;\n\n if (this.debugInfo) {\n ruleset.debugInfo = this.debugInfo;\n }\n\n if (!hasOnePassingSelector) {\n rules.length = 0;\n }\n\n // inherit a function registry from the frames stack when possible;\n // otherwise from the global registry\n ruleset.functionRegistry = (function (frames) {\n let i = 0;\n const n = frames.length;\n let found;\n for ( ; i !== n ; ++i ) {\n found = frames[ i ].functionRegistry;\n if ( found ) { return found; }\n }\n return globalFunctionRegistry;\n }(context.frames)).inherit();\n\n // push the current ruleset to the frames stack\n const ctxFrames = context.frames;\n ctxFrames.unshift(ruleset);\n\n // currrent selectors\n let ctxSelectors = context.selectors;\n if (!ctxSelectors) {\n context.selectors = ctxSelectors = [];\n }\n ctxSelectors.unshift(this.selectors);\n\n // Evaluate imports\n if (ruleset.root || ruleset.allowImports || !ruleset.strictImports) {\n ruleset.evalImports(context);\n }\n\n // Store the frames around mixin definitions,\n // so they can be evaluated like closures when the time comes.\n const rsRules = ruleset.rules;\n for (i = 0; (rule = rsRules[i]); i++) {\n if (rule.evalFirst) {\n rsRules[i] = rule.eval(context);\n }\n }\n\n const mediaBlockCount = (context.mediaBlocks && context.mediaBlocks.length) || 0;\n\n // Evaluate mixin calls.\n for (i = 0; (rule = rsRules[i]); i++) {\n if (rule.type === 'MixinCall') {\n /* jshint loopfunc:true */\n rules = rule.eval(context).filter(function(r) {\n if ((r instanceof Declaration) && r.variable) {\n // do not pollute the scope if the variable is\n // already there. consider returning false here\n // but we need a way to \"return\" variable from mixins\n return !(ruleset.variable(r.name));\n }\n return true;\n });\n rsRules.splice.apply(rsRules, [i, 1].concat(rules));\n i += rules.length - 1;\n ruleset.resetCache();\n } else if (rule.type === 'VariableCall') {\n /* jshint loopfunc:true */\n rules = rule.eval(context).rules.filter(function(r) {\n if ((r instanceof Declaration) && r.variable) {\n // do not pollute the scope at all\n return false;\n }\n return true;\n });\n rsRules.splice.apply(rsRules, [i, 1].concat(rules));\n i += rules.length - 1;\n ruleset.resetCache();\n }\n }\n\n // Evaluate everything else\n for (i = 0; (rule = rsRules[i]); i++) {\n if (!rule.evalFirst) {\n rsRules[i] = rule = rule.eval ? rule.eval(context) : rule;\n }\n }\n\n // Evaluate everything else\n for (i = 0; (rule = rsRules[i]); i++) {\n // for rulesets, check if it is a css guard and can be removed\n if (rule instanceof Ruleset && rule.selectors && rule.selectors.length === 1) {\n // check if it can be folded in (e.g. & where)\n if (rule.selectors[0] && rule.selectors[0].isJustParentSelector()) {\n rsRules.splice(i--, 1);\n\n for (let j = 0; (subRule = rule.rules[j]); j++) {\n if (subRule instanceof Node) {\n subRule.copyVisibilityInfo(rule.visibilityInfo());\n if (!(subRule instanceof Declaration) || !subRule.variable) {\n rsRules.splice(++i, 0, subRule);\n }\n }\n }\n }\n }\n }\n\n // Pop the stack\n ctxFrames.shift();\n ctxSelectors.shift();\n\n if (context.mediaBlocks) {\n for (i = mediaBlockCount; i < context.mediaBlocks.length; i++) {\n context.mediaBlocks[i].bubbleSelectors(selectors);\n }\n }\n\n return ruleset;\n },\n\n evalImports(context) {\n const rules = this.rules;\n let i;\n let importRules;\n if (!rules) { return; }\n\n for (i = 0; i < rules.length; i++) {\n if (rules[i].type === 'Import') {\n importRules = rules[i].eval(context);\n if (importRules && (importRules.length || importRules.length === 0)) {\n rules.splice.apply(rules, [i, 1].concat(importRules));\n i += importRules.length - 1;\n } else {\n rules.splice(i, 1, importRules);\n }\n this.resetCache();\n }\n }\n },\n\n makeImportant() {\n const result = new Ruleset(this.selectors, this.rules.map(function (r) {\n if (r.makeImportant) {\n return r.makeImportant();\n } else {\n return r;\n }\n }), this.strictImports, this.visibilityInfo());\n\n return result;\n },\n\n matchArgs(args) {\n return !args || args.length === 0;\n },\n\n // lets you call a css selector with a guard\n matchCondition(args, context) {\n const lastSelector = this.selectors[this.selectors.length - 1];\n if (!lastSelector.evaldCondition) {\n return false;\n }\n if (lastSelector.condition &&\n !lastSelector.condition.eval(\n new contexts.Eval(context,\n context.frames))) {\n return false;\n }\n return true;\n },\n\n resetCache() {\n this._rulesets = null;\n this._variables = null;\n this._properties = null;\n this._lookups = {};\n },\n\n variables() {\n if (!this._variables) {\n this._variables = !this.rules ? {} : this.rules.reduce(function (hash, r) {\n if (r instanceof Declaration && r.variable === true) {\n hash[r.name] = r;\n }\n // when evaluating variables in an import statement, imports have not been eval'd\n // so we need to go inside import statements.\n // guard against root being a string (in the case of inlined less)\n if (r.type === 'Import' && r.root && r.root.variables) {\n const vars = r.root.variables();\n for (const name in vars) {\n // eslint-disable-next-line no-prototype-builtins\n if (vars.hasOwnProperty(name)) {\n hash[name] = r.root.variable(name);\n }\n }\n }\n return hash;\n }, {});\n }\n return this._variables;\n },\n\n properties() {\n if (!this._properties) {\n this._properties = !this.rules ? {} : this.rules.reduce(function (hash, r) {\n if (r instanceof Declaration && r.variable !== true) {\n const name = (r.name.length === 1) && (r.name[0] instanceof Keyword) ?\n r.name[0].value : r.name;\n // Properties don't overwrite as they can merge\n if (!hash[`$${name}`]) {\n hash[`$${name}`] = [ r ];\n }\n else {\n hash[`$${name}`].push(r);\n }\n }\n return hash;\n }, {});\n }\n return this._properties;\n },\n\n variable(name) {\n const decl = this.variables()[name];\n if (decl) {\n return this.parseValue(decl);\n }\n },\n\n property(name) {\n const decl = this.properties()[name];\n if (decl) {\n return this.parseValue(decl);\n }\n },\n\n lastDeclaration() {\n for (let i = this.rules.length; i > 0; i--) {\n const decl = this.rules[i - 1];\n if (decl instanceof Declaration) {\n return this.parseValue(decl);\n }\n }\n },\n\n parseValue(toParse) {\n const self = this;\n function transformDeclaration(decl) {\n if (decl.value instanceof Anonymous && !decl.parsed) {\n if (typeof decl.value.value === 'string') {\n new Parser(this.parse.context, this.parse.importManager, decl.fileInfo(), decl.value.getIndex()).parseNode(\n decl.value.value,\n ['value', 'important'],\n function(err, result) {\n if (err) {\n decl.parsed = true;\n }\n if (result) {\n decl.value = result[0];\n decl.important = result[1] || '';\n decl.parsed = true;\n }\n });\n } else {\n decl.parsed = true;\n }\n\n return decl;\n }\n else {\n return decl;\n }\n }\n if (!Array.isArray(toParse)) {\n return transformDeclaration.call(self, toParse);\n }\n else {\n const nodes = [];\n toParse.forEach(function(n) {\n nodes.push(transformDeclaration.call(self, n));\n });\n return nodes;\n }\n },\n\n rulesets() {\n if (!this.rules) { return []; }\n\n const filtRules = [];\n const rules = this.rules;\n let i;\n let rule;\n\n for (i = 0; (rule = rules[i]); i++) {\n if (rule.isRuleset) {\n filtRules.push(rule);\n }\n }\n\n return filtRules;\n },\n\n prependRule(rule) {\n const rules = this.rules;\n if (rules) {\n rules.unshift(rule);\n } else {\n this.rules = [ rule ];\n }\n this.setParent(rule, this);\n },\n\n find(selector, self, filter) {\n self = self || this;\n const rules = [];\n let match;\n let foundMixins;\n const key = selector.toCSS();\n\n if (key in this._lookups) { return this._lookups[key]; }\n\n this.rulesets().forEach(function (rule) {\n if (rule !== self) {\n for (let j = 0; j < rule.selectors.length; j++) {\n match = selector.match(rule.selectors[j]);\n if (match) {\n if (selector.elements.length > match) {\n if (!filter || filter(rule)) {\n foundMixins = rule.find(new Selector(selector.elements.slice(match)), self, filter);\n for (let i = 0; i < foundMixins.length; ++i) {\n foundMixins[i].path.push(rule);\n }\n Array.prototype.push.apply(rules, foundMixins);\n }\n } else {\n rules.push({ rule, path: []});\n }\n break;\n }\n }\n }\n });\n this._lookups[key] = rules;\n return rules;\n },\n\n genCSS(context, output) {\n let i;\n let j;\n const charsetRuleNodes = [];\n let ruleNodes = [];\n\n let // Line number debugging\n debugInfo;\n\n let rule;\n let path;\n\n context.tabLevel = (context.tabLevel || 0);\n\n if (!this.root) {\n context.tabLevel++;\n }\n\n const tabRuleStr = context.compress ? '' : Array(context.tabLevel + 1).join(' ');\n const tabSetStr = context.compress ? '' : Array(context.tabLevel).join(' ');\n let sep;\n\n let charsetNodeIndex = 0;\n let importNodeIndex = 0;\n for (i = 0; (rule = this.rules[i]); i++) {\n if (rule instanceof Comment) {\n if (importNodeIndex === i) {\n importNodeIndex++;\n }\n ruleNodes.push(rule);\n } else if (rule.isCharset && rule.isCharset()) {\n ruleNodes.splice(charsetNodeIndex, 0, rule);\n charsetNodeIndex++;\n importNodeIndex++;\n } else if (rule.type === 'Import') {\n ruleNodes.splice(importNodeIndex, 0, rule);\n importNodeIndex++;\n } else {\n ruleNodes.push(rule);\n }\n }\n ruleNodes = charsetRuleNodes.concat(ruleNodes);\n\n // If this is the root node, we don't render\n // a selector, or {}.\n if (!this.root) {\n debugInfo = getDebugInfo(context, this, tabSetStr);\n\n if (debugInfo) {\n output.add(debugInfo);\n output.add(tabSetStr);\n }\n\n const paths = this.paths;\n const pathCnt = paths.length;\n let pathSubCnt;\n\n sep = context.compress ? ',' : (`,\\n${tabSetStr}`);\n\n for (i = 0; i < pathCnt; i++) {\n path = paths[i];\n if (!(pathSubCnt = path.length)) { continue; }\n if (i > 0) { output.add(sep); }\n\n context.firstSelector = true;\n path[0].genCSS(context, output);\n\n context.firstSelector = false;\n for (j = 1; j < pathSubCnt; j++) {\n path[j].genCSS(context, output);\n }\n }\n\n output.add((context.compress ? '{' : ' {\\n') + tabRuleStr);\n }\n\n // Compile rules and rulesets\n for (i = 0; (rule = ruleNodes[i]); i++) {\n\n if (i + 1 === ruleNodes.length) {\n context.lastRule = true;\n }\n\n const currentLastRule = context.lastRule;\n if (rule.isRulesetLike(rule)) {\n context.lastRule = false;\n }\n\n if (rule.genCSS) {\n rule.genCSS(context, output);\n } else if (rule.value) {\n output.add(rule.value.toString());\n }\n\n context.lastRule = currentLastRule;\n\n if (!context.lastRule && rule.isVisible()) {\n output.add(context.compress ? '' : (`\\n${tabRuleStr}`));\n } else {\n context.lastRule = false;\n }\n }\n\n if (!this.root) {\n output.add((context.compress ? '}' : `\\n${tabSetStr}}`));\n context.tabLevel--;\n }\n\n if (!output.isEmpty() && !context.compress && this.firstRoot) {\n output.add('\\n');\n }\n },\n\n joinSelectors(paths, context, selectors) {\n for (let s = 0; s < selectors.length; s++) {\n this.joinSelector(paths, context, selectors[s]);\n }\n },\n\n joinSelector(paths, context, selector) {\n\n function createParenthesis(elementsToPak, originalElement) {\n let replacementParen, j;\n if (elementsToPak.length === 0) {\n replacementParen = new Paren(elementsToPak[0]);\n } else {\n const insideParent = new Array(elementsToPak.length);\n for (j = 0; j < elementsToPak.length; j++) {\n insideParent[j] = new Element(\n null,\n elementsToPak[j],\n originalElement.isVariable,\n originalElement._index,\n originalElement._fileInfo\n );\n }\n replacementParen = new Paren(new Selector(insideParent));\n }\n return replacementParen;\n }\n\n function createSelector(containedElement, originalElement) {\n let element, selector;\n element = new Element(null, containedElement, originalElement.isVariable, originalElement._index, originalElement._fileInfo);\n selector = new Selector([element]);\n return selector;\n }\n\n // joins selector path from `beginningPath` with selector path in `addPath`\n // `replacedElement` contains element that is being replaced by `addPath`\n // returns concatenated path\n function addReplacementIntoPath(beginningPath, addPath, replacedElement, originalSelector) {\n let newSelectorPath, lastSelector, newJoinedSelector;\n // our new selector path\n newSelectorPath = [];\n\n // construct the joined selector - if & is the first thing this will be empty,\n // if not newJoinedSelector will be the last set of elements in the selector\n if (beginningPath.length > 0) {\n newSelectorPath = utils.copyArray(beginningPath);\n lastSelector = newSelectorPath.pop();\n newJoinedSelector = originalSelector.createDerived(utils.copyArray(lastSelector.elements));\n }\n else {\n newJoinedSelector = originalSelector.createDerived([]);\n }\n\n if (addPath.length > 0) {\n // /deep/ is a CSS4 selector - (removed, so should deprecate)\n // that is valid without anything in front of it\n // so if the & does not have a combinator that is \"\" or \" \" then\n // and there is a combinator on the parent, then grab that.\n // this also allows + a { & .b { .a & { ... though not sure why you would want to do that\n let combinator = replacedElement.combinator;\n\n const parentEl = addPath[0].elements[0];\n if (combinator.emptyOrWhitespace && !parentEl.combinator.emptyOrWhitespace) {\n combinator = parentEl.combinator;\n }\n // join the elements so far with the first part of the parent\n newJoinedSelector.elements.push(new Element(\n combinator,\n parentEl.value,\n replacedElement.isVariable,\n replacedElement._index,\n replacedElement._fileInfo\n ));\n newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1));\n }\n\n // now add the joined selector - but only if it is not empty\n if (newJoinedSelector.elements.length !== 0) {\n newSelectorPath.push(newJoinedSelector);\n }\n\n // put together the parent selectors after the join (e.g. the rest of the parent)\n if (addPath.length > 1) {\n let restOfPath = addPath.slice(1);\n restOfPath = restOfPath.map(function (selector) {\n return selector.createDerived(selector.elements, []);\n });\n newSelectorPath = newSelectorPath.concat(restOfPath);\n }\n return newSelectorPath;\n }\n\n // joins selector path from `beginningPath` with every selector path in `addPaths` array\n // `replacedElement` contains element that is being replaced by `addPath`\n // returns array with all concatenated paths\n function addAllReplacementsIntoPath( beginningPath, addPaths, replacedElement, originalSelector, result) {\n let j;\n for (j = 0; j < beginningPath.length; j++) {\n const newSelectorPath = addReplacementIntoPath(beginningPath[j], addPaths, replacedElement, originalSelector);\n result.push(newSelectorPath);\n }\n return result;\n }\n\n function mergeElementsOnToSelectors(elements, selectors) {\n let i, sel;\n\n if (elements.length === 0) {\n return ;\n }\n if (selectors.length === 0) {\n selectors.push([ new Selector(elements) ]);\n return;\n }\n\n for (i = 0; (sel = selectors[i]); i++) {\n // if the previous thing in sel is a parent this needs to join on to it\n if (sel.length > 0) {\n sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements));\n }\n else {\n sel.push(new Selector(elements));\n }\n }\n }\n\n // replace all parent selectors inside `inSelector` by content of `context` array\n // resulting selectors are returned inside `paths` array\n // returns true if `inSelector` contained at least one parent selector\n function replaceParentSelector(paths, context, inSelector) {\n // The paths are [[Selector]]\n // The first list is a list of comma separated selectors\n // The inner list is a list of inheritance separated selectors\n // e.g.\n // .a, .b {\n // .c {\n // }\n // }\n // == [[.a] [.c]] [[.b] [.c]]\n //\n let i, j, k, currentElements, newSelectors, selectorsMultiplied, sel, el, hadParentSelector = false, length, lastSelector;\n function findNestedSelector(element) {\n let maybeSelector;\n if (!(element.value instanceof Paren)) {\n return null;\n }\n\n maybeSelector = element.value.value;\n if (!(maybeSelector instanceof Selector)) {\n return null;\n }\n\n return maybeSelector;\n }\n\n // the elements from the current selector so far\n currentElements = [];\n // the current list of new selectors to add to the path.\n // We will build it up. We initiate it with one empty selector as we \"multiply\" the new selectors\n // by the parents\n newSelectors = [\n []\n ];\n\n for (i = 0; (el = inSelector.elements[i]); i++) {\n // non parent reference elements just get added\n if (el.value !== '&') {\n const nestedSelector = findNestedSelector(el);\n if (nestedSelector !== null) {\n // merge the current list of non parent selector elements\n // on to the current list of selectors to add\n mergeElementsOnToSelectors(currentElements, newSelectors);\n\n const nestedPaths = [];\n let replaced;\n const replacedNewSelectors = [];\n replaced = replaceParentSelector(nestedPaths, context, nestedSelector);\n hadParentSelector = hadParentSelector || replaced;\n // the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors\n for (k = 0; k < nestedPaths.length; k++) {\n const replacementSelector = createSelector(createParenthesis(nestedPaths[k], el), el);\n addAllReplacementsIntoPath(newSelectors, [replacementSelector], el, inSelector, replacedNewSelectors);\n }\n newSelectors = replacedNewSelectors;\n currentElements = [];\n } else {\n currentElements.push(el);\n }\n\n } else {\n hadParentSelector = true;\n // the new list of selectors to add\n selectorsMultiplied = [];\n\n // merge the current list of non parent selector elements\n // on to the current list of selectors to add\n mergeElementsOnToSelectors(currentElements, newSelectors);\n\n // loop through our current selectors\n for (j = 0; j < newSelectors.length; j++) {\n sel = newSelectors[j];\n // if we don't have any parent paths, the & might be in a mixin so that it can be used\n // whether there are parents or not\n if (context.length === 0) {\n // the combinator used on el should now be applied to the next element instead so that\n // it is not lost\n if (sel.length > 0) {\n sel[0].elements.push(new Element(el.combinator, '', el.isVariable, el._index, el._fileInfo));\n }\n selectorsMultiplied.push(sel);\n }\n else {\n // and the parent selectors\n for (k = 0; k < context.length; k++) {\n // We need to put the current selectors\n // then join the last selector's elements on to the parents selectors\n const newSelectorPath = addReplacementIntoPath(sel, context[k], el, inSelector);\n // add that to our new set of selectors\n selectorsMultiplied.push(newSelectorPath);\n }\n }\n }\n\n // our new selectors has been multiplied, so reset the state\n newSelectors = selectorsMultiplied;\n currentElements = [];\n }\n }\n\n // if we have any elements left over (e.g. .a& .b == .b)\n // add them on to all the current selectors\n mergeElementsOnToSelectors(currentElements, newSelectors);\n\n for (i = 0; i < newSelectors.length; i++) {\n length = newSelectors[i].length;\n if (length > 0) {\n paths.push(newSelectors[i]);\n lastSelector = newSelectors[i][length - 1];\n newSelectors[i][length - 1] = lastSelector.createDerived(lastSelector.elements, inSelector.extendList);\n }\n }\n\n return hadParentSelector;\n }\n\n function deriveSelector(visibilityInfo, deriveFrom) {\n const newSelector = deriveFrom.createDerived(deriveFrom.elements, deriveFrom.extendList, deriveFrom.evaldCondition);\n newSelector.copyVisibilityInfo(visibilityInfo);\n return newSelector;\n }\n\n // joinSelector code follows\n let i, newPaths, hadParentSelector;\n\n newPaths = [];\n hadParentSelector = replaceParentSelector(newPaths, context, selector);\n\n if (!hadParentSelector) {\n if (context.length > 0) {\n newPaths = [];\n for (i = 0; i < context.length; i++) {\n\n const concatenated = context[i].map(deriveSelector.bind(this, selector.visibilityInfo()));\n\n concatenated.push(selector);\n newPaths.push(concatenated);\n }\n }\n else {\n newPaths = [[selector]];\n }\n }\n\n for (i = 0; i < newPaths.length; i++) {\n paths.push(newPaths[i]);\n }\n\n }\n});\n\nexport default Ruleset;\n","import Node from './node';\nimport unitConversions from '../data/unit-conversions';\nimport * as utils from '../utils';\n\nconst Unit = function(numerator, denominator, backupUnit) {\n this.numerator = numerator ? utils.copyArray(numerator).sort() : [];\n this.denominator = denominator ? utils.copyArray(denominator).sort() : [];\n if (backupUnit) {\n this.backupUnit = backupUnit;\n } else if (numerator && numerator.length) {\n this.backupUnit = numerator[0];\n }\n};\n\nUnit.prototype = Object.assign(new Node(), {\n type: 'Unit',\n\n clone() {\n return new Unit(utils.copyArray(this.numerator), utils.copyArray(this.denominator), this.backupUnit);\n },\n\n genCSS(context, output) {\n // Dimension checks the unit is singular and throws an error if in strict math mode.\n const strictUnits = context && context.strictUnits;\n if (this.numerator.length === 1) {\n output.add(this.numerator[0]); // the ideal situation\n } else if (!strictUnits && this.backupUnit) {\n output.add(this.backupUnit);\n } else if (!strictUnits && this.denominator.length) {\n output.add(this.denominator[0]);\n }\n },\n\n toString() {\n let i, returnStr = this.numerator.join('*');\n for (i = 0; i < this.denominator.length; i++) {\n returnStr += `/${this.denominator[i]}`;\n }\n return returnStr;\n },\n\n compare(other) {\n return this.is(other.toString()) ? 0 : undefined;\n },\n\n is(unitString) {\n return this.toString().toUpperCase() === unitString.toUpperCase();\n },\n\n isLength() {\n return RegExp('^(px|em|ex|ch|rem|in|cm|mm|pc|pt|ex|vw|vh|vmin|vmax)$', 'gi').test(this.toCSS());\n },\n\n isEmpty() {\n return this.numerator.length === 0 && this.denominator.length === 0;\n },\n\n isSingular() {\n return this.numerator.length <= 1 && this.denominator.length === 0;\n },\n\n map(callback) {\n let i;\n\n for (i = 0; i < this.numerator.length; i++) {\n this.numerator[i] = callback(this.numerator[i], false);\n }\n\n for (i = 0; i < this.denominator.length; i++) {\n this.denominator[i] = callback(this.denominator[i], true);\n }\n },\n\n usedUnits() {\n let group;\n const result = {};\n let mapUnit;\n let groupName;\n\n mapUnit = function (atomicUnit) {\n // eslint-disable-next-line no-prototype-builtins\n if (group.hasOwnProperty(atomicUnit) && !result[groupName]) {\n result[groupName] = atomicUnit;\n }\n\n return atomicUnit;\n };\n\n for (groupName in unitConversions) {\n // eslint-disable-next-line no-prototype-builtins\n if (unitConversions.hasOwnProperty(groupName)) {\n group = unitConversions[groupName];\n\n this.map(mapUnit);\n }\n }\n\n return result;\n },\n\n cancel() {\n const counter = {};\n let atomicUnit;\n let i;\n\n for (i = 0; i < this.numerator.length; i++) {\n atomicUnit = this.numerator[i];\n counter[atomicUnit] = (counter[atomicUnit] || 0) + 1;\n }\n\n for (i = 0; i < this.denominator.length; i++) {\n atomicUnit = this.denominator[i];\n counter[atomicUnit] = (counter[atomicUnit] || 0) - 1;\n }\n\n this.numerator = [];\n this.denominator = [];\n\n for (atomicUnit in counter) {\n // eslint-disable-next-line no-prototype-builtins\n if (counter.hasOwnProperty(atomicUnit)) {\n const count = counter[atomicUnit];\n\n if (count > 0) {\n for (i = 0; i < count; i++) {\n this.numerator.push(atomicUnit);\n }\n } else if (count < 0) {\n for (i = 0; i < -count; i++) {\n this.denominator.push(atomicUnit);\n }\n }\n }\n }\n\n this.numerator.sort();\n this.denominator.sort();\n }\n});\n\nexport default Unit;\n","/* eslint-disable no-prototype-builtins */\nimport Node from './node';\nimport unitConversions from '../data/unit-conversions';\nimport Unit from './unit';\nimport Color from './color';\n\n//\n// A number with a unit\n//\nconst Dimension = function(value, unit) {\n this.value = parseFloat(value);\n if (isNaN(this.value)) {\n throw new Error('Dimension is not a number.');\n }\n this.unit = (unit && unit instanceof Unit) ? unit :\n new Unit(unit ? [unit] : undefined);\n this.setParent(this.unit, this);\n};\n\nDimension.prototype = Object.assign(new Node(), {\n type: 'Dimension',\n\n accept(visitor) {\n this.unit = visitor.visit(this.unit);\n },\n\n // remove when Nodes have JSDoc types\n // eslint-disable-next-line no-unused-vars\n eval(context) {\n return this;\n },\n\n toColor() {\n return new Color([this.value, this.value, this.value]);\n },\n\n genCSS(context, output) {\n if ((context && context.strictUnits) && !this.unit.isSingular()) {\n throw new Error(`Multiple units in dimension. Correct the units or use the unit function. Bad unit: ${this.unit.toString()}`);\n }\n\n const value = this.fround(context, this.value);\n let strValue = String(value);\n\n if (value !== 0 && value < 0.000001 && value > -0.000001) {\n // would be output 1e-6 etc.\n strValue = value.toFixed(20).replace(/0+$/, '');\n }\n\n if (context && context.compress) {\n // Zero values doesn't need a unit\n if (value === 0 && this.unit.isLength()) {\n output.add(strValue);\n return;\n }\n\n // Float values doesn't need a leading zero\n if (value > 0 && value < 1) {\n strValue = (strValue).substr(1);\n }\n }\n\n output.add(strValue);\n this.unit.genCSS(context, output);\n },\n\n // In an operation between two Dimensions,\n // we default to the first Dimension's unit,\n // so `1px + 2` will yield `3px`.\n operate(context, op, other) {\n /* jshint noempty:false */\n let value = this._operate(context, op, this.value, other.value);\n let unit = this.unit.clone();\n\n if (op === '+' || op === '-') {\n if (unit.numerator.length === 0 && unit.denominator.length === 0) {\n unit = other.unit.clone();\n if (this.unit.backupUnit) {\n unit.backupUnit = this.unit.backupUnit;\n }\n } else if (other.unit.numerator.length === 0 && unit.denominator.length === 0) {\n // do nothing\n } else {\n other = other.convertTo(this.unit.usedUnits());\n\n if (context.strictUnits && other.unit.toString() !== unit.toString()) {\n throw new Error('Incompatible units. Change the units or use the unit function. '\n + `Bad units: '${unit.toString()}' and '${other.unit.toString()}'.`);\n }\n\n value = this._operate(context, op, this.value, other.value);\n }\n } else if (op === '*') {\n unit.numerator = unit.numerator.concat(other.unit.numerator).sort();\n unit.denominator = unit.denominator.concat(other.unit.denominator).sort();\n unit.cancel();\n } else if (op === '/') {\n unit.numerator = unit.numerator.concat(other.unit.denominator).sort();\n unit.denominator = unit.denominator.concat(other.unit.numerator).sort();\n unit.cancel();\n }\n return new Dimension(value, unit);\n },\n\n compare(other) {\n let a, b;\n\n if (!(other instanceof Dimension)) {\n return undefined;\n }\n\n if (this.unit.isEmpty() || other.unit.isEmpty()) {\n a = this;\n b = other;\n } else {\n a = this.unify();\n b = other.unify();\n if (a.unit.compare(b.unit) !== 0) {\n return undefined;\n }\n }\n\n return Node.numericCompare(a.value, b.value);\n },\n\n unify() {\n return this.convertTo({ length: 'px', duration: 's', angle: 'rad' });\n },\n\n convertTo(conversions) {\n let value = this.value;\n const unit = this.unit.clone();\n let i;\n let groupName;\n let group;\n let targetUnit;\n let derivedConversions = {};\n let applyUnit;\n\n if (typeof conversions === 'string') {\n for (i in unitConversions) {\n if (unitConversions[i].hasOwnProperty(conversions)) {\n derivedConversions = {};\n derivedConversions[i] = conversions;\n }\n }\n conversions = derivedConversions;\n }\n applyUnit = function (atomicUnit, denominator) {\n if (group.hasOwnProperty(atomicUnit)) {\n if (denominator) {\n value = value / (group[atomicUnit] / group[targetUnit]);\n } else {\n value = value * (group[atomicUnit] / group[targetUnit]);\n }\n\n return targetUnit;\n }\n\n return atomicUnit;\n };\n\n for (groupName in conversions) {\n if (conversions.hasOwnProperty(groupName)) {\n targetUnit = conversions[groupName];\n group = unitConversions[groupName];\n\n unit.map(applyUnit);\n }\n }\n\n unit.cancel();\n\n return new Dimension(value, unit);\n }\n});\n\nexport default Dimension;\n","import Node from './node';\nimport Paren from './paren';\nimport Comment from './comment';\nimport Dimension from './dimension';\nimport Anonymous from './anonymous';\n\nconst Expression = function(value, noSpacing) {\n this.value = value;\n this.noSpacing = noSpacing;\n if (!value) {\n throw new Error('Expression requires an array parameter');\n }\n};\n\nExpression.prototype = Object.assign(new Node(), {\n type: 'Expression',\n\n accept(visitor) {\n this.value = visitor.visitArray(this.value);\n },\n\n eval(context) {\n const noSpacing = this.noSpacing;\n let returnValue;\n const mathOn = context.isMathOn();\n const inParenthesis = this.parens;\n\n let doubleParen = false;\n if (inParenthesis) {\n context.inParenthesis();\n }\n if (this.value.length > 1) {\n returnValue = new Expression(this.value.map(function (e) {\n if (!e.eval) {\n return e;\n }\n return e.eval(context);\n }), this.noSpacing);\n } else if (this.value.length === 1) {\n if (this.value[0].parens && !this.value[0].parensInOp && !context.inCalc) {\n doubleParen = true;\n }\n returnValue = this.value[0].eval(context);\n } else {\n returnValue = this;\n }\n if (inParenthesis) {\n context.outOfParenthesis();\n }\n if (this.parens && this.parensInOp && !mathOn && !doubleParen\n && (!(returnValue instanceof Dimension))) {\n returnValue = new Paren(returnValue);\n }\n returnValue.noSpacing = returnValue.noSpacing || noSpacing;\n return returnValue;\n },\n\n genCSS(context, output) {\n for (let i = 0; i < this.value.length; i++) {\n this.value[i].genCSS(context, output);\n if (!this.noSpacing && i + 1 < this.value.length) {\n if (i + 1 < this.value.length && !(this.value[i + 1] instanceof Anonymous) ||\n this.value[i + 1] instanceof Anonymous && this.value[i + 1].value !== ',') {\n output.add(' ');\n }\n }\n }\n },\n\n throwAwayComments() {\n this.value = this.value.filter(function(v) {\n return !(v instanceof Comment);\n });\n }\n});\n\nexport default Expression;\n","import Ruleset from './ruleset';\nimport Value from './value';\nimport Selector from './selector';\nimport Anonymous from './anonymous';\nimport Expression from './expression';\nimport * as utils from '../utils';\n\nconst NestableAtRulePrototype = {\n\n isRulesetLike() {\n return true;\n },\n\n accept(visitor) {\n if (this.features) {\n this.features = visitor.visit(this.features);\n }\n if (this.rules) {\n this.rules = visitor.visitArray(this.rules);\n }\n },\n\n evalFunction: function () {\n if (!this.features || !Array.isArray(this.features.value) || this.features.value.length < 1) {\n return;\n }\n\n const exprValues = this.features.value;\n let expr, paren;\n\n for (let index = 0; index < exprValues.length; ++index) {\n expr = exprValues[index];\n\n if (expr.type === 'Keyword' && index + 1 < exprValues.length && (expr.noSpacing || expr.noSpacing == null)) {\n paren = exprValues[index + 1];\n \n if (paren.type === 'Paren' && paren.noSpacing) {\n exprValues[index]= new Expression([expr, paren]);\n exprValues.splice(index + 1, 1);\n exprValues[index].noSpacing = true;\n }\n }\n }\n },\n\n evalTop(context) {\n this.evalFunction();\n\n let result = this;\n\n // Render all dependent Media blocks.\n if (context.mediaBlocks.length > 1) {\n const selectors = (new Selector([], null, null, this.getIndex(), this.fileInfo())).createEmptySelectors();\n result = new Ruleset(selectors, context.mediaBlocks);\n result.multiMedia = true;\n result.copyVisibilityInfo(this.visibilityInfo());\n this.setParent(result, this);\n }\n\n delete context.mediaBlocks;\n delete context.mediaPath;\n\n return result;\n },\n\n evalNested(context) {\n this.evalFunction();\n\n let i;\n let value;\n const path = context.mediaPath.concat([this]);\n\n // Extract the media-query conditions separated with `,` (OR).\n for (i = 0; i < path.length; i++) {\n if (path[i].type !== this.type) { \n context.mediaBlocks.splice(i, 1); \n \n return this; \n }\n \n value = path[i].features instanceof Value ?\n path[i].features.value : path[i].features;\n path[i] = Array.isArray(value) ? value : [value];\n }\n\n // Trace all permutations to generate the resulting media-query.\n //\n // (a, b and c) with nested (d, e) ->\n // a and d\n // a and e\n // b and c and d\n // b and c and e\n this.features = new Value(this.permute(path).map(path => {\n path = path.map(fragment => fragment.toCSS ? fragment : new Anonymous(fragment));\n\n for (i = path.length - 1; i > 0; i--) {\n path.splice(i, 0, new Anonymous('and'));\n }\n\n return new Expression(path);\n }));\n this.setParent(this.features, this);\n\n // Fake a tree-node that doesn't output anything.\n return new Ruleset([], []);\n },\n\n permute(arr) {\n if (arr.length === 0) {\n return [];\n } else if (arr.length === 1) {\n return arr[0];\n } else {\n const result = [];\n const rest = this.permute(arr.slice(1));\n for (let i = 0; i < rest.length; i++) {\n for (let j = 0; j < arr[0].length; j++) {\n result.push([arr[0][j]].concat(rest[i]));\n }\n }\n return result;\n }\n },\n\n bubbleSelectors(selectors) {\n if (!selectors) {\n return;\n }\n this.rules = [new Ruleset(utils.copyArray(selectors), [this.rules[0]])];\n this.setParent(this.rules, this);\n }\n};\n\nexport default NestableAtRulePrototype;\n","import Node from './node';\nimport Selector from './selector';\nimport Ruleset from './ruleset';\nimport Anonymous from './anonymous';\nimport NestableAtRulePrototype from './nested-at-rule';\n\nconst AtRule = function(\n name,\n value,\n rules,\n index,\n currentFileInfo,\n debugInfo,\n isRooted,\n visibilityInfo\n) {\n let i;\n var selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors();\n\n this.name = name;\n this.value = (value instanceof Node) ? value : (value ? new Anonymous(value) : value);\n if (rules) {\n if (Array.isArray(rules)) {\n const allDeclarations = this.declarationsBlock(rules);\n \n let allRulesetDeclarations = true;\n rules.forEach(rule => {\n if (rule.type === 'Ruleset' && rule.rules) allRulesetDeclarations = allRulesetDeclarations && this.declarationsBlock(rule.rules, true);\n });\n\n if (allDeclarations && !isRooted) {\n this.simpleBlock = true;\n this.declarations = rules;\n } else if (allRulesetDeclarations && rules.length === 1 && !isRooted && !value) {\n this.simpleBlock = true;\n this.declarations = rules[0].rules ? rules[0].rules : rules;\n } else {\n this.rules = rules;\n }\n } else {\n const allDeclarations = this.declarationsBlock(rules.rules);\n \n if (allDeclarations && !isRooted && !value) {\n this.simpleBlock = true;\n this.declarations = rules.rules;\n } else {\n this.rules = [rules];\n this.rules[0].selectors = (new Selector([], null, null, index, currentFileInfo)).createEmptySelectors();\n }\n }\n if (!this.simpleBlock) {\n for (i = 0; i < this.rules.length; i++) {\n this.rules[i].allowImports = true;\n }\n }\n this.setParent(selectors, this);\n this.setParent(this.rules, this);\n }\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.debugInfo = debugInfo;\n this.isRooted = isRooted || false;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n}\n\nAtRule.prototype = Object.assign(new Node(), {\n type: 'AtRule',\n\n ...NestableAtRulePrototype,\n\n declarationsBlock(rules, mergeable = false) {\n if (!mergeable) {\n return rules.filter(function (node) { return (node.type === 'Declaration' || node.type === 'Comment') && !node.merge}).length === rules.length;\n } else {\n return rules.filter(function (node) { return (node.type === 'Declaration' || node.type === 'Comment'); }).length === rules.length;\n }\n },\n\n keywordList(rules) {\n if (!Array.isArray(rules)) {\n return false;\n } else { \n return rules.filter(function (node) { return (node.type === 'Keyword' || node.type === 'Comment'); }).length === rules.length;\n }\n },\n\n accept(visitor) {\n const value = this.value, rules = this.rules, declarations = this.declarations;\n\n if (rules) {\n this.rules = visitor.visitArray(rules);\n } else if (declarations) {\n this.declarations = visitor.visitArray(declarations); \n }\n if (value) {\n this.value = visitor.visit(value);\n }\n },\n\n isRulesetLike() {\n return this.rules || !this.isCharset();\n },\n\n isCharset() {\n return '@charset' === this.name;\n },\n\n genCSS(context, output) {\n const value = this.value, rules = this.rules || this.declarations;\n output.add(this.name, this.fileInfo(), this.getIndex());\n if (value) {\n output.add(' ');\n value.genCSS(context, output);\n }\n if (this.simpleBlock) {\n this.outputRuleset(context, output, this.declarations);\n } else if (rules) {\n this.outputRuleset(context, output, rules);\n } else {\n output.add(';');\n }\n },\n\n eval(context) {\n let mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules || this.declarations;\n \n // media stored inside other atrule should not bubble over it\n // backpup media bubbling information\n mediaPathBackup = context.mediaPath;\n mediaBlocksBackup = context.mediaBlocks;\n // deleted media bubbling information\n context.mediaPath = [];\n context.mediaBlocks = [];\n\n if (value) {\n value = value.eval(context);\n if (value.value && this.keywordList(value.value)) {\n value = new Anonymous(value.value.map(keyword => keyword.value).join(', '), this.getIndex(), this.fileInfo());\n }\n }\n\n if (rules) {\n rules = this.evalRoot(context, rules);\n }\n if (Array.isArray(rules) && rules[0].rules && Array.isArray(rules[0].rules) && rules[0].rules.length) {\n const allMergeableDeclarations = this.declarationsBlock(rules[0].rules, true);\n if (allMergeableDeclarations && !this.isRooted && !value) {\n var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;\n mergeRules(rules[0].rules);\n rules = rules[0].rules;\n rules.forEach(rule => rule.merge = false);\n }\n }\n if (this.simpleBlock && rules) {\n rules[0].functionRegistry = context.frames[0].functionRegistry.inherit();\n rules = rules.map(function (rule) { return rule.eval(context); });\n }\n\n // restore media bubbling information\n context.mediaPath = mediaPathBackup;\n context.mediaBlocks = mediaBlocksBackup;\n return new AtRule(this.name, value, rules, this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo());\n },\n\n evalRoot(context, rules) {\n let ampersandCount = 0;\n let noAmpersandCount = 0;\n let noAmpersands = true;\n let allAmpersands = false;\n\n if (!this.simpleBlock) {\n rules = [rules[0].eval(context)];\n }\n\n let precedingSelectors = [];\n if (context.frames.length > 0) {\n for (let index = 0; index < context.frames.length; index++) {\n const frame = context.frames[index];\n if (\n frame.type === 'Ruleset' &&\n frame.rules &&\n frame.rules.length > 0\n ) {\n if (frame && !frame.root && frame.selectors && frame.selectors.length > 0) {\n precedingSelectors = precedingSelectors.concat(frame.selectors);\n }\n }\n if (precedingSelectors.length > 0) {\n let value = '';\n const output = { add: function (s) { value += s; } };\n for (let i = 0; i < precedingSelectors.length; i++) {\n precedingSelectors[i].genCSS(context, output);\n }\n if (/^&+$/.test(value.replace(/\\s+/g, ''))) {\n noAmpersands = false;\n noAmpersandCount++;\n } else {\n allAmpersands = false;\n ampersandCount++;\n }\n }\n }\n }\n\n const mixedAmpersands = ampersandCount > 0 && noAmpersandCount > 0 && !allAmpersands && !noAmpersands;\n if (\n (this.isRooted && ampersandCount > 0 && noAmpersandCount === 0 && !allAmpersands && noAmpersands)\n || !mixedAmpersands\n ) {\n rules[0].root = true;\n }\n return rules;\n },\n\n variable(name) {\n if (this.rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n return Ruleset.prototype.variable.call(this.rules[0], name);\n }\n },\n\n find() {\n if (this.rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n return Ruleset.prototype.find.apply(this.rules[0], arguments);\n }\n },\n\n rulesets() {\n if (this.rules) {\n // assuming that there is only one rule at this point - that is how parser constructs the rule\n return Ruleset.prototype.rulesets.apply(this.rules[0]);\n }\n },\n\n outputRuleset(context, output, rules) {\n const ruleCnt = rules.length;\n let i;\n context.tabLevel = (context.tabLevel | 0) + 1;\n\n // Compressed\n if (context.compress) {\n output.add('{');\n for (i = 0; i < ruleCnt; i++) {\n rules[i].genCSS(context, output);\n }\n output.add('}');\n context.tabLevel--;\n return;\n }\n\n // Non-compressed\n const tabSetStr = `\\n${Array(context.tabLevel).join(' ')}`, tabRuleStr = `${tabSetStr} `;\n if (!ruleCnt) {\n output.add(` {${tabSetStr}}`);\n } else {\n output.add(` {${tabRuleStr}`);\n rules[0].genCSS(context, output);\n for (i = 1; i < ruleCnt; i++) {\n output.add(tabRuleStr);\n rules[i].genCSS(context, output);\n }\n output.add(`${tabSetStr}}`);\n }\n\n context.tabLevel--;\n }\n});\n\nexport default AtRule;\n","import Node from './node';\nimport contexts from '../contexts';\nimport * as utils from '../utils';\n\nconst DetachedRuleset = function(ruleset, frames) {\n this.ruleset = ruleset;\n this.frames = frames;\n this.setParent(this.ruleset, this);\n};\n\nDetachedRuleset.prototype = Object.assign(new Node(), {\n type: 'DetachedRuleset',\n evalFirst: true,\n\n accept(visitor) {\n this.ruleset = visitor.visit(this.ruleset);\n },\n\n eval(context) {\n const frames = this.frames || utils.copyArray(context.frames);\n return new DetachedRuleset(this.ruleset, frames);\n },\n\n callEval(context) {\n return this.ruleset.eval(this.frames ? new contexts.Eval(context, this.frames.concat(context.frames)) : context);\n }\n});\n\nexport default DetachedRuleset;\n","import Node from './node';\nimport Color from './color';\nimport Dimension from './dimension';\nimport * as Constants from '../constants';\nconst MATH = Constants.Math;\n\n\nconst Operation = function(op, operands, isSpaced) {\n this.op = op.trim();\n this.operands = operands;\n this.isSpaced = isSpaced;\n};\n\nOperation.prototype = Object.assign(new Node(), {\n type: 'Operation',\n\n accept(visitor) {\n this.operands = visitor.visitArray(this.operands);\n },\n\n eval(context) {\n let a = this.operands[0].eval(context), b = this.operands[1].eval(context), op;\n\n if (context.isMathOn(this.op)) {\n op = this.op === './' ? '/' : this.op;\n if (a instanceof Dimension && b instanceof Color) {\n a = a.toColor();\n }\n if (b instanceof Dimension && a instanceof Color) {\n b = b.toColor();\n }\n if (!a.operate || !b.operate) {\n if (\n (a instanceof Operation || b instanceof Operation)\n && a.op === '/' && context.math === MATH.PARENS_DIVISION\n ) {\n return new Operation(this.op, [a, b], this.isSpaced);\n }\n throw { type: 'Operation',\n message: 'Operation on an invalid type' };\n }\n\n return a.operate(context, op, b);\n } else {\n return new Operation(this.op, [a, b], this.isSpaced);\n }\n },\n\n genCSS(context, output) {\n this.operands[0].genCSS(context, output);\n if (this.isSpaced) {\n output.add(' ');\n }\n output.add(this.op);\n if (this.isSpaced) {\n output.add(' ');\n }\n this.operands[1].genCSS(context, output);\n }\n});\n\nexport default Operation;\n","import Expression from '../tree/expression';\n\nclass functionCaller {\n constructor(name, context, index, currentFileInfo) {\n this.name = name.toLowerCase();\n this.index = index;\n this.context = context;\n this.currentFileInfo = currentFileInfo;\n\n this.func = context.frames[0].functionRegistry.get(this.name);\n }\n\n isValid() {\n return Boolean(this.func);\n }\n\n call(args) {\n if (!(Array.isArray(args))) {\n args = [args];\n }\n const evalArgs = this.func.evalArgs;\n if (evalArgs !== false) {\n args = args.map(a => a.eval(this.context));\n }\n const commentFilter = item => !(item.type === 'Comment');\n\n // This code is terrible and should be replaced as per this issue...\n // https://github.com/less/less.js/issues/2477\n args = args\n .filter(commentFilter)\n .map(item => {\n if (item.type === 'Expression') {\n const subNodes = item.value.filter(commentFilter);\n if (subNodes.length === 1) {\n // https://github.com/less/less.js/issues/3616\n if (item.parens && subNodes[0].op === '/') {\n return item;\n }\n return subNodes[0];\n } else {\n return new Expression(subNodes);\n }\n }\n return item;\n });\n\n if (evalArgs === false) {\n return this.func(this.context, ...args);\n }\n\n return this.func(...args);\n }\n}\n\nexport default functionCaller;\n","import Node from './node';\nimport Anonymous from './anonymous';\nimport FunctionCaller from '../functions/function-caller';\n\n//\n// A function call node.\n//\nconst Call = function(name, args, index, currentFileInfo) {\n this.name = name;\n this.args = args;\n this.calc = name === 'calc';\n this._index = index;\n this._fileInfo = currentFileInfo;\n}\n\nCall.prototype = Object.assign(new Node(), {\n type: 'Call',\n\n accept(visitor) {\n if (this.args) {\n this.args = visitor.visitArray(this.args);\n }\n },\n\n //\n // When evaluating a function call,\n // we either find the function in the functionRegistry,\n // in which case we call it, passing the evaluated arguments,\n // if this returns null or we cannot find the function, we\n // simply print it out as it appeared originally [2].\n //\n // The reason why we evaluate the arguments, is in the case where\n // we try to pass a variable to a function, like: `saturate(@color)`.\n // The function should receive the value, not the variable.\n //\n eval(context) {\n /**\n * Turn off math for calc(), and switch back on for evaluating nested functions\n */\n const currentMathContext = context.mathOn;\n context.mathOn = !this.calc;\n if (this.calc || context.inCalc) {\n context.enterCalc();\n }\n\n const exitCalc = () => {\n if (this.calc || context.inCalc) {\n context.exitCalc();\n }\n context.mathOn = currentMathContext;\n };\n\n let result;\n const funcCaller = new FunctionCaller(this.name, context, this.getIndex(), this.fileInfo());\n\n if (funcCaller.isValid()) {\n try {\n result = funcCaller.call(this.args);\n exitCalc();\n } catch (e) {\n // eslint-disable-next-line no-prototype-builtins\n if (e.hasOwnProperty('line') && e.hasOwnProperty('column')) {\n throw e;\n }\n throw { \n type: e.type || 'Runtime',\n message: `Error evaluating function \\`${this.name}\\`${e.message ? `: ${e.message}` : ''}`,\n index: this.getIndex(), \n filename: this.fileInfo().filename,\n line: e.lineNumber,\n column: e.columnNumber\n };\n }\n }\n\n if (result !== null && result !== undefined) {\n // Results that that are not nodes are cast as Anonymous nodes\n // Falsy values or booleans are returned as empty nodes\n if (!(result instanceof Node)) {\n if (!result || result === true) {\n result = new Anonymous(null); \n }\n else {\n result = new Anonymous(result.toString()); \n }\n \n }\n result._index = this._index;\n result._fileInfo = this._fileInfo;\n return result;\n }\n\n const args = this.args.map(a => a.eval(context));\n exitCalc();\n\n return new Call(this.name, args, this.getIndex(), this.fileInfo());\n },\n\n genCSS(context, output) {\n output.add(`${this.name}(`, this.fileInfo(), this.getIndex());\n\n for (let i = 0; i < this.args.length; i++) {\n this.args[i].genCSS(context, output);\n if (i + 1 < this.args.length) {\n output.add(', ');\n }\n }\n\n output.add(')');\n }\n});\n\nexport default Call;\n","import Node from './node';\nimport Call from './call';\n\nconst Variable = function(name, index, currentFileInfo) {\n this.name = name;\n this._index = index;\n this._fileInfo = currentFileInfo;\n};\n\nVariable.prototype = Object.assign(new Node(), {\n type: 'Variable',\n\n eval(context) {\n let variable, name = this.name;\n\n if (name.indexOf('@@') === 0) {\n name = `@${new Variable(name.slice(1), this.getIndex(), this.fileInfo()).eval(context).value}`;\n }\n\n if (this.evaluating) {\n throw { type: 'Name',\n message: `Recursive variable definition for ${name}`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n\n this.evaluating = true;\n\n variable = this.find(context.frames, function (frame) {\n const v = frame.variable(name);\n if (v) {\n if (v.important) {\n const importantScope = context.importantScope[context.importantScope.length - 1];\n importantScope.important = v.important;\n }\n // If in calc, wrap vars in a function call to cascade evaluate args first\n if (context.inCalc) {\n return (new Call('_SELF', [v.value])).eval(context);\n }\n else {\n return v.value.eval(context);\n }\n }\n });\n if (variable) {\n this.evaluating = false;\n return variable;\n } else {\n throw { type: 'Name',\n message: `variable ${name} is undefined`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n },\n\n find(obj, fun) {\n for (let i = 0, r; i < obj.length; i++) {\n r = fun.call(obj, obj[i]);\n if (r) { return r; }\n }\n return null;\n }\n});\n\nexport default Variable;\n","import Node from './node';\nimport Declaration from './declaration';\n\nconst Property = function(name, index, currentFileInfo) {\n this.name = name;\n this._index = index;\n this._fileInfo = currentFileInfo;\n};\n\nProperty.prototype = Object.assign(new Node(), {\n type: 'Property',\n\n eval(context) {\n let property;\n const name = this.name;\n // TODO: shorten this reference\n const mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;\n\n if (this.evaluating) {\n throw { type: 'Name',\n message: `Recursive property reference for ${name}`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n\n this.evaluating = true;\n\n property = this.find(context.frames, function (frame) {\n let v;\n const vArr = frame.property(name);\n if (vArr) {\n for (let i = 0; i < vArr.length; i++) {\n v = vArr[i];\n\n vArr[i] = new Declaration(v.name,\n v.value,\n v.important,\n v.merge,\n v.index,\n v.currentFileInfo,\n v.inline,\n v.variable\n );\n }\n mergeRules(vArr);\n\n v = vArr[vArr.length - 1];\n if (v.important) {\n const importantScope = context.importantScope[context.importantScope.length - 1];\n importantScope.important = v.important;\n }\n v = v.value.eval(context);\n return v;\n }\n });\n if (property) {\n this.evaluating = false;\n return property;\n } else {\n throw { type: 'Name',\n message: `Property '${name}' is undefined`,\n filename: this.currentFileInfo.filename,\n index: this.index };\n }\n },\n\n find(obj, fun) {\n for (let i = 0, r; i < obj.length; i++) {\n r = fun.call(obj, obj[i]);\n if (r) { return r; }\n }\n return null;\n }\n});\n\nexport default Property;\n","import Node from './node';\n\nconst Attribute = function(key, op, value, cif) {\n this.key = key;\n this.op = op;\n this.value = value;\n this.cif = cif;\n}\n\nAttribute.prototype = Object.assign(new Node(), {\n type: 'Attribute',\n\n eval(context) {\n return new Attribute(\n this.key.eval ? this.key.eval(context) : this.key,\n this.op,\n (this.value && this.value.eval) ? this.value.eval(context) : this.value,\n this.cif\n );\n },\n\n genCSS(context, output) {\n output.add(this.toCSS(context));\n },\n\n toCSS(context) {\n let value = this.key.toCSS ? this.key.toCSS(context) : this.key;\n\n if (this.op) {\n value += this.op;\n value += (this.value.toCSS ? this.value.toCSS(context) : this.value);\n }\n\n if (this.cif) {\n value = value + ' ' + this.cif;\n }\n\n return `[${value}]`;\n }\n});\n\nexport default Attribute;\n","import Node from './node';\nimport Variable from './variable';\nimport Property from './property';\n\nconst Quoted = function(str, content, escaped, index, currentFileInfo) {\n this.escaped = (escaped === undefined) ? true : escaped;\n this.value = content || '';\n this.quote = str.charAt(0);\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.variableRegex = /@\\{([\\w-]+)\\}/g;\n this.propRegex = /\\$\\{([\\w-]+)\\}/g;\n this.allowRoot = escaped;\n};\n\nQuoted.prototype = Object.assign(new Node(), {\n type: 'Quoted',\n\n genCSS(context, output) {\n if (!this.escaped) {\n output.add(this.quote, this.fileInfo(), this.getIndex());\n }\n output.add(this.value);\n if (!this.escaped) {\n output.add(this.quote);\n }\n },\n\n containsVariables() {\n return this.value.match(this.variableRegex);\n },\n\n eval(context) {\n const that = this;\n let value = this.value;\n const variableReplacement = function (_, name1, name2) {\n const v = new Variable(`@${name1 ?? name2}`, that.getIndex(), that.fileInfo()).eval(context, true);\n return (v instanceof Quoted) ? v.value : v.toCSS();\n };\n const propertyReplacement = function (_, name1, name2) {\n const v = new Property(`$${name1 ?? name2}`, that.getIndex(), that.fileInfo()).eval(context, true);\n return (v instanceof Quoted) ? v.value : v.toCSS();\n };\n function iterativeReplace(value, regexp, replacementFnc) {\n let evaluatedValue = value;\n do {\n value = evaluatedValue.toString();\n evaluatedValue = value.replace(regexp, replacementFnc);\n } while (value !== evaluatedValue);\n return evaluatedValue;\n }\n value = iterativeReplace(value, this.variableRegex, variableReplacement);\n value = iterativeReplace(value, this.propRegex, propertyReplacement);\n return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo());\n },\n\n compare(other) {\n // when comparing quoted strings allow the quote to differ\n if (other.type === 'Quoted' && !this.escaped && !other.escaped) {\n return Node.numericCompare(this.value, other.value);\n } else {\n return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined;\n }\n }\n});\n\nexport default Quoted;\n","import Node from './node';\n\nfunction escapePath(path) {\n return path.replace(/[()'\"\\s]/g, function(match) { return `\\\\${match}`; });\n}\n\nconst URL = function(val, index, currentFileInfo, isEvald) {\n this.value = val;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.isEvald = isEvald;\n};\n\nURL.prototype = Object.assign(new Node(), {\n type: 'Url',\n\n accept(visitor) {\n this.value = visitor.visit(this.value);\n },\n\n genCSS(context, output) {\n output.add('url(');\n this.value.genCSS(context, output);\n output.add(')');\n },\n\n eval(context) {\n const val = this.value.eval(context);\n let rootpath;\n\n if (!this.isEvald) {\n // Add the rootpath if the URL requires a rewrite\n rootpath = this.fileInfo() && this.fileInfo().rootpath;\n if (typeof rootpath === 'string' &&\n typeof val.value === 'string' &&\n context.pathRequiresRewrite(val.value)) {\n if (!val.quote) {\n rootpath = escapePath(rootpath);\n }\n val.value = context.rewritePath(val.value, rootpath);\n } else {\n val.value = context.normalizePath(val.value);\n }\n\n // Add url args if enabled\n if (context.urlArgs) {\n if (!val.value.match(/^\\s*data:/)) {\n const delimiter = val.value.indexOf('?') === -1 ? '?' : '&';\n const urlArgs = delimiter + context.urlArgs;\n if (val.value.indexOf('#') !== -1) {\n val.value = val.value.replace('#', `${urlArgs}#`);\n } else {\n val.value += urlArgs;\n }\n }\n }\n }\n\n return new URL(val, this.getIndex(), this.fileInfo(), true);\n }\n});\n\nexport default URL;\n","import Ruleset from './ruleset';\nimport Value from './value';\nimport Selector from './selector';\nimport AtRule from './atrule';\nimport NestableAtRulePrototype from './nested-at-rule';\n\nconst Media = function(value, features, index, currentFileInfo, visibilityInfo) {\n this._index = index;\n this._fileInfo = currentFileInfo;\n\n const selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors();\n\n this.features = new Value(features);\n this.rules = [new Ruleset(selectors, value)];\n this.rules[0].allowImports = true;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n this.setParent(selectors, this);\n this.setParent(this.features, this);\n this.setParent(this.rules, this);\n};\n\nMedia.prototype = Object.assign(new AtRule(), {\n type: 'Media',\n\n ...NestableAtRulePrototype,\n\n genCSS(context, output) {\n output.add('@media ', this._fileInfo, this._index);\n this.features.genCSS(context, output);\n this.outputRuleset(context, output, this.rules);\n },\n\n eval(context) {\n if (!context.mediaBlocks) {\n context.mediaBlocks = [];\n context.mediaPath = [];\n }\n\n const media = new Media(null, [], this._index, this._fileInfo, this.visibilityInfo());\n if (this.debugInfo) {\n this.rules[0].debugInfo = this.debugInfo;\n media.debugInfo = this.debugInfo;\n }\n \n media.features = this.features.eval(context);\n\n context.mediaPath.push(media);\n context.mediaBlocks.push(media);\n\n this.rules[0].functionRegistry = context.frames[0].functionRegistry.inherit();\n context.frames.unshift(this.rules[0]);\n media.rules = [this.rules[0].eval(context)];\n context.frames.shift();\n\n context.mediaPath.pop();\n\n return context.mediaPath.length === 0 ? media.evalTop(context) :\n media.evalNested(context);\n }\n});\n\nexport default Media;\n","import Node from './node';\nimport Media from './media';\nimport URL from './url';\nimport Quoted from './quoted';\nimport Ruleset from './ruleset';\nimport Anonymous from './anonymous';\nimport * as utils from '../utils';\nimport LessError from '../less-error';\nimport Expression from './expression';\n\n//\n// CSS @import node\n//\n// The general strategy here is that we don't want to wait\n// for the parsing to be completed, before we start importing\n// the file. That's because in the context of a browser,\n// most of the time will be spent waiting for the server to respond.\n//\n// On creation, we push the import path to our import queue, though\n// `import,push`, we also pass it a callback, which it'll call once\n// the file has been fetched, and parsed.\n//\nconst Import = function(path, features, options, index, currentFileInfo, visibilityInfo) {\n this.options = options;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.path = path;\n this.features = features;\n this.allowRoot = true;\n\n if (this.options.less !== undefined || this.options.inline) {\n this.css = !this.options.less || this.options.inline;\n } else {\n const pathValue = this.getPath();\n if (pathValue && /[#.&?]css([?;].*)?$/.test(pathValue)) {\n this.css = true;\n }\n }\n this.copyVisibilityInfo(visibilityInfo);\n this.setParent(this.features, this);\n this.setParent(this.path, this);\n};\n\nImport.prototype = Object.assign(new Node(), {\n type: 'Import',\n\n accept(visitor) {\n if (this.features) {\n this.features = visitor.visit(this.features);\n }\n this.path = visitor.visit(this.path);\n if (!this.options.isPlugin && !this.options.inline && this.root) {\n this.root = visitor.visit(this.root);\n }\n },\n\n genCSS(context, output) {\n if (this.css && this.path._fileInfo.reference === undefined) {\n output.add('@import ', this._fileInfo, this._index);\n this.path.genCSS(context, output);\n if (this.features) {\n output.add(' ');\n this.features.genCSS(context, output);\n }\n output.add(';');\n }\n },\n\n getPath() {\n return (this.path instanceof URL) ?\n this.path.value.value : this.path.value;\n },\n\n isVariableImport() {\n let path = this.path;\n if (path instanceof URL) {\n path = path.value;\n }\n if (path instanceof Quoted) {\n return path.containsVariables();\n }\n\n return true;\n },\n\n evalForImport(context) {\n let path = this.path;\n\n if (path instanceof URL) {\n path = path.value;\n }\n\n return new Import(path.eval(context), this.features, this.options, this._index, this._fileInfo, this.visibilityInfo());\n },\n\n evalPath(context) {\n const path = this.path.eval(context);\n const fileInfo = this._fileInfo;\n\n if (!(path instanceof URL)) {\n // Add the rootpath if the URL requires a rewrite\n const pathValue = path.value;\n if (fileInfo &&\n pathValue &&\n context.pathRequiresRewrite(pathValue)) {\n path.value = context.rewritePath(pathValue, fileInfo.rootpath);\n } else {\n path.value = context.normalizePath(path.value);\n }\n }\n\n return path;\n },\n\n eval(context) {\n const result = this.doEval(context);\n if (this.options.reference || this.blocksVisibility()) {\n if (result.length || result.length === 0) {\n result.forEach(function (node) {\n node.addVisibilityBlock();\n }\n );\n } else {\n result.addVisibilityBlock();\n }\n }\n return result;\n },\n\n doEval(context) {\n let ruleset;\n let registry;\n const features = this.features && this.features.eval(context);\n\n if (this.options.isPlugin) {\n if (this.root && this.root.eval) {\n try {\n this.root.eval(context);\n }\n catch (e) {\n e.message = 'Plugin error during evaluation';\n throw new LessError(e, this.root.imports, this.root.filename);\n }\n }\n registry = context.frames[0] && context.frames[0].functionRegistry;\n if ( registry && this.root && this.root.functions ) {\n registry.addMultiple( this.root.functions );\n }\n\n return [];\n }\n\n if (this.skip) {\n if (typeof this.skip === 'function') {\n this.skip = this.skip();\n }\n if (this.skip) {\n return [];\n }\n }\n if (this.features) {\n let featureValue = this.features.value;\n if (Array.isArray(featureValue) && featureValue.length >= 1) {\n const expr = featureValue[0];\n if (expr.type === 'Expression' && Array.isArray(expr.value) && expr.value.length >= 2) {\n featureValue = expr.value;\n const isLayer = featureValue[0].type === 'Keyword' && featureValue[0].value === 'layer'\n && featureValue[1].type === 'Paren';\n if (isLayer) {\n this.css = false;\n }\n }\n }\n }\n if (this.options.inline) {\n const contents = new Anonymous(this.root, 0,\n {\n filename: this.importedFilename,\n reference: this.path._fileInfo && this.path._fileInfo.reference\n }, true, true);\n\n return this.features ? new Media([contents], this.features.value) : [contents];\n } else if (this.css || this.layerCss) {\n const newImport = new Import(this.evalPath(context), features, this.options, this._index);\n if (this.layerCss) {\n newImport.css = this.layerCss;\n newImport.path._fileInfo = this._fileInfo;\n }\n if (!newImport.css && this.error) {\n throw this.error;\n }\n return newImport;\n } else if (this.root) {\n if (this.features) {\n let featureValue = this.features.value;\n if (Array.isArray(featureValue) && featureValue.length === 1) {\n const expr = featureValue[0];\n if (expr.type === 'Expression' && Array.isArray(expr.value) && expr.value.length >= 2) {\n featureValue = expr.value;\n const isLayer = featureValue[0].type === 'Keyword' && featureValue[0].value === 'layer'\n && featureValue[1].type === 'Paren';\n if (isLayer) {\n this.layerCss = true;\n featureValue[0] = new Expression(featureValue.slice(0, 2));\n featureValue.splice(1, 1);\n featureValue[0].noSpacing = true;\n return this;\n }\n }\n }\n }\n ruleset = new Ruleset(null, utils.copyArray(this.root.rules));\n ruleset.evalImports(context);\n\n return this.features ? new Media(ruleset.rules, this.features.value) : ruleset.rules;\n } else {\n if (this.features) {\n let featureValue = this.features.value;\n if (Array.isArray(featureValue) && featureValue.length >= 1) {\n featureValue = featureValue[0].value;\n if (Array.isArray(featureValue) && featureValue.length >= 2) {\n const isLayer = featureValue[0].type === 'Keyword' && featureValue[0].value === 'layer'\n && featureValue[1].type === 'Paren';\n if (isLayer) {\n this.css = true;\n featureValue[0] = new Expression(featureValue.slice(0, 2));\n featureValue.splice(1, 1);\n featureValue[0].noSpacing = true;\n return this;\n }\n }\n }\n }\n return [];\n }\n }\n});\n\nexport default Import;\n","import Node from './node';\nimport Variable from './variable';\n\nconst JsEvalNode = function() {};\n\nJsEvalNode.prototype = Object.assign(new Node(), {\n evaluateJavaScript(expression, context) {\n let result;\n const that = this;\n const evalContext = {};\n\n if (!context.javascriptEnabled) {\n throw { message: 'Inline JavaScript is not enabled. Is it set in your options?',\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n\n expression = expression.replace(/@\\{([\\w-]+)\\}/g, function (_, name) {\n return that.jsify(new Variable(`@${name}`, that.getIndex(), that.fileInfo()).eval(context));\n });\n\n try {\n expression = new Function(`return (${expression})`);\n } catch (e) {\n throw { message: `JavaScript evaluation error: ${e.message} from \\`${expression}\\`` ,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n\n const variables = context.frames[0].variables();\n for (const k in variables) {\n // eslint-disable-next-line no-prototype-builtins\n if (variables.hasOwnProperty(k)) {\n evalContext[k.slice(1)] = {\n value: variables[k].value,\n toJS: function () {\n return this.value.eval(context).toCSS();\n }\n };\n }\n }\n\n try {\n result = expression.call(evalContext);\n } catch (e) {\n throw { message: `JavaScript evaluation error: '${e.name}: ${e.message.replace(/[\"]/g, '\\'')}'` ,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n return result;\n },\n\n jsify(obj) {\n if (Array.isArray(obj.value) && (obj.value.length > 1)) {\n return `[${obj.value.map(function (v) { return v.toCSS(); }).join(', ')}]`;\n } else {\n return obj.toCSS();\n }\n }\n});\n\nexport default JsEvalNode;\n","import JsEvalNode from './js-eval-node';\nimport Dimension from './dimension';\nimport Quoted from './quoted';\nimport Anonymous from './anonymous';\n\nconst JavaScript = function(string, escaped, index, currentFileInfo) {\n this.escaped = escaped;\n this.expression = string;\n this._index = index;\n this._fileInfo = currentFileInfo;\n}\n\nJavaScript.prototype = Object.assign(new JsEvalNode(), {\n type: 'JavaScript',\n\n eval(context) {\n const result = this.evaluateJavaScript(this.expression, context);\n const type = typeof result;\n\n if (type === 'number' && !isNaN(result)) {\n return new Dimension(result);\n } else if (type === 'string') {\n return new Quoted(`\"${result}\"`, result, this.escaped, this._index);\n } else if (Array.isArray(result)) {\n return new Anonymous(result.join(', '));\n } else {\n return new Anonymous(result);\n }\n }\n});\n\nexport default JavaScript;\n","import Node from './node';\n\nconst Assignment = function(key, val) {\n this.key = key;\n this.value = val;\n}\n\nAssignment.prototype = Object.assign(new Node(), {\n type: 'Assignment',\n\n accept(visitor) {\n this.value = visitor.visit(this.value);\n },\n\n eval(context) {\n if (this.value.eval) {\n return new Assignment(this.key, this.value.eval(context));\n }\n return this;\n },\n\n genCSS(context, output) {\n output.add(`${this.key}=`);\n if (this.value.genCSS) {\n this.value.genCSS(context, output);\n } else {\n output.add(this.value);\n }\n }\n});\n\nexport default Assignment;\n","import Node from './node';\n\nconst Condition = function(op, l, r, i, negate) {\n this.op = op.trim();\n this.lvalue = l;\n this.rvalue = r;\n this._index = i;\n this.negate = negate;\n};\n\nCondition.prototype = Object.assign(new Node(), {\n type: 'Condition',\n\n accept(visitor) {\n this.lvalue = visitor.visit(this.lvalue);\n this.rvalue = visitor.visit(this.rvalue);\n },\n\n eval(context) {\n const result = (function (op, a, b) {\n switch (op) {\n case 'and': return a && b;\n case 'or': return a || b;\n default:\n switch (Node.compare(a, b)) {\n case -1:\n return op === '<' || op === '=<' || op === '<=';\n case 0:\n return op === '=' || op === '>=' || op === '=<' || op === '<=';\n case 1:\n return op === '>' || op === '>=';\n default:\n return false;\n }\n }\n })(this.op, this.lvalue.eval(context), this.rvalue.eval(context));\n\n return this.negate ? !result : result;\n }\n});\n\nexport default Condition;\n","import { copy } from 'copy-anything';\nimport Declaration from './declaration';\nimport Node from './node';\n\nconst QueryInParens = function (op, l, m, op2, r, i) {\n this.op = op.trim();\n this.lvalue = l;\n this.mvalue = m;\n this.op2 = op2 ? op2.trim() : null;\n this.rvalue = r;\n this._index = i;\n this.mvalues = [];\n};\n\nQueryInParens.prototype = Object.assign(new Node(), {\n type: 'QueryInParens',\n\n accept(visitor) {\n this.lvalue = visitor.visit(this.lvalue);\n this.mvalue = visitor.visit(this.mvalue);\n if (this.rvalue) {\n this.rvalue = visitor.visit(this.rvalue);\n }\n },\n\n eval(context) {\n this.lvalue = this.lvalue.eval(context);\n \n let variableDeclaration;\n let rule;\n\n for (let i = 0; (rule = context.frames[i]); i++) {\n if (rule.type === 'Ruleset') {\n variableDeclaration = rule.rules.find(function (r) {\n if ((r instanceof Declaration) && r.variable) {\n return true;\n }\n\n return false;\n });\n \n if (variableDeclaration) {\n break;\n }\n }\n }\n\n if (!this.mvalueCopy) {\n this.mvalueCopy = copy(this.mvalue);\n }\n \n if (variableDeclaration) {\n this.mvalue = this.mvalueCopy;\n this.mvalue = this.mvalue.eval(context);\n this.mvalues.push(this.mvalue);\n } else {\n this.mvalue = this.mvalue.eval(context);\n }\n\n if (this.rvalue) {\n this.rvalue = this.rvalue.eval(context);\n }\n return this;\n },\n\n genCSS(context, output) {\n this.lvalue.genCSS(context, output);\n output.add(' ' + this.op + ' ');\n if (this.mvalues.length > 0) {\n this.mvalue = this.mvalues.shift();\n }\n this.mvalue.genCSS(context, output);\n if (this.rvalue) {\n output.add(' ' + this.op2 + ' ');\n this.rvalue.genCSS(context, output);\n }\n },\n});\n\nexport default QueryInParens;\n","import Ruleset from './ruleset';\nimport Value from './value';\nimport Selector from './selector';\nimport AtRule from './atrule';\nimport NestableAtRulePrototype from './nested-at-rule';\n\nconst Container = function(value, features, index, currentFileInfo, visibilityInfo) {\n this._index = index;\n this._fileInfo = currentFileInfo;\n\n const selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors();\n\n this.features = new Value(features);\n this.rules = [new Ruleset(selectors, value)];\n this.rules[0].allowImports = true;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n this.setParent(selectors, this);\n this.setParent(this.features, this);\n this.setParent(this.rules, this);\n};\n\nContainer.prototype = Object.assign(new AtRule(), {\n type: 'Container',\n\n ...NestableAtRulePrototype,\n\n genCSS(context, output) {\n output.add('@container ', this._fileInfo, this._index);\n this.features.genCSS(context, output);\n this.outputRuleset(context, output, this.rules);\n },\n\n eval(context) {\n if (!context.mediaBlocks) {\n context.mediaBlocks = [];\n context.mediaPath = [];\n }\n\n const media = new Container(null, [], this._index, this._fileInfo, this.visibilityInfo());\n if (this.debugInfo) {\n this.rules[0].debugInfo = this.debugInfo;\n media.debugInfo = this.debugInfo;\n }\n \n media.features = this.features.eval(context);\n\n context.mediaPath.push(media);\n context.mediaBlocks.push(media);\n\n this.rules[0].functionRegistry = context.frames[0].functionRegistry.inherit();\n context.frames.unshift(this.rules[0]);\n media.rules = [this.rules[0].eval(context)];\n context.frames.shift();\n\n context.mediaPath.pop();\n\n return context.mediaPath.length === 0 ? media.evalTop(context) :\n media.evalNested(context);\n }\n});\n\nexport default Container;\n","import Node from './node';\n\nconst UnicodeDescriptor = function(value) {\n this.value = value;\n}\n\nUnicodeDescriptor.prototype = Object.assign(new Node(), {\n type: 'UnicodeDescriptor'\n})\n\nexport default UnicodeDescriptor;\n","import Node from './node';\nimport Operation from './operation';\nimport Dimension from './dimension';\n\nconst Negative = function(node) {\n this.value = node;\n};\n\nNegative.prototype = Object.assign(new Node(), {\n type: 'Negative',\n\n genCSS(context, output) {\n output.add('-');\n this.value.genCSS(context, output);\n },\n\n eval(context) {\n if (context.isMathOn()) {\n return (new Operation('*', [new Dimension(-1), this.value])).eval(context);\n }\n return new Negative(this.value.eval(context));\n }\n});\n\nexport default Negative;\n","import Node from './node';\nimport Selector from './selector';\n\nconst Extend = function(selector, option, index, currentFileInfo, visibilityInfo) {\n this.selector = selector;\n this.option = option;\n this.object_id = Extend.next_id++;\n this.parent_ids = [this.object_id];\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n\n switch (option) {\n case '!all':\n case 'all':\n this.allowBefore = true;\n this.allowAfter = true;\n break;\n default:\n this.allowBefore = false;\n this.allowAfter = false;\n break;\n }\n this.setParent(this.selector, this);\n};\n\nExtend.prototype = Object.assign(new Node(), {\n type: 'Extend',\n\n accept(visitor) {\n this.selector = visitor.visit(this.selector);\n },\n\n eval(context) {\n return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());\n },\n\n // remove when Nodes have JSDoc types\n // eslint-disable-next-line no-unused-vars\n clone(context) {\n return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo());\n },\n\n // it concatenates (joins) all selectors in selector array\n findSelfSelectors(selectors) {\n let selfElements = [], i, selectorElements;\n\n for (i = 0; i < selectors.length; i++) {\n selectorElements = selectors[i].elements;\n // duplicate the logic in genCSS function inside the selector node.\n // future TODO - move both logics into the selector joiner visitor\n if (i > 0 && selectorElements.length && selectorElements[0].combinator.value === '') {\n selectorElements[0].combinator.value = ' ';\n }\n selfElements = selfElements.concat(selectors[i].elements);\n }\n\n this.selfSelectors = [new Selector(selfElements)];\n this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo());\n }\n});\n\nExtend.next_id = 0;\nexport default Extend;\n","import Node from './node';\nimport Variable from './variable';\nimport Ruleset from './ruleset';\nimport DetachedRuleset from './detached-ruleset';\nimport LessError from '../less-error';\n\nconst VariableCall = function(variable, index, currentFileInfo) {\n this.variable = variable;\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.allowRoot = true;\n};\n\nVariableCall.prototype = Object.assign(new Node(), {\n type: 'VariableCall',\n\n eval(context) {\n let rules;\n let detachedRuleset = new Variable(this.variable, this.getIndex(), this.fileInfo()).eval(context);\n const error = new LessError({message: `Could not evaluate variable call ${this.variable}`});\n\n if (!detachedRuleset.ruleset) {\n if (detachedRuleset.rules) {\n rules = detachedRuleset;\n }\n else if (Array.isArray(detachedRuleset)) {\n rules = new Ruleset('', detachedRuleset);\n }\n else if (Array.isArray(detachedRuleset.value)) {\n rules = new Ruleset('', detachedRuleset.value);\n }\n else {\n throw error;\n }\n detachedRuleset = new DetachedRuleset(rules);\n }\n\n if (detachedRuleset.ruleset) {\n return detachedRuleset.callEval(context);\n }\n throw error;\n }\n});\n\nexport default VariableCall;\n","import Node from './node';\nimport Variable from './variable';\nimport Ruleset from './ruleset';\nimport Selector from './selector';\n\nconst NamespaceValue = function(ruleCall, lookups, index, fileInfo) {\n this.value = ruleCall;\n this.lookups = lookups;\n this._index = index;\n this._fileInfo = fileInfo;\n};\n\nNamespaceValue.prototype = Object.assign(new Node(), {\n type: 'NamespaceValue',\n\n eval(context) {\n let i, name, rules = this.value.eval(context);\n \n for (i = 0; i < this.lookups.length; i++) {\n name = this.lookups[i];\n\n /**\n * Eval'd DRs return rulesets.\n * Eval'd mixins return rules, so let's make a ruleset if we need it.\n * We need to do this because of late parsing of values\n */\n if (Array.isArray(rules)) {\n rules = new Ruleset([new Selector()], rules);\n }\n\n if (name === '') {\n rules = rules.lastDeclaration();\n }\n else if (name.charAt(0) === '@') {\n if (name.charAt(1) === '@') {\n name = `@${new Variable(name.substr(1)).eval(context).value}`;\n }\n if (rules.variables) {\n rules = rules.variable(name);\n }\n \n if (!rules) {\n throw { type: 'Name',\n message: `variable ${name} not found`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n }\n else {\n if (name.substring(0, 2) === '$@') {\n name = `$${new Variable(name.substr(1)).eval(context).value}`;\n }\n else {\n name = name.charAt(0) === '$' ? name : `$${name}`;\n }\n if (rules.properties) {\n rules = rules.property(name);\n }\n \n if (!rules) {\n throw { type: 'Name',\n message: `property \"${name.substr(1)}\" not found`,\n filename: this.fileInfo().filename,\n index: this.getIndex() };\n }\n // Properties are an array of values, since a ruleset can have multiple props.\n // We pick the last one (the \"cascaded\" value)\n rules = rules[rules.length - 1];\n }\n\n if (rules.value) {\n rules = rules.eval(context).value;\n }\n if (rules.ruleset) {\n rules = rules.ruleset.eval(context);\n }\n }\n return rules;\n }\n});\n\nexport default NamespaceValue;\n","import Selector from './selector';\nimport Element from './element';\nimport Ruleset from './ruleset';\nimport Declaration from './declaration';\nimport DetachedRuleset from './detached-ruleset';\nimport Expression from './expression';\nimport contexts from '../contexts';\nimport * as utils from '../utils';\n\nconst Definition = function(name, params, rules, condition, variadic, frames, visibilityInfo) {\n this.name = name || 'anonymous mixin';\n this.selectors = [new Selector([new Element(null, name, false, this._index, this._fileInfo)])];\n this.params = params;\n this.condition = condition;\n this.variadic = variadic;\n this.arity = params.length;\n this.rules = rules;\n this._lookups = {};\n const optionalParameters = [];\n this.required = params.reduce(function (count, p) {\n if (!p.name || (p.name && !p.value)) {\n return count + 1;\n }\n else {\n optionalParameters.push(p.name);\n return count;\n }\n }, 0);\n this.optionalParameters = optionalParameters;\n this.frames = frames;\n this.copyVisibilityInfo(visibilityInfo);\n this.allowRoot = true;\n}\n\nDefinition.prototype = Object.assign(new Ruleset(), {\n type: 'MixinDefinition',\n evalFirst: true,\n\n accept(visitor) {\n if (this.params && this.params.length) {\n this.params = visitor.visitArray(this.params);\n }\n this.rules = visitor.visitArray(this.rules);\n if (this.condition) {\n this.condition = visitor.visit(this.condition);\n }\n },\n\n evalParams(context, mixinEnv, args, evaldArguments) {\n /* jshint boss:true */\n const frame = new Ruleset(null, null);\n\n let varargs;\n let arg;\n const params = utils.copyArray(this.params);\n let i;\n let j;\n let val;\n let name;\n let isNamedFound;\n let argIndex;\n let argsLength = 0;\n\n if (mixinEnv.frames && mixinEnv.frames[0] && mixinEnv.frames[0].functionRegistry) {\n frame.functionRegistry = mixinEnv.frames[0].functionRegistry.inherit();\n }\n mixinEnv = new contexts.Eval(mixinEnv, [frame].concat(mixinEnv.frames));\n\n if (args) {\n args = utils.copyArray(args);\n argsLength = args.length;\n\n for (i = 0; i < argsLength; i++) {\n arg = args[i];\n if (name = (arg && arg.name)) {\n isNamedFound = false;\n for (j = 0; j < params.length; j++) {\n if (!evaldArguments[j] && name === params[j].name) {\n evaldArguments[j] = arg.value.eval(context);\n frame.prependRule(new Declaration(name, arg.value.eval(context)));\n isNamedFound = true;\n break;\n }\n }\n if (isNamedFound) {\n args.splice(i, 1);\n i--;\n continue;\n } else {\n throw { type: 'Runtime', message: `Named argument for ${this.name} ${args[i].name} not found` };\n }\n }\n }\n }\n argIndex = 0;\n for (i = 0; i < params.length; i++) {\n if (evaldArguments[i]) { continue; }\n\n arg = args && args[argIndex];\n\n if (name = params[i].name) {\n if (params[i].variadic) {\n varargs = [];\n for (j = argIndex; j < argsLength; j++) {\n varargs.push(args[j].value.eval(context));\n }\n frame.prependRule(new Declaration(name, new Expression(varargs).eval(context)));\n } else {\n val = arg && arg.value;\n if (val) {\n // This was a mixin call, pass in a detached ruleset of it's eval'd rules\n if (Array.isArray(val)) {\n val = new DetachedRuleset(new Ruleset('', val));\n }\n else {\n val = val.eval(context);\n }\n } else if (params[i].value) {\n val = params[i].value.eval(mixinEnv);\n frame.resetCache();\n } else {\n throw { type: 'Runtime', message: `wrong number of arguments for ${this.name} (${argsLength} for ${this.arity})` };\n }\n\n frame.prependRule(new Declaration(name, val));\n evaldArguments[i] = val;\n }\n }\n\n if (params[i].variadic && args) {\n for (j = argIndex; j < argsLength; j++) {\n evaldArguments[j] = args[j].value.eval(context);\n }\n }\n argIndex++;\n }\n\n return frame;\n },\n\n makeImportant() {\n const rules = !this.rules ? this.rules : this.rules.map(function (r) {\n if (r.makeImportant) {\n return r.makeImportant(true);\n } else {\n return r;\n }\n });\n const result = new Definition(this.name, this.params, rules, this.condition, this.variadic, this.frames);\n return result;\n },\n\n eval(context) {\n return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || utils.copyArray(context.frames));\n },\n\n evalCall(context, args, important) {\n const _arguments = [];\n const mixinFrames = this.frames ? this.frames.concat(context.frames) : context.frames;\n const frame = this.evalParams(context, new contexts.Eval(context, mixinFrames), args, _arguments);\n let rules;\n let ruleset;\n\n frame.prependRule(new Declaration('@arguments', new Expression(_arguments).eval(context)));\n\n rules = utils.copyArray(this.rules);\n\n ruleset = new Ruleset(null, rules);\n ruleset.originalRuleset = this;\n ruleset = ruleset.eval(new contexts.Eval(context, [this, frame].concat(mixinFrames)));\n if (important) {\n ruleset = ruleset.makeImportant();\n }\n return ruleset;\n },\n\n matchCondition(args, context) {\n if (this.condition && !this.condition.eval(\n new contexts.Eval(context,\n [this.evalParams(context, /* the parameter variables */\n new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])]\n .concat(this.frames || []) // the parent namespace/mixin frames\n .concat(context.frames)))) { // the current environment frames\n return false;\n }\n return true;\n },\n\n matchArgs(args, context) {\n const allArgsCnt = (args && args.length) || 0;\n let len;\n const optionalParameters = this.optionalParameters;\n const requiredArgsCnt = !args ? 0 : args.reduce(function (count, p) {\n if (optionalParameters.indexOf(p.name) < 0) {\n return count + 1;\n } else {\n return count;\n }\n }, 0);\n\n if (!this.variadic) {\n if (requiredArgsCnt < this.required) {\n return false;\n }\n if (allArgsCnt > this.params.length) {\n return false;\n }\n } else {\n if (requiredArgsCnt < (this.required - 1)) {\n return false;\n }\n }\n\n // check patterns\n len = Math.min(requiredArgsCnt, this.arity);\n\n for (let i = 0; i < len; i++) {\n if (!this.params[i].name && !this.params[i].variadic) {\n if (args[i].value.eval(context).toCSS() != this.params[i].value.eval(context).toCSS()) {\n return false;\n }\n }\n }\n return true;\n }\n});\n\nexport default Definition;\n","import Node from './node';\nimport Selector from './selector';\nimport MixinDefinition from './mixin-definition';\nimport defaultFunc from '../functions/default';\n\nconst MixinCall = function(elements, args, index, currentFileInfo, important) {\n this.selector = new Selector(elements);\n this.arguments = args || [];\n this._index = index;\n this._fileInfo = currentFileInfo;\n this.important = important;\n this.allowRoot = true;\n this.setParent(this.selector, this);\n};\n\nMixinCall.prototype = Object.assign(new Node(), {\n type: 'MixinCall',\n\n accept(visitor) {\n if (this.selector) {\n this.selector = visitor.visit(this.selector);\n }\n if (this.arguments.length) {\n this.arguments = visitor.visitArray(this.arguments);\n }\n },\n\n eval(context) {\n let mixins;\n let mixin;\n let mixinPath;\n const args = [];\n let arg;\n let argValue;\n const rules = [];\n let match = false;\n let i;\n let m;\n let f;\n let isRecursive;\n let isOneFound;\n const candidates = [];\n let candidate;\n const conditionResult = [];\n let defaultResult;\n const defFalseEitherCase = -1;\n const defNone = 0;\n const defTrue = 1;\n const defFalse = 2;\n let count;\n let originalRuleset;\n let noArgumentsFilter;\n\n this.selector = this.selector.eval(context);\n\n function calcDefGroup(mixin, mixinPath) {\n let f, p, namespace;\n\n for (f = 0; f < 2; f++) {\n conditionResult[f] = true;\n defaultFunc.value(f);\n for (p = 0; p < mixinPath.length && conditionResult[f]; p++) {\n namespace = mixinPath[p];\n if (namespace.matchCondition) {\n conditionResult[f] = conditionResult[f] && namespace.matchCondition(null, context);\n }\n }\n if (mixin.matchCondition) {\n conditionResult[f] = conditionResult[f] && mixin.matchCondition(args, context);\n }\n }\n if (conditionResult[0] || conditionResult[1]) {\n if (conditionResult[0] != conditionResult[1]) {\n return conditionResult[1] ?\n defTrue : defFalse;\n }\n\n return defNone;\n }\n return defFalseEitherCase;\n }\n\n for (i = 0; i < this.arguments.length; i++) {\n arg = this.arguments[i];\n argValue = arg.value.eval(context);\n if (arg.expand && Array.isArray(argValue.value)) {\n argValue = argValue.value;\n for (m = 0; m < argValue.length; m++) {\n args.push({value: argValue[m]});\n }\n } else {\n args.push({name: arg.name, value: argValue});\n }\n }\n\n noArgumentsFilter = function(rule) {return rule.matchArgs(null, context);};\n\n for (i = 0; i < context.frames.length; i++) {\n if ((mixins = context.frames[i].find(this.selector, null, noArgumentsFilter)).length > 0) {\n isOneFound = true;\n\n // To make `default()` function independent of definition order we have two \"subpasses\" here.\n // At first we evaluate each guard *twice* (with `default() == true` and `default() == false`),\n // and build candidate list with corresponding flags. Then, when we know all possible matches,\n // we make a final decision.\n\n for (m = 0; m < mixins.length; m++) {\n mixin = mixins[m].rule;\n mixinPath = mixins[m].path;\n isRecursive = false;\n for (f = 0; f < context.frames.length; f++) {\n if ((!(mixin instanceof MixinDefinition)) && mixin === (context.frames[f].originalRuleset || context.frames[f])) {\n isRecursive = true;\n break;\n }\n }\n if (isRecursive) {\n continue;\n }\n\n if (mixin.matchArgs(args, context)) {\n candidate = {mixin, group: calcDefGroup(mixin, mixinPath)};\n\n if (candidate.group !== defFalseEitherCase) {\n candidates.push(candidate);\n }\n\n match = true;\n }\n }\n\n defaultFunc.reset();\n\n count = [0, 0, 0];\n for (m = 0; m < candidates.length; m++) {\n count[candidates[m].group]++;\n }\n\n if (count[defNone] > 0) {\n defaultResult = defFalse;\n } else {\n defaultResult = defTrue;\n if ((count[defTrue] + count[defFalse]) > 1) {\n throw { type: 'Runtime',\n message: `Ambiguous use of \\`default()\\` found when matching for \\`${this.format(args)}\\``,\n index: this.getIndex(), filename: this.fileInfo().filename };\n }\n }\n\n for (m = 0; m < candidates.length; m++) {\n candidate = candidates[m].group;\n if ((candidate === defNone) || (candidate === defaultResult)) {\n try {\n mixin = candidates[m].mixin;\n if (!(mixin instanceof MixinDefinition)) {\n originalRuleset = mixin.originalRuleset || mixin;\n mixin = new MixinDefinition('', [], mixin.rules, null, false, null, originalRuleset.visibilityInfo());\n mixin.originalRuleset = originalRuleset;\n }\n const newRules = mixin.evalCall(context, args, this.important).rules;\n this._setVisibilityToReplacement(newRules);\n Array.prototype.push.apply(rules, newRules);\n } catch (e) {\n throw { message: e.message, index: this.getIndex(), filename: this.fileInfo().filename, stack: e.stack };\n }\n }\n }\n\n if (match) {\n return rules;\n }\n }\n }\n if (isOneFound) {\n throw { type: 'Runtime',\n message: `No matching definition was found for \\`${this.format(args)}\\``,\n index: this.getIndex(), filename: this.fileInfo().filename };\n } else {\n throw { type: 'Name',\n message: `${this.selector.toCSS().trim()} is undefined`,\n index: this.getIndex(), filename: this.fileInfo().filename };\n }\n },\n\n _setVisibilityToReplacement(replacement) {\n let i, rule;\n if (this.blocksVisibility()) {\n for (i = 0; i < replacement.length; i++) {\n rule = replacement[i];\n rule.addVisibilityBlock();\n }\n }\n },\n\n format(args) {\n return `${this.selector.toCSS().trim()}(${args ? args.map(function (a) {\n let argValue = '';\n if (a.name) {\n argValue += `${a.name}:`;\n }\n if (a.value.toCSS) {\n argValue += a.value.toCSS();\n } else {\n argValue += '???';\n }\n return argValue;\n }).join(', ') : ''})`;\n }\n});\n\nexport default MixinCall;\n","import Node from './node';\nimport Color from './color';\nimport AtRule from './atrule';\nimport DetachedRuleset from './detached-ruleset';\nimport Operation from './operation';\nimport Dimension from './dimension';\nimport Unit from './unit';\nimport Keyword from './keyword';\nimport Variable from './variable';\nimport Property from './property';\nimport Ruleset from './ruleset';\nimport Element from './element';\nimport Attribute from './attribute';\nimport Combinator from './combinator';\nimport Selector from './selector';\nimport Quoted from './quoted';\nimport Expression from './expression';\nimport Declaration from './declaration';\nimport Call from './call';\nimport URL from './url';\nimport Import from './import';\nimport Comment from './comment';\nimport Anonymous from './anonymous';\nimport Value from './value';\nimport JavaScript from './javascript';\nimport Assignment from './assignment';\nimport Condition from './condition';\nimport QueryInParens from './query-in-parens';\nimport Paren from './paren';\nimport Media from './media';\nimport Container from './container';\nimport UnicodeDescriptor from './unicode-descriptor';\nimport Negative from './negative';\nimport Extend from './extend';\nimport VariableCall from './variable-call';\nimport NamespaceValue from './namespace-value';\n\n// mixins\nimport MixinCall from './mixin-call';\nimport MixinDefinition from './mixin-definition';\n\nexport default {\n Node, Color, AtRule, DetachedRuleset, Operation,\n Dimension, Unit, Keyword, Variable, Property,\n Ruleset, Element, Attribute, Combinator, Selector,\n Quoted, Expression, Declaration, Call, URL, Import,\n Comment, Anonymous, Value, JavaScript, Assignment,\n Condition, Paren, Media, Container, QueryInParens, \n UnicodeDescriptor, Negative, Extend, VariableCall, \n NamespaceValue,\n mixin: {\n Call: MixinCall,\n Definition: MixinDefinition\n }\n};","class AbstractFileManager {\n getPath(filename) {\n let j = filename.lastIndexOf('?');\n if (j > 0) {\n filename = filename.slice(0, j);\n }\n j = filename.lastIndexOf('/');\n if (j < 0) {\n j = filename.lastIndexOf('\\\\');\n }\n if (j < 0) {\n return '';\n }\n return filename.slice(0, j + 1);\n }\n\n tryAppendExtension(path, ext) {\n return /(\\.[a-z]*$)|([?;].*)$/.test(path) ? path : path + ext;\n }\n\n tryAppendLessExtension(path) {\n return this.tryAppendExtension(path, '.less');\n }\n\n supportsSync() {\n return false;\n }\n\n alwaysMakePathsAbsolute() {\n return false;\n }\n\n isPathAbsolute(filename) {\n return (/^(?:[a-z-]+:|\\/|\\\\|#)/i).test(filename);\n }\n\n // TODO: pull out / replace?\n join(basePath, laterPath) {\n if (!basePath) {\n return laterPath;\n }\n return basePath + laterPath;\n }\n\n pathDiff(url, baseUrl) {\n // diff between two paths to create a relative path\n\n const urlParts = this.extractUrlParts(url);\n\n const baseUrlParts = this.extractUrlParts(baseUrl);\n let i;\n let max;\n let urlDirectories;\n let baseUrlDirectories;\n let diff = '';\n if (urlParts.hostPart !== baseUrlParts.hostPart) {\n return '';\n }\n max = Math.max(baseUrlParts.directories.length, urlParts.directories.length);\n for (i = 0; i < max; i++) {\n if (baseUrlParts.directories[i] !== urlParts.directories[i]) { break; }\n }\n baseUrlDirectories = baseUrlParts.directories.slice(i);\n urlDirectories = urlParts.directories.slice(i);\n for (i = 0; i < baseUrlDirectories.length - 1; i++) {\n diff += '../';\n }\n for (i = 0; i < urlDirectories.length - 1; i++) {\n diff += `${urlDirectories[i]}/`;\n }\n return diff;\n }\n\n /**\n * Helper function, not part of API.\n * This should be replaceable by newer Node / Browser APIs\n * \n * @param {string} url \n * @param {string} baseUrl\n */\n extractUrlParts(url, baseUrl) {\n // urlParts[1] = protocol://hostname/ OR /\n // urlParts[2] = / if path relative to host base\n // urlParts[3] = directories\n // urlParts[4] = filename\n // urlParts[5] = parameters\n\n const urlPartsRegex = /^((?:[a-z-]+:)?\\/{2}(?:[^/?#]*\\/)|([/\\\\]))?((?:[^/\\\\?#]*[/\\\\])*)([^/\\\\?#]*)([#?].*)?$/i;\n\n const urlParts = url.match(urlPartsRegex);\n const returner = {};\n let rawDirectories = [];\n const directories = [];\n let i;\n let baseUrlParts;\n\n if (!urlParts) {\n throw new Error(`Could not parse sheet href - '${url}'`);\n }\n\n // Stylesheets in IE don't always return the full path\n if (baseUrl && (!urlParts[1] || urlParts[2])) {\n baseUrlParts = baseUrl.match(urlPartsRegex);\n if (!baseUrlParts) {\n throw new Error(`Could not parse page url - '${baseUrl}'`);\n }\n urlParts[1] = urlParts[1] || baseUrlParts[1] || '';\n if (!urlParts[2]) {\n urlParts[3] = baseUrlParts[3] + urlParts[3];\n }\n }\n\n if (urlParts[3]) {\n rawDirectories = urlParts[3].replace(/\\\\/g, '/').split('/');\n\n // collapse '..' and skip '.'\n for (i = 0; i < rawDirectories.length; i++) {\n\n if (rawDirectories[i] === '..') {\n directories.pop();\n }\n else if (rawDirectories[i] !== '.') {\n directories.push(rawDirectories[i]);\n }\n \n }\n }\n\n returner.hostPart = urlParts[1];\n returner.directories = directories;\n returner.rawPath = (urlParts[1] || '') + rawDirectories.join('/');\n returner.path = (urlParts[1] || '') + directories.join('/');\n returner.filename = urlParts[4];\n returner.fileUrl = returner.path + (urlParts[4] || '');\n returner.url = returner.fileUrl + (urlParts[5] || '');\n return returner;\n }\n}\n\nexport default AbstractFileManager;\n","import functionRegistry from '../functions/function-registry';\nimport LessError from '../less-error';\n\nclass AbstractPluginLoader {\n constructor() {\n // Implemented by Node.js plugin loader\n this.require = function() {\n return null;\n }\n }\n\n evalPlugin(contents, context, imports, pluginOptions, fileInfo) {\n\n let loader, registry, pluginObj, localModule, pluginManager, filename, result;\n\n pluginManager = context.pluginManager;\n\n if (fileInfo) {\n if (typeof fileInfo === 'string') {\n filename = fileInfo;\n }\n else {\n filename = fileInfo.filename;\n }\n }\n const shortname = (new this.less.FileManager()).extractUrlParts(filename).filename;\n\n if (filename) {\n pluginObj = pluginManager.get(filename);\n\n if (pluginObj) {\n result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions);\n if (result) {\n return result;\n }\n try {\n if (pluginObj.use) {\n pluginObj.use.call(this.context, pluginObj);\n }\n }\n catch (e) {\n e.message = e.message || 'Error during @plugin call';\n return new LessError(e, imports, filename);\n }\n return pluginObj;\n }\n }\n localModule = {\n exports: {},\n pluginManager,\n fileInfo\n };\n registry = functionRegistry.create();\n\n const registerPlugin = function(obj) {\n pluginObj = obj;\n };\n\n try {\n loader = new Function('module', 'require', 'registerPlugin', 'functions', 'tree', 'less', 'fileInfo', contents);\n loader(localModule, this.require(filename), registerPlugin, registry, this.less.tree, this.less, fileInfo);\n }\n catch (e) {\n return new LessError(e, imports, filename);\n }\n\n if (!pluginObj) {\n pluginObj = localModule.exports;\n }\n pluginObj = this.validatePlugin(pluginObj, filename, shortname);\n\n if (pluginObj instanceof LessError) {\n return pluginObj;\n }\n\n if (pluginObj) {\n pluginObj.imports = imports;\n pluginObj.filename = filename;\n\n // For < 3.x (or unspecified minVersion) - setOptions() before install()\n if (!pluginObj.minVersion || this.compareVersion('3.0.0', pluginObj.minVersion) < 0) {\n result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions);\n\n if (result) {\n return result;\n }\n }\n\n // Run on first load\n pluginManager.addPlugin(pluginObj, fileInfo.filename, registry);\n pluginObj.functions = registry.getLocalFunctions();\n\n // Need to call setOptions again because the pluginObj might have functions\n result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions);\n if (result) {\n return result;\n }\n\n // Run every @plugin call\n try {\n if (pluginObj.use) {\n pluginObj.use.call(this.context, pluginObj);\n }\n }\n catch (e) {\n e.message = e.message || 'Error during @plugin call';\n return new LessError(e, imports, filename);\n }\n\n }\n else {\n return new LessError({ message: 'Not a valid plugin' }, imports, filename);\n }\n\n return pluginObj;\n\n }\n\n trySetOptions(plugin, filename, name, options) {\n if (options && !plugin.setOptions) {\n return new LessError({\n message: `Options have been provided but the plugin ${name} does not support any options.`\n });\n }\n try {\n plugin.setOptions && plugin.setOptions(options);\n }\n catch (e) {\n return new LessError(e);\n }\n }\n\n validatePlugin(plugin, filename, name) {\n if (plugin) {\n // support plugins being a function\n // so that the plugin can be more usable programmatically\n if (typeof plugin === 'function') {\n plugin = new plugin();\n }\n\n if (plugin.minVersion) {\n if (this.compareVersion(plugin.minVersion, this.less.version) < 0) {\n return new LessError({\n message: `Plugin ${name} requires version ${this.versionToString(plugin.minVersion)}`\n });\n }\n }\n return plugin;\n }\n return null;\n }\n\n compareVersion(aVersion, bVersion) {\n if (typeof aVersion === 'string') {\n aVersion = aVersion.match(/^(\\d+)\\.?(\\d+)?\\.?(\\d+)?/);\n aVersion.shift();\n }\n for (let i = 0; i < aVersion.length; i++) {\n if (aVersion[i] !== bVersion[i]) {\n return parseInt(aVersion[i]) > parseInt(bVersion[i]) ? -1 : 1;\n }\n }\n return 0;\n }\n\n versionToString(version) {\n let versionString = '';\n for (let i = 0; i < version.length; i++) {\n versionString += (versionString ? '.' : '') + version[i];\n }\n return versionString;\n }\n\n printUsage(plugins) {\n for (let i = 0; i < plugins.length; i++) {\n const plugin = plugins[i];\n if (plugin.printUsage) {\n plugin.printUsage();\n }\n }\n }\n}\n\nexport default AbstractPluginLoader;\n\n","import Anonymous from '../tree/anonymous';\nimport Keyword from '../tree/keyword';\n\nfunction boolean(condition) {\n return condition ? Keyword.True : Keyword.False;\n}\n\n/**\n * Functions with evalArgs set to false are sent context\n * as the first argument.\n */\nfunction If(context, condition, trueValue, falseValue) {\n return condition.eval(context) ? trueValue.eval(context)\n : (falseValue ? falseValue.eval(context) : new Anonymous);\n}\nIf.evalArgs = false;\n\nfunction isdefined(context, variable) {\n try {\n variable.eval(context);\n return Keyword.True;\n } catch (e) {\n return Keyword.False;\n }\n}\n\nisdefined.evalArgs = false;\n\nexport default { isdefined, boolean, 'if': If };\n","import Dimension from '../tree/dimension';\nimport Color from '../tree/color';\nimport Quoted from '../tree/quoted';\nimport Anonymous from '../tree/anonymous';\nimport Expression from '../tree/expression';\nimport Operation from '../tree/operation';\nlet colorFunctions;\n\nfunction clamp(val) {\n return Math.min(1, Math.max(0, val));\n}\nfunction hsla(origColor, hsl) {\n const color = colorFunctions.hsla(hsl.h, hsl.s, hsl.l, hsl.a);\n if (color) {\n if (origColor.value && \n /^(rgb|hsl)/.test(origColor.value)) {\n color.value = origColor.value;\n } else {\n color.value = 'rgb';\n }\n return color;\n }\n}\nfunction toHSL(color) {\n if (color.toHSL) {\n return color.toHSL();\n } else {\n throw new Error('Argument cannot be evaluated to a color');\n }\n}\n\nfunction toHSV(color) {\n if (color.toHSV) {\n return color.toHSV();\n } else {\n throw new Error('Argument cannot be evaluated to a color');\n }\n}\n\nfunction number(n) {\n if (n instanceof Dimension) {\n return parseFloat(n.unit.is('%') ? n.value / 100 : n.value);\n } else if (typeof n === 'number') {\n return n;\n } else {\n throw {\n type: 'Argument',\n message: 'color functions take numbers as parameters'\n };\n }\n}\nfunction scaled(n, size) {\n if (n instanceof Dimension && n.unit.is('%')) {\n return parseFloat(n.value * size / 100);\n } else {\n return number(n);\n }\n}\ncolorFunctions = {\n rgb: function (r, g, b) {\n let a = 1\n /**\n * Comma-less syntax\n * e.g. rgb(0 128 255 / 50%)\n */\n if (r instanceof Expression) {\n const val = r.value\n r = val[0]\n g = val[1]\n b = val[2]\n /** \n * @todo - should this be normalized in\n * function caller? Or parsed differently?\n */\n if (b instanceof Operation) {\n const op = b\n b = op.operands[0]\n a = op.operands[1]\n }\n }\n const color = colorFunctions.rgba(r, g, b, a);\n if (color) {\n color.value = 'rgb';\n return color;\n }\n },\n rgba: function (r, g, b, a) {\n try {\n if (r instanceof Color) {\n if (g) {\n a = number(g);\n } else {\n a = r.alpha;\n }\n return new Color(r.rgb, a, 'rgba');\n }\n const rgb = [r, g, b].map(c => scaled(c, 255));\n a = number(a);\n return new Color(rgb, a, 'rgba');\n }\n catch (e) {}\n },\n hsl: function (h, s, l) {\n let a = 1\n if (h instanceof Expression) {\n const val = h.value\n h = val[0]\n s = val[1]\n l = val[2]\n\n if (l instanceof Operation) {\n const op = l\n l = op.operands[0]\n a = op.operands[1]\n }\n }\n const color = colorFunctions.hsla(h, s, l, a);\n if (color) {\n color.value = 'hsl';\n return color;\n }\n },\n hsla: function (h, s, l, a) {\n let m1;\n let m2;\n\n function hue(h) {\n h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);\n if (h * 6 < 1) {\n return m1 + (m2 - m1) * h * 6;\n }\n else if (h * 2 < 1) {\n return m2;\n }\n else if (h * 3 < 2) {\n return m1 + (m2 - m1) * (2 / 3 - h) * 6;\n }\n else {\n return m1;\n }\n }\n\n try {\n if (h instanceof Color) {\n if (s) {\n a = number(s);\n } else {\n a = h.alpha;\n }\n return new Color(h.rgb, a, 'hsla');\n }\n\n h = (number(h) % 360) / 360;\n s = clamp(number(s));l = clamp(number(l));a = clamp(number(a));\n\n m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;\n m1 = l * 2 - m2;\n\n const rgb = [\n hue(h + 1 / 3) * 255,\n hue(h) * 255,\n hue(h - 1 / 3) * 255\n ];\n a = number(a);\n return new Color(rgb, a, 'hsla');\n }\n catch (e) {}\n },\n\n hsv: function(h, s, v) {\n return colorFunctions.hsva(h, s, v, 1.0);\n },\n\n hsva: function(h, s, v, a) {\n h = ((number(h) % 360) / 360) * 360;\n s = number(s);v = number(v);a = number(a);\n\n let i;\n let f;\n i = Math.floor((h / 60) % 6);\n f = (h / 60) - i;\n\n const vs = [v,\n v * (1 - s),\n v * (1 - f * s),\n v * (1 - (1 - f) * s)];\n const perm = [[0, 3, 1],\n [2, 0, 1],\n [1, 0, 3],\n [1, 2, 0],\n [3, 1, 0],\n [0, 1, 2]];\n\n return colorFunctions.rgba(vs[perm[i][0]] * 255,\n vs[perm[i][1]] * 255,\n vs[perm[i][2]] * 255,\n a);\n },\n\n hue: function (color) {\n return new Dimension(toHSL(color).h);\n },\n saturation: function (color) {\n return new Dimension(toHSL(color).s * 100, '%');\n },\n lightness: function (color) {\n return new Dimension(toHSL(color).l * 100, '%');\n },\n hsvhue: function(color) {\n return new Dimension(toHSV(color).h);\n },\n hsvsaturation: function (color) {\n return new Dimension(toHSV(color).s * 100, '%');\n },\n hsvvalue: function (color) {\n return new Dimension(toHSV(color).v * 100, '%');\n },\n red: function (color) {\n return new Dimension(color.rgb[0]);\n },\n green: function (color) {\n return new Dimension(color.rgb[1]);\n },\n blue: function (color) {\n return new Dimension(color.rgb[2]);\n },\n alpha: function (color) {\n return new Dimension(toHSL(color).a);\n },\n luma: function (color) {\n return new Dimension(color.luma() * color.alpha * 100, '%');\n },\n luminance: function (color) {\n const luminance =\n (0.2126 * color.rgb[0] / 255) +\n (0.7152 * color.rgb[1] / 255) +\n (0.0722 * color.rgb[2] / 255);\n\n return new Dimension(luminance * color.alpha * 100, '%');\n },\n saturate: function (color, amount, method) {\n // filter: saturate(3.2);\n // should be kept as is, so check for color\n if (!color.rgb) {\n return null;\n }\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.s += hsl.s * amount.value / 100;\n }\n else {\n hsl.s += amount.value / 100;\n }\n hsl.s = clamp(hsl.s);\n return hsla(color, hsl);\n },\n desaturate: function (color, amount, method) {\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.s -= hsl.s * amount.value / 100;\n }\n else {\n hsl.s -= amount.value / 100;\n }\n hsl.s = clamp(hsl.s);\n return hsla(color, hsl);\n },\n lighten: function (color, amount, method) {\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.l += hsl.l * amount.value / 100;\n }\n else {\n hsl.l += amount.value / 100;\n }\n hsl.l = clamp(hsl.l);\n return hsla(color, hsl);\n },\n darken: function (color, amount, method) {\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.l -= hsl.l * amount.value / 100;\n }\n else {\n hsl.l -= amount.value / 100;\n }\n hsl.l = clamp(hsl.l);\n return hsla(color, hsl);\n },\n fadein: function (color, amount, method) {\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.a += hsl.a * amount.value / 100;\n }\n else {\n hsl.a += amount.value / 100;\n }\n hsl.a = clamp(hsl.a);\n return hsla(color, hsl);\n },\n fadeout: function (color, amount, method) {\n const hsl = toHSL(color);\n\n if (typeof method !== 'undefined' && method.value === 'relative') {\n hsl.a -= hsl.a * amount.value / 100;\n }\n else {\n hsl.a -= amount.value / 100;\n }\n hsl.a = clamp(hsl.a);\n return hsla(color, hsl);\n },\n fade: function (color, amount) {\n const hsl = toHSL(color);\n\n hsl.a = amount.value / 100;\n hsl.a = clamp(hsl.a);\n return hsla(color, hsl);\n },\n spin: function (color, amount) {\n const hsl = toHSL(color);\n const hue = (hsl.h + amount.value) % 360;\n\n hsl.h = hue < 0 ? 360 + hue : hue;\n\n return hsla(color, hsl);\n },\n //\n // Copyright (c) 2006-2009 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein\n // http://sass-lang.com\n //\n mix: function (color1, color2, weight) {\n if (!weight) {\n weight = new Dimension(50);\n }\n const p = weight.value / 100.0;\n const w = p * 2 - 1;\n const a = toHSL(color1).a - toHSL(color2).a;\n\n const w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;\n const w2 = 1 - w1;\n\n const rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2,\n color1.rgb[1] * w1 + color2.rgb[1] * w2,\n color1.rgb[2] * w1 + color2.rgb[2] * w2];\n\n const alpha = color1.alpha * p + color2.alpha * (1 - p);\n\n return new Color(rgb, alpha);\n },\n greyscale: function (color) {\n return colorFunctions.desaturate(color, new Dimension(100));\n },\n contrast: function (color, dark, light, threshold) {\n // filter: contrast(3.2);\n // should be kept as is, so check for color\n if (!color.rgb) {\n return null;\n }\n if (typeof light === 'undefined') {\n light = colorFunctions.rgba(255, 255, 255, 1.0);\n }\n if (typeof dark === 'undefined') {\n dark = colorFunctions.rgba(0, 0, 0, 1.0);\n }\n // Figure out which is actually light and dark:\n if (dark.luma() > light.luma()) {\n const t = light;\n light = dark;\n dark = t;\n }\n if (typeof threshold === 'undefined') {\n threshold = 0.43;\n } else {\n threshold = number(threshold);\n }\n if (color.luma() < threshold) {\n return light;\n } else {\n return dark;\n }\n },\n // Changes made in 2.7.0 - Reverted in 3.0.0\n // contrast: function (color, color1, color2, threshold) {\n // // Return which of `color1` and `color2` has the greatest contrast with `color`\n // // according to the standard WCAG contrast ratio calculation.\n // // http://www.w3.org/TR/WCAG20/#contrast-ratiodef\n // // The threshold param is no longer used, in line with SASS.\n // // filter: contrast(3.2);\n // // should be kept as is, so check for color\n // if (!color.rgb) {\n // return null;\n // }\n // if (typeof color1 === 'undefined') {\n // color1 = colorFunctions.rgba(0, 0, 0, 1.0);\n // }\n // if (typeof color2 === 'undefined') {\n // color2 = colorFunctions.rgba(255, 255, 255, 1.0);\n // }\n // var contrast1, contrast2;\n // var luma = color.luma();\n // var luma1 = color1.luma();\n // var luma2 = color2.luma();\n // // Calculate contrast ratios for each color\n // if (luma > luma1) {\n // contrast1 = (luma + 0.05) / (luma1 + 0.05);\n // } else {\n // contrast1 = (luma1 + 0.05) / (luma + 0.05);\n // }\n // if (luma > luma2) {\n // contrast2 = (luma + 0.05) / (luma2 + 0.05);\n // } else {\n // contrast2 = (luma2 + 0.05) / (luma + 0.05);\n // }\n // if (contrast1 > contrast2) {\n // return color1;\n // } else {\n // return color2;\n // }\n // },\n argb: function (color) {\n return new Anonymous(color.toARGB());\n },\n color: function(c) {\n if ((c instanceof Quoted) &&\n (/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})$/i.test(c.value))) {\n const val = c.value.slice(1);\n return new Color(val, undefined, `#${val}`);\n }\n if ((c instanceof Color) || (c = Color.fromKeyword(c.value))) {\n c.value = undefined;\n return c;\n }\n throw {\n type: 'Argument',\n message: 'argument must be a color keyword or 3|4|6|8 digit hex e.g. #FFF'\n };\n },\n tint: function(color, amount) {\n return colorFunctions.mix(colorFunctions.rgb(255, 255, 255), color, amount);\n },\n shade: function(color, amount) {\n return colorFunctions.mix(colorFunctions.rgb(0, 0, 0), color, amount);\n }\n};\n\nexport default colorFunctions;\n","import Color from '../tree/color';\n\n// Color Blending\n// ref: http://www.w3.org/TR/compositing-1\n\nfunction colorBlend(mode, color1, color2) {\n const ab = color1.alpha; // result\n\n let // backdrop\n cb;\n\n const as = color2.alpha;\n\n let // source\n cs;\n\n let ar;\n let cr;\n const r = [];\n\n ar = as + ab * (1 - as);\n for (let i = 0; i < 3; i++) {\n cb = color1.rgb[i] / 255;\n cs = color2.rgb[i] / 255;\n cr = mode(cb, cs);\n if (ar) {\n cr = (as * cs + ab * (cb -\n as * (cb + cs - cr))) / ar;\n }\n r[i] = cr * 255;\n }\n\n return new Color(r, ar);\n}\n\nconst colorBlendModeFunctions = {\n multiply: function(cb, cs) {\n return cb * cs;\n },\n screen: function(cb, cs) {\n return cb + cs - cb * cs;\n },\n overlay: function(cb, cs) {\n cb *= 2;\n return (cb <= 1) ?\n colorBlendModeFunctions.multiply(cb, cs) :\n colorBlendModeFunctions.screen(cb - 1, cs);\n },\n softlight: function(cb, cs) {\n let d = 1;\n let e = cb;\n if (cs > 0.5) {\n e = 1;\n d = (cb > 0.25) ? Math.sqrt(cb)\n : ((16 * cb - 12) * cb + 4) * cb;\n }\n return cb - (1 - 2 * cs) * e * (d - cb);\n },\n hardlight: function(cb, cs) {\n return colorBlendModeFunctions.overlay(cs, cb);\n },\n difference: function(cb, cs) {\n return Math.abs(cb - cs);\n },\n exclusion: function(cb, cs) {\n return cb + cs - 2 * cb * cs;\n },\n\n // non-w3c functions:\n average: function(cb, cs) {\n return (cb + cs) / 2;\n },\n negation: function(cb, cs) {\n return 1 - Math.abs(cb + cs - 1);\n }\n};\n\nfor (const f in colorBlendModeFunctions) {\n // eslint-disable-next-line no-prototype-builtins\n if (colorBlendModeFunctions.hasOwnProperty(f)) {\n colorBlend[f] = colorBlend.bind(null, colorBlendModeFunctions[f]);\n }\n}\n\nexport default colorBlend;\n","import Quoted from '../tree/quoted';\nimport URL from '../tree/url';\nimport * as utils from '../utils';\nimport logger from '../logger';\n\nexport default environment => {\n \n const fallback = (functionThis, node) => new URL(node, functionThis.index, functionThis.currentFileInfo).eval(functionThis.context); \n\n return { 'data-uri': function(mimetypeNode, filePathNode) {\n\n if (!filePathNode) {\n filePathNode = mimetypeNode;\n mimetypeNode = null;\n }\n\n let mimetype = mimetypeNode && mimetypeNode.value;\n let filePath = filePathNode.value;\n const currentFileInfo = this.currentFileInfo;\n const currentDirectory = currentFileInfo.rewriteUrls ?\n currentFileInfo.currentDirectory : currentFileInfo.entryPath;\n\n const fragmentStart = filePath.indexOf('#');\n let fragment = '';\n if (fragmentStart !== -1) {\n fragment = filePath.slice(fragmentStart);\n filePath = filePath.slice(0, fragmentStart);\n }\n const context = utils.clone(this.context);\n context.rawBuffer = true;\n\n const fileManager = environment.getFileManager(filePath, currentDirectory, context, environment, true);\n\n if (!fileManager) {\n return fallback(this, filePathNode);\n }\n\n let useBase64 = false;\n\n // detect the mimetype if not given\n if (!mimetypeNode) {\n\n mimetype = environment.mimeLookup(filePath);\n\n if (mimetype === 'image/svg+xml') {\n useBase64 = false;\n } else {\n // use base 64 unless it's an ASCII or UTF-8 format\n const charset = environment.charsetLookup(mimetype);\n useBase64 = ['US-ASCII', 'UTF-8'].indexOf(charset) < 0;\n }\n if (useBase64) { mimetype += ';base64'; }\n }\n else {\n useBase64 = /;base64$/.test(mimetype);\n }\n\n const fileSync = fileManager.loadFileSync(filePath, currentDirectory, context, environment);\n if (!fileSync.contents) {\n logger.warn(`Skipped data-uri embedding of ${filePath} because file not found`);\n return fallback(this, filePathNode || mimetypeNode);\n }\n let buf = fileSync.contents;\n if (useBase64 && !environment.encodeBase64) {\n return fallback(this, filePathNode);\n }\n\n buf = useBase64 ? environment.encodeBase64(buf) : encodeURIComponent(buf);\n\n const uri = `data:${mimetype},${buf}${fragment}`;\n\n return new URL(new Quoted(`\"${uri}\"`, uri, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo);\n }};\n};\n","import Comment from '../tree/comment';\nimport Node from '../tree/node';\nimport Dimension from '../tree/dimension';\nimport Declaration from '../tree/declaration';\nimport Expression from '../tree/expression';\nimport Ruleset from '../tree/ruleset';\nimport Selector from '../tree/selector';\nimport Element from '../tree/element';\nimport Quote from '../tree/quoted';\nimport Value from '../tree/value';\n\nconst getItemsFromNode = node => {\n // handle non-array values as an array of length 1\n // return 'undefined' if index is invalid\n const items = Array.isArray(node.value) ?\n node.value : Array(node);\n\n return items;\n};\n\nexport default {\n _SELF: function(n) {\n return n;\n },\n '~': function(...expr) {\n if (expr.length === 1) {\n return expr[0];\n }\n return new Value(expr);\n },\n extract: function(values, index) {\n // (1-based index)\n index = index.value - 1;\n\n return getItemsFromNode(values)[index];\n },\n length: function(values) {\n return new Dimension(getItemsFromNode(values).length);\n },\n /**\n * Creates a Less list of incremental values.\n * Modeled after Lodash's range function, also exists natively in PHP\n * \n * @param {Dimension} [start=1]\n * @param {Dimension} end - e.g. 10 or 10px - unit is added to output\n * @param {Dimension} [step=1] \n */\n range: function(start, end, step) {\n let from;\n let to;\n let stepValue = 1;\n const list = [];\n if (end) {\n to = end;\n from = start.value;\n if (step) {\n stepValue = step.value;\n }\n }\n else {\n from = 1;\n to = start;\n }\n\n for (let i = from; i <= to.value; i += stepValue) {\n list.push(new Dimension(i, to.unit));\n }\n\n return new Expression(list);\n },\n each: function(list, rs) {\n const rules = [];\n let newRules;\n let iterator;\n\n const tryEval = val => {\n if (val instanceof Node) {\n return val.eval(this.context);\n }\n return val;\n };\n\n if (list.value && !(list instanceof Quote)) {\n if (Array.isArray(list.value)) {\n iterator = list.value.map(tryEval);\n } else {\n iterator = [tryEval(list.value)];\n }\n } else if (list.ruleset) {\n iterator = tryEval(list.ruleset).rules;\n } else if (list.rules) {\n iterator = list.rules.map(tryEval);\n } else if (Array.isArray(list)) {\n iterator = list.map(tryEval);\n } else {\n iterator = [tryEval(list)];\n }\n\n let valueName = '@value';\n let keyName = '@key';\n let indexName = '@index';\n\n if (rs.params) {\n valueName = rs.params[0] && rs.params[0].name;\n keyName = rs.params[1] && rs.params[1].name;\n indexName = rs.params[2] && rs.params[2].name;\n rs = rs.rules;\n } else {\n rs = rs.ruleset;\n }\n\n for (let i = 0; i < iterator.length; i++) {\n let key;\n let value;\n const item = iterator[i];\n if (item instanceof Declaration) {\n key = typeof item.name === 'string' ? item.name : item.name[0].value;\n value = item.value;\n } else {\n key = new Dimension(i + 1);\n value = item;\n }\n\n if (item instanceof Comment) {\n continue;\n }\n\n newRules = rs.rules.slice(0);\n if (valueName) {\n newRules.push(new Declaration(valueName,\n value,\n false, false, this.index, this.currentFileInfo));\n }\n if (indexName) {\n newRules.push(new Declaration(indexName,\n new Dimension(i + 1),\n false, false, this.index, this.currentFileInfo));\n }\n if (keyName) {\n newRules.push(new Declaration(keyName,\n key,\n false, false, this.index, this.currentFileInfo));\n }\n\n rules.push(new Ruleset([ new(Selector)([ new Element('', '&') ]) ],\n newRules,\n rs.strictImports,\n rs.visibilityInfo()\n ));\n }\n\n return new Ruleset([ new(Selector)([ new Element('', '&') ]) ],\n rules,\n rs.strictImports,\n rs.visibilityInfo()\n ).eval(this.context);\n }\n};\n","import Dimension from '../tree/dimension';\n\nconst MathHelper = (fn, unit, n) => {\n if (!(n instanceof Dimension)) {\n throw { type: 'Argument', message: 'argument must be a number' };\n }\n if (unit === null) {\n unit = n.unit;\n } else {\n n = n.unify();\n }\n return new Dimension(fn(parseFloat(n.value)), unit);\n};\n\nexport default MathHelper;","import mathHelper from './math-helper.js';\n\nconst mathFunctions = {\n // name, unit\n ceil: null,\n floor: null,\n sqrt: null,\n abs: null,\n tan: '',\n sin: '',\n cos: '',\n atan: 'rad',\n asin: 'rad',\n acos: 'rad'\n};\n\nfor (const f in mathFunctions) {\n // eslint-disable-next-line no-prototype-builtins\n if (mathFunctions.hasOwnProperty(f)) {\n mathFunctions[f] = mathHelper.bind(null, Math[f], mathFunctions[f]);\n }\n}\n\nmathFunctions.round = (n, f) => {\n const fraction = typeof f === 'undefined' ? 0 : f.value;\n return mathHelper(num => num.toFixed(fraction), null, n);\n};\n\nexport default mathFunctions;\n","import Dimension from '../tree/dimension';\nimport Anonymous from '../tree/anonymous';\nimport mathHelper from './math-helper.js';\n\nconst minMax = function (isMin, args) {\n args = Array.prototype.slice.call(args);\n switch (args.length) {\n case 0: throw { type: 'Argument', message: 'one or more arguments required' };\n }\n let i; // key is the unit.toString() for unified Dimension values,\n let j;\n let current;\n let currentUnified;\n let referenceUnified;\n let unit;\n let unitStatic;\n let unitClone;\n\n const // elems only contains original argument values.\n order = [];\n\n const values = {};\n // value is the index into the order array.\n for (i = 0; i < args.length; i++) {\n current = args[i];\n if (!(current instanceof Dimension)) {\n if (Array.isArray(args[i].value)) {\n Array.prototype.push.apply(args, Array.prototype.slice.call(args[i].value));\n continue;\n } else {\n throw { type: 'Argument', message: 'incompatible types' };\n }\n }\n currentUnified = current.unit.toString() === '' && unitClone !== undefined ? new Dimension(current.value, unitClone).unify() : current.unify();\n unit = currentUnified.unit.toString() === '' && unitStatic !== undefined ? unitStatic : currentUnified.unit.toString();\n unitStatic = unit !== '' && unitStatic === undefined || unit !== '' && order[0].unify().unit.toString() === '' ? unit : unitStatic;\n unitClone = unit !== '' && unitClone === undefined ? current.unit.toString() : unitClone;\n j = values[''] !== undefined && unit !== '' && unit === unitStatic ? values[''] : values[unit];\n if (j === undefined) {\n if (unitStatic !== undefined && unit !== unitStatic) {\n throw { type: 'Argument', message: 'incompatible types' };\n }\n values[unit] = order.length;\n order.push(current);\n continue;\n }\n referenceUnified = order[j].unit.toString() === '' && unitClone !== undefined ? new Dimension(order[j].value, unitClone).unify() : order[j].unify();\n if ( isMin && currentUnified.value < referenceUnified.value ||\n !isMin && currentUnified.value > referenceUnified.value) {\n order[j] = current;\n }\n }\n if (order.length == 1) {\n return order[0];\n }\n args = order.map(a => { return a.toCSS(this.context); }).join(this.context.compress ? ',' : ', ');\n return new Anonymous(`${isMin ? 'min' : 'max'}(${args})`);\n};\n\nexport default {\n min: function(...args) {\n try {\n return minMax.call(this, true, args);\n } catch (e) {}\n },\n max: function(...args) {\n try {\n return minMax.call(this, false, args);\n } catch (e) {}\n },\n convert: function (val, unit) {\n return val.convertTo(unit.value);\n },\n pi: function () {\n return new Dimension(Math.PI);\n },\n mod: function(a, b) {\n return new Dimension(a.value % b.value, a.unit);\n },\n pow: function(x, y) {\n if (typeof x === 'number' && typeof y === 'number') {\n x = new Dimension(x);\n y = new Dimension(y);\n } else if (!(x instanceof Dimension) || !(y instanceof Dimension)) {\n throw { type: 'Argument', message: 'arguments must be numbers' };\n }\n\n return new Dimension(Math.pow(x.value, y.value), x.unit);\n },\n percentage: function (n) {\n const result = mathHelper(num => num * 100, '%', n);\n\n return result;\n }\n};\n","import Quoted from '../tree/quoted';\nimport Anonymous from '../tree/anonymous';\nimport JavaScript from '../tree/javascript';\n\nexport default {\n e: function (str) {\n return new Quoted('\"', str instanceof JavaScript ? str.evaluated : str.value, true);\n },\n escape: function (str) {\n return new Anonymous(\n encodeURI(str.value).replace(/=/g, '%3D').replace(/:/g, '%3A').replace(/#/g, '%23').replace(/;/g, '%3B')\n .replace(/\\(/g, '%28').replace(/\\)/g, '%29'));\n },\n replace: function (string, pattern, replacement, flags) {\n let result = string.value;\n replacement = (replacement.type === 'Quoted') ?\n replacement.value : replacement.toCSS();\n result = result.replace(new RegExp(pattern.value, flags ? flags.value : ''), replacement);\n return new Quoted(string.quote || '', result, string.escaped);\n },\n '%': function (string /* arg, arg, ... */) {\n const args = Array.prototype.slice.call(arguments, 1);\n let result = string.value;\n\n for (let i = 0; i < args.length; i++) {\n /* jshint loopfunc:true */\n result = result.replace(/%[sda]/i, token => {\n const value = ((args[i].type === 'Quoted') &&\n token.match(/s/i)) ? args[i].value : args[i].toCSS();\n return token.match(/[A-Z]$/) ? encodeURIComponent(value) : value;\n });\n }\n result = result.replace(/%%/g, '%');\n return new Quoted(string.quote || '', result, string.escaped);\n }\n};\n","import Keyword from '../tree/keyword';\nimport DetachedRuleset from '../tree/detached-ruleset';\nimport Dimension from '../tree/dimension';\nimport Color from '../tree/color';\nimport Quoted from '../tree/quoted';\nimport Anonymous from '../tree/anonymous';\nimport URL from '../tree/url';\nimport Operation from '../tree/operation';\n\nconst isa = (n, Type) => (n instanceof Type) ? Keyword.True : Keyword.False;\nconst isunit = (n, unit) => {\n if (unit === undefined) {\n throw { type: 'Argument', message: 'missing the required second argument to isunit.' };\n }\n unit = typeof unit.value === 'string' ? unit.value : unit;\n if (typeof unit !== 'string') {\n throw { type: 'Argument', message: 'Second argument to isunit should be a unit or a string.' };\n }\n return (n instanceof Dimension) && n.unit.is(unit) ? Keyword.True : Keyword.False;\n};\n\nexport default {\n isruleset: function (n) {\n return isa(n, DetachedRuleset);\n },\n iscolor: function (n) {\n return isa(n, Color);\n },\n isnumber: function (n) {\n return isa(n, Dimension);\n },\n isstring: function (n) {\n return isa(n, Quoted);\n },\n iskeyword: function (n) {\n return isa(n, Keyword);\n },\n isurl: function (n) {\n return isa(n, URL);\n },\n ispixel: function (n) {\n return isunit(n, 'px');\n },\n ispercentage: function (n) {\n return isunit(n, '%');\n },\n isem: function (n) {\n return isunit(n, 'em');\n },\n isunit,\n unit: function (val, unit) {\n if (!(val instanceof Dimension)) {\n throw { type: 'Argument',\n message: `the first argument to unit must be a number${val instanceof Operation ? '. Have you forgotten parenthesis?' : ''}` };\n }\n if (unit) {\n if (unit instanceof Keyword) {\n unit = unit.value;\n } else {\n unit = unit.toCSS();\n }\n } else {\n unit = '';\n }\n return new Dimension(val.value, unit);\n },\n 'get-unit': function (n) {\n return new Anonymous(n.unit);\n }\n};\n","import Variable from '../tree/variable';\nimport Anonymous from '../tree/variable';\n\nconst styleExpression = function (args) {\n args = Array.prototype.slice.call(args);\n switch (args.length) {\n case 0: throw { type: 'Argument', message: 'one or more arguments required' };\n }\n \n const entityList = [new Variable(args[0].value, this.index, this.currentFileInfo).eval(this.context)];\n \n args = entityList.map(a => { return a.toCSS(this.context); }).join(this.context.compress ? ',' : ', ');\n \n return new Anonymous(`style(${args})`);\n};\n\nexport default {\n style: function(...args) {\n try {\n return styleExpression.call(this, args);\n } catch (e) {}\n },\n};\n","import functionRegistry from './function-registry';\nimport functionCaller from './function-caller';\n\nimport boolean from './boolean';\nimport defaultFunc from './default';\nimport color from './color';\nimport colorBlending from './color-blending';\nimport dataUri from './data-uri';\nimport list from './list';\nimport math from './math';\nimport number from './number';\nimport string from './string';\nimport svg from './svg';\nimport types from './types';\nimport style from './style';\n\nexport default environment => {\n const functions = { functionRegistry, functionCaller };\n\n // register functions\n functionRegistry.addMultiple(boolean);\n functionRegistry.add('default', defaultFunc.eval.bind(defaultFunc));\n functionRegistry.addMultiple(color);\n functionRegistry.addMultiple(colorBlending);\n functionRegistry.addMultiple(dataUri(environment));\n functionRegistry.addMultiple(list);\n functionRegistry.addMultiple(math);\n functionRegistry.addMultiple(number);\n functionRegistry.addMultiple(string);\n functionRegistry.addMultiple(svg(environment));\n functionRegistry.addMultiple(types);\n functionRegistry.addMultiple(style);\n\n return functions;\n};\n","import Dimension from '../tree/dimension';\nimport Color from '../tree/color';\nimport Expression from '../tree/expression';\nimport Quoted from '../tree/quoted';\nimport URL from '../tree/url';\n\nexport default () => {\n return { 'svg-gradient': function(direction) {\n let stops;\n let gradientDirectionSvg;\n let gradientType = 'linear';\n let rectangleDimension = 'x=\"0\" y=\"0\" width=\"1\" height=\"1\"';\n const renderEnv = {compress: false};\n let returner;\n const directionValue = direction.toCSS(renderEnv);\n let i;\n let color;\n let position;\n let positionValue;\n let alpha;\n\n function throwArgumentDescriptor() {\n throw { type: 'Argument',\n message: 'svg-gradient expects direction, start_color [start_position], [color position,]...,' +\n ' end_color [end_position] or direction, color list' };\n }\n\n if (arguments.length == 2) {\n if (arguments[1].value.length < 2) {\n throwArgumentDescriptor();\n }\n stops = arguments[1].value;\n } else if (arguments.length < 3) {\n throwArgumentDescriptor();\n } else {\n stops = Array.prototype.slice.call(arguments, 1);\n }\n\n switch (directionValue) {\n case 'to bottom':\n gradientDirectionSvg = 'x1=\"0%\" y1=\"0%\" x2=\"0%\" y2=\"100%\"';\n break;\n case 'to right':\n gradientDirectionSvg = 'x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"0%\"';\n break;\n case 'to bottom right':\n gradientDirectionSvg = 'x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\"';\n break;\n case 'to top right':\n gradientDirectionSvg = 'x1=\"0%\" y1=\"100%\" x2=\"100%\" y2=\"0%\"';\n break;\n case 'ellipse':\n case 'ellipse at center':\n gradientType = 'radial';\n gradientDirectionSvg = 'cx=\"50%\" cy=\"50%\" r=\"75%\"';\n rectangleDimension = 'x=\"-50\" y=\"-50\" width=\"101\" height=\"101\"';\n break;\n default:\n throw { type: 'Argument', message: 'svg-gradient direction must be \\'to bottom\\', \\'to right\\',' +\n ' \\'to bottom right\\', \\'to top right\\' or \\'ellipse at center\\'' };\n }\n returner = `<${gradientType}Gradient id=\"g\" ${gradientDirectionSvg}>`;\n\n for (i = 0; i < stops.length; i += 1) {\n if (stops[i] instanceof Expression) {\n color = stops[i].value[0];\n position = stops[i].value[1];\n } else {\n color = stops[i];\n position = undefined;\n }\n\n if (!(color instanceof Color) || (!((i === 0 || i + 1 === stops.length) && position === undefined) && !(position instanceof Dimension))) {\n throwArgumentDescriptor();\n }\n positionValue = position ? position.toCSS(renderEnv) : i === 0 ? '0%' : '100%';\n alpha = color.alpha;\n returner += ``;\n }\n returner += ``;\n\n returner = encodeURIComponent(returner);\n\n returner = `data:image/svg+xml,${returner}`;\n return new URL(new Quoted(`'${returner}'`, returner, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo);\n }};\n};\n","import contexts from './contexts';\nimport visitor from './visitors';\nimport tree from './tree';\n\nexport default function(root, options) {\n options = options || {};\n let evaldRoot;\n let variables = options.variables;\n const evalEnv = new contexts.Eval(options);\n\n //\n // Allows setting variables with a hash, so:\n //\n // `{ color: new tree.Color('#f01') }` will become:\n //\n // new tree.Declaration('@color',\n // new tree.Value([\n // new tree.Expression([\n // new tree.Color('#f01')\n // ])\n // ])\n // )\n //\n if (typeof variables === 'object' && !Array.isArray(variables)) {\n variables = Object.keys(variables).map(function (k) {\n let value = variables[k];\n\n if (!(value instanceof tree.Value)) {\n if (!(value instanceof tree.Expression)) {\n value = new tree.Expression([value]);\n }\n value = new tree.Value([value]);\n }\n return new tree.Declaration(`@${k}`, value, false, null, 0);\n });\n evalEnv.frames = [new tree.Ruleset(null, variables)];\n }\n\n const visitors = [\n new visitor.JoinSelectorVisitor(),\n new visitor.MarkVisibleSelectorsVisitor(true),\n new visitor.ExtendVisitor(),\n new visitor.ToCSSVisitor({compress: Boolean(options.compress)})\n ];\n\n const preEvalVisitors = [];\n let v;\n let visitorIterator;\n\n /**\n * first() / get() allows visitors to be added while visiting\n * \n * @todo Add scoping for visitors just like functions for @plugin; right now they're global\n */\n if (options.pluginManager) {\n visitorIterator = options.pluginManager.visitor();\n for (let i = 0; i < 2; i++) {\n visitorIterator.first();\n while ((v = visitorIterator.get())) {\n if (v.isPreEvalVisitor) {\n if (i === 0 || preEvalVisitors.indexOf(v) === -1) {\n preEvalVisitors.push(v);\n v.run(root);\n }\n }\n else {\n if (i === 0 || visitors.indexOf(v) === -1) {\n if (v.isPreVisitor) {\n visitors.unshift(v);\n }\n else {\n visitors.push(v);\n }\n }\n }\n }\n }\n }\n\n evaldRoot = root.eval(evalEnv);\n\n for (let i = 0; i < visitors.length; i++) {\n visitors[i].run(evaldRoot);\n }\n\n // Run any remaining visitors added after eval pass\n if (options.pluginManager) {\n visitorIterator.first();\n while ((v = visitorIterator.get())) {\n if (visitors.indexOf(v) === -1 && preEvalVisitors.indexOf(v) === -1) {\n v.run(evaldRoot);\n }\n }\n }\n\n return evaldRoot;\n}\n","/**\n * Plugin Manager\n */\nclass PluginManager {\n constructor(less) {\n this.less = less;\n this.visitors = [];\n this.preProcessors = [];\n this.postProcessors = [];\n this.installedPlugins = [];\n this.fileManagers = [];\n this.iterator = -1;\n this.pluginCache = {};\n this.Loader = new less.PluginLoader(less);\n }\n\n /**\n * Adds all the plugins in the array\n * @param {Array} plugins\n */\n addPlugins(plugins) {\n if (plugins) {\n for (let i = 0; i < plugins.length; i++) {\n this.addPlugin(plugins[i]);\n }\n }\n }\n\n /**\n *\n * @param plugin\n * @param {String} filename\n */\n addPlugin(plugin, filename, functionRegistry) {\n this.installedPlugins.push(plugin);\n if (filename) {\n this.pluginCache[filename] = plugin;\n }\n if (plugin.install) {\n plugin.install(this.less, this, functionRegistry || this.less.functions.functionRegistry);\n }\n }\n\n /**\n *\n * @param filename\n */\n get(filename) {\n return this.pluginCache[filename];\n }\n\n /**\n * Adds a visitor. The visitor object has options on itself to determine\n * when it should run.\n * @param visitor\n */\n addVisitor(visitor) {\n this.visitors.push(visitor);\n }\n\n /**\n * Adds a pre processor object\n * @param {object} preProcessor\n * @param {number} priority - guidelines 1 = before import, 1000 = import, 2000 = after import\n */\n addPreProcessor(preProcessor, priority) {\n let indexToInsertAt;\n for (indexToInsertAt = 0; indexToInsertAt < this.preProcessors.length; indexToInsertAt++) {\n if (this.preProcessors[indexToInsertAt].priority >= priority) {\n break;\n }\n }\n this.preProcessors.splice(indexToInsertAt, 0, {preProcessor, priority});\n }\n\n /**\n * Adds a post processor object\n * @param {object} postProcessor\n * @param {number} priority - guidelines 1 = before compression, 1000 = compression, 2000 = after compression\n */\n addPostProcessor(postProcessor, priority) {\n let indexToInsertAt;\n for (indexToInsertAt = 0; indexToInsertAt < this.postProcessors.length; indexToInsertAt++) {\n if (this.postProcessors[indexToInsertAt].priority >= priority) {\n break;\n }\n }\n this.postProcessors.splice(indexToInsertAt, 0, {postProcessor, priority});\n }\n\n /**\n *\n * @param manager\n */\n addFileManager(manager) {\n this.fileManagers.push(manager);\n }\n\n /**\n *\n * @returns {Array}\n * @private\n */\n getPreProcessors() {\n const preProcessors = [];\n for (let i = 0; i < this.preProcessors.length; i++) {\n preProcessors.push(this.preProcessors[i].preProcessor);\n }\n return preProcessors;\n }\n\n /**\n *\n * @returns {Array}\n * @private\n */\n getPostProcessors() {\n const postProcessors = [];\n for (let i = 0; i < this.postProcessors.length; i++) {\n postProcessors.push(this.postProcessors[i].postProcessor);\n }\n return postProcessors;\n }\n\n /**\n *\n * @returns {Array}\n * @private\n */\n getVisitors() {\n return this.visitors;\n }\n\n visitor() {\n const self = this;\n return {\n first: function() {\n self.iterator = -1;\n return self.visitors[self.iterator];\n },\n get: function() {\n self.iterator += 1;\n return self.visitors[self.iterator];\n }\n };\n }\n\n /**\n *\n * @returns {Array}\n * @private\n */\n getFileManagers() {\n return this.fileManagers;\n }\n}\n\nlet pm;\n\nconst PluginManagerFactory = function(less, newFactory) {\n if (newFactory || !pm) {\n pm = new PluginManager(less);\n }\n return pm;\n};\n\n//\nexport default PluginManagerFactory;\n","'use strict';\n\nfunction parseNodeVersion(version) {\n var match = version.match(/^v(\\d{1,2})\\.(\\d{1,2})\\.(\\d{1,2})(?:-([0-9A-Za-z-.]+))?(?:\\+([0-9A-Za-z-.]+))?$/); // eslint-disable-line max-len\n if (!match) {\n throw new Error('Unable to parse: ' + version);\n }\n\n var res = {\n major: parseInt(match[1], 10),\n minor: parseInt(match[2], 10),\n patch: parseInt(match[3], 10),\n pre: match[4] || '',\n build: match[5] || '',\n };\n\n return res;\n}\n\nmodule.exports = parseNodeVersion;\n","import AbstractFileManager from '../less/environment/abstract-file-manager.js';\n\nlet options;\nlet logger;\nlet fileCache = {};\n\n// TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load\nconst FileManager = function() {}\nFileManager.prototype = Object.assign(new AbstractFileManager(), {\n alwaysMakePathsAbsolute() {\n return true;\n },\n\n join(basePath, laterPath) {\n if (!basePath) {\n return laterPath;\n }\n return this.extractUrlParts(laterPath, basePath).path;\n },\n\n doXHR(url, type, callback, errback) {\n const xhr = new XMLHttpRequest();\n const async = options.isFileProtocol ? options.fileAsync : true;\n\n if (typeof xhr.overrideMimeType === 'function') {\n xhr.overrideMimeType('text/css');\n }\n logger.debug(`XHR: Getting '${url}'`);\n xhr.open('GET', url, async);\n xhr.setRequestHeader('Accept', type || 'text/x-less, text/css; q=0.9, */*; q=0.5');\n xhr.send(null);\n\n function handleResponse(xhr, callback, errback) {\n if (xhr.status >= 200 && xhr.status < 300) {\n callback(xhr.responseText,\n xhr.getResponseHeader('Last-Modified'));\n } else if (typeof errback === 'function') {\n errback(xhr.status, url);\n }\n }\n\n if (options.isFileProtocol && !options.fileAsync) {\n if (xhr.status === 0 || (xhr.status >= 200 && xhr.status < 300)) {\n callback(xhr.responseText);\n } else {\n errback(xhr.status, url);\n }\n } else if (async) {\n xhr.onreadystatechange = () => {\n if (xhr.readyState == 4) {\n handleResponse(xhr, callback, errback);\n }\n };\n } else {\n handleResponse(xhr, callback, errback);\n }\n },\n\n supports() {\n return true;\n },\n\n clearFileCache() {\n fileCache = {};\n },\n\n loadFile(filename, currentDirectory, options) {\n // TODO: Add prefix support like less-node?\n // What about multiple paths?\n\n if (currentDirectory && !this.isPathAbsolute(filename)) {\n filename = currentDirectory + filename;\n }\n\n filename = options.ext ? this.tryAppendExtension(filename, options.ext) : filename;\n\n options = options || {};\n\n // sheet may be set to the stylesheet for the initial load or a collection of properties including\n // some context variables for imports\n const hrefParts = this.extractUrlParts(filename, window.location.href);\n const href = hrefParts.url;\n const self = this;\n \n return new Promise((resolve, reject) => {\n if (options.useFileCache && fileCache[href]) {\n try {\n const lessText = fileCache[href];\n return resolve({ contents: lessText, filename: href, webInfo: { lastModified: new Date() }});\n } catch (e) {\n return reject({ filename: href, message: `Error loading file ${href} error was ${e.message}` });\n }\n }\n\n self.doXHR(href, options.mime, function doXHRCallback(data, lastModified) {\n // per file cache\n fileCache[href] = data;\n\n // Use remote copy (re-parse)\n resolve({ contents: data, filename: href, webInfo: { lastModified }});\n }, function doXHRError(status, url) {\n reject({ type: 'File', message: `'${url}' wasn't found (${status})`, href });\n });\n });\n }\n});\n\nexport default (opts, log) => {\n options = opts;\n logger = log;\n return FileManager;\n}\n","import Environment from './environment/environment';\nimport data from './data';\nimport tree from './tree';\nimport AbstractFileManager from './environment/abstract-file-manager';\nimport AbstractPluginLoader from './environment/abstract-plugin-loader';\nimport visitors from './visitors';\nimport Parser from './parser/parser';\nimport functions from './functions';\nimport contexts from './contexts';\nimport LessError from './less-error';\nimport transformTree from './transform-tree';\nimport * as utils from './utils';\nimport PluginManager from './plugin-manager';\nimport logger from './logger';\nimport SourceMapOutput from './source-map-output';\nimport SourceMapBuilder from './source-map-builder';\nimport ParseTree from './parse-tree';\nimport ImportManager from './import-manager';\nimport Parse from './parse';\nimport Render from './render';\nimport { version } from '../../package.json';\nimport parseVersion from 'parse-node-version';\n\nexport default function(environment, fileManagers) {\n let sourceMapOutput, sourceMapBuilder, parseTree, importManager;\n\n environment = new Environment(environment, fileManagers);\n sourceMapOutput = SourceMapOutput(environment);\n sourceMapBuilder = SourceMapBuilder(sourceMapOutput, environment);\n parseTree = ParseTree(sourceMapBuilder);\n importManager = ImportManager(environment);\n\n const render = Render(environment, parseTree, importManager);\n const parse = Parse(environment, parseTree, importManager);\n\n const v = parseVersion(`v${version}`);\n const initial = {\n version: [v.major, v.minor, v.patch],\n data,\n tree,\n Environment,\n AbstractFileManager,\n AbstractPluginLoader,\n environment,\n visitors,\n Parser,\n functions: functions(environment),\n contexts,\n SourceMapOutput: sourceMapOutput,\n SourceMapBuilder: sourceMapBuilder,\n ParseTree: parseTree,\n ImportManager: importManager,\n render,\n parse,\n LessError,\n transformTree,\n utils,\n PluginManager,\n logger\n };\n\n // Create a public API\n\n const ctor = function(t) {\n return function() {\n const obj = Object.create(t.prototype);\n t.apply(obj, Array.prototype.slice.call(arguments, 0));\n return obj;\n };\n };\n let t;\n const api = Object.create(initial);\n for (const n in initial.tree) {\n /* eslint guard-for-in: 0 */\n t = initial.tree[n];\n if (typeof t === 'function') {\n api[n.toLowerCase()] = ctor(t);\n }\n else {\n api[n] = Object.create(null);\n for (const o in t) {\n /* eslint guard-for-in: 0 */\n api[n][o.toLowerCase()] = ctor(t[o]);\n }\n }\n }\n\n /**\n * Some of the functions assume a `this` context of the API object,\n * which causes it to fail when wrapped for ES6 imports.\n * \n * An assumed `this` should be removed in the future.\n */\n initial.parse = initial.parse.bind(api);\n initial.render = initial.render.bind(api);\n\n return api;\n}\n","import LessError from './less-error';\nimport transformTree from './transform-tree';\nimport logger from './logger';\n\nexport default function(SourceMapBuilder) {\n class ParseTree {\n constructor(root, imports) {\n this.root = root;\n this.imports = imports;\n }\n\n toCSS(options) {\n let evaldRoot;\n const result = {};\n let sourceMapBuilder;\n try {\n evaldRoot = transformTree(this.root, options);\n } catch (e) {\n throw new LessError(e, this.imports);\n }\n\n try {\n const compress = Boolean(options.compress);\n if (compress) {\n logger.warn('The compress option has been deprecated. ' + \n 'We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.');\n }\n\n const toCSSOptions = {\n compress,\n dumpLineNumbers: options.dumpLineNumbers,\n strictUnits: Boolean(options.strictUnits),\n numPrecision: 8};\n\n if (options.sourceMap) {\n sourceMapBuilder = new SourceMapBuilder(options.sourceMap);\n result.css = sourceMapBuilder.toCSS(evaldRoot, toCSSOptions, this.imports);\n } else {\n result.css = evaldRoot.toCSS(toCSSOptions);\n }\n } catch (e) {\n throw new LessError(e, this.imports);\n }\n\n if (options.pluginManager) {\n const postProcessors = options.pluginManager.getPostProcessors();\n for (let i = 0; i < postProcessors.length; i++) {\n result.css = postProcessors[i].process(result.css, { sourceMap: sourceMapBuilder, options, imports: this.imports });\n }\n }\n if (options.sourceMap) {\n result.map = sourceMapBuilder.getExternalSourceMap();\n }\n\n result.imports = [];\n for (const file in this.imports.files) {\n if (Object.prototype.hasOwnProperty.call(this.imports.files, file) && file !== this.imports.rootFilename) {\n result.imports.push(file);\n }\n }\n return result;\n }\n }\n\n return ParseTree;\n}\n","export default function (SourceMapOutput, environment) {\n class SourceMapBuilder {\n constructor(options) {\n this.options = options;\n }\n\n toCSS(rootNode, options, imports) {\n const sourceMapOutput = new SourceMapOutput(\n {\n contentsIgnoredCharsMap: imports.contentsIgnoredChars,\n rootNode,\n contentsMap: imports.contents,\n sourceMapFilename: this.options.sourceMapFilename,\n sourceMapURL: this.options.sourceMapURL,\n outputFilename: this.options.sourceMapOutputFilename,\n sourceMapBasepath: this.options.sourceMapBasepath,\n sourceMapRootpath: this.options.sourceMapRootpath,\n outputSourceFiles: this.options.outputSourceFiles,\n sourceMapGenerator: this.options.sourceMapGenerator,\n sourceMapFileInline: this.options.sourceMapFileInline, \n disableSourcemapAnnotation: this.options.disableSourcemapAnnotation\n });\n\n const css = sourceMapOutput.toCSS(options);\n this.sourceMap = sourceMapOutput.sourceMap;\n this.sourceMapURL = sourceMapOutput.sourceMapURL;\n if (this.options.sourceMapInputFilename) {\n this.sourceMapInputFilename = sourceMapOutput.normalizeFilename(this.options.sourceMapInputFilename);\n }\n if (this.options.sourceMapBasepath !== undefined && this.sourceMapURL !== undefined) {\n this.sourceMapURL = sourceMapOutput.removeBasepath(this.sourceMapURL);\n }\n return css + this.getCSSAppendage();\n }\n\n getCSSAppendage() {\n\n let sourceMapURL = this.sourceMapURL;\n if (this.options.sourceMapFileInline) {\n if (this.sourceMap === undefined) {\n return '';\n }\n sourceMapURL = `data:application/json;base64,${environment.encodeBase64(this.sourceMap)}`;\n }\n\n if (this.options.disableSourcemapAnnotation) {\n return '';\n }\n\n if (sourceMapURL) {\n return `/*# sourceMappingURL=${sourceMapURL} */`;\n }\n return '';\n }\n\n getExternalSourceMap() {\n return this.sourceMap;\n }\n\n setExternalSourceMap(sourceMap) {\n this.sourceMap = sourceMap;\n }\n\n isInline() {\n return this.options.sourceMapFileInline;\n }\n\n getSourceMapURL() {\n return this.sourceMapURL;\n }\n\n getOutputFilename() {\n return this.options.sourceMapOutputFilename;\n }\n\n getInputFilename() {\n return this.sourceMapInputFilename;\n }\n }\n\n return SourceMapBuilder;\n}\n","export default function (environment) {\n class SourceMapOutput {\n constructor(options) {\n this._css = [];\n this._rootNode = options.rootNode;\n this._contentsMap = options.contentsMap;\n this._contentsIgnoredCharsMap = options.contentsIgnoredCharsMap;\n if (options.sourceMapFilename) {\n this._sourceMapFilename = options.sourceMapFilename.replace(/\\\\/g, '/');\n }\n this._outputFilename = options.outputFilename;\n this.sourceMapURL = options.sourceMapURL;\n if (options.sourceMapBasepath) {\n this._sourceMapBasepath = options.sourceMapBasepath.replace(/\\\\/g, '/');\n }\n if (options.sourceMapRootpath) {\n this._sourceMapRootpath = options.sourceMapRootpath.replace(/\\\\/g, '/');\n if (this._sourceMapRootpath.charAt(this._sourceMapRootpath.length - 1) !== '/') {\n this._sourceMapRootpath += '/';\n }\n } else {\n this._sourceMapRootpath = '';\n }\n this._outputSourceFiles = options.outputSourceFiles;\n this._sourceMapGeneratorConstructor = environment.getSourceMapGenerator();\n\n this._lineNumber = 0;\n this._column = 0;\n }\n\n removeBasepath(path) {\n if (this._sourceMapBasepath && path.indexOf(this._sourceMapBasepath) === 0) {\n path = path.substring(this._sourceMapBasepath.length);\n if (path.charAt(0) === '\\\\' || path.charAt(0) === '/') {\n path = path.substring(1);\n }\n }\n\n return path;\n }\n\n normalizeFilename(filename) {\n filename = filename.replace(/\\\\/g, '/');\n filename = this.removeBasepath(filename);\n return (this._sourceMapRootpath || '') + filename;\n }\n\n add(chunk, fileInfo, index, mapLines) {\n\n // ignore adding empty strings\n if (!chunk) {\n return;\n }\n\n let lines, sourceLines, columns, sourceColumns, i;\n\n if (fileInfo && fileInfo.filename) {\n let inputSource = this._contentsMap[fileInfo.filename];\n\n // remove vars/banner added to the top of the file\n if (this._contentsIgnoredCharsMap[fileInfo.filename]) {\n // adjust the index\n index -= this._contentsIgnoredCharsMap[fileInfo.filename];\n if (index < 0) { index = 0; }\n // adjust the source\n inputSource = inputSource.slice(this._contentsIgnoredCharsMap[fileInfo.filename]);\n }\n\n /** \n * ignore empty content, or failsafe\n * if contents map is incorrect\n */\n if (inputSource === undefined) {\n this._css.push(chunk);\n return;\n }\n\n inputSource = inputSource.substring(0, index);\n sourceLines = inputSource.split('\\n');\n sourceColumns = sourceLines[sourceLines.length - 1];\n }\n\n lines = chunk.split('\\n');\n columns = lines[lines.length - 1];\n\n if (fileInfo && fileInfo.filename) {\n if (!mapLines) {\n this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + 1, column: this._column},\n original: { line: sourceLines.length, column: sourceColumns.length},\n source: this.normalizeFilename(fileInfo.filename)});\n } else {\n for (i = 0; i < lines.length; i++) {\n this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + i + 1, column: i === 0 ? this._column : 0},\n original: { line: sourceLines.length + i, column: i === 0 ? sourceColumns.length : 0},\n source: this.normalizeFilename(fileInfo.filename)});\n }\n }\n }\n\n if (lines.length === 1) {\n this._column += columns.length;\n } else {\n this._lineNumber += lines.length - 1;\n this._column = columns.length;\n }\n\n this._css.push(chunk);\n }\n\n isEmpty() {\n return this._css.length === 0;\n }\n\n toCSS(context) {\n this._sourceMapGenerator = new this._sourceMapGeneratorConstructor({ file: this._outputFilename, sourceRoot: null });\n\n if (this._outputSourceFiles) {\n for (const filename in this._contentsMap) {\n // eslint-disable-next-line no-prototype-builtins\n if (this._contentsMap.hasOwnProperty(filename)) {\n let source = this._contentsMap[filename];\n if (this._contentsIgnoredCharsMap[filename]) {\n source = source.slice(this._contentsIgnoredCharsMap[filename]);\n }\n this._sourceMapGenerator.setSourceContent(this.normalizeFilename(filename), source);\n }\n }\n }\n\n this._rootNode.genCSS(context, this);\n\n if (this._css.length > 0) {\n let sourceMapURL;\n const sourceMapContent = JSON.stringify(this._sourceMapGenerator.toJSON());\n\n if (this.sourceMapURL) {\n sourceMapURL = this.sourceMapURL;\n } else if (this._sourceMapFilename) {\n sourceMapURL = this._sourceMapFilename;\n }\n this.sourceMapURL = sourceMapURL;\n\n this.sourceMap = sourceMapContent;\n }\n\n return this._css.join('');\n }\n }\n\n return SourceMapOutput;\n}\n","import contexts from './contexts';\nimport Parser from './parser/parser';\nimport LessError from './less-error';\nimport * as utils from './utils';\nimport logger from './logger';\n\nexport default function(environment) {\n // FileInfo = {\n // 'rewriteUrls' - option - whether to adjust URL's to be relative\n // 'filename' - full resolved filename of current file\n // 'rootpath' - path to append to normal URLs for this node\n // 'currentDirectory' - path to the current file, absolute\n // 'rootFilename' - filename of the base file\n // 'entryPath' - absolute path to the entry file\n // 'reference' - whether the file should not be output and only output parts that are referenced\n\n class ImportManager {\n constructor(less, context, rootFileInfo) {\n this.less = less;\n this.rootFilename = rootFileInfo.filename;\n this.paths = context.paths || []; // Search paths, when importing\n this.contents = {}; // map - filename to contents of all the files\n this.contentsIgnoredChars = {}; // map - filename to lines at the beginning of each file to ignore\n this.mime = context.mime;\n this.error = null;\n this.context = context;\n // Deprecated? Unused outside of here, could be useful.\n this.queue = []; // Files which haven't been imported yet\n this.files = {}; // Holds the imported parse trees.\n }\n\n /**\n * Add an import to be imported\n * @param path - the raw path\n * @param tryAppendExtension - whether to try appending a file extension (.less or .js if the path has no extension)\n * @param currentFileInfo - the current file info (used for instance to work out relative paths)\n * @param importOptions - import options\n * @param callback - callback for when it is imported\n */\n push(path, tryAppendExtension, currentFileInfo, importOptions, callback) {\n const importManager = this, pluginLoader = this.context.pluginManager.Loader;\n\n this.queue.push(path);\n\n const fileParsedFunc = function (e, root, fullPath) {\n importManager.queue.splice(importManager.queue.indexOf(path), 1); // Remove the path from the queue\n\n const importedEqualsRoot = fullPath === importManager.rootFilename;\n if (importOptions.optional && e) {\n callback(null, {rules:[]}, false, null);\n logger.info(`The file ${fullPath} was skipped because it was not found and the import was marked optional.`);\n }\n else {\n // Inline imports aren't cached here.\n // If we start to cache them, please make sure they won't conflict with non-inline imports of the\n // same name as they used to do before this comment and the condition below have been added.\n if (!importManager.files[fullPath] && !importOptions.inline) {\n importManager.files[fullPath] = { root, options: importOptions };\n }\n if (e && !importManager.error) { importManager.error = e; }\n callback(e, root, importedEqualsRoot, fullPath);\n }\n };\n\n const newFileInfo = {\n rewriteUrls: this.context.rewriteUrls,\n entryPath: currentFileInfo.entryPath,\n rootpath: currentFileInfo.rootpath,\n rootFilename: currentFileInfo.rootFilename\n };\n\n const fileManager = environment.getFileManager(path, currentFileInfo.currentDirectory, this.context, environment);\n\n if (!fileManager) {\n fileParsedFunc({ message: `Could not find a file-manager for ${path}` });\n return;\n }\n\n const loadFileCallback = function(loadedFile) {\n let plugin;\n const resolvedFilename = loadedFile.filename;\n const contents = loadedFile.contents.replace(/^\\uFEFF/, '');\n\n // Pass on an updated rootpath if path of imported file is relative and file\n // is in a (sub|sup) directory\n //\n // Examples:\n // - If path of imported file is 'module/nav/nav.less' and rootpath is 'less/',\n // then rootpath should become 'less/module/nav/'\n // - If path of imported file is '../mixins.less' and rootpath is 'less/',\n // then rootpath should become 'less/../'\n newFileInfo.currentDirectory = fileManager.getPath(resolvedFilename);\n if (newFileInfo.rewriteUrls) {\n newFileInfo.rootpath = fileManager.join(\n (importManager.context.rootpath || ''),\n fileManager.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath));\n\n if (!fileManager.isPathAbsolute(newFileInfo.rootpath) && fileManager.alwaysMakePathsAbsolute()) {\n newFileInfo.rootpath = fileManager.join(newFileInfo.entryPath, newFileInfo.rootpath);\n }\n }\n newFileInfo.filename = resolvedFilename;\n\n const newEnv = new contexts.Parse(importManager.context);\n\n newEnv.processImports = false;\n importManager.contents[resolvedFilename] = contents;\n\n if (currentFileInfo.reference || importOptions.reference) {\n newFileInfo.reference = true;\n }\n\n if (importOptions.isPlugin) {\n plugin = pluginLoader.evalPlugin(contents, newEnv, importManager, importOptions.pluginArgs, newFileInfo);\n if (plugin instanceof LessError) {\n fileParsedFunc(plugin, null, resolvedFilename);\n }\n else {\n fileParsedFunc(null, plugin, resolvedFilename);\n }\n } else if (importOptions.inline) {\n fileParsedFunc(null, contents, resolvedFilename);\n } else {\n // import (multiple) parse trees apparently get altered and can't be cached.\n // TODO: investigate why this is\n if (importManager.files[resolvedFilename]\n && !importManager.files[resolvedFilename].options.multiple\n && !importOptions.multiple) {\n\n fileParsedFunc(null, importManager.files[resolvedFilename].root, resolvedFilename);\n }\n else {\n new Parser(newEnv, importManager, newFileInfo).parse(contents, function (e, root) {\n fileParsedFunc(e, root, resolvedFilename);\n });\n }\n }\n };\n let loadedFile;\n let promise;\n const context = utils.clone(this.context);\n\n if (tryAppendExtension) {\n context.ext = importOptions.isPlugin ? '.js' : '.less';\n }\n\n if (importOptions.isPlugin) {\n context.mime = 'application/javascript';\n\n if (context.syncImport) {\n loadedFile = pluginLoader.loadPluginSync(path, currentFileInfo.currentDirectory, context, environment, fileManager);\n } else {\n promise = pluginLoader.loadPlugin(path, currentFileInfo.currentDirectory, context, environment, fileManager);\n }\n }\n else {\n if (context.syncImport) {\n loadedFile = fileManager.loadFileSync(path, currentFileInfo.currentDirectory, context, environment);\n } else {\n promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, context, environment,\n (err, loadedFile) => {\n if (err) {\n fileParsedFunc(err);\n } else {\n loadFileCallback(loadedFile);\n }\n });\n }\n }\n if (loadedFile) {\n if (!loadedFile.filename) {\n fileParsedFunc(loadedFile);\n } else {\n loadFileCallback(loadedFile);\n }\n } else if (promise) {\n promise.then(loadFileCallback, fileParsedFunc);\n }\n }\n }\n\n return ImportManager;\n}\n","import * as utils from './utils';\n\nexport default function(environment, ParseTree) {\n const render = function (input, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = utils.copyOptions(this.options, {});\n }\n else {\n options = utils.copyOptions(this.options, options || {});\n }\n\n if (!callback) {\n const self = this;\n return new Promise(function (resolve, reject) {\n render.call(self, input, options, function(err, output) {\n if (err) {\n reject(err);\n } else {\n resolve(output);\n }\n });\n });\n } else {\n this.parse(input, options, function(err, root, imports, options) {\n if (err) { return callback(err); }\n\n let result;\n try {\n const parseTree = new ParseTree(root, imports);\n result = parseTree.toCSS(options);\n }\n catch (err) { return callback(err); }\n\n callback(null, result);\n });\n }\n };\n\n return render;\n}\n","import contexts from './contexts';\nimport Parser from './parser/parser';\nimport PluginManager from './plugin-manager';\nimport LessError from './less-error';\nimport * as utils from './utils';\n\nexport default function(environment, ParseTree, ImportManager) {\n const parse = function (input, options, callback) {\n\n if (typeof options === 'function') {\n callback = options;\n options = utils.copyOptions(this.options, {});\n }\n else {\n options = utils.copyOptions(this.options, options || {});\n }\n\n if (!callback) {\n const self = this;\n return new Promise(function (resolve, reject) {\n parse.call(self, input, options, function(err, output) {\n if (err) {\n reject(err);\n } else {\n resolve(output);\n }\n });\n });\n } else {\n let context;\n let rootFileInfo;\n const pluginManager = new PluginManager(this, !options.reUsePluginManager);\n\n options.pluginManager = pluginManager;\n\n context = new contexts.Parse(options);\n\n if (options.rootFileInfo) {\n rootFileInfo = options.rootFileInfo;\n } else {\n const filename = options.filename || 'input';\n const entryPath = filename.replace(/[^/\\\\]*$/, '');\n rootFileInfo = {\n filename,\n rewriteUrls: context.rewriteUrls,\n rootpath: context.rootpath || '',\n currentDirectory: entryPath,\n entryPath,\n rootFilename: filename\n };\n // add in a missing trailing slash\n if (rootFileInfo.rootpath && rootFileInfo.rootpath.slice(-1) !== '/') {\n rootFileInfo.rootpath += '/';\n }\n }\n\n const imports = new ImportManager(this, context, rootFileInfo);\n this.importManager = imports;\n\n // TODO: allow the plugins to be just a list of paths or names\n // Do an async plugin queue like lessc\n\n if (options.plugins) {\n options.plugins.forEach(function(plugin) {\n let evalResult, contents;\n if (plugin.fileContent) {\n contents = plugin.fileContent.replace(/^\\uFEFF/, '');\n evalResult = pluginManager.Loader.evalPlugin(contents, context, imports, plugin.options, plugin.filename);\n if (evalResult instanceof LessError) {\n return callback(evalResult);\n }\n }\n else {\n pluginManager.addPlugin(plugin);\n }\n });\n }\n\n new Parser(context, imports, rootFileInfo)\n .parse(input, function (e, root) {\n if (e) { return callback(e); }\n callback(null, root, imports, options);\n }, options);\n }\n };\n return parse;\n}\n","/**\n * @todo Add tests for browser `@plugin`\n */\nimport AbstractPluginLoader from '../less/environment/abstract-plugin-loader.js';\n\n/**\n * Browser Plugin Loader\n */\nconst PluginLoader = function(less) {\n this.less = less;\n // Should we shim this.require for browser? Probably not?\n};\n\nPluginLoader.prototype = Object.assign(new AbstractPluginLoader(), {\n loadPlugin(filename, basePath, context, environment, fileManager) {\n return new Promise((fulfill, reject) => {\n fileManager.loadFile(filename, basePath, context, environment)\n .then(fulfill).catch(reject);\n });\n }\n});\n\nexport default PluginLoader;\n\n","export default (less, options) => {\n const logLevel_debug = 4;\n const logLevel_info = 3;\n const logLevel_warn = 2;\n const logLevel_error = 1;\n\n // The amount of logging in the javascript console.\n // 3 - Debug, information and errors\n // 2 - Information and errors\n // 1 - Errors\n // 0 - None\n // Defaults to 2\n options.logLevel = typeof options.logLevel !== 'undefined' ? options.logLevel : (options.env === 'development' ? logLevel_info : logLevel_error);\n\n if (!options.loggers) {\n options.loggers = [{\n debug: function(msg) {\n if (options.logLevel >= logLevel_debug) {\n console.log(msg);\n }\n },\n info: function(msg) {\n if (options.logLevel >= logLevel_info) {\n console.log(msg);\n }\n },\n warn: function(msg) {\n if (options.logLevel >= logLevel_warn) {\n console.warn(msg);\n }\n },\n error: function(msg) {\n if (options.logLevel >= logLevel_error) {\n console.error(msg);\n }\n }\n }];\n }\n for (let i = 0; i < options.loggers.length; i++) {\n less.logger.addListener(options.loggers[i]);\n }\n};\n","import * as utils from './utils';\nimport browser from './browser';\n\nexport default (window, less, options) => {\n\n function errorHTML(e, rootHref) {\n const id = `less-error-message:${utils.extractId(rootHref || '')}`;\n const template = '
  • {content}
  • ';\n const elem = window.document.createElement('div');\n let timer;\n let content;\n const errors = [];\n const filename = e.filename || rootHref;\n const filenameNoPath = filename.match(/([^/]+(\\?.*)?)$/)[1];\n\n elem.id = id;\n elem.className = 'less-error-message';\n\n content = `

    ${e.type || 'Syntax'}Error: ${e.message || 'There is an error in your .less file'}` + \n `

    in ${filenameNoPath} `;\n\n const errorline = (e, i, classname) => {\n if (e.extract[i] !== undefined) {\n errors.push(template.replace(/\\{line\\}/, (parseInt(e.line, 10) || 0) + (i - 1))\n .replace(/\\{class\\}/, classname)\n .replace(/\\{content\\}/, e.extract[i]));\n }\n };\n\n if (e.line) {\n errorline(e, 0, '');\n errorline(e, 1, 'line');\n errorline(e, 2, '');\n content += `on line ${e.line}, column ${e.column + 1}:

      ${errors.join('')}
    `;\n }\n if (e.stack && (e.extract || options.logLevel >= 4)) {\n content += `
    Stack Trace
    ${e.stack.split('\\n').slice(1).join('
    ')}`;\n }\n elem.innerHTML = content;\n\n // CSS for error messages\n browser.createCSS(window.document, [\n '.less-error-message ul, .less-error-message li {',\n 'list-style-type: none;',\n 'margin-right: 15px;',\n 'padding: 4px 0;',\n 'margin: 0;',\n '}',\n '.less-error-message label {',\n 'font-size: 12px;',\n 'margin-right: 15px;',\n 'padding: 4px 0;',\n 'color: #cc7777;',\n '}',\n '.less-error-message pre {',\n 'color: #dd6666;',\n 'padding: 4px 0;',\n 'margin: 0;',\n 'display: inline-block;',\n '}',\n '.less-error-message pre.line {',\n 'color: #ff0000;',\n '}',\n '.less-error-message h3 {',\n 'font-size: 20px;',\n 'font-weight: bold;',\n 'padding: 15px 0 5px 0;',\n 'margin: 0;',\n '}',\n '.less-error-message a {',\n 'color: #10a',\n '}',\n '.less-error-message .error {',\n 'color: red;',\n 'font-weight: bold;',\n 'padding-bottom: 2px;',\n 'border-bottom: 1px dashed red;',\n '}'\n ].join('\\n'), { title: 'error-message' });\n\n elem.style.cssText = [\n 'font-family: Arial, sans-serif',\n 'border: 1px solid #e00',\n 'background-color: #eee',\n 'border-radius: 5px',\n '-webkit-border-radius: 5px',\n '-moz-border-radius: 5px',\n 'color: #e00',\n 'padding: 15px',\n 'margin-bottom: 15px'\n ].join(';');\n\n if (options.env === 'development') {\n timer = setInterval(() => {\n const document = window.document;\n const body = document.body;\n if (body) {\n if (document.getElementById(id)) {\n body.replaceChild(elem, document.getElementById(id));\n } else {\n body.insertBefore(elem, body.firstChild);\n }\n clearInterval(timer);\n }\n }, 10);\n }\n }\n\n function removeErrorHTML(path) {\n const node = window.document.getElementById(`less-error-message:${utils.extractId(path)}`);\n if (node) {\n node.parentNode.removeChild(node);\n }\n }\n\n function removeErrorConsole() {\n // no action\n }\n\n function removeError(path) {\n if (!options.errorReporting || options.errorReporting === 'html') {\n removeErrorHTML(path);\n } else if (options.errorReporting === 'console') {\n removeErrorConsole(path);\n } else if (typeof options.errorReporting === 'function') {\n options.errorReporting('remove', path);\n }\n }\n\n function errorConsole(e, rootHref) {\n const template = '{line} {content}';\n const filename = e.filename || rootHref;\n const errors = [];\n let content = `${e.type || 'Syntax'}Error: ${e.message || 'There is an error in your .less file'} in ${filename}`;\n\n const errorline = (e, i, classname) => {\n if (e.extract[i] !== undefined) {\n errors.push(template.replace(/\\{line\\}/, (parseInt(e.line, 10) || 0) + (i - 1))\n .replace(/\\{class\\}/, classname)\n .replace(/\\{content\\}/, e.extract[i]));\n }\n };\n\n if (e.line) {\n errorline(e, 0, '');\n errorline(e, 1, 'line');\n errorline(e, 2, '');\n content += ` on line ${e.line}, column ${e.column + 1}:\\n${errors.join('\\n')}`;\n }\n if (e.stack && (e.extract || options.logLevel >= 4)) {\n content += `\\nStack Trace\\n${e.stack}`;\n }\n less.logger.error(content);\n }\n\n function error(e, rootHref) {\n if (!options.errorReporting || options.errorReporting === 'html') {\n errorHTML(e, rootHref);\n } else if (options.errorReporting === 'console') {\n errorConsole(e, rootHref);\n } else if (typeof options.errorReporting === 'function') {\n options.errorReporting('add', e, rootHref);\n }\n }\n\n return {\n add: error,\n remove: removeError\n };\n};\n","/**\n * Kicks off less and compiles any stylesheets\n * used in the browser distributed version of less\n * to kick-start less using the browser api\n */\nimport defaultOptions from '../less/default-options';\nimport addDefaultOptions from './add-default-options';\nimport root from './index';\n\nconst options = defaultOptions();\n\nif (window.less) {\n for (const key in window.less) {\n if (Object.prototype.hasOwnProperty.call(window.less, key)) {\n options[key] = window.less[key];\n }\n }\n}\naddDefaultOptions(window, options);\n\noptions.plugins = options.plugins || [];\n\nif (window.LESS_PLUGINS) {\n options.plugins = options.plugins.concat(window.LESS_PLUGINS);\n}\n\nconst less = root(window, options);\nexport default less;\n\nwindow.less = less;\n\nlet css;\nlet head;\nlet style;\n\n// Always restore page visibility\nfunction resolveOrReject(data) {\n if (data.filename) {\n console.warn(data);\n }\n if (!options.async) {\n head.removeChild(style);\n }\n}\n\nif (options.onReady) {\n if (/!watch/.test(window.location.hash)) {\n less.watch();\n }\n // Simulate synchronous stylesheet loading by hiding page rendering\n if (!options.async) {\n css = 'body { display: none !important }';\n head = document.head || document.getElementsByTagName('head')[0];\n style = document.createElement('style');\n\n style.type = 'text/css';\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n\n head.appendChild(style);\n }\n less.registerStylesheetsImmediately();\n less.pageLoadFinished = less.refresh(less.env === 'development').then(resolveOrReject, resolveOrReject);\n}\n","// Export a new default each time\nexport default function() {\n return {\n /* Inline Javascript - @plugin still allowed */\n javascriptEnabled: false,\n\n /* Outputs a makefile import dependency list to stdout. */\n depends: false,\n\n /* (DEPRECATED) Compress using less built-in compression. \n * This does an okay job but does not utilise all the tricks of \n * dedicated css compression. */\n compress: false,\n\n /* Runs the less parser and just reports errors without any output. */\n lint: false,\n\n /* Sets available include paths.\n * If the file in an @import rule does not exist at that exact location, \n * less will look for it at the location(s) passed to this option. \n * You might use this for instance to specify a path to a library which \n * you want to be referenced simply and relatively in the less files. */\n paths: [],\n\n /* color output in the terminal */\n color: true,\n\n /* The strictImports controls whether the compiler will allow an @import inside of either \n * @media blocks or (a later addition) other selector blocks.\n * See: https://github.com/less/less.js/issues/656 */\n strictImports: false,\n\n /* Allow Imports from Insecure HTTPS Hosts */\n insecure: false,\n\n /* Allows you to add a path to every generated import and url in your css. \n * This does not affect less import statements that are processed, just ones \n * that are left in the output css. */\n rootpath: '',\n\n /* By default URLs are kept as-is, so if you import a file in a sub-directory \n * that references an image, exactly the same URL will be output in the css. \n * This option allows you to re-write URL's in imported files so that the \n * URL is always relative to the base imported file */\n rewriteUrls: false,\n\n /* How to process math \n * 0 always - eagerly try to solve all operations\n * 1 parens-division - require parens for division \"/\"\n * 2 parens | strict - require parens for all operations\n * 3 strict-legacy - legacy strict behavior (super-strict)\n */\n math: 1,\n\n /* Without this option, less attempts to guess at the output unit when it does maths. */\n strictUnits: false,\n\n /* Effectively the declaration is put at the top of your base Less file, \n * meaning it can be used but it also can be overridden if this variable \n * is defined in the file. */\n globalVars: null,\n\n /* As opposed to the global variable option, this puts the declaration at the\n * end of your base file, meaning it will override anything defined in your Less file. */\n modifyVars: null,\n\n /* This option allows you to specify a argument to go on to every URL. */\n urlArgs: ''\n }\n}","import {addDataAttr} from './utils';\nimport browser from './browser';\n\nexport default (window, options) => {\n\n // use options from the current script tag data attribues\n addDataAttr(options, browser.currentScript(window));\n\n if (options.isFileProtocol === undefined) {\n options.isFileProtocol = /^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(window.location.protocol);\n }\n\n // Load styles asynchronously (default: false)\n //\n // This is set to `false` by default, so that the body\n // doesn't start loading before the stylesheets are parsed.\n // Setting this to `true` can result in flickering.\n //\n options.async = options.async || false;\n options.fileAsync = options.fileAsync || false;\n\n // Interval between watch polls\n options.poll = options.poll || (options.isFileProtocol ? 1000 : 1500);\n\n options.env = options.env || (window.location.hostname == '127.0.0.1' ||\n window.location.hostname == '0.0.0.0' ||\n window.location.hostname == 'localhost' ||\n (window.location.port &&\n window.location.port.length > 0) ||\n options.isFileProtocol ? 'development'\n : 'production');\n\n const dumpLineNumbers = /!dumpLineNumbers:(comments|mediaquery|all)/.exec(window.location.hash);\n if (dumpLineNumbers) {\n options.dumpLineNumbers = dumpLineNumbers[1];\n }\n\n if (options.useFileCache === undefined) {\n options.useFileCache = true;\n }\n\n if (options.onReady === undefined) {\n options.onReady = true;\n }\n\n if (options.relativeUrls) {\n options.rewriteUrls = 'all';\n }\n};\n","//\n// index.js\n// Should expose the additional browser functions on to the less object\n//\nimport {addDataAttr} from './utils';\nimport lessRoot from '../less';\nimport browser from './browser';\nimport FM from './file-manager';\nimport PluginLoader from './plugin-loader';\nimport LogListener from './log-listener';\nimport ErrorReporting from './error-reporting';\nimport Cache from './cache';\nimport ImageSize from './image-size';\n\nexport default (window, options) => {\n const document = window.document;\n const less = lessRoot();\n\n less.options = options;\n const environment = less.environment;\n const FileManager = FM(options, less.logger);\n const fileManager = new FileManager();\n environment.addFileManager(fileManager);\n less.FileManager = FileManager;\n less.PluginLoader = PluginLoader;\n\n LogListener(less, options);\n const errors = ErrorReporting(window, less, options);\n const cache = less.cache = options.cache || Cache(window, options, less.logger);\n ImageSize(less.environment);\n\n // Setup user functions - Deprecate?\n if (options.functions) {\n less.functions.functionRegistry.addMultiple(options.functions);\n }\n\n const typePattern = /^text\\/(x-)?less$/;\n\n function clone(obj) {\n const cloned = {};\n for (const prop in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, prop)) {\n cloned[prop] = obj[prop];\n }\n }\n return cloned;\n }\n\n // only really needed for phantom\n function bind(func, thisArg) {\n const curryArgs = Array.prototype.slice.call(arguments, 2);\n return function() {\n const args = curryArgs.concat(Array.prototype.slice.call(arguments, 0));\n return func.apply(thisArg, args);\n };\n }\n\n function loadStyles(modifyVars) {\n const styles = document.getElementsByTagName('style');\n let style;\n\n for (let i = 0; i < styles.length; i++) {\n style = styles[i];\n if (style.type.match(typePattern)) {\n const instanceOptions = clone(options);\n instanceOptions.modifyVars = modifyVars;\n const lessText = style.innerHTML || '';\n instanceOptions.filename = document.location.href.replace(/#.*$/, '');\n\n /* jshint loopfunc:true */\n // use closure to store current style\n less.render(lessText, instanceOptions,\n bind((style, e, result) => {\n if (e) {\n errors.add(e, 'inline');\n } else {\n style.type = 'text/css';\n if (style.styleSheet) {\n style.styleSheet.cssText = result.css;\n } else {\n style.innerHTML = result.css;\n }\n }\n }, null, style));\n }\n }\n }\n\n function loadStyleSheet(sheet, callback, reload, remaining, modifyVars) {\n\n const instanceOptions = clone(options);\n addDataAttr(instanceOptions, sheet);\n instanceOptions.mime = sheet.type;\n\n if (modifyVars) {\n instanceOptions.modifyVars = modifyVars;\n }\n\n function loadInitialFileCallback(loadedFile) {\n const data = loadedFile.contents;\n const path = loadedFile.filename;\n const webInfo = loadedFile.webInfo;\n\n const newFileInfo = {\n currentDirectory: fileManager.getPath(path),\n filename: path,\n rootFilename: path,\n rewriteUrls: instanceOptions.rewriteUrls\n };\n\n newFileInfo.entryPath = newFileInfo.currentDirectory;\n newFileInfo.rootpath = instanceOptions.rootpath || newFileInfo.currentDirectory;\n\n if (webInfo) {\n webInfo.remaining = remaining;\n\n const css = cache.getCSS(path, webInfo, instanceOptions.modifyVars);\n if (!reload && css) {\n webInfo.local = true;\n callback(null, css, data, sheet, webInfo, path);\n return;\n }\n\n }\n\n // TODO add tests around how this behaves when reloading\n errors.remove(path);\n\n instanceOptions.rootFileInfo = newFileInfo;\n less.render(data, instanceOptions, (e, result) => {\n if (e) {\n e.href = path;\n callback(e);\n } else {\n cache.setCSS(sheet.href, webInfo.lastModified, instanceOptions.modifyVars, result.css);\n callback(null, result.css, data, sheet, webInfo, path);\n }\n });\n }\n\n fileManager.loadFile(sheet.href, null, instanceOptions, environment)\n .then(loadedFile => {\n loadInitialFileCallback(loadedFile);\n }).catch(err => {\n console.log(err);\n callback(err);\n });\n\n }\n\n function loadStyleSheets(callback, reload, modifyVars) {\n for (let i = 0; i < less.sheets.length; i++) {\n loadStyleSheet(less.sheets[i], callback, reload, less.sheets.length - (i + 1), modifyVars);\n }\n }\n\n function initRunningMode() {\n if (less.env === 'development') {\n less.watchTimer = setInterval(() => {\n if (less.watchMode) {\n fileManager.clearFileCache();\n /**\n * @todo remove when this is typed with JSDoc\n */\n // eslint-disable-next-line no-unused-vars\n loadStyleSheets((e, css, _, sheet, webInfo) => {\n if (e) {\n errors.add(e, e.href || sheet.href);\n } else if (css) {\n browser.createCSS(window.document, css, sheet);\n }\n });\n }\n }, options.poll);\n }\n }\n\n //\n // Watch mode\n //\n less.watch = function () {\n if (!less.watchMode ) {\n less.env = 'development';\n initRunningMode();\n }\n this.watchMode = true;\n return true;\n };\n\n less.unwatch = function () {clearInterval(less.watchTimer); this.watchMode = false; return false; };\n\n //\n // Synchronously get all tags with the 'rel' attribute set to\n // \"stylesheet/less\".\n //\n less.registerStylesheetsImmediately = () => {\n const links = document.getElementsByTagName('link');\n less.sheets = [];\n\n for (let i = 0; i < links.length; i++) {\n if (links[i].rel === 'stylesheet/less' || (links[i].rel.match(/stylesheet/) &&\n (links[i].type.match(typePattern)))) {\n less.sheets.push(links[i]);\n }\n }\n };\n\n //\n // Asynchronously get all tags with the 'rel' attribute set to\n // \"stylesheet/less\", returning a Promise.\n //\n less.registerStylesheets = () => new Promise((resolve) => {\n less.registerStylesheetsImmediately();\n resolve();\n });\n\n //\n // With this function, it's possible to alter variables and re-render\n // CSS without reloading less-files\n //\n less.modifyVars = record => less.refresh(true, record, false);\n\n less.refresh = (reload, modifyVars, clearFileCache) => {\n if ((reload || clearFileCache) && clearFileCache !== false) {\n fileManager.clearFileCache();\n }\n return new Promise((resolve, reject) => {\n let startTime;\n let endTime;\n let totalMilliseconds;\n let remainingSheets;\n startTime = endTime = new Date();\n\n // Set counter for remaining unprocessed sheets\n remainingSheets = less.sheets.length;\n\n if (remainingSheets === 0) {\n\n endTime = new Date();\n totalMilliseconds = endTime - startTime;\n less.logger.info('Less has finished and no sheets were loaded.');\n resolve({\n startTime,\n endTime,\n totalMilliseconds,\n sheets: less.sheets.length\n });\n\n } else {\n // Relies on less.sheets array, callback seems to be guaranteed to be called for every element of the array\n loadStyleSheets((e, css, _, sheet, webInfo) => {\n if (e) {\n errors.add(e, e.href || sheet.href);\n reject(e);\n return;\n }\n if (webInfo.local) {\n less.logger.info(`Loading ${sheet.href} from cache.`);\n } else {\n less.logger.info(`Rendered ${sheet.href} successfully.`);\n }\n browser.createCSS(window.document, css, sheet);\n less.logger.info(`CSS for ${sheet.href} generated in ${new Date() - endTime}ms`);\n\n // Count completed sheet\n remainingSheets--;\n\n // Check if the last remaining sheet was processed and then call the promise\n if (remainingSheets === 0) {\n totalMilliseconds = new Date() - startTime;\n less.logger.info(`Less has finished. CSS generated in ${totalMilliseconds}ms`);\n resolve({\n startTime,\n endTime,\n totalMilliseconds,\n sheets: less.sheets.length\n });\n }\n endTime = new Date();\n }, reload, modifyVars);\n }\n\n loadStyles(modifyVars);\n });\n };\n\n less.refreshStyles = loadStyles;\n return less;\n};\n","// Cache system is a bit outdated and could do with work\n\nexport default (window, options, logger) => {\n let cache = null;\n if (options.env !== 'development') {\n try {\n cache = (typeof window.localStorage === 'undefined') ? null : window.localStorage;\n } catch (_) {}\n }\n return {\n setCSS: function(path, lastModified, modifyVars, styles) {\n if (cache) {\n logger.info(`saving ${path} to cache.`);\n try {\n cache.setItem(path, styles);\n cache.setItem(`${path}:timestamp`, lastModified);\n if (modifyVars) {\n cache.setItem(`${path}:vars`, JSON.stringify(modifyVars));\n }\n } catch (e) {\n // TODO - could do with adding more robust error handling\n logger.error(`failed to save \"${path}\" to local storage for caching.`);\n }\n }\n },\n getCSS: function(path, webInfo, modifyVars) {\n const css = cache && cache.getItem(path);\n const timestamp = cache && cache.getItem(`${path}:timestamp`);\n let vars = cache && cache.getItem(`${path}:vars`);\n\n modifyVars = modifyVars || {};\n vars = vars || '{}'; // if not set, treat as the JSON representation of an empty object\n\n if (timestamp && webInfo.lastModified &&\n (new Date(webInfo.lastModified).valueOf() ===\n new Date(timestamp).valueOf()) &&\n JSON.stringify(modifyVars) === vars) {\n // Use local copy\n return css;\n }\n }\n };\n};\n","\nimport functionRegistry from './../less/functions/function-registry';\n\nexport default () => {\n function imageSize() {\n throw {\n type: 'Runtime',\n message: 'Image size functions are not supported in browser version of less'\n };\n }\n\n const imageFunctions = {\n 'image-size': function(filePathNode) {\n imageSize(this, filePathNode);\n return -1;\n },\n 'image-width': function(filePathNode) {\n imageSize(this, filePathNode);\n return -1;\n },\n 'image-height': function(filePathNode) {\n imageSize(this, filePathNode);\n return -1;\n }\n };\n\n functionRegistry.addMultiple(imageFunctions);\n};\n"],"names":["extractId","href","replace","addDataAttr","options","tag","opt","dataset","Object","prototype","hasOwnProperty","call","JSON","parse","_","browser","document","styles","sheet","id","concat","title","utils.extractId","oldStyleNode","getElementById","keepOldStyleNode","styleNode","createElement","setAttribute","media","styleSheet","appendChild","createTextNode","childNodes","length","firstChild","nodeValue","head","getElementsByTagName","nextEl","nextSibling","parentNode","insertBefore","removeChild","cssText","e","Error","window","scripts","currentScript","logger$1","error","msg","this","_fireEvent","warn","info","debug","addListener","listener","_listeners","push","removeListener","i_1","splice","type","i_2","logFunction","Environment","externalEnvironment","fileManagers","requiredFunctions","functions","propName","environmentFunc","bind","getFileManager","filename","currentDirectory","environment","isSync","logger","undefined","pluginManager","getFileManagers","fileManager","addFileManager","clearFileManagers","colors","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgrey","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","unitConversions","m","cm","mm","in","px","pt","pc","duration","s","ms","angle","rad","Math","PI","deg","grad","turn","data","Node","parent","visibilityBlocks","nodeVisible","rootNode","parsed","defineProperty","get","fileInfo","getIndex","setParent","nodes","set","node","Array","isArray","forEach","_index","_fileInfo","isRulesetLike","toCSS","context","strs","genCSS","add","chunk","index","isEmpty","join","output","value","accept","visitor","visit","eval","_operate","op","a","b","fround","precision","numPrecision","Number","toFixed","compare","numericCompare","blocksVisibility","addVisibilityBlock","removeVisibilityBlock","ensureVisibility","ensureInvisibility","isVisible","visibilityInfo","copyVisibilityInfo","Color","rgb","originalForm","self","match","map","c","i","parseInt","alpha","split","clamp","v","max","min","toHex","round","toString","assign","luma","r","g","pow","doNotCompress","color","colorFunction","compress","args","indexOf","toHSL","h","l","toRGB","splitcolor","operate","other","d","toHSV","toARGB","x","fromKeyword","keyword","key","toLowerCase","slice","__assign","t","n","arguments","p","apply","SuppressedError","Paren","paren","noSpacing","_noSpaceCombinators"," ","|","Combinator","emptyOrWhitespace","trim","spaceOrEmpty","Element","combinator","isVariable","currentFileInfo","clone","firstSelector","charAt","ALWAYS","PARENS_DIVISION","PARENS","RewriteUrls","getType","payload","copy","target","item","constructor","getPrototypeOf","getOwnPropertyNames","getOwnPropertySymbols","reduce","carry","props","includes","newVal","originalObject","includeNonenumerable","propType","propertyIsEnumerable","enumerable","writable","configurable","assignProp","nonenumerable","getLocation","inputStream","line","column","copyArray","arr","obj","cloned","prop","defaults","obj1","obj2","newObj","_defaults","defaults_1","copyOptions","opts","strictMath","math","Constants.Math","relativeUrls","rewriteUrls","Constants.RewriteUrls","flattenArray","result","length_1","isNullOrUndefined","val","anonymousFunc","LessError","fileContentMap","currentFilename","message","stack","input","contents","loc","utils.getLocation","col","callLine","lines","found","func","Function","lineAdjust","callExtract","extract","create","F","isWarning","_a","stylize","str","type_1","errorTxt","substr","_visitArgs","visitDeeper","_hasIndexed","_noop","Visitor","implementation","_implementation","_visitInCache","_visitOutCache","indexNodeTypes","ticker","child","typeIndex","tree","nodeTypeIndex","fnName","impl","funcOut","visitArgs","newNode","isReplacing","cnt","visitArray","nonReplacing","out","evald","flatten","nestedCnt","j","nestedItem","contexts","copyFromOriginal","original","destination","propertiesToCopy","parseCopyProperties","Parse","paths","evalCopyProperties","isPathRelative","path","test","isPathLocalRelative","Eval","frames","importantScope","enterCalc","calcStack","inCalc","exitCalc","pop","inParenthesis","parensStack","outOfParenthesis","mathOn","isMathOn","pathRequiresRewrite","rewritePath","rootpath","newPath","normalizePath","segment","segments","reverse","ImportSequencer","onSequencerEmpty","imports","variableImports","_onSequencerEmpty","_currentDepth","addImport","callback","importSequencer","importItem","isReady","tryRun","addVariableImport","variableImport","ImportVisitor","importer","finish","_visitor","_importer","_finish","importCount","onceFileDetectionMap","recursionDetector","_sequencer","run","root","isFinished","visitImport","importNode","inlineCSS","inline","css","utils.copyArray","importParent","isVariableImport","processImportNode","evaldImportNode","evalForImport","multiple","importMultiple","tryAppendLessExtension","rules","onImported","sequencedOnImported","getPath","importedAtRoot","fullPath","importVisitor","isPlugin","isOptional","optional","duplicateImport","skip","importedFilename","oldContext","visitDeclaration","declNode","unshift","visitDeclarationOut","shift","visitAtRule","atRuleNode","declarations","isRooted","visitAtRuleOut","visitMixinDefinition","mixinDefinitionNode","visitMixinDefinitionOut","visitRuleset","rulesetNode","visitRulesetOut","visitMedia","mediaNode","visitMediaOut","SetTreeVisibilityVisitor","visible","ExtendFinderVisitor","allExtendsStack","allExtends","extend","extendList","allSelectorsExtendList","ruleCnt","Extend","extendOnEveryPath","selectorPath","selExtendList","allSelectorsExtend","foundExtends","findSelfSelectors","ruleset","firstExtendOnThisSelectorPath","selectors","ProcessExtendsVisitor","extendFinder","extendIndices","doExtendChaining","newRoot","checkExtendsForNonMatched","indices","filter","hasFoundMatches","parent_ids","selector","extendsList","extendsListTarget","iterationCount","extendIndex","targetExtendIndex","matches","newSelector","targetExtend","newExtend","extendsToAdd","extendVisitor","object_id","selfSelectors","findMatch","selfSelector","extendSelector","option","extendChainCount","selectorOne","selectorTwo","ruleNode","visitSelector","selectorNode","pathIndex","selectorsToAdd","extendedSelectors","haystackSelectorPath","haystackSelectorIndex","hackstackSelector","hackstackElementIndex","haystackElement","targetCombinator","potentialMatch","needleElements","elements","potentialMatches","allowBefore","matched","initialCombinator","isElementValuesEqual","finished","allowAfter","endPathIndex","endPathElementIndex","elementValue1","elementValue2","Attribute","Selector","replacementSelector","matchIndex","firstElement","newElements","currentSelectorPathIndex","currentSelectorPathElementIndex","currentValue","derived","createDerived","newAllExtends","lastIndex","JoinSelectorVisitor","getIsOutput","joinSelectors","multiMedia","CSSVisitorUtils","_context","containsSilentNonBlockedChild","bodyRules","rule","isSilent","keepOnlyVisibleChilds","owner","thing","hasVisibleSelector","resolveVisibility","compiledRulesBody","isVisibleRuleset","firstRoot","ToCSSVisitor","utils","variable","mixinNode","visitExtend","extendNode","visitComment","commentNode","originalRules","visitAtRuleWithBody","visitAtRuleWithoutBody","visitAnonymous","anonymousNode","nodeRules","hasFakeRuleset","getBodyRules","_mergeRules","name","charset","debugInfo","comment","Comment","checkValidNodes","isRoot","Declaration","Call","allowRoot","rulesets","_compileRulesetPaths","nodeRuleCnt","_removeDuplicateRules","ruleList","ruleCache","ruleCSS","groups","groupsArr","i_3","merge","group","result_1","space_1","comma_1","Expression","important","Value","visitors","MarkVisibleSelectorsVisitor","ExtendVisitor","getParserInput","furthest","furthestPossibleErrorMessage","chunks","current","currentPos","saveStack","parserInput","skipWhitespace","nextChar","oldi","oldj","curr","endIndex","mem","inp","charCodeAt","autoCommentAbsorb","isLineComment","nextNewLine","text","commentStore","nextStarSlash","save","restore","possibleErrorMessage","state","forget","isWhitespace","offset","pos","code","$re","tok","exec","$char","$peekChar","$str","tokLength","$quoted","startChar","currentPosition","$parseUntil","testChar","quote","returnVal","inComment","blockDepth","blockStack","parseGroups","startPos","lastPos","loop","char","expected","peek","peekChar","currentChar","prevChar","getInput","peekNotNumeric","start","chunkInput","failFunction","fail","lastOpening","lastOpeningParen","lastMultiComment","lastMultiCommentEndBrace","chunkerCurrentIndex","currentChunkStartIndex","cc","cc2","len","level","parenLevel","emitFrom","emitChunk","force","String","fromCharCode","chunker","end","furthestReachedEnd","furthestChar","functionRegistry","makeRegistry","base","_data","addMultiple","_this","keys","getLocalFunctions","inherit","MediaSyntaxOptions","queryInParens","ContainerSyntaxOptions","Anonymous","mapLines","rulesetLike","Boolean","Parser","currentIndex","parsers","quiet","toUpperCase","expect","arg","expectChar","getDebugInfo","lineNumber","fileName","parseNode","parseList","returnNodes","parser","additionalData","globalVars","modifyVars","ignored","err","preText","disablePluginRule","plugin","serializeVars","preProcessors","getPreProcessors","process","banner","contentsIgnoredChars","Ruleset","primary","endInfo","processImports","mixin","extendRule","definition","declaration","variableCall","entities","atrule","foundSemiColon","mixinLookup","quoted","forceEscaped","isEscaped","k","customFuncCall","stop","declarationCall","validCall","substring","ruleProperty","f","ieAlpha","boolean","condition","if","prevArgs","isSemiColonSeparated","argsComma","argsSemiColon","detachedRuleset","assignment","expression","literal","dimension","unicodeDescriptor","entity","url","property","Variable","Property","ch","variableCurly","curly","propertyCurly","colorKeyword","ud","javascript","js","escape","parsedName","lookups","inValue","ruleLookups","VariableCall","NamespaceValue","isRule","first","element","getLookup","hasParens","parensIndex","parensWS","elem","elemIndex","re","isCall","expressionContainsNamed","nameLoop","expand","returner","variadic","expressions","hasSep","throwAwayComments","cond","params","argInfo","conditions","block","lookupValue","Quoted","attribute","slashedCombinator","isLess","when","ele","cif","content","blockRuleset","Definition","DetachedRuleset","dumpLineNumbers","strictImports","hasDR","permissiveValue","anonymousValue","untilTokens","done","testCurrentChar","variableRegex","propRegex","import","features","dir","importOptions","mediaFeatures","o","optionName","importOption","mediaFeature","syntaxOptions","rangeP","spacing","atomicCondition","rvalue","lvalue","prepareAndGetNestableAtRule","treeType","atRule","nestableAtRule","Media","Container","pluginArgs","atruleUnknown","hasBlock","atruleBlock","isKeywordList","nonVendorSpecificName","hasIdentifier","hasExpression","hasUnknown","unknownPackage","blockPackage","sub","addition","parens","colorOperand","Keyword","multiplication","operation","isSpaced","operand","parensInOp","needsParens","logical","next","conditionAnd","negatedCondition","parenthesisCondition","negate","body","me","tryConditionFollowedByParenthesis","preparsedCond","delim","simpleProperty","vars","name_1","evaldCondition","getElements","mixinElements_","utils.isNullOrUndefined","mediaEmpty","els","importManager","createEmptySelectors","el","sels","olen","mixinElements","isJustParentSelector","True","False","MATH","asComment","ctx","asMediaQuery","filenameWithProtocol","lineSeparator","lastRule","prevMath","evaldValue","mathBypass","evalName","importantResult","makeImportant","isCompressed","defaultFunc","value_","error_","reset","_lookups","_variables","_properties","isRuleset","selCnt","hasVariable","hasOnePassingSelector","toParseSelectors","startingIndex","selectorFileInfo","utils.flattenArray","subRule","originalRuleset","allowImports","globalFunctionRegistry","ctxFrames","ctxSelectors","evalImports","rsRules","evalFirst","mediaBlockCount","mediaBlocks","resetCache","bubbleSelectors","importRules","matchArgs","matchCondition","lastSelector","_rulesets","variables","hash","properties","name_2","decl","parseValue","lastDeclaration","toParse","transformDeclaration","nodes_1","filtRules","prependRule","find","foundMixins","ruleNodes","tabLevel","sep","tabRuleStr","tabSetStr","charsetNodeIndex","importNodeIndex","isCharset","pathCnt","pathSubCnt","currentLastRule","joinSelector","createParenthesis","elementsToPak","originalElement","replacementParen","insideParent","createSelector","containedElement","addReplacementIntoPath","beginningPath","addPath","replacedElement","originalSelector","newSelectorPath","newJoinedSelector","parentEl","restOfPath","addAllReplacementsIntoPath","addPaths","mergeElementsOnToSelectors","sel","deriveSelector","deriveFrom","newPaths","replaceParentSelector","inSelector","currentElements","newSelectors","selectorsMultiplied","maybeSelector","hadParentSelector","nestedSelector","replaced","nestedPaths","replacedNewSelectors","concatenated","Unit","numerator","denominator","backupUnit","sort","strictUnits","returnStr","is","unitString","isLength","RegExp","isSingular","usedUnits","mapUnit","groupName","atomicUnit","cancel","counter","count","Dimension","unit","parseFloat","isNaN","toColor","strValue","convertTo","unify","conversions","targetUnit","applyUnit","derivedConversions","returnValue","doubleParen","NestableAtRulePrototype","evalFunction","expr","exprValues","evalTop","mediaPath","evalNested","permute","fragment","rest","AtRule","allDeclarations","declarationsBlock","allRulesetDeclarations_1","simpleBlock","mergeable","keywordList","outputRuleset","mediaPathBackup","mediaBlocksBackup","evalRoot","mergeRules","less","ampersandCount","noAmpersandCount","noAmpersands","allAmpersands","precedingSelectors","frame","value_1","mixedAmpersands","callEval","Operation","operands","functionCaller","isValid","evalArgs","commentFilter","subNodes","to","from","pack","ar","__spreadArray","calc","currentMathContext","funcCaller","FunctionCaller","columnNumber","evaluating","fun","vArr","escaped","containsVariables","that","iterativeReplace","regexp","replacementFnc","evaluatedValue","name1","name2","URL","isEvald","urlArgs","Import","pathValue","reference","evalPath","doEval","registry","featureValue","layerCss","newImport","JsEvalNode","evaluateJavaScript","evalContext","javascriptEnabled","jsify","toJS","JavaScript","string","Assignment","Condition","QueryInParens","op2","mvalue","mvalues","variableDeclaration","mvalueCopy","UnicodeDescriptor","Negative","next_id","selectorElements","selfElements","ruleCall","arity","optionalParameters","required","evalParams","mixinEnv","evaldArguments","varargs","isNamedFound","argIndex","argsLength","evalCall","_arguments","mixinFrames","allArgsCnt","requiredArgsCnt","MixinCall","mixins","mixinPath","argValue","isRecursive","isOneFound","candidate","defaultResult","noArgumentsFilter","candidates","conditionResult","calcDefGroup","namespace","MixinDefinition","format","newRules","_setVisibilityToReplacement","replacement","AbstractFileManager","lastIndexOf","tryAppendExtension","ext","supportsSync","alwaysMakePathsAbsolute","isPathAbsolute","basePath","laterPath","pathDiff","baseUrl","urlDirectories","baseUrlDirectories","urlParts","extractUrlParts","baseUrlParts","diff","hostPart","directories","urlPartsRegex","rawDirectories","rawPath","fileUrl","AbstractPluginLoader","require","evalPlugin","pluginOptions","pluginObj","localModule","shortname","FileManager","trySetOptions","use","exports","loader","validatePlugin","minVersion","compareVersion","addPlugin","setOptions","version","versionToString","aVersion","bVersion","versionString","printUsage","plugins","If","trueValue","falseValue","isdefined","colorFunctions","boolean$1","hsla","origColor","hsl","number","rgba","size","m1","m2","hue","hsv","hsva","vs","floor","perm","saturation","lightness","hsvhue","hsvsaturation","hsvvalue","luminance","saturate","amount","method","desaturate","lighten","darken","fadein","fadeout","fade","spin","mix","color1","color2","weight","w","w1","w2","greyscale","contrast","dark","light","threshold","argb","tint","shade","colorBlend","mode","cb","cs","cr","ab","as","colorBlendModeFunctions","multiply","screen","overlay","softlight","sqrt","hardlight","difference","abs","exclusion","average","negation","getItemsFromNode","list","_SELF","~","_i","values","range","step","stepValue","each","rs","iterator","tryEval","Quote","valueName","keyName","indexName","MathHelper","fn","mathFunctions","ceil","sin","cos","atan","asin","acos","mathHelper","fraction","num","minMax","isMin","currentUnified","referenceUnified","unitStatic","unitClone","order","convert","pi","mod","y","percentage","evaluated","encodeURI","pattern","flags","%","token","encodeURIComponent","isa","Type","isunit","types","isruleset","iscolor","isnumber","isstring","iskeyword","isurl","ispixel","ispercentage","isem","get-unit","styleExpression","style$1","style","colorBlending","fallback","functionThis","data-uri","mimetypeNode","filePathNode","mimetype","filePath","entryPath","fragmentStart","utils.clone","rawBuffer","useBase64","mimeLookup","charsetLookup","fileSync","loadFileSync","buf","encodeBase64","uri","dataUri","svg-gradient","direction","stops","gradientDirectionSvg","position","positionValue","gradientType","rectangleDimension","renderEnv","directionValue","throwArgumentDescriptor","transformTree","evaldRoot","evalEnv","visitorIterator","preEvalVisitors","isPreEvalVisitor","isPreVisitor","pm","PluginManager","postProcessors","installedPlugins","pluginCache","Loader","PluginLoader","addPlugins","install","addVisitor","addPreProcessor","preProcessor","priority","indexToInsertAt","addPostProcessor","postProcessor","manager","getPostProcessors","getVisitors","PluginManagerFactory","newFactory","parseNodeVersion_1","major","minor","patch","pre","build","lessRoot","sourceMapOutput","sourceMapBuilder","parseTree","SourceMapBuilder","ParseTree","toCSSOptions","sourceMap","file_1","getExternalSourceMap","files","rootFilename","SourceMapOutput","contentsIgnoredCharsMap","contentsMap","sourceMapFilename","sourceMapURL","outputFilename","sourceMapOutputFilename","sourceMapBasepath","sourceMapRootpath","outputSourceFiles","sourceMapGenerator","sourceMapFileInline","disableSourcemapAnnotation","sourceMapInputFilename","normalizeFilename","removeBasepath","getCSSAppendage","setExternalSourceMap","isInline","getSourceMapURL","getOutputFilename","getInputFilename","_css","_rootNode","_contentsMap","_contentsIgnoredCharsMap","_sourceMapFilename","_outputFilename","_sourceMapBasepath","_sourceMapRootpath","_outputSourceFiles","_sourceMapGeneratorConstructor","getSourceMapGenerator","_lineNumber","_column","sourceLines","columns","sourceColumns","inputSource","_sourceMapGenerator","addMapping","generated","source","file","sourceRoot","setSourceContent","sourceMapContent","stringify","toJSON","ImportManager","rootFileInfo","mime","queue","pluginLoader","fileParsedFunc","importedEqualsRoot","newFileInfo","loadedFile","promise","loadFileCallback","resolvedFilename","newEnv","syncImport","loadPluginSync","loadPlugin","loadFile","then","render","utils.copyOptions","self_1","Promise","resolve","reject","Render","context_1","pluginManager_1","reUsePluginManager","imports_1","evalResult","fileContent","parseVersion","initial","ctor","api","fileCache","doXHR","errback","xhr","XMLHttpRequest","async","isFileProtocol","fileAsync","handleResponse","status","responseText","getResponseHeader","overrideMimeType","open","setRequestHeader","send","onreadystatechange","readyState","supports","clearFileCache","location","useFileCache","lessText_1","webInfo","lastModified","Date","FM","log","fulfill","catch","ErrorReporting","rootHref","errorReporting","errors","errorline","classname","logLevel","errorConsole","timer","filenameNoPath","className","innerHTML","env","setInterval","replaceChild","clearInterval","errorHTML","remove","removeErrorHTML","depends","lint","insecure","protocol","poll","hostname","port","onReady","addDefaultOptions","LESS_PLUGINS","loggers","console","LogListener","cache","localStorage","setCSS","setItem","getCSS","getItem","timestamp","valueOf","Cache","imageSize","imageFunctions","image-size","image-width","image-height","ImageSize","typePattern","thisArg","curryArgs","loadStyles","instanceOptions","loadStyleSheet","reload","remaining","local","loadInitialFileCallback","loadStyleSheets","sheets","watch","watchMode","watchTimer","unwatch","registerStylesheetsImmediately","links","rel","registerStylesheets","record","refresh","startTime","endTime","totalMilliseconds","remainingSheets","refreshStyles","resolveOrReject","pageLoadFinished"],"mappings":";;;;;;;;;qOACM,SAAUA,EAAUC,GACtB,OAAOA,EAAKC,QAAQ,qBAAsB,IACrCA,QAAQ,qBAAsB,IAC9BA,QAAQ,MAAO,IACfA,QAAQ,eAAgB,IACxBA,QAAQ,YAAa,KACrBA,QAAQ,MAAO,KAGR,SAAAC,EAAYC,EAASC,GACjC,GAAKA,EACL,IAAK,IAAMC,KAAOD,EAAIE,QAClB,GAAIC,OAAOC,UAAUC,eAAeC,KAAKN,EAAIE,QAASD,GAClD,GAAY,QAARA,GAAyB,oBAARA,GAAqC,aAARA,GAA8B,mBAARA,EACpEF,EAAQE,GAAOD,EAAIE,QAAQD,QAE3B,IACIF,EAAQE,GAAOM,KAAKC,MAAMR,EAAIE,QAAQD,IAE1C,MAAOQ,KClBR,IAAAC,EACA,SAAUC,EAAUC,EAAQC,GAEnC,IAAMjB,EAAOiB,EAAMjB,MAAQ,GAGrBkB,EAAK,QAAQC,OAAAF,EAAMG,OAASC,EAAgBrB,IAG5CsB,EAAeP,EAASQ,eAAeL,GACzCM,GAAmB,EAGjBC,EAAYV,EAASW,cAAc,SACzCD,EAAUE,aAAa,OAAQ,YAC3BV,EAAMW,OACNH,EAAUE,aAAa,QAASV,EAAMW,OAE1CH,EAAUP,GAAKA,EAEVO,EAAUI,aACXJ,EAAUK,YAAYf,EAASgB,eAAef,IAG9CQ,EAAqC,OAAjBF,GAAyBA,EAAaU,WAAWC,OAAS,GAAKR,EAAUO,WAAWC,OAAS,GAC7GX,EAAaY,WAAWC,YAAcV,EAAUS,WAAWC,WAGnE,IAAMC,EAAOrB,EAASsB,qBAAqB,QAAQ,GAInD,GAAqB,OAAjBf,IAA8C,IAArBE,EAA4B,CACrD,IAAMc,EAASrB,GAASA,EAAMsB,aAAe,KACzCD,EACAA,EAAOE,WAAWC,aAAahB,EAAWa,GAE1CF,EAAKN,YAAYL,GAUzB,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B,GAAKN,YAAYw8C,KAErB/R,GAAK+hB,iCACL/hB,GAAK2iB,iBAAmB3iB,GAAKoiB,QAAqB,gBAAbpiB,GAAK4e,KAAuB5D,KAAK0H,GAAiBA"} \ No newline at end of file diff --git a/packages/less/index.cjs b/packages/less/index.cjs new file mode 100644 index 0000000000..7ab2bc4d16 --- /dev/null +++ b/packages/less/index.cjs @@ -0,0 +1,5 @@ +// CJS entry: unwrap the Rollup namespace so require('less') returns the Less API object. +const bundle = require('./dist/less-node.cjs'); + +module.exports = bundle.default || bundle; +Object.assign(module.exports, bundle); diff --git a/packages/less/index.js b/packages/less/index.js deleted file mode 100644 index ccd64aec4f..0000000000 --- a/packages/less/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/less-node').default; diff --git a/packages/less/lib/index.js b/packages/less/lib/index.js new file mode 100644 index 0000000000..0983d3ec31 --- /dev/null +++ b/packages/less/lib/index.js @@ -0,0 +1,164 @@ +/** + * Less.js v5 — powered by Jess + * + * This module provides a Less-compatible API backed by the Jess compiler. + * It supports the same `less.render()` interface that Less 4.x users expect, + * while delegating all parsing, evaluation, and output to Jess with the + * `@jesscss/plugin-less` and `@jesscss/plugin-less-compat` plugins. + * + * @module less + */ + +import { readFileSync } from 'node:fs'; +import { readFile } from 'node:fs/promises'; +import { Compiler } from '@jesscss/compiler'; +import nodeModulesPlugin from '@jesscss/plugin-node-modules'; +import { createLessOptions, getCompilerCacheKey, mapRenderResult } from './options.js'; +import { version } from './version.js'; +import { logger } from './logger.js'; +import { lesscHelper } from './lessc-helper.js'; + +const compilerCache = new Map(); +const lessVersion = version.array; + +function normalizeDiagnosticLines(lines, lineNumber, filePath) { + if (Array.isArray(lines)) { + return lines.map((line) => typeof line === 'string' ? line : String(line)); + } + if (lines && typeof lines === 'object') { + const current = Number(lineNumber) || 1; + return [current - 1, current, current + 1] + .filter((line) => line > 0 && Object.prototype.hasOwnProperty.call(lines, line)) + .map((line) => { + const value = lines[line]; + return typeof value === 'string' ? value : String(value); + }); + } + if (typeof filePath === 'string') { + try { + const sourceLines = readFileSync(filePath, 'utf8').split(/\r?\n/); + const current = Number(lineNumber) || 1; + return [current - 1, current, current + 1] + .filter((line) => line > 0 && line <= sourceLines.length) + .map((line) => sourceLines[line - 1]); + } catch { + return undefined; + } + } + return undefined; +} + +function createRenderErrorFromJessDiagnostic(result, filePath) { + const errors = result?.errors || []; + const diagnostic = errors[0]; + const error = new Error(diagnostic?.message || 'Less render failed'); + + error.type = diagnostic?.phase || 'Syntax'; + error.filename = diagnostic?.filePath || filePath; + error.line = diagnostic?.line || 1; + error.column = diagnostic?.column || 1; + error.extract = normalizeDiagnosticLines(diagnostic?.lines, error.line, error.filename); + error.jessErrors = errors; + error.jessWarnings = result?.warnings || []; + + return error; +} + +/** + * @param {object} configOptions + */ +function getCompiler(configOptions) { + const cacheKey = getCompilerCacheKey(configOptions); + let compiler = compilerCache.get(cacheKey); + if (!compiler) { + compiler = new Compiler(configOptions, { + defaultPlugins: context => [nodeModulesPlugin({ basePath: context.resolutionBaseDir })], + scriptPluginSpecifier: '@jesscss/plugin-js', + scriptPluginResolveFrom: import.meta.url + }); + compilerCache.set(cacheKey, compiler); + } + return compiler; +} + +/** + * Render Less source to CSS. + * + * @param {string} input - Less source string + * @param {import('./options.js').LessRenderOptions} [options={}] + * @param {Function} [callback] - Optional Node-style callback(err, result) + * @returns {Promise} + */ +function render(input, options = {}, callback) { + if (typeof options === 'function') { + callback = options; + options = {}; + } + const promise = (async () => { + const { configOptions, filePath } = createLessOptions(options, { source: input }); + const compiler = getCompiler(configOptions); + + const result = await compiler.renderToResult( + { source: input, filePath, language: 'less', extension: '.less' }, + { ...configOptions, suppressWarnings: true } + ); + + if (result.errors?.length) { + throw createRenderErrorFromJessDiagnostic(result, filePath); + } + + return mapRenderResult(result, options); + })(); + + if (callback) { + promise.then( + result => callback(null, result), + err => callback(err) + ); + } + return promise; +} + +/** + * Render a Less file to CSS. + * + * @param {string} filePath - Absolute or relative path to .less file + * @param {import('./options.js').LessRenderOptions} [options={}] + * @returns {Promise} + */ +async function renderFile(filePath, options = {}) { + const source = await readFile(filePath, 'utf8'); + const { configOptions } = createLessOptions(options, { source }); + const compiler = getCompiler(configOptions); + + const result = await compiler.renderToResult(filePath, { ...configOptions, suppressWarnings: true }); + if (result.errors?.length) { + throw createRenderErrorFromJessDiagnostic(result, filePath); + } + return mapRenderResult(result, options); +} + +/** + * COMPAT GAP (v5): the Less 4.x `less.functions` (custom-function registry via + * `less.functions.functionRegistry.add/addMultiple`) and `less.tree` (node + * constructors) are intentionally NOT present on the Jess-backed build. Jess + * registers custom functions with `defineFunction(name, fn, opts)` supplied + * through the compiler config/plugins, and its values are Jess nodes, not + * `less.tree.*`. Providing these as throwing stubs would break feature-detection + * (`if (less.functions)`), so they are left absent until a real compat surface + * (registry -> defineFunction bridge + tree-node shims) is built. Tracked for + * the broader Less-runner/API-parity work; see also test/less-test.js guards. + * + * @type {import('./types.js').LessStatic} + */ +const less = { + version: lessVersion, + render, + renderFile, + logger, + lesscHelper, + Compiler, +}; + +export default less; +export { render, renderFile, logger, lesscHelper, Compiler, lessVersion as version }; diff --git a/packages/less/lib/lessc-helper.js b/packages/less/lib/lessc-helper.js new file mode 100644 index 0000000000..353f315713 --- /dev/null +++ b/packages/less/lib/lessc-helper.js @@ -0,0 +1,52 @@ +/** + * Helper functions for lessc CLI. + * Adapted from lib.bak/less-node/lessc-helper.js. + * @module less/lib/lessc-helper + */ + +/** @type {Record} */ +const STYLES = { + reset: [0, 0], + bold: [1, 22], + inverse: [7, 27], + underline: [4, 24], + yellow: [33, 39], + green: [32, 39], + red: [31, 39], + grey: [90, 39], +}; + +const lesscHelper = { + /** @param {string} str @param {string} style */ + stylize(str, style) { + const s = STYLES[style] ?? STYLES.reset; + return `\x1b[${s[0]}m${str}\x1b[${s[1]}m`; + }, + + printUsage() { + console.log('usage: lessc [option option=parameter ...] [destination]'); + console.log(''); + console.log('If source is set to `-\' (dash or hyphen-minus), input is read from stdin.'); + console.log(''); + console.log('options:'); + console.log(' -h, --help Prints help (this message) and exit.'); + console.log(' -I PATH, -IPATH Adds an import search path.'); + console.log(' --include-path=PATHS Sets include paths. Separated by `:\'. `;\' also supported on windows.'); + console.log(' --no-color Disables colorized output.'); + console.log(' -s, --silent Suppresses output of error messages.'); + console.log(' --quiet Suppresses output of warnings.'); + console.log(' -v, --version Prints version number and exit.'); + console.log(' --verbose Be verbose.'); + console.log(' --collapse-nesting Flatten nested rules after preserving source-order cascade.'); + console.log(''); + console.log('This release intentionally supports a smaller CLI surface.'); + console.log('Source maps, browser compilation, legacy plugin flags, lint-only mode, and'); + console.log('URL rewrite flags will be revisited in later alphas.'); + console.log(''); + console.log('Report bugs to: http://github.com/less/less.js/issues'); + console.log('Home page: '); + }, +}; + +export { lesscHelper }; +export default lesscHelper; diff --git a/packages/less/lib/logger.js b/packages/less/lib/logger.js new file mode 100644 index 0000000000..976d2f0007 --- /dev/null +++ b/packages/less/lib/logger.js @@ -0,0 +1,76 @@ +/** + * Less logger wired to Jess's logger singleton. + * Forwards to Jess and maintains Less-style addListener/removeListener for compatibility. + * @module less/lib/logger + */ + +import { logger as jessLogger } from '@jesscss/core'; + +/** @typedef {{ error?: (msg: string) => void, warn?: (msg: string) => void, info?: (msg: string) => void, debug?: (msg: string) => void }} LogListener */ + +/** @type {LogListener[]} */ +const _listeners = []; + +/** @param {'error'|'warn'|'info'|'debug'} type @param {string} msg */ +function _fireEvent(type, msg) { + for (const listener of _listeners) { + const fn = listener[type]; + if (fn) fn(msg); + } +} + +// Wrap Jess's logger so Less listeners receive Jess's log output without +// writing directly to stderr/stdout. Library consumers should be able to catch +// `less.render()` rejections without surprise terminal output; the CLI owns +// deciding whether/how to print diagnostics. +jessLogger.configure?.({ + log(...args) { + _fireEvent('debug', args.map(String).join(' ')); + }, + info(...args) { + _fireEvent('info', args.map(String).join(' ')); + }, + warn(...args) { + _fireEvent('warn', args.map(String).join(' ')); + }, + error(...args) { + _fireEvent('error', args.map(String).join(' ')); + }, +}); + +/** Less-compatible logger backed by Jess's singleton */ +const logger = { + /** @param {string} msg */ + error(msg) { + _fireEvent('error', msg); + }, + + /** @param {string} msg */ + warn(msg) { + _fireEvent('warn', msg); + }, + + /** @param {string} msg */ + info(msg) { + _fireEvent('info', msg); + }, + + /** @param {string} msg */ + debug(msg) { + _fireEvent('debug', msg); + }, + + /** @param {LogListener} listener */ + addListener(listener) { + _listeners.push(listener); + }, + + /** @param {LogListener} listener */ + removeListener(listener) { + const i = _listeners.indexOf(listener); + if (i >= 0) _listeners.splice(i, 1); + }, +}; + +export { logger }; +export default logger; diff --git a/packages/less/lib/options.d.ts b/packages/less/lib/options.d.ts new file mode 100644 index 0000000000..73ad44e0f8 --- /dev/null +++ b/packages/less/lib/options.d.ts @@ -0,0 +1,46 @@ +/** + * Options mapping between Less render options and Jess compiler config. + */ + +export interface LessRenderOptions { + filename?: string; + paths?: string[]; + /** + * Legacy Less render plugins are routed through the alpha compatibility + * layer. File-manager, pre/post-processor, and @plugin execution are not + * alpha.1-supported surfaces yet. + */ + plugins?: unknown[]; + math?: number | 'always' | 'parens-division' | 'parens' | 'strict'; + /** + * Opt into Less 4-style flattened output. Less v5 preserves authored nesting + * by default. + */ + collapseNesting?: boolean; + /** @internal Jess alpha benchmark-only flag for source graphs already proven @plugin-free. */ + __jessSkipLessCompatWhenPluginFree?: boolean; +} + +export interface LessRenderResult { + css: string; + map?: string; + imports?: string[]; +} + +export interface JessRenderResult { + css?: string; + map?: string | object; + imports?: string[]; +} + +export function createLessOptions(options?: LessRenderOptions): { + configOptions: object; + filePath?: string; +}; + +export function getCompilerCacheKey(configOptions: object): string; + +export function mapRenderResult( + result: JessRenderResult, + options?: LessRenderOptions +): LessRenderResult; diff --git a/packages/less/lib/options.js b/packages/less/lib/options.js new file mode 100644 index 0000000000..63db5c0a22 --- /dev/null +++ b/packages/less/lib/options.js @@ -0,0 +1,145 @@ +/** + * Options mapping between Less render options and Jess compiler config. + * @module less/lib/options + */ + +import lessPlugin from '@jesscss/plugin-less'; +import { lessCompatPlugin } from '@jesscss/plugin-less-compat'; + +const unsupportedAlphaOptions = new Map([ + ['sourceMap', 'source maps are not supported'], + ['sourceMapFilename', 'source maps are not supported'], + ['sourceMapRootpath', 'source maps are not supported'], + ['sourceMapBasepath', 'source maps are not supported'], + ['sourceMapURL', 'source maps are not supported'], + ['sourceMapFileInline', 'source maps are not supported'], + ['globalVars', 'global variable injection is not supported'], + ['modifyVars', 'modify-var injection is not supported'], + ['strictUnits', 'strict unit mode is not supported'], + ['rootpath', 'URL rootpath rewriting is not supported'], + ['rewriteUrls', 'URL rewriting is not supported'], + ['urlArgs', 'URL argument rewriting is not supported'], + ['javascriptEnabled', 'JavaScript evaluation is not supported'], + ['compress', 'compressed output is not supported'], +]); + +function validateAlphaOptions(options) { + for (const [name, reason] of unsupportedAlphaOptions) { + if (Object.prototype.hasOwnProperty.call(options, name)) { + throw new Error(`${name} is not supported: ${reason}`); + } + } +} + +/** + * @param {any} value + * @param {WeakSet} [seen] + * @returns {string} + */ +function stableStringify(value, seen = new WeakSet()) { + if (value == null || typeof value !== 'object') { + if (typeof value === 'function') { + return JSON.stringify(`[function ${value.name || 'anonymous'}]`); + } + return JSON.stringify(value); + } + if (seen.has(value)) { + return '"[Circular]"'; + } + seen.add(value); + if (Array.isArray(value)) { + return `[${value.map((item) => stableStringify(item, seen)).join(',')}]`; + } + if (value.name && typeof value.name === 'string' && ('install' in value || 'parser' in value || 'opts' in value)) { + return stableStringify({ + plugin: value.name, + opts: value.opts || {}, + }, seen); + } + const entries = Object.keys(value) + .sort() + .map((key) => `${JSON.stringify(key)}:${stableStringify(value[key], seen)}`); + return `{${entries.join(',')}}`; +} + +/** + * Map Less render options to Jess compiler config. + * @param {import('./options.js').LessRenderOptions} [options] Less-style options + * @returns {{ configOptions: object, filePath?: string }} + */ +export function createLessOptions(options) { + const opts = options || {}; + validateAlphaOptions(opts); + const filePath = opts.filename || undefined; + const lessPlugins = Array.isArray(opts.plugins) ? opts.plugins : []; + const skipLessCompat = + opts.__jessSkipLessCompatWhenPluginFree === true && lessPlugins.length === 0; + + const math = /** @type {number|string|undefined} */ (opts.math); + const mathMode = + math === 0 || math === 'always' ? 'always' : + math === 2 || math === 'parens' || math === 'strict' ? 'parens' : + 'parens-division'; + + const plugins = [lessPlugin()]; + if (!skipLessCompat) { + plugins.push(lessCompatPlugin({ plugins: lessPlugins })); + } + + const configOptions = { + compile: { + searchPaths: opts.paths || [], + mathMode, + plugins, + }, + // Less v5 preserves authored nesting unless its explicit compatibility + // switch requests flattened CSS. Keep that public Less option at the + // wrapper boundary; Jess owns the one renderer and its output mode. + // A file's styles.config may use an output array. A file-less output entry + // is the compiler's documented per-render override for that shape, so an + // explicit public Less option remains authoritative over fixture config. + output: Object.prototype.hasOwnProperty.call(opts, 'collapseNesting') + ? [{ collapseNesting: opts.collapseNesting === true }] + : {}, + language: {}, + }; + + return { configOptions, filePath }; +} + +/** + * Stable compiler cache key for a Jess compiler configured from Less options. + * @param {object} configOptions Jess compiler config + * @returns {string} + */ +export function getCompilerCacheKey(configOptions) { + return stableStringify(configOptions); +} + +/** + * Map Jess render result to Less-style result. + * @param {import('./options.js').JessRenderResult} result Jess compiler result + * @param {import('./options.js').LessRenderOptions} [options] Original Less options + * @returns {import('./options.js').LessRenderResult} + */ +export function mapRenderResult(result, options) { + const opts = options || {}; + /** @type {import('./options.js').LessRenderResult} */ + const out = { + css: result.css ?? '', + }; + + if (result.imports && Array.isArray(result.imports)) { + out.imports = result.imports; + } + + // Structured Jess warnings (e.g. selector/parentless-ampersand). Exposed so + // callers and tests can assert them, mirroring how errors surface. + if (result.warnings && Array.isArray(result.warnings)) { + out.warnings = result.warnings; + } + + return out; +} + +export default { createLessOptions, getCompilerCacheKey, mapRenderResult }; diff --git a/packages/less/lib/types.js b/packages/less/lib/types.js new file mode 100644 index 0000000000..2daf9da6fe --- /dev/null +++ b/packages/less/lib/types.js @@ -0,0 +1,20 @@ +/** + * JSDoc type definitions for Less.js v5 (Jess wrapper). + * @module less/lib/types + */ + +/** + * @typedef {import('./options.js').LessRenderResult} LessRenderResult + */ + +/** + * @typedef {Object} LessStatic + * @property {number[]} version Less-compatible version tuple + * @property {function(string, import('./options.js').LessRenderOptions?, function?): Promise} render Render Less to CSS + * @property {function(string, import('./options.js').LessRenderOptions?): Promise} renderFile Render Less file to CSS + * @property {import('./logger.js').default} logger Logger instance + * @property {import('./lessc-helper.js').default} lesscHelper CLI helper + * @property {object} Compiler Jess Compiler class + */ + +export {}; diff --git a/packages/less/lib/version.js b/packages/less/lib/version.js new file mode 100644 index 0000000000..d918588fce --- /dev/null +++ b/packages/less/lib/version.js @@ -0,0 +1,19 @@ +/** + * Version info for Less.js v5 (Jess wrapper). + * @module less/lib/version + */ + +import { createRequire } from 'module'; +import parseNodeVersion from 'parse-node-version'; + +const require = createRequire(import.meta.url); +const pkg = require('../package.json'); +const semver = pkg.version || '5.0.0-alpha.0'; +const parsed = parseNodeVersion(`v${semver}`); + +export const version = { + semver, + array: [parsed.major, parsed.minor, parsed.patch], +}; + +export default version; diff --git a/packages/less/package.json b/packages/less/package.json index 3daf466dc3..fb7f513c58 100644 --- a/packages/less/package.json +++ b/packages/less/package.json @@ -1,6 +1,6 @@ { "name": "less", - "version": "4.5.0", + "version": "5.0.0-alpha.1", "description": "Leaner CSS", "homepage": "http://lesscss.org", "author": { @@ -15,48 +15,57 @@ }, "repository": { "type": "git", - "url": "https://github.com/less/less.js.git" + "url": "git+https://github.com/less/less.js.git" }, "master": { "url": "https://github.com/less/less.js/blob/master/", "raw": "https://raw.githubusercontent.com/less/less.js/master/" }, "license": "Apache-2.0", + "type": "module", "bin": { - "lessc": "./bin/lessc" + "lessc": "bin/lessc" + }, + "main": "./dist/less-node.cjs", + "exports": { + ".": { + "import": "./lib/index.js", + "require": "./dist/less-node.cjs", + "default": "./lib/index.js" + }, + "./lib/*": "./lib/*", + "./dist/less-node.cjs": "./dist/less-node.cjs" }, - "main": "index", - "module": "./lib/less-node/index", "directories": { "test": "./test" }, - "browser": "./dist/less.js", + "files": [ + "bin", + "lib", + "!lib/**/*.map", + "dist", + "index.cjs", + "README.md" + ], "engines": { - "node": ">=14" + "node": "^20.19.0 || >=22.12.0" }, "scripts": { - "quicktest": "grunt quicktest", - "test": "grunt test", - "test:node": "grunt test:node", - "test:coverage": "c8 -r lcov -r json-summary -r text-summary -r html --include=\"lib/**/*.js\" --include=\"bin/**/*.js\" --exclude=\"dist/**\" --exclude=\"**/*.test.js\" --exclude=\"**/*.spec.js\" --exclude=\"test/**\" --exclude=\"tmp/**\" --exclude=\"**/abstract-file-manager.js\" --exclude=\"**/abstract-plugin-loader.js\" grunt shell:test && node scripts/coverage-report.js && node scripts/coverage-lines.js", - "grunt": "grunt", + "quicktest": "npm run test:legacy-node", + "test:alpha": "npm run typecheck && npm run build && npm run test:lessc && node test/jess-alpha-fast-path.mjs && node test/alpha-support.mjs && node test/alpha-fixtures.mjs", + "test:lessc": "node test/lessc-alpha.mjs", + "test": "npm run test:alpha", + "test:module": "node test/test-es6.js && node test/test-cjs.cjs", + "test:legacy-node": "node test/index.js", + "test:node": "npm run test:module", + "test:coverage": "c8 -r lcov -r json-summary -r text-summary -r html --include=\"lib/**/*.js\" --include=\"bin/**/*.js\" --exclude=\"dist/**\" --exclude=\"**/*.test.js\" --exclude=\"**/*.spec.js\" --exclude=\"test/**\" --exclude=\"tmp/**\" --exclude=\"**/abstract-file-manager.js\" --exclude=\"**/abstract-plugin-loader.js\" npm run test:legacy-node && node scripts/coverage-report.js && node scripts/coverage-lines.js", "lint": "eslint '**/*.{ts,js}'", "lint:fix": "eslint '**/*.{ts,js}' --fix", - "build": "npm-run-all clean compile", - "clean": "shx rm -rf ./lib tsconfig.tsbuildinfo", - "compile": "tsc -p tsconfig.build.json", - "dev": "tsc -p tsconfig.build.json -w", - "prepublishOnly": "grunt dist", - "postinstall": "node scripts/postinstall.js" - }, - "optionalDependencies": { - "errno": "^0.1.1", - "graceful-fs": "^4.1.2", - "image-size": "~0.5.0", - "make-dir": "^2.1.0", - "mime": "^1.4.1", - "needle": "^3.1.0", - "source-map": "~0.6.0" + "typecheck": "tsc --noEmit", + "build": "node build/rollup.js --dist", + "benchmark": "node benchmark/benchmark-runner.cjs", + "benchmark:all": "node benchmark/run-and-compare.mjs", + "prepublishOnly": "npm run typecheck && npm run build && npm run test:lessc" }, "devDependencies": { "@less/test-data": "workspace:*", @@ -64,30 +73,22 @@ "@rollup/plugin-commonjs": "^17.0.0", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^11.0.0", + "@types/node": "^18", "@typescript-eslint/eslint-plugin": "^4.28.0", "@typescript-eslint/parser": "^4.28.0", "benny": "^3.6.12", "bootstrap-less-port": "0.3.0", - "chai": "^4.2.0", "c8": "^10.1.3", + "chai": "^4.2.0", "chalk": "^4.1.2", "cosmiconfig": "~9.0.0", "cross-env": "^7.0.3", "eslint": "^7.29.0", "fs-extra": "^8.1.0", - "git-rev": "^0.2.1", "glob": "~11.0.3", "globby": "^10.0.1", - "grunt": "^1.0.4", - "grunt-cli": "^1.3.2", - "grunt-contrib-clean": "^1.0.0", - "grunt-contrib-connect": "^1.0.2", - "grunt-eslint": "^23.0.0", - "grunt-saucelabs": "^9.0.1", - "grunt-shell": "^1.3.0", "html-template-tag": "^3.2.0", "jest-diff": "~30.1.2", - "jit-grunt": "^0.10.0", "less-plugin-autoprefix": "^1.5.1", "less-plugin-clean-css": "^1.6.0", "minimist": "^1.2.0", @@ -95,20 +96,20 @@ "mocha-teamcity-reporter": "^3.0.0", "npm-run-all": "^4.1.5", "performance-now": "^0.2.0", - "phin": "^2.2.3", "playwright": "1.50.1", "promise": "^7.1.1", "read-glob": "^3.0.0", "resolve": "^1.17.0", "rollup": "^2.52.2", "rollup-plugin-terser": "^5.1.1", - "rollup-plugin-typescript2": "^0.29.0", "semver": "^6.3.0", "shx": "^0.3.2", - "time-grunt": "^1.3.0", - "ts-node": "^10.9.1", - "typescript": "^4.3.4", - "uikit": "2.27.4" + "typescript": "^5.7.0", + "uikit": "2.27.4", + "url": "^0.11.4", + "path-browserify": "^1.0.1", + "webpack": "^5.64.6", + "webpack-cli": "^5.1.4" }, "keywords": [ "compile less", @@ -138,9 +139,21 @@ "rawcurrent": "https://raw.github.com/less/less.js/v", "sourcearchive": "https://github.com/less/less.js/archive/v", "dependencies": { - "copy-anything": "^2.0.1", + "@jesscss/compiler": "2.0.0-alpha.11", + "@jesscss/core": "2.0.0-alpha.11", + "@jesscss/plugin-less": "2.0.0-alpha.11", + "@jesscss/plugin-less-compat": "2.0.0-alpha.11", + "@jesscss/plugin-node-modules": "2.0.0-alpha.11", "parse-node-version": "^1.0.1", - "tslib": "^2.3.0" + "parseman": "^0.41.0" + }, + "peerDependencies": { + "@jesscss/plugin-js": "2.0.0-alpha.11" + }, + "peerDependenciesMeta": { + "@jesscss/plugin-js": { + "optional": true + } }, "gitHead": "1df9072ee9ebdadc791bf35dfb1dbc3ef9f1948f" } diff --git a/packages/less/scripts/coverage-lines.js b/packages/less/scripts/coverage-lines.js index f912e96369..5adcca63d2 100644 --- a/packages/less/scripts/coverage-lines.js +++ b/packages/less/scripts/coverage-lines.js @@ -6,8 +6,11 @@ * Also outputs JSON file with uncovered lines for programmatic access */ -const fs = require('fs'); -const path = require('path'); +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); const lcovPath = path.join(__dirname, '..', 'coverage', 'lcov.info'); const jsonOutputPath = path.join(__dirname, '..', 'coverage', 'uncovered-lines.json'); @@ -26,28 +29,28 @@ let currentFile = null; const lines = lcovContent.split('\n'); for (let i = 0; i < lines.length; i++) { const line = lines[i]; - + // SF: source file if (line.startsWith('SF:')) { if (currentFile) { files.push(currentFile); } const filePath = line.substring(3); - // Only include src/ files (not less-browser) and bin/ + // Only include lib/ files (not less-browser) and bin/ // Exclude abstract base classes (they're meant to be overridden) const normalized = filePath.replace(/\\/g, '/'); const abstractClasses = ['abstract-file-manager', 'abstract-plugin-loader']; const isAbstract = abstractClasses.some(abstract => normalized.includes(abstract)); - - if (!isAbstract && - ((normalized.includes('src/less/') && !normalized.includes('src/less-browser/')) || - normalized.includes('src/less-node/') || + + if (!isAbstract && + ((normalized.includes('lib/less/') && !normalized.includes('lib/less-browser/')) || + normalized.includes('lib/less-node/') || normalized.includes('bin/'))) { - // Extract relative path - match src/less/... or src/less-node/... or bin/... - // Path format: src/less/tree/debug-info.js or src/less-node/file-manager.js - // Match from src/ or bin/ to end of path - const match = normalized.match(/(src\/[^/]+\/.+|bin\/.+)$/); - const relativePath = match ? match[1] : (normalized.includes('/src/') || normalized.includes('/bin/') ? normalized.split('/').slice(-3).join('/') : path.basename(filePath)); + // Extract relative path - match lib/less/... or lib/less-node/... or bin/... + // Path format: lib/less/tree/debug-info.js or lib/less-node/file-manager.js + // Match from lib/ or bin/ to end of path + const match = normalized.match(/(lib\/[^/]+\/.+|bin\/.+)$/); + const relativePath = match ? match[1] : (normalized.includes('/lib/') || normalized.includes('/bin/') ? normalized.split('/').slice(-3).join('/') : path.basename(filePath)); currentFile = { path: relativePath, fullPath: filePath, @@ -60,7 +63,7 @@ for (let i = 0; i < lines.length; i++) { currentFile = null; } } - + // DA: line data (line number, execution count) if (currentFile && line.startsWith('DA:')) { const match = line.match(/^DA:(\d+),(\d+)$/); @@ -94,7 +97,7 @@ files.forEach(file => { } }); } catch (err) { - // If we can't read the source (e.g., it's in lib/ but we want src/), that's ok + // If we can't read the source, that's ok // We'll just skip the source code } } @@ -114,7 +117,7 @@ if (filesWithGaps.length === 0) { console.log('\n⚠️ No source files found in coverage data. This may indicate an issue with the coverage report.\n'); } else { console.log('\n✅ All analyzed files have 100% line coverage!\n'); - console.log(`(Analyzed ${files.length} files from src/less/, src/less-node/, and bin/)\n`); + console.log(`(Analyzed ${files.length} files from lib/less/, lib/less-node/, and bin/)\n`); } process.exit(0); } @@ -124,18 +127,18 @@ console.log('Uncovered Lines Report'); console.log('='.repeat(100) + '\n'); filesWithGaps.forEach(file => { - const coveragePct = file.totalLines > 0 + const coveragePct = file.totalLines > 0 ? ((file.coveredLines / file.totalLines) * 100).toFixed(1) : '0.0'; - + console.log(`\n${file.path} (${coveragePct}% coverage)`); console.log('-'.repeat(100)); - + // Group consecutive lines into ranges const ranges = []; let start = file.uncoveredLines[0]; let end = file.uncoveredLines[0]; - + for (let i = 1; i < file.uncoveredLines.length; i++) { if (file.uncoveredLines[i] === end + 1) { end = file.uncoveredLines[i]; @@ -146,14 +149,14 @@ filesWithGaps.forEach(file => { } } ranges.push(start === end ? `${start}` : `${start}..${end}`); - + // Display ranges (max 5 per line for readability) const linesPerRow = 5; for (let i = 0; i < ranges.length; i += linesPerRow) { const row = ranges.slice(i, i + linesPerRow); console.log(` Lines: ${row.join(', ')}`); } - + console.log(` Total uncovered: ${file.uncoveredLines.length} of ${file.totalLines} lines`); }); @@ -173,7 +176,7 @@ const jsonOutput = { } return file.fullPath; })(), - coveragePercent: file.totalLines > 0 + coveragePercent: file.totalLines > 0 ? parseFloat(((file.coveredLines / file.totalLines) * 100).toFixed(1)) : 0, totalLines: file.totalLines, @@ -183,10 +186,10 @@ const jsonOutput = { uncoveredRanges: (() => { const ranges = []; if (file.uncoveredLines.length === 0) return ranges; - + let start = file.uncoveredLines[0]; let end = file.uncoveredLines[0]; - + for (let i = 1; i < file.uncoveredLines.length; i++) { if (file.uncoveredLines[i] === end + 1) { end = file.uncoveredLines[i]; @@ -204,4 +207,3 @@ const jsonOutput = { fs.writeFileSync(jsonOutputPath, JSON.stringify(jsonOutput, null, 2), 'utf8'); console.log('\n📄 Uncovered lines data written to: coverage/uncovered-lines.json\n'); - diff --git a/packages/less/scripts/coverage-report.js b/packages/less/scripts/coverage-report.js index 866937c339..54b27ce436 100644 --- a/packages/less/scripts/coverage-report.js +++ b/packages/less/scripts/coverage-report.js @@ -1,11 +1,14 @@ #!/usr/bin/env node /** - * Generates a per-file coverage report table for src/ directories + * Generates a per-file coverage report table for lib/ directories */ -const fs = require('fs'); -const path = require('path'); +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); const coverageSummaryPath = path.join(__dirname, '..', 'coverage', 'coverage-summary.json'); @@ -16,8 +19,8 @@ if (!fs.existsSync(coverageSummaryPath)) { const coverage = JSON.parse(fs.readFileSync(coverageSummaryPath, 'utf8')); -// Filter to only src/ files (less, less-node) and bin/ files -// Note: src/less-browser/ is excluded because browser tests aren't included in coverage +// Filter to only lib/ files (less, less-node) and bin/ files +// Note: lib/less-browser/ is excluded because browser tests aren't included in coverage // Abstract base classes are excluded as they're meant to be overridden by implementations const abstractClasses = [ 'abstract-file-manager', @@ -31,17 +34,17 @@ const srcFiles = Object.entries(coverage) if (abstractClasses.some(abstract => normalized.includes(abstract))) { return false; } - return (normalized.includes('/src/less/') && !normalized.includes('/src/less-browser/')) || - normalized.includes('/src/less-node/') || + return (normalized.includes('/lib/less/') && !normalized.includes('/lib/less-browser/')) || + normalized.includes('/lib/less-node/') || normalized.includes('/bin/'); }) .map(([filePath, data]) => { // Extract relative path from absolute path const normalized = filePath.replace(/\\/g, '/'); - // Match src/ paths or bin/ paths - const match = normalized.match(/((?:src\/[^/]+\/[^/]+\/|bin\/).+)$/); + // Match lib/ paths or bin/ paths + const match = normalized.match(/((?:lib\/[^/]+\/[^/]+\/|bin\/).+)$/); const relativePath = match ? match[1] : path.basename(filePath); - + return { path: relativePath, statements: data.statements, @@ -58,22 +61,22 @@ const srcFiles = Object.entries(coverage) }); if (srcFiles.length === 0) { - console.log('No src/ files found in coverage report.'); + console.log('No lib/ files found in coverage report.'); process.exit(0); } // Group by directory const grouped = { - 'src/less/': [], - 'src/less-node/': [], + 'lib/less/': [], + 'lib/less-node/': [], 'bin/': [] }; srcFiles.forEach(file => { - if (file.path.startsWith('src/less/')) { - grouped['src/less/'].push(file); - } else if (file.path.startsWith('src/less-node/')) { - grouped['src/less-node/'].push(file); + if (file.path.startsWith('lib/less/')) { + grouped['lib/less/'].push(file); + } else if (file.path.startsWith('lib/less-node/')) { + grouped['lib/less-node/'].push(file); } else if (file.path.startsWith('bin/')) { grouped['bin/'].push(file); } @@ -81,29 +84,29 @@ srcFiles.forEach(file => { // Print table console.log('\n' + '='.repeat(100)); -console.log('Per-File Coverage Report (src/less/, src/less-node/, and bin/)'); +console.log('Per-File Coverage Report (lib/less/, lib/less-node/, and bin/)'); console.log('='.repeat(100)); console.log('For line-by-line coverage details, open coverage/index.html in your browser.'); console.log('='.repeat(100) + '\n'); Object.entries(grouped).forEach(([dir, files]) => { if (files.length === 0) return; - + console.log(`\n${dir.toUpperCase()}`); console.log('-'.repeat(100)); console.log( - 'File'.padEnd(50) + - 'Statements'.padStart(12) + - 'Branches'.padStart(12) + - 'Functions'.padStart(12) + + 'File'.padEnd(50) + + 'Statements'.padStart(12) + + 'Branches'.padStart(12) + + 'Functions'.padStart(12) + 'Lines'.padStart(12) ); console.log('-'.repeat(100)); - + files.forEach(file => { const filename = file.path.replace(dir, ''); const truncated = filename.length > 48 ? '...' + filename.slice(-45) : filename; - + console.log( truncated.padEnd(50) + `${file.statements.pct.toFixed(1)}%`.padStart(12) + @@ -112,7 +115,7 @@ Object.entries(grouped).forEach(([dir, files]) => { `${file.lines.pct.toFixed(1)}%`.padStart(12) ); }); - + // Summary for this directory const totals = files.reduce((acc, file) => { acc.statements.total += file.statements.total; @@ -130,8 +133,8 @@ Object.entries(grouped).forEach(([dir, files]) => { functions: { total: 0, covered: 0 }, lines: { total: 0, covered: 0 } }); - - const stmtPct = totals.statements.total > 0 + + const stmtPct = totals.statements.total > 0 ? (totals.statements.covered / totals.statements.total * 100).toFixed(1) : '0.0'; const branchPct = totals.branches.total > 0 @@ -143,7 +146,7 @@ Object.entries(grouped).forEach(([dir, files]) => { const linePct = totals.lines.total > 0 ? (totals.lines.covered / totals.lines.total * 100).toFixed(1) : '0.0'; - + console.log('-'.repeat(100)); console.log( 'TOTAL'.padEnd(50) + @@ -155,4 +158,3 @@ Object.entries(grouped).forEach(([dir, files]) => { }); console.log('\n' + '='.repeat(100) + '\n'); - diff --git a/packages/less/scripts/postinstall.js b/packages/less/scripts/postinstall.js index af5ec9b38c..028ee55e1a 100644 --- a/packages/less/scripts/postinstall.js +++ b/packages/less/scripts/postinstall.js @@ -1,61 +1,44 @@ #!/usr/bin/env node -/** - * Post-install script for Less.js package - * - * This script installs Playwright browsers only when: - * 1. This is a development environment (not when installed as a dependency) - * 2. We're in a monorepo context (parent package.json exists) - * 3. Not running in CI or other automated environments - */ +import fs from 'fs'; +import path from 'path'; +import { execSync } from 'child_process'; +import { fileURLToPath } from 'url'; -const fs = require('fs'); -const path = require('path'); -const { execSync } = require('child_process'); +const __dirname = path.dirname(fileURLToPath(import.meta.url)); -// Check if we're in a development environment function isDevelopmentEnvironment() { - // Skip if this is a global install or user config if (process.env.npm_config_user_config || process.env.npm_config_global) { return false; } - - // Skip in CI environments if (process.env.CI || process.env.GITHUB_ACTIONS || process.env.TRAVIS) { return false; } - - // Check if we're in a monorepo (parent package.json exists) const parentPackageJson = path.join(__dirname, '../../../package.json'); if (!fs.existsSync(parentPackageJson)) { return false; } - - // Check if this is the root of the monorepo const currentPackageJson = path.join(__dirname, '../package.json'); if (!fs.existsSync(currentPackageJson)) { return false; } - return true; } -// Install Playwright browsers function installPlaywrightBrowsers() { try { - console.log('🎭 Installing Playwright browsers for development...'); - execSync('pnpm exec playwright install', { + console.log('Installing Playwright browsers for development...'); + execSync('pnpm exec playwright install', { stdio: 'inherit', cwd: path.join(__dirname, '..') }); - console.log('✅ Playwright browsers installed successfully'); + console.log('Playwright browsers installed successfully'); } catch (error) { - console.warn('⚠️ Failed to install Playwright browsers:', error.message); - console.warn(' You can install them manually with: pnpm exec playwright install'); + console.warn('Failed to install Playwright browsers:', error.message); + console.warn('You can install them manually with: pnpm exec playwright install'); } } -// Main execution if (isDevelopmentEnvironment()) { installPlaywrightBrowsers(); } diff --git a/packages/less/src/less-browser/add-default-options.js b/packages/less/src/less-browser/add-default-options.js deleted file mode 100644 index d839595f96..0000000000 --- a/packages/less/src/less-browser/add-default-options.js +++ /dev/null @@ -1,49 +0,0 @@ -import {addDataAttr} from './utils'; -import browser from './browser'; - -export default (window, options) => { - - // use options from the current script tag data attribues - addDataAttr(options, browser.currentScript(window)); - - if (options.isFileProtocol === undefined) { - options.isFileProtocol = /^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(window.location.protocol); - } - - // Load styles asynchronously (default: false) - // - // This is set to `false` by default, so that the body - // doesn't start loading before the stylesheets are parsed. - // Setting this to `true` can result in flickering. - // - options.async = options.async || false; - options.fileAsync = options.fileAsync || false; - - // Interval between watch polls - options.poll = options.poll || (options.isFileProtocol ? 1000 : 1500); - - options.env = options.env || (window.location.hostname == '127.0.0.1' || - window.location.hostname == '0.0.0.0' || - window.location.hostname == 'localhost' || - (window.location.port && - window.location.port.length > 0) || - options.isFileProtocol ? 'development' - : 'production'); - - const dumpLineNumbers = /!dumpLineNumbers:(comments|mediaquery|all)/.exec(window.location.hash); - if (dumpLineNumbers) { - options.dumpLineNumbers = dumpLineNumbers[1]; - } - - if (options.useFileCache === undefined) { - options.useFileCache = true; - } - - if (options.onReady === undefined) { - options.onReady = true; - } - - if (options.relativeUrls) { - options.rewriteUrls = 'all'; - } -}; diff --git a/packages/less/src/less-browser/bootstrap.js b/packages/less/src/less-browser/bootstrap.js deleted file mode 100644 index 2a73fe3c3d..0000000000 --- a/packages/less/src/less-browser/bootstrap.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Kicks off less and compiles any stylesheets - * used in the browser distributed version of less - * to kick-start less using the browser api - */ -import defaultOptions from '../less/default-options'; -import addDefaultOptions from './add-default-options'; -import root from './index'; - -const options = defaultOptions(); - -if (window.less) { - for (const key in window.less) { - if (Object.prototype.hasOwnProperty.call(window.less, key)) { - options[key] = window.less[key]; - } - } -} -addDefaultOptions(window, options); - -options.plugins = options.plugins || []; - -if (window.LESS_PLUGINS) { - options.plugins = options.plugins.concat(window.LESS_PLUGINS); -} - -const less = root(window, options); -export default less; - -window.less = less; - -let css; -let head; -let style; - -// Always restore page visibility -function resolveOrReject(data) { - if (data.filename) { - console.warn(data); - } - if (!options.async) { - head.removeChild(style); - } -} - -if (options.onReady) { - if (/!watch/.test(window.location.hash)) { - less.watch(); - } - // Simulate synchronous stylesheet loading by hiding page rendering - if (!options.async) { - css = 'body { display: none !important }'; - head = document.head || document.getElementsByTagName('head')[0]; - style = document.createElement('style'); - - style.type = 'text/css'; - if (style.styleSheet) { - style.styleSheet.cssText = css; - } else { - style.appendChild(document.createTextNode(css)); - } - - head.appendChild(style); - } - less.registerStylesheetsImmediately(); - less.pageLoadFinished = less.refresh(less.env === 'development').then(resolveOrReject, resolveOrReject); -} diff --git a/packages/less/src/less-browser/browser.js b/packages/less/src/less-browser/browser.js deleted file mode 100644 index 58f339ccfb..0000000000 --- a/packages/less/src/less-browser/browser.js +++ /dev/null @@ -1,65 +0,0 @@ -import * as utils from './utils'; - -export default { - createCSS: function (document, styles, sheet) { - // Strip the query-string - const href = sheet.href || ''; - - // If there is no title set, use the filename, minus the extension - const id = `less:${sheet.title || utils.extractId(href)}`; - - // If this has already been inserted into the DOM, we may need to replace it - const oldStyleNode = document.getElementById(id); - let keepOldStyleNode = false; - - // Create a new stylesheet node for insertion or (if necessary) replacement - const styleNode = document.createElement('style'); - styleNode.setAttribute('type', 'text/css'); - if (sheet.media) { - styleNode.setAttribute('media', sheet.media); - } - styleNode.id = id; - - if (!styleNode.styleSheet) { - styleNode.appendChild(document.createTextNode(styles)); - - // If new contents match contents of oldStyleNode, don't replace oldStyleNode - keepOldStyleNode = (oldStyleNode !== null && oldStyleNode.childNodes.length > 0 && styleNode.childNodes.length > 0 && - oldStyleNode.firstChild.nodeValue === styleNode.firstChild.nodeValue); - } - - const head = document.getElementsByTagName('head')[0]; - - // If there is no oldStyleNode, just append; otherwise, only append if we need - // to replace oldStyleNode with an updated stylesheet - if (oldStyleNode === null || keepOldStyleNode === false) { - const nextEl = sheet && sheet.nextSibling || null; - if (nextEl) { - nextEl.parentNode.insertBefore(styleNode, nextEl); - } else { - head.appendChild(styleNode); - } - } - if (oldStyleNode && keepOldStyleNode === false) { - oldStyleNode.parentNode.removeChild(oldStyleNode); - } - - // For IE. - // This needs to happen *after* the style element is added to the DOM, otherwise IE 7 and 8 may crash. - // See http://social.msdn.microsoft.com/Forums/en-US/7e081b65-878a-4c22-8e68-c10d39c2ed32/internet-explorer-crashes-appending-style-element-to-head - if (styleNode.styleSheet) { - try { - styleNode.styleSheet.cssText = styles; - } catch (e) { - throw new Error('Couldn\'t reassign styleSheet.cssText.'); - } - } - }, - currentScript: function(window) { - const document = window.document; - return document.currentScript || (() => { - const scripts = document.getElementsByTagName('script'); - return scripts[scripts.length - 1]; - })(); - } -}; diff --git a/packages/less/src/less-browser/cache.js b/packages/less/src/less-browser/cache.js deleted file mode 100644 index a106a63357..0000000000 --- a/packages/less/src/less-browser/cache.js +++ /dev/null @@ -1,43 +0,0 @@ -// Cache system is a bit outdated and could do with work - -export default (window, options, logger) => { - let cache = null; - if (options.env !== 'development') { - try { - cache = (typeof window.localStorage === 'undefined') ? null : window.localStorage; - } catch (_) {} - } - return { - setCSS: function(path, lastModified, modifyVars, styles) { - if (cache) { - logger.info(`saving ${path} to cache.`); - try { - cache.setItem(path, styles); - cache.setItem(`${path}:timestamp`, lastModified); - if (modifyVars) { - cache.setItem(`${path}:vars`, JSON.stringify(modifyVars)); - } - } catch (e) { - // TODO - could do with adding more robust error handling - logger.error(`failed to save "${path}" to local storage for caching.`); - } - } - }, - getCSS: function(path, webInfo, modifyVars) { - const css = cache && cache.getItem(path); - const timestamp = cache && cache.getItem(`${path}:timestamp`); - let vars = cache && cache.getItem(`${path}:vars`); - - modifyVars = modifyVars || {}; - vars = vars || '{}'; // if not set, treat as the JSON representation of an empty object - - if (timestamp && webInfo.lastModified && - (new Date(webInfo.lastModified).valueOf() === - new Date(timestamp).valueOf()) && - JSON.stringify(modifyVars) === vars) { - // Use local copy - return css; - } - } - }; -}; diff --git a/packages/less/src/less-browser/error-reporting.js b/packages/less/src/less-browser/error-reporting.js deleted file mode 100644 index e1ef840ac3..0000000000 --- a/packages/less/src/less-browser/error-reporting.js +++ /dev/null @@ -1,170 +0,0 @@ -import * as utils from './utils'; -import browser from './browser'; - -export default (window, less, options) => { - - function errorHTML(e, rootHref) { - const id = `less-error-message:${utils.extractId(rootHref || '')}`; - const template = '
  • {content}
  • '; - const elem = window.document.createElement('div'); - let timer; - let content; - const errors = []; - const filename = e.filename || rootHref; - const filenameNoPath = filename.match(/([^/]+(\?.*)?)$/)[1]; - - elem.id = id; - elem.className = 'less-error-message'; - - content = `

    ${e.type || 'Syntax'}Error: ${e.message || 'There is an error in your .less file'}` + - `

    in ${filenameNoPath} `; - - const errorline = (e, i, classname) => { - if (e.extract[i] !== undefined) { - errors.push(template.replace(/\{line\}/, (parseInt(e.line, 10) || 0) + (i - 1)) - .replace(/\{class\}/, classname) - .replace(/\{content\}/, e.extract[i])); - } - }; - - if (e.line) { - errorline(e, 0, ''); - errorline(e, 1, 'line'); - errorline(e, 2, ''); - content += `on line ${e.line}, column ${e.column + 1}:

      ${errors.join('')}
    `; - } - if (e.stack && (e.extract || options.logLevel >= 4)) { - content += `
    Stack Trace
    ${e.stack.split('\n').slice(1).join('
    ')}`; - } - elem.innerHTML = content; - - // CSS for error messages - browser.createCSS(window.document, [ - '.less-error-message ul, .less-error-message li {', - 'list-style-type: none;', - 'margin-right: 15px;', - 'padding: 4px 0;', - 'margin: 0;', - '}', - '.less-error-message label {', - 'font-size: 12px;', - 'margin-right: 15px;', - 'padding: 4px 0;', - 'color: #cc7777;', - '}', - '.less-error-message pre {', - 'color: #dd6666;', - 'padding: 4px 0;', - 'margin: 0;', - 'display: inline-block;', - '}', - '.less-error-message pre.line {', - 'color: #ff0000;', - '}', - '.less-error-message h3 {', - 'font-size: 20px;', - 'font-weight: bold;', - 'padding: 15px 0 5px 0;', - 'margin: 0;', - '}', - '.less-error-message a {', - 'color: #10a', - '}', - '.less-error-message .error {', - 'color: red;', - 'font-weight: bold;', - 'padding-bottom: 2px;', - 'border-bottom: 1px dashed red;', - '}' - ].join('\n'), { title: 'error-message' }); - - elem.style.cssText = [ - 'font-family: Arial, sans-serif', - 'border: 1px solid #e00', - 'background-color: #eee', - 'border-radius: 5px', - '-webkit-border-radius: 5px', - '-moz-border-radius: 5px', - 'color: #e00', - 'padding: 15px', - 'margin-bottom: 15px' - ].join(';'); - - if (options.env === 'development') { - timer = setInterval(() => { - const document = window.document; - const body = document.body; - if (body) { - if (document.getElementById(id)) { - body.replaceChild(elem, document.getElementById(id)); - } else { - body.insertBefore(elem, body.firstChild); - } - clearInterval(timer); - } - }, 10); - } - } - - function removeErrorHTML(path) { - const node = window.document.getElementById(`less-error-message:${utils.extractId(path)}`); - if (node) { - node.parentNode.removeChild(node); - } - } - - function removeErrorConsole() { - // no action - } - - function removeError(path) { - if (!options.errorReporting || options.errorReporting === 'html') { - removeErrorHTML(path); - } else if (options.errorReporting === 'console') { - removeErrorConsole(path); - } else if (typeof options.errorReporting === 'function') { - options.errorReporting('remove', path); - } - } - - function errorConsole(e, rootHref) { - const template = '{line} {content}'; - const filename = e.filename || rootHref; - const errors = []; - let content = `${e.type || 'Syntax'}Error: ${e.message || 'There is an error in your .less file'} in ${filename}`; - - const errorline = (e, i, classname) => { - if (e.extract[i] !== undefined) { - errors.push(template.replace(/\{line\}/, (parseInt(e.line, 10) || 0) + (i - 1)) - .replace(/\{class\}/, classname) - .replace(/\{content\}/, e.extract[i])); - } - }; - - if (e.line) { - errorline(e, 0, ''); - errorline(e, 1, 'line'); - errorline(e, 2, ''); - content += ` on line ${e.line}, column ${e.column + 1}:\n${errors.join('\n')}`; - } - if (e.stack && (e.extract || options.logLevel >= 4)) { - content += `\nStack Trace\n${e.stack}`; - } - less.logger.error(content); - } - - function error(e, rootHref) { - if (!options.errorReporting || options.errorReporting === 'html') { - errorHTML(e, rootHref); - } else if (options.errorReporting === 'console') { - errorConsole(e, rootHref); - } else if (typeof options.errorReporting === 'function') { - options.errorReporting('add', e, rootHref); - } - } - - return { - add: error, - remove: removeError - }; -}; diff --git a/packages/less/src/less-browser/file-manager.js b/packages/less/src/less-browser/file-manager.js deleted file mode 100644 index 090886b731..0000000000 --- a/packages/less/src/less-browser/file-manager.js +++ /dev/null @@ -1,112 +0,0 @@ -import AbstractFileManager from '../less/environment/abstract-file-manager.js'; - -let options; -let logger; -let fileCache = {}; - -// TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load -const FileManager = function() {} -FileManager.prototype = Object.assign(new AbstractFileManager(), { - alwaysMakePathsAbsolute() { - return true; - }, - - join(basePath, laterPath) { - if (!basePath) { - return laterPath; - } - return this.extractUrlParts(laterPath, basePath).path; - }, - - doXHR(url, type, callback, errback) { - const xhr = new XMLHttpRequest(); - const async = options.isFileProtocol ? options.fileAsync : true; - - if (typeof xhr.overrideMimeType === 'function') { - xhr.overrideMimeType('text/css'); - } - logger.debug(`XHR: Getting '${url}'`); - xhr.open('GET', url, async); - xhr.setRequestHeader('Accept', type || 'text/x-less, text/css; q=0.9, */*; q=0.5'); - xhr.send(null); - - function handleResponse(xhr, callback, errback) { - if (xhr.status >= 200 && xhr.status < 300) { - callback(xhr.responseText, - xhr.getResponseHeader('Last-Modified')); - } else if (typeof errback === 'function') { - errback(xhr.status, url); - } - } - - if (options.isFileProtocol && !options.fileAsync) { - if (xhr.status === 0 || (xhr.status >= 200 && xhr.status < 300)) { - callback(xhr.responseText); - } else { - errback(xhr.status, url); - } - } else if (async) { - xhr.onreadystatechange = () => { - if (xhr.readyState == 4) { - handleResponse(xhr, callback, errback); - } - }; - } else { - handleResponse(xhr, callback, errback); - } - }, - - supports() { - return true; - }, - - clearFileCache() { - fileCache = {}; - }, - - loadFile(filename, currentDirectory, options) { - // TODO: Add prefix support like less-node? - // What about multiple paths? - - if (currentDirectory && !this.isPathAbsolute(filename)) { - filename = currentDirectory + filename; - } - - filename = options.ext ? this.tryAppendExtension(filename, options.ext) : filename; - - options = options || {}; - - // sheet may be set to the stylesheet for the initial load or a collection of properties including - // some context variables for imports - const hrefParts = this.extractUrlParts(filename, window.location.href); - const href = hrefParts.url; - const self = this; - - return new Promise((resolve, reject) => { - if (options.useFileCache && fileCache[href]) { - try { - const lessText = fileCache[href]; - return resolve({ contents: lessText, filename: href, webInfo: { lastModified: new Date() }}); - } catch (e) { - return reject({ filename: href, message: `Error loading file ${href} error was ${e.message}` }); - } - } - - self.doXHR(href, options.mime, function doXHRCallback(data, lastModified) { - // per file cache - fileCache[href] = data; - - // Use remote copy (re-parse) - resolve({ contents: data, filename: href, webInfo: { lastModified }}); - }, function doXHRError(status, url) { - reject({ type: 'File', message: `'${url}' wasn't found (${status})`, href }); - }); - }); - } -}); - -export default (opts, log) => { - options = opts; - logger = log; - return FileManager; -} diff --git a/packages/less/src/less-browser/image-size.js b/packages/less/src/less-browser/image-size.js deleted file mode 100644 index 8e3caccdfd..0000000000 --- a/packages/less/src/less-browser/image-size.js +++ /dev/null @@ -1,28 +0,0 @@ - -import functionRegistry from './../less/functions/function-registry'; - -export default () => { - function imageSize() { - throw { - type: 'Runtime', - message: 'Image size functions are not supported in browser version of less' - }; - } - - const imageFunctions = { - 'image-size': function(filePathNode) { - imageSize(this, filePathNode); - return -1; - }, - 'image-width': function(filePathNode) { - imageSize(this, filePathNode); - return -1; - }, - 'image-height': function(filePathNode) { - imageSize(this, filePathNode); - return -1; - } - }; - - functionRegistry.addMultiple(imageFunctions); -}; diff --git a/packages/less/src/less-browser/index.js b/packages/less/src/less-browser/index.js deleted file mode 100644 index d2ab24a770..0000000000 --- a/packages/less/src/less-browser/index.js +++ /dev/null @@ -1,289 +0,0 @@ -// -// index.js -// Should expose the additional browser functions on to the less object -// -import {addDataAttr} from './utils'; -import lessRoot from '../less'; -import browser from './browser'; -import FM from './file-manager'; -import PluginLoader from './plugin-loader'; -import LogListener from './log-listener'; -import ErrorReporting from './error-reporting'; -import Cache from './cache'; -import ImageSize from './image-size'; - -export default (window, options) => { - const document = window.document; - const less = lessRoot(); - - less.options = options; - const environment = less.environment; - const FileManager = FM(options, less.logger); - const fileManager = new FileManager(); - environment.addFileManager(fileManager); - less.FileManager = FileManager; - less.PluginLoader = PluginLoader; - - LogListener(less, options); - const errors = ErrorReporting(window, less, options); - const cache = less.cache = options.cache || Cache(window, options, less.logger); - ImageSize(less.environment); - - // Setup user functions - Deprecate? - if (options.functions) { - less.functions.functionRegistry.addMultiple(options.functions); - } - - const typePattern = /^text\/(x-)?less$/; - - function clone(obj) { - const cloned = {}; - for (const prop in obj) { - if (Object.prototype.hasOwnProperty.call(obj, prop)) { - cloned[prop] = obj[prop]; - } - } - return cloned; - } - - // only really needed for phantom - function bind(func, thisArg) { - const curryArgs = Array.prototype.slice.call(arguments, 2); - return function() { - const args = curryArgs.concat(Array.prototype.slice.call(arguments, 0)); - return func.apply(thisArg, args); - }; - } - - function loadStyles(modifyVars) { - const styles = document.getElementsByTagName('style'); - let style; - - for (let i = 0; i < styles.length; i++) { - style = styles[i]; - if (style.type.match(typePattern)) { - const instanceOptions = clone(options); - instanceOptions.modifyVars = modifyVars; - const lessText = style.innerHTML || ''; - instanceOptions.filename = document.location.href.replace(/#.*$/, ''); - - /* jshint loopfunc:true */ - // use closure to store current style - less.render(lessText, instanceOptions, - bind((style, e, result) => { - if (e) { - errors.add(e, 'inline'); - } else { - style.type = 'text/css'; - if (style.styleSheet) { - style.styleSheet.cssText = result.css; - } else { - style.innerHTML = result.css; - } - } - }, null, style)); - } - } - } - - function loadStyleSheet(sheet, callback, reload, remaining, modifyVars) { - - const instanceOptions = clone(options); - addDataAttr(instanceOptions, sheet); - instanceOptions.mime = sheet.type; - - if (modifyVars) { - instanceOptions.modifyVars = modifyVars; - } - - function loadInitialFileCallback(loadedFile) { - const data = loadedFile.contents; - const path = loadedFile.filename; - const webInfo = loadedFile.webInfo; - - const newFileInfo = { - currentDirectory: fileManager.getPath(path), - filename: path, - rootFilename: path, - rewriteUrls: instanceOptions.rewriteUrls - }; - - newFileInfo.entryPath = newFileInfo.currentDirectory; - newFileInfo.rootpath = instanceOptions.rootpath || newFileInfo.currentDirectory; - - if (webInfo) { - webInfo.remaining = remaining; - - const css = cache.getCSS(path, webInfo, instanceOptions.modifyVars); - if (!reload && css) { - webInfo.local = true; - callback(null, css, data, sheet, webInfo, path); - return; - } - - } - - // TODO add tests around how this behaves when reloading - errors.remove(path); - - instanceOptions.rootFileInfo = newFileInfo; - less.render(data, instanceOptions, (e, result) => { - if (e) { - e.href = path; - callback(e); - } else { - cache.setCSS(sheet.href, webInfo.lastModified, instanceOptions.modifyVars, result.css); - callback(null, result.css, data, sheet, webInfo, path); - } - }); - } - - fileManager.loadFile(sheet.href, null, instanceOptions, environment) - .then(loadedFile => { - loadInitialFileCallback(loadedFile); - }).catch(err => { - console.log(err); - callback(err); - }); - - } - - function loadStyleSheets(callback, reload, modifyVars) { - for (let i = 0; i < less.sheets.length; i++) { - loadStyleSheet(less.sheets[i], callback, reload, less.sheets.length - (i + 1), modifyVars); - } - } - - function initRunningMode() { - if (less.env === 'development') { - less.watchTimer = setInterval(() => { - if (less.watchMode) { - fileManager.clearFileCache(); - /** - * @todo remove when this is typed with JSDoc - */ - // eslint-disable-next-line no-unused-vars - loadStyleSheets((e, css, _, sheet, webInfo) => { - if (e) { - errors.add(e, e.href || sheet.href); - } else if (css) { - browser.createCSS(window.document, css, sheet); - } - }); - } - }, options.poll); - } - } - - // - // Watch mode - // - less.watch = function () { - if (!less.watchMode ) { - less.env = 'development'; - initRunningMode(); - } - this.watchMode = true; - return true; - }; - - less.unwatch = function () {clearInterval(less.watchTimer); this.watchMode = false; return false; }; - - // - // Synchronously get all tags with the 'rel' attribute set to - // "stylesheet/less". - // - less.registerStylesheetsImmediately = () => { - const links = document.getElementsByTagName('link'); - less.sheets = []; - - for (let i = 0; i < links.length; i++) { - if (links[i].rel === 'stylesheet/less' || (links[i].rel.match(/stylesheet/) && - (links[i].type.match(typePattern)))) { - less.sheets.push(links[i]); - } - } - }; - - // - // Asynchronously get all tags with the 'rel' attribute set to - // "stylesheet/less", returning a Promise. - // - less.registerStylesheets = () => new Promise((resolve) => { - less.registerStylesheetsImmediately(); - resolve(); - }); - - // - // With this function, it's possible to alter variables and re-render - // CSS without reloading less-files - // - less.modifyVars = record => less.refresh(true, record, false); - - less.refresh = (reload, modifyVars, clearFileCache) => { - if ((reload || clearFileCache) && clearFileCache !== false) { - fileManager.clearFileCache(); - } - return new Promise((resolve, reject) => { - let startTime; - let endTime; - let totalMilliseconds; - let remainingSheets; - startTime = endTime = new Date(); - - // Set counter for remaining unprocessed sheets - remainingSheets = less.sheets.length; - - if (remainingSheets === 0) { - - endTime = new Date(); - totalMilliseconds = endTime - startTime; - less.logger.info('Less has finished and no sheets were loaded.'); - resolve({ - startTime, - endTime, - totalMilliseconds, - sheets: less.sheets.length - }); - - } else { - // Relies on less.sheets array, callback seems to be guaranteed to be called for every element of the array - loadStyleSheets((e, css, _, sheet, webInfo) => { - if (e) { - errors.add(e, e.href || sheet.href); - reject(e); - return; - } - if (webInfo.local) { - less.logger.info(`Loading ${sheet.href} from cache.`); - } else { - less.logger.info(`Rendered ${sheet.href} successfully.`); - } - browser.createCSS(window.document, css, sheet); - less.logger.info(`CSS for ${sheet.href} generated in ${new Date() - endTime}ms`); - - // Count completed sheet - remainingSheets--; - - // Check if the last remaining sheet was processed and then call the promise - if (remainingSheets === 0) { - totalMilliseconds = new Date() - startTime; - less.logger.info(`Less has finished. CSS generated in ${totalMilliseconds}ms`); - resolve({ - startTime, - endTime, - totalMilliseconds, - sheets: less.sheets.length - }); - } - endTime = new Date(); - }, reload, modifyVars); - } - - loadStyles(modifyVars); - }); - }; - - less.refreshStyles = loadStyles; - return less; -}; diff --git a/packages/less/src/less-browser/log-listener.js b/packages/less/src/less-browser/log-listener.js deleted file mode 100644 index 553da89514..0000000000 --- a/packages/less/src/less-browser/log-listener.js +++ /dev/null @@ -1,42 +0,0 @@ -export default (less, options) => { - const logLevel_debug = 4; - const logLevel_info = 3; - const logLevel_warn = 2; - const logLevel_error = 1; - - // The amount of logging in the javascript console. - // 3 - Debug, information and errors - // 2 - Information and errors - // 1 - Errors - // 0 - None - // Defaults to 2 - options.logLevel = typeof options.logLevel !== 'undefined' ? options.logLevel : (options.env === 'development' ? logLevel_info : logLevel_error); - - if (!options.loggers) { - options.loggers = [{ - debug: function(msg) { - if (options.logLevel >= logLevel_debug) { - console.log(msg); - } - }, - info: function(msg) { - if (options.logLevel >= logLevel_info) { - console.log(msg); - } - }, - warn: function(msg) { - if (options.logLevel >= logLevel_warn) { - console.warn(msg); - } - }, - error: function(msg) { - if (options.logLevel >= logLevel_error) { - console.error(msg); - } - } - }]; - } - for (let i = 0; i < options.loggers.length; i++) { - less.logger.addListener(options.loggers[i]); - } -}; diff --git a/packages/less/src/less-browser/plugin-loader.js b/packages/less/src/less-browser/plugin-loader.js deleted file mode 100644 index 2a7e219242..0000000000 --- a/packages/less/src/less-browser/plugin-loader.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @todo Add tests for browser `@plugin` - */ -import AbstractPluginLoader from '../less/environment/abstract-plugin-loader.js'; - -/** - * Browser Plugin Loader - */ -const PluginLoader = function(less) { - this.less = less; - // Should we shim this.require for browser? Probably not? -}; - -PluginLoader.prototype = Object.assign(new AbstractPluginLoader(), { - loadPlugin(filename, basePath, context, environment, fileManager) { - return new Promise((fulfill, reject) => { - fileManager.loadFile(filename, basePath, context, environment) - .then(fulfill).catch(reject); - }); - } -}); - -export default PluginLoader; - diff --git a/packages/less/src/less-browser/utils.js b/packages/less/src/less-browser/utils.js deleted file mode 100644 index 972160b6d1..0000000000 --- a/packages/less/src/less-browser/utils.js +++ /dev/null @@ -1,25 +0,0 @@ - -export function extractId(href) { - return href.replace(/^[a-z-]+:\/+?[^/]+/, '') // Remove protocol & domain - .replace(/[?&]livereload=\w+/, '') // Remove LiveReload cachebuster - .replace(/^\//, '') // Remove root / - .replace(/\.[a-zA-Z]+$/, '') // Remove simple extension - .replace(/[^.\w-]+/g, '-') // Replace illegal characters - .replace(/\./g, ':'); // Replace dots with colons(for valid id) -} - -export function addDataAttr(options, tag) { - if (!tag) {return;} // in case of tag is null or undefined - for (const opt in tag.dataset) { - if (Object.prototype.hasOwnProperty.call(tag.dataset, opt)) { - if (opt === 'env' || opt === 'dumpLineNumbers' || opt === 'rootpath' || opt === 'errorReporting') { - options[opt] = tag.dataset[opt]; - } else { - try { - options[opt] = JSON.parse(tag.dataset[opt]); - } - catch (_) {} - } - } - } -} diff --git a/packages/less/src/less-node/environment.js b/packages/less/src/less-node/environment.js deleted file mode 100644 index a9b790c9bc..0000000000 --- a/packages/less/src/less-node/environment.js +++ /dev/null @@ -1,16 +0,0 @@ -export default { - encodeBase64: function encodeBase64(str) { - // Avoid Buffer constructor on newer versions of Node.js. - const buffer = (Buffer.from ? Buffer.from(str) : (new Buffer(str))); - return buffer.toString('base64'); - }, - mimeLookup: function (filename) { - return require('mime').lookup(filename); - }, - charsetLookup: function (mime) { - return require('mime').charsets.lookup(mime); - }, - getSourceMapGenerator: function getSourceMapGenerator() { - return require('source-map').SourceMapGenerator; - } -}; diff --git a/packages/less/src/less-node/file-manager.js b/packages/less/src/less-node/file-manager.js deleted file mode 100644 index 5482c420fa..0000000000 --- a/packages/less/src/less-node/file-manager.js +++ /dev/null @@ -1,148 +0,0 @@ -import path from 'path'; -import fs from './fs'; -import AbstractFileManager from '../less/environment/abstract-file-manager.js'; - -const FileManager = function() {} -FileManager.prototype = Object.assign(new AbstractFileManager(), { - supports() { - return true; - }, - - supportsSync() { - return true; - }, - - loadFile(filename, currentDirectory, options, environment, callback) { - let fullFilename; - const isAbsoluteFilename = this.isPathAbsolute(filename); - const filenamesTried = []; - const self = this; - const prefix = filename.slice(0, 1); - const explicit = prefix === '.' || prefix === '/'; - let result = null; - let isNodeModule = false; - const npmPrefix = 'npm://'; - - options = options || {}; - - const paths = isAbsoluteFilename ? [''] : [currentDirectory]; - - if (options.paths) { paths.push.apply(paths, options.paths); } - - if (!isAbsoluteFilename && paths.indexOf('.') === -1) { paths.push('.'); } - - const prefixes = options.prefixes || ['']; - const fileParts = this.extractUrlParts(filename); - - if (options.syncImport) { - getFileData(returnData, returnData); - if (callback) { - callback(result.error, result); - } - else { - return result; - } - } - else { - // promise is guaranteed to be asyncronous - // which helps as it allows the file handle - // to be closed before it continues with the next file - return new Promise(getFileData); - } - - function returnData(data) { - if (!data.filename) { - result = { error: data }; - } - else { - result = data; - } - } - - function getFileData(fulfill, reject) { - (function tryPathIndex(i) { - function tryWithExtension() { - const extFilename = options.ext ? self.tryAppendExtension(fullFilename, options.ext) : fullFilename; - - if (extFilename !== fullFilename && !explicit && paths[i] === '.') { - try { - fullFilename = require.resolve(extFilename); - isNodeModule = true; - } - catch (e) { - filenamesTried.push(npmPrefix + extFilename); - fullFilename = extFilename; - } - } - else { - fullFilename = extFilename; - } - } - if (i < paths.length) { - (function tryPrefix(j) { - if (j < prefixes.length) { - isNodeModule = false; - fullFilename = fileParts.rawPath + prefixes[j] + fileParts.filename; - - if (paths[i]) { - fullFilename = path.join(paths[i], fullFilename); - } - - if (!explicit && paths[i] === '.') { - try { - fullFilename = require.resolve(fullFilename); - isNodeModule = true; - } - catch (e) { - filenamesTried.push(npmPrefix + fullFilename); - tryWithExtension(); - } - } - else { - tryWithExtension(); - } - - const readFileArgs = [fullFilename]; - if (!options.rawBuffer) { - readFileArgs.push('utf-8'); - } - if (options.syncImport) { - try { - const data = fs.readFileSync.apply(this, readFileArgs); - fulfill({ contents: data, filename: fullFilename}); - } - catch (e) { - filenamesTried.push(isNodeModule ? npmPrefix + fullFilename : fullFilename); - return tryPrefix(j + 1); - } - } - else { - readFileArgs.push(function(e, data) { - if (e) { - filenamesTried.push(isNodeModule ? npmPrefix + fullFilename : fullFilename); - return tryPrefix(j + 1); - } - fulfill({ contents: data, filename: fullFilename}); - }); - fs.readFile.apply(this, readFileArgs); - } - - } - else { - tryPathIndex(i + 1); - } - })(0); - } else { - reject({ type: 'File', message: `'${filename}' wasn't found. Tried - ${filenamesTried.join(',')}` }); - } - }(0)); - } - }, - - loadFileSync(filename, currentDirectory, options, environment) { - options.syncImport = true; - return this.loadFile(filename, currentDirectory, options, environment); - } -}); - -export default FileManager; diff --git a/packages/less/src/less-node/fs.js b/packages/less/src/less-node/fs.js deleted file mode 100644 index be71f8f2e6..0000000000 --- a/packages/less/src/less-node/fs.js +++ /dev/null @@ -1,10 +0,0 @@ -let fs; -try -{ - fs = require('graceful-fs'); -} -catch (e) -{ - fs = require('fs'); -} -export default fs; diff --git a/packages/less/src/less-node/image-size.js b/packages/less/src/less-node/image-size.js deleted file mode 100644 index 888a7a1363..0000000000 --- a/packages/less/src/less-node/image-size.js +++ /dev/null @@ -1,56 +0,0 @@ -import Dimension from '../less/tree/dimension'; -import Expression from '../less/tree/expression'; -import functionRegistry from './../less/functions/function-registry'; - -export default environment => { - - function imageSize(functionContext, filePathNode) { - let filePath = filePathNode.value; - const currentFileInfo = functionContext.currentFileInfo; - const currentDirectory = currentFileInfo.rewriteUrls ? - currentFileInfo.currentDirectory : currentFileInfo.entryPath; - - const fragmentStart = filePath.indexOf('#'); - if (fragmentStart !== -1) { - filePath = filePath.slice(0, fragmentStart); - } - - const fileManager = environment.getFileManager(filePath, currentDirectory, functionContext.context, environment, true); - - if (!fileManager) { - throw { - type: 'File', - message: `Can not set up FileManager for ${filePathNode}` - }; - } - - const fileSync = fileManager.loadFileSync(filePath, currentDirectory, functionContext.context, environment); - - if (fileSync.error) { - throw fileSync.error; - } - - const sizeOf = require('image-size'); - return sizeOf(fileSync.filename); - } - - const imageFunctions = { - 'image-size': function(filePathNode) { - const size = imageSize(this, filePathNode); - return new Expression([ - new Dimension(size.width, 'px'), - new Dimension(size.height, 'px') - ]); - }, - 'image-width': function(filePathNode) { - const size = imageSize(this, filePathNode); - return new Dimension(size.width, 'px'); - }, - 'image-height': function(filePathNode) { - const size = imageSize(this, filePathNode); - return new Dimension(size.height, 'px'); - } - }; - - functionRegistry.addMultiple(imageFunctions); -}; diff --git a/packages/less/src/less-node/index.js b/packages/less/src/less-node/index.js deleted file mode 100644 index 43cbe7a49d..0000000000 --- a/packages/less/src/less-node/index.js +++ /dev/null @@ -1,22 +0,0 @@ -import environment from './environment'; -import FileManager from './file-manager'; -import UrlFileManager from './url-file-manager'; -import createFromEnvironment from '../less'; -const less = createFromEnvironment(environment, [new FileManager(), new UrlFileManager()]); -import lesscHelper from './lessc-helper'; - -// allow people to create less with their own environment -less.createFromEnvironment = createFromEnvironment; -less.lesscHelper = lesscHelper; -less.PluginLoader = require('./plugin-loader').default; -less.fs = require('./fs').default; -less.FileManager = FileManager; -less.UrlFileManager = UrlFileManager; - -// Set up options -less.options = require('../less/default-options').default(); - -// provide image-size functionality -require('./image-size').default(less.environment); - -export default less; diff --git a/packages/less/src/less-node/lessc-helper.js b/packages/less/src/less-node/lessc-helper.js deleted file mode 100644 index a24653b672..0000000000 --- a/packages/less/src/less-node/lessc-helper.js +++ /dev/null @@ -1,94 +0,0 @@ -// lessc_helper.js -// -// helper functions for lessc -const lessc_helper = { - - // Stylize a string - stylize : function(str, style) { - const styles = { - 'reset' : [0, 0], - 'bold' : [1, 22], - 'inverse' : [7, 27], - 'underline' : [4, 24], - 'yellow' : [33, 39], - 'green' : [32, 39], - 'red' : [31, 39], - 'grey' : [90, 39] - }; - return `\x1b[${styles[style][0]}m${str}\x1b[${styles[style][1]}m`; - }, - - // Print command line options - printUsage: function() { - console.log('usage: lessc [option option=parameter ...] [destination]'); - console.log(''); - console.log('If source is set to `-\' (dash or hyphen-minus), input is read from stdin.'); - console.log(''); - console.log('options:'); - console.log(' -h, --help Prints help (this message) and exit.'); - console.log(' --include-path=PATHS Sets include paths. Separated by `:\'. `;\' also supported on windows.'); - console.log(' -M, --depends Outputs a makefile import dependency list to stdout.'); - console.log(' --no-color Disables colorized output.'); - console.log(' --ie-compat Enables IE8 compatibility checks.'); - console.log(' --js Enables inline JavaScript in less files'); - console.log(' -l, --lint Syntax check only (lint).'); - console.log(' -s, --silent Suppresses output of error messages.'); - console.log(' --quiet Suppresses output of warnings.'); - console.log(' --strict-imports (DEPRECATED) Ignores .less imports inside selector blocks. Has confusing behavior.'); - console.log(' --insecure Allows imports from insecure https hosts.'); - console.log(' -v, --version Prints version number and exit.'); - console.log(' --verbose Be verbose.'); - console.log(' --source-map[=FILENAME] Outputs a v3 sourcemap to the filename (or output filename.map).'); - console.log(' --source-map-rootpath=X Adds this path onto the sourcemap filename and less file paths.'); - console.log(' --source-map-basepath=X Sets sourcemap base path, defaults to current working directory.'); - console.log(' --source-map-include-source Puts the less files into the map instead of referencing them.'); - console.log(' --source-map-inline Puts the map (and any less files) as a base64 data uri into the output css file.'); - console.log(' --source-map-url=URL Sets a custom URL to map file, for sourceMappingURL comment'); - console.log(' in generated CSS file.'); - console.log(' --source-map-no-annotation Excludes the sourceMappingURL comment from the output css file.'); - console.log(' -rp, --rootpath=URL Sets rootpath for url rewriting in relative imports and urls'); - console.log(' Works with or without the relative-urls option.'); - console.log(' -ru=, --rewrite-urls= Rewrites URLs to make them relative to the base less file.'); - console.log(' all|local|off \'all\' rewrites all URLs, \'local\' just those starting with a \'.\''); - console.log(''); - console.log(' -m=, --math='); - console.log(' always Less will eagerly perform math operations always.'); - console.log(' parens-division Math performed except for division (/) operator'); - console.log(' parens | strict Math only performed inside parentheses'); - console.log(' strict-legacy Parens required in very strict terms (legacy --strict-math)'); - console.log(''); - console.log(' -su=on|off Allows mixed units, e.g. 1px+1em or 1px*1px which have units'); - console.log(' --strict-units=on|off that cannot be represented.'); - console.log(' --global-var=\'VAR=VALUE\' Defines a variable that can be referenced by the file.'); - console.log(' --modify-var=\'VAR=VALUE\' Modifies a variable already declared in the file.'); - console.log(' --url-args=\'QUERYSTRING\' Adds params into url tokens (e.g. 42, cb=42 or \'a=1&b=2\')'); - console.log(' --plugin=PLUGIN=OPTIONS Loads a plugin. You can also omit the --plugin= if the plugin begins'); - console.log(' less-plugin. E.g. the clean css plugin is called less-plugin-clean-css'); - console.log(' once installed (npm install less-plugin-clean-css), use either with'); - console.log(' --plugin=less-plugin-clean-css or just --clean-css'); - console.log(' specify options afterwards e.g. --plugin=less-plugin-clean-css="advanced"'); - console.log(' or --clean-css="advanced"'); - console.log(' --disable-plugin-rule Disallow @plugin statements'); - console.log(''); - console.log('-------------------------- Deprecated ----------------'); - console.log(' -sm=on|off Legacy parens-only math. Use --math'); - console.log(' --strict-math=on|off '); - console.log(''); - console.log(' --line-numbers=TYPE (DEPRECATED) Outputs filename and line numbers.'); - console.log(' TYPE can be either \'comments\', \'mediaquery\', or \'all\'.'); - console.log(' The entire dumpLineNumbers option is deprecated.'); - console.log(' Use sourcemaps (--source-map) instead.'); - console.log(' All modes will be removed in a future version.'); - console.log(' Note: \'mediaquery\' and \'all\' modes generate @media -sass-debug-info'); - console.log(' which had short-lived usage and is no longer recommended.'); - console.log(' -x, --compress Compresses output by removing some whitespaces.'); - console.log(' We recommend you use a dedicated minifer like less-plugin-clean-css'); - console.log(''); - console.log('Report bugs to: http://github.com/less/less.js/issues'); - console.log('Home page: '); - } -}; - -// Exports helper functions -// eslint-disable-next-line no-prototype-builtins -for (const h in lessc_helper) { if (lessc_helper.hasOwnProperty(h)) { exports[h] = lessc_helper[h]; }} diff --git a/packages/less/src/less-node/plugin-loader.js b/packages/less/src/less-node/plugin-loader.js deleted file mode 100644 index e9be545b72..0000000000 --- a/packages/less/src/less-node/plugin-loader.js +++ /dev/null @@ -1,59 +0,0 @@ -import path from 'path'; -import AbstractPluginLoader from '../less/environment/abstract-plugin-loader.js'; - -/** - * Node Plugin Loader - */ -const PluginLoader = function(less) { - this.less = less; - this.require = prefix => { - prefix = path.dirname(prefix); - return id => { - const str = id.substr(0, 2); - if (str === '..' || str === './') { - return require(path.join(prefix, id)); - } - else { - return require(id); - } - }; - }; -}; - -PluginLoader.prototype = Object.assign(new AbstractPluginLoader(), { - loadPlugin(filename, basePath, context, environment, fileManager) { - const prefix = filename.slice(0, 1); - const explicit = prefix === '.' || prefix === '/' || filename.slice(-3).toLowerCase() === '.js'; - if (!explicit) { - context.prefixes = ['less-plugin-', '']; - } - - if (context.syncImport) { - return fileManager.loadFileSync(filename, basePath, context, environment); - } - - return new Promise((fulfill, reject) => { - fileManager.loadFile(filename, basePath, context, environment).then( - data => { - try { - fulfill(data); - } - catch (e) { - console.log(e); - reject(e); - } - } - ).catch(err => { - reject(err); - }); - }); - }, - - loadPluginSync(filename, basePath, context, environment, fileManager) { - context.syncImport = true; - return this.loadPlugin(filename, basePath, context, environment, fileManager); - } -}); - -export default PluginLoader; - diff --git a/packages/less/src/less-node/url-file-manager.js b/packages/less/src/less-node/url-file-manager.js deleted file mode 100644 index 7a9092e221..0000000000 --- a/packages/less/src/less-node/url-file-manager.js +++ /dev/null @@ -1,56 +0,0 @@ -/* eslint-disable no-unused-vars */ -/** - * @todo - remove top eslint rule when FileManagers have JSDoc type - * and are TS-type-checked - */ -const isUrlRe = /^(?:https?:)?\/\//i; -import url from 'url'; -let request; -import AbstractFileManager from '../less/environment/abstract-file-manager.js'; -import logger from '../less/logger'; - -const UrlFileManager = function() {} -UrlFileManager.prototype = Object.assign(new AbstractFileManager(), { - supports(filename, currentDirectory, options, environment) { - return isUrlRe.test( filename ) || isUrlRe.test(currentDirectory); - }, - - loadFile(filename, currentDirectory, options, environment) { - return new Promise((fulfill, reject) => { - if (request === undefined) { - try { request = require('needle'); } - catch (e) { request = null; } - } - if (!request) { - reject({ type: 'File', message: 'optional dependency \'needle\' required to import over http(s)\n' }); - return; - } - - let urlStr = isUrlRe.test( filename ) ? filename : url.resolve(currentDirectory, filename); - - /** native-request currently has a bug */ - const hackUrlStr = urlStr.indexOf('?') === -1 ? urlStr + '?' : urlStr - - request.get(hackUrlStr, { follow_max: 5 }, (err, resp, body) => { - if (err || resp && resp.statusCode >= 400) { - const message = resp && resp.statusCode === 404 - ? `resource '${urlStr}' was not found\n` - : `resource '${urlStr}' gave this Error:\n ${err || resp.statusMessage || resp.statusCode}\n`; - reject({ type: 'File', message }); - return; - } - if (resp.statusCode >= 300) { - reject({ type: 'File', message: `resource '${urlStr}' caused too many redirects` }); - return; - } - body = body.toString('utf8'); - if (!body) { - logger.warn(`Warning: Empty body (HTTP ${resp.statusCode}) returned by "${urlStr}"`); - } - fulfill({ contents: body || '', filename: urlStr }); - }); - }); - } -}); - -export default UrlFileManager; diff --git a/packages/less/src/less/constants.js b/packages/less/src/less/constants.js deleted file mode 100644 index d095fc2460..0000000000 --- a/packages/less/src/less/constants.js +++ /dev/null @@ -1,13 +0,0 @@ - -export const Math = { - ALWAYS: 0, - PARENS_DIVISION: 1, - PARENS: 2 - // removed - STRICT_LEGACY: 3 -}; - -export const RewriteUrls = { - OFF: 0, - LOCAL: 1, - ALL: 2 -}; \ No newline at end of file diff --git a/packages/less/src/less/contexts.js b/packages/less/src/less/contexts.js deleted file mode 100644 index 6e3b38900a..0000000000 --- a/packages/less/src/less/contexts.js +++ /dev/null @@ -1,164 +0,0 @@ -const contexts = {}; -export default contexts; -import * as Constants from './constants'; - -const copyFromOriginal = function copyFromOriginal(original, destination, propertiesToCopy) { - if (!original) { return; } - - for (let i = 0; i < propertiesToCopy.length; i++) { - if (Object.prototype.hasOwnProperty.call(original, propertiesToCopy[i])) { - destination[propertiesToCopy[i]] = original[propertiesToCopy[i]]; - } - } -}; - -/* - parse is used whilst parsing - */ -const parseCopyProperties = [ - // options - 'paths', // option - unmodified - paths to search for imports on - 'rewriteUrls', // option - whether to adjust URL's to be relative - 'rootpath', // option - rootpath to append to URL's - 'strictImports', // option - - 'insecure', // option - whether to allow imports from insecure ssl hosts - 'dumpLineNumbers', // option - @deprecated The dumpLineNumbers option is deprecated. Use sourcemaps instead. All modes ('comments', 'mediaquery', 'all') will be removed in a future version. - 'compress', // option - whether to compress - 'syncImport', // option - whether to import synchronously - 'mime', // browser only - mime type for sheet import - 'useFileCache', // browser only - whether to use the per file session cache - // context - 'processImports', // option & context - whether to process imports. if false then imports will not be imported. - // Used by the import manager to stop multiple import visitors being created. - 'pluginManager', // Used as the plugin manager for the session - 'quiet', // option - whether to log warnings -]; - -contexts.Parse = function(options) { - copyFromOriginal(options, this, parseCopyProperties); - - if (typeof this.paths === 'string') { this.paths = [this.paths]; } -}; - -const evalCopyProperties = [ - 'paths', // additional include paths - 'compress', // whether to compress - 'math', // whether math has to be within parenthesis - 'strictUnits', // whether units need to evaluate correctly - 'sourceMap', // whether to output a source map - 'importMultiple', // whether we are currently importing multiple copies - 'urlArgs', // whether to add args into url tokens - 'javascriptEnabled', // option - whether Inline JavaScript is enabled. if undefined, defaults to false - 'pluginManager', // Used as the plugin manager for the session - 'importantScope', // used to bubble up !important statements - 'rewriteUrls' // option - whether to adjust URL's to be relative -]; - -contexts.Eval = function(options, frames) { - copyFromOriginal(options, this, evalCopyProperties); - - if (typeof this.paths === 'string') { this.paths = [this.paths]; } - - this.frames = frames || []; - this.importantScope = this.importantScope || []; -}; - -contexts.Eval.prototype.enterCalc = function () { - if (!this.calcStack) { - this.calcStack = []; - } - this.calcStack.push(true); - this.inCalc = true; -}; - -contexts.Eval.prototype.exitCalc = function () { - this.calcStack.pop(); - if (!this.calcStack.length) { - this.inCalc = false; - } -}; - -contexts.Eval.prototype.inParenthesis = function () { - if (!this.parensStack) { - this.parensStack = []; - } - this.parensStack.push(true); -}; - -contexts.Eval.prototype.outOfParenthesis = function () { - this.parensStack.pop(); -}; - -contexts.Eval.prototype.inCalc = false; -contexts.Eval.prototype.mathOn = true; -contexts.Eval.prototype.isMathOn = function (op) { - if (!this.mathOn) { - return false; - } - if (op === '/' && this.math !== Constants.Math.ALWAYS && (!this.parensStack || !this.parensStack.length)) { - return false; - } - if (this.math > Constants.Math.PARENS_DIVISION) { - return this.parensStack && this.parensStack.length; - } - return true; -}; - -contexts.Eval.prototype.pathRequiresRewrite = function (path) { - const isRelative = this.rewriteUrls === Constants.RewriteUrls.LOCAL ? isPathLocalRelative : isPathRelative; - - return isRelative(path); -}; - -contexts.Eval.prototype.rewritePath = function (path, rootpath) { - let newPath; - - rootpath = rootpath || ''; - newPath = this.normalizePath(rootpath + path); - - // If a path was explicit relative and the rootpath was not an absolute path - // we must ensure that the new path is also explicit relative. - if (isPathLocalRelative(path) && - isPathRelative(rootpath) && - isPathLocalRelative(newPath) === false) { - newPath = `./${newPath}`; - } - - return newPath; -}; - -contexts.Eval.prototype.normalizePath = function (path) { - const segments = path.split('/').reverse(); - let segment; - - path = []; - while (segments.length !== 0) { - segment = segments.pop(); - switch ( segment ) { - case '.': - break; - case '..': - if ((path.length === 0) || (path[path.length - 1] === '..')) { - path.push( segment ); - } else { - path.pop(); - } - break; - default: - path.push(segment); - break; - } - } - - return path.join('/'); -}; - -function isPathRelative(path) { - return !/^(?:[a-z-]+:|\/|#)/i.test(path); -} - -function isPathLocalRelative(path) { - return path.charAt(0) === '.'; -} - -// todo - do the same for the toCSS ? diff --git a/packages/less/src/less/data/colors.js b/packages/less/src/less/data/colors.js deleted file mode 100644 index 3bf17a1f1b..0000000000 --- a/packages/less/src/less/data/colors.js +++ /dev/null @@ -1,150 +0,0 @@ -export default { - 'aliceblue':'#f0f8ff', - 'antiquewhite':'#faebd7', - 'aqua':'#00ffff', - 'aquamarine':'#7fffd4', - 'azure':'#f0ffff', - 'beige':'#f5f5dc', - 'bisque':'#ffe4c4', - 'black':'#000000', - 'blanchedalmond':'#ffebcd', - 'blue':'#0000ff', - 'blueviolet':'#8a2be2', - 'brown':'#a52a2a', - 'burlywood':'#deb887', - 'cadetblue':'#5f9ea0', - 'chartreuse':'#7fff00', - 'chocolate':'#d2691e', - 'coral':'#ff7f50', - 'cornflowerblue':'#6495ed', - 'cornsilk':'#fff8dc', - 'crimson':'#dc143c', - 'cyan':'#00ffff', - 'darkblue':'#00008b', - 'darkcyan':'#008b8b', - 'darkgoldenrod':'#b8860b', - 'darkgray':'#a9a9a9', - 'darkgrey':'#a9a9a9', - 'darkgreen':'#006400', - 'darkkhaki':'#bdb76b', - 'darkmagenta':'#8b008b', - 'darkolivegreen':'#556b2f', - 'darkorange':'#ff8c00', - 'darkorchid':'#9932cc', - 'darkred':'#8b0000', - 'darksalmon':'#e9967a', - 'darkseagreen':'#8fbc8f', - 'darkslateblue':'#483d8b', - 'darkslategray':'#2f4f4f', - 'darkslategrey':'#2f4f4f', - 'darkturquoise':'#00ced1', - 'darkviolet':'#9400d3', - 'deeppink':'#ff1493', - 'deepskyblue':'#00bfff', - 'dimgray':'#696969', - 'dimgrey':'#696969', - 'dodgerblue':'#1e90ff', - 'firebrick':'#b22222', - 'floralwhite':'#fffaf0', - 'forestgreen':'#228b22', - 'fuchsia':'#ff00ff', - 'gainsboro':'#dcdcdc', - 'ghostwhite':'#f8f8ff', - 'gold':'#ffd700', - 'goldenrod':'#daa520', - 'gray':'#808080', - 'grey':'#808080', - 'green':'#008000', - 'greenyellow':'#adff2f', - 'honeydew':'#f0fff0', - 'hotpink':'#ff69b4', - 'indianred':'#cd5c5c', - 'indigo':'#4b0082', - 'ivory':'#fffff0', - 'khaki':'#f0e68c', - 'lavender':'#e6e6fa', - 'lavenderblush':'#fff0f5', - 'lawngreen':'#7cfc00', - 'lemonchiffon':'#fffacd', - 'lightblue':'#add8e6', - 'lightcoral':'#f08080', - 'lightcyan':'#e0ffff', - 'lightgoldenrodyellow':'#fafad2', - 'lightgray':'#d3d3d3', - 'lightgrey':'#d3d3d3', - 'lightgreen':'#90ee90', - 'lightpink':'#ffb6c1', - 'lightsalmon':'#ffa07a', - 'lightseagreen':'#20b2aa', - 'lightskyblue':'#87cefa', - 'lightslategray':'#778899', - 'lightslategrey':'#778899', - 'lightsteelblue':'#b0c4de', - 'lightyellow':'#ffffe0', - 'lime':'#00ff00', - 'limegreen':'#32cd32', - 'linen':'#faf0e6', - 'magenta':'#ff00ff', - 'maroon':'#800000', - 'mediumaquamarine':'#66cdaa', - 'mediumblue':'#0000cd', - 'mediumorchid':'#ba55d3', - 'mediumpurple':'#9370d8', - 'mediumseagreen':'#3cb371', - 'mediumslateblue':'#7b68ee', - 'mediumspringgreen':'#00fa9a', - 'mediumturquoise':'#48d1cc', - 'mediumvioletred':'#c71585', - 'midnightblue':'#191970', - 'mintcream':'#f5fffa', - 'mistyrose':'#ffe4e1', - 'moccasin':'#ffe4b5', - 'navajowhite':'#ffdead', - 'navy':'#000080', - 'oldlace':'#fdf5e6', - 'olive':'#808000', - 'olivedrab':'#6b8e23', - 'orange':'#ffa500', - 'orangered':'#ff4500', - 'orchid':'#da70d6', - 'palegoldenrod':'#eee8aa', - 'palegreen':'#98fb98', - 'paleturquoise':'#afeeee', - 'palevioletred':'#d87093', - 'papayawhip':'#ffefd5', - 'peachpuff':'#ffdab9', - 'peru':'#cd853f', - 'pink':'#ffc0cb', - 'plum':'#dda0dd', - 'powderblue':'#b0e0e6', - 'purple':'#800080', - 'rebeccapurple':'#663399', - 'red':'#ff0000', - 'rosybrown':'#bc8f8f', - 'royalblue':'#4169e1', - 'saddlebrown':'#8b4513', - 'salmon':'#fa8072', - 'sandybrown':'#f4a460', - 'seagreen':'#2e8b57', - 'seashell':'#fff5ee', - 'sienna':'#a0522d', - 'silver':'#c0c0c0', - 'skyblue':'#87ceeb', - 'slateblue':'#6a5acd', - 'slategray':'#708090', - 'slategrey':'#708090', - 'snow':'#fffafa', - 'springgreen':'#00ff7f', - 'steelblue':'#4682b4', - 'tan':'#d2b48c', - 'teal':'#008080', - 'thistle':'#d8bfd8', - 'tomato':'#ff6347', - 'turquoise':'#40e0d0', - 'violet':'#ee82ee', - 'wheat':'#f5deb3', - 'white':'#ffffff', - 'whitesmoke':'#f5f5f5', - 'yellow':'#ffff00', - 'yellowgreen':'#9acd32' -}; \ No newline at end of file diff --git a/packages/less/src/less/data/index.js b/packages/less/src/less/data/index.js deleted file mode 100644 index 1a7d75bc44..0000000000 --- a/packages/less/src/less/data/index.js +++ /dev/null @@ -1,4 +0,0 @@ -import colors from './colors'; -import unitConversions from './unit-conversions'; - -export default { colors, unitConversions }; diff --git a/packages/less/src/less/data/unit-conversions.js b/packages/less/src/less/data/unit-conversions.js deleted file mode 100644 index 1c1593e07f..0000000000 --- a/packages/less/src/less/data/unit-conversions.js +++ /dev/null @@ -1,21 +0,0 @@ -export default { - length: { - 'm': 1, - 'cm': 0.01, - 'mm': 0.001, - 'in': 0.0254, - 'px': 0.0254 / 96, - 'pt': 0.0254 / 72, - 'pc': 0.0254 / 72 * 12 - }, - duration: { - 's': 1, - 'ms': 0.001 - }, - angle: { - 'rad': 1 / (2 * Math.PI), - 'deg': 1 / 360, - 'grad': 1 / 400, - 'turn': 1 - } -}; \ No newline at end of file diff --git a/packages/less/src/less/default-options.js b/packages/less/src/less/default-options.js deleted file mode 100644 index d0aff3b73d..0000000000 --- a/packages/less/src/less/default-options.js +++ /dev/null @@ -1,89 +0,0 @@ -// Export a new default each time -export default function() { - return { - /* Inline Javascript - @plugin still allowed */ - javascriptEnabled: false, - - /* Outputs a makefile import dependency list to stdout. */ - depends: false, - - /* (DEPRECATED) Compress using less built-in compression. - * This does an okay job but does not utilise all the tricks of - * dedicated css compression. */ - compress: false, - - /* Runs the less parser and just reports errors without any output. */ - lint: false, - - /* Sets available include paths. - * If the file in an @import rule does not exist at that exact location, - * less will look for it at the location(s) passed to this option. - * You might use this for instance to specify a path to a library which - * you want to be referenced simply and relatively in the less files. */ - paths: [], - - /* color output in the terminal */ - color: true, - - /** - * @deprecated This option has confusing behavior and may be removed in a future version. - * - * When true, prevents @import statements for .less files from being evaluated inside - * selector blocks (rulesets). The imports are silently ignored and not output. - * - * Behavior: - * - @import at root level: Always processed - * - @import inside @-rules (@media, @supports, etc.): Processed (these are not selector blocks) - * - @import inside selector blocks (.class, #id, etc.): NOT processed (silently ignored) - * - * When false (default): All @import statements are processed regardless of context. - * - * Note: Despite the name "strict", this option does NOT throw an error when imports - * are used in selector blocks - it silently ignores them. This is confusing - * behavior that may catch users off guard. - * - * Note: Only affects .less file imports. CSS imports (url(...) or .css files) are - * always output as CSS @import statements regardless of this setting. - * - * @see https://github.com/less/less.js/issues/656 - */ - strictImports: false, - - /* Allow Imports from Insecure HTTPS Hosts */ - insecure: false, - - /* Allows you to add a path to every generated import and url in your css. - * This does not affect less import statements that are processed, just ones - * that are left in the output css. */ - rootpath: '', - - /* By default URLs are kept as-is, so if you import a file in a sub-directory - * that references an image, exactly the same URL will be output in the css. - * This option allows you to re-write URL's in imported files so that the - * URL is always relative to the base imported file */ - rewriteUrls: false, - - /* How to process math - * 0 always - eagerly try to solve all operations - * 1 parens-division - require parens for division "/" - * 2 parens | strict - require parens for all operations - * 3 strict-legacy - legacy strict behavior (super-strict) - */ - math: 1, - - /* Without this option, less attempts to guess at the output unit when it does maths. */ - strictUnits: false, - - /* Effectively the declaration is put at the top of your base Less file, - * meaning it can be used but it also can be overridden if this variable - * is defined in the file. */ - globalVars: null, - - /* As opposed to the global variable option, this puts the declaration at the - * end of your base file, meaning it will override anything defined in your Less file. */ - modifyVars: null, - - /* This option allows you to specify a argument to go on to every URL. */ - urlArgs: '' - } -} \ No newline at end of file diff --git a/packages/less/src/less/environment/abstract-file-manager.js b/packages/less/src/less/environment/abstract-file-manager.js deleted file mode 100644 index 3598313f32..0000000000 --- a/packages/less/src/less/environment/abstract-file-manager.js +++ /dev/null @@ -1,140 +0,0 @@ -class AbstractFileManager { - getPath(filename) { - let j = filename.lastIndexOf('?'); - if (j > 0) { - filename = filename.slice(0, j); - } - j = filename.lastIndexOf('/'); - if (j < 0) { - j = filename.lastIndexOf('\\'); - } - if (j < 0) { - return ''; - } - return filename.slice(0, j + 1); - } - - tryAppendExtension(path, ext) { - return /(\.[a-z]*$)|([?;].*)$/.test(path) ? path : path + ext; - } - - tryAppendLessExtension(path) { - return this.tryAppendExtension(path, '.less'); - } - - supportsSync() { - return false; - } - - alwaysMakePathsAbsolute() { - return false; - } - - isPathAbsolute(filename) { - return (/^(?:[a-z-]+:|\/|\\|#)/i).test(filename); - } - - // TODO: pull out / replace? - join(basePath, laterPath) { - if (!basePath) { - return laterPath; - } - return basePath + laterPath; - } - - pathDiff(url, baseUrl) { - // diff between two paths to create a relative path - - const urlParts = this.extractUrlParts(url); - - const baseUrlParts = this.extractUrlParts(baseUrl); - let i; - let max; - let urlDirectories; - let baseUrlDirectories; - let diff = ''; - if (urlParts.hostPart !== baseUrlParts.hostPart) { - return ''; - } - max = Math.max(baseUrlParts.directories.length, urlParts.directories.length); - for (i = 0; i < max; i++) { - if (baseUrlParts.directories[i] !== urlParts.directories[i]) { break; } - } - baseUrlDirectories = baseUrlParts.directories.slice(i); - urlDirectories = urlParts.directories.slice(i); - for (i = 0; i < baseUrlDirectories.length - 1; i++) { - diff += '../'; - } - for (i = 0; i < urlDirectories.length - 1; i++) { - diff += `${urlDirectories[i]}/`; - } - return diff; - } - - /** - * Helper function, not part of API. - * This should be replaceable by newer Node / Browser APIs - * - * @param {string} url - * @param {string} baseUrl - */ - extractUrlParts(url, baseUrl) { - // urlParts[1] = protocol://hostname/ OR / - // urlParts[2] = / if path relative to host base - // urlParts[3] = directories - // urlParts[4] = filename - // urlParts[5] = parameters - - const urlPartsRegex = /^((?:[a-z-]+:)?\/{2}(?:[^/?#]*\/)|([/\\]))?((?:[^/\\?#]*[/\\])*)([^/\\?#]*)([#?].*)?$/i; - - const urlParts = url.match(urlPartsRegex); - const returner = {}; - let rawDirectories = []; - const directories = []; - let i; - let baseUrlParts; - - if (!urlParts) { - throw new Error(`Could not parse sheet href - '${url}'`); - } - - // Stylesheets in IE don't always return the full path - if (baseUrl && (!urlParts[1] || urlParts[2])) { - baseUrlParts = baseUrl.match(urlPartsRegex); - if (!baseUrlParts) { - throw new Error(`Could not parse page url - '${baseUrl}'`); - } - urlParts[1] = urlParts[1] || baseUrlParts[1] || ''; - if (!urlParts[2]) { - urlParts[3] = baseUrlParts[3] + urlParts[3]; - } - } - - if (urlParts[3]) { - rawDirectories = urlParts[3].replace(/\\/g, '/').split('/'); - - // collapse '..' and skip '.' - for (i = 0; i < rawDirectories.length; i++) { - - if (rawDirectories[i] === '..') { - directories.pop(); - } - else if (rawDirectories[i] !== '.') { - directories.push(rawDirectories[i]); - } - - } - } - - returner.hostPart = urlParts[1]; - returner.directories = directories; - returner.rawPath = (urlParts[1] || '') + rawDirectories.join('/'); - returner.path = (urlParts[1] || '') + directories.join('/'); - returner.filename = urlParts[4]; - returner.fileUrl = returner.path + (urlParts[4] || ''); - returner.url = returner.fileUrl + (urlParts[5] || ''); - return returner; - } -} - -export default AbstractFileManager; diff --git a/packages/less/src/less/environment/abstract-plugin-loader.js b/packages/less/src/less/environment/abstract-plugin-loader.js deleted file mode 100644 index 917c24baa7..0000000000 --- a/packages/less/src/less/environment/abstract-plugin-loader.js +++ /dev/null @@ -1,185 +0,0 @@ -import functionRegistry from '../functions/function-registry'; -import LessError from '../less-error'; - -class AbstractPluginLoader { - constructor() { - // Implemented by Node.js plugin loader - this.require = function() { - return null; - } - } - - evalPlugin(contents, context, imports, pluginOptions, fileInfo) { - - let loader, registry, pluginObj, localModule, pluginManager, filename, result; - - pluginManager = context.pluginManager; - - if (fileInfo) { - if (typeof fileInfo === 'string') { - filename = fileInfo; - } - else { - filename = fileInfo.filename; - } - } - const shortname = (new this.less.FileManager()).extractUrlParts(filename).filename; - - if (filename) { - pluginObj = pluginManager.get(filename); - - if (pluginObj) { - result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - if (result) { - return result; - } - try { - if (pluginObj.use) { - pluginObj.use.call(this.context, pluginObj); - } - } - catch (e) { - e.message = e.message || 'Error during @plugin call'; - return new LessError(e, imports, filename); - } - return pluginObj; - } - } - localModule = { - exports: {}, - pluginManager, - fileInfo - }; - registry = functionRegistry.create(); - - const registerPlugin = function(obj) { - pluginObj = obj; - }; - - try { - loader = new Function('module', 'require', 'registerPlugin', 'functions', 'tree', 'less', 'fileInfo', contents); - loader(localModule, this.require(filename), registerPlugin, registry, this.less.tree, this.less, fileInfo); - } - catch (e) { - return new LessError(e, imports, filename); - } - - if (!pluginObj) { - pluginObj = localModule.exports; - } - pluginObj = this.validatePlugin(pluginObj, filename, shortname); - - if (pluginObj instanceof LessError) { - return pluginObj; - } - - if (pluginObj) { - pluginObj.imports = imports; - pluginObj.filename = filename; - - // For < 3.x (or unspecified minVersion) - setOptions() before install() - if (!pluginObj.minVersion || this.compareVersion('3.0.0', pluginObj.minVersion) < 0) { - result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - - if (result) { - return result; - } - } - - // Run on first load - pluginManager.addPlugin(pluginObj, fileInfo.filename, registry); - pluginObj.functions = registry.getLocalFunctions(); - - // Need to call setOptions again because the pluginObj might have functions - result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - if (result) { - return result; - } - - // Run every @plugin call - try { - if (pluginObj.use) { - pluginObj.use.call(this.context, pluginObj); - } - } - catch (e) { - e.message = e.message || 'Error during @plugin call'; - return new LessError(e, imports, filename); - } - - } - else { - return new LessError({ message: 'Not a valid plugin' }, imports, filename); - } - - return pluginObj; - - } - - trySetOptions(plugin, filename, name, options) { - if (options && !plugin.setOptions) { - return new LessError({ - message: `Options have been provided but the plugin ${name} does not support any options.` - }); - } - try { - plugin.setOptions && plugin.setOptions(options); - } - catch (e) { - return new LessError(e); - } - } - - validatePlugin(plugin, filename, name) { - if (plugin) { - // support plugins being a function - // so that the plugin can be more usable programmatically - if (typeof plugin === 'function') { - plugin = new plugin(); - } - - if (plugin.minVersion) { - if (this.compareVersion(plugin.minVersion, this.less.version) < 0) { - return new LessError({ - message: `Plugin ${name} requires version ${this.versionToString(plugin.minVersion)}` - }); - } - } - return plugin; - } - return null; - } - - compareVersion(aVersion, bVersion) { - if (typeof aVersion === 'string') { - aVersion = aVersion.match(/^(\d+)\.?(\d+)?\.?(\d+)?/); - aVersion.shift(); - } - for (let i = 0; i < aVersion.length; i++) { - if (aVersion[i] !== bVersion[i]) { - return parseInt(aVersion[i]) > parseInt(bVersion[i]) ? -1 : 1; - } - } - return 0; - } - - versionToString(version) { - let versionString = ''; - for (let i = 0; i < version.length; i++) { - versionString += (versionString ? '.' : '') + version[i]; - } - return versionString; - } - - printUsage(plugins) { - for (let i = 0; i < plugins.length; i++) { - const plugin = plugins[i]; - if (plugin.printUsage) { - plugin.printUsage(); - } - } - } -} - -export default AbstractPluginLoader; - diff --git a/packages/less/src/less/environment/environment-api.ts b/packages/less/src/less/environment/environment-api.ts deleted file mode 100644 index f3725a4ead..0000000000 --- a/packages/less/src/less/environment/environment-api.ts +++ /dev/null @@ -1,21 +0,0 @@ -export interface Environment { - /** - * Converts a string to a base 64 string - */ - encodeBase64(str: string): string - /** - * Lookup the mime-type of a filename - */ - mimeLookup(filename: string): string - /** - * Look up the charset of a mime type - * @param mime - */ - charsetLookup(mime: string): string - /** - * Gets a source map generator - * - * @todo - Figure out precise type - */ - getSourceMapGenerator(): any -} diff --git a/packages/less/src/less/environment/environment.js b/packages/less/src/less/environment/environment.js deleted file mode 100644 index f7d65c6a1e..0000000000 --- a/packages/less/src/less/environment/environment.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @todo Document why this abstraction exists, and the relationship between - * environment, file managers, and plugin manager - */ - -import logger from '../logger'; - -class Environment { - constructor(externalEnvironment, fileManagers) { - this.fileManagers = fileManagers || []; - externalEnvironment = externalEnvironment || {}; - - const optionalFunctions = ['encodeBase64', 'mimeLookup', 'charsetLookup', 'getSourceMapGenerator']; - const requiredFunctions = []; - const functions = requiredFunctions.concat(optionalFunctions); - - for (let i = 0; i < functions.length; i++) { - const propName = functions[i]; - const environmentFunc = externalEnvironment[propName]; - if (environmentFunc) { - this[propName] = environmentFunc.bind(externalEnvironment); - } else if (i < requiredFunctions.length) { - this.warn(`missing required function in environment - ${propName}`); - } - } - } - - getFileManager(filename, currentDirectory, options, environment, isSync) { - - if (!filename) { - logger.warn('getFileManager called with no filename.. Please report this issue. continuing.'); - } - if (currentDirectory === undefined) { - logger.warn('getFileManager called with null directory.. Please report this issue. continuing.'); - } - - let fileManagers = this.fileManagers; - if (options.pluginManager) { - fileManagers = [].concat(fileManagers).concat(options.pluginManager.getFileManagers()); - } - for (let i = fileManagers.length - 1; i >= 0 ; i--) { - const fileManager = fileManagers[i]; - if (fileManager[isSync ? 'supportsSync' : 'supports'](filename, currentDirectory, options, environment)) { - return fileManager; - } - } - return null; - } - - addFileManager(fileManager) { - this.fileManagers.push(fileManager); - } - - clearFileManagers() { - this.fileManagers = []; - } -} - -export default Environment; diff --git a/packages/less/src/less/environment/file-manager-api.ts b/packages/less/src/less/environment/file-manager-api.ts deleted file mode 100644 index 47db48a25f..0000000000 --- a/packages/less/src/less/environment/file-manager-api.ts +++ /dev/null @@ -1,77 +0,0 @@ -import type { Environment } from './environment-api' - -export interface FileManager { - /** - * Given the full path to a file, return the path component - * Provided by AbstractFileManager - */ - getPath(filename: string): string - /** - * Append a .less extension if appropriate. Only called if less thinks one could be added. - * Provided by AbstractFileManager - */ - tryAppendLessExtension(filename: string): string - /** - * Whether the rootpath should be converted to be absolute. - * The browser ovverides this to return true because urls must be absolute. - * Provided by AbstractFileManager (returns false) - */ - alwaysMakePathsAbsolute(): boolean - /** - * Returns whether a path is absolute - * Provided by AbstractFileManager - */ - isPathAbsolute(path: string): boolean - /** - * joins together 2 paths - * Provided by AbstractFileManager - */ - join(basePath: string, laterPath: string): string - /** - * Returns the difference between 2 paths - * E.g. url = a/ baseUrl = a/b/ returns ../ - * url = a/b/ baseUrl = a/ returns b/ - * Provided by AbstractFileManager - */ - pathDiff(url: string, baseUrl: string): string - /** - * Returns whether this file manager supports this file for syncronous file retrieval - * If true is returned, loadFileSync will then be called with the file. - * Provided by AbstractFileManager (returns false) - * - * @todo - Narrow Options type - */ - supportsSync( - filename: string, - currentDirectory: string, - options: Record, - environment: Environment - ): boolean - /** - * If file manager supports async file retrieval for this file type - */ - supports( - filename: string, - currentDirectory: string, - options: Record, - environment: Environment - ): boolean - /** - * Loads a file asynchronously. - */ - loadFile( - filename: string, - currentDirectory: string, - options: Record, - environment: Environment - ): Promise<{ filename: string, contents: string }> - /** - * Loads a file synchronously. Expects an immediate return with an object - */ - loadFileSync( - filename: string, - currentDirectory: string, - options: Record, - environment: Environment - ): { error?: unknown, filename: string, contents: string } -} diff --git a/packages/less/src/less/functions/boolean.js b/packages/less/src/less/functions/boolean.js deleted file mode 100644 index e483bbb23c..0000000000 --- a/packages/less/src/less/functions/boolean.js +++ /dev/null @@ -1,29 +0,0 @@ -import Anonymous from '../tree/anonymous'; -import Keyword from '../tree/keyword'; - -function boolean(condition) { - return condition ? Keyword.True : Keyword.False; -} - -/** - * Functions with evalArgs set to false are sent context - * as the first argument. - */ -function If(context, condition, trueValue, falseValue) { - return condition.eval(context) ? trueValue.eval(context) - : (falseValue ? falseValue.eval(context) : new Anonymous); -} -If.evalArgs = false; - -function isdefined(context, variable) { - try { - variable.eval(context); - return Keyword.True; - } catch (e) { - return Keyword.False; - } -} - -isdefined.evalArgs = false; - -export default { isdefined, boolean, 'if': If }; diff --git a/packages/less/src/less/functions/color-blending.js b/packages/less/src/less/functions/color-blending.js deleted file mode 100644 index c38a5e4267..0000000000 --- a/packages/less/src/less/functions/color-blending.js +++ /dev/null @@ -1,85 +0,0 @@ -import Color from '../tree/color'; - -// Color Blending -// ref: http://www.w3.org/TR/compositing-1 - -function colorBlend(mode, color1, color2) { - const ab = color1.alpha; // result - - let // backdrop - cb; - - const as = color2.alpha; - - let // source - cs; - - let ar; - let cr; - const r = []; - - ar = as + ab * (1 - as); - for (let i = 0; i < 3; i++) { - cb = color1.rgb[i] / 255; - cs = color2.rgb[i] / 255; - cr = mode(cb, cs); - if (ar) { - cr = (as * cs + ab * (cb - - as * (cb + cs - cr))) / ar; - } - r[i] = cr * 255; - } - - return new Color(r, ar); -} - -const colorBlendModeFunctions = { - multiply: function(cb, cs) { - return cb * cs; - }, - screen: function(cb, cs) { - return cb + cs - cb * cs; - }, - overlay: function(cb, cs) { - cb *= 2; - return (cb <= 1) ? - colorBlendModeFunctions.multiply(cb, cs) : - colorBlendModeFunctions.screen(cb - 1, cs); - }, - softlight: function(cb, cs) { - let d = 1; - let e = cb; - if (cs > 0.5) { - e = 1; - d = (cb > 0.25) ? Math.sqrt(cb) - : ((16 * cb - 12) * cb + 4) * cb; - } - return cb - (1 - 2 * cs) * e * (d - cb); - }, - hardlight: function(cb, cs) { - return colorBlendModeFunctions.overlay(cs, cb); - }, - difference: function(cb, cs) { - return Math.abs(cb - cs); - }, - exclusion: function(cb, cs) { - return cb + cs - 2 * cb * cs; - }, - - // non-w3c functions: - average: function(cb, cs) { - return (cb + cs) / 2; - }, - negation: function(cb, cs) { - return 1 - Math.abs(cb + cs - 1); - } -}; - -for (const f in colorBlendModeFunctions) { - // eslint-disable-next-line no-prototype-builtins - if (colorBlendModeFunctions.hasOwnProperty(f)) { - colorBlend[f] = colorBlend.bind(null, colorBlendModeFunctions[f]); - } -} - -export default colorBlend; diff --git a/packages/less/src/less/functions/color.js b/packages/less/src/less/functions/color.js deleted file mode 100644 index c49d233ce0..0000000000 --- a/packages/less/src/less/functions/color.js +++ /dev/null @@ -1,452 +0,0 @@ -import Dimension from '../tree/dimension'; -import Color from '../tree/color'; -import Quoted from '../tree/quoted'; -import Anonymous from '../tree/anonymous'; -import Expression from '../tree/expression'; -import Operation from '../tree/operation'; -let colorFunctions; - -function clamp(val) { - return Math.min(1, Math.max(0, val)); -} -function hsla(origColor, hsl) { - const color = colorFunctions.hsla(hsl.h, hsl.s, hsl.l, hsl.a); - if (color) { - if (origColor.value && - /^(rgb|hsl)/.test(origColor.value)) { - color.value = origColor.value; - } else { - color.value = 'rgb'; - } - return color; - } -} -function toHSL(color) { - if (color.toHSL) { - return color.toHSL(); - } else { - throw new Error('Argument cannot be evaluated to a color'); - } -} - -function toHSV(color) { - if (color.toHSV) { - return color.toHSV(); - } else { - throw new Error('Argument cannot be evaluated to a color'); - } -} - -function number(n) { - if (n instanceof Dimension) { - return parseFloat(n.unit.is('%') ? n.value / 100 : n.value); - } else if (typeof n === 'number') { - return n; - } else { - throw { - type: 'Argument', - message: 'color functions take numbers as parameters' - }; - } -} -function scaled(n, size) { - if (n instanceof Dimension && n.unit.is('%')) { - return parseFloat(n.value * size / 100); - } else { - return number(n); - } -} -colorFunctions = { - rgb: function (r, g, b) { - let a = 1 - /** - * Comma-less syntax - * e.g. rgb(0 128 255 / 50%) - */ - if (r instanceof Expression) { - const val = r.value - r = val[0] - g = val[1] - b = val[2] - /** - * @todo - should this be normalized in - * function caller? Or parsed differently? - */ - if (b instanceof Operation) { - const op = b - b = op.operands[0] - a = op.operands[1] - } - } - const color = colorFunctions.rgba(r, g, b, a); - if (color) { - color.value = 'rgb'; - return color; - } - }, - rgba: function (r, g, b, a) { - try { - if (r instanceof Color) { - if (g) { - a = number(g); - } else { - a = r.alpha; - } - return new Color(r.rgb, a, 'rgba'); - } - const rgb = [r, g, b].map(c => scaled(c, 255)); - a = number(a); - return new Color(rgb, a, 'rgba'); - } - catch (e) {} - }, - hsl: function (h, s, l) { - let a = 1 - if (h instanceof Expression) { - const val = h.value - h = val[0] - s = val[1] - l = val[2] - - if (l instanceof Operation) { - const op = l - l = op.operands[0] - a = op.operands[1] - } - } - const color = colorFunctions.hsla(h, s, l, a); - if (color) { - color.value = 'hsl'; - return color; - } - }, - hsla: function (h, s, l, a) { - let m1; - let m2; - - function hue(h) { - h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h); - if (h * 6 < 1) { - return m1 + (m2 - m1) * h * 6; - } - else if (h * 2 < 1) { - return m2; - } - else if (h * 3 < 2) { - return m1 + (m2 - m1) * (2 / 3 - h) * 6; - } - else { - return m1; - } - } - - try { - if (h instanceof Color) { - if (s) { - a = number(s); - } else { - a = h.alpha; - } - return new Color(h.rgb, a, 'hsla'); - } - - h = (number(h) % 360) / 360; - s = clamp(number(s));l = clamp(number(l));a = clamp(number(a)); - - m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s; - m1 = l * 2 - m2; - - const rgb = [ - hue(h + 1 / 3) * 255, - hue(h) * 255, - hue(h - 1 / 3) * 255 - ]; - a = number(a); - return new Color(rgb, a, 'hsla'); - } - catch (e) {} - }, - - hsv: function(h, s, v) { - return colorFunctions.hsva(h, s, v, 1.0); - }, - - hsva: function(h, s, v, a) { - h = ((number(h) % 360) / 360) * 360; - s = number(s);v = number(v);a = number(a); - - let i; - let f; - i = Math.floor((h / 60) % 6); - f = (h / 60) - i; - - const vs = [v, - v * (1 - s), - v * (1 - f * s), - v * (1 - (1 - f) * s)]; - const perm = [[0, 3, 1], - [2, 0, 1], - [1, 0, 3], - [1, 2, 0], - [3, 1, 0], - [0, 1, 2]]; - - return colorFunctions.rgba(vs[perm[i][0]] * 255, - vs[perm[i][1]] * 255, - vs[perm[i][2]] * 255, - a); - }, - - hue: function (color) { - return new Dimension(toHSL(color).h); - }, - saturation: function (color) { - return new Dimension(toHSL(color).s * 100, '%'); - }, - lightness: function (color) { - return new Dimension(toHSL(color).l * 100, '%'); - }, - hsvhue: function(color) { - return new Dimension(toHSV(color).h); - }, - hsvsaturation: function (color) { - return new Dimension(toHSV(color).s * 100, '%'); - }, - hsvvalue: function (color) { - return new Dimension(toHSV(color).v * 100, '%'); - }, - red: function (color) { - return new Dimension(color.rgb[0]); - }, - green: function (color) { - return new Dimension(color.rgb[1]); - }, - blue: function (color) { - return new Dimension(color.rgb[2]); - }, - alpha: function (color) { - return new Dimension(toHSL(color).a); - }, - luma: function (color) { - return new Dimension(color.luma() * color.alpha * 100, '%'); - }, - luminance: function (color) { - const luminance = - (0.2126 * color.rgb[0] / 255) + - (0.7152 * color.rgb[1] / 255) + - (0.0722 * color.rgb[2] / 255); - - return new Dimension(luminance * color.alpha * 100, '%'); - }, - saturate: function (color, amount, method) { - // filter: saturate(3.2); - // should be kept as is, so check for color - if (!color.rgb) { - return null; - } - const hsl = toHSL(color); - - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.s += hsl.s * amount.value / 100; - } - else { - hsl.s += amount.value / 100; - } - hsl.s = clamp(hsl.s); - return hsla(color, hsl); - }, - desaturate: function (color, amount, method) { - const hsl = toHSL(color); - - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.s -= hsl.s * amount.value / 100; - } - else { - hsl.s -= amount.value / 100; - } - hsl.s = clamp(hsl.s); - return hsla(color, hsl); - }, - lighten: function (color, amount, method) { - const hsl = toHSL(color); - - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.l += hsl.l * amount.value / 100; - } - else { - hsl.l += amount.value / 100; - } - hsl.l = clamp(hsl.l); - return hsla(color, hsl); - }, - darken: function (color, amount, method) { - const hsl = toHSL(color); - - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.l -= hsl.l * amount.value / 100; - } - else { - hsl.l -= amount.value / 100; - } - hsl.l = clamp(hsl.l); - return hsla(color, hsl); - }, - fadein: function (color, amount, method) { - const hsl = toHSL(color); - - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.a += hsl.a * amount.value / 100; - } - else { - hsl.a += amount.value / 100; - } - hsl.a = clamp(hsl.a); - return hsla(color, hsl); - }, - fadeout: function (color, amount, method) { - const hsl = toHSL(color); - - if (typeof method !== 'undefined' && method.value === 'relative') { - hsl.a -= hsl.a * amount.value / 100; - } - else { - hsl.a -= amount.value / 100; - } - hsl.a = clamp(hsl.a); - return hsla(color, hsl); - }, - fade: function (color, amount) { - const hsl = toHSL(color); - - hsl.a = amount.value / 100; - hsl.a = clamp(hsl.a); - return hsla(color, hsl); - }, - spin: function (color, amount) { - const hsl = toHSL(color); - const hue = (hsl.h + amount.value) % 360; - - hsl.h = hue < 0 ? 360 + hue : hue; - - return hsla(color, hsl); - }, - // - // Copyright (c) 2006-2009 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein - // http://sass-lang.com - // - mix: function (color1, color2, weight) { - if (!weight) { - weight = new Dimension(50); - } - const p = weight.value / 100.0; - const w = p * 2 - 1; - const a = toHSL(color1).a - toHSL(color2).a; - - const w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0; - const w2 = 1 - w1; - - const rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2, - color1.rgb[1] * w1 + color2.rgb[1] * w2, - color1.rgb[2] * w1 + color2.rgb[2] * w2]; - - const alpha = color1.alpha * p + color2.alpha * (1 - p); - - return new Color(rgb, alpha); - }, - greyscale: function (color) { - return colorFunctions.desaturate(color, new Dimension(100)); - }, - contrast: function (color, dark, light, threshold) { - // filter: contrast(3.2); - // should be kept as is, so check for color - if (!color.rgb) { - return null; - } - if (typeof light === 'undefined') { - light = colorFunctions.rgba(255, 255, 255, 1.0); - } - if (typeof dark === 'undefined') { - dark = colorFunctions.rgba(0, 0, 0, 1.0); - } - // Figure out which is actually light and dark: - if (dark.luma() > light.luma()) { - const t = light; - light = dark; - dark = t; - } - if (typeof threshold === 'undefined') { - threshold = 0.43; - } else { - threshold = number(threshold); - } - if (color.luma() < threshold) { - return light; - } else { - return dark; - } - }, - // Changes made in 2.7.0 - Reverted in 3.0.0 - // contrast: function (color, color1, color2, threshold) { - // // Return which of `color1` and `color2` has the greatest contrast with `color` - // // according to the standard WCAG contrast ratio calculation. - // // http://www.w3.org/TR/WCAG20/#contrast-ratiodef - // // The threshold param is no longer used, in line with SASS. - // // filter: contrast(3.2); - // // should be kept as is, so check for color - // if (!color.rgb) { - // return null; - // } - // if (typeof color1 === 'undefined') { - // color1 = colorFunctions.rgba(0, 0, 0, 1.0); - // } - // if (typeof color2 === 'undefined') { - // color2 = colorFunctions.rgba(255, 255, 255, 1.0); - // } - // var contrast1, contrast2; - // var luma = color.luma(); - // var luma1 = color1.luma(); - // var luma2 = color2.luma(); - // // Calculate contrast ratios for each color - // if (luma > luma1) { - // contrast1 = (luma + 0.05) / (luma1 + 0.05); - // } else { - // contrast1 = (luma1 + 0.05) / (luma + 0.05); - // } - // if (luma > luma2) { - // contrast2 = (luma + 0.05) / (luma2 + 0.05); - // } else { - // contrast2 = (luma2 + 0.05) / (luma + 0.05); - // } - // if (contrast1 > contrast2) { - // return color1; - // } else { - // return color2; - // } - // }, - argb: function (color) { - return new Anonymous(color.toARGB()); - }, - color: function(c) { - if ((c instanceof Quoted) && - (/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})$/i.test(c.value))) { - const val = c.value.slice(1); - return new Color(val, undefined, `#${val}`); - } - if ((c instanceof Color) || (c = Color.fromKeyword(c.value))) { - c.value = undefined; - return c; - } - throw { - type: 'Argument', - message: 'argument must be a color keyword or 3|4|6|8 digit hex e.g. #FFF' - }; - }, - tint: function(color, amount) { - return colorFunctions.mix(colorFunctions.rgb(255, 255, 255), color, amount); - }, - shade: function(color, amount) { - return colorFunctions.mix(colorFunctions.rgb(0, 0, 0), color, amount); - } -}; - -export default colorFunctions; diff --git a/packages/less/src/less/functions/data-uri.js b/packages/less/src/less/functions/data-uri.js deleted file mode 100644 index 3c09c507ff..0000000000 --- a/packages/less/src/less/functions/data-uri.js +++ /dev/null @@ -1,74 +0,0 @@ -import Quoted from '../tree/quoted'; -import URL from '../tree/url'; -import * as utils from '../utils'; -import logger from '../logger'; - -export default environment => { - - const fallback = (functionThis, node) => new URL(node, functionThis.index, functionThis.currentFileInfo).eval(functionThis.context); - - return { 'data-uri': function(mimetypeNode, filePathNode) { - - if (!filePathNode) { - filePathNode = mimetypeNode; - mimetypeNode = null; - } - - let mimetype = mimetypeNode && mimetypeNode.value; - let filePath = filePathNode.value; - const currentFileInfo = this.currentFileInfo; - const currentDirectory = currentFileInfo.rewriteUrls ? - currentFileInfo.currentDirectory : currentFileInfo.entryPath; - - const fragmentStart = filePath.indexOf('#'); - let fragment = ''; - if (fragmentStart !== -1) { - fragment = filePath.slice(fragmentStart); - filePath = filePath.slice(0, fragmentStart); - } - const context = utils.clone(this.context); - context.rawBuffer = true; - - const fileManager = environment.getFileManager(filePath, currentDirectory, context, environment, true); - - if (!fileManager) { - return fallback(this, filePathNode); - } - - let useBase64 = false; - - // detect the mimetype if not given - if (!mimetypeNode) { - - mimetype = environment.mimeLookup(filePath); - - if (mimetype === 'image/svg+xml') { - useBase64 = false; - } else { - // use base 64 unless it's an ASCII or UTF-8 format - const charset = environment.charsetLookup(mimetype); - useBase64 = ['US-ASCII', 'UTF-8'].indexOf(charset) < 0; - } - if (useBase64) { mimetype += ';base64'; } - } - else { - useBase64 = /;base64$/.test(mimetype); - } - - const fileSync = fileManager.loadFileSync(filePath, currentDirectory, context, environment); - if (!fileSync.contents) { - logger.warn(`Skipped data-uri embedding of ${filePath} because file not found`); - return fallback(this, filePathNode || mimetypeNode); - } - let buf = fileSync.contents; - if (useBase64 && !environment.encodeBase64) { - return fallback(this, filePathNode); - } - - buf = useBase64 ? environment.encodeBase64(buf) : encodeURIComponent(buf); - - const uri = `data:${mimetype},${buf}${fragment}`; - - return new URL(new Quoted(`"${uri}"`, uri, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo); - }}; -}; diff --git a/packages/less/src/less/functions/default.js b/packages/less/src/less/functions/default.js deleted file mode 100644 index 61c14b9acd..0000000000 --- a/packages/less/src/less/functions/default.js +++ /dev/null @@ -1,26 +0,0 @@ -import Keyword from '../tree/keyword'; -import * as utils from '../utils'; - -const defaultFunc = { - eval: function () { - const v = this.value_; - const e = this.error_; - if (e) { - throw e; - } - if (!utils.isNullOrUndefined(v)) { - return v ? Keyword.True : Keyword.False; - } - }, - value: function (v) { - this.value_ = v; - }, - error: function (e) { - this.error_ = e; - }, - reset: function () { - this.value_ = this.error_ = null; - } -}; - -export default defaultFunc; diff --git a/packages/less/src/less/functions/function-caller.js b/packages/less/src/less/functions/function-caller.js deleted file mode 100644 index 4a46ec74b8..0000000000 --- a/packages/less/src/less/functions/function-caller.js +++ /dev/null @@ -1,55 +0,0 @@ -import Expression from '../tree/expression'; - -class functionCaller { - constructor(name, context, index, currentFileInfo) { - this.name = name.toLowerCase(); - this.index = index; - this.context = context; - this.currentFileInfo = currentFileInfo; - - this.func = context.frames[0].functionRegistry.get(this.name); - } - - isValid() { - return Boolean(this.func); - } - - call(args) { - if (!(Array.isArray(args))) { - args = [args]; - } - const evalArgs = this.func.evalArgs; - if (evalArgs !== false) { - args = args.map(a => a.eval(this.context)); - } - const commentFilter = item => !(item.type === 'Comment'); - - // This code is terrible and should be replaced as per this issue... - // https://github.com/less/less.js/issues/2477 - args = args - .filter(commentFilter) - .map(item => { - if (item.type === 'Expression') { - const subNodes = item.value.filter(commentFilter); - if (subNodes.length === 1) { - // https://github.com/less/less.js/issues/3616 - if (item.parens && subNodes[0].op === '/') { - return item; - } - return subNodes[0]; - } else { - return new Expression(subNodes); - } - } - return item; - }); - - if (evalArgs === false) { - return this.func(this.context, ...args); - } - - return this.func(...args); - } -} - -export default functionCaller; diff --git a/packages/less/src/less/functions/function-registry.js b/packages/less/src/less/functions/function-registry.js deleted file mode 100644 index 82ee6f183b..0000000000 --- a/packages/less/src/less/functions/function-registry.js +++ /dev/null @@ -1,36 +0,0 @@ -function makeRegistry( base ) { - return { - _data: {}, - add: function(name, func) { - // precautionary case conversion, as later querying of - // the registry by function-caller uses lower case as well. - name = name.toLowerCase(); - - // eslint-disable-next-line no-prototype-builtins - if (this._data.hasOwnProperty(name)) { - // TODO warn - } - this._data[name] = func; - }, - addMultiple: function(functions) { - Object.keys(functions).forEach( - name => { - this.add(name, functions[name]); - }); - }, - get: function(name) { - return this._data[name] || ( base && base.get( name )); - }, - getLocalFunctions: function() { - return this._data; - }, - inherit: function() { - return makeRegistry( this ); - }, - create: function(base) { - return makeRegistry(base); - } - }; -} - -export default makeRegistry( null ); \ No newline at end of file diff --git a/packages/less/src/less/functions/index.js b/packages/less/src/less/functions/index.js deleted file mode 100644 index 160ac75234..0000000000 --- a/packages/less/src/less/functions/index.js +++ /dev/null @@ -1,35 +0,0 @@ -import functionRegistry from './function-registry'; -import functionCaller from './function-caller'; - -import boolean from './boolean'; -import defaultFunc from './default'; -import color from './color'; -import colorBlending from './color-blending'; -import dataUri from './data-uri'; -import list from './list'; -import math from './math'; -import number from './number'; -import string from './string'; -import svg from './svg'; -import types from './types'; -import style from './style'; - -export default environment => { - const functions = { functionRegistry, functionCaller }; - - // register functions - functionRegistry.addMultiple(boolean); - functionRegistry.add('default', defaultFunc.eval.bind(defaultFunc)); - functionRegistry.addMultiple(color); - functionRegistry.addMultiple(colorBlending); - functionRegistry.addMultiple(dataUri(environment)); - functionRegistry.addMultiple(list); - functionRegistry.addMultiple(math); - functionRegistry.addMultiple(number); - functionRegistry.addMultiple(string); - functionRegistry.addMultiple(svg(environment)); - functionRegistry.addMultiple(types); - functionRegistry.addMultiple(style); - - return functions; -}; diff --git a/packages/less/src/less/functions/list.js b/packages/less/src/less/functions/list.js deleted file mode 100644 index 6ba33a3055..0000000000 --- a/packages/less/src/less/functions/list.js +++ /dev/null @@ -1,158 +0,0 @@ -import Comment from '../tree/comment'; -import Node from '../tree/node'; -import Dimension from '../tree/dimension'; -import Declaration from '../tree/declaration'; -import Expression from '../tree/expression'; -import Ruleset from '../tree/ruleset'; -import Selector from '../tree/selector'; -import Element from '../tree/element'; -import Quote from '../tree/quoted'; -import Value from '../tree/value'; - -const getItemsFromNode = node => { - // handle non-array values as an array of length 1 - // return 'undefined' if index is invalid - const items = Array.isArray(node.value) ? - node.value : Array(node); - - return items; -}; - -export default { - _SELF: function(n) { - return n; - }, - '~': function(...expr) { - if (expr.length === 1) { - return expr[0]; - } - return new Value(expr); - }, - extract: function(values, index) { - // (1-based index) - index = index.value - 1; - - return getItemsFromNode(values)[index]; - }, - length: function(values) { - return new Dimension(getItemsFromNode(values).length); - }, - /** - * Creates a Less list of incremental values. - * Modeled after Lodash's range function, also exists natively in PHP - * - * @param {Dimension} [start=1] - * @param {Dimension} end - e.g. 10 or 10px - unit is added to output - * @param {Dimension} [step=1] - */ - range: function(start, end, step) { - let from; - let to; - let stepValue = 1; - const list = []; - if (end) { - to = end; - from = start.value; - if (step) { - stepValue = step.value; - } - } - else { - from = 1; - to = start; - } - - for (let i = from; i <= to.value; i += stepValue) { - list.push(new Dimension(i, to.unit)); - } - - return new Expression(list); - }, - each: function(list, rs) { - const rules = []; - let newRules; - let iterator; - - const tryEval = val => { - if (val instanceof Node) { - return val.eval(this.context); - } - return val; - }; - - if (list.value && !(list instanceof Quote)) { - if (Array.isArray(list.value)) { - iterator = list.value.map(tryEval); - } else { - iterator = [tryEval(list.value)]; - } - } else if (list.ruleset) { - iterator = tryEval(list.ruleset).rules; - } else if (list.rules) { - iterator = list.rules.map(tryEval); - } else if (Array.isArray(list)) { - iterator = list.map(tryEval); - } else { - iterator = [tryEval(list)]; - } - - let valueName = '@value'; - let keyName = '@key'; - let indexName = '@index'; - - if (rs.params) { - valueName = rs.params[0] && rs.params[0].name; - keyName = rs.params[1] && rs.params[1].name; - indexName = rs.params[2] && rs.params[2].name; - rs = rs.rules; - } else { - rs = rs.ruleset; - } - - for (let i = 0; i < iterator.length; i++) { - let key; - let value; - const item = iterator[i]; - if (item instanceof Declaration) { - key = typeof item.name === 'string' ? item.name : item.name[0].value; - value = item.value; - } else { - key = new Dimension(i + 1); - value = item; - } - - if (item instanceof Comment) { - continue; - } - - newRules = rs.rules.slice(0); - if (valueName) { - newRules.push(new Declaration(valueName, - value, - false, false, this.index, this.currentFileInfo)); - } - if (indexName) { - newRules.push(new Declaration(indexName, - new Dimension(i + 1), - false, false, this.index, this.currentFileInfo)); - } - if (keyName) { - newRules.push(new Declaration(keyName, - key, - false, false, this.index, this.currentFileInfo)); - } - - rules.push(new Ruleset([ new(Selector)([ new Element('', '&') ]) ], - newRules, - rs.strictImports, - rs.visibilityInfo() - )); - } - - return new Ruleset([ new(Selector)([ new Element('', '&') ]) ], - rules, - rs.strictImports, - rs.visibilityInfo() - ).eval(this.context); - } -}; diff --git a/packages/less/src/less/functions/math-helper.js b/packages/less/src/less/functions/math-helper.js deleted file mode 100644 index b557875c5d..0000000000 --- a/packages/less/src/less/functions/math-helper.js +++ /dev/null @@ -1,15 +0,0 @@ -import Dimension from '../tree/dimension'; - -const MathHelper = (fn, unit, n) => { - if (!(n instanceof Dimension)) { - throw { type: 'Argument', message: 'argument must be a number' }; - } - if (unit === null) { - unit = n.unit; - } else { - n = n.unify(); - } - return new Dimension(fn(parseFloat(n.value)), unit); -}; - -export default MathHelper; \ No newline at end of file diff --git a/packages/less/src/less/functions/math.js b/packages/less/src/less/functions/math.js deleted file mode 100644 index 0432eff605..0000000000 --- a/packages/less/src/less/functions/math.js +++ /dev/null @@ -1,29 +0,0 @@ -import mathHelper from './math-helper.js'; - -const mathFunctions = { - // name, unit - ceil: null, - floor: null, - sqrt: null, - abs: null, - tan: '', - sin: '', - cos: '', - atan: 'rad', - asin: 'rad', - acos: 'rad' -}; - -for (const f in mathFunctions) { - // eslint-disable-next-line no-prototype-builtins - if (mathFunctions.hasOwnProperty(f)) { - mathFunctions[f] = mathHelper.bind(null, Math[f], mathFunctions[f]); - } -} - -mathFunctions.round = (n, f) => { - const fraction = typeof f === 'undefined' ? 0 : f.value; - return mathHelper(num => num.toFixed(fraction), null, n); -}; - -export default mathFunctions; diff --git a/packages/less/src/less/functions/number.js b/packages/less/src/less/functions/number.js deleted file mode 100644 index ccb97afef3..0000000000 --- a/packages/less/src/less/functions/number.js +++ /dev/null @@ -1,95 +0,0 @@ -import Dimension from '../tree/dimension'; -import Anonymous from '../tree/anonymous'; -import mathHelper from './math-helper.js'; - -const minMax = function (isMin, args) { - args = Array.prototype.slice.call(args); - switch (args.length) { - case 0: throw { type: 'Argument', message: 'one or more arguments required' }; - } - let i; // key is the unit.toString() for unified Dimension values, - let j; - let current; - let currentUnified; - let referenceUnified; - let unit; - let unitStatic; - let unitClone; - - const // elems only contains original argument values. - order = []; - - const values = {}; - // value is the index into the order array. - for (i = 0; i < args.length; i++) { - current = args[i]; - if (!(current instanceof Dimension)) { - if (Array.isArray(args[i].value)) { - Array.prototype.push.apply(args, Array.prototype.slice.call(args[i].value)); - continue; - } else { - throw { type: 'Argument', message: 'incompatible types' }; - } - } - currentUnified = current.unit.toString() === '' && unitClone !== undefined ? new Dimension(current.value, unitClone).unify() : current.unify(); - unit = currentUnified.unit.toString() === '' && unitStatic !== undefined ? unitStatic : currentUnified.unit.toString(); - unitStatic = unit !== '' && unitStatic === undefined || unit !== '' && order[0].unify().unit.toString() === '' ? unit : unitStatic; - unitClone = unit !== '' && unitClone === undefined ? current.unit.toString() : unitClone; - j = values[''] !== undefined && unit !== '' && unit === unitStatic ? values[''] : values[unit]; - if (j === undefined) { - if (unitStatic !== undefined && unit !== unitStatic) { - throw { type: 'Argument', message: 'incompatible types' }; - } - values[unit] = order.length; - order.push(current); - continue; - } - referenceUnified = order[j].unit.toString() === '' && unitClone !== undefined ? new Dimension(order[j].value, unitClone).unify() : order[j].unify(); - if ( isMin && currentUnified.value < referenceUnified.value || - !isMin && currentUnified.value > referenceUnified.value) { - order[j] = current; - } - } - if (order.length == 1) { - return order[0]; - } - args = order.map(a => { return a.toCSS(this.context); }).join(this.context.compress ? ',' : ', '); - return new Anonymous(`${isMin ? 'min' : 'max'}(${args})`); -}; - -export default { - min: function(...args) { - try { - return minMax.call(this, true, args); - } catch (e) {} - }, - max: function(...args) { - try { - return minMax.call(this, false, args); - } catch (e) {} - }, - convert: function (val, unit) { - return val.convertTo(unit.value); - }, - pi: function () { - return new Dimension(Math.PI); - }, - mod: function(a, b) { - return new Dimension(a.value % b.value, a.unit); - }, - pow: function(x, y) { - if (typeof x === 'number' && typeof y === 'number') { - x = new Dimension(x); - y = new Dimension(y); - } else if (!(x instanceof Dimension) || !(y instanceof Dimension)) { - throw { type: 'Argument', message: 'arguments must be numbers' }; - } - - return new Dimension(Math.pow(x.value, y.value), x.unit); - }, - percentage: function (n) { - const result = mathHelper(num => num * 100, '%', n); - - return result; - } -}; diff --git a/packages/less/src/less/functions/string.js b/packages/less/src/less/functions/string.js deleted file mode 100644 index 2ded205510..0000000000 --- a/packages/less/src/less/functions/string.js +++ /dev/null @@ -1,36 +0,0 @@ -import Quoted from '../tree/quoted'; -import Anonymous from '../tree/anonymous'; -import JavaScript from '../tree/javascript'; - -export default { - e: function (str) { - return new Quoted('"', str instanceof JavaScript ? str.evaluated : str.value, true); - }, - escape: function (str) { - return new Anonymous( - encodeURI(str.value).replace(/=/g, '%3D').replace(/:/g, '%3A').replace(/#/g, '%23').replace(/;/g, '%3B') - .replace(/\(/g, '%28').replace(/\)/g, '%29')); - }, - replace: function (string, pattern, replacement, flags) { - let result = string.value; - replacement = (replacement.type === 'Quoted') ? - replacement.value : replacement.toCSS(); - result = result.replace(new RegExp(pattern.value, flags ? flags.value : ''), replacement); - return new Quoted(string.quote || '', result, string.escaped); - }, - '%': function (string /* arg, arg, ... */) { - const args = Array.prototype.slice.call(arguments, 1); - let result = string.value; - - for (let i = 0; i < args.length; i++) { - /* jshint loopfunc:true */ - result = result.replace(/%[sda]/i, token => { - const value = ((args[i].type === 'Quoted') && - token.match(/s/i)) ? args[i].value : args[i].toCSS(); - return token.match(/[A-Z]$/) ? encodeURIComponent(value) : value; - }); - } - result = result.replace(/%%/g, '%'); - return new Quoted(string.quote || '', result, string.escaped); - } -}; diff --git a/packages/less/src/less/functions/style.js b/packages/less/src/less/functions/style.js deleted file mode 100644 index 85b6b0f960..0000000000 --- a/packages/less/src/less/functions/style.js +++ /dev/null @@ -1,23 +0,0 @@ -import Variable from '../tree/variable'; -import Anonymous from '../tree/variable'; - -const styleExpression = function (args) { - args = Array.prototype.slice.call(args); - switch (args.length) { - case 0: throw { type: 'Argument', message: 'one or more arguments required' }; - } - - const entityList = [new Variable(args[0].value, this.index, this.currentFileInfo).eval(this.context)]; - - args = entityList.map(a => { return a.toCSS(this.context); }).join(this.context.compress ? ',' : ', '); - - return new Anonymous(`style(${args})`); -}; - -export default { - style: function(...args) { - try { - return styleExpression.call(this, args); - } catch (e) {} - }, -}; diff --git a/packages/less/src/less/functions/svg.js b/packages/less/src/less/functions/svg.js deleted file mode 100644 index a1d06314ce..0000000000 --- a/packages/less/src/less/functions/svg.js +++ /dev/null @@ -1,87 +0,0 @@ -import Dimension from '../tree/dimension'; -import Color from '../tree/color'; -import Expression from '../tree/expression'; -import Quoted from '../tree/quoted'; -import URL from '../tree/url'; - -export default () => { - return { 'svg-gradient': function(direction) { - let stops; - let gradientDirectionSvg; - let gradientType = 'linear'; - let rectangleDimension = 'x="0" y="0" width="1" height="1"'; - const renderEnv = {compress: false}; - let returner; - const directionValue = direction.toCSS(renderEnv); - let i; - let color; - let position; - let positionValue; - let alpha; - - function throwArgumentDescriptor() { - throw { type: 'Argument', - message: 'svg-gradient expects direction, start_color [start_position], [color position,]...,' + - ' end_color [end_position] or direction, color list' }; - } - - if (arguments.length == 2) { - if (arguments[1].value.length < 2) { - throwArgumentDescriptor(); - } - stops = arguments[1].value; - } else if (arguments.length < 3) { - throwArgumentDescriptor(); - } else { - stops = Array.prototype.slice.call(arguments, 1); - } - - switch (directionValue) { - case 'to bottom': - gradientDirectionSvg = 'x1="0%" y1="0%" x2="0%" y2="100%"'; - break; - case 'to right': - gradientDirectionSvg = 'x1="0%" y1="0%" x2="100%" y2="0%"'; - break; - case 'to bottom right': - gradientDirectionSvg = 'x1="0%" y1="0%" x2="100%" y2="100%"'; - break; - case 'to top right': - gradientDirectionSvg = 'x1="0%" y1="100%" x2="100%" y2="0%"'; - break; - case 'ellipse': - case 'ellipse at center': - gradientType = 'radial'; - gradientDirectionSvg = 'cx="50%" cy="50%" r="75%"'; - rectangleDimension = 'x="-50" y="-50" width="101" height="101"'; - break; - default: - throw { type: 'Argument', message: 'svg-gradient direction must be \'to bottom\', \'to right\',' + - ' \'to bottom right\', \'to top right\' or \'ellipse at center\'' }; - } - returner = `<${gradientType}Gradient id="g" ${gradientDirectionSvg}>`; - - for (i = 0; i < stops.length; i += 1) { - if (stops[i] instanceof Expression) { - color = stops[i].value[0]; - position = stops[i].value[1]; - } else { - color = stops[i]; - position = undefined; - } - - if (!(color instanceof Color) || (!((i === 0 || i + 1 === stops.length) && position === undefined) && !(position instanceof Dimension))) { - throwArgumentDescriptor(); - } - positionValue = position ? position.toCSS(renderEnv) : i === 0 ? '0%' : '100%'; - alpha = color.alpha; - returner += ``; - } - returner += ``; - - returner = encodeURIComponent(returner); - - returner = `data:image/svg+xml,${returner}`; - return new URL(new Quoted(`'${returner}'`, returner, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo); - }}; -}; diff --git a/packages/less/src/less/functions/types.js b/packages/less/src/less/functions/types.js deleted file mode 100644 index 6f1aff30f1..0000000000 --- a/packages/less/src/less/functions/types.js +++ /dev/null @@ -1,70 +0,0 @@ -import Keyword from '../tree/keyword'; -import DetachedRuleset from '../tree/detached-ruleset'; -import Dimension from '../tree/dimension'; -import Color from '../tree/color'; -import Quoted from '../tree/quoted'; -import Anonymous from '../tree/anonymous'; -import URL from '../tree/url'; -import Operation from '../tree/operation'; - -const isa = (n, Type) => (n instanceof Type) ? Keyword.True : Keyword.False; -const isunit = (n, unit) => { - if (unit === undefined) { - throw { type: 'Argument', message: 'missing the required second argument to isunit.' }; - } - unit = typeof unit.value === 'string' ? unit.value : unit; - if (typeof unit !== 'string') { - throw { type: 'Argument', message: 'Second argument to isunit should be a unit or a string.' }; - } - return (n instanceof Dimension) && n.unit.is(unit) ? Keyword.True : Keyword.False; -}; - -export default { - isruleset: function (n) { - return isa(n, DetachedRuleset); - }, - iscolor: function (n) { - return isa(n, Color); - }, - isnumber: function (n) { - return isa(n, Dimension); - }, - isstring: function (n) { - return isa(n, Quoted); - }, - iskeyword: function (n) { - return isa(n, Keyword); - }, - isurl: function (n) { - return isa(n, URL); - }, - ispixel: function (n) { - return isunit(n, 'px'); - }, - ispercentage: function (n) { - return isunit(n, '%'); - }, - isem: function (n) { - return isunit(n, 'em'); - }, - isunit, - unit: function (val, unit) { - if (!(val instanceof Dimension)) { - throw { type: 'Argument', - message: `the first argument to unit must be a number${val instanceof Operation ? '. Have you forgotten parenthesis?' : ''}` }; - } - if (unit) { - if (unit instanceof Keyword) { - unit = unit.value; - } else { - unit = unit.toCSS(); - } - } else { - unit = ''; - } - return new Dimension(val.value, unit); - }, - 'get-unit': function (n) { - return new Anonymous(n.unit); - } -}; diff --git a/packages/less/src/less/import-manager.js b/packages/less/src/less/import-manager.js deleted file mode 100644 index 350f242db9..0000000000 --- a/packages/less/src/less/import-manager.js +++ /dev/null @@ -1,183 +0,0 @@ -import contexts from './contexts'; -import Parser from './parser/parser'; -import LessError from './less-error'; -import * as utils from './utils'; -import logger from './logger'; - -export default function(environment) { - // FileInfo = { - // 'rewriteUrls' - option - whether to adjust URL's to be relative - // 'filename' - full resolved filename of current file - // 'rootpath' - path to append to normal URLs for this node - // 'currentDirectory' - path to the current file, absolute - // 'rootFilename' - filename of the base file - // 'entryPath' - absolute path to the entry file - // 'reference' - whether the file should not be output and only output parts that are referenced - - class ImportManager { - constructor(less, context, rootFileInfo) { - this.less = less; - this.rootFilename = rootFileInfo.filename; - this.paths = context.paths || []; // Search paths, when importing - this.contents = {}; // map - filename to contents of all the files - this.contentsIgnoredChars = {}; // map - filename to lines at the beginning of each file to ignore - this.mime = context.mime; - this.error = null; - this.context = context; - // Deprecated? Unused outside of here, could be useful. - this.queue = []; // Files which haven't been imported yet - this.files = {}; // Holds the imported parse trees. - } - - /** - * Add an import to be imported - * @param path - the raw path - * @param tryAppendExtension - whether to try appending a file extension (.less or .js if the path has no extension) - * @param currentFileInfo - the current file info (used for instance to work out relative paths) - * @param importOptions - import options - * @param callback - callback for when it is imported - */ - push(path, tryAppendExtension, currentFileInfo, importOptions, callback) { - const importManager = this, pluginLoader = this.context.pluginManager.Loader; - - this.queue.push(path); - - const fileParsedFunc = function (e, root, fullPath) { - importManager.queue.splice(importManager.queue.indexOf(path), 1); // Remove the path from the queue - - const importedEqualsRoot = fullPath === importManager.rootFilename; - if (importOptions.optional && e) { - callback(null, {rules:[]}, false, null); - logger.info(`The file ${fullPath} was skipped because it was not found and the import was marked optional.`); - } - else { - // Inline imports aren't cached here. - // If we start to cache them, please make sure they won't conflict with non-inline imports of the - // same name as they used to do before this comment and the condition below have been added. - if (!importManager.files[fullPath] && !importOptions.inline) { - importManager.files[fullPath] = { root, options: importOptions }; - } - if (e && !importManager.error) { importManager.error = e; } - callback(e, root, importedEqualsRoot, fullPath); - } - }; - - const newFileInfo = { - rewriteUrls: this.context.rewriteUrls, - entryPath: currentFileInfo.entryPath, - rootpath: currentFileInfo.rootpath, - rootFilename: currentFileInfo.rootFilename - }; - - const fileManager = environment.getFileManager(path, currentFileInfo.currentDirectory, this.context, environment); - - if (!fileManager) { - fileParsedFunc({ message: `Could not find a file-manager for ${path}` }); - return; - } - - const loadFileCallback = function(loadedFile) { - let plugin; - const resolvedFilename = loadedFile.filename; - const contents = loadedFile.contents.replace(/^\uFEFF/, ''); - - // Pass on an updated rootpath if path of imported file is relative and file - // is in a (sub|sup) directory - // - // Examples: - // - If path of imported file is 'module/nav/nav.less' and rootpath is 'less/', - // then rootpath should become 'less/module/nav/' - // - If path of imported file is '../mixins.less' and rootpath is 'less/', - // then rootpath should become 'less/../' - newFileInfo.currentDirectory = fileManager.getPath(resolvedFilename); - if (newFileInfo.rewriteUrls) { - newFileInfo.rootpath = fileManager.join( - (importManager.context.rootpath || ''), - fileManager.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath)); - - if (!fileManager.isPathAbsolute(newFileInfo.rootpath) && fileManager.alwaysMakePathsAbsolute()) { - newFileInfo.rootpath = fileManager.join(newFileInfo.entryPath, newFileInfo.rootpath); - } - } - newFileInfo.filename = resolvedFilename; - - const newEnv = new contexts.Parse(importManager.context); - - newEnv.processImports = false; - importManager.contents[resolvedFilename] = contents; - - if (currentFileInfo.reference || importOptions.reference) { - newFileInfo.reference = true; - } - - if (importOptions.isPlugin) { - plugin = pluginLoader.evalPlugin(contents, newEnv, importManager, importOptions.pluginArgs, newFileInfo); - if (plugin instanceof LessError) { - fileParsedFunc(plugin, null, resolvedFilename); - } - else { - fileParsedFunc(null, plugin, resolvedFilename); - } - } else if (importOptions.inline) { - fileParsedFunc(null, contents, resolvedFilename); - } else { - // import (multiple) parse trees apparently get altered and can't be cached. - // TODO: investigate why this is - if (importManager.files[resolvedFilename] - && !importManager.files[resolvedFilename].options.multiple - && !importOptions.multiple) { - - fileParsedFunc(null, importManager.files[resolvedFilename].root, resolvedFilename); - } - else { - new Parser(newEnv, importManager, newFileInfo).parse(contents, function (e, root) { - fileParsedFunc(e, root, resolvedFilename); - }); - } - } - }; - let loadedFile; - let promise; - const context = utils.clone(this.context); - - if (tryAppendExtension) { - context.ext = importOptions.isPlugin ? '.js' : '.less'; - } - - if (importOptions.isPlugin) { - context.mime = 'application/javascript'; - - if (context.syncImport) { - loadedFile = pluginLoader.loadPluginSync(path, currentFileInfo.currentDirectory, context, environment, fileManager); - } else { - promise = pluginLoader.loadPlugin(path, currentFileInfo.currentDirectory, context, environment, fileManager); - } - } - else { - if (context.syncImport) { - loadedFile = fileManager.loadFileSync(path, currentFileInfo.currentDirectory, context, environment); - } else { - promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, context, environment, - (err, loadedFile) => { - if (err) { - fileParsedFunc(err); - } else { - loadFileCallback(loadedFile); - } - }); - } - } - if (loadedFile) { - if (!loadedFile.filename) { - fileParsedFunc(loadedFile); - } else { - loadFileCallback(loadedFile); - } - } else if (promise) { - promise.then(loadFileCallback, fileParsedFunc); - } - } - } - - return ImportManager; -} diff --git a/packages/less/src/less/index.js b/packages/less/src/less/index.js deleted file mode 100644 index e10d0a12cb..0000000000 --- a/packages/less/src/less/index.js +++ /dev/null @@ -1,98 +0,0 @@ -import Environment from './environment/environment'; -import data from './data'; -import tree from './tree'; -import AbstractFileManager from './environment/abstract-file-manager'; -import AbstractPluginLoader from './environment/abstract-plugin-loader'; -import visitors from './visitors'; -import Parser from './parser/parser'; -import functions from './functions'; -import contexts from './contexts'; -import LessError from './less-error'; -import transformTree from './transform-tree'; -import * as utils from './utils'; -import PluginManager from './plugin-manager'; -import logger from './logger'; -import SourceMapOutput from './source-map-output'; -import SourceMapBuilder from './source-map-builder'; -import ParseTree from './parse-tree'; -import ImportManager from './import-manager'; -import Parse from './parse'; -import Render from './render'; -import { version } from '../../package.json'; -import parseVersion from 'parse-node-version'; - -export default function(environment, fileManagers) { - let sourceMapOutput, sourceMapBuilder, parseTree, importManager; - - environment = new Environment(environment, fileManagers); - sourceMapOutput = SourceMapOutput(environment); - sourceMapBuilder = SourceMapBuilder(sourceMapOutput, environment); - parseTree = ParseTree(sourceMapBuilder); - importManager = ImportManager(environment); - - const render = Render(environment, parseTree, importManager); - const parse = Parse(environment, parseTree, importManager); - - const v = parseVersion(`v${version}`); - const initial = { - version: [v.major, v.minor, v.patch], - data, - tree, - Environment, - AbstractFileManager, - AbstractPluginLoader, - environment, - visitors, - Parser, - functions: functions(environment), - contexts, - SourceMapOutput: sourceMapOutput, - SourceMapBuilder: sourceMapBuilder, - ParseTree: parseTree, - ImportManager: importManager, - render, - parse, - LessError, - transformTree, - utils, - PluginManager, - logger - }; - - // Create a public API - - const ctor = function(t) { - return function() { - const obj = Object.create(t.prototype); - t.apply(obj, Array.prototype.slice.call(arguments, 0)); - return obj; - }; - }; - let t; - const api = Object.create(initial); - for (const n in initial.tree) { - /* eslint guard-for-in: 0 */ - t = initial.tree[n]; - if (typeof t === 'function') { - api[n.toLowerCase()] = ctor(t); - } - else { - api[n] = Object.create(null); - for (const o in t) { - /* eslint guard-for-in: 0 */ - api[n][o.toLowerCase()] = ctor(t[o]); - } - } - } - - /** - * Some of the functions assume a `this` context of the API object, - * which causes it to fail when wrapped for ES6 imports. - * - * An assumed `this` should be removed in the future. - */ - initial.parse = initial.parse.bind(api); - initial.render = initial.render.bind(api); - - return api; -} diff --git a/packages/less/src/less/less-error.js b/packages/less/src/less/less-error.js deleted file mode 100644 index c559c1a3ec..0000000000 --- a/packages/less/src/less/less-error.js +++ /dev/null @@ -1,166 +0,0 @@ -import * as utils from './utils'; - -const anonymousFunc = /(|Function):(\d+):(\d+)/; - -/** - * This is a centralized class of any error that could be thrown internally (mostly by the parser). - * Besides standard .message it keeps some additional data like a path to the file where the error - * occurred along with line and column numbers. - * - * @class - * @extends Error - * @type {module.LessError} - * - * @prop {string} type - * @prop {string} filename - * @prop {number} index - * @prop {number} line - * @prop {number} column - * @prop {number} callLine - * @prop {number} callExtract - * @prop {string[]} extract - * - * @param {Object} e - An error object to wrap around or just a descriptive object - * @param {Object} fileContentMap - An object with file contents in 'contents' property (like importManager) @todo - move to fileManager? - * @param {string} [currentFilename] - */ -const LessError = function(e, fileContentMap, currentFilename) { - Error.call(this); - - const filename = e.filename || currentFilename; - - this.message = e.message; - this.stack = e.stack; - - // Set type early so it's always available, even if fileContentMap is missing - this.type = e.type || 'Syntax'; - - if (fileContentMap && filename) { - const input = fileContentMap.contents[filename]; - const loc = utils.getLocation(e.index, input); - var line = loc.line; - const col = loc.column; - const callLine = e.call && utils.getLocation(e.call, input).line; - const lines = input ? input.split('\n') : ''; - - this.filename = filename; - this.index = e.index; - this.line = typeof line === 'number' ? line + 1 : null; - this.column = col; - - if (!this.line && this.stack) { - const found = this.stack.match(anonymousFunc); - - /** - * We have to figure out how this environment stringifies anonymous functions - * so we can correctly map plugin errors. - * - * Note, in Node 8, the output of anonymous funcs varied based on parameters - * being present or not, so we inject dummy params. - */ - const func = new Function('a', 'throw new Error()'); - let lineAdjust = 0; - try { - func(); - } catch (e) { - const match = e.stack.match(anonymousFunc); - lineAdjust = 1 - parseInt(match[2]); - } - - if (found) { - if (found[2]) { - this.line = parseInt(found[2]) + lineAdjust; - } - if (found[3]) { - this.column = parseInt(found[3]); - } - } - } - - this.callLine = callLine + 1; - this.callExtract = lines[callLine]; - - this.extract = [ - lines[this.line - 2], - lines[this.line - 1], - lines[this.line] - ]; - } - -}; - -if (typeof Object.create === 'undefined') { - const F = function () {}; - F.prototype = Error.prototype; - LessError.prototype = new F(); -} else { - LessError.prototype = Object.create(Error.prototype); -} - -LessError.prototype.constructor = LessError; - -/** - * An overridden version of the default Object.prototype.toString - * which uses additional information to create a helpful message. - * - * @param {Object} options - * @returns {string} - */ -LessError.prototype.toString = function(options) { - options = options || {}; - const isWarning = (this.type ?? '').toLowerCase().includes('warning'); - const type = isWarning ? this.type : `${this.type}Error`; - const color = isWarning ? 'yellow' : 'red'; - - let message = ''; - const extract = this.extract || []; - let error = []; - let stylize = function (str) { return str; }; - if (options.stylize) { - const type = typeof options.stylize; - if (type !== 'function') { - throw Error(`options.stylize should be a function, got a ${type}!`); - } - stylize = options.stylize; - } - - if (this.line !== null) { - if (!isWarning && typeof extract[0] === 'string') { - error.push(stylize(`${this.line - 1} ${extract[0]}`, 'grey')); - } - - if (typeof extract[1] === 'string') { - let errorTxt = `${this.line} `; - if (extract[1]) { - errorTxt += extract[1].slice(0, this.column) + - stylize(stylize(stylize(extract[1].substr(this.column, 1), 'bold') + - extract[1].slice(this.column + 1), 'red'), 'inverse'); - } - error.push(errorTxt); - } - - if (!isWarning && typeof extract[2] === 'string') { - error.push(stylize(`${this.line + 1} ${extract[2]}`, 'grey')); - } - error = `${error.join('\n') + stylize('', 'reset')}\n`; - } - - message += stylize(`${type}: ${this.message}`, color); - if (this.filename) { - message += stylize(' in ', color) + this.filename; - } - if (this.line) { - message += stylize(` on line ${this.line}, column ${this.column + 1}:`, 'grey'); - } - - message += `\n${error}`; - - if (this.callLine) { - message += `${stylize('from ', color) + (this.filename || '')}/n`; - message += `${stylize(this.callLine, 'grey')} ${this.callExtract}/n`; - } - - return message; -}; - -export default LessError; \ No newline at end of file diff --git a/packages/less/src/less/logger.js b/packages/less/src/less/logger.js deleted file mode 100644 index ea83d7fdc2..0000000000 --- a/packages/less/src/less/logger.js +++ /dev/null @@ -1,34 +0,0 @@ -export default { - error: function(msg) { - this._fireEvent('error', msg); - }, - warn: function(msg) { - this._fireEvent('warn', msg); - }, - info: function(msg) { - this._fireEvent('info', msg); - }, - debug: function(msg) { - this._fireEvent('debug', msg); - }, - addListener: function(listener) { - this._listeners.push(listener); - }, - removeListener: function(listener) { - for (let i = 0; i < this._listeners.length; i++) { - if (this._listeners[i] === listener) { - this._listeners.splice(i, 1); - return; - } - } - }, - _fireEvent: function(type, msg) { - for (let i = 0; i < this._listeners.length; i++) { - const logFunction = this._listeners[i][type]; - if (logFunction) { - logFunction(msg); - } - } - }, - _listeners: [] -}; diff --git a/packages/less/src/less/parse-tree.js b/packages/less/src/less/parse-tree.js deleted file mode 100644 index f4e578ea7a..0000000000 --- a/packages/less/src/less/parse-tree.js +++ /dev/null @@ -1,124 +0,0 @@ -import LessError from './less-error'; -import transformTree from './transform-tree'; -import logger from './logger'; - -export default function(SourceMapBuilder) { - class ParseTree { - constructor(root, imports) { - this.root = root; - this.imports = imports; - } - - toCSS(options) { - let evaldRoot; - const result = {}; - let sourceMapBuilder; - try { - evaldRoot = transformTree(this.root, options); - } catch (e) { - throw new LessError(e, this.imports); - } - - try { - const compress = Boolean(options.compress); - if (compress) { - logger.warn('The compress option has been deprecated. ' + - 'We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.'); - } - - const toCSSOptions = { - compress, - // @deprecated The dumpLineNumbers option is deprecated. Use sourcemaps instead. All modes will be removed in a future version. - dumpLineNumbers: options.dumpLineNumbers, - strictUnits: Boolean(options.strictUnits), - numPrecision: 8}; - - if (options.sourceMap) { - // Normalize sourceMap option: if it's just true, convert to object - if (options.sourceMap === true) { - options.sourceMap = {}; - } - const sourceMapOpts = options.sourceMap; - - // Set sourceMapInputFilename if not set and filename is available - if (!sourceMapOpts.sourceMapInputFilename && options.filename) { - sourceMapOpts.sourceMapInputFilename = options.filename; - } - - // Default sourceMapBasepath to the input file's directory if not set - // This matches the behavior documented and implemented in bin/lessc - if (sourceMapOpts.sourceMapBasepath === undefined && options.filename) { - // Get directory from filename using string manipulation (works cross-platform) - const lastSlash = Math.max(options.filename.lastIndexOf('/'), options.filename.lastIndexOf('\\')); - if (lastSlash >= 0) { - sourceMapOpts.sourceMapBasepath = options.filename.substring(0, lastSlash); - } else { - // No directory separator found, use current directory - sourceMapOpts.sourceMapBasepath = '.'; - } - } - - // Handle sourceMapFullFilename (CLI-specific: --source-map=filename) - // This is converted to sourceMapFilename and sourceMapOutputFilename - if (sourceMapOpts.sourceMapFullFilename && !sourceMapOpts.sourceMapFileInline) { - // This case is handled by lessc before calling render - // We just need to ensure sourceMapFilename is set if sourceMapFullFilename is provided - if (!sourceMapOpts.sourceMapFilename && !sourceMapOpts.sourceMapURL) { - // Extract just the basename for the sourceMappingURL comment - const mapBase = sourceMapOpts.sourceMapFullFilename.split(/[/\\]/).pop(); - sourceMapOpts.sourceMapFilename = mapBase; - } - } else if (!sourceMapOpts.sourceMapFilename && !sourceMapOpts.sourceMapURL) { - // If sourceMapFilename is not set and sourceMapURL is not set, - // derive it from the output filename (if available) or input filename - if (sourceMapOpts.sourceMapOutputFilename) { - // Use output filename + .map - sourceMapOpts.sourceMapFilename = sourceMapOpts.sourceMapOutputFilename + '.map'; - } else if (options.filename) { - // Fallback to input filename + .css.map - const inputBase = options.filename.replace(/\.[^/.]+$/, ''); - sourceMapOpts.sourceMapFilename = inputBase + '.css.map'; - } - } - - // Default sourceMapOutputFilename if not set - if (!sourceMapOpts.sourceMapOutputFilename) { - if (options.filename) { - const inputBase = options.filename.replace(/\.[^/.]+$/, ''); - sourceMapOpts.sourceMapOutputFilename = inputBase + '.css'; - } else { - sourceMapOpts.sourceMapOutputFilename = 'output.css'; - } - } - - sourceMapBuilder = new SourceMapBuilder(sourceMapOpts); - result.css = sourceMapBuilder.toCSS(evaldRoot, toCSSOptions, this.imports); - } else { - result.css = evaldRoot.toCSS(toCSSOptions); - } - } catch (e) { - throw new LessError(e, this.imports); - } - - if (options.pluginManager) { - const postProcessors = options.pluginManager.getPostProcessors(); - for (let i = 0; i < postProcessors.length; i++) { - result.css = postProcessors[i].process(result.css, { sourceMap: sourceMapBuilder, options, imports: this.imports }); - } - } - if (options.sourceMap) { - result.map = sourceMapBuilder.getExternalSourceMap(); - } - - result.imports = []; - for (const file in this.imports.files) { - if (Object.prototype.hasOwnProperty.call(this.imports.files, file) && file !== this.imports.rootFilename) { - result.imports.push(file); - } - } - return result; - } - } - - return ParseTree; -} diff --git a/packages/less/src/less/parse.js b/packages/less/src/less/parse.js deleted file mode 100644 index 9a27e6155a..0000000000 --- a/packages/less/src/less/parse.js +++ /dev/null @@ -1,87 +0,0 @@ -import contexts from './contexts'; -import Parser from './parser/parser'; -import PluginManager from './plugin-manager'; -import LessError from './less-error'; -import * as utils from './utils'; - -export default function(environment, ParseTree, ImportManager) { - const parse = function (input, options, callback) { - - if (typeof options === 'function') { - callback = options; - options = utils.copyOptions(this.options, {}); - } - else { - options = utils.copyOptions(this.options, options || {}); - } - - if (!callback) { - const self = this; - return new Promise(function (resolve, reject) { - parse.call(self, input, options, function(err, output) { - if (err) { - reject(err); - } else { - resolve(output); - } - }); - }); - } else { - let context; - let rootFileInfo; - const pluginManager = new PluginManager(this, !options.reUsePluginManager); - - options.pluginManager = pluginManager; - - context = new contexts.Parse(options); - - if (options.rootFileInfo) { - rootFileInfo = options.rootFileInfo; - } else { - const filename = options.filename || 'input'; - const entryPath = filename.replace(/[^/\\]*$/, ''); - rootFileInfo = { - filename, - rewriteUrls: context.rewriteUrls, - rootpath: context.rootpath || '', - currentDirectory: entryPath, - entryPath, - rootFilename: filename - }; - // add in a missing trailing slash - if (rootFileInfo.rootpath && rootFileInfo.rootpath.slice(-1) !== '/') { - rootFileInfo.rootpath += '/'; - } - } - - const imports = new ImportManager(this, context, rootFileInfo); - this.importManager = imports; - - // TODO: allow the plugins to be just a list of paths or names - // Do an async plugin queue like lessc - - if (options.plugins) { - options.plugins.forEach(function(plugin) { - let evalResult, contents; - if (plugin.fileContent) { - contents = plugin.fileContent.replace(/^\uFEFF/, ''); - evalResult = pluginManager.Loader.evalPlugin(contents, context, imports, plugin.options, plugin.filename); - if (evalResult instanceof LessError) { - return callback(evalResult); - } - } - else { - pluginManager.addPlugin(plugin); - } - }); - } - - new Parser(context, imports, rootFileInfo) - .parse(input, function (e, root) { - if (e) { return callback(e); } - callback(null, root, imports, options); - }, options); - } - }; - return parse; -} diff --git a/packages/less/src/less/parser/parser-input.js b/packages/less/src/less/parser/parser-input.js deleted file mode 100644 index 4129daede6..0000000000 --- a/packages/less/src/less/parser/parser-input.js +++ /dev/null @@ -1,380 +0,0 @@ -export default () => { - let // Less input string - input; - - let // current chunk - j; - - const // holds state for backtracking - saveStack = []; - - let // furthest index the parser has gone to - furthest; - - let // if this is furthest we got to, this is the probably cause - furthestPossibleErrorMessage; - - let // chunkified input - chunks; - - let // current chunk - current; - - let // index of current chunk, in `input` - currentPos; - - const parserInput = {}; - const CHARCODE_SPACE = 32; - const CHARCODE_TAB = 9; - const CHARCODE_LF = 10; - const CHARCODE_CR = 13; - const CHARCODE_PLUS = 43; - const CHARCODE_COMMA = 44; - const CHARCODE_FORWARD_SLASH = 47; - const CHARCODE_9 = 57; - - function skipWhitespace(length) { - const oldi = parserInput.i; - const oldj = j; - const curr = parserInput.i - currentPos; - const endIndex = parserInput.i + current.length - curr; - const mem = (parserInput.i += length); - const inp = input; - let c; - let nextChar; - let comment; - - for (; parserInput.i < endIndex; parserInput.i++) { - c = inp.charCodeAt(parserInput.i); - - if (parserInput.autoCommentAbsorb && c === CHARCODE_FORWARD_SLASH) { - nextChar = inp.charAt(parserInput.i + 1); - if (nextChar === '/') { - comment = {index: parserInput.i, isLineComment: true}; - let nextNewLine = inp.indexOf('\n', parserInput.i + 2); - if (nextNewLine < 0) { - nextNewLine = endIndex; - } - parserInput.i = nextNewLine; - comment.text = inp.substr(comment.index, parserInput.i - comment.index); - parserInput.commentStore.push(comment); - continue; - } else if (nextChar === '*') { - const nextStarSlash = inp.indexOf('*/', parserInput.i + 2); - if (nextStarSlash >= 0) { - comment = { - index: parserInput.i, - text: inp.substr(parserInput.i, nextStarSlash + 2 - parserInput.i), - isLineComment: false - }; - parserInput.i += comment.text.length - 1; - parserInput.commentStore.push(comment); - continue; - } - } - break; - } - - if ((c !== CHARCODE_SPACE) && (c !== CHARCODE_LF) && (c !== CHARCODE_TAB) && (c !== CHARCODE_CR)) { - break; - } - } - - current = current.slice(length + parserInput.i - mem + curr); - currentPos = parserInput.i; - - if (!current.length) { - if (j < chunks.length - 1) { - current = chunks[++j]; - skipWhitespace(0); // skip space at the beginning of a chunk - return true; // things changed - } - parserInput.finished = true; - } - - return oldi !== parserInput.i || oldj !== j; - } - - parserInput.save = () => { - currentPos = parserInput.i; - saveStack.push( { current, i: parserInput.i, j }); - }; - parserInput.restore = possibleErrorMessage => { - - if (parserInput.i > furthest || (parserInput.i === furthest && possibleErrorMessage && !furthestPossibleErrorMessage)) { - furthest = parserInput.i; - furthestPossibleErrorMessage = possibleErrorMessage; - } - const state = saveStack.pop(); - current = state.current; - currentPos = parserInput.i = state.i; - j = state.j; - }; - parserInput.forget = () => { - saveStack.pop(); - }; - parserInput.isWhitespace = offset => { - const pos = parserInput.i + (offset || 0); - const code = input.charCodeAt(pos); - return (code === CHARCODE_SPACE || code === CHARCODE_CR || code === CHARCODE_TAB || code === CHARCODE_LF); - }; - - // Specialization of $(tok) - parserInput.$re = tok => { - if (parserInput.i > currentPos) { - current = current.slice(parserInput.i - currentPos); - currentPos = parserInput.i; - } - - const m = tok.exec(current); - if (!m) { - return null; - } - - skipWhitespace(m[0].length); - if (typeof m === 'string') { - return m; - } - - return m.length === 1 ? m[0] : m; - }; - - parserInput.$char = tok => { - if (input.charAt(parserInput.i) !== tok) { - return null; - } - skipWhitespace(1); - return tok; - }; - - parserInput.$peekChar = tok => { - if (input.charAt(parserInput.i) !== tok) { - return null; - } - return tok; - }; - - parserInput.$str = tok => { - const tokLength = tok.length; - - // https://jsperf.com/string-startswith/21 - for (let i = 0; i < tokLength; i++) { - if (input.charAt(parserInput.i + i) !== tok.charAt(i)) { - return null; - } - } - - skipWhitespace(tokLength); - return tok; - }; - - parserInput.$quoted = loc => { - const pos = loc || parserInput.i; - const startChar = input.charAt(pos); - - if (startChar !== '\'' && startChar !== '"') { - return; - } - const length = input.length; - const currentPosition = pos; - - for (let i = 1; i + currentPosition < length; i++) { - const nextChar = input.charAt(i + currentPosition); - switch (nextChar) { - case '\\': - i++; - continue; - case '\r': - case '\n': - break; - case startChar: { - const str = input.substr(currentPosition, i + 1); - if (!loc && loc !== 0) { - skipWhitespace(i + 1); - return str - } - return [startChar, str]; - } - default: - } - } - return null; - }; - - /** - * Permissive parsing. Ignores everything except matching {} [] () and quotes - * until matching token (outside of blocks) - */ - parserInput.$parseUntil = tok => { - let quote = ''; - let returnVal = null; - let inComment = false; - let blockDepth = 0; - const blockStack = []; - const parseGroups = []; - const length = input.length; - const startPos = parserInput.i; - let lastPos = parserInput.i; - let i = parserInput.i; - let loop = true; - let testChar; - - if (typeof tok === 'string') { - testChar = char => char === tok - } else { - testChar = char => tok.test(char) - } - - do { - let nextChar = input.charAt(i); - if (blockDepth === 0 && testChar(nextChar)) { - returnVal = input.substr(lastPos, i - lastPos); - if (returnVal) { - parseGroups.push(returnVal); - } - else { - parseGroups.push(' '); - } - returnVal = parseGroups; - skipWhitespace(i - startPos); - loop = false - } else { - if (inComment) { - if (nextChar === '*' && - input.charAt(i + 1) === '/') { - i++; - blockDepth--; - inComment = false; - } - i++; - continue; - } - switch (nextChar) { - case '\\': - i++; - nextChar = input.charAt(i); - parseGroups.push(input.substr(lastPos, i - lastPos + 1)); - lastPos = i + 1; - break; - case '/': - if (input.charAt(i + 1) === '*') { - i++; - inComment = true; - blockDepth++; - } - break; - case '\'': - case '"': - quote = parserInput.$quoted(i); - if (quote) { - parseGroups.push(input.substr(lastPos, i - lastPos), quote); - i += quote[1].length - 1; - lastPos = i + 1; - } - else { - skipWhitespace(i - startPos); - returnVal = nextChar; - loop = false; - } - break; - case '{': - blockStack.push('}'); - blockDepth++; - break; - case '(': - blockStack.push(')'); - blockDepth++; - break; - case '[': - blockStack.push(']'); - blockDepth++; - break; - case '}': - case ')': - case ']': { - const expected = blockStack.pop(); - if (nextChar === expected) { - blockDepth--; - } else { - // move the parser to the error and return expected - skipWhitespace(i - startPos); - returnVal = expected; - loop = false; - } - } - } - i++; - if (i > length) { - loop = false; - } - } - } while (loop); - - return returnVal ? returnVal : null; - } - - parserInput.autoCommentAbsorb = true; - parserInput.commentStore = []; - parserInput.finished = false; - - // Same as $(), but don't change the state of the parser, - // just return the match. - parserInput.peek = tok => { - if (typeof tok === 'string') { - // https://jsperf.com/string-startswith/21 - for (let i = 0; i < tok.length; i++) { - if (input.charAt(parserInput.i + i) !== tok.charAt(i)) { - return false; - } - } - return true; - } else { - return tok.test(current); - } - }; - - // Specialization of peek() - // TODO remove or change some currentChar calls to peekChar - parserInput.peekChar = tok => input.charAt(parserInput.i) === tok; - - parserInput.currentChar = () => input.charAt(parserInput.i); - - parserInput.prevChar = () => input.charAt(parserInput.i - 1); - - parserInput.getInput = () => input; - - parserInput.peekNotNumeric = () => { - const c = input.charCodeAt(parserInput.i); - // Is the first char of the dimension 0-9, '.', '+' or '-' - return (c > CHARCODE_9 || c < CHARCODE_PLUS) || c === CHARCODE_FORWARD_SLASH || c === CHARCODE_COMMA; - }; - - parserInput.start = (str) => { - input = str; - parserInput.i = j = currentPos = furthest = 0; - - chunks = [str]; - current = chunks[0]; - - skipWhitespace(0); - }; - - parserInput.end = () => { - let message; - const isFinished = parserInput.i >= input.length; - - if (parserInput.i < furthest) { - message = furthestPossibleErrorMessage; - parserInput.i = furthest; - } - return { - isFinished, - furthest: parserInput.i, - furthestPossibleErrorMessage: message, - furthestReachedEnd: parserInput.i >= input.length - 1, - furthestChar: input[parserInput.i] - }; - }; - - return parserInput; -}; diff --git a/packages/less/src/less/parser/parser.js b/packages/less/src/less/parser/parser.js deleted file mode 100644 index 4d3b0c7081..0000000000 --- a/packages/less/src/less/parser/parser.js +++ /dev/null @@ -1,2662 +0,0 @@ -import LessError from '../less-error'; -import tree from '../tree'; -import visitors from '../visitors'; -import getParserInput from './parser-input'; -import * as utils from '../utils'; -import functionRegistry from '../functions/function-registry'; -import { ContainerSyntaxOptions, MediaSyntaxOptions } from '../tree/atrule-syntax'; -import logger from '../logger'; -import Selector from '../tree/selector'; -import Anonymous from '../tree/anonymous'; - -// -// less.js - parser -// -// A relatively straight-forward predictive parser. -// There is no tokenization/lexing stage, the input is parsed -// in one sweep. -// -// To make the parser fast enough to run in the browser, several -// optimization had to be made: -// -// - Matching and slicing on a huge input is often cause of slowdowns. -// The solution is to chunkify the input into smaller strings. -// The chunks are stored in the `chunks` var, -// `j` holds the current chunk index, and `currentPos` holds -// the index of the current chunk in relation to `input`. -// This gives us an almost 4x speed-up. -// -// - In many cases, we don't need to match individual tokens; -// for example, if a value doesn't hold any variables, operations -// or dynamic references, the parser can effectively 'skip' it, -// treating it as a literal. -// An example would be '1px solid #000' - which evaluates to itself, -// we don't need to know what the individual components are. -// The drawback, of course is that you don't get the benefits of -// syntax-checking on the CSS. This gives us a 50% speed-up in the parser, -// and a smaller speed-up in the code-gen. -// -// -// Token matching is done with the `$` function, which either takes -// a terminal string or regexp, or a non-terminal function to call. -// It also takes care of moving all the indices forwards. -// - -const Parser = function Parser(context, imports, fileInfo, currentIndex) { - currentIndex = currentIndex || 0; - let parsers; - const parserInput = getParserInput(); - - function error(msg, type) { - throw new LessError( - { - index: parserInput.i, - filename: fileInfo.filename, - type: type || 'Syntax', - message: msg - }, - imports - ); - } - - /** - * - * @param {string} msg - * @param {number} index - * @param {string} type - */ - function warn(msg, index, type) { - if (!context.quiet) { - logger.warn( - (new LessError( - { - index: index ?? parserInput.i, - filename: fileInfo.filename, - type: type ? `${type.toUpperCase()} WARNING` : 'WARNING', - message: msg - }, - imports - )).toString() - ); - } - } - - function expect(arg, msg) { - // some older browsers return typeof 'function' for RegExp - const result = (arg instanceof Function) ? arg.call(parsers) : parserInput.$re(arg); - if (result) { - return result; - } - - error(msg || (typeof arg === 'string' - ? `expected '${arg}' got '${parserInput.currentChar()}'` - : 'unexpected token')); - } - - // Specialization of expect() - function expectChar(arg, msg) { - if (parserInput.$char(arg)) { - return arg; - } - error(msg || `expected '${arg}' got '${parserInput.currentChar()}'`); - } - - function getDebugInfo(index) { - const filename = fileInfo.filename; - - return { - lineNumber: utils.getLocation(index, parserInput.getInput()).line + 1, - fileName: filename - }; - } - - /** - * Used after initial parsing to create nodes on the fly - * - * @param {String} str - string to parse - * @param {Array} parseList - array of parsers to run input through e.g. ["value", "important"] - * @param {Number} currentIndex - start number to begin indexing - * @param {Object} fileInfo - fileInfo to attach to created nodes - */ - function parseNode(str, parseList, callback) { - let result; - const returnNodes = []; - const parser = parserInput; - - try { - parser.start(str); - for (let x = 0, p; (p = parseList[x]); x++) { - result = parsers[p](); - returnNodes.push(result || null); - } - - const endInfo = parser.end(); - if (endInfo.isFinished) { - callback(null, returnNodes); - } - else { - callback(true, null); - } - } catch (e) { - throw new LessError({ - index: e.index + currentIndex, - message: e.message - }, imports, fileInfo.filename); - } - } - - // - // The Parser - // - return { - parserInput, - imports, - fileInfo, - parseNode, - // - // Parse an input string into an abstract syntax tree, - // @param str A string containing 'less' markup - // @param callback call `callback` when done. - // @param [additionalData] An optional map which can contains vars - a map (key, value) of variables to apply - // - parse: function (str, callback, additionalData) { - let root; - let err = null; - let globalVars; - let modifyVars; - let ignored; - let preText = ''; - - // Optionally disable @plugin parsing - if (additionalData && additionalData.disablePluginRule) { - parsers.plugin = function() { - var dir = parserInput.$re(/^@plugin?\s+/); - if (dir) { - error('@plugin statements are not allowed when disablePluginRule is set to true'); - } - } - } - - globalVars = (additionalData && additionalData.globalVars) ? `${Parser.serializeVars(additionalData.globalVars)}\n` : ''; - modifyVars = (additionalData && additionalData.modifyVars) ? `\n${Parser.serializeVars(additionalData.modifyVars)}` : ''; - - if (context.pluginManager) { - const preProcessors = context.pluginManager.getPreProcessors(); - for (let i = 0; i < preProcessors.length; i++) { - str = preProcessors[i].process(str, { context, imports, fileInfo }); - } - } - - if (globalVars || (additionalData && additionalData.banner)) { - preText = ((additionalData && additionalData.banner) ? additionalData.banner : '') + globalVars; - ignored = imports.contentsIgnoredChars; - ignored[fileInfo.filename] = ignored[fileInfo.filename] || 0; - ignored[fileInfo.filename] += preText.length; - } - - str = str.replace(/\r\n?/g, '\n'); - // Remove potential UTF Byte Order Mark - str = preText + str.replace(/^\uFEFF/, '') + modifyVars; - imports.contents[fileInfo.filename] = str; - - // Start with the primary rule. - // The whole syntax tree is held under a Ruleset node, - // with the `root` property set to true, so no `{}` are - // output. The callback is called when the input is parsed. - try { - parserInput.start(str); - - tree.Node.prototype.parse = this; - root = new tree.Ruleset(null, this.parsers.primary()); - tree.Node.prototype.rootNode = root; - root.root = true; - root.firstRoot = true; - root.functionRegistry = functionRegistry.inherit(); - - } catch (e) { - return callback(new LessError(e, imports, fileInfo.filename)); - } - - // If `i` is smaller than the `input.length - 1`, - // it means the parser wasn't able to parse the whole - // string, so we've got a parsing error. - // - // We try to extract a \n delimited string, - // showing the line where the parse error occurred. - // We split it up into two parts (the part which parsed, - // and the part which didn't), so we can color them differently. - const endInfo = parserInput.end(); - if (!endInfo.isFinished) { - - let message = endInfo.furthestPossibleErrorMessage; - - if (!message) { - message = 'Unrecognised input'; - if (endInfo.furthestChar === '}') { - message += '. Possibly missing opening \'{\''; - } else if (endInfo.furthestChar === ')') { - message += '. Possibly missing opening \'(\''; - } else if (endInfo.furthestReachedEnd) { - message += '. Possibly missing something'; - } - } - - err = new LessError({ - type: 'Parse', - message, - index: endInfo.furthest, - filename: fileInfo.filename - }, imports); - } - - const finish = e => { - e = err || e || imports.error; - - if (e) { - if (!(e instanceof LessError)) { - e = new LessError(e, imports, fileInfo.filename); - } - - return callback(e); - } - else { - return callback(null, root); - } - }; - - if (context.processImports !== false) { - new visitors.ImportVisitor(imports, finish) - .run(root); - } else { - return finish(); - } - }, - - // - // Here in, the parsing rules/functions - // - // The basic structure of the syntax tree generated is as follows: - // - // Ruleset -> Declaration -> Value -> Expression -> Entity - // - // Here's some Less code: - // - // .class { - // color: #fff; - // border: 1px solid #000; - // width: @w + 4px; - // > .child {...} - // } - // - // And here's what the parse tree might look like: - // - // Ruleset (Selector '.class', [ - // Declaration ("color", Value ([Expression [Color #fff]])) - // Declaration ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]])) - // Declaration ("width", Value ([Expression [Operation " + " [Variable "@w"][Dimension 4px]]])) - // Ruleset (Selector [Element '>', '.child'], [...]) - // ]) - // - // In general, most rules will try to parse a token with the `$re()` function, and if the return - // value is truly, will return a new node, of the relevant type. Sometimes, we need to check - // first, before parsing, that's when we use `peek()`. - // - parsers: parsers = { - // - // The `primary` rule is the *entry* and *exit* point of the parser. - // The rules here can appear at any level of the parse tree. - // - // The recursive nature of the grammar is an interplay between the `block` - // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule, - // as represented by this simplified grammar: - // - // primary → (ruleset | declaration)+ - // ruleset → selector+ block - // block → '{' primary '}' - // - // Only at one point is the primary rule not called from the - // block rule: at the root level. - // - primary: function () { - const mixin = this.mixin; - let root = []; - let node; - - while (true) { - while (true) { - node = this.comment(); - if (!node) { break; } - root.push(node); - } - // always process comments before deciding if finished - if (parserInput.finished) { - break; - } - if (parserInput.peek('}')) { - break; - } - - node = this.extendRule(); - if (node) { - root = root.concat(node); - continue; - } - - node = mixin.definition() || this.declaration() || mixin.call(false, false) || - this.ruleset() || this.variableCall() || this.entities.call() || this.atrule(); - if (node) { - root.push(node); - } else { - let foundSemiColon = false; - while (parserInput.$char(';')) { - foundSemiColon = true; - } - if (!foundSemiColon) { - break; - } - } - } - - return root; - }, - - // comments are collected by the main parsing mechanism and then assigned to nodes - // where the current structure allows it - comment: function () { - if (parserInput.commentStore.length) { - const comment = parserInput.commentStore.shift(); - return new(tree.Comment)(comment.text, comment.isLineComment, comment.index + currentIndex, fileInfo); - } - }, - - // - // Entities are tokens which can be found inside an Expression - // - entities: { - mixinLookup: function() { - return parsers.mixin.call(true, true); - }, - // - // A string, which supports escaping " and ' - // - // "milky way" 'he\'s the one!' - // - quoted: function (forceEscaped) { - let str; - const index = parserInput.i; - let isEscaped = false; - - parserInput.save(); - if (parserInput.$char('~')) { - isEscaped = true; - } else if (forceEscaped) { - parserInput.restore(); - return; - } - - str = parserInput.$quoted(); - if (!str) { - parserInput.restore(); - return; - } - parserInput.forget(); - - return new(tree.Quoted)(str.charAt(0), str.substr(1, str.length - 2), isEscaped, index + currentIndex, fileInfo); - }, - - // - // A catch-all word, such as: - // - // black border-collapse - // - keyword: function () { - const k = parserInput.$char('%') || parserInput.$re(/^\[?(?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+\]?/); - if (k) { - return tree.Color.fromKeyword(k) || new(tree.Keyword)(k); - } - }, - - // - // A function call - // - // rgb(255, 0, 255) - // - // The arguments are parsed with the `entities.arguments` parser. - // - call: function () { - let name; - let args; - let func; - const index = parserInput.i; - - // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 - if (parserInput.peek(/^url\(/i)) { - return; - } - - parserInput.save(); - - name = parserInput.$re(/^([\w-]+|%|~|progid:[\w.]+)\(/); - if (!name) { - parserInput.forget(); - return; - } - - name = name[1]; - func = this.customFuncCall(name); - if (func) { - args = func.parse(); - if (args && func.stop) { - parserInput.forget(); - return args; - } - } - - args = this.arguments(args); - - if (!parserInput.$char(')')) { - parserInput.restore('Could not parse call arguments or missing \')\''); - return; - } - - parserInput.forget(); - - return new(tree.Call)(name, args, index + currentIndex, fileInfo); - }, - - declarationCall: function () { - let validCall; - let args; - const index = parserInput.i; - - parserInput.save(); - - validCall = parserInput.$re(/^[\w]+\(/); - if (!validCall) { - parserInput.forget(); - return; - } - - validCall = validCall.substring(0, validCall.length - 1); - - let rule = this.ruleProperty(); - let value; - - if (rule) { - value = this.value(); - } - - if (rule && value) { - args = [new (tree.Declaration)(rule, value, null, null, parserInput.i + currentIndex, fileInfo, true)]; - } - - if (!parserInput.$char(')')) { - parserInput.restore('Could not parse call arguments or missing \')\''); - return; - } - - parserInput.forget(); - - return new(tree.Call)(validCall, args, index + currentIndex, fileInfo); - }, - - // - // Parsing rules for functions with non-standard args, e.g.: - // - // boolean(not(2 > 1)) - // - // This is a quick prototype, to be modified/improved when - // more custom-parsed funcs come (e.g. `selector(...)`) - // - - customFuncCall: function (name) { - /* Ideally the table is to be moved out of here for faster perf., - but it's quite tricky since it relies on all these `parsers` - and `expect` available only here */ - return { - alpha: f(parsers.ieAlpha, true), - boolean: f(condition), - 'if': f(condition) - }[name.toLowerCase()]; - - function f(parse, stop) { - return { - parse, // parsing function - stop // when true - stop after parse() and return its result, - // otherwise continue for plain args - }; - } - - function condition() { - return [expect(parsers.condition, 'expected condition')]; - } - }, - - arguments: function (prevArgs) { - let argsComma = prevArgs || []; - const argsSemiColon = []; - let isSemiColonSeparated; - let value; - - parserInput.save(); - - while (true) { - if (prevArgs) { - prevArgs = false; - } else { - value = parsers.detachedRuleset() || this.assignment() || parsers.expression(); - if (!value) { - break; - } - - if (value.value && value.value.length == 1) { - value = value.value[0]; - } - - argsComma.push(value); - } - - if (parserInput.$char(',')) { - continue; - } - - if (parserInput.$char(';') || isSemiColonSeparated) { - isSemiColonSeparated = true; - value = (argsComma.length < 1) ? argsComma[0] - : new tree.Value(argsComma); - argsSemiColon.push(value); - argsComma = []; - } - } - - parserInput.forget(); - return isSemiColonSeparated ? argsSemiColon : argsComma; - }, - literal: function () { - return this.dimension() || - this.color() || - this.quoted() || - this.unicodeDescriptor(); - }, - - // Assignments are argument entities for calls. - // They are present in ie filter properties as shown below. - // - // filter: progid:DXImageTransform.Microsoft.Alpha( *opacity=50* ) - // - - assignment: function () { - let key; - let value; - parserInput.save(); - key = parserInput.$re(/^\w+(?=\s?=)/i); - if (!key) { - parserInput.restore(); - return; - } - if (!parserInput.$char('=')) { - parserInput.restore(); - return; - } - value = parsers.entity(); - if (value) { - parserInput.forget(); - return new(tree.Assignment)(key, value); - } else { - parserInput.restore(); - } - }, - - // - // Parse url() tokens - // - // We use a specific rule for urls, because they don't really behave like - // standard function calls. The difference is that the argument doesn't have - // to be enclosed within a string, so it can't be parsed as an Expression. - // - url: function () { - let value; - const index = parserInput.i; - - parserInput.autoCommentAbsorb = false; - - if (!parserInput.$str('url(')) { - parserInput.autoCommentAbsorb = true; - return; - } - - value = this.quoted() || this.variable() || this.property() || - parserInput.$re(/^(?:(?:\\[()'"])|[^()'"])+/) || ''; - - parserInput.autoCommentAbsorb = true; - - expectChar(')'); - - return new(tree.URL)((value.value !== undefined || - value instanceof tree.Variable || - value instanceof tree.Property) ? - value : new(tree.Anonymous)(value, index), index + currentIndex, fileInfo); - }, - - // - // A Variable entity, such as `@fink`, in - // - // width: @fink + 2px - // - // We use a different parser for variable definitions, - // see `parsers.variable`. - // - variable: function () { - let ch; - let name; - const index = parserInput.i; - - parserInput.save(); - if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^@@?[\w-]+/))) { - ch = parserInput.currentChar(); - if (ch === '(' || ch === '[' && !parserInput.prevChar().match(/^\s/)) { - // this may be a VariableCall lookup - const result = parsers.variableCall(name); - if (result) { - parserInput.forget(); - return result; - } - } - parserInput.forget(); - return new(tree.Variable)(name, index + currentIndex, fileInfo); - } - parserInput.restore(); - }, - - // A variable entity using the protective {} e.g. @{var} - variableCurly: function () { - let curly; - const index = parserInput.i; - - if (parserInput.currentChar() === '@' && (curly = parserInput.$re(/^@\{([\w-]+)\}/))) { - return new(tree.Variable)(`@${curly[1]}`, index + currentIndex, fileInfo); - } - }, - // - // A Property accessor, such as `$color`, in - // - // background-color: $color - // - property: function () { - let name; - const index = parserInput.i; - - if (parserInput.currentChar() === '$' && (name = parserInput.$re(/^\$[\w-]+/))) { - return new(tree.Property)(name, index + currentIndex, fileInfo); - } - }, - - // A property entity useing the protective {} e.g. ${prop} - propertyCurly: function () { - let curly; - const index = parserInput.i; - - if (parserInput.currentChar() === '$' && (curly = parserInput.$re(/^\$\{([\w-]+)\}/))) { - return new(tree.Property)(`$${curly[1]}`, index + currentIndex, fileInfo); - } - }, - // - // A Hexadecimal color - // - // #4F3C2F - // - // `rgb` and `hsl` colors are parsed through the `entities.call` parser. - // - color: function () { - let rgb; - parserInput.save(); - - if (parserInput.currentChar() === '#' && (rgb = parserInput.$re(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})([\w.#[])?/))) { - if (!rgb[2]) { - parserInput.forget(); - return new(tree.Color)(rgb[1], undefined, rgb[0]); - } - } - parserInput.restore(); - }, - - colorKeyword: function () { - parserInput.save(); - const autoCommentAbsorb = parserInput.autoCommentAbsorb; - parserInput.autoCommentAbsorb = false; - const k = parserInput.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/); - parserInput.autoCommentAbsorb = autoCommentAbsorb; - if (!k) { - parserInput.forget(); - return; - } - parserInput.restore(); - const color = tree.Color.fromKeyword(k); - if (color) { - parserInput.$str(k); - return color; - } - }, - - // - // A Dimension, that is, a number and a unit - // - // 0.5em 95% - // - dimension: function () { - if (parserInput.peekNotNumeric()) { - return; - } - - const value = parserInput.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i); - if (value) { - return new(tree.Dimension)(value[1], value[2]); - } - }, - - // - // A unicode descriptor, as is used in unicode-range - // - // U+0?? or U+00A1-00A9 - // - unicodeDescriptor: function () { - let ud; - - ud = parserInput.$re(/^U\+[0-9a-fA-F?]+(-[0-9a-fA-F?]+)?/); - if (ud) { - return new(tree.UnicodeDescriptor)(ud[0]); - } - }, - - // - // JavaScript code to be evaluated - // - // `window.location.href` - // - javascript: function () { - let js; - const index = parserInput.i; - - parserInput.save(); - - const escape = parserInput.$char('~'); - const jsQuote = parserInput.$char('`'); - - if (!jsQuote) { - parserInput.restore(); - return; - } - - js = parserInput.$re(/^[^`]*`/); - if (js) { - parserInput.forget(); - return new(tree.JavaScript)(js.substr(0, js.length - 1), Boolean(escape), index + currentIndex, fileInfo); - } - parserInput.restore('invalid javascript definition'); - } - }, - - // - // The variable part of a variable definition. Used in the `rule` parser - // - // @fink: - // - variable: function () { - let name; - - if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^(@[\w-]+)\s*:/))) { return name[1]; } - }, - - // - // Call a variable value to retrieve a detached ruleset - // or a value from a detached ruleset's rules. - // - // @fink(); - // @fink; - // color: @fink[@color]; - // - variableCall: function (parsedName) { - let lookups; - const i = parserInput.i; - const inValue = !!parsedName; - let name = parsedName; - - parserInput.save(); - - if (name || (parserInput.currentChar() === '@' - && (name = parserInput.$re(/^(@[\w-]+)(\(\s*\))?/)))) { - - lookups = this.mixin.ruleLookups(); - - if (!lookups && ((inValue && parserInput.$str('()') !== '()') || (name[2] !== '()'))) { - parserInput.restore('Missing \'[...]\' lookup in variable call'); - return; - } - - if (!inValue) { - name = name[1]; - } - - const call = new tree.VariableCall(name, i, fileInfo); - if (!inValue && parsers.end()) { - parserInput.forget(); - return call; - } - else { - parserInput.forget(); - return new tree.NamespaceValue(call, lookups, i, fileInfo); - } - } - - parserInput.restore(); - }, - - // - // extend syntax - used to extend selectors - // - extend: function(isRule) { - let elements; - let e; - const index = parserInput.i; - let option; - let extendList; - let extend; - - if (!parserInput.$str(isRule ? '&:extend(' : ':extend(')) { - return; - } - - do { - option = null; - elements = null; - let first = true; - while (!(option = parserInput.$re(/^(!?all)(?=\s*(\)|,))/))) { - e = this.element(); - - if (!e) { - break; - } - /** - * @note - This will not catch selectors in pseudos like :is() and :where() because - * they don't currently parse their contents as selectors. - */ - if (!first && e.combinator.value) { - warn('Targeting complex selectors can have unexpected behavior, and this behavior may change in the future.', index) - } - - first = false; - if (elements) { - elements.push(e); - } else { - elements = [ e ]; - } - } - - option = option && option[1]; - if (!elements) { - error('Missing target selector for :extend().'); - } - extend = new(tree.Extend)(new(tree.Selector)(elements), option, index + currentIndex, fileInfo); - if (extendList) { - extendList.push(extend); - } else { - extendList = [ extend ]; - } - } while (parserInput.$char(',')); - - expect(/^\)/); - - if (isRule) { - expect(/^;/); - } - - return extendList; - }, - - // - // extendRule - used in a rule to extend all the parent selectors - // - extendRule: function() { - return this.extend(true); - }, - - // - // Mixins - // - mixin: { - // - // A Mixin call, with an optional argument list - // - // #mixins > .square(#fff); - // #mixins.square(#fff); - // .rounded(4px, black); - // .button; - // - // We can lookup / return a value using the lookup syntax: - // - // color: #mixin.square(#fff)[@color]; - // - // The `while` loop is there because mixins can be - // namespaced, but we only support the child and descendant - // selector for now. - // - call: function (inValue, getLookup) { - const s = parserInput.currentChar(); - let important = false; - let lookups; - const index = parserInput.i; - let elements; - let args; - let hasParens; - let parensIndex; - let parensWS = false; - - if (s !== '.' && s !== '#') { return; } - - parserInput.save(); // stop us absorbing part of an invalid selector - - elements = this.elements(); - - if (elements) { - parensIndex = parserInput.i; - if (parserInput.$char('(')) { - parensWS = parserInput.isWhitespace(-2); - args = this.args(true).args; - expectChar(')'); - hasParens = true; - if (parensWS) { - warn('Whitespace between a mixin name and parentheses for a mixin call is deprecated', parensIndex, 'DEPRECATED'); - } - } - - if (getLookup !== false) { - lookups = this.ruleLookups(); - } - if (getLookup === true && !lookups) { - parserInput.restore(); - return; - } - - if (inValue && !lookups && !hasParens) { - // This isn't a valid in-value mixin call - parserInput.restore(); - return; - } - - if (!inValue && parsers.important()) { - important = true; - } - - if (inValue || parsers.end()) { - parserInput.forget(); - const mixin = new(tree.mixin.Call)(elements, args, index + currentIndex, fileInfo, !lookups && important); - if (lookups) { - return new tree.NamespaceValue(mixin, lookups); - } - else { - if (!hasParens) { - warn('Calling a mixin without parentheses is deprecated', parensIndex, 'DEPRECATED'); - } - return mixin; - } - } - } - - parserInput.restore(); - }, - /** - * Matching elements for mixins - * (Start with . or # and can have > ) - */ - elements: function() { - let elements; - let e; - let c; - let elem; - let elemIndex; - const re = /^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/; - while (true) { - elemIndex = parserInput.i; - e = parserInput.$re(re); - - if (!e) { - break; - } - elem = new(tree.Element)(c, e, false, elemIndex + currentIndex, fileInfo); - if (elements) { - elements.push(elem); - } else { - elements = [ elem ]; - } - c = parserInput.$char('>'); - } - return elements; - }, - args: function (isCall) { - const entities = parsers.entities; - const returner = { args:null, variadic: false }; - let expressions = []; - const argsSemiColon = []; - const argsComma = []; - let isSemiColonSeparated; - let expressionContainsNamed; - let name; - let nameLoop; - let value; - let arg; - let expand; - let hasSep = true; - - parserInput.save(); - - while (true) { - if (isCall) { - arg = parsers.detachedRuleset() || parsers.expression(); - } else { - parserInput.commentStore.length = 0; - if (parserInput.$str('...')) { - returner.variadic = true; - if (parserInput.$char(';') && !isSemiColonSeparated) { - isSemiColonSeparated = true; - } - (isSemiColonSeparated ? argsSemiColon : argsComma) - .push({ variadic: true }); - break; - } - arg = entities.variable() || entities.property() || entities.literal() || entities.keyword() || this.call(true); - } - - if (!arg || !hasSep) { - break; - } - - nameLoop = null; - if (arg.throwAwayComments) { - arg.throwAwayComments(); - } - value = arg; - let val = null; - - if (isCall) { - // Variable - if (arg.value && arg.value.length == 1) { - val = arg.value[0]; - } - } else { - val = arg; - } - - if (val && (val instanceof tree.Variable || val instanceof tree.Property)) { - if (parserInput.$char(':')) { - if (expressions.length > 0) { - if (isSemiColonSeparated) { - error('Cannot mix ; and , as delimiter types'); - } - expressionContainsNamed = true; - } - - value = parsers.detachedRuleset() || parsers.expression(); - - if (!value) { - if (isCall) { - error('could not understand value for named argument'); - } else { - parserInput.restore(); - returner.args = []; - return returner; - } - } - nameLoop = (name = val.name); - } else if (parserInput.$str('...')) { - if (!isCall) { - returner.variadic = true; - if (parserInput.$char(';') && !isSemiColonSeparated) { - isSemiColonSeparated = true; - } - (isSemiColonSeparated ? argsSemiColon : argsComma) - .push({ name: arg.name, variadic: true }); - break; - } else { - expand = true; - } - } else if (!isCall) { - name = nameLoop = val.name; - value = null; - } - } - - if (value) { - expressions.push(value); - } - - argsComma.push({ name:nameLoop, value, expand }); - - if (parserInput.$char(',')) { - hasSep = true; - continue; - } - hasSep = parserInput.$char(';') === ';'; - - if (hasSep || isSemiColonSeparated) { - - if (expressionContainsNamed) { - error('Cannot mix ; and , as delimiter types'); - } - - isSemiColonSeparated = true; - - if (expressions.length > 1) { - value = new(tree.Value)(expressions); - } - argsSemiColon.push({ name, value, expand }); - - name = null; - expressions = []; - expressionContainsNamed = false; - } - } - - parserInput.forget(); - returner.args = isSemiColonSeparated ? argsSemiColon : argsComma; - return returner; - }, - // - // A Mixin definition, with a list of parameters - // - // .rounded (@radius: 2px, @color) { - // ... - // } - // - // Until we have a finer grained state-machine, we have to - // do a look-ahead, to make sure we don't have a mixin call. - // See the `rule` function for more information. - // - // We start by matching `.rounded (`, and then proceed on to - // the argument list, which has optional default values. - // We store the parameters in `params`, with a `value` key, - // if there is a value, such as in the case of `@radius`. - // - // Once we've got our params list, and a closing `)`, we parse - // the `{...}` block. - // - definition: function () { - let name; - let params = []; - let match; - let ruleset; - let cond; - let variadic = false; - if ((parserInput.currentChar() !== '.' && parserInput.currentChar() !== '#') || - parserInput.peek(/^[^{]*\}/)) { - return; - } - - parserInput.save(); - - match = parserInput.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/); - if (match) { - name = match[1]; - - const argInfo = this.args(false); - params = argInfo.args; - variadic = argInfo.variadic; - - // .mixincall("@{a}"); - // looks a bit like a mixin definition.. - // also - // .mixincall(@a: {rule: set;}); - // so we have to be nice and restore - if (!parserInput.$char(')')) { - parserInput.restore('Missing closing \')\''); - return; - } - - parserInput.commentStore.length = 0; - - if (parserInput.$str('when')) { // Guard - cond = expect(parsers.conditions, 'expected condition'); - } - - ruleset = parsers.block(); - - if (ruleset) { - parserInput.forget(); - return new(tree.mixin.Definition)(name, params, ruleset, cond, variadic); - } else { - parserInput.restore(); - } - } else { - parserInput.restore(); - } - }, - - ruleLookups: function() { - let rule; - const lookups = []; - - if (parserInput.currentChar() !== '[') { - return; - } - - while (true) { - parserInput.save(); - rule = this.lookupValue(); - if (!rule && rule !== '') { - parserInput.restore(); - break; - } - lookups.push(rule); - parserInput.forget(); - } - if (lookups.length > 0) { - return lookups; - } - }, - - lookupValue: function() { - parserInput.save(); - - if (!parserInput.$char('[')) { - parserInput.restore(); - return; - } - - const name = parserInput.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/); - - if (!parserInput.$char(']')) { - parserInput.restore(); - return; - } - - if (name || name === '') { - parserInput.forget(); - return name; - } - - parserInput.restore(); - } - }, - // - // Entities are the smallest recognized token, - // and can be found inside a rule's value. - // - entity: function () { - const entities = this.entities; - - return this.comment() || entities.literal() || entities.variable() || entities.url() || - entities.property() || entities.call() || entities.keyword() || this.mixin.call(true) || - entities.javascript(); - }, - - // - // A Declaration terminator. Note that we use `peek()` to check for '}', - // because the `block` rule will be expecting it, but we still need to make sure - // it's there, if ';' was omitted. - // - end: function () { - return parserInput.$char(';') || parserInput.peek('}'); - }, - - // - // IE's alpha function - // - // alpha(opacity=88) - // - ieAlpha: function () { - let value; - - // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 - if (!parserInput.$re(/^opacity=/i)) { return; } - value = parserInput.$re(/^\d+/); - if (!value) { - value = expect(parsers.entities.variable, 'Could not parse alpha'); - value = `@{${value.name.slice(1)}}`; - } - expectChar(')'); - return new tree.Quoted('', `alpha(opacity=${value})`); - }, - - /** - * A Selector Element - * - * div - * + h1 - * #socks - * input[type="text"] - * - * Elements are the building blocks for Selectors, - * they are made out of a `Combinator` (see combinator rule), - * and an element name, such as a tag a class, or `*`. - */ - element: function () { - let e; - let c; - let v; - const index = parserInput.i; - - c = this.combinator(); - - /** This selector parser is quite simplistic and will pass a number of invalid selectors. */ - e = parserInput.$re(/^(?:\d+\.\d+|\d+)%/) || - // eslint-disable-next-line no-control-regex - parserInput.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/) || - parserInput.$char('*') || parserInput.$char('&') || this.attribute() || - parserInput.$re(/^\([^&()@]+\)/) || parserInput.$re(/^[.#:](?=@)/) || - this.entities.variableCurly(); - - if (!e) { - parserInput.save(); - if (parserInput.$char('(')) { - if ((v = this.selector(false))) { - let selectors = []; - while (parserInput.$char(',')) { - selectors.push(v); - selectors.push(new Anonymous(',')); - v = this.selector(false); - } - selectors.push(v); - - if (parserInput.$char(')')) { - if (selectors.length > 1) { - e = new (tree.Paren)(new Selector(selectors)); - } else { - e = new(tree.Paren)(v); - } - parserInput.forget(); - } else { - parserInput.restore('Missing closing \')\''); - } - } else { - parserInput.restore('Missing closing \')\''); - } - } else { - parserInput.forget(); - } - } - - if (e) { return new(tree.Element)(c, e, e instanceof tree.Variable, index + currentIndex, fileInfo); } - }, - - // - // Combinators combine elements together, in a Selector. - // - // Because our parser isn't white-space sensitive, special care - // has to be taken, when parsing the descendant combinator, ` `, - // as it's an empty space. We have to check the previous character - // in the input, to see if it's a ` ` character. More info on how - // we deal with this in *combinator.js*. - // - combinator: function () { - let c = parserInput.currentChar(); - - if (c === '/') { - parserInput.save(); - const slashedCombinator = parserInput.$re(/^\/[a-z]+\//i); - if (slashedCombinator) { - parserInput.forget(); - return new(tree.Combinator)(slashedCombinator); - } - parserInput.restore(); - } - - if (c === '>' || c === '+' || c === '~' || c === '|' || c === '^') { - parserInput.i++; - if (c === '^' && parserInput.currentChar() === '^') { - c = '^^'; - parserInput.i++; - } - while (parserInput.isWhitespace()) { parserInput.i++; } - return new(tree.Combinator)(c); - } else if (parserInput.isWhitespace(-1)) { - return new(tree.Combinator)(' '); - } else { - return new(tree.Combinator)(null); - } - }, - // - // A CSS Selector - // with less extensions e.g. the ability to extend and guard - // - // .class > div + h1 - // li a:hover - // - // Selectors are made out of one or more Elements, see above. - // - selector: function (isLess) { - const index = parserInput.i; - let elements; - let extendList; - let c; - let e; - let allExtends; - let when; - let condition; - isLess = isLess !== false; - while ((isLess && (extendList = this.extend())) || (isLess && (when = parserInput.$str('when'))) || (e = this.element())) { - if (when) { - condition = expect(this.conditions, 'expected condition'); - } else if (condition) { - error('CSS guard can only be used at the end of selector'); - } else if (extendList) { - if (allExtends) { - allExtends = allExtends.concat(extendList); - } else { - allExtends = extendList; - } - } else { - if (allExtends) { error('Extend can only be used at the end of selector'); } - c = parserInput.currentChar(); - if (Array.isArray(e)){ - e.forEach(ele => elements.push(ele)); - } if (elements) { - elements.push(e); - } else { - elements = [ e ]; - } - e = null; - } - if (c === '{' || c === '}' || c === ';' || c === ',' || c === ')') { - break; - } - } - - if (elements) { return new(tree.Selector)(elements, allExtends, condition, index + currentIndex, fileInfo); } - if (allExtends) { error('Extend must be used to extend a selector, it cannot be used on its own'); } - }, - selectors: function () { - let s; - let selectors; - while (true) { - s = this.selector(); - if (!s) { - break; - } - if (selectors) { - selectors.push(s); - } else { - selectors = [ s ]; - } - parserInput.commentStore.length = 0; - if (s.condition && selectors.length > 1) { - error('Guards are only currently allowed on a single selector.'); - } - if (!parserInput.$char(',')) { break; } - if (s.condition) { - error('Guards are only currently allowed on a single selector.'); - } - parserInput.commentStore.length = 0; - } - return selectors; - }, - attribute: function () { - if (!parserInput.$char('[')) { return; } - - const entities = this.entities; - let key; - let val; - let op; - // - // case-insensitive flag - // e.g. [attr operator value i] - // - let cif; - - if (!(key = entities.variableCurly())) { - key = expect(/^(?:[_A-Za-z0-9-*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/); - } - - op = parserInput.$re(/^[|~*$^]?=/); - if (op) { - val = entities.quoted() || parserInput.$re(/^[0-9]+%/) || parserInput.$re(/^[\w-]+/) || entities.variableCurly(); - if (val) { - cif = parserInput.$re(/^[iIsS]/); - } - } - - expectChar(']'); - - return new(tree.Attribute)(key, op, val, cif); - }, - - // - // The `block` rule is used by `ruleset` and `mixin.definition`. - // It's a wrapper around the `primary` rule, with added `{}`. - // - block: function () { - let content; - if (parserInput.$char('{') && (content = this.primary()) && parserInput.$char('}')) { - return content; - } - }, - - blockRuleset: function() { - let block = this.block(); - - if (block) { - block = new tree.Ruleset(null, block); - } - return block; - }, - - detachedRuleset: function() { - let argInfo; - let params; - let variadic; - - parserInput.save(); - if (parserInput.$re(/^[.#]\(/)) { - /** - * DR args currently only implemented for each() function, and not - * yet settable as `@dr: #(@arg) {}` - * This should be done when DRs are merged with mixins. - * See: https://github.com/less/less-meta/issues/16 - */ - argInfo = this.mixin.args(false); - params = argInfo.args; - variadic = argInfo.variadic; - if (!parserInput.$char(')')) { - parserInput.restore(); - return; - } - } - const blockRuleset = this.blockRuleset(); - if (blockRuleset) { - parserInput.forget(); - if (params) { - return new tree.mixin.Definition(null, params, blockRuleset, null, variadic); - } - return new tree.DetachedRuleset(blockRuleset); - } - parserInput.restore(); - }, - - // - // div, .class, body > p {...} - // - ruleset: function () { - let selectors; - let rules; - let debugInfo; - - parserInput.save(); - - if (context.dumpLineNumbers) { - debugInfo = getDebugInfo(parserInput.i); - } - - selectors = this.selectors(); - - if (selectors && (rules = this.block())) { - parserInput.forget(); - const ruleset = new(tree.Ruleset)(selectors, rules, context.strictImports); - if (context.dumpLineNumbers) { - ruleset.debugInfo = debugInfo; - } - return ruleset; - } else { - parserInput.restore(); - } - }, - declaration: function () { - let name; - let value; - const index = parserInput.i; - let hasDR; - const c = parserInput.currentChar(); - let important; - let merge; - let isVariable; - - if (c === '.' || c === '#' || c === '&' || c === ':') { return; } - - parserInput.save(); - - name = this.variable() || this.ruleProperty(); - if (name) { - isVariable = typeof name === 'string'; - - if (isVariable) { - value = this.detachedRuleset(); - if (value) { - hasDR = true; - } - } - - parserInput.commentStore.length = 0; - if (!value) { - // a name returned by this.ruleProperty() is always an array of the form: - // [string-1, ..., string-n, ""] or [string-1, ..., string-n, "+"] - // where each item is a tree.Keyword or tree.Variable - merge = !isVariable && name.length > 1 && name.pop().value; - - // Custom property values get permissive parsing - if (name[0].value && name[0].value.slice(0, 2) === '--') { - if (parserInput.$char(';')) { - value = new Anonymous(''); - } else { - value = this.permissiveValue(/[;}]/, true); - } - } - // Try to store values as anonymous - // If we need the value later we'll re-parse it in ruleset.parseValue - else { - value = this.anonymousValue(); - } - if (value) { - parserInput.forget(); - // anonymous values absorb the end ';' which is required for them to work - return new(tree.Declaration)(name, value, false, merge, index + currentIndex, fileInfo); - } - - if (!value) { - value = this.value(); - } - - if (value) { - important = this.important(); - } else if (isVariable) { - /** - * As a last resort, try permissiveValue - * - * @todo - This has created some knock-on problems of not - * flagging incorrect syntax or detecting user intent. - */ - value = this.permissiveValue(); - } - } - - if (value && (this.end() || hasDR)) { - parserInput.forget(); - return new(tree.Declaration)(name, value, important, merge, index + currentIndex, fileInfo); - } - else { - parserInput.restore(); - } - } else { - parserInput.restore(); - } - }, - anonymousValue: function () { - const index = parserInput.i; - const match = parserInput.$re(/^([^.#@$+/'"*`(;{}-]*);/); - if (match) { - return new(tree.Anonymous)(match[1], index + currentIndex); - } - }, - /** - * Used for custom properties, at-rules, and variables (as fallback) - * Parses almost anything inside of {} [] () "" blocks - * until it reaches outer-most tokens. - * - * First, it will try to parse comments and entities to reach - * the end. This is mostly like the Expression parser except no - * math is allowed. - * - * @param {RexExp} untilTokens - Characters to stop parsing at - */ - permissiveValue: function (untilTokens) { - let i; - let e; - let done; - let value; - const tok = untilTokens || ';'; - const index = parserInput.i; - const result = []; - - function testCurrentChar() { - const char = parserInput.currentChar(); - if (typeof tok === 'string') { - return char === tok; - } else { - return tok.test(char); - } - } - if (testCurrentChar()) { - return; - } - value = []; - do { - e = this.comment(); - if (e) { - value.push(e); - continue; - } - e = this.entity(); - if (e) { - value.push(e); - } - if (parserInput.peek(',')) { - value.push(new (tree.Anonymous)(',', parserInput.i)); - parserInput.$char(','); - } - } while (e); - - done = testCurrentChar(); - - if (value.length > 0) { - value = new(tree.Expression)(value); - if (done) { - return value; - } - else { - result.push(value); - } - // Preserve space before $parseUntil as it will not - if (parserInput.prevChar() === ' ') { - result.push(new tree.Anonymous(' ', index)); - } - } - parserInput.save(); - - value = parserInput.$parseUntil(tok); - - if (value) { - if (typeof value === 'string') { - error(`Expected '${value}'`, 'Parse'); - } - if (value.length === 1 && value[0] === ' ') { - parserInput.forget(); - return new tree.Anonymous('', index); - } - /** @type {string} */ - let item; - for (i = 0; i < value.length; i++) { - item = value[i]; - if (Array.isArray(item)) { - // Treat actual quotes as normal quoted values - result.push(new tree.Quoted(item[0], item[1], true, index, fileInfo)); - } - else { - if (i === value.length - 1) { - item = item.trim(); - } - // Treat like quoted values, but replace vars like unquoted expressions - const quote = new tree.Quoted('\'', item, true, index, fileInfo); - const variableRegex = /@([\w-]+)/g; - const propRegex = /\$([\w-]+)/g; - if (variableRegex.test(item)) { - warn('@[ident] in unknown values will not be evaluated as variables in the future. Use @{[ident]}', index, 'DEPRECATED'); - } - if (propRegex.test(item)) { - warn('$[ident] in unknown values will not be evaluated as property references in the future. Use ${[ident]}', index, 'DEPRECATED'); - } - quote.variableRegex = /@([\w-]+)|@{([\w-]+)}/g; - quote.propRegex = /\$([\w-]+)|\${([\w-]+)}/g; - result.push(quote); - } - } - parserInput.forget(); - return new tree.Expression(result, true); - } - parserInput.restore(); - }, - - // - // An @import atrule - // - // @import "lib"; - // - // Depending on our environment, importing is done differently: - // In the browser, it's an XHR request, in Node, it would be a - // file-system operation. The function used for importing is - // stored in `import`, which we pass to the Import constructor. - // - 'import': function () { - let path; - let features; - const index = parserInput.i; - - const dir = parserInput.$re(/^@import\s+/); - - if (dir) { - const options = (dir ? this.importOptions() : null) || {}; - - if ((path = this.entities.quoted() || this.entities.url())) { - features = this.mediaFeatures({}); - - if (!parserInput.$char(';')) { - parserInput.i = index; - error('missing semi-colon or unrecognised media features on import'); - } - features = features && new(tree.Value)(features); - return new(tree.Import)(path, features, options, index + currentIndex, fileInfo); - } - else { - parserInput.i = index; - error('malformed import statement'); - } - } - }, - - importOptions: function() { - let o; - const options = {}; - let optionName; - let value; - - // list of options, surrounded by parens - if (!parserInput.$char('(')) { return null; } - do { - o = this.importOption(); - if (o) { - optionName = o; - value = true; - switch (optionName) { - case 'css': - optionName = 'less'; - value = false; - break; - case 'once': - optionName = 'multiple'; - value = false; - break; - } - options[optionName] = value; - if (!parserInput.$char(',')) { break; } - } - } while (o); - expectChar(')'); - return options; - }, - - importOption: function() { - const opt = parserInput.$re(/^(less|css|multiple|once|inline|reference|optional)/); - if (opt) { - return opt[1]; - } - }, - - mediaFeature: function (syntaxOptions) { - const entities = this.entities; - const nodes = []; - let e; - let p; - let rangeP; - let spacing = false; - parserInput.save(); - do { - parserInput.save(); - if (parserInput.$re(/^[0-9a-z-]*\s+\(/)) { - spacing = true; - } - parserInput.restore(); - - e = entities.declarationCall.bind(this)() || entities.keyword() || entities.variable() || entities.mixinLookup() - if (e) { - nodes.push(e); - } else if (parserInput.$char('(')) { - p = this.property(); - parserInput.save(); - if (!p && syntaxOptions.queryInParens && parserInput.$re(/^[0-9a-z-]*\s*([<>]=|<=|>=|[<>]|=)/)) { - parserInput.restore(); - p = this.condition(); - - parserInput.save(); - rangeP = this.atomicCondition(null, p.rvalue); - if (!rangeP) { - parserInput.restore(); - } - } else { - parserInput.restore(); - e = this.value(); - } - if (parserInput.$char(')')) { - if (p && !e) { - nodes.push(new (tree.Paren)(new (tree.QueryInParens)(p.op, p.lvalue, p.rvalue, rangeP ? rangeP.op : null, rangeP ? rangeP.rvalue : null, p._index))); - e = p; - } else if (p && e) { - nodes.push(new (tree.Paren)(new (tree.Declaration)(p, e, null, null, parserInput.i + currentIndex, fileInfo, true))); - if (!spacing) { - nodes[nodes.length - 1].noSpacing = true; - } - spacing = false; - } else if (e) { - nodes.push(new(tree.Paren)(e)); - spacing = false; - } else { - error('badly formed media feature definition'); - } - } else { - error('Missing closing \')\'', 'Parse'); - } - } - } while (e); - - parserInput.forget(); - if (nodes.length > 0) { - return new(tree.Expression)(nodes); - } - }, - - mediaFeatures: function (syntaxOptions) { - const entities = this.entities; - const features = []; - let e; - do { - e = this.mediaFeature(syntaxOptions); - if (e) { - features.push(e); - if (!parserInput.$char(',')) { break; } - else if (!features[features.length - 1].noSpacing) { - features[features.length - 1].noSpacing = false; - } - } else { - e = entities.variable() || entities.mixinLookup(); - if (e) { - features.push(e); - if (!parserInput.$char(',')) { break; } - else if (!features[features.length - 1].noSpacing) { - features[features.length - 1].noSpacing = false; - } - } - } - } while (e); - - return features.length > 0 ? features : null; - }, - - prepareAndGetNestableAtRule: function (treeType, index, debugInfo, syntaxOptions) { - const features = this.mediaFeatures(syntaxOptions); - - const rules = this.block(); - - if (!rules) { - error('media definitions require block statements after any features'); - } - - parserInput.forget(); - - const atRule = new (treeType)(rules, features, index + currentIndex, fileInfo); - if (context.dumpLineNumbers) { - atRule.debugInfo = debugInfo; - } - - return atRule; - }, - - nestableAtRule: function () { - let debugInfo; - const index = parserInput.i; - - if (context.dumpLineNumbers) { - debugInfo = getDebugInfo(index); - } - parserInput.save(); - - if (parserInput.$peekChar('@')) { - if (parserInput.$str('@media')) { - return this.prepareAndGetNestableAtRule(tree.Media, index, debugInfo, MediaSyntaxOptions); - } - - if (parserInput.$str('@container')) { - return this.prepareAndGetNestableAtRule(tree.Container, index, debugInfo, ContainerSyntaxOptions); - } - } - - parserInput.restore(); - }, - - // - - // A @plugin directive, used to import plugins dynamically. - // - // @plugin (args) "lib"; - // - plugin: function () { - let path; - let args; - let options; - const index = parserInput.i; - const dir = parserInput.$re(/^@plugin\s+/); - - if (dir) { - args = this.pluginArgs(); - - if (args) { - options = { - pluginArgs: args, - isPlugin: true - }; - } - else { - options = { isPlugin: true }; - } - - if ((path = this.entities.quoted() || this.entities.url())) { - - if (!parserInput.$char(';')) { - parserInput.i = index; - error('missing semi-colon on @plugin'); - } - return new(tree.Import)(path, null, options, index + currentIndex, fileInfo); - } - else { - parserInput.i = index; - error('malformed @plugin statement'); - } - } - }, - - pluginArgs: function() { - // list of options, surrounded by parens - parserInput.save(); - if (!parserInput.$char('(')) { - parserInput.restore(); - return null; - } - const args = parserInput.$re(/^\s*([^);]+)\)\s*/); - if (args[1]) { - parserInput.forget(); - return args[1].trim(); - } - else { - parserInput.restore(); - return null; - } - }, - atruleUnknown: function (value, name, hasBlock) { - value = this.permissiveValue(/^[{;]/); - hasBlock = (parserInput.currentChar() === '{'); - if (!value) { - if (!hasBlock && parserInput.currentChar() !== ';') { - error(''.concat(name, ' rule is missing block or ending semi-colon')); - } - } - else if (!value.value) { - value = null; - } - return [value, hasBlock]; - }, - atruleBlock: function (rules, value, isRooted, isKeywordList) { - rules = this.blockRuleset(); - parserInput.save(); - if (!rules && !isRooted) { - value = this.entity(); - rules = this.blockRuleset(); - } - if (!rules && !isRooted) { - parserInput.restore(); - var e = []; - value = this.entity(); - while (parserInput.$char(',')) { - e.push(value); - value = this.entity(); - } - if (value && e.length > 0) { - e.push(value); - value = e; - isKeywordList = true; - } - else { - rules = this.blockRuleset(); - } - } - else { - parserInput.forget(); - } - - return [rules, value, isKeywordList]; - }, - // - // A CSS AtRule - // - // @charset "utf-8"; - // - atrule: function () { - const index = parserInput.i; - let name; - let value; - let rules; - let nonVendorSpecificName; - let hasIdentifier; - let hasExpression; - let hasUnknown; - let hasBlock = true; - let isRooted = true; - let isKeywordList = false; - - if (parserInput.currentChar() !== '@') { return; } - - value = this['import']() || this.plugin() || this.nestableAtRule(); - if (value) { - return value; - } - - parserInput.save(); - - name = parserInput.$re(/^@[a-z-]+/); - - if (!name) { return; } - - nonVendorSpecificName = name; - if (name.charAt(1) == '-' && name.indexOf('-', 2) > 0) { - nonVendorSpecificName = `@${name.slice(name.indexOf('-', 2) + 1)}`; - } - - switch (nonVendorSpecificName) { - case '@charset': - hasIdentifier = true; - hasBlock = false; - break; - case '@namespace': - hasExpression = true; - hasBlock = false; - break; - case '@keyframes': - case '@counter-style': - hasIdentifier = true; - break; - case '@document': - case '@supports': - hasUnknown = true; - isRooted = false; - break; - case '@starting-style': - isRooted = false; - break; - case '@layer': - isRooted = false; - break; - default: - hasUnknown = true; - break; - } - - parserInput.commentStore.length = 0; - - if (hasIdentifier) { - value = this.entity(); - if (!value) { - error(`expected ${name} identifier`); - } - } else if (hasExpression) { - value = this.expression(); - if (!value) { - error(`expected ${name} expression`); - } - } else if (hasUnknown) { - const unknownPackage = this.atruleUnknown(value, name, hasBlock); - value = unknownPackage[0]; - hasBlock = unknownPackage[1]; - } - - if (hasBlock) { - let blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList); - rules = blockPackage[0]; - value = blockPackage[1]; - isKeywordList = blockPackage[2]; - - if (!rules && !hasUnknown) { - parserInput.restore(); - name = parserInput.$re(/^@[a-z-]+/); - const unknownPackage = this.atruleUnknown(value, name, hasBlock); - value = unknownPackage[0]; - hasBlock = unknownPackage[1]; - if (hasBlock) { - blockPackage = this.atruleBlock(rules, value, isRooted, isKeywordList); - rules = blockPackage[0]; - value = blockPackage[1]; - isKeywordList = blockPackage[2]; - } - } - } - - if (rules || isKeywordList || (!hasBlock && value && parserInput.$char(';'))) { - parserInput.forget(); - return new(tree.AtRule)(name, value, rules, index + currentIndex, fileInfo, - context.dumpLineNumbers ? getDebugInfo(index) : null, - isRooted - ); - } - - parserInput.restore('at-rule options not recognised'); - }, - - // - // A Value is a comma-delimited list of Expressions - // - // font-family: Baskerville, Georgia, serif; - // - // In a Rule, a Value represents everything after the `:`, - // and before the `;`. - // - value: function () { - let e; - const expressions = []; - const index = parserInput.i; - - do { - e = this.expression(); - if (e) { - expressions.push(e); - if (!parserInput.$char(',')) { break; } - } - } while (e); - - if (expressions.length > 0) { - return new(tree.Value)(expressions, index + currentIndex); - } - }, - important: function () { - if (parserInput.currentChar() === '!') { - return parserInput.$re(/^! *important/); - } - }, - sub: function () { - let a; - let e; - - parserInput.save(); - if (parserInput.$char('(')) { - a = this.addition(); - if (a && parserInput.$char(')')) { - parserInput.forget(); - e = new(tree.Expression)([a]); - e.parens = true; - return e; - } - parserInput.restore('Expected \')\''); - return; - } - parserInput.restore(); - }, - colorOperand: function () { - parserInput.save(); - - // hsl or rgb or lch operand - const match = parserInput.$re(/^[lchrgbs]\s+/); - if (match) { - return new tree.Keyword(match[0]); - } - - parserInput.restore(); - }, - multiplication: function () { - let m; - let a; - let op; - let operation; - let isSpaced; - m = this.operand(); - if (m) { - isSpaced = parserInput.isWhitespace(-1); - while (true) { - if (parserInput.peek(/^\/[*/]/)) { - break; - } - - parserInput.save(); - - op = parserInput.$char('/') || parserInput.$char('*'); - if (!op) { - let index = parserInput.i; - op = parserInput.$str('./'); - if (op) { - warn('./ operator is deprecated', index, 'DEPRECATED'); - } - } - - if (!op) { parserInput.forget(); break; } - - a = this.operand(); - - if (!a) { parserInput.restore(); break; } - parserInput.forget(); - - m.parensInOp = true; - a.parensInOp = true; - operation = new(tree.Operation)(op, [operation || m, a], isSpaced); - isSpaced = parserInput.isWhitespace(-1); - } - return operation || m; - } - }, - addition: function () { - let m; - let a; - let op; - let operation; - let isSpaced; - m = this.multiplication(); - if (m) { - isSpaced = parserInput.isWhitespace(-1); - while (true) { - op = parserInput.$re(/^[-+]\s+/) || (!isSpaced && (parserInput.$char('+') || parserInput.$char('-'))); - if (!op) { - break; - } - a = this.multiplication(); - if (!a) { - break; - } - - m.parensInOp = true; - a.parensInOp = true; - operation = new(tree.Operation)(op, [operation || m, a], isSpaced); - isSpaced = parserInput.isWhitespace(-1); - } - return operation || m; - } - }, - conditions: function () { - let a; - let b; - const index = parserInput.i; - let condition; - - a = this.condition(true); - if (a) { - while (true) { - if (!parserInput.peek(/^,\s*(not\s*)?\(/) || !parserInput.$char(',')) { - break; - } - b = this.condition(true); - if (!b) { - break; - } - condition = new(tree.Condition)('or', condition || a, b, index + currentIndex); - } - return condition || a; - } - }, - condition: function (needsParens) { - let result; - let logical; - let next; - function or() { - return parserInput.$str('or'); - } - - result = this.conditionAnd(needsParens); - if (!result) { - return ; - } - logical = or(); - if (logical) { - next = this.condition(needsParens); - if (next) { - result = new(tree.Condition)(logical, result, next); - } else { - return ; - } - } - return result; - }, - conditionAnd: function (needsParens) { - let result; - let logical; - let next; - const self = this; - function insideCondition() { - const cond = self.negatedCondition(needsParens) || self.parenthesisCondition(needsParens); - if (!cond && !needsParens) { - return self.atomicCondition(needsParens); - } - return cond; - } - function and() { - return parserInput.$str('and'); - } - - result = insideCondition(); - if (!result) { - return ; - } - logical = and(); - if (logical) { - next = this.conditionAnd(needsParens); - if (next) { - result = new(tree.Condition)(logical, result, next); - } else { - return ; - } - } - return result; - }, - negatedCondition: function (needsParens) { - if (parserInput.$str('not')) { - const result = this.parenthesisCondition(needsParens); - if (result) { - result.negate = !result.negate; - } - return result; - } - }, - parenthesisCondition: function (needsParens) { - function tryConditionFollowedByParenthesis(me) { - let body; - parserInput.save(); - body = me.condition(needsParens); - if (!body) { - parserInput.restore(); - return ; - } - if (!parserInput.$char(')')) { - parserInput.restore(); - return ; - } - parserInput.forget(); - return body; - } - - let body; - parserInput.save(); - if (!parserInput.$str('(')) { - parserInput.restore(); - return ; - } - body = tryConditionFollowedByParenthesis(this); - if (body) { - parserInput.forget(); - return body; - } - - body = this.atomicCondition(needsParens); - if (!body) { - parserInput.restore(); - return ; - } - if (!parserInput.$char(')')) { - parserInput.restore(`expected ')' got '${parserInput.currentChar()}'`); - return ; - } - parserInput.forget(); - return body; - }, - atomicCondition: function (needsParens, preparsedCond) { - const entities = this.entities; - const index = parserInput.i; - let a; - let b; - let c; - let op; - - const cond = (function() { - return this.addition() || entities.keyword() || entities.quoted() || entities.mixinLookup(); - }).bind(this) - - if (preparsedCond) { - a = preparsedCond; - } else { - a = cond(); - } - - if (a) { - if (parserInput.$char('>')) { - if (parserInput.$char('=')) { - op = '>='; - } else { - op = '>'; - } - } else - if (parserInput.$char('<')) { - if (parserInput.$char('=')) { - op = '<='; - } else { - op = '<'; - } - } else - if (parserInput.$char('=')) { - if (parserInput.$char('>')) { - op = '=>'; - } else if (parserInput.$char('<')) { - op = '=<'; - } else { - op = '='; - } - } - if (op) { - b = cond(); - if (b) { - c = new(tree.Condition)(op, a, b, index + currentIndex, false); - } else { - error('expected expression'); - } - } else if (!preparsedCond) { - c = new(tree.Condition)('=', a, new(tree.Keyword)('true'), index + currentIndex, false); - } - return c; - } - }, - - // - // An operand is anything that can be part of an operation, - // such as a Color, or a Variable - // - operand: function () { - const entities = this.entities; - let negate; - - if (parserInput.peek(/^-[@$(]/)) { - negate = parserInput.$char('-'); - } - - let o = this.sub() || entities.dimension() || - entities.color() || entities.variable() || - entities.property() || entities.call() || - entities.quoted(true) || entities.colorKeyword() || - this.colorOperand() || entities.mixinLookup(); - - if (negate) { - o.parensInOp = true; - o = new(tree.Negative)(o); - } - - return o; - }, - - // - // Expressions either represent mathematical operations, - // or white-space delimited Entities. - // - // 1px solid black - // @var * 2 - // - expression: function () { - const entities = []; - let e; - let delim; - const index = parserInput.i; - - do { - e = this.comment(); - if (e && !e.isLineComment) { - entities.push(e); - continue; - } - e = this.addition() || this.entity(); - - if (e instanceof tree.Comment) { - e = null; - } - - if (e) { - entities.push(e); - // operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here - if (!parserInput.peek(/^\/[/*]/)) { - delim = parserInput.$char('/'); - if (delim) { - entities.push(new(tree.Anonymous)(delim, index + currentIndex)); - } - } - } - } while (e); - if (entities.length > 0) { - return new(tree.Expression)(entities); - } - }, - property: function () { - const name = parserInput.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/); - if (name) { - return name[1]; - } - }, - ruleProperty: function () { - let name = []; - const index = []; - let s; - let k; - - parserInput.save(); - - const simpleProperty = parserInput.$re(/^([_a-zA-Z0-9-]+)\s*:/); - if (simpleProperty) { - name = [new(tree.Keyword)(simpleProperty[1])]; - parserInput.forget(); - return name; - } - - function match(re) { - const i = parserInput.i; - const chunk = parserInput.$re(re); - if (chunk) { - index.push(i); - return name.push(chunk[1]); - } - } - - match(/^(\*?)/); - while (true) { - if (!match(/^((?:[\w-]+)|(?:[@$]\{[\w-]+\}))/)) { - break; - } - } - - if ((name.length > 1) && match(/^((?:\+_|\+)?)\s*:/)) { - parserInput.forget(); - - // at last, we have the complete match now. move forward, - // convert name particles to tree objects and return: - if (name[0] === '') { - name.shift(); - index.shift(); - } - for (k = 0; k < name.length; k++) { - s = name[k]; - name[k] = (s.charAt(0) !== '@' && s.charAt(0) !== '$') ? - new(tree.Keyword)(s) : - (s.charAt(0) === '@' ? - new(tree.Variable)(`@${s.slice(2, -1)}`, index[k] + currentIndex, fileInfo) : - new(tree.Property)(`$${s.slice(2, -1)}`, index[k] + currentIndex, fileInfo)); - } - return name; - } - parserInput.restore(); - } - } - }; -}; -Parser.serializeVars = vars => { - let s = ''; - - for (const name in vars) { - if (Object.hasOwnProperty.call(vars, name)) { - const value = vars[name]; - s += `${((name[0] === '@') ? '' : '@') + name}: ${value}${(String(value).slice(-1) === ';') ? '' : ';'}`; - } - } - - return s; -}; - -export default Parser; \ No newline at end of file diff --git a/packages/less/src/less/plugin-manager.js b/packages/less/src/less/plugin-manager.js deleted file mode 100644 index 48002fbcdf..0000000000 --- a/packages/less/src/less/plugin-manager.js +++ /dev/null @@ -1,168 +0,0 @@ -/** - * Plugin Manager - */ -class PluginManager { - constructor(less) { - this.less = less; - this.visitors = []; - this.preProcessors = []; - this.postProcessors = []; - this.installedPlugins = []; - this.fileManagers = []; - this.iterator = -1; - this.pluginCache = {}; - this.Loader = new less.PluginLoader(less); - } - - /** - * Adds all the plugins in the array - * @param {Array} plugins - */ - addPlugins(plugins) { - if (plugins) { - for (let i = 0; i < plugins.length; i++) { - this.addPlugin(plugins[i]); - } - } - } - - /** - * - * @param plugin - * @param {String} filename - */ - addPlugin(plugin, filename, functionRegistry) { - this.installedPlugins.push(plugin); - if (filename) { - this.pluginCache[filename] = plugin; - } - if (plugin.install) { - plugin.install(this.less, this, functionRegistry || this.less.functions.functionRegistry); - } - } - - /** - * - * @param filename - */ - get(filename) { - return this.pluginCache[filename]; - } - - /** - * Adds a visitor. The visitor object has options on itself to determine - * when it should run. - * @param visitor - */ - addVisitor(visitor) { - this.visitors.push(visitor); - } - - /** - * Adds a pre processor object - * @param {object} preProcessor - * @param {number} priority - guidelines 1 = before import, 1000 = import, 2000 = after import - */ - addPreProcessor(preProcessor, priority) { - let indexToInsertAt; - for (indexToInsertAt = 0; indexToInsertAt < this.preProcessors.length; indexToInsertAt++) { - if (this.preProcessors[indexToInsertAt].priority >= priority) { - break; - } - } - this.preProcessors.splice(indexToInsertAt, 0, {preProcessor, priority}); - } - - /** - * Adds a post processor object - * @param {object} postProcessor - * @param {number} priority - guidelines 1 = before compression, 1000 = compression, 2000 = after compression - */ - addPostProcessor(postProcessor, priority) { - let indexToInsertAt; - for (indexToInsertAt = 0; indexToInsertAt < this.postProcessors.length; indexToInsertAt++) { - if (this.postProcessors[indexToInsertAt].priority >= priority) { - break; - } - } - this.postProcessors.splice(indexToInsertAt, 0, {postProcessor, priority}); - } - - /** - * - * @param manager - */ - addFileManager(manager) { - this.fileManagers.push(manager); - } - - /** - * - * @returns {Array} - * @private - */ - getPreProcessors() { - const preProcessors = []; - for (let i = 0; i < this.preProcessors.length; i++) { - preProcessors.push(this.preProcessors[i].preProcessor); - } - return preProcessors; - } - - /** - * - * @returns {Array} - * @private - */ - getPostProcessors() { - const postProcessors = []; - for (let i = 0; i < this.postProcessors.length; i++) { - postProcessors.push(this.postProcessors[i].postProcessor); - } - return postProcessors; - } - - /** - * - * @returns {Array} - * @private - */ - getVisitors() { - return this.visitors; - } - - visitor() { - const self = this; - return { - first: function() { - self.iterator = -1; - return self.visitors[self.iterator]; - }, - get: function() { - self.iterator += 1; - return self.visitors[self.iterator]; - } - }; - } - - /** - * - * @returns {Array} - * @private - */ - getFileManagers() { - return this.fileManagers; - } -} - -let pm; - -const PluginManagerFactory = function(less, newFactory) { - if (newFactory || !pm) { - pm = new PluginManager(less); - } - return pm; -}; - -// -export default PluginManagerFactory; diff --git a/packages/less/src/less/render.js b/packages/less/src/less/render.js deleted file mode 100644 index 8d25b1701f..0000000000 --- a/packages/less/src/less/render.js +++ /dev/null @@ -1,41 +0,0 @@ -import * as utils from './utils'; - -export default function(environment, ParseTree) { - const render = function (input, options, callback) { - if (typeof options === 'function') { - callback = options; - options = utils.copyOptions(this.options, {}); - } - else { - options = utils.copyOptions(this.options, options || {}); - } - - if (!callback) { - const self = this; - return new Promise(function (resolve, reject) { - render.call(self, input, options, function(err, output) { - if (err) { - reject(err); - } else { - resolve(output); - } - }); - }); - } else { - this.parse(input, options, function(err, root, imports, options) { - if (err) { return callback(err); } - - let result; - try { - const parseTree = new ParseTree(root, imports); - result = parseTree.toCSS(options); - } - catch (err) { return callback(err); } - - callback(null, result); - }); - } - }; - - return render; -} diff --git a/packages/less/src/less/source-map-builder.js b/packages/less/src/less/source-map-builder.js deleted file mode 100644 index dcf40dfcd2..0000000000 --- a/packages/less/src/less/source-map-builder.js +++ /dev/null @@ -1,82 +0,0 @@ -export default function (SourceMapOutput, environment) { - class SourceMapBuilder { - constructor(options) { - this.options = options; - } - - toCSS(rootNode, options, imports) { - const sourceMapOutput = new SourceMapOutput( - { - contentsIgnoredCharsMap: imports.contentsIgnoredChars, - rootNode, - contentsMap: imports.contents, - sourceMapFilename: this.options.sourceMapFilename, - sourceMapURL: this.options.sourceMapURL, - outputFilename: this.options.sourceMapOutputFilename, - sourceMapBasepath: this.options.sourceMapBasepath, - sourceMapRootpath: this.options.sourceMapRootpath, - outputSourceFiles: this.options.outputSourceFiles, - sourceMapGenerator: this.options.sourceMapGenerator, - sourceMapFileInline: this.options.sourceMapFileInline, - disableSourcemapAnnotation: this.options.disableSourcemapAnnotation - }); - - const css = sourceMapOutput.toCSS(options); - this.sourceMap = sourceMapOutput.sourceMap; - this.sourceMapURL = sourceMapOutput.sourceMapURL; - if (this.options.sourceMapInputFilename) { - this.sourceMapInputFilename = sourceMapOutput.normalizeFilename(this.options.sourceMapInputFilename); - } - if (this.options.sourceMapBasepath !== undefined && this.sourceMapURL !== undefined) { - this.sourceMapURL = sourceMapOutput.removeBasepath(this.sourceMapURL); - } - return css + this.getCSSAppendage(); - } - - getCSSAppendage() { - - let sourceMapURL = this.sourceMapURL; - if (this.options.sourceMapFileInline) { - if (this.sourceMap === undefined) { - return ''; - } - sourceMapURL = `data:application/json;base64,${environment.encodeBase64(this.sourceMap)}`; - } - - if (this.options.disableSourcemapAnnotation) { - return ''; - } - - if (sourceMapURL) { - return `/*# sourceMappingURL=${sourceMapURL} */`; - } - return ''; - } - - getExternalSourceMap() { - return this.sourceMap; - } - - setExternalSourceMap(sourceMap) { - this.sourceMap = sourceMap; - } - - isInline() { - return this.options.sourceMapFileInline; - } - - getSourceMapURL() { - return this.sourceMapURL; - } - - getOutputFilename() { - return this.options.sourceMapOutputFilename; - } - - getInputFilename() { - return this.sourceMapInputFilename; - } - } - - return SourceMapBuilder; -} diff --git a/packages/less/src/less/source-map-output.js b/packages/less/src/less/source-map-output.js deleted file mode 100644 index d88b5b532d..0000000000 --- a/packages/less/src/less/source-map-output.js +++ /dev/null @@ -1,151 +0,0 @@ -export default function (environment) { - class SourceMapOutput { - constructor(options) { - this._css = []; - this._rootNode = options.rootNode; - this._contentsMap = options.contentsMap; - this._contentsIgnoredCharsMap = options.contentsIgnoredCharsMap; - if (options.sourceMapFilename) { - this._sourceMapFilename = options.sourceMapFilename.replace(/\\/g, '/'); - } - this._outputFilename = options.outputFilename ? options.outputFilename.replace(/\\/g, '/') : options.outputFilename; - this.sourceMapURL = options.sourceMapURL; - if (options.sourceMapBasepath) { - this._sourceMapBasepath = options.sourceMapBasepath.replace(/\\/g, '/'); - } - if (options.sourceMapRootpath) { - this._sourceMapRootpath = options.sourceMapRootpath.replace(/\\/g, '/'); - if (this._sourceMapRootpath.charAt(this._sourceMapRootpath.length - 1) !== '/') { - this._sourceMapRootpath += '/'; - } - } else { - this._sourceMapRootpath = ''; - } - this._outputSourceFiles = options.outputSourceFiles; - this._sourceMapGeneratorConstructor = environment.getSourceMapGenerator(); - - this._lineNumber = 0; - this._column = 0; - } - - removeBasepath(path) { - if (this._sourceMapBasepath && path.indexOf(this._sourceMapBasepath) === 0) { - path = path.substring(this._sourceMapBasepath.length); - if (path.charAt(0) === '\\' || path.charAt(0) === '/') { - path = path.substring(1); - } - } - - return path; - } - - normalizeFilename(filename) { - filename = filename.replace(/\\/g, '/'); - filename = this.removeBasepath(filename); - return (this._sourceMapRootpath || '') + filename; - } - - add(chunk, fileInfo, index, mapLines) { - - // ignore adding empty strings - if (!chunk) { - return; - } - - let lines, sourceLines, columns, sourceColumns, i; - - if (fileInfo && fileInfo.filename) { - let inputSource = this._contentsMap[fileInfo.filename]; - - // remove vars/banner added to the top of the file - if (this._contentsIgnoredCharsMap[fileInfo.filename]) { - // adjust the index - index -= this._contentsIgnoredCharsMap[fileInfo.filename]; - if (index < 0) { index = 0; } - // adjust the source - inputSource = inputSource.slice(this._contentsIgnoredCharsMap[fileInfo.filename]); - } - - /** - * ignore empty content, or failsafe - * if contents map is incorrect - */ - if (inputSource === undefined) { - this._css.push(chunk); - return; - } - - inputSource = inputSource.substring(0, index); - sourceLines = inputSource.split('\n'); - sourceColumns = sourceLines[sourceLines.length - 1]; - } - - lines = chunk.split('\n'); - columns = lines[lines.length - 1]; - - if (fileInfo && fileInfo.filename) { - if (!mapLines) { - this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + 1, column: this._column}, - original: { line: sourceLines.length, column: sourceColumns.length}, - source: this.normalizeFilename(fileInfo.filename)}); - } else { - for (i = 0; i < lines.length; i++) { - this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + i + 1, column: i === 0 ? this._column : 0}, - original: { line: sourceLines.length + i, column: i === 0 ? sourceColumns.length : 0}, - source: this.normalizeFilename(fileInfo.filename)}); - } - } - } - - if (lines.length === 1) { - this._column += columns.length; - } else { - this._lineNumber += lines.length - 1; - this._column = columns.length; - } - - this._css.push(chunk); - } - - isEmpty() { - return this._css.length === 0; - } - - toCSS(context) { - this._sourceMapGenerator = new this._sourceMapGeneratorConstructor({ file: this._outputFilename, sourceRoot: null }); - - if (this._outputSourceFiles) { - for (const filename in this._contentsMap) { - // eslint-disable-next-line no-prototype-builtins - if (this._contentsMap.hasOwnProperty(filename)) { - let source = this._contentsMap[filename]; - if (this._contentsIgnoredCharsMap[filename]) { - source = source.slice(this._contentsIgnoredCharsMap[filename]); - } - this._sourceMapGenerator.setSourceContent(this.normalizeFilename(filename), source); - } - } - } - - this._rootNode.genCSS(context, this); - - if (this._css.length > 0) { - let sourceMapURL; - const sourceMapContent = JSON.stringify(this._sourceMapGenerator.toJSON()); - - if (this.sourceMapURL) { - sourceMapURL = this.sourceMapURL; - } else if (this._sourceMapFilename) { - sourceMapURL = this._sourceMapFilename; - } - this.sourceMapURL = sourceMapURL; - - this.sourceMap = sourceMapContent; - } - - return this._css.join(''); - } - } - - return SourceMapOutput; -} diff --git a/packages/less/src/less/transform-tree.js b/packages/less/src/less/transform-tree.js deleted file mode 100644 index 8426f32018..0000000000 --- a/packages/less/src/less/transform-tree.js +++ /dev/null @@ -1,97 +0,0 @@ -import contexts from './contexts'; -import visitor from './visitors'; -import tree from './tree'; - -export default function(root, options) { - options = options || {}; - let evaldRoot; - let variables = options.variables; - const evalEnv = new contexts.Eval(options); - - // - // Allows setting variables with a hash, so: - // - // `{ color: new tree.Color('#f01') }` will become: - // - // new tree.Declaration('@color', - // new tree.Value([ - // new tree.Expression([ - // new tree.Color('#f01') - // ]) - // ]) - // ) - // - if (typeof variables === 'object' && !Array.isArray(variables)) { - variables = Object.keys(variables).map(function (k) { - let value = variables[k]; - - if (!(value instanceof tree.Value)) { - if (!(value instanceof tree.Expression)) { - value = new tree.Expression([value]); - } - value = new tree.Value([value]); - } - return new tree.Declaration(`@${k}`, value, false, null, 0); - }); - evalEnv.frames = [new tree.Ruleset(null, variables)]; - } - - const visitors = [ - new visitor.JoinSelectorVisitor(), - new visitor.MarkVisibleSelectorsVisitor(true), - new visitor.ExtendVisitor(), - new visitor.ToCSSVisitor({compress: Boolean(options.compress)}) - ]; - - const preEvalVisitors = []; - let v; - let visitorIterator; - - /** - * first() / get() allows visitors to be added while visiting - * - * @todo Add scoping for visitors just like functions for @plugin; right now they're global - */ - if (options.pluginManager) { - visitorIterator = options.pluginManager.visitor(); - for (let i = 0; i < 2; i++) { - visitorIterator.first(); - while ((v = visitorIterator.get())) { - if (v.isPreEvalVisitor) { - if (i === 0 || preEvalVisitors.indexOf(v) === -1) { - preEvalVisitors.push(v); - v.run(root); - } - } - else { - if (i === 0 || visitors.indexOf(v) === -1) { - if (v.isPreVisitor) { - visitors.unshift(v); - } - else { - visitors.push(v); - } - } - } - } - } - } - - evaldRoot = root.eval(evalEnv); - - for (let i = 0; i < visitors.length; i++) { - visitors[i].run(evaldRoot); - } - - // Run any remaining visitors added after eval pass - if (options.pluginManager) { - visitorIterator.first(); - while ((v = visitorIterator.get())) { - if (visitors.indexOf(v) === -1 && preEvalVisitors.indexOf(v) === -1) { - v.run(evaldRoot); - } - } - } - - return evaldRoot; -} diff --git a/packages/less/src/less/tree/anonymous.js b/packages/less/src/less/tree/anonymous.js deleted file mode 100644 index 9c40a9526a..0000000000 --- a/packages/less/src/less/tree/anonymous.js +++ /dev/null @@ -1,32 +0,0 @@ -import Node from './node'; - -const Anonymous = function(value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) { - this.value = value; - this._index = index; - this._fileInfo = currentFileInfo; - this.mapLines = mapLines; - this.rulesetLike = (typeof rulesetLike === 'undefined') ? false : rulesetLike; - this.allowRoot = true; - this.copyVisibilityInfo(visibilityInfo); -} - -Anonymous.prototype = Object.assign(new Node(), { - type: 'Anonymous', - eval() { - return new Anonymous(this.value, this._index, this._fileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo()); - }, - compare(other) { - return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined; - }, - isRulesetLike() { - return this.rulesetLike; - }, - genCSS(context, output) { - this.nodeVisible = Boolean(this.value); - if (this.nodeVisible) { - output.add(this.value, this._fileInfo, this._index, this.mapLines); - } - } -}) - -export default Anonymous; diff --git a/packages/less/src/less/tree/assignment.js b/packages/less/src/less/tree/assignment.js deleted file mode 100644 index 564d9220d3..0000000000 --- a/packages/less/src/less/tree/assignment.js +++ /dev/null @@ -1,32 +0,0 @@ -import Node from './node'; - -const Assignment = function(key, val) { - this.key = key; - this.value = val; -} - -Assignment.prototype = Object.assign(new Node(), { - type: 'Assignment', - - accept(visitor) { - this.value = visitor.visit(this.value); - }, - - eval(context) { - if (this.value.eval) { - return new Assignment(this.key, this.value.eval(context)); - } - return this; - }, - - genCSS(context, output) { - output.add(`${this.key}=`); - if (this.value.genCSS) { - this.value.genCSS(context, output); - } else { - output.add(this.value); - } - } -}); - -export default Assignment; diff --git a/packages/less/src/less/tree/atrule-syntax.js b/packages/less/src/less/tree/atrule-syntax.js deleted file mode 100644 index 0c5decb836..0000000000 --- a/packages/less/src/less/tree/atrule-syntax.js +++ /dev/null @@ -1,7 +0,0 @@ -export const MediaSyntaxOptions = { - queryInParens: true -}; - -export const ContainerSyntaxOptions = { - queryInParens: true -}; diff --git a/packages/less/src/less/tree/atrule.js b/packages/less/src/less/tree/atrule.js deleted file mode 100644 index df36a5d876..0000000000 --- a/packages/less/src/less/tree/atrule.js +++ /dev/null @@ -1,271 +0,0 @@ -import Node from './node'; -import Selector from './selector'; -import Ruleset from './ruleset'; -import Anonymous from './anonymous'; -import NestableAtRulePrototype from './nested-at-rule'; - -const AtRule = function( - name, - value, - rules, - index, - currentFileInfo, - debugInfo, - isRooted, - visibilityInfo -) { - let i; - var selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors(); - - this.name = name; - this.value = (value instanceof Node) ? value : (value ? new Anonymous(value) : value); - if (rules) { - if (Array.isArray(rules)) { - const allDeclarations = this.declarationsBlock(rules); - - let allRulesetDeclarations = true; - rules.forEach(rule => { - if (rule.type === 'Ruleset' && rule.rules) allRulesetDeclarations = allRulesetDeclarations && this.declarationsBlock(rule.rules, true); - }); - - if (allDeclarations && !isRooted) { - this.simpleBlock = true; - this.declarations = rules; - } else if (allRulesetDeclarations && rules.length === 1 && !isRooted && !value) { - this.simpleBlock = true; - this.declarations = rules[0].rules ? rules[0].rules : rules; - } else { - this.rules = rules; - } - } else { - const allDeclarations = this.declarationsBlock(rules.rules); - - if (allDeclarations && !isRooted && !value) { - this.simpleBlock = true; - this.declarations = rules.rules; - } else { - this.rules = [rules]; - this.rules[0].selectors = (new Selector([], null, null, index, currentFileInfo)).createEmptySelectors(); - } - } - if (!this.simpleBlock) { - for (i = 0; i < this.rules.length; i++) { - this.rules[i].allowImports = true; - } - } - this.setParent(selectors, this); - this.setParent(this.rules, this); - } - this._index = index; - this._fileInfo = currentFileInfo; - this.debugInfo = debugInfo; - this.isRooted = isRooted || false; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; -} - -AtRule.prototype = Object.assign(new Node(), { - type: 'AtRule', - - ...NestableAtRulePrototype, - - declarationsBlock(rules, mergeable = false) { - if (!mergeable) { - return rules.filter(function (node) { return (node.type === 'Declaration' || node.type === 'Comment') && !node.merge}).length === rules.length; - } else { - return rules.filter(function (node) { return (node.type === 'Declaration' || node.type === 'Comment'); }).length === rules.length; - } - }, - - keywordList(rules) { - if (!Array.isArray(rules)) { - return false; - } else { - return rules.filter(function (node) { return (node.type === 'Keyword' || node.type === 'Comment'); }).length === rules.length; - } - }, - - accept(visitor) { - const value = this.value, rules = this.rules, declarations = this.declarations; - - if (rules) { - this.rules = visitor.visitArray(rules); - } else if (declarations) { - this.declarations = visitor.visitArray(declarations); - } - if (value) { - this.value = visitor.visit(value); - } - }, - - isRulesetLike() { - return this.rules || !this.isCharset(); - }, - - isCharset() { - return '@charset' === this.name; - }, - - genCSS(context, output) { - const value = this.value, rules = this.rules || this.declarations; - output.add(this.name, this.fileInfo(), this.getIndex()); - if (value) { - output.add(' '); - value.genCSS(context, output); - } - if (this.simpleBlock) { - this.outputRuleset(context, output, this.declarations); - } else if (rules) { - this.outputRuleset(context, output, rules); - } else { - output.add(';'); - } - }, - - eval(context) { - let mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules || this.declarations; - - // media stored inside other atrule should not bubble over it - // backpup media bubbling information - mediaPathBackup = context.mediaPath; - mediaBlocksBackup = context.mediaBlocks; - // deleted media bubbling information - context.mediaPath = []; - context.mediaBlocks = []; - - if (value) { - value = value.eval(context); - if (value.value && this.keywordList(value.value)) { - value = new Anonymous(value.value.map(keyword => keyword.value).join(', '), this.getIndex(), this.fileInfo()); - } - } - - if (rules) { - rules = this.evalRoot(context, rules); - } - if (Array.isArray(rules) && rules[0].rules && Array.isArray(rules[0].rules) && rules[0].rules.length) { - const allMergeableDeclarations = this.declarationsBlock(rules[0].rules, true); - if (allMergeableDeclarations && !this.isRooted && !value) { - var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules; - mergeRules(rules[0].rules); - rules = rules[0].rules; - rules.forEach(rule => rule.merge = false); - } - } - if (this.simpleBlock && rules) { - rules[0].functionRegistry = context.frames[0].functionRegistry.inherit(); - rules = rules.map(function (rule) { return rule.eval(context); }); - } - - // restore media bubbling information - context.mediaPath = mediaPathBackup; - context.mediaBlocks = mediaBlocksBackup; - return new AtRule(this.name, value, rules, this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo()); - }, - - evalRoot(context, rules) { - let ampersandCount = 0; - let noAmpersandCount = 0; - let noAmpersands = true; - let allAmpersands = false; - - if (!this.simpleBlock) { - rules = [rules[0].eval(context)]; - } - - let precedingSelectors = []; - if (context.frames.length > 0) { - for (let index = 0; index < context.frames.length; index++) { - const frame = context.frames[index]; - if ( - frame.type === 'Ruleset' && - frame.rules && - frame.rules.length > 0 - ) { - if (frame && !frame.root && frame.selectors && frame.selectors.length > 0) { - precedingSelectors = precedingSelectors.concat(frame.selectors); - } - } - if (precedingSelectors.length > 0) { - let value = ''; - const output = { add: function (s) { value += s; } }; - for (let i = 0; i < precedingSelectors.length; i++) { - precedingSelectors[i].genCSS(context, output); - } - if (/^&+$/.test(value.replace(/\s+/g, ''))) { - noAmpersands = false; - noAmpersandCount++; - } else { - allAmpersands = false; - ampersandCount++; - } - } - } - } - - const mixedAmpersands = ampersandCount > 0 && noAmpersandCount > 0 && !allAmpersands && !noAmpersands; - if ( - (this.isRooted && ampersandCount > 0 && noAmpersandCount === 0 && !allAmpersands && noAmpersands) - || !mixedAmpersands - ) { - rules[0].root = true; - } - return rules; - }, - - variable(name) { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return Ruleset.prototype.variable.call(this.rules[0], name); - } - }, - - find() { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return Ruleset.prototype.find.apply(this.rules[0], arguments); - } - }, - - rulesets() { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return Ruleset.prototype.rulesets.apply(this.rules[0]); - } - }, - - outputRuleset(context, output, rules) { - const ruleCnt = rules.length; - let i; - context.tabLevel = (context.tabLevel | 0) + 1; - - // Compressed - if (context.compress) { - output.add('{'); - for (i = 0; i < ruleCnt; i++) { - rules[i].genCSS(context, output); - } - output.add('}'); - context.tabLevel--; - return; - } - - // Non-compressed - const tabSetStr = `\n${Array(context.tabLevel).join(' ')}`, tabRuleStr = `${tabSetStr} `; - if (!ruleCnt) { - output.add(` {${tabSetStr}}`); - } else { - output.add(` {${tabRuleStr}`); - rules[0].genCSS(context, output); - for (i = 1; i < ruleCnt; i++) { - output.add(tabRuleStr); - rules[i].genCSS(context, output); - } - output.add(`${tabSetStr}}`); - } - - context.tabLevel--; - } -}); - -export default AtRule; diff --git a/packages/less/src/less/tree/attribute.js b/packages/less/src/less/tree/attribute.js deleted file mode 100644 index e716d13d80..0000000000 --- a/packages/less/src/less/tree/attribute.js +++ /dev/null @@ -1,42 +0,0 @@ -import Node from './node'; - -const Attribute = function(key, op, value, cif) { - this.key = key; - this.op = op; - this.value = value; - this.cif = cif; -} - -Attribute.prototype = Object.assign(new Node(), { - type: 'Attribute', - - eval(context) { - return new Attribute( - this.key.eval ? this.key.eval(context) : this.key, - this.op, - (this.value && this.value.eval) ? this.value.eval(context) : this.value, - this.cif - ); - }, - - genCSS(context, output) { - output.add(this.toCSS(context)); - }, - - toCSS(context) { - let value = this.key.toCSS ? this.key.toCSS(context) : this.key; - - if (this.op) { - value += this.op; - value += (this.value.toCSS ? this.value.toCSS(context) : this.value); - } - - if (this.cif) { - value = value + ' ' + this.cif; - } - - return `[${value}]`; - } -}); - -export default Attribute; diff --git a/packages/less/src/less/tree/call.js b/packages/less/src/less/tree/call.js deleted file mode 100644 index 15e98eb800..0000000000 --- a/packages/less/src/less/tree/call.js +++ /dev/null @@ -1,113 +0,0 @@ -import Node from './node'; -import Anonymous from './anonymous'; -import FunctionCaller from '../functions/function-caller'; - -// -// A function call node. -// -const Call = function(name, args, index, currentFileInfo) { - this.name = name; - this.args = args; - this.calc = name === 'calc'; - this._index = index; - this._fileInfo = currentFileInfo; -} - -Call.prototype = Object.assign(new Node(), { - type: 'Call', - - accept(visitor) { - if (this.args) { - this.args = visitor.visitArray(this.args); - } - }, - - // - // When evaluating a function call, - // we either find the function in the functionRegistry, - // in which case we call it, passing the evaluated arguments, - // if this returns null or we cannot find the function, we - // simply print it out as it appeared originally [2]. - // - // The reason why we evaluate the arguments, is in the case where - // we try to pass a variable to a function, like: `saturate(@color)`. - // The function should receive the value, not the variable. - // - eval(context) { - /** - * Turn off math for calc(), and switch back on for evaluating nested functions - */ - const currentMathContext = context.mathOn; - context.mathOn = !this.calc; - if (this.calc || context.inCalc) { - context.enterCalc(); - } - - const exitCalc = () => { - if (this.calc || context.inCalc) { - context.exitCalc(); - } - context.mathOn = currentMathContext; - }; - - let result; - const funcCaller = new FunctionCaller(this.name, context, this.getIndex(), this.fileInfo()); - - if (funcCaller.isValid()) { - try { - result = funcCaller.call(this.args); - exitCalc(); - } catch (e) { - // eslint-disable-next-line no-prototype-builtins - if (e.hasOwnProperty('line') && e.hasOwnProperty('column')) { - throw e; - } - throw { - type: e.type || 'Runtime', - message: `Error evaluating function \`${this.name}\`${e.message ? `: ${e.message}` : ''}`, - index: this.getIndex(), - filename: this.fileInfo().filename, - line: e.lineNumber, - column: e.columnNumber - }; - } - } - - if (result !== null && result !== undefined) { - // Results that that are not nodes are cast as Anonymous nodes - // Falsy values or booleans are returned as empty nodes - if (!(result instanceof Node)) { - if (!result || result === true) { - result = new Anonymous(null); - } - else { - result = new Anonymous(result.toString()); - } - - } - result._index = this._index; - result._fileInfo = this._fileInfo; - return result; - } - - const args = this.args.map(a => a.eval(context)); - exitCalc(); - - return new Call(this.name, args, this.getIndex(), this.fileInfo()); - }, - - genCSS(context, output) { - output.add(`${this.name}(`, this.fileInfo(), this.getIndex()); - - for (let i = 0; i < this.args.length; i++) { - this.args[i].genCSS(context, output); - if (i + 1 < this.args.length) { - output.add(', '); - } - } - - output.add(')'); - } -}); - -export default Call; diff --git a/packages/less/src/less/tree/color.js b/packages/less/src/less/tree/color.js deleted file mode 100644 index 906e69167d..0000000000 --- a/packages/less/src/less/tree/color.js +++ /dev/null @@ -1,241 +0,0 @@ -import Node from './node'; -import colors from '../data/colors'; - -// -// RGB Colors - #ff0014, #eee -// -const Color = function(rgb, a, originalForm) { - const self = this; - // - // The end goal here, is to parse the arguments - // into an integer triplet, such as `128, 255, 0` - // - // This facilitates operations and conversions. - // - if (Array.isArray(rgb)) { - this.rgb = rgb; - } else if (rgb.length >= 6) { - this.rgb = []; - rgb.match(/.{2}/g).map(function (c, i) { - if (i < 3) { - self.rgb.push(parseInt(c, 16)); - } else { - self.alpha = (parseInt(c, 16)) / 255; - } - }); - } else { - this.rgb = []; - rgb.split('').map(function (c, i) { - if (i < 3) { - self.rgb.push(parseInt(c + c, 16)); - } else { - self.alpha = (parseInt(c + c, 16)) / 255; - } - }); - } - this.alpha = this.alpha || (typeof a === 'number' ? a : 1); - if (typeof originalForm !== 'undefined') { - this.value = originalForm; - } -} - -Color.prototype = Object.assign(new Node(), { - type: 'Color', - - luma() { - let r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255; - - r = (r <= 0.03928) ? r / 12.92 : Math.pow(((r + 0.055) / 1.055), 2.4); - g = (g <= 0.03928) ? g / 12.92 : Math.pow(((g + 0.055) / 1.055), 2.4); - b = (b <= 0.03928) ? b / 12.92 : Math.pow(((b + 0.055) / 1.055), 2.4); - - return 0.2126 * r + 0.7152 * g + 0.0722 * b; - }, - - genCSS(context, output) { - output.add(this.toCSS(context)); - }, - - toCSS(context, doNotCompress) { - const compress = context && context.compress && !doNotCompress; - let color; - let alpha; - let colorFunction; - let args = []; - - // `value` is set if this color was originally - // converted from a named color string so we need - // to respect this and try to output named color too. - alpha = this.fround(context, this.alpha); - - if (this.value) { - if (this.value.indexOf('rgb') === 0) { - if (alpha < 1) { - colorFunction = 'rgba'; - } - } else if (this.value.indexOf('hsl') === 0) { - if (alpha < 1) { - colorFunction = 'hsla'; - } else { - colorFunction = 'hsl'; - } - } else { - return this.value; - } - } else { - if (alpha < 1) { - colorFunction = 'rgba'; - } - } - - switch (colorFunction) { - case 'rgba': - args = this.rgb.map(function (c) { - return clamp(Math.round(c), 255); - }).concat(clamp(alpha, 1)); - break; - case 'hsla': - args.push(clamp(alpha, 1)); - // eslint-disable-next-line no-fallthrough - case 'hsl': - color = this.toHSL(); - args = [ - this.fround(context, color.h), - `${this.fround(context, color.s * 100)}%`, - `${this.fround(context, color.l * 100)}%` - ].concat(args); - } - - if (colorFunction) { - // Values are capped between `0` and `255`, rounded and zero-padded. - return `${colorFunction}(${args.join(`,${compress ? '' : ' '}`)})`; - } - - color = this.toRGB(); - - if (compress) { - const splitcolor = color.split(''); - - // Convert color to short format - if (splitcolor[1] === splitcolor[2] && splitcolor[3] === splitcolor[4] && splitcolor[5] === splitcolor[6]) { - color = `#${splitcolor[1]}${splitcolor[3]}${splitcolor[5]}`; - } - } - - return color; - }, - - // - // Operations have to be done per-channel, if not, - // channels will spill onto each other. Once we have - // our result, in the form of an integer triplet, - // we create a new Color node to hold the result. - // - operate(context, op, other) { - const rgb = new Array(3); - const alpha = this.alpha * (1 - other.alpha) + other.alpha; - for (let c = 0; c < 3; c++) { - rgb[c] = this._operate(context, op, this.rgb[c], other.rgb[c]); - } - return new Color(rgb, alpha); - }, - - toRGB() { - return toHex(this.rgb); - }, - - toHSL() { - const r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha; - - const max = Math.max(r, g, b), min = Math.min(r, g, b); - let h; - let s; - const l = (max + min) / 2; - const d = max - min; - - if (max === min) { - h = s = 0; - } else { - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - - switch (max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - h /= 6; - } - return { h: h * 360, s, l, a }; - }, - - // Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript - toHSV() { - const r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha; - - const max = Math.max(r, g, b), min = Math.min(r, g, b); - let h; - let s; - const v = max; - - const d = max - min; - if (max === 0) { - s = 0; - } else { - s = d / max; - } - - if (max === min) { - h = 0; - } else { - switch (max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - h /= 6; - } - return { h: h * 360, s, v, a }; - }, - - toARGB() { - return toHex([this.alpha * 255].concat(this.rgb)); - }, - - compare(x) { - return (x.rgb && - x.rgb[0] === this.rgb[0] && - x.rgb[1] === this.rgb[1] && - x.rgb[2] === this.rgb[2] && - x.alpha === this.alpha) ? 0 : undefined; - } -}); - -Color.fromKeyword = function(keyword) { - let c; - const key = keyword.toLowerCase(); - // eslint-disable-next-line no-prototype-builtins - if (colors.hasOwnProperty(key)) { - c = new Color(colors[key].slice(1)); - } - else if (key === 'transparent') { - c = new Color([0, 0, 0], 0); - } - - if (c) { - c.value = keyword; - return c; - } -}; - -function clamp(v, max) { - return Math.min(Math.max(v, 0), max); -} - -function toHex(v) { - return `#${v.map(function (c) { - c = clamp(Math.round(c), 255); - return (c < 16 ? '0' : '') + c.toString(16); - }).join('')}`; -} - -export default Color; diff --git a/packages/less/src/less/tree/combinator.js b/packages/less/src/less/tree/combinator.js deleted file mode 100644 index a98347699e..0000000000 --- a/packages/less/src/less/tree/combinator.js +++ /dev/null @@ -1,27 +0,0 @@ -import Node from './node'; -const _noSpaceCombinators = { - '': true, - ' ': true, - '|': true -}; - -const Combinator = function(value) { - if (value === ' ') { - this.value = ' '; - this.emptyOrWhitespace = true; - } else { - this.value = value ? value.trim() : ''; - this.emptyOrWhitespace = this.value === ''; - } -} - -Combinator.prototype = Object.assign(new Node(), { - type: 'Combinator', - - genCSS(context, output) { - const spaceOrEmpty = (context.compress || _noSpaceCombinators[this.value]) ? '' : ' '; - output.add(spaceOrEmpty + this.value + spaceOrEmpty); - } -}); - -export default Combinator; diff --git a/packages/less/src/less/tree/comment.js b/packages/less/src/less/tree/comment.js deleted file mode 100644 index ce18c4e588..0000000000 --- a/packages/less/src/less/tree/comment.js +++ /dev/null @@ -1,28 +0,0 @@ -import Node from './node'; -import getDebugInfo from './debug-info'; - -const Comment = function(value, isLineComment, index, currentFileInfo) { - this.value = value; - this.isLineComment = isLineComment; - this._index = index; - this._fileInfo = currentFileInfo; - this.allowRoot = true; -} - -Comment.prototype = Object.assign(new Node(), { - type: 'Comment', - - genCSS(context, output) { - if (this.debugInfo) { - output.add(getDebugInfo(context, this), this.fileInfo(), this.getIndex()); - } - output.add(this.value); - }, - - isSilent(context) { - const isCompressed = context.compress && this.value[2] !== '!'; - return this.isLineComment || isCompressed; - } -}); - -export default Comment; diff --git a/packages/less/src/less/tree/condition.js b/packages/less/src/less/tree/condition.js deleted file mode 100644 index 4ae3beb43b..0000000000 --- a/packages/less/src/less/tree/condition.js +++ /dev/null @@ -1,42 +0,0 @@ -import Node from './node'; - -const Condition = function(op, l, r, i, negate) { - this.op = op.trim(); - this.lvalue = l; - this.rvalue = r; - this._index = i; - this.negate = negate; -}; - -Condition.prototype = Object.assign(new Node(), { - type: 'Condition', - - accept(visitor) { - this.lvalue = visitor.visit(this.lvalue); - this.rvalue = visitor.visit(this.rvalue); - }, - - eval(context) { - const result = (function (op, a, b) { - switch (op) { - case 'and': return a && b; - case 'or': return a || b; - default: - switch (Node.compare(a, b)) { - case -1: - return op === '<' || op === '=<' || op === '<='; - case 0: - return op === '=' || op === '>=' || op === '=<' || op === '<='; - case 1: - return op === '>' || op === '>='; - default: - return false; - } - } - })(this.op, this.lvalue.eval(context), this.rvalue.eval(context)); - - return this.negate ? !result : result; - } -}); - -export default Condition; diff --git a/packages/less/src/less/tree/container.js b/packages/less/src/less/tree/container.js deleted file mode 100644 index 1a5502fa3f..0000000000 --- a/packages/less/src/less/tree/container.js +++ /dev/null @@ -1,63 +0,0 @@ -import Ruleset from './ruleset'; -import Value from './value'; -import Selector from './selector'; -import AtRule from './atrule'; -import NestableAtRulePrototype from './nested-at-rule'; - -const Container = function(value, features, index, currentFileInfo, visibilityInfo) { - this._index = index; - this._fileInfo = currentFileInfo; - - const selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors(); - - this.features = new Value(features); - this.rules = [new Ruleset(selectors, value)]; - this.rules[0].allowImports = true; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - this.setParent(selectors, this); - this.setParent(this.features, this); - this.setParent(this.rules, this); -}; - -Container.prototype = Object.assign(new AtRule(), { - type: 'Container', - - ...NestableAtRulePrototype, - - genCSS(context, output) { - output.add('@container ', this._fileInfo, this._index); - this.features.genCSS(context, output); - this.outputRuleset(context, output, this.rules); - }, - - eval(context) { - if (!context.mediaBlocks) { - context.mediaBlocks = []; - context.mediaPath = []; - } - - const media = new Container(null, [], this._index, this._fileInfo, this.visibilityInfo()); - if (this.debugInfo) { - this.rules[0].debugInfo = this.debugInfo; - media.debugInfo = this.debugInfo; - } - - media.features = this.features.eval(context); - - context.mediaPath.push(media); - context.mediaBlocks.push(media); - - this.rules[0].functionRegistry = context.frames[0].functionRegistry.inherit(); - context.frames.unshift(this.rules[0]); - media.rules = [this.rules[0].eval(context)]; - context.frames.shift(); - - context.mediaPath.pop(); - - return context.mediaPath.length === 0 ? media.evalTop(context) : - media.evalNested(context); - } -}); - -export default Container; diff --git a/packages/less/src/less/tree/debug-info.js b/packages/less/src/less/tree/debug-info.js deleted file mode 100644 index b8224e5779..0000000000 --- a/packages/less/src/less/tree/debug-info.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @deprecated The dumpLineNumbers option is deprecated. Use sourcemaps instead. - * This will be removed in a future version. - * - * @param {Object} ctx - Context object with debugInfo - * @returns {string} Debug info as CSS comment - */ -function asComment(ctx) { - return `/* line ${ctx.debugInfo.lineNumber}, ${ctx.debugInfo.fileName} */\n`; -} - -/** - * @deprecated The dumpLineNumbers option is deprecated. Use sourcemaps instead. - * This function generates Sass-compatible debug info using @media -sass-debug-info syntax. - * This format had short-lived usage and is no longer recommended. - * This will be removed in a future version. - * - * @param {Object} ctx - Context object with debugInfo - * @returns {string} Sass-compatible debug info as @media query - */ -function asMediaQuery(ctx) { - let filenameWithProtocol = ctx.debugInfo.fileName; - if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) { - filenameWithProtocol = `file://${filenameWithProtocol}`; - } - return `@media -sass-debug-info{filename{font-family:${filenameWithProtocol.replace(/([.:/\\])/g, function (a) { - if (a == '\\') { - a = '/'; - } - return `\\${a}`; - })}}line{font-family:\\00003${ctx.debugInfo.lineNumber}}}\n`; -} - -/** - * Generates debug information (line numbers) for CSS output. - * - * @param {Object} context - Context object with dumpLineNumbers option - * @param {Object} ctx - Context object with debugInfo - * @param {string} [lineSeparator] - Separator between comment and media query (for 'all' mode) - * @returns {string} Debug info string - * - * @deprecated The dumpLineNumbers option is deprecated. Use sourcemaps instead. - * All modes ('comments', 'mediaquery', 'all') are deprecated and will be removed in a future version. - * The 'mediaquery' and 'all' modes generate Sass-compatible @media -sass-debug-info output - * which had short-lived usage and is no longer recommended. - */ -function debugInfo(context, ctx, lineSeparator) { - let result = ''; - if (context.dumpLineNumbers && !context.compress) { - switch (context.dumpLineNumbers) { - case 'comments': - result = asComment(ctx); - break; - case 'mediaquery': - result = asMediaQuery(ctx); - break; - case 'all': - result = asComment(ctx) + (lineSeparator || '') + asMediaQuery(ctx); - break; - } - } - return result; -} - -export default debugInfo; - diff --git a/packages/less/src/less/tree/declaration.js b/packages/less/src/less/tree/declaration.js deleted file mode 100644 index 9291f495eb..0000000000 --- a/packages/less/src/less/tree/declaration.js +++ /dev/null @@ -1,109 +0,0 @@ -import Node from './node'; -import Value from './value'; -import Keyword from './keyword'; -import Anonymous from './anonymous'; -import * as Constants from '../constants'; -const MATH = Constants.Math; - -function evalName(context, name) { - let value = ''; - let i; - const n = name.length; - const output = {add: function (s) {value += s;}}; - for (i = 0; i < n; i++) { - name[i].eval(context).genCSS(context, output); - } - return value; -} - -const Declaration = function(name, value, important, merge, index, currentFileInfo, inline, variable) { - this.name = name; - this.value = (value instanceof Node) ? value : new Value([value ? new Anonymous(value) : null]); - this.important = important ? ` ${important.trim()}` : ''; - this.merge = merge; - this._index = index; - this._fileInfo = currentFileInfo; - this.inline = inline || false; - this.variable = (variable !== undefined) ? variable - : (name.charAt && (name.charAt(0) === '@')); - this.allowRoot = true; - this.setParent(this.value, this); -}; - -Declaration.prototype = Object.assign(new Node(), { - type: 'Declaration', - - genCSS(context, output) { - output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex()); - try { - this.value.genCSS(context, output); - } - catch (e) { - e.index = this._index; - e.filename = this._fileInfo.filename; - throw e; - } - output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? '' : ';'), this._fileInfo, this._index); - }, - - eval(context) { - let mathBypass = false, prevMath, name = this.name, evaldValue, variable = this.variable; - if (typeof name !== 'string') { - // expand 'primitive' name directly to get - // things faster (~10% for benchmark.less): - name = (name.length === 1) && (name[0] instanceof Keyword) ? - name[0].value : evalName(context, name); - variable = false; // never treat expanded interpolation as new variable name - } - - // @todo remove when parens-division is default - if (name === 'font' && context.math === MATH.ALWAYS) { - mathBypass = true; - prevMath = context.math; - context.math = MATH.PARENS_DIVISION; - } - try { - context.importantScope.push({}); - evaldValue = this.value.eval(context); - - if (!this.variable && evaldValue.type === 'DetachedRuleset') { - throw { message: 'Rulesets cannot be evaluated on a property.', - index: this.getIndex(), filename: this.fileInfo().filename }; - } - let important = this.important; - const importantResult = context.importantScope.pop(); - if (!important && importantResult.important) { - important = importantResult.important; - } - - return new Declaration(name, - evaldValue, - important, - this.merge, - this.getIndex(), this.fileInfo(), this.inline, - variable); - } - catch (e) { - if (typeof e.index !== 'number') { - e.index = this.getIndex(); - e.filename = this.fileInfo().filename; - } - throw e; - } - finally { - if (mathBypass) { - context.math = prevMath; - } - } - }, - - makeImportant() { - return new Declaration(this.name, - this.value, - '!important', - this.merge, - this.getIndex(), this.fileInfo(), this.inline); - } -}); - -export default Declaration; \ No newline at end of file diff --git a/packages/less/src/less/tree/detached-ruleset.js b/packages/less/src/less/tree/detached-ruleset.js deleted file mode 100644 index de5d915354..0000000000 --- a/packages/less/src/less/tree/detached-ruleset.js +++ /dev/null @@ -1,29 +0,0 @@ -import Node from './node'; -import contexts from '../contexts'; -import * as utils from '../utils'; - -const DetachedRuleset = function(ruleset, frames) { - this.ruleset = ruleset; - this.frames = frames; - this.setParent(this.ruleset, this); -}; - -DetachedRuleset.prototype = Object.assign(new Node(), { - type: 'DetachedRuleset', - evalFirst: true, - - accept(visitor) { - this.ruleset = visitor.visit(this.ruleset); - }, - - eval(context) { - const frames = this.frames || utils.copyArray(context.frames); - return new DetachedRuleset(this.ruleset, frames); - }, - - callEval(context) { - return this.ruleset.eval(this.frames ? new contexts.Eval(context, this.frames.concat(context.frames)) : context); - } -}); - -export default DetachedRuleset; diff --git a/packages/less/src/less/tree/dimension.js b/packages/less/src/less/tree/dimension.js deleted file mode 100644 index 838bd10e97..0000000000 --- a/packages/less/src/less/tree/dimension.js +++ /dev/null @@ -1,178 +0,0 @@ -/* eslint-disable no-prototype-builtins */ -import Node from './node'; -import unitConversions from '../data/unit-conversions'; -import Unit from './unit'; -import Color from './color'; - -// -// A number with a unit -// -const Dimension = function(value, unit) { - this.value = parseFloat(value); - if (isNaN(this.value)) { - throw new Error('Dimension is not a number.'); - } - this.unit = (unit && unit instanceof Unit) ? unit : - new Unit(unit ? [unit] : undefined); - this.setParent(this.unit, this); -}; - -Dimension.prototype = Object.assign(new Node(), { - type: 'Dimension', - - accept(visitor) { - this.unit = visitor.visit(this.unit); - }, - - // remove when Nodes have JSDoc types - // eslint-disable-next-line no-unused-vars - eval(context) { - return this; - }, - - toColor() { - return new Color([this.value, this.value, this.value]); - }, - - genCSS(context, output) { - if ((context && context.strictUnits) && !this.unit.isSingular()) { - throw new Error(`Multiple units in dimension. Correct the units or use the unit function. Bad unit: ${this.unit.toString()}`); - } - - const value = this.fround(context, this.value); - let strValue = String(value); - - if (value !== 0 && value < 0.000001 && value > -0.000001) { - // would be output 1e-6 etc. - strValue = value.toFixed(20).replace(/0+$/, ''); - } - - if (context && context.compress) { - // Zero values doesn't need a unit - if (value === 0 && this.unit.isLength()) { - output.add(strValue); - return; - } - - // Float values doesn't need a leading zero - if (value > 0 && value < 1) { - strValue = (strValue).substr(1); - } - } - - output.add(strValue); - this.unit.genCSS(context, output); - }, - - // In an operation between two Dimensions, - // we default to the first Dimension's unit, - // so `1px + 2` will yield `3px`. - operate(context, op, other) { - /* jshint noempty:false */ - let value = this._operate(context, op, this.value, other.value); - let unit = this.unit.clone(); - - if (op === '+' || op === '-') { - if (unit.numerator.length === 0 && unit.denominator.length === 0) { - unit = other.unit.clone(); - if (this.unit.backupUnit) { - unit.backupUnit = this.unit.backupUnit; - } - } else if (other.unit.numerator.length === 0 && unit.denominator.length === 0) { - // do nothing - } else { - other = other.convertTo(this.unit.usedUnits()); - - if (context.strictUnits && other.unit.toString() !== unit.toString()) { - throw new Error('Incompatible units. Change the units or use the unit function. ' - + `Bad units: '${unit.toString()}' and '${other.unit.toString()}'.`); - } - - value = this._operate(context, op, this.value, other.value); - } - } else if (op === '*') { - unit.numerator = unit.numerator.concat(other.unit.numerator).sort(); - unit.denominator = unit.denominator.concat(other.unit.denominator).sort(); - unit.cancel(); - } else if (op === '/') { - unit.numerator = unit.numerator.concat(other.unit.denominator).sort(); - unit.denominator = unit.denominator.concat(other.unit.numerator).sort(); - unit.cancel(); - } - return new Dimension(value, unit); - }, - - compare(other) { - let a, b; - - if (!(other instanceof Dimension)) { - return undefined; - } - - if (this.unit.isEmpty() || other.unit.isEmpty()) { - a = this; - b = other; - } else { - a = this.unify(); - b = other.unify(); - if (a.unit.compare(b.unit) !== 0) { - return undefined; - } - } - - return Node.numericCompare(a.value, b.value); - }, - - unify() { - return this.convertTo({ length: 'px', duration: 's', angle: 'rad' }); - }, - - convertTo(conversions) { - let value = this.value; - const unit = this.unit.clone(); - let i; - let groupName; - let group; - let targetUnit; - let derivedConversions = {}; - let applyUnit; - - if (typeof conversions === 'string') { - for (i in unitConversions) { - if (unitConversions[i].hasOwnProperty(conversions)) { - derivedConversions = {}; - derivedConversions[i] = conversions; - } - } - conversions = derivedConversions; - } - applyUnit = function (atomicUnit, denominator) { - if (group.hasOwnProperty(atomicUnit)) { - if (denominator) { - value = value / (group[atomicUnit] / group[targetUnit]); - } else { - value = value * (group[atomicUnit] / group[targetUnit]); - } - - return targetUnit; - } - - return atomicUnit; - }; - - for (groupName in conversions) { - if (conversions.hasOwnProperty(groupName)) { - targetUnit = conversions[groupName]; - group = unitConversions[groupName]; - - unit.map(applyUnit); - } - } - - unit.cancel(); - - return new Dimension(value, unit); - } -}); - -export default Dimension; diff --git a/packages/less/src/less/tree/element.js b/packages/less/src/less/tree/element.js deleted file mode 100644 index 4331fbc44e..0000000000 --- a/packages/less/src/less/tree/element.js +++ /dev/null @@ -1,73 +0,0 @@ -import Node from './node'; -import Paren from './paren'; -import Combinator from './combinator'; - -const Element = function(combinator, value, isVariable, index, currentFileInfo, visibilityInfo) { - this.combinator = combinator instanceof Combinator ? - combinator : new Combinator(combinator); - - if (typeof value === 'string') { - this.value = value.trim(); - } else if (value) { - this.value = value; - } else { - this.value = ''; - } - this.isVariable = isVariable; - this._index = index; - this._fileInfo = currentFileInfo; - this.copyVisibilityInfo(visibilityInfo); - this.setParent(this.combinator, this); -} - -Element.prototype = Object.assign(new Node(), { - type: 'Element', - - accept(visitor) { - const value = this.value; - this.combinator = visitor.visit(this.combinator); - if (typeof value === 'object') { - this.value = visitor.visit(value); - } - }, - - eval(context) { - return new Element(this.combinator, - this.value.eval ? this.value.eval(context) : this.value, - this.isVariable, - this.getIndex(), - this.fileInfo(), this.visibilityInfo()); - }, - - clone() { - return new Element(this.combinator, - this.value, - this.isVariable, - this.getIndex(), - this.fileInfo(), this.visibilityInfo()); - }, - - genCSS(context, output) { - output.add(this.toCSS(context), this.fileInfo(), this.getIndex()); - }, - - toCSS(context) { - context = context || {}; - let value = this.value; - const firstSelector = context.firstSelector; - if (value instanceof Paren) { - // selector in parens should not be affected by outer selector - // flags (breaks only interpolated selectors - see #1973) - context.firstSelector = true; - } - value = value.toCSS ? value.toCSS(context) : value; - context.firstSelector = firstSelector; - if (value === '' && this.combinator.value.charAt(0) === '&') { - return ''; - } else { - return this.combinator.toCSS(context) + value; - } - } -}); - -export default Element; diff --git a/packages/less/src/less/tree/expression.js b/packages/less/src/less/tree/expression.js deleted file mode 100644 index c72f55b5b7..0000000000 --- a/packages/less/src/less/tree/expression.js +++ /dev/null @@ -1,77 +0,0 @@ -import Node from './node'; -import Paren from './paren'; -import Comment from './comment'; -import Dimension from './dimension'; -import Anonymous from './anonymous'; - -const Expression = function(value, noSpacing) { - this.value = value; - this.noSpacing = noSpacing; - if (!value) { - throw new Error('Expression requires an array parameter'); - } -}; - -Expression.prototype = Object.assign(new Node(), { - type: 'Expression', - - accept(visitor) { - this.value = visitor.visitArray(this.value); - }, - - eval(context) { - const noSpacing = this.noSpacing; - let returnValue; - const mathOn = context.isMathOn(); - const inParenthesis = this.parens; - - let doubleParen = false; - if (inParenthesis) { - context.inParenthesis(); - } - if (this.value.length > 1) { - returnValue = new Expression(this.value.map(function (e) { - if (!e.eval) { - return e; - } - return e.eval(context); - }), this.noSpacing); - } else if (this.value.length === 1) { - if (this.value[0].parens && !this.value[0].parensInOp && !context.inCalc) { - doubleParen = true; - } - returnValue = this.value[0].eval(context); - } else { - returnValue = this; - } - if (inParenthesis) { - context.outOfParenthesis(); - } - if (this.parens && this.parensInOp && !mathOn && !doubleParen - && (!(returnValue instanceof Dimension))) { - returnValue = new Paren(returnValue); - } - returnValue.noSpacing = returnValue.noSpacing || noSpacing; - return returnValue; - }, - - genCSS(context, output) { - for (let i = 0; i < this.value.length; i++) { - this.value[i].genCSS(context, output); - if (!this.noSpacing && i + 1 < this.value.length) { - if (i + 1 < this.value.length && !(this.value[i + 1] instanceof Anonymous) || - this.value[i + 1] instanceof Anonymous && this.value[i + 1].value !== ',') { - output.add(' '); - } - } - } - }, - - throwAwayComments() { - this.value = this.value.filter(function(v) { - return !(v instanceof Comment); - }); - } -}); - -export default Expression; diff --git a/packages/less/src/less/tree/extend.js b/packages/less/src/less/tree/extend.js deleted file mode 100644 index 19ca6afe50..0000000000 --- a/packages/less/src/less/tree/extend.js +++ /dev/null @@ -1,65 +0,0 @@ -import Node from './node'; -import Selector from './selector'; - -const Extend = function(selector, option, index, currentFileInfo, visibilityInfo) { - this.selector = selector; - this.option = option; - this.object_id = Extend.next_id++; - this.parent_ids = [this.object_id]; - this._index = index; - this._fileInfo = currentFileInfo; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - - switch (option) { - case '!all': - case 'all': - this.allowBefore = true; - this.allowAfter = true; - break; - default: - this.allowBefore = false; - this.allowAfter = false; - break; - } - this.setParent(this.selector, this); -}; - -Extend.prototype = Object.assign(new Node(), { - type: 'Extend', - - accept(visitor) { - this.selector = visitor.visit(this.selector); - }, - - eval(context) { - return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - }, - - // remove when Nodes have JSDoc types - // eslint-disable-next-line no-unused-vars - clone(context) { - return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - }, - - // it concatenates (joins) all selectors in selector array - findSelfSelectors(selectors) { - let selfElements = [], i, selectorElements; - - for (i = 0; i < selectors.length; i++) { - selectorElements = selectors[i].elements; - // duplicate the logic in genCSS function inside the selector node. - // future TODO - move both logics into the selector joiner visitor - if (i > 0 && selectorElements.length && selectorElements[0].combinator.value === '') { - selectorElements[0].combinator.value = ' '; - } - selfElements = selfElements.concat(selectors[i].elements); - } - - this.selfSelectors = [new Selector(selfElements)]; - this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo()); - } -}); - -Extend.next_id = 0; -export default Extend; diff --git a/packages/less/src/less/tree/import.js b/packages/less/src/less/tree/import.js deleted file mode 100644 index 0ba9e3038c..0000000000 --- a/packages/less/src/less/tree/import.js +++ /dev/null @@ -1,239 +0,0 @@ -import Node from './node'; -import Media from './media'; -import URL from './url'; -import Quoted from './quoted'; -import Ruleset from './ruleset'; -import Anonymous from './anonymous'; -import * as utils from '../utils'; -import LessError from '../less-error'; -import Expression from './expression'; - -// -// CSS @import node -// -// The general strategy here is that we don't want to wait -// for the parsing to be completed, before we start importing -// the file. That's because in the context of a browser, -// most of the time will be spent waiting for the server to respond. -// -// On creation, we push the import path to our import queue, though -// `import,push`, we also pass it a callback, which it'll call once -// the file has been fetched, and parsed. -// -const Import = function(path, features, options, index, currentFileInfo, visibilityInfo) { - this.options = options; - this._index = index; - this._fileInfo = currentFileInfo; - this.path = path; - this.features = features; - this.allowRoot = true; - - if (this.options.less !== undefined || this.options.inline) { - this.css = !this.options.less || this.options.inline; - } else { - const pathValue = this.getPath(); - if (pathValue && /[#.&?]css([?;].*)?$/.test(pathValue)) { - this.css = true; - } - } - this.copyVisibilityInfo(visibilityInfo); - this.setParent(this.features, this); - this.setParent(this.path, this); -}; - -Import.prototype = Object.assign(new Node(), { - type: 'Import', - - accept(visitor) { - if (this.features) { - this.features = visitor.visit(this.features); - } - this.path = visitor.visit(this.path); - if (!this.options.isPlugin && !this.options.inline && this.root) { - this.root = visitor.visit(this.root); - } - }, - - genCSS(context, output) { - if (this.css && this.path._fileInfo.reference === undefined) { - output.add('@import ', this._fileInfo, this._index); - this.path.genCSS(context, output); - if (this.features) { - output.add(' '); - this.features.genCSS(context, output); - } - output.add(';'); - } - }, - - getPath() { - return (this.path instanceof URL) ? - this.path.value.value : this.path.value; - }, - - isVariableImport() { - let path = this.path; - if (path instanceof URL) { - path = path.value; - } - if (path instanceof Quoted) { - return path.containsVariables(); - } - - return true; - }, - - evalForImport(context) { - let path = this.path; - - if (path instanceof URL) { - path = path.value; - } - - return new Import(path.eval(context), this.features, this.options, this._index, this._fileInfo, this.visibilityInfo()); - }, - - evalPath(context) { - const path = this.path.eval(context); - const fileInfo = this._fileInfo; - - if (!(path instanceof URL)) { - // Add the rootpath if the URL requires a rewrite - const pathValue = path.value; - if (fileInfo && - pathValue && - context.pathRequiresRewrite(pathValue)) { - path.value = context.rewritePath(pathValue, fileInfo.rootpath); - } else { - path.value = context.normalizePath(path.value); - } - } - - return path; - }, - - eval(context) { - const result = this.doEval(context); - if (this.options.reference || this.blocksVisibility()) { - if (result.length || result.length === 0) { - result.forEach(function (node) { - node.addVisibilityBlock(); - } - ); - } else { - result.addVisibilityBlock(); - } - } - return result; - }, - - doEval(context) { - let ruleset; - let registry; - const features = this.features && this.features.eval(context); - - if (this.options.isPlugin) { - if (this.root && this.root.eval) { - try { - this.root.eval(context); - } - catch (e) { - e.message = 'Plugin error during evaluation'; - throw new LessError(e, this.root.imports, this.root.filename); - } - } - registry = context.frames[0] && context.frames[0].functionRegistry; - if ( registry && this.root && this.root.functions ) { - registry.addMultiple( this.root.functions ); - } - - return []; - } - - if (this.skip) { - if (typeof this.skip === 'function') { - this.skip = this.skip(); - } - if (this.skip) { - return []; - } - } - if (this.features) { - let featureValue = this.features.value; - if (Array.isArray(featureValue) && featureValue.length >= 1) { - const expr = featureValue[0]; - if (expr.type === 'Expression' && Array.isArray(expr.value) && expr.value.length >= 2) { - featureValue = expr.value; - const isLayer = featureValue[0].type === 'Keyword' && featureValue[0].value === 'layer' - && featureValue[1].type === 'Paren'; - if (isLayer) { - this.css = false; - } - } - } - } - if (this.options.inline) { - const contents = new Anonymous(this.root, 0, - { - filename: this.importedFilename, - reference: this.path._fileInfo && this.path._fileInfo.reference - }, true, true); - - return this.features ? new Media([contents], this.features.value) : [contents]; - } else if (this.css || this.layerCss) { - const newImport = new Import(this.evalPath(context), features, this.options, this._index); - if (this.layerCss) { - newImport.css = this.layerCss; - newImport.path._fileInfo = this._fileInfo; - } - if (!newImport.css && this.error) { - throw this.error; - } - return newImport; - } else if (this.root) { - if (this.features) { - let featureValue = this.features.value; - if (Array.isArray(featureValue) && featureValue.length === 1) { - const expr = featureValue[0]; - if (expr.type === 'Expression' && Array.isArray(expr.value) && expr.value.length >= 2) { - featureValue = expr.value; - const isLayer = featureValue[0].type === 'Keyword' && featureValue[0].value === 'layer' - && featureValue[1].type === 'Paren'; - if (isLayer) { - this.layerCss = true; - featureValue[0] = new Expression(featureValue.slice(0, 2)); - featureValue.splice(1, 1); - featureValue[0].noSpacing = true; - return this; - } - } - } - } - ruleset = new Ruleset(null, utils.copyArray(this.root.rules)); - ruleset.evalImports(context); - - return this.features ? new Media(ruleset.rules, this.features.value) : ruleset.rules; - } else { - if (this.features) { - let featureValue = this.features.value; - if (Array.isArray(featureValue) && featureValue.length >= 1) { - featureValue = featureValue[0].value; - if (Array.isArray(featureValue) && featureValue.length >= 2) { - const isLayer = featureValue[0].type === 'Keyword' && featureValue[0].value === 'layer' - && featureValue[1].type === 'Paren'; - if (isLayer) { - this.css = true; - featureValue[0] = new Expression(featureValue.slice(0, 2)); - featureValue.splice(1, 1); - featureValue[0].noSpacing = true; - return this; - } - } - } - } - return []; - } - } -}); - -export default Import; diff --git a/packages/less/src/less/tree/index.js b/packages/less/src/less/tree/index.js deleted file mode 100644 index 1d4fbfdd7e..0000000000 --- a/packages/less/src/less/tree/index.js +++ /dev/null @@ -1,55 +0,0 @@ -import Node from './node'; -import Color from './color'; -import AtRule from './atrule'; -import DetachedRuleset from './detached-ruleset'; -import Operation from './operation'; -import Dimension from './dimension'; -import Unit from './unit'; -import Keyword from './keyword'; -import Variable from './variable'; -import Property from './property'; -import Ruleset from './ruleset'; -import Element from './element'; -import Attribute from './attribute'; -import Combinator from './combinator'; -import Selector from './selector'; -import Quoted from './quoted'; -import Expression from './expression'; -import Declaration from './declaration'; -import Call from './call'; -import URL from './url'; -import Import from './import'; -import Comment from './comment'; -import Anonymous from './anonymous'; -import Value from './value'; -import JavaScript from './javascript'; -import Assignment from './assignment'; -import Condition from './condition'; -import QueryInParens from './query-in-parens'; -import Paren from './paren'; -import Media from './media'; -import Container from './container'; -import UnicodeDescriptor from './unicode-descriptor'; -import Negative from './negative'; -import Extend from './extend'; -import VariableCall from './variable-call'; -import NamespaceValue from './namespace-value'; - -// mixins -import MixinCall from './mixin-call'; -import MixinDefinition from './mixin-definition'; - -export default { - Node, Color, AtRule, DetachedRuleset, Operation, - Dimension, Unit, Keyword, Variable, Property, - Ruleset, Element, Attribute, Combinator, Selector, - Quoted, Expression, Declaration, Call, URL, Import, - Comment, Anonymous, Value, JavaScript, Assignment, - Condition, Paren, Media, Container, QueryInParens, - UnicodeDescriptor, Negative, Extend, VariableCall, - NamespaceValue, - mixin: { - Call: MixinCall, - Definition: MixinDefinition - } -}; \ No newline at end of file diff --git a/packages/less/src/less/tree/javascript.js b/packages/less/src/less/tree/javascript.js deleted file mode 100644 index ebdeeed884..0000000000 --- a/packages/less/src/less/tree/javascript.js +++ /dev/null @@ -1,32 +0,0 @@ -import JsEvalNode from './js-eval-node'; -import Dimension from './dimension'; -import Quoted from './quoted'; -import Anonymous from './anonymous'; - -const JavaScript = function(string, escaped, index, currentFileInfo) { - this.escaped = escaped; - this.expression = string; - this._index = index; - this._fileInfo = currentFileInfo; -} - -JavaScript.prototype = Object.assign(new JsEvalNode(), { - type: 'JavaScript', - - eval(context) { - const result = this.evaluateJavaScript(this.expression, context); - const type = typeof result; - - if (type === 'number' && !isNaN(result)) { - return new Dimension(result); - } else if (type === 'string') { - return new Quoted(`"${result}"`, result, this.escaped, this._index); - } else if (Array.isArray(result)) { - return new Anonymous(result.join(', ')); - } else { - return new Anonymous(result); - } - } -}); - -export default JavaScript; diff --git a/packages/less/src/less/tree/js-eval-node.js b/packages/less/src/less/tree/js-eval-node.js deleted file mode 100644 index e57a22140d..0000000000 --- a/packages/less/src/less/tree/js-eval-node.js +++ /dev/null @@ -1,62 +0,0 @@ -import Node from './node'; -import Variable from './variable'; - -const JsEvalNode = function() {}; - -JsEvalNode.prototype = Object.assign(new Node(), { - evaluateJavaScript(expression, context) { - let result; - const that = this; - const evalContext = {}; - - if (!context.javascriptEnabled) { - throw { message: 'Inline JavaScript is not enabled. Is it set in your options?', - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - - expression = expression.replace(/@\{([\w-]+)\}/g, function (_, name) { - return that.jsify(new Variable(`@${name}`, that.getIndex(), that.fileInfo()).eval(context)); - }); - - try { - expression = new Function(`return (${expression})`); - } catch (e) { - throw { message: `JavaScript evaluation error: ${e.message} from \`${expression}\`` , - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - - const variables = context.frames[0].variables(); - for (const k in variables) { - // eslint-disable-next-line no-prototype-builtins - if (variables.hasOwnProperty(k)) { - evalContext[k.slice(1)] = { - value: variables[k].value, - toJS: function () { - return this.value.eval(context).toCSS(); - } - }; - } - } - - try { - result = expression.call(evalContext); - } catch (e) { - throw { message: `JavaScript evaluation error: '${e.name}: ${e.message.replace(/["]/g, '\'')}'` , - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - return result; - }, - - jsify(obj) { - if (Array.isArray(obj.value) && (obj.value.length > 1)) { - return `[${obj.value.map(function (v) { return v.toCSS(); }).join(', ')}]`; - } else { - return obj.toCSS(); - } - } -}); - -export default JsEvalNode; diff --git a/packages/less/src/less/tree/keyword.js b/packages/less/src/less/tree/keyword.js deleted file mode 100644 index d3b3704e83..0000000000 --- a/packages/less/src/less/tree/keyword.js +++ /dev/null @@ -1,19 +0,0 @@ -import Node from './node'; - -const Keyword = function(value) { - this.value = value; -}; - -Keyword.prototype = Object.assign(new Node(), { - type: 'Keyword', - - genCSS(context, output) { - if (this.value === '%') { throw { type: 'Syntax', message: 'Invalid % without number' }; } - output.add(this.value); - } -}); - -Keyword.True = new Keyword('true'); -Keyword.False = new Keyword('false'); - -export default Keyword; diff --git a/packages/less/src/less/tree/media.js b/packages/less/src/less/tree/media.js deleted file mode 100644 index 7ecd669362..0000000000 --- a/packages/less/src/less/tree/media.js +++ /dev/null @@ -1,63 +0,0 @@ -import Ruleset from './ruleset'; -import Value from './value'; -import Selector from './selector'; -import AtRule from './atrule'; -import NestableAtRulePrototype from './nested-at-rule'; - -const Media = function(value, features, index, currentFileInfo, visibilityInfo) { - this._index = index; - this._fileInfo = currentFileInfo; - - const selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors(); - - this.features = new Value(features); - this.rules = [new Ruleset(selectors, value)]; - this.rules[0].allowImports = true; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - this.setParent(selectors, this); - this.setParent(this.features, this); - this.setParent(this.rules, this); -}; - -Media.prototype = Object.assign(new AtRule(), { - type: 'Media', - - ...NestableAtRulePrototype, - - genCSS(context, output) { - output.add('@media ', this._fileInfo, this._index); - this.features.genCSS(context, output); - this.outputRuleset(context, output, this.rules); - }, - - eval(context) { - if (!context.mediaBlocks) { - context.mediaBlocks = []; - context.mediaPath = []; - } - - const media = new Media(null, [], this._index, this._fileInfo, this.visibilityInfo()); - if (this.debugInfo) { - this.rules[0].debugInfo = this.debugInfo; - media.debugInfo = this.debugInfo; - } - - media.features = this.features.eval(context); - - context.mediaPath.push(media); - context.mediaBlocks.push(media); - - this.rules[0].functionRegistry = context.frames[0].functionRegistry.inherit(); - context.frames.unshift(this.rules[0]); - media.rules = [this.rules[0].eval(context)]; - context.frames.shift(); - - context.mediaPath.pop(); - - return context.mediaPath.length === 0 ? media.evalTop(context) : - media.evalNested(context); - } -}); - -export default Media; diff --git a/packages/less/src/less/tree/mixin-call.js b/packages/less/src/less/tree/mixin-call.js deleted file mode 100644 index 36e6b41ff0..0000000000 --- a/packages/less/src/less/tree/mixin-call.js +++ /dev/null @@ -1,211 +0,0 @@ -import Node from './node'; -import Selector from './selector'; -import MixinDefinition from './mixin-definition'; -import defaultFunc from '../functions/default'; - -const MixinCall = function(elements, args, index, currentFileInfo, important) { - this.selector = new Selector(elements); - this.arguments = args || []; - this._index = index; - this._fileInfo = currentFileInfo; - this.important = important; - this.allowRoot = true; - this.setParent(this.selector, this); -}; - -MixinCall.prototype = Object.assign(new Node(), { - type: 'MixinCall', - - accept(visitor) { - if (this.selector) { - this.selector = visitor.visit(this.selector); - } - if (this.arguments.length) { - this.arguments = visitor.visitArray(this.arguments); - } - }, - - eval(context) { - let mixins; - let mixin; - let mixinPath; - const args = []; - let arg; - let argValue; - const rules = []; - let match = false; - let i; - let m; - let f; - let isRecursive; - let isOneFound; - const candidates = []; - let candidate; - const conditionResult = []; - let defaultResult; - const defFalseEitherCase = -1; - const defNone = 0; - const defTrue = 1; - const defFalse = 2; - let count; - let originalRuleset; - let noArgumentsFilter; - - this.selector = this.selector.eval(context); - - function calcDefGroup(mixin, mixinPath) { - let f, p, namespace; - - for (f = 0; f < 2; f++) { - conditionResult[f] = true; - defaultFunc.value(f); - for (p = 0; p < mixinPath.length && conditionResult[f]; p++) { - namespace = mixinPath[p]; - if (namespace.matchCondition) { - conditionResult[f] = conditionResult[f] && namespace.matchCondition(null, context); - } - } - if (mixin.matchCondition) { - conditionResult[f] = conditionResult[f] && mixin.matchCondition(args, context); - } - } - if (conditionResult[0] || conditionResult[1]) { - if (conditionResult[0] != conditionResult[1]) { - return conditionResult[1] ? - defTrue : defFalse; - } - - return defNone; - } - return defFalseEitherCase; - } - - for (i = 0; i < this.arguments.length; i++) { - arg = this.arguments[i]; - argValue = arg.value.eval(context); - if (arg.expand && Array.isArray(argValue.value)) { - argValue = argValue.value; - for (m = 0; m < argValue.length; m++) { - args.push({value: argValue[m]}); - } - } else { - args.push({name: arg.name, value: argValue}); - } - } - - noArgumentsFilter = function(rule) {return rule.matchArgs(null, context);}; - - for (i = 0; i < context.frames.length; i++) { - if ((mixins = context.frames[i].find(this.selector, null, noArgumentsFilter)).length > 0) { - isOneFound = true; - - // To make `default()` function independent of definition order we have two "subpasses" here. - // At first we evaluate each guard *twice* (with `default() == true` and `default() == false`), - // and build candidate list with corresponding flags. Then, when we know all possible matches, - // we make a final decision. - - for (m = 0; m < mixins.length; m++) { - mixin = mixins[m].rule; - mixinPath = mixins[m].path; - isRecursive = false; - for (f = 0; f < context.frames.length; f++) { - if ((!(mixin instanceof MixinDefinition)) && mixin === (context.frames[f].originalRuleset || context.frames[f])) { - isRecursive = true; - break; - } - } - if (isRecursive) { - continue; - } - - if (mixin.matchArgs(args, context)) { - candidate = {mixin, group: calcDefGroup(mixin, mixinPath)}; - - if (candidate.group !== defFalseEitherCase) { - candidates.push(candidate); - } - - match = true; - } - } - - defaultFunc.reset(); - - count = [0, 0, 0]; - for (m = 0; m < candidates.length; m++) { - count[candidates[m].group]++; - } - - if (count[defNone] > 0) { - defaultResult = defFalse; - } else { - defaultResult = defTrue; - if ((count[defTrue] + count[defFalse]) > 1) { - throw { type: 'Runtime', - message: `Ambiguous use of \`default()\` found when matching for \`${this.format(args)}\``, - index: this.getIndex(), filename: this.fileInfo().filename }; - } - } - - for (m = 0; m < candidates.length; m++) { - candidate = candidates[m].group; - if ((candidate === defNone) || (candidate === defaultResult)) { - try { - mixin = candidates[m].mixin; - if (!(mixin instanceof MixinDefinition)) { - originalRuleset = mixin.originalRuleset || mixin; - mixin = new MixinDefinition('', [], mixin.rules, null, false, null, originalRuleset.visibilityInfo()); - mixin.originalRuleset = originalRuleset; - } - const newRules = mixin.evalCall(context, args, this.important).rules; - this._setVisibilityToReplacement(newRules); - Array.prototype.push.apply(rules, newRules); - } catch (e) { - throw { message: e.message, index: this.getIndex(), filename: this.fileInfo().filename, stack: e.stack }; - } - } - } - - if (match) { - return rules; - } - } - } - if (isOneFound) { - throw { type: 'Runtime', - message: `No matching definition was found for \`${this.format(args)}\``, - index: this.getIndex(), filename: this.fileInfo().filename }; - } else { - throw { type: 'Name', - message: `${this.selector.toCSS().trim()} is undefined`, - index: this.getIndex(), filename: this.fileInfo().filename }; - } - }, - - _setVisibilityToReplacement(replacement) { - let i, rule; - if (this.blocksVisibility()) { - for (i = 0; i < replacement.length; i++) { - rule = replacement[i]; - rule.addVisibilityBlock(); - } - } - }, - - format(args) { - return `${this.selector.toCSS().trim()}(${args ? args.map(function (a) { - let argValue = ''; - if (a.name) { - argValue += `${a.name}:`; - } - if (a.value.toCSS) { - argValue += a.value.toCSS(); - } else { - argValue += '???'; - } - return argValue; - }).join(', ') : ''})`; - } -}); - -export default MixinCall; diff --git a/packages/less/src/less/tree/mixin-definition.js b/packages/less/src/less/tree/mixin-definition.js deleted file mode 100644 index eb22c44b03..0000000000 --- a/packages/less/src/less/tree/mixin-definition.js +++ /dev/null @@ -1,228 +0,0 @@ -import Selector from './selector'; -import Element from './element'; -import Ruleset from './ruleset'; -import Declaration from './declaration'; -import DetachedRuleset from './detached-ruleset'; -import Expression from './expression'; -import contexts from '../contexts'; -import * as utils from '../utils'; - -const Definition = function(name, params, rules, condition, variadic, frames, visibilityInfo) { - this.name = name || 'anonymous mixin'; - this.selectors = [new Selector([new Element(null, name, false, this._index, this._fileInfo)])]; - this.params = params; - this.condition = condition; - this.variadic = variadic; - this.arity = params.length; - this.rules = rules; - this._lookups = {}; - const optionalParameters = []; - this.required = params.reduce(function (count, p) { - if (!p.name || (p.name && !p.value)) { - return count + 1; - } - else { - optionalParameters.push(p.name); - return count; - } - }, 0); - this.optionalParameters = optionalParameters; - this.frames = frames; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; -} - -Definition.prototype = Object.assign(new Ruleset(), { - type: 'MixinDefinition', - evalFirst: true, - - accept(visitor) { - if (this.params && this.params.length) { - this.params = visitor.visitArray(this.params); - } - this.rules = visitor.visitArray(this.rules); - if (this.condition) { - this.condition = visitor.visit(this.condition); - } - }, - - evalParams(context, mixinEnv, args, evaldArguments) { - /* jshint boss:true */ - const frame = new Ruleset(null, null); - - let varargs; - let arg; - const params = utils.copyArray(this.params); - let i; - let j; - let val; - let name; - let isNamedFound; - let argIndex; - let argsLength = 0; - - if (mixinEnv.frames && mixinEnv.frames[0] && mixinEnv.frames[0].functionRegistry) { - frame.functionRegistry = mixinEnv.frames[0].functionRegistry.inherit(); - } - mixinEnv = new contexts.Eval(mixinEnv, [frame].concat(mixinEnv.frames)); - - if (args) { - args = utils.copyArray(args); - argsLength = args.length; - - for (i = 0; i < argsLength; i++) { - arg = args[i]; - if (name = (arg && arg.name)) { - isNamedFound = false; - for (j = 0; j < params.length; j++) { - if (!evaldArguments[j] && name === params[j].name) { - evaldArguments[j] = arg.value.eval(context); - frame.prependRule(new Declaration(name, arg.value.eval(context))); - isNamedFound = true; - break; - } - } - if (isNamedFound) { - args.splice(i, 1); - i--; - continue; - } else { - throw { type: 'Runtime', message: `Named argument for ${this.name} ${args[i].name} not found` }; - } - } - } - } - argIndex = 0; - for (i = 0; i < params.length; i++) { - if (evaldArguments[i]) { continue; } - - arg = args && args[argIndex]; - - if (name = params[i].name) { - if (params[i].variadic) { - varargs = []; - for (j = argIndex; j < argsLength; j++) { - varargs.push(args[j].value.eval(context)); - } - frame.prependRule(new Declaration(name, new Expression(varargs).eval(context))); - } else { - val = arg && arg.value; - if (val) { - // This was a mixin call, pass in a detached ruleset of it's eval'd rules - if (Array.isArray(val)) { - val = new DetachedRuleset(new Ruleset('', val)); - } - else { - val = val.eval(context); - } - } else if (params[i].value) { - val = params[i].value.eval(mixinEnv); - frame.resetCache(); - } else { - throw { type: 'Runtime', message: `wrong number of arguments for ${this.name} (${argsLength} for ${this.arity})` }; - } - - frame.prependRule(new Declaration(name, val)); - evaldArguments[i] = val; - } - } - - if (params[i].variadic && args) { - for (j = argIndex; j < argsLength; j++) { - evaldArguments[j] = args[j].value.eval(context); - } - } - argIndex++; - } - - return frame; - }, - - makeImportant() { - const rules = !this.rules ? this.rules : this.rules.map(function (r) { - if (r.makeImportant) { - return r.makeImportant(true); - } else { - return r; - } - }); - const result = new Definition(this.name, this.params, rules, this.condition, this.variadic, this.frames); - return result; - }, - - eval(context) { - return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || utils.copyArray(context.frames)); - }, - - evalCall(context, args, important) { - const _arguments = []; - const mixinFrames = this.frames ? this.frames.concat(context.frames) : context.frames; - const frame = this.evalParams(context, new contexts.Eval(context, mixinFrames), args, _arguments); - let rules; - let ruleset; - - frame.prependRule(new Declaration('@arguments', new Expression(_arguments).eval(context))); - - rules = utils.copyArray(this.rules); - - ruleset = new Ruleset(null, rules); - ruleset.originalRuleset = this; - ruleset = ruleset.eval(new contexts.Eval(context, [this, frame].concat(mixinFrames))); - if (important) { - ruleset = ruleset.makeImportant(); - } - return ruleset; - }, - - matchCondition(args, context) { - if (this.condition && !this.condition.eval( - new contexts.Eval(context, - [this.evalParams(context, /* the parameter variables */ - new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])] - .concat(this.frames || []) // the parent namespace/mixin frames - .concat(context.frames)))) { // the current environment frames - return false; - } - return true; - }, - - matchArgs(args, context) { - const allArgsCnt = (args && args.length) || 0; - let len; - const optionalParameters = this.optionalParameters; - const requiredArgsCnt = !args ? 0 : args.reduce(function (count, p) { - if (optionalParameters.indexOf(p.name) < 0) { - return count + 1; - } else { - return count; - } - }, 0); - - if (!this.variadic) { - if (requiredArgsCnt < this.required) { - return false; - } - if (allArgsCnt > this.params.length) { - return false; - } - } else { - if (requiredArgsCnt < (this.required - 1)) { - return false; - } - } - - // check patterns - len = Math.min(requiredArgsCnt, this.arity); - - for (let i = 0; i < len; i++) { - if (!this.params[i].name && !this.params[i].variadic) { - if (args[i].value.eval(context).toCSS() != this.params[i].value.eval(context).toCSS()) { - return false; - } - } - } - return true; - } -}); - -export default Definition; diff --git a/packages/less/src/less/tree/namespace-value.js b/packages/less/src/less/tree/namespace-value.js deleted file mode 100644 index fd96ef6121..0000000000 --- a/packages/less/src/less/tree/namespace-value.js +++ /dev/null @@ -1,82 +0,0 @@ -import Node from './node'; -import Variable from './variable'; -import Ruleset from './ruleset'; -import Selector from './selector'; - -const NamespaceValue = function(ruleCall, lookups, index, fileInfo) { - this.value = ruleCall; - this.lookups = lookups; - this._index = index; - this._fileInfo = fileInfo; -}; - -NamespaceValue.prototype = Object.assign(new Node(), { - type: 'NamespaceValue', - - eval(context) { - let i, name, rules = this.value.eval(context); - - for (i = 0; i < this.lookups.length; i++) { - name = this.lookups[i]; - - /** - * Eval'd DRs return rulesets. - * Eval'd mixins return rules, so let's make a ruleset if we need it. - * We need to do this because of late parsing of values - */ - if (Array.isArray(rules)) { - rules = new Ruleset([new Selector()], rules); - } - - if (name === '') { - rules = rules.lastDeclaration(); - } - else if (name.charAt(0) === '@') { - if (name.charAt(1) === '@') { - name = `@${new Variable(name.substr(1)).eval(context).value}`; - } - if (rules.variables) { - rules = rules.variable(name); - } - - if (!rules) { - throw { type: 'Name', - message: `variable ${name} not found`, - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - } - else { - if (name.substring(0, 2) === '$@') { - name = `$${new Variable(name.substr(1)).eval(context).value}`; - } - else { - name = name.charAt(0) === '$' ? name : `$${name}`; - } - if (rules.properties) { - rules = rules.property(name); - } - - if (!rules) { - throw { type: 'Name', - message: `property "${name.substr(1)}" not found`, - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - // Properties are an array of values, since a ruleset can have multiple props. - // We pick the last one (the "cascaded" value) - rules = rules[rules.length - 1]; - } - - if (rules.value) { - rules = rules.eval(context).value; - } - if (rules.ruleset) { - rules = rules.ruleset.eval(context); - } - } - return rules; - } -}); - -export default NamespaceValue; diff --git a/packages/less/src/less/tree/negative.js b/packages/less/src/less/tree/negative.js deleted file mode 100644 index 7e1bcf1b2c..0000000000 --- a/packages/less/src/less/tree/negative.js +++ /dev/null @@ -1,25 +0,0 @@ -import Node from './node'; -import Operation from './operation'; -import Dimension from './dimension'; - -const Negative = function(node) { - this.value = node; -}; - -Negative.prototype = Object.assign(new Node(), { - type: 'Negative', - - genCSS(context, output) { - output.add('-'); - this.value.genCSS(context, output); - }, - - eval(context) { - if (context.isMathOn()) { - return (new Operation('*', [new Dimension(-1), this.value])).eval(context); - } - return new Negative(this.value.eval(context)); - } -}); - -export default Negative; diff --git a/packages/less/src/less/tree/nested-at-rule.js b/packages/less/src/less/tree/nested-at-rule.js deleted file mode 100644 index fc383f3447..0000000000 --- a/packages/less/src/less/tree/nested-at-rule.js +++ /dev/null @@ -1,134 +0,0 @@ -import Ruleset from './ruleset'; -import Value from './value'; -import Selector from './selector'; -import Anonymous from './anonymous'; -import Expression from './expression'; -import * as utils from '../utils'; - -const NestableAtRulePrototype = { - - isRulesetLike() { - return true; - }, - - accept(visitor) { - if (this.features) { - this.features = visitor.visit(this.features); - } - if (this.rules) { - this.rules = visitor.visitArray(this.rules); - } - }, - - evalFunction: function () { - if (!this.features || !Array.isArray(this.features.value) || this.features.value.length < 1) { - return; - } - - const exprValues = this.features.value; - let expr, paren; - - for (let index = 0; index < exprValues.length; ++index) { - expr = exprValues[index]; - - if (expr.type === 'Keyword' && index + 1 < exprValues.length && (expr.noSpacing || expr.noSpacing == null)) { - paren = exprValues[index + 1]; - - if (paren.type === 'Paren' && paren.noSpacing) { - exprValues[index]= new Expression([expr, paren]); - exprValues.splice(index + 1, 1); - exprValues[index].noSpacing = true; - } - } - } - }, - - evalTop(context) { - this.evalFunction(); - - let result = this; - - // Render all dependent Media blocks. - if (context.mediaBlocks.length > 1) { - const selectors = (new Selector([], null, null, this.getIndex(), this.fileInfo())).createEmptySelectors(); - result = new Ruleset(selectors, context.mediaBlocks); - result.multiMedia = true; - result.copyVisibilityInfo(this.visibilityInfo()); - this.setParent(result, this); - } - - delete context.mediaBlocks; - delete context.mediaPath; - - return result; - }, - - evalNested(context) { - this.evalFunction(); - - let i; - let value; - const path = context.mediaPath.concat([this]); - - // Extract the media-query conditions separated with `,` (OR). - for (i = 0; i < path.length; i++) { - if (path[i].type !== this.type) { - context.mediaBlocks.splice(i, 1); - - return this; - } - - value = path[i].features instanceof Value ? - path[i].features.value : path[i].features; - path[i] = Array.isArray(value) ? value : [value]; - } - - // Trace all permutations to generate the resulting media-query. - // - // (a, b and c) with nested (d, e) -> - // a and d - // a and e - // b and c and d - // b and c and e - this.features = new Value(this.permute(path).map(path => { - path = path.map(fragment => fragment.toCSS ? fragment : new Anonymous(fragment)); - - for (i = path.length - 1; i > 0; i--) { - path.splice(i, 0, new Anonymous('and')); - } - - return new Expression(path); - })); - this.setParent(this.features, this); - - // Fake a tree-node that doesn't output anything. - return new Ruleset([], []); - }, - - permute(arr) { - if (arr.length === 0) { - return []; - } else if (arr.length === 1) { - return arr[0]; - } else { - const result = []; - const rest = this.permute(arr.slice(1)); - for (let i = 0; i < rest.length; i++) { - for (let j = 0; j < arr[0].length; j++) { - result.push([arr[0][j]].concat(rest[i])); - } - } - return result; - } - }, - - bubbleSelectors(selectors) { - if (!selectors) { - return; - } - this.rules = [new Ruleset(utils.copyArray(selectors), [this.rules[0]])]; - this.setParent(this.rules, this); - } -}; - -export default NestableAtRulePrototype; diff --git a/packages/less/src/less/tree/node.js b/packages/less/src/less/tree/node.js deleted file mode 100644 index a573903074..0000000000 --- a/packages/less/src/less/tree/node.js +++ /dev/null @@ -1,186 +0,0 @@ -/** - * The reason why Node is a class and other nodes simply do not extend - * from Node (since we're transpiling) is due to this issue: - * - * @see https://github.com/less/less.js/issues/3434 - */ -class Node { - constructor() { - this.parent = null; - this.visibilityBlocks = undefined; - this.nodeVisible = undefined; - this.rootNode = null; - this.parsed = null; - } - - get currentFileInfo() { - return this.fileInfo(); - } - - get index() { - return this.getIndex(); - } - - setParent(nodes, parent) { - function set(node) { - if (node && node instanceof Node) { - node.parent = parent; - } - } - if (Array.isArray(nodes)) { - nodes.forEach(set); - } - else { - set(nodes); - } - } - - getIndex() { - return this._index || (this.parent && this.parent.getIndex()) || 0; - } - - fileInfo() { - return this._fileInfo || (this.parent && this.parent.fileInfo()) || {}; - } - - isRulesetLike() { return false; } - - toCSS(context) { - const strs = []; - this.genCSS(context, { - // remove when genCSS has JSDoc types - // eslint-disable-next-line no-unused-vars - add: function(chunk, fileInfo, index) { - strs.push(chunk); - }, - isEmpty: function () { - return strs.length === 0; - } - }); - return strs.join(''); - } - - genCSS(context, output) { - output.add(this.value); - } - - accept(visitor) { - this.value = visitor.visit(this.value); - } - - eval() { return this; } - - _operate(context, op, a, b) { - switch (op) { - case '+': return a + b; - case '-': return a - b; - case '*': return a * b; - case '/': return a / b; - } - } - - fround(context, value) { - const precision = context && context.numPrecision; - // add "epsilon" to ensure numbers like 1.000000005 (represented as 1.000000004999...) are properly rounded: - return (precision) ? Number((value + 2e-16).toFixed(precision)) : value; - } - - static compare(a, b) { - /* returns: - -1: a < b - 0: a = b - 1: a > b - and *any* other value for a != b (e.g. undefined, NaN, -2 etc.) */ - - if ((a.compare) && - // for "symmetric results" force toCSS-based comparison - // of Quoted or Anonymous if either value is one of those - !(b.type === 'Quoted' || b.type === 'Anonymous')) { - return a.compare(b); - } else if (b.compare) { - return -b.compare(a); - } else if (a.type !== b.type) { - return undefined; - } - - a = a.value; - b = b.value; - if (!Array.isArray(a)) { - return a === b ? 0 : undefined; - } - if (a.length !== b.length) { - return undefined; - } - for (let i = 0; i < a.length; i++) { - if (Node.compare(a[i], b[i]) !== 0) { - return undefined; - } - } - return 0; - } - - static numericCompare(a, b) { - return a < b ? -1 - : a === b ? 0 - : a > b ? 1 : undefined; - } - - // Returns true if this node represents root of ast imported by reference - blocksVisibility() { - if (this.visibilityBlocks === undefined) { - this.visibilityBlocks = 0; - } - return this.visibilityBlocks !== 0; - } - - addVisibilityBlock() { - if (this.visibilityBlocks === undefined) { - this.visibilityBlocks = 0; - } - this.visibilityBlocks = this.visibilityBlocks + 1; - } - - removeVisibilityBlock() { - if (this.visibilityBlocks === undefined) { - this.visibilityBlocks = 0; - } - this.visibilityBlocks = this.visibilityBlocks - 1; - } - - // Turns on node visibility - if called node will be shown in output regardless - // of whether it comes from import by reference or not - ensureVisibility() { - this.nodeVisible = true; - } - - // Turns off node visibility - if called node will NOT be shown in output regardless - // of whether it comes from import by reference or not - ensureInvisibility() { - this.nodeVisible = false; - } - - // return values: - // false - the node must not be visible - // true - the node must be visible - // undefined or null - the node has the same visibility as its parent - isVisible() { - return this.nodeVisible; - } - - visibilityInfo() { - return { - visibilityBlocks: this.visibilityBlocks, - nodeVisible: this.nodeVisible - }; - } - - copyVisibilityInfo(info) { - if (!info) { - return; - } - this.visibilityBlocks = info.visibilityBlocks; - this.nodeVisible = info.nodeVisible; - } -} - -export default Node; diff --git a/packages/less/src/less/tree/operation.js b/packages/less/src/less/tree/operation.js deleted file mode 100644 index 2805326be1..0000000000 --- a/packages/less/src/less/tree/operation.js +++ /dev/null @@ -1,62 +0,0 @@ -import Node from './node'; -import Color from './color'; -import Dimension from './dimension'; -import * as Constants from '../constants'; -const MATH = Constants.Math; - - -const Operation = function(op, operands, isSpaced) { - this.op = op.trim(); - this.operands = operands; - this.isSpaced = isSpaced; -}; - -Operation.prototype = Object.assign(new Node(), { - type: 'Operation', - - accept(visitor) { - this.operands = visitor.visitArray(this.operands); - }, - - eval(context) { - let a = this.operands[0].eval(context), b = this.operands[1].eval(context), op; - - if (context.isMathOn(this.op)) { - op = this.op === './' ? '/' : this.op; - if (a instanceof Dimension && b instanceof Color) { - a = a.toColor(); - } - if (b instanceof Dimension && a instanceof Color) { - b = b.toColor(); - } - if (!a.operate || !b.operate) { - if ( - (a instanceof Operation || b instanceof Operation) - && a.op === '/' && context.math === MATH.PARENS_DIVISION - ) { - return new Operation(this.op, [a, b], this.isSpaced); - } - throw { type: 'Operation', - message: 'Operation on an invalid type' }; - } - - return a.operate(context, op, b); - } else { - return new Operation(this.op, [a, b], this.isSpaced); - } - }, - - genCSS(context, output) { - this.operands[0].genCSS(context, output); - if (this.isSpaced) { - output.add(' '); - } - output.add(this.op); - if (this.isSpaced) { - output.add(' '); - } - this.operands[1].genCSS(context, output); - } -}); - -export default Operation; diff --git a/packages/less/src/less/tree/paren.js b/packages/less/src/less/tree/paren.js deleted file mode 100644 index 248bfde6c4..0000000000 --- a/packages/less/src/less/tree/paren.js +++ /dev/null @@ -1,27 +0,0 @@ -import Node from './node'; - -const Paren = function(node) { - this.value = node; -}; - -Paren.prototype = Object.assign(new Node(), { - type: 'Paren', - - genCSS(context, output) { - output.add('('); - this.value.genCSS(context, output); - output.add(')'); - }, - - eval(context) { - const paren = new Paren(this.value.eval(context)); - - if (this.noSpacing) { - paren.noSpacing = true; - } - - return paren; - } -}); - -export default Paren; diff --git a/packages/less/src/less/tree/property.js b/packages/less/src/less/tree/property.js deleted file mode 100644 index d3b34fce71..0000000000 --- a/packages/less/src/less/tree/property.js +++ /dev/null @@ -1,76 +0,0 @@ -import Node from './node'; -import Declaration from './declaration'; - -const Property = function(name, index, currentFileInfo) { - this.name = name; - this._index = index; - this._fileInfo = currentFileInfo; -}; - -Property.prototype = Object.assign(new Node(), { - type: 'Property', - - eval(context) { - let property; - const name = this.name; - // TODO: shorten this reference - const mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules; - - if (this.evaluating) { - throw { type: 'Name', - message: `Recursive property reference for ${name}`, - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - - this.evaluating = true; - - property = this.find(context.frames, function (frame) { - let v; - const vArr = frame.property(name); - if (vArr) { - for (let i = 0; i < vArr.length; i++) { - v = vArr[i]; - - vArr[i] = new Declaration(v.name, - v.value, - v.important, - v.merge, - v.index, - v.currentFileInfo, - v.inline, - v.variable - ); - } - mergeRules(vArr); - - v = vArr[vArr.length - 1]; - if (v.important) { - const importantScope = context.importantScope[context.importantScope.length - 1]; - importantScope.important = v.important; - } - v = v.value.eval(context); - return v; - } - }); - if (property) { - this.evaluating = false; - return property; - } else { - throw { type: 'Name', - message: `Property '${name}' is undefined`, - filename: this.currentFileInfo.filename, - index: this.index }; - } - }, - - find(obj, fun) { - for (let i = 0, r; i < obj.length; i++) { - r = fun.call(obj, obj[i]); - if (r) { return r; } - } - return null; - } -}); - -export default Property; diff --git a/packages/less/src/less/tree/query-in-parens.js b/packages/less/src/less/tree/query-in-parens.js deleted file mode 100644 index 40b48a71c2..0000000000 --- a/packages/less/src/less/tree/query-in-parens.js +++ /dev/null @@ -1,80 +0,0 @@ -import { copy } from 'copy-anything'; -import Declaration from './declaration'; -import Node from './node'; - -const QueryInParens = function (op, l, m, op2, r, i) { - this.op = op.trim(); - this.lvalue = l; - this.mvalue = m; - this.op2 = op2 ? op2.trim() : null; - this.rvalue = r; - this._index = i; - this.mvalues = []; -}; - -QueryInParens.prototype = Object.assign(new Node(), { - type: 'QueryInParens', - - accept(visitor) { - this.lvalue = visitor.visit(this.lvalue); - this.mvalue = visitor.visit(this.mvalue); - if (this.rvalue) { - this.rvalue = visitor.visit(this.rvalue); - } - }, - - eval(context) { - this.lvalue = this.lvalue.eval(context); - - let variableDeclaration; - let rule; - - for (let i = 0; (rule = context.frames[i]); i++) { - if (rule.type === 'Ruleset') { - variableDeclaration = rule.rules.find(function (r) { - if ((r instanceof Declaration) && r.variable) { - return true; - } - - return false; - }); - - if (variableDeclaration) { - break; - } - } - } - - if (!this.mvalueCopy) { - this.mvalueCopy = copy(this.mvalue); - } - - if (variableDeclaration) { - this.mvalue = this.mvalueCopy; - this.mvalue = this.mvalue.eval(context); - this.mvalues.push(this.mvalue); - } else { - this.mvalue = this.mvalue.eval(context); - } - - if (this.rvalue) { - this.rvalue = this.rvalue.eval(context); - } - return this; - }, - - genCSS(context, output) { - this.lvalue.genCSS(context, output); - output.add(' ' + this.op + ' '); - if (this.mvalues.length > 0) { - this.mvalue = this.mvalues.shift(); - } - this.mvalue.genCSS(context, output); - if (this.rvalue) { - output.add(' ' + this.op2 + ' '); - this.rvalue.genCSS(context, output); - } - }, -}); - -export default QueryInParens; diff --git a/packages/less/src/less/tree/quoted.js b/packages/less/src/less/tree/quoted.js deleted file mode 100644 index 811f6001ac..0000000000 --- a/packages/less/src/less/tree/quoted.js +++ /dev/null @@ -1,67 +0,0 @@ -import Node from './node'; -import Variable from './variable'; -import Property from './property'; - -const Quoted = function(str, content, escaped, index, currentFileInfo) { - this.escaped = (escaped === undefined) ? true : escaped; - this.value = content || ''; - this.quote = str.charAt(0); - this._index = index; - this._fileInfo = currentFileInfo; - this.variableRegex = /@\{([\w-]+)\}/g; - this.propRegex = /\$\{([\w-]+)\}/g; - this.allowRoot = escaped; -}; - -Quoted.prototype = Object.assign(new Node(), { - type: 'Quoted', - - genCSS(context, output) { - if (!this.escaped) { - output.add(this.quote, this.fileInfo(), this.getIndex()); - } - output.add(this.value); - if (!this.escaped) { - output.add(this.quote); - } - }, - - containsVariables() { - return this.value.match(this.variableRegex); - }, - - eval(context) { - const that = this; - let value = this.value; - const variableReplacement = function (_, name1, name2) { - const v = new Variable(`@${name1 ?? name2}`, that.getIndex(), that.fileInfo()).eval(context, true); - return (v instanceof Quoted) ? v.value : v.toCSS(); - }; - const propertyReplacement = function (_, name1, name2) { - const v = new Property(`$${name1 ?? name2}`, that.getIndex(), that.fileInfo()).eval(context, true); - return (v instanceof Quoted) ? v.value : v.toCSS(); - }; - function iterativeReplace(value, regexp, replacementFnc) { - let evaluatedValue = value; - do { - value = evaluatedValue.toString(); - evaluatedValue = value.replace(regexp, replacementFnc); - } while (value !== evaluatedValue); - return evaluatedValue; - } - value = iterativeReplace(value, this.variableRegex, variableReplacement); - value = iterativeReplace(value, this.propRegex, propertyReplacement); - return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo()); - }, - - compare(other) { - // when comparing quoted strings allow the quote to differ - if (other.type === 'Quoted' && !this.escaped && !other.escaped) { - return Node.numericCompare(this.value, other.value); - } else { - return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined; - } - } -}); - -export default Quoted; diff --git a/packages/less/src/less/tree/ruleset.js b/packages/less/src/less/tree/ruleset.js deleted file mode 100644 index a3324cf076..0000000000 --- a/packages/less/src/less/tree/ruleset.js +++ /dev/null @@ -1,848 +0,0 @@ -import Node from './node'; -import Declaration from './declaration'; -import Keyword from './keyword'; -import Comment from './comment'; -import Paren from './paren'; -import Selector from './selector'; -import Element from './element'; -import Anonymous from './anonymous'; -import contexts from '../contexts'; -import globalFunctionRegistry from '../functions/function-registry'; -import defaultFunc from '../functions/default'; -import getDebugInfo from './debug-info'; -import * as utils from '../utils'; -import Parser from '../parser/parser'; - -const Ruleset = function(selectors, rules, strictImports, visibilityInfo) { - this.selectors = selectors; - this.rules = rules; - this._lookups = {}; - this._variables = null; - this._properties = null; - this.strictImports = strictImports; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; - - this.setParent(this.selectors, this); - this.setParent(this.rules, this); -} - -Ruleset.prototype = Object.assign(new Node(), { - type: 'Ruleset', - isRuleset: true, - - isRulesetLike() { return true; }, - - accept(visitor) { - if (this.paths) { - this.paths = visitor.visitArray(this.paths, true); - } else if (this.selectors) { - this.selectors = visitor.visitArray(this.selectors); - } - if (this.rules && this.rules.length) { - this.rules = visitor.visitArray(this.rules); - } - }, - - eval(context) { - let selectors; - let selCnt; - let selector; - let i; - let hasVariable; - let hasOnePassingSelector = false; - - if (this.selectors && (selCnt = this.selectors.length)) { - selectors = new Array(selCnt); - defaultFunc.error({ - type: 'Syntax', - message: 'it is currently only allowed in parametric mixin guards,' - }); - - for (i = 0; i < selCnt; i++) { - selector = this.selectors[i].eval(context); - for (let j = 0; j < selector.elements.length; j++) { - if (selector.elements[j].isVariable) { - hasVariable = true; - break; - } - } - selectors[i] = selector; - if (selector.evaldCondition) { - hasOnePassingSelector = true; - } - } - - if (hasVariable) { - const toParseSelectors = new Array(selCnt); - for (i = 0; i < selCnt; i++) { - selector = selectors[i]; - toParseSelectors[i] = selector.toCSS(context); - } - const startingIndex = selectors[0].getIndex(); - const selectorFileInfo = selectors[0].fileInfo(); - new Parser(context, this.parse.importManager, selectorFileInfo, startingIndex).parseNode( - toParseSelectors.join(','), - ['selectors'], - function(err, result) { - if (result) { - selectors = utils.flattenArray(result); - } - }); - } - - defaultFunc.reset(); - } else { - hasOnePassingSelector = true; - } - - let rules = this.rules ? utils.copyArray(this.rules) : null; - const ruleset = new Ruleset(selectors, rules, this.strictImports, this.visibilityInfo()); - let rule; - let subRule; - - ruleset.originalRuleset = this; - ruleset.root = this.root; - ruleset.firstRoot = this.firstRoot; - ruleset.allowImports = this.allowImports; - - if (this.debugInfo) { - ruleset.debugInfo = this.debugInfo; - } - - if (!hasOnePassingSelector) { - rules.length = 0; - } - - // inherit a function registry from the frames stack when possible; - // otherwise from the global registry - ruleset.functionRegistry = (function (frames) { - let i = 0; - const n = frames.length; - let found; - for ( ; i !== n ; ++i ) { - found = frames[ i ].functionRegistry; - if ( found ) { return found; } - } - return globalFunctionRegistry; - }(context.frames)).inherit(); - - // push the current ruleset to the frames stack - const ctxFrames = context.frames; - ctxFrames.unshift(ruleset); - - // currrent selectors - let ctxSelectors = context.selectors; - if (!ctxSelectors) { - context.selectors = ctxSelectors = []; - } - ctxSelectors.unshift(this.selectors); - - // Evaluate imports - if (ruleset.root || ruleset.allowImports || !ruleset.strictImports) { - ruleset.evalImports(context); - } - - // Store the frames around mixin definitions, - // so they can be evaluated like closures when the time comes. - const rsRules = ruleset.rules; - for (i = 0; (rule = rsRules[i]); i++) { - if (rule.evalFirst) { - rsRules[i] = rule.eval(context); - } - } - - const mediaBlockCount = (context.mediaBlocks && context.mediaBlocks.length) || 0; - - // Evaluate mixin calls. - for (i = 0; (rule = rsRules[i]); i++) { - if (rule.type === 'MixinCall') { - /* jshint loopfunc:true */ - rules = rule.eval(context).filter(function(r) { - if ((r instanceof Declaration) && r.variable) { - // do not pollute the scope if the variable is - // already there. consider returning false here - // but we need a way to "return" variable from mixins - return !(ruleset.variable(r.name)); - } - return true; - }); - rsRules.splice.apply(rsRules, [i, 1].concat(rules)); - i += rules.length - 1; - ruleset.resetCache(); - } else if (rule.type === 'VariableCall') { - /* jshint loopfunc:true */ - rules = rule.eval(context).rules.filter(function(r) { - if ((r instanceof Declaration) && r.variable) { - // do not pollute the scope at all - return false; - } - return true; - }); - rsRules.splice.apply(rsRules, [i, 1].concat(rules)); - i += rules.length - 1; - ruleset.resetCache(); - } - } - - // Evaluate everything else - for (i = 0; (rule = rsRules[i]); i++) { - if (!rule.evalFirst) { - rsRules[i] = rule = rule.eval ? rule.eval(context) : rule; - } - } - - // Evaluate everything else - for (i = 0; (rule = rsRules[i]); i++) { - // for rulesets, check if it is a css guard and can be removed - if (rule instanceof Ruleset && rule.selectors && rule.selectors.length === 1) { - // check if it can be folded in (e.g. & where) - if (rule.selectors[0] && rule.selectors[0].isJustParentSelector()) { - rsRules.splice(i--, 1); - - for (let j = 0; (subRule = rule.rules[j]); j++) { - if (subRule instanceof Node) { - subRule.copyVisibilityInfo(rule.visibilityInfo()); - if (!(subRule instanceof Declaration) || !subRule.variable) { - rsRules.splice(++i, 0, subRule); - } - } - } - } - } - } - - // Pop the stack - ctxFrames.shift(); - ctxSelectors.shift(); - - if (context.mediaBlocks) { - for (i = mediaBlockCount; i < context.mediaBlocks.length; i++) { - context.mediaBlocks[i].bubbleSelectors(selectors); - } - } - - return ruleset; - }, - - evalImports(context) { - const rules = this.rules; - let i; - let importRules; - if (!rules) { return; } - - for (i = 0; i < rules.length; i++) { - if (rules[i].type === 'Import') { - importRules = rules[i].eval(context); - if (importRules && (importRules.length || importRules.length === 0)) { - rules.splice.apply(rules, [i, 1].concat(importRules)); - i += importRules.length - 1; - } else { - rules.splice(i, 1, importRules); - } - this.resetCache(); - } - } - }, - - makeImportant() { - const result = new Ruleset(this.selectors, this.rules.map(function (r) { - if (r.makeImportant) { - return r.makeImportant(); - } else { - return r; - } - }), this.strictImports, this.visibilityInfo()); - - return result; - }, - - matchArgs(args) { - return !args || args.length === 0; - }, - - // lets you call a css selector with a guard - matchCondition(args, context) { - const lastSelector = this.selectors[this.selectors.length - 1]; - if (!lastSelector.evaldCondition) { - return false; - } - if (lastSelector.condition && - !lastSelector.condition.eval( - new contexts.Eval(context, - context.frames))) { - return false; - } - return true; - }, - - resetCache() { - this._rulesets = null; - this._variables = null; - this._properties = null; - this._lookups = {}; - }, - - variables() { - if (!this._variables) { - this._variables = !this.rules ? {} : this.rules.reduce(function (hash, r) { - if (r instanceof Declaration && r.variable === true) { - hash[r.name] = r; - } - // when evaluating variables in an import statement, imports have not been eval'd - // so we need to go inside import statements. - // guard against root being a string (in the case of inlined less) - if (r.type === 'Import' && r.root && r.root.variables) { - const vars = r.root.variables(); - for (const name in vars) { - // eslint-disable-next-line no-prototype-builtins - if (vars.hasOwnProperty(name)) { - hash[name] = r.root.variable(name); - } - } - } - return hash; - }, {}); - } - return this._variables; - }, - - properties() { - if (!this._properties) { - this._properties = !this.rules ? {} : this.rules.reduce(function (hash, r) { - if (r instanceof Declaration && r.variable !== true) { - const name = (r.name.length === 1) && (r.name[0] instanceof Keyword) ? - r.name[0].value : r.name; - // Properties don't overwrite as they can merge - if (!hash[`$${name}`]) { - hash[`$${name}`] = [ r ]; - } - else { - hash[`$${name}`].push(r); - } - } - return hash; - }, {}); - } - return this._properties; - }, - - variable(name) { - const decl = this.variables()[name]; - if (decl) { - return this.parseValue(decl); - } - }, - - property(name) { - const decl = this.properties()[name]; - if (decl) { - return this.parseValue(decl); - } - }, - - lastDeclaration() { - for (let i = this.rules.length; i > 0; i--) { - const decl = this.rules[i - 1]; - if (decl instanceof Declaration) { - return this.parseValue(decl); - } - } - }, - - parseValue(toParse) { - const self = this; - function transformDeclaration(decl) { - if (decl.value instanceof Anonymous && !decl.parsed) { - if (typeof decl.value.value === 'string') { - new Parser(this.parse.context, this.parse.importManager, decl.fileInfo(), decl.value.getIndex()).parseNode( - decl.value.value, - ['value', 'important'], - function(err, result) { - if (err) { - decl.parsed = true; - } - if (result) { - decl.value = result[0]; - decl.important = result[1] || ''; - decl.parsed = true; - } - }); - } else { - decl.parsed = true; - } - - return decl; - } - else { - return decl; - } - } - if (!Array.isArray(toParse)) { - return transformDeclaration.call(self, toParse); - } - else { - const nodes = []; - toParse.forEach(function(n) { - nodes.push(transformDeclaration.call(self, n)); - }); - return nodes; - } - }, - - rulesets() { - if (!this.rules) { return []; } - - const filtRules = []; - const rules = this.rules; - let i; - let rule; - - for (i = 0; (rule = rules[i]); i++) { - if (rule.isRuleset) { - filtRules.push(rule); - } - } - - return filtRules; - }, - - prependRule(rule) { - const rules = this.rules; - if (rules) { - rules.unshift(rule); - } else { - this.rules = [ rule ]; - } - this.setParent(rule, this); - }, - - find(selector, self, filter) { - self = self || this; - const rules = []; - let match; - let foundMixins; - const key = selector.toCSS(); - - if (key in this._lookups) { return this._lookups[key]; } - - this.rulesets().forEach(function (rule) { - if (rule !== self) { - for (let j = 0; j < rule.selectors.length; j++) { - match = selector.match(rule.selectors[j]); - if (match) { - if (selector.elements.length > match) { - if (!filter || filter(rule)) { - foundMixins = rule.find(new Selector(selector.elements.slice(match)), self, filter); - for (let i = 0; i < foundMixins.length; ++i) { - foundMixins[i].path.push(rule); - } - Array.prototype.push.apply(rules, foundMixins); - } - } else { - rules.push({ rule, path: []}); - } - break; - } - } - } - }); - this._lookups[key] = rules; - return rules; - }, - - genCSS(context, output) { - let i; - let j; - const charsetRuleNodes = []; - let ruleNodes = []; - - let // Line number debugging - debugInfo; - - let rule; - let path; - - context.tabLevel = (context.tabLevel || 0); - - if (!this.root) { - context.tabLevel++; - } - - const tabRuleStr = context.compress ? '' : Array(context.tabLevel + 1).join(' '); - const tabSetStr = context.compress ? '' : Array(context.tabLevel).join(' '); - let sep; - - let charsetNodeIndex = 0; - let importNodeIndex = 0; - for (i = 0; (rule = this.rules[i]); i++) { - if (rule instanceof Comment) { - if (importNodeIndex === i) { - importNodeIndex++; - } - ruleNodes.push(rule); - } else if (rule.isCharset && rule.isCharset()) { - ruleNodes.splice(charsetNodeIndex, 0, rule); - charsetNodeIndex++; - importNodeIndex++; - } else if (rule.type === 'Import') { - ruleNodes.splice(importNodeIndex, 0, rule); - importNodeIndex++; - } else { - ruleNodes.push(rule); - } - } - ruleNodes = charsetRuleNodes.concat(ruleNodes); - - // If this is the root node, we don't render - // a selector, or {}. - if (!this.root) { - debugInfo = getDebugInfo(context, this, tabSetStr); - - if (debugInfo) { - output.add(debugInfo); - output.add(tabSetStr); - } - - const paths = this.paths; - const pathCnt = paths.length; - let pathSubCnt; - - sep = context.compress ? ',' : (`,\n${tabSetStr}`); - - for (i = 0; i < pathCnt; i++) { - path = paths[i]; - if (!(pathSubCnt = path.length)) { continue; } - if (i > 0) { output.add(sep); } - - context.firstSelector = true; - path[0].genCSS(context, output); - - context.firstSelector = false; - for (j = 1; j < pathSubCnt; j++) { - path[j].genCSS(context, output); - } - } - - output.add((context.compress ? '{' : ' {\n') + tabRuleStr); - } - - // Compile rules and rulesets - for (i = 0; (rule = ruleNodes[i]); i++) { - - if (i + 1 === ruleNodes.length) { - context.lastRule = true; - } - - const currentLastRule = context.lastRule; - if (rule.isRulesetLike(rule)) { - context.lastRule = false; - } - - if (rule.genCSS) { - rule.genCSS(context, output); - } else if (rule.value) { - output.add(rule.value.toString()); - } - - context.lastRule = currentLastRule; - - if (!context.lastRule && rule.isVisible()) { - output.add(context.compress ? '' : (`\n${tabRuleStr}`)); - } else { - context.lastRule = false; - } - } - - if (!this.root) { - output.add((context.compress ? '}' : `\n${tabSetStr}}`)); - context.tabLevel--; - } - - if (!output.isEmpty() && !context.compress && this.firstRoot) { - output.add('\n'); - } - }, - - joinSelectors(paths, context, selectors) { - for (let s = 0; s < selectors.length; s++) { - this.joinSelector(paths, context, selectors[s]); - } - }, - - joinSelector(paths, context, selector) { - - function createParenthesis(elementsToPak, originalElement) { - let replacementParen, j; - if (elementsToPak.length === 0) { - replacementParen = new Paren(elementsToPak[0]); - } else { - const insideParent = new Array(elementsToPak.length); - for (j = 0; j < elementsToPak.length; j++) { - insideParent[j] = new Element( - null, - elementsToPak[j], - originalElement.isVariable, - originalElement._index, - originalElement._fileInfo - ); - } - replacementParen = new Paren(new Selector(insideParent)); - } - return replacementParen; - } - - function createSelector(containedElement, originalElement) { - let element, selector; - element = new Element(null, containedElement, originalElement.isVariable, originalElement._index, originalElement._fileInfo); - selector = new Selector([element]); - return selector; - } - - // joins selector path from `beginningPath` with selector path in `addPath` - // `replacedElement` contains element that is being replaced by `addPath` - // returns concatenated path - function addReplacementIntoPath(beginningPath, addPath, replacedElement, originalSelector) { - let newSelectorPath, lastSelector, newJoinedSelector; - // our new selector path - newSelectorPath = []; - - // construct the joined selector - if & is the first thing this will be empty, - // if not newJoinedSelector will be the last set of elements in the selector - if (beginningPath.length > 0) { - newSelectorPath = utils.copyArray(beginningPath); - lastSelector = newSelectorPath.pop(); - newJoinedSelector = originalSelector.createDerived(utils.copyArray(lastSelector.elements)); - } - else { - newJoinedSelector = originalSelector.createDerived([]); - } - - if (addPath.length > 0) { - // /deep/ is a CSS4 selector - (removed, so should deprecate) - // that is valid without anything in front of it - // so if the & does not have a combinator that is "" or " " then - // and there is a combinator on the parent, then grab that. - // this also allows + a { & .b { .a & { ... though not sure why you would want to do that - let combinator = replacedElement.combinator; - - const parentEl = addPath[0].elements[0]; - if (combinator.emptyOrWhitespace && !parentEl.combinator.emptyOrWhitespace) { - combinator = parentEl.combinator; - } - // join the elements so far with the first part of the parent - newJoinedSelector.elements.push(new Element( - combinator, - parentEl.value, - replacedElement.isVariable, - replacedElement._index, - replacedElement._fileInfo - )); - newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1)); - } - - // now add the joined selector - but only if it is not empty - if (newJoinedSelector.elements.length !== 0) { - newSelectorPath.push(newJoinedSelector); - } - - // put together the parent selectors after the join (e.g. the rest of the parent) - if (addPath.length > 1) { - let restOfPath = addPath.slice(1); - restOfPath = restOfPath.map(function (selector) { - return selector.createDerived(selector.elements, []); - }); - newSelectorPath = newSelectorPath.concat(restOfPath); - } - return newSelectorPath; - } - - // joins selector path from `beginningPath` with every selector path in `addPaths` array - // `replacedElement` contains element that is being replaced by `addPath` - // returns array with all concatenated paths - function addAllReplacementsIntoPath( beginningPath, addPaths, replacedElement, originalSelector, result) { - let j; - for (j = 0; j < beginningPath.length; j++) { - const newSelectorPath = addReplacementIntoPath(beginningPath[j], addPaths, replacedElement, originalSelector); - result.push(newSelectorPath); - } - return result; - } - - function mergeElementsOnToSelectors(elements, selectors) { - let i, sel; - - if (elements.length === 0) { - return ; - } - if (selectors.length === 0) { - selectors.push([ new Selector(elements) ]); - return; - } - - for (i = 0; (sel = selectors[i]); i++) { - // if the previous thing in sel is a parent this needs to join on to it - if (sel.length > 0) { - sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements)); - } - else { - sel.push(new Selector(elements)); - } - } - } - - // replace all parent selectors inside `inSelector` by content of `context` array - // resulting selectors are returned inside `paths` array - // returns true if `inSelector` contained at least one parent selector - function replaceParentSelector(paths, context, inSelector) { - // The paths are [[Selector]] - // The first list is a list of comma separated selectors - // The inner list is a list of inheritance separated selectors - // e.g. - // .a, .b { - // .c { - // } - // } - // == [[.a] [.c]] [[.b] [.c]] - // - let i, j, k, currentElements, newSelectors, selectorsMultiplied, sel, el, hadParentSelector = false, length, lastSelector; - function findNestedSelector(element) { - let maybeSelector; - if (!(element.value instanceof Paren)) { - return null; - } - - maybeSelector = element.value.value; - if (!(maybeSelector instanceof Selector)) { - return null; - } - - return maybeSelector; - } - - // the elements from the current selector so far - currentElements = []; - // the current list of new selectors to add to the path. - // We will build it up. We initiate it with one empty selector as we "multiply" the new selectors - // by the parents - newSelectors = [ - [] - ]; - - for (i = 0; (el = inSelector.elements[i]); i++) { - // non parent reference elements just get added - if (el.value !== '&') { - const nestedSelector = findNestedSelector(el); - if (nestedSelector !== null) { - // merge the current list of non parent selector elements - // on to the current list of selectors to add - mergeElementsOnToSelectors(currentElements, newSelectors); - - const nestedPaths = []; - let replaced; - const replacedNewSelectors = []; - replaced = replaceParentSelector(nestedPaths, context, nestedSelector); - hadParentSelector = hadParentSelector || replaced; - // the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors - for (k = 0; k < nestedPaths.length; k++) { - const replacementSelector = createSelector(createParenthesis(nestedPaths[k], el), el); - addAllReplacementsIntoPath(newSelectors, [replacementSelector], el, inSelector, replacedNewSelectors); - } - newSelectors = replacedNewSelectors; - currentElements = []; - } else { - currentElements.push(el); - } - - } else { - hadParentSelector = true; - // the new list of selectors to add - selectorsMultiplied = []; - - // merge the current list of non parent selector elements - // on to the current list of selectors to add - mergeElementsOnToSelectors(currentElements, newSelectors); - - // loop through our current selectors - for (j = 0; j < newSelectors.length; j++) { - sel = newSelectors[j]; - // if we don't have any parent paths, the & might be in a mixin so that it can be used - // whether there are parents or not - if (context.length === 0) { - // the combinator used on el should now be applied to the next element instead so that - // it is not lost - if (sel.length > 0) { - sel[0].elements.push(new Element(el.combinator, '', el.isVariable, el._index, el._fileInfo)); - } - selectorsMultiplied.push(sel); - } - else { - // and the parent selectors - for (k = 0; k < context.length; k++) { - // We need to put the current selectors - // then join the last selector's elements on to the parents selectors - const newSelectorPath = addReplacementIntoPath(sel, context[k], el, inSelector); - // add that to our new set of selectors - selectorsMultiplied.push(newSelectorPath); - } - } - } - - // our new selectors has been multiplied, so reset the state - newSelectors = selectorsMultiplied; - currentElements = []; - } - } - - // if we have any elements left over (e.g. .a& .b == .b) - // add them on to all the current selectors - mergeElementsOnToSelectors(currentElements, newSelectors); - - for (i = 0; i < newSelectors.length; i++) { - length = newSelectors[i].length; - if (length > 0) { - paths.push(newSelectors[i]); - lastSelector = newSelectors[i][length - 1]; - newSelectors[i][length - 1] = lastSelector.createDerived(lastSelector.elements, inSelector.extendList); - } - } - - return hadParentSelector; - } - - function deriveSelector(visibilityInfo, deriveFrom) { - const newSelector = deriveFrom.createDerived(deriveFrom.elements, deriveFrom.extendList, deriveFrom.evaldCondition); - newSelector.copyVisibilityInfo(visibilityInfo); - return newSelector; - } - - // joinSelector code follows - let i, newPaths, hadParentSelector; - - newPaths = []; - hadParentSelector = replaceParentSelector(newPaths, context, selector); - - if (!hadParentSelector) { - if (context.length > 0) { - newPaths = []; - for (i = 0; i < context.length; i++) { - - const concatenated = context[i].map(deriveSelector.bind(this, selector.visibilityInfo())); - - concatenated.push(selector); - newPaths.push(concatenated); - } - } - else { - newPaths = [[selector]]; - } - } - - for (i = 0; i < newPaths.length; i++) { - paths.push(newPaths[i]); - } - - } -}); - -export default Ruleset; diff --git a/packages/less/src/less/tree/selector.js b/packages/less/src/less/tree/selector.js deleted file mode 100644 index c2e7db063f..0000000000 --- a/packages/less/src/less/tree/selector.js +++ /dev/null @@ -1,145 +0,0 @@ -import Node from './node'; -import Element from './element'; -import LessError from '../less-error'; -import * as utils from '../utils'; -import Parser from '../parser/parser'; - -const Selector = function(elements, extendList, condition, index, currentFileInfo, visibilityInfo) { - this.extendList = extendList; - this.condition = condition; - this.evaldCondition = !condition; - this._index = index; - this._fileInfo = currentFileInfo; - this.elements = this.getElements(elements); - this.mixinElements_ = undefined; - this.copyVisibilityInfo(visibilityInfo); - this.setParent(this.elements, this); -}; - -Selector.prototype = Object.assign(new Node(), { - type: 'Selector', - - accept(visitor) { - if (this.elements) { - this.elements = visitor.visitArray(this.elements); - } - if (this.extendList) { - this.extendList = visitor.visitArray(this.extendList); - } - if (this.condition) { - this.condition = visitor.visit(this.condition); - } - }, - - createDerived(elements, extendList, evaldCondition) { - elements = this.getElements(elements); - const newSelector = new Selector(elements, extendList || this.extendList, - null, this.getIndex(), this.fileInfo(), this.visibilityInfo()); - newSelector.evaldCondition = (!utils.isNullOrUndefined(evaldCondition)) ? evaldCondition : this.evaldCondition; - newSelector.mediaEmpty = this.mediaEmpty; - return newSelector; - }, - - getElements(els) { - if (!els) { - return [new Element('', '&', false, this._index, this._fileInfo)]; - } - if (typeof els === 'string') { - new Parser(this.parse.context, this.parse.importManager, this._fileInfo, this._index).parseNode( - els, - ['selector'], - function(err, result) { - if (err) { - throw new LessError({ - index: err.index, - message: err.message - }, this.parse.imports, this._fileInfo.filename); - } - els = result[0].elements; - }); - } - return els; - }, - - createEmptySelectors() { - const el = new Element('', '&', false, this._index, this._fileInfo), sels = [new Selector([el], null, null, this._index, this._fileInfo)]; - sels[0].mediaEmpty = true; - return sels; - }, - - match(other) { - const elements = this.elements; - const len = elements.length; - let olen; - let i; - - other = other.mixinElements(); - olen = other.length; - if (olen === 0 || len < olen) { - return 0; - } else { - for (i = 0; i < olen; i++) { - if (elements[i].value !== other[i]) { - return 0; - } - } - } - - return olen; // return number of matched elements - }, - - mixinElements() { - if (this.mixinElements_) { - return this.mixinElements_; - } - - let elements = this.elements.map( function(v) { - return v.combinator.value + (v.value.value || v.value); - }).join('').match(/[,&#*.\w-]([\w-]|(\\.))*/g); - - if (elements) { - if (elements[0] === '&') { - elements.shift(); - } - } else { - elements = []; - } - - return (this.mixinElements_ = elements); - }, - - isJustParentSelector() { - return !this.mediaEmpty && - this.elements.length === 1 && - this.elements[0].value === '&' && - (this.elements[0].combinator.value === ' ' || this.elements[0].combinator.value === ''); - }, - - eval(context) { - const evaldCondition = this.condition && this.condition.eval(context); - let elements = this.elements; - let extendList = this.extendList; - - elements = elements && elements.map(function (e) { return e.eval(context); }); - extendList = extendList && extendList.map(function(extend) { return extend.eval(context); }); - - return this.createDerived(elements, extendList, evaldCondition); - }, - - genCSS(context, output) { - let i, element; - if ((!context || !context.firstSelector) && this.elements[0].combinator.value === '') { - output.add(' ', this.fileInfo(), this.getIndex()); - } - for (i = 0; i < this.elements.length; i++) { - element = this.elements[i]; - element.genCSS(context, output); - } - }, - - getIsOutput() { - return this.evaldCondition; - } -}); - -export default Selector; diff --git a/packages/less/src/less/tree/unicode-descriptor.js b/packages/less/src/less/tree/unicode-descriptor.js deleted file mode 100644 index 78a6950655..0000000000 --- a/packages/less/src/less/tree/unicode-descriptor.js +++ /dev/null @@ -1,11 +0,0 @@ -import Node from './node'; - -const UnicodeDescriptor = function(value) { - this.value = value; -} - -UnicodeDescriptor.prototype = Object.assign(new Node(), { - type: 'UnicodeDescriptor' -}) - -export default UnicodeDescriptor; diff --git a/packages/less/src/less/tree/unit.js b/packages/less/src/less/tree/unit.js deleted file mode 100644 index 946b098fd4..0000000000 --- a/packages/less/src/less/tree/unit.js +++ /dev/null @@ -1,141 +0,0 @@ -import Node from './node'; -import unitConversions from '../data/unit-conversions'; -import * as utils from '../utils'; - -const Unit = function(numerator, denominator, backupUnit) { - this.numerator = numerator ? utils.copyArray(numerator).sort() : []; - this.denominator = denominator ? utils.copyArray(denominator).sort() : []; - if (backupUnit) { - this.backupUnit = backupUnit; - } else if (numerator && numerator.length) { - this.backupUnit = numerator[0]; - } -}; - -Unit.prototype = Object.assign(new Node(), { - type: 'Unit', - - clone() { - return new Unit(utils.copyArray(this.numerator), utils.copyArray(this.denominator), this.backupUnit); - }, - - genCSS(context, output) { - // Dimension checks the unit is singular and throws an error if in strict math mode. - const strictUnits = context && context.strictUnits; - if (this.numerator.length === 1) { - output.add(this.numerator[0]); // the ideal situation - } else if (!strictUnits && this.backupUnit) { - output.add(this.backupUnit); - } else if (!strictUnits && this.denominator.length) { - output.add(this.denominator[0]); - } - }, - - toString() { - let i, returnStr = this.numerator.join('*'); - for (i = 0; i < this.denominator.length; i++) { - returnStr += `/${this.denominator[i]}`; - } - return returnStr; - }, - - compare(other) { - return this.is(other.toString()) ? 0 : undefined; - }, - - is(unitString) { - return this.toString().toUpperCase() === unitString.toUpperCase(); - }, - - isLength() { - return RegExp('^(px|em|ex|ch|rem|in|cm|mm|pc|pt|ex|vw|vh|vmin|vmax)$', 'gi').test(this.toCSS()); - }, - - isEmpty() { - return this.numerator.length === 0 && this.denominator.length === 0; - }, - - isSingular() { - return this.numerator.length <= 1 && this.denominator.length === 0; - }, - - map(callback) { - let i; - - for (i = 0; i < this.numerator.length; i++) { - this.numerator[i] = callback(this.numerator[i], false); - } - - for (i = 0; i < this.denominator.length; i++) { - this.denominator[i] = callback(this.denominator[i], true); - } - }, - - usedUnits() { - let group; - const result = {}; - let mapUnit; - let groupName; - - mapUnit = function (atomicUnit) { - // eslint-disable-next-line no-prototype-builtins - if (group.hasOwnProperty(atomicUnit) && !result[groupName]) { - result[groupName] = atomicUnit; - } - - return atomicUnit; - }; - - for (groupName in unitConversions) { - // eslint-disable-next-line no-prototype-builtins - if (unitConversions.hasOwnProperty(groupName)) { - group = unitConversions[groupName]; - - this.map(mapUnit); - } - } - - return result; - }, - - cancel() { - const counter = {}; - let atomicUnit; - let i; - - for (i = 0; i < this.numerator.length; i++) { - atomicUnit = this.numerator[i]; - counter[atomicUnit] = (counter[atomicUnit] || 0) + 1; - } - - for (i = 0; i < this.denominator.length; i++) { - atomicUnit = this.denominator[i]; - counter[atomicUnit] = (counter[atomicUnit] || 0) - 1; - } - - this.numerator = []; - this.denominator = []; - - for (atomicUnit in counter) { - // eslint-disable-next-line no-prototype-builtins - if (counter.hasOwnProperty(atomicUnit)) { - const count = counter[atomicUnit]; - - if (count > 0) { - for (i = 0; i < count; i++) { - this.numerator.push(atomicUnit); - } - } else if (count < 0) { - for (i = 0; i < -count; i++) { - this.denominator.push(atomicUnit); - } - } - } - } - - this.numerator.sort(); - this.denominator.sort(); - } -}); - -export default Unit; diff --git a/packages/less/src/less/tree/url.js b/packages/less/src/less/tree/url.js deleted file mode 100644 index 90f73d9352..0000000000 --- a/packages/less/src/less/tree/url.js +++ /dev/null @@ -1,63 +0,0 @@ -import Node from './node'; - -function escapePath(path) { - return path.replace(/[()'"\s]/g, function(match) { return `\\${match}`; }); -} - -const URL = function(val, index, currentFileInfo, isEvald) { - this.value = val; - this._index = index; - this._fileInfo = currentFileInfo; - this.isEvald = isEvald; -}; - -URL.prototype = Object.assign(new Node(), { - type: 'Url', - - accept(visitor) { - this.value = visitor.visit(this.value); - }, - - genCSS(context, output) { - output.add('url('); - this.value.genCSS(context, output); - output.add(')'); - }, - - eval(context) { - const val = this.value.eval(context); - let rootpath; - - if (!this.isEvald) { - // Add the rootpath if the URL requires a rewrite - rootpath = this.fileInfo() && this.fileInfo().rootpath; - if (typeof rootpath === 'string' && - typeof val.value === 'string' && - context.pathRequiresRewrite(val.value)) { - if (!val.quote) { - rootpath = escapePath(rootpath); - } - val.value = context.rewritePath(val.value, rootpath); - } else { - val.value = context.normalizePath(val.value); - } - - // Add url args if enabled - if (context.urlArgs) { - if (!val.value.match(/^\s*data:/)) { - const delimiter = val.value.indexOf('?') === -1 ? '?' : '&'; - const urlArgs = delimiter + context.urlArgs; - if (val.value.indexOf('#') !== -1) { - val.value = val.value.replace('#', `${urlArgs}#`); - } else { - val.value += urlArgs; - } - } - } - } - - return new URL(val, this.getIndex(), this.fileInfo(), true); - } -}); - -export default URL; diff --git a/packages/less/src/less/tree/value.js b/packages/less/src/less/tree/value.js deleted file mode 100644 index b1eb57a898..0000000000 --- a/packages/less/src/less/tree/value.js +++ /dev/null @@ -1,45 +0,0 @@ -import Node from './node'; - -const Value = function(value) { - if (!value) { - throw new Error('Value requires an array argument'); - } - if (!Array.isArray(value)) { - this.value = [ value ]; - } - else { - this.value = value; - } -}; - -Value.prototype = Object.assign(new Node(), { - type: 'Value', - - accept(visitor) { - if (this.value) { - this.value = visitor.visitArray(this.value); - } - }, - - eval(context) { - if (this.value.length === 1) { - return this.value[0].eval(context); - } else { - return new Value(this.value.map(function (v) { - return v.eval(context); - })); - } - }, - - genCSS(context, output) { - let i; - for (i = 0; i < this.value.length; i++) { - this.value[i].genCSS(context, output); - if (i + 1 < this.value.length) { - output.add((context && context.compress) ? ',' : ', '); - } - } - } -}); - -export default Value; diff --git a/packages/less/src/less/tree/variable-call.js b/packages/less/src/less/tree/variable-call.js deleted file mode 100644 index 9d1e8b941e..0000000000 --- a/packages/less/src/less/tree/variable-call.js +++ /dev/null @@ -1,45 +0,0 @@ -import Node from './node'; -import Variable from './variable'; -import Ruleset from './ruleset'; -import DetachedRuleset from './detached-ruleset'; -import LessError from '../less-error'; - -const VariableCall = function(variable, index, currentFileInfo) { - this.variable = variable; - this._index = index; - this._fileInfo = currentFileInfo; - this.allowRoot = true; -}; - -VariableCall.prototype = Object.assign(new Node(), { - type: 'VariableCall', - - eval(context) { - let rules; - let detachedRuleset = new Variable(this.variable, this.getIndex(), this.fileInfo()).eval(context); - const error = new LessError({message: `Could not evaluate variable call ${this.variable}`}); - - if (!detachedRuleset.ruleset) { - if (detachedRuleset.rules) { - rules = detachedRuleset; - } - else if (Array.isArray(detachedRuleset)) { - rules = new Ruleset('', detachedRuleset); - } - else if (Array.isArray(detachedRuleset.value)) { - rules = new Ruleset('', detachedRuleset.value); - } - else { - throw error; - } - detachedRuleset = new DetachedRuleset(rules); - } - - if (detachedRuleset.ruleset) { - return detachedRuleset.callEval(context); - } - throw error; - } -}); - -export default VariableCall; diff --git a/packages/less/src/less/tree/variable.js b/packages/less/src/less/tree/variable.js deleted file mode 100644 index a81e3ecef0..0000000000 --- a/packages/less/src/less/tree/variable.js +++ /dev/null @@ -1,65 +0,0 @@ -import Node from './node'; -import Call from './call'; - -const Variable = function(name, index, currentFileInfo) { - this.name = name; - this._index = index; - this._fileInfo = currentFileInfo; -}; - -Variable.prototype = Object.assign(new Node(), { - type: 'Variable', - - eval(context) { - let variable, name = this.name; - - if (name.indexOf('@@') === 0) { - name = `@${new Variable(name.slice(1), this.getIndex(), this.fileInfo()).eval(context).value}`; - } - - if (this.evaluating) { - throw { type: 'Name', - message: `Recursive variable definition for ${name}`, - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - - this.evaluating = true; - - variable = this.find(context.frames, function (frame) { - const v = frame.variable(name); - if (v) { - if (v.important) { - const importantScope = context.importantScope[context.importantScope.length - 1]; - importantScope.important = v.important; - } - // If in calc, wrap vars in a function call to cascade evaluate args first - if (context.inCalc) { - return (new Call('_SELF', [v.value])).eval(context); - } - else { - return v.value.eval(context); - } - } - }); - if (variable) { - this.evaluating = false; - return variable; - } else { - throw { type: 'Name', - message: `variable ${name} is undefined`, - filename: this.fileInfo().filename, - index: this.getIndex() }; - } - }, - - find(obj, fun) { - for (let i = 0, r; i < obj.length; i++) { - r = fun.call(obj, obj[i]); - if (r) { return r; } - } - return null; - } -}); - -export default Variable; diff --git a/packages/less/src/less/utils.js b/packages/less/src/less/utils.js deleted file mode 100644 index f78d611a6d..0000000000 --- a/packages/less/src/less/utils.js +++ /dev/null @@ -1,126 +0,0 @@ -/* jshint proto: true */ -import * as Constants from './constants'; -import { copy } from 'copy-anything'; - -export function getLocation(index, inputStream) { - let n = index + 1; - let line = null; - let column = -1; - - while (--n >= 0 && inputStream.charAt(n) !== '\n') { - column++; - } - - if (typeof index === 'number') { - line = (inputStream.slice(0, index).match(/\n/g) || '').length; - } - - return { - line, - column - }; -} - -export function copyArray(arr) { - let i; - const length = arr.length; - const copy = new Array(length); - - for (i = 0; i < length; i++) { - copy[i] = arr[i]; - } - return copy; -} - -export function clone(obj) { - const cloned = {}; - for (const prop in obj) { - if (Object.prototype.hasOwnProperty.call(obj, prop)) { - cloned[prop] = obj[prop]; - } - } - return cloned; -} - -export function defaults(obj1, obj2) { - let newObj = obj2 || {}; - if (!obj2._defaults) { - newObj = {}; - const defaults = copy(obj1); - newObj._defaults = defaults; - const cloned = obj2 ? copy(obj2) : {}; - Object.assign(newObj, defaults, cloned); - } - return newObj; -} - -export function copyOptions(obj1, obj2) { - if (obj2 && obj2._defaults) { - return obj2; - } - const opts = defaults(obj1, obj2); - if (opts.strictMath) { - opts.math = Constants.Math.PARENS; - } - // Back compat with changed relativeUrls option - if (opts.relativeUrls) { - opts.rewriteUrls = Constants.RewriteUrls.ALL; - } - if (typeof opts.math === 'string') { - switch (opts.math.toLowerCase()) { - case 'always': - opts.math = Constants.Math.ALWAYS; - break; - case 'parens-division': - opts.math = Constants.Math.PARENS_DIVISION; - break; - case 'strict': - case 'parens': - opts.math = Constants.Math.PARENS; - break; - default: - opts.math = Constants.Math.PARENS; - } - } - if (typeof opts.rewriteUrls === 'string') { - switch (opts.rewriteUrls.toLowerCase()) { - case 'off': - opts.rewriteUrls = Constants.RewriteUrls.OFF; - break; - case 'local': - opts.rewriteUrls = Constants.RewriteUrls.LOCAL; - break; - case 'all': - opts.rewriteUrls = Constants.RewriteUrls.ALL; - break; - } - } - return opts; -} - -export function merge(obj1, obj2) { - for (const prop in obj2) { - if (Object.prototype.hasOwnProperty.call(obj2, prop)) { - obj1[prop] = obj2[prop]; - } - } - return obj1; -} - -export function flattenArray(arr, result = []) { - for (let i = 0, length = arr.length; i < length; i++) { - const value = arr[i]; - if (Array.isArray(value)) { - flattenArray(value, result); - } else { - if (value !== undefined) { - result.push(value); - } - } - } - return result; -} - -export function isNullOrUndefined(val) { - return val === null || val === undefined -} \ No newline at end of file diff --git a/packages/less/src/less/visitors/extend-visitor.js b/packages/less/src/less/visitors/extend-visitor.js deleted file mode 100644 index b3dedc93f5..0000000000 --- a/packages/less/src/less/visitors/extend-visitor.js +++ /dev/null @@ -1,507 +0,0 @@ -/* eslint-disable no-unused-vars */ -/** - * @todo - Remove unused when JSDoc types are added for visitor methods - */ -import tree from '../tree'; -import Visitor from './visitor'; -import logger from '../logger'; -import * as utils from '../utils'; - -/* jshint loopfunc:true */ - -class ExtendFinderVisitor { - constructor() { - this._visitor = new Visitor(this); - this.contexts = []; - this.allExtendsStack = [[]]; - } - - run(root) { - root = this._visitor.visit(root); - root.allExtends = this.allExtendsStack[0]; - return root; - } - - visitDeclaration(declNode, visitArgs) { - visitArgs.visitDeeper = false; - } - - visitMixinDefinition(mixinDefinitionNode, visitArgs) { - visitArgs.visitDeeper = false; - } - - visitRuleset(rulesetNode, visitArgs) { - if (rulesetNode.root) { - return; - } - - let i; - let j; - let extend; - const allSelectorsExtendList = []; - let extendList; - - // get &:extend(.a); rules which apply to all selectors in this ruleset - const rules = rulesetNode.rules, ruleCnt = rules ? rules.length : 0; - for (i = 0; i < ruleCnt; i++) { - if (rulesetNode.rules[i] instanceof tree.Extend) { - allSelectorsExtendList.push(rules[i]); - rulesetNode.extendOnEveryPath = true; - } - } - - // now find every selector and apply the extends that apply to all extends - // and the ones which apply to an individual extend - const paths = rulesetNode.paths; - for (i = 0; i < paths.length; i++) { - const selectorPath = paths[i], selector = selectorPath[selectorPath.length - 1], selExtendList = selector.extendList; - - extendList = selExtendList ? utils.copyArray(selExtendList).concat(allSelectorsExtendList) - : allSelectorsExtendList; - - if (extendList) { - extendList = extendList.map(function(allSelectorsExtend) { - return allSelectorsExtend.clone(); - }); - } - - for (j = 0; j < extendList.length; j++) { - this.foundExtends = true; - extend = extendList[j]; - extend.findSelfSelectors(selectorPath); - extend.ruleset = rulesetNode; - if (j === 0) { extend.firstExtendOnThisSelectorPath = true; } - this.allExtendsStack[this.allExtendsStack.length - 1].push(extend); - } - } - - this.contexts.push(rulesetNode.selectors); - } - - visitRulesetOut(rulesetNode) { - if (!rulesetNode.root) { - this.contexts.length = this.contexts.length - 1; - } - } - - visitMedia(mediaNode, visitArgs) { - mediaNode.allExtends = []; - this.allExtendsStack.push(mediaNode.allExtends); - } - - visitMediaOut(mediaNode) { - this.allExtendsStack.length = this.allExtendsStack.length - 1; - } - - visitAtRule(atRuleNode, visitArgs) { - atRuleNode.allExtends = []; - this.allExtendsStack.push(atRuleNode.allExtends); - } - - visitAtRuleOut(atRuleNode) { - this.allExtendsStack.length = this.allExtendsStack.length - 1; - } -} - -class ProcessExtendsVisitor { - constructor() { - this._visitor = new Visitor(this); - } - - run(root) { - const extendFinder = new ExtendFinderVisitor(); - this.extendIndices = {}; - extendFinder.run(root); - if (!extendFinder.foundExtends) { return root; } - root.allExtends = root.allExtends.concat(this.doExtendChaining(root.allExtends, root.allExtends)); - this.allExtendsStack = [root.allExtends]; - const newRoot = this._visitor.visit(root); - this.checkExtendsForNonMatched(root.allExtends); - return newRoot; - } - - checkExtendsForNonMatched(extendList) { - const indices = this.extendIndices; - extendList.filter(function(extend) { - return !extend.hasFoundMatches && extend.parent_ids.length == 1; - }).forEach(function(extend) { - let selector = '_unknown_'; - try { - selector = extend.selector.toCSS({}); - } - catch (_) {} - - if (!indices[`${extend.index} ${selector}`]) { - indices[`${extend.index} ${selector}`] = true; - /** - * @todo Shouldn't this be an error? To alert the developer - * that they may have made an error in the selector they are - * targeting? - */ - logger.warn(`WARNING: extend '${selector}' has no matches`); - } - }); - } - - doExtendChaining(extendsList, extendsListTarget, iterationCount) { - // - // chaining is different from normal extension.. if we extend an extend then we are not just copying, altering - // and pasting the selector we would do normally, but we are also adding an extend with the same target selector - // this means this new extend can then go and alter other extends - // - // this method deals with all the chaining work - without it, extend is flat and doesn't work on other extend selectors - // this is also the most expensive.. and a match on one selector can cause an extension of a selector we had already - // processed if we look at each selector at a time, as is done in visitRuleset - - let extendIndex; - - let targetExtendIndex; - let matches; - const extendsToAdd = []; - let newSelector; - const extendVisitor = this; - let selectorPath; - let extend; - let targetExtend; - let newExtend; - - iterationCount = iterationCount || 0; - - // loop through comparing every extend with every target extend. - // a target extend is the one on the ruleset we are looking at copy/edit/pasting in place - // e.g. .a:extend(.b) {} and .b:extend(.c) {} then the first extend extends the second one - // and the second is the target. - // the separation into two lists allows us to process a subset of chains with a bigger set, as is the - // case when processing media queries - for (extendIndex = 0; extendIndex < extendsList.length; extendIndex++) { - for (targetExtendIndex = 0; targetExtendIndex < extendsListTarget.length; targetExtendIndex++) { - - extend = extendsList[extendIndex]; - targetExtend = extendsListTarget[targetExtendIndex]; - - // look for circular references - if ( extend.parent_ids.indexOf( targetExtend.object_id ) >= 0 ) { continue; } - - // find a match in the target extends self selector (the bit before :extend) - selectorPath = [targetExtend.selfSelectors[0]]; - matches = extendVisitor.findMatch(extend, selectorPath); - - if (matches.length) { - extend.hasFoundMatches = true; - - // we found a match, so for each self selector.. - extend.selfSelectors.forEach(function(selfSelector) { - const info = targetExtend.visibilityInfo(); - - // process the extend as usual - newSelector = extendVisitor.extendSelector(matches, selectorPath, selfSelector, extend.isVisible()); - - // but now we create a new extend from it - newExtend = new(tree.Extend)(targetExtend.selector, targetExtend.option, 0, targetExtend.fileInfo(), info); - newExtend.selfSelectors = newSelector; - - // add the extend onto the list of extends for that selector - newSelector[newSelector.length - 1].extendList = [newExtend]; - - // record that we need to add it. - extendsToAdd.push(newExtend); - newExtend.ruleset = targetExtend.ruleset; - - // remember its parents for circular references - newExtend.parent_ids = newExtend.parent_ids.concat(targetExtend.parent_ids, extend.parent_ids); - - // only process the selector once.. if we have :extend(.a,.b) then multiple - // extends will look at the same selector path, so when extending - // we know that any others will be duplicates in terms of what is added to the css - if (targetExtend.firstExtendOnThisSelectorPath) { - newExtend.firstExtendOnThisSelectorPath = true; - targetExtend.ruleset.paths.push(newSelector); - } - }); - } - } - } - - if (extendsToAdd.length) { - // try to detect circular references to stop a stack overflow. - // may no longer be needed. - this.extendChainCount++; - if (iterationCount > 100) { - let selectorOne = '{unable to calculate}'; - let selectorTwo = '{unable to calculate}'; - try { - selectorOne = extendsToAdd[0].selfSelectors[0].toCSS(); - selectorTwo = extendsToAdd[0].selector.toCSS(); - } - catch (e) {} - throw { message: `extend circular reference detected. One of the circular extends is currently:${selectorOne}:extend(${selectorTwo})`}; - } - - // now process the new extends on the existing rules so that we can handle a extending b extending c extending - // d extending e... - return extendsToAdd.concat(extendVisitor.doExtendChaining(extendsToAdd, extendsListTarget, iterationCount + 1)); - } else { - return extendsToAdd; - } - } - - visitDeclaration(ruleNode, visitArgs) { - visitArgs.visitDeeper = false; - } - - visitMixinDefinition(mixinDefinitionNode, visitArgs) { - visitArgs.visitDeeper = false; - } - - visitSelector(selectorNode, visitArgs) { - visitArgs.visitDeeper = false; - } - - visitRuleset(rulesetNode, visitArgs) { - if (rulesetNode.root) { - return; - } - let matches; - let pathIndex; - let extendIndex; - const allExtends = this.allExtendsStack[this.allExtendsStack.length - 1]; - const selectorsToAdd = []; - const extendVisitor = this; - let selectorPath; - - // look at each selector path in the ruleset, find any extend matches and then copy, find and replace - - for (extendIndex = 0; extendIndex < allExtends.length; extendIndex++) { - for (pathIndex = 0; pathIndex < rulesetNode.paths.length; pathIndex++) { - selectorPath = rulesetNode.paths[pathIndex]; - - // extending extends happens initially, before the main pass - if (rulesetNode.extendOnEveryPath) { continue; } - const extendList = selectorPath[selectorPath.length - 1].extendList; - if (extendList && extendList.length) { continue; } - - matches = this.findMatch(allExtends[extendIndex], selectorPath); - - if (matches.length) { - allExtends[extendIndex].hasFoundMatches = true; - - allExtends[extendIndex].selfSelectors.forEach(function(selfSelector) { - let extendedSelectors; - extendedSelectors = extendVisitor.extendSelector(matches, selectorPath, selfSelector, allExtends[extendIndex].isVisible()); - selectorsToAdd.push(extendedSelectors); - }); - } - } - } - rulesetNode.paths = rulesetNode.paths.concat(selectorsToAdd); - } - - findMatch(extend, haystackSelectorPath) { - // - // look through the haystack selector path to try and find the needle - extend.selector - // returns an array of selector matches that can then be replaced - // - let haystackSelectorIndex; - - let hackstackSelector; - let hackstackElementIndex; - let haystackElement; - let targetCombinator; - let i; - const extendVisitor = this; - const needleElements = extend.selector.elements; - const potentialMatches = []; - let potentialMatch; - const matches = []; - - // loop through the haystack elements - for (haystackSelectorIndex = 0; haystackSelectorIndex < haystackSelectorPath.length; haystackSelectorIndex++) { - hackstackSelector = haystackSelectorPath[haystackSelectorIndex]; - - for (hackstackElementIndex = 0; hackstackElementIndex < hackstackSelector.elements.length; hackstackElementIndex++) { - - haystackElement = hackstackSelector.elements[hackstackElementIndex]; - - // if we allow elements before our match we can add a potential match every time. otherwise only at the first element. - if (extend.allowBefore || (haystackSelectorIndex === 0 && hackstackElementIndex === 0)) { - potentialMatches.push({pathIndex: haystackSelectorIndex, index: hackstackElementIndex, matched: 0, - initialCombinator: haystackElement.combinator}); - } - - for (i = 0; i < potentialMatches.length; i++) { - potentialMatch = potentialMatches[i]; - - // selectors add " " onto the first element. When we use & it joins the selectors together, but if we don't - // then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to - // work out what the resulting combinator will be - targetCombinator = haystackElement.combinator.value; - if (targetCombinator === '' && hackstackElementIndex === 0) { - targetCombinator = ' '; - } - - // if we don't match, null our match to indicate failure - if (!extendVisitor.isElementValuesEqual(needleElements[potentialMatch.matched].value, haystackElement.value) || - (potentialMatch.matched > 0 && needleElements[potentialMatch.matched].combinator.value !== targetCombinator)) { - potentialMatch = null; - } else { - potentialMatch.matched++; - } - - // if we are still valid and have finished, test whether we have elements after and whether these are allowed - if (potentialMatch) { - potentialMatch.finished = potentialMatch.matched === needleElements.length; - if (potentialMatch.finished && - (!extend.allowAfter && - (hackstackElementIndex + 1 < hackstackSelector.elements.length || haystackSelectorIndex + 1 < haystackSelectorPath.length))) { - potentialMatch = null; - } - } - // if null we remove, if not, we are still valid, so either push as a valid match or continue - if (potentialMatch) { - if (potentialMatch.finished) { - potentialMatch.length = needleElements.length; - potentialMatch.endPathIndex = haystackSelectorIndex; - potentialMatch.endPathElementIndex = hackstackElementIndex + 1; // index after end of match - potentialMatches.length = 0; // we don't allow matches to overlap, so start matching again - matches.push(potentialMatch); - } - } else { - potentialMatches.splice(i, 1); - i--; - } - } - } - } - return matches; - } - - isElementValuesEqual(elementValue1, elementValue2) { - if (typeof elementValue1 === 'string' || typeof elementValue2 === 'string') { - return elementValue1 === elementValue2; - } - if (elementValue1 instanceof tree.Attribute) { - if (elementValue1.op !== elementValue2.op || elementValue1.key !== elementValue2.key) { - return false; - } - if (!elementValue1.value || !elementValue2.value) { - if (elementValue1.value || elementValue2.value) { - return false; - } - return true; - } - elementValue1 = elementValue1.value.value || elementValue1.value; - elementValue2 = elementValue2.value.value || elementValue2.value; - return elementValue1 === elementValue2; - } - elementValue1 = elementValue1.value; - elementValue2 = elementValue2.value; - if (elementValue1 instanceof tree.Selector) { - if (!(elementValue2 instanceof tree.Selector) || elementValue1.elements.length !== elementValue2.elements.length) { - return false; - } - for (let i = 0; i < elementValue1.elements.length; i++) { - if (elementValue1.elements[i].combinator.value !== elementValue2.elements[i].combinator.value) { - if (i !== 0 || (elementValue1.elements[i].combinator.value || ' ') !== (elementValue2.elements[i].combinator.value || ' ')) { - return false; - } - } - if (!this.isElementValuesEqual(elementValue1.elements[i].value, elementValue2.elements[i].value)) { - return false; - } - } - return true; - } - return false; - } - - extendSelector(matches, selectorPath, replacementSelector, isVisible) { - - // for a set of matches, replace each match with the replacement selector - - let currentSelectorPathIndex = 0, currentSelectorPathElementIndex = 0, path = [], matchIndex, selector, firstElement, match, newElements; - - for (matchIndex = 0; matchIndex < matches.length; matchIndex++) { - match = matches[matchIndex]; - selector = selectorPath[match.pathIndex]; - firstElement = new tree.Element( - match.initialCombinator, - replacementSelector.elements[0].value, - replacementSelector.elements[0].isVariable, - replacementSelector.elements[0].getIndex(), - replacementSelector.elements[0].fileInfo() - ); - - if (match.pathIndex > currentSelectorPathIndex && currentSelectorPathElementIndex > 0) { - path[path.length - 1].elements = path[path.length - 1] - .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex)); - currentSelectorPathElementIndex = 0; - currentSelectorPathIndex++; - } - - newElements = selector.elements - .slice(currentSelectorPathElementIndex, match.index) - .concat([firstElement]) - .concat(replacementSelector.elements.slice(1)); - - if (currentSelectorPathIndex === match.pathIndex && matchIndex > 0) { - path[path.length - 1].elements = - path[path.length - 1].elements.concat(newElements); - } else { - path = path.concat(selectorPath.slice(currentSelectorPathIndex, match.pathIndex)); - - path.push(new tree.Selector( - newElements - )); - } - currentSelectorPathIndex = match.endPathIndex; - currentSelectorPathElementIndex = match.endPathElementIndex; - if (currentSelectorPathElementIndex >= selectorPath[currentSelectorPathIndex].elements.length) { - currentSelectorPathElementIndex = 0; - currentSelectorPathIndex++; - } - } - - if (currentSelectorPathIndex < selectorPath.length && currentSelectorPathElementIndex > 0) { - path[path.length - 1].elements = path[path.length - 1] - .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex)); - currentSelectorPathIndex++; - } - - path = path.concat(selectorPath.slice(currentSelectorPathIndex, selectorPath.length)); - path = path.map(function (currentValue) { - // we can re-use elements here, because the visibility property matters only for selectors - const derived = currentValue.createDerived(currentValue.elements); - if (isVisible) { - derived.ensureVisibility(); - } else { - derived.ensureInvisibility(); - } - return derived; - }); - return path; - } - - visitMedia(mediaNode, visitArgs) { - let newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]); - newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, mediaNode.allExtends)); - this.allExtendsStack.push(newAllExtends); - } - - visitMediaOut(mediaNode) { - const lastIndex = this.allExtendsStack.length - 1; - this.allExtendsStack.length = lastIndex; - } - - visitAtRule(atRuleNode, visitArgs) { - let newAllExtends = atRuleNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]); - newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, atRuleNode.allExtends)); - this.allExtendsStack.push(newAllExtends); - } - - visitAtRuleOut(atRuleNode) { - const lastIndex = this.allExtendsStack.length - 1; - this.allExtendsStack.length = lastIndex; - } -} - -export default ProcessExtendsVisitor; diff --git a/packages/less/src/less/visitors/import-sequencer.js b/packages/less/src/less/visitors/import-sequencer.js deleted file mode 100644 index dc5d564301..0000000000 --- a/packages/less/src/less/visitors/import-sequencer.js +++ /dev/null @@ -1,56 +0,0 @@ -class ImportSequencer { - constructor(onSequencerEmpty) { - this.imports = []; - this.variableImports = []; - this._onSequencerEmpty = onSequencerEmpty; - this._currentDepth = 0; - } - - addImport(callback) { - const importSequencer = this, - importItem = { - callback, - args: null, - isReady: false - }; - this.imports.push(importItem); - return function() { - importItem.args = Array.prototype.slice.call(arguments, 0); - importItem.isReady = true; - importSequencer.tryRun(); - }; - } - - addVariableImport(callback) { - this.variableImports.push(callback); - } - - tryRun() { - this._currentDepth++; - try { - while (true) { - while (this.imports.length > 0) { - const importItem = this.imports[0]; - if (!importItem.isReady) { - return; - } - this.imports = this.imports.slice(1); - importItem.callback.apply(null, importItem.args); - } - if (this.variableImports.length === 0) { - break; - } - const variableImport = this.variableImports[0]; - this.variableImports = this.variableImports.slice(1); - variableImport(); - } - } finally { - this._currentDepth--; - } - if (this._currentDepth === 0 && this._onSequencerEmpty) { - this._onSequencerEmpty(); - } - } -} - -export default ImportSequencer; diff --git a/packages/less/src/less/visitors/import-visitor.js b/packages/less/src/less/visitors/import-visitor.js deleted file mode 100644 index aaffe0d3ee..0000000000 --- a/packages/less/src/less/visitors/import-visitor.js +++ /dev/null @@ -1,203 +0,0 @@ -/* eslint-disable no-unused-vars */ -/** - * @todo - Remove unused when JSDoc types are added for visitor methods - */ -import contexts from '../contexts'; -import Visitor from './visitor'; -import ImportSequencer from './import-sequencer'; -import * as utils from '../utils'; - -const ImportVisitor = function(importer, finish) { - - this._visitor = new Visitor(this); - this._importer = importer; - this._finish = finish; - this.context = new contexts.Eval(); - this.importCount = 0; - this.onceFileDetectionMap = {}; - this.recursionDetector = {}; - this._sequencer = new ImportSequencer(this._onSequencerEmpty.bind(this)); -}; - -ImportVisitor.prototype = { - isReplacing: false, - run: function (root) { - try { - // process the contents - this._visitor.visit(root); - } - catch (e) { - this.error = e; - } - - this.isFinished = true; - this._sequencer.tryRun(); - }, - _onSequencerEmpty: function() { - if (!this.isFinished) { - return; - } - this._finish(this.error); - }, - visitImport: function (importNode, visitArgs) { - const inlineCSS = importNode.options.inline; - - if (!importNode.css || inlineCSS) { - - const context = new contexts.Eval(this.context, utils.copyArray(this.context.frames)); - const importParent = context.frames[0]; - - this.importCount++; - if (importNode.isVariableImport()) { - this._sequencer.addVariableImport(this.processImportNode.bind(this, importNode, context, importParent)); - } else { - this.processImportNode(importNode, context, importParent); - } - } - visitArgs.visitDeeper = false; - }, - processImportNode: function(importNode, context, importParent) { - let evaldImportNode; - const inlineCSS = importNode.options.inline; - - try { - evaldImportNode = importNode.evalForImport(context); - } catch (e) { - if (!e.filename) { e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename; } - // attempt to eval properly and treat as css - importNode.css = true; - // if that fails, this error will be thrown - importNode.error = e; - } - - if (evaldImportNode && (!evaldImportNode.css || inlineCSS)) { - - if (evaldImportNode.options.multiple) { - context.importMultiple = true; - } - - // try appending if we haven't determined if it is css or not - const tryAppendLessExtension = evaldImportNode.css === undefined; - - for (let i = 0; i < importParent.rules.length; i++) { - if (importParent.rules[i] === importNode) { - importParent.rules[i] = evaldImportNode; - break; - } - } - - const onImported = this.onImported.bind(this, evaldImportNode, context), sequencedOnImported = this._sequencer.addImport(onImported); - - this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.fileInfo(), - evaldImportNode.options, sequencedOnImported); - } else { - this.importCount--; - if (this.isFinished) { - this._sequencer.tryRun(); - } - } - }, - onImported: function (importNode, context, e, root, importedAtRoot, fullPath) { - if (e) { - if (!e.filename) { - e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename; - } - this.error = e; - } - - const importVisitor = this, - inlineCSS = importNode.options.inline, - isPlugin = importNode.options.isPlugin, - isOptional = importNode.options.optional, - duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector; - - if (!context.importMultiple) { - if (duplicateImport) { - importNode.skip = true; - } else { - importNode.skip = function() { - if (fullPath in importVisitor.onceFileDetectionMap) { - return true; - } - importVisitor.onceFileDetectionMap[fullPath] = true; - return false; - }; - } - } - - if (!fullPath && isOptional) { - importNode.skip = true; - } - - if (root) { - importNode.root = root; - importNode.importedFilename = fullPath; - - if (!inlineCSS && !isPlugin && (context.importMultiple || !duplicateImport)) { - importVisitor.recursionDetector[fullPath] = true; - - const oldContext = this.context; - this.context = context; - try { - this._visitor.visit(root); - } catch (e) { - this.error = e; - } - this.context = oldContext; - } - } - - importVisitor.importCount--; - - if (importVisitor.isFinished) { - importVisitor._sequencer.tryRun(); - } - }, - visitDeclaration: function (declNode, visitArgs) { - if (declNode.value.type === 'DetachedRuleset') { - this.context.frames.unshift(declNode); - } else { - visitArgs.visitDeeper = false; - } - }, - visitDeclarationOut: function(declNode) { - if (declNode.value.type === 'DetachedRuleset') { - this.context.frames.shift(); - } - }, - visitAtRule: function (atRuleNode, visitArgs) { - if (atRuleNode.value) { - this.context.frames.unshift(atRuleNode); - } else if (atRuleNode.declarations && atRuleNode.declarations.length) { - if (atRuleNode.isRooted) { - this.context.frames.unshift(atRuleNode); - } else { - this.context.frames.unshift(atRuleNode.declarations[0]); - } - } else if (atRuleNode.rules && atRuleNode.rules.length) { - this.context.frames.unshift(atRuleNode); - } - }, - visitAtRuleOut: function (atRuleNode) { - this.context.frames.shift(); - }, - visitMixinDefinition: function (mixinDefinitionNode, visitArgs) { - this.context.frames.unshift(mixinDefinitionNode); - }, - visitMixinDefinitionOut: function (mixinDefinitionNode) { - this.context.frames.shift(); - }, - visitRuleset: function (rulesetNode, visitArgs) { - this.context.frames.unshift(rulesetNode); - }, - visitRulesetOut: function (rulesetNode) { - this.context.frames.shift(); - }, - visitMedia: function (mediaNode, visitArgs) { - this.context.frames.unshift(mediaNode.rules[0]); - }, - visitMediaOut: function (mediaNode) { - this.context.frames.shift(); - } -}; -export default ImportVisitor; diff --git a/packages/less/src/less/visitors/index.js b/packages/less/src/less/visitors/index.js deleted file mode 100644 index 96deb76c48..0000000000 --- a/packages/less/src/less/visitors/index.js +++ /dev/null @@ -1,15 +0,0 @@ -import Visitor from './visitor'; -import ImportVisitor from './import-visitor'; -import MarkVisibleSelectorsVisitor from './set-tree-visibility-visitor'; -import ExtendVisitor from './extend-visitor'; -import JoinSelectorVisitor from './join-selector-visitor'; -import ToCSSVisitor from './to-css-visitor'; - -export default { - Visitor, - ImportVisitor, - MarkVisibleSelectorsVisitor, - ExtendVisitor, - JoinSelectorVisitor, - ToCSSVisitor -}; diff --git a/packages/less/src/less/visitors/join-selector-visitor.js b/packages/less/src/less/visitors/join-selector-visitor.js deleted file mode 100644 index b55b292c73..0000000000 --- a/packages/less/src/less/visitors/join-selector-visitor.js +++ /dev/null @@ -1,65 +0,0 @@ -/* eslint-disable no-unused-vars */ -/** - * @todo - Remove unused when JSDoc types are added for visitor methods - */ -import Visitor from './visitor'; - -class JoinSelectorVisitor { - constructor() { - this.contexts = [[]]; - this._visitor = new Visitor(this); - } - - run(root) { - return this._visitor.visit(root); - } - - visitDeclaration(declNode, visitArgs) { - visitArgs.visitDeeper = false; - } - - visitMixinDefinition(mixinDefinitionNode, visitArgs) { - visitArgs.visitDeeper = false; - } - - visitRuleset(rulesetNode, visitArgs) { - const context = this.contexts[this.contexts.length - 1]; - const paths = []; - let selectors; - - this.contexts.push(paths); - - if (!rulesetNode.root) { - selectors = rulesetNode.selectors; - if (selectors) { - selectors = selectors.filter(function(selector) { return selector.getIsOutput(); }); - rulesetNode.selectors = selectors.length ? selectors : (selectors = null); - if (selectors) { rulesetNode.joinSelectors(paths, context, selectors); } - } - if (!selectors) { rulesetNode.rules = null; } - rulesetNode.paths = paths; - } - } - - visitRulesetOut(rulesetNode) { - this.contexts.length = this.contexts.length - 1; - } - - visitMedia(mediaNode, visitArgs) { - const context = this.contexts[this.contexts.length - 1]; - mediaNode.rules[0].root = (context.length === 0 || context[0].multiMedia); - } - - visitAtRule(atRuleNode, visitArgs) { - const context = this.contexts[this.contexts.length - 1]; - - if (atRuleNode.declarations && atRuleNode.declarations.length) { - atRuleNode.declarations[0].root = (context.length === 0 || context[0].multiMedia); - } - else if (atRuleNode.rules && atRuleNode.rules.length) { - atRuleNode.rules[0].root = (atRuleNode.isRooted || context.length === 0 || null); - } - } -} - -export default JoinSelectorVisitor; diff --git a/packages/less/src/less/visitors/set-tree-visibility-visitor.js b/packages/less/src/less/visitors/set-tree-visibility-visitor.js deleted file mode 100644 index 3a713e0ae0..0000000000 --- a/packages/less/src/less/visitors/set-tree-visibility-visitor.js +++ /dev/null @@ -1,45 +0,0 @@ -class SetTreeVisibilityVisitor { - constructor(visible) { - this.visible = visible; - } - - run(root) { - this.visit(root); - } - - visitArray(nodes) { - if (!nodes) { - return nodes; - } - - const cnt = nodes.length; - let i; - for (i = 0; i < cnt; i++) { - this.visit(nodes[i]); - } - return nodes; - } - - visit(node) { - if (!node) { - return node; - } - if (node.constructor === Array) { - return this.visitArray(node); - } - - if (!node.blocksVisibility || node.blocksVisibility()) { - return node; - } - if (this.visible) { - node.ensureVisibility(); - } else { - node.ensureInvisibility(); - } - - node.accept(this); - return node; - } -} - -export default SetTreeVisibilityVisitor; \ No newline at end of file diff --git a/packages/less/src/less/visitors/to-css-visitor.js b/packages/less/src/less/visitors/to-css-visitor.js deleted file mode 100644 index 54ddd6398d..0000000000 --- a/packages/less/src/less/visitors/to-css-visitor.js +++ /dev/null @@ -1,367 +0,0 @@ -/* eslint-disable no-unused-vars */ -/** - * @todo - Remove unused when JSDoc types are added for visitor methods - */ -import tree from '../tree'; -import Visitor from './visitor'; - -class CSSVisitorUtils { - constructor(context) { - this._visitor = new Visitor(this); - this._context = context; - } - - containsSilentNonBlockedChild(bodyRules) { - let rule; - if (!bodyRules) { - return false; - } - for (let r = 0; r < bodyRules.length; r++) { - rule = bodyRules[r]; - if (rule.isSilent && rule.isSilent(this._context) && !rule.blocksVisibility()) { - // the atrule contains something that was referenced (likely by extend) - // therefore it needs to be shown in output too - return true; - } - } - return false; - } - - keepOnlyVisibleChilds(owner) { - if (owner && owner.rules) { - owner.rules = owner.rules.filter(thing => thing.isVisible()); - } - } - - isEmpty(owner) { - return (owner && owner.rules) - ? (owner.rules.length === 0) : true; - } - - hasVisibleSelector(rulesetNode) { - return (rulesetNode && rulesetNode.paths) - ? (rulesetNode.paths.length > 0) : false; - } - - resolveVisibility(node) { - if (!node.blocksVisibility()) { - if (this.isEmpty(node)) { - return ; - } - - return node; - } - - const compiledRulesBody = node.rules[0]; - this.keepOnlyVisibleChilds(compiledRulesBody); - - if (this.isEmpty(compiledRulesBody)) { - return ; - } - - node.ensureVisibility(); - node.removeVisibilityBlock(); - - return node; - } - - isVisibleRuleset(rulesetNode) { - if (rulesetNode.firstRoot) { - return true; - } - - if (this.isEmpty(rulesetNode)) { - return false; - } - - if (!rulesetNode.root && !this.hasVisibleSelector(rulesetNode)) { - return false; - } - - return true; - } -} - -const ToCSSVisitor = function(context) { - this._visitor = new Visitor(this); - this._context = context; - this.utils = new CSSVisitorUtils(context); -}; - -ToCSSVisitor.prototype = { - isReplacing: true, - run: function (root) { - return this._visitor.visit(root); - }, - - visitDeclaration: function (declNode, visitArgs) { - if (declNode.blocksVisibility() || declNode.variable) { - return; - } - return declNode; - }, - - visitMixinDefinition: function (mixinNode, visitArgs) { - // mixin definitions do not get eval'd - this means they keep state - // so we have to clear that state here so it isn't used if toCSS is called twice - mixinNode.frames = []; - }, - - visitExtend: function (extendNode, visitArgs) { - }, - - visitComment: function (commentNode, visitArgs) { - if (commentNode.blocksVisibility() || commentNode.isSilent(this._context)) { - return; - } - return commentNode; - }, - - visitMedia: function(mediaNode, visitArgs) { - const originalRules = mediaNode.rules[0].rules; - mediaNode.accept(this._visitor); - visitArgs.visitDeeper = false; - - return this.utils.resolveVisibility(mediaNode, originalRules); - }, - - visitImport: function (importNode, visitArgs) { - if (importNode.blocksVisibility()) { - return ; - } - return importNode; - }, - - visitAtRule: function(atRuleNode, visitArgs) { - if (atRuleNode.rules && atRuleNode.rules.length) { - return this.visitAtRuleWithBody(atRuleNode, visitArgs); - } else { - return this.visitAtRuleWithoutBody(atRuleNode, visitArgs); - } - }, - - visitAnonymous: function(anonymousNode, visitArgs) { - if (!anonymousNode.blocksVisibility()) { - anonymousNode.accept(this._visitor); - return anonymousNode; - } - }, - - visitAtRuleWithBody: function(atRuleNode, visitArgs) { - // if there is only one nested ruleset and that one has no path, then it is - // just fake ruleset - function hasFakeRuleset(atRuleNode) { - const bodyRules = atRuleNode.rules; - return bodyRules.length === 1 && (!bodyRules[0].paths || bodyRules[0].paths.length === 0); - } - function getBodyRules(atRuleNode) { - const nodeRules = atRuleNode.rules; - if (hasFakeRuleset(atRuleNode)) { - return nodeRules[0].rules; - } - - return nodeRules; - } - // it is still true that it is only one ruleset in array - // this is last such moment - // process childs - const originalRules = getBodyRules(atRuleNode); - atRuleNode.accept(this._visitor); - visitArgs.visitDeeper = false; - - if (!this.utils.isEmpty(atRuleNode)) { - this._mergeRules(atRuleNode.rules[0].rules); - } - - return this.utils.resolveVisibility(atRuleNode, originalRules); - }, - - visitAtRuleWithoutBody: function(atRuleNode, visitArgs) { - if (atRuleNode.blocksVisibility()) { - return; - } - - if (atRuleNode.name === '@charset') { - // Only output the debug info together with subsequent @charset definitions - // a comment (or @media statement) before the actual @charset atrule would - // be considered illegal css as it has to be on the first line - if (this.charset) { - if (atRuleNode.debugInfo) { - const comment = new tree.Comment(`/* ${atRuleNode.toCSS(this._context).replace(/\n/g, '')} */\n`); - comment.debugInfo = atRuleNode.debugInfo; - return this._visitor.visit(comment); - } - return; - } - this.charset = true; - } - - return atRuleNode; - }, - - checkValidNodes: function(rules, isRoot) { - if (!rules) { - return; - } - - for (let i = 0; i < rules.length; i++) { - const ruleNode = rules[i]; - if (isRoot && ruleNode instanceof tree.Declaration && !ruleNode.variable) { - throw { message: 'Properties must be inside selector blocks. They cannot be in the root', - index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename}; - } - if (ruleNode instanceof tree.Call) { - throw { message: `Function '${ruleNode.name}' did not return a root node`, - index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename}; - } - if (ruleNode.type && !ruleNode.allowRoot) { - throw { message: `${ruleNode.type} node returned by a function is not valid here`, - index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename}; - } - } - }, - - visitRuleset: function (rulesetNode, visitArgs) { - // at this point rulesets are nested into each other - let rule; - - const rulesets = []; - - this.checkValidNodes(rulesetNode.rules, rulesetNode.firstRoot); - - if (!rulesetNode.root) { - // remove invisible paths - this._compileRulesetPaths(rulesetNode); - - // remove rulesets from this ruleset body and compile them separately - const nodeRules = rulesetNode.rules; - - let nodeRuleCnt = nodeRules ? nodeRules.length : 0; - for (let i = 0; i < nodeRuleCnt; ) { - rule = nodeRules[i]; - if (rule && rule.rules) { - // visit because we are moving them out from being a child - rulesets.push(this._visitor.visit(rule)); - nodeRules.splice(i, 1); - nodeRuleCnt--; - continue; - } - i++; - } - // accept the visitor to remove rules and refactor itself - // then we can decide nogw whether we want it or not - // compile body - if (nodeRuleCnt > 0) { - rulesetNode.accept(this._visitor); - } else { - rulesetNode.rules = null; - } - visitArgs.visitDeeper = false; - } else { // if (! rulesetNode.root) { - rulesetNode.accept(this._visitor); - visitArgs.visitDeeper = false; - } - - if (rulesetNode.rules) { - this._mergeRules(rulesetNode.rules); - this._removeDuplicateRules(rulesetNode.rules); - } - - // now decide whether we keep the ruleset - if (this.utils.isVisibleRuleset(rulesetNode)) { - rulesetNode.ensureVisibility(); - rulesets.splice(0, 0, rulesetNode); - } - - if (rulesets.length === 1) { - return rulesets[0]; - } - return rulesets; - }, - - _compileRulesetPaths: function(rulesetNode) { - if (rulesetNode.paths) { - rulesetNode.paths = rulesetNode.paths - .filter(p => { - let i; - if (p[0].elements[0].combinator.value === ' ') { - p[0].elements[0].combinator = new(tree.Combinator)(''); - } - for (i = 0; i < p.length; i++) { - if (p[i].isVisible() && p[i].getIsOutput()) { - return true; - } - } - return false; - }); - } - }, - - _removeDuplicateRules: function(rules) { - if (!rules) { return; } - - // remove duplicates - const ruleCache = {}; - - let ruleList; - let rule; - let i; - - for (i = rules.length - 1; i >= 0 ; i--) { - rule = rules[i]; - if (rule instanceof tree.Declaration) { - if (!ruleCache[rule.name]) { - ruleCache[rule.name] = rule; - } else { - ruleList = ruleCache[rule.name]; - if (ruleList instanceof tree.Declaration) { - ruleList = ruleCache[rule.name] = [ruleCache[rule.name].toCSS(this._context)]; - } - const ruleCSS = rule.toCSS(this._context); - if (ruleList.indexOf(ruleCSS) !== -1) { - rules.splice(i, 1); - } else { - ruleList.push(ruleCSS); - } - } - } - } - }, - - _mergeRules: function(rules) { - if (!rules) { - return; - } - - const groups = {}; - const groupsArr = []; - - for (let i = 0; i < rules.length; i++) { - const rule = rules[i]; - if (rule.merge) { - const key = rule.name; - groups[key] ? rules.splice(i--, 1) : - groupsArr.push(groups[key] = []); - groups[key].push(rule); - } - } - - groupsArr.forEach(group => { - if (group.length > 0) { - const result = group[0]; - let space = []; - const comma = [new tree.Expression(space)]; - group.forEach(rule => { - if ((rule.merge === '+') && (space.length > 0)) { - comma.push(new tree.Expression(space = [])); - } - space.push(rule.value); - result.important = result.important || rule.important; - }); - result.value = new tree.Value(comma); - } - }); - } -}; - -export default ToCSSVisitor; diff --git a/packages/less/src/less/visitors/visitor.js b/packages/less/src/less/visitors/visitor.js deleted file mode 100644 index 9db634f4f5..0000000000 --- a/packages/less/src/less/visitors/visitor.js +++ /dev/null @@ -1,165 +0,0 @@ -import tree from '../tree'; - -const _visitArgs = { visitDeeper: true }; -let _hasIndexed = false; - -function _noop(node) { - return node; -} - -function indexNodeTypes(parent, ticker) { - // add .typeIndex to tree node types for lookup table - let key, child; - for (key in parent) { - /* eslint guard-for-in: 0 */ - child = parent[key]; - switch (typeof child) { - case 'function': - // ignore bound functions directly on tree which do not have a prototype - // or aren't nodes - if (child.prototype && child.prototype.type) { - child.prototype.typeIndex = ticker++; - } - break; - case 'object': - ticker = indexNodeTypes(child, ticker); - break; - - } - } - return ticker; -} - -class Visitor { - constructor(implementation) { - this._implementation = implementation; - this._visitInCache = {}; - this._visitOutCache = {}; - - if (!_hasIndexed) { - indexNodeTypes(tree, 1); - _hasIndexed = true; - } - } - - visit(node) { - if (!node) { - return node; - } - - const nodeTypeIndex = node.typeIndex; - if (!nodeTypeIndex) { - // MixinCall args aren't a node type? - if (node.value && node.value.typeIndex) { - this.visit(node.value); - } - return node; - } - - const impl = this._implementation; - let func = this._visitInCache[nodeTypeIndex]; - let funcOut = this._visitOutCache[nodeTypeIndex]; - const visitArgs = _visitArgs; - let fnName; - - visitArgs.visitDeeper = true; - - if (!func) { - fnName = `visit${node.type}`; - func = impl[fnName] || _noop; - funcOut = impl[`${fnName}Out`] || _noop; - this._visitInCache[nodeTypeIndex] = func; - this._visitOutCache[nodeTypeIndex] = funcOut; - } - - if (func !== _noop) { - const newNode = func.call(impl, node, visitArgs); - if (node && impl.isReplacing) { - node = newNode; - } - } - - if (visitArgs.visitDeeper && node) { - if (node.length) { - for (let i = 0, cnt = node.length; i < cnt; i++) { - if (node[i].accept) { - node[i].accept(this); - } - } - } else if (node.accept) { - node.accept(this); - } - } - - if (funcOut != _noop) { - funcOut.call(impl, node); - } - - return node; - } - - visitArray(nodes, nonReplacing) { - if (!nodes) { - return nodes; - } - - const cnt = nodes.length; - let i; - - // Non-replacing - if (nonReplacing || !this._implementation.isReplacing) { - for (i = 0; i < cnt; i++) { - this.visit(nodes[i]); - } - return nodes; - } - - // Replacing - const out = []; - for (i = 0; i < cnt; i++) { - const evald = this.visit(nodes[i]); - if (evald === undefined) { continue; } - if (!evald.splice) { - out.push(evald); - } else if (evald.length) { - this.flatten(evald, out); - } - } - return out; - } - - flatten(arr, out) { - if (!out) { - out = []; - } - - let cnt, i, item, nestedCnt, j, nestedItem; - - for (i = 0, cnt = arr.length; i < cnt; i++) { - item = arr[i]; - if (item === undefined) { - continue; - } - if (!item.splice) { - out.push(item); - continue; - } - - for (j = 0, nestedCnt = item.length; j < nestedCnt; j++) { - nestedItem = item[j]; - if (nestedItem === undefined) { - continue; - } - if (!nestedItem.splice) { - out.push(nestedItem); - } else if (nestedItem.length) { - this.flatten(nestedItem, out); - } - } - } - - return out; - } -} - -export default Visitor; diff --git a/packages/less/test/README.md b/packages/less/test/README.md index 7ded68404d..bd8246887d 100644 --- a/packages/less/test/README.md +++ b/packages/less/test/README.md @@ -1,3 +1,25 @@ -Tests are generally organized in the `less/` folder by what options are set in index.js. +# Less Alpha Tests -The main tests are located under `less/_main/` \ No newline at end of file +The alpha gate is intentionally split by contract: + +- `lessc-alpha.mjs` owns CLI behavior, including Linecraft-formatted stderr. + Default diagnostics must include color and source framing; `--no-color` must + suppress terminal control sequences. +- `alpha-support.mjs` owns the supported public API surface and the unsupported + alpha inventory. +- `alpha-fixtures.mjs` walks the upstream `tests-unit`, `tests-config`, + `tests-error`, and `tests-warnings` folders. It classifies render parity, + expected render gaps, forwarded Jess diagnostics, expected missing + diagnostics, and warning gaps. +- `jess-alpha-fast-path.mjs` and the root publish checks own package assembly, + optional peer behavior, and packed-consumer proof. +- `test-es6.js` and `test-cjs.cjs` are the alpha Node module smoke tests. + The historical broad Node harness remains under `test:legacy-node` while + Less 4 parity-only surfaces such as source maps, remote imports, and legacy + plugin-host behavior are outside the alpha gate. + +Do not grow `alpha-fixtures.mjs` into a second full test framework. Detailed +diagnostic, warning, CLI, and package-contract assertions belong in focused +tests. If those focused tests need cases, filtering, snapshots, hooks, or better +failure reporting, move them to a real test runner instead of expanding the +Node-script harness. diff --git a/packages/less/test/alpha-fixtures.mjs b/packages/less/test/alpha-fixtures.mjs new file mode 100644 index 0000000000..44b5cfd8fa --- /dev/null +++ b/packages/less/test/alpha-fixtures.mjs @@ -0,0 +1,551 @@ +import assert from 'node:assert/strict'; +import { createRequire } from 'node:module'; +import { existsSync, readFileSync } from 'node:fs'; +import path from 'node:path'; +import { pathToFileURL } from 'node:url'; + +import { globSync } from 'glob'; + +import less from '../lib/index.js'; + +const require = createRequire(import.meta.url); +const testDataRoot = path.dirname(require.resolve('@less/test-data')); + +function readFixtureFilters(argv) { + const filters = []; + for (let index = 2; index < argv.length; index++) { + const arg = argv[index]; + if (arg === '--fixture') { + const value = argv[index + 1]; + if (!value) { + throw new Error('--fixture requires a fixture path'); + } + filters.push(value); + index += 1; + continue; + } + if (arg.startsWith('--fixture=')) { + const value = arg.slice('--fixture='.length); + if (!value) { + throw new Error('--fixture requires a fixture path'); + } + filters.push(value); + } + } + return filters; +} + +const fixtureFilters = readFixtureFilters(process.argv); + +function fixtureMatches(file) { + if (fixtureFilters.length === 0) { + return true; + } + return fixtureFilters.some(filter => + file === filter || file.includes(filter) + ); +} + +const fixtureFunctionPlugin = { + install(pluginLess, _manager, functions) { + functions.addMultiple({ + add(a, b) { + return readNumericFunctionArg(a) + readNumericFunctionArg(b); + }, + increment(a) { + return readNumericFunctionArg(a) + 1; + }, + _color(str) { + if (readStringFunctionArg(str) === 'evil red') { + return '#660000'; + } + return undefined; + } + }); + } +}; + +const skippedFixtures = new Map([ + ['tests-config/3rd-party/bootstrap4.less', 'broad third-party fixture; keep out of config smoke progression'], + ['tests-config/at-rules-compressed/at-rules-compressed.less', 'compression output parity not yet alpha-gated'], + ['tests-config/at-rules-compressed-evaluation/at-rules-compressed-evaluation.less', 'compression output parity not yet alpha-gated'], + ['tests-config/compression/compression.less', 'compression output parity not yet alpha-gated'], + ['tests-config/debug/linenumbers.less', 'debug output fixture; no expected CSS in upstream fixture'], + ['tests-config/filemanagerPlugin/filemanager.less', 'custom Less file manager plugin API needs scope decision'], + ['tests-config/globalVars/extended.less', 'globalVars injection is not alpha-supported'], + ['tests-config/globalVars/simple.less', 'globalVars injection is not alpha-supported'], + ['tests-config/include-path/include-path.less', 'data-uri() and image-size() file helpers are not alpha-supported'], + ['tests-config/include-path-string/include-path-string.less', 'data-uri() file helper is not alpha-supported'], + ['tests-config/include-path/import-test-e.less', 'helper imported by include-path fixture; no expected CSS'], + ['tests-config/import-redirect/import-redirect.less', 'no expected CSS in upstream fixture'], + ['tests-config/js-type-errors/js-type-error.less', 'expected error fixture, not render-to-CSS fixture'], + ['tests-config/math-always/mixins-guards.less', 'no expected CSS in upstream fixture'], + ['tests-config/math-always/no-sm-operations.less', 'no expected CSS in upstream fixture'], + ['tests-config/math-parens-division/media-math.less', 'no expected CSS in upstream fixture'], + ['tests-config/math-parens-division/mixins-args.less', 'no expected CSS in upstream fixture'], + ['tests-config/math-parens-division/new-division.less', 'no expected CSS in upstream fixture'], + ['tests-config/math-parens-division/parens.less', 'no expected CSS in upstream fixture'], + ['tests-config/math-strict/css.less', 'no expected CSS in upstream fixture'], + ['tests-config/math-strict/media-math.less', 'no expected CSS in upstream fixture'], + ['tests-config/math-strict/mixins-args.less', 'no expected CSS in upstream fixture'], + ['tests-config/math-strict/parens.less', 'no expected CSS in upstream fixture'], + ['tests-config/modifyVars/extended.less', 'modifyVars injection is not alpha-supported'], + ['tests-config/no-js-errors/no-js-errors.less', 'expected error fixture, not render-to-CSS fixture'], + ['tests-config/postProcessorPlugin/postProcessor.less', 'Less postprocessor plugin API needs scope decision'], + ['tests-config/preProcessorPlugin/preProcessor.less', 'Less preprocessor plugin API needs scope decision'], + ['tests-config/process-imports/google.less', 'processImports URL import removal is not alpha-supported'], + ['tests-config/rewrite-urls-all/rewrite-urls-all.less', 'URL rewriting is not alpha-supported'], + ['tests-config/rewrite-urls-local/rewrite-urls-local.less', 'URL rewriting is not alpha-supported'], + ['tests-config/root-registry/file.less', 'no expected CSS in upstream fixture'], + ['tests-config/root-registry/root.less', 'no expected CSS in upstream fixture'], + ['tests-config/rootpath-rewrite-urls-all/rootpath-rewrite-urls-all.less', 'URL rootpath rewriting is not alpha-supported'], + ['tests-config/rootpath-rewrite-urls-local/rootpath-rewrite-urls-local.less', 'URL rootpath rewriting is not alpha-supported'], + ['tests-config/strict-imports/imported.less', 'helper imported by strict-imports fixture; no expected CSS'], + ['tests-config/sourcemaps/basic.less', 'source-map output suite needs dedicated output artifact checks'], + ['tests-config/sourcemaps/custom-props.less', 'source-map output suite needs dedicated output artifact checks'], + ['tests-config/sourcemaps-disable-annotation/basic.less', 'source-map output suite needs dedicated output artifact checks'], + ['tests-config/sourcemaps-empty/empty.less', 'source-map output suite needs dedicated output artifact checks'], + ['tests-config/sourcemaps-empty/var-defs.less', 'source-map output suite needs dedicated output artifact checks'], + ['tests-config/sourcemaps-variable-selector/basic.less', 'source-map output suite needs dedicated output artifact checks'], + ['tests-config/sourcemaps-variable-selector/vars.less', 'source-map output suite needs dedicated output artifact checks'], + ['tests-config/visitorPlugin/visitor.less', 'Less visitor plugin API needs scope decision'], + ['tests-unit/import/import-remote.less', 'remote URL imports require an explicit network/IO allowlist'] +]); +const selectedSkippedCount = [...skippedFixtures.keys()].filter(fixtureMatches).length; + +const expectedFailureFixtures = new Map([ + ['tests-unit/import/import-reference.less', 'reference import filtering leaves extra at-rules'], + ['tests-unit/import/import.less', '@plugin executes; remaining gap is @import media-query handling and @media query merging'], + ['tests-unit/urls/urls.less', 'renders but CSS @import placement and multiline function formatting differ from Less'], + ['tests-config/static-urls/urls.less', 'relativeUrls=false/rootpath static URL behavior is not implemented'], + ['tests-config/url-args/urls.less', 'urlArgs URL query appending is not implemented'], + ['tests-config/sourcemaps-basepath/sourcemaps-basepath.less', 'source-map annotation and artifact output need a dedicated harness'], + ['tests-config/sourcemaps-include-source/sourcemaps-include-source.less', 'source-map annotation and artifact output need a dedicated harness'], + ['tests-config/sourcemaps-rootpath/sourcemaps-rootpath.less', 'source-map annotation and artifact output need a dedicated harness'], + ['tests-config/sourcemaps-url/sourcemaps-url.less', 'source-map annotation and artifact output need a dedicated harness'], + ['tests-unit/detached-rulesets/detached-rulesets.less', 'detached ruleset argument closure matches Less; nested @media query merging still differs'], + ['tests-unit/extract-and-length/extract-and-length.less', 'current published Jess dependency still has list argument evaluation gaps'], + ['tests-unit/mixins/mixins.less', 'same-named nested ruleset resolves the outer .recursion() mixin; remaining mismatch is fixture-local collapseNesting=false rendering'], + ['tests-unit/property-name-interp/property-name-interp.less', 'deprecated dash-only @- and @{-} variable names are rejected'], + ['tests-unit/plugin-module/plugin-module.less', 'legacy CommonJS @plugin graph with require() is not supported by the optional JS runtime'], + ['tests-unit/plugin-preeval/plugin-preeval.less', 'legacy tree visitor ABI is not supported'], + ['tests-unit/plugin/plugin.less', '@plugin scripts execute; remaining gap is nested @media query merging'], + ['tests-unit/parse-interpolation/parse-interpolation.less', 'renders but interpolation formatting differs from Less'], + ['tests-unit/parser-slashed-combinator/parser-slashed-combinator.less', 'slashed combinator not yet supported'], + ['tests-unit/permissive-parse/permissive-parse.less', 'permissive legacy parser corners are not alpha-supported'], + ['tests-unit/media/media.less', 'top-level bare @var at-rule preludes are rejected'], + ['tests-unit/at-rule-variable-deprecated/at-rule-variable-deprecated.less', 'bare @variable references in at-rule structural positions are rejected in Less 5 alpha'], + ['tests-unit/color-functions/operations.less', 'Jess keeps un-operated overflowing rgba() calls authored instead of Less 4 channel clamping'], + ['tests-unit/functions/functions.less', 'Jess keeps un-operated hsl() calls authored instead of Less 4 clamp/canonicalization'] +]); + +const expectedFailureDiagnosticCodes = new Map([ + ['tests-unit/import/import.less', 'plugin/load-failed'] +]); + +const expectedErrorPasses = new Map([ + ['tests-error/eval/add-mixed-units.less', 'unit compatibility errors are not emitted yet'], + ['tests-error/eval/add-mixed-units2.less', 'unit compatibility errors are not emitted yet'], + ['tests-error/eval/color-func-invalid-color-2.less', 'color function argument errors are not emitted yet'], + ['tests-error/eval/color-func-invalid-color.less', 'color function argument errors are not emitted yet'], + ['tests-error/eval/divide-mixed-units.less', 'unit compatibility errors are not emitted yet'], + ['tests-error/eval/multiply-mixed-units.less', 'unit compatibility errors are not emitted yet'], + ['tests-error/eval/percentage-css-var.less', 'function argument type errors are not emitted yet'], + ['tests-error/eval/percentage-non-number-argument.less', 'function argument type errors are not emitted yet'], + ['tests-error/eval/svg-gradient1.less', 'svg-gradient argument validation errors are not emitted yet'], + ['tests-error/eval/svg-gradient2.less', 'svg-gradient argument validation errors are not emitted yet'], + ['tests-error/eval/svg-gradient3.less', 'svg-gradient argument validation errors are not emitted yet'], + ['tests-error/eval/svg-gradient4.less', 'svg-gradient argument validation errors are not emitted yet'], + ['tests-error/eval/svg-gradient5.less', 'svg-gradient argument validation errors are not emitted yet'], + ['tests-error/eval/svg-gradient6.less', 'svg-gradient argument validation errors are not emitted yet'], + ['tests-error/eval/unit-function.less', 'unit() argument validation errors are not emitted yet'] +]); + +const expectedMissingWarnings = new Map([ + ['tests-warnings/parentless-ampersand-nested.less', 'parentless ampersand warning is not emitted yet'], + ['tests-warnings/parentless-ampersand.less', 'parentless ampersand warning is not emitted yet'] +]); + +const files = globSync('{tests-unit/*/*.less,tests-config/*/*.less}', { + cwd: testDataRoot, + nodir: true, + posix: true +}) + .filter(fixtureMatches) + .filter(file => !skippedFixtures.has(file)) + .filter(file => !file.startsWith('tests-unit/plugin-')) + .sort(); + +let passed = 0; +let expectedFailed = 0; +let errored = 0; +let expectedErrorPassed = 0; +let warned = 0; +let expectedWarningMissing = 0; +const failures = []; + +const FIXTURE_TIMEOUT_MS = 15000; + +class FixtureTimeoutError extends Error { + constructor(label, timeoutMs) { + super(`${label} timed out after ${timeoutMs}ms`); + this.name = 'FixtureTimeoutError'; + } +} + +function isFixtureTimeout(error) { + return error instanceof FixtureTimeoutError; +} + +async function withFixtureTimeout(label, work, timeoutMs = FIXTURE_TIMEOUT_MS) { + let timer; + try { + return await Promise.race([ + work(), + new Promise((_, reject) => { + timer = setTimeout(() => { + reject(new FixtureTimeoutError(label, timeoutMs)); + }, timeoutMs); + }) + ]); + } finally { + clearTimeout(timer); + } +} + +for (const file of files) { + const fixturePath = path.join(testDataRoot, file); + const expectedFailureReason = expectedFailureFixtures.get(file); + const expectedDiagnosticCode = expectedFailureDiagnosticCodes.get(file); + const testCases = await getTestCases(fixturePath); + + for (const testCase of testCases) { + try { + if (expectedDiagnosticCode) { + await assertExpectedFailureDiagnostic(testCase, expectedDiagnosticCode); + expectedFailed += 1; + continue; + } else { + await assertFixtureRenders(testCase); + } + if (expectedFailureReason) { + failures.push(`${testCase.label} passed unexpectedly; remove or reclassify expected failure: ${expectedFailureReason}`); + } else { + passed += 1; + } + } catch (error) { + if (isFixtureTimeout(error)) { + failures.push(`${testCase.label}\n${formatError(error)}`); + continue; + } + if (expectedFailureReason) { + expectedFailed += 1; + continue; + } + failures.push(`${testCase.label}\n${formatError(error)}`); + } + } +} + +const errorFiles = globSync('tests-error/{eval,parse}/*.less', { + cwd: testDataRoot, + nodir: true, + posix: true +}) + .filter(fixtureMatches) + .sort(); + +for (const file of errorFiles) { + const fixturePath = path.join(testDataRoot, file); + try { + await withFixtureTimeout(file, () => less.renderFile(fixturePath, { collapseNesting: true })); + const expectedReason = expectedErrorPasses.get(file); + if (expectedReason) { + expectedErrorPassed += 1; + } else { + failures.push(`${file} rendered unexpectedly; expected a friendly diagnostic`); + } + } catch (error) { + if (expectedErrorPasses.has(file)) { + failures.push(`${file} now rejects; remove expected error gap: ${expectedErrorPasses.get(file)}`); + continue; + } + try { + assertForwardedJessDiagnostic(error); + errored += 1; + } catch (assertionError) { + failures.push(`${file}\n${formatError(assertionError)}`); + } + } +} + +const warningFiles = globSync('tests-warnings/*.less', { + cwd: testDataRoot, + nodir: true, + posix: true +}) + .filter(fixtureMatches) + .sort(); + +if (fixtureFilters.length > 0 && files.length === 0 && errorFiles.length === 0 && warningFiles.length === 0 && selectedSkippedCount === 0) { + throw new Error(`No alpha fixtures matched: ${fixtureFilters.join(', ')}`); +} + +for (const file of warningFiles) { + const fixturePath = path.join(testDataRoot, file); + try { + const result = await withFixtureTimeout(file, () => less.renderFile(fixturePath, { collapseNesting: true })); + const warnings = Array.isArray(result.warnings) ? result.warnings : []; + if (warnings.length > 0) { + if (expectedMissingWarnings.has(file)) { + failures.push(`${file} now emits warnings; remove expected warning gap: ${expectedMissingWarnings.get(file)}`); + } else { + warned += 1; + } + continue; + } + if (expectedMissingWarnings.has(file)) { + expectedWarningMissing += 1; + } else { + failures.push(`${file} rendered without warnings`); + } + } catch (error) { + failures.push(`${file} rejected while checking warnings\n${formatError(error)}`); + } +} + +if (failures.length > 0) { + console.error(`Less alpha fixture gate failed (${failures.length}):\n`); + for (const failure of failures) { + console.error(`- ${failure}`); + } + process.exitCode = 1; +} else { + console.log(`Less alpha fixtures passed: ${passed} rendered, ${expectedFailed} expected render failures, ${errored} friendly errors, ${expectedErrorPassed} expected missing errors, ${warned} warnings, ${expectedWarningMissing} expected missing warnings, ${selectedSkippedCount} skipped.`); +} + +async function assertFixtureRenders(testCase) { + const expected = readFileSync(testCase.expectedFile, 'utf8'); + const result = await withFixtureTimeout(testCase.label, () => less.renderFile(testCase.lessFile, testCase.options)); + assert.equal(result.css, expected, `${testCase.label} should render byte-identically`); +} + +async function assertExpectedFailureDiagnostic(testCase, expectedCode) { + try { + await withFixtureTimeout(testCase.label, () => less.renderFile(testCase.lessFile, testCase.options)); + } catch (error) { + if (isFixtureTimeout(error)) { + throw error; + } + assert.ok( + error?.jessErrors?.some?.(diagnostic => diagnostic?.code === expectedCode), + `${testCase.label} should surface Jess diagnostic ${expectedCode}; got ${error?.jessErrors?.map?.(diagnostic => diagnostic?.code).join(', ') || 'none'}` + ); + return; + } + assert.fail(`${testCase.label} rendered successfully instead of surfacing Jess diagnostic ${expectedCode}`); +} + +async function getTestCases(lessFile) { + const relative = path.relative(testDataRoot, lessFile).replace(/\\/g, '/'); + const config = await loadFixtureConfig(path.dirname(lessFile)); + const outputs = outputEntries(config.output); + const baseName = path.basename(lessFile, '.less'); + const cases = []; + + for (const output of outputs) { + const outputName = (output.file || '{name}.css').replace(/\{name\}/g, baseName); + const expectedFile = path.join(path.dirname(lessFile), outputName); + if (!existsSync(expectedFile)) { + if (output.file) { + throw new Error(`Expected output file does not exist: ${expectedFile}`); + } + continue; + } + cases.push({ + label: output.file ? `${relative} (${outputName})` : relative, + lessFile, + expectedFile, + options: renderOptions(config.lessOptions, output) + }); + } + + if (cases.length === 0) { + const fallback = path.join(path.dirname(lessFile), `${baseName}.css`); + if (!existsSync(fallback)) { + throw new Error(`No expected output CSS found for ${lessFile}`); + } + cases.push({ + label: relative, + lessFile, + expectedFile: fallback, + options: renderOptions(config.lessOptions, { collapseNesting: true }) + }); + } + + return cases; +} + +function renderOptions(lessOptions, output) { + const options = { + ...lessOptions, + filename: undefined, + plugins: [fixtureFunctionPlugin, ...(lessOptions.plugins || [])] + }; + if (Object.prototype.hasOwnProperty.call(output, 'collapseNesting')) { + options.collapseNesting = output.collapseNesting === true; + } + return options; +} + +function outputEntries(output) { + const defaultOutput = { collapseNesting: true }; + if (!output || typeof output !== 'object') { + return [defaultOutput]; + } + if (!Array.isArray(output)) { + return [{ ...defaultOutput, ...output }]; + } + let defaults = defaultOutput; + const entries = []; + for (const entry of output) { + if (!entry || typeof entry !== 'object') { + continue; + } + if (!Object.prototype.hasOwnProperty.call(entry, 'file')) { + defaults = { ...defaults, ...entry }; + continue; + } + entries.push({ ...defaults, ...entry }); + } + return entries.length > 0 ? entries : [defaults]; +} + +async function loadFixtureConfig(startDir) { + const configs = []; + let dir = startDir; + while (dir.startsWith(testDataRoot)) { + const configPath = ['styles.config.cjs', 'styles.config.js', 'styles.config.ts'] + .map(name => path.join(dir, name)) + .find(existsSync); + if (configPath) { + configs.push(await readConfig(configPath)); + } + if (dir === testDataRoot) { + break; + } + dir = path.dirname(dir); + } + + return configs.reverse().reduce( + (merged, config) => ({ + lessOptions: { ...merged.lessOptions, ...toLessOptions(config) }, + output: Object.prototype.hasOwnProperty.call(config, 'output') ? config.output : merged.output + }), + { lessOptions: {}, output: { collapseNesting: true } } + ); +} + +async function readConfig(configPath) { + if (configPath.endsWith('.cjs')) { + return require(configPath); + } + if (configPath.endsWith('.js')) { + const mod = await import(pathToFileURL(configPath).href); + return mod.default || mod; + } + return readTsConfig(configPath); +} + +function readTsConfig(configPath) { + const source = readFileSync(configPath, 'utf8'); + const outputEntries = [...source.matchAll(/\{\s*file:\s*'([^']+)'\s*,\s*collapseNesting:\s*(true|false)\s*\}/g)] + .map(match => ({ file: match[1], collapseNesting: match[2] === 'true' })); + const collapseMatch = /output:\s*\{[\s\S]*?collapseNesting:\s*(true|false)/.exec(source); + const mathMatch = /mathMode:\s*'([^']+)'/.exec(source); + const config = {}; + if (outputEntries.length > 0) { + config.output = outputEntries; + } else if (collapseMatch) { + config.output = { collapseNesting: collapseMatch[1] === 'true' }; + } + if (mathMatch) { + config.compile = { mathMode: mathMatch[1] }; + } + return config; +} + +function toLessOptions(config) { + const lessOptions = { ...(config.language?.less || {}) }; + delete lessOptions.javascriptEnabled; + delete lessOptions.relativeUrls; + delete lessOptions.silent; + if (Array.isArray(lessOptions.paths)) { + lessOptions.paths = lessOptions.paths.map(value => path.resolve(testDataRoot, value)); + } + const mathMode = config.compile?.mathMode; + if (mathMode) { + lessOptions.math = mathMode; + } + return lessOptions; +} + +function readNumericFunctionArg(value) { + if (typeof value?.value === 'number') { + return value.value; + } + if (typeof value?.value?.number === 'number') { + return value.value.number; + } + const primitive = value?.valueOf?.() ?? value; + return Number(primitive); +} + +function readStringFunctionArg(value) { + if (typeof value?.value === 'string') { + return value.value.replace(/^(['"])(.*)\1$/, '$2'); + } + if (typeof value?.value?.value === 'string') { + return value.value.value.replace(/^(['"])(.*)\1$/, '$2'); + } + const primitive = value?.valueOf?.() ?? value; + return String(primitive).replace(/^(['"])(.*)\1$/, '$2'); +} + +function assertForwardedJessDiagnostic(error) { + assert.equal(typeof error?.message, 'string', 'diagnostic should expose a message'); + assert.equal(typeof error?.type, 'string', 'diagnostic should expose a type'); + assert.equal(typeof error?.filename, 'string', 'diagnostic should preserve filename'); + assert.ok(error.filename.startsWith(testDataRoot), 'diagnostic filename should stay inside the fixture corpus'); + assert.equal(typeof error?.line, 'number', 'diagnostic should expose a line'); + assert.equal(typeof error?.column, 'number', 'diagnostic should expose a column'); + assert.ok(Array.isArray(error?.jessErrors), 'diagnostic should expose Jess diagnostics'); + assert.ok(error.jessErrors.length > 0, 'diagnostic should include at least one Jess error'); + assert.equal(Object.prototype.hasOwnProperty.call(error, 'offset'), false, 'diagnostic should not leak raw offsets'); + + const diagnostic = error.jessErrors[0]; + assert.equal(typeof diagnostic?.code, 'string', 'Jess diagnostic should preserve code'); + assert.equal(typeof diagnostic?.phase, 'string', 'Jess diagnostic should preserve phase'); + assert.equal(typeof diagnostic?.message, 'string', 'Jess diagnostic should preserve message'); + assert.equal(typeof diagnostic?.reason, 'string', 'Jess diagnostic should preserve reason'); + assert.equal(typeof diagnostic?.fix, 'string', 'Jess diagnostic should preserve fix'); + if (diagnostic?.filePath !== undefined) { + assert.equal(diagnostic.filePath, error.filename, 'Jess diagnostic should preserve filePath'); + } + if (diagnostic?.line !== undefined && diagnostic.line > 0) { + assert.equal(diagnostic.line, error.line, 'Jess diagnostic should preserve line'); + } + if (diagnostic?.column !== undefined && diagnostic.column > 0) { + assert.equal(diagnostic.column, error.column, 'Jess diagnostic should preserve column'); + } + if (diagnostic?.lines !== undefined) { + assert.equal(typeof diagnostic.lines, 'object', 'Jess diagnostic should preserve source lines for Linecraft frames'); + } +} + +function formatError(error) { + if (error && typeof error === 'object' && 'stack' in error && typeof error.stack === 'string') { + return error.stack; + } + return String(error); +} diff --git a/packages/less/test/alpha-support.mjs b/packages/less/test/alpha-support.mjs new file mode 100644 index 0000000000..92487c9ff9 --- /dev/null +++ b/packages/less/test/alpha-support.mjs @@ -0,0 +1,191 @@ +import assert from 'node:assert/strict'; +import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +import less from '../lib/index.js'; + +const testDataRoot = path.resolve(packageRoot(), '..', 'test-data', 'tests-unit'); + +const unsupportedForAlpha1 = [ + { + area: 'Legacy plugin host APIs', + detail: 'Less @plugin, render-option function plugins, file-manager plugins, and pre/post-processors are wired for future compatibility but are not alpha.1-supported execution paths.' + }, + { + area: 'Source maps', + detail: 'Source-map options and annotations are not alpha-supported yet.' + }, + { + area: 'URL rewrite/process-imports compatibility', + detail: 'Less 4 urlArgs/static URL/processImports behavior is not alpha-supported yet.' + }, + { + area: 'Compression/minification parity', + detail: 'Less 5 alpha.1 focuses on readable compiler output, not Less 4 compressed output identity.' + }, + { + area: 'Permissive legacy syntax edge cases', + detail: 'Removed/deprecated syntax such as dynamic @charset and other permissive parser corners must reject with precise diagnostics.' + }, + { + area: 'Browser/Sauce harness', + detail: 'The browser harness is not an alpha.1 publish gate.' + } +]; + +function packageRoot() { + return path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); +} + +function printUnsupportedInventory() { + console.log('\nLess 5 alpha.1 unsupported inventory:'); + for (const entry of unsupportedForAlpha1) { + console.log(`- ${entry.area}: ${entry.detail}`); + } +} + +async function assertFixtureRendersByteIdentical(fixturePath) { + const sourcePath = path.join(testDataRoot, `${fixturePath}.less`); + const expectedPath = path.join(testDataRoot, `${fixturePath}.css`); + const [result, expected] = await Promise.all([ + less.renderFile(sourcePath, { paths: [path.dirname(sourcePath)] }), + readFile(expectedPath, 'utf8') + ]); + assert.equal(result.css, expected, `${fixturePath} should render byte-identically`); +} + +async function assertSupportedCompileSurface() { + const tempDir = await mkdtemp(path.join(tmpdir(), 'less-alpha-support-')); + try { + const imported = path.join(tempDir, 'tokens.less'); + const entry = path.join(tempDir, 'entry.less'); + + await writeFile(imported, [ + '@accent: blue;', + '.token() { border-color: @accent; }', + '' + ].join('\n')); + await writeFile(entry, [ + '@import "tokens.less";', + '@width: 1 + 1;', + '.box {', + ' width: @width;', + ' .token();', + ' &:hover { color: red; }', + '}', + '' + ].join('\n')); + + const result = await less.renderFile(entry, { collapseNesting: true }); + assert.equal(result.css, `.box { + width: 2; + border-color: blue; +} +.box:hover { + color: red; +} +`); + } finally { + await rm(tempDir, { recursive: true, force: true }); + } +} + +async function assertUnsupportedSyntaxHasPreciseDiagnostic() { + const stderrWrites = []; + const originalStderrWrite = process.stderr.write; + process.stderr.write = function captureStderr(chunk, ...args) { + stderrWrites.push(String(chunk)); + if (typeof args.at(-1) === 'function') { + args.at(-1)(); + } + return true; + }; + try { + await assert.rejects( + less.render('@Eight: 8;\n@charset "UTF-@{Eight}";\n', { + filename: 'alpha-unsupported.less' + }), + error => { + assert.equal(error.type, 'parse'); + assert.equal(error.filename, 'alpha-unsupported.less'); + assert.equal(error.line, 2); + assert.equal(error.column, 1); + assert.deepEqual(error.extract, [ + '@Eight: 8;', + '@charset "UTF-@{Eight}";', + '' + ]); + assert.equal(error.jessErrors?.[0]?.code, 'parse/dynamic-charset'); + assert.equal(error.jessErrors?.[0]?.message, error.message); + assert.equal(String(error), 'Error: Interpolation is not valid in @charset.'); + assert.doesNotMatch(String(error), /offset/i); + return true; + } + ); + } finally { + process.stderr.write = originalStderrWrite; + } + assert.equal(stderrWrites.join(''), '', + 'programmatic less.render() failures must not print diagnostics before the caller handles the rejection'); +} + +async function assertBareStructuralAtRuleVariablesReject() { + await assert.rejects( + less.render('@varfoo: foo;\n@container @varfoo (min-width: 400px) { .x { color: red; } }\n', { + filename: 'bare-at-rule-var.less' + }), + error => { + assert.equal(error.type, 'parse'); + assert.equal(error.filename, 'bare-at-rule-var.less'); + assert.equal(error.line, 2); + assert.equal(error.column, 12); + assert.deepEqual(error.extract, [ + '@varfoo: foo;', + '@container @varfoo (min-width: 400px) { .x { color: red; } }', + '' + ]); + assert.doesNotMatch(String(error), /offset/i); + return true; + } + ); +} + +async function assertUnsupportedApiOptionsReject() { + const unsupported = [ + 'sourceMap', + 'globalVars', + 'modifyVars', + 'compress', + 'rewriteUrls', + 'urlArgs', + 'javascriptEnabled', + 'strictUnits', + 'rootpath' + ]; + for (const option of unsupported) { + await assert.rejects( + less.render('.x { color: red; }\n', { [option]: true }), + error => { + assert.match(error.message, /not supported/); + assert.match(error.message, new RegExp(option)); + return true; + }, + `${option} must reject instead of silently no-oping` + ); + } +} + +await assertSupportedCompileSurface(); +await assertUnsupportedSyntaxHasPreciseDiagnostic(); +await assertBareStructuralAtRuleVariablesReject(); +await assertUnsupportedApiOptionsReject(); +await assertFixtureRendersByteIdentical('at-rule-variable-interpolation/at-rule-variable-interpolation'); +await assertFixtureRendersByteIdentical('color-functions/modern'); +await assertFixtureRendersByteIdentical('math-css-vars/math-css-vars'); +await assertFixtureRendersByteIdentical('mixins-guards/mixins-guards'); +await assertFixtureRendersByteIdentical('mixins-named-args/mixins-named-args'); +printUnsupportedInventory(); + +console.log('\nLess 5 alpha.1 support contract passed'); diff --git a/packages/less/test/browser/generator/benchmark.config.js b/packages/less/test/browser/generator/benchmark.config.cjs similarity index 100% rename from packages/less/test/browser/generator/benchmark.config.js rename to packages/less/test/browser/generator/benchmark.config.cjs diff --git a/packages/less/test/browser/generator/generate.cjs b/packages/less/test/browser/generator/generate.cjs new file mode 100644 index 0000000000..543e724df6 --- /dev/null +++ b/packages/less/test/browser/generator/generate.cjs @@ -0,0 +1,78 @@ +const template = require('./template.cjs') +let config +const fs = require('fs-extra') +const path = require('path') +const globby = require('globby') +const { runner } = require('../../mocha-playwright/runner') + + +if (process.argv[2]) { + config = require(`./${process.argv[2]}.config`) +} else { + config = require('./runner.config.cjs') +} + +/** + * Generate templates and run tests + */ +const tests = [] +const cwd = process.cwd() +const tmpDir = path.join(cwd, 'tmp', 'browser') +fs.ensureDirSync(tmpDir) +fs.copySync(path.join(cwd, 'test', 'browser', 'common.js'), path.join(tmpDir, 'common.js')) + +let numTests = 0 +let passedTests = 0 +let failedTests = 0 + +/** Will run the runners in a series */ +function runSerial(tasks) { + var result = Promise.resolve() + start = Date.now() + tasks.forEach(task => { + result = result.then(result => { + if (result && result.result && result.result.stats) { + const stats = result.result.stats + numTests += stats.tests + passedTests += stats.passes + failedTests += stats.failures + } + return task() + }, err => { + console.log(err) + failedTests += 1 + }) + }) + return result +} + +Object.entries(config).forEach(entry => { + const test = entry[1] + const paths = globby.sync(test.src) + const templateString = template(paths, test.options.helpers, test.options.specs) + fs.writeFileSync(path.join(cwd, test.options.outfile), templateString) + tests.push(() => { + const file = 'http://localhost:8081/packages/less/' + test.options.outfile + console.log(file) + return runner({ + file, + timeout: 3500, + args: ['disable-web-security', 'no-sandbox', 'disable-setuid-sandbox'], + }) + }) +}) + +module.exports = () => runSerial(tests).then(() => { + if (failedTests > 0) { + process.stderr.write(failedTests + ' Failed, ' + passedTests + ' passed\n'); + } else { + process.stdout.write('All Passed ' + passedTests + ' run\n'); + } + if (failedTests) { + process.on('exit', function() { process.reallyExit(1); }); + } + process.exit() +}, err => { + process.stderr.write(err.message); + process.exit() +}) diff --git a/packages/less/test/browser/generator/generate.js b/packages/less/test/browser/generator/generate.js index 893c7e3ac0..004c957f74 100644 --- a/packages/less/test/browser/generator/generate.js +++ b/packages/less/test/browser/generator/generate.js @@ -1,68 +1,72 @@ -const template = require('./template') -let config -const fs = require('fs-extra') -const path = require('path') -const globby = require('globby') -const { runner } = require('../../mocha-playwright/runner') +import { createRequire } from 'module'; +import fs from 'fs-extra'; +import path from 'path'; +import globby from 'globby'; +import { runner } from '../../mocha-playwright/runner.js'; +const require = createRequire(import.meta.url); + +let config; +let template; if (process.argv[2]) { - config = require(`./${process.argv[2]}.config`) + config = require(`./${process.argv[2]}.config.cjs`); } else { - config = require('./runner.config') + config = require('./runner.config.cjs'); } +template = require('./template.cjs'); /** * Generate templates and run tests */ -const tests = [] -const cwd = process.cwd() -const tmpDir = path.join(cwd, 'tmp', 'browser') -fs.ensureDirSync(tmpDir) -fs.copySync(path.join(cwd, 'test', 'browser', 'common.js'), path.join(tmpDir, 'common.js')) +const tests = []; +const cwd = process.cwd(); +const tmpDir = path.join(cwd, 'tmp', 'browser'); +fs.ensureDirSync(tmpDir); +fs.copySync(path.join(cwd, 'test', 'browser', 'common.js'), path.join(tmpDir, 'common.js')); -let numTests = 0 -let passedTests = 0 -let failedTests = 0 +let numTests = 0; +let passedTests = 0; +let failedTests = 0; /** Will run the runners in a series */ function runSerial(tasks) { - var result = Promise.resolve() - start = Date.now() + var result = Promise.resolve(); + var start = Date.now(); tasks.forEach(task => { result = result.then(result => { if (result && result.result && result.result.stats) { - const stats = result.result.stats - numTests += stats.tests - passedTests += stats.passes - failedTests += stats.failures + const stats = result.result.stats; + numTests += stats.tests; + passedTests += stats.passes; + failedTests += stats.failures; } - return task() + return task(); }, err => { - console.log(err) - failedTests += 1 - }) - }) - return result + console.log(err); + failedTests += 1; + }); + }); + return result; } Object.entries(config).forEach(entry => { - const test = entry[1] - const paths = globby.sync(test.src) - const templateString = template(paths, test.options.helpers, test.options.specs) - fs.writeFileSync(path.join(cwd, test.options.outfile), templateString) + const test = entry[1]; + const paths = globby.sync(test.src); + const templateString = template(paths, test.options.helpers, test.options.specs); + fs.writeFileSync(path.join(cwd, test.options.outfile), templateString); tests.push(() => { - const file = 'http://localhost:8081/packages/less/' + test.options.outfile - console.log(file) + const file = 'http://localhost:8081/packages/less/' + test.options.outfile; + console.log(file); return runner({ file, timeout: 3500, args: ['disable-web-security', 'no-sandbox', 'disable-setuid-sandbox'], - }) - }) -}) + }); + }); +}); -module.exports = () => runSerial(tests).then(() => { +export default () => runSerial(tests).then(() => { if (failedTests > 0) { process.stderr.write(failedTests + ' Failed, ' + passedTests + ' passed\n'); } else { @@ -71,8 +75,8 @@ module.exports = () => runSerial(tests).then(() => { if (failedTests) { process.on('exit', function() { process.reallyExit(1); }); } - process.exit() + process.exit(); }, err => { process.stderr.write(err.message); - process.exit() -}) + process.exit(); +}); diff --git a/packages/less/test/browser/generator/runner.cjs b/packages/less/test/browser/generator/runner.cjs new file mode 100644 index 0000000000..4a4b877bbb --- /dev/null +++ b/packages/less/test/browser/generator/runner.cjs @@ -0,0 +1,2 @@ +const runner = require('./generate.cjs') +runner() \ No newline at end of file diff --git a/packages/less/test/browser/generator/runner.config.js b/packages/less/test/browser/generator/runner.config.cjs similarity index 96% rename from packages/less/test/browser/generator/runner.config.js rename to packages/less/test/browser/generator/runner.config.cjs index b1b68b3697..996a384cd0 100644 --- a/packages/less/test/browser/generator/runner.config.js +++ b/packages/less/test/browser/generator/runner.config.cjs @@ -1,6 +1,6 @@ var path = require('path'); var resolve = require('resolve') -var { forceCovertToBrowserPath } = require('./utils'); +var { forceCovertToBrowserPath } = require('./utils.cjs'); /** Root of repo */ var testFolder = forceCovertToBrowserPath(path.dirname(resolve.sync('@less/test-data'))); @@ -140,7 +140,7 @@ module.exports = { src: [`${testsConfigFolder}/postProcessorPlugin/*.less`], options: { helpers: [ - 'test/plugins/postprocess/index.js', + 'test/plugins/postprocess/index.cjs', 'test/browser/runner-postProcessorPlugin-options.js' ], specs: 'test/browser/runner-postProcessorPlugin.js', @@ -152,7 +152,7 @@ module.exports = { src: [`${testsConfigFolder}/preProcessorPlugin/*.less`], options: { helpers: [ - 'test/plugins/preprocess/index.js', + 'test/plugins/preprocess/index.cjs', 'test/browser/runner-preProcessorPlugin-options.js' ], specs: 'test/browser/runner-preProcessorPlugin.js', @@ -163,7 +163,7 @@ module.exports = { src: [`${testsConfigFolder}/visitorPlugin/*.less`], options: { helpers: [ - 'test/plugins/visitor/index.js', + 'test/plugins/visitor/index.cjs', 'test/browser/runner-VisitorPlugin-options.js' ], specs: 'test/browser/runner-VisitorPlugin.js', @@ -174,7 +174,7 @@ module.exports = { src: [`${testsConfigFolder}/filemanagerPlugin/*.less`], options: { helpers: [ - 'test/plugins/filemanager/index.js', + 'test/plugins/filemanager/index.cjs', 'test/browser/runner-filemanagerPlugin-options.js' ], specs: 'test/browser/runner-filemanagerPlugin.js', diff --git a/packages/less/test/browser/generator/runner.js b/packages/less/test/browser/generator/runner.js index 25c8460366..9f82233e1e 100644 --- a/packages/less/test/browser/generator/runner.js +++ b/packages/less/test/browser/generator/runner.js @@ -1,2 +1,2 @@ -const runner = require('./generate') -runner() \ No newline at end of file +import generate from './generate.js'; +generate(); diff --git a/packages/less/test/browser/generator/template.js b/packages/less/test/browser/generator/template.cjs similarity index 98% rename from packages/less/test/browser/generator/template.js rename to packages/less/test/browser/generator/template.cjs index a8bb9e0abe..a4c0097e52 100644 --- a/packages/less/test/browser/generator/template.js +++ b/packages/less/test/browser/generator/template.cjs @@ -1,6 +1,6 @@ const html = require('html-template-tag') const path = require('path') -const { forceCovertToBrowserPath } = require('./utils') +const { forceCovertToBrowserPath } = require('./utils.cjs') const webRoot = path.resolve(__dirname, '../../../../../'); const mochaDir = forceCovertToBrowserPath(path.relative(webRoot, path.dirname(require.resolve('mocha')))) diff --git a/packages/less/test/browser/generator/utils.js b/packages/less/test/browser/generator/utils.cjs similarity index 100% rename from packages/less/test/browser/generator/utils.js rename to packages/less/test/browser/generator/utils.cjs diff --git a/packages/less/test/exports/import-patterns.cjs b/packages/less/test/exports/import-patterns.cjs new file mode 100644 index 0000000000..5279cd35f5 --- /dev/null +++ b/packages/less/test/exports/import-patterns.cjs @@ -0,0 +1,31 @@ +/** + * Verifies package exports support the import patterns users report. + * Actual import tests: test-es6.js and test-cjs.cjs + * See: https://github.com/less/less.js/issues/4423 + */ +'use strict'; + +const path = require('path'); +const fs = require('fs'); + +console.log('Verifying exports for user import patterns...\n'); + +const pkgPath = path.join(__dirname, '../../package.json'); +const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); +const exp = pkg.exports; + +if (!exp?.['.']?.import) { + console.error('FAIL: exports.import required (Node/ESM)'); + process.exit(1); +} +if (!exp?.['.']?.require) { + console.error('FAIL: exports.require required (Node/CJS)'); + process.exit(1); +} +if (!fs.existsSync(path.join(__dirname, '../../dist/less-node.cjs'))) { + console.error('FAIL: dist/less-node.cjs not found (run "npm run build" first)'); + process.exit(1); +} + +console.log('✓ exports support: import less from "less" (Node/ESM)'); +console.log('✓ exports support: require("less") (Node/CJS)'); diff --git a/packages/less/test/exports/webpack-browser-entry.js b/packages/less/test/exports/webpack-browser-entry.js new file mode 100644 index 0000000000..bd11f81ddc --- /dev/null +++ b/packages/less/test/exports/webpack-browser-entry.js @@ -0,0 +1,13 @@ +/** + * Entry used by webpack to test browser bundling. + * Replicates: import less from 'less' in a webpack build targeting browser. + * See: https://github.com/less/less.js/issues/4423 + */ +import less from 'less'; + +// Minimal sanity check - browser bundle exposes less on window when loaded via script, +// but when bundled we get the module directly +const result = await less.render('.test { color: red; }'); +if (!result.css.includes('color: red')) { + throw new Error('less.render failed'); +} diff --git a/packages/less/test/exports/webpack-browser.cjs b/packages/less/test/exports/webpack-browser.cjs new file mode 100644 index 0000000000..5412caaabd --- /dev/null +++ b/packages/less/test/exports/webpack-browser.cjs @@ -0,0 +1,69 @@ +/** + * Tests that webpack can bundle less for browser target without + * "Can't resolve 'module'" error. + * See: https://github.com/less/less.js/issues/4423 + */ +'use strict'; + +const path = require('path'); +const fs = require('fs'); + +async function run() { + let webpack; + try { + webpack = require('webpack'); + } catch (e) { + console.log('Skipping webpack browser test: webpack not installed'); + console.log(' (Add webpack and webpack-cli as devDependencies to run this test)'); + return; + } + + const config = { + mode: 'development', + target: 'web', + entry: path.join(__dirname, 'webpack-browser-entry.js'), + output: { + path: path.join(__dirname, '..', '..', 'tmp'), + filename: 'webpack-browser-test-bundle.js' + }, + resolve: { + conditionNames: ['browser', 'import', 'require', 'default'] + }, + module: { + rules: [ + { + // dist/less.js is UMD - ensure webpack treats it correctly + test: /[\\/]dist[\\/]less\.js$/, + type: 'javascript/auto' + } + ] + } + }; + + return new Promise((resolve, reject) => { + webpack(config, (err, stats) => { + if (err) { + reject(err); + return; + } + const info = stats.toJson(); + if (stats.hasErrors()) { + const msg = info.errors.map(e => (e.message || String(e))).join('\n'); + reject(new Error('Webpack build failed:\n' + msg)); + return; + } + const outPath = path.join(config.output.path, config.output.filename); + if (!fs.existsSync(outPath)) { + reject(new Error('Bundle was not created')); + return; + } + console.log("✓ Testing: import less from 'less' in webpack build (browser target) — #4423"); + resolve(); + }); + }); +} + +run().catch((err) => { + console.error('Webpack browser test FAILED:', err.message); + process.exit(1); +}); diff --git a/packages/less/test/index.js b/packages/less/test/index.js index d1e9ef8f98..7dc6a2a015 100644 --- a/packages/less/test/index.js +++ b/packages/less/test/index.js @@ -1,11 +1,23 @@ -// Mock needle for HTTP requests BEFORE any other requires -const Module = require('module'); +import { createRequire } from 'module'; +import Module from 'module'; +import path from 'path'; +import fs from 'fs'; +import { fileURLToPath } from 'url'; +import less from '../lib/index.js'; +import { lesscHelper } from '../lib/lessc-helper.js'; +import createLessTester from './less-test.js'; + +const { stylize } = lesscHelper; + +const require = createRequire(import.meta.url); +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + +// Mock needle for HTTP requests const originalRequire = Module.prototype.require; Module.prototype.require = function(id) { if (id === 'needle') { return { get: function(url, options, callback) { - // Handle CDN requests if (url.includes('cdn.jsdelivr.net')) { if (url.includes('selectors.less')) { @@ -27,23 +39,22 @@ Module.prototype.require = function(id) { return; } } - - // Handle redirect test - simulate needle's automatic redirect handling + + // Handle redirect test if (url.includes('example.com/redirect.less')) { setTimeout(() => { - // Simulate the final response after needle automatically follows the redirect callback(null, { statusCode: 200 }, 'h1 { color: blue; }'); }, 10); return; } - + if (url.includes('example.com/target.less')) { setTimeout(() => { callback(null, { statusCode: 200 }, 'h1 { color: blue; }'); }, 10); return; } - + // Default error for unmocked URLs setTimeout(() => { callback(new Error('Unmocked URL: ' + url), null, null); @@ -54,27 +65,17 @@ Module.prototype.require = function(id) { return originalRequire.apply(this, arguments); }; -// Now load other modules after mocking is set up -var path = require('path'), - fs = require('fs'), - lessTest = require('./less-test'), - stylize = require('../lib/less-node/lessc-helper').stylize; - // Parse command line arguments for test filtering var args = process.argv.slice(2); var testFilter = args.length > 0 ? args[0] : null; // Create the test runner with the filter -var lessTester = lessTest(testFilter); - -// HTTP mocking is now handled by needle mocking above +var lessTester = createLessTester(testFilter); // Test HTTP redirect functionality function testHttpRedirects() { - const less = require('../lib/less-node').default; - - console.log('🧪 Testing HTTP redirect functionality...'); - + console.log('Testing HTTP redirect functionality...'); + const redirectTest = ` @import "https://example.com/redirect.less"; @@ -84,19 +85,18 @@ h1 { color: red; } return less.render(redirectTest, { filename: 'test-redirect.less' }).then(result => { - console.log('✅ HTTP redirect test SUCCESS:'); + console.log('HTTP redirect test SUCCESS:'); console.log(result.css); - - // Check if both imported and local content are present + if (result.css.includes('color: blue') && result.css.includes('color: red')) { - console.log('🎉 HTTP redirect test PASSED - both imported and local content found'); + console.log('HTTP redirect test PASSED - both imported and local content found'); return true; } else { - console.log('❌ HTTP redirect test FAILED - missing expected content'); + console.log('HTTP redirect test FAILED - missing expected content'); return false; } }).catch(err => { - console.log('❌ HTTP redirect test ERROR:'); + console.log('HTTP redirect test ERROR:'); console.log(err.message); return false; }); @@ -104,34 +104,30 @@ h1 { color: red; } // Test import-remote functionality function testImportRemote() { - const less = require('../lib/less-node').default; - const fs = require('fs'); - const path = require('path'); - - console.log('🧪 Testing import-remote functionality...'); - + console.log('Testing import-remote functionality...'); + const testFile = path.join(__dirname, '../../test-data/tests-unit/import/import-remote.less'); const expectedFile = path.join(__dirname, '../../test-data/tests-unit/import/import-remote.css'); - + const content = fs.readFileSync(testFile, 'utf8'); const expected = fs.readFileSync(expectedFile, 'utf8'); - + return less.render(content, { filename: testFile }).then(result => { - console.log('✅ Import-remote test SUCCESS:'); + console.log('Import-remote test SUCCESS:'); console.log('Expected:', expected.trim()); console.log('Actual:', result.css.trim()); - + if (result.css.trim() === expected.trim()) { - console.log('🎉 Import-remote test PASSED - CDN imports and variable resolution working'); + console.log('Import-remote test PASSED - CDN imports and variable resolution working'); return true; } else { - console.log('❌ Import-remote test FAILED - output mismatch'); + console.log('Import-remote test FAILED - output mismatch'); return false; } }).catch(err => { - console.log('❌ Import-remote test ERROR:'); + console.log('Import-remote test ERROR:'); console.log(err.message); return false; }); @@ -143,52 +139,28 @@ if (testFilter) { console.log('Running tests matching: ' + testFilter + '\n'); } -// Glob patterns for main test runs (excluding problematic tests that will run separately) var globPatterns = [ 'tests-config/*/*.less', 'tests-unit/*/*.less', - // Debug tests have nested subdirectories (comments/, mediaquery/, all/) 'tests-config/debug/*/linenumbers-*.less', - '!tests-config/sourcemaps/**/*.less', // Exclude sourcemaps (need special handling) - '!tests-config/sourcemaps-empty/*', // Exclude sourcemaps-empty (need special handling) - '!tests-config/sourcemaps-disable-annotation/*', // Exclude sourcemaps-disable-annotation (need special handling) - '!tests-config/sourcemaps-variable-selector/*', // Exclude sourcemaps-variable-selector (need special handling) - '!tests-config/globalVars/*', // Exclude globalVars (need JSON config handling) - '!tests-config/modifyVars/*', // Exclude modifyVars (need JSON config handling) - '!tests-config/js-type-errors/*', // Exclude js-type-errors (need special test function) - '!tests-config/no-js-errors/*', // Exclude no-js-errors (need special test function) - '!tests-unit/import/import-remote.less', // Exclude import-remote (tested separately in isolation) - - // HTTP import tests are now included since we have needle mocking + '!tests-config/sourcemaps/**/*.less', + '!tests-config/sourcemaps-empty/*', + '!tests-config/sourcemaps-disable-annotation/*', + '!tests-config/sourcemaps-variable-selector/*', + '!tests-config/globalVars/*', + '!tests-config/modifyVars/*', + '!tests-config/js-type-errors/*', + '!tests-config/no-js-errors/*', + '!tests-unit/import/import-remote.less', ]; var testMap = [ - // Main test runs using glob patterns (cosmiconfig handles configs) - { - patterns: globPatterns - }, - - // Error tests - { - patterns: ['tests-error/eval/*.less'], - verifyFunction: lessTester.testErrors - }, - { - patterns: ['tests-error/parse/*.less'], - verifyFunction: lessTester.testErrors - }, - - // Special test cases with specific handling - { - patterns: ['tests-config/js-type-errors/*.less'], - verifyFunction: lessTester.testTypeErrors - }, - { - patterns: ['tests-config/no-js-errors/*.less'], - verifyFunction: lessTester.testErrors - }, - - // Sourcemap tests with special handling + { patterns: globPatterns }, + { patterns: ['tests-error/eval/*.less'], verifyFunction: lessTester.testErrors }, + { patterns: ['tests-error/parse/*.less'], verifyFunction: lessTester.testErrors }, + { patterns: ['tests-warnings/*.less'], verifyFunction: lessTester.testWarnings }, + { patterns: ['tests-config/js-type-errors/*.less'], verifyFunction: lessTester.testTypeErrors }, + { patterns: ['tests-config/no-js-errors/*.less'], verifyFunction: lessTester.testErrors }, { patterns: [ 'tests-config/sourcemaps/**/*.less', @@ -202,35 +174,17 @@ var testMap = [ if (type === 'vars') { return path.join(baseFolder, filename) + '.json'; } - // Extract just the filename (without directory) for the JSON file var jsonFilename = path.basename(filename); - // For sourcemap type, return path relative to test directory - if (type === 'sourcemap') { - return path.join('test/sourcemaps', jsonFilename) + '.json'; - } return path.join('test/sourcemaps', jsonFilename) + '.json'; } }, - { - patterns: ['tests-config/sourcemaps-empty/*.less'], - verifyFunction: lessTester.testEmptySourcemap - }, - { - patterns: ['tests-config/sourcemaps-disable-annotation/*.less'], - verifyFunction: lessTester.testSourcemapWithoutUrlAnnotation - }, - { - patterns: ['tests-config/sourcemaps-variable-selector/*.less'], - verifyFunction: lessTester.testSourcemapWithVariableInSelector - }, - - // Import tests with JSON configs + { patterns: ['tests-config/sourcemaps-empty/*.less'], verifyFunction: lessTester.testEmptySourcemap }, + { patterns: ['tests-config/sourcemaps-disable-annotation/*.less'], verifyFunction: lessTester.testSourcemapWithoutUrlAnnotation }, + { patterns: ['tests-config/sourcemaps-variable-selector/*.less'], verifyFunction: lessTester.testSourcemapWithVariableInSelector }, { patterns: ['tests-config/globalVars/*.less'], lessOptions: { globalVars: function(file) { - const fs = require('fs'); - const path = require('path'); const basename = path.basename(file, '.less'); const jsonPath = path.join(path.dirname(file), basename + '.json'); try { @@ -245,8 +199,6 @@ var testMap = [ patterns: ['tests-config/modifyVars/*.less'], lessOptions: { modifyVars: function(file) { - const fs = require('fs'); - const path = require('path'); const basename = path.basename(file, '.less'); const jsonPath = path.join(path.dirname(file), basename + '.json'); try { @@ -259,34 +211,28 @@ var testMap = [ } ]; -// Note: needle mocking is set up globally at the top of the file - testMap.forEach(function(testConfig) { - // For glob patterns, pass lessOptions as the first parameter and patterns as the second if (testConfig.patterns) { lessTester.runTestSet( - testConfig.lessOptions || {}, // First param: options (including lessOptions) - testConfig.patterns, // Second param: patterns - testConfig.verifyFunction || null, // Third param: verifyFunction - testConfig.nameModifier || null, // Fourth param: nameModifier - testConfig.doReplacements || null, // Fifth param: doReplacements - testConfig.getFilename || null // Sixth param: getFilename + testConfig.lessOptions || {}, + testConfig.patterns, + testConfig.verifyFunction || null, + testConfig.nameModifier || null, + testConfig.doReplacements || null, + testConfig.getFilename || null ); } else { - // Legacy format for non-glob tests - var args = [ - testConfig.options || {}, // First param: options - testConfig.foldername, // Second param: foldername - testConfig.verifyFunction || null, // Third param: verifyFunction - testConfig.nameModifier || null, // Fourth param: nameModifier - testConfig.doReplacements || null, // Fifth param: doReplacements - testConfig.getFilename || null // Sixth param: getFilename - ]; - lessTester.runTestSet.apply(lessTester, args); + lessTester.runTestSet.apply(lessTester, [ + testConfig.options || {}, + testConfig.foldername, + testConfig.verifyFunction || null, + testConfig.nameModifier || null, + testConfig.doReplacements || null, + testConfig.getFilename || null + ]); } }); -// Special synchronous tests lessTester.testSyncronous({syncImport: true}, 'tests-unit/import/import'); lessTester.testSyncronous({syncImport: true}, 'tests-config/math-strict/css'); @@ -295,13 +241,10 @@ lessTester.testDisablePluginRule(); lessTester.testJSImport(); lessTester.finished(); - -// Test HTTP redirect functionality console.log('\nTesting HTTP redirect functionality...'); testHttpRedirects(); console.log('HTTP redirect test completed'); -// Test import-remote functionality in isolation console.log('\nTesting import-remote functionality...'); testImportRemote(); console.log('Import-remote test completed'); diff --git a/packages/less/test/jess-alpha-fast-path.mjs b/packages/less/test/jess-alpha-fast-path.mjs new file mode 100644 index 0000000000..aff9618e6f --- /dev/null +++ b/packages/less/test/jess-alpha-fast-path.mjs @@ -0,0 +1,28 @@ +import assert from 'node:assert/strict'; + +import { createLessOptions } from '../lib/options.js'; + +function pluginNames(configOptions) { + return configOptions.compile.plugins.map(plugin => plugin.name); +} + +{ + const { configOptions } = createLessOptions({}); + assert.deepEqual(pluginNames(configOptions), ['less', 'less-compat']); +} + +{ + const { configOptions } = createLessOptions({ __jessSkipLessCompatWhenPluginFree: true }); + assert.deepEqual(pluginNames(configOptions), ['less']); +} + +{ + const plugin = { install() {} }; + const { configOptions } = createLessOptions({ + plugins: [plugin], + __jessSkipLessCompatWhenPluginFree: true + }); + assert.deepEqual(pluginNames(configOptions), ['less', 'less-compat']); +} + +console.log('Jess alpha plugin-configuration tests passed'); diff --git a/packages/less/test/less-test.js b/packages/less/test/less-test.js index ca4c5a35b5..8547b641a4 100644 --- a/packages/less/test/less-test.js +++ b/packages/less/test/less-test.js @@ -1,8 +1,18 @@ /* jshint latedef: nofunc */ -var semver = require('semver'); -var logger = require('../lib/less/logger').default; -var { cosmiconfigSync } = require('cosmiconfig'); -var glob = require('glob'); +import { createRequire } from 'module'; +import path from 'path'; +import fs from 'fs'; +import semver from 'semver'; +import logger from '../lib/logger.js'; +import { cosmiconfigSync } from 'cosmiconfig'; +import { globSync } from 'glob'; +import { copy as clone } from 'copy-anything'; +import less from '../lib/index.js'; +import { lesscHelper } from '../lib/lessc-helper.js'; + +const { stylize } = lesscHelper; + +const require = createRequire(import.meta.url); var isVerbose = process.env.npm_config_loglevel !== 'concise'; logger.addListener({ @@ -20,15 +30,7 @@ logger.addListener({ }); -module.exports = function(testFilter) { - var path = require('path'), - fs = require('fs'), - clone = require('copy-anything').copy; - - var less = require('../'); - - var stylize = require('../lib/less-node/lessc-helper').stylize; - +export default function(testFilter) { var globals = Object.keys(global); var oneTestOnly = testFilter || process.argv[2], @@ -37,33 +39,21 @@ module.exports = function(testFilter) { var testFolder = path.dirname(require.resolve('@less/test-data')); var lessFolder = testFolder; - // Define String.prototype.endsWith if it doesn't exist (in older versions of node) - // This is required by the testSourceMap function below - if (typeof String.prototype.endsWith !== 'function') { - String.prototype.endsWith = function (str) { - return this.slice(-str.length) === str; - } - } - var queueList = [], queueRunning = false; function queue(func) { if (queueRunning) { - // console.log("adding to queue"); queueList.push(func); } else { - // console.log("first in queue - starting"); queueRunning = true; func(); } } function release() { if (queueList.length) { - // console.log("running next in queue"); var func = queueList.shift(); setTimeout(func, 0); } else { - // console.log("stopping queue"); queueRunning = false; } } @@ -73,97 +63,87 @@ module.exports = function(testFilter) { passedTests = 0, finishTimer = setInterval(endTest, 500); - less.functions.functionRegistry.addMultiple({ - add: function (a, b) { - return new(less.tree.Dimension)(a.value + b.value); - }, - increment: function (a) { - return new(less.tree.Dimension)(a.value + 1); - }, - _color: function (str) { - if (str.value === 'evil red') { return new(less.tree.Color)('600'); } + // Less v5 exposes extension functions through the documented `plugins` + // render option. The v4 process-global function registry is deliberately + // not part of the v5 API. + const fixtureFunctionPlugin = { + install: function (pluginLess, _manager, functions) { + functions.addMultiple({ + add: function (a, b) { + return new(pluginLess.tree.Dimension)(a.value + b.value); + }, + increment: function (a) { + return new(pluginLess.tree.Dimension)(a.value + 1); + }, + _color: function (str) { + if (str.value === 'evil red') { return new(pluginLess.tree.Color)('600'); } + } + }); } - }); + }; function validateSourcemapMappings(sourcemap, lessFile, compiledCSS) { - // Validate sourcemap mappings using SourceMapConsumer var SourceMapConsumer = require('source-map').SourceMapConsumer; - // sourcemap can be either a string or already parsed object var sourceMapObj = typeof sourcemap === 'string' ? JSON.parse(sourcemap) : sourcemap; var consumer = new SourceMapConsumer(sourceMapObj); - - // Read the LESS source file + var lessSource = fs.readFileSync(lessFile, 'utf8'); var lessLines = lessSource.split('\n'); - - // Use the compiled CSS (remove sourcemap annotation for validation) + var cssSource = compiledCSS.replace(/\/\*# sourceMappingURL=.*\*\/\s*$/, '').trim(); var cssLines = cssSource.split('\n'); - + var errors = []; var validatedMappings = 0; - - // Validate mappings for each line in the CSS + for (var cssLine = 1; cssLine <= cssLines.length; cssLine++) { var cssLineContent = cssLines[cssLine - 1]; - // Skip empty lines if (!cssLineContent.trim()) { continue; } - - // Check mapping for the start of this CSS line + var mapping = consumer.originalPositionFor({ line: cssLine, column: 0 }); - + if (mapping.source) { validatedMappings++; - - // Verify the source file exists in the sourcemap + if (!sourceMapObj.sources || sourceMapObj.sources.indexOf(mapping.source) === -1) { errors.push('Line ' + cssLine + ': mapped to source "' + mapping.source + '" which is not in sources array'); } - - // Verify the line number is valid + if (mapping.line && mapping.line > 0) { - // If we can find the source file, validate the line exists var sourceIndex = sourceMapObj.sources.indexOf(mapping.source); if (sourceIndex >= 0 && sourceMapObj.sourcesContent && sourceMapObj.sourcesContent[sourceIndex] !== undefined && sourceMapObj.sourcesContent[sourceIndex] !== null) { var sourceContent = sourceMapObj.sourcesContent[sourceIndex]; - // Ensure sourceContent is a string (it should be, but be defensive) if (typeof sourceContent !== 'string') { sourceContent = String(sourceContent); } - // Split by newline - handle both \n and \r\n var sourceLines = sourceContent.split(/\r?\n/); if (mapping.line > sourceLines.length) { errors.push('Line ' + cssLine + ': mapped to line ' + mapping.line + ' in "' + mapping.source + '" but source only has ' + sourceLines.length + ' lines'); } - } else if (sourceIndex >= 0) { - // Source content not embedded, try to validate against the actual file if it matches - // This is a best-effort validation } } } } - - // Validate that all sources in the sourcemap are valid + if (sourceMapObj.sources) { sourceMapObj.sources.forEach(function(source, index) { if (sourceMapObj.sourcesContent && sourceMapObj.sourcesContent[index]) { - // Source content is embedded, validate it's not empty if (!sourceMapObj.sourcesContent[index].trim()) { errors.push('Source "' + source + '" has empty content'); } } }); } - + if (consumer.destroy && typeof consumer.destroy === 'function') { consumer.destroy(); } - + return { valid: errors.length === 0, errors: errors, @@ -171,13 +151,11 @@ module.exports = function(testFilter) { }; } - function testSourcemap(name, err, compiledLess, doReplacements, sourcemap, baseFolder, getFilename) { + function testSourcemap(name, err, compiledLess, doReplacements, sourcemap, baseFolder, imports, getFilename) { if (err) { fail('ERROR: ' + (err && err.message)); return; } - // Check the sourceMappingURL at the bottom of the file - // Default expected URL is name + '.css.map', but can be overridden by sourceMapURL option var sourceMappingPrefix = '/*# sourceMappingURL=', sourceMappingSuffix = ' */'; var indexOfSourceMappingPrefix = compiledLess.indexOf(sourceMappingPrefix); @@ -185,24 +163,20 @@ module.exports = function(testFilter) { fail('ERROR: sourceMappingURL was not found in ' + baseFolder + '/' + name + '.css.'); return; } - + var startOfSourceMappingValue = indexOfSourceMappingPrefix + sourceMappingPrefix.length, indexOfSuffix = compiledLess.indexOf(sourceMappingSuffix, startOfSourceMappingValue), actualSourceMapURL = compiledLess.substring(startOfSourceMappingValue, indexOfSuffix === -1 ? compiledLess.length : indexOfSuffix).trim(); - - // For tests with custom sourceMapURL, we just verify it exists and is non-empty - // The actual value will be validated by comparing the sourcemap JSON + if (!actualSourceMapURL) { fail('ERROR: sourceMappingURL is empty in ' + baseFolder + '/' + name + '.css.'); return; } - // Use getFilename if available (for sourcemap tests with subdirectories) var jsonPath; if (getFilename && typeof getFilename === 'function') { jsonPath = getFilename(name, 'sourcemap', baseFolder); } else { - // Fallback: extract just the filename for sourcemap JSON files var jsonFilename = path.basename(name); jsonPath = path.join('test/sourcemaps', jsonFilename) + '.json'; } @@ -212,30 +186,18 @@ module.exports = function(testFilter) { fail('ERROR: Could not read expected sourcemap file: ' + jsonPath + ' - ' + e.message); return; } - - // Apply doReplacements to the expected sourcemap to handle {path} placeholders - // This normalizes absolute paths that differ between environments - // For sourcemaps, we need to ensure {path} uses forward slashes to avoid breaking JSON - // (backslashes in JSON strings need escaping, and sourcemaps should use forward slashes anyway) + var replacementPath = path.join(path.dirname(path.join(baseFolder, name) + '.less'), '/'); - // Normalize to forward slashes for sourcemap JSON (web-compatible) replacementPath = replacementPath.replace(/\\/g, '/'); - // Replace {path} with normalized forward-slash path BEFORE calling doReplacements - // This ensures the JSON is always valid and uses web-compatible paths expectedSourcemap = expectedSourcemap.replace(/\{path\}/g, replacementPath); - // Also handle other placeholders that might be in the sourcemap (but {path} is already done) expectedSourcemap = doReplacements(expectedSourcemap, baseFolder, path.join(baseFolder, name) + '.less'); - - // Normalize paths in sourcemap JSON to use forward slashes (web-compatible) - // We need to parse the JSON, normalize the file property, then stringify for comparison - // This avoids breaking escape sequences like \n in the JSON string + function normalizeSourcemapPaths(sm) { try { var parsed = typeof sm === 'string' ? JSON.parse(sm) : sm; if (parsed.file) { parsed.file = parsed.file.replace(/\\/g, '/'); } - // Also normalize paths in sources array if (parsed.sources && Array.isArray(parsed.sources)) { parsed.sources = parsed.sources.map(function(src) { return src.replace(/\\/g, '/'); @@ -243,27 +205,21 @@ module.exports = function(testFilter) { } return JSON.stringify(parsed, null, 0); } catch (parseErr) { - // If parsing fails, return original (shouldn't happen) return sm; } } - + var normalizedSourcemap = normalizeSourcemapPaths(sourcemap); var normalizedExpected = normalizeSourcemapPaths(expectedSourcemap); - + if (normalizedSourcemap === normalizedExpected) { - // Validate the sourcemap mappings are correct - // Find the actual LESS file - it might be in a subdirectory var nameParts = name.split('/'); var lessFileName = nameParts[nameParts.length - 1]; var lessFileDir = nameParts.length > 1 ? nameParts.slice(0, -1).join('/') : ''; var lessFile = path.join(lessFolder, lessFileDir, lessFileName) + '.less'; - - // Only validate if the LESS file exists + if (fs.existsSync(lessFile)) { try { - // Parse the sourcemap once for validation (avoid re-parsing) - // Use the original sourcemap string, not the normalized one var sourceMapObjForValidation = typeof sourcemap === 'string' ? JSON.parse(sourcemap) : sourcemap; var validation = validateSourcemapMappings(sourceMapObjForValidation, lessFile, compiledLess); if (!validation.valid) { @@ -277,10 +233,9 @@ module.exports = function(testFilter) { if (isVerbose) { process.stdout.write(' (validation error: ' + validationErr.message + ')'); } - // Don't fail the test if validation has an error, just log it } } - + ok('OK'); } else if (err) { fail('ERROR: ' + (err && err.message)); @@ -299,14 +254,12 @@ module.exports = function(testFilter) { fail('ERROR: ' + (err && err.message)); return; } - // This matches with strings that end($) with source mapping url annotation. var sourceMapRegExp = /\/\*# sourceMappingURL=.+\.css\.map \*\/$/; if (sourceMapRegExp.test(compiledLess)) { fail('ERROR: sourceMappingURL found in ' + baseFolder + '/' + name + '.css.'); return; } - // Even if annotation is not necessary, the map file should be there. fs.readFile(path.join('test/', name) + '.json', 'utf8', function (e, expectedSourcemap) { process.stdout.write('- ' + path.join(baseFolder, name) + ': '); if (sourcemap === expectedSourcemap) { @@ -331,7 +284,6 @@ module.exports = function(testFilter) { var expectedSourcemap = undefined; if ( compiledLess !== '' ) { difference('\nCompiledLess must be empty', '', compiledLess); - } else if (sourcemap !== expectedSourcemap) { fail('Sourcemap must be undefined'); } else { @@ -346,7 +298,6 @@ module.exports = function(testFilter) { return; } - // Even if annotation is not necessary, the map file should be there. fs.readFile(path.join('test/', name) + '.json', 'utf8', function (e, expectedSourcemap) { process.stdout.write('- ' + path.join(baseFolder, name) + ': '); if (sourcemap === expectedSourcemap) { @@ -373,7 +324,6 @@ module.exports = function(testFilter) { return JSON.stringify(imports, null, ' ') } - /** Imports are not sorted */ const importsString = stringify(imports.sort()) fs.readFile(path.join(lessFolder, name) + '.json', 'utf8', function (e, expectedImports) { @@ -420,9 +370,27 @@ module.exports = function(testFilter) { }); } - // To fix ci fail about error format change in upstream v8 project - // https://github.com/v8/v8/commit/c0fd89c3c089e888c4f4e8582e56db7066fa779b - // Node 16.9.0+ include this change via https://github.com/nodejs/node/pull/39947 + // Assert the structured Jess warnings emitted during a render against a + // golden .txt, mirroring testErrors. Warnings are serialized as pretty JSON; + // the fixture's absolute directory is collapsed to {path} so goldens are + // portable. Trailing whitespace is ignored. + function testWarnings(name, err, compiledLess, doReplacements, sourcemap, baseFolder, imports, getFilename, warnings) { + var lessPath = path.join(baseFolder, name) + '.less'; + var dir = path.dirname(lessPath); + var actualWarn = JSON.stringify(warnings || [], null, 2) + .split(dir + path.sep).join('{path}') + .split(dir).join('{path}'); + fs.readFile(path.join(baseFolder, name) + '.txt', 'utf8', function (e, expectedWarn) { + process.stdout.write('- ' + path.join(baseFolder, name) + ': '); + var trimEnd = function (s) { return (s || '').replace(/\s+$/, ''); }; + if (trimEnd(actualWarn) === trimEnd(expectedWarn)) { + ok('OK'); + } else { + difference('FAIL', expectedWarn, actualWarn); + } + }); + } + function testTypeErrors(name, err, compiledLess, doReplacements, sourcemap, baseFolder) { const fileSuffix = semver.gte(process.version, 'v16.9.0') ? '-2.txt' : '.txt'; fs.readFile(path.join(baseFolder, name) + fileSuffix, 'utf8', function (e, expectedErr) { @@ -448,11 +416,15 @@ module.exports = function(testFilter) { // https://github.com/less/less.js/issues/3112 function testJSImport() { process.stdout.write('- Testing root function registry'); - less.functions.functionRegistry.add('ext', function() { - return new less.tree.Anonymous('file'); - }); + const rootRegistryPlugin = { + install: function (pluginLess, _manager, functions) { + functions.add('ext', function() { + return new pluginLess.tree.Anonymous('file'); + }); + } + }; var expected = '@charset "utf-8";\n'; - toCSS({}, path.join(lessFolder, 'tests-config', 'root-registry', 'root.less'), function(error, output) { + toCSS({ plugins: [rootRegistryPlugin] }, path.join(lessFolder, 'tests-config', 'root-registry', 'root.less'), function(error, output) { if (error) { return fail('ERROR: ' + error); } @@ -464,42 +436,33 @@ module.exports = function(testFilter) { } function globalReplacements(input, directory, filename) { - var path = require('path'); var p = filename ? path.join(path.dirname(filename), '/') : directory; - - // For debug tests in subdirectories (comments/, mediaquery/, all/), - // the import/ directory and main linenumbers.less file are at the parent debug/ level, not in the subdirectory + var isDebugSubdirectory = false; var debugParentPath = null; - + if (directory) { - // Normalize directory path separators for matching var normalizedDir = directory.replace(/\\/g, '/'); - // Check if we're in a debug subdirectory if (normalizedDir.includes('/debug/') && (normalizedDir.includes('/comments/') || normalizedDir.includes('/mediaquery/') || normalizedDir.includes('/all/'))) { isDebugSubdirectory = true; - // Extract the debug/ directory path (parent of the subdirectory) - // Match everything up to and including /debug/ (works with both absolute and relative paths) var debugMatch = normalizedDir.match(/(.+\/debug)\//); if (debugMatch) { debugParentPath = debugMatch[1]; } } } - + if (isDebugSubdirectory && debugParentPath) { - // For {path} placeholder, use the parent debug/ directory - // Convert back to native path format p = debugParentPath.replace(/\//g, path.sep) + path.sep; } - + var pathimport; if (isDebugSubdirectory && debugParentPath) { pathimport = path.join(debugParentPath.replace(/\//g, path.sep), 'import') + path.sep; } else { pathimport = path.join(directory + 'import/'); } - + var pathesc = p.replace(/[.:/\\]/g, function(a) { return '\\' + (a == '\\' ? '\/' : a); }), pathimportesc = pathimport.replace(/[.:/\\]/g, function(a) { return '\\' + (a == '\\' ? '\/' : a); }); @@ -544,13 +507,10 @@ module.exports = function(testFilter) { } function runTestSet(options, foldername, verifyFunction, nameModifier, doReplacements, getFilename) { - // Handle case where first parameter is glob patterns (no options object) if (Array.isArray(options)) { - // First parameter is glob patterns, no options object foldername = options; options = {}; } else if (typeof options === 'string') { - // First parameter is foldername (no options object) foldername = options; options = {}; } else { @@ -577,8 +537,7 @@ module.exports = function(testFilter) { var patterns = foldername; var includePatterns = []; var excludePatterns = []; - - + patterns.forEach(function(pattern) { if (pattern.startsWith('!')) { excludePatterns.push(pattern.substring(1)); @@ -586,11 +545,10 @@ module.exports = function(testFilter) { includePatterns.push(pattern); } }); - - // Use glob to find all matching files, excluding the excluded patterns + var allFiles = []; includePatterns.forEach(function(pattern) { - var files = glob.sync(pattern, { + var files = globSync(pattern, { cwd: baseFolder, absolute: true, ignore: excludePatterns @@ -598,21 +556,18 @@ module.exports = function(testFilter) { allFiles = allFiles.concat(files); }); - - // Note: needle mocking is set up globally in index.js - - // Process each .less file found + allFiles.forEach(function(filePath) { if (/\.less$/.test(filePath)) { var file = path.basename(filePath); - // For glob patterns, we need to construct the relative path differently - // The filePath is absolute, so we need to get the path relative to the test-data directory var relativePath = path.relative(baseFolder, path.dirname(filePath)) + '/'; - // Only process files that have corresponding .css files (these are the actual tests) + // A file is a test if it has a golden .css output OR a .txt + // expectation (error/warning sets assert a .txt instead of + // comparing compiled .css). var cssPath = path.join(path.dirname(filePath), path.basename(file, '.less') + '.css'); - if (fs.existsSync(cssPath)) { - // Process this file using the existing logic + var txtPath = path.join(path.dirname(filePath), path.basename(file, '.less') + '.txt'); + if (fs.existsSync(cssPath) || fs.existsSync(txtPath)) { processFileWithInfo({ file: file, fullPath: filePath, @@ -621,7 +576,6 @@ module.exports = function(testFilter) { } } }); - return; } @@ -630,169 +584,183 @@ module.exports = function(testFilter) { var file = fileInfo.file; var fullPath = fileInfo.fullPath; var relativePath = fileInfo.relativePath; - - // Load config for this specific file using cosmiconfig - var configResult = cosmiconfigSync('styles').search(path.dirname(fullPath)); - - // Deep clone the original options to prevent Less from modifying shared objects - var options = JSON.parse(JSON.stringify(originalOptions || {})); - - if (configResult && configResult.config && configResult.config.language && configResult.config.language.less) { - // Deep clone and merge the language.less settings with the original options - var lessConfig = JSON.parse(JSON.stringify(configResult.config.language.less)); - Object.keys(lessConfig).forEach(function(key) { - options[key] = lessConfig[key]; - }); - } - - // Merge any lessOptions from the testMap (for dynamic options like getVars functions) - if (originalOptions && originalOptions.lessOptions) { - Object.keys(originalOptions.lessOptions).forEach(function(key) { - var value = originalOptions.lessOptions[key]; - if (typeof value === 'function') { - // For functions, call them with the file path - var result = value(fullPath); - options[key] = result; - } else { - // For static values, use them directly - options[key] = value; - } - }); - } - // Don't pass stylize to less.render as it's not a valid option + var configResult = cosmiconfigSync('styles').search(path.dirname(fullPath)); var name = getBasename(file, relativePath); - if (oneTestOnly && typeof oneTestOnly === 'string' && !name.includes(oneTestOnly)) { return; } - totalTests++; - - if (options.sourceMap && !options.sourceMap.sourceMapFileInline) { - // Set test infrastructure defaults only if not already set by styles.config.cjs - // Less.js core (parse-tree.js) will handle normalization of: - // - sourceMapBasepath (defaults to input file's directory) - // - sourceMapInputFilename (defaults to options.filename) - // - sourceMapFilename (derived from sourceMapOutputFilename or input filename) - // - sourceMapOutputFilename (derived from input filename if not set) - if (!options.sourceMap.sourceMapOutputFilename) { - // Needed for sourcemap file name in JSON output - options.sourceMap.sourceMapOutputFilename = name + '.css'; + var config = configResult && configResult.config ? configResult.config : {}; + var outputs = getOutputTargets(config.output, file, fullPath, relativePath, nameModifier, name); + + outputs.forEach(function(outputTarget) { + var options = JSON.parse(JSON.stringify(originalOptions || {})); + + if (config.language && config.language.less) { + var lessConfig = JSON.parse(JSON.stringify(config.language.less)); + Object.keys(lessConfig).forEach(function(key) { + options[key] = lessConfig[key]; + }); } - if (!options.sourceMap.sourceMapRootpath) { - // Test-specific default for consistent test output paths - options.sourceMap.sourceMapRootpath = 'testweb/'; + + // Fixture output config is a Jess test-corpus concern. Select + // only its public Less equivalent; never pass the raw output + // object through the Less API. + if (typeof outputTarget.collapseNesting === 'boolean') { + options.collapseNesting = outputTarget.collapseNesting; } - } - options.getVars = function(file) { - try { - return JSON.parse(fs.readFileSync(getFilename(getBasename(file, relativePath), 'vars', baseFolder), 'utf8')); + if (originalOptions && originalOptions.lessOptions) { + Object.keys(originalOptions.lessOptions).forEach(function(key) { + var value = originalOptions.lessOptions[key]; + if (typeof value === 'function') { + var result = value(fullPath); + options[key] = result; + } else { + options[key] = value; + } + }); } - catch (e) { - return {}; + + totalTests++; + + if (options.sourceMap && typeof options.sourceMap === 'object') { + if (!options.sourceMap.sourceMapFileInline) { + if (!options.sourceMap.sourceMapOutputFilename) { + options.sourceMap.sourceMapOutputFilename = name + '.css'; + } + if (!options.sourceMap.sourceMapRootpath) { + options.sourceMap.sourceMapRootpath = 'testweb/'; + } + } } - }; - - var doubleCallCheck = false; - queue(function() { - toCSS(options, fullPath, function (err, result) { - - if (doubleCallCheck) { - totalTests++; - fail('less is calling back twice'); - process.stdout.write(doubleCallCheck + '\n'); - process.stdout.write((new Error()).stack + '\n'); - return; + + options.getVars = function(file) { + try { + return JSON.parse(fs.readFileSync(getFilename(getBasename(file, relativePath), 'vars', baseFolder), 'utf8')); } - doubleCallCheck = (new Error()).stack; - - /** - * @todo - refactor so the result object is sent to the verify function - */ - if (verifyFunction) { - var verificationResult = verifyFunction( - name, err, result && result.css, doReplacements, result && result.map, baseFolder, result && result.imports, getFilename - ); - release(); - return verificationResult; + catch (e) { + return {}; } + }; - if (err) { - fail('ERROR: ' + (err && err.message)); - if (isVerbose) { - process.stdout.write('\n'); - if (err.stack) { - process.stdout.write(err.stack + '\n'); - } else { - // this sometimes happen - show the whole error object - console.log(err); + var doubleCallCheck = false; + queue(function() { + toCSS(options, fullPath, function (err, result) { + + if (doubleCallCheck) { + totalTests++; + fail('less is calling back twice'); + process.stdout.write(doubleCallCheck + '\n'); + process.stdout.write((new Error()).stack + '\n'); + return; + } + doubleCallCheck = (new Error()).stack; + + if (verifyFunction) { + var warnings = (result && result.warnings) || (err && err.jessWarnings) || []; + var verificationResult = verifyFunction( + name, err, result && result.css, doReplacements, result && result.map, baseFolder, result && result.imports, getFilename, warnings + ); + release(); + return verificationResult; + } + + if (err) { + fail('ERROR: ' + (err && err.message)); + if (isVerbose) { + process.stdout.write('\n'); + if (err.stack) { + process.stdout.write(err.stack + '\n'); + } else { + console.log(err); + } } + release(); + return; } - release(); - return; - } - var css_name = name; - if (nameModifier) { css_name = nameModifier(name); } - - // Check if we're using the new co-located structure (tests-unit/ or tests-config/) or the old separated structure - var cssPath; - if (relativePath.startsWith('tests-unit/') || relativePath.startsWith('tests-config/')) { - // New co-located structure: CSS file is in the same directory as LESS file - cssPath = path.join(path.dirname(fullPath), path.basename(file, '.less') + '.css'); - } else { - // Old separated structure: CSS file is in separate css/ folder - // Windows compatibility: css_name may already contain path separators - // Use path.join with empty string to let path.join handle normalization - cssPath = path.join(testFolder, css_name) + '.css'; - } + var cssPath = outputTarget.cssPath; - // For the new structure, we need to handle replacements differently - var replacementPath; - if (relativePath.startsWith('tests-unit/') || relativePath.startsWith('tests-config/')) { - replacementPath = path.dirname(fullPath); - // Ensure replacementPath ends with a path separator for consistent matching - if (!replacementPath.endsWith(path.sep)) { - replacementPath += path.sep; + var replacementPath; + if (relativePath.startsWith('tests-unit/') || relativePath.startsWith('tests-config/')) { + replacementPath = path.dirname(fullPath); + if (!replacementPath.endsWith(path.sep)) { + replacementPath += path.sep; + } + } else { + replacementPath = path.join(baseFolder, relativePath); } - } else { - replacementPath = path.join(baseFolder, relativePath); - } - var testName = fullPath.replace(/\.less$/, ''); - process.stdout.write('- ' + testName + ': '); + var testName = fullPath.replace(/\.less$/, ''); + process.stdout.write('- ' + testName + ': '); + var css = fs.readFileSync(cssPath, 'utf8'); + css = css && doReplacements(css, replacementPath); + if (result.css === css) { ok('OK'); } + else { + difference('FAIL', css, result.css); + } - var css = fs.readFileSync(cssPath, 'utf8'); - css = css && doReplacements(css, replacementPath); - if (result.css === css) { ok('OK'); } - else { - difference('FAIL', css, result.css); - } - - release(); + release(); + }); }); }); } - + + function getOutputTargets(outputConfig, file, fullPath, relativePath, nameModifier, name) { + var baseName = path.basename(file, '.less'); + var fallbackName = name; + if (nameModifier) { fallbackName = nameModifier(name); } + var fixtureOutput = relativePath.startsWith('tests-unit/') || relativePath.startsWith('tests-config/'); + // `packages/test-data/styles.config.ts` establishes this corpus + // default. cosmiconfig stops at the test-data package boundary, so + // retain it here while local styles.config files override it. + var defaultOutput = { collapseNesting: true }; + + function targetFrom(entry) { + var outputFile = (entry.file || '{name}.css').replace(/\{name\}/g, baseName); + return { + collapseNesting: entry.collapseNesting, + cssPath: fixtureOutput + ? path.join(path.dirname(fullPath), outputFile) + : path.join(testFolder, entry.file ? outputFile : fallbackName + '.css') + }; + } + + if (!outputConfig || typeof outputConfig !== 'object') { + return [targetFrom(defaultOutput)]; + } + if (!Array.isArray(outputConfig)) { + return [targetFrom(Object.assign({}, defaultOutput, outputConfig))]; + } + + var defaults = defaultOutput; + var targets = []; + outputConfig.forEach(function(entry) { + if (!entry || typeof entry !== 'object') { return; } + if (!Object.prototype.hasOwnProperty.call(entry, 'file')) { + defaults = Object.assign(defaults, entry); + return; + } + targets.push(targetFrom(Object.assign({}, defaults, entry))); + }); + return targets.length ? targets : [targetFrom(defaults)]; + } + function getBasename(file, relativePath) { var basePath = relativePath || foldername; - // Ensure basePath ends with a slash for proper path construction if (basePath.charAt(basePath.length - 1) !== '/') { basePath = basePath + '/'; } return basePath + path.basename(file, '.less'); } - - // This function is only called for non-glob patterns now - // For glob patterns, we use the glob library in the calling code var dirPath = path.join(baseFolder, foldername); var items = fs.readdirSync(dirPath); - + items.forEach(function(item) { if (/\.less$/.test(item)) { processFileWithInfo({ @@ -805,11 +773,9 @@ module.exports = function(testFilter) { } function diff(left, right) { - // Configure chalk to always show colors var chalk = require('chalk'); - chalk.level = 3; // Force colors on - - // Use jest-diff for much clearer output like Vitest + chalk.level = 3; + var diffResult = require('jest-diff').diffStringsUnified(left || '', right || '', { expand: false, includeChangeCounts: true, @@ -819,8 +785,7 @@ module.exports = function(testFilter) { changeColor: chalk.inverse, commonColor: chalk.dim }); - - // jest-diff returns a string with ANSI colors, so we can output it directly + process.stdout.write(diffResult + '\n'); } @@ -834,9 +799,8 @@ module.exports = function(testFilter) { process.stdout.write(stylize(msg, 'yellow') + '\n'); failedTests++; - // Only show the diff, not the full text process.stdout.write(stylize('Diff:', 'yellow') + '\n'); - + diff(left || '', right || ''); endTest(); } @@ -882,48 +846,38 @@ module.exports = function(testFilter) { return false; } - /** - * - * @param {Object} options - * @param {string} filePath - * @param {Function} callback - */ function toCSS(options, filePath, callback) { - // Deep clone options to prevent modifying the original, but preserve functions var originalOptions = options || {}; options = JSON.parse(JSON.stringify(originalOptions)); - - // Restore functions that were lost in JSON serialization + if (originalOptions.getVars) { options.getVars = originalOptions.getVars; } + // JSON cloning intentionally drops functions. Retain test-local plugin + // objects so every render exercises the v5 public plugin option. + options.plugins = [fixtureFunctionPlugin, ...(originalOptions.plugins || [])]; var str = fs.readFileSync(filePath, 'utf8'), addPath = path.dirname(filePath); - - // Initialize paths array if it doesn't exist + if (typeof options.paths !== 'string') { options.paths = options.paths || []; } else { options.paths = [options.paths]; } - - // Add the current directory to paths if not already present + if (!contains(options.paths, addPath)) { options.paths.push(addPath); } - - // Resolve all paths relative to the test file's directory + options.paths = options.paths.map(searchPath => { if (path.isAbsolute(searchPath)) { return searchPath; } - // Resolve relative to the test file's directory return path.resolve(path.dirname(filePath), searchPath); }) - + options.filename = path.resolve(process.cwd(), filePath); options.optimization = options.optimization || 0; - // Note: globalVars and modifyVars are now handled via styles.config.cjs or lessOptions if (options.plugin) { var Plugin = require(path.resolve(process.cwd(), options.plugin)); options.plugins = [Plugin]; @@ -946,15 +900,11 @@ module.exports = function(testFilter) { ok(stylize('OK\n', 'green')); } - // HTTP redirect testing is now handled directly in test/index.js - function testDisablePluginRule() { less.render( '@plugin "../../plugin/some_plugin";', {disablePluginRule: true}, function(err) { - // TODO: Need a better way of identifing exactly which error is thrown. Checking - // text like this tends to be rather brittle. const EXPECTED = '@plugin statements are not allowed when disablePluginRule is set to true'; if (!err || String(err).indexOf(EXPECTED) < 0) { fail('ERROR: Expected "' + EXPECTED + '" error'); @@ -970,6 +920,7 @@ module.exports = function(testFilter) { runTestSetNormalOnly: runTestSetNormalOnly, testSyncronous: testSyncronous, testErrors: testErrors, + testWarnings: testWarnings, testTypeErrors: testTypeErrors, testSourcemap: testSourcemap, testSourcemapWithoutUrlAnnotation: testSourcemapWithoutUrlAnnotation, @@ -981,4 +932,4 @@ module.exports = function(testFilter) { testJSImport: testJSImport, finished: finished }; -}; +} diff --git a/packages/less/test/lessc-alpha.mjs b/packages/less/test/lessc-alpha.mjs new file mode 100644 index 0000000000..174fa142ff --- /dev/null +++ b/packages/less/test/lessc-alpha.mjs @@ -0,0 +1,272 @@ +import assert from 'node:assert/strict'; +import { mkdtemp, readFile, realpath, rm, writeFile } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { spawn } from 'node:child_process'; +import less from '../lib/index.js'; +import { createLessOptions } from '../lib/options.js'; + +const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); +const lessc = path.join(packageRoot, 'bin', 'lessc'); +const ESC = String.fromCharCode(0x1B); +const BEL = String.fromCharCode(0x07); + +function runLessc(args, input = '') { + return new Promise((resolve, reject) => { + const child = spawn(process.execPath, [lessc, ...args], { + cwd: packageRoot, + stdio: ['pipe', 'pipe', 'pipe'] + }); + let stdout = ''; + let stderr = ''; + + child.stdout.setEncoding('utf8'); + child.stderr.setEncoding('utf8'); + child.stdout.on('data', chunk => { stdout += chunk; }); + child.stderr.on('data', chunk => { stderr += chunk; }); + child.on('error', reject); + child.on('close', code => resolve({ code, stdout, stderr })); + child.stdin.end(input); + }); +} + +function stripTerminalFormatting(value) { + const osc8Link = new RegExp(`${ESC}\\]8;;[^${ESC}]*(?:${ESC}\\\\|${BEL})`, 'gu'); + const terminalCode = new RegExp(`${ESC}\\[[0-?]*[ -/]*[@-~]`, 'gu'); + return value + .replace(osc8Link, '') + .replace(terminalCode, ''); +} + +function assertNoUiControlSequences(value, label) { + assert.doesNotMatch(value, new RegExp(`${ESC}\\[\\?\\d+[hl]`, 'u'), + `${label} must not use alternate-screen or private terminal mode controls`); + assert.doesNotMatch(value, new RegExp(`${ESC}\\]9;`, 'u'), + `${label} must not use OSC live-region controls`); +} + +const compilerEntrypoint = fileURLToPath(import.meta.resolve('@jesscss/compiler')); +assert.match(compilerEntrypoint, /[/\\]@jesscss[/\\]compiler[/\\]lib[/\\]index\.js$/, + 'the Less CLI must resolve the built generic Jess compiler entrypoint'); +await realpath(compilerEntrypoint); + +{ + assert.deepEqual(createLessOptions({}).configOptions.output, {}); + assert.deepEqual( + createLessOptions({ collapseNesting: true }).configOptions.output, + [{ collapseNesting: true }] + ); + + const source = '.parent { before: 1; .child { inside: 2; } after: 3; }\n'; + assert.equal((await less.render(source)).css, `.parent { + before: 1; + .child { + inside: 2; + } + after: 3; +} +`); + assert.equal((await less.render(source, { collapseNesting: true })).css, `.parent { + before: 1; +} +.parent .child { + inside: 2; +} +.parent { + after: 3; +} +`); + + await assert.rejects( + less.render('@Eight: 8;\n@charset "UTF-@{Eight}";\n', { + filename: 'dynamic-charset.less' + }), + error => { + assert.equal(error.type, 'parse'); + assert.equal(error.message, 'Interpolation is not valid in @charset.'); + assert.equal(error.filename, 'dynamic-charset.less'); + assert.equal(error.line, 2); + assert.equal(error.column, 1); + assert.deepEqual(error.extract, [ + '@Eight: 8;', + '@charset "UTF-@{Eight}";', + '' + ]); + assert.equal(String(error), 'Error: Interpolation is not valid in @charset.'); + assert.doesNotMatch(String(error), /offset/i); + assert.equal(error.jessErrors?.[0]?.code, 'parse/dynamic-charset'); + assert.equal(error.jessErrors?.[0]?.message, error.message); + assert.deepEqual(error.jessErrors?.[0]?.lines, { + 1: '@Eight: 8;', + 2: '@charset "UTF-@{Eight}";', + 3: '' + }); + return true; + }, + 'Less 5 rejects dynamic @charset with a dedicated parse diagnostic' + ); +} + +const tempDir = await mkdtemp(path.join(tmpdir(), 'lessc-alpha-')); +try { + const imported = path.join(tempDir, 'imported.less'); + const input = path.join(tempDir, 'input.less'); + const output = path.join(tempDir, 'output.css'); + const nested = path.join(tempDir, 'nested.less'); + const nestedOutput = path.join(tempDir, 'nested.css'); + const broken = path.join(tempDir, 'broken.less'); + const dynamicCharset = path.join(tempDir, 'dynamic-charset.less'); + + await writeFile(path.join(tempDir, 'styles.config.cjs'), [ + 'module.exports = {', + ' output: [{ file: \'{name}.css\', collapseNesting: false }]', + '};', + '' + ].join('\n')); + await writeFile(imported, '.from-import { color: green; }\n'); + await writeFile(input, '@import "imported.less";\n.from-file { width: (1 + 1); }\n'); + await writeFile(nested, '.parent { before: 1; .child { inside: 2; } after: 3; }\n'); + await writeFile(broken, '.broken { color: red;\n'); + await writeFile(dynamicCharset, '@Eight: 8;\n@charset "UTF-@{Eight}";\n'); + + const collapsedCss = `.parent { + before: 1; +} +.parent .child { + inside: 2; +} +.parent { + after: 3; +} +`; + + assert.equal( + (await less.renderFile(nested, { collapseNesting: true })).css, + collapsedCss, + 'an explicit Less renderFile option overrides a file-local output config' + ); + + const version = await runLessc(['--version']); + assert.equal(version.code, 0, version.stderr); + assert.match(version.stdout, /^lessc \d+\.\d+\.\d+-alpha\.\d+ \(Less Compiler\) \[Jess\]\n$/); + assert.equal(version.stderr, ''); + + const help = await runLessc(['--help']); + assert.equal(help.code, 0, help.stderr); + assert.match(help.stdout, /--collapse-nesting/, + 'lessc help documents the supported alpha nesting flag'); + assert.match(help.stdout, /This release intentionally supports a smaller CLI surface/, + 'lessc help explicitly scopes the supported CLI surface'); + assert.doesNotMatch(help.stdout, /--source-map/, + 'lessc help must not advertise unsupported source-map flags in alpha.1'); + assert.doesNotMatch(help.stdout, /--plugin=/, + 'lessc help must not advertise unsupported plugin flags in alpha.1'); + + for (const flag of ['--source-map', '--plugin=less-plugin-clean-css', '--bogus']) { + const unsupported = await runLessc([flag, '-'], '.unsupported { color: red; }\n'); + assert.equal(unsupported.code, 1, `${flag} must fail instead of silently no-oping`); + assert.equal(unsupported.stdout, '', `${flag} must not emit CSS after rejecting the option`); + assert.match(unsupported.stderr, /not supported/, + `${flag} must explain the alpha CLI surface`); + } + + const stdin = await runLessc(['-'], '.from-stdin { color: blue; }\n'); + assert.equal(stdin.code, 0, stdin.stderr); + assert.match(stdin.stdout, /\.from-stdin\s*\{[\s\S]*color:\s*blue;/); + assert.equal(stdin.stderr, ''); + + const warning = await runLessc(['-'], '.warn { color: lighten(red, nope); }\n'); + assert.equal(warning.code, 0, warning.stderr); + assert.match(warning.stdout, /\.warn\s*\{[\s\S]*color:\s*lighten\(red, nope\);/, + 'warning-producing compiles still emit CSS on stdout'); + assert.doesNotMatch(warning.stdout, /function\/unresolved/, + 'lessc must not mix warnings into CSS stdout'); + assert.match(warning.stderr, /function\/unresolved/, + 'lessc prints structured Jess warnings on stderr after successful compiles'); + + const quietWarning = await runLessc(['--quiet', '-'], '.warn { color: lighten(red, nope); }\n'); + assert.equal(quietWarning.code, 0, quietWarning.stderr); + assert.match(quietWarning.stdout, /\.warn\s*\{/); + assert.equal(quietWarning.stderr, '', '--quiet suppresses successful warning diagnostics'); + + const collapsed = await runLessc( + ['--collapse-nesting', '-'], + '.parent { before: 1; .child { inside: 2; } after: 3; }\n' + ); + assert.equal(collapsed.code, 0, collapsed.stderr); + assert.equal(collapsed.stderr, ''); + assert.equal(collapsed.stdout, `.parent { + before: 1; +} +.parent .child { + inside: 2; +} +.parent { + after: 3; +} +`); + + const collapsedFile = await runLessc(['--collapse-nesting', nested, nestedOutput]); + assert.equal(collapsedFile.code, 0, collapsedFile.stderr); + assert.equal(collapsedFile.stderr, ''); + assert.equal(await readFile(nestedOutput, 'utf8'), collapsedCss, + 'file-mode lessc preserves declaration source order while collapsing nesting'); + + const file = await runLessc([input, output]); + assert.equal(file.code, 0, file.stderr); + assert.match(file.stdout, /^lessc: wrote .+output\.css\n$/); + assert.equal(file.stderr, ''); + const css = await readFile(output, 'utf8'); + assert.match(css, /\.from-import\s*\{[\s\S]*color:\s*green;/, + 'file compilation resolves a sibling import through the CLI'); + assert.match(css, /\.from-file\s*\{[\s\S]*width:\s*2;/); + + const failure = await runLessc([broken]); + assert.equal(failure.code, 1, 'a Less error is a failing lessc process'); + assert.equal(failure.stdout, ''); + assert.ok(failure.stderr.includes(`${ESC}[91m`), + 'lessc reports colored Linecraft diagnostics by default'); + assertNoUiControlSequences(failure.stderr, 'lessc diagnostics'); + assert.match(failure.stderr, /[\u256d\u2570]/u, + 'lessc reports Linecraft source framing by default'); + const failureStderr = stripTerminalFormatting(failure.stderr); + assert.match(failureStderr, /parse\/syntax-error \[parse\]/, + 'lessc reports the Linecraft diagnostic code on stderr'); + assert.match(failureStderr, /broken\.less:2:1/, + 'lessc reports filename, line, and column on stderr'); + assert.match(failureStderr, /\.broken \{ color: red;/, + 'lessc reports the source line on stderr'); + assert.doesNotMatch(failureStderr, /offset/i, + 'lessc diagnostics must not expose raw offsets to users'); + assert.doesNotMatch(failureStderr, / on line \d+, column \d+/, + 'lessc must not reformat Linecraft diagnostics into Less 4-style text'); + assert.doesNotMatch(failureStderr, /^Error: Less parser error\.$/m, + 'lessc must not append a duplicate plain Error after a Linecraft diagnostic'); + + const dynamicCharsetFailure = await runLessc([dynamicCharset]); + assert.equal(dynamicCharsetFailure.code, 1, 'dynamic @charset is a failing lessc process'); + assert.equal(dynamicCharsetFailure.stdout, ''); + const dynamicCharsetStderr = stripTerminalFormatting(dynamicCharsetFailure.stderr); + assert.match(dynamicCharsetStderr, /parse\/dynamic-charset \[parse\]/, + 'lessc reports the canonical Jess diagnostic code for dynamic @charset'); + assert.match(dynamicCharsetStderr, /Interpolation is not valid in @charset\./, + 'lessc preserves the canonical Jess diagnostic message'); + assert.doesNotMatch(dynamicCharsetStderr, /Interpolation in @charset is not supported\./, + 'lessc must not restore the old Less wrapper message rewrite'); + + const silentFailure = await runLessc(['--silent', broken]); + assert.equal(silentFailure.code, 1, '--silent should still fail malformed input'); + assert.equal(silentFailure.stdout, ''); + assert.equal(silentFailure.stderr, '', '--silent must suppress Jess diagnostics'); + + const noColorFailure = await runLessc(['--no-color', broken]); + assert.equal(noColorFailure.code, 1, '--no-color should still fail malformed input'); + assert.equal(noColorFailure.stdout, ''); + assert.equal(noColorFailure.stderr.includes(ESC), false, + '--no-color must suppress ANSI and terminal control sequences'); +} finally { + await rm(tempDir, { recursive: true, force: true }); +} + +console.log('Jess-powered lessc alpha tests passed'); diff --git a/packages/less/test/mocha-playwright/runner.js b/packages/less/test/mocha-playwright/runner.js index da6ef8fd96..c093382384 100644 --- a/packages/less/test/mocha-playwright/runner.js +++ b/packages/less/test/mocha-playwright/runner.js @@ -1,8 +1,6 @@ -'use strict'; - -const path = require('path'); -const util = require('util'); -const { chromium } = require('playwright'); +import path from 'path'; +import util from 'util'; +import { chromium } from 'playwright'; const TIMEOUT_MILLISECONDS = 60000; function initMocha(reporter) { @@ -155,7 +153,7 @@ function prepareUrl(filePath) { return `file://${resolvedPath}`; } -exports.runner = function ({ file, reporter, timeout, width, height, args, executablePath, visible, polling }) { +export function runner({ file, reporter, timeout, width, height, args, executablePath, visible, polling }) { return new Promise(resolve => { // validate options @@ -207,4 +205,4 @@ exports.runner = function ({ file, reporter, timeout, width, height, args, execu resolve(result); }); -}; +} diff --git a/packages/less/test/modify-vars.js b/packages/less/test/modify-vars.js index a5763d2eb4..73ec6a0497 100644 --- a/packages/less/test/modify-vars.js +++ b/packages/less/test/modify-vars.js @@ -1,14 +1,5 @@ -var less; - -// Dist fallback for NPM-installed Less (for plugins that do testing) -try { - less = require('../tmp/less.cjs.js'); -} -catch (e) { - less = require('../dist/less.cjs.js'); -} - -var fs = require('fs'); +import less from '../lib/index.js'; +import fs from 'fs'; var input = fs.readFileSync('./test/less/modifyVars/extended.less', 'utf8'); var expectedCss = fs.readFileSync('./test/css/modifyVars/extended.css', 'utf8'); diff --git a/packages/less/test/plugins/filemanager/index.js b/packages/less/test/plugins/filemanager/index.cjs similarity index 100% rename from packages/less/test/plugins/filemanager/index.js rename to packages/less/test/plugins/filemanager/index.cjs diff --git a/packages/less/test/plugins/postprocess/index.js b/packages/less/test/plugins/postprocess/index.cjs similarity index 100% rename from packages/less/test/plugins/postprocess/index.js rename to packages/less/test/plugins/postprocess/index.cjs diff --git a/packages/less/test/plugins/preprocess/index.js b/packages/less/test/plugins/preprocess/index.cjs similarity index 100% rename from packages/less/test/plugins/preprocess/index.js rename to packages/less/test/plugins/preprocess/index.cjs diff --git a/packages/less/test/plugins/visitor/index.js b/packages/less/test/plugins/visitor/index.cjs similarity index 100% rename from packages/less/test/plugins/visitor/index.js rename to packages/less/test/plugins/visitor/index.cjs diff --git a/packages/less/test/sourcemaps/comprehensive.json b/packages/less/test/sourcemaps/comprehensive.json index 96215f2694..a4a88963bf 100644 --- a/packages/less/test/sourcemaps/comprehensive.json +++ b/packages/less/test/sourcemaps/comprehensive.json @@ -1 +1 @@ -{"version":3,"sources":["comprehensive.less"],"names":[],"mappings":"AAoBA;EACE,aAAA;EACA,mBAAA;;AAFF,UAIE;EACE,YAAA;EACA,eAAA;;AANJ,UAIE,QAIE;EACE,iBAAA;EACA,mBAAA;;AAVN,UAcE;EACE,mBAAA;EACA,aAAA;;AAhBJ,UAcE,SAIE;EACE,SAAA;EACA,gBAAA;;AAMN;EACE,OAAO,qBAAP;EACA,QAAQ,iBAAR;EACA,YAAA;;AAIF;EACE,cAAA;EACA,mBAAA;EACA,yCAAA;;AAIF;EAlDE,mBAAA;EACA,2BAAA;EACA,wBAAA;EAIA,yCAAA;EA+CA,aAAA;EACA,iBAAA;;AAIF,QAA0B;EACxB;IACE,aAAA;;EADF,UAGE;IACE,eAAA;;;AAKN;EACE;IACE,aAAA;IACA,uBAAuB,cAAvB;IACA,SAAA;;;AAKJ;AAMA;EALE,kBAAA;EACA,YAAA;EACA,eAAA;;AAGF;EAEE,mBAAA;EACA,YAAA;;AAIF,WACE;EACE,gBAAA;;AAFJ,WACE,GAGE;EACE,qBAAA;;AALN,WACE,GAGE,GAGE;EACE,qBAAA;;AAEA,WATN,GAGE,GAGE,EAGG;EACC,cAAA;;AAGF,WAbN,GAGE,GAGE,EAOG;EACC,cAAA;;AAYT;EACC,cAAA;;AAIF,OACE,QACE,QACE;EACE,cAAA","file":"{path}comprehensive.css"} \ No newline at end of file +{"version":3,"sources":["comprehensive.less"],"names":[],"mappings":"AAoBA;EACE,aAAA;EACA,mBAAA;;AAFF,UAIE;EACE,YAAA;EACA,eAAA;;AANJ,UAIE,QAIE;EACE,iBAAA;EACA,mBAAA;;AAVN,UAcE;EACE,mBAAA;EACA,aAAA;;AAhBJ,UAcE,SAIE;EACE,SAAA;EACA,gBAAA;;AAMN;EACE,OAAO,qBAAP;EACA,QAAQ,iBAAR;EACA,YAAA;;AAIF;EACE,cAAA;EACA,mBAAA;EACA,yCAAA;;AAIF;EAlDE,mBAAA;EACA,2BAAA;EACA,wBAAA;EAIA,yCAAA;EA+CA,aAAA;EACA,iBAAA;;AAIF,QAA0B;EACxB;IACE,aAAA;;EADF,UAGE;IACE,eAAA;;;AAKN;EACE;IACE,aAAA;IACA,uBAAuB,cAAvB;IACA,SAAA;;;AAKJ;AAMA;EALE,kBAAA;EACA,YAAA;EACA,eAAA;;AAGF;EAEE,mBAAA;EACA,YAAA;;AAIF,WACE;EACE,gBAAA;;AAFJ,WACE,GAGE;EACE,qBAAA;;AALN,WACE,GAGE,GAGE;EACE,qBAAA;;AAEA,WATN,GAGE,GAGE,EAGG;EACC,cAAA;;AAGF,WAbN,GAGE,GAGE,EAOG;EACC,cAAA;;AAYT;EACC,cAAA;;AAIF,OACE,QACE,QACE;EACE,cAAA","file":"comprehensive.css"} \ No newline at end of file diff --git a/packages/less/test/test-cjs-suite.cjs b/packages/less/test/test-cjs-suite.cjs new file mode 100644 index 0000000000..173b1a528f --- /dev/null +++ b/packages/less/test/test-cjs-suite.cjs @@ -0,0 +1,46 @@ +/** + * CJS build test — runs a subset of tests using dist/less-node.cjs. + * Run in addition to the main ESM test suite to verify the CJS build. + */ +'use strict'; + +const path = require('path'); +const fs = require('fs'); + +console.log('Testing CJS build (dist/less-node.cjs)...\n'); + +const less = require('../dist/less-node.cjs'); +const testFolder = path.dirname(require.resolve('@less/test-data')); + +function runTest(name, lessFile, expectedCss) { + const fullPath = path.join(testFolder, lessFile); + const content = fs.readFileSync(fullPath, 'utf8'); + return less.render(content, { filename: fullPath }) + .then(function (result) { + const actual = result.css.trim(); + const expected = (expectedCss || '').trim(); + if (expected && actual !== expected) { + console.error('FAIL', name, '- output mismatch'); + process.exit(1); + } + console.log(' ✓', name); + }) + .catch(function (err) { + console.error('FAIL', name, err.message); + process.exit(1); + }); +} + +Promise.all([ + runTest('variables', 'tests-unit/variables/variables.less'), + runTest('mixins', 'tests-unit/mixins/mixins.less'), + runTest('operations', 'tests-unit/operations/operations.less'), + runTest('import', 'tests-unit/import/import.less') +]) + .then(function () { + console.log('\nCJS build tests passed.'); + }) + .catch(function (err) { + console.error(err); + process.exit(1); + }); diff --git a/packages/less/test/test-cjs.cjs b/packages/less/test/test-cjs.cjs new file mode 100644 index 0000000000..cc2741a1a3 --- /dev/null +++ b/packages/less/test/test-cjs.cjs @@ -0,0 +1,58 @@ +// Replicates: "const less = require('less')" — how users report importing (Node, Webpack CJS) +console.log("Testing: require('less')..."); + +const less = require('less'); + +// Verify it's not a thenable (shouldn't be awaited accidentally) +if (typeof less.then === 'function') { + console.error('CJS test FAILED: exports should not be thenable'); + process.exit(1); +} + +// Test 1: Promise-based render +less.render('.class { width: (1 + 1) }') + .then(function(output) { + if (!output.css.includes('width: 2')) { + console.error('CJS render test FAILED:', output.css); + process.exit(1); + } + console.log('CJS render test PASSED'); + + return new Promise(function(resolve, reject) { + var callbackCompleted = false; + var timer = setTimeout(function() { + if (!callbackCompleted) { + reject(new Error('CJS callback test FAILED: callback was not invoked')); + } + }, 5000); + + // Test 2: Callback-based render + less.render('.cb { color: red }', function(err, output) { + callbackCompleted = true; + clearTimeout(timer); + if (err) { + reject(err); + return; + } + if (!output.css.includes('color: red')) { + reject(new Error('CJS callback test FAILED: ' + output.css)); + return; + } + console.log('CJS callback test PASSED'); + resolve(); + }); + }); + }) + .then(function() { + // Test 3: Property access (version) — available after load + const version = less.version; + if (!Array.isArray(version) || version.length !== 3) { + console.error('CJS version test FAILED:', version); + process.exit(1); + } + console.log('CJS version test PASSED:', version.join('.')); + }) + .catch(function(err) { + console.error('CJS test FAILED:', err); + process.exit(1); + }); diff --git a/packages/less/test/test-es6.js b/packages/less/test/test-es6.js new file mode 100644 index 0000000000..670dd86c62 --- /dev/null +++ b/packages/less/test/test-es6.js @@ -0,0 +1,29 @@ +// https://github.com/less/less.js/issues/3533 +// Replicates: "import less from 'less'" — ESM import +console.log("Testing: import less from 'less'..."); + +import less from 'less'; + +// Test 1: Promise-based API (await) +const output = await less.render('.class { width: (1 + 1) }'); +if (output.css.includes('width: 2')) { + console.log('Promise/await test PASSED'); +} else { + console.error('Promise/await test FAILED:', output.css); + process.exit(1); +} + +// Test 2: Callback-based API +less.render(` +body { + a: 1; + b: 2; + c: 30; + d: 4; +}`, function(error, output) { + if (error) { + console.error('Callback test FAILED:', error); + process.exit(1); + } + console.log('Callback test PASSED'); +}) diff --git a/packages/less/test/test-es6.ts b/packages/less/test/test-es6.ts deleted file mode 100644 index f83b2d0b1e..0000000000 --- a/packages/less/test/test-es6.ts +++ /dev/null @@ -1,17 +0,0 @@ -// https://github.com/less/less.js/issues/3533 -console.log('Testing ES6 imports...') - -import less from '..'; -const lessRender = less.render; - -// then I call lessRender on something -lessRender(` -body { - a: 1; - b: 2; - c: 30; - d: 4; -}`, {sourceMap: {}}, function(error: any, output: any) { - if (error) - console.error(error) -}) \ No newline at end of file diff --git a/packages/less/tsconfig.build.json b/packages/less/tsconfig.build.json deleted file mode 100644 index bbb6936825..0000000000 --- a/packages/less/tsconfig.build.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "rootDir": "./src", - }, - "include": ["src/**/*"] -} \ No newline at end of file diff --git a/packages/less/tsconfig.json b/packages/less/tsconfig.json index 9eb20b6bda..1a24413664 100644 --- a/packages/less/tsconfig.json +++ b/packages/less/tsconfig.json @@ -1,21 +1,17 @@ { "compilerOptions": { - "outDir": "./lib", + "target": "ES2022", + "module": "ES2022", "moduleResolution": "node", - "rootDir": ".", "allowJs": true, - "sourceMap": true, - "inlineSources": true, + "checkJs": false, + "noEmit": true, "esModuleInterop": true, - "importHelpers": true, "noImplicitAny": true, - "target": "ES5" + "strict": false, + "skipLibCheck": true, + "rootDir": "." }, - "ts-node": { - "compilerOptions": { - "rootDir": "." - } - }, - "include": ["**/*"], - "exclude": ["node_modules", "lib/**/*"] -} \ No newline at end of file + "include": ["lib/**/*"], + "exclude": ["node_modules"] +} diff --git a/packages/test-data/UPSTREAM-FIXTURE-SYNC.md b/packages/test-data/UPSTREAM-FIXTURE-SYNC.md new file mode 100644 index 0000000000..ffc78b2c1c --- /dev/null +++ b/packages/test-data/UPSTREAM-FIXTURE-SYNC.md @@ -0,0 +1,54 @@ +# Upstream Fixture Sync Notes + +## Verification snapshot + +Rechecked on 2026-07-29 from PR #19 head `4abb411c` after fetching `origin` +and `upstream`: + +- `origin/less-5-alpha.1` is also `4abb411c`. +- `upstream/alpha` is `330e9d71`; `HEAD...upstream/alpha` is `125 0`. +- `upstream/master` is `89c33e09`; `HEAD...upstream/master` is `108 40`. + +The fixture/test-data commits in `8ae2cc3b..upstream/master` are the entries +classified below: #4462, #4461, #4469, #4472, #4473, #4477, and #4479, plus +release metadata commits #4463, #4471, #4475, and #4482. No additional +upstream fixture commit is currently unclassified for alpha.1. + +## PR #19 scout list + +- `48a386f6` selector regression: ported in `tests-unit/selectors`. +- `da514037` media parenthesis regression: ported in `tests-unit/media`. +- `d250d620` function/condition regressions: ported in `tests-unit/functions` + and `tests-unit/mixins-guards`. +- `6161ecf2` inline condition-expression comparison: + `boolean((2 > 1) = (3 > 2))` is intentionally out of scope for alpha.1; + Jess currently reports `Direct Less comparison requires value operands`. +- `ea62d748` container mixin parameter regression: ported in + `tests-unit/container`; bare container-name variables use interpolation form + for the Less 5 alpha deprecation contract. +- `888f6877` container name regressions: simple camelCase, underscore, and + non-ASCII names are ported. Comma-list container queries, `style(...)` + feature functions, custom-ident names such as `--body`, and escaped names + such as `contact\.body` remain out of scope for alpha.1. +- `d38b43a1` container `style()` comparison/range syntax is intentionally out + of scope for alpha.1; those inputs are parser errors in the current Jess-backed + Less wrapper. +- `83bc8d40` color `calc()` regression: ported in + `tests-unit/color-functions/modern`. +- `c58808fd` and `8e1105f0` bare `@var` deprecation/migration: the migration + fixtures are ported to interpolation-positive coverage. The upstream Less 4 + parser deprecation warning matrix is intentionally not active for alpha.1; + the Jess-backed wrapper exposes a different structured-warning path. +- `6b04d2d6` named-args mixin arity regression: ported in + `tests-unit/mixins-named-args`. +- `d6b20eee` variadic default forwarding regression is intentionally out of + scope for alpha.1. The current alpha wrapper renders an unset forwarded rest + argument as an empty value rather than falling through to the callee default. +- `1ee86aa3` CSS-var math regression: ported in `tests-unit/math-css-vars` with + Less 5 alpha expected output. Upstream's Less 4 `percentage(var(--x))` error + fixture is not active locally because the alpha wrapper currently leaves that + call for browser runtime CSS. + +Package metadata, release notes, lockfile churn, and Less 4 parser/runtime +source changes from upstream/master are intentionally out of scope for this +alpha fixture sync. diff --git a/packages/test-data/package.json b/packages/test-data/package.json index dda701b7a4..6477ee717c 100644 --- a/packages/test-data/package.json +++ b/packages/test-data/package.json @@ -3,7 +3,7 @@ "publishConfig": { "access": "public" }, - "version": "4.5.0", + "version": "5.0.0-alpha.1", "description": "Less files and CSS results", "author": "Alexis Sellier ", "contributors": [ @@ -12,10 +12,11 @@ "bugs": { "url": "https://github.com/less/less.js/issues" }, + "license": "Apache-2.0", "repository": { "type": "git", - "url": "https://github.com/less/less.js.git" + "url": "https://github.com/less/less.js.git", + "directory": "packages/test-data" }, - "license": "Apache-2.0", "gitHead": "1df9072ee9ebdadc791bf35dfb1dbc3ef9f1948f" } diff --git a/packages/test-data/styles.config.ts b/packages/test-data/styles.config.ts new file mode 100644 index 0000000000..ad0936c6ef --- /dev/null +++ b/packages/test-data/styles.config.ts @@ -0,0 +1,15 @@ +/** + * Top-level default config for the Less.js fixture corpus. + * + * Provides the flat-output default (`collapseNesting: true`) that the Jess + * all-less harness applies as the base of the config cascade, so it no longer + * has to hardcode that default. Fixture-directory `styles.config.*` files + * (nearest ancestor, resolved via cosmiconfig walk-up) override this per + * directory; anything without an explicit `collapseNesting` inherits this flat + * default. + */ +export default { + output: { + collapseNesting: true + } +}; diff --git a/packages/test-data/tests-config/3rd-party/styles.config.cjs b/packages/test-data/tests-config/3rd-party/styles.config.cjs index c5f5bb8ec1..9d3be08aa0 100644 --- a/packages/test-data/tests-config/3rd-party/styles.config.cjs +++ b/packages/test-data/tests-config/3rd-party/styles.config.cjs @@ -2,6 +2,6 @@ module.exports = { language: { less: { "math": 0 -} + } } }; diff --git a/packages/test-data/tests-config/at-rules-compressed-evaluation/at-rules-compressed-evaluation.less b/packages/test-data/tests-config/at-rules-compressed-evaluation/at-rules-compressed-evaluation.less index 52ec44e450..d0102854e0 100644 --- a/packages/test-data/tests-config/at-rules-compressed-evaluation/at-rules-compressed-evaluation.less +++ b/packages/test-data/tests-config/at-rules-compressed-evaluation/at-rules-compressed-evaluation.less @@ -25,7 +25,7 @@ // Test eval with value evaluation and keywordList conversion @breakpoint: screen; -@media @breakpoint, print { +@media @{breakpoint}, print { body { margin: 0; } diff --git a/packages/test-data/tests-config/compression/styles.config.cjs b/packages/test-data/tests-config/compression/styles.config.cjs index 381e6ffb0b..5c0aa58a30 100644 --- a/packages/test-data/tests-config/compression/styles.config.cjs +++ b/packages/test-data/tests-config/compression/styles.config.cjs @@ -3,6 +3,6 @@ module.exports = { less: { "math": "strict", "compress": true -} + } } }; diff --git a/packages/test-data/tests-config/debug/all/linenumbers-all.css b/packages/test-data/tests-config/debug/all/linenumbers-all.css index fe107c9582..504e5f7111 100644 --- a/packages/test-data/tests-config/debug/all/linenumbers-all.css +++ b/packages/test-data/tests-config/debug/all/linenumbers-all.css @@ -47,3 +47,13 @@ color: red; width: 2; } +@supports (display: grid) { + .supports-rule { + color: green; + } + /* line 38, {path}linenumbers.less */ + @media -sass-debug-info{filename{font-family:file\:\/\/{pathesc}linenumbers\.less}line{font-family:\0000338}} + .supports-rule .nested-supports { + color: blue; + } +} diff --git a/packages/test-data/tests-config/debug/all/styles.config.cjs b/packages/test-data/tests-config/debug/all/styles.config.cjs index 8f88036497..3df1ad087c 100644 --- a/packages/test-data/tests-config/debug/all/styles.config.cjs +++ b/packages/test-data/tests-config/debug/all/styles.config.cjs @@ -3,6 +3,6 @@ module.exports = { less: { "math": "strict", "dumpLineNumbers": "all" -} + } } }; diff --git a/packages/test-data/tests-config/debug/comments/linenumbers-comments.css b/packages/test-data/tests-config/debug/comments/linenumbers-comments.css index 083d93ee65..8a54a5e5ae 100644 --- a/packages/test-data/tests-config/debug/comments/linenumbers-comments.css +++ b/packages/test-data/tests-config/debug/comments/linenumbers-comments.css @@ -38,3 +38,12 @@ color: red; width: 2; } +@supports (display: grid) { + .supports-rule { + color: green; + } + /* line 38, {path}linenumbers.less */ + .supports-rule .nested-supports { + color: blue; + } +} diff --git a/packages/test-data/tests-config/debug/comments/styles.config.cjs b/packages/test-data/tests-config/debug/comments/styles.config.cjs index b22dd554ae..064d9c209b 100644 --- a/packages/test-data/tests-config/debug/comments/styles.config.cjs +++ b/packages/test-data/tests-config/debug/comments/styles.config.cjs @@ -3,6 +3,6 @@ module.exports = { less: { "math": "strict", "dumpLineNumbers": "comments" -} + } } }; diff --git a/packages/test-data/tests-config/debug/linenumbers.less b/packages/test-data/tests-config/debug/linenumbers.less index b3760d40f5..65642e4008 100644 --- a/packages/test-data/tests-config/debug/linenumbers.less +++ b/packages/test-data/tests-config/debug/linenumbers.less @@ -30,4 +30,13 @@ width: 2; } } +} + +.supports-rule { + @supports (display: grid) { + color: green; + .nested-supports { + color: blue; + } + } } \ No newline at end of file diff --git a/packages/test-data/tests-config/debug/mediaquery/linenumbers-mediaquery.css b/packages/test-data/tests-config/debug/mediaquery/linenumbers-mediaquery.css index 488b29e5aa..9b32a86302 100644 --- a/packages/test-data/tests-config/debug/mediaquery/linenumbers-mediaquery.css +++ b/packages/test-data/tests-config/debug/mediaquery/linenumbers-mediaquery.css @@ -38,3 +38,12 @@ color: red; width: 2; } +@supports (display: grid) { + .supports-rule { + color: green; + } + @media -sass-debug-info{filename{font-family:file\:\/\/{pathesc}linenumbers\.less}line{font-family:\0000338}} + .supports-rule .nested-supports { + color: blue; + } +} diff --git a/packages/test-data/tests-config/debug/mediaquery/styles.config.cjs b/packages/test-data/tests-config/debug/mediaquery/styles.config.cjs index b850e46f1d..ee8822bb0f 100644 --- a/packages/test-data/tests-config/debug/mediaquery/styles.config.cjs +++ b/packages/test-data/tests-config/debug/mediaquery/styles.config.cjs @@ -3,6 +3,6 @@ module.exports = { less: { "math": "strict", "dumpLineNumbers": "mediaquery" -} + } } }; diff --git a/packages/test-data/tests-config/filemanagerPlugin/styles.config.cjs b/packages/test-data/tests-config/filemanagerPlugin/styles.config.cjs index ee444169f7..caf78f0c21 100644 --- a/packages/test-data/tests-config/filemanagerPlugin/styles.config.cjs +++ b/packages/test-data/tests-config/filemanagerPlugin/styles.config.cjs @@ -1,7 +1,7 @@ module.exports = { language: { less: { - "plugin": "test/plugins/filemanager/" -} + "plugin": "test/plugins/filemanager/index.cjs" + } } }; diff --git a/packages/test-data/tests-config/functions-harness/functions-harness.css b/packages/test-data/tests-config/functions-harness/functions-harness.css new file mode 100644 index 0000000000..ab3d561eed --- /dev/null +++ b/packages/test-data/tests-config/functions-harness/functions-harness.css @@ -0,0 +1,8 @@ +#functions { + color: #660000; + width: 16; + height: undefined("self"); + border-width: 5; + variable: 11; + background: linear-gradient(#000, #fff); +} diff --git a/packages/test-data/tests-config/functions-harness/functions-harness.less b/packages/test-data/tests-config/functions-harness/functions-harness.less new file mode 100644 index 0000000000..62d6d0e3e7 --- /dev/null +++ b/packages/test-data/tests-config/functions-harness/functions-harness.less @@ -0,0 +1,10 @@ +#functions { + @var: 10; + @colors: #000, #fff; + color: _color("evil red"); // #660000 + width: increment(15); + height: undefined("self"); + border-width: add(2, 3); + variable: increment(@var); + background: linear-gradient(@colors); +} diff --git a/packages/test-data/tests-config/namespacing/legacy/namespacing-7.css b/packages/test-data/tests-config/namespacing/legacy/namespacing-7.css new file mode 100644 index 0000000000..bae21a6e3d --- /dev/null +++ b/packages/test-data/tests-config/namespacing/legacy/namespacing-7.css @@ -0,0 +1,15 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.output { + a: b; +} +.output-2 { + c: d; +} +.dr { + a: b; +} +.dr-2 { + c: d; +} diff --git a/packages/test-data/tests-config/namespacing/namespacing-5.less b/packages/test-data/tests-config/namespacing/namespacing-5.less index 5a8391477a..76d8fd5b42 100644 --- a/packages/test-data/tests-config/namespacing/namespacing-5.less +++ b/packages/test-data/tests-config/namespacing/namespacing-5.less @@ -20,9 +20,9 @@ } .another-navbar { - @colors: #theme.dark.navbar.colors() !important; - background: @colors[primary]; - border: 1px solid @colors[secondary]; + @theme-colors: #theme.dark.navbar.colors() !important; + background: @theme-colors[primary]; + border: 1px solid @theme-colors[secondary]; } .another { diff --git a/packages/test-data/tests-config/namespacing/namespacing-7.css b/packages/test-data/tests-config/namespacing/namespacing-7.css index 0ebcfcfb2c..7817c3af1c 100644 --- a/packages/test-data/tests-config/namespacing/namespacing-7.css +++ b/packages/test-data/tests-config/namespacing/namespacing-7.css @@ -1,12 +1,20 @@ -.output { - a: b; +& { + .output { + a: b; + } } -.output-2 { - c: d; +& { + .output-2 { + c: d; + } } -.dr { - a: b; +& { + .dr { + a: b; + } } -.dr-2 { - c: d; +& { + .dr-2 { + c: d; + } } diff --git a/packages/test-data/tests-config/namespacing/styles.config.cjs b/packages/test-data/tests-config/namespacing/styles.config.cjs index f944e77079..c6559c7f44 100644 --- a/packages/test-data/tests-config/namespacing/styles.config.cjs +++ b/packages/test-data/tests-config/namespacing/styles.config.cjs @@ -1,5 +1,8 @@ module.exports = { language: { less: {} - } + }, + output: [ + { file: '{name}.css', collapseNesting: false } + ] }; diff --git a/packages/test-data/tests-config/postProcessorPlugin/styles.config.cjs b/packages/test-data/tests-config/postProcessorPlugin/styles.config.cjs index a7364c623e..a3ab5faa1e 100644 --- a/packages/test-data/tests-config/postProcessorPlugin/styles.config.cjs +++ b/packages/test-data/tests-config/postProcessorPlugin/styles.config.cjs @@ -1,7 +1,7 @@ module.exports = { language: { less: { - "plugin": "test/plugins/postprocess/" + "plugin": "test/plugins/postprocess/index.cjs" } } }; diff --git a/packages/test-data/tests-config/preProcessorPlugin/styles.config.cjs b/packages/test-data/tests-config/preProcessorPlugin/styles.config.cjs index fca0da5c98..8439f2fb38 100644 --- a/packages/test-data/tests-config/preProcessorPlugin/styles.config.cjs +++ b/packages/test-data/tests-config/preProcessorPlugin/styles.config.cjs @@ -1,7 +1,7 @@ module.exports = { language: { less: { - "plugin": "test/plugins/preprocess/" + "plugin": "test/plugins/preprocess/index.cjs" } } }; diff --git a/packages/test-data/tests-config/strict-imports/legacy/strict-imports.css b/packages/test-data/tests-config/strict-imports/legacy/strict-imports.css new file mode 100644 index 0000000000..4c699d7616 --- /dev/null +++ b/packages/test-data/tests-config/strict-imports/legacy/strict-imports.css @@ -0,0 +1,14 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.imported { + background: green; +} +@media (max-width: 768px) { + .mobile { + color: red; + } +} +.container .nested { + color: blue; +} diff --git a/packages/test-data/tests-config/strict-imports/strict-imports.css b/packages/test-data/tests-config/strict-imports/strict-imports.css index f3b4f22e4c..7f3dbdcdfc 100644 --- a/packages/test-data/tests-config/strict-imports/strict-imports.css +++ b/packages/test-data/tests-config/strict-imports/strict-imports.css @@ -6,6 +6,8 @@ color: red; } } -.container .nested { - color: blue; +.container { + .nested { + color: blue; + } } diff --git a/packages/test-data/tests-config/strict-imports/styles.config.cjs b/packages/test-data/tests-config/strict-imports/styles.config.cjs index dc5064661f..c6559c7f44 100644 --- a/packages/test-data/tests-config/strict-imports/styles.config.cjs +++ b/packages/test-data/tests-config/strict-imports/styles.config.cjs @@ -1,7 +1,8 @@ module.exports = { - language: { - less: { - strictImports: true - } - } + language: { + less: {} + }, + output: [ + { file: '{name}.css', collapseNesting: false } + ] }; diff --git a/packages/test-data/tests-config/visitorPlugin/styles.config.cjs b/packages/test-data/tests-config/visitorPlugin/styles.config.cjs index 72705a894c..c5971580a6 100644 --- a/packages/test-data/tests-config/visitorPlugin/styles.config.cjs +++ b/packages/test-data/tests-config/visitorPlugin/styles.config.cjs @@ -1,7 +1,7 @@ module.exports = { language: { less: { - "plugin": "test/plugins/visitor/" + "plugin": "test/plugins/visitor/index.cjs" } } }; diff --git a/packages/test-data/tests-error/eval/ampersand-merge-template-invalid.less b/packages/test-data/tests-error/eval/ampersand-merge-template-invalid.less new file mode 100644 index 0000000000..e888d5fc48 --- /dev/null +++ b/packages/test-data/tests-error/eval/ampersand-merge-template-invalid.less @@ -0,0 +1,7 @@ +@list-quoted: ~'apple, satsuma, banana, pear'; + +@{list-quoted} { + .fruit-quoted-& { + content: "Quoted"; + } +} diff --git a/packages/test-data/tests-error/eval/ampersand-merge-template-invalid.txt b/packages/test-data/tests-error/eval/ampersand-merge-template-invalid.txt new file mode 100644 index 0000000000..6a09022d1a --- /dev/null +++ b/packages/test-data/tests-error/eval/ampersand-merge-template-invalid.txt @@ -0,0 +1 @@ +Invalid ampersand merge template ".fruit-quoted-&" with parent selector "apple,satsuma,banana,pear" diff --git a/packages/test-data/tests-error/eval/at-rules-undefined-var.less b/packages/test-data/tests-error/eval/at-rules-undefined-var.less index a1473805d1..3a1f5391e0 100644 --- a/packages/test-data/tests-error/eval/at-rules-undefined-var.less +++ b/packages/test-data/tests-error/eval/at-rules-undefined-var.less @@ -1,4 +1,4 @@ -@keyframes @name { +@keyframes @{name} { 50% {width: 20px;} } diff --git a/packages/test-data/tests-error/eval/detached-ruleset-5.txt b/packages/test-data/tests-error/eval/detached-ruleset-5.txt index 5618979508..e534b33bc0 100644 --- a/packages/test-data/tests-error/eval/detached-ruleset-5.txt +++ b/packages/test-data/tests-error/eval/detached-ruleset-5.txt @@ -1,3 +1,3 @@ -SyntaxError: variable @a is undefined in {path}detached-ruleset-5.less on line 4, column 1: +NameError: variable @a is undefined in {path}detached-ruleset-5.less on line 4, column 1: 3 } 4 .mixin-definition({color: red;}); diff --git a/packages/test-data/tests-error/eval/percentage-css-var.less b/packages/test-data/tests-error/eval/percentage-css-var.less new file mode 100644 index 0000000000..d205361b6d --- /dev/null +++ b/packages/test-data/tests-error/eval/percentage-css-var.less @@ -0,0 +1,3 @@ +.a { + b: percentage(var(--x)); +} diff --git a/packages/test-data/tests-error/eval/percentage-css-var.txt b/packages/test-data/tests-error/eval/percentage-css-var.txt new file mode 100644 index 0000000000..f66fcfe1ed --- /dev/null +++ b/packages/test-data/tests-error/eval/percentage-css-var.txt @@ -0,0 +1,4 @@ +ArgumentError: Error evaluating function `percentage`: argument must be a number in {path}percentage-css-var.less on line 2, column 6: +1 .a { +2 b: percentage(var(--x)); +3 } diff --git a/packages/test-data/tests-unit/at-rule-variable-deprecated/at-rule-variable-deprecated.css b/packages/test-data/tests-unit/at-rule-variable-deprecated/at-rule-variable-deprecated.css new file mode 100644 index 0000000000..878775bf48 --- /dev/null +++ b/packages/test-data/tests-unit/at-rule-variable-deprecated/at-rule-variable-deprecated.css @@ -0,0 +1,45 @@ +@media only screen and (max-width: 200px) { + .body { + width: 480px; + } +} +@media all and (tv) { + .all-and-tv { + var: yes; + } +} +@media screen, print { + .list { + margin: 0; + } +} +@container foo (min-width: 400px) { + .sticky-child { + font-size: 75%; + } +} +@supports (display: flex) { + .flex { + display: flex; + } +} +@supports (display: grid) and (gap: 1rem) { + .grid { + display: grid; + } +} +@keyframes enlarger { + from { + font-size: 12px; + } + to { + font-size: 15px; + } +} +@namespace less "http://lesscss.org"; +@namespace svgns "http://www.w3.org/2000/svg"; +@layer base { + .layered { + color: red; + } +} diff --git a/packages/test-data/tests-unit/at-rule-variable-deprecated/at-rule-variable-deprecated.less b/packages/test-data/tests-unit/at-rule-variable-deprecated/at-rule-variable-deprecated.less new file mode 100644 index 0000000000..8f0a813079 --- /dev/null +++ b/packages/test-data/tests-unit/at-rule-variable-deprecated/at-rule-variable-deprecated.less @@ -0,0 +1,76 @@ +// Backward-compatibility coverage for the deprecated bare `@variable` +// reference in non-value positions (at-rule preludes, names, and identifiers). +// These still resolve, but emit a `variable-in-at-rule-prelude` deprecation +// warning at parse time. New code should use `@{variable}` interpolation +// instead (see media.less / variables-in-at-rules.less). + +// --- nestable at-rule preludes --- +@smartphone: ~"only screen and (max-width: 200px)"; +@media @smartphone { + .body { + width: 480px; + } +} + +@all: ~"all"; +@tv: ~"(tv)"; +@media @all and @tv { + .all-and-tv { + var: yes; + } +} + +@breakpoint: screen; +@media @breakpoint, print { + .list { + margin: 0; + } +} + +@varfoo: foo; +@threshold: 400px; +@container @varfoo (min-width: @threshold) { + .sticky-child { + font-size: 75%; + } +} + +// --- unknown at-rule prelude (structural bare variable — deprecated) --- +@supported: ~"(display: flex)"; +@supports @supported { + .flex { + display: flex; + } +} + +// A bare @variable in a *nested declaration value* (inside `(...)`) is NOT a +// structural position — it is a declaration value and remains valid without a +// deprecation warning, mirroring `@media (min-width: @var)`. +@disp: grid; +@supports (display: @disp) and (gap: 1rem) { + .grid { + display: grid; + } +} + +// --- at-rule identifiers / names --- +@anim: enlarger; +@keyframes @anim { + from { font-size: 12px; } + to { font-size: 15px; } +} + +@ns: less; +@namespace @ns "http://lesscss.org"; + +// indirect (variable-variable) prefix — also a deprecated bare reference +@ns-ref: svg; +@svg: svgns; +@namespace @@ns-ref "http://www.w3.org/2000/svg"; + +@layer-name: base; +@layer @layer-name { + .layered { + color: red; + } +} diff --git a/packages/test-data/tests-unit/at-rule-variable-interpolation/at-rule-variable-interpolation.css b/packages/test-data/tests-unit/at-rule-variable-interpolation/at-rule-variable-interpolation.css new file mode 100644 index 0000000000..878775bf48 --- /dev/null +++ b/packages/test-data/tests-unit/at-rule-variable-interpolation/at-rule-variable-interpolation.css @@ -0,0 +1,45 @@ +@media only screen and (max-width: 200px) { + .body { + width: 480px; + } +} +@media all and (tv) { + .all-and-tv { + var: yes; + } +} +@media screen, print { + .list { + margin: 0; + } +} +@container foo (min-width: 400px) { + .sticky-child { + font-size: 75%; + } +} +@supports (display: flex) { + .flex { + display: flex; + } +} +@supports (display: grid) and (gap: 1rem) { + .grid { + display: grid; + } +} +@keyframes enlarger { + from { + font-size: 12px; + } + to { + font-size: 15px; + } +} +@namespace less "http://lesscss.org"; +@namespace svgns "http://www.w3.org/2000/svg"; +@layer base { + .layered { + color: red; + } +} diff --git a/packages/test-data/tests-unit/at-rule-variable-interpolation/at-rule-variable-interpolation.less b/packages/test-data/tests-unit/at-rule-variable-interpolation/at-rule-variable-interpolation.less new file mode 100644 index 0000000000..f8027a55be --- /dev/null +++ b/packages/test-data/tests-unit/at-rule-variable-interpolation/at-rule-variable-interpolation.less @@ -0,0 +1,72 @@ +// Less 5 coverage for variable interpolation in non-value at-rule positions +// (at-rule preludes, names, and identifiers). Less 4.8 added a companion +// deprecated-bare-@variable fixture; Less 5 keeps the migration target as the +// positive parse/eval fixture. + +// --- nestable at-rule preludes --- +@smartphone: ~"only screen and (max-width: 200px)"; +@media @{smartphone} { + .body { + width: 480px; + } +} + +@all: ~"all"; +@tv: ~"(tv)"; +@media @{all} and @{tv} { + .all-and-tv { + var: yes; + } +} + +@breakpoint: screen; +@media @{breakpoint}, print { + .list { + margin: 0; + } +} + +@varfoo: foo; +@threshold: 400px; +@container @{varfoo} (min-width: @threshold) { + .sticky-child { + font-size: 75%; + } +} + +// --- unknown at-rule prelude --- +@supported: ~"(display: flex)"; +@supports @{supported} { + .flex { + display: flex; + } +} + +// A bare @variable in a *nested declaration value* (inside `(...)`) is a +// declaration value, not a structural at-rule identifier/prelude position. +@disp: grid; +@supports (display: @disp) and (gap: 1rem) { + .grid { + display: grid; + } +} + +// --- at-rule identifiers / names --- +@anim: enlarger; +@keyframes @{anim} { + from { font-size: 12px; } + to { font-size: 15px; } +} + +@ns: less; +@namespace @{ns} "http://lesscss.org"; + +@svg-ns: svgns; +@namespace @{svg-ns} "http://www.w3.org/2000/svg"; + +@layer-name: base; +@layer @{layer-name} { + .layered { + color: red; + } +} diff --git a/packages/test-data/tests-unit/at-rules-bubbling/at-rules-bubbling.css b/packages/test-data/tests-unit/at-rules-bubbling/at-rules-bubbling.css new file mode 100644 index 0000000000..136fdde01d --- /dev/null +++ b/packages/test-data/tests-unit/at-rules-bubbling/at-rules-bubbling.css @@ -0,0 +1,121 @@ +.parent { + color: green; +} +@document url-prefix() { + .parent .child { + color: red; + } +} +@supports (sandwitch: butter) { + .inside .top { + property: value; + } +} +@supports (sandwitch: bread) { + .in1 .in2 { + property: value; + } +} +@supports (sandwitch: ham) { + .inside .top { + property: value; + } +} +@supports (font-family: weirdFont) { + @font-face { + font-family: something; + src: made-up-url; + } +} +@font-face { + @supports not (-webkit-font-smoothing: subpixel-antialiased) { + font-family: something; + src: made-up-url; + } +} +@supports (property: value) { + @media (max-size: 2px) { + @supports (whatever: something) { + .outOfMedia { + property: value; + } + } + } +} +@supports (property: value) { + @media (max-size: 2px) { + @supports (whatever: something) { + .onTop { + property: value; + } + } + } +} +@media print { + html { + in-html: visible; + } + @supports (upper: test) { + html { + in-supports: first; + } + html div { + in-div: visible; + } + @supports not (-webkit-font-smoothing: subpixel-antialiased) { + html div { + in-supports: second; + } + @media screen { + html div { + font-weight: 400; + } + html div nested { + property: value; + } + } + } + } +} +@media print { + @media (max-size: 2px) { + .in1 { + stay: here; + } + @supports not (-webkit-font-smoothing: subpixel-antialiased) { + @supports (whatever: something) { + .in2 .in1 { + property: value; + } + } + } + } +} +html { + font-weight: 300; + -webkit-font-smoothing: subpixel-antialiased; +} +@supports not (-webkit-font-smoothing: subpixel-antialiased) { + html { + font-weight: 400; + } + html nested { + property: value; + } +} +@font-face { + font-family: something; + src: made-up-url; +} +@keyframes "textscale" { + 0% { + font-size: 1em; + } + 100% { + font-size: 2em; + } +} +.onTop { + animation: "textscale"; + font-family: something; +} diff --git a/packages/test-data/tests-unit/directives-bubbling/directives-bubbling.less b/packages/test-data/tests-unit/at-rules-bubbling/at-rules-bubbling.less similarity index 100% rename from packages/test-data/tests-unit/directives-bubbling/directives-bubbling.less rename to packages/test-data/tests-unit/at-rules-bubbling/at-rules-bubbling.less diff --git a/packages/test-data/tests-unit/at-rules-bubbling/legacy/at-rules-bubbling.css b/packages/test-data/tests-unit/at-rules-bubbling/legacy/at-rules-bubbling.css new file mode 100644 index 0000000000..de95b6cbe9 --- /dev/null +++ b/packages/test-data/tests-unit/at-rules-bubbling/legacy/at-rules-bubbling.css @@ -0,0 +1,122 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.parent { + color: green; +} +@document url-prefix() { + .parent .child { + color: red; + } +} +@supports (sandwitch: butter) { + .inside .top { + property: value; + } +} +@supports (sandwitch: bread) { + .in1 .in2 { + property: value; + } +} +@supports (sandwitch: ham) { + .inside .top { + property: value; + } +} +@supports (font-family: weirdFont) { + @font-face { + font-family: something; + src: made-up-url; + } +} +@font-face { + @supports not (-webkit-font-smoothing: subpixel-antialiased) { + font-family: something; + src: made-up-url; + } +} +@supports (property: value) { + @media (max-size: 2px) { + @supports (whatever: something) { + .outOfMedia { + property: value; + } + } + } +} +@supports (property: value) { + @media (max-size: 2px) { + @supports (whatever: something) { + .onTop { + property: value; + } + } + } +} +@media print { + html { + in-html: visible; + } + @supports (upper: test) { + html { + in-supports: first; + } + html div { + in-div: visible; + } + @supports not (-webkit-font-smoothing: subpixel-antialiased) { + html div { + in-supports: second; + } + @media screen { + html div { + font-weight: 400; + } + html div nested { + property: value; + } + } + } + } +} +@media print and (max-size: 2px) { + .in1 { + stay: here; + } + @supports not (-webkit-font-smoothing: subpixel-antialiased) { + @supports (whatever: something) { + .in2 .in1 { + property: value; + } + } + } +} +html { + font-weight: 300; + -webkit-font-smoothing: subpixel-antialiased; +} +@supports not (-webkit-font-smoothing: subpixel-antialiased) { + html { + font-weight: 400; + } + html nested { + property: value; + } +} +.onTop { + animation: "textscale"; + font-family: something; +} +@font-face { + font-family: something; + src: made-up-url; +} +@keyframes "textscale" { + 0% { + font-size: 1em; + } + 100% { + font-size: 2em; + } +} diff --git a/packages/test-data/tests-unit/at-rules-keyword-comments/at-rules-keyword-comments.css b/packages/test-data/tests-unit/at-rules-keyword-comments/at-rules-keyword-comments.css index 2c3f802ec3..9fe3f5bee2 100644 --- a/packages/test-data/tests-unit/at-rules-keyword-comments/at-rules-keyword-comments.css +++ b/packages/test-data/tests-unit/at-rules-keyword-comments/at-rules-keyword-comments.css @@ -1,9 +1,6 @@ -@import "test.css" screen, print; -@media screen, print, handheld { - /* comment */ - /* another */ +@import "test.css" screen /* comment */, print; +@media screen /* comment */, print /* another */, handheld { body { font-size: 12pt; } } -/* comment */ diff --git a/packages/test-data/tests-unit/at-rules-keyword-comments/legacy/at-rules-keyword-comments.css b/packages/test-data/tests-unit/at-rules-keyword-comments/legacy/at-rules-keyword-comments.css new file mode 100644 index 0000000000..046c2e84be --- /dev/null +++ b/packages/test-data/tests-unit/at-rules-keyword-comments/legacy/at-rules-keyword-comments.css @@ -0,0 +1,12 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +@import "test.css" screen, print; +@media screen, print, handheld { + /* comment */ + /* another */ + body { + font-size: 12pt; + } +} +/* comment */ diff --git a/packages/test-data/tests-unit/at-rules-targeted/at-rules-targeted.css b/packages/test-data/tests-unit/at-rules-targeted/at-rules-targeted.css index 5052fae320..73db00f384 100644 --- a/packages/test-data/tests-unit/at-rules-targeted/at-rules-targeted.css +++ b/packages/test-data/tests-unit/at-rules-targeted/at-rules-targeted.css @@ -19,9 +19,11 @@ margin: 2cm; size: A4; } -@media screen and (max-width: 768px) { - .nested { - display: block; +@media screen { + @media (max-width: 768px) { + .nested { + display: block; + } } } @media screen { diff --git a/packages/test-data/tests-unit/at-rules-targeted/legacy/at-rules-targeted.css b/packages/test-data/tests-unit/at-rules-targeted/legacy/at-rules-targeted.css new file mode 100644 index 0000000000..135ddb3cd7 --- /dev/null +++ b/packages/test-data/tests-unit/at-rules-targeted/legacy/at-rules-targeted.css @@ -0,0 +1,55 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +@charset "UTF-8"; +@media screen { + .test { + color: red; + } +} +@media screen, print, handheld { + body { + font-size: 12pt; + } +} +@supports (display: grid) { + .grid { + display: grid; + grid-template-columns: 1fr 1fr; + } +} +@page { + margin: 2cm; + size: A4; +} +@media screen and (max-width: 768px) { + .nested { + display: block; + } +} +@media screen { + .container { + color: red; + } + .container .child { + color: blue; + } +} +@media screen { + .test-var-access { + color: value; + } +} +@layer base { + body { + margin: 0; + } + p { + padding: 0; + } +} +@media screen { + body { + color: black; + } +} diff --git a/packages/test-data/tests-unit/at-rules/at-rules.css b/packages/test-data/tests-unit/at-rules/at-rules.css index a3a13fda26..b5295dae6b 100644 --- a/packages/test-data/tests-unit/at-rules/at-rules.css +++ b/packages/test-data/tests-unit/at-rules/at-rules.css @@ -15,7 +15,7 @@ @namespace svg url(http://www.w3.org/2000/svg); @viewport { width: device-width; - initial-scale: 1; + initial-scale: 1.0; } @keyframes slidein { from { @@ -82,8 +82,8 @@ display: none; } } -@media (max-width: 768px) { - .container { +.container { + @media (max-width: 768px) { padding: 10px; } } @@ -95,9 +95,11 @@ margin-left: 3cm; margin-right: 4cm; } -@media (max-width: 600px) { - .wrapper .mobile-only { - display: block; +.wrapper { + @media (max-width: 600px) { + .mobile-only { + display: block; + } } } @media (min-width: 1024px) { diff --git a/packages/test-data/tests-unit/at-rules/legacy/at-rules.css b/packages/test-data/tests-unit/at-rules/legacy/at-rules.css new file mode 100644 index 0000000000..232957cab8 --- /dev/null +++ b/packages/test-data/tests-unit/at-rules/legacy/at-rules.css @@ -0,0 +1,110 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +@charset "UTF-8"; +@page { + margin: 2cm; + @top-left { + content: "Page " counter(page); + } +} +@page :first { + margin: 3cm; + @top-center { + content: "First Page"; + } +} +@namespace url(http://www.w3.org/1999/xhtml); +@namespace svg url(http://www.w3.org/2000/svg); +@viewport { + width: device-width; + initial-scale: 1; +} +@keyframes slidein { + from { + margin-left: 100%; + width: 300%; + } + to { + margin-left: 0%; + width: 100%; + } +} +@keyframes "complex-animation" { + 0% { + opacity: 0; + transform: scale(0.5); + } + 50% { + opacity: 0.5; + transform: scale(1.2); + } + 100% { + opacity: 1; + transform: scale(1); + } +} +@font-face { + font-family: "MyFont"; + src: url("myfont.woff2") format("woff2"); + font-weight: normal; + font-style: normal; +} +@font-face { + font-family: "CustomFont"; + src: url("custom.woff") format("woff"); +} +@supports (display: grid) { + .grid-container { + display: grid; + grid-template-columns: repeat(3, 1fr); + } +} +@supports (transform-style: preserve-3d) { + @media (min-width: 768px) { + .card { + transform: rotateY(15deg); + } + } +} +@media print { + body { + font-size: 12pt; + color: black; + } +} +@media screen { + @supports (display: flex) { + .container { + display: flex; + } + } +} +@media (max-width: 600px) { + .sidebar { + display: none; + } +} +@media (max-width: 768px) { + .container { + padding: 10px; + } +} +@page :left { + margin-left: 4cm; + margin-right: 3cm; +} +@page :right { + margin-left: 3cm; + margin-right: 4cm; +} +@media (max-width: 600px) { + .wrapper .mobile-only { + display: block; + } +} +@media (min-width: 1024px) { + .desktop { + display: block; + } +} diff --git a/packages/test-data/tests-unit/at-rules/styles.config.ts b/packages/test-data/tests-unit/at-rules/styles.config.ts new file mode 100644 index 0000000000..774aec3bfc --- /dev/null +++ b/packages/test-data/tests-unit/at-rules/styles.config.ts @@ -0,0 +1,5 @@ +export default { + output: [ + { file: '{name}.css', collapseNesting: false } + ] +} diff --git a/packages/test-data/tests-unit/calc/calc.css b/packages/test-data/tests-unit/calc/calc.css index e2b0a5fc90..c1b055fd8f 100644 --- a/packages/test-data/tests-unit/calc/calc.css +++ b/packages/test-data/tests-unit/calc/calc.css @@ -1,7 +1,7 @@ .calc-basic { width: calc(100% - 30px); height: calc(50% + 20px); - margin: calc(10px * 2); + margin: 20px; padding: calc(100vh - 50px); } .calc-variables { @@ -11,19 +11,19 @@ height: calc(50% + (25vh - 20px)); } .calc-nested { - min-height: calc(10vh + calc(5vh)); - nested: calc(calc(2.25rem + 2px) - 1px * 2); + min-height: 15vh; + nested: calc((2.25rem + 2px) - 2px); } .calc-functions { one: calc(100% - 20px); - two: calc(100% - (10px + 10px)); + two: calc(100% - 20px); bar: calc(1 + 20%); } .calc-escape { - three: calc(100% - (3 * 1)); - four: calc(100% - (3 * 1)); + three: calc(100% - 3); + four: calc(100% - 3); } .calc-mixed { - foo: 3 calc(3 + 4) 11; - height: calc(100% - ((10px * 3) + (10px * 2))); + foo: 3 7 11; + height: calc(100% - 50px); } diff --git a/packages/test-data/tests-unit/calc/calc.less b/packages/test-data/tests-unit/calc/calc.less index e69c14c098..c7cdd92374 100644 --- a/packages/test-data/tests-unit/calc/calc.less +++ b/packages/test-data/tests-unit/calc/calc.less @@ -1,3 +1,4 @@ +// Less v5 can further simplify a number of these calc expressions @val: 10px; @var: 50vh/2; diff --git a/packages/test-data/tests-unit/calc/legacy/calc.css b/packages/test-data/tests-unit/calc/legacy/calc.css new file mode 100644 index 0000000000..ed5d8f1674 --- /dev/null +++ b/packages/test-data/tests-unit/calc/legacy/calc.css @@ -0,0 +1,32 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.calc-basic { + width: calc(100% - 30px); + height: calc(50% + 20px); + margin: 20px; + padding: calc(100vh - 50px); +} +.calc-variables { + root: calc(100% - 30px); + root2: calc(100% - 40px); + width: calc(50% + (25vh - 20px)); + height: calc(50% + (25vh - 20px)); +} +.calc-nested { + min-height: calc(10vh + calc(5vh)); + nested: calc(calc(2.25rem + 2px) - 1px * 2); +} +.calc-functions { + one: calc(100% - 20px); + two: calc(100% - (10px + 10px)); + bar: calc(1 + 20%); +} +.calc-escape { + three: calc(100% - (3 * 1)); + four: calc(100% - (3 * 1)); +} +.calc-mixed { + foo: 3 calc(3 + 4) 11; + height: calc(100% - ((10px * 3) + (10px * 2))); +} diff --git a/packages/test-data/tests-unit/color-functions/alpha.css b/packages/test-data/tests-unit/color-functions/alpha.css index fe0ff46966..451f3ae324 100644 --- a/packages/test-data/tests-unit/color-functions/alpha.css +++ b/packages/test-data/tests-unit/color-functions/alpha.css @@ -13,3 +13,9 @@ #alpha #hsl { opacity: 1; } +#alpha #transparent-hex4 { + opacity: 0; +} +#alpha #transparent-hex8 { + opacity: 0; +} diff --git a/packages/test-data/tests-unit/color-functions/alpha.less b/packages/test-data/tests-unit/color-functions/alpha.less index 812149e22b..2237ce855f 100644 --- a/packages/test-data/tests-unit/color-functions/alpha.less +++ b/packages/test-data/tests-unit/color-functions/alpha.less @@ -16,4 +16,10 @@ #hsl { opacity: alpha(hsl(120, 100%, 50%)); } + #transparent-hex4 { + opacity: alpha(#0000); + } + #transparent-hex8 { + opacity: alpha(#00000000); + } } diff --git a/packages/test-data/tests-unit/color-functions/basic.css b/packages/test-data/tests-unit/color-functions/basic.css index 8788ec7658..357c7a1e0b 100644 --- a/packages/test-data/tests-unit/color-functions/basic.css +++ b/packages/test-data/tests-unit/color-functions/basic.css @@ -14,5 +14,5 @@ } #percentage { color: 255; - border-color: rgba(255, 0, 0, 0.5); + border-color: rgba(100%, 0, 0, 50%); } diff --git a/packages/test-data/tests-unit/color-functions/comprehensive.css b/packages/test-data/tests-unit/color-functions/comprehensive.css index 8b04137b9a..ef3b3fda7e 100644 --- a/packages/test-data/tests-unit/color-functions/comprehensive.css +++ b/packages/test-data/tests-unit/color-functions/comprehensive.css @@ -29,17 +29,17 @@ } #percentage { color: 255; - border-color: rgba(255, 0, 0, 0.5); + border-color: rgba(100%, 0, 0, 50%); } #grey { - color: #c8c8c8; + color: rgb(200, 200, 200); } #aa3333 { - color: #aa3333; + color: rgb(66.66%, 20%, 20%); } #bb8080 { - color: hsl(0, 30%, 62%); + color: hsl(0deg, 30%, 62%); } #ccff00 { - color: hsl(72, 100%, 50%); + color: hsl(72deg, 100%, 50%); } diff --git a/packages/test-data/tests-unit/color-functions/comprehensive.less b/packages/test-data/tests-unit/color-functions/comprehensive.less index a011d70378..818f790d0d 100644 --- a/packages/test-data/tests-unit/color-functions/comprehensive.less +++ b/packages/test-data/tests-unit/color-functions/comprehensive.less @@ -1,4 +1,5 @@ // Comprehensive color function tests - all color functions without problematic nesting +// Less v5 preserves original color expressions when possible .lightenblue { color: lighten(blue, 10%); } diff --git a/packages/test-data/tests-unit/color-functions/formats.css b/packages/test-data/tests-unit/color-functions/formats.css index 4194ea6ce7..06fdd414ba 100644 --- a/packages/test-data/tests-unit/color-functions/formats.css +++ b/packages/test-data/tests-unit/color-functions/formats.css @@ -25,15 +25,3 @@ #alpha #hsla { color: hsla(11, 20%, 20%, 0.6); } -#grey { - color: #c8c8c8; -} -#aa3333 { - color: #aa3333; -} -#bb8080 { - color: hsl(0, 30%, 62%); -} -#ccff00 { - color: hsl(72, 100%, 50%); -} diff --git a/packages/test-data/tests-unit/color-functions/formats.less b/packages/test-data/tests-unit/color-functions/formats.less index 481b50f652..aac0c3a3a4 100644 --- a/packages/test-data/tests-unit/color-functions/formats.less +++ b/packages/test-data/tests-unit/color-functions/formats.less @@ -29,18 +29,3 @@ color: hsla(11, 20%, 20%, 0.6); } -#grey { - color: rgb(200, 200, 200); -} - -#aa3333 { - color: rgb(66.66%, 20%, 20%); -} - -#bb8080 { - color: hsl(0deg, 30%, 62%); -} - -#ccff00 { - color: hsl(72deg, 100%, 50%); -} diff --git a/packages/test-data/tests-unit/color-functions/legacy/basic.css b/packages/test-data/tests-unit/color-functions/legacy/basic.css new file mode 100644 index 0000000000..343108ebc5 --- /dev/null +++ b/packages/test-data/tests-unit/color-functions/legacy/basic.css @@ -0,0 +1,21 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.lightenblue { + color: #3333ff; +} +.darkenblue { + color: #0000cc; +} +.unknowncolors { + color: blue2; + border: 2px solid superred; +} +.transparent { + color: transparent; + background-color: rgba(0, 0, 0, 0); +} +#percentage { + color: 255; + border-color: rgba(255, 0, 0, 0.5); +} diff --git a/packages/test-data/tests-unit/color-functions/legacy/comprehensive.css b/packages/test-data/tests-unit/color-functions/legacy/comprehensive.css new file mode 100644 index 0000000000..b5e25b22f8 --- /dev/null +++ b/packages/test-data/tests-unit/color-functions/legacy/comprehensive.css @@ -0,0 +1,48 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.lightenblue { + color: #3333ff; +} +.darkenblue { + color: #0000cc; +} +.unknowncolors { + color: blue2; + border: 2px solid superred; +} +.transparent { + color: transparent; + background-color: rgba(0, 0, 0, 0); +} +#alpha #fromvar { + opacity: 0.7; +} +#alpha #short { + opacity: 1; +} +#alpha #long { + opacity: 1; +} +#alpha #rgba { + opacity: 0.2; +} +#alpha #hsl { + opacity: 1; +} +#percentage { + color: 255; + border-color: rgba(255, 0, 0, 0.5); +} +#grey { + color: #c8c8c8; +} +#aa3333 { + color: #aa3333; +} +#bb8080 { + color: hsl(0, 30%, 62%); +} +#ccff00 { + color: hsl(72, 100%, 50%); +} diff --git a/packages/test-data/tests-unit/color-functions/legacy/modern-syntax.css b/packages/test-data/tests-unit/color-functions/legacy/modern-syntax.css new file mode 100644 index 0000000000..195996e662 --- /dev/null +++ b/packages/test-data/tests-unit/color-functions/legacy/modern-syntax.css @@ -0,0 +1,9 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +foo { + color: #0080ff; + color: rgba(0, 128, 255, 0.5); + color: hsl(198, 28%, 50%); + color: hsla(198, 28%, 50%, 0.5); +} diff --git a/packages/test-data/tests-unit/color-functions/legacy/operations.css b/packages/test-data/tests-unit/color-functions/legacy/operations.css new file mode 100644 index 0000000000..2e426d2810 --- /dev/null +++ b/packages/test-data/tests-unit/color-functions/legacy/operations.css @@ -0,0 +1,18 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +#overflow .a { + color: #000000; +} +#overflow .b { + color: #ffffff; +} +#overflow .c { + color: #ffffff; +} +#overflow .d { + color: #00ff00; +} +#overflow .e { + color: rgba(0, 31, 255, 0.42); +} diff --git a/packages/test-data/tests-unit/color-functions/legacy/rgba.css b/packages/test-data/tests-unit/color-functions/legacy/rgba.css new file mode 100644 index 0000000000..39cfbdd748 --- /dev/null +++ b/packages/test-data/tests-unit/color-functions/legacy/rgba.css @@ -0,0 +1,20 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +#rrggbbaa { + test-1: #55FF5599; + test-2: #5F59; + test-3: rgba(136, 255, 136, 0.6); + test-4: rgba(85, 255, 85, 0.1); + test-5: rgba(85, 255, 85, 0.6); + test-6: rgba(85, 255, 85, 0.6); + test-7: rgba(85, 255, 85, 0.5); + test-8: rgba(var(--color-accent), 0.2); + test-9: rgb(var(--color-accent)); + test-9: hsla(var(--color-accent)); + test-10: #55FF5599; + test-11: hsla(120, 100%, 66.66666667%, 0.6); + test-12: hsla(120, 100%, 66.66666667%, 0.5); + --semi-transparent-dark-background: #001e00ee; + --semi-transparent-dark-background-2: #001e00; +} diff --git a/packages/test-data/tests-unit/color-functions/modern-syntax.css b/packages/test-data/tests-unit/color-functions/modern-syntax.css index e23287f269..dc6fd722d0 100644 --- a/packages/test-data/tests-unit/color-functions/modern-syntax.css +++ b/packages/test-data/tests-unit/color-functions/modern-syntax.css @@ -1,6 +1,6 @@ foo { - color: #0080ff; - color: rgba(0, 128, 255, 0.5); - color: hsl(198, 28%, 50%); - color: hsla(198, 28%, 50%, 0.5); + color: rgb(0 128 255); + color: rgb(0 128 255 / 50%); + color: hsl(198deg 28% 50%); + color: hsl(198deg 28% 50% / 50%); } diff --git a/packages/test-data/tests-unit/color-functions/modern-syntax.less b/packages/test-data/tests-unit/color-functions/modern-syntax.less index 1a52709bca..63ee9b0e4a 100644 --- a/packages/test-data/tests-unit/color-functions/modern-syntax.less +++ b/packages/test-data/tests-unit/color-functions/modern-syntax.less @@ -1,4 +1,5 @@ // Modern CSS color syntax tests - space-separated values and / alpha syntax +// Less v5 preserves modern syntax when possible. foo { color: rgb(0 128 255); color: rgb(0 128 255 / 50%); diff --git a/packages/test-data/tests-unit/color-functions/modern.css b/packages/test-data/tests-unit/color-functions/modern.css index ed84e9002c..bdf2626a4b 100644 --- a/packages/test-data/tests-unit/color-functions/modern.css +++ b/packages/test-data/tests-unit/color-functions/modern.css @@ -34,3 +34,9 @@ .color-rgb-div { background: rgb(from #0000FF calc(r / 2) g b); } +.color-rgb-sub-right-operand { + background: rgb(from blue calc(100 - r) g b); +} +.color-rgb-add-left-operand { + background: rgb(from blue calc(r + 100) g b); +} diff --git a/packages/test-data/tests-unit/color-functions/modern.less b/packages/test-data/tests-unit/color-functions/modern.less index cf04e2c9bf..23445d1250 100644 --- a/packages/test-data/tests-unit/color-functions/modern.less +++ b/packages/test-data/tests-unit/color-functions/modern.less @@ -46,3 +46,11 @@ .color-rgb-div { background: rgb(from #0000FF calc(r / 2) g b); } + +.color-rgb-sub-right-operand { + background: rgb(from blue calc(100 - r) g b); +} + +.color-rgb-add-left-operand { + background: rgb(from blue calc(r + 100) g b); +} diff --git a/packages/test-data/tests-unit/color-functions/operations.less b/packages/test-data/tests-unit/color-functions/operations.less index 3d97e9abd1..f2be054af3 100644 --- a/packages/test-data/tests-unit/color-functions/operations.less +++ b/packages/test-data/tests-unit/color-functions/operations.less @@ -4,5 +4,6 @@ .b { color: (#eee + #fff); } // #ffffff .c { color: (#aaa * 3); } // #ffffff .d { color: (#00ee00 + #009900); } // #00ff00 + // Less v5 preserves color statements that overflow. .e { color: rgba(-99.9, 31.4159, 321, 0.42); } } diff --git a/packages/test-data/tests-unit/color-functions/rgba.css b/packages/test-data/tests-unit/color-functions/rgba.css index cbf4c4d91e..1fefdea008 100644 --- a/packages/test-data/tests-unit/color-functions/rgba.css +++ b/packages/test-data/tests-unit/color-functions/rgba.css @@ -1,8 +1,8 @@ #rrggbbaa { test-1: #55FF5599; test-2: #5F59; - test-3: rgba(136, 255, 136, 0.6); - test-4: rgba(85, 255, 85, 0.1); + test-3: #88ff8899; + test-4: #55ff551a; test-5: rgba(85, 255, 85, 0.6); test-6: rgba(85, 255, 85, 0.6); test-7: rgba(85, 255, 85, 0.5); @@ -13,5 +13,5 @@ test-11: hsla(120, 100%, 66.66666667%, 0.6); test-12: hsla(120, 100%, 66.66666667%, 0.5); --semi-transparent-dark-background: #001e00ee; - --semi-transparent-dark-background-2: #001e00; + --semi-transparent-dark-background-2: rgba(0, 30, 0, 238); } diff --git a/packages/test-data/tests-unit/color-functions/rgba.less b/packages/test-data/tests-unit/color-functions/rgba.less index 7db7877bdf..76aea20562 100644 --- a/packages/test-data/tests-unit/color-functions/rgba.less +++ b/packages/test-data/tests-unit/color-functions/rgba.less @@ -2,6 +2,7 @@ #rrggbbaa { test-1: #55FF5599; test-2: #5F59; + // Less v5 will attempt to preserve color formats when possible. test-3: lighten(#55FF5599, 10%); test-4: fade(#5F59, 10%); test-5: rgba(#55FF5599); @@ -14,5 +15,6 @@ test-11: hsla(#5F59); test-12: hsla(#5F59, 0.5); --semi-transparent-dark-background: #001e00ee; - --semi-transparent-dark-background-2: rgba(0, 30, 0, 238); // invalid opacity will be capped + // Less v5 will not alter custom properties - they can represent any unknown value. + --semi-transparent-dark-background-2: rgba(0, 30, 0, 238); } diff --git a/packages/test-data/tests-unit/comments/comments.css b/packages/test-data/tests-unit/comments/comments.css index 03a41eaadb..e1a243c274 100644 --- a/packages/test-data/tests-unit/comments/comments.css +++ b/packages/test-data/tests-unit/comments/comments.css @@ -26,7 +26,7 @@ */ /* @group Variables ------------------- */ -#comments, +#comments /* boo *//* boo again*/, .comments { /**/ color: red; @@ -45,10 +45,10 @@ color: grey; } */ -.selector, +.selector /* .with */, .lots, -.comments { - color: grey, /* blue */ orange; +/* of */ .comments { + color/* survive */ /* me too */: grey, /* blue */ orange; -webkit-border-radius: 2px /* webkit only */; -moz-border-radius: 8px /* moz only with operation */; } @@ -58,8 +58,7 @@ .sr-only-focusable { clip: auto; } -@-webkit-keyframes hover { - /* and Chrome */ +@-webkit-keyframes /* Safari */ hover /* and Chrome */ { 0% { color: red; } diff --git a/packages/test-data/tests-unit/comments/comments.less b/packages/test-data/tests-unit/comments/comments.less index 3054e6673d..b0e4c59be9 100644 --- a/packages/test-data/tests-unit/comments/comments.less +++ b/packages/test-data/tests-unit/comments/comments.less @@ -1,4 +1,5 @@ // Comprehensive comment handling tests +// Less v5 will preserve many more comments as-is /******************\ * * * Comment Header * @@ -99,5 +100,5 @@ // line immediately followed /*by block */ @string_w_comment: ~"/* // Not commented out // */"; -#output-block { --comment: @string_w_comment; } +#output-block { --comment: @{string_w_comment}; } /*comment on last line*/ diff --git a/packages/test-data/tests-unit/comments/comments2.css b/packages/test-data/tests-unit/comments/comments2.css index 02cad29d27..46459955eb 100644 --- a/packages/test-data/tests-unit/comments/comments2.css +++ b/packages/test-data/tests-unit/comments/comments2.css @@ -1,18 +1,16 @@ -@-webkit-keyframes hover { - /* Safari and Chrome */ -} .bg { background-image: linear-gradient(#333 /*{comment}*/, #111); } #planadvisor, +/*comment*//*comment*/ .first, -.planning { +/*comment*//*comment*/.planning { margin: 10px; total-width: 96em; } .some-inline-comments { a: yes /* comment */; b: red /* comment */; - c: yes /* comment */; - d: red /* comment */; + c: yes; + d: red; } diff --git a/packages/test-data/tests-unit/comments/comments2.less b/packages/test-data/tests-unit/comments/comments2.less index e049e01715..5c0c010b25 100644 --- a/packages/test-data/tests-unit/comments/comments2.less +++ b/packages/test-data/tests-unit/comments/comments2.less @@ -1,5 +1,6 @@ // Inline comments and grid system tests @media all and/*! */(max-width:1024px) {} +// In Less v5, This is an empty ruleset, so it is removed. @-webkit-keyframes hover /* Safari and Chrome */{ } .bg { background-image: linear-gradient(#333 /*{comment}*/, #111); @@ -25,6 +26,8 @@ .some-inline-comments { a: yes /* comment */; b: red /* comment */; + // In Less v5, the comment is considered to be attached to the source, + // not part of the value. @c: yes /* comment */; @d: red /* comment */; c: @c; diff --git a/packages/test-data/tests-unit/comments/legacy/comments.css b/packages/test-data/tests-unit/comments/legacy/comments.css new file mode 100644 index 0000000000..c24022cbf2 --- /dev/null +++ b/packages/test-data/tests-unit/comments/legacy/comments.css @@ -0,0 +1,86 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +/******************\ +* * +* Comment Header * +* * +\******************/ +/* + + Comment + +*/ +/* + * Comment Test + * + * - cloudhead (http://cloudhead.net) + * + */ +/* Colors + * ------ + * #EDF8FC (background blue) + * #166C89 (darkest blue) + * + * Text: + * #333 (standard text) // A comment within a comment! + * #1F9EC9 (standard link) + * + */ +/* @group Variables +------------------- */ +#comments, +.comments { + /**/ + color: red; + /* A C-style comment */ + /* A C-style comment */ + background-color: orange; + font-size: 12px; + /* lost comment */ + content: "content"; + border: 1px solid black; + padding: 0; + margin: 2em; +} +/* commented out + #more-comments { + color: grey; + } +*/ +.selector, +.lots, +.comments { + color: grey, /* blue */ orange; + -webkit-border-radius: 2px /* webkit only */; + -moz-border-radius: 8px /* moz only with operation */; +} +.test-rule { + color: 1px; +} +.sr-only-focusable { + clip: auto; +} +@-webkit-keyframes hover { + /* and Chrome */ + 0% { + color: red; + } +} +#last { + color: blue; +} +/* */ +/* { */ +/* */ +/* */ +/* */ +#div { + color: #A33; +} +/* } */ +/*by block */ +#output-block { + --comment: /* // Not commented out // */; +} +/*comment on last line*/ diff --git a/packages/test-data/tests-unit/comments/legacy/comments2.css b/packages/test-data/tests-unit/comments/legacy/comments2.css new file mode 100644 index 0000000000..539c528be5 --- /dev/null +++ b/packages/test-data/tests-unit/comments/legacy/comments2.css @@ -0,0 +1,21 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +@-webkit-keyframes hover { + /* Safari and Chrome */ +} +.bg { + background-image: linear-gradient(#333 /*{comment}*/, #111); +} +#planadvisor, +.first, +.planning { + margin: 10px; + total-width: 96em; +} +.some-inline-comments { + a: yes /* comment */; + b: red /* comment */; + c: yes /* comment */; + d: red /* comment */; +} diff --git a/packages/test-data/tests-unit/container/container.css b/packages/test-data/tests-unit/container/container.css index 2d518f871a..c8f60bc1b9 100644 --- a/packages/test-data/tests-unit/container/container.css +++ b/packages/test-data/tests-unit/container/container.css @@ -23,9 +23,11 @@ border: 1px solid grey; } } -@container size(min-width: 60ch) { +@container size (min-width: 60ch) { .article--post header { - grid-template-areas: "avatar name" "avatar headline"; + grid-template-areas: + "avatar name" + "avatar headline"; align-items: start; } .article--post { @@ -54,13 +56,28 @@ margin: 0.5em 0 0 0; } } +@container contactBody (min-width: 1300px) { + .named-container { + width: 25%; + } +} +@container _body (min-width: 1300px) { + .underscored-container { + width: 25%; + } +} +@container café (min-width: 1300px) { + .nonascii-container { + width: 25%; + } +} @container (width >= 500px) and (height >= 500px) { .card-content h2 { padding: 0; margin: 0.5em 0 0 0; } } -@container (width > 760px) not (height > 670px) { +@container (width > 760px) and (not (height > 670px)) { .card-content h2 { padding: 0; margin: 0.5em 0 0 0; @@ -78,7 +95,7 @@ margin: 0.5em 0 0 0; } } -@container (width < 500px) or (height < 500px) and (inline-size >= 0px) { +@container ((width < 500px) or (height < 500px)) and (inline-size >= 0px) { .card-content p { padding: 0; } @@ -86,7 +103,7 @@ margin: 0.5em 0 0 0; } } -@container my-page-layout (width < 500px) or (height < 500px) and (block-size > 12em) { +@container my-page-layout ((width < 500px) or (height < 500px)) and (block-size > 12em) { .card-content p { padding: 0; } @@ -94,7 +111,7 @@ margin: 0.5em 0 0 0; } } -@container (width < 500px) or (height < 500px) and (aspect-ratio: 3/2) { +@container ((width < 500px) or (height < 500px)) and (aspect-ratio: 3 / 2) { .card-content p { padding: 0; } @@ -102,7 +119,7 @@ margin: 0.5em 0 0 0; } } -@container (width < 500px) or (height < 500px) and (orientation: portrait) { +@container ((width < 500px) or (height < 500px)) and (orientation: portrait) { .card-content p { padding: 0; } @@ -117,20 +134,20 @@ .card-content p h2 { margin: 0.5em 0 0 0; } -} -@container card (inline-size > 30em) and style(--responsive: true) { - .card-content { - grid-template-columns: 1fr 2fr; - grid-template-rows: auto 1fr; - align-items: start; - column-gap: 20px; - } - .card-content h2 { - padding: 0; - margin: 0.5em 0 0 0; + @container style(--responsive: true) { + .card-content { + grid-template-columns: 1fr 2fr; + grid-template-rows: auto 1fr; + align-items: start; + column-gap: 20px; + } + .card-content h2 { + padding: 0; + margin: 0.5em 0 0 0; + } } } -@container (width < 500px) or (height < 500px) and (orientation: portrait) { +@container ((width < 500px) or (height < 500px)) and (orientation: portrait) { .card-content p { padding: 0; } @@ -138,7 +155,7 @@ margin: 0.5em 0 0 0; } } -@container my-page-layout (width < 500px) or (height < 500px) and (block-size > 12em) { +@container my-page-layout ((width < 500px) or (height < 500px)) and (block-size > 12em) { .card-content p { padding: 0; } @@ -268,3 +285,26 @@ font-size: 75%; } } +@container foo (min-width: 400px) { + #sticky-child { + font-size: 75%; + } +} +@container name (width < 125px) { + .mixin-container-test { + display: none; + } +} +.mixin-container-test { + color: red; +} +@container sidebar (width < 500px) { + .sidebar-test { + display: none; + } +} +@container header (width < 800px) { + .header-test { + display: none; + } +} diff --git a/packages/test-data/tests-unit/container/container.less b/packages/test-data/tests-unit/container/container.less index 229e9046f7..7909430045 100644 --- a/packages/test-data/tests-unit/container/container.less +++ b/packages/test-data/tests-unit/container/container.less @@ -63,7 +63,25 @@ .card-content h2 { padding: 0; margin: 0.5em 0 0 0; - } + } + } +} + +@container contactBody (min-width: 1300px) { + .named-container { + width: 25%; + } +} + +@container _body (min-width: 1300px) { + .underscored-container { + width: 25%; + } +} + +@container café (min-width: 1300px) { + .nonascii-container { + width: 25%; } } @@ -74,7 +92,7 @@ } } -@container (width > 760px) not (height > 670px) { +@container (width > 760px) and (not (height > 670px)) { .card-content h2 { padding: 0; margin: 0.5em 0 0 0; @@ -95,7 +113,7 @@ } } -@container (width < 500px) or (height < 500px) and (inline-size >= 0px) { +@container ((width < 500px) or (height < 500px)) and (inline-size >= 0px) { .card-content p { padding: 0; @@ -105,7 +123,7 @@ } } -@container my-page-layout (width < 500px) or (height < 500px) and (block-size > 12em) { +@container my-page-layout ((width < 500px) or (height < 500px)) and (block-size > 12em) { .card-content p { padding: 0; @@ -115,7 +133,7 @@ } } -@container (width < 500px) or (height < 500px) and (aspect-ratio: 3/2) { +@container ((width < 500px) or (height < 500px)) and (aspect-ratio: 3/2) { .card-content p { padding: 0; @@ -125,7 +143,7 @@ } } -@container (width < 500px) or (height < 500px) and (orientation: portrait) { +@container ((width < 500px) or (height < 500px)) and (orientation: portrait) { .card-content p { padding: 0; @@ -159,7 +177,7 @@ } } -@container ( width < 500px ) or (height<500px) and (orientation: portrait) { +@container ((width < 500px) or (height < 500px)) and (orientation: portrait) { .card-content p { padding: 0; @@ -169,7 +187,7 @@ } } -@container my-page-layout ( width< 500px) or ( height<500px) and ( block-size>12em ) { +@container my-page-layout (( width< 500px) or ( height<500px)) and ( block-size>12em ) { .card-content p { padding: 0; @@ -319,4 +337,35 @@ } } +@varfoo: foo; +@threshold: 400px; +@container @{varfoo} (min-width: @threshold) { + #sticky-child { + font-size: 75%; + } +} + +// Regression test: mixin with variable container name and variable query condition +// Issue: mixins with parameters using @container @name (condition < @var) failed +// with "variable @bp is undefined" error in older versions. Less 5 keeps the +// at-rule name on interpolation form because bare @var there is deprecated. +@issue-width: 125px; +.container-query-mixin(@container-name; @bp) { + @container @{container-name} (width < @bp) { + display: none; + } +} + +.mixin-container-test { + .container-query-mixin(name, @issue-width); + color: red; +} + +// Verify multiple calls with different params produce correct output +.sidebar-test { + .container-query-mixin(sidebar, 500px); +} +.header-test { + .container-query-mixin(header, 800px); +} diff --git a/packages/test-data/tests-unit/container/legacy/container.css b/packages/test-data/tests-unit/container/legacy/container.css new file mode 100644 index 0000000000..ae17470bdf --- /dev/null +++ b/packages/test-data/tests-unit/container/legacy/container.css @@ -0,0 +1,273 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.widget.discoverresults, +.widget.repositoriesresults { + container-type: inline-size; +} +@container (max-width: 350px) { + .widget.discoverresults .cite .wdr-authors, + .widget.repositoriesresults .cite .wdr-authors { + display: none; + } +} +@container (min-width: 700px) { + .card h2 { + font-size: 2em; + } +} +@container sidebar (min-width: 700px) { + .card { + font-size: 2em; + } +} +@container (min-width: 60ch) { + .container:nth-child(odd) > article { + border: 1px solid grey; + } +} +@container size(min-width: 60ch) { + .article--post header { + grid-template-areas: "avatar name" "avatar headline"; + align-items: start; + } + .article--post { + grid-template-areas: "header header" ". stats" ". content"; + grid-auto-columns: 5rem 1fr; + column-gap: 1rem; + } + .article--post__title { + font-size: 1.75rem; + } +} +.card h2 { + container-type: inline-size; + margin: 0; + padding: 10px; +} +@container (min-width: 500px) { + .card h2 .card-content { + grid-template-columns: 1fr 2fr; + grid-template-rows: auto 1fr; + align-items: start; + column-gap: 20px; + } + .card h2 .card-content h2 { + padding: 0; + margin: 0.5em 0 0 0; + } +} +@container (width >= 500px) and (height >= 500px) { + .card-content h2 { + padding: 0; + margin: 0.5em 0 0 0; + } +} +@container (width > 760px) not (height > 670px) { + .card-content h2 { + padding: 0; + margin: 0.5em 0 0 0; + } +} +@container not (height <= 1080px) { + .card-content h2 { + padding: 0; + margin: 0.5em 0 0 0; + } +} +@container (width < 500px) or (height < 500px) { + .card-content h2 { + padding: 0; + margin: 0.5em 0 0 0; + } +} +@container (width < 500px) or (height < 500px) and (inline-size >= 0px) { + .card-content p { + padding: 0; + } + .card-content p h2 { + margin: 0.5em 0 0 0; + } +} +@container my-page-layout (width < 500px) or (height < 500px) and (block-size > 12em) { + .card-content p { + padding: 0; + } + .card-content p h2 { + margin: 0.5em 0 0 0; + } +} +@container (width < 500px) or (height < 500px) and (aspect-ratio: 3/2) { + .card-content p { + padding: 0; + } + .card-content p h2 { + margin: 0.5em 0 0 0; + } +} +@container (width < 500px) or (height < 500px) and (orientation: portrait) { + .card-content p { + padding: 0; + } + .card-content p h2 { + margin: 0.5em 0 0 0; + } +} +@container card (inline-size > 30em) { + .card-content p { + padding: 0; + } + .card-content p h2 { + margin: 0.5em 0 0 0; + } +} +@container card (inline-size > 30em) and style(--responsive: true) { + .card-content { + grid-template-columns: 1fr 2fr; + grid-template-rows: auto 1fr; + align-items: start; + column-gap: 20px; + } + .card-content h2 { + padding: 0; + margin: 0.5em 0 0 0; + } +} +@container (width < 500px) or (height < 500px) and (orientation: portrait) { + .card-content p { + padding: 0; + } + .card-content p h2 { + margin: 0.5em 0 0 0; + } +} +@container my-page-layout (width < 500px) or (height < 500px) and (block-size > 12em) { + .card-content p { + padding: 0; + } + .card-content p h2 { + margin: 0.5em 0 0 0; + } +} +.wrapper { + container-name: wrapper; + container-type: size; +} +@container wrapper (height < 100) { + a { + max-height: 100; + } +} +@container wrapper (height < 200) { + a { + max-height: 200; + } +} +@container wrapper (height < 300) { + a { + max-height: 300; + } +} +@media only screen and (min-width: 768px) { + @container (min-width: 500px) { + .primary-content { + font-size: 1rem; + } + } +} +@media only screen and (min-width: 768px) { + .media-1 { + font-size: 1.5rem; + } + @container (min-width: 500px) { + .primary-content { + font-size: 1rem; + } + } +} +@media only screen and (min-width: 768px) { + .media-1 { + font-size: 1.5rem; + } + @container (min-width: 500px) { + .primary-content { + font-size: 1rem; + } + } + .media-2 { + font-size: 2rem; + } +} +@media only screen and (min-width: 768px) { + .media-1 { + font-size: 1.5rem; + } + @container (min-width: 500px) { + .primary-content { + font-size: 1rem; + } + @media (hover: hover) { + .foo { + font-size: 1.75rem; + } + } + } + .media-2 { + font-size: 2rem; + } +} +@media only screen and (min-width: 768px) { + .media-1 { + font-size: 1.5rem; + } + @container (min-width: 500px) { + .primary-content { + font-size: 1rem; + } + @media (hover: hover) { + .foo { + font-size: 1.75rem; + } + @media not all and (hover: hover) { + .foo { + color: limegreen; + } + } + .media-3 { + padding: 0.5rem; + } + } + } + .media-2 { + font-size: 2rem; + } +} +@container (min-width: 768px) { + @media only screen and (min-width: 768px) { + .foo { + color: aliceblue; + } + } + .container-1 { + color: purple; + } +} +#sticky { + position: sticky; + container-type: scroll-state; +} +@container scroll-state(stuck: top) { + #sticky-child { + font-size: 75%; + } +} +@container scroll-state(snapped: x) { + #sticky-child { + font-size: 75%; + } +} +@container scroll-state(scrollable: top) { + #sticky-child { + font-size: 75%; + } +} diff --git a/packages/test-data/tests-unit/container/styles.config.ts b/packages/test-data/tests-unit/container/styles.config.ts new file mode 100644 index 0000000000..39cc2aac3d --- /dev/null +++ b/packages/test-data/tests-unit/container/styles.config.ts @@ -0,0 +1,8 @@ +export default { + compile: { + mathMode: 'parens-division' + }, + output: { + collapseNesting: true, + }, +}; \ No newline at end of file diff --git a/packages/test-data/tests-unit/css-3/css-3.css b/packages/test-data/tests-unit/css-3/css-3.css index 032eeb3f25..e86a7c03a3 100644 --- a/packages/test-data/tests-unit/css-3/css-3.css +++ b/packages/test-data/tests-unit/css-3/css-3.css @@ -1,8 +1,9 @@ @namespace foo url(http://www.example.com); .comma-delimited { text-shadow: -1px -1px 1px red, 6px 5px 5px yellow; - -moz-box-shadow: 0pt 0pt 2px rgba(255, 255, 255, 0.4) inset, 0pt 4px 6px rgba(255, 255, 255, 0.4) inset; - -webkit-transform: rotate(0deg); + -moz-box-shadow: 0pt 0pt 2px rgba(255, 255, 255, 0.4) inset, + 0pt 4px 6px rgba(255, 255, 255, 0.4) inset; + -webkit-transform: rotate(-0.0000000001deg); } @font-face { font-family: Headline; @@ -74,8 +75,7 @@ p::before { font-size: 12px; } } -@supports ( box-shadow: 2px 2px 2px black ) or - ( -moz-box-shadow: 2px 2px 2px black ) { +@supports (box-shadow: 2px 2px 2px black) or (-moz-box-shadow: 2px 2px 2px black) { .outline { box-shadow: 2px 2px 2px black; -moz-box-shadow: 2px 2px 2px black; diff --git a/packages/test-data/tests-unit/css-3/legacy/css-3.css b/packages/test-data/tests-unit/css-3/legacy/css-3.css new file mode 100644 index 0000000000..c1a83caf47 --- /dev/null +++ b/packages/test-data/tests-unit/css-3/legacy/css-3.css @@ -0,0 +1,147 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +@namespace foo url(http://www.example.com); +.comma-delimited { + text-shadow: -1px -1px 1px red, 6px 5px 5px yellow; + -moz-box-shadow: 0pt 0pt 2px rgba(255, 255, 255, 0.4) inset, 0pt 4px 6px rgba(255, 255, 255, 0.4) inset; + -webkit-transform: rotate(0deg); +} +@font-face { + font-family: Headline; + unicode-range: U+??????, U+0???, U+0-7F, U+A5; +} +.other { + -moz-transform: translate(0, 11em) rotate(-90deg); + transform: rotateX(45deg); +} +.item[data-cra_zy-attr1b-ut3=bold] { + font-weight: bold; +} +p:not([class*="lead"]) { + color: black; +} +input[type="text"].class#id[attr=i32]:not(.one) { + color: inherit; +} +div#id.class[a=one][b=two].class:not(.one) { + color: inherit; +} +ul.comma > li:not(:only-child)::after { + color: inherit; +} +ol.comma > li:nth-last-child(2)::after { + color: inherit; +} +li:nth-child(4n+1), +li:nth-child(-5n), +li:nth-child(-n+2) { + color: inherit; +} +a[href^="http://"] { + color: black; +} +a[href$="http://"] { + color: black; +} +form[data-disabled] { + color: black; +} +p::before { + color: black; +} +#issue322 { + -webkit-animation: anim2 7s infinite ease-in-out; +} +@-webkit-keyframes frames { + 0% { + border: 1px; + } + 5.5% { + border: 2px; + } + 100% { + border: 3px; + } +} +@keyframes fontbulger1 { + to { + font-size: 15px; + } + from, + to { + font-size: 12px; + } + 0%, + 100% { + font-size: 12px; + } +} +@supports ( box-shadow: 2px 2px 2px black ) or + ( -moz-box-shadow: 2px 2px 2px black ) { + .outline { + box-shadow: 2px 2px 2px black; + -moz-box-shadow: 2px 2px 2px black; + } +} +@-x-document url-prefix(""github.com"") { + h1 { + color: red; + } +} +@viewport { + font-size: 10px; +} +foo|h1 { + color: blue; +} +foo|* { + color: yellow; +} +*|h1 { + color: green; +} +h1 { + color: green; +} +.upper-test { + UpperCaseProperties: allowed; +} +@host { + div { + display: block; + } +} +:not(input::placeholder) { + color: #b3b3b3; +} +.shadow > .dom, +body > .shadow { + display: done; +} +:host(.sel.a), +:host-context(.sel.b), +.sel > .b, +::content .sel { + type: shadow-dom; +} +* b { + c: 'd'; +} +* b[e] { + f: 'g'; +} +#issue2066 { + background: url('/images/icon-team.svg') 0 0 / contain; +} +@counter-style triangle { + system: cyclic; + symbols: ‣; + suffix: " "; +} +@unknown foo 42 (bar) { + x { + y: z; + } +} +@unknown foo 43; diff --git a/packages/test-data/tests-unit/css-escapes/css-escapes.css b/packages/test-data/tests-unit/css-escapes/css-escapes.css index f48e0c8577..acfbd3b12c 100644 --- a/packages/test-data/tests-unit/css-escapes/css-escapes.css +++ b/packages/test-data/tests-unit/css-escapes/css-escapes.css @@ -6,10 +6,10 @@ } .\34 04 { background: red; -} -.\34 04 strong { - color: fuchsia; - font-weight: bold; + strong { + color: fuchsia; + font-weight: bold; + } } .trailingTest\+ { color: red; diff --git a/packages/test-data/tests-unit/css-escapes/legacy/css-escapes.css b/packages/test-data/tests-unit/css-escapes/legacy/css-escapes.css new file mode 100644 index 0000000000..2eef67afe2 --- /dev/null +++ b/packages/test-data/tests-unit/css-escapes/legacy/css-escapes.css @@ -0,0 +1,34 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.escape\|random\|char { + color: red; +} +.mixin\!tUp { + font-weight: bold; +} +.\34 04 { + background: red; +} +.\34 04 strong { + color: fuchsia; + font-weight: bold; +} +.trailingTest\+ { + color: red; +} +/* This hideous test of hideousness checks for the selector "blockquote" with various permutations of hex escapes */ +\62\6c\6f \63 \6B \0071 \000075o\74 e { + color: silver; +} +[ng\:cloak], +ng\:form { + display: none; +} +.bootstrap { + background-color: #000 \9; +} +textarea { + font-family: 'helvetica neue', 'wenquanyi micro hei', \5FAE\8F6F\96C5\9ED1, \5B8B\4F53, sans-serif; +} +/* anything to unquote */ diff --git a/packages/test-data/tests-unit/css-escapes/styles.config.ts b/packages/test-data/tests-unit/css-escapes/styles.config.ts new file mode 100644 index 0000000000..774aec3bfc --- /dev/null +++ b/packages/test-data/tests-unit/css-escapes/styles.config.ts @@ -0,0 +1,5 @@ +export default { + output: [ + { file: '{name}.css', collapseNesting: false } + ] +} diff --git a/packages/test-data/tests-unit/css-grid/css-grid.css b/packages/test-data/tests-unit/css-grid/css-grid.css index df36a63ad0..a25a616521 100644 --- a/packages/test-data/tests-unit/css-grid/css-grid.css +++ b/packages/test-data/tests-unit/css-grid/css-grid.css @@ -20,5 +20,8 @@ display: grid; grid-template-columns: 9fr 1.875em 3fr; grid-template-rows: auto; - grid-template-areas: "header header header" "content . sidebar" "footer footer footer"; + grid-template-areas: + "header header header" + "content . sidebar" + "footer footer footer"; } diff --git a/packages/test-data/tests-unit/css-grid/legacy/css-grid.css b/packages/test-data/tests-unit/css-grid/legacy/css-grid.css new file mode 100644 index 0000000000..4db28594a0 --- /dev/null +++ b/packages/test-data/tests-unit/css-grid/legacy/css-grid.css @@ -0,0 +1,27 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.wrapper { + display: grid; + grid-template-columns: [col1-start] 9fr [col1-end] 10px [col2-start] 3fr [col2-end]; + grid-template-rows: auto; +} +.wrapper { + display: grid; + grid-template-columns: [left-bound] auto [container-left] 1170px [container-right] auto [right-bound]; + grid-template-rows: [row-1-start] 140px [row-2-start] 390px [row-3-start] 200px [row-4-start] 120px [row-5-start] 120px [row-6-start] 120px; +} +.container-12 { + z-index: 20; + display: grid; + grid-column: container-left / span 1; + grid-row: 2; + grid-template-columns: [wrapcol-1-start] 1fr [wrapcol-1-end] 15px [wrapcol-2-start] 1fr [wrapcol-2-end] 15px [wrapcol-3-start] 1fr [wrapcol-3-end] 15px [wrapcol-4-start] 1fr [wrapcol-4-end] 15px [wrapcol-5-start] 1fr [wrapcol-5-end] 15px [wrapcol-6-start] 1fr [wrapcol-6-end] 15px [wrapcol-7-start] 1fr [wrapcol-7-end] 15px [wrapcol-8-start] 1fr [wrapcol-8-end] 15px [wrapcol-9-start] 1fr [wrapcol-9-end] 15px [wrapcol-10-start] 1fr [wrapcol-10-end] 15px [wrapcol-11-start] 1fr [wrapcol-11-end] 15px [wrapcol-12-start] 1fr [wrapcol-12-end]; + grid-template-rows: repeat(14, [gutter] 10px [row] 60px); +} +.wrapper { + display: grid; + grid-template-columns: 9fr 1.875em 3fr; + grid-template-rows: auto; + grid-template-areas: "header header header" "content . sidebar" "footer footer footer"; +} diff --git a/packages/test-data/tests-unit/css-guards/css-guards.less b/packages/test-data/tests-unit/css-guards/css-guards.less index 8a097ae4df..f43f621d23 100644 --- a/packages/test-data/tests-unit/css-guards/css-guards.less +++ b/packages/test-data/tests-unit/css-guards/css-guards.less @@ -99,6 +99,7 @@ .errors-if-called when (@c = never) { .mixin-doesnt-exist(); } -a:hover when (2 = true) {5:-} +// a:hover when (2 = true) {5:-} +a:hover when (2 = true) {all:reset} diff --git a/packages/test-data/tests-unit/detached-rulesets/detached-rulesets.css b/packages/test-data/tests-unit/detached-rulesets/detached-rulesets.css index 9c9091eaa2..92bd361446 100644 --- a/packages/test-data/tests-unit/detached-rulesets/detached-rulesets.css +++ b/packages/test-data/tests-unit/detached-rulesets/detached-rulesets.css @@ -29,14 +29,16 @@ html.lt-ie9 header { } .wrap-selector { test: extra-wrap; - visible-one: visible; - visible-two: visible; } .wrap-selector .wrap-selector { test: wrapped-twice; visible-one: visible; visible-two: visible; } +.wrap-selector { + visible-one: visible; + visible-two: visible; +} .wrap-selector { test-func: 90; test-arithmetic: 18px; @@ -46,24 +48,30 @@ html.lt-ie9 header { .without-mixins { b: 1; } -@media (orientation: portrait) and (tv) { - .my-selector { - background-color: black; +@media (orientation: portrait) { + @media (tv) { + .my-selector { + background-color: black; + } } -} -@media (orientation: portrait) and (widescreen) and (print) and (tv) { - .triple-wrapped-mq { - triple: true; + @media (widescreen) { + @media (print) { + @media (tv) { + .triple-wrapped-mq { + triple: true; + } + } + } + @media (tv) { + .triple-wrapped-mq { + triple: true; + } + } } -} -@media (orientation: portrait) and (widescreen) and (tv) { - .triple-wrapped-mq { - triple: true; - } -} -@media (orientation: portrait) and (tv) { - .triple-wrapped-mq { - triple: true; + @media (tv) { + .triple-wrapped-mq { + triple: true; + } } } .a { diff --git a/packages/test-data/tests-unit/detached-rulesets/legacy/detached-rulesets.css b/packages/test-data/tests-unit/detached-rulesets/legacy/detached-rulesets.css new file mode 100644 index 0000000000..d6a30c2355 --- /dev/null +++ b/packages/test-data/tests-unit/detached-rulesets/legacy/detached-rulesets.css @@ -0,0 +1,79 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.wrap-selector { + color: black; + one: 1px; + four: magic-frame; + visible-one: visible; + visible-two: visible; +} +.wrap-selector { + color: red; + visible-one: visible; + visible-two: visible; +} +.wrap-selector { + color: black; + background: white; + visible-one: visible; + visible-two: visible; +} +header { + background: blue; +} +@media screen and (min-width: 1200) { + header { + background: red; + } +} +html.lt-ie9 header { + background: red; +} +.wrap-selector { + test: extra-wrap; + visible-one: visible; + visible-two: visible; +} +.wrap-selector .wrap-selector { + test: wrapped-twice; + visible-one: visible; + visible-two: visible; +} +.wrap-selector { + test-func: 90; + test-arithmetic: 18px; + visible-one: visible; + visible-two: visible; +} +.without-mixins { + b: 1; +} +@media (orientation: portrait) and (tv) { + .my-selector { + background-color: black; + } +} +@media (orientation: portrait) and (widescreen) and (print) and (tv) { + .triple-wrapped-mq { + triple: true; + } +} +@media (orientation: portrait) and (widescreen) and (tv) { + .triple-wrapped-mq { + triple: true; + } +} +@media (orientation: portrait) and (tv) { + .triple-wrapped-mq { + triple: true; + } +} +.a { + test: test; +} +.argument-default { + default: works; + direct: works; + named: works; +} diff --git a/packages/test-data/tests-unit/directives-bubbling/directives-bubbling.css b/packages/test-data/tests-unit/directives-bubbling/directives-bubbling.css index 4f5254b30e..136fdde01d 100644 --- a/packages/test-data/tests-unit/directives-bubbling/directives-bubbling.css +++ b/packages/test-data/tests-unit/directives-bubbling/directives-bubbling.css @@ -36,7 +36,7 @@ @supports (property: value) { @media (max-size: 2px) { @supports (whatever: something) { - .outOfMedia { + .outOfMedia { property: value; } } @@ -45,7 +45,7 @@ @supports (property: value) { @media (max-size: 2px) { @supports (whatever: something) { - .onTop { + .onTop { property: value; } } @@ -77,14 +77,16 @@ } } } -@media print and (max-size: 2px) { - .in1 { - stay: here; - } - @supports not (-webkit-font-smoothing: subpixel-antialiased) { - @supports (whatever: something) { - .in2 .in1 { - property: value; +@media print { + @media (max-size: 2px) { + .in1 { + stay: here; + } + @supports not (-webkit-font-smoothing: subpixel-antialiased) { + @supports (whatever: something) { + .in2 .in1 { + property: value; + } } } } @@ -101,10 +103,6 @@ html { property: value; } } -.onTop { - animation: "textscale"; - font-family: something; -} @font-face { font-family: something; src: made-up-url; @@ -117,3 +115,7 @@ html { font-size: 2em; } } +.onTop { + animation: "textscale"; + font-family: something; +} diff --git a/packages/test-data/tests-unit/extend-chaining/extend-chaining.css b/packages/test-data/tests-unit/extend-chaining/extend-chaining.css index b75ca15658..5e97b8db44 100644 --- a/packages/test-data/tests-unit/extend-chaining/extend-chaining.css +++ b/packages/test-data/tests-unit/extend-chaining/extend-chaining.css @@ -8,13 +8,10 @@ .d { color: black; } -.g.h, -.i.j.h, -.k.j.h { +:is(.g, :is(.i, .k).j).h { color: black; } -.i.j, -.k.j { +:is(.i, .k).j { color: inherit; } .l, @@ -72,10 +69,10 @@ .mc { color: inherit; } -} -@media (tv) and (plasma) { - .me, - .mf { - background: red; + @media (plasma) { + .me, + .mf { + background: red; + } } } diff --git a/packages/test-data/tests-unit/extend-chaining/legacy/extend-chaining.css b/packages/test-data/tests-unit/extend-chaining/legacy/extend-chaining.css new file mode 100644 index 0000000000..412ce8b605 --- /dev/null +++ b/packages/test-data/tests-unit/extend-chaining/legacy/extend-chaining.css @@ -0,0 +1,84 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.a, +.b, +.c { + color: black; +} +.f, +.e, +.d { + color: black; +} +.g.h, +.i.j.h, +.k.j.h { + color: black; +} +.i.j, +.k.j { + color: inherit; +} +.l, +.m, +.n, +.o, +.p, +.q, +.r, +.s, +.t { + color: black; +} +.u, +.v.u.v { + color: black; +} +.w, +.v.w.v { + color: black; +} +.x, +.y, +.z { + color: x; +} +.y, +.z, +.x { + color: y; +} +.z, +.x, +.y { + color: z; +} +.va, +.vb, +.vc { + color: black; +} +.vb, +.vc { + color: inherit; +} +@media (tv) { + .ma, + .mb, + .mc { + color: black; + } + .md, + .ma, + .mb, + .mc { + color: inherit; + } +} +@media (tv) and (plasma) { + .me, + .mf { + background: red; + } +} diff --git a/packages/test-data/tests-unit/extend-clearfix/extend-clearfix.css b/packages/test-data/tests-unit/extend-clearfix/extend-clearfix.css index 966892a27f..3525a8f122 100644 --- a/packages/test-data/tests-unit/extend-clearfix/extend-clearfix.css +++ b/packages/test-data/tests-unit/extend-clearfix/extend-clearfix.css @@ -3,9 +3,7 @@ .bar { *zoom: 1; } -.clearfix:after, -.foo:after, -.bar:after { +:is(.clearfix, .foo, .bar):after { content: ''; display: block; clear: both; diff --git a/packages/test-data/tests-unit/extend-clearfix/extend-clearfix.less b/packages/test-data/tests-unit/extend-clearfix/extend-clearfix.less index 71ac51d25e..82445dfa5a 100644 --- a/packages/test-data/tests-unit/extend-clearfix/extend-clearfix.less +++ b/packages/test-data/tests-unit/extend-clearfix/extend-clearfix.less @@ -17,4 +17,3 @@ &:extend(.clearfix all); color: blue; } - diff --git a/packages/test-data/tests-unit/extend/extend-clearfix.css b/packages/test-data/tests-unit/extend-clearfix/legacy/extend-clearfix.css similarity index 60% rename from packages/test-data/tests-unit/extend/extend-clearfix.css rename to packages/test-data/tests-unit/extend-clearfix/legacy/extend-clearfix.css index 966892a27f..2f26fd96d4 100644 --- a/packages/test-data/tests-unit/extend/extend-clearfix.css +++ b/packages/test-data/tests-unit/extend-clearfix/legacy/extend-clearfix.css @@ -1,3 +1,6 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + .clearfix, .foo, .bar { diff --git a/packages/test-data/tests-unit/extend-exact/extend-exact.css b/packages/test-data/tests-unit/extend-exact/extend-exact.css index beff4133e0..5fd772aa92 100644 --- a/packages/test-data/tests-unit/extend-exact/extend-exact.css +++ b/packages/test-data/tests-unit/extend-exact/extend-exact.css @@ -1,37 +1,38 @@ -.replace.replace .replace, -.c.replace + .replace .replace, -.replace.replace .c, -.c.replace + .replace .c, +:is(.replace.replace, .c.replace + .replace) :is(.replace, .c), .rep_ace { prop: copy-paste-replace; } .a .b .c { prop: not_effected; } -.a, -.effected { +.a { prop: is_effected; + .b { + prop: not_effected; + } + .b.c { + prop: not_effected; + } } -.a .b { - prop: not_effected; -} -.a .b.c { - prop: not_effected; +.effected { + prop: is_effected; } -.c .b .a, -.a .b .a, -.c .a .a, -.a .a .a, -.c .b .c, -.a .b .c, -.c .a .c, -.a .a .c { - prop: not_effected; +.c, +.a { + .b, + .a { + .a, + .c { + prop: not_effected; + } + } +} +.e.e { + prop: extend-double; + &:hover { + hover: not-extended; + } } -.e.e, .dbl { prop: extend-double; } -.e.e:hover { - hover: not-extended; -} diff --git a/packages/test-data/tests-unit/extend-exact/legacy/extend-exact.css b/packages/test-data/tests-unit/extend-exact/legacy/extend-exact.css new file mode 100644 index 0000000000..54931108a1 --- /dev/null +++ b/packages/test-data/tests-unit/extend-exact/legacy/extend-exact.css @@ -0,0 +1,40 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.replace.replace .replace, +.c.replace + .replace .replace, +.replace.replace .c, +.c.replace + .replace .c, +.rep_ace { + prop: copy-paste-replace; +} +.a .b .c { + prop: not_effected; +} +.a, +.effected { + prop: is_effected; +} +.a .b { + prop: not_effected; +} +.a .b.c { + prop: not_effected; +} +.c .b .a, +.a .b .a, +.c .a .a, +.a .a .a, +.c .b .c, +.a .b .c, +.c .a .c, +.a .a .c { + prop: not_effected; +} +.e.e, +.dbl { + prop: extend-double; +} +.e.e:hover { + hover: not-extended; +} diff --git a/packages/test-data/tests-unit/extend-exact/styles.config.ts b/packages/test-data/tests-unit/extend-exact/styles.config.ts new file mode 100644 index 0000000000..7848f4f38e --- /dev/null +++ b/packages/test-data/tests-unit/extend-exact/styles.config.ts @@ -0,0 +1,5 @@ +export default { + output: [ + { file: '{name}.css', collapseNesting: false } + ] +} \ No newline at end of file diff --git a/packages/test-data/tests-unit/extend-media/extend-media.css b/packages/test-data/tests-unit/extend-media/extend-media.css index 1bebabea5f..4a435021bc 100644 --- a/packages/test-data/tests-unit/extend-media/extend-media.css +++ b/packages/test-data/tests-unit/extend-media/extend-media.css @@ -1,24 +1,19 @@ -.ext1 .ext2, -.all .ext2 { +:is(.ext1, .all) .ext2 { background: black; } @media (tv) { - .ext1 .ext3, - .tv-lowres .ext3, - .all .ext3 { + :is(.ext1, .tv-lowres, .all) .ext3 { color: inherit; } .tv-lowres { background: blue; } -} -@media (tv) and (hires) { - .ext1 .ext4, - .tv-hires .ext4, - .all .ext4 { - color: green; - } - .tv-hires { - background: red; + @media (hires) { + :is(.ext1, .tv-lowres, .tv-hires, .all) .ext4 { + color: green; + } + .tv-hires { + background: red; + } } } diff --git a/packages/test-data/tests-unit/extend-media/legacy/extend-media.css b/packages/test-data/tests-unit/extend-media/legacy/extend-media.css new file mode 100644 index 0000000000..229f8ccd46 --- /dev/null +++ b/packages/test-data/tests-unit/extend-media/legacy/extend-media.css @@ -0,0 +1,27 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.ext1 .ext2, +.all .ext2 { + background: black; +} +@media (tv) { + .ext1 .ext3, + .tv-lowres .ext3, + .all .ext3 { + color: inherit; + } + .tv-lowres { + background: blue; + } +} +@media (tv) and (hires) { + .ext1 .ext4, + .tv-hires .ext4, + .all .ext4 { + color: green; + } + .tv-hires { + background: red; + } +} diff --git a/packages/test-data/tests-unit/extend-media/styles.config.ts b/packages/test-data/tests-unit/extend-media/styles.config.ts new file mode 100644 index 0000000000..7848f4f38e --- /dev/null +++ b/packages/test-data/tests-unit/extend-media/styles.config.ts @@ -0,0 +1,5 @@ +export default { + output: [ + { file: '{name}.css', collapseNesting: false } + ] +} \ No newline at end of file diff --git a/packages/test-data/tests-unit/extend-nest/extend-nest.css b/packages/test-data/tests-unit/extend-nest/extend-nest.css index e4b48a4be2..432b47ea1f 100644 --- a/packages/test-data/tests-unit/extend-nest/extend-nest.css +++ b/packages/test-data/tests-unit/extend-nest/extend-nest.css @@ -5,10 +5,7 @@ width: 300px; background: red; } -.sidebar .box, -.sidebar2 .box, -.type1 .sidebar3 .box, -.type2.sidebar4 .box { +:is(.sidebar, .sidebar2, .type1 .sidebar3, .type2.sidebar4) .box { background: #FFF; border: 1px solid #000; margin: 10px 0; @@ -26,8 +23,7 @@ .submit { color: black; } -.button:hover, -.submit:hover { +:is(.button, .submit):hover { color: inherit; } .button2 :hover { @@ -37,21 +33,6 @@ notnested: black; } .amp-test-h, -.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e.amp-test-g, -.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e.amp-test-g, -.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e.amp-test-g, -.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e.amp-test-g, -.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e.amp-test-g, -.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e.amp-test-g, -.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e.amp-test-g, -.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e.amp-test-g, -.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e.amp-test-g, -.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e.amp-test-g, -.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e.amp-test-g, -.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e.amp-test-g, -.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e.amp-test-g, -.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e.amp-test-g, -.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e.amp-test-g, -.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e.amp-test-g { +.amp-test-f:is(.amp-test-c :is(.amp-test-a, .amp-test-b).amp-test-d:is(.amp-test-a, .amp-test-b).amp-test-e) + :is(.amp-test-c :is(.amp-test-a, .amp-test-b).amp-test-d:is(.amp-test-a, .amp-test-b).amp-test-e).amp-test-g { test: extended by masses of selectors; } diff --git a/packages/test-data/tests-unit/extend-nest/legacy/extend-nest.css b/packages/test-data/tests-unit/extend-nest/legacy/extend-nest.css new file mode 100644 index 0000000000..d40efc2e43 --- /dev/null +++ b/packages/test-data/tests-unit/extend-nest/legacy/extend-nest.css @@ -0,0 +1,60 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.sidebar, +.sidebar2, +.type1 .sidebar3, +.type2.sidebar4 { + width: 300px; + background: red; +} +.sidebar .box, +.sidebar2 .box, +.type1 .sidebar3 .box, +.type2.sidebar4 .box { + background: #FFF; + border: 1px solid #000; + margin: 10px 0; +} +.sidebar2 { + background: blue; +} +.type1 .sidebar3 { + background: green; +} +.type2.sidebar4 { + background: red; +} +.button, +.submit { + color: black; +} +.button:hover, +.submit:hover { + color: inherit; +} +.button2 :hover { + nested: white; +} +.button2 :hover { + notnested: black; +} +.amp-test-h, +.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e.amp-test-g, +.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e.amp-test-g, +.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e.amp-test-g, +.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e.amp-test-g, +.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e.amp-test-g, +.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e.amp-test-g, +.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e.amp-test-g, +.amp-test-f.amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e.amp-test-g, +.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e.amp-test-g, +.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e.amp-test-g, +.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e.amp-test-g, +.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e.amp-test-g, +.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-a.amp-test-e.amp-test-g, +.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-a.amp-test-d.amp-test-b.amp-test-e.amp-test-g, +.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-a.amp-test-e.amp-test-g, +.amp-test-f.amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e + .amp-test-c .amp-test-b.amp-test-d.amp-test-b.amp-test-e.amp-test-g { + test: extended by masses of selectors; +} diff --git a/packages/test-data/tests-unit/extend-selector/extend-selector.css b/packages/test-data/tests-unit/extend-selector/extend-selector.css index 3c6c01f2c4..960fe1a860 100644 --- a/packages/test-data/tests-unit/extend-selector/extend-selector.css +++ b/packages/test-data/tests-unit/extend-selector/extend-selector.css @@ -1,87 +1,62 @@ -.error, -.badError { - border: 1px #f00; - background: #fdd; -} -.error.intrusion, -.badError.intrusion { - font-size: 1.3em; - font-weight: bold; -} -.intrusion .error, -.intrusion .badError { - display: none; -} -.badError { - border-width: 3px; -} -.foo .bar, -.foo .baz, -.ext1 .ext2 .bar, -.ext1 .ext2 .baz, -.ext3 .bar, -.ext3 .baz, -.ext4 .bar, -.ext4 .baz { +:is(.foo, .ext1 .ext2, .ext3, .ext4) .bar, +:is(.foo, .ext1 .ext2, .ext3, .ext4) .baz { display: none; } -div.ext5, -.ext6 > .ext5, -div.ext7, -.ext6 > .ext7 { +div:is(.ext5, .ext7), +.ext6 > :is(.ext5, .ext7) { width: 100px; } .ext, -.a .c, -.b .c { +:is(.a, .b) .c { test: 1; } .a, .b { test: 2; -} -.a .c, -.b .c { - test: 3; -} -.a .c .d, -.b .c .d { - test: 4; -} -.replace.replace .replace, -.c.replace + .replace .replace, -.replace.replace .c, -.c.replace + .replace .c, -.rep_ace.rep_ace .rep_ace, -.c.rep_ace + .rep_ace .rep_ace, -.rep_ace.rep_ace .c, -.c.rep_ace + .rep_ace .c { - prop: copy-paste-replace; -} -.attributes [data="test"], -.attributes .attributes .attribute-test { - extend: attributes; -} -.attributes [data], -.attributes .attributes .attribute-test2 { - extend: attributes2; -} -.attributes [data="test3"], -.attributes .attributes .attribute-test { - extend: attributes2; + .c { + test: 3; + .d { + test: 4; + } + } +} +:is(.replace, .rep_ace):is(.replace, .rep_ace), +.c:is(.replace, .rep_ace) + :is(.replace, .rep_ace) { + .replace, + .c, + .rep_ace { + prop: copy-paste-replace; + } +} +.attributes { + [data="test"], + .attribute-test { + extend: attributes; + } + [data], + .attribute-test2 { + extend: attributes2; + } + [data="test3"], + .attribute-test { + extend: attributes2; + } } .header .header-nav, .footer .footer-nav { background: red; -} -.header .header-nav:before, -.footer .footer-nav:before { - background: blue; + &:before { + background: blue; + } } .issue-2586-bordered, .issue-2586-somepage .content { border: solid 1px black; } -.issue-2586-somepage .content > span { - margin-bottom: 10px; +.issue-2586-somepage { + .content { + & > span { + margin-bottom: 10px; + } + } } diff --git a/packages/test-data/tests-unit/extend-selector/extend-selector.less b/packages/test-data/tests-unit/extend-selector/extend-selector.less index 214042d622..1809adb804 100644 --- a/packages/test-data/tests-unit/extend-selector/extend-selector.less +++ b/packages/test-data/tests-unit/extend-selector/extend-selector.less @@ -1,18 +1,3 @@ -.error { - border: 1px #f00; - background: #fdd; -} -.error.intrusion { - font-size: 1.3em; - font-weight: bold; -} -.intrusion .error { - display: none; -} -.badError:extend(.error all) { - border-width: 3px; -} - .foo .bar, .foo .baz { display: none; } diff --git a/packages/test-data/tests-unit/extend-selector/legacy/extend-selector.css b/packages/test-data/tests-unit/extend-selector/legacy/extend-selector.css new file mode 100644 index 0000000000..9bd7ebf68b --- /dev/null +++ b/packages/test-data/tests-unit/extend-selector/legacy/extend-selector.css @@ -0,0 +1,73 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.foo .bar, +.foo .baz, +.ext1 .ext2 .bar, +.ext1 .ext2 .baz, +.ext3 .bar, +.ext3 .baz, +.ext4 .bar, +.ext4 .baz { + display: none; +} +div.ext5, +.ext6 > .ext5, +div.ext7, +.ext6 > .ext7 { + width: 100px; +} +.ext, +.a .c, +.b .c { + test: 1; +} +.a, +.b { + test: 2; +} +.a .c, +.b .c { + test: 3; +} +.a .c .d, +.b .c .d { + test: 4; +} +.replace.replace .replace, +.c.replace + .replace .replace, +.replace.replace .c, +.c.replace + .replace .c, +.rep_ace.rep_ace .rep_ace, +.c.rep_ace + .rep_ace .rep_ace, +.rep_ace.rep_ace .c, +.c.rep_ace + .rep_ace .c { + prop: copy-paste-replace; +} +.attributes [data="test"], +.attributes .attributes .attribute-test { + extend: attributes; +} +.attributes [data], +.attributes .attributes .attribute-test2 { + extend: attributes2; +} +.attributes [data="test3"], +.attributes .attributes .attribute-test { + extend: attributes2; +} +.header .header-nav, +.footer .footer-nav { + background: red; +} +.header .header-nav:before, +.footer .footer-nav:before { + background: blue; +} +.issue-2586-bordered, +.issue-2586-somepage .content { + border: solid 1px black; +} +.issue-2586-somepage .content > span { + margin-bottom: 10px; +} diff --git a/packages/test-data/tests-unit/extend-selector/styles.config.ts b/packages/test-data/tests-unit/extend-selector/styles.config.ts new file mode 100644 index 0000000000..b8791bbcbd --- /dev/null +++ b/packages/test-data/tests-unit/extend-selector/styles.config.ts @@ -0,0 +1,5 @@ +export default { + output: { + collapseNesting: false + } +} \ No newline at end of file diff --git a/packages/test-data/tests-unit/extend/extend-clearfix.less b/packages/test-data/tests-unit/extend/extend-clearfix.less deleted file mode 100644 index 82445dfa5a..0000000000 --- a/packages/test-data/tests-unit/extend/extend-clearfix.less +++ /dev/null @@ -1,19 +0,0 @@ -.clearfix { - *zoom: 1; - &:after { - content: ''; - display: block; - clear: both; - height: 0; - } -} - -.foo { - &:extend(.clearfix all); - color: red; -} - -.bar { - &:extend(.clearfix all); - color: blue; -} diff --git a/packages/test-data/tests-unit/extend/extend.css b/packages/test-data/tests-unit/extend/extend.css index 2895641a73..3e69b5ca62 100644 --- a/packages/test-data/tests-unit/extend/extend.css +++ b/packages/test-data/tests-unit/extend/extend.css @@ -3,34 +3,22 @@ border: 1px #f00; background: #fdd; } -.error.intrusion, -.badError.intrusion { +:is(.error, .badError).intrusion { font-size: 1.3em; font-weight: bold; } -.intrusion .error, -.intrusion .badError { +.intrusion :is(.error, .badError) { display: none; } .badError { border-width: 3px; } -.foo .bar, -.foo .baz, -.ext1 .ext2 .bar, -.ext1 .ext2 .baz, -.ext3 .bar, -.ext3 .baz, -.foo .ext3, -.ext4 .bar, -.ext4 .baz, -.foo .ext4 { +:is(.foo, .ext1 .ext2, .ext3, .ext4) :is(.bar, .ext3, .ext4), +:is(.foo, .ext1 .ext2, .ext3, .ext4) .baz { display: none; } -div.ext5, -.ext6 > .ext5, -div.ext7, -.ext6 > .ext7 { +div:is(.ext5, .ext7), +.ext6 > :is(.ext5, .ext7) { width: 100px; } .ext8.ext9, @@ -56,21 +44,27 @@ div.ext7, .fuu { result: match-nested-foo; } -.aa, -.cc { +.aa { color: black; + .dd, + .ee { + background: red; + } } -.aa .dd, -.aa .ee { - background: red; +.cc { + color: black; } .bb, -.cc, -.ee, .ff { background: red; + .bb, + .ff { + color: black; + } } -.bb .bb, -.ff .ff { - color: black; +.cc { + background: red; +} +.ee { + background: red; } diff --git a/packages/test-data/tests-unit/extend/legacy/extend.css b/packages/test-data/tests-unit/extend/legacy/extend.css new file mode 100644 index 0000000000..2263213cb3 --- /dev/null +++ b/packages/test-data/tests-unit/extend/legacy/extend.css @@ -0,0 +1,79 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.error, +.badError { + border: 1px #f00; + background: #fdd; +} +.error.intrusion, +.badError.intrusion { + font-size: 1.3em; + font-weight: bold; +} +.intrusion .error, +.intrusion .badError { + display: none; +} +.badError { + border-width: 3px; +} +.foo .bar, +.foo .baz, +.ext1 .ext2 .bar, +.ext1 .ext2 .baz, +.ext3 .bar, +.ext3 .baz, +.foo .ext3, +.ext4 .bar, +.ext4 .baz, +.foo .ext4 { + display: none; +} +div.ext5, +.ext6 > .ext5, +div.ext7, +.ext6 > .ext7 { + width: 100px; +} +.ext8.ext9, +.fuu { + result: add-foo; +} +.ext8 .ext9, +.ext8 + .ext9, +.ext8 > .ext9, +.buu, +.zap, +.zoo { + result: bar-matched; +} +.ext8.nomatch { + result: none; +} +.ext8 .ext9, +.buu { + result: match-nested-bar; +} +.ext8.ext9, +.fuu { + result: match-nested-foo; +} +.aa, +.cc { + color: black; +} +.aa .dd, +.aa .ee { + background: red; +} +.bb, +.cc, +.ee, +.ff { + background: red; +} +.bb .bb, +.ff .ff { + color: black; +} diff --git a/packages/test-data/tests-unit/extend/styles.config.ts b/packages/test-data/tests-unit/extend/styles.config.ts new file mode 100644 index 0000000000..7848f4f38e --- /dev/null +++ b/packages/test-data/tests-unit/extend/styles.config.ts @@ -0,0 +1,5 @@ +export default { + output: [ + { file: '{name}.css', collapseNesting: false } + ] +} \ No newline at end of file diff --git a/packages/test-data/tests-unit/extract-and-length/extract-and-length.css b/packages/test-data/tests-unit/extract-and-length/extract-and-length.css index 626ae4d067..4f196d9b0d 100644 --- a/packages/test-data/tests-unit/extract-and-length/extract-and-length.css +++ b/packages/test-data/tests-unit/extract-and-length/extract-and-length.css @@ -15,7 +15,8 @@ number-value: 12345678; color-value: blue; rgba-value: rgba(80, 160, 240, 0.67); - --empty-value: ; + --empty-value: extract(~'', 1); + empty-value: ; name-length: 1; string-length: 1; number-length: 1; @@ -28,12 +29,12 @@ extract: c | b | a; } .mixin-arguments-2 { - length: 4; - extract: c | b | a; + length: 1; + extract: extract(a b c d, 3) | extract(a b c d, 2) | a b c d; } .mixin-arguments-3 { - length: 4; - extract: c | b | a; + length: 1; + extract: extract(a b c d, 3) | extract(a b c d, 2) | a b c d; } .mixin-arguments-4 { length: 0; diff --git a/packages/test-data/tests-unit/extract-and-length/extract-and-length.less b/packages/test-data/tests-unit/extract-and-length/extract-and-length.less index aa08d05094..29c5796573 100644 --- a/packages/test-data/tests-unit/extract-and-length/extract-and-length.less +++ b/packages/test-data/tests-unit/extract-and-length/extract-and-length.less @@ -37,7 +37,12 @@ number-value: extract(12345678, 1); color-value: extract(blue, 1); rgba-value: extract(rgba(80, 160, 240, 0.67), 1); + // Custom properties are preserved as authored unless interpolation is used. + // Less v5 guidance for evaluation: + // @tmp: extract(~'', 1); + // --empty-value: @{tmp}; --empty-value: extract(~'', 1); + empty-value: extract(~'', 1); name-length: length(name); string-length: length("string"); @@ -122,9 +127,9 @@ .md-3D { @a: a b c d, 1 2 3 4; @b: 5 6 7 8, e f g h; - .3D(@a, @b); + .three-D(@a, @b); - .3D(...) { + .three-D(...) { @v1: @arguments; length-1: length(@v1); diff --git a/packages/test-data/tests-unit/extract-and-length/legacy/extract-and-length.css b/packages/test-data/tests-unit/extract-and-length/legacy/extract-and-length.css new file mode 100644 index 0000000000..7202179269 --- /dev/null +++ b/packages/test-data/tests-unit/extract-and-length/legacy/extract-and-length.css @@ -0,0 +1,137 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.multiunit { + length: 6; + extract: abc "abc" 1 1px 1% #123; +} +.incorrect-index { + v1: extract(a b c, 5); + v2: extract(a, b, c, -2); +} +.scalar { + var-value: variable; + var-length: 1; + ill-index: extract(variable, 2); + name-value: name; + string-value: "string"; + number-value: 12345678; + color-value: blue; + rgba-value: rgba(80, 160, 240, 0.67); + --empty-value: extract(~'', 1); + empty-value: ; + name-length: 1; + string-length: 1; + number-length: 1; + color-length: 1; + rgba-length: 1; + empty-length: 1; +} +.mixin-arguments-1 { + length: 4; + extract: c | b | a; +} +.mixin-arguments-2 { + length: 4; + extract: c | b | a; +} +.mixin-arguments-3 { + length: 4; + extract: c | b | a; +} +.mixin-arguments-4 { + length: 0; + extract: extract(, 2) | extract(, 1); +} +.mixin-arguments-2 { + length: 4; + extract: c | b | a; +} +.mixin-arguments-3 { + length: 4; + extract: c | b | a; +} +.mixin-arguments-4 { + length: 3; + extract: c | b; +} +.mixin-arguments-2 { + length: 4; + extract: 3 | 2 | 1; +} +.mixin-arguments-3 { + length: 4; + extract: 3 | 2 | 1; +} +.mixin-arguments-4 { + length: 3; + extract: 3 | 2; +} +.md-space-comma { + length-1: 3; + extract-1: 1 2 3; + length-2: 3; + extract-2: 2; +} +.md-space-comma-as-args-2 { + length: 3; + extract: "x" "y" "z" | 1 2 3 | a b c; +} +.md-space-comma-as-args-3 { + length: 3; + extract: "x" "y" "z" | 1 2 3 | a b c; +} +.md-space-comma-as-args-4 { + length: 2; + extract: "x" "y" "z" | 1 2 3; +} +.md-cat-space-comma { + length-1: 3; + extract-1: 1 2 3; + length-2: 3; + extract-2: 2; +} +.md-cat-space-comma-as-args-2 { + length: 3; + extract: "x" "y" "z" | 1 2 3 | a b c; +} +.md-cat-space-comma-as-args-3 { + length: 3; + extract: "x" "y" "z" | 1 2 3 | a b c; +} +.md-cat-space-comma-as-args-4 { + length: 2; + extract: "x" "y" "z" | 1 2 3; +} +.md-cat-comma-space { + length-1: 3; + extract-1: 1, 2, 3; + length-2: 3; + extract-2: 2; +} +.md-cat-comma-space-as-args-1 { + length: 3; + extract: "x", "y", "z" | 1, 2, 3 | a, b, c; +} +.md-cat-comma-space-as-args-2 { + length: 3; + extract: "x", "y", "z" | 1, 2, 3 | a, b, c; +} +.md-cat-comma-space-as-args-3 { + length: 3; + extract: "x", "y", "z" | 1, 2, 3 | a, b, c; +} +.md-cat-comma-space-as-args-4 { + length: 0; + extract: extract(, 2) | extract(, 1); +} +.md-3D { + length-1: 2; + extract-1: a b c d, 1 2 3 4; + length-2: 2; + extract-2: 5 6 7 8; + length-3: 4; + extract-3: 7; + length-4: 1; + extract-4: 8; +} diff --git a/packages/test-data/tests-unit/functions-each/functions-each.css b/packages/test-data/tests-unit/functions-each/functions-each.css index 782dc32770..a455d7f80d 100644 --- a/packages/test-data/tests-unit/functions-each/functions-each.css +++ b/packages/test-data/tests-unit/functions-each/functions-each.css @@ -8,16 +8,15 @@ a: b; } .each { - index: 1, 2, 3, 4; item1: a; item2: b; item3: c; + index: 1, 2, 3, 4; item4: d; nest-1-1: 10px 1; nest-2-1: 15px 2; nest-1-2: 20px 1; nest-2-2: 25px 2; - padding: 10px 20px 30px 40px; } .each .nest-anon { nest-1-1: a c; @@ -25,6 +24,9 @@ nest-2-1: b c; nest-2-2: b d; } +.each { + padding: 10px 20px 30px 40px; +} .set { one: blue; two: green; diff --git a/packages/test-data/tests-unit/functions/functions.css b/packages/test-data/tests-unit/functions/functions.css index 4876f58747..4a97497f9b 100644 --- a/packages/test-data/tests-unit/functions/functions.css +++ b/packages/test-data/tests-unit/functions/functions.css @@ -1,11 +1,3 @@ -#functions { - color: #660000; - width: 16; - height: undefined("self"); - border-width: 5; - variable: 11; - background: linear-gradient(#000, #fff); -} #built-in { escaped: -Some::weird(#thing, y); lighten: #ffcccc; @@ -17,7 +9,7 @@ desaturate: #29332f; desaturate-relative: #233930; greyscale: #2e2e2e; - hsl-clamp: hsl(0, 0%, 100%); + hsl-clamp: hsl(380, 150%, 150%); spin-p: hsl(20, 50%, 50%); spin-n: hsl(350, 50%, 50%); luma-white: 100%; @@ -110,13 +102,13 @@ min: 1pt; min: 3mm; min: min(1, 4ex, 2pt); - min: min(calc(1 + 1), 1); + min: min(calc(1em + 1vw), 1); min: min(var(--width), 802px); max: 3; max: 5em; max: max(5m, 3em); max: min(var(--body-max-width), calc(100vw - 20px)); - max: max(1, calc(1 + 1)); + max: max(1, calc(1em + 1vw)); max-native: max(10vw, 100px); percentage: 20%; color-quoted-digit: #dda0dd; @@ -224,18 +216,22 @@ html { a: true; b: false; c: false; + d: true; + e: false; } #if { a: 1; b: 2; c: 3; - --e: ; + e: ; f: 6; g: 3; h: 5; i: 6; j: 8; k: 1; + m: 1; + n: 2; l: black; /* results in void */ color: green; @@ -243,7 +239,7 @@ html { } .paren-escapes { list-1: 1, 2, 3; - length-1: 3; + length-1: 1; item-1: 4; item-2: 5; item-3: 6; diff --git a/packages/test-data/tests-unit/functions/functions.less b/packages/test-data/tests-unit/functions/functions.less index bc476b6e25..ab4c4b0499 100644 --- a/packages/test-data/tests-unit/functions/functions.less +++ b/packages/test-data/tests-unit/functions/functions.less @@ -1,14 +1,3 @@ -#functions { - @var: 10; - @colors: #000, #fff; - color: _color("evil red"); // #660000 - width: increment(15); - height: undefined("self"); - border-width: add(2, 3); - variable: increment(@var); - background: linear-gradient(@colors); -} - #built-in { @r: 32; escaped: e("-Some::weird(#thing, y)"); @@ -117,17 +106,17 @@ min: min(1pt, 3pt); min: min(1cm, 3mm); min: min(6em, 5, 4ex, 3, 2pt, 1); - min: min(calc(1 + 1), 1); + min: min(calc(1em + 1vw), 1); min: min(~'var(--width), 802px'); max: max(1, 3); max: max(3em, 1em, 2em, 5em); max: max(1px, 2, 3em, 4, 5m, 6); max: min(var(--body-max-width), calc(100vw - 20px)); - max: max(1, calc(1 + 1)); + max: max(1, calc(1em + 1vw)); max-native: max(10vw, 100px); percentage: percentage((10px / 50)); color-quoted-digit: color("#dda0dd"); - color-quoted-keyword: color("plum"); + color-quoted-keyword: color("plum") + #000000; color-color: color(#dda0dd); color-keyword: color(plum); tint: tint(#777777, 13); @@ -256,6 +245,9 @@ html { a: boolean(not(2 < 1)); b: boolean(not(2 > 1) and (true)); c: boolean(not(boolean(true))); + // not without parentheses (should behave the same as with parentheses) + d: boolean(not false); + e: boolean(not true); } #if { @@ -263,7 +255,7 @@ html { b: if(not(true), 1, 2); @1: if(not(false), {c: 3}, {d: 4}); @1(); - --e: if(not(true), 5); + e: if(not(true), 5); @f: boolean(3 = 4); f: if(not(@f), 6); g: if(true, 3, 5); @@ -271,6 +263,9 @@ html { i: if(true and isnumber(6), 6, 8); j: if(not(true) and true, 6, 8); k: if(true or true, 1); + // not without parentheses + m: if(not false, 1, 2); + n: if(not true, 1, 2); // see: https://github.com/less/less.js/issues/3371 @some: foo; @@ -303,5 +298,7 @@ html { list-2: @list-1; list-3: @list-2; } - .mixin($list-1, ~(7; 8; 9)); + // the following list was semi-colon-separated, but this was never an + // explicitly supported syntax / feature + .mixin($list-1, ~(7, 8, 9)); } diff --git a/packages/test-data/tests-unit/functions/legacy/functions.css b/packages/test-data/tests-unit/functions/legacy/functions.css new file mode 100644 index 0000000000..4edb3db29b --- /dev/null +++ b/packages/test-data/tests-unit/functions/legacy/functions.css @@ -0,0 +1,244 @@ +#built-in { + escaped: -Some::weird(#thing, y); + lighten: #ffcccc; + lighten-relative: #ff6666; + darken: #330000; + darken-relative: #990000; + saturate: #203c31; + saturate-relative: #28342f; + desaturate: #29332f; + desaturate-relative: #233930; + greyscale: #2e2e2e; + hsl-clamp: hsl(0, 0%, 100%); + spin-p: hsl(20, 50%, 50%); + spin-n: hsl(350, 50%, 50%); + luma-white: 100%; + luma-black: 0%; + luma-black-alpha: 0%; + luma-red: 21.26%; + luma-green: 71.52%; + luma-blue: 7.22%; + luma-yellow: 92.78%; + luma-cyan: 78.74%; + luma-differs-from-luminance: 23.89833349%; + luminance-white: 100%; + luminance-black: 0%; + luminance-black-alpha: 0%; + luminance-red: 21.26%; + luminance-differs-from-luma: 36.40541176%; + contrast-filter: contrast(30%); + saturate-filter: saturate(5%); + contrast-white: #000000; + contrast-black: #ffffff; + contrast-red: #ffffff; + contrast-green: #000000; + contrast-blue: #ffffff; + contrast-yellow: #000000; + contrast-cyan: #000000; + contrast-light: #111111; + contrast-dark: #eeeeee; + contrast-wrongorder: #111111; + contrast-light-thresh: #111111; + contrast-dark-thresh: #eeeeee; + contrast-high-thresh: #eeeeee; + contrast-low-thresh: #111111; + contrast-light-thresh-per: #111111; + contrast-dark-thresh-per: #eeeeee; + contrast-high-thresh-per: #eeeeee; + contrast-low-thresh-per: #111111; + replace: "Hello, World!"; + replace-captured: "This is a new string."; + replace-with-flags: "2 + 2 = 4"; + replace-single-quoted: 'foo-2'; + replace-escaped-string: bar-2; + replace-keyword: baz-2; + replace-with-color: "#135#1357"; + replace-with-number: "2em07"; + format: "rgb(32, 128, 64)"; + format-string: "hello world"; + format-multiple: "hello earth 2"; + format-url-encode: "red is %23ff0000"; + format-single-quoted: 'hello single world'; + format-escaped-string: hello escaped world; + format-color-as-string: "#123"; + format-number-as-string: "4px"; + eformat: rgb(32, 128, 64); + unitless: 12; + unit: 14em; + unitpercentage: 100%; + get-unit: px; + get-unit-empty: ; + hue: 98; + saturation: 12%; + lightness: 95%; + hsvhue: 98; + hsvsaturation: 12%; + hsvvalue: 95%; + red: 255; + green: 255; + blue: 255; + rounded: 11; + rounded-two: 10.67; + roundedpx: 3px; + roundedpx-three: 3.333px; + rounded-percentage: 10%; + ceil: 11px; + floor: 12px; + sqrt: 5px; + pi: 3.14159265; + mod: 2m; + abs: 4%; + tan: 0.90040404; + sin: 0.17364818; + cos: 0.84385396; + atan: 0.1rad; + atan: 34deg; + atan: 45deg; + pow: 64px; + pow: 64; + pow: 27; + min: 0; + min: 5; + min: 1pt; + min: 3mm; + min: min(1, 4ex, 2pt); + min: min(calc(1em + 1vw), 1); + min: min(var(--width), 802px); + max: 3; + max: 5em; + max: max(5m, 3em); + max: min(var(--body-max-width), calc(100vw - 20px)); + max: max(1, calc(1em + 1vw)); + max-native: max(10vw, 100px); + percentage: 20%; + color-quoted-digit: #dda0dd; + color-quoted-keyword: #dda0dd; + color-color: #dda0dd; + color-keyword: #dda0dd; + tint: #898989; + tint-full: #ffffff; + tint-percent: #898989; + tint-negative: #656565; + shade: #686868; + shade-full: #000000; + shade-percent: #686868; + shade-negative: #868686; + fade-out: rgba(255, 0, 0, 0.95); + fade-in: rgba(255, 0, 0, 0.95); + fade-out-relative: rgba(255, 0, 0, 0.95); + fade-in-relative: rgba(255, 0, 0, 0.945); + fade-out2: rgba(255, 0, 0, 0); + fade-out2-relative: rgba(255, 0, 0, 0.25); + hsv: hsl(5, 33.33333333%, 22.5%); + hsva: rgba(77, 40, 38, 0.2); + mix: #ff3300; + mix-0: #ffff00; + mix-100: #ff0000; + mix-weightless: #ff8000; + mixt: rgba(255, 0, 0, 0.5); +} +#built-in .is-a { + rules-defined: true; + foo-defined: false; + ruleset: true; + color: true; + color1: true; + color2: true; + color3: true; + keyword: true; + number: true; + string: true; + pixel: true; + percent: true; + em: true; + ex: true; + rem: true; + vw: true; + vh: true; + vmin: true; + vmax: true; + ch: true; + cm: true; + mm: true; + pt: true; + q: true; + in: true; + cat: true; + no-unit-is-empty: true; + case-insensitive-1: true; + case-insensitive-2: true; +} +#alpha { + alpha: hsla(25, 50%, 40%, 0.6); + alpha2: 0.5; + alpha3: 0; +} +#blendmodes { + multiply: #ed0000; + screen: #f600f6; + overlay: #ed0000; + softlight: #fa0000; + hardlight: #0000ed; + difference: #f600f6; + exclusion: #f600f6; + average: #7b007b; + negation: #d73131; +} +#extract-and-length { + extract: 3 2 1 C B A; + length: 6; +} +#quoted-functions-in-mixin { + replace-double-quoted: 'foo-2'; + replace-single-quoted: 'foo-4'; + replace-escaped-string: bar-2; + replace-keyword: baz-2; + replace-anonymous: qux-2; + format-double-quoted: "hello world"; + format-single-quoted: 'hello single world'; + format-escaped-string: hello escaped world; + format-keyword: hello; + format-anonymous: hello anonymous world; +} +#list-details { + length: 2; + one: a 1; + two: b 2; + two-length: 2; + two-one: b; + two-two: 2; +} +/* comment1 */ +html { + color: #8080ff; +} +#boolean { + a: true; + b: false; + c: false; +} +#if { + a: 1; + b: 2; + c: 3; + e: ; + f: 6; + g: 3; + h: 5; + i: 6; + j: 8; + k: 1; + l: black; + /* results in void */ + color: green; + color: purple; +} +.paren-escapes { + list-1: 1, 2, 3; + length-1: 3; + item-1: 4; + item-2: 5; + item-3: 6; + list-2: 1, 2, 3; + list-3: 7, 8, 9; +} diff --git a/packages/test-data/tests-unit/functions/legacy/functions.less b/packages/test-data/tests-unit/functions/legacy/functions.less new file mode 100644 index 0000000000..aa0f928192 --- /dev/null +++ b/packages/test-data/tests-unit/functions/legacy/functions.less @@ -0,0 +1,296 @@ +#built-in { + @r: 32; + escaped: e("-Some::weird(#thing, y)"); + lighten: lighten(#ff0000, 40%); + lighten-relative: lighten(#ff0000, 40%, relative); + darken: darken(#ff0000, 40%); + darken-relative: darken(#ff0000, 40%, relative); + saturate: saturate(#29332f, 20%); + saturate-relative: saturate(#29332f, 20%, relative); + desaturate: desaturate(#203c31, 20%); + desaturate-relative: desaturate(#203c31, 20%, relative); + greyscale: greyscale(#203c31); + hsl-clamp: hsl(380, 150%, 150%); + spin-p: spin(hsl(340, 50%, 50%), 40); + spin-n: spin(hsl(30, 50%, 50%), -40); + luma-white: luma(#fff); + luma-black: luma(#000); + luma-black-alpha: luma(rgba(0,0,0,0.5)); + luma-red: luma(#ff0000); + luma-green: luma(#00ff00); + luma-blue: luma(#0000ff); + luma-yellow: luma(#ffff00); + luma-cyan: luma(#00ffff); + luma-differs-from-luminance: luma(#ff3600); + luminance-white: luma(#fff); + luminance-black: luma(#000); + luminance-black-alpha: luma(rgba(0,0,0,0.5)); + luminance-red: luma(#ff0000); + luminance-differs-from-luma: luminance(#ff3600); + contrast-filter: contrast(30%); + saturate-filter: saturate(5%); + contrast-white: contrast(#fff); + contrast-black: contrast(#000); + contrast-red: contrast(#ff0000); + contrast-green: contrast(#00ff00); + contrast-blue: contrast(#0000ff); + contrast-yellow: contrast(#ffff00); + contrast-cyan: contrast(#00ffff); + contrast-light: contrast(#fff, #111111, #eeeeee); + contrast-dark: contrast(#000, #111111, #eeeeee); + contrast-wrongorder: contrast(#fff, #eeeeee, #111111, 0.5); + contrast-light-thresh: contrast(#fff, #111111, #eeeeee, 0.5); + contrast-dark-thresh: contrast(#000, #111111, #eeeeee, 0.5); + contrast-high-thresh: contrast(#555, #111111, #eeeeee, 0.6); + contrast-low-thresh: contrast(#555, #111111, #eeeeee, 0.09); + contrast-light-thresh-per: contrast(#fff, #111111, #eeeeee, 50%); + contrast-dark-thresh-per: contrast(#000, #111111, #eeeeee, 50%); + contrast-high-thresh-per: contrast(#555, #111111, #eeeeee, 60%); + contrast-low-thresh-per: contrast(#555, #111111, #eeeeee, 9%); + replace: replace("Hello, Mars.", "Mars\.", "World!"); + replace-captured: replace("This is a string.", "(string)\.$", "new $1."); + replace-with-flags: replace("One + one = 4", "one", "2", "gi"); + replace-single-quoted: replace('foo-1', "1", "2"); + replace-escaped-string: replace(~"bar-1", "1", "2"); + replace-keyword: replace(baz-1, "1", "2"); + replace-with-color: replace("007", "0", #135, g); + replace-with-number: replace("007", "0", 2em); + format: %("rgb(%d, %d, %d)", @r, 128, 64); + format-string: %("hello %s", "world"); + format-multiple: %("hello %s %d", "earth", 2); + format-url-encode: %("red is %A", #ff0000); + format-single-quoted: %('hello %s', "single world"); + format-escaped-string: %(~"hello %s", "escaped world"); + format-color-as-string: %("%s", #123); + format-number-as-string: %("%s", 4px); + eformat: e(%("rgb(%d, %d, %d)", @r, 128, 64)); + + unitless: unit(12px); + unit: unit((13px + 1px), em); + unitpercentage: unit(100, %); + + get-unit: get-unit(10px); + get-unit-empty: get-unit(10); + + hue: hue(hsl(98, 12%, 95%)); + saturation: saturation(hsl(98, 12%, 95%)); + lightness: lightness(hsl(98, 12%, 95%)); + hsvhue: hsvhue(hsv(98, 12%, 95%)); + hsvsaturation: hsvsaturation(hsv(98, 12%, 95%)); + hsvvalue: hsvvalue(hsv(98, 12%, 95%)); + red: red(#f00); + green: green(#0f0); + blue: blue(#00f); + rounded: round((@r/3)); + rounded-two: round((@r/3), 2); + roundedpx: round((10px / 3)); + roundedpx-three: round((10px / 3), 3); + rounded-percentage: round(10.2%); + ceil: ceil(10.1px); + floor: floor(12.9px); + sqrt: sqrt(25px); + pi: pi(); + mod: mod(13m, 11cm); // could take into account units, doesn't at the moment + abs: abs(-4%); + tan: tan(42deg); + sin: sin(10deg); + cos: cos(12); + atan: atan(tan(0.1rad)); + atan: convert(acos(cos(34deg)), deg); + atan: convert(acos(cos(50grad)), deg); + pow: pow(8px, 2); + pow: pow(4, 3); + pow: pow(3, 3em); + min: min(0); + min: min(6, 5); + min: min(1pt, 3pt); + min: min(1cm, 3mm); + min: min(6em, 5, 4ex, 3, 2pt, 1); + min: min(calc(1 + 1), 1); + min: min(~'var(--width), 802px'); + max: max(1, 3); + max: max(3em, 1em, 2em, 5em); + max: max(1px, 2, 3em, 4, 5m, 6); + max: min(var(--body-max-width), calc(100vw - 20px)); + max: max(1, calc(1 + 1)); + max-native: max(10vw, 100px); + percentage: percentage((10px / 50)); + color-quoted-digit: color("#dda0dd"); + color-quoted-keyword: color("plum"); + color-color: color(#dda0dd); + color-keyword: color(plum); + tint: tint(#777777, 13); + tint-full: tint(#777777, 100); + tint-percent: tint(#777777, 13%); + tint-negative: tint(#777777, -13%); + shade: shade(#777777, 13); + shade-full: shade(#777777, 100); + shade-percent: shade(#777777, 13%); + shade-negative: shade(#777777, -13%); + + fade-out: fadeout(red, 5%); // support fadeOut and fadeout + fade-in: fadein(fadeout(red, 10%), 5%); + fade-out-relative: fadeout(red, 5%,relative); + fade-in-relative: fadein(fadeout(red, 10%, relative), 5%, relative); + fade-out2: fadeout(fadeout(red, 50%), 50%); + fade-out2-relative: fadeout(fadeout(red, 50%, relative), 50%, relative); + + hsv: hsv(5, 50%, 30%); + hsva: hsva(3, 50%, 30%, 0.2); + + mix: mix(#ff0000, #ffff00, 80); + mix-0: mix(#ff0000, #ffff00, 0); + mix-100: mix(#ff0000, #ffff00, 100); + mix-weightless: mix(#ff0000, #ffff00); + mixt: mix(#ff0000, transparent); + + .is-a { + @rules: { + color: red; + }; + rules-defined: isdefined(@rules); + foo-defined: isdefined(@foo); + ruleset: isruleset(@rules); + color: iscolor(#ddd); + color1: iscolor(red); + color2: iscolor(rgb(0, 0, 0)); + color3: iscolor(transparent); + keyword: iskeyword(hello); + number: isnumber(32); + string: isstring("hello"); + pixel: ispixel(32px); + percent: ispercentage(32%); + em: isem(32em); + ex: isunit(32ex, ex); + rem: isunit(32rem, rem); + vw: isunit(32vw, vw); + vh: isunit(32vh, vh); + vmin: isunit(32vmin, vmin); + vmax: isunit(32vmax, vmax); + ch: isunit(32ch, ch); + cm: isunit(32cm, cm); + mm: isunit(32mm, mm); + pt: isunit(32pt, pt); + q: isunit(32q, q); + in: isunit(32in, in); + cat: isunit(32cat, cat); + no-unit-is-empty: isunit(32, ''); + case-insensitive-1: isunit(32CAT, cat); + case-insensitive-2: isunit(32px, PX); + } +} + +#alpha { + alpha: darken(hsla(25, 50%, 50%, 0.6), 10%); + alpha2: alpha(rgba(3, 4, 5, 0.5)); + alpha3: alpha(transparent); +} + +#blendmodes { + multiply: multiply(#f60000, #f60000); + screen: screen(#f60000, #0000f6); + overlay: overlay(#f60000, #0000f6); + softlight: softlight(#f60000, #ffffff); + hardlight: hardlight(#f60000, #0000f6); + difference: difference(#f60000, #0000f6); + exclusion: exclusion(#f60000, #0000f6); + average: average(#f60000, #0000f6); + negation: negation(#f60000, #313131); +} + +#extract-and-length { + @anon: A B C 1 2 3; + extract: extract(@anon, 6) extract(@anon, 5) extract(@anon, 4) extract(@anon, 3) extract(@anon, 2) extract(@anon, 1); + length: length(@anon); +} + +#quoted-functions-in-mixin { + // Quoted type may have some weird side-effects when used in mixins (#2308) + .mixin(); + .mixin() { + replace-double-quoted: replace('foo-1', "1", "2"); + replace-single-quoted: replace('foo-3', "3", "4"); + replace-escaped-string: replace(~"bar-1", "1", "2"); + replace-keyword: replace(baz-1, "1", "2"); + replace-anonymous: replace(e("qux-1"), "1", "2"); + format-double-quoted: %("hello %s", "world"); + format-single-quoted: %('hello %s', "single world"); + format-escaped-string: %(~"hello %s", "escaped world"); + format-keyword: %(hello); + format-anonymous: %(e("hello %s"), "anonymous world"); + } +} + +#list-details { + @list: + a 1, // Some comment + b 2; + + length: length(@list); + one: extract(@list, 1); + @two: extract(@list, 2); + two: @two; + two-length: length(@two); + two-one: extract(@two, 1); + two-two: extract(@two, 2); +} +@color1: #FFF;/* comment1 */ +@color2: #FFF/* comment2 */; +html { + color: mix(blue, @color1, 50%); + color: mix(blue, @color2, 50%); +} + +#boolean { + a: boolean(not(2 < 1)); + b: boolean(not(2 > 1) and (true)); + c: boolean(not(boolean(true))); +} + +#if { + a: if(not(false), 1, 2); + b: if(not(true), 1, 2); + @1: if(not(false), {c: 3}, {d: 4}); @1(); + + --e: if(not(true), 5); + @f: boolean(3 = 4); + f: if(not(@f), 6); + g: if(true, 3, 5); + h: if(false, 3, 5); + i: if(true and isnumber(6), 6, 8); + j: if(not(true) and true, 6, 8); + k: if(true or true, 1); + + // see: https://github.com/less/less.js/issues/3371 + @some: foo; + l: if((iscolor(@some)), darken(@some, 10%), black); + + + if((false), {g: 7}); /* results in void */ + + @conditional: if((true), { + color: green; + }, {}); + @conditional(); + + @falsey: if((false), { + color: orange; + }, { + color: purple; + }); + @falsey(); +} + +.paren-escapes { + list-1: ~(1, 2, 3); + length-1: length($list-1); + each(~(1 2 3); { + item-@{value}: @value + 3; + }) + + .mixin(@list-1; @list-2) { + list-2: @list-1; + list-3: @list-2; + } + .mixin($list-1, ~(7; 8; 9)); +} diff --git a/packages/test-data/tests-unit/ie-filters/ie-filters.css b/packages/test-data/tests-unit/ie-filters-REMOVED/legacy/ie-filters.css similarity index 100% rename from packages/test-data/tests-unit/ie-filters/ie-filters.css rename to packages/test-data/tests-unit/ie-filters-REMOVED/legacy/ie-filters.css diff --git a/packages/test-data/tests-unit/ie-filters/ie-filters.less b/packages/test-data/tests-unit/ie-filters-REMOVED/legacy/ie-filters.less similarity index 100% rename from packages/test-data/tests-unit/ie-filters/ie-filters.less rename to packages/test-data/tests-unit/ie-filters-REMOVED/legacy/ie-filters.less diff --git a/packages/test-data/tests-unit/import/import-reference-issues.css b/packages/test-data/tests-unit/import/import-reference-issues.css index 92daa29aa9..f8d8717be1 100644 --- a/packages/test-data/tests-unit/import/import-reference-issues.css +++ b/packages/test-data/tests-unit/import/import-reference-issues.css @@ -8,12 +8,12 @@ show-all-content { /* tralala */ -} -show-all-content .fix { - fix: fix; -} -show-all-content .something { - inside: something; + .fix { + fix: fix; + } + .something { + inside: something; + } } #used-namespaced-mixin { was: included; diff --git a/packages/test-data/tests-unit/import/import-reference.css b/packages/test-data/tests-unit/import/import-reference.css index eb14b783f2..203365be2b 100644 --- a/packages/test-data/tests-unit/import/import-reference.css +++ b/packages/test-data/tests-unit/import/import-reference.css @@ -44,11 +44,13 @@ div#id.class[a=one][b=two].class:not(.one) { } .b { color: red; - color: green; } .b .c { color: green; } +.b { + color: green; +} .b:hover { color: green; } @@ -59,7 +61,7 @@ div#id.class[a=one][b=two].class:not(.one) { color: green; } .y { - pulled-in: yes /* inline comment survives */; + pulled-in: yes; } /* comment pulled in */ .visible { diff --git a/packages/test-data/tests-unit/import/import/import-reference.less b/packages/test-data/tests-unit/import/import/import-reference.less index c545f2667f..d690989246 100644 --- a/packages/test-data/tests-unit/import/import/import-reference.less +++ b/packages/test-data/tests-unit/import/import/import-reference.less @@ -73,11 +73,11 @@ } } .mixin-with-directives(@keyframeName) { - @keyframes @keyframeName { + @keyframes @{keyframeName} { @rules1(); } @supports (animation-name: test) { - @keyframes @keyframeName { + @keyframes @{keyframeName} { @rules2(); } .selector { diff --git a/packages/test-data/tests-unit/import/legacy/import-reference-issues.css b/packages/test-data/tests-unit/import/legacy/import-reference-issues.css new file mode 100644 index 0000000000..f5c78d5de3 --- /dev/null +++ b/packages/test-data/tests-unit/import/legacy/import-reference-issues.css @@ -0,0 +1,27 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.test-rule-c { + background-color: green; +} +.theOnlySelector { + shall-have: one selector; +} +show-all-content { + /* + tralala +*/ +} +show-all-content .fix { + fix: fix; +} +show-all-content .something { + inside: something; +} +#used-namespaced-mixin { + was: included; + shall-see: another property above; +} +call-mixin-with-import-by-reference-inside { + the-only-property: nothing-below-this; +} diff --git a/packages/test-data/tests-unit/import/legacy/import-reference.css b/packages/test-data/tests-unit/import/legacy/import-reference.css new file mode 100644 index 0000000000..307e32bf47 --- /dev/null +++ b/packages/test-data/tests-unit/import/legacy/import-reference.css @@ -0,0 +1,101 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +input[type="text"].class#id[attr=i32]:not(.one) { + color: inherit; +} +div#id.class[a=one][b=two].class:not(.one) { + color: inherit; +} +@media print { + .class { + color: blue; + } + .class .sub { + width: 42; + } +} +.visible { + color: red; +} +.visible .c { + color: green; +} +.visible { + color: green; +} +.visible:hover { + color: green; +} +.visible + .visible { + color: green; +} +.visible + .visible .sub { + color: green; +} +@supports (something: else) { + .class { + something: else; + } + .nestedToo .class { + something: else; + } +} +.b { + color: red; +} +.b .c { + color: green; +} +.b { + color: green; +} +.b:hover { + color: green; +} +.b { + color: green; +} +.b + .b { + color: green; +} +.b + .b .sub { + color: green; +} +.y { + pulled-in: yes /* inline comment survives */; +} +/* comment pulled in */ +.visible { + extend: test; +} +.test-rule-mediaq-import { + color: green; + test: 340px; +} +@media (max-size: 450px) { + .test-rule-mediaq-import { + color: red; + } +} +.test-rule { + color: red; +} +.test-rule:first-child { + color: blue; +} +@keyframes some-name { + property: value; +} +@supports (animation-name: test) { + @keyframes some-name { + property: value; + } + .selector { + color: red; + } +} +div { + this isn't very valid CSS. +} +this isn't very valid CSS. diff --git a/packages/test-data/tests-unit/import/styles.config.cjs b/packages/test-data/tests-unit/import/styles.config.cjs index 327a12fb8d..c6559c7f44 100644 --- a/packages/test-data/tests-unit/import/styles.config.cjs +++ b/packages/test-data/tests-unit/import/styles.config.cjs @@ -1,7 +1,8 @@ module.exports = { language: { - less: { - "syncImport": true -} - } + less: {} + }, + output: [ + { file: '{name}.css', collapseNesting: false } + ] }; diff --git a/packages/test-data/tests-unit/javascript/javascript.css b/packages/test-data/tests-unit/javascript-REMOVED/legacy/javascript.css similarity index 100% rename from packages/test-data/tests-unit/javascript/javascript.css rename to packages/test-data/tests-unit/javascript-REMOVED/legacy/javascript.css diff --git a/packages/test-data/tests-unit/javascript/javascript.less b/packages/test-data/tests-unit/javascript-REMOVED/legacy/javascript.less similarity index 100% rename from packages/test-data/tests-unit/javascript/javascript.less rename to packages/test-data/tests-unit/javascript-REMOVED/legacy/javascript.less diff --git a/packages/test-data/tests-unit/javascript/styles.config.cjs b/packages/test-data/tests-unit/javascript-REMOVED/legacy/styles.config.cjs similarity index 100% rename from packages/test-data/tests-unit/javascript/styles.config.cjs rename to packages/test-data/tests-unit/javascript-REMOVED/legacy/styles.config.cjs diff --git a/packages/test-data/tests-unit/layer/layer.css b/packages/test-data/tests-unit/layer/layer.css index 7196325af3..b02d6479eb 100644 --- a/packages/test-data/tests-unit/layer/layer.css +++ b/packages/test-data/tests-unit/layer/layer.css @@ -3,14 +3,18 @@ @import url("/import/layer-import-4.css") layer(print) print; @import url("/import/layer-import-4.css") layer(print) print, (max-width: 600px); @import url("/import/layer-import-5.css") layer(features) supports(display: grid); -@layer { - .main::before { - color: #f00; +.main { + @layer { + &::before { + color: #f00; + } } } @layer legacy { - .sub-rule ul { - color: white; + .sub-rule { + ul { + color: white; + } } } @layer primevue { @@ -30,10 +34,10 @@ body { margin: 0; font-family: system-ui, sans-serif; - } - body header { - background-color: #f0f0f0; - padding: 1rem; + header { + background-color: #f0f0f0; + padding: 1rem; + } } } @layer components { @@ -42,9 +46,9 @@ padding: 0.5rem 1rem; background-color: blue; color: white; - } - .button:hover { - background-color: darkblue; + &:hover { + background-color: darkblue; + } } } @layer utilities { @@ -53,21 +57,19 @@ } .responsive { width: 100%; - } - @media (min-width: 768px) { - .responsive { + @media (min-width: 768px) { width: 50%; } } } .parent { color: black; -} -.parent .child { - color: red; -} -.parent:hover { - background: lightgray; + .child { + color: red; + } + &:hover { + background: lightgray; + } } @layer foo.baz { .bar { @@ -91,3 +93,43 @@ color: #555; } } +@layer theme; +@layer layout, utilities; +body { + color: black; +} +@layer components { + .btn { + color: red; + &:hover { + color: blue; + } + } +} +@layer { + p { + margin-block: 1rem; + } +} +@layer framework.buttons.primary { + .btn-primary { + background: dodgerblue; + color: white; + } +} +.feature { + color: gray; + @layer component { + h2 { + font-size: 1.5rem; + } + } +} +@layer ui { + .btn { + padding: 0.5rem 1rem; + border-radius: 4px; + background: rebeccapurple; + color: white; + } +} diff --git a/packages/test-data/tests-unit/layer/layer.less b/packages/test-data/tests-unit/layer/layer.less index 71578f20b2..5494143eb3 100644 --- a/packages/test-data/tests-unit/layer/layer.less +++ b/packages/test-data/tests-unit/layer/layer.less @@ -18,7 +18,7 @@ @layer-name: primevue; -@layer @layer-name { +@layer @{layer-name} { .test { foo: bar; } @@ -112,3 +112,56 @@ } +@layer theme; +@layer layout, utilities; + +body { + color: black; +} + +@layer components { + .btn { + color: red; + &:hover { + color: blue; + } + } +} + +@layer { + p { + margin-block: 1rem; + } +} + +@layer framework.buttons.primary { + .btn-primary { + background: dodgerblue; + color: white; + } +} + +.feature { + color: gray; + + @layer component { + h2 { + font-size: 1.5rem; + } + } +} + +@primary-color: rebeccapurple; + +.button-styles() { + padding: 0.5rem 1rem; + border-radius: 4px; +} + +@layer ui { + .btn { + .button-styles(); + background: @primary-color; + color: white; + } +} diff --git a/packages/test-data/tests-unit/layer/legacy/layer.css b/packages/test-data/tests-unit/layer/legacy/layer.css new file mode 100644 index 0000000000..5c1d742299 --- /dev/null +++ b/packages/test-data/tests-unit/layer/legacy/layer.css @@ -0,0 +1,136 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +@import url("/import/layer-import-2.css") layer(foo); +@import url("/import/layer-import-3.css") layer(responsive) supports(display: flex) screen and (max-width: 768px); +@import url("/import/layer-import-4.css") layer(print) print; +@import url("/import/layer-import-4.css") layer(print) print, (max-width: 600px); +@import url("/import/layer-import-5.css") layer(features) supports(display: grid); +@layer { + .main::before { + color: #f00; + } +} +@layer legacy { + .sub-rule ul { + color: white; + } +} +@layer primevue { + .test { + foo: bar; + } +} +@layer reset, base, components, utilities; +@layer reset { + *, + *::before, + *::after { + box-sizing: border-box; + } +} +@layer base { + body { + margin: 0; + font-family: system-ui, sans-serif; + } + body header { + background-color: #f0f0f0; + padding: 1rem; + } +} +@layer components { + .button { + display: inline-block; + padding: 0.5rem 1rem; + background-color: blue; + color: white; + } + .button:hover { + background-color: darkblue; + } +} +@layer utilities { + .text-center { + text-align: center; + } + .responsive { + width: 100%; + } + @media (min-width: 768px) { + .responsive { + width: 50%; + } + } +} +.parent { + color: black; +} +.parent .child { + color: red; +} +.parent:hover { + background: lightgray; +} +@layer foo.baz { + .bar { + font-weight: bold; + } +} +@layer framework { + @layer layout { + .container { + display: grid; + gap: 2rem; + } + } +} +@layer framework.layout { + main { + padding: 2rem; + } + p { + margin-block: 1rem; + color: #555; + } +} +@layer theme; +@layer layout, utilities; +body { + color: black; +} +@layer components { + .btn { + color: red; + } + .btn:hover { + color: blue; + } +} +@layer { + p { + margin-block: 1rem; + } +} +@layer framework.buttons.primary { + .btn-primary { + background: dodgerblue; + color: white; + } +} +.feature { + color: gray; +} +@layer component { + .feature h2 { + font-size: 1.5rem; + } +} +@layer ui { + .btn { + padding: 0.5rem 1rem; + border-radius: 4px; + background: rebeccapurple; + color: white; + } +} diff --git a/packages/test-data/tests-unit/layer/styles.config.ts b/packages/test-data/tests-unit/layer/styles.config.ts new file mode 100644 index 0000000000..774aec3bfc --- /dev/null +++ b/packages/test-data/tests-unit/layer/styles.config.ts @@ -0,0 +1,5 @@ +export default { + output: [ + { file: '{name}.css', collapseNesting: false } + ] +} diff --git a/packages/test-data/tests-unit/math-css-vars/math-css-vars.css b/packages/test-data/tests-unit/math-css-vars/math-css-vars.css new file mode 100644 index 0000000000..6bba2fd863 --- /dev/null +++ b/packages/test-data/tests-unit/math-css-vars/math-css-vars.css @@ -0,0 +1,11 @@ +.trig { + a: sin(var(--angle)); + b: cos(var(--a)); + c: calc(tan(var(--t)) * 1px); + d: atan2(var(--x), var(--y)); + e: percentage(var(--p)); +} +.numeric { + a: 0.5; + b: 5; +} diff --git a/packages/test-data/tests-unit/math-css-vars/math-css-vars.less b/packages/test-data/tests-unit/math-css-vars/math-css-vars.less new file mode 100644 index 0000000000..cf437b3314 --- /dev/null +++ b/packages/test-data/tests-unit/math-css-vars/math-css-vars.less @@ -0,0 +1,15 @@ +// Math functions cannot resolve a runtime CSS var() at compile time, so the +// whole call is left for the browser instead of erroring (issue #4224). +.trig { + a: sin(var(--angle)); + b: cos(var(--a)); + c: calc(tan(var(--t)) * 1px); + d: atan2(var(--x), var(--y)); + e: percentage(var(--p)); +} + +// Concrete numeric arguments still evaluate. +.numeric { + a: sin(30deg); + b: ceil(4.2); +} diff --git a/packages/test-data/tests-unit/media/legacy/media.css b/packages/test-data/tests-unit/media/legacy/media.css new file mode 100644 index 0000000000..59ced9a533 --- /dev/null +++ b/packages/test-data/tests-unit/media/legacy/media.css @@ -0,0 +1,274 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +@media print { + .class { + color: blue; + } + .class .sub { + width: 42; + } + .top, + header > h1 { + color: #444444; + } +} +@media screen { + .body { + max-width: 480; + } +} +@media all and (device-aspect-ratio: 16 / 9) { + .body { + max-width: 800px; + } +} +@media all and (orientation: portrait) { + aside { + float: none; + } +} +@media handheld and (min-width: 42), screen and (min-width: 20em) { + .body { + max-width: 480px; + } +} +@media print { + .body { + padding: 20px; + } + .body header { + background-color: red; + } +} +@media print and (orientation: landscape) { + .body { + margin-left: 20px; + } +} +@media screen { + .sidebar { + width: 300px; + } +} +@media screen and (orientation: landscape) { + .sidebar { + width: 500px; + } +} +@media a and (b) { + .first .second .third { + width: 300px; + } + .first .second .fourth { + width: 3; + } +} +@media a and (b) and (c) { + .first .second .third { + width: 500px; + } +} +@media a, (b) and (c) { + .body { + width: 95%; + } +} +@media a and (x), (b) and (c) and (x), a and (y), (b) and (c) and (y) { + .body { + width: 100%; + } +} +.a { + background: black; +} +@media handheld { + .a { + background: white; + } +} +@media handheld and (max-width: 100px) { + .a { + background: red; + } +} +.b { + background: black; +} +@media handheld { + .b { + background: white; + } +} +@media handheld and (max-width: 200px) { + .b { + background: red; + } +} +@media only screen and (max-width: 200px) { + .body { + width: 480px; + } +} +@media print { + @page :left { + margin: 0.5cm; + } + @page :right { + margin: 0.5cm; + } + @page Test:first { + margin: 1cm; + } + @page :first { + size: 8.5in 11in; + @top-left { + margin: 1cm; + } + @top-left-corner { + margin: 1cm; + } + @top-center { + margin: 1cm; + } + @top-right { + margin: 1cm; + } + @top-right-corner { + margin: 1cm; + } + @bottom-left { + margin: 1cm; + } + @bottom-left-corner { + margin: 1cm; + } + @bottom-center { + margin: 1cm; + } + @bottom-right { + margin: 1cm; + } + @bottom-right-corner { + margin: 1cm; + } + @left-top { + margin: 1cm; + } + @left-middle { + margin: 1cm; + } + @left-bottom { + margin: 1cm; + } + @right-top { + margin: 1cm; + } + @right-middle { + content: "Page " counter(page); + } + @right-bottom { + margin: 1cm; + } + } +} +@media (-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2), (-o-min-device-pixel-ratio: 2/1), (min-resolution: 2dppx), (min-resolution: 128dpcm) { + .b { + background: red; + } +} +.body { + background: red; +} +@media (max-width: 500px) { + .body { + background: green; + } +} +@media (max-width: 1000px) { + .body { + background: red; + background: blue; + } +} +@media (max-width: 1000px) and (max-width: 500px) { + .body { + background: green; + } +} +@media (max-width: 1200px) { + /* a comment */ +} +@media (max-width: 1200px) and (max-width: 900px) { + .body { + font-size: 11px; + } +} +@media (min-width: 480px) { + .nav-justified > li { + display: table-cell; + } +} +@media (min-width: 768px) and (min-width: 480px) { + .menu > li { + display: table-cell; + } +} +@media all and (tv) { + .all-and-tv-variables { + var: all-and-tv; + } +} +@media screen and (min-width: 61px) { + .selector { + foo: bar; + } +} +@media screen and (color), projection and (color) { + .selector { + color: #eee; + } +} +@media not (width <= -100px) { + body { + background: green; + } +} +@media (height > -100px) { + body { + background: green; + } +} +@media not (resolution: -300dpi) { + body { + background: green; + } +} +@media (min-orientation: portrait) { + body { + background: green; + } +} +@media print and (min-resolution: 118dpcm) { + body { + background: green; + } +} +@media (200px <= width <= 500px) { + .test-range-syntax { + padding: 0; + } +} +.selector { + color: #eee; +} +@media (200px <= width <= 500px) { + .selector .test-range-syntax { + padding: 0; + } +} +@media print, (max-width: 992px) { + div { + color: red; + } +} diff --git a/packages/test-data/tests-unit/media/media.css b/packages/test-data/tests-unit/media/media.css index d471401e85..ac236bf8df 100644 --- a/packages/test-data/tests-unit/media/media.css +++ b/packages/test-data/tests-unit/media/media.css @@ -37,43 +37,45 @@ .body header { background-color: red; } -} -@media print and (orientation: landscape) { - .body { - margin-left: 20px; + @media (orientation: landscape) { + .body { + margin-left: 20px; + } } } @media screen { .sidebar { width: 300px; } -} -@media screen and (orientation: landscape) { - .sidebar { - width: 500px; - } -} -@media a and (b) { - .first .second .third { - width: 300px; - } - .first .second .fourth { - width: 3; + @media (orientation: landscape) { + .sidebar { + width: 500px; + } } } -@media a and (b) and (c) { - .first .second .third { - width: 500px; +@media a { + @media (b) { + .first .second .third { + width: 300px; + } + @media (c) { + .first .second .third { + width: 500px; + } + } + .first .second .fourth { + width: 3; + } } } @media a, (b) and (c) { .body { width: 95%; } -} -@media a and (x), (b) and (c) and (x), a and (y), (b) and (c) and (y) { - .body { - width: 100%; + @media (x), (y) { + .body { + width: 100%; + } } } .a { @@ -83,10 +85,10 @@ .a { background: white; } -} -@media handheld and (max-width: 100px) { - .a { - background: red; + @media (max-width: 100px) { + .a { + background: red; + } } } .b { @@ -96,10 +98,10 @@ .b { background: white; } -} -@media handheld and (max-width: 200px) { - .b { - background: red; + @media (max-width: 200px) { + .b { + background: red; + } } } @media only screen and (max-width: 200px) { @@ -114,7 +116,7 @@ @page :right { margin: 0.5cm; } - @page Test:first { + @page Test :first { margin: 1cm; } @page :first { @@ -169,7 +171,7 @@ } } } -@media (-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2), (-o-min-device-pixel-ratio: 2/1), (min-resolution: 2dppx), (min-resolution: 128dpcm) { +@media (-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2), (-o-min-device-pixel-ratio: 2 / 1), (min-resolution: 2dppx), (min-resolution: 128dpcm) { .b { background: red; } @@ -185,20 +187,22 @@ @media (max-width: 1000px) { .body { background: red; - background: blue; } -} -@media (max-width: 1000px) and (max-width: 500px) { + @media (max-width: 500px) { + .body { + background: green; + } + } .body { - background: green; + background: blue; } } @media (max-width: 1200px) { /* a comment */ -} -@media (max-width: 1200px) and (max-width: 900px) { - .body { - font-size: 11px; + @media (max-width: 900px) { + .body { + font-size: 11px; + } } } @media (min-width: 480px) { @@ -206,17 +210,19 @@ display: table-cell; } } -@media (min-width: 768px) and (min-width: 480px) { +@media (min-width: 768px) { +@media (min-width: 480px) { .menu > li { display: table-cell; } } +} @media all and (tv) { .all-and-tv-variables { var: all-and-tv; } } -@media screen and (min-width: 61px) { +@media screen and (min-width: (60px + 1)) { .selector { foo: bar; } @@ -269,3 +275,13 @@ color: red; } } +@media screen and (max-width: 1280px) { + .form-process-table { + color: red; + } +} +@media ((color) and (hover)), all { + body { + background: green; + } +} diff --git a/packages/test-data/tests-unit/media/media.less b/packages/test-data/tests-unit/media/media.less index c49cd88606..17a7505e2c 100644 --- a/packages/test-data/tests-unit/media/media.less +++ b/packages/test-data/tests-unit/media/media.less @@ -1,5 +1,3 @@ -// For now, variables can't be declared inside @media blocks. - @var: 42; @media print { @@ -107,7 +105,7 @@ .mediaMixin(); } @smartphone: ~"only screen and (max-width: 200px)"; -@media @smartphone { +@media @{smartphone} { .body { width: 480px; } @@ -226,7 +224,7 @@ } @all: ~"all"; @tv: ~"(tv)"; -@media @all and @tv { +@media @{all} and @{tv} { .all-and-tv-variables { var: all-and-tv; } @@ -296,3 +294,15 @@ color: red; } } + +.form-process-table { + @media screen and(max-width: 1280px) { + color: red; + } +} + +@media ((color) and (hover)), all { + body { + background: green; + } +} diff --git a/packages/test-data/tests-unit/media/styles.config.cjs b/packages/test-data/tests-unit/media/styles.config.cjs new file mode 100644 index 0000000000..6f53ead8d8 --- /dev/null +++ b/packages/test-data/tests-unit/media/styles.config.cjs @@ -0,0 +1,5 @@ +module.exports = { + output: { + collapseNesting: true + } +}; \ No newline at end of file diff --git a/packages/test-data/tests-unit/merge/merge.css b/packages/test-data/tests-unit/merge/merge.css index e02ff63004..ba31555557 100644 --- a/packages/test-data/tests-unit/merge/merge.css +++ b/packages/test-data/tests-unit/merge/merge.css @@ -22,12 +22,12 @@ transform: scale(2, 4), scale(2, 4), scale(2, 4) !important; } .test-rule-interleaved { - transform: t1, t2, t3; background: b1, b2, b3; + transform: t1, t2, t3; } .test-rule-spaced { - transform: t1 t2 t3; background: b1 b2, b3; + transform: t1 t2 t3; } .test-rule-interleaved-with-spaced { transform: t1s, t2 t3s, t4 t5s t6s; diff --git a/packages/test-data/tests-unit/mixin-noparens/legacy/mixin-noparens.css b/packages/test-data/tests-unit/mixin-noparens/legacy/mixin-noparens.css new file mode 100644 index 0000000000..60e92f2817 --- /dev/null +++ b/packages/test-data/tests-unit/mixin-noparens/legacy/mixin-noparens.css @@ -0,0 +1,10 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +#theme > .mixin { + background-color: grey; +} +#container { + color: black; + background-color: grey; +} diff --git a/packages/test-data/tests-unit/mixin-noparens/mixin-noparens.css b/packages/test-data/tests-unit/mixin-noparens/mixin-noparens.css index 97b6b5e03a..2a76c65beb 100644 --- a/packages/test-data/tests-unit/mixin-noparens/mixin-noparens.css +++ b/packages/test-data/tests-unit/mixin-noparens/mixin-noparens.css @@ -1,5 +1,7 @@ -#theme > .mixin { - background-color: grey; +#theme { + > .mixin { + background-color: grey; + } } #container { color: black; diff --git a/packages/test-data/tests-unit/mixin-noparens/styles.config.ts b/packages/test-data/tests-unit/mixin-noparens/styles.config.ts new file mode 100644 index 0000000000..774aec3bfc --- /dev/null +++ b/packages/test-data/tests-unit/mixin-noparens/styles.config.ts @@ -0,0 +1,5 @@ +export default { + output: [ + { file: '{name}.css', collapseNesting: false } + ] +} diff --git a/packages/test-data/tests-unit/mixins-closure/legacy/mixins-closure.css b/packages/test-data/tests-unit/mixins-closure/legacy/mixins-closure.css new file mode 100644 index 0000000000..220c34e0a6 --- /dev/null +++ b/packages/test-data/tests-unit/mixins-closure/legacy/mixins-closure.css @@ -0,0 +1,12 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.class { + width: 99px; +} +.overwrite { + width: 99px; +} +.nested .class { + width: 5px; +} diff --git a/packages/test-data/tests-unit/mixins-closure/mixins-closure.css b/packages/test-data/tests-unit/mixins-closure/mixins-closure.css index b1021b6fb6..37c9b65aff 100644 --- a/packages/test-data/tests-unit/mixins-closure/mixins-closure.css +++ b/packages/test-data/tests-unit/mixins-closure/mixins-closure.css @@ -4,6 +4,8 @@ .overwrite { width: 99px; } -.nested .class { - width: 5px; +.nested { + .class { + width: 5px; + } } diff --git a/packages/test-data/tests-unit/mixins-closure/styles.config.ts b/packages/test-data/tests-unit/mixins-closure/styles.config.ts new file mode 100644 index 0000000000..774aec3bfc --- /dev/null +++ b/packages/test-data/tests-unit/mixins-closure/styles.config.ts @@ -0,0 +1,5 @@ +export default { + output: [ + { file: '{name}.css', collapseNesting: false } + ] +} diff --git a/packages/test-data/tests-unit/mixins-guards-default-func/legacy/mixins-guards-default-func.css b/packages/test-data/tests-unit/mixins-guards-default-func/legacy/mixins-guards-default-func.css new file mode 100644 index 0000000000..df3b3ebcf5 --- /dev/null +++ b/packages/test-data/tests-unit/mixins-guards-default-func/legacy/mixins-guards-default-func.css @@ -0,0 +1,132 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +guard-default-basic-1-1 { + case: 1; +} +guard-default-basic-1-2 { + default: 2; +} +guard-default-basic-2-0 { + default: 0; +} +guard-default-basic-2-2 { + case: 2; +} +guard-default-basic-3-0 { + default: 0; +} +guard-default-basic-3-2 { + case: 2; +} +guard-default-basic-3-3 { + case: 3; +} +guard-default-definition-order-0 { + default: 0; +} +guard-default-definition-order-2 { + case: 2; +} +guard-default-definition-order-2 { + case: 3; +} +guard-default-out-of-guard-0 { + case-0: default(); + case-1: 1; + default: 2; + case-2: default(); +} +guard-default-out-of-guard-1 { + default: default(); +} +guard-default-out-of-guard-2 { + default: default(); +} +guard-default-expr-not-1 { + case: 1; + default: 1; +} +guard-default-expr-eq-true { + case: true; +} +guard-default-expr-eq-false { + case: false; + default: false; +} +guard-default-expr-or-1 { + case: 1; +} +guard-default-expr-or-2 { + case: 2; + default: 2; +} +guard-default-expr-or-3 { + default: 3; +} +guard-default-expr-and-1 { + case: 1; +} +guard-default-expr-and-2 { + case: 2; +} +guard-default-expr-and-3 { + default: 3; +} +guard-default-expr-always-1 { + case: 1; + default: 1; +} +guard-default-expr-always-2 { + default: 2; +} +guard-default-expr-never-1 { + case: 1; +} +guard-default-multi-1-0 { + case: 0; +} +guard-default-multi-1-1 { + default-1: 1; +} +guard-default-multi-2-1 { + default-1: no; +} +guard-default-multi-2-2 { + default-2: no; +} +guard-default-multi-2-3 { + default-3: 3; +} +guard-default-multi-3-blue { + case-2: darkblue; +} +guard-default-multi-3-green { + default-color: green; +} +guard-default-multi-3-foo { + case-1: I am 'foo'; +} +guard-default-multi-3-baz { + default-string: I am 'baz'; +} +guard-default-multi-4 { + always: 1; + always: 2; + case: 2; +} +guard-default-not-ambiguous-2 { + case: 1; + not-default: 2; +} +guard-default-not-ambiguous-3 { + case: 1; + not-default-1: 2; + not-default-2: 2; +} +guard-default-scopes-3 { + three: when default; +} +guard-default-scopes-1 { + one: no condition; +} diff --git a/packages/test-data/tests-unit/mixins-guards-default-func/mixins-guards-default-func.css b/packages/test-data/tests-unit/mixins-guards-default-func/mixins-guards-default-func.css index 3a11c65721..1aaaeb6716 100644 --- a/packages/test-data/tests-unit/mixins-guards-default-func/mixins-guards-default-func.css +++ b/packages/test-data/tests-unit/mixins-guards-default-func/mixins-guards-default-func.css @@ -24,8 +24,6 @@ guard-default-definition-order-0 { } guard-default-definition-order-2 { case: 2; -} -guard-default-definition-order-2 { case: 3; } guard-default-out-of-guard-0 { diff --git a/packages/test-data/tests-unit/mixins-guards/legacy/mixins-guards.css b/packages/test-data/tests-unit/mixins-guards/legacy/mixins-guards.css new file mode 100644 index 0000000000..323417ef61 --- /dev/null +++ b/packages/test-data/tests-unit/mixins-guards/legacy/mixins-guards.css @@ -0,0 +1,214 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.light1 { + color: inherit; + margin: 1px; +} +.light2 { + color: black; + margin: 1px; +} +.max1 { + width: 6; +} +.max2 { + width: 8; +} +.glob1 { + margin: auto auto; +} +.ops1 { + height: gt-or-eq; + height: lt-or-eq; + height: lt-or-eq-alias; +} +.ops2 { + height: gt-or-eq; + height: not-eq; +} +.ops3 { + height: lt-or-eq; + height: lt-or-eq-alias; + height: not-eq; +} +.default1 { + content: default; +} +.test-rule1 { + content: "true."; +} +.test-rule2 { + content: "false."; +} +.test-rule3 { + content: "false."; +} +.test-rule4 { + content: "false."; +} +.test-rule5 { + content: "false."; +} +.bool1 { + content: true and true; + content: true; + content: false, true; + content: false and true and true, true; + content: false, true and true; + content: false, false, true; + content: false, true and true and true, false; + content: not false; + content: not false and false, not false; +} +.equality-units { + test: pass; +} +.colorguardtest { + content: is red; + content: is not blue its red; + content: is not blue its purple; +} +.stringguardtest { + content: "theme1" is "theme1"; + content: "theme1" is not "theme2"; + content: "theme1" is 'theme1'; + content: "theme1" is not 'theme2'; + content: 'theme1' is "theme1"; + content: 'theme1' is not "theme2"; + content: 'theme1' is 'theme1'; + content: 'theme1' is not 'theme2'; + content: theme1 is not "theme2"; + content: theme1 is not 'theme2'; + content: theme1 is theme1; +} +.variouse-types-comparison { + /**/ + content: true is not equal to false; + content: false is not equal to true too; + /**/ + content: 1 is not equal to true; + content: true is not equal to 1 too; + /**/ + content: 2 is equal to 2px; + content: 2px is equal to 2 too; + /**/ + content: 3 is equal to 3; + content: 3 is equal to 3 too; + /**/ + content: 5 is not equal to 4; + content: 4 is not equal to 5 too; + /**/ + content: abc is equal to abc; + content: abc is equal to abc too; + /**/ + content: abc is not equal to "abc"; + content: "abc" is not equal to abc too; + /**/ + content: 'abc' is less than "abd"; + content: "abd" is greater than 'abc' too; + content: 'abc' is not equal to "abd"; + content: "abd" is not equal to 'abc' too; + /**/ + content: 6 is equal to 6; + content: 6 is equal to 6 too; + /**/ + content: 8 is less than 9 too; + content: 9 is greater than 8; + content: 9 is not equal to 8; + content: 8 is not equal to 9 too; + /**/ + content: a is not equal to b; + content: b is not equal to a too; + /**/ + content: 1 2 is not equal to 3; + content: 3 is not equal to 1 2 too; +} +.list-comparison { + /**/ + content: a b c is equal to a b c; + content: a b c is equal to a b c too; + /**/ + content: a b c is not equal to a b d; + content: a b d is not equal to a b c too; + /**/ + content: a, b, c is equal to a, b, c; + content: a, b, c is equal to a, b, c too; + /**/ + content: a, b, c is not equal to a, b, d; + content: a, b, d is not equal to a, b, c too; + /**/ + content: 1 2px 300ms is equal to 1em 2 0.3s; + content: 1em 2 0.3s is equal to 1 2px 300ms too; + /**/ + content: 1 2 3 is not equal to 1, 2, 3; + content: 1, 2, 3 is not equal to 1 2 3 too; + /**/ + content: 1, 2, 3 is equal to 1, 2, 3; + content: 1, 2, 3 is equal to 1, 2, 3 too; + /**/ + content: 1 2 3 1, 2, 3 is equal to 1 2 3 1, 2, 3; + content: 1 2 3 1, 2, 3 is equal to 1 2 3 1, 2, 3 too; + /**/ + content: 1 2 3 1, 2, 3 is not equal to 1, 2, 3 1 2 3; + content: 1, 2, 3 1 2 3 is not equal to 1 2 3 1, 2, 3 too; + /**/ + content: 1 2 3 1, 2, 3 4 is equal to 1 2 3 1, 2, 3 4; + content: 1 2 3 1, 2, 3 4 is equal to 1 2 3 1, 2, 3 4 too; +} +#tryNumberPx { + catch: all; + declare: 4; + declare: 4px; +} +.call-lock-mixin .call-inner-lock-mixin { + a: 1; + x: 1; +} +.mixin-generated-class { + a: 1; +} +#guarded-caller { + guarded: namespace; + silent: namespace; + guarded: with default; +} +#guarded-deeper { + should: match 1; +} +#parenthesisNot-true { + parenthesisNot: just-value; + parenthesisNot: negated twice 1; + parenthesisNot: negated twice 2; + parenthesisNot: negated twice 3; +} +#parenthesisNot-false { + parenthesisNot: negated once inside; + parenthesisNot: negated once outside; + parenthesisNot: negated once middle; +} +#orderOfEvaluation-false-false-true { + no-parenthesis: evaluated true 1a; + no-parenthesis: evaluated true 1b; + no-parenthesis: evaluated true 1d; + no-parenthesis: evaluated true 3; + no-parenthesis: evaluated true 4; + with-parenthesis: evaluated true; +} +#orderOfEvaluation-false-false-false { + no-parenthesis: evaluated true 2a; + no-parenthesis: evaluated true 2b; + no-parenthesis: evaluated true 2c; +} +#orderOfEvaluation-true-true-false { + no-parenthesis: evaluated true 1a; + no-parenthesis: evaluated true 1b; + no-parenthesis: evaluated true 1c; + no-parenthesis: evaluated true 1d; + no-parenthesis: evaluated true 1e; + no-parenthesis: evaluated true 2a; + no-parenthesis: evaluated true 2b; + no-parenthesis: evaluated true 2c; + no-parenthesis: evaluated true 4; + with-parenthesis: evaluated true; +} diff --git a/packages/test-data/tests-unit/mixins-guards/mixins-guards.css b/packages/test-data/tests-unit/mixins-guards/mixins-guards.css index c54eca77eb..db34d1f5f3 100644 --- a/packages/test-data/tests-unit/mixins-guards/mixins-guards.css +++ b/packages/test-data/tests-unit/mixins-guards/mixins-guards.css @@ -158,9 +158,11 @@ declare: 4; declare: 4px; } -.call-lock-mixin .call-inner-lock-mixin { - a: 1; - x: 1; +.call-lock-mixin { + .call-inner-lock-mixin { + a: 1; + x: 1; + } } .mixin-generated-class { a: 1; @@ -209,3 +211,9 @@ no-parenthesis: evaluated true 4; with-parenthesis: evaluated true; } +.test-not-noparens1 { + content: "not without parens true."; +} +.test-not-noparens2 { + content: "not without parens false."; +} diff --git a/packages/test-data/tests-unit/mixins-guards/mixins-guards.less b/packages/test-data/tests-unit/mixins-guards/mixins-guards.less index 834c57d2cf..db45c5bf98 100644 --- a/packages/test-data/tests-unit/mixins-guards/mixins-guards.less +++ b/packages/test-data/tests-unit/mixins-guards/mixins-guards.less @@ -356,3 +356,13 @@ .orderOfEvaluation(true, true, false); } +// not without parentheses should work the same as not with parentheses +.test-not-noparens (@a) when not @a { + content: "not without parens false."; +} +.test-not-noparens (@a) when (@a) { + content: "not without parens true."; +} + +.test-not-noparens1 { .test-not-noparens(true) } +.test-not-noparens2 { .test-not-noparens(false) } diff --git a/packages/test-data/tests-unit/mixins-guards/styles.config.ts b/packages/test-data/tests-unit/mixins-guards/styles.config.ts new file mode 100644 index 0000000000..774aec3bfc --- /dev/null +++ b/packages/test-data/tests-unit/mixins-guards/styles.config.ts @@ -0,0 +1,5 @@ +export default { + output: [ + { file: '{name}.css', collapseNesting: false } + ] +} diff --git a/packages/test-data/tests-unit/mixins-important/mixins-important.css b/packages/test-data/tests-unit/mixins-important/mixins-important.css index 3d53d431c0..482f772f82 100644 --- a/packages/test-data/tests-unit/mixins-important/mixins-important.css +++ b/packages/test-data/tests-unit/mixins-important/mixins-important.css @@ -1,48 +1,62 @@ .class { border: 1; boxer: 1; +} +.class .inner { + test: 1; +} +.class { border-width: 1; border: 2 !important; boxer: 2 !important; +} +.class .inner { + test: 2 !important; +} +.class { border-width: 2 !important; border: 3; boxer: 3; +} +.class .inner { + test: 3; +} +.class { border-width: 3; border: 4 !important; boxer: 4 !important; +} +.class .inner { + test: 4 !important; +} +.class { border-width: 4 !important; border: 5; boxer: 5; +} +.class .inner { + test: 5; +} +.class { border-width: 5; border: 0 !important; boxer: 0 !important; +} +.class .inner { + test: 0 !important; +} +.class { border-width: 0 !important; border: 9 !important; border: 9; boxer: 9; - border-width: 9; -} -.class .inner { - test: 1; -} -.class .inner { - test: 2 !important; -} -.class .inner { - test: 3; -} -.class .inner { - test: 4 !important; -} -.class .inner { - test: 5; -} -.class .inner { - test: 0 !important; } .class .inner { test: 9; } +.class { + border-width: 9; +} .when-calling-nested-issue-2394 { width: auto !important; } diff --git a/packages/test-data/tests-unit/mixins-interpolated/legacy/mixins-interpolated.css b/packages/test-data/tests-unit/mixins-interpolated/legacy/mixins-interpolated.css new file mode 100644 index 0000000000..83fc2c9e33 --- /dev/null +++ b/packages/test-data/tests-unit/mixins-interpolated/legacy/mixins-interpolated.css @@ -0,0 +1,42 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.\123 { + a: 0; +} +.foo { + a: 1; + a: 2; +} +#foo { + a: 3; + a: 4; +} +mi-test-a { + a: 0; + a: 1; + a: 2; + a: 3; + a: 4; +} +.b .bb.foo-xxx .yyy-foo#foo .foo.bbb { + b: 1; +} +mi-test-b { + b: 1; +} +#foo-foo > .bar .baz { + c: c; +} +mi-test-c-1 > .bar .baz { + c: c; +} +mi-test-c-2 .baz { + c: c; +} +mi-test-c-3 { + c: c; +} +mi-test-d { + gender: "Male"; +} diff --git a/packages/test-data/tests-unit/mixins-interpolated/mixins-interpolated.css b/packages/test-data/tests-unit/mixins-interpolated/mixins-interpolated.css index 9a87c35f98..0a9f6c00d2 100644 --- a/packages/test-data/tests-unit/mixins-interpolated/mixins-interpolated.css +++ b/packages/test-data/tests-unit/mixins-interpolated/mixins-interpolated.css @@ -3,14 +3,10 @@ } .foo { a: 1; -} -.foo { a: 2; } #foo { a: 3; -} -#foo { a: 4; } mi-test-a { @@ -20,20 +16,34 @@ mi-test-a { a: 3; a: 4; } -.b .bb.foo-xxx .yyy-foo#foo .foo.bbb { - b: 1; +.b .bb { + &.foo-xxx .yyy-foo#foo { + & .foo.bbb { + b: 1; + } + } } mi-test-b { b: 1; } -#foo-foo > .bar .baz { - c: c; -} -mi-test-c-1 > .bar .baz { - c: c; -} -mi-test-c-2 .baz { - c: c; +#foo-foo { + > .bar { + .baz { + c: c; + } + } +} +mi-test-c-1 { + > .bar { + .baz { + c: c; + } + } +} +mi-test-c-2 { + .baz { + c: c; + } } mi-test-c-3 { c: c; diff --git a/packages/test-data/tests-unit/mixins-interpolated/styles.config.ts b/packages/test-data/tests-unit/mixins-interpolated/styles.config.ts new file mode 100644 index 0000000000..774aec3bfc --- /dev/null +++ b/packages/test-data/tests-unit/mixins-interpolated/styles.config.ts @@ -0,0 +1,5 @@ +export default { + output: [ + { file: '{name}.css', collapseNesting: false } + ] +} diff --git a/packages/test-data/tests-unit/mixins-named-args/mixins-named-args.css b/packages/test-data/tests-unit/mixins-named-args/mixins-named-args.css index e460aa104e..25251b4006 100644 --- a/packages/test-data/tests-unit/mixins-named-args/mixins-named-args.css +++ b/packages/test-data/tests-unit/mixins-named-args/mixins-named-args.css @@ -25,3 +25,9 @@ height: 29%; color: #123456; } +.arity-positional { + value: 3; +} +.arity-named { + value: 4; +} diff --git a/packages/test-data/tests-unit/mixins-named-args/mixins-named-args.less b/packages/test-data/tests-unit/mixins-named-args/mixins-named-args.less index f62dc86a2d..450c2aea54 100644 --- a/packages/test-data/tests-unit/mixins-named-args/mixins-named-args.less +++ b/packages/test-data/tests-unit/mixins-named-args/mixins-named-args.less @@ -34,3 +34,18 @@ .named-args3 { .mixin2(@b: 30%, @c: #123456); } + +.arity-mixin(@a) { + value: @a; +} +.arity-mixin(@a: 1, @b) { + value: @a + @b; +} + +.arity-positional { + .arity-mixin(3); +} + +.arity-named { + .arity-mixin(@b: 3); +} diff --git a/packages/test-data/tests-unit/mixins-nested/legacy/mixins-nested.css b/packages/test-data/tests-unit/mixins-nested/legacy/mixins-nested.css new file mode 100644 index 0000000000..1b05225c9f --- /dev/null +++ b/packages/test-data/tests-unit/mixins-nested/legacy/mixins-nested.css @@ -0,0 +1,17 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.class .inner { + height: 300; +} +.class .inner .innest { + width: 30; + border-width: 60; +} +.class2 .inner { + height: 600; +} +.class2 .inner .innest { + width: 60; + border-width: 120; +} diff --git a/packages/test-data/tests-unit/mixins-nested/mixins-nested.css b/packages/test-data/tests-unit/mixins-nested/mixins-nested.css index 6378c47561..be0a14e617 100644 --- a/packages/test-data/tests-unit/mixins-nested/mixins-nested.css +++ b/packages/test-data/tests-unit/mixins-nested/mixins-nested.css @@ -1,14 +1,18 @@ -.class .inner { - height: 300; +.class { + .inner { + height: 300; + .innest { + width: 30; + border-width: 60; + } + } } -.class .inner .innest { - width: 30; - border-width: 60; -} -.class2 .inner { - height: 600; -} -.class2 .inner .innest { - width: 60; - border-width: 120; +.class2 { + .inner { + height: 600; + .innest { + width: 60; + border-width: 120; + } + } } diff --git a/packages/test-data/tests-unit/mixins-nested/styles.config.ts b/packages/test-data/tests-unit/mixins-nested/styles.config.ts new file mode 100644 index 0000000000..774aec3bfc --- /dev/null +++ b/packages/test-data/tests-unit/mixins-nested/styles.config.ts @@ -0,0 +1,5 @@ +export default { + output: [ + { file: '{name}.css', collapseNesting: false } + ] +} diff --git a/packages/test-data/tests-unit/mixins/legacy/maps.css b/packages/test-data/tests-unit/mixins/legacy/maps.css new file mode 100644 index 0000000000..3c8977a993 --- /dev/null +++ b/packages/test-data/tests-unit/mixins/legacy/maps.css @@ -0,0 +1,9 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.maps h2 { + width: 10px; +} +.maps h1 { + color: white; +} diff --git a/packages/test-data/tests-unit/mixins/v5/mixins.css b/packages/test-data/tests-unit/mixins/legacy/mixins.css similarity index 93% rename from packages/test-data/tests-unit/mixins/v5/mixins.css rename to packages/test-data/tests-unit/mixins/legacy/mixins.css index ce0fbe9441..4f3eafa22d 100644 --- a/packages/test-data/tests-unit/mixins/v5/mixins.css +++ b/packages/test-data/tests-unit/mixins/legacy/mixins.css @@ -1,3 +1,6 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + .mixin { border: 1px solid black; } @@ -33,6 +36,9 @@ border: 1px solid black; background-color: grey; } +#header #cookie { + border-style: dashed; +} #header #cookie .chips { border-style: dotted; } @@ -42,9 +48,6 @@ border-color: orange; background-color: grey; } -#header #cookie { - border-style: dashed; -} .secure-zone { color: transparent; } @@ -78,6 +81,8 @@ border: 1px; background: none; color: orange; + top: 0px; + height: auto; } .extended .higher { top: 0px; @@ -85,10 +90,6 @@ .extended.deeper { height: auto; } -.extended { - top: 0px; - height: auto; -} .do .re .mi .fa .sol .la .si { color: cyan; } @@ -143,4 +144,4 @@ h3 + * { } .button.large { padding-left: 40em; -} \ No newline at end of file +} diff --git a/packages/test-data/tests-unit/mixins/maps.css b/packages/test-data/tests-unit/mixins/maps.css index bf1162832d..d0dd42016c 100644 --- a/packages/test-data/tests-unit/mixins/maps.css +++ b/packages/test-data/tests-unit/mixins/maps.css @@ -1,6 +1,8 @@ -.maps h2 { - width: 10px; -} -.maps h1 { - color: white; +.maps { + h2 { + width: 10px; + } + h1 { + color: white; + } } diff --git a/packages/test-data/tests-unit/mixins/mixins.css b/packages/test-data/tests-unit/mixins/mixins.css index c9087c0a70..a94d8f8316 100644 --- a/packages/test-data/tests-unit/mixins/mixins.css +++ b/packages/test-data/tests-unit/mixins/mixins.css @@ -33,9 +33,6 @@ border: 1px solid black; background-color: grey; } -#header #cookie { - border-style: dashed; -} #header #cookie .chips { border-style: dotted; } @@ -45,6 +42,9 @@ border-color: orange; background-color: grey; } +#header #cookie { + border-style: dashed; +} .secure-zone { color: transparent; } @@ -78,8 +78,6 @@ border: 1px; background: none; color: orange; - top: 0px; - height: auto; } .extended .higher { top: 0px; @@ -87,6 +85,10 @@ .extended.deeper { height: auto; } +.extended { + top: 0px; + height: auto; +} .do .re .mi .fa .sol .la .si { color: cyan; } @@ -142,3 +144,11 @@ h3 + * { .button.large { padding-left: 40em; } +.rest-forwarding-empty { + a: 1; + b: fallback; +} +.rest-forwarding-filled { + a: 1; + b: 2; +} diff --git a/packages/test-data/tests-unit/mixins/mixins.less b/packages/test-data/tests-unit/mixins/mixins.less index bdd055cf22..71b1f3d9b7 100644 --- a/packages/test-data/tests-unit/mixins/mixins.less +++ b/packages/test-data/tests-unit/mixins/mixins.less @@ -143,3 +143,19 @@ h3 { .margin_between(15px, 5px); } .foo { .clearfix(); } + +// Forwarding an unset variadic must fall through to the callee's default, +// not pass an empty argument that overrides it (issue #4352). +.rest-forward(@a, @rest...) { + .rest-target(@a, @rest); +} +.rest-target(@a, @b: fallback) { + a: @a; + b: @b; +} +.rest-forwarding-empty { + .rest-forward(1); +} +.rest-forwarding-filled { + .rest-forward(1, 2); +} diff --git a/packages/test-data/tests-unit/mixins/styles.config.cjs b/packages/test-data/tests-unit/mixins/styles.config.cjs deleted file mode 100644 index 89984413b6..0000000000 --- a/packages/test-data/tests-unit/mixins/styles.config.cjs +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - output: [ - { - collapseNesting: true - }, - { - file: 'v5/mixins.css' - } - ] -}; \ No newline at end of file diff --git a/packages/test-data/tests-unit/mixins/styles.config.ts b/packages/test-data/tests-unit/mixins/styles.config.ts new file mode 100644 index 0000000000..774aec3bfc --- /dev/null +++ b/packages/test-data/tests-unit/mixins/styles.config.ts @@ -0,0 +1,5 @@ +export default { + output: [ + { file: '{name}.css', collapseNesting: false } + ] +} diff --git a/packages/test-data/tests-unit/nesting/legacy/nesting.css b/packages/test-data/tests-unit/nesting/legacy/nesting.css new file mode 100644 index 0000000000..bb5c07c2ef --- /dev/null +++ b/packages/test-data/tests-unit/nesting/legacy/nesting.css @@ -0,0 +1,27 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.nesting-parent { + color: red; +} +.nesting-parent .nesting-child { + color: blue; +} +.nesting-parent .nesting-child .nesting-grandchild { + color: green; +} +.nesting-parent:hover { + color: orange; +} +.nesting-parent.modifier { + color: purple; +} +.correctly-exit-calc-mode h2 { + width: 10px; +} +.correctly-exit-calc-mode div { + width: calc(100px * 2); +} +.correctly-exit-calc-mode h1 { + color: white; +} diff --git a/packages/test-data/tests-unit/nesting/nesting-uncollapsed.css b/packages/test-data/tests-unit/nesting/nesting-uncollapsed.css new file mode 100644 index 0000000000..f5af04aaef --- /dev/null +++ b/packages/test-data/tests-unit/nesting/nesting-uncollapsed.css @@ -0,0 +1,26 @@ +.nesting-parent { + color: red; + .nesting-child { + color: blue; + .nesting-grandchild { + color: green; + } + } + &:hover { + color: orange; + } + &.modifier { + color: purple; + } +} +.correctly-exit-calc-mode { + h2 { + width: 10px; + } + div { + width: 200px; + } + h1 { + color: white; + } +} diff --git a/packages/test-data/tests-unit/nesting/nesting.css b/packages/test-data/tests-unit/nesting/nesting.css index 732dd563ee..bec6c5bfbf 100644 --- a/packages/test-data/tests-unit/nesting/nesting.css +++ b/packages/test-data/tests-unit/nesting/nesting.css @@ -17,7 +17,7 @@ width: 10px; } .correctly-exit-calc-mode div { - width: calc(100px * 2); + width: 200px; } .correctly-exit-calc-mode h1 { color: white; diff --git a/packages/test-data/tests-unit/nesting/styles.config.ts b/packages/test-data/tests-unit/nesting/styles.config.ts new file mode 100644 index 0000000000..80c30e3a96 --- /dev/null +++ b/packages/test-data/tests-unit/nesting/styles.config.ts @@ -0,0 +1,6 @@ +export default { + output: [ + { file: '{name}.css', collapseNesting: true }, + { file: '{name}-uncollapsed.css', collapseNesting: false } + ] +}; diff --git a/packages/test-data/tests-unit/operations/operations.css b/packages/test-data/tests-unit/operations/operations.css index 61ce933f83..e10863c9ee 100644 --- a/packages/test-data/tests-unit/operations/operations.css +++ b/packages/test-data/tests-unit/operations/operations.css @@ -3,13 +3,15 @@ color-2: #f8f800; height: 9px; width: 3em; - subtraction: 0; - division: 1; } #operations .spacing { height: 9px; width: 3em; } +#operations { + subtraction: 0; + division: 1; +} .with-variables { height: 16em; width: 24em; diff --git a/packages/test-data/tests-unit/parse-interpolation/legacy/parse-interpolation.css b/packages/test-data/tests-unit/parse-interpolation/legacy/parse-interpolation.css new file mode 100644 index 0000000000..42376f3814 --- /dev/null +++ b/packages/test-data/tests-unit/parse-interpolation/legacy/parse-interpolation.css @@ -0,0 +1,39 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +input[type=text]:focus, +input[type=email]:focus, +input[type=password]:focus, +textarea:focus { + foo: bar; +} +.a + .z, +.b + .z, +.c + .z { + color: blue; +} +.bar .d.a, +.bar .b, +.c.bar:hover, +.bar baz { + color: blue; +} +.a + .e, +.b.c + .e, +.d + .e { + foo: bar; +} +input[class="text"], +input.text { + background: red; +} +.master-page-1 .selector-1, +.master-page-1 .selector-2 { + background-color: red; +} +.fruit-apple, +.fruit-satsuma, +.fruit-banana, +.fruit-pear { + content: "Just a test."; +} diff --git a/packages/test-data/tests-unit/parse-interpolation/parse-interpolation.css b/packages/test-data/tests-unit/parse-interpolation/parse-interpolation.css index 21122d72e6..2ad602d034 100644 --- a/packages/test-data/tests-unit/parse-interpolation/parse-interpolation.css +++ b/packages/test-data/tests-unit/parse-interpolation/parse-interpolation.css @@ -1,36 +1,73 @@ -input[type=text]:focus, -input[type=email]:focus, -input[type=password]:focus, -textarea:focus { - foo: bar; -} -.a + .z, -.b + .z, -.c + .z { - color: blue; -} -.bar .d.a, -.bar .b, -.c.bar:hover, -.bar baz { - color: blue; -} -.a + .e, -.b.c + .e, -.d + .e { - foo: bar; -} -input[class="text"], -input.text { - background: red; -} -.master-page-1 .selector-1, -.master-page-1 .selector-2 { - background-color: red; -} -.fruit-apple, -.fruit-satsuma, -.fruit-banana, -.fruit-pear { - content: "Just a test."; +input[type=text], +input[type=email], +input[type=password], +textarea { + &:focus { + foo: bar; + } +} +input[type=text], input[type=email], input[type=password], textarea { + &:focus { + foo: baz; + } +} +.a, +.b, +.c { + + .z-cap { + color: blue; + } +} +.a, .b, .c { + + .z-quoted { + color: green; + } +} +.bar { + .d:is(.a, .b, .c)&:hover, baz-cap { + color: blue; + } +} +.bar2 { + .q:is(.a, .b, .c)&:hover, baz-quoted { + color: green; + } +} +:is(.a, .b):is(.c, .d) { + + .e-cap { + foo: bar; + } +} +:is(.a, .b):is(.c, .d) { + + .e-quoted { + foo: bar; + } +} +input.cap { + &[class="text"], + &.text { + background: red; + } +} +input.quoted { + &[class="text"], &.text { + background: blue; + } +} +.master-page-cap { + .selector-1, + .selector-2 { + background-color: red; + } +} +.master-page-quoted { + .selector-1, .selector-2 { + background-color: blue; + } +} +.fruit-cap-apple, +.fruit-cap-satsuma, +.fruit-cap-banana, +.fruit-cap-pear { + content: "Capture"; } diff --git a/packages/test-data/tests-unit/parse-interpolation/parse-interpolation.less b/packages/test-data/tests-unit/parse-interpolation/parse-interpolation.less index 36ad08d271..c6526906ef 100644 --- a/packages/test-data/tests-unit/parse-interpolation/parse-interpolation.less +++ b/packages/test-data/tests-unit/parse-interpolation/parse-interpolation.less @@ -1,54 +1,102 @@ // Parse interpolation tests -@inputs: input[type=text], input[type=email], input[type=password], textarea; +// Paired variants: selector-capture (`*[]`) and quoted selectors (`~'...'`). -@{inputs} { +@inputs-cap: *[input[type=text], input[type=email], input[type=password], textarea]; +@inputs-quoted: ~'input[type=text], input[type=email], input[type=password], textarea'; + +@{inputs-cap} { &:focus { foo: bar; } -} +} -@classes: .a, .b, .c; +@{inputs-quoted} { + &:focus { + foo: baz; + } +} + +@classes-cap: *[.a, .b, .c]; +@classes-quoted: ~'.a, .b, .c'; -@{classes} { - + .z { - color: blue; +@{classes-cap} { + + .z-cap { + color: blue; + } +} + +@{classes-quoted} { + + .z-quoted { + color: green; } } .bar { - .d@{classes}&:hover, baz { + .d@{classes-cap}&:hover, baz-cap { color: blue; } } -@c: ~'.a, .b'; -@d: ~'.c, .d'; -@e: ~' + .e'; +.bar2 { + .q@{classes-quoted}&:hover, baz-quoted { + color: green; + } +} + +@c-cap: *[.a, .b]; +@d-cap: *[.c, .d]; +@e-cap: ~' + .e-cap'; -@{c}@{d} { - @{e} { +@{c-cap}@{d-cap} { + @{e-cap} { foo: bar; } } -@textClasses: ~'&[class="text"], &.text'; +@c-quoted: ~'.a, .b'; +@d-quoted: ~'.c, .d'; +@e-quoted: ~' + .e-quoted'; -input { - @{textClasses} { +@{c-quoted}@{d-quoted} { + @{e-quoted} { + foo: baz; + } +} + +@textClasses-cap: *[&[class="text"], &.text]; +@textClasses-quoted: ~'&[class="text"], &.text'; + +input.cap { + @{textClasses-cap} { background: red; } } -@my-selector: ~'.selector-1, .selector-2'; -.master-page-1 { - @{my-selector} { - background-color: red; - } +input.quoted { + @{textClasses-quoted} { + background: blue; + } } -@list: apple, satsuma, banana, pear; -@{list} { - .fruit-& { - content: "Just a test."; +@my-selector-cap: *[.selector-1, .selector-2]; +@my-selector-quoted: ~'.selector-1, .selector-2'; + +.master-page-cap { + @{my-selector-cap} { + background-color: red; + } +} + +.master-page-quoted { + @{my-selector-quoted} { + background-color: blue; + } +} + +@list-cap: *[apple, satsuma, banana, pear]; + +@{list-cap} { + .fruit-cap-& { + content: "Capture"; } } diff --git a/packages/test-data/tests-unit/parse-interpolation/styles.config.ts b/packages/test-data/tests-unit/parse-interpolation/styles.config.ts new file mode 100644 index 0000000000..7caa063ccc --- /dev/null +++ b/packages/test-data/tests-unit/parse-interpolation/styles.config.ts @@ -0,0 +1,5 @@ +export default { + output: { + collapseNesting: false + } +}; diff --git a/packages/test-data/tests-unit/parser-property-interp/parser-property-interp.css b/packages/test-data/tests-unit/parser-property-interp/parser-property-interp.css index 3699cb17c7..c505efe4c8 100644 --- a/packages/test-data/tests-unit/parser-property-interp/parser-property-interp.css +++ b/packages/test-data/tests-unit/parser-property-interp/parser-property-interp.css @@ -4,6 +4,6 @@ value: width; color: red; border-color-width: 2px; - *-z-color: 1px dashed blue; + --z-color: 1px dashed blue; background-color-width: green; } diff --git a/packages/test-data/tests-unit/parser-property-interp/parser-property-interp.less b/packages/test-data/tests-unit/parser-property-interp/parser-property-interp.less index 8b6dc9138a..3001bfca61 100644 --- a/packages/test-data/tests-unit/parser-property-interp/parser-property-interp.less +++ b/packages/test-data/tests-unit/parser-property-interp/parser-property-interp.less @@ -18,8 +18,8 @@ // border-${prop-name} becomes "border-color" (since prop-name's value is "color") border-${prop-name}-width: 2px; - // Complex property name with ${prop} - *-z-${prop-name}: 1px dashed blue; + // Custom property name with ${prop-name} + --z-${prop-name}: 1px dashed blue; // Multiple ${prop} in same property name // ${my}-${prop-name}-${value} becomes "background-color-width" diff --git a/packages/test-data/tests-unit/parser-slashed-combinator/parser-slashed-combinator.css b/packages/test-data/tests-unit/parser-slashed-combinator/parser-slashed-combinator.css index e5a4f65be6..8b13789179 100644 --- a/packages/test-data/tests-unit/parser-slashed-combinator/parser-slashed-combinator.css +++ b/packages/test-data/tests-unit/parser-slashed-combinator/parser-slashed-combinator.css @@ -1,9 +1 @@ -.parent /deep/ .child { - color: red; -} -.container /shadow/ .content { - background: blue; -} -.wrapper /deep/ .inner /deep/ .deepest { - padding: 10px; -} + diff --git a/packages/test-data/tests-unit/parser-slashed-combinator/parser-slashed-combinator.less b/packages/test-data/tests-unit/parser-slashed-combinator/parser-slashed-combinator.less index 5b91f8f2e7..abfcffec46 100644 --- a/packages/test-data/tests-unit/parser-slashed-combinator/parser-slashed-combinator.less +++ b/packages/test-data/tests-unit/parser-slashed-combinator/parser-slashed-combinator.less @@ -4,17 +4,17 @@ // They were part of the Shadow DOM specification but have been removed // /deep/ combinator (deprecated) -.parent /deep/ .child { - color: red; -} +// .parent /deep/ .child { +// color: red; +// } -// /shadow/ combinator (deprecated) -.container /shadow/ .content { - background: blue; -} +// // /shadow/ combinator (deprecated) +// .container /shadow/ .content { +// background: blue; +// } -// Test with nested selectors -.wrapper /deep/ .inner /deep/ .deepest { - padding: 10px; -} +// // Test with nested selectors +// .wrapper /deep/ .inner /deep/ .deepest { +// padding: 10px; +// } diff --git a/packages/test-data/tests-unit/permissive-parse/permissive-parse.less b/packages/test-data/tests-unit/permissive-parse/permissive-parse.less index 84430b6322..20762cb78c 100644 --- a/packages/test-data/tests-unit/permissive-parse/permissive-parse.less +++ b/packages/test-data/tests-unit/permissive-parse/permissive-parse.less @@ -38,13 +38,13 @@ @size: 640px; @tablet: (min-width: @size); -@media @tablet { +@media @{tablet} { .holy-crap { this: works; } } @tablet: (min-width: @{size}); -@media @tablet { +@media @{tablet} { .with-curly { this: works; } diff --git a/packages/test-data/tests-unit/plugin/styles.config.ts b/packages/test-data/tests-unit/plugin/styles.config.ts new file mode 100644 index 0000000000..a12946b608 --- /dev/null +++ b/packages/test-data/tests-unit/plugin/styles.config.ts @@ -0,0 +1,11 @@ +/** + * `@plugin` fixtures load their scripts through the compiler's plugin resolver. + * Do not `require()` them while loading test configuration: those scripts are + * intentionally evaluated with the plugin-scoped Less globals (`functions`, + * `tree`, and `registerPlugin`), not with Node globals. + */ +export default { + output: { + collapseNesting: true + } +}; diff --git a/packages/test-data/tests-unit/property-accessors/legacy/property-accessors.css b/packages/test-data/tests-unit/property-accessors/legacy/property-accessors.css new file mode 100644 index 0000000000..6096c8e041 --- /dev/null +++ b/packages/test-data/tests-unit/property-accessors/legacy/property-accessors.css @@ -0,0 +1,60 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.block_1 { + color: red; + background-color: red; + width: 50px; + height: 25px; + border: 1px solid #ff3333; +} +.block_1:hover { + background-color: green; + color: green; +} +.block_1 .one { + background: red; +} +.block_1 { + content: "red"; + prop: red; +} +.block_2 { + color: red; +} +.block_2 .two { + background-color: blue; +} +.block_2 { + color: blue; +} +.block_3 { + color: red; + color: yellow; +} +.block_3 .three { + background-color: blue; +} +.block_3 { + color: blue; +} +.block_4 { + color: red; + color: yellow; +} +.block_4 .four { + background-color: yellow; +} +.block_4 { + color: blue; +} +a { + background-color: red, foo; +} +ab { + background: red, foo; +} +.value_as_property { + prop1: color; + color: #FF0000; +} diff --git a/packages/test-data/tests-unit/property-accessors/property-accessors.css b/packages/test-data/tests-unit/property-accessors/property-accessors.css index d48dfc24cc..adf9ecc2f2 100644 --- a/packages/test-data/tests-unit/property-accessors/property-accessors.css +++ b/packages/test-data/tests-unit/property-accessors/property-accessors.css @@ -4,8 +4,6 @@ width: 50px; height: 25px; border: 1px solid #ff3333; - content: "red"; - prop: red; } .block_1:hover { background-color: green; @@ -14,29 +12,39 @@ .block_1 .one { background: red; } +.block_1 { + content: "red"; + prop: red; +} .block_2 { color: red; - color: blue; } .block_2 .two { background-color: blue; } +.block_2 { + color: blue; +} .block_3 { color: red; - color: yellow; - color: blue; } .block_3 .three { background-color: blue; } +.block_3 { + color: yellow; + color: blue; +} .block_4 { color: red; - color: blue; - color: yellow; } .block_4 .four { background-color: yellow; } +.block_4 { + color: blue; + color: yellow; +} a { background-color: red, foo; } diff --git a/packages/test-data/tests-unit/property-name-interp/legacy/property-name-interp.css b/packages/test-data/tests-unit/property-name-interp/legacy/property-name-interp.css new file mode 100644 index 0000000000..593006ce48 --- /dev/null +++ b/packages/test-data/tests-unit/property-name-interp/legacy/property-name-interp.css @@ -0,0 +1,24 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +pi-test { + border: 0; + @not-variable: @not-variable; + ufo-width: 50%; + *-z-border: 1px dashed blue; + -www-border-top: 2px; + radius-is-not-a-border: true; + border-top-left-radius: 2em; + border-top-red-radius-: 3pt; + global-local-mixer-property: strong; +} +pi-test-merge { + pre-property-ish: high, middle, low, base; + pre-property-ish+: nice try dude; +} +pi-indirect-vars { + auto: auto; +} +pi-complex-values { + 3px rgba(255, 255, 0, 0.5), 3.141592653589793 /* foo */3px rgba(255, 255, 0, 0.5), 3.141592653589793 /* foo */: none; +} diff --git a/packages/test-data/tests-unit/property-name-interp/property-name-interp.css b/packages/test-data/tests-unit/property-name-interp/property-name-interp.css index 315815e3fe..982441071d 100644 --- a/packages/test-data/tests-unit/property-name-interp/property-name-interp.css +++ b/packages/test-data/tests-unit/property-name-interp/property-name-interp.css @@ -17,5 +17,5 @@ pi-indirect-vars { auto: auto; } pi-complex-values { - 3px rgba(255, 255, 0, 0.5), 3.141592653589793 /* foo */3px rgba(255, 255, 0, 0.5), 3.141592653589793 /* foo */: none; + 3px rgba(255, 255, 0, 0.5), 3.1415926536 /* foo */3px rgba(255, 255, 0, 0.5), 3.1415926536 /* foo */: none; } diff --git a/packages/test-data/tests-unit/property-name-interp/property-name-interp.less b/packages/test-data/tests-unit/property-name-interp/property-name-interp.less index ab74ee04e1..50dbad12cc 100644 --- a/packages/test-data/tests-unit/property-name-interp/property-name-interp.less +++ b/packages/test-data/tests-unit/property-name-interp/property-name-interp.less @@ -5,7 +5,9 @@ pi-test { @bb: top; @c_c: left; @d-d4: radius; - @-: -; + // Dash-only variable names are removed in Less 5. Keep this fixture on + // the supported interpolation path with an ordinary variable instead. + @dash: -; @var: ~'@not-variable'; @@ -16,7 +18,7 @@ pi-test { -www-@{a}-@{bb}: 2px; @{d-d4}-is-not-a-@{a}:true; @{a}-@{bb}-@{c_c}-@{d-d4} : 2em; - @{a}@{-}@{bb}@{-}red@{-}@{d-d4}-: 3pt; + @{a}@{dash}@{bb}@{dash}red@{dash}@{d-d4}-: 3pt; .mixin(mixer); .merge(ish, base); diff --git a/packages/test-data/tests-unit/property-targeted/legacy/property-targeted.css b/packages/test-data/tests-unit/property-targeted/legacy/property-targeted.css new file mode 100644 index 0000000000..9d69b23fef --- /dev/null +++ b/packages/test-data/tests-unit/property-targeted/legacy/property-targeted.css @@ -0,0 +1,7 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.test-important { + color: red!important; + background: red !important; +} diff --git a/packages/test-data/tests-unit/property-targeted/property-targeted.css b/packages/test-data/tests-unit/property-targeted/property-targeted.css index 19ec97a4b0..76b82445f3 100644 --- a/packages/test-data/tests-unit/property-targeted/property-targeted.css +++ b/packages/test-data/tests-unit/property-targeted/property-targeted.css @@ -1,4 +1,4 @@ .test-important { - color: red!important; + color: red !important; background: red !important; } diff --git a/packages/test-data/tests-unit/rulesets/legacy/rulesets.css b/packages/test-data/tests-unit/rulesets/legacy/rulesets.css new file mode 100644 index 0000000000..8653aef261 --- /dev/null +++ b/packages/test-data/tests-unit/rulesets/legacy/rulesets.css @@ -0,0 +1,31 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +#first > .one > #second .two > #deux { + width: 50%; +} +#first > .one > #second .two > #deux #third:focus { + color: black; +} +#first > .one > #second .two > #deux #third:focus #fifth > #sixth .seventh #eighth + #ninth { + color: purple; +} +#first > .one > #second .two > #deux #third { + height: 100%; +} +#first > .one > #second .two > #deux #fourth, +#first > .one > #second .two > #deux #five, +#first > .one > #second .two > #deux #six { + color: #110000; +} +:is(#first > .one > #second .two > #deux #fourth, #first > .one > #second .two > #deux #five, #first > .one > #second .two > #deux #six) .seven, +:is(#first > .one > #second .two > #deux #fourth, #first > .one > #second .two > #deux #five, #first > .one > #second .two > #deux #six) .eight > #nine { + border: 1px solid black; +} +:is(#first > .one > #second .two > #deux #fourth, #first > .one > #second .two > #deux #five, #first > .one > #second .two > #deux #six) #ten { + color: red; +} +#first > .one { + font-size: 2em; + hasOwnProperty: blue; +} diff --git a/packages/test-data/tests-unit/rulesets/rulesets.css b/packages/test-data/tests-unit/rulesets/rulesets.css index 408c76aada..05ad1e64fc 100644 --- a/packages/test-data/tests-unit/rulesets/rulesets.css +++ b/packages/test-data/tests-unit/rulesets/rulesets.css @@ -1,33 +1,34 @@ #first > .one { + > #second .two > #deux { + width: 50%; + #third { + &:focus { + color: black; + #fifth { + > #sixth { + .seventh #eighth { + + #ninth { + color: purple; + } + } + } + } + } + height: 100%; + } + #fourth, + #five, + #six { + color: #110000; + .seven, + .eight > #nine { + border: 1px solid black; + } + #ten { + color: red; + } + } + } font-size: 2em; -} -#first > .one > #second .two > #deux { - width: 50%; -} -#first > .one > #second .two > #deux #third { - height: 100%; -} -#first > .one > #second .two > #deux #third:focus { - color: black; -} -#first > .one > #second .two > #deux #third:focus #fifth > #sixth .seventh #eighth + #ninth { - color: purple; -} -#first > .one > #second .two > #deux #fourth, -#first > .one > #second .two > #deux #five, -#first > .one > #second .two > #deux #six { - color: #110000; -} -#first > .one > #second .two > #deux #fourth .seven, -#first > .one > #second .two > #deux #five .seven, -#first > .one > #second .two > #deux #six .seven, -#first > .one > #second .two > #deux #fourth .eight > #nine, -#first > .one > #second .two > #deux #five .eight > #nine, -#first > .one > #second .two > #deux #six .eight > #nine { - border: 1px solid black; -} -#first > .one > #second .two > #deux #fourth #ten, -#first > .one > #second .two > #deux #five #ten, -#first > .one > #second .two > #deux #six #ten { - color: red; + hasOwnProperty: blue; } diff --git a/packages/test-data/tests-unit/rulesets/rulesets.less b/packages/test-data/tests-unit/rulesets/rulesets.less index 49d623a717..f2742138af 100644 --- a/packages/test-data/tests-unit/rulesets/rulesets.less +++ b/packages/test-data/tests-unit/rulesets/rulesets.less @@ -28,4 +28,5 @@ } } font-size: 2em; + hasOwnProperty: blue; } diff --git a/packages/test-data/tests-unit/rulesets/styles.config.ts b/packages/test-data/tests-unit/rulesets/styles.config.ts new file mode 100644 index 0000000000..774aec3bfc --- /dev/null +++ b/packages/test-data/tests-unit/rulesets/styles.config.ts @@ -0,0 +1,5 @@ +export default { + output: [ + { file: '{name}.css', collapseNesting: false } + ] +} diff --git a/packages/test-data/tests-unit/scope/legacy/scope.css b/packages/test-data/tests-unit/scope/legacy/scope.css new file mode 100644 index 0000000000..80273f7f38 --- /dev/null +++ b/packages/test-data/tests-unit/scope/legacy/scope.css @@ -0,0 +1,41 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.tiny-scope { + color: #989; +} +.scope1 { + color: blue; + border-color: black; +} +.scope1 .scope2 { + color: blue; +} +.scope1 .scope2 .scope3 { + color: red; + border-color: black; + background-color: white; +} +.scope { + scoped-val: green; +} +.heightIsSet { + height: 1024px; +} +.useHeightInMixinCall { + mixin-height: 1024px; +} +.imported { + exists: true; +} +.testImported { + exists: true; +} +#allAreUsedHere { + default: 'top level'; + scope: 'top level'; + sub-scope-only: 'inside'; +} +#parentSelectorScope { + prop: white; +} diff --git a/packages/test-data/tests-unit/scope/scope.css b/packages/test-data/tests-unit/scope/scope.css index caeb1f0a8d..f96e3c2795 100644 --- a/packages/test-data/tests-unit/scope/scope.css +++ b/packages/test-data/tests-unit/scope/scope.css @@ -1,5 +1,5 @@ .tiny-scope { - color: #989; + color: blue; } .scope1 { color: blue; diff --git a/packages/test-data/tests-unit/selectors/selectors.css b/packages/test-data/tests-unit/selectors/selectors.css index 1ac2719547..2eda595425 100644 --- a/packages/test-data/tests-unit/selectors/selectors.css +++ b/packages/test-data/tests-unit/selectors/selectors.css @@ -1,9 +1,4 @@ -h1 a:hover, -h2 a:hover, -h3 a:hover, -h1 p:hover, -h2 p:hover, -h3 p:hover { +:is(h1 a, h2 a, h3 a, h1 p, h2 p, h3 p):hover { color: red; } #all { @@ -43,20 +38,17 @@ div a { p a span { color: yellow; } -.foo .bar .qux, -.foo .baz .qux { +:is(.foo .bar, .foo .baz) .qux { display: block; } -.qux .foo .bar, -.qux .foo .baz { +.qux :is(.foo .bar, .foo .baz) { display: inline; } .qux.foo .bar, .qux.foo .baz { display: inline-block; } -.qux .foo .bar .biz, -.qux .foo .baz .biz { +.qux :is(.foo .bar, .foo .baz) .biz { display: none; } .a.b.c { @@ -73,32 +65,12 @@ p a span { } .foo + .foo { background: amber; -} -.foo + .foo { background: amber; } -.foo + .foo, -.foo + .bar, -.bar + .foo, -.bar + .bar { +:is(.foo, .bar) + :is(.foo, .bar) { background: amber; } -.foo a > .foo a, -.foo a > .bar a, -.foo a > .foo b, -.foo a > .bar b, -.bar a > .foo a, -.bar a > .bar a, -.bar a > .foo b, -.bar a > .bar b, -.foo b > .foo a, -.foo b > .bar a, -.foo b > .foo b, -.foo b > .bar b, -.bar b > .foo a, -.bar b > .bar a, -.bar b > .foo b, -.bar b > .bar b { +:is(.foo a, .bar a, .foo b, .bar b) > :is(.foo a, .bar a, .foo b, .bar b) { background: amber; } .other ::fnord { @@ -178,13 +150,46 @@ blank blank blank blank blank blank blank blank blank blank blank blank blank bl test: global scope; } .extend-this, -.active.first-level .second-level, -.first-level .second-level.active2 { +.active:is(.first-level .second-level), +:is(.first-level .second-level).active2 { content: '\2661'; } +.x:is(.x.a) { + color: red; +} +.x:not(.x.b, .x.c) { + color: green; +} +.x:is(.x.d, .x.e, .x.f) { + color: blue; +} a:is(.b, :is(.c)) { color: blue; } a:is(.b, :is(.c), :has(div)) { color: red; } +:is(:not(:has(> .foo)), :has(> .foo.bar)) { + overflow: clip; +} +:matches(:not(:has(> .foo)), :has(> .foo.bar)) { + overflow: clip; +} +:where(:not(:has(> .foo)), :has(> .foo.bar)) { + overflow: clip; +} +:is(:has(> .foo + .bar), :has(> .baz ~ .qux), :not(:has(.quux))) { + color: blue; +} +:where(.a, .b, .c) { + color: red; +} +:not(.a, .b, .c) { + color: green; +} +:where(:is(.a, .b), :has(> .c)) { + color: blue; +} +:is(:where(:has(.foo)), :not(:has(.bar))) { + color: purple; +} diff --git a/packages/test-data/tests-unit/selectors/selectors.less b/packages/test-data/tests-unit/selectors/selectors.less index 30635b1d64..f732c8d771 100644 --- a/packages/test-data/tests-unit/selectors/selectors.less +++ b/packages/test-data/tests-unit/selectors/selectors.less @@ -202,6 +202,13 @@ blank blank blank blank blank blank blank blank blank blank blank blank blank bl } } +// https://github.com/less/less.js/issues/4358 +.x { + &:is(&.a) { color: red; } + &:not(&.b, &.c) { color: green; } + &:is(&.d, &.e, &.f) { color: blue; } +} + a:is(.b, :is(.c)) { color: blue; } @@ -209,3 +216,36 @@ a:is(.b, :is(.c)) { a:is(.b, :is(.c), :has(div)) { color: red; } + +// https://github.com/less/less.js/issues/4378 +:is(:not(:has(>.foo)), :has(>.foo.bar)) { + overflow: clip; +} + +:matches(:not(:has(>.foo)), :has(>.foo.bar)) { + overflow: clip; +} + +:where(:not(:has(>.foo)), :has(>.foo.bar)) { + overflow: clip; +} + +:is(:has(>.foo + .bar), :has(>.baz ~ .qux), :not(:has(.quux))) { + color: blue; +} + +:where(.a, .b, .c) { + color: red; +} + +:not(.a, .b, .c) { + color: green; +} + +:where(:is(.a, .b), :has(>.c)) { + color: blue; +} + +:is(:where(:has(.foo)), :not(:has(.bar))) { + color: purple; +} diff --git a/packages/test-data/tests-unit/styles.config.cjs b/packages/test-data/tests-unit/styles.config.cjs index b931b9b001..85865102e5 100644 --- a/packages/test-data/tests-unit/styles.config.cjs +++ b/packages/test-data/tests-unit/styles.config.cjs @@ -4,6 +4,6 @@ module.exports = { "relativeUrls": true, "silent": true, "javascriptEnabled": true -} + } } }; diff --git a/packages/test-data/tests-unit/styles.config.ts b/packages/test-data/tests-unit/styles.config.ts new file mode 100644 index 0000000000..cc02850313 --- /dev/null +++ b/packages/test-data/tests-unit/styles.config.ts @@ -0,0 +1,8 @@ +export default { + compile: { + mathMode: 'always' + }, + output: { + collapseNesting: true, + }, +}; \ No newline at end of file diff --git a/packages/test-data/tests-unit/tailwind/tailwind.css b/packages/test-data/tests-unit/tailwind/tailwind.css new file mode 100644 index 0000000000..499decb219 --- /dev/null +++ b/packages/test-data/tests-unit/tailwind/tailwind.css @@ -0,0 +1,3 @@ +.box { + @apply h-64 w-64; +} diff --git a/packages/test-data/tests-unit/tailwind/tailwind.less b/packages/test-data/tests-unit/tailwind/tailwind.less new file mode 100644 index 0000000000..499decb219 --- /dev/null +++ b/packages/test-data/tests-unit/tailwind/tailwind.less @@ -0,0 +1,3 @@ +.box { + @apply h-64 w-64; +} diff --git a/packages/test-data/tests-unit/variables-in-at-rules/variables-in-at-rules.less b/packages/test-data/tests-unit/variables-in-at-rules/variables-in-at-rules.less index 74f31da313..6b916b20cc 100644 --- a/packages/test-data/tests-unit/variables-in-at-rules/variables-in-at-rules.less +++ b/packages/test-data/tests-unit/variables-in-at-rules/variables-in-at-rules.less @@ -1,18 +1,19 @@ -@Eight: 8; -@charset "UTF-@{Eight}"; +// Less 5 keeps @charset as a static CSS directive. Dynamic charset +// interpolation is covered by the alpha diagnostic contract instead. +@charset "UTF-8"; @ns: less; -@namespace @ns "http://lesscss.org"; +@namespace @{ns} "http://lesscss.org"; @name: enlarger; -@keyframes @name { +@keyframes @{name} { from {font-size: 12px;} to {font-size: 15px;} } .m(reducer); .m(@name) { - @-webkit-keyframes @name { + @-webkit-keyframes @{name} { from {font-size: 13px;} to {font-size: 10px;} } diff --git a/packages/test-data/tests-unit/variables/legacy/variable-advanced.css b/packages/test-data/tests-unit/variables/legacy/variable-advanced.css new file mode 100644 index 0000000000..763004d402 --- /dev/null +++ b/packages/test-data/tests-unit/variables/legacy/variable-advanced.css @@ -0,0 +1,58 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.units-extended { + width: 1px; + same-unit-as-previously: 1px; + square-pixel-divided: 1px; + odd-unit: 2; + percentage: 500%; + pixels: 500px; + conversion-metric-a: 30mm; + conversion-metric-b: 3cm; + conversion-imperial: 3in; + /* stylelint-disable-next-line unit-no-unknown -- historical Less 4 custom-unit output */ + custom-unit: 420octocats; + /* stylelint-disable-next-line unit-no-unknown -- historical Less 4 custom-unit output */ + custom-unit-cancelling: 18dogs; + mix-units: 2px; + invalid-units: 1px; +} +.units-extended .fallback { + div-px-1: 10px; + div-px-2: 1px; + sub-px-1: 12.6px; + sub-cm-1: 9.666625cm; + mul-px-1: 19.6px; + mul-em-1: 19.6em; + mul-em-2: 196em; + mul-cm-1: 196cm; + add-px-1: 15.4px; + add-px-2: 393.35275591px; + mul-px-2: 140px; + mul-px-3: 140px; +} +.css-custom-properties { + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; +} +.variable-interpolation .radio_checked { + border-color: #fff; +} +.each-with-variables div#apple { + color: blue; +} +.each-with-variables div#banana { + color: blue; +} +.each-with-variables div#cherry { + color: blue; +} +.each-with-variables div#carrot { + color: blue; +} +.each-with-variables div#potato { + color: blue; +} diff --git a/packages/test-data/tests-unit/variables/variable-advanced.css b/packages/test-data/tests-unit/variables/variable-advanced.css index f5092252f1..b134c247a2 100644 --- a/packages/test-data/tests-unit/variables/variable-advanced.css +++ b/packages/test-data/tests-unit/variables/variable-advanced.css @@ -1,6 +1,3 @@ -.alpha { - filter: alpha(opacity=42); -} .units-extended { width: 1px; same-unit-as-previously: 1px; @@ -26,7 +23,7 @@ mul-em-2: 196em; mul-cm-1: 196cm; add-px-1: 15.4px; - add-px-2: 393.35275591px; + add-px-2: 393.3527559px; mul-px-2: 140px; mul-px-3: 140px; } diff --git a/packages/test-data/tests-unit/variables/variable-advanced.less b/packages/test-data/tests-unit/variables/variable-advanced.less index fcd96a4aa0..3d68a4cbba 100644 --- a/packages/test-data/tests-unit/variables/variable-advanced.less +++ b/packages/test-data/tests-unit/variables/variable-advanced.less @@ -3,10 +3,11 @@ @c: #888; @onePixel: 1px; -.alpha { - @var: 42; - filter: alpha(opacity=@var); -} +// Hasn't been supported since IE8, so removed +// .alpha { +// @var: 42; +// filter: alpha(opacity=@var); +// } .units-extended { width: @onePixel; diff --git a/packages/test-data/tests-unit/variables/variables.css b/packages/test-data/tests-unit/variables/variables.css index d39c88e176..7c1bff2af6 100644 --- a/packages/test-data/tests-unit/variables/variables.css +++ b/packages/test-data/tests-unit/variables/variables.css @@ -41,3 +41,6 @@ .variable-pollution { a: 'no-pollution'; } +.icon-5_large { + background-image: url(/img/icon/5_large.svg); +} diff --git a/packages/test-data/tests-unit/variables/variables.less b/packages/test-data/tests-unit/variables/variables.less index 208abae65e..61abf255db 100644 --- a/packages/test-data/tests-unit/variables/variables.less +++ b/packages/test-data/tests-unit/variables/variables.less @@ -85,3 +85,9 @@ } + +// https://github.com/less/less.js/issues/2462 +@type: 5_large; +.icon-@{type} { + background-image: ~"url(/img/icon/@{type}.svg)"; +} diff --git a/packages/test-data/tests-unit/whitespace/legacy/whitespace.css b/packages/test-data/tests-unit/whitespace/legacy/whitespace.css new file mode 100644 index 0000000000..779e918225 --- /dev/null +++ b/packages/test-data/tests-unit/whitespace/legacy/whitespace.css @@ -0,0 +1,45 @@ +/* Less 4.x output, recorded when this fixture graduated to v5. + Historical record only — no test reads this file. */ + +.whitespace { + color: white; +} +.whitespace { + color: white; +} +.whitespace { + color: white; +} +.whitespace { + color: white; +} +.whitespace { + color: white ; +} +.white, +.space, +.mania { + color: white; +} +.no-semi-column { + color: white; +} +.no-semi-column { + color: white; + white-space: pre; +} +.no-semi-column { + border: 2px solid white; +} +.newlines { + background: the, + great, + wall; + border: 2px + solid + black; +} +.sel .newline_ws .tab_ws { + color: white; + background-position: 45 -23; +} diff --git a/packages/test-data/tests-unit/whitespace/whitespace.css b/packages/test-data/tests-unit/whitespace/whitespace.css index 38ad81c1c1..5d1a5f6f68 100644 --- a/packages/test-data/tests-unit/whitespace/whitespace.css +++ b/packages/test-data/tests-unit/whitespace/whitespace.css @@ -11,7 +11,7 @@ color: white; } .whitespace { - color: white ; + color: white; } .white, .space, @@ -38,5 +38,6 @@ } .sel .newline_ws .tab_ws { color: white; - background-position: 45 -23; + background-position: 45 + -23; } diff --git a/packages/test-data/tests-warnings/parentless-ampersand-nested.less b/packages/test-data/tests-warnings/parentless-ampersand-nested.less new file mode 100644 index 0000000000..859fb8b421 --- /dev/null +++ b/packages/test-data/tests-warnings/parentless-ampersand-nested.less @@ -0,0 +1,6 @@ +.a { + color: red; +} +& + & { + color: blue; +} diff --git a/packages/test-data/tests-warnings/parentless-ampersand-nested.txt b/packages/test-data/tests-warnings/parentless-ampersand-nested.txt new file mode 100644 index 0000000000..24d341518f --- /dev/null +++ b/packages/test-data/tests-warnings/parentless-ampersand-nested.txt @@ -0,0 +1,42 @@ +[ + { + "code": "selector/parentless-ampersand", + "phase": "eval", + "message": "Parentless ampersand ignored", + "reason": "Selector \"&+&\" uses \"&\" without an available parent selector in this context.", + "fix": "Move the selector under a real parent selector, or remove the stray \"&\".", + "file": { + "name": "parentless-ampersand-nested.less", + "path": "{path}", + "fullPath": "{path}parentless-ampersand-nested.less" + }, + "filePath": "{path}parentless-ampersand-nested.less", + "line": 4, + "column": 1, + "lines": { + "3": "}", + "4": "& + & {", + "5": " color: blue;" + } + }, + { + "code": "selector/parentless-ampersand", + "phase": "eval", + "message": "Parentless ampersand ignored", + "reason": "Selector \"&+&\" uses \"&\" without an available parent selector in this context.", + "fix": "Move the selector under a real parent selector, or remove the stray \"&\".", + "file": { + "name": "parentless-ampersand-nested.less", + "path": "{path}", + "fullPath": "{path}parentless-ampersand-nested.less" + }, + "filePath": "{path}parentless-ampersand-nested.less", + "line": 4, + "column": 5, + "lines": { + "3": "}", + "4": "& + & {", + "5": " color: blue;" + } + } +] diff --git a/packages/test-data/tests-warnings/parentless-ampersand.less b/packages/test-data/tests-warnings/parentless-ampersand.less new file mode 100644 index 0000000000..d2f0b8394c --- /dev/null +++ b/packages/test-data/tests-warnings/parentless-ampersand.less @@ -0,0 +1,3 @@ +& { + color: red; +} diff --git a/packages/test-data/tests-warnings/parentless-ampersand.txt b/packages/test-data/tests-warnings/parentless-ampersand.txt new file mode 100644 index 0000000000..ef5823a6c8 --- /dev/null +++ b/packages/test-data/tests-warnings/parentless-ampersand.txt @@ -0,0 +1,21 @@ +[ + { + "code": "selector/parentless-ampersand", + "phase": "eval", + "message": "Parentless ampersand ignored", + "reason": "Selector \"&\" uses \"&\" without an available parent selector in this context.", + "fix": "Move the selector under a real parent selector, or remove the stray \"&\".", + "file": { + "name": "parentless-ampersand.less", + "path": "{path}", + "fullPath": "{path}parentless-ampersand.less" + }, + "filePath": "{path}parentless-ampersand.less", + "line": 1, + "column": 1, + "lines": { + "1": "& {", + "2": " color: red;" + } + } +] diff --git a/packages/test-import-module/package.json b/packages/test-import-module/package.json index f581c9c0a0..a8a7c0a27c 100644 --- a/packages/test-import-module/package.json +++ b/packages/test-import-module/package.json @@ -1,7 +1,7 @@ { "name": "@less/test-import-module", "private": true, - "version": "4.5.0", + "version": "4.6.0", "description": "Less files to be included in node_modules directory for testing import from node_modules", "author": "Alexis Sellier ", "contributors": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7288a64397..1f585bc90b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,7 +1,7 @@ lockfileVersion: '9.0' settings: - autoInstallPeers: true + autoInstallPeers: false excludeLinksFromLockfile: false importers: @@ -20,21 +20,36 @@ importers: npm-run-all: specifier: ^4.1.5 version: 4.1.5 + playwright: + specifier: 1.50.1 + version: 1.50.1 semver: specifier: ^6.3.1 version: 6.3.1 packages/less: dependencies: - copy-anything: - specifier: ^2.0.1 - version: 2.0.6 + '@jesscss/compiler': + specifier: 2.0.0-alpha.11 + version: 2.0.0-alpha.11(typescript@5.9.3) + '@jesscss/core': + specifier: 2.0.0-alpha.11 + version: 2.0.0-alpha.11 + '@jesscss/plugin-less': + specifier: 2.0.0-alpha.11 + version: 2.0.0-alpha.11(parseman@0.41.0)(typescript@5.9.3) + '@jesscss/plugin-less-compat': + specifier: 2.0.0-alpha.11 + version: 2.0.0-alpha.11(parseman@0.41.0) + '@jesscss/plugin-node-modules': + specifier: 2.0.0-alpha.11 + version: 2.0.0-alpha.11 parse-node-version: specifier: ^1.0.1 version: 1.0.1 - tslib: - specifier: ^2.3.0 - version: 2.8.1 + parseman: + specifier: ^0.41.0 + version: 0.41.0 devDependencies: '@less/test-data': specifier: workspace:* @@ -51,12 +66,15 @@ importers: '@rollup/plugin-node-resolve': specifier: ^11.0.0 version: 11.2.1(rollup@2.80.0) + '@types/node': + specifier: ^18 + version: 18.19.130 '@typescript-eslint/eslint-plugin': specifier: ^4.28.0 - version: 4.33.0(@typescript-eslint/parser@4.33.0(eslint@7.32.0)(typescript@4.9.5))(eslint@7.32.0)(typescript@4.9.5) + version: 4.33.0(@typescript-eslint/parser@4.33.0(eslint@7.32.0)(typescript@5.9.3))(eslint@7.32.0)(typescript@5.9.3) '@typescript-eslint/parser': specifier: ^4.28.0 - version: 4.33.0(eslint@7.32.0)(typescript@4.9.5) + version: 4.33.0(eslint@7.32.0)(typescript@5.9.3) benny: specifier: ^3.6.12 version: 3.7.1 @@ -74,7 +92,7 @@ importers: version: 4.1.2 cosmiconfig: specifier: ~9.0.0 - version: 9.0.2(typescript@4.9.5) + version: 9.0.2(typescript@5.9.3) cross-env: specifier: ^7.0.3 version: 7.0.3 @@ -84,45 +102,18 @@ importers: fs-extra: specifier: ^8.1.0 version: 8.1.0 - git-rev: - specifier: ^0.2.1 - version: 0.2.1 glob: specifier: ~11.0.3 version: 11.0.3 globby: specifier: ^10.0.1 version: 10.0.2 - grunt: - specifier: ^1.0.4 - version: 1.6.2 - grunt-cli: - specifier: ^1.3.2 - version: 1.5.0 - grunt-contrib-clean: - specifier: ^1.0.0 - version: 1.1.0(grunt@1.6.2) - grunt-contrib-connect: - specifier: ^1.0.2 - version: 1.0.2(grunt@1.6.2) - grunt-eslint: - specifier: ^23.0.0 - version: 23.0.0(grunt@1.6.2) - grunt-saucelabs: - specifier: ^9.0.1 - version: 9.0.1(grunt@1.6.2) - grunt-shell: - specifier: ^1.3.0 - version: 1.3.1(grunt@1.6.2) html-template-tag: specifier: ^3.2.0 version: 3.2.0 jest-diff: specifier: ~30.1.2 version: 30.1.2 - jit-grunt: - specifier: ^0.10.0 - version: 0.10.0(grunt@1.6.2) less-plugin-autoprefix: specifier: ^1.5.1 version: 1.5.1 @@ -141,12 +132,12 @@ importers: npm-run-all: specifier: ^4.1.5 version: 4.1.5 + path-browserify: + specifier: ^1.0.1 + version: 1.0.1 performance-now: specifier: ^0.2.0 version: 0.2.0 - phin: - specifier: ^2.2.3 - version: 2.9.3 playwright: specifier: 1.50.1 version: 1.50.1 @@ -165,49 +156,27 @@ importers: rollup-plugin-terser: specifier: ^5.1.1 version: 5.3.1(rollup@2.80.0) - rollup-plugin-typescript2: - specifier: ^0.29.0 - version: 0.29.0(rollup@2.80.0)(typescript@4.9.5) semver: specifier: ^6.3.0 version: 6.3.1 shx: specifier: ^0.3.2 version: 0.3.4 - time-grunt: - specifier: ^1.3.0 - version: 1.4.0 - ts-node: - specifier: ^10.9.1 - version: 10.9.2(@types/node@18.19.130)(typescript@4.9.5) typescript: - specifier: ^4.3.4 - version: 4.9.5 + specifier: ^5.7.0 + version: 5.9.3 uikit: specifier: 2.27.4 version: 2.27.4 - optionalDependencies: - errno: - specifier: ^0.1.1 - version: 0.1.8 - graceful-fs: - specifier: ^4.1.2 - version: 4.2.11 - image-size: - specifier: ~0.5.0 - version: 0.5.5 - make-dir: - specifier: ^2.1.0 - version: 2.1.0 - mime: - specifier: ^1.4.1 - version: 1.6.0 - needle: - specifier: ^3.1.0 - version: 3.5.0 - source-map: - specifier: ~0.6.0 - version: 0.6.1 + url: + specifier: ^0.11.4 + version: 0.11.4 + webpack: + specifier: ^5.64.6 + version: 5.109.0(webpack-cli@5.1.4) + webpack-cli: + specifier: ^5.1.4 + version: 5.1.4(webpack@5.109.0) packages/test-data: {} @@ -253,9 +222,18 @@ packages: resolution: {integrity: sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==} engines: {node: '>=18'} - '@cspotcode/source-map-support@0.8.1': - resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} - engines: {node: '>=12'} + '@discoveryjs/json-ext@0.5.7': + resolution: {integrity: sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==} + engines: {node: '>=10.0.0'} + + '@emnapi/core@1.11.1': + resolution: {integrity: sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==} + + '@emnapi/runtime@1.11.1': + resolution: {integrity: sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==} + + '@emnapi/wasi-threads@1.2.2': + resolution: {integrity: sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==} '@eslint/eslintrc@0.4.3': resolution: {integrity: sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==} @@ -282,6 +260,58 @@ packages: resolution: {integrity: sha512-+Sg6GCR/wy1oSmQDFq4LQDAhm3ETKnorxN+y5nbLULOR3P0c14f2Wurzj3/xqPXtasLFfHd5iRFQ7AJt4KH2cw==} engines: {node: '>=8'} + '@jesscss/awaitable-pipe@2.0.0-alpha.11': + resolution: {integrity: sha512-OnO29CGEvabCEiFcGEHVC2p8jk8789Nm8S1oguczfO72733l8MSCc5f7BBk6WEo1WgNmpRuNe+x0KhgMPG9Bvg==} + engines: {node: ^20.19.0 || >=22.12.0} + + '@jesscss/compiler@2.0.0-alpha.11': + resolution: {integrity: sha512-QK4QcqMhyJo37k18/8nj/H49W0/j4ZVL0b7U62mWQBlIFLf6sOaUr22OFs4H4bCB5RuVSlxfO4KJZBub2qNdVg==} + engines: {node: ^20.19.0 || >=22.12.0} + + '@jesscss/core@2.0.0-alpha.11': + resolution: {integrity: sha512-qcLudGZQECyRTe5QFG4Zo8IoQOw65LAy9nIQwGz+5BLHXBRDDUXy+BQv5j86twRyYxAz49tTGxZ4r+VzZEAEYg==} + engines: {node: ^20.19.0 || >=22.12.0} + + '@jesscss/css-parser@2.0.0-alpha.11': + resolution: {integrity: sha512-9h5ELZHDF+ZbBS8kc2VFX5aeq2e/LRoMMgnYQXYUmHgBWewIpWYSt2rW1tDMfhl6cpiN4xj7d57oeK2/9sM+IA==} + engines: {node: ^20.19.0 || >=22.12.0} + peerDependencies: + '@jesscss/core': 2.0.0-alpha.11 + parseman: ^0.41.0 + peerDependenciesMeta: + '@jesscss/core': + optional: true + + '@jesscss/fns@2.0.0-alpha.11': + resolution: {integrity: sha512-OZZHNX0AWAvvwZZekwilIn25RWuJyvsEqiG0WLGrbX1IRkHbKbjXnWVt8gmrevry3K1Sayj1QLNU02cQKx/PtQ==} + engines: {node: ^20.19.0 || >=22.12.0} + + '@jesscss/less-parser@2.0.0-alpha.11': + resolution: {integrity: sha512-EctxG6TLNePROJT+rlOwnIqV/xcQlpoRqp0Ee7oS6r/oU7ZN7NYTtB6dWDPGHVxJSMGWYfZhEbdP9xpNNytC5w==} + engines: {node: ^20.19.0 || >=22.12.0} + peerDependencies: + '@jesscss/core': 2.0.0-alpha.11 + parseman: ^0.41.0 + peerDependenciesMeta: + '@jesscss/core': + optional: true + + '@jesscss/plugin-less-compat@2.0.0-alpha.11': + resolution: {integrity: sha512-jV3asz1TJvqaMXlkmfJd2KFbmFx14UQuE1ZP8CYea8eNLwiflIfOvDn6HCnkwn0gzJmvoYkW7aoq17JTiJkoXA==} + engines: {node: ^20.19.0 || >=22.12.0} + + '@jesscss/plugin-less@2.0.0-alpha.11': + resolution: {integrity: sha512-3oFbkLoIT7xc0f9AHwcK8xMnuqGLuwDd3Tvql1HTTkmbsa2x7MZ5UbyGPvq4a4TJMJIeQvxV9QghCT9+rRMGow==} + engines: {node: ^20.19.0 || >=22.12.0} + + '@jesscss/plugin-node-modules@2.0.0-alpha.11': + resolution: {integrity: sha512-ShX888c+8R0fzsvJCAQEQUou2mz3Li42Rw/mfHBbU2DeuGiU7OFKrdYbMVa/1hW2BIUeyjCyHRBvJVhyNfEBBw==} + engines: {node: ^20.19.0 || >=22.12.0} + + '@jesscss/style-resolver@2.0.0-alpha.11': + resolution: {integrity: sha512-PJk54FSQ+Ia9Aj4Ku4nJl+ivC0uMDVYCSfw+lVeRVVA0aBcSeU+Q3C+zduc9kDtu53RG+CK6QqJFmJHIw+x95w==} + engines: {node: ^20.19.0 || >=22.12.0} + '@jest/diff-sequences@30.0.1': resolution: {integrity: sha512-n5H8QLDJ47QqbCNn5SuFjCRDrOLEZ0h8vAHCK5RL9Ls7Xa8AQLa/YxAc9UjFqoEDM48muwtBGjtMY5cr0PLDCw==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} @@ -294,18 +324,31 @@ packages: resolution: {integrity: sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + '@jridgewell/gen-mapping@0.3.13': + resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} + + '@jridgewell/remapping@2.3.5': + resolution: {integrity: sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==} + '@jridgewell/resolve-uri@3.1.2': resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} + '@jridgewell/source-map@0.3.11': + resolution: {integrity: sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==} + '@jridgewell/sourcemap-codec@1.5.5': resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==} '@jridgewell/trace-mapping@0.3.31': resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} - '@jridgewell/trace-mapping@0.3.9': - resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} + '@napi-rs/wasm-runtime@1.2.0': + resolution: {integrity: sha512-kDoONqMa+VnZ4vvvu/ZUurpJ4gkZU57e7g69qpNgWhYcZFPUHZM2CEMKm+cG6ufDVALbjMvfmMjFVqaK7uEMnA==} + engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0} + peerDependencies: + '@emnapi/core': ^2.0.0-alpha.3 + '@emnapi/runtime': ^2.0.0-alpha.3 '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} @@ -319,6 +362,239 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + '@oxc-parser/binding-android-arm-eabi@0.137.0': + resolution: {integrity: sha512-KDs+0VPdEmasOkpuJHW9V5WCF+cvYdMQv2Jd+aJXt+cxIx12NToRQRbXaRwUEDsZw+/jMk81Ve8ZFbjUkJTOwA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + + '@oxc-parser/binding-android-arm64@0.137.0': + resolution: {integrity: sha512-WhALNzfy3x/RfC6bsqX+csavuUY0yHHE7XfgPE5M542uhoBZUUoGTPG+nkMbGoG4+gcfss5s7urMyn5QBHu0sw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@oxc-parser/binding-darwin-arm64@0.137.0': + resolution: {integrity: sha512-bFPr5hgmNMOMoyPTGtdsK4Ug21RovIPojRMgDDhSp1LtCnc/DkLwGONKjgRjszg677RlGnkYSviQ8hHaUPOVYA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@oxc-parser/binding-darwin-x64@0.137.0': + resolution: {integrity: sha512-CL5dMm1asqXIDZHg14FLxj3Mc36w8PI7xCWh1uA4is6z8g2XrIILoTcQYOxDbwzuk34RDPX5IAGUxZr6LA9KAg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@oxc-parser/binding-freebsd-x64@0.137.0': + resolution: {integrity: sha512-79h8rYGnSlKPGWo7mHr2ixO6ea7aW8B0CT965SZ8SLbNnCOH5aOYBTeVXUY6eMvEaiLyWr8Skuiugr5pDYgLGw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@oxc-parser/binding-linux-arm-gnueabihf@0.137.0': + resolution: {integrity: sha512-ASgmlSimhGyr0lksgVIo6hibz1obnDq4qJbiMX/AzltfgPnanRrzG1Q+23g8ljOHOjv6dsznkUuCYL3gg0sY1Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxc-parser/binding-linux-arm-musleabihf@0.137.0': + resolution: {integrity: sha512-AU2J9aa22Sx32wRGnDjybOU9TQXXQUud5sdUi+ZB0XxwM8aToWLweV+yA0wlQm0yIUVqljquqoHCYEq9II8gJQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxc-parser/binding-linux-arm64-gnu@0.137.0': + resolution: {integrity: sha512-GdEtiG89yMr7XkUGxifgodXEEm2f+xW2f9CpDjlgAnBOwhTmrpQMvhOGobLVKUyzf/qHBXW16smk5zbF3nZU6w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@oxc-parser/binding-linux-arm64-musl@0.137.0': + resolution: {integrity: sha512-EGJ+Bs8iXx8KBH8DQ5BLoEm5lnHaYjlh4/8j8vFhrr/6z4tqONy5BZDzLpKmmNWlN6Hlc5r8YOuBVHqZ9vRFEQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@oxc-parser/binding-linux-ppc64-gnu@0.137.0': + resolution: {integrity: sha512-vzFUQENy/fnbSe5DZWovq6tIBc1uhuMztanSW6rz1e9WdQE4gHwYuD7ZII6JnrJifd1R3RSoqiZbgRFlVL2tYQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@oxc-parser/binding-linux-riscv64-gnu@0.137.0': + resolution: {integrity: sha512-SfVI14HBQs9gtLcUD5hTt5hsNbdrqSUNg9S8muN+LhVQ5nf1WwH3hAoK6B9NKgdYgWAQSXFXGiiBedQ4r/BKuw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@oxc-parser/binding-linux-riscv64-musl@0.137.0': + resolution: {integrity: sha512-e7Ppy4FCIFNQxT/ikSeIWFoQ0l+N9vgtRBtLcyZXeolTzApyVoPqEXsYPrcdM/9i0Bwk8knvYd37vaEMxHyi6g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [musl] + + '@oxc-parser/binding-linux-s390x-gnu@0.137.0': + resolution: {integrity: sha512-Bho5qFwdhqsIFR7gipYEUlqvi3SRrY8sugxXig380MIaakBB1PyU9+7dBiBVScfImTNWhijUxdBwqrprGdq5WA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@oxc-parser/binding-linux-x64-gnu@0.137.0': + resolution: {integrity: sha512-36mGWtg7PyFzjJwGDkH6/F4o2nIDEoKXLPr/X/lwqklkomQwJJt1I5GJVmGhovUEmgPK5WAeAZMqlFCehwiy9Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@oxc-parser/binding-linux-x64-musl@0.137.0': + resolution: {integrity: sha512-/Jqx6+N7A44n2BdvUr7pXhVr2vFjs6WGH3unZRczwrfiH0H1zY0QwKQMG/dtRiTlKGDKGukznPT8lx84/oEsZg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [musl] + + '@oxc-parser/binding-openharmony-arm64@0.137.0': + resolution: {integrity: sha512-9Uj0qHNNl+OgT1UTGwF7ixIXU6T1u2SbMidmgPy/h1h/fl2gRS6YpAxxY1gwHofcWjoTwkoMFd8xs5Vuj6GOFA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@oxc-parser/binding-wasm32-wasi@0.137.0': + resolution: {integrity: sha512-gW2vfkytNGgMVADiuzdvOfw0mWG9za20F/1fCJsif5aBMAvWJTSbpIXbIe0XkOe0VENk+PadpQ7cZgUy2sUJcA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [wasm32] + + '@oxc-parser/binding-win32-arm64-msvc@0.137.0': + resolution: {integrity: sha512-x+pFANF0yL5uK/6T7lu6SlR5qid6sp//eZXKLq5iNsIE+EQg6EaS8/wsW7E91nXXjpnPhSoMOHXShSVhGRdn8w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@oxc-parser/binding-win32-ia32-msvc@0.137.0': + resolution: {integrity: sha512-sQUqym80PFi6McRsIqfJrSu2JrSClEZIXXD+/FjAFoULEKzOPsldIdFBG96xdX8aVMzCNQ9792FPx3MfkEIrFA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ia32] + os: [win32] + + '@oxc-parser/binding-win32-x64-msvc@0.137.0': + resolution: {integrity: sha512-2AsevxlvNN4WKxpEn3RtqD5zbqMaXF+T7JXblsP4gVuY+vC9dXS4ED/PwfRCliFqoeisYS3Iro4DHzxr0TEvVA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + + '@oxc-project/types@0.137.0': + resolution: {integrity: sha512-WT+Gb24i8hmvo85AIv2oEYouEXkRlKAlT9WaCa3TfLgNCN+GhrJOGZuIlMouAh38Qe4QOx26eUOVsq70qXrywA==} + + '@oxc-resolver/binding-android-arm-eabi@11.23.0': + resolution: {integrity: sha512-8IJyWRLVAyhTfe9/TIEbQqSQnl5rUqYJrUOS6Dkr+Mq9FGHMxDGeiEmwkBqCvDP5KckpPh/GYSgbag66O6JsCw==} + cpu: [arm] + os: [android] + + '@oxc-resolver/binding-android-arm64@11.23.0': + resolution: {integrity: sha512-pprVojnNhHxupwTT2gdeUlkxll6XEvWWBk3oVicOSNVWQC99OBnDhMQDoirqnzrE1bScQSMS2JgPpqdlrhz/Fg==} + cpu: [arm64] + os: [android] + + '@oxc-resolver/binding-darwin-arm64@11.23.0': + resolution: {integrity: sha512-mbIrWIMAJeytyee36OyUP5XH92TP7FaKaQ2m5AjokKy7STgjrhRt7SMXqpqLjhGm6Xn721Xmsg6H3Rtd9YQETw==} + cpu: [arm64] + os: [darwin] + + '@oxc-resolver/binding-darwin-x64@11.23.0': + resolution: {integrity: sha512-UnIphmZ1LazUCr9DXWaKYWtKDefPMbgLsywaoYxRqVCNHhq4MM6d2q1Nz1i9Vzxt5i+cE2nRUYpAUHr/lijNYA==} + cpu: [x64] + os: [darwin] + + '@oxc-resolver/binding-freebsd-x64@11.23.0': + resolution: {integrity: sha512-aaZ/cSEYFkSxgS2hOrobT6RQcsWNviOX8dW6CEkVx2/UYkAf9MeHbjl3W0usWV53rVV//ndBdn2nb1y7jsu4lw==} + cpu: [x64] + os: [freebsd] + + '@oxc-resolver/binding-linux-arm-gnueabihf@11.23.0': + resolution: {integrity: sha512-IoJLvO5SjLSVMaq83BNTrPCb1FppvoJc1IhZ5CoUVl3PykUBku7D+LK1j0GSurhJcIc6zfjghsvaZNpq5ev6Mg==} + cpu: [arm] + os: [linux] + + '@oxc-resolver/binding-linux-arm-musleabihf@11.23.0': + resolution: {integrity: sha512-vskFpwg44T/LFsfjSCnVZ5ygcuqzPC1yUzVEiKa8BgHAQz0+QLQQW3EGWLPVi8EXFghzjR4EtgPBtOhCjU4jdw==} + cpu: [arm] + os: [linux] + + '@oxc-resolver/binding-linux-arm64-gnu@11.23.0': + resolution: {integrity: sha512-//TcHVhrChyw5RYtgts6WO7KcWq9387c1Z5Zvhqpk/ktAbyaRYgBZrpSY1GDCFq50ASt6B6jhh+JxB1rB45IAg==} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@oxc-resolver/binding-linux-arm64-musl@11.23.0': + resolution: {integrity: sha512-ZFqlwiTf7CXLLSGyAR9tYiO33LiaeIEXW+xm42d8mnUGpDgPltyrCGYtQezyMMEXvjhOgCz1X+i7sbDTJEx+bg==} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@oxc-resolver/binding-linux-ppc64-gnu@11.23.0': + resolution: {integrity: sha512-oZ5LeN5+H1R19dRjTAxKrxQguH+AsemHcnthEfFxf4OjmBSty2doHLeSmMunKy3zpTHJQ3lh3Af+dNS+W6dYeA==} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@oxc-resolver/binding-linux-riscv64-gnu@11.23.0': + resolution: {integrity: sha512-O4ciFDyX5ebQd0qkb1bjAIg8IEfiLT03GbSeylwlwlUMK9KwBWaALwrxSbc0Msaz4U6iPj+T9eRXpD5mxBfmvA==} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@oxc-resolver/binding-linux-riscv64-musl@11.23.0': + resolution: {integrity: sha512-P3o8Y9kISYjcxadmbO+94ThRwLhwGuDAbA7dcdd4+YLpfeF+mmobz8fXf4NmSdfSqjyRSkceJDBRZha9NVYkiQ==} + cpu: [riscv64] + os: [linux] + libc: [musl] + + '@oxc-resolver/binding-linux-s390x-gnu@11.23.0': + resolution: {integrity: sha512-oj03m1E3RmTFczKhcKJDzHaEDKJnPIsDcQFVxBJsSdXGSuIPdt5TvcM332FfMQgzI6yDJqyl4InrnFfXrmUTKQ==} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@oxc-resolver/binding-linux-x64-gnu@11.23.0': + resolution: {integrity: sha512-BqJxbSC8FdP7mSuSpRePTGHm0hXWV+dfz//f7SjsteZncLaBgWTBmi/OZNv7sX6CyG/Pt/eJkPorP+DkMOhMwQ==} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@oxc-resolver/binding-linux-x64-musl@11.23.0': + resolution: {integrity: sha512-utmw+VmUrW4K8LI5/6jhg4aGYKJHOIjQ9syYOOA6pF3w7haKu4r4enTe2U0C04/HbUvkq/Zif43xFsKW1Pnq9w==} + cpu: [x64] + os: [linux] + libc: [musl] + + '@oxc-resolver/binding-openharmony-arm64@11.23.0': + resolution: {integrity: sha512-V6lbRrthHa4TbvsLjPtg+EkXT1tRY+s4I8rYLXUfiHlZzGx3sLv1EH9CEOOevjvUYHLsbe/gqCIc73XnQfPb9A==} + cpu: [arm64] + os: [openharmony] + + '@oxc-resolver/binding-wasm32-wasi@11.23.0': + resolution: {integrity: sha512-gRoOxQPdnAmIAjxcuQNBxfihvx+wjTaQM/9/eP12xwnGNawOG/+Zz9RHN4WNSxT45b5CrscK4NB8aPh+oZQXAQ==} + engines: {node: '>=14.0.0'} + cpu: [wasm32] + + '@oxc-resolver/binding-win32-arm64-msvc@11.23.0': + resolution: {integrity: sha512-CgTGMYsJVe1eUiCdJTpGw21svXw79ITsemN1h0hcNkiswasDbN5MoibSLY+gRMWP5syfEz5iffrjZnwEP8xeUA==} + cpu: [arm64] + os: [win32] + + '@oxc-resolver/binding-win32-x64-msvc@11.23.0': + resolution: {integrity: sha512-gUGJpr+Rn6zMxm5juApV0K3U845i8t47o8k+rbO0BHbi4PoJIfSPeQmrE2dgohQm2g5k6iviNFyXCGqvmaYUpw==} + cpu: [x64] + os: [win32] + '@pkgjs/parseargs@0.11.0': resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} @@ -349,17 +625,8 @@ packages: '@sinclair/typebox@0.34.52': resolution: {integrity: sha512-XiMQh7qqVlxZzcVD+kkGMNGMzcTrDMLWI7S4x7z1MkCkbDPrekpZXEUK0eZqZFMuHQg2a2DZOcDIh9o5v3Gonw==} - '@tsconfig/node10@1.0.12': - resolution: {integrity: sha512-UCYBaeFvM11aU2y3YPZ//O5Rhj+xKyzy7mvcIoAjASbigy8mHMryP5cK7dgjlz2hWxh1g5pLw084E0a/wlUSFQ==} - - '@tsconfig/node12@1.0.11': - resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} - - '@tsconfig/node14@1.0.3': - resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} - - '@tsconfig/node16@1.0.4': - resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} + '@tybys/wasm-util@0.10.3': + resolution: {integrity: sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==} '@types/estree@0.0.39': resolution: {integrity: sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==} @@ -434,22 +701,90 @@ packages: resolution: {integrity: sha512-uqi/2aSz9g2ftcHWf8uLPJA70rUv6yuMW5Bohw+bwcuzaxQIHaKFZCKGoGXIrc9vkTJ3+0txM73K0Hq3d5wgIg==} engines: {node: ^8.10.0 || ^10.13.0 || >=11.10.1} - abbrev@1.1.1: - resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} + '@ungap/set-methods@0.1.1': + resolution: {integrity: sha512-xLmZUmhWaRjzUVRldAHjUcW+++6RNXtUEJU4NZi1/xybONq7PA4ZagNmEyel0lOjpPuf/E8c+uLsT3Z4DzEjPw==} - accepts@1.3.8: - resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} - engines: {node: '>= 0.6'} + '@webassemblyjs/ast@1.14.1': + resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==} + + '@webassemblyjs/floating-point-hex-parser@1.13.2': + resolution: {integrity: sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==} + + '@webassemblyjs/helper-api-error@1.13.2': + resolution: {integrity: sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==} + + '@webassemblyjs/helper-buffer@1.14.1': + resolution: {integrity: sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==} + + '@webassemblyjs/helper-numbers@1.13.2': + resolution: {integrity: sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==} + + '@webassemblyjs/helper-wasm-bytecode@1.13.2': + resolution: {integrity: sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==} + + '@webassemblyjs/helper-wasm-section@1.14.1': + resolution: {integrity: sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==} + + '@webassemblyjs/ieee754@1.13.2': + resolution: {integrity: sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==} + + '@webassemblyjs/leb128@1.13.2': + resolution: {integrity: sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==} + + '@webassemblyjs/utf8@1.13.2': + resolution: {integrity: sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==} + + '@webassemblyjs/wasm-edit@1.14.1': + resolution: {integrity: sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==} + + '@webassemblyjs/wasm-gen@1.14.1': + resolution: {integrity: sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==} + + '@webassemblyjs/wasm-opt@1.14.1': + resolution: {integrity: sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==} + + '@webassemblyjs/wasm-parser@1.14.1': + resolution: {integrity: sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==} + + '@webassemblyjs/wast-printer@1.14.1': + resolution: {integrity: sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==} + + '@webpack-cli/configtest@2.1.1': + resolution: {integrity: sha512-wy0mglZpDSiSS0XHrVR+BAdId2+yxPSoJW8fsna3ZpYSlufjvxnP4YbKTCBZnNIcGN4r6ZPXV55X4mYExOfLmw==} + engines: {node: '>=14.15.0'} + peerDependencies: + webpack: 5.x.x + webpack-cli: 5.x.x + + '@webpack-cli/info@2.0.2': + resolution: {integrity: sha512-zLHQdI/Qs1UyT5UBdWNqsARasIA+AaF8t+4u2aS2nEpBQh2mWIVb8qAklq0eUENnC5mOItrIB4LiS9xMtph18A==} + engines: {node: '>=14.15.0'} + peerDependencies: + webpack: 5.x.x + webpack-cli: 5.x.x + + '@webpack-cli/serve@2.0.5': + resolution: {integrity: sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ==} + engines: {node: '>=14.15.0'} + peerDependencies: + webpack: 5.x.x + webpack-cli: 5.x.x + webpack-dev-server: '*' + peerDependenciesMeta: + webpack-dev-server: + optional: true + + '@xtuc/ieee754@1.2.0': + resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==} + + '@xtuc/long@4.2.2': + resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==} acorn-jsx@5.3.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - acorn-walk@8.3.5: - resolution: {integrity: sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw==} - engines: {node: '>=0.4.0'} - acorn@7.4.1: resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==} engines: {node: '>=0.4.0'} @@ -460,9 +795,13 @@ packages: engines: {node: '>=0.4.0'} hasBin: true - agent-base@4.3.0: - resolution: {integrity: sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==} - engines: {node: '>= 4.0.0'} + ajv-formats@2.1.1: + resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} + + ajv-keywords@5.1.0: + resolution: {integrity: sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==} + peerDependencies: + ajv: ^8.8.2 ajv@6.15.0: resolution: {integrity: sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==} @@ -536,9 +875,6 @@ packages: application-config@0.1.2: resolution: {integrity: sha512-Ryjni0MtYYW9Qz2iTIMF5B/4uRJV3dt5f7PYgQ7sjTh3BUf4EvOo83F84Z2//2HP+mUbwRw35/W1jhM5EZhk9Q==} - arg@4.1.3: - resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} - argparse@1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} @@ -549,14 +885,6 @@ packages: resolution: {integrity: sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==} engines: {node: '>= 0.4'} - array-each@1.0.1: - resolution: {integrity: sha512-zHjL5SZa68hkKHBFBK6DJCTtr9sfTCPCaph/L7tMSLcTFgy+zX7E+6q5UArbtOtMBCtxdICpfTCspRse+ywyXA==} - engines: {node: '>=0.10.0'} - - array-slice@1.1.0: - resolution: {integrity: sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==} - engines: {node: '>=0.10.0'} - array-to-sentence@1.1.0: resolution: {integrity: sha512-YkwkMmPA2+GSGvXj1s9NZ6cc2LBtR+uSeWTy2IGi5MR1Wag4DdrcjTxA/YV/Fw+qKlBeXomneZgThEbm/wvZbw==} @@ -579,9 +907,6 @@ packages: resolution: {integrity: sha512-Fh9zh3G2mZ8qM/kwsiKwL2U2FmXxVsboP4x1mXjnhKHv3SmzaBZoYvxEQJz/YS2gnCgd8xlAVWcZnQyC9qZBsA==} engines: {node: '>=0.4.9'} - asn1@0.2.6: - resolution: {integrity: sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==} - assert-fs-readfile-option@1.0.1: resolution: {integrity: sha512-bESFgerRqZpPcFWBW/cXl0l1XQVLPFi80i31S6eYLIzksnNKdTKBlMoC7Dy/FWAj/97XIYhpe2CmVogifnEkMw==} @@ -589,10 +914,6 @@ packages: resolution: {integrity: sha512-brU24g7ryhRwGCI2y+1dGQmQXiZF7TtIj583S96y0jjdajIe6wn8BuXyELYhvD22dtIxDQVFk04YTJwwdwOYJw==} engines: {node: '>=0.8'} - assert-plus@1.0.0: - resolution: {integrity: sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==} - engines: {node: '>=0.8'} - assert-valid-glob-opts@1.0.0: resolution: {integrity: sha512-/mttty5Xh7wE4o7ttKaUpBJl0l04xWe3y6muy1j27gyzSsnceK0AYU9owPtUoL9z8+9hnPxztmuhdFZ7jRoyWw==} @@ -610,15 +931,9 @@ packages: async@0.2.10: resolution: {integrity: sha512-eAkdoKxU6/LkKDBzLpT+t6Ff5EtfSF4wx1WfJiPEEV7WNLnDaRXk0oVysiEPm262roaachGexwUv94WhSgN5TQ==} - async@1.5.2: - resolution: {integrity: sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w==} - async@3.2.6: resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==} - asynckit@0.4.0: - resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - autoprefixer@6.7.7: resolution: {integrity: sha512-WKExI/eSGgGAkWAO+wMVdFObZV7hQen54UpD1kCCTN3tvlL3W1jL4+lPP/M7MwoP7Q4RHzKtO3JQ4HxYEcd+xQ==} @@ -626,15 +941,9 @@ packages: resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} engines: {node: '>= 0.4'} - aws-sign2@0.7.0: - resolution: {integrity: sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==} - aws-sign@0.3.0: resolution: {integrity: sha512-pEMJAknifcXqXqYVXzGPIu8mJvxtJxIdpVpAs8HNS+paT+9srRUDMQn+3hULS7WbLmttcmvgMvnDcFujqXJyPw==} - aws4@1.13.2: - resolution: {integrity: sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==} - balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -642,15 +951,10 @@ packages: resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==} engines: {node: 18 || 20 || >=22} - basic-auth@2.0.1: - resolution: {integrity: sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==} - engines: {node: '>= 0.8'} - - batch@0.6.1: - resolution: {integrity: sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==} - - bcrypt-pbkdf@1.0.2: - resolution: {integrity: sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==} + baseline-browser-mapping@2.11.1: + resolution: {integrity: sha512-HYXq73DDpCtNzOmrFsm9eSwCvWCql0RzqjpDzXN9EadiLJ4DNat0nsZ/Bzmy+Ud12mb4/zKDY0cQ805ZzN+i0A==} + engines: {node: '>=6.0.0'} + hasBin: true benchmark@2.1.4: resolution: {integrity: sha512-l9MlfN4M1K/H2fbhfMy3B7vJd6AGKJVQn2h6Sg/Yx+KckoUA7ewS5Vv6TjSq18ooE1kS9hhAlQRH3AkXIh/aOQ==} @@ -659,6 +963,9 @@ packages: resolution: {integrity: sha512-USzYxODdVfOS7JuQq/L0naxB788dWCiUgUTxvN+WLPt/JfcDURNNj8kN/N+uK6PDvuR67/9/55cVKGPleFQINA==} engines: {node: '>=12'} + bitset@5.2.3: + resolution: {integrity: sha512-uZ7++Z60MC9cZ+7YzQ1v9yPDydcjhmcMjGx2yoGTjjSXBoVMmTr2LCRbkpI19S9P/C75hhP7Bsakj+gVzVUDbQ==} + bl@0.9.5: resolution: {integrity: sha512-njlCs8XLBIK7LCChTWfzWuIAxkpmmLXcL7/igCofFT1B039Sz0IPnAmosN5QaO22lU4qr8LcUz2ojUlE6pLkRQ==} @@ -696,6 +1003,11 @@ packages: deprecated: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools. hasBin: true + browserslist@4.28.7: + resolution: {integrity: sha512-JxV13hNrFxqjOc8alRbq9dK1MM79NEXYpma2B2J4wAtpWS5zIEIKqWPGCl7N4o7Uc7B7itylh7SuDujATRyyTw==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} @@ -736,8 +1048,8 @@ packages: caniuse-db@1.0.30001805: resolution: {integrity: sha512-DQGAXJBLZExxLCy6tmU4BUPb4wO43+Wx9EzfCwR3o6MPNQog1wPa7PV/rjA1rcqYI9s7hQZ9Mg5fo3hdQ/uZsw==} - caseless@0.12.0: - resolution: {integrity: sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==} + caniuse-lite@1.0.30001806: + resolution: {integrity: sha512-72Cuvd95zbSYPKq6Fhg8eDJRlzgWDf7/mtoZv6Qe/DYNCEBdNxoA3+rZAU2ZhGCpZlns3EssFavaZomckT5Uuw==} chai@4.5.0: resolution: {integrity: sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==} @@ -755,12 +1067,20 @@ packages: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} + chalk@5.6.2: + resolution: {integrity: sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + chardet@0.7.0: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} check-error@1.0.3: resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} + chrome-trace-event@1.0.4: + resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==} + engines: {node: '>=6.0'} + clean-css@5.3.3: resolution: {integrity: sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==} engines: {node: '>= 10.0'} @@ -783,6 +1103,10 @@ packages: resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} engines: {node: '>=12'} + clone-deep@4.0.1: + resolution: {integrity: sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==} + engines: {node: '>=6'} + color-convert@1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} @@ -796,21 +1120,27 @@ packages: color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + color-name@2.0.2: + resolution: {integrity: sha512-9vEt7gE16EW7Eu7pvZnR0abW9z6ufzhXxGXZEVU9IqPdlsUiMwJeJfRtq0zePUmnbHGT9zajca7mX8zgoayo4A==} + engines: {node: '>=12.20'} + + colorette@2.0.20: + resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} + colors@0.5.1: resolution: {integrity: sha512-XjsuUwpDeY98+yz959OlUK6m7mLBM+1MEG5oaenfuQnNnrQk1WvtcvFgN3FNDP3f2NmZ211t0mNEfSEN1h0eIg==} engines: {node: '>=0.1.90'} - colors@1.1.2: - resolution: {integrity: sha512-ENwblkFQpqqia6b++zLD/KUWafYlVY/UNnAp7oz7LY7E924wmpye416wBOmvv/HMWzl8gL1kJlfvId/1Dg176w==} - engines: {node: '>=0.1.90'} + combinate@1.1.11: + resolution: {integrity: sha512-+2MNAQ29HtNejOxkgaTQPC2Bm+pQvFuqf7o18uObl/Bx3daX06kjLUNY/qa9f+YSqzqm/ic3SdrlfN0fvTlw2g==} combined-stream@0.0.7: resolution: {integrity: sha512-qfexlmLp9MyrkajQVyjEDb0Vj+KhRgR/rxLiVhaihlT+ZkX0lReqtH6Ack40CvMDERR4b5eFp3CreskpBs1Pig==} engines: {node: '>= 0.8'} - combined-stream@1.0.8: - resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} - engines: {node: '>= 0.8'} + commander@10.0.1: + resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} + engines: {node: '>=14'} commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -829,25 +1159,12 @@ packages: concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - connect-livereload@0.5.4: - resolution: {integrity: sha512-3KnRwsWf4VmP01I4hCDQqTc4e2UxOvJIi8i08GiwqX2oymzxNFY7PqjFkwHglYTJ0yzUJkO5yqdPxVaIz3Pbug==} - - connect@3.7.0: - resolution: {integrity: sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==} - engines: {node: '>= 0.10.0'} - convert-source-map@2.0.0: resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} cookie-jar@0.3.0: resolution: {integrity: sha512-dX1400pzPULr+ZovkIsDEqe7XH8xCAYGT5Dege4Eot44Qs2mS2iJmnh45TxTO5MIsCfrV/JGZVloLhm46AHxNw==} - copy-anything@2.0.6: - resolution: {integrity: sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==} - - core-util-is@1.0.2: - resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==} - core-util-is@1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} @@ -860,9 +1177,6 @@ packages: typescript: optional: true - create-require@1.1.1: - resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} - cross-env@7.0.3: resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==} engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'} @@ -885,9 +1199,8 @@ packages: resolution: {integrity: sha512-T6CEkoSV4q50zW3TlTHMbzy1E5+zlnNcY+yb7tWVYlTwPhx9LpnfAkd4wecpWknDyptp4k97LUZeInlf6jdzBg==} engines: {node: '>= 0.4'} - dashdash@1.14.1: - resolution: {integrity: sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==} - engines: {node: '>=0.10'} + data-structure-typed@2.0.5: + resolution: {integrity: sha512-L/huLz6qr+vBdpp1NK4Rp44HHiI3sRughHBfETdO4PgcQ5qkYWPK2G6dBkpphvW4enkl8NSjXFdvTissK3FEaQ==} data-view-buffer@1.0.2: resolution: {integrity: sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==} @@ -901,21 +1214,6 @@ packages: resolution: {integrity: sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==} engines: {node: '>= 0.4'} - date-time@1.1.0: - resolution: {integrity: sha512-RrxZQ06cdKe7YQ5oqIxs3GMc7W3vXscy7Ds+aZIqmxA59QnVtTiCseA4jbzVUub9xCbo9GuYVZo0OrZLYXnnmw==} - engines: {node: '>=0.10.0'} - - dateformat@4.6.3: - resolution: {integrity: sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==} - - debug@2.6.9: - resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - debug@3.2.6: resolution: {integrity: sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==} deprecated: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) @@ -925,14 +1223,6 @@ packages: supports-color: optional: true - debug@3.2.7: - resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - debug@4.4.3: resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} engines: {node: '>=6.0'} @@ -969,26 +1259,6 @@ packages: resolution: {integrity: sha512-v+7uBd1pqe5YtgPacIIbZ8HuHeLFVNe4mUEyFDXL6KiqzEykjbw+5mXZXpGFgNVasdL4jWKgaKIXrEHiynN1LA==} engines: {node: '>=0.4.0'} - delayed-stream@1.0.0: - resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} - engines: {node: '>=0.4.0'} - - depd@1.1.2: - resolution: {integrity: sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==} - engines: {node: '>= 0.6'} - - depd@2.0.0: - resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} - engines: {node: '>= 0.8'} - - destroy@1.2.0: - resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==} - engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} - - detect-file@1.0.0: - resolution: {integrity: sha512-DtCOLG98P007x7wiiOmfI0fi3eIKyWiLTGJ2MDnVi/E04lWGbf+JzrRHMm0rgIIZJGtHpKpbVgLWHrv8xXpc3Q==} - engines: {node: '>=0.10.0'} - didyoumean@1.2.2: resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==} @@ -996,10 +1266,6 @@ packages: resolution: {integrity: sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==} engines: {node: '>=0.3.1'} - diff@4.0.4: - resolution: {integrity: sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==} - engines: {node: '>=0.3.1'} - dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -1018,15 +1284,12 @@ packages: eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - ecc-jsbn@0.1.2: - resolution: {integrity: sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==} - - ee-first@1.1.1: - resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} - electron-to-chromium@1.5.389: resolution: {integrity: sha512-cEto7aeOqBfU1D+c5py5pE+ooscKE75JifxLBdFUZsqAxRS6y7kebtxAZvICszSl05gPjYHDTjY+lXpyGvpJbg==} + electron-to-chromium@1.5.396: + resolution: {integrity: sha512-yHiw2Y3C3H9U6TMbOfoWK/BPreiOPXRfTWPBwQBoZG6/8TB6eOPnsy5oaRYuatR7Fw2SJ4kKforgufeo7fq0EQ==} + emoji-regex@7.0.3: resolution: {integrity: sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==} @@ -1036,13 +1299,9 @@ packages: emoji-regex@9.2.2: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} - encodeurl@1.0.2: - resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==} - engines: {node: '>= 0.8'} - - encodeurl@2.0.0: - resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==} - engines: {node: '>= 0.8'} + enhanced-resolve@5.24.3: + resolution: {integrity: sha512-PwKooW9JUzh5chmYfHM3IQl5OkK2u2Nm011MgeZrss3JmFraUx/fqrf78kk8GUMYoibx/14MdwTl/1WKkG7TpQ==} + engines: {node: '>=10.13.0'} enquirer@2.4.1: resolution: {integrity: sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==} @@ -1052,8 +1311,9 @@ packages: resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==} engines: {node: '>=6'} - errno@0.1.8: - resolution: {integrity: sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==} + envinfo@7.21.0: + resolution: {integrity: sha512-Lw7I8Zp5YKHFCXL7+Dz95g4CcbMEpgvqZNNq3AmlT5XAV6CgAAk6gyAMqn2zjw08K9BHfcNuKrMiCPLByGafow==} + engines: {node: '>=4'} hasBin: true error-ex@1.3.4: @@ -1078,6 +1338,9 @@ packages: resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} engines: {node: '>= 0.4'} + es-module-lexer@2.3.1: + resolution: {integrity: sha512-shc1dbU90Yl/xq1QrC7QRtfcwURZuVRfPhZbDoldJ1cn1gzDvBaBWlv0eFolj5+0znnPJz5TXLxsN77X/12KTA==} + es-object-atoms@1.1.2: resolution: {integrity: sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==} engines: {node: '>= 0.4'} @@ -1090,19 +1353,10 @@ packages: resolution: {integrity: sha512-yPDz7wqpg1/mmHLmS3tcfTfbw5f1eryXvyghYBffGdERwe+mV7ZcWzTR8LR17Kvqt3qfPurjlonmnq3MKXIOXw==} engines: {node: '>= 0.4'} - es6-promise@4.2.8: - resolution: {integrity: sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==} - - es6-promisify@5.0.0: - resolution: {integrity: sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==} - escalade@3.2.0: resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} engines: {node: '>=6'} - escape-html@1.0.3: - resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} - escape-string-regexp@1.0.5: resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} engines: {node: '>=0.8.0'} @@ -1177,36 +1431,14 @@ packages: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} - etag@1.8.1: - resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} - engines: {node: '>= 0.6'} - - eventemitter2@0.4.14: - resolution: {integrity: sha512-K7J4xq5xAD5jHsGM5ReWXRTFa3JRGofHiMcVgQ8PRwgWxzjHpMWCIzsmyf60+mh8KLsqYPcjUMa0AC4hd6lPyQ==} - - exit-x@0.2.2: - resolution: {integrity: sha512-+I6B/IkJc1o/2tiURyz/ivu/O0nKNEArIUB5O7zBrlDVJr22SCLH3xTeEry428LvFhRzIA1g8izguxJ/gbNcVQ==} - engines: {node: '>= 0.8.0'} - - exit@0.1.2: - resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==} - engines: {node: '>= 0.8.0'} - - expand-tilde@2.0.2: - resolution: {integrity: sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==} - engines: {node: '>=0.10.0'} - - extend@3.0.2: - resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} + events@3.3.0: + resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} + engines: {node: '>=0.8.x'} external-editor@3.1.0: resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} engines: {node: '>=4'} - extsprintf@1.3.0: - resolution: {integrity: sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==} - engines: {'0': node >=0.6.0} - fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} @@ -1223,16 +1455,13 @@ packages: fast-uri@3.1.3: resolution: {integrity: sha512-i70LwGWUduXqzicKXWshooq+sWL1K3WUU5rKZNG/0i3a1OSoX3HqhH5WbWwTmqWfor4urUakGPiRQcleRZTwOg==} + fastest-levenshtein@1.0.16: + resolution: {integrity: sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==} + engines: {node: '>= 4.9.1'} + fastq@1.20.1: resolution: {integrity: sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==} - fg-lodash@0.0.2: - resolution: {integrity: sha512-3jf21fWKb/qCM+frhdQX6/KT7sn12i5T6K7952/hKpOdK5uzYbZbEwJmWjrgrSzc74iXFtrtbHPD2mMywPkB9A==} - - figures@1.7.0: - resolution: {integrity: sha512-UxKlfCRuCBxSXU4C6t9scbDyWZ4VlaFFdojKtzJuSkuOBQ5CNFum+zZXFwHjo+CxBC1t6zlYPgHIgFjL8ggoEQ==} - engines: {node: '>=0.10.0'} - figures@3.2.0: resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==} engines: {node: '>=8'} @@ -1245,14 +1474,6 @@ packages: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} - finalhandler@1.1.2: - resolution: {integrity: sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==} - engines: {node: '>= 0.8'} - - find-cache-dir@3.3.2: - resolution: {integrity: sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==} - engines: {node: '>=8'} - find-up@3.0.0: resolution: {integrity: sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==} engines: {node: '>=6'} @@ -1265,22 +1486,6 @@ packages: resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} engines: {node: '>=10'} - findup-sync@4.0.0: - resolution: {integrity: sha512-6jvvn/12IC4quLBL1KNokxC7wWTvYncaVUYSoxWw7YykPLuRrnv4qdHcSOywOI5RpkOVGeQRtWM8/q+G6W6qfQ==} - engines: {node: '>= 8'} - - findup-sync@5.0.0: - resolution: {integrity: sha512-MzwXju70AuyflbgeOhzvQWAvvQdo1XL0A9bVvlXsYcFEBM87WR4OakL4OfZq+QRmr+duJubio+UtNQCPsVESzQ==} - engines: {node: '>= 10.13.0'} - - fined@1.2.0: - resolution: {integrity: sha512-ZYDqPLGxDkDhDZBjZBb+oD1+j0rA4E0pXY50eplAAOPg2N/gUBSSk5IM1/QhPfyVo19lJ+CvXpqfvk+b2p/8Ng==} - engines: {node: '>= 0.10'} - - flagged-respawn@1.0.1: - resolution: {integrity: sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==} - engines: {node: '>= 0.10'} - flat-cache@3.2.0: resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} engines: {node: ^10.12.0 || >=12.0.0} @@ -1289,6 +1494,10 @@ packages: resolution: {integrity: sha512-FmTtBsHskrU6FJ2VxCnsDb84wu9zhmO3cUX2kGFb5tuwhfXxGciiT0oRY+cck35QmG+NmGh5eLz6lLCpWTqwpA==} hasBin: true + flat@5.0.2: + resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} + hasBin: true + flatted@3.4.2: resolution: {integrity: sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==} @@ -1296,14 +1505,6 @@ packages: resolution: {integrity: sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==} engines: {node: '>= 0.4'} - for-in@1.0.2: - resolution: {integrity: sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==} - engines: {node: '>=0.10.0'} - - for-own@1.0.0: - resolution: {integrity: sha512-0OABksIGrxKK8K4kynWkQ7y1zounQxP+CWnyclVwj81KW3vlLlGUx57DKGcP/LH216GzqnstnPocF16Nxs0Ycg==} - engines: {node: '>=0.10.0'} - foreach@2.0.6: resolution: {integrity: sha512-k6GAGDyqLe9JaebCsFCoudPPWfihKu8pylYXRlqP1J7ms39iPoTtk2fviNglIeQEwdh0bQeKJ01ZPyuyQvKzwg==} @@ -1314,21 +1515,10 @@ packages: forever-agent@0.5.2: resolution: {integrity: sha512-PDG5Ef0Dob/JsZUxUltJOhm/Y9mlteAE+46y3M9RBz/Rd3QVENJ75aGRhN56yekTUboaBIkd8KVWX2NjF6+91A==} - forever-agent@0.6.1: - resolution: {integrity: sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==} - form-data@0.0.8: resolution: {integrity: sha512-yzpBIhe8Ll+dYTXjd+4ORxbQktke+abD0dJjedvqsVVayMkb+PgLGatJNLwo95Va75l3YDZ01SrouzyW9bC2Fg==} engines: {node: '>= 0.6'} - form-data@2.3.3: - resolution: {integrity: sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==} - engines: {node: '>= 0.12'} - - fresh@0.5.2: - resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} - engines: {node: '>= 0.6'} - fs-extra@10.1.0: resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==} engines: {node: '>=12'} @@ -1386,19 +1576,9 @@ packages: resolution: {integrity: sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==} engines: {node: '>= 0.4'} - getobject@1.0.2: - resolution: {integrity: sha512-2zblDBaFcb3rB4rF77XVnuINOE2h2k/OnqXAiy0IrTxUfV1iFp3la33oAQVY9pCpWU268WFYVt2t71hlMuLsOg==} - engines: {node: '>=10'} - - getpass@0.1.7: - resolution: {integrity: sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==} - ghauth@3.0.0: resolution: {integrity: sha512-Ds/q5leXoYu8e+MUJyI1C2mqcvdQ4iTzoOM2WN/p9sh/Z0r609dPUq7mLNa0CoGeKdmesyUmVJOAJeWxQ3tcag==} - git-rev@0.2.1: - resolution: {integrity: sha512-p6OU8kZpeGHYqGpwnSD5/8IIERooiQp0p6On3T7ngcugnjhbmihvgMwCK2iun8ytn7FynsCPN+jRclR29hgOBg==} - github-changes@1.1.2: resolution: {integrity: sha512-S4lzHQHyPSyHm22JjE+Vsyr8/d797NPmYYpBqwfkPj9qHIbSwENoqKngyfGbaVbmPFTeE6QMgDbcX12TWy+fpg==} hasBin: true @@ -1435,22 +1615,10 @@ packages: resolution: {integrity: sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==} deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me - glob@7.1.7: - resolution: {integrity: sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==} - deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me - glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me - global-modules@1.0.0: - resolution: {integrity: sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==} - engines: {node: '>=0.10.0'} - - global-prefix@1.0.2: - resolution: {integrity: sha512-5lsx1NUDHtSjfg0eHlmYvZKv8/nVqX4ckFbM+FrGcQ+04KWcWFo9P5MxPZYSzUvyzmdTbI7Eix8Q4IbELDqzKg==} - engines: {node: '>=0.10.0'} - globals@13.24.0: resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} engines: {node: '>=8'} @@ -1478,71 +1646,6 @@ packages: resolution: {integrity: sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==} engines: {node: '>=4.x'} - grunt-cli@1.5.0: - resolution: {integrity: sha512-rILKAFoU0dzlf22SUfDtq2R1fosChXXlJM5j7wI6uoW8gwmXDXzbUvirlKZSYCdXl3LXFbR+8xyS+WFo+b6vlA==} - engines: {node: '>=10'} - hasBin: true - - grunt-contrib-clean@1.1.0: - resolution: {integrity: sha512-tET+TYTd8vCtKeGwbLjoH8+SdI8ngVzGbPr7vlWkewG7mYYHIccd2Ldxq+PK3DyBp5Www3ugdkfsjoNKUl5MTg==} - engines: {node: '>= 0.10.0'} - peerDependencies: - grunt: '>=0.4.5' - - grunt-contrib-connect@1.0.2: - resolution: {integrity: sha512-7OPoyfGrpOYzuiRPzGyzWDe/xFcjttXe1ztVSFS8TAVBtpfXeeOV9RiwuyqA4yN1UeOG2Pnpx8s0DcUDAu21Gw==} - engines: {node: '>=0.10.0'} - peerDependencies: - grunt: '>=0.4.0' - - grunt-eslint@23.0.0: - resolution: {integrity: sha512-QqHSAiGF08EVD7YlD4OSRWuLRaDvpsRdTptwy9WaxUXE+03mCLVA/lEaR6SHWehF7oUwIqCEjaNONeeeWlB4LQ==} - engines: {node: '>=10'} - peerDependencies: - grunt: '>=1' - - grunt-known-options@2.0.0: - resolution: {integrity: sha512-GD7cTz0I4SAede1/+pAbmJRG44zFLPipVtdL9o3vqx9IEyb7b4/Y3s7r6ofI3CchR5GvYJ+8buCSioDv5dQLiA==} - engines: {node: '>=0.10.0'} - - grunt-legacy-log-utils@2.1.3: - resolution: {integrity: sha512-sgG+QvKmdb44wZyzJP+ejDsy3jYxG2wzohpol+JTMlXqMUBDoZb01JPQ5jKAedtZBFwhmABAc88T9hEBLy3U+Q==} - engines: {node: '>=10'} - - grunt-legacy-log@3.0.1: - resolution: {integrity: sha512-vytI3IUC8qUK9TcvvpHpGJzDojua/sfJV4TdLB4FtCFzospqduzBuL3+dEfpvO+tGECv7/273+33hjjMXSa92g==} - engines: {node: '>= 0.10.0'} - - grunt-legacy-util@2.0.2: - resolution: {integrity: sha512-0xoDILyR4BVJel5uJwnhjdWN9evOQ8A0uXbQUIJ0hgVthIA6kloXHSoqATQPj6BRrHrHkcQtCeGVb0ixFoHyEQ==} - engines: {node: '>=10'} - - grunt-saucelabs@9.0.1: - resolution: {integrity: sha512-3WD5/RtSp8AyEnmtN5HK1NUkU7o/kBl6rGQILnfg7WHTe0g0uG3LtecWPwTRYrD7kop79WkDfeVQ85WjvwDUZw==} - engines: {node: '>=0.6', npm: '>=1.2.12'} - peerDependencies: - grunt: '>=0.4.1' - - grunt-shell@1.3.1: - resolution: {integrity: sha512-fqiC5NNNTCKwH3TCbYpNkNUgq1/cEYJp59tedtWv83sGeG0PTmVB7Lbo/m0WQug3MngV6lsYAXvoNflDD1oeQg==} - engines: {node: '>=0.10.0'} - peerDependencies: - grunt: '>=0.4.0' - - grunt@1.6.2: - resolution: {integrity: sha512-bUzh5nA/P5L66ihXTDP6J5BGnMB/8lXJXejYWSbH4Y4TvWM9t2S39sggQDYYQlx06cYcCsmu63HMYHGCIzUVfg==} - engines: {node: '>=16'} - hasBin: true - - har-schema@2.0.0: - resolution: {integrity: sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==} - engines: {node: '>=4'} - - har-validator@5.1.5: - resolution: {integrity: sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==} - engines: {node: '>=6'} - deprecated: this library is no longer supported - has-ansi@2.0.0: resolution: {integrity: sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==} engines: {node: '>=0.10.0'} @@ -1601,13 +1704,6 @@ packages: engines: {node: '>=0.8.0'} deprecated: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial). - homedir-polyfill@1.0.3: - resolution: {integrity: sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==} - engines: {node: '>=0.10.0'} - - hooker@0.2.3: - resolution: {integrity: sha512-t+UerCsQviSymAInD01Pw+Dn/usmz1sRO+3Zk1+lx8eg+WKpD2ulcwWqHHL0+aseRBr+3+vIhiG1K1JTwaIcTA==} - hosted-git-info@2.8.9: resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} @@ -1620,31 +1716,10 @@ packages: html-template-tag@3.2.0: resolution: {integrity: sha512-dt/21zLAVPBB3M4j6dCE46LyG8PcHHIUTYiBTIRDw1yg4nGaVbKEVHVsm3BpeJzlSB6n9BrcW6kP4zJE9mS3ew==} - http-errors@1.8.1: - resolution: {integrity: sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==} - engines: {node: '>= 0.6'} - - http-errors@2.0.1: - resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==} - engines: {node: '>= 0.8'} - http-signature@0.10.1: resolution: {integrity: sha512-coK8uR5rq2IMj+Hen+sKPA5ldgbCc1/spPdKCL1Fw6h+D0s/2LzMcRK0Cqufs1h0ryx/niwBHGFu8HC3hwU+lA==} engines: {node: '>=0.8'} - http-signature@1.2.0: - resolution: {integrity: sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==} - engines: {node: '>=0.8', npm: '>=1.3.7'} - - http2@3.3.7: - resolution: {integrity: sha512-puSi8M8WNlFJm9Pk4c/Mbz9Gwparuj3gO9/RRO5zv6piQ0FY+9Qywp0PdWshYgsMJSalixFY7eC6oPu0zRxLAQ==} - engines: {node: '>=0.12.0 <9.0.0'} - deprecated: Use the built-in module in node 9.0.0 or newer, instead - - https-proxy-agent@2.2.4: - resolution: {integrity: sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==} - engines: {node: '>= 4.5.0'} - husky@9.1.7: resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==} engines: {node: '>=18'} @@ -1657,10 +1732,6 @@ packages: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} - iconv-lite@0.6.3: - resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} - engines: {node: '>=0.10.0'} - ignore@4.0.6: resolution: {integrity: sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==} engines: {node: '>= 4'} @@ -1669,15 +1740,15 @@ packages: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} - image-size@0.5.5: - resolution: {integrity: sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==} - engines: {node: '>=0.10.0'} - hasBin: true - import-fresh@3.3.1: resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==} engines: {node: '>=6'} + import-local@3.2.0: + resolution: {integrity: sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==} + engines: {node: '>=8'} + hasBin: true + imurmurhash@0.1.4: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} @@ -1695,9 +1766,6 @@ packages: inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - ini@1.3.8: - resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} - inquirer@7.3.3: resolution: {integrity: sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==} engines: {node: '>=8.0.0'} @@ -1709,16 +1777,13 @@ packages: resolution: {integrity: sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==} engines: {node: '>= 0.4'} - interpret@1.1.0: - resolution: {integrity: sha512-CLM8SNMDu7C5psFCn6Wg/tgpj/bKAg7hc2gWqcuR9OD5Ft9PhBpIu8PLicPeis+xDd6YX2ncI8MCA64I9tftIA==} - interpret@1.4.0: resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==} engines: {node: '>= 0.10'} - is-absolute@1.0.0: - resolution: {integrity: sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==} - engines: {node: '>=0.10.0'} + interpret@3.1.1: + resolution: {integrity: sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==} + engines: {node: '>=10.13.0'} is-array-buffer@3.0.5: resolution: {integrity: sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==} @@ -1771,10 +1836,6 @@ packages: resolution: {integrity: sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==} engines: {node: '>= 0.4'} - is-finite@1.1.0: - resolution: {integrity: sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==} - engines: {node: '>=0.10.0'} - is-fullwidth-code-point@2.0.0: resolution: {integrity: sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==} engines: {node: '>=4'} @@ -1828,10 +1889,6 @@ packages: resolution: {integrity: sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==} engines: {node: '>= 0.4'} - is-relative@1.0.0: - resolution: {integrity: sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==} - engines: {node: '>=0.10.0'} - is-set@2.0.3: resolution: {integrity: sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==} engines: {node: '>= 0.4'} @@ -1852,13 +1909,6 @@ packages: resolution: {integrity: sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==} engines: {node: '>= 0.4'} - is-typedarray@1.0.0: - resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==} - - is-unc-path@1.0.0: - resolution: {integrity: sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==} - engines: {node: '>=0.10.0'} - is-weakmap@2.0.2: resolution: {integrity: sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==} engines: {node: '>= 0.4'} @@ -1871,13 +1921,6 @@ packages: resolution: {integrity: sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==} engines: {node: '>= 0.4'} - is-what@3.14.1: - resolution: {integrity: sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==} - - is-windows@1.0.2: - resolution: {integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==} - engines: {node: '>=0.10.0'} - is@0.2.7: resolution: {integrity: sha512-ajQCouIvkcSnl2iRdK70Jug9mohIHVX9uKpoWnl115ov0R5mzBvRrXxrnHbsA+8AdwCwc/sfw7HXmd4I5EJBdQ==} @@ -1894,9 +1937,6 @@ packages: resolution: {integrity: sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==} engines: {node: '>=0.10.0'} - isstream@0.1.2: - resolution: {integrity: sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==} - istanbul-lib-coverage@3.2.2: resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==} engines: {node: '>=8'} @@ -1924,11 +1964,9 @@ packages: resolution: {integrity: sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw==} engines: {node: '>= 6'} - jit-grunt@0.10.0: - resolution: {integrity: sha512-eT/f4c9wgZ3buXB7X1JY1w6uNtAV0bhrbOGf/mFmBb0CDNLUETJ/VRoydayWOI54tOoam0cz9RooVCn3QY1WoA==} - engines: {node: '>=0.10.0'} - peerDependencies: - grunt: '>=0.4.0' + jest-worker@27.5.1: + resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} + engines: {node: '>= 10.13.0'} js-base64@2.6.4: resolution: {integrity: sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==} @@ -1940,10 +1978,6 @@ packages: resolution: {integrity: sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==} hasBin: true - js-yaml@3.14.2: - resolution: {integrity: sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==} - hasBin: true - js-yaml@3.15.0: resolution: {integrity: sha512-ttBQIIQPDeLjpPOohtUdXuXUVoA2uIB6fEH9HyJ7234s5mBJ5wTx20njxplLZQgLaOfpmPQA7X2t5AX6tIPbog==} hasBin: true @@ -1952,9 +1986,6 @@ packages: resolution: {integrity: sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==} hasBin: true - jsbn@0.1.1: - resolution: {integrity: sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==} - json-buffer@3.0.1: resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} @@ -1974,18 +2005,12 @@ packages: json-schema-traverse@1.0.0: resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} - json-schema@0.4.0: - resolution: {integrity: sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==} - json-stable-stringify-without-jsonify@1.0.1: resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} json-stringify-safe@4.0.0: resolution: {integrity: sha512-qzEpz1SDUb9xvA+LDOkNgjekdV7tuC7zDQf14sqMBtujh8kVbQhF11VWm4DeR99yFNjVSjTTfKa40c9ZQOtwXA==} - json-stringify-safe@5.0.1: - resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==} - json2csv@5.0.7: resolution: {integrity: sha512-YRZbUnyaJZLZUJSRi2G/MqahCyRv9n/ds+4oIetjDF3jWQA7AG7iSeKTiZiCNqtMZM7HDyt0e/W6lEnoGEmMGA==} engines: {node: '>= 10', npm: '>= 6.13.0'} @@ -2002,10 +2027,6 @@ packages: resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==} engines: {'0': node >= 0.2.0} - jsprim@1.4.2: - resolution: {integrity: sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==} - engines: {node: '>=0.6.0'} - keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} @@ -2017,6 +2038,9 @@ packages: resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} engines: {node: '>=6'} + known-css-properties@0.37.0: + resolution: {integrity: sha512-JCDrsP4Z1Sb9JwG0aJ8Eo2r7k4Ou5MwmThS/6lcIe1ICyb7UBJKGRIUUdqc2ASdE/42lgz6zFUnzAIhtXnBVrQ==} + less-plugin-autoprefix@1.5.1: resolution: {integrity: sha512-l++6pbkvw8XSD1soqugslzAaz0/YFrWXgc+PGo/EhLCjRo9zJfda2hFPLBSYrRDl62dTeDbN93Kx+1dvnHnkIw==} engines: {node: '>=0.4.2'} @@ -2029,9 +2053,9 @@ packages: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} engines: {node: '>= 0.8.0'} - liftup@3.0.1: - resolution: {integrity: sha512-yRHaiQDizWSzoXk3APcA71eOI/UuhEkNN9DiW2Tt44mhYzX4joFoCZlxsSOF7RyeLlfqzFLQI1ngFq3ggMPhOw==} - engines: {node: '>=10'} + linecraft@0.2.6: + resolution: {integrity: sha512-soXv8qKLqsAA3Ws9HDwrf6VlLUHHKBqLplHVJ/HVhWH5Oakgr5iZmsiKX7eC2VMdZxFaxhLxDsAmiCjLvKPZlQ==} + engines: {node: '>=18.0.0'} lines-and-columns@1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} @@ -2052,6 +2076,9 @@ packages: resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} engines: {node: '>=10'} + lodash-es@4.18.1: + resolution: {integrity: sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A==} + lodash.get@4.4.2: resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==} deprecated: This package is deprecated. Use the optional chaining (?.) operator instead. @@ -2066,10 +2093,6 @@ packages: resolution: {integrity: sha512-qa6QqjA9jJB4AYw+NpD2GI4dzHL6Mv0hL+By6iIul4Ce0C1refrjZJmcGvWdnLUwl4LIPtvzje3UQfGH+nCEsQ==} engines: {'0': node, '1': rhino} - lodash@2.4.2: - resolution: {integrity: sha512-Kak1hi6/hYHGVPmdyiZijoQyz5x2iGVzs6w9GYB/HiXEtylY7tIoYEROMjvM1d9nXJqPOrG2MNPMn01bJ+S0Rw==} - engines: {'0': node, '1': rhino} - lodash@4.18.1: resolution: {integrity: sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==} @@ -2094,29 +2117,13 @@ packages: magic-string@0.25.9: resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==} - make-dir@2.1.0: - resolution: {integrity: sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==} - engines: {node: '>=6'} - - make-dir@3.1.0: - resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} - engines: {node: '>=8'} + magic-string@0.30.21: + resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} make-dir@4.0.0: resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} engines: {node: '>=10'} - make-error@1.3.6: - resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} - - make-iterator@1.0.1: - resolution: {integrity: sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==} - engines: {node: '>=0.10.0'} - - map-cache@0.2.2: - resolution: {integrity: sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==} - engines: {node: '>=0.10.0'} - math-intrinsics@1.1.0: resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} engines: {node: '>= 0.4'} @@ -2136,22 +2143,13 @@ packages: resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} engines: {node: '>=8.6'} - mime-db@1.52.0: - resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} - engines: {node: '>= 0.6'} - - mime-types@2.1.35: - resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + mime-db@1.54.0: + resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==} engines: {node: '>= 0.6'} mime@1.2.11: resolution: {integrity: sha512-Ysa2F/nqTNGHhhm9MV8ure4+Hc+Y8AWiqUdHxsO7xu8zc92ND9f3kpALHjaP026Ft17UfxrMt95c50PLUeynBw==} - mime@1.6.0: - resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} - engines: {node: '>=4'} - hasBin: true - mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} @@ -2173,6 +2171,49 @@ packages: minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + minimizer-webpack-plugin@5.6.1: + resolution: {integrity: sha512-DoeAZz8Q1C1znwsUzej1fdoi4jCf7/+Em27ouLqfK/+3m8G+D7yDhUwrc3CNhjSzGUN1kn7Iv4sWmjflQHenpw==} + engines: {node: '>= 10.13.0'} + peerDependencies: + '@minify-html/node': '*' + '@swc/core': '*' + '@swc/css': '*' + '@swc/html': '*' + clean-css: '*' + cssnano: '*' + csso: '*' + esbuild: '*' + html-minifier-terser: '*' + lightningcss: '*' + postcss: '*' + uglify-js: '*' + webpack: ^5.1.0 + peerDependenciesMeta: + '@minify-html/node': + optional: true + '@swc/core': + optional: true + '@swc/css': + optional: true + '@swc/html': + optional: true + clean-css: + optional: true + cssnano: + optional: true + csso: + optional: true + esbuild: + optional: true + html-minifier-terser: + optional: true + lightningcss: + optional: true + postcss: + optional: true + uglify-js: + optional: true + minipass@7.1.3: resolution: {integrity: sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==} engines: {node: '>=16 || 14 >=14.17'} @@ -2203,13 +2244,6 @@ packages: moment@2.30.1: resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==} - morgan@1.11.0: - resolution: {integrity: sha512-zSkVu3t18r39pw4ixfBKvfZi3y2UOqr7d4WYwcj3m8nXpEQK4rPO6GLzs/CExoRgmX3y9EjmmcXqv6jq0SK46g==} - engines: {node: '>= 0.8.0'} - - ms@2.0.0: - resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} - ms@2.1.1: resolution: {integrity: sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==} @@ -2222,14 +2256,8 @@ packages: natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - needle@3.5.0: - resolution: {integrity: sha512-jaQyPKKk2YokHrEg+vFDYxXIHTCBgiZwSHOoVx/8V3GIBS8/VN6NdVRmg8q1ERtPkMvmOvebsgga4sAj5hls/w==} - engines: {node: '>= 4.4.x'} - hasBin: true - - negotiator@0.6.3: - resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==} - engines: {node: '>= 0.6'} + neo-async@2.6.2: + resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} nice-try@1.0.5: resolution: {integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==} @@ -2249,6 +2277,10 @@ packages: node-promise@0.5.14: resolution: {integrity: sha512-kbd+ABY2XRdByRVHPcBDemymfNL8+msGyKNxG/ziZnh9RjneuuGQl3/CE5UkNWxCInkJS+ztc5B31/t2kIO4Yw==} + node-releases@2.0.51: + resolution: {integrity: sha512-wRNIrw4DmVLKQlbgOMdkMx27Wrpzes2hh5Jtbi2bjPd+4wJstWIqP5A+lscnqbm0xxmT5Bpg8Lec5ItEBwx6BQ==} + engines: {node: '>=18'} + node-uuid@1.4.8: resolution: {integrity: sha512-TkCET/3rr9mUuRp+CpO7qfgT++aAxfDRaalQhwPFzI9BY/2rCDn6OfpZOVggi1AXfTPpfkTrg5f5WQx5G1uLxA==} deprecated: Use uuid module instead @@ -2261,11 +2293,6 @@ packages: nop@1.0.0: resolution: {integrity: sha512-XdkOuXGx0DTwlqb0DWTcDqelgU/F3YyZ+PTRaecpDVpkYskcnh3OeUYKfvjcRQ2D1diTIGxi/a3eHVjW5yPupQ==} - nopt@5.0.0: - resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} - engines: {node: '>=6'} - hasBin: true - normalize-package-data@2.5.0: resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} @@ -2278,27 +2305,12 @@ packages: engines: {node: '>= 4'} hasBin: true - npm-run-path@1.0.0: - resolution: {integrity: sha512-PrGAi1SLlqNvKN5uGBjIgnrTb8fl0Jz0a3JJmeMcGnIBh7UE9Gc4zsAMlwDajOMg2b1OgP6UPvoLUboTmMZPFA==} - engines: {node: '>=0.10.0'} - num2fraction@1.2.2: resolution: {integrity: sha512-Y1wZESM7VUThYY+4W+X4ySH2maqcA+p7UR+w8VWNWVAd6lwuXXWz/w/Cz43J/dI2I+PS6wD5N+bJUF+gjWvIqg==} - number-is-nan@1.0.1: - resolution: {integrity: sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==} - engines: {node: '>=0.10.0'} - oauth-sign@0.3.0: resolution: {integrity: sha512-Tr31Sh5FnK9YKm7xTUPyDMsNOvMqkVDND0zvK/Wgj7/H9q8mpye0qG2nVzrnsvLhcsX5DtqXD0la0ks6rkPCGQ==} - oauth-sign@0.9.0: - resolution: {integrity: sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==} - - object-assign@4.1.1: - resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} - engines: {node: '>=0.10.0'} - object-inspect@1.13.4: resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} engines: {node: '>= 0.4'} @@ -2319,34 +2331,10 @@ packages: resolution: {integrity: sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==} engines: {node: '>= 0.4'} - object.defaults@1.1.0: - resolution: {integrity: sha512-c/K0mw/F11k4dEUBMW8naXUuBuhxRCfG7W+yFy8EcijU/rSmazOUd1XAEEe6bC0OuXY4HUKjTJv7xbxIMqdxrA==} - engines: {node: '>=0.10.0'} - object.getownpropertydescriptors@2.1.9: resolution: {integrity: sha512-mt8YM6XwsTTovI+kdZdHSxoyF2DI59up034orlC9NfweclcWOt7CVascNNLp6U+bjFVCVCIh9PwS76tDM/rH8g==} engines: {node: '>= 0.4'} - object.map@1.0.1: - resolution: {integrity: sha512-3+mAJu2PLfnSVGHwIWubpOFLscJANBKuB/6A4CxBstc4aqwQY0FWcsppuy4jU5GSB95yES5JHSI+33AWuS4k6w==} - engines: {node: '>=0.10.0'} - - object.pick@1.3.0: - resolution: {integrity: sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==} - engines: {node: '>=0.10.0'} - - on-finished@2.3.0: - resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==} - engines: {node: '>= 0.8'} - - on-finished@2.4.1: - resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} - engines: {node: '>= 0.8'} - - on-headers@1.1.0: - resolution: {integrity: sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A==} - engines: {node: '>= 0.8'} - once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} @@ -2354,10 +2342,6 @@ packages: resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} engines: {node: '>=6'} - opn@4.0.2: - resolution: {integrity: sha512-iPBWbPP4OEOzR1xfhpGLDh+ypKBOygunZhM9jBtA7FS5sKjEiMZw0EFb82hnDOmTZX90ZWLoZKUza4cVt8MexA==} - engines: {node: '>=0.10.0'} - optionator@0.9.4: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} @@ -2370,6 +2354,13 @@ packages: resolution: {integrity: sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==} engines: {node: '>= 0.4'} + oxc-parser@0.137.0: + resolution: {integrity: sha512-yFImD+WLElJpLKy8llG1qe4DCmMsL18peRp8XP1JKfig/gISbJkglnpDtX2aTmAn10kZF7164HbN2H8QPsXxGg==} + engines: {node: ^20.19.0 || >=22.12.0} + + oxc-resolver@11.23.0: + resolution: {integrity: sha512-f0+l598CJMOLnYPXsXxttJALH0ljtivdRMKtvHhxRuWa5FYmw5+qODARl8oYjMC/brpzKcrpdORsOBrTqhBZ9A==} + p-limit@2.3.0: resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} engines: {node: '>=6'} @@ -2401,10 +2392,6 @@ packages: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} - parse-filepath@1.0.2: - resolution: {integrity: sha512-FwdRXKCohSVeXqwtYonZTXtbGJKrn+HNyWDYVcp5yuJlesTwNH4rsmRZ+GrKAPJ5bLpRxESMeS+Rl0VCHRvB2Q==} - engines: {node: '>=0.8'} - parse-json@4.0.0: resolution: {integrity: sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==} engines: {node: '>=4'} @@ -2416,21 +2403,16 @@ packages: parse-link-header@0.1.0: resolution: {integrity: sha512-VZ0pZwX3LRTfpDARULYD2C0fHuQqg7TPSGmPoKEHfBBmBhH7KMG3LV27GkUtjezoixE/CCJNAVnNw54IxkskWg==} - parse-ms@1.0.1: - resolution: {integrity: sha512-LpH1Cf5EYuVjkBvCDBYvkUPh+iv2bk3FHflxHkpCYT0/FZ1d3N3uJaLiHr4yGuMcFUhv6eAivitTvWZI4B/chg==} - engines: {node: '>=0.10.0'} - parse-node-version@1.0.1: resolution: {integrity: sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==} engines: {node: '>= 0.10'} - parse-passwd@1.0.0: - resolution: {integrity: sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==} - engines: {node: '>=0.10.0'} + parseman@0.41.0: + resolution: {integrity: sha512-7WDnKzwh4H4sVmQxvRW2PvX2vw76OuEX1LwzxDpSDmE57ymQif87uCJJGoL23fTxgaUoB8/2RoJ0aOredS16ig==} + engines: {node: ^20.19.0 || >=22.12.0} - parseurl@1.3.3: - resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} - engines: {node: '>= 0.8'} + path-browserify@1.0.1: + resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} path-exists@3.0.0: resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==} @@ -2444,10 +2426,6 @@ packages: resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} engines: {node: '>=0.10.0'} - path-key@1.0.0: - resolution: {integrity: sha512-T3hWy7tyXlk3QvPFnT+o2tmXRzU4GkitkUWLp/WZ0S/FXd7XMx176tRurgTvHTNMJOQzTcesHNpBqetH86mQ9g==} - engines: {node: '>=0.10.0'} - path-key@2.0.1: resolution: {integrity: sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==} engines: {node: '>=4'} @@ -2459,14 +2437,6 @@ packages: path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - path-root-regex@0.1.2: - resolution: {integrity: sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ==} - engines: {node: '>=0.10.0'} - - path-root@0.1.1: - resolution: {integrity: sha512-QLcPegTHF11axjfojBIoDygmS2E3Lf+8+jI6wOVmNVenrKSo3mFdSGiIgdSHenczw3wPtlVMQaFVwGmM7BJdtg==} - engines: {node: '>=0.10.0'} - path-scurry@1.11.1: resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} engines: {node: '>=16 || 14 >=14.18'} @@ -2494,13 +2464,6 @@ packages: performance-now@0.2.0: resolution: {integrity: sha512-YHk5ez1hmMR5LOkb9iJkLKqoBlL7WD5M8ljC75ZfzXriuBIVNuecaXuU7e+hOwyqf24Wxhh7Vxgt7Hnw9288Tg==} - performance-now@2.1.0: - resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==} - - phin@2.9.3: - resolution: {integrity: sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==} - deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. - picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} @@ -2508,6 +2471,10 @@ packages: resolution: {integrity: sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==} engines: {node: '>=8.6'} + picomatch@4.0.5: + resolution: {integrity: sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==} + engines: {node: '>=12'} + pidtree@0.3.1: resolution: {integrity: sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==} engines: {node: '>=0.10'} @@ -2517,22 +2484,10 @@ packages: resolution: {integrity: sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==} engines: {node: '>=4'} - pify@4.0.1: - resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} - engines: {node: '>=6'} - pify@5.0.0: resolution: {integrity: sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA==} engines: {node: '>=10'} - pinkie-promise@2.0.1: - resolution: {integrity: sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==} - engines: {node: '>=0.10.0'} - - pinkie@2.0.4: - resolution: {integrity: sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==} - engines: {node: '>=0.10.0'} - pkg-dir@4.2.0: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} @@ -2550,14 +2505,6 @@ packages: engines: {node: '>=18'} hasBin: true - plur@1.0.0: - resolution: {integrity: sha512-qSnKBSZeDY8ApxwhfVIwKwF36KVJqb1/9nzYYq3j3vdwocULCXT8f8fQGkiw1Nk9BGfxiDagEe/pwakA+bOBqw==} - engines: {node: '>=0.10.0'} - - portscanner@1.2.0: - resolution: {integrity: sha512-3MCx40XO6ChNJJHw1tTFukQK/M/8FacGZK/vGbnrKpozObrJzembYtfi7ZdA2hkF2Lojg77XhsKUPvF8eHKcDA==} - engines: {node: '>=0.4', npm: '>=1.0.0'} - possible-typed-array-names@1.1.0: resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==} engines: {node: '>= 0.4'} @@ -2582,10 +2529,6 @@ packages: resolution: {integrity: sha512-D1tKtYvByrBkFLe2wHJl2bwMJIiT8rW+XA+TiataH79/FszLQMrpGEvzUVkzPau7OCO0Qnrhpe87PqtOAIB8Yw==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - pretty-ms@2.1.0: - resolution: {integrity: sha512-H2enpsxzDhuzRl3zeSQpQMirn8dB0Z/gxW96j06tMfTviUWvX14gjKb7qd1gtkUyYhDPuoNe00K5PqNvy2oQNg==} - engines: {node: '>=0.10.0'} - progress@2.0.3: resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==} engines: {node: '>=0.4.0'} @@ -2593,29 +2536,18 @@ packages: promise@7.3.1: resolution: {integrity: sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==} - prr@1.0.1: - resolution: {integrity: sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==} - - psl@1.15.0: - resolution: {integrity: sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==} + punycode@1.4.1: + resolution: {integrity: sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==} punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} - q@1.4.1: - resolution: {integrity: sha512-/CdEdaw49VZVmyIDGUQKDDT53c7qBkO6g5CefWz91Ae+l4+cRtcDYwMTXh6me4O8TMldeGHG3N2Bl84V78Ywbg==} - engines: {node: '>=0.6.0', teleport: '>=0.2.0'} - deprecated: |- - You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other. - - (For a CapTP with native promises, see @endo/eventual-send and @endo/captp) - qs@0.6.6: resolution: {integrity: sha512-kN+yNdAf29Jgp+AYHUmC7X4QdJPR8czuMWLNLc0aRxkQ7tB3vJQEONKKT9ou/rW7EbqVec11srC9q9BiVbcnHA==} - qs@6.5.5: - resolution: {integrity: sha512-mzR4sElr1bfCaPJe7m8ilJ6ZXdDaGoObcYR0ZHSsktM/Lt21MVHj5De30GQH2eiZ1qGRTO7LCAzQsUeXTNexWQ==} + qs@6.15.3: + resolution: {integrity: sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==} engines: {node: '>=0.6'} queue-microtask@1.2.3: @@ -2624,10 +2556,6 @@ packages: randombytes@2.1.0: resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} - range-parser@1.2.1: - resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==} - engines: {node: '>= 0.6'} - react-is@18.3.1: resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==} @@ -2652,9 +2580,9 @@ packages: resolution: {integrity: sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==} engines: {node: '>= 0.10'} - rechoir@0.7.1: - resolution: {integrity: sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==} - engines: {node: '>= 0.10'} + rechoir@0.8.0: + resolution: {integrity: sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==} + engines: {node: '>= 10.13.0'} reflect.getprototypeof@1.0.10: resolution: {integrity: sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==} @@ -2673,14 +2601,6 @@ packages: engines: {'0': node >= 0.8.0} deprecated: request has been deprecated, see https://github.com/request/request/issues/3142 - request@2.88.2: - resolution: {integrity: sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==} - engines: {node: '>= 6'} - deprecated: request has been deprecated, see https://github.com/request/request/issues/3142 - - requestretry@1.9.1: - resolution: {integrity: sha512-DWXDuj4syXribRStpt4qMOSBhDBUarreeoHol9sOdBfDG1BBDwBFfhgxCyDZkdQ+1W9mZm94vwEg8eD3p46tOg==} - require-directory@2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} @@ -2692,16 +2612,17 @@ packages: require-main-filename@2.0.0: resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==} - resolve-dir@1.0.1: - resolution: {integrity: sha512-R7uiTjECzvOsWSfdM0QKFNBVFcK27aHOUwdvK53BcW8zqnGdYp0Fbj82cy54+2A4P2tFM22J5kRfe1R+lM/1yg==} - engines: {node: '>=0.10.0'} + resolve-cwd@3.0.0: + resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} + engines: {node: '>=8'} resolve-from@4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} - resolve@1.17.0: - resolution: {integrity: sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==} + resolve-from@5.0.0: + resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} + engines: {node: '>=8'} resolve@1.22.12: resolution: {integrity: sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==} @@ -2716,11 +2637,6 @@ packages: resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - rimraf@2.7.1: - resolution: {integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==} - deprecated: Rimraf versions prior to v4 are no longer supported - hasBin: true - rimraf@3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} deprecated: Rimraf versions prior to v4 are no longer supported @@ -2732,12 +2648,6 @@ packages: peerDependencies: rollup: '>=0.66.0 <3' - rollup-plugin-typescript2@0.29.0: - resolution: {integrity: sha512-YytahBSZCIjn/elFugEGQR5qTsVhxhUwGZIsA9TmrSsC88qroGo65O5HZP/TTArH2dm0vUmYWhKchhwi2wL9bw==} - peerDependencies: - rollup: '>=1.26.3' - typescript: '>=2.4.0' - rollup-pluginutils@2.8.2: resolution: {integrity: sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==} @@ -2761,9 +2671,6 @@ packages: resolution: {integrity: sha512-wtZlHyOje6OZTGqAoaDKxFkgRtkF9CnHAVnCHKfuj200wAgL+bSJhdsCD2l0Qx/2ekEXjPWcyKkfGb5CPboslg==} engines: {node: '>=0.4'} - safe-buffer@5.1.2: - resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} - safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} @@ -2778,15 +2685,9 @@ packages: safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - sauce-tunnel@2.5.0: - resolution: {integrity: sha512-NsE6r9J+nXT9FBcAxA+nZ1JvmoJJqQPTp33J4vTJQFZ4jtFfPoUMH10AXyIhjEFVemK7XP5SF4Uy+q3dKWWQig==} - - saucelabs@1.5.0: - resolution: {integrity: sha512-jlX3FGdWvYf4Q3LFfFWS1QvPg3IGCGWxIc8QBFdPTbpTJnt/v17FHXYVAn7C8sHf1yUXo2c7yIM0isDryfYtHQ==} - - sax@1.6.0: - resolution: {integrity: sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==} - engines: {node: '>=11.0.0'} + schema-utils@4.3.3: + resolution: {integrity: sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==} + engines: {node: '>= 10.13.0'} semver@5.4.1: resolution: {integrity: sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==} @@ -2805,21 +2706,9 @@ packages: engines: {node: '>=10'} hasBin: true - send@0.19.2: - resolution: {integrity: sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==} - engines: {node: '>= 0.8.0'} - serialize-javascript@4.0.0: resolution: {integrity: sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==} - serve-index@1.9.2: - resolution: {integrity: sha512-KDj11HScOaLmrPxl70KYNW1PksP4Nb/CLL2yvC+Qd2kHMPEEpfc4Re2e4FOay+bC/+XQl/7zAcWON3JVo5v3KQ==} - engines: {node: '>= 0.8.0'} - - serve-static@1.16.3: - resolution: {integrity: sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==} - engines: {node: '>= 0.8.0'} - set-blocking@2.0.0: resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} @@ -2835,8 +2724,9 @@ packages: resolution: {integrity: sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==} engines: {node: '>= 0.4'} - setprototypeof@1.2.0: - resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} + shallow-clone@3.0.1: + resolution: {integrity: sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==} + engines: {node: '>=8'} shebang-command@1.2.0: resolution: {integrity: sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==} @@ -2931,28 +2821,9 @@ packages: spdx-license-ids@3.0.23: resolution: {integrity: sha512-CWLcCCH7VLu13TgOH+r8p1O/Znwhqv/dbb6lqWy67G+pT1kHmeD/+V36AVb/vq8QMIQwVShJ6Ssl5FPh0fuSdw==} - split@1.0.1: - resolution: {integrity: sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==} - sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} - sprintf-js@1.1.3: - resolution: {integrity: sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==} - - sshpk@1.18.0: - resolution: {integrity: sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==} - engines: {node: '>=0.10.0'} - hasBin: true - - statuses@1.5.0: - resolution: {integrity: sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==} - engines: {node: '>= 0.6'} - - statuses@2.0.2: - resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==} - engines: {node: '>= 0.8'} - stop-iteration-iterator@1.1.0: resolution: {integrity: sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==} engines: {node: '>= 0.4'} @@ -3024,6 +2895,14 @@ packages: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} + styles-config@2.0.0-alpha.11: + resolution: {integrity: sha512-dQLDY+RssWLUZCt0aF7Ra/hBAnOTwyWi22Msh+VrQ0/Gw+gX7dEid4VumrIVjESCxb3XPTsaRNBhxSy61dYSPA==} + engines: {node: ^20.19.0 || >=22.12.0} + + superstruct@1.0.3: + resolution: {integrity: sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg==} + engines: {node: '>=14.0.0'} + supports-color@2.0.0: resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==} engines: {node: '>=0.8.0'} @@ -3048,6 +2927,10 @@ packages: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} + supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + supports-preserve-symlinks-flag@1.0.0: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} @@ -3056,11 +2939,20 @@ packages: resolution: {integrity: sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A==} engines: {node: '>=10.0.0'} + tapable@2.3.3: + resolution: {integrity: sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==} + engines: {node: '>=6'} + terser@4.8.1: resolution: {integrity: sha512-4GnLC0x667eJG0ewJTa6z/yXrbLGv80D9Ru6HIpCQmO+Q4PfEtBFi0ObSckqwL6VyQv/7ENJieXHo2ANmdQwgw==} engines: {node: '>=6.0.0'} hasBin: true + terser@5.49.0: + resolution: {integrity: sha512-SNiDnXyHSrxVcIOtVbULzcTmniUiwcV7Nwdyj1twVubeTmbjoa8p69KKDpfkdoOavuM4/GRm1+ykI8qqnavHoA==} + engines: {node: '>=10'} + hasBin: true + test-exclude@7.0.2: resolution: {integrity: sha512-u9E6A+ZDYdp7a4WnarkXPZOx8Ilz46+kby6p1yZ8zsGTz9gYa6FIS7lj2oezzNKmtdyyJNNmmXDppga5GB7kSw==} engines: {node: '>=18'} @@ -3074,14 +2966,6 @@ packages: through@2.3.8: resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} - time-grunt@1.4.0: - resolution: {integrity: sha512-u8n+ZOcdNDkrqlyN+x1ayHN0X+hMgg3SS191EE5xO03nRVnVpNp3UJSmUBCQCAbe959LqWttMaELNclfmWM+fQ==} - engines: {node: '>=0.10.0'} - - time-zone@0.1.0: - resolution: {integrity: sha512-S5CjtVIkeBTnlsaZP3gjsTb78ClBe74sEcgEoBwAVUKnTRDAGqUtLLIZHMsIyqOWjt9DGQpLMMoD8ZKIfP2ddQ==} - engines: {node: '>=0.10.0'} - tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} @@ -3090,37 +2974,12 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} - toidentifier@1.0.1: - resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} - engines: {node: '>=0.6'} - - tough-cookie@2.5.0: - resolution: {integrity: sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==} - engines: {node: '>=0.8'} - tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - ts-node@10.9.2: - resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} - hasBin: true - peerDependencies: - '@swc/core': '>=1.2.50' - '@swc/wasm': '>=1.2.50' - '@types/node': '*' - typescript: '>=2.7' - peerDependenciesMeta: - '@swc/core': - optional: true - '@swc/wasm': - optional: true - tslib@1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} - tslib@2.0.1: - resolution: {integrity: sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==} - tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} @@ -3133,12 +2992,6 @@ packages: tunnel-agent@0.3.0: resolution: {integrity: sha512-jlGqHGoKzyyjhwv/c9omAgohntThMcGtw8RV/RDLlkbbc08kni/akVxO62N8HaXMVbVsK1NCnpSK3N2xCt22ww==} - tunnel-agent@0.6.0: - resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==} - - tweetnacl@0.14.5: - resolution: {integrity: sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==} - type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -3171,9 +3024,9 @@ packages: resolution: {integrity: sha512-phPGCwqr2+Qo0fwniCE8e4pKnGu/yFb5nD5Y8bf0EEeiI5GklnACYA9GFy/DrAeRrKHXvHn+1SUsOWgJp6RO+g==} engines: {node: '>= 0.4'} - typescript@4.9.5: - resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} - engines: {node: '>=4.2.0'} + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + engines: {node: '>=14.17'} hasBin: true uikit@2.27.4: @@ -3183,16 +3036,6 @@ packages: resolution: {integrity: sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==} engines: {node: '>= 0.4'} - unc-path-regex@0.1.2: - resolution: {integrity: sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg==} - engines: {node: '>=0.10.0'} - - underscore.string@2.3.3: - resolution: {integrity: sha512-hbD5MibthuDAu4yA5wxes5bzFgqd3PpBJuClbRxaNddxfdsz+qf+1kHwrGQFrmchmDHb9iNU+6EHDn8uj0xDJg==} - - underscore.string@3.3.6: - resolution: {integrity: sha512-VoC83HWXmCrF6rgkyxS9GHv8W9Q5nhMKho+OadDJGzL2oDYbYEppBaCMH6pFlwLeqj2QS+hhkw2kpXkSdD1JxQ==} - underscore@1.4.4: resolution: {integrity: sha512-ZqGrAgaqqZM7LGRzNjLnw5elevWb5M8LEoDMadxIW3OWbcv72wMMgKdwOKpd5Fqxe8choLD8HN3iSj3TUh/giQ==} @@ -3207,27 +3050,22 @@ packages: resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} engines: {node: '>= 10.0.0'} - unpipe@1.0.0: - resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} - engines: {node: '>= 0.8'} + unplugin@3.0.0: + resolution: {integrity: sha512-0Mqk3AT2TZCXWKdcoaufeXNukv2mTrEZExeXlHIOZXdqYoHHr4n51pymnwV8x2BOVxwXbK2HLlI7usrqMpycdg==} + engines: {node: ^20.19.0 || >=22.12.0} + + update-browserslist-db@1.2.3: + resolution: {integrity: sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} - util-deprecate@1.0.2: - resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - - utils-merge@1.0.1: - resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} - engines: {node: '>= 0.4.0'} - - uuid@3.4.0: - resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==} - deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028). - hasBin: true - - v8-compile-cache-lib@3.0.1: - resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} + url@0.11.4: + resolution: {integrity: sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg==} + engines: {node: '>= 0.4'} v8-compile-cache@2.4.0: resolution: {integrity: sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==} @@ -3236,29 +3074,60 @@ packages: resolution: {integrity: sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==} engines: {node: '>=10.12.0'} - v8flags@4.0.1: - resolution: {integrity: sha512-fcRLaS4H/hrZk9hYwbdRM35D0U8IYMfEClhXxCivOojl+yTRAZH3Zy2sSy6qVCiGbV9YAtPssP6jaChqC9vPCg==} - engines: {node: '>= 10.13.0'} - validate-glob-opts@1.0.2: resolution: {integrity: sha512-3PKjRQq/R514lUcG9OEiW0u9f7D4fP09A07kmk1JbNn2tfeQdAHhlT+A4dqERXKu2br2rrxSM3FzagaEeq9w+A==} validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} - verror@1.10.0: - resolution: {integrity: sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==} - engines: {'0': node >=0.6.0} + watchpack@2.5.2: + resolution: {integrity: sha512-6i/00NBjP4yGPs+caKSyRfpTF/8Torsu0MOW3mMzIbhgISFder8i7xbqgHlLMwJrdiN8ndBV3UA1/AfzPSr+jg==} + engines: {node: '>=10.13.0'} webidl-conversions@3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + webpack-cli@5.1.4: + resolution: {integrity: sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==} + engines: {node: '>=14.15.0'} + hasBin: true + peerDependencies: + '@webpack-cli/generators': '*' + webpack: 5.x.x + webpack-bundle-analyzer: '*' + webpack-dev-server: '*' + peerDependenciesMeta: + '@webpack-cli/generators': + optional: true + webpack-bundle-analyzer: + optional: true + webpack-dev-server: + optional: true + + webpack-merge@5.10.0: + resolution: {integrity: sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==} + engines: {node: '>=10.0.0'} + + webpack-sources@3.5.1: + resolution: {integrity: sha512-jyuiGJdtvY434z5bUZrjz67v76/ePNvFZTp9Mdz29IlH4+GPsgyGjiv0fKI+M7BdkU6ADjulUcKAd3tUK3WlEw==} + engines: {node: '>=10.13.0'} + + webpack-virtual-modules@0.6.2: + resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==} + + webpack@5.109.0: + resolution: {integrity: sha512-vomrngskVVXEZF9sMZfYAd4pXZUnfaWdJGlF+BTNF+gJBCKYCQBnOeVPlrh39Ewl7nlCsirDplMy6o5g9xJHBg==} + engines: {node: '>=10.13.0'} + hasBin: true + peerDependencies: + webpack-cli: '*' + peerDependenciesMeta: + webpack-cli: + optional: true + whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} - when@3.7.8: - resolution: {integrity: sha512-5cZ7mecD3eYcMiCH4wtRPA5iFJZ50BJYDfckI5RRpQiktMiYTcn0ccLTZOvcbBume+1304fQztxeNzNS9Gvrnw==} - which-boxed-primitive@1.1.1: resolution: {integrity: sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==} engines: {node: '>= 0.4'} @@ -3290,6 +3159,9 @@ packages: wide-align@1.1.3: resolution: {integrity: sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==} + wildcard@2.0.1: + resolution: {integrity: sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==} + word-wrap@1.2.5: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} @@ -3354,10 +3226,6 @@ packages: resolution: {integrity: sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==} engines: {node: '>=12'} - yn@3.1.1: - resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} - engines: {node: '>=6'} - yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} @@ -3409,9 +3277,23 @@ snapshots: '@bcoe/v8-coverage@1.0.2': {} - '@cspotcode/source-map-support@0.8.1': + '@discoveryjs/json-ext@0.5.7': {} + + '@emnapi/core@1.11.1': dependencies: - '@jridgewell/trace-mapping': 0.3.9 + '@emnapi/wasi-threads': 1.2.2 + tslib: 2.8.1 + optional: true + + '@emnapi/runtime@1.11.1': + dependencies: + tslib: 2.8.1 + optional: true + + '@emnapi/wasi-threads@1.2.2': + dependencies: + tslib: 2.8.1 + optional: true '@eslint/eslintrc@0.4.3': dependencies: @@ -3450,45 +3332,261 @@ snapshots: '@istanbuljs/schema@0.1.6': {} - '@jest/diff-sequences@30.0.1': {} - - '@jest/get-type@30.1.0': {} + '@jesscss/awaitable-pipe@2.0.0-alpha.11': {} - '@jest/schemas@30.0.5': + '@jesscss/compiler@2.0.0-alpha.11(typescript@5.9.3)': dependencies: - '@sinclair/typebox': 0.34.52 + '@jesscss/core': 2.0.0-alpha.11 + linecraft: 0.2.6 + lodash-es: 4.18.1 + styles-config: 2.0.0-alpha.11(typescript@5.9.3) + transitivePeerDependencies: + - typescript - '@jridgewell/resolve-uri@3.1.2': {} + '@jesscss/core@2.0.0-alpha.11': + dependencies: + '@jesscss/awaitable-pipe': 2.0.0-alpha.11 + '@jridgewell/gen-mapping': 0.3.13 + '@ungap/set-methods': 0.1.1 + bitset: 5.2.3 + chalk: 5.6.2 + color-name: 2.0.2 + combinate: 1.1.11 + data-structure-typed: 2.0.5 + lodash-es: 4.18.1 - '@jridgewell/sourcemap-codec@1.5.5': {} + '@jesscss/css-parser@2.0.0-alpha.11(@jesscss/core@2.0.0-alpha.11)(parseman@0.41.0)': + dependencies: + parseman: 0.41.0 + optionalDependencies: + '@jesscss/core': 2.0.0-alpha.11 - '@jridgewell/trace-mapping@0.3.31': + '@jesscss/fns@2.0.0-alpha.11': dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.5.5 + '@jesscss/awaitable-pipe': 2.0.0-alpha.11 + '@jesscss/core': 2.0.0-alpha.11 + color-name: 2.0.2 + lodash-es: 4.18.1 + superstruct: 1.0.3 - '@jridgewell/trace-mapping@0.3.9': + '@jesscss/less-parser@2.0.0-alpha.11(@jesscss/core@2.0.0-alpha.11)(parseman@0.41.0)': dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.5.5 + '@jesscss/css-parser': 2.0.0-alpha.11(@jesscss/core@2.0.0-alpha.11)(parseman@0.41.0) + known-css-properties: 0.37.0 + parseman: 0.41.0 + optionalDependencies: + '@jesscss/core': 2.0.0-alpha.11 - '@nodelib/fs.scandir@2.1.5': + '@jesscss/plugin-less-compat@2.0.0-alpha.11(parseman@0.41.0)': dependencies: - '@nodelib/fs.stat': 2.0.5 - run-parallel: 1.2.0 + '@jesscss/awaitable-pipe': 2.0.0-alpha.11 + '@jesscss/core': 2.0.0-alpha.11 + '@jesscss/less-parser': 2.0.0-alpha.11(@jesscss/core@2.0.0-alpha.11)(parseman@0.41.0) + '@jesscss/plugin-node-modules': 2.0.0-alpha.11 + transitivePeerDependencies: + - parseman - '@nodelib/fs.stat@2.0.5': {} + '@jesscss/plugin-less@2.0.0-alpha.11(parseman@0.41.0)(typescript@5.9.3)': + dependencies: + '@jesscss/core': 2.0.0-alpha.11 + '@jesscss/fns': 2.0.0-alpha.11 + '@jesscss/less-parser': 2.0.0-alpha.11(@jesscss/core@2.0.0-alpha.11)(parseman@0.41.0) + '@jesscss/plugin-less-compat': 2.0.0-alpha.11(parseman@0.41.0) + '@jesscss/style-resolver': 2.0.0-alpha.11 + styles-config: 2.0.0-alpha.11(typescript@5.9.3) + transitivePeerDependencies: + - parseman + - typescript - '@nodelib/fs.walk@1.2.8': + '@jesscss/plugin-node-modules@2.0.0-alpha.11': dependencies: - '@nodelib/fs.scandir': 2.1.5 - fastq: 1.20.1 + '@jesscss/core': 2.0.0-alpha.11 - '@pkgjs/parseargs@0.11.0': - optional: true + '@jesscss/style-resolver@2.0.0-alpha.11': {} - '@rollup/plugin-commonjs@17.1.0(rollup@2.80.0)': - dependencies: + '@jest/diff-sequences@30.0.1': {} + + '@jest/get-type@30.1.0': {} + + '@jest/schemas@30.0.5': + dependencies: + '@sinclair/typebox': 0.34.52 + + '@jridgewell/gen-mapping@0.3.13': + dependencies: + '@jridgewell/sourcemap-codec': 1.5.5 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/remapping@2.3.5': + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/resolve-uri@3.1.2': {} + + '@jridgewell/source-map@0.3.11': + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/sourcemap-codec@1.5.5': {} + + '@jridgewell/trace-mapping@0.3.31': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.5 + + '@napi-rs/wasm-runtime@1.2.0(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1)': + dependencies: + '@emnapi/core': 1.11.1 + '@emnapi/runtime': 1.11.1 + '@tybys/wasm-util': 0.10.3 + optional: true + + '@nodelib/fs.scandir@2.1.5': + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + + '@nodelib/fs.stat@2.0.5': {} + + '@nodelib/fs.walk@1.2.8': + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.20.1 + + '@oxc-parser/binding-android-arm-eabi@0.137.0': + optional: true + + '@oxc-parser/binding-android-arm64@0.137.0': + optional: true + + '@oxc-parser/binding-darwin-arm64@0.137.0': + optional: true + + '@oxc-parser/binding-darwin-x64@0.137.0': + optional: true + + '@oxc-parser/binding-freebsd-x64@0.137.0': + optional: true + + '@oxc-parser/binding-linux-arm-gnueabihf@0.137.0': + optional: true + + '@oxc-parser/binding-linux-arm-musleabihf@0.137.0': + optional: true + + '@oxc-parser/binding-linux-arm64-gnu@0.137.0': + optional: true + + '@oxc-parser/binding-linux-arm64-musl@0.137.0': + optional: true + + '@oxc-parser/binding-linux-ppc64-gnu@0.137.0': + optional: true + + '@oxc-parser/binding-linux-riscv64-gnu@0.137.0': + optional: true + + '@oxc-parser/binding-linux-riscv64-musl@0.137.0': + optional: true + + '@oxc-parser/binding-linux-s390x-gnu@0.137.0': + optional: true + + '@oxc-parser/binding-linux-x64-gnu@0.137.0': + optional: true + + '@oxc-parser/binding-linux-x64-musl@0.137.0': + optional: true + + '@oxc-parser/binding-openharmony-arm64@0.137.0': + optional: true + + '@oxc-parser/binding-wasm32-wasi@0.137.0': + dependencies: + '@emnapi/core': 1.11.1 + '@emnapi/runtime': 1.11.1 + '@napi-rs/wasm-runtime': 1.2.0(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1) + optional: true + + '@oxc-parser/binding-win32-arm64-msvc@0.137.0': + optional: true + + '@oxc-parser/binding-win32-ia32-msvc@0.137.0': + optional: true + + '@oxc-parser/binding-win32-x64-msvc@0.137.0': + optional: true + + '@oxc-project/types@0.137.0': {} + + '@oxc-resolver/binding-android-arm-eabi@11.23.0': + optional: true + + '@oxc-resolver/binding-android-arm64@11.23.0': + optional: true + + '@oxc-resolver/binding-darwin-arm64@11.23.0': + optional: true + + '@oxc-resolver/binding-darwin-x64@11.23.0': + optional: true + + '@oxc-resolver/binding-freebsd-x64@11.23.0': + optional: true + + '@oxc-resolver/binding-linux-arm-gnueabihf@11.23.0': + optional: true + + '@oxc-resolver/binding-linux-arm-musleabihf@11.23.0': + optional: true + + '@oxc-resolver/binding-linux-arm64-gnu@11.23.0': + optional: true + + '@oxc-resolver/binding-linux-arm64-musl@11.23.0': + optional: true + + '@oxc-resolver/binding-linux-ppc64-gnu@11.23.0': + optional: true + + '@oxc-resolver/binding-linux-riscv64-gnu@11.23.0': + optional: true + + '@oxc-resolver/binding-linux-riscv64-musl@11.23.0': + optional: true + + '@oxc-resolver/binding-linux-s390x-gnu@11.23.0': + optional: true + + '@oxc-resolver/binding-linux-x64-gnu@11.23.0': + optional: true + + '@oxc-resolver/binding-linux-x64-musl@11.23.0': + optional: true + + '@oxc-resolver/binding-openharmony-arm64@11.23.0': + optional: true + + '@oxc-resolver/binding-wasm32-wasi@11.23.0': + dependencies: + '@emnapi/core': 1.11.1 + '@emnapi/runtime': 1.11.1 + '@napi-rs/wasm-runtime': 1.2.0(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1) + optional: true + + '@oxc-resolver/binding-win32-arm64-msvc@11.23.0': + optional: true + + '@oxc-resolver/binding-win32-x64-msvc@11.23.0': + optional: true + + '@pkgjs/parseargs@0.11.0': + optional: true + + '@rollup/plugin-commonjs@17.1.0(rollup@2.80.0)': + dependencies: '@rollup/pluginutils': 3.1.0(rollup@2.80.0) commondir: 1.0.1 estree-walker: 2.0.2 @@ -3522,13 +3620,10 @@ snapshots: '@sinclair/typebox@0.34.52': {} - '@tsconfig/node10@1.0.12': {} - - '@tsconfig/node12@1.0.11': {} - - '@tsconfig/node14@1.0.3': {} - - '@tsconfig/node16@1.0.4': {} + '@tybys/wasm-util@0.10.3': + dependencies: + tslib: 2.8.1 + optional: true '@types/estree@0.0.39': {} @@ -3555,10 +3650,10 @@ snapshots: dependencies: '@types/node': 18.19.130 - '@typescript-eslint/eslint-plugin@4.33.0(@typescript-eslint/parser@4.33.0(eslint@7.32.0)(typescript@4.9.5))(eslint@7.32.0)(typescript@4.9.5)': + '@typescript-eslint/eslint-plugin@4.33.0(@typescript-eslint/parser@4.33.0(eslint@7.32.0)(typescript@5.9.3))(eslint@7.32.0)(typescript@5.9.3)': dependencies: - '@typescript-eslint/experimental-utils': 4.33.0(eslint@7.32.0)(typescript@4.9.5) - '@typescript-eslint/parser': 4.33.0(eslint@7.32.0)(typescript@4.9.5) + '@typescript-eslint/experimental-utils': 4.33.0(eslint@7.32.0)(typescript@5.9.3) + '@typescript-eslint/parser': 4.33.0(eslint@7.32.0)(typescript@5.9.3) '@typescript-eslint/scope-manager': 4.33.0 debug: 4.4.3 eslint: 7.32.0 @@ -3566,18 +3661,18 @@ snapshots: ignore: 5.3.2 regexpp: 3.2.0 semver: 7.8.5 - tsutils: 3.21.0(typescript@4.9.5) + tsutils: 3.21.0(typescript@5.9.3) optionalDependencies: - typescript: 4.9.5 + typescript: 5.9.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/experimental-utils@4.33.0(eslint@7.32.0)(typescript@4.9.5)': + '@typescript-eslint/experimental-utils@4.33.0(eslint@7.32.0)(typescript@5.9.3)': dependencies: '@types/json-schema': 7.0.15 '@typescript-eslint/scope-manager': 4.33.0 '@typescript-eslint/types': 4.33.0 - '@typescript-eslint/typescript-estree': 4.33.0(typescript@4.9.5) + '@typescript-eslint/typescript-estree': 4.33.0(typescript@5.9.3) eslint: 7.32.0 eslint-scope: 5.1.1 eslint-utils: 3.0.0(eslint@7.32.0) @@ -3585,15 +3680,15 @@ snapshots: - supports-color - typescript - '@typescript-eslint/parser@4.33.0(eslint@7.32.0)(typescript@4.9.5)': + '@typescript-eslint/parser@4.33.0(eslint@7.32.0)(typescript@5.9.3)': dependencies: '@typescript-eslint/scope-manager': 4.33.0 '@typescript-eslint/types': 4.33.0 - '@typescript-eslint/typescript-estree': 4.33.0(typescript@4.9.5) + '@typescript-eslint/typescript-estree': 4.33.0(typescript@5.9.3) debug: 4.4.3 eslint: 7.32.0 optionalDependencies: - typescript: 4.9.5 + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -3604,7 +3699,7 @@ snapshots: '@typescript-eslint/types@4.33.0': {} - '@typescript-eslint/typescript-estree@4.33.0(typescript@4.9.5)': + '@typescript-eslint/typescript-estree@4.33.0(typescript@5.9.3)': dependencies: '@typescript-eslint/types': 4.33.0 '@typescript-eslint/visitor-keys': 4.33.0 @@ -3612,9 +3707,9 @@ snapshots: globby: 11.1.0 is-glob: 4.0.3 semver: 7.8.5 - tsutils: 3.21.0(typescript@4.9.5) + tsutils: 3.21.0(typescript@5.9.3) optionalDependencies: - typescript: 4.9.5 + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -3623,28 +3718,119 @@ snapshots: '@typescript-eslint/types': 4.33.0 eslint-visitor-keys: 2.1.0 - abbrev@1.1.1: {} + '@ungap/set-methods@0.1.1': {} - accepts@1.3.8: + '@webassemblyjs/ast@1.14.1': dependencies: - mime-types: 2.1.35 - negotiator: 0.6.3 + '@webassemblyjs/helper-numbers': 1.13.2 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 - acorn-jsx@5.3.2(acorn@7.4.1): + '@webassemblyjs/floating-point-hex-parser@1.13.2': {} + + '@webassemblyjs/helper-api-error@1.13.2': {} + + '@webassemblyjs/helper-buffer@1.14.1': {} + + '@webassemblyjs/helper-numbers@1.13.2': dependencies: - acorn: 7.4.1 + '@webassemblyjs/floating-point-hex-parser': 1.13.2 + '@webassemblyjs/helper-api-error': 1.13.2 + '@xtuc/long': 4.2.2 + + '@webassemblyjs/helper-wasm-bytecode@1.13.2': {} - acorn-walk@8.3.5: + '@webassemblyjs/helper-wasm-section@1.14.1': dependencies: - acorn: 8.17.0 + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/wasm-gen': 1.14.1 + + '@webassemblyjs/ieee754@1.13.2': + dependencies: + '@xtuc/ieee754': 1.2.0 + + '@webassemblyjs/leb128@1.13.2': + dependencies: + '@xtuc/long': 4.2.2 + + '@webassemblyjs/utf8@1.13.2': {} + + '@webassemblyjs/wasm-edit@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/helper-wasm-section': 1.14.1 + '@webassemblyjs/wasm-gen': 1.14.1 + '@webassemblyjs/wasm-opt': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + '@webassemblyjs/wast-printer': 1.14.1 + + '@webassemblyjs/wasm-gen@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/ieee754': 1.13.2 + '@webassemblyjs/leb128': 1.13.2 + '@webassemblyjs/utf8': 1.13.2 + + '@webassemblyjs/wasm-opt@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/wasm-gen': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + + '@webassemblyjs/wasm-parser@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-api-error': 1.13.2 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/ieee754': 1.13.2 + '@webassemblyjs/leb128': 1.13.2 + '@webassemblyjs/utf8': 1.13.2 + + '@webassemblyjs/wast-printer@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@xtuc/long': 4.2.2 + + '@webpack-cli/configtest@2.1.1(webpack-cli@5.1.4)(webpack@5.109.0)': + dependencies: + webpack: 5.109.0(webpack-cli@5.1.4) + webpack-cli: 5.1.4(webpack@5.109.0) + + '@webpack-cli/info@2.0.2(webpack-cli@5.1.4)(webpack@5.109.0)': + dependencies: + webpack: 5.109.0(webpack-cli@5.1.4) + webpack-cli: 5.1.4(webpack@5.109.0) + + '@webpack-cli/serve@2.0.5(webpack-cli@5.1.4)(webpack@5.109.0)': + dependencies: + webpack: 5.109.0(webpack-cli@5.1.4) + webpack-cli: 5.1.4(webpack@5.109.0) + + '@xtuc/ieee754@1.2.0': {} + + '@xtuc/long@4.2.2': {} + + acorn-jsx@5.3.2(acorn@7.4.1): + dependencies: + acorn: 7.4.1 acorn@7.4.1: {} acorn@8.17.0: {} - agent-base@4.3.0: + ajv-formats@2.1.1: dependencies: - es6-promisify: 5.0.0 + ajv: 8.20.0 + + ajv-keywords@5.1.0(ajv@8.20.0): + dependencies: + ajv: 8.20.0 + fast-deep-equal: 3.1.3 ajv@6.15.0: dependencies: @@ -3718,8 +3904,6 @@ snapshots: application-config-path: 0.1.1 mkdirp: 0.5.6 - arg@4.1.3: {} - argparse@1.0.10: dependencies: sprintf-js: 1.0.3 @@ -3731,10 +3915,6 @@ snapshots: call-bound: 1.0.4 is-array-buffer: 3.0.5 - array-each@1.0.1: {} - - array-slice@1.1.0: {} - array-to-sentence@1.1.0: {} array-union@2.1.0: {} @@ -3764,18 +3944,12 @@ snapshots: asn1@0.1.11: {} - asn1@0.2.6: - dependencies: - safer-buffer: 2.1.2 - assert-fs-readfile-option@1.0.1: dependencies: nop: 1.0.0 assert-plus@0.1.5: {} - assert-plus@1.0.0: {} - assert-valid-glob-opts@1.0.0: dependencies: glob-option-error: 1.0.0 @@ -3789,12 +3963,8 @@ snapshots: async@0.2.10: {} - async@1.5.2: {} - async@3.2.6: {} - asynckit@0.4.0: {} - autoprefixer@6.7.7: dependencies: browserslist: 1.7.7 @@ -3808,25 +3978,13 @@ snapshots: dependencies: possible-typed-array-names: 1.1.0 - aws-sign2@0.7.0: {} - aws-sign@0.3.0: {} - aws4@1.13.2: {} - balanced-match@1.0.2: {} balanced-match@4.0.4: {} - basic-auth@2.0.1: - dependencies: - safe-buffer: 5.1.2 - - batch@0.6.1: {} - - bcrypt-pbkdf@1.0.2: - dependencies: - tweetnacl: 0.14.5 + baseline-browser-mapping@2.11.1: {} benchmark@2.1.4: dependencies: @@ -3845,6 +4003,8 @@ snapshots: kleur: 4.1.5 log-update: 4.0.0 + bitset@5.2.3: {} + bl@0.9.5: dependencies: readable-stream: 1.0.34 @@ -3881,6 +4041,14 @@ snapshots: caniuse-db: 1.0.30001805 electron-to-chromium: 1.5.389 + browserslist@4.28.7: + dependencies: + baseline-browser-mapping: 2.11.1 + caniuse-lite: 1.0.30001806 + electron-to-chromium: 1.5.396 + node-releases: 2.0.51 + update-browserslist-db: 1.2.3(browserslist@4.28.7) + buffer-from@1.1.2: {} builtin-modules@3.3.0: {} @@ -3922,7 +4090,7 @@ snapshots: caniuse-db@1.0.30001805: {} - caseless@0.12.0: {} + caniuse-lite@1.0.30001806: {} chai@4.5.0: dependencies: @@ -3953,12 +4121,16 @@ snapshots: ansi-styles: 4.3.0 supports-color: 7.2.0 + chalk@5.6.2: {} + chardet@0.7.0: {} check-error@1.0.3: dependencies: get-func-name: 2.0.2 + chrome-trace-event@1.0.4: {} + clean-css@5.3.3: dependencies: source-map: 0.6.1 @@ -3987,6 +4159,12 @@ snapshots: strip-ansi: 6.0.1 wrap-ansi: 7.0.0 + clone-deep@4.0.1: + dependencies: + is-plain-object: 2.0.4 + kind-of: 6.0.3 + shallow-clone: 3.0.1 + color-convert@1.9.3: dependencies: color-name: 1.1.3 @@ -3999,17 +4177,19 @@ snapshots: color-name@1.1.4: {} + color-name@2.0.2: {} + + colorette@2.0.20: {} + colors@0.5.1: {} - colors@1.1.2: {} + combinate@1.1.11: {} combined-stream@0.0.7: dependencies: delayed-stream: 0.0.5 - combined-stream@1.0.8: - dependencies: - delayed-stream: 1.0.0 + commander@10.0.1: {} commander@2.20.3: {} @@ -4021,39 +4201,20 @@ snapshots: concat-map@0.0.1: {} - connect-livereload@0.5.4: {} - - connect@3.7.0: - dependencies: - debug: 2.6.9 - finalhandler: 1.1.2 - parseurl: 1.3.3 - utils-merge: 1.0.1 - transitivePeerDependencies: - - supports-color - convert-source-map@2.0.0: {} cookie-jar@0.3.0: {} - copy-anything@2.0.6: - dependencies: - is-what: 3.14.1 - - core-util-is@1.0.2: {} - core-util-is@1.0.3: {} - cosmiconfig@9.0.2(typescript@4.9.5): + cosmiconfig@9.0.2(typescript@5.9.3): dependencies: env-paths: 2.2.1 import-fresh: 3.3.1 js-yaml: 4.3.0 parse-json: 5.2.0 optionalDependencies: - typescript: 4.9.5 - - create-require@1.1.1: {} + typescript: 5.9.3 cross-env@7.0.3: dependencies: @@ -4079,9 +4240,7 @@ snapshots: ctype@0.5.3: {} - dashdash@1.14.1: - dependencies: - assert-plus: 1.0.0 + data-structure-typed@2.0.5: {} data-view-buffer@1.0.2: dependencies: @@ -4101,26 +4260,12 @@ snapshots: es-errors: 1.3.0 is-data-view: 1.0.2 - date-time@1.1.0: - dependencies: - time-zone: 0.1.0 - - dateformat@4.6.3: {} - - debug@2.6.9: - dependencies: - ms: 2.0.0 - debug@3.2.6(supports-color@6.0.0): dependencies: ms: 2.1.1 optionalDependencies: supports-color: 6.0.0 - debug@3.2.7: - dependencies: - ms: 2.1.3 - debug@4.4.3: dependencies: ms: 2.1.3 @@ -4149,22 +4294,10 @@ snapshots: delayed-stream@0.0.5: {} - delayed-stream@1.0.0: {} - - depd@1.1.2: {} - - depd@2.0.0: {} - - destroy@1.2.0: {} - - detect-file@1.0.0: {} - didyoumean@1.2.2: {} diff@3.5.0: {} - diff@4.0.4: {} - dir-glob@3.0.1: dependencies: path-type: 4.0.0 @@ -4185,24 +4318,20 @@ snapshots: eastasianwidth@0.2.0: {} - ecc-jsbn@0.1.2: - dependencies: - jsbn: 0.1.1 - safer-buffer: 2.1.2 - - ee-first@1.1.1: {} - electron-to-chromium@1.5.389: {} + electron-to-chromium@1.5.396: {} + emoji-regex@7.0.3: {} emoji-regex@8.0.0: {} emoji-regex@9.2.2: {} - encodeurl@1.0.2: {} - - encodeurl@2.0.0: {} + enhanced-resolve@5.24.3: + dependencies: + graceful-fs: 4.2.11 + tapable: 2.3.3 enquirer@2.4.1: dependencies: @@ -4211,10 +4340,7 @@ snapshots: env-paths@2.2.1: {} - errno@0.1.8: - dependencies: - prr: 1.0.1 - optional: true + envinfo@7.21.0: {} error-ex@1.3.4: dependencies: @@ -4290,6 +4416,8 @@ snapshots: es-errors@1.3.0: {} + es-module-lexer@2.3.1: {} + es-object-atoms@1.1.2: dependencies: es-errors: 1.3.0 @@ -4310,16 +4438,8 @@ snapshots: is-date-object: 1.1.0 is-symbol: 1.1.1 - es6-promise@4.2.8: {} - - es6-promisify@5.0.0: - dependencies: - es6-promise: 4.2.8 - escalade@3.2.0: {} - escape-html@1.0.3: {} - escape-string-regexp@1.0.5: {} escape-string-regexp@4.0.0: {} @@ -4415,19 +4535,7 @@ snapshots: esutils@2.0.3: {} - etag@1.8.1: {} - - eventemitter2@0.4.14: {} - - exit-x@0.2.2: {} - - exit@0.1.2: {} - - expand-tilde@2.0.2: - dependencies: - homedir-polyfill: 1.0.3 - - extend@3.0.2: {} + events@3.3.0: {} external-editor@3.1.0: dependencies: @@ -4435,8 +4543,6 @@ snapshots: iconv-lite: 0.4.24 tmp: 0.0.33 - extsprintf@1.3.0: {} - fast-deep-equal@3.1.3: {} fast-glob@3.3.3: @@ -4453,20 +4559,12 @@ snapshots: fast-uri@3.1.3: {} + fastest-levenshtein@1.0.16: {} + fastq@1.20.1: dependencies: reusify: 1.1.0 - fg-lodash@0.0.2: - dependencies: - lodash: 2.4.2 - underscore.string: 2.3.3 - - figures@1.7.0: - dependencies: - escape-string-regexp: 1.0.5 - object-assign: 4.1.1 - figures@3.2.0: dependencies: escape-string-regexp: 1.0.5 @@ -4479,24 +4577,6 @@ snapshots: dependencies: to-regex-range: 5.0.1 - finalhandler@1.1.2: - dependencies: - debug: 2.6.9 - encodeurl: 1.0.2 - escape-html: 1.0.3 - on-finished: 2.3.0 - parseurl: 1.3.3 - statuses: 1.5.0 - unpipe: 1.0.0 - transitivePeerDependencies: - - supports-color - - find-cache-dir@3.3.2: - dependencies: - commondir: 1.0.1 - make-dir: 3.1.0 - pkg-dir: 4.2.0 - find-up@3.0.0: dependencies: locate-path: 3.0.0 @@ -4511,30 +4591,6 @@ snapshots: locate-path: 6.0.0 path-exists: 4.0.0 - findup-sync@4.0.0: - dependencies: - detect-file: 1.0.0 - is-glob: 4.0.3 - micromatch: 4.0.8 - resolve-dir: 1.0.1 - - findup-sync@5.0.0: - dependencies: - detect-file: 1.0.0 - is-glob: 4.0.3 - micromatch: 4.0.8 - resolve-dir: 1.0.1 - - fined@1.2.0: - dependencies: - expand-tilde: 2.0.2 - is-plain-object: 2.0.4 - object.defaults: 1.1.0 - object.pick: 1.3.0 - parse-filepath: 1.0.2 - - flagged-respawn@1.0.1: {} - flat-cache@3.2.0: dependencies: flatted: 3.4.2 @@ -4545,18 +4601,14 @@ snapshots: dependencies: is-buffer: 2.0.5 + flat@5.0.2: {} + flatted@3.4.2: {} for-each@0.3.5: dependencies: is-callable: 1.2.7 - for-in@1.0.2: {} - - for-own@1.0.0: - dependencies: - for-in: 1.0.2 - foreach@2.0.6: {} foreground-child@3.3.1: @@ -4566,22 +4618,12 @@ snapshots: forever-agent@0.5.2: {} - forever-agent@0.6.1: {} - form-data@0.0.8: dependencies: async: 0.2.10 combined-stream: 0.0.7 mime: 1.2.11 - form-data@2.3.3: - dependencies: - asynckit: 0.4.0 - combined-stream: 1.0.8 - mime-types: 2.1.35 - - fresh@0.5.2: {} - fs-extra@10.1.0: dependencies: graceful-fs: 4.2.11 @@ -4650,12 +4692,6 @@ snapshots: es-errors: 1.3.0 get-intrinsic: 1.3.0 - getobject@1.0.2: {} - - getpass@0.1.7: - dependencies: - assert-plus: 1.0.0 - ghauth@3.0.0: dependencies: application-config: 0.1.2 @@ -4665,8 +4701,6 @@ snapshots: read: 1.0.7 xtend: 4.0.2 - git-rev@0.2.1: {} - github-changes@1.1.2: dependencies: bluebird: 1.0.3 @@ -4730,15 +4764,6 @@ snapshots: once: 1.4.0 path-is-absolute: 1.0.1 - glob@7.1.7: - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 3.1.5 - once: 1.4.0 - path-is-absolute: 1.0.1 - glob@7.2.3: dependencies: fs.realpath: 1.0.0 @@ -4748,20 +4773,6 @@ snapshots: once: 1.4.0 path-is-absolute: 1.0.1 - global-modules@1.0.0: - dependencies: - global-prefix: 1.0.2 - is-windows: 1.0.2 - resolve-dir: 1.0.1 - - global-prefix@1.0.2: - dependencies: - expand-tilde: 2.0.2 - homedir-polyfill: 1.0.3 - ini: 1.3.8 - is-windows: 1.0.2 - which: 1.3.1 - globals@13.24.0: dependencies: type-fest: 0.20.2 @@ -4791,113 +4802,11 @@ snapshots: merge2: 1.4.1 slash: 3.0.0 - gopd@1.2.0: {} - - graceful-fs@4.2.11: {} - - growl@1.10.5: {} - - grunt-cli@1.5.0: - dependencies: - grunt-known-options: 2.0.0 - interpret: 1.1.0 - liftup: 3.0.1 - nopt: 5.0.0 - v8flags: 4.0.1 - - grunt-contrib-clean@1.1.0(grunt@1.6.2): - dependencies: - async: 1.5.2 - grunt: 1.6.2 - rimraf: 2.7.1 - - grunt-contrib-connect@1.0.2(grunt@1.6.2): - dependencies: - async: 1.5.2 - connect: 3.7.0 - connect-livereload: 0.5.4 - grunt: 1.6.2 - http2: 3.3.7 - morgan: 1.11.0 - opn: 4.0.2 - portscanner: 1.2.0 - serve-index: 1.9.2 - serve-static: 1.16.3 - transitivePeerDependencies: - - supports-color - - grunt-eslint@23.0.0(grunt@1.6.2): - dependencies: - chalk: 4.1.2 - eslint: 7.32.0 - grunt: 1.6.2 - transitivePeerDependencies: - - supports-color - - grunt-known-options@2.0.0: {} - - grunt-legacy-log-utils@2.1.3: - dependencies: - chalk: 4.1.2 - - grunt-legacy-log@3.0.1: - dependencies: - colors: 1.1.2 - grunt-legacy-log-utils: 2.1.3 - hooker: 0.2.3 - lodash: 4.18.1 - - grunt-legacy-util@2.0.2: - dependencies: - async: 3.2.6 - exit-x: 0.2.2 - getobject: 1.0.2 - hooker: 0.2.3 - lodash: 4.18.1 - underscore.string: 3.3.6 - which: 2.0.2 - - grunt-saucelabs@9.0.1(grunt@1.6.2): - dependencies: - colors: 1.1.2 - grunt: 1.6.2 - lodash: 4.18.1 - q: 1.4.1 - requestretry: 1.9.1 - sauce-tunnel: 2.5.0 - saucelabs: 1.5.0 - transitivePeerDependencies: - - supports-color - - grunt-shell@1.3.1(grunt@1.6.2): - dependencies: - chalk: 1.1.3 - grunt: 1.6.2 - npm-run-path: 1.0.0 - object-assign: 4.1.1 - - grunt@1.6.2: - dependencies: - dateformat: 4.6.3 - eventemitter2: 0.4.14 - exit: 0.1.2 - findup-sync: 5.0.0 - glob: 7.1.7 - grunt-cli: 1.5.0 - grunt-known-options: 2.0.0 - grunt-legacy-log: 3.0.1 - grunt-legacy-util: 2.0.2 - iconv-lite: 0.6.3 - js-yaml: 3.14.2 - minimatch: 3.1.5 - nopt: 5.0.0 + gopd@1.2.0: {} - har-schema@2.0.0: {} + graceful-fs@4.2.11: {} - har-validator@5.1.5: - dependencies: - ajv: 6.15.0 - har-schema: 2.0.0 + growl@1.10.5: {} has-ansi@2.0.0: dependencies: @@ -4942,12 +4851,6 @@ snapshots: hoek@0.9.1: {} - homedir-polyfill@1.0.3: - dependencies: - parse-passwd: 1.0.0 - - hooker@0.2.3: {} - hosted-git-info@2.8.9: {} html-es6cape@1.0.5: {} @@ -4958,43 +4861,12 @@ snapshots: dependencies: html-es6cape: 1.0.5 - http-errors@1.8.1: - dependencies: - depd: 1.1.2 - inherits: 2.0.4 - setprototypeof: 1.2.0 - statuses: 1.5.0 - toidentifier: 1.0.1 - - http-errors@2.0.1: - dependencies: - depd: 2.0.0 - inherits: 2.0.4 - setprototypeof: 1.2.0 - statuses: 2.0.2 - toidentifier: 1.0.1 - http-signature@0.10.1: dependencies: asn1: 0.1.11 assert-plus: 0.1.5 ctype: 0.5.3 - http-signature@1.2.0: - dependencies: - assert-plus: 1.0.0 - jsprim: 1.4.2 - sshpk: 1.18.0 - - http2@3.3.7: {} - - https-proxy-agent@2.2.4: - dependencies: - agent-base: 4.3.0 - debug: 3.2.7 - transitivePeerDependencies: - - supports-color - husky@9.1.7: {} hyperquest@1.2.0: @@ -5006,22 +4878,20 @@ snapshots: dependencies: safer-buffer: 2.1.2 - iconv-lite@0.6.3: - dependencies: - safer-buffer: 2.1.2 - ignore@4.0.6: {} ignore@5.3.2: {} - image-size@0.5.5: - optional: true - import-fresh@3.3.1: dependencies: parent-module: 1.0.1 resolve-from: 4.0.0 + import-local@3.2.0: + dependencies: + pkg-dir: 4.2.0 + resolve-cwd: 3.0.0 + imurmurhash@0.1.4: {} indexed-filter@1.0.3: @@ -5037,8 +4907,6 @@ snapshots: inherits@2.0.4: {} - ini@1.3.8: {} - inquirer@7.3.3: dependencies: ansi-escapes: 4.3.2 @@ -5065,14 +4933,9 @@ snapshots: hasown: 2.0.4 side-channel: 1.1.1 - interpret@1.1.0: {} - interpret@1.4.0: {} - is-absolute@1.0.0: - dependencies: - is-relative: 1.0.0 - is-windows: 1.0.2 + interpret@3.1.1: {} is-array-buffer@3.0.5: dependencies: @@ -5128,8 +4991,6 @@ snapshots: dependencies: call-bound: 1.0.4 - is-finite@1.1.0: {} - is-fullwidth-code-point@2.0.0: {} is-fullwidth-code-point@3.0.0: {} @@ -5178,10 +5039,6 @@ snapshots: has-tostringtag: 1.0.2 hasown: 2.0.4 - is-relative@1.0.0: - dependencies: - is-unc-path: 1.0.0 - is-set@2.0.3: {} is-shared-array-buffer@1.0.4: @@ -5203,12 +5060,6 @@ snapshots: dependencies: which-typed-array: 1.1.22 - is-typedarray@1.0.0: {} - - is-unc-path@1.0.0: - dependencies: - unc-path-regex: 0.1.2 - is-weakmap@2.0.2: {} is-weakref@1.1.1: @@ -5220,10 +5071,6 @@ snapshots: call-bound: 1.0.4 get-intrinsic: 1.3.0 - is-what@3.14.1: {} - - is-windows@1.0.2: {} - is@0.2.7: {} isarray@0.0.1: {} @@ -5234,8 +5081,6 @@ snapshots: isobject@3.0.1: {} - isstream@0.1.2: {} - istanbul-lib-coverage@3.2.2: {} istanbul-lib-report@3.0.1: @@ -5271,9 +5116,11 @@ snapshots: merge-stream: 2.0.0 supports-color: 6.1.0 - jit-grunt@0.10.0(grunt@1.6.2): + jest-worker@27.5.1: dependencies: - grunt: 1.6.2 + '@types/node': 18.19.130 + merge-stream: 2.0.0 + supports-color: 8.1.1 js-base64@2.6.4: {} @@ -5284,11 +5131,6 @@ snapshots: argparse: 1.0.10 esprima: 4.0.1 - js-yaml@3.14.2: - dependencies: - argparse: 1.0.10 - esprima: 4.0.1 - js-yaml@3.15.0: dependencies: argparse: 1.0.10 @@ -5298,8 +5140,6 @@ snapshots: dependencies: argparse: 2.0.1 - jsbn@0.1.1: {} - json-buffer@3.0.1: {} json-fixer@1.6.15: @@ -5316,14 +5156,10 @@ snapshots: json-schema-traverse@1.0.0: {} - json-schema@0.4.0: {} - json-stable-stringify-without-jsonify@1.0.1: {} json-stringify-safe@4.0.0: {} - json-stringify-safe@5.0.1: {} - json2csv@5.0.7: dependencies: commander: 6.2.1 @@ -5342,13 +5178,6 @@ snapshots: jsonparse@1.3.1: {} - jsprim@1.4.2: - dependencies: - assert-plus: 1.0.0 - extsprintf: 1.3.0 - json-schema: 0.4.0 - verror: 1.10.0 - keyv@4.5.4: dependencies: json-buffer: 3.0.1 @@ -5357,6 +5186,8 @@ snapshots: kleur@4.1.5: {} + known-css-properties@0.37.0: {} + less-plugin-autoprefix@1.5.1: dependencies: autoprefixer: 6.7.7 @@ -5371,16 +5202,7 @@ snapshots: prelude-ls: 1.2.1 type-check: 0.4.0 - liftup@3.0.1: - dependencies: - extend: 3.0.2 - findup-sync: 4.0.0 - fined: 1.2.0 - flagged-respawn: 1.0.1 - is-plain-object: 2.0.4 - object.map: 1.0.1 - rechoir: 0.7.1 - resolve: 1.22.12 + linecraft@0.2.6: {} lines-and-columns@1.2.4: {} @@ -5404,6 +5226,8 @@ snapshots: dependencies: p-locate: 5.0.0 + lodash-es@4.18.1: {} + lodash.get@4.4.2: {} lodash.merge@4.6.2: {} @@ -5412,8 +5236,6 @@ snapshots: lodash@2.4.1: {} - lodash@2.4.2: {} - lodash@4.18.1: {} log-symbols@2.2.0: @@ -5439,28 +5261,14 @@ snapshots: dependencies: sourcemap-codec: 1.4.8 - make-dir@2.1.0: - dependencies: - pify: 4.0.1 - semver: 5.7.2 - optional: true - - make-dir@3.1.0: + magic-string@0.30.21: dependencies: - semver: 6.3.1 + '@jridgewell/sourcemap-codec': 1.5.5 make-dir@4.0.0: dependencies: semver: 7.8.5 - make-error@1.3.6: {} - - make-iterator@1.0.1: - dependencies: - kind-of: 6.0.3 - - map-cache@0.2.2: {} - math-intrinsics@1.1.0: {} memorystream@0.3.1: {} @@ -5474,16 +5282,10 @@ snapshots: braces: 3.0.3 picomatch: 2.3.2 - mime-db@1.52.0: {} - - mime-types@2.1.35: - dependencies: - mime-db: 1.52.0 + mime-db@1.54.0: {} mime@1.2.11: {} - mime@1.6.0: {} - mimic-fn@2.1.0: {} minimatch@10.2.5: @@ -5504,6 +5306,14 @@ snapshots: minimist@1.2.8: {} + minimizer-webpack-plugin@5.6.1(webpack@5.109.0): + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + jest-worker: 27.5.1 + schema-utils: 4.3.3 + terser: 5.49.0 + webpack: 5.109.0(webpack-cli@5.1.4) + minipass@7.1.3: {} mkdirp@0.5.4: @@ -5550,18 +5360,6 @@ snapshots: moment@2.30.1: {} - morgan@1.11.0: - dependencies: - basic-auth: 2.0.1 - debug: 2.6.9 - depd: 2.0.0 - on-finished: 2.4.1 - on-headers: 1.1.0 - transitivePeerDependencies: - - supports-color - - ms@2.0.0: {} - ms@2.1.1: {} ms@2.1.3: {} @@ -5570,13 +5368,7 @@ snapshots: natural-compare@1.4.0: {} - needle@3.5.0: - dependencies: - iconv-lite: 0.6.3 - sax: 1.6.0 - optional: true - - negotiator@0.6.3: {} + neo-async@2.6.2: {} nice-try@1.0.5: {} @@ -5591,6 +5383,8 @@ snapshots: node-promise@0.5.14: {} + node-releases@2.0.51: {} + node-uuid@1.4.8: {} nomnom@1.6.2: @@ -5600,10 +5394,6 @@ snapshots: nop@1.0.0: {} - nopt@5.0.0: - dependencies: - abbrev: 1.1.1 - normalize-package-data@2.5.0: dependencies: hosted-git-info: 2.8.9 @@ -5625,20 +5415,10 @@ snapshots: shell-quote: 1.10.0 string.prototype.padend: 3.1.6 - npm-run-path@1.0.0: - dependencies: - path-key: 1.0.0 - num2fraction@1.2.2: {} - number-is-nan@1.0.1: {} - oauth-sign@0.3.0: {} - oauth-sign@0.9.0: {} - - object-assign@4.1.1: {} - object-inspect@1.13.4: {} object-keys@0.2.0: @@ -5665,13 +5445,6 @@ snapshots: has-symbols: 1.1.0 object-keys: 1.1.1 - object.defaults@1.1.0: - dependencies: - array-each: 1.0.1 - array-slice: 1.1.0 - for-own: 1.0.0 - isobject: 3.0.1 - object.getownpropertydescriptors@2.1.9: dependencies: array.prototype.reduce: 1.0.8 @@ -5682,25 +5455,6 @@ snapshots: gopd: 1.2.0 safe-array-concat: 1.1.4 - object.map@1.0.1: - dependencies: - for-own: 1.0.0 - make-iterator: 1.0.1 - - object.pick@1.3.0: - dependencies: - isobject: 3.0.1 - - on-finished@2.3.0: - dependencies: - ee-first: 1.1.1 - - on-finished@2.4.1: - dependencies: - ee-first: 1.1.1 - - on-headers@1.1.0: {} - once@1.4.0: dependencies: wrappy: 1.0.2 @@ -5709,11 +5463,6 @@ snapshots: dependencies: mimic-fn: 2.1.0 - opn@4.0.2: - dependencies: - object-assign: 4.1.1 - pinkie-promise: 2.0.1 - optionator@0.9.4: dependencies: deep-is: 0.1.4 @@ -5731,6 +5480,53 @@ snapshots: object-keys: 1.1.1 safe-push-apply: 1.0.0 + oxc-parser@0.137.0: + dependencies: + '@oxc-project/types': 0.137.0 + optionalDependencies: + '@oxc-parser/binding-android-arm-eabi': 0.137.0 + '@oxc-parser/binding-android-arm64': 0.137.0 + '@oxc-parser/binding-darwin-arm64': 0.137.0 + '@oxc-parser/binding-darwin-x64': 0.137.0 + '@oxc-parser/binding-freebsd-x64': 0.137.0 + '@oxc-parser/binding-linux-arm-gnueabihf': 0.137.0 + '@oxc-parser/binding-linux-arm-musleabihf': 0.137.0 + '@oxc-parser/binding-linux-arm64-gnu': 0.137.0 + '@oxc-parser/binding-linux-arm64-musl': 0.137.0 + '@oxc-parser/binding-linux-ppc64-gnu': 0.137.0 + '@oxc-parser/binding-linux-riscv64-gnu': 0.137.0 + '@oxc-parser/binding-linux-riscv64-musl': 0.137.0 + '@oxc-parser/binding-linux-s390x-gnu': 0.137.0 + '@oxc-parser/binding-linux-x64-gnu': 0.137.0 + '@oxc-parser/binding-linux-x64-musl': 0.137.0 + '@oxc-parser/binding-openharmony-arm64': 0.137.0 + '@oxc-parser/binding-wasm32-wasi': 0.137.0 + '@oxc-parser/binding-win32-arm64-msvc': 0.137.0 + '@oxc-parser/binding-win32-ia32-msvc': 0.137.0 + '@oxc-parser/binding-win32-x64-msvc': 0.137.0 + + oxc-resolver@11.23.0: + optionalDependencies: + '@oxc-resolver/binding-android-arm-eabi': 11.23.0 + '@oxc-resolver/binding-android-arm64': 11.23.0 + '@oxc-resolver/binding-darwin-arm64': 11.23.0 + '@oxc-resolver/binding-darwin-x64': 11.23.0 + '@oxc-resolver/binding-freebsd-x64': 11.23.0 + '@oxc-resolver/binding-linux-arm-gnueabihf': 11.23.0 + '@oxc-resolver/binding-linux-arm-musleabihf': 11.23.0 + '@oxc-resolver/binding-linux-arm64-gnu': 11.23.0 + '@oxc-resolver/binding-linux-arm64-musl': 11.23.0 + '@oxc-resolver/binding-linux-ppc64-gnu': 11.23.0 + '@oxc-resolver/binding-linux-riscv64-gnu': 11.23.0 + '@oxc-resolver/binding-linux-riscv64-musl': 11.23.0 + '@oxc-resolver/binding-linux-s390x-gnu': 11.23.0 + '@oxc-resolver/binding-linux-x64-gnu': 11.23.0 + '@oxc-resolver/binding-linux-x64-musl': 11.23.0 + '@oxc-resolver/binding-openharmony-arm64': 11.23.0 + '@oxc-resolver/binding-wasm32-wasi': 11.23.0 + '@oxc-resolver/binding-win32-arm64-msvc': 11.23.0 + '@oxc-resolver/binding-win32-x64-msvc': 11.23.0 + p-limit@2.3.0: dependencies: p-try: 2.2.0 @@ -5759,12 +5555,6 @@ snapshots: dependencies: callsites: 3.1.0 - parse-filepath@1.0.2: - dependencies: - is-absolute: 1.0.0 - map-cache: 0.2.2 - path-root: 0.1.1 - parse-json@4.0.0: dependencies: error-ex: 1.3.4 @@ -5781,13 +5571,16 @@ snapshots: dependencies: xtend: 2.0.6 - parse-ms@1.0.1: {} - parse-node-version@1.0.1: {} - parse-passwd@1.0.0: {} + parseman@0.41.0: + dependencies: + magic-string: 0.30.21 + oxc-parser: 0.137.0 + oxc-resolver: 11.23.0 + unplugin: 3.0.0 - parseurl@1.3.3: {} + path-browserify@1.0.1: {} path-exists@3.0.0: {} @@ -5795,20 +5588,12 @@ snapshots: path-is-absolute@1.0.1: {} - path-key@1.0.0: {} - path-key@2.0.1: {} path-key@3.1.1: {} path-parse@1.0.7: {} - path-root-regex@0.1.2: {} - - path-root@0.1.1: - dependencies: - path-root-regex: 0.1.2 - path-scurry@1.11.1: dependencies: lru-cache: 10.4.3 @@ -5831,29 +5616,18 @@ snapshots: performance-now@0.2.0: {} - performance-now@2.1.0: {} - - phin@2.9.3: {} - picocolors@1.1.1: {} picomatch@2.3.2: {} + picomatch@4.0.5: {} + pidtree@0.3.1: {} pify@3.0.0: {} - pify@4.0.1: - optional: true - pify@5.0.0: {} - pinkie-promise@2.0.1: - dependencies: - pinkie: 2.0.4 - - pinkie@2.0.4: {} - pkg-dir@4.2.0: dependencies: find-up: 4.1.0 @@ -5868,12 +5642,6 @@ snapshots: optionalDependencies: fsevents: 2.3.2 - plur@1.0.0: {} - - portscanner@1.2.0: - dependencies: - async: 1.5.2 - possible-typed-array-names@1.1.0: {} postcss-value-parser@3.3.1: {} @@ -5896,32 +5664,22 @@ snapshots: ansi-styles: 5.2.0 react-is: 18.3.1 - pretty-ms@2.1.0: - dependencies: - is-finite: 1.1.0 - parse-ms: 1.0.1 - plur: 1.0.0 - progress@2.0.3: {} promise@7.3.1: dependencies: asap: 2.0.6 - prr@1.0.1: - optional: true - - psl@1.15.0: - dependencies: - punycode: 2.3.1 + punycode@1.4.1: {} punycode@2.3.1: {} - q@1.4.1: {} - qs@0.6.6: {} - qs@6.5.5: {} + qs@6.15.3: + dependencies: + es-define-property: 1.0.1 + side-channel: 1.1.1 queue-microtask@1.2.3: {} @@ -5929,8 +5687,6 @@ snapshots: dependencies: safe-buffer: 5.2.1 - range-parser@1.2.1: {} - react-is@18.3.1: {} read-glob@3.0.0: @@ -5969,7 +5725,7 @@ snapshots: dependencies: resolve: 1.22.12 - rechoir@0.7.1: + rechoir@0.8.0: dependencies: resolve: 1.22.12 @@ -6010,52 +5766,19 @@ snapshots: qs: 0.6.6 tunnel-agent: 0.3.0 - request@2.88.2: - dependencies: - aws-sign2: 0.7.0 - aws4: 1.13.2 - caseless: 0.12.0 - combined-stream: 1.0.8 - extend: 3.0.2 - forever-agent: 0.6.1 - form-data: 2.3.3 - har-validator: 5.1.5 - http-signature: 1.2.0 - is-typedarray: 1.0.0 - isstream: 0.1.2 - json-stringify-safe: 5.0.1 - mime-types: 2.1.35 - oauth-sign: 0.9.0 - performance-now: 2.1.0 - qs: 6.5.5 - safe-buffer: 5.2.1 - tough-cookie: 2.5.0 - tunnel-agent: 0.6.0 - uuid: 3.4.0 - - requestretry@1.9.1: - dependencies: - extend: 3.0.2 - fg-lodash: 0.0.2 - request: 2.88.2 - when: 3.7.8 - require-directory@2.1.1: {} require-from-string@2.0.2: {} require-main-filename@2.0.0: {} - resolve-dir@1.0.1: + resolve-cwd@3.0.0: dependencies: - expand-tilde: 2.0.2 - global-modules: 1.0.0 + resolve-from: 5.0.0 resolve-from@4.0.0: {} - resolve@1.17.0: - dependencies: - path-parse: 1.0.7 + resolve-from@5.0.0: {} resolve@1.22.12: dependencies: @@ -6071,10 +5794,6 @@ snapshots: reusify@1.1.0: {} - rimraf@2.7.1: - dependencies: - glob: 7.2.3 - rimraf@3.0.2: dependencies: glob: 7.2.3 @@ -6088,16 +5807,6 @@ snapshots: serialize-javascript: 4.0.0 terser: 4.8.1 - rollup-plugin-typescript2@0.29.0(rollup@2.80.0)(typescript@4.9.5): - dependencies: - '@rollup/pluginutils': 3.1.0(rollup@2.80.0) - find-cache-dir: 3.3.2 - fs-extra: 8.1.0 - resolve: 1.17.0 - rollup: 2.80.0 - tslib: 2.0.1 - typescript: 4.9.5 - rollup-pluginutils@2.8.2: dependencies: estree-walker: 0.6.1 @@ -6124,8 +5833,6 @@ snapshots: has-symbols: 1.1.0 isarray: 2.0.5 - safe-buffer@5.1.2: {} - safe-buffer@5.2.1: {} safe-push-apply@1.0.0: @@ -6141,20 +5848,12 @@ snapshots: safer-buffer@2.1.2: {} - sauce-tunnel@2.5.0: + schema-utils@4.3.3: dependencies: - chalk: 1.1.3 - request: 2.88.2 - split: 1.0.1 - - saucelabs@1.5.0: - dependencies: - https-proxy-agent: 2.2.4 - transitivePeerDependencies: - - supports-color - - sax@1.6.0: - optional: true + '@types/json-schema': 7.0.15 + ajv: 8.20.0 + ajv-formats: 2.1.1 + ajv-keywords: 5.1.0(ajv@8.20.0) semver@5.4.1: {} @@ -6164,49 +5863,10 @@ snapshots: semver@7.8.5: {} - send@0.19.2: - dependencies: - debug: 2.6.9 - depd: 2.0.0 - destroy: 1.2.0 - encodeurl: 2.0.0 - escape-html: 1.0.3 - etag: 1.8.1 - fresh: 0.5.2 - http-errors: 2.0.1 - mime: 1.6.0 - ms: 2.1.3 - on-finished: 2.4.1 - range-parser: 1.2.1 - statuses: 2.0.2 - transitivePeerDependencies: - - supports-color - serialize-javascript@4.0.0: dependencies: randombytes: 2.1.0 - serve-index@1.9.2: - dependencies: - accepts: 1.3.8 - batch: 0.6.1 - debug: 2.6.9 - escape-html: 1.0.3 - http-errors: 1.8.1 - mime-types: 2.1.35 - parseurl: 1.3.3 - transitivePeerDependencies: - - supports-color - - serve-static@1.16.3: - dependencies: - encodeurl: 2.0.0 - escape-html: 1.0.3 - parseurl: 1.3.3 - send: 0.19.2 - transitivePeerDependencies: - - supports-color - set-blocking@2.0.0: {} set-function-length@1.2.2: @@ -6231,7 +5891,9 @@ snapshots: es-errors: 1.3.0 es-object-atoms: 1.1.2 - setprototypeof@1.2.0: {} + shallow-clone@3.0.1: + dependencies: + kind-of: 6.0.3 shebang-command@1.2.0: dependencies: @@ -6327,30 +5989,8 @@ snapshots: spdx-license-ids@3.0.23: {} - split@1.0.1: - dependencies: - through: 2.3.8 - sprintf-js@1.0.3: {} - sprintf-js@1.1.3: {} - - sshpk@1.18.0: - dependencies: - asn1: 0.2.6 - assert-plus: 1.0.0 - bcrypt-pbkdf: 1.0.2 - dashdash: 1.14.1 - ecc-jsbn: 0.1.2 - getpass: 0.1.7 - jsbn: 0.1.1 - safer-buffer: 2.1.2 - tweetnacl: 0.14.5 - - statuses@1.5.0: {} - - statuses@2.0.2: {} - stop-iteration-iterator@1.1.0: dependencies: es-errors: 1.3.0 @@ -6438,6 +6078,16 @@ snapshots: strip-json-comments@3.1.1: {} + styles-config@2.0.0-alpha.11(typescript@5.9.3): + dependencies: + '@jesscss/core': 2.0.0-alpha.11 + cosmiconfig: 9.0.2(typescript@5.9.3) + picomatch: 4.0.5 + transitivePeerDependencies: + - typescript + + superstruct@1.0.3: {} + supports-color@2.0.0: {} supports-color@3.2.3: @@ -6460,6 +6110,10 @@ snapshots: dependencies: has-flag: 4.0.0 + supports-color@8.1.1: + dependencies: + has-flag: 4.0.0 + supports-preserve-symlinks-flag@1.0.0: {} table@6.9.0: @@ -6470,6 +6124,8 @@ snapshots: string-width: 4.2.3 strip-ansi: 6.0.1 + tapable@2.3.3: {} + terser@4.8.1: dependencies: acorn: 8.17.0 @@ -6477,6 +6133,13 @@ snapshots: source-map: 0.6.1 source-map-support: 0.5.21 + terser@5.49.0: + dependencies: + '@jridgewell/source-map': 0.3.11 + acorn: 8.17.0 + commander: 2.20.3 + source-map-support: 0.5.21 + test-exclude@7.0.2: dependencies: '@istanbuljs/schema': 0.1.6 @@ -6492,18 +6155,6 @@ snapshots: through@2.3.8: {} - time-grunt@1.4.0: - dependencies: - chalk: 1.1.3 - date-time: 1.1.0 - figures: 1.7.0 - hooker: 0.2.3 - number-is-nan: 1.0.1 - pretty-ms: 2.1.0 - text-table: 0.2.0 - - time-zone@0.1.0: {} - tmp@0.0.33: dependencies: os-tmpdir: 1.0.2 @@ -6512,52 +6163,20 @@ snapshots: dependencies: is-number: 7.0.0 - toidentifier@1.0.1: {} - - tough-cookie@2.5.0: - dependencies: - psl: 1.15.0 - punycode: 2.3.1 - tr46@0.0.3: {} - ts-node@10.9.2(@types/node@18.19.130)(typescript@4.9.5): - dependencies: - '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.12 - '@tsconfig/node12': 1.0.11 - '@tsconfig/node14': 1.0.3 - '@tsconfig/node16': 1.0.4 - '@types/node': 18.19.130 - acorn: 8.17.0 - acorn-walk: 8.3.5 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.4 - make-error: 1.3.6 - typescript: 4.9.5 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 - tslib@1.14.1: {} - tslib@2.0.1: {} - - tslib@2.8.1: {} + tslib@2.8.1: + optional: true - tsutils@3.21.0(typescript@4.9.5): + tsutils@3.21.0(typescript@5.9.3): dependencies: tslib: 1.14.1 - typescript: 4.9.5 + typescript: 5.9.3 tunnel-agent@0.3.0: {} - tunnel-agent@0.6.0: - dependencies: - safe-buffer: 5.2.1 - - tweetnacl@0.14.5: {} - type-check@0.4.0: dependencies: prelude-ls: 1.2.1 @@ -6601,7 +6220,7 @@ snapshots: possible-typed-array-names: 1.1.0 reflect.getprototypeof: 1.0.10 - typescript@4.9.5: {} + typescript@5.9.3: {} uikit@2.27.4: dependencies: @@ -6614,15 +6233,6 @@ snapshots: has-symbols: 1.1.0 which-boxed-primitive: 1.1.1 - unc-path-regex@0.1.2: {} - - underscore.string@2.3.3: {} - - underscore.string@3.3.6: - dependencies: - sprintf-js: 1.1.3 - util-deprecate: 1.0.2 - underscore@1.4.4: {} undici-types@5.26.5: {} @@ -6631,19 +6241,26 @@ snapshots: universalify@2.0.1: {} - unpipe@1.0.0: {} + unplugin@3.0.0: + dependencies: + '@jridgewell/remapping': 2.3.5 + picomatch: 4.0.5 + webpack-virtual-modules: 0.6.2 + + update-browserslist-db@1.2.3(browserslist@4.28.7): + dependencies: + browserslist: 4.28.7 + escalade: 3.2.0 + picocolors: 1.1.1 uri-js@4.4.1: dependencies: punycode: 2.3.1 - util-deprecate@1.0.2: {} - - utils-merge@1.0.1: {} - - uuid@3.4.0: {} - - v8-compile-cache-lib@3.0.1: {} + url@0.11.4: + dependencies: + punycode: 1.4.1 + qs: 6.15.3 v8-compile-cache@2.4.0: {} @@ -6653,8 +6270,6 @@ snapshots: '@types/istanbul-lib-coverage': 2.0.6 convert-source-map: 2.0.0 - v8flags@4.0.1: {} - validate-glob-opts@1.0.2: dependencies: array-to-sentence: 1.1.0 @@ -6667,21 +6282,82 @@ snapshots: spdx-correct: 3.2.0 spdx-expression-parse: 3.0.1 - verror@1.10.0: + watchpack@2.5.2: dependencies: - assert-plus: 1.0.0 - core-util-is: 1.0.2 - extsprintf: 1.3.0 + graceful-fs: 4.2.11 webidl-conversions@3.0.1: {} + webpack-cli@5.1.4(webpack@5.109.0): + dependencies: + '@discoveryjs/json-ext': 0.5.7 + '@webpack-cli/configtest': 2.1.1(webpack-cli@5.1.4)(webpack@5.109.0) + '@webpack-cli/info': 2.0.2(webpack-cli@5.1.4)(webpack@5.109.0) + '@webpack-cli/serve': 2.0.5(webpack-cli@5.1.4)(webpack@5.109.0) + colorette: 2.0.20 + commander: 10.0.1 + cross-spawn: 7.0.6 + envinfo: 7.21.0 + fastest-levenshtein: 1.0.16 + import-local: 3.2.0 + interpret: 3.1.1 + rechoir: 0.8.0 + webpack: 5.109.0(webpack-cli@5.1.4) + webpack-merge: 5.10.0 + + webpack-merge@5.10.0: + dependencies: + clone-deep: 4.0.1 + flat: 5.0.2 + wildcard: 2.0.1 + + webpack-sources@3.5.1: {} + + webpack-virtual-modules@0.6.2: {} + + webpack@5.109.0(webpack-cli@5.1.4): + dependencies: + '@types/estree': 1.0.9 + '@types/json-schema': 7.0.15 + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/wasm-edit': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + acorn: 8.17.0 + browserslist: 4.28.7 + chrome-trace-event: 1.0.4 + enhanced-resolve: 5.24.3 + es-module-lexer: 2.3.1 + eslint-scope: 5.1.1 + events: 3.3.0 + graceful-fs: 4.2.11 + mime-db: 1.54.0 + minimizer-webpack-plugin: 5.6.1(webpack@5.109.0) + neo-async: 2.6.2 + schema-utils: 4.3.3 + tapable: 2.3.3 + watchpack: 2.5.2 + webpack-sources: 3.5.1 + optionalDependencies: + webpack-cli: 5.1.4(webpack@5.109.0) + transitivePeerDependencies: + - '@minify-html/node' + - '@swc/core' + - '@swc/css' + - '@swc/html' + - clean-css + - cssnano + - csso + - esbuild + - html-minifier-terser + - lightningcss + - postcss + - uglify-js + whatwg-url@5.0.0: dependencies: tr46: 0.0.3 webidl-conversions: 3.0.1 - when@3.7.8: {} - which-boxed-primitive@1.1.1: dependencies: is-bigint: 1.1.0 @@ -6737,6 +6413,8 @@ snapshots: dependencies: string-width: 2.1.1 + wildcard@2.0.1: {} + word-wrap@1.2.5: {} wrap-ansi@5.1.0: @@ -6831,8 +6509,6 @@ snapshots: y18n: 5.0.8 yargs-parser: 21.1.1 - yn@3.1.1: {} - yocto-queue@0.1.0: {} zen-observable@0.8.15: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 4340350e19..ff2a9fbbbf 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,2 +1,3 @@ packages: - - 'packages/*' \ No newline at end of file + - 'packages/*' +autoInstallPeers: false diff --git a/scripts/bump-and-publish.js b/scripts/bump-and-publish.js index a12d83ff76..8eaa98516a 100755 --- a/scripts/bump-and-publish.js +++ b/scripts/bump-and-publish.js @@ -27,6 +27,15 @@ const semver = require('semver'); const ROOT_DIR = path.resolve(__dirname, '..'); const PACKAGES_DIR = path.join(ROOT_DIR, 'packages'); +const JESS_RUNTIME_DEPENDENCIES = [ + '@jesscss/compiler', + '@jesscss/core', + '@jesscss/plugin-less', + '@jesscss/plugin-less-compat', + '@jesscss/plugin-node-modules' +]; +const OPTIONAL_SCRIPT_PLUGIN_PEER = '@jesscss/plugin-js'; +const FORBIDDEN_LESS_RUNTIME_DEPENDENCIES = ['jess']; // Get all package.json files function getPackageFiles() { @@ -53,6 +62,18 @@ function getPackageFiles() { return packages; } +// A release has one workspace version only for its root manifest and public +// packages. Private fixtures deliberately retain their own compatibility +// version and must never be rewritten as a side effect of publishing Less. +function getReleasePackageFiles() { + return getPackageFiles().filter(pkgPath => { + if (pkgPath === path.join(ROOT_DIR, 'package.json')) { + return true; + } + return !readPackage(pkgPath).private; + }); +} + // Read package.json function readPackage(pkgPath) { return JSON.parse(fs.readFileSync(pkgPath, 'utf8')); @@ -92,6 +113,21 @@ function getNpmVersion(packageName) { } } +// Return the exact published version when it exists. The unqualified `version` +// query follows `latest`, which is not useful on the alpha branch while Less +// v5 is still unpublished (latest remains on the Less 4 line). +function getExactNpmVersion(packageName, version) { + try { + return execSync(`npm view ${packageName}@${version} version`, { + encoding: 'utf8', + stdio: ['ignore', 'pipe', 'ignore'] + }).trim(); + } catch (e) { + // An unpublished exact version is the expected first-alpha case. + return null; + } +} + // Get the current alpha dist-tag version from NPM function getNpmAlphaVersion(packageName) { try { @@ -102,6 +138,91 @@ function getNpmAlphaVersion(packageName) { } } +/** + * Resolve the Jess alpha version that the published Less package must use. + * The release branch must commit exact published Jess alpha dependencies; the + * publish command validates that committed manifest instead of rewriting it. + */ +function getJessPublishVersion() { + const lessPkgPath = path.join(PACKAGES_DIR, 'less', 'package.json'); + const dependencies = readPackage(lessPkgPath).dependencies || {}; + const missing = JESS_RUNTIME_DEPENDENCIES.filter(name => !(name in dependencies)); + if (missing.length > 0) { + throw new Error(`less package is missing Jess runtime dependencies: ${missing.join(', ')}`); + } + + const pinned = JESS_RUNTIME_DEPENDENCIES.map(name => dependencies[name]); + const unique = [...new Set(pinned)]; + if (unique.length !== 1) { + throw new Error(`Jess runtime dependencies must all use the same published alpha version: ${unique.join(', ')}`); + } + + const manifestVersion = unique[0]; + if (!semver.valid(manifestVersion) || !manifestVersion.includes('-alpha.')) { + throw new Error(`Jess runtime dependencies must be pinned to a valid published alpha version, received: ${manifestVersion}`); + } + return manifestVersion; +} + +/** + * A non-dry alpha publish must name Jess runtime packages that are already on + * npm. Keep this guard ahead of all release mutations: failing it must not + * create a Less commit, tag, or push. + */ +function verifyJessRuntimePublishedVersion(version, lookup = getExactNpmVersion) { + const missing = JESS_RUNTIME_DEPENDENCIES.filter(name => lookup(name, version) !== version); + if (missing.length > 0) { + throw new Error(`Jess runtime packages must be published before a Less alpha publish: ${missing.join(', ')}@${version}`); + } + return version; +} + +function verifyScriptPluginOptionalPeer(version, manifest = readPackage(path.join(PACKAGES_DIR, 'less', 'package.json'))) { + for (const name of FORBIDDEN_LESS_RUNTIME_DEPENDENCIES) { + if (manifest.dependencies && name in manifest.dependencies) { + throw new Error(`${name} must not be a Less runtime dependency`); + } + if (manifest.optionalDependencies && name in manifest.optionalDependencies) { + throw new Error(`${name} must not be a Less optionalDependency`); + } + } + if (manifest.dependencies && OPTIONAL_SCRIPT_PLUGIN_PEER in manifest.dependencies) { + throw new Error(`${OPTIONAL_SCRIPT_PLUGIN_PEER} must not be a Less runtime dependency`); + } + if (manifest.optionalDependencies && OPTIONAL_SCRIPT_PLUGIN_PEER in manifest.optionalDependencies) { + throw new Error(`${OPTIONAL_SCRIPT_PLUGIN_PEER} must be an optional peer, not an optionalDependency`); + } + if (manifest.peerDependencies?.[OPTIONAL_SCRIPT_PLUGIN_PEER] !== version) { + throw new Error(`${OPTIONAL_SCRIPT_PLUGIN_PEER} optional peer must be pinned to ${version}`); + } + if (manifest.peerDependenciesMeta?.[OPTIONAL_SCRIPT_PLUGIN_PEER]?.optional !== true) { + throw new Error(`${OPTIONAL_SCRIPT_PLUGIN_PEER} peer dependency must be marked optional`); + } + return version; +} + +/** + * Select the alpha version without treating the `latest` Less 4 release as + * evidence that an explicitly configured Less 5 alpha should be bumped. + * `exactPublishedVersion` is null when the current version is not on npm. + */ +function determineAlphaVersion(currentVersion, exactPublishedVersion, explicitVersion) { + if (explicitVersion && explicitVersion !== currentVersion) { + throw new Error( + `EXPLICIT_VERSION (${explicitVersion}) must match the committed alpha manifest (${currentVersion}); prepare the version change before publishing` + ); + } + if (!semver.valid(currentVersion) || !/-alpha\.\d+$/u.test(currentVersion)) { + throw new Error(`Alpha manifest version must be X.Y.Z-alpha.N, received: ${currentVersion}`); + } + // Alpha manifests are intentional release inputs, never something this + // script guesses and rewrites. In particular, a first alpha remains .1. + // The exact-published lookup is accepted for backwards-compatible callers; + // `verifyUnpublishedVersion` is the actionable release guard. + void exactPublishedVersion; + return currentVersion; +} + // Determine the target version for publishing. // Priority: EXPLICIT_VERSION env > package.json (if ahead of NPM) > NPM patch bump function getTargetVersion(currentVersion, npmVersion) { @@ -126,7 +247,7 @@ function getTargetVersion(currentVersion, npmVersion) { // Update all package.json files with new version function updateAllVersions(newVersion) { - const packageFiles = getPackageFiles(); + const packageFiles = getReleasePackageFiles(); const updated = []; for (const pkgPath of packageFiles) { @@ -141,6 +262,100 @@ function updateAllVersions(newVersion) { return updated; } +function verifyReleaseManifestVersions(version, packageFiles = getReleasePackageFiles()) { + for (const pkgPath of packageFiles) { + const pkg = readPackage(pkgPath); + if (pkg.version !== version) { + throw new Error( + `Release manifest ${path.relative(ROOT_DIR, pkgPath)} has version ${pkg.version}; expected ${version}` + ); + } + } +} + +function verifyWorkspacePackageJson() { + // Parse every workspace package manifest, including private fixtures. This + // catches malformed package metadata without assigning private packages the + // public release version. + for (const pkgPath of getPackageFiles()) { + readPackage(pkgPath); + } +} + +function verifyCleanWorktree() { + const status = execSync('git status --porcelain --untracked-files=all', { + cwd: ROOT_DIR, + encoding: 'utf8' + }).trim(); + if (status) { + throw new Error('Release worktree is not clean; commit, stash, or remove local changes before publishing'); + } +} + +function hasStagedChanges() { + try { + execSync('git diff --cached --quiet', { cwd: ROOT_DIR, stdio: 'ignore' }); + return false; + } catch (error) { + if (error.status === 1) { + return true; + } + throw error; + } +} + +function verifyAlphaRepositoryState(version) { + execSync('git fetch origin alpha master', { cwd: ROOT_DIR, stdio: 'ignore' }); + + const [behind, ahead] = execSync('git rev-list --left-right --count origin/alpha...HEAD', { + cwd: ROOT_DIR, + encoding: 'utf8' + }).trim().split(/\s+/u).map(Number); + if (behind !== 0 || ahead !== 0) { + throw new Error( + `Local alpha must exactly match origin/alpha before publishing (behind ${behind}, ahead ${ahead})` + ); + } + + const missingMasterCommits = Number(execSync('git rev-list --count HEAD..origin/master', { + cwd: ROOT_DIR, + encoding: 'utf8' + }).trim()); + if (missingMasterCommits > 0) { + throw new Error(`Alpha branch is behind origin/master by ${missingMasterCommits} commit(s)`); + } + + if (!semver.valid(version) || !/-alpha\.\d+$/u.test(version)) { + throw new Error(`Alpha release version must be X.Y.Z-alpha.N, received: ${version}`); + } + const masterPkg = JSON.parse(execSync('git show origin/master:packages/less/package.json', { + cwd: ROOT_DIR, + encoding: 'utf8' + })); + const alphaBase = version.replace(/-alpha\.\d+$/u, ''); + if (!semver.gte(alphaBase, masterPkg.version)) { + throw new Error(`Alpha base version ${alphaBase} is lower than origin/master ${masterPkg.version}`); + } +} + +function verifyUnpublishedVersion(packageName, version, lookup = getExactNpmVersion) { + if (lookup(packageName, version)) { + throw new Error(`${packageName}@${version} is already published; prepare and commit the next release version first`); + } +} + +function getAlreadyPublishedPackages(packages, version, lookup = getExactNpmVersion) { + return packages.filter(pkg => lookup(pkg.name, version)); +} + +function verifyRemoteTagCommit(tagName, remoteTagCommit, headCommit) { + if (remoteTagCommit && remoteTagCommit !== headCommit) { + throw new Error( + `Remote tag ${tagName} points at ${remoteTagCommit}, which differs from HEAD ${headCommit}; aborting publish` + ); + } +} + // Get packages that should be published (not private) function getPublishablePackages() { const packageFiles = getPackageFiles(); @@ -192,23 +407,28 @@ function main() { // as-is and fail fast if it is not ahead of the already-published version. let nextVersion; + let jessPublishVersion; + const publishable = getPublishablePackages(); + let alreadyPublished = []; + if (isAlpha) { - // Validate that the version carries the expected '-alpha.' prerelease tag. - if (!currentVersion.includes('-alpha.')) { - console.error(`❌ ERROR: Alpha branch package.json version (${currentVersion}) must contain '-alpha.'`); - console.error(` The alpha release PR should have bumped to an X.Y.Z-alpha.N version.`); - process.exit(1); - } + try { + const exactPublishedVersion = getExactNpmVersion('less', currentVersion); + const npmAlphaVersion = getNpmAlphaVersion('less'); + console.log(`📦 NPM alpha version: ${npmAlphaVersion || '(not published)'}`); + nextVersion = determineAlphaVersion(currentVersion, exactPublishedVersion, process.env.EXPLICIT_VERSION); + console.log(`📦 Using committed alpha version: ${nextVersion}`); - const npmAlphaVersion = getNpmAlphaVersion('less'); - console.log(`📦 NPM alpha version: ${npmAlphaVersion || '(not published)'}`); - if (npmAlphaVersion && semver.valid(currentVersion) && !semver.gt(currentVersion, npmAlphaVersion)) { - console.error(`❌ ERROR: package.json version (${currentVersion}) must be greater than NPM alpha version (${npmAlphaVersion})`); - console.error(` On alpha the version bump should have arrived via the alpha release PR.`); + jessPublishVersion = getJessPublishVersion(); + verifyScriptPluginOptionalPeer(jessPublishVersion); + if (!dryRun) { + verifyJessRuntimePublishedVersion(jessPublishVersion); + } + console.log(`✅ Less package will publish against Jess ${jessPublishVersion}`); + } catch (error) { + console.error(`❌ ERROR: ${error.message || error}`); process.exit(1); } - nextVersion = currentVersion; - console.log(`📦 Using package.json version (no auto-increment on alpha): ${nextVersion}`); } else { // For master: the version bump was already applied via the release PR. // Use the version already in package.json as-is; never auto-increment here @@ -225,10 +445,33 @@ function main() { console.log(`📦 Using package.json version (no auto-increment on master): ${nextVersion}`); } + // These are real release guards, not post-release diagnostics. A real + // release must fail before it mutates tags or talks to npm. Dry-run is + // intentionally only a plan: it can run before the prerequisite Jess alpha is + // published, but cannot claim release readiness. + try { + verifyWorkspacePackageJson(); + verifyReleaseManifestVersions(nextVersion); + if (isAlpha && !dryRun) { + verifyCleanWorktree(); + verifyAlphaRepositoryState(nextVersion); + alreadyPublished = getAlreadyPublishedPackages(publishable, nextVersion); + if (alreadyPublished.length > 0) { + console.warn( + `⚠️ ${alreadyPublished.length} package(s) already exist on npm for ${nextVersion}; ` + + 'assuming a publish rerun and skipping them.' + ); + } + } + } catch (error) { + console.error(`❌ ERROR: ${error.message || error}`); + process.exit(1); + } + // Get publishable packages - const publishable = getPublishablePackages(); console.log(`📦 Found ${publishable.length} publishable packages:`); publishable.forEach(pkg => console.log(` - ${pkg.name}`)); + const alreadyPublishedNames = new Set(alreadyPublished.map(pkg => pkg.name)); // Both master and alpha: the version-bump commit already lives on the branch // (it came from the release PR). Do NOT create another local commit or push @@ -237,7 +480,7 @@ function main() { // // Only the annotated tag is pushed. Tag pushes bypass branch-protection // "require pull request" rules. - + // Create and push the annotated tag — idempotently. // // The tag is created and pushed BEFORE the npm publish loop below. If a @@ -247,11 +490,11 @@ function main() { // leaving the release stuck until someone deletes the tag by hand. // // To make reruns safe we check the remote for the tag: if it already exists - // we simply skip the tag step and fall straight through to the publish retry. - // We do NOT compare it to HEAD — on a rerun `alpha` may have moved past the - // original release commit, and the goal here is only to retry publishing the - // already-tagged version, not to police where the tag points. Only when the - // tag is genuinely absent do we create + push a fresh annotated tag. + // and still points at HEAD, we simply skip the tag step and fall straight + // through to the publish retry. If the remote tag points anywhere else, + // abort instead of publishing packages for a version tagged to another + // commit. Only when the tag is genuinely absent do we create + push a fresh + // annotated tag. // // For master the version-bump commit already lives on the branch (it came // from the release PR). Only the annotated tag is pushed — tag pushes bypass @@ -281,12 +524,16 @@ function main() { if (remoteTagCommit) { // Rerun-after-failed-publish path: the version is already tagged on the - // remote. Skip create/push and fall through to the publish retry. - console.log(`✅ Remote tag ${tagName} already exists — skipping tag create/push, proceeding to publish.`); + // remote. Skip create/push and fall through to the publish retry only if + // the tag still points at the checked-out release commit. const headCommit = execSync('git rev-parse HEAD', { cwd: ROOT_DIR, encoding: 'utf8' }).trim(); - if (remoteTagCommit !== headCommit) { - console.warn(`⚠️ Remote tag ${tagName} points at ${remoteTagCommit}, which differs from HEAD ${headCommit}. Proceeding to publish anyway.`); + try { + verifyRemoteTagCommit(tagName, remoteTagCommit, headCommit); + } catch (error) { + console.error(`❌ ERROR: ${error.message || error}`); + process.exit(1); } + console.log(`✅ Remote tag ${tagName} already exists and points at HEAD; skipping tag create/push, proceeding to publish.`); } else if (dryRun) { console.log(` [DRY RUN] Remote tag ${tagName} not found — would create annotated tag and push to origin.`); } else { @@ -306,7 +553,7 @@ function main() { execSync(`git push origin "${tagName}"`, { cwd: ROOT_DIR, stdio: 'inherit' }); } - // Validate alpha branch requirements + // Compatibility log for the preflight validation above. if (isAlpha) { console.log(`\n🔍 Validating alpha branch requirements...`); @@ -323,55 +570,61 @@ function main() { // (This is enforced in the code below, but we log it for clarity) console.log(`✅ Will publish with 'alpha' tag (enforced)`); - // Validation 3: Check if alpha is behind master - try { - execSync('git fetch origin master:master 2>/dev/null || true', { cwd: ROOT_DIR }); - const masterCommits = execSync('git rev-list --count alpha..master 2>/dev/null || echo "0"', { - cwd: ROOT_DIR, - encoding: 'utf8' - }).trim(); - - if (parseInt(masterCommits, 10) > 0) { - console.error(`❌ ERROR: Alpha branch is behind master by ${masterCommits} commit(s)`); - console.error(` Alpha branch must include all commits from master before publishing`); - console.error(` Please merge master into alpha first`); - process.exit(1); + if (dryRun) { + console.log(`✅ Repository state checks are skipped in dry-run mode`); + } else { + // Validation 3: Check if alpha is behind master. This intentionally uses + // HEAD, not a local branch named `alpha`; publish runs from the checked-out + // release commit. + try { + execSync('git fetch origin master', { cwd: ROOT_DIR, stdio: 'ignore' }); + const masterCommits = execSync('git rev-list --count HEAD..origin/master', { + cwd: ROOT_DIR, + encoding: 'utf8' + }).trim(); + + if (parseInt(masterCommits, 10) > 0) { + console.error(`❌ ERROR: Alpha branch is behind master by ${masterCommits} commit(s)`); + console.error(` Alpha branch must include all commits from master before publishing`); + console.error(` Please merge master into alpha first`); + process.exit(1); + } + console.log(`✅ Alpha branch is up to date with master`); + } catch (e) { + console.log(`⚠️ Could not verify master sync status, continuing...`); } - console.log(`✅ Alpha branch is up to date with master`); - } catch (e) { - console.log(`⚠️ Could not verify master sync status, continuing...`); - } - - // Validation 4: Alpha base version must be >= master version - try { - const masterVersionStr = execSync('git show master:packages/less/package.json 2>/dev/null', { - cwd: ROOT_DIR, - encoding: 'utf8' - }); - const masterPkg = JSON.parse(masterVersionStr); - const masterVersion = masterPkg.version; - - // Extract base version from alpha version (remove -alpha.X) - const alphaBase = nextVersion.replace(/-alpha\.\d+$/, ''); - - // Semver comparison using semver library - const isGreaterOrEqual = semver.gte(alphaBase, masterVersion); - - if (!isGreaterOrEqual) { - console.error(`❌ ERROR: Alpha base version (${alphaBase}) is lower than master version (${masterVersion})`); - console.error(` According to semver, alpha base version must be >= master version`); - process.exit(1); + + // Validation 4: Alpha base version must be >= master version + try { + const masterVersionStr = execSync('git show origin/master:packages/less/package.json', { + cwd: ROOT_DIR, + encoding: 'utf8' + }); + const masterPkg = JSON.parse(masterVersionStr); + const masterVersion = masterPkg.version; + + // Extract base version from alpha version (remove -alpha.X) + const alphaBase = nextVersion.replace(/-alpha\.\d+$/, ''); + + // Semver comparison using semver library + const isGreaterOrEqual = semver.gte(alphaBase, masterVersion); + + if (!isGreaterOrEqual) { + console.error(`❌ ERROR: Alpha base version (${alphaBase}) is lower than master version (${masterVersion})`); + console.error(` According to semver, alpha base version must be >= master version`); + process.exit(1); + } + console.log(`✅ Alpha base version (${alphaBase}) is >= master version (${masterVersion})`); + } catch (e) { + console.log(`⚠️ Could not compare with master version, continuing...`); } - console.log(`✅ Alpha base version (${alphaBase}) is >= master version (${masterVersion})`); - } catch (e) { - console.log(`⚠️ Could not compare with master version, continuing...`); } } // Determine NPM tag based on branch and version const npmTag = isAlpha ? 'alpha' : 'latest'; const isAlphaVersion = nextVersion.includes('-alpha.'); - + // Validation: Alpha versions must use 'alpha' tag, non-alpha versions must use 'latest' tag if (isAlphaVersion && npmTag !== 'alpha') { console.error(`❌ ERROR: Alpha version (${nextVersion}) must be published with 'alpha' tag, not '${npmTag}'`); @@ -400,6 +653,8 @@ function main() { if (dryRun) { console.log(` [DRY RUN] Would publish: ${pkg.name}@${nextVersion} with tag: ${npmTag}`); console.log(` [DRY RUN] Command: npm publish --tag ${npmTag}`); + } else if (alreadyPublishedNames.has(pkg.name)) { + console.log(`⏭️ ${pkg.name}@${nextVersion} is already published; skipping.`); } else { try { // For scoped packages, ensure access is set correctly @@ -456,4 +711,14 @@ if (require.main === module) { main(); } -module.exports = { main }; +module.exports = { + determineAlphaVersion, + getAlreadyPublishedPackages, + getJessPublishVersion, + verifyJessRuntimePublishedVersion, + verifyScriptPluginOptionalPeer, + verifyReleaseManifestVersions, + verifyRemoteTagCommit, + verifyUnpublishedVersion, + main +}; diff --git a/scripts/bump-and-publish.test.mjs b/scripts/bump-and-publish.test.mjs new file mode 100644 index 0000000000..1795736cb7 --- /dev/null +++ b/scripts/bump-and-publish.test.mjs @@ -0,0 +1,136 @@ +import assert from 'node:assert/strict'; +import test from 'node:test'; +import { createRequire } from 'node:module'; + +const require = createRequire(import.meta.url); +const { + determineAlphaVersion, + getAlreadyPublishedPackages, + getJessPublishVersion, + verifyJessRuntimePublishedVersion, + verifyScriptPluginOptionalPeer, + verifyReleaseManifestVersions, + verifyRemoteTagCommit, + verifyUnpublishedVersion, +} = require('./bump-and-publish.js'); + +const committedJessVersion = getJessPublishVersion(); +const escapedCommittedJessVersion = committedJessVersion.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&'); + +test('preserves an explicitly configured first Less v5 alpha when unpublished', () => { + assert.equal( + determineAlphaVersion('5.0.0-alpha.1', null), + '5.0.0-alpha.1', + ); +}); + +test('does not silently increment a committed alpha manifest', () => { + assert.equal( + determineAlphaVersion('5.0.0-alpha.1', '5.0.0-alpha.1'), + '5.0.0-alpha.1', + ); +}); + +test('rejects an environment version that does not match the committed alpha', () => { + assert.throws( + () => determineAlphaVersion('5.0.0-alpha.1', null, '5.0.0-alpha.2'), + /must match the committed alpha manifest/u, + ); +}); + +test('requires an exact Jess alpha for a Less alpha publish', () => { + assert.match(committedJessVersion, /^\d+\.\d+\.\d+-alpha\.\d+$/u); +}); + +test('requires Jess runtime packages to be published before a non-dry Less alpha publish', () => { + assert.equal( + verifyJessRuntimePublishedVersion(committedJessVersion, (_name, version) => version), + committedJessVersion, + ); + assert.throws( + () => verifyJessRuntimePublishedVersion(committedJessVersion, name => + name === '@jesscss/compiler' ? null : committedJessVersion), + new RegExp(`@jesscss/compiler@${escapedCommittedJessVersion}`, 'u'), + ); +}); + +test('keeps plugin-js as an optional peer instead of a shipped dependency', () => { + assert.equal( + verifyScriptPluginOptionalPeer(committedJessVersion, { + peerDependencies: { '@jesscss/plugin-js': committedJessVersion }, + peerDependenciesMeta: { '@jesscss/plugin-js': { optional: true } } + }), + committedJessVersion, + ); + assert.throws( + () => verifyScriptPluginOptionalPeer(committedJessVersion, { + dependencies: { '@jesscss/plugin-js': committedJessVersion }, + peerDependencies: { '@jesscss/plugin-js': committedJessVersion }, + peerDependenciesMeta: { '@jesscss/plugin-js': { optional: true } } + }), + /must not be a Less runtime dependency/u, + ); + assert.throws( + () => verifyScriptPluginOptionalPeer(committedJessVersion, { + optionalDependencies: { '@jesscss/plugin-js': committedJessVersion }, + peerDependencies: { '@jesscss/plugin-js': committedJessVersion }, + peerDependenciesMeta: { '@jesscss/plugin-js': { optional: true } } + }), + /not an optionalDependency/u, + ); + assert.throws( + () => verifyScriptPluginOptionalPeer(committedJessVersion, { + dependencies: { jess: committedJessVersion }, + peerDependencies: { '@jesscss/plugin-js': committedJessVersion }, + peerDependenciesMeta: { '@jesscss/plugin-js': { optional: true } } + }), + /jess must not be a Less runtime dependency/u, + ); +}); + +test('requires every public release manifest to use the committed alpha version', () => { + const fs = require('node:fs'); + const os = require('node:os'); + const path = require('node:path'); + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'less-release-manifests-')); + const matching = path.join(dir, 'matching.json'); + const stale = path.join(dir, 'stale.json'); + fs.writeFileSync(matching, '{"version":"5.0.0-alpha.1"}\n'); + fs.writeFileSync(stale, '{"version":"5.0.0-alpha.2"}\n'); + + assert.doesNotThrow(() => verifyReleaseManifestVersions('5.0.0-alpha.1', [matching])); + assert.throws( + () => verifyReleaseManifestVersions('5.0.0-alpha.1', [matching, stale]), + /stale\.json has version 5\.0\.0-alpha\.2/u, + ); +}); + +test('rejects an already-published Less alpha before release mutations', () => { + assert.doesNotThrow(() => verifyUnpublishedVersion('less', '5.0.0-alpha.1', () => null)); + assert.throws( + () => verifyUnpublishedVersion('less', '5.0.0-alpha.1', () => '5.0.0-alpha.1'), + /already published/u, + ); +}); + +test('detects already-published packages for alpha publish reruns', () => { + const packages = [ + { name: 'less' }, + { name: '@less/test-data' }, + { name: '@less/private-fixture' }, + ]; + const published = getAlreadyPublishedPackages( + packages, + '5.0.0-alpha.1', + name => name === 'less' ? '5.0.0-alpha.1' : null, + ); + assert.deepEqual(published, [{ name: 'less' }]); +}); + +test('rejects a remote release tag that points away from HEAD', () => { + assert.doesNotThrow(() => verifyRemoteTagCommit('v5.0.0-alpha.1', 'abc123', 'abc123')); + assert.throws( + () => verifyRemoteTagCommit('v5.0.0-alpha.1', 'abc123', 'def456'), + /Remote tag v5\.0\.0-alpha\.1 points at abc123, which differs from HEAD def456; aborting publish/u, + ); +}); diff --git a/scripts/post-merge-version-fix.js b/scripts/post-merge-version-fix.js index 4d654b325a..c94a8adbec 100755 --- a/scripts/post-merge-version-fix.js +++ b/scripts/post-merge-version-fix.js @@ -151,3 +151,7 @@ if (require.main === module) { } module.exports = { main }; + + + + diff --git a/scripts/publish-beta.js b/scripts/publish-beta.js new file mode 100644 index 0000000000..f37598caa7 --- /dev/null +++ b/scripts/publish-beta.js @@ -0,0 +1,118 @@ +#!/usr/bin/env node + +/** + * Publish a beta release locally. + * 1. Fetches latest version from npm + * 2. Sets version to next patch + beta.0 (e.g. 4.6.2 → 4.6.3-beta.0) + * 3. Updates all package.json files + * 4. Builds and runs tests + * 5. Publishes to npm with --tag beta (use NPM_TAG=xyz to override) + * + * Usage: pnpm run publish:beta + * pnpm run publish:beta -- --no-test # skip tests + * pnpm run publish:beta -- --dry-run # no publish + * NPM_TAG=next pnpm run publish:beta # use different tag (default: beta) + */ + +const fs = require('fs'); +const path = require('path'); +const { execSync } = require('child_process'); +const semver = require('semver'); + +const ROOT_DIR = path.resolve(__dirname, '..'); +const PACKAGES_DIR = path.join(ROOT_DIR, 'packages'); + +function getPackageFiles() { + const packages = [path.join(ROOT_DIR, 'package.json')]; + const dirs = fs.readdirSync(PACKAGES_DIR, { withFileTypes: true }) + .filter(d => d.isDirectory()) + .map(d => path.join(PACKAGES_DIR, d.name, 'package.json')) + .filter(p => fs.existsSync(p)); + return [...packages, ...dirs]; +} + +function getNpmVersion(name) { + try { + return execSync(`npm view ${name} version`, { encoding: 'utf8' }).trim(); + } catch { + return null; + } +} + +function updateAllVersions(version) { + for (const pkgPath of getPackageFiles()) { + const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); + if (pkg.version) { + pkg.version = version; + fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, '\t') + '\n'); + } + } +} + +function getPublishablePackages() { + const publishable = []; + for (const pkgPath of getPackageFiles()) { + const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); + if (!pkg.private && pkg.name && pkg.name !== '@less/root') { + publishable.push({ name: pkg.name, dir: path.dirname(pkgPath) }); + } + } + return publishable; +} + +function main() { + const args = process.argv.slice(2); + const dryRun = args.includes('--dry-run'); + const skipTest = args.includes('--no-test'); + const npmTag = process.env.NPM_TAG || 'beta'; + + const npmVersion = getNpmVersion('less'); + if (!npmVersion) { + console.error('Could not fetch latest version from npm'); + process.exit(1); + } + + const nextPatch = semver.inc(npmVersion, 'patch'); + const betaVersion = `${nextPatch}-beta.0`; + + console.log(`📦 NPM latest: ${npmVersion}`); + console.log(`🔢 Setting version: ${betaVersion}\n`); + + if (!dryRun) { + updateAllVersions(betaVersion); + console.log(`✅ Updated all package.json files\n`); + } else { + console.log(` [DRY RUN] Would update package.json files to ${betaVersion}\n`); + } + + console.log('🔨 Building...'); + execSync('pnpm run build', { cwd: path.join(PACKAGES_DIR, 'less'), stdio: 'inherit' }); + console.log(''); + + if (!skipTest) { + console.log('🧪 Running tests...'); + execSync('pnpm run test:node', { cwd: ROOT_DIR, stdio: 'inherit' }); + console.log(''); + } + + if (dryRun) { + console.log(`🧪 DRY RUN - Would publish ${betaVersion} with tag '${npmTag}'`); + return; + } + + const publishable = getPublishablePackages(); + console.log(`📤 Publishing to npm with tag '${npmTag}'...\n`); + + for (const pkg of publishable) { + console.log(` Publishing ${pkg.name}@${betaVersion}...`); + execSync(`npm publish --tag ${npmTag} --access public`, { + cwd: pkg.dir, + stdio: 'inherit' + }); + } + + console.log(`\n🎉 Published ${betaVersion} to npm`); + console.log(` Install with: npm install less@${npmTag}`); +} + +main(); diff --git a/scripts/release-metadata.js b/scripts/release-metadata.js index bd4d4b2310..6a36775f81 100644 --- a/scripts/release-metadata.js +++ b/scripts/release-metadata.js @@ -105,10 +105,21 @@ function nextVersion(base, currentVersion, npmVersion) { if (!semver.valid(currentVersion)) { throw new Error(`Invalid current package version: ${currentVersion}`); } + const publishedVersion = npmVersion && semver.valid(npmVersion) ? npmVersion : ''; if (isAlphaBase(base)) { - const baseVersion = npmVersion && semver.valid(npmVersion) && semver.gt(npmVersion, currentVersion) - ? npmVersion + const current = semver.parse(currentVersion); + if ( + current.prerelease.length === 2 && + current.prerelease[0] === 'alpha' && + typeof current.prerelease[1] === 'number' && + (!publishedVersion || semver.gt(currentVersion, publishedVersion)) + ) { + return currentVersion; + } + + const baseVersion = publishedVersion && semver.gt(publishedVersion, currentVersion) + ? publishedVersion : currentVersion; const match = baseVersion.match(/^(\d+\.\d+\.\d+)-alpha\.(\d+)$/); if (match) { @@ -118,10 +129,10 @@ function nextVersion(base, currentVersion, npmVersion) { return `${parsed.major + 1}.0.0-alpha.1`; } - if (npmVersion && semver.valid(npmVersion) && semver.gt(currentVersion, npmVersion)) { + if (publishedVersion && semver.gt(currentVersion, publishedVersion)) { return currentVersion; } - return semver.inc(npmVersion || currentVersion, 'patch'); + return semver.inc(publishedVersion || currentVersion, 'patch'); } function packageFiles() { @@ -132,8 +143,8 @@ function packageFiles() { return [...files, ...packageDirs].filter(file => fs.existsSync(file)); } -function syncPackageVersions(version) { - validateVersionForBase(version.includes('-alpha.') ? 'alpha' : 'master', version); +function syncPackageVersions(base, version) { + validateVersionForBase(base, version); for (const file of packageFiles()) { const pkg = JSON.parse(fs.readFileSync(file, 'utf8')); if (!pkg.version) continue; @@ -217,10 +228,10 @@ function syncChangelogVersion(version, previousVersion) { return true; } -function syncFiles(version, previousVersion) { +function syncFiles(base, version, previousVersion) { const changelogUpdate = readChangelogUpdate(version, previousVersion); - syncPackageVersions(version); + syncPackageVersions(base, version); if (changelogUpdate.status === 'updated' || changelogUpdate.status === 'inserted') { fs.writeFileSync(changelogUpdate.path, changelogUpdate.content); } @@ -237,8 +248,8 @@ function usage() { node scripts/release-metadata.js validate [npmVersion] node scripts/release-metadata.js validate-title-sync [npmVersion] node scripts/release-metadata.js next-version [npmVersion] - node scripts/release-metadata.js sync-package-versions - node scripts/release-metadata.js sync-files `); + node scripts/release-metadata.js sync-package-versions + node scripts/release-metadata.js sync-files `); } function main(argv = process.argv.slice(2)) { @@ -259,9 +270,9 @@ function main(argv = process.argv.slice(2)) { } else if (command === 'next-version') { process.stdout.write(nextVersion(args[0], args[1], args[2] || '')); } else if (command === 'sync-package-versions') { - syncPackageVersions(args[0]); + syncPackageVersions(args[0], args[1]); } else if (command === 'sync-files') { - syncFiles(args[0], args[1]); + syncFiles(args[0], args[1], args[2]); } else { usage(); process.exit(1); diff --git a/scripts/test-release-automation.js b/scripts/test-release-automation.js index e872863536..f73ce0c800 100644 --- a/scripts/test-release-automation.js +++ b/scripts/test-release-automation.js @@ -27,7 +27,10 @@ * * 5. create-release-pr no-op safety (isolated temp git repo) * - when a version bump produces changes → a commit is created - * - when no version changes are needed → exits cleanly with no commit + * - when no version changes are needed → creates an explicit release commit + * + * 6. release title sync no-op safety + * - when release files already match → exits without an empty commit loop * * Run: * node scripts/test-release-automation.js @@ -48,6 +51,10 @@ const { spawnSync, execSync } = require('child_process'); const releaseMetadata = require('./release-metadata'); const ROOT_DIR = path.resolve(__dirname, '..'); +const LESS_MANIFEST = JSON.parse( + fs.readFileSync(path.join(ROOT_DIR, 'packages', 'less', 'package.json'), 'utf8') +); +const JESS_TEST_VERSION = LESS_MANIFEST.dependencies['@jesscss/compiler']; // --------------------------------------------------------------------------- // Resolve semver — works both after `pnpm install` and in a bare sandbox @@ -107,7 +114,10 @@ function section(title) { * (github.event.pull_request.base.ref == 'master' && * startsWith(github.event.pull_request.title, 'chore: release v')) || * (github.event.pull_request.base.ref == 'alpha' && - * startsWith(github.event.pull_request.title, 'chore: alpha release v')) + * ( + * startsWith(github.event.pull_request.title, 'chore: release v') || + * startsWith(github.event.pull_request.title, 'chore: alpha release v') + * )) * ) */ function publishShouldRun({ repo, prMerged, prBaseRef, prTitle }) { @@ -133,13 +143,15 @@ function publishShouldRun({ repo, prMerged, prBaseRef, prTitle }) { /** * create-release-pr.yml `if:` condition: * + * github.event_name == 'push' && * github.repository == 'less/less.js' && * !contains(github.event.head_commit.message, 'chore: release v') && * !contains(github.event.head_commit.message, 'chore: alpha release v') && * !contains(github.event.head_commit.message, '/release-v') && * !contains(github.event.head_commit.message, '/alpha-release-v') */ -function createReleasePRShouldRun({ repo, commitMessage }) { +function createReleasePRShouldRun({ repo, eventName, commitMessage }) { + if (eventName !== 'push') return false; if (repo !== 'less/less.js') return false; if (commitMessage.includes('chore: release v')) return false; if (commitMessage.includes('chore: alpha release v')) return false; @@ -177,7 +189,25 @@ function makeFakeRepo({ packageVersion }) { fs.mkdirSync(pkgDir, { recursive: true }); fs.writeFileSync( path.join(pkgDir, 'package.json'), - JSON.stringify({ name: 'less', version: packageVersion }, null, '\t') + '\n', + JSON.stringify({ + name: 'less', + version: packageVersion, + dependencies: { + '@jesscss/compiler': JESS_TEST_VERSION, + '@jesscss/core': JESS_TEST_VERSION, + '@jesscss/plugin-less': JESS_TEST_VERSION, + '@jesscss/plugin-less-compat': JESS_TEST_VERSION, + '@jesscss/plugin-node-modules': JESS_TEST_VERSION, + }, + peerDependencies: { + '@jesscss/plugin-js': JESS_TEST_VERSION, + }, + peerDependenciesMeta: { + '@jesscss/plugin-js': { + optional: true, + }, + }, + }, null, '\t') + '\n', ); // Minimal git repo @@ -203,6 +233,33 @@ function makeFakeRepo({ packageVersion }) { function runBumpAndPublish(fakeRoot, extraEnv = {}) { const scriptsDir = path.join(fakeRoot, 'scripts'); fs.mkdirSync(scriptsDir, { recursive: true }); + const binDir = path.join(fakeRoot, '.test-bin'); + fs.mkdirSync(binDir, { recursive: true }); + fs.writeFileSync(path.join(binDir, 'npm'), `#!/bin/sh +set -eu +if [ "$1" = "view" ] && [ "$2" = "less" ] && [ "$3" = "version" ]; then + printf '%s\\n' "\${TEST_NPM_LATEST_VERSION:-4.8.1}" + exit 0 +fi +if [ "$1" = "view" ] && [ "$2" = "less" ] && [ "$3" = "dist-tags.alpha" ]; then + if [ "\${TEST_NPM_ALPHA_VERSION:-}" ]; then + printf '%s\\n' "$TEST_NPM_ALPHA_VERSION" + exit 0 + fi + exit 1 +fi +case "$2" in + less@*) + if [ "\${TEST_NPM_EXACT_VERSION:-}" ]; then + printf '%s\\n' "$TEST_NPM_EXACT_VERSION" + exit 0 + fi + exit 1 + ;; +esac +exit 1 +`); + fs.chmodSync(path.join(binDir, 'npm'), 0o755); // Read the production script and patch the ROOT_DIR line. let src = fs.readFileSync(path.join(ROOT_DIR, 'scripts', 'bump-and-publish.js'), 'utf8'); @@ -234,6 +291,7 @@ function runBumpAndPublish(fakeRoot, extraEnv = {}) { env: { ...process.env, ...extraEnv, + PATH: `${binDir}:${process.env.PATH}`, }, encoding: 'utf8', }); @@ -256,13 +314,24 @@ function runBumpAndPublish(fakeRoot, extraEnv = {}) { // whether a commit is created when there are (or aren't) version changes. // --------------------------------------------------------------------------- -function runCreateReleasePRStep({ repoDir, nextVersion, releaseBranch }) { +function runCreateReleasePRStep({ repoDir, nextVersion, releaseBranch, releaseBase = releaseBranch.includes('alpha') ? 'alpha' : 'master' }) { // Stub `gh` binary so any calls are recorded but do nothing const binDir = path.join(repoDir, '.test-bin'); fs.mkdirSync(binDir, { recursive: true }); const ghLog = path.join(repoDir, 'gh-calls.log'); fs.writeFileSync(path.join(binDir, 'gh'), `#!/bin/sh\necho "$@" >> "${ghLog}"\n`); fs.chmodSync(path.join(binDir, 'gh'), 0o755); + const scriptsDir = path.join(repoDir, 'scripts'); + fs.mkdirSync(scriptsDir, { recursive: true }); + let releaseScript = fs.readFileSync(path.join(ROOT_DIR, 'scripts', 'release-metadata.js'), 'utf8') + .replace(/^#!.*\n/, ''); + if (SEMVER_PATH) { + releaseScript = releaseScript.replace( + /require\('semver'\)/g, + `require(${JSON.stringify(SEMVER_PATH)})`, + ); + } + fs.writeFileSync(path.join(scriptsDir, 'release-metadata.js'), releaseScript); const initialHead = execSync('git rev-parse HEAD', { cwd: repoDir, encoding: 'utf8' }).trim(); @@ -270,33 +339,19 @@ function runCreateReleasePRStep({ repoDir, nextVersion, releaseBranch }) { set -euo pipefail NEXT_VERSION=${JSON.stringify(nextVersion)} RELEASE_BRANCH=${JSON.stringify(releaseBranch)} +RELEASE_BASE=${JSON.stringify(releaseBase)} TITLE="chore: release v\${NEXT_VERSION}" git checkout -b "\${RELEASE_BRANCH}" -node -e " - const fs = require('fs'); - const version = process.env.NEXT_VERSION; - const dirs = fs.readdirSync('packages', { withFileTypes: true }) - .filter(d => d.isDirectory()) - .map(d => 'packages/' + d.name + '/package.json'); - for (const f of ['package.json', ...dirs].filter(f => fs.existsSync(f))) { - const pkg = JSON.parse(fs.readFileSync(f, 'utf8')); - if (!pkg.version) continue; - pkg.version = version; - fs.writeFileSync(f, JSON.stringify(pkg, null, '\\t') + '\\n'); - } -" +node scripts/release-metadata.js sync-package-versions "\${RELEASE_BASE}" "\${NEXT_VERSION}" git add package.json packages/*/package.json -COMMITTED=false if git diff --cached --quiet; then echo "STATUS:NO_CHANGES" -else - git commit -m "\${TITLE}" - COMMITTED=true fi -echo "STATUS:COMMITTED=\${COMMITTED}" +git commit --allow-empty -m "\${TITLE}" +echo "STATUS:COMMITTED=true" `; const result = spawnSync('bash', ['-c', script], { @@ -518,6 +573,17 @@ test('npm alpha check rejects an alpha title version that is already published', ); }); +test('next version ignores invalid npm version input while choosing a default', () => { + assert.strictEqual( + releaseMetadata.nextVersion('master', '4.9.0', 'npm ERR registry unavailable'), + '4.9.1', + ); + assert.strictEqual( + releaseMetadata.nextVersion('alpha', '5.0.0-alpha.3', 'not-a-version'), + '5.0.0-alpha.3', + ); +}); + test('title sync rejects versions lower than the release branch package version', () => { assert.throws( () => releaseMetadata.validateTitleSync('master', '4.8.0', '4.9.0', '4.7.0'), @@ -610,28 +676,28 @@ section('2. create-release-pr.yml — workflow trigger conditions'); test('normal merge to master → SHOULD trigger', () => { assert.strictEqual( - createReleasePRShouldRun({ repo: 'less/less.js', commitMessage: 'fix: correct color parsing' }), + createReleasePRShouldRun({ repo: 'less/less.js', eventName: 'push', commitMessage: 'fix: correct color parsing' }), true, ); }); test('normal merge to alpha → SHOULD trigger', () => { assert.strictEqual( - createReleasePRShouldRun({ repo: 'less/less.js', commitMessage: 'feat: new feature for next major' }), + createReleasePRShouldRun({ repo: 'less/less.js', eventName: 'push', commitMessage: 'feat: new feature for next major' }), true, ); }); test('master release PR merge → should NOT trigger (loop guard)', () => { assert.strictEqual( - createReleasePRShouldRun({ repo: 'less/less.js', commitMessage: 'chore: release v4.6.4' }), + createReleasePRShouldRun({ repo: 'less/less.js', eventName: 'push', commitMessage: 'chore: release v4.6.4' }), false, ); }); test('alpha release PR merge → should NOT trigger (loop guard)', () => { assert.strictEqual( - createReleasePRShouldRun({ repo: 'less/less.js', commitMessage: 'chore: alpha release v5.0.0-alpha.2' }), + createReleasePRShouldRun({ repo: 'less/less.js', eventName: 'push', commitMessage: 'chore: alpha release v5.0.0-alpha.2' }), false, ); }); @@ -640,6 +706,7 @@ test('release branch ref in commit message → should NOT trigger (loop guard fo assert.strictEqual( createReleasePRShouldRun({ repo: 'less/less.js', + eventName: 'push', commitMessage: 'Merge chore/release-v4.6.4 into master', }), false, @@ -650,6 +717,7 @@ test('alpha release branch ref in commit message → should NOT trigger (loop gu assert.strictEqual( createReleasePRShouldRun({ repo: 'less/less.js', + eventName: 'push', commitMessage: 'Merge chore/alpha-release-v5.0.0-alpha.2 into alpha', }), false, @@ -658,7 +726,14 @@ test('alpha release branch ref in commit message → should NOT trigger (loop gu test('wrong repository → should NOT trigger', () => { assert.strictEqual( - createReleasePRShouldRun({ repo: 'fork/less.js', commitMessage: 'fix: something' }), + createReleasePRShouldRun({ repo: 'fork/less.js', eventName: 'push', commitMessage: 'fix: something' }), + false, + ); +}); + +test('pull request event → should NOT trigger', () => { + assert.strictEqual( + createReleasePRShouldRun({ repo: 'less/less.js', eventName: 'pull_request', commitMessage: 'fix: something' }), false, ); }); @@ -673,24 +748,24 @@ test('wrong repository → should NOT trigger', () => { section('3. create-release-pr.yml — alpha version increment logic'); -test('4.x: 4.6.3-alpha.1 → 4.6.3-alpha.2', () => { - assert.strictEqual(nextAlphaVersion('4.6.3-alpha.1'), '4.6.3-alpha.2'); +test('unpublished alpha manifest is preserved: 5.0.0-alpha.1 → 5.0.0-alpha.1', () => { + assert.strictEqual(nextAlphaVersion('5.0.0-alpha.1'), '5.0.0-alpha.1'); }); -test('5.x: 5.0.0-alpha.1 → 5.0.0-alpha.2 (answers the original question)', () => { - assert.strictEqual(nextAlphaVersion('5.0.0-alpha.1'), '5.0.0-alpha.2'); +test('published alpha increments: 5.0.0-alpha.1 → 5.0.0-alpha.2', () => { + assert.strictEqual(nextAlphaVersion('5.0.0-alpha.1', '5.0.0-alpha.1'), '5.0.0-alpha.2'); }); test('5.x: 5.0.0-alpha.3 → 5.0.0-alpha.4 (preserves major, not 4.x)', () => { - assert.strictEqual(nextAlphaVersion('5.0.0-alpha.3'), '5.0.0-alpha.4'); + assert.strictEqual(nextAlphaVersion('5.0.0-alpha.3', '5.0.0-alpha.3'), '5.0.0-alpha.4'); }); test('5.x minor/patch: 5.1.2-alpha.7 → 5.1.2-alpha.8', () => { - assert.strictEqual(nextAlphaVersion('5.1.2-alpha.7'), '5.1.2-alpha.8'); + assert.strictEqual(nextAlphaVersion('5.1.2-alpha.7', '5.1.2-alpha.7'), '5.1.2-alpha.8'); }); test('double-digit rollover: 5.0.0-alpha.9 → 5.0.0-alpha.10 (integer, not string comparison)', () => { - assert.strictEqual(nextAlphaVersion('5.0.0-alpha.9'), '5.0.0-alpha.10'); + assert.strictEqual(nextAlphaVersion('5.0.0-alpha.9', '5.0.0-alpha.9'), '5.0.0-alpha.10'); }); test('npm alpha ahead of package.json: 5.0.0-alpha.1 with npm alpha.4 → 5.0.0-alpha.5', () => { @@ -808,8 +883,10 @@ test('alpha: uses package.json version as-is (no auto-increment)', () => { `Expected version 5.0.0-alpha.2 in output.\nSTDOUT: ${stdout}`, ); assert.ok( - stdout.includes('no auto-increment on alpha') || stdout.includes('Using package.json version'), - `Expected "no auto-increment" message.\nSTDOUT: ${stdout}`, + stdout.includes('Using committed alpha version') || + stdout.includes('no auto-increment on alpha') || + stdout.includes('Using package.json version'), + `Expected committed-version/no-auto-increment message.\nSTDOUT: ${stdout}`, ); } finally { fs.rmSync(fakeDir, { recursive: true, force: true }); @@ -932,8 +1009,8 @@ test('version bump needed: creates a commit on the release branch', () => { } }); -test('no version bump needed: exits cleanly, no new commit, no gh calls', () => { - // Repo starts at 4.6.4 (target version) → no diff → no commit +test('no version bump needed: creates explicit release commit, no gh calls', () => { + // Repo starts at 4.6.4 (target version) → no diff → explicit release commit const repoDir = makeFakeRepo({ packageVersion: '4.6.4' }); try { const res = runCreateReleasePRStep({ @@ -942,11 +1019,15 @@ test('no version bump needed: exits cleanly, no new commit, no gh calls', () => releaseBranch: 'chore/release-v4.6.4', }); assert.strictEqual(res.exitCode, 0, `Script exited ${res.exitCode}.\nSTDOUT: ${res.stdout}\nSTDERR: ${res.stderr}`); - assert.ok(!res.newCommitCreated, 'Expected NO new commit when version is already at target'); + assert.ok(res.newCommitCreated, 'Expected an explicit release commit when version is already at target'); assert.ok( res.stdout.includes('STATUS:NO_CHANGES'), `Expected NO_CHANGES status.\nSTDOUT: ${res.stdout}`, ); + assert.ok( + res.stdout.includes('STATUS:COMMITTED=true'), + `Expected COMMITTED=true status.\nSTDOUT: ${res.stdout}`, + ); assert.strictEqual( res.ghCalls, '', `Expected no gh commands to be invoked.\ngh calls log: ${res.ghCalls}`, @@ -956,6 +1037,19 @@ test('no version bump needed: exits cleanly, no new commit, no gh calls', () => } }); +test('release title sync no-op exits without an empty commit', () => { + const workflow = fs.readFileSync(path.join(ROOT_DIR, '.github', 'workflows', 'create-release-pr.yml'), 'utf8'); + const syncStep = workflow.slice(workflow.indexOf(' - name: Sync release files to title version')); + assert.ok( + syncStep.includes('echo "Release files already match v${VERSION}"\n exit 0'), + 'Expected sync-title no-op path to exit cleanly', + ); + assert.ok( + !syncStep.includes('git commit --allow-empty'), + 'Sync-title no-op must not create empty commits on synchronize events', + ); +}); + test('alpha version bump needed: commit created for alpha release branch', () => { // Repo at 5.0.0-alpha.1; bump target is 5.0.0-alpha.2 → diff → commit const repoDir = makeFakeRepo({ packageVersion: '5.0.0-alpha.1' }); diff --git a/scripts/verify-alpha-packed-consumer.mjs b/scripts/verify-alpha-packed-consumer.mjs new file mode 100644 index 0000000000..f8a13c7498 --- /dev/null +++ b/scripts/verify-alpha-packed-consumer.mjs @@ -0,0 +1,392 @@ +#!/usr/bin/env node +/** + * Prove the unpublished Less v5 alpha package works as a real npm consumer. + * + * The alpha checkout commits exact published Jess alpha dependencies. This + * check packs the unpublished Less package, installs it in a clean temporary + * consumer, and lets npm resolve those committed registry dependencies. Nothing + * in the Less checkout is rewritten, installed, published, tagged, or committed + * by this script. + */ +import { spawnSync } from 'node:child_process'; +import { + cpSync, + existsSync, + lstatSync, + mkdirSync, + mkdtempSync, + readFileSync, + readdirSync, + realpathSync, + rmSync, + writeFileSync +} from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const lessRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); +const lessPackageDir = path.join(lessRoot, 'packages', 'less'); +const keep = process.argv.includes('--keep'); +const lessJessDependencies = [ + '@jesscss/compiler', + '@jesscss/core', + '@jesscss/plugin-less', + '@jesscss/plugin-less-compat', + '@jesscss/plugin-node-modules' +]; +const optionalScriptPluginPeer = '@jesscss/plugin-js'; +const forbiddenLessRuntimeDependencies = ['jess']; +const alphaVersionPattern = /^\d+\.\d+\.\d+-alpha\.\d+$/u; + +function fail(message) { + throw new Error(message); +} + +function assert(condition, message) { + if (!condition) { + fail(message); + } +} + +function run(command, args, cwd, options = {}) { + const rendered = [command, ...args].join(' '); + console.log(`\n$ ${rendered}`); + const result = spawnSync(command, args, { + cwd, + encoding: 'utf8', + shell: process.platform === 'win32', + ...options + }); + if (result.error) { + fail(`${rendered} failed to start: ${result.error.message}`); + } + if (result.status !== 0) { + const output = [result.stdout, result.stderr].filter(Boolean).join('\n').trim(); + fail(`${rendered} failed with ${result.status ?? 'unknown exit'}${output ? `:\n${output}` : ''}`); + } + return result; +} + +function readJson(filePath) { + return JSON.parse(readFileSync(filePath, 'utf8')); +} + +function readExpectedJessVersion(manifest = readJson(path.join(lessPackageDir, 'package.json'))) { + const versions = []; + for (const name of lessJessDependencies) { + const version = manifest.dependencies?.[name]; + assert(typeof version === 'string' && alphaVersionPattern.test(version), + `Committed Less dependency ${name} must be an exact Jess alpha version, found ${version ?? '(missing)'}`); + versions.push(version); + } + const unique = [...new Set(versions)]; + assert(unique.length === 1, + `Committed Less Jess runtime dependencies must share one version, found ${unique.join(', ')}`); + const expected = unique[0]; + assert(manifest.peerDependencies?.[optionalScriptPluginPeer] === expected, + `${optionalScriptPluginPeer} must be declared as an optional peer at ${expected}`); + assert(manifest.peerDependenciesMeta?.[optionalScriptPluginPeer]?.optional === true, + `${optionalScriptPluginPeer} peer dependency must be marked optional`); + return expected; +} + +function writeJson(filePath, value) { + writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`); +} + +const expectedJessVersion = readExpectedJessVersion(); + +function packageDirFor(name) { + return name.startsWith('@') ? path.join(...name.split('/')) : name; +} + +function readPackedManifest(tarball, { quiet = false } = {}) { + const result = spawnSync('tar', ['-xOf', tarball, 'package/package.json'], { + encoding: 'utf8', + shell: process.platform === 'win32' + }); + if (result.error || result.status !== 0) { + if (!quiet) { + fail(`Unable to read packed manifest ${tarball}: ${result.error?.message ?? result.stderr ?? 'tar failed'}`); + } + return null; + } + return JSON.parse(result.stdout); +} + +function findPackedTarball(packDir, name) { + for (const file of readdirSync(packDir)) { + if (!file.endsWith('.tgz')) { + continue; + } + const tarball = path.join(packDir, file); + if (readPackedManifest(tarball, { quiet: true })?.name === name) { + return tarball; + } + } + fail(`No packed tarball found for ${name}`); +} + +function packTemporaryLess(packDir) { + const tempLessDir = path.join(path.dirname(packDir), 'less'); + cpSync(lessPackageDir, tempLessDir, { + recursive: true, + filter(source) { + const relative = path.relative(lessPackageDir, source); + return !relative.startsWith('node_modules') && !relative.startsWith('.git'); + } + }); + const packagePath = path.join(tempLessDir, 'package.json'); + const manifest = readJson(packagePath); + assert(manifest.name === 'less', `Expected Less package manifest, got ${manifest.name ?? '(unnamed)'}`); + assert(manifest.version === '5.0.0-alpha.1', + `Expected Less 5.0.0-alpha.1 manifest, found ${manifest.version}`); + for (const name of lessJessDependencies) { + const specifier = String(manifest.dependencies?.[name] ?? ''); + assert(specifier === expectedJessVersion, + `Expected committed Less dependency ${name} to be ${expectedJessVersion}, found ${specifier}`); + } + for (const name of forbiddenLessRuntimeDependencies) { + assert(manifest.dependencies?.[name] === undefined, + `Committed Less must not depend on ${name}`); + assert(manifest.optionalDependencies?.[name] === undefined, + `Committed Less must not ship ${name} as an optionalDependency`); + } + assert(manifest.dependencies?.[optionalScriptPluginPeer] === undefined, + `${optionalScriptPluginPeer} must not be a Less runtime dependency`); + assert(manifest.optionalDependencies?.[optionalScriptPluginPeer] === undefined, + `${optionalScriptPluginPeer} must not be a Less optionalDependency because package managers install optional dependencies by default`); + assert(manifest.peerDependencies?.[optionalScriptPluginPeer] === expectedJessVersion, + `${optionalScriptPluginPeer} must be declared as an optional peer at ${expectedJessVersion}`); + assert(manifest.peerDependenciesMeta?.[optionalScriptPluginPeer]?.optional === true, + `${optionalScriptPluginPeer} peer dependency must be marked optional`); + run('npm', ['pack', '--ignore-scripts', '--json', '--pack-destination', packDir], tempLessDir); + const tarball = findPackedTarball(packDir, 'less'); + const packed = readPackedManifest(tarball); + assert(packed.version === manifest.version, `Packed Less version is ${packed.version}, expected ${manifest.version}`); + for (const name of lessJessDependencies) { + const specifier = packed.dependencies?.[name]; + assert(specifier === expectedJessVersion, + `Packed Less dependency ${name} is ${specifier}, expected ${expectedJessVersion}`); + } + for (const name of forbiddenLessRuntimeDependencies) { + assert(packed.dependencies?.[name] === undefined, + `Packed Less must not depend on ${name}`); + assert(packed.optionalDependencies?.[name] === undefined, + `Packed Less must not ship ${name} as an optionalDependency`); + } + assert(packed.dependencies?.[optionalScriptPluginPeer] === undefined, + `Packed Less must not ship ${optionalScriptPluginPeer} as a runtime dependency`); + assert(packed.optionalDependencies?.[optionalScriptPluginPeer] === undefined, + `Packed Less must not ship ${optionalScriptPluginPeer} as an optionalDependency`); + assert(packed.peerDependencies?.[optionalScriptPluginPeer] === expectedJessVersion, + `Packed Less peer ${optionalScriptPluginPeer} is ${packed.peerDependencies?.[optionalScriptPluginPeer]}, expected ${expectedJessVersion}`); + assert(packed.peerDependenciesMeta?.[optionalScriptPluginPeer]?.optional === true, + `Packed Less peer ${optionalScriptPluginPeer} must be marked optional`); + return { tarball, version: manifest.version }; +} + +function assertConsumerDoesNotResolveInto(consumerDir, forbiddenRoots, packageNames, tarballs) { + const normalizedRoots = forbiddenRoots.map(root => realpathSync.native(root)); + const assertOutside = (candidate, description) => { + const resolved = realpathSync.native(candidate); + for (const root of normalizedRoots) { + assert(resolved !== root && !resolved.startsWith(`${root}${path.sep}`), + `${description} resolves into a workspace: ${resolved}`); + } + }; + const modulesDir = path.join(consumerDir, 'node_modules'); + for (const name of packageNames) { + const installed = path.join(modulesDir, packageDirFor(name)); + assert(existsSync(installed), `consumer install omitted ${name}`); + assert(!lstatSync(installed).isSymbolicLink(), `consumer installed ${name} as a symlink`); + assertOutside(installed, `consumer package ${name}`); + } + const lock = readJson(path.join(consumerDir, 'package-lock.json')); + for (const name of packageNames) { + const entry = lock.packages?.[`node_modules/${name}`]; + assert(entry, `consumer lock omitted ${name}`); + const expected = `file:${path.relative(consumerDir, tarballs.get(name)).split(path.sep).join('/')}`; + assert(entry.resolved === expected, + `consumer did not install ${name} from its expected packed tarball: ${entry.resolved ?? '(missing resolved)'}`); + } + const pending = [modulesDir]; + while (pending.length > 0) { + const current = pending.pop(); + for (const entry of readdirSync(current, { withFileTypes: true })) { + const candidate = path.join(current, entry.name); + if (entry.isSymbolicLink()) { + assertOutside(candidate, `consumer symlink ${candidate}`); + } else if (entry.isDirectory()) { + pending.push(candidate); + } + } + } +} + +function assertConsumerRegistryPackages(consumerDir, forbiddenRoots, packageNames) { + const normalizedRoots = forbiddenRoots.map(root => realpathSync.native(root)); + const assertOutside = (candidate, description) => { + const resolved = realpathSync.native(candidate); + for (const root of normalizedRoots) { + assert(resolved !== root && !resolved.startsWith(`${root}${path.sep}`), + `${description} resolves into a workspace: ${resolved}`); + } + }; + const modulesDir = path.join(consumerDir, 'node_modules'); + const lock = readJson(path.join(consumerDir, 'package-lock.json')); + for (const name of packageNames) { + const installed = path.join(modulesDir, packageDirFor(name)); + assert(existsSync(installed), `consumer install omitted ${name}`); + assert(!lstatSync(installed).isSymbolicLink(), `consumer installed ${name} as a symlink`); + assertOutside(installed, `consumer package ${name}`); + const manifest = readJson(path.join(installed, 'package.json')); + assert(manifest.version === expectedJessVersion, + `consumer installed ${name}@${manifest.version ?? '(missing version)'}, expected ${expectedJessVersion}`); + const entry = lock.packages?.[`node_modules/${name}`]; + assert(entry, `consumer lock omitted ${name}`); + assert(entry.version === expectedJessVersion, + `consumer lock installed ${name}@${entry.version ?? '(missing version)'}, expected ${expectedJessVersion}`); + } + assert(!existsSync(path.join(modulesDir, 'jess')), + 'consumer installed the batteries-included jess package; less should depend only on the generic compiler and Less plugins'); +} + +function writeConsumerChecks(consumerDir) { + const checkPath = path.join(consumerDir, 'verify-lessc.mjs'); + writeFileSync(checkPath, ` +import assert from 'node:assert/strict'; +import { spawnSync } from 'node:child_process'; +import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from 'node:fs'; +import path from 'node:path'; + +const consumer = process.cwd(); +const lessc = path.join(consumer, 'node_modules', '.bin', process.platform === 'win32' ? 'lessc.cmd' : 'lessc'); +const lessPackageCli = path.join(consumer, 'node_modules', 'less', 'bin', 'lessc'); +const fixture = path.join(consumer, 'fixtures'); +mkdirSync(fixture, { recursive: true }); +assert.ok(existsSync(lessc), 'packed install did not expose lessc'); +if (process.platform === 'win32') { + const shim = readFileSync(lessc, 'utf8').replaceAll('/', '\\\\'); + assert.match( + shim, + /\\\\less\\\\bin\\\\lessc/u, + 'packed consumer lessc resolves to another package; the Less tarball must own its public CLI' + ); +} else { + assert.equal( + realpathSync(lessc), + realpathSync(lessPackageCli), + 'packed consumer lessc resolves to another package; the Less tarball must own its public CLI' + ); +} +function run(args, options = {}) { + const result = spawnSync(lessc, args, { + cwd: fixture, + encoding: 'utf8', + shell: process.platform === 'win32', + ...options + }); + if (result.error) throw result.error; + return result; +} + +function stripTerminalFormatting(value) { + return String(value) + .replace(/\\x1B\\]8;;[^\\x1B]*(?:\\x1B\\\\|\\x07)/gu, '') + .replace(/\\x1B\\[[0-?]*[ -/]*[@-~]/gu, ''); +} + +function assertNoUiControlSequences(value, label) { + assert.doesNotMatch(value, /\\x1B\\[\\?\\d+[hl]/u, + label + ' must not use alternate-screen or private terminal mode controls'); + assert.doesNotMatch(value, /\\x1B\\]9;/u, + label + ' must not use OSC live-region controls'); +} + +const version = run(['--version']); +assert.equal(version.status, 0, version.stderr); +assert.match(version.stdout, /^lessc 5\\.0\\.0-alpha\\.1 \\(Less Compiler\\) \\[Jess\\]\\n$/u); + +const stdin = run(['-'], { input: '.stdin { color: red; }\\n' }); +assert.equal(stdin.status, 0, stdin.stderr); +assert.match(stdin.stdout, /\\.stdin[\\s\\S]*color: red;/u); + +writeFileSync(path.join(fixture, 'dep.less'), '.dep { color: blue; }\\n'); +writeFileSync(path.join(fixture, 'entry.less'), '@import "./dep.less";\\n.entry { color: red; }\\n'); +const output = path.join(fixture, 'entry.css'); +const file = run(['entry.less', output]); +assert.equal(file.status, 0, file.stderr); +const css = readFileSync(output, 'utf8'); +assert.match(css, /\\.dep[\\s\\S]*color: blue;/u); +assert.match(css, /\\.entry[\\s\\S]*color: red;/u); + +writeFileSync(path.join(fixture, 'bad.less'), '.broken { color: }\\n.next {\\n'); +const malformed = run(['bad.less']); +assert.notEqual(malformed.status, 0, 'lessc accepted malformed input'); +assert.ok(malformed.stderr.trim().length > 0, 'lessc emitted no malformed-input diagnostic'); +assert.match(malformed.stderr, /\\x1B\\[[0-?]*[ -/]*m/u, + 'packed lessc must emit colored Linecraft diagnostics by default'); +assertNoUiControlSequences(malformed.stderr, 'packed lessc diagnostics'); +assert.match(malformed.stderr, /[\\u256d\\u2570]/u, + 'packed lessc must emit Linecraft source framing by default'); +const malformedPlain = stripTerminalFormatting(malformed.stderr); +assert.match(malformedPlain, /parse\\/syntax-error \\[parse\\]/u, + 'packed lessc must report the Linecraft diagnostic code'); +assert.match(malformedPlain, /bad\\.less:2:1/u, + 'packed lessc must report filename, line, and column'); +assert.match(malformedPlain, /\\.next \\{/u, + 'packed lessc must report the malformed source line'); +assert.doesNotMatch(malformedPlain, / on line \\d+, column \\d+/u, + 'packed lessc must not reformat diagnostics into Less 4-style text'); +assert.doesNotMatch(malformedPlain, /^Error: Less parser error\\.$/m, + 'packed lessc must not append a duplicate plain Error after a Linecraft diagnostic'); +console.log('packed lessc stdin, file/import, and malformed-input paths passed'); +`.trimStart()); + return checkPath; +} + +function main() { + const tempRoot = mkdtempSync(path.join(os.tmpdir(), 'less-alpha-packed-consumer-')); + const packDir = path.join(tempRoot, 'packs'); + const consumerDir = path.join(tempRoot, 'consumer'); + try { + mkdirSync(packDir, { recursive: true }); + mkdirSync(consumerDir, { recursive: true }); + const less = packTemporaryLess(packDir); + const dependencies = Object.fromEntries([ + ['less', `file:${path.relative(consumerDir, less.tarball)}`], + ]); + writeJson(path.join(consumerDir, 'package.json'), { + name: 'less-alpha-packed-consumer-proof', + private: true, + type: 'module', + version: '0.0.0', + dependencies + }); + run('npm', ['install', '--ignore-scripts', '--no-audit', '--no-fund', '--omit=dev'], consumerDir); + assertConsumerDoesNotResolveInto( + consumerDir, + [lessRoot], + ['less'], + new Map([['less', less.tarball]]) + ); + assertConsumerRegistryPackages(consumerDir, [lessRoot], lessJessDependencies); + run(process.execPath, [writeConsumerChecks(consumerDir)], consumerDir); + console.log(`\nPacked Less ${less.version} consumer proof passed with Jess ${expectedJessVersion}.`); + } finally { + if (keep) { + console.log(`Kept packed consumer fixture: ${tempRoot}`); + } else { + rmSync(tempRoot, { recursive: true, force: true }); + } + } +} + +try { + main(); +} catch (error) { + console.error(`\nPacked Less alpha consumer proof failed: ${error instanceof Error ? error.message : String(error)}`); + process.exitCode = 1; +}