@compiled/webpack-loader 0.6.17 → 0.7.3

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 (114) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/{__tests__/fixtures/async.d.ts → __fixtures__/async-styles.d.ts} +0 -0
  3. package/dist/{__tests__/fixtures/async.js → __fixtures__/async-styles.js} +2 -2
  4. package/dist/__fixtures__/async-styles.js.map +1 -0
  5. package/dist/__fixtures__/babel.d.ts +2 -0
  6. package/dist/__fixtures__/babel.js +14 -0
  7. package/dist/__fixtures__/babel.js.map +1 -0
  8. package/dist/{__tests__/fixtures → __fixtures__}/binding-not-found.d.ts +1 -1
  9. package/dist/{__tests__/fixtures → __fixtures__}/binding-not-found.js +6 -9
  10. package/dist/__fixtures__/binding-not-found.js.map +1 -0
  11. package/dist/__fixtures__/common/colors.d.ts +7 -0
  12. package/dist/{__tests__/fixtures/imports → __fixtures__/common}/colors.js +5 -4
  13. package/dist/__fixtures__/common/colors.js.map +1 -0
  14. package/dist/__fixtures__/common/css-prop.d.ts +2 -0
  15. package/dist/__fixtures__/common/css-prop.js +9 -0
  16. package/dist/__fixtures__/common/css-prop.js.map +1 -0
  17. package/dist/__fixtures__/compiled-error.d.ts +2 -0
  18. package/dist/__fixtures__/compiled-error.js +10 -0
  19. package/dist/__fixtures__/compiled-error.js.map +1 -0
  20. package/dist/__fixtures__/important-styles.d.ts +3 -0
  21. package/dist/__fixtures__/important-styles.js +7 -0
  22. package/dist/__fixtures__/important-styles.js.map +1 -0
  23. package/dist/__fixtures__/lib/loader-alias.d.ts +1 -0
  24. package/dist/__fixtures__/lib/loader-alias.js +8 -0
  25. package/dist/__fixtures__/lib/loader-alias.js.map +1 -0
  26. package/dist/__fixtures__/lib/webpack-alias.d.ts +1 -0
  27. package/dist/__fixtures__/lib/webpack-alias.js +8 -0
  28. package/dist/__fixtures__/lib/webpack-alias.js.map +1 -0
  29. package/dist/__fixtures__/loader-alias.d.ts +2 -0
  30. package/dist/__fixtures__/loader-alias.js +12 -0
  31. package/dist/__fixtures__/loader-alias.js.map +1 -0
  32. package/dist/__fixtures__/local-styles.d.ts +2 -0
  33. package/dist/__fixtures__/local-styles.js +14 -0
  34. package/dist/__fixtures__/local-styles.js.map +1 -0
  35. package/dist/__fixtures__/no-compiled-styles.d.ts +0 -0
  36. package/dist/__fixtures__/no-compiled-styles.js +3 -0
  37. package/dist/__fixtures__/no-compiled-styles.js.map +1 -0
  38. package/dist/__fixtures__/relative-styles.d.ts +3 -0
  39. package/dist/__fixtures__/relative-styles.js +34 -0
  40. package/dist/__fixtures__/relative-styles.js.map +1 -0
  41. package/dist/__fixtures__/webpack-alias.d.ts +2 -0
  42. package/dist/__fixtures__/webpack-alias.js +12 -0
  43. package/dist/__fixtures__/webpack-alias.js.map +1 -0
  44. package/dist/compiled-loader.d.ts +4 -3
  45. package/dist/compiled-loader.js +53 -17
  46. package/dist/compiled-loader.js.map +1 -1
  47. package/dist/css-loader.d.ts +3 -3
  48. package/dist/css-loader.js +4 -1
  49. package/dist/css-loader.js.map +1 -1
  50. package/dist/extract-plugin.js +5 -5
  51. package/dist/extract-plugin.js.map +1 -1
  52. package/dist/index.d.ts +1 -0
  53. package/dist/types.d.ts +4 -58
  54. package/dist/{utils/webpack.d.ts → utils.d.ts} +1 -1
  55. package/dist/{utils/webpack.js → utils.js} +1 -1
  56. package/dist/utils.js.map +1 -0
  57. package/package.json +10 -9
  58. package/src/__fixtures__/async-styles.ts +1 -0
  59. package/src/__fixtures__/babel.tsx +11 -0
  60. package/src/{__tests__/fixtures → __fixtures__}/binding-not-found.tsx +2 -1
  61. package/src/{__tests__/fixtures/imports/colors.js → __fixtures__/common/colors.ts} +4 -3
  62. package/src/__fixtures__/common/css-prop.tsx +8 -0
  63. package/src/__fixtures__/compiled-error.tsx +7 -0
  64. package/src/__fixtures__/important-styles.tsx +6 -0
  65. package/src/__fixtures__/lib/babel-cjs.d.ts +3 -0
  66. package/src/{__tests__/fixtures/node_modules → __fixtures__/lib}/babel-cjs.js +0 -0
  67. package/src/__fixtures__/lib/babel-esm.d.ts +3 -0
  68. package/src/{__tests__/fixtures/node_modules → __fixtures__/lib}/babel-esm.js +0 -0
  69. package/src/__fixtures__/lib/loader-alias.ts +5 -0
  70. package/src/__fixtures__/lib/webpack-alias.ts +5 -0
  71. package/src/__fixtures__/loader-alias.tsx +8 -0
  72. package/src/__fixtures__/local-styles.tsx +14 -0
  73. package/src/__fixtures__/no-compiled-styles.ts +1 -0
  74. package/src/__fixtures__/relative-styles.tsx +39 -0
  75. package/src/__fixtures__/webpack-alias.tsx +8 -0
  76. package/src/__tests__/compiled-loader.test.tsx +70 -39
  77. package/src/__tests__/extract-plugin.test.tsx +82 -48
  78. package/src/__tests__/test-utils.tsx +103 -0
  79. package/src/compiled-loader.tsx +70 -34
  80. package/src/css-loader.tsx +9 -5
  81. package/src/extract-plugin.tsx +4 -3
  82. package/src/index.tsx +1 -0
  83. package/src/types.tsx +5 -60
  84. package/src/{utils/webpack.tsx → utils.tsx} +1 -1
  85. package/dist/__tests__/fixtures/async.js.map +0 -1
  86. package/dist/__tests__/fixtures/babel.d.ts +0 -1
  87. package/dist/__tests__/fixtures/babel.js +0 -14
  88. package/dist/__tests__/fixtures/babel.js.map +0 -1
  89. package/dist/__tests__/fixtures/binding-not-found.js.map +0 -1
  90. package/dist/__tests__/fixtures/important-styles.d.ts +0 -2
  91. package/dist/__tests__/fixtures/important-styles.js +0 -6
  92. package/dist/__tests__/fixtures/important-styles.js.map +0 -1
  93. package/dist/__tests__/fixtures/imports/colors.d.ts +0 -6
  94. package/dist/__tests__/fixtures/imports/colors.js.map +0 -1
  95. package/dist/__tests__/fixtures/imports/css-prop.d.ts +0 -1
  96. package/dist/__tests__/fixtures/imports/css-prop.js +0 -8
  97. package/dist/__tests__/fixtures/imports/css-prop.js.map +0 -1
  98. package/dist/__tests__/fixtures/multiple.d.ts +0 -2
  99. package/dist/__tests__/fixtures/multiple.js +0 -28
  100. package/dist/__tests__/fixtures/multiple.js.map +0 -1
  101. package/dist/__tests__/fixtures/single.d.ts +0 -2
  102. package/dist/__tests__/fixtures/single.js +0 -6
  103. package/dist/__tests__/fixtures/single.js.map +0 -1
  104. package/dist/__tests__/utils/webpack.d.ts +0 -6
  105. package/dist/__tests__/utils/webpack.js +0 -81
  106. package/dist/__tests__/utils/webpack.js.map +0 -1
  107. package/dist/utils/webpack.js.map +0 -1
  108. package/src/__tests__/fixtures/async.js +0 -1
  109. package/src/__tests__/fixtures/babel.js +0 -11
  110. package/src/__tests__/fixtures/important-styles.js +0 -5
  111. package/src/__tests__/fixtures/imports/css-prop.js +0 -4
  112. package/src/__tests__/fixtures/multiple.js +0 -28
  113. package/src/__tests__/fixtures/single.js +0 -5
  114. package/src/__tests__/utils/webpack.tsx +0 -88
