Skip to content

Commit

Permalink
chore: update all
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarepiedady committed Mar 13, 2024
1 parent 08f091d commit 6bd9847
Show file tree
Hide file tree
Showing 75 changed files with 7,768 additions and 7,828 deletions.
4 changes: 0 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ merge of your pull request!

**Why**:

<!-- How were these changes implemented? -->

**How**:

<!-- Have you done all of these things? -->

**Checklist**:
Expand Down
54 changes: 37 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ on:

jobs:
node_tests:
name: 'Test stylus on ${{matrix.os}} with node16'
name: 'Test stylus on ${{matrix.os}} with node20'
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
# Pull repo to test machine
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# Configures the node version used on GitHub-hosted runners
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
# The Node.js version to configure
node-version: '16'
node-version: '20'
- name: Install npm dependencies
run: npm install
- name: Print node & npm version
Expand All @@ -36,11 +36,11 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [10, 12, 14, 18]
node: [14, 16, 18, 21]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install npm dependencies
Expand All @@ -51,13 +51,13 @@ jobs:
run: npm run test

benchmark:
name: 'Run stylus benchmark with node18'
name: 'Run stylus benchmark with node20'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
- name: Install npm dependencies
run: npm install
- name: Print put node & npm version
Expand All @@ -69,10 +69,10 @@ jobs:
name: 'yarn exec stylus regression test'
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
- name: Print put node & npm version
run: node --version && npm --version
- name: Install yarn global
Expand All @@ -86,13 +86,33 @@ jobs:
name: 'Run nyc for code coverage'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
- name: Print put node & npm version
run: node --version && npm --version
- name: Install npm dependencies
run: npm install
- name: Run nyc
run: npx nyc@latest npm run test

deno_tests:
name: 'Test stylus on ${{matrix.os}} with latest stable deno'
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
# Pull repo to test machine
- uses: actions/checkout@v4
# Configures the deno version used on GitHub-hosted runners
- uses: denoland/setup-deno@v1
with:
# Run with latest stable Deno
deno-version: v1.x
- name: Print deno version
# Output useful info for debugging.
run: deno --version
- name: Run Test
run: deno run -A deno/test.ts
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Makefile

bm.js

