@amaster.ai/vite-plugins 1.1.0-beta.55 → 1.1.0-beta.57

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/index.cjs CHANGED
@@ -1,30 +1,110 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var crypto=require('crypto'),h=require('fs'),m=require('path'),url=require('url'),x=require('process');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var h__default=/*#__PURE__*/_interopDefault(h);var m__default=/*#__PURE__*/_interopDefault(m);var x__default=/*#__PURE__*/_interopDefault(x);function E(n,r){let e=`${n}:${r}`;return crypto.createHash("md5").update(e).digest("hex").substring(0,12)}var P=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function b(){let n=false;return {name:"vite-plugin-component-id",enforce:"pre",configResolved(r){n=r.command==="serve";},transform(r,e){if(!n||!/\.(tsx|jsx)$/.test(e)||e.includes("node_modules")||!/<[a-z]/.test(r))return null;try{let t=r,o=/<([a-z][\da-z]*)(?=[\s/>])/g,i,s=[],f=p=>{let l=!1,d=!1,a=!1,c=0;for(;c<p;){let g=r[c];if((c>0?r[c-1]:"")==="\\"){c++;continue}g==="'"&&!d&&!a?l=!l:g==='"'&&!l&&!a?d=!d:g==="`"&&!l&&!d&&(a=!a),c++;}return l||d||a};for(;(i=o.exec(r))!==null;){let p=i[1];if(!p)continue;let l=i.index,d=i.index+i[0].length;if(!P.has(p)||f(l))continue;let a=d,c=!1,g=!1;for(;a<r.length&&!c;)r[a]===">"&&(c=!0,r.substring(l,a).includes("data-node-component-id")&&(g=!0)),a++;g||s.push({index:l,tag:p,tagEndIndex:d});}let u=r;for(let p=s.length-1;p>=0;p--){let l=s[p];if(!l)continue;let{index:d,tagEndIndex:a}=l,c=E(e,d),g=u.substring(0,a),v=u.substring(a);t=`${g} data-node-component-id="${c}"${v}`,u=t;}return {code:t,map:null}}catch{return null}}}}var H=`<script>
2
- document.addEventListener("click", (e) => {
3
- const element = e.target;
4
- const noJumpOut = document.body.classList.contains("forbid-jump-out")
5
- if (element.hasAttribute("data-link-href") && !noJumpOut) {
6
- const href = element.getAttribute("data-link-href");
7
- const target = element.getAttribute("data-link-target");
8
- if (href) {
9
- if (target === "_blank") {
10
- window.open(href, "_blank");
11
- } else {
12
- window.location.href = href;
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var m=require('fs'),d=require('path'),C=require('process'),S=require('fs/promises');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var m__default=/*#__PURE__*/_interopDefault(m);var d__default=/*#__PURE__*/_interopDefault(d);var C__default=/*#__PURE__*/_interopDefault(C);var S__default=/*#__PURE__*/_interopDefault(S);var O="@amaster/bridge-monitor",x="\0"+O;function A(){return '<script type="module" src="/@id/@amaster/bridge-monitor"></script>'}function L(r){return `
2
+ // Bridge monitor module - handles all bridge logic
3
+ const SOURCE_KEY = Symbol.for("__jsxSource__");
4
+ const SESSION_KEY = "${r}";
5
+
6
+ // Expose minimal API for external bridge script
7
+ window.__AMASTER_BRIDGE__ = {
8
+ getSourceInfo: (element) => element?.[SOURCE_KEY],
9
+ getSourceMap: () => window.sourceElementMap,
10
+ postToParent: (type, data) => {
11
+ window.parent.postMessage({ type, data, key: SESSION_KEY }, "*");
12
+ },
13
+ isDev: true,
14
+ };
15
+
16
+ // Listen for HMR updates
17
+ if (import.meta.hot) {
18
+ import.meta.hot.on('vite:afterUpdate', (payload) => {
19
+ // Dispatch custom event for bridge.js to listen
20
+ window.dispatchEvent(new CustomEvent('amaster:hmr-update', {
21
+ detail: {
22
+ updates: payload?.updates || []
13
23
  }
24
+ }));
25
+ });
26
+ }
27
+
28
+ // Import and monitor Tailwind config
29
+ (async () => {
30
+ try {
31
+ const tailwindConfig = await import('@amaster/tailwind-config');
32
+ let config = tailwindConfig.default;
33
+ const onUpdate = tailwindConfig.onUpdate;
34
+
35
+ if (!config) {
36
+ return;
37
+ }
38
+
39
+ const sendConfig = (type, newConfig) => {
40
+ config = newConfig || config;
41
+ const serializableConfig = JSON.parse(JSON.stringify(config));
42
+
43
+ // Dispatch event for bridge.js to handle
44
+ window.dispatchEvent(new CustomEvent('amaster:tailwind-config', {
45
+ detail: {
46
+ type: type,
47
+ config: serializableConfig
48
+ }
49
+ }));
50
+ };
51
+
52
+ // Send initial config
53
+ sendConfig('loaded');
54
+
55
+ // Listen for bridge ready event and resend config
56
+ window.addEventListener('amaster:bridge-ready', () => {
57
+ sendConfig('loaded');
58
+ });
59
+
60
+ // Listen for config updates
61
+ if (onUpdate) {
62
+ onUpdate((newConfig) => {
63
+ sendConfig('updated', newConfig);
64
+ });
14
65
  }
15
- } else if(noJumpOut && element.tagName === "A") {
16
- e.preventDefault();
66
+ } catch (e) {
67
+ // Silently fail if tailwind config is not available
68
+ }
69
+ })();
70
+
71
+ // Listen for bridge script URL from platform
72
+ window.addEventListener("message", (event) => {
73
+ const { type, data, key } = event.data;
74
+
75
+ if (key !== SESSION_KEY) {
76
+ return;
17
77
  }
78
+
79
+ if (type === "amaster.loadBridge" && data?.scriptContent) {
80
+ // Create blob URL from script content
81
+ const blob = new Blob([data.scriptContent], { type: 'application/javascript' });
82
+ const blobUrl = URL.createObjectURL(blob);
83
+
84
+ const script = document.createElement("script");
85
+ script.src = blobUrl;
86
+ script.onload = () => {
87
+ URL.revokeObjectURL(blobUrl);
88
+ };
89
+ script.onerror = () => {
90
+ URL.revokeObjectURL(blobUrl);
91
+ };
92
+ document.head.appendChild(script);
93
+ }
94
+ });
95
+
96
+ window.addEventListener("load", () => {
97
+ window.__AMASTER_BRIDGE__?.postToParent("amaster.bridge.initialized", {});
18
98
  });
