@devup-ui/next-plugin 1.0.45 → 1.0.46

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/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 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 +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":"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"}
package/dist/plugin.js CHANGED
@@ -1,59 +1,74 @@
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 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 = {}) {
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: p = m(e, "devup-ui"),
13
+ singleCss: c = !1,
14
+ devupFile: l = "devup.json",
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, {
17
18
  recursive: !0
18
- }), p(i) || n(i, {
19
+ }), a(p) || v(p, {
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
+ }), a(o) || N(o, "*");
22
+ const n = a(l) ? JSON.parse(h(l, "utf-8"))?.theme : {}, d = new RegExp(
23
+ `node_modules(?!.*(${["@devup-ui", ...O].join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
24
+ );
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`]: [
23
28
  {
24
29
  loader: "@devup-ui/webpack-plugin/css-loader"
25
30
  }
26
31
  ],
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
32
+ "*.{tsx,ts,js,mjs}": {
33
+ loaders: [
34
+ {
35
+ loader: "@devup-ui/webpack-plugin/loader",
36
+ options: {
37
+ 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()),
45
+ watch: process.env.NODE_ENV === "development",
46
+ singleCss: c,
47
+ // for turbopack, load theme is required on loader
48
+ theme: n
49
+ }
50
+ }
51
+ ],
52
+ condition: {
53
+ not: {
54
+ path: d
40
55
  }
41
56
  }
42
- ]
57
+ }
43
58
  };
44
- return Object.assign(s.turbopack.rules, O), s;
59
+ return Object.assign(s.turbopack.rules, S), s;
45
60
  }
46
- const { webpack: c } = s;
47
- return s.webpack = (r, e) => (t.cssDir ??= l(
61
+ const { webpack: u } = s;
62
+ return s.webpack = (r, e) => (t.cssDir ??= m(
48
63
  e.dev ? t.distDir ?? "df" : ".next/cache",
49
64
  `devup-ui_${e.buildId}`
50
65
  ), r.plugins.push(
51
- new h({
66
+ new F({
52
67
  ...t,
53
68
  watch: e.dev
54
69
  })
55
- ), typeof c == "function" ? c(r, e) : r), s;
70
+ ), typeof u == "function" ? u(r, e) : r), s;
56
71
  }
57
72
  export {
58
- S as DevupUI
73
+ _ as DevupUI
59
74
  };
@@ -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.46",
23
23
  "publishConfig": {
24
24
  "access": "public"
25
25
  },
@@ -38,8 +38,9 @@
38
38
  "types": "./dist/index.d.ts",
39
39
  "dependencies": {
40
40
  "next": "^16.0",
41
- "@devup-ui/webpack-plugin": "1.0.44",
42
- "@devup-ui/wasm": "1.0.43"
41
+ "glob": "^11.0",
42
+ "@devup-ui/webpack-plugin": "1.0.45",
43
+ "@devup-ui/wasm": "1.0.44"
43
44
  },
44
45
  "devDependencies": {
45
46
  "vite": "^7.1",