@devup-ui/next-plugin 1.0.45 → 1.0.47

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"),k=require("@devup-ui/webpack-plugin");function O(s,c={}){if(process.env.TURBOPACK==="1"||process.env.TURBOPACK==="auto"){if(process.env.NODE_ENV==="production")throw new Error("Devup UI is not supported in production with turbopack");s??={},s.turbopack??={},s.turbopack.rules??={};const{package:i="@devup-ui/react",distDir:e="df",cssDir:u=t.resolve(e,"devup-ui"),singleCss:a=!1,devupFile:p="devup.json"}=c,l=t.join(e,"sheet.json"),d=t.join(e,"classMap.json"),v=t.join(e,"fileMap.json"),o=t.join(e,".gitignore");r.existsSync(e)||r.mkdirSync(e,{recursive:!0}),r.existsSync(u)||r.mkdirSync(u,{recursive:!0}),r.existsSync(o)||r.writeFileSync(o,"*"),process.env.TURBOPACK_DEBUG_JS="*",process.env.NODE_OPTIONS??="",process.env.NODE_OPTIONS+=" --inspect-brk";const b={[`./${t.relative(process.cwd(),u).replaceAll("\\","/")}/*.css`]:[{loader:"@devup-ui/webpack-plugin/css-loader"}],"*.{tsx,ts,js,mjs}":[{loader:"@devup-ui/webpack-plugin/loader",options:{package:i,cssDir:u,sheetFile:l,classMapFile:d,fileMapFile:v,watch:process.env.NODE_ENV==="development",singleCss:a,theme:r.existsSync(p)?JSON.parse(r.readFileSync(p,"utf-8"))?.theme:void 0}}]};return Object.assign(s.turbopack.rules,b),s}const{webpack:n}=s;return s.webpack=(i,e)=>(c.cssDir??=t.resolve(e.dev?c.distDir??"df":".next/cache",`devup-ui_${e.buildId}`),i.plugins.push(new k.DevupUIWebpackPlugin({...c,watch:e.dev})),typeof n=="function"?n(i,e):i),s}exports.DevupUI=O;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("node:fs"),t=require("node:path"),u=require("@devup-ui/wasm"),f=require("@devup-ui/webpack-plugin"),j=require("./preload.cjs");function x(r,c={}){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:a=!1,devupFile:l="devup.json",include:h=[]}=c,O=t.join(e,"sheet.json"),b=t.join(e,"classMap.json"),m=t.join(e,"fileMap.json"),o=t.join(e,".gitignore");s.existsSync(e)||s.mkdirSync(e,{recursive:!0}),s.existsSync(n)||s.mkdirSync(n,{recursive:!0}),s.existsSync(o)||s.writeFileSync(o,"*");const d=s.existsSync(l)?JSON.parse(s.readFileSync(l,"utf-8"))?.theme:{},v=u.getThemeInterface(i,"DevupThemeColors","DevupThemeTypography","DevupTheme");v&&s.writeFileSync(t.join(e,"theme.d.ts"),v);const S=new RegExp(`node_modules(?!.*(${["@devup-ui",...h].join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`);process.env.NODE_ENV!=="production"?(process.env.TURBOPACK_DEBUG_JS="*",process.env.NODE_OPTIONS??="",process.env.NODE_OPTIONS+=" --inspect-brk"):j.preload(S,i,a,d,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:b,fileMapFile:m,defaultSheet:JSON.parse(u.exportSheet()),defaultClassMap:JSON.parse(u.exportClassMap()),defaultFileMap:JSON.parse(u.exportFileMap()),watch:process.env.NODE_ENV==="development",singleCss:a,theme:d}}],condition:{not:{path:S}}}};return Object.assign(r.turbopack.rules,D),r}const{webpack:p}=r;return r.webpack=(i,e)=>(c.cssDir??=t.resolve(e.dev?c.distDir??"df":".next/cache",`devup-ui_${e.buildId}`),i.plugins.push(new f.DevupUIWebpackPlugin({...c,watch:e.dev})),typeof p=="function"?p(i,e):i),r}exports.DevupUI=x;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAEtC,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,CAmFZ"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AASA,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,CAoHZ"}
package/dist/plugin.js CHANGED
@@ -1,59 +1,81 @@
1
- import { existsSync as p, mkdirSync as n, writeFileSync as w, readFileSync as D } from "node:fs";
2
- import { resolve as l, join as u, relative as m } from "node:path";
3
- import { DevupUIWebpackPlugin as h } from "@devup-ui/webpack-plugin";
4
- function S(s, t = {}) {
1
+ import { existsSync as u, mkdirSync as m, writeFileSync as h, readFileSync as N } from "node:fs";
2
+ import { resolve as f, join as p, relative as T } from "node:path";
3
+ import { getThemeInterface as k, exportFileMap as j, exportClassMap as F, exportSheet as g } from "@devup-ui/wasm";
4
+ import { DevupUIWebpackPlugin as w } from "@devup-ui/webpack-plugin";
5
+ import { preload as E } from "./preload.js";
6
+ function _(s, a = {}) {
5
7
  if (process.env.TURBOPACK === "1" || process.env.TURBOPACK === "auto") {
6
- if (process.env.NODE_ENV === "production")
7
- throw new Error("Devup UI is not supported in production with turbopack");
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: i = l(e, "devup-ui"),
13
- singleCss: d = !1,
14
- devupFile: a = "devup.json"
15
- } = t, v = u(e, "sheet.json"), b = u(e, "classMap.json"), k = u(e, "fileMap.json"), o = u(e, ".gitignore");
16
- p(e) || n(e, {
12
+ cssDir: t = f(e, "devup-ui"),
13
+ singleCss: c = !1,
14
+ devupFile: l = "devup.json",
15
+ include: O = []
16
+ } = a, D = p(e, "sheet.json"), S = p(e, "classMap.json"), b = p(e, "fileMap.json"), o = p(e, ".gitignore");
17
+ u(e) || m(e, {
17
18
  recursive: !0
18
- }), p(i) || n(i, {
19
+ }), u(t) || m(t, {
19
20
  recursive: !0
20
- }), p(o) || w(o, "*"), process.env.TURBOPACK_DEBUG_JS = "*", process.env.NODE_OPTIONS ??= "", process.env.NODE_OPTIONS += " --inspect-brk";
21
- const O = {
22
- [`./${m(process.cwd(), i).replaceAll("\\", "/")}/*.css`]: [
21
+ }), u(o) || h(o, "*");
22
+ const n = u(l) ? JSON.parse(N(l, "utf-8"))?.theme : {}, d = k(
23
+ r,
24
+ "DevupThemeColors",
25
+ "DevupThemeTypography",
26
+ "DevupTheme"
27
+ );
28
+ d && h(p(e, "theme.d.ts"), d);
29
+ const v = new RegExp(
30
+ `node_modules(?!.*(${["@devup-ui", ...O].join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
31
+ );
32
+ process.env.NODE_ENV !== "production" ? (process.env.TURBOPACK_DEBUG_JS = "*", process.env.NODE_OPTIONS ??= "", process.env.NODE_OPTIONS += " --inspect-brk") : E(v, r, c, n, t);
33
+ const x = {
34
+ [`./${T(process.cwd(), t).replaceAll("\\", "/")}/*.css`]: [
23
35
  {
24
- loader: "@devup-ui/webpack-plugin/css-loader"
36
+ loader: "@devup-ui/next-plugin/css-loader"
25
37
  }
26
38
  ],
27
- "*.{tsx,ts,js,mjs}": [
28
- {
29
- loader: "@devup-ui/webpack-plugin/loader",
30
- options: {
31
- package: r,
32
- cssDir: i,
33
- sheetFile: v,
34
- classMapFile: b,
35
- fileMapFile: k,
36
- watch: process.env.NODE_ENV === "development",
37
- singleCss: d,
38
- // for turbopack, load theme is required on loader
39
- theme: p(a) ? JSON.parse(D(a, "utf-8"))?.theme : void 0
39
+ "*.{tsx,ts,js,mjs}": {
40
+ loaders: [
41
+ {
42
+ loader: "@devup-ui/next-plugin/loader",
43
+ options: {
44
+ package: r,
45
+ cssDir: t,
46
+ sheetFile: D,
47
+ classMapFile: S,
48
+ fileMapFile: b,
49
+ defaultSheet: JSON.parse(g()),
50
+ defaultClassMap: JSON.parse(F()),
51
+ defaultFileMap: JSON.parse(j()),
52
+ watch: process.env.NODE_ENV === "development",
53
+ singleCss: c,
54
+ // for turbopack, load theme is required on loader
55
+ theme: n
56
+ }
57
+ }
58
+ ],
59
+ condition: {
60
+ not: {
61
+ path: v
40
62
  }
41
63
  }
42
- ]
64
+ }
43
65
  };
44
- return Object.assign(s.turbopack.rules, O), s;
66
+ return Object.assign(s.turbopack.rules, x), s;
45
67
  }
46
- const { webpack: c } = s;
47
- return s.webpack = (r, e) => (t.cssDir ??= l(
48
- e.dev ? t.distDir ?? "df" : ".next/cache",
68
+ const { webpack: i } = s;
69
+ return s.webpack = (r, e) => (a.cssDir ??= f(
70
+ e.dev ? a.distDir ?? "df" : ".next/cache",
49
71
  `devup-ui_${e.buildId}`
50
72
  ), r.plugins.push(
51
- new h({
52
- ...t,
73
+ new w({
74
+ ...a,
53
75
  watch: e.dev
54
76
  })
55
- ), typeof c == "function" ? c(r, e) : r), s;
77
+ ), typeof i == "function" ? i(r, e) : r), s;
56
78
  }
57
79
  export {
58
- S as DevupUI
80
+ _ as DevupUI
59
81
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("node:fs"),s=require("node:path"),c=require("@devup-ui/wasm"),p=require("glob");function b(n,l,i,a,o){const u=p.globSync(["**/*.tsx","**/*.ts","**/*.js","**/*.mjs"],{follow:!0,absolute:!0});c.registerTheme(a);for(const f of u){const e=s.relative(process.cwd(),t.realpathSync(f));if(/\.(test(-d)?|d|spec)\.(tsx|ts|js|mjs)$/.test(e)||/^(out|.next)[/\\]/.test(e)||n.test(e))continue;const{cssFile:r,css:d}=c.codeExtract(e,t.readFileSync(e,"utf-8"),l,o,i,!1,!0);r&&t.writeFileSync(s.join(o,s.basename(r)),d??"","utf-8")}}exports.preload=b;
@@ -0,0 +1,2 @@
1
+ export declare function preload(excludeRegex: RegExp, libPackage: string, singleCss: boolean, theme: object, cssDir: string): void;
2
+ //# sourceMappingURL=preload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preload.d.ts","sourceRoot":"","sources":["../src/preload.ts"],"names":[],"mappings":"AAMA,wBAAgB,OAAO,CACrB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,QA6Bf"}
@@ -0,0 +1,29 @@
1
+ import { realpathSync as m, readFileSync as a, writeFileSync as p } from "node:fs";
2
+ import { relative as u, join as d, basename as j } from "node:path";
3
+ import { registerTheme as x, codeExtract as y } from "@devup-ui/wasm";
4
+ import { globSync as S } from "glob";
5
+ function g(s, r, c, i, e) {
6
+ const f = S(["**/*.tsx", "**/*.ts", "**/*.js", "**/*.mjs"], {
7
+ follow: !0,
8
+ absolute: !0
9
+ });
10
+ x(i);
11
+ for (const l of f) {
12
+ const t = u(process.cwd(), m(l));
13
+ if (/\.(test(-d)?|d|spec)\.(tsx|ts|js|mjs)$/.test(t) || /^(out|.next)[/\\]/.test(t) || s.test(t))
14
+ continue;
15
+ const { cssFile: o, css: n } = y(
16
+ t,
17
+ a(t, "utf-8"),
18
+ r,
19
+ e,
20
+ c,
21
+ !1,
22
+ !0
23
+ );
24
+ o && p(d(e, j(o)), n ?? "", "utf-8");
25
+ }
26
+ }
27
+ export {
28
+ g as preload
29
+ };
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "webpack"
20
20
  ],
21
21
  "type": "module",
22
- "version": "1.0.45",
22
+ "version": "1.0.47",
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": [
@@ -38,8 +46,9 @@
38
46
  "types": "./dist/index.d.ts",
39
47
  "dependencies": {
40
48
  "next": "^16.0",
41
- "@devup-ui/webpack-plugin": "1.0.44",
42
- "@devup-ui/wasm": "1.0.43"
49
+ "glob": "^11.0",
50
+ "@devup-ui/webpack-plugin": "1.0.45",
51
+ "@devup-ui/wasm": "1.0.44"
43
52
  },
44
53
  "devDependencies": {
45
54
  "vite": "^7.1",