Skip to content

Commit 1c136de

Browse files
authored
Merge pull request #277 from sass/merge-main
Merge main into feature.color-4
2 parents 8c82e53 + 6cdf30a commit 1c136de

Some content is hidden

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

50 files changed

+1375
-540
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ defaults:
55

66
env:
77
PROTOC_VERSION: 3.x
8-
DEFAULT_NODE_VERSION: 18.x # If changing this, also change jobs.tests.strategy.matrix.node_version
98

109
on:
1110
push:
@@ -19,10 +18,10 @@ jobs:
1918
runs-on: ubuntu-latest
2019

2120
steps:
22-
- uses: actions/checkout@v2
23-
- uses: actions/setup-node@v2
21+
- uses: actions/checkout@v3
22+
- uses: actions/setup-node@v3
2423
with:
25-
node-version: ${{ env.DEFAULT_NODE_VERSION }}
24+
node-version: 'lts/*'
2625
check-latest: true
2726

2827
- name: Check out the language repo
@@ -43,12 +42,12 @@ jobs:
4342
strategy:
4443
matrix:
4544
os: [ubuntu, macos, windows]
46-
node-version: [18.x, 16.x] # If changing this, also change env.DEFAULT_NODE_VERSION
45+
node-version: ['lts/*', 'lts/-1', 'lts/-2']
4746
fail-fast: false
4847

4948
steps:
50-
- uses: actions/checkout@v2
51-
- uses: actions/setup-node@v2
49+
- uses: actions/checkout@v3
50+
- uses: actions/setup-node@v3
5251
with:
5352
node-version: ${{ matrix.node-version }}
5453
check-latest: true
@@ -73,9 +72,6 @@ jobs:
7372
- run: npm run compile
7473
- run: node test/after-compile-test.mjs
7574

76-
# The versions should be kept up-to-date with the latest LTS Node releases.
77-
# They next need to be rotated October 2021. See
78-
# https://github.com/nodejs/Release.
7975
sass_spec:
8076
name: 'JS API Tests | Node ${{ matrix.node_version }} | ${{ matrix.os }}'
8177
runs-on: ${{ matrix.os }}-latest
@@ -84,17 +80,19 @@ jobs:
8480
fail-fast: false
8581
matrix:
8682
os: [ubuntu, windows, macos]
87-
node_version: [18]
83+
node_version: ['lts/*']
8884
include:
8985
# Include LTS versions on Ubuntu
9086
- os: ubuntu
91-
node_version: 16
87+
node_version: lts/-1
88+
- os: ubuntu
89+
node_version: lts/-2
9290

9391
steps:
94-
- uses: actions/checkout@v2
92+
- uses: actions/checkout@v3
9593
- uses: dart-lang/setup-dart@v1
9694
with: {sdk: stable}
97-
- uses: actions/setup-node@v2
95+
- uses: actions/setup-node@v3
9896
with: {node-version: "${{ matrix.node_version }}"}
9997

10098
- name: Check out Dart Sass
@@ -142,10 +140,10 @@ jobs:
142140
needs: [static_analysis, tests, sass_spec]
143141

144142
steps:
145-
- uses: actions/checkout@v2
146-
- uses: actions/setup-node@v2
143+
- uses: actions/checkout@v3
144+
- uses: actions/setup-node@v3
147145
with:
148-
node-version: ${{ env.DEFAULT_NODE_VERSION }}
146+
node-version: 'lts/*'
149147
check-latest: true
150148
registry-url: 'https://registry.npmjs.org'
151149
- run: npm install
@@ -159,9 +157,7 @@ jobs:
159157
env:
160158
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
161159
run: |
162-
for pkg in linux-arm linux-arm64 linux-ia32 linux-x64 darwin-arm64 darwin-x64 win32-ia32 win32-x64; do
163-
npx ts-node ./tool/prepare-optional-release.ts --package=$pkg && npm publish ./npm/$pkg
164-
done
160+
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' --
165161
166162
- run: npm publish
167163
env:

