@compiled/webpack-loader 0.7.0 → 0.7.5

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 (61) hide show
  1. package/dist/__fixtures__/babel.d.ts +1 -0
  2. package/dist/__fixtures__/babel.js.map +1 -1
  3. package/dist/__fixtures__/binding-not-found.d.ts +1 -1
  4. package/dist/__fixtures__/binding-not-found.js +6 -9
  5. package/dist/__fixtures__/binding-not-found.js.map +1 -1
  6. package/dist/__fixtures__/common/css-prop.d.ts +1 -1
  7. package/dist/__fixtures__/common/css-prop.js +3 -6
  8. package/dist/__fixtures__/common/css-prop.js.map +1 -1
  9. package/dist/__fixtures__/compiled-error.d.ts +1 -0
  10. package/dist/__fixtures__/compiled-error.js +4 -7
  11. package/dist/__fixtures__/compiled-error.js.map +1 -1
  12. package/dist/__fixtures__/important-styles.d.ts +1 -1
  13. package/dist/__fixtures__/important-styles.js +3 -6
  14. package/dist/__fixtures__/important-styles.js.map +1 -1
  15. package/dist/__fixtures__/loader-alias.d.ts +1 -0
  16. package/dist/__fixtures__/loader-alias.js +5 -5
  17. package/dist/__fixtures__/loader-alias.js.map +1 -1
  18. package/dist/__fixtures__/local-styles.d.ts +1 -0
  19. package/dist/__fixtures__/local-styles.js +7 -9
  20. package/dist/__fixtures__/local-styles.js.map +1 -1
  21. package/dist/__fixtures__/relative-styles.d.ts +2 -2
  22. package/dist/__fixtures__/relative-styles.js +8 -10
  23. package/dist/__fixtures__/relative-styles.js.map +1 -1
  24. package/dist/__fixtures__/webpack-alias.d.ts +1 -0
  25. package/dist/__fixtures__/webpack-alias.js +5 -5
  26. package/dist/__fixtures__/webpack-alias.js.map +1 -1
  27. package/dist/compiled-loader.js +3 -2
  28. package/dist/compiled-loader.js.map +1 -1
  29. package/dist/css-loader.js +4 -1
  30. package/dist/css-loader.js.map +1 -1
  31. package/dist/extract-plugin.js.map +1 -1
  32. package/dist/utils.d.ts +1 -1
  33. package/package.json +11 -12
  34. package/src/__fixtures__/babel.tsx +1 -0
  35. package/src/__fixtures__/binding-not-found.tsx +2 -1
  36. package/src/__fixtures__/common/css-prop.tsx +3 -2
  37. package/src/__fixtures__/compiled-error.tsx +2 -2
  38. package/src/__fixtures__/important-styles.tsx +2 -2
  39. package/src/__fixtures__/lib/babel-cjs.d.ts +3 -0
  40. package/src/__fixtures__/lib/babel-esm.d.ts +3 -0
  41. package/src/__fixtures__/loader-alias.tsx +4 -4
  42. package/src/__fixtures__/local-styles.tsx +5 -4
  43. package/src/__fixtures__/relative-styles.tsx +6 -4
  44. package/src/__fixtures__/webpack-alias.tsx +4 -4
  45. package/src/__tests__/compiled-loader.test.tsx +1 -0
  46. package/src/__tests__/extract-plugin.test.tsx +12 -17
  47. package/src/__tests__/test-utils.tsx +3 -2
  48. package/src/compiled-loader.tsx +7 -5
  49. package/src/css-loader.tsx +5 -1
  50. package/src/extract-plugin.tsx +3 -2
  51. package/src/utils.tsx +1 -1
  52. package/CHANGELOG.md +0 -111
  53. package/dist/__fixtures__/lib/babel-cjs.d.ts +0 -3
  54. package/dist/__fixtures__/lib/babel-cjs.js +0 -129
  55. package/dist/__fixtures__/lib/babel-cjs.js.map +0 -1
  56. package/dist/__fixtures__/lib/babel-esm.d.ts +0 -1
  57. package/dist/__fixtures__/lib/babel-esm.js +0 -128
  58. package/dist/__fixtures__/lib/babel-esm.js.map +0 -1
  59. package/dist/__tests__/test-utils.d.ts +0 -8
  60. package/dist/__tests__/test-utils.js +0 -91
  61. package/dist/__tests__/test-utils.js.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import { join } from 'path';