deno/
docs/
.github/
.idea/
Expand Down
17 changes: 17 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
0.63.0 / 2024-03-05
===================
* update vulnerable dependency [#2861](https://github.com/stylus/stylus/pull/2861)

0.62.0 / 2023-11-18
===================
* fix: super call regression [#2843](https://github.com/stylus/stylus/pull/2843)

0.61.0 / 2023-11-04
===================
* chore: drop support for NodeJS 10 and 12 [#2834](https://github.com/stylus/stylus/pull/2834)
* fix: fix [CVE-2023-26364](https://github.com/advisories/GHSA-hpx4-r86g-5jrg)

0.60.0 / 2023-08-30
===================
* feat: support [deno](https://deno.com) [#2813](https://github.com/stylus/stylus/pull/2813)

0.59.0 / 2022-08-13
===================
* deps: switching from css to @adobe/css-tools [#2709](https://github.com/stylus/stylus/pull/2709)
Expand Down
4 changes: 0 additions & 4 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ You can sponsor stylus ongoing development via [opencollective](https://opencoll
<p style="font-size: 30px">Your Logo</p>
</td>
<td width="50%" align="center">
<a href="http://opencollective.com/stylus/">
<img alt="opencollective stylus" src="https://opencollective.com/webpack/donate/[email protected]?color=blue" />
</a>
or
<a href="https://www.paypal.com/paypalme/iChenLei/">
<img alt="Paypal stylus" src="https://www.paypalobjects.com/digitalassets/c/website/marketing/apac/C2/logos-buttons/optimize/Full_Online_Tray_RGB.png" />
</a>
Expand Down
33 changes: 33 additions & 0 deletions deno/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import Mocha from "mocha";

import fs from "node:fs";
import path from "node:path";
import process from "node:process";

globalThis.process = process;

const mocha = new Mocha({
bail: true,
checkLeaks: true,
require: ["chai"],
reporter: "dot",
});

const testDirs = ["test/", "test/middleware/"];

testDirs.forEach((testDir) => {
fs
.readdirSync(testDir)
.filter(function (file) {
if (testDir === "test/" && file === "deno.js") return false;

return file.slice(-3) === ".js";
})
.forEach(function (file) {
mocha.addFile(path.join(testDir, file));
});
});

mocha.run(function (failures) {
process.exitCode = failures ? 1 : 0;
});
4 changes: 3 additions & 1 deletion docs/docs/js.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ stylus(str)
});
```

## .define(name, node)
## .define(name, node[, raw])

By passing a `Node`, we may define a global variable. This is useful when exposing conditional features within your library depending on the availability of another. For example the **Nib** extension library conditionally supports node-canvas, providing image generation.

Expand All @@ -89,6 +89,8 @@ Stylus also casts JavaScript values to their Stylus equivalents when possible. H
.define('families', ['Helvetica Neue', 'Helvetica', 'sans-serif'])
```

Note: In default, The JavaScript object variable will coerce to a tuple-array-like expression. For example `{ foo: 'bar', bar: 'baz' }` would become the expression `(foo 'bar') (bar 'baz')`. If you want to get a [hash object](https://stylus-lang.com/docs/hashes.html) return, please set `raw` to `true`.

These same rules apply to return values in js functions as well:

```js
Expand Down
16 changes: 8 additions & 8 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ layout: home
sidebar: false

title: Stylus
titleTemplate: An expressive, robust, feature-rich CSS language built for nodejs
titleTemplate: An expressive, robust, feature-rich CSS language built for Node.js

hero:
name: Stylus
text: Expressive, dynamic and robust CSSs
tagline: An expressive, robust, feature-rich CSS language built for nodejs
text: Expressive, dynamic, and robust CSS
tagline: An expressive, robust, feature-rich CSS language built for Node.js
image:
src: /logo.svg
alt: Stylus
Expand All @@ -27,12 +27,12 @@ hero:
link: https://github.com/stylus/stylus

features:
- title: Born for Nodejs
details: TJ create this project for nodejs ecosystem since 2010
- title: Born for Node.js
details: TJ created this project for the Node.js Ecosystem in 2010
- title: CSS Compatible
details: Don't like indented syntax ? ok, it's optional! You can write stylus like css-style without pain
details: Don't like indented syntax? OK, it's optional! You can write Stylus like CSS without the pain
- title: IDE support
details: Both VSCode (with stylus extension) and WebStorm (builtin) support stylus development
details: Both VSCode (with Stylus extension) and WebStorm (built in) support Stylus development
- title: All optional
details: braces, semi-colons and more can be omit in your code, keep clean and less
details: Braces, semi-colons, and more can be omitted from your code to keep it clean and smaller
---
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"esno": "^0.16.3",
"fast-glob": "^3.2.11",
"https-localhost": "^4.7.1",
"unocss": "^0.36.0",
"unplugin-vue-components": "^0.19.6",
"unocss": "^0.52.7",
"unplugin-vue-components": "^0.25.0",
"vite-plugin-pwa": "^0.12.0",
"vitepress": "^1.0.0-alpha.1",
"workbox-window": "^6.5.3"
Expand Down
122 changes: 63 additions & 59 deletions lib/cache/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,73 +8,77 @@ var crypto = require('crypto')
, version = require('../../package').version
, nodes = require('../nodes');

var FSCache = module.exports = function(options) {
options = options || {};
this._location = options['cache location'] || '.styl-cache';
if (!fs.existsSync(this._location)) fs.mkdirSync(this._location);
};
module.exports = class FSCache {
constructor(options) {
options = options || {};
this._location = options['cache location'] || '.styl-cache';
if (!fs.existsSync(this._location)) fs.mkdirSync(this._location);
}

/**
* Set cache item with given `key` to `value`.
*
* @param {String} key
* @param {Object} value
* @api private
*/

FSCache.prototype.set = function(key, value) {
fs.writeFileSync(join(this._location, key), JSON.stringify(value));
};
/**
* Set cache item with given `key` to `value`.
*
* @param {String} key
* @param {Object} value
* @api private
*/

/**
* Get cache item with given `key`.
*
* @param {String} key
* @return {Object}
* @api private
*/
set(key, value) {
fs.writeFileSync(join(this._location, key), JSON.stringify(value));
};

FSCache.prototype.get = function(key) {
var data = fs.readFileSync(join(this._location, key), 'utf-8');
return JSON.parse(data, FSCache.fromJSON);
};
/**
* Get cache item with given `key`.
*
* @param {String} key
* @return {Object}
* @api private
*/

/**
* Check if cache has given `key`.
*
* @param {String} key
* @return {Boolean}
* @api private
*/
get(key) {
var data = fs.readFileSync(join(this._location, key), 'utf-8');
return JSON.parse(data, FSCache.fromJSON);
};

FSCache.prototype.has = function(key) {
return fs.existsSync(join(this._location, key));
};
/**
* Check if cache has given `key`.
*
* @param {String} key
* @return {Boolean}
* @api private
*/

/**
* Generate key for the source `str` with `options`.
*
* @param {String} str
* @param {Object} options
* @return {String}
* @api private
*/
has(key) {
return fs.existsSync(join(this._location, key));
};

FSCache.prototype.key = function(str, options) {
var hash = crypto.createHash('sha1');
hash.update(str + version + options.prefix);
return hash.digest('hex');
};
/**
* Generate key for the source `str` with `options`.
*
* @param {String} str
* @param {Object} options
* @return {String}
* @api private
*/

/**
* JSON to Stylus nodes converter.
*
* @api private
*/
key(str, options) {
var hash = crypto.createHash('sha1');
hash.update(str + version + options.prefix);
return hash.digest('hex');
};

/**
* JSON to Stylus nodes converter.
*
* @api private
*/

static fromJSON(key, val) {
if (val && val.__type) {
Object.setPrototypeOf(val, nodes[val.__type].prototype);
}
return val;
};

FSCache.fromJSON = function(key, val) {
if (val && val.__type) {
val.__proto__ = nodes[val.__type].prototype;
}
return val;
};
Loading

0 comments on commit 6bd9847

Please sign in to comment.