Skip to content

Commit 8761c96

Browse files
authored
Merge pull request #413 from sass/merge-main
Merge main into feature.v2
2 parents b3ad64b + e4551e1 commit 8761c96

File tree

32 files changed

+370
-131
lines changed

32 files changed

+370
-131
lines changed

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"error",
66
{"allowExpressions": true}
77
],
8+
"n/no-extraneous-require": ["error", {
9+
"allowModules": ["sass"]
10+
}],
811
"func-style": ["error", "declaration"],
912
"prefer-const": ["error", {"destructuring": "all"}],
1013
// It would be nice to sort import declaration order as well, but that's not

.github/workflows/ci.yml

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
- uses: actions/checkout@v4
22-
- uses: actions/setup-node@v4
21+
- uses: actions/checkout@v6
22+
- uses: actions/setup-node@v6
2323
with:
2424
node-version: 'lts/*'
2525
check-latest: true
@@ -46,8 +46,8 @@ jobs:
4646
fail-fast: false
4747

4848
steps:
49-
- uses: actions/checkout@v4
50-
- uses: actions/setup-node@v4
49+
- uses: actions/checkout@v6
50+
- uses: actions/setup-node@v6
5151
with:
5252
node-version: ${{ matrix.node-version }}
5353
check-latest: true
@@ -89,10 +89,10 @@ jobs:
8989
node_version: lts/-2
9090

9191
steps:
92-
- uses: actions/checkout@v4
92+
- uses: actions/checkout@v6
9393
- uses: dart-lang/setup-dart@v1
9494
with: {sdk: stable}
95-
- uses: actions/setup-node@v4
95+
- uses: actions/setup-node@v6
9696
with: {node-version: "${{ matrix.node_version }}"}
9797

9898
- name: Check out Dart Sass
@@ -124,31 +124,10 @@ jobs:
124124
working-directory: sass-spec
125125

126126
deploy_npm:
127-
name: Deploy npm
128-
runs-on: ubuntu-latest
129-
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/embedded-host-node'"
130127
needs: [static_analysis, tests, sass_spec]
131-
132-
steps:
133-
- uses: actions/checkout@v4
134-
- uses: actions/setup-node@v4
135-
with:
136-
node-version: 'lts/*'
137-
check-latest: true
138-
registry-url: 'https://registry.npmjs.org'
139-
- run: npm install
140-
141-
- name: "Check we're not using a -dev version of the embedded protocol"
142-
run: jq -r '.["protocol-version"]' package.json | grep -qv -- '-dev$'
143-
- name: "Check we're not using a -dev version of the embedded compiler"
144-
run: jq -r '.["compiler-version"]' package.json | grep -qv -- '-dev$'
145-
146-
- name: Publish optional dependencies
147-
env:
148-
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
149-
run: |
150-
find ./npm -mindepth 1 -maxdepth 1 -print0 | xargs -0 -n 1 -- sh -xc 'npx ts-node ./tool/prepare-optional-release.ts --package=$(basename $1) && npm publish $1' --
151-
152-
- run: npm publish
153-
env:
154-
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
128+
if: "github.ref_type == 'tag' && github.event.repository.fork == false"
129+
permissions:
130+
attestations: write
131+
contents: write
132+
id-token: write
133+
uses: ./.github/workflows/release.yml

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
deploy_npm:
8+
name: Deploy npm
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v6
13+
- uses: actions/setup-node@v6
14+
with:
15+
node-version: 'lts/*'
16+
check-latest: true
17+
registry-url: 'https://registry.npmjs.org'
18+
19+
# npm trusted publisher infrastructure requires npm >=11.5.1
20+
- run: npm install -g npm@latest
21+
22+
- run: npm install
23+
24+
- name: "Check we're not using a -dev version of the embedded protocol"
25+
run: jq -r '.["protocol-version"]' package.json | grep -qv -- '-dev$'
26+
- name: "Check we're not using a -dev version of the embedded compiler"
27+
run: jq -r '.["compiler-version"]' package.json | grep -qv -- '-dev$'
28+
29+
- name: Publish optional dependencies
30+
run: |
31+
find ./npm -mindepth 1 -maxdepth 1 -print0 | xargs -0 -n 1 -- sh -xc 'npx ts-node ./tool/prepare-optional-release.ts --package=$(basename $1) && npm publish --provenance $1' --
32+
33+
- run: npm publish --provenance