package/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # @compiled/webpack-loader
2
2
 
3
+ ## 0.7.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 427cead: Compiled now supports turning on the `css` prop using jsx pragmas (both with `@jsx` and `@jsxImportSource`).
8
+ - 79cfb08: Internal refactor changing how the TypeScript compiler picks up source files.
9
+ - 79cfb08: Compiled's CSS loader now uses referential equality instead of pathname to determine if it needs to re-order itself from the last to first.
10
+ - Updated dependencies [79cfb08]
11
+ - Updated dependencies [14368bb]
12
+ - Updated dependencies [68ebac3]
13
+ - Updated dependencies [427cead]
14
+ - Updated dependencies [79cfb08]
15
+ - @compiled/babel-plugin@0.11.1
16
+ - @compiled/babel-plugin-strip-runtime@0.11.1
17
+ - @compiled/css@0.7.1
18
+ - @compiled/utils@0.6.12
19
+
20
+ ## 0.7.2
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [e015a3a]
25
+ - Updated dependencies [fa6af90]
26
+ - @compiled/babel-plugin@0.11.0
27
+
28
+ ## 0.7.1
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies [b68411c]
33
+ - Updated dependencies [53a3d71]
34
+ - @compiled/babel-plugin@0.10.0
35
+
36
+ ## 0.7.0
37
+
38
+ ### Minor Changes
39
+
40
+ - 0b60ae1: Use webpack resolution and add custom `resolve` override
41
+
42
+ ### Patch Changes
43
+
44
+ - Updated dependencies [0b60ae1]
45
+ - Updated dependencies [2092839]
46
+ - @compiled/babel-plugin@0.9.0
47
+
3
48
  ## 0.6.17
4
49
 
5
50
  ### Patch Changes
