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