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