@modular-css/vite 30.0.6 → 30.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-css/vite",
3
- "version": "30.0.6",
3
+ "version": "30.1.1",
4
4
  "description": "vite support for modular-css",
5
5
  "main": "./vite.js",
6
6
  "repository": {
@@ -31,6 +31,6 @@
31
31
  "@rollup/pluginutils": "^5.0.2"
32
32
  },
33
33
  "peerDependencies": {
34
- "vite": "^3 || ^4 || ^5"
34
+ "vite": "^3 || ^4 || ^5 || ^6"
35
35
  }
36
36
  }
package/vite.js CHANGED
@@ -151,7 +151,7 @@ module.exports = (
151
151
  },
152
152
 
153
153
  // Load the virtual CSS files
154
- async load(id, opts = false) {
154
+ async load(id) {
155
155
  log("load", id);
156
156
 
157
157
  // Only want this to run for the virtual CSS modules
@@ -168,24 +168,25 @@ module.exports = (
168
168
  }
169
169
 
170
170
  if(viteServer) {
171
- const node = await viteServer.moduleGraph.ensureEntryFromUrl(id);
171
+ const { moduleGraph } = this.environment || viteServer;
172
+ const thisModule = moduleGraph.getModuleById(id);
173
+
172
174
  const deps = graph.directDependenciesOf(fileKey(normalize(file)));
173
175
  const imported = filterByPrefix(FILE_PREFIX, deps).map((dep) => virtualize(slash(dep)));
174
176
 
175
- await Promise.all(imported.map((dep) => viteServer.moduleGraph.ensureEntryFromUrl(dep)));
177
+ await Promise.all(imported.map((dep) => moduleGraph.ensureEntryFromUrl(dep)));
176
178
 
177
179
  log("load deps", id, "=>", imported);
178
180
 
179
181
  const hmrDeps = imported;
180
182
 
181
- await viteServer.moduleGraph.updateModuleInfo(
182
- node,
183
+ await moduleGraph.updateModuleInfo(
184
+ thisModule,
183
185
  new Set(imported),
184
186
  null,
185
187
  new Set(hmrDeps),
186
188
  null,
187
- true,
188
- Boolean(opts.ssr),
189
+ false,
189
190
  );
190
191
  }
191
192
 
package/CHANGELOG.md DELETED
@@ -1,169 +0,0 @@
1
- # Change Log
2
-
3
- ## 30.0.6
4
-
5
- ### Patch Changes
6
-
7
- - Updated dependencies [[`d9db40b`](https://github.com/tivac/modular-css/commit/d9db40b08355ec13b7929edcb27dd1bc58454513)]:
8
- - @modular-css/processor@29.0.4
9
- - @modular-css/css-to-js@29.0.6
10
-
11
- ## 30.0.5
12
-
13
- ### Patch Changes
14
-
15
- - Updated dependencies [[`e7e8249`](https://github.com/tivac/modular-css/commit/e7e8249b780320ace068b854fbd9dd8e2591de2c)]:
16
- - @modular-css/css-to-js@29.0.5
17
-
18
- ## 30.0.4
19
-
20
- ### Patch Changes
21
-
22
- - [#998](https://github.com/tivac/modular-css/pull/998) [`5fa92ea`](https://github.com/tivac/modular-css/commit/5fa92ea620a698fa7238b67f7f604da00be8b776) Thanks [@tivac](https://github.com/tivac)! - Update `peerDependencies` to support `vite@5`
23
-
24
- ## 30.0.3
25
-
26
- ### Patch Changes
27
-
28
- - Updated dependencies [[`63af4ac3`](https://github.com/tivac/modular-css/commit/63af4ac3ee6380ede5396463fb0305bc14274d84)]:
29
- - @modular-css/css-to-js@29.0.3
30
- - @modular-css/processor@29.0.3
31
-
32
- ## 30.0.2
33
-
34
- ### Patch Changes
35
-
36
- - [#972](https://github.com/tivac/modular-css/pull/972) [`673df5d3`](https://github.com/tivac/modular-css/commit/673df5d345dead81f68eb6199757cfaf400f09a6) Thanks [@tivac](https://github.com/tivac)! - Improved vite integration, now correctly invalidating files when a file is changed or deleted.
37
- Improved invalidation in the processor, preventing stale `@value` or `composes` references from being output.
38
- - Updated dependencies [[`673df5d3`](https://github.com/tivac/modular-css/commit/673df5d345dead81f68eb6199757cfaf400f09a6)]:
39
- - @modular-css/processor@29.0.2
40
- - @modular-css/css-to-js@29.0.2
41
-
42
- ## 30.0.1
43
-
44
- ### Patch Changes
45
-
46
- - Updated dependencies [[`edbbe96`](https://github.com/tivac/modular-css/commit/edbbe9667fa4333913bb95cd8c7e67f386f57054), [`ffab76d`](https://github.com/tivac/modular-css/commit/ffab76d4428211ba33e6f7a6d518618b5cfdef00)]:
47
- - @modular-css/processor@29.0.1
48
- - @modular-css/css-to-js@29.0.1
49
-
50
- ## 30.0.0
51
-
52
- ### Major Changes
53
-
54
- - [`7488bb1`](https://github.com/tivac/modular-css/commit/7488bb12add1175e8c5a1be59ca97ea8207a9d98) Thanks [@tivac](https://github.com/tivac)! - All the various interfaces to `@modular-css/processor` need to be updated because of the breaking changes to composition rules in #926
55
-
56
- ### Patch Changes
57
-
58
- - Updated dependencies [[`7488bb1`](https://github.com/tivac/modular-css/commit/7488bb12add1175e8c5a1be59ca97ea8207a9d98), [`a61fa35`](https://github.com/tivac/modular-css/commit/a61fa35f81e0c5c181c425e596c27f017acd5096)]:
59
- - @modular-css/css-to-js@29.0.0
60
- - @modular-css/processor@29.0.0
61
-
62
- ## 29.1.3
63
-
64
- ### Patch Changes
65
-
66
- - [#919](https://github.com/tivac/modular-css/pull/919) [`989d1f0`](https://github.com/tivac/modular-css/commit/989d1f06caf0505d7cc7bfee52f29afd5a0a7760) Thanks [@tivac](https://github.com/tivac)! - Vite 4 support
67
-
68
- ## 29.1.2
69
-
70
- ### Patch Changes
71
-
72
- - Updated dependencies [[`8983ec7`](https://github.com/tivac/modular-css/commit/8983ec74fe945f2859c4078e66ef15095a75f9be)]:
73
- - @modular-css/processor@28.1.5
74
- - @modular-css/css-to-js@28.4.1
75
-
76
- ## 29.1.1
77
-
78
- ### Patch Changes
79
-
80
- - Updated dependencies [[`6211b85`](https://github.com/tivac/modular-css/commit/6211b859abf83f95ffcce0d741d9e82628f97eb5)]:
81
- - @modular-css/css-to-js@28.4.0
82
-
83
- ## 29.1.0
84
-
85
- ### Minor Changes
86
-
87
- - [#901](https://github.com/tivac/modular-css/pull/901) [`02bc885`](https://github.com/tivac/modular-css/commit/02bc88570045be3e6e23adff5411b6ad1883d104) Thanks [@plesiecki](https://github.com/plesiecki)! - New option to change type of variable declaration — `variableDeclaration` which defaults to `const`. Can be set to `var` if necessary, e.g. ES5 support.
88
-
89
- ### Patch Changes
90
-
91
- - Updated dependencies [[`02bc885`](https://github.com/tivac/modular-css/commit/02bc88570045be3e6e23adff5411b6ad1883d104)]:
92
- - @modular-css/css-to-js@28.3.0
93
-
94
- ## 29.0.2
95
-
96
- ### Patch Changes
97
-
98
- - Updated dependencies [[`b1af909`](https://github.com/tivac/modular-css/commit/b1af909ceaa2dbc4b54c376b9ed5a14a824c6e89)]:
99
- - @modular-css/css-to-js@28.2.4
100
-
101
- ## 29.0.1
102
-
103
- ### Patch Changes
104
-
105
- - Updated dependencies [[`daa9c53`](https://github.com/tivac/modular-css/commit/daa9c535e19f434e651fcbbbaf7cf48fa7b481ae)]:
106
- - @modular-css/processor@28.1.4
107
- - @modular-css/css-to-js@28.2.3
108
-
109
- ## 29.0.0
110
-
111
- ### Major Changes
112
-
113
- - [#874](https://github.com/tivac/modular-css/pull/874) [`65cc277`](https://github.com/tivac/modular-css/commit/65cc2775976570ad50c483abef664483f2b7edf9) Thanks [@Morklympious](https://github.com/Morklympious)! - Updated to support `vite@3`, but now no longer supports `vite@2` due to an API incompatibility between the versions.
114
-
115
- If you want to use `@modular-css/vite` with `vite@2` you'll need to stay on `@modular-css/vite@28.2.2`.
116
-
117
- ## 28.2.2
118
-
119
- ### Patch Changes
120
-
121
- - Updated dependencies [[`2a20cd5`](https://github.com/tivac/modular-css/commit/2a20cd528d3a1dd34d2f034400ce334aeffa09ec)]:
122
- - @modular-css/css-to-js@28.2.2
123
-
124
- ## 28.2.1
125
-
126
- ### Patch Changes
127
-
128
- - Updated dependencies [[`c19671f`](https://github.com/tivac/modular-css/commit/c19671fb8c4798d98a79e6f1d09cfc26e8a12eb7), [`c19671f`](https://github.com/tivac/modular-css/commit/c19671fb8c4798d98a79e6f1d09cfc26e8a12eb7), [`c19671f`](https://github.com/tivac/modular-css/commit/c19671fb8c4798d98a79e6f1d09cfc26e8a12eb7)]:
129
- - @modular-css/css-to-js@28.2.1
130
-
131
- All notable changes to this project will be documented in this file.
132
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
133
-
134
- # [28.2.0](https://github.com/tivac/modular-css/compare/v28.1.4...v28.2.0) (2022-06-20)
135
-
136
- **Note:** Version bump only for package @modular-css/vite
137
-
138
- ## [28.1.4](https://github.com/tivac/modular-css/compare/v28.1.3...v28.1.4) (2022-06-16)
139
-
140
- **Note:** Version bump only for package @modular-css/vite
141
-
142
- ## [28.1.3](https://github.com/tivac/modular-css/compare/v28.1.2...v28.1.3) (2022-06-15)
143
-
144
- **Note:** Version bump only for package @modular-css/vite
145
-
146
- ## [28.1.2](https://github.com/tivac/modular-css/compare/v28.1.1...v28.1.2) (2022-05-25)
147
-
148
- **Note:** Version bump only for package @modular-css/vite
149
-
150
- ## [28.1.1](https://github.com/tivac/modular-css/compare/v28.1.0...v28.1.1) (2022-04-08)
151
-
152
- **Note:** Version bump only for package @modular-css/vite
153
-
154
- # [28.0.0](https://github.com/tivac/modular-css/compare/v27.2.0...v28.0.0) (2022-02-25)
155
-
156
- **Note:** Version bump only for package @modular-css/vite
157
-
158
- ## [27.1.1](https://github.com/tivac/modular-css/compare/v27.1.0...v27.1.1) (2022-02-09)
159
-
160
- ### Bug Fixes
161
-
162
- - **vite:** non-win32 file resolution ([#809](https://github.com/tivac/modular-css/issues/809)) ([115c517](https://github.com/tivac/modular-css/commit/115c517ca5f4586619db2207d1d37675981237c6))
163
-
164
- # [27.1.0](https://github.com/tivac/modular-css/compare/v27.0.3...v27.1.0) (2022-02-03)
165
-
166
- ### Features
167
-
168
- - **vite:** vite plugin ([46c80da](https://github.com/tivac/modular-css/commit/46c80dab3c552b5ddf2c43683984d6c9112ecd39))
169
- - **www:** m-css.com on sveltekit ([d434f92](https://github.com/tivac/modular-css/commit/d434f927a4201df8d66cd7ed5ea2be63daa42b7a))
@@ -1,5 +0,0 @@
1
- .a {
2
- composes: c from "../shared/dynamic-c.mcss";
3
-
4
- color: red;
5
- }
@@ -1,5 +0,0 @@
1
- .b {
2
- composes: c from "../shared/dynamic-c.mcss";
3
-
4
- color: white;
5
- }
@@ -1,9 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <body>
4
- <div id="a">A</div>
5
-
6
- <div id="b">B</div>
7
-
8
- <script type="module" src="./script.js"></script>
9
- </body>
@@ -1,13 +0,0 @@
1
- const aEl = document.querySelector("#a");
2
- const bEl = document.querySelector("#b");
3
-
4
- (async function() {
5
- const a = await import("./a.mcss");
6
- const b = await import("./b.mcss");
7
-
8
- console.log({ a, b });
9
-
10
- aEl.className = a.a;
11
- bEl.className = b.b;
12
- }());
13
-
File without changes
@@ -1,6 +0,0 @@
1
- .c {
2
- background-color: blue;
3
-
4
- width: 100px;
5
- height: 100px;
6
- }
@@ -1,6 +0,0 @@
1
- .c {
2
- background-color: blue;
3
-
4
- width: 100px;
5
- height: 100px;
6
- }
@@ -1,5 +0,0 @@
1
- .a {
2
- composes: c from "../shared/static-c.mcss";
3
-
4
- color: red;
5
- }
@@ -1,5 +0,0 @@
1
- .b {
2
- composes: c from "../shared/static-c.mcss";
3
-
4
- color: white;
5
- }
@@ -1,9 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <body>
4
- <div id="a">A</div>
5
-
6
- <div id="b">B</div>
7
-
8
- <script type="module" src="./script.js"></script>
9
- </body>
@@ -1,10 +0,0 @@
1
- import a from "./a.mcss";
2
- import b from "./b.mcss";
3
-
4
- console.log({ a, b });
5
-
6
- const aEl = document.querySelector("#a");
7
- const bEl = document.querySelector("#b");
8
-
9
- aEl.className = a.a;
10
- bEl.className = b.b;
@@ -1,25 +0,0 @@
1
- import { test as testBase, expect } from "@playwright/test";
2
-
3
- const test = testBase.extend({
4
- dir : [ "static", { option : true }],
5
- });
6
-
7
- test("style ordering", async ({ page, dir }) => {
8
- await page.goto(`/${dir}/`);
9
-
10
- const a = await page.getByText("A");
11
-
12
- await expect(a).toBeVisible();
13
-
14
- await expect(a).toHaveCSS("background-color", "rgb(0, 0, 255)");
15
- await expect(a).toHaveCSS("color", "rgb(255, 0, 0)");
16
- await expect(a).toHaveClass("mc_c mc_a");
17
-
18
- const b = await page.getByText("B");
19
-
20
- await expect(b).toBeVisible();
21
-
22
- await expect(b).toHaveCSS("background-color", "rgb(0, 0, 255)");
23
- await expect(b).toHaveCSS("color", "rgb(255, 255, 255)");
24
- await expect(b).toHaveClass("mc_c mc_b");
25
- });