From 80f5a209f676fbf3df82752d4c3b4c935014c77c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=81=A4=E3=81=8D?= Date: Thu, 30 May 2024 16:25:20 -0700 Subject: [PATCH 01/16] Parse Deprecation.forVersion on compiler side (#299) --- lib/src/deprecations.ts | 20 ++------------------ lib/src/legacy/index.ts | 2 -- lib/src/version.ts | 3 +++ package.json | 2 +- 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/lib/src/deprecations.ts b/lib/src/deprecations.ts index e30527c4..26341d82 100644 --- a/lib/src/deprecations.ts +++ b/lib/src/deprecations.ts @@ -2,26 +2,12 @@ // MIT-style license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. -import {deprecations} from './vendor/deprecations'; -import {Deprecation, DeprecationOrId} from './vendor/sass'; +import {DeprecationOrId} from './vendor/sass'; import {Version} from './version'; export {deprecations} from './vendor/deprecations'; export {Deprecation, DeprecationOrId, DeprecationStatus} from './vendor/sass'; -/** - * Returns whether the given deprecation was active in the given version. - */ -function isActiveIn(deprecation: Deprecation, version: Version) { - const deprecatedIn = deprecation.deprecatedIn; - if (deprecation.status !== 'active' || !deprecatedIn) return false; - if (version.major > deprecatedIn.major) return true; - if (version.major < deprecatedIn.major) return false; - if (version.minor > deprecatedIn.minor) return true; - if (version.minor < deprecatedIn.minor) return false; - return version.patch >= deprecatedIn.patch; -} - /** * Converts a mixed array of deprecations, IDs, and versions to an array of IDs * that's ready to include in a CompileRequest. @@ -31,9 +17,7 @@ export function getDeprecationIds( ): string[] { return arr.flatMap(item => { if (item instanceof Version) { - return Object.values(deprecations) - .filter(deprecation => isActiveIn(deprecation, item)) - .map(deprecation => deprecation.id); + return arr.map(item => item.toString()); } else if (typeof item === 'string') { return item; } diff --git a/lib/src/legacy/index.ts b/lib/src/legacy/index.ts index d7543e35..d5001e7b 100644 --- a/lib/src/legacy/index.ts +++ b/lib/src/legacy/index.ts @@ -32,8 +32,6 @@ import { LegacyStringOptions, Options, StringOptions, - Importer, - FileImporter, } from '../vendor/sass'; import {wrapFunction} from './value/wrap'; import {endOfLoadProtocol, LegacyImporterWrapper} from './importer'; diff --git a/lib/src/version.ts b/lib/src/version.ts index 772b8258..79f61371 100644 --- a/lib/src/version.ts +++ b/lib/src/version.ts @@ -21,4 +21,7 @@ export class Version implements api.Version { parseInt(match[3]) ); } + toString(): string { + return `${this.major}.${this.minor}.${this.patch}`; + } } diff --git a/package.json b/package.json index b2f836a1..bc5eea39 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "sass-embedded", "version": "1.77.3", - "protocol-version": "2.7.0", + "protocol-version": "2.7.1", "compiler-version": "1.77.3", "description": "Node.js library that communicates with Embedded Dart Sass using the Embedded Sass protocol", "repository": "sass/embedded-host-node", From 7dd781ba716f055e711a7289b17d90bef2b34b95 Mon Sep 17 00:00:00 2001 From: Sass Bot Date: Thu, 30 May 2024 23:44:20 +0000 Subject: [PATCH 02/16] Update Dart Sass version and release --- CHANGELOG.md | 10 ++++++++ npm/android-arm/package.json | 2 +- npm/android-arm64/package.json | 2 +- npm/android-ia32/package.json | 2 +- npm/android-x64/package.json | 2 +- npm/darwin-arm64/package.json | 2 +- npm/darwin-x64/package.json | 2 +- npm/linux-arm/package.json | 2 +- npm/linux-arm64/package.json | 2 +- npm/linux-ia32/package.json | 2 +- npm/linux-musl-arm/package.json | 2 +- npm/linux-musl-arm64/package.json | 2 +- npm/linux-musl-ia32/package.json | 2 +- npm/linux-musl-x64/package.json | 2 +- npm/linux-x64/package.json | 2 +- npm/win32-arm64/package.json | 2 +- npm/win32-ia32/package.json | 2 +- npm/win32-x64/package.json | 2 +- package.json | 38 +++++++++++++++---------------- 19 files changed, 46 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d06b712f..41b6c086 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## 1.77.4 + +### Embedded Sass + +* Support passing `Version` input for `fatalDeprecations` as string over + embedded protocol. + +* Fix a bug in the JS Embedded Host where `Version` could be incorrectly accepted + as input for `silenceDeprecations` and `futureDeprecations` in pure JS. + ## 1.77.3 ### Dart API diff --git a/npm/android-arm/package.json b/npm/android-arm/package.json index 31001aef..830d2d51 100644 --- a/npm/android-arm/package.json +++ b/npm/android-arm/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-android-arm", - "version": "1.77.3", + "version": "1.77.4", "description": "The android-arm binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/android-arm64/package.json b/npm/android-arm64/package.json index 849f79d7..b607b7d2 100644 --- a/npm/android-arm64/package.json +++ b/npm/android-arm64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-android-arm64", - "version": "1.77.3", + "version": "1.77.4", "description": "The android-arm64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/android-ia32/package.json b/npm/android-ia32/package.json index beeeba0d..436a91f2 100644 --- a/npm/android-ia32/package.json +++ b/npm/android-ia32/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-android-ia32", - "version": "1.77.3", + "version": "1.77.4", "description": "The android-ia32 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/android-x64/package.json b/npm/android-x64/package.json index 825f950c..4a45edb2 100644 --- a/npm/android-x64/package.json +++ b/npm/android-x64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-android-x64", - "version": "1.77.3", + "version": "1.77.4", "description": "The android-x64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/darwin-arm64/package.json b/npm/darwin-arm64/package.json index fcfc9f1d..929543a2 100644 --- a/npm/darwin-arm64/package.json +++ b/npm/darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-darwin-arm64", - "version": "1.77.3", + "version": "1.77.4", "description": "The darwin-arm64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/darwin-x64/package.json b/npm/darwin-x64/package.json index a3b9b1e3..89ed1e98 100644 --- a/npm/darwin-x64/package.json +++ b/npm/darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-darwin-x64", - "version": "1.77.3", + "version": "1.77.4", "description": "The darwin-x64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-arm/package.json b/npm/linux-arm/package.json index 45f56274..2641b75d 100644 --- a/npm/linux-arm/package.json +++ b/npm/linux-arm/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-arm", - "version": "1.77.3", + "version": "1.77.4", "description": "The linux-arm binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-arm64/package.json b/npm/linux-arm64/package.json index 61d82dd5..43e871e4 100644 --- a/npm/linux-arm64/package.json +++ b/npm/linux-arm64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-arm64", - "version": "1.77.3", + "version": "1.77.4", "description": "The linux-arm64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-ia32/package.json b/npm/linux-ia32/package.json index 82a27457..899d27fc 100644 --- a/npm/linux-ia32/package.json +++ b/npm/linux-ia32/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-ia32", - "version": "1.77.3", + "version": "1.77.4", "description": "The linux-ia32 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-musl-arm/package.json b/npm/linux-musl-arm/package.json index 0ed6b12c..31f99cc4 100644 --- a/npm/linux-musl-arm/package.json +++ b/npm/linux-musl-arm/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-musl-arm", - "version": "1.77.3", + "version": "1.77.4", "description": "The linux-musl-arm binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-musl-arm64/package.json b/npm/linux-musl-arm64/package.json index c7192ad7..4ff0a022 100644 --- a/npm/linux-musl-arm64/package.json +++ b/npm/linux-musl-arm64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-musl-arm64", - "version": "1.77.3", + "version": "1.77.4", "description": "The linux-musl-arm64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-musl-ia32/package.json b/npm/linux-musl-ia32/package.json index a6726169..adc73e80 100644 --- a/npm/linux-musl-ia32/package.json +++ b/npm/linux-musl-ia32/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-musl-ia32", - "version": "1.77.3", + "version": "1.77.4", "description": "The linux-musl-ia32 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-musl-x64/package.json b/npm/linux-musl-x64/package.json index 0d8d06d8..3f7e4187 100644 --- a/npm/linux-musl-x64/package.json +++ b/npm/linux-musl-x64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-musl-x64", - "version": "1.77.3", + "version": "1.77.4", "description": "The linux-musl-x64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-x64/package.json b/npm/linux-x64/package.json index 5db3156b..247b074d 100644 --- a/npm/linux-x64/package.json +++ b/npm/linux-x64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-x64", - "version": "1.77.3", + "version": "1.77.4", "description": "The linux-x64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/win32-arm64/package.json b/npm/win32-arm64/package.json index 9f6ee597..246b9839 100644 --- a/npm/win32-arm64/package.json +++ b/npm/win32-arm64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-win32-arm64", - "version": "1.77.3", + "version": "1.77.4", "description": "The win32-arm64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/win32-ia32/package.json b/npm/win32-ia32/package.json index 40fa2ee2..61c75a8e 100644 --- a/npm/win32-ia32/package.json +++ b/npm/win32-ia32/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-win32-ia32", - "version": "1.77.3", + "version": "1.77.4", "description": "The win32-ia32 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/win32-x64/package.json b/npm/win32-x64/package.json index 21561855..fd46613a 100644 --- a/npm/win32-x64/package.json +++ b/npm/win32-x64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-win32-x64", - "version": "1.77.3", + "version": "1.77.4", "description": "The win32-x64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/package.json b/package.json index bc5eea39..8923e6b2 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "sass-embedded", - "version": "1.77.3", + "version": "1.77.4", "protocol-version": "2.7.1", - "compiler-version": "1.77.3", + "compiler-version": "1.77.4", "description": "Node.js library that communicates with Embedded Dart Sass using the Embedded Sass protocol", "repository": "sass/embedded-host-node", "author": "Google Inc.", @@ -35,23 +35,23 @@ "test": "jest" }, "optionalDependencies": { - "sass-embedded-android-arm": "1.77.3", - "sass-embedded-android-arm64": "1.77.3", - "sass-embedded-android-ia32": "1.77.3", - "sass-embedded-android-x64": "1.77.3", - "sass-embedded-darwin-arm64": "1.77.3", - "sass-embedded-darwin-x64": "1.77.3", - "sass-embedded-linux-arm": "1.77.3", - "sass-embedded-linux-arm64": "1.77.3", - "sass-embedded-linux-ia32": "1.77.3", - "sass-embedded-linux-x64": "1.77.3", - "sass-embedded-linux-musl-arm": "1.77.3", - "sass-embedded-linux-musl-arm64": "1.77.3", - "sass-embedded-linux-musl-ia32": "1.77.3", - "sass-embedded-linux-musl-x64": "1.77.3", - "sass-embedded-win32-arm64": "1.77.3", - "sass-embedded-win32-ia32": "1.77.3", - "sass-embedded-win32-x64": "1.77.3" + "sass-embedded-android-arm": "1.77.4", + "sass-embedded-android-arm64": "1.77.4", + "sass-embedded-android-ia32": "1.77.4", + "sass-embedded-android-x64": "1.77.4", + "sass-embedded-darwin-arm64": "1.77.4", + "sass-embedded-darwin-x64": "1.77.4", + "sass-embedded-linux-arm": "1.77.4", + "sass-embedded-linux-arm64": "1.77.4", + "sass-embedded-linux-ia32": "1.77.4", + "sass-embedded-linux-x64": "1.77.4", + "sass-embedded-linux-musl-arm": "1.77.4", + "sass-embedded-linux-musl-arm64": "1.77.4", + "sass-embedded-linux-musl-ia32": "1.77.4", + "sass-embedded-linux-musl-x64": "1.77.4", + "sass-embedded-win32-arm64": "1.77.4", + "sass-embedded-win32-ia32": "1.77.4", + "sass-embedded-win32-x64": "1.77.4" }, "dependencies": { "@bufbuild/protobuf": "^1.0.0", From 20914eb7dc626b6b38f634546ac72eccd357e31e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=81=A4=E3=81=8D?= Date: Thu, 30 May 2024 17:27:11 -0700 Subject: [PATCH 03/16] Fix release CI (#303) --- tool/prepare-release.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tool/prepare-release.ts b/tool/prepare-release.ts index d5d3ba0d..efdc95a5 100644 --- a/tool/prepare-release.ts +++ b/tool/prepare-release.ts @@ -6,6 +6,7 @@ import {promises as fs} from 'fs'; import * as shell from 'shelljs'; import * as pkg from '../package.json'; +import {getDeprecations} from './get-deprecations'; import {getLanguageRepo} from './get-language-repo'; void (async () => { @@ -14,6 +15,8 @@ void (async () => { await getLanguageRepo('lib/src/vendor'); + await getDeprecations('lib/src/vendor'); + console.log('Transpiling TS into dist.'); shell.exec('tsc -p tsconfig.build.json'); shell.cp('lib/index.mjs', 'dist/lib/index.mjs'); From 274b1ce9e3594d1ad116a0acf759dc5183cae402 Mon Sep 17 00:00:00 2001 From: Sass Bot Date: Tue, 11 Jun 2024 23:58:03 +0000 Subject: [PATCH 04/16] Update Dart Sass version and release --- CHANGELOG.md | 4 ++++ npm/android-arm/package.json | 2 +- npm/android-arm64/package.json | 2 +- npm/android-ia32/package.json | 2 +- npm/android-x64/package.json | 2 +- npm/darwin-arm64/package.json | 2 +- npm/darwin-x64/package.json | 2 +- npm/linux-arm/package.json | 2 +- npm/linux-arm64/package.json | 2 +- npm/linux-ia32/package.json | 2 +- npm/linux-musl-arm/package.json | 2 +- npm/linux-musl-arm64/package.json | 2 +- npm/linux-musl-ia32/package.json | 2 +- npm/linux-musl-x64/package.json | 2 +- npm/linux-x64/package.json | 2 +- npm/win32-arm64/package.json | 2 +- npm/win32-ia32/package.json | 2 +- npm/win32-x64/package.json | 2 +- package.json | 38 +++++++++++++++---------------- 19 files changed, 40 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41b6c086..5f299e04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.77.5 + +* Fully trim redundant selectors generated by `@extend`. + ## 1.77.4 ### Embedded Sass diff --git a/npm/android-arm/package.json b/npm/android-arm/package.json index 830d2d51..1a987b5d 100644 --- a/npm/android-arm/package.json +++ b/npm/android-arm/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-android-arm", - "version": "1.77.4", + "version": "1.77.5", "description": "The android-arm binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/android-arm64/package.json b/npm/android-arm64/package.json index b607b7d2..33191003 100644 --- a/npm/android-arm64/package.json +++ b/npm/android-arm64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-android-arm64", - "version": "1.77.4", + "version": "1.77.5", "description": "The android-arm64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/android-ia32/package.json b/npm/android-ia32/package.json index 436a91f2..4fb6ebec 100644 --- a/npm/android-ia32/package.json +++ b/npm/android-ia32/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-android-ia32", - "version": "1.77.4", + "version": "1.77.5", "description": "The android-ia32 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/android-x64/package.json b/npm/android-x64/package.json index 4a45edb2..726c9a61 100644 --- a/npm/android-x64/package.json +++ b/npm/android-x64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-android-x64", - "version": "1.77.4", + "version": "1.77.5", "description": "The android-x64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/darwin-arm64/package.json b/npm/darwin-arm64/package.json index 929543a2..787fac08 100644 --- a/npm/darwin-arm64/package.json +++ b/npm/darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-darwin-arm64", - "version": "1.77.4", + "version": "1.77.5", "description": "The darwin-arm64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/darwin-x64/package.json b/npm/darwin-x64/package.json index 89ed1e98..06f63746 100644 --- a/npm/darwin-x64/package.json +++ b/npm/darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-darwin-x64", - "version": "1.77.4", + "version": "1.77.5", "description": "The darwin-x64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-arm/package.json b/npm/linux-arm/package.json index 2641b75d..c6c03c65 100644 --- a/npm/linux-arm/package.json +++ b/npm/linux-arm/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-arm", - "version": "1.77.4", + "version": "1.77.5", "description": "The linux-arm binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-arm64/package.json b/npm/linux-arm64/package.json index 43e871e4..8d38c9c3 100644 --- a/npm/linux-arm64/package.json +++ b/npm/linux-arm64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-arm64", - "version": "1.77.4", + "version": "1.77.5", "description": "The linux-arm64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-ia32/package.json b/npm/linux-ia32/package.json index 899d27fc..4541cab5 100644 --- a/npm/linux-ia32/package.json +++ b/npm/linux-ia32/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-ia32", - "version": "1.77.4", + "version": "1.77.5", "description": "The linux-ia32 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-musl-arm/package.json b/npm/linux-musl-arm/package.json index 31f99cc4..76047bd7 100644 --- a/npm/linux-musl-arm/package.json +++ b/npm/linux-musl-arm/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-musl-arm", - "version": "1.77.4", + "version": "1.77.5", "description": "The linux-musl-arm binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-musl-arm64/package.json b/npm/linux-musl-arm64/package.json index 4ff0a022..6ad8daf2 100644 --- a/npm/linux-musl-arm64/package.json +++ b/npm/linux-musl-arm64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-musl-arm64", - "version": "1.77.4", + "version": "1.77.5", "description": "The linux-musl-arm64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-musl-ia32/package.json b/npm/linux-musl-ia32/package.json index adc73e80..588ef01b 100644 --- a/npm/linux-musl-ia32/package.json +++ b/npm/linux-musl-ia32/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-musl-ia32", - "version": "1.77.4", + "version": "1.77.5", "description": "The linux-musl-ia32 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-musl-x64/package.json b/npm/linux-musl-x64/package.json index 3f7e4187..8396955c 100644 --- a/npm/linux-musl-x64/package.json +++ b/npm/linux-musl-x64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-musl-x64", - "version": "1.77.4", + "version": "1.77.5", "description": "The linux-musl-x64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-x64/package.json b/npm/linux-x64/package.json index 247b074d..5561eae1 100644 --- a/npm/linux-x64/package.json +++ b/npm/linux-x64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-x64", - "version": "1.77.4", + "version": "1.77.5", "description": "The linux-x64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/win32-arm64/package.json b/npm/win32-arm64/package.json index 246b9839..4f6b0235 100644 --- a/npm/win32-arm64/package.json +++ b/npm/win32-arm64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-win32-arm64", - "version": "1.77.4", + "version": "1.77.5", "description": "The win32-arm64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/win32-ia32/package.json b/npm/win32-ia32/package.json index 61c75a8e..0deec083 100644 --- a/npm/win32-ia32/package.json +++ b/npm/win32-ia32/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-win32-ia32", - "version": "1.77.4", + "version": "1.77.5", "description": "The win32-ia32 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/win32-x64/package.json b/npm/win32-x64/package.json index fd46613a..fd35767e 100644 --- a/npm/win32-x64/package.json +++ b/npm/win32-x64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-win32-x64", - "version": "1.77.4", + "version": "1.77.5", "description": "The win32-x64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/package.json b/package.json index 8923e6b2..5ed6ca59 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "sass-embedded", - "version": "1.77.4", + "version": "1.77.5", "protocol-version": "2.7.1", - "compiler-version": "1.77.4", + "compiler-version": "1.77.5", "description": "Node.js library that communicates with Embedded Dart Sass using the Embedded Sass protocol", "repository": "sass/embedded-host-node", "author": "Google Inc.", @@ -35,23 +35,23 @@ "test": "jest" }, "optionalDependencies": { - "sass-embedded-android-arm": "1.77.4", - "sass-embedded-android-arm64": "1.77.4", - "sass-embedded-android-ia32": "1.77.4", - "sass-embedded-android-x64": "1.77.4", - "sass-embedded-darwin-arm64": "1.77.4", - "sass-embedded-darwin-x64": "1.77.4", - "sass-embedded-linux-arm": "1.77.4", - "sass-embedded-linux-arm64": "1.77.4", - "sass-embedded-linux-ia32": "1.77.4", - "sass-embedded-linux-x64": "1.77.4", - "sass-embedded-linux-musl-arm": "1.77.4", - "sass-embedded-linux-musl-arm64": "1.77.4", - "sass-embedded-linux-musl-ia32": "1.77.4", - "sass-embedded-linux-musl-x64": "1.77.4", - "sass-embedded-win32-arm64": "1.77.4", - "sass-embedded-win32-ia32": "1.77.4", - "sass-embedded-win32-x64": "1.77.4" + "sass-embedded-android-arm": "1.77.5", + "sass-embedded-android-arm64": "1.77.5", + "sass-embedded-android-ia32": "1.77.5", + "sass-embedded-android-x64": "1.77.5", + "sass-embedded-darwin-arm64": "1.77.5", + "sass-embedded-darwin-x64": "1.77.5", + "sass-embedded-linux-arm": "1.77.5", + "sass-embedded-linux-arm64": "1.77.5", + "sass-embedded-linux-ia32": "1.77.5", + "sass-embedded-linux-x64": "1.77.5", + "sass-embedded-linux-musl-arm": "1.77.5", + "sass-embedded-linux-musl-arm64": "1.77.5", + "sass-embedded-linux-musl-ia32": "1.77.5", + "sass-embedded-linux-musl-x64": "1.77.5", + "sass-embedded-win32-arm64": "1.77.5", + "sass-embedded-win32-ia32": "1.77.5", + "sass-embedded-win32-x64": "1.77.5" }, "dependencies": { "@bufbuild/protobuf": "^1.0.0", From 65014ac8fbe097f1c8135240f0c3d79f1a890a5f Mon Sep 17 00:00:00 2001 From: Sass Bot Date: Thu, 11 Jul 2024 20:05:38 +0000 Subject: [PATCH 05/16] Update Dart Sass version and release --- CHANGELOG.md | 22 ++++++++++++++++++ npm/android-arm/package.json | 2 +- npm/android-arm64/package.json | 2 +- npm/android-ia32/package.json | 2 +- npm/android-x64/package.json | 2 +- npm/darwin-arm64/package.json | 2 +- npm/darwin-x64/package.json | 2 +- npm/linux-arm/package.json | 2 +- npm/linux-arm64/package.json | 2 +- npm/linux-ia32/package.json | 2 +- npm/linux-musl-arm/package.json | 2 +- npm/linux-musl-arm64/package.json | 2 +- npm/linux-musl-ia32/package.json | 2 +- npm/linux-musl-x64/package.json | 2 +- npm/linux-x64/package.json | 2 +- npm/win32-arm64/package.json | 2 +- npm/win32-ia32/package.json | 2 +- npm/win32-x64/package.json | 2 +- package.json | 38 +++++++++++++++---------------- 19 files changed, 58 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f299e04..8533ae1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,25 @@ +## 1.77.8 + +* No user-visible changes. + +## 1.77.7 + +* Declarations that appear after nested rules are deprecated, because the + semantics Sass has historically used are different from the semantics + specified by CSS. In the future, Sass will adopt the standard CSS semantics. + + See [the Sass website](https://sass-lang.com/d/mixed-decls) for details. + +* **Potentially breaking bug fix:** `//` in certain places such as unknown + at-rule values was being preserved in the CSS output, leading to potentially + invalid CSS. It's now properly parsed as a silent comment and omitted from the + CSS output. + +## 1.77.6 + +* Fix a few cases where comments and occasionally even whitespace wasn't allowed + between the end of Sass statements and the following semicolon. + ## 1.77.5 * Fully trim redundant selectors generated by `@extend`. diff --git a/npm/android-arm/package.json b/npm/android-arm/package.json index 1a987b5d..351445fd 100644 --- a/npm/android-arm/package.json +++ b/npm/android-arm/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-android-arm", - "version": "1.77.5", + "version": "1.77.8", "description": "The android-arm binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/android-arm64/package.json b/npm/android-arm64/package.json index 33191003..8a4a9f90 100644 --- a/npm/android-arm64/package.json +++ b/npm/android-arm64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-android-arm64", - "version": "1.77.5", + "version": "1.77.8", "description": "The android-arm64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/android-ia32/package.json b/npm/android-ia32/package.json index 4fb6ebec..28d2cb6c 100644 --- a/npm/android-ia32/package.json +++ b/npm/android-ia32/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-android-ia32", - "version": "1.77.5", + "version": "1.77.8", "description": "The android-ia32 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/android-x64/package.json b/npm/android-x64/package.json index 726c9a61..45fd9d3d 100644 --- a/npm/android-x64/package.json +++ b/npm/android-x64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-android-x64", - "version": "1.77.5", + "version": "1.77.8", "description": "The android-x64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/darwin-arm64/package.json b/npm/darwin-arm64/package.json index 787fac08..fe1f3356 100644 --- a/npm/darwin-arm64/package.json +++ b/npm/darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-darwin-arm64", - "version": "1.77.5", + "version": "1.77.8", "description": "The darwin-arm64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/darwin-x64/package.json b/npm/darwin-x64/package.json index 06f63746..f307056c 100644 --- a/npm/darwin-x64/package.json +++ b/npm/darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-darwin-x64", - "version": "1.77.5", + "version": "1.77.8", "description": "The darwin-x64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-arm/package.json b/npm/linux-arm/package.json index c6c03c65..fd0207b2 100644 --- a/npm/linux-arm/package.json +++ b/npm/linux-arm/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-arm", - "version": "1.77.5", + "version": "1.77.8", "description": "The linux-arm binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-arm64/package.json b/npm/linux-arm64/package.json index 8d38c9c3..92c42112 100644 --- a/npm/linux-arm64/package.json +++ b/npm/linux-arm64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-arm64", - "version": "1.77.5", + "version": "1.77.8", "description": "The linux-arm64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-ia32/package.json b/npm/linux-ia32/package.json index 4541cab5..751c3bbc 100644 --- a/npm/linux-ia32/package.json +++ b/npm/linux-ia32/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-ia32", - "version": "1.77.5", + "version": "1.77.8", "description": "The linux-ia32 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-musl-arm/package.json b/npm/linux-musl-arm/package.json index 76047bd7..24ace4f8 100644 --- a/npm/linux-musl-arm/package.json +++ b/npm/linux-musl-arm/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-musl-arm", - "version": "1.77.5", + "version": "1.77.8", "description": "The linux-musl-arm binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-musl-arm64/package.json b/npm/linux-musl-arm64/package.json index 6ad8daf2..a1ffe55e 100644 --- a/npm/linux-musl-arm64/package.json +++ b/npm/linux-musl-arm64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-musl-arm64", - "version": "1.77.5", + "version": "1.77.8", "description": "The linux-musl-arm64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-musl-ia32/package.json b/npm/linux-musl-ia32/package.json index 588ef01b..60746951 100644 --- a/npm/linux-musl-ia32/package.json +++ b/npm/linux-musl-ia32/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-musl-ia32", - "version": "1.77.5", + "version": "1.77.8", "description": "The linux-musl-ia32 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-musl-x64/package.json b/npm/linux-musl-x64/package.json index 8396955c..ac4afa94 100644 --- a/npm/linux-musl-x64/package.json +++ b/npm/linux-musl-x64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-musl-x64", - "version": "1.77.5", + "version": "1.77.8", "description": "The linux-musl-x64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/linux-x64/package.json b/npm/linux-x64/package.json index 5561eae1..55c52fd6 100644 --- a/npm/linux-x64/package.json +++ b/npm/linux-x64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-linux-x64", - "version": "1.77.5", + "version": "1.77.8", "description": "The linux-x64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/win32-arm64/package.json b/npm/win32-arm64/package.json index 4f6b0235..8569102f 100644 --- a/npm/win32-arm64/package.json +++ b/npm/win32-arm64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-win32-arm64", - "version": "1.77.5", + "version": "1.77.8", "description": "The win32-arm64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/win32-ia32/package.json b/npm/win32-ia32/package.json index 0deec083..94b99812 100644 --- a/npm/win32-ia32/package.json +++ b/npm/win32-ia32/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-win32-ia32", - "version": "1.77.5", + "version": "1.77.8", "description": "The win32-ia32 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/npm/win32-x64/package.json b/npm/win32-x64/package.json index fd35767e..6754cb82 100644 --- a/npm/win32-x64/package.json +++ b/npm/win32-x64/package.json @@ -1,6 +1,6 @@ { "name": "sass-embedded-win32-x64", - "version": "1.77.5", + "version": "1.77.8", "description": "The win32-x64 binary for sass-embedded", "repository": "sass/embedded-host-node", "author": "Google Inc.", diff --git a/package.json b/package.json index 5ed6ca59..02c92231 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "sass-embedded", - "version": "1.77.5", + "version": "1.77.8", "protocol-version": "2.7.1", - "compiler-version": "1.77.5", + "compiler-version": "1.77.8", "description": "Node.js library that communicates with Embedded Dart Sass using the Embedded Sass protocol", "repository": "sass/embedded-host-node", "author": "Google Inc.", @@ -35,23 +35,23 @@ "test": "jest" }, "optionalDependencies": { - "sass-embedded-android-arm": "1.77.5", - "sass-embedded-android-arm64": "1.77.5", - "sass-embedded-android-ia32": "1.77.5", - "sass-embedded-android-x64": "1.77.5", - "sass-embedded-darwin-arm64": "1.77.5", - "sass-embedded-darwin-x64": "1.77.5", - "sass-embedded-linux-arm": "1.77.5", - "sass-embedded-linux-arm64": "1.77.5", - "sass-embedded-linux-ia32": "1.77.5", - "sass-embedded-linux-x64": "1.77.5", - "sass-embedded-linux-musl-arm": "1.77.5", - "sass-embedded-linux-musl-arm64": "1.77.5", - "sass-embedded-linux-musl-ia32": "1.77.5", - "sass-embedded-linux-musl-x64": "1.77.5", - "sass-embedded-win32-arm64": "1.77.5", - "sass-embedded-win32-ia32": "1.77.5", - "sass-embedded-win32-x64": "1.77.5" + "sass-embedded-android-arm": "1.77.8", + "sass-embedded-android-arm64": "1.77.8", + "sass-embedded-android-ia32": "1.77.8", + "sass-embedded-android-x64": "1.77.8", + "sass-embedded-darwin-arm64": "1.77.8", + "sass-embedded-darwin-x64": "1.77.8", + "sass-embedded-linux-arm": "1.77.8", + "sass-embedded-linux-arm64": "1.77.8", + "sass-embedded-linux-ia32": "1.77.8", + "sass-embedded-linux-x64": "1.77.8", + "sass-embedded-linux-musl-arm": "1.77.8", + "sass-embedded-linux-musl-arm64": "1.77.8", + "sass-embedded-linux-musl-ia32": "1.77.8", + "sass-embedded-linux-musl-x64": "1.77.8", + "sass-embedded-win32-arm64": "1.77.8", + "sass-embedded-win32-ia32": "1.77.8", + "sass-embedded-win32-x64": "1.77.8" }, "dependencies": { "@bufbuild/protobuf": "^1.0.0", From 6121ef49f26c144076c2f2e799f360d9257294c7 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Wed, 24 Jul 2024 14:56:18 -0700 Subject: [PATCH 06/16] Enable import sorting (#308) --- .eslintrc | 9 +++++++++ .eslintrc.json | 6 ------ lib/src/compiler/utils.ts | 2 +- lib/src/dispatcher.ts | 2 +- lib/src/importer-registry.ts | 2 +- lib/src/legacy/importer.ts | 6 +++--- lib/src/legacy/index.ts | 6 +++--- lib/src/message-transformer.test.ts | 2 +- lib/src/packet-transformer.test.ts | 2 +- lib/src/protofier.ts | 8 ++++---- lib/src/sync-process/sync-message-port.ts | 2 +- lib/src/sync-process/worker.ts | 6 +++--- lib/src/value/argument-list.ts | 2 +- lib/src/value/calculations.ts | 2 +- lib/src/value/list.ts | 2 +- lib/src/value/number.ts | 2 +- tool/utils.ts | 2 +- 17 files changed, 33 insertions(+), 30 deletions(-) create mode 100644 .eslintrc delete mode 100644 .eslintrc.json diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..f135f8dd --- /dev/null +++ b/.eslintrc @@ -0,0 +1,9 @@ +{ + "extends": "./node_modules/gts/", + "rules": { + "prefer-const": ["error", {"destructuring": "all"}], + // It would be nice to sort import declaration order as well, but that's not + // autofixable and it's not worth the effort of handling manually. + "sort-imports": ["error", {"ignoreDeclarationSort": true}], + } +} diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index d4323578..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./node_modules/gts/", - "rules": { - "prefer-const": ["error", {"destructuring": "all"}] - } -} diff --git a/lib/src/compiler/utils.ts b/lib/src/compiler/utils.ts index 09fa031d..80e1e0fc 100644 --- a/lib/src/compiler/utils.ts +++ b/lib/src/compiler/utils.ts @@ -4,7 +4,7 @@ import * as p from 'path'; import * as supportsColor from 'supports-color'; -import {deprecations, getDeprecationIds, Deprecation} from '../deprecations'; +import {Deprecation, deprecations, getDeprecationIds} from '../deprecations'; import {deprotofySourceSpan} from '../deprotofy-span'; import {Dispatcher, DispatcherHandlers} from '../dispatcher'; import {Exception} from '../exception'; diff --git a/lib/src/dispatcher.ts b/lib/src/dispatcher.ts index a99dee96..48cafefb 100644 --- a/lib/src/dispatcher.ts +++ b/lib/src/dispatcher.ts @@ -8,7 +8,7 @@ import {filter, map, mergeMap, takeUntil} from 'rxjs/operators'; import {OutboundResponse} from './messages'; import * as proto from './vendor/embedded_sass_pb'; import {RequestTracker} from './request-tracker'; -import {PromiseOr, compilerError, thenOr, hostError} from './utils'; +import {PromiseOr, compilerError, hostError, thenOr} from './utils'; // A callback that accepts a response or error. type ResponseCallback = ( diff --git a/lib/src/importer-registry.ts b/lib/src/importer-registry.ts index 749a912b..691b4af2 100644 --- a/lib/src/importer-registry.ts +++ b/lib/src/importer-registry.ts @@ -11,7 +11,7 @@ import {CanonicalizeContext} from './canonicalize-context'; import * as utils from './utils'; import {FileImporter, Importer, Options} from './vendor/sass'; import * as proto from './vendor/embedded_sass_pb'; -import {catchOr, thenOr, PromiseOr} from './utils'; +import {PromiseOr, catchOr, thenOr} from './utils'; const entryPointDirectoryKey = Symbol(); diff --git a/lib/src/legacy/importer.ts b/lib/src/legacy/importer.ts index 5977a3d5..68b79e11 100644 --- a/lib/src/legacy/importer.ts +++ b/lib/src/legacy/importer.ts @@ -9,11 +9,11 @@ import * as util from 'util'; import {resolvePath} from './resolve-path'; import { + PromiseOr, + SyncBoolean, fileUrlToPathCrossPlatform, isErrnoException, thenOr, - PromiseOr, - SyncBoolean, } from '../utils'; import { Importer, @@ -26,10 +26,10 @@ import { LegacySyncImporter, } from '../vendor/sass'; import { - pathToLegacyFileUrl, legacyFileUrlToPath, legacyImporterProtocol, legacyImporterProtocolPrefix, + pathToLegacyFileUrl, } from './utils'; /** diff --git a/lib/src/legacy/index.ts b/lib/src/legacy/index.ts index d5001e7b..f5467565 100644 --- a/lib/src/legacy/index.ts +++ b/lib/src/legacy/index.ts @@ -4,7 +4,7 @@ import * as fs from 'fs'; import * as p from 'path'; -import {pathToFileURL, URL} from 'url'; +import {URL, pathToFileURL} from 'url'; import {NodePackageImporter} from '../importer-registry'; import {Exception} from '../exception'; @@ -15,11 +15,11 @@ import { compileStringAsync, } from '../compile'; import { + SyncBoolean, fileUrlToPathCrossPlatform, isNullOrUndefined, pathToUrlString, withoutExtension, - SyncBoolean, } from '../utils'; import { CompileResult, @@ -34,7 +34,7 @@ import { StringOptions, } from '../vendor/sass'; import {wrapFunction} from './value/wrap'; -import {endOfLoadProtocol, LegacyImporterWrapper} from './importer'; +import {LegacyImporterWrapper, endOfLoadProtocol} from './importer'; import { legacyImporterProtocol, pathToLegacyFileUrl, diff --git a/lib/src/message-transformer.test.ts b/lib/src/message-transformer.test.ts index d74f2e28..767999c9 100644 --- a/lib/src/message-transformer.test.ts +++ b/lib/src/message-transformer.test.ts @@ -2,7 +2,7 @@ // MIT-style license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. -import {Subject, Observable} from 'rxjs'; +import {Observable, Subject} from 'rxjs'; import * as varint from 'varint'; import {expectObservableToError} from '../../test/utils'; diff --git a/lib/src/packet-transformer.test.ts b/lib/src/packet-transformer.test.ts index 4533f002..603801f0 100644 --- a/lib/src/packet-transformer.test.ts +++ b/lib/src/packet-transformer.test.ts @@ -2,7 +2,7 @@ // MIT-style license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. -import {Subject, Observable} from 'rxjs'; +import {Observable, Subject} from 'rxjs'; import {PacketTransformer} from './packet-transformer'; diff --git a/lib/src/protofier.ts b/lib/src/protofier.ts index e2d7f951..00fa3c52 100644 --- a/lib/src/protofier.ts +++ b/lib/src/protofier.ts @@ -10,19 +10,19 @@ import {FunctionRegistry} from './function-registry'; import {SassArgumentList} from './value/argument-list'; import {SassColor} from './value/color'; import {SassFunction} from './value/function'; -import {SassList, ListSeparator} from './value/list'; +import {ListSeparator, SassList} from './value/list'; import {SassMap} from './value/map'; import {SassNumber} from './value/number'; import {SassString} from './value/string'; import {Value} from './value'; import {sassNull} from './value/null'; -import {sassTrue, sassFalse} from './value/boolean'; +import {sassFalse, sassTrue} from './value/boolean'; import { - CalculationValue, - SassCalculation, CalculationInterpolation, CalculationOperation, CalculationOperator, + CalculationValue, + SassCalculation, } from './value/calculations'; import {SassMixin} from './value/mixin'; diff --git a/lib/src/sync-process/sync-message-port.ts b/lib/src/sync-process/sync-message-port.ts index 6c4a8751..7c82a343 100644 --- a/lib/src/sync-process/sync-message-port.ts +++ b/lib/src/sync-process/sync-message-port.ts @@ -5,10 +5,10 @@ import {strict as assert} from 'assert'; import {EventEmitter} from 'events'; import { - receiveMessageOnPort, MessageChannel, MessagePort, TransferListItem, + receiveMessageOnPort, } from 'worker_threads'; // TODO(nex3): Make this its own package. diff --git a/lib/src/sync-process/worker.ts b/lib/src/sync-process/worker.ts index 2b6e4c13..89542961 100644 --- a/lib/src/sync-process/worker.ts +++ b/lib/src/sync-process/worker.ts @@ -3,12 +3,12 @@ // https://opensource.org/licenses/MIT. import { - parentPort, - workerData, MessagePort, TransferListItem, + parentPort, + workerData, } from 'worker_threads'; -import {spawn, SpawnOptionsWithoutStdio} from 'child_process'; +import {SpawnOptionsWithoutStdio, spawn} from 'child_process'; import {strict as assert} from 'assert'; import {SyncMessagePort} from './sync-message-port'; diff --git a/lib/src/value/argument-list.ts b/lib/src/value/argument-list.ts index b898796a..029e2658 100644 --- a/lib/src/value/argument-list.ts +++ b/lib/src/value/argument-list.ts @@ -2,7 +2,7 @@ // MIT-style license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. -import {isOrderedMap, List, OrderedMap} from 'immutable'; +import {List, OrderedMap, isOrderedMap} from 'immutable'; import {ListSeparator, SassList} from './list'; import {Value} from './index'; diff --git a/lib/src/value/calculations.ts b/lib/src/value/calculations.ts index ce32f610..ca3eebe4 100644 --- a/lib/src/value/calculations.ts +++ b/lib/src/value/calculations.ts @@ -2,7 +2,7 @@ // MIT-style license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. -import {hash, List, ValueObject} from 'immutable'; +import {List, ValueObject, hash} from 'immutable'; import {Value} from './index'; import {SassNumber} from './number'; diff --git a/lib/src/value/list.ts b/lib/src/value/list.ts index 97ec57d8..d8175bb0 100644 --- a/lib/src/value/list.ts +++ b/lib/src/value/list.ts @@ -2,7 +2,7 @@ // MIT-style license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. -import {hash, isList, List} from 'immutable'; +import {List, hash, isList} from 'immutable'; import {Value} from './index'; import {SassMap} from './map'; diff --git a/lib/src/value/number.ts b/lib/src/value/number.ts index 9bf26cc8..11d69e56 100644 --- a/lib/src/value/number.ts +++ b/lib/src/value/number.ts @@ -2,7 +2,7 @@ // MIT-style license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. -import {hash, List} from 'immutable'; +import {List, hash} from 'immutable'; import {asImmutableList, valueError} from '../utils'; import {Value} from './index'; diff --git a/tool/utils.ts b/tool/utils.ts index fe1ee82a..21f10779 100644 --- a/tool/utils.ts +++ b/tool/utils.ts @@ -2,7 +2,7 @@ // MIT-style license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. -import {promises as fs, existsSync, lstatSync} from 'fs'; +import {existsSync, promises as fs, lstatSync} from 'fs'; import * as p from 'path'; import * as shell from 'shelljs'; From be8d077fe0e6d6c38d908a3d64181a8d75702d8c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 14:08:52 -0700 Subject: [PATCH 07/16] Bump @types/node from 20.14.13 to 22.0.0 (#310) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.14.13 to 22.0.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 02c92231..e9125b74 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "@types/buffer-builder": "^0.2.0", "@types/google-protobuf": "^3.7.2", "@types/jest": "^29.4.0", - "@types/node": "^20.1.0", + "@types/node": "^22.0.0", "@types/shelljs": "^0.8.8", "@types/supports-color": "^8.1.1", "@types/tar": "^6.1.0", From a9f1440e4cb86746e6fe5527beb2abae8957d057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=81=A4=E3=81=8D?= Date: Wed, 31 Jul 2024 13:59:47 -0700 Subject: [PATCH 08/16] Let dependabot check updates for GitHub Actions (#316) --- .github/dependabot.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index aff82a10..782a0ad7 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,3 +4,7 @@ updates: directory: "/" schedule: interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" From 9b5f08b016253b5e0edb03b153e8fc61346c32fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=81=A4=E3=81=8D?= Date: Wed, 31 Jul 2024 17:47:02 -0700 Subject: [PATCH 09/16] Improve the performance of detecting linux-musl platform by parsing ELF (#315) Co-authored-by: Natalie Weizenbaum --- lib/src/compiler-path.ts | 21 +++++--- lib/src/elf.ts | 102 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 6 deletions(-) create mode 100644 lib/src/elf.ts diff --git a/lib/src/compiler-path.ts b/lib/src/compiler-path.ts index 60675e5b..0097ac28 100644 --- a/lib/src/compiler-path.ts +++ b/lib/src/compiler-path.ts @@ -4,20 +4,29 @@ import * as fs from 'fs'; import * as p from 'path'; +import {getElfInterpreter} from './elf'; import {isErrnoException} from './utils'; /** - * Detect if the current running node binary is linked with musl libc by - * checking if the binary contains a string like "/.../ld-musl-$ARCH.so" + * Detect if the given binary is linked with musl libc by checking if + * the interpreter basename starts with "ld-musl-" */ -const isLinuxMusl = function () { - return fs.readFileSync(process.execPath).includes('/ld-musl-'); -}; +function isLinuxMusl(path: string): boolean { + try { + const interpreter = getElfInterpreter(path); + return p.basename(interpreter).startsWith('ld-musl-'); + } catch (error) { + console.warn( + `Warning: Failed to detect linux-musl, fallback to linux-gnu: ${error.message}` + ); + return false; + } +} /** The full command for the embedded compiler executable. */ export const compilerCommand = (() => { const platform = - process.platform === 'linux' && isLinuxMusl() + process.platform === 'linux' && isLinuxMusl(process.execPath) ? 'linux-musl' : (process.platform as string); diff --git a/lib/src/elf.ts b/lib/src/elf.ts new file mode 100644 index 00000000..1cd396a6 --- /dev/null +++ b/lib/src/elf.ts @@ -0,0 +1,102 @@ +// Copyright 2024 Google LLC. Use of this source code is governed by an +// MIT-style license that can be found in the LICENSE file or at +// https://opensource.org/licenses/MIT. + +import * as fs from 'fs'; + +/** Read a chunk of data from a file descriptor into a new Buffer. */ +function readFileDescriptor( + fd: number, + position: number, + length: number +): Buffer { + const buffer = Buffer.alloc(length); + let offset = 0; + while (offset < length) { + const bytesRead = fs.readSync(fd, buffer, { + offset: offset, + position: position + offset, + }); + if (bytesRead === 0) { + throw new Error(`failed to read fd ${fd}`); + } + + offset += bytesRead; + } + return buffer; +} + +/** Parse an ELF file and return its interpreter. */ +export function getElfInterpreter(path: string): string { + const fd = fs.openSync(path, 'r'); + try { + const elfIdentification = new DataView( + readFileDescriptor(fd, 0, 64).buffer + ); + + if ( + elfIdentification.getUint8(0) !== 0x7f || + elfIdentification.getUint8(1) !== 0x45 || + elfIdentification.getUint8(2) !== 0x4c || + elfIdentification.getUint8(3) !== 0x46 + ) { + throw new Error(`${path} is not an ELF file.`); + } + + const elfIdentificationClass = elfIdentification.getUint8(4); + if (elfIdentificationClass !== 1 && elfIdentificationClass !== 2) { + throw new Error(`${path} has an invalid ELF class.`); + } + const elfClass32 = elfIdentificationClass === 1; + + const elfIdentificationData = elfIdentification.getUint8(5); + if (elfIdentificationData !== 1 && elfIdentificationData !== 2) { + throw new Error(`${path} has an invalid endianness.`); + } + const littleEndian = elfIdentificationData === 1; + + // Converting BigUint64 to Number because node Buffer length has to be + // number type, and we don't expect any elf we check with this method to + // be larger than 9007199254740991 bytes. + const programHeadersOffset = elfClass32 + ? elfIdentification.getUint32(28, littleEndian) + : Number(elfIdentification.getBigUint64(32, littleEndian)); + const programHeadersEntrySize = elfClass32 + ? elfIdentification.getUint16(42, littleEndian) + : elfIdentification.getUint16(54, littleEndian); + const programHeadersEntryCount = elfClass32 + ? elfIdentification.getUint16(44, littleEndian) + : elfIdentification.getUint16(56, littleEndian); + + const programHeaders = new DataView( + readFileDescriptor( + fd, + programHeadersOffset, + programHeadersEntrySize * programHeadersEntryCount + ).buffer + ); + for (let i = 0; i < programHeadersEntryCount; i++) { + const byteOffset = i * programHeadersEntrySize; + const segmentType = programHeaders.getUint32(byteOffset, littleEndian); + if (segmentType !== 3) continue; // 3 is PT_INTERP, the interpreter + + const segmentOffset = elfClass32 + ? programHeaders.getUint32(byteOffset + 4, littleEndian) + : Number(programHeaders.getBigUint64(byteOffset + 8, littleEndian)); + const segmentFileSize = elfClass32 + ? programHeaders.getUint32(byteOffset + 16, littleEndian) + : Number(programHeaders.getBigUint64(byteOffset + 32, littleEndian)); + + const buffer = readFileDescriptor(fd, segmentOffset, segmentFileSize); + if (buffer[segmentFileSize - 1] !== 0) { + throw new Error(`${path} is corrupted.`); + } + + return buffer.toString('utf8', 0, segmentFileSize - 1); + } + + throw new Error(`${path} does not contain an interpreter entry.`); + } finally { + fs.closeSync(fd); + } +} From 53abf9865d404895f427660d665c25f5407ef733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=81=A4=E3=81=8D?= Date: Thu, 1 Aug 2024 13:09:48 -0700 Subject: [PATCH 10/16] Remove broken launcher config from optional dependencies' package.json (#322) --- npm/android-arm/package.json | 3 --- npm/android-arm64/package.json | 3 --- npm/android-ia32/package.json | 3 --- npm/android-x64/package.json | 3 --- npm/darwin-arm64/package.json | 3 --- npm/darwin-x64/package.json | 3 --- npm/linux-arm/package.json | 3 --- npm/linux-arm64/package.json | 3 --- npm/linux-ia32/package.json | 3 --- npm/linux-x64/package.json | 3 --- npm/win32-arm64/package.json | 3 --- npm/win32-ia32/package.json | 3 --- npm/win32-x64/package.json | 3 --- tool/prepare-optional-release.ts | 42 -------------------------------- 14 files changed, 81 deletions(-) diff --git a/npm/android-arm/package.json b/npm/android-arm/package.json index 351445fd..8d467a14 100644 --- a/npm/android-arm/package.json +++ b/npm/android-arm/package.json @@ -11,9 +11,6 @@ "engines": { "node": ">=14.0.0" }, - "bin": { - "sass": "./dart-sass/sass" - }, "os": [ "android" ], diff --git a/npm/android-arm64/package.json b/npm/android-arm64/package.json index 8a4a9f90..6648630f 100644 --- a/npm/android-arm64/package.json +++ b/npm/android-arm64/package.json @@ -11,9 +11,6 @@ "engines": { "node": ">=14.0.0" }, - "bin": { - "sass": "./dart-sass/sass" - }, "os": [ "android" ], diff --git a/npm/android-ia32/package.json b/npm/android-ia32/package.json index 28d2cb6c..4d9c9bc4 100644 --- a/npm/android-ia32/package.json +++ b/npm/android-ia32/package.json @@ -11,9 +11,6 @@ "engines": { "node": ">=14.0.0" }, - "bin": { - "sass": "./dart-sass/sass" - }, "os": [ "android" ], diff --git a/npm/android-x64/package.json b/npm/android-x64/package.json index 45fd9d3d..598f2308 100644 --- a/npm/android-x64/package.json +++ b/npm/android-x64/package.json @@ -11,9 +11,6 @@ "engines": { "node": ">=14.0.0" }, - "bin": { - "sass": "./dart-sass/sass" - }, "os": [ "android" ], diff --git a/npm/darwin-arm64/package.json b/npm/darwin-arm64/package.json index fe1f3356..08a81de6 100644 --- a/npm/darwin-arm64/package.json +++ b/npm/darwin-arm64/package.json @@ -11,9 +11,6 @@ "engines": { "node": ">=14.0.0" }, - "bin": { - "sass": "./dart-sass/sass" - }, "os": [ "darwin" ], diff --git a/npm/darwin-x64/package.json b/npm/darwin-x64/package.json index f307056c..e3428f50 100644 --- a/npm/darwin-x64/package.json +++ b/npm/darwin-x64/package.json @@ -11,9 +11,6 @@ "engines": { "node": ">=14.0.0" }, - "bin": { - "sass": "./dart-sass/sass" - }, "os": [ "darwin" ], diff --git a/npm/linux-arm/package.json b/npm/linux-arm/package.json index fd0207b2..dd910307 100644 --- a/npm/linux-arm/package.json +++ b/npm/linux-arm/package.json @@ -11,9 +11,6 @@ "engines": { "node": ">=14.0.0" }, - "bin": { - "sass": "./dart-sass/sass" - }, "os": [ "linux" ], diff --git a/npm/linux-arm64/package.json b/npm/linux-arm64/package.json index 92c42112..9cd90d34 100644 --- a/npm/linux-arm64/package.json +++ b/npm/linux-arm64/package.json @@ -11,9 +11,6 @@ "engines": { "node": ">=14.0.0" }, - "bin": { - "sass": "./dart-sass/sass" - }, "os": [ "linux" ], diff --git a/npm/linux-ia32/package.json b/npm/linux-ia32/package.json index 751c3bbc..48356826 100644 --- a/npm/linux-ia32/package.json +++ b/npm/linux-ia32/package.json @@ -11,9 +11,6 @@ "engines": { "node": ">=14.0.0" }, - "bin": { - "sass": "./dart-sass/sass" - }, "os": [ "linux" ], diff --git a/npm/linux-x64/package.json b/npm/linux-x64/package.json index 55c52fd6..308a38fb 100644 --- a/npm/linux-x64/package.json +++ b/npm/linux-x64/package.json @@ -11,9 +11,6 @@ "engines": { "node": ">=14.0.0" }, - "bin": { - "sass": "./dart-sass/sass" - }, "os": [ "linux" ], diff --git a/npm/win32-arm64/package.json b/npm/win32-arm64/package.json index 8569102f..27a53b3b 100644 --- a/npm/win32-arm64/package.json +++ b/npm/win32-arm64/package.json @@ -11,9 +11,6 @@ "engines": { "node": ">=14.0.0" }, - "bin": { - "sass": "./dart-sass/sass.bat" - }, "os": [ "win32" ], diff --git a/npm/win32-ia32/package.json b/npm/win32-ia32/package.json index 94b99812..97b1df67 100644 --- a/npm/win32-ia32/package.json +++ b/npm/win32-ia32/package.json @@ -11,9 +11,6 @@ "engines": { "node": ">=14.0.0" }, - "bin": { - "sass": "./dart-sass/sass.bat" - }, "os": [ "win32" ], diff --git a/npm/win32-x64/package.json b/npm/win32-x64/package.json index 6754cb82..5ecbe218 100644 --- a/npm/win32-x64/package.json +++ b/npm/win32-x64/package.json @@ -11,9 +11,6 @@ "engines": { "node": ">=14.0.0" }, - "bin": { - "sass": "./dart-sass/sass.bat" - }, "os": [ "win32" ], diff --git a/tool/prepare-optional-release.ts b/tool/prepare-optional-release.ts index c0e606c3..bc088ffb 100644 --- a/tool/prepare-optional-release.ts +++ b/tool/prepare-optional-release.ts @@ -112,47 +112,6 @@ async function downloadRelease(options: { await fs.unlink(zippedAssetPath); } -// Patch the launcher script if needed. -// -// For linux both `-linux-` and `-linux-musl-` packages will be installed -// because npm doesn't know how to select packages based on LibC. To avoid -// conflicts, only the `-linux-` packages have "bin" scripts defined in -// package.json, which we patch to detect which LibC is available and launch the -// correct binary. -async function patchLauncherScript( - path: string, - dartPlatform: DartPlatform, - dartArch: DartArch -) { - if (dartPlatform !== 'linux') return; - - const scriptPath = p.join(path, 'dart-sass', 'sass'); - console.log(`Patching ${scriptPath} script.`); - - const shebang = Buffer.from('#!/bin/sh\n'); - const buffer = await fs.readFile(scriptPath); - if (!buffer.subarray(0, shebang.length).equals(shebang)) { - throw new Error(`${scriptPath} is not a shell script!`); - } - - const lines = buffer.toString('utf-8').split('\n'); - const index = lines.findIndex(line => line.startsWith('path=')); - if (index < 0) { - throw new Error(`The format of ${scriptPath} has changed!`); - } - - lines.splice( - index + 1, - 0, - '# Detect linux-musl', - 'if grep -qm 1 /ld-musl- /proc/self/exe; then', - ` path="$path/../../sass-embedded-linux-musl-${dartArch}/dart-sass"`, - 'fi' - ); - - await fs.writeFile(scriptPath, lines.join('\n')); -} - void (async () => { try { const version = pkg['compiler-version'] as string; @@ -178,7 +137,6 @@ void (async () => { `${getArchiveExtension(dartPlatform)}`, outPath, }); - await patchLauncherScript(outPath, dartPlatform, dartArch); } catch (error) { console.error(error); process.exitCode = 1; From 0093f6858b6e8cea26148c795274331217c3ce96 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Thu, 1 Aug 2024 13:14:01 -0700 Subject: [PATCH 11/16] Add a Sass executable wrapper that forwards to the correct exe (#313) This allows users to run `npx sass` when they've just installed `sass-embedded` and directly run the Dart VM. Due to npm/cmd-shim#152, there's no way to make this work on Windows CMD/Powershell without substantially curtailing the performance on other operating systems. --- bin/sass.ts | 25 +++++++++++++++++++++++++ package.json | 1 + tsconfig.build.json | 1 + tsconfig.json | 1 + 4 files changed, 28 insertions(+) create mode 100755 bin/sass.ts diff --git a/bin/sass.ts b/bin/sass.ts new file mode 100755 index 00000000..d25d834a --- /dev/null +++ b/bin/sass.ts @@ -0,0 +1,25 @@ +#!/usr/bin/env node + +import * as child_process from 'child_process'; +import {compilerCommand} from '../lib/src/compiler-path'; + +// TODO npm/cmd-shim#152 and yarnpkg/berry#6422 - If and when the package +// managers support it, we should make this a proper shell script rather than a +// JS wrapper. + +try { + child_process.execFileSync( + compilerCommand[0], + [...compilerCommand.slice(1), ...process.argv.slice(2)], + { + stdio: 'inherit', + windowsHide: true, + } + ); +} catch (error) { + if (error.code) { + throw error; + } else { + process.exitCode = error.status; + } +} diff --git a/package.json b/package.json index e9125b74..2983f245 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "engines": { "node": ">=16.0.0" }, + "bin": {"sass": "dist/bin/sass.js"}, "scripts": { "init": "ts-node ./tool/init.ts", "check": "npm-run-all check:gts check:tsc", diff --git a/tsconfig.build.json b/tsconfig.build.json index 0673a92b..5ca9532f 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -1,6 +1,7 @@ { "extends": "./tsconfig.json", "exclude": [ + "jest.config.js", "lib/src/vendor/dart-sass/**", "**/*.test.ts" ] diff --git a/tsconfig.json b/tsconfig.json index 35577090..d83f95cd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,6 +11,7 @@ }, "include": [ "*.ts", + "bin/*.ts", "lib/**/*.ts", "tool/**/*.ts", "test/**/*.ts" From 3b4c45cee73bcd075b1188dca3ee04e6c2530647 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Thu, 1 Aug 2024 17:15:54 -0700 Subject: [PATCH 12/16] Add a couple additional lints to ensure consistent style (#321) --- .eslintrc | 5 +++++ lib/src/compiler.test.ts | 2 +- lib/src/exception.ts | 2 +- lib/src/legacy/value/wrap.ts | 4 ++-- lib/src/packet-transformer.test.ts | 2 +- lib/src/request-tracker.ts | 6 +++--- lib/src/value/calculations.ts | 9 ++++++--- lib/src/value/color.ts | 2 +- lib/src/value/utils.ts | 2 +- test/utils.ts | 2 +- tool/get-deprecations.ts | 2 +- tool/prepare-release.ts | 2 +- 12 files changed, 24 insertions(+), 16 deletions(-) diff --git a/.eslintrc b/.eslintrc index f135f8dd..3b5b9123 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,11 @@ { "extends": "./node_modules/gts/", "rules": { + "@typescript-eslint/explicit-function-return-type": [ + "error", + {"allowExpressions": true} + ], + "func-style": ["error", "declaration"], "prefer-const": ["error", {"destructuring": "all"}], // It would be nice to sort import declaration order as well, but that's not // autofixable and it's not worth the effort of handling manually. diff --git a/lib/src/compiler.test.ts b/lib/src/compiler.test.ts index 58fbc61f..df72f27e 100644 --- a/lib/src/compiler.test.ts +++ b/lib/src/compiler.test.ts @@ -9,7 +9,7 @@ import * as compilerModule from './compiler/utils'; import {Compiler, initCompiler} from './compiler/sync'; const createDispatcher = jest.spyOn(compilerModule, 'createDispatcher'); -function getIdHistory() { +function getIdHistory(): number[] { return createDispatcher.mock.calls.map(([id]) => id); } diff --git a/lib/src/exception.ts b/lib/src/exception.ts index 48eb6dfd..3e00f40e 100644 --- a/lib/src/exception.ts +++ b/lib/src/exception.ts @@ -19,7 +19,7 @@ export class Exception extends Error implements SassException { this.span = deprotofySourceSpan(failure.span!); } - toString() { + toString(): string { return this.message; } } diff --git a/lib/src/legacy/value/wrap.ts b/lib/src/legacy/value/wrap.ts index 178da2ec..7da2e1cd 100644 --- a/lib/src/legacy/value/wrap.ts +++ b/lib/src/legacy/value/wrap.ts @@ -42,7 +42,7 @@ export function wrapFunction( } else { return args => new Promise((resolve, reject) => { - const done = (result: unknown) => { + function done(result: unknown): void { try { if (result instanceof Error) { reject(result); @@ -52,7 +52,7 @@ export function wrapFunction( } catch (error: unknown) { reject(error); } - }; + } // The cast here is necesary to work around microsoft/TypeScript#33815. const syncResult = (callback as (...args: unknown[]) => unknown).apply( diff --git a/lib/src/packet-transformer.test.ts b/lib/src/packet-transformer.test.ts index 603801f0..78297883 100644 --- a/lib/src/packet-transformer.test.ts +++ b/lib/src/packet-transformer.test.ts @@ -55,7 +55,7 @@ describe('packet transformer', () => { describe('decode', () => { let rawBuffers$: Subject; - function expectDecoding(expected: Buffer[], done: () => void) { + function expectDecoding(expected: Buffer[], done: () => void): void { const actual: Buffer[] = []; packets.outboundProtobufs$.subscribe({ next: protobuf => actual.push(protobuf), diff --git a/lib/src/request-tracker.ts b/lib/src/request-tracker.ts index f26db4ca..200f51c1 100644 --- a/lib/src/request-tracker.ts +++ b/lib/src/request-tracker.ts @@ -16,7 +16,7 @@ export class RequestTracker { > = []; /** The next available request ID. */ - get nextId() { + get nextId(): number { for (let i = 0; i < this.requests.length; i++) { if (this.requests[i] === undefined || this.requests[i] === null) { return i; @@ -32,7 +32,7 @@ export class RequestTracker { add( id: number, expectedResponseType: InboundResponseType | OutboundResponseType - ) { + ): void { if (id < 0) { throw Error(`Invalid request ID ${id}.`); } else if (this.requests[id]) { @@ -47,7 +47,7 @@ export class RequestTracker { * Resolves a pending request with matching ID `id` and expected response type * `type`. Throws an error if the Protocol Error is violated. */ - resolve(id: number, type: InboundResponseType | OutboundResponseType) { + resolve(id: number, type: InboundResponseType | OutboundResponseType): void { if (this.requests[id] === undefined || this.requests[id] === null) { throw Error(`Response ID ${id} does not match any pending requests.`); } else if (this.requests[id] !== type) { diff --git a/lib/src/value/calculations.ts b/lib/src/value/calculations.ts index ca3eebe4..7f4c2a4e 100644 --- a/lib/src/value/calculations.ts +++ b/lib/src/value/calculations.ts @@ -23,9 +23,12 @@ function assertCalculationValue(value: CalculationValue): void { } } -const isValidClampArg = (value: CalculationValue): boolean => - value instanceof CalculationInterpolation || - (value instanceof SassString && !value.hasQuotes); +function isValidClampArg(value: CalculationValue): boolean { + return ( + value instanceof CalculationInterpolation || + (value instanceof SassString && !value.hasQuotes) + ); +} /* A SassScript calculation */ export class SassCalculation extends Value { diff --git a/lib/src/value/color.ts b/lib/src/value/color.ts index b2aaad1f..a47c4cd5 100644 --- a/lib/src/value/color.ts +++ b/lib/src/value/color.ts @@ -350,7 +350,7 @@ function hwbToRgb( hue: number, scaledWhiteness: number, scaledBlackness: number -) { +): number { const factor = 1 - scaledWhiteness - scaledBlackness; const channel = hueToRgb(0, 1, hue) * factor + scaledWhiteness; return fuzzyRound(channel * 255); diff --git a/lib/src/value/utils.ts b/lib/src/value/utils.ts index 18584bfb..d40ed98c 100644 --- a/lib/src/value/utils.ts +++ b/lib/src/value/utils.ts @@ -116,7 +116,7 @@ export function fuzzyAssertInRange( } /** Returns `dividend % modulus`, but always in the range `[0, modulus)`. */ -export function positiveMod(dividend: number, modulus: number) { +export function positiveMod(dividend: number, modulus: number): number { const result = dividend % modulus; return result < 0 ? result + modulus : result; } diff --git a/test/utils.ts b/test/utils.ts index f8733917..c071d481 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -48,7 +48,7 @@ export function expectEqualIgnoringWhitespace( string1: string, string2: string ): void { - function strip(str: string) { + function strip(str: string): string { return str.replace(/\s+/g, ''); } expect(strip(string1)).toBe(strip(string2)); diff --git a/tool/get-deprecations.ts b/tool/get-deprecations.ts index 73618b4d..9571335f 100644 --- a/tool/get-deprecations.ts +++ b/tool/get-deprecations.ts @@ -34,7 +34,7 @@ function toVersionCode(version: string | undefined): string { * Generates the list of deprecations based on the YAML file in the language * repo. */ -export async function getDeprecations(outDirectory: string) { +export async function getDeprecations(outDirectory: string): Promise { const yamlText = fs.readFileSync(yamlFile, 'utf8'); const deprecations = parse(yamlText) as YamlData; diff --git a/tool/prepare-release.ts b/tool/prepare-release.ts index efdc95a5..4065ffcf 100644 --- a/tool/prepare-release.ts +++ b/tool/prepare-release.ts @@ -35,7 +35,7 @@ void (async () => { // Quick sanity checks to make sure the release we are preparing is a suitable // candidate for release. -async function sanityCheckBeforeRelease() { +async function sanityCheckBeforeRelease(): Promise { console.log('Running sanity checks before releasing.'); const releaseVersion = pkg.version; From 9b04eeb27ed5a4c8f0409dd39a62c982463cd185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=81=A4=E3=81=8D?= Date: Mon, 5 Aug 2024 20:08:17 -0700 Subject: [PATCH 13/16] Support linux-riscv64 (#323) --- npm/android-riscv64/README.md | 3 +++ npm/android-riscv64/package.json | 20 ++++++++++++++++++++ npm/linux-musl-riscv64/README.md | 3 +++ npm/linux-musl-riscv64/package.json | 20 ++++++++++++++++++++ npm/linux-riscv64/README.md | 3 +++ npm/linux-riscv64/package.json | 20 ++++++++++++++++++++ package.json | 3 +++ tool/prepare-optional-release.ts | 4 +++- 8 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 npm/android-riscv64/README.md create mode 100644 npm/android-riscv64/package.json create mode 100644 npm/linux-musl-riscv64/README.md create mode 100644 npm/linux-musl-riscv64/package.json create mode 100644 npm/linux-riscv64/README.md create mode 100644 npm/linux-riscv64/package.json diff --git a/npm/android-riscv64/README.md b/npm/android-riscv64/README.md new file mode 100644 index 00000000..5c79fe81 --- /dev/null +++ b/npm/android-riscv64/README.md @@ -0,0 +1,3 @@ +# `sass-embedded-android-riscv64` + +This is the **android-riscv64** binary for [`sass-embedded`](https://www.npmjs.com/package/sass-embedded) diff --git a/npm/android-riscv64/package.json b/npm/android-riscv64/package.json new file mode 100644 index 00000000..7096a34d --- /dev/null +++ b/npm/android-riscv64/package.json @@ -0,0 +1,20 @@ +{ + "name": "sass-embedded-android-riscv64", + "version": "1.77.8", + "description": "The android-riscv64 binary for sass-embedded", + "repository": "sass/embedded-host-node", + "author": "Google Inc.", + "license": "MIT", + "files": [ + "dart-sass/**/*" + ], + "engines": { + "node": ">=14.0.0" + }, + "os": [ + "android" + ], + "cpu": [ + "riscv64" + ] +} diff --git a/npm/linux-musl-riscv64/README.md b/npm/linux-musl-riscv64/README.md new file mode 100644 index 00000000..b66e939f --- /dev/null +++ b/npm/linux-musl-riscv64/README.md @@ -0,0 +1,3 @@ +# `sass-embedded-linux-musl-riscv64` + +This is the **linux-musl-riscv64** binary for [`sass-embedded`](https://www.npmjs.com/package/sass-embedded) diff --git a/npm/linux-musl-riscv64/package.json b/npm/linux-musl-riscv64/package.json new file mode 100644 index 00000000..c4cd9bbc --- /dev/null +++ b/npm/linux-musl-riscv64/package.json @@ -0,0 +1,20 @@ +{ + "name": "sass-embedded-linux-musl-riscv64", + "version": "1.77.8", + "description": "The linux-musl-riscv64 binary for sass-embedded", + "repository": "sass/embedded-host-node", + "author": "Google Inc.", + "license": "MIT", + "files": [ + "dart-sass/**/*" + ], + "engines": { + "node": ">=14.0.0" + }, + "os": [ + "linux" + ], + "cpu": [ + "riscv64" + ] +} diff --git a/npm/linux-riscv64/README.md b/npm/linux-riscv64/README.md new file mode 100644 index 00000000..70bf2c32 --- /dev/null +++ b/npm/linux-riscv64/README.md @@ -0,0 +1,3 @@ +# `sass-embedded-linux-riscv64` + +This is the **linux-riscv64** binary for [`sass-embedded`](https://www.npmjs.com/package/sass-embedded) diff --git a/npm/linux-riscv64/package.json b/npm/linux-riscv64/package.json new file mode 100644 index 00000000..332e08b5 --- /dev/null +++ b/npm/linux-riscv64/package.json @@ -0,0 +1,20 @@ +{ + "name": "sass-embedded-linux-riscv64", + "version": "1.77.8", + "description": "The linux-riscv64 binary for sass-embedded", + "repository": "sass/embedded-host-node", + "author": "Google Inc.", + "license": "MIT", + "files": [ + "dart-sass/**/*" + ], + "engines": { + "node": ">=14.0.0" + }, + "os": [ + "linux" + ], + "cpu": [ + "riscv64" + ] +} diff --git a/package.json b/package.json index 2983f245..1858b8ce 100644 --- a/package.json +++ b/package.json @@ -39,16 +39,19 @@ "sass-embedded-android-arm": "1.77.8", "sass-embedded-android-arm64": "1.77.8", "sass-embedded-android-ia32": "1.77.8", + "sass-embedded-android-riscv64": "1.77.8", "sass-embedded-android-x64": "1.77.8", "sass-embedded-darwin-arm64": "1.77.8", "sass-embedded-darwin-x64": "1.77.8", "sass-embedded-linux-arm": "1.77.8", "sass-embedded-linux-arm64": "1.77.8", "sass-embedded-linux-ia32": "1.77.8", + "sass-embedded-linux-riscv64": "1.77.8", "sass-embedded-linux-x64": "1.77.8", "sass-embedded-linux-musl-arm": "1.77.8", "sass-embedded-linux-musl-arm64": "1.77.8", "sass-embedded-linux-musl-ia32": "1.77.8", + "sass-embedded-linux-musl-riscv64": "1.77.8", "sass-embedded-linux-musl-x64": "1.77.8", "sass-embedded-win32-arm64": "1.77.8", "sass-embedded-win32-ia32": "1.77.8", diff --git a/tool/prepare-optional-release.ts b/tool/prepare-optional-release.ts index bc088ffb..29f488e8 100644 --- a/tool/prepare-optional-release.ts +++ b/tool/prepare-optional-release.ts @@ -13,7 +13,7 @@ export type DartPlatform = | 'linux-musl' | 'macos' | 'windows'; -export type DartArch = 'ia32' | 'x64' | 'arm' | 'arm64'; +export type DartArch = 'ia32' | 'x64' | 'arm' | 'arm64' | 'riscv64'; const argv = yargs(process.argv.slice(2)) .option('package', { @@ -61,6 +61,8 @@ export function nodeArchToDartArch(arch: string): DartArch { return 'arm'; case 'arm64': return 'arm64'; + case 'riscv64': + return 'riscv64'; default: throw Error(`Architecture ${arch} is not supported.`); } From f172c1ac924012c4d6e5d53586717e80a957462c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 14:03:10 -0700 Subject: [PATCH 14/16] Bump actions/checkout from 3 to 4 (#318) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d75baccf..ad66a943 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: node-version: 'lts/*' @@ -46,7 +46,7 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} @@ -89,7 +89,7 @@ jobs: node_version: lts/-2 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dart-lang/setup-dart@v1 with: {sdk: stable} - uses: actions/setup-node@v3 @@ -140,7 +140,7 @@ jobs: needs: [static_analysis, tests, sass_spec] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: node-version: 'lts/*' From b54575994a4c51a0e6cfa3fbed236923609245b6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 14:45:09 -0700 Subject: [PATCH 15/16] Bump actions/setup-node from 3 to 4 (#317) Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 4. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad66a943..dd3614a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 'lts/*' check-latest: true @@ -47,7 +47,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} check-latest: true @@ -92,7 +92,7 @@ jobs: - uses: actions/checkout@v4 - uses: dart-lang/setup-dart@v1 with: {sdk: stable} - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: {node-version: "${{ matrix.node_version }}"} - name: Check out Dart Sass @@ -141,7 +141,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 'lts/*' check-latest: true From d2a3cbc1376c64070714ce80ead702ccc2791f58 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Mon, 12 Aug 2024 15:39:51 -0700 Subject: [PATCH 16/16] Fix style issues --- lib/src/protofier.ts | 2 +- lib/src/value/color.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/src/protofier.ts b/lib/src/protofier.ts index c9c28e39..0347364a 100644 --- a/lib/src/protofier.ts +++ b/lib/src/protofier.ts @@ -8,7 +8,7 @@ import * as proto from './vendor/embedded_sass_pb'; import * as utils from './utils'; import {FunctionRegistry} from './function-registry'; import {SassArgumentList} from './value/argument-list'; -import {SassColor, KnownColorSpace} from './value/color'; +import {KnownColorSpace, SassColor} from './value/color'; import {SassFunction} from './value/function'; import {ListSeparator, SassList} from './value/list'; import {SassMap} from './value/map'; diff --git a/lib/src/value/color.ts b/lib/src/value/color.ts index 5febe920..5cf260d4 100644 --- a/lib/src/value/color.ts +++ b/lib/src/value/color.ts @@ -295,7 +295,7 @@ function checkChangeDeprecations( [key in ChannelName]?: number | null; }, channels: ChannelName[] -) { +): void { if (options.alpha === null) emitNullAlphaDeprecation(); for (const channel of channels) { if (options[channel] === null) emitColor4ApiChangeNullDeprecation(channel); @@ -303,7 +303,7 @@ function checkChangeDeprecations( } /** Warn users about legacy color channel getters. */ -function emitColor4ApiGetterDeprecation(name: string) { +function emitColor4ApiGetterDeprecation(name: string): void { console.warn( 'Deprecation [color-4-api]: ' + `\`${name}\` is deprecated, use \`channel\` instead.` + @@ -316,7 +316,7 @@ function emitColor4ApiGetterDeprecation(name: string) { * Warn users about changing channels not in the current color space without * explicitly setting `space`. */ -function emitColor4ApiChangeSpaceDeprecation() { +function emitColor4ApiChangeSpaceDeprecation(): void { console.warn( 'Deprecation [color-4-api]: ' + "Changing a channel not in this color's space without explicitly " + @@ -327,7 +327,7 @@ function emitColor4ApiChangeSpaceDeprecation() { } /** Warn users about `null` channel values without setting `space`. */ -function emitColor4ApiChangeNullDeprecation(channel: string) { +function emitColor4ApiChangeNullDeprecation(channel: string): void { console.warn( 'Deprecation [color-4-api]: ' + `Passing \`${channel}: null\` without setting \`space\` is deprecated.` + @@ -337,7 +337,7 @@ function emitColor4ApiChangeNullDeprecation(channel: string) { } /** Warn users about null-alpha deprecation. */ -function emitNullAlphaDeprecation() { +function emitNullAlphaDeprecation(): void { console.warn( 'Deprecation [null-alpha]: ' + 'Passing `alpha: null` without setting `space` is deprecated.' + @@ -375,7 +375,7 @@ export class SassColor extends Value { private channel2Id!: ChannelName; // Sets channel names based on this color's color space - private setChannelIds(space: KnownColorSpace) { + private setChannelIds(space: KnownColorSpace): void { switch (space) { case 'rgb': case 'srgb': @@ -940,10 +940,10 @@ export class SassColor extends Value { spaceSetExplicitly: boolean ): SassColor { const color = this.toSpace(space); - const getChangedValue = (channel: ChannelName) => { + function getChangedValue(channel: ChannelName): number | null { if (isNumberOrNull(options[channel])) return options[channel]; return color.channel(channel); - }; + } switch (space) { case 'hsl': @@ -1099,7 +1099,7 @@ export class SassColor extends Value { space?: ColorSpaceXyz; } ): SassColor; - change(options: ConstructorOptions) { + change(options: ConstructorOptions): SassColor { const spaceSetExplicitly = !!options.space; let space = options.space ?? this.space; if (this.isLegacy && !spaceSetExplicitly) {