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