@salty-css/webpack 0.0.1-alpha.155 → 0.0.1-alpha.157

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