@salty-css/webpack 0.0.1-alpha.171 → 0.0.1-alpha.173

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/index.cjs +1 -1
  2. package/index.js +22 -23
  3. package/package.json +2 -2
package/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("path"),t=require("./index-a4KtTJRO.cjs"),v=require("fs/promises"),F=require("fs"),S=async e=>{if(!e||e.includes("node_modules")||e.includes("saltygen"))return!1;if(e.includes("salty.config"))return!0;if(!t.isSaltyFile(e))return!1;const r=await v.readFile(e,"utf-8");return!!/.+define[A-Z]\w+/.test(r)},g=(e,s,i=!1,r=!1)=>{var o,u,c;(u=(o=e.module)==null?void 0:o.rules)==null||u.push({test:t.saltyFileRegExp(),use:[{loader:p.resolve(__dirname,r?"./loader.cjs":"./loader.js"),options:{dir:s}}]}),i||(c=e.plugins)==null||c.push({apply:y=>{let l=!1,a=!1;y.hooks.watchRun.tapAsync({name:"generateCss"},async(f,w)=>{if(l)return;l=!0,a=!1,await t.generateCss(s);const h=F.watch(s,{recursive:!0},async(C,n)=>{const d=await S(n);d&&!a?(a=!0,f.watching?(console.log("Restarting server"),l=!1,f.watching.invalidate(),h.close()):console.warn("Could not invalidate watcher and restart server")):!d&&!a&&t.isSaltyFile(n)&&await t.generateFile(s,n)});w()})}})};exports.default=g;exports.saltyPlugin=g;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("path"),t=require("./index-a4KtTJRO.cjs"),h=require("fs/promises"),p=require("fs"),v=async e=>{if(!e||e.includes("node_modules")||e.includes("saltygen"))return!1;if(e.includes("salty.config"))return!0;if(!t.isSaltyFile(e))return!1;const r=await h.readFile(e,"utf-8");return!!/.+define[A-Z]\w+/.test(r)},g=(e,s,o=!1,r=!1)=>{var u,c,f;(c=(u=e.module)==null?void 0:u.rules)==null||c.push({test:t.saltyFileRegExp(),use:[{loader:w.resolve(__dirname,r?"./loader.cjs":"./loader.js"),options:{dir:s}}]}),o||(f=e.plugins)==null||f.push({apply:l=>{let n=!1,a=!1;l.hooks.beforeCompile.tapPromise({name:"generateCss"},async F=>{if(n)return;n=!0,a=!1,await t.generateCss(s);const y=p.watch(s,{recursive:!0},async(S,i)=>{const d=await v(i);d&&!a?(a=!0,l.watching?(console.log("Restarting server"),n=!1,l.watching.invalidate(),y.close()):console.warn("Could not invalidate watcher and restart server")):!d&&!a&&t.isSaltyFile(i)&&await t.generateFile(s,i)})})}})};exports.default=g;exports.saltyPlugin=g;
package/index.js CHANGED
@@ -1,39 +1,38 @@
1
- import { resolve as w } from "path";
2
- import { i as d, s as h, g as m, a as v } from "./index-jvM0uSOz.js";
3
- import { readFile as F } from "fs/promises";
4
- import { watch as C } from "fs";
5
- const R = async (e) => {
1
+ import { resolve as y } from "path";
2
+ import { i as d, s as p, g as w, a as h } from "./index-jvM0uSOz.js";
3
+ import { readFile as m } from "fs/promises";
4
+ import { watch as v } from "fs";
5
+ const C = async (e) => {
6
6
  if (!e || e.includes("node_modules") || e.includes("saltygen")) return !1;
7
7
  if (e.includes("salty.config")) return !0;
8
8
  if (!d(e)) return !1;
9
- const a = await F(e, "utf-8");
9
+ const a = await m(e, "utf-8");
10
10
  return !!/.+define[A-Z]\w+/.test(a);
11
- }, E = (e, s, n = !1, a = !1) => {
12
- var i, o, u;
13
- (o = (i = e.module) == null ? void 0 : i.rules) == null || o.push({
14
- test: h(),
11
+ }, b = (e, s, o = !1, a = !1) => {
12
+ var i, u, c;
13
+ (u = (i = e.module) == null ? void 0 : i.rules) == null || u.push({
14
+ test: p(),
15
15
  use: [
16
16
  {
17
- loader: w(__dirname, a ? "./loader.cjs" : "./loader.js"),
17
+ loader: y(__dirname, a ? "./loader.cjs" : "./loader.js"),
18
18
  options: { dir: s }
19
19
  }
20
20
  ]
21
- }), n || (u = e.plugins) == null || u.push({
22
- apply: (g) => {
23
- let r = !1, t = !1;
24
- g.hooks.watchRun.tapAsync({ name: "generateCss" }, async (c, y) => {
25
- if (r) return;
26
- r = !0, t = !1, await m(s);
27
- const p = C(s, { recursive: !0 }, async (S, l) => {
28
- const f = await R(l);
29
- f && !t ? (t = !0, c.watching ? (console.log("Restarting server"), r = !1, c.watching.invalidate(), p.close()) : console.warn("Could not invalidate watcher and restart server")) : !f && !t && d(l) && await v(s, l);
21
+ }), o || (c = e.plugins) == null || c.push({
22
+ apply: (r) => {
23
+ let l = !1, t = !1;
24
+ r.hooks.beforeCompile.tapPromise({ name: "generateCss" }, async (F) => {
25
+ if (l) return;
26
+ l = !0, t = !1, await w(s);
27
+ const g = v(s, { recursive: !0 }, async (R, n) => {
28
+ const f = await C(n);
29
+ f && !t ? (t = !0, r.watching ? (console.log("Restarting server"), l = !1, r.watching.invalidate(), g.close()) : console.warn("Could not invalidate watcher and restart server")) : !f && !t && d(n) && await h(s, n);
30
30
  });
31
- y();
32
31
  });
33
32
  }
34
33
  });
35
34
  };
36
35
  export {
37
- E as default,
38
- E as saltyPlugin
36
+ b as default,
37
+ b as saltyPlugin
39
38
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/webpack",
3
- "version": "0.0.1-alpha.171",
3
+ "version": "0.0.1-alpha.173",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  }
35
35
  },
36
36
  "dependencies": {
37
- "@salty-css/core": "^0.0.1-alpha.171",
37
+ "@salty-css/core": "^0.0.1-alpha.173",
38
38
  "webpack": ">=5.x"
39
39
  }
40
40
  }