@salty-css/webpack 0.0.1-alpha.156 → 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.
package/index.cjs CHANGED
@@ -1 +1 @@
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;
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,28 +1,39 @@
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(),
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
+ const y = async (s) => {
5
+ if (s.includes("salty.config")) return !0;
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(),
7
13
  use: [
8
14
  {
9
- loader: p(__dirname, l ? "./loader.cjs" : "./loader.js"),
10
- options: { dir: s }
15
+ loader: d(__dirname, a ? "./loader.cjs" : "./loader.js"),
16
+ options: { dir: t }
11
17
  }
12
18
  ]
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) => {
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) => {
19
23
  console.log("generateCssInner");
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();
30
+ })();
20
31
  });
21
32
  });
22
33
  }
23
34
  });
24
35
  };
25
36
  export {
26
- h as default,
27
- h as saltyPlugin
37
+ v as default,
38
+ v as saltyPlugin
28
39
  };
package/loader.cjs CHANGED
@@ -1 +1 @@
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;
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;
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 | void>;
6
+ export default function (this: WebpackLoaderThis): Promise<string | undefined>;
7
7
  export {};
package/loader.js CHANGED
@@ -1,20 +1,8 @@
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));
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);
17
5
  }
18
6
  export {
19
- g as default
7
+ s as default
20
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/webpack",
3
- "version": "0.0.1-alpha.156",
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.156",
37
+ "@salty-css/core": "^0.0.1-alpha.157",
38
38
  "webpack": ">=5.x"
39
39
  }
40
40
  }