swico 1.5.0-beta.5 → 1.5.0-beta.7
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swico",
|
|
3
|
-
"version": "1.5.0-beta.
|
|
3
|
+
"version": "1.5.0-beta.7",
|
|
4
4
|
"description": "Simple, efficient, and practical front-end framework",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -30,6 +30,12 @@
|
|
|
30
30
|
"author": "scw",
|
|
31
31
|
"license": "ISC",
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"qs": "6.13.0",
|
|
34
|
+
"react": "~18.2.0",
|
|
35
|
+
"react-dom": "~18.2.0",
|
|
36
|
+
"react-router-dom": "6.23.0",
|
|
37
|
+
"vue": "~3.4.14",
|
|
38
|
+
"vue-router": "^4.2.5",
|
|
33
39
|
"@babel/types": "7.23.9",
|
|
34
40
|
"@commitlint/cli": "18.5.0",
|
|
35
41
|
"@commitlint/config-conventional": "18.5.0",
|
|
@@ -64,6 +64,7 @@ var mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin
|
|
|
64
64
|
var config_1 = require("../utils/config");
|
|
65
65
|
var html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
66
66
|
var webpack_1 = __importDefault(require("webpack"));
|
|
67
|
+
var tools_1 = require("../utils/tools");
|
|
67
68
|
function default_1(_a) {
|
|
68
69
|
var _b, _c, _d;
|
|
69
70
|
var projectPath = _a.projectPath, entryPath = _a.entryPath, env = _a.env, customConfig = _a.customConfig;
|
|
@@ -113,7 +114,7 @@ function default_1(_a) {
|
|
|
113
114
|
exclude: /node_modules/,
|
|
114
115
|
use: [
|
|
115
116
|
{
|
|
116
|
-
loader:
|
|
117
|
+
loader: (0, tools_1.getLoaderPath)('swc-loader'),
|
|
117
118
|
options: {
|
|
118
119
|
jsc: {
|
|
119
120
|
parser: {
|
|
@@ -140,9 +141,11 @@ function default_1(_a) {
|
|
|
140
141
|
{
|
|
141
142
|
test: /\.module\.css$/,
|
|
142
143
|
use: [
|
|
143
|
-
env === 'dev'
|
|
144
|
+
env === 'dev'
|
|
145
|
+
? (0, tools_1.getLoaderPath)('style-loader')
|
|
146
|
+
: mini_css_extract_plugin_1.default.loader,
|
|
144
147
|
{
|
|
145
|
-
loader: 'css-loader',
|
|
148
|
+
loader: (0, tools_1.getLoaderPath)('css-loader'),
|
|
146
149
|
options: {
|
|
147
150
|
modules: {
|
|
148
151
|
localIdentName: 'moduleStyle_[local]_[contenthash:8]'
|
|
@@ -150,7 +153,7 @@ function default_1(_a) {
|
|
|
150
153
|
}
|
|
151
154
|
},
|
|
152
155
|
{
|
|
153
|
-
loader: 'postcss-loader',
|
|
156
|
+
loader: (0, tools_1.getLoaderPath)('postcss-loader'),
|
|
154
157
|
options: {
|
|
155
158
|
postcssOptions: {
|
|
156
159
|
plugins: [['autoprefixer']]
|
|
@@ -162,10 +165,12 @@ function default_1(_a) {
|
|
|
162
165
|
{
|
|
163
166
|
test: /\.css$/,
|
|
164
167
|
use: [
|
|
165
|
-
env === 'dev'
|
|
166
|
-
|
|
168
|
+
env === 'dev'
|
|
169
|
+
? (0, tools_1.getLoaderPath)('style-loader')
|
|
170
|
+
: mini_css_extract_plugin_1.default.loader,
|
|
171
|
+
(0, tools_1.getLoaderPath)('css-loader'),
|
|
167
172
|
{
|
|
168
|
-
loader: 'postcss-loader',
|
|
173
|
+
loader: (0, tools_1.getLoaderPath)('postcss-loader'),
|
|
169
174
|
options: {
|
|
170
175
|
postcssOptions: {
|
|
171
176
|
plugins: [['autoprefixer']]
|
|
@@ -177,9 +182,11 @@ function default_1(_a) {
|
|
|
177
182
|
{
|
|
178
183
|
test: /\.module\.less$/,
|
|
179
184
|
use: [
|
|
180
|
-
env === 'dev'
|
|
185
|
+
env === 'dev'
|
|
186
|
+
? (0, tools_1.getLoaderPath)('style-loader')
|
|
187
|
+
: mini_css_extract_plugin_1.default.loader,
|
|
181
188
|
{
|
|
182
|
-
loader: 'css-loader',
|
|
189
|
+
loader: (0, tools_1.getLoaderPath)('css-loader'),
|
|
183
190
|
options: {
|
|
184
191
|
modules: {
|
|
185
192
|
localIdentName: 'moduleStyle_[local]_[contenthash:8]'
|
|
@@ -187,38 +194,42 @@ function default_1(_a) {
|
|
|
187
194
|
}
|
|
188
195
|
},
|
|
189
196
|
{
|
|
190
|
-
loader: 'postcss-loader',
|
|
197
|
+
loader: (0, tools_1.getLoaderPath)('postcss-loader'),
|
|
191
198
|
options: {
|
|
192
199
|
postcssOptions: {
|
|
193
200
|
plugins: [['postcss-preset-env', 'autoprefixer']]
|
|
194
201
|
}
|
|
195
202
|
}
|
|
196
203
|
},
|
|
197
|
-
'less-loader'
|
|
204
|
+
(0, tools_1.getLoaderPath)('less-loader')
|
|
198
205
|
]
|
|
199
206
|
},
|
|
200
207
|
{
|
|
201
208
|
test: /\.less$/,
|
|
202
209
|
use: [
|
|
203
|
-
env === 'dev'
|
|
204
|
-
|
|
210
|
+
env === 'dev'
|
|
211
|
+
? (0, tools_1.getLoaderPath)('style-loader')
|
|
212
|
+
: mini_css_extract_plugin_1.default.loader,
|
|
213
|
+
(0, tools_1.getLoaderPath)('css-loader'),
|
|
205
214
|
{
|
|
206
|
-
loader: 'postcss-loader',
|
|
215
|
+
loader: (0, tools_1.getLoaderPath)('postcss-loader'),
|
|
207
216
|
options: {
|
|
208
217
|
postcssOptions: {
|
|
209
218
|
plugins: [['autoprefixer']]
|
|
210
219
|
}
|
|
211
220
|
}
|
|
212
221
|
},
|
|
213
|
-
'less-loader'
|
|
222
|
+
(0, tools_1.getLoaderPath)('less-loader')
|
|
214
223
|
]
|
|
215
224
|
},
|
|
216
225
|
{
|
|
217
226
|
test: /\.module\.scss$/,
|
|
218
227
|
use: [
|
|
219
|
-
env === 'dev'
|
|
228
|
+
env === 'dev'
|
|
229
|
+
? (0, tools_1.getLoaderPath)('style-loader')
|
|
230
|
+
: mini_css_extract_plugin_1.default.loader,
|
|
220
231
|
{
|
|
221
|
-
loader: 'css-loader',
|
|
232
|
+
loader: (0, tools_1.getLoaderPath)('css-loader'),
|
|
222
233
|
options: {
|
|
223
234
|
modules: {
|
|
224
235
|
localIdentName: 'moduleStyle_[local]_[contenthash:8]'
|
|
@@ -226,30 +237,32 @@ function default_1(_a) {
|
|
|
226
237
|
}
|
|
227
238
|
},
|
|
228
239
|
{
|
|
229
|
-
loader: 'postcss-loader',
|
|
240
|
+
loader: (0, tools_1.getLoaderPath)('postcss-loader'),
|
|
230
241
|
options: {
|
|
231
242
|
postcssOptions: {
|
|
232
243
|
plugins: [['postcss-preset-env', 'autoprefixer']]
|
|
233
244
|
}
|
|
234
245
|
}
|
|
235
246
|
},
|
|
236
|
-
'sass-loader'
|
|
247
|
+
(0, tools_1.getLoaderPath)('sass-loader')
|
|
237
248
|
]
|
|
238
249
|
},
|
|
239
250
|
{
|
|
240
251
|
test: /\.scss$/,
|
|
241
252
|
use: [
|
|
242
|
-
env === 'dev'
|
|
243
|
-
|
|
253
|
+
env === 'dev'
|
|
254
|
+
? (0, tools_1.getLoaderPath)('style-loader')
|
|
255
|
+
: mini_css_extract_plugin_1.default.loader,
|
|
256
|
+
(0, tools_1.getLoaderPath)('css-loader'),
|
|
244
257
|
{
|
|
245
|
-
loader: 'postcss-loader',
|
|
258
|
+
loader: (0, tools_1.getLoaderPath)('postcss-loader'),
|
|
246
259
|
options: {
|
|
247
260
|
postcssOptions: {
|
|
248
261
|
plugins: [['autoprefixer']]
|
|
249
262
|
}
|
|
250
263
|
}
|
|
251
264
|
},
|
|
252
|
-
'sass-loader'
|
|
265
|
+
(0, tools_1.getLoaderPath)('sass-loader')
|
|
253
266
|
]
|
|
254
267
|
},
|
|
255
268
|
{
|
|
@@ -272,7 +285,7 @@ function default_1(_a) {
|
|
|
272
285
|
},
|
|
273
286
|
{
|
|
274
287
|
test: /\.html$/,
|
|
275
|
-
loader: 'html-loader'
|
|
288
|
+
loader: (0, tools_1.getLoaderPath)('html-loader')
|
|
276
289
|
}
|
|
277
290
|
]
|
|
278
291
|
}
|
|
@@ -280,7 +293,7 @@ function default_1(_a) {
|
|
|
280
293
|
},
|
|
281
294
|
resolve: {
|
|
282
295
|
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
|
|
283
|
-
alias: __assign({ '@': path_1.default.join(projectPath, '/src') }, getCustomAliasConfig())
|
|
296
|
+
alias: __assign({ '@': path_1.default.join(projectPath, '/src'), react: path_1.default.dirname(require.resolve('react')), 'react-dom': path_1.default.dirname(require.resolve('react-dom')), qs: path_1.default.dirname(require.resolve('qs')) }, getCustomAliasConfig())
|
|
284
297
|
},
|
|
285
298
|
externals: customConfig.base.externals,
|
|
286
299
|
plugins: __spreadArray(__spreadArray(__spreadArray([], basicPlugins, true), [
|
|
@@ -65,6 +65,7 @@ var config_1 = require("../utils/config");
|
|
|
65
65
|
var html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
66
66
|
var webpack_1 = __importDefault(require("webpack"));
|
|
67
67
|
var vue_loader_1 = require("vue-loader");
|
|
68
|
+
var tools_1 = require("../utils/tools");
|
|
68
69
|
function default_1(_a) {
|
|
69
70
|
var _b, _c, _d;
|
|
70
71
|
var projectPath = _a.projectPath, entryPath = _a.entryPath, env = _a.env, customConfig = _a.customConfig;
|
|
@@ -119,7 +120,7 @@ function default_1(_a) {
|
|
|
119
120
|
exclude: /node_modules/,
|
|
120
121
|
use: [
|
|
121
122
|
{
|
|
122
|
-
loader: 'swc-loader',
|
|
123
|
+
loader: (0, tools_1.getLoaderPath)('swc-loader'),
|
|
123
124
|
options: {
|
|
124
125
|
jsc: {
|
|
125
126
|
parser: {
|
|
@@ -142,9 +143,9 @@ function default_1(_a) {
|
|
|
142
143
|
{
|
|
143
144
|
resourceQuery: /module/,
|
|
144
145
|
use: [
|
|
145
|
-
'vue-style-loader',
|
|
146
|
+
(0, tools_1.getLoaderPath)('vue-style-loader'),
|
|
146
147
|
{
|
|
147
|
-
loader: 'css-loader',
|
|
148
|
+
loader: (0, tools_1.getLoaderPath)('css-loader'),
|
|
148
149
|
options: {
|
|
149
150
|
modules: {
|
|
150
151
|
localIdentName: 'moduleStyle_[local]_[contenthash:8]'
|
|
@@ -152,7 +153,7 @@ function default_1(_a) {
|
|
|
152
153
|
}
|
|
153
154
|
},
|
|
154
155
|
{
|
|
155
|
-
loader: 'postcss-loader',
|
|
156
|
+
loader: (0, tools_1.getLoaderPath)('postcss-loader'),
|
|
156
157
|
options: {
|
|
157
158
|
postcssOptions: {
|
|
158
159
|
plugins: [['autoprefixer']]
|
|
@@ -164,11 +165,11 @@ function default_1(_a) {
|
|
|
164
165
|
{
|
|
165
166
|
use: [
|
|
166
167
|
env === 'dev'
|
|
167
|
-
? 'vue-style-loader'
|
|
168
|
+
? (0, tools_1.getLoaderPath)('vue-style-loader')
|
|
168
169
|
: mini_css_extract_plugin_1.default.loader,
|
|
169
|
-
'css-loader',
|
|
170
|
+
(0, tools_1.getLoaderPath)('css-loader'),
|
|
170
171
|
{
|
|
171
|
-
loader: 'postcss-loader',
|
|
172
|
+
loader: (0, tools_1.getLoaderPath)('postcss-loader'),
|
|
172
173
|
options: {
|
|
173
174
|
postcssOptions: {
|
|
174
175
|
plugins: [['autoprefixer']]
|
|
@@ -185,7 +186,7 @@ function default_1(_a) {
|
|
|
185
186
|
{
|
|
186
187
|
resourceQuery: /module/,
|
|
187
188
|
use: [
|
|
188
|
-
'vue-style-loader',
|
|
189
|
+
(0, tools_1.getLoaderPath)('vue-style-loader'),
|
|
189
190
|
{
|
|
190
191
|
loader: 'css-loader',
|
|
191
192
|
options: {
|
|
@@ -195,31 +196,31 @@ function default_1(_a) {
|
|
|
195
196
|
}
|
|
196
197
|
},
|
|
197
198
|
{
|
|
198
|
-
loader: 'postcss-loader',
|
|
199
|
+
loader: (0, tools_1.getLoaderPath)('postcss-loader'),
|
|
199
200
|
options: {
|
|
200
201
|
postcssOptions: {
|
|
201
202
|
plugins: [['autoprefixer']]
|
|
202
203
|
}
|
|
203
204
|
}
|
|
204
205
|
},
|
|
205
|
-
'less-loader'
|
|
206
|
+
(0, tools_1.getLoaderPath)('less-loader')
|
|
206
207
|
]
|
|
207
208
|
},
|
|
208
209
|
{
|
|
209
210
|
use: [
|
|
210
211
|
env === 'dev'
|
|
211
|
-
? 'vue-style-loader'
|
|
212
|
+
? (0, tools_1.getLoaderPath)('vue-style-loader')
|
|
212
213
|
: mini_css_extract_plugin_1.default.loader,
|
|
213
|
-
'css-loader',
|
|
214
|
+
(0, tools_1.getLoaderPath)('css-loader'),
|
|
214
215
|
{
|
|
215
|
-
loader: 'postcss-loader',
|
|
216
|
+
loader: (0, tools_1.getLoaderPath)('postcss-loader'),
|
|
216
217
|
options: {
|
|
217
218
|
postcssOptions: {
|
|
218
219
|
plugins: [['autoprefixer']]
|
|
219
220
|
}
|
|
220
221
|
}
|
|
221
222
|
},
|
|
222
|
-
'less-loader'
|
|
223
|
+
(0, tools_1.getLoaderPath)('less-loader')
|
|
223
224
|
]
|
|
224
225
|
}
|
|
225
226
|
]
|
|
@@ -230,9 +231,9 @@ function default_1(_a) {
|
|
|
230
231
|
{
|
|
231
232
|
resourceQuery: /module/,
|
|
232
233
|
use: [
|
|
233
|
-
'vue-style-loader',
|
|
234
|
+
(0, tools_1.getLoaderPath)('vue-style-loader'),
|
|
234
235
|
{
|
|
235
|
-
loader: 'css-loader',
|
|
236
|
+
loader: (0, tools_1.getLoaderPath)('css-loader'),
|
|
236
237
|
options: {
|
|
237
238
|
modules: {
|
|
238
239
|
localIdentName: 'moduleStyle_[local]_[contenthash:8]'
|
|
@@ -240,31 +241,31 @@ function default_1(_a) {
|
|
|
240
241
|
}
|
|
241
242
|
},
|
|
242
243
|
{
|
|
243
|
-
loader: 'postcss-loader',
|
|
244
|
+
loader: (0, tools_1.getLoaderPath)('postcss-loader'),
|
|
244
245
|
options: {
|
|
245
246
|
postcssOptions: {
|
|
246
247
|
plugins: [['autoprefixer']]
|
|
247
248
|
}
|
|
248
249
|
}
|
|
249
250
|
},
|
|
250
|
-
'sass-loader'
|
|
251
|
+
(0, tools_1.getLoaderPath)('sass-loader')
|
|
251
252
|
]
|
|
252
253
|
},
|
|
253
254
|
{
|
|
254
255
|
use: [
|
|
255
256
|
env === 'dev'
|
|
256
|
-
? 'vue-style-loader'
|
|
257
|
+
? (0, tools_1.getLoaderPath)('vue-style-loader')
|
|
257
258
|
: mini_css_extract_plugin_1.default.loader,
|
|
258
|
-
'css-loader',
|
|
259
|
+
(0, tools_1.getLoaderPath)('css-loader'),
|
|
259
260
|
{
|
|
260
|
-
loader: 'postcss-loader',
|
|
261
|
+
loader: (0, tools_1.getLoaderPath)('postcss-loader'),
|
|
261
262
|
options: {
|
|
262
263
|
postcssOptions: {
|
|
263
264
|
plugins: [['autoprefixer']]
|
|
264
265
|
}
|
|
265
266
|
}
|
|
266
267
|
},
|
|
267
|
-
'sass-loader'
|
|
268
|
+
(0, tools_1.getLoaderPath)('sass-loader')
|
|
268
269
|
]
|
|
269
270
|
}
|
|
270
271
|
]
|
|
@@ -289,7 +290,7 @@ function default_1(_a) {
|
|
|
289
290
|
},
|
|
290
291
|
{
|
|
291
292
|
test: /\.html$/,
|
|
292
|
-
loader: 'html-loader'
|
|
293
|
+
loader: (0, tools_1.getLoaderPath)('html-loader')
|
|
293
294
|
}
|
|
294
295
|
]
|
|
295
296
|
}
|
|
@@ -297,7 +298,7 @@ function default_1(_a) {
|
|
|
297
298
|
},
|
|
298
299
|
resolve: {
|
|
299
300
|
extensions: ['.ts', '.js', '.vue', '.json'],
|
|
300
|
-
alias: __assign({ '@': path_1.default.join(projectPath, '/src'), vue: 'vue/dist/vue.esm-bundler.js' }, getCustomAliasConfig())
|
|
301
|
+
alias: __assign({ '@': path_1.default.join(projectPath, '/src'), vue: 'vue/dist/vue.esm-bundler.js', qs: path_1.default.dirname(require.resolve('qs')) }, getCustomAliasConfig())
|
|
301
302
|
},
|
|
302
303
|
externals: customConfig.base.externals,
|
|
303
304
|
plugins: __spreadArray(__spreadArray(__spreadArray([], basicPlugins, true), [
|
package/src/utils/tools.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ConfigRouterType } from './config';
|
|
|
2
2
|
export declare const copyDirFiles: (src: any, dest: any, filter?: (fileName: any) => boolean) => Promise<void>;
|
|
3
3
|
export declare const getFormatRouter: (projectPath: string, routes: ConfigRouterType['routes'], templateType: any) => any[];
|
|
4
4
|
export declare const getPort: () => Promise<number>;
|
|
5
|
+
export declare const getLoaderPath: (loader: any) => string;
|
|
5
6
|
export declare const colorConfig: {
|
|
6
7
|
theme: string;
|
|
7
8
|
warning: string;
|
package/src/utils/tools.js
CHANGED
|
@@ -80,7 +80,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
80
80
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
81
81
|
};
|
|
82
82
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
83
|
-
exports.initIndexFile = exports.toast = exports.colorConfig = exports.getPort = exports.getFormatRouter = exports.copyDirFiles = void 0;
|
|
83
|
+
exports.initIndexFile = exports.toast = exports.colorConfig = exports.getLoaderPath = exports.getPort = exports.getFormatRouter = exports.copyDirFiles = void 0;
|
|
84
84
|
var portfinder_1 = __importDefault(require("portfinder"));
|
|
85
85
|
var fs_extra_1 = __importDefault(require("fs-extra"));
|
|
86
86
|
var path_1 = __importDefault(require("path"));
|
|
@@ -198,6 +198,8 @@ var getPort = function () {
|
|
|
198
198
|
});
|
|
199
199
|
};
|
|
200
200
|
exports.getPort = getPort;
|
|
201
|
+
var getLoaderPath = function (loader) { return require.resolve(loader); };
|
|
202
|
+
exports.getLoaderPath = getLoaderPath;
|
|
201
203
|
exports.colorConfig = {
|
|
202
204
|
theme: '#7888FCFF',
|
|
203
205
|
warning: '#fb8918',
|