@vanilla-extract/vite-plugin 4.0.4 → 4.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.
@@ -28,7 +28,8 @@ function vanillaExtractPlugin({
28
28
  let resolvedId = filePath;
29
29
  if (filePath.startsWith(config.root) ||
30
30
  // In monorepos the absolute path will be outside of config.root, so we check that they have the same root on the file system
31
- path__default["default"].isAbsolute(filePath) && filePath.split(path__default["default"].sep)[1] === config.root.split(path__default["default"].sep)[1]) {
31
+ // Paths from vite are always normalized, so we have to use the posix path separator
32
+ path__default["default"].isAbsolute(filePath) && filePath.split(path__default["default"].posix.sep)[1] === config.root.split(path__default["default"].posix.sep)[1]) {
32
33
  resolvedId = filePath;
33
34
  } else {
34
35
  // In SSR mode we can have paths like /app/styles.css.ts
@@ -78,6 +79,8 @@ function vanillaExtractPlugin({
78
79
  async configResolved(_resolvedConfig) {
79
80
  config = _resolvedConfig;
80
81
  packageName = integration.getPackageInfo(config.root).name;
82
+ },
83
+ async buildStart() {
81
84
  if (mode !== 'transform') {
82
85
  var _configFile$config$pl;
83
86
  const {
@@ -94,7 +97,7 @@ function vanillaExtractPlugin({
94
97
  cssImportSpecifier: fileIdToVirtualId,
95
98
  viteConfig: {
96
99
  ...(configFile === null || configFile === void 0 ? void 0 : configFile.config),
97
- plugins: configFile === null || configFile === void 0 ? void 0 : (_configFile$config$pl = configFile.config.plugins) === null || _configFile$config$pl === void 0 ? void 0 : _configFile$config$pl.flat().filter(plugin => typeof plugin === 'object' && plugin !== null && 'name' in plugin &&
100
+ plugins: configFile === null || configFile === void 0 || (_configFile$config$pl = configFile.config.plugins) === null || _configFile$config$pl === void 0 ? void 0 : _configFile$config$pl.flat().filter(plugin => typeof plugin === 'object' && plugin !== null && 'name' in plugin &&
98
101
  // Prevent an infinite loop where the compiler creates a new instance of the plugin,
99
102
  // which creates a new compiler, which creates a new instance of the plugin, etc.
100
103
  plugin.name !== 'vanilla-extract' &&
@@ -109,7 +112,7 @@ function vanillaExtractPlugin({
109
112
  },
110
113
  buildEnd() {
111
114
  var _compiler;
112
- (_compiler = compiler) === null || _compiler === void 0 ? void 0 : _compiler.close();
115
+ (_compiler = compiler) === null || _compiler === void 0 || _compiler.close();
113
116
  },
114
117
  async transform(code, id) {
115
118
  const [validId] = id.split('?');
@@ -28,7 +28,8 @@ function vanillaExtractPlugin({
28
28
  let resolvedId = filePath;
29
29
  if (filePath.startsWith(config.root) ||
30
30
  // In monorepos the absolute path will be outside of config.root, so we check that they have the same root on the file system
31
- path__default["default"].isAbsolute(filePath) && filePath.split(path__default["default"].sep)[1] === config.root.split(path__default["default"].sep)[1]) {
31
+ // Paths from vite are always normalized, so we have to use the posix path separator
32
+ path__default["default"].isAbsolute(filePath) && filePath.split(path__default["default"].posix.sep)[1] === config.root.split(path__default["default"].posix.sep)[1]) {
32
33
  resolvedId = filePath;
33
34
  } else {
34
35
  // In SSR mode we can have paths like /app/styles.css.ts
@@ -78,6 +79,8 @@ function vanillaExtractPlugin({
78
79
  async configResolved(_resolvedConfig) {
79
80
  config = _resolvedConfig;
80
81
  packageName = integration.getPackageInfo(config.root).name;
82
+ },
83
+ async buildStart() {
81
84
  if (mode !== 'transform') {
82
85
  var _configFile$config$pl;
83
86
  const {
@@ -94,7 +97,7 @@ function vanillaExtractPlugin({
94
97
  cssImportSpecifier: fileIdToVirtualId,
95
98
  viteConfig: {
96
99
  ...(configFile === null || configFile === void 0 ? void 0 : configFile.config),
97
- plugins: configFile === null || configFile === void 0 ? void 0 : (_configFile$config$pl = configFile.config.plugins) === null || _configFile$config$pl === void 0 ? void 0 : _configFile$config$pl.flat().filter(plugin => typeof plugin === 'object' && plugin !== null && 'name' in plugin &&
100
+ plugins: configFile === null || configFile === void 0 || (_configFile$config$pl = configFile.config.plugins) === null || _configFile$config$pl === void 0 ? void 0 : _configFile$config$pl.flat().filter(plugin => typeof plugin === 'object' && plugin !== null && 'name' in plugin &&
98
101
  // Prevent an infinite loop where the compiler creates a new instance of the plugin,
99
102
  // which creates a new compiler, which creates a new instance of the plugin, etc.
100
103
  plugin.name !== 'vanilla-extract' &&
@@ -109,7 +112,7 @@ function vanillaExtractPlugin({
109
112
  },
110
113
  buildEnd() {
111
114
  var _compiler;
112
- (_compiler = compiler) === null || _compiler === void 0 ? void 0 : _compiler.close();
115
+ (_compiler = compiler) === null || _compiler === void 0 || _compiler.close();
113
116
  },
114
117
  async transform(code, id) {
115
118
  const [validId] = id.split('?');
@@ -20,7 +20,8 @@ function vanillaExtractPlugin({
20
20
  let resolvedId = filePath;
21
21
  if (filePath.startsWith(config.root) ||
22
22
  // In monorepos the absolute path will be outside of config.root, so we check that they have the same root on the file system
23
- path.isAbsolute(filePath) && filePath.split(path.sep)[1] === config.root.split(path.sep)[1]) {
23
+ // Paths from vite are always normalized, so we have to use the posix path separator
24
+ path.isAbsolute(filePath) && filePath.split(path.posix.sep)[1] === config.root.split(path.posix.sep)[1]) {
24
25
  resolvedId = filePath;
25
26
  } else {
26
27
  // In SSR mode we can have paths like /app/styles.css.ts
@@ -70,6 +71,8 @@ function vanillaExtractPlugin({
70
71
  async configResolved(_resolvedConfig) {
71
72
  config = _resolvedConfig;
72
73
  packageName = getPackageInfo(config.root).name;
74
+ },
75
+ async buildStart() {
73
76
  if (mode !== 'transform') {
74
77
  var _configFile$config$pl;
75
78
  const {
@@ -86,7 +89,7 @@ function vanillaExtractPlugin({
86
89
  cssImportSpecifier: fileIdToVirtualId,
87
90
  viteConfig: {
88
91
  ...(configFile === null || configFile === void 0 ? void 0 : configFile.config),
89
- plugins: configFile === null || configFile === void 0 ? void 0 : (_configFile$config$pl = configFile.config.plugins) === null || _configFile$config$pl === void 0 ? void 0 : _configFile$config$pl.flat().filter(plugin => typeof plugin === 'object' && plugin !== null && 'name' in plugin &&
92
+ plugins: configFile === null || configFile === void 0 || (_configFile$config$pl = configFile.config.plugins) === null || _configFile$config$pl === void 0 ? void 0 : _configFile$config$pl.flat().filter(plugin => typeof plugin === 'object' && plugin !== null && 'name' in plugin &&
90
93
  // Prevent an infinite loop where the compiler creates a new instance of the plugin,
91
94
  // which creates a new compiler, which creates a new instance of the plugin, etc.
92
95
  plugin.name !== 'vanilla-extract' &&
@@ -101,7 +104,7 @@ function vanillaExtractPlugin({
101
104
  },
102
105
  buildEnd() {
103
106
  var _compiler;
104
- (_compiler = compiler) === null || _compiler === void 0 ? void 0 : _compiler.close();
107
+ (_compiler = compiler) === null || _compiler === void 0 || _compiler.close();
105
108
  },
106
109
  async transform(code, id) {
107
110
  const [validId] = id.split('?');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanilla-extract/vite-plugin",
3
- "version": "4.0.4",
3
+ "version": "4.0.6",
4
4
  "description": "Zero-runtime Stylesheets-in-TypeScript",
5
5
  "main": "dist/vanilla-extract-vite-plugin.cjs.js",
6
6
  "module": "dist/vanilla-extract-vite-plugin.esm.js",
@@ -18,7 +18,7 @@
18
18
  "@vanilla-extract/integration": "^7.1.0"
19
19
  },
20
20
  "devDependencies": {
21
- "vite": "npm:vite@^5.0.11"
21
+ "vite": "^5.0.11"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "vite": "^4.0.3 || ^5.0.0"