@salty-css/webpack 0.0.1-alpha.160 → 0.0.1-alpha.162

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