CHANGELOG.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,126 @@
1+
## 1.72.0
2+
3+
* Support adjacent `/`s without whitespace in between when parsing plain CSS
4+
expressions.
5+
6+
* Allow the Node.js `pkg:` importer to load Sass stylesheets for `package.json`
7+
`exports` field entries without extensions.
8+
9+
* When printing suggestions for variables, use underscores in variable names
10+
when the original usage used underscores.
11+
12+
### JavaScript API
13+
14+
* Properly resolve `pkg:` imports with the Node.js package importer when
15+
arguments are passed to the JavaScript process.
16+
17+
## 1.71.1
18+
19+
### Command-Line Interface
20+
21+
* Ship the musl Linux release with the proper Dart executable.
22+
23+
### JavaScript API
24+
25+
* Export the `NodePackageImporter` class in ESM mode.
26+
27+
* Allow `NodePackageImporter` to locate a default directory even when the
28+
entrypoint is an ESM module.
29+
30+
### Dart API
31+
32+
* Make passing a null argument to `NodePackageImporter()` a static error rather
33+
than just a runtime error.
34+
35+
### Embedded Sass
36+
37+
* In the JS Embedded Host, properly install the musl Linux embedded compiler
38+
when running on musl Linux.
39+
40+
## 1.71.0
41+
42+
For more information about `pkg:` importers, see [the
43+
announcement][pkg-importers] on the Sass blog.
44+
45+
[pkg-importers]: https://sass-lang.com/blog/announcing-pkg-importers
46+
47+
### Command-Line Interface
48+
49+
* Add a `--pkg-importer` flag to enable built-in `pkg:` importers. Currently
50+
this only supports the Node.js package resolution algorithm, via
51+
`--pkg-importer=node`. For example, `@use "pkg:bootstrap"` will load
52+
`node_modules/bootstrap/scss/bootstrap.scss`.
53+
54+
### JavaScript API
55+
56+
* Add a `NodePackageImporter` importer that can be passed to the `importers`
57+
option. This loads files using the `pkg:` URL scheme according to the Node.js
58+
package resolution algorithm. For example, `@use "pkg:bootstrap"` will load
59+
`node_modules/bootstrap/scss/bootstrap.scss`. The constructor takes a single
60+
optional argument, which indicates the base directory to use when locating
61+
`node_modules` directories. It defaults to
62+
`path.dirname(require.main.filename)`.
63+
64+
### Dart API
65+
66+
* Add a `NodePackageImporter` importer that can be passed to the `importers`
67+
option. This loads files using the `pkg:` URL scheme according to the Node.js
68+
package resolution algorithm. For example, `@use "pkg:bootstrap"` will load
69+
`node_modules/bootstrap/scss/bootstrap.scss`. The constructor takes a single
70+
argument, which indicates the base directory to use when locating
71+
`node_modules` directories.
72+
73+
## 1.70.0
74+
75+
### JavaScript API
76+
77+
* Add a `sass.initCompiler()` function that returns a `sass.Compiler` object
78+
which supports `compile()` and `compileString()` methods with the same API as
79+
the global Sass object. On the Node.js embedded host, each `sass.Compiler`
80+
object uses a single long-lived subprocess, making compiling multiple
81+
stylesheets much more efficient.
82+
83+
* Add a `sass.initAsyncCompiler()` function that returns a `sass.AsyncCompiler`
84+
object which supports `compileAsync()` and `compileStringAsync()` methods with
85+
the same API as the global Sass object. On the Node.js embedded host, each
86+
`sass.AsynCompiler` object uses a single long-lived subprocess, making
87+
compiling multiple stylesheets much more efficient.
88+
89+
### Embedded Sass
90+
91+
* Support the `CompileRequest.silent` field. This allows compilations with no
92+
logging to avoid unnecessary request/response cycles.
93+
94+
* The Dart Sass embedded compiler now reports its name as "dart-sass" rather
95+
than "Dart Sass", to match the JS API's `info` field.
96+
97+
## 1.69.7
98+
99+
### Embedded Sass
100+
101+
* In the JS Embedded Host, properly install the x64 Dart Sass executable on
102+
ARM64 Windows.
103+
104+
## 1.69.6
105+
106+
* Produce better output for numbers with complex units in `meta.inspect()` and
107+
debugging messages.
108+
109+
* Escape U+007F DELETE when serializing strings.
110+
111+
* When generating CSS error messages to display in-browser, escape all code
112+
points that aren't in the US-ASCII region. Previously only code points U+0100
113+
LATIN CAPITAL LETTER A WITH MACRON were escaped.
114+
115+
* Provide official releases for musl LibC and for Android.
116+
117+
* Don't crash when running `meta.apply()` in asynchronous mode.
118+
119+
### JS API
120+
121+
* Fix a bug where certain exceptions could produce `SourceSpan`s that didn't
122+
follow the documented `SourceSpan` API.
123+
1124
## 1.69.5
2125

