@bamboocss/parser 1.13.2 → 1.14.0
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/dist/index.cjs +12 -0
- package/dist/index.mjs +12 -0
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -637,6 +637,13 @@ const combineResult = (unboxed) => {
|
|
|
637
637
|
];
|
|
638
638
|
};
|
|
639
639
|
const defaultEnv = { preset: "ECMA" };
|
|
640
|
+
/**
|
|
641
|
+
* `fallback()` is generated into `styled-system/css`, so evaluating a call to it would mean
|
|
642
|
+
* resolving and running generated code. It is a pure string builder, so the definition is
|
|
643
|
+
* repeated here — without it the call is unresolvable and the whole declaration is dropped
|
|
644
|
+
* with no diagnostic, which is worse than not shipping the helper at all.
|
|
645
|
+
*/
|
|
646
|
+
const fallbackImpl = (...values) => values.some((value) => value === void 0) ? void 0 : `fallback(${values.join(", ")})`;
|
|
640
647
|
const evaluateOptions = { environment: defaultEnv };
|
|
641
648
|
function createParser(context) {
|
|
642
649
|
const { jsx, imports, recipes, config } = context;
|
|
@@ -684,6 +691,11 @@ function createParser(context) {
|
|
|
684
691
|
getEvaluateOptions: (node) => {
|
|
685
692
|
if (!ts_morph.Node.isCallExpression(node)) return evaluateOptions;
|
|
686
693
|
const propAccessExpr = node.getExpression();
|
|
694
|
+
if (ts_morph.Node.isIdentifier(propAccessExpr)) {
|
|
695
|
+
const local = propAccessExpr.getText();
|
|
696
|
+
if (!file.match(local) || file.getName(local) !== "fallback") return evaluateOptions;
|
|
697
|
+
return { environment: Object.assign({}, defaultEnv, { extra: { [local]: fallbackImpl } }) };
|
|
698
|
+
}
|
|
687
699
|
if (!ts_morph.Node.isPropertyAccessExpression(propAccessExpr)) return evaluateOptions;
|
|
688
700
|
let name = propAccessExpr.getText();
|
|
689
701
|
if (!file.isRawFn(name)) return evaluateOptions;
|
package/dist/index.mjs
CHANGED
|
@@ -636,6 +636,13 @@ const combineResult = (unboxed) => {
|
|
|
636
636
|
];
|
|
637
637
|
};
|
|
638
638
|
const defaultEnv = { preset: "ECMA" };
|
|
639
|
+
/**
|
|
640
|
+
* `fallback()` is generated into `styled-system/css`, so evaluating a call to it would mean
|
|
641
|
+
* resolving and running generated code. It is a pure string builder, so the definition is
|
|
642
|
+
* repeated here — without it the call is unresolvable and the whole declaration is dropped
|
|
643
|
+
* with no diagnostic, which is worse than not shipping the helper at all.
|
|
644
|
+
*/
|
|
645
|
+
const fallbackImpl = (...values) => values.some((value) => value === void 0) ? void 0 : `fallback(${values.join(", ")})`;
|
|
639
646
|
const evaluateOptions = { environment: defaultEnv };
|
|
640
647
|
function createParser(context) {
|
|
641
648
|
const { jsx, imports, recipes, config } = context;
|
|
@@ -683,6 +690,11 @@ function createParser(context) {
|
|
|
683
690
|
getEvaluateOptions: (node) => {
|
|
684
691
|
if (!Node.isCallExpression(node)) return evaluateOptions;
|
|
685
692
|
const propAccessExpr = node.getExpression();
|
|
693
|
+
if (Node.isIdentifier(propAccessExpr)) {
|
|
694
|
+
const local = propAccessExpr.getText();
|
|
695
|
+
if (!file.match(local) || file.getName(local) !== "fallback") return evaluateOptions;
|
|
696
|
+
return { environment: Object.assign({}, defaultEnv, { extra: { [local]: fallbackImpl } }) };
|
|
697
|
+
}
|
|
686
698
|
if (!Node.isPropertyAccessExpression(propAccessExpr)) return evaluateOptions;
|
|
687
699
|
let name = propAccessExpr.getText();
|
|
688
700
|
if (!file.isRawFn(name)) return evaluateOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/parser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "The static parser for bamboo css",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"ts-morph": "28.0.0",
|
|
36
36
|
"ts-pattern": "5.9.0",
|
|
37
|
-
"@bamboocss/
|
|
38
|
-
"@bamboocss/
|
|
39
|
-
"@bamboocss/
|
|
40
|
-
"@bamboocss/
|
|
41
|
-
"@bamboocss/
|
|
42
|
-
"@bamboocss/types": "1.
|
|
37
|
+
"@bamboocss/core": "^1.14.0",
|
|
38
|
+
"@bamboocss/config": "^1.14.0",
|
|
39
|
+
"@bamboocss/logger": "1.14.0",
|
|
40
|
+
"@bamboocss/shared": "1.14.0",
|
|
41
|
+
"@bamboocss/extractor": "1.14.0",
|
|
42
|
+
"@bamboocss/types": "1.14.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@bamboocss/generator": "1.
|
|
46
|
-
"@bamboocss/plugin-svelte": "1.
|
|
47
|
-
"@bamboocss/plugin-vue": "1.
|
|
45
|
+
"@bamboocss/generator": "1.14.0",
|
|
46
|
+
"@bamboocss/plugin-svelte": "1.14.0",
|
|
47
|
+
"@bamboocss/plugin-vue": "1.14.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsdown src/index.ts --format=esm,cjs --dts",
|