@@ -18,5 +18,5 @@ var __importStar = (this && this.__importStar) || function (mod) {
18
18
  __setModuleDefault(result, mod);
19
19
  return result;
20
20
  };
21
- Promise.resolve().then(() => __importStar(require('./imports/css-prop')));
22
- //# sourceMappingURL=async.js.map
21
+ Promise.resolve().then(() => __importStar(require('./common/css-prop')));
22
+ //# sourceMappingURL=async-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-styles.js","sourceRoot":"","sources":["../../src/__fixtures__/async-styles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,kDAAO,mBAAmB,IAAE"}
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const App: () => JSX.Element;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.App = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const babel_cjs_1 = __importDefault(require("./lib/babel-cjs"));
9
+ const babel_esm_1 = __importDefault(require("./lib/babel-esm"));
10
+ const App = () => (react_1.default.createElement(react_1.default.Fragment, null,
11
+ react_1.default.createElement(babel_cjs_1.default, null),
12
+ react_1.default.createElement(babel_esm_1.default, null)));
13
+ exports.App = App;
14
+ //# sourceMappingURL=babel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"babel.js","sourceRoot":"","sources":["../../src/__fixtures__/babel.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,gEAAuC;AACvC,gEAAuC;AAEhC,MAAM,GAAG,GAAG,GAAgB,EAAE,CAAC,CACpC;IACE,8BAAC,mBAAQ,OAAG;IACZ,8BAAC,mBAAQ,OAAG,CACX,CACJ,CAAC;AALW,QAAA,GAAG,OAKd"}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare const HeaderSpacing: React.ComponentType<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & import("@compiled/react/dist/esm/styled").StyledProps>;
2
+ export declare const HeaderSpacing: React.ComponentType<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & import("../../../react/src/styled").StyledProps>;
3
3
  interface HeaderProps {
4
4
  variant?: 'default' | 'invert';
5
5
  children: React.ReactNode;
@@ -10,15 +10,12 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  }
11
11
  return t;
12
12
  };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
13
  Object.defineProperty(exports, "__esModule", { value: true });
17
14
  exports.Header = exports.HeaderSpacing = void 0;
18
- const react_1 = __importDefault(require("react"));
19
- const react_2 = require("@compiled/react");
15
+ /** @jsx jsx */
16
+ const react_1 = require("@compiled/react");
20
17
  const height = '9rem';
21
- const StyledHeader = react_2.styled.header `
18
+ const StyledHeader = react_1.styled.header `
22
19
  height: ${height};
23
20
  display: flex;
24
21
  align-items: center;
@@ -34,14 +31,14 @@ const StyledHeader = react_2.styled.header `
34
31
  ${(props) => (props.variant === 'default' ? 'rgba(135, 119, 217, 0.2)' : 'transparent')};
35
32
  color: ${(props) => props.color};
36
33
  `;
37
- exports.HeaderSpacing = react_2.styled.div `
34
+ exports.HeaderSpacing = react_1.styled.div `
38
35
  height: ${height};
