@jesscss/style-resolver 2.0.0-alpha.6 → 2.0.0-alpha.8
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/README.md +43 -0
- package/package.json +2 -3
- package/lib/index.d.cts +0 -35
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @jesscss/style-resolver
|
|
2
|
+
|
|
3
|
+
**Stylesheet import resolution across CSS, Less, SCSS, and Jess — include paths,
|
|
4
|
+
load paths, and extension/index resolution.**
|
|
5
|
+
|
|
6
|
+
`@jesscss/style-resolver` is a building block for
|
|
7
|
+
[Jess](https://github.com/jesscss/jess) — Less.js v5, a ground-up rewrite of the
|
|
8
|
+
Less CSS preprocessor. Given a stylesheet's source and an import statement, it
|
|
9
|
+
figures out which file that import actually points to, applying each language's
|
|
10
|
+
lookup rules (Less and SCSS candidate expansion, partials, index files, search
|
|
11
|
+
paths).
|
|
12
|
+
|
|
13
|
+
It handles the mechanics of finding imports — extracting import statements from
|
|
14
|
+
source, expanding a bare import path into the ordered list of candidate files a
|
|
15
|
+
given language would try, and resolving that against a filesystem-like interface.
|
|
16
|
+
|
|
17
|
+
## Where it fits
|
|
18
|
+
|
|
19
|
+
Import resolution is a shared concern the compiler and tooling both need. It is
|
|
20
|
+
also one of the building blocks toward the broader module/scoping story on the
|
|
21
|
+
Jess roadmap (whose headline is the post-`.jess` minimal browser build) — but this
|
|
22
|
+
package is just the resolver, not that feature.
|
|
23
|
+
|
|
24
|
+
## Who uses it
|
|
25
|
+
|
|
26
|
+
This is an internal package. Most people should install
|
|
27
|
+
[`jess`](https://www.npmjs.com/package/jess) and use the `jess` / `lessc` CLIs.
|
|
28
|
+
The JavaScript/TypeScript API is **not yet stabilized** and is intentionally
|
|
29
|
+
undocumented for now.
|
|
30
|
+
|
|
31
|
+
## Status
|
|
32
|
+
|
|
33
|
+
Alpha. Published to npm under both the `latest` and `alpha` dist-tags. Please
|
|
34
|
+
[report bugs](https://github.com/jesscss/jess/issues).
|
|
35
|
+
|
|
36
|
+
## Links
|
|
37
|
+
|
|
38
|
+
- Repository: <https://github.com/jesscss/jess>
|
|
39
|
+
- Documentation: <https://jesscss.github.io/> (currently pre-alpha content)
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
[MIT](https://github.com/jesscss/jess/blob/dev/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jesscss/style-resolver",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.8",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./lib/index.d.ts",
|
|
13
|
-
"source": "./src/index.ts",
|
|
14
13
|
"import": "./lib/index.js",
|
|
15
14
|
"require": "./lib/index.cjs"
|
|
16
15
|
}
|
|
@@ -25,7 +24,7 @@
|
|
|
25
24
|
"module": "lib/index.js",
|
|
26
25
|
"scripts": {
|
|
27
26
|
"build": "pnpm compile",
|
|
28
|
-
"compile": "tsdown --tsconfig tsconfig.build.json && tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
27
|
+
"compile": "tsdown --tsconfig tsconfig.build.json --no-dts && tsc -p tsconfig.build.json --emitDeclarationOnly --noCheck",
|
|
29
28
|
"test": "vitest --watch=false",
|
|
30
29
|
"lint": "eslint '**/*.{js,ts}'"
|
|
31
30
|
}
|
package/lib/index.d.cts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
//#region src/index.d.ts
|
|
2
|
-
type StyleLang = 'css' | 'less' | 'scss' | 'jess';
|
|
3
|
-
type FsLike = {
|
|
4
|
-
exists(filePath: string): boolean;
|
|
5
|
-
};
|
|
6
|
-
type StylesConfig = {
|
|
7
|
-
/** Project root; used as an optional search base. */rootDir?: string; /** Less-style include paths. */
|
|
8
|
-
includePaths?: string[]; /** SCSS-style load paths. */
|
|
9
|
-
loadPaths?: string[];
|
|
10
|
-
};
|
|
11
|
-
type ImportStatement = {
|
|
12
|
-
lang: StyleLang;
|
|
13
|
-
specifier: string;
|
|
14
|
-
options?: string[];
|
|
15
|
-
specifierRange: {
|
|
16
|
-
startOffset: number;
|
|
17
|
-
endOffset: number;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
type ResolveResult = {
|
|
21
|
-
filePath: string;
|
|
22
|
-
resolvedBy: 'exact' | 'extension' | 'partial' | 'index' | 'loadPath';
|
|
23
|
-
};
|
|
24
|
-
type ResolveImportOptions = {
|
|
25
|
-
lang: StyleLang;
|
|
26
|
-
fromFilePath: string;
|
|
27
|
-
specifier: string;
|
|
28
|
-
config?: StylesConfig;
|
|
29
|
-
};
|
|
30
|
-
declare function extractImports(sourceText: string, lang: StyleLang): ImportStatement[];
|
|
31
|
-
declare function expandLessImportCandidates(importPath: string): string[];
|
|
32
|
-
declare function expandScssImportCandidates(importPath: string): string[];
|
|
33
|
-
declare function resolveImport(fs: FsLike, opts: ResolveImportOptions): ResolveResult | null;
|
|
34
|
-
//#endregion
|
|
35
|
-
export { FsLike, ImportStatement, ResolveImportOptions, ResolveResult, StyleLang, StylesConfig, expandLessImportCandidates, expandScssImportCandidates, extractImports, resolveImport };
|