@umijs/preset-vue 4.0.0-rc.14 → 4.0.0-rc.15

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.
@@ -1,49 +1,38 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.addAssetRules = void 0;
13
- function addAssetRules({ config, api }) {
14
- return __awaiter(this, void 0, void 0, function* () {
15
- // bundler-webpack 本身自带的静态资源会触发 vue-loader currently does not support vue rules with oneOf. 需要禁用掉
16
- config.module.rules.delete('asset');
17
- const { userConfig } = api;
18
- const inlineLimit = parseInt(userConfig.inlineLimit || '10000', 10);
19
- const staticPathPrefix = api.config.staticPathPrefix !== undefined
20
- ? api.config.staticPathPrefix
21
- : 'static/';
22
- config.module
23
- .rule('avif')
24
- .test(/\.avif$/)
25
- .type('asset')
26
- .mimetype('image/avif')
27
- .parser({
28
- dataUrlCondition: {
29
- maxSize: inlineLimit,
30
- },
31
- })
32
- .generator({
33
- filename: `${staticPathPrefix}[name].[hash:8].[ext]`,
34
- });
35
- config.module
36
- .rule('image')
37
- .test(/\.(bmp|gif|jpg|jpeg|png)$/)
38
- .type('asset')
39
- .parser({
40
- dataUrlCondition: {
41
- maxSize: inlineLimit,
42
- },
43
- })
44
- .generator({
45
- filename: `${staticPathPrefix}[name].[hash:8].[ext]`,
46
- });
4
+ async function addAssetRules({ config, api }) {
5
+ // bundler-webpack 本身自带的静态资源会触发 vue-loader currently does not support vue rules with oneOf. 需要禁用掉
6
+ config.module.rules.delete('asset');
7
+ const { userConfig } = api;
8
+ const inlineLimit = parseInt(userConfig.inlineLimit || '10000', 10);
9
+ const staticPathPrefix = api.config.staticPathPrefix !== undefined
10
+ ? api.config.staticPathPrefix
11
+ : 'static/';
12
+ config.module
13
+ .rule('avif')
14
+ .test(/\.avif$/)
15
+ .type('asset')
16
+ .mimetype('image/avif')
17
+ .parser({
18
+ dataUrlCondition: {
19
+ maxSize: inlineLimit,
20
+ },
21
+ })
22
+ .generator({
23
+ filename: `${staticPathPrefix}[name].[hash:8].[ext]`,
24
+ });
25
+ config.module
26
+ .rule('image')
27
+ .test(/\.(bmp|gif|jpg|jpeg|png)$/)
28
+ .type('asset')
29
+ .parser({
30
+ dataUrlCondition: {
31
+ maxSize: inlineLimit,
32
+ },
33
+ })
34
+ .generator({
35
+ filename: `${staticPathPrefix}[name].[hash:8].[ext]`,
47
36
  });
48
37
  }
49
38
  exports.addAssetRules = addAssetRules;
@@ -18,13 +18,21 @@ exports.default = (api) => {
18
18
  }) || require.resolve('vue/dist/vue.runtime.esm-bundler.js');
19
19
  api.modifyDefaultConfig((config) => {
20
20
  var _a;
21
- config.alias = Object.assign(Object.assign({}, config.alias), { vue$: ((_a = api.userConfig.vue) === null || _a === void 0 ? void 0 : _a.runtimeCompiler) ? vuePath : vueRuntimePath, 'vue-router': (0, resolveProjectDep_1.resolveProjectDep)({
21
+ config.alias = {
22
+ ...config.alias,
23
+ vue$: ((_a = api.userConfig.vue) === null || _a === void 0 ? void 0 : _a.runtimeCompiler) ? vuePath : vueRuntimePath,
24
+ 'vue-router': (0, resolveProjectDep_1.resolveProjectDep)({
22
25
  pkg: api.pkg,
23
26
  cwd: api.cwd,
24
27
  dep: 'vue-router',
25
- }) || (0, path_1.dirname)(require.resolve('vue-router/package.json')) });
28
+ }) || (0, path_1.dirname)(require.resolve('vue-router/package.json')),
29
+ };
26
30
  // feature flags https://link.vuejs.org/feature-flags.
27
- config.define = Object.assign(Object.assign({}, config.define), { __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false });
31
+ config.define = {
32
+ ...config.define,
33
+ __VUE_OPTIONS_API__: true,
34
+ __VUE_PROD_DEVTOOLS__: false,
35
+ };
28
36
  return config;
29
37
  });
30
38
  api.modifyConfig((memo) => {
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  const path_1 = require("path");
13
4
  const plugin_utils_1 = require("umi/plugin-utils");
@@ -16,9 +7,9 @@ exports.default = (api) => {
16
7
  api.describe({
17
8
  key: 'preset-vue:tmpFiles',
18
9
  });
19
- api.onGenerateFiles(() => __awaiter(void 0, void 0, void 0, function* () {
10
+ api.onGenerateFiles(async () => {
20
11
  // useAppData.ts
21
- const rendererPath = (0, plugin_utils_1.winPath)(yield api.applyPlugins({
12
+ const rendererPath = (0, plugin_utils_1.winPath)(await api.applyPlugins({
22
13
  key: 'modifyRendererPath',
23
14
  }));
24
15
  api.writeTmpFile({
@@ -29,12 +20,12 @@ exports.default = (api) => {
29
20
  rendererPath,
30
21
  },
31
22
  });
32
- }));
23
+ });
33
24
  api.register({
34
25
  key: 'onGenerateFiles',
35
- fn: () => __awaiter(void 0, void 0, void 0, function* () {
26
+ fn: async () => {
36
27
  // history.ts
37
- const rendererPath = (0, plugin_utils_1.winPath)(yield api.applyPlugins({
28
+ const rendererPath = (0, plugin_utils_1.winPath)(await api.applyPlugins({
38
29
  key: 'modifyRendererPath',
39
30
  }));
40
31
  api.writeTmpFile({
@@ -69,7 +60,7 @@ export default defineComponent({
69
60
  </template>
70
61
  `,
71
62
  });
72
- }),
63
+ },
73
64
  stage: Infinity,
74
65
  });
75
66
  };
@@ -13,10 +13,13 @@ exports.default = (api) => {
13
13
  // 处理 mfsu 包含vue 模块的依赖处理
14
14
  const enableMFSU = memo.mfsu !== false;
15
15
  if (enableMFSU) {
16
- memo.mfsu = Object.assign(Object.assign({}, (memo.mfsu || {})), { chainWebpack(config) {
16
+ memo.mfsu = {
17
+ ...(memo.mfsu || {}),
18
+ chainWebpack(config) {
17
19
  (0, config_1.getConfig)(config, api);
18
20
  return config;
19
- } });
21
+ },
22
+ };
20
23
  }
21
24
  return memo;
22
25
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/preset-vue",
3
- "version": "4.0.0-rc.14",
3
+ "version": "4.0.0-rc.15",
4
4
  "description": "@umijs/preset-vue",
5
5
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/preset-vue#readme",
6
6
  "bugs": "https://github.com/umijs/umi-next/issues",
@@ -22,13 +22,13 @@
22
22
  "dev": "pnpm build -- --watch"
23
23
  },
24
24
  "dependencies": {
25
- "@umijs/renderer-vue": "4.0.0-rc.14",
25
+ "@umijs/renderer-vue": "4.0.0-rc.15",
26
26
  "vue": "3.2.31",
27
27
  "vue-loader": "17.0.0",
28
28
  "vue-router": "4.0.12"
29
29
  },
30
30
  "devDependencies": {
31
- "umi": "4.0.0-rc.14"
31
+ "umi": "4.0.0-rc.15"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"