39
36
  `;
40
37
  const Header = (_a) => {
41
38
  var { children, variant = 'default' } = _a, props = __rest(_a, ["children", "variant"]);
42
39
  const color = variant === 'default' ? 'rgba(37, 56, 88, 0.9)' : 'rgba(255, 255, 255, 0.75)';
43
- return (react_1.default.createElement(StyledHeader, Object.assign({ variant: variant, color: color }, props),
44
- react_1.default.createElement("a", { href: "/", css: { textDecoration: 'none', color: 'currentColor' } }, "Compiled"),
40
+ return (react_1.jsx(StyledHeader, Object.assign({ variant: variant, color: color }, props),
41
+ react_1.jsx("a", { href: "/", css: { textDecoration: 'none', color: 'currentColor' } }, "Compiled"),
45
42
  children));
46
43
  };
47
44
  exports.Header = Header;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binding-not-found.js","sourceRoot":"","sources":["../../src/__fixtures__/binding-not-found.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,eAAe;AACf,2CAA8C;AAG9C,MAAM,MAAM,GAAG,MAAM,CAAC;AAEtB,MAAM,YAAY,GAAG,cAAM,CAAC,MAAM,CAGhC;YACU,MAAM;;;;;;;;;;;;MAYZ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,aAAa,CAAC;WAChF,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK;CAChC,CAAC;AAEW,QAAA,aAAa,GAAG,cAAM,CAAC,GAAG,CAAA;YAC3B,MAAM;CACjB,CAAC;AAOK,MAAM,MAAM,GAAG,CAAC,EAAwD,EAAe,EAAE;QAAzE,EAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,OAAyB,EAApB,KAAK,cAAzC,uBAA2C,CAAF;IAC9D,MAAM,KAAK,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,2BAA2B,CAAC;IAE5F,OAAO,CACL,YAAC,YAAY,kBAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,IAAM,KAAK;QACrD,mBAAG,IAAI,EAAC,GAAG,EAAC,GAAG,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,eAE9D;QACH,QAAQ,CACI,CAChB,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,MAAM,UAWjB"}
@@ -0,0 +1,7 @@
1
+ export declare const blue = "blue";
2
+ export declare const blueviolet = "blueviolet";
3
+ export declare const coral = "coral";
4
+ export declare const purple = "purple";
5
+ export declare const orange = "orange";
6
+ export declare const red = "red";
7
+ export declare const yellow = "yellow";
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.yellow = exports.orange = exports.red = exports.blue = exports.blueviolet = exports.purple = void 0;
4
- exports.purple = 'purple';
5
- exports.blueviolet = 'blueviolet';
3
+ exports.yellow = exports.red = exports.orange = exports.purple = exports.coral = exports.blueviolet = exports.blue = void 0;
6
4
  exports.blue = 'blue';
7
- exports.red = 'red';
5
+ exports.blueviolet = 'blueviolet';
6
+ exports.coral = 'coral';
7
+ exports.purple = 'purple';
8
8
  exports.orange = 'orange';
9
+ exports.red = 'red';
9
10
  exports.yellow = 'yellow';
10
11
  //# sourceMappingURL=colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.js","sourceRoot":"","sources":["../../../src/__fixtures__/common/colors.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,MAAM,CAAC;AACd,QAAA,UAAU,GAAG,YAAY,CAAC;AAC1B,QAAA,KAAK,GAAG,OAAO,CAAC;AAChB,QAAA,MAAM,GAAG,QAAQ,CAAC;AAClB,QAAA,MAAM,GAAG,QAAQ,CAAC;AAClB,QAAA,GAAG,GAAG,KAAK,CAAC;AACZ,QAAA,MAAM,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const Coral: () => JSX.Element;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Coral = void 0;
4
+ /** @jsx jsx */
5
+ const react_1 = require("@compiled/react");
6
+ const colors_1 = require("./colors");
7
+ const Coral = () => (react_1.jsx("div", { css: { color: colors_1.coral, border: `2px solid ${colors_1.coral}` } }));
8
+ exports.Coral = Coral;
9
+ //# sourceMappingURL=css-prop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-prop.js","sourceRoot":"","sources":["../../../src/__fixtures__/common/css-prop.tsx"],"names":[],"mappings":";;;AAAA,eAAe;AACf,2CAAsC;AAEtC,qCAAiC;AAE1B,MAAM,KAAK,GAAG,GAAgB,EAAE,CAAC,CACtC,qBAAK,GAAG,EAAE,EAAE,KAAK,EAAE,cAAK,EAAE,MAAM,EAAE,aAAa,cAAK,EAAE,EAAE,GAAI,CAC7D,CAAC;AAFW,QAAA,KAAK,SAEhB"}
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const App: () => JSX.Element;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.App = void 0;
4
+ /** @jsx jsx */
5
+ const react_1 = require("@compiled/react");
6
+ // @ts-expect-error
7
+ const styles = react_1.css(false);
8
+ const App = () => react_1.jsx("div", { css: styles });
9
+ exports.App = App;
10
+ //# sourceMappingURL=compiled-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiled-error.js","sourceRoot":"","sources":["../../src/__fixtures__/compiled-error.tsx"],"names":[],"mappings":";;;AAAA,eAAe;AACf,2CAA2C;AAE3C,mBAAmB;AACnB,MAAM,MAAM,GAAG,WAAG,CAAC,KAAK,CAAC,CAAC;AAEnB,MAAM,GAAG,GAAG,GAAgB,EAAE,CAAC,qBAAK,GAAG,EAAE,MAAM,GAAI,CAAC;AAA9C,QAAA,GAAG,OAA2C"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const Component: () => JSX.Element;
3
+ export default Component;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /** @jsx jsx */
4
+ const react_1 = require("@compiled/react");
5
+ const Component = () => react_1.jsx("div", { css: { fontSize: '12!important', color: 'blue' } });
6
+ exports.default = Component;
7
+ //# sourceMappingURL=important-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"important-styles.js","sourceRoot":"","sources":["../../src/__fixtures__/important-styles.tsx"],"names":[],"mappings":";;AAAA,eAAe;AACf,2CAAsC;AAEtC,MAAM,SAAS,GAAG,GAAgB,EAAE,CAAC,qBAAK,GAAG,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,GAAI,CAAC;AAE/F,kBAAe,SAAS,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const styles: import("@compiled/react").CSSProps;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.styles = void 0;
4
+ const react_1 = require("@compiled/react");
5
+ exports.styles = react_1.css({
6
+ color: 'indigo',
7
+ });
8
+ //# sourceMappingURL=loader-alias.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader-alias.js","sourceRoot":"","sources":["../../../src/__fixtures__/lib/loader-alias.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AAEzB,QAAA,MAAM,GAAG,WAAG,CAAC;IACxB,KAAK,EAAE,QAAQ;CAChB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const styles: import("@compiled/react").CSSProps;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.styles = void 0;
4
+ const react_1 = require("@compiled/react");
5
+ exports.styles = react_1.css({
6
+ color: 'blue',
7
+ });
8
+ //# sourceMappingURL=webpack-alias.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack-alias.js","sourceRoot":"","sources":["../../../src/__fixtures__/lib/webpack-alias.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AAEzB,QAAA,MAAM,GAAG,WAAG,CAAC;IACxB,KAAK,EAAE,MAAM;CACd,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const App: () => JSX.Element;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.App = void 0;
4
+ /** @jsx jsx */
5
+ // @ts-ignore This is a bug where the meta is not updated for the new file import
6
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
+ const react_1 = require("@compiled/react");
8
+ // @ts-expect-error
9
+ const loader_alias_1 = require("loader-alias");
10
+ const App = () => react_1.jsx("div", { css: loader_alias_1.styles });
11
+ exports.App = App;
12
+ //# sourceMappingURL=loader-alias.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader-alias.js","sourceRoot":"","sources":["../../src/__fixtures__/loader-alias.tsx"],"names":[],"mappings":";;;AAAA,eAAe;AACf,iFAAiF;AACjF,6DAA6D;AAC7D,2CAA2C;AAC3C,mBAAmB;AACnB,+CAAsC;AAE/B,MAAM,GAAG,GAAG,GAAgB,EAAE,CAAC,qBAAK,GAAG,EAAE,qBAAM,GAAI,CAAC;AAA9C,QAAA,GAAG,OAA2C"}
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const App: () => JSX.Element;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.App = void 0;
4
+ /** @jsx jsx */
5
+ const react_1 = require("@compiled/react");
6
+ const react_2 = require("react");
7
+ const Styled = react_1.styled.div({
8
+ color: 'blue',
9
+ });
10
+ const App = () => (react_1.jsx(react_2.Fragment, null,
11
+ react_1.jsx("div", { css: { fontSize: 14 } }),
12
+ react_1.jsx(Styled, null)));
13
+ exports.App = App;
14
+ //# sourceMappingURL=local-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-styles.js","sourceRoot":"","sources":["../../src/__fixtures__/local-styles.tsx"],"names":[],"mappings":";;;AAAA,eAAe;AACf,2CAA8C;AAC9C,iCAAiC;AAEjC,MAAM,MAAM,GAAG,cAAM,CAAC,GAAG,CAAC;IACxB,KAAK,EAAE,MAAM;CACd,CAAC,CAAC;AAEI,MAAM,GAAG,GAAG,GAAgB,EAAE,CAAC,CACpC,YAAC,gBAAQ;IACP,qBAAK,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAI;IAC9B,YAAC,MAAM,OAAG,CACD,CACZ,CAAC;AALW,QAAA,GAAG,OAKd"}
File without changes
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ console.log('Hello world!');
3
+ //# sourceMappingURL=no-compiled-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-compiled-styles.js","sourceRoot":"","sources":["../../src/__fixtures__/no-compiled-styles.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const Styled: import("react").ComponentType<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & import("../../../react/src/styled").StyledProps>;
3
+ export declare const App: () => JSX.Element;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.App = exports.Styled = void 0;
4
+ /** @jsx jsx */
5
+ const react_1 = require("@compiled/react");
6
+ const react_2 = require("react");
7
+ const colors_1 = require("./common/colors");
8
+ exports.Styled = react_1.styled.span `
9
+ color: ${colors_1.blueviolet};
10
+
11
+ :focus {
12
+ color: ${colors_1.purple};
13
+ }
14
+
15
+ :hover {
16
+ color: ${colors_1.blue};
17
+ }
18
+ `;
19
+ const styles = react_1.css `
20
+ color: ${colors_1.red};
21
+
22
+ :focus {
23
+ color: ${colors_1.orange};
24
+ }
25
+
26
+ :hover {
27
+ color: ${colors_1.yellow};
28
+ }
29
+ `;
30
+ const App = () => (react_1.jsx(react_2.Fragment, null,
31
+ react_1.jsx("div", { css: styles }),
32
+ react_1.jsx(exports.Styled, null)));
33
+ exports.App = App;
34
+ //# sourceMappingURL=relative-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relative-styles.js","sourceRoot":"","sources":["../../src/__fixtures__/relative-styles.tsx"],"names":[],"mappings":";;;AAAA,eAAe;AACf,2CAAmD;AACnD,iCAAiC;AAEjC,4CAAgF;AAKnE,QAAA,MAAM,GAAG,cAAM,CAAC,IAAI,CAAA;WACtB,mBAAU;;;aAGR,eAAM;;;;aAIN,aAAI;;CAEhB,CAAC;AAEF,MAAM,MAAM,GAAG,WAAG,CAAA;WACP,YAAG;;;aAGD,eAAM;;;;aAIN,eAAM;;CAElB,CAAC;AAEK,MAAM,GAAG,GAAG,GAAgB,EAAE,CAAC,CACpC,YAAC,gBAAQ;IACP,qBAAK,GAAG,EAAE,MAAM,GAAI;IACpB,YAAC,cAAM,OAAG,CACD,CACZ,CAAC;AALW,QAAA,GAAG,OAKd"}
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const App: () => JSX.Element;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.App = void 0;
4
+ /** @jsx jsx */
5
+ // @ts-expect-error This is a bug where the meta is not updated for the new file import
6
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
+ const react_1 = require("@compiled/react");
8
+ // @ts-expect-error
9
+ const webpack_alias_1 = require("webpack-alias");
10
+ const App = () => react_1.jsx("div", { css: webpack_alias_1.styles });
11
+ exports.App = App;
12
+ //# sourceMappingURL=webpack-alias.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack-alias.js","sourceRoot":"","sources":["../../src/__fixtures__/webpack-alias.tsx"],"names":[],"mappings":";;;AAAA,eAAe;AACf,uFAAuF;AACvF,6DAA6D;AAC7D,2CAA2C;AAC3C,mBAAmB;AACnB,iDAAuC;AAEhC,MAAM,GAAG,GAAG,GAAgB,EAAE,CAAC,qBAAK,GAAG,EAAE,sBAAM,GAAI,CAAC;AAA9C,QAAA,GAAG,OAA2C"}
@@ -1,9 +1,10 @@
1
- import type { CompiledLoaderOptions, LoaderThis } from './types';
1
+ import type { LoaderContext } from 'webpack';
2
+ import type { CompiledLoaderOptions } from './types';
2
3
  /**
3
4
  * Compiled webpack loader.
4
5
  *
5
6
  * @param this
6
7
  * @param code
7
8
  */
8
- export default function compiledLoader(this: LoaderThis<CompiledLoaderOptions>, code: string): Promise<void>;
9
- export declare function pitch(this: LoaderThis<CompiledLoaderOptions>): void;
9
+ export default function compiledLoader(this: LoaderContext<CompiledLoaderOptions>, code: string): Promise<void>;
10
+ export declare function pitch(this: LoaderContext<CompiledLoaderOptions>): void;
@@ -1,45 +1,67 @@
1
1
  "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
5
16
  Object.defineProperty(exports, "__esModule", { value: true });
6
17
  exports.pitch = void 0;
7
- const path_1 = __importDefault(require("path"));
18
+ const fs_1 = __importDefault(require("fs"));
19
+ const path_1 = require("path");
8
20
  const core_1 = require("@babel/core");
9
- const loader_utils_1 = require("loader-utils");
10
21
  const utils_1 = require("@compiled/utils");
22
+ const enhanced_resolve_1 = require("enhanced-resolve");
23
+ const loader_utils_1 = require("loader-utils");
11
24
  const extract_plugin_1 = require("./extract-plugin");
12
- const webpack_1 = require("./utils/webpack");
25
+ const utils_2 = require("./utils");
13
26
  let hasErrored = false;
14
27
  /**
15
28
  * Returns user configuration.
16
29
  *
17
- * @param loader
30
+ * @param context
18
31
  * @returns
19
32
  */
20
33
  function getLoaderOptions(context) {
21
- const { bake = true, extract = false, importReact = undefined, nonce = undefined, } = typeof context.getOptions === 'undefined'
34
+ const { bake = true, extract = false, importReact = undefined, nonce = undefined, resolve = {}, } = typeof context.getOptions === 'undefined'
22
35
  ? // Webpack v4 flow
23
36
  loader_utils_1.getOptions(context)
24
37
  : // Webpack v5 flow
25
38
  context.getOptions({
26
39
  type: 'object',
27
40
  properties: {
28
- importReact: {
41
+ bake: {
29
42
  type: 'boolean',
30
43
  },
31
- nonce: {
32
- type: 'string',
33
- },
34
44
  extract: {
35
45
  type: 'boolean',
36
46
  },
37
- bake: {
47
+ importReact: {
38
48
  type: 'boolean',
39
49
  },
50
+ nonce: {
51
+ type: 'string',
52
+ },
53
+ resolve: {
54
+ type: 'object',
55
+ },
40
56
  },
41
57
  });
42
- return { bake, extract, importReact, nonce };
58
+ return {
59
+ bake,
60
+ extract,
61
+ importReact,
62
+ nonce,
63
+ resolve,
64
+ };
43
65
  }
44
66
  /**
45
67
  * Compiled webpack loader.
@@ -48,7 +70,7 @@ function getLoaderOptions(context) {
48
70
  * @param code
49
71
  */
50
72
  async function compiledLoader(code) {
51
- var _a;
73
+ var _a, _b, _c;
52
74
  const callback = this.async();
53
75
  // Bail early if Compiled isn't in the module.
54
76
  if (code.indexOf('@compiled/react') === -1) {
@@ -57,13 +79,21 @@ async function compiledLoader(code) {
57
79
  try {
58
80
  const includedFiles = [];
59
81
  const foundCSSRules = [];
60
- const options = getLoaderOptions(this);
82
+ const _d = getLoaderOptions(this), { resolve } = _d, options = __rest(_d, ["resolve"]);
61
83
  // Transform to an AST using the local babel config.
62
84
  const ast = await core_1.parseAsync(code, {
63
85
  filename: this.resourcePath,
64
86
  caller: { name: 'compiled' },
65
87
  rootMode: 'upward-optional',
66
88
  });
89
+ // Setup the default resolver, where webpack will merge any passed in options with the default
90
+ // resolve configuration. Ideally, we use this.getResolve({ ...resolve, useSyncFileSystemCalls: true, })
91
+ // However, it does not work correctly when in development mode :/
92
+ const resolver = enhanced_resolve_1.ResolverFactory.createResolver(Object.assign(Object.assign(Object.assign({
93
+ // @ts-expect-error
94
+ fileSystem: new enhanced_resolve_1.CachedInputFileSystem(fs_1.default, 4000) }, ((_b = (_a = this._compilation) === null || _a === void 0 ? void 0 : _a.options.resolve) !== null && _b !== void 0 ? _b : {})), resolve), {
95
+ // This makes the resolver invoke the callback synchronously
96
+ useSyncFileSystemCalls: true }));
67
97
  // Transform using the Compiled Babel Plugin - we deliberately turn off using the local config.
68
98
  const result = await core_1.transformFromAstAsync(ast, code, {
69
99
  babelrc: false,
@@ -77,12 +107,17 @@ async function compiledLoader(code) {
77
107
  ],
78
108
  options.bake && [
79
109
  '@compiled/babel-plugin',
80
- Object.assign(Object.assign({}, options), { onIncludedFiles: (files) => includedFiles.push(...files) }),
110
+ Object.assign(Object.assign({}, options), { onIncludedFiles: (files) => includedFiles.push(...files), resolver: {
111
+ // The resolver needs to be synchronous, as babel plugins must be synchronous
112
+ resolveSync: (context, request) => {
113
+ return resolver.resolveSync({}, path_1.dirname(context), request);
114
+ },
115
+ } }),
81
116
  ],
82
117
  ].filter(utils_1.toBoolean),
83
118
  });
84
119
  includedFiles.forEach((file) => {
85
- this.addDependency(path_1.default.normalize(file));
120
+ this.addDependency(path_1.normalize(file));
86
121
  });
87
122
  let output = (result === null || result === void 0 ? void 0 : result.code) || '';
88
123
  if (options.extract && foundCSSRules.length) {
@@ -91,7 +126,7 @@ async function compiledLoader(code) {
91
126
  // The benefit is two fold:
92
127
  // (1) thread safe collection of styles
93
128
  // (2) caching -- resulting in faster builds (one import per rule!)
94
- const params = webpack_1.toURIComponent(rule);
129
+ const params = utils_2.toURIComponent(rule);
95
130
  // We use require instead of import so it works with both ESM and CJS source.
96
131
  // If we used ESM it would blow up with CJS source, unfortunately.
97
132
  output = `
