Comparing version 7.0.0 to 7.0.1
# True Changelog | ||
## 7.0.1 (01/04/24) | ||
- FEATURE: Validate `runSass` arguments and warn if using v6 API. | ||
- DOCUMENTATION: Add note that `{ style: 'compressed' }` is not supported. | ||
- DOCUMENTATION: Add note about possible Jest error and workaround. | ||
- INTERNAL: Update dependencies | ||
## 7.0.0 (12/14/22) | ||
@@ -11,2 +18,7 @@ | ||
path (or string), 3) optional Sass options | ||
- **Note that some of the Sass options have changed.** For example, | ||
`includePaths` is now `loadPaths`, `outputStyle` is now `style`, `importer` | ||
is now `importers`, etc. See the [Dart Sass | ||
documentation](https://sass-lang.com/documentation/js-api/interfaces/Options) | ||
for more details. | ||
- BREAKING: Require `sass` (`>=1.45.0`) as a peer-dependency, removing True | ||
@@ -33,3 +45,3 @@ `sass` option | ||
// Sass options [required] | ||
{ file: sassFile, outputStyle: 'compressed' }, | ||
{ file: sassFile, includePaths: ['node_modules'] }, | ||
// True options [required] | ||
@@ -45,3 +57,6 @@ { describe, it, sass }, | ||
// Sass options [required] | ||
{ data: sassString, outputStyle: 'compressed' }, | ||
{ | ||
data: sassString, | ||
includePaths: ['node_modules'], | ||
}, | ||
// True options [required] | ||
@@ -65,3 +80,3 @@ { describe, it, sass }, | ||
// Sass options [optional] | ||
{ style: 'compressed' }, | ||
{ loadPaths: ['node_modules'] }, | ||
); | ||
@@ -79,3 +94,3 @@ | ||
// Sass options [optional] | ||
{ style: 'compressed' }, | ||
{ loadPaths: ['node_modules'] }, | ||
); | ||
@@ -82,0 +97,0 @@ ``` |
@@ -1,2 +0,2 @@ | ||
import * as css from 'css'; | ||
import { CssAtRuleAST, CssCommentAST, CssRuleAST } from '@adobe/css-tools'; | ||
import type { Options, StringOptions } from 'sass'; | ||
@@ -35,3 +35,3 @@ export interface TrueOptions { | ||
}; | ||
export type Rule = css.Comment | css.Rule | css.AtRule; | ||
export type Rule = CssCommentAST | CssRuleAST | CssAtRuleAST; | ||
export type Parser = (rule: Rule, ctx: Context) => Parser; | ||
@@ -38,0 +38,0 @@ export declare const runSass: (trueOptions: TrueOptions, src: string, sassOptions?: Options<'sync'> | StringOptions<'sync'>) => void; |
@@ -29,4 +29,4 @@ "use strict"; | ||
exports.parse = exports.formatFailureMessage = exports.runSass = void 0; | ||
const css_tools_1 = require("@adobe/css-tools"); | ||
const assert = __importStar(require("assert")); | ||
const css = __importStar(require("css")); | ||
const jest_diff_1 = require("jest-diff"); | ||
@@ -48,2 +48,6 @@ const lodash_1 = require("lodash"); | ||
} | ||
// Warn if arguments match v6 API | ||
if (typeof src !== 'string' || !trueOptions.describe || !trueOptions.it) { | ||
throw new Error('The arguments provided to `runSass` do not match the new API introduced in True v7. Refer to the v7 release notes for migration documentation: https://github.com/oddbird/true/releases/tag/v7.0.0'); | ||
} | ||
const compiler = trueOpts.sourceType === 'string' ? sass_1.compileString : sass_1.compile; | ||
@@ -185,3 +189,3 @@ const parsedCss = compiler(src, sassOpts).css; | ||
var _a; | ||
const ast = css.parse(rawCss); | ||
const ast = (0, css_tools_1.parse)(rawCss); | ||
const ctx = { modules: [] }; | ||
@@ -372,3 +376,4 @@ let handler = parseModule; | ||
if (ctx.currentAssertion) { | ||
ctx.currentAssertion.output = css.stringify({ | ||
ctx.currentAssertion.output = (0, css_tools_1.stringify)({ | ||
type: css_tools_1.CssTypes.stylesheet, | ||
stylesheet: { rules: ctx.currentOutputRules || [] }, | ||
@@ -409,3 +414,4 @@ }); | ||
if (ctx.currentAssertion) { | ||
ctx.currentAssertion.expected = css.stringify({ | ||
ctx.currentAssertion.expected = (0, css_tools_1.stringify)({ | ||
type: css_tools_1.CssTypes.stylesheet, | ||
stylesheet: { rules: ctx.currentExpectedRules || [] }, | ||
@@ -444,3 +450,4 @@ }); | ||
if (ctx.currentAssertion) { | ||
ctx.currentAssertion.expected = css.stringify({ | ||
ctx.currentAssertion.expected = (0, css_tools_1.stringify)({ | ||
type: css_tools_1.CssTypes.stylesheet, | ||
stylesheet: { rules: ctx.currentExpectedRules || [] }, | ||
@@ -447,0 +454,0 @@ }); |
@@ -1,4 +0,4 @@ | ||
import { Comment, Node } from 'css'; | ||
import { CssAllNodesAST, CssCommentAST } from '@adobe/css-tools'; | ||
export declare const truthyValues: (item?: any) => boolean; | ||
export declare const isCommentNode: (node: Node) => node is Comment; | ||
export declare const isCommentNode: (node: CssAllNodesAST) => node is CssCommentAST; | ||
export declare const removeNewLines: (cssString: string) => string; | ||
@@ -5,0 +5,0 @@ export declare const splitSelectorAndProperties: (blocks: string[]) => { |
{ | ||
"name": "sass-true", | ||
"title": "True", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"description": "Unit testing for Sass.", | ||
@@ -70,36 +70,32 @@ "keywords": [ | ||
"dependencies": { | ||
"@types/css": "^0.0.33", | ||
"css": "^3.0.0", | ||
"jest-diff": "^29.3.1", | ||
"@adobe/css-tools": "^4.3.2", | ||
"jest-diff": "^29.7.0", | ||
"lodash": "^4.17.21" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.20.5", | ||
"@babel/preset-env": "^7.20.2", | ||
"@babel/preset-typescript": "^7.18.6", | ||
"@types/lodash": "^4.14.191", | ||
"@typescript-eslint/eslint-plugin": "^5.46.1", | ||
"@typescript-eslint/parser": "^5.46.1", | ||
"babel-jest": "^29.3.1", | ||
"chai": "^4.3.7", | ||
"eslint": "^8.29.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-import-resolver-typescript": "^3.5.2", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-simple-import-sort": "^8.0.0", | ||
"jest": "^29.3.1", | ||
"jest-environment-node-single-context": "^29.0.0", | ||
"@babel/core": "^7.23.7", | ||
"@babel/preset-env": "^7.23.7", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@types/lodash": "^4.14.202", | ||
"@typescript-eslint/eslint-plugin": "^6.17.0", | ||
"@typescript-eslint/parser": "^6.17.0", | ||
"babel-jest": "^29.7.0", | ||
"chai": "^4.3.10", | ||
"eslint": "^8.56.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-import-resolver-typescript": "^3.6.1", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-simple-import-sort": "^10.0.0", | ||
"jest": "^29.7.0", | ||
"jest-environment-node-single-context": "^29.2.0", | ||
"mocha": "^10.2.0", | ||
"npm-run-all": "^4.1.5", | ||
"postcss": "^8.4.20", | ||
"prettier": "^2.8.1", | ||
"sass": "^1.56.2", | ||
"postcss": "^8.4.32", | ||
"prettier": "^3.1.1", | ||
"sass": "^1.69.7", | ||
"sassdoc": "^2.7.4", | ||
"sassdoc-theme-herman": "^5.0.0", | ||
"stylelint": "^14.16.0", | ||
"stylelint-config-prettier": "^9.0.4", | ||
"stylelint-config-standard-scss": "^6.1.0", | ||
"stylelint-prettier": "^2.0.0", | ||
"typescript": "^4.9.4" | ||
"sassdoc-theme-herman": "^5.0.1", | ||
"stylelint": "^16.1.0", | ||
"stylelint-config-standard-scss": "^13.0.0", | ||
"typescript": "^5.3.3" | ||
}, | ||
@@ -111,3 +107,4 @@ "eyeglass": { | ||
"exports": false | ||
} | ||
}, | ||
"packageManager": "yarn@3.7.0" | ||
} |
@@ -169,2 +169,12 @@ # True | ||
**Note:** Because of differences between Jest globals and Node globals, Dart | ||
Sass often errors when trying to compile in a Jest environment (e.g. | ||
`J.getInterceptor$ax(...).map$1$1 is not a function`). This can usually be fixed | ||
by installing | ||
[jest-environment-node-single-context](https://github.com/kayahr/jest-environment-node-single-context) | ||
and setting `testEnvironment: 'jest-environment-node-single-context'` in | ||
`jest.config.js`. See [possible](https://github.com/sass/dart-sass/issues/1692) | ||
[related](https://github.com/dart-lang/sdk/issues/47670) | ||
[issues](https://github.com/facebook/jest/issues/2549). | ||
**Note:** Jest does not watch for changes in Sass files by default. To use | ||
@@ -205,2 +215,7 @@ `jest --watch` with True, add "scss" to your | ||
**Note:** True requires the | ||
[default Sass `'expanded'` output style](https://sass-lang.com/documentation/js-api/modules#OutputStyle), | ||
and will not work if `{ style: 'compressed' }` is used in the third argument to | ||
`runSass`. | ||
### Custom Importers | ||
@@ -207,0 +222,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
111639
4
25
580
248
+ Added@adobe/css-tools@^4.3.2
+ Added@adobe/css-tools@4.4.1(transitive)
- Removed@types/css@^0.0.33
- Removedcss@^3.0.0
- Removed@types/css@0.0.33(transitive)
- Removedatob@2.1.2(transitive)
- Removedcss@3.0.0(transitive)
- Removeddecode-uri-component@0.2.2(transitive)
- Removedinherits@2.0.4(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedsource-map-resolve@0.6.0(transitive)
Updatedjest-diff@^29.7.0