@vanilla-extract/next-plugin 2.1.0 → 2.1.2

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/README.md CHANGED
@@ -34,7 +34,7 @@ Basically, it’s [“CSS Modules](https://github.com/css-modules/css-modules)-i
34
34
 
35
35
  ---
36
36
 
37
- 🖥   [Try it out for yourself in CodeSandbox.](https://codesandbox.io/s/github/seek-oss/vanilla-extract/tree/master/examples/webpack-react?file=/src/App.css.ts)
37
+ 🖥   [Try it out for yourself in CodeSandbox.](https://codesandbox.io/s/github/vanilla-extract-css/vanilla-extract/tree/master/examples/webpack-react?file=/src/App.css.ts)
38
38
 
39
39
  ---
40
40
 
@@ -0,0 +1,7 @@
1
+ import { VanillaExtractPlugin } from '@vanilla-extract/webpack-plugin';
2
+ import { NextConfig } from 'next/types';
3
+
4
+ type PluginOptions = ConstructorParameters<typeof VanillaExtractPlugin>[0];
5
+ declare const createVanillaExtractPlugin: (pluginOptions?: PluginOptions) => (nextConfig?: NextConfig) => NextConfig;
6
+
7
+ export { createVanillaExtractPlugin };
@@ -13,19 +13,17 @@ var browserslist__default = /*#__PURE__*/_interopDefault(browserslist);
13
13
 
14
14
  function getSupportedBrowsers(dir, isDevelopment) {
15
15
  let browsers;
16
-
17
16
  try {
18
17
  browsers = browserslist__default["default"].loadConfig({
19
18
  path: dir,
20
19
  env: isDevelopment ? 'development' : 'production'
21
20
  });
22
21
  } catch {}
23
-
24
22
  return browsers;
25
23
  }
26
-
27
24
  const createVanillaExtractPlugin = (pluginOptions = {}) => (nextConfig = {}) => Object.assign({}, nextConfig, {
28
25
  webpack(config, options) {
26
+ var _nextConfig$experimen;
29
27
  const {
30
28
  dir,
31
29
  dev,
@@ -43,18 +41,20 @@ const createVanillaExtractPlugin = (pluginOptions = {}) => (nextConfig = {}) =>
43
41
  isServer,
44
42
  isDevelopment: dev,
45
43
  future: nextConfig.future || {},
46
- experimental: nextConfig.experimental || {}
47
- }, () => css.lazyPostCSS(dir, getSupportedBrowsers(dir, dev)), [])
44
+ experimental: nextConfig.experimental || {},
45
+ // @ts-ignore -- 'appDir' config is in beta
46
+ hasAppDir: (_nextConfig$experimen = nextConfig.experimental) === null || _nextConfig$experimen === void 0 ? void 0 : _nextConfig$experimen.appDir
47
+ }, () => css.lazyPostCSS(dir, getSupportedBrowsers(dir, dev), undefined), [])
48
48
  });
49
- config.plugins.push(new webpackPlugin.VanillaExtractPlugin(pluginOptions));
50
-
49
+ config.plugins.push(new webpackPlugin.VanillaExtractPlugin({
50
+ outputCss: !isServer,
51
+ ...pluginOptions
52
+ }));
51
53
  if (typeof nextConfig.webpack === 'function') {
52
54
  return nextConfig.webpack(config, options);
53
55
  }
54
-
55
56
  return config;
56
57
  }
57
-
58
58
  });
59
59
 
60
60
  exports.createVanillaExtractPlugin = createVanillaExtractPlugin;
@@ -13,19 +13,17 @@ var browserslist__default = /*#__PURE__*/_interopDefault(browserslist);
13
13
 
14
14
  function getSupportedBrowsers(dir, isDevelopment) {
15
15
  let browsers;
16
-
17
16
  try {
18
17
  browsers = browserslist__default["default"].loadConfig({
19
18
  path: dir,
20
19
  env: isDevelopment ? 'development' : 'production'
21
20
  });
22
21
  } catch {}
23
-
24
22
  return browsers;
25
23
  }
