@master/css-compiler 2.0.0-rc.73 → 2.0.0-rc.75
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/dist/browser.d.ts +23 -19
- package/dist/browser.js +42 -0
- package/dist/core.d.ts +43 -41
- package/dist/core.js +1639 -0
- package/dist/css-transform.d.ts +10 -6
- package/dist/css-transform.js +17 -0
- package/dist/diagnostics.d.ts +11 -0
- package/dist/diagnostics.js +12 -0
- package/dist/index.d.ts +41 -38
- package/dist/index.js +330 -0
- package/dist/lexer/imports.d.ts +16 -12
- package/dist/lexer/imports.js +38 -0
- package/dist/lexer/source.d.ts +6 -3
- package/dist/lexer/source.js +8 -0
- package/dist/lexer/standalone-master.d.ts +23 -19
- package/dist/lexer/standalone-master.js +219 -0
- package/dist/lower-css-directives.d.ts +18 -13
- package/dist/lower-css-directives.js +753 -0
- package/dist/master-css-manifest.d.ts +18 -12
- package/dist/master-css-manifest.js +546 -0
- package/dist/native-declaration.d.ts +6 -2
- package/dist/native-declaration.js +23 -0
- package/dist/utils/selectors.d.ts +6 -3
- package/dist/utils/selectors.js +49 -0
- package/dist/utils/unquote.d.ts +4 -1
- package/dist/utils/unquote.js +9 -0
- package/dist/utils/wrap-at-rules.d.ts +4 -1
- package/dist/utils/wrap-at-rules.js +11 -0
- package/package.json +69 -1
- package/dist/browser.mjs +0 -47
- package/dist/core.mjs +0 -2146
- package/dist/css-transform.mjs +0 -18
- package/dist/index.mjs +0 -395
- package/dist/lexer/imports.mjs +0 -44
- package/dist/lexer/source.mjs +0 -9
- package/dist/lexer/standalone-master.mjs +0 -233
- package/dist/lower-css-directives.mjs +0 -969
- package/dist/master-css-manifest.mjs +0 -760
- package/dist/native-declaration.mjs +0 -25
- package/dist/utils/selectors.mjs +0 -55
- package/dist/utils/unquote.mjs +0 -10
- package/dist/utils/wrap-at-rules.mjs +0 -10
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/utils/unquote.ts
|
|
2
|
+
function unquote(value) {
|
|
3
|
+
const trimmed = value.trim();
|
|
4
|
+
const quote = trimmed[0];
|
|
5
|
+
if ((quote === "\"" || quote === "'") && trimmed.endsWith(quote)) return trimmed.slice(1, -1).replace(/\\(["'\\])/g, "$1");
|
|
6
|
+
return trimmed;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { unquote as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/utils/wrap-at-rules.ts
|
|
2
|
+
function wrapAtRules(text, atRules) {
|
|
3
|
+
if (!atRules?.length) return text;
|
|
4
|
+
for (let index = atRules.length - 1; index >= 0; index--) {
|
|
5
|
+
const atRule = atRules[index]?.trim();
|
|
6
|
+
if (atRule) text = `${atRule}{${text}}`;
|
|
7
|
+
}
|
|
8
|
+
return text;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { wrapAtRules as default };
|
package/package.json
CHANGED
|
@@ -1 +1,69 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@master/css-compiler",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Compile Master CSS stylesheet directives",
|
|
6
|
+
"author": "Aoyue Design LLC.",
|
|
7
|
+
"funding": "https://rc.css.master.co/sponsor",
|
|
8
|
+
"homepage": "https://css.master.co",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/master-co/css/issues"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/master-co/css.git",
|
|
15
|
+
"directory": "packages/compiler"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"compiler",
|
|
19
|
+
"directives",
|
|
20
|
+
"css",
|
|
21
|
+
"mastercss"
|
|
22
|
+
],
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"module": "./dist/index.js",
|
|
26
|
+
"jsnext:main": "./dist/index.js",
|
|
27
|
+
"esnext": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"import": "./dist/index.js",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./browser": {
|
|
36
|
+
"types": "./dist/browser.d.ts",
|
|
37
|
+
"import": "./dist/browser.js",
|
|
38
|
+
"default": "./dist/browser.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"dist"
|
|
43
|
+
],
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public",
|
|
46
|
+
"provenance": true
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"css-tree": "^3.2.1",
|
|
50
|
+
"csstype": "^3.2.3",
|
|
51
|
+
"lightningcss": "^1.32.0",
|
|
52
|
+
"lightningcss-wasm": "^1.32.0",
|
|
53
|
+
"@master/css-lexer": "^2.0.0-rc.75",
|
|
54
|
+
"@master/css-schema": "^2.0.0-rc.75",
|
|
55
|
+
"@master/css-engine": "^2.0.0-rc.75"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@types/css-tree": "^2.3.11",
|
|
59
|
+
"@master/css-preset": "^2.0.0-rc.75"
|
|
60
|
+
},
|
|
61
|
+
"version": "2.0.0-rc.75",
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsdown --config ../../shared/tsdown-package.config.ts",
|
|
64
|
+
"dev": "tsdown --config ../../shared/tsdown-package.config.ts --watch",
|
|
65
|
+
"lint": "eslint",
|
|
66
|
+
"type-check": "tsc -b tsconfig.typecheck.json",
|
|
67
|
+
"test": "vitest"
|
|
68
|
+
}
|
|
69
|
+
}
|
package/dist/browser.mjs
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import init, { transform } from 'lightningcss-wasm';
|
|
2
|
-
import { compileCSS as compileCSS$1, parseDirectives as parseDirectives$1 } from './core.mjs';
|
|
3
|
-
import lowerCSSDirectives from './lower-css-directives.mjs';
|
|
4
|
-
import { setCSSTransform } from './css-transform.mjs';
|
|
5
|
-
|
|
6
|
-
let initPromise;
|
|
7
|
-
async function initCSSCompiler(input) {
|
|
8
|
-
initPromise ??= init(input).then(()=>{
|
|
9
|
-
setCSSTransform(transform);
|
|
10
|
-
});
|
|
11
|
-
await initPromise;
|
|
12
|
-
}
|
|
13
|
-
async function compileCSS(source, options = {}) {
|
|
14
|
-
await initCSSCompiler();
|
|
15
|
-
return compileCSS$1(source, options);
|
|
16
|
-
}
|
|
17
|
-
async function compileCSSManifest(source, options = {}) {
|
|
18
|
-
const result = await compileCSS(source, options);
|
|
19
|
-
if (result.references?.length) {
|
|
20
|
-
throw new Error('Browser compileCSSManifest cannot resolve @reference directives. Inline referenced CSS or compile the stylesheet in a Node environment.');
|
|
21
|
-
}
|
|
22
|
-
const { manifestInput: _manifestInput, ...directiveData } = result;
|
|
23
|
-
const lowerResult = lowerCSSDirectives(result, {
|
|
24
|
-
baseManifest: options.baseManifest,
|
|
25
|
-
onWarning: options.onWarning
|
|
26
|
-
});
|
|
27
|
-
const generatedCSS = lowerResult.generatedCSS || '';
|
|
28
|
-
const css = [
|
|
29
|
-
result.nativeCSS,
|
|
30
|
-
generatedCSS
|
|
31
|
-
].filter(Boolean).join('\n');
|
|
32
|
-
return {
|
|
33
|
-
...directiveData,
|
|
34
|
-
dependencies: [],
|
|
35
|
-
manifest: lowerResult.manifest,
|
|
36
|
-
warnings: lowerResult.warnings,
|
|
37
|
-
generatedCSS,
|
|
38
|
-
css,
|
|
39
|
-
directives: result
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
async function parseDirectives(source, options = {}) {
|
|
43
|
-
await initCSSCompiler();
|
|
44
|
-
return parseDirectives$1(source, options);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export { compileCSS, compileCSSManifest, initCSSCompiler, parseDirectives };
|