@lark-apaas/fullstack-rspack-preset 1.0.50-alpha.7 → 1.0.50-alpha.9

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/lib/preset.js CHANGED
@@ -377,12 +377,6 @@ function createRecommendRspackConfig(options) {
377
377
  changeOrigin: true,
378
378
  onError: sendBackendUnavailable502,
379
379
  },
380
- {
381
- context: [`${clientBasePath}/openapi`],
382
- target: `http://localhost:${serverPort}`,
383
- changeOrigin: true,
384
- onError: sendBackendUnavailable502,
385
- },
386
380
  {
387
381
  context: [`${clientBasePath}/__innerapi__`],
388
382
  target: `http://localhost:${serverPort}`,
@@ -94,6 +94,34 @@ function getSlardarScriptContent(option = {}) {
94
94
  const bid = option.bid || 'apaas_miaoda';
95
95
  const globalName = option.globalName || 'KSlardarWeb';
96
96
  return [
97
+ {
98
+ tagName: 'script',
99
+ voidTag: false,
100
+ innerHTML: `(function(g){
101
+ if(!window[g]){var q=[];window[g]=function(){q.push([].slice.call(arguments));};window[g].q=q;}
102
+ var buf=window.__slardarErrBuf=window.__slardarErrBuf||[];
103
+ var ref=document.referrer||'';
104
+ window.addEventListener('error',function(e){
105
+ if(e.error==null&&e.target instanceof Element){
106
+ var t=e.target,url=t.src||t.href||'';
107
+ if(url)window[g]('captureException',new Error('Resource load failed: '+url),{team:'miaoda-sdk',source:'resource-error',resourceType:t.tagName.toLowerCase(),resourceUrl:url,referrer:ref});
108
+ return;
109
+ }
110
+ if(e.error!=null){
111
+ buf.push(e.error);
112
+ } else {
113
+ var msg=e.message||'Script error';
114
+ var err=new Error(msg);
115
+ if(e.filename)err.stack=msg+'\\n at '+e.filename+':'+(e.lineno||0)+':'+(e.colno||0);
116
+ buf.push(err);
117
+ }
118
+ },true);
119
+ window.addEventListener('unhandledrejection',function(e){
120
+ if(e.reason!=null)buf.push(e.reason instanceof Error?e.reason:new Error(String(e.reason)));
121
+ });
122
+ })('${globalName}');`,
123
+ attributes: {},
124
+ },
97
125
  {
98
126
  tagName: 'script',
99
127
  voidTag: false,
@@ -109,6 +137,7 @@ function getSlardarScriptContent(option = {}) {
109
137
  window.${globalName}('context.merge', {
110
138
  tenantId: window.tenantId ?? '',
111
139
  appId: window.appId ?? '',
140
+ referrer: document.referrer || '',
112
141
  });
113
142
  window.${globalName}('init', {
114
143
  bid: '${bid}',
@@ -116,6 +145,11 @@ function getSlardarScriptContent(option = {}) {
116
145
  userId: window.userId ?? '',
117
146
  });
118
147
  window.${globalName}('start');
148
+ var buf = window.__slardarErrBuf || [];
149
+ window.__slardarErrBuf = [];
150
+ buf.forEach(function(err) {
151
+ window.${globalName}('captureException', err instanceof Error ? err : new Error(String(err)), { source: 'pre-sdk-error', referrer: document.referrer || '' });
152
+ });
119
153
  }
120
154
  };
121
155
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-rspack-preset",
3
- "version": "1.0.50-alpha.7",
3
+ "version": "1.0.50-alpha.9",
4
4
  "files": [
5
5
  "lib",
6
6
  "patches",
@@ -31,7 +31,7 @@
31
31
  "@babel/parser": "^7.28.0",
32
32
  "@babel/traverse": "^7.28.0",
33
33
  "@babel/types": "^7.28.2",
34
- "@lark-apaas/devtool-kits": "1.2.17-alpha.54",
34
+ "@lark-apaas/devtool-kits": "^1.2.20",
35
35
  "@lark-apaas/miaoda-inspector-babel-plugin": "^1.0.2",
36
36
  "@lark-apaas/styled-jsx": "^1.0.1",
37
37
  "@rspack/plugin-react-refresh": "^1.5.1",