@devup-ui/next-plugin 1.0.46 → 1.0.48

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("@devup-ui/wasm");function l(e){return e.endsWith("devup-ui.css")?null:parseInt(e.split("devup-ui-")[1].split(".")[0])}const r=function(e,t,u){const s=l(this.resourcePath);this.callback(null,i.getCss(s,!0),t,u)};exports.default=r;
@@ -0,0 +1,4 @@
1
+ import { RawLoaderDefinitionFunction } from 'webpack';
2
+ declare const devupUICssLoader: RawLoaderDefinitionFunction;
3
+ export default devupUICssLoader;
4
+ //# sourceMappingURL=css-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-loader.d.ts","sourceRoot":"","sources":["../src/css-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAO1D,QAAA,MAAM,gBAAgB,EAAE,2BAGvB,CAAA;AACD,eAAe,gBAAgB,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { getCss as i } from "@devup-ui/wasm";
2
+ function n(t) {
3
+ return t.endsWith("devup-ui.css") ? null : parseInt(t.split("devup-ui-")[1].split(".")[0]);
4
+ }
5
+ const l = function(t, e, s) {
6
+ const u = n(this.resourcePath);
7
+ this.callback(null, i(u, !0), e, s);
8
+ };
9
+ export {
10
+ l as default
11
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("node:fs/promises"),s=require("node:path"),e=require("@devup-ui/wasm");let M=!1;const j=function(g){const{watch:o,package:w,cssDir:l,sheetFile:S,classMapFile:v,fileMapFile:C,singleCss:P,theme:c,defaultClassMap:n,defaultFileMap:u,defaultSheet:p}=this.getOptions(),a=this.async(),f=this.resourcePath;M||(M=!0,u&&e.importFileMap(u),n&&e.importClassMap(n),p&&e.importSheet(p),c&&e.registerTheme(c));try{let t=s.relative(s.dirname(f),l).replaceAll("\\","/");const b=s.relative(process.cwd(),f);t.startsWith("./")||(t=`./${t}`);const{code:h,css:y="",map:d,cssFile:m,updatedBaseStyle:$}=e.codeExtract(b,g.toString(),w,t,P,!1,!0),F=d?JSON.parse(d):null,r=[];if($&&r.push(i.writeFile(s.join(l,"devup-ui.css"),e.getCss(null,!1),"utf-8")),m){const x=`${this.resourcePath} ${Date.now()}`;r.push(i.writeFile(s.join(l,s.basename(m)),o?`/* ${x} */`:y)),o&&r.push(i.writeFile(S,e.exportSheet()),i.writeFile(v,e.exportClassMap()),i.writeFile(C,e.exportFileMap())),Promise.all(r).catch(console.error).finally(()=>a(null,h,F));return}a(null,h,F)}catch(t){a(t)}};exports.default=j;
@@ -0,0 +1,17 @@
1
+ import { RawLoaderDefinitionFunction } from 'webpack';
2
+ export interface DevupUILoaderOptions {
3
+ package: string;
4
+ cssDir: string;
5
+ sheetFile: string;
6
+ classMapFile: string;
7
+ fileMapFile: string;
8
+ watch: boolean;
9
+ singleCss: boolean;
10
+ theme?: object;
11
+ defaultSheet: object;
12
+ defaultClassMap: object;
13
+ defaultFileMap: object;
14
+ }
15
+ declare const devupUILoader: RawLoaderDefinitionFunction<DevupUILoaderOptions>;
16
+ export default devupUILoader;
17
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1D,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;IACd,SAAS,EAAE,OAAO,CAAA;IAElB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;CACvB;AAGD,QAAA,MAAM,aAAa,EAAE,2BAA2B,CAAC,oBAAoB,CAgFlE,CAAA;AACH,eAAe,aAAa,CAAA"}
package/dist/loader.js ADDED
@@ -0,0 +1,62 @@
1
+ import { writeFile as t } from "node:fs/promises";
2
+ import { relative as d, dirname as k, join as M, basename as D } from "node:path";
3
+ import { importFileMap as O, importClassMap as j, importSheet as A, registerTheme as B, codeExtract as E, getCss as I, exportSheet as J, exportClassMap as L, exportFileMap as N } from "@devup-ui/wasm";
4
+ let F = !1;
5
+ const q = function(g) {
6
+ const {
7
+ watch: r,
8
+ package: C,
9
+ cssDir: a,
10
+ sheetFile: S,
11
+ classMapFile: x,
12
+ fileMapFile: P,
13
+ singleCss: v,
14
+ theme: l,
15
+ defaultClassMap: o,
16
+ defaultFileMap: c,
17
+ defaultSheet: p
18
+ } = this.getOptions(), i = this.async(), n = this.resourcePath;
19
+ F || (F = !0, c && O(c), o && j(o), p && A(p), l && B(l));
20
+ try {
21
+ let e = d(k(n), a).replaceAll("\\", "/");
22
+ const w = d(process.cwd(), n);
23
+ e.startsWith("./") || (e = `./${e}`);
24
+ const {
25
+ code: u,
26
+ css: y = "",
27
+ map: f,
28
+ cssFile: h,
29
+ updatedBaseStyle: $
30
+ } = E(
31
+ w,
32
+ g.toString(),
33
+ C,
34
+ e,
35
+ v,
36
+ !1,
37
+ !0
38
+ ), m = f ? JSON.parse(f) : null, s = [];
39
+ if ($ && s.push(
40
+ t(M(a, "devup-ui.css"), I(null, !1), "utf-8")
41
+ ), h) {
42
+ const b = `${this.resourcePath} ${Date.now()}`;
43
+ s.push(
44
+ t(
45
+ M(a, D(h)),
46
+ r ? `/* ${b} */` : y
47
+ )
48
+ ), r && s.push(
49
+ t(S, J()),
50
+ t(x, L()),
51
+ t(P, N())
52
+ ), Promise.all(s).catch(console.error).finally(() => i(null, u, m));
53
+ return;
54
+ }
55
+ i(null, u, m);
56
+ } catch (e) {
57
+ i(e);
58
+ }
59
+ };
60
+ export {
61
+ q as default
62
+ };
package/dist/plugin.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("node:fs"),t=require("node:path"),a=require("@devup-ui/wasm"),h=require("@devup-ui/webpack-plugin"),w=require("./preload.cjs");function x(s,u={}){if(process.env.TURBOPACK==="1"||process.env.TURBOPACK==="auto"){s??={},s.turbopack??={},s.turbopack.rules??={};const{package:c="@devup-ui/react",distDir:e="df",cssDir:i=t.resolve(e,"devup-ui"),singleCss:p=!1,devupFile:l="devup.json",include:S=[]}=u,b=t.join(e,"sheet.json"),O=t.join(e,"classMap.json"),k=t.join(e,"fileMap.json"),o=t.join(e,".gitignore");r.existsSync(e)||r.mkdirSync(e,{recursive:!0}),r.existsSync(i)||r.mkdirSync(i,{recursive:!0}),r.existsSync(o)||r.writeFileSync(o,"*");const d=r.existsSync(l)?JSON.parse(r.readFileSync(l,"utf-8"))?.theme:{},v=new RegExp(`node_modules(?!.*(${["@devup-ui",...S].join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`);process.env.NODE_ENV!=="production"?(process.env.TURBOPACK_DEBUG_JS="*",process.env.NODE_OPTIONS??="",process.env.NODE_OPTIONS+=" --inspect-brk"):w.preload(v,c,p,d,i);const j={[`./${t.relative(process.cwd(),i).replaceAll("\\","/")}/*.css`]:[{loader:"@devup-ui/webpack-plugin/css-loader"}],"*.{tsx,ts,js,mjs}":{loaders:[{loader:"@devup-ui/webpack-plugin/loader",options:{package:c,cssDir:i,sheetFile:b,classMapFile:O,fileMapFile:k,defaultSheet:JSON.parse(a.exportSheet()),defaultClassMap:JSON.parse(a.exportClassMap()),defaultFileMap:JSON.parse(a.exportFileMap()),watch:process.env.NODE_ENV==="development",singleCss:p,theme:d}}],condition:{not:{path:v}}}};return Object.assign(s.turbopack.rules,j),s}const{webpack:n}=s;return s.webpack=(c,e)=>(u.cssDir??=t.resolve(e.dev?u.distDir??"df":".next/cache",`devup-ui_${e.buildId}`),c.plugins.push(new h.DevupUIWebpackPlugin({...u,watch:e.dev})),typeof n=="function"?n(c,e):c),s}exports.DevupUI=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("node:fs"),t=require("node:path"),c=require("@devup-ui/wasm"),f=require("@devup-ui/webpack-plugin"),j=require("./preload.cjs");function x(r,u={}){if(process.env.TURBOPACK==="1"||process.env.TURBOPACK==="auto"){r??={},r.turbopack??={},r.turbopack.rules??={};const{package:i="@devup-ui/react",distDir:e="df",cssDir:n=t.resolve(e,"devup-ui"),singleCss:l=!1,devupFile:o="devup.json",include:S=[]}=u,O=t.join(e,"sheet.json"),m=t.join(e,"classMap.json"),b=t.join(e,"fileMap.json"),d=t.join(e,".gitignore");s.existsSync(e)||s.mkdirSync(e,{recursive:!0}),s.existsSync(n)||s.mkdirSync(n,{recursive:!0}),s.existsSync(d)||s.writeFileSync(d,"*");const p=s.existsSync(o)?JSON.parse(s.readFileSync(o,"utf-8"))?.theme:{};c.registerTheme(p);const v=c.getThemeInterface(i,"DevupThemeColors","DevupThemeTypography","DevupTheme");v&&s.writeFileSync(t.join(e,"theme.d.ts"),v);const h=new RegExp(`node_modules(?!.*(${["@devup-ui",...S].join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`);process.env.NODE_ENV!=="production"?(process.env.TURBOPACK_DEBUG_JS="*",process.env.NODE_OPTIONS??="",process.env.NODE_OPTIONS+=" --inspect-brk"):j.preload(h,i,l,p,n);const D={[`./${t.relative(process.cwd(),n).replaceAll("\\","/")}/*.css`]:[{loader:"@devup-ui/next-plugin/css-loader"}],"*.{tsx,ts,js,mjs}":{loaders:[{loader:"@devup-ui/next-plugin/loader",options:{package:i,cssDir:n,sheetFile:O,classMapFile:m,fileMapFile:b,defaultSheet:JSON.parse(c.exportSheet()),defaultClassMap:JSON.parse(c.exportClassMap()),defaultFileMap:JSON.parse(c.exportFileMap()),watch:process.env.NODE_ENV==="development",singleCss:l,theme:p}}],condition:{not:{path:h}}}};return Object.assign(r.turbopack.rules,D),r}const{webpack:a}=r;return r.webpack=(i,e)=>(u.cssDir??=t.resolve(e.dev?u.distDir??"df":".next/cache",`devup-ui_${e.buildId}`),i.plugins.push(new f.DevupUIWebpackPlugin({...u,watch:e.dev})),typeof a=="function"?a(i,e):i),r}exports.DevupUI=x;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAItC,KAAK,wBAAwB,GAAG,IAAI,CAClC,OAAO,CAAC,2BAA2B,CAAC,EACpC,OAAO,CACR,CAAA;AAQD,wBAAgB,OAAO,CACrB,MAAM,EAAE,UAAU,EAClB,OAAO,GAAE,wBAA6B,GACrC,UAAU,CA2GZ"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAUA,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAItC,KAAK,wBAAwB,GAAG,IAAI,CAClC,OAAO,CAAC,2BAA2B,CAAC,EACpC,OAAO,CACR,CAAA;AAQD,wBAAgB,OAAO,CACrB,MAAM,EAAE,UAAU,EAClB,OAAO,GAAE,wBAA6B,GACrC,UAAU,CAqHZ"}
package/dist/plugin.js CHANGED
@@ -1,74 +1,83 @@
1
- import { existsSync as a, mkdirSync as v, writeFileSync as N, readFileSync as h } from "node:fs";
2
- import { resolve as m, join as i, relative as D } from "node:path";
3
- import { exportFileMap as w, exportClassMap as x, exportSheet as j } from "@devup-ui/wasm";
4
- import { DevupUIWebpackPlugin as F } from "@devup-ui/webpack-plugin";
5
- import { preload as E } from "./preload.js";
6
- function _(s, t = {}) {
1
+ import { existsSync as u, mkdirSync as m, writeFileSync as h, readFileSync as x } from "node:fs";
2
+ import { resolve as f, join as p, relative as N } from "node:path";
3
+ import { registerTheme as k, getThemeInterface as g, exportFileMap as j, exportClassMap as F, exportSheet as w } from "@devup-ui/wasm";
4
+ import { DevupUIWebpackPlugin as E } from "@devup-ui/webpack-plugin";
5
+ import { preload as M } from "./preload.js";
6
+ function A(s, a = {}) {
7
7
  if (process.env.TURBOPACK === "1" || process.env.TURBOPACK === "auto") {
8
8
  s ??= {}, s.turbopack ??= {}, s.turbopack.rules ??= {};
9
9
  const {
10
10
  package: r = "@devup-ui/react",
11
11
  distDir: e = "df",
12
- cssDir: p = m(e, "devup-ui"),
13
- singleCss: c = !1,
14
- devupFile: l = "devup.json",
12
+ cssDir: t = f(e, "devup-ui"),
13
+ singleCss: l = !1,
14
+ devupFile: o = "devup.json",
15
15
  include: O = []
16
- } = t, b = i(e, "sheet.json"), f = i(e, "classMap.json"), k = i(e, "fileMap.json"), o = i(e, ".gitignore");
17
- a(e) || v(e, {
16
+ } = a, D = p(e, "sheet.json"), S = p(e, "classMap.json"), T = p(e, "fileMap.json"), n = p(e, ".gitignore");
17
+ u(e) || m(e, {
18
18
  recursive: !0
19
- }), a(p) || v(p, {
19
+ }), u(t) || m(t, {
20
20
  recursive: !0
21
- }), a(o) || N(o, "*");
22
- const n = a(l) ? JSON.parse(h(l, "utf-8"))?.theme : {}, d = new RegExp(
21
+ }), u(n) || h(n, "*");
22
+ const i = u(o) ? JSON.parse(x(o, "utf-8"))?.theme : {};
23
+ k(i);
24
+ const d = g(
25
+ r,
26
+ "DevupThemeColors",
27
+ "DevupThemeTypography",
28
+ "DevupTheme"
29
+ );
30
+ d && h(p(e, "theme.d.ts"), d);
31
+ const v = new RegExp(
23
32
  `node_modules(?!.*(${["@devup-ui", ...O].join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
24
33
  );
25
- process.env.NODE_ENV !== "production" ? (process.env.TURBOPACK_DEBUG_JS = "*", process.env.NODE_OPTIONS ??= "", process.env.NODE_OPTIONS += " --inspect-brk") : E(d, r, c, n, p);
26
- const S = {
27
- [`./${D(process.cwd(), p).replaceAll("\\", "/")}/*.css`]: [
34
+ process.env.NODE_ENV !== "production" ? (process.env.TURBOPACK_DEBUG_JS = "*", process.env.NODE_OPTIONS ??= "", process.env.NODE_OPTIONS += " --inspect-brk") : M(v, r, l, i, t);
35
+ const b = {
36
+ [`./${N(process.cwd(), t).replaceAll("\\", "/")}/*.css`]: [
28
37
  {
29
- loader: "@devup-ui/webpack-plugin/css-loader"
38
+ loader: "@devup-ui/next-plugin/css-loader"
30
39
  }
31
40
  ],
32
41
  "*.{tsx,ts,js,mjs}": {
33
42
  loaders: [
34
43
  {
35
- loader: "@devup-ui/webpack-plugin/loader",
44
+ loader: "@devup-ui/next-plugin/loader",
36
45
  options: {
37
46
  package: r,
38
- cssDir: p,
39
- sheetFile: b,
40
- classMapFile: f,
41
- fileMapFile: k,
42
- defaultSheet: JSON.parse(j()),
43
- defaultClassMap: JSON.parse(x()),
44
- defaultFileMap: JSON.parse(w()),
47
+ cssDir: t,
48
+ sheetFile: D,
49
+ classMapFile: S,
50
+ fileMapFile: T,
51
+ defaultSheet: JSON.parse(w()),
52
+ defaultClassMap: JSON.parse(F()),
53
+ defaultFileMap: JSON.parse(j()),
45
54
  watch: process.env.NODE_ENV === "development",
46
- singleCss: c,
55
+ singleCss: l,
47
56
  // for turbopack, load theme is required on loader
48
- theme: n
57
+ theme: i
49
58
  }
50
59
  }
51
60
  ],
52
61
  condition: {
53
62
  not: {
54
- path: d
63
+ path: v
55
64
  }
56
65
  }
57
66
  }
58
67
  };
59
- return Object.assign(s.turbopack.rules, S), s;
68
+ return Object.assign(s.turbopack.rules, b), s;
60
69
  }
61
- const { webpack: u } = s;
62
- return s.webpack = (r, e) => (t.cssDir ??= m(
63
- e.dev ? t.distDir ?? "df" : ".next/cache",
70
+ const { webpack: c } = s;
71
+ return s.webpack = (r, e) => (a.cssDir ??= f(
72
+ e.dev ? a.distDir ?? "df" : ".next/cache",
64
73
  `devup-ui_${e.buildId}`
65
74
  ), r.plugins.push(
66
- new F({
67
- ...t,
75
+ new E({
76
+ ...a,
68
77
  watch: e.dev
69
78
  })
70
- ), typeof u == "function" ? u(r, e) : r), s;
79
+ ), typeof c == "function" ? c(r, e) : r), s;
71
80
  }
72
81
  export {
73
- _ as DevupUI
82
+ A as DevupUI
74
83
  };
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "webpack"
20
20
  ],
21
21
  "type": "module",
22
- "version": "1.0.46",
22
+ "version": "1.0.48",
23
23
  "publishConfig": {
24
24
  "access": "public"
25
25
  },
@@ -30,6 +30,14 @@
30
30
  ".": {
31
31
  "import": "./dist/index.js",
32
32
  "require": "./dist/index.cjs"
33
+ },
34
+ "./css-loader": {
35
+ "import": "./dist/css-loader.js",
36
+ "require": "./dist/css-loader.cjs"
37
+ },
38
+ "./loader": {
39
+ "import": "./dist/loader.js",
40
+ "require": "./dist/loader.cjs"
33
41
  }
34
42
  },
35
43
  "files": [