Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main into feature.color-4 #277

Merged
merged 25 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5789e93
Add semicolons and remove duplicate TS config
jgerigmeyer Dec 15, 2023
d3a6124
Test against Node20, remove Node14.
jgerigmeyer Dec 15, 2023
6520839
update package.json
jgerigmeyer Dec 15, 2023
5352c67
Work around recent breaking change in Node
jgerigmeyer Dec 15, 2023
342887d
Specify node versions a la https://github.com/sass/sass-spec/pull/1957
jgerigmeyer Dec 15, 2023
34bb27e
update actions
jgerigmeyer Dec 15, 2023
f9a28ed
add comment
jgerigmeyer Dec 15, 2023
7c0f559
Merge pull request #264 from oddbird/lint
jgerigmeyer Dec 15, 2023
b52c9b0
Support musl-libc and android (#265)
ntkme Dec 18, 2023
5d97b33
Update Dart Sass version and release
sassbot Dec 29, 2023
4e43248
Look for x64 version on arm64 windows (#266)
chadlwilson Jan 2, 2024
ad6f671
Update Dart Sass version and release
sassbot Jan 2, 2024
728c8fe
Support CompileRequest.silent of embedded protocol (#270)
ntkme Jan 16, 2024
91f382f
[Shared Resources] Embedded host implementation (#261)
jerivas Jan 18, 2024
e3f8462
Update Dart Sass version and release
sassbot Jan 18, 2024
5e2abf5
[Package Importer] Embedded Host (#260)
jamesnw Feb 6, 2024
6944074
Update Dart Sass version and release
sassbot Feb 16, 2024
32a8dfe
Update for cli_pkg 2.8.0 (#272)
ntkme Feb 20, 2024
e6be3a3
Use `process.argv[1]` as a fallback for `new NodePackageImporter()` (…
nex3 Feb 21, 2024
02db735
Update Dart Sass version and release
sassbot Feb 21, 2024
04adc79
Update Dart Sass version and release
sassbot Mar 13, 2024
03934e2
Use native windows-arm64 dart-sass binary (#276)
ntkme Mar 20, 2024
c19bf85
Merge branch 'main' of github.com:sass/embedded-host-node into merge-…
nex3 Mar 27, 2024
00524d8
Update colorjs.io
nex3 Mar 27, 2024
6cdf30a
Reformat
nex3 Mar 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 16 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ defaults:

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

on:
push:
Expand All @@ -19,10 +18,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
node-version: 'lts/*'
check-latest: true

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

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
check-latest: true
Expand All @@ -73,9 +72,6 @@ jobs:
- run: npm run compile
- run: node test/after-compile-test.mjs

# The versions should be kept up-to-date with the latest LTS Node releases.
# They next need to be rotated October 2021. See
# https://github.com/nodejs/Release.
sass_spec:
name: 'JS API Tests | Node ${{ matrix.node_version }} | ${{ matrix.os }}'
runs-on: ${{ matrix.os }}-latest
Expand All @@ -84,17 +80,19 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
node_version: [18]
node_version: ['lts/*']
include:
# Include LTS versions on Ubuntu
- os: ubuntu
node_version: 16
node_version: lts/-1
- os: ubuntu
node_version: lts/-2

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with: {sdk: stable}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with: {node-version: "${{ matrix.node_version }}"}

- name: Check out Dart Sass
Expand Down Expand Up @@ -142,10 +140,10 @@ jobs:
needs: [static_analysis, tests, sass_spec]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
node-version: 'lts/*'
check-latest: true
registry-url: 'https://registry.npmjs.org'
- run: npm install
Expand All @@ -159,9 +157,7 @@ jobs:
env:
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
run: |
for pkg in linux-arm linux-arm64 linux-ia32 linux-x64 darwin-arm64 darwin-x64 win32-ia32 win32-x64; do
npx ts-node ./tool/prepare-optional-release.ts --package=$pkg && npm publish ./npm/$pkg
done
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' --

- run: npm publish
env:
Expand Down
123 changes: 123 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,126 @@
## 1.72.0

* Support adjacent `/`s without whitespace in between when parsing plain CSS
expressions.

* Allow the Node.js `pkg:` importer to load Sass stylesheets for `package.json`
`exports` field entries without extensions.

* When printing suggestions for variables, use underscores in variable names
when the original usage used underscores.

### JavaScript API

* Properly resolve `pkg:` imports with the Node.js package importer when
arguments are passed to the JavaScript process.

## 1.71.1

### Command-Line Interface

* Ship the musl Linux release with the proper Dart executable.

### JavaScript API

* Export the `NodePackageImporter` class in ESM mode.

* Allow `NodePackageImporter` to locate a default directory even when the
entrypoint is an ESM module.

### Dart API

* Make passing a null argument to `NodePackageImporter()` a static error rather
than just a runtime error.

### Embedded Sass

* In the JS Embedded Host, properly install the musl Linux embedded compiler
when running on musl Linux.

## 1.71.0

For more information about `pkg:` importers, see [the
announcement][pkg-importers] on the Sass blog.

[pkg-importers]: https://sass-lang.com/blog/announcing-pkg-importers

### Command-Line Interface

* Add a `--pkg-importer` flag to enable built-in `pkg:` importers. Currently
this only supports the Node.js package resolution algorithm, via
`--pkg-importer=node`. For example, `@use "pkg:bootstrap"` will load
`node_modules/bootstrap/scss/bootstrap.scss`.

### JavaScript API

* Add a `NodePackageImporter` importer that can be passed to the `importers`
option. This loads files using the `pkg:` URL scheme according to the Node.js
package resolution algorithm. For example, `@use "pkg:bootstrap"` will load
`node_modules/bootstrap/scss/bootstrap.scss`. The constructor takes a single
optional argument, which indicates the base directory to use when locating
`node_modules` directories. It defaults to
`path.dirname(require.main.filename)`.

### Dart API

* Add a `NodePackageImporter` importer that can be passed to the `importers`
option. This loads files using the `pkg:` URL scheme according to the Node.js
package resolution algorithm. For example, `@use "pkg:bootstrap"` will load
`node_modules/bootstrap/scss/bootstrap.scss`. The constructor takes a single
argument, which indicates the base directory to use when locating
`node_modules` directories.

## 1.70.0

### JavaScript API

* Add a `sass.initCompiler()` function that returns a `sass.Compiler` object
which supports `compile()` and `compileString()` methods with the same API as
the global Sass object. On the Node.js embedded host, each `sass.Compiler`
object uses a single long-lived subprocess, making compiling multiple
stylesheets much more efficient.

* Add a `sass.initAsyncCompiler()` function that returns a `sass.AsyncCompiler`
object which supports `compileAsync()` and `compileStringAsync()` methods with
the same API as the global Sass object. On the Node.js embedded host, each
`sass.AsynCompiler` object uses a single long-lived subprocess, making
compiling multiple stylesheets much more efficient.

### Embedded Sass

* Support the `CompileRequest.silent` field. This allows compilations with no
logging to avoid unnecessary request/response cycles.

* The Dart Sass embedded compiler now reports its name as "dart-sass" rather
than "Dart Sass", to match the JS API's `info` field.

## 1.69.7

### Embedded Sass

* In the JS Embedded Host, properly install the x64 Dart Sass executable on
ARM64 Windows.

## 1.69.6

* Produce better output for numbers with complex units in `meta.inspect()` and
debugging messages.

* Escape U+007F DELETE when serializing strings.

* When generating CSS error messages to display in-browser, escape all code
points that aren't in the US-ASCII region. Previously only code points U+0100
LATIN CAPITAL LETTER A WITH MACRON were escaped.

* Provide official releases for musl LibC and for Android.

* Don't crash when running `meta.apply()` in asynchronous mode.

### JS API

* Fix a bug where certain exceptions could produce `SourceSpan`s that didn't
follow the documented `SourceSpan` API.

## 1.69.5

### JS API
Expand Down
38 changes: 32 additions & 6 deletions lib/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ export const compile = sass.compile;
export const compileAsync = sass.compileAsync;
export const compileString = sass.compileString;
export const compileStringAsync = sass.compileStringAsync;
export const NodePackageImporter = sass.NodePackageImporter;
export const AsyncCompiler = sass.AsyncCompiler;
export const Compiler = sass.Compiler;
export const initAsyncCompiler = sass.initAsyncCompiler;
export const initCompiler = sass.initCompiler;
export const Logger = sass.Logger;
export const CalculationInterpolation = sass.CalculationInterpolation
export const CalculationOperation = sass.CalculationOperation
export const CalculationOperator = sass.CalculationOperator
export const CalculationInterpolation = sass.CalculationInterpolation;
export const CalculationOperation = sass.CalculationOperation;
export const CalculationOperator = sass.CalculationOperator;
export const SassArgumentList = sass.SassArgumentList;
export const SassBoolean = sass.SassBoolean;
export const SassCalculation = sass.SassCalculation
export const SassCalculation = sass.SassCalculation;
export const SassColor = sass.SassColor;
export const SassFunction = sass.SassFunction;
export const SassMixin = sass.SassMixin;
Expand Down Expand Up @@ -39,8 +44,9 @@ function defaultExportDeprecation() {
if (printedDefaultExportDeprecation) return;
printedDefaultExportDeprecation = true;
console.error(
"`import sass from 'sass'` is deprecated.\n" +
"Please use `import * as sass from 'sass'` instead.");
"`import sass from 'sass'` is deprecated.\n" +
"Please use `import * as sass from 'sass'` instead."
);
}

export default {
Expand All @@ -60,6 +66,26 @@ export default {
defaultExportDeprecation();
return sass.compileStringAsync;
},
get NodePackageImporter() {
defaultExportDeprecation();
return sass.NodePackageImporter;
},
get initAsyncCompiler() {
defaultExportDeprecation();
return sass.initAsyncCompiler;
},
get initCompiler() {
defaultExportDeprecation();
return sass.initCompiler;
},
get AsyncCompiler() {
defaultExportDeprecation();
return sass.AsyncCompiler;
},
get Compiler() {
defaultExportDeprecation();
return sass.Compiler;
},
get Logger() {
defaultExportDeprecation();
return sass.Logger;
Expand Down
7 changes: 4 additions & 3 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ export {
compileString,
compileAsync,
compileStringAsync,
NodePackageImporter,
} from './src/compile';
export {initAsyncCompiler, AsyncCompiler} from './src/compiler/async';
export {initCompiler, Compiler} from './src/compiler/sync';
export {render, renderSync} from './src/legacy';

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

export const Logger = {
silent: {warn() {}, debug() {}},
};
export {Logger} from './src/logger';

// Legacy JS API

Expand Down
47 changes: 0 additions & 47 deletions lib/src/async-compiler.ts

This file was deleted.

Loading
Loading