swico 2.6.0-beta.9 → 2.7.0

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/README.md CHANGED
@@ -7,7 +7,7 @@ Swico,发音近似于“斯威扣”。
7
7
 
8
8
  ## 主要特性
9
9
 
10
- - 构建工具基于Rspack 1.x,基于Rust多线程驱动,显著提升编译性能。
10
+ - 构建工具基于Rspack 1.x,底层基于Rust多线程驱动,显著提升编译性能。
11
11
 
12
12
  - 提供Vue3和React18两种开发模板选择,默认集成TypeScript5。同时最大化统一这两种模板的开发API。
13
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swico",
3
- "version": "2.6.0-beta.9",
3
+ "version": "2.7.0",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -26,7 +26,7 @@ const dev_server_1 = require("@rspack/dev-server");
26
26
  const fs_extra_1 = __importDefault(require("fs-extra"));
27
27
  const core_1 = require("@rspack/core");
28
28
  let currentPort, currentRouterBase = '/';
29
- const handleWatch = (projectPath, devServer, env, templateType) => {
29
+ const handleWatch = (projectPath, devServer, env) => {
30
30
  const envPath = env === 'dev' ? '/.dev/' : '/.prod/';
31
31
  const configFilesWatcher = chokidar_1.default
32
32
  .watch([path_1.default.join(projectPath, '/config/*.ts'), path_1.default.join(projectPath, '/.eslint.config.mjs')], {
@@ -69,7 +69,7 @@ const handleWatch = (projectPath, devServer, env, templateType) => {
69
69
  yield (0, main_config_1.updateIndexFileText)(envPath, replaceIndexText);
70
70
  break;
71
71
  case filePath === loadingFilePath:
72
- replaceIndexText = yield (0, main_config_1.handleLoadingFile)(projectPath, templateType, replaceIndexText);
72
+ replaceIndexText = yield (0, main_config_1.handleLoadingFile)(projectPath, replaceIndexText);
73
73
  yield (0, main_config_1.updateIndexFileText)(envPath, replaceIndexText);
74
74
  }
75
75
  }
@@ -156,7 +156,7 @@ function start() {
156
156
  process.env.SWICO_DEV_PORT = availablePort.toString();
157
157
  createCompileListener(compiler);
158
158
  compiler.getInfrastructureLogger = oriLogger;
159
- handleWatch(projectPath, devServer, env, templateType);
159
+ handleWatch(projectPath, devServer, env);
160
160
  if (SWICO_DEV_RESTART !== 'true' ||
161
161
  (SWICO_DEV_RESTART === 'true' && newRouterBase !== SWICO_DEV_ROUTER_BASE)) {
162
162
  utils_1.toast.info(`Project is running at:${chalk_1.default.hex('#29abe0')(`${startConfig.devServer.server}://localhost:${availablePort}${newRouterBase}`)}`);
@@ -44,7 +44,7 @@ export interface GlobalData {
44
44
  };
45
45
  }
46
46
  export declare const getProjectConfig: (env: GlobalData['env']) => Promise<GlobalData>;
47
- export declare const handleLoadingFile: (projectPath: any, templateType: GlobalData["templateType"], replaceIndexText: any) => Promise<any>;
47
+ export declare const handleLoadingFile: (projectPath: any, replaceIndexText: any) => Promise<any>;
48
48
  export declare const handleGlobalStyleFile: (replaceIndexText: any) => any;
49
49
  export declare const updateIndexFileText: (envPath: any, newFileText: any) => Promise<void>;
50
50
  export declare const getFormatDefineVars: (defineVarsConfigData: any) => Promise<{}>;
@@ -221,14 +221,14 @@ const getGlobalStyleFilePath = () => {
221
221
  }
222
222
  return { filePath, fileType };
223
223
  };
224
- const handleLoadingFile = (projectPath, templateType, replaceIndexText) => __awaiter(void 0, void 0, void 0, function* () {
224
+ const handleLoadingFile = (projectPath, replaceIndexText) => __awaiter(void 0, void 0, void 0, function* () {
225
225
  let newReplaceIndexText = replaceIndexText;
226
226
  try {
227
- yield fs_extra_1.default.access(path_1.default.resolve(projectPath, `./src/loading/${templateType === 'react' ? 'index.tsx' : 'Loading.vue'}`), fs_extra_1.default.constants.F_OK);
228
- newReplaceIndexText = newReplaceIndexText.replace('"../loading"', `"../../src/${templateType === 'react' ? 'loading' : 'loading/Loading'}"`);
227
+ yield fs_extra_1.default.access(path_1.default.resolve(projectPath, './src/loading/index.tsx'), fs_extra_1.default.constants.F_OK);
228
+ newReplaceIndexText = newReplaceIndexText.replace('"../loading"', '"../../src/loading"');
229
229
  }
230
230
  catch (e) {
231
- newReplaceIndexText = newReplaceIndexText.replace(`"../../src/${templateType === 'react' ? 'loading' : 'loading/Loading'}"`, '"../loading"');
231
+ newReplaceIndexText = newReplaceIndexText.replace('"../../src/loading', '"../loading"');
232
232
  }
233
233
  return newReplaceIndexText;
234
234
  });
@@ -268,7 +268,7 @@ const initTemplateConfig = (routerConfig, templateType, env) => {
268
268
  let replaceIndexText = yield fs_extra_1.default.readFile(path_1.default.resolve(projectPath, `./.swico${envPath}index.js`), 'utf8');
269
269
  replaceIndexText = (0, exports.handleGlobalStyleFile)(replaceIndexText);
270
270
  if (templateType === 'react') {
271
- replaceIndexText = yield (0, exports.handleLoadingFile)(projectPath, templateType, replaceIndexText);
271
+ replaceIndexText = yield (0, exports.handleLoadingFile)(projectPath, replaceIndexText);
272
272
  }
273
273
  yield (0, exports.updateIndexFileText)(envPath, replaceIndexText);
274
274
  resolve(null);
@@ -97,5 +97,5 @@ const App = () => {
97
97
  });
98
98
  return react_1.default.createElement(react_router_1.RouterProvider, { router: router });
99
99
  };
100
- const root = (0, client_1.createRoot)(document.getElementById('root'));
100
+ const root = (0, client_1.createRoot)(document.getElementById('swico-root'));
101
101
  root.render(react_1.default.createElement(App, null));
@@ -25,4 +25,4 @@ const app = (0, vue_1.createApp)(Container);
25
25
  app.component('SwicoLayout', Layout_1.default);
26
26
  app.use(router);
27
27
  (_a = global_1.default === null || global_1.default === void 0 ? void 0 : global_1.default.onInit) === null || _a === void 0 ? void 0 : _a.call(global_1.default, app, router);
28
- app.mount('#root');
28
+ app.mount('#swico-root');