@jesscss/plugin-scss 2.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +35 -0
- package/lib/index.cjs +54 -0
- package/lib/index.d.ts +35 -0
- package/lib/index.js +49 -0
- package/package.json +47 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Matthew Dean
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @jesscss/plugin-scss
|
|
2
|
+
|
|
3
|
+
**The SCSS language engine for Jess — the experimental base that seeds
|
|
4
|
+
"Sass+".**
|
|
5
|
+
|
|
6
|
+
This plugin layers an SCSS grammar (`@jesscss/scss-parser`) onto the Jess
|
|
7
|
+
compiler, the same way [`@jesscss/plugin-less`](../jess-plugin-less) provides the
|
|
8
|
+
Less engine. It parses `.scss` into the Jess AST for the engine to evaluate and
|
|
9
|
+
emit.
|
|
10
|
+
|
|
11
|
+
## Roadmap status — experimental, not the alpha focus
|
|
12
|
+
|
|
13
|
+
Jess's language is an **ordered progression: Now Less.js → Next "Sass+" →
|
|
14
|
+
Final `.jess`.** Only Less.js is shipping today.
|
|
15
|
+
|
|
16
|
+
`plugin-scss` sits at the **"Next"** milestone. It is the experimental base for
|
|
17
|
+
**Sass+** — the intended Sass successor, a dialect that fixes and extends
|
|
18
|
+
Sass-style ergonomics — but Sass+ itself is **not shipped**, and SCSS support is
|
|
19
|
+
**not a goal of the current Less-focused alpha.** Expect gaps and breaking
|
|
20
|
+
changes. If you need production Sass today, use Sass.
|
|
21
|
+
|
|
22
|
+
What exists now is the SCSS parser plus this plugin wiring; the Sass+ dialect,
|
|
23
|
+
semantics, and defaults are still being designed. Treat anything here as a
|
|
24
|
+
preview, not a promise.
|
|
25
|
+
|
|
26
|
+
## Status
|
|
27
|
+
|
|
28
|
+
**Alpha / experimental.** Part of [Jess](https://github.com/jesscss/jess). The
|
|
29
|
+
programmatic plugin/compiler API is **not yet stabilized** — the `jess` CLI is
|
|
30
|
+
the documented public surface for the alpha, and it targets Less today.
|
|
31
|
+
|
|
32
|
+
- Project overview & positioning: <https://github.com/jesscss/jess#readme>
|
|
33
|
+
- Docs: <https://jesscss.github.io/> (currently pre-alpha content)
|
|
34
|
+
- Issues: <https://github.com/jesscss/jess/issues>
|
|
35
|
+
- License: MIT
|
package/lib/index.cjs
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
let _jesscss_core = require("@jesscss/core");
|
|
6
|
+
let _jesscss_fns_sass_registry = require("@jesscss/fns/sass/registry");
|
|
7
|
+
let _jesscss_scss_parser = require("@jesscss/scss-parser");
|
|
8
|
+
let _jesscss_style_resolver = require("@jesscss/style-resolver");
|
|
9
|
+
//#region src/index.ts
|
|
10
|
+
const sassValueEvaluator = (0, _jesscss_core.buildEvaluator)((0, _jesscss_fns_sass_registry.makeSassRegistry)());
|
|
11
|
+
var ScssPlugin = class extends _jesscss_core.AbstractPlugin {
|
|
12
|
+
name = "scss";
|
|
13
|
+
supportedExtensions = [".scss"];
|
|
14
|
+
unitMode;
|
|
15
|
+
equalityMode;
|
|
16
|
+
constructor(opts = {}) {
|
|
17
|
+
super();
|
|
18
|
+
this.opts = opts;
|
|
19
|
+
this.unitMode = opts.unitMode ?? "preserve";
|
|
20
|
+
this.equalityMode = opts.equalityMode ?? "sass";
|
|
21
|
+
}
|
|
22
|
+
expandImport(importPath) {
|
|
23
|
+
return (0, _jesscss_style_resolver.expandScssImportCandidates)(importPath);
|
|
24
|
+
}
|
|
25
|
+
setContext(context) {
|
|
26
|
+
if (context.documentContext?.plugin !== this) return;
|
|
27
|
+
if (context.opts.unitMode === void 0) context.setOption("unitMode", this.unitMode);
|
|
28
|
+
if (context.opts.equalityMode === void 0) context.setOption("equalityMode", this.equalityMode);
|
|
29
|
+
context.registerValueEvaluator(sassValueEvaluator);
|
|
30
|
+
}
|
|
31
|
+
safeParse(filePath, source) {
|
|
32
|
+
try {
|
|
33
|
+
return {
|
|
34
|
+
document: (0, _jesscss_scss_parser.parse)(source),
|
|
35
|
+
errors: [],
|
|
36
|
+
warnings: []
|
|
37
|
+
};
|
|
38
|
+
} catch (error) {
|
|
39
|
+
return {
|
|
40
|
+
errors: [(0, _jesscss_core.parserDiagnostic)({
|
|
41
|
+
dialect: "SCSS",
|
|
42
|
+
error,
|
|
43
|
+
filePath,
|
|
44
|
+
source
|
|
45
|
+
})],
|
|
46
|
+
warnings: []
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const scssPlugin = ((opts) => new ScssPlugin(opts));
|
|
52
|
+
//#endregion
|
|
53
|
+
exports.ScssPlugin = ScssPlugin;
|
|
54
|
+
exports.default = scssPlugin;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AbstractPlugin, type ISafeParseResult, type EqualityMode, type UnitMode, type Context } from '@jesscss/core';
|
|
2
|
+
export type ScssPluginOptions = {
|
|
3
|
+
allowExtendSelectors?: ExtendSelectorKind[];
|
|
4
|
+
/**
|
|
5
|
+
* Compatibility input retained on this frontend's option object. The shared
|
|
6
|
+
* evaluator reads the resolved Context compile/input option; configuring a
|
|
7
|
+
* Compiler should use `compile.unitMode` or matched input options.
|
|
8
|
+
*/
|
|
9
|
+
unitMode?: UnitMode;
|
|
10
|
+
/**
|
|
11
|
+
* Compatibility input retained on this frontend's option object. It does not
|
|
12
|
+
* select a separate SCSS evaluator; configure the shared evaluator through
|
|
13
|
+
* Context compile/input options.
|
|
14
|
+
*/
|
|
15
|
+
equalityMode?: EqualityMode;
|
|
16
|
+
/**
|
|
17
|
+
* Whether to collapse nested selectors (flatten nesting during print).
|
|
18
|
+
* This is a Jess output option, not a Sass option.
|
|
19
|
+
*/
|
|
20
|
+
collapseNesting?: boolean;
|
|
21
|
+
};
|
|
22
|
+
type ExtendSelectorKind = 'simple' | 'basic' | 'pseudo' | 'complex' | 'compound';
|
|
23
|
+
export declare class ScssPlugin extends AbstractPlugin {
|
|
24
|
+
opts: ScssPluginOptions;
|
|
25
|
+
name: string;
|
|
26
|
+
supportedExtensions: string[];
|
|
27
|
+
unitMode: UnitMode;
|
|
28
|
+
equalityMode: EqualityMode;
|
|
29
|
+
constructor(opts?: ScssPluginOptions);
|
|
30
|
+
expandImport(importPath: string): string[];
|
|
31
|
+
setContext(context: Context): void;
|
|
32
|
+
safeParse(filePath: string, source: string): ISafeParseResult;
|
|
33
|
+
}
|
|
34
|
+
declare const scssPlugin: (opts?: ScssPluginOptions) => ScssPlugin;
|
|
35
|
+
export default scssPlugin;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { AbstractPlugin, buildEvaluator, parserDiagnostic } from "@jesscss/core";
|
|
2
|
+
import { makeSassRegistry } from "@jesscss/fns/sass/registry";
|
|
3
|
+
import { parse } from "@jesscss/scss-parser";
|
|
4
|
+
import { expandScssImportCandidates } from "@jesscss/style-resolver";
|
|
5
|
+
//#region src/index.ts
|
|
6
|
+
const sassValueEvaluator = buildEvaluator(makeSassRegistry());
|
|
7
|
+
var ScssPlugin = class extends AbstractPlugin {
|
|
8
|
+
name = "scss";
|
|
9
|
+
supportedExtensions = [".scss"];
|
|
10
|
+
unitMode;
|
|
11
|
+
equalityMode;
|
|
12
|
+
constructor(opts = {}) {
|
|
13
|
+
super();
|
|
14
|
+
this.opts = opts;
|
|
15
|
+
this.unitMode = opts.unitMode ?? "preserve";
|
|
16
|
+
this.equalityMode = opts.equalityMode ?? "sass";
|
|
17
|
+
}
|
|
18
|
+
expandImport(importPath) {
|
|
19
|
+
return expandScssImportCandidates(importPath);
|
|
20
|
+
}
|
|
21
|
+
setContext(context) {
|
|
22
|
+
if (context.documentContext?.plugin !== this) return;
|
|
23
|
+
if (context.opts.unitMode === void 0) context.setOption("unitMode", this.unitMode);
|
|
24
|
+
if (context.opts.equalityMode === void 0) context.setOption("equalityMode", this.equalityMode);
|
|
25
|
+
context.registerValueEvaluator(sassValueEvaluator);
|
|
26
|
+
}
|
|
27
|
+
safeParse(filePath, source) {
|
|
28
|
+
try {
|
|
29
|
+
return {
|
|
30
|
+
document: parse(source),
|
|
31
|
+
errors: [],
|
|
32
|
+
warnings: []
|
|
33
|
+
};
|
|
34
|
+
} catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
errors: [parserDiagnostic({
|
|
37
|
+
dialect: "SCSS",
|
|
38
|
+
error,
|
|
39
|
+
filePath,
|
|
40
|
+
source
|
|
41
|
+
})],
|
|
42
|
+
warnings: []
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const scssPlugin = ((opts) => new ScssPlugin(opts));
|
|
48
|
+
//#endregion
|
|
49
|
+
export { ScssPlugin, scssPlugin as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jesscss/plugin-scss",
|
|
3
|
+
"publishConfig": {
|
|
4
|
+
"access": "public"
|
|
5
|
+
},
|
|
6
|
+
"description": "An SCSS stylesheet engine for Jess",
|
|
7
|
+
"version": "2.0.0-alpha.10",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
10
|
+
},
|
|
11
|
+
"main": "lib/index.cjs",
|
|
12
|
+
"types": "lib/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./lib/index.d.ts",
|
|
16
|
+
"import": "./lib/index.js",
|
|
17
|
+
"require": "./lib/index.cjs"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"lib"
|
|
23
|
+
],
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@jesscss/core": "2.0.0-alpha.10",
|
|
26
|
+
"@jesscss/fns": "2.0.0-alpha.10",
|
|
27
|
+
"@jesscss/scss-parser": "2.0.0-alpha.10",
|
|
28
|
+
"@jesscss/style-resolver": "2.0.0-alpha.10"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {},
|
|
31
|
+
"author": "Matthew Dean <matthew-dean@users.noreply.github.com>",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/jesscss/jess/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/jesscss/jess#readme",
|
|
37
|
+
"type": "module",
|
|
38
|
+
"module": "lib/index.js",
|
|
39
|
+
"scripts": {
|
|
40
|
+
"ci": "pnpm build && pnpm test",
|
|
41
|
+
"build": "pnpm compile",
|
|
42
|
+
"compile": "tsdown --tsconfig tsconfig.build.json --no-dts && tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
43
|
+
"test": "vitest --run --passWithNoTests",
|
|
44
|
+
"lint:fix": "eslint --fix '**/*.{js,ts}'",
|
|
45
|
+
"lint": "eslint '**/*.{js,ts}'"
|
|
46
|
+
}
|
|
47
|
+
}
|