@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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/dist/browser.d.ts +23 -19
  3. package/dist/browser.js +42 -0
  4. package/dist/core.d.ts +43 -41
  5. package/dist/core.js +1639 -0
  6. package/dist/css-transform.d.ts +10 -6
  7. package/dist/css-transform.js +17 -0
  8. package/dist/diagnostics.d.ts +11 -0
  9. package/dist/diagnostics.js +12 -0
  10. package/dist/index.d.ts +41 -38
  11. package/dist/index.js +330 -0
  12. package/dist/lexer/imports.d.ts +16 -12
  13. package/dist/lexer/imports.js +38 -0
  14. package/dist/lexer/source.d.ts +6 -3
  15. package/dist/lexer/source.js +8 -0
  16. package/dist/lexer/standalone-master.d.ts +23 -19
  17. package/dist/lexer/standalone-master.js +219 -0
  18. package/dist/lower-css-directives.d.ts +18 -13
  19. package/dist/lower-css-directives.js +753 -0
  20. package/dist/master-css-manifest.d.ts +18 -12
  21. package/dist/master-css-manifest.js +546 -0
  22. package/dist/native-declaration.d.ts +6 -2
  23. package/dist/native-declaration.js +23 -0
  24. package/dist/utils/selectors.d.ts +6 -3
  25. package/dist/utils/selectors.js +49 -0
  26. package/dist/utils/unquote.d.ts +4 -1
  27. package/dist/utils/unquote.js +9 -0
  28. package/dist/utils/wrap-at-rules.d.ts +4 -1
  29. package/dist/utils/wrap-at-rules.js +11 -0
  30. package/package.json +69 -1
  31. package/dist/browser.mjs +0 -47
  32. package/dist/core.mjs +0 -2146
  33. package/dist/css-transform.mjs +0 -18
  34. package/dist/index.mjs +0 -395
  35. package/dist/lexer/imports.mjs +0 -44
  36. package/dist/lexer/source.mjs +0 -9
  37. package/dist/lexer/standalone-master.mjs +0 -233
  38. package/dist/lower-css-directives.mjs +0 -969
  39. package/dist/master-css-manifest.mjs +0 -760
  40. package/dist/native-declaration.mjs +0 -25
  41. package/dist/utils/selectors.mjs +0 -55
  42. package/dist/utils/unquote.mjs +0 -10
  43. 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 };
@@ -1 +1,4 @@
1
- export default function wrapAtRules(text: string, atRules?: string[]): string;
1
+ //#region src/utils/wrap-at-rules.d.ts
2
+ declare function wrapAtRules(text: string, atRules?: string[]): string;
3
+ //#endregion
4
+ export { wrapAtRules 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
- {"name":"@master/css-compiler","type":"module","scripts":{"build":"techor build \"src/**/*.ts\" --formats esm","dev":"pnpm build --watch","lint":"eslint","type-check":"tsc --noEmit","test":"vitest"},"license":"MIT","description":"Compile Master CSS stylesheet directives","author":"Aoyue Design LLC.","funding":"https://rc.css.master.co/sponsor","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/compiler"},"keywords":["compiler","directives","css","mastercss"],"sideEffects":false,"main":"./dist/index.mjs","module":"./dist/index.mjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.mjs","default":"./dist/browser.mjs"}},"files":["dist"],"publishConfig":{"access":"public","provenance":true},"dependencies":{"@master/css-engine":"^2.0.0-rc.73","@master/css-lexer":"^2.0.0-rc.73","css-tree":"^3.2.1","csstype":"^3.2.3","lightningcss":"^1.32.0","lightningcss-wasm":"^1.32.0","@master/css-schema":"^2.0.0-rc.73"},"devDependencies":{"@master/css-preset":"^2.0.0-rc.73","@types/css-tree":"^2.3.11"},"version":"2.0.0-rc.73"}
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 };