swico 2.6.0-beta.8 → 2.6.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/package.json +1 -1
- package/src/command/start.js +3 -3
- package/src/index.vue.js +1 -1
- package/src/main-config/index.d.ts +1 -1
- package/src/main-config/index.js +5 -5
- package/src/project-path/.swico-vue/$env/index.js +0 -2
- package/src/project-path/.swico-vue/loading.d.ts +0 -2
- package/src/project-path/.swico-vue/loading.js +0 -7
package/package.json
CHANGED
package/src/command/start.js
CHANGED
|
@@ -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
|
|
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,
|
|
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
|
|
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}`)}`);
|
package/src/index.vue.js
CHANGED
|
@@ -11,7 +11,7 @@ var mock_history_1 = require("./mock-history");
|
|
|
11
11
|
Object.defineProperty(exports, "history", { enumerable: true, get: function () { return mock_history_1.history; } });
|
|
12
12
|
exports.Outlet = (0, vue_1.defineComponent)({
|
|
13
13
|
name: 'Outlet',
|
|
14
|
-
template: '<RouterView v-slot="{ Component }"><template v-if="Component"><Suspense><component :is="Component"></component><template #fallback
|
|
14
|
+
template: '<RouterView v-slot="{ Component }"><template v-if="Component"><Suspense><component :is="Component"></component><template #fallback></template></Suspense></template></RouterView>'
|
|
15
15
|
});
|
|
16
16
|
const defineConfig = (env, config) => config;
|
|
17
17
|
exports.defineConfig = defineConfig;
|
|
@@ -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,
|
|
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<{}>;
|
package/src/main-config/index.js
CHANGED
|
@@ -221,14 +221,14 @@ const getGlobalStyleFilePath = () => {
|
|
|
221
221
|
}
|
|
222
222
|
return { filePath, fileType };
|
|
223
223
|
};
|
|
224
|
-
const handleLoadingFile = (projectPath,
|
|
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,
|
|
228
|
-
newReplaceIndexText = newReplaceIndexText.replace('"../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(
|
|
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,
|
|
271
|
+
replaceIndexText = yield (0, exports.handleLoadingFile)(projectPath, replaceIndexText);
|
|
272
272
|
}
|
|
273
273
|
yield (0, exports.updateIndexFileText)(envPath, replaceIndexText);
|
|
274
274
|
resolve(null);
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
const vue_1 = require("vue");
|
|
8
8
|
const Layout_1 = __importDefault(require("../../src/layout/Layout"));
|
|
9
9
|
const global_1 = __importDefault(require("../../src/global"));
|
|
10
|
-
const loading_1 = __importDefault(require("../loading"));
|
|
11
10
|
const history_1 = require("./history");
|
|
12
11
|
const Container = (0, vue_1.defineComponent)({
|
|
13
12
|
name: 'Container',
|
|
@@ -24,7 +23,6 @@ const Container = (0, vue_1.defineComponent)({
|
|
|
24
23
|
const router = (0, history_1.getRouter)();
|
|
25
24
|
const app = (0, vue_1.createApp)(Container);
|
|
26
25
|
app.component('SwicoLayout', Layout_1.default);
|
|
27
|
-
app.component('SwicoLoading', loading_1.default);
|
|
28
26
|
app.use(router);
|
|
29
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);
|
|
30
28
|
app.mount('#root');
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
-
export default _default;
|