@umijs/preset-vue
Advanced tools
Comparing version 4.0.7 to 4.0.8
@@ -1,5 +0,30 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TEMPLATES_DIR = void 0; | ||
const path_1 = require("path"); | ||
exports.TEMPLATES_DIR = (0, path_1.join)(__dirname, '../templates'); | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// constants.ts | ||
var constants_exports = {}; | ||
__export(constants_exports, { | ||
TEMPLATES_DIR: () => TEMPLATES_DIR | ||
}); | ||
module.exports = __toCommonJS(constants_exports); | ||
var import_path = require("path"); | ||
var TEMPLATES_DIR = (0, import_path.join)(__dirname, "../templates"); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
TEMPLATES_DIR | ||
}); |
@@ -1,38 +0,48 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.addAssetRules = void 0; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// assetRules.ts | ||
var assetRules_exports = {}; | ||
__export(assetRules_exports, { | ||
addAssetRules: () => addAssetRules | ||
}); | ||
module.exports = __toCommonJS(assetRules_exports); | ||
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]`, | ||
}); | ||
config.module.rules.delete("asset"); | ||
const { userConfig } = api; | ||
const inlineLimit = parseInt(userConfig.inlineLimit || "10000", 10); | ||
const staticPathPrefix = api.config.staticPathPrefix !== void 0 ? 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; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
addAssetRules | ||
}); |
@@ -1,45 +0,46 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getConfig = void 0; | ||
const pluginWebpack5_js_1 = __importDefault(require("vue-loader/dist/pluginWebpack5.js")); | ||
const assetRules_1 = require("./assetRules"); | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// config.ts | ||
var config_exports = {}; | ||
__export(config_exports, { | ||
getConfig: () => getConfig | ||
}); | ||
module.exports = __toCommonJS(config_exports); | ||
var import_pluginWebpack5 = __toESM(require("vue-loader/dist/pluginWebpack5.js")); | ||
var import_assetRules = require("./assetRules"); | ||
function getConfig(config, api) { | ||
config.module.noParse(/^(vue|vue-router|vuex|vuex-router-sync)$/); | ||
// https://github.com/webpack/webpack/issues/14532#issuecomment-947525539 | ||
config.output.set('hashFunction', 'xxhash64'); | ||
// https://github.com/webpack/webpack/issues/11467#issuecomment-691873586 | ||
config.module | ||
.rule('esm') | ||
.test(/\.m?jsx?$/) | ||
.resolve.set('fullySpecified', false); | ||
config.resolve.extensions.merge(['.vue']).end(); | ||
config.module | ||
.rule('vue') | ||
.test(/\.vue$/) | ||
.use('vue-loader') | ||
.loader(require.resolve('vue-loader')) | ||
.options({ | ||
babelParserPlugins: ['jsx', 'classProperties', 'decorators-legacy'], | ||
}); | ||
config.plugin('vue-loader-plugin').use(pluginWebpack5_js_1.default); | ||
// https://github.com/vuejs/vue-loader/issues/1435#issuecomment-869074949 | ||
config.module | ||
.rule('vue-style') | ||
.test(/\.vue$/) | ||
.resourceQuery(/type=style/) | ||
.sideEffects(true); | ||
// 兼容 element-ui plus | ||
config.module | ||
.rule('fix-element-ui-plus') | ||
.test(/\.mjs$/) | ||
.include.add(/node_modules/) | ||
.end() | ||
.type('javascript/auto') | ||
.resolve.fullySpecified(false); | ||
// asset | ||
(0, assetRules_1.addAssetRules)({ api, config }); | ||
config.module.noParse(/^(vue|vue-router|vuex|vuex-router-sync)$/); | ||
config.output.set("hashFunction", "xxhash64"); | ||
config.module.rule("esm").test(/\.m?jsx?$/).resolve.set("fullySpecified", false); | ||
config.resolve.extensions.merge([".vue"]).end(); | ||
config.module.rule("vue").test(/\.vue$/).use("vue-loader").loader(require.resolve("vue-loader")).options({ | ||
babelParserPlugins: ["jsx", "classProperties", "decorators-legacy"] | ||
}); | ||
config.plugin("vue-loader-plugin").use(import_pluginWebpack5.default); | ||
config.module.rule("vue-style").test(/\.vue$/).resourceQuery(/type=style/).sideEffects(true); | ||
config.module.rule("fix-element-ui-plus").test(/\.mjs$/).include.add(/node_modules/).end().type("javascript/auto").resolve.fullySpecified(false); | ||
(0, import_assetRules.addAssetRules)({ api, config }); | ||
} | ||
exports.getConfig = getConfig; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
getConfig | ||
}); |
@@ -1,55 +0,101 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const path_1 = require("path"); | ||
const resolveProjectDep_1 = require("../utils/resolveProjectDep"); | ||
exports.default = (api) => { | ||
api.describe({ | ||
key: 'preset-vue:default', | ||
}); | ||
const vuePath = (0, resolveProjectDep_1.resolveProjectDep)({ | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __defProps = Object.defineProperties; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropDescs = Object.getOwnPropertyDescriptors; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __spreadValues = (a, b) => { | ||
for (var prop in b || (b = {})) | ||
if (__hasOwnProp.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
if (__getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(b)) { | ||
if (__propIsEnum.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
} | ||
return a; | ||
}; | ||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// default.ts | ||
var default_exports = {}; | ||
__export(default_exports, { | ||
default: () => default_default | ||
}); | ||
module.exports = __toCommonJS(default_exports); | ||
var import_path = require("path"); | ||
var import_resolveProjectDep = require("../utils/resolveProjectDep"); | ||
var default_default = (api) => { | ||
api.describe({ | ||
key: "preset-vue:default" | ||
}); | ||
const vuePath = (0, import_resolveProjectDep.resolveProjectDep)({ | ||
pkg: api.pkg, | ||
cwd: api.cwd, | ||
dep: "vue/dist/vue.esm-bundler.js" | ||
}) || require.resolve("vue/dist/vue.esm-bundler.js"); | ||
const vueRuntimePath = (0, import_resolveProjectDep.resolveProjectDep)({ | ||
pkg: api.pkg, | ||
cwd: api.cwd, | ||
dep: "vue/dist/vue.runtime.esm-bundler.js" | ||
}) || require.resolve("vue/dist/vue.runtime.esm-bundler.js"); | ||
api.modifyDefaultConfig((config) => { | ||
var _a; | ||
config.alias = __spreadProps(__spreadValues({}, config.alias), { | ||
vue: ((_a = api.userConfig.vue) == null ? void 0 : _a.runtimeCompiler) ? vuePath : vueRuntimePath, | ||
"vue-router": (0, import_resolveProjectDep.resolveProjectDep)({ | ||
pkg: api.pkg, | ||
cwd: api.cwd, | ||
dep: 'vue/dist/vue.esm-bundler.js', | ||
}) || require.resolve('vue/dist/vue.esm-bundler.js'); | ||
const vueRuntimePath = (0, resolveProjectDep_1.resolveProjectDep)({ | ||
pkg: api.pkg, | ||
cwd: api.cwd, | ||
dep: 'vue/dist/vue.runtime.esm-bundler.js', | ||
}) || require.resolve('vue/dist/vue.runtime.esm-bundler.js'); | ||
api.modifyDefaultConfig((config) => { | ||
var _a; | ||
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')), | ||
}; | ||
// feature flags https://link.vuejs.org/feature-flags. | ||
config.define = { | ||
...config.define, | ||
__VUE_OPTIONS_API__: true, | ||
__VUE_PROD_DEVTOOLS__: false, | ||
}; | ||
return config; | ||
dep: "vue-router" | ||
}) || (0, import_path.dirname)(require.resolve("vue-router/package.json")) | ||
}); | ||
api.modifyConfig((memo) => { | ||
// react 独有配置需要禁用 | ||
memo.fastRefresh = false; | ||
return memo; | ||
config.define = __spreadProps(__spreadValues({}, config.define), { | ||
__VUE_OPTIONS_API__: true, | ||
__VUE_PROD_DEVTOOLS__: false | ||
}); | ||
api.modifyAppData((memo) => { | ||
memo.framework = 'vue'; | ||
return memo; | ||
}); | ||
api.modifyRendererPath(() => (0, path_1.dirname)(require.resolve('@umijs/renderer-vue/package.json'))); | ||
// 增加运行时key | ||
api.addRuntimePluginKey(() => [ | ||
'router', | ||
'onRouterCreated', | ||
'onAppCreated', | ||
'onMounted', | ||
]); | ||
return config; | ||
}); | ||
api.modifyConfig((memo) => { | ||
memo.fastRefresh = false; | ||
return memo; | ||
}); | ||
api.modifyAppData((memo) => { | ||
memo.framework = "vue"; | ||
return memo; | ||
}); | ||
api.modifyRendererPath(() => (0, import_path.dirname)(require.resolve("@umijs/renderer-vue/package.json"))); | ||
api.modifyBabelPresetOpts((memo) => { | ||
memo.presetTypeScript = { | ||
allExtensions: true, | ||
isTSX: true | ||
}; | ||
return memo; | ||
}); | ||
api.addRuntimePluginKey(() => [ | ||
"router", | ||
"onRouterCreated", | ||
"onAppCreated", | ||
"onMounted" | ||
]); | ||
}; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = {}); |
@@ -1,44 +0,63 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const path_1 = require("path"); | ||
const plugin_utils_1 = require("umi/plugin-utils"); | ||
const constants_1 = require("../../constants"); | ||
exports.default = (api) => { | ||
api.describe({ | ||
key: 'preset-vue:tmpFiles', | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// tmpFiles.ts | ||
var tmpFiles_exports = {}; | ||
__export(tmpFiles_exports, { | ||
default: () => tmpFiles_default | ||
}); | ||
module.exports = __toCommonJS(tmpFiles_exports); | ||
var import_path = require("path"); | ||
var import_plugin_utils = require("umi/plugin-utils"); | ||
var import_constants = require("../../constants"); | ||
var tmpFiles_default = (api) => { | ||
api.describe({ | ||
key: "preset-vue:tmpFiles" | ||
}); | ||
api.onGenerateFiles(async () => { | ||
const rendererPath = (0, import_plugin_utils.winPath)(await api.applyPlugins({ | ||
key: "modifyRendererPath" | ||
})); | ||
api.writeTmpFile({ | ||
noPluginDir: true, | ||
path: "plugin-vue/index.ts", | ||
tplPath: (0, import_path.join)(import_constants.TEMPLATES_DIR, "useAppData.tpl"), | ||
context: { | ||
rendererPath | ||
} | ||
}); | ||
api.onGenerateFiles(async () => { | ||
// useAppData.ts | ||
const rendererPath = (0, plugin_utils_1.winPath)(await api.applyPlugins({ | ||
key: 'modifyRendererPath', | ||
})); | ||
api.writeTmpFile({ | ||
noPluginDir: true, | ||
path: 'plugin-vue/index.ts', | ||
tplPath: (0, path_1.join)(constants_1.TEMPLATES_DIR, 'useAppData.tpl'), | ||
context: { | ||
rendererPath, | ||
}, | ||
}); | ||
}); | ||
api.register({ | ||
key: 'onGenerateFiles', | ||
fn: async () => { | ||
// history.ts | ||
const rendererPath = (0, plugin_utils_1.winPath)(await api.applyPlugins({ | ||
key: 'modifyRendererPath', | ||
})); | ||
api.writeTmpFile({ | ||
noPluginDir: true, | ||
path: 'core/history.ts', | ||
tplPath: (0, path_1.join)(constants_1.TEMPLATES_DIR, 'history.tpl'), | ||
context: { | ||
rendererPath, | ||
}, | ||
}); | ||
// EmptyRoutes.tsx | ||
api.writeTmpFile({ | ||
noPluginDir: true, | ||
path: 'core/EmptyRoute.tsx', | ||
content: ` | ||
}); | ||
api.register({ | ||
key: "onGenerateFiles", | ||
fn: async () => { | ||
const rendererPath = (0, import_plugin_utils.winPath)(await api.applyPlugins({ | ||
key: "modifyRendererPath" | ||
})); | ||
api.writeTmpFile({ | ||
noPluginDir: true, | ||
path: "core/history.ts", | ||
tplPath: (0, import_path.join)(import_constants.TEMPLATES_DIR, "history.tpl"), | ||
context: { | ||
rendererPath | ||
} | ||
}); | ||
api.writeTmpFile({ | ||
noPluginDir: true, | ||
path: "core/EmptyRoute.tsx", | ||
content: ` | ||
import { defineComponent } from 'vue'; | ||
@@ -51,17 +70,18 @@ | ||
}); | ||
`, | ||
}); | ||
// App.vue | ||
api.writeTmpFile({ | ||
noPluginDir: true, | ||
path: 'core/App.vue', | ||
content: ` | ||
` | ||
}); | ||
api.writeTmpFile({ | ||
noPluginDir: true, | ||
path: "core/App.vue", | ||
content: ` | ||
<template> | ||
<router-view></router-view> | ||
</template> | ||
`, | ||
}); | ||
}, | ||
stage: Infinity, | ||
}); | ||
` | ||
}); | ||
}, | ||
stage: Infinity | ||
}); | ||
}; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = {}); |
@@ -1,17 +0,40 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// @ts-ignore | ||
const plugin_vue_1 = __importDefault(require("../../../compiled/@vitejs/plugin-vue")); | ||
exports.default = (api) => { | ||
api.describe({ | ||
key: 'preset-vue:vite', | ||
}); | ||
api.modifyViteConfig((config) => { | ||
var _a; | ||
(_a = config.plugins) === null || _a === void 0 ? void 0 : _a.push((0, plugin_vue_1.default)(api.config.vue)); | ||
return config; | ||
}); | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// vite.ts | ||
var vite_exports = {}; | ||
__export(vite_exports, { | ||
default: () => vite_default | ||
}); | ||
module.exports = __toCommonJS(vite_exports); | ||
var import_plugin_vue = __toESM(require("../../../compiled/@vitejs/plugin-vue")); | ||
var vite_default = (api) => { | ||
api.describe({ | ||
key: "preset-vue:vite" | ||
}); | ||
api.modifyViteConfig((config) => { | ||
var _a; | ||
(_a = config.plugins) == null ? void 0 : _a.push((0, import_plugin_vue.default)(api.config.vue)); | ||
return config; | ||
}); | ||
}; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = {}); |
@@ -1,26 +0,65 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const config_1 = require("./config/config"); | ||
exports.default = (api) => { | ||
api.describe({ | ||
key: 'preset-vue:webpack', | ||
}); | ||
api.chainWebpack((config) => { | ||
(0, config_1.getConfig)(config, api); | ||
return config; | ||
}); | ||
api.modifyConfig((memo) => { | ||
// 处理 mfsu 包含vue 模块的依赖处理 | ||
const enableMFSU = memo.mfsu !== false; | ||
if (enableMFSU) { | ||
memo.mfsu = { | ||
...(memo.mfsu || {}), | ||
chainWebpack(config) { | ||
(0, config_1.getConfig)(config, api); | ||
return config; | ||
}, | ||
}; | ||
var __defProp = Object.defineProperty; | ||
var __defProps = Object.defineProperties; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropDescs = Object.getOwnPropertyDescriptors; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __spreadValues = (a, b) => { | ||
for (var prop in b || (b = {})) | ||
if (__hasOwnProp.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
if (__getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(b)) { | ||
if (__propIsEnum.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
} | ||
return a; | ||
}; | ||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// webpack.ts | ||
var webpack_exports = {}; | ||
__export(webpack_exports, { | ||
default: () => webpack_default | ||
}); | ||
module.exports = __toCommonJS(webpack_exports); | ||
var import_config = require("./config/config"); | ||
var webpack_default = (api) => { | ||
api.describe({ | ||
key: "preset-vue:webpack" | ||
}); | ||
api.chainWebpack((config) => { | ||
(0, import_config.getConfig)(config, api); | ||
return config; | ||
}); | ||
api.modifyConfig((memo) => { | ||
const enableMFSU = memo.mfsu !== false; | ||
if (enableMFSU) { | ||
memo.mfsu = __spreadProps(__spreadValues({}, memo.mfsu || {}), { | ||
chainWebpack(config) { | ||
(0, import_config.getConfig)(config, api); | ||
return config; | ||
} | ||
return memo; | ||
}); | ||
}); | ||
} | ||
return memo; | ||
}); | ||
}; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = {}); |
@@ -1,22 +0,49 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
require("./requireHook"); | ||
exports.default = (api) => { | ||
api.describe({ | ||
key: 'vue', | ||
config: { | ||
schema(joi) { | ||
return joi.object(); | ||
}, | ||
default: {}, | ||
}, | ||
}); | ||
return { | ||
plugins: [ | ||
require.resolve('./features/default'), | ||
require.resolve('./features/webpack'), | ||
require.resolve('./features/tmpFiles/tmpFiles'), | ||
require.resolve('./features/vite/vite'), | ||
], | ||
}; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
default: () => src_default | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
var import_requireHook = require("./requireHook"); | ||
var src_default = (api) => { | ||
api.describe({ | ||
key: "vue", | ||
config: { | ||
schema(joi) { | ||
return joi.object(); | ||
}, | ||
default: {} | ||
} | ||
}); | ||
return { | ||
plugins: [ | ||
require.resolve("./features/default"), | ||
require.resolve("./features/webpack"), | ||
require.resolve("./features/tmpFiles/tmpFiles"), | ||
require.resolve("./features/vite/vite") | ||
] | ||
}; | ||
}; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = {}); |
@@ -1,37 +0,55 @@ | ||
"use strict"; | ||
// MIT: copy from https://github.com/vercel/next.js/blob/canary/packages/next/build/webpack/require-hook.ts | ||
// sync injects a hook for webpack and webpack/... requires to use the internal ncc webpack version | ||
// this is in order for userland plugins to attach to the same webpack instance as umi | ||
// the individual compiled modules are as defined for the compilation in bundles/webpack/packages/* | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.hookPropertyMap = void 0; | ||
// TODO 之后走预打包处理 | ||
// @ts-ignore | ||
const deepImports_json_1 = __importDefault(require("@umijs/bundler-webpack/compiled/webpack/deepImports.json")); | ||
const hookPropertyMap = new Map([ | ||
['webpack', '@umijs/bundler-webpack/compiled/webpack'], | ||
['webpack/package', '@umijs/bundler-webpack/compiled/webpack/package'], | ||
['webpack/package.json', '@umijs/bundler-webpack/compiled/webpack/package'], | ||
['webpack/lib/webpack', '@umijs/bundler-webpack/compiled/webpack'], | ||
['webpack/lib/webpack.js', '@umijs/bundler-webpack/compiled/webpack'], | ||
['tapable', '@umijs/bundler-utils/compiled/tapable'], | ||
['vite', '@umijs/bundler-vite/compiled/vite'], | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target, mod2)); | ||
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2); | ||
// requireHook.ts | ||
var requireHook_exports = {}; | ||
__export(requireHook_exports, { | ||
hookPropertyMap: () => hookPropertyMap | ||
}); | ||
module.exports = __toCommonJS(requireHook_exports); | ||
var import_deepImports = __toESM(require("@umijs/bundler-webpack/compiled/webpack/deepImports.json")); | ||
var hookPropertyMap = /* @__PURE__ */ new Map([ | ||
["webpack", "@umijs/bundler-webpack/compiled/webpack"], | ||
["webpack/package", "@umijs/bundler-webpack/compiled/webpack/package"], | ||
["webpack/package.json", "@umijs/bundler-webpack/compiled/webpack/package"], | ||
["webpack/lib/webpack", "@umijs/bundler-webpack/compiled/webpack"], | ||
["webpack/lib/webpack.js", "@umijs/bundler-webpack/compiled/webpack"], | ||
["tapable", "@umijs/bundler-utils/compiled/tapable"], | ||
["vite", "@umijs/bundler-vite/compiled/vite"] | ||
]); | ||
exports.hookPropertyMap = hookPropertyMap; | ||
deepImports_json_1.default.forEach((item) => { | ||
const name = item.split('/').pop(); | ||
hookPropertyMap.set(item, `@umijs/bundler-webpack/compiled/webpack/${name}`); | ||
hookPropertyMap.set(`${item}.js`, `@umijs/bundler-webpack/compiled/webpack/${name}`); | ||
import_deepImports.default.forEach((item) => { | ||
const name = item.split("/").pop(); | ||
hookPropertyMap.set(item, `@umijs/bundler-webpack/compiled/webpack/${name}`); | ||
hookPropertyMap.set(`${item}.js`, `@umijs/bundler-webpack/compiled/webpack/${name}`); | ||
}); | ||
const mod = require('module'); | ||
const resolveFilename = mod._resolveFilename; | ||
mod._resolveFilename = function (request, parent, isMain, options) { | ||
const hookResolved = hookPropertyMap.get(request); | ||
if (hookResolved) { | ||
request = hookResolved; | ||
} | ||
return resolveFilename.call(mod, request, parent, isMain, options); | ||
var mod = require("module"); | ||
var resolveFilename = mod._resolveFilename; | ||
mod._resolveFilename = function(request, parent, isMain, options) { | ||
const hookResolved = hookPropertyMap.get(request); | ||
if (hookResolved) { | ||
request = hookResolved; | ||
} | ||
return resolveFilename.call(mod, request, parent, isMain, options); | ||
}; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
hookPropertyMap | ||
}); |
@@ -1,15 +0,38 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.resolveProjectDep = void 0; | ||
const path_1 = require("path"); | ||
const plugin_utils_1 = require("umi/plugin-utils"); | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// resolveProjectDep.ts | ||
var resolveProjectDep_exports = {}; | ||
__export(resolveProjectDep_exports, { | ||
resolveProjectDep: () => resolveProjectDep | ||
}); | ||
module.exports = __toCommonJS(resolveProjectDep_exports); | ||
var import_path = require("path"); | ||
var import_plugin_utils = require("umi/plugin-utils"); | ||
function resolveProjectDep(opts) { | ||
var _a, _b; | ||
if (((_a = opts.pkg.dependencies) === null || _a === void 0 ? void 0 : _a[opts.dep]) || | ||
((_b = opts.pkg.devDependencies) === null || _b === void 0 ? void 0 : _b[opts.dep])) { | ||
return (0, path_1.dirname)(plugin_utils_1.resolve.sync(`${opts.dep}/package.json`, { | ||
basedir: opts.cwd, | ||
})); | ||
} | ||
var _a, _b; | ||
if (((_a = opts.pkg.dependencies) == null ? void 0 : _a[opts.dep]) || ((_b = opts.pkg.devDependencies) == null ? void 0 : _b[opts.dep])) { | ||
return (0, import_path.dirname)(import_plugin_utils.resolve.sync(`${opts.dep}/package.json`, { | ||
basedir: opts.cwd | ||
})); | ||
} | ||
} | ||
exports.resolveProjectDep = resolveProjectDep; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
resolveProjectDep | ||
}); |
{ | ||
"name": "@umijs/preset-vue", | ||
"version": "4.0.7", | ||
"version": "4.0.8", | ||
"description": "@umijs/preset-vue", | ||
@@ -20,8 +20,8 @@ "homepage": "https://github.com/umijs/umi/tree/master/packages/preset-vue#readme", | ||
"scripts": { | ||
"build": "pnpm tsc", | ||
"build": "pnpm father build", | ||
"build:deps": "umi-scripts bundleDeps", | ||
"dev": "pnpm build --watch" | ||
"dev": "pnpm father dev" | ||
}, | ||
"dependencies": { | ||
"@umijs/renderer-vue": "4.0.7", | ||
"@umijs/renderer-vue": "4.0.8", | ||
"vue": "3.2.36", | ||
@@ -33,3 +33,3 @@ "vue-loader": "17.0.0", | ||
"@vitejs/plugin-vue": "2.3.1", | ||
"umi": "4.0.7" | ||
"umi": "4.0.8" | ||
}, | ||
@@ -36,0 +36,0 @@ "publishConfig": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
116759
584
1
+ Added@babel/runtime@7.17.9(transitive)
+ Added@umijs/renderer-vue@4.0.8(transitive)
+ Addedregenerator-runtime@0.13.11(transitive)
- Removed@umijs/renderer-vue@4.0.7(transitive)
Updated@umijs/renderer-vue@4.0.8