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

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 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"),l=require("./index-a4KtTJRO.cjs"),r=(e,s,i=!1,u=!1)=>{var n,a,o;(a=(n=e.module)==null?void 0:n.rules)==null||a.push({test:l.saltyFileRegExp(),use:[{loader:p.resolve(__dirname,u?"./loader.cjs":"./loader.js"),options:{dir:s}}]}),i||(o=e.plugins)==null||o.push({apply:g=>{g.hooks.watchRun.tapPromise({name:"generateCss"},async t=>{console.log("generateCss"),await l.generateCss(s),t.hooks.emit.tapPromise({name:"generateCssInner"},async c=>{console.log("generateCssInner")}),t.hooks.emit.tapPromise({name:"generateCssInner"},async c=>{console.log("generateCssInner")})})}})};exports.default=r;exports.saltyPlugin=r;
package/index.js CHANGED
@@ -1,41 +1,28 @@
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
- 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(),
1
+ import { resolve as p } from "path";
2
+ import { s as g, g as c } from "./index-jvM0uSOz.js";
3
+ const h = (e, s, r = !1, l = !1) => {
4
+ var a, o, n;
5
+ (o = (a = e.module) == null ? void 0 : a.rules) == null || o.push({
6
+ test: g(),
13
7
  use: [
14
8
  {
15
- loader: f(__dirname, o ? "./loader.cjs" : "./loader.js"),
16
- options: { dir: t }
9
+ loader: p(__dirname, l ? "./loader.cjs" : "./loader.js"),
10
+ options: { dir: s }
17
11
  }
18
12
  ]
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) => {
13
+ }), r || (n = e.plugins) == null || n.push({
14
+ apply: (i) => {
15
+ i.hooks.watchRun.tapPromise({ name: "generateCss" }, async (t) => {
16
+ console.log("generateCss"), await c(s), t.hooks.emit.tapPromise({ name: "generateCssInner" }, async (m) => {
17
+ console.log("generateCssInner");
18
+ }), t.hooks.emit.tapPromise({ name: "generateCssInner" }, async (m) => {
23
19
  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();
32
- })();
33
20
  });
34
21
  });
35
22
  }
36
23
  });
37
24
  };
38
25
  export {
39
- P as default,
40
- P as saltyPlugin
26
+ h as default,
27
+ h as saltyPlugin
41
28
  };
package/loader.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const i=require("./index-a4KtTJRO.cjs");async function n(){const{dir:e}=this.getOptions(),{resourcePath:t}=this;return await i.generateFile(e,t),await i.minimizeFile(e,t)}module.exports=n;
1
+ "use strict";const n=require("./index-a4KtTJRO.cjs"),a=require("fs/promises"),c=async t=>{if(t.includes("salty.config"))return!0;if(!n.isSaltyFile(t))return!1;const i=await a.readFile(t,"utf-8");return!!/.+define[A-Z]\w+/.test(i)};async function l(){const{dir:t}=this.getOptions(),{resourcePath:e}=this,s=await c(e);console.log("shouldRestart in loader",{shouldRestart:s,resourcePath:e});const i=async()=>{var r,o;console.log("restarting"),(o=(r=this._compiler)==null?void 0:r.watching)==null||o.invalidate()};return s?i():(await n.generateFile(t,e),await n.minimizeFile(t,e))}module.exports=l;
package/loader.d.ts CHANGED
@@ -3,5 +3,5 @@ interface SaltyLoaderOptions {
3
3
  dir: string;
4
4
  }
5
5
  type WebpackLoaderThis = LoaderContext<SaltyLoaderOptions>;
6
- export default function (this: WebpackLoaderThis): Promise<string | undefined>;
6
+ export default function (this: WebpackLoaderThis): Promise<string | void>;
7
7
  export {};
package/loader.js CHANGED
@@ -1,8 +1,20 @@
1
- import { a as e, m as i } from "./index-jvM0uSOz.js";
2
- async function s() {
3
- const { dir: t } = this.getOptions(), { resourcePath: a } = this;
4
- return await e(t, a), await i(t, a);
1
+ import { i as n, a as o, m as c } from "./index-jvM0uSOz.js";
2
+ import { readFile as l } from "fs/promises";
3
+ const u = async (t) => {
4
+ if (t.includes("salty.config")) return !0;
5
+ if (!n(t)) return !1;
6
+ const e = await l(t, "utf-8");
7
+ return !!/.+define[A-Z]\w+/.test(e);
8
+ };
9
+ async function g() {
10
+ const { dir: t } = this.getOptions(), { resourcePath: s } = this, i = await u(s);
11
+ console.log("shouldRestart in loader", { shouldRestart: i, resourcePath: s });
12
+ const e = async () => {
13
+ var a, r;
14
+ console.log("restarting"), (r = (a = this._compiler) == null ? void 0 : a.watching) == null || r.invalidate();
15
+ };
16
+ return i ? e() : (await o(t, s), await c(t, s));
5
17
  }
6
18
  export {
7
- s as default
19
+ g as default
8
20
  };
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.156",
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.156",
38
38
  "webpack": ">=5.x"
39
39
  }
40
40
  }