19
- </script>`;function L(){try{let n=url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))),r=m.dirname(n),e=m.resolve(r,"../dist/bridge.bridge.js");return `<script>
20
- ${h.readFileSync(e,"utf-8")}
21
- </script>`}catch(n){return console.warn("Failed to read bridge script:",n),""}}function _(){let n=false,r="";return {name:"vite-plugin-editor-bridge",configResolved(e){n=e.command==="serve",n&&(r=L());},transformIndexHtml(e){let o=`${H}${n?r:""}</body>`;return e.replace("</body>",o)}}}function w(n){let r=false,e=n?.routesFilePath||"src/routes.tsx";return {name:"vite-plugin-routes-expose",enforce:"post",configResolved(t){r=t.command==="serve";},transform(t,o){if(!r||!o.endsWith(e))return null;try{return t.includes("window.__APP_ROUTES__")?null:{code:`${t}
99
+
100
+ export default {};
101
+ `}function R(){let r=false;return {name:"vite-plugin-editor-bridge",configResolved(n){r=n.command==="serve";},resolveId(n){if(n===O)return x},load(n){if(n===x){let e=process.env.VITE_AMASTER_KEY||"";return L(e)}},transformIndexHtml(n){if(!r)return n;let e=A();return n.replace("</body>",`${e}</body>`)}}}function T(r){let n=false,e=r?.routesFilePath||"src/routes.tsx";return {name:"vite-plugin-routes-expose",enforce:"post",configResolved(t){n=t.command==="serve";},transform(t,o){if(!n||!o.endsWith(e))return null;try{return t.includes("window.__APP_ROUTES__")?null:{code:`${t}
22
102
 
23
103
  // Development mode: Expose routes to window.__APP_ROUTES__
24
104
  if (typeof window !== 'undefined') {
25
105
  window.__APP_ROUTES__ = typeof routes !== 'undefined' && Array.isArray(routes) ? routes : [];
26
106
  }
