@modular-css/vite 27.1.0 → 28.1.1

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 (3) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/package.json +4 -4
  3. package/vite.js +15 -14
package/CHANGELOG.md CHANGED
@@ -3,6 +3,33 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [28.1.1](https://github.com/tivac/modular-css/compare/v28.1.0...v28.1.1) (2022-04-08)
7
+
8
+ **Note:** Version bump only for package @modular-css/vite
9
+
10
+
11
+
12
+
13
+
14
+ # [28.0.0](https://github.com/tivac/modular-css/compare/v27.2.0...v28.0.0) (2022-02-25)
15
+
16
+ **Note:** Version bump only for package @modular-css/vite
17
+
18
+
19
+
20
+
21
+
22
+ ## [27.1.1](https://github.com/tivac/modular-css/compare/v27.1.0...v27.1.1) (2022-02-09)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **vite:** non-win32 file resolution ([#809](https://github.com/tivac/modular-css/issues/809)) ([115c517](https://github.com/tivac/modular-css/commit/115c517ca5f4586619db2207d1d37675981237c6))
28
+
29
+
30
+
31
+
32
+
6
33
  # [27.1.0](https://github.com/tivac/modular-css/compare/v27.0.3...v27.1.0) (2022-02-03)
7
34
 
8
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-css/vite",
3
- "version": "27.1.0",
3
+ "version": "28.1.1",
4
4
  "description": "vite support for modular-css",
5
5
  "main": "./vite.js",
6
6
  "repository": {
@@ -26,12 +26,12 @@
26
26
  "postcss"
27
27
  ],
28
28
  "dependencies": {
29
- "@modular-css/css-to-js": "^27.1.0",
30
- "@modular-css/processor": "^27.1.0",
29
+ "@modular-css/css-to-js": "^28.1.1",
30
+ "@modular-css/processor": "^28.0.0",
31
31
  "@rollup/pluginutils": "^4.1.2"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "vite": "^2.7.3"
35
35
  },
36
- "gitHead": "e302570bde992b563a69bad58245c68adda65504"
36
+ "gitHead": "90370d2b7007deb078d3acd2716b0a35a98f6c78"
37
37
  }
package/vite.js CHANGED
@@ -31,10 +31,6 @@ const virtualize = (file) => `${file}?${CSS_QUERY}`;
31
31
  const devirtualize = (file) => `${file.split("?")[0]}`;
32
32
  const isVirtual = (file) => file.endsWith(`?${CSS_QUERY}`);
33
33
 
34
- // NOTE: Can't use basic isAbsolute check because of paths vite passes in. On windows they can be
35
- // "/foo/bar/baz.mcss" which isAbsolute will treat as absolute, even though it definitely isn't
36
- const isPartial = (file) => (process.platform !== "win32" ? !path.isAbsolute(file) : path.parse(file).root === "/");
37
-
38
34
  module.exports = (
39
35
  /* istanbul ignore next: too painful to test */
40
36
  pluginOptions = {}
@@ -89,15 +85,26 @@ module.exports = (
89
85
  Object.keys(processor.files).forEach((file) => this.addWatchFile(file));
90
86
  },
91
87
 
92
- resolveId(source) {
88
+ async resolveId(source) {
89
+ // Only care about our particular type of virtual file
93
90
  if(!isVirtual(source)) {
94
91
  return null;
95
92
  }
96
93
 
94
+ log("resolving", source);
95
+
97
96
  let resolved = source;
97
+
98
+ // Check file as passed (minus the query params)
99
+ if(processor.has(devirtualize(resolved))) {
100
+ return resolved;
101
+ }
102
+
103
+ resolved = path.join(process.cwd(), resolved);
98
104
 
99
- if(isPartial(resolved)) {
100
- resolved = path.join(process.cwd(), resolved);
105
+ // Check file as an asbolute path (minus the query params)
106
+ if(!processor.has(devirtualize(resolved))) {
107
+ return null;
101
108
  }
102
109
 
103
110
  resolved = slash(resolved);
@@ -118,15 +125,9 @@ module.exports = (
118
125
 
119
126
  log("loading", id);
120
127
 
121
- let file = devirtualize(id);
122
-
123
- if(isPartial(file)) {
124
- file = path.join(process.cwd(), file);
125
- }
128
+ const file = devirtualize(id);
126
129
 
127
130
  if(!processor.has(file)) {
128
- log("no loading", file);
129
-
130
131
  return null;
131
132
  }
132
133