@salty-css/webpack 0.0.1-alpha.164 → 0.0.1-alpha.165

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