27
- `,map:null}}catch{return null}}}}function T(){let n="",r=`
107
+ `,map:null}}catch{return null}}}}function P(){let r="",n=`
28
108
  <script>
29
109
  (function() {
30
110
  'use strict';
@@ -32,6 +112,9 @@ if (typeof window !== 'undefined') {
32
112
  // Log API path (provided by Vite dev server)
33
113
  var LOG_API_PATH = '/__browser__';
34
114
 
115
+ // Save original fetch before any interception, used exclusively for log writing
116
+ var __originalFetch__ = window.fetch.bind(window);
117
+
35
118
  // Write queue to ensure sequential writes
36
119
  var writeQueue = [];
37
120
  var isWriting = false;
@@ -44,7 +127,7 @@ if (typeof window !== 'undefined') {
44
127
  var entry = writeQueue.shift();
45
128
  var logText = JSON.stringify(entry);
46
129
 
47
- fetch(LOG_API_PATH, {
130
+ __originalFetch__(LOG_API_PATH, {
48
131
  method: 'POST',
49
132
  headers: { 'Content-Type': 'application/json' },
50
133
  body: logText
@@ -162,12 +245,19 @@ if (typeof window !== 'undefined') {
162
245
  };
163
246
  }
164
247
 
165
- // Check if message should be filtered (contains [vite] text)
248
+ // Keywords to filter from console log collection
249
+ var FILTERED_CONSOLE_KEYWORDS = ['[vite]', '[BrowserLogs]'];
250
+
251
+ // Check if message should be filtered
166
252
  function shouldFilterConsoleLog(args) {
167
253
  for (var i = 0; i < args.length; i++) {
168
254
  var arg = args[i];
169
- if (typeof arg === 'string' && arg.indexOf('[vite]') !== -1) {
170
- return true;
255
+ if (typeof arg === 'string') {
256
+ for (var j = 0; j < FILTERED_CONSOLE_KEYWORDS.length; j++) {
257
+ if (arg.indexOf(FILTERED_CONSOLE_KEYWORDS[j]) !== -1) {
258
+ return true;
259
+ }
260
+ }
171
261
  }
172
262
  }
173
263
  return false;
@@ -705,15 +795,198 @@ if (typeof window !== 'undefined') {
705
795
 
706
796
  originalConsole.log('[BrowserLogs] Log collection started');
707
797
  })();
708
- </script>`;return {name:"vite-plugin-browser-logs",configResolved(e){let t=x__default.default.env.WORKSPACE_DIR;if(t)n=m__default.default.join(t,"browser.log");else {let o=e.root||x__default.default.cwd();for(;o!==m__default.default.dirname(o)&&!h__default.default.existsSync(m__default.default.join(o,"package.json"));)o=m__default.default.dirname(o);n=m__default.default.join(o,"browser.log");}},configureServer(e){e.middlewares.use((t,o,i)=>{if(t.url==="/__browser__"&&t.method==="POST"){let s=t.headers.origin||"*",f="";t.on("data",u=>{f+=u.toString();}),t.on("end",()=>{try{let u=m__default.default.dirname(n);h__default.default.existsSync(u)||h__default.default.mkdirSync(u,{recursive:!0}),h__default.default.appendFileSync(n,`${f}
709
- `,"utf-8"),o.writeHead(200,{"Content-Type":"application/json","Access-Control-Allow-Origin":s,"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}),o.end(JSON.stringify({success:!0}));}catch(u){console.error("[BrowserLogs] Write error:",u),o.writeHead(500,{"Content-Type":"application/json","Access-Control-Allow-Origin":s,"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}),o.end(JSON.stringify({success:false,error:String(u)}));}});}else if(t.url==="/__browser__"&&t.method==="OPTIONS"){let s=t.headers.origin||"*";o.writeHead(204,{"Access-Control-Allow-Origin":s,"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type","Access-Control-Max-Age":"86400"}),o.end();}else if(t.url==="/__browser__"){let s=t.headers.origin||"*";o.writeHead(405,{"Content-Type":"application/json","Access-Control-Allow-Origin":s}),o.end(JSON.stringify({error:"Method not allowed"}));}else i();}),console.log("[BrowserLogs] Logs will be written to:",n);},transformIndexHtml(e){return e.replace(/<head([^>]*)>/i,`<head$1>${r}`)}}}function S(n={}){let{designWidth:r=375,maxWidth:e=750,baseFontSize:t=12,minRootSize:o=12,maxRootSize:i=24}=n;return {name:"vite-plugin-taro-style-adapter",apply:"serve",transformIndexHtml(s){let f=`
798
+ </script>`;return {name:"vite-plugin-browser-logs",configResolved(e){let t=C__default.default.env.WORKSPACE_DIR;if(t)r=d__default.default.join(t,"browser.log");else {let o=e.root||C__default.default.cwd();for(;o!==d__default.default.dirname(o)&&!m__default.default.existsSync(d__default.default.join(o,"package.json"));)o=d__default.default.dirname(o);r=d__default.default.join(o,"browser.log");}},configureServer(e){e.middlewares.use((t,o,l)=>{if(t.url==="/__browser__"&&t.method==="POST"){let i=t.headers.origin||"*",u="";t.on("data",c=>{u+=c.toString();}),t.on("end",()=>{try{let c=d__default.default.dirname(r);m__default.default.existsSync(c)||m__default.default.mkdirSync(c,{recursive:!0}),m__default.default.appendFileSync(r,`${u}
799
+ `,"utf-8"),o.writeHead(200,{"Content-Type":"application/json","Access-Control-Allow-Origin":i,"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}),o.end(JSON.stringify({success:!0}));}catch(c){console.error("[BrowserLogs] Write error:",c),o.writeHead(500,{"Content-Type":"application/json","Access-Control-Allow-Origin":i,"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}),o.end(JSON.stringify({success:false,error:String(c)}));}});}else if(t.url==="/__browser__"&&t.method==="OPTIONS"){let i=t.headers.origin||"*";o.writeHead(204,{"Access-Control-Allow-Origin":i,"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type","Access-Control-Max-Age":"86400"}),o.end();}else if(t.url==="/__browser__"){let i=t.headers.origin||"*";o.writeHead(405,{"Content-Type":"application/json","Access-Control-Allow-Origin":i}),o.end(JSON.stringify({error:"Method not allowed"}));}else l();}),console.log("[BrowserLogs] Logs will be written to:",r);},transformIndexHtml(e){return e.replace(/<head([^>]*)>/i,`<head$1>${n}`)}}}var j=`
800
+ import * as React from "react";
801
+ import * as ReactJSXDevRuntime from "react/jsx-dev-runtime";
802
+
803
+ const _jsxDEV = ReactJSXDevRuntime.jsxDEV;
804
+ export const Fragment = ReactJSXDevRuntime.Fragment;
805
+
806
+ const SOURCE_KEY = Symbol.for("__jsxSource__");
807
+ const PROJECT_ROOT = "";
808
+
809
+ const cleanFileName = (fileName) => {
810
+ if (!fileName) return "";
811
+ // Remove project root prefix to get relative path
812
+ if (PROJECT_ROOT && fileName.startsWith(PROJECT_ROOT)) {
813
+ const relative = fileName.slice(PROJECT_ROOT.length);
814
+ return relative.startsWith("/") ? relative.slice(1) : relative;
815
+ }
816
+ return fileName;
817
+ };
818
+
819
+ // Global map to track elements by source location
820
+ const sourceElementMap = new Map();
821
+ window.sourceElementMap = sourceElementMap;
822
+
823
+ function getSourceKey(sourceInfo) {
824
+ return \`\${cleanFileName(sourceInfo.fileName)}:\${sourceInfo.lineNumber}:\${sourceInfo.columnNumber}\`;
825
+ }
826
+
827
+ function unregisterElement(node, sourceInfo) {
828
+ const key = getSourceKey(sourceInfo);
829
+ const refs = sourceElementMap.get(key);
830
+ if (refs) {
831
+ for (const ref of refs) {
832
+ if (ref.deref() === node) {
833
+ refs.delete(ref);
834
+ break;
835
+ }
836
+ }
837
+ if (refs.size === 0) {
838
+ sourceElementMap.delete(key);
839
+ }
840
+ }
841
+ }
842
+
843
+ function registerElement(node, sourceInfo) {
844
+ const key = getSourceKey(sourceInfo);
845
+ if (!sourceElementMap.has(key)) {
846
+ sourceElementMap.set(key, new Set());
847
+ }
848
+ sourceElementMap.get(key).add(new WeakRef(node));
849
+ }
850
+
851
+ function getTypeName(type) {
852
+ if (typeof type === "string") return type;
853
+ if (typeof type === "function") return type.displayName || type.name || "Unknown";
854
+ if (typeof type === "object" && type !== null) {
855
+ return type.displayName || type.render?.displayName || type.render?.name || "Unknown";
856
+ }
857
+ return "Unknown";
858
+ }
859
+
860
+ export function jsxDEV(type, props, key, isStatic, source, self) {
861
+ // For custom components, tag their rendered output
862
+ if (source?.fileName && typeof type !== "string" && type !== Fragment) {
863
+ const typeName = getTypeName(type);
864
+ const jsxSourceInfo = {
865
+ fileName: cleanFileName(source.fileName),
866
+ lineNumber: source.lineNumber,
867
+ columnNumber: source.columnNumber,
868
+ displayName: typeName,
869
+ };
870
+
871
+ const originalRef = props?.ref;
872
+
873
+ // Check if component can safely receive refs
874
+ // - forwardRef components have $$typeof symbol
875
+ // - Class components have prototype.isReactComponent
876
+ // - If there's already a ref, the component expects it
877
+ const isForwardRef = type.$$typeof === Symbol.for('react.forward_ref');
878
+ const isClassComponent = typeof type === 'function' && type.prototype?.isReactComponent;
879
+ const hasExistingRef = originalRef !== undefined;
880
+
881
+ const canReceiveRef = isForwardRef || isClassComponent || hasExistingRef;
882
+
883
+ if (canReceiveRef) {
884
+ const enhancedProps = {
885
+ ...props,
886
+ ref: (node) => {
887
+ if (node) {
888
+ if (!node[SOURCE_KEY]) {
889
+ node[SOURCE_KEY] = jsxSourceInfo;
890
+ registerElement(node, jsxSourceInfo);
891
+ }
892
+ }
893
+ if (typeof originalRef === "function") {
894
+ originalRef(node);
895
+ } else if (originalRef && typeof originalRef === "object") {
896
+ originalRef.current = node;
897
+ }
898
+ },
899
+ };
900
+ return _jsxDEV(type, enhancedProps, key, isStatic, source, self);
901
+ }
902
+
903
+ return _jsxDEV(type, props, key, isStatic, source, self);
904
+ }
905
+
906
+ // For host elements (div, span, etc.), tag with source info
907
+ if (source?.fileName && typeof type === "string") {
908
+ const sourceInfo = {
909
+ fileName: cleanFileName(source.fileName),
910
+ lineNumber: source.lineNumber,
911
+ columnNumber: source.columnNumber,
912
+ displayName: type,
913
+ };
914
+
915
+ const originalRef = props?.ref;
916
+
917
+ const enhancedProps = {
918
+ ...props,
919
+ ref: (node) => {
920
+ if (node) {
921
+ const existingSource = node[SOURCE_KEY];
922
+ if (existingSource) {
923
+ if (getSourceKey(existingSource) !== getSourceKey(sourceInfo)) {
924
+ unregisterElement(node, existingSource);
925
+ node[SOURCE_KEY] = sourceInfo;
926
+ registerElement(node, sourceInfo);
927
+ }
928
+ } else {
929
+ node[SOURCE_KEY] = sourceInfo;
930
+ registerElement(node, sourceInfo);
931
+ }
932
+ }
933
+ if (typeof originalRef === "function") {
934
+ originalRef(node);
935
+ } else if (originalRef && typeof originalRef === "object") {
936
+ originalRef.current = node;
937
+ }
938
+ },
939
+ };
940
+ return _jsxDEV(type, enhancedProps, key, isStatic, source, self);
941
+ }
942
+
943
+ return _jsxDEV(type, props, key, isStatic, source, self);
944
+ }
945
+ `;function v(){let r=false,n="";return {name:"vite-plugin-jsx-source-tagger",enforce:"pre",configResolved(e){r=e.command==="serve",n=e.root;},resolveId(e,t){return r&&e==="react/jsx-dev-runtime"&&!t?.includes("\0jsx-source")?"\0jsx-source/jsx-dev-runtime":null},load(e){return r&&e==="\0jsx-source/jsx-dev-runtime"?j.replace('const PROJECT_ROOT = "";',`const PROJECT_ROOT = ${JSON.stringify(n)};`):null}}}function _(r){let n="",e=false,t=null,o=null,l=r?.configPath||"./tailwind.config.ts",i="@amaster/tailwind-config",u="\0"+i,c=async()=>{let a=d__default.default.resolve(n,l);try{return await S__default.default.access(a),a}catch{if(l.endsWith(".ts")){let s=a.replace(/\.ts$/,".js");try{return await S__default.default.access(s),s}catch{return null}}else if(l.endsWith(".js")){let s=a.replace(/\.js$/,".ts");try{return await S__default.default.access(s),s}catch{return null}}return null}},h=async a=>{try{let s=await c();if(!s)return null;if(a){let E=await a.ssrLoadModule(s);return t=E.default||E,t}let f=await import(`file://${s}?t=${Date.now()}`);return t=f.default||f,t}catch(s){return console.error("[tailwind-config-sync] Failed to generate config:",s),null}};return {name:"vite-plugin-tailwind-config-sync",configResolved(a){n=a.root,e=a.command==="serve";},async buildStart(){e&&await h();},resolveId(a){if(a===i)return u},async load(a){if(a===u)return await h(o),t?`
946
+ // Use global variable to persist callbacks and current config across HMR updates
947
+ if (!window.__tailwindConfigCallbacks) {
948
+ window.__tailwindConfigCallbacks = [];
949
+ }
950
+
951
+ // Always update current config with the latest from server
952
+ let tailwindConfigCurrent = ${JSON.stringify(t)};
953
+
954
+ if (import.meta.hot) {
955
+ // Accept self updates
956
+ import.meta.hot.accept((newModule) => {
957
+ if (newModule && newModule.default) {
958
+ // Call all update callbacks with the new config from window
959
+ window.__tailwindConfigCallbacks.forEach((callback) => {
960
+ try {
961
+ // Pass the actual config object, not the Proxy
962
+ callback(newModule.default);
963
+ } catch (e) {
964
+ console.error('[TailwindConfig] Callback error:', e);
965
+ }
966
+ });
967
+ }
968
+ });
969
+ }
970
+
971
+ export function onUpdate(fn) {
972
+ window.__tailwindConfigCallbacks.push(fn);
973
+ return () => {
974
+ const index = window.__tailwindConfigCallbacks.indexOf(fn);
975
+ if (index > -1) {
976
+ window.__tailwindConfigCallbacks.splice(index, 1);
977
+ }
978
+ };
979
+ };
980
+ export default tailwindConfigCurrent;
981
+
982
+ `:"export default null;"},configureServer(a){e&&(o=a,(async()=>{try{let s=await c();s&&a.watcher.add(s);}catch{}})());},async handleHotUpdate({file:a,server:s}){let p=await c();if(!p||d__default.default.normalize(a)!==d__default.default.normalize(p))return;let f=s.moduleGraph.getModuleById(p);f&&s.moduleGraph.invalidateModule(f),await h(s);let g=s.moduleGraph.getModuleById(u);return g?(s.moduleGraph.invalidateModule(g),[g]):[]}}}function b(r={}){let{designWidth:n=375,maxWidth:e=750,baseFontSize:t=12,minRootSize:o=12,maxRootSize:l=24}=r;return {name:"vite-plugin-taro-style-adapter",apply:"serve",transformIndexHtml(i){let u=`
710
983
  <script data-taro-flexible="true">
711
984
  (function() {
712
- var designWidth = ${r};
985
+ var designWidth = ${n};
713
986
  var maxWidth = ${e};
714
987
  var baseFontSize = ${t};
715
988
  var minRootSize = ${o};
716
- var maxRootSize = ${i};
989
+ var maxRootSize = ${l};
717
990
 
718
991
  function setRootFontSize() {
719
992
  var docEl = document.documentElement;
@@ -747,7 +1020,7 @@ if (typeof window !== 'undefined') {
747
1020
  document.addEventListener('DOMContentLoaded', setRootFontSize);
748
1021
  })();
749
1022
  </script>
750
- `;return s.replace("</head>",`${f}
1023
+ `;return i.replace("</head>",`${u}
751
1024
  <style data-taro-adapter="true">
752
1025
  /* \u4EC5 H5 \u751F\u6548\uFF1A\u9690\u85CF Taro \u9875\u9762\u5BB9\u5668\u6EDA\u52A8\u6761\uFF0C\u4F46\u4ECD\u53EF\u6EDA\u52A8 */
753
1026
  .taro_page {
@@ -793,5 +1066,5 @@ if (typeof window !== 'undefined') {
793
1066
  object-fit: contain;
794
1067
  }
795
1068
  </style>
796
- </head>`)}}}function y(n={}){let{ratio:r=2}=n;return {postcssPlugin:"postcss-rpx2px",Declaration(e){e.value?.includes("rpx")&&(e.value=e.value.replace(/(-?\d*\.?\d+)rpx/gi,(t,o)=>{let i=parseFloat(o)/r;return i===0?"0":`${i}px`}));}}}y.postcss=true;function C(n={}){let{additional:r=[],autoInjectTaroApp:e=true,autoInjectVite:t=true}=n,o={},i=new Set(r);return e&&Object.keys(process.env).forEach(s=>{s.startsWith("TARO_APP_")&&i.add(s);}),t&&Object.keys(process.env).forEach(s=>{s.startsWith("VITE_")&&i.add(s);}),i.forEach(s=>{let f=process.env[s]||"";o[`process.env.${s}`]=JSON.stringify(f);}),o}function j(){return {"process.env.TARO_APP_API_BASE_URL":JSON.stringify(process.env.TARO_APP_API_BASE_URL||""),"process.env.VITE_API_BASE_URL":JSON.stringify(process.env.VITE_API_BASE_URL||"")}}function B(n={}){let r=n.isTaro??x__default.default.env.TARO_ENV==="h5",e=[b(),_(),w()];return r&&(e.unshift(S(n.styleAdapter)),e.unshift({name:"dev-postcss-rpx2px-plugin",apply:"serve",config(t){typeof t.css?.postcss=="object"&&t.css?.postcss.plugins?.unshift(y());}})),x__default.default.env.WORKSPACE_GIT_REPO&&e.push(T()),e}exports.componentIdPlugin=b;exports.default=B;exports.editorBridgePlugin=_;exports.injectAmasterEnv=j;exports.injectTaroEnv=C;exports.routesExposePlugin=w;exports.rpx2pxPlugin=y;exports.taroStyleAdapterPlugin=S;//# sourceMappingURL=index.cjs.map
1069
+ </head>`)}}}function y(r={}){let{ratio:n=2}=r;return {postcssPlugin:"postcss-rpx2px",Declaration(e){e.value?.includes("rpx")&&(e.value=e.value.replace(/(-?\d*\.?\d+)rpx/gi,(t,o)=>{let l=parseFloat(o)/n;return l===0?"0":`${l}px`}));}}}y.postcss=true;function k(r={}){let{additional:n=[],autoInjectTaroApp:e=true,autoInjectVite:t=true}=r,o={},l=new Set(n);return e&&Object.keys(process.env).forEach(i=>{i.startsWith("TARO_APP_")&&l.add(i);}),t&&Object.keys(process.env).forEach(i=>{i.startsWith("VITE_")&&l.add(i);}),l.forEach(i=>{let u=process.env[i]||"";o[`process.env.${i}`]=JSON.stringify(u);}),o}function D(){return {"process.env.TARO_APP_API_BASE_URL":JSON.stringify(process.env.TARO_APP_API_BASE_URL||""),"process.env.VITE_API_BASE_URL":JSON.stringify(process.env.VITE_API_BASE_URL||"")}}function q(r={}){let n=r.isTaro??C__default.default.env.TARO_ENV==="h5",e=[R(),T()];return r.jsxSourceTagger!==false&&e.push(v()),r.tailwindConfigSync!==false&&e.push(_({configPath:r.tailwindConfigPath})),n&&(e.unshift(b(r.styleAdapter)),e.unshift({name:"dev-postcss-rpx2px-plugin",apply:"serve",config(t){typeof t.css?.postcss=="object"&&t.css?.postcss.plugins?.unshift(y());}})),C__default.default.env.WORKSPACE_GIT_REPO&&e.push(P()),e}exports.default=q;exports.editorBridgePlugin=R;exports.injectAmasterEnv=D;exports.injectTaroEnv=k;exports.jsxSourceTaggerPlugin=v;exports.routesExposePlugin=T;exports.rpx2pxPlugin=y;exports.tailwindConfigSyncPlugin=_;exports.taroStyleAdapterPlugin=b;//# sourceMappingURL=index.cjs.map
797
1070
  //# sourceMappingURL=index.cjs.map