@@ -99,7 +134,7 @@ async function compiledLoader(code) {
99
134
  ${output}`;
100
135
  });
101
136
  }
102
- callback(null, output, (_a = result === null || result === void 0 ? void 0 : result.map) !== null && _a !== void 0 ? _a : undefined);
137
+ callback(null, output, (_c = result === null || result === void 0 ? void 0 : result.map) !== null && _c !== void 0 ? _c : undefined);
103
138
  }
104
139
  catch (e) {
105
140
  const error = utils_1.createError('compiled-loader', 'Unhandled exception')(e.stack);
@@ -109,6 +144,7 @@ async function compiledLoader(code) {
109
144
  exports.default = compiledLoader;
110
145
  function pitch() {
111
146
  const options = getLoaderOptions(this);
147
+ // @ts-expect-error No definitions for this[pluginName]
112
148
  if (!hasErrored && options.extract && !this[extract_plugin_1.pluginName]) {
113
149
  this.emitError(utils_1.createError('webpack-loader')(`You forgot to add the 'CompiledExtractPlugin' plugin (i.e \`{ plugins: [new CompiledExtractPlugin()] }\`), please read https://compiledcssinjs.com/docs/css-extraction-webpack`));
114
150
  // We only want to error once, if we didn't do this you'd get an error for every file found.
