@meituan-nocode/vite-plugin-nocode-compiler 0.2.9-beta.0 → 0.2.9-beta.2

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
@@ -47,7 +47,7 @@ function readJsonBody(req) {
47
47
  }
48
48
 
49
49
  // package.json
50
- var version = "0.2.9-beta.0";
50
+ var version = "0.2.9-beta.2";
51
51
 
52
52
  // src/index.ts
53
53
  function getHotChannel(server) {
@@ -131,19 +131,17 @@ function resolveFileToAbsPath(file, viteRoot) {
131
131
  return null;
132
132
  }
133
133
  var PLUGIN_NAME = "vite-plugin-nocode-compiler";
134
- function ensurePluginFirst(config) {
134
+ function ensurePluginFirst(config, onError) {
135
135
  try {
136
136
  const plugins = config.plugins;
137
137
  if (!Array.isArray(plugins)) return;
138
- const targetPlugin = plugins.find((p) => p.name === PLUGIN_NAME);
139
- if (!targetPlugin) return;
140
- if (plugins[0] === targetPlugin) return;
141
- const idx = plugins.indexOf(targetPlugin);
138
+ const idx = plugins.findIndex((p) => p.name === PLUGIN_NAME);
142
139
  if (idx > 0) {
143
- plugins.splice(idx, 1);
140
+ const [targetPlugin] = plugins.splice(idx, 1);
144
141
  plugins.unshift(targetPlugin);
145
142
  }
146
- } catch {
143
+ } catch (e) {
144
+ onError == null ? void 0 : onError(e instanceof Error ? e : new Error(String(e)));
147
145
  }
148
146
  }
149
147
  function componentCompiler(options = {}) {
@@ -170,7 +168,7 @@ function componentCompiler(options = {}) {
170
168
  * 2. 初始化 PackageVersionRegistry
171
169
  */
172
170
  configResolved(config) {
173
- ensurePluginFirst(config);
171
+ ensurePluginFirst(config, (error) => monitorService.reportError(error, { scene: "ensurePluginFirst" }));
174
172
  pkgRegistry = new import_nocode_compiler_core.PackageVersionRegistry(config.root);
175
173
  },
176
174
  /**
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ function readJsonBody(req) {
22
22
  }
23
23
 
24
24
  // package.json
25
- var version = "0.2.9-beta.0";
25
+ var version = "0.2.9-beta.2";
26
26
 
27
27
  // src/index.ts
28
28
  function getHotChannel(server) {
@@ -106,19 +106,17 @@ function resolveFileToAbsPath(file, viteRoot) {
106
106
  return null;
107
107
  }
108
108
  var PLUGIN_NAME = "vite-plugin-nocode-compiler";
109
- function ensurePluginFirst(config) {
109
+ function ensurePluginFirst(config, onError) {
110
110
  try {
111
111
  const plugins = config.plugins;
112
112
  if (!Array.isArray(plugins)) return;
113
- const targetPlugin = plugins.find((p) => p.name === PLUGIN_NAME);
114
- if (!targetPlugin) return;
115
- if (plugins[0] === targetPlugin) return;
116
- const idx = plugins.indexOf(targetPlugin);
113
+ const idx = plugins.findIndex((p) => p.name === PLUGIN_NAME);
117
114
  if (idx > 0) {
118
- plugins.splice(idx, 1);
115
+ const [targetPlugin] = plugins.splice(idx, 1);
119
116
  plugins.unshift(targetPlugin);
120
117
  }
121
- } catch {
118
+ } catch (e) {
119
+ onError == null ? void 0 : onError(e instanceof Error ? e : new Error(String(e)));
122
120
  }
123
121
  }
124
122
  function componentCompiler(options = {}) {
@@ -145,7 +143,7 @@ function componentCompiler(options = {}) {
145
143
  * 2. 初始化 PackageVersionRegistry
146
144
  */
147
145
  configResolved(config) {
148
- ensurePluginFirst(config);
146
+ ensurePluginFirst(config, (error) => monitorService.reportError(error, { scene: "ensurePluginFirst" }));
149
147
  pkgRegistry = new PackageVersionRegistry(config.root);
150
148
  },
151
149
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meituan-nocode/vite-plugin-nocode-compiler",
3
- "version": "0.2.9-beta.0",
3
+ "version": "0.2.9-beta.2",
4
4
  "description": "Vite plugin for nocode compiler",
5
5
  "type": "module",
6
6
  "exports": {