2
+
2
3
  import { bundle as bundleEntry } from './test-utils';
3
4
  import type { BundleOptions } from './test-utils';
4
5
 
@@ -23,7 +24,7 @@ describe('CompiledExtractPlugin', () => {
23
24
  message: expect.stringContaining("You forgot to add the 'CompiledExtractPlugin' plugin"),
24
25
  }),
25
26
  ]);
26
- });
27
+ }, 10000);
27
28
 
28
29
  it('extracts local styles', async () => {
29
30
  const actual = await bundle(join(fixturesPath, 'local-styles.tsx'));
@@ -33,7 +34,7 @@ describe('CompiledExtractPlugin', () => {
33
34
  ._syaz13q2{color:blue}
34
35
  "
35
36
  `);
36
- });
37
+ }, 10000);
37
38
 
38
39
  it('extracts styles imported through a relative path', async () => {
39
40
  const actual = await bundle(join(fixturesPath, 'relative-styles.tsx'));
@@ -49,7 +50,7 @@ describe('CompiledExtractPlugin', () => {
49
50
  ._30l313q2:hover{color:blue}
50
51
  "
51
52
  `);
52
- });
53
+ }, 10000);
53
54
 
54
55
  it('extracts styles imported through a webpack alias', async () => {
55
56
  const assets = await bundle(join(fixturesPath, 'webpack-alias.tsx'));
@@ -58,7 +59,7 @@ describe('CompiledExtractPlugin', () => {
58
59
  "._syaz13q2{color:blue}
59
60
  "
60
61
  `);
61
- });
62
+ }, 10000);
62
63
 
63
64
  it('extracts styles imported through an overridden resolve configuration', async () => {
64
65
  const assets = await bundle(join(fixturesPath, 'loader-alias.tsx'), {
@@ -74,20 +75,14 @@ describe('CompiledExtractPlugin', () => {
74
75
  "._syaz1if8{color:indigo}
75
76
  "
76
77
  `);
77
- });
78
+ }, 10000);
78
79
 
79
80
  it('extracts styles from an async chunk', async () => {
80
81
  const actual = await bundle(join(fixturesPath, 'async-styles.ts'));
81
82
 
82
83
  // Only generate one CSS bundle
83
- expect(Object.keys(actual)).toMatchInlineSnapshot(`
84
- Array [
85
- "main.js",
86
- "377.js",
87
- "static/compiled-css.css",
88
- "377.js.LICENSE.txt",
89
- ]
90
- `);
84
+ const cssFiles = Object.keys(actual).filter((key) => key.endsWith('.css'));
85
+ expect(cssFiles).toHaveLength(1);
91
86
 
92
87
  // Extract the styles into said bundle
93
88
  expect(actual[assetName]).toMatchInlineSnapshot(`
@@ -95,7 +90,7 @@ describe('CompiledExtractPlugin', () => {
95
90
  ._syaz1vyr{color:coral}
96
91
  "
97
92
  `);
98
- });
93
+ }, 10000);
99
94
 
100
95
  it('extracts styles from a pre-built babel files', async () => {
101
96
  const actual = await bundle(join(fixturesPath, 'babel.tsx'));
@@ -111,7 +106,7 @@ describe('CompiledExtractPlugin', () => {
111
106
  ._syaz13q2{color:blue}
112
107
  "
113
108
  `);
114
- });
109
+ }, 10000);
115
110
 
116
111
  it('extracts important styles', async () => {
117
112
  const actual = await bundle(join(fixturesPath, 'important-styles.tsx'));
@@ -121,7 +116,7 @@ describe('CompiledExtractPlugin', () => {
121
116
  ._1wybc038{font-size:12!important}
122
117
  "
123
118
  `);
124
- });
119
+ }, 10000);
125
120
 
