@griffel/transform 3.0.5 → 3.0.6
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.md +21 -0
- package/package.json +6 -5
- package/src/constants.d.mts +2 -0
- package/src/{constants.mts → constants.mjs} +1 -0
- package/src/constants.mjs.map +1 -0
- package/src/evaluation/astEvaluator.d.mts +20 -0
- package/src/evaluation/astEvaluator.mjs +90 -0
- package/src/evaluation/astEvaluator.mjs.map +1 -0
- package/src/evaluation/batchEvaluator.d.mts +13 -0
- package/src/evaluation/batchEvaluator.mjs +54 -0
- package/src/evaluation/batchEvaluator.mjs.map +1 -0
- package/src/evaluation/evalCache.d.mts +9 -0
- package/src/evaluation/evalCache.mjs +65 -0
- package/src/evaluation/evalCache.mjs.map +1 -0
- package/src/evaluation/fluentTokensPlugin.d.mts +2 -0
- package/src/evaluation/fluentTokensPlugin.mjs +70 -0
- package/src/evaluation/fluentTokensPlugin.mjs.map +1 -0
- package/src/evaluation/module.d.mts +44 -0
- package/src/evaluation/module.mjs +207 -0
- package/src/evaluation/module.mjs.map +1 -0
- package/src/evaluation/process.d.mts +24 -0
- package/src/evaluation/{process.mts → process.mjs} +7 -12
- package/src/evaluation/process.mjs.map +1 -0
- package/src/evaluation/types.d.mts +34 -0
- package/src/evaluation/types.mjs +2 -0
- package/src/evaluation/types.mjs.map +1 -0
- package/src/evaluation/vmEvaluator.d.mts +3 -0
- package/src/evaluation/vmEvaluator.mjs +33 -0
- package/src/evaluation/vmEvaluator.mjs.map +1 -0
- package/src/{index.mts → index.d.mts} +0 -4
- package/src/index.mjs +9 -0
- package/src/index.mjs.map +1 -0
- package/src/transformSync.d.mts +41 -0
- package/src/transformSync.mjs +253 -0
- package/src/transformSync.mjs.map +1 -0
- package/src/types.d.mts +12 -0
- package/src/types.mjs +2 -0
- package/src/types.mjs.map +1 -0
- package/src/utils/convertESMtoCJS.d.mts +6 -0
- package/src/utils/convertESMtoCJS.mjs +203 -0
- package/src/utils/convertESMtoCJS.mjs.map +1 -0
- package/src/utils/dedupeCSSRules.d.mts +6 -0
- package/src/utils/dedupeCSSRules.mjs +19 -0
- package/src/utils/dedupeCSSRules.mjs.map +1 -0
- package/CHANGELOG.json +0 -404
- package/CHANGELOG.md +0 -130
- package/__fixtures__/assets/blank.jpg +0 -0
- package/__fixtures__/assets/code.ts +0 -12
- package/__fixtures__/assets/empty.jpg +0 -0
- package/__fixtures__/assets/output.meta.json +0 -12
- package/__fixtures__/assets/output.ts +0 -12
- package/__fixtures__/assets-multiple-declarations/blank.jpg +0 -0
- package/__fixtures__/assets-multiple-declarations/code.ts +0 -8
- package/__fixtures__/assets-multiple-declarations/empty.jpg +0 -0
- package/__fixtures__/assets-multiple-declarations/output.meta.json +0 -9
- package/__fixtures__/assets-multiple-declarations/output.ts +0 -6
- package/__fixtures__/assets-reset-styles/blank.jpg +0 -0
- package/__fixtures__/assets-reset-styles/code.ts +0 -11
- package/__fixtures__/assets-reset-styles/empty.jpg +0 -0
- package/__fixtures__/assets-reset-styles/output.meta.json +0 -11
- package/__fixtures__/assets-reset-styles/output.ts +0 -7
- package/__fixtures__/assets-urls/code.ts +0 -13
- package/__fixtures__/assets-urls/output.meta.json +0 -14
- package/__fixtures__/assets-urls/output.ts +0 -10
- package/__fixtures__/at-rules/code.ts +0 -14
- package/__fixtures__/at-rules/output.meta.json +0 -15
- package/__fixtures__/at-rules/output.ts +0 -10
- package/__fixtures__/config-classname-hash-salt/code.ts +0 -5
- package/__fixtures__/config-classname-hash-salt/output.meta.json +0 -7
- package/__fixtures__/config-classname-hash-salt/output.ts +0 -3
- package/__fixtures__/config-evaluation-rules/code.ts +0 -8
- package/__fixtures__/config-evaluation-rules/consts.ts +0 -1
- package/__fixtures__/config-evaluation-rules/output.meta.json +0 -7
- package/__fixtures__/config-evaluation-rules/output.ts +0 -4
- package/__fixtures__/config-evaluation-rules/sampleEvaluator.cjs +0 -12
- package/__fixtures__/error-argument-count/fixture.js +0 -4
- package/__fixtures__/error-cjs/fixture.js +0 -4
- package/__fixtures__/error-on-undefined/fixture.ts +0 -7
- package/__fixtures__/error-on-undefined/tokens.ts +0 -1
- package/__fixtures__/export-default/code.ts +0 -6
- package/__fixtures__/export-default/output.meta.json +0 -14
- package/__fixtures__/export-default/output.ts +0 -6
- package/__fixtures__/function-mixin/code.ts +0 -6
- package/__fixtures__/function-mixin/mixins.ts +0 -7
- package/__fixtures__/function-mixin/output.meta.json +0 -7
- package/__fixtures__/function-mixin/output.ts +0 -4
- package/__fixtures__/function-mixin/tokens.ts +0 -3
- package/__fixtures__/import-alias/code.ts +0 -5
- package/__fixtures__/import-alias/output.meta.json +0 -7
- package/__fixtures__/import-alias/output.ts +0 -3
- package/__fixtures__/import-custom-module/code.ts +0 -6
- package/__fixtures__/import-custom-module/output.meta.json +0 -7
- package/__fixtures__/import-custom-module/output.ts +0 -4
- package/__fixtures__/keyframes/code.ts +0 -22
- package/__fixtures__/keyframes/output.meta.json +0 -17
- package/__fixtures__/keyframes/output.ts +0 -6
- package/__fixtures__/multiple-declarations/code.ts +0 -8
- package/__fixtures__/multiple-declarations/output.meta.json +0 -7
- package/__fixtures__/multiple-declarations/output.ts +0 -4
- package/__fixtures__/non-existing-module-call/code.ts +0 -10
- package/__fixtures__/non-existing-module-call/module.ts +0 -13
- package/__fixtures__/non-existing-module-call/output.meta.json +0 -7
- package/__fixtures__/non-existing-module-call/output.ts +0 -6
- package/__fixtures__/object/code.ts +0 -6
- package/__fixtures__/object/output.meta.json +0 -14
- package/__fixtures__/object/output.ts +0 -6
- package/__fixtures__/object-computed-keys/code.ts +0 -8
- package/__fixtures__/object-computed-keys/output.meta.json +0 -14
- package/__fixtures__/object-computed-keys/output.ts +0 -8
- package/__fixtures__/object-imported-keys/code.ts +0 -9
- package/__fixtures__/object-imported-keys/consts.ts +0 -2
- package/__fixtures__/object-imported-keys/output.meta.json +0 -7
- package/__fixtures__/object-imported-keys/output.ts +0 -4
- package/__fixtures__/object-mixins/code.ts +0 -11
- package/__fixtures__/object-mixins/mixins.ts +0 -17
- package/__fixtures__/object-mixins/output.meta.json +0 -16
- package/__fixtures__/object-mixins/output.ts +0 -10
- package/__fixtures__/object-mixins/tokens.ts +0 -3
- package/__fixtures__/object-nesting/code.ts +0 -13
- package/__fixtures__/object-nesting/consts.ts +0 -1
- package/__fixtures__/object-nesting/output.meta.json +0 -9
- package/__fixtures__/object-nesting/output.ts +0 -6
- package/__fixtures__/object-reset/code.ts +0 -8
- package/__fixtures__/object-reset/output.meta.json +0 -7
- package/__fixtures__/object-reset/output.ts +0 -5
- package/__fixtures__/object-sequence-expr/code.ts +0 -16
- package/__fixtures__/object-sequence-expr/output.meta.json +0 -7
- package/__fixtures__/object-sequence-expr/output.ts +0 -7
- package/__fixtures__/object-shorthands/code.ts +0 -8
- package/__fixtures__/object-shorthands/output.meta.json +0 -20
- package/__fixtures__/object-shorthands/output.ts +0 -5
- package/__fixtures__/object-variables/code.ts +0 -9
- package/__fixtures__/object-variables/output.meta.json +0 -15
- package/__fixtures__/object-variables/output.ts +0 -9
- package/__fixtures__/object-variables/vars.ts +0 -5
- package/__fixtures__/reset-styles/code.ts +0 -6
- package/__fixtures__/reset-styles/output.meta.json +0 -7
- package/__fixtures__/reset-styles/output.ts +0 -3
- package/__fixtures__/reset-styles-at-rules/code.ts +0 -7
- package/__fixtures__/reset-styles-at-rules/output.meta.json +0 -8
- package/__fixtures__/reset-styles-at-rules/output.ts +0 -3
- package/__fixtures__/rules-with-metadata/code.ts +0 -9
- package/__fixtures__/rules-with-metadata/output.meta.json +0 -14
- package/__fixtures__/rules-with-metadata/output.ts +0 -3
- package/__fixtures__/shared-mixins/code.ts +0 -7
- package/__fixtures__/shared-mixins/mixins.ts +0 -6
- package/__fixtures__/shared-mixins/output.meta.json +0 -7
- package/__fixtures__/shared-mixins/output.ts +0 -8
- package/__fixtures__/static-styles/code.ts +0 -7
- package/__fixtures__/static-styles/output.meta.json +0 -7
- package/__fixtures__/static-styles/output.ts +0 -3
- package/__fixtures__/static-styles-array/code.ts +0 -10
- package/__fixtures__/static-styles-array/output.meta.json +0 -7
- package/__fixtures__/static-styles-array/output.ts +0 -3
- package/__fixtures__/static-styles-string/code.ts +0 -3
- package/__fixtures__/static-styles-string/output.meta.json +0 -7
- package/__fixtures__/static-styles-string/output.ts +0 -3
- package/__fixtures__/tokens/code.ts +0 -11
- package/__fixtures__/tokens/output.meta.json +0 -12
- package/__fixtures__/tokens/output.ts +0 -7
- package/__fixtures__/tokens/tokens.ts +0 -4
- package/__fixtures__/unsupported-css-properties/fixture.ts +0 -16
- package/__fixtures__/unsupported-css-properties/output.meta.json +0 -5
- package/__fixtures__/unsupported-css-properties/output.ts +0 -3
- package/eslint.config.mjs +0 -31
- package/project.json +0 -51
- package/src/evaluation/astEvaluator.mts +0 -109
- package/src/evaluation/astEvaluator.test.mts +0 -126
- package/src/evaluation/batchEvaluator.mts +0 -79
- package/src/evaluation/evalCache.mts +0 -84
- package/src/evaluation/fluentTokensPlugin.mts +0 -82
- package/src/evaluation/fluentTokensPlugin.test.mts +0 -130
- package/src/evaluation/module.mts +0 -271
- package/src/evaluation/module.test.mts +0 -133
- package/src/evaluation/types.mts +0 -49
- package/src/evaluation/vmEvaluator.mts +0 -45
- package/src/evaluation/vmEvaluator.test.mts +0 -30
- package/src/transformSync.mts +0 -425
- package/src/transformSync.test.mts +0 -429
- package/src/types.mts +0 -13
- package/src/utils/convertESMtoCJS.mts +0 -226
- package/src/utils/convertESMtoCJS.test.mts +0 -159
- package/src/utils/dedupeCSSRules.mts +0 -25
- package/src/utils/dedupeCSSRules.test.mts +0 -39
- package/tsconfig.json +0 -19
- package/tsconfig.lib.json +0 -30
- package/tsconfig.spec.json +0 -24
- package/vitest.config.mts +0 -18
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { convertESMtoCJS } from './convertESMtoCJS.mjs';
|
|
3
|
-
|
|
4
|
-
describe('convertESMtoCJS', () => {
|
|
5
|
-
it('throws on parse errors', () => {
|
|
6
|
-
expect(() => convertESMtoCJS('for (const key of ) {}', '/test.js')).toThrowError(
|
|
7
|
-
/convertESMtoCJS: failed to parse/,
|
|
8
|
-
);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('returns CJS code unchanged', () => {
|
|
12
|
-
const code = 'const x = require("foo");\nmodule.exports = x;';
|
|
13
|
-
expect(convertESMtoCJS(code, '/test.js')).toBe(code);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('converts side-effect import', () => {
|
|
17
|
-
expect(convertESMtoCJS('import "./foo";', '/test.js')).toMatchInlineSnapshot(`
|
|
18
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
require("./foo");"
|
|
20
|
-
`);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('converts named import', () => {
|
|
24
|
-
expect(convertESMtoCJS('import { foo } from "./foo";', '/test.js')).toMatchInlineSnapshot(`
|
|
25
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const { foo } = require("./foo");"
|
|
27
|
-
`);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('converts aliased named import', () => {
|
|
31
|
-
expect(convertESMtoCJS('import { foo as bar } from "./foo";', '/test.js')).toMatchInlineSnapshot(`
|
|
32
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
const { foo: bar } = require("./foo");"
|
|
34
|
-
`);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('converts default import', () => {
|
|
38
|
-
expect(convertESMtoCJS('import foo from "./foo";', '/test.js')).toMatchInlineSnapshot(`
|
|
39
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
const _require$foo = require("./foo");
|
|
41
|
-
const foo = _require$foo.__esModule ? _require$foo.default : _require$foo;"
|
|
42
|
-
`);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('converts namespace import', () => {
|
|
46
|
-
expect(convertESMtoCJS('import * as foo from "./foo";', '/test.js')).toMatchInlineSnapshot(`
|
|
47
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
const foo = require("./foo");"
|
|
49
|
-
`);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('converts default + named imports', () => {
|
|
53
|
-
expect(convertESMtoCJS('import foo, { bar } from "./foo";', '/test.js')).toMatchInlineSnapshot(`
|
|
54
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
-
const _require$foo = require("./foo");
|
|
56
|
-
const foo = _require$foo.__esModule ? _require$foo.default : _require$foo;
|
|
57
|
-
const { bar } = _require$foo;"
|
|
58
|
-
`);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('converts export const', () => {
|
|
62
|
-
expect(convertESMtoCJS('export const x = 1;', '/test.js')).toMatchInlineSnapshot(`
|
|
63
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
|
-
const x = 1;
|
|
65
|
-
exports.x = x;"
|
|
66
|
-
`);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('converts export const with destructuring', () => {
|
|
70
|
-
expect(convertESMtoCJS('export const { a, b } = obj;', '/test.js')).toMatchInlineSnapshot(`
|
|
71
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
72
|
-
const { a, b } = obj;
|
|
73
|
-
exports.a = a;
|
|
74
|
-
exports.b = b;"
|
|
75
|
-
`);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('converts export function', () => {
|
|
79
|
-
expect(convertESMtoCJS('export function foo() {}', '/test.js')).toMatchInlineSnapshot(`
|
|
80
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
81
|
-
function foo() {}
|
|
82
|
-
exports.foo = foo;"
|
|
83
|
-
`);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('defers export var assignment for TS enum IIFE pattern', () => {
|
|
87
|
-
const code = [
|
|
88
|
-
'export var Depths;',
|
|
89
|
-
'(function (Depths) {',
|
|
90
|
-
' Depths.depth4 = "shadow";',
|
|
91
|
-
'})(Depths || (Depths = {}));',
|
|
92
|
-
].join('\n');
|
|
93
|
-
|
|
94
|
-
expect(convertESMtoCJS(code, '/test.js')).toMatchInlineSnapshot(`
|
|
95
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
96
|
-
var Depths;
|
|
97
|
-
(function (Depths) {
|
|
98
|
-
Depths.depth4 = "shadow";
|
|
99
|
-
})(Depths || (Depths = {}));
|
|
100
|
-
exports.Depths = Depths;"
|
|
101
|
-
`);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it('converts export { name }', () => {
|
|
105
|
-
expect(convertESMtoCJS('const x = 1;\nexport { x };', '/test.js')).toMatchInlineSnapshot(`
|
|
106
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
107
|
-
const x = 1;
|
|
108
|
-
exports["x"] = x;"
|
|
109
|
-
`);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('converts re-export from another module', () => {
|
|
113
|
-
expect(convertESMtoCJS('export { foo } from "./bar";', '/test.js')).toMatchInlineSnapshot(`
|
|
114
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
115
|
-
exports["foo"] = require("./bar")["foo"];"
|
|
116
|
-
`);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
it('converts export default expression', () => {
|
|
120
|
-
expect(convertESMtoCJS('export default 42;', '/test.js')).toMatchInlineSnapshot(`
|
|
121
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
122
|
-
exports.default = 42;"
|
|
123
|
-
`);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('converts export default named function', () => {
|
|
127
|
-
expect(convertESMtoCJS('export default function foo() {}', '/test.js')).toMatchInlineSnapshot(`
|
|
128
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
129
|
-
function foo() {}
|
|
130
|
-
exports.default = foo;"
|
|
131
|
-
`);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it('converts export * from', () => {
|
|
135
|
-
expect(convertESMtoCJS('export * from "./foo";', '/test.js')).toMatchInlineSnapshot(`
|
|
136
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
137
|
-
Object.assign(exports, require("./foo"));"
|
|
138
|
-
`);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
it('converts export * as name from', () => {
|
|
142
|
-
expect(convertESMtoCJS('export * as ns from "./foo";', '/test.js')).toMatchInlineSnapshot(`
|
|
143
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
144
|
-
exports["ns"] = require("./foo");"
|
|
145
|
-
`);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('handles "use strict" directive with ESM exports', () => {
|
|
149
|
-
const code = '"use strict";\nexport const foo = 1;\nexport class Bar {}';
|
|
150
|
-
expect(convertESMtoCJS(code, '/test.js')).toMatchInlineSnapshot(`
|
|
151
|
-
"Object.defineProperty(exports, "__esModule", { value: true });
|
|
152
|
-
"use strict";
|
|
153
|
-
const foo = 1;
|
|
154
|
-
class Bar {}
|
|
155
|
-
exports.foo = foo;
|
|
156
|
-
exports.Bar = Bar;"
|
|
157
|
-
`);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { CSSRulesByBucket, CSSBucketEntry } from '@griffel/core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Rules that are returned by `resolveStyles()` are not deduplicated.
|
|
5
|
-
* It's critical to filter out duplicates for build-time transform to avoid duplicated rules in a bundle.
|
|
6
|
-
*/
|
|
7
|
-
export function dedupeCSSRules(cssRulesByBucket: CSSRulesByBucket): CSSRulesByBucket {
|
|
8
|
-
return Object.fromEntries(
|
|
9
|
-
Object.entries(cssRulesByBucket).map(([styleBucketName, cssBucketEntries]) => {
|
|
10
|
-
if (styleBucketName === 'm') {
|
|
11
|
-
const seen = new Map<string, CSSBucketEntry>();
|
|
12
|
-
|
|
13
|
-
for (const entry of cssBucketEntries) {
|
|
14
|
-
if (!seen.has(entry[0])) {
|
|
15
|
-
seen.set(entry[0], entry);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return [styleBucketName, Array.from(seen.values())];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return [styleBucketName, Array.from(new Set(cssBucketEntries))];
|
|
23
|
-
}),
|
|
24
|
-
);
|
|
25
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { CSSRulesByBucket } from '@griffel/core';
|
|
2
|
-
import { expect, it, describe } from 'vitest';
|
|
3
|
-
|
|
4
|
-
import { dedupeCSSRules } from './dedupeCSSRules.mjs';
|
|
5
|
-
|
|
6
|
-
describe('dedupeCSSRules', () => {
|
|
7
|
-
it('dedupes simple rules', () => {
|
|
8
|
-
const rules: CSSRulesByBucket = {
|
|
9
|
-
d: ['.foo { color: red; }', '.foo { color: red; }', '.baz { color: pink }'],
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
expect(dedupeCSSRules(rules)).toMatchObject({
|
|
13
|
-
d: ['.foo { color: red; }', '.baz { color: pink }'],
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('dedupes rules with metadata', () => {
|
|
18
|
-
const rules: CSSRulesByBucket = {
|
|
19
|
-
m: [
|
|
20
|
-
['@media (min-width: 480px) { .foo { color: red; } }', { m: '(min-width: 480px)' }],
|
|
21
|
-
['@media (min-width: 480px) { .baz { color: pink; } }', { m: '(min-width: 480px)' }],
|
|
22
|
-
|
|
23
|
-
['@media (min-width: 600px) { .foo { color: red; } }', { m: '(min-width: 600px)' }],
|
|
24
|
-
['@media (min-width: 600px) { .foo { color: red; } }', { m: '(min-width: 600px)' }],
|
|
25
|
-
['@media (min-width: 600px) { .baz { color: pink; } }', { m: '(min-width: 600px)' }],
|
|
26
|
-
],
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
expect(dedupeCSSRules(rules)).toMatchObject({
|
|
30
|
-
m: [
|
|
31
|
-
['@media (min-width: 480px) { .foo { color: red; } }', { m: '(min-width: 480px)' }],
|
|
32
|
-
['@media (min-width: 480px) { .baz { color: pink; } }', { m: '(min-width: 480px)' }],
|
|
33
|
-
|
|
34
|
-
['@media (min-width: 600px) { .foo { color: red; } }', { m: '(min-width: 600px)' }],
|
|
35
|
-
['@media (min-width: 600px) { .baz { color: pink; } }', { m: '(min-width: 600px)' }],
|
|
36
|
-
],
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"allowJs": true,
|
|
5
|
-
"module": "NodeNext",
|
|
6
|
-
"moduleResolution": "NodeNext",
|
|
7
|
-
"target": "ES2022"
|
|
8
|
-
},
|
|
9
|
-
"files": [],
|
|
10
|
-
"include": [],
|
|
11
|
-
"references": [
|
|
12
|
-
{
|
|
13
|
-
"path": "./tsconfig.lib.json"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"path": "./tsconfig.spec.json"
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
}
|
package/tsconfig.lib.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"outDir": "../../dist/out-tsc",
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"types": ["node", "environment"]
|
|
9
|
-
},
|
|
10
|
-
"exclude": [
|
|
11
|
-
"__fixtures__/**/*",
|
|
12
|
-
"**/*.spec.ts",
|
|
13
|
-
"**/*.test.ts",
|
|
14
|
-
"jest.config.ts",
|
|
15
|
-
"vite.config.ts",
|
|
16
|
-
"vite.config.mts",
|
|
17
|
-
"vitest.config.ts",
|
|
18
|
-
"vitest.config.mts",
|
|
19
|
-
"src/**/*.test.ts",
|
|
20
|
-
"src/**/*.test.mts",
|
|
21
|
-
"src/**/*.spec.ts",
|
|
22
|
-
"src/**/*.test.tsx",
|
|
23
|
-
"src/**/*.spec.tsx",
|
|
24
|
-
"src/**/*.test.js",
|
|
25
|
-
"src/**/*.spec.js",
|
|
26
|
-
"src/**/*.test.jsx",
|
|
27
|
-
"src/**/*.spec.jsx"
|
|
28
|
-
],
|
|
29
|
-
"include": ["**/*.mts"]
|
|
30
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc",
|
|
5
|
-
"typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"],
|
|
6
|
-
"types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"]
|
|
7
|
-
},
|
|
8
|
-
"include": [
|
|
9
|
-
"vite.config.ts",
|
|
10
|
-
"vite.config.mts",
|
|
11
|
-
"vitest.config.ts",
|
|
12
|
-
"vitest.config.mts",
|
|
13
|
-
"src/**/*.test.ts",
|
|
14
|
-
"src/**/*.test.mts",
|
|
15
|
-
"src/**/*.spec.ts",
|
|
16
|
-
"src/**/*.test.tsx",
|
|
17
|
-
"src/**/*.spec.tsx",
|
|
18
|
-
"src/**/*.test.js",
|
|
19
|
-
"src/**/*.spec.js",
|
|
20
|
-
"src/**/*.test.jsx",
|
|
21
|
-
"src/**/*.spec.jsx",
|
|
22
|
-
"src/**/*.d.ts"
|
|
23
|
-
]
|
|
24
|
-
}
|
package/vitest.config.mts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vitest/config';
|
|
2
|
-
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
root: __dirname,
|
|
6
|
-
cacheDir: '../../node_modules/.vite/packages/transform',
|
|
7
|
-
plugins: [nxViteTsPaths()],
|
|
8
|
-
test: {
|
|
9
|
-
watch: false,
|
|
10
|
-
environment: 'node',
|
|
11
|
-
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
12
|
-
reporters: ['default'],
|
|
13
|
-
coverage: {
|
|
14
|
-
reportsDirectory: '../../coverage/packages/transform',
|
|
15
|
-
provider: 'v8',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
});
|