3126
### JS API

lib/index.mjs

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@ export const compile = sass.compile;
44
export const compileAsync = sass.compileAsync;
55
export const compileString = sass.compileString;
66
export const compileStringAsync = sass.compileStringAsync;
7+
export const NodePackageImporter = sass.NodePackageImporter;
8+
export const AsyncCompiler = sass.AsyncCompiler;
9+
export const Compiler = sass.Compiler;
10+
export const initAsyncCompiler = sass.initAsyncCompiler;
11+
export const initCompiler = sass.initCompiler;
712
export const Logger = sass.Logger;
8-
export const CalculationInterpolation = sass.CalculationInterpolation
9-
export const CalculationOperation = sass.CalculationOperation
10-
export const CalculationOperator = sass.CalculationOperator
13+
export const CalculationInterpolation = sass.CalculationInterpolation;
14+
export const CalculationOperation = sass.CalculationOperation;
15+
export const CalculationOperator = sass.CalculationOperator;
1116
export const SassArgumentList = sass.SassArgumentList;
1217
export const SassBoolean = sass.SassBoolean;
13-
export const SassCalculation = sass.SassCalculation
18+
export const SassCalculation = sass.SassCalculation;
1419
export const SassColor = sass.SassColor;
1520
export const SassFunction = sass.SassFunction;
1621
export const SassMixin = sass.SassMixin;
@@ -39,8 +44,9 @@ function defaultExportDeprecation() {
3944
if (printedDefaultExportDeprecation) return;
4045
printedDefaultExportDeprecation = true;
4146
console.error(
42-
"`import sass from 'sass'` is deprecated.\n" +
43-
"Please use `import * as sass from 'sass'` instead.");
47+
"`import sass from 'sass'` is deprecated.\n" +
48+
"Please use `import * as sass from 'sass'` instead."
49+
);
4450
}
4551

4652
export default {
@@ -60,6 +66,26 @@ export default {
6066
defaultExportDeprecation();
6167
return sass.compileStringAsync;
6268
},
69+
get NodePackageImporter() {
70+
defaultExportDeprecation();
71+
return sass.NodePackageImporter;
72+
},
73+
get initAsyncCompiler() {
74+
defaultExportDeprecation();
75+
return sass.initAsyncCompiler;
76+
},
77+
get initCompiler() {
78+
defaultExportDeprecation();
79+
return sass.initCompiler;
80+
},
81+
get AsyncCompiler() {
82+
defaultExportDeprecation();
83+
return sass.AsyncCompiler;
84+
},
85+
get Compiler() {
86+
defaultExportDeprecation();
87+
return sass.Compiler;
88+
},
6389
get Logger() {
6490
defaultExportDeprecation();
6591
return sass.Logger;

lib/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ export {
3131
compileString,
3232
compileAsync,
3333
compileStringAsync,
34+
NodePackageImporter,
3435
} from './src/compile';
36+
export {initAsyncCompiler, AsyncCompiler} from './src/compiler/async';
37+
export {initCompiler, Compiler} from './src/compiler/sync';
3538
export {render, renderSync} from './src/legacy';
3639

3740
export const info = `sass-embedded\t${pkg.version}`;
3841

39-
export const Logger = {
40-
silent: {warn() {}, debug() {}},
41-
};
42+
export {Logger} from './src/logger';
4243

4344
// Legacy JS API
4445

lib/src/async-compiler.ts

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

0 commit comments

Comments
 (0)