Skip to content

Commit 21c99cb

Browse files
authored
Merge pull request #324 from sass/merge
Merge main into feature.color-4
2 parents 3d9c234 + d2a3cbc commit 21c99cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+379
-208
lines changed

.eslintrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "./node_modules/gts/",
3+
"rules": {
4+
"@typescript-eslint/explicit-function-return-type": [
5+
"error",
6+
{"allowExpressions": true}
7+
],
8+
"func-style": ["error", "declaration"],
9+
"prefer-const": ["error", {"destructuring": "all"}],
10+
// It would be nice to sort import declaration order as well, but that's not
11+
// autofixable and it's not worth the effort of handling manually.
12+
"sort-imports": ["error", {"ignoreDeclarationSort": true}],
13+
}
14+
}

.eslintrc.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "weekly"
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "weekly"

.github/workflows/ci.yml

Lines changed: 8 additions & 8 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@v3
22-
- uses: actions/setup-node@v3
21+
- uses: actions/checkout@v4
22+
- uses: actions/setup-node@v4
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@v3
50-
- uses: actions/setup-node@v3
49+
- uses: actions/checkout@v4
50+
- uses: actions/setup-node@v4
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@v3
92+
- uses: actions/checkout@v4
9393
- uses: dart-lang/setup-dart@v1
9494
with: {sdk: stable}
95-
- uses: actions/setup-node@v3
95+
- uses: actions/setup-node@v4
9696
with: {node-version: "${{ matrix.node_version }}"}
9797

9898
- name: Check out Dart Sass
@@ -140,8 +140,8 @@ jobs:
140140
needs: [static_analysis, tests, sass_spec]
141141

