@griffel/transform 3.0.0 → 3.0.1

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 (46) hide show
  1. package/LICENSE.md +21 -0
  2. package/package.json +9 -6
  3. package/src/constants.mjs +3 -0
  4. package/src/constants.mjs.map +1 -0
  5. package/{evaluation → src/evaluation}/astEvaluator.d.mts +2 -2
  6. package/src/evaluation/astEvaluator.mjs +90 -0
  7. package/src/evaluation/astEvaluator.mjs.map +1 -0
  8. package/{evaluation → src/evaluation}/batchEvaluator.d.mts +4 -4
  9. package/src/evaluation/batchEvaluator.mjs +54 -0
  10. package/src/evaluation/batchEvaluator.mjs.map +1 -0
  11. package/src/evaluation/evalCache.mjs +65 -0
  12. package/src/evaluation/evalCache.mjs.map +1 -0
  13. package/{evaluation → src/evaluation}/fluentTokensPlugin.d.mts +1 -1
  14. package/src/evaluation/fluentTokensPlugin.mjs +70 -0
  15. package/src/evaluation/fluentTokensPlugin.mjs.map +1 -0
  16. package/{evaluation → src/evaluation}/module.d.mts +13 -1
  17. package/src/evaluation/module.mjs +207 -0
  18. package/src/evaluation/module.mjs.map +1 -0
  19. package/src/evaluation/process.mjs +28 -0
  20. package/src/evaluation/process.mjs.map +1 -0
  21. package/{evaluation → src/evaluation}/types.d.mts +1 -1
  22. package/src/evaluation/types.mjs +2 -0
  23. package/src/evaluation/types.mjs.map +1 -0
  24. package/{evaluation → src/evaluation}/vmEvaluator.d.mts +2 -2
  25. package/src/evaluation/vmEvaluator.mjs +33 -0
  26. package/src/evaluation/vmEvaluator.mjs.map +1 -0
  27. package/src/index.mjs +9 -0
  28. package/src/index.mjs.map +1 -0
  29. package/{transformSync.d.mts → src/transformSync.d.mts} +4 -3
  30. package/src/transformSync.mjs +252 -0
  31. package/src/transformSync.mjs.map +1 -0
  32. package/{types.d.mts → src/types.d.mts} +1 -1
  33. package/src/types.mjs +2 -0
  34. package/src/types.mjs.map +1 -0
  35. package/src/utils/convertESMtoCJS.mjs +203 -0
  36. package/src/utils/convertESMtoCJS.mjs.map +1 -0
  37. package/{utils → src/utils}/dedupeCSSRules.d.mts +1 -1
  38. package/src/utils/dedupeCSSRules.mjs +19 -0
  39. package/src/utils/dedupeCSSRules.mjs.map +1 -0
  40. package/CHANGELOG.md +0 -80
  41. package/transform.js +0 -933
  42. /package/{constants.d.mts → src/constants.d.mts} +0 -0
  43. /package/{evaluation → src/evaluation}/evalCache.d.mts +0 -0
  44. /package/{evaluation → src/evaluation}/process.d.mts +0 -0
  45. /package/{index.d.mts → src/index.d.mts} +0 -0
  46. /package/{utils → src/utils}/convertESMtoCJS.d.mts +0 -0
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Rules that are returned by `resolveStyles()` are not deduplicated.
3
+ * It's critical to filter out duplicates for build-time transform to avoid duplicated rules in a bundle.
4
+ */
5
+ export function dedupeCSSRules(cssRulesByBucket) {
6
+ return Object.fromEntries(Object.entries(cssRulesByBucket).map(([styleBucketName, cssBucketEntries]) => {
7
+ if (styleBucketName === 'm') {
8
+ const seen = new Map();
9
+ for (const entry of cssBucketEntries) {
10
+ if (!seen.has(entry[0])) {
11
+ seen.set(entry[0], entry);
12
+ }
13
+ }
14
+ return [styleBucketName, Array.from(seen.values())];
15
+ }
16
+ return [styleBucketName, Array.from(new Set(cssBucketEntries))];
17
+ }));
18
+ }
19
+ //# sourceMappingURL=dedupeCSSRules.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dedupeCSSRules.mjs","sourceRoot":"","sources":["../../../../../packages/transform/src/utils/dedupeCSSRules.mts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,gBAAkC;IAC/D,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,eAAe,EAAE,gBAAgB,CAAC,EAAE,EAAE;QAC3E,IAAI,eAAe,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,IAAI,GAAG,IAAI,GAAG,EAA0B,CAAC;YAE/C,KAAK,MAAM,KAAK,IAAI,gBAAgB,EAAE,CAAC;gBACrC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBACxB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;YAED,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAClE,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
package/CHANGELOG.md DELETED
@@ -1,80 +0,0 @@
1
- # Change Log - @griffel/transform
2
-
3
- This log was last generated on Mon, 23 Mar 2026 16:49:14 GMT and should not be manually modified.
4
-
5
- <!-- Start content -->
6
-
7
- ## 3.0.0
8
-
9
- Mon, 23 Mar 2026 16:49:14 GMT
10
-
11
- ### Major changes
12
-
13
- - BREAKING: rename modules to importsToTransform, add functionsToTransform option (olfedias@microsoft.com)
14
-
15
- ### Patches
16
-
17
- - fix: reverse styleCalls iteration to match CSS rule ordering of old plugin (olfedias@microsoft.com)
18
- - fix: add zIndex fallback values in fluentTokensPlugin (olfedias@microsoft.com)
19
-
20
- ## 2.0.2
21
-
22
- Fri, 13 Mar 2026 17:00:44 GMT
23
-
24
- ### Patches
25
-
26
- - fix: wrap VM errors as host Error with filename context (olfedias@microsoft.com)
27
- - perf: skip eval cache for __mkPreval entry-point evaluations (olfedias@microsoft.com)
28
- - fix: wrap VM errors as host Error with filename context, defer CJS export assignments for IIFE patterns (olfedias@microsoft.com)
29
- - Bump @griffel/transform-shaker to v1.0.2
30
-
31
- ## 2.0.0
32
-
33
- Wed, 11 Mar 2026 13:33:34 GMT
34
-
35
- ### Major changes
36
-
37
- - BREAKING: Replace @linaria/shaker with @griffel/transform-shaker. Remove babelOptions from TransformOptions. Remove StrictOptions type. (olfedias@microsoft.com)
38
-
39
- ### Patches
40
-
41
- - feat: add collectPerfIssues option to TransformOptions (olfedias@microsoft.com)
42
- - fix: fix VM result index mapping in batchEvaluator (olfedias@microsoft.com)
43
-
44
- ## 1.2.1
45
-
46
- Fri, 06 Mar 2026 15:56:28 GMT
47
-
48
- ### Patches
49
-
50
- - refactor: remove cookModuleId from module evaluation (olfedias@microsoft.com)
51
- - Bump @griffel/core to v1.20.1
52
-
53
- ## 1.2.0
54
-
55
- Fri, 06 Mar 2026 08:17:05 GMT
56
-
57
- ### Minor changes
58
-
59
- - feat: add AST evaluator plugin system with evaluationPlugins option (olfedias@microsoft.com)
60
- - feat: wrap imported asset paths in <griffel-asset> tags for reliable CSS extraction (olfedias@microsoft.com)
61
- - feat: add makeStaticStyles AOT/CSS extraction support (olfedias@microsoft.com)
62
- - feat: hybrid evaluator that shakes ESM node_modules instead of ignoring them (olfedias@microsoft.com)
63
- - feat: throw on non-ESM input in transformSync (olfedias@microsoft.com)
64
- - Bump @griffel/core to v1.20.0
65
-
66
- ### Patches
67
-
68
- - refactor: use ScopeTracker from oxc-walker for scope-aware import resolution (olfedias@microsoft.com)
69
- - refactor: extract dedupeCSSRules result to a variable in transformSync (olfedias@microsoft.com)
70
- - refactor: internalize Linaria Module/EvalCache to remove @linaria/babel-preset dependency (olfedias@microsoft.com)
71
- - perf: replace DeoptError with DEOPT sentinel symbol, optimize CSS rule dedup and lookups (olfedias@microsoft.com)
72
-
73
- ## 1.1.0
74
-
75
- Mon, 03 Nov 2025 15:43:56 GMT
76
-
77
- ### Minor changes
78
-
79
- - Add initial @griffel/transform package boilerplate (copilot@github.com)
80
- - feat: add functionality (copilot@github.com)