rainbowindex 0.2.2 → 0.4.0

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/dist/vite.mjs CHANGED
@@ -1,42 +1,59 @@
1
1
  import {
2
2
  postcss_default
3
- } from "./chunk-CUUW2K35.mjs";
4
- import "./chunk-FHATRQMN.mjs";
3
+ } from "./chunk-TLR6RP5L.mjs";
4
+ import "./chunk-4SVFFDS2.mjs";
5
5
  import {
6
+ isSourceFile
7
+ } from "./chunk-3HRMFZGE.mjs";
8
+ import {
9
+ DIRECTIVE_TYPE_NAMES,
6
10
  expandApplyGroups,
7
11
  findClosingBrace,
8
12
  hasRIActivation,
9
13
  isAtRuleBoundary,
10
- isAtRuleNameChar,
11
- isSourceFile
12
- } from "./chunk-W6XIBM4M.mjs";
14
+ isAtRuleNameChar
15
+ } from "./chunk-6DAHUFNU.mjs";
13
16
  import {
14
17
  devWarn
15
- } from "./chunk-SOMDX7V6.mjs";
18
+ } from "./chunk-5Y7EXXLS.mjs";
16
19
 
17
20
  // src/integrations/vite.ts
18
21
  import { existsSync } from "fs";
19
- import { access, readFile, readdir } from "fs/promises";
22
+ import { access, readdir, readFile } from "fs/promises";
20
23
  import { join, relative, resolve } from "path";
21
- var CSS_FILE_RE = /\.(?:module\.)?css$/;
22
- var REMOVAL_BODY_DIRECTIVES = /* @__PURE__ */ new Set([
23
- "color",
24
- "text",
25
- "spacing",
26
- "breakpoint",
27
- "rounded",
28
- "shadow",
29
- "weight",
30
- "ease",
31
- "blur",
32
- "z",
33
- "animate",
34
- "leading",
35
- "tracking",
36
- "opacity",
37
- "duration"
38
- ]);
39
- var KEYWORD_BODY_DIRECTIVES = /* @__PURE__ */ new Set(["fluid"]);
24
+
25
+ // src/directives/postcss-safe.ts
26
+ var BODY_GRAMMAR = {
27
+ color: "removal",
28
+ text: "removal",
29
+ spacing: "removal",
30
+ breakpoint: "removal",
31
+ rounded: "removal",
32
+ shadow: "removal",
33
+ weight: "removal",
34
+ ease: "removal",
35
+ blur: "removal",
36
+ z: "removal",
37
+ animate: "removal",
38
+ leading: "removal",
39
+ tracking: "removal",
40
+ opacity: "removal",
41
+ duration: "removal",
42
+ fluid: "keyword",
43
+ font: "raw",
44
+ preflight: "raw",
45
+ utility: "raw",
46
+ custom: "raw",
47
+ source: "raw",
48
+ layer: "raw",
49
+ register: "raw"
50
+ };
51
+ var REMOVAL_BODY_DIRECTIVES = new Set(
52
+ DIRECTIVE_TYPE_NAMES.filter((n) => BODY_GRAMMAR[n] === "removal")
53
+ );
54
+ var KEYWORD_BODY_DIRECTIVES = new Set(
55
+ DIRECTIVE_TYPE_NAMES.filter((n) => BODY_GRAMMAR[n] === "keyword")
56
+ );
40
57
  var REMOVAL_RE = /!([\w][\w-]*)\s*;/g;
41
58
  var FLUID_KEYWORD_RE = /\b(no-parabolic|parabolic|no-shift|shift)\s*;?/g;
42
59
  var COLOR_FLAG_RE = /(?<=[{;\s]|^)(inline|no-parabolic|parabolic)\s*(?:;|(?=}))/g;
@@ -148,6 +165,9 @@ function rewriteDirectiveBodies(code) {
148
165
  if (last === 0) return code;
149
166
  return out + code.slice(last);
150
167
  }
168
+
169
+ // src/integrations/vite.ts
170
+ var CSS_FILE_RE = /\.(?:module\.)?css$/;
151
171
  var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "dist"]);
152
172
  var POSTCSS_CONFIG_FILES = [
153
173
  "postcss.config.js",
@@ -248,11 +268,12 @@ function rainbowindexVite() {
248
268
  }
249
269
  if (!isSourceFile(file)) return;
250
270
  const extraModules = [];
271
+ const hmrModules = new Set(modules);
251
272
  for (const cssFile of riCSSFiles) {
252
273
  const mods = server.moduleGraph.getModulesByFile(cssFile);
253
274
  if (mods) {
254
275
  for (const mod of mods) {
255
- if (!modules.includes(mod)) {
276
+ if (!hmrModules.has(mod)) {
256
277
  extraModules.push(mod);
257
278
  }
258
279
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rainbowindex",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "description": "CSS-first system for building and maintaining consistent user interfaces",
5
5
  "keywords": [
6
6
  "css",