Socket
Socket
Sign inDemoInstall

@umijs/preset-vue

Package Overview
Dependencies
Maintainers
10
Versions
377
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@umijs/preset-vue - npm Package Compare versions

Comparing version 4.0.0-canary.20220429.4 to 4.0.0-canary.20220506.1

75

dist/features/config/assetRules.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.addAssetRules = void 0;
function addAssetRules({ config, api }) {
return __awaiter(this, void 0, void 0, function* () {
// bundler-webpack 本身自带的静态资源会触发 vue-loader currently does not support vue rules with oneOf. 需要禁用掉
config.module.rules.delete('asset');
const { userConfig } = api;
const inlineLimit = parseInt(userConfig.inlineLimit || '10000', 10);
const staticPathPrefix = api.config.staticPathPrefix !== undefined
? api.config.staticPathPrefix
: 'static/';
config.module
.rule('avif')
.test(/\.avif$/)
.type('asset')
.mimetype('image/avif')
.parser({
dataUrlCondition: {
maxSize: inlineLimit,
},
})
.generator({
filename: `${staticPathPrefix}[name].[hash:8].[ext]`,
});
config.module
.rule('image')
.test(/\.(bmp|gif|jpg|jpeg|png)$/)
.type('asset')
.parser({
dataUrlCondition: {
maxSize: inlineLimit,
},
})
.generator({
filename: `${staticPathPrefix}[name].[hash:8].[ext]`,
});
async function addAssetRules({ config, api }) {
// bundler-webpack 本身自带的静态资源会触发 vue-loader currently does not support vue rules with oneOf. 需要禁用掉
config.module.rules.delete('asset');
const { userConfig } = api;
const inlineLimit = parseInt(userConfig.inlineLimit || '10000', 10);
const staticPathPrefix = api.config.staticPathPrefix !== undefined
? api.config.staticPathPrefix
: 'static/';
config.module
.rule('avif')
.test(/\.avif$/)
.type('asset')
.mimetype('image/avif')
.parser({
dataUrlCondition: {
maxSize: inlineLimit,
},
})
.generator({
filename: `${staticPathPrefix}[name].[hash:8].[ext]`,
});
config.module
.rule('image')
.test(/\.(bmp|gif|jpg|jpeg|png)$/)
.type('asset')
.parser({
dataUrlCondition: {
maxSize: inlineLimit,
},
})
.generator({
filename: `${staticPathPrefix}[name].[hash:8].[ext]`,
});
}
exports.addAssetRules = addAssetRules;

@@ -21,9 +21,17 @@ "use strict";

var _a;
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)({
config.alias = {
...config.alias,
vue$: ((_a = api.userConfig.vue) === null || _a === void 0 ? void 0 : _a.runtimeCompiler) ? vuePath : vueRuntimePath,
'vue-router': (0, resolveProjectDep_1.resolveProjectDep)({
pkg: api.pkg,
cwd: api.cwd,
dep: 'vue-router',
}) || (0, path_1.dirname)(require.resolve('vue-router/package.json')) });
}) || (0, path_1.dirname)(require.resolve('vue-router/package.json')),
};
// feature flags https://link.vuejs.org/feature-flags.
config.define = Object.assign(Object.assign({}, config.define), { __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false });
config.define = {
...config.define,
__VUE_OPTIONS_API__: true,
__VUE_PROD_DEVTOOLS__: false,
};
return config;

@@ -30,0 +38,0 @@ });

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -19,5 +10,5 @@ const path_1 = require("path");

});
api.onGenerateFiles(() => __awaiter(void 0, void 0, void 0, function* () {
api.onGenerateFiles(async () => {
// useAppData.ts
const rendererPath = (0, plugin_utils_1.winPath)(yield api.applyPlugins({
const rendererPath = (0, plugin_utils_1.winPath)(await api.applyPlugins({
key: 'modifyRendererPath',

@@ -33,8 +24,8 @@ }));

});
}));
});
api.register({
key: 'onGenerateFiles',
fn: () => __awaiter(void 0, void 0, void 0, function* () {
fn: async () => {
// history.ts
const rendererPath = (0, plugin_utils_1.winPath)(yield api.applyPlugins({
const rendererPath = (0, plugin_utils_1.winPath)(await api.applyPlugins({
key: 'modifyRendererPath',

@@ -74,5 +65,5 @@ }));

});
}),
},
stage: Infinity,
});
};

@@ -16,6 +16,9 @@ "use strict";

if (enableMFSU) {
memo.mfsu = Object.assign(Object.assign({}, (memo.mfsu || {})), { chainWebpack(config) {
memo.mfsu = {
...(memo.mfsu || {}),
chainWebpack(config) {
(0, config_1.getConfig)(config, api);
return config;
} });
},
};
}

@@ -22,0 +25,0 @@ return memo;

{
"name": "@umijs/preset-vue",
"version": "4.0.0-canary.20220429.4",
"version": "4.0.0-canary.20220506.1",
"description": "@umijs/preset-vue",

@@ -25,3 +25,3 @@ "homepage": "https://github.com/umijs/umi-next/tree/master/packages/preset-vue#readme",

"dependencies": {
"@umijs/renderer-vue": "4.0.0-canary.20220429.4",
"@umijs/renderer-vue": "4.0.0-canary.20220506.1",
"vue": "3.2.31",

@@ -32,3 +32,3 @@ "vue-loader": "17.0.0",

"devDependencies": {
"umi": "4.0.0-canary.20220429.4"
"umi": "4.0.0-canary.20220506.1"
},

@@ -35,0 +35,0 @@ "publishConfig": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc