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

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