126
121
  it('should find bindings', async () => {
127
122
  const actual = await bundle(join(fixturesPath, 'binding-not-found.tsx'));
@@ -152,5 +147,5 @@ describe('CompiledExtractPlugin', () => {
152
147
  ._4t3i1jdh{height:9rem}
153
148
  "
154
149
  `);
155
- });
150
+ }, 10000);
156
151
  });
@@ -1,6 +1,7 @@
1
- import { createFsFromVolume, Volume } from 'memfs';
2
- import MiniCssExtractPlugin from 'mini-css-extract-plugin';
3
1
  import { join } from 'path';
2
+
3
+ import { Volume, createFsFromVolume } from 'memfs';
4
+ import MiniCssExtractPlugin from 'mini-css-extract-plugin';
4
5
  import webpack from 'webpack';
5
6
 
6
7
  import { CompiledExtractPlugin } from '../index';
@@ -1,9 +1,10 @@
1
- import { transformFromAstAsync, parseAsync } from '@babel/core';
2
- import { toBoolean, createError } from '@compiled/utils';
3
- import { CachedInputFileSystem, ResolverFactory } from 'enhanced-resolve';
4
1
  import fs from 'fs';
5
- import { getOptions } from 'loader-utils';
6
2
  import { dirname, normalize } from 'path';
3
+
4
+ import { parseAsync, transformFromAstAsync } from '@babel/core';
5
+ import { createError, toBoolean } from '@compiled/utils';
6
+ import { CachedInputFileSystem, ResolverFactory } from 'enhanced-resolve';
7
+ import { getOptions } from 'loader-utils';
7
8
  import type { LoaderContext } from 'webpack';
8
9
 
9
10
  import { pluginName } from './extract-plugin';
@@ -150,7 +151,8 @@ export default async function compiledLoader(
150
151
  }
151
152
 
152
153
  callback(null, output, result?.map ?? undefined);
153
- } catch (e) {
154
+ } catch (e: unknown) {
155
+ // @ts-expect-error Not checking for error type
154
156
  const error = createError('compiled-loader', 'Unhandled exception')(e.stack);
155
157
  callback(error);
156
158
  }
@@ -1,4 +1,5 @@
1
1
  import { URLSearchParams } from 'url';
2
+
2
3
  import type { LoaderContext } from 'webpack';
3
4
 
4
5
  /**
@@ -14,10 +15,13 @@ export default function CSSLoader(this: LoaderContext<void>): string {
14
15
  * Moves CSSloader to the end of the loader queue so it runs first.
15
16
  */
16
17
  export function pitch(this: LoaderContext<void>): void {
17
- if (this.loaders[0].path !== __filename) {
18
+ if (this.loaders[0].pitch !== pitch) {
19
+ // If the first loader isn't this one - skip.
18
20
  return;
19
21
  }
20
22
 
23
+ // The first loader is Compiled's css-loader - we need to shift
24
+ // it to be at the end of the loader chain so it runs first (instead of last).
21
25
  const firstLoader = this.loaders.shift();
22
26
  this.loaders.push(firstLoader!);
23
27
  }
@@ -1,6 +1,7 @@
1
1
  import { sort } from '@compiled/css';
2
- import { toBoolean, createError } from '@compiled/utils';
3
- import type { Compiler, Compilation } from 'webpack';
2
+ import { createError, toBoolean } from '@compiled/utils';
3
+ import type { Compilation, Compiler } from 'webpack';
4
+
4
5
  import type { CompiledExtractPluginOptions } from './types';
5
6
  import {
6
7
  getAssetSourceContents,
package/src/utils.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import type { Compiler, Compilation as CompilationType, sources } from 'webpack';
1
+ import type { Compilation as CompilationType, Compiler, sources } from 'webpack';
2
2
 
3
3
  /**
4
4
  * Gets the normal module hook for webpack 4 & webpack 5.
package/CHANGELOG.md DELETED
@@ -1,111 +0,0 @@
1
- # @compiled/webpack-loader
2
-
3
- ## 0.7.0
4
-
5
- ### Minor Changes
6
-
7
- - 0b60ae1: Use webpack resolution and add custom `resolve` override
8
-
9
- ### Patch Changes
10
-
11
- - Updated dependencies [0b60ae1]
12
- - Updated dependencies [2092839]
13
- - @compiled/babel-plugin@0.9.0
14
-
15
- ## 0.6.17
16
-
17
- ### Patch Changes
18
-
19
- - Updated dependencies [53935b3]
20
- - @compiled/babel-plugin@0.8.0
21
-
22
- ## 0.6.16
23
-
24
- ### Patch Changes
25
-
26
- - Updated dependencies [bcb2a68]
27
- - Updated dependencies [a7ab8e1]
28
- - Updated dependencies [e1dc346]
29
- - Updated dependencies [bcb2a68]
30
- - Updated dependencies [48805ec]
31
- - Updated dependencies [587e729]
32
- - @compiled/babel-plugin@0.7.0
33
- - @compiled/css@0.7.0
34
-
35
- ## 0.6.15
36
-
37
- ### Patch Changes
38
-
39
- - 40bc0d9: Package descriptions have been updated.
40
- - Updated dependencies [40bc0d9]
41
- - Updated dependencies [1b1c964]
42
- - Updated dependencies [1b1c964]
43
- - @compiled/babel-plugin@0.6.13
44
- - @compiled/babel-plugin-strip-runtime@0.6.13
45
- - @compiled/css@0.6.11
46
- - @compiled/utils@0.6.11
47
-
48
- ## 0.6.14
49
-
50
- ### Patch Changes
51
-
52
- - ad512ec: Fixed extraction when `!important` styles were found.
53
-
54
- ## 0.6.13
55
-
56
- ### Patch Changes
57
-
58
- - 6a7261e: Programmatic babel use now searches upwards for a project root, and if found will use that config. This fixes issues in some monorepo setups.
59
- - 8a13ee9: The loader now only errors once when running without the webpack extract plugin.
60
- - Updated dependencies [b92eb6d]
61
- - @compiled/babel-plugin-strip-runtime@0.6.11
62
-
63
- ## 0.6.12
64
-
65
- ### Patch Changes
66
-
67
- - 4032cd4: The `importReact` option now correctly defaults to `true`.
68
-
69
- ## 0.6.11
70
-
71
- ### Patch Changes
72
-
73
- - 37108e4: Fixed webpack 4 flow throwing unexpectedly.
74
- - 37108e4: Added missing babel dependency.
75
- - 37108e4: Fixed css loader entrypoint not making its way to npm.
76
- - 37108e4: Compiled dependencies are now using carat range.
77
- - 37108e4: Fixed bug picking up an unexpected asset during webpack compilation.
78
- - Updated dependencies [992e401]
79
- - Updated dependencies [37108e4]
80
- - @compiled/utils@0.6.10
81
- - @compiled/babel-plugin@0.6.10
82
- - @compiled/css@0.6.10
83
-
84
- ## 0.6.10
85
-
86
- ### Patch Changes
87
-
88
- - 660309a: Support for webpack 4 has been added, follow the [extraction guide](https://compiledcssinjs.com/docs/css-extraction-webpack) to get started.
89
-
90
- ## 0.6.9
91
-
92
- ### Patch Changes
93
-
94
- - 0bb1c11: Added new option `extract` with pairing webpack plugin `CompiledExtractPlugin`.
95
- Configuring them will strip all the runtime from your app and extract all styles to an atomic style sheet.
96
-
97
- For help getting started with this feature read the [CSS extraction guide](https://compiledcssinjs.com/docs/css-extraction-webpack) for webpack.
98
-
99
- - Updated dependencies [0bb1c11]
100
- - Updated dependencies [0bb1c11]
101
- - @compiled/css@0.6.9
102
- - @compiled/utils@0.6.9
103
- - @compiled/babel-plugin@0.6.9
104
-
105
- ## 0.6.8
106
-
107
- ### Patch Changes
108
-
109
- - aea3504: Packages now released with [changesets](https://github.com/atlassian/changesets).
110
- - Updated dependencies [aea3504]
111
- - @compiled/babel-plugin@0.6.8
@@ -1,3 +0,0 @@
1
- export var __esModule: boolean;
2
- export default BabelComponent;
3
- declare function BabelComponent(_ref2: any): any;
@@ -1,129 +0,0 @@
1
- /* index.js generated by @compiled/babel-plugin v0.6.7 */
2
- 'use strict';
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true,
5
- });
6
- exports.default = BabelComponent;
7
- var _react = require('react');
8
- var _runtime = require('@compiled/react/runtime');
9
- var _jsxRuntime = require('react/jsx-runtime');
10
- var _8 = '._19pk1ul9{margin-top:30px}';
11
- function ownKeys(object, enumerableOnly) {
12
- var keys = Object.keys(object);
13
- if (Object.getOwnPropertySymbols) {
14
- var symbols = Object.getOwnPropertySymbols(object);
15
- if (enumerableOnly)
16
- symbols = symbols.filter(function (sym) {
17
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
18
- });
19
- keys.push.apply(keys, symbols);
20
- }
21
- return keys;
22
- }
23
- function _objectSpread(target) {
24
- for (var i = 1; i < arguments.length; i++) {
25
- var source = arguments[i] != null ? arguments[i] : {};
26
- if (i % 2) {
27
- ownKeys(Object(source), true).forEach(function (key) {
28
- _defineProperty(target, key, source[key]);
29
- });
30
- }
31
- else if (Object.getOwnPropertyDescriptors) {
32
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
33
- }
34
- else {
35
- ownKeys(Object(source)).forEach(function (key) {
36
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
37
- });
38
- }
39
- }
40
- return target;
41
- }
42
- function _defineProperty(obj, key, value) {
43
- if (key in obj) {
44
- Object.defineProperty(obj, key, {
45
- value: value,
46
- enumerable: true,
47
- configurable: true,
48
- writable: true,
49
- });
50
- }
51
- else {
52
- obj[key] = value;
53
- }
54
- return obj;
55
- }
56
- function _objectWithoutProperties(source, excluded) {
57
- if (source == null)
58
- return {};
59
- var target = _objectWithoutPropertiesLoose(source, excluded);
60
- var key, i;
61
- if (Object.getOwnPropertySymbols) {
62
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
63
- for (i = 0; i < sourceSymbolKeys.length; i++) {
64
- key = sourceSymbolKeys[i];
65
- if (excluded.indexOf(key) >= 0)
66
- continue;
67
- if (!Object.prototype.propertyIsEnumerable.call(source, key))
68
- continue;
69
- target[key] = source[key];
70
- }
71
- }
72
- return target;
73
- }
74
- function _objectWithoutPropertiesLoose(source, excluded) {
75
- if (source == null)
76
- return {};
77
- var target = {};
78
- var sourceKeys = Object.keys(source);
79
- var key, i;
80
- for (i = 0; i < sourceKeys.length; i++) {
81
- key = sourceKeys[i];
82
- if (excluded.indexOf(key) >= 0)
83
- continue;
84
- target[key] = source[key];
85
- }
86
- return target;
87
- }
88
- var _7 = '._19bvftgi{padding-left:8px}';
89
- var _6 = '._n3tdftgi{padding-bottom:8px}';
90
- var _5 = '._u5f3ftgi{padding-right:8px}';
91
- var _4 = '._ca0qftgi{padding-top:8px}';
92
- var _3 = '._19itlf8h{border:2px solid blue}';
93
- var _2 = '._1wyb1ul9{font-size:30px}';
94
- var _ = '._syaz13q2{color:blue}';
95
- var Button = (0, _react.forwardRef)(function (_ref, ref) {
96
- var _ref$as = _ref.as, C = _ref$as === void 0 ? 'button' : _ref$as, style = _ref.style, props = _objectWithoutProperties(_ref, ['as', 'style']);
97
- return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_runtime.CC, {
98
- children: [
99
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_runtime.CS, {
100
- children: [_, _2, _3, _4, _5, _6, _7],
101
- }),
102
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(C, _objectSpread(_objectSpread({}, props), {}, {
103
- style: style,
104
- ref: ref,
105
- className: (0, _runtime.ax)([
106
- '_syaz13q2 _1wyb1ul9 _19itlf8h _ca0qftgi _u5f3ftgi _n3tdftgi _19bvftgi',
107
- props.className,
108
- ]),
109
- })),
110
- ],
111
- });
112
- });
113
- function BabelComponent(_ref2) {
114
- var children = _ref2.children;
115
- return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_runtime.CC, {
116
- children: [
117
- /*#__PURE__*/ (0, _jsxRuntime.jsx)(_runtime.CS, {
118
- children: [_8],
119
- }),
120
- /*#__PURE__*/ (0, _jsxRuntime.jsx)('div', {
121
- className: (0, _runtime.ax)(['_19pk1ul9']),
122
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(Button, {
123
- children: children,
124
- }),
125
- }),
126
- ],
127
- });
128
- }
129
- //# sourceMappingURL=babel-cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"babel-cjs.js","sourceRoot":"","sources":["../../../src/__fixtures__/lib/babel-cjs.js"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,YAAY,CAAC;AAEb,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE;IAC3C,KAAK,EAAE,IAAI;CACZ,CAAC,CAAC;AACH,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC;AAEjC,IAAI,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAE9B,IAAI,QAAQ,GAAG,OAAO,CAAC,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AAC,KAAK,EAAE;gBACxC,SAAS,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;gBAC1C,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE;oBACnD,QAAQ,EAAE,QAAQ;iBACnB,CAAC;aACH,CAAC;SACH;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -1 +0,0 @@
1
- export default function BabelComponent(_ref2: any): any;
@@ -1,128 +0,0 @@
1
- "use strict";
2
- /* index.js generated by @compiled/babel-plugin v0.6.7 */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const react_1 = require("react");
5
- var _8 = '._19pk1ul9{margin-top:30px}';
6
- function ownKeys(object, enumerableOnly) {
7
- var keys = Object.keys(object);
8
- if (Object.getOwnPropertySymbols) {
9
- var symbols = Object.getOwnPropertySymbols(object);
10
- if (enumerableOnly)
11
- symbols = symbols.filter(function (sym) {
12
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
13
- });
14
- keys.push.apply(keys, symbols);
15
- }
16
- return keys;
17
- }
18
- function _objectSpread(target) {
19
- for (var i = 1; i < arguments.length; i++) {
20
- var source = arguments[i] != null ? arguments[i] : {};
21
- if (i % 2) {
22
- ownKeys(Object(source), true).forEach(function (key) {
23
- _defineProperty(target, key, source[key]);
24
- });
25
- }
26
- else if (Object.getOwnPropertyDescriptors) {
27
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
28
- }
29
- else {
30
- ownKeys(Object(source)).forEach(function (key) {
31
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
32
- });
33
- }
34
- }
35
- return target;
36
- }
37
- function _defineProperty(obj, key, value) {
38
- if (key in obj) {
39
- Object.defineProperty(obj, key, {
40
- value: value,
41
- enumerable: true,
42
- configurable: true,
43
- writable: true,
44
- });
45
- }
46
- else {
47
- obj[key] = value;
48
- }
49
- return obj;
50
- }
51
- function _objectWithoutProperties(source, excluded) {
52
- if (source == null)
53
- return {};
54
- var target = _objectWithoutPropertiesLoose(source, excluded);
55
- var key, i;
56
- if (Object.getOwnPropertySymbols) {
57
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
58
- for (i = 0; i < sourceSymbolKeys.length; i++) {
59
- key = sourceSymbolKeys[i];
60
- if (excluded.indexOf(key) >= 0)
61
- continue;
62
- if (!Object.prototype.propertyIsEnumerable.call(source, key))
63
- continue;
64
- target[key] = source[key];
65
- }
66
- }
67
- return target;
68
- }
69
- function _objectWithoutPropertiesLoose(source, excluded) {
70
- if (source == null)
71
- return {};
72
- var target = {};
73
- var sourceKeys = Object.keys(source);
74
- var key, i;
75
- for (i = 0; i < sourceKeys.length; i++) {
76
- key = sourceKeys[i];
77
- if (excluded.indexOf(key) >= 0)
78
- continue;
79
- target[key] = source[key];
80
- }
81
- return target;
82
- }
83
- const runtime_1 = require("@compiled/react/runtime");
84
- const jsx_runtime_1 = require("react/jsx-runtime");
85
- const jsx_runtime_2 = require("react/jsx-runtime");
86
- var _7 = '._19bvftgi{padding-left:8px}';
87
- var _6 = '._n3tdftgi{padding-bottom:8px}';
88
- var _5 = '._u5f3ftgi{padding-right:8px}';
89
- var _4 = '._ca0qftgi{padding-top:8px}';
90
- var _3 = '._19itlf8h{border:2px solid blue}';
91
- var _2 = '._1wyb1ul9{font-size:30px}';
92
- var _ = '._syaz13q2{color:blue}';
93
- var Button = react_1.forwardRef(function (_ref, ref) {
94
- var _ref$as = _ref.as, C = _ref$as === void 0 ? 'button' : _ref$as, style = _ref.style, props = _objectWithoutProperties(_ref, ['as', 'style']);
95
- return /*#__PURE__*/ jsx_runtime_2.jsxs(runtime_1.CC, {
96
- children: [
97
- /*#__PURE__*/ jsx_runtime_1.jsx(runtime_1.CS, {
98
- children: [_, _2, _3, _4, _5, _6, _7],
99
- }),
100
- /*#__PURE__*/ jsx_runtime_1.jsx(C, _objectSpread(_objectSpread({}, props), {}, {
101
- style: style,
102
- ref: ref,
103
- className: runtime_1.ax([
104
- '_syaz13q2 _1wyb1ul9 _19itlf8h _ca0qftgi _u5f3ftgi _n3tdftgi _19bvftgi',
105
- props.className,
106
- ]),
107
- })),
108
- ],
109
- });
110
- });
111
- function BabelComponent(_ref2) {
112
- var children = _ref2.children;
113
- return /*#__PURE__*/ jsx_runtime_2.jsxs(runtime_1.CC, {
114
- children: [
115
- /*#__PURE__*/ jsx_runtime_1.jsx(runtime_1.CS, {
116
- children: [_8],
117
- }),
118
- /*#__PURE__*/ jsx_runtime_1.jsx('div', {
119
- className: runtime_1.ax(['_19pk1ul9']),
120
- children: /*#__PURE__*/ jsx_runtime_1.jsx(Button, {
121
- children: children,
122
- }),
123
- }),
124
- ],
125
- });
126
- }
127
- exports.default = BabelComponent;
128
- //# sourceMappingURL=babel-esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"babel-esm.js","sourceRoot":"","sources":["../../../src/__fixtures__/lib/babel-esm.js"],"names":[],"mappings":";AAAA,yDAAyD;;AAEzD,iCAAmC;AACnC,IAAI,EAAE,GAAG,6BAA6B,CAAC;AAEvC,SAAS,OAAO,CAAC,MAAM,EAAE,cAAc;IACrC,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,MAAM,CAAC,qBAAqB,EAAE;QAChC,IAAI,OAAO,GAAG,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;QACnD,IAAI,cAAc;YAChB,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,GAAG;gBACpC,OAAO,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC;YACjE,CAAC,CAAC,CAAC;QACL,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KAChC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,aAAa,CAAC,MAAM;IAC3B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CAAC,CAAC;AACH,SAAwB,cAAc,CAAC,KAAK;IAC1C,IAAI,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IAC9B,OAAO,aAAa,CAAC,kBAAK,CAAC,YAAE,EAAE;QAC7B,QAAQ,EAAE;YACR,aAAa,CAAC,iBAAI,CAAC,YAAE,EAAE;gBACrB,QAAQ,EAAE,CAAC,EAAE,CAAC;aACf,CAAC;YACF,aAAa,CAAC,iBAAI,CAAC,KAAK,EAAE;gBACxB,SAAS,EAAE,YAAE,CAAC,CAAC,WAAW,CAAC,CAAC;gBAC5B,QAAQ,EAAE,aAAa,CAAC,iBAAI,CAAC,MAAM,EAAE;oBACnC,QAAQ,EAAE,QAAQ;iBACnB,CAAC;aACH,CAAC;SACH;KACF,CAAC,CAAC;AACL,CAAC;AAfD,iCAeC"}
@@ -1,8 +0,0 @@
1
- import type { ResolveOptions } from '../index';
2
- export interface BundleOptions {
3
- extract?: boolean;
4
- disableExtractPlugin?: boolean;
5
- mode: 'development' | 'production';
6
- resolve?: ResolveOptions;
7
- }
8
- export declare function bundle(entry: string, { extract, disableExtractPlugin, mode, resolve }: BundleOptions): Promise<Record<string, string>>;
@@ -1,91 +0,0 @@
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.bundle = void 0;
7
- const memfs_1 = require("memfs");
8
- const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
9
- const path_1 = require("path");
10
- const webpack_1 = __importDefault(require("webpack"));
11
- const index_1 = require("../index");
12
- function bundle(entry, { extract = false, disableExtractPlugin = false, mode, resolve = {} }) {
13
- const outputPath = path_1.join(__dirname, 'dist');
14
- const compiler = webpack_1.default({
15
- entry,
16
- mode,
17
- module: {
18
- rules: [
19
- {
20
- test: /\.[jt]sx?$/,
21
- exclude: /node_modules/,
22
- use: [
23
- {
24
- loader: 'babel-loader',
25
- options: {
26
- babelrc: false,
27
- configFile: false,
28
- presets: ['@babel/preset-env', '@babel/preset-typescript', '@babel/preset-react'],
29
- },
30
- },
31
- {
32
- loader: '@compiled/webpack-loader',
33
- options: {
34
- extract,
35
- importReact: false,
36
- resolve,
37
- },
38
- },
39
- ],
40
- },
41
- {
42
- test: /\.css$/i,
43
- sideEffects: true,
44
- use: [mini_css_extract_plugin_1.default.loader, 'css-loader'],
45
- },
46
- ],
47
- },
48
- optimization: {
49
- usedExports: false,
50
- },
51
- output: {
52
- filename: '[name].js',
53
- path: outputPath,
54
- },
55
- plugins: [
56
- new mini_css_extract_plugin_1.default({ filename: 'static/[name].css' }),
57
- ...(disableExtractPlugin ? [] : [new index_1.CompiledExtractPlugin()]),
58
- ],
59
- resolve: {
60
- alias: {
61
- 'webpack-alias': path_1.join(__dirname, '..', '__fixtures__', 'lib', 'webpack-alias.ts'),
62
- },
63
- extensions: ['.tsx', '.ts', '.jsx', '.js'],
64
- },
65
- });
66
- const fs = memfs_1.createFsFromVolume(new memfs_1.Volume());
67
- // @ts-ignore
68
- compiler.outputFileSystem = fs;
69
- // @ts-ignore
70
- compiler.intermediateFileSystem = fs;
71
- return new Promise((resolve, reject) => {
72
- compiler.run((err, stats) => {
73
- if (err) {
74
- reject(err);
75
- return;
76
- }
77
- if (stats === null || stats === void 0 ? void 0 : stats.hasErrors()) {
78
- reject(stats.toJson().errors);
79
- return;
80
- }
81
- const assets = {};
82
- Object.keys((stats === null || stats === void 0 ? void 0 : stats.compilation.assets) || {}).map((name) => {
83
- const file = fs.readFileSync(path_1.join(outputPath, name), { encoding: 'utf-8' });
84
- assets[name] = file;
85
- });
86
- resolve(assets);
87
- });
88
- });
89
- }
90
- exports.bundle = bundle;
91
- //# sourceMappingURL=test-utils.js.map