CHANGELOG.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,150 @@
1+
## 1.97.1
2+
3+
* Fix a bug with the new CSS-style `if()` syntax where values would be evaluated
4+
even if their conditions didn't match.
5+
6+
## 1.97.0
7+
8+
* Add support for the `display-p3-linear` color space.
9+
10+
## 1.96.0
11+
12+
* Allow numbers with complex units (more than one numerator unit or more than
13+
zero denominator units) to be emitted to CSS. These are now emitted as
14+
`calc()` expressions, which now support complex units in plain CSS.
15+
16+
## 1.95.1
17+
18+
* No user-visible changes.
19+
20+
## 1.95.0
21+
22+
* Add support for the [CSS-style `if()` function]. In addition to supporting the
23+
plain CSS syntax, this also supports a `sass()` query that takes a Sass
24+
expression that evaluates to `true` or `false` at preprocessing time depending
25+
on whether the Sass value is truthy. If there are no plain-CSS queries, the
26+
function will return the first value whose query returns true during
27+
preprocessing. For example, `if(sass(false): 1; sass(true): 2; else: 3)`
28+
returns `2`.
29+
30+
[CSS-style `if()` function]: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/if
31+
32+
* The old Sass `if()` syntax is now deprecated. Users are encouraged to migrate
33+
to the new CSS syntax. `if($condition, $if-true, $if-false)` can be changed to
34+
`if(sass($condition): $if-true; else: $if-false)`.
35+
36+
See [the Sass website](https://sass-lang.com/d/if-function) for details.
37+
38+
* Plain-CSS `if()` functions are now considered "special numbers", meaning that
39+
they can be used in place of arguments to CSS color functions.
40+
41+
* Plain-CSS `if()` functions and `attr()` functions are now considered "special
42+
variable strings" (like `var()`), meaning they can now be used in place of
43+
multiple arguments or syntax fragments in various CSS functions.
44+
45+
## 1.94.3
46+
47+
* Fix the span reported for standalone `%` expressions followed by whitespace.
48+
49+
## 1.94.2
50+
51+
### Command-Line Interface
52+
53+
* Using `--fatal-deprecation <version>` no longer emits warnings about
54+
deprecations that are obsolete.
55+
56+
### Dart API
57+
58+
* `Deprecation.forVersion` now excludes obsolete deprecations from the set it
59+
returns.
60+
61+
### JS API
62+
63+
* Excludes obsolete deprecations from `fatalDeprecations` when a `Version` is
64+
passed.
65+
66+
### Node.js Embedded Host
67+
68+
* Fix a bug where a variable could be used before it was initialized during
69+
async compilation.
70+
71+
## 1.94.1
72+
73+
* No user-visible changes.
74+
75+
## 1.94.0
76+
77+
* **Potentially breaking compatibility fix:** `@function` rules whose names
78+
begin with `--` are now parsed as unknown at-rules to support the plain CSS
79+
`@function` rule. Within this rule, the `result` property is parsed as raw
80+
CSS just like custom properties.
81+
82+
* **Potentially breaking compatibility fix:** `@mixin` rules whose names begin
83+
with `--` are now errors. These are not yet parsed as unknown at-rules because
84+
no browser currently supports CSS mixins.
85+
86+
## 1.93.3
87+
88+
* Fix a performance regression that was introduced in 1.92.0.
89+
90+
## 1.93.2
91+
92+
* No user-visible changes.
93+
94+
### JavaScript API
95+
96+
* Fix another error in the release process for `@sass/types`.
97+
98+
## 1.93.1
99+
100+
* No user-visible changes.
101+
102+
### JavaScript API
103+
104+
* Fix an error in the release process for `@sass/types`.
105+
106+
## 1.93.0
107+
108+
* Fix a crash when a style rule contains a nested `@import`, and the loaded file
109+
`@use`s a user-defined module as well as `@include`s a top-level mixin which
110+
emits top-level declarations.
111+
112+
### JavaScript API
113+
114+
* Release a `@sass/types` package which contains the type annotations used by
115+
both the `sass` and `sass-embedded` package without any additional code or
116+
dependencies.
117+
118+
## 1.92.1
119+
120+
* Fix a bug where variable definitions from one imported, forwarded module
121+
would not be passed as implicit configuration to a later imported, forwarded
122+
module.
123+
124+
## 1.92.0
125+
126+
* **Breaking change:** Emit declarations, childless at-rules, and comments in
127+
the order they appear in the source even when they're interleaved with nested
128+
rules. This obsoletes the `mixed-decls` deprecation.
129+
130+
* **Breaking change:** The function name `type()` is now fully reserved for the
131+
plain CSS function. This means that `@function` definitions with the name
132+
`type` will produce errors, while function calls will be parsed as special
133+
function strings.
134+
135+
* Configuring private variables using `@use ... with`, `@forward ... with`, and
136+
`meta.load-css(..., $with: ...)` is now deprecated. Private variables were
137+
always intended to be fully encapsulated within the module that defines them,
138+
and this helps enforce that encapsulation.
139+
140+
* Fix a bug where `@extend` rules loaded through a mixture of `@import` and
141+
`@use` rules could fail to apply correctly.
142+
143+
### Command-Line Interface
144+
145+
* In `--watch` mode, delete the source map when the associated source file is
146+
deleted.
147+
1148
## 1.91.0
2149

3150
* **Potentially breaking change:** `meta.inspect()` (as well as other systems

bin/sass.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,31 @@
22

33
import * as child_process from 'child_process';
44
import * as path from 'path';
5+
56
import {compilerCommand} from '../lib/src/compiler-path';
67

78
// TODO npm/cmd-shim#152 and yarnpkg/berry#6422 - If and when the package
89
// managers support it, we should make this a proper shell script rather than a
910
// JS wrapper.
1011

1112
try {
12-
child_process.execFileSync(
13-
compilerCommand[0],
14-
[...compilerCommand.slice(1), ...process.argv.slice(2)],
15-
{
16-
// Node blocks launching .bat and .cmd without a shell due to CVE-2024-27980
17-
shell: ['.bat', '.cmd'].includes(
18-
path.extname(compilerCommand[0]).toLowerCase(),
19-
),
20-
stdio: 'inherit',
21-
windowsHide: true,
22-
},
23-
);
13+
let command = compilerCommand[0];
14+
let args = [...compilerCommand.slice(1), ...process.argv.slice(2)];
15+
const options: child_process.ExecFileSyncOptions = {
16+
stdio: 'inherit',
17+
windowsHide: true,
18+
};
19+
20+
// Node forbids launching .bat and .cmd without a shell due to CVE-2024-27980,
21+
// and DEP0190 forbids passing an argument list *with* shell: true. To work
22+
// around this, we have to manually concatenate the arguments.
23+
if (['.bat', '.cmd'].includes(path.extname(command).toLowerCase())) {
24+
command = `${command} ${args.join(' ')}`;
25+
args = [];
26+
options.shell = true;
27+
}
28+
29+
child_process.execFileSync(command, args, options);
2430
} catch (error) {
2531
if (error.code) {
2632
throw error;

lib/index.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function defaultExportDeprecation() {
4747
printedDefaultExportDeprecation = true;
4848
console.error(
4949
"`import sass from 'sass'` is deprecated.\n" +
50-
"Please use `import * as sass from 'sass'` instead."
50+
"Please use `import * as sass from 'sass'` instead.",
5151
);
5252
}
5353

0 commit comments

Comments
 (0)