@meituan-nocode/vite-plugin-nocode-compiler 0.1.0-beta.19-z → 0.1.0-beta.20-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.
package/dist/index.js CHANGED
@@ -70,11 +70,6 @@ function NocodeCompiler(options = {}) {
70
70
  const [_completePath, query] = id.split('?', 2); // 当前文件的绝对路径
71
71
  let filePath = _completePath;
72
72
  const params = new URLSearchParams(query);
73
- // 检查是否需要标记入口文件
74
- const isEntry = options.entryFileMarker && (0, utils_1.isEntryFile)(filePath);
75
- if (isEntry && options.enableLogging) {
76
- console.log(`[vite-plugin-nocode-compiler] Processing entry file: ${filePath}`);
77
- }
78
73
  let fileType = '';
79
74
  if ((0, utils_1.isJsTypeFile)(filePath) || (filePath.endsWith('.vue') && (utils_1.jsxParamList.some(param => params.get(param) !== null) || params.get('lang') === 'tsx' || params.get('lang') === 'jsx'))) {
80
75
  // jsx 代码
@@ -98,7 +93,6 @@ function NocodeCompiler(options = {}) {
98
93
  content: code,
99
94
  filePath,
100
95
  fileType,
101
- isEntry,
102
96
  });
103
97
  }
104
98
  return code;
package/dist/utils.d.ts CHANGED
@@ -1,14 +1,6 @@
1
1
  export declare const JsFileExtList: string[];
2
2
  export declare const jsxParamList: string[];
3
3
  export declare function isJsTypeFile(file: string): boolean;
4
- /**
5
- * 判断文件是否为入口文件
6
- * 在 Vite 中,入口文件通常是 index.html 或者在 build.rollupOptions.input 中指定的文件
7
- * 由于插件无法直接访问 Vite 配置,我们使用一些启发式方法来判断
8
- * @param filePath 文件路径
9
- * @returns 是否为入口文件
10
- */
11
- export declare function isEntryFile(filePath: string): boolean;
12
4
  /**
13
5
  * 规范化路径,将反斜杠转换为正斜杠
14
6
  * @param filePath 文件路径
package/dist/utils.js CHANGED
@@ -1,42 +1,14 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.jsxParamList = exports.JsFileExtList = void 0;
7
4
  exports.isJsTypeFile = isJsTypeFile;
8
- exports.isEntryFile = isEntryFile;
9
5
  exports.normalizePath = normalizePath;
10
- const path_1 = __importDefault(require("path"));
11
6
  exports.JsFileExtList = ['.js', '.ts', '.mjs', '.mts', '.jsx', '.tsx'];
12
7
  exports.jsxParamList = ['isJsx', 'isTsx', 'lang.jsx', 'lang.tsx'];
13
8
  // 是否为 JS 类型的文件
14
9
  function isJsTypeFile(file) {
15
10
  return exports.JsFileExtList.some(ext => file.endsWith(ext));
16
11
  }
17
- /**
18
- * 判断文件是否为入口文件
19
- * 在 Vite 中,入口文件通常是 index.html 或者在 build.rollupOptions.input 中指定的文件
20
- * 由于插件无法直接访问 Vite 配置,我们使用一些启发式方法来判断
21
- * @param filePath 文件路径
22
- * @returns 是否为入口文件
23
- */
24
- function isEntryFile(filePath) {
25
- // 规范化路径
26
- const normalizedPath = normalizePath(filePath);
27
- // 检查是否为 index.html
28
- if (normalizedPath.endsWith('/index.html') || normalizedPath.endsWith('\\index.html')) {
29
- return true;
30
- }
31
- // 检查是否为 src/main.js, src/main.ts, src/index.js, src/index.ts 等常见入口文件
32
- const fileName = path_1.default.basename(normalizedPath);
33
- const dirName = path_1.default.dirname(normalizedPath);
34
- if ((fileName === 'main.js' || fileName === 'main.ts' || fileName === 'main.jsx' || fileName === 'main.tsx' || fileName === 'index.js' || fileName === 'index.ts' || fileName === 'index.jsx' || fileName === 'index.tsx') && (dirName.endsWith('/src') || dirName.endsWith('\\src'))) {
35
- return true;
36
- }
37
- // 如果有更多的入口文件模式,可以在这里添加
38
- return false;
39
- }
40
12
  /**
41
13
  * 规范化路径,将反斜杠转换为正斜杠
42
14
  * @param filePath 文件路径
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.19-z",
3
+ "version": "0.1.0-beta.20-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.19-z"
30
+ "@meituan-nocode/nocode-compiler-core": "0.1.0-beta.20-z"
31
31
  }
32
32
  }