@meituan-nocode/vite-plugin-nocode-compiler 0.1.0-beta.17-z → 0.1.0-beta.18-z

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -39,6 +39,15 @@ exports.NocodeCompiler = NocodeCompiler;
39
39
  const compilerCore = __importStar(require("@meituan-nocode/nocode-compiler-core"));
40
40
  const { CodeTransformer } = compilerCore;
41
41
  const utils_1 = require("./utils");
42
+ // 检查是否安装了@vue/compiler-dom
43
+ let vueCompilerAvailable = false;
44
+ try {
45
+ require('@vue/compiler-dom');
46
+ vueCompilerAvailable = true;
47
+ }
48
+ catch (error) {
49
+ console.warn('[vite-plugin-nocode-compiler] @vue/compiler-dom not found. Vue compilation will be skipped.');
50
+ }
42
51
  /**
43
52
  * Vite插件
44
53
  * 用于在构建过程中处理Vue和React组件,添加nocode相关的标记
@@ -71,6 +80,11 @@ function NocodeCompiler(options = {}) {
71
80
  // vue 代码
72
81
  fileType = 'vue';
73
82
  }
83
+ // 如果是Vue文件但@vue/compiler-dom不可用,跳过处理
84
+ if (fileType === 'vue' && !vueCompilerAvailable) {
85
+ console.warn(`[vite-plugin-nocode-compiler] Skipping Vue file processing for ${filePath} due to missing @vue/compiler-dom`);
86
+ return code;
87
+ }
74
88
  if (fileType) {
75
89
  return codeTransformer.transformCode({
76
90
  content: code,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meituan-nocode/vite-plugin-nocode-compiler",
3
- "version": "0.1.0-beta.17-z",
3
+ "version": "0.1.0-beta.18-z",
4
4
  "description": "nocode compiler plugin",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
@@ -27,6 +27,6 @@
27
27
  "vite": "^4.5.14"
28
28
  },
29
29
  "dependencies": {
30
- "@meituan-nocode/nocode-compiler-core": "0.1.0-beta.17-z"
30
+ "@meituan-nocode/nocode-compiler-core": "0.1.0-beta.18-z"
31
31
  }
32
32
  }