@@ -1 +1 @@
1
- {"version":3,"file":"compiled-loader.js","sourceRoot":"","sources":["../src/compiled-loader.tsx"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,sCAAgE;AAChE,+CAA0C;AAC1C,2CAAyD;AAEzD,qDAA8C;AAC9C,6CAAiD;AAEjD,IAAI,UAAU,GAAG,KAAK,CAAC;AAEvB;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,OAA0C;IAClE,MAAM,EACJ,IAAI,GAAG,IAAI,EACX,OAAO,GAAG,KAAK,EACf,WAAW,GAAG,SAAS,EACvB,KAAK,GAAG,SAAS,GAClB,GACC,OAAO,OAAO,CAAC,UAAU,KAAK,WAAW;QACvC,CAAC,CAAC,kBAAkB;YAClB,yBAAU,CAAC,OAAO,CAAC;QACrB,CAAC,CAAC,kBAAkB;YAClB,OAAO,CAAC,UAAU,CAAC;gBACjB,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,WAAW,EAAE;wBACX,IAAI,EAAE,SA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I,CAAC,UAAU,IAAI,OAAO,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,2BAAU,CAAC,EAAE;QACvD,IAAI,CAAC,SAAS,CACZ,mBAAW,CAAC,gBAAgB,CAAC,CAC3B,gLAAgL,CACjL,CACF,CAAC;QAEF,4FAA4F;QAC5F,UAAU,GAAG,IAAI,CAAC;KACnB;AACH,CAAC;AAbD,sBAaC"}
1
+ {"version":3,"file":"compiled-loader.js","sourceRoot":"","sources":["../src/compiled-loader.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,+BAA0C;AAE1C,sCAAgE;AAChE,2CAAyD;AACzD,uDAA0E;AAC1E,+CAA0C;AAG1C,qDAA8C;AAE9C,mCAAyC;AAEzC,IAAI,UAAU,GAAG,KAAK,CAAC;AAEvB;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,OAA6C;IACrE,MAAM,EACJ,IAAI,GAAG,IAAI,EACX,OAAO,GAAG,KAAK,EACf,WAAW,GAAG,SAAS,EACvB,KAAK,GAAG,SAAS,EACjB,OAAO,GAAG,EAAE,GACb,GAA0B,OAAO,OAAO,CAAC,UAAU,KAAK,WAAW;QAClE,CAAC,CAAC,kBAAkB;YAClB,yBAAU,CAAC,OAAO,CAAC;QACrB,CAAC,CAAC,kBAAkB;YAClB,OAAO,CAAC,UAAU,CAAC;gBACjB,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,IAAI,EAAE;wBACJ,IAAI,EAAE,SAAS;qBAChB;oBACD,OAAO,EAAE;wBACP,IAAI,EAAE,SAAS;qBAChB;oBACD,WAAW,EAAE;wBACX,IAAI,EAAE,SAAS;qBAChB;oBACD,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;qBACf;oBACD,OAAO,EAAE;wBACP,IAAI,EAAE,QAAQ;qBACf;iBACF;aACF,CAAC,CAAC;IAEP,OAAO;QACL,IAAI;QACJ,OAAO;QACP,WAAW;QACX,KAAK;QACL,OAAO;KACR,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AAM,CAAE,GAAG,mCAAI,SAAS,CAAC,CAAC;KAClD;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,KAAK,GAAG,mBAAW,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC7E,QAAQ,CAAC,KAAK,CAAC,CAAC;KACjB;AACH,CAAC;AAzFD,iCAyFC;AAED,SAAgB,KAAK;IACnB,MAAM,OAAO,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAEvC,uDAAuD;IACvD,IAAI,CAAC,UAAU,IAAI,OAAO,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,2BAAU,CAAC,EAAE;QACvD,IAAI,CAAC,SAAS,CACZ,mBAAW,CAAC,gBAAgB,CAAC,CAC3B,gLAAgL,CACjL,CACF,CAAC;QAEF,4FAA4F;QAC5F,UAAU,GAAG,IAAI,CAAC;KACnB;AACH,CAAC;AAdD,sBAcC"}
@@ -1,9 +1,9 @@
1
- import type { LoaderThis } from './types';
1
+ import type { LoaderContext } from 'webpack';
2
2
  /**
3
3
  * CSSLoader will take the style query params added by `./compiled-loader.tsx` and turn it into CSS.
4
4
  */
5
- export default function CSSLoader(this: LoaderThis): string;
5
+ export default function CSSLoader(this: LoaderContext<void>): string;
6
6
  /**
7
7
  * Moves CSSloader to the end of the loader queue so it runs first.
8
8
  */
9
- export declare function pitch(this: LoaderThis): void;
9
+ export declare function pitch(this: LoaderContext<void>): void;
@@ -15,9 +15,12 @@ exports.default = CSSLoader;
15
15
  * Moves CSSloader to the end of the loader queue so it runs first.
16
16
  */
17
17
  function pitch() {
18
- if (this.loaders[0].path !== __filename) {
18
+ if (this.loaders[0].pitch !== pitch) {
19
+ // If the first loader isn't this one - skip.
19
20
  return;
20
21
  }
22
+ // The first loader is Compiled's css-loader - we need to shift
23
+ // it to be at the end of the loader chain so it runs first (instead of last).
21
24
  const firstLoader = this.loaders.shift();
22
25
  this.loaders.push(firstLoader);
23
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"css-loader.js","sourceRoot":"","sources":["../src/css-loader.tsx"],"names":[],"mappings":";;;AAAA,6BAAsC;AAGtC;;GAEG;AACH,SAAwB,SAAS;IAC/B,MAAM,KAAK,GAAG,IAAI,qBAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,SAAS,IAAI,EAAE,CAAC;AACzB,CAAC;AAJD,4BAIC;AAED;;GAEG;AACH,SAAgB,KAAK;IACnB,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,EAAE;QACvC,OAAO;KACR;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACzC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC;AAPD,sBAOC"}
1
+ {"version":3,"file":"css-loader.js","sourceRoot":"","sources":["../src/css-loader.tsx"],"names":[],"mappings":";;;AAAA,6BAAsC;AAItC;;GAEG;AACH,SAAwB,SAAS;IAC/B,MAAM,KAAK,GAAG,IAAI,qBAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,SAAS,IAAI,EAAE,CAAC;AACzB,CAAC;AAJD,4BAIC;AAED;;GAEG;AACH,SAAgB,KAAK;IACnB,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,EAAE;QACnC,6CAA6C;QAC7C,OAAO;KACR;IAED,+DAA+D;IAC/D,8EAA8E;IAC9E,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACzC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAY,CAAC,CAAC;AAClC,CAAC;AAVD,sBAUC"}