Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.80.6-dev

* No user-visible changes.

## 1.80.5

### Embedded Host
Expand Down
4 changes: 4 additions & 0 deletions pkg/sass-parser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.3-dev

* No user-visible changes.

## 0.4.2

* Add support for parsing variable declarations.
Expand Down
2 changes: 1 addition & 1 deletion pkg/sass-parser/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class _Syntax implements Syntax {

return new Root(
undefined,
sassInternal.parse(css.toString(), this.#syntax, opts?.from)
sassInternal.parse(css.toString(), this.#syntax, opts?.from),
);
}

Expand Down
45 changes: 23 additions & 22 deletions pkg/sass-parser/lib/src/configuration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('a configuration map', () => {
describe('empty', () => {
function describeNode(
description: string,
create: () => Configuration
create: () => Configuration,
): void {
describe(description, () => {
beforeEach(() => (node = create()));
Expand All @@ -35,12 +35,12 @@ describe('a configuration map', () => {

describeNode(
'parsed as SCSS',
() => (scss.parse('@use "foo"').nodes[0] as UseRule).configuration
() => (scss.parse('@use "foo"').nodes[0] as UseRule).configuration,
);

describeNode(
'parsed as Sass',
() => (sass.parse('@use "foo"').nodes[0] as UseRule).configuration
() => (sass.parse('@use "foo"').nodes[0] as UseRule).configuration,
);

describe('constructed manually', () => {
Expand All @@ -50,22 +50,22 @@ describe('a configuration map', () => {

describeNode(
'variables record',
() => new Configuration({variables: {}})
() => new Configuration({variables: {}}),
);
});

describeNode(
'constructed from props',
() =>
new UseRule({useUrl: 'foo', configuration: {variables: []}})
.configuration
.configuration,
);
});

describe('with a variable', () => {
function describeNode(
description: string,
create: () => Configuration
create: () => Configuration,
): void {
describe(description, () => {
beforeEach(() => (node = create()));
Expand All @@ -86,14 +86,14 @@ describe('a configuration map', () => {
'parsed as SCSS',
() =>
(scss.parse('@use "foo" with ($bar: "baz")').nodes[0] as UseRule)
.configuration
.configuration,
);

describeNode(
'parsed as Sass',
() =>
(sass.parse('@use "foo" with ($bar: "baz")').nodes[0] as UseRule)
.configuration
.configuration,
);

describe('constructed manually', () => {
Expand All @@ -104,12 +104,13 @@ describe('a configuration map', () => {
variables: [
{variableName: 'bar', expression: {text: 'baz', quotes: true}},
],
})
}),
);

describeNode(
'variables record',
() => new Configuration({variables: {bar: {text: 'baz', quotes: true}}})
() =>
new Configuration({variables: {bar: {text: 'baz', quotes: true}}}),
);
});

Expand All @@ -119,7 +120,7 @@ describe('a configuration map', () => {
new UseRule({
useUrl: 'foo',
configuration: {variables: {bar: {text: 'baz', quotes: true}}},
}).configuration
}).configuration,
);
});

Expand Down Expand Up @@ -225,7 +226,7 @@ describe('a configuration map', () => {
describe('adds a new variable', () => {
function describeVariable(
description: string,
create: () => Configuration
create: () => Configuration,
): void {
it(description, () => {
expect(create()).toBe(node);
Expand All @@ -238,15 +239,15 @@ describe('a configuration map', () => {
}

describeVariable('with Expression', () =>
node.set('baz', new StringExpression({text: 'bang', quotes: true}))
node.set('baz', new StringExpression({text: 'bang', quotes: true})),
);

describeVariable('with ExpressionProps', () =>
node.set('baz', {text: 'bang', quotes: true})
node.set('baz', {text: 'bang', quotes: true}),
);

describeVariable('with ConfiguredVariableObjectProps', () =>
node.set('baz', {expression: {text: 'bang', quotes: true}})
node.set('baz', {expression: {text: 'bang', quotes: true}}),
);
});

Expand All @@ -269,7 +270,7 @@ describe('a configuration map', () => {
foo: {text: 'bar', quotes: true},
baz: {text: 'bang', quotes: true},
},
}).toString()
}).toString(),
).toBe('($foo: "bar", $baz: "bang")'));
});

Expand All @@ -281,7 +282,7 @@ describe('a configuration map', () => {
foo: {text: 'bar', quotes: true},
baz: {text: 'bang', quotes: true},
},
}).toString()
}).toString(),
).toBe('($foo: "bar", $baz: "bang",)'));

it('with comma: true and afterValue', () =>
Expand All @@ -295,7 +296,7 @@ describe('a configuration map', () => {
raws: {afterValue: '/**/'},
},
},
}).toString()
}).toString(),
).toBe('($foo: "bar", $baz: "bang"/**/,)'));

it('with after', () =>
Expand All @@ -306,7 +307,7 @@ describe('a configuration map', () => {
foo: {text: 'bar', quotes: true},
baz: {text: 'bang', quotes: true},
},
}).toString()
}).toString(),
).toBe('($foo: "bar", $baz: "bang"/**/)'));

it('with after and afterValue', () =>
Expand All @@ -320,7 +321,7 @@ describe('a configuration map', () => {
raws: {afterValue: ' '},
},
},
}).toString()
}).toString(),
).toBe('($foo: "bar", $baz: "bang" /**/)'));

it('with afterValue and a guard', () =>
Expand All @@ -334,7 +335,7 @@ describe('a configuration map', () => {
guarded: true,
},
},
}).toString()
}).toString(),
).toBe('($foo: "bar", $baz: "bang" !default/**/)'));
});
});
Expand Down Expand Up @@ -422,6 +423,6 @@ describe('a configuration map', () => {
it.skip('toJSON', () =>
expect(
(scss.parse('@use "foo" with ($baz: "qux")').nodes[0] as UseRule)
.configuration
.configuration,
).toMatchSnapshot());
});
2 changes: 1 addition & 1 deletion pkg/sass-parser/lib/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class Configuration extends Node {
constructor(_: undefined, inner: sassInternal.ConfiguredVariable[]);
constructor(
defaults?: ConfigurationProps,
inner?: sassInternal.ConfiguredVariable[]
inner?: sassInternal.ConfiguredVariable[],
) {
super({});
this.raws = defaults?.raws ?? {};
Expand Down
Loading