swico 2.0.0-beta.4 → 2.0.0-beta.6

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": "2.0.0-beta.4",
3
+ "version": "2.0.0-beta.6",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -41,9 +41,6 @@
41
41
  "commander": "12.0.0",
42
42
  "cross-spawn": "7.0.5",
43
43
  "css-loader": "6.3.0",
44
- "eslint-plugin-react": "7.33.2",
45
- "eslint-plugin-react-hooks": "4.3.0",
46
- "eslint-plugin-vue": "9.19.2",
47
44
  "eslint-webpack-plugin": "4.0.0",
48
45
  "fs-extra": "11.3.0",
49
46
  "html-loader": "5.0.0",
@@ -116,6 +116,7 @@ const createCompileListener = (compiler) => {
116
116
  return;
117
117
  }
118
118
  if (stats === null || stats === void 0 ? void 0 : stats.hasWarnings()) {
119
+ console.log('warning', info);
119
120
  const warnings = info.warnings;
120
121
  warnings.some((item) => {
121
122
  const msg = item.message || item.stack;
@@ -4,6 +4,7 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
4
4
  output: {
5
5
  path: string;
6
6
  filename: string;
7
+ cssFilename: string;
7
8
  assetModuleFilename: string;
8
9
  publicPath: string;
9
10
  clean: boolean;
@@ -45,7 +45,8 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
45
45
  entry: entryPath,
46
46
  output: {
47
47
  path: path_1.default.join(projectPath, '/dist'),
48
- filename: 'js/[name].[chunkhash].js',
48
+ filename: 'js/[name].[id].js',
49
+ cssFilename: 'css/[name].[contenthash].css',
49
50
  assetModuleFilename: 'assets/[name]_[chunkhash][ext]',
50
51
  publicPath,
51
52
  clean: true
@@ -94,7 +95,6 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
94
95
  test: /\.css$/,
95
96
  type: 'css/auto',
96
97
  use: [
97
- core_1.rspack.CssExtractRspackPlugin.loader,
98
98
  cssLoader,
99
99
  {
100
100
  loader: postcssLoader,
@@ -110,8 +110,6 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
110
110
  test: /\.less$/,
111
111
  type: 'css/auto',
112
112
  use: [
113
- core_1.rspack.CssExtractRspackPlugin.loader,
114
- cssLoader,
115
113
  {
116
114
  loader: postcssLoader,
117
115
  options: {
@@ -127,8 +125,6 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
127
125
  test: /\.scss$/,
128
126
  type: 'css/auto',
129
127
  use: [
130
- core_1.rspack.CssExtractRspackPlugin.loader,
131
- cssLoader,
132
128
  {
133
129
  loader: postcssLoader,
134
130
  options: {
@@ -183,10 +179,6 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
183
179
  },
184
180
  hash: true
185
181
  }),
186
- new core_1.rspack.CssExtractRspackPlugin({
187
- filename: env === 'dev' ? 'css/[name].css' : 'css/[name].[contenthash].css',
188
- ignoreOrder: true
189
- }),
190
182
  ...((customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) || config_1.initConfig.plugins)
191
183
  ]
192
184
  };
@@ -4,10 +4,14 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
4
4
  output: {
5
5
  path: string;
6
6
  filename: string;
7
+ cssFilename: string;
7
8
  assetModuleFilename: string;
8
9
  publicPath: string;
9
10
  clean: boolean;
10
11
  };
12
+ experiments: {
13
+ css: boolean;
14
+ };
11
15
  target: string[];
12
16
  module: {
13
17
  parser: {
@@ -47,57 +51,24 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
47
51
  } | {
48
52
  oneOf: ({
49
53
  test: RegExp;
50
- oneOf: ({
51
- resourceQuery: RegExp;
52
- use: (string | {
53
- loader: string;
54
- options: {
55
- modules: {
56
- localIdentName: string;
57
- };
58
- postcssOptions?: undefined;
59
- };
60
- } | {
61
- loader: string;
62
- options: {
63
- postcssOptions: {
64
- plugins: string[][];
65
- };
66
- modules?: undefined;
67
- };
68
- })[];
69
- } | {
70
- use: (string | {
71
- loader: string;
72
- options: {
73
- postcssOptions: {
74
- plugins: string[][];
75
- };
76
- };
77
- })[];
78
- resourceQuery?: undefined;
79
- })[];
80
- type?: undefined;
54
+ type: string;
55
+ loader: string;
81
56
  generator?: undefined;
82
- loader?: undefined;
83
57
  } | {
84
58
  test: RegExp;
85
59
  type: string;
86
60
  generator: {
87
61
  filename: string;
88
62
  };
89
- oneOf?: undefined;
90
63
  loader?: undefined;
91
64
  } | {
92
65
  test: RegExp;
93
66
  type: string;
94
- oneOf?: undefined;
95
- generator?: undefined;
96
67
  loader?: undefined;
68
+ generator?: undefined;
97
69
  } | {
98
70
  test: RegExp;
99
71
  loader: string;
100
- oneOf?: undefined;
101
72
  type?: undefined;
102
73
  generator?: undefined;
103
74
  })[];
@@ -47,11 +47,15 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
47
47
  entry: entryPath,
48
48
  output: {
49
49
  path: path_1.default.join(projectPath, '/dist'),
50
- filename: 'js/[name].[chunkhash].js',
51
- assetModuleFilename: 'assets/[name]_[chunkhash][ext]',
50
+ filename: 'js/[name].[id].js',
51
+ cssFilename: 'css/[name].[contenthash].css',
52
+ assetModuleFilename: 'assets/[name]_[id][ext]',
52
53
  publicPath,
53
54
  clean: true
54
55
  },
56
+ experiments: {
57
+ css: true
58
+ },
55
59
  target: ['web', 'es5'],
56
60
  module: {
57
61
  parser: {
@@ -90,138 +94,15 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
90
94
  },
91
95
  {
92
96
  oneOf: [
93
- {
94
- test: /\.css$/,
95
- oneOf: [
96
- {
97
- resourceQuery: /module/,
98
- use: [
99
- vueStyleLoader,
100
- {
101
- loader: cssLoader,
102
- options: {
103
- modules: {
104
- localIdentName: 'moduleStyle_[local]_[contenthash:8]'
105
- }
106
- }
107
- },
108
- {
109
- loader: postcssLoader,
110
- options: {
111
- postcssOptions: {
112
- plugins: [['autoprefixer']]
113
- }
114
- }
115
- }
116
- ]
117
- },
118
- {
119
- use: [
120
- env === 'dev'
121
- ? vueStyleLoader
122
- : core_1.CssExtractRspackPlugin.loader,
123
- cssLoader,
124
- {
125
- loader: postcssLoader,
126
- options: {
127
- postcssOptions: {
128
- plugins: [['autoprefixer']]
129
- }
130
- }
131
- }
132
- ]
133
- }
134
- ]
135
- },
136
97
  {
137
98
  test: /\.less$/,
138
- oneOf: [
139
- {
140
- resourceQuery: /module/,
141
- use: [
142
- vueStyleLoader,
143
- {
144
- loader: cssLoader,
145
- options: {
146
- modules: {
147
- localIdentName: 'moduleStyle_[local]_[contenthash:8]'
148
- }
149
- }
150
- },
151
- {
152
- loader: postcssLoader,
153
- options: {
154
- postcssOptions: {
155
- plugins: [['autoprefixer']]
156
- }
157
- }
158
- },
159
- lessLoader
160
- ]
161
- },
162
- {
163
- use: [
164
- env === 'dev'
165
- ? vueStyleLoader
166
- : core_1.CssExtractRspackPlugin.loader,
167
- cssLoader,
168
- {
169
- loader: postcssLoader,
170
- options: {
171
- postcssOptions: {
172
- plugins: [['autoprefixer']]
173
- }
174
- }
175
- },
176
- lessLoader
177
- ]
178
- }
179
- ]
99
+ type: 'css',
100
+ loader: lessLoader
180
101
  },
181
102
  {
182
103
  test: /\.scss$/,
183
- oneOf: [
184
- {
185
- resourceQuery: /module/,
186
- use: [
187
- vueStyleLoader,
188
- {
189
- loader: cssLoader,
190
- options: {
191
- modules: {
192
- localIdentName: 'moduleStyle_[local]_[contenthash:8]'
193
- }
194
- }
195
- },
196
- {
197
- loader: postcssLoader,
198
- options: {
199
- postcssOptions: {
200
- plugins: [['autoprefixer']]
201
- }
202
- }
203
- },
204
- sassLoader
205
- ]
206
- },
207
- {
208
- use: [
209
- env === 'dev'
210
- ? vueStyleLoader
211
- : core_1.CssExtractRspackPlugin.loader,
212
- cssLoader,
213
- {
214
- loader: postcssLoader,
215
- options: {
216
- postcssOptions: {
217
- plugins: [['autoprefixer']]
218
- }
219
- }
220
- },
221
- sassLoader
222
- ]
223
- }
224
- ]
104
+ type: 'css',
105
+ loader: sassLoader
225
106
  },
226
107
  {
227
108
  test: /\.(jpg|png|gif|webp|bmp|jpeg|svg)$/,
@@ -272,10 +153,6 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
272
153
  },
273
154
  hash: true
274
155
  }),
275
- new core_1.CssExtractRspackPlugin({
276
- filename: env === 'dev' ? 'css/[name].css' : 'css/[name].[contenthash].css',
277
- ignoreOrder: true
278
- }),
279
156
  ...((customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) || config_1.initConfig.plugins)
280
157
  ]
281
158
  };
@@ -46,15 +46,14 @@ const core_1 = require("@rspack/core");
46
46
  const BundleAnalyzerPlugin = webpack_bundle_analyzer_1.default.BundleAnalyzerPlugin;
47
47
  const isAnalyze = process.env.ANALYZE === 'true';
48
48
  function default_1(options) {
49
- var _a, _b, _c, _d, _e, _f, _g;
49
+ var _a, _b, _c, _d, _e;
50
50
  return __awaiter(this, void 0, void 0, function* () {
51
51
  const { projectPath, customConfig, templateType } = options;
52
- const getBaseConfig = (yield Promise.resolve(`${templateType === 'vue' ? './webpack.base.vue' : './webpack.base.react'}`).then(s => __importStar(require(s)))).default;
52
+ const getBaseConfig = (yield Promise.resolve(`${templateType === 'vue' ? './rspack.base.vue' : './rspack.base.react'}`).then(s => __importStar(require(s)))).default;
53
53
  const baseConfig = yield getBaseConfig(Object.assign(Object.assign({}, options), { env: 'prod' }));
54
- const consoleAvailable = (_b = (_a = customConfig.prod) === null || _a === void 0 ? void 0 : _a.console) !== null && _b !== void 0 ? _b : config_1.initConfig.console;
55
54
  const isPublicDirExist = yield fs_extra_1.default.exists(path_1.default.join(projectPath, '/public'));
56
- const copyConfig = (_d = (_c = customConfig.prod) === null || _c === void 0 ? void 0 : _c.copy) !== null && _d !== void 0 ? _d : config_1.initConfig.copy;
57
- const customDevtool = (_e = customConfig.prod.devtool) !== null && _e !== void 0 ? _e : customConfig.base.devtool;
55
+ const copyConfig = (_b = (_a = customConfig.prod) === null || _a === void 0 ? void 0 : _a.copy) !== null && _b !== void 0 ? _b : config_1.initConfig.copy;
56
+ const customDevtool = (_c = customConfig.prod.devtool) !== null && _c !== void 0 ? _c : customConfig.base.devtool;
58
57
  return (0, webpack_merge_1.merge)(baseConfig, {
59
58
  performance: {
60
59
  hints: false
@@ -115,7 +114,7 @@ function default_1(options) {
115
114
  color: tools_1.colorConfig.theme,
116
115
  profile: false
117
116
  }),
118
- ...((_g = (_f = customConfig.prod) === null || _f === void 0 ? void 0 : _f.plugins) !== null && _g !== void 0 ? _g : [])
117
+ ...((_e = (_d = customConfig.prod) === null || _d === void 0 ? void 0 : _d.plugins) !== null && _e !== void 0 ? _e : [])
119
118
  ]
120
119
  });
121
120
  });