142142
steps:
143-
- uses: actions/checkout@v3
144-
- uses: actions/setup-node@v3
143+
- uses: actions/checkout@v4
144+
- uses: actions/setup-node@v4
145145
with:
146146
node-version: 'lts/*'
147147
check-latest: true

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
## 1.77.8
2+
3+
* No user-visible changes.
4+
5+
## 1.77.7
6+
7+
* Declarations that appear after nested rules are deprecated, because the
8+
semantics Sass has historically used are different from the semantics
9+
specified by CSS. In the future, Sass will adopt the standard CSS semantics.
10+
11+
See [the Sass website](https://sass-lang.com/d/mixed-decls) for details.
12+
13+
* **Potentially breaking bug fix:** `//` in certain places such as unknown
14+
at-rule values was being preserved in the CSS output, leading to potentially
15+
invalid CSS. It's now properly parsed as a silent comment and omitted from the
16+
CSS output.
17+
18+
## 1.77.6
19+
20+
* Fix a few cases where comments and occasionally even whitespace wasn't allowed
21+
between the end of Sass statements and the following semicolon.
22+
23+
## 1.77.5
24+
25+
* Fully trim redundant selectors generated by `@extend`.
26+
27+
## 1.77.4
28+
29+
### Embedded Sass
30+
31+
* Support passing `Version` input for `fatalDeprecations` as string over
32+
embedded protocol.
33+
34+
* Fix a bug in the JS Embedded Host where `Version` could be incorrectly accepted
35+
as input for `silenceDeprecations` and `futureDeprecations` in pure JS.
36+
137
## 1.77.3
238

339
### Dart API

bin/sass.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env node
2+
3+
import * as child_process from 'child_process';
4+
import {compilerCommand} from '../lib/src/compiler-path';
5+
6+
// TODO npm/cmd-shim#152 and yarnpkg/berry#6422 - If and when the package
7+
// managers support it, we should make this a proper shell script rather than a
8+
// JS wrapper.
9+
10+
try {
11+
child_process.execFileSync(
12+
compilerCommand[0],
13+
[...compilerCommand.slice(1), ...process.argv.slice(2)],
14+
{
15+
stdio: 'inherit',
16+
windowsHide: true,
17+
}
18+
);
19+
} catch (error) {
20+
if (error.code) {
21+
throw error;
22+
} else {
23+
process.exitCode = error.status;
24+
}
25+
}

lib/src/compiler-path.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,29 @@
44

55
import * as fs from 'fs';
66
import * as p from 'path';
7+
import {getElfInterpreter} from './elf';
78
import {isErrnoException} from './utils';
89

910
/**
10-
* Detect if the current running node binary is linked with musl libc by
11-
* checking if the binary contains a string like "/.../ld-musl-$ARCH.so"
11+
* Detect if the given binary is linked with musl libc by checking if
12+
* the interpreter basename starts with "ld-musl-"
1213
*/
13-
const isLinuxMusl = function () {
14-
return fs.readFileSync(process.execPath).includes('/ld-musl-');
15-
};
14+
function isLinuxMusl(path: string): boolean {
15+
try {
16+
const interpreter = getElfInterpreter(path);
17+
return p.basename(interpreter).startsWith('ld-musl-');
18+
} catch (error) {
19+
console.warn(
20+
`Warning: Failed to detect linux-musl, fallback to linux-gnu: ${error.message}`
21+
);
22+
return false;
23+
}
24+
}
1625

1726
/** The full command for the embedded compiler executable. */
1827
export const compilerCommand = (() => {
1928
const platform =
20-
process.platform === 'linux' && isLinuxMusl()
29+
process.platform === 'linux' && isLinuxMusl(process.execPath)
2130
? 'linux-musl'
2231
: (process.platform as string);
2332

lib/src/compiler.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import * as compilerModule from './compiler/utils';
99
import {Compiler, initCompiler} from './compiler/sync';
1010

1111
const createDispatcher = jest.spyOn(compilerModule, 'createDispatcher');
12-
function getIdHistory() {
12+
function getIdHistory(): number[] {
1313
return createDispatcher.mock.calls.map(([id]) => id);
1414
}
1515

lib/src/compiler/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import * as p from 'path';
66
import * as supportsColor from 'supports-color';
7-
import {deprecations, getDeprecationIds, Deprecation} from '../deprecations';
7+
import {Deprecation, deprecations, getDeprecationIds} from '../deprecations';
88
import {deprotofySourceSpan} from '../deprotofy-span';
99
import {Dispatcher, DispatcherHandlers} from '../dispatcher';
1010
import {Exception} from '../exception';

lib/src/deprecations.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,12 @@
22
// MIT-style license that can be found in the LICENSE file or at
33
// https://opensource.org/licenses/MIT.
44

5-
import {deprecations} from './vendor/deprecations';
6-
import {Deprecation, DeprecationOrId} from './vendor/sass';
5+
import {DeprecationOrId} from './vendor/sass';
76
import {Version} from './version';
87

98
export {deprecations} from './vendor/deprecations';
109
export {Deprecation, DeprecationOrId, DeprecationStatus} from './vendor/sass';
1110

12-
/**
13-
* Returns whether the given deprecation was active in the given version.
14-
*/
15-
function isActiveIn(deprecation: Deprecation, version: Version) {
16-
const deprecatedIn = deprecation.deprecatedIn;
17-
if (deprecation.status !== 'active' || !deprecatedIn) return false;
18-
if (version.major > deprecatedIn.major) return true;
19-
if (version.major < deprecatedIn.major) return false;
20-
if (version.minor > deprecatedIn.minor) return true;
21-
if (version.minor < deprecatedIn.minor) return false;
22-
return version.patch >= deprecatedIn.patch;
23-
}
24-
2511
/**
2612
* Converts a mixed array of deprecations, IDs, and versions to an array of IDs
2713
* that's ready to include in a CompileRequest.
@@ -31,9 +17,7 @@ export function getDeprecationIds(
3117
): string[] {
3218
return arr.flatMap(item => {
3319
if (item instanceof Version) {
34-
return Object.values(deprecations)
35-
.filter(deprecation => isActiveIn(deprecation, item))
36-
.map(deprecation => deprecation.id);
20+
return arr.map(item => item.toString());
3721
} else if (typeof item === 'string') {
3822
return item;
3923
}

0 commit comments

Comments
 (0)