26
-
27
24
  const createVanillaExtractPlugin = (pluginOptions = {}) => (nextConfig = {}) => Object.assign({}, nextConfig, {
28
25
  webpack(config, options) {
26
+ var _nextConfig$experimen;
29
27
  const {
30
28
  dir,
31
29
  dev,
@@ -43,18 +41,20 @@ const createVanillaExtractPlugin = (pluginOptions = {}) => (nextConfig = {}) =>
43
41
  isServer,
44
42
  isDevelopment: dev,
45
43
  future: nextConfig.future || {},
46
- experimental: nextConfig.experimental || {}
47
- }, () => css.lazyPostCSS(dir, getSupportedBrowsers(dir, dev)), [])
44
+ experimental: nextConfig.experimental || {},
45
+ // @ts-ignore -- 'appDir' config is in beta
46
+ hasAppDir: (_nextConfig$experimen = nextConfig.experimental) === null || _nextConfig$experimen === void 0 ? void 0 : _nextConfig$experimen.appDir
47
+ }, () => css.lazyPostCSS(dir, getSupportedBrowsers(dir, dev), undefined), [])
48
48
  });
49
- config.plugins.push(new webpackPlugin.VanillaExtractPlugin(pluginOptions));
50
-
49
+ config.plugins.push(new webpackPlugin.VanillaExtractPlugin({
50
+ outputCss: !isServer,
51
+ ...pluginOptions
52
+ }));
51
53
  if (typeof nextConfig.webpack === 'function') {
52
54
  return nextConfig.webpack(config, options);
53
55
  }
54
-
55
56
  return config;
56
57
  }
57
-
58
58
  });
59
59
 
60
60
  exports.createVanillaExtractPlugin = createVanillaExtractPlugin;
@@ -5,19 +5,17 @@ import { getGlobalCssLoader } from 'next/dist/build/webpack/config/blocks/css/lo
5
5
 
6
6
  function getSupportedBrowsers(dir, isDevelopment) {
7
7
  let browsers;
8
-
9
8
  try {
10
9
  browsers = browserslist.loadConfig({
11
10
  path: dir,
12
11
  env: isDevelopment ? 'development' : 'production'
13
12
  });
14
13
  } catch {}
15
-
16
14
  return browsers;
17
15
  }
18
-
19
16
  const createVanillaExtractPlugin = (pluginOptions = {}) => (nextConfig = {}) => Object.assign({}, nextConfig, {
20
17
  webpack(config, options) {
18
+ var _nextConfig$experimen;
21
19
  const {
22
20
  dir,
23
21
  dev,
@@ -35,18 +33,20 @@ const createVanillaExtractPlugin = (pluginOptions = {}) => (nextConfig = {}) =>
35
33
  isServer,
36
34
  isDevelopment: dev,
37
35
  future: nextConfig.future || {},
38
- experimental: nextConfig.experimental || {}
39
- }, () => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)), [])
36
+ experimental: nextConfig.experimental || {},
37
+ // @ts-ignore -- 'appDir' config is in beta
38
+ hasAppDir: (_nextConfig$experimen = nextConfig.experimental) === null || _nextConfig$experimen === void 0 ? void 0 : _nextConfig$experimen.appDir
39
+ }, () => lazyPostCSS(dir, getSupportedBrowsers(dir, dev), undefined), [])
40
40
  });
41
- config.plugins.push(new VanillaExtractPlugin(pluginOptions));
42
-
41
+ config.plugins.push(new VanillaExtractPlugin({
42
+ outputCss: !isServer,
43
+ ...pluginOptions
44
+ }));
43
45
  if (typeof nextConfig.webpack === 'function') {
44
46
  return nextConfig.webpack(config, options);
45
47
  }
46
-
47
48
  return config;
48
49
  }
49
-
50
50
  });
51
51
 
52
52
  export { createVanillaExtractPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanilla-extract/next-plugin",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Zero-runtime Stylesheets-in-TypeScript",
5
5
  "main": "dist/vanilla-extract-next-plugin.cjs.js",
6
6
  "module": "dist/vanilla-extract-next-plugin.esm.js",
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/seek-oss/vanilla-extract.git",
12
+ "url": "https://github.com/vanilla-extract-css/vanilla-extract.git",
13
13
  "directory": "packages/next-plugin"
14
14
  },
15
15
  "author": "SEEK",